@fuzdev/fuz_app 0.163.0 → 0.165.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 (199) hide show
  1. package/README.md +2 -1
  2. package/dist/actions/action_event_data.d.ts +1 -1
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +4 -0
  5. package/dist/actions/action_spec.d.ts +3 -3
  6. package/dist/actions/action_spec.d.ts.map +1 -1
  7. package/dist/auth/CLAUDE.md +1 -1
  8. package/dist/auth/account_route_schema.d.ts +3 -27
  9. package/dist/auth/account_route_schema.d.ts.map +1 -1
  10. package/dist/auth/account_route_schema.js +6 -20
  11. package/dist/auth/admin_action_specs.d.ts +56 -56
  12. package/dist/auth/audit_log_route_schema.d.ts +1 -1
  13. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  14. package/dist/auth/audit_log_route_schema.js +4 -5
  15. package/dist/auth/audit_log_schema.d.ts +18 -18
  16. package/dist/auth/bootstrap_route_schema.d.ts +1 -30
  17. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  18. package/dist/auth/bootstrap_route_schema.js +3 -8
  19. package/dist/auth/daemon_token.d.ts +4 -4
  20. package/dist/auth/daemon_token.d.ts.map +1 -1
  21. package/dist/auth/daemon_token.js +3 -3
  22. package/dist/auth/daemon_token_middleware.d.ts +1 -1
  23. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  24. package/dist/auth/daemon_token_middleware.js +5 -5
  25. package/dist/auth/middleware.js +4 -4
  26. package/dist/auth/role_grant_offer_action_specs.d.ts +2 -2
  27. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  28. package/dist/auth/signup_route_schema.js +3 -7
  29. package/dist/db/CLAUDE.md +2 -1
  30. package/dist/db/file_fact_url.d.ts +11 -6
  31. package/dist/db/file_fact_url.d.ts.map +1 -1
  32. package/dist/db/file_fact_url.js +5 -5
  33. package/dist/db/schema_ready.d.ts +0 -5
  34. package/dist/db/schema_ready.d.ts.map +1 -1
  35. package/dist/db/schema_ready.js +0 -5
  36. package/dist/http/CLAUDE.md +105 -71
  37. package/dist/http/auth_shape.d.ts +48 -29
  38. package/dist/http/auth_shape.d.ts.map +1 -1
  39. package/dist/http/auth_shape.js +12 -85
  40. package/dist/http/body_limit.d.ts +12 -0
  41. package/dist/http/body_limit.d.ts.map +1 -1
  42. package/dist/http/body_limit.js +15 -0
  43. package/dist/http/body_limit_schema.d.ts +20 -0
  44. package/dist/http/body_limit_schema.d.ts.map +1 -0
  45. package/dist/http/body_limit_schema.js +20 -0
  46. package/dist/http/common_routes.d.ts +1 -1
  47. package/dist/http/common_routes.d.ts.map +1 -1
  48. package/dist/http/common_routes.js +11 -14
  49. package/dist/http/db_routes.d.ts.map +1 -1
  50. package/dist/http/db_routes.js +59 -69
  51. package/dist/http/dev_route_error_check.d.ts +70 -0
  52. package/dist/http/dev_route_error_check.d.ts.map +1 -0
  53. package/dist/http/dev_route_error_check.js +119 -0
  54. package/dist/http/error_schemas.d.ts +365 -189
  55. package/dist/http/error_schemas.d.ts.map +1 -1
  56. package/dist/http/error_schemas.js +256 -149
  57. package/dist/http/health_schema.d.ts +10 -6
  58. package/dist/http/health_schema.d.ts.map +1 -1
  59. package/dist/http/health_schema.js +3 -3
  60. package/dist/http/middleware_spec.d.ts +8 -3
  61. package/dist/http/middleware_spec.d.ts.map +1 -1
  62. package/dist/http/origin.d.ts +12 -43
  63. package/dist/http/origin.d.ts.map +1 -1
  64. package/dist/http/origin.js +10 -6
  65. package/dist/http/route_error_check.d.ts +179 -0
  66. package/dist/http/route_error_check.d.ts.map +1 -0
  67. package/dist/http/route_error_check.js +283 -0
  68. package/dist/http/route_errors.d.ts +80 -0
  69. package/dist/http/route_errors.d.ts.map +1 -0
  70. package/dist/http/route_errors.js +83 -0
  71. package/dist/http/route_spec.d.ts +33 -17
  72. package/dist/http/route_spec.d.ts.map +1 -1
  73. package/dist/http/route_spec.js +48 -62
  74. package/dist/http/schema_helpers.d.ts +15 -34
  75. package/dist/http/schema_helpers.d.ts.map +1 -1
  76. package/dist/http/schema_helpers.js +11 -47
  77. package/dist/http/surface.d.ts +19 -12
  78. package/dist/http/surface.d.ts.map +1 -1
  79. package/dist/http/surface.js +25 -38
  80. package/dist/http/surface_query.d.ts +11 -2
  81. package/dist/http/surface_query.d.ts.map +1 -1
  82. package/dist/http/surface_query.js +7 -1
  83. package/dist/primitive_schemas_fuz.d.ts +17 -3
  84. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  85. package/dist/primitive_schemas_fuz.js +13 -3
  86. package/dist/rate_limiter.d.ts +13 -0
  87. package/dist/rate_limiter.d.ts.map +1 -1
  88. package/dist/rate_limiter.js +20 -2
  89. package/dist/schema_issues.d.ts +29 -11
  90. package/dist/schema_issues.d.ts.map +1 -1
  91. package/dist/schema_issues.js +11 -10
  92. package/dist/schema_meta.d.ts +8 -1
  93. package/dist/schema_meta.d.ts.map +1 -1
  94. package/dist/schema_meta.js +2 -1
  95. package/dist/server/app_server.d.ts +3 -1
  96. package/dist/server/app_server.d.ts.map +1 -1
  97. package/dist/server/app_server.js +24 -10
  98. package/dist/server/serve_fact_route.d.ts.map +1 -1
  99. package/dist/server/serve_fact_route.js +8 -31
  100. package/dist/server/surface_route.d.ts.map +1 -1
  101. package/dist/server/surface_route.js +5 -6
  102. package/dist/server/x_accel.d.ts +12 -7
  103. package/dist/server/x_accel.d.ts.map +1 -1
  104. package/dist/server/x_accel.js +7 -9
  105. package/dist/testing/CLAUDE.md +105 -61
  106. package/dist/testing/admin_integration.js +2 -2
  107. package/dist/testing/adversarial_404.d.ts +4 -18
  108. package/dist/testing/adversarial_404.d.ts.map +1 -1
  109. package/dist/testing/adversarial_404.js +20 -52
  110. package/dist/testing/adversarial_headers.d.ts +3 -4
  111. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  112. package/dist/testing/adversarial_headers.js +8 -6
  113. package/dist/testing/adversarial_input.d.ts.map +1 -1
  114. package/dist/testing/adversarial_input.js +20 -19
  115. package/dist/testing/assertions.d.ts +46 -14
  116. package/dist/testing/assertions.d.ts.map +1 -1
  117. package/dist/testing/assertions.js +73 -16
  118. package/dist/testing/attack_surface.d.ts +17 -35
  119. package/dist/testing/attack_surface.d.ts.map +1 -1
  120. package/dist/testing/attack_surface.js +36 -95
  121. package/dist/testing/auth_apps.d.ts.map +1 -1
  122. package/dist/testing/auth_apps.js +2 -1
  123. package/dist/testing/cross_backend/action_manifest.d.ts +126 -56
  124. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  125. package/dist/testing/cross_backend/action_manifest.js +11 -11
  126. package/dist/testing/cross_backend/action_manifest_parity.d.ts +1 -1
  127. package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
  128. package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
  129. package/dist/testing/cross_backend/cell_crud.js +2 -1
  130. package/dist/testing/cross_backend/conformance_table.js +1 -1
  131. package/dist/testing/cross_backend/fact_serving.js +3 -3
  132. package/dist/testing/cross_backend/in_process_setup.d.ts +7 -3
  133. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  134. package/dist/testing/cross_backend/in_process_setup.js +11 -4
  135. package/dist/testing/cross_backend/origin_conformance.d.ts +278 -102
  136. package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
  137. package/dist/testing/cross_backend/origin_conformance.js +21 -21
  138. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  139. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +7 -1
  140. package/dist/testing/cross_backend/setup.d.ts +13 -0
  141. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  142. package/dist/testing/cross_backend/setup.js +24 -7
  143. package/dist/testing/cross_backend/spine_suites.d.ts +3 -2
  144. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  145. package/dist/testing/cross_backend/spine_suites.js +5 -2
  146. package/dist/testing/cross_backend/standard.d.ts +31 -0
  147. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  148. package/dist/testing/cross_backend/standard.js +9 -3
  149. package/dist/testing/cross_backend/testing_origin_check.d.ts +147 -71
  150. package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
  151. package/dist/testing/cross_backend/testing_origin_check.js +16 -13
  152. package/dist/testing/cross_backend/testing_reset_actions.d.ts +70 -27
  153. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  154. package/dist/testing/data_exposure.d.ts +7 -0
  155. package/dist/testing/data_exposure.d.ts.map +1 -1
  156. package/dist/testing/data_exposure.js +8 -7
  157. package/dist/testing/error_coverage.d.ts +53 -61
  158. package/dist/testing/error_coverage.d.ts.map +1 -1
  159. package/dist/testing/error_coverage.js +86 -119
  160. package/dist/testing/integration.d.ts +28 -1
  161. package/dist/testing/integration.d.ts.map +1 -1
  162. package/dist/testing/integration.js +54 -29
  163. package/dist/testing/integration_helpers.d.ts +37 -9
  164. package/dist/testing/integration_helpers.d.ts.map +1 -1
  165. package/dist/testing/integration_helpers.js +75 -40
  166. package/dist/testing/middleware.d.ts +3 -5
  167. package/dist/testing/middleware.d.ts.map +1 -1
  168. package/dist/testing/middleware.js +5 -4
  169. package/dist/testing/middleware_gate_probes.d.ts +90 -0
  170. package/dist/testing/middleware_gate_probes.d.ts.map +1 -0
  171. package/dist/testing/middleware_gate_probes.js +179 -0
  172. package/dist/testing/rate_limiting.d.ts +1 -1
  173. package/dist/testing/rate_limiting.d.ts.map +1 -1
  174. package/dist/testing/rate_limiting.js +5 -4
  175. package/dist/testing/round_trip.d.ts +7 -0
  176. package/dist/testing/round_trip.d.ts.map +1 -1
  177. package/dist/testing/round_trip.js +8 -5
  178. package/dist/testing/schema_generators.d.ts +40 -11
  179. package/dist/testing/schema_generators.d.ts.map +1 -1
  180. package/dist/testing/schema_generators.js +71 -17
  181. package/dist/testing/stubs.d.ts +10 -1
  182. package/dist/testing/stubs.d.ts.map +1 -1
  183. package/dist/testing/stubs.js +15 -5
  184. package/dist/testing/surface_invariants.d.ts +36 -115
  185. package/dist/testing/surface_invariants.d.ts.map +1 -1
  186. package/dist/testing/surface_invariants.js +106 -269
  187. package/dist/testing/transports/raw_http.d.ts +10 -2
  188. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  189. package/dist/testing/transports/raw_http.js +10 -4
  190. package/dist/ui/CLAUDE.md +4 -2
  191. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  192. package/dist/ui/auth_state.svelte.js +2 -8
  193. package/dist/ui/backend_probe.svelte.js +3 -3
  194. package/dist/ui/table_state.svelte.d.ts.map +1 -1
  195. package/dist/ui/table_state.svelte.js +1 -8
  196. package/dist/ui/ui_fetch.d.ts +12 -2
  197. package/dist/ui/ui_fetch.d.ts.map +1 -1
  198. package/dist/ui/ui_fetch.js +22 -4
  199. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"error_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/error_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvE,0CAA0C;AAC1C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAG,kBAA2B,CAAC;AAIlE,wCAAwC;AACxC,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAC;AAEhF,+CAA+C;AAC/C,eAAO,MAAM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,MAAM,mBAAmB,GAAI,gEAOjC,wBAAwB,KAAG,KAAK,CAAC,YAAY,CAsC/C,CAAC"}
