@fuzdev/fuz_app 0.32.0 → 0.34.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.
@@ -121,6 +121,16 @@ export interface CreateTestAppOptions extends TestAppServerOptions {
121
121
  /** Optional overrides for `AppServerOptions` (backend, session_options, and create_route_specs are managed). */
122
122
  app_options?: Partial<Omit<AppServerOptions, 'backend' | 'session_options' | 'create_route_specs'>>;
123
123
  }
124
+ /**
125
+ * `app_options` shape accepted by DB-backed suite helpers
126
+ * (`describe_standard_integration_tests`, `describe_audit_completeness_tests`,
127
+ * etc.). Excludes `rpc_endpoints` on top of the fields `CreateTestAppOptions`
128
+ * excludes — suites require `rpc_endpoints` at the suite level (hard-failed
129
+ * by `require_rpc_endpoint_path`) so setup-time path lookup and runtime
130
+ * dispatch read from one source of truth. Low-level `create_test_app`
131
+ * callers still pass `rpc_endpoints` via `app_options`.
132
+ */
133
+ export type SuiteAppOptions = Partial<Omit<AppServerOptions, 'backend' | 'session_options' | 'create_route_specs' | 'rpc_endpoints'>>;
124
134
  /**
125
135
  * A bootstrapped test account with credentials.
126
136
  */
