@fuzdev/fuz_app 0.165.0 → 0.167.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 +3 -3
- package/dist/actions/action_codegen.d.ts +10 -1
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +17 -8
- package/dist/actions/action_event_data.d.ts +1 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +24 -15
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/perform_action.d.ts +2 -1
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/auth/CLAUDE.md +10 -8
- package/dist/auth/account_action_specs.d.ts +8 -8
- package/dist/auth/account_route_schema.d.ts +197 -164
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +19 -17
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +285 -294
- package/dist/auth/admin_action_specs.d.ts +64 -64
- package/dist/auth/audit_log_route_schema.d.ts +16 -8
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +4 -3
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +112 -111
- package/dist/auth/audit_log_schema.d.ts +22 -22
- package/dist/auth/bootstrap_route_schema.d.ts +46 -69
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +8 -7
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +100 -98
- package/dist/auth/cell_action_specs.d.ts +6092 -1092
- package/dist/auth/cell_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_action_specs.js +96 -97
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +1 -0
- package/dist/auth/cell_audit_action_specs.d.ts +301 -69
- package/dist/auth/cell_audit_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_audit_action_specs.js +21 -16
- package/dist/auth/cell_audit_actions.js +2 -2
- package/dist/auth/cell_audit_events.d.ts +2 -2
- package/dist/auth/cell_audit_events.d.ts.map +1 -1
- package/dist/auth/cell_audit_metadata.d.ts +93 -30
- package/dist/auth/cell_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_audit_metadata.js +15 -14
- package/dist/auth/cell_authorize.d.ts +3 -3
- package/dist/auth/cell_authorize.js +3 -3
- package/dist/auth/cell_data_schema.d.ts +17 -9
- package/dist/auth/cell_data_schema.d.ts.map +1 -1
- package/dist/auth/cell_data_schema.js +9 -7
- package/dist/auth/cell_field_action_specs.d.ts +697 -130
- package/dist/auth/cell_field_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_field_action_specs.js +25 -27
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +2 -0
- package/dist/auth/cell_field_audit_metadata.d.ts +49 -13
- package/dist/auth/cell_field_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_field_audit_metadata.js +6 -6
- package/dist/auth/cell_grant_action_specs.d.ts +1044 -208
- package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_grant_action_specs.js +36 -33
- package/dist/auth/cell_grant_actions.js +2 -2
- package/dist/auth/cell_grant_audit_metadata.d.ts +188 -40
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +12 -11
- package/dist/auth/cell_item_action_specs.d.ts +949 -175
- package/dist/auth/cell_item_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_item_action_specs.js +30 -34
- package/dist/auth/cell_item_actions.js +1 -1
- package/dist/auth/cell_item_audit_metadata.d.ts +68 -19
- package/dist/auth/cell_item_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_item_audit_metadata.js +9 -9
- package/dist/auth/cell_relation_list_limit.d.ts +1 -2
- package/dist/auth/cell_relation_list_limit.d.ts.map +1 -1
- package/dist/auth/cell_relation_list_limit.js +3 -8
- package/dist/auth/role_grant_offer_action_specs.d.ts +4 -4
- package/dist/auth/signup_route_schema.d.ts +9 -4
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +5 -3
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +170 -170
- package/dist/db/cell_moderation.d.ts +6 -7
- package/dist/db/cell_moderation.d.ts.map +1 -1
- package/dist/db/cell_moderation.js +6 -7
- package/dist/http/CLAUDE.md +48 -3
- package/dist/http/common_routes.d.ts +1 -1
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +13 -11
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +25 -28
- package/dist/http/error_schemas.d.ts +5 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +5 -1
- package/dist/http/route_result.d.ts +101 -0
- package/dist/http/route_result.d.ts.map +1 -0
- package/dist/http/route_result.js +56 -0
- package/dist/http/route_spec.d.ts +110 -6
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +82 -14
- package/dist/rate_limiter.d.ts +0 -9
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +0 -15
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +23 -21
- package/dist/server/surface_route.d.ts +1 -1
- package/dist/server/surface_route.d.ts.map +1 -1
- package/dist/server/surface_route.js +4 -2
- package/dist/testing/CLAUDE.md +5 -3
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +12 -7
- package/dist/testing/cross_backend/cell_crud.js +2 -2
- package/dist/testing/cross_backend/cell_relations.js +2 -2
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +3 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.js +2 -6
- package/dist/testing/stubs.d.ts +14 -3
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +21 -6
- package/package.json +1 -1
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -141,7 +141,7 @@ and options on each function's TSDoc.
|
|
|
141
141
|
- `generate_frontend_actions_api` — typed `FrontendActionsApi` interface. A void or null input of either library (`is_void_schema`, `is_null_schema`) emits `input?: void`; otherwise each method's `input?:` follows `action_input_is_optional` (parsed with `parse_any`) — the schema accepts `undefined`, or accepts `{}` and is not marked `.meta({empty_input_handler_guarded: true})` (`SchemaFieldMeta`, read by `is_empty_input_handler_guarded` in `schema_meta.ts` — set on `cell_get`, `cell_field_list` and `cell_item_list`, whose `{}` reaches a handler guard that refuses it with a declared reason, so their input stays required; a consumer marks its own the same way); an input-shape invariant test reads the same rule.
|
|
142
142
|
- `generate_action_method_enums` — up to nine `z.enum` + `z.infer` pairs.
|
|
143
143
|
- `generate_typed_action_event_alias` — fixed-shape `TypedActionEvent<TMethod, TPhase, TStep>` alias.
|
|
144
|
-
- `generate_action_specs_record` — `ActionSpecs` runtime const +
|
|
144
|
+
- `generate_action_specs_record` — `ActionSpecs` runtime const + type + `action_specs` array. The const is annotated with the type (`readonly` members), so a consumer's declaration emit names the type instead of writing every spec's schema types out, which past enough specs is TS7056. The type is an alias, not an interface: an alias has an implicit index signature, so `Object.values(ActionSpecs)` stays typed and `action_specs` checks each spec against `ActionSpecUnion` (over an interface it is `any[]`).
|
|
145
145
|
- `generate_action_inputs_outputs` — `ActionInputs` + `ActionOutputs` runtime consts + interfaces, each schema typed as its output: `z.infer<typeof …>` for a Zod schema, fuz_schema's `Infer<typeof …>` for a `@fuzdev/fuz_schema` one, importing `z` and `Infer` only when a schema of that library is present; a schema of neither throws naming the method.
|
|
146
146
|
- `generate_action_event_datas` — `ActionEventDatas` interface; per-spec variants.
|
|
147
147
|
- `generate_frontend_action_handlers` — `FrontendActionHandlers` interface (Tier 2 only).
|
|
@@ -191,7 +191,7 @@ use `auth: {account: 'none', actor: 'none'}` and `transaction: false`.
|
|
|
191
191
|
|
|
192
192
|
The HTTP RPC dispatcher is a thin shim around `perform_action`
|
|
193
193
|
(`actions/perform_action.ts`). The shim owns wire-shape concerns (envelope
|
|
194
|
-
parsing, GET vs POST split, `
|
|
194
|
+
parsing, GET vs POST split, the envelope responses — each a `route_raw`); the
|
|
195
195
|
auth/validation/dispatch pipeline is shared with the WebSocket dispatcher.
|
|
196
196
|
|
|
197
197
|
**Phase order: 401 → authz → 403 → 429 → 400 → handler.** Authorize first,
|
|
@@ -211,7 +211,7 @@ Shim responsibilities (per-request):
|
|
|
211
211
|
3. GET read restriction — GET rejected for `side_effects: true` actions. Every response the GET handler writes, its refusals included, carries `Cache-Control: no-store` (`RPC_GET_CACHE_CONTROL`; a pre-handler middleware refusal, like the origin 403, does not): a read answers one caller at one moment.
|
|
212
212
|
4. Build `PerformActionInput` from `get_resolved_auth(c)` + `get_client_ip` + `c.req.raw.signal`. Test-preset escape hatch reads `has_test_context_preset(c)` + `REQUEST_CONTEXT_KEY`.
|
|
213
213
|
5. Call `perform_action` (shared core).
|
|
214
|
-
6. Bind result via `serialize_action_result(id, result, method, log)` (`actions/perform_action.ts`, shared with WS) → `{body, status}`, written with `c.json`'s content type.
|
|
214
|
+
6. Bind result via `serialize_action_result(id, result, method, log)` (`actions/perform_action.ts`, shared with WS) → `{body, status}`, written with `c.json`'s bytes and content type and returned as a `route_raw`, as is every envelope the shim answers: no REST definition describes one.
|
|
215
215
|
|
|
216
216
|
Error paths: `ThrownJsonrpcError` (recognized through
|
|
217
217
|
`to_thrown_jsonrpc_error` in `http/jsonrpc_errors.ts` by its realm-global
|
|
@@ -173,10 +173,19 @@ export declare const generate_typed_action_event_alias: (imports: ImportBuilder,
|
|
|
173
173
|
metatypes_path?: string;
|
|
174
174
|
}) => string;
|
|
175
175
|
/**
|
|
176
|
-
* Emit the `ActionSpecs` runtime const +
|
|
176
|
+
* Emit the `ActionSpecs` runtime const + type + the `action_specs:
|
|
177
177
|
* Array<ActionSpecUnion>` value bundling every spec. Adds the `* as specs`
|
|
178
178
|
* namespace import + the `ActionSpecUnion` type import.
|
|
179
179
|
*
|
|
180
|
+
* The const is annotated with the type, whose members are `readonly` like an
|
|
181
|
+
* `as const` literal's. Inferred, its type is every spec's schema types
|
|
182
|
+
* written out, and a consumer compiled with `declaration: true` hits TS7056
|
|
183
|
+
* once its spec list is long enough; declared, it serializes as the type's
|
|
184
|
+
* name. The type is an alias and not an interface: an alias has an implicit
|
|
185
|
+
* index signature, so `Object.values(ActionSpecs)` stays typed by the specs
|
|
186
|
+
* and `action_specs` checks each against `ActionSpecUnion`, where over an
|
|
187
|
+
* interface it is `any[]`.
|
|
188
|
+
*
|
|
180
189
|
* @param options.qualify_spec - per-spec qualified identifier callback for
|
|
181
190
|
* multi-source consumers (e.g. ``(s) => `admin_specs.${s.method}_action_spec` ``).
|
|
182
191
|
* When set, the helper emits the callback's return value instead of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_codegen.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_codegen.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG1E;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,+CAAgD,CAAC;AAErF,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAI5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI,oBACrC,CAAC;AAEjC,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,WA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;CACnC,KACC,MA2CF,CAAC;AAMF;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,0BAA0B,GACtC,SAAS,aAAa,CAAC,UAAU,CAAC,EAClC,SAAS,aAAa,KACpB;IACF,YAAY,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;IAChD,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CAiC1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B,KAAG,MAYH,CAAC"}
|
|
@@ -595,10 +595,19 @@ type TypedActionEvent<
|
|
|
595
595
|
> = ActionEvent<TMethod, TPhase, TStep> & {readonly data: ActionEventDatas[TMethod]};`;
|
|
596
596
|
};
|
|
597
597
|
/**
|
|
598
|
-
* Emit the `ActionSpecs` runtime const +
|
|
598
|
+
* Emit the `ActionSpecs` runtime const + type + the `action_specs:
|
|
599
599
|
* Array<ActionSpecUnion>` value bundling every spec. Adds the `* as specs`
|
|
600
600
|
* namespace import + the `ActionSpecUnion` type import.
|
|
601
601
|
*
|
|
602
|
+
* The const is annotated with the type, whose members are `readonly` like an
|
|
603
|
+
* `as const` literal's. Inferred, its type is every spec's schema types
|
|
604
|
+
* written out, and a consumer compiled with `declaration: true` hits TS7056
|
|
605
|
+
* once its spec list is long enough; declared, it serializes as the type's
|
|
606
|
+
* name. The type is an alias and not an interface: an alias has an implicit
|
|
607
|
+
* index signature, so `Object.values(ActionSpecs)` stays typed by the specs
|
|
608
|
+
* and `action_specs` checks each against `ActionSpecUnion`, where over an
|
|
609
|
+
* interface it is `any[]`.
|
|
610
|
+
*
|
|
602
611
|
* @param options.qualify_spec - per-spec qualified identifier callback for
|
|
603
612
|
* multi-source consumers (e.g. ``(s) => `admin_specs.${s.method}_action_spec` ``).
|
|
604
613
|
* When set, the helper emits the callback's return value instead of
|
|
@@ -616,8 +625,8 @@ export const generate_action_specs_record = (specs, imports, options) => {
|
|
|
616
625
|
* Action specifications indexed by method name.
|
|
617
626
|
* These represent the complete action spec definitions.
|
|
618
627
|
*/
|
|
619
|
-
export const ActionSpecs = {}
|
|
620
|
-
export
|
|
628
|
+
export const ActionSpecs: ActionSpecs = {};
|
|
629
|
+
export type ActionSpecs = {};
|
|
621
630
|
|
|
622
631
|
export const action_specs: Array<ActionSpecUnion> = Object.values(ActionSpecs);`;
|
|
623
632
|
}
|
|
@@ -626,18 +635,18 @@ export const action_specs: Array<ActionSpecUnion> = Object.values(ActionSpecs);`
|
|
|
626
635
|
.map((s) => `\t${to_action_property_key(s.method)}: ${qualify(s)},`)
|
|
627
636
|
.join('\n');
|
|
628
637
|
const type_lines = filtered
|
|
629
|
-
.map((s) => `\
|
|
638
|
+
.map((s) => `\treadonly ${to_action_property_key(s.method)}: typeof ${qualify(s)};`)
|
|
630
639
|
.join('\n');
|
|
631
640
|
return `/**
|
|
632
641
|
* Action specifications indexed by method name.
|
|
633
642
|
* These represent the complete action spec definitions.
|
|
634
643
|
*/
|
|
635
|
-
export const ActionSpecs = {
|
|
644
|
+
export const ActionSpecs: ActionSpecs = {
|
|
636
645
|
${value_lines}
|
|
637
|
-
}
|
|
638
|
-
export
|
|
646
|
+
};
|
|
647
|
+
export type ActionSpecs = {
|
|
639
648
|
${type_lines}
|
|
640
|
-
}
|
|
649
|
+
};
|
|
641
650
|
|
|
642
651
|
export const action_specs: Array<ActionSpecUnion> = Object.values(ActionSpecs);`;
|
|
643
652
|
};
|
|
@@ -12,8 +12,8 @@ import { JsonrpcRequest, JsonrpcResponseOrError, JsonrpcNotification, JsonrpcErr
|
|
|
12
12
|
import { ActionExecutor } from './action_event_types.js';
|
|
13
13
|
export declare const ActionEventData: z.ZodObject<{
|
|
14
14
|
kind: z.ZodEnum<{
|
|
15
|
-
remote_notification: "remote_notification";
|
|
16
15
|
request_response: "request_response";
|
|
16
|
+
remote_notification: "remote_notification";
|
|
17
17
|
local_call: "local_call";
|
|
18
18
|
}>;
|
|
19
19
|
phase: z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"action_rpc.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_rpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAmC,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAiBxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACxC,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;OAQG;IACH,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C;;;;;;;OAOG;IACH,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,wBAAwB,KAAG,KAAK,CAAC,SAAS,CAoOtF,CAAC"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
import { z } from 'zod';
|
|
16
16
|
import { DEV } from 'esm-env';
|
|
17
17
|
import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
|
|
18
|
-
import {} from '../http/route_spec.js';
|
|
18
|
+
import { define_route } from '../http/route_spec.js';
|
|
19
|
+
import { route_raw } from '../http/route_result.js';
|
|
19
20
|
import { get_client_ip } from '../http/client_ip.js';
|
|
20
21
|
import { get_request_context } from '../auth/request_context.js';
|
|
21
22
|
import { get_resolved_auth } from '../auth/resolved_auth.js';
|
|
@@ -29,6 +30,14 @@ import { perform_action, serialize_action_result } from './perform_action.js';
|
|
|
29
30
|
* — a read is per caller and per moment, so nothing may store it.
|
|
30
31
|
*/
|
|
31
32
|
export const RPC_GET_CACHE_CONTROL = 'no-store';
|
|
33
|
+
/**
|
|
34
|
+
* A JSON-RPC envelope answered at `status`, with the bytes and `Content-Type`
|
|
35
|
+
* `c.json` writes, as a raw result: the endpoint answers envelopes, its
|
|
36
|
+
* refusals included, which no REST definition describes.
|
|
37
|
+
*/
|
|
38
|
+
const envelope_response = (c, envelope, status) => route_raw(c.body(JSON.stringify(envelope), status, {
|
|
39
|
+
'Content-Type': 'application/json'
|
|
40
|
+
}));
|
|
32
41
|
/**
|
|
33
42
|
* Single JSON-RPC 2.0 endpoint — the canonical RPC transport binding.
|
|
34
43
|
*
|
|
@@ -95,10 +104,10 @@ export const create_rpc_endpoint = (options) => {
|
|
|
95
104
|
const dispatch = async (c, route, method_name, raw_params, id, restrict_to_reads) => {
|
|
96
105
|
const action = action_map.get(method_name);
|
|
97
106
|
if (!action) {
|
|
98
|
-
return c
|
|
107
|
+
return envelope_response(c, create_jsonrpc_error_response(id, jsonrpc_error_messages.method_not_found(method_name)), jsonrpc_error_code_to_http_status(JSONRPC_ERROR_CODES.method_not_found));
|
|
99
108
|
}
|
|
100
109
|
if (restrict_to_reads && action.spec.side_effects) {
|
|
101
|
-
return c
|
|
110
|
+
return envelope_response(c, create_jsonrpc_error_response(id, jsonrpc_error_messages.invalid_request({
|
|
102
111
|
reason: `method '${method_name}' has side effects and must use POST`
|
|
103
112
|
})), jsonrpc_error_code_to_http_status(JSONRPC_ERROR_CODES.invalid_request));
|
|
104
113
|
}
|
|
@@ -137,9 +146,9 @@ export const create_rpc_endpoint = (options) => {
|
|
|
137
146
|
// dispatcher emits (the value space is verified by
|
|
138
147
|
// `jsonrpc_error_code_to_http_status`), which the cast to Hono's
|
|
139
148
|
// `ContentfulStatusCode` bridges. The content type is `c.json`'s.
|
|
140
|
-
return c.body(body, status, {
|
|
149
|
+
return route_raw(c.body(body, status, {
|
|
141
150
|
'Content-Type': 'application/json'
|
|
142
|
-
});
|
|
151
|
+
}));
|
|
143
152
|
};
|
|
144
153
|
// POST handler — parse JSON-RPC envelope from body
|
|
145
154
|
const post_handler = async (c, route) => {
|
|
@@ -150,7 +159,7 @@ export const create_rpc_endpoint = (options) => {
|
|
|
150
159
|
}
|
|
151
160
|
catch {
|
|
152
161
|
const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.parse_error());
|
|
153
|
-
return c
|
|
162
|
+
return envelope_response(c, error, 400);
|
|
154
163
|
}
|
|
155
164
|
// the classifier the WS path runs; HTTP issues no server-initiated
|
|
156
165
|
// requests and has no notification semantics, so a response or a
|
|
@@ -162,10 +171,10 @@ export const create_rpc_endpoint = (options) => {
|
|
|
162
171
|
return dispatch(c, route, method, params, id, false);
|
|
163
172
|
}
|
|
164
173
|
case 'invalid':
|
|
165
|
-
return c
|
|
174
|
+
return envelope_response(c, create_jsonrpc_error_response(classified.id, classified.error), 400);
|
|
166
175
|
case 'notification':
|
|
167
176
|
case 'response':
|
|
168
|
-
return c
|
|
177
|
+
return envelope_response(c, create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request()), 400);
|
|
169
178
|
default:
|
|
170
179
|
throw new UnreachableError(classified);
|
|
171
180
|
}
|
|
@@ -180,12 +189,12 @@ export const create_rpc_endpoint = (options) => {
|
|
|
180
189
|
const method_name = c.req.query('method');
|
|
181
190
|
if (!method_name) {
|
|
182
191
|
const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request({ reason: 'missing method query parameter' }));
|
|
183
|
-
return c
|
|
192
|
+
return envelope_response(c, error, 400);
|
|
184
193
|
}
|
|
185
194
|
const id_raw = c.req.query('id');
|
|
186
195
|
if (!id_raw) {
|
|
187
196
|
const error = create_jsonrpc_error_response(null, jsonrpc_error_messages.invalid_request({ reason: 'missing id query parameter' }));
|
|
188
|
-
return c
|
|
197
|
+
return envelope_response(c, error, 400);
|
|
189
198
|
}
|
|
190
199
|
// parse integer ids so GET ?id=42 matches POST {id: 42} behavior
|
|
191
200
|
// JSON-RPC spec: "Numbers SHOULD NOT contain fractional parts"
|
|
@@ -200,13 +209,13 @@ export const create_rpc_endpoint = (options) => {
|
|
|
200
209
|
}
|
|
201
210
|
catch {
|
|
202
211
|
const error = create_jsonrpc_error_response(id, jsonrpc_error_messages.invalid_params('params query parameter is not valid JSON'));
|
|
203
|
-
return c
|
|
212
|
+
return envelope_response(c, error, 400);
|
|
204
213
|
}
|
|
205
214
|
}
|
|
206
215
|
return dispatch(c, route, method_name, params, id, true);
|
|
207
216
|
};
|
|
208
217
|
return [
|
|
209
|
-
{
|
|
218
|
+
define_route({
|
|
210
219
|
method: 'POST',
|
|
211
220
|
path: endpoint_path,
|
|
212
221
|
auth: { account: 'none', actor: 'none' }, // per-action auth inside dispatcher
|
|
@@ -220,8 +229,8 @@ export const create_rpc_endpoint = (options) => {
|
|
|
220
229
|
input: z.null(), // dispatcher owns body parsing; rpc_endpoints surface has the real schemas
|
|
221
230
|
output: z.any(), // varies by method
|
|
222
231
|
transaction: false // per-action inside dispatcher
|
|
223
|
-
},
|
|
224
|
-
{
|
|
232
|
+
}),
|
|
233
|
+
define_route({
|
|
225
234
|
method: 'GET',
|
|
226
235
|
path: endpoint_path,
|
|
227
236
|
auth: { account: 'none', actor: 'none' }, // per-action auth inside dispatcher
|
|
@@ -233,6 +242,6 @@ export const create_rpc_endpoint = (options) => {
|
|
|
233
242
|
input: z.null(), // params from query string, validated by dispatcher
|
|
234
243
|
output: z.any(), // varies by method
|
|
235
244
|
transaction: false // per-action inside dispatcher
|
|
236
|
-
}
|
|
245
|
+
})
|
|
237
246
|
];
|
|
238
247
|
};
|
|
@@ -24,17 +24,17 @@ import type { ValidationSchema } from '../schema_issues.js';
|
|
|
24
24
|
/** The action kinds, in declaration order — what `ActionKind` and `is_action_spec` read. */
|
|
25
25
|
export declare const ACTION_KINDS: readonly ["request_response", "remote_notification", "local_call"];
|
|
26
26
|
export declare const ActionKind: z.ZodEnum<{
|
|
27
|
-
remote_notification: "remote_notification";
|
|
28
27
|
request_response: "request_response";
|
|
28
|
+
remote_notification: "remote_notification";
|
|
29
29
|
local_call: "local_call";
|
|
30
30
|
}>;
|
|
31
31
|
export type ActionKind = z.infer<typeof ActionKind>;
|
|
32
32
|
/** Which side initiates an action — what `ActionInitiator` reads. */
|
|
33
33
|
export declare const ACTION_INITIATORS: readonly ["frontend", "backend", "both"];
|
|
34
34
|
export declare const ActionInitiator: z.ZodEnum<{
|
|
35
|
+
both: "both";
|
|
35
36
|
frontend: "frontend";
|
|
36
37
|
backend: "backend";
|
|
37
|
-
both: "both";
|
|
38
38
|
}>;
|
|
39
39
|
export type ActionInitiator = z.infer<typeof ActionInitiator>;
|
|
40
40
|
/** The fields every action spec carries; each kind narrows some of them. */
|
|
@@ -145,7 +145,8 @@ export interface PerformActionDeps {
|
|
|
145
145
|
/**
|
|
146
146
|
* Discriminated result of `perform_action`. Each transport binds this to
|
|
147
147
|
* its wire shape: HTTP RPC folds the error into a JSON-RPC envelope and
|
|
148
|
-
* returns
|
|
148
|
+
* returns it as a `route_raw` result over `c.body`; WS sends the response
|
|
149
|
+
* over the socket.
|
|
149
150
|
*/
|
|
150
151
|
export type PerformActionResult = {
|
|
151
152
|
kind: 'ok';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perform_action.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAGN,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAGvB,MAAM,oBAAoB,CAAC;AAiB5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,kEAAkE;IAClE,MAAM,EAAE,SAAS,CAAC;IAClB,uGAAuG;IACvG,UAAU,EAAE,OAAO,CAAC;IACpB,sDAAsD;IACtD,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;;;;;OAMG;IACH,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,MAAM,EAAE,WAAW,CAAC;IACpB,sFAAsF;IACtF,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,uDAAuD;IACvD,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B;;;;OAIG;IACH,MAAM,CAAC,EAAE;QAAE,eAAe,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,CAAC;CACpD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC,gGAAgG;IAChG,EAAE,EAAE,EAAE,CAAC;IACP;;;OAGG;IACH,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC;;;OAGG;IACH,mBAAmB,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACvD,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,uEAAuE;IACvE,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAED
|
|
1
|
+
{"version":3,"file":"perform_action.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,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|
consumer's `validate_data(kind, data)` callback on `CellActionDeps`, which
|
|
272
272
|
accepts or throws and never rewrites (the handler stores the caller's `data`).
|
|
273
273
|
|
|
274
|
-
- `auth/cell_data_schema.ts` — `CellData` base (`
|
|
275
|
-
optional `label` / `summary`); per-kind
|
|
274
|
+
- `auth/cell_data_schema.ts` — `CellData` base (a `@fuzdev/fuz_schema`
|
|
275
|
+
`loose_object` with optional `label` / `summary`); a per-kind schema spreads
|
|
276
|
+
its `def` (`loose_object({...CellData.def, ...})`). **`kind` is
|
|
276
277
|
not in `data`** — it is a top-level `cell.kind` column (peer to
|
|
277
278
|
`visibility` / `path`), the write-once capability/identity axis; a stray
|
|
278
279
|
`kind` inside `data` is rejected fail-loud (`ERROR_CELL_KIND_IN_DATA`).
|
|
279
280
|
- `auth/cell_action_specs.ts` — `CellVisibility` enum, `CellPath` brand,
|
|
280
281
|
`CELL_KIND_LENGTH_MAX` (64 — the wire `kind` on `cell_create` and the
|
|
281
282
|
`cell_list` filter; the tag is copied into the cell's audit rows),
|
|
282
|
-
`CellJson`, `CellPolicy` (a root's contribution policy, `
|
|
283
|
+
`CellJson`, `CellPolicy` (a root's contribution policy, a `loose_object`), the
|
|
283
284
|
generic verb specs (`cell_create / get / update / delete / list / clone /
|
|
284
285
|
moderate / policy_set`), error reasons, and `all_cell_action_specs`
|
|
285
286
|
(spreads in the grant / field / item / audit registries so codegen + UI
|
|
@@ -291,7 +292,8 @@ moderate / policy_set`), error reasons, and `all_cell_action_specs`
|
|
|
291
292
|
- `auth/cell_grant_action_specs.ts` / `cell_field_action_specs.ts` /
|
|
292
293
|
`cell_item_action_specs.ts` / `cell_audit_action_specs.ts` — the
|
|
293
294
|
`cell_grant_*` / `cell_field_*` / `cell_item_*` / `cell_audit_list`
|
|
294
|
-
specs + their wire JSON shapes.
|
|
295
|
+
specs + their wire JSON shapes. Every cell wire schema is
|
|
296
|
+
`@fuzdev/fuz_schema`.
|
|
295
297
|
- `auth/cell_authorize.ts` — pure predicates over
|
|
296
298
|
`(RequestContext | null, CellRow, grants)`: `can_view_cell`,
|
|
297
299
|
`can_edit_cell`, and `can_manage_cell` (= admin ‖ owner, where owner is
|
|
@@ -415,8 +417,8 @@ root_id, root_policy}` than `validate_data` and returns a `CellCreateVerdict`
|
|
|
415
417
|
Distinct from `create_cell_actions` (the CRUD-only factory it bundles).
|
|
416
418
|
- `auth/cell_audit_metadata.ts` + `cell_grant_audit_metadata.ts` +
|
|
417
419
|
`cell_field_audit_metadata.ts` + `cell_item_audit_metadata.ts` — audit
|
|
418
|
-
metadata envelopes (IDs only),
|
|
419
|
-
consumer's `create_audit_log_config`.
|
|
420
|
+
metadata envelopes (IDs only), `@fuzdev/fuz_schema` `loose_object`s,
|
|
421
|
+
registered via `extra_events:` on the consumer's `create_audit_log_config`.
|
|
420
422
|
- `auth/cell_audit_events.ts` — `cell_audit_events`, the canonical
|
|
421
423
|
`event_type → metadata` map bundling every cell-domain audit event.
|
|
422
424
|
Consumers spread it into `extra_events` to register the whole layer in
|
|
@@ -483,8 +485,8 @@ than read back — the `expires_at` on `account_token_create`'s output — use
|
|
|
483
485
|
`to_iso8601_seconds` (`timestamp.ts`), so the mint and the later
|
|
484
486
|
`account_token_list` read agree byte for byte.
|
|
485
487
|
|
|
486
|
-
The `*Json` schemas type these as `
|
|
487
|
-
also satisfies — so the shape is pinned behaviorally by
|
|
488
|
+
The `*Json` schemas type these as `Timestamp` (`iso_datetime`), which a
|
|
489
|
+
millisecond stamp also satisfies — so the shape is pinned behaviorally by
|
|
488
490
|
`assert_iso8601_seconds` (`testing/cross_backend/wire_shapes.ts`) inside the
|
|
489
491
|
shared suites, on both backends.
|
|
490
492
|
|
|
@@ -116,11 +116,11 @@ export type SessionRevokeAllInput = Infer<typeof SessionRevokeAllInput>;
|
|
|
116
116
|
* `count` is the number of sessions revoked.
|
|
117
117
|
*/
|
|
118
118
|
export declare const SessionRevokeAllOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
119
|
-
count: number;
|
|
120
119
|
ok: true;
|
|
121
|
-
}, {
|
|
122
120
|
count: number;
|
|
121
|
+
}, {
|
|
123
122
|
ok: true;
|
|
123
|
+
count: number;
|
|
124
124
|
}, "object", {
|
|
125
125
|
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
126
126
|
count: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>;
|
|
@@ -256,14 +256,14 @@ export declare const TokenCreateOutput: import("@fuzdev/fuz_schema/schema.ts").S
|
|
|
256
256
|
name: string;
|
|
257
257
|
id: string;
|
|
258
258
|
expires_at: string | null;
|
|
259
|
-
token: string;
|
|
260
259
|
ok: true;
|
|
260
|
+
token: string;
|
|
261
261
|
}, {
|
|
262
262
|
name: string;
|
|
263
263
|
id: string;
|
|
264
264
|
expires_at: string | null;
|
|
265
|
-
token: string;
|
|
266
265
|
ok: true;
|
|
266
|
+
token: string;
|
|
267
267
|
}, "object", {
|
|
268
268
|
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
269
269
|
token: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
@@ -532,11 +532,11 @@ export declare const account_session_revoke_all_action_spec: {
|
|
|
532
532
|
side_effects: true;
|
|
533
533
|
input: import("@fuzdev/fuz_schema/schema.ts").Schema<void, void, "literal", undefined>;
|
|
534
534
|
output: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
535
|
-
count: number;
|
|
536
535
|
ok: true;
|
|
537
|
-
}, {
|
|
538
536
|
count: number;
|
|
537
|
+
}, {
|
|
539
538
|
ok: true;
|
|
539
|
+
count: number;
|
|
540
540
|
}, "object", {
|
|
541
541
|
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
542
542
|
count: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>;
|
|
@@ -657,14 +657,14 @@ export declare const account_token_create_action_spec: {
|
|
|
657
657
|
name: string;
|
|
658
658
|
id: string;
|
|
659
659
|
expires_at: string | null;
|
|
660
|
-
token: string;
|
|
661
660
|
ok: true;
|
|
661
|
+
token: string;
|
|
662
662
|
}, {
|
|
663
663
|
name: string;
|
|
664
664
|
id: string;
|
|
665
665
|
expires_at: string | null;
|
|
666
|
-
token: string;
|
|
667
666
|
ok: true;
|
|
667
|
+
token: string;
|
|
668
668
|
}, "object", {
|
|
669
669
|
ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
|
|
670
670
|
token: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|