@robelest/convex-auth 0.0.4-preview.32 → 0.0.4-preview.34

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 (89) hide show
  1. package/dist/component/_generated/component.d.ts +1611 -2039
  2. package/dist/component/account.js +3 -0
  3. package/dist/component/convex.config.d.ts +2 -2
  4. package/dist/component/factor/device.js +3 -0
  5. package/dist/component/factor/passkey.js +3 -0
  6. package/dist/component/factor/totp.js +3 -0
  7. package/dist/component/group/invite.js +3 -0
  8. package/dist/component/group/member.js +3 -0
  9. package/dist/component/group.js +3 -0
  10. package/dist/component/model.d.ts +342 -30
  11. package/dist/component/model.js +22 -4
  12. package/dist/component/modules.js +24 -21
  13. package/dist/component/public/factors/devices.js +37 -106
  14. package/dist/component/public/factors/passkeys.js +29 -149
  15. package/dist/component/public/factors/totp.js +32 -159
  16. package/dist/component/public/groups/core.js +19 -82
  17. package/dist/component/public/groups/invites.js +15 -104
  18. package/dist/component/public/groups/members.js +26 -149
  19. package/dist/component/public/identity/accounts.js +12 -94
  20. package/dist/component/public/identity/codes.js +13 -73
  21. package/dist/component/public/identity/sessions.js +5 -107
  22. package/dist/component/public/identity/tokens.js +13 -103
  23. package/dist/component/public/identity/users.js +188 -185
  24. package/dist/component/public/identity/verifiers.js +17 -80
  25. package/dist/component/public/security/keys.js +13 -120
  26. package/dist/component/public/security/limits.js +0 -43
  27. package/dist/component/public/sso/audit.js +0 -28
  28. package/dist/component/public/sso/core.js +31 -104
  29. package/dist/component/public/sso/domains.js +0 -71
  30. package/dist/component/public/sso/scim.js +63 -239
  31. package/dist/component/public/sso/secrets.js +0 -30
  32. package/dist/component/public/sso/webhooks.js +23 -128
  33. package/dist/component/rateLimit.js +3 -0
  34. package/dist/component/schema.d.ts +378 -342
  35. package/dist/component/schema.js +11 -1
  36. package/dist/component/session.js +3 -0
  37. package/dist/component/sso/audit.js +3 -0
  38. package/dist/component/sso/connection/domain/verification.js +3 -0
  39. package/dist/component/sso/connection/domain.js +3 -0
  40. package/dist/component/sso/connection/scim/config.js +3 -0
  41. package/dist/component/sso/connection/scim/identity.js +3 -0
  42. package/dist/component/sso/connection/secret.js +3 -0
  43. package/dist/component/sso/connection.js +3 -0
  44. package/dist/component/sso/webhook/delivery.js +3 -0
  45. package/dist/component/sso/webhook/endpoint.js +3 -0
  46. package/dist/component/token/pkce.js +3 -0
  47. package/dist/component/token/refresh.js +3 -0
  48. package/dist/component/token/verification.js +3 -0
  49. package/dist/component/user/email.js +3 -0
  50. package/dist/component/user/key.js +3 -0
  51. package/dist/component/user.js +62 -0
  52. package/dist/core/index.d.ts +131 -28
  53. package/dist/core/index.js +2 -0
  54. package/dist/model.js +391 -0
  55. package/dist/providers/credentials.d.ts +1 -1
  56. package/dist/providers/github.js +6 -0
  57. package/dist/providers/password.js +1 -2
  58. package/dist/server/auth.d.ts +73 -7
  59. package/dist/server/auth.js +4 -1
  60. package/dist/server/context.js +30 -3
  61. package/dist/server/contract.js +42 -42
  62. package/dist/server/core.js +224 -86
  63. package/dist/server/db.js +45 -37
  64. package/dist/server/facade.d.ts +39 -0
  65. package/dist/server/facade.js +16 -0
  66. package/dist/server/index.d.ts +5 -3
  67. package/dist/server/index.js +3 -1
  68. package/dist/server/mounts.d.ts +101 -101
  69. package/dist/server/mutations/credentials/signin.js +3 -7
  70. package/dist/server/mutations/oauth.js +9 -6
  71. package/dist/server/runtime.d.ts +147 -46
  72. package/dist/server/runtime.js +10 -8
  73. package/dist/server/services/group.js +9 -9
  74. package/dist/server/sso/domain.d.ts +1 -1
  75. package/dist/server/sso/domain.js +40 -40
  76. package/dist/server/sso/http.js +18 -18
  77. package/dist/server/sso/oidc.js +1 -1
  78. package/dist/server/sso/policies.js +3 -3
  79. package/dist/server/sso/policy.js +12 -4
  80. package/dist/server/sso/provision.js +9 -9
  81. package/dist/server/sso/validators.js +2 -2
  82. package/dist/server/sso/webhook.js +8 -8
  83. package/dist/server/types.d.ts +185 -124
  84. package/dist/server/types.js +29 -24
  85. package/dist/server/users.js +49 -2
  86. package/dist/server/validators.d.ts +745 -0
  87. package/dist/server/validators.js +60 -0
  88. package/package.json +1 -1
  89. package/dist/component/public.js +0 -22
