@fuzdev/fuz_app 0.55.0 → 0.56.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 (331) hide show
  1. package/dist/actions/CLAUDE.md +211 -155
  2. package/dist/actions/action_bridge.d.ts +8 -5
  3. package/dist/actions/action_bridge.d.ts.map +1 -1
  4. package/dist/actions/action_bridge.js +1 -11
  5. package/dist/actions/action_codegen.d.ts +19 -0
  6. package/dist/actions/action_codegen.d.ts.map +1 -1
  7. package/dist/actions/action_codegen.js +20 -14
  8. package/dist/actions/action_registry.d.ts.map +1 -1
  9. package/dist/actions/action_registry.js +5 -2
  10. package/dist/actions/action_rpc.d.ts +110 -44
  11. package/dist/actions/action_rpc.d.ts.map +1 -1
  12. package/dist/actions/action_rpc.js +92 -287
  13. package/dist/actions/action_spec.d.ts +55 -16
  14. package/dist/actions/action_spec.d.ts.map +1 -1
  15. package/dist/actions/action_spec.js +16 -11
  16. package/dist/actions/action_types.d.ts +28 -60
  17. package/dist/actions/action_types.d.ts.map +1 -1
  18. package/dist/actions/action_types.js +13 -5
  19. package/dist/actions/broadcast_api.d.ts +2 -2
  20. package/dist/actions/broadcast_api.js +2 -2
  21. package/dist/actions/compile_action_registry.d.ts +50 -0
  22. package/dist/actions/compile_action_registry.d.ts.map +1 -0
  23. package/dist/actions/compile_action_registry.js +69 -0
  24. package/dist/actions/heartbeat.d.ts +8 -4
  25. package/dist/actions/heartbeat.d.ts.map +1 -1
  26. package/dist/actions/heartbeat.js +5 -4
  27. package/dist/actions/perform_action.d.ts +145 -0
  28. package/dist/actions/perform_action.d.ts.map +1 -0
  29. package/dist/actions/perform_action.js +258 -0
  30. package/dist/actions/register_action_ws.d.ts +44 -38
  31. package/dist/actions/register_action_ws.d.ts.map +1 -1
  32. package/dist/actions/register_action_ws.js +101 -159
  33. package/dist/actions/register_ws_endpoint.d.ts +2 -10
  34. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  35. package/dist/actions/register_ws_endpoint.js +32 -10
  36. package/dist/actions/transports_ws_auth_guard.d.ts +1 -1
  37. package/dist/actions/transports_ws_auth_guard.js +1 -1
  38. package/dist/actions/transports_ws_backend.d.ts +1 -1
  39. package/dist/actions/transports_ws_backend.js +1 -1
  40. package/dist/auth/CLAUDE.md +673 -442
  41. package/dist/auth/account_action_specs.d.ts +28 -7
  42. package/dist/auth/account_action_specs.d.ts.map +1 -1
  43. package/dist/auth/account_action_specs.js +7 -7
  44. package/dist/auth/account_actions.d.ts +8 -14
  45. package/dist/auth/account_actions.d.ts.map +1 -1
  46. package/dist/auth/account_actions.js +26 -32
  47. package/dist/auth/account_queries.d.ts +46 -13
  48. package/dist/auth/account_queries.d.ts.map +1 -1
  49. package/dist/auth/account_queries.js +73 -33
  50. package/dist/auth/account_routes.d.ts +4 -3
  51. package/dist/auth/account_routes.d.ts.map +1 -1
  52. package/dist/auth/account_routes.js +58 -33
  53. package/dist/auth/account_schema.d.ts +46 -54
  54. package/dist/auth/account_schema.d.ts.map +1 -1
  55. package/dist/auth/account_schema.js +21 -48
  56. package/dist/auth/admin_action_specs.d.ts +55 -21
  57. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  58. package/dist/auth/admin_action_specs.js +42 -26
  59. package/dist/auth/admin_actions.d.ts +14 -21
  60. package/dist/auth/admin_actions.d.ts.map +1 -1
  61. package/dist/auth/admin_actions.js +47 -44
  62. package/dist/auth/audit_emitter.d.ts +160 -0
  63. package/dist/auth/audit_emitter.d.ts.map +1 -0
  64. package/dist/auth/audit_emitter.js +83 -0
  65. package/dist/auth/audit_log_queries.d.ts +17 -87
  66. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  67. package/dist/auth/audit_log_queries.js +17 -96
  68. package/dist/auth/audit_log_routes.d.ts +1 -1
  69. package/dist/auth/audit_log_routes.d.ts.map +1 -1
  70. package/dist/auth/audit_log_routes.js +7 -3
  71. package/dist/auth/audit_log_schema.d.ts +48 -42
  72. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  73. package/dist/auth/audit_log_schema.js +56 -43
  74. package/dist/auth/auth_guard_resolver.d.ts +44 -0
  75. package/dist/auth/auth_guard_resolver.d.ts.map +1 -0
  76. package/dist/auth/auth_guard_resolver.js +56 -0
  77. package/dist/auth/bootstrap_account.d.ts +7 -7
  78. package/dist/auth/bootstrap_account.d.ts.map +1 -1
  79. package/dist/auth/bootstrap_account.js +7 -7
  80. package/dist/auth/bootstrap_routes.d.ts.map +1 -1
  81. package/dist/auth/bootstrap_routes.js +11 -10
  82. package/dist/auth/cleanup.d.ts +20 -26
  83. package/dist/auth/cleanup.d.ts.map +1 -1
  84. package/dist/auth/cleanup.js +33 -47
  85. package/dist/auth/credential_type_schema.d.ts +115 -0
  86. package/dist/auth/credential_type_schema.d.ts.map +1 -0
  87. package/dist/auth/credential_type_schema.js +127 -0
  88. package/dist/auth/daemon_token_middleware.d.ts +1 -1
  89. package/dist/auth/daemon_token_middleware.js +3 -3
  90. package/dist/auth/ddl.d.ts +2 -2
  91. package/dist/auth/ddl.d.ts.map +1 -1
  92. package/dist/auth/ddl.js +6 -6
  93. package/dist/auth/deps.d.ts +7 -32
  94. package/dist/auth/deps.d.ts.map +1 -1
  95. package/dist/auth/grant_path_schema.d.ts +117 -0
  96. package/dist/auth/grant_path_schema.d.ts.map +1 -0
  97. package/dist/auth/grant_path_schema.js +137 -0
  98. package/dist/auth/invite_queries.d.ts +12 -1
  99. package/dist/auth/invite_queries.d.ts.map +1 -1
  100. package/dist/auth/invite_queries.js +12 -1
  101. package/dist/auth/invite_schema.d.ts +1 -1
  102. package/dist/auth/invite_schema.d.ts.map +1 -1
  103. package/dist/auth/invite_schema.js +1 -1
  104. package/dist/auth/middleware.d.ts.map +1 -1
  105. package/dist/auth/middleware.js +5 -2
  106. package/dist/auth/migrations.d.ts +22 -7
  107. package/dist/auth/migrations.d.ts.map +1 -1
  108. package/dist/auth/migrations.js +64 -25
  109. package/dist/auth/request_context.d.ts +157 -170
  110. package/dist/auth/request_context.d.ts.map +1 -1
  111. package/dist/auth/request_context.js +224 -268
  112. package/dist/auth/{permit_offer_action_specs.d.ts → role_grant_offer_action_specs.d.ts} +130 -100
  113. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -0
  114. package/dist/auth/role_grant_offer_action_specs.js +262 -0
  115. package/dist/auth/role_grant_offer_actions.d.ts +104 -0
  116. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -0
  117. package/dist/auth/{permit_offer_actions.js → role_grant_offer_actions.js} +153 -140
  118. package/dist/auth/{permit_offer_notifications.d.ts → role_grant_offer_notifications.d.ts} +80 -70
  119. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -0
  120. package/dist/auth/role_grant_offer_notifications.js +182 -0
  121. package/dist/auth/{permit_offer_queries.d.ts → role_grant_offer_queries.d.ts} +64 -64
  122. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -0
  123. package/dist/auth/{permit_offer_queries.js → role_grant_offer_queries.js} +136 -123
  124. package/dist/auth/role_grant_offer_schema.d.ts +150 -0
  125. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -0
  126. package/dist/auth/{permit_offer_schema.js → role_grant_offer_schema.js} +55 -36
  127. package/dist/auth/role_grant_queries.d.ts +231 -0
  128. package/dist/auth/role_grant_queries.d.ts.map +1 -0
  129. package/dist/auth/role_grant_queries.js +320 -0
  130. package/dist/auth/role_schema.d.ts +150 -40
  131. package/dist/auth/role_schema.d.ts.map +1 -1
  132. package/dist/auth/role_schema.js +144 -45
  133. package/dist/auth/scope_kind_schema.d.ts +96 -0
  134. package/dist/auth/scope_kind_schema.d.ts.map +1 -0
  135. package/dist/auth/scope_kind_schema.js +94 -0
  136. package/dist/auth/self_service_role_action_specs.d.ts +4 -1
  137. package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
  138. package/dist/auth/self_service_role_action_specs.js +2 -2
  139. package/dist/auth/self_service_role_actions.d.ts +35 -29
  140. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  141. package/dist/auth/self_service_role_actions.js +58 -48
  142. package/dist/auth/session_cookie.d.ts +43 -6
  143. package/dist/auth/session_cookie.d.ts.map +1 -1
  144. package/dist/auth/session_cookie.js +31 -5
  145. package/dist/auth/session_middleware.d.ts +37 -3
  146. package/dist/auth/session_middleware.d.ts.map +1 -1
  147. package/dist/auth/session_middleware.js +33 -7
  148. package/dist/auth/signup_routes.d.ts.map +1 -1
  149. package/dist/auth/signup_routes.js +48 -19
  150. package/dist/auth/standard_action_specs.d.ts +2 -2
  151. package/dist/auth/standard_action_specs.js +4 -4
  152. package/dist/auth/standard_rpc_actions.d.ts +23 -19
  153. package/dist/auth/standard_rpc_actions.d.ts.map +1 -1
  154. package/dist/auth/standard_rpc_actions.js +12 -12
  155. package/dist/db/migrate.d.ts +1 -1
  156. package/dist/db/migrate.js +1 -1
  157. package/dist/dev/setup.d.ts +2 -2
  158. package/dist/dev/setup.d.ts.map +1 -1
  159. package/dist/dev/setup.js +4 -4
  160. package/dist/env/load.d.ts +1 -1
  161. package/dist/env/load.js +1 -1
  162. package/dist/hono_context.d.ts +27 -45
  163. package/dist/hono_context.d.ts.map +1 -1
  164. package/dist/hono_context.js +14 -28
  165. package/dist/http/CLAUDE.md +235 -121
  166. package/dist/http/auth_shape.d.ts +191 -0
  167. package/dist/http/auth_shape.d.ts.map +1 -0
  168. package/dist/http/auth_shape.js +237 -0
  169. package/dist/http/common_routes.js +3 -3
  170. package/dist/http/db_routes.d.ts +4 -0
  171. package/dist/http/db_routes.d.ts.map +1 -1
  172. package/dist/http/db_routes.js +44 -7
  173. package/dist/http/error_schemas.d.ts +56 -34
  174. package/dist/http/error_schemas.d.ts.map +1 -1
  175. package/dist/http/error_schemas.js +63 -28
  176. package/dist/http/pending_effects.d.ts +71 -18
  177. package/dist/http/pending_effects.d.ts.map +1 -1
  178. package/dist/http/pending_effects.js +87 -18
  179. package/dist/http/proxy.d.ts +52 -5
  180. package/dist/http/proxy.d.ts.map +1 -1
  181. package/dist/http/proxy.js +92 -14
  182. package/dist/http/route_spec.d.ts +89 -75
  183. package/dist/http/route_spec.d.ts.map +1 -1
  184. package/dist/http/route_spec.js +54 -72
  185. package/dist/http/schema_helpers.d.ts +3 -14
  186. package/dist/http/schema_helpers.d.ts.map +1 -1
  187. package/dist/http/schema_helpers.js +2 -14
  188. package/dist/http/surface.d.ts +2 -10
  189. package/dist/http/surface.d.ts.map +1 -1
  190. package/dist/http/surface.js +3 -4
  191. package/dist/http/surface_query.d.ts +39 -35
  192. package/dist/http/surface_query.d.ts.map +1 -1
  193. package/dist/http/surface_query.js +79 -36
  194. package/dist/primitive_schemas.d.ts +39 -0
  195. package/dist/primitive_schemas.d.ts.map +1 -0
  196. package/dist/primitive_schemas.js +40 -0
  197. package/dist/realtime/sse_auth_guard.d.ts +5 -5
  198. package/dist/realtime/sse_auth_guard.js +9 -9
  199. package/dist/runtime/mock.d.ts +1 -1
  200. package/dist/runtime/mock.js +1 -1
  201. package/dist/server/app_backend.d.ts +14 -11
  202. package/dist/server/app_backend.d.ts.map +1 -1
  203. package/dist/server/app_backend.js +12 -8
  204. package/dist/server/app_server.d.ts +7 -7
  205. package/dist/server/app_server.d.ts.map +1 -1
  206. package/dist/server/app_server.js +35 -40
  207. package/dist/server/validate_nginx.d.ts +1 -1
  208. package/dist/server/validate_nginx.js +1 -1
  209. package/dist/testing/CLAUDE.md +50 -38
  210. package/dist/testing/admin_integration.d.ts +5 -6
  211. package/dist/testing/admin_integration.d.ts.map +1 -1
  212. package/dist/testing/admin_integration.js +87 -85
  213. package/dist/testing/app_server.d.ts +11 -14
  214. package/dist/testing/app_server.d.ts.map +1 -1
  215. package/dist/testing/app_server.js +16 -15
  216. package/dist/testing/assertions.d.ts.map +1 -1
  217. package/dist/testing/assertions.js +2 -1
  218. package/dist/testing/attack_surface.d.ts.map +1 -1
  219. package/dist/testing/attack_surface.js +15 -9
  220. package/dist/testing/audit_completeness.d.ts +2 -2
  221. package/dist/testing/audit_completeness.d.ts.map +1 -1
  222. package/dist/testing/audit_completeness.js +36 -36
  223. package/dist/testing/auth_apps.d.ts +5 -4
  224. package/dist/testing/auth_apps.d.ts.map +1 -1
  225. package/dist/testing/auth_apps.js +22 -19
  226. package/dist/testing/data_exposure.d.ts.map +1 -1
  227. package/dist/testing/data_exposure.js +5 -5
  228. package/dist/testing/db.d.ts +1 -1
  229. package/dist/testing/db.d.ts.map +1 -1
  230. package/dist/testing/db.js +4 -4
  231. package/dist/testing/db_entities.d.ts +22 -0
  232. package/dist/testing/db_entities.d.ts.map +1 -0
  233. package/dist/testing/db_entities.js +28 -0
  234. package/dist/testing/entities.d.ts +8 -7
  235. package/dist/testing/entities.d.ts.map +1 -1
  236. package/dist/testing/entities.js +21 -18
  237. package/dist/testing/integration.d.ts.map +1 -1
  238. package/dist/testing/integration.js +13 -14
  239. package/dist/testing/integration_helpers.d.ts +4 -4
  240. package/dist/testing/integration_helpers.d.ts.map +1 -1
  241. package/dist/testing/integration_helpers.js +20 -18
  242. package/dist/testing/middleware.d.ts +4 -4
  243. package/dist/testing/middleware.d.ts.map +1 -1
  244. package/dist/testing/middleware.js +12 -11
  245. package/dist/testing/rpc_attack_surface.d.ts.map +1 -1
  246. package/dist/testing/rpc_attack_surface.js +40 -24
  247. package/dist/testing/rpc_round_trip.d.ts +1 -1
  248. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  249. package/dist/testing/rpc_round_trip.js +14 -13
  250. package/dist/testing/sse_round_trip.d.ts +3 -4
  251. package/dist/testing/sse_round_trip.d.ts.map +1 -1
  252. package/dist/testing/sse_round_trip.js +7 -11
  253. package/dist/testing/standard.d.ts +1 -1
  254. package/dist/testing/stubs.d.ts +25 -0
  255. package/dist/testing/stubs.d.ts.map +1 -1
  256. package/dist/testing/stubs.js +43 -2
  257. package/dist/testing/surface_invariants.d.ts +2 -2
  258. package/dist/testing/ws_round_trip.d.ts +12 -13
  259. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  260. package/dist/testing/ws_round_trip.js +19 -11
  261. package/dist/ui/AdminAccounts.svelte +23 -20
  262. package/dist/ui/AdminOverview.svelte +15 -13
  263. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  264. package/dist/ui/{AdminPermitHistory.svelte → AdminRoleGrantHistory.svelte} +12 -12
  265. package/dist/ui/AdminRoleGrantHistory.svelte.d.ts +4 -0
  266. package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -0
  267. package/dist/ui/BootstrapForm.svelte +1 -1
  268. package/dist/ui/CLAUDE.md +60 -60
  269. package/dist/ui/{PermitOfferForm.svelte → RoleGrantOfferForm.svelte} +27 -26
  270. package/dist/ui/{PermitOfferForm.svelte.d.ts → RoleGrantOfferForm.svelte.d.ts} +7 -7
  271. package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -0
  272. package/dist/ui/{PermitOfferHistory.svelte → RoleGrantOfferHistory.svelte} +12 -12
  273. package/dist/ui/{PermitOfferHistory.svelte.d.ts → RoleGrantOfferHistory.svelte.d.ts} +4 -4
  274. package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -0
  275. package/dist/ui/{PermitOfferInbox.svelte → RoleGrantOfferInbox.svelte} +14 -14
  276. package/dist/ui/{PermitOfferInbox.svelte.d.ts → RoleGrantOfferInbox.svelte.d.ts} +4 -4
  277. package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -0
  278. package/dist/ui/SignupForm.svelte +1 -1
  279. package/dist/ui/SurfaceExplorer.svelte +35 -15
  280. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
  281. package/dist/ui/account_sessions_state.svelte.d.ts +2 -3
  282. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -1
  283. package/dist/ui/account_sessions_state.svelte.js +2 -3
  284. package/dist/ui/admin_accounts_state.svelte.d.ts +18 -18
  285. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  286. package/dist/ui/admin_accounts_state.svelte.js +16 -16
  287. package/dist/ui/admin_rpc_adapters.d.ts +20 -20
  288. package/dist/ui/admin_rpc_adapters.d.ts.map +1 -1
  289. package/dist/ui/admin_rpc_adapters.js +17 -17
  290. package/dist/ui/admin_sessions_state.svelte.d.ts +2 -2
  291. package/dist/ui/admin_sessions_state.svelte.js +2 -2
  292. package/dist/ui/audit_log_state.svelte.d.ts +7 -7
  293. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -1
  294. package/dist/ui/audit_log_state.svelte.js +6 -6
  295. package/dist/ui/auth_state.svelte.d.ts +3 -3
  296. package/dist/ui/auth_state.svelte.d.ts.map +1 -1
  297. package/dist/ui/auth_state.svelte.js +6 -6
  298. package/dist/ui/format_scope.d.ts +2 -2
  299. package/dist/ui/format_scope.js +2 -2
  300. package/dist/ui/{permit_offers_state.svelte.d.ts → role_grant_offers_state.svelte.d.ts} +30 -30
  301. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -0
  302. package/dist/ui/{permit_offers_state.svelte.js → role_grant_offers_state.svelte.js} +18 -18
  303. package/dist/ui/ui_format.js +2 -2
  304. package/package.json +3 -3
  305. package/dist/auth/permit_offer_action_specs.d.ts.map +0 -1
  306. package/dist/auth/permit_offer_action_specs.js +0 -258
  307. package/dist/auth/permit_offer_actions.d.ts +0 -110
  308. package/dist/auth/permit_offer_actions.d.ts.map +0 -1
  309. package/dist/auth/permit_offer_notifications.d.ts.map +0 -1
  310. package/dist/auth/permit_offer_notifications.js +0 -182
  311. package/dist/auth/permit_offer_queries.d.ts.map +0 -1
  312. package/dist/auth/permit_offer_schema.d.ts +0 -125
  313. package/dist/auth/permit_offer_schema.d.ts.map +0 -1
  314. package/dist/auth/permit_queries.d.ts +0 -222
  315. package/dist/auth/permit_queries.d.ts.map +0 -1
  316. package/dist/auth/permit_queries.js +0 -305
  317. package/dist/auth/require_keeper.d.ts +0 -20
  318. package/dist/auth/require_keeper.d.ts.map +0 -1
  319. package/dist/auth/require_keeper.js +0 -35
  320. package/dist/auth/route_guards.d.ts +0 -27
  321. package/dist/auth/route_guards.d.ts.map +0 -1
  322. package/dist/auth/route_guards.js +0 -38
  323. package/dist/auth/session_lifecycle.d.ts +0 -37
  324. package/dist/auth/session_lifecycle.d.ts.map +0 -1
  325. package/dist/auth/session_lifecycle.js +0 -29
  326. package/dist/ui/AdminPermitHistory.svelte.d.ts +0 -4
  327. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +0 -1
  328. package/dist/ui/PermitOfferForm.svelte.d.ts.map +0 -1
  329. package/dist/ui/PermitOfferHistory.svelte.d.ts.map +0 -1
  330. package/dist/ui/PermitOfferInbox.svelte.d.ts.map +0 -1
  331. package/dist/ui/permit_offers_state.svelte.d.ts.map +0 -1
