weaver-work-cli 0.1.33 → 0.1.38
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/chunks/{archive-FVFY6GZN.js → archive-PDV724YK.js} +5 -4
- package/dist/chunks/{archive-oa-NW3OD4UV.js → archive-oa-4XE4MNXQ.js} +4 -3
- package/dist/chunks/{asset-7QJKMIDV.js → asset-PDL2QE2N.js} +8 -7
- package/dist/chunks/{attachment-content-OSAVA6K3.js → attachment-content-MDDGOE5E.js} +3 -3
- package/dist/chunks/{blog-I7SDPNW4.js → blog-UYR3EUXW.js} +5 -4
- package/dist/chunks/{caizhilian-O37ZIQNY.js → caizhilian-LG2X5NMF.js} +5 -4
- package/dist/chunks/{calendar-7KXE4ED3.js → calendar-FG4BAZHE.js} +4 -3
- package/dist/chunks/{chunk-Q6LWB5HX.js → chunk-6FTTSA45.js} +4 -3
- package/dist/chunks/{chunk-MQ2I5AA3.js → chunk-6LTFIFLM.js} +3 -2
- package/dist/chunks/{chunk-WRRJ4GG2.js → chunk-CORFRD7Q.js} +4 -3
- package/dist/chunks/{chunk-WY74UBJ6.js → chunk-DMV2TOMH.js} +2194 -240
- package/dist/chunks/{chunk-MEEFGWTM.js → chunk-ELYDWBZJ.js} +135 -10
- package/dist/chunks/{chunk-EEWPQE3O.js → chunk-FUWVHMVV.js} +7 -6
- package/dist/chunks/{chunk-HEL5XTYI.js → chunk-GGJFMNJM.js} +26 -4
- package/dist/chunks/{chunk-KAS45KNR.js → chunk-IZUDA353.js} +1 -1
- package/dist/chunks/{chunk-2FLWXFVS.js → chunk-J7USS3ED.js} +4 -4
- package/dist/chunks/{chunk-IHUYP6LO.js → chunk-JSMFPO43.js} +1 -1
- package/dist/chunks/{chunk-RBGOMK4Y.js → chunk-KKRL3REV.js} +5 -4
- package/dist/chunks/{chunk-OCU4RLHC.js → chunk-NI6GIPIM.js} +195 -36
- package/dist/chunks/{chunk-PRHJGPMA.js → chunk-NR6RKXPA.js} +2 -2
- package/dist/chunks/{chunk-D223PTXU.js → chunk-OJQUJZQF.js} +33 -7
- package/dist/chunks/{chunk-ILMBNVSG.js → chunk-UJJD4QWF.js} +4 -3
- package/dist/chunks/{chunk-6ATGWRZM.js → chunk-UZZBA6PV.js} +177 -14
- package/dist/chunks/{chunk-GFPXQIY2.js → chunk-VRYHGG6O.js} +2 -2
- package/dist/chunks/{chunk-NHA62QD7.js → chunk-XJY7G4DD.js} +3 -3
- package/dist/chunks/{chunk-VBCFFFGT.js → chunk-Z32KWY6G.js} +4 -1
- package/dist/chunks/{conflict-SFNEVJY5.js → conflict-BQZEQ4SP.js} +2 -2
- package/dist/chunks/contract-XIRAFTEV.js +9111 -0
- package/dist/chunks/{cowork-CKWYHXYB.js → cowork-BLG62BL2.js} +46 -26
- package/dist/chunks/{ebuilder-form-KOLJRVZD.js → ebuilder-form-NUKG5QW4.js} +3 -3
- package/dist/chunks/{ehr-WFOC3B4D.js → ehr-2STW5ILH.js} +174 -10
- package/dist/chunks/{esb-LJZTN663.js → esb-UUDQUNKY.js} +4 -4
- package/dist/chunks/{fna-F7QRIIZC.js → fna-6RCY4NU5.js} +15 -9
- package/dist/chunks/{host-VQ6JJXGQ.js → host-7RXEDMAH.js} +3 -3
- package/dist/chunks/{host-KXPTEWFS.js → host-EJZFROU3.js} +3 -3
- package/dist/chunks/{host-BCGUVEWX.js → host-FWDOSRH5.js} +3 -3
- package/dist/chunks/{host-DGE2TZD4.js → host-RHM3NPXV.js} +3 -3
- package/dist/chunks/{host-BQBRHVR3.js → host-UFF33TWJ.js} +3 -3
- package/dist/chunks/{hrm-NI6XAKW5.js → hrm-PKJ6ELSH.js} +3 -3
- package/dist/chunks/{im-7TRTF3KT.js → im-YJAXS7CO.js} +3 -3
- package/dist/chunks/{invoice-AOXWJKYT.js → invoice-HWVSXGX6.js} +3 -3
- package/dist/chunks/{jiuchuanhui-7NQWEZAW.js → jiuchuanhui-L7VKILZB.js} +4 -3
- package/dist/chunks/{lazy-dispatch-RNS4EE4S.js → lazy-dispatch-NMYEIHRH.js} +4 -4
- package/dist/chunks/{mail-VDHJAB4O.js → mail-B42RRU7G.js} +46 -24
- package/dist/chunks/{meeting-GA7XCNNP.js → meeting-CFYVBJSS.js} +77 -12
- package/dist/chunks/{okr-TQIRERPQ.js → okr-GCLF6V7W.js} +4 -3
- package/dist/chunks/{plan-4RY4LN2P.js → plan-ZVL7GBRI.js} +4 -3
- package/dist/chunks/{project-D6XT2OC5.js → project-4YWAAE2K.js} +4 -3
- package/dist/chunks/{registry-QKMI43Q6.js → registry-EP4VTHZS.js} +8 -8
- package/dist/chunks/{registry-JHRIDQ3A.js → registry-FRJ6H7BT.js} +4 -4
- package/dist/chunks/{registry-VOGKFFTR.js → registry-SG2PGVCF.js} +2 -2
- package/dist/chunks/{room-recommend-D4EUOOWY.js → room-recommend-R3JVUUAC.js} +4 -4
- package/dist/chunks/{schedule-XPFBHPCV.js → schedule-NIJBTYDO.js} +4 -4
- package/dist/chunks/{workflow-HLBZRWIY.js → workflow-BB24DFBY.js} +11 -4
- package/dist/index.js +31 -26
- package/dist/internal/e10/auth-recovery.js +114 -1
- package/dist/internal/e10/client.js +16 -2
- package/dist/internal/e10/fetch-timing.js +31 -0
- package/dist/internal/e10/request-runtime.js +108 -7
- package/dist/shortcuts/archive/host.js +3 -2
- package/dist/shortcuts/archive-oa/host.js +2 -1
- package/dist/shortcuts/asset/host.js +6 -5
- package/dist/shortcuts/blog/host.js +3 -2
- package/dist/shortcuts/caizhilian/host.js +3 -2
- package/dist/shortcuts/calendar/host.js +2 -1
- package/dist/shortcuts/contract/host.js +2 -1
- package/dist/shortcuts/cowork/host.js +10 -1
- package/dist/shortcuts/cowork/operations/types.js +17 -2
- package/dist/shortcuts/ebuilder-form/host.js +3 -1
- package/dist/shortcuts/ehr/host.js +2 -1
- package/dist/shortcuts/ehr/operations/recruit-write.js +35 -0
- package/dist/shortcuts/ehr/operations/recruit.js +147 -0
- package/dist/shortcuts/esb/host.js +2 -1
- package/dist/shortcuts/fna/host.js +2 -1
- package/dist/shortcuts/fna/operations/expense-chart.js +19 -7
- package/dist/shortcuts/hrm/host.js +2 -1
- package/dist/shortcuts/im/host.js +3 -2
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/host.js +5 -4
- package/dist/shortcuts/jiuchuanhui/host.js +2 -1
- package/dist/shortcuts/mail/host.js +10 -1
- package/dist/shortcuts/mail/operations/types.js +17 -2
- package/dist/shortcuts/meeting/host.js +3 -2
- package/dist/shortcuts/meeting/index.js +79 -1
- package/dist/shortcuts/meeting/invitation/text.js +71 -0
- package/dist/shortcuts/meeting/manifest.js +10 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -0
- package/dist/shortcuts/meeting/operations/eb/conflict.js +6 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +2105 -169
- package/dist/shortcuts/meeting/operations/eb/crm-search.js +478 -0
- package/dist/shortcuts/meeting/operations/eb/factory.js +161 -8
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +36 -2
- package/dist/shortcuts/meeting/operations/eb-fallback.js +4 -0
- package/dist/shortcuts/meeting/operations/env.js +6 -0
- package/dist/shortcuts/meeting/operations/invitation.js +200 -28
- package/dist/shortcuts/okr/host.js +2 -1
- package/dist/shortcuts/plan/host.js +2 -1
- package/dist/shortcuts/project/host.js +2 -1
- package/dist/shortcuts/workflow/endpoints.js +8 -3
- package/dist/shortcuts/workflow/operations/form.js +341 -36
- package/dist/shortcuts/workflow/operations.js +23 -1
- package/docs/ehr.md +1 -1
- package/docs/fna.md +2 -1
- package/package.json +1 -1
- package/skill-template/business-info.json +18 -0
- package/skill-template/domains/cowork.md +14 -0
- package/skills/weaver-e10-cowork/SKILL.md +101 -0
- package/skills/weaver-e10-cowork/references/cowork-read.md +90 -0
- package/skills/weaver-e10-cowork/references/cowork-write.md +131 -0
- package/skills/weaver-e10-cowork/references/safety-boundaries.md +45 -0
- package/skills/weaver-e10-jucailin/SKILL.md +21 -3
- package/skills/weaver-e10-jucailin/references/recruit-read.md +25 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +13 -0
- package/skills/weaver-e10-jucailin/references/salary.md +15 -11
- package/skills/weaver-e10-mail/SKILL.md +12 -9
- package/skills/weaver-e10-meeting/SKILL.md +499 -300
- package/skills/weaver-e10-meeting/references/meeting-eb.md +334 -0
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +64 -6
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-qiyecheng/SKILL.md +5 -2
- package/skills/weaver-e10-qiyecheng/references/catalog.md +2 -2
- package/skills/weaver-e10-qiyecheng/references/expense-chart.md +15 -1
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +22 -21
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
|
@@ -21,8 +21,10 @@ import {
|
|
|
21
21
|
} from "./chunk-AJ62BGAW.js";
|
|
22
22
|
import {
|
|
23
23
|
E10_REAUTH_GUIDANCE,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
createFetchTimingSink,
|
|
25
|
+
hasXiaoEEnv,
|
|
26
|
+
runWithFetchTiming
|
|
27
|
+
} from "./chunk-OJQUJZQF.js";
|
|
26
28
|
|
|
27
29
|
// src/shortcuts/workflow/operations/form.ts
|
|
28
30
|
import { randomUUID } from "node:crypto";
|
|
@@ -341,9 +343,9 @@ var FORM_ENDPOINTS = {
|
|
|
341
343
|
tenantSetting: "/api/file/tenant/setting"
|
|
342
344
|
};
|
|
343
345
|
var AJAX_QUERY = { sf_request_type: "ajax" };
|
|
344
|
-
function formApiUrl(path, relateType) {
|
|
346
|
+
function formApiUrl(path, relateType, ebPrefix = "/api/ebuilder/flow/") {
|
|
345
347
|
if (String(relateType || "").trim() === "WEA_EBUILDER") {
|
|
346
|
-
return path.replace("/api/workflow/core/",
|
|
348
|
+
return path.replace("/api/workflow/core/", ebPrefix);
|
|
347
349
|
}
|
|
348
350
|
return path;
|
|
349
351
|
}
|
|
@@ -5446,7 +5448,8 @@ function extractFields(layoutData, requiredMap, disableEditMap, displayMap) {
|
|
|
5446
5448
|
const name = String(option.name ?? option.content ?? "").trim();
|
|
5447
5449
|
if (optionId && name) options.push({ id: optionId, name });
|
|
5448
5450
|
}
|
|
5449
|
-
const
|
|
5451
|
+
const componentBase = normalized.replace(/component$/, "");
|
|
5452
|
+
const isBrowser = Object.keys(browserType).length > 0 || BROWSER_COMPONENTS.has(normalized) || BROWSER_COMPONENTS.has(componentBase);
|
|
5450
5453
|
const isSelect = SELECT_COMPONENTS.has(normalized) || options.length > 0;
|
|
5451
5454
|
result.push({
|
|
5452
5455
|
id: fieldId,
|
|
@@ -6037,7 +6040,20 @@ async function resolveCreateWorkflow(rawWorkflow, env) {
|
|
|
6037
6040
|
throw workflowClarificationError(
|
|
6038
6041
|
"workflow",
|
|
6039
6042
|
"",
|
|
6040
|
-
"\u8981\u53D1\u8D77\u54EA\u4E2A\u6D41\u7A0B\uFF1F\u8BF7\u63D0\u4F9B\u8BE5\u6D41\u7A0B\u7684\u5B8C\u6574\u540D\u79F0\uFF08\u6216\u5176\u5B83\u53EF\u7528\u4E8E\u68C0\u7D22\u7684\u5173\u952E\u8BCD\uFF09\u540E\u518D\u7EE7\u7EED\u3002"
|
|
6043
|
+
"\u8981\u53D1\u8D77\u54EA\u4E2A\u6D41\u7A0B\uFF1F\u8BF7\u63D0\u4F9B\u8BE5\u6D41\u7A0B\u7684\u5B8C\u6574\u540D\u79F0\uFF08\u6216\u5176\u5B83\u53EF\u7528\u4E8E\u68C0\u7D22\u7684\u5173\u952E\u8BCD\uFF09\u540E\u518D\u7EE7\u7EED\u3002",
|
|
6044
|
+
[],
|
|
6045
|
+
{
|
|
6046
|
+
clarificationReason: "workflow_required",
|
|
6047
|
+
missingInput: ["workflow"],
|
|
6048
|
+
requiredInput: {
|
|
6049
|
+
workflow: {
|
|
6050
|
+
required: true,
|
|
6051
|
+
type: "string | string[]",
|
|
6052
|
+
description: "\u8981\u53D1\u8D77\u7684\u5DE5\u4F5C\u6D41\uFF1A\u5B8C\u6574\u540D\u79F0\u3001\u540D\u79F0\u5173\u952E\u8BCD\uFF0C\u6216\u300C\u540D\u79F0(ID)\u300D\uFF1B\u7EAF\u6570\u5B57\u6309\u5DE5\u4F5C\u6D41 ID \u5904\u7406\u3002",
|
|
6053
|
+
example: ["\u8D39\u7528\u62A5\u9500"]
|
|
6054
|
+
}
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6041
6057
|
);
|
|
6042
6058
|
}
|
|
6043
6059
|
const explicitIds = /* @__PURE__ */ new Set();
|
|
@@ -6207,15 +6223,15 @@ function singleExplicitWorkflowId(rawWorkflow) {
|
|
|
6207
6223
|
const parsed = parseNameWithId(terms[0]);
|
|
6208
6224
|
return parsed.id ?? (/^[0-9]+$/.test(terms[0]) ? terms[0] : "");
|
|
6209
6225
|
}
|
|
6210
|
-
async function loadCreateFormPack(workflowId, env) {
|
|
6226
|
+
async function loadCreateFormPack(workflowId, env, options = {}) {
|
|
6211
6227
|
const [{ data }, workflowMemory] = await Promise.all([
|
|
6212
|
-
buildCreateFormData(workflowId, env),
|
|
6228
|
+
buildCreateFormData(workflowId, env, options),
|
|
6213
6229
|
// 记忆读取是 best-effort(内部全 catch),不会把表单载入的错误顶掉。
|
|
6214
6230
|
fetchWorkflowMemory(workflowId, env)
|
|
6215
6231
|
]);
|
|
6216
6232
|
return { data, workflowMemory };
|
|
6217
6233
|
}
|
|
6218
|
-
async function prepareCreateFormPayload(args, env) {
|
|
6234
|
+
async function prepareCreateFormPayload(args, env, options = {}) {
|
|
6219
6235
|
const authStartedAt = Date.now();
|
|
6220
6236
|
await env.host.getSession();
|
|
6221
6237
|
const authMs = Date.now() - authStartedAt;
|
|
@@ -6224,10 +6240,10 @@ async function prepareCreateFormPayload(args, env) {
|
|
|
6224
6240
|
const explicitId = singleExplicitWorkflowId(args.workflow);
|
|
6225
6241
|
if (explicitId) {
|
|
6226
6242
|
target = { id: explicitId, name: "", source: "workflowId" };
|
|
6227
|
-
pack = await loadCreateFormPack(explicitId, env);
|
|
6243
|
+
pack = await loadCreateFormPack(explicitId, env, options);
|
|
6228
6244
|
} else {
|
|
6229
6245
|
target = await resolveCreateWorkflow(args.workflow, env);
|
|
6230
|
-
pack = await loadCreateFormPack(target.id, env);
|
|
6246
|
+
pack = await loadCreateFormPack(target.id, env, options);
|
|
6231
6247
|
}
|
|
6232
6248
|
const fullPayload = {
|
|
6233
6249
|
...pack.data,
|
|
@@ -6277,11 +6293,13 @@ async function commandCreateForm(args, env) {
|
|
|
6277
6293
|
};
|
|
6278
6294
|
return workflowSuccess("workflow.createForm", result);
|
|
6279
6295
|
}
|
|
6280
|
-
async function buildCreateFormData(workflowId, env) {
|
|
6296
|
+
async function buildCreateFormData(workflowId, env, options = {}) {
|
|
6297
|
+
const detailMark = options.detailMark === "isDetail" ? "isDetail" : "subFormId";
|
|
6298
|
+
const getHistory = options.getHistory !== false;
|
|
6281
6299
|
const query = { workflowId, isCreate: 1, ...AJAX_QUERY };
|
|
6282
6300
|
const body = { workflowId, isCreate: 1, isMobile: 0 };
|
|
6283
|
-
const historyListSnapshot = fetchHistoryListSnapshot(env, { workflowId }).catch(() => null);
|
|
6284
|
-
const historyDetails = historyListSnapshot.then(async (snapshot) => snapshot && snapshot.requestIds.length ? prefetchHistoryDetails(env, snapshot) : null);
|
|
6301
|
+
const historyListSnapshot = getHistory ? fetchHistoryListSnapshot(env, { workflowId }).catch(() => null) : Promise.resolve(null);
|
|
6302
|
+
const historyDetails = getHistory ? historyListSnapshot.then(async (snapshot) => snapshot && snapshot.requestIds.length ? prefetchHistoryDetails(env, snapshot) : null) : Promise.resolve(null);
|
|
6285
6303
|
historyDetails.catch(() => {
|
|
6286
6304
|
});
|
|
6287
6305
|
const isXiaoE = hasXiaoEEnv(env.ctx.env, env.ctx.getGlobalOptions?.());
|
|
@@ -6361,6 +6379,24 @@ async function buildCreateFormData(workflowId, env) {
|
|
|
6361
6379
|
if (compsFieldIds.size && !String(f.subFormId ?? "").trim() && !compsFieldIds.has(fid)) continue;
|
|
6362
6380
|
visibleFields.push(f);
|
|
6363
6381
|
}
|
|
6382
|
+
const hiddenBySubform = /* @__PURE__ */ new Map();
|
|
6383
|
+
for (const f of fields) {
|
|
6384
|
+
const fid = String(f.id ?? "");
|
|
6385
|
+
const sid = String(f.subFormId ?? "").trim();
|
|
6386
|
+
if (!sid || !hiddenCellIds.has(fid)) continue;
|
|
6387
|
+
hiddenBySubform.set(sid, (hiddenBySubform.get(sid) || 0) + 1);
|
|
6388
|
+
}
|
|
6389
|
+
const survivingSubforms = new Set(
|
|
6390
|
+
visibleFields.map((f) => String(f.subFormId ?? "").trim()).filter(Boolean)
|
|
6391
|
+
);
|
|
6392
|
+
const invisibleSubformWarnings = [];
|
|
6393
|
+
for (const [sid, count] of hiddenBySubform) {
|
|
6394
|
+
if (survivingSubforms.has(sid)) continue;
|
|
6395
|
+
invisibleSubformWarnings.push(
|
|
6396
|
+
`\u660E\u7EC6\u8868 ${sid} \u7684 ${count} \u4E2A\u5B57\u6BB5\u5168\u90E8\u88AB\u5224\u4E3A\u300C\u4E0D\u53EF\u89C1\u300D\uFF08\u8BE5\u660E\u7EC6\u8868\u6240\u5728\u7684\u884C/\u5217\u5728\u8868\u5355\u5E03\u5C40\u91CC\u662F\u9690\u85CF\u7684\uFF09\uFF0C\u56E0\u6B64\u6CA1\u6709\u51FA\u73B0\u5728\u5B57\u6BB5\u6E05\u5355\u91CC\u3002\u8981\u4E48\u5728\u8868\u5355\u8BBE\u8BA1\u5668\u91CC\u628A\u660E\u7EC6\u8868\u632A\u5230\u53EF\u89C1\u884C\uFF0C\u8981\u4E48\u53D6\u6D88\u9690\u85CF\u5B83\u6240\u5728\u7684\u884C/\u5217\uFF0C\u7136\u540E\u91CD\u65B0\u8F7D\u5165\u8868\u5355\u3002`
|
|
6397
|
+
);
|
|
6398
|
+
}
|
|
6399
|
+
let layoutWarning = invisibleSubformWarnings.length ? invisibleSubformWarnings.join("\uFF1B") : null;
|
|
6364
6400
|
const defaults = normalizeDefaults(layoutData.defaultDetails);
|
|
6365
6401
|
const systemFieldValues = _normalizeSystemFieldValues(layoutData.businessOperatorObj);
|
|
6366
6402
|
let linkageActions = Array.isArray(layoutData.linkageActions) ? layoutData.linkageActions : [];
|
|
@@ -6402,6 +6438,33 @@ async function buildCreateFormData(workflowId, env) {
|
|
|
6402
6438
|
}
|
|
6403
6439
|
}
|
|
6404
6440
|
const folderOptionValues = _mainValueMap(defaults);
|
|
6441
|
+
const conditionalHiddenSubforms = /* @__PURE__ */ new Set();
|
|
6442
|
+
const conditionalMainFields = /* @__PURE__ */ new Set();
|
|
6443
|
+
const conditionalHints = collectDetailShowLinkages(layoutData.viewLinkages, fields);
|
|
6444
|
+
const fieldShowIds = collectFieldShowLinkageIds(layoutData.viewLinkages);
|
|
6445
|
+
for (const fid of Array.from(mainHidden)) {
|
|
6446
|
+
if (!fieldShowIds.has(fid)) continue;
|
|
6447
|
+
if (hiddenCellIds.has(fid)) continue;
|
|
6448
|
+
const target = visibleFields.find((f) => String(f.id ?? "") === fid);
|
|
6449
|
+
if (!target) continue;
|
|
6450
|
+
conditionalMainFields.add(fid);
|
|
6451
|
+
mainHidden.delete(fid);
|
|
6452
|
+
invisibleSubformWarnings.push(
|
|
6453
|
+
`\u5B57\u6BB5\u300C${target.name}\u300D(${fid}) \u56E0\u663E\u793A\u8054\u52A8\u9690\u85CF\uFF08\u8BE5\u5B57\u6BB5\u672C\u8EAB\u662F\u89E6\u53D1\u5B57\u6BB5\uFF09\uFF0C\u5DF2\u7167\u5E38\u4E0B\u53D1\u5E76\u6807 conditional: true`
|
|
6454
|
+
);
|
|
6455
|
+
}
|
|
6456
|
+
for (const sid of Array.from(hiddenSubforms)) {
|
|
6457
|
+
const hint = conditionalHints.get(sid);
|
|
6458
|
+
if (!hint) continue;
|
|
6459
|
+
const usable = visibleFields.some((f) => String(f.subFormId ?? "") === sid && !hiddenCellIds.has(String(f.id ?? "")));
|
|
6460
|
+
if (!usable) continue;
|
|
6461
|
+
conditionalHiddenSubforms.add(sid);
|
|
6462
|
+
hiddenSubforms.delete(sid);
|
|
6463
|
+
invisibleSubformWarnings.push(
|
|
6464
|
+
`\u660E\u7EC6\u8868 ${sid}${hint.tableName ? `\uFF08${hint.tableName}\uFF09` : ""} \u56E0\u663E\u793A\u8054\u52A8\u9690\u85CF\uFF0C\u89E6\u53D1\u5B57\u6BB5\uFF1A${hint.triggerNames.join("\u3001") || hint.triggerIds.join("\u3001")}\u3002\u8BE5\u8868\u5B57\u6BB5\u5DF2\u7167\u5E38\u4E0B\u53D1\uFF08\u6807 conditional: true\uFF09\uFF0C\u628A\u89E6\u53D1\u5B57\u6BB5\u586B\u4E0A\u540E\u8868\u5355\u91CC\u5C31\u4F1A\u663E\u793A\uFF1B\u4E0D\u8981\u56DE\u300C\u8868\u5355\u91CC\u6CA1\u6709\u8FD9\u5F20\u660E\u7EC6\u8868\u300D\u3002`
|
|
6465
|
+
);
|
|
6466
|
+
}
|
|
6467
|
+
layoutWarning = invisibleSubformWarnings.length ? invisibleSubformWarnings.join("\uFF1B") : null;
|
|
6405
6468
|
for (const field of visibleFields) {
|
|
6406
6469
|
const fieldId = String(field.id ?? "");
|
|
6407
6470
|
const subFormId = String(field.subFormId ?? "");
|
|
@@ -6457,7 +6520,13 @@ async function buildCreateFormData(workflowId, env) {
|
|
|
6457
6520
|
if (!modelFieldIds.has(String(field.id ?? ""))) continue;
|
|
6458
6521
|
const slimSubFormId = String(field.subFormId ?? "");
|
|
6459
6522
|
const item = { id: field.id, name: field.name };
|
|
6460
|
-
if (
|
|
6523
|
+
if (detailMark === "isDetail") {
|
|
6524
|
+
if (slimSubFormId) item.isDetail = true;
|
|
6525
|
+
} else if (slimSubFormId) {
|
|
6526
|
+
item.subFormId = slimSubFormId;
|
|
6527
|
+
}
|
|
6528
|
+
if (slimSubFormId && conditionalHiddenSubforms.has(slimSubFormId)) item.conditional = true;
|
|
6529
|
+
if (!slimSubFormId && conditionalMainFields.has(String(field.id ?? ""))) item.conditional = true;
|
|
6461
6530
|
item.componentKey = field.componentKey;
|
|
6462
6531
|
const initialValue = initialValueByFieldId.get(String(field.id ?? ""));
|
|
6463
6532
|
if (initialValue !== void 0) item.initialValue = initialValue;
|
|
@@ -6492,8 +6561,8 @@ async function buildCreateFormData(workflowId, env) {
|
|
|
6492
6561
|
}
|
|
6493
6562
|
if (String(field.componentKey ?? "").toLowerCase() === "textarea" && field.richEditor) item.componentKey = "RichText";
|
|
6494
6563
|
if (String(field.format ?? "").trim()) item.format = String(field.format).trim();
|
|
6495
|
-
const
|
|
6496
|
-
if (
|
|
6564
|
+
const options2 = field.options || [];
|
|
6565
|
+
if (options2.length) item.options = options2;
|
|
6497
6566
|
slimFields.push(item);
|
|
6498
6567
|
}
|
|
6499
6568
|
const fieldsById = /* @__PURE__ */ new Map();
|
|
@@ -6502,7 +6571,7 @@ async function buildCreateFormData(workflowId, env) {
|
|
|
6502
6571
|
...requiredFieldsList.map((f) => String(f?.id ?? "")),
|
|
6503
6572
|
...Object.values(subFormRequired).flatMap((list) => list.map((f) => String(f?.id ?? "")))
|
|
6504
6573
|
].filter(Boolean))];
|
|
6505
|
-
const historyCache = fields.length ? await buildHistoryRequestData(
|
|
6574
|
+
const historyCache = getHistory && fields.length ? await buildHistoryRequestData(
|
|
6506
6575
|
env,
|
|
6507
6576
|
fields,
|
|
6508
6577
|
historyRequiredFieldIds.map((id) => ({ id, name: String((fieldsById.get(id) || {}).name ?? id) })),
|
|
@@ -6580,7 +6649,9 @@ async function buildCreateFormData(workflowId, env) {
|
|
|
6580
6649
|
// 历史参考值(近一年、非草稿、最近 5 条「我发起的」)——填值前先看它,能直接照用的字段就别去
|
|
6581
6650
|
// 问用户。字段范围与 `fields` **同一口径**(见 modelFieldIds 注释);完整结果(本表单全部字段)
|
|
6582
6651
|
// 仍随句柄留给 `createRequest` 用(条件必填要到那边才现身)。
|
|
6583
|
-
|
|
6652
|
+
// `getHistory:false`(隐藏入参)时整段历史取数没做 ⇒ 这里给 `null`(不是空数组:空数组表示
|
|
6653
|
+
// "查了但没数据",两者含义不同)。
|
|
6654
|
+
historyRequestData: getHistory ? filterHistoryRequestData(historyCache, modelFieldIds) : null,
|
|
6584
6655
|
systemFields: {
|
|
6585
6656
|
permissions: minorInfo.permissions || {},
|
|
6586
6657
|
defaults: context.systemFields.defaults,
|
|
@@ -6589,6 +6660,8 @@ async function buildCreateFormData(workflowId, env) {
|
|
|
6589
6660
|
},
|
|
6590
6661
|
systemFieldWarning: minorWarning,
|
|
6591
6662
|
requiredInfoWarning: requiredInfoWarningText(context),
|
|
6663
|
+
// 明细表整表不可见时的告警(见 layoutWarning 注释):有值时**不要**回"表单里没有这张明细表"。
|
|
6664
|
+
layoutWarning,
|
|
6592
6665
|
// 原 Python 把完整 context 落盘;此处通过 continuation 承载,返回结构保持文档契约。
|
|
6593
6666
|
continuation: token
|
|
6594
6667
|
}
|
|
@@ -7630,9 +7703,10 @@ async function runFieldLinkage(env, ctx, entries, actionTypes, allDetails, isEdi
|
|
|
7630
7703
|
}
|
|
7631
7704
|
}
|
|
7632
7705
|
if (!dataList.length && !runDataList.length) return [];
|
|
7706
|
+
const linkageModule = formModuleName(ctx.frame && ctx.frame.relate_type, "ebuilderform");
|
|
7633
7707
|
const executeParam = {
|
|
7634
7708
|
formId: ctx.layout.form_id,
|
|
7635
|
-
module:
|
|
7709
|
+
module: linkageModule,
|
|
7636
7710
|
dataList,
|
|
7637
7711
|
runDataList,
|
|
7638
7712
|
moduleDataList: []
|
|
@@ -7673,9 +7747,9 @@ async function runFieldLinkage(env, ctx, entries, actionTypes, allDetails, isEdi
|
|
|
7673
7747
|
const frame = ctx.frame || {};
|
|
7674
7748
|
if (frame.layout_multi_id) executeParam.layoutId = frame.layout_multi_id;
|
|
7675
7749
|
}
|
|
7676
|
-
const payload = { formId: ctx.layout.form_id, module:
|
|
7750
|
+
const payload = { formId: ctx.layout.form_id, module: linkageModule, executeParam };
|
|
7677
7751
|
const relateType = ctx.frame && ctx.frame.relate_type || "";
|
|
7678
|
-
const endpoint = formApiUrl(FORM_ENDPOINTS.fdLinkage, relateType);
|
|
7752
|
+
const endpoint = formApiUrl(FORM_ENDPOINTS.fdLinkage, relateType, "/api/ebuilder/form/");
|
|
7679
7753
|
const response = await requestJson(env, "POST", endpoint, AJAX_QUERY, payload);
|
|
7680
7754
|
const data = response && typeof response === "object" ? response : null;
|
|
7681
7755
|
const linkageList = data && typeof data === "object" ? data.linkageDataList : null;
|
|
@@ -7708,6 +7782,50 @@ function mergeLinkageDetails(merged, linkageDetails) {
|
|
|
7708
7782
|
function emptyLinkageVisibility() {
|
|
7709
7783
|
return [/* @__PURE__ */ new Set(), {}, {}, {}];
|
|
7710
7784
|
}
|
|
7785
|
+
function collectFieldShowLinkageIds(linkages) {
|
|
7786
|
+
const out = /* @__PURE__ */ new Set();
|
|
7787
|
+
if (!Array.isArray(linkages)) return out;
|
|
7788
|
+
for (const rule of linkages) {
|
|
7789
|
+
const details = Array.isArray(rule?.linkageDetails) ? rule.linkageDetails : [];
|
|
7790
|
+
for (const detail of details) {
|
|
7791
|
+
if (!detail || typeof detail !== "object") continue;
|
|
7792
|
+
if (String(detail.linkageObj ?? "") !== "field") continue;
|
|
7793
|
+
if (String(detail.linkageProp ?? "") !== "show") continue;
|
|
7794
|
+
const fid = String(detail.linkageValue ?? "").trim();
|
|
7795
|
+
if (fid) out.add(fid);
|
|
7796
|
+
}
|
|
7797
|
+
}
|
|
7798
|
+
return out;
|
|
7799
|
+
}
|
|
7800
|
+
function collectDetailShowLinkages(linkages, fields) {
|
|
7801
|
+
const out = /* @__PURE__ */ new Map();
|
|
7802
|
+
if (!Array.isArray(linkages)) return out;
|
|
7803
|
+
const list = Array.isArray(fields) ? fields : [];
|
|
7804
|
+
const nameOf = (id) => {
|
|
7805
|
+
for (const f of list) {
|
|
7806
|
+
if (String(f?.id ?? "") === id) return String(f?.name ?? id);
|
|
7807
|
+
}
|
|
7808
|
+
return id;
|
|
7809
|
+
};
|
|
7810
|
+
for (const rule of linkages) {
|
|
7811
|
+
const details = Array.isArray(rule?.linkageDetails) ? rule.linkageDetails : [];
|
|
7812
|
+
for (const detail of details) {
|
|
7813
|
+
if (!detail || typeof detail !== "object") continue;
|
|
7814
|
+
if (String(detail.linkageObj ?? "") !== "detail") continue;
|
|
7815
|
+
if (String(detail.linkageProp ?? "") !== "show") continue;
|
|
7816
|
+
const sid = String(detail.linkageValue ?? "").trim();
|
|
7817
|
+
if (!sid) continue;
|
|
7818
|
+
const conds = Array.isArray(rule?.condition?.conditionDetails) ? rule.condition.conditionDetails : [];
|
|
7819
|
+
const triggerIds = conds.map((c) => String(c?.targetId ?? "").trim()).filter(Boolean);
|
|
7820
|
+
out.set(sid, {
|
|
7821
|
+
triggerIds,
|
|
7822
|
+
triggerNames: triggerIds.map(nameOf),
|
|
7823
|
+
tableName: nameOf(sid) === sid ? "" : nameOf(sid)
|
|
7824
|
+
});
|
|
7825
|
+
}
|
|
7826
|
+
}
|
|
7827
|
+
return out;
|
|
7828
|
+
}
|
|
7711
7829
|
function computeLinkageVisibility(linkages, entries, defaults, linkageDetails, systemFieldValues, fields) {
|
|
7712
7830
|
const hiddenSubforms = /* @__PURE__ */ new Set();
|
|
7713
7831
|
const rowHidden = {};
|
|
@@ -8282,6 +8400,15 @@ function xiaoECustomParams(preview) {
|
|
|
8282
8400
|
}
|
|
8283
8401
|
return { values, keys: ordered };
|
|
8284
8402
|
}
|
|
8403
|
+
function xiaoESrcFieldQuery(params) {
|
|
8404
|
+
let query = "";
|
|
8405
|
+
for (const fieldId of params.keys) {
|
|
8406
|
+
const text = params.values[fieldId];
|
|
8407
|
+
if (!text) continue;
|
|
8408
|
+
query += `&${fieldId}=${text}`;
|
|
8409
|
+
}
|
|
8410
|
+
return query;
|
|
8411
|
+
}
|
|
8285
8412
|
function renderXiaoEFillFormMarkdown(params) {
|
|
8286
8413
|
const base = String(params.baseUrl ?? "").replace(/\/+$/u, "");
|
|
8287
8414
|
const workflowId = String(params.workflowId ?? "").trim();
|
|
@@ -8293,7 +8420,7 @@ function renderXiaoEFillFormMarkdown(params) {
|
|
|
8293
8420
|
arguments: {
|
|
8294
8421
|
type: "e10",
|
|
8295
8422
|
title: String(params.title ?? ""),
|
|
8296
|
-
src: `${base}/sp/workflow${createPath}?workflowId=${workflowId}&isCreate=1`,
|
|
8423
|
+
src: `${base}/sp/workflow${createPath}?workflowId=${workflowId}&isCreate=1${xiaoESrcFieldQuery(params.customParams)}`,
|
|
8297
8424
|
sdkOptions: {
|
|
8298
8425
|
compName: XIAOE_FILL_FORM_SDK_OPTIONS.compName,
|
|
8299
8426
|
routerType: XIAOE_FILL_FORM_SDK_OPTIONS.routerType,
|
|
@@ -8401,7 +8528,8 @@ async function runCreateRequest(args, env, options = {}) {
|
|
|
8401
8528
|
}
|
|
8402
8529
|
const [details, valueAmbiguities, preview] = await resolveEntryValues(env, entries, context.layout.form_id);
|
|
8403
8530
|
const merged = mergeDetails(context.defaults || [], details);
|
|
8404
|
-
const
|
|
8531
|
+
const forceServerSubmit = args.forceServerSubmit === true;
|
|
8532
|
+
const isXiaoE = forceServerSubmit ? false : hasXiaoEEnv(env.ctx.env, env.ctx.getGlobalOptions?.());
|
|
8405
8533
|
const linkageDetails = isXiaoE ? [] : await runFieldLinkage(env, linkageContextFromPayload(context), entries, null, merged, false, context.defaults || []);
|
|
8406
8534
|
const merged2 = fillDetailDefaultsByRow(
|
|
8407
8535
|
mergeLinkageDetails(merged, linkageDetails),
|
|
@@ -8776,10 +8904,18 @@ function apiShortName(path) {
|
|
|
8776
8904
|
function withApiTiming(host, spans) {
|
|
8777
8905
|
const record = async (path, run) => {
|
|
8778
8906
|
const start = Date.now();
|
|
8907
|
+
const fetchTiming = createFetchTimingSink();
|
|
8779
8908
|
try {
|
|
8780
|
-
return await run
|
|
8909
|
+
return await runWithFetchTiming(fetchTiming, run);
|
|
8781
8910
|
} finally {
|
|
8782
|
-
spans.push({
|
|
8911
|
+
spans.push({
|
|
8912
|
+
name: apiShortName(path),
|
|
8913
|
+
start,
|
|
8914
|
+
end: Date.now(),
|
|
8915
|
+
fetchStart: fetchTiming.fetchStart,
|
|
8916
|
+
fetchEnd: fetchTiming.fetchEnd,
|
|
8917
|
+
fetchMs: fetchTiming.fetchMs
|
|
8918
|
+
});
|
|
8783
8919
|
}
|
|
8784
8920
|
};
|
|
8785
8921
|
return {
|
|
@@ -8818,18 +8954,33 @@ function summarizeApiSpans(spans) {
|
|
|
8818
8954
|
const items = group.map((item) => ({
|
|
8819
8955
|
name: item.name,
|
|
8820
8956
|
at: Math.max(0, Math.round(item.start - origin)),
|
|
8821
|
-
ms: Math.max(0, Math.round(item.end - item.start))
|
|
8957
|
+
ms: Math.max(0, Math.round(item.end - item.start)),
|
|
8958
|
+
fetchAt: item.fetchStart === null ? null : Math.max(0, Math.round(item.fetchStart - origin)),
|
|
8959
|
+
fetchEnd: item.fetchEnd === null ? null : Math.max(0, Math.round(item.fetchEnd - origin)),
|
|
8960
|
+
fetchCost: Math.max(0, Math.round(item.fetchMs))
|
|
8822
8961
|
})).sort((a, b) => b.ms - a.ms || a.at - b.at);
|
|
8823
8962
|
slowest.push({ batch: key, name: items[0].name, ms: items[0].ms, items });
|
|
8824
8963
|
}
|
|
8825
8964
|
}
|
|
8826
8965
|
return { durations, slowest };
|
|
8827
8966
|
}
|
|
8967
|
+
function readHiddenGetHistory(value) {
|
|
8968
|
+
if (value === false || value === 0) return false;
|
|
8969
|
+
if (typeof value === "string") {
|
|
8970
|
+
const text = value.trim().toLowerCase();
|
|
8971
|
+
if (text === "false" || text === "0") return false;
|
|
8972
|
+
}
|
|
8973
|
+
return true;
|
|
8974
|
+
}
|
|
8828
8975
|
async function commandCreateRequestDirect(args, env) {
|
|
8829
8976
|
const startedAt = Date.now();
|
|
8830
8977
|
const spans = [];
|
|
8831
8978
|
const timedEnv = { ...env, host: withApiTiming(env.host, spans) };
|
|
8832
|
-
const
|
|
8979
|
+
const getHistory = readHiddenGetHistory(args.getHistory);
|
|
8980
|
+
const { payload, authMs } = await prepareCreateFormPayload(args, timedEnv, {
|
|
8981
|
+
getHistory,
|
|
8982
|
+
detailMark: "isDetail"
|
|
8983
|
+
});
|
|
8833
8984
|
const contextId = String(payload.contextId ?? "");
|
|
8834
8985
|
if (!contextId) {
|
|
8835
8986
|
throw workflowValidationError("context_missing", "\u8868\u5355\u8F7D\u5165\u672A\u4EA7\u51FA\u53EF\u7528\u53E5\u67C4\uFF0C\u8BF7\u91CD\u8BD5");
|
|
@@ -8856,7 +9007,7 @@ async function commandCreateRequestDirect(args, env) {
|
|
|
8856
9007
|
"workflow.createRequestDirect"
|
|
8857
9008
|
) > CREATE_FORM_STDOUT_SAFE_CHARS;
|
|
8858
9009
|
if (overLine()) {
|
|
8859
|
-
data.historyRequestData = [];
|
|
9010
|
+
if (getHistory) data.historyRequestData = [];
|
|
8860
9011
|
if ("userMemory" in data && overLine()) data.userMemory = "";
|
|
8861
9012
|
}
|
|
8862
9013
|
return workflowSuccess("workflow.createRequestDirect", {
|
|
@@ -8876,10 +9027,14 @@ function formatRemark(value) {
|
|
|
8876
9027
|
if (text.startsWith("_weaverMte_")) return text;
|
|
8877
9028
|
return `_weaverMte_<p>${text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</p>`;
|
|
8878
9029
|
}
|
|
9030
|
+
function formModuleName(relateType, ebModule = "ebuildercard") {
|
|
9031
|
+
return String(relateType ?? "").trim() === "WEA_EBUILDER" ? ebModule : "workflow";
|
|
9032
|
+
}
|
|
8879
9033
|
function buildSaveBody(context, prepared) {
|
|
8880
9034
|
const runtime = context.runtime;
|
|
9035
|
+
const moduleName = formModuleName(context.frame?.relate_type);
|
|
8881
9036
|
return {
|
|
8882
|
-
module:
|
|
9037
|
+
module: moduleName,
|
|
8883
9038
|
customParam: {
|
|
8884
9039
|
isCreate: true,
|
|
8885
9040
|
requestId: runtime.request_id,
|
|
@@ -8897,7 +9052,7 @@ function buildSaveBody(context, prepared) {
|
|
|
8897
9052
|
},
|
|
8898
9053
|
employeeId: runtime.employee_id,
|
|
8899
9054
|
formData: {
|
|
8900
|
-
module:
|
|
9055
|
+
module: moduleName,
|
|
8901
9056
|
presetDataId: runtime.request_id,
|
|
8902
9057
|
dataDetails: prepared.dataDetails,
|
|
8903
9058
|
client: "pc",
|
|
@@ -9274,12 +9429,15 @@ async function runCreateNodeFieldVerification(env, context, switches) {
|
|
|
9274
9429
|
result.passed = !result.blocked;
|
|
9275
9430
|
return result;
|
|
9276
9431
|
}
|
|
9277
|
-
function buildEditDataLayoutRequest(requestId, workflowId, nodeId, formId, dataId, layoutMultiId, viewFormNodeId, permissionType, runtime) {
|
|
9432
|
+
function buildEditDataLayoutRequest(requestId, workflowId, nodeId, formId, dataId, layoutMultiId, viewFormNodeId, permissionType, runtime, relateType) {
|
|
9278
9433
|
return {
|
|
9279
9434
|
terminalType: "PC",
|
|
9280
9435
|
dataId,
|
|
9281
9436
|
formId,
|
|
9282
|
-
|
|
9437
|
+
// 建模表单取 `ebuilderform`(2026-10-30 真机请求体实证),**不是** `ebuildercard`:
|
|
9438
|
+
// 同为 `form/core` 下的接口,`getFormLayout` / `saveFormData` 是 `ebuildercard`,
|
|
9439
|
+
// 本接口与 `executeFdLinkage` 是 `ebuilderform` —— 建模表单内部不能按"同族"推定。
|
|
9440
|
+
module: formModuleName(relateType, "ebuilderform"),
|
|
9283
9441
|
newLayout: true,
|
|
9284
9442
|
cacheUid: null,
|
|
9285
9443
|
layoutMultiId,
|
|
@@ -9349,7 +9507,7 @@ async function commandEditLoad(args, env) {
|
|
|
9349
9507
|
tenantSetting = {};
|
|
9350
9508
|
}
|
|
9351
9509
|
const dataId = requestId;
|
|
9352
|
-
const dlResp = await requestJson(env, "POST", formApiUrl(FORM_ENDPOINTS.formDataAndLayout, frame.relate_type), { formId: frame.form_id, dataId, ...AJAX_QUERY }, buildEditDataLayoutRequest(requestId, workflowId, runtime.node_id, frame.form_id, dataId, frame.layout_multi_id, frame.view_form_node_id, frame.permission_type, runtime));
|
|
9510
|
+
const dlResp = await requestJson(env, "POST", formApiUrl(FORM_ENDPOINTS.formDataAndLayout, frame.relate_type), { formId: frame.form_id, dataId, ...AJAX_QUERY }, buildEditDataLayoutRequest(requestId, workflowId, runtime.node_id, frame.form_id, dataId, frame.layout_multi_id, frame.view_form_node_id, frame.permission_type, runtime, frame.relate_type));
|
|
9353
9511
|
const dlData = dlResp;
|
|
9354
9512
|
if (!dlData || typeof dlData !== "object") throw workflowApiError("format_error", "getFormDataAndLayout \u672A\u8FD4\u56DE\u6709\u6548 data");
|
|
9355
9513
|
const vrc = Array.isArray(dlData.viewRelateConfig) ? dlData.viewRelateConfig : [];
|
|
@@ -9595,8 +9753,9 @@ async function commandEditPrepare(args, env) {
|
|
|
9595
9753
|
}
|
|
9596
9754
|
function buildEditSaveBody(context, prepared) {
|
|
9597
9755
|
const runtime = context.runtime || {};
|
|
9756
|
+
const moduleName = formModuleName(context.frame?.relate_type);
|
|
9598
9757
|
return {
|
|
9599
|
-
module:
|
|
9758
|
+
module: moduleName,
|
|
9600
9759
|
customParam: {
|
|
9601
9760
|
isCreate: false,
|
|
9602
9761
|
requestId: context.requestId ?? context.request_id,
|
|
@@ -9616,7 +9775,7 @@ function buildEditSaveBody(context, prepared) {
|
|
|
9616
9775
|
formData: {
|
|
9617
9776
|
id: context.data_id,
|
|
9618
9777
|
updateTimeStamp: context.update_time_stamp || "",
|
|
9619
|
-
module:
|
|
9778
|
+
module: moduleName,
|
|
9620
9779
|
dataDelRows: [],
|
|
9621
9780
|
dataDetails: prepared.dataDetails || [],
|
|
9622
9781
|
client: "pc",
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
createE10RequestRuntime,
|
|
10
10
|
requireE10Session
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UZZBA6PV.js";
|
|
12
12
|
import {
|
|
13
13
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
14
14
|
getActiveProfile
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OJQUJZQF.js";
|
|
16
16
|
|
|
17
17
|
// src/shortcuts/workflow/host.ts
|
|
18
18
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -754,12 +754,6 @@ function packageFileUrl(...segments) {
|
|
|
754
754
|
return pathToFileURL(packagePath(...segments));
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
-
// src/internal/e10/auth/xiaoe.ts
|
|
758
|
-
import { execFile } from "node:child_process";
|
|
759
|
-
import { accessSync, constants as fsConstants, existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync } from "node:fs";
|
|
760
|
-
import { homedir as homedir2 } from "node:os";
|
|
761
|
-
import { join as join2 } from "node:path";
|
|
762
|
-
|
|
763
757
|
// src/core/runtime-agent.ts
|
|
764
758
|
var XIAOE_RUNTIME_AGENT_ALIASES = /* @__PURE__ */ new Set([
|
|
765
759
|
"xiaoe",
|
|
@@ -781,6 +775,10 @@ function isXiaoERuntime(options) {
|
|
|
781
775
|
}
|
|
782
776
|
|
|
783
777
|
// src/internal/e10/auth/xiaoe.ts
|
|
778
|
+
import { execFile } from "node:child_process";
|
|
779
|
+
import { accessSync, constants as fsConstants, existsSync as existsSync4, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync } from "node:fs";
|
|
780
|
+
import { homedir as homedir2 } from "node:os";
|
|
781
|
+
import { join as join2 } from "node:path";
|
|
784
782
|
var DEFAULT_E10_BASE_URL = "https://www.e-cology.com.cn";
|
|
785
783
|
var XIAOE_AGENT_TYPE = "XiaoE";
|
|
786
784
|
var XIAOE_UNIFIED_LOGIN_MAP_ENV_KEYS = [
|
|
@@ -1581,6 +1579,31 @@ async function tryXiaoEUnifiedLogin(options = {}) {
|
|
|
1581
1579
|
}
|
|
1582
1580
|
}
|
|
1583
1581
|
|
|
1582
|
+
// src/internal/e10/fetch-timing.ts
|
|
1583
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
1584
|
+
var storage = new AsyncLocalStorage();
|
|
1585
|
+
function createFetchTimingSink() {
|
|
1586
|
+
return { fetchMs: 0, fetchCount: 0, fetchStart: null, fetchEnd: null };
|
|
1587
|
+
}
|
|
1588
|
+
function runWithFetchTiming(sink, fn) {
|
|
1589
|
+
return storage.run(sink, fn);
|
|
1590
|
+
}
|
|
1591
|
+
function startFetchTiming() {
|
|
1592
|
+
const sink = storage.getStore();
|
|
1593
|
+
if (!sink) return null;
|
|
1594
|
+
const startedAt = Date.now();
|
|
1595
|
+
let finished = false;
|
|
1596
|
+
return () => {
|
|
1597
|
+
if (finished) return;
|
|
1598
|
+
finished = true;
|
|
1599
|
+
const endedAt = Date.now();
|
|
1600
|
+
sink.fetchMs += Math.max(0, endedAt - startedAt);
|
|
1601
|
+
sink.fetchCount += 1;
|
|
1602
|
+
sink.fetchStart = sink.fetchStart === null ? startedAt : Math.min(sink.fetchStart, startedAt);
|
|
1603
|
+
sink.fetchEnd = sink.fetchEnd === null ? endedAt : Math.max(sink.fetchEnd, endedAt);
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1584
1607
|
export {
|
|
1585
1608
|
packagePath,
|
|
1586
1609
|
packageFileUrl,
|
|
@@ -1612,5 +1635,8 @@ export {
|
|
|
1612
1635
|
inspectXiaoEUnifiedLoginSources,
|
|
1613
1636
|
resolveXiaoEPreferredBaseUrl,
|
|
1614
1637
|
createXiaoEUnifiedLoginUnavailableError,
|
|
1615
|
-
tryXiaoEUnifiedLogin
|
|
1638
|
+
tryXiaoEUnifiedLogin,
|
|
1639
|
+
createFetchTimingSink,
|
|
1640
|
+
runWithFetchTiming,
|
|
1641
|
+
startFetchTiming
|
|
1616
1642
|
};
|
|
@@ -12,12 +12,13 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
E10ApiError,
|
|
14
14
|
createE10RequestRuntime,
|
|
15
|
+
isE10SessionExpiredResponse,
|
|
15
16
|
requireE10Session
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UZZBA6PV.js";
|
|
17
18
|
import {
|
|
18
19
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
19
20
|
getActiveProfile
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-OJQUJZQF.js";
|
|
21
22
|
|
|
22
23
|
// src/shortcuts/esb/host.ts
|
|
23
24
|
var ESB_PATHS = {
|
|
@@ -125,7 +126,7 @@ function createEsbHost(ctx, dependencies = {}) {
|
|
|
125
126
|
} catch (error) {
|
|
126
127
|
mapRuntimeNetworkError(error);
|
|
127
128
|
}
|
|
128
|
-
if (response
|
|
129
|
+
if (isE10SessionExpiredResponse(response)) {
|
|
129
130
|
throw esbAuthError(
|
|
130
131
|
"session_expired",
|
|
131
132
|
E10_SESSION_EXPIRED_MESSAGE,
|