weaver-work-cli 0.1.38 → 0.1.40
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/README.md +7 -3
- package/dist/chunks/{archive-PDV724YK.js → archive-JHTONRST.js} +556 -66
- package/dist/chunks/{archive-oa-4XE4MNXQ.js → archive-oa-FCHLCPHC.js} +2 -2
- package/dist/chunks/{asset-PDL2QE2N.js → asset-RLIHC7DB.js} +2 -2
- package/dist/chunks/asset-idle-KVOFTLCP.js +670 -0
- package/dist/chunks/{attachment-content-MDDGOE5E.js → attachment-content-RZYDB3MB.js} +3 -3
- package/dist/chunks/{blog-UYR3EUXW.js → blog-42OZTJNP.js} +2 -2
- package/dist/chunks/{caizhilian-LG2X5NMF.js → caizhilian-KRK547K5.js} +2 -2
- package/dist/chunks/{calendar-FG4BAZHE.js → calendar-RTWAMKHD.js} +2 -2
- package/dist/chunks/{chunk-J7USS3ED.js → chunk-4CTESSKI.js} +4 -4
- package/dist/chunks/{chunk-OJQUJZQF.js → chunk-4TEDNCON.js} +45 -5
- package/dist/chunks/chunk-57IECMWX.js +487 -0
- package/dist/chunks/{chunk-ELYDWBZJ.js → chunk-7BRU4EFH.js} +13 -7
- package/dist/chunks/{chunk-6LTFIFLM.js → chunk-7E6MUOEK.js} +2 -2
- package/dist/chunks/{chunk-KKRL3REV.js → chunk-7U577Q7U.js} +2 -2
- package/dist/chunks/{chunk-UJJD4QWF.js → chunk-CAQNBBQA.js} +2 -2
- package/dist/chunks/{chunk-CORFRD7Q.js → chunk-CXRQWOZ5.js} +2 -2
- package/dist/chunks/{chunk-GGJFMNJM.js → chunk-FLS4DPGP.js} +110 -16
- package/dist/chunks/{chunk-JSMFPO43.js → chunk-I566ZYNF.js} +1 -1
- package/dist/chunks/{chunk-6FTTSA45.js → chunk-IZSSVYAG.js} +2 -2
- package/dist/chunks/{chunk-XJY7G4DD.js → chunk-JWRZM2H2.js} +3 -3
- package/dist/chunks/{chunk-NI6GIPIM.js → chunk-LFMSDBZN.js} +529 -395
- package/dist/chunks/{chunk-VRYHGG6O.js → chunk-LN447PY2.js} +92 -51
- package/dist/chunks/{chunk-NR6RKXPA.js → chunk-NETCCARD.js} +4 -2
- package/dist/chunks/{chunk-Z32KWY6G.js → chunk-NJKREDA3.js} +1 -1
- package/dist/chunks/{chunk-FUWVHMVV.js → chunk-SPRHHSVC.js} +2 -2
- package/dist/chunks/{chunk-IZUDA353.js → chunk-T6EGVBKU.js} +1 -1
- package/dist/chunks/{chunk-DMV2TOMH.js → chunk-VNBU55SL.js} +428 -145
- package/dist/chunks/{chunk-UZZBA6PV.js → chunk-WFFNM65B.js} +47 -6
- package/dist/chunks/{chunk-EG6ZU444.js → chunk-ZUX3P6BQ.js} +10 -5
- package/dist/chunks/{conflict-BQZEQ4SP.js → conflict-VR55AOOO.js} +2 -2
- package/dist/chunks/{contract-XIRAFTEV.js → contract-HI4FNPYE.js} +2 -2
- package/dist/chunks/{cowork-BLG62BL2.js → cowork-HJLI353D.js} +12 -5
- package/dist/chunks/{ebuilder-form-NUKG5QW4.js → ebuilder-form-HTGI63UU.js} +3 -3
- package/dist/chunks/{ehr-2STW5ILH.js → ehr-GYXIYH3A.js} +2 -2
- package/dist/chunks/env-DW3G4HUO.js +19 -0
- package/dist/chunks/{esb-UUDQUNKY.js → esb-I5INCEFE.js} +4 -4
- package/dist/chunks/factory-TKXGXS6L.js +30 -0
- package/dist/chunks/{fna-6RCY4NU5.js → fna-K2MHTQ24.js} +2 -2
- package/dist/chunks/group-chat-VYBNMJLG.js +18 -0
- package/dist/chunks/{host-FWDOSRH5.js → host-256GVCAH.js} +3 -3
- package/dist/chunks/{host-EJZFROU3.js → host-D5SERMAJ.js} +3 -3
- package/dist/chunks/{host-RHM3NPXV.js → host-JM4YVHFM.js} +3 -3
- package/dist/chunks/{host-7RXEDMAH.js → host-L3VLITMT.js} +3 -3
- package/dist/chunks/{host-UFF33TWJ.js → host-ZUQTJYYK.js} +3 -3
- package/dist/chunks/{hrm-PKJ6ELSH.js → hrm-VLRBKTZB.js} +3 -3
- package/dist/chunks/{im-YJAXS7CO.js → im-QK3VTLXK.js} +8 -8
- package/dist/chunks/{invoice-HWVSXGX6.js → invoice-T5JTA32H.js} +3 -3
- package/dist/chunks/{jiuchuanhui-L7VKILZB.js → jiuchuanhui-P2FNEQVZ.js} +2 -2
- package/dist/chunks/{lazy-dispatch-NMYEIHRH.js → lazy-dispatch-XRRI46M6.js} +5 -5
- package/dist/chunks/{mail-B42RRU7G.js → mail-3Y7MJ6PS.js} +9 -4
- package/dist/chunks/{meeting-CFYVBJSS.js → meeting-M7LTXGJE.js} +11 -10
- package/dist/chunks/{okr-GCLF6V7W.js → okr-OBC6S67L.js} +2 -2
- package/dist/chunks/{plan-ZVL7GBRI.js → plan-5H6I53SK.js} +2 -2
- package/dist/chunks/{project-4YWAAE2K.js → project-L75QZV4S.js} +2 -2
- package/dist/chunks/{registry-EP4VTHZS.js → registry-KMHCPAAD.js} +9 -8
- package/dist/chunks/{registry-OZSMDVPP.js → registry-QGHFNUWS.js} +2 -2
- package/dist/chunks/{registry-FRJ6H7BT.js → registry-RXPN6BBT.js} +4 -4
- package/dist/chunks/{registry-SG2PGVCF.js → registry-UGRBCBHO.js} +3 -3
- package/dist/chunks/{room-recommend-R3JVUUAC.js → room-recommend-A3UDC3CA.js} +4 -4
- package/dist/chunks/{schedule-NIJBTYDO.js → schedule-5GCACCK7.js} +4 -4
- package/dist/chunks/{workflow-BB24DFBY.js → workflow-M5ZJ7DWF.js} +11 -8
- package/dist/core/output.js +16 -6
- package/dist/index.js +33 -28
- package/dist/internal/e10/auth/commands.js +109 -56
- package/dist/internal/e10/auth/messages.js +1 -0
- package/dist/internal/e10/auth/session.js +11 -1
- package/dist/internal/e10/auth/xiaoe.js +29 -4
- package/dist/internal/e10/auth-recovery.js +13 -6
- package/dist/internal/e10/client.js +13 -0
- package/dist/internal/e10/context.js +24 -3
- package/dist/internal/e10/request-runtime.js +12 -1
- package/dist/shortcuts/archive/host.js +2 -0
- package/dist/shortcuts/archive/manifest.js +1 -1
- package/dist/shortcuts/archive/operations/borrow-list.js +13 -1
- package/dist/shortcuts/archive/operations/flow-url.js +1 -1
- package/dist/shortcuts/archive/operations/prelib.js +472 -0
- package/dist/shortcuts/archive/operations/registry.js +2 -0
- package/dist/shortcuts/archive/operations/upload.js +1 -1
- package/dist/shortcuts/asset-idle/errors.js +44 -0
- package/dist/shortcuts/asset-idle/host.js +161 -0
- package/dist/shortcuts/asset-idle/index.js +114 -0
- package/dist/shortcuts/asset-idle/manifest.js +159 -0
- package/dist/shortcuts/asset-idle/operations/idle.js +47 -0
- package/dist/shortcuts/asset-idle/operations/registry.js +33 -0
- package/dist/shortcuts/asset-idle/operations/shared.js +142 -0
- package/dist/shortcuts/asset-idle/operations/types.js +9 -0
- package/dist/shortcuts/asset-idle/operations.js +15 -0
- package/dist/shortcuts/cowork/operations/item-write.js +10 -2
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/mail/operations/mail-send.js +8 -2
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +381 -104
- package/dist/shortcuts/meeting/operations/eb/crm-search.js +87 -5
- package/dist/shortcuts/meeting/operations/eb/flow-memory.js +49 -0
- package/dist/shortcuts/meeting/operations/eb/group-chat.js +583 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +19 -3
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +2 -0
- package/dist/shortcuts/meeting/operations/eb/usage-cache.js +99 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +35 -12
- package/dist/shortcuts/workflow/host.js +3 -0
- package/dist/shortcuts/workflow/index.js +1 -1
- package/dist/shortcuts/workflow/operations/form.js +65 -171
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +129 -27
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupStore.js +6 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +60 -117
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +44 -7
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +37 -29
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +48 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +22 -18
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +17 -9
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +34 -10
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +5 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +9 -2
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +122 -20
- package/docs/_catalog.md +3 -0
- package/docs/asset-idle.md +45 -0
- package/docs/e10-auth.md +16 -1
- package/docs/todo-smart-convert/subgroup-rules.md +1 -1
- package/package.json +1 -1
- package/scripts/mcp-meeting.mjs +234 -0
- package/scripts/package-skill.mjs +2 -0
- package/skill-template/business-info.json +14 -1
- package/skill-template/domains/asset-idle.md +13 -0
- package/skill-template/domains/wenshuding.md +3 -0
- package/skills/weaver-e10-archive-oa/SKILL.md +1 -0
- package/skills/weaver-e10-archive-oa/references/my-borrow.md +49 -0
- package/skills/weaver-e10-asset-idle/SKILL.md +73 -0
- package/skills/weaver-e10-asset-idle/references/idle-list.md +62 -0
- package/skills/weaver-e10-asset-idle/references/idle-stats-and-charts.md +65 -0
- package/skills/weaver-e10-asset-idle/references/source-manifest.json +193 -0
- package/skills/weaver-e10-asset-idle/references/widget-style.md +205 -0
- package/skills/weaver-e10-caizhilian/SKILL.md +29 -11
- package/skills/weaver-e10-caizhilian/references/auth-and-install.md +12 -0
- package/skills/weaver-e10-caizhilian/references/files.md +1 -1
- package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +1 -1
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +45 -45
- package/skills/weaver-e10-cowork/SKILL.md +2 -0
- package/skills/weaver-e10-cowork/references/cowork-write.md +1 -1
- package/skills/weaver-e10-jucailin/SKILL.md +2 -0
- package/skills/weaver-e10-jucailin/references/recruit-read.md +2 -0
- package/skills/weaver-e10-jucailin/references/recruit-write.md +1 -1
- package/skills/weaver-e10-mail/SKILL.md +3 -0
- package/skills/weaver-e10-mail/references/mail-send.md +2 -0
- package/skills/weaver-e10-meeting/SKILL.md +88 -25
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +25 -11
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-shared/SKILL.md +5 -5
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +3 -3
- package/skills/weaver-e10-wenshuding/SKILL.md +29 -6
- package/skills/weaver-e10-wenshuding/references/archive-borrow-list.md +14 -0
- package/skills/weaver-e10-wenshuding/references/archive-download.md +2 -0
- package/skills/weaver-e10-wenshuding/references/archive-flow.md +1 -1
- package/skills/weaver-e10-wenshuding/references/archive-prelib-arrange.md +76 -0
- package/skills/weaver-e10-wenshuding/references/archive-prelib-list.md +107 -0
- package/skills/weaver-e10-wenshuding/references/archive-prelib-open.md +59 -0
- package/skills/weaver-e10-wenshuding/references/archive-upload.md +4 -1
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +108 -65
- package/skills/weaver-e10-workflow/SKILL.md +9 -2
- package/skills/weaver-e10-workflow/aigroup/default.json +166 -19
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +72 -34
- package/skills/weaver-e10-workflow/tools/todo-serve.cjs +113 -25
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +350 -50
- package/dist/chunks/{chunk-2LV74IWP.js → chunk-E7OK5WD5.js} +5 -5
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
createE10RequestRuntime,
|
|
6
6
|
isE10SessionExpiredResponse,
|
|
7
7
|
requireE10Session
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WFFNM65B.js";
|
|
9
9
|
import {
|
|
10
10
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
11
11
|
getActiveProfile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4TEDNCON.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError,
|
|
15
15
|
isCliError,
|
|
@@ -573,7 +573,9 @@ function createArchiveHost(ctx, dependencies = {}) {
|
|
|
573
573
|
form: multipart === void 0 && form === void 0 ? void 0 : formBody(form ?? {}),
|
|
574
574
|
formData: multipart,
|
|
575
575
|
headers: { "X-Requested-With": "XMLHttpRequest", ...extraHeaders },
|
|
576
|
-
timeoutMs
|
|
576
|
+
timeoutMs,
|
|
577
|
+
// 下载接口常 302 重定向到文件服务/CDN,需跟随,避免被误判为登录失效
|
|
578
|
+
followRedirects: true
|
|
577
579
|
}) : await rt.requestJson({
|
|
578
580
|
module: "archive",
|
|
579
581
|
operation,
|
|
@@ -820,6 +822,530 @@ var prelibTree = {
|
|
|
820
822
|
};
|
|
821
823
|
var fondsOperations = [fondsList, prelibTree];
|
|
822
824
|
|
|
825
|
+
// src/shortcuts/archive/operations/prelib.ts
|
|
826
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
827
|
+
|
|
828
|
+
// src/shortcuts/archive/operations/confirm.ts
|
|
829
|
+
function requireConfirm(args, action) {
|
|
830
|
+
if (args.confirm !== true) {
|
|
831
|
+
throw archiveConfirmationError(action, {
|
|
832
|
+
hint: `\u6267\u884C ${action} \u5FC5\u987B\u663E\u5F0F\u786E\u8BA4\uFF1A\u4F20\u5165 confirm=true\uFF08CLI \u7528 --yes\uFF09`
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
async function issueLease(env, action, payload, ttlMs = 10 * 6e4) {
|
|
837
|
+
const session = await env.host.getSession();
|
|
838
|
+
const continuation = await env.continuation.issue(
|
|
839
|
+
{
|
|
840
|
+
operation: action,
|
|
841
|
+
baseUrl: session.baseUrl,
|
|
842
|
+
userId: session.userId,
|
|
843
|
+
...payload
|
|
844
|
+
},
|
|
845
|
+
ttlMs
|
|
846
|
+
);
|
|
847
|
+
return { continuation, expiresInMs: ttlMs };
|
|
848
|
+
}
|
|
849
|
+
async function verifyLease(args, action, env) {
|
|
850
|
+
requireConfirm(args, action);
|
|
851
|
+
if (typeof args.continuation !== "string" || !args.continuation.trim()) {
|
|
852
|
+
throw archiveValidationError("continuation_required", `${action} \u5FC5\u987B\u4F20\u5165 prepare \u8FD4\u56DE\u7684 continuation`);
|
|
853
|
+
}
|
|
854
|
+
const lease = await env.continuation.verify(args.continuation.trim(), action);
|
|
855
|
+
const session = await env.host.getSession();
|
|
856
|
+
if (lease.baseUrl !== session.baseUrl || lease.userId !== session.userId) {
|
|
857
|
+
throw archiveValidationError(
|
|
858
|
+
"continuation_context_mismatch",
|
|
859
|
+
"\u786E\u8BA4\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF08\u73AF\u5883\u6216\u767B\u5F55\u8D26\u53F7\u4E0D\u540C\uFF09\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare"
|
|
860
|
+
);
|
|
861
|
+
}
|
|
862
|
+
return lease;
|
|
863
|
+
}
|
|
864
|
+
function assertLeaseTarget(lease, args, keys, action) {
|
|
865
|
+
for (const key of keys) {
|
|
866
|
+
if (args[key] === void 0 || args[key] === null || args[key] === "") continue;
|
|
867
|
+
if (String(lease[key] ?? "") !== String(args[key])) {
|
|
868
|
+
throw archiveValidationError(
|
|
869
|
+
"continuation_target_changed",
|
|
870
|
+
`${action} \u7684\u53C2\u6570 ${key} \u4E0E prepare \u65F6\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare`
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// src/shortcuts/archive/operations/prelib.ts
|
|
877
|
+
var PRELIB_MENU_SIGN = "preLib";
|
|
878
|
+
var PRELIB_TREE_TYPE = "4";
|
|
879
|
+
var PRELIB_NODE_TYPE = 2;
|
|
880
|
+
var PRELIB_FORM_TAG = '["",""]';
|
|
881
|
+
var INTELLIGENT_APPLY = "archive.prelib.intelligent.apply";
|
|
882
|
+
var ARRANGE_APPLY = "archive.prelib.arrange.apply";
|
|
883
|
+
var NON_DISPLAY_FIELDS = /* @__PURE__ */ new Set([
|
|
884
|
+
"id",
|
|
885
|
+
"rowKey",
|
|
886
|
+
"flowId",
|
|
887
|
+
"form_data_id",
|
|
888
|
+
"form_table_id",
|
|
889
|
+
"ebrecord_rowkey",
|
|
890
|
+
"isFollow",
|
|
891
|
+
"is_flow",
|
|
892
|
+
"isToDo",
|
|
893
|
+
"todoPropSpan",
|
|
894
|
+
"data_status_value"
|
|
895
|
+
]);
|
|
896
|
+
function isEfileLibNode2(id) {
|
|
897
|
+
if (typeof id !== "string" || !id.includes("_")) return false;
|
|
898
|
+
const [left, right] = id.split("_");
|
|
899
|
+
return Boolean(left && left === right);
|
|
900
|
+
}
|
|
901
|
+
function optionalText(value) {
|
|
902
|
+
if (typeof value !== "string") return void 0;
|
|
903
|
+
const text = value.trim();
|
|
904
|
+
return text ? text : void 0;
|
|
905
|
+
}
|
|
906
|
+
async function resolveEfileNode(host, treeId) {
|
|
907
|
+
const response = await host.request({
|
|
908
|
+
method: "POST",
|
|
909
|
+
path: "/api/archive/core/archivetree/getTree",
|
|
910
|
+
body: {
|
|
911
|
+
treeType: PRELIB_TREE_TYPE,
|
|
912
|
+
menuSign: PRELIB_MENU_SIGN,
|
|
913
|
+
logFlag: PRELIB_MENU_SIGN,
|
|
914
|
+
needControl: true,
|
|
915
|
+
needSysn: true
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
const data = unwrapData(response);
|
|
919
|
+
const nodes = Array.isArray(data) ? data : [];
|
|
920
|
+
const efileNodes = nodes.filter((item) => isEfileLibNode2(item?.id)).map((item) => ({ treeId: String(item.id), nodeName: String(item.content ?? "") }));
|
|
921
|
+
if (treeId) {
|
|
922
|
+
const matched = efileNodes.find((item) => item.treeId === treeId);
|
|
923
|
+
return matched ?? { treeId, nodeName: "" };
|
|
924
|
+
}
|
|
925
|
+
if (efileNodes.length === 0) {
|
|
926
|
+
throw archiveValidationError(
|
|
927
|
+
"prelib_node_missing",
|
|
928
|
+
"\u672A\u627E\u5230\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9\uFF08\u9884\u5F52\u6863\u6811\u8FD4\u56DE\u4E3A\u7A7A\uFF09\u3002\u8BF7\u5148\u91CD\u65B0\u83B7\u53D6\u4E00\u6B21\uFF1A\u91CD\u8BD5\u672C operation\uFF0C\u6216\u7528\u5DF2\u77E5 treeId \u663E\u5F0F\u4F20\u5165\uFF1B\u82E5\u4ECD\u7136\u83B7\u53D6\u4E0D\u5230\uFF0C\u901A\u5E38\u662F\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u8BE5\u9884\u5F52\u6863\u5E93\u6743\u9650\uFF0C\u6B64\u65F6\u5E94\u505C\u6B62\u540E\u7EED\u64CD\u4F5C\uFF08\u4E0D\u8981\u731C\u6D4B treeId\uFF0C\u4E5F\u4E0D\u8981\u7EE7\u7EED\u4E0A\u4F20\uFF09\u3002"
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
return efileNodes[0];
|
|
932
|
+
}
|
|
933
|
+
async function fetchTreeDetail(host, treeId) {
|
|
934
|
+
const response = await host.request({
|
|
935
|
+
method: "POST",
|
|
936
|
+
path: "/api/archive/core/archivetree/getTreeDetail",
|
|
937
|
+
body: {
|
|
938
|
+
treeType: PRELIB_TREE_TYPE,
|
|
939
|
+
rootNode: "",
|
|
940
|
+
rootNodeTag: "",
|
|
941
|
+
needControl: true,
|
|
942
|
+
formTag: PRELIB_FORM_TAG,
|
|
943
|
+
preFileFilterId: "",
|
|
944
|
+
menuSign: PRELIB_MENU_SIGN,
|
|
945
|
+
treeId,
|
|
946
|
+
nodeType: PRELIB_NODE_TYPE,
|
|
947
|
+
logFlag: PRELIB_MENU_SIGN
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
const data = unwrapData(response) ?? {};
|
|
951
|
+
const url1 = String(data.url1 ?? "").trim();
|
|
952
|
+
const matched = url1.match(/(\d+)\s*$/u);
|
|
953
|
+
const listId = matched?.[1] ?? "";
|
|
954
|
+
const extra = data.extraParams ?? {};
|
|
955
|
+
const metaFormId = String(extra.metaFormId ?? "").trim();
|
|
956
|
+
const tag = String(extra.tag ?? "").trim();
|
|
957
|
+
if (!listId || !metaFormId) {
|
|
958
|
+
throw archiveValidationError(
|
|
959
|
+
"prelib_detail_invalid",
|
|
960
|
+
`getTreeDetail \u672A\u8FD4\u56DE\u6709\u6548\u7684\u5217\u8868\u89C6\u56FE\uFF08url1=${url1 || "\u7A7A"}\uFF0CmetaFormId=${metaFormId || "\u7A7A"}\uFF09`
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
const boxUrl = String(data.boxUrl ?? "").trim();
|
|
964
|
+
return { listId, metaFormId, tag, url1, ...boxUrl ? { boxUrl } : {} };
|
|
965
|
+
}
|
|
966
|
+
async function fetchPrelibDatas(host, node, detail, pageNo) {
|
|
967
|
+
const current = positiveInt(pageNo, "pageNo", 1);
|
|
968
|
+
const [appId] = node.treeId.split("_");
|
|
969
|
+
const paramsJson = JSON.stringify({
|
|
970
|
+
treeType: PRELIB_TREE_TYPE,
|
|
971
|
+
rootNode: "",
|
|
972
|
+
rootNodeTag: "",
|
|
973
|
+
needControl: true,
|
|
974
|
+
formTag: PRELIB_FORM_TAG,
|
|
975
|
+
preFileFilterId: "",
|
|
976
|
+
menuSign: PRELIB_MENU_SIGN,
|
|
977
|
+
id: node.treeId,
|
|
978
|
+
nodeType: PRELIB_NODE_TYPE,
|
|
979
|
+
isLeaf: true,
|
|
980
|
+
content: node.nodeName
|
|
981
|
+
});
|
|
982
|
+
const response = await host.request({
|
|
983
|
+
method: "POST",
|
|
984
|
+
path: "/api/ebuilder/form/list/getListDatas",
|
|
985
|
+
query: { passid: detail.metaFormId, cid: detail.metaFormId },
|
|
986
|
+
body: {
|
|
987
|
+
current,
|
|
988
|
+
requiredMatch: 1,
|
|
989
|
+
tableuid: randomBytes2(16).toString("hex"),
|
|
990
|
+
mapResult: "1",
|
|
991
|
+
recheckQuery: "1",
|
|
992
|
+
metaFormId: detail.metaFormId,
|
|
993
|
+
tag: detail.tag,
|
|
994
|
+
treeId: node.treeId,
|
|
995
|
+
nodeType: PRELIB_NODE_TYPE,
|
|
996
|
+
systemId: appId,
|
|
997
|
+
metaId: appId,
|
|
998
|
+
hasBtn: "1",
|
|
999
|
+
paramsJson,
|
|
1000
|
+
metaName: node.nodeName,
|
|
1001
|
+
menuSign: PRELIB_MENU_SIGN,
|
|
1002
|
+
searchParamData: { type: "and", searchType: "2", commonSearchFields: {}, groupFields: {} },
|
|
1003
|
+
listId: detail.listId,
|
|
1004
|
+
isFollow: 0,
|
|
1005
|
+
isShareToMe: 0,
|
|
1006
|
+
filterCondition: {},
|
|
1007
|
+
browser: "Chrome"
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
const data = unwrapData(response) ?? {};
|
|
1011
|
+
const columns = (Array.isArray(data.columns) ? data.columns : []).map((item) => ({
|
|
1012
|
+
title: String(item?.title ?? ""),
|
|
1013
|
+
dataIndex: String(item?.dataIndex ?? ""),
|
|
1014
|
+
hide: item?.hide === true
|
|
1015
|
+
}));
|
|
1016
|
+
const rows = Array.isArray(data.data) ? data.data : Array.isArray(data.displayData) ? data.displayData : [];
|
|
1017
|
+
const displayData = Array.isArray(data.displayData) ? data.displayData : [];
|
|
1018
|
+
const visibleColumns = columns.filter((item) => item?.hide !== true).map((item) => ({ title: String(item?.title ?? ""), dataIndex: String(item?.dataIndex ?? "") }));
|
|
1019
|
+
const fieldNames = /* @__PURE__ */ new Set();
|
|
1020
|
+
for (const row of [...rows, ...displayData]) {
|
|
1021
|
+
for (const key of Object.keys(row)) {
|
|
1022
|
+
if (!key || NON_DISPLAY_FIELDS.has(key) || /(?:Action|Span)$/.test(key)) continue;
|
|
1023
|
+
fieldNames.add(key);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
const dataFields = [...fieldNames];
|
|
1027
|
+
const pageSize = data.pageSize === void 0 ? void 0 : Number(data.pageSize);
|
|
1028
|
+
const total = data.total === void 0 ? void 0 : Number(data.total);
|
|
1029
|
+
return {
|
|
1030
|
+
columns,
|
|
1031
|
+
visibleColumns,
|
|
1032
|
+
rows,
|
|
1033
|
+
displayData,
|
|
1034
|
+
dataFields,
|
|
1035
|
+
pageNo: Number(data.current ?? current),
|
|
1036
|
+
...pageSize === void 0 ? {} : { pageSize },
|
|
1037
|
+
...total === void 0 ? {} : { total }
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
var prelibList = {
|
|
1041
|
+
name: "archive.prelib.list",
|
|
1042
|
+
resource: "prelib",
|
|
1043
|
+
method: "list",
|
|
1044
|
+
action: "archive.prelib.list",
|
|
1045
|
+
summary: "\u67E5\u8BE2\u9884\u5F52\u6863\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\uFF1AtreeId \u2192 getTreeDetail \u53D6\u5217\u8868\u89C6\u56FE\uFF08url1/metaFormId/tag\uFF09\u2192 getListDatas \u53D6\u5217\u4E0E\u6570\u636E\u884C\uFF08\u53EA\u8BFB\uFF09",
|
|
1046
|
+
capability: "prelib",
|
|
1047
|
+
risk: READ,
|
|
1048
|
+
inputSchema: schemaOf(
|
|
1049
|
+
{
|
|
1050
|
+
treeId: {
|
|
1051
|
+
type: "string",
|
|
1052
|
+
description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF08\u5F62\u5982 {appId}_{appId}\uFF09\uFF1B\u4E0D\u4F20\u65F6\u53D6\u9884\u5F52\u6863\u6811\u7B2C\u4E00\u4E2A\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9"
|
|
1053
|
+
},
|
|
1054
|
+
pageNo: { type: "integer", minimum: 1, description: "\u9875\u7801\uFF0C\u9ED8\u8BA4 1" }
|
|
1055
|
+
},
|
|
1056
|
+
{ description: "\u67E5\u8BE2\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868" }
|
|
1057
|
+
),
|
|
1058
|
+
handler: async (args, { host }) => {
|
|
1059
|
+
const node = await resolveEfileNode(host, optionalText(args.treeId));
|
|
1060
|
+
const detail = await fetchTreeDetail(host, node.treeId);
|
|
1061
|
+
const page = await fetchPrelibDatas(host, node, detail, args.pageNo);
|
|
1062
|
+
const session = await host.getSession();
|
|
1063
|
+
const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
|
|
1064
|
+
const openUrls = page.rows.map((row) => {
|
|
1065
|
+
const id = String(row?.id ?? "").trim();
|
|
1066
|
+
const path = `${PRELIB_FILE_LIB_EDIT_PATH}?${new URLSearchParams({ singleMetaId: id, treeId: node.treeId }).toString()}`;
|
|
1067
|
+
return id && root ? `${root}${path}` : "";
|
|
1068
|
+
});
|
|
1069
|
+
return archiveSuccess(
|
|
1070
|
+
"archive.prelib.list",
|
|
1071
|
+
{
|
|
1072
|
+
treeId: node.treeId,
|
|
1073
|
+
nodeName: node.nodeName,
|
|
1074
|
+
listId: detail.listId,
|
|
1075
|
+
metaFormId: detail.metaFormId,
|
|
1076
|
+
tag: detail.tag,
|
|
1077
|
+
url1: detail.url1,
|
|
1078
|
+
...detail.boxUrl ? { boxUrl: detail.boxUrl } : {},
|
|
1079
|
+
...page,
|
|
1080
|
+
openUrls
|
|
1081
|
+
},
|
|
1082
|
+
{ count: page.rows.length, nodeName: node.nodeName }
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
var intelligentPrepare = {
|
|
1087
|
+
name: "archive.prelib.intelligent.prepare",
|
|
1088
|
+
resource: "prelib",
|
|
1089
|
+
method: "intelligent",
|
|
1090
|
+
action: "archive.prelib.intelligent.prepare",
|
|
1091
|
+
summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u53D1\u8D77\u667A\u80FD\u8BC6\u522B\uFF08\u9884\u68C0\uFF0C\u4E0D\u5199\u6570\u636E\uFF09\uFF1A\u89E3\u6790 treeId/formId \u5E76\u751F\u6210\u786E\u8BA4\u7968\u636E",
|
|
1092
|
+
capability: "prelib",
|
|
1093
|
+
risk: READ,
|
|
1094
|
+
inputSchema: schemaOf(
|
|
1095
|
+
{
|
|
1096
|
+
treeId: {
|
|
1097
|
+
type: "string",
|
|
1098
|
+
description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF1B\u4E0D\u4F20\u65F6\u53D6\u9884\u5F52\u6863\u6811\u7B2C\u4E00\u4E2A\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9"
|
|
1099
|
+
},
|
|
1100
|
+
checkIds: {
|
|
1101
|
+
type: "array",
|
|
1102
|
+
items: { type: "string" },
|
|
1103
|
+
description: "\u52FE\u9009\u7684\u6570\u636E ID \u5217\u8868\uFF08\u53D6\u81EA archive.prelib.list \u8FD4\u56DE\u884C\u7684 id\uFF09"
|
|
1104
|
+
},
|
|
1105
|
+
formId: {
|
|
1106
|
+
type: "string",
|
|
1107
|
+
description: "\u8868\u5355 ID\uFF1B\u4E0D\u4F20\u65F6\u53D6 getTreeDetail \u7684 extraParams.metaFormId"
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
{ required: ["checkIds"], description: "\u667A\u80FD\u8BC6\u522B\u9884\u68C0" }
|
|
1111
|
+
),
|
|
1112
|
+
handler: async (args, env) => {
|
|
1113
|
+
const checkIds = toStringIdList(args.checkIds, "checkIds");
|
|
1114
|
+
if (!checkIds || checkIds.length === 0) {
|
|
1115
|
+
throw archiveValidationError("id_list_required", "checkIds \u5FC5\u586B\u4E14\u81F3\u5C11\u4E00\u9879");
|
|
1116
|
+
}
|
|
1117
|
+
const node = await resolveEfileNode(env.host, optionalText(args.treeId));
|
|
1118
|
+
const detail = await fetchTreeDetail(env.host, node.treeId);
|
|
1119
|
+
const formId = optionalText(args.formId) ?? detail.metaFormId;
|
|
1120
|
+
const { continuation, expiresInMs } = await issueLease(env, INTELLIGENT_APPLY, {
|
|
1121
|
+
treeId: node.treeId,
|
|
1122
|
+
formId,
|
|
1123
|
+
checkIds
|
|
1124
|
+
});
|
|
1125
|
+
return archiveSuccess(
|
|
1126
|
+
"archive.prelib.intelligent.prepare",
|
|
1127
|
+
{
|
|
1128
|
+
preview: { treeId: node.treeId, nodeName: node.nodeName, formId, count: checkIds.length, checkIds },
|
|
1129
|
+
hint: `\u786E\u8BA4\u540E\u8C03\u7528 ${INTELLIGENT_APPLY}\uFF08CLI\uFF1Aarchive run ${INTELLIGENT_APPLY} --input-json '{"continuation":"<token>","confirm":true}'\uFF09`,
|
|
1130
|
+
continuation
|
|
1131
|
+
},
|
|
1132
|
+
{ requiresConfirmation: true, expiresInMs }
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
var intelligentApply = {
|
|
1137
|
+
name: INTELLIGENT_APPLY,
|
|
1138
|
+
resource: "prelib",
|
|
1139
|
+
method: "intelligent",
|
|
1140
|
+
action: INTELLIGENT_APPLY,
|
|
1141
|
+
summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u53D1\u8D77\u667A\u80FD\u8BC6\u522B\uFF08\u5199\u64CD\u4F5C\uFF09\uFF1A\u8C03\u7528 intelligentCate \u63D0\u4EA4\u8BC6\u522B\u4EFB\u52A1\uFF0C\u8FD4\u56DE taskId",
|
|
1142
|
+
capability: "prelib",
|
|
1143
|
+
risk: WRITE,
|
|
1144
|
+
requiresConfirmation: true,
|
|
1145
|
+
inputSchema: schemaOf(
|
|
1146
|
+
{
|
|
1147
|
+
continuation: { type: "string", description: "prepare \u8FD4\u56DE\u7684\u786E\u8BA4\u7968\u636E" },
|
|
1148
|
+
confirm: { type: "boolean", description: "\u5FC5\u987B\u4E3A true\uFF08CLI --yes\uFF09" }
|
|
1149
|
+
},
|
|
1150
|
+
{ required: ["continuation", "confirm"], description: "\u63D0\u4EA4\u667A\u80FD\u8BC6\u522B\u4EFB\u52A1" }
|
|
1151
|
+
),
|
|
1152
|
+
handler: async (args, env) => {
|
|
1153
|
+
const lease = await verifyLease(args, INTELLIGENT_APPLY, env);
|
|
1154
|
+
const treeId = String(lease.treeId ?? "").trim();
|
|
1155
|
+
const formId = String(lease.formId ?? "").trim();
|
|
1156
|
+
const checkIds = Array.isArray(lease.checkIds) ? lease.checkIds.map(String) : [];
|
|
1157
|
+
if (!treeId || !formId || checkIds.length === 0) {
|
|
1158
|
+
throw archiveValidationError("continuation_payload_invalid", "\u786E\u8BA4\u7968\u636E\u7F3A\u5C11 treeId / formId / checkIds");
|
|
1159
|
+
}
|
|
1160
|
+
const response = await env.host.request({
|
|
1161
|
+
method: "POST",
|
|
1162
|
+
path: "/api/archive/core/intelligent/intelligentCate",
|
|
1163
|
+
body: {
|
|
1164
|
+
treeId,
|
|
1165
|
+
checkIds: checkIds.join(","),
|
|
1166
|
+
formId,
|
|
1167
|
+
logFlag: PRELIB_MENU_SIGN
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
const data = unwrapData(response) ?? {};
|
|
1171
|
+
const taskId = String(data.taskId ?? "").trim();
|
|
1172
|
+
return archiveSuccess(
|
|
1173
|
+
INTELLIGENT_APPLY,
|
|
1174
|
+
{
|
|
1175
|
+
treeId,
|
|
1176
|
+
formId,
|
|
1177
|
+
checkIds,
|
|
1178
|
+
...taskId ? { taskId } : {},
|
|
1179
|
+
hint: "\u667A\u80FD\u8BC6\u522B\u4E3A\u5F02\u6B65\u4EFB\u52A1\uFF0C\u8FD4\u56DE taskId \u8868\u793A\u5DF2\u63D0\u4EA4\uFF1B\u8BC6\u522B\u7ED3\u679C\u9700\u5728\u7CFB\u7EDF\u4E2D\u67E5\u770B"
|
|
1180
|
+
},
|
|
1181
|
+
{ wrote: true, count: checkIds.length }
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
var arrangePrepare = {
|
|
1186
|
+
name: "archive.prelib.arrange.prepare",
|
|
1187
|
+
resource: "prelib",
|
|
1188
|
+
method: "arrange",
|
|
1189
|
+
action: "archive.prelib.arrange.prepare",
|
|
1190
|
+
summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u63D0\u4EA4\u6574\u7406\uFF08\u9884\u68C0\uFF0C\u4E0D\u5199\u6570\u636E\uFF09\uFF1A\u89E3\u6790 treeId/formId \u5E76\u751F\u6210\u786E\u8BA4\u7968\u636E",
|
|
1191
|
+
capability: "prelib",
|
|
1192
|
+
risk: READ,
|
|
1193
|
+
inputSchema: schemaOf(
|
|
1194
|
+
{
|
|
1195
|
+
treeId: {
|
|
1196
|
+
type: "string",
|
|
1197
|
+
description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF1B\u4E0D\u4F20\u65F6\u53D6\u9884\u5F52\u6863\u6811\u7B2C\u4E00\u4E2A\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9"
|
|
1198
|
+
},
|
|
1199
|
+
checkIds: {
|
|
1200
|
+
type: "array",
|
|
1201
|
+
items: { type: "string" },
|
|
1202
|
+
description: "\u52FE\u9009\u7684\u6570\u636E ID \u5217\u8868\uFF08\u53D6\u81EA archive.prelib.list \u8FD4\u56DE\u884C\u7684 id\uFF09"
|
|
1203
|
+
},
|
|
1204
|
+
formId: {
|
|
1205
|
+
type: "string",
|
|
1206
|
+
description: "\u8868\u5355 ID\uFF1B\u4E0D\u4F20\u65F6\u53D6 getTreeDetail \u7684 extraParams.metaFormId"
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1209
|
+
{ required: ["checkIds"], description: "\u63D0\u4EA4\u6574\u7406\u9884\u68C0" }
|
|
1210
|
+
),
|
|
1211
|
+
handler: async (args, env) => {
|
|
1212
|
+
const checkIds = toStringIdList(args.checkIds, "checkIds");
|
|
1213
|
+
if (!checkIds || checkIds.length === 0) {
|
|
1214
|
+
throw archiveValidationError("id_list_required", "checkIds \u5FC5\u586B\u4E14\u81F3\u5C11\u4E00\u9879");
|
|
1215
|
+
}
|
|
1216
|
+
const node = await resolveEfileNode(env.host, optionalText(args.treeId));
|
|
1217
|
+
const detail = await fetchTreeDetail(env.host, node.treeId);
|
|
1218
|
+
const formId = optionalText(args.formId) ?? detail.metaFormId;
|
|
1219
|
+
const { continuation, expiresInMs } = await issueLease(env, ARRANGE_APPLY, {
|
|
1220
|
+
treeId: node.treeId,
|
|
1221
|
+
formId,
|
|
1222
|
+
checkIds
|
|
1223
|
+
});
|
|
1224
|
+
return archiveSuccess(
|
|
1225
|
+
"archive.prelib.arrange.prepare",
|
|
1226
|
+
{
|
|
1227
|
+
preview: { treeId: node.treeId, nodeName: node.nodeName, formId, count: checkIds.length, checkIds },
|
|
1228
|
+
hint: `\u53EA\u6709\u8BC6\u522B\u72B6\u6001\u4E3A\u300C\u5DF2\u8BC6\u522B\u300D\u7684\u6570\u636E\u624D\u4F1A\u88AB\u6574\u7406\uFF1B\u672A\u8BC6\u522B / \u8BC6\u522B\u4E2D / \u8BC6\u522B\u5F02\u5E38\u7684\u884C\u63D0\u4EA4\u540E\u4E5F\u4F1A\u88AB\u670D\u52A1\u7AEF\u8FC7\u6EE4\u6389\uFF08\u4E0D\u62A5\u9519\u4F46\u5B9E\u9645\u4E0D\u5904\u7406\uFF09\uFF0C\u5EFA\u8BAE\u5148\u505A\u667A\u80FD\u8BC6\u522B\u5E76\u786E\u8BA4\u8BC6\u522B\u6210\u529F\u3002\u786E\u8BA4\u540E\u8C03\u7528 ${ARRANGE_APPLY}\uFF1B\u670D\u52A1\u7AEF\u4F1A\u8FD4\u56DE\u5B9E\u9645\u5904\u7406\u6761\u6570\uFF0C\u4E0D\u8981\u58F0\u79F0\u5168\u90E8\u6574\u7406\u5B8C\u6210`,
|
|
1229
|
+
continuation
|
|
1230
|
+
},
|
|
1231
|
+
{ requiresConfirmation: true, expiresInMs }
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
var arrangeApply = {
|
|
1236
|
+
name: ARRANGE_APPLY,
|
|
1237
|
+
resource: "prelib",
|
|
1238
|
+
method: "arrange",
|
|
1239
|
+
action: ARRANGE_APPLY,
|
|
1240
|
+
summary: "\u5BF9\u7535\u5B50\u6587\u4EF6\u5E93\u5217\u8868\u91CC\u52FE\u9009\u7684\u6570\u636E\u63D0\u4EA4\u6574\u7406\uFF08\u5199\u64CD\u4F5C\uFF09\uFF1A\u8C03\u7528 prefileBatch/batchSave\uFF0C\u8FD4\u56DE\u670D\u52A1\u7AEF\u5904\u7406\u8BF4\u660E",
|
|
1241
|
+
capability: "prelib",
|
|
1242
|
+
risk: WRITE,
|
|
1243
|
+
requiresConfirmation: true,
|
|
1244
|
+
inputSchema: schemaOf(
|
|
1245
|
+
{
|
|
1246
|
+
continuation: { type: "string", description: "prepare \u8FD4\u56DE\u7684\u786E\u8BA4\u7968\u636E" },
|
|
1247
|
+
confirm: { type: "boolean", description: "\u5FC5\u987B\u4E3A true\uFF08CLI --yes\uFF09" }
|
|
1248
|
+
},
|
|
1249
|
+
{ required: ["continuation", "confirm"], description: "\u63D0\u4EA4\u6574\u7406" }
|
|
1250
|
+
),
|
|
1251
|
+
handler: async (args, env) => {
|
|
1252
|
+
const lease = await verifyLease(args, ARRANGE_APPLY, env);
|
|
1253
|
+
const treeId = String(lease.treeId ?? "").trim();
|
|
1254
|
+
const formId = String(lease.formId ?? "").trim();
|
|
1255
|
+
const checkIds = Array.isArray(lease.checkIds) ? lease.checkIds.map(String) : [];
|
|
1256
|
+
if (!treeId || !formId || checkIds.length === 0) {
|
|
1257
|
+
throw archiveValidationError("continuation_payload_invalid", "\u786E\u8BA4\u7968\u636E\u7F3A\u5C11 treeId / formId / checkIds");
|
|
1258
|
+
}
|
|
1259
|
+
const response = await env.host.request({
|
|
1260
|
+
method: "POST",
|
|
1261
|
+
path: "/api/archive/core/prefileBatch/batchSave",
|
|
1262
|
+
body: {
|
|
1263
|
+
treeId,
|
|
1264
|
+
autoBatchProduct: true,
|
|
1265
|
+
formId,
|
|
1266
|
+
checkIds: checkIds.join(","),
|
|
1267
|
+
logFlag: PRELIB_MENU_SIGN
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
const raw = response;
|
|
1271
|
+
const message = String(raw?.msg ?? "").trim();
|
|
1272
|
+
return archiveSuccess(
|
|
1273
|
+
ARRANGE_APPLY,
|
|
1274
|
+
{
|
|
1275
|
+
treeId,
|
|
1276
|
+
formId,
|
|
1277
|
+
checkIds,
|
|
1278
|
+
...message ? { message } : {},
|
|
1279
|
+
hint: "\u63D0\u4EA4\u6574\u7406\u53EA\u5904\u7406\u8BC6\u522B\u72B6\u6001\u4E3A\u300C\u5DF2\u8BC6\u522B\u300D\u7684\u6570\u636E\uFF1B\u672A\u8BC6\u522B / \u8BC6\u522B\u4E2D / \u8BC6\u522B\u5F02\u5E38\u7684\u884C\u4F1A\u88AB\u670D\u52A1\u7AEF\u8FC7\u6EE4\u3002\u5FC5\u987B\u628A\u670D\u52A1\u7AEF message \u5982\u5B9E\u8F6C\u8FBE\uFF0C\u4E0D\u8981\u58F0\u79F0\u5168\u90E8\u6574\u7406\u5B8C\u6210\uFF1B\u82E5\u5904\u7406\u6761\u6570\u4E3A 0\uFF0C\u63D0\u793A\u7528\u6237\u5148\u505A\u667A\u80FD\u8BC6\u522B\u4E14\u8BC6\u522B\u6210\u529F\u540E\u518D\u6574\u7406"
|
|
1280
|
+
},
|
|
1281
|
+
{ wrote: true, count: checkIds.length }
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1285
|
+
var PRELIB_FILE_LIB_EDIT_PATH = "/sp/custom/archive/fileLibEdit";
|
|
1286
|
+
var prelibOpen = {
|
|
1287
|
+
name: "archive.prelib.open",
|
|
1288
|
+
resource: "prelib",
|
|
1289
|
+
method: "open",
|
|
1290
|
+
action: "archive.prelib.open",
|
|
1291
|
+
summary: "\u751F\u6210\u9884\u5F52\u6863\u7535\u5B50\u6587\u4EF6\u5E93\u91CC\u6307\u5B9A\u6570\u636E\u7684\u6863\u6848\u6253\u5F00\u94FE\u63A5\uFF08\u53EA\u8BFB\uFF09\uFF1A\u6309\u884C id\uFF08singleMetaId\uFF09\u4E0E\u8282\u70B9 treeId \u62FC\u51FA fileLibEdit \u94FE\u63A5",
|
|
1292
|
+
capability: "prelib",
|
|
1293
|
+
risk: READ,
|
|
1294
|
+
inputSchema: schemaOf(
|
|
1295
|
+
{
|
|
1296
|
+
checkIds: {
|
|
1297
|
+
type: "array",
|
|
1298
|
+
items: { type: "string" },
|
|
1299
|
+
description: "\u6570\u636E ID \u5217\u8868\uFF08\u53D6\u81EA archive.prelib.list \u8FD4\u56DE\u884C\u7684 id\uFF09\uFF0C\u5373\u94FE\u63A5\u7684 singleMetaId"
|
|
1300
|
+
},
|
|
1301
|
+
treeId: {
|
|
1302
|
+
type: "string",
|
|
1303
|
+
description: "\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9 treeId\uFF1B\u4E0D\u4F20\u65F6\u81EA\u52A8\u53D6\u3002treeId \u672C\u8EAB\u5373 ${systemId}_${metadataId}"
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
{ required: ["checkIds"], description: "\u751F\u6210\u6863\u6848\u6253\u5F00\u94FE\u63A5" }
|
|
1307
|
+
),
|
|
1308
|
+
handler: async (args, env) => {
|
|
1309
|
+
const checkIds = toStringIdList(args.checkIds, "checkIds");
|
|
1310
|
+
if (!checkIds || checkIds.length === 0) {
|
|
1311
|
+
throw archiveValidationError("id_list_required", "checkIds \u5FC5\u586B\u4E14\u81F3\u5C11\u4E00\u9879");
|
|
1312
|
+
}
|
|
1313
|
+
const node = await resolveEfileNode(env.host, optionalText(args.treeId));
|
|
1314
|
+
const [systemId, metadataId = ""] = node.treeId.split("_");
|
|
1315
|
+
const session = await env.host.getSession();
|
|
1316
|
+
const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
|
|
1317
|
+
const links = checkIds.map((id) => {
|
|
1318
|
+
const path = `${PRELIB_FILE_LIB_EDIT_PATH}?${new URLSearchParams({ singleMetaId: id, treeId: node.treeId }).toString()}`;
|
|
1319
|
+
return {
|
|
1320
|
+
singleMetaId: id,
|
|
1321
|
+
treeId: node.treeId,
|
|
1322
|
+
path,
|
|
1323
|
+
url: root ? `${root}${path}` : path
|
|
1324
|
+
};
|
|
1325
|
+
});
|
|
1326
|
+
return archiveSuccess(
|
|
1327
|
+
"archive.prelib.open",
|
|
1328
|
+
{
|
|
1329
|
+
nodeName: node.nodeName,
|
|
1330
|
+
systemId,
|
|
1331
|
+
metadataId,
|
|
1332
|
+
count: links.length,
|
|
1333
|
+
links,
|
|
1334
|
+
...links.length === 1 ? { url: links[0].url } : {},
|
|
1335
|
+
hint: "CLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u8BE5 URL\uFF08\u9700\u5DF2\u767B\u5F55\u8BE5\u73AF\u5883\u4E14\u6709\u8BE5\u6863\u6848\u67E5\u770B\u6743\u9650\uFF09"
|
|
1336
|
+
}
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
var prelibOperations = [
|
|
1341
|
+
prelibList,
|
|
1342
|
+
intelligentPrepare,
|
|
1343
|
+
intelligentApply,
|
|
1344
|
+
arrangePrepare,
|
|
1345
|
+
arrangeApply,
|
|
1346
|
+
prelibOpen
|
|
1347
|
+
];
|
|
1348
|
+
|
|
823
1349
|
// src/shortcuts/archive/operations/archive-info.ts
|
|
824
1350
|
function splitArcId(arcDangan, field) {
|
|
825
1351
|
const text = typeof arcDangan === "string" ? arcDangan : String(arcDangan ?? "");
|
|
@@ -957,7 +1483,7 @@ var searchRun = {
|
|
|
957
1483
|
var searchOperations = [searchRun];
|
|
958
1484
|
|
|
959
1485
|
// src/shortcuts/archive/operations/getPageUrl.ts
|
|
960
|
-
import { randomBytes as
|
|
1486
|
+
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
961
1487
|
var ARCHIVE_APP_TAG = "archive_wsd";
|
|
962
1488
|
var BORROW_CAR_TAG = "uf_arc_borrow_car";
|
|
963
1489
|
var BORROWING_TAG = "uf_arc_borrowing";
|
|
@@ -1044,7 +1570,7 @@ async function fetchArchiveListDatas(host, target, pageNo, logFlag) {
|
|
|
1044
1570
|
listId: target.viewId,
|
|
1045
1571
|
searchParamData: { searchType: "2", type: "and", commonSearchFields: {}, groupFields: {} },
|
|
1046
1572
|
requiredMatch: 1,
|
|
1047
|
-
tableuid:
|
|
1573
|
+
tableuid: randomBytes3(16).toString("hex"),
|
|
1048
1574
|
mapResult: "1",
|
|
1049
1575
|
recheckQuery: "1",
|
|
1050
1576
|
isFollow: 0,
|
|
@@ -1407,7 +1933,17 @@ var borrowListDetail = {
|
|
|
1407
1933
|
}
|
|
1408
1934
|
const session = await host.getSession();
|
|
1409
1935
|
const detail = await fetchBorrowDetail(host, session.userId, String(dataId));
|
|
1410
|
-
|
|
1936
|
+
const root = String(session?.baseUrl ?? "").replace(/\/+$/, "");
|
|
1937
|
+
const details = detail.details.map((item) => ({
|
|
1938
|
+
...item,
|
|
1939
|
+
arcDangan: item.arcDangan.map((arc) => {
|
|
1940
|
+
const [arcId, arcFormId = ""] = String(arc.id ?? "").split("_");
|
|
1941
|
+
if (!arcId || !arcFormId) return arc;
|
|
1942
|
+
const viewPath = `/sp/custom/archive/archiveView?arcId=${arcId}&arcFormId=${arcFormId}`;
|
|
1943
|
+
return { ...arc, viewPath, url: root ? `${root}${viewPath}` : viewPath };
|
|
1944
|
+
})
|
|
1945
|
+
}));
|
|
1946
|
+
return archiveSuccess("archive.borrow-list.detail", { ...detail, details }, { count: details.length });
|
|
1411
1947
|
}
|
|
1412
1948
|
};
|
|
1413
1949
|
var borrowListOperations = [borrowListList, borrowListDetail];
|
|
@@ -1417,56 +1953,6 @@ import { existsSync as existsSync2 } from "node:fs";
|
|
|
1417
1953
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
1418
1954
|
import { homedir as homedir2 } from "node:os";
|
|
1419
1955
|
import { basename, dirname, extname, resolve as resolve2 } from "node:path";
|
|
1420
|
-
|
|
1421
|
-
// src/shortcuts/archive/operations/confirm.ts
|
|
1422
|
-
function requireConfirm(args, action) {
|
|
1423
|
-
if (args.confirm !== true) {
|
|
1424
|
-
throw archiveConfirmationError(action, {
|
|
1425
|
-
hint: `\u6267\u884C ${action} \u5FC5\u987B\u663E\u5F0F\u786E\u8BA4\uFF1A\u4F20\u5165 confirm=true\uFF08CLI \u7528 --yes\uFF09`
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
async function issueLease(env, action, payload, ttlMs = 10 * 6e4) {
|
|
1430
|
-
const session = await env.host.getSession();
|
|
1431
|
-
const continuation = await env.continuation.issue(
|
|
1432
|
-
{
|
|
1433
|
-
operation: action,
|
|
1434
|
-
baseUrl: session.baseUrl,
|
|
1435
|
-
userId: session.userId,
|
|
1436
|
-
...payload
|
|
1437
|
-
},
|
|
1438
|
-
ttlMs
|
|
1439
|
-
);
|
|
1440
|
-
return { continuation, expiresInMs: ttlMs };
|
|
1441
|
-
}
|
|
1442
|
-
async function verifyLease(args, action, env) {
|
|
1443
|
-
requireConfirm(args, action);
|
|
1444
|
-
if (typeof args.continuation !== "string" || !args.continuation.trim()) {
|
|
1445
|
-
throw archiveValidationError("continuation_required", `${action} \u5FC5\u987B\u4F20\u5165 prepare \u8FD4\u56DE\u7684 continuation`);
|
|
1446
|
-
}
|
|
1447
|
-
const lease = await env.continuation.verify(args.continuation.trim(), action);
|
|
1448
|
-
const session = await env.host.getSession();
|
|
1449
|
-
if (lease.baseUrl !== session.baseUrl || lease.userId !== session.userId) {
|
|
1450
|
-
throw archiveValidationError(
|
|
1451
|
-
"continuation_context_mismatch",
|
|
1452
|
-
"\u786E\u8BA4\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF08\u73AF\u5883\u6216\u767B\u5F55\u8D26\u53F7\u4E0D\u540C\uFF09\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare"
|
|
1453
|
-
);
|
|
1454
|
-
}
|
|
1455
|
-
return lease;
|
|
1456
|
-
}
|
|
1457
|
-
function assertLeaseTarget(lease, args, keys, action) {
|
|
1458
|
-
for (const key of keys) {
|
|
1459
|
-
if (args[key] === void 0 || args[key] === null || args[key] === "") continue;
|
|
1460
|
-
if (String(lease[key] ?? "") !== String(args[key])) {
|
|
1461
|
-
throw archiveValidationError(
|
|
1462
|
-
"continuation_target_changed",
|
|
1463
|
-
`${action} \u7684\u53C2\u6570 ${key} \u4E0E prepare \u65F6\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare`
|
|
1464
|
-
);
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
// src/shortcuts/archive/operations/download.ts
|
|
1470
1956
|
var DOWNLOAD_APPLY = "archive.borrow-list.download.apply";
|
|
1471
1957
|
var EXPORT_TYPES = ["0", "1"];
|
|
1472
1958
|
var EXPORT_STRUCTURES = ["", "0", "1", "2"];
|
|
@@ -1491,7 +1977,7 @@ function sleep(ms) {
|
|
|
1491
1977
|
setTimeout(done, ms);
|
|
1492
1978
|
});
|
|
1493
1979
|
}
|
|
1494
|
-
function
|
|
1980
|
+
function optionalText2(value, field) {
|
|
1495
1981
|
if (value === void 0 || value === null || value === "") return void 0;
|
|
1496
1982
|
if (typeof value !== "string") {
|
|
1497
1983
|
throw archiveValidationError("field_invalid", `${field} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
|
|
@@ -1503,9 +1989,9 @@ function parseExportParams(args) {
|
|
|
1503
1989
|
if (!EXPORT_TYPES.includes(exportType)) {
|
|
1504
1990
|
throw archiveValidationError("export_type_invalid", "exportType \u53EA\u80FD\u662F 0\uFF08\u76F4\u63A5\u5BFC\u51FA\uFF09\u6216 1\uFF08\u5206\u7EC4\u5BFC\u51FA\uFF09");
|
|
1505
1991
|
}
|
|
1506
|
-
const exportStructure =
|
|
1507
|
-
const groupField =
|
|
1508
|
-
const documentField =
|
|
1992
|
+
const exportStructure = optionalText2(args.exportStructure, "exportStructure") ?? "";
|
|
1993
|
+
const groupField = optionalText2(args.groupField, "groupField") ?? "";
|
|
1994
|
+
const documentField = optionalText2(args.documentField, "documentField") ?? "";
|
|
1509
1995
|
if (!EXPORT_STRUCTURES.includes(exportStructure)) {
|
|
1510
1996
|
throw archiveValidationError("export_structure_invalid", "exportStructure \u53EA\u80FD\u662F\u7A7A\u30010\u30011\u30012");
|
|
1511
1997
|
}
|
|
@@ -1590,7 +2076,7 @@ var downloadPrepare = {
|
|
|
1590
2076
|
const exportParams = parseExportParams(args);
|
|
1591
2077
|
const session = await env.host.getSession();
|
|
1592
2078
|
const { workflowId, returnDateTime } = await assertDownloadable(env.host, session.userId, String(dataId));
|
|
1593
|
-
const output =
|
|
2079
|
+
const output = optionalText2(args.output, "output");
|
|
1594
2080
|
const { continuation, expiresInMs } = await issueLease(env, DOWNLOAD_APPLY, {
|
|
1595
2081
|
dataId: String(dataId),
|
|
1596
2082
|
requestId: workflowId,
|
|
@@ -1772,7 +2258,7 @@ function flowResult(action, baseUrl, workflowId, params, extra = {}) {
|
|
|
1772
2258
|
workflowId,
|
|
1773
2259
|
url: buildFlowUrl(baseUrl, workflowId, params),
|
|
1774
2260
|
params,
|
|
1775
|
-
hint: "CLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\
|
|
2261
|
+
hint: "CLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u4E5F\u4E0D\u8981\u6267\u884C open/start \u81EA\u52A8\u6253\u5F00\uFF1B\u8BF7\u628A url \u4EE5 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u7531\u5BA2\u6237\u7AEF\u51B3\u5B9A\u6253\u5F00\u65B9\u5F0F"
|
|
1776
2262
|
},
|
|
1777
2263
|
{ wrote: true }
|
|
1778
2264
|
);
|
|
@@ -2001,7 +2487,7 @@ import { basename as basename2, resolve as resolve3 } from "node:path";
|
|
|
2001
2487
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
2002
2488
|
var UPLOAD_APPLY = "archive.upload.prelib.apply";
|
|
2003
2489
|
var MAX_UPLOAD_BYTES = 200 * 1024 * 1024;
|
|
2004
|
-
function
|
|
2490
|
+
function isEfileLibNode3(item) {
|
|
2005
2491
|
const id = typeof item?.id === "string" ? item.id : "";
|
|
2006
2492
|
if (!id || !id.includes("_")) return false;
|
|
2007
2493
|
const [left, right] = id.split("_");
|
|
@@ -2017,9 +2503,12 @@ async function resolveDefaultTreeId(host) {
|
|
|
2017
2503
|
if (!Array.isArray(data)) {
|
|
2018
2504
|
throw archiveValidationError("tree_invalid", "getTree \u8FD4\u56DE\u5F02\u5E38\uFF1Adata \u4E0D\u662F\u6570\u7EC4");
|
|
2019
2505
|
}
|
|
2020
|
-
const nodes = data.filter(
|
|
2506
|
+
const nodes = data.filter(isEfileLibNode3);
|
|
2021
2507
|
if (nodes.length === 0) {
|
|
2022
|
-
throw archiveValidationError(
|
|
2508
|
+
throw archiveValidationError(
|
|
2509
|
+
"tree_id_required",
|
|
2510
|
+
"\u672A\u627E\u5230\u7535\u5B50\u6587\u4EF6\u5E93\u8282\u70B9\uFF08\u9884\u5F52\u6863\u6811\u8FD4\u56DE\u4E3A\u7A7A\uFF09\u3002\u8BF7\u5148\u91CD\u65B0\u83B7\u53D6\u4E00\u6B21\uFF1A\u91CD\u8BD5\u672C operation\uFF0C\u6216\u7528\u5DF2\u77E5 treeId \u663E\u5F0F\u4F20\u5165\uFF1B\u82E5\u4ECD\u7136\u83B7\u53D6\u4E0D\u5230\uFF0C\u901A\u5E38\u662F\u5F53\u524D\u8D26\u53F7\u6CA1\u6709\u8BE5\u9884\u5F52\u6863\u5E93\u6743\u9650\uFF0C\u6B64\u65F6\u5E94\u505C\u6B62\u4E0A\u4F20\uFF08\u4E0D\u8981\u731C\u6D4B treeId\uFF09\u3002"
|
|
2511
|
+
);
|
|
2023
2512
|
}
|
|
2024
2513
|
if (nodes.length > 1) {
|
|
2025
2514
|
throw archiveValidationError(
|
|
@@ -2185,6 +2674,7 @@ function buildRegistry() {
|
|
|
2185
2674
|
const registry = /* @__PURE__ */ new Map();
|
|
2186
2675
|
const definitions = [
|
|
2187
2676
|
...fondsOperations,
|
|
2677
|
+
...prelibOperations,
|
|
2188
2678
|
...archiveInfoOperations,
|
|
2189
2679
|
...searchOperations,
|
|
2190
2680
|
...borrowCarOperations,
|
|
@@ -2239,7 +2729,7 @@ var archiveManifest = {
|
|
|
2239
2729
|
rules: [
|
|
2240
2730
|
"\u5199\u64CD\u4F5C\uFF08*.apply\uFF09\u5FC5\u987B\u5148\u6267\u884C\u540C\u540D\u7684 prepare \u62FF\u5230 continuation\uFF0C\u518D\u5E26 confirm=true \u6267\u884C apply\uFF1BCLI \u7528 --yes \u8868\u793A\u786E\u8BA4\u3002",
|
|
2241
2731
|
"\u501F\u9605\u5355\u4E0B\u8F7D\u4E3A\u5F02\u6B65\u4EFB\u52A1\uFF1Aapply \u4F1A\u8F6E\u8BE2\u6253\u5305\u8FDB\u5EA6\uFF0C\u5B8C\u6210\u540E\u628A zip \u4FDD\u5B58\u5230\u5F53\u524D\u7528\u6237\u7684\u300C\u4E0B\u8F7D\u300D\u76EE\u5F55\uFF08\u53EF\u7528 output \u6307\u5B9A\u8DEF\u5F84\uFF09\u3002",
|
|
2242
|
-
"\u53D1\u8D77\u501F\u9605/\u7EED\u501F\u53EA\u8FD4\u56DE\u6D41\u7A0B\u521B\u5EFA\u9875 URL\uFF0CCLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\
|
|
2732
|
+
"\u53D1\u8D77\u501F\u9605/\u7EED\u501F\u53EA\u8FD4\u56DE\u6D41\u7A0B\u521B\u5EFA\u9875 URL\uFF0CCLI \u4E0D\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF1B\u5E94\u4EE5 Markdown \u8D85\u94FE\u63A5\uFF08a \u6807\u7B7E\uFF09\u8FD4\u56DE\uFF0C\u7531\u5BA2\u6237\u7AEF\u51B3\u5B9A\u6253\u5F00\u65B9\u5F0F\u3002",
|
|
2243
2733
|
"\u501F\u9605\u8F66/\u501F\u9605\u5355\u5217\u8868\u4F18\u5148\u81EA\u5B9A\u4E49\u63A5\u53E3\uFF0C\u63A5\u53E3\u672A\u53D1\u5E03\u65F6\u81EA\u52A8\u56DE\u9000 ebuilder \u5217\u8868\u94FE\u8DEF\uFF0C\u56DE\u9000\u65F6\u884C\u7684\u5B57\u6BB5\u66F4\u5C11\uFF08\u63D0\u4F9B fields/display\uFF09\u3002"
|
|
2244
2734
|
],
|
|
2245
2735
|
operations: archiveOperations,
|