@fuzdev/fuz_app 0.50.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 (374) hide show
  1. package/dist/actions/CLAUDE.md +16 -3
  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 +44 -13
  6. package/dist/actions/action_codegen.d.ts.map +1 -1
  7. package/dist/actions/action_codegen.js +58 -20
  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 +2 -2
  18. package/dist/actions/action_registry.js +2 -2
  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 +23 -3
  23. package/dist/actions/action_spec.d.ts.map +1 -1
  24. package/dist/actions/action_spec.js +17 -3
  25. package/dist/actions/action_types.d.ts +2 -2
  26. package/dist/actions/action_types.js +2 -2
  27. package/dist/actions/cancel.d.ts +2 -2
  28. package/dist/actions/cancel.js +2 -2
  29. package/dist/actions/heartbeat.d.ts +2 -2
  30. package/dist/actions/heartbeat.js +2 -2
  31. package/dist/actions/protocol.d.ts +1 -1
  32. package/dist/actions/protocol.js +1 -1
  33. package/dist/actions/register_action_ws.d.ts +4 -1
  34. package/dist/actions/register_action_ws.d.ts.map +1 -1
  35. package/dist/actions/register_action_ws.js +4 -1
  36. package/dist/actions/register_ws_endpoint.d.ts +3 -0
  37. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  38. package/dist/actions/register_ws_endpoint.js +3 -0
  39. package/dist/actions/request_tracker.svelte.d.ts +14 -1
  40. package/dist/actions/request_tracker.svelte.d.ts.map +1 -1
  41. package/dist/actions/request_tracker.svelte.js +14 -1
  42. package/dist/actions/socket.svelte.d.ts +35 -15
  43. package/dist/actions/socket.svelte.d.ts.map +1 -1
  44. package/dist/actions/socket.svelte.js +33 -13
  45. package/dist/actions/transports.d.ts +12 -3
  46. package/dist/actions/transports.d.ts.map +1 -1
  47. package/dist/actions/transports.js +16 -7
  48. package/dist/actions/transports_http.d.ts +7 -0
  49. package/dist/actions/transports_http.d.ts.map +1 -1
  50. package/dist/actions/transports_http.js +7 -0
  51. package/dist/actions/transports_ws.d.ts +13 -0
  52. package/dist/actions/transports_ws.d.ts.map +1 -1
  53. package/dist/actions/transports_ws.js +13 -0
  54. package/dist/actions/transports_ws_auth_guard.d.ts +6 -2
  55. package/dist/actions/transports_ws_auth_guard.d.ts.map +1 -1
  56. package/dist/actions/transports_ws_auth_guard.js +6 -2
  57. package/dist/actions/transports_ws_backend.d.ts +14 -1
  58. package/dist/actions/transports_ws_backend.d.ts.map +1 -1
  59. package/dist/actions/transports_ws_backend.js +14 -1
  60. package/dist/auth/CLAUDE.md +40 -4
  61. package/dist/auth/account_queries.d.ts +10 -0
  62. package/dist/auth/account_queries.d.ts.map +1 -1
  63. package/dist/auth/account_queries.js +10 -0
  64. package/dist/auth/account_routes.d.ts +3 -3
  65. package/dist/auth/account_routes.js +3 -3
  66. package/dist/auth/account_schema.d.ts +1 -1
  67. package/dist/auth/account_schema.js +1 -1
  68. package/dist/auth/admin_actions.d.ts +1 -0
  69. package/dist/auth/admin_actions.d.ts.map +1 -1
  70. package/dist/auth/admin_actions.js +1 -0
  71. package/dist/auth/api_token.d.ts +1 -1
  72. package/dist/auth/api_token.js +1 -1
  73. package/dist/auth/api_token_queries.d.ts +7 -0
  74. package/dist/auth/api_token_queries.d.ts.map +1 -1
  75. package/dist/auth/api_token_queries.js +7 -0
  76. package/dist/auth/app_settings_queries.d.ts +4 -0
  77. package/dist/auth/app_settings_queries.d.ts.map +1 -1
  78. package/dist/auth/app_settings_queries.js +4 -0
  79. package/dist/auth/audit_log_queries.d.ts +6 -0
  80. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  81. package/dist/auth/audit_log_queries.js +6 -0
  82. package/dist/auth/audit_log_routes.d.ts +1 -1
  83. package/dist/auth/audit_log_routes.js +1 -1
  84. package/dist/auth/audit_log_schema.d.ts +3 -1
  85. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  86. package/dist/auth/audit_log_schema.js +134 -55
  87. package/dist/auth/bearer_auth.d.ts +2 -0
  88. package/dist/auth/bearer_auth.d.ts.map +1 -1
  89. package/dist/auth/bearer_auth.js +2 -0
  90. package/dist/auth/bootstrap_account.d.ts +3 -0
  91. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  92. package/dist/auth/bootstrap_account.js +3 -0
  93. package/dist/auth/cleanup.d.ts +6 -0
  94. package/dist/auth/cleanup.d.ts.map +1 -1
  95. package/dist/auth/cleanup.js +6 -0
  96. package/dist/auth/daemon_token.d.ts +1 -1
  97. package/dist/auth/daemon_token.js +1 -1
  98. package/dist/auth/daemon_token_middleware.d.ts +5 -1
  99. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  100. package/dist/auth/daemon_token_middleware.js +5 -1
  101. package/dist/auth/ddl.d.ts +1 -1
  102. package/dist/auth/ddl.js +1 -1
  103. package/dist/auth/invite_queries.d.ts +4 -0
  104. package/dist/auth/invite_queries.d.ts.map +1 -1
  105. package/dist/auth/invite_queries.js +4 -0
  106. package/dist/auth/password.d.ts +1 -1
  107. package/dist/auth/password.js +1 -1
  108. package/dist/auth/permit_offer_action_specs.d.ts +5 -0
  109. package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
  110. package/dist/auth/permit_offer_action_specs.js +10 -0
  111. package/dist/auth/permit_offer_queries.d.ts +19 -0
  112. package/dist/auth/permit_offer_queries.d.ts.map +1 -1
  113. package/dist/auth/permit_offer_queries.js +19 -0
  114. package/dist/auth/permit_queries.d.ts +8 -0
  115. package/dist/auth/permit_queries.d.ts.map +1 -1
  116. package/dist/auth/permit_queries.js +8 -0
  117. package/dist/auth/request_context.d.ts +1 -0
  118. package/dist/auth/request_context.d.ts.map +1 -1
  119. package/dist/auth/request_context.js +1 -0
  120. package/dist/auth/role_schema.d.ts +2 -0
  121. package/dist/auth/role_schema.d.ts.map +1 -1
  122. package/dist/auth/role_schema.js +2 -0
  123. package/dist/auth/route_guards.d.ts +1 -1
  124. package/dist/auth/route_guards.js +1 -1
  125. package/dist/auth/self_service_role_action_specs.d.ts +1 -1
  126. package/dist/auth/self_service_role_action_specs.js +1 -1
  127. package/dist/auth/self_service_role_actions.d.ts +2 -1
  128. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  129. package/dist/auth/self_service_role_actions.js +2 -1
  130. package/dist/auth/session_lifecycle.d.ts +3 -0
  131. package/dist/auth/session_lifecycle.d.ts.map +1 -1
  132. package/dist/auth/session_lifecycle.js +3 -0
  133. package/dist/auth/session_middleware.d.ts +5 -0
  134. package/dist/auth/session_middleware.d.ts.map +1 -1
  135. package/dist/auth/session_middleware.js +5 -0
  136. package/dist/auth/session_queries.d.ts +10 -1
  137. package/dist/auth/session_queries.d.ts.map +1 -1
  138. package/dist/auth/session_queries.js +10 -1
  139. package/dist/auth/signup_routes.d.ts +1 -1
  140. package/dist/auth/signup_routes.js +1 -1
  141. package/dist/cli/config.d.ts +2 -0
  142. package/dist/cli/config.d.ts.map +1 -1
  143. package/dist/cli/config.js +2 -0
  144. package/dist/cli/daemon.d.ts +6 -1
  145. package/dist/cli/daemon.d.ts.map +1 -1
  146. package/dist/cli/daemon.js +6 -1
  147. package/dist/cli/util.d.ts +1 -1
  148. package/dist/cli/util.js +1 -1
  149. package/dist/db/assert_row.d.ts +2 -1
  150. package/dist/db/assert_row.d.ts.map +1 -1
  151. package/dist/db/assert_row.js +2 -1
  152. package/dist/db/create_db.d.ts +5 -2
  153. package/dist/db/create_db.d.ts.map +1 -1
  154. package/dist/db/create_db.js +5 -2
  155. package/dist/db/db.d.ts +22 -7
  156. package/dist/db/db.d.ts.map +1 -1
  157. package/dist/db/db.js +21 -6
  158. package/dist/db/db_pg.d.ts +2 -1
  159. package/dist/db/db_pg.d.ts.map +1 -1
  160. package/dist/db/db_pg.js +5 -3
  161. package/dist/db/db_pglite.d.ts +3 -2
  162. package/dist/db/db_pglite.d.ts.map +1 -1
  163. package/dist/db/db_pglite.js +3 -2
  164. package/dist/db/migrate.d.ts +8 -4
  165. package/dist/db/migrate.d.ts.map +1 -1
  166. package/dist/db/migrate.js +6 -2
  167. package/dist/db/sql_identifier.d.ts +2 -1
  168. package/dist/db/sql_identifier.d.ts.map +1 -1
  169. package/dist/db/sql_identifier.js +2 -1
  170. package/dist/db/status.d.ts +4 -1
  171. package/dist/db/status.d.ts.map +1 -1
  172. package/dist/db/status.js +5 -2
  173. package/dist/dev/setup.d.ts +18 -2
  174. package/dist/dev/setup.d.ts.map +1 -1
  175. package/dist/dev/setup.js +18 -2
  176. package/dist/env/dotenv.d.ts +2 -1
  177. package/dist/env/dotenv.d.ts.map +1 -1
  178. package/dist/env/dotenv.js +2 -1
  179. package/dist/env/load.d.ts +1 -1
  180. package/dist/env/load.js +1 -1
  181. package/dist/env/resolve.d.ts +1 -1
  182. package/dist/env/resolve.js +1 -1
  183. package/dist/env/update_env_variable.d.ts +2 -0
  184. package/dist/env/update_env_variable.d.ts.map +1 -1
  185. package/dist/env/update_env_variable.js +2 -0
  186. package/dist/hono_context.d.ts +1 -1
  187. package/dist/hono_context.js +1 -1
  188. package/dist/http/jsonrpc_errors.d.ts +2 -2
  189. package/dist/http/jsonrpc_errors.js +2 -2
  190. package/dist/http/jsonrpc_helpers.d.ts +2 -2
  191. package/dist/http/jsonrpc_helpers.js +2 -2
  192. package/dist/http/middleware_spec.d.ts +1 -1
  193. package/dist/http/middleware_spec.js +1 -1
  194. package/dist/http/origin.d.ts +1 -1
  195. package/dist/http/origin.js +1 -1
  196. package/dist/http/pending_effects.d.ts +4 -0
  197. package/dist/http/pending_effects.d.ts.map +1 -1
  198. package/dist/http/pending_effects.js +4 -0
  199. package/dist/http/proxy.d.ts +3 -0
  200. package/dist/http/proxy.d.ts.map +1 -1
  201. package/dist/http/proxy.js +3 -0
  202. package/dist/http/route_spec.d.ts +1 -0
  203. package/dist/http/route_spec.d.ts.map +1 -1
  204. package/dist/http/route_spec.js +7 -0
  205. package/dist/http/schema_helpers.d.ts +1 -1
  206. package/dist/http/schema_helpers.js +1 -1
  207. package/dist/http/surface.d.ts +1 -1
  208. package/dist/http/surface.js +1 -1
  209. package/dist/rate_limiter.d.ts +14 -1
  210. package/dist/rate_limiter.d.ts.map +1 -1
  211. package/dist/rate_limiter.js +14 -1
  212. package/dist/realtime/sse.d.ts +7 -1
  213. package/dist/realtime/sse.d.ts.map +1 -1
  214. package/dist/realtime/sse.js +3 -1
  215. package/dist/realtime/sse_auth_guard.d.ts +21 -21
  216. package/dist/realtime/sse_auth_guard.d.ts.map +1 -1
  217. package/dist/realtime/sse_auth_guard.js +24 -24
  218. package/dist/realtime/subscriber_registry.d.ts +4 -2
  219. package/dist/realtime/subscriber_registry.d.ts.map +1 -1
  220. package/dist/realtime/subscriber_registry.js +4 -2
  221. package/dist/runtime/deno.d.ts +1 -1
  222. package/dist/runtime/deno.js +1 -1
  223. package/dist/runtime/fs.d.ts +5 -0
  224. package/dist/runtime/fs.d.ts.map +1 -1
  225. package/dist/runtime/fs.js +5 -0
  226. package/dist/runtime/mock.d.ts +6 -0
  227. package/dist/runtime/mock.d.ts.map +1 -1
  228. package/dist/runtime/mock.js +6 -0
  229. package/dist/runtime/node.d.ts +1 -1
  230. package/dist/runtime/node.js +1 -1
  231. package/dist/server/app_backend.d.ts +1 -0
  232. package/dist/server/app_backend.d.ts.map +1 -1
  233. package/dist/server/app_backend.js +1 -0
  234. package/dist/server/app_server.d.ts +4 -0
  235. package/dist/server/app_server.d.ts.map +1 -1
  236. package/dist/server/app_server.js +4 -0
  237. package/dist/server/validate_nginx.d.ts +3 -0
  238. package/dist/server/validate_nginx.d.ts.map +1 -1
  239. package/dist/testing/admin_integration.d.ts +5 -0
  240. package/dist/testing/admin_integration.d.ts.map +1 -1
  241. package/dist/testing/admin_integration.js +5 -0
  242. package/dist/testing/adversarial_headers.d.ts +5 -3
  243. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  244. package/dist/testing/adversarial_headers.js +5 -3
  245. package/dist/testing/adversarial_input.d.ts +4 -0
  246. package/dist/testing/adversarial_input.d.ts.map +1 -1
  247. package/dist/testing/adversarial_input.js +4 -0
  248. package/dist/testing/app_server.d.ts +3 -0
  249. package/dist/testing/app_server.d.ts.map +1 -1
  250. package/dist/testing/app_server.js +11 -0
  251. package/dist/testing/assertions.d.ts +23 -7
  252. package/dist/testing/assertions.d.ts.map +1 -1
  253. package/dist/testing/assertions.js +23 -7
  254. package/dist/testing/audit_completeness.d.ts +4 -0
  255. package/dist/testing/audit_completeness.d.ts.map +1 -1
  256. package/dist/testing/audit_completeness.js +4 -0
  257. package/dist/testing/auth_apps.d.ts +3 -0
  258. package/dist/testing/auth_apps.d.ts.map +1 -1
  259. package/dist/testing/auth_apps.js +3 -0
  260. package/dist/testing/db.d.ts +9 -1
  261. package/dist/testing/db.d.ts.map +1 -1
  262. package/dist/testing/db.js +9 -1
  263. package/dist/testing/error_coverage.d.ts +9 -0
  264. package/dist/testing/error_coverage.d.ts.map +1 -1
  265. package/dist/testing/error_coverage.js +9 -0
  266. package/dist/testing/integration.d.ts +4 -0
  267. package/dist/testing/integration.d.ts.map +1 -1
  268. package/dist/testing/integration.js +4 -0
  269. package/dist/testing/integration_helpers.d.ts +10 -4
  270. package/dist/testing/integration_helpers.d.ts.map +1 -1
  271. package/dist/testing/integration_helpers.js +10 -4
  272. package/dist/testing/middleware.d.ts +5 -0
  273. package/dist/testing/middleware.d.ts.map +1 -1
  274. package/dist/testing/middleware.js +5 -0
  275. package/dist/testing/rate_limiting.d.ts +3 -0
  276. package/dist/testing/rate_limiting.d.ts.map +1 -1
  277. package/dist/testing/rate_limiting.js +3 -0
  278. package/dist/testing/rpc_attack_surface.js +1 -1
  279. package/dist/testing/rpc_helpers.d.ts +21 -8
  280. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  281. package/dist/testing/rpc_helpers.js +22 -9
  282. package/dist/testing/schema_generators.d.ts +7 -2
  283. package/dist/testing/schema_generators.d.ts.map +1 -1
  284. package/dist/testing/schema_generators.js +7 -2
  285. package/dist/testing/sse_round_trip.d.ts +3 -0
  286. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  287. package/dist/testing/sse_round_trip.js +3 -0
  288. package/dist/testing/stubs.d.ts +7 -0
  289. package/dist/testing/stubs.d.ts.map +1 -1
  290. package/dist/testing/stubs.js +7 -0
  291. package/dist/testing/surface_invariants.d.ts +14 -0
  292. package/dist/testing/surface_invariants.d.ts.map +1 -1
  293. package/dist/testing/surface_invariants.js +14 -0
  294. package/dist/testing/ws_round_trip.d.ts +13 -1
  295. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  296. package/dist/testing/ws_round_trip.js +1 -1
  297. package/dist/ui/AccountSessions.svelte +9 -0
  298. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  299. package/dist/ui/AdminAccounts.svelte +10 -0
  300. package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
  301. package/dist/ui/AdminAuditLog.svelte +10 -0
  302. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  303. package/dist/ui/AdminInvites.svelte +9 -0
  304. package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
  305. package/dist/ui/AdminOverview.svelte +10 -0
  306. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  307. package/dist/ui/AdminPermitHistory.svelte +9 -0
  308. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -1
  309. package/dist/ui/AdminSessions.svelte +10 -0
  310. package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
  311. package/dist/ui/AdminSettings.svelte +9 -0
  312. package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
  313. package/dist/ui/AdminSurface.svelte +9 -0
  314. package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
  315. package/dist/ui/AppShell.svelte +24 -0
  316. package/dist/ui/AppShell.svelte.d.ts +23 -0
  317. package/dist/ui/AppShell.svelte.d.ts.map +1 -1
  318. package/dist/ui/BootstrapForm.svelte +17 -0
  319. package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
  320. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  321. package/dist/ui/ColumnLayout.svelte +11 -0
  322. package/dist/ui/ColumnLayout.svelte.d.ts +10 -0
  323. package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -1
  324. package/dist/ui/Datatable.svelte +18 -0
  325. package/dist/ui/Datatable.svelte.d.ts +17 -0
  326. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  327. package/dist/ui/LoginForm.svelte +18 -0
  328. package/dist/ui/LoginForm.svelte.d.ts +9 -0
  329. package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
  330. package/dist/ui/LogoutButton.svelte +9 -0
  331. package/dist/ui/LogoutButton.svelte.d.ts +8 -0
  332. package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
  333. package/dist/ui/MenuLink.svelte +10 -0
  334. package/dist/ui/MenuLink.svelte.d.ts +9 -0
  335. package/dist/ui/MenuLink.svelte.d.ts.map +1 -1
  336. package/dist/ui/OpenSignupToggle.svelte +9 -0
  337. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  338. package/dist/ui/SignupForm.svelte +16 -0
  339. package/dist/ui/SignupForm.svelte.d.ts +4 -0
  340. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  341. package/dist/ui/SurfaceExplorer.svelte +9 -0
  342. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  343. package/dist/ui/account_sessions_state.svelte.d.ts +2 -2
  344. package/dist/ui/account_sessions_state.svelte.js +1 -1
  345. package/dist/ui/admin_rpc_adapters.d.ts +1 -1
  346. package/dist/ui/admin_rpc_adapters.js +1 -1
  347. package/dist/ui/audit_log_state.svelte.d.ts +6 -1
  348. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  349. package/dist/ui/audit_log_state.svelte.js +6 -1
  350. package/dist/ui/auth_state.svelte.d.ts +16 -4
  351. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  352. package/dist/ui/auth_state.svelte.js +16 -4
  353. package/dist/ui/form_state.svelte.d.ts +9 -0
  354. package/dist/ui/form_state.svelte.d.ts.map +1 -1
  355. package/dist/ui/form_state.svelte.js +9 -0
  356. package/dist/ui/loadable.svelte.d.ts +6 -1
  357. package/dist/ui/loadable.svelte.d.ts.map +1 -1
  358. package/dist/ui/loadable.svelte.js +6 -1
  359. package/dist/ui/permit_offers_state.svelte.d.ts +2 -0
  360. package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
  361. package/dist/ui/permit_offers_state.svelte.js +2 -0
  362. package/dist/ui/popover.svelte.d.ts +17 -4
  363. package/dist/ui/popover.svelte.d.ts.map +1 -1
  364. package/dist/ui/popover.svelte.js +17 -4
  365. package/dist/ui/position_helpers.d.ts +1 -0
  366. package/dist/ui/position_helpers.d.ts.map +1 -1
  367. package/dist/ui/position_helpers.js +1 -0
  368. package/dist/ui/sidebar_state.svelte.d.ts +22 -9
  369. package/dist/ui/sidebar_state.svelte.d.ts.map +1 -1
  370. package/dist/ui/sidebar_state.svelte.js +17 -2
  371. package/dist/ui/table_state.svelte.d.ts +14 -0
  372. package/dist/ui/table_state.svelte.d.ts.map +1 -1
  373. package/dist/ui/table_state.svelte.js +14 -0
  374. 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
