@fuzdev/fuz_app 0.51.0 → 0.52.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 (320) hide show
  1. package/dist/actions/CLAUDE.md +14 -1
  2. package/dist/actions/action_bridge.d.ts +3 -1
  3. package/dist/actions/action_bridge.d.ts.map +1 -1
  4. package/dist/actions/action_bridge.js +3 -1
  5. package/dist/actions/action_codegen.d.ts +18 -8
  6. package/dist/actions/action_codegen.d.ts.map +1 -1
  7. package/dist/actions/action_codegen.js +18 -8
  8. package/dist/actions/action_event.d.ts +44 -1
  9. package/dist/actions/action_event.d.ts.map +1 -1
  10. package/dist/actions/action_event.js +44 -1
  11. package/dist/actions/action_event_helpers.d.ts +26 -0
  12. package/dist/actions/action_event_helpers.d.ts.map +1 -1
  13. package/dist/actions/action_event_helpers.js +26 -1
  14. package/dist/actions/action_peer.d.ts +17 -0
  15. package/dist/actions/action_peer.d.ts.map +1 -1
  16. package/dist/actions/action_peer.js +8 -0
  17. package/dist/actions/action_registry.d.ts +1 -1
  18. package/dist/actions/action_registry.js +1 -1
  19. package/dist/actions/action_rpc.d.ts +4 -0
  20. package/dist/actions/action_rpc.d.ts.map +1 -1
  21. package/dist/actions/action_rpc.js +4 -0
  22. package/dist/actions/action_spec.d.ts +22 -2
  23. package/dist/actions/action_spec.d.ts.map +1 -1
  24. package/dist/actions/action_spec.js +16 -2
  25. package/dist/actions/register_action_ws.d.ts +3 -0
  26. package/dist/actions/register_action_ws.d.ts.map +1 -1
  27. package/dist/actions/register_action_ws.js +3 -0
  28. package/dist/actions/register_ws_endpoint.d.ts +3 -0
  29. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  30. package/dist/actions/register_ws_endpoint.js +3 -0
  31. package/dist/actions/request_tracker.svelte.d.ts +14 -1
  32. package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
  33. package/dist/actions/request_tracker.svelte.js +14 -1
  34. package/dist/actions/socket.svelte.d.ts +35 -15
  35. package/dist/actions/socket.svelte.d.ts.map +1 -1
  36. package/dist/actions/socket.svelte.js +33 -13
  37. package/dist/actions/transports.d.ts +12 -3
  38. package/dist/actions/transports.d.ts.map +1 -1
  39. package/dist/actions/transports.js +16 -7
  40. package/dist/actions/transports_http.d.ts +7 -0
  41. package/dist/actions/transports_http.d.ts.map +1 -1
  42. package/dist/actions/transports_http.js +7 -0
  43. package/dist/actions/transports_ws.d.ts +13 -0
  44. package/dist/actions/transports_ws.d.ts.map +1 -1
  45. package/dist/actions/transports_ws.js +13 -0
  46. package/dist/actions/transports_ws_auth_guard.d.ts +6 -2
  47. package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
  48. package/dist/actions/transports_ws_auth_guard.js +6 -2
  49. package/dist/actions/transports_ws_backend.d.ts +14 -1
  50. package/dist/actions/transports_ws_backend.d.ts.map +1 -1
  51. package/dist/actions/transports_ws_backend.js +14 -1
  52. package/dist/auth/CLAUDE.md +40 -4
  53. package/dist/auth/account_queries.d.ts +10 -0
  54. package/dist/auth/account_queries.d.ts.map +1 -1
  55. package/dist/auth/account_queries.js +10 -0
  56. package/dist/auth/admin_actions.d.ts +1 -0
  57. package/dist/auth/admin_actions.d.ts.map +1 -1
  58. package/dist/auth/admin_actions.js +1 -0
  59. package/dist/auth/api_token_queries.d.ts +7 -0
  60. package/dist/auth/api_token_queries.d.ts.map +1 -1
  61. package/dist/auth/api_token_queries.js +7 -0
  62. package/dist/auth/app_settings_queries.d.ts +4 -0
  63. package/dist/auth/app_settings_queries.d.ts.map +1 -1
  64. package/dist/auth/app_settings_queries.js +4 -0
  65. package/dist/auth/audit_log_queries.d.ts +6 -0
  66. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  67. package/dist/auth/audit_log_queries.js +6 -0
  68. package/dist/auth/audit_log_schema.d.ts +2 -0
  69. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  70. package/dist/auth/audit_log_schema.js +134 -55
  71. package/dist/auth/bearer_auth.d.ts +2 -0
  72. package/dist/auth/bearer_auth.d.ts.map +1 -1
  73. package/dist/auth/bearer_auth.js +2 -0
  74. package/dist/auth/bootstrap_account.d.ts +3 -0
  75. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  76. package/dist/auth/bootstrap_account.js +3 -0
  77. package/dist/auth/cleanup.d.ts +6 -0
  78. package/dist/auth/cleanup.d.ts.map +1 -1
  79. package/dist/auth/cleanup.js +6 -0
  80. package/dist/auth/daemon_token_middleware.d.ts +4 -0
  81. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  82. package/dist/auth/daemon_token_middleware.js +4 -0
  83. package/dist/auth/invite_queries.d.ts +4 -0
  84. package/dist/auth/invite_queries.d.ts.map +1 -1
  85. package/dist/auth/invite_queries.js +4 -0
  86. package/dist/auth/permit_offer_action_specs.d.ts +5 -0
  87. package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
  88. package/dist/auth/permit_offer_action_specs.js +10 -0
  89. package/dist/auth/permit_offer_queries.d.ts +19 -0
  90. package/dist/auth/permit_offer_queries.d.ts.map +1 -1
  91. package/dist/auth/permit_offer_queries.js +19 -0
  92. package/dist/auth/permit_queries.d.ts +8 -0
  93. package/dist/auth/permit_queries.d.ts.map +1 -1
  94. package/dist/auth/permit_queries.js +8 -0
  95. package/dist/auth/request_context.d.ts +1 -0
  96. package/dist/auth/request_context.d.ts.map +1 -1
  97. package/dist/auth/request_context.js +1 -0
  98. package/dist/auth/role_schema.d.ts +2 -0
  99. package/dist/auth/role_schema.d.ts.map +1 -1
  100. package/dist/auth/role_schema.js +2 -0
  101. package/dist/auth/self_service_role_actions.d.ts +1 -0
  102. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  103. package/dist/auth/self_service_role_actions.js +1 -0
  104. package/dist/auth/session_lifecycle.d.ts +3 -0
  105. package/dist/auth/session_lifecycle.d.ts.map +1 -1
  106. package/dist/auth/session_lifecycle.js +3 -0
  107. package/dist/auth/session_middleware.d.ts +5 -0
  108. package/dist/auth/session_middleware.d.ts.map +1 -1
  109. package/dist/auth/session_middleware.js +5 -0
  110. package/dist/auth/session_queries.d.ts +9 -0
  111. package/dist/auth/session_queries.d.ts.map +1 -1
  112. package/dist/auth/session_queries.js +9 -0
  113. package/dist/cli/config.d.ts +2 -0
  114. package/dist/cli/config.d.ts.map +1 -1
  115. package/dist/cli/config.js +2 -0
  116. package/dist/cli/daemon.d.ts +6 -1
  117. package/dist/cli/daemon.d.ts.map +1 -1
  118. package/dist/cli/daemon.js +6 -1
  119. package/dist/db/assert_row.d.ts +2 -1
  120. package/dist/db/assert_row.d.ts.map +1 -1
  121. package/dist/db/assert_row.js +2 -1
  122. package/dist/db/create_db.d.ts +3 -0
  123. package/dist/db/create_db.d.ts.map +1 -1
  124. package/dist/db/create_db.js +3 -0
  125. package/dist/db/db.d.ts +19 -4
  126. package/dist/db/db.d.ts.map +1 -1
  127. package/dist/db/db.js +18 -3
  128. package/dist/db/db_pg.d.ts +2 -1
  129. package/dist/db/db_pg.d.ts.map +1 -1
  130. package/dist/db/db_pg.js +5 -3
  131. package/dist/db/db_pglite.d.ts +3 -2
  132. package/dist/db/db_pglite.d.ts.map +1 -1
  133. package/dist/db/db_pglite.js +3 -2
  134. package/dist/db/migrate.d.ts +8 -4
  135. package/dist/db/migrate.d.ts.map +1 -1
  136. package/dist/db/migrate.js +6 -2
  137. package/dist/db/sql_identifier.d.ts +2 -1
  138. package/dist/db/sql_identifier.d.ts.map +1 -1
  139. package/dist/db/sql_identifier.js +2 -1
  140. package/dist/db/status.d.ts +4 -1
  141. package/dist/db/status.d.ts.map +1 -1
  142. package/dist/db/status.js +5 -2
  143. package/dist/dev/setup.d.ts +18 -2
  144. package/dist/dev/setup.d.ts.map +1 -1
  145. package/dist/dev/setup.js +18 -2
  146. package/dist/env/dotenv.d.ts +2 -1
  147. package/dist/env/dotenv.d.ts.map +1 -1
  148. package/dist/env/dotenv.js +2 -1
  149. package/dist/env/load.d.ts +1 -1
  150. package/dist/env/load.js +1 -1
  151. package/dist/env/resolve.d.ts +1 -1
  152. package/dist/env/resolve.js +1 -1
  153. package/dist/env/update_env_variable.d.ts +2 -0
  154. package/dist/env/update_env_variable.d.ts.map +1 -1
  155. package/dist/env/update_env_variable.js +2 -0
  156. package/dist/http/pending_effects.d.ts +4 -0
  157. package/dist/http/pending_effects.d.ts.map +1 -1
  158. package/dist/http/pending_effects.js +4 -0
  159. package/dist/http/proxy.d.ts +3 -0
  160. package/dist/http/proxy.d.ts.map +1 -1
  161. package/dist/http/proxy.js +3 -0
  162. package/dist/http/route_spec.d.ts +1 -0
  163. package/dist/http/route_spec.d.ts.map +1 -1
  164. package/dist/http/route_spec.js +7 -0
  165. package/dist/rate_limiter.d.ts +14 -1
  166. package/dist/rate_limiter.d.ts.map +1 -1
  167. package/dist/rate_limiter.js +14 -1
  168. package/dist/realtime/sse.d.ts +7 -1
  169. package/dist/realtime/sse.d.ts.map +1 -1
  170. package/dist/realtime/sse.js +3 -1
  171. package/dist/realtime/sse_auth_guard.d.ts +21 -21
  172. package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
  173. package/dist/realtime/sse_auth_guard.js +24 -24
  174. package/dist/realtime/subscriber_registry.d.ts +4 -2
  175. package/dist/realtime/subscriber_registry.d.ts.map +1 -1
  176. package/dist/realtime/subscriber_registry.js +4 -2
  177. package/dist/runtime/fs.d.ts +5 -0
  178. package/dist/runtime/fs.d.ts.map +1 -1
  179. package/dist/runtime/fs.js +5 -0
  180. package/dist/runtime/mock.d.ts +6 -0
  181. package/dist/runtime/mock.d.ts.map +1 -1
  182. package/dist/runtime/mock.js +6 -0
  183. package/dist/server/app_backend.d.ts +1 -0
  184. package/dist/server/app_backend.d.ts.map +1 -1
  185. package/dist/server/app_backend.js +1 -0
  186. package/dist/server/app_server.d.ts +4 -0
  187. package/dist/server/app_server.d.ts.map +1 -1
  188. package/dist/server/app_server.js +4 -0
  189. package/dist/server/validate_nginx.d.ts +3 -0
  190. package/dist/server/validate_nginx.d.ts.map +1 -1
  191. package/dist/testing/admin_integration.d.ts +5 -0
  192. package/dist/testing/admin_integration.d.ts.map +1 -1
  193. package/dist/testing/admin_integration.js +5 -0
  194. package/dist/testing/adversarial_headers.d.ts +5 -3
  195. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  196. package/dist/testing/adversarial_headers.js +5 -3
  197. package/dist/testing/adversarial_input.d.ts +4 -0
  198. package/dist/testing/adversarial_input.d.ts.map +1 -1
  199. package/dist/testing/adversarial_input.js +4 -0
  200. package/dist/testing/app_server.d.ts +3 -0
  201. package/dist/testing/app_server.d.ts.map +1 -1
  202. package/dist/testing/app_server.js +11 -0
  203. package/dist/testing/assertions.d.ts +23 -7
  204. package/dist/testing/assertions.d.ts.map +1 -1
  205. package/dist/testing/assertions.js +23 -7
  206. package/dist/testing/audit_completeness.d.ts +4 -0
  207. package/dist/testing/audit_completeness.d.ts.map +1 -1
  208. package/dist/testing/audit_completeness.js +4 -0
  209. package/dist/testing/auth_apps.d.ts +3 -0
  210. package/dist/testing/auth_apps.d.ts.map +1 -1
  211. package/dist/testing/auth_apps.js +3 -0
  212. package/dist/testing/db.d.ts +9 -1
  213. package/dist/testing/db.d.ts.map +1 -1
  214. package/dist/testing/db.js +9 -1
  215. package/dist/testing/error_coverage.d.ts +9 -0
  216. package/dist/testing/error_coverage.d.ts.map +1 -1
  217. package/dist/testing/error_coverage.js +9 -0
  218. package/dist/testing/integration.d.ts +4 -0
  219. package/dist/testing/integration.d.ts.map +1 -1
  220. package/dist/testing/integration.js +4 -0
  221. package/dist/testing/integration_helpers.d.ts +10 -4
  222. package/dist/testing/integration_helpers.d.ts.map +1 -1
  223. package/dist/testing/integration_helpers.js +10 -4
  224. package/dist/testing/middleware.d.ts +5 -0
  225. package/dist/testing/middleware.d.ts.map +1 -1
  226. package/dist/testing/middleware.js +5 -0
  227. package/dist/testing/rate_limiting.d.ts +3 -0
  228. package/dist/testing/rate_limiting.d.ts.map +1 -1
  229. package/dist/testing/rate_limiting.js +3 -0
  230. package/dist/testing/rpc_helpers.d.ts +21 -8
  231. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  232. package/dist/testing/rpc_helpers.js +21 -8
  233. package/dist/testing/schema_generators.d.ts +7 -2
  234. package/dist/testing/schema_generators.d.ts.map +1 -1
  235. package/dist/testing/schema_generators.js +7 -2
  236. package/dist/testing/sse_round_trip.d.ts +3 -0
  237. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  238. package/dist/testing/sse_round_trip.js +3 -0
  239. package/dist/testing/stubs.d.ts +7 -0
  240. package/dist/testing/stubs.d.ts.map +1 -1
  241. package/dist/testing/stubs.js +7 -0
  242. package/dist/testing/surface_invariants.d.ts +14 -0
  243. package/dist/testing/surface_invariants.d.ts.map +1 -1
  244. package/dist/testing/surface_invariants.js +14 -0
  245. package/dist/testing/ws_round_trip.d.ts +13 -1
  246. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  247. package/dist/ui/AccountSessions.svelte +9 -0
  248. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  249. package/dist/ui/AdminAccounts.svelte +10 -0
  250. package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
  251. package/dist/ui/AdminAuditLog.svelte +10 -0
  252. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  253. package/dist/ui/AdminInvites.svelte +9 -0
  254. package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
  255. package/dist/ui/AdminOverview.svelte +10 -0
  256. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  257. package/dist/ui/AdminPermitHistory.svelte +9 -0
  258. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -1
  259. package/dist/ui/AdminSessions.svelte +10 -0
  260. package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
  261. package/dist/ui/AdminSettings.svelte +9 -0
  262. package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
  263. package/dist/ui/AdminSurface.svelte +9 -0
  264. package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
  265. package/dist/ui/AppShell.svelte +24 -0
  266. package/dist/ui/AppShell.svelte.d.ts +23 -0
  267. package/dist/ui/AppShell.svelte.d.ts.map +1 -1
  268. package/dist/ui/BootstrapForm.svelte +17 -0
  269. package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
  270. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  271. package/dist/ui/ColumnLayout.svelte +11 -0
  272. package/dist/ui/ColumnLayout.svelte.d.ts +10 -0
  273. package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -1
  274. package/dist/ui/Datatable.svelte +18 -0
  275. package/dist/ui/Datatable.svelte.d.ts +17 -0
  276. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  277. package/dist/ui/LoginForm.svelte +18 -0
  278. package/dist/ui/LoginForm.svelte.d.ts +9 -0
  279. package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
  280. package/dist/ui/LogoutButton.svelte +9 -0
  281. package/dist/ui/LogoutButton.svelte.d.ts +8 -0
  282. package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
  283. package/dist/ui/MenuLink.svelte +10 -0
  284. package/dist/ui/MenuLink.svelte.d.ts +9 -0
  285. package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
  286. package/dist/ui/OpenSignupToggle.svelte +9 -0
  287. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  288. package/dist/ui/SignupForm.svelte +16 -0
  289. package/dist/ui/SignupForm.svelte.d.ts +4 -0
  290. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  291. package/dist/ui/SurfaceExplorer.svelte +9 -0
  292. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  293. package/dist/ui/audit_log_state.svelte.d.ts +6 -1
  294. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  295. package/dist/ui/audit_log_state.svelte.js +6 -1
  296. package/dist/ui/auth_state.svelte.d.ts +16 -4
  297. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  298. package/dist/ui/auth_state.svelte.js +16 -4
  299. package/dist/ui/form_state.svelte.d.ts +9 -0
  300. package/dist/ui/form_state.svelte.d.ts.map +1 -1
  301. package/dist/ui/form_state.svelte.js +9 -0
  302. package/dist/ui/loadable.svelte.d.ts +6 -1
  303. package/dist/ui/loadable.svelte.d.ts.map +1 -1
  304. package/dist/ui/loadable.svelte.js +6 -1
  305. package/dist/ui/permit_offers_state.svelte.d.ts +2 -0
  306. package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
  307. package/dist/ui/permit_offers_state.svelte.js +2 -0
  308. package/dist/ui/popover.svelte.d.ts +17 -4
  309. package/dist/ui/popover.svelte.d.ts.map +1 -1
  310. package/dist/ui/popover.svelte.js +17 -4
  311. package/dist/ui/position_helpers.d.ts +1 -0
  312. package/dist/ui/position_helpers.d.ts.map +1 -1
  313. package/dist/ui/position_helpers.js +1 -0
  314. package/dist/ui/sidebar_state.svelte.d.ts +22 -9
  315. package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
  316. package/dist/ui/sidebar_state.svelte.js +17 -2
  317. package/dist/ui/table_state.svelte.d.ts +14 -0
  318. package/dist/ui/table_state.svelte.d.ts.map +1 -1
  319. package/dist/ui/table_state.svelte.js +14 -0
  320. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  # actions/ — SAES (Symmetric Action Event System)
