@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
@@ -12,7 +12,7 @@
12
12
  * - `cell_grant_create` — admin / owner only. Refuses a cell whose
13
13
  * `moderation` doesn't admit an audience (403 `cell_grant_unapproved`,
14
14
  * after the manage gate). Validates role-shaped
15
- * principals against the role schema; rejects owner-as-principal.
15
+ * principals against the role registry; rejects owner-as-principal.
16
16
  * Actor-shaped principals carry a pre-resolved `actor_id` (callers pick
17
17
  * via `actor_search`). Idempotent — re-granting the same principal
18
18
  * updates `level` via UPSERT. A mounted `authorize_grant_create` is asked
@@ -38,7 +38,7 @@
38
38
  * @module
39
39
  */
40
40
  import { type ActionContext, type RpcAction } from '../actions/action_types.js';
41
- import type { RoleSchemaResult } from './role_schema.js';
41
+ import type { RoleRegistry } from './role_schema.js';
42
42
  import type { ActionFactoryDeps } from './deps.js';
43
43
  import type { RequestActorContext } from './request_context.js';
44
44
  import type { Uuid } from '../primitive_schemas.js';
@@ -128,7 +128,7 @@ export type CellGrantRevokeAuthorize = (auth: RequestActorContext, input: CellGr
128
128
  /**
129
129
  * Dependencies for `create_cell_grant_actions`.
130
130
  *
131
- * `roles` is the role schema — read for the role-validity gate on
131
+ * `roles` is the role registry — read for the role-validity gate on
132
132
  * `cell_grant_create`; `authorize_grant_create` is the optional consumer gate
133
133
  * (`CellGrantCreateAuthorize`) and `authorize_grant_revoke` the optional
134
134
  * steward widening of `cell_grant_revoke` (`CellGrantRevokeAuthorize`). The
@@ -136,7 +136,7 @@ export type CellGrantRevokeAuthorize = (auth: RequestActorContext, input: CellGr
136
136
  * fire-and-forget plumbing.
137
137
  */
138
138
  export type CellGrantActionDeps = ActionFactoryDeps & {
139
- roles: RoleSchemaResult;
139
+ roles: RoleRegistry;
140
140
  authorize_grant_create?: CellGrantCreateAuthorize;
141
141
  authorize_grant_revoke?: CellGrantRevokeAuthorize;
142
142
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cell_grant_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/cell_grant_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EASN,KAAK,oBAAoB,EAMzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAKN,KAAK,YAAY,EACjB,KAAK,4BAA4B,EACjC,MAAM,6BAA6B,CAAC;AAOrC;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC7C,gCAAgC;IACh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,EAAE,IAAI,CAAC;IACd,iDAAiD;IACjD,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,QAAQ,EAAE,IAAI,CAAC;IACf,mCAAmC;IACnC,KAAK,EAAE,cAAc,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACtC,IAAI,EAAE,mBAAmB,EACzB,KAAK,EAAE,6BAA6B,EACpC,GAAG,EAAE,aAAa,KACd,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG;IACrD,KAAK,EAAE,YAAY,CAAC;IACpB,sBAAsB,CAAC,EAAE,wBAAwB,CAAC;IAClD,sBAAsB,CAAC,EAAE,wBAAwB,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,YAAY,KAAG,SAShD,CAAC;AA4EH,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,GAAI,MAAM,mBAAmB,KAAG,KAAK,CAAC,SAAS,CAwJpF,CAAC"}
@@ -12,7 +12,7 @@
12
12
  * - `cell_grant_create` — admin / owner only. Refuses a cell whose
13
13
  * `moderation` doesn't admit an audience (403 `cell_grant_unapproved`,
14
14
  * after the manage gate). Validates role-shaped
15
- * principals against the role schema; rejects owner-as-principal.
15
+ * principals against the role registry; rejects owner-as-principal.
16
16
  * Actor-shaped principals carry a pre-resolved `actor_id` (callers pick
17
17
  * via `actor_search`). Idempotent — re-granting the same principal
18
18
  * updates `level` via UPSERT. A mounted `authorize_grant_create` is asked
@@ -15,19 +15,19 @@
15
15
  * `BuiltinCredentialType` is the closed set middleware sets on the Hono
16
16
  * context (`hono_context.ts`) and the audit log records — middleware only
17
17
  * ever authenticates through a builtin. Consumer-declared types live in
18
- * the registry `create_credential_type_schema` builds, consulted when
18
+ * the registry `create_credential_type_registry` builds, consulted when
19
19
  * validating `RoleSpec.required_credential_types`.
20
20
  *
21
21
  * @module
22
22
  */
23
- import { z } from 'zod';
23
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
24
24
  /**
25
- * Zod schema for valid credential-type name strings: the shared name grammar
25
+ * Valid credential-type name strings: the shared name grammar
26
26
  * (`auth/name_schema.ts`), runs of lowercase letters joined by single
27
27
  * underscores, at most `NAME_LENGTH_MAX` characters.
28
28
  */
29
- export declare const CredentialTypeName: z.ZodString;
30
- export type CredentialTypeName = z.infer<typeof CredentialTypeName>;
29
+ export declare const CredentialTypeName: 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
+ export type CredentialTypeName = Infer<typeof CredentialTypeName>;
31
31
  /** Cookie-based session credential. */
32
32
  export declare const CREDENTIAL_TYPE_SESSION = "session";
33
33
  /**
@@ -41,13 +41,8 @@ export declare const CREDENTIAL_TYPE_API_TOKEN = "api_token";
41
41
  export declare const CREDENTIAL_TYPE_DAEMON_TOKEN = "daemon_token";
42
42
  /** The builtin credential-type names as a const tuple. */
43
43
  export declare const BUILTIN_CREDENTIAL_TYPES: readonly ["session", "api_token", "daemon_token"];
44
- /** Zod enum for builtin credential types only. */
45
- export declare const BuiltinCredentialType: z.ZodEnum<{
46
- session: "session";
47
- api_token: "api_token";
48
- daemon_token: "daemon_token";
49
- }>;
50
- export type BuiltinCredentialType = z.infer<typeof BuiltinCredentialType>;
44
+ /** A builtin credential-type name, the closed set middleware authenticates through. */
45
+ export type BuiltinCredentialType = (typeof BUILTIN_CREDENTIAL_TYPES)[number];
51
46
  /**
52
47
  * Per-credential-type metadata. `description` is admin-UI-facing copy
53
48
  * (mirrors `RoleSpec.description` and `ScopeKindMeta.description`).
@@ -62,20 +57,12 @@ export interface CredentialTypeMeta {
62
57
  * Typed `ReadonlyMap` for the contract — but JS Maps don't honor
63
58
  * `Object.freeze` for `.set` / `.delete` / `.clear` (they mutate
64
59
  * internal slots, not own properties), so freeze adds no runtime guard
65
- * here. Read once at startup by `create_credential_type_schema`;
60
+ * here. Read once at startup by `create_credential_type_registry`;
66
61
  * runtime mutation has no effect on already-built schemas.
67
62
  */
68
63
  export declare const builtin_credential_type_meta: ReadonlyMap<string, CredentialTypeMeta>;
69
- /** The result of `create_credential_type_schema` — a Zod schema and metadata map. */
70
- export interface CredentialTypeSchemaResult {
71
- /**
72
- * Zod schema that validates credential-type name strings against the
73
- * registered set (builtins + consumer-declared). Use at I/O
74
- * boundaries (admin UIs, codegen) and as the construction-time check
75
- * inside `create_role_schema` for every
76
- * `RoleSpec.required_credential_types` entry.
77
- */
78
- CredentialType: z.ZodType<string>;
64
+ /** The result of `create_credential_type_registry` — the metadata map. */
65
+ export interface CredentialTypeRegistry {
79
66
  /**
80
67
  * Map of every registered credential-type to its metadata. Keyed by
81
68
  * name. Read at startup by admin / codegen surfaces.
@@ -83,31 +70,31 @@ export interface CredentialTypeSchemaResult {
83
70
  credential_types: ReadonlyMap<string, CredentialTypeMeta>;
84
71
  }
85
72
  /**
86
- * Create a credential-type schema from the builtin set plus optional
73
+ * Create a credential-type registry from the builtin set plus optional
87
74
  * consumer-declared additions.
88
75
  *
89
76
  * Builtins (`session`, `api_token`, `daemon_token`) are always present;
90
77
  * consumer entries that collide with a builtin name throw at
91
- * construction. Pass the result into `create_role_schema`'s optional
78
+ * construction. Pass the result into `create_role_registry`'s optional
92
79
  * `credential_types` parameter so each role's
93
80
  * `required_credential_types` entries are validated against this set
94
81
  * at construction time.
95
82
  *
96
83
  * @param consumer_types - optional consumer-declared credential-type set with optional metadata
97
- * @returns `{CredentialType, credential_types}` — Zod schema and metadata map
84
+ * @returns `{credential_types}` — the metadata map
98
85
  *
99
86
  * @throws Error if any `consumer_types` key fails `CredentialTypeName` (its grammar or its length cap), collides with a builtin name, or appears more than once
100
87
  *
101
88
  * @example
102
89
  * ```ts
103
90
  * // simple — builtins only
104
- * const {CredentialType, credential_types} = create_credential_type_schema();
91
+ * const {credential_types} = create_credential_type_registry();
105
92
  *
106
93
  * // with consumer extensions
107
- * const {CredentialType} = create_credential_type_schema({
94
+ * const {credential_types} = create_credential_type_registry({
108
95
  * sso_assertion: {description: 'OIDC SSO assertion bound to an IdP-asserted account.'},
109
96
  * });
110
97
  * ```
111
98
  */
112
- export declare const create_credential_type_schema: (consumer_types?: Record<string, CredentialTypeMeta>) => CredentialTypeSchemaResult;
99
+ export declare const create_credential_type_registry: (consumer_types?: Record<string, CredentialTypeMeta>) => CredentialTypeRegistry;
113
100
  //# sourceMappingURL=credential_type_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credential_type_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/credential_type_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,aAAwC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIpE,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD,yEAAyE;AACzE,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAE3D,0DAA0D;AAC1D,eAAO,MAAM,wBAAwB,mDAI3B,CAAC;AAEX,kDAAkD;AAClD,eAAO,MAAM,qBAAqB;;;;EAAmC,CAAC;AACtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAa/E,CAAC;AAEH,qFAAqF;AACrF,MAAM,WAAW,0BAA0B;IAC1C;;;;;;OAMG;IACH,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC;;;OAGG;IACH,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,6BAA6B,GACzC,iBAAgB,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAM,KACrD,0BA2BF,CAAC"}
1
+ {"version":3,"file":"credential_type_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/credential_type_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAuB,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAI/E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,0MAAwC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIlE,uCAAuC;AACvC,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAC;AAErD,yEAAyE;AACzE,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAE3D,0DAA0D;AAC1D,eAAO,MAAM,wBAAwB,mDAI3B,CAAC;AAEX,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAa/E,CAAC;AAEH,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACtC;;;OAGG;IACH,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,+BAA+B,GAC3C,iBAAgB,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAM,KACrD,sBAwBF,CAAC"}
@@ -15,15 +15,15 @@
15
15
  * `BuiltinCredentialType` is the closed set middleware sets on the Hono
16
16
  * context (`hono_context.ts`) and the audit log records — middleware only
17
17
  * ever authenticates through a builtin. Consumer-declared types live in
18
- * the registry `create_credential_type_schema` builds, consulted when
18
+ * the registry `create_credential_type_registry` builds, consulted when
19
19
  * validating `RoleSpec.required_credential_types`.
20
20
  *
21
21
  * @module
22
22
  */
23
- import { z } from 'zod';
23
+ import { format_issue, parse } from '@fuzdev/fuz_schema/schema.ts';
24
24
  import { create_name_schema } from './name_schema.js';
25
25
  /**
26
- * Zod schema for valid credential-type name strings: the shared name grammar
26
+ * Valid credential-type name strings: the shared name grammar
27
27
  * (`auth/name_schema.ts`), runs of lowercase letters joined by single
28
28
  * underscores, at most `NAME_LENGTH_MAX` characters.
29
29
  */
@@ -46,15 +46,13 @@ export const BUILTIN_CREDENTIAL_TYPES = [
46
46
  CREDENTIAL_TYPE_API_TOKEN,
47
47
  CREDENTIAL_TYPE_DAEMON_TOKEN
48
48
  ];
49
- /** Zod enum for builtin credential types only. */
50
- export const BuiltinCredentialType = z.enum(BUILTIN_CREDENTIAL_TYPES);
51
49
  /**
52
50
  * Builtin credential-type metadata. Not overridable by consumers.
53
51
  *
54
52
  * Typed `ReadonlyMap` for the contract — but JS Maps don't honor
55
53
  * `Object.freeze` for `.set` / `.delete` / `.clear` (they mutate
56
54
  * internal slots, not own properties), so freeze adds no runtime guard
57
- * here. Read once at startup by `create_credential_type_schema`;
55
+ * here. Read once at startup by `create_credential_type_registry`;
58
56
  * runtime mutation has no effect on already-built schemas.
59
57
  */
60
58
  export const builtin_credential_type_meta = new Map([
@@ -72,39 +70,39 @@ export const builtin_credential_type_meta = new Map([
72
70
  ]
73
71
  ]);
74
72
  /**
75
- * Create a credential-type schema from the builtin set plus optional
73
+ * Create a credential-type registry from the builtin set plus optional
76
74
  * consumer-declared additions.
77
75
  *
78
76
  * Builtins (`session`, `api_token`, `daemon_token`) are always present;
79
77
  * consumer entries that collide with a builtin name throw at
80
- * construction. Pass the result into `create_role_schema`'s optional
78
+ * construction. Pass the result into `create_role_registry`'s optional
81
79
  * `credential_types` parameter so each role's
82
80
  * `required_credential_types` entries are validated against this set
83
81
  * at construction time.
84
82
  *
85
83
  * @param consumer_types - optional consumer-declared credential-type set with optional metadata
86
- * @returns `{CredentialType, credential_types}` — Zod schema and metadata map
84
+ * @returns `{credential_types}` — the metadata map
87
85
  *
88
86
  * @throws Error if any `consumer_types` key fails `CredentialTypeName` (its grammar or its length cap), collides with a builtin name, or appears more than once
89
87
  *
90
88
  * @example
91
89
  * ```ts
92
90
  * // simple — builtins only
93
- * const {CredentialType, credential_types} = create_credential_type_schema();
91
+ * const {credential_types} = create_credential_type_registry();
94
92
  *
95
93
  * // with consumer extensions
96
- * const {CredentialType} = create_credential_type_schema({
94
+ * const {credential_types} = create_credential_type_registry({
97
95
  * sso_assertion: {description: 'OIDC SSO assertion bound to an IdP-asserted account.'},
98
96
  * });
99
97
  * ```
100
98
  */
101
- export const create_credential_type_schema = (consumer_types = {}) => {
99
+ export const create_credential_type_registry = (consumer_types = {}) => {
102
100
  const consumer_names = Object.keys(consumer_types);
103
101
  const seen = new Set();
104
102
  for (const name of consumer_names) {
105
- const parsed = CredentialTypeName.safeParse(name);
106
- if (!parsed.success) {
107
- throw new Error(`Invalid credential-type name "${name}": ${parsed.error.issues[0].message}`);
103
+ const parsed = parse(CredentialTypeName, name);
104
+ if (!parsed.ok) {
105
+ throw new Error(`Invalid credential-type name "${name}": ${format_issue(parsed.issues[0])}`);
108
106
  }
109
107
  if (builtin_credential_type_meta.has(name)) {
110
108
  throw new Error(`Consumer credential-type "${name}" collides with builtin credential-type`);
@@ -114,11 +112,9 @@ export const create_credential_type_schema = (consumer_types = {}) => {
114
112
  }
115
113
  seen.add(name);
116
114
  }
117
- const all_names = [...BUILTIN_CREDENTIAL_TYPES, ...consumer_names];
118
- const CredentialType = z.enum(all_names);
119
115
  const credential_types = new Map(builtin_credential_type_meta);
120
116
  for (const name of consumer_names) {
121
117
  credential_types.set(name, consumer_types[name]);
122
118
  }
123
- return { CredentialType, credential_types };
119
+ return { credential_types };
124
120
  };
@@ -24,14 +24,14 @@
24
24
  *
25
25
  * @module
26
26
  */
27
- import { z } from 'zod';
27
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
28
28
  /**
29
- * Zod schema for valid grant-path name strings: the shared name grammar
29
+ * Valid grant-path name strings: the shared name grammar
30
30
  * (`auth/name_schema.ts`), runs of lowercase letters joined by single
31
31
  * underscores, at most `NAME_LENGTH_MAX` characters.
32
32
  */
33
- export declare const GrantPathName: z.ZodString;
34
- export type GrantPathName = z.infer<typeof GrantPathName>;
33
+ export declare const GrantPathName: 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>>>;
34
+ export type GrantPathName = Infer<typeof GrantPathName>;
35
35
  /** Admin-mediated grant — `role_grant_offer_create` plus admin-direct flows. */
36
36
  export declare const GRANT_PATH_ADMIN = "admin";
37
37
  /** Self-service grant — caller toggles their own role_grant via `self_service_role_set`. */
@@ -42,14 +42,8 @@ export declare const GRANT_PATH_SYSTEM = "system";
42
42
  export declare const GRANT_PATH_BOOTSTRAP = "bootstrap";
43
43
  /** The builtin grant-path names as a const tuple. */
44
44
  export declare const BUILTIN_GRANT_PATHS: readonly ["admin", "self_service", "system", "bootstrap"];
45
- /** Zod enum for builtin grant paths only. */
46
- export declare const BuiltinGrantPath: z.ZodEnum<{
47
- admin: "admin";
48
- self_service: "self_service";
49
- system: "system";
50
- bootstrap: "bootstrap";
51
- }>;
52
- export type BuiltinGrantPath = z.infer<typeof BuiltinGrantPath>;
45
+ /** A builtin grant-path name. */
46
+ export type BuiltinGrantPath = (typeof BUILTIN_GRANT_PATHS)[number];
53
47
  /**
54
48
  * Per-grant-path metadata. `description` is admin-UI-facing copy
55
49
  * (mirrors `RoleSpec.description` and `ScopeKindMeta.description`).
@@ -64,20 +58,12 @@ export interface GrantPathMeta {
64
58
  * Typed `ReadonlyMap` for the contract — but JS Maps don't honor
65
59
  * `Object.freeze` for `.set` / `.delete` / `.clear` (they mutate
66
60
  * internal slots, not own properties), so freeze adds no runtime guard
67
- * here. Read once at startup by `create_grant_path_schema`; runtime
61
+ * here. Read once at startup by `create_grant_path_registry`; runtime
68
62
  * mutation has no effect on already-built schemas.
69
63
  */
70
64
  export declare const builtin_grant_path_meta: ReadonlyMap<string, GrantPathMeta>;
71
- /** The result of `create_grant_path_schema` — a Zod schema and metadata map. */
72
- export interface GrantPathSchemaResult {
73
- /**
74
- * Zod schema that validates grant-path name strings against the
75
- * registered set (builtins + consumer-declared). Use at I/O
76
- * boundaries (admin UIs, codegen) and as the construction-time check
77
- * inside `create_role_schema` for every `RoleSpec.grant_paths`
78
- * entry.
79
- */
80
- GrantPath: z.ZodType<string>;
65
+ /** The result of `create_grant_path_registry` — the metadata map. */
66
+ export interface GrantPathRegistry {
81
67
  /**
82
68
  * Map of every registered grant-path to its metadata. Keyed by
83
69
  * name. Read at startup by admin / codegen surfaces.
@@ -85,30 +71,30 @@ export interface GrantPathSchemaResult {
85
71
  grant_paths: ReadonlyMap<string, GrantPathMeta>;
86
72
  }
87
73
  /**
88
- * Create a grant-path schema from the builtin set plus optional
74
+ * Create a grant-path registry from the builtin set plus optional
89
75
  * consumer-declared additions.
90
76
  *
91
77
  * Builtins (`admin`, `self_service`, `system`, `bootstrap`) are always
92
78
  * present; consumer entries that collide with a builtin name throw at
93
- * construction. Pass the result into `create_role_schema`'s optional
79
+ * construction. Pass the result into `create_role_registry`'s optional
94
80
  * `grant_paths` parameter so each role's `grant_paths` entries are
95
81
  * validated against this set at construction time.
96
82
  *
97
83
  * @param consumer_paths - optional consumer-declared grant-path set with optional metadata
98
- * @returns `{GrantPath, grant_paths}` — Zod schema and metadata map
84
+ * @returns `{grant_paths}` — the metadata map
99
85
  *
100
86
  * @throws Error if any `consumer_paths` key fails `GrantPathName` (its grammar or its length cap), collides with a builtin name, or appears more than once
101
87
  *
102
88
  * @example
103
89
  * ```ts
104
90
  * // simple — builtins only
105
- * const {GrantPath, grant_paths} = create_grant_path_schema();
91
+ * const {grant_paths} = create_grant_path_registry();
106
92
  *
107
93
  * // with consumer extensions
108
- * const {GrantPath} = create_grant_path_schema({
94
+ * const {grant_paths} = create_grant_path_registry({
109
95
  * invite_only: {description: 'Granted by claiming a consumer-issued invite.'},
110
96
  * });
111
97
  * ```
112
98
  */
113
- export declare const create_grant_path_schema: (consumer_paths?: Record<string, GrantPathMeta>) => GrantPathSchemaResult;
99
+ export declare const create_grant_path_registry: (consumer_paths?: Record<string, GrantPathMeta>) => GrantPathRegistry;
114
100
  //# sourceMappingURL=grant_path_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grant_path_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/grant_path_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AACH,eAAO,MAAM,aAAa,aAAmC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAI1D,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,4FAA4F;AAC5F,eAAO,MAAM,uBAAuB,iBAAi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,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,2DAKtB,CAAC;AAEX,iCAAiC;AACjC,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAuBrE,CAAC;AAEH,qEAAqE;AACrE,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,0BAA0B,GACtC,iBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAM,KAChD,iBAwBF,CAAC"}
@@ -24,10 +24,10 @@
24
24
  *
25
25
  * @module
26
26
  */
27
- import { z } from 'zod';
27
+ import { format_issue, parse } from '@fuzdev/fuz_schema/schema.ts';
28
28
  import { create_name_schema } from './name_schema.js';
29
29
  /**
30
- * Zod schema for valid grant-path name strings: the shared name grammar
30
+ * Valid grant-path name strings: the shared name grammar
31
31
  * (`auth/name_schema.ts`), runs of lowercase letters joined by single
32
32
  * underscores, at most `NAME_LENGTH_MAX` characters.
33
33
  */
@@ -48,15 +48,13 @@ export const BUILTIN_GRANT_PATHS = [
48
48
  GRANT_PATH_SYSTEM,
49
49
  GRANT_PATH_BOOTSTRAP
50
50
  ];
51
- /** Zod enum for builtin grant paths only. */
52
- export const BuiltinGrantPath = z.enum(BUILTIN_GRANT_PATHS);
53
51
  /**
54
52
  * Builtin grant-path metadata. Not overridable by consumers.
55
53
  *
56
54
  * Typed `ReadonlyMap` for the contract — but JS Maps don't honor
57
55
  * `Object.freeze` for `.set` / `.delete` / `.clear` (they mutate
58
56
  * internal slots, not own properties), so freeze adds no runtime guard
59
- * here. Read once at startup by `create_grant_path_schema`; runtime
57
+ * here. Read once at startup by `create_grant_path_registry`; runtime
60
58
  * mutation has no effect on already-built schemas.
61
59
  */
62
60
  export const builtin_grant_path_meta = new Map([
@@ -82,38 +80,38 @@ export const builtin_grant_path_meta = new Map([
82
80
  ]
83
81
  ]);
84
82
  /**
85
- * Create a grant-path schema from the builtin set plus optional
83
+ * Create a grant-path registry from the builtin set plus optional
86
84
  * consumer-declared additions.
87
85
  *
88
86
  * Builtins (`admin`, `self_service`, `system`, `bootstrap`) are always
89
87
  * present; consumer entries that collide with a builtin name throw at
90
- * construction. Pass the result into `create_role_schema`'s optional
88
+ * construction. Pass the result into `create_role_registry`'s optional
91
89
  * `grant_paths` parameter so each role's `grant_paths` entries are
92
90
  * validated against this set at construction time.
93
91
  *
94
92
  * @param consumer_paths - optional consumer-declared grant-path set with optional metadata
95
- * @returns `{GrantPath, grant_paths}` — Zod schema and metadata map
93
+ * @returns `{grant_paths}` — the metadata map
96
94
  *
97
95
  * @throws Error if any `consumer_paths` key fails `GrantPathName` (its grammar or its length cap), collides with a builtin name, or appears more than once
98
96
  *
99
97
  * @example
100
98
  * ```ts
101
99
  * // simple — builtins only
102
- * const {GrantPath, grant_paths} = create_grant_path_schema();
100
+ * const {grant_paths} = create_grant_path_registry();
103
101
  *
104
102
  * // with consumer extensions
105
- * const {GrantPath} = create_grant_path_schema({
103
+ * const {grant_paths} = create_grant_path_registry({
106
104
  * invite_only: {description: 'Granted by claiming a consumer-issued invite.'},
107
105
  * });
108
106
  * ```
109
107
  */
110
- export const create_grant_path_schema = (consumer_paths = {}) => {
108
+ export const create_grant_path_registry = (consumer_paths = {}) => {
111
109
  const consumer_names = Object.keys(consumer_paths);
112
110
  const seen = new Set();
113
111
  for (const name of consumer_names) {
114
- const parsed = GrantPathName.safeParse(name);
115
- if (!parsed.success) {
116
- throw new Error(`Invalid grant-path name "${name}": ${parsed.error.issues[0].message}`);
112
+ const parsed = parse(GrantPathName, name);
113
+ if (!parsed.ok) {
114
+ throw new Error(`Invalid grant-path name "${name}": ${format_issue(parsed.issues[0])}`);
117
115
  }
118
116
  if (builtin_grant_path_meta.has(name)) {
119
117
  throw new Error(`Consumer grant-path "${name}" collides with builtin grant-path`);
@@ -123,11 +121,9 @@ export const create_grant_path_schema = (consumer_paths = {}) => {
123
121
  }
124
122
  seen.add(name);
125
123
  }
126
- const all_names = [...BUILTIN_GRANT_PATHS, ...consumer_names];
127
- const GrantPath = z.enum(all_names);
128
124
  const grant_paths = new Map(builtin_grant_path_meta);
129
125
  for (const name of consumer_names) {
130
126
  grant_paths.set(name, consumer_paths[name]);
131
127
  }
132
- return { GrantPath, grant_paths };
128
+ return { grant_paths };
133
129
  };
@@ -69,7 +69,7 @@ const AUTH_MIGRATION_NAMESPACE = 'fuz_auth';
69
69
  * partial unique index is scoped by
70
70
  * `(to_account, role, scope_kind, scope, from_actor)` so multiple
71
71
  * grantors may coexist. `scope_kind` is informative-only in v1
72
- * (registry-membership validation against `create_scope_kind_schema`);
72
+ * (registry-membership validation against `create_scope_kind_registry`);
73
73
  * v2 may add INSERT-time `(role, scope_kind)` enforcement.
74
74
  */
75
75
  const AUTH_MIGRATIONS = [
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @module
15
15
  */
16
- import type { z } from 'zod';
16
+ import { type PipeSchema, type string } from '@fuzdev/fuz_schema/schema.ts';
17
17
  /**
18
18
  * The longest name the grammar admits, in UTF-16 code units (what
19
19
  * `String.length` measures; for a name on `NAME_REGEX` they are its
@@ -51,13 +51,14 @@ export declare const format_name_length_message: (label: string) => string;
51
51
  */
52
52
  export declare const format_name_pattern_message: (label: string) => string;
53
53
  /**
54
- * A Zod schema for a name of one domain: `bounded_string` at
55
- * `NAME_LENGTH_MAX`, then `NAME_REGEX`, each with the domain's message. A
56
- * string both too long and off the grammar gets both issues, the length one
57
- * first.
54
+ * A `@fuzdev/fuz_schema` schema for a name of one domain: `bounded_string`
55
+ * at `NAME_LENGTH_MAX`, then `NAME_REGEX`, each with the domain's message. A
56
+ * string both too long and off the grammar gets the one length issue, as the
57
+ * `pipe` stops at its first failing step; a value that is no string gets
58
+ * fuz_schema's message. Its JSON Schema is `maxLength` and `pattern`.
58
59
  *
59
60
  * @param label - the domain's label, capitalized, e.g. `'Role'` or `'Scope-kind'`
60
61
  * @returns the name schema
61
62
  */
62
- export declare const create_name_schema: (label: string) => z.ZodString;
63
+ export declare const create_name_schema: (label: string) => PipeSchema<string, PipeSchema<string, typeof string>>;
63
64
  //# sourceMappingURL=name_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"name_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/name_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,QAAyB,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,OACW,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,MAAM,KAAG,MACI,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,MACuD,CAAC;AAEpH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,CAAC,CAAC,SAII,CAAC"}
1
+ {"version":3,"file":"name_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/name_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAwB,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAIlG;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,QAAyB,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,OACW,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,GAAI,OAAO,MAAM,KAAG,MACI,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,MACuD,CAAC;AAEpH;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC9B,OAAO,MAAM,KACX,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,MAAM,CAAC,CAIrD,CAAC"}
@@ -13,7 +13,8 @@
13
13
  *
14
14
  * @module
15
15
  */
16
- import { bounded_string } from '../primitive_schemas.js';
16
+ import { message, pipe, regex } from '@fuzdev/fuz_schema/schema.ts';
17
+ import { bounded_string } from '../primitive_schemas_fuz.js';
17
18
  /**
18
19
  * The longest name the grammar admits, in UTF-16 code units (what
19
20
  * `String.length` measures; for a name on `NAME_REGEX` they are its
@@ -51,15 +52,13 @@ export const format_name_length_message = (label) => `${label} names must be at
51
52
  */
52
53
  export const format_name_pattern_message = (label) => `${label} names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores`;
53
54
  /**
54
- * A Zod schema for a name of one domain: `bounded_string` at
55
- * `NAME_LENGTH_MAX`, then `NAME_REGEX`, each with the domain's message. A
56
- * string both too long and off the grammar gets both issues, the length one
57
- * first.
55
+ * A `@fuzdev/fuz_schema` schema for a name of one domain: `bounded_string`
56
+ * at `NAME_LENGTH_MAX`, then `NAME_REGEX`, each with the domain's message. A
57
+ * string both too long and off the grammar gets the one length issue, as the
58
+ * `pipe` stops at its first failing step; a value that is no string gets
59
+ * fuz_schema's message. Its JSON Schema is `maxLength` and `pattern`.
58
60
  *
59
61
  * @param label - the domain's label, capitalized, e.g. `'Role'` or `'Scope-kind'`
60
62
  * @returns the name schema
61
63
  */
62
- export const create_name_schema = (label) => bounded_string({
63
- max: NAME_LENGTH_MAX,
64
- max_message: format_name_length_message(label)
65
- }).regex(NAME_REGEX, format_name_pattern_message(label));
64
+ export const create_name_schema = (label) => pipe(bounded_string({ max: NAME_LENGTH_MAX, max_message: format_name_length_message(label) }), message(regex(NAME_REGEX), format_name_pattern_message(label)));
@@ -6,17 +6,25 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { z } from 'zod';
9
+ import type { Infer } from '@fuzdev/fuz_schema/schema.ts';
10
10
  /** Minimum password length, in UTF-16 code units (OWASP recommendation). */
11
11
  export declare const PASSWORD_LENGTH_MIN = 12;
12
12
  /** Maximum password length, in UTF-16 code units. Caps hashing cost to prevent DoS via oversized passwords. */
13
13
  export declare const PASSWORD_LENGTH_MAX = 300;
14
- /** Password for account creation or password change — enforces current length policy. Also usable for client-side UX validation. */
15
- export declare const Password: z.ZodString;
16
- export type Password = z.infer<typeof Password>;
17
- /** Password submitted for login or verification — minimal validation for forward-compatibility if length requirements change. */
18
- export declare const PasswordProvided: z.ZodString;
19
- export type PasswordProvided = z.infer<typeof PasswordProvided>;
14
+ /**
15
+ * Password for account creation or password change — enforces current length
16
+ * policy. Also usable for client-side UX validation. A `@fuzdev/fuz_schema`
17
+ * schema.
18
+ */
19
+ export declare const Password: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
20
+ export type Password = Infer<typeof Password>;
21
+ /**
22
+ * Password submitted for login or verification — minimal validation for
23
+ * forward-compatibility if length requirements change. A `@fuzdev/fuz_schema`
24
+ * schema.
25
+ */
26
+ export declare const PasswordProvided: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
27
+ export type PasswordProvided = Infer<typeof PasswordProvided>;
20
28
  /**
21
29
  * Injectable password hashing dependencies.
22
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"password.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/password.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,+GAA+G;AAC/G,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,oIAAoI;AACpI,eAAO,MAAM,QAAQ,aAGa,CAAC;AACnC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,iIAAiI;AACjI,eAAO,MAAM,gBAAgB,aAE3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD"}
1
+ {"version":3,"file":"password.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/password.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAI1D,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,+GAA+G;AAC/G,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,+IAKpB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,+IAE3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACrD"}
@@ -6,18 +6,25 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { z } from 'zod';
10
- import { bounded_string } from '../primitive_schemas.js';
9
+ import { meta } from '@fuzdev/fuz_schema/meta.ts';
10
+ import { bounded_string } from '../primitive_schemas_fuz.js';
11
11
  /** Minimum password length, in UTF-16 code units (OWASP recommendation). */
12
12
  export const PASSWORD_LENGTH_MIN = 12;
13
13
  /** Maximum password length, in UTF-16 code units. Caps hashing cost to prevent DoS via oversized passwords. */
14
14
  export const PASSWORD_LENGTH_MAX = 300;
15
- /** Password for account creation or password change — enforces current length policy. Also usable for client-side UX validation. */
16
- export const Password = bounded_string({
17
- min: PASSWORD_LENGTH_MIN,
18
- max: PASSWORD_LENGTH_MAX
19
- }).meta({ sensitivity: 'secret' });
20
- /** Password submitted for login or verification — minimal validation for forward-compatibility if length requirements change. */
21
- export const PasswordProvided = bounded_string({ min: 1, max: PASSWORD_LENGTH_MAX }).meta({
15
+ /**
16
+ * Password for account creation or password change — enforces current length
17
+ * policy. Also usable for client-side UX validation. A `@fuzdev/fuz_schema`
18
+ * schema.
19
+ */
20
+ export const Password = meta(bounded_string({ min: PASSWORD_LENGTH_MIN, max: PASSWORD_LENGTH_MAX }), {
21
+ sensitivity: 'secret'
22
+ });
23
+ /**
24
+ * Password submitted for login or verification — minimal validation for
25
+ * forward-compatibility if length requirements change. A `@fuzdev/fuz_schema`
26
+ * schema.
27
+ */
28
+ export const PasswordProvided = meta(bounded_string({ min: 1, max: PASSWORD_LENGTH_MAX }), {
22
29
  sensitivity: 'secret'
23
30
  });
@@ -26,8 +26,8 @@ import { array, check, integer, literal, max_value, message, min_value, nullable
26
26
  import { ActingActor, Uuid, bounded_string } from '../primitive_schemas_fuz.js';
27
27
  import { ERROR_INSUFFICIENT_PERMISSIONS, ERROR_LIMIT_INVALID, ERROR_OFFSET_INVALID, ERROR_ROLE_GRANT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
28
28
  import { NAME_LENGTH_MAX } from './name_schema.js';
29
- import { RoleName } from './role_schema_fuz.js';
30
- import { ScopeKindName } from './scope_kind_schema_fuz.js';
29
+ import { RoleName } from './role_schema.js';
30
+ import { ScopeKindName } from './scope_kind_schema.js';
31
31
  import { ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX, RoleGrantOfferJson } from './role_grant_offer_schema.js';
32
32
  import { ROLE_GRANT_REVOKED_REASON_LENGTH_MAX } from './account_schema.js';
33
33
  /** Error reason — caller tried to offer themselves a role_grant. */