weaver-work-cli 0.1.28 → 0.1.31
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-U766FTFH.js +2537 -0
- package/dist/chunks/archive-oa-DMWEKX3L.js +1317 -0
- package/dist/chunks/asset-TCR7VDEV.js +2109 -0
- package/dist/chunks/attachment-content-AQNX5N3S.js +23 -0
- package/dist/chunks/blog-EVZWGDVM.js +2157 -0
- package/dist/chunks/caizhilian-JOWS6SL5.js +10087 -0
- package/dist/chunks/calendar-5WNCV66Q.js +1195 -0
- package/dist/chunks/chunk-2DUV44UX.js +15606 -0
- package/dist/chunks/chunk-324YPTC2.js +1607 -0
- package/dist/chunks/chunk-65QMVWHS.js +231 -0
- package/dist/chunks/chunk-6V7ZLF34.js +387 -0
- package/dist/chunks/chunk-AC7KJWC5.js +358 -0
- package/dist/chunks/chunk-AJ62BGAW.js +29 -0
- package/dist/chunks/chunk-BUSC6UAE.js +43 -0
- package/dist/chunks/chunk-CVZ2JOSW.js +62 -0
- package/dist/chunks/chunk-D4LTJSJD.js +477 -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-GCG2NMWR.js +703 -0
- package/dist/chunks/chunk-GPMFD4RD.js +75 -0
- package/dist/chunks/chunk-H3WDBYJW.js +508 -0
- package/dist/chunks/chunk-H6XSTSLM.js +2357 -0
- package/dist/chunks/chunk-J7RJTZSV.js +5556 -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-R2IJAK7T.js +464 -0
- package/dist/chunks/chunk-R7O5PUWO.js +205 -0
- package/dist/chunks/chunk-RCGYCOMG.js +6962 -0
- package/dist/chunks/chunk-VZTXRG6X.js +403 -0
- package/dist/chunks/chunk-WHD4XMRP.js +161 -0
- package/dist/chunks/chunk-YLCYX7LE.js +371 -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-NJ4YK6CC.js +2276 -0
- package/dist/chunks/ehr-MMYN36VA.js +5241 -0
- package/dist/chunks/employee-SAK2QYXX.js +11 -0
- package/dist/chunks/esb-HIWHOU7Q.js +141 -0
- package/dist/chunks/fna-KBACQTA5.js +1444 -0
- package/dist/chunks/host-3OHS5QUX.js +21 -0
- package/dist/chunks/host-IG6KEH5Q.js +19 -0
- package/dist/chunks/host-KQL5N4HO.js +23 -0
- package/dist/chunks/host-LLSZQCWR.js +17 -0
- package/dist/chunks/hrm-LYEC67ZQ.js +244 -0
- package/dist/chunks/im-RN2UKAEU.js +252 -0
- package/dist/chunks/invoice-EEPHLAF6.js +5179 -0
- package/dist/chunks/jiuchuanhui-WVVZYSJE.js +1940 -0
- package/dist/chunks/lazy-dispatch-MDOFFL2S.js +28 -0
- package/dist/chunks/mail-LNQLTF6L.js +2695 -0
- package/dist/chunks/meeting-XSD3BDVQ.js +504 -0
- package/dist/chunks/msg-parse-4GSQ2WTO.js +41 -0
- package/dist/chunks/okr-TMWTIU2K.js +2482 -0
- package/dist/chunks/plan-A2FSFA7T.js +2025 -0
- package/dist/chunks/project-T26QLBQF.js +1361 -0
- package/dist/chunks/registry-2VLUAESA.js +14 -0
- package/dist/chunks/registry-JCFEYXOE.js +18 -0
- package/dist/chunks/registry-NYPYMZXG.js +16 -0
- package/dist/chunks/registry-Q7OQJ3SU.js +19 -0
- package/dist/chunks/registry-ZJMJVWFA.js +19 -0
- package/dist/chunks/room-recommend-UR4ZDZS6.js +20 -0
- package/dist/chunks/schedule-5L2PM4M6.js +24 -0
- package/dist/chunks/state-Y2XBP6YE.js +15 -0
- package/dist/chunks/workflow-TR6PG2SL.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 +47 -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/host.js +2 -1
- package/dist/shortcuts/invoice/manifest.js +36 -12
- package/dist/shortcuts/invoice/operations/issuing-qys.js +132 -36
- 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/index.js +3 -0
- package/dist/shortcuts/workflow/operations/form.js +17 -5
- package/dist/shortcuts/workflow/operations/read.js +13 -6
- package/dist/shortcuts/workflow/operations/registry.js +2 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/businessRules.js +331 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/detailFieldRules.js +133 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/summaryCache.js +326 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailCache.js +113 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoDetailFetcher.js +259 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoListRows.js +64 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoOutputPlanner.js +28 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.aggregate.js +70 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +267 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +392 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.detail.js +165 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +448 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +348 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +222 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.pipeline.js +66 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +502 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +540 -0
- package/docs/_catalog.md +1 -0
- package/docs/contract.md +39 -4
- package/docs/invoice.md +7 -7
- package/docs/todo-smart-convert/README.md +171 -0
- package/docs/todo-smart-convert/data-contract.md +236 -0
- package/docs/todo-smart-convert/mock/ai-todo-query-target.json +209 -0
- package/docs/todo-smart-convert/subgroup-rules.md +245 -0
- package/package.json +3 -2
- package/scripts/bundle.mjs +63 -0
- package/scripts/package-skill.mjs +1 -1
- package/skill-template/business-info.json +25 -4
- package/skill-template/domains/jinchengda.md +16 -3
- package/skill-template/domains/yepiaotong.md +3 -3
- 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-workflow/SKILL.md +23 -1
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +282 -0
- package/skills/weaver-e10-workflow/scripts/todo-summary.cjs +695 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +15 -11
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +10 -7
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-form-fill-rules.md +41 -14
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +54 -26
- 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 +8 -2
- package/templates/meeting/invitation.docx +0 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/shortcuts/im/operations/msg-parse.ts
|
|
5
|
+
var MSG_TYPES = {
|
|
6
|
+
1: "\u6587\u672C",
|
|
7
|
+
2: "\u56FE\u7247",
|
|
8
|
+
3: "\u8BED\u97F3",
|
|
9
|
+
4: "\u6587\u4EF6",
|
|
10
|
+
5: "\u4F4D\u7F6E",
|
|
11
|
+
6: "\u56FE\u6587",
|
|
12
|
+
7: "\u89C6\u9891",
|
|
13
|
+
8: "\u4E8B\u9879",
|
|
14
|
+
9: "\u7CFB\u7EDF\u6D88\u606F",
|
|
15
|
+
10: "\u64A4\u56DE",
|
|
16
|
+
11: "\u6296\u4E00\u6296",
|
|
17
|
+
12: "\u5C4F\u853D",
|
|
18
|
+
14: "\u901A\u77E5",
|
|
19
|
+
15: "\u81EA\u5B9A\u4E49",
|
|
20
|
+
16: "\u8BED\u97F3\u901A\u8BDD",
|
|
21
|
+
17: "\u804A\u5929\u8BB0\u5F55",
|
|
22
|
+
18: "\u89C6\u9891\u901A\u8BDD",
|
|
23
|
+
19: "\u7FA4\u516C\u544A",
|
|
24
|
+
20: "\u5206\u4EAB\u5730\u5740",
|
|
25
|
+
21: "\u8868\u60C5",
|
|
26
|
+
22: "\u5F3A\u63D0\u9192",
|
|
27
|
+
23: "\u94FE\u63A5",
|
|
28
|
+
24: "\u7FA4\u63A5\u9F99",
|
|
29
|
+
25: "+1\u56DE\u590D",
|
|
30
|
+
26: "\u5BCC\u6587\u672C"
|
|
31
|
+
};
|
|
32
|
+
function getTypeName(type) {
|
|
33
|
+
const t = Number(type);
|
|
34
|
+
return MSG_TYPES[t] || "\u672A\u77E5";
|
|
35
|
+
}
|
|
36
|
+
function parseMsg(value) {
|
|
37
|
+
if (!value) return null;
|
|
38
|
+
if (typeof value === "string") {
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(value);
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (typeof value === "object") return value;
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function normalizeKey(key) {
|
|
49
|
+
if (key.startsWith("%") && key.endsWith("%")) return key;
|
|
50
|
+
return `%${key}%`;
|
|
51
|
+
}
|
|
52
|
+
function formatPersonToken(value, nameMap) {
|
|
53
|
+
const uidRaw = value?.u !== void 0 && value.u !== null ? String(value.u) : value?.uid !== void 0 && value.uid !== null ? String(value.uid) : "";
|
|
54
|
+
const cRaw = value?.c !== void 0 && value.c !== null ? String(value.c) : "";
|
|
55
|
+
if (uidRaw && nameMap?.[uidRaw]) return nameMap[uidRaw];
|
|
56
|
+
if (uidRaw) return uidRaw;
|
|
57
|
+
return cRaw;
|
|
58
|
+
}
|
|
59
|
+
function formatI18nVal(value, nameMap) {
|
|
60
|
+
if (Array.isArray(value)) {
|
|
61
|
+
return value.map((item) => formatI18nVal(item, nameMap)).filter(Boolean).join("\u3001");
|
|
62
|
+
}
|
|
63
|
+
if (value && typeof value === "object") {
|
|
64
|
+
if (value.u !== void 0 || value.uid !== void 0) return formatPersonToken(value, nameMap);
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
if (value === void 0 || value === null) return "";
|
|
68
|
+
return String(value);
|
|
69
|
+
}
|
|
70
|
+
function substituteTemplate(template, kvs, jvs, nameMap) {
|
|
71
|
+
const merged = { ...kvs || {}, ...jvs || {} };
|
|
72
|
+
let text = String(template || "");
|
|
73
|
+
for (const [rawKey, value] of Object.entries(merged)) {
|
|
74
|
+
const key = normalizeKey(rawKey);
|
|
75
|
+
const replacement = formatI18nVal(value, nameMap);
|
|
76
|
+
text = text.split(key).join(replacement);
|
|
77
|
+
}
|
|
78
|
+
return text;
|
|
79
|
+
}
|
|
80
|
+
function collectMentionMap(msg) {
|
|
81
|
+
const map = /* @__PURE__ */ new Map();
|
|
82
|
+
const walk = (value) => {
|
|
83
|
+
if (!value || typeof value !== "object") return;
|
|
84
|
+
if (Array.isArray(value)) {
|
|
85
|
+
for (const item of value) walk(item);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (Array.isArray(value.aus)) {
|
|
89
|
+
for (const item of value.aus) {
|
|
90
|
+
if (item && item.id !== void 0 && item.id !== null && item.nm) map.set(String(item.id), String(item.nm));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const key of Object.keys(value)) {
|
|
94
|
+
if (key === "aus") continue;
|
|
95
|
+
walk(value[key]);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
walk(msg);
|
|
99
|
+
return map;
|
|
100
|
+
}
|
|
101
|
+
function replaceMentions(text, mentionMap, nameMap) {
|
|
102
|
+
let output = String(text || "");
|
|
103
|
+
if (!output.includes(":@")) return output;
|
|
104
|
+
output = output.replace(/:@(\d{1,30});/g, (_, uidRaw) => {
|
|
105
|
+
const uid = uidRaw;
|
|
106
|
+
const name = mentionMap?.get(uid) || nameMap?.[uid] || uid;
|
|
107
|
+
return `@${name}`;
|
|
108
|
+
});
|
|
109
|
+
return output;
|
|
110
|
+
}
|
|
111
|
+
function extractTxt(seg, opts = {}) {
|
|
112
|
+
const txt = seg?.txt;
|
|
113
|
+
if (!txt) return "";
|
|
114
|
+
const mentionMap = opts.mentionMap ?? collectMentionMap(seg);
|
|
115
|
+
if (typeof txt === "string") return replaceMentions(txt, mentionMap, opts.nameMap);
|
|
116
|
+
if (typeof txt !== "object") return "";
|
|
117
|
+
if (txt.v !== void 0 && txt.v !== null && String(txt.v) !== "") {
|
|
118
|
+
return replaceMentions(String(txt.v), mentionMap, opts.nameMap);
|
|
119
|
+
}
|
|
120
|
+
const kvs = txt.kvs || {};
|
|
121
|
+
const jvs = txt.jvs || {};
|
|
122
|
+
if (txt.i18n && typeof txt.i18n === "string" && txt.i18n.includes("%")) {
|
|
123
|
+
return replaceMentions(substituteTemplate(txt.i18n, kvs, jvs, opts.nameMap), mentionMap, opts.nameMap);
|
|
124
|
+
}
|
|
125
|
+
if (txt.id18n !== void 0 && txt.id18n !== null) {
|
|
126
|
+
const translated = opts.i18nMap?.[String(txt.id18n)];
|
|
127
|
+
if (translated) {
|
|
128
|
+
return replaceMentions(substituteTemplate(translated, kvs, jvs, opts.nameMap), mentionMap, opts.nameMap);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (txt.i18n && typeof txt.i18n === "string") {
|
|
132
|
+
return replaceMentions(substituteTemplate(txt.i18n, kvs, jvs, opts.nameMap), mentionMap, opts.nameMap);
|
|
133
|
+
}
|
|
134
|
+
return "";
|
|
135
|
+
}
|
|
136
|
+
function parseSysMsg(msg) {
|
|
137
|
+
const sys = msg?.dt?.[0]?.sys;
|
|
138
|
+
if (!sys) return {};
|
|
139
|
+
return {
|
|
140
|
+
group: sys.group !== void 0 ? String(sys.group) : void 0,
|
|
141
|
+
type: sys.type !== void 0 ? String(sys.type) : void 0,
|
|
142
|
+
tpl: sys.tpl !== void 0 ? String(sys.tpl) : void 0,
|
|
143
|
+
etName: sys.et?.nm !== void 0 && sys.et.nm !== null ? String(sys.et.nm) : void 0,
|
|
144
|
+
id18n: sys.id18n !== void 0 ? String(sys.id18n) : void 0
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function parseContent(value, opts = {}) {
|
|
148
|
+
const msg = parseMsg(value) || {};
|
|
149
|
+
const type = Number(msg.type || 0);
|
|
150
|
+
const typeName = getTypeName(type);
|
|
151
|
+
const dt = Array.isArray(msg.dt) ? msg.dt : [];
|
|
152
|
+
const data = dt[0] || {};
|
|
153
|
+
const sys = parseSysMsg(msg);
|
|
154
|
+
const tf = Number(msg.tf || 0);
|
|
155
|
+
const must = (tf & 1) !== 0;
|
|
156
|
+
const localOpts = { ...opts, mentionMap: opts.mentionMap ?? collectMentionMap(msg) };
|
|
157
|
+
let content = "";
|
|
158
|
+
let fileName = "";
|
|
159
|
+
switch (type) {
|
|
160
|
+
case 1:
|
|
161
|
+
content = extractTxt(data, localOpts);
|
|
162
|
+
break;
|
|
163
|
+
case 2: {
|
|
164
|
+
content = parseSegment(data, localOpts) || "[\u56FE\u7247]";
|
|
165
|
+
fileName = data?.img?.nm ? String(data.img.nm) : "";
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
case 4:
|
|
169
|
+
fileName = data?.file?.nm ? String(data.file.nm) : "";
|
|
170
|
+
content = fileName ? `[\u6587\u4EF6]${fileName}` : "[\u6587\u4EF6]";
|
|
171
|
+
break;
|
|
172
|
+
case 7: {
|
|
173
|
+
content = parseSegment(data, localOpts) || "[\u89C6\u9891]";
|
|
174
|
+
fileName = data?.media?.nm ? String(data.media.nm) : data?.video?.nm ? String(data.video.nm) : "";
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case 5:
|
|
178
|
+
content = data?.location?.name ? String(data.location.name) : "";
|
|
179
|
+
break;
|
|
180
|
+
case 8:
|
|
181
|
+
content = data?.entity?.entityName ? String(data.entity.entityName) : "";
|
|
182
|
+
break;
|
|
183
|
+
case 20:
|
|
184
|
+
content = data?.shareaddr?.name ? String(data.shareaddr.name) : extractTxt(data, localOpts);
|
|
185
|
+
break;
|
|
186
|
+
case 26:
|
|
187
|
+
content = msg.vv ? String(msg.vv) : dt.map((d) => parseSegment(d, localOpts)).join("");
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
content = extractTxt(data, localOpts);
|
|
191
|
+
}
|
|
192
|
+
if (sys.tpl === "1" && sys.etName) content = sys.etName;
|
|
193
|
+
if (content && String(content).includes(":@")) {
|
|
194
|
+
content = replaceMentions(content, localOpts.mentionMap, localOpts.nameMap);
|
|
195
|
+
}
|
|
196
|
+
if (must) content = `[\u5FC5\u8FBE]${content}`;
|
|
197
|
+
let title = "";
|
|
198
|
+
if (sys.etName) title = sys.etName;
|
|
199
|
+
else if (sys.id18n && opts.i18nMap?.[sys.id18n]) title = opts.i18nMap[sys.id18n];
|
|
200
|
+
return { type, typeName, content, title, must, fileName, sys };
|
|
201
|
+
}
|
|
202
|
+
function parseSegment(seg, opts = {}) {
|
|
203
|
+
if (!seg) return "";
|
|
204
|
+
const name = (value) => value?.nm !== void 0 && value.nm !== null ? String(value.nm) : "";
|
|
205
|
+
const hasFileId = (value) => Boolean(value) && (value.src !== void 0 || value.id !== void 0 || value.nm !== void 0);
|
|
206
|
+
if (hasFileId(seg.img)) return `[\u56FE\u7247]${name(seg.img)}`;
|
|
207
|
+
if (hasFileId(seg.file)) return `[\u6587\u4EF6]${name(seg.file)}`;
|
|
208
|
+
if (hasFileId(seg.video)) return `[\u89C6\u9891]${name(seg.video)}`;
|
|
209
|
+
if (hasFileId(seg.media)) return `[\u89C6\u9891]${name(seg.media)}`;
|
|
210
|
+
if (hasFileId(seg.voice)) return `[\u8BED\u97F3]${name(seg.voice)}`;
|
|
211
|
+
if (seg.location?.name) return String(seg.location.name);
|
|
212
|
+
if (seg.txt) return extractTxt(seg, opts);
|
|
213
|
+
return "";
|
|
214
|
+
}
|
|
215
|
+
function senderName(msg, fromUid, authUid, nameMap = {}) {
|
|
216
|
+
const uid = String(fromUid ?? "");
|
|
217
|
+
if (authUid && uid === authUid) return "\u6211";
|
|
218
|
+
const sname = msg?.sname ? String(msg.sname) : "";
|
|
219
|
+
if (sname) return sname;
|
|
220
|
+
if (uid && nameMap[uid]) return nameMap[uid];
|
|
221
|
+
if (uid) return uid;
|
|
222
|
+
return "";
|
|
223
|
+
}
|
|
224
|
+
function extractImgs(msg) {
|
|
225
|
+
const dt = Array.isArray(msg?.dt) ? msg.dt : [];
|
|
226
|
+
const items = [];
|
|
227
|
+
for (const seg of dt) {
|
|
228
|
+
const img = seg?.img;
|
|
229
|
+
if (!img) continue;
|
|
230
|
+
const fileId = img.src !== void 0 && img.src !== null ? String(img.src) : img.id !== void 0 ? String(img.id) : "";
|
|
231
|
+
if (!fileId) continue;
|
|
232
|
+
items.push({
|
|
233
|
+
fileId,
|
|
234
|
+
name: img.nm !== void 0 ? String(img.nm) : "",
|
|
235
|
+
w: img.w !== void 0 ? String(img.w) : void 0,
|
|
236
|
+
h: img.h !== void 0 ? String(img.h) : void 0,
|
|
237
|
+
size: img.s !== void 0 ? String(img.s) : void 0,
|
|
238
|
+
mime: img.t !== void 0 ? String(img.t) : void 0
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
return items;
|
|
242
|
+
}
|
|
243
|
+
function extractVideos(msg) {
|
|
244
|
+
const dt = Array.isArray(msg?.dt) ? msg.dt : [];
|
|
245
|
+
const items = [];
|
|
246
|
+
for (const seg of dt) {
|
|
247
|
+
const media = seg?.media || seg?.video;
|
|
248
|
+
if (!media) continue;
|
|
249
|
+
const fileId = media.src !== void 0 && media.src !== null ? String(media.src) : media.id !== void 0 ? String(media.id) : "";
|
|
250
|
+
if (!fileId) continue;
|
|
251
|
+
items.push({
|
|
252
|
+
fileId,
|
|
253
|
+
name: media.nm !== void 0 ? String(media.nm) : "",
|
|
254
|
+
ext: media.ext !== void 0 ? String(media.ext) : void 0,
|
|
255
|
+
w: media.w !== void 0 ? String(media.w) : void 0,
|
|
256
|
+
h: media.h !== void 0 ? String(media.h) : void 0,
|
|
257
|
+
size: media.s !== void 0 ? String(media.s) : void 0,
|
|
258
|
+
mime: media.t !== void 0 ? String(media.t) : void 0
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
return items;
|
|
262
|
+
}
|
|
263
|
+
function extractFiles(msg) {
|
|
264
|
+
const dt = Array.isArray(msg?.dt) ? msg.dt : [];
|
|
265
|
+
const items = [];
|
|
266
|
+
for (const seg of dt) {
|
|
267
|
+
const file = seg?.file;
|
|
268
|
+
if (!file) continue;
|
|
269
|
+
const fileId = file.id !== void 0 && file.id !== null ? String(file.id) : file.src !== void 0 ? String(file.src) : "";
|
|
270
|
+
if (!fileId) continue;
|
|
271
|
+
items.push({
|
|
272
|
+
fileId,
|
|
273
|
+
name: file.nm !== void 0 ? String(file.nm) : "",
|
|
274
|
+
ext: file.ext !== void 0 ? String(file.ext) : void 0,
|
|
275
|
+
size: file.s !== void 0 ? String(file.s) : void 0,
|
|
276
|
+
mime: file.t !== void 0 ? String(file.t) : void 0
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return items;
|
|
280
|
+
}
|
|
281
|
+
function walkCollect(value, kind, out) {
|
|
282
|
+
if (value === void 0 || value === null) return;
|
|
283
|
+
if (Array.isArray(value)) {
|
|
284
|
+
for (const item of value) walkCollect(item, kind, out);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (typeof value === "object") {
|
|
288
|
+
for (const key of Object.keys(value)) {
|
|
289
|
+
const child = value[key];
|
|
290
|
+
if (kind === "id18n" && key === "id18n" && child !== void 0 && child !== null && /^\d+$/.test(String(child))) {
|
|
291
|
+
out.add(String(child));
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (kind === "person") {
|
|
295
|
+
if ((key === "u" || key === "uid") && child !== void 0 && child !== null) {
|
|
296
|
+
const uid = String(child);
|
|
297
|
+
if (/^\d+$/.test(uid)) out.add(uid);
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (key === "fd" && child === "@") {
|
|
301
|
+
const id = value.id;
|
|
302
|
+
if (id !== void 0 && id !== null) out.add(String(id));
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
if (key === "txt" && typeof child === "string") {
|
|
306
|
+
const matches = child.match(/:@(\d+);/g);
|
|
307
|
+
if (matches) {
|
|
308
|
+
for (const m of matches) {
|
|
309
|
+
const uid = m.slice(2, -1);
|
|
310
|
+
if (/^\d+$/.test(uid)) out.add(uid);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
walkCollect(child, kind, out);
|
|
317
|
+
}
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (kind === "person" && typeof value === "string") {
|
|
321
|
+
const matches = value.match(/:@(\d+);/g);
|
|
322
|
+
if (matches) {
|
|
323
|
+
for (const m of matches) {
|
|
324
|
+
const uid = m.slice(2, -1);
|
|
325
|
+
if (/^\d+$/.test(uid)) out.add(uid);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function collectI18nIds(msgs) {
|
|
331
|
+
const out = /* @__PURE__ */ new Set();
|
|
332
|
+
for (const item of msgs) {
|
|
333
|
+
const msg = parseMsg(item?.msg);
|
|
334
|
+
if (msg) walkCollect(msg, "id18n", out);
|
|
335
|
+
}
|
|
336
|
+
return [...out];
|
|
337
|
+
}
|
|
338
|
+
function collectPersonIds(msgs) {
|
|
339
|
+
const out = /* @__PURE__ */ new Set();
|
|
340
|
+
for (const item of msgs) {
|
|
341
|
+
const msg = parseMsg(item?.msg);
|
|
342
|
+
if (msg) walkCollect(msg, "person", out);
|
|
343
|
+
}
|
|
344
|
+
return [...out];
|
|
345
|
+
}
|
|
346
|
+
function collapseNewlines(text) {
|
|
347
|
+
return String(text || "").replace(/\r\n+/g, "\n").replace(/\n+/g, "\u23CE");
|
|
348
|
+
}
|
|
349
|
+
function escapePipe(text) {
|
|
350
|
+
return String(text || "").replace(/\|/g, "\\|");
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export {
|
|
354
|
+
MSG_TYPES,
|
|
355
|
+
getTypeName,
|
|
356
|
+
parseMsg,
|
|
357
|
+
substituteTemplate,
|
|
358
|
+
collectMentionMap,
|
|
359
|
+
replaceMentions,
|
|
360
|
+
extractTxt,
|
|
361
|
+
parseSysMsg,
|
|
362
|
+
parseContent,
|
|
363
|
+
senderName,
|
|
364
|
+
extractImgs,
|
|
365
|
+
extractVideos,
|
|
366
|
+
extractFiles,
|
|
367
|
+
collectI18nIds,
|
|
368
|
+
collectPersonIds,
|
|
369
|
+
collapseNewlines,
|
|
370
|
+
escapePipe
|
|
371
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
CliError
|
|
5
|
+
} from "./chunk-LUSPKZKY.js";
|
|
6
|
+
|
|
7
|
+
// src/shortcuts/im/errors.ts
|
|
8
|
+
var ImCliError = class extends CliError {
|
|
9
|
+
type;
|
|
10
|
+
subtype;
|
|
11
|
+
code;
|
|
12
|
+
retryable;
|
|
13
|
+
stage;
|
|
14
|
+
details;
|
|
15
|
+
partialData;
|
|
16
|
+
constructor(type, subtype, message, options = {}) {
|
|
17
|
+
super(message, options.exitCode ?? 5 /* InternalError */);
|
|
18
|
+
this.name = "ImCliError";
|
|
19
|
+
this.type = type;
|
|
20
|
+
this.subtype = subtype;
|
|
21
|
+
this.code = options.code;
|
|
22
|
+
this.retryable = options.retryable ?? false;
|
|
23
|
+
this.stage = options.stage;
|
|
24
|
+
this.details = options.details;
|
|
25
|
+
this.partialData = options.partialData;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function imValidationError(subtype, message, details) {
|
|
29
|
+
return new ImCliError("validation", subtype, message, {
|
|
30
|
+
details,
|
|
31
|
+
exitCode: 2 /* UsageError */
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function imAuthError(subtype, message, details) {
|
|
35
|
+
return new ImCliError("authentication", subtype, message, {
|
|
36
|
+
details,
|
|
37
|
+
exitCode: 3 /* AuthError */
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function imNetworkError(subtype, message, options = {}) {
|
|
41
|
+
return new ImCliError("network", subtype, message, {
|
|
42
|
+
...options,
|
|
43
|
+
retryable: options.retryable ?? true,
|
|
44
|
+
exitCode: 4 /* NetworkError */
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function imConfirmationError(action, details) {
|
|
48
|
+
return new ImCliError("confirmation", "required", "\u8BE5\u64CD\u4F5C\u9700\u8981\u660E\u786E\u786E\u8BA4", {
|
|
49
|
+
details: { action, ...details },
|
|
50
|
+
exitCode: 10 /* ConfirmationRequired */
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function imBusinessError(subtype, message, options = {}) {
|
|
54
|
+
return new ImCliError("api", subtype, message, {
|
|
55
|
+
...options,
|
|
56
|
+
code: options.code,
|
|
57
|
+
exitCode: 1
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
ImCliError,
|
|
63
|
+
imValidationError,
|
|
64
|
+
imAuthError,
|
|
65
|
+
imNetworkError,
|
|
66
|
+
imConfirmationError,
|
|
67
|
+
imBusinessError
|
|
68
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
createImContinuationSigner
|
|
5
|
+
} from "./chunk-P26ZWSKU.js";
|
|
6
|
+
import "./chunk-ZEDWSH32.js";
|
|
7
|
+
import "./chunk-LUSPKZKY.js";
|
|
8
|
+
import "./chunk-BUSC6UAE.js";
|
|
9
|
+
export {
|
|
10
|
+
createImContinuationSigner
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
continuationReplayError,
|
|
5
|
+
createWorkflowContinuationSigner
|
|
6
|
+
} from "./chunk-EZALDOQH.js";
|
|
7
|
+
import "./chunk-FMPJJYYI.js";
|
|
8
|
+
import "./chunk-LUSPKZKY.js";
|
|
9
|
+
import "./chunk-BUSC6UAE.js";
|
|
10
|
+
export {
|
|
11
|
+
continuationReplayError,
|
|
12
|
+
createWorkflowContinuationSigner
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
createEsbContinuationSigner
|
|
5
|
+
} from "./chunk-NIAJ5ZCG.js";
|
|
6
|
+
import "./chunk-GPMFD4RD.js";
|
|
7
|
+
import "./chunk-LUSPKZKY.js";
|
|
8
|
+
import "./chunk-BUSC6UAE.js";
|
|
9
|
+
export {
|
|
10
|
+
createEsbContinuationSigner
|
|
11
|
+
};
|