@@ -31,7 +31,7 @@
31
31
  *
32
32
  * @module
33
33
  */
34
- import { type ActorSummaryJson, type PermitSummaryJson, type SessionAccount } from '../auth/account_schema.js';
34
+ import { type ActorSummaryJson, type RoleGrantSummaryJson, type SessionAccount } from '../auth/account_schema.js';
35
35
  /**
36
36
  * Svelte context for `AuthState`.
37
37
  * Use `auth_state_context.set(state)` in the provider and `auth_state_context.get()` to access.
@@ -47,8 +47,8 @@ export declare class AuthState {
47
47
  verify_error: string | null;
48
48
  account: SessionAccount | null;
49
49
  actor: ActorSummaryJson | null;
50
- permits: Array<PermitSummaryJson>;
51
- readonly active_permits: Array<PermitSummaryJson>;
50
+ role_grants: Array<RoleGrantSummaryJson>;
51
+ readonly active_role_grants: Array<RoleGrantSummaryJson>;
52
52
  readonly roles: Array<string>;
53
53
  /** True when bootstrap is available (no accounts exist yet). */
54
54
  needs_bootstrap: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"auth_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/auth_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,MAAM,2BAA2B,CAAC;AAEnC;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C;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;CAA8B,CAAC;AAE9D,qBAAa,SAAS;IACrB,SAAS,UAAqB;IAC9B,QAAQ,UAAqB;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAoB;IAC/C,OAAO,EAAE,cAAc,GAAG,IAAI,CAAoB;IAClD,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAoB;IAClD,WAAW,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAkB;IAC1D,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAEtD;IACF,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAwD;IAErF,gEAAgE;IAChE,eAAe,UAAqB;IAEpC;;;;;;;;OAQG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BpC;;;;;;;OAOG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAwCjE;;;;;OAKG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiCpF;;;;;;;OAOG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA4ClF;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAW7B"}