@@ -2,26 +2,31 @@
2
2
  * Standard error response schemas and error code constants for fuz_app routes.
3
3
  *
4
4
  * Defines `ERROR_*` constants (single source of truth for machine-parseable
5
- * error codes), Zod schemas for error response shapes, a type for error schema
6
- * maps, and `derive_error_schemas` to auto-populate middleware-produced errors
7
- * from a route's auth requirement and input schema.
5
+ * error codes, which double as JSON-RPC `data.reason`s), the per-code REST
6
+ * error definitions (`rest_error`, one `REST_*` per code a route or middleware
7
+ * answers, each with its HTTP status and its body as a `@fuzdev/fuz_schema`
8
+ * schema), a type for error schema maps, and `derive_route_errors`, the
9
+ * definitions the framework answers a route with from its method, auth
10
+ * requirement, and input slots.
8
11
  *
9
- * Used in `RouteSpec.errors` and `MiddlewareSpec.errors` for surface
10
- * introspection and DEV-mode validation.
12
+ * Used in `RouteSpec.errors` and `MiddlewareSpec.errors`, which each route's
13
+ * error map (`http/route_errors.ts`) unions with the derived definitions for
14
+ * the surface, the DEV error check, and the test helpers.
11
15
  *
12
16
  * @module
13
17
  */