@@ -116,8 +129,8 @@ not the runtime):
116
129
  - `ImportBuilder` — tracks value / type / namespace imports; emits `import type` when every entry on a module is a type (tree-shaking). Namespace (`* as specs`) entries are emitted verbatim. Public surface: `add`, `add_type`, `add_many`, `add_types`, `build`, `preview`, `has_imports`, `import_count`, `clear`.
117
130
  - `get_executor_phases(spec, executor)` — phases a given executor (`'frontend' | 'backend'`) participates in for the spec. Deduplicates via `Set` (handles `initiator: 'both'` overlap).
118
131
  - `get_handler_return_type(spec, phase, imports, collections_path?)` — the TS type a phase handler must return; triggers the `ActionOutputs` import (sourced from `collections_path`, default `'./action_collections.js'`) as a side effect.
119
- - `generate_phase_handlers(spec, executor, imports, {action_event_type?, collections_path?})` — emits the typed handler-map fragment for one action; consumers compose these into `ActionHandlers` types.
120
- - `generate_actions_api_method_signature(spec, {sync_returns_value?})` — single source of truth for the typed `FrontendActionsApi` method shape. Threads `options?: RpcClientCallOptions` (`{signal?, transport_name?, queue?}`) onto every async method — `request_response`, `remote_notification`, and async `local_call` — and wraps the return in `Promise<Result<...>>`. Notifications were previously emitted as `=> void`, mismatching the runtime (`create_remote_notification_method` returns a Promise that resolves to `Result<{value: void}>`); regenerate consumer typed clients to pick up the corrected shape.
132
+ - `generate_phase_handlers(spec, executor, imports, {action_event_type?, collections_path?})` — emits the typed handler-map fragment for one action; consumers compose these into `ActionHandlers` types. Returns `''` when the spec contributes no phases on the given executor (e.g. a backend-only `local_call` asked for `'frontend'`) so wrappers' `.filter(Boolean)` drops the row entirely instead of emitting a useless `${method}?: never` for a method that doesn't belong on this side.
133
+ - `generate_actions_api_method_signature(spec, imports, {sync_returns_value?, collections_path?})` — single source of truth for the typed `FrontendActionsApi` method shape. Threads `options?: RpcClientCallOptions` (`{signal?, transport_name?, queue?}`) onto every async method — `request_response`, `remote_notification`, and async `local_call` — and wraps the return in `Promise<Result<...>>`. Registers exactly the imports the emitted line references on `imports` — `ActionInputs` only when the spec has input, `RpcClientCallOptions` only when async, `Result` / `JsonrpcErrorObject` only when the return wraps in `Result`. Mirrors the leaf-level pattern `get_handler_return_type` already follows so wrappers no longer pre-register imports a per-spec emit might not actually use.
121
134
  - `create_banner(origin_path)` — gen banner comment.