@@ -33,7 +33,7 @@
33
33
  */
34
34
  import { create_context } from '@fuzdev/fuz_ui/context_helpers.js';
35
35
  import { ui_fetch } from './ui_fetch.js';
36
- import { is_permit_active, } from '../auth/account_schema.js';
36
+ import { is_role_grant_active, } from '../auth/account_schema.js';
37
37
  /**
38
38
  * Svelte context for `AuthState`.
39
39
  * Use `auth_state_context.set(state)` in the provider and `auth_state_context.get()` to access.
@@ -45,9 +45,9 @@ export class AuthState {
45
45
  verify_error = $state.raw(null);
46
46
  account = $state.raw(null);
47
47
  actor = $state.raw(null);
48
- permits = $state.raw([]);
49
- active_permits = $derived(this.permits.filter((p) => is_permit_active(p)));
50
- roles = $derived(this.active_permits.map((p) => p.role));
48
+ role_grants = $state.raw([]);
49
+ active_role_grants = $derived(this.role_grants.filter((p) => is_role_grant_active(p)));
50
+ roles = $derived(this.active_role_grants.map((p) => p.role));
51
51
  /** True when bootstrap is available (no accounts exist yet). */
52
52
  needs_bootstrap = $state.raw(false);
53
53
  /**
@@ -68,7 +68,7 @@ export class AuthState {
68
68
  this.verified = true;
69
69
  this.account = data.account ?? null;
70
70
  this.actor = data.actor ?? null;
71
- this.permits = data.permits ?? [];
71
+ this.role_grants = data.role_grants ?? [];
72
72
  this.needs_bootstrap = false;
73
73
  }
74
74
  else {
@@ -248,6 +248,6 @@ export class AuthState {
248
248
  this.verified = false;
249
249
  this.account = null;
250
250
  this.actor = null;
251
- this.permits = [];
251
+ this.role_grants = [];
252
252
  }
253
253
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Shared `format_scope` callback contract for permit-display components.
2
+ * Shared `format_scope` callback contract for role-grant-display components.
3
3
  *
4
- * Permits and offers carry a `scope_id` that names a consumer-owned resource
4
+ * Role grants and offers carry a `scope_id` that names a consumer-owned resource
5
5
  * (e.g. a classroom uuid). The default render is the raw uuid. Consumers wire
6
6
  * a `FormatScope` via context to render a human label without per-page
7
7
  * lookup or forking the components.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Shared `format_scope` callback contract for permit-display components.
2
+ * Shared `format_scope` callback contract for role-grant-display components.
3
3
  *
4
- * Permits and offers carry a `scope_id` that names a consumer-owned resource
4
+ * Role grants and offers carry a `scope_id` that names a consumer-owned resource
5
5
  * (e.g. a classroom uuid). The default render is the raw uuid. Consumers wire
6
6
  * a `FormatScope` via context to render a human label without per-page
7
7
  * lookup or forking the components.
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Reactive state for the consentful-permits offer flow.
2
+ * Reactive state for the consentful-role-grants offer flow.
3
3
  *
4
4
  * Maintains one offer cache keyed by id, seeded by the RPC list/history
5
- * actions and kept live by the six permit-offer WebSocket notifications.
5
+ * actions and kept live by the six role-grant-offer WebSocket notifications.
6
6
  * `incoming` (recipient-side pending) and `outgoing` (grantor-side pending)
7
7
  * are derived views; `history` is the full cache ordered newest-first for
8
8
  * the grantor/admin history view.
@@ -16,32 +16,32 @@
16
16
  * @module
17
17
  */