@@ -19,9 +19,19 @@ var schema_default = defineSchema({
19
19
  phone: v.optional(v.string()),
20
20
  phoneVerificationTime: v.optional(v.number()),
21
21
  isAnonymous: v.optional(v.boolean()),
22
- hasTotp: v.optional(v.boolean()),
22
+ lastActiveGroup: v.optional(v.id("Group")),
23
23
  extend: v.optional(v.any())
24
24
  }).index("email", ["email"]).index("email_verified", ["email", "emailVerificationTime"]).index("phone", ["phone"]).index("phone_verified", ["phone", "phoneVerificationTime"]),
25
+ UserEmail: defineTable({
26
+ userId: v.id("User"),
27
+ email: v.string(),
28
+ verificationTime: v.optional(v.number()),
29
+ isPrimary: v.boolean(),
30
+ source: v.union(v.literal("password"), v.literal("oauth"), v.literal("oidc"), v.literal("saml"), v.literal("scim")),
31
+ accountId: v.optional(v.id("Account")),
32
+ provider: v.optional(v.string()),
33
+ connectionId: v.optional(v.id("GroupConnection"))
34
+ }).index("email", ["email"]).index("email_verified", ["email", "verificationTime"]).index("user_id", ["userId"]).index("user_id_primary", ["userId", "isPrimary"]).index("connection_id_email", ["connectionId", "email"]),
25
35
  Session: defineTable({
26
36
  userId: v.id("User"),
27
37
  expirationTime: v.number()
@@ -0,0 +1,3 @@
1
+ import { sessionCreate, sessionDelete, sessionGetById, sessionIssue, sessionList } from "./public/identity/sessions.js";
2
+
3
+ export { sessionCreate as create, sessionDelete as delete, sessionGetById as get, sessionIssue as issue, sessionList as list };
@@ -0,0 +1,3 @@
1
+ import { groupAuditEventCreate, groupAuditEventList } from "../public/sso/audit.js";
2
+
3
+ export { groupAuditEventCreate as create, groupAuditEventList as list };
@@ -0,0 +1,3 @@
1
+ import { groupConnectionDomainVerificationDelete, groupConnectionDomainVerificationGet, groupConnectionDomainVerificationUpsert } from "../../../public/sso/domains.js";
2
+
3
+ export { groupConnectionDomainVerificationDelete as delete, groupConnectionDomainVerificationGet as get, groupConnectionDomainVerificationUpsert as upsert };
@@ -0,0 +1,3 @@
1
+ import { groupConnectionDomainAdd, groupConnectionDomainDelete, groupConnectionDomainList, groupConnectionDomainVerify } from "../../public/sso/domains.js";
2
+
3
+ export { groupConnectionDomainAdd as create, groupConnectionDomainDelete as delete, groupConnectionDomainList as list, groupConnectionDomainVerify as verify };
@@ -0,0 +1,3 @@
1
+ import { groupConnectionScimConfigGet, groupConnectionScimConfigUpsert } from "../../../public/sso/scim.js";
2
+
3
+ export { groupConnectionScimConfigGet as get, groupConnectionScimConfigUpsert as upsert };
@@ -0,0 +1,3 @@
1
+ import { groupConnectionScimIdentityDelete, groupConnectionScimIdentityGet, groupConnectionScimIdentityListByGroupConnection, groupConnectionScimIdentityUpsert } from "../../../public/sso/scim.js";
2
+
3
+ export { groupConnectionScimIdentityDelete as delete, groupConnectionScimIdentityGet as get, groupConnectionScimIdentityListByGroupConnection as list, groupConnectionScimIdentityUpsert as upsert };
@@ -0,0 +1,3 @@
1
+ import { groupConnectionSecretDelete, groupConnectionSecretGet, groupConnectionSecretUpsert } from "../../public/sso/secrets.js";
2
+
3
+ export { groupConnectionSecretDelete as delete, groupConnectionSecretGet as get, groupConnectionSecretUpsert as upsert };
@@ -0,0 +1,3 @@
1
+ import { groupConnectionCreate, groupConnectionDelete, groupConnectionGet, groupConnectionList, groupConnectionUpdate } from "../public/sso/core.js";
2
+
3
+ export { groupConnectionCreate as create, groupConnectionDelete as delete, groupConnectionGet as get, groupConnectionList as list, groupConnectionUpdate as update };
@@ -0,0 +1,3 @@
1
+ import { groupWebhookDeliveryCreate, groupWebhookDeliveryList, groupWebhookDeliveryPatch } from "../../public/sso/webhooks.js";
2
+
3
+ export { groupWebhookDeliveryCreate as create, groupWebhookDeliveryList as list, groupWebhookDeliveryPatch as update };
@@ -0,0 +1,3 @@
1
+ import { groupWebhookEndpointCreate, groupWebhookEndpointGet, groupWebhookEndpointList, groupWebhookEndpointUpdate } from "../../public/sso/webhooks.js";
2
+
3
+ export { groupWebhookEndpointCreate as create, groupWebhookEndpointGet as get, groupWebhookEndpointList as list, groupWebhookEndpointUpdate as update };
@@ -0,0 +1,3 @@
1
+ import { verifierCreate, verifierDelete, verifierGet, verifierPatch } from "../public/identity/verifiers.js";
2
+
3
+ export { verifierCreate as create, verifierDelete as delete, verifierGet as get, verifierPatch as update };
@@ -0,0 +1,3 @@
1
+ import { refreshTokenCreate, refreshTokenDeleteAll, refreshTokenExchange, refreshTokenGet, refreshTokenGetChildren, refreshTokenListBySession, refreshTokenPatch } from "../public/identity/tokens.js";
2
+
3
+ export { refreshTokenCreate as create, refreshTokenDeleteAll as delete, refreshTokenExchange as exchange, refreshTokenGet as get, refreshTokenListBySession as list, refreshTokenGetChildren as listChildren, refreshTokenPatch as update };
@@ -0,0 +1,3 @@
1
+ import { verificationCodeCreate, verificationCodeDelete, verificationCodeGet } from "../public/identity/codes.js";
2
+
3
+ export { verificationCodeCreate as create, verificationCodeDelete as delete, verificationCodeGet as get };
@@ -0,0 +1,3 @@
1
+ import { userEmailListByUser, userEmailOwner, userEmailRemove, userEmailSetPrimary, userEmailUpsert } from "../public/identity/users.js";
2
+
3
+ export { userEmailRemove as delete, userEmailListByUser as list, userEmailOwner as owner, userEmailSetPrimary as setPrimary, userEmailUpsert as upsert };
@@ -0,0 +1,3 @@
1
+ import { keyDelete, keyGet, keyInsert, keyList, keyPatch } from "../public/security/keys.js";
2
+
3
+ export { keyInsert as create, keyDelete as delete, keyGet as get, keyList as list, keyPatch as update };
@@ -0,0 +1,62 @@
1
+ import { vUserDoc } from "./model.js";
2
+ import { query } from "./functions.js";
3
+ import { userDelete, userInsert, userList, userPatch, userUpsert } from "./public/identity/users.js";
4
+ import { v } from "convex/values";
5
+
6
+ //#region src/component/user.ts
7
+ /**
8
+ * `component.user.*` — the User entity surface.
9
+ *
10
+ * Reads collapse into one overloaded `get`; the rest are 1:1 verbs.
11
+ *
12
+ * @module
13
+ */
14
+ /**
15
+ * Read a user by identity. One overloaded function (single Convex
16
+ * function with a unioned `args`/`returns`). Accepts exactly one
17
+ * selector:
18
+ *
19
+ * - `{ id }` → `Doc<"User"> | null`
20
+ * - `{ ids }` → `(Doc<"User"> | null)[]` (order preserved, deduped)
21
+ * - `{ verifiedEmail }`→ `Doc<"User"> | null` (exactly-one-or-null)
22
+ * - `{ verifiedPhone }`→ `Doc<"User"> | null` (exactly-one-or-null)
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * await ctx.runQuery(component.user.get, { id: userId });
27
+ * await ctx.runQuery(component.user.get, { ids: memberIds });
28
+ * await ctx.runQuery(component.user.get, { verifiedEmail: "a@b.com" });
29
+ * ```
30
+ */
31
+ const get = query({
32
+ args: {
33
+ id: v.optional(v.id("User")),
34
+ ids: v.optional(v.array(v.id("User"))),
35
+ verifiedEmail: v.optional(v.string()),
36
+ verifiedPhone: v.optional(v.string())
37
+ },
38
+ returns: v.union(vUserDoc, v.null(), v.array(v.union(vUserDoc, v.null()))),
39
+ handler: async (ctx, args) => {
40
+ if (args.ids !== void 0) {
41
+ if (args.ids.length === 0) return [];
42
+ const unique = Array.from(new Set(args.ids));
43
+ const docs = await Promise.all(unique.map((id) => ctx.db.get("User", id)));
44
+ const byId = new Map(unique.map((id, i) => [id, docs[i] ?? null]));
45
+ return args.ids.map((id) => byId.get(id) ?? null);
46
+ }
47
+ if (args.verifiedEmail !== void 0) {
48
+ const users = await ctx.db.query("User").withIndex("email_verified", (q) => q.eq("email", args.verifiedEmail).gt("emailVerificationTime", void 0)).take(2);
49
+ return users.length === 1 ? users[0] : null;
50
+ }
51
+ if (args.verifiedPhone !== void 0) {
52
+ const users = await ctx.db.query("User").withIndex("phone_verified", (q) => q.eq("phone", args.verifiedPhone).gt("phoneVerificationTime", void 0)).take(2);
53
+ return users.length === 1 ? users[0] : null;
54
+ }
55
+ if (args.id === void 0) return null;
56
+ return await ctx.db.get("User", args.id);
57
+ }
58
+ });
59
+
60
+ //#endregion
61
+ export { userInsert as create, userDelete as delete, get, userList as list, userPatch as update, userUpsert as upsert };
62
+ //# sourceMappingURL=user.js.map
@@ -1,9 +1,10 @@
1
1
  import { AuthAuthorizationConfig, ConvexAuthConfig, Doc, KeyDoc, KeyScope, ScopeChecker, UserOrderBy, UserWhere } from "../server/types.js";
2
2
  import { AuthConfig, AuthContext, AuthContextConfig, AuthContextFactory, AuthContextResolver, OptionalAuthContext, UserDoc } from "../server/facade.js";
3
3
  import { ComponentCtx, ComponentReadCtx } from "../server/component/context.js";
4
+ import "../server/identity/convex.js";
4
5
  import { AuthProfile } from "../server/payloads.js";
6
+ import "../server/index.js";
5
7
  import "../component/index.js";
6
- import "../server/identity/convex.js";
7
8
  import * as convex_values0 from "convex/values";
8
9
  import * as convex_server0 from "convex/server";
9
10
  import * as fluent_convex0 from "fluent-convex";
@@ -53,26 +54,51 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
53
54
  cursor?: string | null;
54
55
  orderBy?: UserOrderBy;
55
56
  order?: "asc" | "desc";
56
- }) => Promise<any>;
57
+ }) => Promise<{
58
+ items: Doc<"User">[];
59
+ nextCursor: string | null;
60
+ }>;
57
61
  viewer: (ctx: ComponentReadCtx & {
58
62
  auth: convex_server0.Auth;
59
63
  }) => Promise<Doc<"User"> | null>;
