@fuzdev/fuz_app 0.150.0 → 0.152.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 (597) hide show
  1. package/README.md +1 -1
  2. package/dist/actions/CLAUDE.md +324 -299
  3. package/dist/actions/action_bridge.d.ts +5 -86
  4. package/dist/actions/action_bridge.d.ts.map +1 -1
  5. package/dist/actions/action_bridge.js +4 -84
  6. package/dist/actions/action_codegen.d.ts +8 -166
  7. package/dist/actions/action_codegen.d.ts.map +1 -1
  8. package/dist/actions/action_codegen.js +19 -95
  9. package/dist/actions/action_dispatcher.d.ts +10 -0
  10. package/dist/actions/action_dispatcher.d.ts.map +1 -1
  11. package/dist/actions/action_dispatcher.js +9 -6
  12. package/dist/actions/action_event.d.ts +1 -2
  13. package/dist/actions/action_event.d.ts.map +1 -1
  14. package/dist/actions/action_event.js +7 -13
  15. package/dist/actions/action_event_helpers.d.ts +1 -40
  16. package/dist/actions/action_event_helpers.d.ts.map +1 -1
  17. package/dist/actions/action_event_helpers.js +1 -25
  18. package/dist/actions/action_rpc.d.ts +10 -215
  19. package/dist/actions/action_rpc.d.ts.map +1 -1
  20. package/dist/actions/action_rpc.js +56 -111
  21. package/dist/actions/action_spec.d.ts +2 -2
  22. package/dist/actions/action_spec.js +2 -2
  23. package/dist/actions/action_types.d.ts +229 -8
  24. package/dist/actions/action_types.d.ts.map +1 -1
  25. package/dist/actions/action_types.js +56 -5
  26. package/dist/actions/broadcast_api.d.ts +22 -17
  27. package/dist/actions/broadcast_api.d.ts.map +1 -1
  28. package/dist/actions/broadcast_api.js +16 -27
  29. package/dist/actions/cancel.d.ts +4 -13
  30. package/dist/actions/cancel.d.ts.map +1 -1
  31. package/dist/actions/cancel.js +5 -17
  32. package/dist/actions/compile_action_registry.d.ts +1 -2
  33. package/dist/actions/compile_action_registry.d.ts.map +1 -1
  34. package/dist/actions/connection_closer.d.ts +120 -50
  35. package/dist/actions/connection_closer.d.ts.map +1 -1
  36. package/dist/actions/connection_closer.js +139 -31
  37. package/dist/actions/{transports_ws_backend.d.ts → connection_registry.d.ts} +120 -132
  38. package/dist/actions/connection_registry.d.ts.map +1 -0
  39. package/dist/actions/{transports_ws_backend.js → connection_registry.js} +149 -152
  40. package/dist/actions/frontend_rpc_client.d.ts +52 -2
  41. package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
  42. package/dist/actions/frontend_rpc_client.js +42 -4
  43. package/dist/actions/peer_ping.d.ts +7 -9
  44. package/dist/actions/peer_ping.d.ts.map +1 -1
  45. package/dist/actions/peer_ping.js +6 -8
  46. package/dist/actions/peer_request.d.ts +6 -5
  47. package/dist/actions/peer_request.d.ts.map +1 -1
  48. package/dist/actions/peer_request.js +6 -5
  49. package/dist/actions/perform_action.d.ts +36 -28
  50. package/dist/actions/perform_action.d.ts.map +1 -1
  51. package/dist/actions/perform_action.js +60 -34
  52. package/dist/actions/protocol.d.ts +14 -0
  53. package/dist/actions/protocol.d.ts.map +1 -1
  54. package/dist/actions/protocol.js +18 -0
  55. package/dist/actions/register_action_ws.d.ts +137 -298
  56. package/dist/actions/register_action_ws.d.ts.map +1 -1
  57. package/dist/actions/register_action_ws.js +155 -923
  58. package/dist/actions/socket.svelte.d.ts +9 -0
  59. package/dist/actions/socket.svelte.d.ts.map +1 -1
  60. package/dist/actions/socket.svelte.js +16 -5
  61. package/dist/actions/transports.d.ts +88 -34
  62. package/dist/actions/transports.d.ts.map +1 -1
  63. package/dist/actions/transports.js +76 -76
  64. package/dist/actions/transports_http.d.ts +48 -12
  65. package/dist/actions/transports_http.d.ts.map +1 -1
  66. package/dist/actions/transports_http.js +75 -44
  67. package/dist/actions/transports_ws.d.ts +29 -0
  68. package/dist/actions/transports_ws.d.ts.map +1 -1
  69. package/dist/actions/transports_ws.js +34 -8
  70. package/dist/actions/ws_endpoint_spec.d.ts +52 -75
  71. package/dist/actions/ws_endpoint_spec.d.ts.map +1 -1
  72. package/dist/actions/ws_endpoint_spec.js +27 -10
  73. package/dist/actions/ws_outbound_writer.d.ts +3 -3
  74. package/dist/actions/ws_outbound_writer.js +3 -3
  75. package/dist/actions/ws_socket_session.d.ts +321 -0
  76. package/dist/actions/ws_socket_session.d.ts.map +1 -0
  77. package/dist/actions/ws_socket_session.js +783 -0
  78. package/dist/auth/CLAUDE.md +70 -44
  79. package/dist/auth/account_action_specs.d.ts +2 -0
  80. package/dist/auth/account_action_specs.d.ts.map +1 -1
  81. package/dist/auth/account_actions.d.ts +1 -1
  82. package/dist/auth/account_actions.d.ts.map +1 -1
  83. package/dist/auth/account_actions.js +9 -3
  84. package/dist/auth/account_queries.d.ts +10 -0
  85. package/dist/auth/account_queries.d.ts.map +1 -1
  86. package/dist/auth/account_queries.js +27 -17
  87. package/dist/auth/account_routes.d.ts +2 -1
  88. package/dist/auth/account_routes.d.ts.map +1 -1
  89. package/dist/auth/account_routes.js +14 -17
  90. package/dist/auth/account_schema.d.ts +5 -5
  91. package/dist/auth/account_schema.d.ts.map +1 -1
  92. package/dist/auth/account_schema.js +5 -2
  93. package/dist/auth/actor_lookup_actions.d.ts +1 -1
  94. package/dist/auth/actor_lookup_actions.d.ts.map +1 -1
  95. package/dist/auth/actor_lookup_actions.js +1 -1
  96. package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
  97. package/dist/auth/actor_search_action_specs.js +2 -1
  98. package/dist/auth/actor_search_actions.d.ts +1 -1
  99. package/dist/auth/actor_search_actions.d.ts.map +1 -1
  100. package/dist/auth/actor_search_actions.js +1 -1
  101. package/dist/auth/actor_search_queries.d.ts +5 -5
  102. package/dist/auth/actor_search_queries.d.ts.map +1 -1
  103. package/dist/auth/actor_search_queries.js +7 -7
  104. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  105. package/dist/auth/admin_action_specs.js +3 -1
  106. package/dist/auth/admin_actions.d.ts +1 -1
  107. package/dist/auth/admin_actions.d.ts.map +1 -1
  108. package/dist/auth/admin_actions.js +12 -42
  109. package/dist/auth/all_cell_actions.d.ts +6 -4
  110. package/dist/auth/all_cell_actions.d.ts.map +1 -1
  111. package/dist/auth/all_cell_actions.js +1 -1
  112. package/dist/auth/api_token_queries.d.ts +1 -0
  113. package/dist/auth/api_token_queries.d.ts.map +1 -1
  114. package/dist/auth/api_token_queries.js +1 -0
  115. package/dist/auth/audit_emitter.d.ts +3 -3
  116. package/dist/auth/audit_emitter.js +2 -2
  117. package/dist/auth/audit_log_route_schema.d.ts.map +1 -1
  118. package/dist/auth/audit_log_route_schema.js +3 -2
  119. package/dist/auth/audit_log_routes.d.ts +20 -11
  120. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  121. package/dist/auth/audit_log_routes.js +49 -29
  122. package/dist/auth/audit_log_schema.d.ts +13 -21
  123. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  124. package/dist/auth/audit_log_schema.js +10 -18
  125. package/dist/auth/bearer_auth.d.ts +7 -4
  126. package/dist/auth/bearer_auth.d.ts.map +1 -1
  127. package/dist/auth/bearer_auth.js +21 -15
  128. package/dist/auth/cell_action_helpers.d.ts +89 -0
  129. package/dist/auth/cell_action_helpers.d.ts.map +1 -0
  130. package/dist/auth/cell_action_helpers.js +113 -0
  131. package/dist/auth/cell_actions.d.ts +22 -13
  132. package/dist/auth/cell_actions.d.ts.map +1 -1
  133. package/dist/auth/cell_actions.js +105 -167
  134. package/dist/auth/cell_audit_actions.d.ts +1 -1
  135. package/dist/auth/cell_audit_actions.d.ts.map +1 -1
  136. package/dist/auth/cell_audit_actions.js +3 -12
  137. package/dist/auth/cell_audit_metadata.d.ts +1 -1
  138. package/dist/auth/cell_audit_metadata.js +1 -1
  139. package/dist/auth/cell_field_actions.d.ts +1 -1
  140. package/dist/auth/cell_field_actions.d.ts.map +1 -1
  141. package/dist/auth/cell_field_actions.js +16 -66
  142. package/dist/auth/cell_grant_action_specs.d.ts +2 -2
  143. package/dist/auth/cell_grant_action_specs.js +3 -3
  144. package/dist/auth/cell_grant_actions.d.ts +73 -11
  145. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  146. package/dist/auth/cell_grant_actions.js +63 -55
  147. package/dist/auth/cell_grant_audit_metadata.d.ts +6 -3
  148. package/dist/auth/cell_grant_audit_metadata.d.ts.map +1 -1
  149. package/dist/auth/cell_grant_audit_metadata.js +7 -4
  150. package/dist/auth/cell_item_actions.d.ts +1 -1
  151. package/dist/auth/cell_item_actions.d.ts.map +1 -1
  152. package/dist/auth/cell_item_actions.js +21 -82
  153. package/dist/auth/cleanup.d.ts +1 -1
  154. package/dist/auth/cleanup.d.ts.map +1 -1
  155. package/dist/auth/cleanup.js +6 -3
  156. package/dist/auth/credential_deadline.d.ts +3 -3
  157. package/dist/auth/credential_deadline.js +3 -3
  158. package/dist/auth/credential_type_schema.d.ts +5 -5
  159. package/dist/auth/credential_type_schema.js +5 -5
  160. package/dist/auth/daemon_token_middleware.d.ts +12 -6
  161. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  162. package/dist/auth/daemon_token_middleware.js +28 -17
  163. package/dist/auth/deps.d.ts +4 -4
  164. package/dist/auth/fail_floor.d.ts +55 -0
  165. package/dist/auth/fail_floor.d.ts.map +1 -0
  166. package/dist/auth/fail_floor.js +63 -0
  167. package/dist/auth/invite_queries.d.ts +3 -15
  168. package/dist/auth/invite_queries.d.ts.map +1 -1
  169. package/dist/auth/invite_queries.js +3 -21
  170. package/dist/auth/middleware.d.ts +12 -7
  171. package/dist/auth/middleware.d.ts.map +1 -1
  172. package/dist/auth/middleware.js +42 -29
  173. package/dist/auth/migrations.d.ts +5 -33
  174. package/dist/auth/migrations.d.ts.map +1 -1
  175. package/dist/auth/migrations.js +9 -16
  176. package/dist/auth/request_context.d.ts +101 -71
  177. package/dist/auth/request_context.d.ts.map +1 -1
  178. package/dist/auth/request_context.js +137 -140
  179. package/dist/auth/resolved_auth.d.ts +122 -36
  180. package/dist/auth/resolved_auth.d.ts.map +1 -1
  181. package/dist/auth/resolved_auth.js +89 -38
  182. package/dist/auth/role_grant_offer_action_specs.d.ts +99 -14
  183. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  184. package/dist/auth/role_grant_offer_action_specs.js +26 -13
  185. package/dist/auth/role_grant_offer_actions.d.ts +13 -7
  186. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  187. package/dist/auth/role_grant_offer_actions.js +14 -12
  188. package/dist/auth/role_grant_offer_notifications.d.ts +3 -3
  189. package/dist/auth/role_grant_offer_notifications.js +1 -1
  190. package/dist/auth/role_grant_offer_queries.d.ts +0 -5
  191. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  192. package/dist/auth/role_grant_offer_queries.js +9 -41
  193. package/dist/auth/role_grant_queries.d.ts +17 -67
  194. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  195. package/dist/auth/role_grant_queries.js +34 -106
  196. package/dist/auth/role_grant_sql.d.ts +42 -0
  197. package/dist/auth/role_grant_sql.d.ts.map +1 -0
  198. package/dist/auth/role_grant_sql.js +54 -0
  199. package/dist/auth/scope_kind_schema.d.ts +1 -1
  200. package/dist/auth/scope_kind_schema.js +1 -1
  201. package/dist/auth/self_service_role_actions.d.ts +1 -1
  202. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  203. package/dist/auth/self_service_role_actions.js +1 -1
  204. package/dist/auth/session_queries.d.ts +2 -1
  205. package/dist/auth/session_queries.d.ts.map +1 -1
  206. package/dist/auth/session_queries.js +2 -1
  207. package/dist/auth/signup_routes.d.ts +2 -1
  208. package/dist/auth/signup_routes.d.ts.map +1 -1
  209. package/dist/auth/signup_routes.js +14 -13
  210. package/dist/auth/standard_rpc_actions.d.ts +1 -1
  211. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  212. package/dist/auth/token_scope.d.ts +19 -46
  213. package/dist/auth/token_scope.d.ts.map +1 -1
  214. package/dist/auth/token_scope.js +23 -41
  215. package/dist/db/CLAUDE.md +9 -4
  216. package/dist/db/cell_ddl.d.ts +5 -142
  217. package/dist/db/cell_ddl.d.ts.map +1 -1
  218. package/dist/db/cell_ddl.js +17 -16
  219. package/dist/db/cell_field_queries.d.ts +0 -13
  220. package/dist/db/cell_field_queries.d.ts.map +1 -1
  221. package/dist/db/cell_field_queries.js +0 -16
  222. package/dist/db/cell_grant_queries.d.ts +10 -5
  223. package/dist/db/cell_grant_queries.d.ts.map +1 -1
  224. package/dist/db/cell_grant_queries.js +13 -7
  225. package/dist/db/cell_item_queries.d.ts +0 -7
  226. package/dist/db/cell_item_queries.d.ts.map +1 -1
  227. package/dist/db/cell_item_queries.js +0 -10
  228. package/dist/db/cell_queries.d.ts +12 -48
  229. package/dist/db/cell_queries.d.ts.map +1 -1
  230. package/dist/db/cell_queries.js +24 -55
  231. package/dist/db/cell_view_sql.d.ts +1 -6
  232. package/dist/db/cell_view_sql.d.ts.map +1 -1
  233. package/dist/db/cell_view_sql.js +1 -2
  234. package/dist/db/fact_ddl.d.ts +5 -30
  235. package/dist/db/fact_ddl.d.ts.map +1 -1
  236. package/dist/db/fact_ddl.js +14 -13
  237. package/dist/db/fact_store.d.ts +11 -0
  238. package/dist/db/fact_store.d.ts.map +1 -1
  239. package/dist/db/fact_store.js +4 -1
  240. package/dist/db/migrate.d.ts +44 -6
  241. package/dist/db/migrate.d.ts.map +1 -1
  242. package/dist/db/migrate.js +63 -4
  243. package/dist/dev/setup.d.ts +18 -14
  244. package/dist/dev/setup.d.ts.map +1 -1
  245. package/dist/dev/setup.js +42 -39
  246. package/dist/env/dotenv.d.ts +2 -2
  247. package/dist/env/dotenv.js +2 -2
  248. package/dist/env/update_env_variable.d.ts +33 -21
  249. package/dist/env/update_env_variable.d.ts.map +1 -1
  250. package/dist/env/update_env_variable.js +54 -35
  251. package/dist/hono_context.d.ts +15 -90
  252. package/dist/hono_context.d.ts.map +1 -1
  253. package/dist/hono_context.js +9 -56
  254. package/dist/http/CLAUDE.md +35 -20
  255. package/dist/http/auth_shape.d.ts +1 -8
  256. package/dist/http/auth_shape.d.ts.map +1 -1
  257. package/dist/http/auth_shape.js +6 -12
  258. package/dist/http/common_routes.d.ts.map +1 -1
  259. package/dist/http/common_routes.js +3 -2
  260. package/dist/http/db_routes.d.ts +3 -3
  261. package/dist/http/db_routes.js +3 -3
  262. package/dist/http/error_schemas.d.ts +1 -2
  263. package/dist/http/error_schemas.d.ts.map +1 -1
  264. package/dist/http/error_schemas.js +1 -2
  265. package/dist/http/health_schema.d.ts +16 -0
  266. package/dist/http/health_schema.d.ts.map +1 -0
  267. package/dist/http/health_schema.js +12 -0
  268. package/dist/http/jsonrpc_errors.d.ts +22 -2
  269. package/dist/http/jsonrpc_errors.d.ts.map +1 -1
  270. package/dist/http/jsonrpc_errors.js +41 -3
  271. package/dist/http/jsonrpc_helpers.d.ts +60 -17
  272. package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
  273. package/dist/http/jsonrpc_helpers.js +67 -25
  274. package/dist/http/origin.d.ts +30 -1
  275. package/dist/http/origin.d.ts.map +1 -1
  276. package/dist/http/origin.js +46 -9
  277. package/dist/http/origin_wildcard.d.ts +97 -0
  278. package/dist/http/origin_wildcard.d.ts.map +1 -0
  279. package/dist/http/origin_wildcard.js +142 -0
  280. package/dist/http/pending_effects.d.ts +28 -0
  281. package/dist/http/pending_effects.d.ts.map +1 -1
  282. package/dist/http/pending_effects.js +32 -1
  283. package/dist/http/route_spec.d.ts +4 -3
  284. package/dist/http/route_spec.d.ts.map +1 -1
  285. package/dist/http/route_spec.js +54 -45
  286. package/dist/http/surface.d.ts +1 -1
  287. package/dist/http/surface.d.ts.map +1 -1
  288. package/dist/http/surface_query.d.ts +9 -50
  289. package/dist/http/surface_query.d.ts.map +1 -1
  290. package/dist/http/surface_query.js +48 -94
  291. package/dist/realtime/audit_log_sse.d.ts +180 -0
  292. package/dist/realtime/audit_log_sse.d.ts.map +1 -0
  293. package/dist/realtime/audit_log_sse.js +154 -0
  294. package/dist/realtime/sse.d.ts +21 -6
  295. package/dist/realtime/sse.d.ts.map +1 -1
  296. package/dist/realtime/sse.js +33 -10
  297. package/dist/realtime/sse_constants.d.ts +29 -2
  298. package/dist/realtime/sse_constants.d.ts.map +1 -1
  299. package/dist/realtime/sse_constants.js +35 -2
  300. package/dist/realtime/{subscriber_registry.d.ts → sse_registry.d.ts} +12 -12
  301. package/dist/realtime/sse_registry.d.ts.map +1 -0
  302. package/dist/realtime/{subscriber_registry.js → sse_registry.js} +4 -4
  303. package/dist/schema_meta.d.ts +30 -10
  304. package/dist/schema_meta.d.ts.map +1 -1
  305. package/dist/schema_meta.js +85 -21
  306. package/dist/sensitivity.d.ts +9 -3
  307. package/dist/sensitivity.d.ts.map +1 -1
  308. package/dist/sensitivity.js +3 -2
  309. package/dist/server/app_backend.d.ts +8 -5
  310. package/dist/server/app_backend.d.ts.map +1 -1
  311. package/dist/server/app_backend.js +6 -12
  312. package/dist/server/app_server.d.ts +62 -51
  313. package/dist/server/app_server.d.ts.map +1 -1
  314. package/dist/server/app_server.js +84 -71
  315. package/dist/server/app_server_context.d.ts +1 -1
  316. package/dist/server/app_server_context.d.ts.map +1 -1
  317. package/dist/server/env.d.ts +24 -20
  318. package/dist/server/env.d.ts.map +1 -1
  319. package/dist/server/env.js +24 -34
  320. package/dist/server/serve_fact_route.d.ts +12 -16
  321. package/dist/server/serve_fact_route.d.ts.map +1 -1
  322. package/dist/server/serve_fact_route.js +59 -34
  323. package/dist/server/static.d.ts.map +1 -1
  324. package/dist/server/static.js +2 -2
  325. package/dist/testing/CLAUDE.md +179 -158
  326. package/dist/testing/admin_integration.d.ts.map +1 -1
  327. package/dist/testing/admin_integration.js +10 -19
  328. package/dist/testing/adversarial_headers.d.ts.map +1 -1
  329. package/dist/testing/adversarial_headers.js +8 -0
  330. package/dist/testing/app_server.d.ts +9 -77
  331. package/dist/testing/app_server.d.ts.map +1 -1
  332. package/dist/testing/app_server.js +31 -112
  333. package/dist/testing/attack_surface.d.ts.map +1 -1
  334. package/dist/testing/attack_surface.js +3 -4
  335. package/dist/testing/audit_completeness.d.ts.map +1 -1
  336. package/dist/testing/audit_completeness.js +4 -5
  337. package/dist/testing/auth_apps.d.ts +3 -3
  338. package/dist/testing/auth_apps.d.ts.map +1 -1
  339. package/dist/testing/auth_apps.js +9 -6
  340. package/dist/testing/connection_closer_helpers.d.ts +8 -16
  341. package/dist/testing/connection_closer_helpers.d.ts.map +1 -1
  342. package/dist/testing/connection_closer_helpers.js +7 -20
  343. package/dist/testing/cross_backend/action_manifest.d.ts +15 -4
  344. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  345. package/dist/testing/cross_backend/action_manifest.js +13 -3
  346. package/dist/testing/cross_backend/action_manifest_parity.d.ts +15 -7
  347. package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
  348. package/dist/testing/cross_backend/action_manifest_parity.js +8 -1
  349. package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
  350. package/dist/testing/cross_backend/body_size.js +25 -22
  351. package/dist/testing/cross_backend/build_test_backend_paths.d.ts +22 -3
  352. package/dist/testing/cross_backend/build_test_backend_paths.d.ts.map +1 -1
  353. package/dist/testing/cross_backend/build_test_backend_paths.js +34 -11
  354. package/dist/testing/cross_backend/capabilities.d.ts +13 -7
  355. package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
  356. package/dist/testing/cross_backend/cell_grant_role.js +2 -2
  357. package/dist/testing/cross_backend/cell_grant_steward.d.ts +4 -0
  358. package/dist/testing/cross_backend/cell_grant_steward.d.ts.map +1 -0
  359. package/dist/testing/cross_backend/cell_grant_steward.js +120 -0
  360. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  361. package/dist/testing/cross_backend/cell_relations.js +21 -0
  362. package/dist/testing/cross_backend/conformance_table.d.ts +1 -1
  363. package/dist/testing/cross_backend/conformance_table.d.ts.map +1 -1
  364. package/dist/testing/cross_backend/default_backend_configs.d.ts +18 -4
  365. package/dist/testing/cross_backend/default_backend_configs.d.ts.map +1 -1
  366. package/dist/testing/cross_backend/default_backend_configs.js +29 -9
  367. package/dist/testing/cross_backend/default_spine_surface.d.ts +7 -7
  368. package/dist/testing/cross_backend/default_spine_surface.js +2 -2
  369. package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
  370. package/dist/testing/cross_backend/fact_serving.js +48 -0
  371. package/dist/testing/cross_backend/full_spine_mount.d.ts +3 -4
  372. package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
  373. package/dist/testing/cross_backend/full_spine_mount.js +9 -2
  374. package/dist/testing/cross_backend/origin_scope.d.ts.map +1 -1
  375. package/dist/testing/cross_backend/origin_scope.js +5 -13
  376. package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
  377. package/dist/testing/cross_backend/peer_ping_ws.js +29 -4
  378. package/dist/testing/cross_backend/postgres_database.d.ts +32 -0
  379. package/dist/testing/cross_backend/postgres_database.d.ts.map +1 -1
  380. package/dist/testing/cross_backend/postgres_database.js +56 -1
  381. package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
  382. package/dist/testing/cross_backend/query_shape.js +18 -1
  383. package/dist/testing/cross_backend/role_grant_offer_lifecycle.d.ts.map +1 -1
  384. package/dist/testing/cross_backend/role_grant_offer_lifecycle.js +23 -1
  385. package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -2
  386. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +1 -1
  387. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  388. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts +17 -5
  389. package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
  390. package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +5 -4
  391. package/dist/testing/cross_backend/session_cap.d.ts +8 -0
  392. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  393. package/dist/testing/cross_backend/session_cap.js +66 -2
  394. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  395. package/dist/testing/cross_backend/setup.js +5 -4
  396. package/dist/testing/cross_backend/spine_suites.d.ts +4 -1
  397. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  398. package/dist/testing/cross_backend/spine_suites.js +21 -0
  399. package/dist/testing/cross_backend/spine_surface_constants.d.ts +22 -7
  400. package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
  401. package/dist/testing/cross_backend/spine_surface_constants.js +22 -7
  402. package/dist/testing/cross_backend/sse_round_trip.d.ts.map +1 -1
  403. package/dist/testing/cross_backend/sse_round_trip.js +4 -3
  404. package/dist/testing/cross_backend/standard.d.ts +6 -12
  405. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  406. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts +8 -0
  407. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.d.ts.map +1 -0
  408. package/dist/testing/cross_backend/test_cell_grant_steward_revoke_authorize.js +22 -0
  409. package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
  410. package/dist/testing/cross_backend/testing_backdoor.js +4 -6
  411. package/dist/testing/cross_backend/testing_origin_check.d.ts +1 -1
  412. package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
  413. package/dist/testing/cross_backend/testing_origin_check.js +1 -1
  414. package/dist/testing/cross_backend/testing_reset_actions.d.ts +10 -5
  415. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  416. package/dist/testing/cross_backend/testing_reset_actions.js +7 -6
  417. package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
  418. package/dist/testing/cross_backend/testing_server_bun.js +5 -4
  419. package/dist/testing/cross_backend/testing_server_core.d.ts +6 -7
  420. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  421. package/dist/testing/cross_backend/testing_server_core.js +1 -1
  422. package/dist/testing/cross_backend/testing_server_node.d.ts.map +1 -1
  423. package/dist/testing/cross_backend/testing_server_node.js +13 -2
  424. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  425. package/dist/testing/cross_backend/token_lifetime.js +68 -0
  426. package/dist/testing/cross_backend/transport_composition.d.ts +1 -1
  427. package/dist/testing/cross_backend/transport_composition.d.ts.map +1 -1
  428. package/dist/testing/cross_backend/transport_composition.js +45 -3
  429. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +16 -2
  430. package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
  431. package/dist/testing/cross_backend/ts_spine_backend_config.js +11 -8
  432. package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
  433. package/dist/testing/cross_backend/ws_action_rate_limit.js +30 -12
  434. package/dist/testing/cross_backend/ws_connection_cap.d.ts.map +1 -1
  435. package/dist/testing/cross_backend/ws_connection_cap.js +5 -7
  436. package/dist/testing/cross_backend/ws_endpoint.d.ts +2 -3
  437. package/dist/testing/cross_backend/ws_endpoint.d.ts.map +1 -1
  438. package/dist/testing/cross_backend/ws_envelope.d.ts +17 -0
  439. package/dist/testing/cross_backend/ws_envelope.d.ts.map +1 -0
  440. package/dist/testing/cross_backend/ws_envelope.js +172 -0
  441. package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts +16 -0
  442. package/dist/testing/cross_backend/ws_inbound_dispatch.d.ts.map +1 -1
  443. package/dist/testing/cross_backend/ws_inbound_dispatch.js +8 -4
  444. package/dist/testing/cross_backend/ws_outbound_overflow.d.ts.map +1 -1
  445. package/dist/testing/cross_backend/ws_outbound_overflow.js +5 -8
  446. package/dist/testing/cross_backend/ws_role_gated.js +2 -2
  447. package/dist/testing/cross_backend/ws_round_trip.d.ts.map +1 -1
  448. package/dist/testing/cross_backend/ws_round_trip.js +6 -4
  449. package/dist/{cli/daemon.d.ts → testing/daemon_info.d.ts} +15 -47
  450. package/dist/testing/daemon_info.d.ts.map +1 -0
  451. package/dist/testing/daemon_info.js +108 -0
  452. package/dist/testing/daemon_token_rotation.js +1 -1
  453. package/dist/testing/data_exposure.d.ts.map +1 -1
  454. package/dist/testing/data_exposure.js +3 -4
  455. package/dist/testing/db.js +2 -2
  456. package/dist/testing/integration.d.ts.map +1 -1
  457. package/dist/testing/integration.js +35 -65
  458. package/dist/testing/integration_helpers.d.ts +0 -15
  459. package/dist/testing/integration_helpers.d.ts.map +1 -1
  460. package/dist/testing/integration_helpers.js +2 -42
  461. package/dist/testing/middleware.d.ts +20 -12
  462. package/dist/testing/middleware.d.ts.map +1 -1
  463. package/dist/testing/middleware.js +49 -40
  464. package/dist/testing/rate_limiting.d.ts.map +1 -1
  465. package/dist/testing/rate_limiting.js +13 -22
  466. package/dist/testing/resolved_auth.d.ts +30 -0
  467. package/dist/testing/resolved_auth.d.ts.map +1 -0
  468. package/dist/testing/resolved_auth.js +41 -0
  469. package/dist/testing/rpc_envelope_cases.d.ts.map +1 -1
  470. package/dist/testing/rpc_envelope_cases.js +3 -0
  471. package/dist/testing/rpc_helpers.d.ts +1 -1
  472. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  473. package/dist/testing/rpc_helpers.js +2 -1
  474. package/dist/testing/sse_round_trip.d.ts +5 -4
  475. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  476. package/dist/testing/sse_round_trip.js +2 -2
  477. package/dist/testing/stubs.d.ts +2 -2
  478. package/dist/testing/stubs.d.ts.map +1 -1
  479. package/dist/testing/stubs.js +24 -21
  480. package/dist/testing/test_origin.d.ts +25 -0
  481. package/dist/testing/test_origin.d.ts.map +1 -0
  482. package/dist/testing/test_origin.js +28 -0
  483. package/dist/testing/transports/raw_http.d.ts +54 -0
  484. package/dist/testing/transports/raw_http.d.ts.map +1 -1
  485. package/dist/testing/transports/raw_http.js +58 -0
  486. package/dist/testing/transports/ws_raw_client.d.ts +8 -0
  487. package/dist/testing/transports/ws_raw_client.d.ts.map +1 -1
  488. package/dist/testing/transports/ws_raw_client.js +13 -0
  489. package/dist/testing/transports/ws_transport.d.ts +15 -2
  490. package/dist/testing/transports/ws_transport.d.ts.map +1 -1
  491. package/dist/testing/transports/ws_transport.js +4 -2
  492. package/dist/testing/ws_round_trip.d.ts +27 -25
  493. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  494. package/dist/testing/ws_round_trip.js +34 -26
  495. package/dist/ui/AccountSessions.svelte +48 -19
  496. package/dist/ui/AccountSessions.svelte.d.ts +2 -17
  497. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
  498. package/dist/ui/AdminAccounts.svelte +6 -1
  499. package/dist/ui/AdminAuditLog.svelte +61 -22
  500. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
  501. package/dist/ui/AdminInvites.svelte +1 -1
  502. package/dist/ui/AdminOverview.svelte +76 -37
  503. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  504. package/dist/ui/AdminRoleGrantHistory.svelte +6 -1
  505. package/dist/ui/AdminSessions.svelte +1 -1
  506. package/dist/ui/AppShell.svelte +3 -2
  507. package/dist/ui/AppShell.svelte.d.ts +3 -2
  508. package/dist/ui/AppShell.svelte.d.ts.map +1 -1
  509. package/dist/ui/CLAUDE.md +121 -35
  510. package/dist/ui/Datatable.svelte +33 -18
  511. package/dist/ui/Datatable.svelte.d.ts +2 -14
  512. package/dist/ui/Datatable.svelte.d.ts.map +1 -1
  513. package/dist/ui/OpenSignupToggle.svelte +10 -1
  514. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
  515. package/dist/ui/PopoverButton.svelte +13 -8
  516. package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
  517. package/dist/ui/RoleGrantOfferForm.svelte +3 -2
  518. package/dist/ui/RoleGrantOfferForm.svelte.d.ts +3 -2
  519. package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
  520. package/dist/ui/RoleGrantOfferHistory.svelte +3 -3
  521. package/dist/ui/RoleGrantOfferInbox.svelte +19 -15
  522. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
  523. package/dist/ui/SurfaceExplorer.svelte +66 -27
  524. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  525. package/dist/ui/account_sessions_state.svelte.d.ts +7 -14
  526. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
  527. package/dist/ui/admin_accounts_state.svelte.d.ts +14 -9
  528. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  529. package/dist/ui/admin_accounts_state.svelte.js +6 -4
  530. package/dist/ui/admin_invites_state.svelte.d.ts +2 -2
  531. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
  532. package/dist/ui/admin_rpc_adapters.d.ts +9 -9
  533. package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
  534. package/dist/ui/admin_rpc_adapters.js +9 -9
  535. package/dist/ui/app_settings_state.svelte.d.ts +2 -2
  536. package/dist/ui/app_settings_state.svelte.d.ts.map +1 -1
  537. package/dist/ui/audit_log_state.svelte.d.ts +70 -13
  538. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  539. package/dist/ui/audit_log_state.svelte.js +239 -47
  540. package/dist/ui/backend_probe.svelte.d.ts +93 -0
  541. package/dist/ui/backend_probe.svelte.d.ts.map +1 -0
  542. package/dist/ui/backend_probe.svelte.js +140 -0
  543. package/dist/ui/format_scope.d.ts +7 -7
  544. package/dist/ui/format_scope.d.ts.map +1 -1
  545. package/dist/ui/format_scope.js +4 -4
  546. package/dist/ui/keyed_async_slot.svelte.d.ts +2 -2
  547. package/dist/ui/keyed_async_slot.svelte.js +2 -2
  548. package/dist/ui/popover.svelte.d.ts +18 -19
  549. package/dist/ui/popover.svelte.d.ts.map +1 -1
  550. package/dist/ui/popover.svelte.js +103 -16
  551. package/dist/ui/role_grant_offers_state.svelte.d.ts +41 -46
  552. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
  553. package/dist/ui/role_grant_offers_state.svelte.js +37 -19
  554. package/dist/ui/ui_format.d.ts +17 -0
  555. package/dist/ui/ui_format.d.ts.map +1 -1
  556. package/dist/ui/ui_format.js +20 -0
  557. package/package.json +9 -8
  558. package/dist/actions/register_ws_endpoint.d.ts +0 -79
  559. package/dist/actions/register_ws_endpoint.d.ts.map +0 -1
  560. package/dist/actions/register_ws_endpoint.js +0 -109
  561. package/dist/actions/transports_ws_auth_guard.d.ts +0 -96
  562. package/dist/actions/transports_ws_auth_guard.d.ts.map +0 -1
  563. package/dist/actions/transports_ws_auth_guard.js +0 -141
  564. package/dist/actions/transports_ws_backend.d.ts.map +0 -1
  565. package/dist/cli/args.d.ts +0 -55
  566. package/dist/cli/args.d.ts.map +0 -1
  567. package/dist/cli/args.js +0 -100
  568. package/dist/cli/config.d.ts +0 -47
  569. package/dist/cli/config.d.ts.map +0 -1
  570. package/dist/cli/config.js +0 -77
  571. package/dist/cli/daemon.d.ts.map +0 -1
  572. package/dist/cli/daemon.js +0 -181
  573. package/dist/cli/help.d.ts +0 -124
  574. package/dist/cli/help.d.ts.map +0 -1
  575. package/dist/cli/help.js +0 -215
  576. package/dist/cli/logger.d.ts +0 -46
  577. package/dist/cli/logger.d.ts.map +0 -1
  578. package/dist/cli/logger.js +0 -48
  579. package/dist/cli/util.d.ts +0 -36
  580. package/dist/cli/util.d.ts.map +0 -1
  581. package/dist/cli/util.js +0 -50
  582. package/dist/realtime/sse_auth_guard.d.ts +0 -197
  583. package/dist/realtime/sse_auth_guard.d.ts.map +0 -1
  584. package/dist/realtime/sse_auth_guard.js +0 -239
  585. package/dist/realtime/subscriber_registry.d.ts.map +0 -1
  586. package/dist/testing/bootstrap_success.d.ts +0 -29
  587. package/dist/testing/bootstrap_success.d.ts.map +0 -1
  588. package/dist/testing/bootstrap_success.js +0 -144
  589. package/dist/testing/mock_fs.d.ts +0 -20
  590. package/dist/testing/mock_fs.d.ts.map +0 -1
  591. package/dist/testing/mock_fs.js +0 -28
  592. package/dist/testing/standard.d.ts +0 -122
  593. package/dist/testing/standard.d.ts.map +0 -1
  594. package/dist/testing/standard.js +0 -73
  595. package/dist/testing/testing_rate_limiter.d.ts +0 -65
  596. package/dist/testing/testing_rate_limiter.d.ts.map +0 -1
  597. package/dist/testing/testing_rate_limiter.js +0 -80
