faire-auth 1.0.3 → 1.1.0
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/{adapter-factory-lKIOf2OR.mjs → adapter-factory-qPVW8x9-.mjs} +34 -36
- package/dist/{adapter-factory-D1I7joki.cjs → adapter-factory-u8r3oTez.cjs} +66 -68
- package/dist/adapters/drizzle-adapter/index.cjs +34 -40
- package/dist/adapters/drizzle-adapter/index.d.cts +4 -9
- package/dist/adapters/drizzle-adapter/index.d.mts +4 -9
- package/dist/adapters/drizzle-adapter/index.mjs +20 -26
- package/dist/adapters/index.cjs +11 -16
- package/dist/adapters/index.d.cts +11 -37
- package/dist/adapters/index.d.mts +11 -37
- package/dist/adapters/index.mjs +4 -13
- package/dist/adapters/kysely-adapter/index.cjs +270 -11
- package/dist/adapters/kysely-adapter/index.d.cts +9 -19
- package/dist/adapters/kysely-adapter/index.d.mts +9 -19
- package/dist/adapters/kysely-adapter/index.mjs +267 -9
- package/dist/adapters/memory-adapter/index.cjs +146 -9
- package/dist/adapters/memory-adapter/index.d.cts +4 -10
- package/dist/adapters/memory-adapter/index.d.mts +4 -10
- package/dist/adapters/memory-adapter/index.mjs +145 -9
- package/dist/adapters/mongodb-adapter/index.cjs +13 -21
- package/dist/adapters/mongodb-adapter/index.d.cts +3 -8
- package/dist/adapters/mongodb-adapter/index.d.mts +4 -9
- package/dist/adapters/mongodb-adapter/index.mjs +12 -20
- package/dist/adapters/prisma-adapter/index.cjs +12 -20
- package/dist/adapters/prisma-adapter/index.d.cts +4 -8
- package/dist/adapters/prisma-adapter/index.d.mts +4 -8
- package/dist/adapters/prisma-adapter/index.mjs +5 -13
- package/dist/adapters/test.cjs +86 -69
- package/dist/adapters/test.d.cts +7 -11
- package/dist/adapters/test.d.mts +7 -11
- package/dist/adapters/test.mjs +83 -66
- package/dist/api/index.cjs +3 -20
- package/dist/api/index.d.cts +2 -3
- package/dist/api/index.d.mts +2 -3
- package/dist/api/index.mjs +1 -20
- package/dist/api/middleware/index.cjs +4 -11
- package/dist/api/middleware/index.d.cts +3 -9
- package/dist/api/middleware/index.d.mts +3 -9
- package/dist/api/middleware/index.mjs +3 -11
- package/dist/{api-B4RDwBty.mjs → api-0f-F-Fi2.mjs} +292 -189
- package/dist/{api-CaRC1Gio.cjs → api-LjfH6hQi.cjs} +557 -452
- package/dist/{test-utils/bun-sqlite-dialect-BZBvHchL.cjs → bun-sqlite-dialect-BHkarnxN.cjs} +5 -9
- package/dist/{test-utils/bun-sqlite-dialect-BSWhhKNs.mjs → bun-sqlite-dialect-BiZBuEF6.mjs} +6 -9
- package/dist/client/index.cjs +8 -15
- package/dist/client/index.d.cts +9 -14
- package/dist/client/index.d.mts +9 -14
- package/dist/client/index.mjs +7 -15
- package/dist/client/lynx/index.cjs +10 -18
- package/dist/client/lynx/index.d.cts +402 -71
- package/dist/client/lynx/index.d.mts +402 -71
- package/dist/client/lynx/index.mjs +5 -13
- package/dist/client/plugins/index.cjs +3 -5
- package/dist/client/plugins/index.d.cts +5 -10
- package/dist/client/plugins/index.d.mts +5 -10
- package/dist/client/plugins/index.mjs +2 -4
- package/dist/client/react/index.cjs +6 -14
- package/dist/client/react/index.d.cts +402 -71
- package/dist/client/react/index.d.mts +402 -71
- package/dist/client/react/index.mjs +5 -13
- package/dist/client/solid/index.cjs +6 -14
- package/dist/client/solid/index.d.cts +393 -57
- package/dist/client/solid/index.d.mts +393 -57
- package/dist/client/solid/index.mjs +5 -13
- package/dist/client/svelte/index.cjs +5 -10
- package/dist/client/svelte/index.d.cts +400 -67
- package/dist/client/svelte/index.d.mts +400 -67
- package/dist/client/svelte/index.mjs +4 -10
- package/dist/client/vue/index.cjs +6 -14
- package/dist/client/vue/index.d.cts +401 -68
- package/dist/client/vue/index.d.mts +401 -68
- package/dist/client/vue/index.mjs +5 -13
- package/dist/{cookies-BTs1o992.mjs → cookies-D9aY_gJh.mjs} +25 -21
- package/dist/{cookies-BTl72THv.cjs → cookies-DQ52rcOy.cjs} +119 -115
- package/dist/crypto/index.cjs +10 -8
- package/dist/crypto/index.d.cts +5 -13
- package/dist/crypto/index.d.mts +5 -13
- package/dist/crypto/index.mjs +2 -5
- package/dist/{crypto-DH2Aa7jN.mjs → crypto-BH-hD0lJ.mjs} +7 -10
- package/dist/{crypto-DpSCnrTp.cjs → crypto-BITfWVwD.cjs} +24 -27
- package/dist/db/index.cjs +1135 -29
- package/dist/db/index.d.cts +1 -2
- package/dist/db/index.d.mts +1 -2
- package/dist/db/index.mjs +1115 -16
- package/dist/defu-D2h4S3X-.mjs +87 -0
- package/dist/defu-DWS5RPWt.cjs +134 -0
- package/dist/{email-verification-DI_0H4JC.cjs → email-verification-DOPnSgbI.cjs} +65 -71
- package/dist/{email-verification-C_lBu_JY.mjs → email-verification-YSR5n5lb.mjs} +23 -29
- package/dist/{hono-CO-zsqI-.mjs → hono-BAV2wQkK.mjs} +16 -33
- package/dist/hono-SVQuc5Ru.mjs +4 -0
- package/dist/hono-pgK4H_U1.cjs +9 -0
- package/dist/{hono-DnW5crl1.cjs → hono-tyFFJFdS.cjs} +42 -60
- package/dist/index-B86Cy0dE.d.cts +2 -0
- package/dist/index-B86Cy0dE.d.mts +2 -0
- package/dist/index.cjs +115 -150
- package/dist/index.d.cts +4 -5
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +46 -81
- package/dist/integrations/next-js.cjs +5 -9
- package/dist/integrations/next-js.d.cts +6 -14
- package/dist/integrations/next-js.d.mts +6 -14
- package/dist/integrations/next-js.mjs +4 -9
- package/dist/integrations/node.cjs +16 -14
- package/dist/integrations/node.d.cts +6 -14
- package/dist/integrations/node.d.mts +6 -14
- package/dist/integrations/node.mjs +15 -13
- package/dist/integrations/react-start.cjs +7 -11
- package/dist/integrations/react-start.d.cts +5 -13
- package/dist/integrations/react-start.d.mts +5 -13
- package/dist/integrations/react-start.mjs +6 -11
- package/dist/integrations/solid-start.cjs +3 -5
- package/dist/integrations/solid-start.d.cts +2 -5
- package/dist/integrations/solid-start.d.mts +2 -5
- package/dist/integrations/solid-start.mjs +2 -4
- package/dist/integrations/svelte-kit.cjs +6 -10
- package/dist/integrations/svelte-kit.d.cts +11 -23
- package/dist/integrations/svelte-kit.d.mts +11 -23
- package/dist/integrations/svelte-kit.mjs +5 -10
- package/dist/{ip-BjNYspCH.mjs → ip-6Lv2o42m.mjs} +4 -9
- package/dist/{ip-C17Qdq-G.cjs → ip-DPydExzV.cjs} +21 -27
- package/dist/{json--tl7Grvs.cjs → json-D3aq-nH2.cjs} +9 -13
- package/dist/{json-B1v2qRTQ.mjs → json-DooGMtnJ.mjs} +2 -5
- package/dist/{logged-CyGfp8_H.mjs → logged-B83SzMnJ.mjs} +6 -10
- package/dist/{logged-Dv3st5qc.cjs → logged-BIpCpnVY.cjs} +13 -18
- package/dist/{middleware-CE6OhDkq.mjs → middleware-Cakg4e1D.mjs} +2 -4
- package/dist/{middleware-CWvRH4EW.cjs → middleware-Cd-VkNxB.cjs} +17 -20
- package/dist/{node-sqlite-dialect-w4DAg0PH.mjs → node-sqlite-dialect-BMVOjEMh.mjs} +6 -9
- package/dist/{test-utils/node-sqlite-dialect-BgJqjBOu.cjs → node-sqlite-dialect-D3QPFROH.cjs} +5 -9
- package/dist/oauth2/index.cjs +166 -22
- package/dist/oauth2/index.d.cts +5 -17
- package/dist/oauth2/index.d.mts +5 -17
- package/dist/oauth2/index.mjs +156 -16
- package/dist/{origin-check-DjLTuZQ8.cjs → origin-check-BflGhEEN.cjs} +34 -38
- package/dist/{origin-check-8Gajklvh.mjs → origin-check-CRgs1M7k.mjs} +13 -16
- package/dist/{parser-B25ylT5u.mjs → parser-CqwvpF6l.cjs} +12 -10
- package/dist/{parser-B_wxvaAr.cjs → parser-DcKDjjHO.mjs} +7 -22
- package/dist/plugins/access/index.cjs +38 -4
- package/dist/plugins/access/index.d.cts +36 -2
- package/dist/plugins/access/index.d.mts +36 -2
- package/dist/plugins/access/index.mjs +36 -3
- package/dist/plugins/bearer/index.cjs +52 -7
- package/dist/plugins/bearer/index.d.cts +27 -4
- package/dist/plugins/bearer/index.d.mts +27 -4
- package/dist/plugins/bearer/index.mjs +51 -7
- package/dist/plugins/index.cjs +1385 -842
- package/dist/plugins/index.d.cts +489 -7566
- package/dist/plugins/index.d.mts +489 -7566
- package/dist/plugins/index.mjs +1118 -576
- package/dist/plugins/passkey/index.cjs +551 -15
- package/dist/plugins/passkey/index.d.cts +123 -4
- package/dist/plugins/passkey/index.d.mts +123 -4
- package/dist/plugins/passkey/index.mjs +547 -15
- package/dist/{chunk-BFnQceUY.mjs → rolldown-runtime-BKpuH2hG.mjs} +6 -7
- package/dist/{chunk-fPmz2rbM.cjs → rolldown-runtime-C_Pgydhf.cjs} +22 -24
- package/dist/{schema-DTIwLLmf.mjs → schema-CFCpv0tK.mjs} +3 -6
- package/dist/{schema-CirKflVs.cjs → schema-b-lKhMkG.cjs} +51 -55
- package/dist/{session-CM3rmOYF.mjs → session-BGjJgihS.mjs} +51 -74
- package/dist/{session-Cwrj4GfV.cjs → session-CzZSMmQC.cjs} +197 -219
- package/dist/shared.d.cts +1581 -0
- package/dist/shared.d.mts +1581 -0
- package/dist/social-providers/index.cjs +9 -9
- package/dist/social-providers/index.d.cts +1 -1
- package/dist/social-providers/index.d.mts +1 -1
- package/dist/social-providers/index.mjs +3 -5
- package/dist/social-providers-CjPww-qf.mjs +6 -0
- package/dist/social-providers-D7w_7Ym8.cjs +10 -0
- package/dist/{state-CvSihlVT.cjs → state-2OrNjOO-.cjs} +24 -24
- package/dist/{state-CQghgH9I.mjs → state-Dooeisfq.mjs} +17 -17
- package/dist/{bun-sqlite-dialect-DPgTzc0w.cjs → test-utils/bun-sqlite-dialect-BHkarnxN.cjs} +5 -9
- package/dist/{bun-sqlite-dialect-6NqeV3px.mjs → test-utils/bun-sqlite-dialect-BiZBuEF6.mjs} +6 -9
- package/dist/test-utils/index.cjs +8831 -7941
- package/dist/test-utils/index.d.cts +310 -12440
- package/dist/test-utils/index.d.mts +313 -12440
- package/dist/test-utils/index.mjs +8591 -7701
- package/dist/test-utils/{node-sqlite-dialect-DAQXiobH.mjs → node-sqlite-dialect-BMVOjEMh.mjs} +6 -9
- package/dist/{node-sqlite-dialect-DP11CB0y.cjs → test-utils/node-sqlite-dialect-D3QPFROH.cjs} +5 -9
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.mts +2 -3
- package/dist/types/index.mjs +1 -1
- package/dist/{url-BoUuoIwZ.mjs → url-CJtdrrUu.mjs} +12 -13
- package/dist/{url-Ce7CVaQD.cjs → url-DjCmCUHS.cjs} +42 -44
- package/dist/utils/cookies.cjs +29 -30
- package/dist/utils/cookies.d.cts +21 -25
- package/dist/utils/cookies.d.mts +20 -24
- package/dist/utils/cookies.mjs +2 -7
- package/dist/utils-C7OHyfHa.mjs +4 -0
- package/dist/utils-iX0Vy_UL.cjs +3 -0
- package/package.json +40 -30
- package/dist/access-BZ7-AbTM.cjs +0 -51
- package/dist/access-D0DRqUKC.mjs +0 -39
- package/dist/bearer-DDzrp5M7.cjs +0 -60
- package/dist/bearer-WZcs7gxL.mjs +0 -54
- package/dist/db-4tUsQJXd.mjs +0 -1119
- package/dist/db-ChMbb_U-.cjs +0 -1180
- package/dist/defu-BmOYq4PU.cjs +0 -34
- package/dist/defu-D9ZTXqlo.mjs +0 -28
- package/dist/hono-C14rpOEa.cjs +0 -13
- package/dist/hono-CoKYWnXA.mjs +0 -7
- package/dist/hono-D0VqxVy1.d.mts +0 -18
- package/dist/hono-DOM31WQz.d.cts +0 -18
- package/dist/index-BCTFWP_o.d.mts +0 -992
- package/dist/index-BDhhaE6Y.d.cts +0 -3
- package/dist/index-BVRfQy6L.d.mts +0 -992
- package/dist/index-Baarsq5J.d.mts +0 -33
- package/dist/index-By364WbF.d.cts +0 -992
- package/dist/index-BzWwMgxr.d.cts +0 -992
- package/dist/index-CF9iq55a.d.mts +0 -3
- package/dist/index-CJD2yB-W.d.cts +0 -33
- package/dist/index-CRt_fppq.d.mts +0 -41
- package/dist/index-CdLyn7qP.d.cts +0 -41
- package/dist/index-CsWF3f7U.d.cts +0 -13350
- package/dist/index-CzidsAyA.d.mts +0 -13350
- package/dist/index-DvW-GCcI.d.cts +0 -33
- package/dist/index-f-5OJ9yV.d.cts +0 -13350
- package/dist/index-rFv8Hxld.d.mts +0 -13350
- package/dist/index-ztVZPQdV.d.mts +0 -33
- package/dist/kysely-adapter-CtIdoHa8.mjs +0 -270
- package/dist/kysely-adapter-QZTx077T.cjs +0 -288
- package/dist/memory-adapter-17RZd5df.cjs +0 -154
- package/dist/memory-adapter-Dp4XdCZK.mjs +0 -148
- package/dist/oauth2-5RL4cVNS.cjs +0 -177
- package/dist/oauth2-C56wz-n9.mjs +0 -159
- package/dist/passkey-BTT-v5c-.cjs +0 -512
- package/dist/passkey-CzY_W2us.mjs +0 -505
- package/dist/request-1NL_1lyJ.mjs +0 -58
- package/dist/request-CPNlp-DK.cjs +0 -100
- package/dist/social-providers-B8RK5yqI.mjs +0 -9
- package/dist/social-providers-BmFOIIPk.cjs +0 -13
- package/dist/utils-44aDDP8f.cjs +0 -2
- package/dist/utils-D4vZd1-9.mjs +0 -4
package/dist/index.mjs
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import "./
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./
|
|
13
|
-
import { n as parseState, t as generateState } from "./state-CQghgH9I.mjs";
|
|
14
|
-
import { t as social_providers_exports } from "./social-providers-B8RK5yqI.mjs";
|
|
15
|
-
import { t as router } from "./api-B4RDwBty.mjs";
|
|
16
|
-
import { n as mergeHeaders } from "./request-1NL_1lyJ.mjs";
|
|
17
|
-
import { a as logger, i as generateRandomString, n as createLogger, r as generateId, t as ENV } from "./utils-D4vZd1-9.mjs";
|
|
18
|
-
import "./schema-DTIwLLmf.mjs";
|
|
19
|
-
import { r as getKyselyDatabaseType } from "./kysely-adapter-CtIdoHa8.mjs";
|
|
20
|
-
import { n as getAuthTables } from "./adapter-factory-lKIOf2OR.mjs";
|
|
21
|
-
import { a as createInternalAdapter, r as getAdapter, s as getMigrations } from "./db-4tUsQJXd.mjs";
|
|
22
|
-
import "./memory-adapter-Dp4XdCZK.mjs";
|
|
23
|
-
import { t as defu } from "./defu-D9ZTXqlo.mjs";
|
|
1
|
+
import { n as getCurrentAdapter } from "./ip-6Lv2o42m.mjs";
|
|
2
|
+
import { t as router } from "./api-0f-F-Fi2.mjs";
|
|
3
|
+
import { getKyselyDatabaseType } from "./adapters/kysely-adapter/index.mjs";
|
|
4
|
+
import { n as crypto_exports, t as checkPassword } from "./crypto-BH-hD0lJ.mjs";
|
|
5
|
+
import { n as parseState, t as generateState } from "./state-Dooeisfq.mjs";
|
|
6
|
+
import { createInternalAdapter, getAdapter, getMigrations } from "./db/index.mjs";
|
|
7
|
+
import { n as getAuthTables } from "./adapter-factory-qPVW8x9-.mjs";
|
|
8
|
+
import { t as social_providers_exports } from "./social-providers-CjPww-qf.mjs";
|
|
9
|
+
import { a as logger, i as generateRandomString, n as createLogger, r as generateId, t as ENV } from "./utils-C7OHyfHa.mjs";
|
|
10
|
+
import { i as createCookieCreator, l as getCookies } from "./cookies-D9aY_gJh.mjs";
|
|
11
|
+
import { r as mergeHeaders, t as defu } from "./defu-D2h4S3X-.mjs";
|
|
12
|
+
import { a as getTrustedOrigins, t as getBaseURL } from "./url-CJtdrrUu.mjs";
|
|
24
13
|
import { ENV as ENV$1, createLogger as createLogger$1, env, getBooleanEnvVar, getEnvVar, isDevelopment, isProduction, isTest, logger as logger$1 } from "@faire-auth/core/env";
|
|
25
14
|
import { APIError, BASE_ERROR_CODES, FaireAuthError, FaireAuthError as FaireAuthError$1, MissingDependencyError } from "@faire-auth/core/error";
|
|
26
15
|
import { DEFAULT_SECRET } from "@faire-auth/core/static";
|
|
27
16
|
import { hashToBase64 } from "@faire-auth/core/datatypes";
|
|
28
17
|
import { betterFetch } from "@better-fetch/fetch";
|
|
29
|
-
|
|
30
|
-
//#region src/context/cloudflare.ts
|
|
18
|
+
// src/context/cloudflare.ts
|
|
31
19
|
/**
|
|
32
20
|
* Symbol used as an index in the global scope to set and retrieve the Cloudflare context
|
|
33
21
|
*
|
|
@@ -42,9 +30,7 @@ const cloudflareContextSymbol = Symbol.for("__cloudflare-context__");
|
|
|
42
30
|
function getCloudflareContext() {
|
|
43
31
|
return globalThis[cloudflareContextSymbol];
|
|
44
32
|
}
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/telemetry/detectors/detect-auth-config.ts
|
|
33
|
+
// src/telemetry/detectors/detect-auth-config.ts
|
|
48
34
|
function getTelemetryAuthConfig(options, context) {
|
|
49
35
|
return {
|
|
50
36
|
database: context?.database,
|
|
@@ -230,9 +216,7 @@ function getTelemetryAuthConfig(options, context) {
|
|
|
230
216
|
}
|
|
231
217
|
};
|
|
232
218
|
}
|
|
233
|
-
|
|
234
|
-
//#endregion
|
|
235
|
-
//#region src/utils/package-json.ts
|
|
219
|
+
// src/utils/package-json.ts
|
|
236
220
|
let packageJSONCache;
|
|
237
221
|
async function readRootPackageJson() {
|
|
238
222
|
if (packageJSONCache) return packageJSONCache;
|
|
@@ -271,9 +255,7 @@ async function getVersionFromLocalPackageJson(pkg) {
|
|
|
271
255
|
async function getNameFromLocalPackageJson() {
|
|
272
256
|
return (await readRootPackageJson())?.name;
|
|
273
257
|
}
|
|
274
|
-
|
|
275
|
-
//#endregion
|
|
276
|
-
//#region src/telemetry/detectors/detect-database.ts
|
|
258
|
+
// src/telemetry/detectors/detect-database.ts
|
|
277
259
|
const DATABASES = {
|
|
278
260
|
pg: "postgresql",
|
|
279
261
|
mysql: "mysql",
|
|
@@ -294,9 +276,7 @@ async function detectDatabase() {
|
|
|
294
276
|
};
|
|
295
277
|
}
|
|
296
278
|
}
|
|
297
|
-
|
|
298
|
-
//#endregion
|
|
299
|
-
//#region src/telemetry/detectors/detect-framework.ts
|
|
279
|
+
// src/telemetry/detectors/detect-framework.ts
|
|
300
280
|
const FRAMEWORKS = {
|
|
301
281
|
next: "next",
|
|
302
282
|
nuxt: "nuxt",
|
|
@@ -319,9 +299,7 @@ async function detectFramework() {
|
|
|
319
299
|
};
|
|
320
300
|
}
|
|
321
301
|
}
|
|
322
|
-
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region src/telemetry/detectors/detect-project-info.ts
|
|
302
|
+
// src/telemetry/detectors/detect-project-info.ts
|
|
325
303
|
function detectPackageManager() {
|
|
326
304
|
const userAgent = process.env.npm_config_user_agent;
|
|
327
305
|
if (!userAgent) return;
|
|
@@ -333,9 +311,7 @@ function detectPackageManager() {
|
|
|
333
311
|
version: pmSpec.substring(separatorPos + 1)
|
|
334
312
|
};
|
|
335
313
|
}
|
|
336
|
-
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region src/telemetry/detectors/detect-system-info.ts
|
|
314
|
+
// src/telemetry/detectors/detect-system-info.ts
|
|
339
315
|
function getVendor() {
|
|
340
316
|
const hasAny = (...keys) => keys.some((k) => Boolean(env[k]));
|
|
341
317
|
if (hasAny("CF_PAGES", "CF_PAGES_URL", "CF_ACCOUNT_ID") || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers") return "cloudflare";
|
|
@@ -446,12 +422,10 @@ async function isInsideContainer() {
|
|
|
446
422
|
if (isInsideContainerCached === void 0) isInsideContainerCached = await hasContainerEnv() || await isDocker();
|
|
447
423
|
return isInsideContainerCached;
|
|
448
424
|
}
|
|
449
|
-
function isCI
|
|
425
|
+
function isCI() {
|
|
450
426
|
return env.CI !== "false" && ("BUILD_ID" in env || "BUILD_NUMBER" in env || "CI" in env || "CI_APP_ID" in env || "CI_BUILD_ID" in env || "CI_BUILD_NUMBER" in env || "CI_NAME" in env || "CONTINUOUS_INTEGRATION" in env || "RUN_ID" in env);
|
|
451
427
|
}
|
|
452
|
-
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/telemetry/detectors/detect-runtime.ts
|
|
428
|
+
// src/telemetry/detectors/detect-runtime.ts
|
|
455
429
|
function detectRuntime() {
|
|
456
430
|
if (typeof Deno !== "undefined") return {
|
|
457
431
|
name: "deno",
|
|
@@ -471,11 +445,9 @@ function detectRuntime() {
|
|
|
471
445
|
};
|
|
472
446
|
}
|
|
473
447
|
function detectEnvironment() {
|
|
474
|
-
return getEnvVar("NODE_ENV") === "production" ? "production" : isCI
|
|
448
|
+
return getEnvVar("NODE_ENV") === "production" ? "production" : isCI() ? "ci" : isTest() ? "test" : "development";
|
|
475
449
|
}
|
|
476
|
-
|
|
477
|
-
//#endregion
|
|
478
|
-
//#region src/telemetry/project-id.ts
|
|
450
|
+
// src/telemetry/project-id.ts
|
|
479
451
|
let projectIdCached = null;
|
|
480
452
|
async function getProjectId(baseUrl) {
|
|
481
453
|
if (projectIdCached) return projectIdCached;
|
|
@@ -491,9 +463,7 @@ async function getProjectId(baseUrl) {
|
|
|
491
463
|
projectIdCached = generateId(32);
|
|
492
464
|
return projectIdCached;
|
|
493
465
|
}
|
|
494
|
-
|
|
495
|
-
//#endregion
|
|
496
|
-
//#region src/telemetry/index.ts
|
|
466
|
+
// src/telemetry/index.ts
|
|
497
467
|
function createTelemetry(options, context) {
|
|
498
468
|
const debugEnabled = options.telemetry?.debug || getBooleanEnvVar("FAIRE_AUTH_TELEMETRY_DEBUG", false);
|
|
499
469
|
const TELEMETRY_ENDPOINT = ENV$1.FAIRE_AUTH_TELEMETRY_ENDPOINT;
|
|
@@ -516,7 +486,7 @@ function createTelemetry(options, context) {
|
|
|
516
486
|
let payload;
|
|
517
487
|
const enabled = isEnabled();
|
|
518
488
|
async function ensureInitialized() {
|
|
519
|
-
if (initDone) return initDone;
|
|
489
|
+
if (initDone !== void 0) return initDone;
|
|
520
490
|
initDone = (async () => {
|
|
521
491
|
anonymousId = await getProjectId(options.baseURL);
|
|
522
492
|
payload = {
|
|
@@ -548,18 +518,16 @@ function createTelemetry(options, context) {
|
|
|
548
518
|
}
|
|
549
519
|
};
|
|
550
520
|
}
|
|
551
|
-
|
|
552
|
-
//#endregion
|
|
553
|
-
//#region src/init.ts
|
|
521
|
+
// src/init.ts
|
|
554
522
|
const getInternalPlugins = (options) => {
|
|
555
523
|
const plugins = [];
|
|
556
524
|
if (options.advanced?.crossSubDomainCookies?.enabled === true) {}
|
|
557
525
|
return plugins;
|
|
558
526
|
};
|
|
559
|
-
const loadSecret = (options, logger
|
|
527
|
+
const loadSecret = (options, logger) => {
|
|
560
528
|
const secret = options.secret ?? env["FAIRE_AUTH_SECRET"] ?? env["AUTH_SECRET"] ?? DEFAULT_SECRET;
|
|
561
529
|
if (secret === DEFAULT_SECRET) {
|
|
562
|
-
if (isProduction()) logger
|
|
530
|
+
if (isProduction()) logger.error("You are using the default secret. Please set `FAIRE_AUTH_SECRET` in your environment variables or pass `secret` in your auth config.");
|
|
563
531
|
}
|
|
564
532
|
return secret;
|
|
565
533
|
};
|
|
@@ -570,7 +538,7 @@ const runPluginInit = (ctx, options) => {
|
|
|
570
538
|
const result = plugin.init(context);
|
|
571
539
|
if (typeof result === "object") {
|
|
572
540
|
if (result.options) {
|
|
573
|
-
const { databaseHooks
|
|
541
|
+
const { databaseHooks, ...restOpts } = result.options;
|
|
574
542
|
if (result.options.databaseHooks) dbHooks.push(result.options.databaseHooks);
|
|
575
543
|
options = defu(options, restOpts);
|
|
576
544
|
}
|
|
@@ -599,14 +567,14 @@ const init = (options) => {
|
|
|
599
567
|
if (baseURL == null && !isDevelopment() && !isTest()) throw new Error("baseURL is required for auth context");
|
|
600
568
|
const adapter = getAdapter(options);
|
|
601
569
|
const internalPlugins = getInternalPlugins(options);
|
|
602
|
-
const logger
|
|
603
|
-
const secret = loadSecret(options, logger
|
|
604
|
-
const generateId
|
|
570
|
+
const logger = createLogger$1(options.logger);
|
|
571
|
+
const secret = loadSecret(options, logger);
|
|
572
|
+
const generateId = initGenerateId(options);
|
|
605
573
|
const secondaryStorage = options.secondaryStorage;
|
|
606
574
|
const sessionConfig = {
|
|
607
|
-
updateAge: options.session?.updateAge ??
|
|
608
|
-
expiresIn: options.session?.expiresIn ??
|
|
609
|
-
freshAge: options.session?.freshAge ??
|
|
575
|
+
updateAge: options.session?.updateAge ?? 86400,
|
|
576
|
+
expiresIn: options.session?.expiresIn ?? 604800,
|
|
577
|
+
freshAge: options.session?.freshAge ?? 86400,
|
|
610
578
|
cookieRefreshCache: (() => {
|
|
611
579
|
const refreshCache = options.session?.cookieCache?.refreshCache;
|
|
612
580
|
const maxAge = options.session?.cookieCache?.maxAge ?? 300;
|
|
@@ -633,12 +601,12 @@ const init = (options) => {
|
|
|
633
601
|
options.basePath ??= "/api/auth";
|
|
634
602
|
options.plugins ??= [];
|
|
635
603
|
options.plugins.push(...internalPlugins);
|
|
636
|
-
|
|
604
|
+
const context = {
|
|
637
605
|
appName: options.appName ?? "Faire Auth",
|
|
638
606
|
socialProviders: Object.entries(options.socialProviders ?? {}).map(([key, value]) => {
|
|
639
607
|
if (value == null) return null;
|
|
640
608
|
if (value.enabled === false) return null;
|
|
641
|
-
if (!value.clientId) logger
|
|
609
|
+
if (!value.clientId) logger.warn(`Social provider ${key} is missing clientId or clientSecret`);
|
|
642
610
|
if (!(key in social_providers_exports.socialProviders)) throw new Error(`${key} does not exist in known social providers`);
|
|
643
611
|
const provider = social_providers_exports.socialProviders[key](value);
|
|
644
612
|
if (value.disableImplicitSignUp) provider.disableImplicitSignUp = value.disableImplicitSignUp;
|
|
@@ -650,9 +618,9 @@ const init = (options) => {
|
|
|
650
618
|
sessionConfig,
|
|
651
619
|
secret,
|
|
652
620
|
authCookies: getCookies(options),
|
|
653
|
-
logger
|
|
621
|
+
logger,
|
|
654
622
|
rateLimit,
|
|
655
|
-
generateId
|
|
623
|
+
generateId,
|
|
656
624
|
password: {
|
|
657
625
|
hash: options.emailAndPassword?.password?.hash ?? crypto_exports.hashPassword,
|
|
658
626
|
verify: options.emailAndPassword?.password?.verify ?? crypto_exports.verifyPassword,
|
|
@@ -665,8 +633,8 @@ const init = (options) => {
|
|
|
665
633
|
newSession: null,
|
|
666
634
|
adapter,
|
|
667
635
|
internalAdapter: createInternalAdapter(adapter, options, {
|
|
668
|
-
logger
|
|
669
|
-
generateId
|
|
636
|
+
logger,
|
|
637
|
+
generateId,
|
|
670
638
|
sessionConfig,
|
|
671
639
|
...secondaryStorage && { secondaryStorage }
|
|
672
640
|
}, options.databaseHooks ? [options.databaseHooks] : []),
|
|
@@ -681,11 +649,10 @@ const init = (options) => {
|
|
|
681
649
|
database: typeof options.database === "function" ? "adapter" : getKyselyDatabaseType(options.database) || "unknown"
|
|
682
650
|
}).publish,
|
|
683
651
|
...secondaryStorage && { secondaryStorage }
|
|
684
|
-
}
|
|
652
|
+
};
|
|
653
|
+
return runPluginInit(context, options);
|
|
685
654
|
};
|
|
686
|
-
|
|
687
|
-
//#endregion
|
|
688
|
-
//#region src/auth.ts
|
|
655
|
+
// src/auth.ts
|
|
689
656
|
function defineOptions(config) {
|
|
690
657
|
return config;
|
|
691
658
|
}
|
|
@@ -695,7 +662,7 @@ const faireAuth = (options) => {
|
|
|
695
662
|
return {
|
|
696
663
|
handler: (request, Env, executionCtx) => {
|
|
697
664
|
const cfCtx = getCloudflareContext();
|
|
698
|
-
return app.fetch(request,
|
|
665
|
+
return app.fetch(request, Env ?? cfCtx?.env ?? ENV$1, executionCtx ?? cfCtx?.ctx);
|
|
699
666
|
},
|
|
700
667
|
app,
|
|
701
668
|
api,
|
|
@@ -717,6 +684,4 @@ const faireAuth = (options) => {
|
|
|
717
684
|
}
|
|
718
685
|
};
|
|
719
686
|
};
|
|
720
|
-
|
|
721
|
-
//#endregion
|
|
722
|
-
export { APIError, ENV, FaireAuthError, MissingDependencyError, createLogger, createTelemetry, defineOptions, faireAuth, generateId, generateRandomString, generateState, getCurrentAdapter, getTelemetryAuthConfig, logger, mergeHeaders, parseState };
|
|
687
|
+
export { APIError, ENV, FaireAuthError, MissingDependencyError, createLogger, createTelemetry, defineOptions, faireAuth, generateId, generateRandomString, generateState, getCurrentAdapter, getTelemetryAuthConfig, logger, mergeHeaders, parseState };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
require(
|
|
3
|
-
const require_cookies = require(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//#region src/integrations/next-js.ts
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_middleware = require("../middleware-Cd-VkNxB.cjs");
|
|
3
|
+
const require_cookies = require("../cookies-DQ52rcOy.cjs");
|
|
4
|
+
// src/integrations/next-js.ts
|
|
7
5
|
function toNextJsHandler(auth) {
|
|
8
6
|
const handler = async (request) => "handler" in auth ? auth.handler(request) : auth(request);
|
|
9
7
|
return {
|
|
@@ -44,7 +42,5 @@ const nextCookies = () => ({
|
|
|
44
42
|
})
|
|
45
43
|
}] }
|
|
46
44
|
});
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
45
|
exports.nextCookies = nextCookies;
|
|
50
|
-
exports.toNextJsHandler = toNextJsHandler;
|
|
46
|
+
exports.toNextJsHandler = toNextJsHandler;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as ContextVars } from "../hono-DOM31WQz.cjs";
|
|
3
|
-
import * as _faire_auth_core_types31 from "@faire-auth/core/types";
|
|
4
|
-
import * as hono31 from "hono";
|
|
5
|
-
|
|
6
|
-
//#region src/integrations/next-js.d.ts
|
|
7
|
-
declare function toNextJsHandler(auth: {
|
|
1
|
+
export declare function toNextJsHandler(auth: {
|
|
8
2
|
handler: (request: Request) => Promise<Response>;
|
|
9
3
|
} | ((request: Request) => Promise<Response>)): {
|
|
10
4
|
GET: (request: Request) => Promise<Response>;
|
|
11
5
|
POST: (request: Request) => Promise<Response>;
|
|
12
6
|
};
|
|
13
|
-
declare const nextCookies: () => {
|
|
14
|
-
id:
|
|
7
|
+
export declare const nextCookies: () => {
|
|
8
|
+
id: string;
|
|
15
9
|
hooks: {
|
|
16
10
|
after: {
|
|
17
|
-
matcher: (_ctx:
|
|
18
|
-
handler: (_authOptions:
|
|
11
|
+
matcher: (_ctx: any) => boolean;
|
|
12
|
+
handler: (_authOptions: any) => (ctx: any) => Promise<void>;
|
|
19
13
|
}[];
|
|
20
14
|
};
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { nextCookies, toNextJsHandler };
|
|
15
|
+
};
|
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as ContextVars } from "../hono-D0VqxVy1.mjs";
|
|
3
|
-
import * as hono0 from "hono";
|
|
4
|
-
import * as _faire_auth_core_types0 from "@faire-auth/core/types";
|
|
5
|
-
|
|
6
|
-
//#region src/integrations/next-js.d.ts
|
|
7
|
-
declare function toNextJsHandler(auth: {
|
|
1
|
+
export declare function toNextJsHandler(auth: {
|
|
8
2
|
handler: (request: Request) => Promise<Response>;
|
|
9
3
|
} | ((request: Request) => Promise<Response>)): {
|
|
10
4
|
GET: (request: Request) => Promise<Response>;
|
|
11
5
|
POST: (request: Request) => Promise<Response>;
|
|
12
6
|
};
|
|
13
|
-
declare const nextCookies: () => {
|
|
14
|
-
id:
|
|
7
|
+
export declare const nextCookies: () => {
|
|
8
|
+
id: string;
|
|
15
9
|
hooks: {
|
|
16
10
|
after: {
|
|
17
|
-
matcher: (_ctx:
|
|
18
|
-
handler: (_authOptions:
|
|
11
|
+
matcher: (_ctx: any) => boolean;
|
|
12
|
+
handler: (_authOptions: any) => (ctx: any) => Promise<void>;
|
|
19
13
|
}[];
|
|
20
14
|
};
|
|
21
|
-
};
|
|
22
|
-
//#endregion
|
|
23
|
-
export { nextCookies, toNextJsHandler };
|
|
15
|
+
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../
|
|
3
|
-
|
|
4
|
-
import { n as createHook } from "../middleware-CE6OhDkq.mjs";
|
|
5
|
-
|
|
6
|
-
//#region src/integrations/next-js.ts
|
|
1
|
+
import { n as createHook } from "../middleware-Cakg4e1D.mjs";
|
|
2
|
+
import { p as parseSetCookieHeader } from "../cookies-D9aY_gJh.mjs";
|
|
3
|
+
// src/integrations/next-js.ts
|
|
7
4
|
function toNextJsHandler(auth) {
|
|
8
5
|
const handler = async (request) => "handler" in auth ? auth.handler(request) : auth(request);
|
|
9
6
|
return {
|
|
@@ -44,6 +41,4 @@ const nextCookies = () => ({
|
|
|
44
41
|
})
|
|
45
42
|
}] }
|
|
46
43
|
});
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
export { nextCookies, toNextJsHandler };
|
|
44
|
+
export { nextCookies, toNextJsHandler };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/integrations/node.ts
|
|
3
3
|
function get_raw_body(req, body_size_limit) {
|
|
4
4
|
const h = req.headers;
|
|
5
5
|
if (!h["content-type"]) return null;
|
|
@@ -54,13 +54,15 @@ function getRequest({ request, base, bodySizeLimit }) {
|
|
|
54
54
|
const maybeConsumedReq = request;
|
|
55
55
|
let body = void 0;
|
|
56
56
|
const method = request.method;
|
|
57
|
-
if (method !== "GET" && method !== "HEAD")
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
58
|
+
if (maybeConsumedReq.body !== void 0) {
|
|
59
|
+
const bodyContent = typeof maybeConsumedReq.body === "string" ? maybeConsumedReq.body : JSON.stringify(maybeConsumedReq.body);
|
|
60
|
+
body = new ReadableStream({ start(controller) {
|
|
61
|
+
controller.enqueue(new TextEncoder().encode(bodyContent));
|
|
62
|
+
controller.close();
|
|
63
|
+
} });
|
|
64
|
+
} else body = get_raw_body(request, bodySizeLimit);
|
|
65
|
+
}
|
|
64
66
|
return new Request(base + fullPath, {
|
|
65
67
|
duplex: "half",
|
|
66
68
|
method: request.method,
|
|
@@ -126,14 +128,14 @@ function toNode(handler) {
|
|
|
126
128
|
const toNodeHandler = (auth) => "handler" in auth ? toNode(auth.handler) : toNode(auth);
|
|
127
129
|
function fromNodeHeaders(nodeHeaders) {
|
|
128
130
|
const webHeaders = new Headers();
|
|
129
|
-
for (const [key, value] of Object.entries(nodeHeaders)) if (value !== void 0)
|
|
130
|
-
|
|
131
|
+
for (const [key, value] of Object.entries(nodeHeaders)) if (value !== void 0) {
|
|
132
|
+
if (Array.isArray(value)) value.forEach((v) => webHeaders.append(key, v));
|
|
133
|
+
else webHeaders.set(key, value);
|
|
134
|
+
}
|
|
131
135
|
return webHeaders;
|
|
132
136
|
}
|
|
133
|
-
|
|
134
|
-
//#endregion
|
|
135
137
|
exports.fromNodeHeaders = fromNodeHeaders;
|
|
136
138
|
exports.getRequest = getRequest;
|
|
137
139
|
exports.setResponse = setResponse;
|
|
138
140
|
exports.toNode = toNode;
|
|
139
|
-
exports.toNodeHandler = toNodeHandler;
|
|
141
|
+
exports.toNodeHandler = toNodeHandler;
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../hono-DOM31WQz.cjs";
|
|
1
|
+
import { b as Auth } from "../shared.cjs";
|
|
3
2
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "node:http";
|
|
4
|
-
|
|
5
|
-
//#region src/integrations/node.d.ts
|
|
6
|
-
declare function getRequest({
|
|
7
|
-
request,
|
|
8
|
-
base,
|
|
9
|
-
bodySizeLimit
|
|
10
|
-
}: {
|
|
3
|
+
declare function getRequest({ request, base, bodySizeLimit }: {
|
|
11
4
|
base: string;
|
|
12
5
|
bodySizeLimit?: number;
|
|
13
6
|
request: IncomingMessage;
|
|
14
7
|
}): Request;
|
|
15
8
|
declare function setResponse(res: ServerResponse, response: Response): Promise<void>;
|
|
16
|
-
declare function toNode(handler: Auth["handler"]): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
17
|
-
declare const toNodeHandler: (auth: {
|
|
9
|
+
export declare function toNode(handler: Auth["handler"]): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
10
|
+
export declare const toNodeHandler: (auth: {
|
|
18
11
|
handler: Auth["handler"];
|
|
19
12
|
} | Auth["handler"]) => (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
20
|
-
declare function fromNodeHeaders(nodeHeaders: IncomingHttpHeaders): Headers;
|
|
21
|
-
|
|
22
|
-
export { fromNodeHeaders, getRequest, setResponse, toNode, toNodeHandler };
|
|
13
|
+
export declare function fromNodeHeaders(nodeHeaders: IncomingHttpHeaders): Headers;
|
|
14
|
+
export { getRequest, setResponse };
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../hono-D0VqxVy1.mjs";
|
|
1
|
+
import { M as Auth } from "../shared.mjs";
|
|
3
2
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from "node:http";
|
|
4
|
-
|
|
5
|
-
//#region src/integrations/node.d.ts
|
|
6
|
-
declare function getRequest({
|
|
7
|
-
request,
|
|
8
|
-
base,
|
|
9
|
-
bodySizeLimit
|
|
10
|
-
}: {
|
|
3
|
+
declare function getRequest({ request, base, bodySizeLimit }: {
|
|
11
4
|
base: string;
|
|
12
5
|
bodySizeLimit?: number;
|
|
13
6
|
request: IncomingMessage;
|
|
14
7
|
}): Request;
|
|
15
8
|
declare function setResponse(res: ServerResponse, response: Response): Promise<void>;
|
|
16
|
-
declare function toNode(handler: Auth["handler"]): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
17
|
-
declare const toNodeHandler: (auth: {
|
|
9
|
+
export declare function toNode(handler: Auth["handler"]): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
10
|
+
export declare const toNodeHandler: (auth: {
|
|
18
11
|
handler: Auth["handler"];
|
|
19
12
|
} | Auth["handler"]) => (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
20
|
-
declare function fromNodeHeaders(nodeHeaders: IncomingHttpHeaders): Headers;
|
|
21
|
-
|
|
22
|
-
export { fromNodeHeaders, getRequest, setResponse, toNode, toNodeHandler };
|
|
13
|
+
export declare function fromNodeHeaders(nodeHeaders: IncomingHttpHeaders): Headers;
|
|
14
|
+
export { getRequest, setResponse };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/integrations/node.ts
|
|
2
2
|
function get_raw_body(req, body_size_limit) {
|
|
3
3
|
const h = req.headers;
|
|
4
4
|
if (!h["content-type"]) return null;
|
|
@@ -53,13 +53,15 @@ function getRequest({ request, base, bodySizeLimit }) {
|
|
|
53
53
|
const maybeConsumedReq = request;
|
|
54
54
|
let body = void 0;
|
|
55
55
|
const method = request.method;
|
|
56
|
-
if (method !== "GET" && method !== "HEAD")
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
57
|
+
if (maybeConsumedReq.body !== void 0) {
|
|
58
|
+
const bodyContent = typeof maybeConsumedReq.body === "string" ? maybeConsumedReq.body : JSON.stringify(maybeConsumedReq.body);
|
|
59
|
+
body = new ReadableStream({ start(controller) {
|
|
60
|
+
controller.enqueue(new TextEncoder().encode(bodyContent));
|
|
61
|
+
controller.close();
|
|
62
|
+
} });
|
|
63
|
+
} else body = get_raw_body(request, bodySizeLimit);
|
|
64
|
+
}
|
|
63
65
|
return new Request(base + fullPath, {
|
|
64
66
|
duplex: "half",
|
|
65
67
|
method: request.method,
|
|
@@ -125,10 +127,10 @@ function toNode(handler) {
|
|
|
125
127
|
const toNodeHandler = (auth) => "handler" in auth ? toNode(auth.handler) : toNode(auth);
|
|
126
128
|
function fromNodeHeaders(nodeHeaders) {
|
|
127
129
|
const webHeaders = new Headers();
|
|
128
|
-
for (const [key, value] of Object.entries(nodeHeaders)) if (value !== void 0)
|
|
129
|
-
|
|
130
|
+
for (const [key, value] of Object.entries(nodeHeaders)) if (value !== void 0) {
|
|
131
|
+
if (Array.isArray(value)) value.forEach((v) => webHeaders.append(key, v));
|
|
132
|
+
else webHeaders.set(key, value);
|
|
133
|
+
}
|
|
130
134
|
return webHeaders;
|
|
131
135
|
}
|
|
132
|
-
|
|
133
|
-
//#endregion
|
|
134
|
-
export { fromNodeHeaders, getRequest, setResponse, toNode, toNodeHandler };
|
|
136
|
+
export { fromNodeHeaders, getRequest, setResponse, toNode, toNodeHandler };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
require(
|
|
3
|
-
const require_cookies = require(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//#region src/integrations/react-start.ts
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_middleware = require("../middleware-Cd-VkNxB.cjs");
|
|
3
|
+
const require_cookies = require("../cookies-DQ52rcOy.cjs");
|
|
4
|
+
// src/integrations/react-start.ts
|
|
7
5
|
const reactStartCookies = () => {
|
|
8
6
|
return {
|
|
9
7
|
id: "react-start-cookies",
|
|
@@ -16,14 +14,14 @@ const reactStartCookies = () => {
|
|
|
16
14
|
const { setCookie } = await import("@tanstack/start-server-core");
|
|
17
15
|
parsed.forEach((value, key) => {
|
|
18
16
|
if (!key) return;
|
|
19
|
-
const opts = {
|
|
17
|
+
const opts = Object.fromEntries(Object.entries({
|
|
20
18
|
sameSite: value.samesite,
|
|
21
19
|
secure: value.secure,
|
|
22
20
|
maxAge: value["max-age"],
|
|
23
21
|
httpOnly: value.httponly,
|
|
24
22
|
domain: value.domain,
|
|
25
23
|
path: value.path
|
|
26
|
-
};
|
|
24
|
+
}).filter(([, v]) => v !== void 0));
|
|
27
25
|
try {
|
|
28
26
|
setCookie(key, decodeURIComponent(value.value), opts);
|
|
29
27
|
} catch (e) {}
|
|
@@ -32,6 +30,4 @@ const reactStartCookies = () => {
|
|
|
32
30
|
}] }
|
|
33
31
|
};
|
|
34
32
|
};
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
|
-
exports.reactStartCookies = reactStartCookies;
|
|
33
|
+
exports.reactStartCookies = reactStartCookies;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as _faire_auth_core_types29 from "@faire-auth/core/types";
|
|
4
|
-
import * as hono29 from "hono";
|
|
5
|
-
|
|
6
|
-
//#region src/integrations/react-start.d.ts
|
|
7
|
-
declare const reactStartCookies: () => {
|
|
8
|
-
id: "react-start-cookies";
|
|
1
|
+
export declare const reactStartCookies: () => {
|
|
2
|
+
id: string;
|
|
9
3
|
hooks: {
|
|
10
4
|
after: {
|
|
11
|
-
matcher: (_ctx:
|
|
12
|
-
handler: (_authOptions:
|
|
5
|
+
matcher: (_ctx: any) => boolean;
|
|
6
|
+
handler: (_authOptions: any) => (ctx: any) => Promise<void>;
|
|
13
7
|
}[];
|
|
14
8
|
};
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { reactStartCookies };
|
|
9
|
+
};
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as hono19 from "hono";
|
|
4
|
-
import * as _faire_auth_core_types10 from "@faire-auth/core/types";
|
|
5
|
-
|
|
6
|
-
//#region src/integrations/react-start.d.ts
|
|
7
|
-
declare const reactStartCookies: () => {
|
|
8
|
-
id: "react-start-cookies";
|
|
1
|
+
export declare const reactStartCookies: () => {
|
|
2
|
+
id: string;
|
|
9
3
|
hooks: {
|
|
10
4
|
after: {
|
|
11
|
-
matcher: (_ctx:
|
|
12
|
-
handler: (_authOptions:
|
|
5
|
+
matcher: (_ctx: any) => boolean;
|
|
6
|
+
handler: (_authOptions: any) => (ctx: any) => Promise<void>;
|
|
13
7
|
}[];
|
|
14
8
|
};
|
|
15
|
-
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { reactStartCookies };
|
|
9
|
+
};
|