@neondatabase/auth 0.1.0-beta.19 → 0.1.0-beta.20
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-core-CiZ94eSH.d.mts → adapter-core-23fYTUxT.d.mts} +113 -113
- package/dist/{adapter-core-J65ZBFCQ.mjs → adapter-core-8s6XdCco.mjs} +95 -2
- package/dist/{better-auth-react-adapter-D0YDUhsP.mjs → better-auth-react-adapter-D9tIaEyQ.mjs} +10 -3
- package/dist/{supabase-adapter-Czd-BqPV.d.mts → better-auth-react-adapter-QFe5RtaM.d.mts} +305 -389
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/{neon-auth-D5blqfx_.mjs → neon-auth-2f58U8_-.mjs} +4 -2
- package/dist/{neon-auth-CjtW9yrE.d.mts → neon-auth-CDYpC_O1.d.mts} +8 -6
- package/dist/next/index.mjs +3 -3
- package/dist/next/server/index.d.mts +4 -4
- package/dist/react/adapters/index.d.mts +3 -3
- package/dist/react/adapters/index.mjs +2 -2
- package/dist/react/index.d.mts +3 -3
- package/dist/react/index.mjs +2 -2
- package/dist/{supabase-adapter-VEBuV-CR.mjs → supabase-adapter-BYMJSxOT.mjs} +19 -5
- package/dist/{better-auth-react-adapter-f7gIfbP8.d.mts → supabase-adapter-Dr-pKvPt.d.mts} +145 -55
- package/dist/types/index.d.mts +1 -1
- package/dist/vanilla/adapters/index.d.mts +2 -2
- package/dist/vanilla/adapters/index.mjs +2 -2
- package/dist/vanilla/index.d.mts +2 -2
- package/dist/vanilla/index.mjs +2 -2
- package/package.json +5 -4
|
@@ -626,6 +626,96 @@ function initBroadcastChannel() {
|
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region package.json
|
|
631
|
+
var name = "@neondatabase/auth";
|
|
632
|
+
var version = "0.1.0-beta.19";
|
|
633
|
+
|
|
634
|
+
//#endregion
|
|
635
|
+
//#region ../internal/dist/index.mjs
|
|
636
|
+
const X_NEON_CLIENT_INFO_HEADER = "X-Neon-Client-Info";
|
|
637
|
+
/**
|
|
638
|
+
* Type guard for checking if a property exists on globalThis
|
|
639
|
+
*/
|
|
640
|
+
function hasGlobalProperty(key) {
|
|
641
|
+
return key in globalThis;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Detects the JavaScript framework being used at runtime.
|
|
645
|
+
* Detection order matters to avoid false positives (e.g., Next.js includes React).
|
|
646
|
+
*/
|
|
647
|
+
function detectFramework() {
|
|
648
|
+
if (typeof process !== "undefined" && process.env && (process.env.NEXT_RUNTIME || process.env.__NEXT_PRIVATE_ORIGIN)) return "next";
|
|
649
|
+
if (typeof globalThis.window !== "undefined") {
|
|
650
|
+
if (hasGlobalProperty("__NEXT_DATA__")) return "next";
|
|
651
|
+
if (hasGlobalProperty("__remixContext")) return "remix";
|
|
652
|
+
if (hasGlobalProperty("__REACT_DEVTOOLS_GLOBAL_HOOK__")) return "react";
|
|
653
|
+
if (hasGlobalProperty("__VUE__")) return "vue";
|
|
654
|
+
if (hasGlobalProperty("Zone")) return "angular";
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
function getClientInfo(sdkName, sdkVersion) {
|
|
658
|
+
const base = {
|
|
659
|
+
sdk: sdkName,
|
|
660
|
+
version: sdkVersion,
|
|
661
|
+
runtime: "unknown",
|
|
662
|
+
runtimeVersion: "unknown",
|
|
663
|
+
platform: "unknown",
|
|
664
|
+
arch: "unknown"
|
|
665
|
+
};
|
|
666
|
+
let result;
|
|
667
|
+
if (typeof process !== "undefined" && process.versions?.node) result = {
|
|
668
|
+
...base,
|
|
669
|
+
runtime: "node",
|
|
670
|
+
runtimeVersion: process.versions.node,
|
|
671
|
+
platform: process.platform,
|
|
672
|
+
arch: process.arch
|
|
673
|
+
};
|
|
674
|
+
else if (typeof Deno !== "undefined") result = {
|
|
675
|
+
...base,
|
|
676
|
+
runtime: "deno",
|
|
677
|
+
runtimeVersion: Deno.version?.deno ?? "unknown",
|
|
678
|
+
platform: Deno.build?.os ?? "unknown",
|
|
679
|
+
arch: Deno.build?.arch ?? "unknown"
|
|
680
|
+
};
|
|
681
|
+
else if (typeof Bun !== "undefined") result = {
|
|
682
|
+
...base,
|
|
683
|
+
runtime: "bun",
|
|
684
|
+
runtimeVersion: Bun.version ?? "unknown",
|
|
685
|
+
platform: process?.platform ?? "unknown",
|
|
686
|
+
arch: process?.arch ?? "unknown"
|
|
687
|
+
};
|
|
688
|
+
else if (typeof EdgeRuntime !== "undefined" || typeof process !== "undefined" && !process.versions?.node && typeof globalThis.window === "undefined" && typeof document === "undefined") result = {
|
|
689
|
+
...base,
|
|
690
|
+
runtime: "edge"
|
|
691
|
+
};
|
|
692
|
+
else if (globalThis.window !== void 0 && typeof document !== "undefined") result = {
|
|
693
|
+
...base,
|
|
694
|
+
runtime: "browser",
|
|
695
|
+
runtimeVersion: "unknown",
|
|
696
|
+
platform: "web",
|
|
697
|
+
arch: "unknown"
|
|
698
|
+
};
|
|
699
|
+
else result = base;
|
|
700
|
+
const framework = detectFramework();
|
|
701
|
+
if (framework) result.framework = framework;
|
|
702
|
+
return result;
|
|
703
|
+
}
|
|
704
|
+
function createClientInfoInjector(defaultSdkName, defaultSdkVersion) {
|
|
705
|
+
const cachedClientInfo = JSON.stringify(getClientInfo(defaultSdkName, defaultSdkVersion));
|
|
706
|
+
return function injectClientInfo$1(headers, sdkOverride) {
|
|
707
|
+
const result = new Headers(headers);
|
|
708
|
+
if (result.has(X_NEON_CLIENT_INFO_HEADER)) return result;
|
|
709
|
+
const clientInfoString = sdkOverride ? JSON.stringify(getClientInfo(sdkOverride.name, sdkOverride.version)) : cachedClientInfo;
|
|
710
|
+
result.set(X_NEON_CLIENT_INFO_HEADER, clientInfoString);
|
|
711
|
+
return result;
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
//#endregion
|
|
716
|
+
//#region src/utils/client-info.ts
|
|
717
|
+
const injectClientInfo = createClientInfoInjector(name, version);
|
|
718
|
+
|
|
629
719
|
//#endregion
|
|
630
720
|
//#region src/core/adapter-core.ts
|
|
631
721
|
const FORCE_FETCH_HEADER = "X-Force-Fetch";
|
|
@@ -658,7 +748,7 @@ var NeonAuthAdapterCore = class {
|
|
|
658
748
|
userOnRequest?.(request);
|
|
659
749
|
},
|
|
660
750
|
customFetchImpl: async (url, init) => {
|
|
661
|
-
const headers =
|
|
751
|
+
const headers = injectClientInfo(init?.headers);
|
|
662
752
|
if (headers.has(FORCE_FETCH_HEADER)) {
|
|
663
753
|
headers.delete(FORCE_FETCH_HEADER);
|
|
664
754
|
const response$1 = await fetch(url, {
|
|
@@ -680,7 +770,10 @@ var NeonAuthAdapterCore = class {
|
|
|
680
770
|
if (response$1) return response$1;
|
|
681
771
|
}
|
|
682
772
|
const key = `${init?.method || "GET"}:${url}:${init?.body || ""}`;
|
|
683
|
-
const response = await BETTER_AUTH_METHODS_IN_FLIGHT_REQUESTS.deduplicate(key, () => fetch(url,
|
|
773
|
+
const response = await BETTER_AUTH_METHODS_IN_FLIGHT_REQUESTS.deduplicate(key, () => fetch(url, {
|
|
774
|
+
...init,
|
|
775
|
+
headers
|
|
776
|
+
}));
|
|
684
777
|
if (!response.ok) {
|
|
685
778
|
const errorBody = await response.clone().json().catch(() => ({}));
|
|
686
779
|
const err = new Error(errorBody.message || `HTTP ${response.status} ${response.statusText}`);
|
package/dist/{better-auth-react-adapter-D0YDUhsP.mjs → better-auth-react-adapter-D9tIaEyQ.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as NeonAuthAdapterCore } from "./adapter-core-
|
|
1
|
+
import { t as NeonAuthAdapterCore } from "./adapter-core-8s6XdCco.mjs";
|
|
2
2
|
import { createAuthClient } from "better-auth/react";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/better-auth-react/better-auth-react-adapter.ts
|
|
@@ -34,9 +34,16 @@ var BetterAuthReactAdapterImpl = class extends NeonAuthAdapterCore {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
function BetterAuthReactAdapter(options) {
|
|
37
|
-
return (url) => new BetterAuthReactAdapterImpl({
|
|
37
|
+
return (url, fetchOptions) => new BetterAuthReactAdapterImpl({
|
|
38
38
|
baseURL: url,
|
|
39
|
-
...options
|
|
39
|
+
...options,
|
|
40
|
+
fetchOptions: {
|
|
41
|
+
...options?.fetchOptions,
|
|
42
|
+
headers: {
|
|
43
|
+
...options?.fetchOptions?.headers,
|
|
44
|
+
...fetchOptions?.headers
|
|
45
|
+
}
|
|
46
|
+
}
|
|
40
47
|
});
|
|
41
48
|
}
|
|
42
49
|
|