@fuzdev/fuz_app 0.168.0 → 0.169.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/actions/CLAUDE.md +1 -1
- package/dist/actions/action_codegen.d.ts +9 -7
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +20 -15
- package/dist/actions/action_event_data.d.ts +16 -16
- package/dist/actions/heartbeat.d.ts +1 -1
- package/dist/auth/account_action_specs.d.ts +11 -11
- package/dist/auth/account_action_specs.js +1 -1
- package/dist/auth/account_route_schema.d.ts +18 -18
- package/dist/auth/account_route_schema.js +1 -1
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +38 -40
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +7 -8
- package/dist/auth/actor_lookup_action_specs.d.ts +7 -7
- package/dist/auth/actor_lookup_action_specs.js +1 -1
- package/dist/auth/actor_search_action_specs.d.ts +6 -6
- package/dist/auth/actor_search_action_specs.js +1 -1
- package/dist/auth/admin_action_specs.d.ts +166 -166
- package/dist/auth/admin_action_specs.js +1 -1
- package/dist/auth/app_settings_schema.d.ts +3 -3
- package/dist/auth/app_settings_schema.d.ts.map +1 -1
- package/dist/auth/app_settings_schema.js +1 -1
- package/dist/auth/audit_log_route_schema.d.ts +1 -1
- package/dist/auth/audit_log_route_schema.js +1 -1
- package/dist/auth/audit_log_schema.d.ts +61 -61
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +1 -1
- package/dist/auth/bootstrap_route_schema.d.ts +4 -4
- package/dist/auth/bootstrap_route_schema.js +1 -1
- package/dist/auth/cell_action_specs.d.ts +424 -424
- package/dist/auth/cell_action_specs.js +1 -1
- package/dist/auth/cell_audit_action_specs.d.ts +14 -14
- package/dist/auth/cell_audit_action_specs.js +1 -1
- package/dist/auth/cell_audit_metadata.d.ts +8 -8
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_action_specs.d.ts +55 -55
- package/dist/auth/cell_field_action_specs.js +1 -1
- package/dist/auth/cell_field_audit_metadata.d.ts +4 -4
- package/dist/auth/cell_field_audit_metadata.js +1 -1
- package/dist/auth/cell_grant_action_specs.d.ts +61 -61
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_audit_metadata.d.ts +10 -10
- package/dist/auth/cell_grant_audit_metadata.js +1 -1
- package/dist/auth/cell_item_action_specs.d.ts +76 -76
- package/dist/auth/cell_item_action_specs.js +1 -1
- package/dist/auth/cell_item_audit_metadata.d.ts +5 -5
- package/dist/auth/cell_item_audit_metadata.js +1 -1
- package/dist/auth/invite_schema.d.ts +11 -11
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +1 -1
- package/dist/auth/name_schema.js +1 -1
- package/dist/auth/password.js +1 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts +182 -182
- package/dist/auth/role_grant_offer_action_specs.js +1 -1
- package/dist/auth/role_grant_offer_notifications.d.ts +107 -107
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +1 -1
- package/dist/auth/role_grant_offer_schema.d.ts +9 -9
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +1 -1
- package/dist/auth/self_service_role_action_specs.d.ts +2 -2
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/signup_route_schema.d.ts +2 -2
- package/dist/auth/signup_route_schema.js +1 -1
- package/dist/auth/token_scope.d.ts +8 -8
- package/dist/db/file_fact_url.d.ts +1 -1
- package/dist/http/CLAUDE.md +7 -7
- package/dist/http/auth_shape.d.ts +15 -32
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +31 -38
- package/dist/http/db_routes.d.ts +1 -1
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/http/db_routes.js +1 -1
- package/dist/http/error_schemas.d.ts +18 -18
- package/dist/http/jsonrpc.d.ts +11 -11
- package/dist/http/schema_helpers.d.ts +2 -2
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +8 -7
- package/dist/primitive_schemas.d.ts +173 -115
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +134 -158
- package/dist/schema_issues.d.ts +10 -7
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +38 -8
- package/dist/server/serve_fact_route.js +1 -1
- package/dist/server/surface_route.js +1 -1
- package/dist/testing/CLAUDE.md +3 -3
- package/dist/testing/cross_backend/conformance_case.d.ts +96 -114
- package/dist/testing/cross_backend/conformance_case.d.ts.map +1 -1
- package/dist/testing/cross_backend/conformance_case.js +0 -256
- package/dist/testing/cross_backend/fact_serving.js +1 -1
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +3 -4
- package/dist/testing/cross_backend/testing_origin_check.d.ts +8 -8
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +608 -201
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +46 -55
- package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_outbound_overflow.js +35 -0
- package/dist/testing/rpc_helpers.d.ts +1 -1
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +0 -1
- package/dist/testing/schema_generators.js +1 -13
- package/dist/testing/schema_introspect.d.ts +438 -78
- package/dist/testing/schema_introspect.d.ts.map +1 -1
- package/dist/testing/schema_introspect.js +26 -26
- package/dist/testing/transports/bootstrap.d.ts +1 -1
- package/dist/testing/transports/bootstrap.d.ts.map +1 -1
- package/dist/testing/transports/bootstrap.js +1 -1
- package/dist/ui/BootstrapForm.svelte +1 -2
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +1 -2
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +5 -5
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
- package/dist/ui/role_grant_offers_state.svelte.d.ts +1 -1
- package/dist/zod.d.ts +18 -3
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +26 -3
- package/dist/zod_schemas.d.ts +100 -0
- package/dist/zod_schemas.d.ts.map +1 -0
- package/dist/zod_schemas.js +157 -0
- package/package.json +5 -5
- package/dist/primitive_schemas_fuz.d.ts +0 -178
- package/dist/primitive_schemas_fuz.d.ts.map +0 -1
- package/dist/primitive_schemas_fuz.js +0 -149
|
@@ -34,37 +34,37 @@ import './assert_dev_env.js';
|
|
|
34
34
|
*
|
|
35
35
|
* @module
|
|
36
36
|
*/
|
|
37
|
-
import {
|
|
37
|
+
import { array, boolean, nullable, number, pipe, record, safe_integer, string, strip_object } from '@fuzdev/fuz_schema/schema.ts';
|
|
38
38
|
/**
|
|
39
|
-
* Per-column structural metadata. The
|
|
39
|
+
* Per-column structural metadata. The schema is the canonical source
|
|
40
40
|
* for the column shape — `SchemaSnapshot` reuses it as the cross-impl
|
|
41
41
|
* `_testing_schema_snapshot` RPC action's wire validator, so the
|
|
42
42
|
* introspection type and the wire contract can't drift apart.
|
|
43
43
|
*/
|
|
44
|
-
export const ColumnSnapshot =
|
|
44
|
+
export const ColumnSnapshot = strip_object({
|
|
45
45
|
/** SQL standard type name from `information_schema.columns.data_type`. */
|
|
46
|
-
data_type:
|
|
46
|
+
data_type: string,
|
|
47
47
|
/** Postgres-native type name from `information_schema.columns.udt_name`. */
|
|
48
|
-
udt_name:
|
|
48
|
+
udt_name: string,
|
|
49
49
|
/** `true` when the column accepts NULL. */
|
|
50
|
-
is_nullable:
|
|
50
|
+
is_nullable: boolean,
|
|
51
51
|
/** Default-value expression as Postgres reports it, or `null` if none. */
|
|
52
|
-
column_default:
|
|
52
|
+
column_default: nullable(string),
|
|
53
53
|
/** `true` when the column was declared GENERATED ... AS IDENTITY. */
|
|
54
|
-
is_identity:
|
|
54
|
+
is_identity: boolean
|
|
55
55
|
});
|
|
56
56
|
/** Per-table structural metadata. */
|
|
57
|
-
export const TableSnapshot =
|
|
57
|
+
export const TableSnapshot = strip_object({
|
|
58
58
|
/** Column metadata keyed by column name (sorted on serialization). */
|
|
59
|
-
columns:
|
|
59
|
+
columns: record(ColumnSnapshot),
|
|
60
60
|
/** Index definitions as Postgres renders them via `pg_indexes.indexdef`. */
|
|
61
|
-
indexes:
|
|
61
|
+
indexes: array(strip_object({ name: string, definition: string })),
|
|
62
62
|
/** Constraint definitions as Postgres renders them via `pg_get_constraintdef`. */
|
|
63
|
-
constraints:
|
|
63
|
+
constraints: array(strip_object({ name: string, type: string, definition: string }))
|
|
64
64
|
});
|
|
65
65
|
/** Sequence metadata — `data_type` is `bigint` (BIGSERIAL) or `integer` (SERIAL). */
|
|
66
|
-
export const SequenceSnapshot =
|
|
67
|
-
data_type:
|
|
66
|
+
export const SequenceSnapshot = strip_object({
|
|
67
|
+
data_type: string
|
|
68
68
|
});
|
|
69
69
|
/**
|
|
70
70
|
* Enum-type metadata — the labels of a `CREATE TYPE ... AS ENUM`, captured in
|
|
@@ -72,9 +72,9 @@ export const SequenceSnapshot = z.object({
|
|
|
72
72
|
* enum's labels are an ordered set, and reordering them is a schema change, so
|
|
73
73
|
* the parity diff compares the arrays positionally.
|
|
74
74
|
*/
|
|
75
|
-
export const EnumTypeSnapshot =
|
|
75
|
+
export const EnumTypeSnapshot = strip_object({
|
|
76
76
|
/** Enum labels in declared order. */
|
|
77
|
-
labels:
|
|
77
|
+
labels: array(string)
|
|
78
78
|
});
|
|
79
79
|
/**
|
|
80
80
|
* Normalized database schema snapshot for parity comparison — the single
|
|
@@ -85,13 +85,13 @@ export const EnumTypeSnapshot = z.object({
|
|
|
85
85
|
* All fields are deterministically ordered on capture so structural equality
|
|
86
86
|
* via `JSON.stringify` or per-key comparison yields stable results.
|
|
87
87
|
*/
|
|
88
|
-
export const SchemaSnapshot =
|
|
88
|
+
export const SchemaSnapshot = strip_object({
|
|
89
89
|
/** Tables keyed by name. */
|
|
90
|
-
tables:
|
|
90
|
+
tables: record(TableSnapshot),
|
|
91
91
|
/** Sequences keyed by name. */
|
|
92
|
-
sequences:
|
|
92
|
+
sequences: record(SequenceSnapshot),
|
|
93
93
|
/** Enum types (`CREATE TYPE ... AS ENUM`) keyed by name; labels in declared order. */
|
|
94
|
-
enums:
|
|
94
|
+
enums: record(EnumTypeSnapshot)
|
|
95
95
|
});
|
|
96
96
|
/**
|
|
97
97
|
* A single `schema_version` tracker row — the migration-identity primitive.
|
|
@@ -104,21 +104,21 @@ export const SchemaSnapshot = z.object({
|
|
|
104
104
|
* bootstrapped spines so a migration-name or partitioning drift — invisible
|
|
105
105
|
* to the schema snapshot — is a gated fact, not a latent interop break.
|
|
106
106
|
*/
|
|
107
|
-
export const MigrationTrackerEntry =
|
|
107
|
+
export const MigrationTrackerEntry = strip_object({
|
|
108
108
|
/** Migration namespace (e.g. `fuz_auth`, `fuz_cell`). */
|
|
109
|
-
namespace:
|
|
109
|
+
namespace: string,
|
|
110
110
|
/** Migration name within the namespace (e.g. `full_cell_schema`). */
|
|
111
|
-
name:
|
|
111
|
+
name: string,
|
|
112
112
|
/** Per-namespace apply order, starting at 0. */
|
|
113
|
-
sequence:
|
|
113
|
+
sequence: pipe(number, safe_integer)
|
|
114
114
|
});
|
|
115
115
|
/**
|
|
116
116
|
* The full `schema_version` tracker as a deterministically-ordered list,
|
|
117
117
|
* wrapped in an object so it round-trips cleanly as a JSON-RPC result.
|
|
118
118
|
* Sorted by `(namespace, sequence)` on capture.
|
|
119
119
|
*/
|
|
120
|
-
export const MigrationTracker =
|
|
121
|
-
entries:
|
|
120
|
+
export const MigrationTracker = strip_object({
|
|
121
|
+
entries: array(MigrationTrackerEntry)
|
|
122
122
|
});
|
|
123
123
|
/**
|
|
124
124
|
* Read every `schema_version` row into a deterministic `MigrationTracker`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
|
-
import { Uuid } from '../../
|
|
2
|
+
import { Uuid } from '../../primitive_schemas.js';
|
|
3
3
|
import type { BackendConfig } from '../cross_backend/backend_config.js';
|
|
4
4
|
import type { FetchTransport } from './fetch_transport.js';
|
|
5
5
|
/** Input for `bootstrap()`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/transports/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwB9B,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/transports/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAwB9B,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAe3D,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAC/B;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;KAAE,CAAC;IACtC,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAU,SAAS,gBAAgB,KAAG,OAAO,CAAC,eAAe,CA8BlF,CAAC"}
|
|
@@ -19,7 +19,7 @@ import '../assert_dev_env.js';
|
|
|
19
19
|
* @module
|
|
20
20
|
*/
|
|
21
21
|
import { parse, string, strip_object } from '@fuzdev/fuz_schema/schema.ts';
|
|
22
|
-
import { Uuid } from '../../
|
|
22
|
+
import { Uuid } from '../../primitive_schemas.js';
|
|
23
23
|
import { format_issues } from '../../schema_issues.js';
|
|
24
24
|
/**
|
|
25
25
|
* The `BootstrapOutput` envelope shape the cross-process bootstrap call
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
import { autofocus } from '@fuzdev/fuz_ui/autofocus.svelte.ts';
|
|
19
19
|
import { is } from '@fuzdev/fuz_schema/schema.ts';
|
|
20
20
|
|
|
21
|
-
import { USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN } from '../primitive_schemas.js';
|
|
22
|
-
import { Username } from '../primitive_schemas_fuz.js';
|
|
21
|
+
import { USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN, Username } from '../primitive_schemas.js';
|
|
23
22
|
import { PASSWORD_LENGTH_MIN } from '../auth/password.js';
|
|
24
23
|
import { auth_state_context } from './auth_state.svelte.js';
|
|
25
24
|
import { FormState } from './form_state.svelte.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BootstrapForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/BootstrapForm.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BootstrapForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/BootstrapForm.svelte"],"names":[],"mappings":"AA0BC,KAAK,gBAAgB,GAAI;IACxB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AA2GH,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
import { autofocus } from '@fuzdev/fuz_ui/autofocus.svelte.ts';
|
|
18
18
|
import { is } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
19
|
|
|
20
|
-
import { USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN } from '../primitive_schemas.js';
|
|
21
|
-
import { Username } from '../primitive_schemas_fuz.js';
|
|
20
|
+
import { USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN, Username } from '../primitive_schemas.js';
|
|
22
21
|
import { PASSWORD_LENGTH_MIN } from '../auth/password.js';
|
|
23
22
|
import { auth_state_context } from './auth_state.svelte.js';
|
|
24
23
|
import { FormState } from './form_state.svelte.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignupForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/SignupForm.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignupForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/SignupForm.svelte"],"names":[],"mappings":"AAyBC,KAAK,gBAAgB,GAAI;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAsGH,QAAA,MAAM,UAAU,sDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -101,7 +101,6 @@ export declare class AdminAccountsState {
|
|
|
101
101
|
#private;
|
|
102
102
|
readonly list: AsyncSlot<void, string>;
|
|
103
103
|
readonly grant: KeyedAsyncSlot<string, {
|
|
104
|
-
message: string | null;
|
|
105
104
|
id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
106
105
|
created_at: string;
|
|
107
106
|
expires_at: string;
|
|
@@ -109,6 +108,7 @@ export declare class AdminAccountsState {
|
|
|
109
108
|
scope_kind: string | null;
|
|
110
109
|
scope_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
111
110
|
from_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
111
|
+
message: string | null;
|
|
112
112
|
to_account_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
113
113
|
to_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
114
114
|
accepted_at: string | null;
|
|
@@ -118,10 +118,10 @@ export declare class AdminAccountsState {
|
|
|
118
118
|
superseded_at: string | null;
|
|
119
119
|
resulting_role_grant_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
120
120
|
}, string>;
|
|
121
|
-
readonly revoke: KeyedAsyncSlot<
|
|
122
|
-
readonly retract: KeyedAsyncSlot<
|
|
123
|
-
readonly soft_delete: KeyedAsyncSlot<
|
|
124
|
-
readonly undelete: KeyedAsyncSlot<
|
|
121
|
+
readonly revoke: KeyedAsyncSlot<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, void, string>;
|
|
122
|
+
readonly retract: KeyedAsyncSlot<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, void, string>;
|
|
123
|
+
readonly soft_delete: KeyedAsyncSlot<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, void, string>;
|
|
124
|
+
readonly undelete: KeyedAsyncSlot<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, void, string>;
|
|
125
125
|
accounts: Array<AdminAccountEntryJson>;
|
|
126
126
|
grantable_roles: Array<RoleName>;
|
|
127
127
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_accounts_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_accounts_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,KAAK,qBAAqB,EAAmB,MAAM,2BAA2B,CAAC;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EACX,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,0CAA0C,CAAC;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,gBAAgB;IAChC,aAAa,EAAE,CAAC,MAAM,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACnF,cAAc,EAAE,CACf,MAAM,EAAE,kBAAkB,GAAG;QAAE,UAAU,EAAE,IAAI,CAAA;KAAE,KAC7C,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClC,gBAAgB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,aAAa,EAAE,CAAC,MAAM,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACnF,iBAAiB,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC9F,iBAAiB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpF,aAAa,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC5F,kBAAkB,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACjG,gBAAgB,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC3F;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B;2CAAwB,gBAAgB;4BAAhB,gBAAgB;uBAAhB,gBAAgB,WAAhB,gBAAgB;CAAG,CAAC;AAEnF,MAAM,WAAW,yBAAyB;IACzC;;;;;OAKG;IACH,OAAO,EAAE,MAAM,gBAAgB,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,YAAY,IAAI,EAAE,MAAM,QAAQ,EAAE,cAAc,IAAI,GAAG,IAAI,KAAG,MACT,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GACjC,OAAO,IAAI,CAAC,qBAAqB,EAAE,aAAa,GAAG,gBAAgB,CAAC,EACpE,MAAM,MAAM,EACZ,MAAK,IAAiB,KACpB,OAEuE,CAAC;AAE3E,qBAAa,kBAAkB;;IAG9B,QAAQ,CAAC,IAAI,0BAAyB;IACtC,QAAQ,CAAC,KAAK;;;;;;;;;;;;;;;;;eAAoD;IAClE,QAAQ,CAAC,MAAM
|
|
1
|
+
{"version":3,"file":"admin_accounts_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_accounts_state.svelte.ts"],"names":[],"mappings":"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"}
|
|
@@ -48,7 +48,7 @@ export declare class AdminInvitesState {
|
|
|
48
48
|
#private;
|
|
49
49
|
readonly list: AsyncSlot<void, string>;
|
|
50
50
|
readonly create: AsyncSlot<void, string>;
|
|
51
|
-
readonly remove: KeyedAsyncSlot<
|
|
51
|
+
readonly remove: KeyedAsyncSlot<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, void, string>;
|
|
52
52
|
invites: Array<InviteWithUsernamesJson>;
|
|
53
53
|
readonly invite_count: number;
|
|
54
54
|
readonly unclaimed_count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_invites_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_invites_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,MAAM,+BAA+B,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9D,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACnE,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACnE;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;2CAAwB,eAAe;4BAAf,eAAe;uBAAf,eAAe,WAAf,eAAe;CAAG,CAAC;AAEjF,MAAM,WAAW,wBAAwB;IACxC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,eAAe,CAAC;CAC/B;AAED,qBAAa,iBAAiB;;IAG7B,QAAQ,CAAC,IAAI,0BAAyB;IACtC,QAAQ,CAAC,MAAM,0BAAyB;IACxC,QAAQ,CAAC,MAAM
|
|
1
|
+
{"version":3,"file":"admin_invites_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_invites_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,MAAM,+BAA+B,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9D,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACnE,MAAM,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACnE;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;2CAAwB,eAAe;4BAAf,eAAe;uBAAf,eAAe,WAAf,eAAe;CAAG,CAAC;AAEjF,MAAM,WAAW,wBAAwB;IACxC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,eAAe,CAAC;CAC/B;AAED,qBAAa,iBAAiB;;IAG7B,QAAQ,CAAC,IAAI,0BAAyB;IACtC,QAAQ,CAAC,MAAM,0BAAyB;IACxC,QAAQ,CAAC,MAAM,+FAAoC;IAEnD,OAAO,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAkB;IAEzD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAiC;IAC9D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAA8D;gBAElF,OAAO,EAAE,wBAAwB;IAIvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtB,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASlE,aAAa,CAAC,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5C"}
|
|
@@ -36,8 +36,8 @@ export interface AdminSessionsStateOptions {
|
|
|
36
36
|
export declare class AdminSessionsState {
|
|
37
37
|
#private;
|
|
38
38
|
readonly list: AsyncSlot<void, string>;
|
|
39
|
-
readonly revoke_sessions: KeyedAsyncSlot<
|
|
40
|
-
readonly revoke_tokens: KeyedAsyncSlot<
|
|
39
|
+
readonly revoke_sessions: KeyedAsyncSlot<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, void, string>;
|
|
40
|
+
readonly revoke_tokens: KeyedAsyncSlot<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, void, string>;
|
|
41
41
|
sessions: Array<AdminSessionJson>;
|
|
42
42
|
readonly active_count: number;
|
|
43
43
|
constructor(options: AdminSessionsStateOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_sessions_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_sessions_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,OAAO,EAAE,MAAM,gBAAgB,CAAC;CAChC;AAED,qBAAa,kBAAkB;;IAG9B,QAAQ,CAAC,IAAI,0BAAyB;IACtC,QAAQ,CAAC,eAAe
|
|
1
|
+
{"version":3,"file":"admin_sessions_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/admin_sessions_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,OAAO,EAAE,MAAM,gBAAgB,CAAC;CAChC;AAED,qBAAa,kBAAkB;;IAG9B,QAAQ,CAAC,IAAI,0BAAyB;IACtC,QAAQ,CAAC,eAAe,+FAAoC;IAC5D,QAAQ,CAAC,aAAa,+FAAoC;IAE1D,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAkB;IAEnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAkC;gBAEnD,OAAO,EAAE,yBAAyB;IAIxC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtB,sBAAsB,CAAC,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvD,oBAAoB,CAAC,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAM3D"}
|
|
@@ -99,7 +99,6 @@ export declare class RoleGrantOffersState {
|
|
|
99
99
|
readonly list: AsyncSlot<void, string>;
|
|
100
100
|
readonly list_history: AsyncSlot<void, string>;
|
|
101
101
|
readonly create: AsyncSlot<{
|
|
102
|
-
message: string | null;
|
|
103
102
|
id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
104
103
|
created_at: string;
|
|
105
104
|
expires_at: string;
|
|
@@ -107,6 +106,7 @@ export declare class RoleGrantOffersState {
|
|
|
107
106
|
scope_kind: string | null;
|
|
108
107
|
scope_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
109
108
|
from_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
109
|
+
message: string | null;
|
|
110
110
|
to_account_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">;
|
|
111
111
|
to_actor_id: import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid"> | null;
|
|
112
112
|
accepted_at: string | null;
|
package/dist/zod.d.ts
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Zod schema introspection utilities.
|
|
3
3
|
*
|
|
4
|
-
* Generic helpers for walking, unwrapping, and extracting field info from Zod schemas
|
|
5
|
-
*
|
|
6
|
-
* checks
|
|
4
|
+
* Generic helpers for walking, unwrapping, and extracting field info from Zod schemas,
|
|
5
|
+
* and `zod_has_trait`, the structural `instanceof`. Used by adversarial input
|
|
6
|
+
* testing, test-data generation, auth-shape checks, and the dual-library layer
|
|
7
|
+
* (`schema_issues.ts`, `http/schema_helpers.ts`). Imports Zod's types only, so
|
|
8
|
+
* an importer loads no Zod.
|
|
7
9
|
*
|
|
8
10
|
* @module
|
|
9
11
|
*/
|
|
10
12
|
import type { z } from 'zod';
|
|
13
|
+
/**
|
|
14
|
+
* Whether `value` carries the Zod trait `trait` — what Zod's own
|
|
15
|
+
* `instanceof` reads (`value._zod.traits.has(trait)`), so it answers as
|
|
16
|
+
* `value instanceof z[trait]` would, a schema made by another copy of Zod
|
|
17
|
+
* included, without importing Zod at runtime. The classic API's names are the
|
|
18
|
+
* classes' (`'ZodType'`, `'ZodObject'`, `'ZodNull'`, `'ZodError'`), the core's
|
|
19
|
+
* `$`-prefixed (`'$ZodType'`).
|
|
20
|
+
*
|
|
21
|
+
* @param value - any value
|
|
22
|
+
* @param trait - the Zod class name to test for
|
|
23
|
+
* @returns whether `value` is an instance of that Zod class
|
|
24
|
+
*/
|
|
25
|
+
export declare const zod_has_trait: (value: unknown, trait: string) => boolean;
|
|
11
26
|
/**
|
|
12
27
|
* Unwrap Zod wrappers (optional, default, nullable, pipe, transform)
|
|
13
28
|
* to get the base type definition.
|
package/dist/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/zod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/zod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,EAAE,OAAO,MAAM,KAAG,OAM7D,CAAC;AAgCF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,IAAI,CAAC,WAOzD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,MAAqC,CAAC;AAgC5F;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAM5D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAUxE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EACtD,QAAQ,CAAC,KACP,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAGjC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GACtC,QAAQ,CAAC,CAAC,OAAO,EACjB,KAAK,MAAM,KACT,CAAC,CAAC,OAAO,GAAG,SAGd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,CAAC,CAAC,OAAO,EAAE,KAAK,MAAM,KAAG,CAAC,CAAC,OAIvE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,SAAS,GAAG,IAUtE,CAAC;AAIF;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC/B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;OAQG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,6GAA6G;IAC7G,QAAQ,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,WAAW,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,CAAC,CAAC,SAAS,KAAG,KAAK,CAAC,eAAe,CAa7E,CAAC"}
|
package/dist/zod.js
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Zod schema introspection utilities.
|
|
3
3
|
*
|
|
4
|
-
* Generic helpers for walking, unwrapping, and extracting field info from Zod schemas
|
|
5
|
-
*
|
|
6
|
-
* checks
|
|
4
|
+
* Generic helpers for walking, unwrapping, and extracting field info from Zod schemas,
|
|
5
|
+
* and `zod_has_trait`, the structural `instanceof`. Used by adversarial input
|
|
6
|
+
* testing, test-data generation, auth-shape checks, and the dual-library layer
|
|
7
|
+
* (`schema_issues.ts`, `http/schema_helpers.ts`). Imports Zod's types only, so
|
|
8
|
+
* an importer loads no Zod.
|
|
7
9
|
*
|
|
8
10
|
* @module
|
|
9
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* Whether `value` carries the Zod trait `trait` — what Zod's own
|
|
14
|
+
* `instanceof` reads (`value._zod.traits.has(trait)`), so it answers as
|
|
15
|
+
* `value instanceof z[trait]` would, a schema made by another copy of Zod
|
|
16
|
+
* included, without importing Zod at runtime. The classic API's names are the
|
|
17
|
+
* classes' (`'ZodType'`, `'ZodObject'`, `'ZodNull'`, `'ZodError'`), the core's
|
|
18
|
+
* `$`-prefixed (`'$ZodType'`).
|
|
19
|
+
*
|
|
20
|
+
* @param value - any value
|
|
21
|
+
* @param trait - the Zod class name to test for
|
|
22
|
+
* @returns whether `value` is an instance of that Zod class
|
|
23
|
+
*/
|
|
24
|
+
export const zod_has_trait = (value, trait) => {
|
|
25
|
+
if (value === null || (typeof value !== 'object' && typeof value !== 'function'))
|
|
26
|
+
return false;
|
|
27
|
+
const internals = value._zod;
|
|
28
|
+
if (internals === null || typeof internals !== 'object')
|
|
29
|
+
return false;
|
|
30
|
+
const traits = internals.traits;
|
|
31
|
+
return traits instanceof Set && traits.has(trait);
|
|
32
|
+
};
|
|
10
33
|
//
|
|
11
34
|
// Schema Introspection
|
|
12
35
|
//
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Zod forms of the primitives a consumer's Zod schema embeds: `ZodUuid`,
|
|
3
|
+
* `ZodUuidWithDefault`, `ZodFactHashSchema`, `ZodUsername`, `ZodEmail`, and
|
|
4
|
+
* `ZodActingActor`, each built on the grammar of its `@fuzdev/fuz_schema`
|
|
5
|
+
* twin in `primitive_schemas.ts` and sharing its output type, so a value
|
|
6
|
+
* parsed by either goes where the other's is taken; and the branded
|
|
7
|
+
* `Datetime`, with `DatetimeNow` and `get_datetime_now`, which has no twin
|
|
8
|
+
* (`Timestamp` is the wire timestamp).
|
|
9
|
+
*
|
|
10
|
+
* fuz_app's own schemas are fuz_schema; this module is for apps whose schemas
|
|
11
|
+
* are still Zod, which the action and route layers accept. It is the one
|
|
12
|
+
* fuz_app module that imports Zod at runtime, so only an importer of it loads
|
|
13
|
+
* Zod.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import type { Branded } from '@fuzdev/fuz_schema/schema.ts';
|
|
19
|
+
import { type FactHash } from '@fuzdev/fuz_util/hash_schemas.ts';
|
|
20
|
+
/**
|
|
21
|
+
* The Zod form of `Username`: the same bounds and grammar, output in
|
|
22
|
+
* lowercase. Every input gets the same verdict and output from both; a string
|
|
23
|
+
* outside the bounds and off the grammar gets the grammar issue after the
|
|
24
|
+
* length one, where `Username` gives the length issue alone.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ZodUsername: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
27
|
+
export type ZodUsername = z.infer<typeof ZodUsername>;
|
|
28
|
+
/**
|
|
29
|
+
* The Zod form of `Email`: at most `EMAIL_LENGTH_MAX` UTF-8 bytes, then
|
|
30
|
+
* `EMAIL_REGEX`, no transform. Every input gets the same verdict and output
|
|
31
|
+
* from both. The byte bound runs first and aborts, so an address past it gets
|
|
32
|
+
* the length issue alone, a Zod `custom` issue with `EMAIL_LENGTH_MESSAGE`,
|
|
33
|
+
* and is never read by the regex; its JSON Schema is the `pattern` alone,
|
|
34
|
+
* where `Email`'s adds the bound as `maxLength`.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ZodEmail: z.ZodString;
|
|
37
|
+
export type ZodEmail = z.infer<typeof ZodEmail>;
|
|
38
|
+
/**
|
|
39
|
+
* The Zod form of `Uuid`: `z.uuid()` with `UUID_REGEX` as its `pattern` — the
|
|
40
|
+
* max UUID in any case, as RFC 9562 §4 and the Rust spine's `is_valid_uuid`
|
|
41
|
+
* read it — output in lowercase. Every input gets the same verdict and output
|
|
42
|
+
* from both, and their JSON Schema is the same. Issues and JSON Schema keep
|
|
43
|
+
* `format: 'uuid'`; only the `pattern` differs from a bare `z.uuid()`'s.
|
|
44
|
+
*
|
|
45
|
+
* `pattern` is a `$ZodUUIDDef` field that `z.uuid()` honors (its default
|
|
46
|
+
* applies only when none is given) but whose public params type omits it,
|
|
47
|
+
* hence the cast on the params.
|
|
48
|
+
*
|
|
49
|
+
* `.toLowerCase()` rather than `.transform()`: an overwrite keeps the output
|
|
50
|
+
* type and stays invisible to JSON Schema, where a transform would leave no
|
|
51
|
+
* input schema to render.
|
|
52
|
+
*
|
|
53
|
+
* The output type is fuz_schema's `Branded<string, 'Uuid'>`, `Uuid`'s, by a
|
|
54
|
+
* cast: Zod's `.brand('Uuid')` would output Zod's own brand, which a
|
|
55
|
+
* fuz_schema `Uuid` isn't assignable to.
|
|
56
|
+
*/
|
|
57
|
+
export declare const ZodUuid: z.ZodUUID & z.ZodType<Branded<string, 'Uuid'>, string>;
|
|
58
|
+
export type ZodUuid = z.infer<typeof ZodUuid>;
|
|
59
|
+
/** `ZodUuid` that defaults to a fresh `create_uuid()` when the input is `undefined`. */
|
|
60
|
+
export declare const ZodUuidWithDefault: z.ZodDefault<z.ZodUUID & z.ZodType<Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<Branded<string, "Uuid">, string>>>;
|
|
61
|
+
export type ZodUuidWithDefault = z.infer<typeof ZodUuidWithDefault>;
|
|
62
|
+
/**
|
|
63
|
+
* Branded datetime schema, zod's default `z.iso.datetime()`: an RFC 3339 date
|
|
64
|
+
* and time in UTC with a real calendar date, `Z` and no offset, and a fraction
|
|
65
|
+
* of any length or none. Zod 4.6 requires the seconds; earlier zod 4, which
|
|
66
|
+
* the `zod` peer range admits, also takes `HH:MMZ`. `Timestamp` is this
|
|
67
|
+
* grammar with the seconds required and the fraction capped at 9 digits, and
|
|
68
|
+
* not branded.
|
|
69
|
+
*/
|
|
70
|
+
export declare const Datetime: z.core.$ZodBranded<z.ZodISODateTime, "Datetime", "out">;
|
|
71
|
+
export type Datetime = z.infer<typeof Datetime>;
|
|
72
|
+
/** Returns an ISO 8601 datetime string for the current time. */
|
|
73
|
+
export declare const get_datetime_now: () => Datetime;
|
|
74
|
+
/** `Datetime` that defaults to `get_datetime_now()` when the input is `undefined`. */
|
|
75
|
+
export declare const DatetimeNow: z.ZodDefault<z.core.$ZodBranded<z.ZodISODateTime, "Datetime", "out">>;
|
|
76
|
+
export type DatetimeNow = z.infer<typeof DatetimeNow>;
|
|
77
|
+
/**
|
|
78
|
+
* The Zod form of `FactHashSchema`: `FACT_HASH_EXACT`, its output fuz_util's
|
|
79
|
+
* `FactHash`, so a parsed value passes straight to `fact_hash_bytes`,
|
|
80
|
+
* `fact_hash_stream`, and `FactStore`. The two agree on every input, and
|
|
81
|
+
* their JSON Schema is the same `pattern`.
|
|
82
|
+
*
|
|
83
|
+
* The output type is a cast over a plain regex check: Zod's
|
|
84
|
+
* `.brand('FactHash')` would output Zod's own brand, which doesn't fit
|
|
85
|
+
* fuz_util's fuz_schema-branded `FactHash`, and a `.transform` or `z.custom`
|
|
86
|
+
* that produced the right type has no JSON Schema form. The cast costs
|
|
87
|
+
* nothing at runtime and keeps the `ZodString` API and the `pattern`, so
|
|
88
|
+
* `.meta()`, `.nullable()`, and `z.array()` compose as before.
|
|
89
|
+
*/
|
|
90
|
+
export declare const ZodFactHashSchema: z.ZodString & z.ZodType<FactHash, string>;
|
|
91
|
+
/**
|
|
92
|
+
* The Zod form of `ActingActor`, for a Zod input that needs the caller's
|
|
93
|
+
* acting actor: an optional `ZodUuid` carrying `ACTING_ACTOR_DESCRIPTION`.
|
|
94
|
+
* `ActingActor`'s doc has the resolution rules. The dispatcher finds it by
|
|
95
|
+
* reference, as it does `ActingActor`, so an input declares this export, not
|
|
96
|
+
* a copy of it.
|
|
97
|
+
*/
|
|
98
|
+
export declare const ZodActingActor: z.ZodOptional<z.ZodUUID & z.ZodType<Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<Branded<string, "Uuid">, string>>>;
|
|
99
|
+
export type ZodActingActor = z.infer<typeof ZodActingActor>;
|
|
100
|
+
//# sourceMappingURL=zod_schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/zod_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;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;AAyElF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,wDAEW,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,aAGD,CAAC;AACrB,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAEF,CAAC;AAC1E,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C,wFAAwF;AACxF,eAAO,MAAM,kBAAkB,iIAA+B,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,yDAAqC,CAAC;AAC3D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,QAAO,QAAgD,CAAC;AAErF,sFAAsF;AACtF,eAAO,MAAM,WAAW,uEAAqC,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAEH,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,kIAAqE,CAAC;AACjG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Zod forms of the primitives a consumer's Zod schema embeds: `ZodUuid`,
|
|
3
|
+
* `ZodUuidWithDefault`, `ZodFactHashSchema`, `ZodUsername`, `ZodEmail`, and
|
|
4
|
+
* `ZodActingActor`, each built on the grammar of its `@fuzdev/fuz_schema`
|
|
5
|
+
* twin in `primitive_schemas.ts` and sharing its output type, so a value
|
|
6
|
+
* parsed by either goes where the other's is taken; and the branded
|
|
7
|
+
* `Datetime`, with `DatetimeNow` and `get_datetime_now`, which has no twin
|
|
8
|
+
* (`Timestamp` is the wire timestamp).
|
|
9
|
+
*
|
|
10
|
+
* fuz_app's own schemas are fuz_schema; this module is for apps whose schemas
|
|
11
|
+
* are still Zod, which the action and route layers accept. It is the one
|
|
12
|
+
* fuz_app module that imports Zod at runtime, so only an importer of it loads
|
|
13
|
+
* Zod.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { FACT_HASH_EXACT } from '@fuzdev/fuz_util/hash_schemas.ts';
|
|
19
|
+
import { ACTING_ACTOR_DESCRIPTION, create_uuid, EMAIL_LENGTH_MESSAGE, EMAIL_REGEX, is_email_within_length_max, USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN, USERNAME_REGEX, UUID_REGEX } from './primitive_schemas.js';
|
|
20
|
+
import { register_zod_acting_actor } from './http/auth_shape.js';
|
|
21
|
+
/**
|
|
22
|
+
* A Zod string bounded in UTF-16 code units, `ZodUsername`'s length check.
|
|
23
|
+
*
|
|
24
|
+
* Zod's `.min()` / `.max()` alone don't pin the unit: depending on the
|
|
25
|
+
* installed Zod they count code units or Unicode code points, and the peer
|
|
26
|
+
* range admits both. The schema still carries them — they are what puts
|
|
27
|
+
* `minLength` / `maxLength` in the generated JSON Schema — and a check beside
|
|
28
|
+
* them settles the verdict on `String.length`: it adds the over-`max` or
|
|
29
|
+
* under-`min` issue when Zod raised none, and withdraws one Zod raised for a
|
|
30
|
+
* string that is within the bound in units. The issue it adds has the fields
|
|
31
|
+
* of Zod's own and, like Zod's, lets the checks chained after it run, so a
|
|
32
|
+
* refusal reads the same whichever count Zod used.
|
|
33
|
+
*/
|
|
34
|
+
const zod_bounded_string = (min, max) => z
|
|
35
|
+
.string()
|
|
36
|
+
.min(min)
|
|
37
|
+
.max(max)
|
|
38
|
+
.check((ctx) => {
|
|
39
|
+
const { length } = ctx.value;
|
|
40
|
+
const { issues } = ctx;
|
|
41
|
+
const too_big = issues.findIndex((i) => i.code === 'too_big' && i.origin === 'string' && i.maximum === max);
|
|
42
|
+
if (length > max) {
|
|
43
|
+
if (too_big === -1) {
|
|
44
|
+
issues.push({
|
|
45
|
+
origin: 'string',
|
|
46
|
+
code: 'too_big',
|
|
47
|
+
maximum: max,
|
|
48
|
+
inclusive: true,
|
|
49
|
+
input: ctx.value,
|
|
50
|
+
// as on Zod's own length issues: the checks chained after still run
|
|
51
|
+
continue: true
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else if (too_big !== -1) {
|
|
56
|
+
issues.splice(too_big, 1);
|
|
57
|
+
}
|
|
58
|
+
const too_small = issues.findIndex((i) => i.code === 'too_small' && i.origin === 'string' && i.minimum === min);
|
|
59
|
+
if (length < min) {
|
|
60
|
+
if (too_small === -1) {
|
|
61
|
+
issues.push({
|
|
62
|
+
origin: 'string',
|
|
63
|
+
code: 'too_small',
|
|
64
|
+
minimum: min,
|
|
65
|
+
inclusive: true,
|
|
66
|
+
input: ctx.value,
|
|
67
|
+
continue: true
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else if (too_small !== -1) {
|
|
72
|
+
issues.splice(too_small, 1);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* The Zod form of `Username`: the same bounds and grammar, output in
|
|
77
|
+
* lowercase. Every input gets the same verdict and output from both; a string
|
|
78
|
+
* outside the bounds and off the grammar gets the grammar issue after the
|
|
79
|
+
* length one, where `Username` gives the length issue alone.
|
|
80
|
+
*/
|
|
81
|
+
export const ZodUsername = zod_bounded_string(USERNAME_LENGTH_MIN, USERNAME_LENGTH_MAX)
|
|
82
|
+
.regex(USERNAME_REGEX)
|
|
83
|
+
.transform((s) => s.toLowerCase());
|
|
84
|
+
/**
|
|
85
|
+
* The Zod form of `Email`: at most `EMAIL_LENGTH_MAX` UTF-8 bytes, then
|
|
86
|
+
* `EMAIL_REGEX`, no transform. Every input gets the same verdict and output
|
|
87
|
+
* from both. The byte bound runs first and aborts, so an address past it gets
|
|
88
|
+
* the length issue alone, a Zod `custom` issue with `EMAIL_LENGTH_MESSAGE`,
|
|
89
|
+
* and is never read by the regex; its JSON Schema is the `pattern` alone,
|
|
90
|
+
* where `Email`'s adds the bound as `maxLength`.
|
|
91
|
+
*/
|
|
92
|
+
export const ZodEmail = z
|
|
93
|
+
.string()
|
|
94
|
+
.refine(is_email_within_length_max, { message: EMAIL_LENGTH_MESSAGE, abort: true })
|
|
95
|
+
.regex(EMAIL_REGEX);
|
|
96
|
+
/**
|
|
97
|
+
* The Zod form of `Uuid`: `z.uuid()` with `UUID_REGEX` as its `pattern` — the
|
|
98
|
+
* max UUID in any case, as RFC 9562 §4 and the Rust spine's `is_valid_uuid`
|
|
99
|
+
* read it — output in lowercase. Every input gets the same verdict and output
|
|
100
|
+
* from both, and their JSON Schema is the same. Issues and JSON Schema keep
|
|
101
|
+
* `format: 'uuid'`; only the `pattern` differs from a bare `z.uuid()`'s.
|
|
102
|
+
*
|
|
103
|
+
* `pattern` is a `$ZodUUIDDef` field that `z.uuid()` honors (its default
|
|
104
|
+
* applies only when none is given) but whose public params type omits it,
|
|
105
|
+
* hence the cast on the params.
|
|
106
|
+
*
|
|
107
|
+
* `.toLowerCase()` rather than `.transform()`: an overwrite keeps the output
|
|
108
|
+
* type and stays invisible to JSON Schema, where a transform would leave no
|
|
109
|
+
* input schema to render.
|
|
110
|
+
*
|
|
111
|
+
* The output type is fuz_schema's `Branded<string, 'Uuid'>`, `Uuid`'s, by a
|
|
112
|
+
* cast: Zod's `.brand('Uuid')` would output Zod's own brand, which a
|
|
113
|
+
* fuz_schema `Uuid` isn't assignable to.
|
|
114
|
+
*/
|
|
115
|
+
export const ZodUuid = z
|
|
116
|
+
.uuid({ pattern: UUID_REGEX })
|
|
117
|
+
.toLowerCase();
|
|
118
|
+
/** `ZodUuid` that defaults to a fresh `create_uuid()` when the input is `undefined`. */
|
|
119
|
+
export const ZodUuidWithDefault = ZodUuid.default(create_uuid);
|
|
120
|
+
/**
|
|
121
|
+
* Branded datetime schema, zod's default `z.iso.datetime()`: an RFC 3339 date
|
|
122
|
+
* and time in UTC with a real calendar date, `Z` and no offset, and a fraction
|
|
123
|
+
* of any length or none. Zod 4.6 requires the seconds; earlier zod 4, which
|
|
124
|
+
* the `zod` peer range admits, also takes `HH:MMZ`. `Timestamp` is this
|
|
125
|
+
* grammar with the seconds required and the fraction capped at 9 digits, and
|
|
126
|
+
* not branded.
|
|
127
|
+
*/
|
|
128
|
+
export const Datetime = z.iso.datetime().brand('Datetime');
|
|
129
|
+
/** Returns an ISO 8601 datetime string for the current time. */
|
|
130
|
+
export const get_datetime_now = () => new Date().toISOString();
|
|
131
|
+
/** `Datetime` that defaults to `get_datetime_now()` when the input is `undefined`. */
|
|
132
|
+
export const DatetimeNow = Datetime.default(get_datetime_now);
|
|
133
|
+
/**
|
|
134
|
+
* The Zod form of `FactHashSchema`: `FACT_HASH_EXACT`, its output fuz_util's
|
|
135
|
+
* `FactHash`, so a parsed value passes straight to `fact_hash_bytes`,
|
|
136
|
+
* `fact_hash_stream`, and `FactStore`. The two agree on every input, and
|
|
137
|
+
* their JSON Schema is the same `pattern`.
|
|
138
|
+
*
|
|
139
|
+
* The output type is a cast over a plain regex check: Zod's
|
|
140
|
+
* `.brand('FactHash')` would output Zod's own brand, which doesn't fit
|
|
141
|
+
* fuz_util's fuz_schema-branded `FactHash`, and a `.transform` or `z.custom`
|
|
142
|
+
* that produced the right type has no JSON Schema form. The cast costs
|
|
143
|
+
* nothing at runtime and keeps the `ZodString` API and the `pattern`, so
|
|
144
|
+
* `.meta()`, `.nullable()`, and `z.array()` compose as before.
|
|
145
|
+
*/
|
|
146
|
+
export const ZodFactHashSchema = z
|
|
147
|
+
.string()
|
|
148
|
+
.regex(FACT_HASH_EXACT);
|
|
149
|
+
/**
|
|
150
|
+
* The Zod form of `ActingActor`, for a Zod input that needs the caller's
|
|
151
|
+
* acting actor: an optional `ZodUuid` carrying `ACTING_ACTOR_DESCRIPTION`.
|
|
152
|
+
* `ActingActor`'s doc has the resolution rules. The dispatcher finds it by
|
|
153
|
+
* reference, as it does `ActingActor`, so an input declares this export, not
|
|
154
|
+
* a copy of it.
|
|
155
|
+
*/
|
|
156
|
+
export const ZodActingActor = ZodUuid.optional().meta({ description: ACTING_ACTOR_DESCRIPTION });
|
|
157
|
+
register_zod_acting_actor(ZodActingActor);
|