64
+ email: {
65
+ list: (ctx: ComponentReadCtx & {
66
+ auth: convex_server0.Auth;
67
+ }, opts?: {
68
+ userId?: string;
69
+ }) => Promise<Doc<"UserEmail">[]>;
70
+ add: (ctx: ComponentCtx & {
71
+ auth: convex_server0.Auth;
72
+ }, email: string, opts?: {
73
+ userId?: string;
74
+ }) => Promise<{
75
+ email: string;
76
+ }>;
77
+ remove: (ctx: ComponentCtx & {
78
+ auth: convex_server0.Auth;
79
+ }, email: string, opts?: {
80
+ userId?: string;
81
+ }) => Promise<{
82
+ email: string;
83
+ }>;
84
+ primary: {
85
+ (ctx: ComponentReadCtx & {
86
+ auth: convex_server0.Auth;
87
+ }, opts?: {
88
+ userId?: string;
89
+ }): Promise<Doc<"UserEmail"> | null>;
90
+ (ctx: ComponentCtx & {
91
+ auth: convex_server0.Auth;
92
+ }, email: string, opts?: {
93
+ userId?: string;
94
+ }): Promise<{
95
+ email: string;
96
+ }>;
97
+ };
98
+ };
60
99
  update: (ctx: ComponentCtx, userId: string, data: Record<string, unknown>) => Promise<{
61
100
  userId: string;
62
101
  }>;
