@fuzdev/fuz_app 0.65.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.
Files changed (159) hide show
  1. package/dist/actions/CLAUDE.md +65 -86
  2. package/dist/actions/action_codegen.d.ts +1 -1
  3. package/dist/actions/action_codegen.js +1 -1
  4. package/dist/actions/action_event_data.d.ts +1 -1
  5. package/dist/auth/CLAUDE.md +83 -104
  6. package/dist/auth/audit_log_schema.js +2 -2
  7. package/dist/auth/daemon_token_middleware.d.ts +15 -5
  8. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  9. package/dist/auth/daemon_token_middleware.js +24 -15
  10. package/dist/auth/invite_queries.d.ts +17 -7
  11. package/dist/auth/invite_queries.d.ts.map +1 -1
  12. package/dist/auth/invite_queries.js +19 -8
  13. package/dist/auth/signup_routes.d.ts +47 -1
  14. package/dist/auth/signup_routes.d.ts.map +1 -1
  15. package/dist/auth/signup_routes.js +103 -52
  16. package/dist/env/resolve.d.ts +44 -7
  17. package/dist/env/resolve.d.ts.map +1 -1
  18. package/dist/env/resolve.js +94 -27
  19. package/dist/http/CLAUDE.md +47 -52
  20. package/dist/http/jsonrpc.d.ts +23 -7
  21. package/dist/http/jsonrpc.d.ts.map +1 -1
  22. package/dist/http/jsonrpc.js +19 -3
  23. package/dist/http/surface.d.ts +9 -2
  24. package/dist/http/surface.d.ts.map +1 -1
  25. package/dist/runtime/mock.d.ts +1 -1
  26. package/dist/runtime/mock.js +1 -1
  27. package/dist/testing/CLAUDE.md +659 -511
  28. package/dist/testing/admin_integration.d.ts +5 -5
  29. package/dist/testing/admin_integration.d.ts.map +1 -1
  30. package/dist/testing/admin_integration.js +95 -39
  31. package/dist/testing/app_server.d.ts +16 -1
  32. package/dist/testing/app_server.d.ts.map +1 -1
  33. package/dist/testing/app_server.js +18 -3
  34. package/dist/testing/audit_completeness.d.ts +7 -5
  35. package/dist/testing/audit_completeness.d.ts.map +1 -1
  36. package/dist/testing/audit_completeness.js +5 -9
  37. package/dist/testing/bootstrap_success.js +2 -2
  38. package/dist/testing/cross_backend/backend_config.d.ts +113 -0
  39. package/dist/testing/cross_backend/backend_config.d.ts.map +1 -0
  40. package/dist/testing/cross_backend/backend_config.js +1 -0
  41. package/dist/testing/cross_backend/bench/bench_report.d.ts +46 -0
  42. package/dist/testing/cross_backend/bench/bench_report.d.ts.map +1 -0
  43. package/dist/testing/cross_backend/bench/bench_report.js +83 -0
  44. package/dist/testing/cross_backend/bench/run_cross_impl_bench.d.ts +44 -0
  45. package/dist/testing/cross_backend/bench/run_cross_impl_bench.d.ts.map +1 -0
  46. package/dist/testing/cross_backend/bench/run_cross_impl_bench.js +38 -0
  47. package/dist/testing/cross_backend/bench/scenario.d.ts +57 -0
  48. package/dist/testing/cross_backend/bench/scenario.d.ts.map +1 -0
  49. package/dist/testing/cross_backend/bench/scenario.js +28 -0
  50. package/dist/testing/cross_backend/bootstrap_backend.d.ts +41 -0
  51. package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -0
  52. package/dist/testing/cross_backend/bootstrap_backend.js +34 -0
  53. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +24 -0
  54. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -0
  55. package/dist/testing/cross_backend/build_test_backend_paths.js +33 -0
  56. package/dist/testing/cross_backend/capabilities.d.ts +3 -2
  57. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  58. package/dist/testing/cross_backend/default_backend_configs.d.ts +122 -0
  59. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -0
  60. package/dist/testing/cross_backend/default_backend_configs.js +111 -0
  61. package/dist/testing/cross_backend/default_secrets.d.ts +40 -0
  62. package/dist/testing/cross_backend/default_secrets.d.ts.map +1 -0
  63. package/dist/testing/cross_backend/default_secrets.js +39 -0
  64. package/dist/testing/cross_backend/default_spine_surface.d.ts +64 -0
  65. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -0
  66. package/dist/testing/cross_backend/default_spine_surface.js +121 -0
  67. package/dist/testing/cross_backend/setup.d.ts +270 -34
  68. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  69. package/dist/testing/cross_backend/setup.js +495 -15
  70. package/dist/testing/cross_backend/spawn_backend.d.ts +58 -0
  71. package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -0
  72. package/dist/testing/cross_backend/spawn_backend.js +229 -0
  73. package/dist/testing/cross_backend/spine_stub_backend_config.d.ts +66 -0
  74. package/dist/testing/cross_backend/spine_stub_backend_config.d.ts.map +1 -0
  75. package/dist/testing/cross_backend/spine_stub_backend_config.js +49 -0
  76. package/dist/testing/cross_backend/sse_round_trip.d.ts +37 -0
  77. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -0
  78. package/dist/testing/cross_backend/sse_round_trip.js +137 -0
  79. package/dist/testing/cross_backend/standard.d.ts +96 -0
  80. package/dist/testing/cross_backend/standard.d.ts.map +1 -0
  81. package/dist/testing/cross_backend/standard.js +49 -0
  82. package/dist/testing/cross_backend/testing_reset_actions.d.ts +171 -0
  83. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -0
  84. package/dist/testing/cross_backend/testing_reset_actions.js +213 -0
  85. package/dist/testing/cross_backend/testing_server_bun.d.ts +5 -0
  86. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -0
  87. package/dist/testing/cross_backend/testing_server_bun.js +59 -0
  88. package/dist/testing/cross_backend/testing_server_core.d.ts +140 -0
  89. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -0
  90. package/dist/testing/cross_backend/testing_server_core.js +68 -0
  91. package/dist/testing/cross_backend/testing_server_deno.d.ts +5 -0
  92. package/dist/testing/cross_backend/testing_server_deno.d.ts.map +1 -0
  93. package/dist/testing/cross_backend/testing_server_deno.js +37 -0
  94. package/dist/testing/cross_backend/testing_server_node.d.ts +5 -0
  95. package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -0
  96. package/dist/testing/cross_backend/testing_server_node.js +50 -0
  97. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +72 -0
  98. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -0
  99. package/dist/testing/cross_backend/ts_spine_backend_config.js +112 -0
  100. package/dist/testing/cross_backend/ws_round_trip.d.ts +35 -0
  101. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -0
  102. package/dist/testing/cross_backend/ws_round_trip.js +113 -0
  103. package/dist/testing/data_exposure.d.ts +4 -6
  104. package/dist/testing/data_exposure.d.ts.map +1 -1
  105. package/dist/testing/data_exposure.js +1 -5
  106. package/dist/testing/db_entities.d.ts +18 -7
  107. package/dist/testing/db_entities.d.ts.map +1 -1
  108. package/dist/testing/db_entities.js +18 -7
  109. package/dist/testing/integration.d.ts +27 -6
  110. package/dist/testing/integration.d.ts.map +1 -1
  111. package/dist/testing/integration.js +93 -58
  112. package/dist/testing/round_trip.d.ts +4 -5
  113. package/dist/testing/round_trip.d.ts.map +1 -1
  114. package/dist/testing/round_trip.js +1 -5
  115. package/dist/testing/rpc_helpers.d.ts +10 -4
  116. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  117. package/dist/testing/rpc_helpers.js +1 -1
  118. package/dist/testing/rpc_round_trip.d.ts +5 -5
  119. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  120. package/dist/testing/rpc_round_trip.js +1 -5
  121. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  122. package/dist/testing/sse_round_trip.js +1 -68
  123. package/dist/testing/standard.d.ts +4 -5
  124. package/dist/testing/standard.d.ts.map +1 -1
  125. package/dist/testing/stubs.d.ts +10 -3
  126. package/dist/testing/stubs.d.ts.map +1 -1
  127. package/dist/testing/stubs.js +9 -2
  128. package/dist/testing/testing_rate_limiter.d.ts +59 -0
  129. package/dist/testing/testing_rate_limiter.d.ts.map +1 -0
  130. package/dist/testing/testing_rate_limiter.js +74 -0
  131. package/dist/testing/transports/bootstrap.d.ts +52 -0
  132. package/dist/testing/transports/bootstrap.d.ts.map +1 -0
  133. package/dist/testing/transports/bootstrap.js +70 -0
  134. package/dist/testing/transports/fetch_transport.d.ts +81 -0
  135. package/dist/testing/transports/fetch_transport.d.ts.map +1 -0
  136. package/dist/testing/transports/fetch_transport.js +74 -0
  137. package/dist/testing/transports/sse_frame_reader.d.ts +41 -0
  138. package/dist/testing/transports/sse_frame_reader.d.ts.map +1 -0
  139. package/dist/testing/transports/sse_frame_reader.js +84 -0
  140. package/dist/testing/transports/sse_transport.d.ts +54 -0
  141. package/dist/testing/transports/sse_transport.d.ts.map +1 -0
  142. package/dist/testing/transports/sse_transport.js +51 -0
  143. package/dist/testing/transports/ws_client.d.ts +108 -0
  144. package/dist/testing/transports/ws_client.d.ts.map +1 -0
  145. package/dist/testing/transports/ws_client.js +56 -0
  146. package/dist/testing/transports/ws_transport.d.ts +43 -0
  147. package/dist/testing/transports/ws_transport.d.ts.map +1 -0
  148. package/dist/testing/transports/ws_transport.js +169 -0
  149. package/dist/testing/ws_round_trip.d.ts +21 -103
  150. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  151. package/dist/testing/ws_round_trip.js +42 -40
  152. package/dist/ui/CLAUDE.md +5 -3
  153. package/dist/ui/MenuLink.svelte +16 -16
  154. package/dist/ui/MenuLink.svelte.d.ts +13 -4
  155. package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
  156. package/package.json +7 -1
  157. package/dist/testing/transports/surface_source.d.ts +0 -51
  158. package/dist/testing/transports/surface_source.d.ts.map +0 -1
  159. package/dist/testing/transports/surface_source.js +0 -19
