@fuzdev/fuz_app 0.160.0 → 0.162.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.
- package/dist/auth/CLAUDE.md +31 -21
- package/dist/auth/account_action_specs.d.ts +173 -35
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +10 -7
- package/dist/auth/account_route_schema.d.ts +293 -46
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +5 -4
- package/dist/auth/account_schema.d.ts +489 -103
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +67 -47
- package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
- package/dist/auth/actor_search_action_specs.d.ts +6 -6
- package/dist/auth/admin_action_specs.d.ts +2748 -505
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +175 -187
- package/dist/auth/app_settings_schema.d.ts +46 -23
- package/dist/auth/app_settings_schema.d.ts.map +1 -1
- package/dist/auth/app_settings_schema.js +12 -15
- package/dist/auth/audit_emitter.d.ts +8 -3
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +32 -9
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +4 -3
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_schema.d.ts +791 -253
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +198 -198
- package/dist/auth/audit_log_schema_fuz.d.ts +53 -0
- package/dist/auth/audit_log_schema_fuz.d.ts.map +1 -0
- package/dist/auth/audit_log_schema_fuz.js +50 -0
- package/dist/auth/credential_type_schema.d.ts +5 -8
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +6 -10
- package/dist/auth/grant_path_schema.d.ts +4 -7
- package/dist/auth/grant_path_schema.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.js +6 -10
- package/dist/auth/invite_schema.d.ts +98 -26
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +21 -14
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +27 -0
- package/dist/auth/name_schema.d.ts +63 -0
- package/dist/auth/name_schema.d.ts.map +1 -0
- package/dist/auth/name_schema.js +65 -0
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +2 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts +192 -192
- package/dist/auth/role_grant_offer_action_specs.js +2 -2
- package/dist/auth/role_grant_offer_notifications.d.ts +126 -126
- package/dist/auth/role_grant_offer_schema.d.ts +12 -12
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +8 -8
- package/dist/auth/role_schema.d.ts +14 -25
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +15 -29
- package/dist/auth/role_schema_fuz.d.ts +4 -3
- package/dist/auth/role_schema_fuz.d.ts.map +1 -1
- package/dist/auth/role_schema_fuz.js +7 -5
- package/dist/auth/scope_kind_schema.d.ts +13 -26
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +15 -31
- package/dist/auth/scope_kind_schema_fuz.d.ts +4 -3
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema_fuz.js +7 -5
- package/dist/auth/self_service_role_action_specs.d.ts +2 -2
- package/dist/auth/token_scope.d.ts +7 -13
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +9 -14
- package/dist/dev/setup.d.ts +14 -7
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +11 -6
- package/dist/primitive_schemas.d.ts +47 -4
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +40 -19
- package/dist/primitive_schemas_fuz.d.ts +70 -8
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +62 -7
- package/dist/testing/CLAUDE.md +11 -6
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +6 -2
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +12 -13
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +24 -13
- package/dist/testing/cross_backend/role_grant_role_grammar.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_role_grammar.js +8 -15
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +4 -3
- package/dist/testing/db_entities.d.ts +3 -1
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +4 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +3 -2
- package/dist/zod.d.ts +2 -1
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +6 -2
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ export declare const SelfServiceRoleSetInput: import("@fuzdev/fuz_schema/schema.
|
|
|
23
23
|
}, "object", {
|
|
24
24
|
role: 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>>>;
|
|
25
25
|
enabled: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
26
|
-
acting: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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<"
|
|
26
|
+
acting: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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">)[]> & {
|
|
27
27
|
readonly '~types'?: {
|
|
28
28
|
readonly input: string;
|
|
29
29
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
@@ -85,7 +85,7 @@ export declare const self_service_role_set_action_spec: {
|
|
|
85
85
|
}, "object", {
|
|
86
86
|
role: 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>>>;
|
|
87
87
|
enabled: import("@fuzdev/fuz_schema/schema.ts").Schema<boolean, boolean, "boolean", undefined>;
|
|
88
|
-
acting: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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<"
|
|
88
|
+
acting: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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">)[]> & {
|
|
89
89
|
readonly '~types'?: {
|
|
90
90
|
readonly input: string;
|
|
91
91
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
@@ -149,17 +149,6 @@ export type TokenSurface = (typeof TOKEN_SURFACES)[number];
|
|
|
149
149
|
* mount.
|
|
150
150
|
*/
|
|
151
151
|
export declare const is_token_surface: (value: string) => value is TokenSurface;
|
|
152
|
-
/**
|
|
153
|
-
* Name format for the identifier half of a capability string: runs of
|
|
154
|
-
* lowercase letters (a-z) joined by single underscores, the grammar of
|
|
155
|
-
* `RoleName` / `CredentialTypeName` / `ScopeKindName` / `GrantPathName` too.
|
|
156
|
-
*
|
|
157
|
-
* Applied to the `surface:` arm only. The `rpc:` arm's identifier is an action
|
|
158
|
-
* method name, whose vocabulary belongs to `ActionSpec` (and includes shapes
|
|
159
|
-
* like `peer/ping` this regex would refuse); the dispatcher computes it from the
|
|
160
|
-
* registered method, so nothing parses one.
|
|
161
|
-
*/
|
|
162
|
-
export declare const TOKEN_SURFACE_NAME_REGEX: RegExp;
|
|
163
152
|
/**
|
|
164
153
|
* The capability string an action method is refused under: `rpc:<method>`.
|
|
165
154
|
*
|
|
@@ -179,8 +168,13 @@ export declare const token_scope_method_capability: (method: string) => string;
|
|
|
179
168
|
* Callers turn `false` into a registration-time throw: `RouteAuth.required_scope`
|
|
180
169
|
* is typed as a plain string so `http/` needs no `auth/` import, and this is the
|
|
181
170
|
* single point where that string becomes a mounted guard, so it is where the
|
|
182
|
-
* value gets checked. The identifier is checked for shape
|
|
183
|
-
*
|
|
171
|
+
* value gets checked. The identifier is checked for shape, not membership —
|
|
172
|
+
* a consumer names its own surface: the shared name grammar (`is_valid_name`),
|
|
173
|
+
* runs of lowercase letters joined by single underscores, at most
|
|
174
|
+
* `NAME_LENGTH_MAX` characters. The `rpc:` arm's identifier is an action method
|
|
175
|
+
* name, whose vocabulary belongs to `ActionSpec` (and includes shapes like
|
|
176
|
+
* `peer/ping` the grammar would refuse); the dispatcher computes it from the
|
|
177
|
+
* registered method, so nothing parses one.
|
|
184
178
|
*
|
|
185
179
|
* @param value - the declared capability string, e.g. `surface:audit_stream`
|
|
186
180
|
* @returns whether `value` is a well-formed `surface:<name>` capability
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_scope.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/token_scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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AAI,OAAO,MAAM,KAAG,KAAK,IAAI,YACA,CAAC;AAQ3D;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,MAAM,KAAG,MAC3B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,KAAG,OAEG,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,YAAY,MAAM,KAChB;IAAE,KAAK,EAAE,sBAAsB,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAGxD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,GAAI,OAAO,UAAU,KAAG,MAGrD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,UAAU,GAAG,IAU5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,UAAU,KAAG,MAQzD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,UAAU,GAAG,IAQtE,CAAC"}
|
package/dist/auth/token_scope.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
* @module
|
|
30
30
|
*/
|
|
31
31
|
import { z } from 'zod';
|
|
32
|
+
import { is_valid_name } from './name_schema.js';
|
|
32
33
|
/** Current `TokenScope` document version. Must match the Rust `TOKEN_SCOPE_VERSION`. */
|
|
33
34
|
export const TOKEN_SCOPE_VERSION = 1;
|
|
34
35
|
/**
|
|
@@ -161,17 +162,6 @@ export const TOKEN_SURFACES = [
|
|
|
161
162
|
* mount.
|
|
162
163
|
*/
|
|
163
164
|
export const is_token_surface = (value) => TOKEN_SURFACES.includes(value);
|
|
164
|
-
/**
|
|
165
|
-
* Name format for the identifier half of a capability string: runs of
|
|
166
|
-
* lowercase letters (a-z) joined by single underscores, the grammar of
|
|
167
|
-
* `RoleName` / `CredentialTypeName` / `ScopeKindName` / `GrantPathName` too.
|
|
168
|
-
*
|
|
169
|
-
* Applied to the `surface:` arm only. The `rpc:` arm's identifier is an action
|
|
170
|
-
* method name, whose vocabulary belongs to `ActionSpec` (and includes shapes
|
|
171
|
-
* like `peer/ping` this regex would refuse); the dispatcher computes it from the
|
|
172
|
-
* registered method, so nothing parses one.
|
|
173
|
-
*/
|
|
174
|
-
export const TOKEN_SURFACE_NAME_REGEX = /^[a-z]+(?:_[a-z]+)*$/;
|
|
175
165
|
// Capability-string prefixes. Private: `token_scope_method_capability` builds
|
|
176
166
|
// the one capability anything computes, and `is_route_scope_capability` checks
|
|
177
167
|
// the one a route declares, so nothing outside this module concatenates these.
|
|
@@ -196,14 +186,19 @@ export const token_scope_method_capability = (method) => `${CAPABILITY_RPC_PREFI
|
|
|
196
186
|
* Callers turn `false` into a registration-time throw: `RouteAuth.required_scope`
|
|
197
187
|
* is typed as a plain string so `http/` needs no `auth/` import, and this is the
|
|
198
188
|
* single point where that string becomes a mounted guard, so it is where the
|
|
199
|
-
* value gets checked. The identifier is checked for shape
|
|
200
|
-
*
|
|
189
|
+
* value gets checked. The identifier is checked for shape, not membership —
|
|
190
|
+
* a consumer names its own surface: the shared name grammar (`is_valid_name`),
|
|
191
|
+
* runs of lowercase letters joined by single underscores, at most
|
|
192
|
+
* `NAME_LENGTH_MAX` characters. The `rpc:` arm's identifier is an action method
|
|
193
|
+
* name, whose vocabulary belongs to `ActionSpec` (and includes shapes like
|
|
194
|
+
* `peer/ping` the grammar would refuse); the dispatcher computes it from the
|
|
195
|
+
* registered method, so nothing parses one.
|
|
201
196
|
*
|
|
202
197
|
* @param value - the declared capability string, e.g. `surface:audit_stream`
|
|
203
198
|
* @returns whether `value` is a well-formed `surface:<name>` capability
|
|
204
199
|
*/
|
|
205
200
|
export const is_route_scope_capability = (value) => value.startsWith(CAPABILITY_SURFACE_PREFIX) &&
|
|
206
|
-
|
|
201
|
+
is_valid_name(value.slice(CAPABILITY_SURFACE_PREFIX.length));
|
|
207
202
|
/**
|
|
208
203
|
* Build the flat denial body a non-RPC route returns when a narrowed token
|
|
209
204
|
* reaches a capability it lacks:
|
package/dist/dev/setup.d.ts
CHANGED
|
@@ -179,9 +179,12 @@ export declare const create_database: (deps: CommandDeps, db_name: string, optio
|
|
|
179
179
|
export declare const reset_database: (deps: CommandDeps & FsReadDeps & FsRemoveDeps, database_url: string, options?: ResetDatabaseOptions) => Promise<ResetDbResult>;
|
|
180
180
|
/** Input to `seed_dev_account`. */
|
|
181
181
|
export interface SeedDevAccountInput {
|
|
182
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* Account username, stored lowercased, as the `account_username_lowercase`
|
|
184
|
+
* CHECK requires. Its length and grammar (`Username`) are not checked.
|
|
185
|
+
*/
|
|
183
186
|
username: string;
|
|
184
|
-
/** Account password
|
|
187
|
+
/** Account password, hashed as given — the password policy is bypassed. */
|
|
185
188
|
password: string;
|
|
186
189
|
/** Roles to grant via role_grant (idempotent). */
|
|
187
190
|
roles?: ReadonlyArray<string>;
|
|
@@ -199,11 +202,15 @@ export interface SeedDevAccountDeps extends QueryDeps {
|
|
|
199
202
|
hash_password: (password: string) => Promise<string>;
|
|
200
203
|
}
|
|
201
204
|
/**
|
|
202
|
-
* Seed a development test account, bypassing username
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
205
|
+
* Seed a development test account, bypassing the username and password
|
|
206
|
+
* policy: the username is stored lowercased, for the account and its actor's
|
|
207
|
+
* `name`, its length and grammar unchecked, and the password is hashed as
|
|
208
|
+
* given.
|
|
209
|
+
*
|
|
210
|
+
* Idempotent by username, compared case-insensitively — if an account with
|
|
211
|
+
* the given username already exists, reuses it and only reconciles the
|
|
212
|
+
* requested role grants. Never updates an existing password (rerun would
|
|
213
|
+
* silently rotate it).
|
|
207
214
|
*
|
|
208
215
|
* Intended for `scripts/dev_setup.ts` — do not call in production.
|
|
209
216
|
*
|
package/dist/dev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AQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACrD;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,GAC5B,MAAM,kBAAkB,EACxB,OAAO,mBAAmB,EAC1B,UAAU;IAAE,GAAG,CAAC,EAAE,WAAW,CAAA;CAAE,KAC7B,OAAO,CAAC,oBAAoB,CAyC9B,CAAC"}
|
package/dist/dev/setup.js
CHANGED
|
@@ -283,11 +283,15 @@ export const reset_database = async (deps, database_url, options) => {
|
|
|
283
283
|
return { reset: true, skipped: false, db_type: 'postgres' };
|
|
284
284
|
};
|
|
285
285
|
/**
|
|
286
|
-
* Seed a development test account, bypassing username
|
|
286
|
+
* Seed a development test account, bypassing the username and password
|
|
287
|
+
* policy: the username is stored lowercased, for the account and its actor's
|
|
288
|
+
* `name`, its length and grammar unchecked, and the password is hashed as
|
|
289
|
+
* given.
|
|
287
290
|
*
|
|
288
|
-
* Idempotent by username — if an account with
|
|
289
|
-
* exists, reuses it and only reconciles the
|
|
290
|
-
* updates an existing password (rerun would
|
|
291
|
+
* Idempotent by username, compared case-insensitively — if an account with
|
|
292
|
+
* the given username already exists, reuses it and only reconciles the
|
|
293
|
+
* requested role grants. Never updates an existing password (rerun would
|
|
294
|
+
* silently rotate it).
|
|
291
295
|
*
|
|
292
296
|
* Intended for `scripts/dev_setup.ts` — do not call in production.
|
|
293
297
|
*
|
|
@@ -297,7 +301,8 @@ export const reset_database = async (deps, database_url, options) => {
|
|
|
297
301
|
export const seed_dev_account = async (deps, input, options) => {
|
|
298
302
|
const log = options?.log ?? default_setup_logger;
|
|
299
303
|
const query_deps = { db: deps.db };
|
|
300
|
-
const
|
|
304
|
+
const username = input.username.toLowerCase();
|
|
305
|
+
const existing = await query_account_by_username(query_deps, username);
|
|
301
306
|
if (existing) {
|
|
302
307
|
const actors = await query_actors_by_account(query_deps, existing.id);
|
|
303
308
|
if (actors.length === 0) {
|
|
@@ -319,7 +324,7 @@ export const seed_dev_account = async (deps, input, options) => {
|
|
|
319
324
|
}
|
|
320
325
|
const password_hash = await deps.hash_password(input.password);
|
|
321
326
|
const { account, actor } = await query_create_account_with_actor(query_deps, {
|
|
322
|
-
username
|
|
327
|
+
username,
|
|
323
328
|
password_hash
|
|
324
329
|
});
|
|
325
330
|
for (const role of input.roles ?? []) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reusable validator-schema primitives — `bounded_string`, `Username`,
|
|
3
3
|
* `UsernameProvided`, `Email`, the branded `Uuid` and `Datetime` with their
|
|
4
|
-
* factories, and the hash
|
|
4
|
+
* factories, and the hash schema `FactHashSchema`. Lives at
|
|
5
5
|
* the top level (not inside `auth/` or `http/`) because these shapes don't
|
|
6
6
|
* depend on or imply any domain — accounts hold a username and email, but
|
|
7
7
|
* invites, password resets, cells, and other surfaces all reach for the same
|
|
@@ -59,6 +59,12 @@ export declare const bounded_string: (options: BoundedStringOptions) => z.ZodStr
|
|
|
59
59
|
export declare const USERNAME_LENGTH_MIN = 3;
|
|
60
60
|
/** Maximum username length (matches GitHub's limit). The grammar is ASCII, so units and characters agree. */
|
|
61
61
|
export declare const USERNAME_LENGTH_MAX = 39;
|
|
62
|
+
/**
|
|
63
|
+
* The creation username's grammar: a letter, then letters, digits, `_` or
|
|
64
|
+
* `-`, ending in a letter or digit. ASCII, so it needs at least two
|
|
65
|
+
* characters, and `Username` bounds the length beside it.
|
|
66
|
+
*/
|
|
67
|
+
export declare const USERNAME_REGEX: RegExp;
|
|
62
68
|
/** Maximum length for username input on login/lookup, in UTF-16 code units, measured before trimming — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
63
69
|
export declare const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
64
70
|
/**
|
|
@@ -96,6 +102,43 @@ export type UsernameProvided = z.infer<typeof UsernameProvided>;
|
|
|
96
102
|
* Rust spine's `s.len()` check; for an all-ASCII address bytes == characters.
|
|
97
103
|
*/
|
|
98
104
|
export declare const EMAIL_LENGTH_MAX = 254;
|
|
105
|
+
/**
|
|
106
|
+
* Loose email shape `local@domain.tld`: a non-empty local part, exactly one
|
|
107
|
+
* `@`, a domain that holds a `.` and neither starts nor ends with one, and
|
|
108
|
+
* no whitespace. Accepts `a@b.c` (single-char TLDs are fine), `a@b..c` and
|
|
109
|
+
* `user+tag@a.co`; rejects `notanemail`, `@x.com`, `user@`, `user@host`,
|
|
110
|
+
* `a@.b.c`, `a@b.c.`, and any whitespace. The Rust spine's `is_valid_email`
|
|
111
|
+
* is the same rule.
|
|
112
|
+
*
|
|
113
|
+
* The negated class excludes `\s` **plus** U+0085 (NEL): JS's `\s` omits
|
|
114
|
+
* U+0085 but Unicode `White_Space` (Rust's `char::is_whitespace`) includes
|
|
115
|
+
* it, so excluding it keeps the whitespace set identical across the twins.
|
|
116
|
+
* (The Rust side correspondingly also rejects U+FEFF, which JS `\s` treats as
|
|
117
|
+
* whitespace but Unicode `White_Space` does not — so both spines reject
|
|
118
|
+
* exactly `White_Space ∪ {U+FEFF}`.)
|
|
119
|
+
*
|
|
120
|
+
* Linear in the input's length: the `@` can match only the first `@`, and the
|
|
121
|
+
* `\.` only the domain's first `.`, since the classes before each exclude it,
|
|
122
|
+
* so the tail after the `\.` is scanned once. The domain spelled
|
|
123
|
+
* `[^\s\u0085@.][^\s\u0085@]*\.[^\s\u0085@]*[^\s\u0085@.]`, the same
|
|
124
|
+
* language, is quadratic: it tries every `.` as the split.
|
|
125
|
+
*/
|
|
126
|
+
export declare const EMAIL_REGEX: RegExp;
|
|
127
|
+
/** The message of an email over `EMAIL_LENGTH_MAX` bytes, on either schema library's `Email`. */
|
|
128
|
+
export declare const EMAIL_LENGTH_MESSAGE = "Email must be at most 254 bytes";
|
|
129
|
+
/**
|
|
130
|
+
* Whether `s` is at most `EMAIL_LENGTH_MAX` bytes in UTF-8, the bound both
|
|
131
|
+
* `Email` schemas check.
|
|
132
|
+
*
|
|
133
|
+
* `s.length` (UTF-16 units) is a cheap upper bound that short-circuits the
|
|
134
|
+
* `encode` on absurd inputs: a valid (<= 254-byte) address is necessarily
|
|
135
|
+
* <= 254 code units, so it never refuses one — the byte count is the real
|
|
136
|
+
* RFC-5321 octet bound, matching the Rust spine's `s.len()`.
|
|
137
|
+
*
|
|
138
|
+
* @param s - the address
|
|
139
|
+
* @returns `true` when the address is within the byte bound
|
|
140
|
+
*/
|
|
141
|
+
export declare const is_email_within_length_max: (s: string) => boolean;
|
|
99
142
|
/**
|
|
100
143
|
* Email validation. Every current consumer pairs it with `Username` (signup,
|
|
101
144
|
* invites, audit log), so the two live together with the other Zod
|
|
@@ -113,6 +156,9 @@ export declare const EMAIL_LENGTH_MAX = 254;
|
|
|
113
156
|
* transform: case is preserved and surrounding whitespace is rejected (not
|
|
114
157
|
* trimmed), so storage is verbatim and the case-insensitive lookup rides the
|
|
115
158
|
* DB-side `LOWER(email)`.
|
|
159
|
+
*
|
|
160
|
+
* The byte bound runs first and aborts, so an address past it gets the
|
|
161
|
+
* length issue alone and is never read by the regex.
|
|
116
162
|
*/
|
|
117
163
|
export declare const Email: z.ZodString;
|
|
118
164
|
export type Email = z.infer<typeof Email>;
|
|
@@ -160,9 +206,6 @@ export declare const get_datetime_now: () => Datetime;
|
|
|
160
206
|
/** `Datetime` that defaults to `get_datetime_now()` when the input is `undefined`. */
|
|
161
207
|
export declare const DatetimeNow: z.ZodDefault<z.core.$ZodBranded<z.ZodISODateTime, "Datetime", "out">>;
|
|
162
208
|
export type DatetimeNow = z.infer<typeof DatetimeNow>;
|
|
163
|
-
/** Zod schema for a BLAKE3 hex hash — 64 lowercase hex characters (256-bit output). */
|
|
164
|
-
export declare const Blake3Hash: z.ZodString;
|
|
165
|
-
export type Blake3Hash = z.infer<typeof Blake3Hash>;
|
|
166
209
|
/**
|
|
167
210
|
* Wire-form schema for a `blake3:`-prefixed fact hash, whose output is
|
|
168
211
|
* `FactHash` from `@fuzdev/fuz_util/hash_schemas.ts` — the type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIlF,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACpC,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,GAAI,SAAS,oBAAoB,KAAG,CAAC,CAAC,SA+ChE,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,6GAA6G;AAC7G,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,gNAAgN;AAChN,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,wDAEc,CAAC;AACpC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,wDAEqE,CAAC;AACnG,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAA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`Email`, the branded `Uuid` and `Datetime` with their
|
|
4
|
-
* factories, and the hash
|
|
4
|
+
* factories, and the hash schema `FactHashSchema`. Lives at
|
|
5
5
|
* the top level (not inside `auth/` or `http/`) because these shapes don't
|
|
6
6
|
* depend on or imply any domain — accounts hold a username and email, but
|
|
7
7
|
* invites, password resets, cells, and other surfaces all reach for the same
|
|
@@ -96,6 +96,12 @@ export const bounded_string = (options) => {
|
|
|
96
96
|
export const USERNAME_LENGTH_MIN = 3;
|
|
97
97
|
/** Maximum username length (matches GitHub's limit). The grammar is ASCII, so units and characters agree. */
|
|
98
98
|
export const USERNAME_LENGTH_MAX = 39;
|
|
99
|
+
/**
|
|
100
|
+
* The creation username's grammar: a letter, then letters, digits, `_` or
|
|
101
|
+
* `-`, ending in a letter or digit. ASCII, so it needs at least two
|
|
102
|
+
* characters, and `Username` bounds the length beside it.
|
|
103
|
+
*/
|
|
104
|
+
export const USERNAME_REGEX = /^[a-zA-Z][0-9a-zA-Z_-]*[0-9a-zA-Z]$/;
|
|
99
105
|
/** Maximum length for username input on login/lookup, in UTF-16 code units, measured before trimming — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
100
106
|
export const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
101
107
|
/**
|
|
@@ -109,7 +115,7 @@ export const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
|
109
115
|
* `LOWER(username) = LOWER($1)` lookup contract simple.
|
|
110
116
|
*/
|
|
111
117
|
export const Username = bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX })
|
|
112
|
-
.regex(
|
|
118
|
+
.regex(USERNAME_REGEX)
|
|
113
119
|
.transform((s) => s.toLowerCase());
|
|
114
120
|
/**
|
|
115
121
|
* Username submitted for login or lookup — minimal validation for forward-compatibility if format rules change.
|
|
@@ -137,10 +143,11 @@ export const UsernameProvided = bounded_string({ min: 1, max: USERNAME_PROVIDED_
|
|
|
137
143
|
export const EMAIL_LENGTH_MAX = 254;
|
|
138
144
|
/**
|
|
139
145
|
* Loose email shape `local@domain.tld`: a non-empty local part, exactly one
|
|
140
|
-
* `@`, a domain
|
|
141
|
-
* no whitespace. Accepts `a@b.c` (single-char TLDs are fine) and
|
|
142
|
-
* `user+tag@a.co`; rejects `notanemail`, `@x.com`, `user@`, `user@host`,
|
|
143
|
-
* any whitespace.
|
|
146
|
+
* `@`, a domain that holds a `.` and neither starts nor ends with one, and
|
|
147
|
+
* no whitespace. Accepts `a@b.c` (single-char TLDs are fine), `a@b..c` and
|
|
148
|
+
* `user+tag@a.co`; rejects `notanemail`, `@x.com`, `user@`, `user@host`,
|
|
149
|
+
* `a@.b.c`, `a@b.c.`, and any whitespace. The Rust spine's `is_valid_email`
|
|
150
|
+
* is the same rule.
|
|
144
151
|
*
|
|
145
152
|
* The negated class excludes `\s` **plus** U+0085 (NEL): JS's `\s` omits
|
|
146
153
|
* U+0085 but Unicode `White_Space` (Rust's `char::is_whitespace`) includes
|
|
@@ -148,10 +155,31 @@ export const EMAIL_LENGTH_MAX = 254;
|
|
|
148
155
|
* (The Rust side correspondingly also rejects U+FEFF, which JS `\s` treats as
|
|
149
156
|
* whitespace but Unicode `White_Space` does not — so both spines reject
|
|
150
157
|
* exactly `White_Space ∪ {U+FEFF}`.)
|
|
158
|
+
*
|
|
159
|
+
* Linear in the input's length: the `@` can match only the first `@`, and the
|
|
160
|
+
* `\.` only the domain's first `.`, since the classes before each exclude it,
|
|
161
|
+
* so the tail after the `\.` is scanned once. The domain spelled
|
|
162
|
+
* `[^\s\u0085@.][^\s\u0085@]*\.[^\s\u0085@]*[^\s\u0085@.]`, the same
|
|
163
|
+
* language, is quadratic: it tries every `.` as the split.
|
|
151
164
|
*/
|
|
152
|
-
const EMAIL_REGEX = /^[^\s\u0085@]+@[^\s\u0085
|
|
165
|
+
export const EMAIL_REGEX = /^[^\s\u0085@]+@[^\s\u0085@.]+\.[^\s\u0085@]*[^\s\u0085@.]$/;
|
|
166
|
+
/** The message of an email over `EMAIL_LENGTH_MAX` bytes, on either schema library's `Email`. */
|
|
167
|
+
export const EMAIL_LENGTH_MESSAGE = `Email must be at most ${EMAIL_LENGTH_MAX} bytes`;
|
|
153
168
|
/** UTF-8 encoder for the `EMAIL_LENGTH_MAX` byte (octet) bound. */
|
|
154
169
|
const utf8_encoder = new TextEncoder();
|
|
170
|
+
/**
|
|
171
|
+
* Whether `s` is at most `EMAIL_LENGTH_MAX` bytes in UTF-8, the bound both
|
|
172
|
+
* `Email` schemas check.
|
|
173
|
+
*
|
|
174
|
+
* `s.length` (UTF-16 units) is a cheap upper bound that short-circuits the
|
|
175
|
+
* `encode` on absurd inputs: a valid (<= 254-byte) address is necessarily
|
|
176
|
+
* <= 254 code units, so it never refuses one — the byte count is the real
|
|
177
|
+
* RFC-5321 octet bound, matching the Rust spine's `s.len()`.
|
|
178
|
+
*
|
|
179
|
+
* @param s - the address
|
|
180
|
+
* @returns `true` when the address is within the byte bound
|
|
181
|
+
*/
|
|
182
|
+
export const is_email_within_length_max = (s) => s.length <= EMAIL_LENGTH_MAX && utf8_encoder.encode(s).length <= EMAIL_LENGTH_MAX;
|
|
155
183
|
/**
|
|
156
184
|
* Email validation. Every current consumer pairs it with `Username` (signup,
|
|
157
185
|
* invites, audit log), so the two live together with the other Zod
|
|
@@ -169,17 +197,14 @@ const utf8_encoder = new TextEncoder();
|
|
|
169
197
|
* transform: case is preserved and surrounding whitespace is rejected (not
|
|
170
198
|
* trimmed), so storage is verbatim and the case-insensitive lookup rides the
|
|
171
199
|
* DB-side `LOWER(email)`.
|
|
200
|
+
*
|
|
201
|
+
* The byte bound runs first and aborts, so an address past it gets the
|
|
202
|
+
* length issue alone and is never read by the regex.
|
|
172
203
|
*/
|
|
173
204
|
export const Email = z
|
|
174
205
|
.string()
|
|
175
|
-
.
|
|
176
|
-
|
|
177
|
-
// `encode` on absurd inputs: a valid (<= 254-byte) address is necessarily
|
|
178
|
-
// <= 254 code units, so this never rejects one — the byte count is the real
|
|
179
|
-
// RFC-5321 octet bound, matching the Rust spine's `s.len()`.
|
|
180
|
-
.refine((s) => s.length <= EMAIL_LENGTH_MAX && utf8_encoder.encode(s).length <= EMAIL_LENGTH_MAX, {
|
|
181
|
-
message: `Email must be at most ${EMAIL_LENGTH_MAX} bytes`
|
|
182
|
-
});
|
|
206
|
+
.refine(is_email_within_length_max, { message: EMAIL_LENGTH_MESSAGE, abort: true })
|
|
207
|
+
.regex(EMAIL_REGEX);
|
|
183
208
|
/** Returns a new random (v4) `Uuid`. */
|
|
184
209
|
export const create_uuid = () => crypto.randomUUID();
|
|
185
210
|
/**
|
|
@@ -232,10 +257,6 @@ export const Datetime = z.iso.datetime().brand('Datetime');
|
|
|
232
257
|
export const get_datetime_now = () => new Date().toISOString();
|
|
233
258
|
/** `Datetime` that defaults to `get_datetime_now()` when the input is `undefined`. */
|
|
234
259
|
export const DatetimeNow = Datetime.default(get_datetime_now);
|
|
235
|
-
/** Zod schema for a BLAKE3 hex hash — 64 lowercase hex characters (256-bit output). */
|
|
236
|
-
export const Blake3Hash = z
|
|
237
|
-
.string()
|
|
238
|
-
.regex(/^[0-9a-f]{64}$/, 'Expected a 64-character lowercase hex blake3 hash');
|
|
239
260
|
/**
|
|
240
261
|
* Wire-form schema for a `blake3:`-prefixed fact hash, whose output is
|
|
241
262
|
* `FactHash` from `@fuzdev/fuz_util/hash_schemas.ts` — the type
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `
|
|
3
|
-
* `UuidWithDefault` (`primitive_schemas.ts`), and
|
|
4
|
-
* (`http/auth_shape.ts`), under the same names, for schemas
|
|
5
|
-
* fuz_schema
|
|
2
|
+
* `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `Username`,
|
|
3
|
+
* `Email`, `Uuid`, `UuidWithDefault` (`primitive_schemas.ts`), and
|
|
4
|
+
* `ActingActor` (`http/auth_shape.ts`), under the same names, for schemas
|
|
5
|
+
* written in fuz_schema; `UsernameCanonical`, the username an output carries;
|
|
6
|
+
* `Timestamp`, a timestamp on the wire; and `Blake3Hash`, a BLAKE3 hex hash,
|
|
7
|
+
* which has no Zod twin.
|
|
6
8
|
*
|
|
7
9
|
* The output type is shared: the Zod `Uuid` outputs fuz_schema's
|
|
8
10
|
* `Branded<string, 'Uuid'>` too, so a value parsed by either twin goes where
|
|
@@ -12,7 +14,7 @@
|
|
|
12
14
|
* says, the max UUID included, and the Rust spine's: every input gets the same
|
|
13
15
|
* verdict and output from both, and their JSON Schema is the same.
|
|
14
16
|
*
|
|
15
|
-
* The
|
|
17
|
+
* The twins are `@nodocs` while the Zod schemas of the same names stay, as
|
|
16
18
|
* the docs build refuses two exports of one name.
|
|
17
19
|
*
|
|
18
20
|
* @module
|
|
@@ -32,6 +34,48 @@ import { type BoundedStringOptions } from './primitive_schemas.js';
|
|
|
32
34
|
* @nodocs
|
|
33
35
|
*/
|
|
34
36
|
export declare const bounded_string: (options: BoundedStringOptions) => PipeSchema<string, typeof string>;
|
|
37
|
+
/**
|
|
38
|
+
* Username for account creation, the twin of the Zod `Username`: the same
|
|
39
|
+
* bounds and grammar, output in lowercase. Every input gets the same verdict
|
|
40
|
+
* and output from both; a string outside the bounds and off the grammar gets
|
|
41
|
+
* the length issue alone, where Zod adds the grammar issue after it.
|
|
42
|
+
*
|
|
43
|
+
* @nodocs
|
|
44
|
+
*/
|
|
45
|
+
export declare const Username: PipeSchema<string, PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
46
|
+
/** @nodocs */
|
|
47
|
+
export type Username = Infer<typeof Username>;
|
|
48
|
+
/**
|
|
49
|
+
* A username's canonical grammar, `USERNAME_REGEX` in lowercase: a lowercase
|
|
50
|
+
* letter, then lowercase letters, digits, `_` or `-`, ending in a lowercase
|
|
51
|
+
* letter or digit. What `Username` outputs, and what an `account` row holds
|
|
52
|
+
* (its `account_username_lowercase` CHECK).
|
|
53
|
+
*/
|
|
54
|
+
export declare const USERNAME_CANONICAL_REGEX: RegExp;
|
|
55
|
+
/**
|
|
56
|
+
* A username as an account row holds it, the `username` of an output: the
|
|
57
|
+
* bounds of `Username` and `USERNAME_CANONICAL_REGEX`, no transform. A
|
|
58
|
+
* username in any other case fails, where the Zod `Username` lowercased it.
|
|
59
|
+
*/
|
|
60
|
+
export declare const UsernameCanonical: PipeSchema<string, PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
61
|
+
export type UsernameCanonical = Infer<typeof UsernameCanonical>;
|
|
62
|
+
/**
|
|
63
|
+
* Email validation, the twin of the Zod `Email`: `EMAIL_REGEX` and at most
|
|
64
|
+
* `EMAIL_LENGTH_MAX` UTF-8 bytes, no transform. The `max_length` ahead of the
|
|
65
|
+
* grammar refuses a string past the bound in UTF-16 code units, which is past
|
|
66
|
+
* it in bytes too, before the regex reads it, and the `check` after it the
|
|
67
|
+
* multibyte address within the units but past the bytes, both with
|
|
68
|
+
* `EMAIL_LENGTH_MESSAGE`. Every input gets the same verdict and output from
|
|
69
|
+
* both; a string past the bound in code units gets the length issue as a
|
|
70
|
+
* `max_length`, where Zod gives a `check`, and one within the bound in code
|
|
71
|
+
* units but past it in bytes and off the grammar gets the grammar issue, where
|
|
72
|
+
* Zod gives the length one.
|
|
73
|
+
*
|
|
74
|
+
* @nodocs
|
|
75
|
+
*/
|
|
76
|
+
export declare const Email: PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
77
|
+
/** @nodocs */
|
|
78
|
+
export type Email = Infer<typeof Email>;
|
|
35
79
|
/**
|
|
36
80
|
* Branded UUID schema: a UUID of RFC 9562 in either case, output in
|
|
37
81
|
* lowercase, the form Postgres renders a `uuid` in and every id the server
|
|
@@ -40,7 +84,7 @@ export declare const bounded_string: (options: BoundedStringOptions) => PipeSche
|
|
|
40
84
|
*
|
|
41
85
|
* @nodocs
|
|
42
86
|
*/
|
|
43
|
-
export declare const Uuid: 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<"
|
|
87
|
+
export declare const Uuid: 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">)[]> & {
|
|
44
88
|
readonly '~types'?: {
|
|
45
89
|
readonly input: string;
|
|
46
90
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
@@ -53,7 +97,7 @@ export type Uuid = Infer<typeof Uuid>;
|
|
|
53
97
|
*
|
|
54
98
|
* @nodocs
|
|
55
99
|
*/
|
|
56
|
-
export declare const UuidWithDefault: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string | undefined, "with_default_fn", import("@fuzdev/fuz_schema/schema.ts").SchemaDefaultFnDef<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<"
|
|
100
|
+
export declare const UuidWithDefault: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string | undefined, "with_default_fn", import("@fuzdev/fuz_schema/schema.ts").SchemaDefaultFnDef<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">)[]> & {
|
|
57
101
|
readonly '~types'?: {
|
|
58
102
|
readonly input: string;
|
|
59
103
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
@@ -61,6 +105,24 @@ export declare const UuidWithDefault: import("@fuzdev/fuz_schema/schema.ts").Sch
|
|
|
61
105
|
}>>;
|
|
62
106
|
/** @nodocs */
|
|
63
107
|
export type UuidWithDefault = Infer<typeof UuidWithDefault>;
|
|
108
|
+
/**
|
|
109
|
+
* A timestamp on the wire: a date and time of RFC 3339 in UTC, fuz_schema's
|
|
110
|
+
* `iso_datetime`, which both spines' `YYYY-MM-DDTHH:MM:SSZ`
|
|
111
|
+
* (`iso8601_timestamp_column`) and a `toISOString()` stamp satisfy. Not
|
|
112
|
+
* branded, unlike the Zod `Datetime`.
|
|
113
|
+
*/
|
|
114
|
+
export declare const Timestamp: PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
115
|
+
export type Timestamp = Infer<typeof Timestamp>;
|
|
116
|
+
/** A BLAKE3 hex hash's grammar: 64 lowercase hex characters (256-bit output). */
|
|
117
|
+
export declare const BLAKE3_HASH_REGEX: RegExp;
|
|
118
|
+
/** The message of a string off `BLAKE3_HASH_REGEX`. */
|
|
119
|
+
export declare const BLAKE3_HASH_MESSAGE = "Expected a 64-character lowercase hex blake3 hash";
|
|
120
|
+
/**
|
|
121
|
+
* A BLAKE3 hex hash: `BLAKE3_HASH_REGEX`, whose issue carries
|
|
122
|
+
* `BLAKE3_HASH_MESSAGE`. A value that is no string gets fuz_schema's message.
|
|
123
|
+
*/
|
|
124
|
+
export declare const Blake3Hash: PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
125
|
+
export type Blake3Hash = Infer<typeof Blake3Hash>;
|
|
64
126
|
/** The `description` both `ActingActor` twins carry. */
|
|
65
127
|
export declare const ACTING_ACTOR_DESCRIPTION = "Actor on the authenticated account that this request acts as. Omit on single-actor accounts; required on multi-actor.";
|
|
66
128
|
/**
|
|
@@ -71,7 +133,7 @@ export declare const ACTING_ACTOR_DESCRIPTION = "Actor on the authenticated acco
|
|
|
71
133
|
*
|
|
72
134
|
* @nodocs
|
|
73
135
|
*/
|
|
74
|
-
export declare const ActingActor: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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<"
|
|
136
|
+
export declare const ActingActor: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<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">)[]> & {
|
|
75
137
|
readonly '~types'?: {
|
|
76
138
|
readonly input: string;
|
|
77
139
|
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|