@@ -2,7 +2,7 @@
2
2
  * Shared `format_scope` callback contract for role-grant-display components.
3
3
  *
4
4
  * Role grants and offers carry a `scope_id` that names a consumer-owned resource
5
- * (e.g. a classroom uuid). The default render is the raw uuid. Consumers wire
5
+ * (e.g. a classroom uuid). The default render is the truncated uuid. Consumers wire
6
6
  * a `FormatScope` via context to render a human label without per-page
7
7
  * lookup or forking the components.
8
8
  *
@@ -10,17 +10,17 @@
10
10
  */
11
11
  import { create_context } from '@fuzdev/fuz_ui/context_helpers.ts';
12
12
  import { truncate_uuid } from './ui_format.js';
13
- /** Default `FormatScope` — always returns `null` so callers fall back to the raw uuid. */
13
+ /** Default `FormatScope` — always returns `null` so callers fall back to the truncated uuid. */
14
14
  export const default_format_scope = () => null;
15
15
  /**
16
16
  * Svelte context carrying a getter for the consumer's `FormatScope`.
17
17
  * Provisioned by `provide_admin_rpc_contexts` from its `format_scope` option.
18
18
  * Default getter returns `default_format_scope` so unprovisioned trees render
19
- * the raw uuid.
19
+ * the truncated uuid.
20
20
  */
