@robelest/convex-auth 0.0.4-preview.27 → 0.0.4-preview.28
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/README.md +3 -5
- package/dist/bin.js +6488 -1571
- package/dist/browser/index.js +10 -7
- package/dist/browser/locks.js +3 -5
- package/dist/browser/navigation.js +7 -10
- package/dist/browser/runtime.js +35 -33
- package/dist/client/core/types.js +17 -0
- package/dist/client/factors/device.js +26 -19
- package/dist/client/index.js +151 -163
- package/dist/client/runtime/proxy.js +6 -6
- package/dist/client/services/adapters.js +3 -7
- package/dist/client/services/http.js +2 -5
- package/dist/client/services/resolve.js +5 -11
- package/dist/client/services/runtime.js +2 -5
- package/dist/component/_generated/component.d.ts +46 -0
- package/dist/component/index.d.ts +3 -3
- package/dist/component/model.d.ts +25 -25
- package/dist/component/public/identity/sessions.js +38 -1
- package/dist/component/public/identity/tokens.js +81 -3
- package/dist/component/public/identity/verifiers.js +9 -3
- package/dist/component/public.js +3 -3
- package/dist/component/schema.d.ts +320 -320
- package/dist/core/index.d.ts +380 -0
- package/dist/core/index.js +83 -0
- package/dist/otel.d.ts +13 -17
- package/dist/otel.js +39 -49
- package/dist/providers/email.d.ts +2 -2
- package/dist/providers/password.js +8 -16
- package/dist/providers/phone.js +2 -9
- package/dist/server/auth-context.d.ts +204 -0
- package/dist/server/auth-context.js +76 -0
- package/dist/server/auth.d.ts +25 -187
- package/dist/server/auth.js +5 -96
- package/dist/server/componentContext.d.ts +12 -0
- package/dist/server/componentContext.js +1 -0
- package/dist/server/config.js +1 -12
- package/dist/server/constants.js +6 -0
- package/dist/server/contract.d.ts +1 -1
- package/dist/server/core.js +5 -14
- package/dist/server/crypto.js +26 -18
- package/dist/server/db.js +6 -1
- package/dist/server/device.js +88 -78
- package/dist/server/http.d.ts +4 -3
- package/dist/server/http.js +74 -86
- package/dist/server/index.d.ts +2 -1
- package/dist/server/limits.js +22 -15
- package/dist/server/mounts.d.ts +103 -103
- package/dist/server/mutations/account.js +6 -4
- package/dist/server/mutations/invalidate.js +3 -6
- package/dist/server/mutations/oauth.js +86 -88
- package/dist/server/mutations/refresh.js +45 -87
- package/dist/server/mutations/register.js +19 -19
- package/dist/server/mutations/retrieve.js +17 -15
- package/dist/server/mutations/signature.js +9 -13
- package/dist/server/mutations/signin.js +7 -3
- package/dist/server/mutations/signout.js +10 -15
- package/dist/server/mutations/store.js +22 -12
- package/dist/server/mutations/verifier.js +11 -6
- package/dist/server/mutations/verify.js +55 -46
- package/dist/server/oauth/runtime.js +27 -25
- package/dist/server/passkey.js +299 -250
- package/dist/server/prefetch.js +283 -281
- package/dist/server/refresh.js +7 -60
- package/dist/server/runtime.d.ts +82 -206
- package/dist/server/runtime.js +63 -56
- package/dist/server/services/config.js +5 -3
- package/dist/server/services/logger.js +2 -4
- package/dist/server/services/providers.js +2 -4
- package/dist/server/services/refresh.js +2 -4
- package/dist/server/services/resolve.js +15 -14
- package/dist/server/services/signin.js +2 -4
- package/dist/server/sessions.js +32 -33
- package/dist/server/signin.js +177 -142
- package/dist/server/sso/domain.d.ts +20 -68
- package/dist/server/sso/domain.js +444 -413
- package/dist/server/sso/http.js +53 -59
- package/dist/server/sso/oidc.js +94 -80
- package/dist/server/tokens.js +13 -3
- package/dist/server/totp.js +153 -116
- package/dist/server/types.d.ts +2 -2
- package/dist/server/users.js +18 -23
- package/dist/server/utils/cache.js +51 -0
- package/dist/server/utils/dispatch.js +36 -0
- package/dist/server/utils/retry.js +24 -0
- package/dist/server/utils/span.js +32 -0
- package/dist/shared/errors.js +9 -3
- package/dist/shared/log.js +20 -22
- package/package.json +41 -33
package/dist/server/refresh.js
CHANGED
|
@@ -1,80 +1,27 @@
|
|
|
1
|
-
import { LOG_LEVELS } from "../shared/log.js";
|
|
2
1
|
import { envOptionalNumber, readConfigSync } from "./env.js";
|
|
3
|
-
import {
|
|
4
|
-
import { log, maybeRedact } from "./log.js";
|
|
2
|
+
import { maybeRedact } from "./log.js";
|
|
5
3
|
import { ConvexError } from "convex/values";
|
|
6
|
-
import { Effect } from "effect";
|
|
7
4
|
|
|
8
5
|
//#region src/server/refresh.ts
|
|
9
6
|
const REFRESH_TOKEN_DIVIDER = "|";
|
|
10
7
|
const DEFAULT_SESSION_INACTIVE_DURATION_MS = 1e3 * 60 * 60 * 24 * 30;
|
|
11
8
|
/** @internal */
|
|
12
9
|
const REFRESH_TOKEN_REUSE_WINDOW_MS = 10 * 1e3;
|
|
13
|
-
|
|
14
|
-
async function createRefreshToken(ctx, config, sessionId, parentRefreshTokenId) {
|
|
15
|
-
const expirationTime = Date.now() + (config.session?.inactiveDurationMs ?? readConfigSync(envOptionalNumber("AUTH_SESSION_INACTIVE_DURATION_MS")) ?? DEFAULT_SESSION_INACTIVE_DURATION_MS);
|
|
16
|
-
return authDb(ctx, config).refreshTokens.create({
|
|
17
|
-
sessionId,
|
|
18
|
-
expirationTime,
|
|
19
|
-
parentRefreshTokenId: parentRefreshTokenId ?? void 0
|
|
20
|
-
});
|
|
21
|
-
}
|
|
10
|
+
const refreshTokenExpirationTime = (config, now = Date.now()) => now + (config.session?.inactiveDurationMs ?? readConfigSync(envOptionalNumber("AUTH_SESSION_INACTIVE_DURATION_MS")) ?? DEFAULT_SESSION_INACTIVE_DURATION_MS);
|
|
22
11
|
/** @internal */
|
|
23
12
|
const parseRefreshToken = (refreshToken) => {
|
|
24
13
|
const [refreshTokenId, sessionId] = refreshToken.split(REFRESH_TOKEN_DIVIDER);
|
|
25
14
|
const message = `Can't parse refresh token: ${maybeRedact(refreshToken)}`;
|
|
26
|
-
if (refreshTokenId == null || sessionId == null)
|
|
15
|
+
if (refreshTokenId == null || sessionId == null) throw new ConvexError({
|
|
27
16
|
code: "INVALID_REFRESH_TOKEN",
|
|
28
17
|
message
|
|
29
|
-
})
|
|
30
|
-
return
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
31
20
|
refreshTokenId,
|
|
32
21
|
sessionId
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
/** @internal */
|
|
36
|
-
function invalidateRefreshTokensInSubtree(ctx, refreshToken, config) {
|
|
37
|
-
const db = authDb(ctx, config);
|
|
38
|
-
return Effect.gen(function* () {
|
|
39
|
-
const tokensToInvalidate = [refreshToken];
|
|
40
|
-
const visited = new Set([refreshToken._id]);
|
|
41
|
-
let frontier = [refreshToken._id];
|
|
42
|
-
while (frontier.length > 0) {
|
|
43
|
-
const nextFrontier = [];
|
|
44
|
-
for (const currentTokenId of frontier) {
|
|
45
|
-
const children = yield* Effect.promise(() => db.refreshTokens.getChildren(refreshToken.sessionId, currentTokenId));
|
|
46
|
-
for (const child of children) {
|
|
47
|
-
if (visited.has(child._id)) continue;
|
|
48
|
-
visited.add(child._id);
|
|
49
|
-
tokensToInvalidate.push(child);
|
|
50
|
-
nextFrontier.push(child._id);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
frontier = nextFrontier;
|
|
54
|
-
}
|
|
55
|
-
yield* Effect.forEach(tokensToInvalidate, (token) => token.firstUsedTime === void 0 || token.firstUsedTime > Date.now() - REFRESH_TOKEN_REUSE_WINDOW_MS ? Effect.promise(() => db.refreshTokens.patch(token._id, { firstUsedTime: Date.now() - REFRESH_TOKEN_REUSE_WINDOW_MS })) : Effect.void, { discard: true });
|
|
56
|
-
return tokensToInvalidate;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/** @internal */
|
|
60
|
-
const refreshTokenIfValid = (ctx, refreshTokenId, tokenSessionId, config) => {
|
|
61
|
-
const db = authDb(ctx, config);
|
|
62
|
-
const fetchDoc = (promise, failMsg) => Effect.tryPromise({
|
|
63
|
-
try: promise,
|
|
64
|
-
catch: () => failMsg
|
|
65
|
-
}).pipe(Effect.catch((message) => Effect.sync(() => {
|
|
66
|
-
log(LOG_LEVELS.ERROR, message);
|
|
67
|
-
return null;
|
|
68
|
-
})));
|
|
69
|
-
return fetchDoc(() => db.refreshTokens.getById(refreshTokenId), "Invalid refresh token format").pipe(Effect.flatMap((doc) => doc !== null ? Effect.succeed(doc) : Effect.fail("Invalid refresh token")), Effect.flatMap((doc) => doc.expirationTime >= Date.now() ? Effect.succeed(doc) : Effect.fail("Expired refresh token")), Effect.flatMap((doc) => doc.sessionId === tokenSessionId ? Effect.succeed(doc) : Effect.fail("Invalid refresh token session ID"))).pipe(Effect.flatMap((refreshTokenDoc) => fetchDoc(() => db.sessions.getById(refreshTokenDoc.sessionId), "Invalid refresh token session format").pipe(Effect.flatMap((session) => session !== null ? Effect.succeed(session) : Effect.fail("Invalid refresh token session")), Effect.flatMap((session) => session.expirationTime >= Date.now() ? Effect.succeed(session) : Effect.fail("Expired refresh token session")), Effect.map((session) => ({
|
|
70
|
-
session,
|
|
71
|
-
refreshTokenDoc
|
|
72
|
-
})))), Effect.catch((message) => Effect.sync(() => {
|
|
73
|
-
log(LOG_LEVELS.ERROR, message);
|
|
74
|
-
return null;
|
|
75
|
-
})));
|
|
22
|
+
};
|
|
76
23
|
};
|
|
77
24
|
|
|
78
25
|
//#endregion
|
|
79
|
-
export { REFRESH_TOKEN_DIVIDER, REFRESH_TOKEN_REUSE_WINDOW_MS,
|
|
26
|
+
export { REFRESH_TOKEN_DIVIDER, REFRESH_TOKEN_REUSE_WINDOW_MS, parseRefreshToken, refreshTokenExpirationTime };
|
|
80
27
|
//# sourceMappingURL=refresh.js.map
|
package/dist/server/runtime.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentCtx, ComponentReadCtx } from "./componentContext.js";
|
|
2
|
+
import { AuthProviderConfig, ConvexAuthConfig, CorsConfig, HttpKeyContext, KeyDoc, KeyScope, ScopeChecker, UserOrderBy, UserWhere } from "./types.js";
|
|
2
3
|
import { AuthProfile, SignInParams } from "./payloads.js";
|
|
3
4
|
import { HttpAuthContext, HttpAuthContextConfig, OptionalHttpAuthContext } from "./http.js";
|
|
4
5
|
import { createGroupConnectionDomain } from "./sso/domain.js";
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
6
|
+
import * as convex_values1133 from "convex/values";
|
|
7
|
+
import * as convex_server106 from "convex/server";
|
|
7
8
|
import { GenericActionCtx, GenericDataModel, HttpRouter } from "convex/server";
|
|
8
9
|
|
|
9
10
|
//#region src/server/runtime.d.ts
|
|
@@ -31,33 +32,21 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
31
32
|
*/
|
|
32
33
|
auth: {
|
|
33
34
|
user: {
|
|
34
|
-
get: (ctx:
|
|
35
|
-
|
|
36
|
-
}, userId: string) => Promise<any>;
|
|
37
|
-
list: (ctx: {
|
|
38
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
39
|
-
}, opts?: {
|
|
35
|
+
get: (ctx: ComponentReadCtx, userId: string) => Promise<any>;
|
|
36
|
+
list: (ctx: ComponentReadCtx, opts?: {
|
|
40
37
|
where?: UserWhere;
|
|
41
38
|
limit?: number;
|
|
42
39
|
cursor?: string | null;
|
|
43
40
|
orderBy?: UserOrderBy;
|
|
44
41
|
order?: "asc" | "desc";
|
|
45
42
|
}) => Promise<any>;
|
|
46
|
-
viewer: (ctx: {
|
|
47
|
-
|
|
48
|
-
} & {
|
|
49
|
-
auth: convex_server100.Auth;
|
|
43
|
+
viewer: (ctx: ComponentReadCtx & {
|
|
44
|
+
auth: convex_server106.Auth;
|
|
50
45
|
}) => Promise<any>;
|
|
51
|
-
update: (ctx: {
|
|
52
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
53
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
54
|
-
}, userId: string, data: Record<string, unknown>) => Promise<{
|
|
46
|
+
update: (ctx: ComponentCtx, userId: string, data: Record<string, unknown>) => Promise<{
|
|
55
47
|
userId: string;
|
|
56
48
|
}>;
|
|
57
|
-
setActiveGroup: (ctx: {
|
|
58
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
59
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
60
|
-
}, opts: {
|
|
49
|
+
setActiveGroup: (ctx: ComponentCtx, opts: {
|
|
61
50
|
userId: string;
|
|
62
51
|
groupId: string | null;
|
|
63
52
|
}) => Promise<{
|
|
@@ -67,15 +56,10 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
67
56
|
userId: string;
|
|
68
57
|
groupId: string;
|
|
69
58
|
}>;
|
|
70
|
-
getActiveGroup: (ctx: {
|
|
71
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
72
|
-
}, opts: {
|
|
59
|
+
getActiveGroup: (ctx: ComponentReadCtx, opts: {
|
|
73
60
|
userId: string;
|
|
74
61
|
}) => Promise<string | null>;
|
|
75
|
-
delete: (ctx: {
|
|
76
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
77
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
78
|
-
}, userId: string, opts?: {
|
|
62
|
+
delete: (ctx: ComponentCtx, userId: string, opts?: {
|
|
79
63
|
cascade?: boolean;
|
|
80
64
|
}) => Promise<{
|
|
81
65
|
userId: string;
|
|
@@ -83,21 +67,17 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
83
67
|
};
|
|
84
68
|
session: {
|
|
85
69
|
current: (ctx: {
|
|
86
|
-
auth:
|
|
87
|
-
}) => Promise<
|
|
70
|
+
auth: convex_server106.Auth;
|
|
71
|
+
}) => Promise<convex_values1133.GenericId<"Session"> | null>;
|
|
88
72
|
invalidate: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: {
|
|
89
|
-
userId:
|
|
90
|
-
except?:
|
|
73
|
+
userId: convex_values1133.GenericId<"User">;
|
|
74
|
+
except?: convex_values1133.GenericId<"Session">[];
|
|
91
75
|
}) => Promise<{
|
|
92
|
-
userId:
|
|
93
|
-
except:
|
|
76
|
+
userId: convex_values1133.GenericId<"User">;
|
|
77
|
+
except: convex_values1133.GenericId<"Session">[];
|
|
94
78
|
}>;
|
|
95
|
-
get: (ctx:
|
|
96
|
-
|
|
97
|
-
}, sessionId: string) => Promise<any>;
|
|
98
|
-
list: (ctx: {
|
|
99
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
100
|
-
}, opts: {
|
|
79
|
+
get: (ctx: ComponentReadCtx, sessionId: string) => Promise<any>;
|
|
80
|
+
list: (ctx: ComponentReadCtx, opts: {
|
|
101
81
|
userId: string;
|
|
102
82
|
}) => Promise<any>;
|
|
103
83
|
};
|
|
@@ -142,55 +122,36 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
142
122
|
}) => Promise<{
|
|
143
123
|
accountId: string;
|
|
144
124
|
}>;
|
|
145
|
-
delete: (ctx: {
|
|
146
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
147
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
148
|
-
}, accountId: string) => Promise<{
|
|
125
|
+
delete: (ctx: ComponentCtx, accountId: string) => Promise<{
|
|
149
126
|
accountId: string;
|
|
150
127
|
}>;
|
|
151
|
-
listPasskeys: (ctx: {
|
|
152
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
153
|
-
}, opts: {
|
|
128
|
+
listPasskeys: (ctx: ComponentReadCtx, opts: {
|
|
154
129
|
userId: string;
|
|
155
130
|
}) => Promise<any>;
|
|
156
|
-
renamePasskey: (ctx: {
|
|
157
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
158
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
159
|
-
}, passkeyId: string, name: string) => Promise<{
|
|
131
|
+
renamePasskey: (ctx: ComponentCtx, passkeyId: string, name: string) => Promise<{
|
|
160
132
|
passkeyId: string;
|
|
161
133
|
}>;
|
|
162
|
-
deletePasskey: (ctx: {
|
|
163
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
164
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
165
|
-
}, passkeyId: string) => Promise<{
|
|
134
|
+
deletePasskey: (ctx: ComponentCtx, passkeyId: string) => Promise<{
|
|
166
135
|
passkeyId: string;
|
|
167
136
|
}>;
|
|
168
|
-
listTotps: (ctx: {
|
|
169
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
170
|
-
}, opts: {
|
|
137
|
+
listTotps: (ctx: ComponentReadCtx, opts: {
|
|
171
138
|
userId: string;
|
|
172
139
|
}) => Promise<any>;
|
|
173
|
-
deleteTotp: (ctx: {
|
|
174
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
175
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
176
|
-
}, totpId: string) => Promise<{
|
|
140
|
+
deleteTotp: (ctx: ComponentCtx, totpId: string) => Promise<{
|
|
177
141
|
totpId: string;
|
|
178
142
|
}>;
|
|
179
143
|
};
|
|
180
144
|
provider: {
|
|
181
|
-
signIn: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, providerConfig: AuthProviderConfig, args: {
|
|
182
|
-
accountId?:
|
|
145
|
+
signIn: (<DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, providerConfig: AuthProviderConfig, args: {
|
|
146
|
+
accountId?: convex_values1133.GenericId<"Account">;
|
|
183
147
|
params?: SignInParams;
|
|
184
148
|
}) => Promise<{
|
|
185
|
-
userId:
|
|
186
|
-
sessionId:
|
|
187
|
-
} | null
|
|
149
|
+
userId: string;
|
|
150
|
+
sessionId: string;
|
|
151
|
+
} | null>) | undefined;
|
|
188
152
|
};
|
|
189
153
|
group: {
|
|
190
|
-
create: (ctx: {
|
|
191
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
192
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
193
|
-
}, data: {
|
|
154
|
+
create: (ctx: ComponentCtx, data: {
|
|
194
155
|
name: string;
|
|
195
156
|
slug?: string;
|
|
196
157
|
type?: string;
|
|
@@ -203,12 +164,8 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
203
164
|
}) => Promise<{
|
|
204
165
|
groupId: string;
|
|
205
166
|
}>;
|
|
206
|
-
get: (ctx:
|
|
207
|
-
|
|
208
|
-
}, groupId: string) => Promise<any>;
|
|
209
|
-
list: (ctx: {
|
|
210
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
211
|
-
}, opts?: {
|
|
167
|
+
get: (ctx: ComponentReadCtx, groupId: string) => Promise<any>;
|
|
168
|
+
list: (ctx: ComponentReadCtx, opts?: {
|
|
212
169
|
where?: {
|
|
213
170
|
slug?: string;
|
|
214
171
|
type?: string;
|
|
@@ -229,21 +186,13 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
229
186
|
orderBy?: "_creationTime" | "name" | "slug" | "type";
|
|
230
187
|
order?: "asc" | "desc";
|
|
231
188
|
}) => Promise<any>;
|
|
232
|
-
update: (ctx: {
|
|
233
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
234
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
235
|
-
}, groupId: string, data: Record<string, unknown>) => Promise<{
|
|
189
|
+
update: (ctx: ComponentCtx, groupId: string, data: Record<string, unknown>) => Promise<{
|
|
236
190
|
groupId: string;
|
|
237
191
|
}>;
|
|
238
|
-
delete: (ctx: {
|
|
239
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
240
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
241
|
-
}, groupId: string) => Promise<{
|
|
192
|
+
delete: (ctx: ComponentCtx, groupId: string) => Promise<{
|
|
242
193
|
groupId: string;
|
|
243
194
|
}>;
|
|
244
|
-
ancestors: (ctx: {
|
|
245
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
246
|
-
}, opts: {
|
|
195
|
+
ancestors: (ctx: ComponentReadCtx, opts: {
|
|
247
196
|
groupId: string;
|
|
248
197
|
maxDepth?: number;
|
|
249
198
|
includeSelf?: boolean;
|
|
@@ -254,10 +203,7 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
254
203
|
}>;
|
|
255
204
|
};
|
|
256
205
|
member: {
|
|
257
|
-
create: (ctx: {
|
|
258
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
259
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
260
|
-
}, data: {
|
|
206
|
+
create: (ctx: ComponentCtx, data: {
|
|
261
207
|
groupId: string;
|
|
262
208
|
userId: string;
|
|
263
209
|
roleIds?: string[];
|
|
@@ -266,12 +212,8 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
266
212
|
}) => Promise<{
|
|
267
213
|
memberId: string;
|
|
268
214
|
}>;
|
|
269
|
-
get: (ctx:
|
|
270
|
-
|
|
271
|
-
}, memberId: string) => Promise<any>;
|
|
272
|
-
list: (ctx: {
|
|
273
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
274
|
-
}, opts?: {
|
|
215
|
+
get: (ctx: ComponentReadCtx, memberId: string) => Promise<any>;
|
|
216
|
+
list: (ctx: ComponentReadCtx, opts?: {
|
|
275
217
|
where?: {
|
|
276
218
|
groupId?: string;
|
|
277
219
|
userId?: string;
|
|
@@ -283,21 +225,13 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
283
225
|
orderBy?: "_creationTime" | "status";
|
|
284
226
|
order?: "asc" | "desc";
|
|
285
227
|
}) => Promise<any>;
|
|
286
|
-
delete: (ctx: {
|
|
287
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
288
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
289
|
-
}, memberId: string) => Promise<{
|
|
228
|
+
delete: (ctx: ComponentCtx, memberId: string) => Promise<{
|
|
290
229
|
memberId: string;
|
|
291
230
|
}>;
|
|
292
|
-
update: (ctx: {
|
|
293
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
294
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
295
|
-
}, memberId: string, data: Record<string, unknown>) => Promise<{
|
|
231
|
+
update: (ctx: ComponentCtx, memberId: string, data: Record<string, unknown>) => Promise<{
|
|
296
232
|
memberId: string;
|
|
297
233
|
}>;
|
|
298
|
-
inspect: (ctx: {
|
|
299
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
300
|
-
}, opts: {
|
|
234
|
+
inspect: (ctx: ComponentReadCtx, opts: {
|
|
301
235
|
userId: string;
|
|
302
236
|
groupId: string;
|
|
303
237
|
ancestry?: boolean;
|
|
@@ -320,9 +254,7 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
320
254
|
roleIds: string[];
|
|
321
255
|
grants: string[];
|
|
322
256
|
}>;
|
|
323
|
-
require: (ctx: {
|
|
324
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
325
|
-
}, opts: {
|
|
257
|
+
require: (ctx: ComponentReadCtx, opts: {
|
|
326
258
|
userId: string;
|
|
327
259
|
groupId: string;
|
|
328
260
|
ancestry?: boolean;
|
|
@@ -345,10 +277,7 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
345
277
|
}>;
|
|
346
278
|
};
|
|
347
279
|
invite: {
|
|
348
|
-
create: (ctx: {
|
|
349
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
350
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
351
|
-
}, data: {
|
|
280
|
+
create: (ctx: ComponentCtx, data: {
|
|
352
281
|
groupId?: string;
|
|
353
282
|
invitedByUserId?: string;
|
|
354
283
|
email?: string;
|
|
@@ -359,24 +288,15 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
359
288
|
inviteId: string;
|
|
360
289
|
token: string;
|
|
361
290
|
}>;
|
|
362
|
-
get: (ctx:
|
|
363
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
364
|
-
}, inviteId: string) => Promise<any>;
|
|
291
|
+
get: (ctx: ComponentReadCtx, inviteId: string) => Promise<any>;
|
|
365
292
|
token: {
|
|
366
|
-
get: (ctx:
|
|
367
|
-
|
|
368
|
-
}, token: string) => Promise<any>;
|
|
369
|
-
accept: (ctx: {
|
|
370
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
371
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
372
|
-
}, args: {
|
|
293
|
+
get: (ctx: ComponentReadCtx, token: string) => Promise<any>;
|
|
294
|
+
accept: (ctx: ComponentCtx, args: {
|
|
373
295
|
token: string;
|
|
374
296
|
acceptedByUserId: string;
|
|
375
297
|
}) => Promise<any>;
|
|
376
298
|
};
|
|
377
|
-
list: (ctx: {
|
|
378
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
379
|
-
}, opts?: {
|
|
299
|
+
list: (ctx: ComponentReadCtx, opts?: {
|
|
380
300
|
where?: {
|
|
381
301
|
tokenHash?: string;
|
|
382
302
|
groupId?: string;
|
|
@@ -391,25 +311,16 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
391
311
|
orderBy?: "_creationTime" | "status" | "email" | "expiresTime" | "acceptedTime";
|
|
392
312
|
order?: "asc" | "desc";
|
|
393
313
|
}) => Promise<any>;
|
|
394
|
-
accept: (ctx: {
|
|
395
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
396
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
397
|
-
}, inviteId: string, acceptedByUserId?: string) => Promise<{
|
|
314
|
+
accept: (ctx: ComponentCtx, inviteId: string, acceptedByUserId?: string) => Promise<{
|
|
398
315
|
inviteId: string;
|
|
399
316
|
acceptedByUserId: string | null;
|
|
400
317
|
}>;
|
|
401
|
-
revoke: (ctx: {
|
|
402
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
403
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
404
|
-
}, inviteId: string) => Promise<{
|
|
318
|
+
revoke: (ctx: ComponentCtx, inviteId: string) => Promise<{
|
|
405
319
|
inviteId: string;
|
|
406
320
|
}>;
|
|
407
321
|
};
|
|
408
322
|
key: {
|
|
409
|
-
create: (ctx: {
|
|
410
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
411
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
412
|
-
}, opts: {
|
|
323
|
+
create: (ctx: ComponentCtx, opts: {
|
|
413
324
|
userId: string;
|
|
414
325
|
name: string;
|
|
415
326
|
scopes: KeyScope[];
|
|
@@ -423,17 +334,12 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
423
334
|
keyId: string;
|
|
424
335
|
secret: string;
|
|
425
336
|
}>;
|
|
426
|
-
verify: (ctx: {
|
|
427
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
428
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
429
|
-
}, rawKey: string) => Promise<{
|
|
337
|
+
verify: (ctx: ComponentCtx, rawKey: string) => Promise<{
|
|
430
338
|
userId: string;
|
|
431
339
|
keyId: string;
|
|
432
340
|
scopes: ScopeChecker;
|
|
433
341
|
}>;
|
|
434
|
-
list: (ctx: {
|
|
435
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
436
|
-
}, opts?: {
|
|
342
|
+
list: (ctx: ComponentReadCtx, opts?: {
|
|
437
343
|
where?: {
|
|
438
344
|
userId?: string;
|
|
439
345
|
revoked?: boolean;
|
|
@@ -445,13 +351,8 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
445
351
|
orderBy?: "_creationTime" | "name" | "lastUsedAt" | "expiresAt" | "revoked";
|
|
446
352
|
order?: "asc" | "desc";
|
|
447
353
|
}) => Promise<any>;
|
|
448
|
-
get: (ctx:
|
|
449
|
-
|
|
450
|
-
}, keyId: string) => Promise<KeyDoc | null>;
|
|
451
|
-
update: (ctx: {
|
|
452
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
453
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
454
|
-
}, keyId: string, data: {
|
|
354
|
+
get: (ctx: ComponentReadCtx, keyId: string) => Promise<KeyDoc | null>;
|
|
355
|
+
update: (ctx: ComponentCtx, keyId: string, data: {
|
|
455
356
|
name?: string;
|
|
456
357
|
scopes?: KeyScope[];
|
|
457
358
|
rateLimit?: {
|
|
@@ -461,22 +362,13 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
461
362
|
}) => Promise<{
|
|
462
363
|
keyId: string;
|
|
463
364
|
}>;
|
|
464
|
-
revoke: (ctx: {
|
|
465
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
466
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
467
|
-
}, keyId: string) => Promise<{
|
|
365
|
+
revoke: (ctx: ComponentCtx, keyId: string) => Promise<{
|
|
468
366
|
keyId: string;
|
|
469
367
|
}>;
|
|
470
|
-
delete: (ctx: {
|
|
471
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
472
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
473
|
-
}, keyId: string) => Promise<{
|
|
368
|
+
delete: (ctx: ComponentCtx, keyId: string) => Promise<{
|
|
474
369
|
keyId: string;
|
|
475
370
|
}>;
|
|
476
|
-
rotate: (ctx: {
|
|
477
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
478
|
-
runMutation: <Mutation extends convex_server100.FunctionReference<"mutation", "public" | "internal">>(mutation: Mutation, ...args: convex_server100.OptionalRestArgs<Mutation>) => Promise<convex_server100.FunctionReturnType<Mutation>>;
|
|
479
|
-
}, keyId: string, opts?: {
|
|
371
|
+
rotate: (ctx: ComponentCtx, keyId: string, opts?: {
|
|
480
372
|
name?: string;
|
|
481
373
|
expiresAt?: number;
|
|
482
374
|
}) => Promise<{
|
|
@@ -541,32 +433,24 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
541
433
|
context: {
|
|
542
434
|
<TResolve extends Record<string, unknown> = Record<string, never>, TCtx extends {
|
|
543
435
|
auth: {
|
|
544
|
-
getUserIdentity: () => Promise<
|
|
436
|
+
getUserIdentity: () => Promise<convex_server106.UserIdentity | null>;
|
|
545
437
|
};
|
|
546
|
-
} & {
|
|
547
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
548
|
-
} = {
|
|
438
|
+
} & ComponentReadCtx = {
|
|
549
439
|
auth: {
|
|
550
|
-
getUserIdentity: () => Promise<
|
|
440
|
+
getUserIdentity: () => Promise<convex_server106.UserIdentity | null>;
|
|
551
441
|
};
|
|
552
|
-
} & {
|
|
553
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
554
|
-
}>(ctx: TCtx, request: Request, config: HttpAuthContextConfig<TResolve, TCtx> & {
|
|
442
|
+
} & ComponentReadCtx>(ctx: TCtx, request: Request, config: HttpAuthContextConfig<TResolve, TCtx> & {
|
|
555
443
|
optional: true;
|
|
556
444
|
}): Promise<OptionalHttpAuthContext & TResolve>;
|
|
557
445
|
<TResolve extends Record<string, unknown> = Record<string, never>, TCtx extends {
|
|
558
446
|
auth: {
|
|
559
|
-
getUserIdentity: () => Promise<
|
|
447
|
+
getUserIdentity: () => Promise<convex_server106.UserIdentity | null>;
|
|
560
448
|
};
|
|
561
|
-
} & {
|
|
562
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
563
|
-
} = {
|
|
449
|
+
} & ComponentReadCtx = {
|
|
564
450
|
auth: {
|
|
565
|
-
getUserIdentity: () => Promise<
|
|
451
|
+
getUserIdentity: () => Promise<convex_server106.UserIdentity | null>;
|
|
566
452
|
};
|
|
567
|
-
} &
|
|
568
|
-
runQuery: <Query extends convex_server100.FunctionReference<"query", "public" | "internal">>(query: Query, ...args: convex_server100.OptionalRestArgs<Query>) => Promise<convex_server100.FunctionReturnType<Query>>;
|
|
569
|
-
}>(ctx: TCtx, request: Request, config?: HttpAuthContextConfig<TResolve, TCtx>): Promise<HttpAuthContext & TResolve>;
|
|
453
|
+
} & ComponentReadCtx>(ctx: TCtx, request: Request, config?: HttpAuthContextConfig<TResolve, TCtx>): Promise<HttpAuthContext & TResolve>;
|
|
570
454
|
};
|
|
571
455
|
/**
|
|
572
456
|
* Wrap an HTTP action handler with Bearer token authentication.
|
|
@@ -598,7 +482,7 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
598
482
|
action: string;
|
|
599
483
|
};
|
|
600
484
|
cors?: CorsConfig;
|
|
601
|
-
}) =>
|
|
485
|
+
}) => convex_server106.PublicHttpAction;
|
|
602
486
|
/**
|
|
603
487
|
* Register a Bearer-authenticated route **and** its OPTIONS preflight
|
|
604
488
|
* in a single call.
|
|
@@ -644,22 +528,22 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
644
528
|
*
|
|
645
529
|
* Also used for refreshing the session.
|
|
646
530
|
*/
|
|
647
|
-
signIn:
|
|
531
|
+
signIn: convex_server106.RegisteredAction<"public", {
|
|
648
532
|
provider?: string | undefined;
|
|
649
|
-
params?: Record<string, string | number | boolean | (string | number | boolean | null)[] | Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | null> | undefined;
|
|
650
533
|
verifier?: string | undefined;
|
|
534
|
+
params?: Record<string, string | number | boolean | (string | number | boolean | null)[] | Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | null> | undefined;
|
|
651
535
|
refreshToken?: string | undefined;
|
|
652
536
|
calledBy?: string | undefined;
|
|
653
537
|
}, Promise<SignInActionResult>>;
|
|
654
538
|
/**
|
|
655
539
|
* Action called by the client to invalidate the current session.
|
|
656
540
|
*/
|
|
657
|
-
signOut:
|
|
541
|
+
signOut: convex_server106.RegisteredAction<"public", {}, Promise<void>>;
|
|
658
542
|
/**
|
|
659
543
|
* Internal mutation used by the library to read and write
|
|
660
544
|
* to the database during signin and signout.
|
|
661
545
|
*/
|
|
662
|
-
store:
|
|
546
|
+
store: convex_server106.RegisteredMutation<"internal", {
|
|
663
547
|
args: {
|
|
664
548
|
sessionId?: string | undefined;
|
|
665
549
|
type: "signIn";
|
|
@@ -678,6 +562,7 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
678
562
|
generateTokens: boolean;
|
|
679
563
|
allowExtraProviders: boolean;
|
|
680
564
|
} | {
|
|
565
|
+
signature?: string | undefined;
|
|
681
566
|
type: "verifier";
|
|
682
567
|
} | {
|
|
683
568
|
type: "verifierSignature";
|
|
@@ -685,36 +570,36 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
685
570
|
signature: string;
|
|
686
571
|
} | {
|
|
687
572
|
accountExtend?: {
|
|
688
|
-
saml?: {
|
|
689
|
-
attributes?: Record<string, string | string[]> | undefined;
|
|
690
|
-
sessionIndex?: string | undefined;
|
|
691
|
-
} | undefined;
|
|
692
573
|
identity?: {
|
|
693
574
|
type?: string | undefined;
|
|
694
|
-
protocol?: string | undefined;
|
|
695
575
|
provider?: string | undefined;
|
|
696
576
|
providerAccountId?: string | undefined;
|
|
577
|
+
protocol?: string | undefined;
|
|
697
578
|
connectionId?: string | undefined;
|
|
698
579
|
subject?: string | undefined;
|
|
699
580
|
issuer?: string | undefined;
|
|
700
581
|
discoveryUrl?: string | undefined;
|
|
701
582
|
entityId?: string | undefined;
|
|
702
583
|
} | undefined;
|
|
584
|
+
saml?: {
|
|
585
|
+
attributes?: Record<string, string | string[]> | undefined;
|
|
586
|
+
sessionIndex?: string | undefined;
|
|
587
|
+
} | undefined;
|
|
703
588
|
} | undefined;
|
|
704
589
|
profile: Record<string, string | number | boolean | (string | number | boolean | null)[] | Record<string, string | number | boolean | (string | number | boolean | null)[] | null> | null>;
|
|
705
590
|
type: "userOAuth";
|
|
706
591
|
provider: string;
|
|
707
|
-
signature: string;
|
|
708
592
|
providerAccountId: string;
|
|
593
|
+
signature: string;
|
|
709
594
|
} | {
|
|
710
595
|
email?: string | undefined;
|
|
711
596
|
phone?: string | undefined;
|
|
712
597
|
accountId?: string | undefined;
|
|
713
|
-
code: string;
|
|
714
598
|
type: "createVerificationCode";
|
|
599
|
+
expirationTime: number;
|
|
715
600
|
provider: string;
|
|
601
|
+
code: string;
|
|
716
602
|
allowExtraProviders: boolean;
|
|
717
|
-
expirationTime: number;
|
|
718
603
|
} | {
|
|
719
604
|
shouldLinkViaEmail?: boolean | undefined;
|
|
720
605
|
shouldLinkViaPhone?: boolean | undefined;
|
|
@@ -744,16 +629,7 @@ declare function Auth(config_: ConvexAuthConfig): {
|
|
|
744
629
|
type: "invalidateSessions";
|
|
745
630
|
userId: string;
|
|
746
631
|
};
|
|
747
|
-
}, Promise<
|
|
748
|
-
token: string;
|
|
749
|
-
refreshToken: string;
|
|
750
|
-
} | {
|
|
751
|
-
userId: convex_values1045.GenericId<"User">;
|
|
752
|
-
sessionId: convex_values1045.GenericId<"Session">;
|
|
753
|
-
} | {
|
|
754
|
-
account: Doc<"Account">;
|
|
755
|
-
user: Doc<"User">;
|
|
756
|
-
} | null>>;
|
|
632
|
+
}, Promise<unknown>>;
|
|
757
633
|
};
|
|
758
634
|
//#endregion
|
|
759
635
|
export { Auth };
|