@askrjs/server/askr
Exports from the declarations published in @askrjs/server. Signatures reflect the published artifact.
Exports
This entrypoint publishes 12 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.
ActionHandlertype
ActionHandler: (context: ActionHandlerContext, input: Input, dependencies: Dependencies) => ActionOutcome<Result> | Promise<ActionOutcome<Result>>A server action's business logic: validated input in, an {@link ActionOutcome} out.
ActionOutcometype
ActionOutcome: anyThe result of a successful {@link ActionHandler} invocation: an optional redirect, result payload, and cookies.
redirect- readonly redirect?: string;
result- readonly result?: Result;
cookies- readonly cookies?: readonly ActionCookieInstruction[];
ActionRegistrytype
ActionRegistry: anyA registry of server actions, as created by {@link defineServerActions }, used by {@link createAskrPageHandler }.
entries- readonly entries: readonly Readonly<{ descriptor: ActionDescriptor; }>[];
csrfToken- csrfToken(context: ServerContext): Promise<string | undefined>;
execute- execute(context: ServerContext, options: ActionExecutionOptions): Promise<ActionExecution | undefined>;
AskrApptype
AskrApp: anyA configured Askr application, as returned by {@link createAskrApp}.
fetch- fetch(request: Request): Promise<Response>;
toOpenApiDocument- toOpenApiDocument(): OpenApiDocument;
close- close(): Promise<void>;
AskrAppApitype
AskrAppApi: anyThe API group passed to {@link AskrAppApiOptions.define}, extended with a schema helper.
schema- schema: ApiDefinition<Dependencies>["schema"];
AskrAppOptionstype
AskrAppOptions: anyOptions for {@link createAskrApp}.
name- readonly name: string;
version- readonly version: string;
dependencies- readonly dependencies: Dependencies;
pages- readonly pages: RouteRegistry;
queryRegistry- readonly queryRegistry?: ServerQueryRegistry;
api- readonly api?: AskrAppApiOptions<Dependencies>;
actions- readonly actions?: ActionRegistryOptions & { readonly handlers: readonly ActionRegistration<Dependencies>[]; };
auth- readonly auth?: AskrAppAuthOptions<P>;
middleware- readonly middleware?: readonly Middleware[];
probes- readonly probes?: ProbeOptions;
telemetry- readonly telemetry?: ServerTelemetry;
onError- readonly onError?: ServerAppOptions["onError"];
onAccessDenied- readonly onAccessDenied?: ServerAppOptions["onAccessDenied"];
close- readonly close?: (dependencies: Dependencies) => void | Promise<void>;
cspNonce- readonly cspNonce?: CspNonceProvider;
AskrPageHandlerOptionstype
AskrPageHandlerOptions: anyOptions for {@link createAskrPageHandler}.
registry- registry: RouteRegistry;
auth- auth?: RouteAuthOptions;
queryRegistry- queryRegistry?: ServerQueryRegistry;
seed- seed?: number;
actions- actions?: ActionRegistry;
cspNonce- cspNonce?: CspNonceProvider;
createAskrApptype
createAskrApp: <Dependencies, P extends Principal = Principal>(options: AskrAppOptions<Dependencies, P>) => AskrAppAssembles a complete Askr application from page routes, an optional OpenAPI-described API,
optional server actions, and optional authentication — wiring an API router (mounted at
options.api?.prefix, default /api), auth routes, and a page-rendering fallback handler
into a single {@link ServerApp }-like object.
createAskrPageHandlertype
createAskrPageHandler: (options: AskrPageHandlerOptions) => HandlerCreates a catch-all route {@link Handler} that server-renders Askr framework pages: routes
GET/HEAD requests through Askr's SSR pipeline, and (if options.actions is provided)
dispatches POST requests as form actions, re-rendering the page with validation errors on
failure or following a redirect/response on success.
defineServerActionstype
defineServerActions: <Dependencies>(options: ServerActionsOptions<Dependencies>, ...entries: readonly ActionRegistration<Dependencies>[]) => ActionRegistryBuilds an {@link ActionRegistry} from a set of {@link ActionEntry}s (via {@link handleAction}),
wiring up CSRF token issuance/verification (unless options.csrf is false), submission
parsing (JSON or form-encoded), input validation, telemetry, and response negotiation
(redirect vs. JSON envelope) for each action invocation.
handleActiontype
handleAction: <Dependencies, Input extends Record<string, unknown>, Result = unknown>(descriptor: ActionDescriptor<Input>, handler: ActionHandler<Dependencies, Input, Result>) => ActionEntry<Dependencies, Input, Result>Pairs an action descriptor (its ID and input schema) with a typed handler, ready to pass to {@link defineServerActions}.
ServerActionsOptionstype
ServerActionsOptions: anyOptions for {@link defineServerActions }.
dependencies- readonly dependencies: Dependencies;