@usehercules/convex 0.0.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 (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +478 -0
  3. package/dist/_generated/component.d.ts +184 -0
  4. package/dist/_generated/component.d.ts.map +1 -0
  5. package/dist/_generated/component.js +11 -0
  6. package/dist/_generated/component.js.map +1 -0
  7. package/dist/checker/cli.d.ts +3 -0
  8. package/dist/checker/cli.d.ts.map +1 -0
  9. package/dist/checker/cli.js +71 -0
  10. package/dist/checker/cli.js.map +1 -0
  11. package/dist/checker/index.d.ts +28 -0
  12. package/dist/checker/index.d.ts.map +1 -0
  13. package/dist/checker/index.js +1928 -0
  14. package/dist/checker/index.js.map +1 -0
  15. package/dist/client/access-admin.d.ts +818 -0
  16. package/dist/client/access-admin.d.ts.map +1 -0
  17. package/dist/client/access-admin.js +1830 -0
  18. package/dist/client/access-admin.js.map +1 -0
  19. package/dist/client/http.d.ts +19 -0
  20. package/dist/client/http.d.ts.map +1 -0
  21. package/dist/client/http.js +76 -0
  22. package/dist/client/http.js.map +1 -0
  23. package/dist/client/index.d.ts +440 -0
  24. package/dist/client/index.d.ts.map +1 -0
  25. package/dist/client/index.js +654 -0
  26. package/dist/client/index.js.map +1 -0
  27. package/dist/component/authz.d.ts +114 -0
  28. package/dist/component/authz.d.ts.map +1 -0
  29. package/dist/component/authz.js +168 -0
  30. package/dist/component/authz.js.map +1 -0
  31. package/dist/component/checks.d.ts +86 -0
  32. package/dist/component/checks.d.ts.map +1 -0
  33. package/dist/component/checks.js +184 -0
  34. package/dist/component/checks.js.map +1 -0
  35. package/dist/component/convex.config.d.ts +3 -0
  36. package/dist/component/convex.config.d.ts.map +1 -0
  37. package/dist/component/convex.config.js +3 -0
  38. package/dist/component/convex.config.js.map +1 -0
  39. package/dist/component/effective.d.ts +82 -0
  40. package/dist/component/effective.d.ts.map +1 -0
  41. package/dist/component/effective.js +757 -0
  42. package/dist/component/effective.js.map +1 -0
  43. package/dist/component/queries.d.ts +170 -0
  44. package/dist/component/queries.d.ts.map +1 -0
  45. package/dist/component/queries.js +633 -0
  46. package/dist/component/queries.js.map +1 -0
  47. package/dist/component/schema.d.ts +258 -0
  48. package/dist/component/schema.d.ts.map +1 -0
  49. package/dist/component/schema.js +222 -0
  50. package/dist/component/schema.js.map +1 -0
  51. package/dist/component/sync.d.ts +85 -0
  52. package/dist/component/sync.d.ts.map +1 -0
  53. package/dist/component/sync.js +851 -0
  54. package/dist/component/sync.js.map +1 -0
  55. package/dist/shared/projection-protocol.d.ts +1624 -0
  56. package/dist/shared/projection-protocol.d.ts.map +1 -0
  57. package/dist/shared/projection-protocol.js +561 -0
  58. package/dist/shared/projection-protocol.js.map +1 -0
  59. package/dist/shared/sync.d.ts +24 -0
  60. package/dist/shared/sync.d.ts.map +1 -0
  61. package/dist/shared/sync.js +18 -0
  62. package/dist/shared/sync.js.map +1 -0
  63. package/dist/shared/token.d.ts +5 -0
  64. package/dist/shared/token.d.ts.map +1 -0
  65. package/dist/shared/token.js +19 -0
  66. package/dist/shared/token.js.map +1 -0
  67. package/package.json +89 -0
@@ -0,0 +1,818 @@
1
+ import type { ActionBuilder, GenericActionCtx, GenericDataModel } from "convex/server";
2
+ import type { AccessDeploymentEntryMirrorResult, Membership, ScopeRoleSummary } from "./index";
3
+ declare const DEFAULT_API_VERSION = "2025-12-09";
4
+ type WriteResult = Record<string, unknown>;
5
+ export type AccessBindingAppliesTo = "self" | "self_and_descendants";
6
+ export type AccessResourceGrantWriteResult = {
7
+ accessScopeId: string;
8
+ grantId: string;
9
+ changed: boolean;
10
+ sourceVersion: number;
11
+ projectionIds: string[];
12
+ };
13
+ export type AccessResourceGrantsReplaceResult = {
14
+ accessScopeId: string;
15
+ resourceType: string;
16
+ resourceId: string;
17
+ subjects: Array<{
18
+ principalId: string;
19
+ grants: Array<{
20
+ grantId: string;
21
+ roleId: string | null;
22
+ permissionId: string | null;
23
+ appliesTo: AccessBindingAppliesTo;
24
+ expiresAt: string | null;
25
+ }>;
26
+ }>;
27
+ changed: boolean;
28
+ sourceVersion: number;
29
+ projectionIds: string[];
30
+ };
31
+ export type AccessMemberRolesReplaceResult = {
32
+ accessScopeId: string;
33
+ principalId: string;
34
+ roleIds: string[];
35
+ changed: boolean;
36
+ sourceVersion: number;
37
+ projectionIds: string[];
38
+ };
39
+ export type AccessGrantableRoleTarget = {
40
+ type: "scope";
41
+ } | {
42
+ type: "resource";
43
+ resourceType: string;
44
+ resourceId: string;
45
+ appliesTo?: AccessBindingAppliesTo;
46
+ };
47
+ export type AccessGrantableRoleListResult = {
48
+ accessScopeId: string;
49
+ roles: ScopeRoleSummary[];
50
+ };
51
+ export type AccessScopeCreateResult = {
52
+ accessScopeId: string;
53
+ created?: boolean;
54
+ sourceVersion: number;
55
+ projectionIds: string[];
56
+ };
57
+ export type AccessInvitationCreateResult = {
58
+ accessScopeId: string;
59
+ invitationId: string;
60
+ email: string;
61
+ roleIds: string[];
62
+ token: string;
63
+ acceptUrl: string;
64
+ expiresAt: string;
65
+ sourceVersion: number;
66
+ projectionIds: string[];
67
+ };
68
+ export type AccessInvitationAcceptResult = {
69
+ accessScopeId: string;
70
+ invitationId: string;
71
+ principalId: string;
72
+ roleIds: string[];
73
+ changed?: boolean;
74
+ sourceVersion: number;
75
+ projectionIds: string[];
76
+ };
77
+ export type AccessDeploymentEntryResult = {
78
+ allowed: boolean;
79
+ reason: string;
80
+ principalId?: string;
81
+ status?: "active" | "blocked" | "suspended" | "pending_approval" | "removed";
82
+ stateVersion: number;
83
+ changed: boolean;
84
+ };
85
+ export type AccessGroupListResult = {
86
+ accessScopeId: string;
87
+ groups: Array<{
88
+ groupPrincipalId: string;
89
+ name: string | null;
90
+ memberCount: number;
91
+ archived: boolean;
92
+ archivedAt: string | null;
93
+ createdAt: string;
94
+ updatedAt: string;
95
+ }>;
96
+ };
97
+ export type AccessGroupWriteResult = {
98
+ accessScopeId: string;
99
+ groupPrincipalId: string;
100
+ changed?: boolean;
101
+ sourceVersion: number;
102
+ projectionIds: string[];
103
+ };
104
+ export type AccessGroupMemberWriteResult = AccessGroupWriteResult & {
105
+ memberPrincipalId: string;
106
+ membershipId?: string;
107
+ };
108
+ export type AccessResourceInvitationListResult = {
109
+ accessScopeId: string;
110
+ invitations: Array<{
111
+ invitationId: string;
112
+ email: string;
113
+ resourceType: string;
114
+ resourceId: string;
115
+ conferralType: "role" | "permission" | null;
116
+ roleId: string | null;
117
+ permissionId: string | null;
118
+ appliesTo: AccessBindingAppliesTo;
119
+ expiresAt: string;
120
+ createdAt: string;
121
+ updatedAt: string;
122
+ }>;
123
+ };
124
+ export type AccessRoleOverridesResult = {
125
+ accessScopeId: string;
126
+ roleId: string;
127
+ overrides: Array<{
128
+ permissionId: string;
129
+ permissionKey: string;
130
+ effect: "allow" | "deny";
131
+ }>;
132
+ };
133
+ export type AccessUserExceptionsResult = {
134
+ accessScopeId: string;
135
+ principalId: string;
136
+ exceptions: Array<{
137
+ permissionId: string;
138
+ permissionKey: string;
139
+ effect: "allow" | "deny";
140
+ expiresAt: string | null;
141
+ }>;
142
+ };
143
+ export type AccessAdminSdkClient = {
144
+ post<T>(path: string, options: {
145
+ body: Record<string, unknown>;
146
+ }): Promise<T>;
147
+ };
148
+ type AccessAdminApiOptions = {
149
+ apiKey?: string;
150
+ apiKeyEnvVar?: string;
151
+ apiVersion?: typeof DEFAULT_API_VERSION;
152
+ client?: AccessAdminSdkClient;
153
+ };
154
+ export type CreateAccessAdminActionsOptions<DataModel extends GenericDataModel> = AccessAdminApiOptions & {
155
+ internalAction: ActionBuilder<DataModel, "internal">;
156
+ };
157
+ export type CreateAccessUserActionsOptions<DataModel extends GenericDataModel> = AccessAdminApiOptions & {
158
+ authenticatedAction: ActionBuilder<DataModel, "public">;
159
+ getDeploymentEntryStatus?: (ctx: GenericActionCtx<DataModel>) => Promise<AccessDeploymentEntryMirrorResult>;
160
+ };
161
+ export type AccessAccountEntryMode = "open" | "allowlisted_only" | "invite_only" | "approval_required";
162
+ export type CreateAccessScopeArgs = {
163
+ name: string;
164
+ defaultRoleKey?: string;
165
+ accountEntryMode?: AccessAccountEntryMode;
166
+ };
167
+ export type CreateAccessInvitationArgs = {
168
+ scopeId: string;
169
+ email: string;
170
+ roleIds?: string[];
171
+ roleKeys?: string[];
172
+ expiresInDays?: number;
173
+ };
174
+ export type CreateResourceInvitationArgs = {
175
+ scopeId: string;
176
+ email: string;
177
+ resourceType: string;
178
+ resourceId: string;
179
+ /** Conferred grant — exactly one of these. A custom role or a single permission. */
180
+ roleKey?: string;
181
+ permissionKey?: string;
182
+ appliesTo?: AccessBindingAppliesTo;
183
+ expiresInDays?: number;
184
+ };
185
+ export type AcceptAccessInvitationArgs = {
186
+ token: string;
187
+ /**
188
+ * The signed-in user's OIDC ID token (`user.id_token`): a JWT with three
189
+ * dot-separated segments. Never pass a user or subject id (for example
190
+ * `user.profile.sub`); the control plane verifies the token signature, so a
191
+ * bare id is rejected.
192
+ */
193
+ idToken: string;
194
+ };
195
+ export type CreateAccessScopeContext = {
196
+ auth: {
197
+ getUserIdentity(): Promise<{
198
+ tokenIdentifier?: string | null;
199
+ } | null>;
200
+ };
201
+ };
202
+ export type CreateAccessScopeActionOptions<DataModel extends GenericDataModel> = AccessAdminApiOptions & {
203
+ authenticatedAction: ActionBuilder<DataModel, "public">;
204
+ canCreateScope: (ctx: CreateAccessScopeContext, args: CreateAccessScopeArgs) => boolean | Promise<boolean>;
205
+ };
206
+ export type ResourceCreatorBootstrapTarget = {
207
+ scopeId: string;
208
+ resourceId: string;
209
+ creatorHerculesAuthUserId: string;
210
+ state: "provisioning" | "active";
211
+ };
212
+ export type ResourceCreatorBootstrapResult = {
213
+ resourceId: string;
214
+ state: "active";
215
+ bootstrapped: false;
216
+ } | {
217
+ resourceId: string;
218
+ state: "active";
219
+ bootstrapped: true;
220
+ grant: AccessResourceGrantWriteResult;
221
+ };
222
+ export type CreateResourceCreatorBootstrapActionOptions<DataModel extends GenericDataModel> = AccessAdminApiOptions & {
223
+ authenticatedAction: ActionBuilder<DataModel, "public">;
224
+ resourceType: string;
225
+ managerRoleKey: string;
226
+ appliesTo: AccessBindingAppliesTo;
227
+ getBootstrapTarget: (ctx: GenericActionCtx<DataModel>, args: {
228
+ resourceId: string;
229
+ }) => Promise<ResourceCreatorBootstrapTarget | null>;
230
+ listMyMemberships: (ctx: GenericActionCtx<DataModel>) => Promise<Membership[]>;
231
+ activateResource: (ctx: GenericActionCtx<DataModel>, args: {
232
+ resourceId: string;
233
+ creatorHerculesAuthUserId: string;
234
+ grant: AccessResourceGrantWriteResult;
235
+ }) => Promise<void>;
236
+ };
237
+ /**
238
+ * Builds the managed Access Control write actions (assign/remove roles,
239
+ * invite, create org custom roles, resource grants, overrides, expiries,
240
+ * member lifecycle, admission rules, entry mode, and groups) plus the raw
241
+ * reads backing them (group/resource-invitation lists, role overrides, user
242
+ * exceptions). Each one calls the Hercules control plane, so it needs the
243
+ * `HERCULES_API_KEY` secret. Wire it once in `convex/accessAdmin.ts` and
244
+ * re-export the actions you use.
245
+ *
246
+ * These are internal service-authority actions. Do not re-export them as public
247
+ * Convex actions. Use {@link createAccessUserActions} for public resource
248
+ * management by signed-in app users.
249
+ */
250
+ export declare function createAccessAdminActions<DataModel extends GenericDataModel>(options: CreateAccessAdminActionsOptions<DataModel>): {
251
+ archiveScope: import("convex/server").RegisteredAction<"internal", {
252
+ scopeId: string;
253
+ }, Promise<WriteResult>>;
254
+ setDefaultRole: import("convex/server").RegisteredAction<"internal", {
255
+ roleId?: string | undefined;
256
+ roleKey?: string | undefined;
257
+ scopeId: string;
258
+ }, Promise<WriteResult>>;
259
+ createInvitation: import("convex/server").RegisteredAction<"internal", {
260
+ roleIds?: string[] | undefined;
261
+ roleKeys?: string[] | undefined;
262
+ expiresInDays?: number | undefined;
263
+ email: string;
264
+ scopeId: string;
265
+ }, Promise<AccessInvitationCreateResult>>;
266
+ revokeInvitation: import("convex/server").RegisteredAction<"internal", {
267
+ scopeId: string;
268
+ invitationId: string;
269
+ }, Promise<WriteResult>>;
270
+ assignRole: import("convex/server").RegisteredAction<"internal", {
271
+ herculesAuthUserId?: string | undefined;
272
+ roleId?: string | undefined;
273
+ principalId?: string | undefined;
274
+ roleKey?: string | undefined;
275
+ scopeId: string;
276
+ }, Promise<WriteResult>>;
277
+ removeRole: import("convex/server").RegisteredAction<"internal", {
278
+ herculesAuthUserId?: string | undefined;
279
+ roleId?: string | undefined;
280
+ principalId?: string | undefined;
281
+ roleKey?: string | undefined;
282
+ scopeId: string;
283
+ }, Promise<WriteResult>>;
284
+ createOrgCustomRole: import("convex/server").RegisteredAction<"internal", {
285
+ key?: string | undefined;
286
+ description?: string | undefined;
287
+ name: string;
288
+ scopeId: string;
289
+ permissionKeys: string[];
290
+ }, Promise<WriteResult>>;
291
+ updateRolePermissions: import("convex/server").RegisteredAction<"internal", {
292
+ roleId?: string | undefined;
293
+ roleKey?: string | undefined;
294
+ scopeId: string;
295
+ permissionKeys: string[];
296
+ }, Promise<WriteResult>>;
297
+ setUserExceptions: import("convex/server").RegisteredAction<"internal", {
298
+ herculesAuthUserId?: string | undefined;
299
+ principalId?: string | undefined;
300
+ allow: string[];
301
+ deny: string[];
302
+ scopeId: string;
303
+ }, Promise<WriteResult>>;
304
+ createResourceGrant: import("convex/server").RegisteredAction<"internal", {
305
+ herculesAuthUserId?: string | undefined;
306
+ principalId?: string | undefined;
307
+ appliesTo?: "self" | "self_and_descendants" | undefined;
308
+ expiresAt?: string | null | undefined;
309
+ permissionKey?: string | undefined;
310
+ roleKey?: string | undefined;
311
+ resourceType: string;
312
+ resourceId: string;
313
+ scopeId: string;
314
+ }, Promise<AccessResourceGrantWriteResult>>;
315
+ replaceResourceGrants: import("convex/server").RegisteredAction<"internal", {
316
+ resourceType: string;
317
+ resourceId: string;
318
+ scopeId: string;
319
+ subjects: {
320
+ herculesAuthUserId?: string | undefined;
321
+ principalId?: string | undefined;
322
+ grants: {
323
+ appliesTo?: "self" | "self_and_descendants" | undefined;
324
+ expiresAt?: string | null | undefined;
325
+ permissionKey?: string | undefined;
326
+ roleKey?: string | undefined;
327
+ }[];
328
+ }[];
329
+ }, Promise<AccessResourceGrantsReplaceResult>>;
330
+ replaceMemberRoles: import("convex/server").RegisteredAction<"internal", {
331
+ herculesAuthUserId?: string | undefined;
332
+ principalId?: string | undefined;
333
+ scopeId: string;
334
+ roleKeys: string[];
335
+ }, Promise<AccessMemberRolesReplaceResult>>;
336
+ createResourceInvitation: import("convex/server").RegisteredAction<"internal", {
337
+ appliesTo?: "self" | "self_and_descendants" | undefined;
338
+ permissionKey?: string | undefined;
339
+ roleKey?: string | undefined;
340
+ expiresInDays?: number | undefined;
341
+ email: string;
342
+ resourceType: string;
343
+ resourceId: string;
344
+ scopeId: string;
345
+ }, Promise<AccessInvitationCreateResult>>;
346
+ setResourcePermissionRule: import("convex/server").RegisteredAction<"internal", {
347
+ appliesTo?: "self" | "self_and_descendants" | undefined;
348
+ expiresAt?: string | null | undefined;
349
+ resourceType: string;
350
+ effect: "allow" | "deny";
351
+ scopeId: string;
352
+ permissionKey: string;
353
+ target: {
354
+ mode: "all";
355
+ } | {
356
+ resourceId: string;
357
+ mode: "specific";
358
+ };
359
+ subject: {
360
+ type: "principal";
361
+ principalId: string;
362
+ } | {
363
+ type: "role";
364
+ roleKey: string;
365
+ };
366
+ }, Promise<WriteResult>>;
367
+ setResourcePermissionRules: import("convex/server").RegisteredAction<"internal", {
368
+ appliesTo?: "self" | "self_and_descendants" | undefined;
369
+ resourceType: string;
370
+ scopeId: string;
371
+ target: {
372
+ mode: "all";
373
+ } | {
374
+ resourceId: string;
375
+ mode: "specific";
376
+ };
377
+ subject: {
378
+ type: "principal";
379
+ principalId: string;
380
+ } | {
381
+ type: "role";
382
+ roleKey: string;
383
+ };
384
+ rules: {
385
+ expiresAt?: string | null | undefined;
386
+ effect: "allow" | "deny" | "clear";
387
+ permissionKey: string;
388
+ }[];
389
+ }, Promise<WriteResult>>;
390
+ revokeResourceGrant: import("convex/server").RegisteredAction<"internal", {
391
+ scopeId: string;
392
+ grantId: string;
393
+ }, Promise<AccessResourceGrantWriteResult>>;
394
+ setGrantExpiry: import("convex/server").RegisteredAction<"internal", {
395
+ expiresAt: string | null;
396
+ scopeId: string;
397
+ grantId: string;
398
+ }, Promise<AccessResourceGrantWriteResult>>;
399
+ setRoleOverride: import("convex/server").RegisteredAction<"internal", {
400
+ allow: string[];
401
+ deny: string[];
402
+ scopeId: string;
403
+ roleKey: string;
404
+ }, Promise<WriteResult>>;
405
+ addMember: import("convex/server").RegisteredAction<"internal", {
406
+ roleId?: string | undefined;
407
+ roleKey?: string | undefined;
408
+ herculesAuthUserId: string;
409
+ scopeId: string;
410
+ }, Promise<WriteResult>>;
411
+ setMemberStatus: import("convex/server").RegisteredAction<"internal", {
412
+ status: "active" | "suspended";
413
+ principalId: string;
414
+ scopeId: string;
415
+ }, Promise<WriteResult>>;
416
+ removeMember: import("convex/server").RegisteredAction<"internal", {
417
+ principalId: string;
418
+ scopeId: string;
419
+ }, Promise<WriteResult>>;
420
+ approveMember: import("convex/server").RegisteredAction<"internal", {
421
+ principalId: string;
422
+ scopeId: string;
423
+ }, Promise<WriteResult>>;
424
+ upsertAdmissionRule: import("convex/server").RegisteredAction<"internal", {
425
+ reason?: string | null | undefined;
426
+ effect: "allow" | "deny";
427
+ scopeId: string;
428
+ subjectType: "email" | "domain";
429
+ subjectValue: string;
430
+ }, Promise<WriteResult>>;
431
+ archiveAdmissionRule: import("convex/server").RegisteredAction<"internal", {
432
+ scopeId: string;
433
+ ruleId: string;
434
+ }, Promise<WriteResult>>;
435
+ setAccountEntryMode: import("convex/server").RegisteredAction<"internal", {
436
+ accountEntryMode: "open" | "allowlisted_only" | "invite_only" | "approval_required";
437
+ scopeId: string;
438
+ }, Promise<WriteResult>>;
439
+ createGroup: import("convex/server").RegisteredAction<"internal", {
440
+ name: string;
441
+ scopeId: string;
442
+ }, Promise<AccessGroupWriteResult>>;
443
+ renameGroup: import("convex/server").RegisteredAction<"internal", {
444
+ name: string;
445
+ groupPrincipalId: string;
446
+ scopeId: string;
447
+ }, Promise<AccessGroupWriteResult>>;
448
+ archiveGroup: import("convex/server").RegisteredAction<"internal", {
449
+ groupPrincipalId: string;
450
+ scopeId: string;
451
+ }, Promise<AccessGroupWriteResult>>;
452
+ listGroups: import("convex/server").RegisteredAction<"internal", {
453
+ includeArchived?: boolean | undefined;
454
+ scopeId: string;
455
+ }, Promise<AccessGroupListResult>>;
456
+ addGroupMember: import("convex/server").RegisteredAction<"internal", {
457
+ groupPrincipalId: string;
458
+ memberPrincipalId: string;
459
+ scopeId: string;
460
+ }, Promise<AccessGroupMemberWriteResult>>;
461
+ removeGroupMember: import("convex/server").RegisteredAction<"internal", {
462
+ groupPrincipalId: string;
463
+ memberPrincipalId: string;
464
+ scopeId: string;
465
+ }, Promise<AccessGroupMemberWriteResult>>;
466
+ listResourceInvitations: import("convex/server").RegisteredAction<"internal", {
467
+ scopeId: string;
468
+ }, Promise<AccessResourceInvitationListResult>>;
469
+ getRoleOverrides: import("convex/server").RegisteredAction<"internal", {
470
+ roleId?: string | undefined;
471
+ roleKey?: string | undefined;
472
+ scopeId: string;
473
+ }, Promise<AccessRoleOverridesResult>>;
474
+ getUserExceptions: import("convex/server").RegisteredAction<"internal", {
475
+ herculesAuthUserId?: string | undefined;
476
+ principalId?: string | undefined;
477
+ scopeId: string;
478
+ }, Promise<AccessUserExceptionsResult>>;
479
+ };
480
+ /**
481
+ * Builds authenticated public actions for end-user access management. The
482
+ * control plane verifies the supplied ID token and applies the operation's
483
+ * scope, Owner, or resource-level RBAC gate.
484
+ *
485
+ * Every action's `idToken` argument must be the signed-in user's OIDC ID token
486
+ * (`user.id_token`): a JWT with three dot-separated segments. Never pass a user
487
+ * or subject id (for example `user.profile.sub`); the SDK rejects values that
488
+ * are not JWT-shaped before calling the API.
489
+ */
490
+ export declare function createAccessUserActions<DataModel extends GenericDataModel>(options: CreateAccessUserActionsOptions<DataModel>): {
491
+ enterDeployment: import("convex/server").RegisteredAction<"public", {
492
+ idToken: string;
493
+ }, Promise<AccessDeploymentEntryResult>>;
494
+ setDefaultRole: import("convex/server").RegisteredAction<"public", {
495
+ roleId?: string | undefined;
496
+ roleKey?: string | undefined;
497
+ scopeId: string;
498
+ idToken: string;
499
+ }, Promise<WriteResult>>;
500
+ createInvitation: import("convex/server").RegisteredAction<"public", {
501
+ roleIds?: string[] | undefined;
502
+ roleKeys?: string[] | undefined;
503
+ expiresInDays?: number | undefined;
504
+ email: string;
505
+ scopeId: string;
506
+ idToken: string;
507
+ }, Promise<AccessInvitationCreateResult>>;
508
+ revokeInvitation: import("convex/server").RegisteredAction<"public", {
509
+ scopeId: string;
510
+ invitationId: string;
511
+ idToken: string;
512
+ }, Promise<WriteResult>>;
513
+ /**
514
+ * Lists only roles the signed-in actor may assign at the exact target.
515
+ * Use this for role pickers; `listScopeRoles` is the complete mirrored
516
+ * catalog and can include roles the actor is not authorized to confer.
517
+ * `subjectType` must match the intended user or group recipient.
518
+ */
519
+ listGrantableRoles: import("convex/server").RegisteredAction<"public", {
520
+ scopeId: string;
521
+ target: {
522
+ type: "scope";
523
+ } | {
524
+ appliesTo?: "self" | "self_and_descendants" | undefined;
525
+ type: "resource";
526
+ resourceType: string;
527
+ resourceId: string;
528
+ };
529
+ subjectType: "user" | "group";
530
+ idToken: string;
531
+ }, Promise<AccessGrantableRoleListResult>>;
532
+ assignRole: import("convex/server").RegisteredAction<"public", {
533
+ herculesAuthUserId?: string | undefined;
534
+ roleId?: string | undefined;
535
+ principalId?: string | undefined;
536
+ roleKey?: string | undefined;
537
+ scopeId: string;
538
+ idToken: string;
539
+ }, Promise<WriteResult>>;
540
+ removeRole: import("convex/server").RegisteredAction<"public", {
541
+ herculesAuthUserId?: string | undefined;
542
+ roleId?: string | undefined;
543
+ principalId?: string | undefined;
544
+ roleKey?: string | undefined;
545
+ scopeId: string;
546
+ idToken: string;
547
+ }, Promise<WriteResult>>;
548
+ createOrgCustomRole: import("convex/server").RegisteredAction<"public", {
549
+ key?: string | undefined;
550
+ description?: string | undefined;
551
+ name: string;
552
+ scopeId: string;
553
+ permissionKeys: string[];
554
+ idToken: string;
555
+ }, Promise<WriteResult>>;
556
+ updateRolePermissions: import("convex/server").RegisteredAction<"public", {
557
+ roleId?: string | undefined;
558
+ roleKey?: string | undefined;
559
+ scopeId: string;
560
+ permissionKeys: string[];
561
+ idToken: string;
562
+ }, Promise<WriteResult>>;
563
+ setUserExceptions: import("convex/server").RegisteredAction<"public", {
564
+ herculesAuthUserId?: string | undefined;
565
+ principalId?: string | undefined;
566
+ allow: string[];
567
+ deny: string[];
568
+ scopeId: string;
569
+ idToken: string;
570
+ }, Promise<WriteResult>>;
571
+ createResourceGrant: import("convex/server").RegisteredAction<"public", {
572
+ herculesAuthUserId?: string | undefined;
573
+ principalId?: string | undefined;
574
+ appliesTo?: "self" | "self_and_descendants" | undefined;
575
+ expiresAt?: string | null | undefined;
576
+ permissionKey?: string | undefined;
577
+ roleKey?: string | undefined;
578
+ resourceType: string;
579
+ resourceId: string;
580
+ scopeId: string;
581
+ idToken: string;
582
+ }, Promise<AccessResourceGrantWriteResult>>;
583
+ replaceResourceGrants: import("convex/server").RegisteredAction<"public", {
584
+ resourceType: string;
585
+ resourceId: string;
586
+ scopeId: string;
587
+ subjects: {
588
+ herculesAuthUserId?: string | undefined;
589
+ principalId?: string | undefined;
590
+ grants: {
591
+ appliesTo?: "self" | "self_and_descendants" | undefined;
592
+ expiresAt?: string | null | undefined;
593
+ permissionKey?: string | undefined;
594
+ roleKey?: string | undefined;
595
+ }[];
596
+ }[];
597
+ idToken: string;
598
+ }, Promise<AccessResourceGrantsReplaceResult>>;
599
+ replaceMemberRoles: import("convex/server").RegisteredAction<"public", {
600
+ herculesAuthUserId?: string | undefined;
601
+ principalId?: string | undefined;
602
+ scopeId: string;
603
+ roleKeys: string[];
604
+ idToken: string;
605
+ }, Promise<AccessMemberRolesReplaceResult>>;
606
+ createResourceInvitation: import("convex/server").RegisteredAction<"public", {
607
+ appliesTo?: "self" | "self_and_descendants" | undefined;
608
+ permissionKey?: string | undefined;
609
+ roleKey?: string | undefined;
610
+ expiresInDays?: number | undefined;
611
+ email: string;
612
+ resourceType: string;
613
+ resourceId: string;
614
+ scopeId: string;
615
+ idToken: string;
616
+ }, Promise<AccessInvitationCreateResult>>;
617
+ setResourcePermissionRule: import("convex/server").RegisteredAction<"public", {
618
+ appliesTo?: "self" | "self_and_descendants" | undefined;
619
+ expiresAt?: string | null | undefined;
620
+ resourceType: string;
621
+ effect: "allow" | "deny";
622
+ scopeId: string;
623
+ permissionKey: string;
624
+ target: {
625
+ mode: "all";
626
+ } | {
627
+ resourceId: string;
628
+ mode: "specific";
629
+ };
630
+ subject: {
631
+ type: "principal";
632
+ principalId: string;
633
+ } | {
634
+ type: "role";
635
+ roleKey: string;
636
+ };
637
+ idToken: string;
638
+ }, Promise<WriteResult>>;
639
+ setResourcePermissionRules: import("convex/server").RegisteredAction<"public", {
640
+ appliesTo?: "self" | "self_and_descendants" | undefined;
641
+ resourceType: string;
642
+ scopeId: string;
643
+ target: {
644
+ mode: "all";
645
+ } | {
646
+ resourceId: string;
647
+ mode: "specific";
648
+ };
649
+ subject: {
650
+ type: "principal";
651
+ principalId: string;
652
+ } | {
653
+ type: "role";
654
+ roleKey: string;
655
+ };
656
+ rules: {
657
+ expiresAt?: string | null | undefined;
658
+ effect: "allow" | "deny" | "clear";
659
+ permissionKey: string;
660
+ }[];
661
+ idToken: string;
662
+ }, Promise<WriteResult>>;
663
+ revokeResourceGrant: import("convex/server").RegisteredAction<"public", {
664
+ scopeId: string;
665
+ grantId: string;
666
+ idToken: string;
667
+ }, Promise<AccessResourceGrantWriteResult>>;
668
+ setGrantExpiry: import("convex/server").RegisteredAction<"public", {
669
+ expiresAt: string | null;
670
+ scopeId: string;
671
+ grantId: string;
672
+ idToken: string;
673
+ }, Promise<AccessResourceGrantWriteResult>>;
674
+ setRoleOverride: import("convex/server").RegisteredAction<"public", {
675
+ allow: string[];
676
+ deny: string[];
677
+ scopeId: string;
678
+ roleKey: string;
679
+ idToken: string;
680
+ }, Promise<WriteResult>>;
681
+ addMember: import("convex/server").RegisteredAction<"public", {
682
+ roleId?: string | undefined;
683
+ roleKey?: string | undefined;
684
+ herculesAuthUserId: string;
685
+ scopeId: string;
686
+ idToken: string;
687
+ }, Promise<WriteResult>>;
688
+ setMemberStatus: import("convex/server").RegisteredAction<"public", {
689
+ status: "active" | "suspended";
690
+ principalId: string;
691
+ scopeId: string;
692
+ idToken: string;
693
+ }, Promise<WriteResult>>;
694
+ removeMember: import("convex/server").RegisteredAction<"public", {
695
+ principalId: string;
696
+ scopeId: string;
697
+ idToken: string;
698
+ }, Promise<WriteResult>>;
699
+ approveMember: import("convex/server").RegisteredAction<"public", {
700
+ principalId: string;
701
+ scopeId: string;
702
+ idToken: string;
703
+ }, Promise<WriteResult>>;
704
+ upsertAdmissionRule: import("convex/server").RegisteredAction<"public", {
705
+ reason?: string | null | undefined;
706
+ effect: "allow" | "deny";
707
+ scopeId: string;
708
+ subjectType: "email" | "domain";
709
+ subjectValue: string;
710
+ idToken: string;
711
+ }, Promise<WriteResult>>;
712
+ archiveAdmissionRule: import("convex/server").RegisteredAction<"public", {
713
+ scopeId: string;
714
+ ruleId: string;
715
+ idToken: string;
716
+ }, Promise<WriteResult>>;
717
+ setAccountEntryMode: import("convex/server").RegisteredAction<"public", {
718
+ accountEntryMode: "open" | "allowlisted_only" | "invite_only" | "approval_required";
719
+ scopeId: string;
720
+ idToken: string;
721
+ }, Promise<WriteResult>>;
722
+ createGroup: import("convex/server").RegisteredAction<"public", {
723
+ name: string;
724
+ scopeId: string;
725
+ idToken: string;
726
+ }, Promise<AccessGroupWriteResult>>;
727
+ renameGroup: import("convex/server").RegisteredAction<"public", {
728
+ name: string;
729
+ groupPrincipalId: string;
730
+ scopeId: string;
731
+ idToken: string;
732
+ }, Promise<AccessGroupWriteResult>>;
733
+ archiveGroup: import("convex/server").RegisteredAction<"public", {
734
+ groupPrincipalId: string;
735
+ scopeId: string;
736
+ idToken: string;
737
+ }, Promise<AccessGroupWriteResult>>;
738
+ listGroups: import("convex/server").RegisteredAction<"public", {
739
+ includeArchived?: boolean | undefined;
740
+ scopeId: string;
741
+ idToken: string;
742
+ }, Promise<AccessGroupListResult>>;
743
+ addGroupMember: import("convex/server").RegisteredAction<"public", {
744
+ groupPrincipalId: string;
745
+ memberPrincipalId: string;
746
+ scopeId: string;
747
+ idToken: string;
748
+ }, Promise<AccessGroupMemberWriteResult>>;
749
+ removeGroupMember: import("convex/server").RegisteredAction<"public", {
750
+ groupPrincipalId: string;
751
+ memberPrincipalId: string;
752
+ scopeId: string;
753
+ idToken: string;
754
+ }, Promise<AccessGroupMemberWriteResult>>;
755
+ listResourceInvitations: import("convex/server").RegisteredAction<"public", {
756
+ scopeId: string;
757
+ idToken: string;
758
+ }, Promise<AccessResourceInvitationListResult>>;
759
+ getRoleOverrides: import("convex/server").RegisteredAction<"public", {
760
+ roleId?: string | undefined;
761
+ roleKey?: string | undefined;
762
+ scopeId: string;
763
+ idToken: string;
764
+ }, Promise<AccessRoleOverridesResult>>;
765
+ getUserExceptions: import("convex/server").RegisteredAction<"public", {
766
+ herculesAuthUserId?: string | undefined;
767
+ principalId?: string | undefined;
768
+ scopeId: string;
769
+ idToken: string;
770
+ }, Promise<AccessUserExceptionsResult>>;
771
+ };
772
+ /**
773
+ * Builds a public authenticated action for creating an organization scope.
774
+ * `canCreateScope` is the app's product-policy gate. The authenticated caller
775
+ * becomes the new scope's Owner automatically; do not add a separate self
776
+ * role or resource grant.
777
+ */
778
+ export declare function createAccessScopeAction<DataModel extends GenericDataModel>(options: CreateAccessScopeActionOptions<DataModel>): import("convex/server").RegisteredAction<"public", {
779
+ accountEntryMode?: "open" | "allowlisted_only" | "invite_only" | "approval_required" | undefined;
780
+ defaultRoleKey?: string | undefined;
781
+ name: string;
782
+ }, Promise<AccessScopeCreateResult>>;
783
+ /**
784
+ * Builds a public action that gives a newly created app resource's trusted
785
+ * creator one fixed manager role, then marks the app row active.
786
+ *
787
+ * The browser supplies only `resourceId`. App-owned callbacks must load the
788
+ * trusted creator and scope from the database and activate the same
789
+ * provisioning row. The resource type, role, and descendant behavior are
790
+ * static factory configuration, so callers cannot turn this into arbitrary
791
+ * self-grant.
792
+ *
793
+ * Keep the resource unavailable while it is `provisioning`. If activation
794
+ * fails after the grant, retrying is safe because the control-plane grant
795
+ * write is idempotent. Once active, this action never recreates a removed
796
+ * manager grant.
797
+ */
798
+ export declare function createResourceCreatorBootstrapAction<DataModel extends GenericDataModel>(options: CreateResourceCreatorBootstrapActionOptions<DataModel>): import("convex/server").RegisteredAction<"public", {
799
+ resourceId: string;
800
+ }, Promise<ResourceCreatorBootstrapResult>>;
801
+ /**
802
+ * Creates an organization scope for the authenticated caller. Hercules derives
803
+ * the caller from the Convex identity and makes that user Owner of the new
804
+ * scope. The app should persist the returned `accessScopeId` on its
805
+ * organization metadata row.
806
+ */
807
+ export declare function createAccessScope(ctx: CreateAccessScopeContext, args: CreateAccessScopeArgs, options?: AccessAdminApiOptions): Promise<AccessScopeCreateResult>;
808
+ export declare function createAccessInvitation(args: CreateAccessInvitationArgs, options?: AccessAdminApiOptions): Promise<AccessInvitationCreateResult>;
809
+ /**
810
+ * Invite an email to a single resource, conferring a custom role or a single
811
+ * permission scoped to that resource (not the whole scope). Pass exactly one of
812
+ * `roleKey` / `permissionKey`. This helper always acts as the internal service.
813
+ * Public app-user invitations are exposed by {@link createAccessUserActions}.
814
+ */
815
+ export declare function createResourceInvitation(args: CreateResourceInvitationArgs, options?: AccessAdminApiOptions): Promise<AccessInvitationCreateResult>;
816
+ export declare function acceptAccessInvitation(ctx: CreateAccessScopeContext, args: AcceptAccessInvitationArgs, options?: AccessAdminApiOptions): Promise<AccessInvitationAcceptResult>;
817
+ export {};
818
+ //# sourceMappingURL=access-admin.d.ts.map