14
- import { z } from 'zod';
18
+ import { array, integer, literal, loose_object, min_value, number, optional, pipe, string, boolean, union } from '@fuzdev/fuz_schema/schema.ts';
19
+ import { meta } from '@fuzdev/fuz_schema/meta.ts';
15
20
  import { needs_actor } from './auth_shape.js';
16
21
  import { WireIssue } from '../schema_issues.js';
17
22
  // --- Core: Validation (auto-derived by route spec middleware) ---
18
- /** Request body failed Zod validation. */
23
+ /** Request body failed its input schema. */
19
24
  export const ERROR_INVALID_REQUEST_BODY = 'invalid_request_body';
20
25
  /** Request body is not valid JSON or not an object. */
21
26
  export const ERROR_INVALID_JSON_BODY = 'invalid_json_body';
22
- /** URL path params failed Zod validation. */
27
+ /** URL path params failed their schema. */
23
28
  export const ERROR_INVALID_ROUTE_PARAMS = 'invalid_route_params';
24
- /** URL query params failed Zod validation. */
29
+ /** URL query params failed their schema. */
25
30
  export const ERROR_INVALID_QUERY_PARAMS = 'invalid_query_params';
26
31
  /**
27
32
  * An RPC call's `params` hold an own `__proto__` key, at any depth — refused
@@ -37,7 +42,7 @@ export const ERROR_INSUFFICIENT_PERMISSIONS = 'insufficient_permissions';
37
42
  /**
38
43
  * Route requires a credential type the request didn't arrive on.
39
44
  * Symmetric with `ERROR_INSUFFICIENT_PERMISSIONS` + `required_roles`:
40
- * the body carries `required_credential_types: ReadonlyArray<string>`
45
+ * the body carries `required_credential_types: Array<string>`
41
46
  * — what the route demanded, not what arrived. Today the only
42
47
  * credential gate is keeper (`['daemon_token']`); future gates
43
48
  * (`agent_token`, `group_actor_token`) reuse the same literal and
@@ -73,6 +78,13 @@ export const ERROR_INVALID_CONTENT_LENGTH = 'invalid_content_length';
73
78
  // --- Origin & bearer token verification ---
74
79
  /** Request origin not in allowlist. */
75
80
  export const ERROR_FORBIDDEN_ORIGIN = 'forbidden_origin';
81
+ /**
82
+ * The request's `Host` names a host the server doesn't answer to — the Rust
83
+ * spine's DNS-rebinding gate (`host_gate`), its `FORBIDDEN_HOST_REASON`. The
84
+ * TS spine has no host gate; a surface describing a Rust server that mounts
85
+ * one declares it.
86
+ */
87
+ export const ERROR_FORBIDDEN_HOST = 'forbidden_host';
76
88
  /**
77
89
  * A `POST` whose `Content-Type` the route refuses: anything but
78
90
  * `application/json` on a JSON route, a CORS-safelisted type or none on a
@@ -178,180 +190,275 @@ export const ERROR_TABLE_NOT_DELETABLE = 'table_not_deletable';
178
190
  export const ERROR_ROW_NOT_FOUND = 'row_not_found';
179
191
  /** Database health-check query failed (connectivity or query error). */
180
192
  export const ERROR_DATABASE_CONNECTION_FAILED = 'database_connection_failed';
