@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
@@ -15,8 +15,8 @@
15
15
  * `(scope_kind=NULL, scope_id=NULL)`.
16
16
  *
17
17
  * Open registry, no builtins. Consumers declare their kinds via
18
- * `create_scope_kind_schema(consumer_kinds)` and pass the result to
19
- * `create_role_schema` so `RoleSpec.applicable_scope_kinds` can be
18
+ * `create_scope_kind_registry(consumer_kinds)` and pass the result to
19
+ * `create_role_registry` so `RoleSpec.applicable_scope_kinds` can be
20
20
  * validated at construction time. Mirrors the open-string registry
21
21
  * pattern used for `RoleName`, `AuditEventTypeName`, and `CredentialTypeName`.
22
22
  *
@@ -31,33 +31,34 @@
31
31
  *
32
32
  * @module
33
33
  */
34
- import { z } from 'zod';
34
+ import { format_issue, parse } from '@fuzdev/fuz_schema/schema.ts';
35
35
  import { create_name_schema, format_name_length_message, format_name_pattern_message } from './name_schema.js';
36
- /** The message of a scope-kind name longer than `NAME_LENGTH_MAX`, in both `ScopeKindName`s. */
36
+ /** The message of a scope-kind name longer than `NAME_LENGTH_MAX`. */
37
37
  export const SCOPE_KIND_NAME_LENGTH_MESSAGE = format_name_length_message('Scope-kind');
38
- /** The message of a scope-kind name off `NAME_REGEX`, in both `ScopeKindName`s. */
38
+ /** The message of a scope-kind name off `NAME_REGEX`. */
39
39
  export const SCOPE_KIND_NAME_PATTERN_MESSAGE = format_name_pattern_message('Scope-kind');
40
40
  /**
41
- * Zod schema for valid scope-kind name strings: a registered name, and the
41
+ * Valid scope-kind name strings: a registered name, and the
42
42
  * `scope_kind` the grant inputs take. The shared name grammar
43
43
  * (`auth/name_schema.ts`), at most `NAME_LENGTH_MAX` UTF-16 code units, which
44
44
  * bounds a registered name and the tag where it enters — the grant inputs
45
45
  * (`role_grant_offer_create`, `role_grant_assign`) copy it into the row and
46
46
  * its audit metadata — so no registry declares a kind the grant inputs would
47
- * refuse. Off the grammar is the index-side `'GLOBAL'` token. Twin of the Rust
48
- * spine's `is_valid_name`, and of the `@fuzdev/fuz_schema` `ScopeKindName` in
49
- * `auth/scope_kind_schema_fuz.ts`, built from the same constants.
47
+ * refuse. Off the grammar is the index-side `'GLOBAL'` token. A string it
48
+ * refuses gets `SCOPE_KIND_NAME_LENGTH_MESSAGE` or
49
+ * `SCOPE_KIND_NAME_PATTERN_MESSAGE`; a value that is no string, fuz_schema's
50
+ * message. Twin of the Rust spine's `is_valid_name`.
50
51
  */
51
52
  export const ScopeKindName = create_name_schema('Scope-kind');
52
53
  /**
53
- * Create a scope-kind schema from a consumer-declared registry.
54
+ * Create a scope-kind registry from the consumer-declared set.
54
55
  *
55
56
  * Open registry — no builtins. The `'GLOBAL'` token used inside the
56
57
  * partial unique indexes on `role_grant` and `role_grant_offer` is not a
57
58
  * registry entry (it's an index expression only), and no consumer can
58
59
  * declare it because the regex rejects uppercase.
59
60
  *
60
- * Call once at server init. Pass the result into `create_role_schema`'s
61
+ * Call once at server init. Pass the result into `create_role_registry`'s
61
62
  * optional `scope_kinds` parameter so each role's
62
63
  * `applicable_scope_kinds` entries are validated against this set at
63
64
  * construction time. v1 keeps `applicable_scope_kinds` informative-only
@@ -66,35 +67,34 @@ export const ScopeKindName = create_name_schema('Scope-kind');
66
67
  * consumer usage.
67
68
  *
68
69
  * @param consumer_kinds - the consumer-declared scope-kind set with optional metadata
69
- * @returns `{ScopeKind, scope_kinds}` — Zod schema and metadata map
70
+ * @returns `{scope_kinds}` — the metadata map
70
71
  *
71
72
  * @throws Error if any `consumer_kinds` key fails `ScopeKindName` (its grammar or its length cap) or appears more than once
72
73
  *
73
74
  * @example
74
75
  * ```ts
75
76
  * // visiones
76
- * const {ScopeKind, scope_kinds} = create_scope_kind_schema({
77
+ * const {scope_kinds} = create_scope_kind_registry({
77
78
  * classroom: {description: 'A classroom — teacher and student role_grants scope here.'},
78
79
  * });
79
80
  * ```
80
81
  */
