@lark-apaas/client-toolkit 1.2.28-alpha.62 → 1.2.28-alpha.64

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.
@@ -9,10 +9,6 @@ export type IUserProfile = {
9
9
  * inactive 2
10
10
  */
11
11
  status?: number;
12
- /**
13
- * 飞书 user_id
14
- */
15
- lark_user_id?: string;
16
12
  };
17
13
  export type IFileAttachment = {
18
14
  bucket_id: string;
package/lib/auth.d.ts CHANGED
@@ -1 +1,2 @@
1
- export { CanRole, AbilityContext, ROLE_SUBJECT, useAuth, } from '@lark-apaas/auth-sdk';
1
+ export { AuthProvider, useAuth, Can, CanRole, useCan, AbilityContext, useUserPermissions, PermissionClient, ROLE_SUBJECT, } from '@lark-apaas/auth-sdk';
2
+ export type { AuthProviderProps, PermissionApiResponse, PermissionApiConfig, PermissionPointData, AuthSdkConfig, } from '@lark-apaas/auth-sdk';
package/lib/auth.js CHANGED
@@ -1,2 +1,2 @@
1
- import { AbilityContext, CanRole, ROLE_SUBJECT, useAuth } from "@lark-apaas/auth-sdk";
2
- export { AbilityContext, CanRole, ROLE_SUBJECT, useAuth };
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 };
@@ -3,25 +3,11 @@ import { logger } from "../logger/index.js";
3
3
  import { getCurrentUserProfile } from "../integrations/getCurrentUserProfile.js";
4
4
  import { getDataloom } from "../integrations/dataloom.js";
5
5
  import { isSparkRuntime } from "../utils/utils.js";
6
- import { getAxiosForBackend } from "../utils/getAxiosForBackend.js";
7
6
  function getNameFromArray(nameArray) {
8
7
  if (!nameArray || 0 === nameArray.length) return;
9
8
  const chineseName = nameArray.find((item)=>2052 === item.language_code);
10
9
  return chineseName?.text ?? nameArray[0]?.text;
11
10
  }
12
- let _larkUserIdCache = null;
13
- let _larkUserIdPromise = null;
14
- function fetchLarkUserId() {
15
- if (null !== _larkUserIdCache) return Promise.resolve(_larkUserIdCache);
16
- if (_larkUserIdPromise) return _larkUserIdPromise;
17
- _larkUserIdPromise = getAxiosForBackend().get('/api/authnpaas/lark-user-id').then(({ data })=>{
18
- _larkUserIdCache = data?.lark_user_id || null;
19
- return _larkUserIdCache;
20
- }).catch(()=>null).finally(()=>{
21
- _larkUserIdPromise = null;
22
- });
23
- return _larkUserIdPromise;
24
- }
25
11
  function getCompatibilityUserProfile() {
26
12
  const userInfo = getCurrentUserProfile();
27
13
  return {
@@ -48,8 +34,6 @@ const useCurrentUserProfile = ()=>{
48
34
  userName: userName,
49
35
  userAvatar: info?.avatar?.image?.large
50
36
  };
51
- const larkUserId = await fetchLarkUserId();
52
- if (larkUserId) newUserInfo.lark_user_id = larkUserId;
53
37
  if ('development' === process.env.NODE_ENV) logger.info('MiaoDaMetaInfoChanged', newUserInfo);
54
38
  setUserInfo(newUserInfo);
55
39
  };
@@ -372,18 +372,7 @@ function initAxiosConfig(axiosInstance) {
372
372
  name: 'toolkit_axios_403_downgrade',
373
373
  categories: {
374
374
  url: String(error.config?.url || ''),
375
- method: String(error.config?.method || ''),
376
- ...'production' !== process.env.NODE_ENV && {
377
- responseData: (()=>{
378
- try {
379
- const data = error.response?.data;
380
- if (!data) return '';
381
- return 'string' == typeof data ? data.slice(0, 512) : JSON.stringify(data).slice(0, 512);
382
- } catch {
383
- return '';
384
- }
385
- })()
386
- }
375
+ method: String(error.config?.method || '')
387
376
  }
388
377
  });
389
378
  return error.response;
@@ -394,19 +383,7 @@ function initAxiosConfig(axiosInstance) {
394
383
  categories: {
395
384
  url: String(error.config?.url || ''),
396
385
  method: String(error.config?.method || ''),
397
- status: String(error.response?.status || ''),
398
- ...'production' !== process.env.NODE_ENV && {
399
- errorMessage: String(error.message || ''),
400
- responseData: (()=>{
401
- try {
402
- const data = error.response?.data;
403
- if (!data) return '';
404
- return 'string' == typeof data ? data.slice(0, 512) : JSON.stringify(data).slice(0, 512);
405
- } catch {
406
- return '';
407
- }
408
- })()
409
- }
386
+ status: String(error.response?.status || '')
410
387
  }
411
388
  });
412
389
  return Promise.reject(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.28-alpha.62",
3
+ "version": "1.2.28-alpha.64",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -100,7 +100,7 @@
100
100
  "@ant-design/cssinjs": "^1.24.0",
101
101
  "@data-loom/js": "0.4.13",
102
102
  "@lark-apaas/aily-web-sdk": "^0.0.7",
103
- "@lark-apaas/auth-sdk": "^0.1.3",
103
+ "@lark-apaas/auth-sdk": "0.1.0-alpha.85",
104
104
  "@lark-apaas/client-capability": "^0.1.6",
105
105
  "@lark-apaas/internal-slardar": "^0.0.3",
106
106
  "@lark-apaas/miaoda-inspector": "^1.0.22",