@lark-apaas/client-toolkit 1.2.35-alpha.5 → 1.2.35-alpha.7
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/integrations/dataloom.d.ts +1 -1
- package/lib/integrations/dataloom.js +3 -13
- package/lib/utils/url.d.ts +0 -4
- package/lib/utils/url.js +0 -22
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const createDataLoomClient: (url?: string, pat?: string) => import("@
|
|
1
|
+
declare const createDataLoomClient: (url?: string, pat?: string) => import("@lark-apaas/dataloom").DataloomClient;
|
|
2
2
|
/** 获取dataloom实例 */
|
|
3
3
|
export declare function getDataloom(): Promise<ReturnType<typeof createDataLoomClient>>;
|
|
4
4
|
export {};
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createClient } from "@data-loom/js";
|
|
1
|
+
import { createClient } from "@lark-apaas/dataloom";
|
|
3
2
|
import { getAppId } from "../utils/getAppId.js";
|
|
4
3
|
import { getAppPublished } from "../utils/getInitialInfo.js";
|
|
5
4
|
const createDataLoomClient = (url, pat)=>{
|
|
6
|
-
const { baseUrl, workspace } = url ? splitWorkspaceUrl(url) : {
|
|
7
|
-
baseUrl: '',
|
|
8
|
-
workspace: ''
|
|
9
|
-
};
|
|
10
5
|
const appId = getAppId();
|
|
11
|
-
return createClient(
|
|
6
|
+
return createClient(url ?? '', pat ?? '', {
|
|
12
7
|
global: {
|
|
13
8
|
enableDataloomLog: 'production' !== process.env.NODE_ENV,
|
|
14
9
|
requestRateLimit: 'production' !== process.env.NODE_ENV ? 100 : void 0,
|
|
15
10
|
brandName: 'miaoda',
|
|
16
|
-
appId
|
|
17
|
-
onError: (error, dataloomInstance)=>{
|
|
18
|
-
if (error?.status === 401) {
|
|
19
|
-
if (error?.code === 'k_ident_013001') dataloomInstance.service.session.redirectToLogin();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
11
|
+
appId
|
|
22
12
|
}
|
|
23
13
|
});
|
|
24
14
|
};
|
package/lib/utils/url.d.ts
CHANGED
package/lib/utils/url.js
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { logger } from "../logger/index.js";
|
|
2
|
-
function splitWorkspaceUrl(fullUrl) {
|
|
3
|
-
try {
|
|
4
|
-
const url = new URL(fullUrl);
|
|
5
|
-
const pathParts = url.pathname.split('/');
|
|
6
|
-
const workspacesIndex = pathParts.findIndex((part)=>'workspaces' === part);
|
|
7
|
-
if (-1 === workspacesIndex) throw new Error('Invalid workspace URL format');
|
|
8
|
-
const basePathParts = pathParts.slice(0, workspacesIndex);
|
|
9
|
-
const workspace = pathParts[workspacesIndex + 1];
|
|
10
|
-
return {
|
|
11
|
-
baseUrl: `${url.origin}${basePathParts.join('/')}`,
|
|
12
|
-
workspace
|
|
13
|
-
};
|
|
14
|
-
} catch (error) {
|
|
15
|
-
logger.error('Error splitting workspace URL:', error);
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
baseUrl: fullUrl,
|
|
19
|
-
workspace: 'workspace'
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export { splitWorkspaceUrl };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.2.35-alpha.
|
|
3
|
+
"version": "1.2.35-alpha.7",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -98,10 +98,10 @@
|
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@ant-design/colors": "^7.2.1",
|
|
100
100
|
"@ant-design/cssinjs": "^1.24.0",
|
|
101
|
-
"@
|
|
102
|
-
"@lark-apaas/aily-web-sdk": "0.0.2-alpha.19",
|
|
101
|
+
"@lark-apaas/aily-web-sdk": "^0.0.9",
|
|
103
102
|
"@lark-apaas/auth-sdk": "^0.1.4",
|
|
104
103
|
"@lark-apaas/client-capability": "^0.1.6",
|
|
104
|
+
"@lark-apaas/dataloom": "0.1.1-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",
|