@lark-apaas/client-toolkit-lite 1.1.16 → 1.1.18-alpha.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/dist/index.cjs +4 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -35
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -3235,41 +3235,12 @@ function getAxiosForBackend() {
|
|
|
3235
3235
|
__name(getAxiosForBackend, "getAxiosForBackend");
|
|
3236
3236
|
var axiosForBackend = getAxiosForBackend();
|
|
3237
3237
|
|
|
3238
|
-
// src/utils/url.ts
|
|
3239
|
-
function splitWorkspaceUrl(fullUrl) {
|
|
3240
|
-
try {
|
|
3241
|
-
const url = new URL(fullUrl);
|
|
3242
|
-
const pathParts = url.pathname.split("/");
|
|
3243
|
-
const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
|
|
3244
|
-
if (workspacesIndex === -1) {
|
|
3245
|
-
throw new Error("Invalid workspace URL format");
|
|
3246
|
-
}
|
|
3247
|
-
const basePathParts = pathParts.slice(0, workspacesIndex);
|
|
3248
|
-
const workspace = pathParts[workspacesIndex + 1];
|
|
3249
|
-
return {
|
|
3250
|
-
baseUrl: `${url.origin}${basePathParts.join("/")}`,
|
|
3251
|
-
workspace
|
|
3252
|
-
};
|
|
3253
|
-
} catch (error) {
|
|
3254
|
-
console.error("Error splitting workspace URL:", error);
|
|
3255
|
-
}
|
|
3256
|
-
return {
|
|
3257
|
-
baseUrl: fullUrl,
|
|
3258
|
-
// 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
|
|
3259
|
-
workspace: "workspace"
|
|
3260
|
-
};
|
|
3261
|
-
}
|
|
3262
|
-
__name(splitWorkspaceUrl, "splitWorkspaceUrl");
|
|
3263
|
-
|
|
3264
3238
|
// src/integrations/dataloom.ts
|
|
3265
3239
|
var import_dataloom = require("@lark-apaas/dataloom");
|
|
3266
3240
|
var import_auth_sdk3 = require("@lark-apaas/auth-sdk");
|
|
3267
|
-
var createDataLoomClient = /* @__PURE__ */ __name((
|
|
3268
|
-
const { baseUrl } = url ? splitWorkspaceUrl(url) : {
|
|
3269
|
-
baseUrl: ""
|
|
3270
|
-
};
|
|
3241
|
+
var createDataLoomClient = /* @__PURE__ */ __name(() => {
|
|
3271
3242
|
const appId = getAppId() ?? "";
|
|
3272
|
-
return (0, import_dataloom.createClient)(
|
|
3243
|
+
return (0, import_dataloom.createClient)({
|
|
3273
3244
|
global: {
|
|
3274
3245
|
enableDataloomLog: process.env.NODE_ENV !== "production",
|
|
3275
3246
|
requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
|
|
@@ -3291,10 +3262,8 @@ function getDataloom() {
|
|
|
3291
3262
|
if (pendingPromise3) {
|
|
3292
3263
|
return pendingPromise3;
|
|
3293
3264
|
}
|
|
3294
|
-
pendingPromise3 = getInitialInfo().then((
|
|
3295
|
-
|
|
3296
|
-
const DATALOOM_PAT = info?.app_runtime_extra?.token;
|
|
3297
|
-
dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
|
|
3265
|
+
pendingPromise3 = getInitialInfo().then(() => {
|
|
3266
|
+
dataloom = createDataLoomClient();
|
|
3298
3267
|
return dataloom;
|
|
3299
3268
|
}).finally(() => {
|
|
3300
3269
|
pendingPromise3 = null;
|