@@ -0,0 +1,111 @@
1
+ import '../assert_dev_env.js';
2
+ import { build_test_backend_paths } from './build_test_backend_paths.js';
3
+ import { default_test_bootstrap_token, default_test_cookie_keys, default_test_keeper_password, default_test_keeper_username, } from './default_secrets.js';
4
+ /**
5
+ * Capabilities shared by TS-family backends — same canonical
6
+ * implementation, same feature set. No trusted-proxy phase (the test
7
+ * binary doesn't enable proxy parsing) and no per-account login rate
8
+ * limit (the TS canonical path leaves the limiter null in test mode).
9
+ */
10
+ export const ts_default_capabilities = Object.freeze({
11
+ bearer_auth: true,
12
+ trusted_proxy: false,
13
+ login_rate_limit: false,
14
+ ws: true,
15
+ sse: false,
16
+ in_process_only: false,
17
+ });
18
+ /**
19
+ * Capabilities for the Rust family. Adds `trusted_proxy: true` (the
20
+ * Rust spine's client-IP middleware is always wired; the env-gate just
21
+ * controls whether XFF is consulted vs the TCP peer IP) and
22
+ * `login_rate_limit: true` (env-gated bucket on `/login` + `/password`).
23
+ */
24
+ export const rust_default_capabilities = Object.freeze({
25
+ bearer_auth: true,
26
+ trusted_proxy: true,
27
+ login_rate_limit: true,
28
+ ws: true,
29
+ sse: false,
30
+ in_process_only: false,
31
+ });
32
+ /** Bootstrap block built from the default secrets + supplied paths. */
33
+ const build_default_bootstrap = (paths, overrides) => ({
34
+ token_path: paths.bootstrap_token_path,
35
+ token: default_test_bootstrap_token,
36
+ username: default_test_keeper_username,
37
+ password: default_test_keeper_password,
38
+ daemon_token_path: paths.daemon_token_path,
39
+ ...overrides,
40
+ });
41
+ /**
42
+ * Shared builder for TS-family backends (Deno + Node). Owns the common
43
+ * env baseline (NODE_ENV, HOST, PORT, in-memory PGlite, cookie keys,
44
+ * bootstrap token path) so per-backend factories only declare what
45
+ * genuinely differs.
46
+ */
47
+ export const make_default_ts_backend_config = (opts) => {
48
+ const { name, port, start_command, database_url = 'memory://', extra_env, capabilities = ts_default_capabilities, paths = build_test_backend_paths(name), bootstrap_overrides, port_env_var = 'PORT', } = opts;
49
+ return {
50
+ name,
51
+ start_command,
52
+ base_url: `http://localhost:${port}`,
53
+ rpc_path: '/api/rpc',
54
+ ws_path: '/api/ws',
55
+ health_path: '/health',
56
+ bootstrap_path: '/api/account/bootstrap',
57
+ cookie_name: 'fuz_session',
58
+ startup_timeout_ms: 30_000,
59
+ env: {
60
+ NODE_ENV: 'development',
61
+ HOST: 'localhost',
62
+ [port_env_var]: String(port),
63
+ DATABASE_URL: database_url,
64
+ SECRET_FUZ_COOKIE_KEYS: default_test_cookie_keys,
65
+ FUZ_ALLOWED_ORIGINS: 'http://localhost:*',
66
+ FUZ_BOOTSTRAP_TOKEN_PATH: paths.bootstrap_token_path,
67
+ ...extra_env,
68
+ },
69
+ bootstrap: build_default_bootstrap(paths, bootstrap_overrides),
70
+ capabilities,
71
+ };
72
+ };
73
+ /**
74
+ * Shared builder for Rust-family backends. Owns the common env baseline
75
+ * (RUST_LOG, HOST, port, real Postgres, cookie keys, bootstrap token
76
+ * path, the `FUZ_TESTING_RESET_DB_ON_STARTUP=true` self-wipe gate) plus
77
+ * the 120s startup window for cargo's first-run build cost.
78
+ */
79
+ export const make_default_rust_backend_config = (opts) => {
80
+ const { name, port, start_command, database_url, extra_env, capabilities = rust_default_capabilities, paths = build_test_backend_paths(name), bootstrap_overrides, port_env_var = 'PORT', rust_log = 'info', } = opts;
81
+ return {
82
+ name,
83
+ start_command,
84
+ base_url: `http://localhost:${port}`,
85
+ rpc_path: '/api/rpc',
86
+ ws_path: '/api/ws',
87
+ health_path: '/health',
88
+ bootstrap_path: '/api/account/bootstrap',
89
+ cookie_name: 'fuz_session',
90
+ startup_timeout_ms: 120_000,
91
+ env: {
92
+ RUST_LOG: rust_log,
93
+ HOST: 'localhost',
94
+ [port_env_var]: String(port),
95
+ DATABASE_URL: database_url,
96
+ SECRET_FUZ_COOKIE_KEYS: default_test_cookie_keys,
97
+ FUZ_ALLOWED_ORIGINS: 'http://localhost:*',
98
+ FUZ_BOOTSTRAP_TOKEN_PATH: paths.bootstrap_token_path,
99
+ // Self-wipe the auth-namespace schema before migrations on every
100
+ // boot. Read by `fuz_testing::reset_db_on_startup_if_env_set`,
101
+ // which the consumer's test binary invokes from its
102
+ // `pre_migration_hook` between pool creation and
103
+ // `fuz_db::run_migrations`. The `_testing_reset` RPC action
104
+ // (per-test reset) is orthogonal.
105
+ FUZ_TESTING_RESET_DB_ON_STARTUP: 'true',
106
+ ...extra_env,
107
+ },
108
+ bootstrap: build_default_bootstrap(paths, bootstrap_overrides),
109
+ capabilities,
110
+ };
111
+ };
@@ -0,0 +1,40 @@
1
+ import '../assert_dev_env.js';
2
+ /**
3
+ * Default test secrets for cross-process backend bootstrap.
4
+ *
5
+ * Every cross-backend consumer needs the same shape: a bootstrap token
6
+ * the harness writes to disk before spawn, a keeper username/password
7
+ * the harness POSTs to `/api/account/bootstrap`, and cookie keys the
8
+ * binary uses to construct its `Keyring`. The literals here are dev-only
9
+ * and protected by `assert_dev_env`; the binaries themselves throw on
10
+ * production load.
11
+ *
12
+ * Each constant is exported individually so consumers can override one
13
+ * without re-deriving the rest. Builders in `default_backend_configs.ts`
14
+ * thread these defaults into the `BackendConfig.bootstrap` block and the
15
+ * `SECRET_FUZ_COOKIE_KEYS` env entry; callers compose the
16
+ * `bootstrap_overrides` knob when they need a non-default keeper.
17
+ *
18
+ * @module
19
+ */
20
+ /**
21
+ * Fixed bootstrap token written to each backend's `token_path` before
22
+ * spawn. The test binary reads + consumes this via its
23
+ * `*_BOOTSTRAP_TOKEN_PATH` env var; the harness POSTs the same token to
24
+ * `/api/account/bootstrap` to mint the keeper account. Any 32+ char
25
+ * string works — the binary just compares bytes, no entropy required
26
+ * for tests.
27
+ */
28
+ export declare const default_test_bootstrap_token = "test_bootstrap_token_for_cross_be";
29
+ /** Keeper username used by every cross-process test fixture. */
30
+ export declare const default_test_keeper_username = "keeper";
31
+ /** Keeper password used by every cross-process test fixture. */
32
+ export declare const default_test_keeper_password = "password_test_keeper";
33
+ /**
34
+ * Dev-only cookie keys (64+ chars). The test binary needs
35
+ * `SECRET_FUZ_COOKIE_KEYS` to construct its `Keyring`. Never used in
36
+ * production — the test binaries themselves throw on production load
37
+ * via `assert_dev_env`.
38
+ */
39
+ export declare const default_test_cookie_keys = "dev_only_cookie_keys_for_cross_backend_tests_not_for_prod_use_xx";
40
+ //# sourceMappingURL=default_secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default_secrets.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_secrets.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,sCAAsC,CAAC;AAEhF,gEAAgE;AAChE,eAAO,MAAM,4BAA4B,WAAW,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,4BAA4B,yBAAyB,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,qEAC8B,CAAC"}
@@ -0,0 +1,39 @@
1
+ import '../assert_dev_env.js';
2
+ /**
3
+ * Default test secrets for cross-process backend bootstrap.
4
+ *
5
+ * Every cross-backend consumer needs the same shape: a bootstrap token
6
+ * the harness writes to disk before spawn, a keeper username/password
7
+ * the harness POSTs to `/api/account/bootstrap`, and cookie keys the
8
+ * binary uses to construct its `Keyring`. The literals here are dev-only
9
+ * and protected by `assert_dev_env`; the binaries themselves throw on
10
+ * production load.
11
+ *
12
+ * Each constant is exported individually so consumers can override one
13
+ * without re-deriving the rest. Builders in `default_backend_configs.ts`
14
+ * thread these defaults into the `BackendConfig.bootstrap` block and the
15
+ * `SECRET_FUZ_COOKIE_KEYS` env entry; callers compose the
16
+ * `bootstrap_overrides` knob when they need a non-default keeper.
17
+ *
18
+ * @module
19
+ */
20
+ /**
21
+ * Fixed bootstrap token written to each backend's `token_path` before
22
+ * spawn. The test binary reads + consumes this via its
23
+ * `*_BOOTSTRAP_TOKEN_PATH` env var; the harness POSTs the same token to
24
+ * `/api/account/bootstrap` to mint the keeper account. Any 32+ char
25
+ * string works — the binary just compares bytes, no entropy required
26
+ * for tests.
27
+ */
28
+ export const default_test_bootstrap_token = 'test_bootstrap_token_for_cross_be';
29
+ /** Keeper username used by every cross-process test fixture. */
30
+ export const default_test_keeper_username = 'keeper';
31
+ /** Keeper password used by every cross-process test fixture. */
32
+ export const default_test_keeper_password = 'password_test_keeper';
33
+ /**
34
+ * Dev-only cookie keys (64+ chars). The test binary needs
35
+ * `SECRET_FUZ_COOKIE_KEYS` to construct its `Keyring`. Never used in
36
+ * production — the test binaries themselves throw on production load
37
+ * via `assert_dev_env`.
38
+ */
39
+ export const default_test_cookie_keys = 'dev_only_cookie_keys_for_cross_backend_tests_not_for_prod_use_xx';
@@ -0,0 +1,64 @@
1
+ import '../assert_dev_env.js';
2
+ import { type RoleSchemaResult } from '../../auth/role_schema.js';
3
+ import { type SessionOptions } from '../../auth/session_cookie.js';
4
+ import { type RouteSpec } from '../../http/route_spec.js';
5
+ import type { AppSurfaceSpec, RpcEndpointSpec } from '../../http/surface.js';
6
+ import type { AppServerContext } from '../../server/app_server.js';
7
+ /**
8
+ * Session config — cookie name matches the binary's issued session cookie
9
+ * (`fuz_session`) so cookie-attribute assertions + jar extraction line up.
10
+ */
11
+ export declare const spine_session_options: SessionOptions<string>;
12
+ /**
13
+ * Built-in roles only — the standard spine registers no app-defined role
14
+ * specs. When the spine grows additional grantable roles, thread their
15
+ * registry through `create_role_schema` here so the admin suite picks up
16
+ * grant-path coverage.
17
+ */
18
+ export declare const spine_roles: RoleSchemaResult;
19
+ /** RPC endpoint mount path — matches the binary's `/api/rpc`. */
20
+ export declare const SPINE_RPC_PATH = "/api/rpc";
21
+ /**
22
+ * Audit-log SSE stream path — `/api/admin` prefix + the
23
+ * `create_audit_log_route_specs` `/audit/stream` route. Matches the default
24
+ * `BackendConfig.sse_path` and the cross-process SSE suite's default. Only
25
+ * mounted by the TS spine binary (which wires `audit_log_sse`); the shared
26
+ * surface stub leaves `ctx.audit_sse` null so the snapshot stays SSE-free.
27
+ */
28
+ export declare const SPINE_SSE_PATH = "/api/admin/audit/stream";
29
+ /**
30
+ * Factory-form RPC endpoints so the `app_settings_update` handler closes
31
+ * over the per-test `ctx.app_settings`. `create_app_server` (in the binary)
32
+ * owns live dispatch; the surface builder invokes the factory once with a
33
+ * stub ctx for setup-time path/method lookup, so the handler closures are
34
+ * never called across the process boundary.
35
+ *
36
+ * Test binaries append their own `_testing_reset` action to this endpoint's
37
+ * `actions` (see `testing_reset_actions.ts`); it is intentionally excluded
38
+ * here so it stays off the declared surface (the harness calls it directly
39
+ * over the daemon-token channel).
40
+ */
41
+ export declare const spine_rpc_endpoints: (ctx: AppServerContext) => Array<RpcEndpointSpec>;
42
+ /**
43
+ * Account REST + signup route specs under `/api/account` (bootstrap
44
+ * auto-mounted by the surface builder / `create_app_server`), plus the
45
+ * audit-log SSE stream under `/api/admin` **only when `ctx.audit_sse` is
46
+ * set** (the TS spine binary passes `audit_log_sse: true`).
47
+ *
48
+ * The shared `create_spine_surface_spec()` builds its ctx with
49
+ * `audit_sse: null`, so the declared surface snapshot stays SSE-free and the
50
+ * Rust `spine_stub` cross test is unaffected — only the live TS binary mounts
51
+ * the stream at `SPINE_SSE_PATH`.
52
+ */
53
+ export declare const create_spine_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
54
+ /**
55
+ * The `AppSurfaceSpec` for the standard spine surface — the wire-shape
56
+ * source the cross-process round-trip + RPC-round-trip suites validate
57
+ * against. `bootstrap: {mode: 'surface_only'}` mounts
58
+ * `POST /api/account/bootstrap`'s shape to match the binary (which wires
59
+ * bootstrap for real); the harness's `globalSetup` already consumed the
60
+ * live bootstrap, so the cross-process round-trip validates the binary's
61
+ * 409 against the route's declared error schema.
62
+ */
63
+ export declare const create_spine_surface_spec: () => AppSurfaceSpec;
64
+ //# sourceMappingURL=default_spine_surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default_spine_surface.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/default_spine_surface.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA6B9B,OAAO,EAAqB,KAAK,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAwB,KAAK,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAGxF,OAAO,EAAqB,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAGjE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,MAAM,CAAwC,CAAC;AAElG;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,gBAAyC,CAAC;AAEpE,iEAAiE;AACjE,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,4BAA4B,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,gBAAgB,KAAG,KAAK,CAAC,eAAe,CAQhF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GAAI,KAAK,gBAAgB,KAAG,KAAK,CAAC,SAAS,CAkB/E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAAO,cAM1C,CAAC"}
@@ -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
+ });