@fuzdev/fuz_app 0.169.0 → 0.171.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/dist/actions/CLAUDE.md +19 -21
- package/dist/actions/action_codegen.d.ts +27 -18
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +90 -90
- package/dist/actions/action_event.d.ts +0 -8
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -6
- package/dist/actions/action_event_data.d.ts +4 -4
- package/dist/actions/action_rpc.d.ts +1 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +6 -7
- package/dist/actions/action_spec.d.ts +8 -10
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +1 -1
- package/dist/actions/action_types.d.ts +4 -4
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +2 -2
- package/dist/actions/broadcast_api.d.ts +2 -2
- package/dist/actions/broadcast_api.js +4 -4
- package/dist/actions/compile_action_registry.d.ts +6 -7
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/compile_action_registry.js +8 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +3 -2
- package/dist/actions/perform_action.d.ts +6 -6
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +11 -10
- package/dist/actions/socket.svelte.d.ts +1 -1
- package/dist/actions/socket.svelte.js +2 -2
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +2 -1
- package/dist/auth/CLAUDE.md +11 -11
- package/dist/auth/admin_action_specs.d.ts +24 -24
- package/dist/auth/audit_emitter.d.ts +6 -7
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +11 -22
- package/dist/auth/audit_log_ddl.d.ts +1 -1
- package/dist/auth/audit_log_ddl.js +1 -1
- package/dist/auth/audit_log_queries.d.ts +0 -13
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +3 -3
- package/dist/auth/audit_log_schema.d.ts +14 -15
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +1 -1
- package/dist/auth/auth_ddl.d.ts +1 -1
- package/dist/auth/auth_ddl.js +1 -1
- package/dist/auth/cell_action_specs.d.ts +54 -54
- package/dist/auth/cell_actions.d.ts +2 -2
- package/dist/auth/cell_actions.js +5 -5
- package/dist/auth/middleware.d.ts +6 -2
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +14 -2
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +7 -9
- package/dist/auth/role_grant_offer_action_specs.d.ts +6 -6
- package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
- package/dist/auth/role_grant_offer_ddl.js +1 -1
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +2 -3
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/env/env_schemas.d.ts +1 -2
- package/dist/env/env_schemas.d.ts.map +1 -1
- package/dist/env/env_schemas.js +3 -4
- package/dist/http/CLAUDE.md +30 -31
- package/dist/http/auth_shape.d.ts +14 -32
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +14 -49
- package/dist/http/error_schemas.d.ts +18 -18
- package/dist/http/json_text.d.ts +53 -0
- package/dist/http/json_text.d.ts.map +1 -0
- package/dist/http/json_text.js +152 -0
- package/dist/http/jsonrpc_helpers.js +1 -1
- package/dist/http/route_error_check.d.ts +2 -2
- package/dist/http/route_error_check.d.ts.map +1 -1
- package/dist/http/route_error_check.js +2 -3
- package/dist/http/route_errors.d.ts +4 -4
- package/dist/http/route_errors.d.ts.map +1 -1
- package/dist/http/route_errors.js +0 -13
- package/dist/http/route_result.d.ts +2 -1
- package/dist/http/route_result.d.ts.map +1 -1
- package/dist/http/route_spec.d.ts +34 -37
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +31 -31
- package/dist/http/schema_helpers.d.ts +77 -68
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +54 -77
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +6 -8
- package/dist/primitive_schemas.d.ts +9 -17
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +9 -17
- package/dist/realtime/sse.d.ts +3 -3
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +2 -2
- package/dist/schema_issues.d.ts +39 -147
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +39 -352
- package/dist/schema_meta.d.ts +63 -136
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +37 -184
- package/dist/sensitivity.d.ts +3 -5
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -5
- package/dist/testing/CLAUDE.md +20 -22
- package/dist/testing/adversarial_headers.js +2 -2
- package/dist/testing/adversarial_input_cases.d.ts +19 -18
- package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
- package/dist/testing/adversarial_input_cases.js +31 -46
- package/dist/testing/assertions.d.ts +2 -2
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +3 -3
- package/dist/testing/cross_backend/account_lifecycle.js +2 -2
- package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +4 -3
- package/dist/testing/cross_backend/cell_crud.js +1 -1
- package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
- package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_table.js +3 -3
- package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
- package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
- package/dist/testing/cross_backend/cross_rpc.js +4 -4
- package/dist/testing/cross_backend/differential.js +2 -2
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +16 -11
- package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
- package/dist/testing/cross_backend/query_shape.js +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts +25 -3
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +4 -4
- package/dist/testing/cross_backend/sse_round_trip.js +2 -2
- package/dist/testing/cross_backend/testing_origin_check.d.ts +4 -4
- package/dist/testing/cross_backend/token_lifetime.js +3 -3
- package/dist/testing/cross_backend/wire_shapes.js +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.js +8 -0
- package/dist/testing/cross_backend/ws_round_trip.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +1 -1
- package/dist/testing/integration.js +2 -2
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -2
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +2 -2
- package/dist/testing/rpc_attack_surface.js +1 -1
- package/dist/testing/rpc_envelope_cases.d.ts +10 -3
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +22 -1
- package/dist/testing/rpc_helpers.d.ts +12 -14
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +9 -10
- package/dist/testing/schema_generators.d.ts +67 -60
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +154 -159
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/surface_invariants.d.ts +1 -1
- package/dist/testing/surface_invariants.js +1 -1
- package/dist/ui/form_state.svelte.d.ts +1 -1
- package/dist/ui/form_state.svelte.js +1 -1
- package/package.json +5 -7
- package/dist/zod.d.ts +0 -116
- package/dist/zod.d.ts.map +0 -1
- package/dist/zod.js +0 -218
- package/dist/zod_schemas.d.ts +0 -100
- package/dist/zod_schemas.d.ts.map +0 -1
- package/dist/zod_schemas.js +0 -157
|
@@ -75,7 +75,11 @@ export declare const assert_credential_routes_in_auth_scope: (route_specs: Reado
|
|
|
75
75
|
/**
|
|
76
76
|
* Throw unless every origin carve-out names a path and a reason, and stays
|
|
77
77
|
* off the auth middleware's scope: a path that starts with `/` (a Hono pattern
|
|
78
|
-
* like `/hooks/*` or `/health`)
|
|
78
|
+
* like `/hooks/*` or `/health`) and is no route template — a carve-out matches
|
|
79
|
+
* a request path exactly or by a trailing `/*` prefix (`middleware_applies`),
|
|
80
|
+
* so a `:param`, a `{pattern}`, or an inner `*` would match only its own
|
|
81
|
+
* literal text at runtime while the surface reads it as the template — a
|
|
82
|
+
* non-blank reason — a carve-out is an
|
|
79
83
|
* argument someone wrote down, never an empty placeholder — and a pattern that
|
|
80
84
|
* matches nothing under `auth_path` (`middleware_paths_overlap`).
|
|
81
85
|
*
|
|
@@ -93,7 +97,7 @@ export declare const assert_credential_routes_in_auth_scope: (route_specs: Reado
|
|
|
93
97
|
*
|
|
94
98
|
* @param carve_outs - the carve-outs to check
|
|
95
99
|
* @param auth_path - the auth middleware's path pattern (default `AUTH_MIDDLEWARE_PATH`)
|
|
96
|
-
* @throws Error naming the first carve-out with no path, no reason, or a pattern overlapping `auth_path`
|
|
100
|
+
* @throws Error naming the first carve-out with no path, a route template, no reason, or a pattern overlapping `auth_path`
|
|
97
101
|
*/
|
|
98
102
|
export declare const assert_origin_carve_outs_valid: (carve_outs: ReadonlyArray<MiddlewareCarveOut>, auth_path?: string) => void;
|
|
99
103
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,6BAA6B,GACzC,QAAQ,eAAe,GAAG,cAAc,GAAG,wBAAwB,EACnE,MAAM,MAAM,KACV,IAQF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sCAAsC,GAClD,aAAa,aAAa,CAAC,SAAS,CAAC,KACnC,IAcF,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EA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;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,OAAO,EACb,SAAS,qBAAqB,KAC5B,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAqF/B,CAAC"}
|
package/dist/auth/middleware.js
CHANGED
|
@@ -92,7 +92,11 @@ export const assert_credential_routes_in_auth_scope = (route_specs) => {
|
|
|
92
92
|
/**
|
|
93
93
|
* Throw unless every origin carve-out names a path and a reason, and stays
|
|
94
94
|
* off the auth middleware's scope: a path that starts with `/` (a Hono pattern
|
|
95
|
-
* like `/hooks/*` or `/health`)
|
|
95
|
+
* like `/hooks/*` or `/health`) and is no route template — a carve-out matches
|
|
96
|
+
* a request path exactly or by a trailing `/*` prefix (`middleware_applies`),
|
|
97
|
+
* so a `:param`, a `{pattern}`, or an inner `*` would match only its own
|
|
98
|
+
* literal text at runtime while the surface reads it as the template — a
|
|
99
|
+
* non-blank reason — a carve-out is an
|
|
96
100
|
* argument someone wrote down, never an empty placeholder — and a pattern that
|
|
97
101
|
* matches nothing under `auth_path` (`middleware_paths_overlap`).
|
|
98
102
|
*
|
|
@@ -110,7 +114,7 @@ export const assert_credential_routes_in_auth_scope = (route_specs) => {
|
|
|
110
114
|
*
|
|
111
115
|
* @param carve_outs - the carve-outs to check
|
|
112
116
|
* @param auth_path - the auth middleware's path pattern (default `AUTH_MIDDLEWARE_PATH`)
|
|
113
|
-
* @throws Error naming the first carve-out with no path, no reason, or a pattern overlapping `auth_path`
|
|
117
|
+
* @throws Error naming the first carve-out with no path, a route template, no reason, or a pattern overlapping `auth_path`
|
|
114
118
|
*/
|
|
115
119
|
export const assert_origin_carve_outs_valid = (carve_outs, auth_path = AUTH_MIDDLEWARE_PATH) => {
|
|
116
120
|
for (const carve_out of carve_outs) {
|
|
@@ -118,6 +122,14 @@ export const assert_origin_carve_outs_valid = (carve_outs, auth_path = AUTH_MIDD
|
|
|
118
122
|
throw new Error(`origin carve-out path ${JSON.stringify(carve_out.path)} must start with / ` +
|
|
119
123
|
'(a Hono pattern like /hooks/* or /health)');
|
|
120
124
|
}
|
|
125
|
+
const wildcard_at = carve_out.path.indexOf('*');
|
|
126
|
+
if (/[:{]/.test(carve_out.path) ||
|
|
127
|
+
(wildcard_at !== -1 &&
|
|
128
|
+
!(wildcard_at === carve_out.path.length - 1 && carve_out.path.endsWith('/*')))) {
|
|
129
|
+
throw new Error(`origin carve-out ${carve_out.path} is a route template — a carve-out matches a ` +
|
|
130
|
+
'request path exactly or by a trailing /* prefix, so a :param, {pattern} or inner * ' +
|
|
131
|
+
'would match only its own literal text; carve out the literal path or its /* prefix');
|
|
132
|
+
}
|
|
121
133
|
if (carve_out.reason.trim() === '') {
|
|
122
134
|
throw new Error(`origin carve-out ${carve_out.path} needs a reason — say why the paths are safe ` +
|
|
123
135
|
'without the origin check');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_context.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/request_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,KAAK,EAEV,KAAK,SAAS,EACd,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAerD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAIN,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,sBAAsB,EACtB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"request_context.d.ts","sourceRoot":"../src/lib/","sources":["../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E,GAC5C;IAAE,KAAK,EAAE,OAAO,0BAA0B,CAAA;CAAE,GAC5C;IAAE,KAAK,EAAE,OAAO,sBAAsB,CAAA;CAAE,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,mBAAmB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,eAAe,EAAE,cAAc,GAAG,IAAI,CAAA;CAAE,GACpD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,IAAI,EAAE,wBAAwB,CAAA;CAAE,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,yBAAyB,GACrC,MAAM,SAAS,EACf,YAAY,MAAM,GAAG,IAAI,EACzB,MAAM,SAAS,EACf,cAAc,MAAM,GAAG,SAAS,KAC9B,OAAO,CAAC,mBAAmB,CAwC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,uBAAuB,GACnC,GAAG,OAAO,EACV,MAAM,SAAS,EACf,MAAM,SAAS,EACf,QAAQ,MAAM,GAAG,SAAS,KACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAYzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,SAAS,KACb,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAO5D,CAAC"}
|
|
@@ -47,6 +47,7 @@ import { is_route_scope_capability, token_scope_admits_non_rpc, token_scope_deni
|
|
|
47
47
|
import { is_public_auth, needs_actor, parse_acting } from '../http/auth_shape.js';
|
|
48
48
|
import { is_null_schema } from '../http/schema_helpers.js';
|
|
49
49
|
import { ERROR_AUTHENTICATION_REQUIRED, ERROR_INSUFFICIENT_PERMISSIONS, ERROR_CREDENTIAL_TYPE_REQUIRED, ERROR_ACTOR_REQUIRED, ERROR_ACTOR_NOT_ON_ACCOUNT, ERROR_NO_ACTORS_ON_ACCOUNT, ERROR_ACCOUNT_VANISHED } from '../http/error_schemas.js';
|
|
50
|
+
import { read_json_body } from '../http/json_text.js';
|
|
50
51
|
/** Hono context variable name for the request context. */
|
|
51
52
|
export const REQUEST_CONTEXT_KEY = 'request_context';
|
|
52
53
|
/**
|
|
@@ -651,14 +652,14 @@ export const create_fuz_authorization_handler = (deps) => {
|
|
|
651
652
|
*
|
|
652
653
|
* REST is bi-located: GETs declare `acting` on `query`, mutations on `input`.
|
|
653
654
|
* Query validation still runs ahead of the authorization phase, so the GET
|
|
654
|
-
* half reads a typed
|
|
655
|
+
* half reads a typed field. Input validation now runs *after* the
|
|
655
656
|
* authority gates (nothing about a route's body shape reaches a caller those
|
|
656
657
|
* gates refuse), so the mutation half reads the raw body instead.
|
|
657
658
|
*
|
|
658
659
|
* The raw read mirrors `create_input_validation`'s own skip conditions exactly
|
|
659
660
|
* — GETs and null-input specs — so this never parses a body the route itself
|
|
660
661
|
* would have left alone. That matters for the routes carrying raw bytes rather
|
|
661
|
-
* than JSON (git smart-HTTP, binary uploads): they declare `input:
|
|
662
|
+
* than JSON (git smart-HTTP, binary uploads): they declare `input: literal(null)`,
|
|
662
663
|
* so their stream reaches the handler untouched, and they carry `acting` on
|
|
663
664
|
* `query` regardless.
|
|
664
665
|
*
|
|
@@ -675,14 +676,11 @@ const read_route_acting = async (c, spec) => {
|
|
|
675
676
|
return validated_query.acting;
|
|
676
677
|
if (spec.method === 'GET' || is_null_schema(spec.input))
|
|
677
678
|
return undefined;
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
catch {
|
|
683
|
-
// Malformed body — input validation answers with the 400.
|
|
679
|
+
const read = await read_json_body(c.req);
|
|
680
|
+
// Malformed body — input validation answers with the 400.
|
|
681
|
+
if (!read.ok)
|
|
684
682
|
return undefined;
|
|
685
|
-
|
|
683
|
+
const body = read.value;
|
|
686
684
|
if (typeof body !== 'object' || body === null)
|
|
687
685
|
return undefined;
|
|
688
686
|
return parse_acting(body.acting);
|
|
@@ -96,24 +96,24 @@ export declare const RoleGrantOfferCreateInput: import("@fuzdev/fuz_schema/schem
|
|
|
96
96
|
to_account_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
97
97
|
scope_kind?: string | null | undefined;
|
|
98
98
|
scope_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
99
|
-
message?: string | null | undefined;
|
|
100
99
|
acting?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined;
|
|
100
|
+
message?: string | null | undefined;
|
|
101
101
|
to_actor_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
102
102
|
}, import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
103
103
|
role: string;
|
|
104
104
|
to_account_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
105
105
|
scope_kind?: string | null | undefined;
|
|
106
106
|
scope_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
107
|
-
message?: string | null | undefined;
|
|
108
107
|
acting?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined;
|
|
108
|
+
message?: string | null | undefined;
|
|
109
109
|
to_actor_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
110
110
|
}, {
|
|
111
111
|
role: string;
|
|
112
112
|
to_account_id: string;
|
|
113
113
|
scope_kind?: string | null | undefined;
|
|
114
114
|
scope_id?: string | null | undefined;
|
|
115
|
-
message?: string | null | undefined;
|
|
116
115
|
acting?: string | undefined;
|
|
116
|
+
message?: string | null | undefined;
|
|
117
117
|
to_actor_id?: string | null | undefined;
|
|
118
118
|
}, "object", {
|
|
119
119
|
to_account_id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
|
|
@@ -1283,24 +1283,24 @@ export declare const role_grant_offer_create_action_spec: {
|
|
|
1283
1283
|
to_account_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
1284
1284
|
scope_kind?: string | null | undefined;
|
|
1285
1285
|
scope_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
1286
|
-
message?: string | null | undefined;
|
|
1287
1286
|
acting?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined;
|
|
1287
|
+
message?: string | null | undefined;
|
|
1288
1288
|
to_actor_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
1289
1289
|
}, import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
1290
1290
|
role: string;
|
|
1291
1291
|
to_account_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
1292
1292
|
scope_kind?: string | null | undefined;
|
|
1293
1293
|
scope_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
1294
|
-
message?: string | null | undefined;
|
|
1295
1294
|
acting?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined;
|
|
1295
|
+
message?: string | null | undefined;
|
|
1296
1296
|
to_actor_id?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null | undefined;
|
|
1297
1297
|
}, {
|
|
1298
1298
|
role: string;
|
|
1299
1299
|
to_account_id: string;
|
|
1300
1300
|
scope_kind?: string | null | undefined;
|
|
1301
1301
|
scope_id?: string | null | undefined;
|
|
1302
|
-
message?: string | null | undefined;
|
|
1303
1302
|
acting?: string | undefined;
|
|
1303
|
+
message?: string | null | undefined;
|
|
1304
1304
|
to_actor_id?: string | null | undefined;
|
|
1305
1305
|
}, "object", {
|
|
1306
1306
|
to_account_id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `ROLE_GRANT_OFFER_COLUMNS` projection const.
|
|
5
5
|
*
|
|
6
6
|
* Separated from `auth/role_grant_offer_schema.ts` so the schema module stays
|
|
7
|
-
*
|
|
7
|
+
* schemas only (paired with `auth/auth_ddl.ts` and `auth/audit_log_ddl.ts`).
|
|
8
8
|
*
|
|
9
9
|
* An offer is a pending grant awaiting recipient consent. Lifecycle states
|
|
10
10
|
* are mutually exclusive via a CHECK constraint (`role_grant_offer_single_terminal`):
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `ROLE_GRANT_OFFER_COLUMNS` projection const.
|
|
5
5
|
*
|
|
6
6
|
* Separated from `auth/role_grant_offer_schema.ts` so the schema module stays
|
|
7
|
-
*
|
|
7
|
+
* schemas only (paired with `auth/auth_ddl.ts` and `auth/audit_log_ddl.ts`).
|
|
8
8
|
*
|
|
9
9
|
* An offer is a pending grant awaiting recipient consent. Lifecycle states
|
|
10
10
|
* are mutually exclusive via a CHECK constraint (`role_grant_offer_single_terminal`):
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role_grant_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAKN,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"role_grant_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAKN,KAAK,KAAK,EAEV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAsC,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAExF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAO9D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAClC,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAC;CAC5E;AAID,eAAO,MAAM,6CAA6C,8BAA8B,CAAC;AACzF,eAAO,MAAM,8CAA8C,+BAA+B,CAAC;AAC3F,eAAO,MAAM,6CAA6C,8BAA8B,CAAC;AACzF,eAAO,MAAM,6CAA6C,8BAA8B,CAAC;AACzF,eAAO,MAAM,8CAA8C,+BAA+B,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWjB,CAAC;AAEzC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUT,CAAC;AAczC;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,EAAE,aAAa,CAAC,MAAM,CACH,CAAC;AAEtE;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,EAAE,KAAK,CAAC,SAAS,CACwB,CAAC;AAM1F;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oCAAoC,GAChD,QAAQ,kBAAkB,EAC1B,KAAK,MAAM,KACT,kBAcF,CAAC;AAIF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,6CAA6C,GACzD,QAAQ,6BAA6B,KACnC,mBACiF,CAAC;AAErF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,6CAA6C,GACzD,QAAQ,6BAA6B,KACnC,mBACiF,CAAC;AAErF,eAAO,MAAM,qCAAqC,GACjD,QAAQ,sBAAsB,KAC5B,mBACyE,CAAC"}
|
|
@@ -37,11 +37,10 @@
|
|
|
37
37
|
* @module
|
|
38
38
|
*/
|
|
39
39
|
import { DEV } from 'esm-env';
|
|
40
|
-
import { nullable, object, one_of, void as fuz_void } from '@fuzdev/fuz_schema/schema.ts';
|
|
40
|
+
import { nullable, object, one_of, void as fuz_void, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
41
41
|
import { Uuid as UuidSchema, bounded_string } from '../primitive_schemas.js';
|
|
42
42
|
import { create_action_event_spec } from '../actions/action_bridge.js';
|
|
43
43
|
import { create_jsonrpc_notification } from '../http/jsonrpc_helpers.js';
|
|
44
|
-
import { parse_any } from '../schema_issues.js';
|
|
45
44
|
import { RoleName } from './role_schema.js';
|
|
46
45
|
import { ScopeKindName } from './scope_kind_schema.js';
|
|
47
46
|
import { RoleGrantOfferJson } from './role_grant_offer_schema.js';
|
|
@@ -218,7 +217,7 @@ export const create_validated_notification_sender = (sender, log) => {
|
|
|
218
217
|
send_to_account: (account_id, message) => {
|
|
219
218
|
const spec = notification_spec_by_method.get(message.method);
|
|
220
219
|
if (spec) {
|
|
221
|
-
const result =
|
|
220
|
+
const result = parse(spec.input, message.params);
|
|
222
221
|
if (!result.ok) {
|
|
223
222
|
log.error(`notification params schema mismatch: ${message.method}`, result.issues);
|
|
224
223
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* Audit metadata carries `self_service: true` so admin reviewers can
|
|
21
21
|
* distinguish self-toggled role_grants from admin grants/offers. The
|
|
22
22
|
* `role_grant_create` / `role_grant_revoke` metadata schemas declare
|
|
23
|
-
* `self_service:
|
|
23
|
+
* `self_service: optional(boolean)` explicitly, so the field is
|
|
24
24
|
* part of the documented schema surface and is round-trip-validated by
|
|
25
25
|
* `query_audit_log`.
|
|
26
26
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* Audit metadata carries `self_service: true` so admin reviewers can
|
|
21
21
|
* distinguish self-toggled role_grants from admin grants/offers. The
|
|
22
22
|
* `role_grant_create` / `role_grant_revoke` metadata schemas declare
|
|
23
|
-
* `self_service:
|
|
23
|
+
* `self_service: optional(boolean)` explicitly, so the field is
|
|
24
24
|
* part of the documented schema surface and is round-trip-validated by
|
|
25
25
|
* `query_audit_log`.
|
|
26
26
|
*
|
|
@@ -34,8 +34,7 @@ export declare const env_integer: (options?: EnvIntegerOptions) => PipeSchema<nu
|
|
|
34
34
|
* `no`, `off`, `n`, or `disabled` for `false`. Anything else is refused,
|
|
35
35
|
* `''` and `' true'` included, so a typo doesn't silently flip a feature.
|
|
36
36
|
*
|
|
37
|
-
* The
|
|
38
|
-
* of the Rust spine's `parse_stringbool`.
|
|
37
|
+
* The twin of the Rust spine's `parse_stringbool`, its set and its case rule.
|
|
39
38
|
*/
|
|
40
39
|
export declare const EnvStringbool: PipeSchema<boolean, typeof string>;
|
|
41
40
|
//# sourceMappingURL=env_schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/env_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAON,MAAM,EAEN,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,mBAAmB,CAAC;AAE3B,gCAAgC;AAChC,MAAM,WAAW,iBAAiB;IACjC,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAeD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,iBAAiB,KAAG,UAAU,CAAC,MAAM,EAAE,OAAO,MAAM,CAMxF,CAAC;AAmBH
|
|
1
|
+
{"version":3,"file":"env_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/env/env_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAON,MAAM,EAEN,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AAGtC,OAAO,mBAAmB,CAAC;AAE3B,gCAAgC;AAChC,MAAM,WAAW,iBAAiB;IACjC,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAeD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,iBAAiB,KAAG,UAAU,CAAC,MAAM,EAAE,OAAO,MAAM,CAMxF,CAAC;AAmBH;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,OAAO,EAAE,OAAO,MAAM,CAO5D,CAAC"}
|
package/dist/env/env_schemas.js
CHANGED
|
@@ -27,8 +27,8 @@ const EnvDigits = pipe(string, transform((v) => v.replace(WHITE_SPACE_EDGES, '')
|
|
|
27
27
|
* @param options - the bounds, default `0` to `Number.MAX_SAFE_INTEGER`
|
|
28
28
|
*/
|
|
29
29
|
export const env_integer = (options) => pipe(EnvDigits, safe_integer, min_value(options?.min ?? 0), max_value(options?.max ?? Number.MAX_SAFE_INTEGER));
|
|
30
|
-
// the recognized spellings, lowercase, as
|
|
31
|
-
//
|
|
30
|
+
// the recognized spellings, lowercase, as the Rust spine's `parse_stringbool`
|
|
31
|
+
// has them
|
|
32
32
|
const STRINGBOOL_VALUES = new Map([
|
|
33
33
|
['true', true],
|
|
34
34
|
['1', true],
|
|
@@ -49,7 +49,6 @@ const STRINGBOOL_VALUES = new Map([
|
|
|
49
49
|
* `no`, `off`, `n`, or `disabled` for `false`. Anything else is refused,
|
|
50
50
|
* `''` and `' true'` included, so a typo doesn't silently flip a feature.
|
|
51
51
|
*
|
|
52
|
-
* The
|
|
53
|
-
* of the Rust spine's `parse_stringbool`.
|
|
52
|
+
* The twin of the Rust spine's `parse_stringbool`, its set and its case rule.
|
|
54
53
|
*/
|
|
55
54
|
export const EnvStringbool = pipe(string, check((v) => STRINGBOOL_VALUES.has(v.toLowerCase()), 'true|1|yes|on|y|enabled or false|0|no|off|n|disabled'), transform((v) => STRINGBOOL_VALUES.get(v.toLowerCase())));
|
package/dist/http/CLAUDE.md
CHANGED
|
@@ -22,6 +22,7 @@ effects, see ../../../docs/architecture.md.
|
|
|
22
22
|
- `http/route_error_check.ts` — `check_route_error` (whether an error response is one its route's map declares, the rule the DEV error check and `assert_response_matches_spec` share; `ALWAYS_ACCEPTED_ERRORS`, `is_error_status`, `format_route_error_check`) `is_json_response`, and the test helpers' hono-free route lookup (`split_route_template` and `parse_route_param`, a template read segment by segment as Hono's `getPattern` reads it; `compile_route_path`; `compile_route_param_pattern`, a `{re}` grouped and anchored as `compile_route_path` reads it — Hono's RegExpRouter reading, stricter than TrieRouter's ungrouped `^re$`; `decode_route_path`, a path as Hono's router decodes it; `to_mounted_routes`; `find_mounted_route`), whose reading `resolve_valid_path` also fills params by. Hono-free and `esm-env`-free.
|
|
23
23
|
- `http/dev_route_error_check.ts` — `create_dev_route_error_check({route_specs, route_error_maps, log})`: the DEV-only outer error check, `null` outside DEV; `create_route_lookup`, its lookup by Hono's own router.
|
|
24
24
|
- `http/schema_helpers.ts` — shared schema introspection (null/void/strict/surface/middleware-applies), and `to_void_params` / `to_input_params` / `json_has_own_proto_key` / `safe_parse_dropping_unknown_keys`.
|
|
25
|
+
- `http/json_text.ts` — `parse_json_text`: JSON text read as the Rust spine's `serde_json` reads it, refusing what `JSON.parse` accepts and serde refuses (an escaped lone surrogate in a string or key, a number out of `f64` range, nesting `JSON_DEPTH_LIMIT` (128) deep); one linear scan of the text after `JSON.parse` accepts it (`is_serde_json_text`), so a refused value under a duplicated key is seen and the cost stays a few milliseconds a MiB. `read_json_body(c.req)` reads a request body through it once per request (the authorization phase's `acting` read and input validation share it), as text, never `c.req.json()`. Every body and frame parse runs it: route input, the RPC POST body and `GET` `params`, WS frames. Hono-free, imports nothing.
|
|
25
26
|
- `http/middleware_spec.ts` — `MiddlewareSpec` interface.
|
|
26
27
|
- `http/body_limit.ts` — `create_body_limit_middleware(max_size)`: the `413` body cap `create_app_server` mounts, as `create_body_limit_middleware_spec(max_size)`, a `MiddlewareSpec` at `'*'` ahead of the other middleware, absent with `max_body_size: null`. Its hono-free shape, `body_limit_middleware_shape` (`http/body_limit_schema.ts`), declares its `413` `payload_too_large` and `400` `invalid_content_length`, so every route's error map carries both; `create_test_app_surface_spec` lists the same shape with a stub handler. Refuses on `Content-Length` without reading `c.req.raw.body` and answers `Connection: close` — `413` past the cap, `400` `ERROR_INVALID_CONTENT_LENGTH` when the value is not a plain run of ASCII digits (a length the cap cannot read, which Hono's `bodyLimit` would pass uncounted) — else falls through to Hono's `bodyLimit` (no `Content-Length`, or one beside `Transfer-Encoding`), which reads the body into memory up to the cap before the next middleware runs, so its `413` — no `Connection: close` — also precedes origin and auth. After the header `413` Node and Bun close at once (the header is what makes them — Bun 1.4.3 is the tested floor, an older Bun kept the connection and served the next request) and Deno closes once the declared body has arrived (../../../docs/security.md §Body Size Limiting).
|
|
27
28
|
- `http/surface.ts` — `AppSurface`, `AppSurfaceSpec`, `generate_app_surface`, diagnostics.
|
|
@@ -52,10 +53,10 @@ consumers.
|
|
|
52
53
|
- `auth: RouteAuth` — flat record `{account, actor, roles?, credential_types?, required_scope?}` from `http/auth_shape.ts`. `account` / `actor` are `'none' | 'optional' | 'required'`. `required_scope` names the capability a narrowed api token's scope must admit — `surface:<name>`, a non-RPC surface refused to every narrowed token (an `rpc:<method>` capability throws at registration: it is the dispatcher's per-method gate, which a route never reaches) — and is route-spec-only: `compile_action_registry` rejects it on an `ActionSpec`, where the dispatcher derives `rpc:<method>` from `spec.method`. Otherwise the same shape governs `ActionSpec.auth` (see `actions/CLAUDE.md`).
|
|
53
54
|
- `handler: RouteHandler` — `(c: Context, route: RouteContext) => RouteResult | Promise<RouteResult>`, a result the framework answers with (§Handlers and results)
|
|
54
55
|
- `description` — free-text, surfaced in `AppSurface`
|
|
55
|
-
- `params?:
|
|
56
|
-
- `query?:
|
|
57
|
-
- `input:
|
|
58
|
-
- `output:
|
|
56
|
+
- `params?: AnySchema` — strict-object schema for URL path params
|
|
57
|
+
- `query?: AnySchema` — strict-object schema for URL query string
|
|
58
|
+
- `input: AnySchema` — request body schema; `literal(null)` for no-body (GET/DELETE)
|
|
59
|
+
- `output: AnySchema` — success response schema
|
|
59
60
|
- `mints_credential?: boolean` — the route issues a session cookie while declaring no auth (login, signup, bootstrap); assembly refuses it outside `AUTH_MIDDLEWARE_PATH`, as it does any route whose `auth.account` is not `'none'` (`assert_credential_routes_in_auth_scope` in `auth/middleware.ts`)
|
|
60
61
|
- `reads_credential?: boolean` — the handler reads the resolved account while the route declares no auth gate, answering an anonymous caller itself (account status, the cell-scoped fact read, `create_rpc_endpoint`'s pair, whose dispatcher gates per action); held inside `AUTH_MIDDLEWARE_PATH` by the same assertion. Such a handler reads the account through `get_public_account_id` (`auth/request_context.ts`), which answers a scope-narrowed token as anonymous — the RPC pair excepted, its dispatcher gating each method
|
|
61
62
|
- `rate_limit?: RateLimitKey` — metadata only (`'ip' | 'account' | 'both'`); auto-derives 429
|
|
@@ -63,20 +64,18 @@ consumers.
|
|
|
63
64
|
- `jsonrpc?: boolean` — the route answers JSON-RPC envelopes, not REST bodies; set by `create_rpc_endpoint`, read by the DEV error check and `assert_response_matches_spec`
|
|
64
65
|
- `transaction?: boolean` — declarative transaction wrapping (see below)
|
|
65
66
|
|
|
66
|
-
Every schema field takes a
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
holding a value of neither library throws at registration, naming the route
|
|
67
|
+
Every schema field takes a `@fuzdev/fuz_schema` schema (`AnySchema`),
|
|
68
|
+
validated through `parse`, its refusals answered with `to_wire_issues`'s
|
|
69
|
+
`WireIssue`s. A slot holding a value that is no schema throws at registration, naming the route
|
|
70
70
|
and the slot (`assert_validation_schema`) — in an assembled app, surface
|
|
71
71
|
generation (`schema_to_surface`) reads most slots first and throws the same
|
|
72
72
|
refusal; `params`, `query` and an `errors` entry
|
|
73
|
-
may be absent. A
|
|
73
|
+
may be absent. A `params` or `query` must be an object schema
|
|
74
74
|
under any wrappers (`get_schema_entries`); `apply_route_specs` throws naming
|
|
75
75
|
the route on one that isn't. Input/output naming mirrors SAES `ActionSpec`. Use a strict object for
|
|
76
|
-
inputs —
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`loose_object`); the warning names the library's strict form.
|
|
76
|
+
inputs — fuz_schema's `object` — the surface diagnostic warns on non-strict
|
|
77
|
+
objects because unknown keys are silently stripped by `strip_object` and
|
|
78
|
+
kept by `loose_object`.
|
|
80
79
|
|
|
81
80
|
### Handlers and results
|
|
82
81
|
|
|
@@ -164,7 +163,7 @@ wrapper). See `auth/signup_routes.ts`.
|
|
|
164
163
|
3. **Pre-authorization auth guards** — every gate that reads only what the auth middleware set, in coarse-to-fine order: `require_auth` (401 `ERROR_AUTHENTICATION_REQUIRED`) when `auth.account === 'required'` or `auth.actor === 'required'`; `require_credential_types(types)` (403 `ERROR_CREDENTIAL_TYPE_REQUIRED` with `required_credential_types: ReadonlyArray<string>`) when `auth.credential_types?.length`; `require_token_scope(capability)` (403 `ERROR_TOKEN_SCOPE_REQUIRED` with `required_scope`, the token-scope refusal) when `auth.required_scope` names a capability. All fire before any body parsing — so a caller they refuse never sees route-shape information from input parse failures — and before actor resolution, so a wrong channel costs no DB work and never learns account state (e.g. that the account is multi-actor). The `AuthGuardResolver` (e.g. `fuz_auth_guard_resolver` from `auth/auth_guard_resolver.ts`) returns this set as `pre_authorization: Array<MiddlewareHandler>`.
|
|
165
164
|
4. **Authorization phase** — when `spec.auth.actor !== 'none'`, resolves the acting actor against the resolved credential's account (`get_resolved_auth`, set by the auth middleware) plus the `acting` selector (`validated_query.acting` on GETs; read off the raw body on mutations, since body validation now runs after the gates), builds `RequestContext` via `build_request_context`, and sets `REQUEST_CONTEXT_KEY`. When `auth.account !== 'none' && auth.actor === 'none'`, an account-only context is built. Resolution failures return 400 `ERROR_ACTOR_REQUIRED` (with `available[]`) or `ERROR_ACTOR_NOT_ON_ACCOUNT` (or 500 `ERROR_NO_ACTORS_ON_ACCOUNT` on signup-invariant violation, 500 `ERROR_ACCOUNT_VANISHED` on torn account/actor reads after a successful resolve). Public routes (`account: 'none' && actor: 'none'`) skip this phase entirely.
|
|
166
165
|
5. **Post-authorization auth guards** — `require_role(roles)` (403 `ERROR_INSUFFICIENT_PERMISSIONS` with `required_roles: ReadonlyArray<string>`) when `auth.roles?.length`. The only gate in this phase, because it is the only one that reads `REQUEST_CONTEXT_KEY` (populated by step 4) rather than the auth middleware's own context vars. Multi-role specs admit any-of via `has_any_scoped_role(ctx, roles, null)`.
|
|
167
|
-
6. **Input validation** — JSON body parsed + validated; mismatch returns 400 `ERROR_INVALID_JSON_BODY` (not JSON) or `ERROR_INVALID_REQUEST_BODY` (schema failure with `issues`). Every schema refusal's `issues` are `WireIssue`s (`to_wire_issues`, `schema_issues.ts`), sent under DEV only (`dev_only`). Skipped on GET and on a null input (`is_null_schema`: `
|
|
166
|
+
6. **Input validation** — JSON body parsed (`read_json_body`) + validated; mismatch returns 400 `ERROR_INVALID_JSON_BODY` (not JSON, or JSON the Rust spine refuses — `parse_json_text`) or `ERROR_INVALID_REQUEST_BODY` (schema failure with `issues`). Every schema refusal's `issues` are `WireIssue`s (`to_wire_issues`, `schema_issues.ts`), sent under DEV only (`dev_only`). Skipped on GET and on a null input (`is_null_schema`: `literal(null)`). The validated input lands on `c.var.validated_input`.
|
|
168
167
|
7. **Handler** — wrapped in transaction when `use_transaction` (see above), receives `RouteContext`; its result becomes the response (`to_route_response`)
|
|
169
168
|
8. **Error catch** — catches a thrown JSON-RPC error (`ThrownJsonrpcError`, recognized by brand through `to_thrown_jsonrpc_error`, so one from a second fuz_app copy maps too; a foreign error class carrying a JSON-RPC `code` falls to the generic path) → maps to HTTP status + the flat REST error body (`{error: <reason>, message?, ...rest_data}`); catches generic `Error` → 500 `{error: 'internal_error', message?}` (message only in DEV). The reason string comes from `err.data.reason` when set (consumer-supplied canonical reason override) or from `jsonrpc_error_code_to_name(err.code)` (e.g. `-32003 → 'not_found'`). The flat shape matches what middleware and direct handlers emit — REST callers see one envelope across every emit site, while the JSON-RPC dispatcher keeps its own `{jsonrpc, id, error: {code, message, data}}` envelope on the RPC mount.
|
|
170
169
|
9. **DEV-only output validation** — a 2xx JSON body against `spec.output` (see below); error responses are the outer DEV error check's
|
|
@@ -184,8 +183,7 @@ Duplicate `method path` pairs throw at registration.
|
|
|
184
183
|
|
|
185
184
|
Validated values are accessed via `get_route_input(c, schema)`,
|
|
186
185
|
`get_route_params(c, schema)`, `get_route_query(c, schema)` — pass the
|
|
187
|
-
matching schema,
|
|
188
|
-
`ValidationOutput<typeof schema>`.
|
|
186
|
+
matching schema, and the return type infers as `Infer<typeof schema>`.
|
|
189
187
|
Each helper has a `<T>(c)` overload (no schema arg) for callers without the
|
|
190
188
|
schema in scope.
|
|
191
189
|
|
|
@@ -224,8 +222,8 @@ action-handler surfaces (REST, RPC, WS); see ../../../docs/architecture.md
|
|
|
224
222
|
- `RateLimitKey` (`rate_limiter.ts`) — `'ip' | 'account' | 'both'`
|
|
225
223
|
|
|
226
224
|
`RouteSpec.errors` and `MiddlewareSpec.errors` are lists of definitions
|
|
227
|
-
(`ReadonlyArray<RestErrorDef>`), so a
|
|
228
|
-
|
|
225
|
+
(`ReadonlyArray<RestErrorDef>`), so a bare schema is impossible by type, and
|
|
226
|
+
`apply_route_specs` refuses anything else at registration.
|
|
229
227
|
|
|
230
228
|
All error bodies are loose objects — intentional because multiple
|
|
231
229
|
producers (middleware + handler) can emit different extra fields at the
|
|
@@ -287,8 +285,8 @@ beside them.
|
|
|
287
285
|
|
|
288
286
|
The same auto-derivation pattern is **not** appropriate for
|
|
289
287
|
consumer-authored inputs (or handler outputs). A consumer's spec declares
|
|
290
|
-
the exact `acting?: ActingActor` slot (`ActingActor` of `primitive_schemas.ts
|
|
291
|
-
|
|
288
|
+
the exact `acting?: ActingActor` slot (`ActingActor` of `primitive_schemas.ts`),
|
|
289
|
+
and the framework
|
|
292
290
|
reads it back via reference-equality to drive the authorization phase — auto-extending
|
|
293
291
|
schemas at registration time would obscure the source of truth ("did the
|
|
294
292
|
spec declare this, or did the framework graft it on?") and quietly shadow
|
|
@@ -311,7 +309,7 @@ confirmation.
|
|
|
311
309
|
|
|
312
310
|
## Schema Helpers
|
|
313
311
|
|
|
314
|
-
`http/schema_helpers.ts` is the canonical home for shared schema introspection
|
|
312
|
+
`http/schema_helpers.ts` is the canonical home for shared schema introspection
|
|
315
313
|
— extracted to break a circular dependency between `http/route_spec.ts`
|
|
316
314
|
(input validation) and `http/surface.ts` (surface generation).
|
|
317
315
|
|
|
@@ -322,14 +320,15 @@ generation logic.
|
|
|
322
320
|
|
|
323
321
|
Key helpers:
|
|
324
322
|
|
|
325
|
-
- `is_null_schema(schema)` — a `
|
|
326
|
-
- `is_void_schema(schema)` — a `
|
|
323
|
+
- `is_null_schema(schema)` — a `literal(null)` (a kind check, not parse-null, to avoid false positives from `nullable(string)`)
|
|
324
|
+
- `is_void_schema(schema)` — a `literal(undefined)` (what `s.void` is, a `meta` copy included; a kind check like `is_null_schema`, so an optional schema is not void); a void input declares a parameterless RPC method
|
|
327
325
|
- `to_void_params(raw_params)` — reads absent, `null`, and `{}` params of a void input as the no-arg call (`undefined`), passing any other shape through for the void schema to refuse — the twin of the Rust spine's `require_void_params`
|
|
328
|
-
- `to_input_params(input, raw_params)` — the one params normalizer every receiving end runs before the input parse (`
|
|
326
|
+
- `to_input_params(input, raw_params)` — the one params normalizer every receiving end runs before the input parse (`parse`): `to_void_params` for a void input, else absent/`null` → `{}`; used by both the server dispatch core (`perform_action`) and the peer receive path (`ActionDispatcher`)
|
|
329
327
|
- `json_has_own_proto_key(value)` — whether any object in a parsed JSON value has an own `__proto__` key, by an iterative walk (no recursion — `JSON.parse` nests deeper than the call stack); the dispatcher refuses such params with `ERROR_PARAMS_PROTO_KEY`. Twin of the Rust `fuz_http::json_has_own_proto_key`
|
|
330
|
-
- `safe_parse_dropping_unknown_keys(schema, value)` — the forward-compatible read of a remote-authored payload,
|
|
331
|
-
- `is_strict_object_schema(schema)` — detects
|
|
332
|
-
- `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — throws first on a value
|
|
328
|
+
- `safe_parse_dropping_unknown_keys(schema, value)` — the forward-compatible read of a remote-authored payload, returning `parse`'s `{ok, value}` / `{ok: false, issues}`: while every issue is an unknown key (`unknown_key_targets`), strips them from a copy and reparses — after the first parse that reports unknown keys, one schema-guided pass deletes every key a strict `object` doesn't name anywhere the schema reaches (entries, array items, record values, the `variant` option), as a parse reports at most a hundred issues; a key under a `union` is never stripped (the union fails as one issue of its own), and a later `pipe` stage is stripped only as reported — until nothing is left to strip, capped at `UNKNOWN_KEY_PASSES_MAX` passes (the last failure returned past it); any other issue still fails. Used for response `result`s (`ActionEvent`) and peer replies (`peer/ping`); matches serde's ignore-unknown-fields default on the Rust spine
|
|
329
|
+
- `is_strict_object_schema(schema)` — detects an `object` (not `strip_object` / `loose_object`); a `pipe` is read through to its first schema when no stage is a `transform` (so a refined `object` reads strict)
|
|
330
|
+
- `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — throws first on a value that is no schema (`assert_validation_schema`, naming `source`, so an assembled app's slot holding none fails boot as registration would refuse it, not as an unwritable JSON Schema); a schema → JSON Schema (`to_json_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `unknown`) or one the emitter refuses outright throws, prefixed with `source` — so a root-level transform output fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
|
|
331
|
+
- `SchemaFieldInfo` — one field of an object schema (`name`, `base_type` — a `SchemaFieldBaseType`, the innermost fuz_schema kind —, `required`, `has_default`, `nullable`), what the testing generators' `to_object_schema_view` produces
|
|
333
332
|
- `middleware_applies(mw_path, route_path)` — Hono pattern matching: `'*'`, exact, `'/api/*'` prefix (handles `prefix.slice(0, -1)` so `/api/*` also matches the bare `/api`)
|
|
334
333
|
- `middleware_carves_out(spec, route_path)` — one of the layer's `carve_outs` applies to the route; the carve-out half of `middleware_spec_applies`, which `assert_full_middleware_stack` reads to relax a carved-out route's expected stack
|
|
335
334
|
- `middleware_spec_applies(spec, route_path)` — the layer runs on the route: its `path` applies and none of its `carve_outs` does; what the route error map takes middleware definitions by
|
|
@@ -352,7 +351,7 @@ policy invariants.
|
|
|
352
351
|
|
|
353
352
|
`generate_app_surface(options)` emits a `warning` diagnostic for every
|
|
354
353
|
input schema that's not strict (unknown keys silently strip under
|
|
355
|
-
`
|
|
354
|
+
`strip_object`), writes every schema through `schema_to_surface` — inputs,
|
|
356
355
|
params and query on the input side (what the server accepts, so a
|
|
357
356
|
`Username` transform keeps its bounds and pattern), outputs, error bodies and
|
|
358
357
|
event params on the output side — with an `info` diagnostic (category
|
|
@@ -524,7 +523,7 @@ own by casting `as JsonrpcErrorCode`, and declare each one's HTTP status with
|
|
|
524
523
|
- `request_cancelled` (-32010, HTTP 499) — caller-initiated cancellation (nginx "client closed").
|
|
525
524
|
|
|
526
525
|
**`invalid_params` vs `validation_error`** — use `invalid_params` (standard
|
|
527
|
-
code) for
|
|
526
|
+
code) for schema parse failures; reserve `validation_error` (app code) for
|
|
528
527
|
business rules.
|
|
529
528
|
|
|
530
529
|
**`rate_limited` vs `queue_overflow`** — both 429; reverse map
|
|
@@ -630,7 +629,7 @@ must run only after the transaction commits.
|
|
|
630
629
|
- Structurally satisfied by both `RouteContext` (HTTP) and `ActionContext` (RPC + WS) — they share the `{log, post_commit_effects}` shape, which is why this helper lives in `http/` rather than `actions/` or `auth/`.
|
|
631
630
|
|
|
632
631
|
WS sends are **not** wrapped by `create_validated_broadcaster` (that only
|
|
633
|
-
guards SSE `broadcast(channel, data)`).
|
|
632
|
+
guards SSE `broadcast(channel, data)`). The input schemas of
|
|
634
633
|
`RemoteNotificationActionSpec`s are contracts for consumers, not enforced
|
|
635
634
|
at send time.
|
|
636
635
|
|
|
@@ -753,5 +752,5 @@ Interfaces exported for consumer use: `TableInfo`, `TableWithCount`,
|
|
|
753
752
|
|
|
754
753
|
- **Middleware ordering** is assembled by `create_app_server` — see the root ../../../CLAUDE.md §Middleware Ordering. The invariants `http/` needs consumers to uphold: trusted-proxy runs before auth/rate-limit; origin verification runs before session parsing; `client_ip` must be set before any handler or rate limiter reads it
|
|
755
754
|
- **No re-exports.** Import every symbol from its canonical source module. `http/surface.ts` no longer re-exports schema helpers — go through `http/schema_helpers.ts`
|
|
756
|
-
- **Input/output schemas align with SAES.** When wiring RPC via `actions/action_rpc.ts`, the same
|
|
755
|
+
- **Input/output schemas align with SAES.** When wiring RPC via `actions/action_rpc.ts`, the same schemas flow through unchanged (see `actions/CLAUDE.md` §Single JSON-RPC 2.0 endpoint)
|
|
757
756
|
- **Error modules are complementary, not redundant.** `http/error_schemas.ts` is declaration-first (for routes and surface); `http/jsonrpc_errors.ts` is throw-first (for handlers and the catch layer). A single `ERROR_*` code can be raised either way depending on whether the handler needs to also attach diagnostic fields
|
|
@@ -33,17 +33,7 @@
|
|
|
33
33
|
*
|
|
34
34
|
* @module
|
|
35
35
|
*/
|
|
36
|
-
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
37
|
-
import type { ValidationSchema } from '../schema_issues.js';
|
|
38
|
-
/**
|
|
39
|
-
* Register a Zod schema as the Zod form of `ActingActor`, which
|
|
40
|
-
* `input_schema_declares_acting` then finds by reference. `zod_schemas.ts`
|
|
41
|
-
* registers `ZodActingActor`, its one caller.
|
|
42
|
-
*
|
|
43
|
-
* @param schema - the Zod `ActingActor`
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
export declare const register_zod_acting_actor: (schema: object) => void;
|
|
36
|
+
import { type AnySchema, type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
47
37
|
/**
|
|
48
38
|
* Read an `acting` selector out of an unvalidated value.
|
|
49
39
|
*
|
|
@@ -64,8 +54,8 @@ export declare const register_zod_acting_actor: (schema: object) => void;
|
|
|
64
54
|
* an input schema behind it, so there a malformed selector is final (the
|
|
65
55
|
* status route answers account-only).
|
|
66
56
|
*
|
|
67
|
-
* The grammar is `ActingActor`'s, which is
|
|
68
|
-
*
|
|
57
|
+
* The grammar is `ActingActor`'s, which is the Rust spine's, so every value
|
|
58
|
+
* reads as either would, the max UUID in any case
|
|
69
59
|
* included. The id comes back lowercased. A route declaring `acting` on its
|
|
70
60
|
* `query` schema doesn't read it here: that schema runs ahead of the
|
|
71
61
|
* authorization phase, with the same grammar.
|
|
@@ -214,24 +204,16 @@ export declare const is_plain_authenticated_auth: (auth: RouteAuth) => boolean;
|
|
|
214
204
|
export declare const assert_route_auth_invariants: (auth: RouteAuth, context: string) => void;
|
|
215
205
|
/**
|
|
216
206
|
* Whether a schema declares the canonical `acting?: ActingActor` field.
|
|
217
|
-
* Reference-equality on the exported `ActingActor`
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* the
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* authored as `z.optional(z.strictObject({acting: ActingActor}))` or
|
|
226
|
-
* `z.strictObject({acting: ActingActor}).default({})` still trips the
|
|
227
|
-
* predicate.
|
|
228
|
-
*
|
|
229
|
-
* A `@fuzdev/fuz_schema` schema is read by `get_schema_entries`, which sees
|
|
230
|
-
* through its wrappers (`optional`, `nullable`, the defaults) and a `pipe` to
|
|
231
|
-
* the schema it starts with; a schema that isn't an object under them (a void
|
|
232
|
-
* input, say) answers `false`.
|
|
207
|
+
* Reference-equality on the exported `ActingActor` (`primitive_schemas.ts`),
|
|
208
|
+
* so consumer schemas with unrelated `acting` fields don't trip this check.
|
|
209
|
+
*
|
|
210
|
+
* The schema is read by `get_schema_entries`, which sees through its wrappers
|
|
211
|
+
* (`optional`, `nullable`, the defaults) and a `pipe` to the schema it starts
|
|
212
|
+
* with, so `optional(object({acting: ActingActor}))` still trips the
|
|
213
|
+
* predicate; a schema that isn't an object under them (a void input, say)
|
|
214
|
+
* answers `false`.
|
|
233
215
|
*/
|
|
234
|
-
export declare const input_schema_declares_acting: (schema:
|
|
216
|
+
export declare const input_schema_declares_acting: (schema: AnySchema) => boolean;
|
|
235
217
|
/**
|
|
236
218
|
* Slots where a spec may declare the `acting?: ActingActor` field —
|
|
237
219
|
* input for both REST + actions; query for REST GETs that bi-locate
|
|
@@ -239,8 +221,8 @@ export declare const input_schema_declares_acting: (schema: ValidationSchema) =>
|
|
|
239
221
|
* field is omitted on action call sites).
|
|
240
222
|
*/
|
|
241
223
|
export interface ActingSlots {
|
|
242
|
-
input:
|
|
243
|
-
query?:
|
|
224
|
+
input: AnySchema;
|
|
225
|
+
query?: AnySchema;
|
|
244
226
|
}
|
|
245
227
|
/**
|
|
246
228
|
* Registry-time biconditional check: `auth.actor !== 'none' ⟺ some
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_shape.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/auth_shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;
|
|
1
|
+
{"version":3,"file":"auth_shape.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/auth_shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAKzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SAGtD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,wKAA2C,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAuDxD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1C,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,cAAc,CAAC,EAAE,MAAM,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