@fuzdev/fuz_app 0.54.0 → 0.55.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 (142) hide show
  1. package/dist/actions/CLAUDE.md +68 -13
  2. package/dist/actions/action_codegen.d.ts +13 -0
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +15 -1
  5. package/dist/actions/action_rpc.d.ts +60 -7
  6. package/dist/actions/action_rpc.d.ts.map +1 -1
  7. package/dist/actions/action_rpc.js +158 -44
  8. package/dist/actions/register_action_ws.d.ts +4 -4
  9. package/dist/actions/register_action_ws.js +6 -6
  10. package/dist/actions/register_ws_endpoint.d.ts +20 -7
  11. package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
  12. package/dist/actions/register_ws_endpoint.js +30 -5
  13. package/dist/actions/transports.d.ts.map +1 -1
  14. package/dist/actions/transports.js +0 -4
  15. package/dist/auth/CLAUDE.md +219 -66
  16. package/dist/auth/account_actions.d.ts +6 -6
  17. package/dist/auth/account_actions.d.ts.map +1 -1
  18. package/dist/auth/account_actions.js +8 -11
  19. package/dist/auth/account_queries.d.ts +6 -3
  20. package/dist/auth/account_queries.d.ts.map +1 -1
  21. package/dist/auth/account_queries.js +14 -5
  22. package/dist/auth/account_routes.d.ts +7 -10
  23. package/dist/auth/account_routes.d.ts.map +1 -1
  24. package/dist/auth/account_routes.js +70 -23
  25. package/dist/auth/account_schema.d.ts +19 -0
  26. package/dist/auth/account_schema.d.ts.map +1 -1
  27. package/dist/auth/account_schema.js +20 -0
  28. package/dist/auth/admin_action_specs.d.ts +45 -11
  29. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  30. package/dist/auth/admin_action_specs.js +23 -8
  31. package/dist/auth/admin_actions.d.ts +8 -7
  32. package/dist/auth/admin_actions.d.ts.map +1 -1
  33. package/dist/auth/admin_actions.js +11 -18
  34. package/dist/auth/audit_log_queries.d.ts +53 -14
  35. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  36. package/dist/auth/audit_log_queries.js +45 -2
  37. package/dist/auth/audit_log_schema.d.ts +55 -1
  38. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  39. package/dist/auth/audit_log_schema.js +19 -3
  40. package/dist/auth/bearer_auth.d.ts +9 -7
  41. package/dist/auth/bearer_auth.d.ts.map +1 -1
  42. package/dist/auth/bearer_auth.js +13 -21
  43. package/dist/auth/cleanup.d.ts.map +1 -1
  44. package/dist/auth/cleanup.js +5 -0
  45. package/dist/auth/daemon_token_middleware.d.ts +23 -11
  46. package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
  47. package/dist/auth/daemon_token_middleware.js +26 -20
  48. package/dist/auth/deps.d.ts +14 -0
  49. package/dist/auth/deps.d.ts.map +1 -1
  50. package/dist/auth/middleware.d.ts.map +1 -1
  51. package/dist/auth/middleware.js +4 -2
  52. package/dist/auth/migrations.d.ts +15 -7
  53. package/dist/auth/migrations.d.ts.map +1 -1
  54. package/dist/auth/migrations.js +15 -7
  55. package/dist/auth/permit_offer_action_specs.d.ts +45 -6
  56. package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
  57. package/dist/auth/permit_offer_action_specs.js +38 -7
  58. package/dist/auth/permit_offer_actions.d.ts +2 -2
  59. package/dist/auth/permit_offer_actions.d.ts.map +1 -1
  60. package/dist/auth/permit_offer_actions.js +98 -90
  61. package/dist/auth/permit_offer_notifications.d.ts +10 -0
  62. package/dist/auth/permit_offer_notifications.d.ts.map +1 -1
  63. package/dist/auth/permit_offer_queries.d.ts +68 -9
  64. package/dist/auth/permit_offer_queries.d.ts.map +1 -1
  65. package/dist/auth/permit_offer_queries.js +147 -35
  66. package/dist/auth/permit_offer_schema.d.ts +23 -1
  67. package/dist/auth/permit_offer_schema.d.ts.map +1 -1
  68. package/dist/auth/permit_offer_schema.js +5 -0
  69. package/dist/auth/permit_queries.d.ts +17 -5
  70. package/dist/auth/permit_queries.d.ts.map +1 -1
  71. package/dist/auth/permit_queries.js +19 -8
  72. package/dist/auth/request_context.d.ts +321 -38
  73. package/dist/auth/request_context.d.ts.map +1 -1
  74. package/dist/auth/request_context.js +393 -66
  75. package/dist/auth/route_guards.d.ts +10 -4
  76. package/dist/auth/route_guards.d.ts.map +1 -1
  77. package/dist/auth/route_guards.js +14 -8
  78. package/dist/auth/self_service_role_action_specs.d.ts +2 -0
  79. package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
  80. package/dist/auth/self_service_role_action_specs.js +2 -0
  81. package/dist/auth/self_service_role_actions.d.ts +6 -5
  82. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  83. package/dist/auth/self_service_role_actions.js +18 -8
  84. package/dist/db/migrate.d.ts +11 -7
  85. package/dist/db/migrate.d.ts.map +1 -1
  86. package/dist/db/migrate.js +9 -6
  87. package/dist/dev/setup.d.ts.map +1 -1
  88. package/dist/dev/setup.js +5 -3
  89. package/dist/hono_context.d.ts +77 -0
  90. package/dist/hono_context.d.ts.map +1 -1
  91. package/dist/hono_context.js +50 -0
  92. package/dist/http/CLAUDE.md +80 -17
  93. package/dist/http/error_schemas.d.ts +92 -1
  94. package/dist/http/error_schemas.d.ts.map +1 -1
  95. package/dist/http/error_schemas.js +73 -16
  96. package/dist/http/jsonrpc_errors.d.ts +27 -2
  97. package/dist/http/jsonrpc_errors.d.ts.map +1 -1
  98. package/dist/http/jsonrpc_errors.js +26 -2
  99. package/dist/http/route_spec.d.ts +62 -4
  100. package/dist/http/route_spec.d.ts.map +1 -1
  101. package/dist/http/route_spec.js +117 -21
  102. package/dist/http/schema_helpers.d.ts +13 -1
  103. package/dist/http/schema_helpers.d.ts.map +1 -1
  104. package/dist/http/schema_helpers.js +21 -2
  105. package/dist/http/surface.d.ts +10 -1
  106. package/dist/http/surface.d.ts.map +1 -1
  107. package/dist/http/surface.js +2 -2
  108. package/dist/server/app_server.d.ts.map +1 -1
  109. package/dist/server/app_server.js +11 -1
  110. package/dist/testing/CLAUDE.md +23 -17
  111. package/dist/testing/admin_integration.d.ts.map +1 -1
  112. package/dist/testing/admin_integration.js +15 -13
  113. package/dist/testing/adversarial_headers.js +1 -1
  114. package/dist/testing/app_server.js +2 -2
  115. package/dist/testing/audit_completeness.d.ts.map +1 -1
  116. package/dist/testing/audit_completeness.js +21 -7
  117. package/dist/testing/auth_apps.d.ts.map +1 -1
  118. package/dist/testing/auth_apps.js +6 -3
  119. package/dist/testing/entities.d.ts +2 -1
  120. package/dist/testing/entities.d.ts.map +1 -1
  121. package/dist/testing/entities.js +1 -0
  122. package/dist/testing/integration_helpers.d.ts +4 -2
  123. package/dist/testing/integration_helpers.d.ts.map +1 -1
  124. package/dist/testing/integration_helpers.js +9 -5
  125. package/dist/testing/middleware.d.ts +12 -8
  126. package/dist/testing/middleware.d.ts.map +1 -1
  127. package/dist/testing/middleware.js +67 -25
  128. package/dist/testing/rpc_helpers.d.ts.map +1 -1
  129. package/dist/testing/rpc_helpers.js +3 -1
  130. package/dist/testing/ws_round_trip.d.ts.map +1 -1
  131. package/dist/testing/ws_round_trip.js +5 -1
  132. package/dist/ui/CLAUDE.md +16 -10
  133. package/dist/ui/PermitOfferForm.svelte +14 -0
  134. package/dist/ui/PermitOfferForm.svelte.d.ts +6 -0
  135. package/dist/ui/PermitOfferForm.svelte.d.ts.map +1 -1
  136. package/dist/ui/admin_accounts_state.svelte.d.ts +8 -1
  137. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
  138. package/dist/ui/admin_accounts_state.svelte.js +14 -3
  139. package/dist/ui/permit_offers_state.svelte.d.ts +9 -1
  140. package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
  141. package/dist/ui/permit_offers_state.svelte.js +7 -1
  142. package/package.json +1 -1
