@fuzdev/fuz_app 0.52.0 → 0.54.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 +29 -9
- package/dist/actions/action_codegen.d.ts +10 -35
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +13 -42
- package/dist/actions/action_peer.d.ts.map +1 -1
- package/dist/actions/action_peer.js +0 -9
- package/dist/actions/action_registry.d.ts +0 -4
- package/dist/actions/action_registry.d.ts.map +1 -1
- package/dist/actions/action_registry.js +4 -10
- package/dist/actions/action_rpc.d.ts +16 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +41 -20
- package/dist/actions/action_spec.d.ts +54 -5
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +21 -5
- package/dist/actions/frontend_rpc_client.d.ts +1 -9
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +1 -9
- package/dist/actions/register_action_ws.d.ts +16 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +41 -1
- package/dist/actions/request_tracker.svelte.d.ts +10 -15
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +10 -15
- package/dist/actions/rpc_client.d.ts +0 -1
- package/dist/actions/rpc_client.d.ts.map +1 -1
- package/dist/actions/rpc_client.js +3 -17
- package/dist/actions/socket.svelte.d.ts +0 -1
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +0 -1
- package/dist/actions/transports.d.ts +4 -3
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +4 -13
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -2
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +0 -9
- package/dist/auth/CLAUDE.md +43 -19
- package/dist/auth/account_queries.d.ts +0 -3
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +0 -3
- package/dist/auth/admin_action_specs.d.ts +5 -0
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +5 -0
- package/dist/auth/api_token_queries.d.ts +0 -1
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +0 -1
- package/dist/auth/audit_log_queries.d.ts +0 -1
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +0 -1
- package/dist/auth/audit_log_routes.d.ts +2 -2
- package/dist/auth/audit_log_routes.js +2 -2
- package/dist/auth/invite_queries.d.ts +0 -1
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +0 -1
- package/dist/auth/permit_offer_action_specs.d.ts +1 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +1 -0
- package/dist/auth/permit_offer_actions.d.ts.map +1 -1
- package/dist/auth/permit_offer_actions.js +9 -6
- package/dist/auth/permit_offer_queries.d.ts +0 -1
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +0 -1
- package/dist/auth/permit_queries.d.ts +0 -1
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +0 -1
- package/dist/auth/request_context.d.ts +47 -2
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +57 -2
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +14 -11
- package/dist/auth/session_lifecycle.d.ts +0 -1
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +0 -1
- package/dist/auth/session_middleware.d.ts +0 -4
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +0 -4
- package/dist/cli/config.d.ts +0 -3
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +0 -3
- package/dist/cli/daemon.d.ts +1 -1
- package/dist/cli/daemon.js +1 -1
- package/dist/db/create_db.d.ts +0 -1
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +0 -1
- package/dist/db/db.d.ts +0 -4
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +0 -4
- package/dist/db/db_pg.d.ts +2 -2
- package/dist/db/db_pg.js +2 -2
- package/dist/db/db_pglite.d.ts +1 -2
- package/dist/db/db_pglite.d.ts.map +1 -1
- package/dist/db/db_pglite.js +1 -2
- package/dist/db/migrate.d.ts +0 -1
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +0 -1
- package/dist/dev/setup.d.ts +0 -3
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +0 -3
- package/dist/env/load.d.ts +0 -2
- package/dist/env/load.d.ts.map +1 -1
- package/dist/env/load.js +0 -2
- package/dist/hono_context.d.ts +2 -5
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +2 -5
- package/dist/http/common_routes.d.ts +0 -8
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +0 -8
- package/dist/http/db_routes.d.ts +0 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +0 -3
- package/dist/http/error_schemas.d.ts +12 -11
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +11 -7
- package/dist/http/jsonrpc_errors.d.ts +0 -6
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +0 -6
- package/dist/http/origin.d.ts +6 -13
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +7 -14
- package/dist/http/proxy.d.ts +1 -7
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +1 -7
- package/dist/http/route_spec.d.ts +13 -35
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +10 -22
- package/dist/http/schema_helpers.d.ts +0 -4
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +0 -4
- package/dist/http/surface.d.ts +2 -12
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +1 -12
- package/dist/rate_limiter.d.ts +16 -0
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +26 -0
- package/dist/realtime/sse.d.ts +0 -1
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +0 -1
- package/dist/realtime/subscriber_registry.d.ts +0 -3
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +0 -3
- package/dist/runtime/fs.d.ts +1 -4
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +1 -4
- package/dist/runtime/mock.d.ts +0 -3
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +0 -3
- package/dist/server/app_server.d.ts +27 -5
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +19 -7
- package/dist/server/startup.d.ts +0 -2
- package/dist/server/startup.d.ts.map +1 -1
- package/dist/server/startup.js +0 -2
- package/dist/server/static.d.ts +0 -1
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +0 -1
- package/dist/server/validate_nginx.d.ts +0 -3
- package/dist/server/validate_nginx.d.ts.map +1 -1
- package/dist/server/validate_nginx.js +0 -3
- package/dist/testing/CLAUDE.md +1 -1
- package/dist/testing/admin_integration.d.ts +0 -1
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +3 -6
- package/dist/testing/adversarial_404.d.ts +0 -2
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +0 -2
- package/dist/testing/adversarial_headers.d.ts +0 -1
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +0 -1
- package/dist/testing/adversarial_input.d.ts +0 -2
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +0 -2
- package/dist/testing/app_server.d.ts +22 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +2 -4
- package/dist/testing/assertions.d.ts +0 -4
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +0 -4
- package/dist/testing/attack_surface.d.ts +0 -4
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +0 -4
- package/dist/testing/audit_completeness.d.ts +0 -1
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +0 -1
- package/dist/testing/auth_apps.d.ts +2 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -10
- package/dist/testing/data_exposure.d.ts +0 -11
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +0 -11
- package/dist/testing/db.d.ts +0 -6
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +0 -6
- package/dist/testing/error_coverage.d.ts +0 -14
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +0 -14
- package/dist/testing/integration.d.ts +0 -1
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +0 -1
- package/dist/testing/integration_helpers.d.ts +1 -36
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +1 -43
- package/dist/testing/middleware.d.ts +0 -10
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +0 -10
- package/dist/testing/mock_fs.d.ts +0 -2
- package/dist/testing/mock_fs.d.ts.map +1 -1
- package/dist/testing/mock_fs.js +0 -2
- package/dist/testing/rate_limiting.d.ts +0 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +0 -1
- package/dist/testing/round_trip.d.ts +0 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +0 -2
- package/dist/testing/rpc_attack_surface.d.ts +0 -2
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +0 -2
- package/dist/testing/rpc_helpers.d.ts +0 -6
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +0 -6
- package/dist/testing/rpc_round_trip.d.ts +0 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +0 -2
- package/dist/testing/schema_generators.d.ts +0 -3
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +29 -3
- package/dist/testing/sse_round_trip.d.ts +0 -1
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +0 -1
- package/dist/testing/standard.d.ts +0 -2
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +0 -2
- package/dist/testing/stubs.d.ts +3 -5
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +5 -5
- package/dist/testing/surface_invariants.d.ts +0 -3
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +0 -3
- package/dist/ui/CLAUDE.md +1 -1
- package/dist/ui/audit_log_state.svelte.js +1 -1
- package/dist/ui/position_helpers.d.ts +0 -3
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +0 -3
- package/dist/ui/sidebar_state.svelte.d.ts +1 -2
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +1 -2
- package/dist/ui/ui_fetch.d.ts +1 -7
- package/dist/ui/ui_fetch.d.ts.map +1 -1
- package/dist/ui/ui_fetch.js +1 -7
- package/dist/ui/ui_format.d.ts +2 -14
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +2 -14
- package/package.json +2 -2
|
@@ -8,11 +8,6 @@
|
|
|
8
8
|
* @see `actions/action_rpc.ts` for the JSON-RPC dispatcher
|
|
9
9
|
* @see `actions/register_action_ws.ts` for the WebSocket dispatcher
|
|
10
10
|
*
|
|
11
|
-
* TODO @action-system-review The action system (action_spec, action_registry,
|
|
12
|
-
* action_codegen, action_bridge) will evolve significantly as RPC patterns settle.
|
|
13
|
-
* Current state: bridge is stable, registry and codegen are partially stub API.
|
|
14
|
-
* Search for `@action-system-review` across the actions/ and routes/ modules.
|
|
15
|
-
*
|
|
16
11
|
* @module
|
|
17
12
|
*/
|
|
18
13
|
import { z } from 'zod';
|
|
@@ -72,6 +67,30 @@ export declare const ActionSpec: z.ZodObject<{
|
|
|
72
67
|
* transport errors leave it unset.
|
|
73
68
|
*/
|
|
74
69
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
70
|
+
/**
|
|
71
|
+
* Rate limit key the RPC dispatcher consults for this action. Optional —
|
|
72
|
+
* actions without it skip the rate-limit hook entirely.
|
|
73
|
+
*
|
|
74
|
+
* - `'ip'` — keyed on the resolved client IP (`get_client_ip(c)`).
|
|
75
|
+
* - `'account'` — keyed on the post-auth actor id (`request_context.actor.id`).
|
|
76
|
+
* Registration-time error if paired with `auth: 'public'` (no actor).
|
|
77
|
+
* - `'both'` — both checks run; either can block.
|
|
78
|
+
*
|
|
79
|
+
* Throttle-requests semantics — every invocation records, regardless of
|
|
80
|
+
* outcome (different from REST login's throttle-failures, which resets
|
|
81
|
+
* on success). Suits admin mutation oracles (`invite_create` account-
|
|
82
|
+
* existence probe) where the *successful* invocation is the threat.
|
|
83
|
+
*
|
|
84
|
+
* Today only `RequestResponseActionSpec` is consulted by the RPC
|
|
85
|
+
* dispatcher. The field is on the base for shape symmetry with
|
|
86
|
+
* `streams` and `error_reasons`; remote_notification / local_call
|
|
87
|
+
* dispatchers don't read it.
|
|
88
|
+
*/
|
|
89
|
+
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
account: "account";
|
|
91
|
+
ip: "ip";
|
|
92
|
+
both: "both";
|
|
93
|
+
}>>;
|
|
75
94
|
}, z.core.$strict>;
|
|
76
95
|
export type ActionSpec = z.infer<typeof ActionSpec>;
|
|
77
96
|
export declare const RequestResponseActionSpec: z.ZodObject<{
|
|
@@ -87,6 +106,11 @@ export declare const RequestResponseActionSpec: z.ZodObject<{
|
|
|
87
106
|
description: z.ZodString;
|
|
88
107
|
streams: z.ZodOptional<z.ZodString>;
|
|
89
108
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
109
|
+
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
110
|
+
account: "account";
|
|
111
|
+
ip: "ip";
|
|
112
|
+
both: "both";
|
|
113
|
+
}>>;
|
|
90
114
|
kind: z.ZodDefault<z.ZodLiteral<"request_response">>;
|
|
91
115
|
auth: z.ZodUnion<readonly [z.ZodLiteral<"public">, z.ZodLiteral<"authenticated">, z.ZodLiteral<"keeper">, z.ZodObject<{
|
|
92
116
|
role: z.ZodString;
|
|
@@ -105,6 +129,11 @@ export declare const RemoteNotificationActionSpec: z.ZodObject<{
|
|
|
105
129
|
description: z.ZodString;
|
|
106
130
|
streams: z.ZodOptional<z.ZodString>;
|
|
107
131
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
132
|
+
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
133
|
+
account: "account";
|
|
134
|
+
ip: "ip";
|
|
135
|
+
both: "both";
|
|
136
|
+
}>>;
|
|
108
137
|
kind: z.ZodDefault<z.ZodLiteral<"remote_notification">>;
|
|
109
138
|
auth: z.ZodDefault<z.ZodNull>;
|
|
110
139
|
side_effects: z.ZodDefault<z.ZodLiteral<true>>;
|
|
@@ -130,6 +159,11 @@ export declare const LocalCallActionSpec: z.ZodObject<{
|
|
|
130
159
|
description: z.ZodString;
|
|
131
160
|
streams: z.ZodOptional<z.ZodString>;
|
|
132
161
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
162
|
+
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
163
|
+
account: "account";
|
|
164
|
+
ip: "ip";
|
|
165
|
+
both: "both";
|
|
166
|
+
}>>;
|
|
133
167
|
kind: z.ZodDefault<z.ZodLiteral<"local_call">>;
|
|
134
168
|
auth: z.ZodDefault<z.ZodNull>;
|
|
135
169
|
}, z.core.$strict>;
|
|
@@ -147,6 +181,11 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
147
181
|
description: z.ZodString;
|
|
148
182
|
streams: z.ZodOptional<z.ZodString>;
|
|
149
183
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
184
|
+
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
185
|
+
account: "account";
|
|
186
|
+
ip: "ip";
|
|
187
|
+
both: "both";
|
|
188
|
+
}>>;
|
|
150
189
|
kind: z.ZodDefault<z.ZodLiteral<"request_response">>;
|
|
151
190
|
auth: z.ZodUnion<readonly [z.ZodLiteral<"public">, z.ZodLiteral<"authenticated">, z.ZodLiteral<"keeper">, z.ZodObject<{
|
|
152
191
|
role: z.ZodString;
|
|
@@ -163,6 +202,11 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
163
202
|
description: z.ZodString;
|
|
164
203
|
streams: z.ZodOptional<z.ZodString>;
|
|
165
204
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
205
|
+
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
206
|
+
account: "account";
|
|
207
|
+
ip: "ip";
|
|
208
|
+
both: "both";
|
|
209
|
+
}>>;
|
|
166
210
|
kind: z.ZodDefault<z.ZodLiteral<"remote_notification">>;
|
|
167
211
|
auth: z.ZodDefault<z.ZodNull>;
|
|
168
212
|
side_effects: z.ZodDefault<z.ZodLiteral<true>>;
|
|
@@ -182,6 +226,11 @@ export declare const ActionSpecUnion: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
182
226
|
description: z.ZodString;
|
|
183
227
|
streams: z.ZodOptional<z.ZodString>;
|
|
184
228
|
error_reasons: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
229
|
+
rate_limit: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
account: "account";
|
|
231
|
+
ip: "ip";
|
|
232
|
+
both: "both";
|
|
233
|
+
}>>;
|
|
185
234
|
kind: z.ZodDefault<z.ZodLiteral<"local_call">>;
|
|
186
235
|
auth: z.ZodDefault<z.ZodNull>;
|
|
187
236
|
}, z.core.$strict>]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_spec.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"action_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,UAAU;;;;EAAoE,CAAC;AAC5F,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,eAAe;;;;EAA0C,CAAC;AACvE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU;;oBAKrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEp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10 @@
|
|
|
8
8
|
* @see `actions/action_rpc.ts` for the JSON-RPC dispatcher
|
|
9
9
|
* @see `actions/register_action_ws.ts` for the WebSocket dispatcher
|
|
10
10
|
*
|
|
11
|
-
* TODO @action-system-review The action system (action_spec, action_registry,
|
|
12
|
-
* action_codegen, action_bridge) will evolve significantly as RPC patterns settle.
|
|
13
|
-
* Current state: bridge is stable, registry and codegen are partially stub API.
|
|
14
|
-
* Search for `@action-system-review` across the actions/ and routes/ modules.
|
|
15
|
-
*
|
|
16
11
|
* @module
|
|
17
12
|
*/
|
|
18
13
|
import { z } from 'zod';
|
|
14
|
+
import { RateLimitKey } from '../http/error_schemas.js';
|
|
19
15
|
export const ActionKind = z.enum(['request_response', 'remote_notification', 'local_call']);
|
|
20
16
|
export const ActionInitiator = z.enum(['frontend', 'backend', 'both']);
|
|
21
17
|
export const ActionAuth = z.union([
|
|
@@ -53,6 +49,26 @@ export const ActionSpec = z.strictObject({
|
|
|
53
49
|
* transport errors leave it unset.
|
|
54
50
|
*/
|
|
55
51
|
error_reasons: z.array(z.string()).readonly().optional(),
|
|
52
|
+
/**
|
|
53
|
+
* Rate limit key the RPC dispatcher consults for this action. Optional —
|
|
54
|
+
* actions without it skip the rate-limit hook entirely.
|
|
55
|
+
*
|
|
56
|
+
* - `'ip'` — keyed on the resolved client IP (`get_client_ip(c)`).
|
|
57
|
+
* - `'account'` — keyed on the post-auth actor id (`request_context.actor.id`).
|
|
58
|
+
* Registration-time error if paired with `auth: 'public'` (no actor).
|
|
59
|
+
* - `'both'` — both checks run; either can block.
|
|
60
|
+
*
|
|
61
|
+
* Throttle-requests semantics — every invocation records, regardless of
|
|
62
|
+
* outcome (different from REST login's throttle-failures, which resets
|
|
63
|
+
* on success). Suits admin mutation oracles (`invite_create` account-
|
|
64
|
+
* existence probe) where the *successful* invocation is the threat.
|
|
65
|
+
*
|
|
66
|
+
* Today only `RequestResponseActionSpec` is consulted by the RPC
|
|
67
|
+
* dispatcher. The field is on the base for shape symmetry with
|
|
68
|
+
* `streams` and `error_reasons`; remote_notification / local_call
|
|
69
|
+
* dispatchers don't read it.
|
|
70
|
+
*/
|
|
71
|
+
rate_limit: RateLimitKey.optional(),
|
|
56
72
|
});
|
|
57
73
|
export const RequestResponseActionSpec = ActionSpec.extend({
|
|
58
74
|
kind: z.literal('request_response').default('request_response'),
|
|
@@ -142,14 +142,6 @@ export interface FrontendRpcClient<TApi> {
|
|
|
142
142
|
/** Action environment — exposed for consumers that need to share it (e.g. attach a notification handler registry). */
|
|
143
143
|
environment: ActionEventEnvironment;
|
|
144
144
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Build a frontend-only typed RPC client.
|
|
147
|
-
*
|
|
148
|
-
* @param options - `specs` (required), optional `path` / `transports` /
|
|
149
|
-
* `transport_for_method` / `on_action_event`
|
|
150
|
-
* @returns `{api, api_result, peer, environment}` — both Proxy shapes plus
|
|
151
|
-
* the underlying primitives. `api` throws on `{ok: false}`; `api_result`
|
|
152
|
-
* returns the Result.
|
|
153
|
-
*/
|
|
145
|
+
/** Build a frontend-only typed RPC client. See module doc for the bundle's design. */
|
|
154
146
|
export declare const create_frontend_rpc_client: <TApi extends object>(options: CreateFrontendRpcClientOptions<TApi>) => FrontendRpcClient<TApi>;
|
|
155
147
|
//# sourceMappingURL=frontend_rpc_client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend_rpc_client.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/frontend_rpc_client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAa,KAAK,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAGN,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEtD,gDAAgD;AAChD,MAAM,WAAW,8BAA8B,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IAC3E;;;;;;;;;;;;;;OAcG;IACH,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACtC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACtC;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC;IACpE;;;;;;;;;;;;;;;;OAgBG;IACH,qBAAqB,CAAC,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,CAAC;CACxE;AAED,uDAAuD;AACvD,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACtC;;;;OAIG;IACH,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;OAKG;IACH,UAAU,EAAE,IAAI,CAAC;IACjB,0GAA0G;IAC1G,IAAI,EAAE,UAAU,CAAC;IACjB,sHAAsH;IACtH,WAAW,EAAE,sBAAsB,CAAC;CACpC;AAED
|
|
1
|
+
{"version":3,"file":"frontend_rpc_client.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/frontend_rpc_client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAa,KAAK,SAAS,EAAC,MAAM,iBAA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 +50,7 @@ import { ActionPeer } from './action_peer.js';
|
|
|
50
50
|
import { Transports } from './transports.js';
|
|
51
51
|
import { FrontendHttpTransport } from './transports_http.js';
|
|
52
52
|
import { create_rpc_client, create_throwing_api, } from './rpc_client.js';
|
|
53
|
-
/**
|
|
54
|
-
* Build a frontend-only typed RPC client.
|
|
55
|
-
*
|
|
56
|
-
* @param options - `specs` (required), optional `path` / `transports` /
|
|
57
|
-
* `transport_for_method` / `on_action_event`
|
|
58
|
-
* @returns `{api, api_result, peer, environment}` — both Proxy shapes plus
|
|
59
|
-
* the underlying primitives. `api` throws on `{ok: false}`; `api_result`
|
|
60
|
-
* returns the Result.
|
|
61
|
-
*/
|
|
53
|
+
/** Build a frontend-only typed RPC client. See module doc for the bundle's design. */
|
|
62
54
|
export const create_frontend_rpc_client = (options) => {
|
|
63
55
|
const registry = new ActionRegistry([...options.specs]);
|
|
64
56
|
const environment = {
|
|
@@ -32,6 +32,7 @@ import type { Context, Hono } from 'hono';
|
|
|
32
32
|
import type { UpgradeWebSocket, WSContext } from 'hono/ws';
|
|
33
33
|
import { type Logger as LoggerType } from '@fuzdev/fuz_util/log.js';
|
|
34
34
|
import type { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
35
|
+
import type { RateLimiter } from '../rate_limiter.js';
|
|
35
36
|
import { type Action, type BaseHandlerContext, type WsActionHandler } from './action_types.js';
|
|
36
37
|
import { BackendWebsocketTransport, type ConnectionIdentity } from './transports_ws_backend.js';
|
|
37
38
|
export type { Action, BaseHandlerContext, WsActionHandler };
|
|
@@ -140,6 +141,21 @@ export interface RegisterActionWsOptions<TCtx extends BaseHandlerContext> {
|
|
|
140
141
|
* down the transport's internal state. Errors are logged and swallowed.
|
|
141
142
|
*/
|
|
142
143
|
on_socket_close?: (ctx: SocketCloseContext) => void | Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Per-IP rate limiter consulted for actions whose spec declares
|
|
146
|
+
* `rate_limit: 'ip'` or `'both'`. `null` (or omitted) disables the
|
|
147
|
+
* IP check. Same limiter is shared with the HTTP RPC dispatcher so
|
|
148
|
+
* one budget covers both transports per action. Resolved at upgrade
|
|
149
|
+
* time and reused for every message on the socket.
|
|
150
|
+
*/
|
|
151
|
+
action_ip_rate_limiter?: RateLimiter | null;
|
|
152
|
+
/**
|
|
153
|
+
* Per-actor rate limiter consulted for actions whose spec declares
|
|
154
|
+
* `rate_limit: 'account'` or `'both'`. Keyed on
|
|
155
|
+
* `request_context.actor.id`. `null` (or omitted) disables the
|
|
156
|
+
* account check. Same limiter is shared with the HTTP RPC dispatcher.
|
|
157
|
+
*/
|
|
158
|
+
action_account_rate_limiter?: RateLimiter | null;
|
|
143
159
|
}
|
|
144
160
|
/** Result of `register_action_ws`. */
|
|
145
161
|
export interface RegisterActionWsResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register_action_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACxC,OAAO,KAAK,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEzD,OAAO,EAAS,KAAK,MAAM,IAAI,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"register_action_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACxC,OAAO,KAAK,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEzD,OAAO,EAAS,KAAK,MA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EAAE,gBAAgB,CAAC;IACnC;;;;;;;OAOG;IACH,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC;;;;;OAKG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/D;;;;OAIG;IACH,SAAS,CAAC,EAAE,yBAAyB,CAAC;IACtC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;IAC7C,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qDAAqD;IACrD,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5C;;;;;OAKG;IACH,2BAA2B,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACjD;AAED,sCAAsC;AACtC,MAAM,WAAW,sBAAsB;IACtC,yEAAyE;IACzE,SAAS,EAAE,yBAAyB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,SAAS,kBAAkB,EACjE,SAAS,uBAAuB,CAAC,IAAI,CAAC,KACpC,sBAmaF,CAAC"}
|
|
@@ -34,6 +34,7 @@ import { Logger } from '@fuzdev/fuz_util/log.js';
|
|
|
34
34
|
import { get_request_context, has_role } from '../auth/request_context.js';
|
|
35
35
|
import { hash_session_token } from '../auth/session_queries.js';
|
|
36
36
|
import { ROLE_KEEPER } from '../auth/role_schema.js';
|
|
37
|
+
import { get_client_ip } from '../http/proxy.js';
|
|
37
38
|
import { JSONRPC_VERSION } from '../http/jsonrpc.js';
|
|
38
39
|
import { jsonrpc_error_messages, ThrownJsonrpcError } from '../http/jsonrpc_errors.js';
|
|
39
40
|
import { create_jsonrpc_error_response, create_jsonrpc_error_response_from_thrown, create_jsonrpc_notification, to_jsonrpc_message_id, to_jsonrpc_params, is_jsonrpc_request, } from '../http/jsonrpc_helpers.js';
|
|
@@ -66,7 +67,7 @@ export const DEFAULT_SERVER_HEARTBEAT_TIMEOUT = 60_000;
|
|
|
66
67
|
* in the transport's internal maps via `add_connection` / `remove_connection`
|
|
67
68
|
*/
|
|
68
69
|
export const register_action_ws = (options) => {
|
|
69
|
-
const { path, app, upgradeWebSocket, actions, extend_context, transport = new BackendWebsocketTransport(), heartbeat = true, artificial_delay = 0, log = new Logger('[ws]'), on_socket_open, on_socket_close, } = options;
|
|
70
|
+
const { path, app, upgradeWebSocket, actions, extend_context, transport = new BackendWebsocketTransport(), heartbeat = true, artificial_delay = 0, log = new Logger('[ws]'), on_socket_open, on_socket_close, action_ip_rate_limiter = null, action_account_rate_limiter = null, } = options;
|
|
70
71
|
// Fan the unified actions array into the two lookups the dispatcher
|
|
71
72
|
// consults at message time. Keeping them internal means the composable
|
|
72
73
|
// `{spec, handler}` tuple remains the only shape consumers name.
|
|
@@ -76,6 +77,12 @@ export const register_action_ws = (options) => {
|
|
|
76
77
|
spec_by_method.set(action.spec.method, action.spec);
|
|
77
78
|
if (action.handler)
|
|
78
79
|
handlers[action.spec.method] = action.handler;
|
|
80
|
+
// Reject account-keyed rate limiting on public actions — the dispatcher
|
|
81
|
+
// has no actor to key on. Mirrors the HTTP RPC registration check.
|
|
82
|
+
if ((action.spec.rate_limit === 'account' || action.spec.rate_limit === 'both') &&
|
|
83
|
+
action.spec.auth === 'public') {
|
|
84
|
+
throw new Error(`WS action "${action.spec.method}" declares rate_limit: '${action.spec.rate_limit}' but auth: 'public' — no actor available for account-keyed limiting. Use 'ip' or change auth.`);
|
|
85
|
+
}
|
|
79
86
|
}
|
|
80
87
|
const heartbeat_enabled = heartbeat !== false;
|
|
81
88
|
const heartbeat_config = typeof heartbeat === 'object' ? heartbeat : {};
|
|
@@ -90,6 +97,10 @@ export const register_action_ws = (options) => {
|
|
|
90
97
|
// non-null by the time we get here.
|
|
91
98
|
const request_context = get_request_context(c);
|
|
92
99
|
const account_id = request_context.account.id;
|
|
100
|
+
// Resolved at upgrade — every message on this socket shares the
|
|
101
|
+
// same client IP, so we capture once and reuse for rate-limit
|
|
102
|
+
// keying. `'unknown'` if the proxy middleware wasn't in the stack.
|
|
103
|
+
const client_ip = get_client_ip(c);
|
|
93
104
|
const credential_type = c.get(CREDENTIAL_TYPE_KEY);
|
|
94
105
|
// Session-based connections have a token hash for targeted revocation.
|
|
95
106
|
// Bearer/daemon connections pass null — still reachable via
|
|
@@ -248,6 +259,35 @@ export const register_action_ws = (options) => {
|
|
|
248
259
|
return;
|
|
249
260
|
}
|
|
250
261
|
}
|
|
262
|
+
// Rate limit — throttle-requests semantics, mirrors the HTTP RPC
|
|
263
|
+
// dispatcher. Same limiters are shared across transports so an
|
|
264
|
+
// attacker can't bypass the budget by switching from RPC to WS.
|
|
265
|
+
const rate_limit = spec.rate_limit;
|
|
266
|
+
if (rate_limit) {
|
|
267
|
+
const ip_check = action_ip_rate_limiter && (rate_limit === 'ip' || rate_limit === 'both');
|
|
268
|
+
const account_check = action_account_rate_limiter && (rate_limit === 'account' || rate_limit === 'both');
|
|
269
|
+
const send_rate_limited = (retry_after) => {
|
|
270
|
+
ws.send(JSON.stringify(create_jsonrpc_error_response(id, jsonrpc_error_messages.rate_limited('rate limited', { retry_after }))));
|
|
271
|
+
};
|
|
272
|
+
if (ip_check) {
|
|
273
|
+
const result = action_ip_rate_limiter.check(client_ip);
|
|
274
|
+
if (!result.allowed) {
|
|
275
|
+
send_rate_limited(result.retry_after);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (account_check) {
|
|
280
|
+
const result = action_account_rate_limiter.check(request_context.actor.id);
|
|
281
|
+
if (!result.allowed) {
|
|
282
|
+
send_rate_limited(result.retry_after);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (ip_check)
|
|
287
|
+
action_ip_rate_limiter.record(client_ip);
|
|
288
|
+
if (account_check)
|
|
289
|
+
action_account_rate_limiter.record(request_context.actor.id);
|
|
290
|
+
}
|
|
251
291
|
// Look up handler — method is validated against spec_by_method above.
|
|
252
292
|
const handler = handlers[method];
|
|
253
293
|
if (!handler) {
|
|
@@ -12,9 +12,6 @@ import { type JsonrpcErrorResponse, type JsonrpcRequestId, type JsonrpcResponseO
|
|
|
12
12
|
type Datetime = string & {
|
|
13
13
|
readonly __brand: 'Datetime';
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Represents a pending request with its associated state.
|
|
17
|
-
*/
|
|
18
15
|
export declare class RequestTrackerItem {
|
|
19
16
|
readonly id: JsonrpcRequestId;
|
|
20
17
|
readonly deferred: Deferred<JsonrpcResponseOrError>;
|
|
@@ -24,34 +21,32 @@ export declare class RequestTrackerItem {
|
|
|
24
21
|
constructor(id: JsonrpcRequestId, deferred: Deferred<JsonrpcResponseOrError>, created: Datetime, status: AsyncStatus, timeout: NodeJS.Timeout | undefined);
|
|
25
22
|
}
|
|
26
23
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
24
|
+
* Reactive pending-request store with per-request timeouts. Used by transports
|
|
25
|
+
* that don't delegate request/response correlation to a `WebsocketRpcConnection`.
|
|
29
26
|
*/
|
|
30
27
|
export declare class RequestTracker {
|
|
31
28
|
readonly pending_requests: SvelteMap<JsonrpcRequestId, RequestTrackerItem>;
|
|
32
29
|
readonly request_timeout_ms: number;
|
|
33
30
|
constructor(request_timeout_ms?: number);
|
|
34
31
|
/**
|
|
35
|
-
* Track a new request
|
|
36
|
-
*
|
|
37
|
-
* @returns
|
|
32
|
+
* Track a new request keyed by `id`.
|
|
33
|
+
*
|
|
34
|
+
* @returns deferred resolved on response, or rejected via the timeout
|
|
38
35
|
* @mutates this - inserts a `RequestTrackerItem` into `pending_requests`
|
|
39
36
|
* and arms a timeout that auto-rejects after `request_timeout_ms`;
|
|
40
37
|
* clears any prior timeout for the same id
|
|
41
38
|
*/
|
|
42
39
|
track_request(id: JsonrpcRequestId): Deferred<JsonrpcResponseOrError>;
|
|
43
40
|
/**
|
|
44
|
-
* Resolve a pending request with
|
|
45
|
-
*
|
|
46
|
-
* @param response - the response data
|
|
41
|
+
* Resolve a pending request with its response.
|
|
42
|
+
*
|
|
47
43
|
* @mutates this - clears the timeout, marks status `'success'`,
|
|
48
44
|
* resolves the deferred, and removes the entry from `pending_requests`
|
|
49
45
|
*/
|
|
50
46
|
resolve_request(id: JsonrpcRequestId, response: JsonrpcResponseOrError): void;
|
|
51
47
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @param error_message - the complete `JsonrpcErrorResponse` object
|
|
48
|
+
* Reject a pending request with `error_message`.
|
|
49
|
+
*
|
|
55
50
|
* @mutates this - clears the timeout, marks status `'failure'`,
|
|
56
51
|
* rejects the deferred with a `ThrownJsonrpcError`, and removes the
|
|
57
52
|
* entry from `pending_requests`
|
|
@@ -66,7 +61,7 @@ export declare class RequestTracker {
|
|
|
66
61
|
* Cancel a pending request without rejecting its deferred — just
|
|
67
62
|
* cleanup. The caller's promise stays unsettled; pair with an external
|
|
68
63
|
* resolution if needed.
|
|
69
|
-
*
|
|
64
|
+
*
|
|
70
65
|
* @mutates this - clears the timeout and removes the entry from `pending_requests`
|
|
71
66
|
*/
|
|
72
67
|
cancel_request(id: JsonrpcRequestId): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_tracker.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/request_tracker.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAk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G,SAAS;CAQpC;AAED;;;GAGG;AACH,qBAAa,cAAc;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAmB;IAC7F,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;gBAExB,kBAAkB,SAAU;IAIxC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,EAAE,gBAAgB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;IA6BrE;;;;;OAKG;IACH,eAAe,CAAC,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAkB7E;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,GAAG,IAAI;IAuB/E;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI;IAiBlC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,EAAE,gBAAgB,GAAG,IAAI;IAe1C;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;CAiB1C"}
|
|
@@ -12,9 +12,6 @@ import { ThrownJsonrpcError, JSONRPC_ERROR_CODES } from '../http/jsonrpc_errors.
|
|
|
12
12
|
const get_datetime_now = () => new Date().toISOString();
|
|
13
13
|
// TODO what if this uses a tracker id param that's an opaque UUID but can be used for action association?
|
|
14
14
|
// TODO name, like `TrackedRequest`? or is this implicit namespacing and generic name preferred
|
|
15
|
-
/**
|
|
16
|
-
* Represents a pending request with its associated state.
|
|
17
|
-
*/
|
|
18
15
|
export class RequestTrackerItem {
|
|
19
16
|
id;
|
|
20
17
|
deferred;
|
|
@@ -30,8 +27,8 @@ export class RequestTrackerItem {
|
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* Reactive pending-request store with per-request timeouts. Used by transports
|
|
31
|
+
* that don't delegate request/response correlation to a `WebsocketRpcConnection`.
|
|
35
32
|
*/
|
|
36
33
|
export class RequestTracker {
|
|
37
34
|
pending_requests = new SvelteMap();
|
|
@@ -40,9 +37,9 @@ export class RequestTracker {
|
|
|
40
37
|
this.request_timeout_ms = request_timeout_ms;
|
|
41
38
|
}
|
|
42
39
|
/**
|
|
43
|
-
* Track a new request
|
|
44
|
-
*
|
|
45
|
-
* @returns
|
|
40
|
+
* Track a new request keyed by `id`.
|
|
41
|
+
*
|
|
42
|
+
* @returns deferred resolved on response, or rejected via the timeout
|
|
46
43
|
* @mutates this - inserts a `RequestTrackerItem` into `pending_requests`
|
|
47
44
|
* and arms a timeout that auto-rejects after `request_timeout_ms`;
|
|
48
45
|
* clears any prior timeout for the same id
|
|
@@ -69,9 +66,8 @@ export class RequestTracker {
|
|
|
69
66
|
return deferred;
|
|
70
67
|
}
|
|
71
68
|
/**
|
|
72
|
-
* Resolve a pending request with
|
|
73
|
-
*
|
|
74
|
-
* @param response - the response data
|
|
69
|
+
* Resolve a pending request with its response.
|
|
70
|
+
*
|
|
75
71
|
* @mutates this - clears the timeout, marks status `'success'`,
|
|
76
72
|
* resolves the deferred, and removes the entry from `pending_requests`
|
|
77
73
|
*/
|
|
@@ -91,9 +87,8 @@ export class RequestTracker {
|
|
|
91
87
|
this.pending_requests.delete(id);
|
|
92
88
|
}
|
|
93
89
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* @param error_message - the complete `JsonrpcErrorResponse` object
|
|
90
|
+
* Reject a pending request with `error_message`.
|
|
91
|
+
*
|
|
97
92
|
* @mutates this - clears the timeout, marks status `'failure'`,
|
|
98
93
|
* rejects the deferred with a `ThrownJsonrpcError`, and removes the
|
|
99
94
|
* entry from `pending_requests`
|
|
@@ -138,7 +133,7 @@ export class RequestTracker {
|
|
|
138
133
|
* Cancel a pending request without rejecting its deferred — just
|
|
139
134
|
* cleanup. The caller's promise stays unsettled; pair with an external
|
|
140
135
|
* resolution if needed.
|
|
141
|
-
*
|
|
136
|
+
*
|
|
142
137
|
* @mutates this - clears the timeout and removes the entry from `pending_requests`
|
|
143
138
|
*/
|
|
144
139
|
cancel_request(id) {
|
|
@@ -68,7 +68,6 @@ export interface CreateRpcClientOptions<TApi extends object = object> {
|
|
|
68
68
|
* const api_result = create_rpc_client<MyActionsApi>({peer, environment});
|
|
69
69
|
* ```
|
|
70
70
|
*
|
|
71
|
-
* @param options - client options (peer, environment, optional callbacks)
|
|
72
71
|
* @returns a Proxy typed as `TApi` that responds to any method name found in the environment's specs
|
|
73
72
|
*/
|
|
74
73
|
export declare const create_rpc_client: <TApi extends object>(options: CreateRpcClientOptions<TApi>) => TApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_client.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/rpc_client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAQvD,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAsB,KAAK,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAMxE,OAAO,KAAK,EAAC,UAAU,EAAE,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,aAAa,GAAG,SAAS,CAAC;AAM/E,uCAAuC;AACvC,MAAM,WAAW,sBAAsB,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IACnE,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,sBAAsB,CAAC;IACpC;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,WAA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Q,qBAAqB;CAAG;AA6GtE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,WAAW,CAAC,IAAI,IAAI;KAC9B,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAClC,GAAG,IAAI,EAAE,MAAM,KAAK,KAChB,OAAO,CAAC,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,MAAM,CAAA;KAAC,EAAE;QAAC,KAAK,EAAE,kBAAkB,CAAA;KAAC,CAAC,CAAC,GACrE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,MAAM,CAAC,GACnC,IAAI,CAAC,CAAC,CAAC;CACV,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,SAAS,MAAM,EAAE,YAAY,IAAI,KAAG,WAAW,CAAC,IAAI,CA8B3F,CAAC"}
|
|
@@ -33,7 +33,6 @@ import { jsonrpc_error_messages } from '../http/jsonrpc_errors.js';
|
|
|
33
33
|
* const api_result = create_rpc_client<MyActionsApi>({peer, environment});
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
|
-
* @param options - client options (peer, environment, optional callbacks)
|
|
37
36
|
* @returns a Proxy typed as `TApi` that responds to any method name found in the environment's specs
|
|
38
37
|
*/
|
|
39
38
|
export const create_rpc_client = (options) => {
|
|
@@ -56,9 +55,6 @@ export const create_rpc_client = (options) => {
|
|
|
56
55
|
},
|
|
57
56
|
});
|
|
58
57
|
};
|
|
59
|
-
/**
|
|
60
|
-
* Creates a method that executes an action through its complete lifecycle.
|
|
61
|
-
*/
|
|
62
58
|
const create_action_method = (peer, environment, spec, on_action_event, transport_for_method) => {
|
|
63
59
|
switch (spec.kind) {
|
|
64
60
|
case 'local_call':
|
|
@@ -71,10 +67,7 @@ const create_action_method = (peer, environment, spec, on_action_event, transpor
|
|
|
71
67
|
return create_remote_notification_method(peer, environment, spec, on_action_event, transport_for_method);
|
|
72
68
|
}
|
|
73
69
|
};
|
|
74
|
-
/**
|
|
75
|
-
* Creates a synchronous local call method.
|
|
76
|
-
* Returns value directly - can throw on error (sync methods cannot return Result).
|
|
77
|
-
*/
|
|
70
|
+
/** Sync local-call dispatch — returns the value directly; throws on error (no Result wrapping). */
|
|
78
71
|
const create_sync_local_call_method = (environment, spec, on_action_event) => {
|
|
79
72
|
return (input) => {
|
|
80
73
|
const event = create_action_event(environment, spec, input);
|
|
@@ -91,8 +84,7 @@ const create_sync_local_call_method = (environment, spec, on_action_event) => {
|
|
|
91
84
|
};
|
|
92
85
|
};
|
|
93
86
|
/**
|
|
94
|
-
*
|
|
95
|
-
* Returns Result for type-safe error handling.
|
|
87
|
+
* Async local-call dispatch — returns Result.
|
|
96
88
|
*
|
|
97
89
|
* Local calls don't traverse a transport, so `transport_name` is ignored and
|
|
98
90
|
* `signal` can only short-circuit before the synchronous handler runs (no
|
|
@@ -112,9 +104,6 @@ const create_async_local_call_method = (environment, spec, on_action_event) => {
|
|
|
112
104
|
return extract_action_result(event);
|
|
113
105
|
};
|
|
114
106
|
};
|
|
115
|
-
/**
|
|
116
|
-
* Creates a request/response method that communicates over the network.
|
|
117
|
-
*/
|
|
118
107
|
const create_request_response_method = (peer, environment, spec, on_action_event, transport_for_method) => {
|
|
119
108
|
return async (input, options) => {
|
|
120
109
|
const event = create_action_event(environment, spec, input);
|
|
@@ -143,10 +132,7 @@ const create_request_response_method = (peer, environment, spec, on_action_event
|
|
|
143
132
|
return extract_action_result(event);
|
|
144
133
|
};
|
|
145
134
|
};
|
|
146
|
-
/**
|
|
147
|
-
* Creates a remote notification method (fire and forget).
|
|
148
|
-
* Returns Result<{value: void}> for consistency.
|
|
149
|
-
*/
|
|
135
|
+
/** Fire-and-forget remote notification — returns `Result<{value: void}>` for consistency with `request_response`. */
|
|
150
136
|
const create_remote_notification_method = (peer, environment, spec, on_action_event, transport_for_method) => {
|
|
151
137
|
return async (input, options) => {
|
|
152
138
|
const event = create_action_event(environment, spec, input);
|
|
@@ -286,7 +286,6 @@ export declare class FrontendWebsocketClient implements WebsocketConnection, Dis
|
|
|
286
286
|
* a terminal session-revocation read as `failure` while a clean client-
|
|
287
287
|
* initiated close reads as `initial` (the "not connected, not trying" state).
|
|
288
288
|
*
|
|
289
|
-
* @param status - the socket's current `SocketStatus`
|
|
290
289
|
* @param revoked - whether the session has been permanently revoked
|
|
291
290
|
* (typically `FrontendWebsocketClient.revoked`)
|
|
292
291
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/socket.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAyC,KAAK,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAKjG,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAE5D,qDAAqD;AACrD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,kCAAkC;AAClC,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,8DAA8D;AAC9D,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AACjD,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,qDAAqD;AACrD,eAAO,MAAM,0BAA0B,QAAS,CAAC;AACjD,wFAAwF;AACxF,eAAO,MAAM,iCAAiC,QAAS,CAAC;AACxD,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,GAAG,QAAQ,CAAC;AAE9F,MAAM,MAAM,oBAA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W,GAAG,IAAI;IA2CzF;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,SAAS,GAAE,OAAO,GAAG,iCAAiC,GAAG,IAAW,GAAG,IAAI;IAazF;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,IAAI,IAAI;IAOxB,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;;;;;OASG;IACH,OAAO,IAAI,IAAI;IA2Bf;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,GAAE,MAA2B,GAAG,IAAI;IASnD,sGAAsG;IACtG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAIxB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAc3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,OAAO,CAAC,CAAC,GAAG,OAAO,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE;QAAC,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,gBAAgB,CAAA;KAAM,GAC1E,OAAO,CAAC,CAAC,CAAC;IA2Eb,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,IAAI;IAK9D,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,IAAI;CAyU1D;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,GACzC,QAAQ,YAAY,EACpB,SAAS,OAAO,KACd,WAaF,CAAC"}
|
|
@@ -724,7 +724,6 @@ export class FrontendWebsocketClient {
|
|
|
724
724
|
* a terminal session-revocation read as `failure` while a clean client-
|
|
725
725
|
* initiated close reads as `initial` (the "not connected, not trying" state).
|
|
726
726
|
*
|
|
727
|
-
* @param status - the socket's current `SocketStatus`
|
|
728
727
|
* @param revoked - whether the session has been permanently revoked
|
|
729
728
|
* (typically `FrontendWebsocketClient.revoked`)
|
|
730
729
|
*/
|
|
@@ -74,9 +74,10 @@ export declare class Transports {
|
|
|
74
74
|
*/
|
|
75
75
|
set_current_transport(transport_name: TransportName): void;
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
77
|
+
* Resolve a transport. With `allow_fallback`, walks specified → current →
|
|
78
|
+
* any-ready; without, returns the named transport (or current) only when
|
|
79
|
+
* it's ready.
|
|
80
|
+
*
|
|
80
81
|
* @returns the resolved transport, or `null` when none is ready
|
|
81
82
|
*/
|
|
82
83
|
get_transport(transport_name?: TransportName): Transport | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/transports.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EACX,gCAAgC,EAChC,gCAAgC,EAChC,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,mDAAmD;AACnD,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C,sEAAsE;AACtE,eAAO,MAAM,iCAAiC,OAAO,CAAC;AACtD,yEAAyE;AACzE,eAAO,MAAM,iCAAiC,OAAO,CAAC;AAKtD,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACzB,cAAc,EAAE,aAAa,CAAC;IAE9B,IAAI,CAAC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