@fuzdev/fuz_app 0.162.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 (121) hide show
  1. package/dist/auth/CLAUDE.md +38 -35
  2. package/dist/auth/account_action_specs.d.ts +441 -115
  3. package/dist/auth/account_action_specs.d.ts.map +1 -1
  4. package/dist/auth/account_action_specs.js +47 -46
  5. package/dist/auth/account_route_schema.d.ts +120 -60
  6. package/dist/auth/account_route_schema.d.ts.map +1 -1
  7. package/dist/auth/account_route_schema.js +50 -36
  8. package/dist/auth/account_routes.js +1 -1
  9. package/dist/auth/account_schema.d.ts +54 -27
  10. package/dist/auth/account_schema.d.ts.map +1 -1
  11. package/dist/auth/account_schema.js +16 -18
  12. package/dist/auth/admin_action_specs.d.ts +20 -20
  13. package/dist/auth/admin_action_specs.js +2 -4
  14. package/dist/auth/admin_actions.d.ts +4 -4
  15. package/dist/auth/admin_actions.d.ts.map +1 -1
  16. package/dist/auth/admin_actions.js +3 -3
  17. package/dist/auth/all_cell_actions.d.ts +3 -3
  18. package/dist/auth/all_cell_actions.d.ts.map +1 -1
  19. package/dist/auth/all_cell_actions.js +1 -1
  20. package/dist/auth/api_token.d.ts +4 -4
  21. package/dist/auth/api_token.d.ts.map +1 -1
  22. package/dist/auth/api_token.js +3 -3
  23. package/dist/auth/audit_log_schema.d.ts +28 -48
  24. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  25. package/dist/auth/audit_log_schema.js +34 -30
  26. package/dist/auth/bootstrap_route_schema.d.ts +173 -50
  27. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  28. package/dist/auth/bootstrap_route_schema.js +35 -16
  29. package/dist/auth/cell_grant_action_specs.d.ts +1 -1
  30. package/dist/auth/cell_grant_action_specs.js +1 -1
  31. package/dist/auth/cell_grant_actions.d.ts +4 -4
  32. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  33. package/dist/auth/cell_grant_actions.js +1 -1
  34. package/dist/auth/credential_type_schema.d.ts +16 -29
  35. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  36. package/dist/auth/credential_type_schema.js +14 -18
  37. package/dist/auth/grant_path_schema.d.ts +15 -29
  38. package/dist/auth/grant_path_schema.d.ts.map +1 -1
  39. package/dist/auth/grant_path_schema.js +13 -17
  40. package/dist/auth/migrations.js +1 -1
  41. package/dist/auth/name_schema.d.ts +7 -6
  42. package/dist/auth/name_schema.d.ts.map +1 -1
  43. package/dist/auth/name_schema.js +8 -9
  44. package/dist/auth/password.d.ts +15 -7
  45. package/dist/auth/password.d.ts.map +1 -1
  46. package/dist/auth/password.js +16 -9
  47. package/dist/auth/role_grant_offer_action_specs.js +2 -2
  48. package/dist/auth/role_grant_offer_actions.d.ts +4 -4
  49. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  50. package/dist/auth/role_grant_offer_actions.js +3 -3
  51. package/dist/auth/role_grant_offer_notifications.js +2 -2
  52. package/dist/auth/role_grant_offer_schema.d.ts +2 -2
  53. package/dist/auth/role_grant_offer_schema.js +2 -2
  54. package/dist/auth/role_schema.d.ts +47 -55
  55. package/dist/auth/role_schema.d.ts.map +1 -1
  56. package/dist/auth/role_schema.js +29 -35
  57. package/dist/auth/scope_kind_schema.d.ts +22 -26
  58. package/dist/auth/scope_kind_schema.d.ts.map +1 -1
  59. package/dist/auth/scope_kind_schema.js +19 -19
  60. package/dist/auth/self_service_role_action_specs.js +1 -1
  61. package/dist/auth/self_service_role_actions.d.ts +6 -6
  62. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  63. package/dist/auth/self_service_role_actions.js +7 -6
  64. package/dist/auth/signup_route_schema.d.ts +71 -21
  65. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  66. package/dist/auth/signup_route_schema.js +18 -16
  67. package/dist/auth/standard_rpc_actions.d.ts +1 -1
  68. package/dist/auth/standard_rpc_actions.js +1 -1
  69. package/dist/auth/token_lifetime.d.ts +33 -9
  70. package/dist/auth/token_lifetime.d.ts.map +1 -1
  71. package/dist/auth/token_lifetime.js +8 -7
  72. package/dist/auth/token_scope.d.ts +99 -25
  73. package/dist/auth/token_scope.d.ts.map +1 -1
  74. package/dist/auth/token_scope.js +57 -35
  75. package/dist/primitive_schemas.d.ts +2 -19
  76. package/dist/primitive_schemas.d.ts.map +1 -1
  77. package/dist/primitive_schemas.js +2 -20
  78. package/dist/primitive_schemas_fuz.d.ts +22 -2
  79. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  80. package/dist/primitive_schemas_fuz.js +23 -4
  81. package/dist/testing/CLAUDE.md +22 -5
  82. package/dist/testing/admin_integration.d.ts +3 -3
  83. package/dist/testing/admin_integration.d.ts.map +1 -1
  84. package/dist/testing/admin_integration.js +1 -1
  85. package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
  86. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  87. package/dist/testing/cross_backend/default_spine_surface.js +2 -2
  88. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  89. package/dist/testing/cross_backend/identity_parity.js +39 -6
  90. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
  91. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  92. package/dist/testing/cross_backend/setup.d.ts +1 -1
  93. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  94. package/dist/testing/cross_backend/setup.js +45 -42
  95. package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
  96. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  97. package/dist/testing/cross_backend/standard.d.ts +4 -4
  98. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  99. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  100. package/dist/testing/cross_backend/token_lifetime.js +34 -1
  101. package/dist/testing/integration.js +1 -1
  102. package/dist/testing/token_scope_fixtures.d.ts +24 -0
  103. package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
  104. package/dist/testing/token_scope_fixtures.js +49 -0
  105. package/dist/testing/transports/bootstrap.d.ts +1 -1
  106. package/dist/testing/transports/bootstrap.d.ts.map +1 -1
  107. package/dist/testing/transports/bootstrap.js +13 -12
  108. package/dist/ui/BootstrapForm.svelte +4 -2
  109. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  110. package/dist/ui/SignupForm.svelte +4 -2
  111. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  112. package/package.json +1 -1
  113. package/dist/auth/audit_log_schema_fuz.d.ts +0 -53
  114. package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
  115. package/dist/auth/audit_log_schema_fuz.js +0 -50
  116. package/dist/auth/role_schema_fuz.d.ts +0 -30
  117. package/dist/auth/role_schema_fuz.d.ts.map +0 -1
  118. package/dist/auth/role_schema_fuz.js +0 -30
  119. package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
  120. package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
  121. package/dist/auth/scope_kind_schema_fuz.js +0 -31