63
- setActiveGroup: (ctx: ComponentCtx, opts: {
64
- userId: string;
65
- groupId: string | null;
66
- }) => Promise<{
67
- userId: string;
68
- groupId: null;
69
- } | {
70
- userId: string;
71
- groupId: string;
72
- }>;
73
- getActiveGroup: (ctx: ComponentReadCtx, opts: {
74
- userId: string;
75
- }) => Promise<string | null>;
76
102
  delete: (ctx: ComponentCtx, userId: string, opts?: {
77
103
  cascade?: boolean;
78
104
  }) => Promise<{
@@ -87,10 +113,10 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
87
113
  userId: convex_values0.GenericId<"User">;
88
114
  except: convex_values0.GenericId<"Session">[];
89
115
  }>;
90
- get: (ctx: ComponentReadCtx, sessionId: string) => Promise<any>;
116
+ get: (ctx: ComponentReadCtx, sessionId: string) => Promise<Doc<"Session"> | null>;
91
117
  list: (ctx: ComponentReadCtx, opts: {
92
118
  userId: string;
93
- }) => Promise<any>;
119
+ }) => Promise<Doc<"Session">[]>;
94
120
  };
95
121
  account: {
96
122
  create: <DataModel extends fluent_convex0.GenericDataModel>(ctx: convex_server0.GenericActionCtx<DataModel>, args: {
@@ -138,7 +164,7 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
138
164
  }>;
139
165
  listPasskeys: (ctx: ComponentReadCtx, opts: {
140
166
  userId: string;
141
- }) => Promise<any>;
167
+ }) => Promise<Doc<"Passkey">[]>;
142
168
  renamePasskey: (ctx: ComponentCtx, passkeyId: string, name: string) => Promise<{
143
169
  passkeyId: string;
144
170
  }>;
