-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(drivers): webdav driver #276
base: main
Are you sure you want to change the base?
Conversation
β Live Preview ready!
|
Driver (read-only) is tested and working with Nuxt Content. |
Passing the 'directory' option implies that this source prefix should be stripped from the path.
Hi dear @shareable-vision i love the idea of supporting webdav as a driver! Checking the webdav npm package used, it seems little bit overcomplex. I think we probably can directly implement a webdav client only using native An (old) example to inspire: https://github.com/ai-zelenin/webdav-client-fetch/blob/master/ts/index.ts Do you think you can try to reimplement it with fetch only and no dependencies? ππΌ |
That's a great idea. I will work on it. |
WebDav server sends XML data. Although testing with NextCloud, I'm cross-referencing with other authorities and avoiding any namespaced properties, keeping it minimal and hopefully generally compatible. Native fetch is great . .. but there is not a Node equivalent of browser-native DOMParser. If we can use Any idea for reliably parsing XML with no dependencies? βfolks highly discourage parsing XML with regex. What do you think? βI'm really glad you put me onto this! |
After taking time to consider, I don't think we should use a manual regex approach for parsing the XML for the sake of having zero dependencies, while I really appreciate that you got me to thinking about the efficiency of the package that we're leveraging. WebDav is a standardization of XML βthe parsing of the XML responses is key to the function of the driver, and it is reasonable to require that a user install an additional peer dependency.
|
Hi dear @shareable-vision. Sorry for answering late and thanks for willing to continue working on this. Nice point about XML parser lacking. Looking at Usng bundlephobia.com, fast-xml-parser is 25KB vs JSDom 2.4 MB. We might find something even smaller but i think that's a good start. |
Requires `fast-xml-parser`.
Just pushed re-implementation of read-only version of the Webdav driver using 'fast-xml-parser'. I will work on implementing Will have to study Webdav resource locking. |
I want to work on this a little longer and make some improvements. One very major improvement that I see now will be to use the I'm also mulling over the advantages of polling. Will study the other drivers more about this . . WebDAV uses 'etag' to version files. When re-syncing does need to happen, the etag can be referenced to quickly validate the cache. |
Thanks for updates and nice work on this @shareable-vision I have marked PR as draft in meantime please ping when felt ready I will also check locally in coming days and try to help if fine for you ππΌ |
β¦rectories. Implement optional 'infinityDepthHeaderUnavailable' to use fallback mechanism.
Perfect π Did implement Will do write functions as best as I can without getting into the weeds about locked resources. Will touch base soon. |
Almost ready for review. Open to feedback.
WebDAV defines Concerns:Can optimize PUT request?: I'm not sure if the PUT requests may be optimized by using a ReadableStream. Probably because they are already utf8-encoded, this won't make any difference . . What should be the desired behavior of the My thinking previously was that an undefined Polling? I haven't implemented any polling (which might be configurable via an 'interval' key). I'm not sure if it's a good idea. It seems like the driver consumer can do that if they wish simply by re-calling |
* Consolidate redundant assignment of latest.atime * Avoid bug of early return on failing to make (already existent) empty directory, which will occur because Object.keys(files) does not provide keys/meta for empty directories. * Use delete keyword on files[key].body when etag changes.
* undefined 'ttl' disables cache expiration. * `getKeys()` always refetches meta from source; uses 'etag' to validate. Update docs: * setItem/removeItem functions are available.
Driver is ready for review. |
π Linked issue
Issue #275
β Type of change
π Description
Webdav driver for unstorage powered by the
webdav
NPM package.π Checklist
Considerations
The driver currently only implements read-only functions.
To-do
setItem
andremoveItem
, leveragingputFileContents
anddeleteFile