@@ -1,8 +1,7 @@
1
1
  /**
2
- * Audit log types and client-safe schemas. The wire rows and the builtin
3
- * metadata schemas are `@fuzdev/fuz_schema` schemas; the event-type and
4
- * outcome vocabularies are Zod, with their fuz_schema twins in
5
- * `auth/audit_log_schema_fuz.ts`.
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.
6
5
  *
7
6
  * Records auth mutations (login, logout, grant, revoke, etc.) for
8
7
  * security monitoring and operational visibility.
@@ -11,7 +10,6 @@
11
10
  *
12
11
  * @module
13
12
  */
14
- import { z } from 'zod';
15
13
  import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
16
14
  import { Uuid } from '../primitive_schemas_fuz.js';
17
15
  import { type ValidationSchema } from '../schema_issues.js';
@@ -22,38 +20,8 @@ import { type ValidationSchema } from '../schema_issues.js';
22
20
  * audit logging.
23
21
  */
24
22
  export declare const AUDIT_EVENT_TYPES: readonly ["login", "logout", "bootstrap", "signup", "password_change", "session_revoke", "session_revoke_all", "token_create", "token_revoke", "token_revoke_all", "role_grant_create", "role_grant_revoke", "role_grant_offer_create", "role_grant_offer_accept", "role_grant_offer_decline", "role_grant_offer_retract", "role_grant_offer_expire", "role_grant_offer_supersede", "invite_create", "invite_delete", "account_delete", "account_purge", "account_undelete", "actor_delete", "actor_purge", "actor_undelete", "app_settings_update", "db_admin_row_delete"];
