@fuzdev/fuz_app 0.159.0 → 0.160.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 (39) hide show
  1. package/dist/actions/CLAUDE.md +7 -2
  2. package/dist/actions/protocol.d.ts +7 -0
  3. package/dist/actions/protocol.d.ts.map +1 -1
  4. package/dist/actions/protocol.js +19 -4
  5. package/dist/auth/CLAUDE.md +32 -11
  6. package/dist/auth/account_schema.d.ts +2 -2
  7. package/dist/auth/account_schema.d.ts.map +1 -1
  8. package/dist/auth/account_schema.js +1 -1
  9. package/dist/auth/role_grant_offer_action_specs.d.ts +2257 -400
  10. package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
  11. package/dist/auth/role_grant_offer_action_specs.js +103 -99
  12. package/dist/auth/role_grant_offer_actions.d.ts +6 -3
  13. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  14. package/dist/auth/role_grant_offer_actions.js +15 -6
  15. package/dist/auth/role_grant_offer_notifications.d.ts +1364 -255
  16. package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
  17. package/dist/auth/role_grant_offer_notifications.js +100 -47
  18. package/dist/auth/role_grant_offer_schema.d.ts +90 -22
  19. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  20. package/dist/auth/role_grant_offer_schema.js +40 -39
  21. package/dist/auth/scope_kind_schema.d.ts +6 -1
  22. package/dist/auth/scope_kind_schema.d.ts.map +1 -1
  23. package/dist/auth/scope_kind_schema.js +8 -3
  24. package/dist/auth/scope_kind_schema_fuz.d.ts +30 -0
  25. package/dist/auth/scope_kind_schema_fuz.d.ts.map +1 -0
  26. package/dist/auth/scope_kind_schema_fuz.js +29 -0
  27. package/dist/testing/CLAUDE.md +15 -8
  28. package/dist/testing/cross_backend/default_spine_surface.d.ts +1 -1
  29. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts +15 -3
  30. package/dist/testing/cross_backend/role_grant_offer_notification_ws.d.ts.map +1 -1
  31. package/dist/testing/cross_backend/role_grant_offer_notification_ws.js +60 -17
  32. package/dist/testing/cross_backend/spine_suites.d.ts +4 -3
  33. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  34. package/dist/testing/cross_backend/spine_suites.js +2 -1
  35. package/dist/ui/CLAUDE.md +4 -4
  36. package/dist/ui/admin_accounts_state.svelte.d.ts +8 -8
  37. package/dist/ui/role_grant_offers_state.svelte.d.ts +9 -9
  38. package/dist/ui/role_grant_offers_state.svelte.js +4 -4
  39. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAsB,KAAK,IAAI,EAAkB,MAAM,yBAAyB,CAAC;AAIxF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAM9D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAClC,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAC;CAC5E;AAID,eAAO,MAAM,6CAA6C,8BAA8B,CAAC;AACzF,eAAO,MAAM,8CAA8C,+BAA+B,CAAC;AAC3F,eAAO,MAAM,6CAA6C,8BAA8B,CAAC;AACzF,eAAO,MAAM,6CAA6C,8BAA8B,CAAC;AACzF,eAAO,MAAM,8CAA8C,+BAA+B,CAAC;AAC3F,eAAO,MAAM,qCAAqC,sBAAsB,CAAC;AAIzE,iFAAiF;AACjF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;kBAEvC,CAAC;AACH,MAAM,MAAM,4BAA4B,GA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zC,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;CAUR,CAAC;AAIzC;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,EAAE,KAAK,CAAC,SAAS,CAOhE,CAAC;AAIF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,6CAA6C,GACzD,QAAQ,6BAA6B,KACnC,mBACiF,CAAC;AAErF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,6CAA6C,GACzD,QAAQ,6BAA6B,KACnC,mBACiF,CAAC;AAErF,eAAO,MAAM,oCAAoC,GAChD,QAAQ,qBAAqB,KAC3B,mBACwE,CAAC"}
