@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
@@ -124,14 +124,7 @@ export class TableState {
124
124
  try {
125
125
  const response = await ui_fetch(`/api/db/tables/${this.table_name}/rows/${encodeURIComponent(pk_str)}`, { method: 'DELETE' });
126
126
  if (!response.ok) {
127
- try {
128
- const data = await response.json();
129
- const error_msg = data.error || 'unknown error';
130
- this.delete_error = data.detail ? `${error_msg}: ${data.detail}` : error_msg;
131
- }
132
- catch {
133
- this.delete_error = `Error: ${response.status}`;
134
- }
127
+ this.delete_error = await parse_response_error(response);
135
128
  return false;
136
129
  }
137
130
  // Remove from UI
@@ -12,12 +12,22 @@
12
12
  */
13
13
  export declare const ui_fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
14
14
  /**
15
- * Safely extract an error message from a non-ok response.
15
+ * The text to show for an error body: its `message` when it carries one,
16
+ * else its `error` code — a body's `error` is a machine-readable code, and
17
+ * prose, when the server sends any, is in `message`.
18
+ *
19
+ * @param body - the parsed error body, of any shape
20
+ * @param fallback - the text when the body has neither
21
+ */
22
+ export declare const format_error_body: (body: unknown, fallback: string) => string;
23
+ /**
24
+ * Safely extract an error message from a non-ok response: its `message`,
25
+ * else its `error` code (`format_error_body`).
16
26
  *
17
27
  * Handles responses with non-JSON bodies (e.g. HTML 404 pages)
18
28
  * that would throw on `response.json()`.
19
29
  *
20
- * @param fallback - message when no `.error` field is found
30
+ * @param fallback - message when the body has no `message` or `error`
21
31
  */
22
32
  export declare const parse_response_error: (response: Response, fallback?: string) => Promise<string>;
23
33
  //# sourceMappingURL=ui_fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui_fetch.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ui_fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,WAAW,GAAG,GAAG,EAAE,OAAO,WAAW,KAAG,OAAO,CAAC,QAAQ,CACtC,CAAC;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAChC,UAAU,QAAQ,EAClB,WAAW,MAAM,KACf,OAAO,CAAC,MAAM,CAQhB,CAAC"}
1
+ {"version":3,"file":"ui_fetch.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ui_fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,WAAW,GAAG,GAAG,EAAE,OAAO,WAAW,KAAG,OAAO,CAAC,QAAQ,CACtC,CAAC;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,OAAO,EAAE,UAAU,MAAM,KAAG,MAMnE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAChC,UAAU,QAAQ,EAClB,WAAW,MAAM,KACf,OAAO,CAAC,MAAM,CAOhB,CAAC"}
@@ -12,18 +12,36 @@
12
12
  */
13
13
  export const ui_fetch = (input, init) => fetch(input, { ...init, credentials: 'include' });
14
14
  /**
15
- * Safely extract an error message from a non-ok response.
15
+ * The text to show for an error body: its `message` when it carries one,
16
+ * else its `error` code — a body's `error` is a machine-readable code, and
17
+ * prose, when the server sends any, is in `message`.
18
+ *
19
+ * @param body - the parsed error body, of any shape
20
+ * @param fallback - the text when the body has neither
21
+ */
22
+ export const format_error_body = (body, fallback) => {
23
+ if (body === null || typeof body !== 'object')
24
+ return fallback;
25
+ const { message, error } = body;
26
+ if (typeof message === 'string' && message)
27
+ return message;
28
+ if (typeof error === 'string' && error)
29
+ return error;
30
+ return fallback;
31
+ };
32
+ /**
33
+ * Safely extract an error message from a non-ok response: its `message`,
34
+ * else its `error` code (`format_error_body`).
16
35
  *
17
36
  * Handles responses with non-JSON bodies (e.g. HTML 404 pages)
18
37
  * that would throw on `response.json()`.
19
38
  *
20
- * @param fallback - message when no `.error` field is found
39
+ * @param fallback - message when the body has no `message` or `error`
21
40
  */
22
41
  export const parse_response_error = async (response, fallback) => {
23
42
  const default_message = fallback ?? `Error: ${response.status}`;
24
43
  try {
25
- const data = await response.json();
26
- return typeof data?.error === 'string' ? data.error : default_message;
44
+ return format_error_body(await response.json(), default_message);
27
45
  }
28
46
  catch {
29
47
  return default_message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.163.0",
3
+ "version": "0.165.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",