122
135
  - `to_action_spec_identifier(method)` / `to_action_spec_input_identifier` / `to_action_spec_output_identifier` — naming convention helpers (emit `foo_action_spec` / `foo_action_spec.input` / `foo_action_spec.output`).
123
136
  - `PROTOCOL_ACTION_METHODS` (+ `ProtocolActionMethod` type) — readonly tuple `['heartbeat', 'cancel']`. Pairs with `protocol_actions` / `protocol_action_specs` in `actions/protocol.ts` (the runtime bundles). Consumers spread when filtering backend `request_response` methods so dispatcher-owned protocol actions don't leak into `BackendRequestResponseMethod` / handler maps.
@@ -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":["../../src/lib/actions/action_bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAC,UAAU,EAAE,UAAU,IAAI,cAAc,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAC3F,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAC,iBAAiB,EAA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OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAEhE,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;IACtB,uGAAuG;IACvG,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IACpB,mFAAmF;IACnF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,+IAA+I;IAC/I,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,8GAA8G;IAC9G,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,kDAAkD;AAClD,eAAO,MAAM,eAAe,GAAI,MAAM,cAAc,KAAG,SAKtD,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,GAAI,cAAc,iBAAiB,KAAG,WAEpE,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,GACpC,MAAM,UAAU,EAChB,SAAS,kBAAkB,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
  }
