@fuzdev/fuz_app 0.169.0 → 0.170.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 +17 -19
- package/dist/actions/action_codegen.d.ts +25 -18
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +83 -67
- 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.js +1 -1
- 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/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/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/request_context.js +2 -2
- 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 +29 -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/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_spec.d.ts +33 -36
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +21 -22
- package/dist/http/schema_helpers.d.ts +75 -67
- 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 +29 -42
- 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.js +9 -9
- 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_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 +3 -3
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +1 -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 +150 -145
- 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
|
@@ -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;AAC3F,eAAO,MAAM,sCAAsC,uBAAuB,CAAC;AAI3E,iFAAiF;AACjF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AqC,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
|
@@ -52,10 +52,10 @@ consumers.
|
|
|
52
52
|
- `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
53
|
- `handler: RouteHandler` — `(c: Context, route: RouteContext) => RouteResult | Promise<RouteResult>`, a result the framework answers with (§Handlers and results)
|
|
54
54
|
- `description` — free-text, surfaced in `AppSurface`
|
|
55
|
-
- `params?:
|
|
56
|
-
- `query?:
|
|
57
|
-
- `input:
|
|
58
|
-
- `output:
|
|
55
|
+
- `params?: AnySchema` — strict-object schema for URL path params
|
|
56
|
+
- `query?: AnySchema` — strict-object schema for URL query string
|
|
57
|
+
- `input: AnySchema` — request body schema; `literal(null)` for no-body (GET/DELETE)
|
|
58
|
+
- `output: AnySchema` — success response schema
|
|
59
59
|
- `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
60
|
- `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
61
|
- `rate_limit?: RateLimitKey` — metadata only (`'ip' | 'account' | 'both'`); auto-derives 429
|
|
@@ -63,20 +63,18 @@ consumers.
|
|
|
63
63
|
- `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
64
|
- `transaction?: boolean` — declarative transaction wrapping (see below)
|
|
65
65
|
|
|
66
|
-
Every schema field takes a
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
holding a value of neither library throws at registration, naming the route
|
|
66
|
+
Every schema field takes a `@fuzdev/fuz_schema` schema (`AnySchema`),
|
|
67
|
+
validated through `parse`, its refusals answered with `to_wire_issues`'s
|
|
68
|
+
`WireIssue`s. A slot holding a value that is no schema throws at registration, naming the route
|
|
70
69
|
and the slot (`assert_validation_schema`) — in an assembled app, surface
|
|
71
70
|
generation (`schema_to_surface`) reads most slots first and throws the same
|
|
72
71
|
refusal; `params`, `query` and an `errors` entry
|
|
73
|
-
may be absent. A
|
|
72
|
+
may be absent. A `params` or `query` must be an object schema
|
|
74
73
|
under any wrappers (`get_schema_entries`); `apply_route_specs` throws naming
|
|
75
74
|
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.
|
|
75
|
+
inputs — fuz_schema's `object` — the surface diagnostic warns on non-strict
|
|
76
|
+
objects because unknown keys are silently stripped by `strip_object` and
|
|
77
|
+
kept by `loose_object`.
|
|
80
78
|
|
|
81
79
|
### Handlers and results
|
|
82
80
|
|
|
@@ -164,7 +162,7 @@ wrapper). See `auth/signup_routes.ts`.
|
|
|
164
162
|
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
163
|
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
164
|
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`: `
|
|
165
|
+
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`: `literal(null)`). The validated input lands on `c.var.validated_input`.
|
|
168
166
|
7. **Handler** — wrapped in transaction when `use_transaction` (see above), receives `RouteContext`; its result becomes the response (`to_route_response`)
|
|
169
167
|
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
168
|
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 +182,7 @@ Duplicate `method path` pairs throw at registration.
|
|
|
184
182
|
|
|
185
183
|
Validated values are accessed via `get_route_input(c, schema)`,
|
|
186
184
|
`get_route_params(c, schema)`, `get_route_query(c, schema)` — pass the
|
|
187
|
-
matching schema,
|
|
188
|
-
`ValidationOutput<typeof schema>`.
|
|
185
|
+
matching schema, and the return type infers as `Infer<typeof schema>`.
|
|
189
186
|
Each helper has a `<T>(c)` overload (no schema arg) for callers without the
|
|
190
187
|
schema in scope.
|
|
191
188
|
|
|
@@ -224,8 +221,8 @@ action-handler surfaces (REST, RPC, WS); see ../../../docs/architecture.md
|
|
|
224
221
|
- `RateLimitKey` (`rate_limiter.ts`) — `'ip' | 'account' | 'both'`
|
|
225
222
|
|
|
226
223
|
`RouteSpec.errors` and `MiddlewareSpec.errors` are lists of definitions
|
|
227
|
-
(`ReadonlyArray<RestErrorDef>`), so a
|
|
228
|
-
|
|
224
|
+
(`ReadonlyArray<RestErrorDef>`), so a bare schema is impossible by type, and
|
|
225
|
+
`apply_route_specs` refuses anything else at registration.
|
|
229
226
|
|
|
230
227
|
All error bodies are loose objects — intentional because multiple
|
|
231
228
|
producers (middleware + handler) can emit different extra fields at the
|
|
@@ -287,8 +284,8 @@ beside them.
|
|
|
287
284
|
|
|
288
285
|
The same auto-derivation pattern is **not** appropriate for
|
|
289
286
|
consumer-authored inputs (or handler outputs). A consumer's spec declares
|
|
290
|
-
the exact `acting?: ActingActor` slot (`ActingActor` of `primitive_schemas.ts
|
|
291
|
-
|
|
287
|
+
the exact `acting?: ActingActor` slot (`ActingActor` of `primitive_schemas.ts`),
|
|
288
|
+
and the framework
|
|
292
289
|
reads it back via reference-equality to drive the authorization phase — auto-extending
|
|
293
290
|
schemas at registration time would obscure the source of truth ("did the
|
|
294
291
|
spec declare this, or did the framework graft it on?") and quietly shadow
|
|
@@ -311,7 +308,7 @@ confirmation.
|
|
|
311
308
|
|
|
312
309
|
## Schema Helpers
|
|
313
310
|
|
|
314
|
-
`http/schema_helpers.ts` is the canonical home for shared schema introspection
|
|
311
|
+
`http/schema_helpers.ts` is the canonical home for shared schema introspection
|
|
315
312
|
— extracted to break a circular dependency between `http/route_spec.ts`
|
|
316
313
|
(input validation) and `http/surface.ts` (surface generation).
|
|
317
314
|
|
|
@@ -322,14 +319,15 @@ generation logic.
|
|
|
322
319
|
|
|
323
320
|
Key helpers:
|
|
324
321
|
|
|
325
|
-
- `is_null_schema(schema)` — a `
|
|
326
|
-
- `is_void_schema(schema)` — a `
|
|
322
|
+
- `is_null_schema(schema)` — a `literal(null)` (a kind check, not parse-null, to avoid false positives from `nullable(string)`)
|
|
323
|
+
- `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
324
|
- `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 (`
|
|
325
|
+
- `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
326
|
- `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
|
|
327
|
+
- `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
|
|
328
|
+
- `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)
|
|
329
|
+
- `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
|
|
330
|
+
- `SchemaFieldInfo` — one field of an object schema (`name`, `base_type`, `required`, `has_default`, `nullable`), what the testing generators' `to_object_schema_view` produces
|
|
333
331
|
- `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
332
|
- `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
333
|
- `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 +350,7 @@ policy invariants.
|
|
|
352
350
|
|
|
353
351
|
`generate_app_surface(options)` emits a `warning` diagnostic for every
|
|
354
352
|
input schema that's not strict (unknown keys silently strip under
|
|
355
|
-
`
|
|
353
|
+
`strip_object`), writes every schema through `schema_to_surface` — inputs,
|
|
356
354
|
params and query on the input side (what the server accepts, so a
|
|
357
355
|
`Username` transform keeps its bounds and pattern), outputs, error bodies and
|
|
358
356
|
event params on the output side — with an `info` diagnostic (category
|
|
@@ -524,7 +522,7 @@ own by casting `as JsonrpcErrorCode`, and declare each one's HTTP status with
|
|
|
524
522
|
- `request_cancelled` (-32010, HTTP 499) — caller-initiated cancellation (nginx "client closed").
|
|
525
523
|
|
|
526
524
|
**`invalid_params` vs `validation_error`** — use `invalid_params` (standard
|
|
527
|
-
code) for
|
|
525
|
+
code) for schema parse failures; reserve `validation_error` (app code) for
|
|
528
526
|
business rules.
|
|
529
527
|
|
|
530
528
|
**`rate_limited` vs `queue_overflow`** — both 429; reverse map
|
|
@@ -630,7 +628,7 @@ must run only after the transaction commits.
|
|
|
630
628
|
- 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
629
|
|
|
632
630
|
WS sends are **not** wrapped by `create_validated_broadcaster` (that only
|
|
633
|
-
guards SSE `broadcast(channel, data)`).
|
|
631
|
+
guards SSE `broadcast(channel, data)`). The input schemas of
|
|
634
632
|
`RemoteNotificationActionSpec`s are contracts for consumers, not enforced
|
|
635
633
|
at send time.
|
|
636
634
|
|
|
@@ -753,5 +751,5 @@ Interfaces exported for consumer use: `TableInfo`, `TableWithCount`,
|
|
|
753
751
|
|
|
754
752
|
- **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
753
|
- **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
|
|
754
|
+
- **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
755
|
- **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,OAA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D,MAAM,SAAS,EACf,OAAO,WAAW,EAClB,SAAS,MAAM,KACb,IAmBF,CAAC"}
|
package/dist/http/auth_shape.js
CHANGED
|
@@ -33,28 +33,9 @@
|
|
|
33
33
|
*
|
|
34
34
|
* @module
|
|
35
35
|
*/
|
|
36
|
-
import {
|
|
36
|
+
import { one_of, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
37
37
|
import { get_schema_entries } from '@fuzdev/fuz_schema/introspect.ts';
|
|
38
38
|
import { ActingActor } from '../primitive_schemas.js';
|
|
39
|
-
import { zod_unwrap_to_object } from '../zod.js';
|
|
40
|
-
/**
|
|
41
|
-
* The Zod `ActingActor` forms `input_schema_declares_acting` matches by
|
|
42
|
-
* reference: `ZodActingActor`, registered when `zod_schemas.ts` loads, so
|
|
43
|
-
* this module never imports Zod at runtime. A Zod input holding it has loaded
|
|
44
|
-
* that module, so it is registered before any spec reaches the check.
|
|
45
|
-
*/
|
|
46
|
-
const zod_acting_actors = new WeakSet();
|
|
47
|
-
/**
|
|
48
|
-
* Register a Zod schema as the Zod form of `ActingActor`, which
|
|
49
|
-
* `input_schema_declares_acting` then finds by reference. `zod_schemas.ts`
|
|
50
|
-
* registers `ZodActingActor`, its one caller.
|
|
51
|
-
*
|
|
52
|
-
* @param schema - the Zod `ActingActor`
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
export const register_zod_acting_actor = (schema) => {
|
|
56
|
-
zod_acting_actors.add(schema);
|
|
57
|
-
};
|
|
58
39
|
/**
|
|
59
40
|
* Read an `acting` selector out of an unvalidated value.
|
|
60
41
|
*
|
|
@@ -75,8 +56,8 @@ export const register_zod_acting_actor = (schema) => {
|
|
|
75
56
|
* an input schema behind it, so there a malformed selector is final (the
|
|
76
57
|
* status route answers account-only).
|
|
77
58
|
*
|
|
78
|
-
* The grammar is `ActingActor`'s, which is
|
|
79
|
-
*
|
|
59
|
+
* The grammar is `ActingActor`'s, which is the Rust spine's, so every value
|
|
60
|
+
* reads as either would, the max UUID in any case
|
|
80
61
|
* included. The id comes back lowercased. A route declaring `acting` on its
|
|
81
62
|
* `query` schema doesn't read it here: that schema runs ahead of the
|
|
82
63
|
* authorization phase, with the same grammar.
|
|
@@ -221,32 +202,16 @@ export const assert_route_auth_invariants = (auth, context) => {
|
|
|
221
202
|
// + `register_action_ws`).
|
|
222
203
|
/**
|
|
223
204
|
* Whether a schema declares the canonical `acting?: ActingActor` field.
|
|
224
|
-
* Reference-equality on the exported `ActingActor`
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* the
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* authored as `z.optional(z.strictObject({acting: ActingActor}))` or
|
|
233
|
-
* `z.strictObject({acting: ActingActor}).default({})` still trips the
|
|
234
|
-
* predicate.
|
|
235
|
-
*
|
|
236
|
-
* A `@fuzdev/fuz_schema` schema is read by `get_schema_entries`, which sees
|
|
237
|
-
* through its wrappers (`optional`, `nullable`, the defaults) and a `pipe` to
|
|
238
|
-
* the schema it starts with; a schema that isn't an object under them (a void
|
|
239
|
-
* input, say) answers `false`.
|
|
205
|
+
* Reference-equality on the exported `ActingActor` (`primitive_schemas.ts`),
|
|
206
|
+
* so consumer schemas with unrelated `acting` fields don't trip this check.
|
|
207
|
+
*
|
|
208
|
+
* The schema is read by `get_schema_entries`, which sees through its wrappers
|
|
209
|
+
* (`optional`, `nullable`, the defaults) and a `pipe` to the schema it starts
|
|
210
|
+
* with, so `optional(object({acting: ActingActor}))` still trips the
|
|
211
|
+
* predicate; a schema that isn't an object under them (a void input, say)
|
|
212
|
+
* answers `false`.
|
|
240
213
|
*/
|
|
241
|
-
export const input_schema_declares_acting = (schema) =>
|
|
242
|
-
if (is_schema(schema))
|
|
243
|
-
return get_schema_entries(schema)?.acting === ActingActor;
|
|
244
|
-
const obj = zod_unwrap_to_object(schema);
|
|
245
|
-
if (!obj)
|
|
246
|
-
return false;
|
|
247
|
-
const acting = obj.shape.acting;
|
|
248
|
-
return acting !== undefined && zod_acting_actors.has(acting);
|
|
249
|
-
};
|
|
214
|
+
export const input_schema_declares_acting = (schema) => get_schema_entries(schema)?.acting === ActingActor;
|
|
250
215
|
/**
|
|
251
216
|
* Registry-time biconditional check: `auth.actor !== 'none' ⟺ some
|
|
252
217
|
* supplied slot declares acting?: ActingActor`. Throws on violation.
|
|
@@ -274,7 +239,7 @@ export const assert_route_auth_acting_biconditional = (auth, slots, context) =>
|
|
|
274
239
|
return;
|
|
275
240
|
const slot_phrase = slots.query !== undefined ? 'input or query schema' : 'input schema';
|
|
276
241
|
if (wants_actor) {
|
|
277
|
-
throw new Error(`${context}: auth.actor === '${auth.actor}' requires the ${slot_phrase} to declare 'acting?: ActingActor' (
|
|
242
|
+
throw new Error(`${context}: auth.actor === '${auth.actor}' requires the ${slot_phrase} to declare 'acting?: ActingActor' (registry-time invariant 2)`);
|
|
278
243
|
}
|
|
279
|
-
throw new Error(`${context}: ${slot_phrase} declares 'acting?: ActingActor'
|
|
244
|
+
throw new Error(`${context}: ${slot_phrase} declares 'acting?: ActingActor' but auth.actor === 'none' (registry-time invariant 2)`);
|
|
280
245
|
};
|