weaver-work-cli 0.1.29 → 0.1.32
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-UMGX72K6.js +2537 -0
- package/dist/chunks/archive-oa-N2IYBLF3.js +1317 -0
- package/dist/chunks/asset-GLEGKFG5.js +2109 -0
- package/dist/chunks/attachment-content-AQNX5N3S.js +23 -0
- package/dist/chunks/blog-E44OTVDA.js +2157 -0
- package/dist/chunks/caizhilian-DQUFZXZL.js +10087 -0
- package/dist/chunks/calendar-JKPIRKFD.js +1195 -0
- package/dist/chunks/chunk-2GA5ZIQL.js +1615 -0
- package/dist/chunks/chunk-4YC43QQ4.js +403 -0
- package/dist/chunks/chunk-6EFWDL7Y.js +161 -0
- package/dist/chunks/chunk-6RKD4DRZ.js +5556 -0
- package/dist/chunks/chunk-AJ62BGAW.js +29 -0
- package/dist/chunks/chunk-BUSC6UAE.js +43 -0
- package/dist/chunks/chunk-C6R3B2ML.js +358 -0
- package/dist/chunks/chunk-CVZ2JOSW.js +62 -0
- package/dist/chunks/chunk-DW6AUUKS.js +508 -0
- package/dist/chunks/chunk-E4Z23GHM.js +6962 -0
- package/dist/chunks/chunk-EG6ZU444.js +654 -0
- package/dist/chunks/chunk-EZALDOQH.js +383 -0
- package/dist/chunks/chunk-FMPJJYYI.js +106 -0
- package/dist/chunks/chunk-G2JSIUWF.js +769 -0
- package/dist/chunks/chunk-G3QJULO2.js +387 -0
- package/dist/chunks/chunk-GCG2NMWR.js +703 -0
- package/dist/chunks/chunk-GPMFD4RD.js +75 -0
- package/dist/chunks/chunk-H6XSTSLM.js +2357 -0
- package/dist/chunks/chunk-H7J4DC5R.js +464 -0
- package/dist/chunks/chunk-IURUFGZK.js +477 -0
- package/dist/chunks/chunk-LUSPKZKY.js +53 -0
- package/dist/chunks/chunk-NIAJ5ZCG.js +73 -0
- package/dist/chunks/chunk-NOODWMCL.js +584 -0
- package/dist/chunks/chunk-OOUTBLZ4.js +51 -0
- package/dist/chunks/chunk-P26ZWSKU.js +73 -0
- package/dist/chunks/chunk-QWY6PGL6.js +3472 -0
- package/dist/chunks/chunk-WKI2FBIQ.js +15606 -0
- package/dist/chunks/chunk-WSKBSQ2U.js +231 -0
- package/dist/chunks/chunk-YLCYX7LE.js +371 -0
- package/dist/chunks/chunk-YRVDW4WN.js +205 -0
- package/dist/chunks/chunk-ZEDWSH32.js +68 -0
- package/dist/chunks/continuation-2CKSBLA6.js +11 -0
- package/dist/chunks/continuation-HZIZRZBX.js +13 -0
- package/dist/chunks/continuation-NLECEJPX.js +11 -0
- package/dist/chunks/ebuilder-form-V5FG2EHC.js +2276 -0
- package/dist/chunks/ehr-HMFY6VIL.js +5241 -0
- package/dist/chunks/employee-SAK2QYXX.js +11 -0
- package/dist/chunks/esb-ZYSVB7SG.js +141 -0
- package/dist/chunks/fna-B7RKPAZD.js +1444 -0
- package/dist/chunks/host-45WED2KK.js +21 -0
- package/dist/chunks/host-I4Z6BFYX.js +23 -0
- package/dist/chunks/host-KNZ52LJZ.js +17 -0
- package/dist/chunks/host-OCH2BCCV.js +19 -0
- package/dist/chunks/hrm-2KAZGUHI.js +244 -0
- package/dist/chunks/im-ACJJWH4U.js +252 -0
- package/dist/chunks/invoice-ZK3WCX2U.js +5179 -0
- package/dist/chunks/jiuchuanhui-5PQD3IL2.js +1940 -0
- package/dist/chunks/lazy-dispatch-JQXBW3GM.js +28 -0
- package/dist/chunks/mail-S2HDDXO2.js +2695 -0
- package/dist/chunks/meeting-QVN3I37L.js +504 -0
- package/dist/chunks/msg-parse-4GSQ2WTO.js +41 -0
- package/dist/chunks/okr-QNG4VC2Q.js +2482 -0
- package/dist/chunks/plan-A25EMW6U.js +2025 -0
- package/dist/chunks/project-G6XV66DZ.js +1361 -0
- package/dist/chunks/registry-2VLUAESA.js +14 -0
- package/dist/chunks/registry-7C5UMIPL.js +19 -0
- package/dist/chunks/registry-DC6KR3NH.js +18 -0
- package/dist/chunks/registry-NYPYMZXG.js +16 -0
- package/dist/chunks/registry-TI3CIUXF.js +19 -0
- package/dist/chunks/room-recommend-WRTHO6Y2.js +20 -0
- package/dist/chunks/schedule-KFIITGSK.js +24 -0
- package/dist/chunks/state-Y2XBP6YE.js +15 -0
- package/dist/chunks/workflow-DJ7SYWAF.js +245 -0
- package/dist/cmd/argv.js +45 -0
- package/dist/cmd/docs/index.js +3 -3
- package/dist/cmd/lazy-dispatch.js +20 -0
- package/dist/cmd/root.js +2 -4
- package/dist/cmd/setup/index.js +2 -2
- package/dist/cmd/skills/index.js +2 -2
- package/dist/core/package-paths.js +61 -0
- package/dist/index.js +163 -7
- package/dist/internal/e10/auth/xiaoe.js +3 -3
- package/dist/internal/e10/request-runtime.js +18 -62
- package/dist/internal/skills/detector.js +2 -2
- package/dist/shortcuts/contract/data/performance-catalog.js +1306 -0
- package/dist/shortcuts/contract/host.js +91 -35
- package/dist/shortcuts/contract/index.js +213 -0
- package/dist/shortcuts/contract/manifest.js +928 -0
- package/dist/shortcuts/contract/ooxml/docx.js +295 -0
- package/dist/shortcuts/contract/ooxml/xlsx.js +221 -0
- package/dist/shortcuts/contract/ooxml/zip.js +158 -0
- package/dist/shortcuts/contract/operations/assistant.js +1156 -0
- package/dist/shortcuts/contract/operations/clause-library.js +522 -0
- package/dist/shortcuts/contract/operations/compare.js +193 -0
- package/dist/shortcuts/contract/operations/credit-page.js +34 -0
- package/dist/shortcuts/contract/operations/flow.js +98 -0
- package/dist/shortcuts/contract/operations/page.js +66 -0
- package/dist/shortcuts/contract/operations/performance.js +733 -0
- package/dist/shortcuts/contract/operations/quote.js +557 -0
- package/dist/shortcuts/contract/operations/recommend.js +78 -0
- package/dist/shortcuts/contract/operations/registry.js +18 -0
- package/dist/shortcuts/contract/operations/review.js +83 -0
- package/dist/shortcuts/contract/operations/shared.js +37 -0
- package/dist/shortcuts/contract/operations/upload.js +108 -0
- package/dist/shortcuts/contract/operations/write.js +3 -2
- package/dist/shortcuts/index.js +140 -40
- package/dist/shortcuts/invoice/manifest.js +34 -11
- package/dist/shortcuts/invoice/operations/reim-auto.js +9 -0
- package/dist/shortcuts/invoice/operations/reim.js +81 -5
- package/dist/shortcuts/invoice/operations/shared.js +12 -5
- package/dist/shortcuts/meeting/host.js +45 -3
- package/dist/shortcuts/meeting/invitation/docx.js +442 -0
- package/dist/shortcuts/meeting/operations/attachment-content.js +418 -0
- package/dist/shortcuts/meeting/operations/attachment.js +442 -0
- package/dist/shortcuts/meeting/operations/eb/cache.js +57 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +343 -28
- package/dist/shortcuts/meeting/operations/eb/conflict.js +372 -11
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +710 -0
- package/dist/shortcuts/meeting/operations/eb/decision.js +47 -1
- package/dist/shortcuts/meeting/operations/eb/factory.js +129 -11
- package/dist/shortcuts/meeting/operations/eb/index.js +122 -2
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +378 -0
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +84 -0
- package/dist/shortcuts/meeting/operations/eb/schedule.js +450 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +576 -0
- package/dist/shortcuts/meeting/operations/invitation.js +458 -0
- package/dist/shortcuts/meeting/operations/minute-content.js +266 -0
- package/dist/shortcuts/meeting/operations/pipeline.js +489 -0
- package/dist/shortcuts/meeting/operations/qrcode.js +131 -0
- package/dist/shortcuts/meeting/operations/receipts.js +1 -1
- package/dist/shortcuts/meeting/operations/registry.js +18 -0
- package/dist/shortcuts/meeting/operations/summary.js +276 -0
- package/dist/shortcuts/meeting/operations/task-notify.js +325 -0
- package/dist/shortcuts/meeting/operations.js +42 -1
- package/dist/shortcuts/meeting/qr/encoder.js +427 -0
- package/dist/shortcuts/meeting/qr/render.js +103 -0
- package/dist/shortcuts/workflow/operations/form.js +17 -5
- package/docs/contract.md +39 -4
- package/docs/invoice.md +5 -5
- package/package.json +3 -2
- package/scripts/bundle.mjs +63 -0
- package/skill-template/business-info.json +25 -4
- package/skill-template/domains/jinchengda.md +16 -3
- package/skill-template/domains/yepiaotong.md +1 -1
- package/skills/weaver-e10-jinchengda/SKILL.md +111 -31
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +150 -0
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +87 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +111 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +0 -13
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +50 -0
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +4 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +74 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +84 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +29 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +28 -0
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +2 -21
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +0 -24
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +0 -17
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +70 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +0 -15
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +1168 -152
- package/skills/weaver-e10-meeting/SKILL.md +493 -17
- package/skills/weaver-e10-meeting/references/meeting-change.md +4 -4
- package/skills/weaver-e10-meeting/references/meeting-create.md +6 -6
- package/skills/weaver-e10-meeting/references/meeting-eb.md +503 -27
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +113 -0
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +6 -6
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +425 -0
- package/skills/weaver-e10-meeting/references/meeting-queries.md +4 -4
- package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +15 -15
- package/skills/weaver-e10-meeting/references/meeting-verification.md +19 -11
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +9 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +6 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +14 -11
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +97 -56
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +84 -60
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +142 -105
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +53 -194
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -7
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +164 -72
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +6 -0
- package/templates/meeting/invitation.docx +0 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
isEsbFlowUnavailable
|
|
5
|
+
} from "./chunk-YRVDW4WN.js";
|
|
6
|
+
import {
|
|
7
|
+
esbValidationError
|
|
8
|
+
} from "./chunk-GPMFD4RD.js";
|
|
9
|
+
|
|
10
|
+
// src/shortcuts/esb/manifest.ts
|
|
11
|
+
var flowId = { type: "string", pattern: "^\\d+$", minLength: 1, maxLength: 32 };
|
|
12
|
+
var customParams = {
|
|
13
|
+
type: "object",
|
|
14
|
+
minProperties: 1,
|
|
15
|
+
properties: {
|
|
16
|
+
mainTable: { type: "object" }
|
|
17
|
+
},
|
|
18
|
+
required: ["mainTable"],
|
|
19
|
+
description: "\u52A8\u4F5C\u6D41\u81EA\u5B9A\u4E49\u8F93\u5165\u53C2\u6570\uFF0C\u987B\u5305\u542B mainTable\uFF1B\u4E3B\u8868\u4E0E\u660E\u7EC6\u8868\u5B57\u6BB5\u4EE5 esb.input-format \u8FD4\u56DE\u7684\u6A21\u677F\u4E3A\u51C6"
|
|
20
|
+
};
|
|
21
|
+
var triggerProperties = {
|
|
22
|
+
esbFlowId: { ...flowId, description: "\u666E\u901A\u89E6\u53D1\uFF1A\u52A8\u4F5C\u6D41 ID\uFF08esbFlowId\uFF09" },
|
|
23
|
+
uniqueIndent: {
|
|
24
|
+
type: "string",
|
|
25
|
+
minLength: 1,
|
|
26
|
+
maxLength: 128,
|
|
27
|
+
description: "\u552F\u4E00\u503C\u89E6\u53D1\uFF1A\u52A8\u4F5C\u6D41\u552F\u4E00\u503C\uFF0C\u53D6\u503C\u4E3A esb_application.primary_key\uFF08\u9700\u5728 esb_setting \u5E93\u67E5\u5F97\u540E\u4F20\u5165\uFF09"
|
|
28
|
+
},
|
|
29
|
+
employeeId: { type: "string", minLength: 1, maxLength: 64, description: "\u89E6\u53D1\u4EBA\u5458 ID\uFF08\u5FC5\u586B\uFF09" },
|
|
30
|
+
customParams,
|
|
31
|
+
moduleSource: { type: "string", minLength: 1, maxLength: 64, description: "\u89E6\u53D1\u6765\u6E90\u6807\u8BC6\uFF0C\u9ED8\u8BA4\u4E0D\u8981\u4F20\uFF1B\u4EC5\u4E8C\u5F00\u573A\u666F\u4F20 ecode" }
|
|
32
|
+
};
|
|
33
|
+
var esbOperations = [
|
|
34
|
+
{
|
|
35
|
+
name: "esb.input-format",
|
|
36
|
+
summary: "\u6309 applicationId \u83B7\u53D6\u81EA\u5B9A\u4E49\u89E6\u53D1\u52A8\u4F5C\u6D41\u7684\u5165\u53C2\u6A21\u677F\uFF08\u53EA\u8BFB\uFF0C\u65E0\u526F\u4F5C\u7528\uFF09",
|
|
37
|
+
risk: "read",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: "object",
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
properties: {
|
|
42
|
+
applicationId: { ...flowId, description: "\u52A8\u4F5C\u6D41 ID\uFF08\u4E0E\u89E6\u53D1\u63A5\u53E3\u7684 esbFlowId \u6307\u5411\u540C\u4E00\u52A8\u4F5C\u6D41\uFF09" }
|
|
43
|
+
},
|
|
44
|
+
required: ["applicationId"]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "esb.trigger.prepare",
|
|
49
|
+
summary: "\u89E6\u53D1\u524D\u7684\u53EA\u8BFB\u56DE\u67E5\u4E0E\u8BF7\u6C42\u4F53\u7EC4\u88C5\uFF0C\u7B7E\u53D1 apply \u6240\u9700\u7684 continuation\uFF08\u4E0D\u4EA7\u751F\u4E1A\u52A1\u526F\u4F5C\u7528\uFF09",
|
|
50
|
+
risk: "read-before-write",
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: "object",
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
properties: triggerProperties,
|
|
55
|
+
required: ["employeeId", "customParams"],
|
|
56
|
+
oneOf: [{ required: ["esbFlowId"] }, { required: ["uniqueIndent"] }]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "esb.trigger.apply",
|
|
61
|
+
summary: "\u6309 continuation \u6267\u884C\u52A8\u4F5C\u6D41\u89E6\u53D1\uFF08\u9AD8\u98CE\u9669\u5199\u64CD\u4F5C\uFF0C\u53EF\u80FD\u4EA7\u751F\u4E1A\u52A1\u526F\u4F5C\u7528\uFF09",
|
|
62
|
+
risk: "high-risk-write",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: "object",
|
|
65
|
+
additionalProperties: false,
|
|
66
|
+
properties: {
|
|
67
|
+
continuation: { type: "string", minLength: 1, description: "esb.trigger.prepare \u8FD4\u56DE\u7684 continuation\uFF0C\u6709\u6548\u671F 10 \u5206\u949F" },
|
|
68
|
+
confirm: { const: true, description: "\u5FC5\u987B\u663E\u5F0F\u4E3A true\uFF0C\u8868\u793A\u7528\u6237\u5DF2\u786E\u8BA4\u6267\u884C\u8BE5\u52A8\u4F5C\u6D41" }
|
|
69
|
+
},
|
|
70
|
+
required: ["continuation", "confirm"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
];
|
|
74
|
+
var esbManifest = {
|
|
75
|
+
schemaVersion: 1,
|
|
76
|
+
name: "esb",
|
|
77
|
+
title: "\u6CDB\u5FAEE10 ESB\u52A8\u4F5C\u6D41\u6267\u884C",
|
|
78
|
+
version: "0.1.0",
|
|
79
|
+
host: "e10-esb",
|
|
80
|
+
status: "builtin",
|
|
81
|
+
sourceSkill: "weaver-e10-customesb-execute",
|
|
82
|
+
operations: esbOperations,
|
|
83
|
+
withheldOperations: [
|
|
84
|
+
{
|
|
85
|
+
name: "esb.actionflow.resolve",
|
|
86
|
+
reason: "\u6309\u52A8\u4F5C\u6D41\u540D\u79F0\u89E3\u6790 esbFlowId \u9700\u8981 ESB \u4E2D\u5FC3\u52A8\u4F5C\u6D41\u5217\u8868\u67E5\u8BE2\u63A5\u53E3\uFF0C\u6E90\u8D44\u6599\u672A\u7ED9\u51FA\u8BE5\u63A5\u53E3\u7684\u8DEF\u5F84\u3001\u8BF7\u6C42\u5B57\u6BB5\u4E0E\u8FD4\u56DE\u7ED3\u6784\uFF0C\u65E0\u6CD5\u5B89\u5168\u5B9E\u73B0\uFF1B\u8BF7\u7528\u6237\u76F4\u63A5\u63D0\u4F9B\u52A8\u4F5C\u6D41 ID\u3002"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "esb.unique-indent.resolve",
|
|
90
|
+
reason: "\u552F\u4E00\u503C\u89E6\u53D1\u6240\u9700\u7684 primary_key \u9700\u76F4\u63A5\u67E5\u8BE2 esb_setting \u5E93\uFF08SELECT primary_key FROM esb_application WHERE id = ?\uFF09\uFF0CCLI \u6CA1\u6709\u6570\u636E\u5E93\u901A\u9053\uFF0C\u53EA\u80FD\u7531\u8C03\u7528\u65B9\u67E5\u5F97\u540E\u901A\u8FC7 uniqueIndent \u4F20\u5165\u3002"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/shortcuts/esb/operations/types.ts
|
|
96
|
+
function esbSuccess(action, data, meta, warnings = []) {
|
|
97
|
+
const payload = { ok: true, action, data };
|
|
98
|
+
if (meta && Object.keys(meta).length > 0) payload.meta = meta;
|
|
99
|
+
if (warnings.length > 0) payload.warnings = warnings;
|
|
100
|
+
return payload;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/shortcuts/esb/operations/shared.ts
|
|
104
|
+
var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
105
|
+
function asObject(value, field = "input") {
|
|
106
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
107
|
+
throw esbValidationError("input_not_object", `${field} \u5FC5\u987B\u662F JSON \u5BF9\u8C61`);
|
|
108
|
+
}
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
function assertNoForbiddenKeys(input) {
|
|
112
|
+
for (const key of Object.keys(input)) {
|
|
113
|
+
if (FORBIDDEN_KEYS.has(key)) {
|
|
114
|
+
throw esbValidationError("forbidden_key", `\u8F93\u5165\u5305\u542B\u975E\u6CD5\u5B57\u6BB5\uFF1A${key}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function assertKnownKeys(input, allowed, operation) {
|
|
119
|
+
const unknown = Object.keys(input).filter((key) => !allowed.includes(key));
|
|
120
|
+
if (unknown.length > 0) {
|
|
121
|
+
throw esbValidationError("unknown_field", `${operation} \u4E0D\u652F\u6301\u5B57\u6BB5\uFF1A${unknown.join("\u3001")}`, { unknown });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function isFilled(value) {
|
|
125
|
+
return value !== void 0 && value !== null && value !== "";
|
|
126
|
+
}
|
|
127
|
+
function requiredString(value, field) {
|
|
128
|
+
if (!isFilled(value)) {
|
|
129
|
+
throw esbValidationError("field_required", `${field} \u5FC5\u586B`);
|
|
130
|
+
}
|
|
131
|
+
if (typeof value === "object") {
|
|
132
|
+
throw esbValidationError("field_invalid", `${field} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
|
|
133
|
+
}
|
|
134
|
+
return String(value);
|
|
135
|
+
}
|
|
136
|
+
function flowIdString(value, field) {
|
|
137
|
+
const text = requiredString(value, field);
|
|
138
|
+
if (!/^\d+$/.test(text)) {
|
|
139
|
+
throw esbValidationError("field_invalid", `${field} \u5FC5\u987B\u662F\u6570\u5B57 ID\uFF08\u957F\u6574\u578B\u6309\u5B57\u7B26\u4E32\u4F20\u9012\uFF09`);
|
|
140
|
+
}
|
|
141
|
+
return text;
|
|
142
|
+
}
|
|
143
|
+
function normalizeTriggerInput(input) {
|
|
144
|
+
const hasFlowId = isFilled(input.esbFlowId);
|
|
145
|
+
const hasUniqueIndent = isFilled(input.uniqueIndent);
|
|
146
|
+
if (!hasFlowId && !hasUniqueIndent) {
|
|
147
|
+
throw esbValidationError(
|
|
148
|
+
"trigger_target_missing",
|
|
149
|
+
"esbFlowId \u4E0E uniqueIndent \u4E8C\u9009\u4E00\u5FC5\u586B\uFF1A\u666E\u901A\u89E6\u53D1\u4F20 esbFlowId\uFF0C\u552F\u4E00\u503C\u89E6\u53D1\u4F20 uniqueIndent"
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
if (hasFlowId && hasUniqueIndent) {
|
|
153
|
+
throw esbValidationError("trigger_target_conflict", "esbFlowId \u4E0E uniqueIndent \u4E0D\u80FD\u540C\u65F6\u4F20\u5165\uFF0C\u8BF7\u4E8C\u9009\u4E00");
|
|
154
|
+
}
|
|
155
|
+
const employeeId = requiredString(input.employeeId, "employeeId");
|
|
156
|
+
const customParams2 = asObject(input.customParams, "customParams");
|
|
157
|
+
const mainTable = customParams2.mainTable;
|
|
158
|
+
if (!mainTable || typeof mainTable !== "object" || Array.isArray(mainTable)) {
|
|
159
|
+
throw esbValidationError("custom_params_invalid", "customParams.mainTable \u5FC5\u987B\u662F JSON \u5BF9\u8C61");
|
|
160
|
+
}
|
|
161
|
+
const moduleSource = isFilled(input.moduleSource) ? requiredString(input.moduleSource, "moduleSource") : void 0;
|
|
162
|
+
return {
|
|
163
|
+
mode: hasFlowId ? "esbFlowId" : "uniqueIndent",
|
|
164
|
+
...hasFlowId ? { esbFlowId: flowIdString(input.esbFlowId, "esbFlowId") } : {},
|
|
165
|
+
...hasUniqueIndent ? { uniqueIndent: requiredString(input.uniqueIndent, "uniqueIndent") } : {},
|
|
166
|
+
employeeId,
|
|
167
|
+
customParams: customParams2,
|
|
168
|
+
...moduleSource === void 0 ? {} : { moduleSource }
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function buildTriggerPayload(target) {
|
|
172
|
+
return {
|
|
173
|
+
customParams: target.customParams,
|
|
174
|
+
...target.moduleSource === void 0 ? {} : { moduleSource: target.moduleSource },
|
|
175
|
+
...target.esbFlowId === void 0 ? {} : { esbFlowId: target.esbFlowId },
|
|
176
|
+
...target.uniqueIndent === void 0 ? {} : { uniqueIndent: target.uniqueIndent },
|
|
177
|
+
employeeId: target.employeeId
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
var MAX_PLACEHOLDERS = 100;
|
|
181
|
+
function collectPlaceholders(value, prefix = "", collected = []) {
|
|
182
|
+
if (collected.length >= MAX_PLACEHOLDERS) return collected;
|
|
183
|
+
if (Array.isArray(value)) {
|
|
184
|
+
value.forEach((item, index) => collectPlaceholders(item, `${prefix}[${index}]`, collected));
|
|
185
|
+
return collected;
|
|
186
|
+
}
|
|
187
|
+
if (value && typeof value === "object") {
|
|
188
|
+
for (const [key, item] of Object.entries(value)) {
|
|
189
|
+
collectPlaceholders(item, prefix ? `${prefix}.${key}` : key, collected);
|
|
190
|
+
if (collected.length >= MAX_PLACEHOLDERS) break;
|
|
191
|
+
}
|
|
192
|
+
return collected;
|
|
193
|
+
}
|
|
194
|
+
if (typeof value === "string" && value.trim() === "#\u53EF\u9009") collected.push(prefix);
|
|
195
|
+
return collected;
|
|
196
|
+
}
|
|
197
|
+
var PAGE_ACTIONS = {
|
|
198
|
+
0: "\u65E0\u9700\u9875\u9762\u64CD\u4F5C",
|
|
199
|
+
1: "\u5237\u65B0\u9875\u9762",
|
|
200
|
+
2: "\u5173\u95ED\u9875\u9762",
|
|
201
|
+
3: "\u8DF3\u8F6C\u9875\u9762"
|
|
202
|
+
};
|
|
203
|
+
var REMINDERS = {
|
|
204
|
+
0: "\u65E0\u63D0\u9192",
|
|
205
|
+
1: "\u63D0\u9192",
|
|
206
|
+
2: "\u786E\u8BA4",
|
|
207
|
+
3: "\u8B66\u544A",
|
|
208
|
+
4: "\u9519\u8BEF"
|
|
209
|
+
};
|
|
210
|
+
function asRecord(value) {
|
|
211
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
212
|
+
}
|
|
213
|
+
function summarizeTriggerResult(value) {
|
|
214
|
+
const record = asRecord(value);
|
|
215
|
+
const actionData = asRecord(record.actionData);
|
|
216
|
+
const pageAction = Number(actionData.pageAction ?? 0);
|
|
217
|
+
const reminder = Number(actionData.reminder ?? 0);
|
|
218
|
+
const hasData = Number(actionData.hasData ?? 0);
|
|
219
|
+
const followUp = [];
|
|
220
|
+
if (pageAction !== 0) followUp.push(PAGE_ACTIONS[pageAction] || `\u9875\u9762\u52A8\u4F5C ${pageAction}`);
|
|
221
|
+
if (reminder !== 0) {
|
|
222
|
+
const reminderMsg = typeof actionData.reminderMsg === "string" && actionData.reminderMsg.trim() ? actionData.reminderMsg.trim() : void 0;
|
|
223
|
+
followUp.push(`${REMINDERS[reminder] || `\u63D0\u9192 ${reminder}`}${reminderMsg ? `\uFF1A${reminderMsg}` : ""}`);
|
|
224
|
+
}
|
|
225
|
+
if (hasData === 1) followUp.push("\u52A8\u4F5C\u6D41\u8FD4\u56DE\u4E86\u4E1A\u52A1\u6570\u636E\uFF0C\u89C1 actionData.responseData");
|
|
226
|
+
if (followUp.length === 0) followUp.push("\u52A8\u4F5C\u6D41\u5DF2\u6267\u884C\u5B8C\u6210\uFF0C\u65E0\u9700\u989D\u5916\u9875\u9762\u52A8\u4F5C");
|
|
227
|
+
return {
|
|
228
|
+
resultCode: 200,
|
|
229
|
+
resultMsg: typeof record.resultMsg === "string" ? record.resultMsg : "",
|
|
230
|
+
...record.resultData === void 0 ? {} : { resultData: record.resultData },
|
|
231
|
+
...record.nextAction === void 0 ? {} : { nextAction: record.nextAction },
|
|
232
|
+
actionData,
|
|
233
|
+
followUp
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// src/shortcuts/esb/operations/input-format.ts
|
|
238
|
+
function normalizeTemplate(raw, applicationId) {
|
|
239
|
+
const record = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
240
|
+
const customParams2 = record.customParams ?? null;
|
|
241
|
+
const esbFlowId = record.esbFlowId === void 0 || record.esbFlowId === null ? applicationId : String(record.esbFlowId);
|
|
242
|
+
const moduleSource = typeof record.moduleSource === "string" && record.moduleSource.trim() ? record.moduleSource.trim() : "AISKILL";
|
|
243
|
+
const optionalFields = collectPlaceholders(customParams2);
|
|
244
|
+
const warnings = [];
|
|
245
|
+
if (customParams2 === null) {
|
|
246
|
+
warnings.push("\u63A5\u53E3\u672A\u8FD4\u56DE customParams\uFF1A\u8BF7\u786E\u8BA4\u8BE5\u52A8\u4F5C\u6D41\u662F\u5426\u914D\u7F6E\u4E86\u81EA\u5B9A\u4E49\u5165\u53C2\u6A21\u677F\uFF0C\u672A\u914D\u7F6E\u65F6\u6309\u76EE\u6807\u52A8\u4F5C\u6D41\u8981\u6C42\u76F4\u63A5\u7EC4\u88C5 mainTable");
|
|
247
|
+
}
|
|
248
|
+
if (optionalFields.length > 0) {
|
|
249
|
+
warnings.push(`\u6A21\u677F\u542B ${optionalFields.length} \u4E2A #\u53EF\u9009 \u5360\u4F4D\u5B57\u6BB5\uFF0C\u89E6\u53D1\u65F6\u66FF\u6362\u4E3A\u771F\u5B9E\u4E1A\u52A1\u503C\u6216\u5220\u9664\u4E0D\u9700\u8981\u7684\u5B57\u6BB5`);
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
template: { applicationId, esbFlowId, moduleSource, customParams: customParams2, optionalFields },
|
|
253
|
+
warnings
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
var esbInputFormatHandlers = {
|
|
257
|
+
"esb.input-format": async (input, { host }) => {
|
|
258
|
+
const applicationId = flowIdString(input.applicationId, "applicationId");
|
|
259
|
+
const { template, warnings } = normalizeTemplate(await host.inputFormat(applicationId), applicationId);
|
|
260
|
+
return esbSuccess("esb.input-format", template, { status: "COMPLETE" }, warnings);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// src/shortcuts/esb/operations/trigger.ts
|
|
265
|
+
function describeLookupFailure(error) {
|
|
266
|
+
if (error && typeof error === "object") {
|
|
267
|
+
const structured = error;
|
|
268
|
+
const subtype = typeof structured.subtype === "string" ? structured.subtype : "unknown";
|
|
269
|
+
return `subtype=${subtype}`;
|
|
270
|
+
}
|
|
271
|
+
return "cause=unknown";
|
|
272
|
+
}
|
|
273
|
+
var esbTriggerHandlers = {
|
|
274
|
+
"esb.trigger.prepare": async (input, { host, continuation }) => {
|
|
275
|
+
const target = normalizeTriggerInput(input);
|
|
276
|
+
const warnings = [];
|
|
277
|
+
let templateFields = null;
|
|
278
|
+
if (target.mode === "esbFlowId") {
|
|
279
|
+
const esbFlowId = target.esbFlowId;
|
|
280
|
+
try {
|
|
281
|
+
const raw = await host.inputFormat(esbFlowId);
|
|
282
|
+
const record = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
283
|
+
templateFields = collectPlaceholders(record.customParams ?? null);
|
|
284
|
+
} catch (error) {
|
|
285
|
+
if (isEsbFlowUnavailable(error)) throw error;
|
|
286
|
+
warnings.push(`\u76EE\u6807\u52A8\u4F5C\u6D41\u5165\u53C2\u6A21\u677F\u56DE\u67E5\u672A\u6210\u529F\uFF08${describeLookupFailure(error)}\uFF09\uFF0C\u5DF2\u8DF3\u8FC7\u56DE\u67E5\uFF1B\u89E6\u53D1\u662F\u5426\u53EF\u7528\u4EE5 apply \u8FD4\u56DE\u4E3A\u51C6`);
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
warnings.push("\u552F\u4E00\u503C\u89E6\u53D1\u65E0\u6CD5\u6309 applicationId \u56DE\u67E5\uFF1A\u540C\u4E00\u79DF\u6237\u4E0B\u5B58\u5728\u76F8\u540C\u552F\u4E00\u503C\u7684\u591A\u6761\u52A8\u4F5C\u6D41\u65F6\uFF0C\u7CFB\u7EDF\u53EA\u6267\u884C create_time \u6700\u65B0\u7684\u4E00\u6761");
|
|
290
|
+
}
|
|
291
|
+
const payload = buildTriggerPayload(target);
|
|
292
|
+
const session = await host.getSession();
|
|
293
|
+
const token = await continuation.issue({
|
|
294
|
+
operation: "esb.trigger.apply",
|
|
295
|
+
target: { mode: target.mode, value: target.esbFlowId ?? target.uniqueIndent },
|
|
296
|
+
actor: { userId: session.userId, tenantKey: session.tenantKey, profile: session.profile },
|
|
297
|
+
payload
|
|
298
|
+
});
|
|
299
|
+
return esbSuccess(
|
|
300
|
+
"esb.trigger.prepare",
|
|
301
|
+
{
|
|
302
|
+
target: {
|
|
303
|
+
mode: target.mode,
|
|
304
|
+
esbFlowId: target.esbFlowId ?? null,
|
|
305
|
+
uniqueIndent: target.uniqueIndent ?? null,
|
|
306
|
+
employeeId: target.employeeId
|
|
307
|
+
},
|
|
308
|
+
requestPreview: payload,
|
|
309
|
+
templateFields,
|
|
310
|
+
continuation: token,
|
|
311
|
+
expiresInSeconds: 600
|
|
312
|
+
},
|
|
313
|
+
{ status: "PREPARED" },
|
|
314
|
+
warnings
|
|
315
|
+
);
|
|
316
|
+
},
|
|
317
|
+
"esb.trigger.apply": async (input, { host, continuation }) => {
|
|
318
|
+
if (input.confirm !== true) {
|
|
319
|
+
throw esbValidationError("confirm_required", "\u89E6\u53D1\u52A8\u4F5C\u6D41\u662F\u9AD8\u98CE\u9669\u5199\u64CD\u4F5C\uFF1A\u5FC5\u987B\u663E\u5F0F\u4F20 confirm: true \u8868\u793A\u7528\u6237\u5DF2\u786E\u8BA4\u6267\u884C");
|
|
320
|
+
}
|
|
321
|
+
const record = await continuation.verify(requiredString(input.continuation, "continuation"), "esb.trigger.apply");
|
|
322
|
+
const session = await host.getSession();
|
|
323
|
+
const actor = record.actor && typeof record.actor === "object" ? record.actor : {};
|
|
324
|
+
if (actor.userId !== session.userId || actor.tenantKey !== session.tenantKey) {
|
|
325
|
+
throw esbValidationError(
|
|
326
|
+
"continuation_actor_changed",
|
|
327
|
+
"continuation \u7B7E\u53D1\u65F6\u7684\u767B\u5F55\u8EAB\u4EFD\u4E0E\u5F53\u524D\u4F1A\u8BDD\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C esb.trigger.prepare \u540E\u518D\u786E\u8BA4"
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
const payload = asObject(record.payload, "continuation.payload");
|
|
331
|
+
const mainTable = payload.customParams?.mainTable;
|
|
332
|
+
if (!mainTable || typeof mainTable !== "object" || Array.isArray(mainTable)) {
|
|
333
|
+
throw esbValidationError("continuation_payload_invalid", "continuation \u4E2D\u7684 customParams.mainTable \u7F3A\u5931\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C esb.trigger.prepare");
|
|
334
|
+
}
|
|
335
|
+
const result = await host.trigger(payload);
|
|
336
|
+
return esbSuccess("esb.trigger.apply", summarizeTriggerResult(result), { status: "COMPLETE" });
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// src/shortcuts/esb/operations/registry.ts
|
|
341
|
+
function mergeHandlers(maps) {
|
|
342
|
+
const merged = {};
|
|
343
|
+
for (const map of maps) {
|
|
344
|
+
for (const [name, handler] of Object.entries(map)) {
|
|
345
|
+
if (merged[name]) throw new Error(`duplicate esb operation handler: ${name}`);
|
|
346
|
+
merged[name] = handler;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return merged;
|
|
350
|
+
}
|
|
351
|
+
var esbHandlers = mergeHandlers([esbInputFormatHandlers, esbTriggerHandlers]);
|
|
352
|
+
function buildRegistry() {
|
|
353
|
+
const registry = /* @__PURE__ */ new Map();
|
|
354
|
+
for (const contract of esbManifest.operations) {
|
|
355
|
+
const handler = esbHandlers[contract.name];
|
|
356
|
+
if (!handler) throw new Error(`esb operation ${contract.name} has no handler`);
|
|
357
|
+
registry.set(contract.name, { ...contract, handler });
|
|
358
|
+
}
|
|
359
|
+
for (const name of Object.keys(esbHandlers)) {
|
|
360
|
+
if (!registry.has(name)) throw new Error(`esb handler ${name} is not declared in manifest`);
|
|
361
|
+
}
|
|
362
|
+
return registry;
|
|
363
|
+
}
|
|
364
|
+
var esbOperationRegistry = buildRegistry();
|
|
365
|
+
function esbOperationDefinitions() {
|
|
366
|
+
return [...esbOperationRegistry.values()];
|
|
367
|
+
}
|
|
368
|
+
function getEsbOperation(operation) {
|
|
369
|
+
const definition = esbOperationRegistry.get(operation);
|
|
370
|
+
if (!definition) {
|
|
371
|
+
throw esbValidationError("operation_unknown", `ESB \u52A8\u4F5C\u6D41\u4E0D\u652F\u6301\u64CD\u4F5C\uFF1A${operation}`);
|
|
372
|
+
}
|
|
373
|
+
return definition;
|
|
374
|
+
}
|
|
375
|
+
function hasEsbOperation(operation) {
|
|
376
|
+
return esbOperationRegistry.has(operation);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export {
|
|
380
|
+
esbManifest,
|
|
381
|
+
asObject,
|
|
382
|
+
assertNoForbiddenKeys,
|
|
383
|
+
assertKnownKeys,
|
|
384
|
+
esbOperationDefinitions,
|
|
385
|
+
getEsbOperation,
|
|
386
|
+
hasEsbOperation
|
|
387
|
+
};
|