@fuzdev/fuz_app 0.169.0 → 0.171.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 (171) hide show
  1. package/dist/actions/CLAUDE.md +19 -21
  2. package/dist/actions/action_codegen.d.ts +27 -18
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +90 -90
  5. package/dist/actions/action_event.d.ts +0 -8
  6. package/dist/actions/action_event.d.ts.map +1 -1
  7. package/dist/actions/action_event.js +7 -6
  8. package/dist/actions/action_event_data.d.ts +4 -4
  9. package/dist/actions/action_rpc.d.ts +1 -1
  10. package/dist/actions/action_rpc.d.ts.map +1 -1
  11. package/dist/actions/action_rpc.js +6 -7
  12. package/dist/actions/action_spec.d.ts +8 -10
  13. package/dist/actions/action_spec.d.ts.map +1 -1
  14. package/dist/actions/action_spec.js +1 -1
  15. package/dist/actions/action_types.d.ts +4 -4
  16. package/dist/actions/action_types.d.ts.map +1 -1
  17. package/dist/actions/action_types.js +2 -2
  18. package/dist/actions/broadcast_api.d.ts +2 -2
  19. package/dist/actions/broadcast_api.js +4 -4
  20. package/dist/actions/compile_action_registry.d.ts +6 -7
  21. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  22. package/dist/actions/compile_action_registry.js +8 -9
  23. package/dist/actions/peer_ping.d.ts.map +1 -1
  24. package/dist/actions/peer_ping.js +3 -2
  25. package/dist/actions/perform_action.d.ts +6 -6
  26. package/dist/actions/perform_action.d.ts.map +1 -1
  27. package/dist/actions/perform_action.js +11 -10
  28. package/dist/actions/socket.svelte.d.ts +1 -1
  29. package/dist/actions/socket.svelte.js +2 -2
  30. package/dist/actions/ws_socket_session.d.ts.map +1 -1
  31. package/dist/actions/ws_socket_session.js +2 -1
  32. package/dist/auth/CLAUDE.md +11 -11
  33. package/dist/auth/admin_action_specs.d.ts +24 -24
  34. package/dist/auth/audit_emitter.d.ts +6 -7
  35. package/dist/auth/audit_emitter.d.ts.map +1 -1
  36. package/dist/auth/audit_emitter.js +11 -22
  37. package/dist/auth/audit_log_ddl.d.ts +1 -1
  38. package/dist/auth/audit_log_ddl.js +1 -1
  39. package/dist/auth/audit_log_queries.d.ts +0 -13
  40. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  41. package/dist/auth/audit_log_queries.js +3 -3
  42. package/dist/auth/audit_log_schema.d.ts +14 -15
  43. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  44. package/dist/auth/audit_log_schema.js +1 -1
  45. package/dist/auth/auth_ddl.d.ts +1 -1
  46. package/dist/auth/auth_ddl.js +1 -1
  47. package/dist/auth/cell_action_specs.d.ts +54 -54
  48. package/dist/auth/cell_actions.d.ts +2 -2
  49. package/dist/auth/cell_actions.js +5 -5
  50. package/dist/auth/middleware.d.ts +6 -2
  51. package/dist/auth/middleware.d.ts.map +1 -1
  52. package/dist/auth/middleware.js +14 -2
  53. package/dist/auth/request_context.d.ts.map +1 -1
  54. package/dist/auth/request_context.js +7 -9
  55. package/dist/auth/role_grant_offer_action_specs.d.ts +6 -6
  56. package/dist/auth/role_grant_offer_ddl.d.ts +1 -1
  57. package/dist/auth/role_grant_offer_ddl.js +1 -1
  58. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  59. package/dist/auth/role_grant_offer_notifications.js +2 -3
  60. package/dist/auth/self_service_role_actions.d.ts +1 -1
  61. package/dist/auth/self_service_role_actions.js +1 -1
  62. package/dist/env/env_schemas.d.ts +1 -2
  63. package/dist/env/env_schemas.d.ts.map +1 -1
  64. package/dist/env/env_schemas.js +3 -4
  65. package/dist/http/CLAUDE.md +30 -31
  66. package/dist/http/auth_shape.d.ts +14 -32
  67. package/dist/http/auth_shape.d.ts.map +1 -1
  68. package/dist/http/auth_shape.js +14 -49
  69. package/dist/http/error_schemas.d.ts +18 -18
  70. package/dist/http/json_text.d.ts +53 -0
  71. package/dist/http/json_text.d.ts.map +1 -0
  72. package/dist/http/json_text.js +152 -0
  73. package/dist/http/jsonrpc_helpers.js +1 -1
  74. package/dist/http/route_error_check.d.ts +2 -2
  75. package/dist/http/route_error_check.d.ts.map +1 -1
  76. package/dist/http/route_error_check.js +2 -3
  77. package/dist/http/route_errors.d.ts +4 -4
  78. package/dist/http/route_errors.d.ts.map +1 -1
  79. package/dist/http/route_errors.js +0 -13
  80. package/dist/http/route_result.d.ts +2 -1
  81. package/dist/http/route_result.d.ts.map +1 -1
  82. package/dist/http/route_spec.d.ts +34 -37
  83. package/dist/http/route_spec.d.ts.map +1 -1
  84. package/dist/http/route_spec.js +31 -31
  85. package/dist/http/schema_helpers.d.ts +77 -68
  86. package/dist/http/schema_helpers.d.ts.map +1 -1
  87. package/dist/http/schema_helpers.js +54 -77
  88. package/dist/http/surface.d.ts.map +1 -1
  89. package/dist/http/surface.js +6 -8
  90. package/dist/primitive_schemas.d.ts +9 -17
  91. package/dist/primitive_schemas.d.ts.map +1 -1
  92. package/dist/primitive_schemas.js +9 -17
  93. package/dist/realtime/sse.d.ts +3 -3
  94. package/dist/realtime/sse.d.ts.map +1 -1
  95. package/dist/realtime/sse.js +2 -2
  96. package/dist/schema_issues.d.ts +39 -147
  97. package/dist/schema_issues.d.ts.map +1 -1
  98. package/dist/schema_issues.js +39 -352
  99. package/dist/schema_meta.d.ts +63 -136
  100. package/dist/schema_meta.d.ts.map +1 -1
  101. package/dist/schema_meta.js +37 -184
  102. package/dist/sensitivity.d.ts +3 -5
  103. package/dist/sensitivity.d.ts.map +1 -1
  104. package/dist/sensitivity.js +3 -5
  105. package/dist/testing/CLAUDE.md +20 -22
  106. package/dist/testing/adversarial_headers.js +2 -2
  107. package/dist/testing/adversarial_input_cases.d.ts +19 -18
  108. package/dist/testing/adversarial_input_cases.d.ts.map +1 -1
  109. package/dist/testing/adversarial_input_cases.js +31 -46
  110. package/dist/testing/assertions.d.ts +2 -2
  111. package/dist/testing/assertions.d.ts.map +1 -1
  112. package/dist/testing/assertions.js +3 -3
  113. package/dist/testing/cross_backend/account_lifecycle.js +2 -2
  114. package/dist/testing/cross_backend/action_manifest.d.ts +10 -9
  115. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  116. package/dist/testing/cross_backend/action_manifest.js +4 -3
  117. package/dist/testing/cross_backend/cell_crud.js +1 -1
  118. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts +0 -62
  119. package/dist/testing/cross_backend/conformance_rpc_auth.d.ts.map +1 -1
  120. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  121. package/dist/testing/cross_backend/conformance_table.js +3 -3
  122. package/dist/testing/cross_backend/cross_rpc.d.ts +3 -4
  123. package/dist/testing/cross_backend/cross_rpc.d.ts.map +1 -1
  124. package/dist/testing/cross_backend/cross_rpc.js +4 -4
  125. package/dist/testing/cross_backend/differential.js +2 -2
  126. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  127. package/dist/testing/cross_backend/identity_parity.js +16 -11
  128. package/dist/testing/cross_backend/origin_conformance.d.ts +9 -9
  129. package/dist/testing/cross_backend/query_shape.js +1 -1
  130. package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
  131. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  132. package/dist/testing/cross_backend/setup.d.ts +25 -3
  133. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  134. package/dist/testing/cross_backend/setup.js +4 -4
  135. package/dist/testing/cross_backend/sse_round_trip.js +2 -2
  136. package/dist/testing/cross_backend/testing_origin_check.d.ts +4 -4
  137. package/dist/testing/cross_backend/token_lifetime.js +3 -3
  138. package/dist/testing/cross_backend/wire_shapes.js +1 -1
  139. package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -1
  140. package/dist/testing/cross_backend/ws_envelope.js +8 -0
  141. package/dist/testing/cross_backend/ws_round_trip.js +1 -1
  142. package/dist/testing/data_exposure.d.ts.map +1 -1
  143. package/dist/testing/data_exposure.js +1 -1
  144. package/dist/testing/integration.js +2 -2
  145. package/dist/testing/integration_helpers.d.ts.map +1 -1
  146. package/dist/testing/integration_helpers.js +2 -2
  147. package/dist/testing/middleware.d.ts.map +1 -1
  148. package/dist/testing/middleware.js +2 -2
  149. package/dist/testing/rpc_attack_surface.js +1 -1
  150. package/dist/testing/rpc_envelope_cases.d.ts +10 -3
  151. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  152. package/dist/testing/rpc_envelope_cases.js +22 -1
  153. package/dist/testing/rpc_helpers.d.ts +12 -14
  154. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  155. package/dist/testing/rpc_helpers.js +9 -10
  156. package/dist/testing/schema_generators.d.ts +67 -60
  157. package/dist/testing/schema_generators.d.ts.map +1 -1
  158. package/dist/testing/schema_generators.js +154 -159
  159. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  160. package/dist/testing/sse_round_trip.js +2 -2
  161. package/dist/testing/surface_invariants.d.ts +1 -1
  162. package/dist/testing/surface_invariants.js +1 -1
  163. package/dist/ui/form_state.svelte.d.ts +1 -1
  164. package/dist/ui/form_state.svelte.js +1 -1
  165. package/package.json +5 -7
  166. package/dist/zod.d.ts +0 -116
  167. package/dist/zod.d.ts.map +0 -1
  168. package/dist/zod.js +0 -218
  169. package/dist/zod_schemas.d.ts +0 -100
  170. package/dist/zod_schemas.d.ts.map +0 -1
  171. package/dist/zod_schemas.js +0 -157