181
- // --- Standard error shapes ---
182
- // Using z.looseObject — error responses may carry extra context fields.
183
- /** Base API error — all JSON error responses have at least `{error: string}`. */
184
- export const ApiError = z.looseObject({ error: z.string() });
193
+ // --- Readiness (`GET /ready`) ---
194
+ /** The live database lacks a table or column the deploy expects (`db/schema_ready.ts`). */
195
+ export const ERROR_SCHEMA_DRIFT = 'schema_drift';
196
+ /** The readiness check could not query the database. */
197
+ export const ERROR_DB_UNREACHABLE = 'db_unreachable';
198
+ // --- Catch-all ---
199
+ /**
200
+ * An unexpected failure — the catch layer's answer to an error no route
201
+ * declares (`{error: 'internal_error', message?}`, the message DEV-only).
202
+ */
203
+ export const ERROR_INTERNAL_ERROR = 'internal_error';
204
+ /**
205
+ * The grammar of an `error` code: a lowercase ASCII letter, then lowercase
206
+ * letters, digits, and `_` — a code, never prose. Prose goes in `message`.
207
+ */
208
+ export const REST_ERROR_CODE_PATTERN = /^[a-z][a-z0-9_]*$/;
185
209
  /**
186
- * Input validation error — returned when params / query / body fails Zod
187
- * parsing, or when the request body is not valid JSON.
210
+ * Whether a value is an `error` code, by `REST_ERROR_CODE_PATTERN`.
188
211
  *
189
- * `error` is one of the four validation codes the framework emits.
190
- * `issues` carries the validation issues as `WireIssue`s, whichever schema
191
- * library refused, for diagnostic display on the three schema-failure cases (`invalid_request_body`,
192
- * `invalid_route_params`, `invalid_query_params`). The field is optional:
193
- * the `invalid_json_body` case (request body parse failure or non-object
194
- * root) emits no `issues`, and the schema-failure cases emit them only in
195
- * development — production omits them (via `dev_only`) so error responses
196
- * don't leak input-schema structure to callers.
212
+ * @param value - the value to test
197
213
  */
198
- export const ValidationError = z.looseObject({
199
- error: z.enum([
200
- ERROR_INVALID_REQUEST_BODY,
201
- ERROR_INVALID_JSON_BODY,
202
- ERROR_INVALID_ROUTE_PARAMS,
203
- ERROR_INVALID_QUERY_PARAMS
204
- ]),
205
- issues: z.array(WireIssue).optional()
206
- });
214
+ export const is_rest_error_code = (value) => typeof value === 'string' && REST_ERROR_CODE_PATTERN.test(value);
207
215
  /**
208
- * Permission error — returned by `require_role()` and the dispatcher's
209
- * post-authorization role gate when the actor's role_grants don't include any
210
- * of the route's `auth.roles`.
216
+ * Define a REST error: its status, its code, and the fields its body carries
217
+ * beside `error`.
211
218
  *
212
- * `required_roles` carries the full disjunction the route declared
213
- * (`auth.roles` from the new flat-record shape). Single-role specs surface
214
- * as a one-element array; multi-role disjunctions show every admittable
215
- * role so clients can render targeted copy ("requires admin or steward").
219
+ * @param status - the HTTP status it answers at, a literal
220
+ * @param code - the `error` code, a literal matching `REST_ERROR_CODE_PATTERN`, usually an `ERROR_*` constant
221
+ * @param fields - the body's other entries
222
+ * @param headers - the response headers to derive from a body
223
+ * @returns the definition, its body schema a `loose_object`
224
+ * @throws Error when `code` is not an error code (`REST_ERROR_CODE_PATTERN`), or
225
+ * when `fields` has an own `error` entry, which would replace the code
216
226
  */
217
- export const PermissionError = z.looseObject({
218
- error: z.literal(ERROR_INSUFFICIENT_PERMISSIONS),
219
- required_roles: z.array(z.string()).readonly()
220
- });
227
+ // @__NO_SIDE_EFFECTS__
228
+ export const rest_error = (status, code, fields, headers) => {
229
+ if (fields && Object.hasOwn(fields, 'error')) {
230
+ throw new Error(`rest_error: fields of ${JSON.stringify(code)} hold an \`error\` entry, which would replace its code`);
231
+ }
232
+ if (!is_rest_error_code(code)) {
233
+ throw new Error(`rest_error: ${JSON.stringify(code)} is not an error code (${REST_ERROR_CODE_PATTERN.source}) — put prose in \`message\``);
234
+ }
235
+ const def_fields = (fields ?? {});
236
+ const schema = loose_object({
237
+ error: literal(code),
238
+ ...def_fields
239
+ });
240
+ return headers
241
+ ? { status, code, fields: def_fields, schema, headers }
242
+ : { status, code, fields: def_fields, schema };
243
+ };
221
244
  /**
222
- * Credential-type error — returned by the dispatcher's post-authorization
223
- * credential gate (and the `require_credential_types` REST middleware) when
224
- * the request's credential type isn't in the route's
225
- * `auth.credential_types` allowlist.
245
+ * Whether two definitions are the same: one object, or the same status, code,
246
+ * and `headers`, with the same schema at every field.
226
247
  *
227
- * `required_credential_types` carries what the route declared
228
- * (`['daemon_token']` for keeper; future gates carry their own labels).
229
- * Symmetric with `PermissionError`'s `required_roles`: clients see what
230
- * the route demanded, not what their credential is.
248
+ * @param a - one definition
249
+ * @param b - the other
231
250
  */
