@fuzdev/fuz_app 0.161.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.
Files changed (63) hide show
  1. package/dist/auth/CLAUDE.md +16 -8
  2. package/dist/auth/account_action_specs.d.ts +173 -35
  3. package/dist/auth/account_action_specs.d.ts.map +1 -1
  4. package/dist/auth/account_action_specs.js +10 -7
  5. package/dist/auth/account_route_schema.d.ts +293 -46
  6. package/dist/auth/account_route_schema.d.ts.map +1 -1
  7. package/dist/auth/account_route_schema.js +5 -4
  8. package/dist/auth/account_schema.d.ts +489 -103
  9. package/dist/auth/account_schema.d.ts.map +1 -1
  10. package/dist/auth/account_schema.js +67 -47
  11. package/dist/auth/admin_action_specs.d.ts +1753 -240
  12. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  13. package/dist/auth/admin_action_specs.js +29 -25
  14. package/dist/auth/audit_emitter.d.ts +8 -3
  15. package/dist/auth/audit_emitter.d.ts.map +1 -1
  16. package/dist/auth/audit_emitter.js +32 -9
  17. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  18. package/dist/auth/audit_log_queries.js +4 -3
  19. package/dist/auth/audit_log_schema.d.ts +786 -259
  20. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  21. package/dist/auth/audit_log_schema.js +188 -201
  22. package/dist/auth/audit_log_schema_fuz.d.ts +17 -3
  23. package/dist/auth/audit_log_schema_fuz.d.ts.map +1 -1
  24. package/dist/auth/audit_log_schema_fuz.js +17 -4
  25. package/dist/auth/credential_type_schema.d.ts +1 -1
  26. package/dist/auth/invite_schema.d.ts +98 -26
  27. package/dist/auth/invite_schema.d.ts.map +1 -1
  28. package/dist/auth/invite_schema.js +21 -14
  29. package/dist/auth/migrations.d.ts.map +1 -1
  30. package/dist/auth/migrations.js +27 -0
  31. package/dist/auth/role_grant_offer_action_specs.d.ts +72 -72
  32. package/dist/auth/role_grant_offer_notifications.d.ts +60 -60
  33. package/dist/auth/role_grant_offer_schema.d.ts +6 -6
  34. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  35. package/dist/auth/role_grant_offer_schema.js +8 -8
  36. package/dist/dev/setup.d.ts +14 -7
  37. package/dist/dev/setup.d.ts.map +1 -1
  38. package/dist/dev/setup.js +11 -6
  39. package/dist/primitive_schemas.d.ts +1 -4
  40. package/dist/primitive_schemas.d.ts.map +1 -1
  41. package/dist/primitive_schemas.js +1 -5
  42. package/dist/primitive_schemas_fuz.d.ts +36 -2
  43. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  44. package/dist/primitive_schemas_fuz.js +34 -3
  45. package/dist/testing/CLAUDE.md +7 -3
  46. package/dist/testing/app_server.d.ts +3 -1
  47. package/dist/testing/app_server.d.ts.map +1 -1
  48. package/dist/testing/app_server.js +6 -2
  49. package/dist/testing/audit_drift_guard.d.ts.map +1 -1
  50. package/dist/testing/audit_drift_guard.js +12 -13
  51. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  52. package/dist/testing/cross_backend/identity_parity.js +4 -2
  53. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  54. package/dist/testing/cross_backend/session_cap.js +4 -3
  55. package/dist/testing/db_entities.d.ts +3 -1
  56. package/dist/testing/db_entities.d.ts.map +1 -1
  57. package/dist/testing/db_entities.js +4 -2
  58. package/dist/testing/integration.d.ts.map +1 -1
  59. package/dist/testing/integration.js +3 -2
  60. package/dist/zod.d.ts +2 -1
  61. package/dist/zod.d.ts.map +1 -1
  62. package/dist/zod.js +6 -2
  63. package/package.json +1 -1