25
- /** Zod schema for audit event types. */
26
- export declare const AuditEventType: z.ZodEnum<{
27
- bootstrap: "bootstrap";
28
- login: "login";
29
- logout: "logout";
30
- signup: "signup";
31
- password_change: "password_change";
32
- session_revoke: "session_revoke";
33
- session_revoke_all: "session_revoke_all";
34
- token_create: "token_create";
35
- token_revoke: "token_revoke";
36
- token_revoke_all: "token_revoke_all";
37
- role_grant_create: "role_grant_create";
38
- role_grant_revoke: "role_grant_revoke";
39
- role_grant_offer_create: "role_grant_offer_create";
40
- role_grant_offer_accept: "role_grant_offer_accept";
41
- role_grant_offer_decline: "role_grant_offer_decline";
42
- role_grant_offer_retract: "role_grant_offer_retract";
43
- role_grant_offer_expire: "role_grant_offer_expire";
44
- role_grant_offer_supersede: "role_grant_offer_supersede";
45
- invite_create: "invite_create";
46
- invite_delete: "invite_delete";
47
- account_delete: "account_delete";
48
- account_purge: "account_purge";
49
- account_undelete: "account_undelete";
50
- actor_delete: "actor_delete";
51
- actor_purge: "actor_purge";
52
- actor_undelete: "actor_undelete";
53
- app_settings_update: "app_settings_update";
54
- db_admin_row_delete: "db_admin_row_delete";
55
- }>;
56
- export type AuditEventType = z.infer<typeof AuditEventType>;
23
+ /** A builtin audit event type, one of `AUDIT_EVENT_TYPES`. */
24
+ export type AuditEventType = (typeof AUDIT_EVENT_TYPES)[number];
57
25
  /**
58
26
  * What a **successful** audit row invalidates — the axis the revocation
59
27
  * listener (`create_revocation_guard`) dispatches on.
@@ -128,18 +96,30 @@ export declare const to_global_role_revocation: (event: AuditLogEvent) => {
128
96
  role: string;
129
97
  } | null;
130
98
  /**
131
- * Zod schema for valid audit event-type name strings: `AUDIT_EVENT_TYPE_NAME_REGEX`,
132
- * at most `NAME_LENGTH_MAX` UTF-16 code units. Twin of the Rust spine's
133
- * `is_valid_audit_event_type_name`.
99
+ * Letter start, then letters, digits, `_`, `.`, `/`, `-`. Accepts snake_case,
100
+ * dotted, and namespaced consumer conventions; rejects empty strings, leading
101
+ * separators, whitespace, and control characters. The audit event type's own
102
+ * grammar, wider than the shared name grammar (`auth/name_schema.ts`), whose
103
+ * length cap `AuditEventTypeName` takes.
134
104
  */
135
- export declare const AuditEventTypeName: z.ZodString;
136
- export type AuditEventTypeName = z.infer<typeof AuditEventTypeName>;
137
- /** Zod schema for audit event outcomes. */
138
- export declare const AuditOutcome: z.ZodEnum<{
139
- success: "success";
140
- failure: "failure";
141
- }>;
142
- export type AuditOutcome = z.infer<typeof AuditOutcome>;
105
+ export declare const AUDIT_EVENT_TYPE_NAME_REGEX: RegExp;
106
+ /** The message of an audit event-type name past `NAME_LENGTH_MAX`. */
107
+ export declare const AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE = "must be at most 64 characters";
108
+ /** The message of an audit event-type name off `AUDIT_EVENT_TYPE_NAME_REGEX`. */
109
+ export declare const AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE = "must start with a letter; only letters, digits, _ . / - allowed";
110
+ /**
111
+ * Valid audit event-type name strings: `AUDIT_EVENT_TYPE_NAME_REGEX`, at most
112
+ * `NAME_LENGTH_MAX` UTF-16 code units. A string it refuses gets
113
+ * `AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE` or
114
+ * `AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE`, the length one alone for a string
115
+ * both too long and off the grammar; a value that is no string, fuz_schema's
116
+ * message. Twin of the Rust spine's `is_valid_audit_event_type_name`.
117
+ */
118
+ export declare const AuditEventTypeName: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
119
+ export type AuditEventTypeName = Infer<typeof AuditEventTypeName>;
120
+ /** Audit event outcome. */
121
+ export declare const AuditOutcome: import("@fuzdev/fuz_schema/schema.ts").Schema<"success" | "failure", "success" | "failure", "one_of", readonly ["success", "failure"]>;
122
+ export type AuditOutcome = Infer<typeof AuditOutcome>;
143
123
  /**
144
124
  * Per-event-type metadata schemas, `@fuzdev/fuz_schema` `loose_object`s so
145
125
  * consumers can add fields while known ones are validated. The record is
@@ -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;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAgBN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAoB,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAA4B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA4BtF;;;;;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,eAA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AED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEhE,+EAA+E;AAC/E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzC,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAE1F,wFAAwF;AACxF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,8 +1,7 @@
1
1
  /**
2
- * Audit log types and client-safe schemas. The wire rows and the builtin
3
- * metadata schemas are `@fuzdev/fuz_schema` schemas; the event-type and
4
- * outcome vocabularies are Zod, with their fuz_schema twins in
5
- * `auth/audit_log_schema_fuz.ts`.
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.
6
5
  *
7
6
  * Records auth mutations (login, logout, grant, revoke, etc.) for
8
7
  * security monitoring and operational visibility.
@@ -11,19 +10,14 @@
11
10
  *
12
11
  * @module
13
12
  */
