@loozo/angular-launch 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +715 -255
  2. package/builders/application.js +32 -3
  3. package/builders/channel-forwarding.d.ts +15 -0
  4. package/builders/channel-forwarding.js +61 -0
  5. package/builders/options.d.ts +6 -2
  6. package/builders/options.js +16 -5
  7. package/builders/serve.js +198 -140
  8. package/channel.d.ts +3 -1
  9. package/channel.js +3 -2
  10. package/client.d.ts +14 -24
  11. package/generation/index.d.ts +2 -123
  12. package/generation/index.js +3 -685
  13. package/generation/redirects.d.ts +14 -0
  14. package/generation/redirects.js +43 -0
  15. package/generation/run.d.ts +168 -0
  16. package/generation/run.js +659 -0
  17. package/index.d.ts +2 -0
  18. package/index.js +1 -0
  19. package/launch-queries.d.ts +16 -0
  20. package/launch-queries.js +3 -0
  21. package/navigation.d.ts +3 -3
  22. package/navigation.js +1 -1
  23. package/node/index.d.ts +3 -0
  24. package/node/index.js +6 -3
  25. package/node/upgrade-listener-slot.d.ts +1 -0
  26. package/node/upgrade-listener-slot.js +4 -0
  27. package/outcomes.d.ts +23 -7
  28. package/outcomes.js +58 -12
  29. package/package.json +15 -11
  30. package/redirect-translation.d.ts +53 -0
  31. package/redirect-translation.js +141 -0
  32. package/{generated.js → remote-client.js} +27 -21
  33. package/route-types.d.ts +130 -0
  34. package/route-types.js +1 -0
  35. package/route.d.ts +45 -0
  36. package/route.js +113 -0
  37. package/schemas/application.json +19 -3
  38. package/schemas/serve.json +3 -3
  39. package/server/application.d.ts +107 -0
  40. package/server/application.js +108 -0
  41. package/server/backend.d.ts +25 -13
  42. package/server/backend.js +39 -24
  43. package/server/channel-messages.d.ts +1 -1
  44. package/server/channel-messages.js +1 -1
  45. package/server/channel-socket.d.ts +1 -1
  46. package/server/definitions.d.ts +146 -298
  47. package/server/definitions.js +29 -117
  48. package/server/dispatch.d.ts +67 -63
  49. package/server/dispatch.js +121 -61
  50. package/server/event-stream.d.ts +2 -2
  51. package/server/event-stream.js +1 -1
  52. package/server/generated.d.ts +2 -1
  53. package/server/generated.js +2 -1
  54. package/server/index.d.ts +3 -2
  55. package/server/index.js +2 -1
  56. package/server/outcomes.d.ts +26 -13
  57. package/server/outcomes.js +43 -16
  58. package/server/read-cookies.d.ts +19 -0
  59. package/server/read-cookies.js +39 -0
  60. package/server/response-effects.d.ts +2 -2
  61. package/server/stages.d.ts +62 -0
  62. package/server/stages.js +51 -0
  63. package/server/upgrade.d.ts +11 -12
  64. package/server/upgrade.js +13 -14
  65. package/source-text.d.ts +1 -0
  66. package/source-text.js +56 -0
  67. package/stream.d.ts +6 -3
  68. package/stream.js +8 -6
  69. package/tanstack-query/README.md +15 -15
  70. package/tanstack-query/create-queries.d.ts +2 -0
  71. package/tanstack-query/{generated.js → create-queries.js} +8 -9
  72. package/tanstack-query/hydration-window.d.ts +11 -0
  73. package/tanstack-query/hydration-window.js +9 -0
  74. package/tanstack-query/hydration.d.ts +4 -14
  75. package/tanstack-query/hydration.js +9 -12
  76. package/tanstack-query/index.d.ts +1 -1
  77. package/tanstack-query/queries.d.ts +42 -27
  78. package/testing/call-procedure.d.ts +154 -0
  79. package/testing/call-procedure.js +97 -0
  80. package/testing/index.d.ts +2 -0
  81. package/testing/index.js +1 -0
  82. package/generation/context-file.d.ts +0 -2
  83. package/generation/context-file.js +0 -3
  84. package/tanstack-query/generated.d.ts +0 -5
  85. /package/{generated.d.ts → remote-client.d.ts} +0 -0
