@fuzdev/fuz_app 0.52.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/CLAUDE.md +29 -9
- package/dist/actions/action_codegen.d.ts +10 -35
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +13 -42
- package/dist/actions/action_peer.d.ts.map +1 -1
- package/dist/actions/action_peer.js +0 -9
- package/dist/actions/action_registry.d.ts +0 -4
- package/dist/actions/action_registry.d.ts.map +1 -1
- package/dist/actions/action_registry.js +4 -10
- package/dist/actions/action_rpc.d.ts +16 -0
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +41 -20
- package/dist/actions/action_spec.d.ts +54 -5
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/action_spec.js +21 -5
- package/dist/actions/frontend_rpc_client.d.ts +1 -9
- package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
- package/dist/actions/frontend_rpc_client.js +1 -9
- package/dist/actions/register_action_ws.d.ts +16 -0
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/register_action_ws.js +41 -1
- package/dist/actions/request_tracker.svelte.d.ts +10 -15
- package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
- package/dist/actions/request_tracker.svelte.js +10 -15
- package/dist/actions/rpc_client.d.ts +0 -1
- package/dist/actions/rpc_client.d.ts.map +1 -1
- package/dist/actions/rpc_client.js +3 -17
- package/dist/actions/socket.svelte.d.ts +0 -1
- package/dist/actions/socket.svelte.d.ts.map +1 -1
- package/dist/actions/socket.svelte.js +0 -1
- package/dist/actions/transports.d.ts +4 -3
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +4 -13
- package/dist/actions/transports_ws_auth_guard.d.ts +0 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +0 -2
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +0 -9
- package/dist/auth/CLAUDE.md +43 -19
- package/dist/auth/account_queries.d.ts +0 -3
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +0 -3
- package/dist/auth/admin_action_specs.d.ts +5 -0
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +5 -0
- package/dist/auth/api_token_queries.d.ts +0 -1
- package/dist/auth/api_token_queries.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +0 -1
- package/dist/auth/audit_log_queries.d.ts +0 -1
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +0 -1
- package/dist/auth/audit_log_routes.d.ts +2 -2
- package/dist/auth/audit_log_routes.js +2 -2
- package/dist/auth/invite_queries.d.ts +0 -1
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +0 -1
- package/dist/auth/permit_offer_action_specs.d.ts +1 -0
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +1 -0
- package/dist/auth/permit_offer_actions.d.ts.map +1 -1
- package/dist/auth/permit_offer_actions.js +9 -6
- package/dist/auth/permit_offer_queries.d.ts +0 -1
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +0 -1
- package/dist/auth/permit_queries.d.ts +0 -1
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +0 -1
- package/dist/auth/request_context.d.ts +47 -2
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +57 -2
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +14 -11
- package/dist/auth/session_lifecycle.d.ts +0 -1
- package/dist/auth/session_lifecycle.d.ts.map +1 -1
- package/dist/auth/session_lifecycle.js +0 -1
- package/dist/auth/session_middleware.d.ts +0 -4
- package/dist/auth/session_middleware.d.ts.map +1 -1
- package/dist/auth/session_middleware.js +0 -4
- package/dist/cli/config.d.ts +0 -3
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +0 -3
- package/dist/cli/daemon.d.ts +1 -1
- package/dist/cli/daemon.js +1 -1
- package/dist/db/create_db.d.ts +0 -1
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +0 -1
- package/dist/db/db.d.ts +0 -4
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +0 -4
- package/dist/db/db_pg.d.ts +2 -2
- package/dist/db/db_pg.js +2 -2
- package/dist/db/db_pglite.d.ts +1 -2
- package/dist/db/db_pglite.d.ts.map +1 -1
- package/dist/db/db_pglite.js +1 -2
- package/dist/db/migrate.d.ts +0 -1
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +0 -1
- package/dist/dev/setup.d.ts +0 -3
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +0 -3
- package/dist/env/load.d.ts +0 -2
- package/dist/env/load.d.ts.map +1 -1
- package/dist/env/load.js +0 -2
- package/dist/hono_context.d.ts +2 -5
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +2 -5
- package/dist/http/common_routes.d.ts +0 -8
- package/dist/http/common_routes.d.ts.map +1 -1
- package/dist/http/common_routes.js +0 -8
- package/dist/http/db_routes.d.ts +0 -3
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +0 -3
- package/dist/http/error_schemas.d.ts +12 -11
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +11 -7
- package/dist/http/jsonrpc_errors.d.ts +0 -6
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +0 -6
- package/dist/http/origin.d.ts +6 -13
- package/dist/http/origin.d.ts.map +1 -1
- package/dist/http/origin.js +7 -14
- package/dist/http/proxy.d.ts +1 -7
- package/dist/http/proxy.d.ts.map +1 -1
- package/dist/http/proxy.js +1 -7
- package/dist/http/route_spec.d.ts +13 -35
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +10 -22
- package/dist/http/schema_helpers.d.ts +0 -4
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +0 -4
- package/dist/http/surface.d.ts +2 -12
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +1 -12
- package/dist/rate_limiter.d.ts +16 -0
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +26 -0
- package/dist/realtime/sse.d.ts +0 -1
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse.js +0 -1
- package/dist/realtime/subscriber_registry.d.ts +0 -3
- package/dist/realtime/subscriber_registry.d.ts.map +1 -1
- package/dist/realtime/subscriber_registry.js +0 -3
- package/dist/runtime/fs.d.ts +1 -4
- package/dist/runtime/fs.d.ts.map +1 -1
- package/dist/runtime/fs.js +1 -4
- package/dist/runtime/mock.d.ts +0 -3
- package/dist/runtime/mock.d.ts.map +1 -1
- package/dist/runtime/mock.js +0 -3
- package/dist/server/app_server.d.ts +27 -5
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +19 -7
- package/dist/server/startup.d.ts +0 -2
- package/dist/server/startup.d.ts.map +1 -1
- package/dist/server/startup.js +0 -2
- package/dist/server/static.d.ts +0 -1
- package/dist/server/static.d.ts.map +1 -1
- package/dist/server/static.js +0 -1
- package/dist/server/validate_nginx.d.ts +0 -3
- package/dist/server/validate_nginx.d.ts.map +1 -1
- package/dist/server/validate_nginx.js +0 -3
- package/dist/testing/CLAUDE.md +1 -1
- package/dist/testing/admin_integration.d.ts +0 -1
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +3 -6
- package/dist/testing/adversarial_404.d.ts +0 -2
- package/dist/testing/adversarial_404.d.ts.map +1 -1
- package/dist/testing/adversarial_404.js +0 -2
- package/dist/testing/adversarial_headers.d.ts +0 -1
- package/dist/testing/adversarial_headers.d.ts.map +1 -1
- package/dist/testing/adversarial_headers.js +0 -1
- package/dist/testing/adversarial_input.d.ts +0 -2
- package/dist/testing/adversarial_input.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +0 -2
- package/dist/testing/app_server.d.ts +22 -0
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +2 -4
- package/dist/testing/assertions.d.ts +0 -4
- package/dist/testing/assertions.d.ts.map +1 -1
- package/dist/testing/assertions.js +0 -4
- package/dist/testing/attack_surface.d.ts +0 -4
- package/dist/testing/attack_surface.d.ts.map +1 -1
- package/dist/testing/attack_surface.js +0 -4
- package/dist/testing/audit_completeness.d.ts +0 -1
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +0 -1
- package/dist/testing/auth_apps.d.ts +2 -10
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +2 -10
- package/dist/testing/data_exposure.d.ts +0 -11
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +0 -11
- package/dist/testing/db.d.ts +0 -6
- package/dist/testing/db.d.ts.map +1 -1
- package/dist/testing/db.js +0 -6
- package/dist/testing/error_coverage.d.ts +0 -14
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +0 -14
- package/dist/testing/integration.d.ts +0 -1
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +0 -1
- package/dist/testing/integration_helpers.d.ts +1 -36
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +1 -43
- package/dist/testing/middleware.d.ts +0 -10
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +0 -10
- package/dist/testing/mock_fs.d.ts +0 -2
- package/dist/testing/mock_fs.d.ts.map +1 -1
- package/dist/testing/mock_fs.js +0 -2
- package/dist/testing/rate_limiting.d.ts +0 -1
- package/dist/testing/rate_limiting.d.ts.map +1 -1
- package/dist/testing/rate_limiting.js +0 -1
- package/dist/testing/round_trip.d.ts +0 -2
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +0 -2
- package/dist/testing/rpc_attack_surface.d.ts +0 -2
- package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
- package/dist/testing/rpc_attack_surface.js +0 -2
- package/dist/testing/rpc_helpers.d.ts +0 -6
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +0 -6
- package/dist/testing/rpc_round_trip.d.ts +0 -2
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +0 -2
- package/dist/testing/schema_generators.d.ts +0 -3
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +29 -3
- package/dist/testing/sse_round_trip.d.ts +0 -1
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +0 -1
- package/dist/testing/standard.d.ts +0 -2
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +0 -2
- package/dist/testing/stubs.d.ts +3 -5
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +5 -5
- package/dist/testing/surface_invariants.d.ts +0 -3
- package/dist/testing/surface_invariants.d.ts.map +1 -1
- package/dist/testing/surface_invariants.js +0 -3
- package/dist/ui/CLAUDE.md +1 -1
- package/dist/ui/audit_log_state.svelte.js +1 -1
- package/dist/ui/position_helpers.d.ts +0 -3
- package/dist/ui/position_helpers.d.ts.map +1 -1
- package/dist/ui/position_helpers.js +0 -3
- package/dist/ui/sidebar_state.svelte.d.ts +1 -2
- package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
- package/dist/ui/sidebar_state.svelte.js +1 -2
- package/dist/ui/ui_fetch.d.ts +1 -7
- package/dist/ui/ui_fetch.d.ts.map +1 -1
- package/dist/ui/ui_fetch.js +1 -7
- package/dist/ui/ui_format.d.ts +2 -14
- package/dist/ui/ui_format.d.ts.map +1 -1
- package/dist/ui/ui_format.js +2 -14
- package/package.json +2 -2
package/dist/testing/db.js
CHANGED
|
@@ -36,7 +36,6 @@ export const IS_CI = process.env.CI === 'true';
|
|
|
36
36
|
* Removes all tables, sequences, indexes, types, and functions.
|
|
37
37
|
* The database instance remains usable after reset.
|
|
38
38
|
*
|
|
39
|
-
* @param db - the database to reset
|
|
40
39
|
* @mutates db - drops the `public` schema and recreates it; all rows in all
|
|
41
40
|
* tables are gone after this returns.
|
|
42
41
|
*/
|
|
@@ -57,7 +56,6 @@ let module_db = null;
|
|
|
57
56
|
* cold-start cost again.
|
|
58
57
|
*
|
|
59
58
|
* @param init_schema - callback to initialize the database schema
|
|
60
|
-
* @returns a factory that creates in-memory pglite databases
|
|
61
59
|
*/
|
|
62
60
|
export const create_pglite_factory = (init_schema) => ({
|
|
63
61
|
name: 'pglite',
|
|
@@ -209,7 +207,6 @@ export const AUTH_DROP_TABLES = [
|
|
|
209
207
|
* Safe on fresh databases (`IF EXISTS` on all statements). No-op effect for
|
|
210
208
|
* PGlite (already fresh), but harmless to call unconditionally.
|
|
211
209
|
*
|
|
212
|
-
* @param db - the database to clean
|
|
213
210
|
* @mutates db - drops every table in `AUTH_DROP_TABLES` plus `schema_version`.
|
|
214
211
|
*/
|
|
215
212
|
export const drop_auth_schema = async (db) => {
|
|
@@ -228,7 +225,6 @@ export const drop_auth_schema = async (db) => {
|
|
|
228
225
|
*
|
|
229
226
|
* @param factories - one or more database factories to run suites against
|
|
230
227
|
* @param truncate_tables - tables to truncate between tests (children first for FK safety)
|
|
231
|
-
* @returns a `describe_db` function for use in test files
|
|
232
228
|
* @mutates the underlying database between tests — `beforeEach` issues
|
|
233
229
|
* `TRUNCATE <truncate_tables> CASCADE` against the shared instance.
|
|
234
230
|
*/
|
|
@@ -258,8 +254,6 @@ export const create_describe_db = (factories, truncate_tables) => {
|
|
|
258
254
|
};
|
|
259
255
|
/**
|
|
260
256
|
* Log factory status to console.
|
|
261
|
-
*
|
|
262
|
-
* @param factories - the database factories to report on
|
|
263
257
|
*/
|
|
264
258
|
export const log_db_factory_status = (factories) => {
|
|
265
259
|
const enabled = factories.filter((f) => !f.skip).map((f) => f.name);
|
|
@@ -71,10 +71,7 @@ export declare class ErrorCoverageCollector {
|
|
|
71
71
|
* (e.g., `/api/accounts/abc` → `/api/accounts/:id`). When `code` is provided,
|
|
72
72
|
* it is stored alongside the status for per-code coverage tracking.
|
|
73
73
|
*
|
|
74
|
-
* @param route_specs - route specs for path resolution
|
|
75
|
-
* @param method - HTTP method
|
|
76
74
|
* @param path - request path (may be concrete)
|
|
77
|
-
* @param status - observed HTTP status code
|
|
78
75
|
* @param code - observed body `error` code (pass when the route's error
|
|
79
76
|
* schema declares specific codes via `z.literal` or `z.enum`)
|
|
80
77
|
* @mutates `this.observed` - adds the resolved `"METHOD /spec-path:STATUS"`
|
|
@@ -90,10 +87,6 @@ export declare class ErrorCoverageCollector {
|
|
|
90
87
|
* for per-code coverage. Pass an explicit `code` to override the
|
|
91
88
|
* auto-extracted value or when the body was already consumed.
|
|
92
89
|
*
|
|
93
|
-
* @param route_specs - route specs for schema lookup and path resolution
|
|
94
|
-
* @param method - HTTP method
|
|
95
|
-
* @param path - request path
|
|
96
|
-
* @param response - the Response to validate and record
|
|
97
90
|
* @param code - observed body `error` code (override; if omitted and the
|
|
98
91
|
* response body is a JSON object with a string `error` field, that value
|
|
99
92
|
* is auto-extracted)
|
|
@@ -111,10 +104,6 @@ export declare class ErrorCoverageCollector {
|
|
|
111
104
|
* `z.enum`), reports per-code rows; otherwise reports one row per status.
|
|
112
105
|
* A status-only observation (no code) satisfies all declared codes for that
|
|
113
106
|
* status — the "any-code" rule.
|
|
114
|
-
*
|
|
115
|
-
* @param route_specs - route specs to check coverage against
|
|
116
|
-
* @param options - exclusion configuration (skip routes or statuses)
|
|
117
|
-
* @returns uncovered entries with method, path, status, and optional code
|
|
118
107
|
*/
|
|
119
108
|
uncovered(route_specs: Array<RouteSpec>, options?: CoverageFilterOptions): Array<UncoveredEntry>;
|
|
120
109
|
}
|
|
@@ -142,9 +131,6 @@ export interface ErrorCoverageOptions extends CoverageFilterOptions {
|
|
|
142
131
|
* When `min_coverage` is 0 (default), logs coverage info without failing.
|
|
143
132
|
* When > 0, fails if coverage is below the threshold.
|
|
144
133
|
*
|
|
145
|
-
* @param collector - the coverage collector with recorded observations
|
|
146
|
-
* @param route_specs - route specs to check coverage against
|
|
147
|
-
* @param options - threshold and exclusion configuration
|
|
148
134
|
* @throws AssertionError if `min_coverage > 0` and the covered/total ratio
|
|
149
135
|
* falls below the threshold — the failure message lists every uncovered
|
|
150
136
|
* route + status (+ code).
|
|
@@ -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;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAIrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,KAAK,CAAC,MAAM,CAAC,GAAG,IAWhF,CAAC;AAEF,sFAAsF;AACtF,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACrC,kDAAkD;IAClD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,iCAAiC;IACjC,eAAe,CAAC,EAAE,KAAK,CAAC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IAUP;;;;;;;;;;;;;;;;OAgBG;IACG,iBAAiB,CACtB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,EAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC;IAgBhB;;;;;;;;OAQG;IACH,SAAS,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC;CAKhG;AAED;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,2CAA2C;AAC3C,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAClE,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAaD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,qBAAqB,GACjC,WAAW,sBAAsB,EACjC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,UAAU,oBAAoB,KAC5B,IAqBF,CAAC"}
|
|
@@ -113,10 +113,7 @@ export class ErrorCoverageCollector {
|
|
|
113
113
|
* (e.g., `/api/accounts/abc` → `/api/accounts/:id`). When `code` is provided,
|
|
114
114
|
* it is stored alongside the status for per-code coverage tracking.
|
|
115
115
|
*
|
|
116
|
-
* @param route_specs - route specs for path resolution
|
|
117
|
-
* @param method - HTTP method
|
|
118
116
|
* @param path - request path (may be concrete)
|
|
119
|
-
* @param status - observed HTTP status code
|
|
120
117
|
* @param code - observed body `error` code (pass when the route's error
|
|
121
118
|
* schema declares specific codes via `z.literal` or `z.enum`)
|
|
122
119
|
* @mutates `this.observed` - adds the resolved `"METHOD /spec-path:STATUS"`
|
|
@@ -140,10 +137,6 @@ export class ErrorCoverageCollector {
|
|
|
140
137
|
* for per-code coverage. Pass an explicit `code` to override the
|
|
141
138
|
* auto-extracted value or when the body was already consumed.
|
|
142
139
|
*
|
|
143
|
-
* @param route_specs - route specs for schema lookup and path resolution
|
|
144
|
-
* @param method - HTTP method
|
|
145
|
-
* @param path - request path
|
|
146
|
-
* @param response - the Response to validate and record
|
|
147
140
|
* @param code - observed body `error` code (override; if omitted and the
|
|
148
141
|
* response body is a JSON object with a string `error` field, that value
|
|
149
142
|
* is auto-extracted)
|
|
@@ -176,10 +169,6 @@ export class ErrorCoverageCollector {
|
|
|
176
169
|
* `z.enum`), reports per-code rows; otherwise reports one row per status.
|
|
177
170
|
* A status-only observation (no code) satisfies all declared codes for that
|
|
178
171
|
* status — the "any-code" rule.
|
|
179
|
-
*
|
|
180
|
-
* @param route_specs - route specs to check coverage against
|
|
181
|
-
* @param options - exclusion configuration (skip routes or statuses)
|
|
182
|
-
* @returns uncovered entries with method, path, status, and optional code
|
|
183
172
|
*/
|
|
184
173
|
uncovered(route_specs, options) {
|
|
185
174
|
return walk_coverage(this, route_specs, options)
|
|
@@ -213,9 +202,6 @@ const format_uncovered = (entry) => `${entry.method} ${entry.path} → ${entry.s
|
|
|
213
202
|
* When `min_coverage` is 0 (default), logs coverage info without failing.
|
|
214
203
|
* When > 0, fails if coverage is below the threshold.
|
|
215
204
|
*
|
|
216
|
-
* @param collector - the coverage collector with recorded observations
|
|
217
|
-
* @param route_specs - route specs to check coverage against
|
|
218
|
-
* @param options - threshold and exclusion configuration
|
|
219
205
|
* @throws AssertionError if `min_coverage > 0` and the covered/total ratio
|
|
220
206
|
* falls below the threshold — the failure message lists every uncovered
|
|
221
207
|
* route + status (+ code).
|
|
@@ -51,7 +51,6 @@ export interface StandardIntegrationTestOptions {
|
|
|
51
51
|
* Each test group asserts that required routes exist, failing with a descriptive
|
|
52
52
|
* message if the consumer's route specs are misconfigured.
|
|
53
53
|
*
|
|
54
|
-
* @param options - session config and route factory
|
|
55
54
|
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
56
55
|
* suite hard-fails via `require_rpc_endpoint_path` rather than running
|
|
57
56
|
* tests that would crash mid-suite trying to dispatch
|
|
@@ -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;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IAg8CF,CAAC"}
|
|
@@ -56,7 +56,6 @@ const build_test_app_options = (options, db) => ({
|
|
|
56
56
|
* Each test group asserts that required routes exist, failing with a descriptive
|
|
57
57
|
* message if the consumer's route specs are misconfigured.
|
|
58
58
|
*
|
|
59
|
-
* @param options - session config and route factory
|
|
60
59
|
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
61
60
|
* suite hard-fails via `require_rpc_endpoint_path` rather than running
|
|
62
61
|
* tests that would crash mid-suite trying to dispatch
|
|
@@ -8,10 +8,7 @@ import type { TestApp, TestAccount } from './app_server.js';
|
|
|
8
8
|
*
|
|
9
9
|
* Supports both exact matches and parameterized paths (`:param` segments).
|
|
10
10
|
*
|
|
11
|
-
* @param specs - route specs to search
|
|
12
|
-
* @param method - HTTP method
|
|
13
11
|
* @param path - request path (exact or with concrete param values)
|
|
14
|
-
* @returns matching route spec, or `undefined`
|
|
15
12
|
*/
|
|
16
13
|
export declare const find_route_spec: (specs: Array<RouteSpec>, method: string, path: string) => RouteSpec | undefined;
|
|
17
14
|
/**
|
|
@@ -31,14 +28,7 @@ export type RestAuthRouteSuffix = (typeof REST_AUTH_ROUTE_SUFFIXES)[number];
|
|
|
31
28
|
* method name (e.g. `/sessions/revoke-all`) fails loudly at the call site
|
|
32
29
|
* instead of silently returning `undefined`.
|
|
33
30
|
*
|
|
34
|
-
* @
|
|
35
|
-
* @param suffix - REST auth path suffix
|
|
36
|
-
* @param method - HTTP method
|
|
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`.
|
|
31
|
+
* @throws Error if `suffix` is not in `REST_AUTH_ROUTE_SUFFIXES`.
|
|
42
32
|
*/
|
|
43
33
|
export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuthRouteSuffix, method: RouteMethod) => RouteSpec | undefined;
|
|
44
34
|
/**
|
|
@@ -47,10 +37,6 @@ export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuth
|
|
|
47
37
|
* For 2xx responses, validates against `spec.output`.
|
|
48
38
|
* For error responses, validates against the merged error schema for that status code.
|
|
49
39
|
*
|
|
50
|
-
* @param route_specs - route specs for schema lookup
|
|
51
|
-
* @param method - HTTP method of the request
|
|
52
|
-
* @param path - path of the request
|
|
53
|
-
* @param response - the Response to validate
|
|
54
40
|
* @throws Error if no route spec matches `method` + `path`, if the response
|
|
55
41
|
* body fails to parse against the declared output / error schema, or if the
|
|
56
42
|
* response is non-JSON despite a declared schema for that status.
|
|
@@ -58,10 +44,6 @@ export declare const find_auth_route: (specs: Array<RouteSpec>, suffix: RestAuth
|
|
|
58
44
|
export declare const assert_response_matches_spec: (route_specs: Array<RouteSpec>, method: string, path: string, response: Response) => Promise<void>;
|
|
59
45
|
/**
|
|
60
46
|
* Create an expired test cookie — validly signed but with an expiry timestamp in 1970.
|
|
61
|
-
*
|
|
62
|
-
* @param keyring - keyring for signing
|
|
63
|
-
* @param session_options - session config
|
|
64
|
-
* @returns signed cookie value with long-past expiry
|
|
65
47
|
*/
|
|
66
48
|
export declare const create_expired_test_cookie: (keyring: Keyring, session_options: SessionOptions<string>) => Promise<string>;
|
|
67
49
|
/**
|
|
@@ -69,10 +51,7 @@ export declare const create_expired_test_cookie: (keyring: Keyring, session_opti
|
|
|
69
51
|
*
|
|
70
52
|
* Error schemas use `z.looseObject` (intentional — multiple producers), but
|
|
71
53
|
* test responses should be checked for fields that could leak information.
|
|
72
|
-
* Flags any field not in the known-safe set so callers can decide whether to
|
|
73
|
-
* fail or log.
|
|
74
54
|
*
|
|
75
|
-
* @param body - parsed error response JSON
|
|
76
55
|
* @returns array of unexpected field names (empty = clean)
|
|
77
56
|
*/
|
|
78
57
|
export declare const check_error_response_fields: (body: Record<string, unknown>) => Array<string>;
|
|
@@ -82,16 +61,12 @@ export declare const check_error_response_fields: (body: Record<string, unknown>
|
|
|
82
61
|
* Checks both field names and string values for patterns indicating
|
|
83
62
|
* stack traces, SQL, or internal paths.
|
|
84
63
|
*
|
|
85
|
-
* @param body - parsed error response JSON
|
|
86
64
|
* @param context - description for error messages
|
|
87
65
|
*/
|
|
88
66
|
export declare const assert_no_error_info_leakage: (body: Record<string, unknown>, context: string) => void;
|
|
89
67
|
/**
|
|
90
68
|
* Assert that a 429 response includes a valid `Retry-After` header
|
|
91
69
|
* matching the JSON body's `retry_after` field.
|
|
92
|
-
*
|
|
93
|
-
* @param response - the 429 response
|
|
94
|
-
* @param body - parsed JSON body with `retry_after` field
|
|
95
70
|
*/
|
|
96
71
|
export declare const assert_rate_limit_retry_after_header: (response: Response, body: {
|
|
97
72
|
retry_after: number;
|
|
@@ -104,16 +79,11 @@ export declare const ADMIN_ONLY_FIELD_BLOCKLIST: ReadonlyArray<string>;
|
|
|
104
79
|
* Recursively collect all key names from a parsed JSON value.
|
|
105
80
|
*
|
|
106
81
|
* Walks objects and arrays to find every property name at any nesting depth.
|
|
107
|
-
*
|
|
108
|
-
* @param value - parsed JSON value
|
|
109
|
-
* @returns set of all key names found
|
|
110
82
|
*/
|
|
111
83
|
export declare const collect_json_keys_recursive: (value: unknown) => Set<string>;
|
|
112
84
|
/**
|
|
113
85
|
* Assert that a parsed JSON body contains no fields from the given blocklist.
|
|
114
86
|
*
|
|
115
|
-
* @param body - parsed response JSON
|
|
116
|
-
* @param blocklist - field names to check for
|
|
117
87
|
* @param context - description for error messages
|
|
118
88
|
*/
|
|
119
89
|
export declare const assert_no_sensitive_fields_in_json: (body: unknown, blocklist: ReadonlyArray<string>, context: string) => void;
|
|
@@ -126,11 +96,6 @@ export declare const assert_no_sensitive_fields_in_json: (body: unknown, blockli
|
|
|
126
96
|
* - `role: admin` — the admin account's session cookie
|
|
127
97
|
* - `role: <other>` — the test app's bootstrapped keeper session
|
|
128
98
|
* - `keeper` — the test app's daemon token
|
|
129
|
-
*
|
|
130
|
-
* @param spec - route spec to inspect
|
|
131
|
-
* @param test_app - the assembled test app (for bootstrapped credentials)
|
|
132
|
-
* @param authed_account - an account with no roles (for `authenticated` auth)
|
|
133
|
-
* @param admin_account - an account with `admin` role (for role-gated routes)
|
|
134
99
|
*/
|
|
135
100
|
export declare const pick_auth_headers: (spec: RouteSpec, test_app: TestApp, authed_account: TestAccount, admin_account: TestAccount) => Record<string, string>;
|
|
136
101
|
//# sourceMappingURL=integration_helpers.d.ts.map
|
|
@@ -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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AgCF;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GAAI,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,KAAK,CAAC,MAAM,CAQvF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,MAAM,KACb,IAkBF,CAAC;AAEF;;;GAGG;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;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,KAAG,GAAG,CAAC,MAAM,CAetE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,GAC9C,MAAM,OAAO,EACb,WAAW,aAAa,CAAC,MAAM,CAAC,EAChC,SAAS,MAAM,KACb,IAKF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAC7B,MAAM,SAAS,EACf,UAAU,OAAO,EACjB,gBAAgB,WAAW,EAC3B,eAAe,WAAW,KACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAcvB,CAAC"}
|
|
@@ -13,10 +13,7 @@ import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
|
13
13
|
*
|
|
14
14
|
* Supports both exact matches and parameterized paths (`:param` segments).
|
|
15
15
|
*
|
|
16
|
-
* @param specs - route specs to search
|
|
17
|
-
* @param method - HTTP method
|
|
18
16
|
* @param path - request path (exact or with concrete param values)
|
|
19
|
-
* @returns matching route spec, or `undefined`
|
|
20
17
|
*/
|
|
21
18
|
export const find_route_spec = (specs, method, path) => {
|
|
22
19
|
// exact match first
|
|
@@ -57,14 +54,7 @@ export const REST_AUTH_ROUTE_SUFFIXES = [
|
|
|
57
54
|
* method name (e.g. `/sessions/revoke-all`) fails loudly at the call site
|
|
58
55
|
* instead of silently returning `undefined`.
|
|
59
56
|
*
|
|
60
|
-
* @
|
|
61
|
-
* @param suffix - REST auth path suffix
|
|
62
|
-
* @param method - HTTP method
|
|
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`.
|
|
57
|
+
* @throws Error if `suffix` is not in `REST_AUTH_ROUTE_SUFFIXES`.
|
|
68
58
|
*/
|
|
69
59
|
export const find_auth_route = (specs, suffix, method) => {
|
|
70
60
|
if (!REST_AUTH_ROUTE_SUFFIXES.includes(suffix)) {
|
|
@@ -78,10 +68,6 @@ export const find_auth_route = (specs, suffix, method) => {
|
|
|
78
68
|
* For 2xx responses, validates against `spec.output`.
|
|
79
69
|
* For error responses, validates against the merged error schema for that status code.
|
|
80
70
|
*
|
|
81
|
-
* @param route_specs - route specs for schema lookup
|
|
82
|
-
* @param method - HTTP method of the request
|
|
83
|
-
* @param path - path of the request
|
|
84
|
-
* @param response - the Response to validate
|
|
85
71
|
* @throws Error if no route spec matches `method` + `path`, if the response
|
|
86
72
|
* body fails to parse against the declared output / error schema, or if the
|
|
87
73
|
* response is non-JSON despite a declared schema for that status.
|
|
@@ -132,22 +118,11 @@ export const assert_response_matches_spec = async (route_specs, method, path, re
|
|
|
132
118
|
};
|
|
133
119
|
/**
|
|
134
120
|
* Create an expired test cookie — validly signed but with an expiry timestamp in 1970.
|
|
135
|
-
*
|
|
136
|
-
* @param keyring - keyring for signing
|
|
137
|
-
* @param session_options - session config
|
|
138
|
-
* @returns signed cookie value with long-past expiry
|
|
139
121
|
*/
|
|
140
122
|
export const create_expired_test_cookie = async (keyring, session_options) => {
|
|
141
123
|
// now_seconds=1 puts the expiry at 1 + max_age seconds past epoch — still in 1970
|
|
142
124
|
return create_session_cookie_value(keyring, 'expired_test_token', session_options, 1);
|
|
143
125
|
};
|
|
144
|
-
/**
|
|
145
|
-
* Assert that a 429 response includes a valid `Retry-After` header
|
|
146
|
-
* matching the JSON body's `retry_after` field.
|
|
147
|
-
*
|
|
148
|
-
* @param response - the 429 response
|
|
149
|
-
* @param body - parsed JSON body with `retry_after` field
|
|
150
|
-
*/
|
|
151
126
|
/**
|
|
152
127
|
* Known safe fields that may appear in any error response.
|
|
153
128
|
*
|
|
@@ -181,10 +156,7 @@ const LEAKY_FIELD_PATTERNS = [
|
|
|
181
156
|
*
|
|
182
157
|
* Error schemas use `z.looseObject` (intentional — multiple producers), but
|
|
183
158
|
* test responses should be checked for fields that could leak information.
|
|
184
|
-
* Flags any field not in the known-safe set so callers can decide whether to
|
|
185
|
-
* fail or log.
|
|
186
159
|
*
|
|
187
|
-
* @param body - parsed error response JSON
|
|
188
160
|
* @returns array of unexpected field names (empty = clean)
|
|
189
161
|
*/
|
|
190
162
|
export const check_error_response_fields = (body) => {
|
|
@@ -202,7 +174,6 @@ export const check_error_response_fields = (body) => {
|
|
|
202
174
|
* Checks both field names and string values for patterns indicating
|
|
203
175
|
* stack traces, SQL, or internal paths.
|
|
204
176
|
*
|
|
205
|
-
* @param body - parsed error response JSON
|
|
206
177
|
* @param context - description for error messages
|
|
207
178
|
*/
|
|
208
179
|
export const assert_no_error_info_leakage = (body, context) => {
|
|
@@ -221,9 +192,6 @@ export const assert_no_error_info_leakage = (body, context) => {
|
|
|
221
192
|
/**
|
|
222
193
|
* Assert that a 429 response includes a valid `Retry-After` header
|
|
223
194
|
* matching the JSON body's `retry_after` field.
|
|
224
|
-
*
|
|
225
|
-
* @param response - the 429 response
|
|
226
|
-
* @param body - parsed JSON body with `retry_after` field
|
|
227
195
|
*/
|
|
228
196
|
export const assert_rate_limit_retry_after_header = (response, body) => {
|
|
229
197
|
const header = response.headers.get('Retry-After');
|
|
@@ -241,9 +209,6 @@ export const ADMIN_ONLY_FIELD_BLOCKLIST = ['updated_by', 'created_by'];
|
|
|
241
209
|
* Recursively collect all key names from a parsed JSON value.
|
|
242
210
|
*
|
|
243
211
|
* Walks objects and arrays to find every property name at any nesting depth.
|
|
244
|
-
*
|
|
245
|
-
* @param value - parsed JSON value
|
|
246
|
-
* @returns set of all key names found
|
|
247
212
|
*/
|
|
248
213
|
export const collect_json_keys_recursive = (value) => {
|
|
249
214
|
const keys = new Set();
|
|
@@ -266,8 +231,6 @@ export const collect_json_keys_recursive = (value) => {
|
|
|
266
231
|
/**
|
|
267
232
|
* Assert that a parsed JSON body contains no fields from the given blocklist.
|
|
268
233
|
*
|
|
269
|
-
* @param body - parsed response JSON
|
|
270
|
-
* @param blocklist - field names to check for
|
|
271
234
|
* @param context - description for error messages
|
|
272
235
|
*/
|
|
273
236
|
export const assert_no_sensitive_fields_in_json = (body, blocklist, context) => {
|
|
@@ -285,11 +248,6 @@ export const assert_no_sensitive_fields_in_json = (body, blocklist, context) =>
|
|
|
285
248
|
* - `role: admin` — the admin account's session cookie
|
|
286
249
|
* - `role: <other>` — the test app's bootstrapped keeper session
|
|
287
250
|
* - `keeper` — the test app's daemon token
|
|
288
|
-
*
|
|
289
|
-
* @param spec - route spec to inspect
|
|
290
|
-
* @param test_app - the assembled test app (for bootstrapped credentials)
|
|
291
|
-
* @param authed_account - an account with no roles (for `authenticated` auth)
|
|
292
|
-
* @param admin_account - an account with `admin` role (for role-gated routes)
|
|
293
251
|
*/
|
|
294
252
|
export const pick_auth_headers = (spec, test_app, authed_account, admin_account) => {
|
|
295
253
|
switch (spec.auth.type) {
|
|
@@ -63,7 +63,6 @@ export interface BearerAuthMocks {
|
|
|
63
63
|
* `query_account_by_id`, `query_actor_by_account`, and `query_permit_find_active_for_actor`
|
|
64
64
|
* so each test case controls return values independently.
|
|
65
65
|
*
|
|
66
|
-
* @param tc - the test config providing mock return values
|
|
67
66
|
* @returns mocks bundle with spy references
|
|
68
67
|
* @mutates module-level `vi.mock` registrations for `api_token_queries`,
|
|
69
68
|
* `account_queries`, and `permit_queries` — each call resets and re-binds
|
|
@@ -77,10 +76,6 @@ export declare const TEST_CLIENT_IP = "127.0.0.1";
|
|
|
77
76
|
*
|
|
78
77
|
* The route handler at `/api/test` returns the resolved context in the response body,
|
|
79
78
|
* enabling assertions on `REQUEST_CONTEXT_KEY` and `CREDENTIAL_TYPE_KEY`.
|
|
80
|
-
*
|
|
81
|
-
* @param tc - the test config providing mock behavior
|
|
82
|
-
* @param ip_rate_limiter - optional rate limiter (null to disable)
|
|
83
|
-
* @returns the app and mocks bundle
|
|
84
79
|
*/
|
|
85
80
|
export declare const create_bearer_auth_test_app: (tc: BearerAuthTestOptions, ip_rate_limiter?: RateLimiter | null) => {
|
|
86
81
|
app: Hono;
|
|
@@ -90,10 +85,6 @@ export declare const create_bearer_auth_test_app: (tc: BearerAuthTestOptions, ip
|
|
|
90
85
|
* Run a table of bearer auth middleware test cases.
|
|
91
86
|
*
|
|
92
87
|
* Generates one `test()` per case inside a `describe()` block.
|
|
93
|
-
*
|
|
94
|
-
* @param suite_name - the describe block name
|
|
95
|
-
* @param cases - the test case table
|
|
96
|
-
* @param ip_rate_limiter - optional rate limiter shared across cases
|
|
97
88
|
*/
|
|
98
89
|
export declare const describe_bearer_auth_cases: (suite_name: string, cases: Array<BearerAuthTestCase>, ip_rate_limiter?: RateLimiter | null) => void;
|
|
99
90
|
/** Path used by the echo route in `create_test_middleware_stack_app`. */
|
|
@@ -123,7 +114,6 @@ export interface TestMiddlewareStackApp {
|
|
|
123
114
|
* All DB queries return undefined (no real database needed).
|
|
124
115
|
* The echo route at `TEST_MIDDLEWARE_PATH` returns `{ok, client_ip, has_context}`.
|
|
125
116
|
*
|
|
126
|
-
* @param options - middleware stack configuration
|
|
127
117
|
* @returns the app and mock spies (reconfigure via `mockImplementation` for valid-token paths)
|
|
128
118
|
* @mutates module-level `vi.mock` registrations for the four bearer-auth query
|
|
129
119
|
* modules — each call resets the spies before wiring the stack.
|
|
@@ -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,CAAC,EAAE,OAAO,CAAC;IACjC,+CAA+C;IAC/C,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gFAAgF;IAChF,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+GAA+G;IAC/G,qBAAqB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;CAClC;AAED,gEAAgE;AAChE,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAChE,+EAA+E;IAC/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query_permit_find_active_for_actor`
|
|
42
42
|
* so each test case controls return values independently.
|
|
43
43
|
*
|
|
44
|
-
* @param tc - the test config providing mock return values
|
|
45
44
|
* @returns mocks bundle with spy references
|
|
46
45
|
* @mutates module-level `vi.mock` registrations for `api_token_queries`,
|
|
47
46
|
* `account_queries`, and `permit_queries` — each call resets and re-binds
|
|
@@ -73,10 +72,6 @@ export const TEST_CLIENT_IP = '127.0.0.1';
|
|
|
73
72
|
*
|
|
74
73
|
* The route handler at `/api/test` returns the resolved context in the response body,
|
|
75
74
|
* enabling assertions on `REQUEST_CONTEXT_KEY` and `CREDENTIAL_TYPE_KEY`.
|
|
76
|
-
*
|
|
77
|
-
* @param tc - the test config providing mock behavior
|
|
78
|
-
* @param ip_rate_limiter - optional rate limiter (null to disable)
|
|
79
|
-
* @returns the app and mocks bundle
|
|
80
75
|
*/
|
|
81
76
|
export const create_bearer_auth_test_app = (tc, ip_rate_limiter = null) => {
|
|
82
77
|
const mocks = create_bearer_auth_mocks(tc);
|
|
@@ -118,10 +113,6 @@ export const create_bearer_auth_test_app = (tc, ip_rate_limiter = null) => {
|
|
|
118
113
|
* Run a table of bearer auth middleware test cases.
|
|
119
114
|
*
|
|
120
115
|
* Generates one `test()` per case inside a `describe()` block.
|
|
121
|
-
*
|
|
122
|
-
* @param suite_name - the describe block name
|
|
123
|
-
* @param cases - the test case table
|
|
124
|
-
* @param ip_rate_limiter - optional rate limiter shared across cases
|
|
125
116
|
*/
|
|
126
117
|
export const describe_bearer_auth_cases = (suite_name, cases, ip_rate_limiter = null) => {
|
|
127
118
|
describe(suite_name, () => {
|
|
@@ -177,7 +168,6 @@ export const TEST_MIDDLEWARE_PATH = '/api/test';
|
|
|
177
168
|
* All DB queries return undefined (no real database needed).
|
|
178
169
|
* The echo route at `TEST_MIDDLEWARE_PATH` returns `{ok, client_ip, has_context}`.
|
|
179
170
|
*
|
|
180
|
-
* @param options - middleware stack configuration
|
|
181
171
|
* @returns the app and mock spies (reconfigure via `mockImplementation` for valid-token paths)
|
|
182
172
|
* @mutates module-level `vi.mock` registrations for the four bearer-auth query
|
|
183
173
|
* modules — each call resets the spies before wiring the stack.
|
|
@@ -14,8 +14,6 @@ export interface MockFs {
|
|
|
14
14
|
*
|
|
15
15
|
* `read_file` throws an `ENOENT`-tagged error for missing paths so callers
|
|
16
16
|
* can exercise the same "file doesn't exist" code path as `node:fs`.
|
|
17
|
-
*
|
|
18
|
-
* @param initial_files - starting contents keyed by absolute path
|
|
19
17
|
*/
|
|
20
18
|
export declare const create_mock_fs: (initial_files?: Record<string, string>) => MockFs;
|
|
21
19
|
//# sourceMappingURL=mock_fs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_fs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/mock_fs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACtB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC/C;AAED
|
|
1
|
+
{"version":3,"file":"mock_fs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/mock_fs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACtB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC/C;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,gBAAe,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KAAG,MAuB3E,CAAC"}
|
package/dist/testing/mock_fs.js
CHANGED
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
*
|
|
10
10
|
* `read_file` throws an `ENOENT`-tagged error for missing paths so callers
|
|
11
11
|
* can exercise the same "file doesn't exist" code path as `node:fs`.
|
|
12
|
-
*
|
|
13
|
-
* @param initial_files - starting contents keyed by absolute path
|
|
14
12
|
*/
|
|
15
13
|
export const create_mock_fs = (initial_files = {}) => {
|
|
16
14
|
const files = { ...initial_files };
|
|
@@ -53,7 +53,6 @@ export interface RateLimitingTestOptions {
|
|
|
53
53
|
* Each test group asserts that required routes exist, failing with a descriptive
|
|
54
54
|
* message if the consumer's route specs are misconfigured.
|
|
55
55
|
*
|
|
56
|
-
* @param options - session config and route factory
|
|
57
56
|
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
58
57
|
* bearer-auth rate-limit test probes via the `account_verify` RPC action,
|
|
59
58
|
* so the suite hard-fails via `require_rpc_endpoint_path`.
|
|
@@ -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,S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AC;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;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS,uBAAuB,KAAG,IA8P/E,CAAC"}
|
|
@@ -35,7 +35,6 @@ import { account_verify_action_spec } from '../auth/account_action_specs.js';
|
|
|
35
35
|
* Each test group asserts that required routes exist, failing with a descriptive
|
|
36
36
|
* message if the consumer's route specs are misconfigured.
|
|
37
37
|
*
|
|
38
|
-
* @param options - session config and route factory
|
|
39
38
|
* @throws Error at setup time when `options.rpc_endpoints` is empty — the
|
|
40
39
|
* bearer-auth rate-limit test probes via the `account_verify` RPC action,
|
|
41
40
|
* so the suite hard-fails via `require_rpc_endpoint_path`.
|
|
@@ -30,8 +30,6 @@ export interface RoundTripTestOptions {
|
|
|
30
30
|
* SSE routes are skipped (Content-Type `text/event-stream`).
|
|
31
31
|
* Routes returning non-2xx with valid input are still validated against
|
|
32
32
|
* their declared error schemas.
|
|
33
|
-
*
|
|
34
|
-
* @param options - round-trip test configuration
|
|
35
33
|
*/
|
|
36
34
|
export declare const describe_round_trip_validation: (options: RoundTripTestOptions) => void;
|
|
37
35
|
//# sourceMappingURL=round_trip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"round_trip.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/round_trip.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAc7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAG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;IACjD,WAAW,CAAC,EAAE,OAAO,CACpB,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,iBAAiB,GAAG,oBAAoB,CAAC,CAC5E,CAAC;IACF,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC,kDAAkD;IAClD,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,+EAA+E;IAC/E,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,8BAA8B,GAAI,SAAS,oBAAoB,KAAG,IA6F9E,CAAC"}
|
|
@@ -29,8 +29,6 @@ import { create_stub_app_server_context } from './stubs.js';
|
|
|
29
29
|
* SSE routes are skipped (Content-Type `text/event-stream`).
|
|
30
30
|
* Routes returning non-2xx with valid input are still validated against
|
|
31
31
|
* their declared error schemas.
|
|
32
|
-
*
|
|
33
|
-
* @param options - round-trip test configuration
|
|
34
32
|
*/
|
|
35
33
|
export const describe_round_trip_validation = (options) => {
|
|
36
34
|
const skip_set = new Set(options.skip_routes);
|
|
@@ -16,8 +16,6 @@ export interface RpcAttackSurfaceOptions {
|
|
|
16
16
|
* 3. Adversarial params — schema-invalid params per method
|
|
17
17
|
*
|
|
18
18
|
* Skips silently when `surface.rpc_endpoints` is empty.
|
|
19
|
-
*
|
|
20
|
-
* @param options - the test configuration
|
|
21
19
|
*/
|
|
22
20
|
export declare const describe_rpc_attack_surface_tests: (options: RpcAttackSurfaceOptions) => void;
|
|
23
21
|
//# sourceMappingURL=rpc_attack_surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc_attack_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_attack_surface.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAkB7B,OAAO,KAAK,EAA6C,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAoBnG,uDAAuD;AACvD,MAAM,WAAW,uBAAuB;IACvC,+FAA+F;IAC/F,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5B,yDAAyD;IACzD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACrB;AAodD
|
|
1
|
+
{"version":3,"file":"rpc_attack_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/rpc_attack_surface.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAkB7B,OAAO,KAAK,EAA6C,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAoBnG,uDAAuD;AACvD,MAAM,WAAW,uBAAuB;IACvC,+FAA+F;IAC/F,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5B,yDAAyD;IACzD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACrB;AAodD;;;;;;;;;GASG;AACH,eAAO,MAAM,iCAAiC,GAAI,SAAS,uBAAuB,KAAG,IAOpF,CAAC"}
|
|
@@ -383,8 +383,6 @@ const format_auth = (auth) => {
|
|
|
383
383
|
* 3. Adversarial params — schema-invalid params per method
|
|
384
384
|
*
|
|
385
385
|
* Skips silently when `surface.rpc_endpoints` is empty.
|
|
386
|
-
*
|
|
387
|
-
* @param options - the test configuration
|
|
388
386
|
*/
|
|
389
387
|
export const describe_rpc_attack_surface_tests = (options) => {
|
|
390
388
|
const { surface } = options.build();
|
|
@@ -42,7 +42,6 @@ export declare const resolve_rpc_endpoints_for_setup: (rpc_endpoints: RpcEndpoin
|
|
|
42
42
|
/**
|
|
43
43
|
* Create a `RequestInit` for a JSON-RPC POST request.
|
|
44
44
|
*
|
|
45
|
-
* @param method - JSON-RPC method name
|
|
46
45
|
* @param params - params (omit for parameterless methods; `null` is also
|
|
47
46
|
* stripped for ergonomic call sites — JSON-RPC 2.0 §4.2
|
|
48
47
|
* forbids `"params": null` on the wire, and `create_rpc_endpoint`
|
|
@@ -51,17 +50,14 @@ export declare const resolve_rpc_endpoints_for_setup: (rpc_endpoints: RpcEndpoin
|
|
|
51
50
|
* envelope (e.g. asserting envelope-level rejection) should
|
|
52
51
|
* build the body inline rather than route through this helper.
|
|
53
52
|
* @param id - request id (default `'test'`)
|
|
54
|
-
* @returns a `RequestInit` with the JSON-RPC envelope as body
|
|
55
53
|
*/
|
|
56
54
|
export declare const create_rpc_post_init: (method: string, params?: unknown, id?: string | number) => RequestInit;
|
|
57
55
|
/**
|
|
58
56
|
* Build a GET URL with JSON-RPC query parameters.
|
|
59
57
|
*
|
|
60
58
|
* @param endpoint_path - the RPC endpoint path (e.g., `/api/rpc`)
|
|
61
|
-
* @param method - JSON-RPC method name
|
|
62
59
|
* @param params - params (omit for parameterless methods)
|
|
63
60
|
* @param id - request id (default `'test'`)
|
|
64
|
-
* @returns the full URL with query string
|
|
65
61
|
*/
|
|
66
62
|
export declare const create_rpc_get_url: (endpoint_path: string, method: string, params?: unknown, id?: string | number) => string;
|
|
67
63
|
/**
|
|
@@ -70,7 +66,6 @@ export declare const create_rpc_get_url: (endpoint_path: string, method: string,
|
|
|
70
66
|
* Validates the structure matches `JsonrpcErrorResponse` and optionally
|
|
71
67
|
* checks the error code.
|
|
72
68
|
*
|
|
73
|
-
* @param body - parsed response body
|
|
74
69
|
* @param expected_code - optional error code to assert
|
|
75
70
|
*/
|
|
76
71
|
export declare const assert_jsonrpc_error_response: (body: unknown, expected_code?: JsonrpcErrorCode) => void;
|
|
@@ -81,7 +76,6 @@ export declare const assert_jsonrpc_error_response: (body: unknown, expected_cod
|
|
|
81
76
|
* is provided, also validates the `result` field against the declared
|
|
82
77
|
* output schema — matching the REST round-trip's `assert_response_matches_spec`.
|
|
83
78
|
*
|
|
84
|
-
* @param body - parsed response body
|
|
85
79
|
* @param output_schema - optional Zod schema to validate the `result` field against
|
|
86
80
|
*/
|
|
87
81
|
export declare const assert_jsonrpc_success_response: (body: unknown, output_schema?: z.ZodType) => void;
|