14
- import { z } from 'zod';
15
13
  import { meta } from '@fuzdev/fuz_schema/meta.ts';
16
- import { boolean, literal, loose_object, nullable, number, object, one_of, optional, pipe, record, regex, safe_integer, string, unknown } from '@fuzdev/fuz_schema/schema.ts';
17
- import { bounded_string } from '../primitive_schemas.js';
18
- import { Email, Timestamp, Uuid } from '../primitive_schemas_fuz.js';
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';
19
16
  import { assert_validation_schema } from '../schema_issues.js';
20
17
  import { AuthSessionJson, SessionId } from './account_schema.js';
21
- import { API_TOKEN_ID_REGEX } from './api_token.js';
18
+ import { ApiTokenId } from './api_token.js';
22
19
  import { BUILTIN_CREDENTIAL_TYPES } from './credential_type_schema.js';
23
20
  import { NAME_LENGTH_MAX } from './name_schema.js';
24
- import { AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE, AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE, AUDIT_EVENT_TYPE_NAME_REGEX, AuditEventTypeName as AuditEventTypeNameFuz, AuditOutcome as AuditOutcomeFuz } from './audit_log_schema_fuz.js';
25
- /** An API token's public id (`tok_…`), `ApiTokenId`'s check in fuz_schema. */
26
- const TokenId = pipe(string, regex(API_TOKEN_ID_REGEX));
27
21
  /**
28
22
  * Defense-in-depth audit field — records the credential channel
29
23
  * (`session` / `api_token` / `daemon_token`) the request arrived on.
@@ -70,8 +64,6 @@ export const AUDIT_EVENT_TYPES = Object.freeze([
70
64
  'app_settings_update',
71
65
  'db_admin_row_delete'
72
66
  ]);
73
- /** Zod schema for audit event types. */
74
- export const AuditEventType = z.enum(AUDIT_EVENT_TYPES);
75
67
  /**
76
68
  * The `RevocationScope` of every builtin audit event — declared once, the one
77
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
@@ -161,16 +153,28 @@ export const to_global_role_revocation = (event) => {
161
153
  return { account_id, role };
162
154
  };
163
155
  /**
164
- * Zod schema for valid audit event-type name strings: `AUDIT_EVENT_TYPE_NAME_REGEX`,
165
- * at most `NAME_LENGTH_MAX` UTF-16 code units. Twin of the Rust spine's
166
- * `is_valid_audit_event_type_name`.
156
+ * Letter start, then letters, digits, `_`, `.`, `/`, `-`. Accepts snake_case,
157
+ * dotted, and namespaced consumer conventions; rejects empty strings, leading
158
+ * separators, whitespace, and control characters. The audit event type's own
159
+ * grammar, wider than the shared name grammar (`auth/name_schema.ts`), whose
160
+ * length cap `AuditEventTypeName` takes.
167
161
  */