@@ -1,86 +1,49 @@
1
1
  import { createErrors, declaredFailures } from "./errors.js";
2
2
  /**
3
- * Defines the application's per-request server context.
3
+ * Creates a middleware: code that runs around a procedure call, to refuse it or wrap the
4
+ * rest of it.
4
5
  *
5
6
  * @remarks
6
- * Default-export the call itself from exactly one file in your application's sources,
7
- * as `export default defineContext(...)`: generation finds it by that default export and
8
- * registers its awaited return type as {@link Context}. Import `defineContext` by name
9
- * from this entry point and call it without type arguments; a context assigned to a
10
- * variable and exported later, or `defineContext<MyContext>(...)`, fails generation.
11
- * The factory runs once per live server request, for page renders
12
- * and RPC requests alike, and its value is the `context` middleware and handlers start
13
- * from. Keep per-request state in the context rather than in module variables.
14
- *
15
- * When Angular prerenders a page that calls an RPC, the factory runs at build time with a
16
- * cookie-less `GET` of the page's URL on a local origin Angular picks, so a prerendered
17
- * page shows what an anonymous visitor would see.
18
- *
19
- * @example
20
- * ```ts
21
- * import { defineContext } from "@loozo/angular-launch/server";
22
- * import { sessions } from "./sessions.server";
23
- *
24
- * export default defineContext(async (request: Request) => ({
25
- * user: await sessions.authenticate(request),
26
- * }));
27
- * ```
28
- *
29
- * @typeParam Value - The factory's return type, possibly a promise.
30
- * @param create - Creates the context for one request. A rejection or throw fails that
31
- * request: an RPC request returns `INTERNAL`.
32
- * @returns The context definition to default-export.
33
- */
34
- export function defineContext(create) {
35
- return { create };
36
- }
37
- /**
38
- * Creates a middleware: code that runs around a procedure call, to refuse it, add typed
39
- * values to its context, or wrap the rest of it.
40
- *
41
- * @remarks
42
- * List middleware in `defineRpc`'s `use` to run it for every procedure in the group, or
43
- * in a procedure's `use` to run it for that procedure. A call runs the group's
44
- * middleware with no input, then validates the input, then runs the procedure's
45
- * middleware with the validated input, then the handler. Middleware runs for every
46
- * call, also during server rendering, where `request` is the page request, and when
47
- * Angular prerenders a page, where it's a cookie-less `GET` of the page's URL.
7
+ * List middleware in a route's `.use()` to run it for that route's own procedures, or in
8
+ * a procedure's `use` to run it for that procedure. Those lists also take a bare `run`
9
+ * function, typed with the route's context and, on a procedure, the validated input, so use
10
+ * `middleware` for middleware you share. A call runs the owning route's stages,
11
+ * then its `.use()` middleware with no input, then validates the input, then runs the
12
+ * procedure's middleware with the validated input, then the handler. Middleware runs for
13
+ * every call, also during server rendering, where `request` is the page request, and when
14
+ * Angular prerenders a page, where it's a cookie-less `GET` of the page's URL. A route's
15
+ * `.use()` isn't inherited: a child route's procedures don't run it.
48
16
  *
49
17
  * `run` must call `next()` exactly once and return its result: calling it twice or
50
- * returning anything else fails the call with `INTERNAL`. `next(added)` merges `added`
51
- * into the context by spread, so the context must be a plain object. The context is
52
- * read-only at the top level: change it through `next()`. Every `next(...)` in a
53
- * middleware adds the same keys, and a value that differs per branch goes in one
54
- * `next()` call with a union-typed value, such as
55
- * `next({ user: preview ? null : context.user })`: separate `next({ user: null })` and
56
- * `next({ user: context.user })` calls don't infer `User | null` when `context.user` is
57
- * a `User`. `next()` rejects when anything after it throws, so `await next()` in a `try`
58
- * wraps the rest of the call.
18
+ * returning anything else fails the call with `INTERNAL`. `next()` rejects when anything
19
+ * after it throws, so `await next()` in a `try` wraps the rest of the call. Middleware
20
+ * can't add to the context: derive values in a `.context()` stage instead.
59
21
  *
60
22
  * Refuse a call with `throw forbidden()`, which fails it with `FORBIDDEN`, or answer it
61
- * with `throw notFound()` or `throw redirect(to)`. Any other exception fails it with
23
+ * with `throw notFound()` or `throw redirect(destination, values)`. Any other exception fails it with
62
24
  * `INTERNAL` and is logged on the server. Declared errors belong to handlers.
63
25
  *
64
26
  * @example
65
27
  * ```ts
66
- * import { forbidden, middleware } from "@loozo/angular-launch/server";
28
+ * import { middleware } from "@loozo/angular-launch/server";
67
29
  *
68
- * export const signedIn = middleware(async ({ context, next }) => {
69
- * if (context.user === null) {
70
- * throw forbidden();
71
- * }
30
+ * export const timing = middleware(async ({ next, response }) => {
31
+ * const start = performance.now();
72
32
  *
73
- * return next({ user: context.user });
33
+ * try {
34
+ * return await next();
35
+ * } finally {
36
+ * response.headers.append("server-timing", `rpc;dur=${performance.now() - start}`);
37
+ * }
74
38
  * });
75
39
  * ```
76
40
  *
77
- * @typeParam Needs - The context it needs, from an annotated argument. Defaults to
78
- * {@link Context}.
79
- * @typeParam Added - The values it adds, inferred from what it passes to `next()`.
80
- * @typeParam Input - The input it needs, from an annotated argument. Defaults to
81
- * `unknown`.
41
+ * @typeParam Needs - The context it needs. Defaults to `{}`, also when the call is written
42
+ * inline in `.use()`: pass the keys it reads, as in `middleware<{ user: User }>(…)`, or
43
+ * write a bare function there instead.
44
+ * @typeParam Input - The input it needs. Defaults to `unknown`.
82
45
  * @param run - Runs the middleware for one call.
83
- * @returns The middleware, to list in a `use` array.
46
+ * @returns The middleware, to list in `.use()` or a procedure's `use`.
84
47
  */
