@fuzdev/fuz_app 0.150.0 → 0.151.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/README.md +1 -1
- package/dist/actions/CLAUDE.md +324 -299
- package/dist/actions/action_bridge.d.ts +5 -86
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +4 -84
- package/dist/actions/action_codegen.d.ts +8 -166
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +19 -95
- package/dist/actions/action_dispatcher.d.ts +10 -0
- package/dist/actions/action_dispatcher.d.ts.map +1 -1
- package/dist/actions/action_dispatcher.js +9 -6
- package/dist/actions/action_event.d.ts +1 -2
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +7 -13
- package/dist/actions/action_event_helpers.d.ts +1 -40
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +1 -25
- package/dist/actions/action_rpc.d.ts +10 -215
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +56 -111
- package/dist/actions/action_spec.d.ts +2 -2
- package/dist/actions/action_spec.js +2 -2
- package/dist/actions/action_types.d.ts +229 -8
- package/dist/actions/action_types.d.ts.map +1 -1
- package/dist/actions/action_types.js +56 -5
- package/dist/actions/broadcast_api.d.ts +22 -17
- package/dist/actions/broadcast_api.d.ts.map +1 -1
- package/dist/actions/broadcast_api.js +16 -27
- package/dist/actions/cancel.d.ts +4 -13
- package/dist/actions/cancel.d.ts.map +1 -1
- package/dist/actions/cancel.js +5 -17
- package/dist/actions/compile_action_registry.d.ts +1 -2
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +120 -50
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +139 -31
- package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
- package/dist/actions/connection_registry.d.ts.map +1 -0
- package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
- package/dist/actions/frontend_rpc_client.d.ts +52 -2
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +42 -4
- package/dist/actions/peer_ping.d.ts +7 -9
- package/dist/actions/peer_ping.d.ts.map +1 -1
- package/dist/actions/peer_ping.js +6 -8
- package/dist/actions/peer_request.d.ts +6 -5
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/peer_request.js +6 -5
- package/dist/actions/perform_action.d.ts +36 -28
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +60 -34
- package/dist/actions/protocol.d.ts +14 -0
- package/dist/actions/protocol.d.ts.map +1 -1
- package/dist/actions/protocol.js +18 -0
- package/dist/actions/register_action_ws.d.ts +137 -298
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +155 -923
- package/dist/actions/socket.svelte.d.ts +9 -0
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +16 -5
- package/dist/actions/transports.d.ts +88 -34
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +76 -76
- package/dist/actions/transports_http.d.ts +48 -12
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +75 -44
- package/dist/actions/transports_ws.d.ts +29 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +34 -8
- package/dist/actions/ws_endpoint_spec.d.ts +52 -75
- package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
- package/dist/actions/ws_endpoint_spec.js +27 -10
- package/dist/actions/ws_outbound_writer.d.ts +3 -3
- package/dist/actions/ws_outbound_writer.js +3 -3
- package/dist/actions/ws_socket_session.d.ts +321 -0
- package/dist/actions/ws_socket_session.d.ts.map +1 -0
- package/dist/actions/ws_socket_session.js +783 -0
- package/dist/auth/CLAUDE.md +70 -44
- package/dist/auth/account_action_specs.d.ts +2 -0
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_actions.d.ts +1 -1
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +9 -3
- package/dist/auth/account_queries.d.ts +10 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +27 -17
- package/dist/auth/account_routes.d.ts +2 -1
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +14 -17
- package/dist/auth/account_schema.d.ts +5 -5
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +5 -2
- package/dist/auth/actor_lookup_actions.d.ts +1 -1
- package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
- package/dist/auth/actor_lookup_actions.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +2 -1
- package/dist/auth/actor_search_actions.d.ts +1 -1
- package/dist/auth/actor_search_actions.d.ts.map +1 -1
- package/dist/auth/actor_search_actions.js +1 -1
- package/dist/auth/actor_search_queries.d.ts +5 -5
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_queries.js +7 -7
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +3 -1
- package/dist/auth/admin_actions.d.ts +1 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +12 -42
- package/dist/auth/all_cell_actions.d.ts +6 -4
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token_queries.d.ts +1 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -0
- package/dist/auth/audit_emitter.d.ts +3 -3
- package/dist/auth/audit_emitter.js +2 -2
- package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_route_schema.js +3 -2
- package/dist/auth/audit_log_routes.d.ts +20 -11
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +49 -29
- package/dist/auth/audit_log_schema.d.ts +13 -21
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +10 -18
- package/dist/auth/bearer_auth.d.ts +7 -4
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +21 -15
- package/dist/auth/cell_action_helpers.d.ts +89 -0
- package/dist/auth/cell_action_helpers.d.ts.map +1 -0
- package/dist/auth/cell_action_helpers.js +113 -0
- package/dist/auth/cell_actions.d.ts +22 -13
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +105 -167
- package/dist/auth/cell_audit_actions.d.ts +1 -1
- package/dist/auth/cell_audit_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_actions.js +3 -12
- package/dist/auth/cell_audit_metadata.d.ts +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_actions.d.ts +1 -1
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +16 -66
- package/dist/auth/cell_grant_action_specs.d.ts +2 -2
- package/dist/auth/cell_grant_action_specs.js +3 -3
- package/dist/auth/cell_grant_actions.d.ts +73 -11
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +63 -55
- package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
- package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +7 -4
- package/dist/auth/cell_item_actions.d.ts +1 -1
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +21 -82
- package/dist/auth/cleanup.d.ts +1 -1
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -3
- package/dist/auth/credential_deadline.d.ts +3 -3
- package/dist/auth/credential_deadline.js +3 -3
- package/dist/auth/credential_type_schema.d.ts +5 -5
- package/dist/auth/credential_type_schema.js +5 -5
- package/dist/auth/daemon_token_middleware.d.ts +12 -6
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +28 -17
- package/dist/auth/deps.d.ts +4 -4
- package/dist/auth/fail_floor.d.ts +55 -0
- package/dist/auth/fail_floor.d.ts.map +1 -0
- package/dist/auth/fail_floor.js +63 -0
- package/dist/auth/invite_queries.d.ts +3 -15
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -21
- package/dist/auth/middleware.d.ts +12 -7
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +42 -29
- package/dist/auth/migrations.d.ts +5 -33
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +9 -16
- package/dist/auth/request_context.d.ts +101 -71
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +137 -140
- package/dist/auth/resolved_auth.d.ts +122 -36
- package/dist/auth/resolved_auth.d.ts.map +1 -1
- package/dist/auth/resolved_auth.js +89 -38
- package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +26 -13
- package/dist/auth/role_grant_offer_actions.d.ts +13 -7
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +14 -12
- package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts +0 -5
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +9 -41
- package/dist/auth/role_grant_queries.d.ts +17 -67
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +34 -106
- package/dist/auth/role_grant_sql.d.ts +42 -0
- package/dist/auth/role_grant_sql.d.ts.map +1 -0
- package/dist/auth/role_grant_sql.js +54 -0
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +1 -1
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -1
- package/dist/auth/session_queries.d.ts +2 -1
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +2 -1
- package/dist/auth/signup_routes.d.ts +2 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +14 -13
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
- package/dist/auth/token_scope.d.ts +19 -46
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +23 -41
- package/dist/db/CLAUDE.md +9 -4
- package/dist/db/cell_ddl.d.ts +5 -142
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +17 -16
- package/dist/db/cell_field_queries.d.ts +0 -13
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +0 -16
- package/dist/db/cell_grant_queries.d.ts +10 -5
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.js +13 -7
- package/dist/db/cell_item_queries.d.ts +0 -7
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +0 -10
- package/dist/db/cell_queries.d.ts +12 -48
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +24 -55
- package/dist/db/cell_view_sql.d.ts +1 -6
- package/dist/db/cell_view_sql.d.ts.map +1 -1
- package/dist/db/cell_view_sql.js +1 -2
- package/dist/db/fact_ddl.d.ts +5 -30
- package/dist/db/fact_ddl.d.ts.map +1 -1
- package/dist/db/fact_ddl.js +14 -13
- package/dist/db/fact_store.d.ts +11 -0
- package/dist/db/fact_store.d.ts.map +1 -1
- package/dist/db/fact_store.js +4 -1
- package/dist/db/migrate.d.ts +44 -6
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +63 -4
- package/dist/dev/setup.d.ts +18 -14
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +42 -39
- package/dist/env/dotenv.d.ts +2 -2
- package/dist/env/dotenv.js +2 -2
- package/dist/env/update_env_variable.d.ts +33 -21
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +54 -35
- package/dist/hono_context.d.ts +15 -90
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +9 -56
- package/dist/http/CLAUDE.md +35 -20
- package/dist/http/auth_shape.d.ts +1 -8
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +6 -12
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +3 -2
- package/dist/http/db_routes.d.ts +3 -3
- package/dist/http/db_routes.js +3 -3
- package/dist/http/error_schemas.d.ts +1 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +1 -2
- package/dist/http/health_schema.d.ts +16 -0
- package/dist/http/health_schema.d.ts.map +1 -0
- package/dist/http/health_schema.js +12 -0
- package/dist/http/jsonrpc_errors.d.ts +22 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +41 -3
- package/dist/http/jsonrpc_helpers.d.ts +60 -17
- package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
- package/dist/http/jsonrpc_helpers.js +67 -25
- package/dist/http/origin.d.ts +30 -1
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +46 -9
- package/dist/http/origin_wildcard.d.ts +97 -0
- package/dist/http/origin_wildcard.d.ts.map +1 -0
- package/dist/http/origin_wildcard.js +142 -0
- package/dist/http/pending_effects.d.ts +28 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +32 -1
- package/dist/http/route_spec.d.ts +4 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +54 -45
- package/dist/http/surface.d.ts +1 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface_query.d.ts +9 -50
- package/dist/http/surface_query.d.ts.map +1 -1
- package/dist/http/surface_query.js +48 -94
- package/dist/realtime/audit_log_sse.d.ts +180 -0
- package/dist/realtime/audit_log_sse.d.ts.map +1 -0
- package/dist/realtime/audit_log_sse.js +154 -0
- package/dist/realtime/sse.d.ts +21 -6
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +33 -10
- package/dist/realtime/sse_constants.d.ts +29 -2
- package/dist/realtime/sse_constants.d.ts.map +1 -1
- package/dist/realtime/sse_constants.js +35 -2
- package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
- package/dist/realtime/sse_registry.d.ts.map +1 -0
- package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
- package/dist/schema_meta.d.ts +30 -10
- package/dist/schema_meta.d.ts.map +1 -1
- package/dist/schema_meta.js +85 -21
- package/dist/sensitivity.d.ts +9 -3
- package/dist/sensitivity.d.ts.map +1 -1
- package/dist/sensitivity.js +3 -2
- package/dist/server/app_backend.d.ts +8 -5
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +6 -12
- package/dist/server/app_server.d.ts +62 -51
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +84 -71
- package/dist/server/app_server_context.d.ts +1 -1
- package/dist/server/app_server_context.d.ts.map +1 -1
- package/dist/server/env.d.ts +24 -20
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +24 -34
- package/dist/server/serve_fact_route.d.ts +12 -16
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +59 -34
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +2 -2
- package/dist/testing/CLAUDE.md +179 -158
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +10 -19
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +8 -0
- package/dist/testing/app_server.d.ts +9 -77
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +31 -112
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +3 -4
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -5
- package/dist/testing/auth_apps.d.ts +3 -3
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +9 -6
- package/dist/testing/connection_closer_helpers.d.ts +8 -16
- package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
- package/dist/testing/connection_closer_helpers.js +7 -20
- package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +13 -3
- package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
- package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
- package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
- package/dist/testing/cross_backend/body_size.js +25 -22
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
- package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
- package/dist/testing/cross_backend/capabilities.d.ts +13 -7
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_grant_role.js +2 -2
- package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
- package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
- package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +21 -0
- package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
- package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_backend_configs.js +29 -9
- package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +48 -0
- package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +9 -2
- package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_scope.js +5 -13
- package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
- package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
- package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
- package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
- package/dist/testing/cross_backend/postgres_database.js +56 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +18 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
- package/dist/testing/cross_backend/session_cap.d.ts +8 -0
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +66 -2
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +5 -4
- package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +21 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/sse_round_trip.js +4 -3
- package/dist/testing/cross_backend/standard.d.ts +6 -12
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +4 -6
- package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_origin_check.js +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +1 -1
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_node.js +13 -2
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +68 -0
- package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
- package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
- package/dist/testing/cross_backend/transport_composition.js +45 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
- package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
- package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
- package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
- package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_envelope.js +172 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
- package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
- package/dist/testing/cross_backend/ws_role_gated.js +2 -2
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_round_trip.js +6 -4
- package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
- package/dist/testing/daemon_info.d.ts.map +1 -0
- package/dist/testing/daemon_info.js +108 -0
- package/dist/testing/daemon_token_rotation.js +1 -1
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +3 -4
- package/dist/testing/db.js +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +35 -65
- package/dist/testing/integration_helpers.d.ts +0 -15
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +2 -42
- package/dist/testing/middleware.d.ts +20 -12
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +49 -40
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +13 -22
- package/dist/testing/resolved_auth.d.ts +30 -0
- package/dist/testing/resolved_auth.d.ts.map +1 -0
- package/dist/testing/resolved_auth.js +41 -0
- package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
- package/dist/testing/rpc_envelope_cases.js +3 -0
- 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 +2 -1
- package/dist/testing/sse_round_trip.d.ts +5 -4
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +2 -2
- package/dist/testing/stubs.d.ts +2 -2
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +24 -21
- package/dist/testing/test_origin.d.ts +25 -0
- package/dist/testing/test_origin.d.ts.map +1 -0
- package/dist/testing/test_origin.js +28 -0
- package/dist/testing/transports/raw_http.d.ts +54 -0
- package/dist/testing/transports/raw_http.d.ts.map +1 -1
- package/dist/testing/transports/raw_http.js +58 -0
- package/dist/testing/transports/ws_raw_client.d.ts +8 -0
- package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
- package/dist/testing/transports/ws_raw_client.js +13 -0
- package/dist/testing/transports/ws_transport.d.ts +15 -2
- package/dist/testing/transports/ws_transport.d.ts.map +1 -1
- package/dist/testing/transports/ws_transport.js +4 -2
- package/dist/testing/ws_round_trip.d.ts +27 -25
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +34 -26
- package/dist/ui/AccountSessions.svelte +48 -19
- package/dist/ui/AccountSessions.svelte.d.ts +2 -17
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +6 -1
- package/dist/ui/AdminAuditLog.svelte +61 -22
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +1 -1
- package/dist/ui/AdminOverview.svelte +76 -37
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
- package/dist/ui/AdminSessions.svelte +1 -1
- package/dist/ui/AppShell.svelte +3 -2
- package/dist/ui/AppShell.svelte.d.ts +3 -2
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +121 -35
- package/dist/ui/Datatable.svelte +33 -18
- package/dist/ui/Datatable.svelte.d.ts +2 -14
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +10 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte +13 -8
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
- package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +66 -27
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
- package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +6 -4
- package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.d.ts +9 -9
- package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
- package/dist/ui/admin_rpc_adapters.js +9 -9
- package/dist/ui/app_settings_state.svelte.d.ts +2 -2
- package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +70 -13
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +239 -47
- package/dist/ui/backend_probe.svelte.d.ts +93 -0
- package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
- package/dist/ui/backend_probe.svelte.js +140 -0
- package/dist/ui/format_scope.d.ts +7 -7
- package/dist/ui/format_scope.d.ts.map +1 -1
- package/dist/ui/format_scope.js +4 -4
- package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
- package/dist/ui/keyed_async_slot.svelte.js +2 -2
- package/dist/ui/popover.svelte.d.ts +18 -19
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +103 -16
- package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
- package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.js +37 -19
- package/dist/ui/ui_format.d.ts +17 -0
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +20 -0
- package/package.json +2 -1
- package/dist/actions/register_ws_endpoint.d.ts +0 -79
- package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
- package/dist/actions/register_ws_endpoint.js +0 -109
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
- package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -141
- package/dist/actions/transports_ws_backend.d.ts.map +0 -1
- package/dist/cli/args.d.ts +0 -55
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -100
- package/dist/cli/config.d.ts +0 -47
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -77
- package/dist/cli/daemon.d.ts.map +0 -1
- package/dist/cli/daemon.js +0 -181
- package/dist/cli/help.d.ts +0 -124
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -215
- package/dist/cli/logger.d.ts +0 -46
- package/dist/cli/logger.d.ts.map +0 -1
- package/dist/cli/logger.js +0 -48
- package/dist/cli/util.d.ts +0 -36
- package/dist/cli/util.d.ts.map +0 -1
- package/dist/cli/util.js +0 -50
- package/dist/realtime/sse_auth_guard.d.ts +0 -197
- package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
- package/dist/realtime/sse_auth_guard.js +0 -239
- package/dist/realtime/subscriber_registry.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.d.ts +0 -29
- package/dist/testing/bootstrap_success.d.ts.map +0 -1
- package/dist/testing/bootstrap_success.js +0 -144
- package/dist/testing/mock_fs.d.ts +0 -20
- package/dist/testing/mock_fs.d.ts.map +0 -1
- package/dist/testing/mock_fs.js +0 -28
- package/dist/testing/standard.d.ts +0 -122
- package/dist/testing/standard.d.ts.map +0 -1
- package/dist/testing/standard.js +0 -73
- package/dist/testing/testing_rate_limiter.d.ts +0 -65
- package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
- package/dist/testing/testing_rate_limiter.js +0 -80
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
* to wire WS-pushed `remote_notification` dispatch or a `receive_error` /
|
|
9
9
|
* `local_call` hook.
|
|
10
10
|
*
|
|
11
|
+
* Transports: always a `FrontendHttpTransport` on `path` — a read
|
|
12
|
+
* (`side_effects: false`) goes as a `GET` unless its input carries a
|
|
13
|
+
* sensitive value (`'secret'` or `'personal'`) or its URL runs long, both
|
|
14
|
+
* derived from `specs` — and, with `ws`, a
|
|
15
|
+
* `FrontendWebsocketTransport` over the WebSocket client the caller passes,
|
|
16
|
+
* which every `request_response` method routes to. The caller builds and
|
|
17
|
+
* connects the client (`FrontendWebsocketClient`, its URL from
|
|
18
|
+
* `to_same_origin_ws_url`), so an HTTP-only bundle never imports the socket.
|
|
19
|
+
*
|
|
11
20
|
* Returns both Proxy shapes from one factory call:
|
|
12
21
|
*
|
|
13
22
|
* - `api` — typed throwing Proxy. `await api.foo(input)` returns the
|
|
@@ -47,6 +56,7 @@
|
|
|
47
56
|
*/
|
|
48
57
|
import { ActionDispatcher } from './action_dispatcher.js';
|
|
49
58
|
import { type Transport } from './transports.js';
|
|
59
|
+
import { type WebsocketRpcConnection } from './transports_ws.js';
|
|
50
60
|
import { type ThrowingApi, type TransportForMethod } from './rpc_client.js';
|
|
51
61
|
import type { ActionEvent } from './action_event.js';
|
|
52
62
|
import type { ActionEventEnvironment } from './action_event_types.js';
|
|
@@ -74,17 +84,36 @@ export interface CreateFrontendRpcClientOptions<TApi extends object = object> {
|
|
|
74
84
|
* Defaults to `/api/rpc`. Ignored when `transports` is provided.
|
|
75
85
|
*/
|
|
76
86
|
path?: string;
|
|
87
|
+
/** Extra headers on every HTTP RPC call — see `FrontendHttpTransportOptions.headers`. */
|
|
88
|
+
http_headers?: Record<string, string>;
|
|
89
|
+
/**
|
|
90
|
+
* The longest path and query a read is sent as a `GET` with — see
|
|
91
|
+
* `FrontendHttpTransportOptions.max_get_url_length`.
|
|
92
|
+
*/
|
|
93
|
+
max_get_url_length?: number;
|
|
94
|
+
/**
|
|
95
|
+
* A WebSocket lane: a `FrontendWebsocketTransport` over `client`, registered
|
|
96
|
+
* after the HTTP transport, which every `request_response` method routes to
|
|
97
|
+
* unless `transport_for_method` says otherwise — the HTTP transport stays
|
|
98
|
+
* the fallback while the socket is down. Server-pushed requests and
|
|
99
|
+
* notifications on the socket dispatch through the peer
|
|
100
|
+
* (`lookup_action_handler`).
|
|
101
|
+
*/
|
|
102
|
+
ws?: FrontendRpcClientWsOptions;
|
|
77
103
|
/**
|
|
78
104
|
* Optional explicit transport list. When provided, the default
|
|
79
105
|
* `FrontendHttpTransport(path)` is **not** registered — the caller is
|
|
80
|
-
* responsible for at least one ready transport.
|
|
81
|
-
*
|
|
106
|
+
* responsible for at least one ready transport. Exclusive with `ws`,
|
|
107
|
+
* `http_headers`, and `max_get_url_length`, which configure the built-in
|
|
108
|
+
* transports.
|
|
82
109
|
*/
|
|
83
110
|
transports?: ReadonlyArray<Transport>;
|
|
84
111
|
/**
|
|
85
112
|
* Optional per-method transport selector — pure pass-through to
|
|
86
113
|
* `create_rpc_client`. Return the transport name to use for a given
|
|
87
114
|
* method, or `undefined` to fall back to the peer's default selection.
|
|
115
|
+
* With `ws` set it defaults to routing every `request_response` method to
|
|
116
|
+
* the WebSocket.
|
|
88
117
|
*
|
|
89
118
|
* Useful when methods are registered on different backend dispatchers
|
|
90
119
|
* (e.g. streaming actions on WS, REST RPC on HTTP) — a tx-style mixed
|
|
@@ -128,6 +157,25 @@ export interface CreateFrontendRpcClientOptions<TApi extends object = object> {
|
|
|
128
157
|
*/
|
|
129
158
|
log?: ActionEventEnvironment['log'];
|
|
130
159
|
}
|
|
160
|
+
/** The WebSocket lane of `create_frontend_rpc_client`. */
|
|
161
|
+
export interface FrontendRpcClientWsOptions {
|
|
162
|
+
/**
|
|
163
|
+
* The WebSocket client — typically a `FrontendWebsocketClient` over
|
|
164
|
+
* `to_same_origin_ws_url('/api/ws')`. The caller owns its lifecycle
|
|
165
|
+
* (`connect()` in the browser, `close()`).
|
|
166
|
+
*/
|
|
167
|
+
client: WebsocketRpcConnection;
|
|
168
|
+
/**
|
|
169
|
+
* The peer's default `queue` — `true` for a client-authoritative app whose
|
|
170
|
+
* requests should wait out a disconnect in the socket's durable queue
|
|
171
|
+
* rather than fail. Per call, `RpcClientCallOptions.queue` overrides it.
|
|
172
|
+
*
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
queue?: boolean;
|
|
176
|
+
/** See `FrontendWebsocketTransportOptions.max_message_bytes`. */
|
|
177
|
+
max_message_bytes?: number | null;
|
|
178
|
+
}
|
|
131
179
|
/** Bundle returned by `create_frontend_rpc_client`. */
|
|
132
180
|
export interface FrontendRpcClient<TApi> {
|
|
133
181
|
/**
|
|
@@ -145,6 +193,8 @@ export interface FrontendRpcClient<TApi> {
|
|
|
145
193
|
api_result: TApi;
|
|
146
194
|
/** Underlying peer — exposed for consumers that need to register more transports or send raw messages. */
|
|
147
195
|
peer: ActionDispatcher;
|
|
196
|
+
/** The `ws.client` the WebSocket lane runs over, or `null` without one. */
|
|
197
|
+
socket: WebsocketRpcConnection | null;
|
|
148
198
|
/** Action environment — exposed for consumers that need to share it (e.g. attach a notification handler registry). */
|
|
149
199
|
environment: ActionEventEnvironment;
|
|
150
200
|
}
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"frontend_rpc_client.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/frontend_rpc_client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAA8B,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAGN,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,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;OAKG;IACH,UAAU,EAAE,IAAI,CAAC;IACjB,0GAA0G;IAC1G,IAAI,EAAE,gBAAgB,CAAC;IACvB,2EAA2E;IAC3E,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtC,sHAAsH;IACtH,WAAW,EAAE,sBAAsB,CAAC;CACpC;AAED,sFAAsF;AACtF,eAAO,MAAM,0BAA0B,GAAI,IAAI,SAAS,MAAM,EAC7D,SAAS,8BAA8B,CAAC,IAAI,CAAC,KAC3C,iBAAiB,CAAC,IAAI,CA2DxB,CAAC"}
|
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
* to wire WS-pushed `remote_notification` dispatch or a `receive_error` /
|
|
9
9
|
* `local_call` hook.
|
|
10
10
|
*
|
|
11
|
+
* Transports: always a `FrontendHttpTransport` on `path` — a read
|
|
12
|
+
* (`side_effects: false`) goes as a `GET` unless its input carries a
|
|
13
|
+
* sensitive value (`'secret'` or `'personal'`) or its URL runs long, both
|
|
14
|
+
* derived from `specs` — and, with `ws`, a
|
|
15
|
+
* `FrontendWebsocketTransport` over the WebSocket client the caller passes,
|
|
16
|
+
* which every `request_response` method routes to. The caller builds and
|
|
17
|
+
* connects the client (`FrontendWebsocketClient`, its URL from
|
|
18
|
+
* `to_same_origin_ws_url`), so an HTTP-only bundle never imports the socket.
|
|
19
|
+
*
|
|
11
20
|
* Returns both Proxy shapes from one factory call:
|
|
12
21
|
*
|
|
13
22
|
* - `api` — typed throwing Proxy. `await api.foo(input)` returns the
|
|
@@ -49,9 +58,15 @@ import { ActionRegistry } from './action_registry.js';
|
|
|
49
58
|
import { ActionDispatcher } from './action_dispatcher.js';
|
|
50
59
|
import { Transports } from './transports.js';
|
|
51
60
|
import { FrontendHttpTransport } from './transports_http.js';
|
|
61
|
+
import { FrontendWebsocketTransport } from './transports_ws.js';
|
|
52
62
|
import { create_rpc_client, create_throwing_api } from './rpc_client.js';
|
|
53
63
|
/** Build a frontend-only typed RPC client. See module doc for the bundle's design. */
|
|
54
64
|
export const create_frontend_rpc_client = (options) => {
|
|
65
|
+
const { ws } = options;
|
|
66
|
+
if (options.transports &&
|
|
67
|
+
(ws || options.http_headers !== undefined || options.max_get_url_length !== undefined)) {
|
|
68
|
+
throw new Error('create_frontend_rpc_client: `transports` replaces the built-in transports, which `ws`, `http_headers`, and `max_get_url_length` configure — pass one or the other');
|
|
69
|
+
}
|
|
55
70
|
const registry = new ActionRegistry([...options.specs]);
|
|
56
71
|
const environment = {
|
|
57
72
|
executor: 'frontend',
|
|
@@ -60,20 +75,43 @@ export const create_frontend_rpc_client = (options) => {
|
|
|
60
75
|
log: options.log
|
|
61
76
|
};
|
|
62
77
|
const transports = new Transports();
|
|
78
|
+
const peer = new ActionDispatcher({
|
|
79
|
+
environment,
|
|
80
|
+
transports,
|
|
81
|
+
default_send_options: ws?.queue ? { queue: true } : undefined
|
|
82
|
+
});
|
|
83
|
+
let ws_transport = null;
|
|
63
84
|
if (options.transports) {
|
|
64
85
|
for (const t of options.transports)
|
|
65
86
|
transports.register_transport(t);
|
|
66
87
|
}
|
|
67
88
|
else {
|
|
68
|
-
transports.register_transport(new FrontendHttpTransport(
|
|
89
|
+
transports.register_transport(new FrontendHttpTransport({
|
|
90
|
+
url: options.path ?? '/api/rpc',
|
|
91
|
+
headers: options.http_headers,
|
|
92
|
+
lookup_action_spec: environment.lookup_action_spec,
|
|
93
|
+
max_get_url_length: options.max_get_url_length
|
|
94
|
+
}));
|
|
95
|
+
if (ws) {
|
|
96
|
+
ws_transport = new FrontendWebsocketTransport(ws.client, (data) => peer.receive(data), {
|
|
97
|
+
max_message_bytes: ws.max_message_bytes
|
|
98
|
+
});
|
|
99
|
+
transports.register_transport(ws_transport);
|
|
100
|
+
}
|
|
69
101
|
}
|
|
70
|
-
const
|
|
102
|
+
const ws_transport_name = ws_transport?.transport_name;
|
|
103
|
+
const transport_for_method = options.transport_for_method ??
|
|
104
|
+
(ws_transport_name
|
|
105
|
+
? (method) => registry.spec_by_method.get(method)?.kind === 'request_response'
|
|
106
|
+
? ws_transport_name
|
|
107
|
+
: undefined
|
|
108
|
+
: undefined);
|
|
71
109
|
const api_result = create_rpc_client({
|
|
72
110
|
peer,
|
|
73
111
|
environment,
|
|
74
112
|
on_action_event: options.on_action_event,
|
|
75
|
-
transport_for_method
|
|
113
|
+
transport_for_method
|
|
76
114
|
});
|
|
77
115
|
const api = create_throwing_api(api_result);
|
|
78
|
-
return { api, api_result, peer, environment };
|
|
116
|
+
return { api, api_result, peer, socket: ws?.client ?? null, environment };
|
|
79
117
|
};
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
* constants and `PingResponse` (parity by test, not codegen).
|
|
26
26
|
*
|
|
27
27
|
* **Frontend-safe.** Like `heartbeat.ts` / `cancel.ts`, this module names
|
|
28
|
-
* the
|
|
29
|
-
* `
|
|
30
|
-
* `action_rpc.ts
|
|
31
|
-
*
|
|
28
|
+
* the handler types (`ActionContext`, `RpcAction`) type-only from
|
|
29
|
+
* `actions/action_types.ts` and never imports the dispatch core
|
|
30
|
+
* (`action_rpc.ts`, which would drag Hono into any frontend that pulls
|
|
31
|
+
* `protocol_action_specs`). The frontend responder
|
|
32
32
|
* (`peer_ping_responder`) lives here too so a real frontend can answer the
|
|
33
33
|
* server's probe.
|
|
34
34
|
*
|
|
35
35
|
* @module
|
|
36
36
|
*/
|
|
37
37
|
import { z } from 'zod';
|
|
38
|
-
import type { ActionContext, RpcAction } from './
|
|
38
|
+
import type { ActionContext, RpcAction } from './action_types.js';
|
|
39
39
|
/** Wire method name (both directions). Twin of the Rust `PEER_PING_METHOD`. */
|
|
40
40
|
export declare const PEER_PING_METHOD = "peer/ping";
|
|
41
41
|
/**
|
|
@@ -144,10 +144,8 @@ export declare const peer_ping_responder: (params: unknown) => PingResponse;
|
|
|
144
144
|
* Protocol-action tuple — spread into the server's `actions` array (via
|
|
145
145
|
* `protocol_actions` from `actions/protocol.ts`) so the dispatcher resolves the
|
|
146
146
|
* `peer/ping` handler on both the WS endpoint and (for the no-transport refusal)
|
|
147
|
-
* the HTTP RPC endpoint. A plain `RpcAction` literal
|
|
148
|
-
*
|
|
149
|
-
* frontend-safety discipline `heartbeat_action` / `cancel_action` follow; the
|
|
150
|
-
* handler's input/output are already pinned by `peer_ping_handler`'s signature.
|
|
147
|
+
* the HTTP RPC endpoint. A plain `RpcAction` literal — the handler's
|
|
148
|
+
* input/output are already pinned by `peer_ping_handler`'s signature.
|
|
151
149
|
* Usable directly in the spine's `RpcAction[]` full mount and the `Action[]`
|
|
152
150
|
* protocol bundle alike.
|
|
153
151
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer_ping.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/peer_ping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"peer_ping.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/peer_ping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGlE,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAIvC,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAClD,iDAAiD;AACjD,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,iHAAiH;AACjH,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAC5D,sEAAsE;AACtE,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AACxE,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AACxE,qFAAqF;AACrF,eAAO,MAAM,+BAA+B,6BAA6B,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;mBAQf,CAAC;AACd,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB;;kBAE5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,YAAY;;;kBAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;CAaG,CAAC;AA+BtC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAC7B,OAAO,eAAe,EACtB,KAAK,aAAa,KAChB,OAAO,CAAC,YAAY,CAsCtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,OAAO,KAAG,YAGrD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAG9B,CAAC"}
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
* constants and `PingResponse` (parity by test, not codegen).
|
|
26
26
|
*
|
|
27
27
|
* **Frontend-safe.** Like `heartbeat.ts` / `cancel.ts`, this module names
|
|
28
|
-
* the
|
|
29
|
-
* `
|
|
30
|
-
* `action_rpc.ts
|
|
31
|
-
*
|
|
28
|
+
* the handler types (`ActionContext`, `RpcAction`) type-only from
|
|
29
|
+
* `actions/action_types.ts` and never imports the dispatch core
|
|
30
|
+
* (`action_rpc.ts`, which would drag Hono into any frontend that pulls
|
|
31
|
+
* `protocol_action_specs`). The frontend responder
|
|
32
32
|
* (`peer_ping_responder`) lives here too so a real frontend can answer the
|
|
33
33
|
* server's probe.
|
|
34
34
|
*
|
|
@@ -186,10 +186,8 @@ export const peer_ping_responder = (params) => {
|
|
|
186
186
|
* Protocol-action tuple — spread into the server's `actions` array (via
|
|
187
187
|
* `protocol_actions` from `actions/protocol.ts`) so the dispatcher resolves the
|
|
188
188
|
* `peer/ping` handler on both the WS endpoint and (for the no-transport refusal)
|
|
189
|
-
* the HTTP RPC endpoint. A plain `RpcAction` literal
|
|
190
|
-
*
|
|
191
|
-
* frontend-safety discipline `heartbeat_action` / `cancel_action` follow; the
|
|
192
|
-
* handler's input/output are already pinned by `peer_ping_handler`'s signature.
|
|
189
|
+
* the HTTP RPC endpoint. A plain `RpcAction` literal — the handler's
|
|
190
|
+
* input/output are already pinned by `peer_ping_handler`'s signature.
|
|
193
191
|
* Usable directly in the spine's `RpcAction[]` full mount and the `Action[]`
|
|
194
192
|
* protocol bundle alike.
|
|
195
193
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* isolation guarantee), id allocation (`s{n}`-namespaced so a client's own
|
|
8
8
|
* request ids can't collide), the per-request deadline, and the per-connection
|
|
9
9
|
* in-flight cap. It deliberately does **not** touch the socket — the caller
|
|
10
|
-
* (`
|
|
10
|
+
* (`ConnectionRegistry.request_connection`) does the send and threads the
|
|
11
11
|
* reply back via `resolve`. This mirrors the Rust `fuz_realtime::peer` split
|
|
12
12
|
* (the `PendingPeerRequests` registry vs the transport that composes it), and
|
|
13
13
|
* keeps the registry pure data so it unit-tests without a live socket.
|
|
@@ -19,15 +19,16 @@ import type { Uuid } from '../primitive_schemas.js';
|
|
|
19
19
|
import type { JsonrpcErrorObject, JsonrpcErrorResponse, JsonrpcRequestId, JsonrpcRequestParams, JsonrpcResponse, JsonrpcResult } from '../http/jsonrpc.js';
|
|
20
20
|
/**
|
|
21
21
|
* Default deadline (ms) for a server→client peer request before it resolves
|
|
22
|
-
* `timeout`. Twin of the Rust spine's `
|
|
22
|
+
* `timeout`. Twin of the Rust spine's `DEFAULT_PEER_REQUEST_TIMEOUT`.
|
|
23
23
|
*/
|
|
24
24
|
export declare const DEFAULT_PEER_REQUEST_TIMEOUT = 10000;
|
|
25
25
|
/**
|
|
26
26
|
* Per-connection cap on concurrent in-flight server→client requests. A caller
|
|
27
27
|
* past it gets `too_many_in_flight` instead of growing the pending map
|
|
28
|
-
* unbounded. Twin of the Rust spine's
|
|
28
|
+
* unbounded. Twin of the Rust spine's
|
|
29
|
+
* `DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION`.
|
|
29
30
|
*/
|
|
30
|
-
export declare const
|
|
31
|
+
export declare const DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION = 256;
|
|
31
32
|
/**
|
|
32
33
|
* Why a server→client peer request did not yield a client success reply.
|
|
33
34
|
*
|
|
@@ -75,7 +76,7 @@ export interface PeerRequestOptions {
|
|
|
75
76
|
export type RequestClient = (method: string, params: JsonrpcRequestParams | undefined, options?: PeerRequestOptions) => Promise<PeerRequestOutcome>;
|
|
76
77
|
/** Options for `PendingPeerRequests`. */
|
|
77
78
|
export interface PendingPeerRequestsOptions {
|
|
78
|
-
/** Per-connection in-flight cap. Defaults to `
|
|
79
|
+
/** Per-connection in-flight cap. Defaults to `DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION`. */
|
|
79
80
|
max_in_flight_per_connection?: number;
|
|
80
81
|
/** Default per-request deadline (ms). Defaults to `DEFAULT_PEER_REQUEST_TIMEOUT`. */
|
|
81
82
|
default_timeout_ms?: number;
|
|
@@ -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,CAA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|
8
8
|
* request ids can't collide), the per-request deadline, and the per-connection
|
|
9
9
|
* in-flight cap. It deliberately does **not** touch the socket — the caller
|
|
10
|
-
* (`
|
|
10
|
+
* (`ConnectionRegistry.request_connection`) does the send and threads the
|
|
11
11
|
* reply back via `resolve`. This mirrors the Rust `fuz_realtime::peer` split
|
|
12
12
|
* (the `PendingPeerRequests` registry vs the transport that composes it), and
|
|
13
13
|
* keeps the registry pure data so it unit-tests without a live socket.
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
import { is_jsonrpc_error_response } from '../http/jsonrpc_helpers.js';
|
|
18
18
|
/**
|
|
19
19
|
* Default deadline (ms) for a server→client peer request before it resolves
|
|
20
|
-
* `timeout`. Twin of the Rust spine's `
|
|
20
|
+
* `timeout`. Twin of the Rust spine's `DEFAULT_PEER_REQUEST_TIMEOUT`.
|
|
21
21
|
*/
|
|
22
22
|
export const DEFAULT_PEER_REQUEST_TIMEOUT = 10_000;
|
|
23
23
|
/**
|
|
24
24
|
* Per-connection cap on concurrent in-flight server→client requests. A caller
|
|
25
25
|
* past it gets `too_many_in_flight` instead of growing the pending map
|
|
26
|
-
* unbounded. Twin of the Rust spine's
|
|
26
|
+
* unbounded. Twin of the Rust spine's
|
|
27
|
+
* `DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION`.
|
|
27
28
|
*/
|
|
28
|
-
export const
|
|
29
|
+
export const DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION = 256;
|
|
29
30
|
/**
|
|
30
31
|
* Correlation registry for in-flight server→client requests, nested by
|
|
31
32
|
* connection then by the server-issued request id.
|
|
@@ -47,7 +48,7 @@ export class PendingPeerRequests {
|
|
|
47
48
|
#default_timeout_ms;
|
|
48
49
|
constructor(options) {
|
|
49
50
|
this.#max_in_flight =
|
|
50
|
-
options?.max_in_flight_per_connection ??
|
|
51
|
+
options?.max_in_flight_per_connection ?? DEFAULT_MAX_IN_FLIGHT_PEER_REQUESTS_PER_CONNECTION;
|
|
51
52
|
this.#default_timeout_ms = options?.default_timeout_ms ?? DEFAULT_PEER_REQUEST_TIMEOUT;
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* on `'required'` axes.
|
|
10
10
|
* 2. **Authorization phase** — when `auth.actor !== 'none'` (or
|
|
11
11
|
* `auth.account !== 'none' && actor === 'none'`), resolves the actor
|
|
12
|
-
* via `apply_authorization_phase` against the
|
|
12
|
+
* via `apply_authorization_phase` against the resolved credential's account
|
|
13
13
|
* plus the request's `acting` selector, read off the raw params by
|
|
14
14
|
* `read_acting`. Failures fold into a JSON-RPC error envelope. The
|
|
15
15
|
* test-harness escape hatch lives in the caller — pass
|
|
16
16
|
* `preset.request_context` to skip the live phase and use a pre-baked
|
|
17
17
|
* context instead.
|
|
18
18
|
* 3. **Post-authorization auth (403)** — gates `auth.credential_types`,
|
|
19
|
-
* the credential's `
|
|
20
|
-
* context.
|
|
19
|
+
* the credential's scope (`resolved_auth_scope`), and `auth.roles` against
|
|
20
|
+
* the resolved context.
|
|
21
21
|
* 4. **Rate limit (429)** — per-action IP / account throttling, throttle-
|
|
22
22
|
* requests semantics (every invocation records, regardless of outcome).
|
|
23
23
|
* Ahead of validation so the budget is charged for malformed params too
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
* throws, never mutates the result).
|
|
52
52
|
*
|
|
53
53
|
* The function is pure data — it never touches a Hono context, so HTTP
|
|
54
|
-
* RPC
|
|
55
|
-
* call into it the same way and bind the discriminated
|
|
54
|
+
* RPC and WS dispatch call into it the same way and bind the discriminated
|
|
56
55
|
* `PerformActionResult` to their wire shape.
|
|
57
56
|
*
|
|
58
57
|
* @module
|
|
@@ -61,13 +60,12 @@ import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
|
61
60
|
import type { z } from 'zod';
|
|
62
61
|
import type { Uuid } from '../primitive_schemas.js';
|
|
63
62
|
import { type RequestContext } from '../auth/request_context.js';
|
|
64
|
-
import { type
|
|
63
|
+
import { type ResolvedAuth } from '../auth/resolved_auth.js';
|
|
65
64
|
import type { Db } from '../db/db.js';
|
|
66
65
|
import { type JsonrpcRequestId, type JsonrpcErrorObject } from '../http/jsonrpc.js';
|
|
67
66
|
import type { RateLimiter } from '../rate_limiter.js';
|
|
68
|
-
import type { RpcAction } from './
|
|
67
|
+
import type { RpcAction } from './action_types.js';
|
|
69
68
|
import type { RequestClient } from './peer_request.js';
|
|
70
|
-
import { type TokenScope } from '../auth/token_scope.js';
|
|
71
69
|
/**
|
|
72
70
|
* Per-call inputs to `perform_action`. Each transport assembles this from
|
|
73
71
|
* its wire envelope + connection identity.
|
|
@@ -79,17 +77,14 @@ export interface PerformActionInput {
|
|
|
79
77
|
raw_params: unknown;
|
|
80
78
|
/** JSON-RPC request id — echoed onto the response. */
|
|
81
79
|
request_id: JsonrpcRequestId;
|
|
82
|
-
/** Authenticated account id, or `null` for anonymous. */
|
|
83
|
-
account_id: string | null;
|
|
84
|
-
/** Credential type the request arrived on, or `null` for anonymous. */
|
|
85
|
-
credential_type: CredentialType | null;
|
|
86
80
|
/**
|
|
87
|
-
* The credential
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
81
|
+
* The credential the request authenticated with (`get_resolved_auth`), or
|
|
82
|
+
* `null` for anonymous. Its account is what the authorization phase
|
|
83
|
+
* resolves the acting actor against, its type and scope what the
|
|
84
|
+
* post-authorization gates read, and its type and session hash what the
|
|
85
|
+
* handler sees on `ActionContext`.
|
|
91
86
|
*/
|
|
92
|
-
|
|
87
|
+
auth: ResolvedAuth | null;
|
|
93
88
|
/** Resolved client IP (`'unknown'` if upstream couldn't resolve). */
|
|
94
89
|
client_ip: string;
|
|
95
90
|
/** Per-request abort signal. HTTP: `c.req.raw.signal`. WS: `AbortSignal.any([socket, request])`. */
|
|
@@ -164,7 +159,7 @@ export type PerformActionResult = {
|
|
|
164
159
|
* Phase order: 401 → authz → 403 → 429 → 400 → handler. On the test-preset path
|
|
165
160
|
* the dispatcher skips the live authorization phase and uses the supplied
|
|
166
161
|
* pre-baked context for post-authorization checks; the 401 still fires when
|
|
167
|
-
* the harness omits `
|
|
162
|
+
* the harness omits `auth`.
|
|
168
163
|
*/
|
|
169
164
|
export declare const perform_action: (input: PerformActionInput, deps: PerformActionDeps) => Promise<PerformActionResult>;
|
|
170
165
|
/**
|
|
@@ -189,16 +184,29 @@ export declare const to_invalid_params_error: (input: z.ZodType, issues: Readonl
|
|
|
189
184
|
* @returns the `forbidden` error object with reason `credential_type_required`
|
|
190
185
|
*/
|
|
191
186
|
export declare const credential_type_required_error: (required_credential_types: ReadonlyArray<string>) => JsonrpcErrorObject;
|
|
187
|
+
/** A `PerformActionResult` serialized for the wire: the JSON body and its HTTP status. */
|
|
188
|
+
export interface SerializedActionResult {
|
|
189
|
+
body: string;
|
|
190
|
+
/** `200` for a result, the error's status otherwise. WS ignores it. */
|
|
191
|
+
status: number;
|
|
192
|
+
}
|
|
192
193
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
194
|
+
* Serialize a `PerformActionResult` to its JSON-RPC envelope text — the one
|
|
195
|
+
* step HTTP RPC and WS share after `perform_action` returns.
|
|
196
|
+
*
|
|
197
|
+
* A result that cannot be serialized (a `bigint`, a cycle) answers
|
|
198
|
+
* `internal_error` rather than throwing. By then the action has committed, so
|
|
199
|
+
* a throw would cost its effects: over HTTP the route wrapper reads it as a
|
|
200
|
+
* rollback and discards `post_commit_effects` (a revocation's connection
|
|
201
|
+
* closes among them); over WS the adapter does not await the frame handler, so
|
|
202
|
+
* the rejection is unhandled and the caller gets no reply to a request that
|
|
203
|
+
* did run.
|
|
204
|
+
*
|
|
205
|
+
* @param id - the request id the envelope echoes
|
|
206
|
+
* @param result - what `perform_action` returned
|
|
207
|
+
* @param method - the action method, for the log line
|
|
208
|
+
* @param log - where a serialization failure is logged
|
|
209
|
+
* @returns the envelope text and the HTTP status to send it with
|
|
195
210
|
*/
|
|
196
|
-
export declare const
|
|
197
|
-
jsonrpc: string;
|
|
198
|
-
id: JsonrpcRequestId;
|
|
199
|
-
} & ({
|
|
200
|
-
result: unknown;
|
|
201
|
-
} | {
|
|
202
|
-
error: JsonrpcErrorObject;
|
|
203
|
-
});
|
|
211
|
+
export declare const serialize_action_result: (id: JsonrpcRequestId, result: PerformActionResult, method: string, log: Logger) => SerializedActionResult;
|
|
204
212
|
//# sourceMappingURL=perform_action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perform_action.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"perform_action.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/perform_action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAKtC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EAGvB,MAAM,oBAAoB,CAAC;AAgB5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,kEAAkE;IAClE,MAAM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