168
- export const AuditEventTypeName = bounded_string({
169
- max: NAME_LENGTH_MAX,
170
- max_message: AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE
171
- }).regex(AUDIT_EVENT_TYPE_NAME_REGEX, { message: AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE });
172
- /** Zod schema for audit event outcomes. */
173
- export const AuditOutcome = z.enum(['success', 'failure']);
162
+ export const AUDIT_EVENT_TYPE_NAME_REGEX = /^[A-Za-z][A-Za-z0-9_./-]*$/;
163
+ /** The message of an audit event-type name past `NAME_LENGTH_MAX`. */
164
+ export const AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE = `must be at most ${NAME_LENGTH_MAX} characters`;
165
+ /** The message of an audit event-type name off `AUDIT_EVENT_TYPE_NAME_REGEX`. */
166
+ export const AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE = 'must start with a letter; only letters, digits, _ . / - allowed';
167
+ /**
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`.
174
+ */
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']);
174
178
  /**
175
179
  * Per-event-type metadata schemas, `@fuzdev/fuz_schema` `loose_object`s so
176
180
  * consumers can add fields while known ones are validated. The record is
@@ -235,12 +239,12 @@ export const audit_metadata_schemas = Object.freeze({
235
239
  credential_type: credential_type_meta
236
240
  }),
237
241
  token_create: loose_object({
238
- token_id: meta(TokenId, { description: 'Public id of the created API token (`tok_…`).' }),
242
+ token_id: meta(ApiTokenId, { description: 'Public id of the created API token (`tok_…`).' }),
239
243
  name: meta(string, { description: 'Operator-supplied label for the token.' }),
240
244
  credential_type: credential_type_meta
241
245
  }),
242
246
  token_revoke: loose_object({
243
- token_id: meta(TokenId, { description: 'Public id of the revoked API token (`tok_…`).' }),
247
+ token_id: meta(ApiTokenId, { description: 'Public id of the revoked API token (`tok_…`).' }),
244
248
  credential_type: credential_type_meta
245
249
  }),
246
250
  token_revoke_all: loose_object({
@@ -483,9 +487,9 @@ export const create_audit_log_config = (options) => {
483
487
  if (builtin_set.has(t)) {
484
488
  throw new Error(`extra_events key "${t}" collides with a builtin event type — pick a distinct string (e.g. "app_${t}")`);
485
489
  }
486
- const name_check = AuditEventTypeName.safeParse(t);
487
- if (!name_check.success) {
488
- 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])}`);
489
493
  }
490
494
  extra_keys.push(t);
491
495
  if (schema !== null) {
@@ -516,8 +520,8 @@ export const AUDIT_LOG_DEFAULT_LIMIT = 50;
516
520
  export const AuditLogEventJson = object({
517
521
  id: Uuid,
518
522
  seq: pipe(number, safe_integer),
519
- event_type: AuditEventTypeNameFuz,
520
- outcome: AuditOutcomeFuz,
523
+ event_type: AuditEventTypeName,
524
+ outcome: AuditOutcome,
521
525
  actor_id: nullable(Uuid),
522
526
  account_id: nullable(Uuid),
523
527
  target_account_id: nullable(Uuid),
@@ -13,26 +13,90 @@
13
13
  *
14
14
  * @module
15
15
  */
