@gatwech/auth 1.0.0-beta.20 → 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 +2 -2
- package/dist/client/plugins/index.d.mts +47 -47
- package/dist/client/plugins/index.mjs +2 -2
- package/dist/client/react/index.d.mts +2 -2
- package/dist/{client-F67q-Lbi.d.mts → client-B00gkznv.d.mts} +1 -1
- package/dist/{client-4QEb0rUr.mjs → client-CMsC6-rl.mjs} +1 -1
- package/dist/{client-C_qmyez2.d.mts → client-Da7tq8m6.d.mts} +1 -1
- 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-BX7rl07Z.d.mts → index-BECNG13R.d.mts} +13 -13
- package/dist/{index-D57DuhZR.d.mts → index-BKy-8t2n.d.mts} +179 -126
- package/dist/{index-Df0KhQRf-BEa5tdwJ.d.mts → index-BL_t8cRp-C4QYBsac.d.mts} +56 -17
- package/dist/{index-D6ku0rUC.d.mts → index-BWYXZVsV.d.mts} +5 -5
- package/dist/{index-DwPAddfE.d.mts → index-Bhc37y9F.d.mts} +3 -3
- package/dist/{index-BNhJglHC.d.mts → index-BjCQ3jmE.d.mts} +119 -119
- package/dist/{index-CzpdkTdv.d.mts → index-Bxive_YT.d.mts} +9 -9
- package/dist/{index-DGeoJ4gu.d.mts → index-C-IDh5yy.d.mts} +2 -2
- package/dist/{index-Dnd8S4S4.d.mts → index-CM1rFdwV.d.mts} +9 -9
- package/dist/{index-CNd5jqLl.d.mts → index-CMG4Pnen.d.mts} +4 -4
- package/dist/{index-4I1YhYhk.d.mts → index-CTqynuxm.d.mts} +4 -4
- package/dist/{index-CP8x1TFq.d.mts → index-CbBQdS-u.d.mts} +6 -6
- package/dist/{index-DyXi7S2M.d.mts → index-CpH-1sse.d.mts} +10 -10
- package/dist/{index-CC920PPp.d.mts → index-D1OZ2e4m.d.mts} +14 -14
- package/dist/{index-CofuaNMl.d.mts → index-Dt2I0G4X.d.mts} +7 -7
- package/dist/{index-XfE0WjTN.d.mts → index-IX1to9TB.d.mts} +34 -34
- package/dist/{index-KhbNmMmG.d.mts → index-TrOnY3pM.d.mts} +170 -170
- package/dist/{index-CsxtcAO0.d.mts → index-VUyESU4p.d.mts} +1 -1
- package/dist/{index-CBiGsvDd.d.mts → index-WV7VzW2H.d.mts} +8 -8
- package/dist/{index-Bml-PCqP.d.mts → index-YeXSxzhX.d.mts} +19 -19
- package/dist/{index-BsSKcKgO.d.mts → index-cPt-00xm.d.mts} +6 -6
- package/dist/{index-sb-UFLuo.d.mts → index-iRoaTsOj.d.mts} +2 -2
- package/dist/{index-DFSRYWFI.d.mts → index-jEkJ2Zfk.d.mts} +6 -6
- package/dist/{index-DTkcY7xH.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-DiPqydKG.mjs → sentinel-B4Wo79HK.mjs} +295 -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/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 +1045 -1045
- 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,7 +1,7 @@
|
|
|
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";
|
|
@@ -1,39 +1,39 @@
|
|
|
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
|
-
import * as
|
|
34
|
+
import * as _better_fetch_fetch53 from "@better-fetch/fetch";
|
|
35
35
|
import { BetterFetch, BetterFetchOption } from "@better-fetch/fetch";
|
|
36
|
-
import * as
|
|
36
|
+
import * as nanostores3 from "nanostores";
|
|
37
37
|
import { atom } from "nanostores";
|
|
38
38
|
|
|
39
39
|
//#region src/plugins/additional-fields/client.d.ts
|
|
@@ -369,10 +369,10 @@ interface GoogleOneTapActionOptions extends Omit<GoogleOneTapOptions, "clientId"
|
|
|
369
369
|
}
|
|
370
370
|
declare const oneTapClient: (options: GoogleOneTapOptions) => {
|
|
371
371
|
id: "one-tap";
|
|
372
|
-
getActions: ($fetch:
|
|
372
|
+
getActions: ($fetch: _better_fetch_fetch53.BetterFetch, _: _gatwech_core53.ClientStore) => {
|
|
373
373
|
oneTap: (opts?: GoogleOneTapActionOptions | undefined, fetchOptions?: BetterFetchOption | undefined) => Promise<void>;
|
|
374
374
|
};
|
|
375
|
-
getAtoms($fetch:
|
|
375
|
+
getAtoms($fetch: _better_fetch_fetch53.BetterFetch): {};
|
|
376
376
|
};
|
|
377
377
|
//#endregion
|
|
378
378
|
//#region src/plugins/one-time-token/client.d.ts
|
|
@@ -471,7 +471,7 @@ declare const organizationClient: <CO extends OrganizationClientOptions>(options
|
|
|
471
471
|
} ? true : false;
|
|
472
472
|
};
|
|
473
473
|
}>;
|
|
474
|
-
getActions: ($fetch:
|
|
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;
|
|
@@ -555,12 +555,12 @@ declare const organizationClient: <CO extends OrganizationClientOptions>(options
|
|
|
555
555
|
}) => boolean;
|
|
556
556
|
};
|
|
557
557
|
};
|
|
558
|
-
getAtoms: ($fetch:
|
|
559
|
-
$listOrg:
|
|
560
|
-
$activeOrgSignal:
|
|
561
|
-
$activeMemberSignal:
|
|
562
|
-
$activeMemberRoleSignal:
|
|
563
|
-
activeOrganization:
|
|
558
|
+
getAtoms: ($fetch: _better_fetch_fetch53.BetterFetch) => {
|
|
559
|
+
$listOrg: nanostores3.PreinitializedWritableAtom<boolean> & object;
|
|
560
|
+
$activeOrgSignal: nanostores3.PreinitializedWritableAtom<boolean> & object;
|
|
561
|
+
$activeMemberSignal: nanostores3.PreinitializedWritableAtom<boolean> & object;
|
|
562
|
+
$activeMemberRoleSignal: nanostores3.PreinitializedWritableAtom<boolean> & object;
|
|
563
|
+
activeOrganization: nanostores3.PreinitializedWritableAtom<{
|
|
564
564
|
data: Prettify<({
|
|
565
565
|
id: string;
|
|
566
566
|
name: string;
|
|
@@ -572,14 +572,14 @@ declare const organizationClient: <CO extends OrganizationClientOptions>(options
|
|
|
572
572
|
members: InferMember<CO, false>[];
|
|
573
573
|
invitations: InferInvitation<CO, false>[];
|
|
574
574
|
}> | null;
|
|
575
|
-
error: null |
|
|
575
|
+
error: null | _better_fetch_fetch53.BetterFetchError;
|
|
576
576
|
isPending: boolean;
|
|
577
577
|
isRefetching: boolean;
|
|
578
578
|
refetch: (queryParams?: {
|
|
579
579
|
query?: SessionQueryParams;
|
|
580
580
|
} | undefined) => void;
|
|
581
581
|
}> & object;
|
|
582
|
-
listOrganizations:
|
|
582
|
+
listOrganizations: nanostores3.PreinitializedWritableAtom<{
|
|
583
583
|
data: ({
|
|
584
584
|
id: string;
|
|
585
585
|
name: string;
|
|
@@ -588,14 +588,14 @@ declare const organizationClient: <CO extends OrganizationClientOptions>(options
|
|
|
588
588
|
logo?: string | null | undefined;
|
|
589
589
|
metadata?: any;
|
|
590
590
|
} & InferAdditionalFieldsFromPluginOptions<"organization", CO, false> extends infer T_1 ? { [K in keyof T_1]: T_1[K] } : never)[] | null;
|
|
591
|
-
error: null |
|
|
591
|
+
error: null | _better_fetch_fetch53.BetterFetchError;
|
|
592
592
|
isPending: boolean;
|
|
593
593
|
isRefetching: boolean;
|
|
594
594
|
refetch: (queryParams?: {
|
|
595
595
|
query?: SessionQueryParams;
|
|
596
596
|
} | undefined) => void;
|
|
597
597
|
}> & object;
|
|
598
|
-
activeMember:
|
|
598
|
+
activeMember: nanostores3.PreinitializedWritableAtom<{
|
|
599
599
|
data: {
|
|
600
600
|
id: string;
|
|
601
601
|
organizationId: string;
|
|
@@ -603,18 +603,18 @@ declare const organizationClient: <CO extends OrganizationClientOptions>(options
|
|
|
603
603
|
role: string;
|
|
604
604
|
createdAt: Date;
|
|
605
605
|
} | null;
|
|
606
|
-
error: null |
|
|
606
|
+
error: null | _better_fetch_fetch53.BetterFetchError;
|
|
607
607
|
isPending: boolean;
|
|
608
608
|
isRefetching: boolean;
|
|
609
609
|
refetch: (queryParams?: {
|
|
610
610
|
query?: SessionQueryParams;
|
|
611
611
|
} | undefined) => void;
|
|
612
612
|
}> & object;
|
|
613
|
-
activeMemberRole:
|
|
613
|
+
activeMemberRole: nanostores3.PreinitializedWritableAtom<{
|
|
614
614
|
data: {
|
|
615
615
|
role: string;
|
|
616
616
|
} | null;
|
|
617
|
-
error: null |
|
|
617
|
+
error: null | _better_fetch_fetch53.BetterFetchError;
|
|
618
618
|
isPending: boolean;
|
|
619
619
|
isRefetching: boolean;
|
|
620
620
|
refetch: (queryParams?: {
|
|
@@ -912,16 +912,16 @@ declare const passkeyClient: () => {
|
|
|
912
912
|
};
|
|
913
913
|
};
|
|
914
914
|
getAtoms($fetch: BetterFetch): {
|
|
915
|
-
listPasskeys:
|
|
915
|
+
listPasskeys: nanostores3.PreinitializedWritableAtom<{
|
|
916
916
|
data: Passkey[] | null;
|
|
917
|
-
error: null |
|
|
917
|
+
error: null | _better_fetch_fetch53.BetterFetchError;
|
|
918
918
|
isPending: boolean;
|
|
919
919
|
isRefetching: boolean;
|
|
920
920
|
refetch: (queryParams?: {
|
|
921
921
|
query?: SessionQueryParams;
|
|
922
922
|
} | undefined) => void;
|
|
923
923
|
}> & object;
|
|
924
|
-
$listPasskeys:
|
|
924
|
+
$listPasskeys: nanostores3.PreinitializedWritableAtom<any> & object;
|
|
925
925
|
};
|
|
926
926
|
pathMethods: {
|
|
927
927
|
"/passkey/register": "POST";
|
|
@@ -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
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as PrettifyDeep, h as UnionToIntersection } from "../../helper-BgOIGHsu.mjs";
|
|
2
|
-
import { I as InferActions, K as SessionQueryParams, R as InferClientAPI, U as IsSignal, z as InferErrorCodes } from "../../index-
|
|
2
|
+
import { I as InferActions, K as SessionQueryParams, R as InferClientAPI, U as IsSignal, 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, PayvoAuthClientPlugin } from "@gatwech/core";
|
|
7
7
|
import { BASE_ERROR_CODES } from "@gatwech/core/error";
|