232
- export const CredentialTypeRequiredError = z.looseObject({
233
- error: z.literal(ERROR_CREDENTIAL_TYPE_REQUIRED),
234
- required_credential_types: z.array(z.string()).readonly()
235
- });
251
+ export const same_rest_error = (a, b) => {
252
+ if (a === b)
253
+ return true;
254
+ if (a.status !== b.status || a.code !== b.code || a.headers !== b.headers)
255
+ return false;
256
+ const a_keys = Object.keys(a.fields);
257
+ const b_fields = b.fields;
258
+ return (a_keys.length === Object.keys(b.fields).length &&
259
+ a_keys.every((key) => Object.hasOwn(b_fields, key) && b_fields[key] === a.fields[key]));
260
+ };
236
261
  /**
237
- * Token-scope error — returned by the `require_token_scope` guard (and its
238
- * direct-call twin `token_scope_surface_denial`) when a **narrowed** api token
239
- * reaches a capability its scope does not admit. See
240
- * `docs/security.md` §Token scoping.
262
+ * A list of definitions with each repeat after its first left out
263
+ * (`same_rest_error`), in list order.
241
264
  *
242
- * `required_scope` carries the capability string the route demands, verbatim
243
- * from its `auth.required_scope` (`surface:audit_stream`, …) — matching the Rust
244
- * `token_scope_surface_denied_response` and the dispatcher's own per-method
245
- * denial. Third in the family with `PermissionError` and
246
- * `CredentialTypeRequiredError` — each names what the route demanded rather
247
- * than what the caller holds.
265
+ * @param defs - the definitions
266
+ * @returns the distinct definitions
248
267
  */