85
48
  export function middleware(run) {
86
49
  return { run };
@@ -99,60 +62,9 @@ function procedure(kind, { input, message, use = [], errors = {}, handler }) {
99
62
  };
100
63
  }
101
64
  // The checked option types above tie each result to its builder's type parameters.
102
- const builder = {
65
+ export const builder = {
103
66
  query: (options) => procedure("query", options),
104
67
  mutation: (options) => procedure("mutation", options),
105
68
  stream: (options) => procedure("stream", options),
106
69
  channel: (options) => procedure("channel", options),
107
70
  };
108
- /**
109
- * Defines the RPC group for the route declared in the same directory.
110
- *
111
- * @remarks
112
- * Default-export the result from a file next to the route's `route.ts`; one group per
113
- * route. That route must be one that gets generated files: not a redirect, and with a
114
- * page or descendants with pages that aren't all redirects. Generation reads the call
115
- * statically without running it: import `defineRpc` by name from this entry point and
116
- * call it directly without type arguments, with a literal identifier other than
117
- * `__proto__` for the namespace; pass an arrow function whose parameter destructures
118
- * `query` and/or `mutation` without renaming and whose body is a parenthesized object
119
- * literal of procedures, each a direct `query(...)` or `mutation(...)` call with inline
120
- * options; and write the group options inline. Each route's generated `injectRpc()`
121
- * exposes its own group and its ancestors' groups under their namespaces. Each namespace
122
- * must be unique across the app: calls go to `/_rpc/<namespace>/<procedure>`.
123
- *
124
- * The group's `use` middleware runs for every procedure in the group, before input
125
- * validation, and the procedures' handlers and middleware see what it adds to the
126
- * context. It isn't inherited through the route tree.
127
- *
128
- * Exposure isn't authorization: anyone who can reach the server can call any
129
- * procedure, so protect every group and procedure that needs it.
130
- *
131
- * @example
132
- * ```ts
133
- * import { defineRpc } from "@loozo/angular-launch/server";
134
- * import { signedIn } from "../../auth.server";
135
- *
136
- * export default defineRpc(
137
- * "todos",
138
- * ({ query }) => ({
139
- * list: query({
140
- * handler: ({ context }) => context.db.todos.listForUser(context.user.id),
141
- * }),
142
- * }),
143
- * { use: [signedIn] },
144
- * );
145
- * ```
146
- *
147
- * @typeParam Name - The namespace literal.
148
- * @typeParam Use - The group's middleware, written inline.
149
- * @typeParam Procedures - The procedures, keyed by name.
150
- * @param name - The namespace the generated client exposes the group under.
151
- * @param build - Returns the procedures, keyed by name, built with the `query` and
152
- * `mutation` builders it receives.
153
- * @param options - `use`: middleware that runs for every procedure in the group.
154
- * @returns The group, to default-export.
155
- */
156
- export function defineRpc(name, build, { use, } = {}) {
157
- return { name, procedures: build(builder), use: use ?? [] };
158
- }
@@ -1,56 +1,51 @@
1
1
  import { type FrameworkCode } from "../client.js";
2
2
  import { type InputIssue } from "../input-issues.js";
3
- import type { ContextDefinition, ContextOf, Group, ProcedureDefinition } from "./definitions.js";
3
+ import type { ApplicationBinding } from "./application.js";
4
4
  import { type ChannelInbox } from "./channel-messages.js";
5
5
  import { type StreamStart } from "./event-stream.js";
6
6
  import { type ResponseEffects } from "./response-effects.js";
7
- /**
8
- * The application's RPC groups, keyed by namespace.
9
- *
10
- * @remarks
11
- * Internal; not exported from a public entry point. Generation writes it as
12
- * `registry` in `server.generated.ts`.
13
- */
14
- export type Registry = Readonly<Record<string, Group<string, Record<string, ProcedureDefinition>>>>;
15
7
  declare const scopeMarker: unique symbol;
16
8
  /**
17
- * The application identity and context definition that requests are bound to.
9
+ * A live server request bound to its application, holding the request's lazy context.
18
10
  *
19
11
  * @remarks
20
- * Internal; not exported from a public entry point. Generation writes it as
21
- * `appBinding` in `server.generated.ts`.
22
- *
23
- * @typeParam Definition - The application's context definition.
12
+ * Created by the generated `createRequestScope` in `server.generated.ts`, which runs no
13
+ * stage: each route's `.context()` stage runs at most once per scope, the first time an
14
+ * RPC call needs it. Render a page by passing `scope.request` together with `scope` as
15
+ * Angular's request context; RPC calls during that render fail with `INTERNAL` if the two
16
+ * don't belong together.
24
17
  */
25
- export interface ApplicationBinding<Definition extends ContextDefinition<unknown> = ContextDefinition<unknown>> {
26
- /** The generated application identity. */
27
- readonly id: string;
28
- /** The application's context definition. */
29
- readonly context: Definition;
30
- }
31
- /**
32
- * A live server request bound to the context created for it.
33
- *
34
- * @remarks
35
- * Created by the generated `createContext` in `server.generated.ts`.
36
- * Render a page by passing `scope.request` together with `scope` as Angular's request
37
- * context; RPC calls during that render fail with `INTERNAL` if the two don't belong
38
- * together.
39
- *
40
- * @typeParam Value - The context value.
41
- */
42
- export interface RequestScope<Value = unknown> {
18
+ export interface RequestScope {
43
19
  /** The identity of the application the scope was created for. */
44
20
  readonly appId: string;
45
21
  /** A random identifier tying `request` to this scope. */
46
22
  readonly binding: string;
47
23
  /** A clone of the original request that carries the scope binding. */
48
24
  readonly request: Request;
49
- /** The awaited context value created for `request`. */
50
- readonly value: Value;
51
- /** Internal brand of genuine request scopes; not public API. */
52
- readonly [scopeMarker]: true;
25
+ /** Internal: holds the scope's stage runner and rendering calls; not public API. */
26
+ readonly [scopeMarker]: object;
53
27
  }
28
+ /**
29
+ * Runs one call made while rendering a page in the copy of the package that created
30
+ * `scope`, with that copy's application binding.
31
+ *
32
+ * @remarks
33
+ * Internal; not exported from a public entry point. Angular bundles the server entry, which
34
+ * creates the scope and answers RPCs, apart from the server application, which renders, so
35
+ * modules both import exist once in each bundle. Running the call in the creating copy
36
+ * runs the stages, middleware and handlers of the bundle that answers RPCs, so a page and
37
+ * an RPC of one server share their module state. The call otherwise runs as
38
+ * {@link runProcedure} in `"rendering"` mode, which checks the scope again.
39
+ *
40
+ * @param scope - A scope that passed {@link assertBoundScope} for the rendering application.
41
+ * @param path - The request path.
42
+ * @param envelope - The parsed request body.
43
+ * @param request - The page request the scope is bound to.
44
+ * @param signal - The call's abort signal.
45
+ * @param effects - Collects the call's cookies and headers.
46
+ * @returns The reply to deliver.
47
+ */
48
+ export declare function runRenderingCall(scope: RequestScope, path: string, envelope: unknown, request: Request, signal: AbortSignal, effects: ResponseEffects): Promise<Reply>;
54
49
  /**
55
50
  * Checks whether a value has the shape of a {@link RequestScope}.
56
51
  *
@@ -63,40 +58,49 @@ export interface RequestScope<Value = unknown> {
63
58
  */
64
59
  export declare function isRequestScope(value: unknown): value is RequestScope;
65
60
  /**
66
- * Creates the context for a live server request and binds them into a
67
- * {@link RequestScope}.
61
+ * Binds a live server request into a {@link RequestScope}, running nothing.
68
62
  *
69
63
  * @remarks
70
64
  * Internal: exported only from `@loozo/angular-launch/_server` for the generated
71
- * `createContext` in `server.generated.ts`; call that instead.
65
+ * `createRequestScope` in `server.generated.ts`; call that instead.
72
66
  * The scope's `request` is a clone of `request` with an added
73
- * `x-loozo-launch-scope` header, so the original stays usable. The context factory
74
- * receives that clone.
67
+ * `x-loozo-launch-scope` header, so the original stays usable. Stages receive that clone
68
+ * and its signal. Calls made while rendering with the scope run with `application`, in
69
+ * this copy of the package: see {@link runRenderingCall}.
75
70
  *
76
- * @typeParam Definition - The application's context definition.
77
71
  * @param application - The application binding.
78
72
  * @param request - The live server request.
79
73
  * @returns The request scope.
80
- * @throws Rejects with whatever the context factory throws or rejects with, or with a
81
- * `TypeError` when `request`'s body was already read and can't be cloned.
74
+ * @throws TypeError when `request`'s body was already read and can't be cloned.
82
75
  */
83
- export declare function createRequestScope<Definition extends ContextDefinition<unknown>>(application: ApplicationBinding<Definition>, request: Request): Promise<RequestScope<ContextOf<Definition>>>;
76
+ export declare function createRequestScope(application: ApplicationBinding, request: Request): RequestScope;
84
77
  export declare function assertBoundScope(scope: unknown, application: ApplicationBinding, request: Request): asserts scope is RequestScope;
85
78
  /**
86
- * The HTTP status and JSON body {@link dispatch} produces for one call. Internal.
79
+ * The HTTP status and JSON body {@link runProcedure} produces for one call. Internal.
87
80
  *
88
81
  * @remarks
89
- * Only status 200 is a result; every other status carries a frame dispatch built itself,
82
+ * Only status 200 is a result; every other status carries a frame `runProcedure` built itself,
90
83
  * so a result shaped like a frame stays data.
91
84
  */
92
85
  export interface Reply {
93
86
  /** 200 for a result, 303 for a redirect, otherwise the error's or not-found's status. */
94
87
  readonly status: number;
95
88
  /**
96
- * The result, an `{ error: { code, message, data } }` frame, `{ redirect: { to } }` or
89
+ * The result, an `{ error: { code, message, data } }` frame, `{ redirect: { to } }` (with
90
+ * `words` too for a translated application's destination with static segments) or
97
91
  * `{ notFound: null }`.
98
92
  */
99
93
  readonly body: unknown;
94
+ /**
95
+ * The stage that failed the call with an unexpected error, for diagnostics such as a
96
+ * prerender fault. Never sent: only `body` reaches the wire.
97
+ */
98
+ readonly failedStage?: {
99
+ /** The failing stage's route file. */
100
+ readonly route: string;
101
+ /** What the stage threw. */
102
+ readonly error: unknown;
103
+ };
100
104
  }
101
105
  export declare function failure(code: Exclude<FrameworkCode, "INVALID_INPUT">): Reply;
102
106
  export declare function invalidInput(issues?: readonly InputIssue[]): Reply;
@@ -117,13 +121,17 @@ export declare function isJsonMediaType(contentType: string | null): boolean;
117
121
  * `RPC_NOT_FOUND`; the
118
122
  * envelope must be strict JSON (`INTERNAL` otherwise, such as for `{ input: undefined }`,
119
123
  * a cycle or an accessor), and exactly `{ input }` (`INVALID_INPUT` with no issues);
120
- * the group's middleware runs with no input; the input must pass the schema
124
+ * the owning route's stages run, root first, each at most once per scope (a stage that
125
+ * throws `forbidden()`, `notFound()` or `redirect()` answers with that outcome, and any
126
+ * other failure gives `INTERNAL` with the reply's `failedStage` naming it); the owning
127
+ * route's `.use()` middleware runs with no input; the input must pass the schema
121
128
  * (`INVALID_INPUT` with the schema's issues), or be `null` without one (`INVALID_INPUT`
122
129
  * with no issues); the procedure's middleware runs with the validated input; then the
123
130
  * handler. The handler's strict JSON result is returned with status 200, and its
124
131
  * declared errors with their status. `forbidden()` thrown from middleware or the
125
132
  * handler gives `FORBIDDEN`, `notFound()` a 404 with `{ notFound: null }` and
126
- * `redirect(to)` a 303 with `{ redirect: { to } }`; a middleware that calls `next` twice
133
+ * `redirect()` a 303 with `{ redirect: { to } }` (plus `words` in a translated application);
134
+ * a middleware that calls `next` twice
127
135
  * or doesn't return its result gives `INTERNAL`.
128
136
  *
129
137
  * A stream's handler returns an iterable instead of a result. Its iterator goes to
@@ -135,13 +143,12 @@ export declare function isJsonMediaType(contentType: string | null): boolean;
135
143
  * `inbox` and validated with its message schema. A message that fails validation, or a
136
144
  * protocol violation the inbox reports, ends the call with `INVALID_INPUT`.
137
145
  *
138
- * Middleware and handlers set cookies and headers through `effects.control`; the caller
139
- * commits and applies them.
146
+ * Stages, middleware and handlers set cookies and headers through `effects.control`; the
147
+ * caller commits and applies them. A stage writes to the call that first ran it.
140
148
  *
141
- * @param registry - The application's RPC groups.
142
149
  * @param path - The request path.
143
150
  * @param envelope - The parsed request body.
144
- * @param scope - The request scope whose context the call receives.
151
+ * @param scope - The request scope whose stages the call runs.
145
152
  * @param application - The application binding the scope must belong to.
146
153
  * @param request - The request the scope must be bound to.
147
154
  * @param mode - `"http"` for browser requests (the default), `"socket"` for websocket
@@ -153,7 +160,7 @@ export declare function isJsonMediaType(contentType: string | null): boolean;
153
160
  * @param inbox - A channel's incoming messages.
154
161
  * @returns The reply to send.
155
162
  */
156
- export declare function dispatch(registry: Registry, path: string, envelope: unknown, scope: RequestScope, application: ApplicationBinding, request: Request, mode?: "http" | "socket" | "rendering", signal?: AbortSignal, effects?: ResponseEffects, start?: (stream: StreamStart) => void, inbox?: ChannelInbox): Promise<Reply>;
163
+ export declare function runProcedure(path: string, envelope: unknown, scope: RequestScope, application: ApplicationBinding, request: Request, mode?: "http" | "socket" | "rendering", signal?: AbortSignal, effects?: ResponseEffects, start?: (stream: StreamStart) => void, inbox?: ChannelInbox): Promise<Reply>;
157
164
  /**
158
165
  * Options for the generated `handleRequest` and `handleUpgrade` in `server.generated.ts`.
159
166
  */
@@ -189,14 +196,13 @@ export declare function crossSiteReason(request: Request, origins: readonly stri
189
196
  * app's own origin, otherwise the reply is `FORBIDDEN`: an `Origin` listed in `origins`
190
197
  * passes; otherwise `Sec-Fetch-Site`, when sent, must be `same-origin`; otherwise
191
198
  * `Origin`, when sent, must equal the request URL's origin; a request with neither
192
- * header is refused. No context is created for any of these refusals. A fresh context
193
- * is then created before the body is parsed; if that fails the reply is `INTERNAL`, even
194
- * when the body isn't JSON. Otherwise a body that isn't JSON gives `INVALID_INPUT` with
195
- * no issues.
199
+ * header is refused. No stage runs for any of these refusals. A fresh request scope is
200
+ * then created, which runs nothing, and a body that isn't JSON gives `INVALID_INPUT` with
201
+ * no issues before any stage runs.
196
202
  * JSON responses carry `Cache-Control: private, no-store`, `Vary: Cookie` and
197
203
  * `X-Content-Type-Options: nosniff`.
198
204
  *
199
- * Once the call reached `dispatch`, its response carries the headers and cookies the
205
+ * Once the call reached {@link runProcedure}, its response carries the headers and cookies the
200
206
  * call set, whatever its outcome. Launch's own headers replace the call's headers of the
201
207
  * same name, and each cookie adds a `Set-Cookie` header.
202
208
  *
@@ -208,14 +214,12 @@ export declare function crossSiteReason(request: Request, origins: readonly stri
208
214
  * ones set when the handler returned its iterable: setting a cookie later throws, and
209
215
  * later header changes are ignored.
210
216
  *
211
- * @typeParam Definition - The application's context definition.
212
- * @param registry - The application's RPC groups.
213
217
  * @param application - The application binding.
214
218
  * @param request - The incoming server request.
215
219
  * @param options - The allowed hosts and further allowed origins.
216
220
  * @returns The RPC response, or `null` when the path doesn't start with `/_rpc/`.
217
221
  */
218
- export declare function handleRpc<Definition extends ContextDefinition<unknown>>(registry: Registry, application: ApplicationBinding<Definition>, request: Request, { allowedHosts, origins }: HandleOptions): Promise<Response | null>;
222
+ export declare function handleRpc(application: ApplicationBinding, request: Request, { allowedHosts, origins }: HandleOptions): Promise<Response | null>;
219
223
  /** The call's headers, then Launch's own over them, then the call's cookies. */
220
224
  export declare function responseHeaders(own: Readonly<Record<string, string>>, effects: ResponseEffects | undefined): Headers;
221
225
  export declare function response(reply: Reply, effects?: ResponseEffects): Response;