@@ -147,7 +173,7 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
147
173
  }>;
148
174
  listTotps: (ctx: ComponentReadCtx, opts: {
149
175
  userId: string;
150
- }) => Promise<any>;
176
+ }) => Promise<Doc<"TotpFactor">[]>;
151
177
  deleteTotp: (ctx: ComponentCtx, totpId: string) => Promise<{
152
178
  totpId: string;
153
179
  }>;
@@ -169,6 +195,17 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
169
195
  get: {
170
196
  (ctx: ComponentReadCtx, groupId: string): Promise<Doc<"Group"> | null>;
171
197
  (ctx: ComponentReadCtx, groupIds: readonly string[]): Promise<Array<Doc<"Group"> | null>>;
198
+ (ctx: ComponentReadCtx, selector: {
199
+ slug: string;
200
+ }): Promise<Doc<"Group"> | null>;
201
+ (ctx: ComponentReadCtx, groupId: string, opts: {
202
+ tree: true;
203
+ }): Promise<{
204
+ current: Doc<"Group">;
205
+ parent: Doc<"Group"> | null;
206
+ children: Array<Doc<"Group">>;
207
+ ancestors: Array<Doc<"Group">>;
208
+ } | null>;
172
209
  };
173
210
  list: (ctx: ComponentReadCtx, opts?: {
174
211
  where?: {
@@ -190,7 +227,10 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
190
227
  cursor?: string | null;
191
228
  orderBy?: "_creationTime" | "name" | "slug" | "type";
192
229
  order?: "asc" | "desc";
193
- }) => Promise<any>;
230
+ }) => Promise<{
231
+ items: Doc<"Group">[];
232
+ nextCursor: string | null;
233
+ }>;
194
234
  update: (ctx: ComponentCtx, groupId: string, data: Record<string, unknown>) => Promise<{
195
235
  groupId: string;
196
236
  }>;