@@ -1 +1 @@
1
- {"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAK/B,OAAO,EAA2B,KAAK,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAE1E,OAAO,KAAK,EAAC,EAAE,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAU1D,OAAO,EAA8B,KAAK,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAG3F,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO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AG,OAAO,CAAC,OAAO,CAkGpF,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import './assert_dev_env.js';
2
2
  import type { SessionOptions } from '../auth/session_cookie.js';
3
- import type { AppServerContext, AppServerOptions } from '../server/app_server.js';
3
+ import type { AppServerContext } from '../server/app_server.js';
4
4
  import type { RouteSpec } from '../http/route_spec.js';
5
+ import { type SuiteAppOptions } from './app_server.js';
5
6
  import { type DbFactory } from './db.js';
6
- import type { RpcEndpointSpec } from '../http/surface.js';
7
+ import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
7
8
  /**
8
9
  * Configuration for `describe_audit_completeness_tests`.
9
10
  */
@@ -20,10 +21,13 @@ export interface AuditCompletenessTestOptions {
20
21
  * `(ctx: AppServerContext) => Array<RpcEndpointSpec>` — the factory form
21
22
  * is required when action handlers must close over the per-test
22
23
  * `ctx.app_settings` / `ctx.deps` (e.g. exercising `app_settings_update`).
24
+ * The factory must return the same endpoint `path` regardless of ctx —
25
+ * it is invoked once at setup with a stub ctx for path lookup and again
26
+ * per-test by `create_app_server` for live dispatch.
23
27
  */
24
- rpc_endpoints: Array<RpcEndpointSpec> | ((ctx: AppServerContext) => Array<RpcEndpointSpec>);
28
+ rpc_endpoints: RpcEndpointsSuiteOption;
25
29
  /** Optional overrides for `AppServerOptions`. */
26
- app_options?: Partial<Omit<AppServerOptions, 'backend' | 'session_options' | 'create_route_specs'>>;
30
+ app_options?: SuiteAppOptions;
27
31
  /** Database factories to run tests against. Default: pglite only. */
28
32
  db_factories?: Array<DbFactory>;
29
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"audit_completeness.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/audit_completeness.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAkB7B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACh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,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAsB1B;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C,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;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC,iDAAiD;IACjD,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAChC;AAoDD;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,GAAI,SAAS,4BAA4B,KAAG,IAyezF,CAAC"}
@@ -16,13 +16,12 @@ import { describe, test, assert } from 'vitest';
16
16
  import { ROLE_KEEPER, ROLE_ADMIN } from '../auth/role_schema.js';
17
17
  import { AUDIT_EVENT_TYPES } from '../auth/audit_log_schema.js';
18
18
  import { AUTH_MIGRATION_NS } from '../auth/migrations.js';
19
- import { create_test_app } from './app_server.js';
19
+ import { create_test_app, } from './app_server.js';
20
20
  import { create_pglite_factory, create_describe_db, AUTH_INTEGRATION_TRUNCATE_TABLES, } from './db.js';
21
21
  import { find_auth_route } from './integration_helpers.js';
22
22
  import { run_migrations } from '../db/migrate.js';
23
23
  import { query_accept_offer } from '../auth/permit_offer_queries.js';
24
- import { rpc_call, require_rpc_endpoint_path } from './rpc_helpers.js';
25
- import { create_stub_app_server_context } from './stubs.js';
24
+ import { rpc_call_for_spec, require_rpc_endpoint_path, resolve_rpc_endpoints_for_setup, } from './rpc_helpers.js';
26
25
  import { permit_offer_create_action_spec, permit_revoke_action_spec, } from '../auth/permit_offer_action_specs.js';
27
26
  import { admin_session_revoke_all_action_spec, admin_token_revoke_all_action_spec, app_settings_update_action_spec, invite_create_action_spec, invite_delete_action_spec, } from '../auth/admin_action_specs.js';
28
27
  import { account_session_list_action_spec, account_session_revoke_action_spec, account_session_revoke_all_action_spec, account_token_create_action_spec, account_token_list_action_spec, account_token_revoke_action_spec, } from '../auth/account_action_specs.js';
@@ -42,8 +41,8 @@ const build_options = (options, db) => ({
42
41
  db,
43
42
  roles: [ROLE_KEEPER, ROLE_ADMIN],
44
43
  app_options: {
45
- rpc_endpoints: options.rpc_endpoints,
46
44
  ...options.app_options,
45
+ rpc_endpoints: options.rpc_endpoints,
47
46
  },
48
47
  });
49
48
  /** Headers for unauthenticated JSON requests (login, signup). */
@@ -68,17 +67,10 @@ const json_session_headers = (test_app, extra) => test_app.create_session_header
68
67
  */
69
68
  export const describe_audit_completeness_tests = (options) => {
70
69
  // Hard-fail early so consumers see a clear setup error instead of a
71
- // confusing test failure when `rpc_endpoints` is missing. For the
72
- // factory form we invoke the factory once here with a stub ctx purely
73
- // to extract the endpoint path (a stable string like `/api/rpc`); the
74
- // resulting actions array is discarded. `create_app_server` invokes
75
- // the factory a second time inside each test with its real ctx, and
76
- // those are the handlers that actually serve requests. Safe as long
77
- // as the factory is pure — the stock helpers (e.g.
78
- // `create_admin_rpc_actions`) are.
79
- const rpc_endpoints_for_setup = typeof options.rpc_endpoints === 'function'
80
- ? options.rpc_endpoints(create_stub_app_server_context(options.session_options))
81
- : options.rpc_endpoints;
70
+ // confusing test failure when `rpc_endpoints` is missing. Factory-form
71
+ // callers are resolved with a stub ctx purely to extract the endpoint
72
+ // path; real handlers run per-test via `app_options.rpc_endpoints`.
73
+ const rpc_endpoints_for_setup = resolve_rpc_endpoints_for_setup(options.rpc_endpoints, options.session_options);
82
74
  const rpc_path = require_rpc_endpoint_path(rpc_endpoints_for_setup);
83
75
  const init_schema = async (db) => {
84
76
  await run_migrations(db, [AUTH_MIGRATION_NS]);
@@ -134,10 +126,10 @@ export const describe_audit_completeness_tests = (options) => {
134
126
  });
135
127
  test('token create produces token_create event', async () => {
136
128
  const test_app = await create_test_app(build_options(options, get_db()));
137
- const res = await rpc_call({
129
+ const res = await rpc_call_for_spec({
138
130
  app: test_app.app,
139
131
  path: rpc_path,
140
- method: account_token_create_action_spec.method,
132
+ spec: account_token_create_action_spec,
141
133
  params: { name: 'audit-test' },
142
134
  headers: test_app.create_session_headers(),
143
135
  });
@@ -148,19 +140,20 @@ export const describe_audit_completeness_tests = (options) => {
148
140
  test('token revoke produces token_revoke event', async () => {
149
141
  const test_app = await create_test_app(build_options(options, get_db()));
150
142
  // get a token ID to revoke
151
- const list_res = await rpc_call({
143
+ const list_res = await rpc_call_for_spec({
152
144
  app: test_app.app,
153
145
  path: rpc_path,
154
- method: account_token_list_action_spec.method,
146
+ spec: account_token_list_action_spec,
147
+ params: null,
155
148
  headers: test_app.create_session_headers(),
156
149
  });
157
150
  assert.ok(list_res.ok, 'account_token_list should succeed');
158
151
  const { tokens } = list_res.result;
159
152
  assert.ok(tokens.length > 0, 'Expected at least one token');
160
- const res = await rpc_call({
153
+ const res = await rpc_call_for_spec({
161
154
  app: test_app.app,
162
155
  path: rpc_path,
163
- method: account_token_revoke_action_spec.method,
156
+ spec: account_token_revoke_action_spec,
164
157
  params: { token_id: tokens[0].id },
165
158
  headers: test_app.create_session_headers(),
166
159
  });
@@ -182,20 +175,21 @@ export const describe_audit_completeness_tests = (options) => {
182
175
  }),
183
176
  });
184
177
  // get session IDs (newest first)
185
- const list_res = await rpc_call({
178
+ const list_res = await rpc_call_for_spec({
186
179
  app: test_app.app,
187
180
  path: rpc_path,
188
- method: account_session_list_action_spec.method,
181
+ spec: account_session_list_action_spec,
182
+ params: null,
189
183
  headers: test_app.create_session_headers(),
190
184
  });
191
185
  assert.ok(list_res.ok, 'account_session_list should succeed');
192
186
  const { sessions } = list_res.result;
193
187
  assert.ok(sessions.length >= 2, 'Expected at least 2 sessions');
194
188
  // revoke the second session (not the one used for auth)
195
- const res = await rpc_call({
189
+ const res = await rpc_call_for_spec({
196
190
  app: test_app.app,
197
191
  path: rpc_path,
198
- method: account_session_revoke_action_spec.method,
192
+ spec: account_session_revoke_action_spec,
199
193
  params: { session_id: sessions[1].id },
200
194
  headers: test_app.create_session_headers(),
201
195
  });
@@ -205,10 +199,11 @@ export const describe_audit_completeness_tests = (options) => {
205
199
  });
206
200
  test('session revoke-all produces session_revoke_all event', async () => {
207
201
  const test_app = await create_test_app(build_options(options, get_db()));
208
- const res = await rpc_call({
202
+ const res = await rpc_call_for_spec({
209
203
  app: test_app.app,
210
204
  path: rpc_path,
211
- method: account_session_revoke_all_action_spec.method,
205
+ spec: account_session_revoke_all_action_spec,
206
+ params: null,
212
207
  headers: test_app.create_session_headers(),
213
208
  });
214
209
  assert.ok(res.ok, `account_session_revoke_all failed: ${res.ok ? '' : JSON.stringify(res.error)}`);
@@ -237,10 +232,10 @@ export const describe_audit_completeness_tests = (options) => {
237
232
  test('admin offer (RPC) + accept produces permit_offer_create and permit_grant events', async () => {
238
233
  const test_app = await create_test_app(build_options(options, get_db()));
239
234
  const target = await test_app.create_account({ username: 'audit_target' });
240
- const offer_res = await rpc_call({
235
+ const offer_res = await rpc_call_for_spec({
241
236
  app: test_app.app,
242
237
  path: rpc_path,
243
- method: permit_offer_create_action_spec.method,
238
+ spec: permit_offer_create_action_spec,
244
239
  params: { to_account_id: target.account.id, role: ROLE_ADMIN },
245
240
  headers: test_app.create_session_headers(),
246
241
  });
@@ -263,10 +258,10 @@ export const describe_audit_completeness_tests = (options) => {
263
258
  const target_actor = await query_actor_by_account({ db: get_db() }, target.account.id);
264
259
  assert.ok(target_actor);
265
260
  // Offer + accept to materialize a permit we can revoke.
266
- const offer_res = await rpc_call({
261
+ const offer_res = await rpc_call_for_spec({
267
262
  app: test_app.app,
268
263
  path: rpc_path,
269
- method: permit_offer_create_action_spec.method,
264
+ spec: permit_offer_create_action_spec,
270
265
  params: { to_account_id: target.account.id, role: ROLE_ADMIN },
271
266
  headers: test_app.create_session_headers(),
272
267
  });
@@ -276,10 +271,10 @@ export const describe_audit_completeness_tests = (options) => {
276
271
  return query_accept_offer({ db: tx }, { offer_id: offer.id, to_account_id: target.account.id, ip: null });
277
272
  });
278
273
  // Revoke via RPC.
279
- const revoke_res = await rpc_call({
274
+ const revoke_res = await rpc_call_for_spec({
280
275
  app: test_app.app,
281
276
  path: rpc_path,
282
- method: permit_revoke_action_spec.method,
277
+ spec: permit_revoke_action_spec,
283
278
  params: { actor_id: target_actor.id, permit_id: accept_result.permit.id },
284
279
  headers: test_app.create_session_headers(),
285
280
  });
@@ -290,10 +285,10 @@ export const describe_audit_completeness_tests = (options) => {
290
285
  test('admin session revoke-all produces session_revoke_all event', async () => {
291
286
  const test_app = await create_test_app(build_options(options, get_db()));
292
287
  const target = await test_app.create_account({ username: 'audit_sessions_target' });
293
- const res = await rpc_call({
288
+ const res = await rpc_call_for_spec({
294
289
  app: test_app.app,
295
290
  path: rpc_path,
296
- method: admin_session_revoke_all_action_spec.method,
291
+ spec: admin_session_revoke_all_action_spec,
297
292
  params: { account_id: target.account.id },
298
293
  headers: test_app.create_session_headers(),
299
294
  });
@@ -305,10 +300,10 @@ export const describe_audit_completeness_tests = (options) => {
305
300
  test('admin token revoke-all produces token_revoke_all event', async () => {
306
301
  const test_app = await create_test_app(build_options(options, get_db()));
307
302
  const target = await test_app.create_account({ username: 'audit_tokens_target' });
308
- const res = await rpc_call({
303
+ const res = await rpc_call_for_spec({
309
304
  app: test_app.app,
310
305
  path: rpc_path,
311
- method: admin_token_revoke_all_action_spec.method,
306
+ spec: admin_token_revoke_all_action_spec,
312
307
  params: { account_id: target.account.id },
313
308
  headers: test_app.create_session_headers(),
314
309
  });
@@ -321,19 +316,19 @@ export const describe_audit_completeness_tests = (options) => {
321
316
  describe('invite mutation audit events', () => {
322
317
  test('invite create and delete produce audit events', async () => {
323
318
  const test_app = await create_test_app(build_options(options, get_db()));
324
- const create_res = await rpc_call({
319
+ const create_res = await rpc_call_for_spec({
325
320
  app: test_app.app,
326
321
  path: rpc_path,
327
- method: invite_create_action_spec.method,
322
+ spec: invite_create_action_spec,
328
323
  params: { username: 'invited_user' },
329
324
  headers: test_app.create_session_headers(),
330
325
  });
331
326
  assert.ok(create_res.ok, `invite_create failed: ${create_res.ok ? '' : JSON.stringify(create_res.error)}`);
332
327
  const { invite } = create_res.result;
333
- const delete_res = await rpc_call({
328
+ const delete_res = await rpc_call_for_spec({
334
329
  app: test_app.app,
335
330
  path: rpc_path,
336
- method: invite_delete_action_spec.method,
331
+ spec: invite_delete_action_spec,
337
332
  params: { invite_id: invite.id },
338
333
  headers: test_app.create_session_headers(),
339
334
  });
@@ -347,10 +342,10 @@ export const describe_audit_completeness_tests = (options) => {
347
342
  describe('app settings mutation audit events', () => {
348
343
  test('settings update produces app_settings_update event', async () => {
349
344
  const test_app = await create_test_app(build_options(options, get_db()));
350
- const res = await rpc_call({
345
+ const res = await rpc_call_for_spec({
351
346
  app: test_app.app,
352
347
  path: rpc_path,
353
- method: app_settings_update_action_spec.method,
348
+ spec: app_settings_update_action_spec,
354
349
  params: { open_signup: true },
355
350
  headers: test_app.create_session_headers(),
356
351
  });
@@ -364,10 +359,10 @@ export const describe_audit_completeness_tests = (options) => {
364
359
  test('signup produces signup event', async () => {
365
360
  const test_app = await create_test_app(build_options(options, get_db()));
366
361
  // enable open signup via RPC
367
- const settings_res = await rpc_call({
362
+ const settings_res = await rpc_call_for_spec({
368
363
  app: test_app.app,
369
364
  path: rpc_path,
370
- method: app_settings_update_action_spec.method,
365
+ spec: app_settings_update_action_spec,
371
366
  params: { open_signup: true },
372
367
  headers: test_app.create_session_headers(),
373
368
  });
@@ -1,9 +1,10 @@
1
1
  import './assert_dev_env.js';
2
2
  import type { SessionOptions } from '../auth/session_cookie.js';
3
- import type { AppServerContext, AppServerOptions } from '../server/app_server.js';
3
+ import type { AppServerContext } from '../server/app_server.js';
4
4
  import type { RouteSpec } from '../http/route_spec.js';
5
+ import { type SuiteAppOptions } from './app_server.js';
5
6
  import { type DbFactory } from './db.js';
6
- import type { RpcEndpointSpec } from '../http/surface.js';
7
+ import { type RpcEndpointsSuiteOption } from './rpc_helpers.js';
7
8
  /**
8
9
  * Configuration for `describe_standard_integration_tests`.
9
10
  */
@@ -13,7 +14,7 @@ export interface StandardIntegrationTestOptions {
13
14
  /** Route spec factory — same one used in production. */
14
15
  create_route_specs: (ctx: AppServerContext) => Array<RouteSpec>;
15
16
  /** Optional overrides for `AppServerOptions`. */
16
- app_options?: Partial<Omit<AppServerOptions, 'backend' | 'session_options' | 'create_route_specs'>>;
17
+ app_options?: SuiteAppOptions;
17
18
  /**
18
19
  * Database factories to run tests against. Default: pglite only.
19
20
  * Pass consumer factories (e.g. `[pglite_factory, pg_factory]`) to also test against PostgreSQL.
@@ -22,12 +23,21 @@ export interface StandardIntegrationTestOptions {
22
23
  /**
23
24
  * RPC endpoint specs — required. This suite dispatches
24
25
  * `account_verify`, `account_session_*`, and `account_token_*` via
25
- * `rpc_call` (the `/api/account/verify` REST route is a status-only
26
- * nginx shim with no payload). Hard-fails via
26
+ * `rpc_call_for_spec` (the `/api/account/verify` REST route is a
27
+ * status-only nginx shim with no payload). Hard-fails via
27
28
  * `require_rpc_endpoint_path` on setup so consumer projects see a
28
29
  * clear setup error instead of confusing test failures.
30
+ *
31
+ * Accepts either an array (eager) or a factory
32
+ * `(ctx: AppServerContext) => Array<RpcEndpointSpec>` — the factory form
33
+ * is required when action handlers must close over the per-test
34
+ * `ctx.app_settings` / `ctx.deps` (e.g. the canonical
35
+ * `create_admin_rpc_actions(ctx.deps, {app_settings: ctx.app_settings})`
36
+ * pattern). The factory must return the same endpoint `path` regardless
37
+ * of ctx — it is invoked once at setup with a stub ctx for path lookup
38
+ * and again per-test by `create_app_server` for live dispatch.
29
39
  */
30
- rpc_endpoints: Array<RpcEndpointSpec>;
40
+ rpc_endpoints: RpcEndpointsSuiteOption;
31
41
  }
32
42
  /**
33
43
  * Standard integration test suite for fuz_app auth routes.
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[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