@contentgrowth/content-auth 0.2.2 → 0.2.3
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/backend/index.d.ts
CHANGED
|
@@ -1074,6 +1074,15 @@ declare namespace schema {
|
|
|
1074
1074
|
declare function getInvitationLink(data: any, baseUrl: string): {
|
|
1075
1075
|
link: any;
|
|
1076
1076
|
};
|
|
1077
|
+
/**
|
|
1078
|
+
* Extracts the session token from the request.
|
|
1079
|
+
* Checks "Authorization: Bearer <token>" header first.
|
|
1080
|
+
* Then checks cookies for "better-auth.session_token", "session_token", and "__Secure-better-auth.session_token".
|
|
1081
|
+
*
|
|
1082
|
+
* @param req The Request object
|
|
1083
|
+
* @returns The session token or null if not found
|
|
1084
|
+
*/
|
|
1085
|
+
declare function getSessionToken(req: Request): string | null;
|
|
1077
1086
|
|
|
1078
1087
|
interface AuthConfig {
|
|
1079
1088
|
/**
|
|
@@ -1104,4 +1113,4 @@ declare const createAuthApp: (config: AuthConfig) => {
|
|
|
1104
1113
|
auth: better_auth.Auth<any>;
|
|
1105
1114
|
};
|
|
1106
1115
|
|
|
1107
|
-
export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, schema };
|
|
1116
|
+
export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema };
|
package/dist/backend/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
createAuth,
|
|
5
5
|
createAuthApp,
|
|
6
6
|
getInvitationLink,
|
|
7
|
+
getSessionToken,
|
|
7
8
|
schema_exports
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-6DFIEMYG.js";
|
|
9
10
|
import "../chunk-R5U7XKVJ.js";
|
|
10
11
|
export {
|
|
11
12
|
Hono,
|
|
@@ -13,5 +14,6 @@ export {
|
|
|
13
14
|
createAuth,
|
|
14
15
|
createAuthApp,
|
|
15
16
|
getInvitationLink,
|
|
17
|
+
getSessionToken,
|
|
16
18
|
schema_exports as schema
|
|
17
19
|
};
|
|
@@ -175,6 +175,22 @@ function getInvitationLink(data, baseUrl) {
|
|
|
175
175
|
link: rawLink
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
+
function getSessionToken(req) {
|
|
179
|
+
const authHeader = req.headers.get("Authorization");
|
|
180
|
+
if (authHeader?.startsWith("Bearer ")) {
|
|
181
|
+
return authHeader.split(" ")[1];
|
|
182
|
+
}
|
|
183
|
+
const cookieHeader = req.headers.get("Cookie");
|
|
184
|
+
if (!cookieHeader) return null;
|
|
185
|
+
const cookies = {};
|
|
186
|
+
cookieHeader.split(";").forEach((c) => {
|
|
187
|
+
const [key, value] = c.trim().split("=");
|
|
188
|
+
if (key && value) {
|
|
189
|
+
cookies[key] = value;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return cookies["better-auth.session_token"] || cookies["session_token"] || cookies["__Secure-better-auth.session_token"] || null;
|
|
193
|
+
}
|
|
178
194
|
|
|
179
195
|
// src/backend/index.ts
|
|
180
196
|
var createAuth = (config) => {
|
|
@@ -235,6 +251,7 @@ var createAuthApp = (config) => {
|
|
|
235
251
|
export {
|
|
236
252
|
schema_exports,
|
|
237
253
|
getInvitationLink,
|
|
254
|
+
getSessionToken,
|
|
238
255
|
Hono,
|
|
239
256
|
createAuth,
|
|
240
257
|
authMiddleware,
|
|
@@ -628,7 +628,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
628
628
|
sortDirection?: "asc" | "desc" | undefined;
|
|
629
629
|
filterField?: string | undefined;
|
|
630
630
|
filterValue?: string | number | boolean | undefined;
|
|
631
|
-
filterOperator?: "eq" | "ne" | "
|
|
631
|
+
filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
|
|
632
632
|
organizationId?: string | undefined;
|
|
633
633
|
organizationSlug?: string | undefined;
|
|
634
634
|
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
|
|
@@ -639,7 +639,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
639
639
|
sortDirection?: "asc" | "desc" | undefined;
|
|
640
640
|
filterField?: string | undefined;
|
|
641
641
|
filterValue?: string | number | boolean | undefined;
|
|
642
|
-
filterOperator?: "eq" | "ne" | "
|
|
642
|
+
filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
|
|
643
643
|
organizationId?: string | undefined;
|
|
644
644
|
organizationSlug?: string | undefined;
|
|
645
645
|
} | undefined;
|
|
@@ -746,7 +746,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
746
746
|
} & {
|
|
747
747
|
signIn: {
|
|
748
748
|
social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
|
|
749
|
-
provider: (string & {}) | "
|
|
749
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
750
750
|
callbackURL?: string | undefined;
|
|
751
751
|
newUserCallbackURL?: string | undefined;
|
|
752
752
|
errorCallbackURL?: string | undefined;
|
|
@@ -763,7 +763,7 @@ declare const createClient: (baseUrl?: string) => {
|
|
|
763
763
|
loginHint?: string | undefined;
|
|
764
764
|
additionalData?: Record<string, any> | undefined;
|
|
765
765
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
|
|
766
|
-
provider: (string & {}) | "
|
|
766
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
767
767
|
callbackURL?: string | undefined;
|
|
768
768
|
newUserCallbackURL?: string | undefined;
|
|
769
769
|
errorCallbackURL?: string | undefined;
|
|
@@ -2205,7 +2205,7 @@ declare const authClient: {
|
|
|
2205
2205
|
sortDirection?: "asc" | "desc" | undefined;
|
|
2206
2206
|
filterField?: string | undefined;
|
|
2207
2207
|
filterValue?: string | number | boolean | undefined;
|
|
2208
|
-
filterOperator?: "eq" | "ne" | "
|
|
2208
|
+
filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
|
|
2209
2209
|
organizationId?: string | undefined;
|
|
2210
2210
|
organizationSlug?: string | undefined;
|
|
2211
2211
|
}> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth.Prettify<{
|
|
@@ -2216,7 +2216,7 @@ declare const authClient: {
|
|
|
2216
2216
|
sortDirection?: "asc" | "desc" | undefined;
|
|
2217
2217
|
filterField?: string | undefined;
|
|
2218
2218
|
filterValue?: string | number | boolean | undefined;
|
|
2219
|
-
filterOperator?: "eq" | "ne" | "
|
|
2219
|
+
filterOperator?: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "contains" | undefined;
|
|
2220
2220
|
organizationId?: string | undefined;
|
|
2221
2221
|
organizationSlug?: string | undefined;
|
|
2222
2222
|
} | undefined;
|
|
@@ -2323,7 +2323,7 @@ declare const authClient: {
|
|
|
2323
2323
|
} & {
|
|
2324
2324
|
signIn: {
|
|
2325
2325
|
social: <FetchOptions extends better_auth.ClientFetchOption<Partial<{
|
|
2326
|
-
provider: (string & {}) | "
|
|
2326
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
2327
2327
|
callbackURL?: string | undefined;
|
|
2328
2328
|
newUserCallbackURL?: string | undefined;
|
|
2329
2329
|
errorCallbackURL?: string | undefined;
|
|
@@ -2340,7 +2340,7 @@ declare const authClient: {
|
|
|
2340
2340
|
loginHint?: string | undefined;
|
|
2341
2341
|
additionalData?: Record<string, any> | undefined;
|
|
2342
2342
|
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: better_auth.Prettify<{
|
|
2343
|
-
provider: (string & {}) | "
|
|
2343
|
+
provider: (string & {}) | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "vercel";
|
|
2344
2344
|
callbackURL?: string | undefined;
|
|
2345
2345
|
newUserCallbackURL?: string | undefined;
|
|
2346
2346
|
errorCallbackURL?: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, schema } from './backend/index.js';
|
|
1
|
+
export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema } from './backend/index.js';
|
|
2
2
|
export { AuthForm, CreateOrganizationForm, InviteMemberForm, OrganizationSwitcher } from './frontend/index.js';
|
|
3
3
|
export { authClient, createClient } from './frontend/client.js';
|
|
4
4
|
export * from 'better-auth';
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
createAuth,
|
|
5
5
|
createAuthApp,
|
|
6
6
|
getInvitationLink,
|
|
7
|
+
getSessionToken,
|
|
7
8
|
schema_exports
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6DFIEMYG.js";
|
|
9
10
|
import {
|
|
10
11
|
AuthForm,
|
|
11
12
|
CreateOrganizationForm,
|
|
@@ -29,5 +30,6 @@ export {
|
|
|
29
30
|
createAuthApp,
|
|
30
31
|
createClient,
|
|
31
32
|
getInvitationLink,
|
|
33
|
+
getSessionToken,
|
|
32
34
|
schema_exports as schema
|
|
33
35
|
};
|