# new UserRequestHandler(renderingEngine)
Service-based base class implementing the user request lifecycle.
Abstract base class for user request handlers.
Handler methods follow the core Service golden rules: handle (and the
lifecycle helpers getInput/cancel) accept rest contextual args
(...args: ContextualArgs<C>) and obtain their { log, ctx, ctxArgs } via
this.logCtx([request, ...args], this.handle, true) — entry and resolution
via log.info, transitions via log.verbose, payload details via
log.debug and failures/cancellations via log.error. A CancelledError
is thrown when the user cancels mid-request. handle is the one async
method handlers override, returning the resolved value or throwing.
Parameters:
| Name | Type | Description |
|---|---|---|
renderingEngine |
RenderingFacade
|
The rendering-engine surface the handler drives (modal, toast, spinner and router). |
Classes
- UserRequestHandler
- Creates a handler bound to the given rendering-engine facade.
Methods
# protected logCtx(args, operation, allowCreate, overrides) → {UserRequestLogContext.<C, ARGS>|Promise.<UserRequestLogContext.<C, ARGS>>}
Logging + rendering-engine methods for a call.
Logging + rendering-engine methods for a call. Mirrors the
Service logCtx contract and exposes modal/toast/spinner/router
getters wrapping the rendering engine.
Parameters:
| Name | Type | Description |
|---|---|---|
args |
MaybeContextualArg.<C, ARGS>
|
Contextual args (context at the end, or pre-args plus context). |
operation |
METHOD
|
The operation the context is created for. |
allowCreate |
boolean
|
Whether a context is created when none is provided. |
overrides |
Partial.<FlagsOf.<CONTEXT>>
|
Optional flag overrides. |
The contextual surface (or a promise of it when allowCreate is true).
UserRequestLogContext.<C, ARGS>
|
Promise.<UserRequestLogContext.<C, ARGS>>
# wrapLogContext() → {UserRequestLogContext.<C, ARGS>}
Decorates the base contextual surface with the rendering
engine methods exposed as modal/toast/spinner/router bound getters.
Decorates the base contextual surface with the rendering
engine methods exposed as modal/toast/spinner/router bound getters.
The decorated contextual surface.
UserRequestLogContext.<C, ARGS>
# static getHandler(reference) → {Constructor.<UserRequestHandler>|undefined}
Resolves the handler class registered for the given request
reference via Metadata.
Resolves the handler class registered for the given request
reference via Metadata. Handlers are recorded by the @userRequest
decorator under USER_REQUEST_KEY.
Parameters:
| Name | Type | Description |
|---|---|---|
reference |
string
|
The request id/type the handler is registered for. |
The registered handler constructor, or undefined when unknown.
Constructor.<UserRequestHandler>
|
undefined
# static getMetadata(target) → {UserRequestHandlerMetadata|undefined}
Reads the @userRequest metadata recorded on a handler class
via Metadata.
Reads the @userRequest metadata recorded on a handler class
via Metadata.
Parameters:
| Name | Type | Description |
|---|---|---|
target |
object
|
The handler class to inspect. |
The recorded metadata
{ reference }, or undefined when the class is not decorated.
UserRequestHandlerMetadata
|
undefined