@@ -9,12 +9,6 @@
9
9
  * all reach for the same primitives without going through auth. A URL is
10
10
  * `Url` from `@fuzdev/fuz_util/url.ts`.
11
11
  *
12
- * The Zod forms a consumer's Zod schema embeds — `ZodUuid`,
13
- * `ZodUuidWithDefault`, `ZodFactHashSchema`, `ZodUsername`,
14
- * `ZodActingActor` — are in `zod_schemas.ts`, built on the grammars here and
15
- * sharing their output types, so a value parsed by either goes where the
16
- * other's is taken.
17
- *
18
12
  * Client-safe: nothing here imports `@fuzdev/blake3-wasm`, so wire schemas
19
13
  * that validate a hash don't pull the WASM binary into a bundle.
20
14
  *
@@ -151,9 +145,9 @@ export declare const is_email_within_length_max: (s: string) => boolean;
151
145
  * Deliberately permissive — a structural shape check (`EMAIL_REGEX` plus the
152
146
  * `EMAIL_LENGTH_MAX` byte bound), not RFC 5322 conformance or deliverability
153
147
  * (real delivery is proven by a confirmation email). The rule is one explicit
154
- * regex the Rust spine's `is_valid_email` mirrors, looser than Zod's
155
- * `z.email()` (2+ char TLD, no consecutive dots), which rejected addresses
156
- * like `a@b.c`. The length bound is the UTF-8 **byte** count (RFC 5321
148
+ * regex the Rust spine's `is_valid_email` mirrors, looser than grammars
149
+ * requiring a 2+ char TLD and no consecutive dots, which reject addresses like
150
+ * `a@b.c`. The length bound is the UTF-8 **byte** count (RFC 5321
157
151
  * measures octets), so a multibyte address is bounded identically to the
158
152
  * Rust spine's `s.len()`. No transform: case is preserved and surrounding
159
153
  * whitespace is rejected (not trimmed), so storage is verbatim and the
@@ -172,11 +166,9 @@ export declare const create_uuid: () => Uuid;
172
166
  /**
173
167
  * The UUID grammar of RFC 9562, in either case: five groups of hex digits,
174
168
  * 8-4-4-4-12, with a version from 1 to 8 and the RFC's variant, or the nil or
175
- * the max UUID. It is `z.uuid()`'s own but for the max UUID, which `z.uuid()`
176
- * spells in lowercase only, where RFC 9562 §4 reads a UUID case-insensitively.
177
- * The same source as the pattern fuz_schema's `uuid` renders to JSON Schema,
178
- * which a test holds it to, the `pattern` of `ZodUuid`, and the grammar of
179
- * the Rust spine's `is_valid_uuid`.
169
+ * the max UUID, read case-insensitively as RFC 9562 §4 reads a UUID. The same
170
+ * source as the pattern fuz_schema's `uuid` renders to JSON Schema, which a
171
+ * test holds it to, and the grammar of the Rust spine's `is_valid_uuid`.
180
172
  */
181
173
  export declare const UUID_REGEX: RegExp;
182
174
  /**
@@ -205,7 +197,7 @@ export type UuidWithDefault = Infer<typeof UuidWithDefault>;
205
197
  * A timestamp on the wire: a date and time of RFC 3339 in UTC, fuz_schema's
206
198
  * `iso_datetime`, which both spines' `YYYY-MM-DDTHH:MM:SSZ`
207
199
  * (`iso8601_timestamp_column`) and a `toISOString()` stamp satisfy. Not
208
- * branded, unlike the Zod `Datetime` of `zod_schemas.ts`.
200
+ * branded.
209
201
  */
210
202
  export declare const Timestamp: PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
211
203
  export type Timestamp = Infer<typeof Timestamp>;
@@ -233,7 +225,7 @@ export declare const BLAKE3_HASH_MESSAGE = "Expected a 64-character lowercase he
233
225
  */
234
226
  export declare const Blake3Hash: PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
235
227
  export type Blake3Hash = Infer<typeof Blake3Hash>;
236
- /** The `description` of `ActingActor`, which `ZodActingActor` carries too. */
228
+ /** The `description` of `ActingActor`. */
237
229
  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.";
238
230
  /**
239
231
  * `acting` field shared by every input that needs the caller's acting actor.
@@ -254,7 +246,7 @@ export declare const ACTING_ACTOR_DESCRIPTION = "Actor on the authenticated acco
254
246
  * 2: `auth.actor !== 'none'` ⟺ input (or query, on REST GETs) declares
255
247
  * `acting?: ActingActor`. The dispatcher finds it by reference
256
248
  * (`input_schema_declares_acting`), so an input declares this export, not a
257
- * copy of it; a Zod input declares `ZodActingActor` (`zod_schemas.ts`).
249
+ * copy of it.
258
250
  */
259
251
  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<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | 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<"lazy"> | 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<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | 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<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform">)[]> & {
260
252
  readonly '~types'?: {
@@ -1 +1 @@
1
- {"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAUN,MAAM,EAKN,KAAK,KAAK,EACV,KAAK,UAAU,EACf,MAAM,8BAA8B,CAAC;AAKtC,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;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAC1B,SAAS,oBAAoB,KAC3B,UAAU,CAAC,MAAM,EAAE,OAAO,MAAM,CAKlC,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,6GAA6G;AAC7G,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAwC,CAAC;AAEpE,gNAAgN;AAChN,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,4HAIpB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAA+B,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,4HAG7B,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEhE;;;;;;;;;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M,iBAAiB,QAAmB,CAAC;AAElD,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,sDAAsD,CAAC;AAEvF;;;GAGG;AACH,eAAO,MAAM,UAAU,wGAAuE,CAAC;AAC/F,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD,0CAA0C;AAC1C,eAAO,MAAM,wBAAwB,0HACmF,CAAC;AAEzH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW;;;;;GAAkE,CAAC;AAC3F,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -9,12 +9,6 @@
9
9
  * all reach for the same primitives without going through auth. A URL is
10
10
  * `Url` from `@fuzdev/fuz_util/url.ts`.
11
11
  *
12
- * The Zod forms a consumer's Zod schema embeds — `ZodUuid`,
13
- * `ZodUuidWithDefault`, `ZodFactHashSchema`, `ZodUsername`,
14
- * `ZodActingActor` — are in `zod_schemas.ts`, built on the grammars here and
15
- * sharing their output types, so a value parsed by either goes where the
16
- * other's is taken.
17
- *
18
12
  * Client-safe: nothing here imports `@fuzdev/blake3-wasm`, so wire schemas
19
13
  * that validate a hash don't pull the WASM binary into a bundle.
20
14
  *
@@ -147,9 +141,9 @@ export const is_email_within_length_max = (s) => s.length <= EMAIL_LENGTH_MAX &&
147
141
  * Deliberately permissive — a structural shape check (`EMAIL_REGEX` plus the
148
142
  * `EMAIL_LENGTH_MAX` byte bound), not RFC 5322 conformance or deliverability
149
143
  * (real delivery is proven by a confirmation email). The rule is one explicit
150
- * regex the Rust spine's `is_valid_email` mirrors, looser than Zod's
151
- * `z.email()` (2+ char TLD, no consecutive dots), which rejected addresses
152
- * like `a@b.c`. The length bound is the UTF-8 **byte** count (RFC 5321
144
+ * regex the Rust spine's `is_valid_email` mirrors, looser than grammars
145
+ * requiring a 2+ char TLD and no consecutive dots, which reject addresses like
146
+ * `a@b.c`. The length bound is the UTF-8 **byte** count (RFC 5321
153
147
  * measures octets), so a multibyte address is bounded identically to the
154
148
  * Rust spine's `s.len()`. No transform: case is preserved and surrounding
155
149
  * whitespace is rejected (not trimmed), so storage is verbatim and the
@@ -167,11 +161,9 @@ export const create_uuid = () => crypto.randomUUID();
167
161
  /**
168
162
  * The UUID grammar of RFC 9562, in either case: five groups of hex digits,
169
163
  * 8-4-4-4-12, with a version from 1 to 8 and the RFC's variant, or the nil or
170
- * the max UUID. It is `z.uuid()`'s own but for the max UUID, which `z.uuid()`
171
- * spells in lowercase only, where RFC 9562 §4 reads a UUID case-insensitively.
172
- * The same source as the pattern fuz_schema's `uuid` renders to JSON Schema,
173
- * which a test holds it to, the `pattern` of `ZodUuid`, and the grammar of
174
- * the Rust spine's `is_valid_uuid`.
164
+ * the max UUID, read case-insensitively as RFC 9562 §4 reads a UUID. The same
165
+ * source as the pattern fuz_schema's `uuid` renders to JSON Schema, which a
166
+ * test holds it to, and the grammar of the Rust spine's `is_valid_uuid`.
175
167
  */
176
168
  export const UUID_REGEX = /^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;
177
169
  /**
@@ -188,7 +180,7 @@ export const UuidWithDefault = with_default_fn(Uuid, create_uuid);
188
180
  * A timestamp on the wire: a date and time of RFC 3339 in UTC, fuz_schema's
189
181
  * `iso_datetime`, which both spines' `YYYY-MM-DDTHH:MM:SSZ`
190
182
  * (`iso8601_timestamp_column`) and a `toISOString()` stamp satisfy. Not
191
- * branded, unlike the Zod `Datetime` of `zod_schemas.ts`.
183
+ * branded.
192
184
  */
193
185
  export const Timestamp = pipe(string, iso_datetime);
194
186
  /**
@@ -209,7 +201,7 @@ export const BLAKE3_HASH_MESSAGE = 'Expected a 64-character lowercase hex blake3
209
201
  * `BLAKE3_HASH_MESSAGE`. A value that is no string gets fuz_schema's message.
210
202
  */
211
203
  export const Blake3Hash = pipe(string, message(regex(BLAKE3_HASH_REGEX), BLAKE3_HASH_MESSAGE));
212
- /** The `description` of `ActingActor`, which `ZodActingActor` carries too. */
204
+ /** The `description` of `ActingActor`. */
213
205
  export const ACTING_ACTOR_DESCRIPTION = 'Actor on the authenticated account that this request acts as. Omit on single-actor accounts; required on multi-actor.';
214
206
  /**
215
207
  * `acting` field shared by every input that needs the caller's acting actor.
@@ -230,6 +222,6 @@ export const ACTING_ACTOR_DESCRIPTION = 'Actor on the authenticated account that
230
222
  * 2: `auth.actor !== 'none'` ⟺ input (or query, on REST GETs) declares
231
223
  * `acting?: ActingActor`. The dispatcher finds it by reference
232
224
  * (`input_schema_declares_acting`), so an input declares this export, not a
233
- * copy of it; a Zod input declares `ZodActingActor` (`zod_schemas.ts`).
225
+ * copy of it.
234
226
  */
235
227
  export const ActingActor = meta(optional(Uuid), { description: ACTING_ACTOR_DESCRIPTION });
@@ -32,7 +32,7 @@
32
32
  */
33
33
  import type { Context } from 'hono';
34
34
  import type { Logger } from '@fuzdev/fuz_util/log.ts';
35
- import { type ValidationSchema } from '../schema_issues.js';
35
+ import { type AnySchema } from '@fuzdev/fuz_schema/schema.ts';
36
36
  /**
37
37
  * Generic SSE stream controller interface.
38
38
  *
@@ -118,8 +118,8 @@ export declare const create_sse_response: <T = unknown>(c: Context, log: Logger,
118
118
  export interface EventSpec {
119
119
  /** Event method name, used as the JSON-RPC notification `method`. */
120
120
  method: string;
121
- /** Schema for the notification `params` payload, Zod or `@fuzdev/fuz_schema`. */
122
- params: ValidationSchema;
121
+ /** Schema for the notification `params` payload. */
122
+ params: AnySchema;
123
123
  /** Human-readable description for surface output and docs. */
124
124
  description: string;
125
125
  /** Channel this event broadcasts on. Omit for cross-channel events. */
@@ -1 +1 @@
1
- {"version":3,"file":"sse.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/realtime/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;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E,MAAM,GAAG,IAAI,CAAC;CAC9B;AA8DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,GAAG,OAAO,EAC9C,GAAG,OAAO,EACV,KAAK,MAAM,EACX,UAAU,kBAAkB,KAC1B;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;CAsG5C,CAAC;AAEF,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACzB,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,MAAM,EAAE,SAAS,CAAC;IAClB,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,CAAC,SAAS,eAAe,EACrE,aAAa;IAAE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAAE,EAC9D,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,KAAK,MAAM,KACT;IAAE,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CAmBjD,CAAC"}
@@ -32,9 +32,9 @@
32
32
  */
33
33
  import { streamSSE } from 'hono/streaming';
34
34
  import { DEV } from 'esm-env';
35
+ import { parse } from '@fuzdev/fuz_schema/schema.ts';
35
36
  import { utf8_length } from '../actions/transports.js';
36
37
  import { OutboundBudget } from './outbound_budget.js';
37
- import { parse_any } from '../schema_issues.js';
38
38
  import { SSE_CONNECTED_COMMENT, SSE_KEEP_ALIVE_COMMENT, SSE_KEEP_ALIVE_INTERVAL_MS, SSE_OUTBOUND_QUEUE_BYTES, validate_sse_keep_alive_ms } from './sse_constants.js';
39
39
  const is_node_connection_stream = (value) => {
40
40
  if (typeof value !== 'object' || value === null)
@@ -249,7 +249,7 @@ export const create_validated_broadcaster = (broadcaster, event_specs, log) => {
249
249
  log.warn(`Unknown event method: '${data.method}'`);
250
250
  }
251
251
  else {
252
- const result = parse_any(spec.params, data.params);
252
+ const result = parse(spec.params, data.params);
253
253
  if (!result.ok) {
254
254
  log.warn(`Params mismatch for '${data.method}':`, result.issues);
255
255
  }
@@ -1,102 +1,39 @@
1
1
  /**
2
- * Validation issues from either schema library the stack's specs use: Zod
3
- * (`z.core.$ZodIssue`) and `@fuzdev/fuz_schema` (`SchemaIssue`). A schema is
4
- * wholly one library, so one parse's issues are all of one kind; these
5
- * helpers read either, so the dispatcher, `ActionEvent` and the
6
- * forward-compatible reads treat a spec the same whichever library it is
7
- * written in, and an error response carries either library's issues in one
8
- * shape, `WireIssue`.
2
+ * Validation issues of a `@fuzdev/fuz_schema` parse (`SchemaIssue`) as the
3
+ * stack reads them: on the input or on a field, unknown keys, text, and the
4
+ * one shape every error response carries them in, `WireIssue`.
9
5
  *
10
6
  * @module
11
7
  */
12
- import type { z } from 'zod';
13
- import { SchemaError, type AnySchema, type Infer, type InferInput, type Schema, type SchemaIssue } from '@fuzdev/fuz_schema/schema.ts';
14
- import type { Result } from '@fuzdev/fuz_util/result.ts';
15
- /** A schema of either library: a Zod schema or a `@fuzdev/fuz_schema` one. */
16
- export type ValidationSchema = z.ZodType | AnySchema;
8
+ import { SchemaError, type AnySchema, type Infer, type SchemaIssue } from '@fuzdev/fuz_schema/schema.ts';
17
9
  /**
18
- * Whether `value` is a Zod schema of the classic API, as `z.ZodType`'s
19
- * `instanceof` reads it (`zod_has_trait`): by the schema's traits, so a schema
20
- * made by another copy of Zod is one too. Imports no Zod at runtime.
21
- *
22
- * @param value - any value
23
- */
24
- export declare const is_zod_schema: (value: unknown) => value is z.ZodType;
25
- /**
26
- * Throw unless `value` is a Zod schema, naming `label` — what a reader of a
27
- * spec's schema calls once it has ruled out a `@fuzdev/fuz_schema` schema
28
- * (`is_schema`), so a value of neither library fails loudly where it is read,
29
- * rather than as a `TypeError` deeper in or a silent `undefined`.
30
- *
31
- * @param value - the schema, known not to be a fuz_schema schema
32
- * @param label - names the schema in the error, e.g. `` `action 'foo' input` ``
33
- * @throws Error when `value` is not a Zod schema, saying it is of neither library
34
- */
35
- export declare function assert_zod_schema(value: unknown, label: string): asserts value is z.ZodType;
36
- /**
37
- * Throw unless `value` is a schema of either library (`is_schema` or
38
- * `is_zod_schema`), naming `label` — what spec registration runs on each
39
- * schema slot, so a value of neither library fails at registration rather
40
- * than at request time.
10
+ * Throw unless `value` is a `@fuzdev/fuz_schema` schema (`is_schema`), naming
11
+ * `label` — what spec registration runs on each schema slot, so a value that
12
+ * is no schema fails at registration rather than at request time.
41
13
  *
42
14
  * @param value - the value a spec declares as a schema
43
15
  * @param label - names the spec and slot in the error, e.g. `` `RPC action "foo": input` ``
44
- * @throws Error when `value` is neither a Zod nor a fuz_schema schema
45
- */
46
- export declare function assert_validation_schema(value: unknown, label: string): asserts value is ValidationSchema;
47
- /**
48
- * The output type of a `ValidationSchema`: fuz_schema's `Infer` or Zod's
49
- * `z.output`. The test narrows `T` itself: `Infer<T & Schema>` would read as
50
- * `unknown`.
51
- */
52
- export type ValidationOutput<T extends ValidationSchema> = T extends Schema ? Infer<T> : T extends z.ZodType ? z.output<T> : never;
53
- /** The input type of a `ValidationSchema`: fuz_schema's `InferInput` or Zod's `z.input`. */
54
- export type ValidationInput<T extends ValidationSchema> = T extends Schema ? InferInput<T> : T extends z.ZodType ? z.input<T> : never;
55
- /** One issue of a failed parse, in the library's own shape. */
56
- export type AnyIssue = z.core.$ZodIssue | SchemaIssue;
57
- /** What `parse_any` returns: the output, or the failed parse's issues in the library's order. */
58
- export type ParseAnyResult<T> = Result<{
59
- value: T;
60
- }, {
61
- issues: Array<AnyIssue>;
62
- }>;
63
- /**
64
- * Parse `value` with a schema of either library: `parse` for a fuz_schema
65
- * schema (`is_schema`), `safeParse` for a Zod one.
66
- *
67
- * A fuz_schema parse reports at most its first hundred issues, a Zod parse
68
- * every issue.
69
- *
70
- * @param schema - a Zod or fuz_schema schema
71
- * @param value - the value to validate
72
- * @returns the output, or the issues
73
- * @throws Error when `schema` is neither a Zod nor a fuz_schema schema
16
+ * @throws Error when `value` is not a fuz_schema schema
74
17
  */
75
- export declare const parse_any: <T extends ValidationSchema>(schema: T, value: unknown) => ParseAnyResult<ValidationOutput<T>>;
76
- /**
77
- * Whether `issue` is Zod's: every Zod issue has a `code`, a fuz_schema issue a `kind`.
78
- */
79
- export declare const is_zod_issue: (issue: AnyIssue) => issue is z.core.$ZodIssue;
18
+ export declare function assert_validation_schema(value: unknown, label: string): asserts value is AnySchema;
80
19
  /**
81
20
  * Whether `issue` sits on the input itself rather than on one of its fields:
82
21
  * a non-object input, or an unknown key on the input object — what the Rust
83
22
  * twin refuses before reading any field.
84
23
  *
85
- * Zod reports both at an empty path, its `unrecognized_keys` naming the keys.
86
- * fuz_schema reports a non-object at an empty path and each unknown key as an
24
+ * A non-object is reported at an empty path, and each unknown key as an
87
25
  * `unknown_key` issue whose path ends at the key, so one on the input has a
88
- * path of the key alone. An unknown key on a nested object is on that field,
89
- * as Zod's is.
26
+ * path of the key alone. An unknown key on a nested object is on that field.
90
27
  *
91
28
  * On the wire the `unknown_key` rule changes no answer today: a root
92
29
  * `unknown_key` comes from a root `object`, which `resolve_issues_invalid_reason`
93
30
  * already answers with none from its check of the input's keys, or from a
94
31
  * schema such as a `variant` whose fields resolve no reason. It is kept as the
95
- * direct statement of Zod's rule.
32
+ * direct statement of the rule.
96
33
  *
97
34
  * @param issue - one issue of a failed parse
98
35
  */
99
- export declare const issue_is_on_input: (issue: AnyIssue) => boolean;
36
+ export declare const issue_is_on_input: (issue: SchemaIssue) => boolean;
100
37
  /** Keys a parse refused as unknown, and the path of the object holding them. */
101
38
  export interface UnknownKeyTarget {
102
39
  /** The path of the object the keys are on, `[]` for the input itself. */
@@ -106,110 +43,65 @@ export interface UnknownKeyTarget {
106
43
  }
107
44
  /**
108
45
  * The unknown keys among `issues`, each with the path of its object, or
109
- * `null` when any issue is something else.
110
- *
111
- * A Zod `unrecognized_keys` issue is at its object's path and names every
112
- * key; a fuz_schema `unknown_key` issue is one key, the last element of its
113
- * path.
46
+ * `null` when any issue is something else. An `unknown_key` issue is one
47
+ * key, the last element of its path.
114
48
  *
115
49
  * @param issues - a failed parse's issues
116
50
  * @returns a target per issue, or `null` when not every issue is an unknown key
117
51
  */
118
- export declare const unknown_key_targets: (issues: ReadonlyArray<AnyIssue>) => Array<UnknownKeyTarget> | null;
52
+ export declare const unknown_key_targets: (issues: ReadonlyArray<SchemaIssue>) => Array<UnknownKeyTarget> | null;
119
53
  /**
120
- * A failed parse's issues as text. Zod issues read as `z.prettifyError`
121
- * writes them — shortest path first, each `✖ message` and, when it has a
122
- * path, ` → at path` — without importing Zod at runtime; fuz_schema issues
123
- * are their `format_issue` lines.
54
+ * A failed parse's issues as text, a `format_issue` line each.
124
55
  *
125
- * @param issues - a failed parse's issues, all of one library
56
+ * @param issues - a failed parse's issues
126
57
  */
127
- export declare const format_issues: (issues: ReadonlyArray<AnyIssue>) => string;
58
+ export declare const format_issues: (issues: ReadonlyArray<SchemaIssue>) => string;
128
59
  /**
129
- * Whether `err` is a thrown validation failure of either library: a
130
- * `z.ZodError` or a fuz_schema `SchemaError` (`parse_or_throw`). Both carry
131
- * the failed parse's `issues`.
60
+ * Whether `err` is a thrown validation failure, a `SchemaError`
61
+ * (`parse_or_throw`), which carries the failed parse's `issues`.
132
62
  *
133
63
  * @param err - a caught value
134
64
  */
135
- export declare const is_schema_validation_error: (err: unknown) => err is z.ZodError | SchemaError;
65
+ export declare const is_schema_validation_error: (err: unknown) => err is SchemaError;
136
66
  /**
137
67
  * A `@fuzdev/fuz_schema` `loose_object`: a validation issue as an error
138
- * response carries it, for either schema library — fuz_schema's `SchemaIssue`
139
- * as JSON, with `message` the text of the issue. `to_wire_issues` builds it
140
- * from either library's issues.
68
+ * response carries it — `SchemaIssue` as JSON, with `message` the text of the
69
+ * issue. `to_wire_issues` builds it.
141
70
  *
142
71
  * Loose: a client reads it, and a newer server may add fields.
143
72
  */
144
- export declare const WireIssue: Schema<{
73
+ export declare const WireIssue: import("@fuzdev/fuz_schema/schema.ts").Schema<{
145
74
  kind: string;
146
- message: string;
147
75
  path: (string | number)[];
148
76
  expected: string;
149
77
  received: string;
78
+ message: string;
150
79
  } & Record<string, unknown>, {
151
80
  kind: string;
152
- message: string;
153
81
  path: (string | number)[];
154
82
  expected: string;
155
83
  received: string;
84
+ message: string;
156
85
  } & Record<string, unknown>, "loose_object", {
157
86
  /** The fuz_schema kind of the check that failed, or `unknown_key` / `missing_key`. */
158
- kind: Schema<string, string, "string", undefined>;
87
+ kind: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
159
88
  /** Keys from the root value to the one that failed, outermost first. */
160
- path: Schema<(string | number)[], (string | number)[], "array", Schema<string | number, string | number, "union", readonly [Schema<string, string, "string", undefined>, Schema<number, number, "number", undefined>]>>;
89
+ path: import("@fuzdev/fuz_schema/schema.ts").Schema<(string | number)[], (string | number)[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<string | number, string | number, "union", readonly [import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>]>>;
161
90
  /** Describes what was expected, as fuz_schema writes it. */
162
- expected: Schema<string, string, "string", undefined>;
91
+ expected: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
163
92
  /** The type of the value that failed: `'null'`, `'array'`, `'NaN'`, `'Infinity'`, `'-Infinity'`, or its `typeof`. */
164
- received: Schema<string, string, "string", undefined>;
165
- /** The issue as text: `format_issue` for a fuz_schema issue, Zod's own message for a Zod one. */
166
- message: Schema<string, string, "string", undefined>;
93
+ received: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
94
+ /** The issue as text, `format_issue`'s. */
95
+ message: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
167
96
  }>;
168
97
  export type WireIssue = Infer<typeof WireIssue>;
169
98
  /**
170
- * A failed parse's issues as `WireIssue`s, whichever library made them.
171
- *
172
- * A fuz_schema issue keeps its `kind`, `path`, `expected` and `received`, and
173
- * its `message` is `format_issue`'s text, the path included.
174
- *
175
- * A Zod issue maps to the kind fuz_schema reports for the same check, its
176
- * `message` Zod's own text, which names no path:
99
+ * A failed parse's issues as `WireIssue`s: each keeps its `kind`, `path`,
100
+ * `expected` and `received`, and its `message` is `format_issue`'s text, the
101
+ * path included. A symbol key in a path goes as its text.
177
102
  *
178
- * - `invalid_type` — the type's kind (`string`, `number`, `boolean`,
179
- * `bigint`, `object`, `record`, `array`); `int` is `integer`, a `tuple` an
180
- * `array`, `null`, `undefined`, `void` and `nan` a `literal` of the value,
181
- * `nonoptional` a `missing_key`, and a type fuz_schema has no kind for
182
- * (`date`, `map`, `set`, `file`, `symbol`, `function`, `never`) a `check`
183
- * expecting the type's name. A missing key is reported as fuz_schema
184
- * reports it, as the type expected with `received: 'undefined'`.
185
- * - `too_small` / `too_big` — `min_length` / `max_length` for a string,
186
- * array, set or file (`length >= N`), `min_value` / `max_value` otherwise
187
- * (`>= N`); an exclusive bound writes `>` or `<`, which fuz_schema has no
188
- * check for, and an exact length is reported as the bound it broke.
189
- * - `invalid_format` — `uuid` for a `uuid` or `guid`, `iso_datetime` for a
190
- * `datetime`, `regex` for a `regex` (expecting its pattern), and a `check`
191
- * expecting the format's name for every other format.
192
- * - `unrecognized_keys` — an `unknown_key` per key, the key appended to the
193
- * path, as fuz_schema reports them.
194
- * - `invalid_union` — a `variant` expecting the options when Zod names a
195
- * discriminator, else a `union` expecting each option as fuz_schema names
196
- * it: by the type or the values it expected of the value, or by the
197
- * value's type when the option took the type and failed a refinement or a
198
- * field below. A union refused because more than one option matched is a
199
- * `union` expecting `exactly one option`.
200
- * - `invalid_value` — a `literal` of one value, a `one_of` of more.
201
- * - `custom` — a `check`; `not_multiple_of` a `check` expecting
202
- * `multiple of N`; `invalid_key` and `invalid_element` a `check` expecting
203
- * `a valid key` / `a valid element`.
204
- *
205
- * A Zod issue holds no value, so `received` is read from `input` at the
206
- * issue's path: `'undefined'` where a key is missing or the path leads
207
- * through something that isn't an object. Where an earlier step of a Zod
208
- * pipe replaced the value, it names the input's value, not the replacement.
209
- *
210
- * @param issues - a failed parse's issues, either library
211
- * @param input - the value that was parsed
212
- * @returns the issues, one per issue but for a Zod `unrecognized_keys`, which is one per key
103
+ * @param issues - a failed parse's issues
104
+ * @returns one per issue
213
105
  */
214
- export declare const to_wire_issues: (issues: ReadonlyArray<AnyIssue>, input: unknown) => Array<WireIssue>;
106
+ export declare const to_wire_issues: (issues: ReadonlyArray<SchemaIssue>) => Array<WireIssue>;
215
107
  //# sourceMappingURL=schema_issues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema_issues.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/schema_issues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAON,WAAW,EAGX,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAIzD,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC;AAErD;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,CAAC,CAAC,OAC1B,CAAC;AAEjC;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,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