@lark-apaas/client-toolkit 1.2.44-alpha.0 → 1.2.44-alpha.2
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/lib/auth.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { AuthProvider, useAuth, Can, CanRole, useCan, AbilityContext, useUserPermissions, PermissionClient, ROLE_SUBJECT, } from '@lark-apaas/auth-sdk';
|
|
2
2
|
export type { AuthProviderProps, PermissionApiResponse, PermissionApiConfig, PermissionPointData, AuthSdkConfig, } from '@lark-apaas/auth-sdk';
|
|
3
|
+
export { authClient, AccountClient } from '@lark-apaas/auth-sdk';
|
|
4
|
+
export type { AccountClient as AuthClient, AccountServiceResponse, AccountServiceError, SearchParams, User, UserResponse, SignInRedirectionOptions, UserBaseInfo, UserInfoResponse, Avatar, } from '@lark-apaas/auth-sdk';
|
package/lib/auth.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AbilityContext, AuthProvider, Can, CanRole, PermissionClient, ROLE_SUBJECT, useAuth, useCan, useUserPermissions } from "@lark-apaas/auth-sdk";
|
|
2
|
-
export { AbilityContext, AuthProvider, Can, CanRole, PermissionClient, ROLE_SUBJECT, useAuth, useCan, useUserPermissions };
|
|
1
|
+
import { AbilityContext, AccountClient, AuthProvider, Can, CanRole, PermissionClient, ROLE_SUBJECT, authClient, useAuth, useCan, useUserPermissions } from "@lark-apaas/auth-sdk";
|
|
2
|
+
export { AbilityContext, AccountClient, AuthProvider, Can, CanRole, PermissionClient, ROLE_SUBJECT, authClient, useAuth, useCan, useUserPermissions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import react from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { authClient } from "@lark-apaas/auth-sdk";
|
|
4
4
|
import { UserSelectUI } from "./UserSelectUI/index.js";
|
|
5
5
|
const UserSelect = ({ mode = 'single', defaultValue, value, onChange, placeholder, fetchUsers })=>{
|
|
6
6
|
const normalizedIds = react.useMemo(()=>{
|
|
@@ -67,8 +67,7 @@ const UserSelect = ({ mode = 'single', defaultValue, value, onChange, placeholde
|
|
|
67
67
|
if (!normalizedIds.length) return void setUiValue(void 0);
|
|
68
68
|
const fetchProfiles = async ()=>{
|
|
69
69
|
try {
|
|
70
|
-
const
|
|
71
|
-
const response = await dataloom.service.user.getByIds(normalizedIds);
|
|
70
|
+
const response = await authClient.user.getByIds(normalizedIds);
|
|
72
71
|
const fetchedList = Array.isArray(response?.data) ? response?.data : Array.isArray(response?.data?.user_list) ? response?.data?.user_list : [];
|
|
73
72
|
const fetchedMap = new Map();
|
|
74
73
|
fetchedList.forEach((profile)=>{
|
|
@@ -115,8 +114,7 @@ const UserSelect = ({ mode = 'single', defaultValue, value, onChange, placeholde
|
|
|
115
114
|
const fetchUsersImpl = react.useCallback(async (search)=>{
|
|
116
115
|
if (fetchUsers) return fetchUsers(search);
|
|
117
116
|
try {
|
|
118
|
-
const
|
|
119
|
-
const { data } = await dataloom.service.user.search({
|
|
117
|
+
const { data } = await authClient.user.search({
|
|
120
118
|
name: search,
|
|
121
119
|
pageSize: 20
|
|
122
120
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
+
import { authClient } from "@lark-apaas/auth-sdk";
|
|
2
3
|
import { logger } from "../logger/index.js";
|
|
3
4
|
import { getCurrentUserProfile } from "../integrations/getCurrentUserProfile.js";
|
|
4
|
-
import { getDataloom } from "../integrations/dataloom.js";
|
|
5
5
|
import { isSparkRuntime } from "../utils/utils.js";
|
|
6
6
|
import { getAxiosForBackend } from "../utils/getAxiosForBackend.js";
|
|
7
7
|
function getNameFromArray(nameArray) {
|
|
@@ -35,8 +35,7 @@ const useCurrentUserProfile = ()=>{
|
|
|
35
35
|
useEffect(()=>{
|
|
36
36
|
let cancelled = false;
|
|
37
37
|
const fetchAndSetUserInfo = async ()=>{
|
|
38
|
-
const
|
|
39
|
-
const result = await dataloom?.service?.session?.getUserInfo();
|
|
38
|
+
const result = await authClient.session.getUserInfo();
|
|
40
39
|
if (cancelled) return;
|
|
41
40
|
const info = result?.data?.user_info;
|
|
42
41
|
const userName = getNameFromArray(info?.name);
|
package/lib/hooks/useLogout.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { authClient } from "@lark-apaas/auth-sdk";
|
|
3
3
|
function useLogout() {
|
|
4
4
|
const [isLoading, setIsLoading] = useState(false);
|
|
5
5
|
async function handlerLogout() {
|
|
6
6
|
if ('production' !== process.env.NODE_ENV) return void console.log('只有生产环境才执行登出');
|
|
7
7
|
setIsLoading(true);
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
await dataloom.service.session.signOut();
|
|
9
|
+
await authClient.session.signOut();
|
|
11
10
|
} catch (error) {
|
|
12
11
|
console.error('登出失败', error);
|
|
13
12
|
} finally{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { splitWorkspaceUrl } from "../utils/url.js";
|
|
2
2
|
import { createClient } from "@lark-apaas/dataloom";
|
|
3
|
+
import { authClient } from "@lark-apaas/auth-sdk";
|
|
3
4
|
import { getAppId } from "../utils/getAppId.js";
|
|
4
5
|
import { getAppPublished } from "../utils/getInitialInfo.js";
|
|
5
6
|
const createDataLoomClient = (url, pat)=>{
|
|
@@ -12,7 +13,11 @@ const createDataLoomClient = (url, pat)=>{
|
|
|
12
13
|
enableDataloomLog: 'production' !== process.env.NODE_ENV,
|
|
13
14
|
requestRateLimit: 'production' !== process.env.NODE_ENV ? 100 : void 0,
|
|
14
15
|
brandName: 'miaoda',
|
|
15
|
-
appId
|
|
16
|
+
appId,
|
|
17
|
+
accountServices: {
|
|
18
|
+
user: authClient.user,
|
|
19
|
+
session: authClient.session
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
});
|
|
18
23
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { authClient } from "@lark-apaas/auth-sdk";
|
|
2
2
|
const pendingRequests = new Map();
|
|
3
3
|
async function fetchUserProfilesByIds(ids) {
|
|
4
4
|
try {
|
|
5
|
-
const
|
|
6
|
-
if (!dataloom) throw new Error('Dataloom client is unavailable');
|
|
7
|
-
const response = await dataloom.service.user.getByIds(ids);
|
|
5
|
+
const response = await authClient.user.getByIds(ids);
|
|
8
6
|
return Array.isArray(response?.data) ? response.data : response?.data?.user_list || [];
|
|
9
7
|
} catch (error) {
|
|
10
8
|
console.error(`Failed to fetch profiles for user IDs ${ids.join(', ')}:`, error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.2.44-alpha.
|
|
3
|
+
"version": "1.2.44-alpha.2",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -99,9 +99,9 @@
|
|
|
99
99
|
"@ant-design/colors": "^7.2.1",
|
|
100
100
|
"@ant-design/cssinjs": "^1.24.0",
|
|
101
101
|
"@lark-apaas/aily-web-sdk": "^0.0.9",
|
|
102
|
-
"@lark-apaas/auth-sdk": "
|
|
102
|
+
"@lark-apaas/auth-sdk": "0.1.5-alpha.0",
|
|
103
103
|
"@lark-apaas/client-capability": "^0.1.6",
|
|
104
|
-
"@lark-apaas/dataloom": "
|
|
104
|
+
"@lark-apaas/dataloom": "0.1.2-alpha.2",
|
|
105
105
|
"@lark-apaas/internal-slardar": "^0.0.3",
|
|
106
106
|
"@lark-apaas/miaoda-inspector": "^1.0.23",
|
|
107
107
|
"@lark-apaas/observable-web": "^1.0.6",
|