@fuzdev/fuz_app 0.161.0 → 0.163.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 (151) hide show
  1. package/dist/auth/CLAUDE.md +47 -36
  2. package/dist/auth/account_action_specs.d.ts +614 -150
  3. package/dist/auth/account_action_specs.d.ts.map +1 -1
  4. package/dist/auth/account_action_specs.js +56 -52
  5. package/dist/auth/account_route_schema.d.ts +401 -94
  6. package/dist/auth/account_route_schema.d.ts.map +1 -1
  7. package/dist/auth/account_route_schema.js +54 -39
  8. package/dist/auth/account_routes.js +1 -1
  9. package/dist/auth/account_schema.d.ts +531 -118
  10. package/dist/auth/account_schema.d.ts.map +1 -1
  11. package/dist/auth/account_schema.js +76 -58
  12. package/dist/auth/admin_action_specs.d.ts +1753 -240
  13. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  14. package/dist/auth/admin_action_specs.js +28 -26
  15. package/dist/auth/admin_actions.d.ts +4 -4
  16. package/dist/auth/admin_actions.d.ts.map +1 -1
  17. package/dist/auth/admin_actions.js +3 -3
  18. package/dist/auth/all_cell_actions.d.ts +3 -3
  19. package/dist/auth/all_cell_actions.d.ts.map +1 -1
  20. package/dist/auth/all_cell_actions.js +1 -1
  21. package/dist/auth/api_token.d.ts +4 -4
  22. package/dist/auth/api_token.d.ts.map +1 -1
  23. package/dist/auth/api_token.js +3 -3
  24. package/dist/auth/audit_emitter.d.ts +8 -3
  25. package/dist/auth/audit_emitter.d.ts.map +1 -1
  26. package/dist/auth/audit_emitter.js +32 -9
  27. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  28. package/dist/auth/audit_log_queries.js +4 -3
  29. package/dist/auth/audit_log_schema.d.ts +798 -291
  30. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  31. package/dist/auth/audit_log_schema.js +192 -201
  32. package/dist/auth/bootstrap_route_schema.d.ts +173 -50
  33. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  34. package/dist/auth/bootstrap_route_schema.js +35 -16
  35. package/dist/auth/cell_grant_action_specs.d.ts +1 -1
  36. package/dist/auth/cell_grant_action_specs.js +1 -1
  37. package/dist/auth/cell_grant_actions.d.ts +4 -4
  38. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  39. package/dist/auth/cell_grant_actions.js +1 -1
  40. package/dist/auth/credential_type_schema.d.ts +16 -29
  41. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  42. package/dist/auth/credential_type_schema.js +14 -18
  43. package/dist/auth/grant_path_schema.d.ts +15 -29
  44. package/dist/auth/grant_path_schema.d.ts.map +1 -1
  45. package/dist/auth/grant_path_schema.js +13 -17
  46. package/dist/auth/invite_schema.d.ts +98 -26
  47. package/dist/auth/invite_schema.d.ts.map +1 -1
  48. package/dist/auth/invite_schema.js +21 -14
  49. package/dist/auth/migrations.d.ts.map +1 -1
  50. package/dist/auth/migrations.js +28 -1
  51. package/dist/auth/name_schema.d.ts +7 -6
  52. package/dist/auth/name_schema.d.ts.map +1 -1
  53. package/dist/auth/name_schema.js +8 -9
  54. package/dist/auth/password.d.ts +15 -7
  55. package/dist/auth/password.d.ts.map +1 -1
  56. package/dist/auth/password.js +16 -9
  57. package/dist/auth/role_grant_offer_action_specs.d.ts +72 -72
  58. package/dist/auth/role_grant_offer_action_specs.js +2 -2
  59. package/dist/auth/role_grant_offer_actions.d.ts +4 -4
  60. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  61. package/dist/auth/role_grant_offer_actions.js +3 -3
  62. package/dist/auth/role_grant_offer_notifications.d.ts +60 -60
  63. package/dist/auth/role_grant_offer_notifications.js +2 -2
  64. package/dist/auth/role_grant_offer_schema.d.ts +8 -8
  65. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  66. package/dist/auth/role_grant_offer_schema.js +10 -10
  67. package/dist/auth/role_schema.d.ts +47 -55
  68. package/dist/auth/role_schema.d.ts.map +1 -1
  69. package/dist/auth/role_schema.js +29 -35
  70. package/dist/auth/scope_kind_schema.d.ts +22 -26
  71. package/dist/auth/scope_kind_schema.d.ts.map +1 -1
  72. package/dist/auth/scope_kind_schema.js +19 -19
  73. package/dist/auth/self_service_role_action_specs.js +1 -1
  74. package/dist/auth/self_service_role_actions.d.ts +6 -6
  75. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  76. package/dist/auth/self_service_role_actions.js +7 -6
  77. package/dist/auth/signup_route_schema.d.ts +71 -21
  78. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  79. package/dist/auth/signup_route_schema.js +18 -16
  80. package/dist/auth/standard_rpc_actions.d.ts +1 -1
  81. package/dist/auth/standard_rpc_actions.js +1 -1
  82. package/dist/auth/token_lifetime.d.ts +33 -9
  83. package/dist/auth/token_lifetime.d.ts.map +1 -1
  84. package/dist/auth/token_lifetime.js +8 -7
  85. package/dist/auth/token_scope.d.ts +99 -25
  86. package/dist/auth/token_scope.d.ts.map +1 -1
  87. package/dist/auth/token_scope.js +57 -35
  88. package/dist/dev/setup.d.ts +14 -7
  89. package/dist/dev/setup.d.ts.map +1 -1
  90. package/dist/dev/setup.js +11 -6
  91. package/dist/primitive_schemas.d.ts +2 -22
  92. package/dist/primitive_schemas.d.ts.map +1 -1
  93. package/dist/primitive_schemas.js +2 -24
  94. package/dist/primitive_schemas_fuz.d.ts +56 -2
  95. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  96. package/dist/primitive_schemas_fuz.js +54 -4
  97. package/dist/testing/CLAUDE.md +29 -8
  98. package/dist/testing/admin_integration.d.ts +3 -3
  99. package/dist/testing/admin_integration.d.ts.map +1 -1
  100. package/dist/testing/admin_integration.js +1 -1
  101. package/dist/testing/app_server.d.ts +3 -1
  102. package/dist/testing/app_server.d.ts.map +1 -1
  103. package/dist/testing/app_server.js +6 -2
  104. package/dist/testing/audit_drift_guard.d.ts.map +1 -1
  105. package/dist/testing/audit_drift_guard.js +12 -13
  106. package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
  107. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  108. package/dist/testing/cross_backend/default_spine_surface.js +2 -2
  109. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  110. package/dist/testing/cross_backend/identity_parity.js +43 -8
  111. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
  112. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  113. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  114. package/dist/testing/cross_backend/session_cap.js +4 -3
  115. package/dist/testing/cross_backend/setup.d.ts +1 -1
  116. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  117. package/dist/testing/cross_backend/setup.js +45 -42
  118. package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
  119. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  120. package/dist/testing/cross_backend/standard.d.ts +4 -4
  121. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  122. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  123. package/dist/testing/cross_backend/token_lifetime.js +34 -1
  124. package/dist/testing/db_entities.d.ts +3 -1
  125. package/dist/testing/db_entities.d.ts.map +1 -1
  126. package/dist/testing/db_entities.js +4 -2
  127. package/dist/testing/integration.d.ts.map +1 -1
  128. package/dist/testing/integration.js +4 -3
  129. package/dist/testing/token_scope_fixtures.d.ts +24 -0
  130. package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
  131. package/dist/testing/token_scope_fixtures.js +49 -0
  132. package/dist/testing/transports/bootstrap.d.ts +1 -1
  133. package/dist/testing/transports/bootstrap.d.ts.map +1 -1
  134. package/dist/testing/transports/bootstrap.js +13 -12
  135. package/dist/ui/BootstrapForm.svelte +4 -2
  136. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  137. package/dist/ui/SignupForm.svelte +4 -2
  138. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  139. package/dist/zod.d.ts +2 -1
  140. package/dist/zod.d.ts.map +1 -1
  141. package/dist/zod.js +6 -2
  142. package/package.json +1 -1
  143. package/dist/auth/audit_log_schema_fuz.d.ts +0 -39
  144. package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
  145. package/dist/auth/audit_log_schema_fuz.js +0 -37
  146. package/dist/auth/role_schema_fuz.d.ts +0 -30
  147. package/dist/auth/role_schema_fuz.d.ts.map +0 -1
  148. package/dist/auth/role_schema_fuz.js +0 -30
  149. package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
  150. package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
  151. package/dist/auth/scope_kind_schema_fuz.js +0 -31