@@ -217,8 +257,8 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
217
257
  }) => Promise<{
218
258
  memberId: string;
219
259
  }>;
220
- get: (ctx: ComponentReadCtx, memberId: string) => Promise<any>;
221
- list: (ctx: ComponentReadCtx, opts?: {
260
+ get: (ctx: ComponentReadCtx, memberId: string) => Promise<Doc<"GroupMember"> | null>;
261
+ list: <O extends {
222
262
  where?: {
223
263
  groupId?: string;
224
264
  userId?: string;
@@ -229,7 +269,33 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
229
269
  cursor?: string | null;
230
270
  orderBy?: "_creationTime" | "status";
231
271
  order?: "asc" | "desc";
232
- }) => Promise<any>;
272
+ withGroup?: true;
273
+ withGrants?: true;
274
+ } | undefined = undefined>(ctx: ComponentReadCtx, opts?: O) => Promise<{
275
+ items: ({
276
+ _id: convex_values0.GenericId<"GroupMember">;
277
+ _creationTime: number;
278
+ extend?: any;
279
+ status?: string | undefined;
280
+ role?: string | undefined;
281
+ roleIds?: string[] | undefined;
282
+ userId: convex_values0.GenericId<"User">;
283
+ groupId: convex_values0.GenericId<"Group">;
284
+ } & {
285
+ _id: convex_values0.GenericId<"GroupMember">;
286
+ _creationTime: number;
287
+ } & (NonNullable<O> extends infer T_2 ? T_2 extends NonNullable<O> ? T_2 extends {
288
+ withGroup: true;
289
+ } ? {
290
+ group: Doc<"Group"> | null;
291
+ } : unknown : never : never) & (NonNullable<O> extends infer T_3 ? T_3 extends NonNullable<O> ? T_3 extends {
292
+ withGrants: true;
293
+ } ? {
294
+ roleIds: string[];
295
+ grants: string[];
296
+ } : unknown : never : never))[];
297
+ nextCursor: string | null;
298
+ }>;
233
299
  delete: (ctx: ComponentCtx, memberId: string) => Promise<{
234
300
  memberId: string;
235
301
  }>;
@@ -308,13 +374,19 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
308
374
  inviteId: string;
309
375
  token: string;
310
376
  }>;