16
- import { z } from 'zod';
17
- /** Input for `POST /bootstrap`. `token` is the one-shot token file contents. */
18
- export declare const BootstrapInput: z.ZodObject<{
19
- token: z.ZodString;
20
- username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
21
- password: z.ZodString;
22
- }, z.core.$strict>;
23
- export type BootstrapInput = z.infer<typeof BootstrapInput>;
24
- /** Output for `POST /bootstrap`. Session cookie is the operative side effect. */
25
- export declare const BootstrapOutput: z.ZodObject<{
26
- ok: z.ZodLiteral<true>;
27
- account: z.ZodObject<{
28
- id: z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>;
29
- username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
30
- }, z.core.$strict>;
31
- actor: z.ZodObject<{
32
- id: z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>;
33
- }, z.core.$strict>;
34
- }, z.core.$strict>;
35
- export type BootstrapOutput = z.infer<typeof BootstrapOutput>;
16
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
17
+ /**
18
+ * The longest `token` `POST /bootstrap` takes, in UTF-16 code units: the token
19
+ * file's cap, `MAX_SECURE_FILE_SIZE` bytes. A token that can match the file is
20
+ * at most that many bytes in UTF-8, and no more code units than bytes, so the
21
+ * bound refuses none that could match. A longer one is a malformed body, a
22
+ * `400 invalid_request_body` refused before the bootstrap window or the token
23
+ * file is read, with no audit row. Twin of the Rust spine's
24
+ * `BOOTSTRAP_TOKEN_LENGTH_MAX`, which counts the same units.
25
+ */
26
+ export declare const BOOTSTRAP_TOKEN_LENGTH_MAX = 4096;
27
+ /**
28
+ * Input for `POST /bootstrap`, a `@fuzdev/fuz_schema` schema. `token` is the
29
+ * one-shot token file contents, 1 to `BOOTSTRAP_TOKEN_LENGTH_MAX` UTF-16 code
30
+ * units.
31
+ */
32
+ export declare const BootstrapInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
33
+ username: string;
34
+ token: string;
35
+ password: string;
36
+ }, {
37
+ username: string;
38
+ token: string;
39
+ password: string;
40
+ }, "object", {
41
+ token: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
42
+ username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
43
+ password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
44
+ }>;
45
+ export type BootstrapInput = Infer<typeof BootstrapInput>;
46
+ /**
47
+ * Output for `POST /bootstrap`, a `@fuzdev/fuz_schema` schema. Session cookie
48
+ * is the operative side effect. Its `username` is the account row's,
49
+ * `UsernameCanonical`.
50
+ */
51
+ export declare const BootstrapOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
52
+ account: {
53
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
54
+ username: string;
55
+ };
56
+ actor: {
57
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
58
+ };
59
+ ok: true;
60
+ }, {
61
+ account: {
62
+ id: string;
63
+ username: string;
64
+ };
65
+ actor: {
66
+ id: string;
67
+ };
68
+ ok: true;
69
+ }, "object", {
70
+ ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
71
+ account: import("@fuzdev/fuz_schema/schema.ts").Schema<{
72
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
73
+ username: string;
74
+ }, {
75
+ id: string;
76
+ username: string;
77
+ }, "object", {
78
+ id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
79
+ readonly '~types'?: {
80
+ readonly input: string;
81
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
82
+ } | undefined;
83
+ };
84
+ username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
85
+ }>;
86
+ actor: import("@fuzdev/fuz_schema/schema.ts").Schema<{
87
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
88
+ }, {
89
+ id: string;
90
+ }, "object", {
91
+ id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
92
+ readonly '~types'?: {
93
+ readonly input: string;
94
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
95
+ } | undefined;
96
+ };
97
+ }>;
98
+ }>;
99
+ export type BootstrapOutput = Infer<typeof BootstrapOutput>;
36
100
  /**
37
101
  * The `POST /bootstrap` route shape minus its handler — pure hono-free data.
38
102
  * `create_bootstrap_route_specs` spreads this and attaches the live handler;
@@ -49,38 +113,97 @@ export declare const bootstrap_route_shape: {
49
113
  mints_credential: true;
50
114
  description: string;
51
115
  transaction: false;
52
- input: z.ZodObject<{
53
- token: z.ZodString;
54
- username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
55
- password: z.ZodString;
56
- }, z.core.$strict>;
57
- output: z.ZodObject<{
58
- ok: z.ZodLiteral<true>;
59
- account: z.ZodObject<{
60
- id: z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>;
61
- username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
62
- }, z.core.$strict>;
63
- actor: z.ZodObject<{
64
- id: z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>;
65
- }, z.core.$strict>;
66
- }, z.core.$strict>;
116
+ input: import("@fuzdev/fuz_schema/schema.ts").Schema<{
117
+ username: string;
118
+ token: string;
119
+ password: string;
120
+ }, {
121
+ username: string;
122
+ token: string;
123
+ password: string;
124
+ }, "object", {
125
+ token: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
126
+ username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
127
+ password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
128
+ }>;
129
+ output: import("@fuzdev/fuz_schema/schema.ts").Schema<{
130
+ account: {
131
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
132
+ username: string;
133
+ };
134
+ actor: {
135
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
136
+ };
137
+ ok: true;
138
+ }, {
139
+ account: {
140
+ id: string;
141
+ username: string;
142
+ };
143
+ actor: {
144
+ id: string;
145
+ };
146
+ ok: true;
147
+ }, "object", {
148
+ ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
149
+ account: import("@fuzdev/fuz_schema/schema.ts").Schema<{
150
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
151
+ username: string;
152
+ }, {
153
+ id: string;
154
+ username: string;
155
+ }, "object", {
156
+ id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
157
+ readonly '~types'?: {
158
+ readonly input: string;
159
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
160
+ } | undefined;
161
+ };
162
+ username: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
163
+ }>;
164
+ actor: import("@fuzdev/fuz_schema/schema.ts").Schema<{
165
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
166
+ }, {
167
+ id: string;
168
+ }, "object", {
169
+ id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case">)[]> & {
170
+ readonly '~types'?: {
171
+ readonly input: string;
172
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
173
+ } | undefined;
174
+ };
175
+ }>;
176
+ }>;
67
177
  rate_limit: "ip";
68
178
  errors: {
69
- 400: z.ZodObject<{
70
- error: z.ZodEnum<{
71
- invalid_request_body: "invalid_request_body";
72
- invalid_json_body: "invalid_json_body";
73
- }>;
74
- }, z.core.$loose>;
75
- 401: z.ZodObject<{
76
- error: z.ZodLiteral<"invalid_token">;
77
- }, z.core.$loose>;
78
- 403: z.ZodObject<{
79
- error: z.ZodLiteral<"already_bootstrapped">;
80
- }, z.core.$loose>;
81
- 404: z.ZodObject<{
82
- error: z.ZodLiteral<"token_file_missing">;
83
- }, z.core.$loose>;
179
+ 400: import("@fuzdev/fuz_schema/schema.ts").Schema<{
180
+ error: "invalid_request_body" | "invalid_json_body";
181
+ } & Record<string, unknown>, {
182
+ error: "invalid_request_body" | "invalid_json_body";
183
+ } & Record<string, unknown>, "loose_object", {
184
+ error: import("@fuzdev/fuz_schema/schema.ts").Schema<"invalid_request_body" | "invalid_json_body", "invalid_request_body" | "invalid_json_body", "one_of", readonly ["invalid_json_body", "invalid_request_body"]>;
185
+ }>;
186
+ 401: import("@fuzdev/fuz_schema/schema.ts").Schema<{
187
+ error: "invalid_token";
188
+ } & Record<string, unknown>, {
189
+ error: "invalid_token";
190
+ } & Record<string, unknown>, "loose_object", {
191
+ error: import("@fuzdev/fuz_schema/schema.ts").Schema<"invalid_token", "invalid_token", "literal", "invalid_token">;
192
+ }>;
193
+ 403: import("@fuzdev/fuz_schema/schema.ts").Schema<{
194
+ error: "already_bootstrapped";
195
+ } & Record<string, unknown>, {
196
+ error: "already_bootstrapped";
197
+ } & Record<string, unknown>, "loose_object", {
198
+ error: import("@fuzdev/fuz_schema/schema.ts").Schema<"already_bootstrapped", "already_bootstrapped", "literal", "already_bootstrapped">;
199
+ }>;
200
+ 404: import("@fuzdev/fuz_schema/schema.ts").Schema<{
201
+ error: "token_file_missing";
202
+ } & Record<string, unknown>, {
203
+ error: "token_file_missing";
204
+ } & Record<string, unknown>, "loose_object", {
205
+ error: import("@fuzdev/fuz_schema/schema.ts").Schema<"token_file_missing", "token_file_missing", "literal", "token_file_missing">;
206
+ }>;
84
207
  };
85
208
  };
86
209
  //# sourceMappingURL=bootstrap_route_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,gFAAgF;AAChF,eAAO,MAAM,cAAc;;;;kBAIzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,iFAAiF;AACjF,eAAO,MAAM,eAAe;;;;;;;;;kBAI1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBI,CAAC"}
1
+ {"version":3,"file":"bootstrap_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/bootstrap_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AActC;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;EAMzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBI,CAAC"}
@@ -13,21 +13,42 @@
13
13
  *
14
14
  * @module
15
15
  */
