The CWA is in heavy development
The CWA is still in alpha and not ready for production - some code and implementations are likely to change. If you would like to try out the CWA, please enjoy what we have provided and feel free to provide feedback, or get involved on GitHub.
DraftCwa 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({
iri: '/component/titles/018e-...'
})
Saving (Upsert-style)
saveResource handles both create and update depending on whether the IRI is the NEW_RESOURCE_IRI sentinel:
cwa.resourcesManager.saveResource({ endpoint, data })
Error Management
cwa.resourcesManager.errors // CwaErrorEvent[]
cwa.resourcesManager.hasErrors // boolean
cwa.resourcesManager.addError(event)
cwa.resourcesManager.removeError(id)