@dads-framework/http 0.0.0-stage → 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.
- package/LICENSE.md +21 -0
- package/README.md +219 -2
- package/dist/http.tsbuildinfo +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/create-http-app.d.ts +108 -0
- package/dist/lib/create-http-app.d.ts.map +1 -0
- package/dist/lib/create-http-app.js +181 -0
- package/dist/lib/create-http-app.js.map +1 -0
- package/dist/lib/http-errors.d.ts +52 -0
- package/dist/lib/http-errors.d.ts.map +1 -0
- package/dist/lib/http-errors.js +66 -0
- package/dist/lib/http-errors.js.map +1 -0
- package/dist/lib/mcp/mcp-tool.d.ts +94 -0
- package/dist/lib/mcp/mcp-tool.d.ts.map +1 -0
- package/dist/lib/mcp/mcp-tool.js +11 -0
- package/dist/lib/mcp/mcp-tool.js.map +1 -0
- package/dist/lib/object-value.d.ts +3 -0
- package/dist/lib/object-value.d.ts.map +1 -0
- package/dist/lib/object-value.js +5 -0
- package/dist/lib/object-value.js.map +1 -0
- package/dist/lib/openapi/build-document.d.ts +27 -0
- package/dist/lib/openapi/build-document.d.ts.map +1 -0
- package/dist/lib/openapi/build-document.js +192 -0
- package/dist/lib/openapi/build-document.js.map +1 -0
- package/dist/lib/openapi/logic/add-discriminators.d.ts +16 -0
- package/dist/lib/openapi/logic/add-discriminators.d.ts.map +1 -0
- package/dist/lib/openapi/logic/add-discriminators.js +235 -0
- package/dist/lib/openapi/logic/add-discriminators.js.map +1 -0
- package/dist/lib/openapi/logic/by-code-point.d.ts +2 -0
- package/dist/lib/openapi/logic/by-code-point.d.ts.map +1 -0
- package/dist/lib/openapi/logic/by-code-point.js +6 -0
- package/dist/lib/openapi/logic/by-code-point.js.map +1 -0
- package/dist/lib/openapi/logic/capitalize-initial.d.ts +2 -0
- package/dist/lib/openapi/logic/capitalize-initial.d.ts.map +1 -0
- package/dist/lib/openapi/logic/capitalize-initial.js +4 -0
- package/dist/lib/openapi/logic/capitalize-initial.js.map +1 -0
- package/dist/lib/openapi/logic/document-record.d.ts +5 -0
- package/dist/lib/openapi/logic/document-record.d.ts.map +1 -0
- package/dist/lib/openapi/logic/document-record.js +14 -0
- package/dist/lib/openapi/logic/document-record.js.map +1 -0
- package/dist/lib/openapi/logic/list-order.d.ts +23 -0
- package/dist/lib/openapi/logic/list-order.d.ts.map +1 -0
- package/dist/lib/openapi/logic/list-order.js +102 -0
- package/dist/lib/openapi/logic/list-order.js.map +1 -0
- package/dist/lib/openapi/logic/open-response-objects.d.ts +14 -0
- package/dist/lib/openapi/logic/open-response-objects.d.ts.map +1 -0
- package/dist/lib/openapi/logic/open-response-objects.js +130 -0
- package/dist/lib/openapi/logic/open-response-objects.js.map +1 -0
- package/dist/lib/openapi/logic/openapi-parts.d.ts +37 -0
- package/dist/lib/openapi/logic/openapi-parts.d.ts.map +1 -0
- package/dist/lib/openapi/logic/openapi-parts.js +243 -0
- package/dist/lib/openapi/logic/openapi-parts.js.map +1 -0
- package/dist/lib/openapi/logic/schema-components.d.ts +5 -0
- package/dist/lib/openapi/logic/schema-components.d.ts.map +1 -0
- package/dist/lib/openapi/logic/schema-components.js +47 -0
- package/dist/lib/openapi/logic/schema-components.js.map +1 -0
- package/dist/lib/request-log/authorization-warning-faults.d.ts +30 -0
- package/dist/lib/request-log/authorization-warning-faults.d.ts.map +1 -0
- package/dist/lib/request-log/authorization-warning-faults.js +35 -0
- package/dist/lib/request-log/authorization-warning-faults.js.map +1 -0
- package/dist/lib/request-log/capture-request-record.d.ts +50 -0
- package/dist/lib/request-log/capture-request-record.d.ts.map +1 -0
- package/dist/lib/request-log/capture-request-record.js +132 -0
- package/dist/lib/request-log/capture-request-record.js.map +1 -0
- package/dist/lib/request-log/request-log-sink.d.ts +31 -0
- package/dist/lib/request-log/request-log-sink.d.ts.map +1 -0
- package/dist/lib/request-log/request-log-sink.js +26 -0
- package/dist/lib/request-log/request-log-sink.js.map +1 -0
- package/dist/lib/request-log/request-outcome.d.ts +53 -0
- package/dist/lib/request-log/request-outcome.d.ts.map +1 -0
- package/dist/lib/request-log/request-outcome.js +96 -0
- package/dist/lib/request-log/request-outcome.js.map +1 -0
- package/dist/lib/request-log/request-record.d.ts +114 -0
- package/dist/lib/request-log/request-record.d.ts.map +1 -0
- package/dist/lib/request-log/request-record.js +231 -0
- package/dist/lib/request-log/request-record.js.map +1 -0
- package/dist/lib/request-pipeline/assert-no-app-site-serving.d.ts +8 -0
- package/dist/lib/request-pipeline/assert-no-app-site-serving.d.ts.map +1 -0
- package/dist/lib/request-pipeline/assert-no-app-site-serving.js +15 -0
- package/dist/lib/request-pipeline/assert-no-app-site-serving.js.map +1 -0
- package/dist/lib/request-pipeline/carry-audit-actor.d.ts +71 -0
- package/dist/lib/request-pipeline/carry-audit-actor.d.ts.map +1 -0
- package/dist/lib/request-pipeline/carry-audit-actor.js +79 -0
- package/dist/lib/request-pipeline/carry-audit-actor.js.map +1 -0
- package/dist/lib/request-pipeline/carry-authorization-consistency.d.ts +4 -0
- package/dist/lib/request-pipeline/carry-authorization-consistency.d.ts.map +1 -0
- package/dist/lib/request-pipeline/carry-authorization-consistency.js +21 -0
- package/dist/lib/request-pipeline/carry-authorization-consistency.js.map +1 -0
- package/dist/lib/request-pipeline/enforce-access.d.ts +146 -0
- package/dist/lib/request-pipeline/enforce-access.d.ts.map +1 -0
- package/dist/lib/request-pipeline/enforce-access.js +238 -0
- package/dist/lib/request-pipeline/enforce-access.js.map +1 -0
- package/dist/lib/request-pipeline/enforce-scope.d.ts +23 -0
- package/dist/lib/request-pipeline/enforce-scope.d.ts.map +1 -0
- package/dist/lib/request-pipeline/enforce-scope.js +58 -0
- package/dist/lib/request-pipeline/enforce-scope.js.map +1 -0
- package/dist/lib/request-pipeline/envelope.d.ts +17 -0
- package/dist/lib/request-pipeline/envelope.d.ts.map +1 -0
- package/dist/lib/request-pipeline/envelope.js +4 -0
- package/dist/lib/request-pipeline/envelope.js.map +1 -0
- package/dist/lib/request-pipeline/error-handler.d.ts +14 -0
- package/dist/lib/request-pipeline/error-handler.d.ts.map +1 -0
- package/dist/lib/request-pipeline/error-handler.js +138 -0
- package/dist/lib/request-pipeline/error-handler.js.map +1 -0
- package/dist/lib/request-pipeline/feature-state-preview.d.ts +69 -0
- package/dist/lib/request-pipeline/feature-state-preview.d.ts.map +1 -0
- package/dist/lib/request-pipeline/feature-state-preview.js +61 -0
- package/dist/lib/request-pipeline/feature-state-preview.js.map +1 -0
- package/dist/lib/request-pipeline/feature-state.d.ts +64 -0
- package/dist/lib/request-pipeline/feature-state.d.ts.map +1 -0
- package/dist/lib/request-pipeline/feature-state.js +38 -0
- package/dist/lib/request-pipeline/feature-state.js.map +1 -0
- package/dist/lib/request-pipeline/logic/is-write-method.d.ts +2 -0
- package/dist/lib/request-pipeline/logic/is-write-method.d.ts.map +1 -0
- package/dist/lib/request-pipeline/logic/is-write-method.js +7 -0
- package/dist/lib/request-pipeline/logic/is-write-method.js.map +1 -0
- package/dist/lib/request-pipeline/logic/read-request-source.d.ts +19 -0
- package/dist/lib/request-pipeline/logic/read-request-source.d.ts.map +1 -0
- package/dist/lib/request-pipeline/logic/read-request-source.js +40 -0
- package/dist/lib/request-pipeline/logic/read-request-source.js.map +1 -0
- package/dist/lib/request-pipeline/logic/single-request-header.d.ts +3 -0
- package/dist/lib/request-pipeline/logic/single-request-header.d.ts.map +1 -0
- package/dist/lib/request-pipeline/logic/single-request-header.js +16 -0
- package/dist/lib/request-pipeline/logic/single-request-header.js.map +1 -0
- package/dist/lib/request-pipeline/machine-credential-access.d.ts +19 -0
- package/dist/lib/request-pipeline/machine-credential-access.d.ts.map +1 -0
- package/dist/lib/request-pipeline/machine-credential-access.js +28 -0
- package/dist/lib/request-pipeline/machine-credential-access.js.map +1 -0
- package/dist/lib/request-pipeline/rate-limit.d.ts +15 -0
- package/dist/lib/request-pipeline/rate-limit.d.ts.map +1 -0
- package/dist/lib/request-pipeline/rate-limit.js +40 -0
- package/dist/lib/request-pipeline/rate-limit.js.map +1 -0
- package/dist/lib/request-pipeline/raw-route-byte-body.d.ts +19 -0
- package/dist/lib/request-pipeline/raw-route-byte-body.d.ts.map +1 -0
- package/dist/lib/request-pipeline/raw-route-byte-body.js +26 -0
- package/dist/lib/request-pipeline/raw-route-byte-body.js.map +1 -0
- package/dist/lib/request-pipeline/refuse-visible-record-list.d.ts +16 -0
- package/dist/lib/request-pipeline/refuse-visible-record-list.d.ts.map +1 -0
- package/dist/lib/request-pipeline/refuse-visible-record-list.js +33 -0
- package/dist/lib/request-pipeline/refuse-visible-record-list.js.map +1 -0
- package/dist/lib/request-pipeline/register-routes.d.ts +50 -0
- package/dist/lib/request-pipeline/register-routes.d.ts.map +1 -0
- package/dist/lib/request-pipeline/register-routes.js +215 -0
- package/dist/lib/request-pipeline/register-routes.js.map +1 -0
- package/dist/lib/request-pipeline/request-id.d.ts +22 -0
- package/dist/lib/request-pipeline/request-id.d.ts.map +1 -0
- package/dist/lib/request-pipeline/request-id.js +26 -0
- package/dist/lib/request-pipeline/request-id.js.map +1 -0
- package/dist/lib/request-pipeline/request-language-response.d.ts +14 -0
- package/dist/lib/request-pipeline/request-language-response.d.ts.map +1 -0
- package/dist/lib/request-pipeline/request-language-response.js +47 -0
- package/dist/lib/request-pipeline/request-language-response.js.map +1 -0
- package/dist/lib/request-pipeline/request-locale.d.ts +38 -0
- package/dist/lib/request-pipeline/request-locale.d.ts.map +1 -0
- package/dist/lib/request-pipeline/request-locale.js +102 -0
- package/dist/lib/request-pipeline/request-locale.js.map +1 -0
- package/dist/lib/request-pipeline/request-origin.d.ts +17 -0
- package/dist/lib/request-pipeline/request-origin.d.ts.map +1 -0
- package/dist/lib/request-pipeline/request-origin.js +38 -0
- package/dist/lib/request-pipeline/request-origin.js.map +1 -0
- package/dist/lib/request-pipeline/request-trace.d.ts +10 -0
- package/dist/lib/request-pipeline/request-trace.d.ts.map +1 -0
- package/dist/lib/request-pipeline/request-trace.js +24 -0
- package/dist/lib/request-pipeline/request-trace.js.map +1 -0
- package/dist/lib/request-pipeline/route-rate-limit.d.ts +19 -0
- package/dist/lib/request-pipeline/route-rate-limit.d.ts.map +1 -0
- package/dist/lib/request-pipeline/route-rate-limit.js +32 -0
- package/dist/lib/request-pipeline/route-rate-limit.js.map +1 -0
- package/dist/lib/request-pipeline/run-route.d.ts +9 -0
- package/dist/lib/request-pipeline/run-route.d.ts.map +1 -0
- package/dist/lib/request-pipeline/run-route.js +42 -0
- package/dist/lib/request-pipeline/run-route.js.map +1 -0
- package/dist/lib/request-pipeline/with-deadline.d.ts +12 -0
- package/dist/lib/request-pipeline/with-deadline.d.ts.map +1 -0
- package/dist/lib/request-pipeline/with-deadline.js +55 -0
- package/dist/lib/request-pipeline/with-deadline.js.map +1 -0
- package/dist/lib/route/access.d.ts +143 -0
- package/dist/lib/route/access.d.ts.map +1 -0
- package/dist/lib/route/access.js +97 -0
- package/dist/lib/route/access.js.map +1 -0
- package/dist/lib/route/capabilities.d.ts +100 -0
- package/dist/lib/route/capabilities.d.ts.map +1 -0
- package/dist/lib/route/capabilities.js +42 -0
- package/dist/lib/route/capabilities.js.map +1 -0
- package/dist/lib/route/define-raw-route.d.ts +81 -0
- package/dist/lib/route/define-raw-route.d.ts.map +1 -0
- package/dist/lib/route/define-raw-route.js +5 -0
- package/dist/lib/route/define-raw-route.js.map +1 -0
- package/dist/lib/route/delete-route.d.ts +26 -0
- package/dist/lib/route/delete-route.d.ts.map +1 -0
- package/dist/lib/route/delete-route.js +6 -0
- package/dist/lib/route/delete-route.js.map +1 -0
- package/dist/lib/route/get-route.d.ts +43 -0
- package/dist/lib/route/get-route.d.ts.map +1 -0
- package/dist/lib/route/get-route.js +18 -0
- package/dist/lib/route/get-route.js.map +1 -0
- package/dist/lib/route/list-result.d.ts +11 -0
- package/dist/lib/route/list-result.d.ts.map +1 -0
- package/dist/lib/route/list-result.js +8 -0
- package/dist/lib/route/list-result.js.map +1 -0
- package/dist/lib/route/list-route.d.ts +60 -0
- package/dist/lib/route/list-route.d.ts.map +1 -0
- package/dist/lib/route/list-route.js +68 -0
- package/dist/lib/route/list-route.js.map +1 -0
- package/dist/lib/route/patch-route.d.ts +27 -0
- package/dist/lib/route/patch-route.d.ts.map +1 -0
- package/dist/lib/route/patch-route.js +8 -0
- package/dist/lib/route/patch-route.js.map +1 -0
- package/dist/lib/route/post-no-content-route.d.ts +18 -0
- package/dist/lib/route/post-no-content-route.d.ts.map +1 -0
- package/dist/lib/route/post-no-content-route.js +8 -0
- package/dist/lib/route/post-no-content-route.js.map +1 -0
- package/dist/lib/route/post-route.d.ts +34 -0
- package/dist/lib/route/post-route.d.ts.map +1 -0
- package/dist/lib/route/post-route.js +23 -0
- package/dist/lib/route/post-route.js.map +1 -0
- package/dist/lib/route/route-definition.d.ts +224 -0
- package/dist/lib/route/route-definition.d.ts.map +1 -0
- package/dist/lib/route/route-definition.js +32 -0
- package/dist/lib/route/route-definition.js.map +1 -0
- package/dist/lib/route/route-execution.d.ts +47 -0
- package/dist/lib/route/route-execution.d.ts.map +1 -0
- package/dist/lib/route/route-execution.js +162 -0
- package/dist/lib/route/route-execution.js.map +1 -0
- package/dist/lib/route/route-group.d.ts +21 -0
- package/dist/lib/route/route-group.d.ts.map +1 -0
- package/dist/lib/route/route-group.js +18 -0
- package/dist/lib/route/route-group.js.map +1 -0
- package/dist/lib/route/route-guards.test-support.d.ts +2 -0
- package/dist/lib/route/route-guards.test-support.d.ts.map +1 -0
- package/dist/lib/route/route-guards.test-support.js +2 -0
- package/dist/lib/route/route-guards.test-support.js.map +1 -0
- package/dist/lib/route/sse-route.d.ts +54 -0
- package/dist/lib/route/sse-route.d.ts.map +1 -0
- package/dist/lib/route/sse-route.js +63 -0
- package/dist/lib/route/sse-route.js.map +1 -0
- package/dist/lib/route/web-socket-route.d.ts +45 -0
- package/dist/lib/route/web-socket-route.d.ts.map +1 -0
- package/dist/lib/route/web-socket-route.js +180 -0
- package/dist/lib/route/web-socket-route.js.map +1 -0
- package/dist/lib/route-catalog/route-catalog-parts.d.ts +27 -0
- package/dist/lib/route-catalog/route-catalog-parts.d.ts.map +1 -0
- package/dist/lib/route-catalog/route-catalog-parts.js +87 -0
- package/dist/lib/route-catalog/route-catalog-parts.js.map +1 -0
- package/dist/protocol-mounts/index.d.ts +19 -0
- package/dist/protocol-mounts/index.d.ts.map +1 -0
- package/dist/protocol-mounts/index.js +19 -0
- package/dist/protocol-mounts/index.js.map +1 -0
- package/dist/protocol-mounts/lib/mcp/json-rpc.d.ts +54 -0
- package/dist/protocol-mounts/lib/mcp/json-rpc.d.ts.map +1 -0
- package/dist/protocol-mounts/lib/mcp/json-rpc.js +53 -0
- package/dist/protocol-mounts/lib/mcp/json-rpc.js.map +1 -0
- package/dist/protocol-mounts/lib/mcp/mcp-endpoint.d.ts +31 -0
- package/dist/protocol-mounts/lib/mcp/mcp-endpoint.d.ts.map +1 -0
- package/dist/protocol-mounts/lib/mcp/mcp-endpoint.js +179 -0
- package/dist/protocol-mounts/lib/mcp/mcp-endpoint.js.map +1 -0
- package/dist/protocol-mounts/lib/mcp/mcp-methods.d.ts +68 -0
- package/dist/protocol-mounts/lib/mcp/mcp-methods.d.ts.map +1 -0
- package/dist/protocol-mounts/lib/mcp/mcp-methods.js +201 -0
- package/dist/protocol-mounts/lib/mcp/mcp-methods.js.map +1 -0
- package/dist/protocol-mounts/lib/mcp/protected-resource-metadata.d.ts +18 -0
- package/dist/protocol-mounts/lib/mcp/protected-resource-metadata.d.ts.map +1 -0
- package/dist/protocol-mounts/lib/mcp/protected-resource-metadata.js +34 -0
- package/dist/protocol-mounts/lib/mcp/protected-resource-metadata.js.map +1 -0
- package/dist/protocol-mounts/lib/protocol-mount/mount-fetch-handler.d.ts +55 -0
- package/dist/protocol-mounts/lib/protocol-mount/mount-fetch-handler.d.ts.map +1 -0
- package/dist/protocol-mounts/lib/protocol-mount/mount-fetch-handler.js +98 -0
- package/dist/protocol-mounts/lib/protocol-mount/mount-fetch-handler.js.map +1 -0
- package/dist/protocol-mounts/lib/protocol-mount/to-web-request.d.ts +14 -0
- package/dist/protocol-mounts/lib/protocol-mount/to-web-request.d.ts.map +1 -0
- package/dist/protocol-mounts/lib/protocol-mount/to-web-request.js +60 -0
- package/dist/protocol-mounts/lib/protocol-mount/to-web-request.js.map +1 -0
- package/dist/testing/build-test-app.d.ts +47 -0
- package/dist/testing/build-test-app.d.ts.map +1 -0
- package/dist/testing/build-test-app.js +79 -0
- package/dist/testing/build-test-app.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/parse-inject-response.d.ts +32 -0
- package/dist/testing/parse-inject-response.d.ts.map +1 -0
- package/dist/testing/parse-inject-response.js +39 -0
- package/dist/testing/parse-inject-response.js.map +1 -0
- package/package.json +55 -4
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { ScopeAnswer, SubjectRef } from "@dads-framework/access/runtime";
|
|
3
|
+
import type { HttpMethod, Locale, RouteContract } from "@dads-framework/contract";
|
|
4
|
+
import type { FeatureStateSnapshot } from "../request-pipeline/feature-state.js";
|
|
5
|
+
import type { RouteAccess } from "./access.js";
|
|
6
|
+
import type { RouteCapabilities } from "./capabilities.js";
|
|
7
|
+
export type { HttpMethod } from "@dads-framework/contract";
|
|
8
|
+
/**
|
|
9
|
+
* `:param` names extracted from a path template at the type level, so a
|
|
10
|
+
* `params` schema that doesn't match the path fails to compile.
|
|
11
|
+
*/
|
|
12
|
+
export type PathParamNames<Path extends string> = Path extends `${string}:${infer Param}/${infer Rest}` ? Param | PathParamNames<`/${Rest}`> : Path extends `${string}:${infer Param}` ? Param : never;
|
|
13
|
+
/** The object shape a `params` schema must produce for a given path. */
|
|
14
|
+
export type PathParamsShape<Path extends string> = Record<PathParamNames<Path>, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Minimal structural logger (pino-compatible). Handlers never see Fastify —
|
|
17
|
+
* this is the only logging surface they get.
|
|
18
|
+
*/
|
|
19
|
+
export type RouteLogger = {
|
|
20
|
+
info(obj: object, msg?: string): void;
|
|
21
|
+
warn(obj: object, msg?: string): void;
|
|
22
|
+
error(obj: object, msg?: string): void;
|
|
23
|
+
};
|
|
24
|
+
/** What a handler receives: parsed inputs, the subject, and nothing else. */
|
|
25
|
+
export type RouteHandlerContext<Params, Query, Body, Subject> = {
|
|
26
|
+
readonly params: Params;
|
|
27
|
+
readonly query: Query;
|
|
28
|
+
readonly body: Body;
|
|
29
|
+
readonly subject: Subject;
|
|
30
|
+
/** Authenticated account for audit; subject may be a company-qualified actor. */
|
|
31
|
+
readonly authenticatedSubject: Subject;
|
|
32
|
+
/** Captured input, not a resolved identity or proof of authority. Present only on input-only session routes. */
|
|
33
|
+
readonly untrustedAuthorizationContext?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The context `subject` was resolved for, as the caller named it. Present
|
|
36
|
+
* only once a declared authorization context resolved. One subject may
|
|
37
|
+
* answer several contexts, so the subject alone does not say which.
|
|
38
|
+
*/
|
|
39
|
+
readonly authorizationContext?: string;
|
|
40
|
+
/**
|
|
41
|
+
* When the caller last proved who they are on their session, by a sign-in
|
|
42
|
+
* the server forced and checked itself. Present only when the subject
|
|
43
|
+
* resolver read a session stamped so; a write that asks for a recent
|
|
44
|
+
* sign-in refuses without it.
|
|
45
|
+
*/
|
|
46
|
+
readonly sessionReauthenticatedAt?: Date;
|
|
47
|
+
readonly requestId: string;
|
|
48
|
+
/**
|
|
49
|
+
* The language this request asked for, resolved from `Accept-Language` with
|
|
50
|
+
* an English fallback. Server-owned vocabulary is stored side by side and
|
|
51
|
+
* resolved against this, so the wire keeps carrying plain strings.
|
|
52
|
+
*/
|
|
53
|
+
readonly locale: Locale;
|
|
54
|
+
readonly log: RouteLogger;
|
|
55
|
+
/**
|
|
56
|
+
* The subject's visible set — present exactly on requireVisibility list
|
|
57
|
+
* routes (whose typed overload requires it); absent everywhere else.
|
|
58
|
+
*/
|
|
59
|
+
readonly visibleIds?: readonly string[];
|
|
60
|
+
/**
|
|
61
|
+
* The subject's scope answers — present exactly on `requiresScoped` list
|
|
62
|
+
* routes (whose typed overload requires it); absent everywhere else.
|
|
63
|
+
*/
|
|
64
|
+
readonly scope?: ScopeAnswer;
|
|
65
|
+
/** Request-scoped feature snapshot, present only on participating API routes. */
|
|
66
|
+
readonly featureState?: FeatureStateSnapshot;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* A named route handler with no receiver. Generated handler bundles expose
|
|
70
|
+
* these as readonly properties, so route cards can pass a direct reference.
|
|
71
|
+
*/
|
|
72
|
+
export type NamedRouteHandler<Context, Result> = (context: Context) => Result;
|
|
73
|
+
/** A named route handler whose implementation completes asynchronously. */
|
|
74
|
+
export type AsyncNamedRouteHandler<Context, Result> = NamedRouteHandler<Context, Promise<Result>>;
|
|
75
|
+
export type SchemaOutput<S> = S extends z.ZodType ? z.output<S> : undefined;
|
|
76
|
+
/**
|
|
77
|
+
* What a handler must return: the data shape alone, or `{ data, meta }`
|
|
78
|
+
* when the route declares a `meta` schema (paginated lists per
|
|
79
|
+
* docs/architecture/api-conventions.md#pagination).
|
|
80
|
+
*/
|
|
81
|
+
export type HandlerResult<ResponseSchema extends z.ZodType, MetaSchema extends z.ZodType | undefined> = MetaSchema extends z.ZodType ? {
|
|
82
|
+
data: z.input<ResponseSchema>;
|
|
83
|
+
meta: z.input<MetaSchema>;
|
|
84
|
+
} : z.input<ResponseSchema>;
|
|
85
|
+
/** The raw material the kit feeds a route; `execute` does the typed work. */
|
|
86
|
+
export type RawRouteInput = {
|
|
87
|
+
readonly params: unknown;
|
|
88
|
+
readonly query: unknown;
|
|
89
|
+
readonly body: unknown;
|
|
90
|
+
readonly subject: SubjectRef | null;
|
|
91
|
+
/** The pipeline always supplies this; direct identity-context execution may omit it. */
|
|
92
|
+
readonly authenticatedSubject?: SubjectRef | null;
|
|
93
|
+
readonly untrustedAuthorizationContext?: string;
|
|
94
|
+
readonly authorizationContext?: string;
|
|
95
|
+
/** When the caller last signed in again on their session, when the subject resolver says. */
|
|
96
|
+
readonly sessionReauthenticatedAt?: Date;
|
|
97
|
+
readonly requestId: string;
|
|
98
|
+
readonly locale: Locale;
|
|
99
|
+
readonly log: RouteLogger;
|
|
100
|
+
/** Set by access enforcement on requireVisibility routes only. */
|
|
101
|
+
readonly visibleIds?: readonly string[];
|
|
102
|
+
/** Set by access enforcement on requiresScoped routes only. */
|
|
103
|
+
readonly scope?: ScopeAnswer;
|
|
104
|
+
readonly featureState?: FeatureStateSnapshot;
|
|
105
|
+
};
|
|
106
|
+
/** What `execute` hands back for enveloping — both halves schema-parsed. */
|
|
107
|
+
export type RouteResult = {
|
|
108
|
+
readonly data: unknown;
|
|
109
|
+
readonly meta?: unknown;
|
|
110
|
+
};
|
|
111
|
+
/** Public ingestion that appends internal records and creates no caller-owned resource. */
|
|
112
|
+
export type ResourceFreePostPolicy = {
|
|
113
|
+
readonly kind: "resource-free";
|
|
114
|
+
readonly purpose: "append-only-telemetry";
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* The erased, registrable form of a route. `execute` parses inputs (throwing
|
|
118
|
+
* `RequestValidationError` → 400), invokes the handler, and parses the result
|
|
119
|
+
* through the response (and meta) schema (throwing `ResponseDriftError` →
|
|
120
|
+
* 500). Schemas stay attached for OpenAPI generation.
|
|
121
|
+
*/
|
|
122
|
+
export type RouteDefinition = {
|
|
123
|
+
readonly kind: "route";
|
|
124
|
+
readonly descriptor: RouteContract;
|
|
125
|
+
readonly method: HttpMethod;
|
|
126
|
+
readonly path: string;
|
|
127
|
+
/** Stamped by routeGroup — the only way a route becomes registrable. */
|
|
128
|
+
readonly tag: string;
|
|
129
|
+
readonly summary: string;
|
|
130
|
+
/** Maximum request body bytes for this route; omitted retains the application limit. */
|
|
131
|
+
readonly bodyLimitBytes?: number;
|
|
132
|
+
readonly access: RouteAccess;
|
|
133
|
+
/** group ∪ route capabilities; the app default merges at registration. */
|
|
134
|
+
readonly capabilities: RouteCapabilities;
|
|
135
|
+
readonly status: 200 | 201 | 202 | 204;
|
|
136
|
+
readonly resourcePolicy?: ResourceFreePostPolicy;
|
|
137
|
+
readonly schemas: {
|
|
138
|
+
readonly params?: z.ZodType;
|
|
139
|
+
readonly query?: z.ZodType;
|
|
140
|
+
readonly body?: z.ZodType;
|
|
141
|
+
/** Absent on no-content (DELETE) routes. */
|
|
142
|
+
readonly response?: z.ZodType;
|
|
143
|
+
readonly meta?: z.ZodType;
|
|
144
|
+
};
|
|
145
|
+
readonly execute: (raw: RawRouteInput) => Promise<RouteResult>;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* What a verb returns: a route WITHOUT a tag. Blueprints are not
|
|
149
|
+
* registrable — `registerRoutes` takes `RouteDefinition[]` only, so a route
|
|
150
|
+
* that never went through `routeGroup` does not compile (the always-a-group
|
|
151
|
+
* rule, mechanically).
|
|
152
|
+
*/
|
|
153
|
+
export type RouteBlueprint = Omit<RouteDefinition, "tag">;
|
|
154
|
+
export { buildDefinition, buildNoContentDefinition, type ErasedNoContentConfig, type ErasedRouteConfig, } from "./route-execution.js";
|
|
155
|
+
/**
|
|
156
|
+
* Erased verb input — ErasedRouteConfig minus `method`, hand-written (NOT
|
|
157
|
+
* via Omit: mapped types strip method-syntax bivariance off `handler`,
|
|
158
|
+
* which is load-bearing for the verb call signatures).
|
|
159
|
+
*/
|
|
160
|
+
export type ErasedVerbConfig = {
|
|
161
|
+
readonly route?: RouteContract;
|
|
162
|
+
readonly path?: string;
|
|
163
|
+
readonly summary: string;
|
|
164
|
+
/** Maximum request body bytes for this route; omitted retains the application limit. */
|
|
165
|
+
readonly bodyLimitBytes?: number;
|
|
166
|
+
readonly capabilities?: RouteCapabilities;
|
|
167
|
+
readonly access: RouteAccess;
|
|
168
|
+
readonly response: z.ZodType;
|
|
169
|
+
readonly meta?: z.ZodType;
|
|
170
|
+
readonly status?: 200 | 201 | 202;
|
|
171
|
+
readonly params?: z.ZodType;
|
|
172
|
+
readonly query?: z.ZodType;
|
|
173
|
+
readonly body?: z.ZodType;
|
|
174
|
+
handler(ctx: RouteHandlerContext<unknown, unknown, unknown, SubjectRef>): unknown;
|
|
175
|
+
};
|
|
176
|
+
/** Erased no-content verb input — same rationale as ErasedVerbConfig. */
|
|
177
|
+
export type ErasedNoContentVerbConfig = {
|
|
178
|
+
readonly route?: RouteContract;
|
|
179
|
+
readonly path?: string;
|
|
180
|
+
readonly summary: string;
|
|
181
|
+
/** Maximum request body bytes for this route; omitted retains the application limit. */
|
|
182
|
+
readonly bodyLimitBytes?: number;
|
|
183
|
+
readonly capabilities?: RouteCapabilities;
|
|
184
|
+
readonly access: RouteAccess;
|
|
185
|
+
readonly params?: z.ZodType;
|
|
186
|
+
readonly body?: z.ZodType;
|
|
187
|
+
handler(ctx: RouteHandlerContext<unknown, undefined, unknown, SubjectRef>): Promise<void> | void;
|
|
188
|
+
};
|
|
189
|
+
/** A route card path is literal and mount-relative, never a computed URL string. */
|
|
190
|
+
type LiteralMountRelativePath<Path extends string> = string extends Path ? never : Path extends `/${string}` ? Path : never;
|
|
191
|
+
/** One transient route source: the legacy descriptor or the literal route card path. */
|
|
192
|
+
type VerbRouteSource<Method extends HttpMethod, Path extends string> = {
|
|
193
|
+
readonly route: RouteContract<Method, Path>;
|
|
194
|
+
readonly path?: never;
|
|
195
|
+
} | {
|
|
196
|
+
readonly route?: never;
|
|
197
|
+
readonly path: LiteralMountRelativePath<Path>;
|
|
198
|
+
};
|
|
199
|
+
/** Shared fields every verb declares. */
|
|
200
|
+
export type VerbCommon<Method extends HttpMethod, Path extends string, Access extends RouteAccess> = VerbRouteSource<Method, Path> & {
|
|
201
|
+
/** OpenAPI operation summary. */
|
|
202
|
+
readonly summary: string;
|
|
203
|
+
/** Maximum request body bytes for this route; omitted retains the application limit. */
|
|
204
|
+
readonly bodyLimitBytes?: number;
|
|
205
|
+
readonly access: Access;
|
|
206
|
+
/** Route-rung of the capability ladder (route > group > app). */
|
|
207
|
+
readonly capabilities?: RouteCapabilities;
|
|
208
|
+
};
|
|
209
|
+
/** Resolve the temporary route source into the descriptor the kit already stores. */
|
|
210
|
+
export declare function resolveVerbRoute(config: {
|
|
211
|
+
readonly route?: RouteContract;
|
|
212
|
+
readonly path?: string;
|
|
213
|
+
}, expectedMethod: HttpMethod): {
|
|
214
|
+
readonly descriptor: RouteContract;
|
|
215
|
+
readonly method: HttpMethod;
|
|
216
|
+
readonly path: string;
|
|
217
|
+
};
|
|
218
|
+
/** Path params are required exactly when the path template has `:params`. */
|
|
219
|
+
export type VerbParams<Path extends string, ParamsSchema extends z.ZodType<PathParamsShape<Path>> | undefined> = [PathParamNames<Path>] extends [never] ? {
|
|
220
|
+
readonly params?: undefined;
|
|
221
|
+
} : {
|
|
222
|
+
readonly params: ParamsSchema;
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=route-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-definition.d.ts","sourceRoot":"","sources":["../../../src/lib/route/route-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,aAAa,EACd,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,cAAc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,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAsCA;AAED,6EAA6E;AAC7E,MAAM,MAAM,UAAU,CACpB,IAAI,SAAS,MAAM,EACnB,YAAY,SAAS,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,IAC/D,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACtC;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HttpWiringError } from "../http-errors.js";
|
|
2
|
+
export { buildDefinition, buildNoContentDefinition, } from "./route-execution.js";
|
|
3
|
+
/** Resolve the temporary route source into the descriptor the kit already stores. */
|
|
4
|
+
export function resolveVerbRoute(config, expectedMethod) {
|
|
5
|
+
const hasRoute = config.route !== undefined;
|
|
6
|
+
const hasPath = config.path !== undefined;
|
|
7
|
+
if (hasRoute === hasPath) {
|
|
8
|
+
throw new HttpWiringError(`${expectedMethod} helper requires exactly one of route or path`);
|
|
9
|
+
}
|
|
10
|
+
if (config.route !== undefined) {
|
|
11
|
+
if (config.route.method !== expectedMethod) {
|
|
12
|
+
throw new HttpWiringError(`${expectedMethod} helper received ${config.route.method} descriptor for ${config.route.template}`);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
descriptor: config.route,
|
|
16
|
+
method: config.route.method,
|
|
17
|
+
path: config.route.template,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (config.path === undefined) {
|
|
21
|
+
throw new HttpWiringError(`${expectedMethod} helper requires a literal path when no route is provided`);
|
|
22
|
+
}
|
|
23
|
+
if (!config.path.startsWith("/") || config.path.startsWith("//")) {
|
|
24
|
+
throw new HttpWiringError(`${expectedMethod} helper received a path that is not mount-relative`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
descriptor: { method: expectedMethod, template: config.path },
|
|
28
|
+
method: expectedMethod,
|
|
29
|
+
path: config.path,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=route-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-definition.js","sourceRoot":"","sources":["../../../src/lib/route/route-definition.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAmLpD,OAAO,EACL,eAAe,EACf,wBAAwB,GAGzB,MAAM,sBAAsB,CAAC;AA2E9B,qFAAqF;AACrF,MAAM,UAAU,gBAAgB,CAC9B,MAAkE,EAClE,cAA0B;IAM1B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC;IAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;IAC1C,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,eAAe,CACvB,GAAG,cAAc,+CAA+C,CACjE,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;YAC3C,MAAM,IAAI,eAAe,CACvB,GAAG,cAAc,oBAAoB,MAAM,CAAC,KAAK,CAAC,MAAM,mBAAmB,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CACnG,CAAC;QACJ,CAAC;QACD,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,KAAK;YACxB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;YAC3B,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;SAC5B,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAe,CACvB,GAAG,cAAc,2DAA2D,CAC7E,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACjE,MAAM,IAAI,eAAe,CACvB,GAAG,cAAc,oDAAoD,CACtE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,UAAU,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE;QAC7D,MAAM,EAAE,cAAc;QACtB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { SubjectRef } from "@dads-framework/access/runtime";
|
|
3
|
+
import type { HttpMethod, RouteContract } from "@dads-framework/contract";
|
|
4
|
+
import type { RouteAccess } from "./access.js";
|
|
5
|
+
import type { RouteCapabilities } from "./capabilities.js";
|
|
6
|
+
import type { RouteBlueprint, RouteHandlerContext } from "./route-definition.js";
|
|
7
|
+
/**
|
|
8
|
+
* The type-erased view verb builders hand to route execution. Public verb
|
|
9
|
+
* signatures preserve their exact handler context; method syntax retains the
|
|
10
|
+
* sanctioned bivariance required at this erased boundary.
|
|
11
|
+
*/
|
|
12
|
+
export type ErasedRouteConfig = {
|
|
13
|
+
readonly descriptor: RouteContract;
|
|
14
|
+
readonly method: HttpMethod;
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly summary: string;
|
|
17
|
+
/** Maximum request body bytes for this route; omitted retains the application limit. */
|
|
18
|
+
readonly bodyLimitBytes?: number;
|
|
19
|
+
readonly capabilities?: RouteCapabilities;
|
|
20
|
+
readonly access: RouteAccess;
|
|
21
|
+
readonly response: z.ZodType;
|
|
22
|
+
readonly meta?: z.ZodType;
|
|
23
|
+
readonly status?: 200 | 201 | 202;
|
|
24
|
+
readonly params?: z.ZodType;
|
|
25
|
+
readonly query?: z.ZodType;
|
|
26
|
+
readonly body?: z.ZodType;
|
|
27
|
+
handler(context: RouteHandlerContext<unknown, unknown, unknown, SubjectRef>): unknown;
|
|
28
|
+
};
|
|
29
|
+
/** Erased form of a no-content (DELETE) route. */
|
|
30
|
+
export type ErasedNoContentConfig = {
|
|
31
|
+
readonly descriptor: RouteContract;
|
|
32
|
+
readonly method: HttpMethod;
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly summary: string;
|
|
35
|
+
/** Maximum request body bytes for this route; omitted retains the application limit. */
|
|
36
|
+
readonly bodyLimitBytes?: number;
|
|
37
|
+
readonly capabilities?: RouteCapabilities;
|
|
38
|
+
readonly access: RouteAccess;
|
|
39
|
+
readonly params?: z.ZodType;
|
|
40
|
+
readonly body?: z.ZodType;
|
|
41
|
+
handler(context: RouteHandlerContext<unknown, undefined, unknown, SubjectRef>): Promise<void> | void;
|
|
42
|
+
};
|
|
43
|
+
/** The execution engine behind response-producing route verbs. */
|
|
44
|
+
export declare function buildDefinition(config: ErasedRouteConfig): RouteBlueprint;
|
|
45
|
+
/** The execution engine behind deleteRoute: parse inputs, then return 204. */
|
|
46
|
+
export declare function buildNoContentDefinition(config: ErasedNoContentConfig): RouteBlueprint;
|
|
47
|
+
//# sourceMappingURL=route-execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-execution.d.ts","sourceRoot":"","sources":["../../../src/lib/route/route-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAS1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,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QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IAC1B,OAAO,CACL,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,GACpE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAsCzE;AAED,8EAA8E;AAC9E,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,qBAAqB,GAC5B,cAAc,CAqChB"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { HttpWiringError, RequestValidationError, ResponseDriftError, } from "../http-errors.js";
|
|
2
|
+
import { isObjectValue } from "../object-value.js";
|
|
3
|
+
/** The execution engine behind response-producing route verbs. */
|
|
4
|
+
export function buildDefinition(config) {
|
|
5
|
+
const status = config.status ?? (config.method === "POST" ? 201 : 200);
|
|
6
|
+
const execute = async (raw) => {
|
|
7
|
+
const subject = raw.subject;
|
|
8
|
+
assertSubjectAllowed(config, subject);
|
|
9
|
+
const authenticatedSubject = resolveAuthenticatedSubject(config.access, raw);
|
|
10
|
+
assertSubjectAllowed(config, authenticatedSubject);
|
|
11
|
+
const inputs = parseInputs(config, raw);
|
|
12
|
+
const result = await config.handler({
|
|
13
|
+
...inputs,
|
|
14
|
+
subject,
|
|
15
|
+
authenticatedSubject,
|
|
16
|
+
requestId: raw.requestId,
|
|
17
|
+
locale: raw.locale,
|
|
18
|
+
log: raw.log,
|
|
19
|
+
...forwardedIdentity(raw),
|
|
20
|
+
...forwardedReads(raw),
|
|
21
|
+
});
|
|
22
|
+
return parseHandlerResult(config, result);
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
kind: "route",
|
|
26
|
+
descriptor: config.descriptor,
|
|
27
|
+
method: config.method,
|
|
28
|
+
path: config.path,
|
|
29
|
+
summary: config.summary,
|
|
30
|
+
...bodyLimitOf(config),
|
|
31
|
+
access: config.access,
|
|
32
|
+
capabilities: config.capabilities ?? {},
|
|
33
|
+
status,
|
|
34
|
+
schemas: { response: config.response, ...requestSchemasOf(config) },
|
|
35
|
+
execute,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** The execution engine behind deleteRoute: parse inputs, then return 204. */
|
|
39
|
+
export function buildNoContentDefinition(config) {
|
|
40
|
+
const execute = async (raw) => {
|
|
41
|
+
const subject = raw.subject;
|
|
42
|
+
assertSubjectAllowed(config, subject);
|
|
43
|
+
const authenticatedSubject = resolveAuthenticatedSubject(config.access, raw);
|
|
44
|
+
assertSubjectAllowed(config, authenticatedSubject);
|
|
45
|
+
const inputs = parseInputs(config, raw);
|
|
46
|
+
await config.handler({
|
|
47
|
+
params: inputs.params,
|
|
48
|
+
query: undefined,
|
|
49
|
+
body: inputs.body,
|
|
50
|
+
subject,
|
|
51
|
+
authenticatedSubject,
|
|
52
|
+
requestId: raw.requestId,
|
|
53
|
+
locale: raw.locale,
|
|
54
|
+
log: raw.log,
|
|
55
|
+
...forwardedIdentity(raw),
|
|
56
|
+
});
|
|
57
|
+
return { data: undefined };
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
kind: "route",
|
|
61
|
+
descriptor: config.descriptor,
|
|
62
|
+
method: config.method,
|
|
63
|
+
path: config.path,
|
|
64
|
+
summary: config.summary,
|
|
65
|
+
...bodyLimitOf(config),
|
|
66
|
+
access: config.access,
|
|
67
|
+
capabilities: config.capabilities ?? {},
|
|
68
|
+
status: 204,
|
|
69
|
+
schemas: requestSchemasOf(config),
|
|
70
|
+
execute,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Who the caller is beyond the subject, each part only when enforcement set it. */
|
|
74
|
+
function forwardedIdentity(raw) {
|
|
75
|
+
return {
|
|
76
|
+
...(raw.untrustedAuthorizationContext === undefined
|
|
77
|
+
? {}
|
|
78
|
+
: { untrustedAuthorizationContext: raw.untrustedAuthorizationContext }),
|
|
79
|
+
...(raw.authorizationContext === undefined
|
|
80
|
+
? {}
|
|
81
|
+
: { authorizationContext: raw.authorizationContext }),
|
|
82
|
+
...(raw.sessionReauthenticatedAt === undefined
|
|
83
|
+
? {}
|
|
84
|
+
: { sessionReauthenticatedAt: raw.sessionReauthenticatedAt }),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** What a visibility, scoped or feature-state route was given to read with. */
|
|
88
|
+
function forwardedReads(raw) {
|
|
89
|
+
return {
|
|
90
|
+
...(raw.visibleIds === undefined ? {} : { visibleIds: raw.visibleIds }),
|
|
91
|
+
...(raw.scope === undefined ? {} : { scope: raw.scope }),
|
|
92
|
+
...(raw.featureState === undefined
|
|
93
|
+
? {}
|
|
94
|
+
: { featureState: raw.featureState }),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function bodyLimitOf(config) {
|
|
98
|
+
return config.bodyLimitBytes === undefined
|
|
99
|
+
? {}
|
|
100
|
+
: { bodyLimitBytes: config.bodyLimitBytes };
|
|
101
|
+
}
|
|
102
|
+
/** The request schemas a route declared; an undeclared part stays absent. */
|
|
103
|
+
function requestSchemasOf(config) {
|
|
104
|
+
return {
|
|
105
|
+
...(config.params === undefined ? {} : { params: config.params }),
|
|
106
|
+
...(config.query === undefined ? {} : { query: config.query }),
|
|
107
|
+
...(config.body === undefined ? {} : { body: config.body }),
|
|
108
|
+
...(config.meta === undefined ? {} : { meta: config.meta }),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function resolveAuthenticatedSubject(access, raw) {
|
|
112
|
+
if (access.kind !== "public" && access.authorizationContext !== undefined) {
|
|
113
|
+
if (raw.authenticatedSubject === undefined ||
|
|
114
|
+
raw.authenticatedSubject === null) {
|
|
115
|
+
throw new HttpWiringError("authorization-context route ran without its authenticated identity");
|
|
116
|
+
}
|
|
117
|
+
return raw.authenticatedSubject;
|
|
118
|
+
}
|
|
119
|
+
return raw.authenticatedSubject ?? raw.subject;
|
|
120
|
+
}
|
|
121
|
+
function parseInputs(config, raw) {
|
|
122
|
+
return {
|
|
123
|
+
params: parsePart("params", config.params, raw.params),
|
|
124
|
+
query: parsePart("query", config.query, raw.query),
|
|
125
|
+
body: parsePart("body", config.body, raw.body),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function parsePart(part, schema, raw) {
|
|
129
|
+
if (schema === undefined) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const parsed = schema.safeParse(raw ?? {});
|
|
133
|
+
if (!parsed.success) {
|
|
134
|
+
throw new RequestValidationError(part, parsed.error);
|
|
135
|
+
}
|
|
136
|
+
return parsed.data;
|
|
137
|
+
}
|
|
138
|
+
function assertSubjectAllowed(route, subject) {
|
|
139
|
+
if (route.access.kind !== "public" && subject === null) {
|
|
140
|
+
throw new HttpWiringError(`route ${route.method} ${route.path} ran without a subject despite ${route.access.kind} access`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function parseHandlerResult(config, raw) {
|
|
144
|
+
if (config.meta === undefined) {
|
|
145
|
+
return { data: parseHalf(config.path, config.response, raw) };
|
|
146
|
+
}
|
|
147
|
+
if (!isObjectValue(raw) || !("data" in raw) || !("meta" in raw)) {
|
|
148
|
+
throw new HttpWiringError(`route ${config.method} ${config.path} declares a meta schema but its handler did not return { data, meta }`);
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
data: parseHalf(config.path, config.response, raw["data"]),
|
|
152
|
+
meta: parseHalf(config.path, config.meta, raw["meta"]),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function parseHalf(routePath, schema, candidate) {
|
|
156
|
+
const parsed = schema.safeParse(candidate);
|
|
157
|
+
if (!parsed.success) {
|
|
158
|
+
throw new ResponseDriftError(routePath, parsed.error);
|
|
159
|
+
}
|
|
160
|
+
return parsed.data;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=route-execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-execution.js","sourceRoot":"","sources":["../../../src/lib/route/route-execution.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,eAAe,EAEf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAoDnD,kEAAkE;AAClE,MAAM,UAAU,eAAe,CAAC,MAAyB;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAEvE,MAAM,OAAO,GAAG,KAAK,EAAE,GAAkB,EAAwB,EAAE;QACjE,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC5B,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACtC,MAAM,oBAAoB,GAAG,2BAA2B,CACtD,MAAM,CAAC,MAAM,EACb,GAAG,CACJ,CAAC;QACF,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;YAClC,GAAG,MAAM;YACT,OAAO;YACP,oBAAoB;YACpB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,GAAG,iBAAiB,CAAC,GAAG,CAAC;YACzB,GAAG,cAAc,CAAC,GAAG,CAAC;SACvB,CAAC,CAAC;QACH,OAAO,kBAAkB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KAAK,CAAC,MAAM,CAAC,IAAI,SAAS,CAChG,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAyB,EACzB,GAAY;IAEZ,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;IAChE,CAAC;IACD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,eAAe,CACvB,SAAS,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,uEAAuE,CAC7G,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;KACvD,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAChB,SAAiB,EACjB,MAAiB,EACjB,SAAkB;IAElB,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,kBAAkB,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RouteCapabilities } from "./capabilities.js";
|
|
2
|
+
import type { RawRouteBlueprint, RawRouteDefinition } from "./define-raw-route.js";
|
|
3
|
+
import type { RouteBlueprint, RouteDefinition } from "./route-definition.js";
|
|
4
|
+
/**
|
|
5
|
+
* The only door from authored routes to registrable ones (always-a-group
|
|
6
|
+
* rule, locked with Bryton 2026-07-09): the OpenAPI tag is stamped ONCE per
|
|
7
|
+
* group, and group-level capabilities apply across every member — each
|
|
8
|
+
* route's own `capabilities` field overrides per key (route > group; the
|
|
9
|
+
* app default merges at registration).
|
|
10
|
+
*
|
|
11
|
+
* Groups compose: a domain owning two tags returns
|
|
12
|
+
* `[...groupA, ...groupB]`. A blueprint that never passed through a group
|
|
13
|
+
* is not a `RouteDefinition` and will not register — forgetting the group
|
|
14
|
+
* is a compile error, not a runtime surprise.
|
|
15
|
+
*/
|
|
16
|
+
export type HttpRoute = RouteDefinition | RawRouteDefinition;
|
|
17
|
+
type AnyBlueprint = RouteBlueprint | RawRouteBlueprint;
|
|
18
|
+
export declare function routeGroup(tag: string, routes: readonly AnyBlueprint[]): HttpRoute[];
|
|
19
|
+
export declare function routeGroup(tag: string, capabilities: RouteCapabilities, routes: readonly AnyBlueprint[]): HttpRoute[];
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=route-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-group.d.ts","sourceRoot":"","sources":["../../../src/lib/route/route-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7E;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAC7D,KAAK,YAAY,GAAG,cAAc,GAAG,iBAAiB,CAAC;AAQvD,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,SAAS,EAAE,CAAC;AACf,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveCapabilities } from "./capabilities.js";
|
|
2
|
+
function isBlueprintList(value) {
|
|
3
|
+
return Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
export function routeGroup(tag, capabilitiesOrRoutes, maybeRoutes) {
|
|
6
|
+
const capabilities = isBlueprintList(capabilitiesOrRoutes)
|
|
7
|
+
? undefined
|
|
8
|
+
: capabilitiesOrRoutes;
|
|
9
|
+
const routes = isBlueprintList(capabilitiesOrRoutes)
|
|
10
|
+
? capabilitiesOrRoutes
|
|
11
|
+
: (maybeRoutes ?? []);
|
|
12
|
+
return routes.map((blueprint) => ({
|
|
13
|
+
...blueprint,
|
|
14
|
+
tag,
|
|
15
|
+
capabilities: resolveCapabilities(undefined, capabilities, blueprint.capabilities),
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=route-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-group.js","sourceRoot":"","sources":["../../../src/lib/route/route-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,mBAAmB,CAAC;AAuBhF,SAAS,eAAe,CACtB,KAAkD;IAElD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAWD,MAAM,UAAU,UAAU,CACxB,GAAW,EACX,oBAAiE,EACjE,WAAqC;IAErC,MAAM,YAAY,GAAG,eAAe,CAAC,oBAAoB,CAAC;QACxD,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,oBAAoB,CAAC;IACzB,MAAM,MAAM,GAAG,eAAe,CAAC,oBAAoB,CAAC;QAClD,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAChC,GAAG,SAAS;QACZ,GAAG;QACH,YAAY,EAAE,mBAAmB,CAC/B,SAAS,EACT,YAAY,EACZ,SAAS,CAAC,YAAY,CACvB;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-guards.test-support.d.ts","sourceRoot":"","sources":["../../../src/lib/route/route-guards.test-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-guards.test-support.js","sourceRoot":"","sources":["../../../src/lib/route/route-guards.test-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RouteAccess } from "./access.js";
|
|
2
|
+
import type { RouteCapabilities } from "./capabilities.js";
|
|
3
|
+
import { type RawOpenApiOperation, type RawRouteBlueprint, type RawRouteContext } from "./define-raw-route.js";
|
|
4
|
+
/**
|
|
5
|
+
* `sseRoute` — the kit primitive for a Server-Sent-Events stream, so no route
|
|
6
|
+
* hand-rolls the same framing twice (docs/architecture/http-edge.md). It is a
|
|
7
|
+
* thin, typed shape over {@link defineRawRoute}: it still declares `access` and
|
|
8
|
+
* flows through the same session/permission wall as every route, but it OWNS the
|
|
9
|
+
* SSE mechanics a stream must get right — hijacking the socket, the
|
|
10
|
+
* `text/event-stream` headers, the keep-alive heartbeat, the `:ready` flush, and
|
|
11
|
+
* tearing the subscription down when the client disconnects.
|
|
12
|
+
*
|
|
13
|
+
* Authorization the kit cannot express (e.g. "may this subject view this org?")
|
|
14
|
+
* stays in the handler: it runs BEFORE any stream opens, denies with the normal
|
|
15
|
+
* error envelope, and only calls `ctx.open(...)` once the caller is cleared —
|
|
16
|
+
* so a denial never leaks a hijacked socket.
|
|
17
|
+
*/
|
|
18
|
+
/** Silent-comment keep-alive cadence — proxies/browsers drop an idle stream otherwise. */
|
|
19
|
+
export declare const DEFAULT_SSE_HEARTBEAT_MS = 15000;
|
|
20
|
+
/** The write surface a stream handler uses; the kit owns the wire framing. */
|
|
21
|
+
export type SseStream = {
|
|
22
|
+
/** Emit one `data: <json>\n\n` event frame. */
|
|
23
|
+
send(data: unknown): void;
|
|
24
|
+
/** Emit a bare `:<text>\n\n` comment (readiness marker, manual keep-alive). */
|
|
25
|
+
comment(text?: string): void;
|
|
26
|
+
};
|
|
27
|
+
/** Runs when the client disconnects — release every subscription here. */
|
|
28
|
+
export type SseCleanup = () => void;
|
|
29
|
+
export type SseRouteContext = RawRouteContext & {
|
|
30
|
+
/**
|
|
31
|
+
* Open the stream: hijack the socket, write the event-stream headers, wire the
|
|
32
|
+
* heartbeat, flush `:ready`, then keep the connection live. `onOpen` receives
|
|
33
|
+
* the write surface and returns the teardown to run on disconnect. Call this
|
|
34
|
+
* ONLY after the handler has authorized the request; to deny, send an error and
|
|
35
|
+
* return without calling it.
|
|
36
|
+
*
|
|
37
|
+
* A property (not a method) so a handler can safely destructure `{ open }`.
|
|
38
|
+
*/
|
|
39
|
+
readonly open: (onOpen: (stream: SseStream) => SseCleanup) => void;
|
|
40
|
+
};
|
|
41
|
+
export type SseRouteConfig = {
|
|
42
|
+
readonly path: string;
|
|
43
|
+
readonly summary: string;
|
|
44
|
+
readonly access: RouteAccess;
|
|
45
|
+
/** Route-rung of the capability ladder (route, then group, then app). */
|
|
46
|
+
readonly capabilities?: RouteCapabilities;
|
|
47
|
+
/** Keep-alive cadence; defaults to {@link DEFAULT_SSE_HEARTBEAT_MS}. */
|
|
48
|
+
readonly heartbeatMs?: number;
|
|
49
|
+
readonly openapi: RawOpenApiOperation;
|
|
50
|
+
readonly handler: (ctx: SseRouteContext) => Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
/** Declare an SSE route. `access` is required — the same wall as every verb. */
|
|
53
|
+
export declare function sseRoute(config: SseRouteConfig): RawRouteBlueprint;
|
|
54
|
+
//# sourceMappingURL=sse-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse-route.d.ts","sourceRoot":"","sources":["../../../src/lib/route/sse-route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;GAaG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG;IACtB,+CAA+C;IAC/C,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC;AAEpC,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,UAAU,KAAK,IAAI,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,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