81
- export const create_scope_kind_schema = (consumer_kinds) => {
82
+ export const create_scope_kind_registry = (consumer_kinds) => {
82
83
  const names = Object.keys(consumer_kinds);
83
84
  const seen = new Set();
84
85
  for (const name of names) {
85
- const parsed = ScopeKindName.safeParse(name);
86
- if (!parsed.success) {
87
- throw new Error(`Invalid scope-kind name "${name}": ${parsed.error.issues[0].message}`);
86
+ const parsed = parse(ScopeKindName, name);
87
+ if (!parsed.ok) {
88
+ throw new Error(`Invalid scope-kind name "${name}": ${format_issue(parsed.issues[0])}`);
88
89
  }
89
90
  if (seen.has(name)) {
90
91
  throw new Error(`Duplicate scope-kind name "${name}"`);
91
92
  }
92
93
  seen.add(name);
93
94
  }
94
- const ScopeKind = names.length === 0 ? z.never() : z.enum(names);
95
95
  const scope_kinds = new Map();
96
96
  for (const name of names) {
97
97
  scope_kinds.set(name, consumer_kinds[name]);
98
98
  }
99
- return { ScopeKind, scope_kinds };
99
+ return { scope_kinds };
100
100
  };
@@ -10,7 +10,7 @@
10
10
  import { meta } from '@fuzdev/fuz_schema/meta.ts';
11
11
  import { boolean, literal, object } from '@fuzdev/fuz_schema/schema.ts';
12
12
  import { ActingActor } from '../primitive_schemas_fuz.js';
13
- import { RoleName } from './role_schema_fuz.js';
13
+ import { RoleName } from './role_schema.js';
14
14
  /** Error reason — caller asked to self-toggle a role outside the configured allowlist. */
15
15
  export const ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE = 'role_not_self_service_eligible';
16
16
  /** Input for `self_service_role_set`, a `@fuzdev/fuz_schema` schema. */
@@ -37,7 +37,7 @@
37
37
  * @module
38
38
  */
39
39
  import { type RpcAction } from '../actions/action_types.js';
40
- import { type RoleSchemaResult } from './role_schema.js';
40
+ import { type RoleRegistry } from './role_schema.js';
41
41
  import type { RevokingActionFactoryDeps } from './deps.js';
42
42
  /**
43
43
  * Validate a deployment's self-service eligible-role set at construction.
@@ -45,7 +45,7 @@ import type { RevokingActionFactoryDeps } from './deps.js';
45
45
  * Refuses a builtin role (`admin` / `keeper`) — self-toggling one would hand
46
46
  * any account instance-wide authority, so no eligible set may name it — and a
47
47
  * name outside the `RoleName` grammar. The same fail-loud-at-boot shape as
48
- * `create_role_schema`, which refuses a builtin name where only app roles
48
+ * `create_role_registry`, which refuses a builtin name where only app roles
49
49
  * belong. Twin of the Rust `validate_self_service_eligible_roles`.
50
50
  *
51
51
  * @param roles - the eligible role names
@@ -57,7 +57,7 @@ export interface SelfServiceRoleActionsOptions {
57
57
  /**
58
58
  * Optional override allowlist of role strings eligible for
59
59
  * self-service. When omitted, eligibility is derived from
60
- * `roles.role_specs` (or `builtin_role_specs_by_name` when `roles`
60
+ * `roles.role_specs` (or `builtin_role_specs` when `roles`
61
61
  * is also omitted) by selecting every role whose
62
62
  * `RoleSpec.grant_paths` includes `'self_service'`. Pass an empty
63
63
  * array to lock the surface down (every call comes back as
@@ -68,11 +68,11 @@ export interface SelfServiceRoleActionsOptions {
68
68
  */
69
69
  eligible_roles?: ReadonlyArray<string>;
70
70
  /**
71
- * Optional role schema. Drives default eligibility derivation from
71
+ * Optional role registry. Drives default eligibility derivation from
72
72
  * `RoleSpec.grant_paths` and validates the `eligible_roles` override
73
73
  * (when supplied) against the registered role set.
74
74
  */
75
- roles?: RoleSchemaResult;
75
+ roles?: RoleRegistry;
76
76
  }
77
77
  /**
78
78
  * Build the unified self-service role toggle RPC action.
@@ -81,7 +81,7 @@ export interface SelfServiceRoleActionsOptions {
81
81
  * `connection_closer`); `audit.emit` writes a success row in the request
82
82
  * transaction and a failure row via the captured pool, and a disable closes the caller's connections gated on the role
83
83
  * through `connection_closer`.
84
- * @param options - optional eligible-role override plus optional role schema for default-eligibility derivation
84
+ * @param options - optional eligible-role override plus optional role registry for default-eligibility derivation
85
85
  * @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
86
86
  * @throws Error at factory time if any `eligible_roles` entry is missing from `options.roles.role_specs`
87
87
  * @throws Error at factory time if the eligible set names a builtin role or an invalid role name
@@ -1 +1 @@
1
- {"version":3,"file":"self_service_role_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGjG,OAAO,EAKN,KAAK,gBAAgB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAW3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oCAAoC,GAAI,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAG,IAW9E,CAAC;AAEF,sDAAsD;AACtD,MAAM,WAAW,6BAA6B;IAC7C;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,yBAAyB,EAC/B,UAAS,6BAAkC,KACzC,KAAK,CAAC,SAAS,CA0JjB,CAAC"}
1
+ {"version":3,"file":"self_service_role_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/self_service_role_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAIH,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGjG,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAW3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oCAAoC,GAAI,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAG,IAW9E,CAAC;AAEF,sDAAsD;AACtD,MAAM,WAAW,6BAA6B;IAC7C;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,yBAAyB,EAC/B,UAAS,6BAAkC,KACzC,KAAK,CAAC,SAAS,CA0JjB,CAAC"}
@@ -36,10 +36,11 @@
36
36
  *
37
37
  * @module
38
38
  */
39
+ import { is } from '@fuzdev/fuz_schema/schema.ts';
39
40
  import { rpc_action } from '../actions/action_types.js';
40
41
  import { queue_connection_close } from '../actions/connection_closer.js';
41
42
  import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
42
- import { builtin_role_specs_by_name, is_builtin_role, list_roles_with_grant_path, RoleName } from './role_schema.js';
43
+ import { builtin_role_specs, is_builtin_role, list_roles_with_grant_path, RoleName } from './role_schema.js';
43
44
  import { GRANT_PATH_SELF_SERVICE } from './grant_path_schema.js';
44
45
  import { query_create_role_grant, query_revoke_role_grant } from './role_grant_queries.js';
45
46
  import { is_role_grant_active } from './account_schema.js';
@@ -51,7 +52,7 @@ import { ERROR_ROLE_NOT_SELF_SERVICE_ELIGIBLE, self_service_role_set_action_spec
51
52
  * Refuses a builtin role (`admin` / `keeper`) — self-toggling one would hand
52
53
  * any account instance-wide authority, so no eligible set may name it — and a
53
54
  * name outside the `RoleName` grammar. The same fail-loud-at-boot shape as
54
- * `create_role_schema`, which refuses a builtin name where only app roles
55
+ * `create_role_registry`, which refuses a builtin name where only app roles
55
56
  * belong. Twin of the Rust `validate_self_service_eligible_roles`.
56
57
  *
57
58
  * @param roles - the eligible role names
@@ -62,7 +63,7 @@ export const validate_self_service_eligible_roles = (roles) => {
62
63
  if (is_builtin_role(role)) {
63
64
  throw new Error(`self-service eligible role "${role}" is a builtin role — builtin roles are never self-service`);
64
65
  }
65
- if (!RoleName.safeParse(role).success) {
66
+ if (!is(RoleName, role)) {
66
67
  throw new Error(`self-service eligible role "${role}" is not a valid role name`);
67
68
  }
68
69
  }
@@ -74,13 +75,13 @@ export const validate_self_service_eligible_roles = (roles) => {
74
75
  * `connection_closer`); `audit.emit` writes a success row in the request
75
76
  * transaction and a failure row via the captured pool, and a disable closes the caller's connections gated on the role
76
77
  * through `connection_closer`.
77
- * @param options - optional eligible-role override plus optional role schema for default-eligibility derivation
78
+ * @param options - optional eligible-role override plus optional role registry for default-eligibility derivation
78
79
  * @returns the `RpcAction` array to spread into a `create_rpc_endpoint` call
79
80
  * @throws Error at factory time if any `eligible_roles` entry is missing from `options.roles.role_specs`
80
81
  * @throws Error at factory time if the eligible set names a builtin role or an invalid role name
81
82
  */
82
83
  export const create_self_service_role_actions = (deps, options = {}) => {
83
- const role_specs = options.roles?.role_specs ?? builtin_role_specs_by_name;
84
+ const role_specs = options.roles?.role_specs ?? builtin_role_specs;
84
85
  const eligible = options.eligible_roles
85
86
  ? new Set(options.eligible_roles)
86
87
  : new Set(list_roles_with_grant_path(role_specs, GRANT_PATH_SELF_SERVICE));
@@ -88,7 +89,7 @@ export const create_self_service_role_actions = (deps, options = {}) => {
88
89
  if (options.eligible_roles && options.roles) {
89
90
  for (const r of eligible) {
90
91
  if (!role_specs.has(r)) {
91
- throw new Error(`create_self_service_role_actions: eligible_roles entry "${r}" is not registered in roles.role_specs — typo or missing call to create_role_schema`);
92
+ throw new Error(`create_self_service_role_actions: eligible_roles entry "${r}" is not registered in roles.role_specs — typo or missing call to create_role_registry`);
92
93
  }
93
94
  }
94
95
  }
@@ -11,33 +11,83 @@
11
11
  *
12
12
  * @module
13
13
  */
14
- import { z } from 'zod';
14
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
15
15
  import type { RouteSpec } from '../http/route_spec.js';
16
- /** Input for `POST /signup`. `email` is optional (absent or `null` = no email) and must match any referenced invite. */
17
- export declare const SignupInput: z.ZodObject<{
18
- username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
19
- password: z.ZodString;
20
- email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
- }, z.core.$strict>;
22
- export type SignupInput = z.infer<typeof SignupInput>;
23
16
  /**
24
- * Output for `POST /signup`.
17
+ * Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
18
+ * (absent or `null` = no email) and must match any referenced invite.
19
+ */
20
+ export declare const SignupInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
21
+ username: string;
22
+ password: string;
23
+ email?: string | null | undefined;
24
+ }, {
25
+ username: string;
26
+ password: string;
27
+ email?: string | null | undefined;
28
+ }, "object", {
29
+ 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>>>;
30
+ password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
31
+ email: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null | undefined, string | null | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>>>;
32
+ }>;
33
+ export type SignupInput = Infer<typeof SignupInput>;
34
+ /**
35
+ * Output for `POST /signup`, a `@fuzdev/fuz_schema` schema.
25
36
  *
26
37
  * Session cookie is the operative side effect. The returned `account` and
27
38
  * `actor` mirror `BootstrapOutput` so cross-process per-test setup can read
28
- * the per-test identity straight off the signup response.
39
+ * the per-test identity straight off the signup response. Its `username` is
40
+ * the account row's, `UsernameCanonical`.
29
41
  */
30
- export declare const SignupOutput: z.ZodObject<{
31
- ok: z.ZodLiteral<true>;
32
- account: z.ZodObject<{
33
- 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>>;
34
- username: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
35
- }, z.core.$strict>;
36
- actor: z.ZodObject<{
37
- 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>>;
38
- }, z.core.$strict>;
39
- }, z.core.$strict>;
40
- export type SignupOutput = z.infer<typeof SignupOutput>;
42
+ export declare const SignupOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
43
+ account: {
44
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
45
+ username: string;
46
+ };
47
+ actor: {
48
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
49
+ };
50
+ ok: true;
51
+ }, {
52
+ account: {
53
+ id: string;
54
+ username: string;
55
+ };
56
+ actor: {
57
+ id: string;
58
+ };
59
+ ok: true;
60
+ }, "object", {
61
+ ok: import("@fuzdev/fuz_schema/schema.ts").Schema<true, true, "literal", true>;
62
+ account: import("@fuzdev/fuz_schema/schema.ts").Schema<{
63
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
64
+ username: string;
65
+ }, {
66
+ id: string;
67
+ username: string;
68
+ }, "object", {
69
+ 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">)[]> & {
70
+ readonly '~types'?: {
71
+ readonly input: string;
72
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
73
+ } | undefined;
74
+ };
75
+ 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>>>;
76
+ }>;
77
+ actor: import("@fuzdev/fuz_schema/schema.ts").Schema<{
78
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
79
+ }, {
80
+ id: string;
81
+ }, "object", {
82
+ 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">)[]> & {
83
+ readonly '~types'?: {
84
+ readonly input: string;
85
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
86
+ } | undefined;
87
+ };
88
+ }>;
89
+ }>;
90
+ export type SignupOutput = Infer<typeof SignupOutput>;
41
91
  /** Option inputs that shape the signup route metadata (not its handler). */
42
92
  export interface SignupRouteShapeOptions {
43
93
  /** Whether a per-account signup rate limiter is wired — toggles `rate_limit`. */
@@ -1 +1 @@
1
- {"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQvD,wHAAwH;AACxH,eAAO,MAAM,WAAW;;;;kBAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;;kBAIvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACvC,iFAAiF;IACjF,2BAA2B,EAAE,OAAO,CAAC;CACrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,KAC9B,IAAI,CAAC,SAAS,EAAE,SAAS,CAiB1B,CAAC"}
1
+ {"version":3,"file":"signup_route_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/signup_route_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAON,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAKtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQvD;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;EAItB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEtD,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACvC,iFAAiF;IACjF,2BAA2B,EAAE,OAAO,CAAC;CACrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACrC,SAAS,uBAAuB,KAC9B,IAAI,CAAC,SAAS,EAAE,SAAS,CAe1B,CAAC"}
@@ -11,27 +11,31 @@
11
11
  *
12
12
  * @module
13
13
  */
14
- import { z } from 'zod';
15
- import { Uuid, Username, Email } from '../primitive_schemas.js';
14
+ import { literal, loose_object, nullable, object, one_of, optional } from '@fuzdev/fuz_schema/schema.ts';
15
+ import { Email, Username, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
16
16
  import { Password } from './password.js';
17
17
  import { ERROR_NO_MATCHING_INVITE, ERROR_SIGNUP_CONFLICT, ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY } from '../http/error_schemas.js';
18
- /** Input for `POST /signup`. `email` is optional (absent or `null` = no email) and must match any referenced invite. */
19
- export const SignupInput = z.strictObject({
18
+ /**
19
+ * Input for `POST /signup`, a `@fuzdev/fuz_schema` schema. `email` is optional
20
+ * (absent or `null` = no email) and must match any referenced invite.
21
+ */
22
+ export const SignupInput = object({
20
23
  username: Username,
21
24
  password: Password,
22
- email: Email.nullish()
25
+ email: optional(nullable(Email))
23
26
  });
24
27
  /**
25
- * Output for `POST /signup`.
28
+ * Output for `POST /signup`, a `@fuzdev/fuz_schema` schema.
26
29
  *
27
30
  * Session cookie is the operative side effect. The returned `account` and
28
31
  * `actor` mirror `BootstrapOutput` so cross-process per-test setup can read
29
- * the per-test identity straight off the signup response.
32
+ * the per-test identity straight off the signup response. Its `username` is
33
+ * the account row's, `UsernameCanonical`.
30
34
  */
31
- export const SignupOutput = z.strictObject({
32
- ok: z.literal(true),
33
- account: z.strictObject({ id: Uuid, username: Username }),
34
- actor: z.strictObject({ id: Uuid })
35
+ export const SignupOutput = object({
36
+ ok: literal(true),
37
+ account: object({ id: Uuid, username: UsernameCanonical }),
38
+ actor: object({ id: Uuid })
35
39
  });
36
40
  /**
37
41
  * The `POST /signup` route shape minus its handler — pure hono-free data.
@@ -50,10 +54,8 @@ export const create_signup_route_shape = (options) => ({
50
54
  output: SignupOutput,
51
55
  rate_limit: options.signup_account_rate_limited ? 'both' : 'ip',
52
56
  errors: {
53
- 400: z.looseObject({
54
- error: z.enum([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY])
55
- }),
56
- 403: z.looseObject({ error: z.literal(ERROR_NO_MATCHING_INVITE) }),
57
- 409: z.looseObject({ error: z.literal(ERROR_SIGNUP_CONFLICT) })
57
+ 400: loose_object({ error: one_of([ERROR_INVALID_JSON_BODY, ERROR_INVALID_REQUEST_BODY]) }),
58
+ 403: loose_object({ error: literal(ERROR_NO_MATCHING_INVITE) }),
59
+ 409: loose_object({ error: literal(ERROR_SIGNUP_CONFLICT) })
58
60
  }
59
61
  });
@@ -56,7 +56,7 @@ export interface StandardRpcActionsDeps extends RevokingActionFactoryDeps {
56
56
  * option flows to admin + role-grant-offer.
57
57
  *
58
58
  * @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
59
- * @param options - role schema, role-grant-offer config, account config
59
+ * @param options - role registry, role-grant-offer config, account config
60
60
  * @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
61
61
  */
62
62
  export declare const create_standard_rpc_actions: (deps: StandardRpcActionsDeps, options?: StandardRpcActionsOptions) => Array<RpcAction>;
@@ -31,7 +31,7 @@ import { create_account_actions } from './account_actions.js';
31
31
  * option flows to admin + role-grant-offer.
32
32
  *
33
33
  * @param deps - `StandardRpcActionsDeps` (`log`, `audit`, `connection_closer` from `RevokingActionFactoryDeps`; optional `notification_sender` for WS fan-out)
34
- * @param options - role schema, role-grant-offer config, account config
34
+ * @param options - role registry, role-grant-offer config, account config
35
35
  * @returns RPC actions to pass as `rpc_endpoints` or spread into `create_rpc_endpoint`
36
36
  */
37
37
  export const create_standard_rpc_actions = (deps, options = {}) => [
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @module
21
21
  */
22
- import { z } from 'zod';
22
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
23
23
  /**
24
24
  * Upper bound on `ttl.days` — a sanity cap (100 years), not a policy ceiling.
25
25
  * Shared with the Rust twin so out-of-range requests 400 identically on both
@@ -27,19 +27,43 @@ import { z } from 'zod';
27
27
  */
28
28
  export declare const TOKEN_TTL_DAYS_MAX = 36500;
29
29
  /**
30
- * Caller-provided lifetime for `account_token_create`.
30
+ * Caller-provided lifetime for `account_token_create`, a `@fuzdev/fuz_schema`
31
+ * schema.
31
32
  *
32
33
  * `eternal` mints a never-expiring token (`expires_at` NULL); `ttl` bounds it
33
34
  * to `days` from mint time. `eternal` is deliberately the first variant so
34
35
  * schema-driven test generators produce it by default.
35
36
  */
36
- export declare const TokenLifetimeInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
37
- kind: z.ZodLiteral<"eternal">;
38
- }, z.core.$strict>, z.ZodObject<{
39
- kind: z.ZodLiteral<"ttl">;
40
- days: z.ZodNumber;
41
- }, z.core.$strict>], "kind">;
42
- export type TokenLifetimeInput = z.infer<typeof TokenLifetimeInput>;
37
+ export declare const TokenLifetimeInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
38
+ kind: "eternal";
39
+ } | {
40
+ kind: "ttl";
41
+ days: number;
42
+ }, {
43
+ kind: "eternal";
44
+ } | {
45
+ kind: "ttl";
46
+ days: number;
47
+ }, "variant", {
48
+ readonly key: "kind";
49
+ readonly options: readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<{
50
+ kind: "eternal";
51
+ }, {
52
+ kind: "eternal";
53
+ }, "object", {
54
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"eternal", "eternal", "literal", "eternal">;
55
+ }>, import("@fuzdev/fuz_schema/schema.ts").Schema<{
56
+ kind: "ttl";
57
+ days: number;
58
+ }, {
59
+ kind: "ttl";
60
+ days: number;
61
+ }, "object", {
62
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<"ttl", "ttl", "literal", "ttl">;
63
+ days: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>;
64
+ }>];
65
+ }>;
66
+ export type TokenLifetimeInput = Infer<typeof TokenLifetimeInput>;
43
67
  /**
44
68
  * Resolve a lifetime input to the `expires_at` value the mint query stores.
45
69
  *
@@ -1 +1 @@
1
- {"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_lifetime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;4BAM7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAU,kBAAkB,EAC5B,MAAK,IAAiB,KACpB,IAAI,GAAG,IAGT,CAAC"}
1
+ {"version":3,"file":"token_lifetime.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_lifetime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAU,kBAAkB,EAC5B,MAAK,IAAiB,KACpB,IAAI,GAAG,IAGT,CAAC"}
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * @module
21
21
  */
22
- import { z } from 'zod';
22
+ import { integer, literal, max_value, min_value, number, object, pipe, variant } from '@fuzdev/fuz_schema/schema.ts';
23
23
  /**
24
24
  * Upper bound on `ttl.days` — a sanity cap (100 years), not a policy ceiling.
25
25
  * Shared with the Rust twin so out-of-range requests 400 identically on both
@@ -27,17 +27,18 @@ import { z } from 'zod';
27
27
  */
28
28
  export const TOKEN_TTL_DAYS_MAX = 36_500;
29
29
  /**
30
- * Caller-provided lifetime for `account_token_create`.
30
+ * Caller-provided lifetime for `account_token_create`, a `@fuzdev/fuz_schema`
31
+ * schema.
31
32
  *
32
33
  * `eternal` mints a never-expiring token (`expires_at` NULL); `ttl` bounds it
33
34
  * to `days` from mint time. `eternal` is deliberately the first variant so
34
35
  * schema-driven test generators produce it by default.
35
36
  */
36
- export const TokenLifetimeInput = z.discriminatedUnion('kind', [
37
- z.strictObject({ kind: z.literal('eternal') }),
38
- z.strictObject({
39
- kind: z.literal('ttl'),
40
- days: z.number().int().min(1).max(TOKEN_TTL_DAYS_MAX)
37
+ export const TokenLifetimeInput = variant('kind', [
38
+ object({ kind: literal('eternal') }),
39
+ object({
40
+ kind: literal('ttl'),
41
+ days: pipe(number, integer, min_value(1), max_value(TOKEN_TTL_DAYS_MAX))
41
42
  })
42
43
  ]);
43
44
  /**