Resource-scoped CRUD helpers and filter-widget factory for one resource.
Resolves the resource by name from the app context and returns:
resource - the resolved ResourceConfig (or null until loaded).
components - a map of field name -> filter component. The widget is
chosen by field shape (boolean, FK, enum, number, date, inline-ref, or, via
field.autocomplete, text/token/email/phone). In client filter mode
option suggestions derive from data; in server mode FK/ref options are
fetched (FK options are cached globally per target resource).
list, get, create, update, remove - CRUD via the shared axios
client. create/update run sanitizePayload (resolving FK ids to
objects). patch is present only when the spec exposes a PATCH operation.
stream - subscribe to an x-sse stream via EventSource, resolving
{pathParams}; present only for streaming resources.
loading / error - request state (error parsed from the response
body: an array of {msg} errors, a detail string, or message).
Notes:
list/get accept both a bare array and { total, items }; paginated
resources require the latter.
Methods throw (and set error) when the resource is not loaded yet.
Parameters
resourceName: string
The resource name (URL path segment) to bind to.
Returns UseResourceReturn
The bound resource, CRUD methods, filter components, streaming
subscription and request state.
Resource-scoped CRUD helpers and filter-widget factory for one resource.
Resolves the resource by name from the app context and returns:
resource- the resolvedResourceConfig(ornulluntil loaded).components- a map of field name -> filter component. The widget is chosen by field shape (boolean, FK, enum, number, date, inline-ref, or, viafield.autocomplete, text/token/email/phone). Inclientfilter mode option suggestions derive fromdata; inservermode FK/ref options are fetched (FK options are cached globally per target resource).list,get,create,update,remove- CRUD via the shared axios client.create/updaterunsanitizePayload(resolving FK ids to objects).patchis present only when the spec exposes a PATCH operation.stream- subscribe to anx-ssestream viaEventSource, resolving{pathParams}; present only for streaming resources.loading/error- request state (errorparsed from the response body: an array of{msg}errors, adetailstring, ormessage).Notes:
list/getaccept both a bare array and{ total, items }; paginated resources require the latter.error) when the resource is not loaded yet.