@gatwech/auth 1.0.0-beta.19 → 1.0.0-beta.21
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/adapters/drizzle-adapter/index.mjs +11 -2
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/kysely-adapter/index.mjs +1 -1
- package/dist/adapters/memory-adapter/index.d.mts +1 -1
- package/dist/adapters/memory-adapter/index.mjs +2 -2
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.mjs +1 -1
- package/dist/{audit-log-DKsUWR8O.mjs → audit-log-DgqHJ-uv.mjs} +132 -63
- package/dist/{auth-vfCyIIeV.mjs → auth-BoEA9bN7.mjs} +14 -1
- package/dist/client/index.d.mts +18 -18
- package/dist/client/plugins/index.d.mts +28 -28
- package/dist/client/plugins/index.mjs +2 -2
- package/dist/client/react/index.d.mts +16 -16
- package/dist/{client-CSOs1YN7.d.mts → client-B00gkznv.d.mts} +1 -1
- package/dist/{client-4QEb0rUr.mjs → client-CMsC6-rl.mjs} +1 -1
- package/dist/{client-DZHNfxuR.d.mts → client-Da7tq8m6.d.mts} +4 -4
- package/dist/cookies/index.d.mts +3 -3
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +1 -1
- package/dist/{db-7vHnL1XA.mjs → db-CV59HpEF.mjs} +2 -2
- package/dist/{index-mxEUX2Gs.d.mts → index-BECNG13R.d.mts} +13 -13
- package/dist/{index-DRM35ir1.d.mts → index-BKy-8t2n.d.mts} +118 -65
- package/dist/{index-Df0KhQRf-BEa5tdwJ.d.mts → index-BL_t8cRp-C4QYBsac.d.mts} +56 -17
- package/dist/{index-DXVU0HGr.d.mts → index-BWYXZVsV.d.mts} +5 -5
- package/dist/{index-Df4SvZaE.d.mts → index-Bhc37y9F.d.mts} +3 -3
- package/dist/{index-BNhJglHC.d.mts → index-BjCQ3jmE.d.mts} +119 -119
- package/dist/{index-Cv9iMevV.d.mts → index-Bxive_YT.d.mts} +9 -9
- package/dist/{index-CgeC2eGC.d.mts → index-C-IDh5yy.d.mts} +2 -2
- package/dist/{index-COGe8UJx.d.mts → index-CM1rFdwV.d.mts} +9 -9
- package/dist/{index-zBdYQGaS.d.mts → index-CMG4Pnen.d.mts} +6 -6
- package/dist/{index-Blmhq6eA.d.mts → index-CTqynuxm.d.mts} +4 -4
- package/dist/{index-DS-R7st3.d.mts → index-CbBQdS-u.d.mts} +6 -6
- package/dist/{index-Db8jqUq2.d.mts → index-CpH-1sse.d.mts} +10 -10
- package/dist/{index-CUknVRZp.d.mts → index-D1OZ2e4m.d.mts} +14 -14
- package/dist/{index-CaqpCfE5.d.mts → index-Dt2I0G4X.d.mts} +7 -7
- package/dist/{index-EABwA_BH.d.mts → index-IX1to9TB.d.mts} +34 -34
- package/dist/{index-CKnPAS5n.d.mts → index-TrOnY3pM.d.mts} +170 -170
- package/dist/{index-CsxtcAO0.d.mts → index-VUyESU4p.d.mts} +1 -1
- package/dist/{index-CP3FNbOZ.d.mts → index-WV7VzW2H.d.mts} +8 -8
- package/dist/{index-xoYsoOiR.d.mts → index-YeXSxzhX.d.mts} +3 -3
- package/dist/{index-DG-X1PK5.d.mts → index-cPt-00xm.d.mts} +6 -6
- package/dist/{index-BNDRYfTF.d.mts → index-iRoaTsOj.d.mts} +2 -2
- package/dist/{index-BAVzFqII.d.mts → index-jEkJ2Zfk.d.mts} +6 -6
- package/dist/{index-DyH_CgmX.d.mts → index-oNlp4SvD.d.mts} +10 -10
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/integrations/next-js.d.mts +4 -4
- package/dist/integrations/node.d.mts +2 -2
- package/dist/integrations/react-start.d.mts +4 -4
- package/dist/{kysely-adapter-Bkm1liPW.mjs → kysely-adapter-BidlNTiV.mjs} +4 -2
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/oauth2/index.mjs +1 -1
- package/dist/{organization-CkTKs7bx.mjs → organization-D4QMpChF.mjs} +1 -1
- package/dist/plugins/admin/index.d.mts +3 -3
- package/dist/plugins/admin/index.mjs +1 -1
- package/dist/plugins/anonymous/index.d.mts +3 -3
- package/dist/plugins/anonymous/index.mjs +1 -1
- package/dist/plugins/audit-log/client.d.mts +24 -24
- package/dist/plugins/audit-log/index.d.mts +23 -23
- package/dist/plugins/audit-log/index.mjs +2 -2
- package/dist/plugins/bearer/index.d.mts +1 -1
- package/dist/plugins/captcha/index.d.mts +1 -1
- package/dist/plugins/custom-session/index.d.mts +3 -3
- package/dist/plugins/custom-session/index.mjs +1 -1
- package/dist/plugins/device-authorization/index.d.mts +1 -1
- package/dist/plugins/device-authorization/index.mjs +1 -1
- package/dist/plugins/email-otp/index.d.mts +2 -2
- package/dist/plugins/email-otp/index.mjs +1 -1
- package/dist/plugins/generic-oauth/index.d.mts +3 -3
- package/dist/plugins/generic-oauth/index.mjs +1 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +1 -1
- package/dist/plugins/haveibeenpwned/index.mjs +1 -1
- package/dist/plugins/index.d.mts +23 -23
- package/dist/plugins/index.mjs +5 -5
- package/dist/plugins/jwt/index.d.mts +3 -3
- package/dist/plugins/jwt/index.mjs +1 -1
- package/dist/plugins/magic-link/index.d.mts +1 -1
- package/dist/plugins/magic-link/index.mjs +1 -1
- package/dist/plugins/multi-session/index.d.mts +2 -2
- package/dist/plugins/multi-session/index.mjs +1 -1
- package/dist/plugins/oauth-proxy/index.d.mts +1 -1
- package/dist/plugins/oauth-proxy/index.mjs +1 -1
- package/dist/plugins/one-tap/index.d.mts +1 -1
- package/dist/plugins/one-tap/index.mjs +1 -1
- package/dist/plugins/one-time-token/index.d.mts +3 -3
- package/dist/plugins/one-time-token/index.mjs +5 -5
- package/dist/plugins/organization/index.d.mts +3 -3
- package/dist/plugins/organization/index.mjs +2 -2
- package/dist/plugins/passkey/index.d.mts +3 -3
- package/dist/plugins/passkey/index.mjs +1 -1
- package/dist/plugins/phone-number/index.d.mts +3 -3
- package/dist/plugins/phone-number/index.mjs +1 -1
- package/dist/plugins/sentinel/client.d.mts +24 -24
- package/dist/plugins/sentinel/client.mjs +2 -2
- package/dist/plugins/sentinel/index.d.mts +23 -23
- package/dist/plugins/sentinel/index.mjs +3 -3
- package/dist/plugins/two-factor/index.d.mts +3 -3
- package/dist/plugins/two-factor/index.mjs +1 -1
- package/dist/plugins/username/index.d.mts +1 -1
- package/dist/plugins/username/index.mjs +1 -1
- package/dist/{pow-OK01yPG3.mjs → pow-DvkUopsK.mjs} +17 -1
- package/dist/{sentinel-C-D1IHJo.mjs → sentinel-B4Wo79HK.mjs} +326 -92
- package/dist/src/adapters/memory-adapter/memory-adapter.d.ts +1 -1
- package/dist/src/adapters/prisma-adapter/test/auth.d.ts +1 -1
- package/dist/src/adapters/tests/auth-flow.d.ts +3 -3
- package/dist/src/adapters/tests/normal.d.ts +10 -2
- package/dist/src/adapters/tests/number-id.d.ts +4 -4
- package/dist/src/adapters/tests/performance.d.ts +3 -3
- package/dist/src/adapters/tests/transactions.d.ts +3 -3
- package/dist/src/api/index.d.ts +8 -8
- package/dist/src/plugins/admin/admin.d.ts +2 -2
- package/dist/src/plugins/api-key/index.d.ts +2 -2
- package/dist/src/plugins/audit-log/index.d.ts +5 -14
- package/dist/src/plugins/audit-log/remote.d.ts +4 -4
- package/dist/src/plugins/audit-log/types.d.ts +22 -0
- package/dist/src/plugins/email-otp/index.d.ts +1 -1
- package/dist/src/plugins/multi-session/index.d.ts +8 -8
- package/dist/src/plugins/organization/routes/crud-access-control.d.ts +8 -8
- package/dist/src/plugins/organization/routes/crud-invites.d.ts +46 -46
- package/dist/src/plugins/organization/routes/crud-members.d.ts +40 -40
- package/dist/src/plugins/organization/routes/crud-org.d.ts +36 -36
- package/dist/src/plugins/organization/routes/crud-team.d.ts +50 -50
- package/dist/src/plugins/sentinel/email.d.ts +9 -3
- package/dist/src/plugins/sentinel/index.d.ts +10 -1
- package/dist/src/plugins/sentinel/intel.d.ts +8 -1
- package/dist/src/plugins/sentinel/memory-cache.d.ts +12 -0
- package/dist/src/plugins/sentinel/schema.d.ts +4 -0
- package/dist/src/plugins/sentinel/store.d.ts +7 -0
- package/dist/src/plugins/sentinel/types.d.ts +29 -1
- package/dist/src/test-utils/test-instance.d.ts +25 -25
- package/dist/test-utils/index.d.mts +293 -293
- package/dist/test-utils/index.mjs +7 -7
- package/dist/types/index.d.mts +2 -2
- package/package.json +3 -3
|
@@ -10,6 +10,15 @@ import { PayvoAuthError } from "@gatwech/core/error";
|
|
|
10
10
|
import { and, asc, count, desc, eq, gt, gte, inArray, like, lt, lte, ne, notInArray, or, sql } from "drizzle-orm";
|
|
11
11
|
|
|
12
12
|
//#region src/adapters/drizzle-adapter/drizzle-adapter.ts
|
|
13
|
+
/**
|
|
14
|
+
* The number of rows a statement changed. Each driver reports it differently,
|
|
15
|
+
* so this reads whichever field the driver sets.
|
|
16
|
+
*/
|
|
17
|
+
function affectedRows(result) {
|
|
18
|
+
const header = Array.isArray(result) && !("count" in result) ? result[0] : result;
|
|
19
|
+
const count$1 = header?.changes ?? header?.rowsAffected ?? header?.rowCount ?? header?.affectedRows ?? header?.count;
|
|
20
|
+
return Number(count$1 ?? 0);
|
|
21
|
+
}
|
|
13
22
|
const drizzleAdapter = (db, config) => {
|
|
14
23
|
let lazyOptions = null;
|
|
15
24
|
const createCustomAdapter = (db$1) => ({ getFieldName, debugLog }) => {
|
|
@@ -167,7 +176,7 @@ const drizzleAdapter = (db, config) => {
|
|
|
167
176
|
async updateMany({ model, where, update: values }) {
|
|
168
177
|
const schemaModel = getSchema(model);
|
|
169
178
|
const clause = convertWhereClause(where, model);
|
|
170
|
-
return await db$1.update(schemaModel).set(values).where(...clause);
|
|
179
|
+
return affectedRows(await db$1.update(schemaModel).set(values).where(...clause));
|
|
171
180
|
},
|
|
172
181
|
async delete({ model, where }) {
|
|
173
182
|
const schemaModel = getSchema(model);
|
|
@@ -177,7 +186,7 @@ const drizzleAdapter = (db, config) => {
|
|
|
177
186
|
async deleteMany({ model, where }) {
|
|
178
187
|
const schemaModel = getSchema(model);
|
|
179
188
|
const clause = convertWhereClause(where, model);
|
|
180
|
-
return await db$1.delete(schemaModel).where(...clause);
|
|
189
|
+
return affectedRows(await db$1.delete(schemaModel).where(...clause));
|
|
181
190
|
},
|
|
182
191
|
options: config
|
|
183
192
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u as Prettify } from "../helper-BgOIGHsu.mjs";
|
|
2
|
-
import { A as Where$1 } from "../index-
|
|
2
|
+
import { A as Where$1 } from "../index-BjCQ3jmE.mjs";
|
|
3
3
|
import "../types-DNQ9XQrB.mjs";
|
|
4
|
-
import "../index-
|
|
4
|
+
import "../index-BL_t8cRp-C4QYBsac.mjs";
|
|
5
5
|
import "../plugins-Dy_FrD4Y.mjs";
|
|
6
6
|
import { PayvoAuthOptions } from "@gatwech/core";
|
|
7
7
|
import { DBFieldAttribute, PayvoAuthDBSchema } from "@gatwech/core/db";
|
|
@@ -7,6 +7,6 @@ import { n as getKyselyDatabaseType, t as createKyselyAdapter } from "../../dial
|
|
|
7
7
|
import "../../get-tables-CKvSyDST.mjs";
|
|
8
8
|
import "../../misc-fKH4d5XQ.mjs";
|
|
9
9
|
import "../../adapter-factory-xbLUJt85.mjs";
|
|
10
|
-
import { t as kyselyAdapter } from "../../kysely-adapter-
|
|
10
|
+
import { t as kyselyAdapter } from "../../kysely-adapter-BidlNTiV.mjs";
|
|
11
11
|
|
|
12
12
|
export { createKyselyAdapter, getKyselyDatabaseType, kyselyAdapter };
|
|
@@ -135,12 +135,12 @@ const memoryAdapter = (db, config) => {
|
|
|
135
135
|
});
|
|
136
136
|
return count;
|
|
137
137
|
},
|
|
138
|
-
updateMany({ model, where, update }) {
|
|
138
|
+
async updateMany({ model, where, update }) {
|
|
139
139
|
const res = convertWhereClause(where, model);
|
|
140
140
|
res.forEach((record) => {
|
|
141
141
|
Object.assign(record, update);
|
|
142
142
|
});
|
|
143
|
-
return res
|
|
143
|
+
return res.length;
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
}
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../helper-BgOIGHsu.mjs";
|
|
2
|
-
import { $ as AuthEndpoint, At as ok, Bt as listUserAccounts, Ct as revokeSession, Dt as requestPasswordReset, Et as sessionMiddleware, Ft as verifyEmail, Gt as originCheckMiddleware, Ht as unlinkAccount, It as callbackOAuth, Kt as getOAuthState, Lt as accountInfo, Mt as createEmailVerificationToken, Nt as sendVerificationEmail, Ot as requestPasswordResetCallback, Pt as sendVerificationEmailFn, Q as APIError, Rt as getAccessToken, St as revokeOtherSessions, Tt as sensitiveSessionMiddleware, Ut as isSimpleRequest, Vt as refreshToken, Wt as originCheck, _t as freshSessionMiddleware, at as optionsMiddleware, bt as listSessions, ct as changePassword, dt as setPassword, et as AuthMiddleware, ft as updateUser, gt as signInSocial, ht as signInEmail, it as getEndpoints, jt as error, kt as resetPassword, lt as deleteUser, mt as signOut, nt as createAuthEndpoint, ot as router, pt as signUpEmail, rt as createAuthMiddleware, st as changeEmail, tt as checkEndpointConflicts, ut as deleteUserCallback, vt as getSession, wt as revokeSessions, xt as requestOnlySessionMiddleware, yt as getSessionFromCtx, zt as linkSocialAccount } from "../index-
|
|
2
|
+
import { $ as AuthEndpoint, At as ok, Bt as listUserAccounts, Ct as revokeSession, Dt as requestPasswordReset, Et as sessionMiddleware, Ft as verifyEmail, Gt as originCheckMiddleware, Ht as unlinkAccount, It as callbackOAuth, Kt as getOAuthState, Lt as accountInfo, Mt as createEmailVerificationToken, Nt as sendVerificationEmail, Ot as requestPasswordResetCallback, Pt as sendVerificationEmailFn, Q as APIError, Rt as getAccessToken, St as revokeOtherSessions, Tt as sensitiveSessionMiddleware, Ut as isSimpleRequest, Vt as refreshToken, Wt as originCheck, _t as freshSessionMiddleware, at as optionsMiddleware, bt as listSessions, ct as changePassword, dt as setPassword, et as AuthMiddleware, ft as updateUser, gt as signInSocial, ht as signInEmail, it as getEndpoints, jt as error, kt as resetPassword, lt as deleteUser, mt as signOut, nt as createAuthEndpoint, ot as router, pt as signUpEmail, rt as createAuthMiddleware, st as changeEmail, tt as checkEndpointConflicts, ut as deleteUserCallback, vt as getSession, wt as revokeSessions, xt as requestOnlySessionMiddleware, yt as getSessionFromCtx, zt as linkSocialAccount } from "../index-BjCQ3jmE.mjs";
|
|
3
3
|
import "../types-DNQ9XQrB.mjs";
|
|
4
|
-
import "../index-
|
|
4
|
+
import "../index-BL_t8cRp-C4QYBsac.mjs";
|
|
5
5
|
import "../plugins-Dy_FrD4Y.mjs";
|
|
6
6
|
export { APIError, AuthEndpoint, AuthMiddleware, accountInfo, callbackOAuth, changeEmail, changePassword, checkEndpointConflicts, createAuthEndpoint, createAuthMiddleware, createEmailVerificationToken, deleteUser, deleteUserCallback, error, freshSessionMiddleware, getAccessToken, getEndpoints, getOAuthState, getSession, getSessionFromCtx, isSimpleRequest, linkSocialAccount, listSessions, listUserAccounts, ok, optionsMiddleware, originCheck, originCheckMiddleware, refreshToken, requestOnlySessionMiddleware, requestPasswordReset, requestPasswordResetCallback, resetPassword, revokeOtherSessions, revokeSession, revokeSessions, router, sendVerificationEmail, sendVerificationEmailFn, sensitiveSessionMiddleware, sessionMiddleware, setPassword, signInEmail, signInSocial, signOut, signUpEmail, unlinkAccount, updateUser, verifyEmail };
|
package/dist/api/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import "../jwt-CmxZAGe2.mjs";
|
|
|
8
8
|
import "../random-32E3cU5o.mjs";
|
|
9
9
|
import "../cookies-BuvlgcA-.mjs";
|
|
10
10
|
import "../date-CMr04reD.mjs";
|
|
11
|
-
import "../db-
|
|
11
|
+
import "../db-CV59HpEF.mjs";
|
|
12
12
|
import "../dialect-HsWUfpYY.mjs";
|
|
13
13
|
import "../get-tables-CKvSyDST.mjs";
|
|
14
14
|
import "../types-DCPpFKUB.mjs";
|
|
@@ -2,7 +2,7 @@ import { t as getIp } from "./get-request-ip-DSjrEpGo.mjs";
|
|
|
2
2
|
import { t as generateRandomString } from "./random-32E3cU5o.mjs";
|
|
3
3
|
import { n as mergeSchema } from "./date-CMr04reD.mjs";
|
|
4
4
|
import { r as getSessionFromCtx, u as sessionMiddleware } from "./session-BB3oqApE.mjs";
|
|
5
|
-
import { a as CREDENTIAL_SIGN_IN_PATHS, c as SIGN_IN_PATHS, i as AUDIT_EVENT_TYPES, l as VERIFICATION_PATHS, n as registerAuditRecorder, o as PATH_EVENTS, r as ALL_EVENT_TYPES } from "./registry-CqG_3Qnx.mjs";
|
|
5
|
+
import { a as CREDENTIAL_SIGN_IN_PATHS, c as SIGN_IN_PATHS, i as AUDIT_EVENT_TYPES, l as VERIFICATION_PATHS, n as registerAuditRecorder, o as PATH_EVENTS, r as ALL_EVENT_TYPES, s as SECURITY_EVENT_TYPES } from "./registry-CqG_3Qnx.mjs";
|
|
6
6
|
import { env } from "@gatwech/core/env";
|
|
7
7
|
import { defineErrorCodes } from "@gatwech/core/utils";
|
|
8
8
|
import { APIError } from "better-call";
|
|
@@ -11,9 +11,14 @@ import * as z$1 from "zod";
|
|
|
11
11
|
import { betterFetch } from "@better-fetch/fetch";
|
|
12
12
|
|
|
13
13
|
//#region src/plugins/audit-log/remote.ts
|
|
14
|
+
/** Sends to the backend: the first attempt and up to 2 retries */
|
|
15
|
+
const SEND_ATTEMPTS = 3;
|
|
16
|
+
/** Delay before the first retry, doubled for the next */
|
|
17
|
+
const RETRY_DELAY_MS = 250;
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
19
|
+
* Sends each event to the hosted backend as it's recorded, in the
|
|
20
|
+
* background, so the auth flow never waits for it. Failures are retried, then
|
|
21
|
+
* logged and dropped.
|
|
17
22
|
*/
|
|
18
23
|
function createRemoteSink(options) {
|
|
19
24
|
if (options === false) return {
|
|
@@ -28,47 +33,33 @@ function createRemoteSink(options) {
|
|
|
28
33
|
};
|
|
29
34
|
const baseURL = apiUrl.replace(/\/+$/, "");
|
|
30
35
|
const timeout = options?.timeout ?? 3e3;
|
|
31
|
-
const maxSize = options?.batch?.maxSize ?? 25;
|
|
32
|
-
const flushIntervalMs = options?.batch?.flushIntervalMs ?? 2e3;
|
|
33
36
|
const headers = {
|
|
34
37
|
...options?.headers,
|
|
35
38
|
authorization: `Bearer ${apiKey}`
|
|
36
39
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
/** Sends one event, retrying failures the backend may recover from */
|
|
41
|
+
async function send(event, logger$1) {
|
|
42
|
+
for (let attempt = 1;; attempt++) {
|
|
43
|
+
const { error } = await betterFetch(`${baseURL}/v1/events`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers,
|
|
46
|
+
body: { events: [event] },
|
|
47
|
+
timeout
|
|
48
|
+
}).catch((e) => ({ error: e }));
|
|
49
|
+
if (!error) return;
|
|
50
|
+
const status = error.status;
|
|
51
|
+
if (!(status === void 0 || status >= 500 || status === 408 || status === 429) || attempt === SEND_ATTEMPTS) {
|
|
52
|
+
logger$1.error("[audit-log] Failed to send audit event", error);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS * 2 ** (attempt - 1)));
|
|
52
56
|
}
|
|
53
|
-
if (!buffer.length) return;
|
|
54
|
-
const events = buffer;
|
|
55
|
-
buffer = [];
|
|
56
|
-
await send(events, logger$1);
|
|
57
57
|
}
|
|
58
58
|
return {
|
|
59
59
|
sink: {
|
|
60
|
-
push(event,
|
|
61
|
-
|
|
62
|
-
if (buffer.length >= maxSize) {
|
|
63
|
-
flush(logger$1);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (!timer) {
|
|
67
|
-
timer = setTimeout(() => void flush(logger$1), flushIntervalMs);
|
|
68
|
-
timer.unref?.();
|
|
69
|
-
}
|
|
60
|
+
push(event, auth) {
|
|
61
|
+
auth.runInBackground(send(event, auth.logger));
|
|
70
62
|
},
|
|
71
|
-
flush,
|
|
72
63
|
async query({ userIds, organizationIds,...query }) {
|
|
73
64
|
const params = new URLSearchParams();
|
|
74
65
|
for (const [key, value] of Object.entries(query)) if (value !== void 0) params.set(key, String(value));
|
|
@@ -177,20 +168,32 @@ function toPagination(query) {
|
|
|
177
168
|
offset: Math.max(Math.trunc(Number(query.offset) || 0), 0)
|
|
178
169
|
};
|
|
179
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Failed attempts and security decisions a user can see about their own
|
|
173
|
+
* account before they are signed in
|
|
174
|
+
*/
|
|
175
|
+
const ACCOUNT_ATTEMPT_EVENT_TYPES = [
|
|
176
|
+
AUDIT_EVENT_TYPES.USER_SIGN_IN_FAILED,
|
|
177
|
+
AUDIT_EVENT_TYPES.VERIFICATION_FAILED,
|
|
178
|
+
SECURITY_EVENT_TYPES.BLOCKED,
|
|
179
|
+
SECURITY_EVENT_TYPES.CREDENTIAL_STUFFING,
|
|
180
|
+
SECURITY_EVENT_TYPES.VELOCITY_EXCEEDED
|
|
181
|
+
];
|
|
182
|
+
/** The most attempts on an account shown with a user's own events */
|
|
183
|
+
const ACCOUNT_ATTEMPT_LIMIT = 50;
|
|
180
184
|
const auditLog = (options) => {
|
|
181
185
|
const opts = {
|
|
182
186
|
...options,
|
|
183
187
|
database: options?.database ?? true,
|
|
184
188
|
trackFailedSignIns: options?.trackFailedSignIns ?? true,
|
|
185
|
-
adminRoles: options?.adminRoles ?? ["admin"]
|
|
189
|
+
adminRoles: options?.adminRoles ?? ["admin"],
|
|
190
|
+
organizationAdminRoles: options?.organizationAdminRoles ?? ["owner", "admin"],
|
|
191
|
+
showAttemptsOnOwnAccount: options?.showAttemptsOnOwnAccount ?? true
|
|
186
192
|
};
|
|
187
193
|
const excluded = new Set(opts.exclude ?? []);
|
|
188
194
|
const { sink: remote, misconfigured } = createRemoteSink(opts.remote);
|
|
189
195
|
const mergedSchema = mergeSchema(schema, opts.schema);
|
|
190
196
|
let authContext;
|
|
191
|
-
/** Pending update payloads, so `update.after` knows which fields changed */
|
|
192
|
-
const pendingUserUpdates = /* @__PURE__ */ new WeakMap();
|
|
193
|
-
const noContextKey = {};
|
|
194
197
|
/** Users created in a request, so their first account isn't a link */
|
|
195
198
|
const createdUsers = /* @__PURE__ */ new WeakMap();
|
|
196
199
|
/**
|
|
@@ -292,7 +295,7 @@ const auditLog = (options) => {
|
|
|
292
295
|
...data,
|
|
293
296
|
id: id || generateRandomString(32)
|
|
294
297
|
};
|
|
295
|
-
remote?.push(full, auth
|
|
298
|
+
remote?.push(full, auth);
|
|
296
299
|
const onEvent = opts.onEvent;
|
|
297
300
|
if (onEvent) await Promise.resolve().then(() => onEvent(full)).catch((e) => auth.logger.error("[audit-log] onEvent handler failed", e));
|
|
298
301
|
} catch (e) {
|
|
@@ -372,6 +375,70 @@ const auditLog = (options) => {
|
|
|
372
375
|
offset
|
|
373
376
|
};
|
|
374
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* Attempts made on a user's account before signing in, matched by the email
|
|
380
|
+
* that was typed. Anyone can type any email, so these are stripped of what
|
|
381
|
+
* identifies the person who made them. Only events since the user's account
|
|
382
|
+
* was created count, so an address's earlier history isn't shown.
|
|
383
|
+
*/
|
|
384
|
+
async function queryAccountAttempts(auth, user, filters) {
|
|
385
|
+
if (filters.eventType && !ACCOUNT_ATTEMPT_EVENT_TYPES.includes(filters.eventType)) return [];
|
|
386
|
+
const since = new Date(Math.max(new Date(user.createdAt).getTime(), filters.startDate ? new Date(filters.startDate).getTime() : 0));
|
|
387
|
+
const identifiers = [...new Set([
|
|
388
|
+
user.email,
|
|
389
|
+
user.email.toLowerCase(),
|
|
390
|
+
typeof user.normalizedEmail === "string" ? user.normalizedEmail : null
|
|
391
|
+
].filter((value) => Boolean(value)))];
|
|
392
|
+
let events;
|
|
393
|
+
if (remote) events = (await remote.query({
|
|
394
|
+
limit: 100,
|
|
395
|
+
offset: 0,
|
|
396
|
+
identifier: user.email.toLowerCase(),
|
|
397
|
+
startDate: since.toISOString(),
|
|
398
|
+
endDate: filters.endDate
|
|
399
|
+
})).events.filter((event) => !event.userId && (filters.eventType ? event.eventType === filters.eventType : ACCOUNT_ATTEMPT_EVENT_TYPES.includes(event.eventType)));
|
|
400
|
+
else {
|
|
401
|
+
const where = [
|
|
402
|
+
{
|
|
403
|
+
field: "identifier",
|
|
404
|
+
operator: "in",
|
|
405
|
+
value: identifiers
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
field: "eventType",
|
|
409
|
+
operator: "in",
|
|
410
|
+
value: filters.eventType ? [filters.eventType] : ACCOUNT_ATTEMPT_EVENT_TYPES
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
field: "createdAt",
|
|
414
|
+
operator: "gte",
|
|
415
|
+
value: since
|
|
416
|
+
}
|
|
417
|
+
];
|
|
418
|
+
if (filters.endDate) where.push({
|
|
419
|
+
field: "createdAt",
|
|
420
|
+
operator: "lte",
|
|
421
|
+
value: new Date(filters.endDate)
|
|
422
|
+
});
|
|
423
|
+
events = await auth.adapter.findMany({
|
|
424
|
+
model: "auditLog",
|
|
425
|
+
where,
|
|
426
|
+
limit: ACCOUNT_ATTEMPT_LIMIT * 4,
|
|
427
|
+
sortBy: {
|
|
428
|
+
field: "createdAt",
|
|
429
|
+
direction: "desc"
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
events = events.filter((event) => !event.userId);
|
|
433
|
+
}
|
|
434
|
+
return events.slice(0, ACCOUNT_ATTEMPT_LIMIT).map((event) => ({
|
|
435
|
+
...event,
|
|
436
|
+
ipAddress: null,
|
|
437
|
+
userAgent: null,
|
|
438
|
+
visitorId: null,
|
|
439
|
+
eventData: null
|
|
440
|
+
}));
|
|
441
|
+
}
|
|
375
442
|
/** Organization memberships of a user, empty without the organization plugin */
|
|
376
443
|
async function findMemberships(auth, userId) {
|
|
377
444
|
try {
|
|
@@ -418,25 +485,14 @@ const auditLog = (options) => {
|
|
|
418
485
|
identifier: user.email
|
|
419
486
|
});
|
|
420
487
|
} },
|
|
421
|
-
update: {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
async after(user, context) {
|
|
430
|
-
const key = context ?? noContextKey;
|
|
431
|
-
const data = pendingUserUpdates.get(key)?.shift();
|
|
432
|
-
if (!user || !data) return;
|
|
433
|
-
for (const event of userEventsFromUpdate(data)) await record(context ?? void 0, {
|
|
434
|
-
...event,
|
|
435
|
-
userId: user.id,
|
|
436
|
-
identifier: user.email
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
},
|
|
488
|
+
update: { async after(user, context, data) {
|
|
489
|
+
if (!user || !data) return;
|
|
490
|
+
for (const event of userEventsFromUpdate(data)) await record(context ?? void 0, {
|
|
491
|
+
...event,
|
|
492
|
+
userId: user.id,
|
|
493
|
+
identifier: user.email
|
|
494
|
+
});
|
|
495
|
+
} },
|
|
440
496
|
delete: { async after(user, context) {
|
|
441
497
|
await record(context ?? void 0, {
|
|
442
498
|
eventType: AUDIT_EVENT_TYPES.USER_DELETED,
|
|
@@ -575,7 +631,7 @@ const auditLog = (options) => {
|
|
|
575
631
|
metadata: { openapi: {
|
|
576
632
|
operationId: "getAuditLogs",
|
|
577
633
|
summary: "Get audit logs",
|
|
578
|
-
description: "Get the current user's audit events, optionally restricted to an organization",
|
|
634
|
+
description: "Get the current user's audit events, optionally restricted to an organization, with failed attempts on their account",
|
|
579
635
|
responses: { 200: {
|
|
580
636
|
description: "Paginated audit events",
|
|
581
637
|
content: { "application/json": { schema: {
|
|
@@ -646,11 +702,24 @@ const auditLog = (options) => {
|
|
|
646
702
|
const { limit: _limit, offset: _offset,...filters } = ctx.query ?? {};
|
|
647
703
|
const pagination = toPagination(ctx.query ?? {});
|
|
648
704
|
if (filters.userId && filters.userId !== user.id) throw new APIError("FORBIDDEN", { message: AUDIT_LOG_ERROR_CODES.AUDIT_LOG_ACCESS_DENIED });
|
|
649
|
-
|
|
705
|
+
const own = await runQuery(ctx.context, {
|
|
650
706
|
...filters,
|
|
651
707
|
...pagination,
|
|
708
|
+
limit: pagination.offset + pagination.limit,
|
|
709
|
+
offset: 0,
|
|
652
710
|
userId: user.id
|
|
653
|
-
})
|
|
711
|
+
});
|
|
712
|
+
const attempts = opts.showAttemptsOnOwnAccount && !filters.organizationId ? await queryAccountAttempts(ctx.context, user, filters).catch((e) => {
|
|
713
|
+
ctx.context.logger.error("[audit-log] Failed to query account attempts", e);
|
|
714
|
+
return [];
|
|
715
|
+
}) : [];
|
|
716
|
+
const events = [...own.events, ...attempts].sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()).slice(pagination.offset, pagination.offset + pagination.limit);
|
|
717
|
+
return ctx.json({
|
|
718
|
+
events,
|
|
719
|
+
total: own.total + attempts.length,
|
|
720
|
+
limit: pagination.limit,
|
|
721
|
+
offset: pagination.offset
|
|
722
|
+
});
|
|
654
723
|
}),
|
|
655
724
|
getAllAuditLogs: createAuthEndpoint("/audit-log/get-all-audit-logs", {
|
|
656
725
|
method: "GET",
|
|
@@ -733,7 +802,7 @@ const auditLog = (options) => {
|
|
|
733
802
|
...filters,
|
|
734
803
|
...pagination
|
|
735
804
|
}));
|
|
736
|
-
const administered = (await findMemberships(ctx.context, user.id)).filter((m) => hasRole(m.role,
|
|
805
|
+
const administered = (await findMemberships(ctx.context, user.id)).filter((m) => hasRole(m.role, opts.organizationAdminRoles)).map((m) => m.organizationId);
|
|
737
806
|
if (!administered.length || filters.organizationId && !administered.includes(filters.organizationId)) throw new APIError("FORBIDDEN", { message: AUDIT_LOG_ERROR_CODES.AUDIT_LOG_ACCESS_DENIED });
|
|
738
807
|
return ctx.json(await runQuery(ctx.context, {
|
|
739
808
|
...filters,
|
|
@@ -3,7 +3,7 @@ import { r as getOrigin, t as getBaseURL } from "./url-VB2gAbTI.mjs";
|
|
|
3
3
|
import { a as getEndpoints, n as checkEndpointConflicts, s as router } from "./api-Dk8Yj_J5.mjs";
|
|
4
4
|
import { i as verifyPassword, r as hashPassword } from "./crypto-CCyta8xj.mjs";
|
|
5
5
|
import { i as getCookies, t as createCookieGetter } from "./cookies-BuvlgcA-.mjs";
|
|
6
|
-
import { a as createInternalAdapter, r as getAdapter, s as getMigrations } from "./db-
|
|
6
|
+
import { a as createInternalAdapter, r as getAdapter, s as getMigrations } from "./db-CV59HpEF.mjs";
|
|
7
7
|
import { n as getKyselyDatabaseType } from "./dialect-HsWUfpYY.mjs";
|
|
8
8
|
import { t as getAuthTables } from "./get-tables-CKvSyDST.mjs";
|
|
9
9
|
import { t as checkPassword } from "./password-5CdcAVaH.mjs";
|
|
@@ -137,6 +137,19 @@ const init = async (options) => {
|
|
|
137
137
|
await runMigrations();
|
|
138
138
|
},
|
|
139
139
|
publishTelemetry: publish,
|
|
140
|
+
runInBackground(promise) {
|
|
141
|
+
const task = promise.catch((error) => {
|
|
142
|
+
logger$1.error("Background task failed", error);
|
|
143
|
+
});
|
|
144
|
+
options.advanced?.backgroundTasks?.handler(task);
|
|
145
|
+
},
|
|
146
|
+
async runInBackgroundOrAwait(promise) {
|
|
147
|
+
const handler = options.advanced?.backgroundTasks?.handler;
|
|
148
|
+
if (!handler || !promise) return promise;
|
|
149
|
+
handler(promise.catch((error) => {
|
|
150
|
+
logger$1.error("Background task failed", error);
|
|
151
|
+
}));
|
|
152
|
+
},
|
|
140
153
|
skipCSRFCheck: !!options.advanced?.disableCSRFCheck,
|
|
141
154
|
skipOriginCheck: options.advanced?.disableOriginCheck !== void 0 ? options.advanced.disableOriginCheck : isTest() ? true : false
|
|
142
155
|
});
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { d as PrettifyDeep, h as UnionToIntersection } from "../helper-BgOIGHsu.mjs";
|
|
2
|
-
import { B as InferPluginsFromClient, F as ClientStore, G as PayvoAuthClientPlugin, H as InferUserFromClient, I as InferActions, K as SessionQueryParams, L as InferAdditionalFromClient, M as AtomListener, N as ClientAtomListener, P as ClientOptions, R as InferClientAPI, U as IsSignal, V as InferSessionFromClient, W as PayvoAuthClientOptions, q as Store, z as InferErrorCodes } from "../index-
|
|
2
|
+
import { B as InferPluginsFromClient, F as ClientStore, G as PayvoAuthClientPlugin, H as InferUserFromClient, I as InferActions, K as SessionQueryParams, L as InferAdditionalFromClient, M as AtomListener, N as ClientAtomListener, P as ClientOptions, R as InferClientAPI, U as IsSignal, V as InferSessionFromClient, W as PayvoAuthClientOptions, q as Store, z as InferErrorCodes } from "../index-BjCQ3jmE.mjs";
|
|
3
3
|
import "../types-DNQ9XQrB.mjs";
|
|
4
|
-
import "../index-
|
|
4
|
+
import "../index-BL_t8cRp-C4QYBsac.mjs";
|
|
5
5
|
import "../plugins-Dy_FrD4Y.mjs";
|
|
6
6
|
import { PayvoAuthClientOptions as PayvoAuthClientOptions$1, PayvoAuthClientPlugin as PayvoAuthClientPlugin$1, PayvoAuthOptions, PayvoAuthPlugin } from "@gatwech/core";
|
|
7
7
|
import { BASE_ERROR_CODES } from "@gatwech/core/error";
|
|
8
|
-
import * as
|
|
8
|
+
import * as _better_fetch_fetch20 from "@better-fetch/fetch";
|
|
9
9
|
import { BetterFetch, BetterFetchError, BetterFetchOption } from "@better-fetch/fetch";
|
|
10
|
-
import * as
|
|
10
|
+
import * as nanostores0 from "nanostores";
|
|
11
11
|
import { Atom, PreinitializedWritableAtom, WritableAtom } from "nanostores";
|
|
12
12
|
export * from "@better-fetch/fetch";
|
|
13
13
|
export * from "nanostores";
|
|
@@ -79,27 +79,27 @@ declare function createAuthClient<Option extends PayvoAuthClientOptions$1>(optio
|
|
|
79
79
|
error: BetterFetchError | null;
|
|
80
80
|
isPending: boolean;
|
|
81
81
|
}>;
|
|
82
|
-
$fetch:
|
|
83
|
-
plugins: (
|
|
82
|
+
$fetch: _better_fetch_fetch20.BetterFetch<{
|
|
83
|
+
plugins: (_better_fetch_fetch20.BetterFetchPlugin | {
|
|
84
84
|
id: string;
|
|
85
85
|
name: string;
|
|
86
86
|
hooks: {
|
|
87
|
-
onSuccess(context:
|
|
87
|
+
onSuccess(context: _better_fetch_fetch20.SuccessContext<any>): void;
|
|
88
88
|
};
|
|
89
89
|
} | {
|
|
90
90
|
id: string;
|
|
91
91
|
name: string;
|
|
92
92
|
hooks: {
|
|
93
|
-
onRequest<T extends Record<string, any>>(context:
|
|
93
|
+
onRequest<T extends Record<string, any>>(context: _better_fetch_fetch20.RequestContext<T>): void;
|
|
94
94
|
};
|
|
95
95
|
} | {
|
|
96
96
|
id: string;
|
|
97
97
|
name: string;
|
|
98
98
|
hooks: {
|
|
99
|
-
onSuccess: ((context:
|
|
100
|
-
onError: ((context:
|
|
101
|
-
onRequest: (<T extends Record<string, any>>(context:
|
|
102
|
-
onResponse: ((context:
|
|
99
|
+
onSuccess: ((context: _better_fetch_fetch20.SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
100
|
+
onError: ((context: _better_fetch_fetch20.ErrorContext) => Promise<void> | void) | undefined;
|
|
101
|
+
onRequest: (<T extends Record<string, any>>(context: _better_fetch_fetch20.RequestContext<T>) => Promise<_better_fetch_fetch20.RequestContext | void> | _better_fetch_fetch20.RequestContext | void) | undefined;
|
|
102
|
+
onResponse: ((context: _better_fetch_fetch20.ResponseContext) => Promise<Response | void | _better_fetch_fetch20.ResponseContext> | Response | _better_fetch_fetch20.ResponseContext | void) | undefined;
|
|
103
103
|
};
|
|
104
104
|
})[];
|
|
105
105
|
method: string;
|
|
@@ -119,12 +119,12 @@ declare function createAuthClient<Option extends PayvoAuthClientOptions$1>(optio
|
|
|
119
119
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
120
120
|
signal?: (AbortSignal | null) | undefined;
|
|
121
121
|
window?: null | undefined;
|
|
122
|
-
onRetry?: ((response:
|
|
122
|
+
onRetry?: ((response: _better_fetch_fetch20.ResponseContext) => Promise<void> | void) | undefined;
|
|
123
123
|
hookOptions?: {
|
|
124
124
|
cloneResponse?: boolean;
|
|
125
125
|
} | undefined;
|
|
126
126
|
timeout?: number | undefined;
|
|
127
|
-
customFetchImpl:
|
|
127
|
+
customFetchImpl: _better_fetch_fetch20.FetchEsque;
|
|
128
128
|
baseURL: string;
|
|
129
129
|
throw?: boolean | undefined;
|
|
130
130
|
auth?: ({
|
|
@@ -144,16 +144,16 @@ declare function createAuthClient<Option extends PayvoAuthClientOptions$1>(optio
|
|
|
144
144
|
params?: any;
|
|
145
145
|
duplex?: "full" | "half" | undefined;
|
|
146
146
|
jsonParser: (text: string) => Promise<any> | any;
|
|
147
|
-
retry?:
|
|
147
|
+
retry?: _better_fetch_fetch20.RetryOptions | undefined;
|
|
148
148
|
retryAttempt?: number | undefined;
|
|
149
|
-
output?: (
|
|
150
|
-
errorSchema?:
|
|
149
|
+
output?: (_better_fetch_fetch20.StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
150
|
+
errorSchema?: _better_fetch_fetch20.StandardSchemaV1 | undefined;
|
|
151
151
|
disableValidation?: boolean | undefined;
|
|
152
152
|
}, unknown, unknown, {}>;
|
|
153
153
|
$store: {
|
|
154
154
|
notify: (signal?: (Omit<string, "$sessionSignal"> | "$sessionSignal") | undefined) => void;
|
|
155
155
|
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
156
|
-
atoms: Record<string,
|
|
156
|
+
atoms: Record<string, nanostores0.WritableAtom<any>>;
|
|
157
157
|
};
|
|
158
158
|
$Infer: {
|
|
159
159
|
Session: NonNullable<InferClientAPI<Option> extends {
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { a as LiteralNumber, c as OmitId, d as PrettifyDeep, f as Primitive, g as WithoutEmpty, h as UnionToIntersection, i as HasRequiredKeys, l as PreserveJSDoc, m as StripEmptyObjects, n as DeepPartial, o as LiteralString, p as RequiredKeysOf, r as Expand, s as LiteralUnion, t as Awaitable, u as Prettify } from "../../helper-BgOIGHsu.mjs";
|
|
2
|
-
import { K as SessionQueryParams, Y as Auth, g as User$1, h as Session$1, i as PayvoAuthPlugin$1, mn as InferAdditionalFieldsFromPluginOptions, r as PayvoAuthOptions$1 } from "../../index-
|
|
2
|
+
import { K as SessionQueryParams, Y as Auth, g as User$1, h as Session$1, i as PayvoAuthPlugin$1, mn as InferAdditionalFieldsFromPluginOptions, r as PayvoAuthOptions$1 } from "../../index-BjCQ3jmE.mjs";
|
|
3
3
|
import "../../types-DNQ9XQrB.mjs";
|
|
4
|
-
import "../../index-
|
|
4
|
+
import "../../index-BL_t8cRp-C4QYBsac.mjs";
|
|
5
5
|
import "../../plugins-Dy_FrD4Y.mjs";
|
|
6
6
|
import { a as Role, i as AccessControl, o as Statements } from "../../index-CxlWnL9c.mjs";
|
|
7
|
-
import { t as admin } from "../../index-
|
|
8
|
-
import { r as anonymous } from "../../index-
|
|
9
|
-
import { L as apiKey } from "../../index-
|
|
10
|
-
import "../../index-
|
|
11
|
-
import "../../index-
|
|
12
|
-
import "../../index-
|
|
13
|
-
import { i as deviceAuthorizationClient } from "../../index-
|
|
14
|
-
import { n as emailOTP } from "../../index-
|
|
15
|
-
import { n as genericOAuth } from "../../index-
|
|
16
|
-
import "../../index-
|
|
17
|
-
import { t as jwt } from "../../index-
|
|
18
|
-
import { t as magicLink } from "../../index-
|
|
19
|
-
import { t as multiSession } from "../../index-
|
|
20
|
-
import "../../index-
|
|
21
|
-
import "../../index-
|
|
22
|
-
import { t as oneTimeToken } from "../../index-
|
|
7
|
+
import { t as admin } from "../../index-IX1to9TB.mjs";
|
|
8
|
+
import { r as anonymous } from "../../index-CMG4Pnen.mjs";
|
|
9
|
+
import { L as apiKey } from "../../index-BKy-8t2n.mjs";
|
|
10
|
+
import "../../index-CbBQdS-u.mjs";
|
|
11
|
+
import "../../index-C-IDh5yy.mjs";
|
|
12
|
+
import "../../index-cPt-00xm.mjs";
|
|
13
|
+
import { i as deviceAuthorizationClient } from "../../index-jEkJ2Zfk.mjs";
|
|
14
|
+
import { n as emailOTP } from "../../index-D1OZ2e4m.mjs";
|
|
15
|
+
import { n as genericOAuth } from "../../index-WV7VzW2H.mjs";
|
|
16
|
+
import "../../index-Bhc37y9F.mjs";
|
|
17
|
+
import { t as jwt } from "../../index-CM1rFdwV.mjs";
|
|
18
|
+
import { t as magicLink } from "../../index-CTqynuxm.mjs";
|
|
19
|
+
import { t as multiSession } from "../../index-CpH-1sse.mjs";
|
|
20
|
+
import "../../index-oNlp4SvD.mjs";
|
|
21
|
+
import "../../index-iRoaTsOj.mjs";
|
|
22
|
+
import { t as oneTimeToken } from "../../index-BWYXZVsV.mjs";
|
|
23
23
|
import "../../index-QmocqGM-.mjs";
|
|
24
|
-
import { F as OrganizationOptions, S as Team, b as OrganizationRole, c as InferMember, f as InferTeam, g as Member, l as InferOrganization, p as Invitation, r as OrganizationPlugin, s as InferInvitation, v as Organization, w as TeamMember } from "../../index-
|
|
25
|
-
import { r as phoneNumber } from "../../index-
|
|
26
|
-
import { n as twoFactorClient } from "../../index-
|
|
27
|
-
import { n as Passkey, t as passkey } from "../../index-
|
|
28
|
-
import { n as username } from "../../index-
|
|
29
|
-
import { t as auditLogClient } from "../../client-
|
|
30
|
-
import { t as sentinelClient } from "../../client-
|
|
31
|
-
import * as
|
|
24
|
+
import { F as OrganizationOptions, S as Team, b as OrganizationRole, c as InferMember, f as InferTeam, g as Member, l as InferOrganization, p as Invitation, r as OrganizationPlugin, s as InferInvitation, v as Organization, w as TeamMember } from "../../index-TrOnY3pM.mjs";
|
|
25
|
+
import { r as phoneNumber } from "../../index-Dt2I0G4X.mjs";
|
|
26
|
+
import { n as twoFactorClient } from "../../index-YeXSxzhX.mjs";
|
|
27
|
+
import { n as Passkey, t as passkey } from "../../index-BECNG13R.mjs";
|
|
28
|
+
import { n as username } from "../../index-Bxive_YT.mjs";
|
|
29
|
+
import { t as auditLogClient } from "../../client-B00gkznv.mjs";
|
|
30
|
+
import { t as sentinelClient } from "../../client-Da7tq8m6.mjs";
|
|
31
|
+
import * as _gatwech_core53 from "@gatwech/core";
|
|
32
32
|
import { ClientStore, PayvoAuthOptions } from "@gatwech/core";
|
|
33
33
|
import { DBFieldAttribute } from "@gatwech/core/db";
|
|
34
34
|
import * as _better_fetch_fetch53 from "@better-fetch/fetch";
|
|
@@ -369,7 +369,7 @@ interface GoogleOneTapActionOptions extends Omit<GoogleOneTapOptions, "clientId"
|
|
|
369
369
|
}
|
|
370
370
|
declare const oneTapClient: (options: GoogleOneTapOptions) => {
|
|
371
371
|
id: "one-tap";
|
|
372
|
-
getActions: ($fetch: _better_fetch_fetch53.BetterFetch, _:
|
|
372
|
+
getActions: ($fetch: _better_fetch_fetch53.BetterFetch, _: _gatwech_core53.ClientStore) => {
|
|
373
373
|
oneTap: (opts?: GoogleOneTapActionOptions | undefined, fetchOptions?: BetterFetchOption | undefined) => Promise<void>;
|
|
374
374
|
};
|
|
375
375
|
getAtoms($fetch: _better_fetch_fetch53.BetterFetch): {};
|
|
@@ -471,7 +471,7 @@ declare const organizationClient: <CO extends OrganizationClientOptions>(options
|
|
|
471
471
|
} ? true : false;
|
|
472
472
|
};
|
|
473
473
|
}>;
|
|
474
|
-
getActions: ($fetch: _better_fetch_fetch53.BetterFetch, _$store:
|
|
474
|
+
getActions: ($fetch: _better_fetch_fetch53.BetterFetch, _$store: _gatwech_core53.ClientStore, co: _gatwech_core53.PayvoAuthClientOptions | undefined) => {
|
|
475
475
|
$Infer: {
|
|
476
476
|
ActiveOrganization: CO["teams"] extends {
|
|
477
477
|
enabled: true;
|
|
@@ -10,10 +10,10 @@ import { t as hasPermission } from "../../has-permission-Bvg8de8g.mjs";
|
|
|
10
10
|
import { t as deviceAuthorizationClient } from "../../client-cBiytuOL.mjs";
|
|
11
11
|
import { a as memberAc, o as ownerAc, r as defaultRoles, t as adminAc } from "../../access-CrwEFPHE.mjs";
|
|
12
12
|
import { n as hasPermissionFn } from "../../permission-CDDWgA_O.mjs";
|
|
13
|
-
import "../../pow-
|
|
13
|
+
import "../../pow-DvkUopsK.mjs";
|
|
14
14
|
import { t as twoFactorClient } from "../../client-BuveH3MN.mjs";
|
|
15
15
|
import { t as auditLogClient } from "../../client-DzOqXJUm.mjs";
|
|
16
|
-
import { t as sentinelClient } from "../../client-
|
|
16
|
+
import { t as sentinelClient } from "../../client-CMsC6-rl.mjs";
|
|
17
17
|
import { atom } from "nanostores";
|
|
18
18
|
import { WebAuthnError, startAuthentication, startRegistration } from "@simplewebauthn/browser";
|
|
19
19
|
|