@@ -2,7 +2,9 @@
2
2
  * `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `Username`,
3
3
  * `Email`, `Uuid`, `UuidWithDefault` (`primitive_schemas.ts`), and
4
4
  * `ActingActor` (`http/auth_shape.ts`), under the same names, for schemas
5
- * written in fuz_schema.
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 exports are `@nodocs` while the Zod schemas of the same names stay, as
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
@@ -43,6 +45,20 @@ export declare const bounded_string: (options: BoundedStringOptions) => PipeSche
43
45
  export declare const Username: PipeSchema<string, PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
44
46
  /** @nodocs */
45
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>;
46
62
  /**
47
63
  * Email validation, the twin of the Zod `Email`: `EMAIL_REGEX` and at most
48
64
  * `EMAIL_LENGTH_MAX` UTF-8 bytes, no transform. The `max_length` ahead of the
@@ -89,6 +105,24 @@ export declare const UuidWithDefault: import("@fuzdev/fuz_schema/schema.ts").Sch
89
105
  }>>;
90
106
  /** @nodocs */
91
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>;
92
126
  /** The `description` both `ActingActor` twins carry. */
93
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.";
94
128
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"primitive_schemas_fuz.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas_fuz.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EASN,MAAM,EAIN,KAAK,KAAK,EACV,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EASN,KAAK,oBAAoB,EACzB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAC1B,SAAS,oBAAoB,KAC3B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W,CAAC,CAAC"}
@@ -2,7 +2,9 @@
2
2
  * `@fuzdev/fuz_schema` twins of the Zod `bounded_string`, `Username`,
3
3
  * `Email`, `Uuid`, `UuidWithDefault` (`primitive_schemas.ts`), and
4
4
  * `ActingActor` (`http/auth_shape.ts`), under the same names, for schemas
5
- * written in fuz_schema.
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,13 +14,13 @@
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 exports are `@nodocs` while the Zod schemas of the same names stay, as
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
19
21
  */
20
22
  import { meta } from '@fuzdev/fuz_schema/meta.ts';
21
- import { brand, check, max_length, message, min_length, optional, pipe, regex, string, to_lower_case, uuid, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
23
+ import { brand, check, iso_datetime, max_length, message, min_length, optional, pipe, regex, string, to_lower_case, uuid, with_default_fn } from '@fuzdev/fuz_schema/schema.ts';
22
24
  import { create_uuid, EMAIL_LENGTH_MAX, EMAIL_LENGTH_MESSAGE, EMAIL_REGEX, is_email_within_length_max, USERNAME_LENGTH_MAX, USERNAME_LENGTH_MIN, USERNAME_REGEX } from './primitive_schemas.js';
23
25
  /**
24
26
  * A string schema whose length is bounded in UTF-16 code units, the twin of
@@ -46,6 +48,19 @@ export const bounded_string = (options) => {
46
48
  * @nodocs
47
49
  */
48
50
  export const Username = pipe(bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX }), regex(USERNAME_REGEX), to_lower_case);
51
+ /**
52
+ * A username's canonical grammar, `USERNAME_REGEX` in lowercase: a lowercase
53
+ * letter, then lowercase letters, digits, `_` or `-`, ending in a lowercase
54
+ * letter or digit. What `Username` outputs, and what an `account` row holds
55
+ * (its `account_username_lowercase` CHECK).
56
+ */
57
+ export const USERNAME_CANONICAL_REGEX = /^[a-z][0-9a-z_-]*[0-9a-z]$/;
58
+ /**
59
+ * A username as an account row holds it, the `username` of an output: the
60
+ * bounds of `Username` and `USERNAME_CANONICAL_REGEX`, no transform. A
61
+ * username in any other case fails, where the Zod `Username` lowercased it.
62
+ */
63
+ export const UsernameCanonical = pipe(bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX }), regex(USERNAME_CANONICAL_REGEX));
49
64
  /**
50
65
  * Email validation, the twin of the Zod `Email`: `EMAIL_REGEX` and at most
51
66
  * `EMAIL_LENGTH_MAX` UTF-8 bytes, no transform. The `max_length` ahead of the
@@ -76,6 +91,22 @@ export const Uuid = brand(pipe(string, uuid, to_lower_case), 'Uuid');
76
91
  * @nodocs
77
92
  */
78
93
  export const UuidWithDefault = with_default_fn(Uuid, create_uuid);
94
+ /**
95
+ * A timestamp on the wire: a date and time of RFC 3339 in UTC, fuz_schema's
96
+ * `iso_datetime`, which both spines' `YYYY-MM-DDTHH:MM:SSZ`
97
+ * (`iso8601_timestamp_column`) and a `toISOString()` stamp satisfy. Not
98
+ * branded, unlike the Zod `Datetime`.
99
+ */
100
+ export const Timestamp = pipe(string, iso_datetime);
101
+ /** A BLAKE3 hex hash's grammar: 64 lowercase hex characters (256-bit output). */
102
+ export const BLAKE3_HASH_REGEX = /^[0-9a-f]{64}$/;
103
+ /** The message of a string off `BLAKE3_HASH_REGEX`. */
104
+ export const BLAKE3_HASH_MESSAGE = 'Expected a 64-character lowercase hex blake3 hash';
105
+ /**
106
+ * A BLAKE3 hex hash: `BLAKE3_HASH_REGEX`, whose issue carries
107
+ * `BLAKE3_HASH_MESSAGE`. A value that is no string gets fuz_schema's message.
108
+ */
109
+ export const Blake3Hash = pipe(string, message(regex(BLAKE3_HASH_REGEX), BLAKE3_HASH_MESSAGE));
79
110
  /** The `description` both `ActingActor` twins carry. */
80
111
  export const ACTING_ACTOR_DESCRIPTION = 'Actor on the authenticated account that this request acts as. Omit on single-actor accounts; required on multi-actor.';
81
112
  /**
@@ -77,7 +77,9 @@ harness's `connect`, `create_bearer_auth_test_app`'s `pre_context`.
77
77
  ### `db_entities.ts` — DB-backed entity factories
78
78
 
79
79
  `create_test_account_with_actor(db, {username, password_hash?})` wraps
80
- `query_create_account_with_actor` with default `password_hash` (`'hash'`).
80
+ `query_create_account_with_actor` with default `password_hash` (`'hash'`),
81
+ storing the username lowercased, as every production creation path does and
82
+ the `account_username_lowercase` CHECK requires.
81
83
  Returns `{account, actor}`. Replaces the per-file `create_user` /
82
84
  `create_test_actor` / `create_test_account` helpers that had accumulated
83
85
  across the auth test suite. Use for query-level tests needing real DB rows
@@ -120,7 +122,7 @@ mismatch.
120
122
  ### `audit_drift_guard.ts` — audit-emission validation
121
123
 
122
124
  - `install_audit_drift_guard()` — `beforeEach` resets + `afterEach` zero-checks the `audit_metadata_validation_failures` + `audit_unknown_event_type_failures` counters from `auth/audit_log_queries.ts` and the emitter's write-failure counter (`get_audit_write_failures` in `auth/audit_emitter.ts`). Call once at the top of any `describe_db` block firing audit emits — production validation and the emitter's write are fail-open, so without this any regression shipping a typo'd `event_type` or undeclared metadata field, or losing a row the database refused, is silent. A test that fails a write on purpose resets the counter (`reset_audit_write_failures`) once it has asserted it.
123
- - `assert_audit_event_metadata(event, {reject_unknown_keys?})` — the wire-side twin: parses a read audit row's `metadata` against its builtin event type's `audit_metadata_schemas` entry as declared, so a mistyped, `null`, or missing field fails while a consumer-added key passes (the schemas are `z.looseObject`, and a builtin's schema can't be overridden, so added keys are a consumer's only extension path). `reject_unknown_keys` closes the world: an undeclared key fails too, for a suite whose backend adds none. The wire schema leaves `metadata` a loose record and only the TS spine validates it, at insert and fail-open, so this is what holds every spine's rows to their event's contract. A consumer-registered event type passes unexamined. `list_audit_events` and the admin suite run it on every row they read, with `reject_unknown_keys` from the fixture's `reject_unknown_audit_metadata_keys` (a setup option on `default_cross_process_setup`, `default_in_process_setup` and `default_in_process_suite_options`); fuz_app's own spine wiring turns it on.
125
+ - `assert_audit_event_metadata(event, {reject_unknown_keys?})` — the wire-side twin: parses a read audit row's `metadata` against its builtin event type's `audit_metadata_schemas` entry as declared, so a mistyped, `null`, or missing field fails while a consumer-added key passes (the schemas are fuz_schema `loose_object`s, and a builtin's schema can't be overridden, so added keys are a consumer's only extension path). `reject_unknown_keys` closes the world, each `loose_object`'s `def` spread into an `object`: an undeclared key fails too, for a suite whose backend adds none. The wire schema leaves `metadata` a loose record and only the TS spine validates it, at insert and fail-open, so this is what holds every spine's rows to their event's contract. A consumer-registered event type passes unexamined. `list_audit_events` and the admin suite run it on every row they read, with `reject_unknown_keys` from the fixture's `reject_unknown_audit_metadata_keys` (a setup option on `default_cross_process_setup`, `default_in_process_setup` and `default_in_process_suite_options`); fuz_app's own spine wiring turns it on.
124
126
  - `assert_no_audit_drift()` — the zero-check itself, for a test that manages the counters. Pair with `await_pending_effects: true` (the `create_test_app` default) so fire-and-forget audit writes complete by response time.
125
127
  - `create_recording_audit_emitter(calls_ref?)` — no-op `AuditEmitter` pushing every `emit` and `emit_pool` call into `calls`. Pass `calls_ref` to write into a caller-owned array; omit to let the helper allocate. Returns `{emitter, calls}` — destructure `emitter` as the `audit` dep and read `calls` to assert. `add_listener` records (never fires) and returns a remover with the production semantics, so `listener_count` tracks what a server registered and released. Replaces per-file capturing emitters previously duplicated across `password_change.test.ts`, `audit_log.test.ts`, etc.
126
128
  - `RecordingAuditEmitter` — `{emitter: AuditEmitter; calls: Array<AuditLogInput>}`.
@@ -183,7 +185,9 @@ cookie" flow, split by intent:
183
185
  - `create_test_account_with_credentials(options)` — general path used by `TestApp.create_account` for additional non-keeper accounts. Same body, no lock interaction (additional accounts aren't bootstraps).
184
186
 
185
187
  Both take `{db, keyring, session_options, password, username?, password_value?, roles?}`
186
- (shared `CreateTestAccountWithCredentialsOptions` / `BootstrapTestKeeperOptions`).
188
+ (shared `CreateTestAccountWithCredentialsOptions` / `BootstrapTestKeeperOptions`),
189
+ and store the username lowercased, as the Rust spine's `_testing_reset` seeds
190
+ do, so the returned `account.username` is its lowercase.
187
191
 
188
192
  Types:
189
193
 
@@ -62,7 +62,9 @@ export type BootstrapTestKeeperOptions = CreateTestAccountWithCredentialsOptions
62
62
  * having happened.
63
63
  *
64
64
  * Creates an account with actor, grants roles, creates an API token,
65
- * creates a session, and signs a session cookie.
65
+ * creates a session, and signs a session cookie. The username is stored
66
+ * lowercased, as every production creation path stores it, so the returned
67
+ * `account.username` is the lowercase of `options.username`.
66
68
  *
67
69
  * @mutates the underlying `options.db` — inserts rows into `account`, `actor`,
68
70
  * `role_grant` (one per role), `api_token`, and `auth_session`.
@@ -1 +1 @@
1
- {"version":3,"file":"app_server.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/app_server.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAU5D,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3E,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEN,KAAK,SAAS,EAC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,CAAC,OAAO,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7E,2PAA2P;IAC3P,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,QAAO,IAAI,CACzD,gBAAgB,EAChB,iBAAiB,GAAG,OAAO,GAAG,YAAY,CAa1C,CAAC;AAgCF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS,oBAAoB,KAAG,OAAO,CAAC,OAAO,CAqFpF,CAAC"}
@@ -77,7 +77,9 @@ const resolve_fallback_factory = (migration_namespaces) => {
77
77
  * having happened.
78
78
  *
79
79
  * Creates an account with actor, grants roles, creates an API token,
80
- * creates a session, and signs a session cookie.
80
+ * creates a session, and signs a session cookie. The username is stored
81
+ * lowercased, as every production creation path stores it, so the returned
82
+ * `account.username` is the lowercase of `options.username`.
81
83
  *
82
84
  * @mutates the underlying `options.db` — inserts rows into `account`, `actor`,
83
85
  * `role_grant` (one per role), `api_token`, and `auth_session`.
@@ -86,8 +88,10 @@ export const create_test_account_with_credentials = async (options) => {
86
88
  const { db, keyring, session_options, password, username = 'keeper', password_value = DEFAULT_TEST_PASSWORD, roles = [], email } = options;
87
89
  const deps = { db };
88
90
  const password_hash = await password.hash_password(password_value);
91
+ // lowercase, as `Username` stores every name production creates, and as the
92
+ // `account_username_lowercase` CHECK requires
89
93
  const { account, actor } = await query_create_account_with_actor(deps, {
90
- username,
94
+ username: username.toLowerCase(),
91
95
  password_hash,
92
96
  ...(email !== undefined && { email })
93
97
  });
@@ -1 +1 @@
1
- {"version":3,"file":"audit_drift_guard.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/audit_drift_guard.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAW7B,OAAO,EAGN,KAAK,YAAY,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGN,KAA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C;IACtB,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,8BAA8B,GAC1C,YAAY,KAAK,CAAC,aAAa,CAAC,KAC9B,qBAwCF,CAAC;AA4BF,iDAAiD;AACjD,MAAM,WAAW,+BAA+B;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,2BAA2B,GACvC,OAAO,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC,EACrE,UAAU,+BAA+B,KACvC,IAYF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import './assert_dev_env.js';
2
2
  import { assert, beforeEach, afterEach } from 'vitest';
3
- import { z } from 'zod';
3
+ import { format_issue, nullable, object, parse } from '@fuzdev/fuz_schema/schema.ts';
4
4
  import { get_audit_metadata_validation_failures, get_audit_unknown_event_type_failures, reset_audit_metadata_validation_failures, reset_audit_unknown_event_type_failures } from '../auth/audit_log_queries.js';
5
5
  import { get_audit_write_failures, reset_audit_write_failures } from '../auth/audit_emitter.js';
6
6
  import { audit_metadata_schemas } from '../auth/audit_log_schema.js';
@@ -128,16 +128,17 @@ export const create_recording_audit_emitter = (calls_ref) => {
128
128
  };
129
129
  /**
130
130
  * The closed-world twin of a builtin event's `audit_metadata_schemas` entry:
131
- * the same fields, with unknown keys refused. The registry's schemas are
132
- * `z.looseObject` so a consumer can add fields to a builtin event (a builtin's
133
- * schema can't be overridden), so this is opt-in.
131
+ * the same fields, with unknown keys refused — its `loose_object`'s `def`
132
+ * spread into an `object`, under the `nullable` it may have. The registry's
133
+ * schemas are `loose_object`s so a consumer can add fields to a builtin event
134
+ * (a builtin's schema can't be overridden), so this is opt-in.
134
135
  */
135
136
  const to_closed_metadata_schema = (schema) => {
136
- if (schema instanceof z.ZodNullable) {
137
- return to_closed_metadata_schema(schema.unwrap()).nullable();
137
+ if (schema.kind === 'nullable') {
138
+ return nullable(to_closed_metadata_schema(schema.def.schema));
138
139
  }
139
- if (schema instanceof z.ZodObject)
140
- return z.strictObject(schema.shape);
140
+ if (schema.kind === 'loose_object')
141
+ return object({ ...schema.def });
141
142
  return schema;
142
143
  };
143
144
  const declared_metadata_schemas = new Map(Object.entries(audit_metadata_schemas));
@@ -165,12 +166,10 @@ export const assert_audit_event_metadata = (event, options) => {
165
166
  const schema = (options?.reject_unknown_keys ? closed_metadata_schemas : declared_metadata_schemas).get(event.event_type);
166
167
  if (!schema)
167
168
  return;
168
- const parsed = schema.safeParse(event.metadata);
169
- if (parsed.success)
169
+ const parsed = parse(schema, event.metadata);
170
+ if (parsed.ok)
170
171
  return;
171
172
  assert.fail(`audit row ${event.event_type} (outcome=${event.outcome}) carries metadata outside its ` +
172
173
  `audit_metadata_schemas entry: ${JSON.stringify(event.metadata)} — ` +
173
- parsed.error.issues
174
- .map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`)
175
- .join('; '));
174
+ parsed.issues.map(format_issue).join('; '));
176
175
  };