16
- import { z } from 'zod';
17
- import { Uuid, Username } from '../primitive_schemas.js';
16
+ import { meta } from '@fuzdev/fuz_schema/meta.ts';
17
+ import { literal, loose_object, max_length, min_length, object, one_of, pipe, string } from '@fuzdev/fuz_schema/schema.ts';
18
+ import { Username, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
18
19
  import { Password } from './password.js';
19
20
  import { ERROR_INVALID_TOKEN, ERROR_ALREADY_BOOTSTRAPPED, ERROR_TOKEN_FILE_MISSING, ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY } from '../http/error_schemas.js';
20
- /** Input for `POST /bootstrap`. `token` is the one-shot token file contents. */
21
- export const BootstrapInput = z.strictObject({
22
- token: z.string().min(1).meta({ sensitivity: 'secret' }),
21
+ /**
22
+ * The longest `token` `POST /bootstrap` takes, in UTF-16 code units: the token
23
+ * file's cap, `MAX_SECURE_FILE_SIZE` bytes. A token that can match the file is
24
+ * at most that many bytes in UTF-8, and no more code units than bytes, so the
25
+ * bound refuses none that could match. A longer one is a malformed body, a
26
+ * `400 invalid_request_body` refused before the bootstrap window or the token
27
+ * file is read, with no audit row. Twin of the Rust spine's
28
+ * `BOOTSTRAP_TOKEN_LENGTH_MAX`, which counts the same units.
29
+ */
30
+ export const BOOTSTRAP_TOKEN_LENGTH_MAX = 4096;
31
+ /**
32
+ * Input for `POST /bootstrap`, a `@fuzdev/fuz_schema` schema. `token` is the
33
+ * one-shot token file contents, 1 to `BOOTSTRAP_TOKEN_LENGTH_MAX` UTF-16 code
34
+ * units.
35
+ */
36
+ export const BootstrapInput = object({
37
+ token: meta(pipe(string, min_length(1), max_length(BOOTSTRAP_TOKEN_LENGTH_MAX)), {
38
+ sensitivity: 'secret'
39
+ }),
23
40
  username: Username,
24
41
  password: Password
25
42
  });
26
- /** Output for `POST /bootstrap`. Session cookie is the operative side effect. */
27
- export const BootstrapOutput = z.strictObject({
28
- ok: z.literal(true),
29
- account: z.strictObject({ id: Uuid, username: Username }),
30
- actor: z.strictObject({ id: Uuid })
43
+ /**
44
+ * Output for `POST /bootstrap`, a `@fuzdev/fuz_schema` schema. Session cookie
45
+ * is the operative side effect. Its `username` is the account row's,
46
+ * `UsernameCanonical`.
47
+ */
48
+ export const BootstrapOutput = object({
49
+ ok: literal(true),
50
+ account: object({ id: Uuid, username: UsernameCanonical }),
51
+ actor: object({ id: Uuid })
31
52
  });
32
53
  /**
33
54
  * The `POST /bootstrap` route shape minus its handler — pure hono-free data.
@@ -46,11 +67,9 @@ export const bootstrap_route_shape = {
46
67
  output: BootstrapOutput,
47
68
  rate_limit: 'ip',
48
69
  errors: {
49
- 400: z.looseObject({
50
- error: z.enum([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY])
51
- }),
52
- 401: z.looseObject({ error: z.literal(ERROR_INVALID_TOKEN) }),
53
- 403: z.looseObject({ error: z.literal(ERROR_ALREADY_BOOTSTRAPPED) }),
54
- 404: z.looseObject({ error: z.literal(ERROR_TOKEN_FILE_MISSING) })
70
+ 400: loose_object({ error: one_of([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY]) }),
71
+ 401: loose_object({ error: literal(ERROR_INVALID_TOKEN) }),
72
+ 403: loose_object({ error: literal(ERROR_ALREADY_BOOTSTRAPPED) }),
73
+ 404: loose_object({ error: literal(ERROR_TOKEN_FILE_MISSING) })
55
74
  }
56
75
  };
@@ -25,7 +25,7 @@ export declare const ERROR_CELL_GRANT_NOT_FOUND: "cell_grant_not_found";
25
25
  export declare const ERROR_CELL_GRANT_PRINCIPAL_IS_OWNER: "cell_grant_principal_is_owner";
26
26
  /**
27
27
  * Error reason — role-shaped principal references a role string not
28
- * registered in the role schema. Would produce a dead grant row that
28
+ * registered in the role registry. Would produce a dead grant row that
29
29
  * no role_grant could match.
30
30
  */
31
31
  export declare const ERROR_CELL_GRANT_UNKNOWN_ROLE: "cell_grant_unknown_role";
@@ -28,7 +28,7 @@ export const ERROR_CELL_GRANT_NOT_FOUND = 'cell_grant_not_found';
28
28
  export const ERROR_CELL_GRANT_PRINCIPAL_IS_OWNER = 'cell_grant_principal_is_owner';
29
29
  /**
30
30
  * Error reason — role-shaped principal references a role string not
31
- * registered in the role schema. Would produce a dead grant row that
31
+ * registered in the role registry. Would produce a dead grant row that
32
32
  * no role_grant could match.
33
33
  */
34
34
  export const ERROR_CELL_GRANT_UNKNOWN_ROLE = 'cell_grant_unknown_role';