21
21
  export const format_scope_context = create_context(() => () => default_format_scope);
22
22
  /**
23
- * Resolve a scope label across the context → raw-uuid fallback chain.
23
+ * Resolve a scope label across the context → truncated-uuid fallback chain.
24
24
  *
25
25
  * `global_label` is returned for `scope_id === null`. Callers pass `null`
26
26
  * to render no chip (admin tables — global is the implicit default) or
@@ -27,8 +27,8 @@
27
27
  * readonly remove = new KeyedAsyncSlot<Uuid>();
28
28
  *
29
29
  * async submit_delete(id: Uuid): Promise<void> {
30
- * const ok = await this.remove.run(id, () => this.#rpc().delete({invite_id: id}));
31
- * if (ok !== undefined) await this.fetch();
30
+ * await this.remove.run(id, () => this.#rpc().delete({invite_id: id}));
31
+ * if (this.remove.succeeded(id)) await this.fetch();
32
32
  * }
33
33
  * }
34
34
  *
@@ -27,8 +27,8 @@
27
27
  * readonly remove = new KeyedAsyncSlot<Uuid>();
28
28
  *
29
29
  * async submit_delete(id: Uuid): Promise<void> {
30
- * const ok = await this.remove.run(id, () => this.#rpc().delete({invite_id: id}));
31
- * if (ok !== undefined) await this.fetch();
30
+ * await this.remove.run(id, () => this.#rpc().delete({invite_id: id}));
31
+ * if (this.remove.succeeded(id)) await this.fetch();
32
32
  * }
33
33
  * }
34
34
  *
@@ -1,10 +1,24 @@
1
1
  /**
2
2
  * Popover state class with trigger, content, and container attachments.
3
3
  *
4
- * `Popover` manages visibility, positioning, outside-click dismissal,
5
- * and ARIA attributes. The `trigger`, `content`, and `container`
4
+ * `Popover` manages visibility, positioning, outside-click and Escape
5
+ * dismissal, and ARIA attributes. The `trigger`, `content`, and `container`
6
6
  * attachments wire up the DOM via Svelte's `{@attach}` directive.
7
7
  *
8
+ * While visible, the trigger carries `aria-expanded="true"` and
9
+ * `aria-controls` naming the content (cleared on hide, when the content
10
+ * usually leaves the DOM), and the content — `role="dialog"` unless it sets
11
+ * its own role — is `aria-labelledby` the trigger unless it carries its own
12
+ * name. Escape hides the popover while it's visible, returning focus to the
13
+ * trigger when focus was inside the content. The listener is on `document`,
14
+ * so it runs before `window` listeners, and it prevents the default — so an
15
+ * enclosing layer that skips handled Escapes, like `AppShell`'s narrow
16
+ * overlay, stays open, and only the popover closes. An Escape another
17
+ * listener already prevented is left alone. With several popovers visible,
18
+ * only the newest handles Escape, so nested ones close innermost first. While
19
+ * a modal (`:modal`) is open, a popover outside it leaves Escape to the modal;
20
+ * a popover inside the modal still closes first.
21
+ *
8
22
  * For the common button + popover pattern, see `PopoverButton`.
9
23
  *
10
24
  * @example
@@ -47,8 +61,6 @@
47
61
  * @module
48
62
  */
