pat-filemanger use @plone/client for standard restapi calls#1604
Draft
petschki wants to merge 1 commit into
Draft
pat-filemanger use @plone/client for standard restapi calls#1604petschki wants to merge 1 commit into
pat-filemanger use @plone/client for standard restapi calls#1604petschki wants to merge 1 commit into
Conversation
…hybrid)
Volto's aurora @plone/client (2.0.0-alpha.4) dropped the React/react-query
dependency, so it is usable in this Svelte/Patternslib bundle. Route the
standard restapi calls through the official client; keep the calls the alpha
client can't yet express on the native-fetch request() layer. All calls already
funnel through src/api/*, so this is a contained refactor of that layer.
- api/ploneClient.js: shared client (initialize with apiPath=portalUrl,
apiSuffix="" → no /++api++), client()/toPath()/unwrap(); unwrap returns the
axios .data and maps the client's {status,data,location} rejection to a
RestapiError so callers keep .message/.status/.body. App.svelte inits it
before any store runs.
- Migrated: fetchBreadcrumbs→getBreadcrumbs, pasteItems→move/copyContent,
deleteItem→deleteContent, moveItem→updateContent{ordering}, createFolder→
createContent. Methods are called on the instance (services read this.config).
- Kept custom (alpha client can't express yet): the sorted/batched listing,
workflow transitions, rearrange/set-default-page, tags/properties/rename,
link integrity, and tus upload. The two transports coexist by design.
- docs/upstream-plone-client.md: ready-to-submit diffs+descriptions for the four
wrapper gaps so the rest can migrate once released.
- Tests mock ./ploneClient.js at the api boundary; a jest manual mock at
src/__mocks__/@plone/client.js auto-stubs the package (its CJS build pulls in
ESM-only query-string jest can't load). Suite green; dev build compiles. The
pattern is dynamically imported, so axios/zod land in the lazy filemanager
chunk — core bundle ~unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hybrid implementation
Volto's aurora @plone/client (2.0.0-alpha.4) dropped the React/react-query dependency, so it is usable in this Svelte/Patternslib bundle. Route the standard restapi calls through the official client; keep the calls the alpha client can't yet express on the native-fetch request() layer. All calls already funnel through src/api/*, so this is a contained refactor of that layer.