@@ -1 +1 @@
1
- {"version":3,"file":"audit_log_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/audit_log_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,IAAI,EAAS,MAAM,yBAAyB,CAAC;AAmBtE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,6iBA6BnB,CAAC;AAEZ,wCAAwC;AACxC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AACxD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CA8BzF,CAAC;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,KAAG,eAG/C,CAAC;AAEX;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,yBAAy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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAIhF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Audit log types and client-safe Zod schemas.
2
+ * Audit log types and client-safe `@fuzdev/fuz_schema` schemas: the
3
+ * event-type and outcome vocabularies, the builtin metadata schemas, and the
4
+ * wire rows.
3
5
  *
4
6
  * Records auth mutations (login, logout, grant, revoke, etc.) for
5
7
  * security monitoring and operational visibility.
@@ -8,11 +10,13 @@
8
10
  *
9
11
  * @module
10
12
  */
11
- import { z } from 'zod';
12
- import { bounded_string, Uuid, Email } from '../primitive_schemas.js';
13
+ import { meta } from '@fuzdev/fuz_schema/meta.ts';
14
+ import { boolean, format_issue, literal, loose_object, message, nullable, number, object, one_of, optional, parse, pipe, record, regex, safe_integer, string, unknown } from '@fuzdev/fuz_schema/schema.ts';
15
+ import { bounded_string, Email, Timestamp, Uuid } from '../primitive_schemas_fuz.js';
16
+ import { assert_validation_schema } from '../schema_issues.js';
13
17
  import { AuthSessionJson, SessionId } from './account_schema.js';
14
18
  import { ApiTokenId } from './api_token.js';
15
- import { BuiltinCredentialType } from './credential_type_schema.js';
19
+ import { BUILTIN_CREDENTIAL_TYPES } from './credential_type_schema.js';
16
20
  import { NAME_LENGTH_MAX } from './name_schema.js';
17
21
  /**
18
22
  * Defense-in-depth audit field — records the credential channel
@@ -21,7 +25,7 @@ import { NAME_LENGTH_MAX } from './name_schema.js';
21
25
  * so forensics survive a future loosening or bypass of the spec gate.
22
26
  * See `docs/security.md` §Credential-channel gating.
23
27
  */
24
- const credential_type_meta = BuiltinCredentialType.optional().meta({
28
+ const credential_type_meta = meta(optional(one_of(BUILTIN_CREDENTIAL_TYPES)), {
25
29
  description: 'Credential channel the request arrived on. Defense in depth — the spec gate restricts to `session`, but the row preserves what actually authenticated the request in case the gate is loosened or bypassed in a future refactor.'
26
30
  });
27
31
  /**
@@ -60,8 +64,6 @@ export const AUDIT_EVENT_TYPES = Object.freeze([
60
64
  'app_settings_update',
61
65
  'db_admin_row_delete'
62
66
  ]);
63
- /** Zod schema for audit event types. */
64
- export const AuditEventType = z.enum(AUDIT_EVENT_TYPES);
65
67
  /**
66
68
  * The `RevocationScope` of every builtin audit event — declared once, the one
67
69
  * answer the revocation listener reads, and the twin of the Rust spine's table. Typed over `AuditEventType`, so a new event type does not compile
@@ -163,106 +165,97 @@ export const AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE = `must be at most ${NAME_LENG
163
165
  /** The message of an audit event-type name off `AUDIT_EVENT_TYPE_NAME_REGEX`. */
164
166
  export const AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE = 'must start with a letter; only letters, digits, _ . / - allowed';
165
167
  /**
166
- * Zod schema for valid audit event-type name strings: `AUDIT_EVENT_TYPE_NAME_REGEX`,
167
- * at most `NAME_LENGTH_MAX` UTF-16 code units. Twin of the Rust spine's
168
- * `is_valid_audit_event_type_name`.
168
+ * Valid audit event-type name strings: `AUDIT_EVENT_TYPE_NAME_REGEX`, at most
169
+ * `NAME_LENGTH_MAX` UTF-16 code units. A string it refuses gets
170
+ * `AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE` or
171
+ * `AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE`, the length one alone for a string
172
+ * both too long and off the grammar; a value that is no string, fuz_schema's
173
+ * message. Twin of the Rust spine's `is_valid_audit_event_type_name`.
169
174
  */
170
- export const AuditEventTypeName = bounded_string({
171
- max: NAME_LENGTH_MAX,
172
- max_message: AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE
173
- }).regex(AUDIT_EVENT_TYPE_NAME_REGEX, { message: AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE });
174
- /** Zod schema for audit event outcomes. */
175
- export const AuditOutcome = z.enum(['success', 'failure']);
175
+ export const AuditEventTypeName = pipe(bounded_string({ max: NAME_LENGTH_MAX, max_message: AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE }), message(regex(AUDIT_EVENT_TYPE_NAME_REGEX), AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE));
176
+ /** Audit event outcome. */
177
+ export const AuditOutcome = one_of(['success', 'failure']);
176
178
  /**
177
- * Per-event-type metadata Zod schemas. `z.looseObject` so consumers can
178
- * add fields while known ones are validated. The record is frozen to
179
- * catch mutation bugs at the key level (e.g. tests that try to swap in a
180
- * stub schema); the Zod schemas themselves are reachable and mutable —
181
- * freeze isn't a security boundary.
179
+ * Per-event-type metadata schemas, `@fuzdev/fuz_schema` `loose_object`s so
180
+ * consumers can add fields while known ones are validated. The record is
181
+ * frozen to catch mutation bugs at the key level (e.g. tests that try to swap
182
+ * in a stub schema); freeze isn't a security boundary.
182
183
  */
183
184
  export const audit_metadata_schemas = Object.freeze({
184
- login: z
185
- .looseObject({
186
- username: z.string().meta({ description: 'Username submitted with the login attempt.' })
187
- })
188
- .nullable(),
189
- logout: z.null(),
190
- bootstrap: z
191
- .looseObject({
192
- error: z.string().meta({ description: 'Error message for a failed bootstrap attempt.' })
193
- })
194
- .nullable(),
195
- signup: z.looseObject({
196
- username: z.string().meta({ description: 'Username submitted at signup.' }),
197
- invite_id: Uuid.optional().meta({
185
+ login: nullable(loose_object({
186
+ username: meta(string, { description: 'Username submitted with the login attempt.' })
187
+ })),
188
+ logout: literal(null),
189
+ bootstrap: nullable(loose_object({
190
+ error: meta(string, { description: 'Error message for a failed bootstrap attempt.' })
191
+ })),
192
+ signup: loose_object({
193
+ username: meta(string, { description: 'Username submitted at signup.' }),
194
+ invite_id: meta(optional(Uuid), {
198
195
  description: 'Invite consumed by this signup. Set on success and on `signup_conflict` failure rows when an invite was matched at attempt time.'
199
196
  }),
200
- open_signup: z.boolean().optional().meta({
197
+ open_signup: meta(optional(boolean), {
201
198
  description: 'True when the signup occurred via the `open_signup` setting (no invite required). Set on success rows under `open_signup` and on failure rows when the attempt was made under `open_signup`.'
202
199
  }),
203
- reason: z.string().optional().meta({
200
+ reason: meta(optional(string), {
204
201
  description: 'Failure category: `no_match` (no unclaimed invite matched), `signup_conflict` (username/email already exists, raised by the DB unique constraint), `internal_error` (catch-all for non-classified tx failures — Argon2 fault, session create error, DB outage mid-tx). Set only on `outcome=failure`.'
205
202
  }),
206
- email: Email.optional().meta({
203
+ email: meta(optional(Email), {
207
204
  description: 'Email submitted at signup — recorded on failure rows for forensic correlation. Omitted on success rows because the email is already tied to the resulting account.'
208
205
  })
209
206
  }),
210
- password_change: z
211
- .looseObject({
212
- sessions_revoked: z.number().optional().meta({
207
+ password_change: nullable(loose_object({
208
+ sessions_revoked: meta(optional(number), {
213
209
  description: 'Number of sessions revoked as a side effect of the password change. Present on `outcome=success`.'
214
210
  }),
215
- tokens_revoked: z.number().optional().meta({
211
+ tokens_revoked: meta(optional(number), {
216
212
  description: 'Number of API tokens revoked as a side effect of the password change. Present on `outcome=success`.'
217
213
  }),
218
- reason: z.enum(['concurrent_change']).optional().meta({
214
+ reason: meta(optional(literal('concurrent_change')), {
219
215
  description: 'Failure category. `concurrent_change` indicates another password change committed first against the same starting hash (verify-write race loser). Absent for typed-wrong-password failures.'
220
216
  }),
221
217
  credential_type: credential_type_meta
222
- })
223
- .nullable(),
224
- session_revoke: z.looseObject({
225
- session_id: SessionId.meta({
218
+ })),
219
+ session_revoke: loose_object({
220
+ session_id: meta(SessionId, {
226
221
  description: 'Blake3 hash identifying the revoked session row.'
227
222
  }),
228
223
  credential_type: credential_type_meta
229
224
  }),
230
- session_revoke_all: z.looseObject({
225
+ session_revoke_all: loose_object({
231
226
  // Omitted on `outcome='failure'` (no revocation attempted — e.g. target
232
227
  // account not found); `reason` carries the failure category, and
233
228
  // `attempted_account_id` preserves the probed id (the `target_account_id`
234
229
  // column is null in that case because it's a FK to `account`).
235
- count: z.number().optional().meta({
230
+ count: meta(optional(number), {
236
231
  description: 'Number of sessions revoked. Omitted on `outcome=failure` because no revocation was attempted.'
237
232
  }),
238
- reason: z
239
- .string()
240
- .optional()
241
- .meta({ description: 'Failure category. Set only on `outcome=failure`.' }),
242
- attempted_account_id: Uuid.optional().meta({
233
+ reason: meta(optional(string), {
234
+ description: 'Failure category. Set only on `outcome=failure`.'
235
+ }),
236
+ attempted_account_id: meta(optional(Uuid), {
243
237
  description: 'Probed account id when the target lookup missed (FK constraint forces `target_account_id` to null).'
244
238
  }),
245
239
  credential_type: credential_type_meta
246
240
  }),
247
- token_create: z.looseObject({
248
- token_id: ApiTokenId.meta({ description: 'Public id of the created API token (`tok_…`).' }),
249
- name: z.string().meta({ description: 'Operator-supplied label for the token.' }),
241
+ token_create: loose_object({
242
+ token_id: meta(ApiTokenId, { description: 'Public id of the created API token (`tok_…`).' }),
243
+ name: meta(string, { description: 'Operator-supplied label for the token.' }),
250
244
  credential_type: credential_type_meta
251
245
  }),
252
- token_revoke: z.looseObject({
253
- token_id: ApiTokenId.meta({ description: 'Public id of the revoked API token (`tok_…`).' }),
246
+ token_revoke: loose_object({
247
+ token_id: meta(ApiTokenId, { description: 'Public id of the revoked API token (`tok_…`).' }),
254
248
  credential_type: credential_type_meta
255
249
  }),
256
- token_revoke_all: z.looseObject({
250
+ token_revoke_all: loose_object({
257
251
  // Same shape as `session_revoke_all` for failures.
258
- count: z.number().optional().meta({
252
+ count: meta(optional(number), {
259
253
  description: 'Number of tokens revoked. Omitted on `outcome=failure` because no revocation was attempted.'
260
254
  }),
261
- reason: z
262
- .string()
263
- .optional()
264
- .meta({ description: 'Failure category. Set only on `outcome=failure`.' }),
265
- attempted_account_id: Uuid.optional().meta({
255
+ reason: meta(optional(string), {
256
+ description: 'Failure category. Set only on `outcome=failure`.'
257
+ }),
258
+ attempted_account_id: meta(optional(Uuid), {
266
259
  description: 'Probed account id when the target lookup missed (FK constraint forces `target_account_id` to null).'
267
260
  })
268
261
  }),
@@ -270,91 +263,89 @@ export const audit_metadata_schemas = Object.freeze({
270
263
  // (e.g. admin-grant-path denied) never produce a role_grant row.
271
264
  // `self_service: true` is set by the self-service role toggle in
272
265
  // `self_service_role_actions.ts` — declared explicitly rather than
273
- // riding on `z.looseObject` permissiveness so the field is part of
266
+ // riding on `loose_object` permissiveness so the field is part of
274
267
  // the documented schema surface.
275
- role_grant_create: z.looseObject({
276
- role: z.string().meta({ description: 'Role being granted.' }),
277
- role_grant_id: Uuid.optional().meta({
268
+ role_grant_create: loose_object({
269
+ role: meta(string, { description: 'Role being granted.' }),
270
+ role_grant_id: meta(optional(Uuid), {
278
271
  description: 'Id of the resulting role_grant row. Omitted when the grant failed (e.g. admin-grant-path denial).'
279
272
  }),
280
- scope_kind: z.string().nullish().meta({
273
+ scope_kind: meta(optional(nullable(string)), {
281
274
  description: 'Kind tag paired with `scope_id` on a `role_grant_assign` row; null for a global grant.'
282
275
  }),
283
- scope_id: Uuid.nullish().meta({
276
+ scope_id: meta(optional(nullable(Uuid)), {
284
277
  description: 'Scope of the granted role_grant; null for global role_grants.'
285
278
  }),
286
- source_offer_id: Uuid.optional().meta({
279
+ source_offer_id: meta(optional(Uuid), {
287
280
  description: 'Offer this grant resolved, when the grant originated from an accepted offer.'
288
281
  }),
289
- self_service: z.boolean().optional().meta({
282
+ self_service: meta(optional(boolean), {
290
283
  description: 'True when the grant came from the self-service role toggle.'
291
284
  })
292
285
  }),
293
- role_grant_revoke: z.looseObject({
294
- role: z.string().meta({ description: 'Role being revoked.' }),
295
- role_grant_id: Uuid.meta({ description: 'Id of the revoked role_grant row.' }),
296
- scope_id: Uuid.nullish().meta({
286
+ role_grant_revoke: loose_object({
287
+ role: meta(string, { description: 'Role being revoked.' }),
288
+ role_grant_id: meta(Uuid, { description: 'Id of the revoked role_grant row.' }),
289
+ scope_id: meta(optional(nullable(Uuid)), {
297
290
  description: 'Scope of the revoked role_grant; null for global role_grants.'
298
291
  }),
299
- reason: z
300
- .string()
301
- .optional()
302
- .meta({ description: 'Optional admin-supplied or self-service reason text.' }),
303
- self_service: z.boolean().optional().meta({
292
+ reason: meta(optional(string), {
293
+ description: 'Optional admin-supplied or self-service reason text.'
294
+ }),
295
+ self_service: meta(optional(boolean), {
304
296
  description: 'True when the revoke came from the self-service role toggle.'
305
297
  })
306
298
  }),
307
299
  // `offer_id` is optional because failed creates (e.g. admin-grant-path
308
300
  // denied, `authorize` callback denied) never produce an offer row.
309
- role_grant_offer_create: z.looseObject({
310
- offer_id: Uuid.optional().meta({
301
+ role_grant_offer_create: loose_object({
302
+ offer_id: meta(optional(Uuid), {
311
303
  description: 'Id of the created offer row. Omitted when the create failed before insert.'
312
304
  }),
313
- role: z.string().meta({ description: 'Role being offered.' }),
314
- scope_id: Uuid.nullish().meta({
305
+ role: meta(string, { description: 'Role being offered.' }),
306
+ scope_id: meta(optional(nullable(Uuid)), {
315
307
  description: 'Scope of the offered role; null for global offers.'
316
308
  }),
317
- to_account_id: Uuid.meta({ description: 'Account the offer is directed to.' })
309
+ to_account_id: meta(Uuid, { description: 'Account the offer is directed to.' })
318
310
  }),
319
311
  // `role_grant_create` is emitted alongside on accept — two events per accept by
320
312
  // design: offer-lifecycle audit + role-grant-lifecycle audit. A refused
321
313
  // accept (a builtin-role offer that must not mint) is an `outcome=failure`
322
314
  // row with no `role_grant_id` (nothing was minted) and the wire `reason`.
323
- role_grant_offer_accept: z.looseObject({
324
- offer_id: Uuid.meta({ description: 'Id of the accepted (or refused) offer.' }),
325
- role_grant_id: Uuid.optional().meta({
315
+ role_grant_offer_accept: loose_object({
316
+ offer_id: meta(Uuid, { description: 'Id of the accepted (or refused) offer.' }),
317
+ role_grant_id: meta(optional(Uuid), {
326
318
  description: 'Id of the resulting role_grant row. Omitted on `outcome=failure` because no grant was minted.'
327
319
  }),
328
- role: z.string().meta({ description: 'Role granted by the offer.' }),
329
- scope_id: Uuid.nullish().meta({
320
+ role: meta(string, { description: 'Role granted by the offer.' }),
321
+ scope_id: meta(optional(nullable(Uuid)), {
330
322
  description: 'Scope of the resulting role_grant; null for global role_grants.'
331
323
  }),
332
- reason: z.string().optional().meta({
324
+ reason: meta(optional(string), {
333
325
  description: 'Wire error reason of a refused accept. Set only on `outcome=failure`.'
334
326
  })
335
327
  }),
336
- role_grant_offer_decline: z.looseObject({
337
- offer_id: Uuid.meta({ description: 'Id of the declined offer.' }),
338
- role: z.string().meta({ description: 'Role that was offered.' }),
339
- scope_id: Uuid.nullish().meta({
328
+ role_grant_offer_decline: loose_object({
329
+ offer_id: meta(Uuid, { description: 'Id of the declined offer.' }),
330
+ role: meta(string, { description: 'Role that was offered.' }),
331
+ scope_id: meta(optional(nullable(Uuid)), {
340
332
  description: 'Scope of the offered role; null for global offers.'
341
333
  }),
342
- reason: z
343
- .string()
344
- .optional()
345
- .meta({ description: 'Optional decline reason text from the recipient.' })
334
+ reason: meta(optional(string), {
335
+ description: 'Optional decline reason text from the recipient.'
336
+ })
346
337
  }),
347
- role_grant_offer_retract: z.looseObject({
348
- offer_id: Uuid.meta({ description: 'Id of the retracted offer.' }),
349
- role: z.string().meta({ description: 'Role that was offered.' }),
350
- scope_id: Uuid.nullish().meta({
338
+ role_grant_offer_retract: loose_object({
339
+ offer_id: meta(Uuid, { description: 'Id of the retracted offer.' }),
340
+ role: meta(string, { description: 'Role that was offered.' }),
341
+ scope_id: meta(optional(nullable(Uuid)), {
351
342
  description: 'Scope of the offered role; null for global offers.'
352
343
  })
353
344
  }),
354
- role_grant_offer_expire: z.looseObject({
355
- offer_id: Uuid.meta({ description: 'Id of the expired offer.' }),
356
- role: z.string().meta({ description: 'Role that was offered.' }),
357
- scope_id: Uuid.nullish().meta({
345
+ role_grant_offer_expire: loose_object({
346
+ offer_id: meta(Uuid, { description: 'Id of the expired offer.' }),
347
+ role: meta(string, { description: 'Role that was offered.' }),
348
+ scope_id: meta(optional(nullable(Uuid)), {
358
349
  description: 'Scope of the offered role; null for global offers.'
359
350
  })
360
351
  }),
@@ -364,28 +355,26 @@ export const audit_metadata_schemas = Object.freeze({
364
355
  // — the recipient's grant of the offered role, or a grant of the grantor's),
365
356
  // the destroyed parent scope row (for `scope_destroyed`), or the grantor's
366
357
  // removed account (for `account_deleted`).
367
- role_grant_offer_supersede: z.looseObject({
368
- offer_id: Uuid.meta({ description: 'Id of the superseded offer.' }),
369
- role: z.string().meta({ description: 'Role that was offered.' }),
370
- scope_id: Uuid.nullish().meta({
358
+ role_grant_offer_supersede: loose_object({
359
+ offer_id: meta(Uuid, { description: 'Id of the superseded offer.' }),
360
+ role: meta(string, { description: 'Role that was offered.' }),
361
+ scope_id: meta(optional(nullable(Uuid)), {
371
362
  description: 'Scope of the offered role; null for global offers.'
372
363
  }),
373
- reason: z
374
- .enum(['sibling_accepted', 'role_grant_revoked', 'scope_destroyed', 'account_deleted'])
375
- .meta({
364
+ reason: meta(one_of(['sibling_accepted', 'role_grant_revoked', 'scope_destroyed', 'account_deleted']), {
376
365
  description: "Trigger that obsoleted the offer: a sibling offer was accepted, the resulting role_grant or one of the grantor's was revoked, the parent scope row was destroyed, or the grantor's account was deleted or purged."
377
366
  }),
378
- cause_id: Uuid.meta({
367
+ cause_id: meta(Uuid, {
379
368
  description: "Row that caused the supersede: accepted offer (`sibling_accepted`), revoked role_grant (`role_grant_revoked`), destroyed parent scope row (`scope_destroyed`), or the grantor's account (`account_deleted`)."
380
369
  })
381
370
  }),
382
- invite_create: z.looseObject({
383
- invite_id: Uuid.meta({ description: 'Id of the created invite.' }),
384
- email: z.string().nullable().meta({ description: 'Invited email address; null when not set.' }),
385
- username: z.string().nullable().meta({ description: 'Invited username; null when not set.' })
371
+ invite_create: loose_object({
372
+ invite_id: meta(Uuid, { description: 'Id of the created invite.' }),
373
+ email: meta(nullable(string), { description: 'Invited email address; null when not set.' }),
374
+ username: meta(nullable(string), { description: 'Invited username; null when not set.' })
386
375
  }),
387
- invite_delete: z.looseObject({
388
- invite_id: Uuid.meta({ description: 'Id of the deleted invite.' })
376
+ invite_delete: loose_object({
377
+ invite_id: meta(Uuid, { description: 'Id of the deleted invite.' })
389
378
  }),
390
379
  // Account/actor deletion snapshots identity into metadata so the
391
380
  // identity behind a now-orphaned audit id survives a purge (the
@@ -395,33 +384,27 @@ export const audit_metadata_schemas = Object.freeze({
395
384
  // snapshot and the not-found failure shape (`reason` /
396
385
  // `attempted_account_id`). See `auth/CLAUDE.md` §Account/actor deletion
397
386
  // (delete = soft, purge = hard).
398
- account_delete: z.looseObject({
399
- username: z.string().optional().meta({ description: 'Username at soft-delete time.' }),
400
- email: z
401
- .string()
402
- .nullable()
403
- .optional()
404
- .meta({ description: 'Email at soft-delete time; null when unset.' }),
405
- reason: z
406
- .string()
407
- .optional()
408
- .meta({ description: 'Failure category. Set only on `outcome=failure`.' }),
409
- attempted_account_id: Uuid.optional().meta({
387
+ account_delete: loose_object({
388
+ username: meta(optional(string), { description: 'Username at soft-delete time.' }),
389
+ email: meta(optional(nullable(string)), {
390
+ description: 'Email at soft-delete time; null when unset.'
391
+ }),
392
+ reason: meta(optional(string), {
393
+ description: 'Failure category. Set only on `outcome=failure`.'
394
+ }),
395
+ attempted_account_id: meta(optional(Uuid), {
410
396
  description: 'Probed account id when the target was missing (`outcome=failure`).'
411
397
  })
412
398
  }),
413
- account_purge: z.looseObject({
414
- username: z.string().optional().meta({ description: 'Username at purge time.' }),
415
- email: z
416
- .string()
417
- .nullable()
418
- .optional()
419
- .meta({ description: 'Email at purge time; null when unset.' }),
420
- reason: z
421
- .string()
422
- .optional()
423
- .meta({ description: 'Failure category. Set only on `outcome=failure`.' }),
424
- attempted_account_id: Uuid.optional().meta({
399
+ account_purge: loose_object({
400
+ username: meta(optional(string), { description: 'Username at purge time.' }),
401
+ email: meta(optional(nullable(string)), {
402
+ description: 'Email at purge time; null when unset.'
403
+ }),
404
+ reason: meta(optional(string), {
405
+ description: 'Failure category. Set only on `outcome=failure`.'
406
+ }),
407
+ attempted_account_id: meta(optional(Uuid), {
425
408
  description: 'Probed account id when the target was missing (`outcome=failure`).'
426
409
  })
427
410
  }),
@@ -430,46 +413,43 @@ export const audit_metadata_schemas = Object.freeze({
430
413
  // the delete events so reviewers see who was reactivated; `reason` /
431
414
  // `attempted_account_id` carry the not-found failure shape. Admin-only —
432
415
  // the self path is unreachable (a tombstoned account can't authenticate).
433
- account_undelete: z.looseObject({
434
- username: z.string().optional().meta({ description: 'Username at reactivation time.' }),
435
- email: z
436
- .string()
437
- .nullable()
438
- .optional()
439
- .meta({ description: 'Email at reactivation time; null when unset.' }),
440
- reason: z
441
- .string()
442
- .optional()
443
- .meta({ description: 'Failure category. Set only on `outcome=failure`.' }),
444
- attempted_account_id: Uuid.optional().meta({
416
+ account_undelete: loose_object({
417
+ username: meta(optional(string), { description: 'Username at reactivation time.' }),
418
+ email: meta(optional(nullable(string)), {
419
+ description: 'Email at reactivation time; null when unset.'
420
+ }),
421
+ reason: meta(optional(string), {
422
+ description: 'Failure category. Set only on `outcome=failure`.'
423
+ }),
424
+ attempted_account_id: meta(optional(Uuid), {
445
425
  description: 'Probed account id when the target was missing/not-deleted (`outcome=failure`).'
446
426
  })
447
427
  }),
448
- actor_delete: z.looseObject({
449
- name: z.string().optional().meta({ description: 'Actor display name at soft-delete time.' })
428
+ actor_delete: loose_object({
429
+ name: meta(optional(string), { description: 'Actor display name at soft-delete time.' })
450
430
  }),
451
- actor_purge: z.looseObject({
452
- name: z.string().optional().meta({ description: 'Actor display name at purge time.' })
431
+ actor_purge: loose_object({
432
+ name: meta(optional(string), { description: 'Actor display name at purge time.' })
453
433
  }),
454
- actor_undelete: z.looseObject({
455
- name: z.string().optional().meta({ description: 'Actor display name at reactivation time.' })
434
+ actor_undelete: loose_object({
435
+ name: meta(optional(string), { description: 'Actor display name at reactivation time.' })
456
436
  }),
457
- app_settings_update: z.looseObject({
458
- setting: z.string().meta({ description: 'Name of the setting that changed.' }),
459
- old_value: z.unknown().meta({ description: 'Setting value before the update.' }),
460
- new_value: z.unknown().meta({ description: 'Setting value after the update.' })
437
+ app_settings_update: loose_object({
438
+ setting: meta(string, { description: 'Name of the setting that changed.' }),
439
+ old_value: meta(unknown, { description: 'Setting value before the update.' }),
440
+ new_value: meta(unknown, { description: 'Setting value after the update.' })
461
441
  }),
462
442
  // Row deleted through the generic db-admin table browser
463
443
  // (`http/db_routes.ts` / the Rust spine's `fuz_db_admin`). Account-grain
464
444
  // attribution (`account_id`, no `actor_id`) — the browser's gate is
465
445
  // account-grain by construction. Emitted only on a successful delete;
466
446
  // post-composite-refusal the delete is provably single-row, so no count.
467
- db_admin_row_delete: z.looseObject({
468
- table: z.string().meta({ description: 'Table the row was deleted from.' }),
469
- pk_column: z.string().meta({
447
+ db_admin_row_delete: loose_object({
448
+ table: meta(string, { description: 'Table the row was deleted from.' }),
449
+ pk_column: meta(string, {
470
450
  description: 'Single primary-key column the `DELETE` filtered on.'
471
451
  }),
472
- id: z.string().meta({
452
+ id: meta(string, {
473
453
  description: "Primary-key value of the deleted row, as the row's canonical `::text` rendering."
474
454
  })
475
455
  })
@@ -491,7 +471,7 @@ export const builtin_audit_log_config = Object.freeze({
491
471
  * `AppDeps.audit` emitter. Builtin handlers omit the `audit_log_config`
492
472
  * slot and pick up `builtin_audit_log_config`.
493
473
  *
494
- * @throws Error when an `extra_events` key collides with a builtin event type or fails `AuditEventTypeName` format validation
474
+ * @throws Error when an `extra_events` key collides with a builtin event type or fails `AuditEventTypeName` format validation, or its value is neither `null` nor a schema of either library
495
475
  */
496
476
  export const create_audit_log_config = (options) => {
497
477
  const extras = options?.extra_events;
@@ -507,13 +487,15 @@ export const create_audit_log_config = (options) => {
507
487
  if (builtin_set.has(t)) {
508
488
  throw new Error(`extra_events key "${t}" collides with a builtin event type — pick a distinct string (e.g. "app_${t}")`);
509
489
  }
510
- const name_check = AuditEventTypeName.safeParse(t);
511
- if (!name_check.success) {
512
- throw new Error(`extra_events key "${t}" has invalid format: ${name_check.error.issues[0].message}`);
490
+ const name_check = parse(AuditEventTypeName, t);
491
+ if (!name_check.ok) {
492
+ throw new Error(`extra_events key "${t}" has invalid format: ${format_issue(name_check.issues[0])}`);
513
493
  }
514
494
  extra_keys.push(t);
515
- if (schema !== null)
495
+ if (schema !== null) {
496
+ assert_validation_schema(schema, `extra_events key "${t}"`);
516
497
  metadata_schemas[t] = schema;
498
+ }
517
499
  }
518
500
  return Object.freeze({
519
501
  event_types: Object.freeze([...AUDIT_EVENT_TYPES, ...extra_keys]),
@@ -523,7 +505,7 @@ export const create_audit_log_config = (options) => {
523
505
  /** Default page size for audit log listings. */
524
506
  export const AUDIT_LOG_DEFAULT_LIMIT = 50;
525
507
  /**
526
- * Zod schema for client-safe audit log event.
508
+ * Client-safe audit log event, a `@fuzdev/fuz_schema` schema.
527
509
  *
528
510
  * `event_type` is `AuditEventTypeName` (regex-validated string, at most
529
511
  * `NAME_LENGTH_MAX` characters) — matches
@@ -531,32 +513,41 @@ export const AUDIT_LOG_DEFAULT_LIMIT = 50;
531
513
  * types registered via `create_audit_log_config({extra_events})` round-trip
532
514
  * through queries, `on_audit_event` callbacks, and JSON-RPC responses
533
515
  * identically to builtins. `AuditLogInput<T>` stays parameterized on the
534
- * write side so `AuditMetadataMap` narrows metadata per event type.
516
+ * write side so `AuditMetadataMap` narrows metadata per event type. `seq` is
517
+ * an integer within `Number.MAX_SAFE_INTEGER`, the integers a JSON number
518
+ * holds exactly.
535
519
  */
536
- export const AuditLogEventJson = z.strictObject({
520
+ export const AuditLogEventJson = object({
537
521
  id: Uuid,
538
- seq: z.number().int(),
522
+ seq: pipe(number, safe_integer),
539
523
  event_type: AuditEventTypeName,
540
524
  outcome: AuditOutcome,
541
- actor_id: Uuid.nullable(),
542
- account_id: Uuid.nullable(),
543
- target_account_id: Uuid.nullable(),
544
- target_actor_id: Uuid.nullable(),
545
- ip: z.string().nullable(),
546
- created_at: z.string(),
547
- metadata: z.record(z.string(), z.unknown()).nullable()
525
+ actor_id: nullable(Uuid),
526
+ account_id: nullable(Uuid),
527
+ target_account_id: nullable(Uuid),
528
+ target_actor_id: nullable(Uuid),
529
+ ip: nullable(string),
530
+ created_at: Timestamp,
531
+ metadata: nullable(record(unknown))
548
532
  });
549
- /** Zod schema for audit log events with resolved usernames. */
550
- export const AuditLogEventWithUsernamesJson = AuditLogEventJson.extend({
551
- username: z.string().nullable(),
552
- target_username: z.string().nullable()
533
+ /** Audit log events with resolved usernames, a `@fuzdev/fuz_schema` schema. */
534
+ export const AuditLogEventWithUsernamesJson = object({
535
+ ...AuditLogEventJson.def,
536
+ username: nullable(string),
537
+ target_username: nullable(string)
553
538
  });
554
- /** Zod schema for role_grant history events with resolved usernames. */
555
- export const RoleGrantHistoryEventJson = AuditLogEventJson.extend({
556
- username: z.string().nullable(),
557
- target_username: z.string().nullable()
539
+ /** Role_grant history events with resolved usernames, a `@fuzdev/fuz_schema` schema. */
540
+ export const RoleGrantHistoryEventJson = object({
541
+ ...AuditLogEventJson.def,
542
+ username: nullable(string),
543
+ target_username: nullable(string)
558
544
  });
559
- /** Zod schema for admin session listing (session + username, without `is_current`). */
560
- export const AdminSessionJson = AuthSessionJson.omit({ is_current: true }).extend({
561
- username: z.string()
545
+ const { is_current: _, ...admin_session_entries } = AuthSessionJson.def;
546
+ /**
547
+ * Admin session listing (session + username, without `is_current`), a
548
+ * `@fuzdev/fuz_schema` schema. `username` is a plain string.
549
+ */
550
+ export const AdminSessionJson = object({
551
+ ...admin_session_entries,
552
+ username: string
562
553
  });