@robelest/convex-auth 0.0.4-preview.16 → 0.0.4-preview.18
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.
- package/dist/authorization/index.d.ts +17 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +17 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/client/index.js +73 -0
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +52 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/convex.config.d.ts +2 -2
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/index.js +2 -2
- package/dist/component/model.d.ts +75 -75
- package/dist/component/model.d.ts.map +1 -1
- package/dist/component/model.js +2 -0
- package/dist/component/model.js.map +1 -1
- package/dist/component/public/factors.d.ts.map +1 -1
- package/dist/component/public/factors.js +1 -1
- package/dist/component/public/factors.js.map +1 -1
- package/dist/component/public/groups.d.ts +10 -2
- package/dist/component/public/groups.d.ts.map +1 -1
- package/dist/component/public/groups.js +92 -8
- package/dist/component/public/groups.js.map +1 -1
- package/dist/component/public/identity.d.ts.map +1 -1
- package/dist/component/public/identity.js +3 -3
- package/dist/component/public/identity.js.map +1 -1
- package/dist/component/public/shared.d.ts +4 -4
- package/dist/component/public/shared.d.ts.map +1 -1
- package/dist/component/public.d.ts +3 -3
- package/dist/component/public.js +2 -2
- package/dist/component/schema.d.ts +13 -2
- package/dist/component/schema.js +7 -5
- package/dist/component/schema.js.map +1 -1
- package/dist/component/server/auth.d.ts +4 -25
- package/dist/component/server/auth.d.ts.map +1 -1
- package/dist/component/server/auth.js +4 -10
- package/dist/component/server/auth.js.map +1 -1
- package/dist/component/server/domains/core.js +196 -131
- package/dist/component/server/domains/core.js.map +1 -1
- package/dist/component/server/factory.d.ts +3 -3
- package/dist/component/server/signin.js +20 -1
- package/dist/component/server/signin.js.map +1 -1
- package/dist/server/auth.d.ts +4 -25
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +4 -10
- package/dist/server/auth.js.map +1 -1
- package/dist/server/domains/core.d.ts +73 -58
- package/dist/server/domains/core.d.ts.map +1 -1
- package/dist/server/domains/core.js +196 -131
- package/dist/server/domains/core.js.map +1 -1
- package/dist/server/http.d.ts +2 -2
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/index.d.ts +108 -69
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +138 -54
- package/dist/server/index.js.map +1 -1
- package/dist/server/mutations/code.d.ts +9 -9
- package/dist/server/mutations/index.d.ts +69 -69
- package/dist/server/mutations/invalidate.d.ts +4 -4
- package/dist/server/mutations/invalidate.d.ts.map +1 -1
- package/dist/server/mutations/oauth.d.ts +7 -7
- package/dist/server/mutations/register.d.ts +9 -9
- package/dist/server/mutations/retrieve.d.ts +6 -6
- package/dist/server/mutations/retrieve.d.ts.map +1 -1
- package/dist/server/mutations/signature.d.ts +4 -4
- package/dist/server/mutations/signature.d.ts.map +1 -1
- package/dist/server/mutations/signin.d.ts +5 -5
- package/dist/server/mutations/signin.d.ts.map +1 -1
- package/dist/server/mutations/verify.d.ts +7 -7
- package/dist/server/signin.js +20 -1
- package/dist/server/signin.js.map +1 -1
- package/dist/server/version.d.ts +1 -1
- package/dist/server/version.js +1 -1
- package/dist/server/version.js.map +1 -1
- package/package.json +9 -5
- package/src/authorization/index.ts +37 -0
- package/src/client/index.ts +122 -0
- package/src/component/_generated/component.ts +64 -0
- package/src/component/index.ts +1 -1
- package/src/component/model.ts +2 -0
- package/src/component/public/factors.ts +3 -2
- package/src/component/public/groups.ts +142 -8
- package/src/component/public/identity.ts +9 -6
- package/src/component/schema.ts +14 -2
- package/src/server/auth.ts +9 -61
- package/src/server/domains/core.ts +235 -210
- package/src/server/index.ts +158 -75
- package/src/server/signin.ts +52 -0
- package/src/server/version.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MutationCtx } from "../types.js";
|
|
2
2
|
import { Config, GetProviderOrThrowFunc } from "../provider.js";
|
|
3
3
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
4
|
-
import * as
|
|
4
|
+
import * as convex_values10 from "convex/values";
|
|
5
5
|
import { Infer } from "convex/values";
|
|
6
6
|
|
|
7
7
|
//#region src/server/mutations/code.d.ts
|
|
8
|
-
declare const createVerificationCodeArgs:
|
|
8
|
+
declare const createVerificationCodeArgs: convex_values10.VObject<{
|
|
9
9
|
email?: string | undefined;
|
|
10
10
|
phone?: string | undefined;
|
|
11
11
|
accountId?: string | undefined;
|
|
@@ -14,13 +14,13 @@ declare const createVerificationCodeArgs: convex_values16.VObject<{
|
|
|
14
14
|
code: string;
|
|
15
15
|
expirationTime: number;
|
|
16
16
|
}, {
|
|
17
|
-
accountId:
|
|
18
|
-
provider:
|
|
19
|
-
email:
|
|
20
|
-
phone:
|
|
21
|
-
code:
|
|
22
|
-
expirationTime:
|
|
23
|
-
allowExtraProviders:
|
|
17
|
+
accountId: convex_values10.VString<string | undefined, "optional">;
|
|
18
|
+
provider: convex_values10.VString<string, "required">;
|
|
19
|
+
email: convex_values10.VString<string | undefined, "optional">;
|
|
20
|
+
phone: convex_values10.VString<string | undefined, "optional">;
|
|
21
|
+
code: convex_values10.VString<string, "required">;
|
|
22
|
+
expirationTime: convex_values10.VFloat64<number, "required">;
|
|
23
|
+
allowExtraProviders: convex_values10.VBoolean<boolean, "required">;
|
|
24
24
|
}, "required", "email" | "phone" | "provider" | "allowExtraProviders" | "accountId" | "code" | "expirationTime">;
|
|
25
25
|
type ReturnType = string;
|
|
26
26
|
declare function createVerificationCodeImpl(ctx: MutationCtx, args: Infer<typeof createVerificationCodeArgs>, getProviderOrThrow: GetProviderOrThrowFunc, config: Config): Promise<ReturnType>;
|
|
@@ -12,11 +12,11 @@ import { callVerifier } from "./verifier.js";
|
|
|
12
12
|
import { callRefreshSession } from "./refresh.js";
|
|
13
13
|
import { callSignOut } from "./signout.js";
|
|
14
14
|
import { callSignIn } from "./signin.js";
|
|
15
|
-
import * as
|
|
15
|
+
import * as convex_values40 from "convex/values";
|
|
16
16
|
import { Infer } from "convex/values";
|
|
17
17
|
|
|
18
18
|
//#region src/server/mutations/index.d.ts
|
|
19
|
-
declare const storeArgs:
|
|
19
|
+
declare const storeArgs: convex_values40.VObject<{
|
|
20
20
|
args: {
|
|
21
21
|
sessionId?: string | undefined;
|
|
22
22
|
type: "signIn";
|
|
@@ -86,7 +86,7 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
86
86
|
userId: string;
|
|
87
87
|
};
|
|
88
88
|
}, {
|
|
89
|
-
args:
|
|
89
|
+
args: convex_values40.VUnion<{
|
|
90
90
|
sessionId?: string | undefined;
|
|
91
91
|
type: "signIn";
|
|
92
92
|
userId: string;
|
|
@@ -153,27 +153,27 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
153
153
|
except?: string[] | undefined;
|
|
154
154
|
type: "invalidateSessions";
|
|
155
155
|
userId: string;
|
|
156
|
-
}, [
|
|
156
|
+
}, [convex_values40.VObject<{
|
|
157
157
|
sessionId?: string | undefined;
|
|
158
158
|
type: "signIn";
|
|
159
159
|
userId: string;
|
|
160
160
|
generateTokens: boolean;
|
|
161
161
|
}, {
|
|
162
|
-
userId:
|
|
163
|
-
sessionId:
|
|
164
|
-
generateTokens:
|
|
165
|
-
type:
|
|
166
|
-
}, "required", "type" | "userId" | "sessionId" | "generateTokens">,
|
|
162
|
+
userId: convex_values40.VString<string, "required">;
|
|
163
|
+
sessionId: convex_values40.VString<string | undefined, "optional">;
|
|
164
|
+
generateTokens: convex_values40.VBoolean<boolean, "required">;
|
|
165
|
+
type: convex_values40.VLiteral<"signIn", "required">;
|
|
166
|
+
}, "required", "type" | "userId" | "sessionId" | "generateTokens">, convex_values40.VObject<{
|
|
167
167
|
type: "signOut";
|
|
168
168
|
}, {
|
|
169
|
-
type:
|
|
170
|
-
}, "required", "type">,
|
|
169
|
+
type: convex_values40.VLiteral<"signOut", "required">;
|
|
170
|
+
}, "required", "type">, convex_values40.VObject<{
|
|
171
171
|
type: "refreshSession";
|
|
172
172
|
refreshToken: string;
|
|
173
173
|
}, {
|
|
174
|
-
refreshToken:
|
|
175
|
-
type:
|
|
176
|
-
}, "required", "type" | "refreshToken">,
|
|
174
|
+
refreshToken: convex_values40.VString<string, "required">;
|
|
175
|
+
type: convex_values40.VLiteral<"refreshSession", "required">;
|
|
176
|
+
}, "required", "type" | "refreshToken">, convex_values40.VObject<{
|
|
177
177
|
provider?: string | undefined;
|
|
178
178
|
verifier?: string | undefined;
|
|
179
179
|
type: "verifyCodeAndSignIn";
|
|
@@ -181,25 +181,25 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
181
181
|
generateTokens: boolean;
|
|
182
182
|
allowExtraProviders: boolean;
|
|
183
183
|
}, {
|
|
184
|
-
params:
|
|
185
|
-
provider:
|
|
186
|
-
verifier:
|
|
187
|
-
generateTokens:
|
|
188
|
-
allowExtraProviders:
|
|
189
|
-
type:
|
|
190
|
-
}, "required", "provider" | "type" | "params" | "verifier" | "generateTokens" | "allowExtraProviders" | `params.${string}`>,
|
|
184
|
+
params: convex_values40.VAny<any, "required", string>;
|
|
185
|
+
provider: convex_values40.VString<string | undefined, "optional">;
|
|
186
|
+
verifier: convex_values40.VString<string | undefined, "optional">;
|
|
187
|
+
generateTokens: convex_values40.VBoolean<boolean, "required">;
|
|
188
|
+
allowExtraProviders: convex_values40.VBoolean<boolean, "required">;
|
|
189
|
+
type: convex_values40.VLiteral<"verifyCodeAndSignIn", "required">;
|
|
190
|
+
}, "required", "provider" | "type" | "params" | "verifier" | "generateTokens" | "allowExtraProviders" | `params.${string}`>, convex_values40.VObject<{
|
|
191
191
|
type: "verifier";
|
|
192
192
|
}, {
|
|
193
|
-
type:
|
|
194
|
-
}, "required", "type">,
|
|
193
|
+
type: convex_values40.VLiteral<"verifier", "required">;
|
|
194
|
+
}, "required", "type">, convex_values40.VObject<{
|
|
195
195
|
type: "verifierSignature";
|
|
196
196
|
verifier: string;
|
|
197
197
|
signature: string;
|
|
198
198
|
}, {
|
|
199
|
-
verifier:
|
|
200
|
-
signature:
|
|
201
|
-
type:
|
|
202
|
-
}, "required", "type" | "verifier" | "signature">,
|
|
199
|
+
verifier: convex_values40.VString<string, "required">;
|
|
200
|
+
signature: convex_values40.VString<string, "required">;
|
|
201
|
+
type: convex_values40.VLiteral<"verifierSignature", "required">;
|
|
202
|
+
}, "required", "type" | "verifier" | "signature">, convex_values40.VObject<{
|
|
203
203
|
accountExtend?: any;
|
|
204
204
|
provider: string;
|
|
205
205
|
type: "userOAuth";
|
|
@@ -207,13 +207,13 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
207
207
|
providerAccountId: string;
|
|
208
208
|
profile: any;
|
|
209
209
|
}, {
|
|
210
|
-
provider:
|
|
211
|
-
providerAccountId:
|
|
212
|
-
profile:
|
|
213
|
-
signature:
|
|
214
|
-
accountExtend:
|
|
215
|
-
type:
|
|
216
|
-
}, "required", "provider" | "type" | "signature" | "providerAccountId" | "profile" | "accountExtend" | `profile.${string}` | `accountExtend.${string}`>,
|
|
210
|
+
provider: convex_values40.VString<string, "required">;
|
|
211
|
+
providerAccountId: convex_values40.VString<string, "required">;
|
|
212
|
+
profile: convex_values40.VAny<any, "required", string>;
|
|
213
|
+
signature: convex_values40.VString<string, "required">;
|
|
214
|
+
accountExtend: convex_values40.VAny<any, "optional", string>;
|
|
215
|
+
type: convex_values40.VLiteral<"userOAuth", "required">;
|
|
216
|
+
}, "required", "provider" | "type" | "signature" | "providerAccountId" | "profile" | "accountExtend" | `profile.${string}` | `accountExtend.${string}`>, convex_values40.VObject<{
|
|
217
217
|
email?: string | undefined;
|
|
218
218
|
phone?: string | undefined;
|
|
219
219
|
accountId?: string | undefined;
|
|
@@ -223,15 +223,15 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
223
223
|
code: string;
|
|
224
224
|
expirationTime: number;
|
|
225
225
|
}, {
|
|
226
|
-
accountId:
|
|
227
|
-
provider:
|
|
228
|
-
email:
|
|
229
|
-
phone:
|
|
230
|
-
code:
|
|
231
|
-
expirationTime:
|
|
232
|
-
allowExtraProviders:
|
|
233
|
-
type:
|
|
234
|
-
}, "required", "email" | "phone" | "provider" | "type" | "allowExtraProviders" | "accountId" | "code" | "expirationTime">,
|
|
226
|
+
accountId: convex_values40.VString<string | undefined, "optional">;
|
|
227
|
+
provider: convex_values40.VString<string, "required">;
|
|
228
|
+
email: convex_values40.VString<string | undefined, "optional">;
|
|
229
|
+
phone: convex_values40.VString<string | undefined, "optional">;
|
|
230
|
+
code: convex_values40.VString<string, "required">;
|
|
231
|
+
expirationTime: convex_values40.VFloat64<number, "required">;
|
|
232
|
+
allowExtraProviders: convex_values40.VBoolean<boolean, "required">;
|
|
233
|
+
type: convex_values40.VLiteral<"createVerificationCode", "required">;
|
|
234
|
+
}, "required", "email" | "phone" | "provider" | "type" | "allowExtraProviders" | "accountId" | "code" | "expirationTime">, convex_values40.VObject<{
|
|
235
235
|
shouldLinkViaEmail?: boolean | undefined;
|
|
236
236
|
shouldLinkViaPhone?: boolean | undefined;
|
|
237
237
|
provider: string;
|
|
@@ -242,19 +242,19 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
242
242
|
id: string;
|
|
243
243
|
};
|
|
244
244
|
}, {
|
|
245
|
-
provider:
|
|
246
|
-
account:
|
|
245
|
+
provider: convex_values40.VString<string, "required">;
|
|
246
|
+
account: convex_values40.VObject<{
|
|
247
247
|
secret?: string | undefined;
|
|
248
248
|
id: string;
|
|
249
249
|
}, {
|
|
250
|
-
id:
|
|
251
|
-
secret:
|
|
250
|
+
id: convex_values40.VString<string, "required">;
|
|
251
|
+
secret: convex_values40.VString<string | undefined, "optional">;
|
|
252
252
|
}, "required", "id" | "secret">;
|
|
253
|
-
profile:
|
|
254
|
-
shouldLinkViaEmail:
|
|
255
|
-
shouldLinkViaPhone:
|
|
256
|
-
type:
|
|
257
|
-
}, "required", "provider" | "type" | "profile" | `profile.${string}` | "account" | "shouldLinkViaEmail" | "shouldLinkViaPhone" | "account.id" | "account.secret">,
|
|
253
|
+
profile: convex_values40.VAny<any, "required", string>;
|
|
254
|
+
shouldLinkViaEmail: convex_values40.VBoolean<boolean | undefined, "optional">;
|
|
255
|
+
shouldLinkViaPhone: convex_values40.VBoolean<boolean | undefined, "optional">;
|
|
256
|
+
type: convex_values40.VLiteral<"createAccountFromCredentials", "required">;
|
|
257
|
+
}, "required", "provider" | "type" | "profile" | `profile.${string}` | "account" | "shouldLinkViaEmail" | "shouldLinkViaPhone" | "account.id" | "account.secret">, convex_values40.VObject<{
|
|
258
258
|
provider: string;
|
|
259
259
|
type: "retrieveAccountWithCredentials";
|
|
260
260
|
account: {
|
|
@@ -262,16 +262,16 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
262
262
|
id: string;
|
|
263
263
|
};
|
|
264
264
|
}, {
|
|
265
|
-
provider:
|
|
266
|
-
account:
|
|
265
|
+
provider: convex_values40.VString<string, "required">;
|
|
266
|
+
account: convex_values40.VObject<{
|
|
267
267
|
secret?: string | undefined;
|
|
268
268
|
id: string;
|
|
269
269
|
}, {
|
|
270
|
-
id:
|
|
271
|
-
secret:
|
|
270
|
+
id: convex_values40.VString<string, "required">;
|
|
271
|
+
secret: convex_values40.VString<string | undefined, "optional">;
|
|
272
272
|
}, "required", "id" | "secret">;
|
|
273
|
-
type:
|
|
274
|
-
}, "required", "provider" | "type" | "account" | "account.id" | "account.secret">,
|
|
273
|
+
type: convex_values40.VLiteral<"retrieveAccountWithCredentials", "required">;
|
|
274
|
+
}, "required", "provider" | "type" | "account" | "account.id" | "account.secret">, convex_values40.VObject<{
|
|
275
275
|
provider: string;
|
|
276
276
|
type: "modifyAccount";
|
|
277
277
|
account: {
|
|
@@ -279,28 +279,28 @@ declare const storeArgs: convex_values32.VObject<{
|
|
|
279
279
|
secret: string;
|
|
280
280
|
};
|
|
281
281
|
}, {
|
|
282
|
-
provider:
|
|
283
|
-
account:
|
|
282
|
+
provider: convex_values40.VString<string, "required">;
|
|
283
|
+
account: convex_values40.VObject<{
|
|
284
284
|
id: string;
|
|
285
285
|
secret: string;
|
|
286
286
|
}, {
|
|
287
|
-
id:
|
|
288
|
-
secret:
|
|
287
|
+
id: convex_values40.VString<string, "required">;
|
|
288
|
+
secret: convex_values40.VString<string, "required">;
|
|
289
289
|
}, "required", "id" | "secret">;
|
|
290
|
-
type:
|
|
291
|
-
}, "required", "provider" | "type" | "account" | "account.id" | "account.secret">,
|
|
290
|
+
type: convex_values40.VLiteral<"modifyAccount", "required">;
|
|
291
|
+
}, "required", "provider" | "type" | "account" | "account.id" | "account.secret">, convex_values40.VObject<{
|
|
292
292
|
except?: string[] | undefined;
|
|
293
293
|
type: "invalidateSessions";
|
|
294
294
|
userId: string;
|
|
295
295
|
}, {
|
|
296
|
-
userId:
|
|
297
|
-
except:
|
|
298
|
-
type:
|
|
296
|
+
userId: convex_values40.VString<string, "required">;
|
|
297
|
+
except: convex_values40.VArray<string[] | undefined, convex_values40.VString<string, "required">, "optional">;
|
|
298
|
+
type: convex_values40.VLiteral<"invalidateSessions", "required">;
|
|
299
299
|
}, "required", "type" | "userId" | "except">], "required", "email" | "phone" | "provider" | "type" | "params" | "verifier" | "refreshToken" | "userId" | "sessionId" | "generateTokens" | "allowExtraProviders" | `params.${string}` | "signature" | "providerAccountId" | "profile" | "accountExtend" | `profile.${string}` | `accountExtend.${string}` | "accountId" | "code" | "expirationTime" | "account" | "shouldLinkViaEmail" | "shouldLinkViaPhone" | "account.id" | "account.secret" | "except">;
|
|
300
300
|
}, "required", "args" | "args.email" | "args.phone" | "args.provider" | "args.type" | "args.params" | "args.verifier" | "args.refreshToken" | "args.userId" | "args.sessionId" | "args.generateTokens" | "args.allowExtraProviders" | `args.params.${string}` | "args.signature" | "args.providerAccountId" | "args.profile" | "args.accountExtend" | `args.profile.${string}` | `args.accountExtend.${string}` | "args.accountId" | "args.code" | "args.expirationTime" | "args.account" | "args.shouldLinkViaEmail" | "args.shouldLinkViaPhone" | "args.account.id" | "args.account.secret" | "args.except">;
|
|
301
301
|
declare const storeImpl: (ctx: MutationCtx, fnArgs: Infer<typeof storeArgs>, getProviderOrThrow: GetProviderOrThrowFunc, config: Config) => Promise<string | void | {
|
|
302
|
-
userId:
|
|
303
|
-
sessionId:
|
|
302
|
+
userId: convex_values40.GenericId<"User">;
|
|
303
|
+
sessionId: convex_values40.GenericId<"Session">;
|
|
304
304
|
} | (string & {
|
|
305
305
|
__tableName: "AuthVerifier";
|
|
306
306
|
}) | SessionInfo | {
|
|
@@ -2,16 +2,16 @@ import { MutationCtx } from "../types.js";
|
|
|
2
2
|
import { Config } from "../provider.js";
|
|
3
3
|
import { Fx } from "@robelest/fx";
|
|
4
4
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
5
|
-
import * as
|
|
5
|
+
import * as convex_values6 from "convex/values";
|
|
6
6
|
import { Infer } from "convex/values";
|
|
7
7
|
|
|
8
8
|
//#region src/server/mutations/invalidate.d.ts
|
|
9
|
-
declare const invalidateSessionsArgs:
|
|
9
|
+
declare const invalidateSessionsArgs: convex_values6.VObject<{
|
|
10
10
|
except?: string[] | undefined;
|
|
11
11
|
userId: string;
|
|
12
12
|
}, {
|
|
13
|
-
userId:
|
|
14
|
-
except:
|
|
13
|
+
userId: convex_values6.VString<string, "required">;
|
|
14
|
+
except: convex_values6.VArray<string[] | undefined, convex_values6.VString<string, "required">, "optional">;
|
|
15
15
|
}, "required", "userId" | "except">;
|
|
16
16
|
declare const callInvalidateSessions: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: Infer<typeof invalidateSessionsArgs>) => Promise<void>;
|
|
17
17
|
declare function invalidateSessionsImpl(ctx: MutationCtx, args: Infer<typeof invalidateSessionsArgs>, config: Config): Fx<void, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalidate.d.ts","names":[],"sources":["../../../src/server/mutations/invalidate.ts"],"mappings":";;;;;;;;cAWa,sBAAA,
|
|
1
|
+
{"version":3,"file":"invalidate.d.ts","names":[],"sources":["../../../src/server/mutations/invalidate.ts"],"mappings":";;;;;;;;cAWa,sBAAA,iBAAsB,OAAA;;;;UAGjC,cAAA,CAAA,OAAA;;;cAEW,sBAAA,qBACO,gBAAA,EAElB,GAAA,EAAK,gBAAA,CAAiB,SAAA,GACtB,IAAA,EAAM,KAAA,QAAa,sBAAA,MAClB,OAAA;AAAA,iBASa,sBAAA,CACd,GAAA,EAAK,WAAA,EACL,IAAA,EAAM,KAAA,QAAa,sBAAA,GACnB,MAAA,EAAQ,MAAA,GACP,EAAA"}
|
|
@@ -3,22 +3,22 @@ import { AuthError } from "../fx.js";
|
|
|
3
3
|
import { Config, GetProviderOrThrowFunc } from "../provider.js";
|
|
4
4
|
import { Fx } from "@robelest/fx";
|
|
5
5
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
6
|
-
import * as
|
|
6
|
+
import * as convex_values18 from "convex/values";
|
|
7
7
|
import { Infer } from "convex/values";
|
|
8
8
|
|
|
9
9
|
//#region src/server/mutations/oauth.d.ts
|
|
10
|
-
declare const userOAuthArgs:
|
|
10
|
+
declare const userOAuthArgs: convex_values18.VObject<{
|
|
11
11
|
accountExtend?: any;
|
|
12
12
|
provider: string;
|
|
13
13
|
signature: string;
|
|
14
14
|
providerAccountId: string;
|
|
15
15
|
profile: any;
|
|
16
16
|
}, {
|
|
17
|
-
provider:
|
|
18
|
-
providerAccountId:
|
|
19
|
-
profile:
|
|
20
|
-
signature:
|
|
21
|
-
accountExtend:
|
|
17
|
+
provider: convex_values18.VString<string, "required">;
|
|
18
|
+
providerAccountId: convex_values18.VString<string, "required">;
|
|
19
|
+
profile: convex_values18.VAny<any, "required", string>;
|
|
20
|
+
signature: convex_values18.VString<string, "required">;
|
|
21
|
+
accountExtend: convex_values18.VAny<any, "optional", string>;
|
|
22
22
|
}, "required", "provider" | "signature" | "providerAccountId" | "profile" | "accountExtend" | `profile.${string}` | `accountExtend.${string}`>;
|
|
23
23
|
type ReturnType = string;
|
|
24
24
|
declare function userOAuthImpl(ctx: MutationCtx, args: Infer<typeof userOAuthArgs>, getProviderOrThrow: GetProviderOrThrowFunc, config: Config): Fx<ReturnType, AuthError>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Doc, MutationCtx } from "../types.js";
|
|
2
2
|
import { Config, GetProviderOrThrowFunc } from "../provider.js";
|
|
3
3
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
4
|
-
import * as
|
|
4
|
+
import * as convex_values109 from "convex/values";
|
|
5
5
|
import { Infer } from "convex/values";
|
|
6
6
|
|
|
7
7
|
//#region src/server/mutations/register.d.ts
|
|
8
|
-
declare const createAccountFromCredentialsArgs:
|
|
8
|
+
declare const createAccountFromCredentialsArgs: convex_values109.VObject<{
|
|
9
9
|
shouldLinkViaEmail?: boolean | undefined;
|
|
10
10
|
shouldLinkViaPhone?: boolean | undefined;
|
|
11
11
|
provider: string;
|
|
@@ -15,17 +15,17 @@ declare const createAccountFromCredentialsArgs: convex_values108.VObject<{
|
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
17
|
}, {
|
|
18
|
-
provider:
|
|
19
|
-
account:
|
|
18
|
+
provider: convex_values109.VString<string, "required">;
|
|
19
|
+
account: convex_values109.VObject<{
|
|
20
20
|
secret?: string | undefined;
|
|
21
21
|
id: string;
|
|
22
22
|
}, {
|
|
23
|
-
id:
|
|
24
|
-
secret:
|
|
23
|
+
id: convex_values109.VString<string, "required">;
|
|
24
|
+
secret: convex_values109.VString<string | undefined, "optional">;
|
|
25
25
|
}, "required", "id" | "secret">;
|
|
26
|
-
profile:
|
|
27
|
-
shouldLinkViaEmail:
|
|
28
|
-
shouldLinkViaPhone:
|
|
26
|
+
profile: convex_values109.VAny<any, "required", string>;
|
|
27
|
+
shouldLinkViaEmail: convex_values109.VBoolean<boolean | undefined, "optional">;
|
|
28
|
+
shouldLinkViaPhone: convex_values109.VBoolean<boolean | undefined, "optional">;
|
|
29
29
|
}, "required", "provider" | "profile" | `profile.${string}` | "account" | "shouldLinkViaEmail" | "shouldLinkViaPhone" | "account.id" | "account.secret">;
|
|
30
30
|
type ReturnType = {
|
|
31
31
|
account: Doc<"Account">;
|
|
@@ -2,24 +2,24 @@ import { Doc, MutationCtx } from "../types.js";
|
|
|
2
2
|
import { Config, GetProviderOrThrowFunc } from "../provider.js";
|
|
3
3
|
import { Fx } from "@robelest/fx";
|
|
4
4
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
5
|
-
import * as
|
|
5
|
+
import * as convex_values26 from "convex/values";
|
|
6
6
|
import { Infer } from "convex/values";
|
|
7
7
|
|
|
8
8
|
//#region src/server/mutations/retrieve.d.ts
|
|
9
|
-
declare const retrieveAccountWithCredentialsArgs:
|
|
9
|
+
declare const retrieveAccountWithCredentialsArgs: convex_values26.VObject<{
|
|
10
10
|
provider: string;
|
|
11
11
|
account: {
|
|
12
12
|
secret?: string | undefined;
|
|
13
13
|
id: string;
|
|
14
14
|
};
|
|
15
15
|
}, {
|
|
16
|
-
provider:
|
|
17
|
-
account:
|
|
16
|
+
provider: convex_values26.VString<string, "required">;
|
|
17
|
+
account: convex_values26.VObject<{
|
|
18
18
|
secret?: string | undefined;
|
|
19
19
|
id: string;
|
|
20
20
|
}, {
|
|
21
|
-
id:
|
|
22
|
-
secret:
|
|
21
|
+
id: convex_values26.VString<string, "required">;
|
|
22
|
+
secret: convex_values26.VString<string | undefined, "optional">;
|
|
23
23
|
}, "required", "id" | "secret">;
|
|
24
24
|
}, "required", "provider" | "account" | "account.id" | "account.secret">;
|
|
25
25
|
type ReturnType = "InvalidAccountId" | "TooManyFailedAttempts" | "InvalidSecret" | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieve.d.ts","names":[],"sources":["../../../src/server/mutations/retrieve.ts"],"mappings":";;;;;;;;cAgBa,kCAAA,
|
|
1
|
+
{"version":3,"file":"retrieve.d.ts","names":[],"sources":["../../../src/server/mutations/retrieve.ts"],"mappings":";;;;;;;;cAgBa,kCAAA,kBAAkC,OAAA;;;;;;;YAG7C,eAAA,CAAA,OAAA;;;;;;;;;KAEG,UAAA;EAIC,OAAA,EAAS,GAAA;EAAgB,IAAA,EAAM,GAAA;AAAA;AAAA,iBAErB,kCAAA,CACd,GAAA,EAAK,WAAA,EACL,IAAA,EAAM,KAAA,QAAa,kCAAA,GACnB,kBAAA,EAAoB,sBAAA,EACpB,MAAA,EAAQ,MAAA,GACP,EAAA,CAAG,UAAA;AAAA,cAgEO,kCAAA,qBACO,gBAAA,EAElB,GAAA,EAAK,gBAAA,CAAiB,SAAA,GACtB,IAAA,EAAM,KAAA,QAAa,kCAAA,MAClB,OAAA,CAAQ,UAAA;;cAUE,kCAAA,qBAdO,gBAAA,EAAgB,GAAA,EAE7B,gBAAA,CAAiB,SAAA,GAAU,IAAA,EAC1B,KAAA,QAAa,kCAAA,MAClB,OAAA,CAAQ,UAAA"}
|
|
@@ -3,16 +3,16 @@ import { AuthError } from "../fx.js";
|
|
|
3
3
|
import { Config } from "../provider.js";
|
|
4
4
|
import { Fx } from "@robelest/fx";
|
|
5
5
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
6
|
-
import * as
|
|
6
|
+
import * as convex_values37 from "convex/values";
|
|
7
7
|
import { Infer } from "convex/values";
|
|
8
8
|
|
|
9
9
|
//#region src/server/mutations/signature.d.ts
|
|
10
|
-
declare const verifierSignatureArgs:
|
|
10
|
+
declare const verifierSignatureArgs: convex_values37.VObject<{
|
|
11
11
|
verifier: string;
|
|
12
12
|
signature: string;
|
|
13
13
|
}, {
|
|
14
|
-
verifier:
|
|
15
|
-
signature:
|
|
14
|
+
verifier: convex_values37.VString<string, "required">;
|
|
15
|
+
signature: convex_values37.VString<string, "required">;
|
|
16
16
|
}, "required", "verifier" | "signature">;
|
|
17
17
|
type ReturnType = void;
|
|
18
18
|
declare function verifierSignatureImpl(ctx: MutationCtx, args: Infer<typeof verifierSignatureArgs>, config: Config): Fx<ReturnType, AuthError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.d.ts","names":[],"sources":["../../../src/server/mutations/signature.ts"],"mappings":";;;;;;;;;cAUa,qBAAA,
|
|
1
|
+
{"version":3,"file":"signature.d.ts","names":[],"sources":["../../../src/server/mutations/signature.ts"],"mappings":";;;;;;;;;cAUa,qBAAA,kBAAqB,OAAA;;;;YAGhC,eAAA,CAAA,OAAA;;;KAEG,UAAA;AAAA,iBAEW,qBAAA,CACd,GAAA,EAAK,WAAA,EACL,IAAA,EAAM,KAAA,QAAa,qBAAA,GACnB,MAAA,EAAQ,MAAA,GACP,EAAA,CAAG,UAAA,EAAY,SAAA;AAAA,cAkBL,qBAAA,qBAAiD,gBAAA,EAC5D,GAAA,EAAK,gBAAA,CAAiB,SAAA,GACtB,IAAA,EAAM,KAAA,QAAa,qBAAA,MAClB,OAAA"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { MutationCtx, SessionInfo } from "../types.js";
|
|
2
2
|
import { Config } from "../provider.js";
|
|
3
3
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
4
|
-
import * as
|
|
4
|
+
import * as convex_values117 from "convex/values";
|
|
5
5
|
import { Infer } from "convex/values";
|
|
6
6
|
|
|
7
7
|
//#region src/server/mutations/signin.d.ts
|
|
8
|
-
declare const signInArgs:
|
|
8
|
+
declare const signInArgs: convex_values117.VObject<{
|
|
9
9
|
sessionId?: string | undefined;
|
|
10
10
|
userId: string;
|
|
11
11
|
generateTokens: boolean;
|
|
12
12
|
}, {
|
|
13
|
-
userId:
|
|
14
|
-
sessionId:
|
|
15
|
-
generateTokens:
|
|
13
|
+
userId: convex_values117.VString<string, "required">;
|
|
14
|
+
sessionId: convex_values117.VString<string | undefined, "optional">;
|
|
15
|
+
generateTokens: convex_values117.VBoolean<boolean, "required">;
|
|
16
16
|
}, "required", "userId" | "sessionId" | "generateTokens">;
|
|
17
17
|
type ReturnType = SessionInfo;
|
|
18
18
|
declare function signInImpl(ctx: MutationCtx, args: Infer<typeof signInArgs>, config: Config): Promise<ReturnType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signin.d.ts","names":[],"sources":["../../../src/server/mutations/signin.ts"],"mappings":";;;;;;;cAYa,UAAA,
|
|
1
|
+
{"version":3,"file":"signin.d.ts","names":[],"sources":["../../../src/server/mutations/signin.ts"],"mappings":";;;;;;;cAYa,UAAA,mBAAU,OAAA;;;;;UAIrB,gBAAA,CAAA,OAAA;;;;KAEG,UAAA,GAAa,WAAA;AAAA,iBAEI,UAAA,CACpB,GAAA,EAAK,WAAA,EACL,IAAA,EAAM,KAAA,QAAa,UAAA,GACnB,MAAA,EAAQ,MAAA,GACP,OAAA,CAAQ,UAAA;AAAA,cAmBE,UAAA,qBAAsC,gBAAA,EACjD,GAAA,EAAK,gBAAA,CAAiB,SAAA,GACtB,IAAA,EAAM,KAAA,QAAa,UAAA,MAClB,OAAA,CAAQ,UAAA"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { MutationCtx, SessionInfo } from "../types.js";
|
|
2
2
|
import { Config, GetProviderOrThrowFunc } from "../provider.js";
|
|
3
3
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
4
|
-
import * as
|
|
4
|
+
import * as convex_values31 from "convex/values";
|
|
5
5
|
import { Infer } from "convex/values";
|
|
6
6
|
|
|
7
7
|
//#region src/server/mutations/verify.d.ts
|
|
8
|
-
declare const verifyCodeAndSignInArgs:
|
|
8
|
+
declare const verifyCodeAndSignInArgs: convex_values31.VObject<{
|
|
9
9
|
provider?: string | undefined;
|
|
10
10
|
verifier?: string | undefined;
|
|
11
11
|
params: any;
|
|
12
12
|
generateTokens: boolean;
|
|
13
13
|
allowExtraProviders: boolean;
|
|
14
14
|
}, {
|
|
15
|
-
params:
|
|
16
|
-
provider:
|
|
17
|
-
verifier:
|
|
18
|
-
generateTokens:
|
|
19
|
-
allowExtraProviders:
|
|
15
|
+
params: convex_values31.VAny<any, "required", string>;
|
|
16
|
+
provider: convex_values31.VString<string | undefined, "optional">;
|
|
17
|
+
verifier: convex_values31.VString<string | undefined, "optional">;
|
|
18
|
+
generateTokens: convex_values31.VBoolean<boolean, "required">;
|
|
19
|
+
allowExtraProviders: convex_values31.VBoolean<boolean, "required">;
|
|
20
20
|
}, "required", "provider" | "params" | "verifier" | "generateTokens" | "allowExtraProviders" | `params.${string}`>;
|
|
21
21
|
type ReturnType = null | SessionInfo;
|
|
22
22
|
declare function verifyCodeAndSignInImpl(ctx: MutationCtx, args: Infer<typeof verifyCodeAndSignInArgs>, getProviderOrThrow: GetProviderOrThrowFunc, config: Config): Promise<ReturnType>;
|
package/dist/server/signin.js
CHANGED
|
@@ -55,7 +55,8 @@ function signInFx(ctx, provider, args, options) {
|
|
|
55
55
|
oauth: (p) => handleOAuthProviderFx(ctx, p, args, options),
|
|
56
56
|
passkey: (p) => handlePasskeyFx(ctx, p, args),
|
|
57
57
|
totp: (p) => handleTotp(ctx, p, args),
|
|
58
|
-
device: (p) => handleDevice(ctx, p, args)
|
|
58
|
+
device: (p) => handleDevice(ctx, p, args),
|
|
59
|
+
sso: (_p) => handleSsoProviderFx(ctx, args)
|
|
59
60
|
});
|
|
60
61
|
});
|
|
61
62
|
}
|
|
@@ -175,6 +176,24 @@ function handleOAuthProviderFx(ctx, provider, args, options) {
|
|
|
175
176
|
};
|
|
176
177
|
});
|
|
177
178
|
}
|
|
179
|
+
function handleSsoProviderFx(ctx, args) {
|
|
180
|
+
return Fx.gen(function* () {
|
|
181
|
+
const enterpriseId = args.params?.enterpriseId;
|
|
182
|
+
if (!enterpriseId || typeof enterpriseId !== "string") return yield* Fx.fail(new AuthError("SIGN_IN_MISSING_PARAMS", "enterpriseId is required for SSO sign-in."));
|
|
183
|
+
const protocol = args.params?.protocol ?? "oidc";
|
|
184
|
+
if (protocol !== "oidc" && protocol !== "saml") return yield* Fx.fail(new AuthError("SIGN_IN_MISSING_PARAMS", `Invalid SSO protocol: ${protocol}. Expected "oidc" or "saml".`));
|
|
185
|
+
const verifier = yield* Fx.promise(() => callVerifier(ctx));
|
|
186
|
+
const siteUrl = process.env.CUSTOM_AUTH_SITE_URL ?? requireEnv("CONVEX_SITE_URL");
|
|
187
|
+
const redirect = new URL(`${siteUrl}/api/auth/sso/${enterpriseId}/${protocol}/signin`);
|
|
188
|
+
redirect.searchParams.set("code", verifier);
|
|
189
|
+
if (typeof args.params?.redirectTo === "string") redirect.searchParams.set("redirectTo", args.params.redirectTo);
|
|
190
|
+
return {
|
|
191
|
+
kind: "redirect",
|
|
192
|
+
redirect: redirect.toString(),
|
|
193
|
+
verifier
|
|
194
|
+
};
|
|
195
|
+
});
|
|
196
|
+
}
|
|
178
197
|
|
|
179
198
|
//#endregion
|
|
180
199
|
export { signInImpl };
|