@@ -1 +1 @@
1
- {"version":3,"file":"identity_parity.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqH9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyB5C,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAsKD,eAAO,MAAM,oCAAoC,GAChD,SAAS,8BAA8B,KACrC,IAieF,CAAC"}
1
+ {"version":3,"file":"identity_parity.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/identity_parity.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqH9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAyB5C,uDAAuD;AACvD,MAAM,WAAW,8BAA8B;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAsKD,eAAO,MAAM,oCAAoC,GAChD,SAAS,8BAA8B,KACrC,IAmeF,CAAC"}
@@ -337,8 +337,10 @@ export const describe_identity_parity_cross_tests = (options) => {
337
337
  test('case-insensitive login — uppercase submission matches a mixed-case account', async () => {
338
338
  const fixture = await setup_test();
339
339
  // Mixed-case ASCII username (valid per the `Username` regex), stored
340
- // lowercase; an all-uppercase submission matches only if the lookup
341
- // folds case on this backend.
340
+ // lowercase on every fixture: through signup's `Username` across
341
+ // processes, by the harness in process, and held there by the
342
+ // `account_username_lowercase` CHECK. An all-uppercase submission
343
+ // matches only if the lookup folds case on this backend.
342
344
  await fixture.create_account({ username: 'Canon_Mixed_User' });
343
345
  assert_attempt(await login(fixture, 'CANON_MIXED_USER'), 200, 'uppercase login');
344
346
  });
@@ -1 +1 @@
1
- {"version":3,"file":"session_cap.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/session_cap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAkE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,gCAAgC,GAAI,SAAS,0BAA0B,KAAG,IA2MtF,CAAC"}
1
+ {"version":3,"file":"session_cap.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/session_cap.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAmE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,qEAAqE;IACrE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,gBAAgB,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,gCAAgC,GAAI,SAAS,0BAA0B,KAAG,IAwMtF,CAAC"}
@@ -52,6 +52,7 @@ import '../assert_dev_env.js';
52
52
  * @module
53
53
  */
54
54
  import { describe, test, assert } from 'vitest';
55
+ import { parse } from '@fuzdev/fuz_schema/schema.ts';
55
56
  import { heartbeat_action_spec } from '../../actions/heartbeat.js';
56
57
  import { WS_CLOSE_SESSION_REVOKED } from '../../actions/transports.js';
57
58
  import { DEFAULT_MAX_SESSIONS } from '../../auth/account_route_schema.js';
@@ -151,9 +152,9 @@ export const describe_session_cap_cross_tests = (options) => {
151
152
  });