311
- get: (ctx: ComponentReadCtx, inviteId: string) => Promise<any>;
377
+ get: (ctx: ComponentReadCtx, inviteId: string) => Promise<Doc<"GroupInvite"> | null>;
312
378
  token: {
313
- get: (ctx: ComponentReadCtx, token: string) => Promise<any>;
379
+ get: (ctx: ComponentReadCtx, token: string) => Promise<Doc<"GroupInvite"> | null>;
314
380
  accept: (ctx: ComponentCtx, args: {
315
381
  token: string;
316
382
  acceptedByUserId: string;
317
- }) => Promise<any>;
383
+ }) => Promise<{
384
+ inviteId: string;
385
+ groupId: string | null;
386
+ memberId?: string;
387
+ inviteStatus: string;
388
+ membershipStatus: string;
389
+ }>;
318
390
  };
319
391
  list: (ctx: ComponentReadCtx, opts?: {
320
392
  where?: {
@@ -330,7 +402,10 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
330
402
  cursor?: string | null;
331
403
  orderBy?: "_creationTime" | "status" | "email" | "expiresTime" | "acceptedTime";
332
404
  order?: "asc" | "desc";
333
- }) => Promise<any>;
405
+ }) => Promise<{
406
+ items: Doc<"GroupInvite">[];
407
+ nextCursor: string | null;
408
+ }>;
334
409
  accept: (ctx: ComponentCtx, inviteId: string, acceptedByUserId?: string) => Promise<{
335
410
  inviteId: string;
336
411
  acceptedByUserId: string | null;
@@ -370,7 +445,10 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
370
445
  cursor?: string | null;
371
446
  orderBy?: "_creationTime" | "name" | "lastUsedAt" | "expiresAt" | "revoked";
372
447
  order?: "asc" | "desc";
373
- }) => Promise<any>;
448
+ }) => Promise<{
449
+ items: Doc<"ApiKey">[];
450
+ nextCursor: string | null;
451
+ }>;
374
452
  get: (ctx: ComponentReadCtx, keyId: string) => Promise<KeyDoc | null>;
375
453
  update: (ctx: ComponentCtx, keyId: string, data: {
376
454
  name?: string;
@@ -396,6 +474,31 @@ declare function createAuthContext(component: ConvexAuthConfig["component"], con
396
474
  secret: string;
397
475
  }>;
398
476
  };
477
+ active: {
478
+ get: (ctx: ComponentReadCtx & {
479
+ auth: convex_server0.Auth;
480
+ }, opts?: {
481
+ userId?: string;
482
+ }) => Promise<{
483
+ groupId: string;
484
+ group: Doc<"Group"> | null;
485
+ membership: Doc<"GroupMember">;
486
+ } | null>;
487
+ set: (ctx: ComponentCtx & {
488
+ auth: convex_server0.Auth;
489
+ }, groupId: string, opts?: {
490
+ userId?: string;
491
+ }) => Promise<{
492
+ groupId: string;
493
+ }>;
494
+ clear: (ctx: ComponentCtx & {
495
+ auth: convex_server0.Auth;
496
+ }, opts?: {
497
+ userId?: string;
498
+ }) => Promise<{
499
+ groupId: null;
500
+ }>;
501
+ };
399
502
  };
400
503
  //#endregion
401
504
  export { type AuthContext, type AuthContextConfig, type OptionalAuthContext, type UserDoc, createAuthContext };
@@ -57,6 +57,7 @@ function createAuthContext(component, config) {
57
57
  });
58
58
  const authLike = {
59
59
  user: domains.user,
60
+ active: domains.active,
60
61
  member: domains.member
61
62
  };
62
63
  return {
@@ -67,6 +68,7 @@ function createAuthContext(component, config) {
67
68
  member: domains.member,
68
69
  invite: domains.invite,
69
70
  key: domains.key,
71
+ active: domains.active,
70
72
  ...createAuthContextFacade(authLike)
71
73
  };
72
74
  }