@fuzdev/fuz_app 0.51.0 → 0.52.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 +14 -1
- 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 +18 -8
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +18 -8
- 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 -0
- package/dist/actions/action_registry.d.ts +1 -1
- package/dist/actions/action_registry.js +1 -1
- package/dist/actions/action_rpc.d.ts +4 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +4 -0
- package/dist/actions/action_spec.d.ts +22 -2
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +16 -2
- package/dist/actions/register_action_ws.d.ts +3 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +3 -0
- 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 +14 -1
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +14 -1
- package/dist/actions/socket.svelte.d.ts +35 -15
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +33 -13
- package/dist/actions/transports.d.ts +12 -3
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +16 -7
- 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 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +6 -2
- 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 -1
- package/dist/auth/CLAUDE.md +40 -4
- 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 +10 -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 +7 -0
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +7 -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 +6 -0
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +6 -0
- 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 +4 -0
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +4 -0
- package/dist/auth/permit_offer_action_specs.d.ts +5 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +10 -0
- package/dist/auth/permit_offer_queries.d.ts +19 -0
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +19 -0
- package/dist/auth/permit_queries.d.ts +8 -0
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +8 -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 +3 -0
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +3 -0
- package/dist/auth/session_middleware.d.ts +5 -0
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +5 -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 +2 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +2 -0
- 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 -0
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +3 -0
- package/dist/db/db.d.ts +19 -4
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +18 -3
- package/dist/db/db_pg.d.ts +2 -1
- package/dist/db/db_pg.d.ts.map +1 -1
- package/dist/db/db_pg.js +5 -3
- package/dist/db/db_pglite.d.ts +3 -2
- package/dist/db/db_pglite.d.ts.map +1 -1
- package/dist/db/db_pglite.js +3 -2
- package/dist/db/migrate.d.ts +8 -4
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +6 -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 +18 -2
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +18 -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 -1
- package/dist/env/load.js +1 -1
- 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/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 -0
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +3 -0
- package/dist/http/route_spec.d.ts +1 -0
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +7 -0
- package/dist/rate_limiter.d.ts +14 -1
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +14 -1
- package/dist/realtime/sse.d.ts +7 -1
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +3 -1
- 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 -2
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +4 -2
- package/dist/runtime/fs.d.ts +5 -0
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +5 -0
- package/dist/runtime/mock.d.ts +6 -0
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +6 -0
- 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 +4 -0
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +4 -0
- package/dist/server/validate_nginx.d.ts +3 -0
- package/dist/server/validate_nginx.d.ts.map +1 -1
- package/dist/testing/admin_integration.d.ts +5 -0
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +5 -0
- package/dist/testing/adversarial_headers.d.ts +5 -3
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +5 -3
- package/dist/testing/adversarial_input.d.ts +4 -0
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +4 -0
- package/dist/testing/app_server.d.ts +3 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +11 -0
- package/dist/testing/assertions.d.ts +23 -7
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +23 -7
- package/dist/testing/audit_completeness.d.ts +4 -0
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +4 -0
- package/dist/testing/auth_apps.d.ts +3 -0
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +3 -0
- package/dist/testing/db.d.ts +9 -1
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +9 -1
- package/dist/testing/error_coverage.d.ts +9 -0
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +9 -0
- package/dist/testing/integration.d.ts +4 -0
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -0
- package/dist/testing/integration_helpers.d.ts +10 -4
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +10 -4
- package/dist/testing/middleware.d.ts +5 -0
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +5 -0
- package/dist/testing/rate_limiting.d.ts +3 -0
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +3 -0
- package/dist/testing/rpc_helpers.d.ts +21 -8
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +21 -8
- package/dist/testing/schema_generators.d.ts +7 -2
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +7 -2
- package/dist/testing/sse_round_trip.d.ts +3 -0
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +3 -0
- package/dist/testing/stubs.d.ts +7 -0
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +7 -0
- package/dist/testing/surface_invariants.d.ts +14 -0
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +14 -0
- 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/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 +6 -1
- 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 -0
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +1 -0
- package/dist/ui/sidebar_state.svelte.d.ts +22 -9
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +17 -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/package.json +1 -1
package/dist/testing/db.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface DbFactory {
|
|
|
21
21
|
* The database instance remains usable after reset.
|
|
22
22
|
*
|
|
23
23
|
* @param db - the database to reset
|
|
24
|
+
* @mutates db - drops the `public` schema and recreates it; all rows in all
|
|
25
|
+
* tables are gone after this returns.
|
|
24
26
|
*/
|
|
25
27
|
export declare const reset_pglite: (db: Db) => Promise<void>;
|
|
26
28
|
/**
|
|
@@ -50,7 +52,10 @@ export declare const create_pglite_factory: (init_schema: (db: Db) => Promise<vo
|
|
|
50
52
|
*
|
|
51
53
|
* @param init_schema - callback to initialize the database schema
|
|
52
54
|
* @param test_url - PostgreSQL connection URL (e.g. from `TEST_DATABASE_URL`)
|
|
53
|
-
* @returns a factory that creates pg databases
|
|
55
|
+
* @returns a factory that creates pg databases. The returned `create()`
|
|
56
|
+
* throws when `test_url` is unset (despite the `skip: true` flag — defense
|
|
57
|
+
* against direct invocation), and rewrites Postgres "database does not
|
|
58
|
+
* exist" errors into a `createdb` hint message.
|
|
54
59
|
*/
|
|
55
60
|
export declare const create_pg_factory: (init_schema: (db: Db) => Promise<void>, test_url?: string) => DbFactory;
|
|
56
61
|
/**
|
|
@@ -87,6 +92,7 @@ export declare const AUTH_DROP_TABLES: readonly ["app_settings", "invite", "audi
|
|
|
87
92
|
* PGlite (already fresh), but harmless to call unconditionally.
|
|
88
93
|
*
|
|
89
94
|
* @param db - the database to clean
|
|
95
|
+
* @mutates db - drops every table in `AUTH_DROP_TABLES` plus `schema_version`.
|
|
90
96
|
*/
|
|
91
97
|
export declare const drop_auth_schema: (db: Db) => Promise<void>;
|
|
92
98
|
/**
|
|
@@ -100,6 +106,8 @@ export declare const drop_auth_schema: (db: Db) => Promise<void>;
|
|
|
100
106
|
* @param factories - one or more database factories to run suites against
|
|
101
107
|
* @param truncate_tables - tables to truncate between tests (children first for FK safety)
|
|
102
108
|
* @returns a `describe_db` function for use in test files
|
|
109
|
+
* @mutates the underlying database between tests — `beforeEach` issues
|
|
110
|
+
* `TRUNCATE <truncate_tables> CASCADE` against the shared instance.
|
|
103
111
|
*/
|
|
104
112
|
export declare const create_describe_db: (factories: DbFactory | Array<DbFactory>, truncate_tables: Array<string>) => ((name: string, fn: (get_db: () => Db) => void) => void);
|
|
105
113
|
/**
|
package/dist/testing/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/db.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA6B7B,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAKpC;;GAEG;AACH,eAAO,MAAM,KAAK,SAA4B,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/db.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA6B7B,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAKpC;;GAEG;AACH,eAAO,MAAM,KAAK,SAA4B,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAU,IAAI,EAAE,KAAG,OAAO,CAAC,IAAI,CAGvD,CAAC;AAMF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,KAAG,SAkB7E,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,GAC7B,aAAa,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,EACtC,WAAW,MAAM,KACf,SA2DF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,UAQhC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,UAAyC,CAAC;AAEvF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,+IAWnB,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAU,IAAI,EAAE,KAAG,OAAO,CAAC,IAAI,CAK3D,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAC9B,WAAW,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,EACvC,iBAAiB,KAAK,CAAC,MAAM,CAAC,KAC5B,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,KAAK,IAAI,CAwBzD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,KAAK,CAAC,SAAS,CAAC,KAAG,IAMnE,CAAC"}
|
package/dist/testing/db.js
CHANGED
|
@@ -37,6 +37,8 @@ export const IS_CI = process.env.CI === 'true';
|
|
|
37
37
|
* The database instance remains usable after reset.
|
|
38
38
|
*
|
|
39
39
|
* @param db - the database to reset
|
|
40
|
+
* @mutates db - drops the `public` schema and recreates it; all rows in all
|
|
41
|
+
* tables are gone after this returns.
|
|
40
42
|
*/
|
|
41
43
|
export const reset_pglite = async (db) => {
|
|
42
44
|
await db.query('DROP SCHEMA public CASCADE');
|
|
@@ -91,7 +93,10 @@ export const create_pglite_factory = (init_schema) => ({
|
|
|
91
93
|
*
|
|
92
94
|
* @param init_schema - callback to initialize the database schema
|
|
93
95
|
* @param test_url - PostgreSQL connection URL (e.g. from `TEST_DATABASE_URL`)
|
|
94
|
-
* @returns a factory that creates pg databases
|
|
96
|
+
* @returns a factory that creates pg databases. The returned `create()`
|
|
97
|
+
* throws when `test_url` is unset (despite the `skip: true` flag — defense
|
|
98
|
+
* against direct invocation), and rewrites Postgres "database does not
|
|
99
|
+
* exist" errors into a `createdb` hint message.
|
|
95
100
|
*/
|
|
96
101
|
export const create_pg_factory = (init_schema, test_url) => {
|
|
97
102
|
const should_skip = !test_url;
|
|
@@ -205,6 +210,7 @@ export const AUTH_DROP_TABLES = [
|
|
|
205
210
|
* PGlite (already fresh), but harmless to call unconditionally.
|
|
206
211
|
*
|
|
207
212
|
* @param db - the database to clean
|
|
213
|
+
* @mutates db - drops every table in `AUTH_DROP_TABLES` plus `schema_version`.
|
|
208
214
|
*/
|
|
209
215
|
export const drop_auth_schema = async (db) => {
|
|
210
216
|
for (const table of AUTH_DROP_TABLES) {
|
|
@@ -223,6 +229,8 @@ export const drop_auth_schema = async (db) => {
|
|
|
223
229
|
* @param factories - one or more database factories to run suites against
|
|
224
230
|
* @param truncate_tables - tables to truncate between tests (children first for FK safety)
|
|
225
231
|
* @returns a `describe_db` function for use in test files
|
|
232
|
+
* @mutates the underlying database between tests — `beforeEach` issues
|
|
233
|
+
* `TRUNCATE <truncate_tables> CASCADE` against the shared instance.
|
|
226
234
|
*/
|
|
227
235
|
export const create_describe_db = (factories, truncate_tables) => {
|
|
228
236
|
const factory_list = Array.isArray(factories) ? factories : [factories];
|
|
@@ -77,6 +77,8 @@ export declare class ErrorCoverageCollector {
|
|
|
77
77
|
* @param status - observed HTTP status code
|
|
78
78
|
* @param code - observed body `error` code (pass when the route's error
|
|
79
79
|
* schema declares specific codes via `z.literal` or `z.enum`)
|
|
80
|
+
* @mutates `this.observed` - adds the resolved `"METHOD /spec-path:STATUS"`
|
|
81
|
+
* key (and the `:CODE` variant when `code` is provided).
|
|
80
82
|
*/
|
|
81
83
|
record(route_specs: Array<RouteSpec>, method: string, path: string, status: number, code?: string): void;
|
|
82
84
|
/**
|
|
@@ -95,6 +97,10 @@ export declare class ErrorCoverageCollector {
|
|
|
95
97
|
* @param code - observed body `error` code (override; if omitted and the
|
|
96
98
|
* response body is a JSON object with a string `error` field, that value
|
|
97
99
|
* is auto-extracted)
|
|
100
|
+
* @mutates `this.observed` - via `record` after `assert_response_matches_spec`
|
|
101
|
+
* succeeds.
|
|
102
|
+
* @throws Error if the response body fails the route spec's declared
|
|
103
|
+
* schemas (propagated from `assert_response_matches_spec`).
|
|
98
104
|
*/
|
|
99
105
|
assert_and_record(route_specs: Array<RouteSpec>, method: string, path: string, response: Response, code?: string): Promise<void>;
|
|
100
106
|
/**
|
|
@@ -139,6 +145,9 @@ export interface ErrorCoverageOptions extends CoverageFilterOptions {
|
|
|
139
145
|
* @param collector - the coverage collector with recorded observations
|
|
140
146
|
* @param route_specs - route specs to check coverage against
|
|
141
147
|
* @param options - threshold and exclusion configuration
|
|
148
|
+
* @throws AssertionError if `min_coverage > 0` and the covered/total ratio
|
|
149
|
+
* falls below the threshold — the failure message lists every uncovered
|
|
150
|
+
* route + status (+ code).
|
|
142
151
|
*/
|
|
143
152
|
export declare const assert_error_coverage: (collector: ErrorCoverageCollector, route_specs: Array<RouteSpec>, options?: ErrorCoverageOptions) => void;
|
|
144
153
|
//# sourceMappingURL=error_coverage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_coverage.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/error_coverage.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;GAWG;AA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CAAC,EAC7B,UAAU,oBAAoB,KAC5B,IAqBF,CAAC"}
|
|
@@ -119,6 +119,8 @@ export class ErrorCoverageCollector {
|
|
|
119
119
|
* @param status - observed HTTP status code
|
|
120
120
|
* @param code - observed body `error` code (pass when the route's error
|
|
121
121
|
* schema declares specific codes via `z.literal` or `z.enum`)
|
|
122
|
+
* @mutates `this.observed` - adds the resolved `"METHOD /spec-path:STATUS"`
|
|
123
|
+
* key (and the `:CODE` variant when `code` is provided).
|
|
122
124
|
*/
|
|
123
125
|
record(route_specs, method, path, status, code) {
|
|
124
126
|
const spec = find_route_spec(route_specs, method, path);
|
|
@@ -145,6 +147,10 @@ export class ErrorCoverageCollector {
|
|
|
145
147
|
* @param code - observed body `error` code (override; if omitted and the
|
|
146
148
|
* response body is a JSON object with a string `error` field, that value
|
|
147
149
|
* is auto-extracted)
|
|
150
|
+
* @mutates `this.observed` - via `record` after `assert_response_matches_spec`
|
|
151
|
+
* succeeds.
|
|
152
|
+
* @throws Error if the response body fails the route spec's declared
|
|
153
|
+
* schemas (propagated from `assert_response_matches_spec`).
|
|
148
154
|
*/
|
|
149
155
|
async assert_and_record(route_specs, method, path, response, code) {
|
|
150
156
|
await assert_response_matches_spec(route_specs, method, path, response);
|
|
@@ -210,6 +216,9 @@ const format_uncovered = (entry) => `${entry.method} ${entry.path} → ${entry.s
|
|
|
210
216
|
* @param collector - the coverage collector with recorded observations
|
|
211
217
|
* @param route_specs - route specs to check coverage against
|
|
212
218
|
* @param options - threshold and exclusion configuration
|
|
219
|
+
* @throws AssertionError if `min_coverage > 0` and the covered/total ratio
|
|
220
|
+
* falls below the threshold — the failure message lists every uncovered
|
|
221
|
+
* route + status (+ code).
|
|
213
222
|
*/
|
|
214
223
|
export const assert_error_coverage = (collector, route_specs, options) => {
|
|
215
224
|
const min_coverage = options?.min_coverage ?? 0;
|
|
@@ -52,6 +52,10 @@ export interface StandardIntegrationTestOptions {
|
|
|
52
52
|
* message if the consumer's route specs are misconfigured.
|
|
53
53
|
*
|
|
54
54
|
* @param options - session config and route factory
|
|
55
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
56
|
+
* suite hard-fails via `require_rpc_endpoint_path` rather than running
|
|
57
|
+
* tests that would crash mid-suite trying to dispatch
|
|
58
|
+
* `account_verify` / `account_session_*` / `account_token_*`.
|
|
55
59
|
*/
|
|
56
60
|
export declare const describe_standard_integration_tests: (options: StandardIntegrationTestOptions) => void;
|
|
57
61
|
//# sourceMappingURL=integration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAA6C,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAqB1B;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,EAAE,uBAAuB,CAAC;CACvC;AAsBD
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAA6C,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAOjB,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAqB1B;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,EAAE,uBAAuB,CAAC;CACvC;AAsBD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IAg8CF,CAAC"}
|
|
@@ -57,6 +57,10 @@ const build_test_app_options = (options, db) => ({
|
|
|
57
57
|
* message if the consumer's route specs are misconfigured.
|
|
58
58
|
*
|
|
59
59
|
* @param options - session config and route factory
|
|
60
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
61
|
+
* suite hard-fails via `require_rpc_endpoint_path` rather than running
|
|
62
|
+
* tests that would crash mid-suite trying to dispatch
|
|
63
|
+
* `account_verify` / `account_session_*` / `account_token_*`.
|
|
60
64
|
*/
|
|
61
65
|
export const describe_standard_integration_tests = (options) => {
|
|
62
66
|
// Hard-fail early so consumers see a clear setup error instead of a
|
|
@@ -35,6 +35,10 @@ export type RestAuthRouteSuffix = (typeof REST_AUTH_ROUTE_SUFFIXES)[number];
|
|
|
35
35
|
* @param suffix - REST auth path suffix
|
|
36
36
|
* @param method - HTTP method
|
|
37
37
|
* @returns matching route spec, or `undefined`
|
|
38
|
+
* @throws Error if `suffix` is not in `REST_AUTH_ROUTE_SUFFIXES` — surfaces
|
|
39
|
+
* accidental use of a post-RPC-migration method name (e.g.
|
|
40
|
+
* `/sessions/revoke-all`) at the call site rather than silently returning
|
|
41
|
+
* `undefined`.
|
|
38
42
|
*/
|
|
39
43
|
export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuthRouteSuffix, method: RouteMethod) => RouteSpec | undefined;
|
|
40
44
|
/**
|
|
@@ -42,12 +46,14 @@ export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuth
|
|
|
42
46
|
*
|
|
43
47
|
* For 2xx responses, validates against `spec.output`.
|
|
44
48
|
* For error responses, validates against the merged error schema for that status code.
|
|
45
|
-
* Throws with details on mismatch.
|
|
46
49
|
*
|
|
47
50
|
* @param route_specs - route specs for schema lookup
|
|
48
51
|
* @param method - HTTP method of the request
|
|
49
52
|
* @param path - path of the request
|
|
50
53
|
* @param response - the Response to validate
|
|
54
|
+
* @throws Error if no route spec matches `method` + `path`, if the response
|
|
55
|
+
* body fails to parse against the declared output / error schema, or if the
|
|
56
|
+
* response is non-JSON despite a declared schema for that status.
|
|
51
57
|
*/
|
|
52
58
|
export declare const assert_response_matches_spec: (route_specs: Array<RouteSpec>, method: string, path: string, response: Response) => Promise<void>;
|
|
53
59
|
/**
|
|
@@ -59,14 +65,14 @@ export declare const assert_response_matches_spec: (route_specs: Array<RouteSpec
|
|
|
59
65
|
*/
|
|
60
66
|
export declare const create_expired_test_cookie: (keyring: Keyring, session_options: SessionOptions<string>) => Promise<string>;
|
|
61
67
|
/**
|
|
62
|
-
*
|
|
68
|
+
* List the fields in an error response body that are not in the known-safe set.
|
|
63
69
|
*
|
|
64
70
|
* Error schemas use `z.looseObject` (intentional — multiple producers), but
|
|
65
71
|
* test responses should be checked for fields that could leak information.
|
|
66
|
-
* Flags any field not in the known-safe set
|
|
72
|
+
* Flags any field not in the known-safe set so callers can decide whether to
|
|
73
|
+
* fail or log.
|
|
67
74
|
*
|
|
68
75
|
* @param body - parsed error response JSON
|
|
69
|
-
* @param context - description for error messages (e.g., `'POST /api/login 401'`)
|
|
70
76
|
* @returns array of unexpected field names (empty = clean)
|
|
71
77
|
*/
|
|
72
78
|
export declare const check_error_response_fields: (body: Record<string, unknown>) => Array<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAU7B,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAA8B,KAAK,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAE3F,OAAO,KAAK,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAC3B,OAAO,KAAK,CAAC,SAAS,CAAC,EACvB,QAAQ,MAAM,EACd,MAAM,MAAM,KACV,SAAS,GAAG,SAad,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,iFAO3B,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"integration_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration_helpers.ts"],"names":[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AA4B,GACxC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,MAAM,KACb,IAkBF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC,GAChD,UAAU,QAAQ,EAClB,MAAM;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,KACzB,IAUF,CAAC;AAIF,oEAAoE;AACpE,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,MAAM,CAAmC,CAAC;AAEhG,0EAA0E;AAC1E,eAAO,MAAM,0BAA0B,EAAE,aAAa,CAAC,MAAM,CAAgC,CAAC;AAE9F;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,KAAG,GAAG,CAAC,MAAM,CAetE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,GAC9C,MAAM,OAAO,EACb,WAAW,aAAa,CAAC,MAAM,CAAC,EAChC,SAAS,MAAM,KACb,IAKF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,SAAS,EACf,UAAU,OAAO,EACjB,gBAAgB,WAAW,EAC3B,eAAe,WAAW,KACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAcvB,CAAC"}
|
|
@@ -61,6 +61,10 @@ export const REST_AUTH_ROUTE_SUFFIXES = [
|
|
|
61
61
|
* @param suffix - REST auth path suffix
|
|
62
62
|
* @param method - HTTP method
|
|
63
63
|
* @returns matching route spec, or `undefined`
|
|
64
|
+
* @throws Error if `suffix` is not in `REST_AUTH_ROUTE_SUFFIXES` — surfaces
|
|
65
|
+
* accidental use of a post-RPC-migration method name (e.g.
|
|
66
|
+
* `/sessions/revoke-all`) at the call site rather than silently returning
|
|
67
|
+
* `undefined`.
|
|
64
68
|
*/
|
|
65
69
|
export const find_auth_route = (specs, suffix, method) => {
|
|
66
70
|
if (!REST_AUTH_ROUTE_SUFFIXES.includes(suffix)) {
|
|
@@ -73,12 +77,14 @@ export const find_auth_route = (specs, suffix, method) => {
|
|
|
73
77
|
*
|
|
74
78
|
* For 2xx responses, validates against `spec.output`.
|
|
75
79
|
* For error responses, validates against the merged error schema for that status code.
|
|
76
|
-
* Throws with details on mismatch.
|
|
77
80
|
*
|
|
78
81
|
* @param route_specs - route specs for schema lookup
|
|
79
82
|
* @param method - HTTP method of the request
|
|
80
83
|
* @param path - path of the request
|
|
81
84
|
* @param response - the Response to validate
|
|
85
|
+
* @throws Error if no route spec matches `method` + `path`, if the response
|
|
86
|
+
* body fails to parse against the declared output / error schema, or if the
|
|
87
|
+
* response is non-JSON despite a declared schema for that status.
|
|
82
88
|
*/
|
|
83
89
|
export const assert_response_matches_spec = async (route_specs, method, path, response) => {
|
|
84
90
|
const spec = find_route_spec(route_specs, method, path);
|
|
@@ -171,14 +177,14 @@ const LEAKY_FIELD_PATTERNS = [
|
|
|
171
177
|
'token',
|
|
172
178
|
];
|
|
173
179
|
/**
|
|
174
|
-
*
|
|
180
|
+
* List the fields in an error response body that are not in the known-safe set.
|
|
175
181
|
*
|
|
176
182
|
* Error schemas use `z.looseObject` (intentional — multiple producers), but
|
|
177
183
|
* test responses should be checked for fields that could leak information.
|
|
178
|
-
* Flags any field not in the known-safe set
|
|
184
|
+
* Flags any field not in the known-safe set so callers can decide whether to
|
|
185
|
+
* fail or log.
|
|
179
186
|
*
|
|
180
187
|
* @param body - parsed error response JSON
|
|
181
|
-
* @param context - description for error messages (e.g., `'POST /api/login 401'`)
|
|
182
188
|
* @returns array of unexpected field names (empty = clean)
|
|
183
189
|
*/
|
|
184
190
|
export const check_error_response_fields = (body) => {
|
|
@@ -65,6 +65,9 @@ export interface BearerAuthMocks {
|
|
|
65
65
|
*
|
|
66
66
|
* @param tc - the test config providing mock return values
|
|
67
67
|
* @returns mocks bundle with spy references
|
|
68
|
+
* @mutates module-level `vi.mock` registrations for `api_token_queries`,
|
|
69
|
+
* `account_queries`, and `permit_queries` — each call resets and re-binds
|
|
70
|
+
* the four spies, so cases run in sequence without bleeding state.
|
|
68
71
|
*/
|
|
69
72
|
export declare const create_bearer_auth_mocks: (tc: BearerAuthTestOptions) => BearerAuthMocks;
|
|
70
73
|
/** Default client IP set by the proxy stub in test apps. */
|
|
@@ -122,6 +125,8 @@ export interface TestMiddlewareStackApp {
|
|
|
122
125
|
*
|
|
123
126
|
* @param options - middleware stack configuration
|
|
124
127
|
* @returns the app and mock spies (reconfigure via `mockImplementation` for valid-token paths)
|
|
128
|
+
* @mutates module-level `vi.mock` registrations for the four bearer-auth query
|
|
129
|
+
* modules — each call resets the spies before wiring the stack.
|
|
125
130
|
*/
|
|
126
131
|
export declare const create_test_middleware_stack_app: (options?: TestMiddlewareStackOptions) => TestMiddlewareStackApp;
|
|
127
132
|
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,EAAE,EAAyB,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAU3B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAsB,KAAK,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAqBpF,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACrC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,oEAAoE;IACpE,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,iDAAiD;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4CAA4C;IAC5C,sBAAsB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AC,CAAC;IACxC,eAAe,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1C,oBAAoB,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/C,0BAA0B,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CACrD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,GAC5C,UAAU,0BAA0B,KAClC,sBAiDF,CAAC"}
|
|
@@ -43,6 +43,9 @@ const STUB_DEPS = { db: {} };
|
|
|
43
43
|
*
|
|
44
44
|
* @param tc - the test config providing mock return values
|
|
45
45
|
* @returns mocks bundle with spy references
|
|
46
|
+
* @mutates module-level `vi.mock` registrations for `api_token_queries`,
|
|
47
|
+
* `account_queries`, and `permit_queries` — each call resets and re-binds
|
|
48
|
+
* the four spies, so cases run in sequence without bleeding state.
|
|
46
49
|
*/
|
|
47
50
|
export const create_bearer_auth_mocks = (tc) => {
|
|
48
51
|
const mock_validate = vi.mocked(query_validate_api_token);
|
|
@@ -176,6 +179,8 @@ export const TEST_MIDDLEWARE_PATH = '/api/test';
|
|
|
176
179
|
*
|
|
177
180
|
* @param options - middleware stack configuration
|
|
178
181
|
* @returns the app and mock spies (reconfigure via `mockImplementation` for valid-token paths)
|
|
182
|
+
* @mutates module-level `vi.mock` registrations for the four bearer-auth query
|
|
183
|
+
* modules — each call resets the spies before wiring the stack.
|
|
179
184
|
*/
|
|
180
185
|
export const create_test_middleware_stack_app = (options) => {
|
|
181
186
|
const trusted_proxies = options?.trusted_proxies ?? ['10.0.0.1'];
|
|
@@ -54,6 +54,9 @@ export interface RateLimitingTestOptions {
|
|
|
54
54
|
* message if the consumer's route specs are misconfigured.
|
|
55
55
|
*
|
|
56
56
|
* @param options - session config and route factory
|
|
57
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
58
|
+
* bearer-auth rate-limit test probes via the `account_verify` RPC action,
|
|
59
|
+
* so the suite hard-fails via `require_rpc_endpoint_path`.
|
|
57
60
|
*/
|
|
58
61
|
export declare const describe_rate_limiting_tests: (options: RateLimitingTestOptions) => void;
|
|
59
62
|
//# sourceMappingURL=rate_limiting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate_limiting.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rate_limiting.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAIrD,OAAO,EAAkB,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAIN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAK1B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;CACvC;AAED
|
|
1
|
+
{"version":3,"file":"rate_limiting.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rate_limiting.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAIrD,OAAO,EAAkB,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAIN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAK1B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,wDAAwD;IACxD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,uBAAuB,KAAG,IA8P/E,CAAC"}
|
|
@@ -36,6 +36,9 @@ import { account_verify_action_spec } from '../auth/account_action_specs.js';
|
|
|
36
36
|
* message if the consumer's route specs are misconfigured.
|
|
37
37
|
*
|
|
38
38
|
* @param options - session config and route factory
|
|
39
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
40
|
+
* bearer-auth rate-limit test probes via the `account_verify` RPC action,
|
|
41
|
+
* so the suite hard-fails via `require_rpc_endpoint_path`.
|
|
39
42
|
*/
|
|
40
43
|
export const describe_rate_limiting_tests = (options) => {
|
|
41
44
|
const max_attempts = options.max_attempts ?? 2;
|
|
@@ -34,6 +34,9 @@ export type RpcEndpointsSuiteOption = Array<RpcEndpointSpec> | ((ctx: AppServerC
|
|
|
34
34
|
* etc.) are. Factories that return a different `path` based on `ctx` will
|
|
35
35
|
* produce a setup/runtime mismatch; the path-purity assert below surfaces
|
|
36
36
|
* that as a clear `gro check` error rather than a silent test/runtime drift.
|
|
37
|
+
*
|
|
38
|
+
* @throws Error if the factory's two stub-ctx invocations produce different
|
|
39
|
+
* `(path, method-list)` shapes — surfaces non-pure factories at setup time.
|
|
37
40
|
*/
|
|
38
41
|
export declare const resolve_rpc_endpoints_for_setup: (rpc_endpoints: RpcEndpointsSuiteOption, session_options: SessionOptions<string>) => Array<RpcEndpointSpec>;
|
|
39
42
|
/**
|
|
@@ -144,11 +147,10 @@ export interface RpcCallArgs {
|
|
|
144
147
|
* caller-provided headers, fires POST (default) or GET, parses the envelope,
|
|
145
148
|
* and returns a discriminated result.
|
|
146
149
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* `error.data.reason`.
|
|
150
|
+
* @throws Error if the response body is neither a valid `JsonrpcResponse`
|
|
151
|
+
* nor `JsonrpcErrorResponse` envelope — protocol-level failures the caller
|
|
152
|
+
* should never tolerate. All JSON-RPC errors come back via `{ok: false, error}`
|
|
153
|
+
* so assertions can focus on `error.code` / `error.data.reason`.
|
|
152
154
|
*/
|
|
153
155
|
export declare const rpc_call: (args: RpcCallArgs) => Promise<RpcCallResult>;
|
|
154
156
|
/**
|
|
@@ -196,6 +198,9 @@ export type RpcCallForSpecArgs<TSpec extends RequestResponseActionSpec> = Omit<R
|
|
|
196
198
|
* happy-path + denial-path assertions where the error `data.reason` shape
|
|
197
199
|
* is still asserted manually. For adversarial input tests that send
|
|
198
200
|
* malformed params, use the untyped `rpc_call`.
|
|
201
|
+
*
|
|
202
|
+
* @throws Error if the success `result` does not parse against `spec.output`,
|
|
203
|
+
* or if `rpc_call` itself throws on an envelope violation.
|
|
199
204
|
*/
|
|
200
205
|
export declare const rpc_call_for_spec: <TSpec extends RequestResponseActionSpec>(args: RpcCallForSpecArgs<TSpec>) => Promise<RpcCallResultForSpec<TSpec>>;
|
|
201
206
|
/**
|
|
@@ -203,6 +208,9 @@ export declare const rpc_call_for_spec: <TSpec extends RequestResponseActionSpec
|
|
|
203
208
|
* output schema and returns typed data. Envelope-level failures or error
|
|
204
209
|
* responses throw — use the untyped `rpc_call` for tests that need to
|
|
205
210
|
* assert on specific error shapes.
|
|
211
|
+
*
|
|
212
|
+
* @throws Error if the response is a JSON-RPC error, if `rpc_call` throws
|
|
213
|
+
* on an envelope violation, or if the result fails `output_schema.safeParse`.
|
|
206
214
|
*/
|
|
207
215
|
export declare const rpc_call_typed: <T>(args: RpcCallArgs, output_schema: z.ZodType<T>) => Promise<T>;
|
|
208
216
|
/**
|
|
@@ -225,12 +233,17 @@ export declare const find_rpc_method: (rpc_endpoints: ReadonlyArray<AppSurfaceRp
|
|
|
225
233
|
} | undefined;
|
|
226
234
|
/**
|
|
227
235
|
* Resolve a single RPC endpoint path — the common case where a consumer
|
|
228
|
-
* mounts exactly one `create_rpc_endpoint`.
|
|
229
|
-
*
|
|
230
|
-
*
|
|
236
|
+
* mounts exactly one `create_rpc_endpoint`.
|
|
237
|
+
*
|
|
238
|
+
* Used at suite setup time to hard-fail integration suites (admin / audit /
|
|
239
|
+
* SSE / rate-limiting) when the consumer omitted `rpc_endpoints` rather
|
|
240
|
+
* than letting tests fail mid-run with confusing errors.
|
|
231
241
|
*
|
|
232
242
|
* Callers that need multi-endpoint support should iterate `rpc_endpoints`
|
|
233
243
|
* directly.
|
|
244
|
+
*
|
|
245
|
+
* @throws Error if `rpc_endpoints` is empty (hard-fail; see the suite options
|
|
246
|
+
* docs) or has more than one entry (ambiguous).
|
|
234
247
|
*/
|
|
235
248
|
export declare const require_rpc_endpoint_path: (rpc_endpoints: ReadonlyArray<RpcEndpointSpec>) => string;
|
|
236
249
|
//# sourceMappingURL=rpc_helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAC,qBAAqB,EAAE,mBAAmB,EAAE,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAG9D;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAChC,KAAK,CAAC,eAAe,CAAC,GACtB,CAAC,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"rpc_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAIN,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAC,qBAAqB,EAAE,mBAAmB,EAAE,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACpG,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM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e,aAAa,CAAC,qBAAqB,CAAC,EACnD,QAAQ,MAAM,KACZ;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAC,GAAG,SAOrD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,GACrC,eAAe,aAAa,CAAC,eAAe,CAAC,KAC3C,MAYF,CAAC"}
|
|
@@ -30,6 +30,9 @@ import { create_stub_app_server_context } from './stubs.js';
|
|
|
30
30
|
* etc.) are. Factories that return a different `path` based on `ctx` will
|
|
31
31
|
* produce a setup/runtime mismatch; the path-purity assert below surfaces
|
|
32
32
|
* that as a clear `gro check` error rather than a silent test/runtime drift.
|
|
33
|
+
*
|
|
34
|
+
* @throws Error if the factory's two stub-ctx invocations produce different
|
|
35
|
+
* `(path, method-list)` shapes — surfaces non-pure factories at setup time.
|
|
33
36
|
*/
|
|
34
37
|
export const resolve_rpc_endpoints_for_setup = (rpc_endpoints, session_options) => {
|
|
35
38
|
if (typeof rpc_endpoints !== 'function')
|
|
@@ -144,11 +147,10 @@ const RPC_CALL_DEFAULT_HEADERS = {
|
|
|
144
147
|
* caller-provided headers, fires POST (default) or GET, parses the envelope,
|
|
145
148
|
* and returns a discriminated result.
|
|
146
149
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* `error.data.reason`.
|
|
150
|
+
* @throws Error if the response body is neither a valid `JsonrpcResponse`
|
|
151
|
+
* nor `JsonrpcErrorResponse` envelope — protocol-level failures the caller
|
|
152
|
+
* should never tolerate. All JSON-RPC errors come back via `{ok: false, error}`
|
|
153
|
+
* so assertions can focus on `error.code` / `error.data.reason`.
|
|
152
154
|
*/
|
|
153
155
|
export const rpc_call = async (args) => {
|
|
154
156
|
const { app, path, method, params, headers, id = 'test', verb = 'POST', suppress_default_origin, } = args;
|
|
@@ -214,6 +216,9 @@ export const rpc_call_non_browser = (args) => rpc_call({ ...args, suppress_defau
|
|
|
214
216
|
* happy-path + denial-path assertions where the error `data.reason` shape
|
|
215
217
|
* is still asserted manually. For adversarial input tests that send
|
|
216
218
|
* malformed params, use the untyped `rpc_call`.
|
|
219
|
+
*
|
|
220
|
+
* @throws Error if the success `result` does not parse against `spec.output`,
|
|
221
|
+
* or if `rpc_call` itself throws on an envelope violation.
|
|
217
222
|
*/
|
|
218
223
|
export const rpc_call_for_spec = async (args) => {
|
|
219
224
|
const { spec, params, ...rest } = args;
|
|
@@ -232,6 +237,9 @@ export const rpc_call_for_spec = async (args) => {
|
|
|
232
237
|
* output schema and returns typed data. Envelope-level failures or error
|
|
233
238
|
* responses throw — use the untyped `rpc_call` for tests that need to
|
|
234
239
|
* assert on specific error shapes.
|
|
240
|
+
*
|
|
241
|
+
* @throws Error if the response is a JSON-RPC error, if `rpc_call` throws
|
|
242
|
+
* on an envelope violation, or if the result fails `output_schema.safeParse`.
|
|
235
243
|
*/
|
|
236
244
|
export const rpc_call_typed = async (args, output_schema) => {
|
|
237
245
|
const res = await rpc_call(args);
|
|
@@ -275,12 +283,17 @@ export const find_rpc_method = (rpc_endpoints, method) => {
|
|
|
275
283
|
};
|
|
276
284
|
/**
|
|
277
285
|
* Resolve a single RPC endpoint path — the common case where a consumer
|
|
278
|
-
* mounts exactly one `create_rpc_endpoint`.
|
|
279
|
-
*
|
|
280
|
-
*
|
|
286
|
+
* mounts exactly one `create_rpc_endpoint`.
|
|
287
|
+
*
|
|
288
|
+
* Used at suite setup time to hard-fail integration suites (admin / audit /
|
|
289
|
+
* SSE / rate-limiting) when the consumer omitted `rpc_endpoints` rather
|
|
290
|
+
* than letting tests fail mid-run with confusing errors.
|
|
281
291
|
*
|
|
282
292
|
* Callers that need multi-endpoint support should iterate `rpc_endpoints`
|
|
283
293
|
* directly.
|
|
294
|
+
*
|
|
295
|
+
* @throws Error if `rpc_endpoints` is empty (hard-fail; see the suite options
|
|
296
|
+
* docs) or has more than one entry (ambiguous).
|
|
284
297
|
*/
|
|
285
298
|
export const require_rpc_endpoint_path = (rpc_endpoints) => {
|
|
286
299
|
if (rpc_endpoints.length === 0) {
|
|
@@ -26,8 +26,13 @@ export declare const resolve_valid_path: (path: string, params_schema?: z.ZodObj
|
|
|
26
26
|
* Generate a valid request body for a route's input schema.
|
|
27
27
|
*
|
|
28
28
|
* Returns `undefined` for null schemas or schemas that can't be unwrapped to objects.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
*
|
|
30
|
+
* @param input_schema - the route's input Zod schema
|
|
31
|
+
* @returns a generated body that passes `safeParse`, or `undefined` for null /
|
|
32
|
+
* non-object schemas
|
|
33
|
+
* @throws Error if the generated body fails `input_schema.safeParse` — catches
|
|
34
|
+
* broken `generate_valid_value` logic early with a descriptive Zod-issues
|
|
35
|
+
* summary instead of a confusing 400 in downstream tests.
|
|
31
36
|
*/
|
|
32
37
|
export declare const generate_valid_body: (input_schema: z.ZodType) => Record<string, unknown> | undefined;
|
|
33
38
|
//# sourceMappingURL=schema_generators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_generators.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,yBAAyB,CAAC;AAIjC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,MAAM,GAAG,IAShE,CAAC;AA+FF,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,OAAO,KAAG,OAkDnF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,gBAAgB,CAAC,CAAC,SAAS,KAAG,MAa9E,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"schema_generators.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,yBAAyB,CAAC;AAIjC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,MAAM,GAAG,IAShE,CAAC;AA+FF,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,OAAO,KAAG,OAkDnF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,gBAAgB,CAAC,CAAC,SAAS,KAAG,MAa9E,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC/B,cAAc,CAAC,CAAC,OAAO,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAkB5B,CAAC"}
|
|
@@ -207,8 +207,13 @@ export const resolve_valid_path = (path, params_schema) => {
|
|
|
207
207
|
* Generate a valid request body for a route's input schema.
|
|
208
208
|
*
|
|
209
209
|
* Returns `undefined` for null schemas or schemas that can't be unwrapped to objects.
|
|
210
|
-
*
|
|
211
|
-
*
|
|
210
|
+
*
|
|
211
|
+
* @param input_schema - the route's input Zod schema
|
|
212
|
+
* @returns a generated body that passes `safeParse`, or `undefined` for null /
|
|
213
|
+
* non-object schemas
|
|
214
|
+
* @throws Error if the generated body fails `input_schema.safeParse` — catches
|
|
215
|
+
* broken `generate_valid_value` logic early with a descriptive Zod-issues
|
|
216
|
+
* summary instead of a confusing 400 in downstream tests.
|
|
212
217
|
*/
|
|
213
218
|
export const generate_valid_body = (input_schema) => {
|
|
214
219
|
if (is_null_schema(input_schema))
|
|
@@ -75,6 +75,9 @@ export interface SseRouteTestOptions {
|
|
|
75
75
|
* then asserts close-on-revoke (unless opted out).
|
|
76
76
|
*
|
|
77
77
|
* @param options - SSE test configuration
|
|
78
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
79
|
+
* close-on-revoke assertion dispatches `account_session_revoke_all` via
|
|
80
|
+
* RPC. Hard-fails via `require_rpc_endpoint_path`.
|
|
78
81
|
*/
|
|
79
82
|
export declare const describe_sse_route_tests: (options: SseRouteTestOptions) => void;
|
|
80
83
|
//# sourceMappingURL=sse_round_trip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse_round_trip.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/sse_round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAwB,KAAK,SAAS,EAAuB,MAAM,oBAAoB,CAAC;AAE/F,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,SAAS,CAAC;AAE9D,OAAO,EAIN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAM1B,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAChC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAC,KAAK,OAAO,CAAC,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AS,EAAC,MAAM,SAAS,CAAC;AAE9D,OAAO,EAIN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAM1B,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAChC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC/B;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IACnC,4CAA4C;IAC5C,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,qDAAqD;IACrD,kBAAkB,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;IAChE,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD;;;;;;;;;;;;;OAaG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC,8BAA8B;IAC9B,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CAChC;AAyHD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,mBAAmB,KAAG,IA2HvE,CAAC"}
|
|
@@ -127,6 +127,9 @@ const parse_and_validate_sse_payload = (frame, event_specs, route_path) => {
|
|
|
127
127
|
* then asserts close-on-revoke (unless opted out).
|
|
128
128
|
*
|
|
129
129
|
* @param options - SSE test configuration
|
|
130
|
+
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
131
|
+
* close-on-revoke assertion dispatches `account_session_revoke_all` via
|
|
132
|
+
* RPC. Hard-fails via `require_rpc_endpoint_path`.
|
|
130
133
|
*/
|
|
131
134
|
export const describe_sse_route_tests = (options) => {
|
|
132
135
|
// Hard-fail early so consumers see a clear setup error instead of a
|
package/dist/testing/stubs.d.ts
CHANGED
|
@@ -15,7 +15,14 @@ import type { EventSpec } from '../realtime/sse.js';
|
|
|
15
15
|
* calls through to a throwing stub, the error message identifies exactly which stub
|
|
16
16
|
* was hit, catching test bugs that would silently pass with `{} as any`.
|
|
17
17
|
*
|
|
18
|
+
* JS-internal probes (`Symbol`, `then`, `constructor`, `$$typeof`) return
|
|
19
|
+
* `undefined` so the proxy doesn't crash framework-level identity checks;
|
|
20
|
+
* `toJSON` returns `"[throwing_stub:label]"` so accidental serialization
|
|
21
|
+
* surfaces the stub's identity in console output rather than silent `"{}"`.
|
|
22
|
+
*
|
|
18
23
|
* @param label - descriptive name for error messages (e.g. `'keyring'`, `'db'`)
|
|
24
|
+
* @throws Error on any non-internal property access (`get` trap), labeled with
|
|
25
|
+
* the stub name and the offending property.
|
|
19
26
|
*/
|
|
20
27
|
export declare const create_throwing_stub: <T = any>(label: string) => T;
|
|
21
28
|
/**
|