152
153
  try {
153
154
  const result = await client.request(1, 'account_session_list', undefined);
154
- const parsed = SessionListOutput.safeParse(result);
155
- assert.ok(parsed.success, `the socket's session list parses (got ${JSON.stringify(result)})`);
156
- const current = parsed.data.sessions.filter((s) => s.is_current).map((s) => s.id);
155
+ const parsed = parse(SessionListOutput, result);
156
+ assert.ok(parsed.ok, `the socket's session list parses (got ${JSON.stringify(result)})`);
157
+ const current = parsed.value.sessions.filter((s) => s.is_current).map((s) => s.id);
157
158
  assert.deepStrictEqual(current, on_first.current, "the first login's socket sees exactly its own session as current");
158
159
  }
159
160
  finally {
@@ -13,7 +13,9 @@ export interface TestAccountWithActor {
13
13
  * so suites that don't exercise password verification can stay terse.
14
14
  * Replaces the per-file `create_user` / `create_test_actor` /
15
15
  * `create_test_account` helpers that had accumulated across the auth
16
- * test suite.
16
+ * test suite. The username is stored lowercased, as every production
17
+ * creation path stores it and the `account_username_lowercase` CHECK
18
+ * requires.
17
19
  */
18
20
  export declare const create_test_account_with_actor: (db: Db, options: {
19
21
  username: string;
@@ -1 +1 @@
1
- {"version":3,"file":"db_entities.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/db_entities.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA0B7B,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACb;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,GAC1C,IAAI,EAAE,EACN,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,KACnD,OAAO,CAAC,oBAAoB,CAI7B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B,GACzC,IAAI,EAAE,EACN,OAAO,oBAAoB,KACzB,OAAO,CAAC,SAAS,CAA2C,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,EAAE,EACN,YAAY,MAAM,EAClB,MAAM,MAAM,KACV,OAAO,CAAC,KAAK,CAWf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAU,IAAI,EAAE,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CACvC,CAAC"}
1
+ {"version":3,"file":"db_entities.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/db_entities.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA0B7B,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACjG,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,oFAAoF;AACpF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACb;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8BAA8B,GAC1C,IAAI,EAAE,EACN,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,KACnD,OAAO,CAAC,oBAAoB,CAI7B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,6BAA6B,GACzC,IAAI,EAAE,EACN,OAAO,oBAAoB,KACzB,OAAO,CAAC,SAAS,CAA2C,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,uBAAuB,GACnC,IAAI,EAAE,EACN,YAAY,MAAM,EAClB,MAAM,MAAM,KACV,OAAO,CAAC,KAAK,CAWf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAU,IAAI,EAAE,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CACvC,CAAC"}
@@ -25,9 +25,11 @@ import { query_create_role_grant } from '../auth/role_grant_queries.js';
25
25
  * so suites that don't exercise password verification can stay terse.
26
26
  * Replaces the per-file `create_user` / `create_test_actor` /
27
27
  * `create_test_account` helpers that had accumulated across the auth
28
- * test suite.
28
+ * test suite. The username is stored lowercased, as every production
29
+ * creation path stores it and the `account_username_lowercase` CHECK
30
+ * requires.
29
31
  */
30
- export const create_test_account_with_actor = async (db, options) => query_create_account_with_actor({ db }, { username: options.username, password_hash: options.password_hash ?? 'hash' });
32
+ export const create_test_account_with_actor = async (db, options) => query_create_account_with_actor({ db }, { username: options.username.toLowerCase(), password_hash: options.password_hash ?? 'hash' });
31
33
  /**
32
34
  * Materialize a `role_grant` directly via `query_create_role_grant`,
33
35
  * bypassing the production offer/accept consent flow.
@@ -1 +1 @@
1
- {"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAsB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAkB1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAK1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IA28CF,CAAC"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAuB7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAkB1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAK1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,eAAe,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;;;;;OAYG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IA28CF,CAAC"}
@@ -17,6 +17,7 @@ import './assert_dev_env.js';
17
17
  * @module
18
18
  */
19
19
  import { describe, test, assert, afterAll } from 'vitest';
20
+ import { parse_or_throw } from '@fuzdev/fuz_schema/schema.ts';
20
21
  import { find_auth_route, assert_response_matches_spec, assert_no_error_info_leakage } from './integration_helpers.js';
21
22
  import { find_rpc_action, rpc_call_for_spec, require_rpc_endpoint_path, resolve_rpc_endpoints_for_setup } from './rpc_helpers.js';
22
23
  import { ErrorCoverageCollector, assert_error_coverage, DEFAULT_INTEGRATION_ERROR_COVERAGE } from './error_coverage.js';
@@ -329,11 +330,11 @@ export const describe_standard_integration_tests = (options) => {
329
330
  `capability but doesn't mount the route.`);
330
331
  const body = await res.json();
331
332
  // Throws on any extra/missing field across account/actor/role_grants.
332
- const parsed = AccountStatusOutput.parse(body);
333
+ const parsed = parse_or_throw(AccountStatusOutput, body);
333
334
  // Single-actor keeper: actor resolved, role_grants populated.
334
335
  assert.ok(parsed.actor, 'single-actor keeper must resolve a non-null actor');
335
336
  assert.ok(parsed.role_grants.length > 0, 'single-actor keeper must have populated role_grants');
336
- // Byte-shape gate: `z.string()` accepts a millisecond stamp too,
337
+ // Byte-shape gate: `iso_datetime` accepts a millisecond stamp too,
337
338
  // so the schema parse above can't tell the two spines apart.
338
339
  assert_iso8601_seconds(parsed.account.created_at, 'account.created_at');
339
340
  for (const grant of parsed.role_grants) {
package/dist/zod.d.ts CHANGED
@@ -48,7 +48,8 @@ export declare const zod_get_schema_layers: (schema: z.ZodType) => Array<z.ZodTy
48
48
  export declare const zod_get_schema_keys: <T extends z.ZodType>(schema: T) => Array<keyof z.infer<T> & string>;
49
49
  /**
50
50
  * Get the field schema for a key in an object schema, returning `undefined` if
51
- * the schema is not an object or the key is missing.
51
+ * the schema is not an object or the key is not one of its own fields (a name
52
+ * the shape only inherits, such as `constructor` or `toString`, included).
52
53
  *
53
54
  * @param schema - Zod schema (typically a `ZodObject` with possible wrappers)
54
55
  * @param key - the property name
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;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgC7B;;;;;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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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
@@ -136,13 +136,17 @@ export const zod_get_schema_keys = (schema) => {
136
136
  };
137
137
  /**
138
138
  * Get the field schema for a key in an object schema, returning `undefined` if
139
- * the schema is not an object or the key is missing.
139
+ * the schema is not an object or the key is not one of its own fields (a name
140
+ * the shape only inherits, such as `constructor` or `toString`, included).
140
141
  *
141
142
  * @param schema - Zod schema (typically a `ZodObject` with possible wrappers)
142
143
  * @param key - the property name
143
144
  * @returns the field's schema, or `undefined`
144
145
  */
145
- export const zod_maybe_get_field_schema = (schema, key) => zod_unwrap_to_object(schema)?.shape[key];
146
+ export const zod_maybe_get_field_schema = (schema, key) => {
147
+ const shape = zod_unwrap_to_object(schema)?.shape;
148
+ return shape && Object.hasOwn(shape, key) ? shape[key] : undefined;
149
+ };
146
150
  /**
147
151
  * Get the field schema for a key in an object schema.
148
152
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.161.0",
3
+ "version": "0.162.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",