2
2
 
3
- One declarative `ActionSpec` shape — `{method, kind, initiator, auth, side_effects, input, output, async, description}` — binds to three
3
+ One declarative `ActionSpec` shape — `{method, kind, initiator, auth, side_effects, input, output, async, description, streams?, error_reasons?}` — binds to three
4
4
  transport surfaces (REST, JSON-RPC, WebSocket) with uniform DEV-only output
5
5
  validation and symmetric send/receive. This directory holds the spec types,
6
6
  registry, codegen helpers, both transport bridges, the single-endpoint RPC
@@ -47,6 +47,19 @@ Optional `streams?: string` names a companion `remote_notification` method
47
47
  emitted as request-scoped progress. Transport-agnostic handshake —
48
48
  registry-time validation that the named method exists is a consumer concern.
49
49
 
50
+ Optional `error_reasons?: ReadonlyArray<string>` declares the reason codes a
51
+ handler may surface via `error.data.reason`. Same precedent as `streams`:
52
+ declarative metadata for consumers (codegen, UI form-state matching, docs)
53
+ to read off the spec instead of scanning handler code. No runtime
54
+ enforcement — drift between declared reasons and what handlers actually
55
+ throw is caught per-module by source-scanning unit tests (see
56
+ `../../test/auth/permit_offer_actions.error_reasons.test.ts`). Reuses
57
+ the same `as const` string constants the handler throws (e.g.
58
+ `ERROR_OFFER_*` from `../auth/permit_offer_action_specs.ts`,
59
+ `ERROR_PERMIT_NOT_FOUND` from `../http/error_schemas.ts`) so call
60
+ sites can import either side. Standard transport errors (validation,
61
+ auth, rate-limit) stay implicit.
62
+
50
63
  Canonical spec shape: module-scope declaration with `satisfies` +
