@choiceform/shared-auth 0.1.2 → 0.1.4
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/README.md +5 -0
- package/dist/components/auth-sync.d.ts +4 -3
- package/dist/components/auth-sync.d.ts.map +1 -1
- package/dist/components/auth-sync.js +73 -31
- package/dist/core.d.ts +11 -10
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +1 -1
- package/dist/init.d.ts +11 -10
- package/dist/init.d.ts.map +1 -1
- package/dist/lib/auth-client.d.ts +19 -10
- package/dist/lib/auth-client.d.ts.map +1 -1
- package/dist/lib/auth-client.js +29 -1
- package/dist/store/actions.d.ts +9 -1
- package/dist/store/actions.d.ts.map +1 -1
- package/dist/store/actions.js +32 -12
- package/dist/store/utils.js +1 -1
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,13 +3,14 @@ import type { AuthInstance } from "../core";
|
|
|
3
3
|
* Better Auth 认证状态同步组件
|
|
4
4
|
*
|
|
5
5
|
* 功能说明:
|
|
6
|
-
* - 使用 better-auth 的 useSession hook
|
|
7
|
-
* - 监听 authStore
|
|
6
|
+
* - 使用 better-auth 的 useSession hook 同步认证状态到 Legend State
|
|
7
|
+
* - 监听 authStore 状态,在用户登录成功后自动设置组织/团队上下文
|
|
8
8
|
* - 确保登录流程的完整性和权限上下文的正确性
|
|
9
9
|
*
|
|
10
10
|
* 技术实现:
|
|
11
11
|
* - 使用 Legend State 的 use$ hook 响应式监听状态变化
|
|
12
|
-
* - 使用 useRef
|
|
12
|
+
* - 使用 useRef 确保组织/团队设置只执行一次
|
|
13
|
+
* - 使用 useCallback 缓存映射函数,避免不必要的重渲染
|
|
13
14
|
* - 分离 session 同步和团队设置的逻辑,保持代码清晰
|
|
14
15
|
*
|
|
15
16
|
* 边缘情况处理:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-sync.d.ts","sourceRoot":"","sources":["../../src/components/auth-sync.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"auth-sync.d.ts","sourceRoot":"","sources":["../../src/components/auth-sync.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAoS3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,QA0FxD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
1
|
+
import { useEffect, useRef, useCallback } from "react";
|
|
2
2
|
import { use$ } from "@legendapp/state/react";
|
|
3
3
|
/**
|
|
4
4
|
* 将日期转换为 ISO 字符串
|
|
@@ -11,7 +11,7 @@ function toISOString(date) {
|
|
|
11
11
|
/**
|
|
12
12
|
* 将 Better Auth session 用户数据映射为 SessionUser
|
|
13
13
|
*/
|
|
14
|
-
function mapSessionUserToSessionUser(sessionUser,
|
|
14
|
+
function mapSessionUserToSessionUser(sessionUser, sessionData) {
|
|
15
15
|
return {
|
|
16
16
|
banExpires: sessionUser.banExpires,
|
|
17
17
|
banReason: sessionUser.banReason,
|
|
@@ -21,10 +21,12 @@ function mapSessionUserToSessionUser(sessionUser, sessionCreatedAt) {
|
|
|
21
21
|
emailVerified: sessionUser.emailVerified,
|
|
22
22
|
id: sessionUser.id,
|
|
23
23
|
image: sessionUser.image || undefined,
|
|
24
|
-
lastLoginAt: toISOString(
|
|
24
|
+
lastLoginAt: toISOString(sessionData?.createdAt),
|
|
25
25
|
name: sessionUser.name,
|
|
26
26
|
role: sessionUser.role,
|
|
27
27
|
updatedAt: toISOString(sessionUser.updatedAt) ?? "",
|
|
28
|
+
activeOrganizationId: sessionData?.activeOrganizationId,
|
|
29
|
+
activeTeamId: sessionData?.activeTeamId,
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
@@ -86,7 +88,7 @@ async function parseErrorResponse(response) {
|
|
|
86
88
|
* - API 返回错误:记录详细错误信息
|
|
87
89
|
* - 无效响应数据:记录错误但不影响登录
|
|
88
90
|
*/
|
|
89
|
-
async function setupCompanionTeam(
|
|
91
|
+
async function setupCompanionTeam(auth, token, refetchSession) {
|
|
90
92
|
try {
|
|
91
93
|
// 1. 验证环境变量配置
|
|
92
94
|
const oneAuthBaseUrl = getEnvVar("VITE_AUTH_API_URL") || getEnvVar("VITE_CORE_AI_API_URL");
|
|
@@ -112,16 +114,14 @@ async function setupCompanionTeam(_auth, token) {
|
|
|
112
114
|
}
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
115
|
-
// 4.
|
|
116
|
-
const encodedToken = encodeURIComponent(oneAuthToken);
|
|
117
|
-
// 5. 获取组织信息
|
|
117
|
+
// 4. 获取组织信息
|
|
118
118
|
const myOrganizationUrl = `${oneAuthBaseUrl}/v1/organizations/me`;
|
|
119
119
|
if (isDev) {
|
|
120
120
|
console.log("[AuthSync] Fetching organization from:", myOrganizationUrl);
|
|
121
121
|
}
|
|
122
122
|
const orgResponse = await fetch(myOrganizationUrl, {
|
|
123
123
|
headers: {
|
|
124
|
-
Authorization: `Bearer ${
|
|
124
|
+
Authorization: `Bearer ${oneAuthToken}`,
|
|
125
125
|
"Content-Type": "application/json",
|
|
126
126
|
},
|
|
127
127
|
});
|
|
@@ -156,7 +156,7 @@ async function setupCompanionTeam(_auth, token) {
|
|
|
156
156
|
const setActiveOrgResponse = await fetch(setActiveOrgUrl, {
|
|
157
157
|
method: "POST",
|
|
158
158
|
headers: {
|
|
159
|
-
Authorization: `Bearer ${
|
|
159
|
+
Authorization: `Bearer ${oneAuthToken}`,
|
|
160
160
|
"Content-Type": "application/json",
|
|
161
161
|
},
|
|
162
162
|
body: JSON.stringify({ organizationId: organization.id }),
|
|
@@ -176,7 +176,7 @@ async function setupCompanionTeam(_auth, token) {
|
|
|
176
176
|
const setActiveTeamResponse = await fetch(setActiveTeamUrl, {
|
|
177
177
|
method: "POST",
|
|
178
178
|
headers: {
|
|
179
|
-
Authorization: `Bearer ${
|
|
179
|
+
Authorization: `Bearer ${oneAuthToken}`,
|
|
180
180
|
"Content-Type": "application/json",
|
|
181
181
|
},
|
|
182
182
|
body: JSON.stringify({ teamId: firstTeam.id }),
|
|
@@ -188,6 +188,42 @@ async function setupCompanionTeam(_auth, token) {
|
|
|
188
188
|
if (isDev) {
|
|
189
189
|
console.log("[AuthSync] Successfully set active team");
|
|
190
190
|
}
|
|
191
|
+
// 刷新 session 并更新 authStore
|
|
192
|
+
if (refetchSession) {
|
|
193
|
+
refetchSession();
|
|
194
|
+
}
|
|
195
|
+
// 使用 fetch 直接调用 get-session 获取最新数据
|
|
196
|
+
try {
|
|
197
|
+
const getSessionUrl = `${authBaseURL}/v1/auth/get-session`;
|
|
198
|
+
const sessionResponse = await fetch(getSessionUrl, {
|
|
199
|
+
headers: {
|
|
200
|
+
Authorization: `Bearer ${oneAuthToken}`,
|
|
201
|
+
"Content-Type": "application/json",
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
if (sessionResponse.ok) {
|
|
205
|
+
const sessionData = await sessionResponse.json();
|
|
206
|
+
const data = sessionData;
|
|
207
|
+
if (data.user && data.session) {
|
|
208
|
+
const currentUser = auth.authStore.user.get();
|
|
209
|
+
if (currentUser) {
|
|
210
|
+
auth.authStore.user.set({
|
|
211
|
+
...currentUser,
|
|
212
|
+
activeOrganizationId: data.session.activeOrganizationId,
|
|
213
|
+
activeTeamId: data.session.activeTeamId,
|
|
214
|
+
});
|
|
215
|
+
if (isDev) {
|
|
216
|
+
console.log("[AuthSync] Updated authStore with activeOrganizationId and activeTeamId");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
if (isDev) {
|
|
224
|
+
console.error("[AuthSync] Failed to refresh session:", err);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
191
227
|
}
|
|
192
228
|
else if (isDev) {
|
|
193
229
|
console.warn("[AuthSync] First team has invalid ID, skipping team setup");
|
|
@@ -214,13 +250,14 @@ async function setupCompanionTeam(_auth, token) {
|
|
|
214
250
|
* Better Auth 认证状态同步组件
|
|
215
251
|
*
|
|
216
252
|
* 功能说明:
|
|
217
|
-
* - 使用 better-auth 的 useSession hook
|
|
218
|
-
* - 监听 authStore
|
|
253
|
+
* - 使用 better-auth 的 useSession hook 同步认证状态到 Legend State
|
|
254
|
+
* - 监听 authStore 状态,在用户登录成功后自动设置组织/团队上下文
|
|
219
255
|
* - 确保登录流程的完整性和权限上下文的正确性
|
|
220
256
|
*
|
|
221
257
|
* 技术实现:
|
|
222
258
|
* - 使用 Legend State 的 use$ hook 响应式监听状态变化
|
|
223
|
-
* - 使用 useRef
|
|
259
|
+
* - 使用 useRef 确保组织/团队设置只执行一次
|
|
260
|
+
* - 使用 useCallback 缓存映射函数,避免不必要的重渲染
|
|
224
261
|
* - 分离 session 同步和团队设置的逻辑,保持代码清晰
|
|
225
262
|
*
|
|
226
263
|
* 边缘情况处理:
|
|
@@ -237,13 +274,27 @@ export function AuthSync({ auth }) {
|
|
|
237
274
|
const isLoaded = use$(authStore.isLoaded);
|
|
238
275
|
// 监听 better-auth 的 session(用于同步到 store)
|
|
239
276
|
const sessionResult = authClient.useSession();
|
|
240
|
-
const { data: session, isPending, error } = sessionResult || {
|
|
277
|
+
const { data: session, isPending, error, refetch } = sessionResult || {
|
|
241
278
|
data: null,
|
|
242
279
|
isPending: false,
|
|
243
|
-
error: null
|
|
280
|
+
error: null,
|
|
281
|
+
refetch: undefined,
|
|
244
282
|
};
|
|
245
|
-
// 使用 ref
|
|
283
|
+
// 使用 ref 确保组织/团队设置只执行一次
|
|
246
284
|
const teamSetupRef = useRef(false);
|
|
285
|
+
// 使用 useCallback 缓存 session 映射逻辑,避免不必要的重计算
|
|
286
|
+
const handleSessionUpdate = useCallback((sessionData) => {
|
|
287
|
+
if (sessionData?.user) {
|
|
288
|
+
try {
|
|
289
|
+
const mappedUser = mapSessionUserToSessionUser(sessionData.user, sessionData.session);
|
|
290
|
+
authActions.initialize(mappedUser, true);
|
|
291
|
+
}
|
|
292
|
+
catch (mappingError) {
|
|
293
|
+
console.error("[AuthSync] Failed to map session user:", mappingError);
|
|
294
|
+
// 映射失败时不清空用户信息,可能已有有效的用户数据
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}, [authActions]);
|
|
247
298
|
// Effect 1: 同步 better-auth session 到 store
|
|
248
299
|
useEffect(() => {
|
|
249
300
|
// 加载中状态
|
|
@@ -254,27 +305,18 @@ export function AuthSync({ auth }) {
|
|
|
254
305
|
authActions.setLoading(false);
|
|
255
306
|
// 错误处理
|
|
256
307
|
if (error) {
|
|
257
|
-
const errorMessage = error instanceof Error
|
|
258
|
-
? error.message
|
|
259
|
-
: (typeof error === "string" ? error : "Authentication error");
|
|
308
|
+
const errorMessage = error instanceof Error ? error.message : typeof error === "string" ? error : "Authentication error";
|
|
260
309
|
authActions.setError(errorMessage);
|
|
261
310
|
authActions.initialize(null, true);
|
|
262
311
|
teamSetupRef.current = false;
|
|
263
312
|
return;
|
|
264
313
|
}
|
|
265
314
|
// Session 存在:映射用户数据并更新 store
|
|
266
|
-
if (session
|
|
267
|
-
|
|
268
|
-
const mappedUser = mapSessionUserToSessionUser(session.user, session.session?.createdAt);
|
|
269
|
-
authActions.initialize(mappedUser, true);
|
|
270
|
-
}
|
|
271
|
-
catch (mappingError) {
|
|
272
|
-
console.error("[AuthSync] Failed to map session user:", mappingError);
|
|
273
|
-
// 映射失败时不清空用户信息,可能已有有效的用户数据
|
|
274
|
-
}
|
|
315
|
+
if (session) {
|
|
316
|
+
handleSessionUpdate(session);
|
|
275
317
|
}
|
|
276
318
|
// 注意:没有 session 时不主动清空用户信息,因为可能已经从 token 加载了
|
|
277
|
-
}, [session, isPending, error, authActions]);
|
|
319
|
+
}, [session, isPending, error, authActions, handleSessionUpdate]);
|
|
278
320
|
// Effect 2: 监听 authStore 状态,设置伴生团队
|
|
279
321
|
useEffect(() => {
|
|
280
322
|
// 条件检查:只有在用户已认证且已加载完成时才设置伴生团队
|
|
@@ -283,7 +325,7 @@ export function AuthSync({ auth }) {
|
|
|
283
325
|
const token = tokenStorage.get();
|
|
284
326
|
// 验证 token 存在
|
|
285
327
|
if (token && typeof token === "string" && token.trim().length > 0) {
|
|
286
|
-
setupCompanionTeam(auth, token).catch((error) => {
|
|
328
|
+
setupCompanionTeam(auth, token, refetch).catch((error) => {
|
|
287
329
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
288
330
|
console.error("[AuthSync] Failed to setup companion team:", errorMessage);
|
|
289
331
|
// 失败后重置 ref,允许在特定条件下重试(如 token 更新后)
|
|
@@ -298,7 +340,7 @@ export function AuthSync({ auth }) {
|
|
|
298
340
|
if (isLoaded && !isAuthenticated) {
|
|
299
341
|
teamSetupRef.current = false;
|
|
300
342
|
}
|
|
301
|
-
}, [user, isAuthenticated, isLoaded, auth, tokenStorage]);
|
|
343
|
+
}, [user, isAuthenticated, isLoaded, auth, tokenStorage, refetch]);
|
|
302
344
|
// 这是一个隐形组件,不渲染任何内容
|
|
303
345
|
return null;
|
|
304
346
|
}
|
package/dist/core.d.ts
CHANGED
|
@@ -600,13 +600,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
600
600
|
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<NonNullable<void | {
|
|
601
601
|
status: boolean;
|
|
602
602
|
user: {
|
|
603
|
-
id:
|
|
604
|
-
email:
|
|
605
|
-
name:
|
|
606
|
-
image:
|
|
607
|
-
emailVerified:
|
|
608
|
-
createdAt:
|
|
609
|
-
updatedAt:
|
|
603
|
+
id: string;
|
|
604
|
+
email: string;
|
|
605
|
+
name: string;
|
|
606
|
+
image: string | null | undefined;
|
|
607
|
+
emailVerified: boolean;
|
|
608
|
+
createdAt: Date;
|
|
609
|
+
updatedAt: Date;
|
|
610
610
|
};
|
|
611
611
|
} | {
|
|
612
612
|
status: boolean;
|
|
@@ -1800,7 +1800,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
1800
1800
|
userId?: string | undefined;
|
|
1801
1801
|
} & {
|
|
1802
1802
|
fetchOptions?: FetchOptions | undefined;
|
|
1803
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<
|
|
1803
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<any, {
|
|
1804
1804
|
code?: string;
|
|
1805
1805
|
message?: string;
|
|
1806
1806
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
@@ -1938,7 +1938,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
1938
1938
|
} & {
|
|
1939
1939
|
fetchOptions?: FetchOptions | undefined;
|
|
1940
1940
|
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
1941
|
-
user:
|
|
1941
|
+
user: packages_core_dist_oauth2.OAuth2UserInfo;
|
|
1942
1942
|
data: Record<string, any>;
|
|
1943
1943
|
}, {
|
|
1944
1944
|
code?: string;
|
|
@@ -2055,6 +2055,7 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
2055
2055
|
};
|
|
2056
2056
|
} | null;
|
|
2057
2057
|
isPending: boolean;
|
|
2058
|
+
isRefetching: boolean;
|
|
2058
2059
|
error: import("@better-fetch/fetch").BetterFetchError | null;
|
|
2059
2060
|
refetch: (queryParams?: {
|
|
2060
2061
|
query?: import("better-auth").SessionQueryParams;
|
|
@@ -2100,13 +2101,13 @@ export declare function createAuth(config: AuthConfig): {
|
|
|
2100
2101
|
onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): void;
|
|
2101
2102
|
};
|
|
2102
2103
|
})[];
|
|
2103
|
-
redirect?: RequestRedirect | undefined;
|
|
2104
2104
|
method: string;
|
|
2105
2105
|
headers?: (HeadersInit & (HeadersInit | {
|
|
2106
2106
|
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2107
2107
|
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2108
2108
|
authorization: "Bearer" | "Basic";
|
|
2109
2109
|
})) | undefined;
|
|
2110
|
+
redirect?: RequestRedirect | undefined;
|
|
2110
2111
|
cache?: RequestCache | undefined;
|
|
2111
2112
|
credentials?: RequestCredentials;
|
|
2112
2113
|
integrity?: string | undefined;
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAsCq+e,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAA08oS,CAAC;mCAAyD,CAAC;oCAA0D,CAAC;iCAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;yBAA9K,CAAC;+BAAyD,CAAC;gCAA0D,CAAC;6BAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAAznpS,CAAC;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAA1+a,CAAC;qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAA2hD,CAAC;;;;;oBAAwW,CAAC;iBAA4C,CAAC;uBAA+C,CAAC;qBAAuC,CAAC;qBAAuC,CAAC;gBAAmC,CAAC;oBAA2C,CAAC;oBAA+C,CAAC;0BAA4C,CAAC;kBAA4C,CAAC;kBAAkD,CAAC;mBAAmC,CAAC;uBAA4G,CAAC;6BAA6B,CAAC;;mBAAiD,CAAC;;;iBAAqH,CAAC;gBAAmC,CAAC;;;;;;;;;;;;gBAA+iB,CAAC;iBAAoB,CAAC;kBAAqB,CAAC;kBAAqB,CAAC;;iBAAsG,CAAC;wBAAoE,CAAC;kBAAoC,CAAC;uBAAqG,CAAC;6BAA6E,CAAC;;;2BAA0F,CAAC;mHAA6K,CAAC;;;;;;;EAJx/L;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA"}
|
package/dist/core.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createBoundAuthUtils } from "./store/utils";
|
|
|
7
7
|
* 创建认证系统实例
|
|
8
8
|
*/
|
|
9
9
|
export function createAuth(config) {
|
|
10
|
-
// 创建 auth client
|
|
10
|
+
// 创建 auth client (传递 tokenStorageKey 以支持 bearer token 认证)
|
|
11
11
|
const authClient = createAuthClientFromConfig(config);
|
|
12
12
|
// 创建 store
|
|
13
13
|
const { authStore, tokenStorage } = createAuthStore({
|
package/dist/init.d.ts
CHANGED
|
@@ -606,13 +606,13 @@ export declare function initAuth(config: {
|
|
|
606
606
|
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<NonNullable<void | {
|
|
607
607
|
status: boolean;
|
|
608
608
|
user: {
|
|
609
|
-
id:
|
|
610
|
-
email:
|
|
611
|
-
name:
|
|
612
|
-
image:
|
|
613
|
-
emailVerified:
|
|
614
|
-
createdAt:
|
|
615
|
-
updatedAt:
|
|
609
|
+
id: string;
|
|
610
|
+
email: string;
|
|
611
|
+
name: string;
|
|
612
|
+
image: string | null | undefined;
|
|
613
|
+
emailVerified: boolean;
|
|
614
|
+
createdAt: Date;
|
|
615
|
+
updatedAt: Date;
|
|
616
616
|
};
|
|
617
617
|
} | {
|
|
618
618
|
status: boolean;
|
|
@@ -1806,7 +1806,7 @@ export declare function initAuth(config: {
|
|
|
1806
1806
|
userId?: string | undefined;
|
|
1807
1807
|
} & {
|
|
1808
1808
|
fetchOptions?: FetchOptions | undefined;
|
|
1809
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<
|
|
1809
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<any, {
|
|
1810
1810
|
code?: string;
|
|
1811
1811
|
message?: string;
|
|
1812
1812
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
@@ -1944,7 +1944,7 @@ export declare function initAuth(config: {
|
|
|
1944
1944
|
} & {
|
|
1945
1945
|
fetchOptions?: FetchOptions | undefined;
|
|
1946
1946
|
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
1947
|
-
user:
|
|
1947
|
+
user: packages_core_dist_oauth2.OAuth2UserInfo;
|
|
1948
1948
|
data: Record<string, any>;
|
|
1949
1949
|
}, {
|
|
1950
1950
|
code?: string;
|
|
@@ -2061,6 +2061,7 @@ export declare function initAuth(config: {
|
|
|
2061
2061
|
};
|
|
2062
2062
|
} | null;
|
|
2063
2063
|
isPending: boolean;
|
|
2064
|
+
isRefetching: boolean;
|
|
2064
2065
|
error: import("@better-fetch/fetch").BetterFetchError | null;
|
|
2065
2066
|
refetch: (queryParams?: {
|
|
2066
2067
|
query?: import("better-auth").SessionQueryParams;
|
|
@@ -2106,13 +2107,13 @@ export declare function initAuth(config: {
|
|
|
2106
2107
|
onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): void;
|
|
2107
2108
|
};
|
|
2108
2109
|
})[];
|
|
2109
|
-
redirect?: RequestRedirect | undefined;
|
|
2110
2110
|
method: string;
|
|
2111
2111
|
headers?: (HeadersInit & (HeadersInit | {
|
|
2112
2112
|
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2113
2113
|
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2114
2114
|
authorization: "Bearer" | "Basic";
|
|
2115
2115
|
})) | undefined;
|
|
2116
|
+
redirect?: RequestRedirect | undefined;
|
|
2116
2117
|
cache?: RequestCache | undefined;
|
|
2117
2118
|
credentials?: RequestCredentials;
|
|
2118
2119
|
integrity?: string | undefined;
|
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C;;GAEG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAe+0f,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts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;;;;;;;;;gBAA+iB,CAAC;iBAAoB,CAAC;kBAAqB,CAAC;kBAAqB,CAAC;;iBAAsG,CAAC;wBAAoE,CAAC;kBAAoC,CAAC;uBAAqG,CAAC;6BAA6E,CAAC;;;2BAA0F,CAAC;mHAA6K,CAAC;;;;;;;EAFtzM"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { AuthConfig } from "../config";
|
|
2
2
|
/**
|
|
3
3
|
* 创建 Better Auth 客户端
|
|
4
|
+
*
|
|
5
|
+
* 配置说明:
|
|
6
|
+
* - 使用 Bearer Token 认证模式
|
|
7
|
+
* - Token 从 localStorage 中动态读取
|
|
8
|
+
* - 支持服务器端 Bearer Plugin 的 session 管理
|
|
9
|
+
*
|
|
10
|
+
* @param config - 认证配置对象
|
|
11
|
+
* @returns Better Auth 客户端实例
|
|
4
12
|
*/
|
|
5
13
|
export declare function createAuthClientFromConfig(config: AuthConfig): {
|
|
6
14
|
signIn: {
|
|
@@ -560,13 +568,13 @@ export declare function createAuthClientFromConfig(config: AuthConfig): {
|
|
|
560
568
|
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<NonNullable<void | {
|
|
561
569
|
status: boolean;
|
|
562
570
|
user: {
|
|
563
|
-
id:
|
|
564
|
-
email:
|
|
565
|
-
name:
|
|
566
|
-
image:
|
|
567
|
-
emailVerified:
|
|
568
|
-
createdAt:
|
|
569
|
-
updatedAt:
|
|
571
|
+
id: string;
|
|
572
|
+
email: string;
|
|
573
|
+
name: string;
|
|
574
|
+
image: string | null | undefined;
|
|
575
|
+
emailVerified: boolean;
|
|
576
|
+
createdAt: Date;
|
|
577
|
+
updatedAt: Date;
|
|
570
578
|
};
|
|
571
579
|
} | {
|
|
572
580
|
status: boolean;
|
|
@@ -1760,7 +1768,7 @@ export declare function createAuthClientFromConfig(config: AuthConfig): {
|
|
|
1760
1768
|
userId?: string | undefined;
|
|
1761
1769
|
} & {
|
|
1762
1770
|
fetchOptions?: FetchOptions | undefined;
|
|
1763
|
-
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<
|
|
1771
|
+
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<any, {
|
|
1764
1772
|
code?: string;
|
|
1765
1773
|
message?: string;
|
|
1766
1774
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
@@ -1898,7 +1906,7 @@ export declare function createAuthClientFromConfig(config: AuthConfig): {
|
|
|
1898
1906
|
} & {
|
|
1899
1907
|
fetchOptions?: FetchOptions | undefined;
|
|
1900
1908
|
}>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
|
|
1901
|
-
user:
|
|
1909
|
+
user: packages_core_dist_oauth2.OAuth2UserInfo;
|
|
1902
1910
|
data: Record<string, any>;
|
|
1903
1911
|
}, {
|
|
1904
1912
|
code?: string;
|
|
@@ -2015,6 +2023,7 @@ export declare function createAuthClientFromConfig(config: AuthConfig): {
|
|
|
2015
2023
|
};
|
|
2016
2024
|
} | null;
|
|
2017
2025
|
isPending: boolean;
|
|
2026
|
+
isRefetching: boolean;
|
|
2018
2027
|
error: import("@better-fetch/fetch").BetterFetchError | null;
|
|
2019
2028
|
refetch: (queryParams?: {
|
|
2020
2029
|
query?: import("better-auth").SessionQueryParams;
|
|
@@ -2060,13 +2069,13 @@ export declare function createAuthClientFromConfig(config: AuthConfig): {
|
|
|
2060
2069
|
onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): void;
|
|
2061
2070
|
};
|
|
2062
2071
|
})[];
|
|
2063
|
-
redirect?: RequestRedirect | undefined;
|
|
2064
2072
|
method: string;
|
|
2065
2073
|
headers?: (HeadersInit & (HeadersInit | {
|
|
2066
2074
|
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2067
2075
|
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2068
2076
|
authorization: "Bearer" | "Basic";
|
|
2069
2077
|
})) | undefined;
|
|
2078
|
+
redirect?: RequestRedirect | undefined;
|
|
2070
2079
|
cache?: RequestCache | undefined;
|
|
2071
2080
|
credentials?: RequestCredentials;
|
|
2072
2081
|
integrity?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../src/lib/auth-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C
|
|
1
|
+
{"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../src/lib/auth-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;6BA6Bqkf,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAA08oS,CAAC;+BAAyD,CAAC;gCAA0D,CAAC;6BAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;qBAA9K,CAAC;2BAAyD,CAAC;4BAA0D,CAAC;yBAAuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAznpS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAA2C,CAAC;gBAA+C,CAAC;sBAA4C,CAAC;cAA4C,CAAC;cAAkD,CAAC;eAAmC,CAAC;mBAA4G,CAAC;yBAA6B,CAAC;;eAAiD,CAAC;;;aAAqH,CAAC;YAAmC,CAAC;;;;;;;;;;;;YAA+iB,CAAC;aAAoB,CAAC;cAAqB,CAAC;cAAqB,CAAC;;aAAsG,CAAC;oBAAoE,CAAC;cAAoC,CAAC;mBAAqG,CAAC;yBAA6E,CAAC;;;uBAA0F,CAAC;+GAA6K,CAAC;;;;;;EAFxmM"}
|
package/dist/lib/auth-client.js
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
import { createAuthClient } from "better-auth/react";
|
|
2
2
|
/**
|
|
3
3
|
* 创建 Better Auth 客户端
|
|
4
|
+
*
|
|
5
|
+
* 配置说明:
|
|
6
|
+
* - 使用 Bearer Token 认证模式
|
|
7
|
+
* - Token 从 localStorage 中动态读取
|
|
8
|
+
* - 支持服务器端 Bearer Plugin 的 session 管理
|
|
9
|
+
*
|
|
10
|
+
* @param config - 认证配置对象
|
|
11
|
+
* @returns Better Auth 客户端实例
|
|
4
12
|
*/
|
|
5
13
|
export function createAuthClientFromConfig(config) {
|
|
6
|
-
const { baseURL, plugins = [] } = config;
|
|
14
|
+
const { baseURL, plugins = [], tokenStorageKey = "auth-token" } = config;
|
|
7
15
|
return createAuthClient({
|
|
8
16
|
baseURL: `${baseURL}/v1/auth`,
|
|
9
17
|
plugins,
|
|
18
|
+
fetchOptions: {
|
|
19
|
+
auth: {
|
|
20
|
+
type: "Bearer",
|
|
21
|
+
token: () => {
|
|
22
|
+
// 从 localStorage 获取存储的 bearer token
|
|
23
|
+
// SSR 环境下 localStorage 不存在,返回空字符串
|
|
24
|
+
if (typeof window === "undefined" || typeof localStorage === "undefined") {
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const token = localStorage.getItem(tokenStorageKey);
|
|
29
|
+
return token || "";
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// localStorage 访问失败(如隐私模式),返回空字符串
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
10
38
|
});
|
|
11
39
|
}
|
package/dist/store/actions.d.ts
CHANGED
|
@@ -19,7 +19,15 @@ export declare function createAuthActions(authStore: Observable<AuthState>, toke
|
|
|
19
19
|
*/
|
|
20
20
|
initialize(user: SessionUser | null, isLoaded: boolean): Promise<void>;
|
|
21
21
|
/**
|
|
22
|
-
* 使用
|
|
22
|
+
* 使用 Bearer Token 获取 session
|
|
23
|
+
*
|
|
24
|
+
* 流程:
|
|
25
|
+
* 1. 保存 token 到 localStorage
|
|
26
|
+
* 2. 使用 Bearer Token 请求 session endpoint
|
|
27
|
+
* 3. 解析响应数据并提取用户信息
|
|
28
|
+
* 4. 更新 authStore 状态
|
|
29
|
+
*
|
|
30
|
+
* @param token - Bearer Token
|
|
23
31
|
*/
|
|
24
32
|
fetchSessionWithToken(token: string): Promise<void>;
|
|
25
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAgE3C;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,EAChC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE;IACV,MAAM,EAAE;QACN,MAAM,EAAE,CAAC,OAAO,EAAE;YAAE,WAAW,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;KACjF,CAAA;IACD,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CAChC;IAeC;;OAEG;qBACoB,WAAW,GAAG,IAAI,YAAY,OAAO;IAe5D;;;;;;;;;;OAUG;iCACgC,MAAM;IAuDzC;;;OAGG;;IAOH;;OAEG;wBACiB,OAAO;IAI3B;;OAEG;oBACa,MAAM,GAAG,IAAI;IAI7B;;;;;;OAMG;sBACoB,MAAM,eAA0B,MAAM;IAmC7D;;OAEG;;IAgCH;;OAEG;qBACc,WAAW,GAAG,IAAI;IAUnC;;OAEG;eACQ,WAAW,GAAG,IAAI;EAIhC;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
package/dist/store/actions.js
CHANGED
|
@@ -8,14 +8,21 @@ function toISOString(date) {
|
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* 从服务器响应中提取用户数据
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* 支持多种数据结构格式以提供更好的兼容性:
|
|
13
|
+
* - 标准格式: { user: {...}, session: {...} }
|
|
14
|
+
* - 嵌套格式: { session: { user: {...} } }
|
|
15
|
+
* - 包装格式: { data: { user: {...} } }
|
|
16
|
+
* - 扁平格式: { id, email, ... }
|
|
17
|
+
*
|
|
18
|
+
* @param sessionData - 服务器返回的 session 数据
|
|
19
|
+
* @returns 映射后的 SessionUser 对象,失败返回 null
|
|
12
20
|
*/
|
|
13
21
|
function extractUserData(sessionData) {
|
|
14
22
|
if (!sessionData || typeof sessionData !== "object")
|
|
15
23
|
return null;
|
|
16
24
|
const data = sessionData;
|
|
17
25
|
// 尝试从不同的数据结构中提取用户信息
|
|
18
|
-
// 优先使用标准格式:{session: {...}, user: {...}}
|
|
19
26
|
const rawUserData = data.user || // 标准格式
|
|
20
27
|
data.session?.user || // 嵌套格式
|
|
21
28
|
data.data?.user || // 包装格式
|
|
@@ -23,10 +30,13 @@ function extractUserData(sessionData) {
|
|
|
23
30
|
if (!rawUserData || typeof rawUserData !== "object")
|
|
24
31
|
return null;
|
|
25
32
|
const user = rawUserData;
|
|
26
|
-
// 提取 session
|
|
27
|
-
const
|
|
28
|
-
|
|
33
|
+
// 提取 session 相关数据(activeOrganizationId 和 activeTeamId 存储在 session 中)
|
|
34
|
+
const sessionInfo = data.session;
|
|
35
|
+
const sessionCreatedAt = sessionInfo?.createdAt
|
|
36
|
+
? toISOString(sessionInfo.createdAt)
|
|
29
37
|
: undefined;
|
|
38
|
+
const activeOrganizationId = sessionInfo?.activeOrganizationId;
|
|
39
|
+
const activeTeamId = sessionInfo?.activeTeamId;
|
|
30
40
|
return {
|
|
31
41
|
banExpires: user.banExpires,
|
|
32
42
|
banReason: user.banReason,
|
|
@@ -40,6 +50,8 @@ function extractUserData(sessionData) {
|
|
|
40
50
|
name: user.name,
|
|
41
51
|
role: user.role,
|
|
42
52
|
updatedAt: toISOString(user.updatedAt) ?? "",
|
|
53
|
+
activeOrganizationId,
|
|
54
|
+
activeTeamId,
|
|
43
55
|
};
|
|
44
56
|
}
|
|
45
57
|
/**
|
|
@@ -71,27 +83,35 @@ export function createAuthActions(authStore, tokenStorage, config, authClient) {
|
|
|
71
83
|
authStore.loading.set(!isLoaded);
|
|
72
84
|
},
|
|
73
85
|
/**
|
|
74
|
-
* 使用
|
|
86
|
+
* 使用 Bearer Token 获取 session
|
|
87
|
+
*
|
|
88
|
+
* 流程:
|
|
89
|
+
* 1. 保存 token 到 localStorage
|
|
90
|
+
* 2. 使用 Bearer Token 请求 session endpoint
|
|
91
|
+
* 3. 解析响应数据并提取用户信息
|
|
92
|
+
* 4. 更新 authStore 状态
|
|
93
|
+
*
|
|
94
|
+
* @param token - Bearer Token
|
|
75
95
|
*/
|
|
76
96
|
async fetchSessionWithToken(token) {
|
|
77
97
|
try {
|
|
78
98
|
if (!token) {
|
|
79
99
|
throw new Error("Token is required");
|
|
80
100
|
}
|
|
81
|
-
// 保存 token 到 localStorage
|
|
101
|
+
// 保存 token 到 localStorage(供 authClient 使用)
|
|
82
102
|
tokenStorage.save(token);
|
|
83
103
|
const endpoint = `${baseURL}${getSessionEndpoint}`;
|
|
84
104
|
const response = await fetch(endpoint, {
|
|
85
105
|
method: "GET",
|
|
86
106
|
headers: {
|
|
87
|
-
Authorization: `Bearer ${
|
|
107
|
+
Authorization: `Bearer ${token}`,
|
|
88
108
|
"Content-Type": "application/json",
|
|
89
109
|
},
|
|
90
110
|
});
|
|
91
|
-
const responseText = await response.text();
|
|
92
111
|
if (!response.ok) {
|
|
93
112
|
throw new Error(`Failed to fetch session: ${response.status}`);
|
|
94
113
|
}
|
|
114
|
+
const responseText = await response.text();
|
|
95
115
|
// 解析响应数据
|
|
96
116
|
let sessionData = null;
|
|
97
117
|
try {
|
|
@@ -100,7 +120,7 @@ export function createAuthActions(authStore, tokenStorage, config, authClient) {
|
|
|
100
120
|
}
|
|
101
121
|
}
|
|
102
122
|
catch (error) {
|
|
103
|
-
console.error("Failed to parse session response:", error);
|
|
123
|
+
console.error("[fetchSessionWithToken] Failed to parse session response:", error);
|
|
104
124
|
this.handleUnauthorized();
|
|
105
125
|
return;
|
|
106
126
|
}
|
|
@@ -113,12 +133,12 @@ export function createAuthActions(authStore, tokenStorage, config, authClient) {
|
|
|
113
133
|
authStore.loading.set(false);
|
|
114
134
|
}
|
|
115
135
|
else {
|
|
116
|
-
console.error("Invalid session data received");
|
|
136
|
+
console.error("[fetchSessionWithToken] Invalid session data received");
|
|
117
137
|
this.handleUnauthorized();
|
|
118
138
|
}
|
|
119
139
|
}
|
|
120
140
|
catch (error) {
|
|
121
|
-
console.error("Failed to fetch session:", error);
|
|
141
|
+
console.error("[fetchSessionWithToken] Failed to fetch session:", error);
|
|
122
142
|
this.handleUnauthorized();
|
|
123
143
|
}
|
|
124
144
|
},
|
package/dist/store/utils.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,37 +1,87 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 认证相关的类型定义
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* 会话用户信息
|
|
6
|
+
*
|
|
7
|
+
* 包含用户基本信息和当前活动的组织/团队上下文
|
|
8
|
+
*/
|
|
4
9
|
export type SessionUser = {
|
|
10
|
+
/** 当前活动的组织 ID */
|
|
11
|
+
activeOrganizationId?: string;
|
|
12
|
+
/** 当前活动的团队 ID */
|
|
13
|
+
activeTeamId?: string;
|
|
14
|
+
/** 禁用到期时间 */
|
|
5
15
|
banExpires?: string;
|
|
16
|
+
/** 禁用原因 */
|
|
6
17
|
banReason?: string;
|
|
18
|
+
/** 是否被禁用 */
|
|
7
19
|
banned?: boolean;
|
|
20
|
+
/** 用户创建时间 */
|
|
8
21
|
createdAt: string;
|
|
22
|
+
/** 用户邮箱 */
|
|
9
23
|
email: string;
|
|
24
|
+
/** 邮箱是否已验证 */
|
|
10
25
|
emailVerified: boolean;
|
|
26
|
+
/** 用户 ID */
|
|
11
27
|
id: string;
|
|
28
|
+
/** 用户头像 URL */
|
|
12
29
|
image?: string;
|
|
30
|
+
/** 最后登录时间 */
|
|
13
31
|
lastLoginAt?: string;
|
|
32
|
+
/** 用户名称 */
|
|
14
33
|
name: string;
|
|
34
|
+
/** 用户角色 */
|
|
15
35
|
role?: string;
|
|
36
|
+
/** 用户信息更新时间 */
|
|
16
37
|
updatedAt: string;
|
|
17
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Better Auth Session 对象
|
|
41
|
+
*
|
|
42
|
+
* 包含会话信息和关联的用户数据
|
|
43
|
+
*/
|
|
18
44
|
export type Session = {
|
|
45
|
+
/** 当前活动的组织 ID(存储在 session 中) */
|
|
46
|
+
activeOrganizationId?: string;
|
|
47
|
+
/** 当前活动的团队 ID(存储在 session 中) */
|
|
48
|
+
activeTeamId?: string;
|
|
49
|
+
/** 会话创建时间 */
|
|
19
50
|
createdAt: string;
|
|
51
|
+
/** 会话过期时间 */
|
|
20
52
|
expiresAt: string;
|
|
53
|
+
/** 会话 ID */
|
|
21
54
|
id: string;
|
|
55
|
+
/** 客户端 IP 地址 */
|
|
22
56
|
ipAddress?: string;
|
|
57
|
+
/** 会话 Token */
|
|
23
58
|
token: string;
|
|
59
|
+
/** 会话更新时间 */
|
|
24
60
|
updatedAt: string;
|
|
61
|
+
/** 关联的用户信息 */
|
|
25
62
|
user: SessionUser;
|
|
63
|
+
/** 客户端 User-Agent */
|
|
26
64
|
userAgent?: string;
|
|
65
|
+
/** 用户 ID */
|
|
27
66
|
userId: string;
|
|
28
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* 认证状态
|
|
70
|
+
*
|
|
71
|
+
* 存储在 Legend State 中的认证状态数据
|
|
72
|
+
*/
|
|
29
73
|
export interface AuthState {
|
|
74
|
+
/** 错误信息 */
|
|
30
75
|
error: string | null;
|
|
76
|
+
/** 是否已认证 */
|
|
31
77
|
isAuthenticated: boolean;
|
|
78
|
+
/** 是否已加载完成 */
|
|
32
79
|
isLoaded: boolean;
|
|
80
|
+
/** 是否正在加载 */
|
|
33
81
|
loading: boolean;
|
|
82
|
+
/** 认证 Token */
|
|
34
83
|
token: string | null;
|
|
84
|
+
/** 当前用户信息 */
|
|
35
85
|
user: SessionUser | null;
|
|
36
86
|
}
|
|
37
87
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,iBAAiB;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,eAAe;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,gCAAgC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gCAAgC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAA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