@fuzdev/fuz_app 0.64.0 → 0.66.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 +510 -946
- package/dist/actions/action_codegen.d.ts +1 -1
- package/dist/actions/action_codegen.js +1 -1
- package/dist/actions/action_event_data.d.ts +1 -1
- package/dist/actions/broadcast_api.d.ts +1 -1
- package/dist/actions/broadcast_api.js +1 -1
- package/dist/actions/cancel.d.ts +2 -2
- package/dist/actions/cancel.js +3 -3
- package/dist/actions/connection_closer.d.ts +1 -4
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +1 -4
- package/dist/actions/register_action_ws.d.ts +2 -2
- package/dist/actions/register_ws_endpoint.d.ts +1 -1
- package/dist/actions/transports_ws_auth_guard.d.ts +1 -2
- package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
- package/dist/actions/transports_ws_auth_guard.js +1 -2
- package/dist/auth/CLAUDE.md +570 -1871
- package/dist/auth/account_schema.d.ts +1 -1
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/api_token_queries.js +1 -1
- package/dist/auth/audit_log_ddl.d.ts +1 -1
- package/dist/auth/audit_log_ddl.d.ts.map +1 -1
- package/dist/auth/audit_log_ddl.js +1 -1
- package/dist/auth/audit_log_schema.js +2 -2
- package/dist/auth/bootstrap_account.d.ts.map +1 -1
- package/dist/auth/bootstrap_account.js +1 -5
- package/dist/auth/bootstrap_routes.d.ts +7 -1
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +15 -11
- package/dist/auth/daemon_token_middleware.d.ts +15 -5
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +24 -15
- package/dist/auth/invite_queries.d.ts +17 -7
- package/dist/auth/invite_queries.d.ts.map +1 -1
- package/dist/auth/invite_queries.js +19 -8
- package/dist/auth/keyring.d.ts +6 -6
- package/dist/auth/keyring.js +8 -8
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +4 -2
- package/dist/auth/signup_routes.d.ts +47 -1
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +103 -52
- package/dist/db/create_db.d.ts.map +1 -1
- package/dist/db/create_db.js +13 -0
- package/dist/dev/setup.d.ts +2 -2
- package/dist/dev/setup.js +3 -3
- package/dist/env/resolve.d.ts +44 -7
- package/dist/env/resolve.d.ts.map +1 -1
- package/dist/env/resolve.js +94 -27
- package/dist/http/CLAUDE.md +243 -522
- package/dist/http/error_schemas.d.ts +0 -4
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +0 -4
- package/dist/http/ip_canonical.d.ts +5 -4
- package/dist/http/ip_canonical.d.ts.map +1 -1
- package/dist/http/ip_canonical.js +8 -4
- package/dist/http/jsonrpc.d.ts +23 -7
- package/dist/http/jsonrpc.d.ts.map +1 -1
- package/dist/http/jsonrpc.js +19 -3
- package/dist/http/origin.d.ts +1 -1
- package/dist/http/origin.js +1 -1
- package/dist/http/surface.d.ts +9 -2
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/runtime/mock.d.ts +1 -1
- package/dist/runtime/mock.js +2 -2
- package/dist/server/app_server.d.ts +41 -10
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +10 -4
- package/dist/server/env.d.ts +7 -7
- package/dist/server/env.d.ts.map +1 -1
- package/dist/server/env.js +14 -14
- package/dist/server/static.d.ts +4 -4
- package/dist/server/static.js +7 -7
- package/dist/testing/CLAUDE.md +740 -418
- package/dist/testing/admin_integration.d.ts +18 -23
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +230 -216
- package/dist/testing/app_server.d.ts +141 -39
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +157 -44
- package/dist/testing/audit_completeness.d.ts +25 -22
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +198 -159
- package/dist/testing/bootstrap_success.d.ts +28 -0
- package/dist/testing/bootstrap_success.d.ts.map +1 -0
- package/dist/testing/bootstrap_success.js +144 -0
- package/dist/testing/cross_backend/backend_config.d.ts +113 -0
- package/dist/testing/cross_backend/backend_config.d.ts.map +1 -0
- package/dist/testing/cross_backend/backend_config.js +1 -0
- package/dist/testing/cross_backend/bench/bench_report.d.ts +46 -0
- package/dist/testing/cross_backend/bench/bench_report.d.ts.map +1 -0
- package/dist/testing/cross_backend/bench/bench_report.js +83 -0
- package/dist/testing/cross_backend/bench/run_cross_impl_bench.d.ts +44 -0
- package/dist/testing/cross_backend/bench/run_cross_impl_bench.d.ts.map +1 -0
- package/dist/testing/cross_backend/bench/run_cross_impl_bench.js +38 -0
- package/dist/testing/cross_backend/bench/scenario.d.ts +57 -0
- package/dist/testing/cross_backend/bench/scenario.d.ts.map +1 -0
- package/dist/testing/cross_backend/bench/scenario.js +28 -0
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +41 -0
- package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -0
- package/dist/testing/cross_backend/bootstrap_backend.js +34 -0
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts +24 -0
- package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -0
- package/dist/testing/cross_backend/build_test_backend_paths.js +33 -0
- package/dist/testing/cross_backend/capabilities.d.ts +65 -0
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -0
- package/dist/testing/cross_backend/capabilities.js +47 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts +122 -0
- package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -0
- package/dist/testing/cross_backend/default_backend_configs.js +111 -0
- package/dist/testing/cross_backend/default_secrets.d.ts +40 -0
- package/dist/testing/cross_backend/default_secrets.d.ts.map +1 -0
- package/dist/testing/cross_backend/default_secrets.js +39 -0
- package/dist/testing/cross_backend/default_spine_surface.d.ts +64 -0
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -0
- package/dist/testing/cross_backend/default_spine_surface.js +121 -0
- package/dist/testing/cross_backend/setup.d.ts +451 -0
- package/dist/testing/cross_backend/setup.d.ts.map +1 -0
- package/dist/testing/cross_backend/setup.js +581 -0
- package/dist/testing/cross_backend/spawn_backend.d.ts +58 -0
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -0
- package/dist/testing/cross_backend/spawn_backend.js +229 -0
- package/dist/testing/cross_backend/spine_stub_backend_config.d.ts +66 -0
- package/dist/testing/cross_backend/spine_stub_backend_config.d.ts.map +1 -0
- package/dist/testing/cross_backend/spine_stub_backend_config.js +49 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts +37 -0
- package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -0
- package/dist/testing/cross_backend/sse_round_trip.js +137 -0
- package/dist/testing/cross_backend/standard.d.ts +96 -0
- package/dist/testing/cross_backend/standard.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard.js +49 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +171 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_reset_actions.js +213 -0
- package/dist/testing/cross_backend/testing_server_bun.d.ts +5 -0
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_bun.js +59 -0
- package/dist/testing/cross_backend/testing_server_core.d.ts +140 -0
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_core.js +68 -0
- package/dist/testing/cross_backend/testing_server_deno.d.ts +5 -0
- package/dist/testing/cross_backend/testing_server_deno.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_deno.js +37 -0
- package/dist/testing/cross_backend/testing_server_node.d.ts +5 -0
- package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_server_node.js +50 -0
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +72 -0
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -0
- package/dist/testing/cross_backend/ts_spine_backend_config.js +112 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts +35 -0
- package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -0
- package/dist/testing/cross_backend/ws_round_trip.js +113 -0
- package/dist/testing/data_exposure.d.ts +11 -14
- package/dist/testing/data_exposure.d.ts.map +1 -1
- package/dist/testing/data_exposure.js +123 -146
- package/dist/testing/db_entities.d.ts +22 -1
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +24 -1
- package/dist/testing/integration.d.ts +56 -21
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +294 -319
- package/dist/testing/integration_helpers.d.ts +16 -6
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +7 -7
- 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.map +1 -1
- package/dist/testing/rate_limiting.js +9 -0
- package/dist/testing/role_grant_helpers.d.ts +31 -0
- package/dist/testing/role_grant_helpers.d.ts.map +1 -0
- package/dist/testing/role_grant_helpers.js +46 -0
- package/dist/testing/round_trip.d.ts +20 -16
- package/dist/testing/round_trip.d.ts.map +1 -1
- package/dist/testing/round_trip.js +61 -86
- package/dist/testing/rpc_helpers.d.ts +10 -4
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +1 -1
- package/dist/testing/rpc_round_trip.d.ts +24 -21
- package/dist/testing/rpc_round_trip.d.ts.map +1 -1
- package/dist/testing/rpc_round_trip.js +87 -104
- package/dist/testing/schema_introspect.d.ts +106 -0
- package/dist/testing/schema_introspect.d.ts.map +1 -0
- package/dist/testing/schema_introspect.js +123 -0
- package/dist/testing/schema_parity.d.ts +144 -0
- package/dist/testing/schema_parity.d.ts.map +1 -0
- package/dist/testing/schema_parity.js +233 -0
- package/dist/testing/sse_round_trip.d.ts.map +1 -1
- package/dist/testing/sse_round_trip.js +1 -68
- package/dist/testing/standard.d.ts +56 -25
- package/dist/testing/standard.d.ts.map +1 -1
- package/dist/testing/standard.js +62 -5
- package/dist/testing/stubs.d.ts +21 -6
- package/dist/testing/stubs.d.ts.map +1 -1
- package/dist/testing/stubs.js +33 -23
- package/dist/testing/testing_rate_limiter.d.ts +59 -0
- package/dist/testing/testing_rate_limiter.d.ts.map +1 -0
- package/dist/testing/testing_rate_limiter.js +74 -0
- package/dist/testing/transports/bootstrap.d.ts +52 -0
- package/dist/testing/transports/bootstrap.d.ts.map +1 -0
- package/dist/testing/transports/bootstrap.js +70 -0
- package/dist/testing/transports/fetch_transport.d.ts +81 -0
- package/dist/testing/transports/fetch_transport.d.ts.map +1 -0
- package/dist/testing/transports/fetch_transport.js +74 -0
- package/dist/testing/transports/sse_frame_reader.d.ts +41 -0
- package/dist/testing/transports/sse_frame_reader.d.ts.map +1 -0
- package/dist/testing/transports/sse_frame_reader.js +84 -0
- package/dist/testing/transports/sse_transport.d.ts +54 -0
- package/dist/testing/transports/sse_transport.d.ts.map +1 -0
- package/dist/testing/transports/sse_transport.js +51 -0
- package/dist/testing/transports/ws_client.d.ts +108 -0
- package/dist/testing/transports/ws_client.d.ts.map +1 -0
- package/dist/testing/transports/ws_client.js +56 -0
- package/dist/testing/transports/ws_transport.d.ts +43 -0
- package/dist/testing/transports/ws_transport.d.ts.map +1 -0
- package/dist/testing/transports/ws_transport.js +169 -0
- package/dist/testing/ws_round_trip.d.ts +21 -103
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +42 -40
- package/dist/ui/CLAUDE.md +5 -3
- package/dist/ui/MenuLink.svelte +16 -16
- package/dist/ui/MenuLink.svelte.d.ts +13 -4
- package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
- package/package.json +10 -4
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical no-domain spine surface — the standard fuz_app
|
|
4
|
+
* auth/account/admin/audit surface with no consumer domain layer on top.
|
|
5
|
+
*
|
|
6
|
+
* This is the single source of truth for "the standard spine surface",
|
|
7
|
+
* shared by:
|
|
8
|
+
*
|
|
9
|
+
* - the Rust `testing_spine_stub` cross-process self-tests (which build the
|
|
10
|
+
* `AppSurfaceSpec` via `create_spine_surface_spec` and drive the binary's
|
|
11
|
+
* wire shape),
|
|
12
|
+
* - the TS `testing_spine_server` cross-process binary (which feeds
|
|
13
|
+
* `create_spine_route_specs` + `spine_rpc_endpoints` into a live
|
|
14
|
+
* `create_app_server`), and
|
|
15
|
+
* - the `cross_backend_ts_*` self-test projects.
|
|
16
|
+
*
|
|
17
|
+
* **`$lib`-free by contract.** This module and everything it imports use
|
|
18
|
+
* relative specifiers (no `$lib` SvelteKit alias) so the spawned TS test
|
|
19
|
+
* binary — run under Gro's loader, which resolves `.js`→`.ts` and package
|
|
20
|
+
* imports but **not** the `$lib` alias — can import it transitively. Keep
|
|
21
|
+
* it that way: a `$lib` import anywhere in this graph breaks the binary
|
|
22
|
+
* spawn while still typechecking under vitest.
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
import { create_account_route_specs } from '../../auth/account_routes.js';
|
|
27
|
+
import { create_audit_log_route_specs } from '../../auth/audit_log_routes.js';
|
|
28
|
+
import { create_role_schema } from '../../auth/role_schema.js';
|
|
29
|
+
import { create_session_config } from '../../auth/session_cookie.js';
|
|
30
|
+
import { create_signup_route_specs } from '../../auth/signup_routes.js';
|
|
31
|
+
import { create_standard_rpc_actions } from '../../auth/standard_rpc_actions.js';
|
|
32
|
+
import { prefix_route_specs } from '../../http/route_spec.js';
|
|
33
|
+
import { create_test_app_surface_spec } from '../stubs.js';
|
|
34
|
+
/**
|
|
35
|
+
* Session config — cookie name matches the binary's issued session cookie
|
|
36
|
+
* (`fuz_session`) so cookie-attribute assertions + jar extraction line up.
|
|
37
|
+
*/
|
|
38
|
+
export const spine_session_options = create_session_config('fuz_session');
|
|
39
|
+
/**
|
|
40
|
+
* Built-in roles only — the standard spine registers no app-defined role
|
|
41
|
+
* specs. When the spine grows additional grantable roles, thread their
|
|
42
|
+
* registry through `create_role_schema` here so the admin suite picks up
|
|
43
|
+
* grant-path coverage.
|
|
44
|
+
*/
|
|
45
|
+
export const spine_roles = create_role_schema([]);
|
|
46
|
+
/** RPC endpoint mount path — matches the binary's `/api/rpc`. */
|
|
47
|
+
export const SPINE_RPC_PATH = '/api/rpc';
|
|
48
|
+
/**
|
|
49
|
+
* Audit-log SSE stream path — `/api/admin` prefix + the
|
|
50
|
+
* `create_audit_log_route_specs` `/audit/stream` route. Matches the default
|
|
51
|
+
* `BackendConfig.sse_path` and the cross-process SSE suite's default. Only
|
|
52
|
+
* mounted by the TS spine binary (which wires `audit_log_sse`); the shared
|
|
53
|
+
* surface stub leaves `ctx.audit_sse` null so the snapshot stays SSE-free.
|
|
54
|
+
*/
|
|
55
|
+
export const SPINE_SSE_PATH = '/api/admin/audit/stream';
|
|
56
|
+
/**
|
|
57
|
+
* Factory-form RPC endpoints so the `app_settings_update` handler closes
|
|
58
|
+
* over the per-test `ctx.app_settings`. `create_app_server` (in the binary)
|
|
59
|
+
* owns live dispatch; the surface builder invokes the factory once with a
|
|
60
|
+
* stub ctx for setup-time path/method lookup, so the handler closures are
|
|
61
|
+
* never called across the process boundary.
|
|
62
|
+
*
|
|
63
|
+
* Test binaries append their own `_testing_reset` action to this endpoint's
|
|
64
|
+
* `actions` (see `testing_reset_actions.ts`); it is intentionally excluded
|
|
65
|
+
* here so it stays off the declared surface (the harness calls it directly
|
|
66
|
+
* over the daemon-token channel).
|
|
67
|
+
*/
|
|
68
|
+
export const spine_rpc_endpoints = (ctx) => [
|
|
69
|
+
{
|
|
70
|
+
path: SPINE_RPC_PATH,
|
|
71
|
+
actions: create_standard_rpc_actions(ctx.deps, {
|
|
72
|
+
app_settings: ctx.app_settings,
|
|
73
|
+
roles: spine_roles,
|
|
74
|
+
}),
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
/**
|
|
78
|
+
* Account REST + signup route specs under `/api/account` (bootstrap
|
|
79
|
+
* auto-mounted by the surface builder / `create_app_server`), plus the
|
|
80
|
+
* audit-log SSE stream under `/api/admin` **only when `ctx.audit_sse` is
|
|
81
|
+
* set** (the TS spine binary passes `audit_log_sse: true`).
|
|
82
|
+
*
|
|
83
|
+
* The shared `create_spine_surface_spec()` builds its ctx with
|
|
84
|
+
* `audit_sse: null`, so the declared surface snapshot stays SSE-free and the
|
|
85
|
+
* Rust `spine_stub` cross test is unaffected — only the live TS binary mounts
|
|
86
|
+
* the stream at `SPINE_SSE_PATH`.
|
|
87
|
+
*/
|
|
88
|
+
export const create_spine_route_specs = (ctx) => [
|
|
89
|
+
...prefix_route_specs('/api/account', [
|
|
90
|
+
...create_account_route_specs(ctx.deps, {
|
|
91
|
+
session_options: spine_session_options,
|
|
92
|
+
ip_rate_limiter: null,
|
|
93
|
+
login_account_rate_limiter: null,
|
|
94
|
+
login_fail_floor_ms: 0,
|
|
95
|
+
}),
|
|
96
|
+
...create_signup_route_specs(ctx.deps, {
|
|
97
|
+
session_options: spine_session_options,
|
|
98
|
+
ip_rate_limiter: null,
|
|
99
|
+
signup_account_rate_limiter: null,
|
|
100
|
+
app_settings: ctx.app_settings,
|
|
101
|
+
}),
|
|
102
|
+
]),
|
|
103
|
+
...(ctx.audit_sse
|
|
104
|
+
? prefix_route_specs('/api/admin', create_audit_log_route_specs({ stream: ctx.audit_sse }))
|
|
105
|
+
: []),
|
|
106
|
+
];
|
|
107
|
+
/**
|
|
108
|
+
* The `AppSurfaceSpec` for the standard spine surface — the wire-shape
|
|
109
|
+
* source the cross-process round-trip + RPC-round-trip suites validate
|
|
110
|
+
* against. `bootstrap: {mode: 'surface_only'}` mounts
|
|
111
|
+
* `POST /api/account/bootstrap`'s shape to match the binary (which wires
|
|
112
|
+
* bootstrap for real); the harness's `globalSetup` already consumed the
|
|
113
|
+
* live bootstrap, so the cross-process round-trip validates the binary's
|
|
114
|
+
* 409 against the route's declared error schema.
|
|
115
|
+
*/
|
|
116
|
+
export const create_spine_surface_spec = () => create_test_app_surface_spec({
|
|
117
|
+
session_options: spine_session_options,
|
|
118
|
+
create_route_specs: create_spine_route_specs,
|
|
119
|
+
rpc_endpoints: spine_rpc_endpoints,
|
|
120
|
+
bootstrap: { mode: 'surface_only' },
|
|
121
|
+
});
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
3
|
+
import type { Keyring } from '../../auth/keyring.js';
|
|
4
|
+
import type { RouteSpec } from '../../http/route_spec.js';
|
|
5
|
+
import type { AppServerContext, BootstrapServerOptions } from '../../server/app_server.js';
|
|
6
|
+
import type { SessionOptions } from '../../auth/session_cookie.js';
|
|
7
|
+
import { type CreateTestAppOptions, type SuiteAppOptions, type TestAccount, type TestAppServer } from '../app_server.js';
|
|
8
|
+
import { type RpcEndpointsSuiteOption } from '../rpc_helpers.js';
|
|
9
|
+
import { type BackendCapabilities } from './capabilities.js';
|
|
10
|
+
import type { AppSurfaceSpec } from '../../http/surface.js';
|
|
11
|
+
import { type FetchTransport } from '../transports/fetch_transport.js';
|
|
12
|
+
import type { BackendHandle } from './spawn_backend.js';
|
|
13
|
+
/**
|
|
14
|
+
* Options for `TestFixture.create_account` — mints an additional
|
|
15
|
+
* bootstrapped account alongside the keeper. Matches the existing
|
|
16
|
+
* `TestApp.create_account` signature so the migration to fixture-style
|
|
17
|
+
* reads is a one-site call rewrite per use.
|
|
18
|
+
*/
|
|
19
|
+
export interface CreateTestAccountOptions {
|
|
20
|
+
readonly username?: string;
|
|
21
|
+
readonly password_value?: string;
|
|
22
|
+
readonly roles?: Array<string>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Shape returned by `TestFixture.create_account`. Aliased to the
|
|
26
|
+
* existing `TestAccount` interface from `app_server.ts` — same shape,
|
|
27
|
+
* stable name on the cross-backend testing surface so call sites read
|
|
28
|
+
* `fixture.create_account(...)` returning `TestAccountFixture` without
|
|
29
|
+
* crossing module boundaries.
|
|
30
|
+
*/
|
|
31
|
+
export type TestAccountFixture = TestAccount;
|
|
32
|
+
/**
|
|
33
|
+
* Spec for a bootstrap-time secondary account seeded alongside the
|
|
34
|
+
* keeper by `_testing_reset` (cross-process) or `create_test_app`
|
|
35
|
+
* (in-process). Used for accounts whose required roles aren't
|
|
36
|
+
* admin-grantable via offer/accept — primarily `ROLE_KEEPER` (whose
|
|
37
|
+
* `RoleSpec.grant_paths` is bootstrap-only), where the only way to
|
|
38
|
+
* land the grant is at the bootstrap-equivalent setup step.
|
|
39
|
+
*
|
|
40
|
+
* For admin-grantable roles, prefer `fixture.create_account({roles})`
|
|
41
|
+
* — that goes through the production offer/accept handlers and
|
|
42
|
+
* observes audit + WS fan-out. `extra_accounts` is the cradle-only
|
|
43
|
+
* bypass; the runtime has no equivalent action.
|
|
44
|
+
*/
|
|
45
|
+
export interface ExtraAccountSpec {
|
|
46
|
+
readonly username: string;
|
|
47
|
+
readonly password_value?: string;
|
|
48
|
+
readonly roles: ReadonlyArray<string>;
|
|
49
|
+
}
|
|
50
|
+
/** Bootstrap-time-seeded secondary account exposed on the fixture. */
|
|
51
|
+
export interface ExtraAccountFixture {
|
|
52
|
+
readonly account: {
|
|
53
|
+
readonly id: Uuid;
|
|
54
|
+
readonly username: string;
|
|
55
|
+
};
|
|
56
|
+
readonly actor: {
|
|
57
|
+
readonly id: Uuid;
|
|
58
|
+
};
|
|
59
|
+
readonly api_token: string;
|
|
60
|
+
readonly session_cookie: string;
|
|
61
|
+
readonly create_session_headers: (extra?: Record<string, string>) => Record<string, string>;
|
|
62
|
+
readonly create_bearer_headers: (extra?: Record<string, string>) => Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Fields shared by every `TestFixture` regardless of transport. The
|
|
66
|
+
* discriminated union below adds in-process-only fields conditionally.
|
|
67
|
+
*
|
|
68
|
+
* **Keeper ≠ admin.** `fixture.account` / `fixture.actor` refer to the
|
|
69
|
+
* **fresh keeper** seeded per test. The keeper account holds
|
|
70
|
+
* `ROLE_KEEPER` + `ROLE_ADMIN` by default — matching the production
|
|
71
|
+
* `bootstrap_account` flow. The `ROLE_KEEPER` role itself does *not*
|
|
72
|
+
* grant admin reach; the bootstrap account just happens to hold both as
|
|
73
|
+
* separate grants. Tests probing the keeper-vs-admin separation (e.g.
|
|
74
|
+
* "non-admin cannot list accounts") declare a secondary at setup-time
|
|
75
|
+
* via `extra_accounts: [{username, roles: [ROLE_KEEPER]}]` and read it
|
|
76
|
+
* from `fixture.extra_accounts[username]`.
|
|
77
|
+
*/
|
|
78
|
+
export interface TestFixtureBase {
|
|
79
|
+
/**
|
|
80
|
+
* Transport for this test's HTTP requests. Typed as `FetchTransport`
|
|
81
|
+
* so cross-process tests can call `transport.cookies()` for WS upgrade
|
|
82
|
+
* cookie threading; in-process provides a no-op `cookies()` returning
|
|
83
|
+
* `[]` (in-process tests construct cookies via `create_session_headers`
|
|
84
|
+
* directly and don't thread WS through this channel).
|
|
85
|
+
*/
|
|
86
|
+
readonly transport: FetchTransport;
|
|
87
|
+
/**
|
|
88
|
+
* Build a brand-new `FetchTransport` with an empty cookie jar pinned to
|
|
89
|
+
* the same backend. Use for unauthed assertions (`no cookie on protected
|
|
90
|
+
* route returns 401`, bearer-only calls expected to fall through to the
|
|
91
|
+
* unauthenticated path) where the per-test session cookie carried by
|
|
92
|
+
* `transport`'s jar would otherwise leak into the request and convert a
|
|
93
|
+
* 401 into a 200.
|
|
94
|
+
*
|
|
95
|
+
* **New-per-call, not memoized** — each invocation returns a fresh
|
|
96
|
+
* instance. If a call mutates the jar (e.g. an unauthed login attempt
|
|
97
|
+
* returning `Set-Cookie`) it can't pollute sibling calls.
|
|
98
|
+
*
|
|
99
|
+
* Pass `origin: null` for bearer-only probes that must look like
|
|
100
|
+
* non-browser callers — the auth middleware silently discards bearer
|
|
101
|
+
* credentials when `Origin`/`Referer` is present, so a default
|
|
102
|
+
* `Origin: <base_url>` would convert "bearer + no Origin → 200" into
|
|
103
|
+
* "bearer + Origin → discarded → 401" cross-process. In-process the
|
|
104
|
+
* wrapper is stateless and the option is a no-op (no auto-Origin to
|
|
105
|
+
* suppress).
|
|
106
|
+
*
|
|
107
|
+
* In-process this is functionally identical to `transport` (the wrapper's
|
|
108
|
+
* `cookies(): []` is a no-op already); cross-process the returned
|
|
109
|
+
* transport starts with an empty jar at the same `base_url`.
|
|
110
|
+
*/
|
|
111
|
+
readonly fresh_transport: (options?: {
|
|
112
|
+
readonly origin?: string | null;
|
|
113
|
+
}) => FetchTransport;
|
|
114
|
+
/** The freshly-bootstrapped keeper account. */
|
|
115
|
+
readonly account: {
|
|
116
|
+
readonly id: Uuid;
|
|
117
|
+
readonly username: string;
|
|
118
|
+
};
|
|
119
|
+
/** The actor linked to the keeper account. */
|
|
120
|
+
readonly actor: {
|
|
121
|
+
readonly id: Uuid;
|
|
122
|
+
};
|
|
123
|
+
/** Build request headers with the keeper's session cookie. */
|
|
124
|
+
readonly create_session_headers: (extra?: Record<string, string>) => Record<string, string>;
|
|
125
|
+
/** Build request headers with the keeper's bearer token. */
|
|
126
|
+
readonly create_bearer_headers: (extra?: Record<string, string>) => Record<string, string>;
|
|
127
|
+
/** Build request headers with the daemon token (keeper auth). */
|
|
128
|
+
readonly create_daemon_token_headers: (extra?: Record<string, string>) => Record<string, string>;
|
|
129
|
+
/**
|
|
130
|
+
* Mint an additional bootstrapped account for cross-account / multi-user
|
|
131
|
+
* tests. In-process: re-uses `create_test_account_with_credentials` against the same DB;
|
|
132
|
+
* cross-process: goes through the consumer-supplied DB-admin
|
|
133
|
+
* channel.
|
|
134
|
+
*/
|
|
135
|
+
readonly create_account: (options?: CreateTestAccountOptions) => Promise<TestAccountFixture>;
|
|
136
|
+
/**
|
|
137
|
+
* Bootstrap-time-seeded secondaries, keyed by their declared
|
|
138
|
+
* `username`. Populated from the `extra_accounts` option passed to
|
|
139
|
+
* `default_in_process_setup` / `default_cross_process_setup`. Empty
|
|
140
|
+
* for suites that don't declare any.
|
|
141
|
+
*/
|
|
142
|
+
readonly extra_accounts: Readonly<Record<string, ExtraAccountFixture>>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The per-test bundle returned by `SetupTest`. Every Tier 1 suite body
|
|
146
|
+
* reads exclusively from this shape — no `test_app.backend.*` reads
|
|
147
|
+
* remain in the suite bodies.
|
|
148
|
+
*
|
|
149
|
+
* Discriminated by `in_process`: when `true`, `keyring` and
|
|
150
|
+
* `backend_internals` are present (compile-time narrowed); when `false`,
|
|
151
|
+
* they're absent and the suite body must either run via the public wire
|
|
152
|
+
* (cross-process) or gate the test with
|
|
153
|
+
* `test_if(capabilities.in_process_only, ...)`. The discriminant value
|
|
154
|
+
* mirrors `BackendCapabilities.in_process_only` — both source from the
|
|
155
|
+
* same producer (`default_in_process_setup` vs. cross-process variant).
|
|
156
|
+
*
|
|
157
|
+
* Suite bodies narrow with `assert(fixture.in_process)` after
|
|
158
|
+
* `setup_test()`; sites that reach for `keyring` or `backend_internals`
|
|
159
|
+
* are in-process-only by structure and the assertion surfaces a clear
|
|
160
|
+
* failure if a future cross-process consumer reaches them without a
|
|
161
|
+
* `test_if` gate.
|
|
162
|
+
*/
|
|
163
|
+
export type TestFixture = (TestFixtureBase & {
|
|
164
|
+
readonly in_process: true;
|
|
165
|
+
/**
|
|
166
|
+
* Test-only keyring access — in-process only. Used for
|
|
167
|
+
* expired-cookie generation in `describe_standard_integration_tests`.
|
|
168
|
+
*/
|
|
169
|
+
readonly keyring: Keyring;
|
|
170
|
+
/**
|
|
171
|
+
* Raw backend access (`deps.db`, etc.) — in-process only. Used
|
|
172
|
+
* by the origin-verification cookie-composition sites in
|
|
173
|
+
* `describe_standard_integration_tests`. Tests that need a
|
|
174
|
+
* direct DB role_grant seed at the in-process layer reach for
|
|
175
|
+
* `create_test_role_grant_direct` from `db_entities.ts`; that
|
|
176
|
+
* helper bypasses the consent flow on purpose for query-level
|
|
177
|
+
* (`*.db.test.ts`) tests and has no cross-process analog.
|
|
178
|
+
* Cross-process tests grant additional roles via
|
|
179
|
+
* `fixture.create_account({roles})` (offer/accept) or
|
|
180
|
+
* `extra_accounts` (bootstrap-time bypass).
|
|
181
|
+
*/
|
|
182
|
+
readonly backend_internals: TestAppServer;
|
|
183
|
+
}) | (TestFixtureBase & {
|
|
184
|
+
readonly in_process: false;
|
|
185
|
+
});
|
|
186
|
+
/**
|
|
187
|
+
* Per-test fixture-producing function. Invoked once inside every
|
|
188
|
+
* `test()` body. The implementation captures factory inputs (in-process)
|
|
189
|
+
* or a long-running backend handle (cross-process) and creates
|
|
190
|
+
* a fresh per-test bundle on each call.
|
|
191
|
+
*/
|
|
192
|
+
export type SetupTest = () => Promise<TestFixture>;
|
|
193
|
+
/**
|
|
194
|
+
* Options for `default_in_process_setup`. Extends `CreateTestAppOptions`
|
|
195
|
+
* with the same `extra_accounts` slot the cross-process variant accepts
|
|
196
|
+
* — both transports observe the same bootstrap-time secondary set so
|
|
197
|
+
* suite bodies can read `fixture.extra_accounts[username]` uniformly.
|
|
198
|
+
*/
|
|
199
|
+
export interface InProcessSetupOptions extends CreateTestAppOptions {
|
|
200
|
+
/**
|
|
201
|
+
* Additional accounts seeded at this transport's bootstrap-equivalent
|
|
202
|
+
* step. See `ExtraAccountSpec` for the cradle-only-bypass rationale.
|
|
203
|
+
* Most suites pass `undefined` / `[]`; the `ROLE_KEEPER` probe (in
|
|
204
|
+
* `describe_standard_admin_integration_tests`) is the primary user.
|
|
205
|
+
*/
|
|
206
|
+
readonly extra_accounts?: ReadonlyArray<ExtraAccountSpec>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Build a `SetupTest` that creates a fresh `TestApp` per call via
|
|
210
|
+
* `create_test_app` and projects it into the `TestFixture` shape.
|
|
211
|
+
*
|
|
212
|
+
* Same factory inputs `create_test_app` already takes — this helper
|
|
213
|
+
* is a projection layer, not a new lifecycle. fuz_app's own `src/test/`
|
|
214
|
+
* and consumer suites pass `default_in_process_setup({...factory_inputs})`
|
|
215
|
+
* in place of the old per-suite factory-input bundle. The `extra_accounts`
|
|
216
|
+
* slot (see `InProcessSetupOptions`) seeds bootstrap-time secondaries
|
|
217
|
+
* directly via `create_test_account_with_credentials` against the same
|
|
218
|
+
* DB the keeper just landed on — mirrors the cross-process
|
|
219
|
+
* `_testing_reset` cradle so suite bodies read
|
|
220
|
+
* `fixture.extra_accounts[username]` uniformly regardless of transport.
|
|
221
|
+
*
|
|
222
|
+
* The describe-level `auth_integration_truncate_tables` / pglite WASM
|
|
223
|
+
* cache lifecycle stays in `create_pglite_factory` / `create_describe_db`
|
|
224
|
+
* (`testing/db.js`) — `default_in_process_setup` doesn't manage db state
|
|
225
|
+
* beyond what `create_test_app` already does.
|
|
226
|
+
*/
|
|
227
|
+
export declare const default_in_process_setup: (options: InProcessSetupOptions) => SetupTest;
|
|
228
|
+
/**
|
|
229
|
+
* Cross-process backend handle enriched with the bootstrapped keeper's
|
|
230
|
+
* captured credentials. Consumers compose this in vitest's
|
|
231
|
+
* `globalSetup`:
|
|
232
|
+
*
|
|
233
|
+
* ```ts
|
|
234
|
+
* const handle = await spawn_backend(config);
|
|
235
|
+
* const keeper_transport = create_fetch_transport({base_url: config.base_url});
|
|
236
|
+
* const keeper = await bootstrap({transport: keeper_transport, config});
|
|
237
|
+
* const bootstrapped: BootstrappedBackendHandle = {
|
|
238
|
+
* ...handle,
|
|
239
|
+
* keeper_transport,
|
|
240
|
+
* keeper_account: keeper.account,
|
|
241
|
+
* keeper_actor: keeper.actor,
|
|
242
|
+
* keeper_cookies: keeper.cookies,
|
|
243
|
+
* };
|
|
244
|
+
* ```
|
|
245
|
+
*
|
|
246
|
+
* `default_cross_process_setup(bootstrapped, options)` reads from this
|
|
247
|
+
* shape — the per-test fixture closes over the keeper credentials so
|
|
248
|
+
* cross-process tests can drive admin-RPC / audit-observer flows
|
|
249
|
+
* against the long-lived bootstrapped admin alongside the per-test
|
|
250
|
+
* signup+login account.
|
|
251
|
+
*/
|
|
252
|
+
export interface BootstrappedBackendHandle extends BackendHandle {
|
|
253
|
+
/** Transport carrying the keeper session cookie + cookie jar. */
|
|
254
|
+
readonly keeper_transport: FetchTransport;
|
|
255
|
+
/** Keeper account JSON captured from `POST /bootstrap`. */
|
|
256
|
+
readonly keeper_account: {
|
|
257
|
+
readonly id: Uuid;
|
|
258
|
+
readonly username: string;
|
|
259
|
+
};
|
|
260
|
+
/** Keeper actor JSON captured from `POST /bootstrap`. */
|
|
261
|
+
readonly keeper_actor: {
|
|
262
|
+
readonly id: Uuid;
|
|
263
|
+
};
|
|
264
|
+
/** Raw keeper `Set-Cookie` values — thread into `ws_transport` for keeper-authenticated WS upgrades. */
|
|
265
|
+
readonly keeper_cookies: ReadonlyArray<string>;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* `BootstrappedBackendHandle` minus the live `child` / `teardown` references
|
|
269
|
+
* that only make sense in the `globalSetup` process. The cross-process
|
|
270
|
+
* `provide`/`inject` path strips them on serialization, and the per-test
|
|
271
|
+
* helpers (`mint_account`, `fire_testing_reset`, `default_cross_process_setup`)
|
|
272
|
+
* never read either field — so the test-worker view of the handle has this
|
|
273
|
+
* shape. Also the return type of `reconstruct_bootstrapped_handle`.
|
|
274
|
+
*/
|
|
275
|
+
export type ReconstructedBootstrappedBackendHandle = Omit<BootstrappedBackendHandle, 'child' | 'teardown'>;
|
|
276
|
+
/**
|
|
277
|
+
* Serializable subset of {@link BootstrappedBackendHandle} suitable for
|
|
278
|
+
* vitest's `project.provide()` — vitest 4 hard-rejects non-serializable
|
|
279
|
+
* values, so the live `child: ChildProcess` + `teardown: () => Promise<void>`
|
|
280
|
+
* + `keeper_transport: FetchTransport` (closure) must stay in the
|
|
281
|
+
* `globalSetup` process. The handful of fields tests actually read
|
|
282
|
+
* (`config`, `daemon_token`, `keeper_account`, `keeper_actor`,
|
|
283
|
+
* `keeper_cookies`) round-trip through structured clone fine.
|
|
284
|
+
*
|
|
285
|
+
* `globalSetup` calls {@link serialize_bootstrapped_handle} before
|
|
286
|
+
* `project.provide`; test files call {@link reconstruct_bootstrapped_handle}
|
|
287
|
+
* on the injected value to rebuild a usable handle (without `child` /
|
|
288
|
+
* `teardown` — lifecycle stays with `globalSetup`).
|
|
289
|
+
*/
|
|
290
|
+
export interface SerializableBootstrappedBackendHandle {
|
|
291
|
+
readonly config: BackendHandle['config'];
|
|
292
|
+
readonly daemon_token: BackendHandle['daemon_token'];
|
|
293
|
+
readonly keeper_account: BootstrappedBackendHandle['keeper_account'];
|
|
294
|
+
readonly keeper_actor: BootstrappedBackendHandle['keeper_actor'];
|
|
295
|
+
readonly keeper_cookies: ReadonlyArray<string>;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Strip the non-serializable members so the result can be passed to
|
|
299
|
+
* vitest's `project.provide`. Call in `globalSetup` before provide.
|
|
300
|
+
*/
|
|
301
|
+
export declare const serialize_bootstrapped_handle: (handle: BootstrappedBackendHandle) => SerializableBootstrappedBackendHandle;
|
|
302
|
+
/**
|
|
303
|
+
* Rebuild a usable handle from the serialized subset. Synthesizes a
|
|
304
|
+
* fresh {@link FetchTransport} primed with the keeper's `Set-Cookie`
|
|
305
|
+
* values so `_testing_reset` and other keeper-authenticated calls work.
|
|
306
|
+
* The returned shape omits `child` and `teardown` — lifecycle stays
|
|
307
|
+
* with `globalSetup`; tests that try to teardown themselves wouldn't
|
|
308
|
+
* have a serializable reference anyway.
|
|
309
|
+
*/
|
|
310
|
+
export declare const reconstruct_bootstrapped_handle: (serialized: SerializableBootstrappedBackendHandle) => ReconstructedBootstrappedBackendHandle;
|
|
311
|
+
/** Options for `default_cross_process_setup`. */
|
|
312
|
+
export interface CrossProcessSetupOptions {
|
|
313
|
+
/**
|
|
314
|
+
* Additional roles to grant the fresh keeper on every per-test reset,
|
|
315
|
+
* *in addition to* the `[ROLE_KEEPER, ROLE_ADMIN]` defaults the
|
|
316
|
+
* `_testing_reset` action seeds. Cross-process mirror of in-process
|
|
317
|
+
* `extra_keeper_roles` on `default_in_process_suite_options`.
|
|
318
|
+
*
|
|
319
|
+
* Costs nothing extra per test — the `_testing_reset` action seeds
|
|
320
|
+
* the keeper in a single transaction regardless of how many roles
|
|
321
|
+
* are in the list.
|
|
322
|
+
*
|
|
323
|
+
* `ROLE_ADMIN` is already in the default set, so admin-suite
|
|
324
|
+
* consumers usually pass an empty / omitted array. Consumer-defined
|
|
325
|
+
* roles (e.g. `teacher`) are passed here when the keeper-acting test
|
|
326
|
+
* needs them.
|
|
327
|
+
*
|
|
328
|
+
* **Keeper ≠ admin.** Tests that need a *non-admin* secondary
|
|
329
|
+
* account with `ROLE_KEEPER` declare it via `extra_accounts` —
|
|
330
|
+
* `ROLE_KEEPER`'s `RoleSpec.grant_paths` is bootstrap-only, so it
|
|
331
|
+
* can only be granted at the test-binary bootstrap-equivalent step.
|
|
332
|
+
*/
|
|
333
|
+
readonly extra_keeper_roles?: ReadonlyArray<string>;
|
|
334
|
+
/**
|
|
335
|
+
* Bootstrap-time secondary accounts seeded alongside the keeper on
|
|
336
|
+
* every per-test reset. See `ExtraAccountSpec` for why this is a
|
|
337
|
+
* cradle-only bypass. The reset action seeds them in the same
|
|
338
|
+
* transaction as the keeper.
|
|
339
|
+
*/
|
|
340
|
+
readonly extra_accounts?: ReadonlyArray<ExtraAccountSpec>;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Build a `SetupTest` against a spawned + bootstrapped backend.
|
|
344
|
+
*
|
|
345
|
+
* Per-test body (unconditional reset — fresh keeper every test):
|
|
346
|
+
*
|
|
347
|
+
* 1. Fire `_testing_reset` via the keeper's daemon-token channel. The
|
|
348
|
+
* action wipes auth tables, seeds a fresh keeper (with
|
|
349
|
+
* `extra_keeper_roles` applied), seeds any `extra_accounts`, and
|
|
350
|
+
* returns the new credentials.
|
|
351
|
+
* 2. Build the `TestFixture` closing over the new keeper as the
|
|
352
|
+
* fixture's primary `account` / `actor` (matching in-process
|
|
353
|
+
* semantics). `fixture.extra_accounts[username]` exposes any
|
|
354
|
+
* bootstrap-time secondaries.
|
|
355
|
+
* 3. `fixture.create_account()` mints additional *post-bootstrap*
|
|
356
|
+
* accounts via the production signup + login flow (invite → signup
|
|
357
|
+
* → login → token). Roles go through offer/accept (production
|
|
358
|
+
* consent path).
|
|
359
|
+
*
|
|
360
|
+
* No `reset: boolean` opt-in — every test runs against a freshly
|
|
361
|
+
* bootstrapped keeper. This converges in-process and cross-process
|
|
362
|
+
* keeper lifetimes; mutation-cascade tests (password change,
|
|
363
|
+
* revoke-all) and hardcoded-username signup tests work uniformly.
|
|
364
|
+
*/
|
|
365
|
+
export declare const default_cross_process_setup: (handle: ReconstructedBootstrappedBackendHandle, options?: CrossProcessSetupOptions) => SetupTest;
|
|
366
|
+
/**
|
|
367
|
+
* Consumer-facing options for `default_in_process_suite_options` — the
|
|
368
|
+
* minimal factory inputs both `default_in_process_setup` and
|
|
369
|
+
* `create_test_app_surface_spec` consume to produce the
|
|
370
|
+
* `{setup_test, surface_source, capabilities}` bundle.
|
|
371
|
+
*/
|
|
372
|
+
export interface DefaultInProcessSuiteOptions {
|
|
373
|
+
session_options: SessionOptions<string>;
|
|
374
|
+
create_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
|
|
375
|
+
rpc_endpoints?: RpcEndpointsSuiteOption;
|
|
376
|
+
/**
|
|
377
|
+
* Bootstrap config — top-level slot, single source of truth for both
|
|
378
|
+
* surface generation and live dispatch. Same precedent as
|
|
379
|
+
* `rpc_endpoints`. Discriminated by `mode`; omit for the default (no
|
|
380
|
+
* bootstrap route mounted).
|
|
381
|
+
*/
|
|
382
|
+
bootstrap?: BootstrapServerOptions;
|
|
383
|
+
app_options?: SuiteAppOptions;
|
|
384
|
+
/**
|
|
385
|
+
* Additional roles to grant the bootstrapped keeper alongside
|
|
386
|
+
* `ROLE_KEEPER` — additive, never replaces. The keeper account
|
|
387
|
+
* always holds `ROLE_KEEPER` (otherwise daemon-token auth breaks);
|
|
388
|
+
* pass extras here for suites that need additional role coverage.
|
|
389
|
+
*
|
|
390
|
+
* Admin-suite consumers pass `[ROLE_ADMIN]` so the default keeper
|
|
391
|
+
* can hit admin-gated RPC methods.
|
|
392
|
+
* `describe_standard_admin_integration_tests` and
|
|
393
|
+
* `describe_audit_completeness_tests` need this.
|
|
394
|
+
*/
|
|
395
|
+
extra_keeper_roles?: Array<string>;
|
|
396
|
+
/**
|
|
397
|
+
* Bootstrap-time secondary accounts seeded alongside the keeper. See
|
|
398
|
+
* `ExtraAccountSpec` for the cradle-only-bypass rationale. Same shape
|
|
399
|
+
* as the cross-process `extra_accounts` option — suites read seeded
|
|
400
|
+
* accounts from `fixture.extra_accounts[username]` regardless of
|
|
401
|
+
* transport.
|
|
402
|
+
*/
|
|
403
|
+
extra_accounts?: ReadonlyArray<ExtraAccountSpec>;
|
|
404
|
+
/**
|
|
405
|
+
* Pre-built `AppSurfaceSpec` — overrides the default which calls
|
|
406
|
+
* `create_test_app_surface_spec` against the same factory inputs.
|
|
407
|
+
* Pass when surface assembly needs fields outside the shared subset
|
|
408
|
+
* (e.g. `env_schema`, `event_specs`, `ws_endpoints`, `transform_middleware`).
|
|
409
|
+
*/
|
|
410
|
+
surface_source?: AppSurfaceSpec;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Build the full in-process suite bundle in a single helper invocation.
|
|
414
|
+
* Output covers `{setup_test, surface_source, capabilities}` plus every
|
|
415
|
+
* factory input the Tier 1 suites read at their top level
|
|
416
|
+
* (`session_options`, `create_route_specs`, `rpc_endpoints`) — so the
|
|
417
|
+
* call site spreads once and adds only suite-specific extras
|
|
418
|
+
* (`roles`, `skip_routes`, `input_overrides`, `db_factories`, ...).
|
|
419
|
+
*
|
|
420
|
+
* ```ts
|
|
421
|
+
* // Suite-extras-free call: helper output is the entire options bag.
|
|
422
|
+
* describe_round_trip_validation(default_in_process_suite_options({
|
|
423
|
+
* session_options,
|
|
424
|
+
* create_route_specs,
|
|
425
|
+
* rpc_endpoints: [rpc_endpoint_spec],
|
|
426
|
+
* }));
|
|
427
|
+
*
|
|
428
|
+
* // With suite-specific extras: spread and add.
|
|
429
|
+
* describe_standard_admin_integration_tests({
|
|
430
|
+
* ...default_in_process_suite_options({
|
|
431
|
+
* session_options, create_route_specs, rpc_endpoints,
|
|
432
|
+
* extra_keeper_roles: [ROLE_ADMIN],
|
|
433
|
+
* }),
|
|
434
|
+
* roles,
|
|
435
|
+
* });
|
|
436
|
+
* ```
|
|
437
|
+
*
|
|
438
|
+
* Suites that don't read `session_options` / `rpc_endpoints` at their
|
|
439
|
+
* top level (`round_trip`, `data_exposure`) accept the spread anyway —
|
|
440
|
+
* excess properties on spread sources aren't checked by TS, and the
|
|
441
|
+
* uniform shape keeps consumer call sites mechanical.
|
|
442
|
+
*/
|
|
443
|
+
export declare const default_in_process_suite_options: <const O extends DefaultInProcessSuiteOptions>(options: O) => {
|
|
444
|
+
setup_test: SetupTest;
|
|
445
|
+
surface_source: AppSurfaceSpec;
|
|
446
|
+
capabilities: BackendCapabilities;
|
|
447
|
+
session_options: O["session_options"];
|
|
448
|
+
create_route_specs: O["create_route_specs"];
|
|
449
|
+
rpc_endpoints: O["rpc_endpoints"];
|
|
450
|
+
};
|
|
451
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/setup.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAuB9B,OAAO,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAE5C,OAAO,KAAK,EAAC,OAAO,EAA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