@relkit/better-auth 0.3.0 → 0.5.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/react.d.ts +14 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +29 -0
- package/dist/react.js.map +1 -0
- package/package.json +16 -6
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RelkitClientProviderProps } from "@relkit/client/react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export interface BetterAuthClientLike<Session> {
|
|
4
|
+
useSession(): {
|
|
5
|
+
readonly data: Session | null | undefined;
|
|
6
|
+
readonly isPending: boolean;
|
|
7
|
+
readonly error?: unknown;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface BetterAuthRelkitClientProviderProps<Session> extends RelkitClientProviderProps {
|
|
11
|
+
readonly authClient: BetterAuthClientLike<Session>;
|
|
12
|
+
}
|
|
13
|
+
export declare function BetterAuthRelkitClientProvider<Session>({ authClient, identityKey, ...props }: BetterAuthRelkitClientProviderProps<Session>): ReactNode;
|
|
14
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,oBAAoB,CAAC,OAAO;IAC3C,UAAU,IAAI;QACZ,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;QAC1C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,mCAAmC,CAAC,OAAO,CAAE,SAAQ,yBAAyB;IAC7F,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;CACpD;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,EACtD,UAAU,EACV,WAAW,EACX,GAAG,KAAK,EACT,EAAE,mCAAmC,CAAC,OAAO,CAAC,GAAG,SAAS,CAY1D"}
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { RelkitClientProvider } from "@relkit/client/react";
|
|
3
|
+
import { createElement } from "react";
|
|
4
|
+
export function BetterAuthRelkitClientProvider({ authClient, identityKey, ...props }) {
|
|
5
|
+
const session = authClient.useSession();
|
|
6
|
+
const key = session.isPending ? "pending" : sessionKey(session.data);
|
|
7
|
+
return createElement(RelkitClientProvider, {
|
|
8
|
+
...props,
|
|
9
|
+
key,
|
|
10
|
+
...(session.isPending
|
|
11
|
+
? { identityKey: null }
|
|
12
|
+
: identityKey === undefined
|
|
13
|
+
? {}
|
|
14
|
+
: { identityKey }),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function sessionKey(value) {
|
|
18
|
+
if (value === null || value === undefined)
|
|
19
|
+
return "anonymous";
|
|
20
|
+
const session = record(record(value)?.session);
|
|
21
|
+
const user = record(record(value)?.user);
|
|
22
|
+
return [session?.id, session?.updatedAt, user?.id].map(String).join(":");
|
|
23
|
+
}
|
|
24
|
+
function record(value) {
|
|
25
|
+
return value !== null && typeof value === "object"
|
|
26
|
+
? value
|
|
27
|
+
: undefined;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,oBAAoB,EAAkC,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAkB,MAAM,OAAO,CAAC;AActD,MAA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|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Better Auth integration for RELKIT routes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,17 +26,27 @@
|
|
|
26
26
|
".": {
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
28
|
"import": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./react": {
|
|
31
|
+
"types": "./dist/react.d.ts",
|
|
32
|
+
"import": "./dist/react.js"
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
"dependencies": {
|
|
32
|
-
"@relkit/
|
|
33
|
-
"@relkit/
|
|
34
|
-
"@relkit/
|
|
35
|
-
"@relkit/
|
|
36
|
+
"@relkit/client": "0.5.0",
|
|
37
|
+
"@relkit/contracts": "0.5.0",
|
|
38
|
+
"@relkit/drizzle": "0.5.0",
|
|
39
|
+
"@relkit/invocation": "0.5.0",
|
|
40
|
+
"@relkit/routes": "0.5.0",
|
|
36
41
|
"better-auth": "1.7.1"
|
|
37
42
|
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": ">=18.0.0"
|
|
45
|
+
},
|
|
38
46
|
"devDependencies": {
|
|
39
|
-
"
|
|
47
|
+
"@types/react": "19.2.18",
|
|
48
|
+
"drizzle-orm": "1.0.0-rc.5-169397b",
|
|
49
|
+
"react": "19.2.8"
|
|
40
50
|
},
|
|
41
51
|
"scripts": {
|
|
42
52
|
"build": "tsc -b",
|