@fuzdev/fuz_app 0.51.0 → 0.53.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 +43 -10
- package/dist/actions/action_bridge.d.ts +3 -1
- package/dist/actions/action_bridge.d.ts.map +1 -1
- package/dist/actions/action_bridge.js +3 -1
- package/dist/actions/action_codegen.d.ts +28 -43
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +31 -50
- package/dist/actions/action_event.d.ts +44 -1
- package/dist/actions/action_event.d.ts.map +1 -1
- package/dist/actions/action_event.js +44 -1
- package/dist/actions/action_event_helpers.d.ts +26 -0
- package/dist/actions/action_event_helpers.d.ts.map +1 -1
- package/dist/actions/action_event_helpers.js +26 -1
- package/dist/actions/action_peer.d.ts +17 -0
- package/dist/actions/action_peer.d.ts.map +1 -1
- package/dist/actions/action_peer.js +8 -9
- package/dist/actions/action_registry.d.ts +1 -5
- package/dist/actions/action_registry.d.ts.map +1 -1
- package/dist/actions/action_registry.js +5 -11
- package/dist/actions/action_rpc.d.ts +20 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +45 -20
- package/dist/actions/action_spec.d.ts +75 -6
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +36 -6
- 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 +19 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +44 -1
- package/dist/actions/register_ws_endpoint.d.ts +3 -0
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +3 -0
- package/dist/actions/request_tracker.svelte.d.ts +24 -16
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +24 -16
- 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 +35 -16
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +33 -14
- package/dist/actions/transports.d.ts +15 -5
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +15 -15
- package/dist/actions/transports_http.d.ts +7 -0
- package/dist/actions/transports_http.d.ts.map +1 -1
- package/dist/actions/transports_http.js +7 -0
- package/dist/actions/transports_ws.d.ts +13 -0
- package/dist/actions/transports_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws.js +13 -0
- package/dist/actions/transports_ws_auth_guard.d.ts +6 -4
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +6 -4
- package/dist/actions/transports_ws_backend.d.ts +14 -1
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +14 -10
- package/dist/auth/CLAUDE.md +64 -18
- package/dist/auth/account_queries.d.ts +7 -0
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +7 -0
- 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/admin_actions.d.ts +1 -0
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +1 -0
- package/dist/auth/api_token_queries.d.ts +6 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +6 -0
- package/dist/auth/app_settings_queries.d.ts +4 -0
- package/dist/auth/app_settings_queries.d.ts.map +1 -1
- package/dist/auth/app_settings_queries.js +4 -0
- package/dist/auth/audit_log_queries.d.ts +5 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +5 -0
- package/dist/auth/audit_log_routes.d.ts +2 -2
- package/dist/auth/audit_log_routes.js +2 -2
- package/dist/auth/audit_log_schema.d.ts +2 -0
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +134 -55
- package/dist/auth/bearer_auth.d.ts +2 -0
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +2 -0
- package/dist/auth/bootstrap_account.d.ts +3 -0
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +3 -0
- package/dist/auth/cleanup.d.ts +6 -0
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +6 -0
- package/dist/auth/daemon_token_middleware.d.ts +4 -0
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +4 -0
- package/dist/auth/invite_queries.d.ts +3 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +3 -0
- package/dist/auth/permit_offer_action_specs.d.ts +6 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +11 -0
- package/dist/auth/permit_offer_queries.d.ts +18 -0
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +18 -0
- package/dist/auth/permit_queries.d.ts +7 -0
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +7 -0
- package/dist/auth/request_context.d.ts +1 -0
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +1 -0
- package/dist/auth/role_schema.d.ts +2 -0
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +2 -0
- package/dist/auth/self_service_role_actions.d.ts +1 -0
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +1 -0
- package/dist/auth/session_lifecycle.d.ts +2 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +2 -0
- package/dist/auth/session_middleware.d.ts +1 -0
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +1 -0
- package/dist/auth/session_queries.d.ts +9 -0
- package/dist/auth/session_queries.d.ts.map +1 -1
- package/dist/auth/session_queries.js +9 -0
- package/dist/cli/config.d.ts +1 -2
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +1 -2
- package/dist/cli/daemon.d.ts +6 -1
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/daemon.js +6 -1
- package/dist/db/assert_row.d.ts +2 -1
- package/dist/db/assert_row.d.ts.map +1 -1
- package/dist/db/assert_row.js +2 -1
- package/dist/db/create_db.d.ts +3 -1
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +3 -1
- package/dist/db/db.d.ts +15 -4
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +14 -3
- package/dist/db/db_pg.d.ts +4 -3
- package/dist/db/db_pg.d.ts.map +1 -1
- package/dist/db/db_pg.js +7 -5
- package/dist/db/db_pglite.d.ts +4 -4
- package/dist/db/db_pglite.js +4 -4
- package/dist/db/migrate.d.ts +7 -4
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +5 -2
- package/dist/db/sql_identifier.d.ts +2 -1
- package/dist/db/sql_identifier.d.ts.map +1 -1
- package/dist/db/sql_identifier.js +2 -1
- package/dist/db/status.d.ts +4 -1
- package/dist/db/status.d.ts.map +1 -1
- package/dist/db/status.js +5 -2
- package/dist/dev/setup.d.ts +15 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +15 -2
- package/dist/env/dotenv.d.ts +2 -1
- package/dist/env/dotenv.d.ts.map +1 -1
- package/dist/env/dotenv.js +2 -1
- package/dist/env/load.d.ts +1 -3
- package/dist/env/load.d.ts.map +1 -1
- package/dist/env/load.js +1 -3
- package/dist/env/resolve.d.ts +1 -1
- package/dist/env/resolve.js +1 -1
- package/dist/env/update_env_variable.d.ts +2 -0
- package/dist/env/update_env_variable.d.ts.map +1 -1
- package/dist/env/update_env_variable.js +2 -0
- 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/pending_effects.d.ts +4 -0
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/pending_effects.js +4 -0
- package/dist/http/proxy.d.ts +3 -6
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -6
- package/dist/http/route_spec.d.ts +14 -35
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +17 -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 +30 -1
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +40 -1
- package/dist/realtime/sse.d.ts +7 -2
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +3 -2
- package/dist/realtime/sse_auth_guard.d.ts +21 -21
- package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
- package/dist/realtime/sse_auth_guard.js +24 -24
- package/dist/realtime/subscriber_registry.d.ts +4 -5
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +4 -5
- package/dist/runtime/fs.d.ts +5 -3
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +5 -3
- package/dist/runtime/mock.d.ts +6 -3
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +6 -3
- package/dist/server/app_backend.d.ts +1 -0
- package/dist/server/app_backend.d.ts.map +1 -1
- package/dist/server/app_backend.js +1 -0
- package/dist/server/app_server.d.ts +31 -5
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +23 -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 +3 -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 +5 -1
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +8 -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 +5 -4
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +5 -4
- package/dist/testing/adversarial_input.d.ts +4 -2
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +4 -2
- package/dist/testing/app_server.d.ts +25 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +11 -2
- package/dist/testing/assertions.d.ts +23 -11
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +23 -11
- 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 +4 -1
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -1
- package/dist/testing/auth_apps.d.ts +5 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +5 -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 +9 -7
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +9 -7
- package/dist/testing/error_coverage.d.ts +9 -14
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +9 -14
- package/dist/testing/integration.d.ts +4 -1
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -1
- package/dist/testing/integration_helpers.d.ts +5 -34
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +5 -41
- package/dist/testing/middleware.d.ts +5 -10
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -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 +3 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -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 +21 -14
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +21 -14
- 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 +5 -3
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +22 -3
- package/dist/testing/sse_round_trip.d.ts +3 -1
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +3 -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 +8 -3
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +10 -3
- package/dist/testing/surface_invariants.d.ts +14 -3
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +14 -3
- package/dist/testing/ws_round_trip.d.ts +13 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/ui/AccountSessions.svelte +9 -0
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte +10 -0
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAuditLog.svelte +10 -0
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte +9 -0
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
- package/dist/ui/AdminOverview.svelte +10 -0
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminPermitHistory.svelte +9 -0
- package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSessions.svelte +10 -0
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSettings.svelte +9 -0
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSurface.svelte +9 -0
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
- package/dist/ui/AppShell.svelte +24 -0
- package/dist/ui/AppShell.svelte.d.ts +23 -0
- package/dist/ui/AppShell.svelte.d.ts.map +1 -1
- package/dist/ui/BootstrapForm.svelte +17 -0
- package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/CLAUDE.md +1 -1
- package/dist/ui/ColumnLayout.svelte +11 -0
- package/dist/ui/ColumnLayout.svelte.d.ts +10 -0
- package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -1
- package/dist/ui/Datatable.svelte +18 -0
- package/dist/ui/Datatable.svelte.d.ts +17 -0
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/LoginForm.svelte +18 -0
- package/dist/ui/LoginForm.svelte.d.ts +9 -0
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
- package/dist/ui/LogoutButton.svelte +9 -0
- package/dist/ui/LogoutButton.svelte.d.ts +8 -0
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
- package/dist/ui/MenuLink.svelte +10 -0
- package/dist/ui/MenuLink.svelte.d.ts +9 -0
- package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte +9 -0
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +16 -0
- package/dist/ui/SignupForm.svelte.d.ts +4 -0
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte +9 -0
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.d.ts +6 -1
- package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
- package/dist/ui/audit_log_state.svelte.js +7 -2
- package/dist/ui/auth_state.svelte.d.ts +16 -4
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +16 -4
- package/dist/ui/form_state.svelte.d.ts +9 -0
- package/dist/ui/form_state.svelte.d.ts.map +1 -1
- package/dist/ui/form_state.svelte.js +9 -0
- package/dist/ui/loadable.svelte.d.ts +6 -1
- package/dist/ui/loadable.svelte.d.ts.map +1 -1
- package/dist/ui/loadable.svelte.js +6 -1
- package/dist/ui/permit_offers_state.svelte.d.ts +2 -0
- package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/permit_offers_state.svelte.js +2 -0
- package/dist/ui/popover.svelte.d.ts +17 -4
- package/dist/ui/popover.svelte.d.ts.map +1 -1
- package/dist/ui/popover.svelte.js +17 -4
- package/dist/ui/position_helpers.d.ts +1 -3
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +1 -3
- package/dist/ui/sidebar_state.svelte.d.ts +21 -9
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +16 -2
- package/dist/ui/table_state.svelte.d.ts +14 -0
- package/dist/ui/table_state.svelte.d.ts.map +1 -1
- package/dist/ui/table_state.svelte.js +14 -0
- 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
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# actions/ — SAES (Symmetric Action Event System)
|
|
2
2
|
|
|
3
|
-
One declarative `ActionSpec` shape — `{method, kind, initiator, auth, side_effects, input, output, async, description}` — binds to three
|
|
3
|
+
One declarative `ActionSpec` shape — `{method, kind, initiator, auth, side_effects, input, output, async, description, streams?, error_reasons?}` — binds to three
|
|
4
4
|
transport surfaces (REST, JSON-RPC, WebSocket) with uniform DEV-only output
|
|
5
5
|
validation and symmetric send/receive. This directory holds the spec types,
|
|
6
6
|
registry, codegen helpers, both transport bridges, the single-endpoint RPC
|
|
@@ -19,10 +19,10 @@ IMPORTANT: Every exported Zod schema is paired with a same-named `z.infer`
|
|
|
19
19
|
type export. When adding new schemas, keep the pair invariant — it is the
|
|
20
20
|
convention callers rely on for type imports.
|
|
21
21
|
|
|
22
|
-
NOTE:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
NOTE: `ActionRegistry` keeps a few pre-built getters (auth filters,
|
|
23
|
+
initiator-direction filters) that codegen doesn't consume today — kept
|
|
24
|
+
low-cost for future filtering. Bridge, RPC endpoint, and per-derivation
|
|
25
|
+
codegen helpers are post-SAES-RPC-closeout stable.
|
|
26
26
|
|
|
27
27
|
## Action specs (`action_spec.ts`)
|
|
28
28
|
|
|
@@ -47,6 +47,36 @@ Optional `streams?: string` names a companion `remote_notification` method
|
|
|
47
47
|
emitted as request-scoped progress. Transport-agnostic handshake —
|
|
48
48
|
registry-time validation that the named method exists is a consumer concern.
|
|
49
49
|
|
|
50
|
+
Optional `error_reasons?: ReadonlyArray<string>` declares the reason codes a
|
|
51
|
+
handler may surface via `error.data.reason`. Same precedent as `streams`:
|
|
52
|
+
declarative metadata for consumers (codegen, UI form-state matching, docs)
|
|
53
|
+
to read off the spec instead of scanning handler code. No runtime
|
|
54
|
+
enforcement — drift between declared reasons and what handlers actually
|
|
55
|
+
throw is caught per-module by source-scanning unit tests (see
|
|
56
|
+
`../../test/auth/permit_offer_actions.error_reasons.test.ts`). Reuses
|
|
57
|
+
the same `as const` string constants the handler throws (e.g.
|
|
58
|
+
`ERROR_OFFER_*` from `../auth/permit_offer_action_specs.ts`,
|
|
59
|
+
`ERROR_PERMIT_NOT_FOUND` from `../http/error_schemas.ts`) so call
|
|
60
|
+
sites can import either side. Standard transport errors (validation,
|
|
61
|
+
auth, rate-limit) stay implicit.
|
|
62
|
+
|
|
63
|
+
Optional `rate_limit?: 'ip' | 'account' | 'both'` opts the action into
|
|
64
|
+
the dispatcher's per-action rate-limit hook. Same hook fires on the HTTP
|
|
65
|
+
RPC dispatcher (`create_rpc_endpoint`) and the WebSocket dispatcher
|
|
66
|
+
(`register_action_ws`) — one budget per action, not per transport.
|
|
67
|
+
`'ip'` keys on the resolved client IP; `'account'` keys on
|
|
68
|
+
`request_context.actor.id` (post-auth) and is rejected at registration
|
|
69
|
+
when paired with `auth: 'public'` (no actor to key on); `'both'` runs
|
|
70
|
+
both checks. **Throttle-requests semantics** — every invocation records,
|
|
71
|
+
regardless of outcome (different from REST login's throttle-failures
|
|
72
|
+
that resets on success). The motivating threat is admin mutation oracles
|
|
73
|
+
(`invite_create` account-existence probe) where the _successful_
|
|
74
|
+
invocation is the threat. Limiters are configured at server-assembly
|
|
75
|
+
time via `AppServerOptions.action_ip_rate_limiter` /
|
|
76
|
+
`action_account_rate_limiter` and threaded into both dispatchers
|
|
77
|
+
automatically; consumers wiring `register_action_ws` directly forward
|
|
78
|
+
the same limiters from `AppServerContext`.
|
|
79
|
+
|
|
50
80
|
Canonical spec shape: module-scope declaration with `satisfies` +
|
|
51
81
|
`{method}_action_spec` naming, preserving the literal `method` type and
|
|
52
82
|
dropping per-spec `*_METHOD` constants (readers dereference `.method` at
|
|
@@ -80,8 +110,11 @@ The remaining asymmetry today is runtime: there is no
|
|
|
80
110
|
`create_backend_rpc_client` and `create_broadcast_api` returns
|
|
81
111
|
`Promise<void>` (fire-and-forget broadcast) rather than the
|
|
82
112
|
`Promise<Result<{value}, {error}>>` shape `FrontendActionsApi` methods
|
|
83
|
-
return. Closing those gaps is
|
|
84
|
-
|
|
113
|
+
return. Closing those gaps is on the deferred follow-up set in the
|
|
114
|
+
[SAES RPC closeout](https://github.com/ryanatkn/grimoire/blob/main/quests/HISTORY.md#saes-rpc-direction-2026-04)
|
|
115
|
+
(grimoire `lore/fuz_app/TODO.md` § Future Directions tracks the symmetric
|
|
116
|
+
backend signature, backend RPC client, and local-call symmetry items) —
|
|
117
|
+
wait for a second backend runtime case.
|
|
85
118
|
|
|
86
119
|
`ActionRegistry(specs)` is a query/filter wrapper over `ActionSpecUnion[]`.
|
|
87
120
|
Codegen-used getter groups:
|
|
@@ -105,8 +138,8 @@ Codegen-used getter groups:
|
|
|
105
138
|
`request_response` join): `backend_initiated_specs`,
|
|
106
139
|
`backend_initiated_methods`.
|
|
107
140
|
|
|
108
|
-
Other getters (auth, initiator-direction) are pre-built
|
|
109
|
-
|
|
141
|
+
Other getters (auth filters, initiator-direction filters) are pre-built
|
|
142
|
+
API surface unused by codegen today.
|
|
110
143
|
|
|
111
144
|
`action_codegen.ts` provides gen helpers (used by consumer `*.gen.ts` files,
|
|
112
145
|
not the runtime):
|
|
@@ -176,7 +209,7 @@ and `FrontendActionHandlers`.
|
|
|
176
209
|
- `generate_action_event_datas(specs, imports, {same_file?, collections_path?, include_protocol_actions?})` — `ActionEventDatas` interface; per-spec variant by kind (`ActionEventRequestResponseData` / `ActionEventRemoteNotificationData` / `ActionEventLocalCallData`). `same_file` (default `true`) is the file-layout switch: when `true`, assumes `ActionInputs` / `ActionOutputs` are in the same module and adds no import (the zzz pattern); when `false`, adds the type imports from `collections_path` (default `'./action_collections.js'`). `collections_path` alone is a no-op — the surprising omit-vs-default behavior of earlier versions has been replaced.
|
|
177
210
|
- `generate_frontend_actions_api(specs, imports, {interface_name?, method_filter?, collections_path?, sync_returns_value?, include_protocol_actions?})` — emits the typed `FrontendActionsApi` interface (configurable via `interface_name`, default `'FrontendActionsApi'`). One method signature per spec via `generate_actions_api_method_signature`. Protocol actions filtered by default; `method_filter: (spec) => boolean` runs after the protocol-action filter. Renamed from `generate_actions_api` in API review III to make the side-of-the-wire intent visible at every consumer site.
|
|
178
211
|
- `generate_frontend_action_handlers(specs, imports, {collections_path?, include_protocol_actions?})` — `FrontendActionHandlers` interface (Tier 2 only — wraps `generate_phase_handlers` with `action_event_type: 'TypedActionEvent'`). Pair with `generate_typed_action_event_alias`.
|
|
179
|
-
- `generate_backend_actions_api(specs, imports, {interface_name?, spec_array_name?, specs_module?, collections_path?, qualify_spec?, include_protocol_actions?})` — `BackendActionsApi` interface AND `broadcast_action_specs: ReadonlyArray<ActionSpecUnion>` array (both names configurable). Filter: `kind === 'remote_notification' && initiator !== 'frontend'`, with `streams`-target methods (request-scoped progress notifications invoked via `ctx.notify`) excluded — the discriminator is `ActionSpec.streams`, not a manual list. Adds `ActionInputs` (from `collections_path`) + `ActionSpecUnion`, plus `* as specs` from `specs_module` unless `qualify_spec` is set. Method shape today is `(input) => Promise<void>` (matches `create_broadcast_api`'s fire-and-forget runtime); generalizing to per-kind shapes via `generate_actions_api_method_signature` is deferred until a second backend runtime constructor lands (
|
|
212
|
+
- `generate_backend_actions_api(specs, imports, {interface_name?, spec_array_name?, specs_module?, collections_path?, qualify_spec?, include_protocol_actions?})` — `BackendActionsApi` interface AND `broadcast_action_specs: ReadonlyArray<ActionSpecUnion>` array (both names configurable). Filter: `kind === 'remote_notification' && initiator !== 'frontend'`, with `streams`-target methods (request-scoped progress notifications invoked via `ctx.notify`) excluded — the discriminator is `ActionSpec.streams`, not a manual list. Adds `ActionInputs` (from `collections_path`) + `ActionSpecUnion`, plus `* as specs` from `specs_module` unless `qualify_spec` is set. Method shape today is `(input) => Promise<void>` (matches `create_broadcast_api`'s fire-and-forget runtime); generalizing to per-kind shapes via `generate_actions_api_method_signature` is deferred until a second backend runtime constructor lands (tracked in grimoire `lore/fuz_app/TODO.md` § Future Directions, _Symmetric backend signature shape_).
|
|
180
213
|
- `generate_backend_action_handlers_map(imports, options?)` — emits the `BackendActionHandlers` mapped type (`{[K in BackendRequestResponseMethod]: (input: ActionInputs[K], ctx: BackendHandlerContext) => ActionOutputs[K] | Promise<ActionOutputs[K]>}`). Replaces the hand-maintained `Exclude<>` + parallel mapped-type pattern (zzz had this at `zzz/src/lib/server/zzz_action_handlers.ts:42-66`). Configurable type name, method enum name, and context type name; configurable `collections_path` / `metatypes_path` for the type imports.
|
|
181
214
|
|
|
182
215
|
### Wrapper + multi-source helper
|
|
@@ -49,7 +49,8 @@ export declare const derive_http_method: (side_effects: ActionSideEffects) => Ro
|
|
|
49
49
|
* @param spec - the action spec (must have non-null `auth`)
|
|
50
50
|
* @param options - HTTP-specific options (path, handler, optional overrides)
|
|
51
51
|
* @returns a `RouteSpec` ready for `apply_route_specs`
|
|
52
|
-
* @throws if `spec.auth` is null
|
|
52
|
+
* @throws Error if `spec.auth` is null (only `request_response` actions can
|
|
53
|
+
* become routes; notifications and local calls cannot)
|
|
53
54
|
*/
|
|
54
55
|
export declare const create_action_route_spec: (spec: ActionSpec, options: ActionRouteOptions) => RouteSpec;
|
|
55
56
|
/**
|
|
@@ -60,6 +61,7 @@ export declare const create_action_route_spec: (spec: ActionSpec, options: Actio
|
|
|
60
61
|
* @param spec - the action spec (must have `kind: 'remote_notification'`)
|
|
61
62
|
* @param options - optional event-specific options (channel)
|
|
62
63
|
* @returns an `EventSpec` ready for `create_validated_broadcaster`
|
|
64
|
+
* @throws Error if `spec.kind` is not `'remote_notification'`
|
|
63
65
|
*/
|
|
64
66
|
export declare const create_action_event_spec: (spec: ActionSpec, options?: ActionEventOptions) => EventSpec;
|
|
65
67
|
//# sourceMappingURL=action_bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_bridge.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAC,UAAU,EAAE,UAAU,IAAI,cAAc,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAC3F,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;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E,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;IACtB,uGAAuG;IACvG,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACpB,mFAAmF;IACnF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,+IAA+I;IAC/I,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,8GAA8G;IAC9G,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,kDAAkD;AAClD,eAAO,MAAM,eAAe,GAAI,MAAM,cAAc,KAAG,SAKtD,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,GAAI,cAAc,iBAAiB,KAAG,WAEpE,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,UAAU,EAChB,SAAS,kBAAkB,KACzB,SAmBF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,UAAU,EAChB,UAAU,kBAAkB,KAC1B,SAYF,CAAC"}
|
|
@@ -35,7 +35,8 @@ export const derive_http_method = (side_effects) => {
|
|
|
35
35
|
* @param spec - the action spec (must have non-null `auth`)
|
|
36
36
|
* @param options - HTTP-specific options (path, handler, optional overrides)
|
|
37
37
|
* @returns a `RouteSpec` ready for `apply_route_specs`
|
|
38
|
-
* @throws if `spec.auth` is null
|
|
38
|
+
* @throws Error if `spec.auth` is null (only `request_response` actions can
|
|
39
|
+
* become routes; notifications and local calls cannot)
|
|
39
40
|
*/
|
|
40
41
|
export const create_action_route_spec = (spec, options) => {
|
|
41
42
|
if (spec.auth === null) {
|
|
@@ -63,6 +64,7 @@ export const create_action_route_spec = (spec, options) => {
|
|
|
63
64
|
* @param spec - the action spec (must have `kind: 'remote_notification'`)
|
|
64
65
|
* @param options - optional event-specific options (channel)
|
|
65
66
|
* @returns an `EventSpec` ready for `create_validated_broadcaster`
|
|
67
|
+
* @throws Error if `spec.kind` is not `'remote_notification'`
|
|
66
68
|
*/
|
|
67
69
|
export const create_action_event_spec = (spec, options) => {
|
|
68
70
|
if (spec.kind !== 'remote_notification') {
|
|
@@ -22,9 +22,6 @@ export type ProtocolActionMethod = (typeof PROTOCOL_ACTION_METHODS)[number];
|
|
|
22
22
|
* });
|
|
23
23
|
*/
|
|
24
24
|
export declare const is_protocol_action_method: (method: string) => method is ProtocolActionMethod;
|
|
25
|
-
/**
|
|
26
|
-
* Represents an import item with its kind (type, value, or namespace).
|
|
27
|
-
*/
|
|
28
25
|
interface ImportItem {
|
|
29
26
|
name: string;
|
|
30
27
|
kind: 'type' | 'value' | 'namespace';
|
|
@@ -56,51 +53,41 @@ export declare class ImportBuilder {
|
|
|
56
53
|
#private;
|
|
57
54
|
imports: Map<string, Map<string, ImportItem>>;
|
|
58
55
|
/**
|
|
59
|
-
* Add a value import
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
56
|
+
* Add a value import. Accepts `* as ns` strings as namespace imports.
|
|
57
|
+
*
|
|
58
|
+
* @returns `this` for chaining
|
|
59
|
+
* @mutates this - inserts into the internal `imports` map
|
|
62
60
|
*/
|
|
63
61
|
add(from: string, what: string): this;
|
|
64
62
|
/**
|
|
65
|
-
* Add a type import
|
|
66
|
-
*
|
|
67
|
-
* @
|
|
63
|
+
* Add a type-only import.
|
|
64
|
+
*
|
|
65
|
+
* @returns `this` for chaining
|
|
66
|
+
* @mutates this - inserts into the internal `imports` map (downgrade to
|
|
67
|
+
* type is suppressed if already registered as a value)
|
|
68
68
|
*/
|
|
69
69
|
add_type(from: string, what: string): this;
|
|
70
|
-
/**
|
|
71
|
-
* Add multiple value imports from the same module.
|
|
72
|
-
*/
|
|
73
70
|
add_many(from: string, ...items: Array<string>): this;
|
|
74
|
-
/**
|
|
75
|
-
* Add multiple type imports from the same module.
|
|
76
|
-
*/
|
|
77
71
|
add_types(from: string, ...items: Array<string>): this;
|
|
78
72
|
/**
|
|
79
|
-
* Generate the import statements.
|
|
80
|
-
*
|
|
73
|
+
* Generate the import statements. When every import from a module is a
|
|
74
|
+
* type, emits `import type {…}` so the whole statement disappears at
|
|
75
|
+
* compile time.
|
|
81
76
|
*/
|
|
82
77
|
build(): string;
|
|
83
|
-
/**
|
|
84
|
-
* Check if the builder has any imports.
|
|
85
|
-
*/
|
|
86
78
|
has_imports(): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Get the number of import statements that will be generated.
|
|
89
|
-
*/
|
|
90
79
|
get import_count(): number;
|
|
91
|
-
/**
|
|
92
|
-
* Preview what imports will be generated (useful for debugging).
|
|
93
|
-
* @returns array of import statement strings
|
|
94
|
-
*/
|
|
80
|
+
/** Build the same statement list as `build` without joining — for inspection in tests. */
|
|
95
81
|
preview(): Array<string>;
|
|
96
82
|
/**
|
|
97
83
|
* Clear all imports.
|
|
84
|
+
*
|
|
85
|
+
* @returns `this` for chaining
|
|
86
|
+
* @mutates this - empties the internal `imports` map
|
|
98
87
|
*/
|
|
99
88
|
clear(): this;
|
|
100
89
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Determines which phases an executor can handle based on the action spec.
|
|
103
|
-
*/
|
|
90
|
+
/** Phases an executor can handle for the given spec — kind + initiator → set of phases. */
|
|
104
91
|
export declare const get_executor_phases: (spec: ActionSpecUnion, executor: "frontend" | "backend") => Array<ActionEventPhase>;
|
|
105
92
|
/** Default `collections_path` — every consumer's gen producers point at the sibling `action_collections.js`. */
|
|
106
93
|
export declare const DEFAULT_COLLECTIONS_PATH = "./action_collections.js";
|
|
@@ -129,16 +116,14 @@ export declare const get_handler_return_type: (spec: ActionSpecUnion, phase: Act
|
|
|
129
116
|
*
|
|
130
117
|
* @param options.action_event_type - custom type name to use instead of `ActionEvent`
|
|
131
118
|
* (consumers can define a narrowed type that carries typed input/output via their codegen maps)
|
|
132
|
-
* @param options.collections_path -
|
|
119
|
+
* @param options.collections_path - Import path the side-effect `ActionOutputs` import
|
|
133
120
|
* resolves to. Defaults to `'./action_collections.js'`.
|
|
134
121
|
*/
|
|
135
122
|
export declare const generate_phase_handlers: (spec: ActionSpecUnion, executor: "frontend" | "backend", imports: ImportBuilder, options?: {
|
|
136
123
|
action_event_type?: string;
|
|
137
124
|
collections_path?: string;
|
|
138
125
|
}) => string;
|
|
139
|
-
/**
|
|
140
|
-
* Creates a file banner comment.
|
|
141
|
-
*/
|
|
126
|
+
/** "DO NOT EDIT" banner naming the gen producer. */
|
|
142
127
|
export declare const create_banner: (origin_path: string) => string;
|
|
143
128
|
export declare const to_action_spec_identifier: (method: string) => string;
|
|
144
129
|
export declare const to_action_spec_input_identifier: (method: string) => string;
|
|
@@ -169,13 +154,11 @@ export declare const to_action_spec_output_identifier: (method: string) => strin
|
|
|
169
154
|
* follows so wrappers no longer pre-register imports a per-spec emit might
|
|
170
155
|
* not actually use.
|
|
171
156
|
*
|
|
172
|
-
* @param
|
|
173
|
-
* @param imports - import builder to register references on
|
|
174
|
-
* @param options.sync_returns_value - when true (default), sync local_call
|
|
157
|
+
* @param options.sync_returns_value - When true (default), sync `local_call`
|
|
175
158
|
* methods return the output value directly; when false they're wrapped in
|
|
176
159
|
* `Result<{value, error}>` like async methods. Set to `false` if your
|
|
177
|
-
* FrontendActionsApi treats every method uniformly.
|
|
178
|
-
* @param options.collections_path -
|
|
160
|
+
* `FrontendActionsApi` treats every method uniformly.
|
|
161
|
+
* @param options.collections_path - Import path that `ActionInputs` /
|
|
179
162
|
* `ActionOutputs` resolve to. Defaults to `'./action_collections.js'`.
|
|
180
163
|
* @returns one line like `foo: (input: ActionInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
|
|
181
164
|
*/
|
|
@@ -368,7 +351,7 @@ export declare const generate_frontend_action_handlers: (specs: ReadonlyArray<Ac
|
|
|
368
351
|
* Method signature shape today is `(input) => Promise<void>` — matches the
|
|
369
352
|
* fire-and-forget runtime of `create_broadcast_api`. Generalizing per-kind
|
|
370
353
|
* via `generate_actions_api_method_signature` is deferred until a second
|
|
371
|
-
* backend runtime constructor lands
|
|
354
|
+
* backend runtime constructor lands.
|
|
372
355
|
*
|
|
373
356
|
* @param options.qualify_spec - per-spec qualified identifier callback for
|
|
374
357
|
* multi-source consumers. When set, the helper emits the callback's return
|
|
@@ -434,6 +417,11 @@ export interface SpecSource {
|
|
|
434
417
|
* per-call callback wasn't enough; the import dance + dup-check was the
|
|
435
418
|
* real boilerplate.
|
|
436
419
|
*
|
|
420
|
+
* @throws Error if two sources contain the same method name (same-method
|
|
421
|
+
* detection is the consumer's primary debugging signal). Also throws if
|
|
422
|
+
* the returned `qualify_spec` is later called with a method not registered
|
|
423
|
+
* in any source.
|
|
424
|
+
*
|
|
437
425
|
* @example
|
|
438
426
|
* ```ts
|
|
439
427
|
* const sources = [
|
|
@@ -454,9 +442,6 @@ export interface SpecSource {
|
|
|
454
442
|
* });
|
|
455
443
|
* };
|
|
456
444
|
* ```
|
|
457
|
-
*
|
|
458
|
-
* @throws if two sources contain the same method name (same-method detection
|
|
459
|
-
* is the consumer's primary debugging signal).
|
|
460
445
|
*/
|
|
461
446
|
export declare const create_namespace_qualifier: (sources: ReadonlyArray<SpecSource>, imports: ImportBuilder) => {
|
|
462
447
|
qualify_spec: (spec: ActionSpecUnion) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_codegen.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_codegen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAGxE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,kCAAmC,CAAC;AAExE,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAI5E;;;;;;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|
|
@@ -49,9 +49,10 @@ export const is_protocol_action_method = (method) => PROTOCOL_METHOD_SET.has(met
|
|
|
49
49
|
export class ImportBuilder {
|
|
50
50
|
imports = new Map();
|
|
51
51
|
/**
|
|
52
|
-
* Add a value import
|
|
53
|
-
*
|
|
54
|
-
* @
|
|
52
|
+
* Add a value import. Accepts `* as ns` strings as namespace imports.
|
|
53
|
+
*
|
|
54
|
+
* @returns `this` for chaining
|
|
55
|
+
* @mutates this - inserts into the internal `imports` map
|
|
55
56
|
*/
|
|
56
57
|
add(from, what) {
|
|
57
58
|
// Handle namespace imports specially
|
|
@@ -61,34 +62,27 @@ export class ImportBuilder {
|
|
|
61
62
|
return this.#add_import(from, what, 'value');
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
|
-
* Add a type import
|
|
65
|
-
*
|
|
66
|
-
* @
|
|
65
|
+
* Add a type-only import.
|
|
66
|
+
*
|
|
67
|
+
* @returns `this` for chaining
|
|
68
|
+
* @mutates this - inserts into the internal `imports` map (downgrade to
|
|
69
|
+
* type is suppressed if already registered as a value)
|
|
67
70
|
*/
|
|
68
71
|
add_type(from, what) {
|
|
69
72
|
return this.#add_import(from, what, 'type');
|
|
70
73
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Add multiple value imports from the same module.
|
|
73
|
-
*/
|
|
74
74
|
add_many(from, ...items) {
|
|
75
75
|
for (const item of items) {
|
|
76
76
|
this.add(from, item);
|
|
77
77
|
}
|
|
78
78
|
return this;
|
|
79
79
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Add multiple type imports from the same module.
|
|
82
|
-
*/
|
|
83
80
|
add_types(from, ...items) {
|
|
84
81
|
for (const item of items) {
|
|
85
82
|
this.add_type(from, item);
|
|
86
83
|
}
|
|
87
84
|
return this;
|
|
88
85
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Internal method to add an import with its kind.
|
|
91
|
-
*/
|
|
92
86
|
#add_import(from, name, kind) {
|
|
93
87
|
// Skip empty imports
|
|
94
88
|
if (!name || (kind !== 'namespace' && name === '')) {
|
|
@@ -107,42 +101,33 @@ export class ImportBuilder {
|
|
|
107
101
|
return this;
|
|
108
102
|
}
|
|
109
103
|
/**
|
|
110
|
-
* Generate the import statements.
|
|
111
|
-
*
|
|
104
|
+
* Generate the import statements. When every import from a module is a
|
|
105
|
+
* type, emits `import type {…}` so the whole statement disappears at
|
|
106
|
+
* compile time.
|
|
112
107
|
*/
|
|
113
108
|
build() {
|
|
114
109
|
return this.#generate_import_statements().join('\n');
|
|
115
110
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Check if the builder has any imports.
|
|
118
|
-
*/
|
|
119
111
|
has_imports() {
|
|
120
112
|
return this.imports.size > 0;
|
|
121
113
|
}
|
|
122
|
-
/**
|
|
123
|
-
* Get the number of import statements that will be generated.
|
|
124
|
-
*/
|
|
125
114
|
get import_count() {
|
|
126
115
|
return this.imports.size;
|
|
127
116
|
}
|
|
128
|
-
/**
|
|
129
|
-
* Preview what imports will be generated (useful for debugging).
|
|
130
|
-
* @returns array of import statement strings
|
|
131
|
-
*/
|
|
117
|
+
/** Build the same statement list as `build` without joining — for inspection in tests. */
|
|
132
118
|
preview() {
|
|
133
119
|
return this.#generate_import_statements();
|
|
134
120
|
}
|
|
135
121
|
/**
|
|
136
122
|
* Clear all imports.
|
|
123
|
+
*
|
|
124
|
+
* @returns `this` for chaining
|
|
125
|
+
* @mutates this - empties the internal `imports` map
|
|
137
126
|
*/
|
|
138
127
|
clear() {
|
|
139
128
|
this.imports.clear();
|
|
140
129
|
return this;
|
|
141
130
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Internal helper to generate import statements from the current state.
|
|
144
|
-
* Shared by both build() and preview() methods.
|
|
145
|
-
*/
|
|
146
131
|
#generate_import_statements() {
|
|
147
132
|
const statements = [];
|
|
148
133
|
for (const [from, module_imports] of this.imports) {
|
|
@@ -185,9 +170,7 @@ export class ImportBuilder {
|
|
|
185
170
|
return statements;
|
|
186
171
|
}
|
|
187
172
|
}
|
|
188
|
-
/**
|
|
189
|
-
* Determines which phases an executor can handle based on the action spec.
|
|
190
|
-
*/
|
|
173
|
+
/** Phases an executor can handle for the given spec — kind + initiator → set of phases. */
|
|
191
174
|
export const get_executor_phases = (spec, executor) => {
|
|
192
175
|
const { kind, initiator } = spec;
|
|
193
176
|
const phases = [];
|
|
@@ -214,9 +197,9 @@ export const get_executor_phases = (spec, executor) => {
|
|
|
214
197
|
}
|
|
215
198
|
if (can_receive) {
|
|
216
199
|
phases.push('receive_request', 'send_response');
|
|
217
|
-
// TODO
|
|
218
|
-
// (already
|
|
219
|
-
//
|
|
200
|
+
// TODO consolidate — `send_error` is added redundantly when
|
|
201
|
+
// initiator:'both' (already pushed above); the trailing Set dedup
|
|
202
|
+
// handles it.
|
|
220
203
|
phases.push('send_error');
|
|
221
204
|
}
|
|
222
205
|
break;
|
|
@@ -289,7 +272,7 @@ export const get_handler_return_type = (spec, phase, imports, collections_path =
|
|
|
289
272
|
*
|
|
290
273
|
* @param options.action_event_type - custom type name to use instead of `ActionEvent`
|
|
291
274
|
* (consumers can define a narrowed type that carries typed input/output via their codegen maps)
|
|
292
|
-
* @param options.collections_path -
|
|
275
|
+
* @param options.collections_path - Import path the side-effect `ActionOutputs` import
|
|
293
276
|
* resolves to. Defaults to `'./action_collections.js'`.
|
|
294
277
|
*/
|
|
295
278
|
export const generate_phase_handlers = (spec, executor, imports, options) => {
|
|
@@ -315,9 +298,7 @@ export const generate_phase_handlers = (spec, executor, imports, options) => {
|
|
|
315
298
|
.join(';\n\t\t');
|
|
316
299
|
return `${method}?: {\n\t\t${phase_handlers};\n\t}`;
|
|
317
300
|
};
|
|
318
|
-
/**
|
|
319
|
-
* Creates a file banner comment.
|
|
320
|
-
*/
|
|
301
|
+
/** "DO NOT EDIT" banner naming the gen producer. */
|
|
321
302
|
export const create_banner = (origin_path) => `generated by ${origin_path} - DO NOT EDIT OR RISK LOST DATA`;
|
|
322
303
|
// TODO rethink these, see also zzz `codegen.ts`
|
|
323
304
|
export const to_action_spec_identifier = (method) => `${method}_action_spec`;
|
|
@@ -349,13 +330,11 @@ export const to_action_spec_output_identifier = (method) => `${to_action_spec_id
|
|
|
349
330
|
* follows so wrappers no longer pre-register imports a per-spec emit might
|
|
350
331
|
* not actually use.
|
|
351
332
|
*
|
|
352
|
-
* @param
|
|
353
|
-
* @param imports - import builder to register references on
|
|
354
|
-
* @param options.sync_returns_value - when true (default), sync local_call
|
|
333
|
+
* @param options.sync_returns_value - When true (default), sync `local_call`
|
|
355
334
|
* methods return the output value directly; when false they're wrapped in
|
|
356
335
|
* `Result<{value, error}>` like async methods. Set to `false` if your
|
|
357
|
-
* FrontendActionsApi treats every method uniformly.
|
|
358
|
-
* @param options.collections_path -
|
|
336
|
+
* `FrontendActionsApi` treats every method uniformly.
|
|
337
|
+
* @param options.collections_path - Import path that `ActionInputs` /
|
|
359
338
|
* `ActionOutputs` resolve to. Defaults to `'./action_collections.js'`.
|
|
360
339
|
* @returns one line like `foo: (input: ActionInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
|
|
361
340
|
*/
|
|
@@ -839,7 +818,7 @@ ${lines};
|
|
|
839
818
|
* Method signature shape today is `(input) => Promise<void>` — matches the
|
|
840
819
|
* fire-and-forget runtime of `create_broadcast_api`. Generalizing per-kind
|
|
841
820
|
* via `generate_actions_api_method_signature` is deferred until a second
|
|
842
|
-
* backend runtime constructor lands
|
|
821
|
+
* backend runtime constructor lands.
|
|
843
822
|
*
|
|
844
823
|
* @param options.qualify_spec - per-spec qualified identifier callback for
|
|
845
824
|
* multi-source consumers. When set, the helper emits the callback's return
|
|
@@ -936,6 +915,11 @@ export type ${type_name} = {
|
|
|
936
915
|
* per-call callback wasn't enough; the import dance + dup-check was the
|
|
937
916
|
* real boilerplate.
|
|
938
917
|
*
|
|
918
|
+
* @throws Error if two sources contain the same method name (same-method
|
|
919
|
+
* detection is the consumer's primary debugging signal). Also throws if
|
|
920
|
+
* the returned `qualify_spec` is later called with a method not registered
|
|
921
|
+
* in any source.
|
|
922
|
+
*
|
|
939
923
|
* @example
|
|
940
924
|
* ```ts
|
|
941
925
|
* const sources = [
|
|
@@ -956,9 +940,6 @@ export type ${type_name} = {
|
|
|
956
940
|
* });
|
|
957
941
|
* };
|
|
958
942
|
* ```
|
|
959
|
-
*
|
|
960
|
-
* @throws if two sources contain the same method name (same-method detection
|
|
961
|
-
* is the consumer's primary debugging signal).
|
|
962
943
|
*/
|
|
963
944
|
export const create_namespace_qualifier = (sources, imports) => {
|
|
964
945
|
const method_to_ns = new Map();
|
|
@@ -33,22 +33,60 @@ export declare class ActionEvent<TMethod extends string = string, TPhase extends
|
|
|
33
33
|
};
|
|
34
34
|
constructor(environment: ActionEventEnvironment, spec: ActionSpecUnion, data: ActionEventDataUnion<TMethod>);
|
|
35
35
|
toJSON(): ActionEventDataUnion<TMethod>;
|
|
36
|
+
/**
|
|
37
|
+
* Subscribe a listener fired on every `data` transition.
|
|
38
|
+
*
|
|
39
|
+
* @param listener - called with `(new_data, old_data, event)` after each mutation
|
|
40
|
+
* @returns unsubscribe function
|
|
41
|
+
* @mutates this - adds `listener` to the internal observer set
|
|
42
|
+
*/
|
|
36
43
|
observe(listener: ActionEventChangeObserver<TMethod>): () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Replace the event's `data` and notify observers.
|
|
46
|
+
*
|
|
47
|
+
* @mutates this - sets `data` and fires every registered observer in insertion order
|
|
48
|
+
*/
|
|
37
49
|
set_data(new_data: ActionEventDataUnion<TMethod>): void;
|
|
38
50
|
/**
|
|
39
51
|
* Parse input data according to the action's schema.
|
|
52
|
+
*
|
|
53
|
+
* @returns `this` for chaining with `handle_async` / `handle_sync`
|
|
54
|
+
* @mutates this - transitions step from `initial` to `parsed` (or to
|
|
55
|
+
* `failed` / `receive_error` on validation or response error)
|
|
56
|
+
* @throws Error if called from a step other than `initial`
|
|
40
57
|
*/
|
|
41
58
|
parse(): this;
|
|
42
59
|
/**
|
|
43
60
|
* Execute the handler for the current phase.
|
|
61
|
+
*
|
|
62
|
+
* @mutates this - transitions step `parsed → handling → handled`, or to
|
|
63
|
+
* `failed` / `send_error` / `receive_error` on handler throw. No-op
|
|
64
|
+
* when already `failed`.
|
|
65
|
+
* @throws Error if called from a step other than `parsed` (or `failed`,
|
|
66
|
+
* which no-ops). Handler-thrown `ThrownJsonrpcError` is caught and
|
|
67
|
+
* routed through error phases; other throws are wrapped as
|
|
68
|
+
* `internal_error`.
|
|
44
69
|
*/
|
|
45
70
|
handle_async(): Promise<void>;
|
|
46
71
|
/**
|
|
47
|
-
* Execute handler synchronously (only for sync local_call actions).
|
|
72
|
+
* Execute handler synchronously (only for sync `local_call` actions).
|
|
73
|
+
*
|
|
74
|
+
* @mutates this - transitions step `parsed → handling → handled`, or to
|
|
75
|
+
* `failed` on handler throw. No-op when already `failed`.
|
|
76
|
+
* @throws Error if the spec is not a sync `local_call`, or if called
|
|
77
|
+
* from a step other than `parsed` (or `failed`, which no-ops).
|
|
48
78
|
*/
|
|
49
79
|
handle_sync(): void;
|
|
50
80
|
/**
|
|
51
81
|
* Transition to a new phase.
|
|
82
|
+
*
|
|
83
|
+
* @param phase - the next phase to transition into
|
|
84
|
+
* @mutates this - replaces `data` with a fresh phase-initial record,
|
|
85
|
+
* carrying forward `request` / `response` / `error` / `output` as
|
|
86
|
+
* appropriate for the kind/phase pair
|
|
87
|
+
* @throws Error if called from a step other than `handled` (or
|
|
88
|
+
* `failed`, which no-ops), or if the phase transition is illegal for
|
|
89
|
+
* the current phase
|
|
52
90
|
*/
|
|
53
91
|
transition(phase: ActionEventPhase): void;
|
|
54
92
|
is_complete(): boolean;
|
|
@@ -59,10 +97,15 @@ export declare class ActionEvent<TMethod extends string = string, TPhase extends
|
|
|
59
97
|
}
|
|
60
98
|
/**
|
|
61
99
|
* Create an action event from a spec and initial input.
|
|
100
|
+
*
|
|
101
|
+
* @throws Error if `initial_phase` is omitted and the executor cannot
|
|
102
|
+
* initiate the action (per `spec.initiator`)
|
|
62
103
|
*/
|
|
63
104
|
export declare const create_action_event: <TMethod extends string = string>(environment: ActionEventEnvironment, spec: ActionSpecUnion, input: unknown, initial_phase?: ActionEventPhase) => ActionEvent<TMethod>;
|
|
64
105
|
/**
|
|
65
106
|
* Reconstruct an action event from serialized JSON data.
|
|
107
|
+
*
|
|
108
|
+
* @throws Error if the JSON's `method` field has no spec registered in `environment`
|
|
66
109
|
*/
|
|
67
110
|
export declare const create_action_event_from_json: <TMethod extends string = string>(json: ActionEventDataUnion<TMethod>, environment: ActionEventEnvironment) => ActionEvent<TMethod>;
|
|
68
111
|
export declare const parse_action_event: (raw_json: unknown, environment: ActionEventEnvironment) => ActionEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action_event.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_event.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAC,gBAAgB,EAAc,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAWpF,OAAO,KAAK,EACX,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,sBAAsB,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAkB,KAAK,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAclF,MAAM,MAAM,yBAAyB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,IAAI,CACxE,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACvC,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACvC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,KACvB,IAAI,CAAC;AAEV;;GAEG;AACH,qBAAa,WAAW,CACvB,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,EAClD,KAAK,SAAS,eAAe,GAAG,eAAe;;IAK/C,QAAQ,CAAC,WAAW,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