49
63
  import type { Attachment } from 'svelte/attachments';
50
- import type { Snippet } from 'svelte';
51
- import type { TransitionConfig } from 'svelte/transition';
52
64
  import { type Position, type Alignment } from './position_helpers.js';
53
65
  /**
54
66
  * Parameters for configuring the popover.
@@ -70,20 +82,7 @@ export interface PopoverParameters {
70
82
  onhide?: () => void;
71
83
  }
72
84
  /**
73
- * Parameters for the popover trigger action.
74
- */
75
- export interface PopoverTriggerParameters extends PopoverParameters {
76
- /** Content to render in the popover (as a snippet). */
77
- content?: Snippet;
78
- }
79
- /**
80
- * Support both Svelte transitions and custom transitions.
81
- */
82
- export type TransitionFunction = (node: HTMLElement) => TransitionConfig | {
83
- destroy?: () => void;
84
- };
85
- /**
86
- * Parameters for the popover content action.
85
+ * Parameters for the popover content attachment.
87
86
  */
88
87
  export interface PopoverContentParameters extends PopoverParameters {
89
88
  }
@@ -141,7 +140,7 @@ export declare class Popover {
141
140
  /**
142
141
  * Attachment factory for the trigger element that shows/hides the popover.
143
142
  */
144
- trigger: (params?: PopoverTriggerParameters) => Attachment<HTMLElement>;
143
+ trigger: (params?: PopoverParameters) => Attachment<HTMLElement>;
145
144
  /**
146
145
  * Attachment factory for the popover content element.
147
146
  */
@@ -1 +1 @@
1
- {"version":3,"file":"popover.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/popover.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAA4B,MAAM,uBAAuB,CAAC;AAShG;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,yCAAyC;IACzC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,I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H,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAQhC;IAEF;;OAEG;IACH,OAAO,GAAI,SAAS,iBAAiB,KAAG,UAAU,CAAC,WAAW,CAAC,CAuB7D;IAEF;;OAEG;IACH,OAAO,GAAI,SAAS,wBAAwB,KAAG,UAAU,CAAC,WAAW,CAAC,CAoEpE;CACF"}
@@ -1,10 +1,24 @@
1
1
  /**
2
2
  * Popover state class with trigger, content, and container attachments.
3
3
  *
4
- * `Popover` manages visibility, positioning, outside-click dismissal,
5
- * and ARIA attributes. The `trigger`, `content`, and `container`
4
+ * `Popover` manages visibility, positioning, outside-click and Escape
5
+ * dismissal, and ARIA attributes. The `trigger`, `content`, and `container`
6
6
  * attachments wire up the DOM via Svelte's `{@attach}` directive.
7
7
  *
8
+ * While visible, the trigger carries `aria-expanded="true"` and
9
+ * `aria-controls` naming the content (cleared on hide, when the content
10
+ * usually leaves the DOM), and the content — `role="dialog"` unless it sets
11
+ * its own role — is `aria-labelledby` the trigger unless it carries its own
12
+ * name. Escape hides the popover while it's visible, returning focus to the
13
+ * trigger when focus was inside the content. The listener is on `document`,
14
+ * so it runs before `window` listeners, and it prevents the default — so an
15
+ * enclosing layer that skips handled Escapes, like `AppShell`'s narrow
16
+ * overlay, stays open, and only the popover closes. An Escape another
17
+ * listener already prevented is left alone. With several popovers visible,
18
+ * only the newest handles Escape, so nested ones close innermost first. While
19
+ * a modal (`:modal`) is open, a popover outside it leaves Escape to the modal;
20
+ * a popover inside the modal still closes first.
21
+ *
8
22
  * For the common button + popover pattern, see `PopoverButton`.
9
23
  *
10
24
  * @example
@@ -50,6 +64,12 @@ import { on } from 'svelte/events';
50
64
  import { swallow } from '@fuzdev/fuz_util/dom.ts';
51
65
  import { generate_position_styles } from './position_helpers.js';
52
66
  const create_client_id = () => Math.random().toString(36).substring(2);
67
+ /**
68
+ * The popovers listening for Escape, oldest first — only the last one handles
69
+ * it. Each enters on show (or on content attach while visible) and leaves on
70
+ * hide or content teardown.
71
+ */
72
+ const escape_stack = [];
53
73
  /**
54
74
  * Class that manages state and provides actions for popovers.
55
75
  */
@@ -78,6 +98,8 @@ export class Popover {
78
98
  #onhide = undefined;
79
99
  /** Cleanup function for document click handler. */
80
100
  #document_click_cleanup = undefined;
101
+ /** Cleanup function for the document Escape handler. */
102
+ #escape_cleanup = undefined;
81
103
  constructor(params) {
82
104
  if (params) {
83
105
  this.update(params);
@@ -106,6 +128,41 @@ export class Popover {
106
128
  this.#document_click_cleanup = undefined;
107
129
  }
108
130
  }
131
+ /**
132
+ * Registers the document Escape handler while visible, removes it otherwise.
133
+ */
134
+ #manage_escape() {
135
+ if (this.visible && !this.#escape_cleanup) {
136
+ const off = on(document, 'keydown', (event) => {
137
+ if (event.key !== 'Escape' || event.defaultPrevented)
138
+ return;
139
+ // a newer visible popover handles it
140
+ if (escape_stack.at(-1) !== this)
141
+ return;
142
+ // a modal this popover isn't inside owns Escape (its close request)
143
+ const modal = document.querySelector(':modal');
144
+ if (modal && !(this.#content_element && modal.contains(this.#content_element)))
145
+ return;
146
+ event.preventDefault();
147
+ const active = document.activeElement;
148
+ const return_focus = !!active && !!this.#content_element?.contains(active);
149
+ this.hide();
150
+ if (return_focus)
151
+ this.#trigger_element?.focus();
152
+ });
153
+ escape_stack.push(this);
154
+ this.#escape_cleanup = () => {
155
+ off();
156
+ const index = escape_stack.indexOf(this);
157
+ if (index !== -1)
158
+ escape_stack.splice(index, 1);
159
+ };
160
+ }
161
+ else if (!this.visible && this.#escape_cleanup) {
162
+ this.#escape_cleanup();
163
+ this.#escape_cleanup = undefined;
164
+ }
165
+ }
109
166
  /**
110
167
  * Updates the popover configuration. Swaps `popover_class` on the live
111
168
  * content element when supplied and re-syncs the outside-click handler
@@ -156,19 +213,37 @@ export class Popover {
156
213
  // to allow Svelte transitions to work properly
157
214
  }
158
215
  /**
159
- * Updates ARIA attributes and state for accessibility.
216
+ * Updates ARIA attributes and state for accessibility: `aria-expanded`
217
+ * always, and `aria-controls` only while visible with content attached.
160
218
  */
161
219
  #update_trigger_aria_attributes() {
162
- if (this.#trigger_element) {
163
- this.#trigger_element.setAttribute('aria-expanded', this.visible ? 'true' : 'false');
164
- // If we have a content element, establish the relationship
165
- if (this.#content_element) {
166
- const content_id = this.#content_element.id || `popover-content-${create_client_id()}`;
167
- this.#content_element.id = content_id;
168
- this.#trigger_element.setAttribute('aria-controls', content_id);
169
- }
220
+ if (!this.#trigger_element)
221
+ return;
222
+ this.#trigger_element.setAttribute('aria-expanded', this.visible ? 'true' : 'false');
223
+ if (this.visible && this.#content_element) {
224
+ const content_id = this.#content_element.id || `popover-content-${create_client_id()}`;
225
+ this.#content_element.id = content_id;
226
+ this.#trigger_element.setAttribute('aria-controls', content_id);
227
+ }
228
+ else {
229
+ this.#trigger_element.removeAttribute('aria-controls');
170
230
  }
171
231
  }
232
+ /**
233
+ * Names the content by the trigger (`aria-labelledby`) unless the content
234
+ * already carries a name of its own.
235
+ */
236
+ #label_content() {
237
+ const content = this.#content_element;
238
+ const trigger = this.#trigger_element;
239
+ if (!content || !trigger)
240
+ return;
241
+ if (content.hasAttribute('aria-label') || content.hasAttribute('aria-labelledby'))
242
+ return;
243
+ const trigger_id = trigger.id || `popover-trigger-${create_client_id()}`;
244
+ trigger.id = trigger_id;
245
+ content.setAttribute('aria-labelledby', trigger_id);
246
+ }
172
247
  /**
173
248
  * Shows the popover, registering the outside-click handler and updating
174
249
  * `aria-expanded` on the trigger. No-ops when already visible.
@@ -180,6 +255,7 @@ export class Popover {
180
255
  return;
181
256
  this.visible = true;
182
257
  this.#manage_outside_click();
258
+ this.#manage_escape();
183
259
  this.#update_trigger_aria_attributes();
184
260
  if (this.#onshow)
185
261
  this.#onshow();
@@ -195,6 +271,7 @@ export class Popover {
195
271
  return;
196
272
  this.visible = false;
197
273
  this.#manage_outside_click();
274
+ this.#manage_escape();
198
275
  this.#update_trigger_aria_attributes();
199
276
  if (this.#onhide)
200
277
  this.#onhide();
@@ -234,6 +311,7 @@ export class Popover {
234
311
  this.update(params);
235
312
  }
236
313
  this.#update_trigger_aria_attributes();
314
+ this.#label_content();
237
315
  const click_handler = on(node, 'click', (e) => {
238
316
  swallow(e);
239
317
  this.toggle();
@@ -281,20 +359,29 @@ export class Popover {
281
359
  };
282
360
  update_node_position();
283
361
  this.#manage_outside_click();
362
+ this.#manage_escape();
284
363
  if (!node.hasAttribute('role')) {
285
364
  node.setAttribute('role', 'dialog');
286
365
  }
366
+ this.#label_content();
367
+ this.#update_trigger_aria_attributes();
287
368
  return () => {
369
+ if (this.popover_class) {
370
+ node.classList.remove(this.popover_class);
371
+ }
372
+ // a newer content node owns the listeners now
373
+ if (this.#content_element !== node)
374
+ return;
288
375
  if (this.#document_click_cleanup) {
289
376
  this.#document_click_cleanup();
290
377
  this.#document_click_cleanup = undefined;
291
378
  }
292
- if (this.popover_class) {
293
- node.classList.remove(this.popover_class);
294
- }
295
- if (this.#content_element === node) {
296
- this.#content_element = null;
379
+ if (this.#escape_cleanup) {
380
+ this.#escape_cleanup();
381
+ this.#escape_cleanup = undefined;
297
382
  }
383
+ this.#content_element = null;
384
+ this.#update_trigger_aria_attributes();
298
385
  };
299
386
  };
300
387
  };
@@ -13,19 +13,26 @@
13
13
  * delivery is pull-only via `subscribe()` — the consumer plumbs their
14
14
  * `FrontendWebsocketClient` / `ActionDispatcher` receiver to `apply_notification`.
15
15
  *
16
- * Holds six `AsyncSlot`s — one per RPC verb. The cache `#offers` lives on
17
- * the class (multiple ops write into it via `#merge_offers` /
18
- * `#remove_offer`); the `create` slot is typed `AsyncSlot<RoleGrantOfferJson>`
19
- * so `submit_create` can return the new offer via the slot's
20
- * supersession-safe `data` path, but the other slots' `data` is unused
21
- * (no single op owns the cache). Method names use the `submit_*` prefix
22
- * to avoid slot-name collisions; the `history` view stayed natural by
23
- * naming the fetch slot `list_history`.
16
+ * Holds one slot per RPC verb: `AsyncSlot`s for `list`, `list_history` and
17
+ * `create`, and `KeyedAsyncSlot`s keyed by offer id for the per-row verbs
18
+ * `accept`, `decline` and `retract`, so each row carries its own pending
19
+ * state and error. The cache `#offers` lives on the class (multiple ops
20
+ * write into it via `#merge_offers` / `#remove_offer`); the `create` slot is
21
+ * typed `AsyncSlot<RoleGrantOfferJson>` so `submit_create` can return the
22
+ * new offer via the slot's supersession-safe `data` path, but the other
23
+ * slots' `data` is unused (no single op owns the cache). Each terminal verb
24
+ * stamps the offer it answers into the cache, so `history` shows it whether
25
+ * or not its WS notification arrives. Method names use the `submit_*`
26
+ * prefix to avoid slot-name collisions; the `history` view stayed natural
27
+ * by naming the fetch slot `list_history`.
24
28
  *
25
29
  * @module
26
30
  */
27
31
  import { AsyncSlot } from './async_slot.svelte.js';
32
+ import { KeyedAsyncSlot } from './keyed_async_slot.svelte.js';
33
+ import type { Uuid } from '../primitive_schemas.js';
28
34
  import type { RoleGrantOfferJson } from '../auth/role_grant_offer_schema.js';
35
+ import { type RoleGrantOfferAcceptInput, type RoleGrantOfferAcceptOutput, type RoleGrantOfferCreateInput, type RoleGrantOfferCreateOutput, type RoleGrantOfferDeclineInput, type RoleGrantOfferDeclineOutput, type RoleGrantOfferHistoryInput, type RoleGrantOfferHistoryOutput, type RoleGrantOfferListInput, type RoleGrantOfferListOutput, type RoleGrantOfferRetractInput, type RoleGrantOfferRetractOutput } from '../auth/role_grant_offer_action_specs.js';
29
36
  /**
30
37
  * The scope of an offer: global (both absent / `null`) or scoped (both set).
31
38
  * `scope_kind` and `scope_id` are paired on the wire — a lone `scope_id` is an
@@ -37,15 +44,13 @@ export type RoleGrantOfferScope = {
37
44
  scope_id?: null;
38
45
  } | {
39
46
  scope_kind: string;
40
- scope_id: string;
47
+ scope_id: Uuid;
41
48
  };
42
- /** Params for creating an offer — `RoleGrantOffersRpc.create` and `submit_create`. */
43
- export type RoleGrantOfferCreateParams = {
44
- to_account_id: string;
45
- to_actor_id?: string | null;
46
- role: string;
47
- message?: string | null;
48
- } & RoleGrantOfferScope;
49
+ /**
50
+ * Params for `submit_create` — `RoleGrantOfferCreateInput` with its scope as
51
+ * the paired `RoleGrantOfferScope`, so a lone `scope_id` is a type error.
52
+ */
53
+ export type RoleGrantOfferCreateParams = Omit<RoleGrantOfferCreateInput, 'scope_kind' | 'scope_id'> & RoleGrantOfferScope;
49
54
  /**
50
55
  * Svelte context for `RoleGrantOffersState`.
51
56
  * Use `role_grant_offers_state_context.set(state)` in the provider and
@@ -60,32 +65,17 @@ export declare const role_grant_offers_state_context: {
60
65
  * Narrow RPC surface consumed by `RoleGrantOffersState`. Consumers adapt their
61
66
  * typed client (e.g. a `create_rpc_client` Proxy) to this shape — the state
62
67
  * class stays decoupled from the client's `Result` return type so tests can
63
- * inject plain-function stubs.
68
+ * inject plain-function stubs. Each method takes its action's input as one
69
+ * params object and returns its output, both typed from the action specs, so
70
+ * the typed throwing client's methods bridge with no casts.
64
71
  */
65
72
  export interface RoleGrantOffersRpc {
66
- list: () => Promise<{
67
- offers: Array<RoleGrantOfferJson>;
68
- }>;
69
- history: (options?: {
70
- limit?: number;
71
- offset?: number;
72
- }) => Promise<{
73
- offers: Array<RoleGrantOfferJson>;
74
- }>;
75
- create: (params: RoleGrantOfferCreateParams) => Promise<{
76
- offer: RoleGrantOfferJson;
77
- }>;
78
- accept: (offer_id: string) => Promise<{
79
- role_grant_id: string;
80
- offer: RoleGrantOfferJson;
81
- superseded_offer_ids: Array<string>;
82
- }>;
83
- decline: (offer_id: string, reason?: string | null) => Promise<{
84
- ok: true;
85
- }>;
86
- retract: (offer_id: string) => Promise<{
87
- ok: true;
88
- }>;
73
+ list: (params?: RoleGrantOfferListInput) => Promise<RoleGrantOfferListOutput>;
74
+ history: (params?: RoleGrantOfferHistoryInput) => Promise<RoleGrantOfferHistoryOutput>;
75
+ create: (params: RoleGrantOfferCreateInput) => Promise<RoleGrantOfferCreateOutput>;
76
+ accept: (params: RoleGrantOfferAcceptInput) => Promise<RoleGrantOfferAcceptOutput>;
77
+ decline: (params: RoleGrantOfferDeclineInput) => Promise<RoleGrantOfferDeclineOutput>;
78
+ retract: (params: RoleGrantOfferRetractInput) => Promise<RoleGrantOfferRetractOutput>;
89
79
  }
90
80
  /** Narrow WS notification envelope — method + params, matching `JsonrpcNotification`. */
91
81
  export interface RoleGrantOfferNotification {
@@ -126,9 +116,12 @@ export declare class RoleGrantOffersState {
126
116
  superseded_at: string | null;
127
117
  resulting_role_grant_id: (string & import("zod").$brand<"Uuid">) | null;
128
118
  }, string>;
129
- readonly accept: AsyncSlot<void, string>;
130
- readonly decline: AsyncSlot<void, string>;
131
- readonly retract: AsyncSlot<void, string>;
119
+ /** Per-offer accept, keyed by offer id. */
120
+ readonly accept: KeyedAsyncSlot<string, void, string>;
121
+ /** Per-offer decline, keyed by offer id. */
122
+ readonly decline: KeyedAsyncSlot<string, void, string>;
123
+ /** Per-offer retract, keyed by offer id. */
124
+ readonly retract: KeyedAsyncSlot<string, void, string>;
132
125
  /** Pending offers for the current account, soonest-expiring first. */
133
126
  readonly incoming: Array<RoleGrantOfferJson>;
134
127
  /** Pending offers from the current actor, newest-created first. */
@@ -155,9 +148,11 @@ export declare class RoleGrantOffersState {
155
148
  */
156
149
  submit_create(params: RoleGrantOfferCreateParams): Promise<RoleGrantOfferJson | undefined>;
157
150
  /** Accept an offer; stamps it terminal in the cache and drops any siblings the server superseded. */
158
- submit_accept(offer_id: string): Promise<void>;
159
- submit_decline(offer_id: string, reason?: string | null): Promise<void>;
160
- submit_retract(offer_id: string): Promise<void>;
151
+ submit_accept(offer_id: Uuid): Promise<void>;
152
+ /** Decline an offer; stamps the declined offer the server returns into the cache. */
153
+ submit_decline(offer_id: Uuid, reason?: string | null): Promise<void>;
154
+ /** Retract an offer; stamps the retracted offer the server returns into the cache. */
155
+ submit_retract(offer_id: Uuid): Promise<void>;
161
156
  /**
162
157
  * Wire a notification subscription. The handler dispatches each matching
163
158
  * notification into `apply_notification`; the returned disposer unwires.
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offers_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/l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AAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjF;;;;;;;;OAQG;IACG,aAAa,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAWhG,qGAAqG;IAC/F,aAAa,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAalD,qFAAqF;IAC/E,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAO3E,sFAAsF;IAChF,cAAc,CAAC,QAAQ,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnD;;;OAGG;IACH,SAAS,CAAC,YAAY,EAAE,uBAAuB,GAAG,MAAM,IAAI;IAM5D;;;;;;OAMG;IACH,kBAAkB,CAAC,YAAY,EAAE,0BAA0B,GAAG,IAAI;IAwBlE,4CAA4C;IAC5C,KAAK,IAAI,IAAI;CA+Bb"}
@@ -13,19 +13,24 @@
13
13
  * delivery is pull-only via `subscribe()` — the consumer plumbs their
14
14
  * `FrontendWebsocketClient` / `ActionDispatcher` receiver to `apply_notification`.
15
15
  *
16
- * Holds six `AsyncSlot`s — one per RPC verb. The cache `#offers` lives on
17
- * the class (multiple ops write into it via `#merge_offers` /
18
- * `#remove_offer`); the `create` slot is typed `AsyncSlot<RoleGrantOfferJson>`
19
- * so `submit_create` can return the new offer via the slot's
20
- * supersession-safe `data` path, but the other slots' `data` is unused
21
- * (no single op owns the cache). Method names use the `submit_*` prefix
22
- * to avoid slot-name collisions; the `history` view stayed natural by
23
- * naming the fetch slot `list_history`.
16
+ * Holds one slot per RPC verb: `AsyncSlot`s for `list`, `list_history` and
17
+ * `create`, and `KeyedAsyncSlot`s keyed by offer id for the per-row verbs
18
+ * `accept`, `decline` and `retract`, so each row carries its own pending
19
+ * state and error. The cache `#offers` lives on the class (multiple ops
20
+ * write into it via `#merge_offers` / `#remove_offer`); the `create` slot is
21
+ * typed `AsyncSlot<RoleGrantOfferJson>` so `submit_create` can return the
22
+ * new offer via the slot's supersession-safe `data` path, but the other
23
+ * slots' `data` is unused (no single op owns the cache). Each terminal verb
24
+ * stamps the offer it answers into the cache, so `history` shows it whether
25
+ * or not its WS notification arrives. Method names use the `submit_*`
26
+ * prefix to avoid slot-name collisions; the `history` view stayed natural
27
+ * by naming the fetch slot `list_history`.
24
28
  *
25
29
  * @module
26
30
  */
27
31
  import { create_context } from '@fuzdev/fuz_ui/context_helpers.ts';
28
32
  import { AsyncSlot } from './async_slot.svelte.js';
33
+ import { KeyedAsyncSlot } from './keyed_async_slot.svelte.js';
29
34
  import { is_iso8601_seconds_live } from '../timestamp.js';
30
35
  import { GRANT_SCOPE_PAIRED_MESSAGE, is_grant_scope_paired } from '../auth/role_grant_offer_action_specs.js';
31
36
  import { ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, ROLE_GRANT_REVOKE_NOTIFICATION_METHOD } from '../auth/role_grant_offer_notifications.js';
@@ -46,9 +51,12 @@ export class RoleGrantOffersState {
46
51
  list = new AsyncSlot();
47
52
  list_history = new AsyncSlot();
48
53
  create = new AsyncSlot();
49
- accept = new AsyncSlot();
50
- decline = new AsyncSlot();
51
- retract = new AsyncSlot();
54
+ /** Per-offer accept, keyed by offer id. */
55
+ accept = new KeyedAsyncSlot();
56
+ /** Per-offer decline, keyed by offer id. */
57
+ decline = new KeyedAsyncSlot();
58
+ /** Per-offer retract, keyed by offer id. */
59
+ retract = new KeyedAsyncSlot();
52
60
  #offers = $state.raw(new Map());
53
61
  /** Pending offers for the current account, soonest-expiring first. */
54
62
  incoming = $derived.by(() => {
@@ -138,8 +146,8 @@ export class RoleGrantOffersState {
138
146
  }
139
147
  /** Accept an offer; stamps it terminal in the cache and drops any siblings the server superseded. */
140
148
  async submit_accept(offer_id) {
141
- await this.accept.run(async () => {
142
- const result = await this.#rpc.accept(offer_id);
149
+ await this.accept.run(offer_id, async () => {
150
+ const result = await this.#rpc.accept({ offer_id });
143
151
  this.#merge_offers([result.offer]);
144
152
  // siblings are authoritatively superseded server-side; the
145
153
  // corresponding WS notifications will also arrive, but dropping
@@ -149,16 +157,18 @@ export class RoleGrantOffersState {
149
157
  }
150
158
  });
151
159
  }
160
+ /** Decline an offer; stamps the declined offer the server returns into the cache. */
152
161
  async submit_decline(offer_id, reason) {
153
- await this.decline.run(async () => {
154
- await this.#rpc.decline(offer_id, reason);
155
- this.#remove_offer(offer_id);
162
+ await this.decline.run(offer_id, async () => {
163
+ const { offer } = await this.#rpc.decline({ offer_id, reason });
164
+ this.#merge_offers([offer]);
156
165
  });
157
166
  }
167
+ /** Retract an offer; stamps the retracted offer the server returns into the cache. */
158
168
  async submit_retract(offer_id) {
159
- await this.retract.run(async () => {
160
- await this.#rpc.retract(offer_id);
161
- this.#remove_offer(offer_id);
169
+ await this.retract.run(offer_id, async () => {
170
+ const { offer } = await this.#rpc.retract({ offer_id });
171
+ this.#merge_offers([offer]);
162
172
  });
163
173
  }
164
174
  /**
@@ -212,9 +222,17 @@ export class RoleGrantOffersState {
212
222
  this.retract.reset();
213
223
  this.#offers = new Map();
214
224
  }
225
+ /**
226
+ * Merge offers into the cache by id. A terminal offer is never replaced by
227
+ * a pending one — offers only move forward, so a late notification or seed
228
+ * can't revive one a verb already stamped terminal.
229
+ */
215
230
  #merge_offers(offers) {
216
231
  const next = new Map(this.#offers);
217
232
  for (const offer of offers) {
233
+ const known = next.get(offer.id);
234
+ if (known && is_terminal(known) && !is_terminal(offer))
235
+ continue;
218
236
  next.set(offer.id, offer);
219
237
  }
220
238
  this.#offers = next;
@@ -41,6 +41,23 @@ export declare const format_value: (value: unknown) => string;
41
41
  * @returns readable absolute datetime like `"2026-03-21 14:30:00 UTC"`
42
42
  */
43
43
  export declare const format_datetime_local: (timestamp: string | number | Date) => string;
44
+ /**
45
+ * Count the rows of a newest-first list created at or after `window_start`,
46
+ * for a list fetched with a row cap. The label reads `N+` when the cap may cut
47
+ * the window off — the list is full and its oldest row is still inside the
48
+ * window.
49
+ *
50
+ * @param rows - newest-first rows, as a capped list query returns them
51
+ * @param window_start - the window's start, in epoch milliseconds
52
+ * @param cap - the row limit the list was fetched with
53
+ * @returns the count and its display label
54
+ */
55
+ export declare const count_in_window: (rows: ReadonlyArray<{
56
+ created_at: string;
57
+ }>, window_start: number, cap: number) => {
58
+ count: number;
59
+ label: string;
60
+ };
44
61
  /**
45
62
  * Format audit event metadata for display based on event type.
46
63
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ui_format.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ui_format.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAChC,WAAW,MAAM,GAAG,MAAM,GAAG,IAAI,EACjC,MAAK,MAAmB,KACtB,MA2BF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAY1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,EAAE,YAAY,MAAM,EAAE,kBAAe,KAAG,MAOlF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAAmC,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAW7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,MAOzE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GACjC,YAAY,MAAM,EAClB,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,KACtC,MAgEF,CAAC"}
1
+ {"version":3,"file":"ui_format.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ui_format.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAChC,WAAW,MAAM,GAAG,MAAM,GAAG,IAAI,EACjC,MAAK,MAAmB,KACtB,MA2BF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,MAY1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,EAAE,YAAY,MAAM,EAAE,kBAAe,KAAG,MAOlF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAAmC,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAW7C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,MAOzE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC3B,MAAM,aAAa,CAAC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,EAC3C,cAAc,MAAM,EACpB,KAAK,MAAM,KACT;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAOhC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GACjC,YAAY,MAAM,EAClB,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,KACtC,MAgEF,CAAC"}
@@ -122,6 +122,26 @@ export const format_datetime_local = (timestamp) => {
122
122
  .replace('T', ' ')
123
123
  .replace(/\.\d+Z$/, ' UTC');
124
124
  };
125
+ /**
126
+ * Count the rows of a newest-first list created at or after `window_start`,
127
+ * for a list fetched with a row cap. The label reads `N+` when the cap may cut
128
+ * the window off — the list is full and its oldest row is still inside the
129
+ * window.
130
+ *
131
+ * @param rows - newest-first rows, as a capped list query returns them
132
+ * @param window_start - the window's start, in epoch milliseconds
133
+ * @param cap - the row limit the list was fetched with
134
+ * @returns the count and its display label
135
+ */
136
+ export const count_in_window = (rows, window_start, cap) => {
137
+ let count = 0;
138
+ for (const row of rows)
139
+ if (Date.parse(row.created_at) >= window_start)
140
+ count++;
141
+ const oldest = rows.at(-1);
142
+ const cut_off = rows.length >= cap && oldest !== undefined && Date.parse(oldest.created_at) >= window_start;
143
+ return { count, label: cut_off ? `${count}+` : String(count) };
144
+ };
125
145
  /**
126
146
  * Format audit event metadata for display based on event type.
127
147
  *