51
64
  `{method}_action_spec` naming, preserving the literal `method` type and
52
65
  dropping per-spec `*_METHOD` constants (readers dereference `.method` at
@@ -49,7 +49,8 @@ export declare const derive_http_method: (side_effects: ActionSideEffects) => Ro
49
49
  * @param spec - the action spec (must have non-null `auth`)
50
50
  * @param options - HTTP-specific options (path, handler, optional overrides)
51
51
  * @returns a `RouteSpec` ready for `apply_route_specs`
52
- * @throws if `spec.auth` is null
52
+ * @throws Error if `spec.auth` is null (only `request_response` actions can
53
+ * become routes; notifications and local calls cannot)
53
54
  */
54
55
  export declare const create_action_route_spec: (spec: ActionSpec, options: ActionRouteOptions) => RouteSpec;
55
56
  /**
@@ -60,6 +61,7 @@ export declare const create_action_route_spec: (spec: ActionSpec, options: Actio
60
61
  * @param spec - the action spec (must have `kind: 'remote_notification'`)
61
62
  * @param options - optional event-specific options (channel)
62
63
  * @returns an `EventSpec` ready for `create_validated_broadcaster`
64
+ * @throws Error if `spec.kind` is not `'remote_notification'`
63
65
  */
64
66
  export declare const create_action_event_spec: (spec: ActionSpec, options?: ActionEventOptions) => EventSpec;
65
67
  //# sourceMappingURL=action_bridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action_bridge.d.ts","sourceRoot":"../src/lib/","sources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KACzB,SAmBF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,UAAU,EAChB,UAAU,kBAAkB,KAC1B,SAYF,CAAC"}
@@ -35,7 +35,8 @@ export const derive_http_method = (side_effects) => {
35
35
  * @param spec - the action spec (must have non-null `auth`)
36
36
  * @param options - HTTP-specific options (path, handler, optional overrides)
37
37
  * @returns a `RouteSpec` ready for `apply_route_specs`
38
- * @throws if `spec.auth` is null
38
+ * @throws Error if `spec.auth` is null (only `request_response` actions can
39
+ * become routes; notifications and local calls cannot)
39
40
  */
40
41
  export const create_action_route_spec = (spec, options) => {
41
42
  if (spec.auth === null) {
@@ -63,6 +64,7 @@ export const create_action_route_spec = (spec, options) => {
63
64
  * @param spec - the action spec (must have `kind: 'remote_notification'`)
64
65
  * @param options - optional event-specific options (channel)
65
66
  * @returns an `EventSpec` ready for `create_validated_broadcaster`
67
+ * @throws Error if `spec.kind` is not `'remote_notification'`
66
68
  */
67
69
  export const create_action_event_spec = (spec, options) => {
68
70
  if (spec.kind !== 'remote_notification') {
@@ -59,12 +59,17 @@ export declare class ImportBuilder {
59
59
  * Add a value import to be included in the generated code.
60
60
  * @param from - the module to import from
61
61
  * @param what - what to import (value)
62
+ * @returns `this` for chaining
63
+ * @mutates this - inserts into the internal `imports` map
62
64
  */
63
65
  add(from: string, what: string): this;
64
66
  /**
65
67
  * Add a type import to be included in the generated code.
66
68
  * @param from - the module to import from
67
69
  * @param what - what to import (type)
70
+ * @returns `this` for chaining
71
+ * @mutates this - inserts into the internal `imports` map (downgrade to
72
+ * type is suppressed if already registered as a value)
68
73
  */
69
74
  add_type(from: string, what: string): this;
70
75
  /**
@@ -95,6 +100,9 @@ export declare class ImportBuilder {
95
100
  preview(): Array<string>;
96
101
  /**
97
102
  * Clear all imports.
103
+ *
104
+ * @returns `this` for chaining
105
+ * @mutates this - empties the internal `imports` map
98
106
  */
99
107
  clear(): this;
100
108
  }
@@ -129,7 +137,7 @@ export declare const get_handler_return_type: (spec: ActionSpecUnion, phase: Act
129
137
  *
130
138
  * @param options.action_event_type - custom type name to use instead of `ActionEvent`
131
139
  * (consumers can define a narrowed type that carries typed input/output via their codegen maps)
132
- * @param options.collections_path - import path the side-effect `ActionOutputs` import
140
+ * @param options.collections_path - Import path the side-effect `ActionOutputs` import
133
141
  * resolves to. Defaults to `'./action_collections.js'`.
134
142
  */
135
143
  export declare const generate_phase_handlers: (spec: ActionSpecUnion, executor: "frontend" | "backend", imports: ImportBuilder, options?: {
@@ -171,11 +179,11 @@ export declare const to_action_spec_output_identifier: (method: string) => strin
171
179
  *
172
180
  * @param spec - the action spec to emit
173
181
  * @param imports - import builder to register references on
174
- * @param options.sync_returns_value - when true (default), sync local_call
182
+ * @param options.sync_returns_value - When true (default), sync `local_call`
175
183
  * methods return the output value directly; when false they're wrapped in
176
184
  * `Result<{value, error}>` like async methods. Set to `false` if your
177
- * FrontendActionsApi treats every method uniformly.
178
- * @param options.collections_path - import path that `ActionInputs` /
185
+ * `FrontendActionsApi` treats every method uniformly.
186
+ * @param options.collections_path - Import path that `ActionInputs` /
179
187
  * `ActionOutputs` resolve to. Defaults to `'./action_collections.js'`.
180
188
  * @returns one line like `foo: (input: ActionInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
181
189
  */
@@ -368,7 +376,7 @@ export declare const generate_frontend_action_handlers: (specs: ReadonlyArray<Ac
368
376
  * Method signature shape today is `(input) => Promise<void>` — matches the
369
377
  * fire-and-forget runtime of `create_broadcast_api`. Generalizing per-kind
370
378
  * via `generate_actions_api_method_signature` is deferred until a second
371
- * backend runtime constructor lands (see SAES quest § API review III).
379
+ * backend runtime constructor lands.
372
380
  *
373
381
  * @param options.qualify_spec - per-spec qualified identifier callback for
374
382
  * multi-source consumers. When set, the helper emits the callback's return
@@ -434,6 +442,11 @@ export interface SpecSource {
434
442
  * per-call callback wasn't enough; the import dance + dup-check was the
435
443
  * real boilerplate.
436
444
  *
445
+ * @throws Error if two sources contain the same method name (same-method
446
+ * detection is the consumer's primary debugging signal). Also throws if
447
+ * the returned `qualify_spec` is later called with a method not registered
448
+ * in any source.
449
+ *
437
450
  * @example
438
451
  * ```ts
439
452
  * const sources = [
@@ -454,9 +467,6 @@ export interface SpecSource {
454
467
  * });
455
468
  * };
456
469
  * ```
457
- *
458
- * @throws if two sources contain the same method name (same-method detection
459
- * is the consumer's primary debugging signal).
460
470
  */
461
471
  export declare const create_namespace_qualifier: (sources: ReadonlyArray<SpecSource>, imports: ImportBuilder) => {
462
472
  qualify_spec: (spec: ActionSpecUnion) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"action_codegen.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_codegen.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAGxE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,kCAAmC,CAAC;AAExE,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAI5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI,oBACrC,CAAC;AAEjC;;GAEG;AACH,UAAU,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa;;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAa;IAE1D;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQrC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,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AS,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CA6B1C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC9B,KAAG,MAYH,CAAC"}
@@ -52,6 +52,8 @@ export class ImportBuilder {
52
52
  * Add a value import to be included in the generated code.
53
53
  * @param from - the module to import from
54
54
  * @param what - what to import (value)
55
+ * @returns `this` for chaining
56
+ * @mutates this - inserts into the internal `imports` map
55
57
  */
56
58
  add(from, what) {
57
59
  // Handle namespace imports specially
@@ -64,6 +66,9 @@ export class ImportBuilder {
64
66
  * Add a type import to be included in the generated code.
65
67
  * @param from - the module to import from
66
68
  * @param what - what to import (type)
69
+ * @returns `this` for chaining
70
+ * @mutates this - inserts into the internal `imports` map (downgrade to
71
+ * type is suppressed if already registered as a value)
67
72
  */
68
73
  add_type(from, what) {
69
74
  return this.#add_import(from, what, 'type');
@@ -134,6 +139,9 @@ export class ImportBuilder {
134
139
  }
135
140
  /**
136
141
  * Clear all imports.
142
+ *
143
+ * @returns `this` for chaining
144
+ * @mutates this - empties the internal `imports` map
137
145
  */
138
146
  clear() {
139
147
  this.imports.clear();
@@ -289,7 +297,7 @@ export const get_handler_return_type = (spec, phase, imports, collections_path =
289
297
  *
290
298
  * @param options.action_event_type - custom type name to use instead of `ActionEvent`
291
299
  * (consumers can define a narrowed type that carries typed input/output via their codegen maps)
292
- * @param options.collections_path - import path the side-effect `ActionOutputs` import
300
+ * @param options.collections_path - Import path the side-effect `ActionOutputs` import
293
301
  * resolves to. Defaults to `'./action_collections.js'`.
294
302
  */
295
303
  export const generate_phase_handlers = (spec, executor, imports, options) => {
@@ -351,11 +359,11 @@ export const to_action_spec_output_identifier = (method) => `${to_action_spec_id
351
359
  *
352
360
  * @param spec - the action spec to emit
353
361
  * @param imports - import builder to register references on
354
- * @param options.sync_returns_value - when true (default), sync local_call
362
+ * @param options.sync_returns_value - When true (default), sync `local_call`
355
363
  * methods return the output value directly; when false they're wrapped in
356
364
  * `Result<{value, error}>` like async methods. Set to `false` if your
357
- * FrontendActionsApi treats every method uniformly.
358
- * @param options.collections_path - import path that `ActionInputs` /
365
+ * `FrontendActionsApi` treats every method uniformly.
366
+ * @param options.collections_path - Import path that `ActionInputs` /
359
367
  * `ActionOutputs` resolve to. Defaults to `'./action_collections.js'`.
360
368
  * @returns one line like `foo: (input: ActionInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
361
369
  */
@@ -839,7 +847,7 @@ ${lines};
839
847
  * Method signature shape today is `(input) => Promise<void>` — matches the
840
848
  * fire-and-forget runtime of `create_broadcast_api`. Generalizing per-kind
841
849
  * via `generate_actions_api_method_signature` is deferred until a second
842
- * backend runtime constructor lands (see SAES quest § API review III).
850
+ * backend runtime constructor lands.
843
851
  *
844
852
  * @param options.qualify_spec - per-spec qualified identifier callback for
845
853
  * multi-source consumers. When set, the helper emits the callback's return
@@ -936,6 +944,11 @@ export type ${type_name} = {
936
944
  * per-call callback wasn't enough; the import dance + dup-check was the
937
945
  * real boilerplate.
938
946
  *
947
+ * @throws Error if two sources contain the same method name (same-method
948
+ * detection is the consumer's primary debugging signal). Also throws if
949
+ * the returned `qualify_spec` is later called with a method not registered
950
+ * in any source.
951
+ *
939
952
  * @example
940
953
  * ```ts
941
954
  * const sources = [
@@ -956,9 +969,6 @@ export type ${type_name} = {
956
969
  * });
957
970
  * };
958
971
  * ```
959
- *
960
- * @throws if two sources contain the same method name (same-method detection
961
- * is the consumer's primary debugging signal).
962
972
  */
963
973
  export const create_namespace_qualifier = (sources, imports) => {
964
974
  const method_to_ns = new Map();
@@ -33,22 +33,60 @@ export declare class ActionEvent<TMethod extends string = string, TPhase extends
33
33
  };
34
34
  constructor(environment: ActionEventEnvironment, spec: ActionSpecUnion, data: ActionEventDataUnion<TMethod>);
35
35
  toJSON(): ActionEventDataUnion<TMethod>;
36
+ /**
37
+ * Subscribe a listener fired on every `data` transition.
38
+ *
39
+ * @param listener - called with `(new_data, old_data, event)` after each mutation
40
+ * @returns unsubscribe function
41
+ * @mutates this - adds `listener` to the internal observer set
42
+ */
36
43
  observe(listener: ActionEventChangeObserver<TMethod>): () => void;
44
+ /**
45
+ * Replace the event's `data` and notify observers.
46
+ *
47
+ * @mutates this - sets `data` and fires every registered observer in insertion order
48
+ */
37
49
  set_data(new_data: ActionEventDataUnion<TMethod>): void;
38
50
  /**
39
51
  * Parse input data according to the action's schema.
52
+ *
53
+ * @returns `this` for chaining with `handle_async` / `handle_sync`
54
+ * @mutates this - transitions step from `initial` to `parsed` (or to
55
+ * `failed` / `receive_error` on validation or response error)
56
+ * @throws Error if called from a step other than `initial`
40
57
  */
41
58
  parse(): this;
42
59
  /**
43
60
  * Execute the handler for the current phase.
61
+ *
62
+ * @mutates this - transitions step `parsed → handling → handled`, or to
63
+ * `failed` / `send_error` / `receive_error` on handler throw. No-op
64
+ * when already `failed`.
65
+ * @throws Error if called from a step other than `parsed` (or `failed`,
66
+ * which no-ops). Handler-thrown `ThrownJsonrpcError` is caught and
67
+ * routed through error phases; other throws are wrapped as
68
+ * `internal_error`.
44
69
  */
45
70
  handle_async(): Promise<void>;
46
71
  /**
47
- * Execute handler synchronously (only for sync local_call actions).
72
+ * Execute handler synchronously (only for sync `local_call` actions).
73
+ *
74
+ * @mutates this - transitions step `parsed → handling → handled`, or to
75
+ * `failed` on handler throw. No-op when already `failed`.
76
+ * @throws Error if the spec is not a sync `local_call`, or if called
77
+ * from a step other than `parsed` (or `failed`, which no-ops).
48
78
  */
49
79
  handle_sync(): void;
50
80
  /**
51
81
  * Transition to a new phase.
82
+ *
83
+ * @param phase - the next phase to transition into
84
+ * @mutates this - replaces `data` with a fresh phase-initial record,
85
+ * carrying forward `request` / `response` / `error` / `output` as
86
+ * appropriate for the kind/phase pair
87
+ * @throws Error if called from a step other than `handled` (or
88
+ * `failed`, which no-ops), or if the phase transition is illegal for
89
+ * the current phase
52
90
  */
53
91
  transition(phase: ActionEventPhase): void;
54
92
  is_complete(): boolean;
@@ -59,10 +97,15 @@ export declare class ActionEvent<TMethod extends string = string, TPhase extends
59
97
  }
60
98
  /**
61
99
  * Create an action event from a spec and initial input.
100
+ *
101
+ * @throws Error if `initial_phase` is omitted and the executor cannot
102
+ * initiate the action (per `spec.initiator`)
62
103
  */
63
104
  export declare const create_action_event: <TMethod extends string = string>(environment: ActionEventEnvironment, spec: ActionSpecUnion, input: unknown, initial_phase?: ActionEventPhase) => ActionEvent<TMethod>;
64
105
  /**
65
106
  * Reconstruct an action event from serialized JSON data.
107
+ *
108
+ * @throws Error if the JSON's `method` field has no spec registered in `environment`
66
109
  */
67
110
  export declare const create_action_event_from_json: <TMethod extends string = string>(json: ActionEventDataUnion<TMethod>, environment: ActionEventEnvironment) => ActionEvent<TMethod>;
68
111
  export declare const parse_action_event: (raw_json: unknown, environment: ActionEventEnvironment) => ActionEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"action_event.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_event.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAC,gBAAgB,EAAc,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAWpF,OAAO,KAAK,EACX,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,sBAAsB,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAkB,KAAK,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAclF,MAAM,MAAM,yBAAyB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,IAAI,CACxE,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACvC,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,EACvC,KAAK,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GAIG;AACH,eAAO,MAAM,6BAA6B,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EAC5E,MAAM,oBAAoB,CAAC,OAAO,CAAC,EACnC,aAAa,sBAAsB,KACjC,WAAW,CAAC,OAAO,CAOrB,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAC9B,UAAU,OAAO,EACjB,aAAa,sBAAsB,KACjC,WAGF,CAAC"}
@@ -40,10 +40,22 @@ export class ActionEvent {
40
40
  }
41
41
  // TODO rethink the reactivity of this class, maybe just use `$state` or `$state.raw`?
42
42
  // does that have any negative implications when used on the backend?
43
+ /**
44
+ * Subscribe a listener fired on every `data` transition.
45
+ *
46
+ * @param listener - called with `(new_data, old_data, event)` after each mutation
47
+ * @returns unsubscribe function
48
+ * @mutates this - adds `listener` to the internal observer set
49
+ */
43
50
  observe(listener) {
44
51
  this.#listeners.add(listener);
45
52
  return () => this.#listeners.delete(listener);
46
53
  }
54
+ /**
55
+ * Replace the event's `data` and notify observers.
56
+ *
57
+ * @mutates this - sets `data` and fires every registered observer in insertion order
58
+ */
47
59
  set_data(new_data) {
48
60
  const old_data = this.#data;
49
61
  this.#data = new_data;
@@ -54,6 +66,11 @@ export class ActionEvent {
54
66
  }
55
67
  /**
56
68
  * Parse input data according to the action's schema.
69
+ *
70
+ * @returns `this` for chaining with `handle_async` / `handle_sync`
71
+ * @mutates this - transitions step from `initial` to `parsed` (or to
72
+ * `failed` / `receive_error` on validation or response error)
73
+ * @throws Error if called from a step other than `initial`
57
74
  */
58
75
  parse() {
59
76
  if (this.#data.step !== 'initial') {
@@ -93,6 +110,14 @@ export class ActionEvent {
93
110
  }
94
111
  /**
95
112
  * Execute the handler for the current phase.
113
+ *
114
+ * @mutates this - transitions step `parsed → handling → handled`, or to
115
+ * `failed` / `send_error` / `receive_error` on handler throw. No-op
116
+ * when already `failed`.
117
+ * @throws Error if called from a step other than `parsed` (or `failed`,
118
+ * which no-ops). Handler-thrown `ThrownJsonrpcError` is caught and
119
+ * routed through error phases; other throws are wrapped as
120
+ * `internal_error`.
96
121
  */
97
122
  // TODO add timeout support
98
123
  // TODO add cancellation support
@@ -136,7 +161,12 @@ export class ActionEvent {
136
161
  }
137
162
  }
138
163
  /**
139
- * Execute handler synchronously (only for sync local_call actions).
164
+ * Execute handler synchronously (only for sync `local_call` actions).
165
+ *
166
+ * @mutates this - transitions step `parsed → handling → handled`, or to
167
+ * `failed` on handler throw. No-op when already `failed`.
168
+ * @throws Error if the spec is not a sync `local_call`, or if called
169
+ * from a step other than `parsed` (or `failed`, which no-ops).
140
170
  */
141
171
  handle_sync() {
142
172
  if (this.spec.kind !== 'local_call' || this.spec.async) {
@@ -168,6 +198,14 @@ export class ActionEvent {
168
198
  }
169
199
  /**
170
200
  * Transition to a new phase.
201
+ *
202
+ * @param phase - the next phase to transition into
203
+ * @mutates this - replaces `data` with a fresh phase-initial record,
204
+ * carrying forward `request` / `response` / `error` / `output` as
205
+ * appropriate for the kind/phase pair
206
+ * @throws Error if called from a step other than `handled` (or
207
+ * `failed`, which no-ops), or if the phase transition is illegal for
208
+ * the current phase
171
209
  */
172
210
  transition(phase) {
173
211
  if (this.#data.step === 'failed') {
@@ -340,6 +378,9 @@ export class ActionEvent {
340
378
  // TODO not sure about this helper's design/location (should it be internal to the class constructor? a static method?)
341
379
  /**
342
380
  * Create an action event from a spec and initial input.
381
+ *
382
+ * @throws Error if `initial_phase` is omitted and the executor cannot
383
+ * initiate the action (per `spec.initiator`)
343
384
  */
344
385
  export const create_action_event = (environment, spec, input, initial_phase) => {
345
386
  const phase = initial_phase || get_initial_phase(spec.kind, spec.initiator, environment.executor);
@@ -351,6 +392,8 @@ export const create_action_event = (environment, spec, input, initial_phase) =>
351
392
  };
352
393
  /**
353
394
  * Reconstruct an action event from serialized JSON data.
395
+ *
396
+ * @throws Error if the JSON's `method` field has no spec registered in `environment`
354
397
  */
355
398
  export const create_action_event_from_json = (json, environment) => {
356
399
  const spec = environment.lookup_action_spec(json.method);
@@ -58,13 +58,39 @@ export declare const is_notification_send_with_parsed_input: <TMethod extends st
58
58
  step: "parsed" | "handling";
59
59
  input: unknown;
60
60
  };
61
+ /**
62
+ * Validate that a step transition is legal per `ACTION_EVENT_STEP_TRANSITIONS`.
63
+ *
64
+ * @throws Error if `from → to` is not a permitted transition
65
+ */
61
66
  export declare const validate_step_transition: (from: ActionEventStep, to: ActionEventStep) => void;
67
+ /**
68
+ * Validate that `phase` is one of the phases allowed for `kind` per
69
+ * `ACTION_EVENT_PHASE_BY_KIND`.
70
+ *
71
+ * @throws Error if `phase` is not valid for `kind`
72
+ */
62
73
  export declare const validate_phase_for_kind: (kind: ActionKind, phase: ActionEventPhase) => void;
74
+ /**
75
+ * Validate that a phase chain is legal per `ACTION_EVENT_PHASE_TRANSITIONS`.
76
+ *
77
+ * @throws Error if `from → to` is not the permitted next phase (or `from` is terminal)
78
+ */
63
79
  export declare const validate_phase_transition: (from: ActionEventPhase, to: ActionEventPhase) => void;
64
80
  export declare const get_initial_phase: (kind: ActionKind, initiator: ActionInitiator, executor: ActionExecutor) => ActionEventPhase | null;
65
81
  export declare const should_validate_output: (kind: ActionKind, phase: ActionEventPhase) => boolean;
66
82
  export declare const is_action_complete: (data: ActionEventData) => boolean;
67
83
  export declare const create_initial_data: (kind: ActionKind, phase: ActionEventPhase, method: string, executor: ActionExecutor, input: unknown) => ActionEventData;
84
+ /**
85
+ * Pull the terminal `Result` from an action event.
86
+ *
87
+ * `data.error` populated → error path (covers both explicit `failed` and
88
+ * the unhandled `receive_error` / `send_error` case where no handler was
89
+ * registered for the error phase). `step === 'handled'` → success path.
90
+ *
91
+ * @throws Error if the event is in a non-terminal state (programming error —
92
+ * callers should check `is_action_complete` first)
93
+ */
68
94
  export declare const extract_action_result: (event: ActionEvent) => Result<{
69
95
  value: ActionEventData["output"];
70
96
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"action_event_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_event_helpers.ts"],"names":[],"mappings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AI,MAAM,eAAe,EAAE,IAAI,eAAe,KAAG,IAIrF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,UAAU,EAAE,OAAO,gBAAgB,KAAG,IAInF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,MAAM,gBAAgB,EAAE,IAAI,gBAAgB,KAAG,IAKxF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC7B,MAAM,UAAU,EAChB,WAAW,eAAe,EAC1B,UAAU,cAAc,KACtB,gBAAgB,GAAG,IAWrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,UAAU,EAAE,OAAO,gBAAgB,KAAG,OAEpC,CAAC;AAEhD,eAAO,MAAM,kBAAkB,GAAI,MAAM,eAAe,KAAG,OAO1D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC/B,MAAM,UAAU,EAChB,OAAO,gBAAgB,EACvB,QAAQ,MAAM,EACd,UAAU,cAAc,EACxB,OAAO,OAAO,KACZ,eAaD,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,GACjC,OAAO,WAAW,KAChB,MAAM,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;CAAC,EAAE;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAC,CAuBxE,CAAC"}
@@ -27,17 +27,32 @@ export const is_failed = (data) => data.step === 'failed';
27
27
  // are created when transitioning from 'parsed' to 'handling'
28
28
  export const is_send_request_with_parsed_input = (data) => is_send_request(data) && (data.step === 'parsed' || data.step === 'handling');
29
29
  export const is_notification_send_with_parsed_input = (data) => is_notification_send(data) && (data.step === 'parsed' || data.step === 'handling');
30
- // Validation helpers
30
+ /**
31
+ * Validate that a step transition is legal per `ACTION_EVENT_STEP_TRANSITIONS`.
32
+ *
33
+ * @throws Error if `from → to` is not a permitted transition
34
+ */
31
35
  export const validate_step_transition = (from, to) => {
32
36
  if (!ACTION_EVENT_STEP_TRANSITIONS[from].includes(to)) {
33
37
  throw new Error(`Invalid step transition from '${from}' to '${to}'`);
34
38
  }
35
39
  };
40
+ /**
41
+ * Validate that `phase` is one of the phases allowed for `kind` per
42
+ * `ACTION_EVENT_PHASE_BY_KIND`.
43
+ *
44
+ * @throws Error if `phase` is not valid for `kind`
45
+ */
36
46
  export const validate_phase_for_kind = (kind, phase) => {
37
47
  if (!ACTION_EVENT_PHASE_BY_KIND[kind].includes(phase)) {
38
48
  throw new Error(`Invalid phase '${phase}' for ${kind} action`);
39
49
  }
40
50
  };
51
+ /**
52
+ * Validate that a phase chain is legal per `ACTION_EVENT_PHASE_TRANSITIONS`.
53
+ *
54
+ * @throws Error if `from → to` is not the permitted next phase (or `from` is terminal)
55
+ */
41
56
  export const validate_phase_transition = (from, to) => {
42
57
  const expected = ACTION_EVENT_PHASE_TRANSITIONS[from];
43
58
  if (expected !== to) {
@@ -81,6 +96,16 @@ export const create_initial_data = (kind, phase, method, executor, input) => ({
81
96
  response: null,
82
97
  notification: null,
83
98
  });
99
+ /**
100
+ * Pull the terminal `Result` from an action event.
101
+ *
102
+ * `data.error` populated → error path (covers both explicit `failed` and
103
+ * the unhandled `receive_error` / `send_error` case where no handler was
104
+ * registered for the error phase). `step === 'handled'` → success path.
105
+ *
106
+ * @throws Error if the event is in a non-terminal state (programming error —
107
+ * callers should check `is_action_complete` first)
108
+ */
84
109
  export const extract_action_result = (event) => {
85
110
  const { data } = event;
86
111
  // `data.error` populated → error path. This covers two cases:
@@ -31,8 +31,25 @@ export declare class ActionPeer {
31
31
  readonly transports: Transports;
32
32
  default_send_options: Omit<ActionPeerSendOptions, 'signal'>;
33
33
  constructor(options: ActionPeerOptions);
34
+ /**
35
+ * Resolve a transport (per-call name → default name → registry default)
36
+ * and forward the message. Catches unexpected throws and converts them
37
+ * to JSON-RPC error responses — this method never throws.
38
+ *
39
+ * @returns the response envelope for requests, or `null` for successful
40
+ * notifications (`JsonrpcErrorResponse` if the notification's transport
41
+ * send failed)
42
+ */
34
43
  send(message: JsonrpcRequest, options?: ActionPeerSendOptions): Promise<JsonrpcResponseOrError>;
35
44
  send(message: JsonrpcNotification, options?: ActionPeerSendOptions): Promise<JsonrpcErrorResponse | null>;
45
+ /**
46
+ * Dispatch an inbound JSON-RPC message — request, notification, or
47
+ * malformed envelope. Never throws; unexpected failures become
48
+ * JSON-RPC error responses.
49
+ *
50
+ * @returns response message for requests, `null` for notifications, or
51
+ * an `invalid_request` error for malformed input
52
+ */
36
53
  receive(message: unknown): Promise<JsonrpcMessageFromServerToClient | null>;
37
54
  }
38
55
  //# sourceMappingURL=action_peer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action_peer.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/action_peer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEN,gCAAgC,EAChC,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAC,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAOpE;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAClE,cAAc,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE,sBAAsB,CAAC;IAGpC,UAAU,CAAC,EAAE,UAAU,CAAC;IAKxB,oBAAoB,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;CAC7D;AAED,qBAAa,UAAU;;IACtB,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAMhC,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CA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ACT,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAC5B,IAAI,CACT,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA8CvC;;;;;;;OAOG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gCAAgC,GAAG,IAAI,CAAC;CAyIjF"}
@@ -48,6 +48,14 @@ export class ActionPeer {
48
48
  return create_jsonrpc_error_response_from_thrown(to_jsonrpc_message_id(message), error);
49
49
  } // TODO finally?
50
50
  }
51
+ /**
52
+ * Dispatch an inbound JSON-RPC message — request, notification, or
53
+ * malformed envelope. Never throws; unexpected failures become
54
+ * JSON-RPC error responses.
55
+ *
56
+ * @returns response message for requests, `null` for notifications, or
57
+ * an `invalid_request` error for malformed input
58
+ */
51
59
  async receive(message) {
52
60
  try {
53
61
  const result = await this.#receive_message(message);
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `ActionRegistry` — query and filter utility over `ActionSpecUnion[]`.
3
3
  *
4
- * Vocabulary (set in API review III, see the `docs/` directory and the SAES quest):
4
+ * Vocabulary (see the `docs/` directory):
5
5
  * - `*_handled_*` — request_response specs the named side **receives**
6
6
  * (so the named side owns the handler). Used by codegen to emit typed
7
7
  * handler maps.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `ActionRegistry` — query and filter utility over `ActionSpecUnion[]`.
3
3
  *
4
- * Vocabulary (set in API review III, see the `docs/` directory and the SAES quest):
4
+ * Vocabulary (see the `docs/` directory):
5
5
  * - `*_handled_*` — request_response specs the named side **receives**
6
6
  * (so the named side owns the handler). Used by codegen to emit typed
7
7
  * handler maps.
@@ -132,6 +132,10 @@ export interface CreateRpcEndpointOptions {
132
132
  *
133
133
  * @param options - endpoint path, actions, and logger
134
134
  * @returns route specs (GET + POST) ready for `apply_route_specs`
135
+ * @throws Error if two actions share the same `spec.method` (registration-time
136
+ * duplicate detection); also throws if any action's `spec.input` is
137
+ * `z.null()` (JSON-RPC 2.0 §4.2 forbids `params: null` on the wire — use
138
+ * `z.void()` for parameterless methods).
135
139
  */
136
140
  export declare const create_rpc_endpoint: (options: CreateRpcEndpointOptions) => Array<RouteSpec>;
137
141
  //# sourceMappingURL=action_rpc.d.ts.map