1
+ {"version":3,"file":"role_grant_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAKN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAQ9D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAClC,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAC;CAC5E;AAID,eAAO,MAAM,6CAA6C,8BAA8B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUhB,CAAC;AAEzC,eAAO,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWjB,CAAC;AAEzC,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUT,CAAC;AAczC;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,EAAE,aAAa,CAAC,MAAM,CACH,CAAC;AAEtE;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,EAAE,KAAK,CAAC,SAAS,CACwB,CAAC;AAM1F;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oCAAoC,GAChD,QAAQ,kBAAkB,EAC1B,KAAK,MAAM,KACT,kBAcF,CAAC;AAIF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,6CAA6C,GACzD,QAAQ,6BAA6B,KACnC,mBACiF,CAAC;AAErF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,4CAA4C,GACxD,QAAQ,4BAA4B,KAClC,mBACgF,CAAC;AAEpF,eAAO,MAAM,6CAA6C,GACzD,QAAQ,6BAA6B,KACnC,mBACiF,CAAC;AAErF,eAAO,MAAM,qCAAqC,GACjD,QAAQ,sBAAsB,KAC5B,mBACyE,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * `NotificationSender` interface that decouples offer/revoke send sites
4
4
  * from `ConnectionRegistry`.
5
5
  *
6
- * Six `RemoteNotificationActionSpec`s cover the consentful-role-grants
6
+ * These `RemoteNotificationActionSpec`s cover the consentful-role-grants
7
7
  * lifecycle events the server pushes to affected accounts:
8
8
  *
9
9
  * - `role_grant_offer_received` → recipient's sockets when an offer is created
@@ -13,27 +13,37 @@
13
13
  * - `role_grant_offer_supersede` → grantor's sockets when a sibling accept,
14
14
  * a revoke of the resulting role_grant, or destruction of the parent scope
15
15
  * row obsoletes their pending offer
16
- * - `role_grant_revoke` → revokee's sockets when one of their active role_grants
17
- * is revoked (companion to the `role_grant_revoke` audit event)
16
+ * - `role_grant_revoked` → revokee's sockets when one of their active
17
+ * role_grants is revoked by the `role_grant_revoke` action (companion to the
18
+ * `role_grant_revoke` audit event)
18
19
  *
19
20
  * Payloads are flat and normalized — `RoleGrantOfferJson` for the offer-lifecycle
20
21
  * notifications (decline reason rides on `offer.decline_reason`, not a
21
- * sibling field), and `{role_grant_id, role, scope_id, reason?}` for `role_grant_revoke`. The
22
- * revokee/grantor/recipient account id travels via the send target (the
23
- * `NotificationSender.send_to_account` argument), not in the payload.
22
+ * sibling field), and `{role_grant_id, role, scope_kind, scope_id, reason}`
23
+ * for `role_grant_revoked`. The revokee/grantor/recipient account id travels
24
+ * via the send target (the `NotificationSender.send_to_account` argument),
25
+ * not in the payload. The params schemas are `@fuzdev/fuz_schema` schemas.
24
26
  *
25
- * The specs surface as `EventSpec`s via `create_action_event_spec` — callers
26
- * append `role_grant_offer_notification_specs` to their `event_specs` on
27
- * `create_app_server` so the surface reflects them and DEV-mode broadcast
28
- * validation catches payload drift.
27
+ * `role_grant_offer_notification_actions` holds the specs as handler-less
28
+ * actions. `to_ws_actions` (`actions/protocol.ts`) appends them to the WS
29
+ * action set of an RPC list that carries the role_grant_offer actions, so the
30
+ * surface lists them on the WS endpoint as `remote_notification` methods. An
31
+ * inbound frame for one is still answered `method_not_found`, as no handler is
32
+ * registered. Under DEV,
33
+ * `create_role_grant_offer_actions` checks each params object it sends
34
+ * against its spec's `input` (`create_validated_notification_sender`);
35
+ * production sends unchecked.
29
36
  *
30
37
  * @module
31
38
  */
32
- import { z } from 'zod';
33
- import { Uuid as UuidSchema, bounded_string } from '../primitive_schemas.js';
39
+ import { DEV } from 'esm-env';
40
+ import { nullable, object, one_of, void as fuz_void } from '@fuzdev/fuz_schema/schema.ts';
41
+ import { Uuid as UuidSchema, bounded_string } from '../primitive_schemas_fuz.js';
34
42
  import { create_action_event_spec } from '../actions/action_bridge.js';
35
43
  import { create_jsonrpc_notification } from '../http/jsonrpc_helpers.js';
36
- import { RoleName } from './role_schema.js';
44
+ import { parse_any } from '../schema_issues.js';
45
+ import { RoleName } from './role_schema_fuz.js';
46
+ import { ScopeKindName } from './scope_kind_schema_fuz.js';
37
47
  import { RoleGrantOfferJson } from './role_grant_offer_schema.js';
38
48
  import { ROLE_GRANT_REVOKED_REASON_LENGTH_MAX } from './account_schema.js';
39
49
  // -- Method constants -------------------------------------------------------
@@ -42,18 +52,18 @@ export const ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD = 'role_grant_offer_
42
52
  export const ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD = 'role_grant_offer_accepted';
43
53
  export const ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD = 'role_grant_offer_declined';
44
54
  export const ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD = 'role_grant_offer_supersede';