249
- export const TokenScopeRequiredError = z.looseObject({
250
- error: z.literal(ERROR_TOKEN_SCOPE_REQUIRED),
251
- required_scope: z.string()
252
- });
253
- /** Rate limit error — returned when a rate limiter rejects the request. */
254
- export const RateLimitError = z.looseObject({
255
- error: z.literal(ERROR_RATE_LIMIT_EXCEEDED),
256
- retry_after: z.number()
268
+ export const dedupe_rest_errors = (defs) => {
269
+ const distinct = [];
270
+ for (const def of defs) {
271
+ if (!distinct.some((seen) => same_rest_error(seen, def)))
272
+ distinct.push(def);
273
+ }
274
+ return distinct;
275
+ };
276
+ /**
277
+ * Build an error-schema map from a list of definitions, grouped by status.
278
+ * A status with one definition maps to its schema, and one with more to a
279
+ * `union` of their schemas in list order — two shapes of one code included,
280
+ * each a branch; a definition listed twice counts once (`dedupe_rest_errors`).
281
+ *
282
+ * @param defs - the definitions
283
+ * @returns the error schemas, keyed by status
284
+ */
285
+ export const to_error_schemas = (defs) => {
286
+ const by_status = new Map();
287
+ for (const { status, schema } of dedupe_rest_errors(defs)) {
288
+ const schemas = by_status.get(status);
289
+ if (schemas)
290
+ schemas.push(schema);
291
+ else
292
+ by_status.set(status, [schema]);
293
+ }
294
+ const errors = {};
295
+ for (const [status, schemas] of by_status) {
296
+ errors[status] = schemas.length === 1 ? schemas[0] : union(schemas);
297
+ }
298
+ return errors;
299
+ };
300
+ /**
301
+ * The validation issues a 400 input refusal carries, as `WireIssue`s,
302
+ * whichever schema library refused: optional, since the framework emits them
303
+ * only in development (`dev_only`), so error responses don't leak
304
+ * input-schema structure to callers.
305
+ */
306
+ const INPUT_ISSUES = optional(array(WireIssue));
307
+ // 400: input validation, the route's own middleware
308
+ export const REST_INVALID_REQUEST_BODY = rest_error(400, ERROR_INVALID_REQUEST_BODY, {
309
+ issues: INPUT_ISSUES
257
310
  });
258
- /** Payload too large error — returned when the request body exceeds the size limit. */
259
- export const PayloadTooLargeError = z.looseObject({
260
- error: z.literal(ERROR_PAYLOAD_TOO_LARGE)
311
+ export const REST_INVALID_JSON_BODY = rest_error(400, ERROR_INVALID_JSON_BODY);
312
+ export const REST_INVALID_ROUTE_PARAMS = rest_error(400, ERROR_INVALID_ROUTE_PARAMS, {
313
+ issues: INPUT_ISSUES
261
314
  });
262
- /** Unsupported content type error — returned when a `POST` route refuses the request's `Content-Type`. */
263
- export const UnsupportedContentTypeError = z.looseObject({
264
- error: z.literal(ERROR_UNSUPPORTED_CONTENT_TYPE)
315
+ export const REST_INVALID_QUERY_PARAMS = rest_error(400, ERROR_INVALID_QUERY_PARAMS, {
316
+ issues: INPUT_ISSUES
265
317
  });
266
- /** Foreign key violation error — returned when a delete is blocked by references. */
267
- export const ForeignKeyError = z.looseObject({
268
- error: z.literal(ERROR_FOREIGN_KEY_VIOLATION)
318
+ // 400: the body limit
319
+ export const REST_INVALID_CONTENT_LENGTH = rest_error(400, ERROR_INVALID_CONTENT_LENGTH);
320
+ // 400 and 500: the authorization phase, which resolves the acting actor on a
321
+ // route whose `auth.actor` is not `'none'` (`derive_route_errors`)
322
+ /** No `acting` selector on a multi-actor account; `available` lists the account's actors. */
323
+ export const REST_ACTOR_REQUIRED = rest_error(400, ERROR_ACTOR_REQUIRED, {
324
+ available: array(loose_object({ id: string, name: string }))
269
325
  });
326
+ /** The `acting` selector names an actor that isn't the account's. */
327
+ export const REST_ACTOR_NOT_ON_ACCOUNT = rest_error(400, ERROR_ACTOR_NOT_ON_ACCOUNT);
328
+ // 400: the table browser's row `DELETE`
329
+ export const REST_TABLE_NOT_DELETABLE = rest_error(400, ERROR_TABLE_NOT_DELETABLE);
330
+ export const REST_TABLE_NO_PRIMARY_KEY = rest_error(400, ERROR_TABLE_NO_PRIMARY_KEY);
331
+ // 401
332
+ export const REST_AUTHENTICATION_REQUIRED = rest_error(401, ERROR_AUTHENTICATION_REQUIRED);
333
+ /** `GET /api/account/status`'s anonymous answer: the same code, with the bootstrap status. */
334
+ export const REST_AUTHENTICATION_REQUIRED_BOOTSTRAP = rest_error(401, ERROR_AUTHENTICATION_REQUIRED, { bootstrap_available: optional(boolean) });
335
+ export const REST_INVALID_CREDENTIALS = rest_error(401, ERROR_INVALID_CREDENTIALS);
336
+ /** The bootstrap token didn't match. */
337
+ export const REST_INVALID_TOKEN = rest_error(401, ERROR_INVALID_TOKEN);
338
+ // 403: the auth gates; each names what the route demanded, not what the caller holds
270
339
  /**
271
- * Authorization-phase failure shapes. Surfaced when the dispatcher's
272
- * `apply_authorization_phase` rejects a request before the handler runs —
273
- * the route is acting-aware (input declares `acting?: ActingActor` or
274
- * auth requires role_grants), but actor resolution failed.
275
- *
276
- * 400: `actor_required` (with `available[]`) for unspecified-actor on
277
- * a multi-actor account; `actor_not_on_account` for a supplied actor
278
- * id that doesn't belong to the authenticated account.
279
- *
280
- * 500: `no_actors_on_account` for a signup-invariant violation (the
281
- * actor list enumerated empty); `account_vanished` for a torn-read
282
- * race (account/actor row deleted between credential validation and
283
- * the dispatcher's follow-up read).
284
- *
285
- * Used by `derive_error_schemas` when `auth.actor !== 'none'` so the
286
- * merged error surface matches what the dispatcher actually emits.
340
+ * The role gate's refusal (`require_role`, and the dispatcher's): the actor
341
+ * holds none of the route's `auth.roles`. `required_roles` is the whole
342
+ * disjunction, so a client can say "requires admin or steward".
287
343
  */
288
- export const ActorRequiredError = z.looseObject({
289
- error: z.literal(ERROR_ACTOR_REQUIRED),
290
- available: z.array(z.looseObject({ id: z.string(), name: z.string() }))
291
- });
292
- export const ActorNotOnAccountError = z.looseObject({
293
- error: z.literal(ERROR_ACTOR_NOT_ON_ACCOUNT)
344
+ export const REST_INSUFFICIENT_PERMISSIONS = rest_error(403, ERROR_INSUFFICIENT_PERMISSIONS, {
345
+ required_roles: meta(array(string), { readOnly: true })
294
346
  });
295
- export const NoActorsOnAccountError = z.looseObject({
296
- error: z.literal(ERROR_NO_ACTORS_ON_ACCOUNT)
347
+ /**
348
+ * The credential-type gate's refusal (`require_credential_types`, and the
349
+ * dispatcher's): the request's credential type is not in the route's
350
+ * `auth.credential_types`, which `required_credential_types` carries.
351
+ */
352
+ export const REST_CREDENTIAL_TYPE_REQUIRED = rest_error(403, ERROR_CREDENTIAL_TYPE_REQUIRED, {
353
+ required_credential_types: meta(array(string), { readOnly: true })
297
354
  });
298
- export const AccountVanishedError = z.looseObject({
299
- error: z.literal(ERROR_ACCOUNT_VANISHED)
355
+ /**
356
+ * The token-scope gate's refusal (`require_token_scope`, and
357
+ * `token_scope_surface_denial`): a narrowed api token reaches a capability its
358
+ * scope does not admit. `required_scope` is the route's `auth.required_scope`,
359
+ * verbatim. See `docs/security.md` §Token scoping.
360
+ */
361
+ export const REST_TOKEN_SCOPE_REQUIRED = rest_error(403, ERROR_TOKEN_SCOPE_REQUIRED, {
362
+ required_scope: string
300
363
  });
364
+ // 403: the origin check, bootstrap, signup
365
+ export const REST_FORBIDDEN_ORIGIN = rest_error(403, ERROR_FORBIDDEN_ORIGIN);
366
+ // 403: the Rust spine's host gate
367
+ export const REST_FORBIDDEN_HOST = rest_error(403, ERROR_FORBIDDEN_HOST);
368
+ export const REST_ALREADY_BOOTSTRAPPED = rest_error(403, ERROR_ALREADY_BOOTSTRAPPED);
369
+ export const REST_NO_MATCHING_INVITE = rest_error(403, ERROR_NO_MATCHING_INVITE);
370
+ // 404
371
+ export const REST_TOKEN_FILE_MISSING = rest_error(404, ERROR_TOKEN_FILE_MISSING);
372
+ export const REST_TABLE_NOT_FOUND = rest_error(404, ERROR_TABLE_NOT_FOUND);
373
+ export const REST_ROW_NOT_FOUND = rest_error(404, ERROR_ROW_NOT_FOUND);
374
+ // 409
375
+ /** A delete blocked by rows that reference the row. */
376
+ export const REST_FOREIGN_KEY_VIOLATION = rest_error(409, ERROR_FOREIGN_KEY_VIOLATION);
377
+ export const REST_SIGNUP_CONFLICT = rest_error(409, ERROR_SIGNUP_CONFLICT);
378
+ // 413, 415
379
+ /** The body limit's refusal: the request body exceeds the size limit. */
380
+ export const REST_PAYLOAD_TOO_LARGE = rest_error(413, ERROR_PAYLOAD_TOO_LARGE);
381
+ /** A `POST` route refuses the request's `Content-Type`. */
382
+ export const REST_UNSUPPORTED_CONTENT_TYPE = rest_error(415, ERROR_UNSUPPORTED_CONTENT_TYPE);
383
+ /** The rate limiter's refusal; `retry_after` is in seconds, `Retry-After` its ceiling. */
384
+ export const REST_RATE_LIMIT_EXCEEDED = rest_error(429, ERROR_RATE_LIMIT_EXCEEDED, { retry_after: pipe(number, integer, min_value(0)) }, (body) => ({ 'Retry-After': String(Math.ceil(body.retry_after)) }));
385
+ // 500: the authorization phase, and the catch layer any route can answer with
386
+ /** The account's actors enumerated empty, a signup invariant broken. */
387
+ export const REST_NO_ACTORS_ON_ACCOUNT = rest_error(500, ERROR_NO_ACTORS_ON_ACCOUNT);
388
+ /** The account or actor row was deleted between credential validation and the actor read. */
389
+ export const REST_ACCOUNT_VANISHED = rest_error(500, ERROR_ACCOUNT_VANISHED);
390
+ export const REST_INTERNAL_ERROR = rest_error(500, ERROR_INTERNAL_ERROR);
391
+ // 503: a failed pool checkout any route can answer with, and the health and readiness checks
392
+ export const REST_SERVICE_UNAVAILABLE = rest_error(503, ERROR_SERVICE_UNAVAILABLE);
393
+ export const REST_DATABASE_CONNECTION_FAILED = rest_error(503, ERROR_DATABASE_CONNECTION_FAILED);
394
+ export const REST_SCHEMA_DRIFT = rest_error(503, ERROR_SCHEMA_DRIFT);
395
+ export const REST_DB_UNREACHABLE = rest_error(503, ERROR_DB_UNREACHABLE);
301
396
  /**
302
- * Rate limit key type — declares what a route or RPC action's rate limiter
303
- * is keyed on.
397
+ * Derive the error definitions the framework answers a route with, from its
398
+ * method, auth requirement, input slots, and rate limit — each narrowed to
399
+ * what the route's own middleware can emit.
400
+ *
401
+ * Route handlers declare additional definitions via `RouteSpec.errors`; the
402
+ * route's error map (`resolve_route_error_map`) is the union of these, the
403
+ * applying middleware's, and the route's own.
404
+ *
405
+ * Derivation rules:
406
+ * - **A body**, an `input` other than `null` on a method other than `GET`:
407
+ * 400 `invalid_request_body` and `invalid_json_body`. A `GET` reads no body.
408
+ * - **`params`**: 400 `invalid_route_params`. **`query`**: 400
409
+ * `invalid_query_params`.
410
+ * - **`auth.account === 'required'`** or **`auth.actor === 'required'`**: 401
411
+ * `authentication_required` — the pre-authorization gate's refusal when the
412
+ * credential isn't there. `'optional'` does not derive 401.
413
+ * - **`auth.required_scope`**: 403 `token_scope_required` (carrying
414
+ * `required_scope`). **`auth.credential_types?.length`**: 403
415
+ * `credential_type_required` (carrying `required_credential_types`).
416
+ * **`auth.roles?.length`**: 403 `insufficient_permissions` (carrying
417
+ * `required_roles`). In the order the gates fire; a route with more than
418
+ * one has each.
419
+ * - **`auth.actor !== 'none'`**: 400 `actor_required` and
420
+ * `actor_not_on_account`, and 500 `no_actors_on_account` and
421
+ * `account_vanished` — what the dispatcher's authorization phase emits
422
+ * when it resolves an actor.
423
+ * - **`rate_limit`**: 429 `rate_limit_exceeded` (with `retry_after`).
424
+ * - **`POST`**: 415 `unsupported_content_type` (see
425
+ * `is_post_content_type_refused` in `http/simple_request.ts`).
304
426
  *
305
- * - `'ip'` — per-IP rate limiting (login, bootstrap, password change, signup)
306
- * - `'account'` — per-account rate limiting. On REST auth routes the key is
307
- * the submitted identifier (login). On RPC actions (post-auth) the key is
308
- * the resolved actor id (`request_context.actor.id`) — separate namespace.
309
- * - `'both'` — both keys.
427
+ * @param options - what the derivation reads of the route
428
+ * @returns the definitions, in the order above
310
429
  */
311
- export const RateLimitKey = z.enum(['ip', 'account', 'both']);
312
- export const derive_error_schemas = ({ auth, has_input = false, has_params = false, has_query = false, rate_limit, checks_content_type = false }) => {
313
- const errors = {};
314
- const has_validation = has_input || has_params || has_query;
315
- if (needs_actor(auth)) {
316
- errors[400] = has_validation
317
- ? z.union([ValidationError, ActorRequiredError, ActorNotOnAccountError])
318
- : z.union([ActorRequiredError, ActorNotOnAccountError]);
319
- errors[500] = z.union([NoActorsOnAccountError, AccountVanishedError]);
430
+ export const derive_route_errors = ({ method, auth, has_input = false, has_params = false, has_query = false, rate_limit }) => {
431
+ const defs = [];
432
+ // the input middleware runs on a body only off `GET` (`create_input_validation`)
433
+ if (has_input && method !== 'GET') {
434
+ defs.push(REST_INVALID_REQUEST_BODY, REST_INVALID_JSON_BODY);
320
435
  }
321
- else if (has_validation) {
322
- errors[400] = ValidationError;
436
+ if (has_params)
437
+ defs.push(REST_INVALID_ROUTE_PARAMS);
438
+ if (has_query)
439
+ defs.push(REST_INVALID_QUERY_PARAMS);
440
+ if (needs_actor(auth)) {
441
+ defs.push(REST_ACTOR_REQUIRED, REST_ACTOR_NOT_ON_ACCOUNT, REST_NO_ACTORS_ON_ACCOUNT, REST_ACCOUNT_VANISHED);
323
442
  }
324
443
  // 401 fires when the dispatcher's pre-authorization gate rejects an
325
444
  // unauthenticated caller — `account === 'required'` (no credential) or
326
445
  // `actor === 'required'` (no credential to resolve an actor against,
327
446
  // per registry-time invariant 3 forbidding accountless actors in v1).
328
447
  if (auth.account === 'required' || auth.actor === 'required') {
329
- errors[401] = ApiError;
448
+ defs.push(REST_AUTHENTICATION_REQUIRED);
330
449
  }
331
450
  // 403 fires from any of three gates: the token-scope refusal
332
451
  // (`auth.required_scope`, pre-authorization), the credential-type gate, and
333
- // the role gate (both post-authorization). A route can declare any
334
- // combination, so collect the shapes its gates can emit — in the order they
335
- // fire — and union them when there's more than one, so DEV-mode
336
- // error-schema validation accepts whichever the pipeline produced.
337
- const forbidden_shapes = [];
452
+ // the role gate (both post-authorization), in the order they fire
338
453
  if (auth.required_scope !== undefined)
339
- forbidden_shapes.push(TokenScopeRequiredError);
454
+ defs.push(REST_TOKEN_SCOPE_REQUIRED);
340
455
  if (auth.credential_types?.length)
341
- forbidden_shapes.push(CredentialTypeRequiredError);
456
+ defs.push(REST_CREDENTIAL_TYPE_REQUIRED);
342
457
  if (auth.roles?.length)
343
- forbidden_shapes.push(PermissionError);
344
- if (forbidden_shapes.length === 1) {
345
- errors[403] = forbidden_shapes[0];
346
- }
347
- else if (forbidden_shapes.length > 1) {
348
- errors[403] = z.union(forbidden_shapes);
349
- }
350
- if (rate_limit) {
351
- errors[429] = RateLimitError;
352
- }
353
- if (checks_content_type) {
354
- errors[415] = UnsupportedContentTypeError;
355
- }
356
- return errors;
458
+ defs.push(REST_INSUFFICIENT_PERMISSIONS);
459
+ if (rate_limit)
460
+ defs.push(REST_RATE_LIMIT_EXCEEDED);
461
+ if (method === 'POST')
462
+ defs.push(REST_UNSUPPORTED_CONTENT_TYPE);
463
+ return defs;
357
464
  };
@@ -5,12 +5,16 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import { z } from 'zod';
8
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
9
9
  /** The public liveness route both spines mount. */
10
10
  export declare const HEALTH_PATH = "/health";
11
- /** The liveness route's response body. */
12
- export declare const HealthResponse: z.ZodObject<{
13
- status: z.ZodLiteral<"ok">;
14
- }, z.core.$strict>;
15
- export type HealthResponse = z.infer<typeof HealthResponse>;
11
+ /** The liveness route's response body, a `@fuzdev/fuz_schema` `object`. */
12
+ export declare const HealthResponse: import("@fuzdev/fuz_schema/schema.ts").Schema<{
13
+ status: "ok";
14
+ }, {
15
+ status: "ok";
16
+ }, "object", {
17
+ status: import("@fuzdev/fuz_schema/schema.ts").Schema<"ok", "ok", "literal", "ok">;
18
+ }>;
19
+ export type HealthResponse = Infer<typeof HealthResponse>;
16
20
  //# sourceMappingURL=health_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"health_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/health_schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mDAAmD;AACnD,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,0CAA0C;AAC1C,eAAO,MAAM,cAAc;;kBAA8C,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"health_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/health_schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE3E,mDAAmD;AACnD,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,2EAA2E;AAC3E,eAAO,MAAM,cAAc;;;;;;EAAoC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * @module
7
7
  */
8
- import { z } from 'zod';
8
+ import { literal, object } from '@fuzdev/fuz_schema/schema.ts';
9
9
  /** The public liveness route both spines mount. */
10
10
  export const HEALTH_PATH = '/health';
11
- /** The liveness route's response body. */
12
- export const HealthResponse = z.strictObject({ status: z.literal('ok') });
11
+ /** The liveness route's response body, a `@fuzdev/fuz_schema` `object`. */
12
+ export const HealthResponse = object({ status: literal('ok') });
@@ -7,7 +7,7 @@
7
7
  * @module
8
8
  */
9
9
  import type { MiddlewareHandler } from 'hono';
10
- import type { RouteErrorSchemas } from './error_schemas.js';
10
+ import type { RestErrorDef } from './error_schemas.js';
11
11
  /**
12
12
  * Paths a middleware layer explicitly does not run on, and why — the named
13
13
  * exception to a layer that covers every path by default (the origin check).
@@ -23,8 +23,13 @@ export interface MiddlewareSpec {
23
23
  name: string;
24
24
  path: string;
25
25
  handler: MiddlewareHandler;
26
- /** Error response schemas this middleware can produce, keyed by HTTP status code. */
27
- errors?: RouteErrorSchemas;
26
+ /**
27
+ * The error definitions this layer can answer with. Each joins the error map
28
+ * (`resolve_route_error_map`) of every route the layer runs on, beside the
29
+ * route's own, replacing none of them. An empty list says the layer answers
30
+ * with no error of its own.
31
+ */
32
+ errors?: ReadonlyArray<RestErrorDef>;
28
33
  /**
29
34
  * Paths under `path` the layer does not run on. The handler enforces them
30
35
  * itself (Hono mounts by `path` alone); the field is what keeps the
@@ -1 +1 @@
1
- {"version":3,"file":"middleware_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/middleware_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6GAA6G;IAC7G,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,gCAAgC;AAChC,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,C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