@lark-apaas/client-toolkit 1.2.46-alpha.3 → 1.2.46-beta.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/lib/auth.d.ts CHANGED
@@ -1,4 +1,2 @@
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, 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
+ 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,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import react from "react";
3
- import { authClient } from "@lark-apaas/auth-sdk";
3
+ import { getDataloom } from "../../integrations/dataloom.js";
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,7 +67,8 @@ 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 response = await authClient.user.getByIds(normalizedIds);
70
+ const dataloom = await getDataloom();
71
+ const response = await dataloom.service.user.getByIds(normalizedIds);
71
72
  const fetchedList = Array.isArray(response?.data) ? response?.data : Array.isArray(response?.data?.user_list) ? response?.data?.user_list : [];
72
73
  const fetchedMap = new Map();
73
74
  fetchedList.forEach((profile)=>{
@@ -114,7 +115,8 @@ const UserSelect = ({ mode = 'single', defaultValue, value, onChange, placeholde
114
115
  const fetchUsersImpl = react.useCallback(async (search)=>{
115
116
  if (fetchUsers) return fetchUsers(search);
116
117
  try {
117
- const { data } = await authClient.user.search({
118
+ const dataloom = await getDataloom();
119
+ const { data } = await dataloom.service.user.search({
118
120
  name: search,
119
121
  pageSize: 20
120
122
  });
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
- import { authClient } from "@lark-apaas/auth-sdk";
3
2
  import { logger } from "../logger/index.js";
4
3
  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,7 +35,8 @@ const useCurrentUserProfile = ()=>{
35
35
  useEffect(()=>{
36
36
  let cancelled = false;
37
37
  const fetchAndSetUserInfo = async ()=>{
38
- const result = await authClient.session.getUserInfo();
38
+ const dataloom = await getDataloom();
39
+ const result = await dataloom?.service?.session?.getUserInfo();
39
40
  if (cancelled) return;
40
41
  const info = result?.data?.user_info;
41
42
  const userName = getNameFromArray(info?.name);
@@ -1,12 +1,13 @@
1
1
  import { useState } from "react";
2
- import { authClient } from "@lark-apaas/auth-sdk";
2
+ import { getDataloom } from "../integrations/dataloom.js";
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
- await authClient.session.signOut();
9
+ const dataloom = await getDataloom();
10
+ await dataloom.service.session.signOut();
10
11
  } catch (error) {
11
12
  console.error('登出失败', error);
12
13
  } finally{
@@ -1,6 +1,5 @@
1
1
  import { splitWorkspaceUrl } from "../utils/url.js";
2
2
  import { createClient } from "@lark-apaas/dataloom";
3
- import { authClient } from "@lark-apaas/auth-sdk";
4
3
  import { getAppId } from "../utils/getAppId.js";
5
4
  import { getAppPublished } from "../utils/getInitialInfo.js";
6
5
  const createDataLoomClient = (url, pat)=>{
@@ -13,11 +12,7 @@ const createDataLoomClient = (url, pat)=>{
13
12
  enableDataloomLog: 'production' !== process.env.NODE_ENV,
14
13
  requestRateLimit: 'production' !== process.env.NODE_ENV ? 100 : void 0,
15
14
  brandName: 'miaoda',
16
- appId,
17
- accountServices: {
18
- user: authClient.user,
19
- session: authClient.session
20
- }
15
+ appId
21
16
  }
22
17
  });
23
18
  };
@@ -1,8 +1,10 @@
1
- import { authClient } from "@lark-apaas/auth-sdk";
1
+ import { getDataloom } from "../integrations/dataloom.js";
2
2
  const pendingRequests = new Map();
3
3
  async function fetchUserProfilesByIds(ids) {
4
4
  try {
5
- const response = await authClient.user.getByIds(ids);
5
+ const dataloom = await getDataloom();
6
+ if (!dataloom) throw new Error('Dataloom client is unavailable');
7
+ const response = await dataloom.service.user.getByIds(ids);
6
8
  return Array.isArray(response?.data) ? response.data : response?.data?.user_list || [];
7
9
  } catch (error) {
8
10
  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.46-alpha.3",
3
+ "version": "1.2.46-beta.0",
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.11",
102
- "@lark-apaas/auth-sdk": "0.1.5-alpha.2",
103
- "@lark-apaas/client-capability": "^0.1.6",
104
- "@lark-apaas/dataloom": "0.1.2-alpha.4",
102
+ "@lark-apaas/auth-sdk": "^0.1.4",
103
+ "@lark-apaas/client-capability": "0.1.7-beta.0",
104
+ "@lark-apaas/dataloom": "^0.1.1",
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",