@lupinum/better-convex-nuxt 1.0.0-beta.2 → 1.0.0-beta.3
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/module.json +1 -1
- package/dist/runtime/auth/better-auth-browser-adapter.d.ts +1 -0
- package/dist/runtime/auth/better-auth-browser-adapter.js +18 -3
- package/dist/runtime/auth/integrated-client.d.ts +1 -1
- package/dist/runtime/auth/token-fetcher.d.ts +5 -1
- package/dist/runtime/auth/token-fetcher.js +3 -0
- package/dist/runtime/cli/auth-schema.js +3 -2
- package/dist/runtime/cli/init.js +2 -1
- package/dist/runtime/convex-auth/adapter/create-adapter.js +36 -8
- package/dist/runtime/convex-auth/adapter/define-functions.d.ts +206 -7
- package/dist/runtime/convex-auth/adapter/define-functions.js +172 -18
- package/dist/runtime/convex-auth/adapter/query.d.ts +8 -3
- package/dist/runtime/convex-auth/adapter/query.js +20 -3
- package/dist/runtime/convex-auth/adapter/relationships.d.ts +2 -0
- package/dist/runtime/convex-auth/adapter/relationships.js +3 -1
- package/dist/runtime/convex-auth/auth-jwt.d.ts +3 -0
- package/dist/runtime/convex-auth/auth-jwt.js +12 -0
- package/dist/runtime/convex-auth/component/_generated/component.d.ts +340 -79
- package/dist/runtime/convex-auth/component/_generated/server.js +3 -3
- package/dist/runtime/convex-auth/component/adapter.d.ts +199 -8
- package/dist/runtime/convex-auth/component/adapter.js +7 -0
- package/dist/runtime/convex-auth/create-auth-component.d.ts +24 -2
- package/dist/runtime/convex-auth/create-auth-component.js +33 -15
- package/dist/runtime/convex-auth/create-better-convex-auth.d.ts +14 -5
- package/dist/runtime/convex-auth/create-better-convex-auth.js +99 -35
- package/dist/runtime/convex-auth/index.d.ts +3 -1
- package/dist/runtime/convex-auth/index.js +2 -0
- package/dist/runtime/convex-auth/oauth-live-access.js +6 -10
- package/dist/runtime/convex-auth/plugin.js +30 -1
- package/dist/runtime/convex-auth/test.d.ts +20 -407
- package/dist/runtime/convex-auth/test.js +31 -1
- package/dist/runtime/convex-auth/workforce/adapter-policy.d.ts +29 -0
- package/dist/runtime/convex-auth/workforce/adapter-policy.js +98 -0
- package/dist/runtime/convex-auth/workforce/adapter-transport.d.ts +40 -0
- package/dist/runtime/convex-auth/workforce/adapter-transport.js +31 -0
- package/dist/runtime/convex-auth/workforce/admission.d.ts +13 -0
- package/dist/runtime/convex-auth/workforce/admission.js +16 -0
- package/dist/runtime/convex-auth/workforce/credential-generation.d.ts +9 -0
- package/dist/runtime/convex-auth/workforce/credential-generation.js +41 -0
- package/dist/runtime/convex-auth/workforce/factor-fingerprint.d.ts +2 -0
- package/dist/runtime/convex-auth/workforce/factor-fingerprint.js +4 -0
- package/dist/runtime/convex-auth/workforce/factor-transitions.d.ts +36 -0
- package/dist/runtime/convex-auth/workforce/factor-transitions.js +180 -0
- package/dist/runtime/convex-auth/workforce/operations.d.ts +150 -0
- package/dist/runtime/convex-auth/workforce/operations.js +45 -0
- package/dist/runtime/convex-auth/workforce/otp-binding.d.ts +8 -0
- package/dist/runtime/convex-auth/workforce/otp-binding.js +48 -0
- package/dist/runtime/convex-auth/workforce/pending-factor-view.d.ts +4 -0
- package/dist/runtime/convex-auth/workforce/pending-factor-view.js +12 -0
- package/dist/runtime/convex-auth/workforce/profile.d.ts +9 -0
- package/dist/runtime/convex-auth/workforce/profile.js +24 -0
- package/dist/runtime/convex-auth/workforce/provider-hooks.d.ts +6 -0
- package/dist/runtime/convex-auth/workforce/provider-hooks.js +191 -0
- package/dist/runtime/convex-auth/workforce/replay.d.ts +32 -0
- package/dist/runtime/convex-auth/workforce/replay.js +75 -0
- package/dist/runtime/convex-auth/workforce/request-context.d.ts +29 -0
- package/dist/runtime/convex-auth/workforce/request-context.js +88 -0
- package/dist/runtime/convex-auth/workforce/schema.d.ts +93 -0
- package/dist/runtime/convex-auth/workforce/schema.js +102 -0
- package/dist/runtime/convex-auth/workforce/session-assurance.d.ts +29 -0
- package/dist/runtime/convex-auth/workforce/session-assurance.js +43 -0
- package/dist/runtime/convex-auth/workforce/session-management.d.ts +91 -0
- package/dist/runtime/convex-auth/workforce/session-management.js +132 -0
- package/dist/runtime/convex-auth/workforce/session-transitions.d.ts +11 -0
- package/dist/runtime/convex-auth/workforce/session-transitions.js +106 -0
- package/dist/runtime/plugin.auth.client.js +11 -1
- package/dist/runtime/shared/release-fingerprint.js +1 -1
- package/package.json +12 -7
- package/security/upstream-convex-better-auth.json +234 -36
- package/dist/runtime/convex-auth/component/schema.d.ts +0 -805
package/dist/module.json
CHANGED
|
@@ -27,6 +27,7 @@ export declare function createBetterAuthBrowserAdapter(source: BetterAuthBrowser
|
|
|
27
27
|
}, options?: {
|
|
28
28
|
initialIdentityKey?: string;
|
|
29
29
|
}): BetterConvexAuthAdapter & {
|
|
30
|
+
isRestrictedSession(): boolean;
|
|
30
31
|
failClosed(message: string): void;
|
|
31
32
|
dispose(): void;
|
|
32
33
|
};
|
|
@@ -18,6 +18,7 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
18
18
|
let observedSessionToken;
|
|
19
19
|
let observedIdentityKey = options.initialIdentityKey;
|
|
20
20
|
let cachedToken = null;
|
|
21
|
+
let restrictedGeneration;
|
|
21
22
|
let snapshot = options.initialIdentityKey ? {
|
|
22
23
|
status: "authenticated",
|
|
23
24
|
identityKey: options.initialIdentityKey,
|
|
@@ -60,6 +61,7 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
60
61
|
const retainsEstablishedSession = Boolean(value.error) && !isUnauthorized(value.error) && snapshot.status === "authenticated" && observedSessionToken === sessionToken && observedIdentityKey === key;
|
|
61
62
|
if (retainsEstablishedSession) return;
|
|
62
63
|
if (value.error || malformed) {
|
|
64
|
+
restrictedGeneration = void 0;
|
|
63
65
|
cachedToken = null;
|
|
64
66
|
sessionGeneration += 1;
|
|
65
67
|
observedSessionToken = null;
|
|
@@ -80,10 +82,11 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
80
82
|
if (changed) {
|
|
81
83
|
sessionGeneration += 1;
|
|
82
84
|
cachedToken = null;
|
|
85
|
+
restrictedGeneration = void 0;
|
|
83
86
|
}
|
|
84
87
|
observedSessionToken = sessionToken;
|
|
85
88
|
observedIdentityKey = key;
|
|
86
|
-
snapshot = sessionToken && key ? {
|
|
89
|
+
snapshot = sessionToken && key && restrictedGeneration !== sessionGeneration ? {
|
|
87
90
|
status: "authenticated",
|
|
88
91
|
identityKey: key,
|
|
89
92
|
sessionGeneration,
|
|
@@ -94,7 +97,7 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
94
97
|
sessionGeneration,
|
|
95
98
|
error: null
|
|
96
99
|
};
|
|
97
|
-
if (
|
|
100
|
+
if (snapshot.status === "anonymous") callbacks.anonymous(null);
|
|
98
101
|
callbacks.sessionChanged?.(sessionToken, null, sessionGeneration);
|
|
99
102
|
notify();
|
|
100
103
|
};
|
|
@@ -145,6 +148,7 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
145
148
|
};
|
|
146
149
|
return Object.freeze({
|
|
147
150
|
snapshot: () => snapshot,
|
|
151
|
+
isRestrictedSession: () => !disposed && restrictedGeneration === sessionGeneration && snapshot.status === "anonymous",
|
|
148
152
|
subscribe(listener) {
|
|
149
153
|
if (disposed) return () => {
|
|
150
154
|
};
|
|
@@ -154,8 +158,17 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
154
158
|
async fetchToken() {
|
|
155
159
|
if (disposed || snapshot.status !== "authenticated") return null;
|
|
156
160
|
const expectedKey = snapshot.identityKey;
|
|
161
|
+
const expectedGeneration = sessionGeneration;
|
|
157
162
|
const outcome = await fetchConvexToken(source);
|
|
158
|
-
if (disposed || snapshot.status !== "authenticated" || snapshot.identityKey !== expectedKey) {
|
|
163
|
+
if (disposed || snapshot.status !== "authenticated" || snapshot.identityKey !== expectedKey || sessionGeneration !== expectedGeneration) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
if (outcome.restricted) {
|
|
167
|
+
cachedToken = null;
|
|
168
|
+
restrictedGeneration = expectedGeneration;
|
|
169
|
+
snapshot = { status: "anonymous", identityKey: null, sessionGeneration, error: null };
|
|
170
|
+
callbacks.anonymous(null);
|
|
171
|
+
notify();
|
|
159
172
|
return null;
|
|
160
173
|
}
|
|
161
174
|
if (outcome.identity) {
|
|
@@ -187,6 +200,7 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
187
200
|
},
|
|
188
201
|
failClosed(message) {
|
|
189
202
|
if (disposed) return;
|
|
203
|
+
restrictedGeneration = void 0;
|
|
190
204
|
cachedToken = null;
|
|
191
205
|
sessionGeneration += 1;
|
|
192
206
|
snapshot = {
|
|
@@ -204,6 +218,7 @@ export function createBetterAuthBrowserAdapter(source, callbacks = { authenticat
|
|
|
204
218
|
dispose() {
|
|
205
219
|
if (disposed) return;
|
|
206
220
|
disposed = true;
|
|
221
|
+
restrictedGeneration = void 0;
|
|
207
222
|
stop();
|
|
208
223
|
for (const cancel of [...cancelSessionSettlement]) cancel();
|
|
209
224
|
cancelSessionSettlement.clear();
|
|
@@ -10,7 +10,7 @@ export interface CanonicalSessionReconciler {
|
|
|
10
10
|
* without changing its synchronous contract.
|
|
11
11
|
*/
|
|
12
12
|
cancel(checkpoint: SessionCheckpoint): void;
|
|
13
|
-
/** Re-read the
|
|
13
|
+
/** Re-read the provider session, then await matching Convex settlement (possibly anonymous). */
|
|
14
14
|
reconcile(checkpoint: SessionCheckpoint): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -39,7 +39,9 @@ export declare function decodeFetchedIdentity(token: string): FetchedIdentity |
|
|
|
39
39
|
* The outcome of one total token fetch. `identity: null` with `authError: null`
|
|
40
40
|
* is a clean anonymous result when the exchange succeeds with no token. A
|
|
41
41
|
* definitive 401/403 means presented credentials were rejected and is reported
|
|
42
|
-
* as an authentication error
|
|
42
|
+
* as an authentication error, except the exact live workforce continuation
|
|
43
|
+
* refusal. That result is restricted and grants no Convex identity.
|
|
44
|
+
* `authError` is also set when a token decodes
|
|
43
45
|
* without a stable user id, or a transient transport failure exhausts the retry
|
|
44
46
|
* loop. `definitive`
|
|
45
47
|
* distinguishes such a transient (non-definitive) failure — over which a usable
|
|
@@ -49,6 +51,8 @@ export interface FetchOutcome {
|
|
|
49
51
|
identity: FetchedIdentity | null;
|
|
50
52
|
authError: string | null;
|
|
51
53
|
definitive: boolean;
|
|
54
|
+
/** A live workforce cookie may continue setup, but cannot authenticate Convex. */
|
|
55
|
+
restricted?: true;
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
54
58
|
* Total Convex-token fetch; never throws.
|
|
@@ -75,6 +75,9 @@ export async function fetchConvexToken(source, options = {}) {
|
|
|
75
75
|
break;
|
|
76
76
|
}
|
|
77
77
|
if (response.error) {
|
|
78
|
+
if (typeof response.error === "object" && "status" in response.error && response.error.status === 403 && "code" in response.error && response.error.code === "AUTH_WORKFORCE_FULL_AUTH_REQUIRED") {
|
|
79
|
+
return { identity: null, authError: null, definitive: true, restricted: true };
|
|
80
|
+
}
|
|
78
81
|
if (isDefinitiveAuthStatus(response.error)) {
|
|
79
82
|
return {
|
|
80
83
|
identity: null,
|
|
@@ -21,7 +21,8 @@ const SUPPORTED_SCHEMA_PLUGIN_IDS = /* @__PURE__ */ new Set([
|
|
|
21
21
|
"two-factor",
|
|
22
22
|
"email-otp",
|
|
23
23
|
"jwt",
|
|
24
|
-
"oauth-provider"
|
|
24
|
+
"oauth-provider",
|
|
25
|
+
"bcn-workforce-schema"
|
|
25
26
|
]);
|
|
26
27
|
function usage() {
|
|
27
28
|
return [
|
|
@@ -88,7 +89,7 @@ function requireSchemaOptions(value) {
|
|
|
88
89
|
const id = isRecord(plugin) && typeof plugin.id === "string" ? plugin.id : void 0;
|
|
89
90
|
if (!id || !SUPPORTED_SCHEMA_PLUGIN_IDS.has(id) || seen.has(id)) {
|
|
90
91
|
throw new Error(
|
|
91
|
-
`Schema config plugin at index ${index} is unsupported; the 1.0 profile admits organization, two-factor, email-otp, jwt,
|
|
92
|
+
`Schema config plugin at index ${index} is unsupported; the 1.0 profile admits organization, two-factor, email-otp, jwt, oauth-provider, and bcn-workforce-schema once each.`
|
|
92
93
|
);
|
|
93
94
|
}
|
|
94
95
|
seen.add(id);
|
package/dist/runtime/cli/init.js
CHANGED
|
@@ -41,7 +41,8 @@ export default app
|
|
|
41
41
|
import schema from './schema'
|
|
42
42
|
import schemaMetadata from './schemaMetadata'
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
// This module is inside the isolated betterAuth component, not the public app API.
|
|
45
|
+
export const { assertProfile, consumeOne, count, create, deleteMany, deleteOne, findMany, findOne, incrementOne, rotateSigningKey, sessionAdmission, expireWorkforceSession, listWorkforceSessions, revokeAllWorkforceSessions, revokeWorkforceSession, touchWorkforceSession, updateMany, updateOne } = defineAuthAdapterFunctions({ metadata: schemaMetadata, schema })
|
|
45
46
|
`,
|
|
46
47
|
"convex/betterAuth/convex.config.ts": `import { defineComponent } from 'convex/server'
|
|
47
48
|
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAdapterFactory
|
|
3
3
|
} from "better-auth/adapters";
|
|
4
|
+
import { APIError } from "better-auth/api";
|
|
4
5
|
import { symmetricDecrypt, symmetricEncrypt } from "better-auth/crypto";
|
|
5
6
|
import { createFunctionHandle } from "convex/server";
|
|
7
|
+
import { ConvexError } from "convex/values";
|
|
6
8
|
import { isWritableAuthCtx, requireWritableAuthCtx } from "../context.js";
|
|
7
|
-
import {
|
|
9
|
+
import { createWorkforceAdapterTransport } from "../workforce/adapter-transport.js";
|
|
10
|
+
import { hasWorkforceSchema, workforceSchemaPlugin } from "../workforce/schema.js";
|
|
11
|
+
import { createAuthSchema, generateAuthSchemaArtifacts } from "./generate-schema.js";
|
|
12
|
+
function rejectReplay(error) {
|
|
13
|
+
if (error instanceof ConvexError && error.data === "AUTH_WORKFORCE_TOTP_REPLAYED") {
|
|
14
|
+
throw new APIError("FORBIDDEN", {
|
|
15
|
+
code: "INVALID_TWO_FACTOR_CODE",
|
|
16
|
+
message: "This code cannot be used. Wait for a new code and try again."
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
8
21
|
function toComponentWhere(where) {
|
|
9
22
|
return where?.map((condition) => ({
|
|
10
23
|
...condition,
|
|
@@ -144,9 +157,14 @@ export function createConvexAuthAdapter(ctx, component, adapterOptions = {}) {
|
|
|
144
157
|
customTransformInput: ({ data, fieldAttributes }) => fieldAttributes.type === "date" ? toEpochMilliseconds(data) : data,
|
|
145
158
|
customTransformOutput: ({ data, fieldAttributes }) => fieldAttributes.type === "date" ? toDate(data) : data
|
|
146
159
|
},
|
|
147
|
-
adapter: ({ getFieldName, getModelName, options }) => {
|
|
160
|
+
adapter: ({ getFieldName, getModelName, options, schema }) => {
|
|
148
161
|
options.telemetry = { enabled: false };
|
|
149
162
|
if (options.advanced?.database?.joins) throw new Error("AUTH_JOINS_UNSUPPORTED");
|
|
163
|
+
const workforce = options.plugins?.some((plugin) => plugin.id === workforceSchemaPlugin.id) === true;
|
|
164
|
+
if (workforce && !hasWorkforceSchema(generateAuthSchemaArtifacts(schema).metadata)) {
|
|
165
|
+
throw new Error("AUTH_WORKFORCE_SCHEMA_MISMATCH");
|
|
166
|
+
}
|
|
167
|
+
const workforceTransport = createWorkforceAdapterTransport(workforce);
|
|
150
168
|
const idTokens = createAccountIdTokenProtector(options);
|
|
151
169
|
const triggerModels = {
|
|
152
170
|
onCreate: configuredTriggerModels(adapterOptions.triggers, "onCreate").map(getModelName),
|
|
@@ -181,11 +199,14 @@ export function createConvexAuthAdapter(ctx, component, adapterOptions = {}) {
|
|
|
181
199
|
data
|
|
182
200
|
}) => {
|
|
183
201
|
requireWritableAuthCtx(ctx);
|
|
202
|
+
const { operation, consumedChallenge } = await workforceTransport.create(model, data);
|
|
184
203
|
const created = await ctx.runMutation(component.adapter.create, {
|
|
185
204
|
model,
|
|
186
205
|
data: await idTokens.protect(model, data),
|
|
187
|
-
onCreateHandle: await triggerHandle(model, "onCreate")
|
|
188
|
-
|
|
206
|
+
onCreateHandle: await triggerHandle(model, "onCreate"),
|
|
207
|
+
...operation ? { workforce: operation } : {},
|
|
208
|
+
...consumedChallenge ? { workforceConsumedChallenge: consumedChallenge } : {}
|
|
209
|
+
}).catch(rejectReplay);
|
|
189
210
|
return idTokens.reveal(model, created);
|
|
190
211
|
},
|
|
191
212
|
findOne: async ({
|
|
@@ -193,10 +214,12 @@ export function createConvexAuthAdapter(ctx, component, adapterOptions = {}) {
|
|
|
193
214
|
where,
|
|
194
215
|
select
|
|
195
216
|
}) => {
|
|
217
|
+
const operation = await workforceTransport.operation(model);
|
|
196
218
|
const found = await ctx.runQuery(component.adapter.findOne, {
|
|
197
219
|
model,
|
|
198
220
|
where: toComponentWhere(where),
|
|
199
|
-
select: mapSelect(model, select)
|
|
221
|
+
select: mapSelect(model, select),
|
|
222
|
+
...operation?.operation === "confirm-enrollment" ? { workforce: operation } : {}
|
|
200
223
|
});
|
|
201
224
|
return idTokens.reveal(model, found);
|
|
202
225
|
},
|
|
@@ -231,12 +254,14 @@ export function createConvexAuthAdapter(ctx, component, adapterOptions = {}) {
|
|
|
231
254
|
}) => {
|
|
232
255
|
requireWritableAuthCtx(ctx);
|
|
233
256
|
if (where.length === 0) return null;
|
|
257
|
+
const operation = await workforceTransport.operation();
|
|
234
258
|
const updated = await ctx.runMutation(component.adapter.updateOne, {
|
|
235
259
|
model,
|
|
236
260
|
where: toComponentWhere(where),
|
|
237
261
|
update: await idTokens.protect(model, update),
|
|
238
|
-
onUpdateHandle: await triggerHandle(model, "onUpdate")
|
|
239
|
-
|
|
262
|
+
onUpdateHandle: await triggerHandle(model, "onUpdate"),
|
|
263
|
+
...operation ? { workforce: operation } : {}
|
|
264
|
+
}).catch(rejectReplay);
|
|
240
265
|
return idTokens.reveal(model, updated);
|
|
241
266
|
},
|
|
242
267
|
updateMany: async ({ model, where, update }) => {
|
|
@@ -283,6 +308,7 @@ export function createConvexAuthAdapter(ctx, component, adapterOptions = {}) {
|
|
|
283
308
|
onUpdateHandle: await relationshipTriggerHandle("onUpdate"),
|
|
284
309
|
onUpdateModels: triggerModels.onUpdate
|
|
285
310
|
});
|
|
311
|
+
await workforceTransport.consumed(model, consumed);
|
|
286
312
|
return idTokens.reveal(model, consumed);
|
|
287
313
|
},
|
|
288
314
|
incrementOne: async ({
|
|
@@ -292,12 +318,14 @@ export function createConvexAuthAdapter(ctx, component, adapterOptions = {}) {
|
|
|
292
318
|
set
|
|
293
319
|
}) => {
|
|
294
320
|
requireWritableAuthCtx(ctx);
|
|
321
|
+
const operation = await workforceTransport.operation();
|
|
295
322
|
const incremented = await ctx.runMutation(component.adapter.incrementOne, {
|
|
296
323
|
model,
|
|
297
324
|
where: toComponentWhere(where),
|
|
298
325
|
increment,
|
|
299
326
|
set: await idTokens.protect(model, set),
|
|
300
|
-
onUpdateHandle: await triggerHandle(model, "onUpdate")
|
|
327
|
+
onUpdateHandle: await triggerHandle(model, "onUpdate"),
|
|
328
|
+
...operation ? { workforce: operation } : {}
|
|
301
329
|
});
|
|
302
330
|
return idTokens.reveal(model, incremented);
|
|
303
331
|
}
|
|
@@ -1,18 +1,149 @@
|
|
|
1
1
|
import { type SchemaDefinition } from 'convex/server';
|
|
2
|
+
import { type GenericId } from 'convex/values';
|
|
2
3
|
import type { AuthSchemaMetadata } from './metadata.js';
|
|
3
4
|
export interface DefineAuthAdapterFunctionsOptions<Schema extends SchemaDefinition<any, any>> {
|
|
4
5
|
schema: Schema;
|
|
5
6
|
metadata: AuthSchemaMetadata;
|
|
6
7
|
}
|
|
7
8
|
export declare function defineAuthAdapterFunctions<Schema extends SchemaDefinition<any, any>>({ schema, metadata, }: DefineAuthAdapterFunctionsOptions<Schema>): {
|
|
9
|
+
touchWorkforceSession: import("convex/server").RegisteredMutation<"public", {
|
|
10
|
+
actor: {
|
|
11
|
+
userId: string;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
};
|
|
14
|
+
}, Promise<{
|
|
15
|
+
expiresAt: number;
|
|
16
|
+
}>>;
|
|
17
|
+
listWorkforceSessions: import("convex/server").RegisteredQuery<"public", {
|
|
18
|
+
paginationOpts: {
|
|
19
|
+
cursor: string | null;
|
|
20
|
+
numItems: number;
|
|
21
|
+
};
|
|
22
|
+
actor: {
|
|
23
|
+
userId: string;
|
|
24
|
+
sessionId: string;
|
|
25
|
+
};
|
|
26
|
+
}, Promise<{
|
|
27
|
+
page: {
|
|
28
|
+
method: "password-only" | "totp-enrollment" | "password-totp" | "password-recovery";
|
|
29
|
+
expiresAt: number;
|
|
30
|
+
sessionId: string;
|
|
31
|
+
authenticatedAt: number;
|
|
32
|
+
sessionStartedAt: number;
|
|
33
|
+
isCurrent: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
isDone: boolean;
|
|
36
|
+
continueCursor: string;
|
|
37
|
+
}>>;
|
|
38
|
+
revokeWorkforceSession: import("convex/server").RegisteredMutation<"public", {
|
|
39
|
+
actor: {
|
|
40
|
+
userId: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
};
|
|
43
|
+
sessionId: string;
|
|
44
|
+
}, Promise<null>>;
|
|
45
|
+
revokeAllWorkforceSessions: import("convex/server").RegisteredMutation<"public", {
|
|
46
|
+
actor: {
|
|
47
|
+
userId: string;
|
|
48
|
+
sessionId: string;
|
|
49
|
+
};
|
|
50
|
+
}, Promise<null>>;
|
|
51
|
+
expireWorkforceSession: import("convex/server").RegisteredMutation<"internal", {
|
|
52
|
+
storageId: GenericId<"session">;
|
|
53
|
+
}, Promise<null>>;
|
|
54
|
+
assertProfile: import("convex/server").RegisteredQuery<"public", {
|
|
55
|
+
workforce: boolean;
|
|
56
|
+
}, null>;
|
|
57
|
+
sessionAdmission: import("convex/server").RegisteredQuery<"public", {
|
|
58
|
+
userId?: string | undefined;
|
|
59
|
+
sessionId: string;
|
|
60
|
+
}, Promise<{
|
|
61
|
+
user: Record<string, string | number | boolean | string[] | number[] | null>;
|
|
62
|
+
session: Record<string, string | number | boolean | string[] | number[] | null>;
|
|
63
|
+
} | null>>;
|
|
8
64
|
create: import("convex/server").RegisteredMutation<"public", {
|
|
65
|
+
workforce?: {
|
|
66
|
+
replay?: {
|
|
67
|
+
userId: string;
|
|
68
|
+
digest: string;
|
|
69
|
+
factorId: string;
|
|
70
|
+
factorFingerprint: string;
|
|
71
|
+
matchingCounters: number[];
|
|
72
|
+
} | undefined;
|
|
73
|
+
userId: string;
|
|
74
|
+
sessionId: string;
|
|
75
|
+
operation: "change-password" | "begin-enrollment" | "confirm-enrollment" | "regenerate-backup-codes";
|
|
76
|
+
expectedGeneration: number;
|
|
77
|
+
} | {
|
|
78
|
+
userId: string;
|
|
79
|
+
operation: "password-sign-in";
|
|
80
|
+
expectedGeneration: number;
|
|
81
|
+
} | {
|
|
82
|
+
userId: string;
|
|
83
|
+
operation: "password-challenge";
|
|
84
|
+
expectedGeneration: number;
|
|
85
|
+
challengeId: string;
|
|
86
|
+
} | {
|
|
87
|
+
replay?: {
|
|
88
|
+
userId: string;
|
|
89
|
+
digest: string;
|
|
90
|
+
factorId: string;
|
|
91
|
+
factorFingerprint: string;
|
|
92
|
+
matchingCounters: number[];
|
|
93
|
+
} | undefined;
|
|
94
|
+
userId: string;
|
|
95
|
+
operation: "totp-sign-in" | "recovery-sign-in";
|
|
96
|
+
expectedGeneration: number;
|
|
97
|
+
challengeId: string;
|
|
98
|
+
} | undefined;
|
|
9
99
|
onCreateHandle?: string | undefined;
|
|
100
|
+
workforceConsumedChallenge?: {
|
|
101
|
+
userId: string;
|
|
102
|
+
expiresAt: number;
|
|
103
|
+
operation: "totp-sign-in" | "recovery-sign-in";
|
|
104
|
+
expectedGeneration: number;
|
|
105
|
+
challengeId: string;
|
|
106
|
+
} | undefined;
|
|
10
107
|
data: any;
|
|
11
108
|
model: string;
|
|
12
|
-
}, Promise<Record<string,
|
|
109
|
+
}, Promise<Record<string, string | number | boolean | string[] | number[] | null>>>;
|
|
13
110
|
findOne: import("convex/server").RegisteredQuery<"public", {
|
|
14
111
|
join?: any;
|
|
15
112
|
select?: string[] | undefined;
|
|
113
|
+
workforce?: {
|
|
114
|
+
replay?: {
|
|
115
|
+
userId: string;
|
|
116
|
+
digest: string;
|
|
117
|
+
factorId: string;
|
|
118
|
+
factorFingerprint: string;
|
|
119
|
+
matchingCounters: number[];
|
|
120
|
+
} | undefined;
|
|
121
|
+
userId: string;
|
|
122
|
+
sessionId: string;
|
|
123
|
+
operation: "change-password" | "begin-enrollment" | "confirm-enrollment" | "regenerate-backup-codes";
|
|
124
|
+
expectedGeneration: number;
|
|
125
|
+
} | {
|
|
126
|
+
userId: string;
|
|
127
|
+
operation: "password-sign-in";
|
|
128
|
+
expectedGeneration: number;
|
|
129
|
+
} | {
|
|
130
|
+
userId: string;
|
|
131
|
+
operation: "password-challenge";
|
|
132
|
+
expectedGeneration: number;
|
|
133
|
+
challengeId: string;
|
|
134
|
+
} | {
|
|
135
|
+
replay?: {
|
|
136
|
+
userId: string;
|
|
137
|
+
digest: string;
|
|
138
|
+
factorId: string;
|
|
139
|
+
factorFingerprint: string;
|
|
140
|
+
matchingCounters: number[];
|
|
141
|
+
} | undefined;
|
|
142
|
+
userId: string;
|
|
143
|
+
operation: "totp-sign-in" | "recovery-sign-in";
|
|
144
|
+
expectedGeneration: number;
|
|
145
|
+
challengeId: string;
|
|
146
|
+
} | undefined;
|
|
16
147
|
where?: {
|
|
17
148
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
18
149
|
operator?: "in" | "lt" | "lte" | "gt" | "gte" | "eq" | "not_in" | "ne" | "contains" | "starts_with" | "ends_with" | undefined;
|
|
@@ -26,7 +157,7 @@ export declare function defineAuthAdapterFunctions<Schema extends SchemaDefiniti
|
|
|
26
157
|
direction: "asc" | "desc";
|
|
27
158
|
} | undefined;
|
|
28
159
|
model: string;
|
|
29
|
-
}, Promise<Record<string,
|
|
160
|
+
}, Promise<Record<string, string | number | boolean | string[] | number[] | null> | null>>;
|
|
30
161
|
findMany: import("convex/server").RegisteredQuery<"public", {
|
|
31
162
|
join?: any;
|
|
32
163
|
select?: string[] | undefined;
|
|
@@ -52,7 +183,7 @@ export declare function defineAuthAdapterFunctions<Schema extends SchemaDefiniti
|
|
|
52
183
|
cursor: string | null;
|
|
53
184
|
};
|
|
54
185
|
model: string;
|
|
55
|
-
}, Promise<
|
|
186
|
+
}, Promise<import("convex/server").PaginationResult<Record<string, string | number | boolean | string[] | number[] | null>>>>;
|
|
56
187
|
count: import("convex/server").RegisteredQuery<"public", {
|
|
57
188
|
where?: {
|
|
58
189
|
mode?: "sensitive" | "insensitive" | undefined;
|
|
@@ -64,6 +195,40 @@ export declare function defineAuthAdapterFunctions<Schema extends SchemaDefiniti
|
|
|
64
195
|
model: string;
|
|
65
196
|
}, Promise<number>>;
|
|
66
197
|
updateOne: import("convex/server").RegisteredMutation<"public", {
|
|
198
|
+
workforce?: {
|
|
199
|
+
replay?: {
|
|
200
|
+
userId: string;
|
|
201
|
+
digest: string;
|
|
202
|
+
factorId: string;
|
|
203
|
+
factorFingerprint: string;
|
|
204
|
+
matchingCounters: number[];
|
|
205
|
+
} | undefined;
|
|
206
|
+
userId: string;
|
|
207
|
+
sessionId: string;
|
|
208
|
+
operation: "change-password" | "begin-enrollment" | "confirm-enrollment" | "regenerate-backup-codes";
|
|
209
|
+
expectedGeneration: number;
|
|
210
|
+
} | {
|
|
211
|
+
userId: string;
|
|
212
|
+
operation: "password-sign-in";
|
|
213
|
+
expectedGeneration: number;
|
|
214
|
+
} | {
|
|
215
|
+
userId: string;
|
|
216
|
+
operation: "password-challenge";
|
|
217
|
+
expectedGeneration: number;
|
|
218
|
+
challengeId: string;
|
|
219
|
+
} | {
|
|
220
|
+
replay?: {
|
|
221
|
+
userId: string;
|
|
222
|
+
digest: string;
|
|
223
|
+
factorId: string;
|
|
224
|
+
factorFingerprint: string;
|
|
225
|
+
matchingCounters: number[];
|
|
226
|
+
} | undefined;
|
|
227
|
+
userId: string;
|
|
228
|
+
operation: "totp-sign-in" | "recovery-sign-in";
|
|
229
|
+
expectedGeneration: number;
|
|
230
|
+
challengeId: string;
|
|
231
|
+
} | undefined;
|
|
67
232
|
onUpdateHandle?: string | undefined;
|
|
68
233
|
update: any;
|
|
69
234
|
model: string;
|
|
@@ -74,7 +239,7 @@ export declare function defineAuthAdapterFunctions<Schema extends SchemaDefiniti
|
|
|
74
239
|
value: string | number | boolean | string[] | number[] | null;
|
|
75
240
|
field: string;
|
|
76
241
|
}[];
|
|
77
|
-
}, Promise<Record<string,
|
|
242
|
+
}, Promise<Record<string, string | number | boolean | string[] | number[] | null> | null>>;
|
|
78
243
|
updateMany: import("convex/server").RegisteredMutation<"public", {
|
|
79
244
|
onUpdateHandle?: string | undefined;
|
|
80
245
|
update: any;
|
|
@@ -100,7 +265,7 @@ export declare function defineAuthAdapterFunctions<Schema extends SchemaDefiniti
|
|
|
100
265
|
value: string | number | boolean | string[] | number[] | null;
|
|
101
266
|
field: string;
|
|
102
267
|
}[];
|
|
103
|
-
}, Promise<Record<string,
|
|
268
|
+
}, Promise<Record<string, string | number | boolean | string[] | number[] | null> | null>>;
|
|
104
269
|
deleteMany: import("convex/server").RegisteredMutation<"public", {
|
|
105
270
|
onDeleteHandle?: string | undefined;
|
|
106
271
|
onDeleteModels?: string[] | undefined;
|
|
@@ -128,9 +293,43 @@ export declare function defineAuthAdapterFunctions<Schema extends SchemaDefiniti
|
|
|
128
293
|
value: string | number | boolean | string[] | number[] | null;
|
|
129
294
|
field: string;
|
|
130
295
|
}[];
|
|
131
|
-
}, Promise<Record<string,
|
|
296
|
+
}, Promise<Record<string, string | number | boolean | string[] | number[] | null> | null>>;
|
|
132
297
|
incrementOne: import("convex/server").RegisteredMutation<"public", {
|
|
133
298
|
set?: any;
|
|
299
|
+
workforce?: {
|
|
300
|
+
replay?: {
|
|
301
|
+
userId: string;
|
|
302
|
+
digest: string;
|
|
303
|
+
factorId: string;
|
|
304
|
+
factorFingerprint: string;
|
|
305
|
+
matchingCounters: number[];
|
|
306
|
+
} | undefined;
|
|
307
|
+
userId: string;
|
|
308
|
+
sessionId: string;
|
|
309
|
+
operation: "change-password" | "begin-enrollment" | "confirm-enrollment" | "regenerate-backup-codes";
|
|
310
|
+
expectedGeneration: number;
|
|
311
|
+
} | {
|
|
312
|
+
userId: string;
|
|
313
|
+
operation: "password-sign-in";
|
|
314
|
+
expectedGeneration: number;
|
|
315
|
+
} | {
|
|
316
|
+
userId: string;
|
|
317
|
+
operation: "password-challenge";
|
|
318
|
+
expectedGeneration: number;
|
|
319
|
+
challengeId: string;
|
|
320
|
+
} | {
|
|
321
|
+
replay?: {
|
|
322
|
+
userId: string;
|
|
323
|
+
digest: string;
|
|
324
|
+
factorId: string;
|
|
325
|
+
factorFingerprint: string;
|
|
326
|
+
matchingCounters: number[];
|
|
327
|
+
} | undefined;
|
|
328
|
+
userId: string;
|
|
329
|
+
operation: "totp-sign-in" | "recovery-sign-in";
|
|
330
|
+
expectedGeneration: number;
|
|
331
|
+
challengeId: string;
|
|
332
|
+
} | undefined;
|
|
134
333
|
onUpdateHandle?: string | undefined;
|
|
135
334
|
model: string;
|
|
136
335
|
where: {
|
|
@@ -141,7 +340,7 @@ export declare function defineAuthAdapterFunctions<Schema extends SchemaDefiniti
|
|
|
141
340
|
field: string;
|
|
142
341
|
}[];
|
|
143
342
|
increment: any;
|
|
144
|
-
}, Promise<Record<string,
|
|
343
|
+
}, Promise<Record<string, string | number | boolean | string[] | number[] | null> | null>>;
|
|
145
344
|
rotateSigningKey: import("convex/server").RegisteredMutation<"public", {
|
|
146
345
|
onlyIfEmpty?: boolean | undefined;
|
|
147
346
|
next: {
|