18
18
  import { Loadable } from './loadable.svelte.js';
19
- import type { PermitOfferJson } from '../auth/permit_offer_schema.js';
19
+ import type { RoleGrantOfferJson } from '../auth/role_grant_offer_schema.js';
20
20
  /**
21
- * Svelte context for `PermitOffersState`.
22
- * Use `permit_offers_state_context.set(state)` in the provider and
23
- * `permit_offers_state_context.get()` to access.
21
+ * Svelte context for `RoleGrantOffersState`.
22
+ * Use `role_grant_offers_state_context.set(state)` in the provider and
23
+ * `role_grant_offers_state_context.get()` to access.
24
24
  */
25
- export declare const permit_offers_state_context: {
26
- get: (error_message?: string) => PermitOffersState;
27
- get_maybe: () => PermitOffersState | undefined;
28
- set: (value: PermitOffersState) => PermitOffersState;
25
+ export declare const role_grant_offers_state_context: {
26
+ get: (error_message?: string) => RoleGrantOffersState;
27
+ get_maybe: () => RoleGrantOffersState | undefined;
28
+ set: (value: RoleGrantOffersState) => RoleGrantOffersState;
29
29
  };
30
30
  /**
31
- * Narrow RPC surface consumed by `PermitOffersState`. Consumers adapt their
31
+ * Narrow RPC surface consumed by `RoleGrantOffersState`. Consumers adapt their
32
32
  * typed client (e.g. a `create_rpc_client` Proxy) to this shape — the state
33
33
  * class stays decoupled from the client's `Result` return type so tests can
34
34
  * inject plain-function stubs.
35
35
  */
36
- export interface PermitOffersRpc {
36
+ export interface RoleGrantOffersRpc {
37
37
  list: () => Promise<{
38
- offers: Array<PermitOfferJson>;
38
+ offers: Array<RoleGrantOfferJson>;
39
39
  }>;
40
40
  history: (options?: {
41
41
  limit?: number;
42
42
  offset?: number;
43
43
  }) => Promise<{
44
- offers: Array<PermitOfferJson>;
44
+ offers: Array<RoleGrantOfferJson>;
45
45
  }>;
46
46
  create: (params: {
47
47
  to_account_id: string;
@@ -50,11 +50,11 @@ export interface PermitOffersRpc {
50
50
  scope_id?: string | null;
51
51
  message?: string | null;
52
52
  }) => Promise<{
53
- offer: PermitOfferJson;
53
+ offer: RoleGrantOfferJson;
54
54
  }>;
55
55
  accept: (offer_id: string) => Promise<{
56
- permit_id: string;
57
- offer: PermitOfferJson;
56
+ role_grant_id: string;
57
+ offer: RoleGrantOfferJson;
58
58
  superseded_offer_ids: Array<string>;
59
59
  }>;
60
60
  decline: (offer_id: string, reason?: string | null) => Promise<{
@@ -65,14 +65,14 @@ export interface PermitOffersRpc {
65
65
  }>;
66
66
  }
67
67
  /** Narrow WS notification envelope — method + params, matching `JsonrpcNotification`. */
68
- export interface PermitOfferNotification {
68
+ export interface RoleGrantOfferNotification {
69
69
  method: string;
70
70
  params: unknown;
71
71
  }
72
72
  /** Subscription primitive — consumer wires their WS receiver; returns a disposer. */
73
- export type PermitOfferSubscribe = (handler: (notification: PermitOfferNotification) => void) => () => void;
74
- export interface PermitOffersStateOptions {
75
- rpc: PermitOffersRpc;
73
+ export type RoleGrantOfferSubscribe = (handler: (notification: RoleGrantOfferNotification) => void) => () => void;
74
+ export interface RoleGrantOffersStateOptions {
75
+ rpc: RoleGrantOffersRpc;
76
76
  /** Reactive accessor for the current account id; returns `null` when logged out. */
77
77
  account_id: () => string | null;
78
78
  /**
@@ -81,16 +81,16 @@ export interface PermitOffersStateOptions {
81
81
  */
82
82
  actor_id: () => string | null;
83
83
  }
84
- export declare class PermitOffersState extends Loadable {
84
+ export declare class RoleGrantOffersState extends Loadable {
85
85
  #private;
86
86
  /** Pending offers for the current account, soonest-expiring first. */
87
- readonly incoming: Array<PermitOfferJson>;
87
+ readonly incoming: Array<RoleGrantOfferJson>;
88
88
  /** Pending offers from the current actor, newest-created first. */
89
- readonly outgoing: Array<PermitOfferJson>;
89
+ readonly outgoing: Array<RoleGrantOfferJson>;
90
90
  /** Every offer known to this state, newest-created first. Feeds the history view. */
91
- readonly history: Array<PermitOfferJson>;
91
+ readonly history: Array<RoleGrantOfferJson>;
92
92
  readonly incoming_count: number;
93
- constructor(options: PermitOffersStateOptions);
93
+ constructor(options: RoleGrantOffersStateOptions);
94
94
  /** Seed the cache with the recipient-side pending inbox. */
95
95
  fetch(): Promise<void>;
96
96
  /** Seed both-directions history (includes terminal rows). */
@@ -111,7 +111,7 @@ export declare class PermitOffersState extends Loadable {
111
111
  role: string;
112
112
  scope_id?: string | null;
113
113
  message?: string | null;
114
- }): Promise<PermitOfferJson | undefined>;
114
+ }): Promise<RoleGrantOfferJson | undefined>;
115
115
  /** Accept an offer; stamps it terminal in the cache and drops any siblings the server superseded. */
116
116
  accept(offer_id: string): Promise<void>;
117
117
  decline(offer_id: string, reason?: string | null): Promise<void>;
@@ -120,7 +120,7 @@ export declare class PermitOffersState extends Loadable {
120
120
  * Wire a notification subscription. The handler dispatches each matching
121
121
  * notification into `apply_notification`; the returned disposer unwires.
122
122
  */
123
- subscribe(subscribe_fn: PermitOfferSubscribe): () => void;
123
+ subscribe(subscribe_fn: RoleGrantOfferSubscribe): () => void;
124
124
  /**
125
125
  * Reduce a single WS notification into the cache. Exposed so consumers
126
126
  * wiring their WS receiver directly (without `subscribe`) and tests can
@@ -128,8 +128,8 @@ export declare class PermitOffersState extends Loadable {
128
128
  *
129
129
  * @mutates `this`
130
130
  */
131
- apply_notification(notification: PermitOfferNotification): void;
131
+ apply_notification(notification: RoleGrantOfferNotification): void;
132
132
  /** Clear the cache and reset loading/error state. */
133
133
  reset(): void;
134
134
  }
135
- //# sourceMappingURL=permit_offers_state.svelte.d.ts.map
135
+ //# sourceMappingURL=role_grant_offers_state.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role_grant_offers_state.svelte.d.ts","s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AM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAQ3C,qGAAqG;IAC/F,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAavC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhE,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9C;;;OAGG;IACH,SAAS,CAAC,YAAY,EAAE,uBAAuB,GAAG,MAAM,IAAI;IAM5D;;;;;;OAMG;IACH,kBAAkB,CAAC,YAAY,EAAE,0BAA0B,GAAG,IAAI;IAwBlE,qDAAqD;IAC5C,KAAK,IAAI,IAAI;CAmBtB"}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Reactive state for the consentful-permits offer flow.
2
+ * Reactive state for the consentful-role-grants offer flow.
3
3
  *
4
4
  * Maintains one offer cache keyed by id, seeded by the RPC list/history
5
- * actions and kept live by the six permit-offer WebSocket notifications.
5
+ * actions and kept live by the six role-grant-offer WebSocket notifications.
6
6
  * `incoming` (recipient-side pending) and `outgoing` (grantor-side pending)
7
7
  * are derived views; `history` is the full cache ordered newest-first for
8
8
  * the grantor/admin history view.
@@ -17,18 +17,18 @@
17
17
  */
18
18
  import { create_context } from '@fuzdev/fuz_ui/context_helpers.js';
19
19
  import { Loadable } from './loadable.svelte.js';
20
- import { PERMIT_OFFER_ACCEPTED_NOTIFICATION_METHOD, PERMIT_OFFER_DECLINED_NOTIFICATION_METHOD, PERMIT_OFFER_RECEIVED_NOTIFICATION_METHOD, PERMIT_OFFER_RETRACTED_NOTIFICATION_METHOD, PERMIT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, PERMIT_REVOKE_NOTIFICATION_METHOD, } from '../auth/permit_offer_notifications.js';
20
+ 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';
21
21
  /**
22
- * Svelte context for `PermitOffersState`.
23
- * Use `permit_offers_state_context.set(state)` in the provider and
24
- * `permit_offers_state_context.get()` to access.
22
+ * Svelte context for `RoleGrantOffersState`.
23
+ * Use `role_grant_offers_state_context.set(state)` in the provider and
24
+ * `role_grant_offers_state_context.get()` to access.
25
25
  */
26
- export const permit_offers_state_context = create_context();
26
+ export const role_grant_offers_state_context = create_context();
27
27
  const is_terminal = (o) => o.accepted_at !== null ||
28
28
  o.declined_at !== null ||
29
29
  o.retracted_at !== null ||
30
30
  o.superseded_at !== null;
31
- export class PermitOffersState extends Loadable {
31
+ export class RoleGrantOffersState extends Loadable {
32
32
  #rpc;
33
33
  #get_account_id;
34
34
  #get_actor_id;
@@ -155,23 +155,23 @@ export class PermitOffersState extends Loadable {
155
155
  */
156
156
  apply_notification(notification) {
157
157
  switch (notification.method) {
158
- case PERMIT_OFFER_RECEIVED_NOTIFICATION_METHOD:
159
- case PERMIT_OFFER_RETRACTED_NOTIFICATION_METHOD:
160
- case PERMIT_OFFER_ACCEPTED_NOTIFICATION_METHOD:
161
- case PERMIT_OFFER_DECLINED_NOTIFICATION_METHOD:
162
- case PERMIT_OFFER_SUPERSEDE_NOTIFICATION_METHOD: {
158
+ case ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD:
159
+ case ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD:
160
+ case ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD:
161
+ case ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD:
162
+ case ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD: {
163
163
  const params = notification.params;
164
164
  if (!params || typeof params !== 'object' || !('offer' in params))
165
165
  return;
166
166
  const offer = params.offer;
167
- if (!is_permit_offer_like(offer))
167
+ if (!is_role_grant_offer_like(offer))
168
168
  return;
169
169
  this.#merge_offers([offer]);
170
170
  return;
171
171
  }
172
- case PERMIT_REVOKE_NOTIFICATION_METHOD:
173
- // permit_revoke is a permit-lifecycle event — the offer cache
174
- // is unaffected. Consumers handle it in an auth/permits state.
172
+ case ROLE_GRANT_REVOKE_NOTIFICATION_METHOD:
173
+ // role_grant_revoke is a role-grant-lifecycle event — the offer cache
174
+ // is unaffected. Consumers handle it in an auth/role_grants state.
175
175
  return;
176
176
  default:
177
177
  // unrelated notifications — ignore silently.
@@ -198,7 +198,7 @@ export class PermitOffersState extends Loadable {
198
198
  this.#offers = next;
199
199
  }
200
200
  }
201
- const is_permit_offer_like = (value) => !!value &&
201
+ const is_role_grant_offer_like = (value) => !!value &&
202
202
  typeof value === 'object' &&
203
203
  typeof value.id === 'string' &&
204
204
  typeof value.to_account_id === 'string' &&
@@ -159,9 +159,9 @@ export const format_audit_metadata = (event_type, metadata) => {
159
159
  return metadata.token_id ? `token: ${truncate_middle(metadata.token_id, 12)}` : '';
160
160
  case 'token_revoke_all':
161
161
  return metadata.count != null ? `${metadata.count} tokens` : '';
162
- case 'permit_grant':
162
+ case 'role_grant_create':
163
163
  return metadata.role ? `role: ${metadata.role}` : '';
164
- case 'permit_revoke':
164
+ case 'role_grant_revoke':
165
165
  return metadata.role ? `role: ${metadata.role}` : '';
166
166
  case 'invite_create':
167
167
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.55.0",
3
+ "version": "0.56.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",
@@ -22,7 +22,7 @@
22
22
  "node": ">=24.14"
23
23
  },
24
24
  "peerDependencies": {
25
- "@electric-sql/pglite": ">=0.3",
25
+ "@electric-sql/pglite": ">=0.4",
26
26
  "@fuzdev/blake3_wasm": ">=0.1.0",
27
27
  "@fuzdev/fuz_util": ">=0.53.4",
28
28
  "@node-rs/argon2": ">=2",
@@ -41,7 +41,7 @@
41
41
  }
42
42
  },
43
43
  "devDependencies": {
44
- "@electric-sql/pglite": "^0.3.16",
44
+ "@electric-sql/pglite": "^0.4.5",
45
45
  "@fuzdev/blake3_wasm": "^0.1.0",
46
46
  "@fuzdev/fuz_code": "^0.45.1",
47
47
  "@fuzdev/fuz_css": "^0.59.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"permit_offer_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,2BAA2B,CAAC;AAMzE,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AACpE,kEAAkE;AAClE,eAAO,MAAM,oBAAoB,EAAG,gBAAyB,CAAC;AAC9D,sDAAsD;AACtD,eAAO,MAAM,mBAAmB,EAAG,eAAwB,CAAC;AAC5D,wGAAwG;AACxG,eAAO,MAAM,qBAAqB,EAAG,iBAA0B,CAAC;AAChE,qGAAqG;AACrG,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAClF,gKAAgK;AAChK,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAC1E,6FAA6F;AAC7F,eAAO,MAAM,0BAA0B,EAAG,sBAA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;;;;;;;;;;;;;;;;;;;CAaD,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,yBAAyB,CAQ1E,CAAC"}
@@ -1,258 +0,0 @@
1
- /**
2
- * Permit offer RPC action specs — declarative contract for the
3
- * consentful-permits surface (offer lifecycle + admin revoke).
4
- *
5
- * Import this module for the specs, Input/Output schemas, `ERROR_OFFER_*`
6
- * reason constants, and the `all_permit_offer_action_specs` registry.
7
- * Handlers live in `auth/permit_offer_actions.ts`.
8
- *
9
- * Authorization enforcement: offer-lifecycle specs declare
10
- * `auth: 'authenticated'` and rely on `query_*` IDOR guards or in-handler
11
- * policy checks (e.g. `permit_offer_list`/`_history` elevate to admin only
12
- * when inspecting another account — an input-dependent check that can't be
13
- * expressed at the spec level). `permit_revoke` declares
14
- * `auth: {role: 'admin'}` — the RPC dispatcher's per-spec post-authorization
15
- * auth gate (`check_action_auth_post_authorization`) rejects non-admin
16
- * callers before the handler runs even though the endpoint hosts non-admin
17
- * methods alongside.
18
- *
19
- * @module
20
- */
21
- import { z } from 'zod';
22
- import { Uuid } from '@fuzdev/fuz_util/id.js';
23
- import { ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
24
- import { RoleName } from './role_schema.js';
25
- import { PERMIT_OFFER_MESSAGE_LENGTH_MAX, PermitOfferJson } from './permit_offer_schema.js';
26
- import { ActingActor, PERMIT_REVOKED_REASON_LENGTH_MAX } from './account_schema.js';
27
- /** Error reason — caller tried to offer themselves a permit. */
28
- export const ERROR_OFFER_SELF_TARGET = 'offer_self_target';
29
- /** Error reason — offer is declined, retracted, or superseded. */
30
- export const ERROR_OFFER_TERMINAL = 'offer_terminal';
31
- /** Error reason — offer's `expires_at` has passed. */
32
- export const ERROR_OFFER_EXPIRED = 'offer_expired';
33
- /** Error reason — offer does not exist or belongs to a different recipient (404-over-403 IDOR mask). */
34
- export const ERROR_OFFER_NOT_FOUND = 'offer_not_found';
35
- /** Error reason — the offered role is not `web_grantable` (nobody may offer it via this surface). */
36
- export const ERROR_OFFER_ROLE_NOT_GRANTABLE = 'offer_role_not_grantable';
37
- /** Error reason — caller is not authorized to offer this role (default policy: caller lacks the role; consumer `authorize` callback may add further policy). */
38
- export const ERROR_OFFER_NOT_AUTHORIZED = 'offer_not_authorized';
39
- /** Error reason — actor-targeted offer was accepted by an actor other than `to_actor_id`. */
40
- export const ERROR_OFFER_ACTOR_MISMATCH = 'offer_actor_mismatch';
41
- /** Error reason — `permit_offer_create` was called with a `to_actor_id` that does not belong to `to_account_id`. */
42
- export const ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH = 'offer_actor_account_mismatch';
43
- // -- Input/output schemas ---------------------------------------------------
44
- /**
45
- * Input for `permit_offer_create`.
46
- *
47
- * `to_actor_id` (optional) narrows the offer to a specific actor on the
48
- * recipient account. When supplied, `permit_offer_accept` will only admit
49
- * the named actor — wrong-actor accepts reject with
50
- * `offer_actor_mismatch`. The audit envelope's `target_actor_id` is
51
- * stamped from this column on the create / supersede / expire / retract
52
- * events. Omit (or pass null) for the account-grain default — any actor
53
- * on `to_account_id` may accept.
54
- */
55
- export const PermitOfferCreateInput = z.strictObject({
56
- to_account_id: Uuid.meta({ description: 'Account id of the recipient.' }),
57
- to_actor_id: Uuid.nullish().meta({
58
- description: 'Optional actor-grain target on the recipient account. When set, only this actor may accept and the audit envelope carries it on offer-shape events. Must belong to `to_account_id`.',
59
- }),
60
- role: RoleName.meta({ description: 'Role being offered.' }),
61
- scope_id: Uuid.nullish().meta({
62
- description: 'Scope id for resource-scoped grants (e.g. classroom id). `null` for global.',
63
- }),
64
- message: z
65
- .string()
66
- .max(PERMIT_OFFER_MESSAGE_LENGTH_MAX)
67
- .nullish()
68
- .meta({ description: 'Optional free-form note from the grantor.' }),
69
- acting: ActingActor,
70
- });
71
- /** Input for `permit_offer_accept`. */
72
- export const PermitOfferAcceptInput = z.strictObject({
73
- offer_id: Uuid.meta({ description: 'The offer to accept.' }),
74
- acting: ActingActor,
75
- });
76
- /** Input for `permit_offer_decline`. */
77
- export const PermitOfferDeclineInput = z.strictObject({
78
- offer_id: Uuid.meta({ description: 'The offer to decline.' }),
79
- reason: z
80
- .string()
81
- .max(PERMIT_OFFER_MESSAGE_LENGTH_MAX)
82
- .nullish()
83
- .meta({ description: 'Optional free-form reason given on decline.' }),
84
- acting: ActingActor,
85
- });
86
- /** Input for `permit_offer_retract`. */
87
- export const PermitOfferRetractInput = z.strictObject({
88
- offer_id: Uuid.meta({ description: 'The offer to retract.' }),
89
- acting: ActingActor,
90
- });
91
- /** Input for `permit_offer_list`. `account_id` is admin-only (inspect another account's inbox). */
92
- export const PermitOfferListInput = z.strictObject({
93
- account_id: Uuid.nullish().meta({
94
- description: 'Admin-only — list offers for another account. Defaults to the caller.',
95
- }),
96
- acting: ActingActor,
97
- });
98
- /**
99
- * Input for `permit_revoke`. Admin-only mutation that revokes an active
100
- * permit on a target actor. `actor_id` is the natural key — permits are
101
- * actor-scoped, and the admin UI reads `row.actor.id` straight from the
102
- * listing. Deriving `actor_id` from `account_id` would collapse under
103
- * multi-actor accounts.
104
- */
105
- export const PermitRevokeInput = z.strictObject({
106
- actor_id: Uuid.meta({ description: 'Actor whose permit to revoke.' }),
107
- permit_id: Uuid.meta({ description: 'The permit to revoke.' }),
108
- reason: z.string().max(PERMIT_REVOKED_REASON_LENGTH_MAX).nullish().meta({
109
- description: 'Optional free-form reason; stamped on `permit.revoked_reason` and surfaced on the revokee WS notification.',
110
- }),
111
- acting: ActingActor,
112
- });
113
- /**
114
- * Input for `permit_offer_history`. Returns every offer involving the account
115
- * in either direction (recipient or grantor), including terminal rows, newest
116
- * first. `account_id` is admin-only.
117
- */
118
- export const PermitOfferHistoryInput = z.strictObject({
119
- account_id: Uuid.nullish().meta({
120
- description: 'Admin-only — history for another account. Defaults to the caller.',
121
- }),
122
- limit: z.number().int().min(1).max(500).nullish().meta({
123
- description: 'Max rows to return (default 100).',
124
- }),
125
- offset: z.number().int().min(0).nullish().meta({
126
- description: 'Pagination offset (default 0).',
127
- }),
128
- acting: ActingActor,
129
- });
130
- /** Output for `permit_offer_create`. */
131
- export const PermitOfferCreateOutput = z.strictObject({
132
- offer: PermitOfferJson,
133
- });
134
- /** Output for `permit_offer_accept`. */
135
- export const PermitOfferAcceptOutput = z.strictObject({
136
- permit_id: Uuid,
137
- offer: PermitOfferJson,
138
- superseded_offer_ids: z.array(Uuid),
139
- });
140
- /** Output for `permit_offer_decline` / `permit_offer_retract`. */
141
- export const PermitOfferOkOutput = z.strictObject({ ok: z.literal(true) });
142
- /** Output for `permit_offer_list`. */
143
- export const PermitOfferListOutput = z.strictObject({ offers: z.array(PermitOfferJson) });
144
- /** Output for `permit_offer_history`. */
145
- export const PermitOfferHistoryOutput = z.strictObject({ offers: z.array(PermitOfferJson) });
146
- /** Output for `permit_revoke`. */
147
- export const PermitRevokeOutput = z.strictObject({
148
- ok: z.literal(true),
149
- revoked: z.literal(true),
150
- });
151
- // -- Action specs -----------------------------------------------------------
152
- export const permit_offer_create_action_spec = {
153
- method: 'permit_offer_create',
154
- kind: 'request_response',
155
- initiator: 'frontend',
156
- auth: 'authenticated',
157
- side_effects: true,
158
- input: PermitOfferCreateInput,
159
- output: PermitOfferCreateOutput,
160
- async: true,
161
- description: 'Offer a permit to another account. Grantor must hold the offered role (or pass a consumer authorize callback); role must be web_grantable.',
162
- error_reasons: [
163
- ERROR_OFFER_SELF_TARGET,
164
- ERROR_OFFER_ROLE_NOT_GRANTABLE,
165
- ERROR_OFFER_NOT_AUTHORIZED,
166
- ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH,
167
- ],
168
- };
169
- export const permit_offer_accept_action_spec = {
170
- method: 'permit_offer_accept',
171
- kind: 'request_response',
172
- initiator: 'frontend',
173
- auth: 'authenticated',
174
- side_effects: true,
175
- input: PermitOfferAcceptInput,
176
- output: PermitOfferAcceptOutput,
177
- async: true,
178
- description: 'Accept an offer. Atomically marks the offer accepted, inserts the permit, and supersedes sibling pending offers for the same (account, role, scope).',
179
- error_reasons: [
180
- ERROR_OFFER_NOT_FOUND,
181
- ERROR_OFFER_TERMINAL,
182
- ERROR_OFFER_EXPIRED,
183
- ERROR_OFFER_ACTOR_MISMATCH,
184
- ],
185
- };
186
- export const permit_offer_decline_action_spec = {
187
- method: 'permit_offer_decline',
188
- kind: 'request_response',
189
- initiator: 'frontend',
190
- auth: 'authenticated',
191
- side_effects: true,
192
- input: PermitOfferDeclineInput,
193
- output: PermitOfferOkOutput,
194
- async: true,
195
- description: 'Decline an offer. Recipient-only.',
196
- error_reasons: [ERROR_OFFER_NOT_FOUND, ERROR_OFFER_TERMINAL],
197
- };
198
- export const permit_offer_retract_action_spec = {
199
- method: 'permit_offer_retract',
200
- kind: 'request_response',
201
- initiator: 'frontend',
202
- auth: 'authenticated',
203
- side_effects: true,
204
- input: PermitOfferRetractInput,
205
- output: PermitOfferOkOutput,
206
- async: true,
207
- description: 'Retract an offer. Grantor-only, pre-decision.',
208
- error_reasons: [ERROR_OFFER_NOT_FOUND, ERROR_OFFER_TERMINAL],
209
- };
210
- export const permit_offer_list_action_spec = {
211
- method: 'permit_offer_list',
212
- kind: 'request_response',
213
- initiator: 'frontend',
214
- auth: 'authenticated',
215
- side_effects: false,
216
- input: PermitOfferListInput,
217
- output: PermitOfferListOutput,
218
- async: true,
219
- description: 'List pending, non-expired offers for the caller. Admins may pass `account_id` to inspect another account.',
220
- };
221
- export const permit_offer_history_action_spec = {
222
- method: 'permit_offer_history',
223
- kind: 'request_response',
224
- initiator: 'frontend',
225
- auth: 'authenticated',
226
- side_effects: false,
227
- input: PermitOfferHistoryInput,
228
- output: PermitOfferHistoryOutput,
229
- async: true,
230
- description: 'List every offer involving the caller (either direction), including terminal rows, newest first. Admins may pass `account_id` to inspect another account.',
231
- };
232
- export const permit_revoke_action_spec = {
233
- method: 'permit_revoke',
234
- kind: 'request_response',
235
- initiator: 'frontend',
236
- auth: { role: 'admin' },
237
- side_effects: true,
238
- input: PermitRevokeInput,
239
- output: PermitRevokeOutput,
240
- async: true,
241
- description: 'Revoke an active permit on a target actor. Admin-only. Supersedes any pending offers for the same (account, role, scope). Fires permit_revoke + permit_offer_supersede notifications.',
242
- error_reasons: [ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE],
243
- rate_limit: 'account',
244
- };
245
- /**
246
- * All permit-offer action specs — a codegen-ready registry. Consumers spread
247
- * this into their own action-spec array to include offer lifecycle + revoke
248
- * methods in a typed client surface.
249
- */
250
- export const all_permit_offer_action_specs = [
251
- permit_offer_create_action_spec,
252
- permit_offer_accept_action_spec,
253
- permit_offer_decline_action_spec,
254
- permit_offer_retract_action_spec,
255
- permit_offer_list_action_spec,
256
- permit_offer_history_action_spec,
257
- permit_revoke_action_spec,
258
- ];