Skip to content

Move the plone.restapi driver into @plone/controlpanels - #351

Open
sneridagh wants to merge 2 commits into
feat/controlpanels-cssfrom
feat/controlpanels-restapi-driver
Open

sneridagh wants to merge 2 commits into
feat/controlpanels-cssfrom
feat/controlpanels-restapi-driver

Conversation

@sneridagh

Copy link
Copy Markdown
Member

Part of #269, for the Volto port (phase 9). Stacked on #350.

The plone.restapi side of the content types driver moves from @plone/cmsui into @plone/controlpanels, so Aurora and Volto share it. Aurora runs it on the server, and Volto will run it in the browser.

@plone/controlpanels

  • createRestApiDriver(request, backend): the content types driver for plone.restapi. It uses @content-types, @behaviors and @workflows (Endpoints for per-type content settings, behavior order and workflow assignment plone.restapi#2061) when backend says the site has them, and @controlpanels/dexterity-types otherwise, with those capabilities off. Workflow changes finish while the request waits, so the driver returns jobs that are already done.
  • detectRestApi(request): which of those services the backend has. A 404 means it's missing. An unclear answer, such as a 401, is marked so the app doesn't keep it.
  • RestApiRequest: each app passes its own function to call plone.restapi, with its credentials. It resolves with the response's body, and rejects with the status and the body, as @plone/client and Volto's Api do.
  • The payload translations moved here from cmsui, under src/content-types/restapi/: dexterityTypes.ts (was helpers/contentTypes.ts) and contentTypesService.ts (was helpers/contentTypesApi.ts), with their tests. errorMessage also reads response.body.

Aurora (@plone/cmsui)

  • helpers/contentTypesBackend.ts: restApiRequest(cli) adapts @plone/client, and contentTypesDriver(cli) builds the driver for the backend. What a backend has is still kept for a minute.
  • routes/api/contentTypes.tsx is a thin layer over the driver: each route calls one of its methods. It adds @workflow-assignments, and POST @workflow-changes (with ?preview for the dry run).
  • auroraDriver.ts is a thin client for those routes.

No behavior changes.

Checks

See #269 for how to review and merge the stack.

@sneridagh
sneridagh force-pushed the feat/controlpanels-restapi-driver branch from 6167d32 to 95daf29 Compare November 1, 2026 02:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant