@fuzdev/fuz_app 0.166.0 → 0.168.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 +10 -9
- 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_dispatcher.d.ts +1 -1
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +1 -1
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +1 -1
- package/dist/actions/action_event_data.d.ts +260 -65
- package/dist/actions/action_event_data.d.ts.map +1 -1
- package/dist/actions/action_event_data.js +11 -11
- package/dist/actions/action_event_types.d.ts +5 -14
- package/dist/actions/action_event_types.d.ts.map +1 -1
- package/dist/actions/action_event_types.js +3 -3
- package/dist/actions/action_rpc.js +5 -5
- package/dist/actions/action_spec.d.ts +8 -26
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +4 -4
- package/dist/actions/broadcast_api.d.ts +1 -1
- package/dist/actions/broadcast_api.js +1 -1
- package/dist/actions/cancel.d.ts +17 -9
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +3 -3
- package/dist/actions/heartbeat.d.ts +3 -4
- package/dist/actions/heartbeat.d.ts.map +1 -1
- package/dist/actions/heartbeat.js +4 -4
- package/dist/actions/peer_ping.d.ts +63 -23
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +20 -19
- package/dist/actions/peer_request.d.ts +6 -3
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +8 -2
- package/dist/actions/perform_action.d.ts +1 -1
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/transports.d.ts +2 -3
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +0 -4
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +4 -3
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +6 -5
- package/dist/auth/CLAUDE.md +10 -8
- 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/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 +9 -8
- package/dist/http/jsonrpc.d.ts +231 -152
- package/dist/http/jsonrpc.d.ts.map +1 -1
- package/dist/http/jsonrpc.js +55 -85
- package/dist/http/jsonrpc_errors.d.ts +22 -4
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +37 -4
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +13 -12
- package/dist/testing/CLAUDE.md +6 -3
- 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/peer_ping_ws.d.ts +3 -2
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +49 -2
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +13 -14
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +11 -11
- package/dist/testing/transports/ws_client.js +1 -1
- package/dist/ui/SurfaceExplorer.svelte +2 -2
- package/package.json +2 -2
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*
|
|
35
35
|
* @module
|
|
36
36
|
*/
|
|
37
|
-
import {
|
|
37
|
+
import { min_value, number, object, optional, parse, pipe, safe_integer, with_default } from '@fuzdev/fuz_schema/schema.ts';
|
|
38
38
|
import { ThrownJsonrpcError, JSONRPC_ERROR_CODES } from '../http/jsonrpc_errors.js';
|
|
39
39
|
import { safe_parse_dropping_unknown_keys } from '../http/schema_helpers.js';
|
|
40
40
|
import { DEFAULT_PEER_REQUEST_TIMEOUT } from './peer_request.js';
|
|
@@ -66,26 +66,27 @@ export const REASON_PEER_PING_NONCE_MISMATCH = 'peer_ping_nonce_mismatch';
|
|
|
66
66
|
* (mirrors the Rust `PingActionInput`): `nonce` defaults to a server-issued
|
|
67
67
|
* value, `timeout_ms` to `DEFAULT_PEER_REQUEST_TIMEOUT` (clamped shorten-only).
|
|
68
68
|
*/
|
|
69
|
-
export const PingActionInput =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
export const PingActionInput = with_default(object({
|
|
70
|
+
nonce: optional(pipe(number, safe_integer)),
|
|
71
|
+
timeout_ms: optional(pipe(number, safe_integer, min_value(1)))
|
|
72
|
+
}),
|
|
73
|
+
// the default reads an omitted input (`undefined`) as `{}`: both fields are
|
|
74
|
+
// optional, so an empty invocation is valid (server-issued nonce, default
|
|
75
|
+
// timeout). The server reads absent `params` as `{}` before the schema; the
|
|
76
|
+
// client's pre-send parse of `app.api['peer/ping']()` reaches the default.
|
|
77
|
+
// One shared `{}`, which nothing writes to
|
|
78
|
+
{});
|
|
78
79
|
/** Params of the server→client `peer/ping` request frame. Twin of the Rust `PingRequest`. */
|
|
79
|
-
export const PingRequestParams =
|
|
80
|
-
nonce:
|
|
80
|
+
export const PingRequestParams = object({
|
|
81
|
+
nonce: pipe(number, safe_integer)
|
|
81
82
|
});
|
|
82
83
|
/**
|
|
83
84
|
* The client's reply shape — also the action's output (the handler returns the
|
|
84
85
|
* validated echo). Twin of the Rust `PingResponse`.
|
|
85
86
|
*/
|
|
86
|
-
export const PingResponse =
|
|
87
|
-
nonce:
|
|
88
|
-
protocol_version:
|
|
87
|
+
export const PingResponse = object({
|
|
88
|
+
nonce: pipe(number, safe_integer),
|
|
89
|
+
protocol_version: pipe(number, safe_integer)
|
|
89
90
|
});
|
|
90
91
|
/**
|
|
91
92
|
* `ActionSpec` for the shared `peer/ping`. `initiator: 'both'` (the
|
|
@@ -127,8 +128,8 @@ const peer_request_error_to_jsonrpc = (error) => {
|
|
|
127
128
|
case 'too_many_in_flight':
|
|
128
129
|
return new ThrownJsonrpcError(JSONRPC_ERROR_CODES.queue_overflow, 'too many in-flight peer requests', { reason: REASON_PEER_TOO_MANY_IN_FLIGHT });
|
|
129
130
|
case 'client_error':
|
|
130
|
-
//
|
|
131
|
-
//
|
|
131
|
+
// the client's error, already read to a base-set code and a string
|
|
132
|
+
// message (`parse_inbound_jsonrpc_error`), reaches the caller as is
|
|
132
133
|
return new ThrownJsonrpcError(error.error.code, error.error.message, error.error.data);
|
|
133
134
|
}
|
|
134
135
|
};
|
|
@@ -179,8 +180,8 @@ export const peer_ping_handler = async (input, ctx) => {
|
|
|
179
180
|
* @returns the `PingResponse` echo to send back as the reply's `result`
|
|
180
181
|
*/
|
|
181
182
|
export const peer_ping_responder = (params) => {
|
|
182
|
-
const parsed = PingRequestParams
|
|
183
|
-
return { nonce: parsed.
|
|
183
|
+
const parsed = parse(PingRequestParams, params);
|
|
184
|
+
return { nonce: parsed.ok ? parsed.value.nonce : 0, protocol_version: PEER_PROTOCOL_VERSION };
|
|
184
185
|
};
|
|
185
186
|
/**
|
|
186
187
|
* Protocol-action tuple — spread into the server's `actions` array (via
|
|
@@ -36,8 +36,9 @@ export declare const DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION = 256;
|
|
|
36
36
|
* - `connection_gone` — the socket closed (or was never registered) before a reply.
|
|
37
37
|
* - `too_many_in_flight` — the per-connection in-flight cap was hit.
|
|
38
38
|
* - `client_error` — the client answered with a JSON-RPC error; `error` is
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* its envelope read by `parse_inbound_jsonrpc_error` (a base-set code, a
|
|
40
|
+
* string message, its `data` as sent), so the initiating handler can surface
|
|
41
|
+
* the client's own message and data.
|
|
41
42
|
*/
|
|
42
43
|
export type PeerRequestError = {
|
|
43
44
|
kind: 'timeout';
|
|
@@ -113,7 +114,9 @@ export declare class PendingPeerRequests {
|
|
|
113
114
|
/**
|
|
114
115
|
* Settle the pending request matching an inbound reply. A success response
|
|
115
116
|
* resolves `{ok: true, value: result}`; an error response resolves
|
|
116
|
-
* `{ok: false, error: {kind: 'client_error', error}}`
|
|
117
|
+
* `{ok: false, error: {kind: 'client_error', error}}`, its `error` read by
|
|
118
|
+
* `parse_inbound_jsonrpc_error`, as the Rust twin reads it — the reply is
|
|
119
|
+
* remote-authored and unvalidated.
|
|
117
120
|
*
|
|
118
121
|
* Returns `false` when no entry matches — an unsolicited, cross-connection,
|
|
119
122
|
* or already-settled reply — so the caller drops it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer_request.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/peer_request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EACX,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"peer_request.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/peer_request.ts"],"names":[],"mappings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BAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,mBAAmB;;gBAUnB,OAAO,CAAC,EAAE,0BAA0B;IAMhD;;;;;;;;;OASG;IACH,QAAQ,CACP,aAAa,EAAE,IAAI,EACnB,UAAU,CAAC,EAAE,MAAM,GACjB;QAAE,EAAE,EAAE,gBAAgB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;KAAE,GAAG,IAAI;IAkBxE;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,GAAG,oBAAoB,GAAG,OAAO;IAcvF;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAUpF;;;;;OAKG;IACH,KAAK,CAAC,aAAa,EAAE,IAAI,GAAG,IAAI;IAUhC;;;OAGG;IACH,IAAI,CAAC,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM;CAMlC;AAKD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,6BAA6B,GACzC,KAAK,MAAM,EACX,eAAe,IAAI,EACnB,IAAI,gBAAgB,GAAG,IAAI,KACzB,IAQF,CAAC"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
17
|
import { is_jsonrpc_error_response } from '../http/jsonrpc_helpers.js';
|
|
18
|
+
import { parse_inbound_jsonrpc_error } from '../http/jsonrpc_errors.js';
|
|
18
19
|
/**
|
|
19
20
|
* Default deadline (ms) for a server→client peer request before it resolves
|
|
20
21
|
* `timeout`. Twin of the Rust spine's `DEFAULT_PEER_REQUEST_TIMEOUT`.
|
|
@@ -79,7 +80,9 @@ export class PendingPeerRequests {
|
|
|
79
80
|
/**
|
|
80
81
|
* Settle the pending request matching an inbound reply. A success response
|
|
81
82
|
* resolves `{ok: true, value: result}`; an error response resolves
|
|
82
|
-
* `{ok: false, error: {kind: 'client_error', error}}`
|
|
83
|
+
* `{ok: false, error: {kind: 'client_error', error}}`, its `error` read by
|
|
84
|
+
* `parse_inbound_jsonrpc_error`, as the Rust twin reads it — the reply is
|
|
85
|
+
* remote-authored and unvalidated.
|
|
83
86
|
*
|
|
84
87
|
* Returns `false` when no entry matches — an unsolicited, cross-connection,
|
|
85
88
|
* or already-settled reply — so the caller drops it.
|
|
@@ -94,7 +97,10 @@ export class PendingPeerRequests {
|
|
|
94
97
|
if (!this.#pending.get(connection_id)?.has(id))
|
|
95
98
|
return false;
|
|
96
99
|
const outcome = is_jsonrpc_error_response(response)
|
|
97
|
-
? {
|
|
100
|
+
? {
|
|
101
|
+
ok: false,
|
|
102
|
+
error: { kind: 'client_error', error: parse_inbound_jsonrpc_error(response.error) }
|
|
103
|
+
}
|
|
98
104
|
: { ok: true, value: response.result };
|
|
99
105
|
this.settle(connection_id, id, outcome);
|
|
100
106
|
return true;
|
|
@@ -77,7 +77,7 @@ import type { RequestClient } from './peer_request.js';
|
|
|
77
77
|
export interface PerformActionInput {
|
|
78
78
|
/** The resolved spec + handler (transport does method lookup). */
|
|
79
79
|
action: RpcAction;
|
|
80
|
-
/** Raw params from the wire envelope (
|
|
80
|
+
/** Raw params from the wire envelope (validated by `JsonrpcRequest`, pre-`parse_any(spec.input, …)`). */
|
|
81
81
|
raw_params: unknown;
|
|
82
82
|
/** JSON-RPC request id — echoed onto the response. */
|
|
83
83
|
request_id: JsonrpcRequestId;
|
|
@@ -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,E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AW,GAAG,IAAI,CAAC;CAChD;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC9B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAC1B,OAAO,kBAAkB,EACzB,MAAM,iBAAiB,KACrB,OAAO,CAAC,mBAAmB,CAuL7B,CAAC;AA8BF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GACnC,OAAO,gBAAgB,EACvB,QAAQ,aAAa,CAAC,QAAQ,CAAC,EAC/B,QAAQ,OAAO,KACb,kBAOF,CAAC;AA6DF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,GAC1C,2BAA2B,aAAa,CAAC,MAAM,CAAC,KAC9C,kBAIA,CAAC;AAqEJ,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,gBAAgB,EACpB,QAAQ,mBAAmB,EAC3B,QAAQ,MAAM,EACd,KAAK,MAAM,KACT,sBAkBF,CAAC"}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import { z } from 'zod';
|
|
10
9
|
import type { JsonrpcMessageFromClientToServer, JsonrpcMessageFromServerToClient, JsonrpcNotification, JsonrpcRequest, JsonrpcResponseOrError, JsonrpcErrorResponse } from '../http/jsonrpc.js';
|
|
11
10
|
/**
|
|
12
11
|
* WebSocket close code for session revocation — and for a credential that
|
|
@@ -199,8 +198,8 @@ export declare const utf8_length_over: (text: string, max_bytes: number) => numb
|
|
|
199
198
|
* @returns its length in UTF-8 bytes
|
|
200
199
|
*/
|
|
201
200
|
export declare const utf8_length: (text: string) => number;
|
|
202
|
-
|
|
203
|
-
export type TransportName =
|
|
201
|
+
/** A transport's name — not branded, for convenience: an unknown one fails at runtime. */
|
|
202
|
+
export type TransportName = string;
|
|
204
203
|
/**
|
|
205
204
|
* Per-call options accepted by every transport's `send`. Optional and
|
|
206
205
|
* extensible — adding a field is non-breaking. Source of truth for the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"transports.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACX,gCAAgC,EAChC,gCAAgC,EAChC,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,oBAAoB,CAAC;AACjE;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,uBAAuB,CAAC;AACvE,sEAAsE;AACtE,eAAO,MAAM,iCAAiC,OAAO,CAAC;AACtD;;;;GAIG;AACH,eAAO,MAAM,wCAAwC,6BAA6B,CAAC;AACnF,yEAAyE;AACzE,eAAO,MAAM,iCAAiC,OAAO,CAAC;AACtD;;;GAGG;AACH,eAAO,MAAM,wCAAwC,6BAA6B,CAAC;AACnF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C;;;GAGG;AACH,eAAO,MAAM,gCAAgC,qBAAqB,CAAC;AACnE;;;;;;;;;;;;;;;;GAgBG;A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AC;CAChB;AAED,MAAM,WAAW,SAAS;IACzB,cAAc,EAAE,aAAa,CAAC;IAE9B,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/F,IAAI,CACH,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IACxC,IAAI,CACH,OAAO,EAAE,gCAAgC,EACzC,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAAC;IACpD,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,UAAU;;IAItB;;;;;OAKG;IACH,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAQ9C;;;;;;;;;OASG;IACH,aAAa,CAAC,cAAc,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;CAa9F"}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import { z } from 'zod';
|
|
10
9
|
/**
|
|
11
10
|
* WebSocket close code for session revocation — and for a credential that
|
|
12
11
|
* expired while the socket was open (`WS_CLOSE_CREDENTIAL_EXPIRED_REASON`).
|
|
@@ -204,9 +203,6 @@ export const utf8_length_over = (text, max_bytes) => {
|
|
|
204
203
|
* @returns its length in UTF-8 bytes
|
|
205
204
|
*/
|
|
206
205
|
export const utf8_length = (text) => text_encoder.encode(text).byteLength;
|
|
207
|
-
// TODO figure out the symmetry of frontend and backend transports (none/partial/full?) --
|
|
208
|
-
// we may also need orthogonal abstractions to clarify the transport role
|
|
209
|
-
export const TransportName = z.string(); // not branded for convenience, will just error at runtime, the schema is just for docs atm
|
|
210
206
|
/**
|
|
211
207
|
* The transports a peer sends through, by name. The first registered is the
|
|
212
208
|
* default a call that names none prefers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports_http.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports_http.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"transports_http.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports_http.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH,OAAO,EACN,oBAAoB,EAGpB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,KAAK,sBAAsB,EAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASxD;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,2CAA2C;AAC3C,MAAM,WAAW,4BAA4B;IAC5C,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;;;OASG;IACH,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IACpE;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,qBAAsB,YAAW,SAAS;;IACtD,QAAQ,CAAC,cAAc,EAAG,mBAAmB,CAAU;gBAU3C,OAAO,EAAE,4BAA4B;IAgD3C,IAAI,CACT,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,sBAAsB,CAAC;IAC5B,IAAI,CACT,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA4EvC,QAAQ,IAAI,OAAO;CAGnB"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
import { DEV } from 'esm-env';
|
|
8
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
8
9
|
import { to_thrown_jsonrpc_error, jsonrpc_error_messages, http_status_to_jsonrpc_error_code, jsonrpc_error_code_to_http_status, UNKNOWN_ERROR_MESSAGE } from '../http/jsonrpc_errors.js';
|
|
9
10
|
import { create_jsonrpc_error_response, to_jsonrpc_message_id, is_jsonrpc_error_response, is_jsonrpc_response } from '../http/jsonrpc_helpers.js';
|
|
10
11
|
import { JsonrpcErrorResponse } from '../http/jsonrpc.js';
|
|
@@ -172,10 +173,10 @@ const read_json_body = async (response) => {
|
|
|
172
173
|
* so a numeric id comes back as its string form.
|
|
173
174
|
*/
|
|
174
175
|
const to_error_response_for = (body, id) => {
|
|
175
|
-
const parsed = JsonrpcErrorResponse
|
|
176
|
-
if (!parsed.
|
|
176
|
+
const parsed = parse(JsonrpcErrorResponse, body);
|
|
177
|
+
if (!parsed.ok)
|
|
177
178
|
return null;
|
|
178
|
-
const response = parsed.
|
|
179
|
+
const response = parsed.value;
|
|
179
180
|
if (response.id !== null && String(response.id) !== String(id))
|
|
180
181
|
return null;
|
|
181
182
|
return response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;G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AAE,CAAC,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACjF,iEAAiE;IACjE,sBAAsB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,2EAA2E;IAC3E,2BAA2B,EAAE,WAAW,GAAG,IAAI,CAAC;IAChD,6FAA6F;IAC7F,eAAe,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACrF,+EAA+E;IAC/E,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;CACxC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,mGAAmG;IACnG,cAAc,EAAE;QAAE,eAAe,EAAE,cAAc,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC;IACvE;;;;OAIG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB,gGAAgG;IAChG,eAAe,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,UAAU,gBAAgB,EAC1B,SAAS,eAAe,KACtB,QA6oBF,CAAC"}
|
|
@@ -108,6 +108,7 @@
|
|
|
108
108
|
* @module
|
|
109
109
|
*/
|
|
110
110
|
import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
|
|
111
|
+
import { parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
111
112
|
import { recheck_admission, resolved_auth_api_token_id, resolved_auth_session_hash } from '../auth/resolved_auth.js';
|
|
112
113
|
import { schedule_credential_deadline } from '../auth/credential_deadline.js';
|
|
113
114
|
import { flush_request_effects } from '../http/pending_effects.js';
|
|
@@ -538,17 +539,17 @@ export const create_ws_socket_events = (endpoint, upgrade) => {
|
|
|
538
539
|
// notification handlers are not a feature yet). Notifications
|
|
539
540
|
// stay unvalidated — they carry no id to answer an error on.
|
|
540
541
|
if (classified.method === cancel_action_spec.method) {
|
|
541
|
-
const parsed = CancelNotificationParams
|
|
542
|
-
if (!parsed.
|
|
543
|
-
log.debug('cancel: invalid params, ignoring', parsed.
|
|
542
|
+
const parsed = parse(CancelNotificationParams, classified.params);
|
|
543
|
+
if (!parsed.ok) {
|
|
544
|
+
log.debug('cancel: invalid params, ignoring', parsed.issues);
|
|
544
545
|
return;
|
|
545
546
|
}
|
|
546
|
-
const controller = pending_controllers.get(parsed.
|
|
547
|
+
const controller = pending_controllers.get(parsed.value.request_id);
|
|
547
548
|
if (controller) {
|
|
548
549
|
controller.abort();
|
|
549
550
|
}
|
|
550
551
|
else {
|
|
551
|
-
log.debug('cancel: no pending request for id', parsed.
|
|
552
|
+
log.debug('cancel: no pending request for id', parsed.value.request_id);
|
|
552
553
|
}
|
|
553
554
|
}
|
|
554
555
|
return;
|
package/dist/auth/CLAUDE.md
CHANGED
|
@@ -271,15 +271,16 @@ Generic-only — no app vocabulary on the wire; per-kind shape is the
|
|
|
271
271
|
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
|
|