CWA 2 is a prerelease (2.0.0-alpha), heading for a beta. It runs production sites; configuration can still change between releases, always with upgrade notes. View versions and support
Cwa Api

cwa.resourcesManager

CRUD operations on resources — create, update, delete, save, and error management.

CRUD operations that talk to the API. These are used internally by the admin panel and are available for advanced custom UIs.

Creating Resources

await cwa.resourcesManager.createResource({
    endpoint: '/component/titles',
    data: { title: 'Hello', uiComponent: 'Title' }
})

Updating Resources

await cwa.resourcesManager.updateResource({
    endpoint: '/component/titles/018e-...',
    data: { title: 'Updated Title' }
})

Deleting Resources

await cwa.resourcesManager.deleteResource({
    endpoint: '/component/titles/018e-...'
})

deleteResource shows a confirmation dialog first — it returns false immediately if the user cancels, and no request is made.

Reordering a Component Group

const saved = await cwa.resourcesManager.orderComponentGroup(groupIri, [
  '/_/component_positions/0190…b',
  '/_/component_positions/0190…a',
])

orderComponentGroup(groupIri, positionIris) sends PATCH <groupIri>/order with the positions in their new order, then updates the stored positions' sortValue from the response. It returns false if the API refuses the order: the error is added to the error store and the group's order is read again from the API. refreshComponentGroupOrder(groupIri) only reads it again.

A position's sortValue is read-only on the API, so don't send it with updateResource: it's ignored. To move one position, send after or before with the IRI of a position in the same group. See How Positions Are Ordered.

Writing Directly to the Store

storeResource({ resource }) writes a resource straight into the local resources store — it makes no API request. It is internal to the module (the password-reset form and component-group reordering use it) and can change without notice.

Your app should never call it to save content. Use createResource / updateResource / deleteResource, or useCwaResourceModel for a bound field, for anything that should reach the API.

Error Management

cwa.resourcesManager.errors        // CwaErrorEvent[]
cwa.resourcesManager.hasErrors     // boolean
cwa.resourcesManager.addError(event)
cwa.resourcesManager.removeError(id)