@fuzdev/fuz_app 0.78.1 → 0.80.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 +5 -5
- package/dist/actions/action_rpc.d.ts +1 -1
- package/dist/actions/compile_action_registry.d.ts +1 -1
- package/dist/actions/compile_action_registry.js +1 -1
- package/dist/actions/connection_closer.d.ts +1 -1
- package/dist/actions/connection_closer.js +1 -1
- package/dist/auth/actor_lookup_action_specs.d.ts +1 -1
- package/dist/auth/actor_lookup_action_specs.js +1 -1
- package/dist/auth/actor_lookup_queries.d.ts +1 -1
- package/dist/auth/actor_lookup_queries.js +1 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +3 -3
- package/dist/auth/actor_search_queries.js +3 -3
- package/dist/auth/all_action_spec_registries.d.ts +1 -1
- package/dist/auth/all_action_spec_registries.js +1 -1
- package/dist/auth/cell_action_specs.d.ts +1 -1
- package/dist/auth/cell_action_specs.js +1 -1
- package/dist/auth/cell_actions.d.ts +2 -2
- package/dist/auth/cell_actions.js +2 -2
- package/dist/auth/cell_audit_events.d.ts +3 -3
- package/dist/auth/cell_audit_events.js +3 -3
- package/dist/auth/cell_data_schema.d.ts +2 -2
- package/dist/auth/cell_data_schema.js +2 -2
- package/dist/auth/cell_field_actions.d.ts +3 -3
- package/dist/auth/cell_field_actions.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +3 -3
- package/dist/auth/cell_grant_actions.js +3 -3
- package/dist/auth/cell_item_actions.d.ts +3 -3
- package/dist/auth/cell_item_actions.js +3 -3
- package/dist/db/cell_queries.d.ts +2 -2
- package/dist/db/cell_queries.js +1 -1
- package/dist/http/CLAUDE.md +4 -4
- package/dist/http/auth_shape.d.ts +2 -2
- package/dist/http/auth_shape.js +2 -2
- package/dist/http/ip_canonical.d.ts +1 -1
- package/dist/http/ip_canonical.js +1 -1
- package/dist/http/proxy.d.ts +1 -1
- package/dist/http/proxy.js +1 -1
- package/dist/http/route_spec.d.ts +1 -1
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.js +1 -1
- package/dist/testing/CLAUDE.md +6 -2
- package/dist/testing/audit_completeness.js +1 -1
- package/dist/testing/audit_drift_guard.d.ts +1 -1
- package/dist/testing/cross_backend/backend_config.d.ts +1 -1
- package/dist/testing/cross_backend/bench/run_cross_impl_bench.d.ts +1 -1
- package/dist/testing/cross_backend/capabilities.d.ts +10 -0
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +1 -0
- package/dist/testing/cross_backend/cell_cross_helpers.d.ts +1 -1
- package/dist/testing/cross_backend/cell_cross_helpers.js +2 -2
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +2 -0
- package/dist/testing/cross_backend/default_secrets.d.ts +1 -1
- package/dist/testing/cross_backend/default_secrets.js +1 -1
- package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +1 -1
- package/dist/testing/cross_backend/fact_serving.d.ts +14 -0
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -0
- package/dist/testing/cross_backend/fact_serving.js +189 -0
- package/dist/testing/cross_backend/setup.d.ts +3 -3
- package/dist/testing/cross_backend/setup.js +2 -2
- package/dist/testing/cross_backend/spawn_backend.d.ts +1 -1
- package/dist/testing/cross_backend/spawn_backend.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +34 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +43 -0
- package/dist/testing/cross_backend/testing_server_bun.js +3 -3
- package/dist/testing/cross_backend/testing_server_core.d.ts +3 -3
- package/dist/testing/cross_backend/testing_server_deno.js +2 -2
- package/dist/testing/cross_backend/testing_server_node.js +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +1 -1
- package/dist/testing/cross_backend/xfail.js +1 -1
- package/dist/testing/data_exposure.js +1 -1
- package/dist/testing/db_entities.d.ts +1 -1
- package/dist/testing/db_entities.js +3 -3
- package/dist/testing/integration.d.ts +1 -1
- package/dist/testing/role_grant_helpers.js +1 -1
- package/dist/testing/rpc_round_trip.js +1 -1
- package/dist/testing/schema_introspect.d.ts +3 -3
- package/dist/testing/schema_introspect.js +3 -3
- package/dist/testing/transports/sse_transport.js +2 -2
- package/dist/testing/transports/ws_client.d.ts +1 -1
- package/dist/testing/transports/ws_client.js +2 -2
- package/dist/testing/transports/ws_transport.js +1 -1
- package/dist/ui/CLAUDE.md +1 -1
- package/dist/ui/sidebar_state.svelte.d.ts +2 -2
- package/dist/ui/sidebar_state.svelte.js +2 -2
- package/package.json +1 -1
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
> symmetric send/receive.
|
|
6
6
|
|
|
7
7
|
For consumer wiring (client-authoritative vs server-authoritative dispatch,
|
|
8
|
-
role-grant-offer UI integration), see
|
|
8
|
+
role-grant-offer UI integration), see ../../../docs/usage.md §Deriving
|
|
9
9
|
Route/Event Specs, §Single JSON-RPC 2.0 Endpoint, §WebSocket Endpoint. For
|
|
10
|
-
DEV-only output validation semantics see
|
|
10
|
+
DEV-only output validation semantics see ../../../docs/architecture.md
|
|
11
11
|
§DEV-only Output Validation. For the SAES binding matrix and middleware
|
|
12
|
-
ordering see the root
|
|
12
|
+
ordering see the root ../../../CLAUDE.md §Action Spec System (SAES) and
|
|
13
13
|
§Middleware Ordering.
|
|
14
14
|
|
|
15
15
|
**CLAUDE.md is a map; TSDoc is the detail.** Per-symbol semantics
|
|
@@ -58,7 +58,7 @@ Optional fields:
|
|
|
58
58
|
Canonical spec shape: module-scope `satisfies` declaration with
|
|
59
59
|
`{method}_action_spec` naming, preserving the literal `method` type and
|
|
60
60
|
dropping per-spec `*_METHOD` constants (readers dereference `.method`). See
|
|
61
|
-
|
|
61
|
+
../../../docs/usage.md §Canonical action-spec shape.
|
|
62
62
|
|
|
63
63
|
## Kind → binding matrix
|
|
64
64
|
|
|
@@ -300,7 +300,7 @@ the response unchanged, do not throw, do not mutate status.
|
|
|
300
300
|
|
|
301
301
|
Caller-facing `input` schemas are validated **always** (DEV + production)
|
|
302
302
|
— they're the contract with external callers. Server-authored `output`
|
|
303
|
-
schemas are internal data. See
|
|
303
|
+
schemas are internal data. See ../../../docs/architecture.md §DEV-only Output
|
|
304
304
|
Validation for full rationale.
|
|
305
305
|
|
|
306
306
|
## Transports
|
|
@@ -59,7 +59,7 @@ export interface ActionContext {
|
|
|
59
59
|
pending_effects: Array<Promise<void>>;
|
|
60
60
|
/**
|
|
61
61
|
* Deferred post-commit thunks — do not push directly; reach for
|
|
62
|
-
* `emit_after_commit(ctx, fn)` from `pending_effects.ts`. The flush
|
|
62
|
+
* `emit_after_commit(ctx, fn)` from `http/pending_effects.ts`. The flush
|
|
63
63
|
* site invokes each thunk after the handler (and any wrapping
|
|
64
64
|
* `db.transaction`) returns.
|
|
65
65
|
*/
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* kind / handler presence.
|
|
21
21
|
*
|
|
22
22
|
* Pre-consolidation each dispatcher inlined these checks; the comment
|
|
23
|
-
* in `register_action_ws.ts` literally said "mirrors the HTTP RPC
|
|
23
|
+
* in `actions/register_action_ws.ts` literally said "mirrors the HTTP RPC
|
|
24
24
|
* registration check" but nothing kept them mirrored. Centralizing the
|
|
25
25
|
* loop closes the most likely future drift surface.
|
|
26
26
|
*
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* kind / handler presence.
|
|
21
21
|
*
|
|
22
22
|
* Pre-consolidation each dispatcher inlined these checks; the comment
|
|
23
|
-
* in `register_action_ws.ts` literally said "mirrors the HTTP RPC
|
|
23
|
+
* in `actions/register_action_ws.ts` literally said "mirrors the HTTP RPC
|
|
24
24
|
* registration check" but nothing kept them mirrored. Centralizing the
|
|
25
25
|
* loop closes the most likely future drift surface.
|
|
26
26
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* message but does NOT re-query session / token validity — that
|
|
8
8
|
* trade-off keeps chatty connections fast. The cost: revocation
|
|
9
9
|
* doesn't actually disconnect open sockets unless something closes
|
|
10
|
-
* them. `transports_ws_auth_guard.ts` is the listener-based seam
|
|
10
|
+
* them. `actions/transports_ws_auth_guard.ts` is the listener-based seam
|
|
11
11
|
* (audit-event → close), but it only fires after the audit INSERT
|
|
12
12
|
* succeeds — if the INSERT fails (DB error, pool exhausted, handler
|
|
13
13
|
* dies mid-flight) the listener never runs and the live socket keeps
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* message but does NOT re-query session / token validity — that
|
|
8
8
|
* trade-off keeps chatty connections fast. The cost: revocation
|
|
9
9
|
* doesn't actually disconnect open sockets unless something closes
|
|
10
|
-
* them. `transports_ws_auth_guard.ts` is the listener-based seam
|
|
10
|
+
* them. `actions/transports_ws_auth_guard.ts` is the listener-based seam
|
|
11
11
|
* (audit-event → close), but it only fires after the audit INSERT
|
|
12
12
|
* succeeds — if the INSERT fails (DB error, pool exhausted, handler
|
|
13
13
|
* dies mid-flight) the listener never runs and the live socket keeps
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* 2. {@link ACTOR_LOOKUP_IDS_MAX} cap per call,
|
|
42
42
|
* 3. actor-uuid intractability (122-bit random),
|
|
43
43
|
* 4. hard-deleted actors are indistinguishable from never-existed (no
|
|
44
|
-
* tombstone oracle — see `actor_lookup_queries.ts`).
|
|
44
|
+
* tombstone oracle — see `auth/actor_lookup_queries.ts`).
|
|
45
45
|
*
|
|
46
46
|
* Response order is unspecified — callers index by `id` when needed.
|
|
47
47
|
*
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* 2. {@link ACTOR_LOOKUP_IDS_MAX} cap per call,
|
|
42
42
|
* 3. actor-uuid intractability (122-bit random),
|
|
43
43
|
* 4. hard-deleted actors are indistinguishable from never-existed (no
|
|
44
|
-
* tombstone oracle — see `actor_lookup_queries.ts`).
|
|
44
|
+
* tombstone oracle — see `auth/actor_lookup_queries.ts`).
|
|
45
45
|
*
|
|
46
46
|
* Response order is unspecified — callers index by `id` when needed.
|
|
47
47
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* The inner join still resolves one row per actor — `actor.account_id`
|
|
11
11
|
* is `NOT NULL` so every actor has exactly one account.
|
|
12
12
|
*
|
|
13
|
-
* Info-leak posture (see `actor_lookup_action_specs.ts` §audit):
|
|
13
|
+
* Info-leak posture (see `auth/actor_lookup_action_specs.ts` §audit):
|
|
14
14
|
*
|
|
15
15
|
* - Row shape **omits** `account_id` — the join is control-plane,
|
|
16
16
|
* not wire-visible.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* The inner join still resolves one row per actor — `actor.account_id`
|
|
11
11
|
* is `NOT NULL` so every actor has exactly one account.
|
|
12
12
|
*
|
|
13
|
-
* Info-leak posture (see `actor_lookup_action_specs.ts` §audit):
|
|
13
|
+
* Info-leak posture (see `auth/actor_lookup_action_specs.ts` §audit):
|
|
14
14
|
*
|
|
15
15
|
* - Row shape **omits** `account_id` — the join is control-plane,
|
|
16
16
|
* not wire-visible.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* `display_name` is omitted (not `null`) when `actor.name` is blank,
|
|
21
21
|
* matching the wire shape `ActorLookupEntryJson.display_name?` — same
|
|
22
|
-
* convention as `actor_lookup_actions.ts`.
|
|
22
|
+
* convention as `auth/actor_lookup_actions.ts`.
|
|
23
23
|
*
|
|
24
24
|
* @module
|
|
25
25
|
*/
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* `display_name` is omitted (not `null`) when `actor.name` is blank,
|
|
21
21
|
* matching the wire shape `ActorLookupEntryJson.display_name?` — same
|
|
22
|
-
* convention as `actor_lookup_actions.ts`.
|
|
22
|
+
* convention as `auth/actor_lookup_actions.ts`.
|
|
23
23
|
*
|
|
24
24
|
* @module
|
|
25
25
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prefix-based actor search.
|
|
3
3
|
*
|
|
4
|
-
* Sibling to `actor_lookup_queries.ts` — that resolves a batch of ids to
|
|
4
|
+
* Sibling to `auth/actor_lookup_queries.ts` — that resolves a batch of ids to
|
|
5
5
|
* labels; this resolves a partial name to candidate actors. Same row
|
|
6
6
|
* shape (`ActorLookupRow`) so the labels arc on the consumer side stays
|
|
7
7
|
* uniform.
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
* gates), no role_grant join — every actor with a matching prefix is
|
|
30
30
|
* returned.
|
|
31
31
|
*
|
|
32
|
-
* ## Info-leak posture (see `actor_search_action_specs.ts` §audit)
|
|
32
|
+
* ## Info-leak posture (see `auth/actor_search_action_specs.ts` §audit)
|
|
33
33
|
*
|
|
34
34
|
* - Row shape **omits** `account_id` — the join is control-plane, not
|
|
35
|
-
* wire-visible. Identical to `actor_lookup_queries.ts`.
|
|
35
|
+
* wire-visible. Identical to `auth/actor_lookup_queries.ts`.
|
|
36
36
|
* - Hard-deleted actors (cascade-orphaned via `actor.account_id` FK)
|
|
37
37
|
* drop out silently.
|
|
38
38
|
* - No `created_at` / `updated_at` projected (timing-oracle avoidance).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prefix-based actor search.
|
|
3
3
|
*
|
|
4
|
-
* Sibling to `actor_lookup_queries.ts` — that resolves a batch of ids to
|
|
4
|
+
* Sibling to `auth/actor_lookup_queries.ts` — that resolves a batch of ids to
|
|
5
5
|
* labels; this resolves a partial name to candidate actors. Same row
|
|
6
6
|
* shape (`ActorLookupRow`) so the labels arc on the consumer side stays
|
|
7
7
|
* uniform.
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
* gates), no role_grant join — every actor with a matching prefix is
|
|
30
30
|
* returned.
|
|
31
31
|
*
|
|
32
|
-
* ## Info-leak posture (see `actor_search_action_specs.ts` §audit)
|
|
32
|
+
* ## Info-leak posture (see `auth/actor_search_action_specs.ts` §audit)
|
|
33
33
|
*
|
|
34
34
|
* - Row shape **omits** `account_id` — the join is control-plane, not
|
|
35
|
-
* wire-visible. Identical to `actor_lookup_queries.ts`.
|
|
35
|
+
* wire-visible. Identical to `auth/actor_lookup_queries.ts`.
|
|
36
36
|
* - Hard-deleted actors (cascade-orphaned via `actor.account_id` FK)
|
|
37
37
|
* drop out silently.
|
|
38
38
|
* - No `created_at` / `updated_at` projected (timing-oracle avoidance).
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* everything into a single mount would silently widen the dispatch surface
|
|
13
13
|
* the moment a new opt-in landed — the exact failure mode this module is
|
|
14
14
|
* built to detect, not propagate. See `./CLAUDE.md` §RPC actions
|
|
15
|
-
* (`standard_rpc_actions.ts`).
|
|
15
|
+
* (`auth/standard_rpc_actions.ts`).
|
|
16
16
|
*
|
|
17
17
|
* Use cases for this registry:
|
|
18
18
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* everything into a single mount would silently widen the dispatch surface
|
|
13
13
|
* the moment a new opt-in landed — the exact failure mode this module is
|
|
14
14
|
* built to detect, not propagate. See `./CLAUDE.md` §RPC actions
|
|
15
|
-
* (`standard_rpc_actions.ts`).
|
|
15
|
+
* (`auth/standard_rpc_actions.ts`).
|
|
16
16
|
*
|
|
17
17
|
* Use cases for this registry:
|
|
18
18
|
*
|
|
@@ -114,7 +114,7 @@ export declare const CELL_RELATIONS_BUNDLE_LIMIT = 500;
|
|
|
114
114
|
* Wire form for a cell row. `data` is the typed-but-permissive `CellData`
|
|
115
115
|
* shape (kind / label / summary typed-and-optional, additional fields
|
|
116
116
|
* pass through). Per-kind shape validation is sub-API and handled by
|
|
117
|
-
* the app's `validate_data` deps callback (see `cell_actions.ts`).
|
|
117
|
+
* the app's `validate_data` deps callback (see `auth/cell_actions.ts`).
|
|
118
118
|
*
|
|
119
119
|
* `visibility` is the access-control axis — a top-level column on the
|
|
120
120
|
* row, not a field inside `data`. `cell_grant` and `visibility` are the
|
|
@@ -120,7 +120,7 @@ export const CELL_RELATIONS_BUNDLE_LIMIT = 500;
|
|
|
120
120
|
* Wire form for a cell row. `data` is the typed-but-permissive `CellData`
|
|
121
121
|
* shape (kind / label / summary typed-and-optional, additional fields
|
|
122
122
|
* pass through). Per-kind shape validation is sub-API and handled by
|
|
123
|
-
* the app's `validate_data` deps callback (see `cell_actions.ts`).
|
|
123
|
+
* the app's `validate_data` deps callback (see `auth/cell_actions.ts`).
|
|
124
124
|
*
|
|
125
125
|
* `visibility` is the access-control axis — a top-level column on the
|
|
126
126
|
* row, not a field inside `data`. `cell_grant` and `visibility` are the
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Generic cell RPC action handlers.
|
|
3
3
|
*
|
|
4
4
|
* Six `request_response` actions bound to the specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* - Mutations: `cell_create`, `cell_update`, `cell_delete`, `cell_clone`.
|
|
8
8
|
* - Reads: `cell_get`, `cell_list`.
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* Mutations emit `cell_create` / `cell_update` / `cell_delete` audit
|
|
31
31
|
* events via `deps.audit.emit(...)`. The `AuditLogConfig` threaded through
|
|
32
32
|
* the consumer's `audit_factory` (see `create_app_backend`) must declare
|
|
33
|
-
* the cell event types (see
|
|
33
|
+
* the cell event types (see `auth/cell_audit_metadata.ts`).
|
|
34
34
|
*
|
|
35
35
|
* App vocabulary (e.g., collection / entry kinds) lives in client-side
|
|
36
36
|
* helpers and per-app `validate_data` deps — this layer is generic-only
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Generic cell RPC action handlers.
|
|
3
3
|
*
|
|
4
4
|
* Six `request_response` actions bound to the specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* - Mutations: `cell_create`, `cell_update`, `cell_delete`, `cell_clone`.
|
|
8
8
|
* - Reads: `cell_get`, `cell_list`.
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* Mutations emit `cell_create` / `cell_update` / `cell_delete` audit
|
|
31
31
|
* events via `deps.audit.emit(...)`. The `AuditLogConfig` threaded through
|
|
32
32
|
* the consumer's `audit_factory` (see `create_app_backend`) must declare
|
|
33
|
-
* the cell event types (see
|
|
33
|
+
* the cell event types (see `auth/cell_audit_metadata.ts`).
|
|
34
34
|
*
|
|
35
35
|
* App vocabulary (e.g., collection / entry kinds) lives in client-side
|
|
36
36
|
* helpers and per-app `validate_data` deps — this layer is generic-only
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* alongside.
|
|
10
10
|
*
|
|
11
11
|
* Aggregator module by design — not a compat shim. The per-event metadata
|
|
12
|
-
* schemas live in their own files (`cell_audit_metadata.ts`,
|
|
13
|
-
* `cell_grant_audit_metadata.ts`, `cell_field_audit_metadata.ts`,
|
|
14
|
-
* `cell_item_audit_metadata.ts`); this module is the single registration
|
|
12
|
+
* schemas live in their own files (`auth/cell_audit_metadata.ts`,
|
|
13
|
+
* `auth/cell_grant_audit_metadata.ts`, `auth/cell_field_audit_metadata.ts`,
|
|
14
|
+
* `auth/cell_item_audit_metadata.ts`); this module is the single registration
|
|
15
15
|
* surface that keeps the keys in lockstep with the handlers.
|
|
16
16
|
*
|
|
17
17
|
* @module
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* alongside.
|
|
10
10
|
*
|
|
11
11
|
* Aggregator module by design — not a compat shim. The per-event metadata
|
|
12
|
-
* schemas live in their own files (`cell_audit_metadata.ts`,
|
|
13
|
-
* `cell_grant_audit_metadata.ts`, `cell_field_audit_metadata.ts`,
|
|
14
|
-
* `cell_item_audit_metadata.ts`); this module is the single registration
|
|
12
|
+
* schemas live in their own files (`auth/cell_audit_metadata.ts`,
|
|
13
|
+
* `auth/cell_grant_audit_metadata.ts`, `auth/cell_field_audit_metadata.ts`,
|
|
14
|
+
* `auth/cell_item_audit_metadata.ts`); this module is the single registration
|
|
15
15
|
* surface that keeps the keys in lockstep with the handlers.
|
|
16
16
|
*
|
|
17
17
|
* @module
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Loose object: arbitrary additional fields pass through unvalidated,
|
|
9
9
|
* preserving the "unknown kinds ship without RPC churn" property. Per-kind
|
|
10
10
|
* shape enforcement is opt-in via the `validate_data` deps slot — see
|
|
11
|
-
* `cell_actions.ts`.
|
|
11
|
+
* `auth/cell_actions.ts`.
|
|
12
12
|
*
|
|
13
13
|
* **Discipline**: a field joins `CellData` only when at least two
|
|
14
14
|
* consumers in different domains read it generically. `kind` (editor
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* **Visibility is not in here.** Access control is a peer of `cell_grant`,
|
|
21
21
|
* not content metadata — `cell.visibility` lives as a top-level column on
|
|
22
22
|
* `CellJson` and `CellRow` (the `CellVisibility` enum is defined in
|
|
23
|
-
* `cell_action_specs.ts` next to the wire fields that use it), and is
|
|
23
|
+
* `auth/cell_action_specs.ts` next to the wire fields that use it), and is
|
|
24
24
|
* enforced by `can_view_cell` reading the column directly (no JSON dive).
|
|
25
25
|
*
|
|
26
26
|
* @module
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Loose object: arbitrary additional fields pass through unvalidated,
|
|
9
9
|
* preserving the "unknown kinds ship without RPC churn" property. Per-kind
|
|
10
10
|
* shape enforcement is opt-in via the `validate_data` deps slot — see
|
|
11
|
-
* `cell_actions.ts`.
|
|
11
|
+
* `auth/cell_actions.ts`.
|
|
12
12
|
*
|
|
13
13
|
* **Discipline**: a field joins `CellData` only when at least two
|
|
14
14
|
* consumers in different domains read it generically. `kind` (editor
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* **Visibility is not in here.** Access control is a peer of `cell_grant`,
|
|
21
21
|
* not content metadata — `cell.visibility` lives as a top-level column on
|
|
22
22
|
* `CellJson` and `CellRow` (the `CellVisibility` enum is defined in
|
|
23
|
-
* `cell_action_specs.ts` next to the wire fields that use it), and is
|
|
23
|
+
* `auth/cell_action_specs.ts` next to the wire fields that use it), and is
|
|
24
24
|
* enforced by `can_view_cell` reading the column directly (no JSON dive).
|
|
25
25
|
*
|
|
26
26
|
* @module
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Cell-field RPC handlers.
|
|
3
3
|
*
|
|
4
4
|
* Three `request_response` actions bound to the specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_field_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* - `cell_field_set` — admin / owner / editor-grant on `source` may set;
|
|
8
8
|
* `target` must be view-admitted (so a caller can't link to a cell they
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* first, then filter rows by `can_view_cell(source)`.
|
|
17
17
|
*
|
|
18
18
|
* IDOR-mask 404s on cell-miss / cell-unviewable, mirroring the existence-
|
|
19
|
-
* leak guards in `cell_actions.ts` / `cell_grant_actions.ts`.
|
|
19
|
+
* leak guards in `auth/cell_actions.ts` / `auth/cell_grant_actions.ts`.
|
|
20
20
|
*
|
|
21
21
|
* Audit events `cell_field_set` / `cell_field_delete` carry IDs only —
|
|
22
|
-
* see
|
|
22
|
+
* see `auth/cell_field_audit_metadata.ts`.
|
|
23
23
|
*
|
|
24
24
|
* @module
|
|
25
25
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Cell-field RPC handlers.
|
|
3
3
|
*
|
|
4
4
|
* Three `request_response` actions bound to the specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_field_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* - `cell_field_set` — admin / owner / editor-grant on `source` may set;
|
|
8
8
|
* `target` must be view-admitted (so a caller can't link to a cell they
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* first, then filter rows by `can_view_cell(source)`.
|
|
17
17
|
*
|
|
18
18
|
* IDOR-mask 404s on cell-miss / cell-unviewable, mirroring the existence-
|
|
19
|
-
* leak guards in `cell_actions.ts` / `cell_grant_actions.ts`.
|
|
19
|
+
* leak guards in `auth/cell_actions.ts` / `auth/cell_grant_actions.ts`.
|
|
20
20
|
*
|
|
21
21
|
* Audit events `cell_field_set` / `cell_field_delete` carry IDs only —
|
|
22
|
-
* see
|
|
22
|
+
* see `auth/cell_field_audit_metadata.ts`.
|
|
23
23
|
*
|
|
24
24
|
* @module
|
|
25
25
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Cell-grant ACL RPC handlers.
|
|
3
3
|
*
|
|
4
4
|
* Three `request_response` actions bound to specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_grant_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* Grant management is **manage-tier only** (`can_manage_cell` = admin /
|
|
8
8
|
* owner). Editor-grant holders may edit a cell's content + relations but
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
*
|
|
23
23
|
* All three 404 with `cell_not_found` on cell-miss / cell-unviewable, and
|
|
24
24
|
* with `cell_grant_not_found` on grant-miss, mirroring the existence-leak
|
|
25
|
-
* guards in `cell_actions.ts`.
|
|
25
|
+
* guards in `auth/cell_actions.ts`.
|
|
26
26
|
*
|
|
27
27
|
* Audit events `cell_grant_create` / `cell_grant_revoke` carry IDs only
|
|
28
|
-
* (no display-name snapshots); see
|
|
28
|
+
* (no display-name snapshots); see `auth/cell_grant_audit_metadata.ts`.
|
|
29
29
|
*
|
|
30
30
|
* @module
|
|
31
31
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Cell-grant ACL RPC handlers.
|
|
3
3
|
*
|
|
4
4
|
* Three `request_response` actions bound to specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_grant_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* Grant management is **manage-tier only** (`can_manage_cell` = admin /
|
|
8
8
|
* owner). Editor-grant holders may edit a cell's content + relations but
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
*
|
|
23
23
|
* All three 404 with `cell_not_found` on cell-miss / cell-unviewable, and
|
|
24
24
|
* with `cell_grant_not_found` on grant-miss, mirroring the existence-leak
|
|
25
|
-
* guards in `cell_actions.ts`.
|
|
25
|
+
* guards in `auth/cell_actions.ts`.
|
|
26
26
|
*
|
|
27
27
|
* Audit events `cell_grant_create` / `cell_grant_revoke` carry IDs only
|
|
28
|
-
* (no display-name snapshots); see
|
|
28
|
+
* (no display-name snapshots); see `auth/cell_grant_audit_metadata.ts`.
|
|
29
29
|
*
|
|
30
30
|
* @module
|
|
31
31
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Cell-item RPC handlers.
|
|
3
3
|
*
|
|
4
4
|
* Four `request_response` actions bound to the specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_item_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* - `cell_item_insert` — admin / owner / editor-grant on `parent` may
|
|
8
8
|
* insert; `child` must be view-admitted. Returns
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
* filter rows by `can_view_cell(parent)`.
|
|
20
20
|
*
|
|
21
21
|
* IDOR-mask 404s on cell-miss / cell-unviewable, mirroring the existence-
|
|
22
|
-
* leak guards in `cell_actions.ts`.
|
|
22
|
+
* leak guards in `auth/cell_actions.ts`.
|
|
23
23
|
*
|
|
24
24
|
* Audit events `cell_item_insert` / `cell_item_move` / `cell_item_delete`
|
|
25
|
-
* carry IDs only — see
|
|
25
|
+
* carry IDs only — see `auth/cell_item_audit_metadata.ts`.
|
|
26
26
|
*
|
|
27
27
|
* @module
|
|
28
28
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Cell-item RPC handlers.
|
|
3
3
|
*
|
|
4
4
|
* Four `request_response` actions bound to the specs in
|
|
5
|
-
*
|
|
5
|
+
* `auth/cell_item_action_specs.ts`:
|
|
6
6
|
*
|
|
7
7
|
* - `cell_item_insert` — admin / owner / editor-grant on `parent` may
|
|
8
8
|
* insert; `child` must be view-admitted. Returns
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
* filter rows by `can_view_cell(parent)`.
|
|
20
20
|
*
|
|
21
21
|
* IDOR-mask 404s on cell-miss / cell-unviewable, mirroring the existence-
|
|
22
|
-
* leak guards in `cell_actions.ts`.
|
|
22
|
+
* leak guards in `auth/cell_actions.ts`.
|
|
23
23
|
*
|
|
24
24
|
* Audit events `cell_item_insert` / `cell_item_move` / `cell_item_delete`
|
|
25
|
-
* carry IDs only — see
|
|
25
|
+
* carry IDs only — see `auth/cell_item_audit_metadata.ts`.
|
|
26
26
|
*
|
|
27
27
|
* @module
|
|
28
28
|
*/
|
|
@@ -32,8 +32,8 @@ import type { CellVisibility } from '../auth/cell_action_specs.js';
|
|
|
32
32
|
* written, and the wire validates `CellData` on every write.
|
|
33
33
|
*
|
|
34
34
|
* Parent↔child membership and named relations live in the `cell_item` /
|
|
35
|
-
* `cell_field` sibling tables (see `cell_item_queries.ts` /
|
|
36
|
-
* `cell_field_queries.ts`). The cell row carries identity + content only.
|
|
35
|
+
* `cell_field` sibling tables (see `db/cell_item_queries.ts` /
|
|
36
|
+
* `db/cell_field_queries.ts`). The cell row carries identity + content only.
|
|
37
37
|
*
|
|
38
38
|
* `grant_count` is a derived projection (correlated subquery against
|
|
39
39
|
* `cell_grant` keyed by `cell_id`, served by `idx_cell_grant_cell`) —
|
package/dist/db/cell_queries.js
CHANGED
|
@@ -307,7 +307,7 @@ export const query_cell_list = async (deps, params) => {
|
|
|
307
307
|
* either an actor-shaped principal (`g.actor_id = $11`) or a
|
|
308
308
|
* role-shaped principal whose `(role, scope_id)` matches a row in the
|
|
309
309
|
* `caller_role_grants` CTE. NULL `g.scope_id` matches any scope, mirroring
|
|
310
|
-
* `grant_admits` in `cell_authorize.ts`.
|
|
310
|
+
* `grant_admits` in `auth/cell_authorize.ts`.
|
|
311
311
|
*/
|
|
312
312
|
const grant_admits_caller_predicate = (g_alias) => `(
|
|
313
313
|
($11::uuid IS NOT NULL AND ${g_alias}.actor_id = $11)
|
package/dist/http/CLAUDE.md
CHANGED
|
@@ -10,7 +10,7 @@ other domains should do the same — extend, don't special-case.
|
|
|
10
10
|
|
|
11
11
|
For the design rationale behind declarative routes, DEV-only output
|
|
12
12
|
validation, the three-layer error-schema merge, and fire-and-forget
|
|
13
|
-
effects, see
|
|
13
|
+
effects, see ../../../docs/architecture.md.
|
|
14
14
|
|
|
15
15
|
## Module Map
|
|
16
16
|
|
|
@@ -134,7 +134,7 @@ are the contract with external callers.
|
|
|
134
134
|
|
|
135
135
|
Production short-circuits to the unwrapped handler — no parse work on the
|
|
136
136
|
hot path. Uniform across all three action-handler surfaces (REST, RPC,
|
|
137
|
-
WS); see
|
|
137
|
+
WS); see ../../../docs/architecture.md §DEV-only Output Validation.
|
|
138
138
|
|
|
139
139
|
### Helpers
|
|
140
140
|
|
|
@@ -297,7 +297,7 @@ pull in route types.
|
|
|
297
297
|
Resolves the real client IP from `X-Forwarded-For` only when the TCP
|
|
298
298
|
connection is from a configured trusted proxy. Without this middleware,
|
|
299
299
|
`get_client_ip(c)` returns `'unknown'`. Must run **before** auth and
|
|
300
|
-
rate-limiting middleware (see root
|
|
300
|
+
rate-limiting middleware (see root ../../../CLAUDE.md §Middleware Ordering).
|
|
301
301
|
|
|
302
302
|
Per-symbol semantics on TSDoc; the cross-cutting properties:
|
|
303
303
|
|
|
@@ -492,7 +492,7 @@ Interfaces exported for consumer use: `TableInfo`, `TableWithCount`,
|
|
|
492
492
|
|
|
493
493
|
## Cross-Module Notes
|
|
494
494
|
|
|
495
|
-
- **Middleware ordering** is assembled by `create_app_server` — see the root
|
|
495
|
+
- **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
|
|
496
496
|
- **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`
|
|
497
497
|
- **Input/output schemas align with SAES.** When wiring RPC via `actions/action_rpc.ts` or bridging to `RouteSpec` via `actions/action_bridge.ts`, the same Zod types flow through unchanged (see `actions/CLAUDE.md` §Single JSON-RPC 2.0 endpoint and §HTTP bridge)
|
|
498
498
|
- **Error modules are complementary, not redundant.** `http/error_schemas.ts` is Zod-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
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* The same shape governs both `ActionSpec.auth` (in `actions/action_spec.ts`)
|
|
16
16
|
* and `RouteSpec.auth` (in `http/route_spec.ts`). The canonical schema
|
|
17
17
|
* lives here in `http/` because that preserves the existing
|
|
18
|
-
* `actions → http` dependency direction (and `error_schemas.ts` /
|
|
19
|
-
* `surface.ts` consume the type).
|
|
18
|
+
* `actions → http` dependency direction (and `http/error_schemas.ts` /
|
|
19
|
+
* `http/surface.ts` consume the type).
|
|
20
20
|
*
|
|
21
21
|
* Registry-time invariants 1, 3, and 4 live on the schema's
|
|
22
22
|
* `.superRefine` so any spec that fails them throws at the Zod parse
|
package/dist/http/auth_shape.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* The same shape governs both `ActionSpec.auth` (in `actions/action_spec.ts`)
|
|
16
16
|
* and `RouteSpec.auth` (in `http/route_spec.ts`). The canonical schema
|
|
17
17
|
* lives here in `http/` because that preserves the existing
|
|
18
|
-
* `actions → http` dependency direction (and `error_schemas.ts` /
|
|
19
|
-
* `surface.ts` consume the type).
|
|
18
|
+
* `actions → http` dependency direction (and `http/error_schemas.ts` /
|
|
19
|
+
* `http/surface.ts` consume the type).
|
|
20
20
|
*
|
|
21
21
|
* Registry-time invariants 1, 3, and 4 live on the schema's
|
|
22
22
|
* `.superRefine` so any spec that fails them throws at the Zod parse
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* set — brackets, whitespace, control bytes, letters g–z — disqualifies
|
|
42
42
|
* the input from parsing.
|
|
43
43
|
*
|
|
44
|
-
* Same regex `proxy.ts`'s `validate_ip_strict` uses; exported here so
|
|
44
|
+
* Same regex `http/proxy.ts`'s `validate_ip_strict` uses; exported here so
|
|
45
45
|
* both modules can share one source of truth.
|
|
46
46
|
*/
|
|
47
47
|
export declare const IP_LITERAL_CHARS: RegExp;
|
|
@@ -42,7 +42,7 @@ import { convertIPv6ToBinary, distinctRemoteAddr } from 'hono/utils/ipaddr';
|
|
|
42
42
|
* set — brackets, whitespace, control bytes, letters g–z — disqualifies
|
|
43
43
|
* the input from parsing.
|
|
44
44
|
*
|
|
45
|
-
* Same regex `proxy.ts`'s `validate_ip_strict` uses; exported here so
|
|
45
|
+
* Same regex `http/proxy.ts`'s `validate_ip_strict` uses; exported here so
|
|
46
46
|
* both modules can share one source of truth.
|
|
47
47
|
*/
|
|
48
48
|
export const IP_LITERAL_CHARS = /^[0-9a-fA-F.:]+$/;
|
package/dist/http/proxy.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { MiddlewareSpec } from './middleware_spec.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* Normalize an IP address for consistent matching and storage.
|
|
15
15
|
*
|
|
16
|
-
* Delegates to `canonicalize_ip` from `ip_canonical.ts` — collapses
|
|
16
|
+
* Delegates to `canonicalize_ip` from `http/ip_canonical.ts` — collapses
|
|
17
17
|
* RFC 5952-equivalent IPv6 forms (`::1`, `::0001`, `0:0:0:0:0:0:0:1`)
|
|
18
18
|
* into a single key, emits IPv4-mapped IPv6 in dotted form, and
|
|
19
19
|
* strips the `::ffff:` prefix from dotted IPv4-mapped values so the
|
package/dist/http/proxy.js
CHANGED
|
@@ -12,7 +12,7 @@ import { canonicalize_ip, IP_LITERAL_CHARS } from './ip_canonical.js';
|
|
|
12
12
|
/**
|
|
13
13
|
* Normalize an IP address for consistent matching and storage.
|
|
14
14
|
*
|
|
15
|
-
* Delegates to `canonicalize_ip` from `ip_canonical.ts` — collapses
|
|
15
|
+
* Delegates to `canonicalize_ip` from `http/ip_canonical.ts` — collapses
|
|
16
16
|
* RFC 5952-equivalent IPv6 forms (`::1`, `::0001`, `0:0:0:0:0:0:0:1`)
|
|
17
17
|
* into a single key, emits IPv4-mapped IPv6 in dotted form, and
|
|
18
18
|
* strips the `::ffff:` prefix from dotted IPv4-mapped values so the
|
|
@@ -83,7 +83,7 @@ export interface RouteContext {
|
|
|
83
83
|
pending_effects: Array<Promise<void>>;
|
|
84
84
|
/**
|
|
85
85
|
* Deferred post-commit thunks — do not push directly; reach for
|
|
86
|
-
* `emit_after_commit(ctx, fn)` from `pending_effects.ts`. The flush
|
|
86
|
+
* `emit_after_commit(ctx, fn)` from `http/pending_effects.ts`. The flush
|
|
87
87
|
* middleware invokes each thunk after the handler (and any wrapping
|
|
88
88
|
* `db.transaction`) returns, closing the microtask-ordering window
|
|
89
89
|
* that an eager `Promise.resolve().then(fn)` leaves open inside the
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Lives in its own module — separate from `server/app_server.ts` — so it can
|
|
5
5
|
* be consumed as a **pure type** without dragging in the server-assembly
|
|
6
|
-
* machinery. `app_server.ts` value-imports `hono` (it builds the `Hono` app),
|
|
6
|
+
* machinery. `server/app_server.ts` value-imports `hono` (it builds the `Hono` app),
|
|
7
7
|
* so importing anything from it forces `hono` to be installed. Contract-only
|
|
8
8
|
* consumers — cross-process test surfaces, Rust-backed servers that reuse the
|
|
9
9
|
* route/RPC spec factories without running the TS server — need
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Lives in its own module — separate from `server/app_server.ts` — so it can
|
|
5
5
|
* be consumed as a **pure type** without dragging in the server-assembly
|
|
6
|
-
* machinery. `app_server.ts` value-imports `hono` (it builds the `Hono` app),
|
|
6
|
+
* machinery. `server/app_server.ts` value-imports `hono` (it builds the `Hono` app),
|
|
7
7
|
* so importing anything from it forces `hono` to be installed. Contract-only
|
|
8
8
|
* consumers — cross-process test surfaces, Rust-backed servers that reuse the
|
|
9
9
|
* route/RPC spec factories without running the TS server — need
|