45
- export const ROLE_GRANT_REVOKE_NOTIFICATION_METHOD = 'role_grant_revoke';
55
+ export const ROLE_GRANT_REVOKED_NOTIFICATION_METHOD = 'role_grant_revoked';
46
56
  // -- Params schemas ---------------------------------------------------------
47
57
  /** Params for `role_grant_offer_received` — offer delivered to its recipient. */
48
- export const RoleGrantOfferReceivedParams = z.strictObject({
58
+ export const RoleGrantOfferReceivedParams = object({
49
59
  offer: RoleGrantOfferJson
50
60
  });
51
61
  /** Params for `role_grant_offer_retracted` — grantor-side retraction. */
52
- export const RoleGrantOfferRetractedParams = z.strictObject({
62
+ export const RoleGrantOfferRetractedParams = object({
53
63
  offer: RoleGrantOfferJson
54
64
  });
55
65
  /** Params for `role_grant_offer_accepted` — recipient accepted the offer. */
56
- export const RoleGrantOfferAcceptedParams = z.strictObject({
66
+ export const RoleGrantOfferAcceptedParams = object({
57
67
  offer: RoleGrantOfferJson
58
68
  });
59
69
  /**
@@ -61,7 +71,7 @@ export const RoleGrantOfferAcceptedParams = z.strictObject({
61
71
  * inside `offer.decline_reason` — the DB stamps it on the offer row during
62
72
  * decline, so a sibling `reason` field would just duplicate it.
63
73
  */
64
- export const RoleGrantOfferDeclinedParams = z.strictObject({
74
+ export const RoleGrantOfferDeclinedParams = object({
65
75
  offer: RoleGrantOfferJson
66
76
  });
67
77
  /**
@@ -74,23 +84,25 @@ export const RoleGrantOfferDeclinedParams = z.strictObject({
74
84
  * at the accepted offer id, the revoked role_grant id, or the destroyed scope
75
85
  * row id respectively.
76
86
  */
77
- export const RoleGrantOfferSupersedeParams = z.strictObject({
87
+ export const RoleGrantOfferSupersedeParams = object({
78
88
  offer: RoleGrantOfferJson,
79
- reason: z.enum(['sibling_accepted', 'role_grant_revoked', 'scope_destroyed']),
89
+ reason: one_of(['sibling_accepted', 'role_grant_revoked', 'scope_destroyed']),
80
90
  cause_id: UuidSchema
81
91
  });
82
92
  /**
83
- * Params for `role_grant_revoke`. Delivered to the revokee's sockets when one
93
+ * Params for `role_grant_revoked`. Delivered to the revokee's sockets when one
84
94
  * of their active role_grants is revoked. Flat wire shape — `revoked_by` is
85
95
  * admin-UI-visible but deliberately omitted here (the revokee doesn't need
86
96
  * to learn the admin's identity). Target account is implicit in the send
87
- * target.
97
+ * target. `scope_kind` and `scope_id` are the revoked grant's pair, both
98
+ * `null` for a global grant; both keys are required.
88
99
  */
89
- export const RoleGrantRevokeParams = z.strictObject({
100
+ export const RoleGrantRevokedParams = object({
90
101
  role_grant_id: UuidSchema,
91
102
  role: RoleName,
92
- scope_id: UuidSchema.nullable(),
93
- reason: bounded_string({ max: ROLE_GRANT_REVOKED_REASON_LENGTH_MAX }).nullable()
103
+ scope_kind: nullable(ScopeKindName),
104
+ scope_id: nullable(UuidSchema),
105
+ reason: nullable(bounded_string({ max: ROLE_GRANT_REVOKED_REASON_LENGTH_MAX }))
94
106
  });
95
107
  // -- Action specs -----------------------------------------------------------
96
108
  export const role_grant_offer_received_notification_spec = {
@@ -100,7 +112,7 @@ export const role_grant_offer_received_notification_spec = {
100
112
  auth: null,
101
113
  side_effects: true,
102
114
  input: RoleGrantOfferReceivedParams,
103
- output: z.void(),
115
+ output: fuz_void,
104
116
  async: true,
105
117
  description: 'A new role_grant offer arrived in the recipient’s inbox.'
106
118
  };
@@ -111,7 +123,7 @@ export const role_grant_offer_retracted_notification_spec = {
111
123
  auth: null,
112
124
  side_effects: true,
113
125
  input: RoleGrantOfferRetractedParams,
114
- output: z.void(),
126
+ output: fuz_void,
115
127
  async: true,
116
128
  description: 'A pending role_grant offer was retracted by its grantor.'
117
129
  };
@@ -122,7 +134,7 @@ export const role_grant_offer_accepted_notification_spec = {
122
134
  auth: null,
123
135
  side_effects: true,
124
136
  input: RoleGrantOfferAcceptedParams,
125
- output: z.void(),
137
+ output: fuz_void,
126
138
  async: true,
127
139
  description: 'A pending role_grant offer was accepted by its recipient.'
128
140
  };
@@ -133,7 +145,7 @@ export const role_grant_offer_declined_notification_spec = {
133
145
  auth: null,
134
146
  side_effects: true,
135
147
  input: RoleGrantOfferDeclinedParams,
136
- output: z.void(),
148
+ output: fuz_void,
137
149
  async: true,
138
150
  description: 'A pending role_grant offer was declined by its recipient.'
139
151
  };
@@ -144,40 +156,81 @@ export const role_grant_offer_supersede_notification_spec = {
144
156
  auth: null,
145
157
  side_effects: true,
146
158
  input: RoleGrantOfferSupersedeParams,
147
- output: z.void(),
159
+ output: fuz_void,
148
160
  async: true,
149
161
  description: 'A grantor’s pending role_grant offer was obsoleted by a sibling accept, by revoke of the resulting role_grant, or by destruction of the parent scope row.'
150
162
  };
151
- export const role_grant_revoke_notification_spec = {
152
- method: ROLE_GRANT_REVOKE_NOTIFICATION_METHOD,
163
+ export const role_grant_revoked_notification_spec = {
164
+ method: ROLE_GRANT_REVOKED_NOTIFICATION_METHOD,
153
165
  kind: 'remote_notification',
154
166
  initiator: 'backend',
155
167
  auth: null,
156
168
  side_effects: true,
157
- input: RoleGrantRevokeParams,
158
- output: z.void(),
169
+ input: RoleGrantRevokedParams,
170
+ output: fuz_void,
159
171
  async: true,
160
172
  description: 'An active role_grant on the revokee’s account was revoked.'
161
173
  };
162
- // -- EventSpec surface ------------------------------------------------------
174
+ // -- Registries ------------------------------------------------------------
175
+ /** The role_grant_offer notification specs, in the order of their builders. */
176
+ const role_grant_offer_notification_action_specs = [
177
+ role_grant_offer_received_notification_spec,
178
+ role_grant_offer_retracted_notification_spec,
179
+ role_grant_offer_accepted_notification_spec,
180
+ role_grant_offer_declined_notification_spec,
181
+ role_grant_offer_supersede_notification_spec,
182
+ role_grant_revoked_notification_spec
183
+ ];
184
+ /**
185
+ * The role_grant_offer notifications as handler-less actions, for a WS action
186
+ * set: `to_ws_actions` (`actions/protocol.ts`) appends them when the RPC list
187
+ * carries the role_grant_offer actions, so the WS endpoint's surface lists
188
+ * them as `remote_notification` methods. With no handler they never reach
189
+ * dispatch, so an inbound frame for one is answered `method_not_found`.
190
+ */
191
+ export const role_grant_offer_notification_actions = role_grant_offer_notification_action_specs.map((spec) => ({ spec }));
163
192
  /**
164
- * SSE/WS event specs for the consentful-role-grants notification surface.
193
+ * The role_grant_offer notifications as `EventSpec`s, derived through
194
+ * `create_action_event_spec`. The notifications go to an account's WS sockets
195
+ * through `NotificationSender`, never over SSE, and the WS surface lists them
196
+ * through `role_grant_offer_notification_actions`; these are for a consumer
197
+ * that wants them as event specs, as to broadcast them on an SSE channel of
198
+ * its own.
199
+ */
200
+ export const role_grant_offer_notification_specs = role_grant_offer_notification_action_specs.map((spec) => create_action_event_spec(spec));
201
+ const notification_spec_by_method = new Map(role_grant_offer_notification_action_specs.map((spec) => [spec.method, spec]));
202
+ /**
203
+ * Wrap a `NotificationSender` so that under DEV each role_grant_offer
204
+ * notification it sends has its params checked against its spec's `input`,
205
+ * a mismatch logged as an error the way DEV output validation logs one; the
206
+ * notification is sent either way, unchanged. A method that is no
207
+ * role_grant_offer notification passes unchecked. In production the sender is
208
+ * returned as it is.
165
209
  *
166
- * Pass to `create_app_server`'s `event_specs` so the attack surface reflects
167
- * them and DEV-mode `create_validated_broadcaster` catches payload drift.
210
+ * @param sender - the sender to wrap
211
+ * @param log - where a mismatch is logged
212
+ * @returns `sender` in production, else a checking wrapper around it
168
213
  */
169
- export const role_grant_offer_notification_specs = [
170
- create_action_event_spec(role_grant_offer_received_notification_spec),
171
- create_action_event_spec(role_grant_offer_retracted_notification_spec),
172
- create_action_event_spec(role_grant_offer_accepted_notification_spec),
173
- create_action_event_spec(role_grant_offer_declined_notification_spec),
174
- create_action_event_spec(role_grant_offer_supersede_notification_spec),
175
- create_action_event_spec(role_grant_revoke_notification_spec)
176
- ];
214
+ export const create_validated_notification_sender = (sender, log) => {
215
+ if (!DEV)
216
+ return sender;
217
+ return {
218
+ send_to_account: (account_id, message) => {
219
+ const spec = notification_spec_by_method.get(message.method);
220
+ if (spec) {
221
+ const result = parse_any(spec.input, message.params);
222
+ if (!result.ok) {
223
+ log.error(`notification params schema mismatch: ${message.method}`, result.issues);
224
+ }
225
+ }
226
+ return sender.send_to_account(account_id, message);
227
+ }
228
+ };
229
+ };
177
230
  // -- Notification builders --------------------------------------------------
178
231
  export const build_role_grant_offer_received_notification = (params) => create_jsonrpc_notification(ROLE_GRANT_OFFER_RECEIVED_NOTIFICATION_METHOD, params);
179
232
  export const build_role_grant_offer_retracted_notification = (params) => create_jsonrpc_notification(ROLE_GRANT_OFFER_RETRACTED_NOTIFICATION_METHOD, params);
180
233
  export const build_role_grant_offer_accepted_notification = (params) => create_jsonrpc_notification(ROLE_GRANT_OFFER_ACCEPTED_NOTIFICATION_METHOD, params);
181
234
  export const build_role_grant_offer_declined_notification = (params) => create_jsonrpc_notification(ROLE_GRANT_OFFER_DECLINED_NOTIFICATION_METHOD, params);
182
235
  export const build_role_grant_offer_supersede_notification = (params) => create_jsonrpc_notification(ROLE_GRANT_OFFER_SUPERSEDE_NOTIFICATION_METHOD, params);
183
- export const build_role_grant_revoke_notification = (params) => create_jsonrpc_notification(ROLE_GRANT_REVOKE_NOTIFICATION_METHOD, params);
236
+ export const build_role_grant_revoked_notification = (params) => create_jsonrpc_notification(ROLE_GRANT_REVOKED_NOTIFICATION_METHOD, params);
@@ -11,8 +11,8 @@
11
11
  *
12
12
  * @module
13
13
  */
14
- import { z } from 'zod';
15
- import { Uuid } from '../primitive_schemas.js';
14
+ import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
15
+ import type { Uuid } from '../primitive_schemas.js';
16
16
  /** Maximum length of the optional message attached to an offer, and of a decline reason, in UTF-16 code units. */
17
17
  export declare const ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX = 500;
18
18
  /** Default TTL for a newly created offer — 30 days. Matches GitHub org-invite expiry. */
@@ -109,26 +109,94 @@ export interface CreateRoleGrantOfferInput {
109
109
  message?: string | null;
110
110
  expires_at: Date;
111
111
  }
112
- /** Zod schema for client-safe role_grant offer data. */
113
- export declare const RoleGrantOfferJson: z.ZodObject<{
114
- id: z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>;
115
- from_actor_id: z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>;
116
- to_account_id: z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>;
117
- to_actor_id: z.ZodNullable<z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>>;
118
- role: z.ZodString;
119
- scope_kind: z.ZodNullable<z.ZodString>;
120
- scope_id: z.ZodNullable<z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>>;
121
- message: z.ZodNullable<z.ZodString>;
122
- created_at: z.ZodString;
123
- expires_at: z.ZodString;
124
- accepted_at: z.ZodNullable<z.ZodString>;
125
- declined_at: z.ZodNullable<z.ZodString>;
126
- decline_reason: z.ZodNullable<z.ZodString>;
127
- retracted_at: z.ZodNullable<z.ZodString>;
128
- superseded_at: z.ZodNullable<z.ZodString>;
129
- resulting_role_grant_id: z.ZodNullable<z.ZodUUID & z.ZodType<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string, z.core.$ZodTypeInternals<import("@fuzdev/fuz_schema/schema.js").Branded<string, "Uuid">, string>>>;
130
- }, z.core.$strict>;
131
- export type RoleGrantOfferJson = z.infer<typeof RoleGrantOfferJson>;
112
+ /**
113
+ * Client-safe role_grant offer data, a `@fuzdev/fuz_schema` schema. `role` is
114
+ * a `RoleName` and `scope_kind` a `ScopeKindName` or `null`, so a row holding
115
+ * a name off either grammar fails it.
116
+ */
117
+ export declare const RoleGrantOfferJson: import("@fuzdev/fuz_schema/schema.ts").Schema<{
118
+ message: string | null;
119
+ id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
120
+ created_at: string;
121
+ expires_at: string;
122
+ role: string;
123
+ scope_kind: string | null;
124
+ scope_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null;
125
+ from_actor_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
126
+ to_account_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
127
+ to_actor_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null;
128
+ accepted_at: string | null;
129
+ declined_at: string | null;
130
+ decline_reason: string | null;
131
+ retracted_at: string | null;
132
+ superseded_at: string | null;
133
+ resulting_role_grant_id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null;
134
+ }, {
135
+ message: string | null;
136
+ id: string;
137
+ created_at: string;
138
+ expires_at: string;
139
+ role: string;
140
+ scope_kind: string | null;
141
+ scope_id: string | null;
142
+ from_actor_id: string;
143
+ to_account_id: string;
144
+ to_actor_id: string | null;
145
+ accepted_at: string | null;
146
+ declined_at: string | null;
147
+ decline_reason: string | null;
148
+ retracted_at: string | null;
149
+ superseded_at: string | null;
150
+ resulting_role_grant_id: string | null;
151
+ }, "object", {
152
+ id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
153
+ readonly '~types'?: {
154
+ readonly input: string;
155
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
156
+ } | undefined;
157
+ };
158
+ from_actor_id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
159
+ readonly '~types'?: {
160
+ readonly input: string;
161
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
162
+ } | undefined;
163
+ };
164
+ to_account_id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
165
+ readonly '~types'?: {
166
+ readonly input: string;
167
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
168
+ } | undefined;
169
+ };
170
+ to_actor_id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
171
+ readonly '~types'?: {
172
+ readonly input: string;
173
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
174
+ } | undefined;
175
+ }>>;
176
+ role: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
177
+ scope_kind: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>>;
178
+ scope_id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
179
+ readonly '~types'?: {
180
+ readonly input: string;
181
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
182
+ } | undefined;
183
+ }>>;
184
+ message: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
185
+ created_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
186
+ expires_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
187
+ accepted_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
188
+ declined_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
189
+ decline_reason: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>>;
190
+ retracted_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
191
+ superseded_at: import("@fuzdev/fuz_schema/schema.ts").Schema<string | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
192
+ resulting_role_grant_id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid"> | null, string | null, "nullable", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
193
+ readonly '~types'?: {
194
+ readonly input: string;
195
+ readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
196
+ } | undefined;
197
+ }>>;
198
+ }>;
199
+ export type RoleGrantOfferJson = Infer<typeof RoleGrantOfferJson>;
132
200
  /** Convert a `RoleGrantOffer` row to its JSON payload shape. */
133
201
  export declare const to_role_grant_offer_json: (offer: RoleGrantOffer) => RoleGrantOfferJson;
134
202
  //# sourceMappingURL=role_grant_offer_schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"role_grant_offer_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/role_grant_offer_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAkB,MAAM,yBAAyB,CAAC;AAI/D,kHAAkH;AAClH,eAAO,MAAM,mCAAmC,MAAM,CAAC;AAEvD,yFAAyF;AACzF,eAAO,MAAM,+BAA+B,QAA2B,CAAC;AAExE,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,IAAI,CAAC;IACT,aAAa,EAAE,IAAI,CAAC;IACpB,aAAa,EAAE,IAAI,CAAC;IACpB;;;;;;;;;;;OAWG;IACH,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;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IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8C9B,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElE,gEAAgE;AAChE,eAAO,MAAM,wBAAwB,GAAI,OAAO,cAAc,KAAG,kBAiB/D,CAAC"}
@@ -11,59 +11,60 @@
11
11
  *
12
12
  * @module
13
13
  */
14
- import { z } from 'zod';
15
- import { Uuid, bounded_string } from '../primitive_schemas.js';
16
- import { RoleName } from './role_schema.js';
14
+ import { meta } from '@fuzdev/fuz_schema/meta.ts';
15
+ import { nullable, object, string } from '@fuzdev/fuz_schema/schema.ts';
16
+ import { Uuid as UuidSchema, bounded_string } from '../primitive_schemas_fuz.js';
17
+ import { RoleName } from './role_schema_fuz.js';
18
+ import { ScopeKindName } from './scope_kind_schema_fuz.js';
17
19
  /** Maximum length of the optional message attached to an offer, and of a decline reason, in UTF-16 code units. */
18
20
  export const ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX = 500;
19
21
  /** Default TTL for a newly created offer — 30 days. Matches GitHub org-invite expiry. */
20
22
  export const ROLE_GRANT_OFFER_DEFAULT_TTL_MS = 30 * 24 * 60 * 60 * 1000;
21
- /** Zod schema for client-safe role_grant offer data. */
22
- export const RoleGrantOfferJson = z
23
- .strictObject({
24
- id: Uuid.meta({ description: 'Offer id.' }),
25
- from_actor_id: Uuid.meta({ description: 'Actor that issued the offer.' }),
26
- to_account_id: Uuid.meta({ description: 'Account the offer is directed to.' }),
27
- to_actor_id: Uuid.nullable().meta({
23
+ /**
24
+ * Client-safe role_grant offer data, a `@fuzdev/fuz_schema` schema. `role` is
25
+ * a `RoleName` and `scope_kind` a `ScopeKindName` or `null`, so a row holding
26
+ * a name off either grammar fails it.
27
+ */
28
+ export const RoleGrantOfferJson = meta(object({
29
+ id: meta(UuidSchema, { description: 'Offer id.' }),
30
+ from_actor_id: meta(UuidSchema, { description: 'Actor that issued the offer.' }),
31
+ to_account_id: meta(UuidSchema, { description: 'Account the offer is directed to.' }),
32
+ to_actor_id: meta(nullable(UuidSchema), {
28
33
  description: 'Optional actor-grain target on the recipient account. When set, only this actor may accept; when null any actor on `to_account_id` may accept.'
29
34
  }),
30
- role: RoleName.meta({ description: 'Role being offered.' }),
31
- scope_kind: z.string().nullable().meta({
35
+ role: meta(RoleName, { description: 'Role being offered.' }),
36
+ scope_kind: meta(nullable(ScopeKindName), {
32
37
  description: 'Machine-readable kind tag for `scope_id` — paired-null with `scope_id` (both null for global, both non-null for scoped).'
33
38
  }),
34
- scope_id: Uuid.nullable().meta({
39
+ scope_id: meta(nullable(UuidSchema), {
35
40
  description: 'Scope the offered role_grant applies to (e.g. a classroom id). `null` for global role_grants.'
36
41
  }),
37
- message: bounded_string({ max: ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX })
38
- .nullable()
39
- .meta({ description: 'Optional free-form note from the grantor.' }),
40
- created_at: z.string().meta({ description: 'ISO timestamp when the offer was created.' }),
41
- expires_at: z
42
- .string()
43
- .meta({ description: 'ISO timestamp after which the offer is no longer valid.' }),
44
- accepted_at: z
45
- .string()
46
- .nullable()
47
- .meta({ description: 'ISO timestamp when the offer was accepted.' }),
48
- declined_at: z
49
- .string()
50
- .nullable()
51
- .meta({ description: 'ISO timestamp when the offer was declined.' }),
52
- decline_reason: bounded_string({ max: ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX })
53
- .nullable()
54
- .meta({ description: 'Optional reason given on decline.' }),
55
- retracted_at: z
56
- .string()
57
- .nullable()
58
- .meta({ description: 'ISO timestamp when the grantor retracted the offer.' }),
59
- superseded_at: z.string().nullable().meta({
42
+ message: meta(nullable(bounded_string({ max: ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX })), {
43
+ description: 'Optional free-form note from the grantor.'
44
+ }),
45
+ created_at: meta(string, { description: 'ISO timestamp when the offer was created.' }),
46
+ expires_at: meta(string, {
47
+ description: 'ISO timestamp after which the offer is no longer valid.'
48
+ }),
49
+ accepted_at: meta(nullable(string), {
50
+ description: 'ISO timestamp when the offer was accepted.'
51
+ }),
52
+ declined_at: meta(nullable(string), {
53
+ description: 'ISO timestamp when the offer was declined.'
54
+ }),
55
+ decline_reason: meta(nullable(bounded_string({ max: ROLE_GRANT_OFFER_MESSAGE_LENGTH_MAX })), {
56
+ description: 'Optional reason given on decline.'
57
+ }),
58
+ retracted_at: meta(nullable(string), {
59
+ description: 'ISO timestamp when the grantor retracted the offer.'
60
+ }),
61
+ superseded_at: meta(nullable(string), {
60
62
  description: 'ISO timestamp when this offer was obsoleted by a sibling accept or by revoke of the resulting role_grant.'
61
63
  }),
62
- resulting_role_grant_id: Uuid.nullable().meta({
64
+ resulting_role_grant_id: meta(nullable(UuidSchema), {
63
65
  description: 'Role grant produced by accepting this offer. `null` until/unless accepted.'
64
66
  })
65
- })
66
- .meta({ description: 'A role_grant offer — a pending grant awaiting recipient consent.' });
67
+ }), { description: 'A role_grant offer — a pending grant awaiting recipient consent.' });
67
68
  /** Convert a `RoleGrantOffer` row to its JSON payload shape. */
68
69
  export const to_role_grant_offer_json = (offer) => ({
69
70
  id: offer.id,
@@ -50,10 +50,15 @@ export declare const SCOPE_KIND_NAME_REGEX: RegExp;
50
50
  * spine's `SCOPE_KIND_LENGTH_MAX`.
51
51
  */
52
52
  export declare const SCOPE_KIND_LENGTH_MAX = 64;
53
+ /** The message of a scope-kind name longer than `SCOPE_KIND_LENGTH_MAX`, in both `ScopeKindName`s. */
54
+ export declare const SCOPE_KIND_NAME_LENGTH_MESSAGE = "Scope-kind names must be at most 64 characters";
55
+ /** The message of a scope-kind name outside `SCOPE_KIND_NAME_REGEX`, in both `ScopeKindName`s. */
56
+ export declare const SCOPE_KIND_NAME_PATTERN_MESSAGE = "Scope-kind names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores";
53
57
  /**
54
58
  * Zod schema for valid scope-kind name strings: a registered name, and the
55
59
  * `scope_kind` the grant inputs take. Twin of the Rust spine's
56
- * `is_valid_scope_kind_name`.
60
+ * `is_valid_scope_kind_name`, and of the `@fuzdev/fuz_schema` `ScopeKindName`
61
+ * in `auth/scope_kind_schema_fuz.ts`, built from the same constants.
57
62
  */
58
63
  export declare const ScopeKindName: z.ZodString;
59
64
  export type ScopeKindName = z.infer<typeof ScopeKindName>;
@@ -1 +1 @@
1
- {"version":3,"file":"scope_kind_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/scope_kind_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAyB,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,aAAa,aAMzB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACrC;;;;;OAKG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,wBAAwB,GACpC,gBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAC3C,qBAwBF,CAAC"}
1
+ {"version":3,"file":"scope_kind_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/scope_kind_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAyB,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,sGAAsG;AACtG,eAAO,MAAM,8BAA8B,mDAAyE,CAAC;AAErH,kGAAkG;AAClG,eAAO,MAAM,+BAA+B,uHACyE,CAAC;AAEtH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,aAGsC,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,gFAAgF;AAChF,MAAM,WAAW,qBAAqB;IACrC;;;;;OAKG;IACH,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,wBAAwB,GACpC,gBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAC3C,qBAwBF,CAAC"}
@@ -51,15 +51,20 @@ export const SCOPE_KIND_NAME_REGEX = /^[a-z]+(?:_[a-z]+)*$/;
51
51
  * spine's `SCOPE_KIND_LENGTH_MAX`.
52
52
  */
53
53
  export const SCOPE_KIND_LENGTH_MAX = 64;
54
+ /** The message of a scope-kind name longer than `SCOPE_KIND_LENGTH_MAX`, in both `ScopeKindName`s. */
55
+ export const SCOPE_KIND_NAME_LENGTH_MESSAGE = `Scope-kind names must be at most ${SCOPE_KIND_LENGTH_MAX} characters`;
56
+ /** The message of a scope-kind name outside `SCOPE_KIND_NAME_REGEX`, in both `ScopeKindName`s. */
57
+ export const SCOPE_KIND_NAME_PATTERN_MESSAGE = 'Scope-kind names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores';
54
58
  /**
55
59
  * Zod schema for valid scope-kind name strings: a registered name, and the
56
60
  * `scope_kind` the grant inputs take. Twin of the Rust spine's
57
- * `is_valid_scope_kind_name`.
61
+ * `is_valid_scope_kind_name`, and of the `@fuzdev/fuz_schema` `ScopeKindName`
62
+ * in `auth/scope_kind_schema_fuz.ts`, built from the same constants.
58
63
  */
59
64
  export const ScopeKindName = bounded_string({
60
65
  max: SCOPE_KIND_LENGTH_MAX,
61
- max_message: `Scope-kind names must be at most ${SCOPE_KIND_LENGTH_MAX} characters`
62
- }).regex(SCOPE_KIND_NAME_REGEX, 'Scope-kind names must be lowercase letters and underscores (a-z_), no leading, trailing or consecutive underscores');
66
+ max_message: SCOPE_KIND_NAME_LENGTH_MESSAGE
67
+ }).regex(SCOPE_KIND_NAME_REGEX, SCOPE_KIND_NAME_PATTERN_MESSAGE);
63
68
  /**
64
69
  * Create a scope-kind schema from a consumer-declared registry.
65
70
  *