@@ -118,9 +126,18 @@ export declare const get_handler_return_type: (spec: ActionSpecUnion, phase: Act
118
126
  * Generates the phase handlers for an action spec using the unified ActionEvent type
119
127
  * with the new phase/step type parameters.
120
128
  *
129
+ * Returns `''` when the spec contributes no phases on the given executor side
130
+ * (e.g. a backend-only `local_call` asked for `'frontend'`). Upstream wrappers
131
+ * compose blocks with `.filter(Boolean)` so empty entries are dropped from the
132
+ * generated handler map. The earlier shape was `${method}?: never`, which read
133
+ * as "calling this here is a type error" but in practice produced useless rows
134
+ * on `FrontendActionHandlers` for methods that don't belong on this side at
135
+ * all — drop the row instead so the typed surface only carries methods the
136
+ * executor actually handles.
137
+ *
121
138
  * @param options.action_event_type - custom type name to use instead of `ActionEvent`
122
139
  * (consumers can define a narrowed type that carries typed input/output via their codegen maps)
123
- * @param options.collections_path - import path the side-effect `ActionOutputs` import
140
+ * @param options.collections_path - Import path the side-effect `ActionOutputs` import
124
141
  * resolves to. Defaults to `'./action_collections.js'`.
125
142
  */
126
143
  export declare const generate_phase_handlers: (spec: ActionSpecUnion, executor: "frontend" | "backend", imports: ImportBuilder, options?: {
@@ -151,19 +168,28 @@ export declare const to_action_spec_output_identifier: (method: string) => strin
151
168
  * failure). Earlier emit shapes declared notifications as `=> void` —
152
169
  * regenerate consumer typed clients to pick up the corrected return.
153
170
  *
154
- * Consumers must import `ActionInputs`, `ActionOutputs`, `Result`,
155
- * `JsonrpcErrorObject`, and (for async) `RpcClientCallOptions` into the
156
- * generated module — the helper only emits the type references.
171
+ * Registers exactly the imports the emitted line references on `imports`:
172
+ * `ActionInputs` (when the spec has input), `ActionOutputs` (always),
173
+ * `RpcClientCallOptions` (async only), and `Result` + `JsonrpcErrorObject`
174
+ * (any return shape that wraps the value in `Result<{value}, {error}>` —
175
+ * every async method, plus sync `local_call` when `sync_returns_value:
176
+ * false`). Mirrors the leaf-level pattern `get_handler_return_type` already
177
+ * follows so wrappers no longer pre-register imports a per-spec emit might
178
+ * not actually use.
157
179
  *
158
180
  * @param spec - the action spec to emit
159
- * @param options.sync_returns_value - when true (default), sync local_call
181
+ * @param imports - import builder to register references on
182
+ * @param options.sync_returns_value - When true (default), sync `local_call`
160
183
  * methods return the output value directly; when false they're wrapped in
161
184
  * `Result<{value, error}>` like async methods. Set to `false` if your
162
- * FrontendActionsApi treats every method uniformly.
185
+ * `FrontendActionsApi` treats every method uniformly.
186
+ * @param options.collections_path - Import path that `ActionInputs` /
187
+ * `ActionOutputs` resolve to. Defaults to `'./action_collections.js'`.
163
188
  * @returns one line like `foo: (input: ActionInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
164
189
  */
165
- export declare const generate_actions_api_method_signature: (spec: ActionSpecUnion, options?: {
190
+ export declare const generate_actions_api_method_signature: (spec: ActionSpecUnion, imports: ImportBuilder, options?: {
166
191
  sync_returns_value?: boolean;
192
+ collections_path?: string;
167
193
  }) => string;
168
194
  /** Discriminator for `generate_action_method_enums` — which method-set enums to emit. */
169
195
  export type ActionMethodEnumKind = 'all' | 'request_response' | 'remote_notification' | 'local_call' | 'frontend' | 'backend' | 'frontend_handled' | 'backend_handled' | 'broadcast';
@@ -300,8 +326,11 @@ export declare const generate_action_event_datas: (specs: ReadonlyArray<ActionSp
300
326
  * (e.g. omit additional methods alongside the default protocol-action
301
327
  * filter) via `method_filter`.
302
328
  *
303
- * Adds the `Result`, `JsonrpcErrorObject`, and `RpcClientCallOptions` type
304
- * imports plus `ActionInputs` / `ActionOutputs` (sourced from `collections_path`).
329
+ * Imports are registered by the leaf `generate_actions_api_method_signature`
330
+ * per emitted line only what the spec set actually references shows up on
331
+ * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
332
+ * one with no inputs skips `ActionInputs`; sync `local_call` methods with
333
+ * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
305
334
  *
306
335
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
307
336
  * of `BackendActionsApi`. Earlier consumer-named variants (`MyActionsApi`,
@@ -347,7 +376,7 @@ export declare const generate_frontend_action_handlers: (specs: ReadonlyArray<Ac
347
376
  * Method signature shape today is `(input) => Promise<void>` — matches the
348
377
  * fire-and-forget runtime of `create_broadcast_api`. Generalizing per-kind
349
378
  * via `generate_actions_api_method_signature` is deferred until a second
350
- * backend runtime constructor lands (see SAES quest § API review III).
379
+ * backend runtime constructor lands.
351
380
  *
352
381
  * @param options.qualify_spec - per-spec qualified identifier callback for
353
382
  * multi-source consumers. When set, the helper emits the callback's return
@@ -413,6 +442,11 @@ export interface SpecSource {
413
442
  * per-call callback wasn't enough; the import dance + dup-check was the
414
443
  * real boilerplate.
415
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
+ *
416
450
  * @example
417
451
  * ```ts
418
452
  * const sources = [
@@ -433,9 +467,6 @@ export interface SpecSource {
433
467
  * });
434
468
  * };
435
469
  * ```
436
- *
437
- * @throws if two sources contain the same method name (same-method detection
438
- * is the consumer's primary debugging signal).
439
470
  */
440
471
  export declare const create_namespace_qualifier: (sources: ReadonlyArray<SpecSource>, imports: ImportBuilder) => {
441
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,IAAI;IAI1C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G;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();
@@ -278,16 +286,25 @@ export const get_handler_return_type = (spec, phase, imports, collections_path =
278
286
  * Generates the phase handlers for an action spec using the unified ActionEvent type
279
287
  * with the new phase/step type parameters.
280
288
  *
289
+ * Returns `''` when the spec contributes no phases on the given executor side
290
+ * (e.g. a backend-only `local_call` asked for `'frontend'`). Upstream wrappers
291
+ * compose blocks with `.filter(Boolean)` so empty entries are dropped from the
292
+ * generated handler map. The earlier shape was `${method}?: never`, which read
293
+ * as "calling this here is a type error" but in practice produced useless rows
294
+ * on `FrontendActionHandlers` for methods that don't belong on this side at
295
+ * all — drop the row instead so the typed surface only carries methods the
296
+ * executor actually handles.
297
+ *
281
298
  * @param options.action_event_type - custom type name to use instead of `ActionEvent`
282
299
  * (consumers can define a narrowed type that carries typed input/output via their codegen maps)
283
- * @param options.collections_path - import path the side-effect `ActionOutputs` import
300
+ * @param options.collections_path - Import path the side-effect `ActionOutputs` import
284
301
  * resolves to. Defaults to `'./action_collections.js'`.
285
302
  */
286
303
  export const generate_phase_handlers = (spec, executor, imports, options) => {
287
304
  const { method } = spec;
288
305
  const phases = get_executor_phases(spec, executor);
289
306
  if (phases.length === 0) {
290
- return `${method}?: never`;
307
+ return '';
291
308
  }
292
309
  const action_event_type = options?.action_event_type ?? 'ActionEvent';
293
310
  const collections_path = options?.collections_path ?? DEFAULT_COLLECTIONS_PATH;
@@ -331,32 +348,52 @@ export const to_action_spec_output_identifier = (method) => `${to_action_spec_id
331
348
  * failure). Earlier emit shapes declared notifications as `=> void` —
332
349
  * regenerate consumer typed clients to pick up the corrected return.
333
350
  *
334
- * Consumers must import `ActionInputs`, `ActionOutputs`, `Result`,
335
- * `JsonrpcErrorObject`, and (for async) `RpcClientCallOptions` into the
336
- * generated module — the helper only emits the type references.
351
+ * Registers exactly the imports the emitted line references on `imports`:
352
+ * `ActionInputs` (when the spec has input), `ActionOutputs` (always),
353
+ * `RpcClientCallOptions` (async only), and `Result` + `JsonrpcErrorObject`
354
+ * (any return shape that wraps the value in `Result<{value}, {error}>` —
355
+ * every async method, plus sync `local_call` when `sync_returns_value:
356
+ * false`). Mirrors the leaf-level pattern `get_handler_return_type` already
357
+ * follows so wrappers no longer pre-register imports a per-spec emit might
358
+ * not actually use.
337
359
  *
338
360
  * @param spec - the action spec to emit
339
- * @param options.sync_returns_value - when true (default), sync local_call
361
+ * @param imports - import builder to register references on
362
+ * @param options.sync_returns_value - When true (default), sync `local_call`
340
363
  * methods return the output value directly; when false they're wrapped in
341
364
  * `Result<{value, error}>` like async methods. Set to `false` if your
342
- * FrontendActionsApi treats every method uniformly.
365
+ * `FrontendActionsApi` treats every method uniformly.
366
+ * @param options.collections_path - Import path that `ActionInputs` /
367
+ * `ActionOutputs` resolve to. Defaults to `'./action_collections.js'`.
343
368
  * @returns one line like `foo: (input: ActionInputs['foo'], options?: RpcClientCallOptions) => Promise<Result<...>>;`
344
369
  */
345
- export const generate_actions_api_method_signature = (spec, options) => {
370
+ export const generate_actions_api_method_signature = (spec, imports, options) => {
346
371
  const sync_returns_value = options?.sync_returns_value ?? true;
372
+ const collections_path = options?.collections_path ?? DEFAULT_COLLECTIONS_PATH;
347
373
  const innermost_type_name = zod_get_base_type(spec.input);
348
374
  const has_input = innermost_type_name !== 'null' && innermost_type_name !== 'void';
349
375
  const input_param = has_input
350
376
  ? `input${spec.input.safeParse(undefined).success ? '?' : ''}: ActionInputs['${spec.method}']`
351
377
  : 'input?: void';
378
+ if (has_input)
379
+ imports.add_type(collections_path, 'ActionInputs');
380
+ imports.add_type(collections_path, 'ActionOutputs');
352
381
  const is_async = spec.kind === 'request_response' || spec.kind === 'remote_notification' || spec.async;
353
382
  const options_param = is_async ? ', options?: RpcClientCallOptions' : '';
383
+ if (is_async) {
384
+ imports.add_type('@fuzdev/fuz_app/actions/rpc_client.js', 'RpcClientCallOptions');
385
+ }
354
386
  const result_return = `Result<{value: ActionOutputs['${spec.method}']}, {error: JsonrpcErrorObject}>`;
355
387
  const return_type = is_async
356
388
  ? `Promise<${result_return}>`
357
389
  : sync_returns_value
358
390
  ? `ActionOutputs['${spec.method}']`
359
391
  : result_return;
392
+ const wraps_in_result = is_async || !sync_returns_value;
393
+ if (wraps_in_result) {
394
+ imports.add_type('@fuzdev/fuz_util/result.js', 'Result');
395
+ imports.add_type('@fuzdev/fuz_app/http/jsonrpc.js', 'JsonrpcErrorObject');
396
+ }
360
397
  return `${spec.method}: (${input_param}${options_param}) => ${return_type};`;
361
398
  };
362
399
  // --------------------------------------------------------------------------
@@ -711,8 +748,11 @@ ${lines.join('\n')}
711
748
  * (e.g. omit additional methods alongside the default protocol-action
712
749
  * filter) via `method_filter`.
713
750
  *
714
- * Adds the `Result`, `JsonrpcErrorObject`, and `RpcClientCallOptions` type
715
- * imports plus `ActionInputs` / `ActionOutputs` (sourced from `collections_path`).
751
+ * Imports are registered by the leaf `generate_actions_api_method_signature`
752
+ * per emitted line only what the spec set actually references shows up on
753
+ * `imports`. A spec set with no async methods skips `RpcClientCallOptions`;
754
+ * one with no inputs skips `ActionInputs`; sync `local_call` methods with
755
+ * `sync_returns_value: true` (the default) skip `Result` / `JsonrpcErrorObject`.
716
756
  *
717
757
  * The interface name is fixed at `FrontendActionsApi` — the symmetric counterpart
718
758
  * of `BackendActionsApi`. Earlier consumer-named variants (`MyActionsApi`,
@@ -738,14 +778,10 @@ export const generate_frontend_actions_api = (specs, imports, options) => {
738
778
  return `${interface_doc}
739
779
  export interface FrontendActionsApi {}`;
740
780
  }
741
- const collections_path = options?.collections_path ?? DEFAULT_COLLECTIONS_PATH;
742
- imports.add_type('@fuzdev/fuz_util/result.js', 'Result');
743
- imports.add_type('@fuzdev/fuz_app/http/jsonrpc.js', 'JsonrpcErrorObject');
744
- imports.add_type('@fuzdev/fuz_app/actions/rpc_client.js', 'RpcClientCallOptions');
745
- imports.add_types(collections_path, 'ActionInputs', 'ActionOutputs');
746
781
  const lines = filtered
747
- .map((spec) => generate_actions_api_method_signature(spec, {
782
+ .map((spec) => generate_actions_api_method_signature(spec, imports, {
748
783
  sync_returns_value: options?.sync_returns_value,
784
+ collections_path: options?.collections_path,
749
785
  }))
750
786
  .map((line) => `\t${line}`)
751
787
  .join('\n');
@@ -811,7 +847,7 @@ ${lines};
811
847
  * Method signature shape today is `(input) => Promise<void>` — matches the
812
848
  * fire-and-forget runtime of `create_broadcast_api`. Generalizing per-kind
813
849
  * via `generate_actions_api_method_signature` is deferred until a second
814
- * backend runtime constructor lands (see SAES quest § API review III).
850
+ * backend runtime constructor lands.
815
851
  *
816
852
  * @param options.qualify_spec - per-spec qualified identifier callback for
817
853
  * multi-source consumers. When set, the helper emits the callback's return
@@ -908,6 +944,11 @@ export type ${type_name} = {
908
944
  * per-call callback wasn't enough; the import dance + dup-check was the
909
945
  * real boilerplate.
910
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
+ *
911
952
  * @example
912
953
  * ```ts
913
954
  * const sources = [
@@ -928,9 +969,6 @@ export type ${type_name} = {
928
969
  * });
929
970
  * };
930
971
  * ```
931
- *
932
- * @throws if two sources contain the same method name (same-method detection
933
- * is the consumer's primary debugging signal).
934
972
  */
935
973
  export const create_namespace_qualifier = (sources, imports) => {
936
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,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AW,IAAI,OAAO;IAItB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAIxC,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAQ1C,YAAY,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAUpD,gBAAgB,CAAC,YAAY,EAAE,mBAAmB,GAAG,IAAI;CAyKzD;AAGD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EAClE,aAAa,sBAAsB,EACnC,MAAM,eAAe,EACrB,OAAO,OAAO,EACd,gBAAgB,gBAAgB,KAC9B,WAAW,CAAC,OAAO,CAiBrB,CAAC;AAEF;;;;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);