@@ -11,18 +11,19 @@
11
11
  * policy checks (e.g. `permit_offer_list`/`_history` elevate to admin only
12
12
  * when inspecting another account — an input-dependent check that can't be
13
13
  * expressed at the spec level). `permit_revoke` declares
14
- * `auth: {role: 'admin'}` — the RPC dispatcher's per-spec `check_action_auth`
15
- * gates it before the handler runs even though the endpoint hosts non-admin
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
16
17
  * methods alongside.
17
18
  *
18
19
  * @module
19
20
  */
20
21
  import { z } from 'zod';
21
22
  import { Uuid } from '@fuzdev/fuz_util/id.js';
22
- import { ERROR_ACCOUNT_NOT_FOUND, ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE, } from '../http/error_schemas.js';
23
+ import { ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
23
24
  import { RoleName } from './role_schema.js';
24
25
  import { PERMIT_OFFER_MESSAGE_LENGTH_MAX, PermitOfferJson } from './permit_offer_schema.js';
25
- import { PERMIT_REVOKED_REASON_LENGTH_MAX } from './account_schema.js';
26
+ import { ActingActor, PERMIT_REVOKED_REASON_LENGTH_MAX } from './account_schema.js';
26
27
  /** Error reason — caller tried to offer themselves a permit. */
27
28
  export const ERROR_OFFER_SELF_TARGET = 'offer_self_target';
28
29
  /** Error reason — offer is declined, retracted, or superseded. */
@@ -35,10 +36,27 @@ export const ERROR_OFFER_NOT_FOUND = 'offer_not_found';
35
36
  export const ERROR_OFFER_ROLE_NOT_GRANTABLE = 'offer_role_not_grantable';
36
37
  /** Error reason — caller is not authorized to offer this role (default policy: caller lacks the role; consumer `authorize` callback may add further policy). */
37
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';
38
43
  // -- Input/output schemas ---------------------------------------------------
39
- /** Input for `permit_offer_create`. */
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
+ */
40
55
  export const PermitOfferCreateInput = z.strictObject({
41
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
+ }),
42
60
  role: RoleName.meta({ description: 'Role being offered.' }),
43
61
  scope_id: Uuid.nullish().meta({
44
62
  description: 'Scope id for resource-scoped grants (e.g. classroom id). `null` for global.',
@@ -48,10 +66,12 @@ export const PermitOfferCreateInput = z.strictObject({
48
66
  .max(PERMIT_OFFER_MESSAGE_LENGTH_MAX)
49
67
  .nullish()
50
68
  .meta({ description: 'Optional free-form note from the grantor.' }),
69
+ acting: ActingActor,
51
70
  });
52
71
  /** Input for `permit_offer_accept`. */
53
72
  export const PermitOfferAcceptInput = z.strictObject({
54
73
  offer_id: Uuid.meta({ description: 'The offer to accept.' }),
74
+ acting: ActingActor,
55
75
  });
56
76
  /** Input for `permit_offer_decline`. */
57
77
  export const PermitOfferDeclineInput = z.strictObject({
@@ -61,16 +81,19 @@ export const PermitOfferDeclineInput = z.strictObject({
61
81
  .max(PERMIT_OFFER_MESSAGE_LENGTH_MAX)
62
82
  .nullish()
63
83
  .meta({ description: 'Optional free-form reason given on decline.' }),
84
+ acting: ActingActor,
64
85
  });
65
86
  /** Input for `permit_offer_retract`. */
66
87
  export const PermitOfferRetractInput = z.strictObject({
67
88
  offer_id: Uuid.meta({ description: 'The offer to retract.' }),
89
+ acting: ActingActor,
68
90
  });
69
91
  /** Input for `permit_offer_list`. `account_id` is admin-only (inspect another account's inbox). */
70
92
  export const PermitOfferListInput = z.strictObject({
71
93
  account_id: Uuid.nullish().meta({
72
94
  description: 'Admin-only — list offers for another account. Defaults to the caller.',
73
95
  }),
96
+ acting: ActingActor,
74
97
  });
75
98
  /**
76
99
  * Input for `permit_revoke`. Admin-only mutation that revokes an active
@@ -85,6 +108,7 @@ export const PermitRevokeInput = z.strictObject({
85
108
  reason: z.string().max(PERMIT_REVOKED_REASON_LENGTH_MAX).nullish().meta({
86
109
  description: 'Optional free-form reason; stamped on `permit.revoked_reason` and surfaced on the revokee WS notification.',
87
110
  }),
111
+ acting: ActingActor,
88
112
  });
89
113
  /**
90
114
  * Input for `permit_offer_history`. Returns every offer involving the account
@@ -101,6 +125,7 @@ export const PermitOfferHistoryInput = z.strictObject({
101
125
  offset: z.number().int().min(0).nullish().meta({
102
126
  description: 'Pagination offset (default 0).',
103
127
  }),
128
+ acting: ActingActor,
104
129
  });
105
130
  /** Output for `permit_offer_create`. */
106
131
  export const PermitOfferCreateOutput = z.strictObject({
@@ -138,6 +163,7 @@ export const permit_offer_create_action_spec = {
138
163
  ERROR_OFFER_SELF_TARGET,
139
164
  ERROR_OFFER_ROLE_NOT_GRANTABLE,
140
165
  ERROR_OFFER_NOT_AUTHORIZED,
166
+ ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH,
141
167
  ],
142
168
  };
143
169
  export const permit_offer_accept_action_spec = {
@@ -150,7 +176,12 @@ export const permit_offer_accept_action_spec = {
150
176
  output: PermitOfferAcceptOutput,
151
177
  async: true,
152
178
  description: 'Accept an offer. Atomically marks the offer accepted, inserts the permit, and supersedes sibling pending offers for the same (account, role, scope).',
153
- error_reasons: [ERROR_OFFER_NOT_FOUND, ERROR_OFFER_TERMINAL, ERROR_OFFER_EXPIRED],
179
+ error_reasons: [
180
+ ERROR_OFFER_NOT_FOUND,
181
+ ERROR_OFFER_TERMINAL,
182
+ ERROR_OFFER_EXPIRED,
183
+ ERROR_OFFER_ACTOR_MISMATCH,
184
+ ],
154
185
  };
155
186
  export const permit_offer_decline_action_spec = {
156
187
  method: 'permit_offer_decline',
@@ -208,7 +239,7 @@ export const permit_revoke_action_spec = {
208
239
  output: PermitRevokeOutput,
209
240
  async: true,
210
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.',
211
- error_reasons: [ERROR_PERMIT_NOT_FOUND, ERROR_ACCOUNT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE],
242
+ error_reasons: [ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE],
212
243
  rate_limit: 'account',
213
244
  };
214
245
  /**
@@ -39,7 +39,7 @@
39
39
  import { type ActionContext, type RpcAction } from '../actions/action_rpc.js';
40
40
  import { type RoleSchemaResult } from './role_schema.js';
41
41
  import { type RequestContext } from './request_context.js';
42
- import type { RouteFactoryDeps } from './deps.js';
42
+ import type { AuditEmitDeps, RouteFactoryDeps } from './deps.js';
43
43
  import { type NotificationSender } from './permit_offer_notifications.js';
44
44
  /**
45
45
  * Authorization callback for `permit_offer_create`. Returns `true` to allow,
@@ -94,7 +94,7 @@ export declare const authorize_admin_or_holder: PermitOfferCreateAuthorize;
94
94
  * directly (the transport's `send_to_account` signature accepts the broader
95
95
  * `JsonrpcMessageFromServerToClient`, which is contravariantly compatible).
96
96
  */
97
- export interface PermitOfferActionDeps extends Pick<RouteFactoryDeps, 'log' | 'on_audit_event' | 'audit_log_config'> {
97
+ export interface PermitOfferActionDeps extends AuditEmitDeps {
98
98
  /** Optional WS fan-out primitive. `null` or absent → notifications skipped. */
99
99
  notification_sender?: NotificationSender | null;
100
100
  }
@@ -1 +1 @@
1
- {"version":3,"file":"permit_offer_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_actions.ts"],"names":[],"mappings":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AAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAChD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,qBAAqB,EAC3B,UAAS,wBAA6B,KACpC,KAAK,CAAC,SAAS,CA4cjB,CAAC"}
@@ -36,19 +36,19 @@
36
36
  *
37
37
  * @module
38
38
  */
39
- import { rpc_action } from '../actions/action_rpc.js';
39
+ import { rpc_actor_action, } from '../actions/action_rpc.js';
40
40
  import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
41
41
  import { emit_after_commit } from '../http/pending_effects.js';
42
42
  import { BUILTIN_ROLE_OPTIONS, ROLE_ADMIN } from './role_schema.js';
43
43
  import { PERMIT_OFFER_DEFAULT_TTL_MS, to_permit_offer_json } from './permit_offer_schema.js';
44
- import { query_permit_offer_create, query_permit_offer_decline, query_permit_offer_retract, query_permit_offer_list, query_permit_offer_history_for_account, query_accept_offer, PermitOfferAlreadyTerminalError, PermitOfferExpiredError, PermitOfferNotFoundError, PermitOfferSelfTargetError, } from './permit_offer_queries.js';
44
+ import { query_permit_offer_create, query_permit_offer_decline, query_permit_offer_retract, query_permit_offer_list, query_permit_offer_history_for_account, query_accept_offer, PermitOfferActorAccountMismatchError, PermitOfferActorMismatchError, PermitOfferAlreadyTerminalError, PermitOfferExpiredError, PermitOfferNotFoundError, PermitOfferSelfTargetError, } from './permit_offer_queries.js';
45
45
  import { query_permit_find_active_role_for_actor, query_revoke_permit } from './permit_queries.js';
46
46
  import { query_actor_by_id } from './account_queries.js';
47
- import { audit_log_fire_and_forget } from './audit_log_queries.js';
48
- import { has_role, has_scoped_role } from './request_context.js';
47
+ import { emit_permit_target_event } from './audit_log_queries.js';
48
+ import { has_role, has_scoped_role, } from './request_context.js';
49
49
  import { build_permit_offer_accepted_notification, build_permit_offer_declined_notification, build_permit_offer_received_notification, build_permit_offer_retracted_notification, build_permit_offer_supersede_notification, build_permit_revoke_notification, } from './permit_offer_notifications.js';
50
- import { ERROR_ACCOUNT_NOT_FOUND, ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE, } from '../http/error_schemas.js';
51
- import { ERROR_OFFER_EXPIRED, ERROR_OFFER_NOT_AUTHORIZED, ERROR_OFFER_NOT_FOUND, ERROR_OFFER_ROLE_NOT_GRANTABLE, ERROR_OFFER_SELF_TARGET, ERROR_OFFER_TERMINAL, permit_offer_create_action_spec, permit_offer_accept_action_spec, permit_offer_decline_action_spec, permit_offer_retract_action_spec, permit_offer_list_action_spec, permit_offer_history_action_spec, permit_revoke_action_spec, } from './permit_offer_action_specs.js';
50
+ import { ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
51
+ import { ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH, ERROR_OFFER_ACTOR_MISMATCH, ERROR_OFFER_EXPIRED, ERROR_OFFER_NOT_AUTHORIZED, ERROR_OFFER_NOT_FOUND, ERROR_OFFER_ROLE_NOT_GRANTABLE, ERROR_OFFER_SELF_TARGET, ERROR_OFFER_TERMINAL, permit_offer_create_action_spec, permit_offer_accept_action_spec, permit_offer_decline_action_spec, permit_offer_retract_action_spec, permit_offer_list_action_spec, permit_offer_history_action_spec, permit_revoke_action_spec, } from './permit_offer_action_specs.js';
52
52
  // -- Helpers ----------------------------------------------------------------
53
53
  /** Fire `on_audit_event` for each event — used by accept, whose events were written in-transaction. */
54
54
  const fan_out_audit_events = (events, on_audit_event, log) => {
@@ -87,16 +87,6 @@ export const authorize_admin_or_holder = async (auth, input, _deps, _ctx) => {
87
87
  return true;
88
88
  return has_scoped_role(auth, input.role, null);
89
89
  };
90
- /**
91
- * Narrow `ctx.auth` to non-null. The RPC dispatcher has already enforced
92
- * `auth: 'authenticated'` before the handler runs — this is a type narrow,
93
- * not a runtime check that would otherwise fail.
94
- */
95
- const require_request_auth = (auth) => {
96
- if (!auth)
97
- throw new Error('unreachable: action auth guard did not enforce authentication');
98
- return auth;
99
- };
100
90
  /**
101
91
  * Create the seven permit-offer RPC actions (six offer-lifecycle methods
102
92
  * plus `permit_revoke`).
@@ -110,28 +100,29 @@ export const create_permit_offer_actions = (deps, options = {}) => {
110
100
  const role_options = options.roles?.role_options ?? BUILTIN_ROLE_OPTIONS;
111
101
  const default_ttl_ms = options.default_ttl_ms ?? PERMIT_OFFER_DEFAULT_TTL_MS;
112
102
  const authorize = options.authorize ?? default_authorize;
113
- // Three denial paths (web_grantable, authorize, self-target) all emit the
114
- // same failure-outcome audit event. Local closure over `log` + `on_audit_event`.
103
+ // Four denial paths (web_grantable, authorize, self-target,
104
+ // actor-account mismatch) all emit the same failure-outcome audit
105
+ // event. `target_actor_id` is populated when the caller supplied a
106
+ // `to_actor_id` so failure rows match the success-shape envelope of
107
+ // actor-targeted offers.
115
108
  const emit_create_failure_audit = (ctx, auth, input) => {
116
- void audit_log_fire_and_forget(ctx, {
109
+ void emit_permit_target_event(ctx, auth, deps, {
117
110
  event_type: 'permit_offer_create',
118
111
  outcome: 'failure',
119
- actor_id: auth.actor.id,
120
- account_id: auth.account.id,
121
112
  target_account_id: input.to_account_id,
122
- ip: ctx.client_ip,
113
+ target_actor_id: input.to_actor_id ?? null,
123
114
  metadata: {
124
115
  role: input.role,
125
116
  scope_id: input.scope_id ?? null,
126
117
  to_account_id: input.to_account_id,
127
118
  },
128
- }, deps);
119
+ });
129
120
  };
130
121
  // Returns {offer} only — no auto-accept. Recipient must call
131
122
  // permit_offer_accept; admin tests materialize permits via
132
123
  // query_accept_offer (see testing/admin_integration.ts `offer_and_accept`).
133
124
  const create_handler = async (input, ctx) => {
134
- const auth = require_request_auth(ctx.auth);
125
+ const auth = ctx.auth;
135
126
  // Role must be web_grantable — same gate as admin direct-grant.
136
127
  const rc = role_options.get(input.role);
137
128
  if (!rc?.web_grantable) {
@@ -156,6 +147,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
156
147
  offer = await query_permit_offer_create(ctx, {
157
148
  from_actor_id: auth.actor.id,
158
149
  to_account_id: input.to_account_id,
150
+ to_actor_id: input.to_actor_id ?? null,
159
151
  role: input.role,
160
152
  scope_id: input.scope_id ?? null,
161
153
  message: input.message ?? null,
@@ -169,21 +161,29 @@ export const create_permit_offer_actions = (deps, options = {}) => {
169
161
  reason: ERROR_OFFER_SELF_TARGET,
170
162
  });
171
163
  }
164
+ if (err instanceof PermitOfferActorAccountMismatchError) {
165
+ emit_create_failure_audit(ctx, auth, input);
166
+ throw jsonrpc_errors.invalid_params('to_actor_id does not belong to to_account_id', {
167
+ reason: ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH,
168
+ });
169
+ }
172
170
  throw err;
173
171
  }
174
- void audit_log_fire_and_forget(ctx, {
172
+ // `target_actor_id` is populated when the offer is actor-targeted
173
+ // (per the offer's `to_actor_id`), null for account-grain offers
174
+ // — closes the audit hole where offer-shape events used to leave
175
+ // actor-grain forensics blank even when the binding was known.
176
+ void emit_permit_target_event(ctx, auth, deps, {
175
177
  event_type: 'permit_offer_create',
176
- actor_id: auth.actor.id,
177
- account_id: auth.account.id,
178
178
  target_account_id: input.to_account_id,
179
- ip: ctx.client_ip,
179
+ target_actor_id: offer.to_actor_id,
180
180
  metadata: {
181
181
  offer_id: offer.id,
182
182
  role: offer.role,
183
183
  scope_id: offer.scope_id,
184
184
  to_account_id: offer.to_account_id,
185
185
  },
186
- }, deps);
186
+ });
187
187
  const offer_json = to_permit_offer_json(offer);
188
188
  if (notification_sender) {
189
189
  emit_after_commit(ctx, () => {
@@ -193,12 +193,13 @@ export const create_permit_offer_actions = (deps, options = {}) => {
193
193
  return { offer: offer_json };
194
194
  };
195
195
  const accept_handler = async (input, ctx) => {
196
- const auth = require_request_auth(ctx.auth);
196
+ const auth = ctx.auth;
197
197
  let result;
198
198
  try {
199
199
  result = await query_accept_offer(ctx, {
200
200
  offer_id: input.offer_id,
201
201
  to_account_id: auth.account.id,
202
+ actor_id: auth.actor.id,
202
203
  ip: ctx.client_ip,
203
204
  });
204
205
  }
@@ -212,6 +213,11 @@ export const create_permit_offer_actions = (deps, options = {}) => {
212
213
  if (err instanceof PermitOfferExpiredError) {
213
214
  throw jsonrpc_errors.invalid_request({ reason: ERROR_OFFER_EXPIRED });
214
215
  }
216
+ if (err instanceof PermitOfferActorMismatchError) {
217
+ throw jsonrpc_errors.forbidden('offer is targeted to a different actor', {
218
+ reason: ERROR_OFFER_ACTOR_MISMATCH,
219
+ });
220
+ }
215
221
  throw err;
216
222
  }
217
223
  // Look up the grantor's account_id inside the transaction so the
@@ -254,7 +260,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
254
260
  };
255
261
  };
256
262
  const decline_handler = async (input, ctx) => {
257
- const auth = require_request_auth(ctx.auth);
263
+ const auth = ctx.auth;
258
264
  let declined;
259
265
  try {
260
266
  declined = await query_permit_offer_decline(ctx, input.offer_id, auth.account.id, input.reason ?? null);
@@ -268,35 +274,36 @@ export const create_permit_offer_actions = (deps, options = {}) => {
268
274
  if (!declined) {
269
275
  throw jsonrpc_errors.not_found('offer', { reason: ERROR_OFFER_NOT_FOUND });
270
276
  }
271
- void audit_log_fire_and_forget(ctx, {
277
+ // `permit_offer_decline` is *to* the offering actor — populate both
278
+ // `target_actor_id` (the grantor actor) and `target_account_id`
279
+ // (the grantor account, joined in the decline RETURNING via CTE).
280
+ // The "both populated → same account" invariant holds: the
281
+ // grantor's actor↔account binding is 1:1 by definition of `actor`.
282
+ void emit_permit_target_event(ctx, auth, deps, {
272
283
  event_type: 'permit_offer_decline',
273
- actor_id: auth.actor.id,
274
- account_id: auth.account.id,
275
- ip: ctx.client_ip,
284
+ target_account_id: declined.from_account_id,
285
+ target_actor_id: declined.from_actor_id,
276
286
  metadata: {
277
287
  offer_id: declined.id,
278
288
  role: declined.role,
279
289
  scope_id: declined.scope_id,
280
290
  reason: input.reason ?? undefined,
281
291
  },
282
- }, deps);
292
+ });
283
293
  if (notification_sender) {
284
- // Look up the grantor's account (SELECT by PK, same tx) for the
285
- // notification target. The decline reason rides along on
286
- // `offer.decline_reason` — the DB set it in the RETURNING above.
287
- const grantor_actor = await query_actor_by_id(ctx, declined.from_actor_id);
288
- const grantor_account_id = grantor_actor?.account_id ?? null;
289
- if (grantor_account_id) {
290
- const offer_json = to_permit_offer_json(declined);
291
- emit_after_commit(ctx, () => {
292
- notification_sender.send_to_account(grantor_account_id, build_permit_offer_declined_notification({ offer: offer_json }));
293
- });
294
- }
294
+ // Grantor's account_id rides on `declined.from_account_id` from
295
+ // the decline RETURNING no second SELECT needed. The decline
296
+ // reason rides along on `offer.decline_reason` — the DB set it
297
+ // in the RETURNING above.
298
+ const offer_json = to_permit_offer_json(declined);
299
+ emit_after_commit(ctx, () => {
300
+ notification_sender.send_to_account(declined.from_account_id, build_permit_offer_declined_notification({ offer: offer_json }));
301
+ });
295
302
  }
296
303
  return { ok: true };
297
304
  };
298
305
  const retract_handler = async (input, ctx) => {
299
- const auth = require_request_auth(ctx.auth);
306
+ const auth = ctx.auth;
300
307
  let retracted;
301
308
  try {
302
309
  retracted = await query_permit_offer_retract(ctx, input.offer_id, auth.actor.id);
@@ -310,17 +317,20 @@ export const create_permit_offer_actions = (deps, options = {}) => {
310
317
  if (!retracted) {
311
318
  throw jsonrpc_errors.not_found('offer', { reason: ERROR_OFFER_NOT_FOUND });
312
319
  }
313
- void audit_log_fire_and_forget(ctx, {
320
+ // `permit_offer_retract` is *from* the recipient inbox —
321
+ // `target_account_id` is the recipient account; `target_actor_id`
322
+ // inherits the offer's `to_actor_id` (set on actor-targeted
323
+ // offers, null on account-grain offers).
324
+ void emit_permit_target_event(ctx, auth, deps, {
314
325
  event_type: 'permit_offer_retract',
315
- actor_id: auth.actor.id,
316
- account_id: auth.account.id,
317
- ip: ctx.client_ip,
326
+ target_account_id: retracted.to_account_id,
327
+ target_actor_id: retracted.to_actor_id,
318
328
  metadata: {
319
329
  offer_id: retracted.id,
320
330
  role: retracted.role,
321
331
  scope_id: retracted.scope_id,
322
332
  },
323
- }, deps);
333
+ });
324
334
  if (notification_sender) {
325
335
  const offer_json = to_permit_offer_json(retracted);
326
336
  emit_after_commit(ctx, () => {
@@ -330,7 +340,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
330
340
  return { ok: true };
331
341
  };
332
342
  const list_handler = async (input, ctx) => {
333
- const auth = require_request_auth(ctx.auth);
343
+ const auth = ctx.auth;
334
344
  const target = input.account_id ?? auth.account.id;
335
345
  if (target !== auth.account.id && !has_role(auth, ROLE_ADMIN)) {
336
346
  throw jsonrpc_errors.forbidden('admin required to inspect another account');
@@ -339,7 +349,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
339
349
  return { offers: offers.map(to_permit_offer_json) };
340
350
  };
341
351
  const history_handler = async (input, ctx) => {
342
- const auth = require_request_auth(ctx.auth);
352
+ const auth = ctx.auth;
343
353
  const target = input.account_id ?? auth.account.id;
344
354
  if (target !== auth.account.id && !has_role(auth, ROLE_ADMIN)) {
345
355
  throw jsonrpc_errors.forbidden('admin required to inspect another account');
@@ -348,35 +358,32 @@ export const create_permit_offer_actions = (deps, options = {}) => {
348
358
  return { offers: offers.map(to_permit_offer_json) };
349
359
  };
350
360
  const revoke_handler = async (input, ctx) => {
351
- const auth = require_request_auth(ctx.auth);
352
- // IDOR guard + role lookup. One SELECT — returns null when the
353
- // permit is revoked, missing, or belongs to a different actor.
361
+ const auth = ctx.auth;
362
+ // IDOR guard + role lookup + actor → account JOIN. One SELECT —
363
+ // returns null when the permit is revoked, missing, or belongs
364
+ // to a different actor. The JOIN supplies `account_id` for the
365
+ // audit envelope's `target_account_id` and the post-commit
366
+ // SSE/WS socket-close fan-out target. `permit_revoke` is the
367
+ // canonical actor-bound-subject event: `target_actor_id` is the
368
+ // permit's grantee (input.actor_id); `target_account_id` is the
369
+ // account hosting that actor (sessions remain account-grain
370
+ // after multi-actor lands).
354
371
  const permit_row = await query_permit_find_active_role_for_actor(ctx, input.permit_id, input.actor_id);
355
372
  if (!permit_row) {
356
373
  throw jsonrpc_errors.not_found('permit', { reason: ERROR_PERMIT_NOT_FOUND });
357
374
  }
358
- // Resolve the target actor's account once — drives both the audit
359
- // `target_account_id` and the post-commit notification target.
360
- const target_actor = await query_actor_by_id(ctx, input.actor_id);
361
- if (!target_actor) {
362
- // The IDOR guard above already matched, so a missing actor here
363
- // indicates a race (account deleted between the two SELECTs).
364
- // Treat as account-not-found for the caller.
365
- throw jsonrpc_errors.not_found('account', { reason: ERROR_ACCOUNT_NOT_FOUND });
366
- }
367
- const target_account_id = target_actor.account_id;
375
+ const target_account_id = permit_row.account_id;
376
+ const target_actor_id = input.actor_id;
368
377
  // web_grantable gate — keeper/daemon-scoped roles stay CLI-only.
369
378
  const rc = role_options.get(permit_row.role);
370
379
  if (!rc?.web_grantable) {
371
- void audit_log_fire_and_forget(ctx, {
380
+ void emit_permit_target_event(ctx, auth, deps, {
372
381
  event_type: 'permit_revoke',
373
382
  outcome: 'failure',
374
- actor_id: auth.actor.id,
375
- account_id: auth.account.id,
376
383
  target_account_id,
377
- ip: ctx.client_ip,
384
+ target_actor_id,
378
385
  metadata: { role: permit_row.role, permit_id: input.permit_id },
379
- }, deps);
386
+ });
380
387
  throw jsonrpc_errors.forbidden('role not web-grantable', {
381
388
  reason: ERROR_ROLE_NOT_WEB_GRANTABLE,
382
389
  });
@@ -387,25 +394,26 @@ export const create_permit_offer_actions = (deps, options = {}) => {
387
394
  // the IDOR check and the UPDATE.
388
395
  throw jsonrpc_errors.not_found('permit', { reason: ERROR_PERMIT_NOT_FOUND });
389
396
  }
390
- void audit_log_fire_and_forget(ctx, {
397
+ void emit_permit_target_event(ctx, auth, deps, {
391
398
  event_type: 'permit_revoke',
392
- actor_id: auth.actor.id,
393
- account_id: auth.account.id,
394
399
  target_account_id,
395
- ip: ctx.client_ip,
400
+ target_actor_id,
396
401
  metadata: {
397
402
  role: result.role,
398
403
  permit_id: result.id,
399
404
  scope_id: result.scope_id,
400
405
  reason: input.reason ?? undefined,
401
406
  },
402
- }, deps);
407
+ });
408
+ // Supersede cascade — the recipient is known (`offer.to_account_id`),
409
+ // so populate `target_account_id` rather than leaving it null;
410
+ // `target_actor_id` inherits the offer's `to_actor_id` (actor-grain
411
+ // when the superseded offer was actor-targeted, null otherwise).
403
412
  for (const offer of result.superseded_offers) {
404
- void audit_log_fire_and_forget(ctx, {
413
+ void emit_permit_target_event(ctx, auth, deps, {
405
414
  event_type: 'permit_offer_supersede',
406
- actor_id: auth.actor.id,
407
- account_id: offer.to_account_id,
408
- ip: ctx.client_ip,
415
+ target_account_id: offer.to_account_id,
416
+ target_actor_id: offer.to_actor_id,
409
417
  metadata: {
410
418
  offer_id: offer.id,
411
419
  role: offer.role,
@@ -413,7 +421,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
413
421
  reason: 'permit_revoked',
414
422
  cause_id: result.id,
415
423
  },
416
- }, deps);
424
+ });
417
425
  }
418
426
  if (notification_sender) {
419
427
  const superseded = result.superseded_offers.map((o) => ({
@@ -441,12 +449,12 @@ export const create_permit_offer_actions = (deps, options = {}) => {
441
449
  return { ok: true, revoked: true };
442
450
  };
443
451
  return [
444
- rpc_action(permit_offer_create_action_spec, create_handler),
445
- rpc_action(permit_offer_accept_action_spec, accept_handler),
446
- rpc_action(permit_offer_decline_action_spec, decline_handler),
447
- rpc_action(permit_offer_retract_action_spec, retract_handler),
448
- rpc_action(permit_offer_list_action_spec, list_handler),
449
- rpc_action(permit_offer_history_action_spec, history_handler),
450
- rpc_action(permit_revoke_action_spec, revoke_handler),
452
+ rpc_actor_action(permit_offer_create_action_spec, create_handler),
453
+ rpc_actor_action(permit_offer_accept_action_spec, accept_handler),
454
+ rpc_actor_action(permit_offer_decline_action_spec, decline_handler),
455
+ rpc_actor_action(permit_offer_retract_action_spec, retract_handler),
456
+ rpc_actor_action(permit_offer_list_action_spec, list_handler),
457
+ rpc_actor_action(permit_offer_history_action_spec, history_handler),
458
+ rpc_actor_action(permit_revoke_action_spec, revoke_handler),
451
459
  ];
452
460
  };
@@ -62,6 +62,7 @@ export declare const PermitOfferReceivedParams: z.ZodObject<{
62
62
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
63
63
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
64
64
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
65
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
65
66
  role: z.ZodString;
66
67
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
67
68
  message: z.ZodNullable<z.ZodString>;
@@ -82,6 +83,7 @@ export declare const PermitOfferRetractedParams: z.ZodObject<{
82
83
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
83
84
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
84
85
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
86
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
85
87
  role: z.ZodString;
86
88
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
87
89
  message: z.ZodNullable<z.ZodString>;
@@ -102,6 +104,7 @@ export declare const PermitOfferAcceptedParams: z.ZodObject<{
102
104
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
103
105
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
104
106
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
107
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
105
108
  role: z.ZodString;
106
109
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
107
110
  message: z.ZodNullable<z.ZodString>;
@@ -126,6 +129,7 @@ export declare const PermitOfferDeclinedParams: z.ZodObject<{
126
129
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
127
130
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
128
131
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
132
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
129
133
  role: z.ZodString;
130
134
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
131
135
  message: z.ZodNullable<z.ZodString>;
@@ -154,6 +158,7 @@ export declare const PermitOfferSupersedeParams: z.ZodObject<{
154
158
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
155
159
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
156
160
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
161
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
157
162
  role: z.ZodString;
158
163
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
159
164
  message: z.ZodNullable<z.ZodString>;
@@ -199,6 +204,7 @@ export declare const permit_offer_received_notification_spec: {
199
204
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
200
205
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
201
206
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
207
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
202
208
  role: z.ZodString;
203
209
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
204
210
  message: z.ZodNullable<z.ZodString>;
@@ -227,6 +233,7 @@ export declare const permit_offer_retracted_notification_spec: {
227
233
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
228
234
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
229
235
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
236
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
230
237
  role: z.ZodString;
231
238
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
232
239
  message: z.ZodNullable<z.ZodString>;
@@ -255,6 +262,7 @@ export declare const permit_offer_accepted_notification_spec: {
255
262
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
256
263
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
257
264
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
265
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
258
266
  role: z.ZodString;
259
267
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
260
268
  message: z.ZodNullable<z.ZodString>;
@@ -283,6 +291,7 @@ export declare const permit_offer_declined_notification_spec: {
283
291
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
284
292
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
285
293
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
294
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
286
295
  role: z.ZodString;
287
296
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
288
297
  message: z.ZodNullable<z.ZodString>;
@@ -311,6 +320,7 @@ export declare const permit_offer_supersede_notification_spec: {
311
320
  id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
312
321
  from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
313
322
  to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
323
+ to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
314
324
  role: z.ZodString;
315
325
  scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
316
326
  message: z.ZodNullable<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"permit_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAqB,KAAK,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAIrE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAM5D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAClC,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAC;CAC5E;AAID,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,0CAA0C,2BAA2B,CAAC;AACnF,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,0CAA0C,2BAA2B,CAAC;AACnF,eAAO,MAAM,iCAAiC,kBAAkB,CAAC;AAIjE,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;kBAEpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,qEAAqE;AACrE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;kBAErC,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEpF,yEAAyE;AACzE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;kBAEpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CA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M,wCAAwC,GACpD,QAAQ,yBAAyB,KAC/B,mBAC4E,CAAC;AAEhF,eAAO,MAAM,yCAAyC,GACrD,QAAQ,0BAA0B,KAChC,mBAC6E,CAAC;AAEjF,eAAO,MAAM,gCAAgC,GAAI,QAAQ,kBAAkB,KAAG,mBACP,CAAC"}
1
+ {"version":3,"file":"permit_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAqB,KAAK,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAIrE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAM5D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAClC,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAC;CAC5E;AAID,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,0CAA0C,2BAA2B,CAAC;AACnF,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,0CAA0C,2BAA2B,CAAC;AACnF,eAAO,MAAM,iCAAiC,kBAAkB,CAAC;AAIjE,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;kBAEpC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,qEAAqE;AACrE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;kBAErC,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC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