weaver-work-cli 0.1.54 → 0.1.57
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-ZQ4A4TV6.js → archive-4SQAVTIB.js} +3 -2
- package/dist/chunks/{archive-oa-57R2FYHV.js → archive-oa-W2UEJ67L.js} +137 -8
- package/dist/chunks/{asset-ZOJVBWZH.js → asset-EGZEABBI.js} +3 -2
- package/dist/chunks/{asset-idle-XGB5IPGT.js → asset-idle-EBUZBB6M.js} +3 -2
- package/dist/chunks/{attachment-content-2EPEI4HV.js → attachment-content-QGM5MLQE.js} +4 -3
- package/dist/chunks/{blog-QSHLZSFW.js → blog-2YKMWOWI.js} +3 -2
- package/dist/chunks/{caizhilian-KCQYFH72.js → caizhilian-QJ4FLSQJ.js} +5 -4
- package/dist/chunks/{calendar-DLGMRJQA.js → calendar-H4QTJCUY.js} +3 -2
- package/dist/chunks/{chunk-XPQN4E5O.js → chunk-44KJ7WFA.js} +300 -55
- package/dist/chunks/{chunk-CZNZKOHR.js → chunk-4GG72JAT.js} +2 -2
- package/dist/chunks/{chunk-YIKSL36S.js → chunk-5N222HK6.js} +2 -2
- package/dist/chunks/{chunk-XHMJBRLZ.js → chunk-6DVL5IN5.js} +4 -1
- package/dist/chunks/{chunk-JJRIT2ZN.js → chunk-6MS3RLPO.js} +5 -334
- package/dist/chunks/{chunk-QUDHSMG3.js → chunk-7EBV7Q3R.js} +112 -27
- package/dist/chunks/{chunk-CNVZETM5.js → chunk-AHJZIMCX.js} +1 -1
- package/dist/chunks/{chunk-TGAGQV4I.js → chunk-CQ4OVCKG.js} +2 -2
- package/dist/chunks/{chunk-2BQESR2U.js → chunk-DVR2EDUU.js} +99 -34
- package/dist/chunks/{chunk-7KKI5KDY.js → chunk-FDAJC7R4.js} +4 -4
- package/dist/chunks/{chunk-GR76ZDDX.js → chunk-FMNCSYIG.js} +2 -2
- package/dist/chunks/{chunk-6LGLI46Q.js → chunk-L2LMBFG5.js} +1 -1
- package/dist/chunks/{chunk-DLY5GUXX.js → chunk-PH7N4UFT.js} +1 -1
- package/dist/chunks/{chunk-U6R6FZHD.js → chunk-SFM3M2L3.js} +286 -93
- package/dist/chunks/chunk-SHYQUBY3.js +48 -0
- package/dist/chunks/{chunk-HFXK54M4.js → chunk-TGM7BWEH.js} +2 -2
- package/dist/chunks/{chunk-Z7B7QSR2.js → chunk-TJUAGZU7.js} +11 -11
- package/dist/chunks/{chunk-LYOFRYC4.js → chunk-UI66EMOR.js} +4 -4
- package/dist/chunks/{chunk-762M5XJS.js → chunk-VMCCRWFO.js} +2 -2
- package/dist/chunks/{chunk-FE3CQAAM.js → chunk-WHJIUKJW.js} +681 -48
- package/dist/chunks/{chunk-PGO4ILMQ.js → chunk-WMB3SMXI.js} +1 -1
- package/dist/chunks/chunk-WMRNO6IU.js +337 -0
- package/dist/chunks/{chunk-6NXT4ICB.js → chunk-WVH5ESDA.js} +1 -1
- package/dist/chunks/{chunk-O6RIBG5E.js → chunk-XU3FL3AW.js} +4 -4
- package/dist/chunks/{chunk-Z6UUBY37.js → chunk-Z4IPY5GV.js} +2 -2
- package/dist/chunks/{conflict-K2IAKKFR.js → conflict-VAFFPUY3.js} +2 -2
- package/dist/chunks/{contract-LJRAXVZU.js → contract-LLRKMLQQ.js} +2655 -1319
- package/dist/chunks/{cowork-3ACICHDQ.js → cowork-2RDFBZWB.js} +3 -2
- package/dist/chunks/{create-flow-UL37MZGP.js → create-flow-TVYE3IOH.js} +6 -6
- package/dist/chunks/{data-WK5CQXNF.js → data-WVICO3DT.js} +57 -11
- package/dist/chunks/{ebuilder-form-CBYI6CQ6.js → ebuilder-form-TWSXS5NA.js} +7 -6
- package/dist/chunks/{ehr-XI4BIVR2.js → ehr-52GBKNJR.js} +3 -2
- package/dist/chunks/{env-BZDB5OVZ.js → env-BVVFIN4P.js} +2 -2
- package/dist/chunks/{esb-4BQHNP5C.js → esb-HJSXCEOM.js} +5 -4
- package/dist/chunks/{factory-VD3YI6N7.js → factory-RCQ36LLE.js} +1 -1
- package/dist/chunks/{fna-ECOYBQYL.js → fna-OBACRT3J.js} +72 -3
- package/dist/chunks/{group-chat-DHNVO76L.js → group-chat-YFZDUUY3.js} +3 -3
- package/dist/chunks/{host-TUOIOEMC.js → host-2BKMPWDH.js} +4 -3
- package/dist/chunks/{host-3TNBMDTR.js → host-KJT3G5D2.js} +4 -3
- package/dist/chunks/{host-7OWWPLM4.js → host-KOWUMNAY.js} +4 -3
- package/dist/chunks/{host-M4XP5URR.js → host-MFXRA2MY.js} +4 -3
- package/dist/chunks/{host-7NTIBSPK.js → host-TTSGY5NZ.js} +4 -3
- package/dist/chunks/{host-G3VU7SDW.js → host-W4JCNRFS.js} +4 -3
- package/dist/chunks/{hrm-YGIR3HGF.js → hrm-AK3WGBMN.js} +4 -3
- package/dist/chunks/{im-TN2JYVGJ.js → im-JZSBPO4Z.js} +4 -3
- package/dist/chunks/{invoice-V7ZTITUO.js → invoice-7JGSEWT5.js} +22 -9
- package/dist/chunks/{jiuchuanhui-ASFZBMPU.js → jiuchuanhui-K4EQU6GK.js} +3 -2
- package/dist/chunks/{lazy-dispatch-XSAHDK6Z.js → lazy-dispatch-JHGFCKJN.js} +5 -4
- package/dist/chunks/{mail-M3HJF5ER.js → mail-IKVCQCVZ.js} +3 -2
- package/dist/chunks/{meeting-OWG4O2XH.js → meeting-JOHV4RH3.js} +14 -12
- package/dist/chunks/minute-doc-JLS4KMFZ.js +156 -0
- package/dist/chunks/{okr-EVX7FB5G.js → okr-KV43FPPX.js} +3 -2
- package/dist/chunks/{operations-J7PUIVWZ.js → operations-ZPWBMYKE.js} +5 -4
- package/dist/chunks/{plan-2QJQEPBO.js → plan-WOYR4WEG.js} +3 -2
- package/dist/chunks/{project-XELELW2T.js → project-CQJKBUIL.js} +3 -2
- package/dist/chunks/{reception-QGPNTGHG.js → reception-MPBU3JXC.js} +3 -2
- package/dist/chunks/{recruit-stage-XCMVEQA2.js → recruit-stage-USTTRHOX.js} +3 -2
- package/dist/chunks/{registry-CJOVECZD.js → registry-GURQG4ZV.js} +3 -2
- package/dist/chunks/{registry-ASYCWF2U.js → registry-LITYOH2W.js} +12 -10
- package/dist/chunks/{registry-QJCZ2GVG.js → registry-SS5J2FZQ.js} +5 -4
- package/dist/chunks/{room-recommend-LSVAMGKV.js → room-recommend-62MECG4J.js} +4 -4
- package/dist/chunks/{schedule-7QOPRUU4.js → schedule-6QRXIBGU.js} +4 -4
- package/dist/chunks/{smart-extract-FOUYNIG3.js → smart-extract-APX2PNIN.js} +3 -2
- package/dist/chunks/{workflow-YHXFIU63.js → workflow-WMPW3WSB.js} +5 -4
- package/dist/index.js +33 -32
- package/dist/internal/e10/auth/agent-host-key.js +68 -0
- package/dist/internal/e10/auth/agent-hosts.js +250 -0
- package/dist/internal/e10/auth/commands.js +99 -30
- package/dist/internal/e10/auth/paths.js +9 -0
- package/dist/internal/e10/auth/session.js +17 -0
- package/dist/internal/e10/auth/xiaoe.js +37 -3
- package/dist/shortcuts/archive-oa/operations/contract-modules.js +106 -0
- package/dist/shortcuts/archive-oa/operations/contract.js +38 -4
- package/dist/shortcuts/archive-oa/operations/registry.js +2 -1
- package/dist/shortcuts/contract/index.js +6 -7
- package/dist/shortcuts/contract/manifest.js +101 -24
- package/dist/shortcuts/contract/ooxml/docx-table.js +75 -3
- package/dist/shortcuts/contract/ooxml/xlsx.js +49 -13
- package/dist/shortcuts/contract/operations/card-action.js +113 -12
- package/dist/shortcuts/contract/operations/card-ebdf-list.js +29 -7
- package/dist/shortcuts/contract/operations/card-plan.js +75 -9
- package/dist/shortcuts/contract/operations/card-risk-report.js +2 -2
- package/dist/shortcuts/contract/operations/card.js +1 -1
- package/dist/shortcuts/contract/operations/clause-library.js +88 -16
- package/dist/shortcuts/contract/operations/compare-screen.js +378 -0
- package/dist/shortcuts/contract/operations/compare.js +1 -1
- package/dist/shortcuts/contract/operations/credit-page.js +1 -1
- package/dist/shortcuts/contract/operations/docx-slots.js +1000 -0
- package/dist/shortcuts/contract/operations/flow.js +2 -2
- package/dist/shortcuts/contract/operations/quote-to-contract.js +495 -0
- package/dist/shortcuts/contract/operations/quote.js +2 -229
- package/dist/shortcuts/contract/operations/recommend.js +1 -1
- package/dist/shortcuts/contract/operations/registry.js +6 -2
- package/dist/shortcuts/contract/operations/review.js +230 -4
- package/dist/shortcuts/contract/operations/save-recognize.js +122 -3
- package/dist/shortcuts/contract/operations/template.js +11 -10
- package/dist/shortcuts/data/operations/ds.js +5 -5
- package/dist/shortcuts/data/operations/shared.js +76 -4
- package/dist/shortcuts/fna/manifest.js +7 -2
- package/dist/shortcuts/fna/operations/budget.js +68 -0
- package/dist/shortcuts/invoice/manifest.js +8 -3
- package/dist/shortcuts/invoice/operations/reim.js +10 -3
- package/dist/shortcuts/meeting/minute-doc.js +153 -0
- package/dist/shortcuts/meeting/operations/compose-outcome.js +176 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +1 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +26 -0
- package/dist/shortcuts/meeting/operations/eb/decision-task-batch.js +144 -0
- package/dist/shortcuts/meeting/operations/eb/decision.js +92 -4
- package/dist/shortcuts/meeting/operations/eb/index.js +133 -4
- package/dist/shortcuts/meeting/operations/eb/meeting-link.js +90 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +46 -0
- package/dist/shortcuts/meeting/operations/minute-content.js +61 -0
- package/dist/shortcuts/meeting/operations/registry.js +14 -1
- package/dist/shortcuts/meeting/operations/self-check.js +49 -0
- package/dist/shortcuts/workflow/endpoints.js +2 -0
- package/dist/shortcuts/workflow/operations/read.js +114 -8
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +72 -46
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +41 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +46 -11
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +18 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroupAdd.js +51 -0
- package/docs/e10-auth.md +78 -0
- package/docs/fna.md +8 -3
- package/docs/invoice.md +1 -1
- package/package.json +4 -2
- package/scripts/pack-offline.mjs +228 -0
- package/scripts/package-skill.mjs +14 -5
- package/skill-template/business-info.json +3 -0
- package/skill-template/domains/qiyecheng.md +4 -3
- package/skills/weaver-e10-archive-oa/SKILL.md +6 -1
- package/skills/weaver-e10-archive-oa/references/contract-search.md +91 -4
- package/skills/weaver-e10-jinchengda/SKILL.md +100 -81
- package/skills/weaver-e10-jinchengda/references/contract-action-card-template.html +11 -6
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +5 -4
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +38 -12
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +20 -6
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +8 -3
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +56 -13
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +7 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-compare-report.md +11 -5
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +38 -7
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +13 -25
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +9 -8
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +8 -6
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +10 -7
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +3 -1
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +26 -18
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +18 -13
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +5 -3
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +105 -49
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +3 -6
- package/skills/weaver-e10-meeting/SKILL.md +47 -9
- package/skills/weaver-e10-qiyecheng/SKILL.md +16 -7
- package/skills/weaver-e10-qiyecheng/references/budget.md +77 -3
- package/skills/weaver-e10-qiyecheng/references/catalog.md +6 -4
- package/skills/weaver-e10-qiyecheng/references/getEnabledTemplate-api.md +255 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +70 -25
- package/skills/weaver-e10-workflow/SKILL.md +54 -40
- package/skills/weaver-e10-workflow/references/todo-dialogue.md +134 -0
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +102 -80
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +23 -13
- package/skills/weaver-e10-workflow/references/workflow-query.md +68 -46
- package/skills/weaver-e10-workflow/references/workflow-view.md +21 -13
- package/skills/weaver-e10-workflow/tools/todo-summary.cjs +317 -332
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +1 -0
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +23 -13
- package/skills/weaver-e10-yepiaotong.zip +0 -0
- package/dist/shortcuts/contract/ooxml/docx.js +0 -295
- package/dist/shortcuts/contract/operations/docx-fillfromquote.js +0 -532
- package/skills/weaver-e10-jinchengda/references/contract-risk-report-template.html +0 -178
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +0 -1270
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +0 -998
- package/skills/weaver-e10-workflow/tools/todo-serve.cjs +0 -327
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
createE10RequestRuntime,
|
|
12
12
|
isE10SessionExpiredResponse,
|
|
13
13
|
requireE10Session
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WVH5ESDA.js";
|
|
15
15
|
import {
|
|
16
16
|
E10_SESSION_EXPIRED_MESSAGE,
|
|
17
17
|
getActiveProfile
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SFM3M2L3.js";
|
|
19
19
|
|
|
20
20
|
// src/shortcuts/im/host.ts
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
createE10RequestRuntime,
|
|
11
11
|
isE10SessionExpiredResponse,
|
|
12
12
|
requireE10Session
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WVH5ESDA.js";
|
|
14
14
|
import {
|
|
15
15
|
getActiveProfile
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SFM3M2L3.js";
|
|
17
17
|
|
|
18
18
|
// src/shortcuts/ebuilder-form/host.ts
|
|
19
19
|
import { randomUUID } from "node:crypto";
|
|
@@ -689,6 +689,9 @@ var EB_ENDPOINTS = [
|
|
|
689
689
|
interfacePk: "query_mtDetail_list",
|
|
690
690
|
countPk: "query_mtDetail_count",
|
|
691
691
|
queryParams: [
|
|
692
|
+
"date",
|
|
693
|
+
"mine",
|
|
694
|
+
"member",
|
|
692
695
|
"mt_id",
|
|
693
696
|
"creator",
|
|
694
697
|
"mt_name",
|
|
@@ -2329,7 +2332,7 @@ function buildWriteOperations(endpoint, preflight, afterWrite) {
|
|
|
2329
2332
|
);
|
|
2330
2333
|
}
|
|
2331
2334
|
if (endpoint.interfacePk === "create_meeting") {
|
|
2332
|
-
const { fetchEbAppSettings, assertEbCreatePathAllowed } = await import("./conflict-
|
|
2335
|
+
const { fetchEbAppSettings, assertEbCreatePathAllowed } = await import("./conflict-VAFFPUY3.js");
|
|
2333
2336
|
assertEbCreatePathAllowed(await fetchEbAppSettings(env, applyName));
|
|
2334
2337
|
}
|
|
2335
2338
|
const pkQuery = writePkQuery(endpoint, payload);
|
|
@@ -1,348 +1,21 @@
|
|
|
1
1
|
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
2
|
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
readDocxEntries
|
|
5
|
+
} from "./chunk-WMRNO6IU.js";
|
|
3
6
|
import {
|
|
4
7
|
meetingStateDir
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-L2LMBFG5.js";
|
|
6
9
|
import {
|
|
7
10
|
SCHEMA_ID,
|
|
8
11
|
meetingSuccess,
|
|
9
12
|
meetingValidationError,
|
|
10
13
|
schemaOf
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6DVL5IN5.js";
|
|
12
15
|
|
|
13
16
|
// src/shortcuts/meeting/operations/attachment-content.ts
|
|
14
17
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
15
18
|
import { join, resolve } from "node:path";
|
|
16
|
-
|
|
17
|
-
// src/shortcuts/meeting/invitation/docx.ts
|
|
18
|
-
import { deflateRawSync, inflateRawSync } from "node:zlib";
|
|
19
|
-
var EOCD_SIG = 101010256;
|
|
20
|
-
var CEN_SIG = 33639248;
|
|
21
|
-
var LOC_SIG = 67324752;
|
|
22
|
-
function findEocd(buf) {
|
|
23
|
-
const min = Math.max(0, buf.length - 65535 - 22);
|
|
24
|
-
for (let i = buf.length - 22; i >= min; i -= 1) {
|
|
25
|
-
if (buf.readUInt32LE(i) === EOCD_SIG) return i;
|
|
26
|
-
}
|
|
27
|
-
throw new Error("docx \u89E3\u6790\u5931\u8D25\uFF1A\u627E\u4E0D\u5230 ZIP \u7ED3\u675F\u8BB0\u5F55\uFF08EOCD\uFF09");
|
|
28
|
-
}
|
|
29
|
-
function readDocxEntries(buf) {
|
|
30
|
-
const eocd = findEocd(buf);
|
|
31
|
-
const count = buf.readUInt16LE(eocd + 10);
|
|
32
|
-
let offset = buf.readUInt32LE(eocd + 16);
|
|
33
|
-
const entries = [];
|
|
34
|
-
for (let i = 0; i < count; i += 1) {
|
|
35
|
-
if (buf.readUInt32LE(offset) !== CEN_SIG) {
|
|
36
|
-
throw new Error("docx \u89E3\u6790\u5931\u8D25\uFF1A\u4E2D\u592E\u76EE\u5F55\u6761\u76EE\u7B7E\u540D\u4E0D\u5339\u914D");
|
|
37
|
-
}
|
|
38
|
-
const method = buf.readUInt16LE(offset + 10);
|
|
39
|
-
const compSize = buf.readUInt32LE(offset + 20);
|
|
40
|
-
const nameLen = buf.readUInt16LE(offset + 28);
|
|
41
|
-
const extraLen = buf.readUInt16LE(offset + 30);
|
|
42
|
-
const commentLen = buf.readUInt16LE(offset + 32);
|
|
43
|
-
const localOffset = buf.readUInt32LE(offset + 42);
|
|
44
|
-
const name = buf.subarray(offset + 46, offset + 46 + nameLen).toString("utf8");
|
|
45
|
-
if (buf.readUInt32LE(localOffset) !== LOC_SIG) {
|
|
46
|
-
throw new Error(`docx \u89E3\u6790\u5931\u8D25\uFF1A${name} \u7684\u672C\u5730\u5934\u7B7E\u540D\u4E0D\u5339\u914D`);
|
|
47
|
-
}
|
|
48
|
-
const localNameLen = buf.readUInt16LE(localOffset + 26);
|
|
49
|
-
const localExtraLen = buf.readUInt16LE(localOffset + 28);
|
|
50
|
-
const dataStart = localOffset + 30 + localNameLen + localExtraLen;
|
|
51
|
-
const raw = buf.subarray(dataStart, dataStart + compSize);
|
|
52
|
-
const data = method === 0 ? Buffer.from(raw) : inflateRawSync(raw);
|
|
53
|
-
entries.push({ name, data });
|
|
54
|
-
offset += 46 + nameLen + extraLen + commentLen;
|
|
55
|
-
}
|
|
56
|
-
return entries;
|
|
57
|
-
}
|
|
58
|
-
var CRC_TABLE = (() => {
|
|
59
|
-
const table = new Int32Array(256);
|
|
60
|
-
for (let i = 0; i < 256; i += 1) {
|
|
61
|
-
let c = i;
|
|
62
|
-
for (let k = 0; k < 8; k += 1) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
63
|
-
table[i] = c;
|
|
64
|
-
}
|
|
65
|
-
return table;
|
|
66
|
-
})();
|
|
67
|
-
function crc32(buf) {
|
|
68
|
-
let crc = -1;
|
|
69
|
-
for (let i = 0; i < buf.length; i += 1) crc = CRC_TABLE[(crc ^ buf[i]) & 255] ^ crc >>> 8;
|
|
70
|
-
return (crc ^ -1) >>> 0;
|
|
71
|
-
}
|
|
72
|
-
function dosDateTime(date) {
|
|
73
|
-
const time = (date.getHours() << 11 | date.getMinutes() << 5 | date.getSeconds() >> 1) & 65535;
|
|
74
|
-
const d = (date.getFullYear() - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate()) & 65535;
|
|
75
|
-
return { time, date: d };
|
|
76
|
-
}
|
|
77
|
-
function writeDocxEntries(entries, now = /* @__PURE__ */ new Date()) {
|
|
78
|
-
const { time, date } = dosDateTime(now);
|
|
79
|
-
const locals = [];
|
|
80
|
-
const centrals = [];
|
|
81
|
-
let offset = 0;
|
|
82
|
-
for (const entry of entries) {
|
|
83
|
-
const nameBuf = Buffer.from(entry.name, "utf8");
|
|
84
|
-
const crc = crc32(entry.data);
|
|
85
|
-
const deflated = deflateRawSync(entry.data);
|
|
86
|
-
const useDeflate = deflated.length < entry.data.length;
|
|
87
|
-
const payload = useDeflate ? deflated : entry.data;
|
|
88
|
-
const method = useDeflate ? 8 : 0;
|
|
89
|
-
const local = Buffer.alloc(30);
|
|
90
|
-
local.writeUInt32LE(LOC_SIG, 0);
|
|
91
|
-
local.writeUInt16LE(20, 4);
|
|
92
|
-
local.writeUInt16LE(2048, 6);
|
|
93
|
-
local.writeUInt16LE(method, 8);
|
|
94
|
-
local.writeUInt16LE(time, 10);
|
|
95
|
-
local.writeUInt16LE(date, 12);
|
|
96
|
-
local.writeUInt32LE(crc, 14);
|
|
97
|
-
local.writeUInt32LE(payload.length, 18);
|
|
98
|
-
local.writeUInt32LE(entry.data.length, 22);
|
|
99
|
-
local.writeUInt16LE(nameBuf.length, 26);
|
|
100
|
-
local.writeUInt16LE(0, 28);
|
|
101
|
-
const central = Buffer.alloc(46);
|
|
102
|
-
central.writeUInt32LE(CEN_SIG, 0);
|
|
103
|
-
central.writeUInt16LE(20, 4);
|
|
104
|
-
central.writeUInt16LE(20, 6);
|
|
105
|
-
central.writeUInt16LE(2048, 8);
|
|
106
|
-
central.writeUInt16LE(method, 10);
|
|
107
|
-
central.writeUInt16LE(time, 12);
|
|
108
|
-
central.writeUInt16LE(date, 14);
|
|
109
|
-
central.writeUInt32LE(crc, 16);
|
|
110
|
-
central.writeUInt32LE(payload.length, 20);
|
|
111
|
-
central.writeUInt32LE(entry.data.length, 24);
|
|
112
|
-
central.writeUInt16LE(nameBuf.length, 28);
|
|
113
|
-
central.writeUInt16LE(0, 30);
|
|
114
|
-
central.writeUInt16LE(0, 32);
|
|
115
|
-
central.writeUInt16LE(0, 34);
|
|
116
|
-
central.writeUInt16LE(0, 36);
|
|
117
|
-
central.writeUInt32LE(0, 38);
|
|
118
|
-
central.writeUInt32LE(offset, 42);
|
|
119
|
-
locals.push(local, nameBuf, payload);
|
|
120
|
-
centrals.push(central, nameBuf);
|
|
121
|
-
offset += local.length + nameBuf.length + payload.length;
|
|
122
|
-
}
|
|
123
|
-
const centralBuf = Buffer.concat(centrals);
|
|
124
|
-
const eocd = Buffer.alloc(22);
|
|
125
|
-
eocd.writeUInt32LE(EOCD_SIG, 0);
|
|
126
|
-
eocd.writeUInt16LE(0, 4);
|
|
127
|
-
eocd.writeUInt16LE(0, 6);
|
|
128
|
-
eocd.writeUInt16LE(entries.length, 8);
|
|
129
|
-
eocd.writeUInt16LE(entries.length, 10);
|
|
130
|
-
eocd.writeUInt32LE(centralBuf.length, 12);
|
|
131
|
-
eocd.writeUInt32LE(offset, 16);
|
|
132
|
-
eocd.writeUInt16LE(0, 20);
|
|
133
|
-
return Buffer.concat([...locals, centralBuf, eocd]);
|
|
134
|
-
}
|
|
135
|
-
var PENDING_MARK = "\u3010\u5F85\u8865\u5145\u3011";
|
|
136
|
-
function unescapeXml(text) {
|
|
137
|
-
return text.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
138
|
-
}
|
|
139
|
-
function escapeXml(text) {
|
|
140
|
-
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
141
|
-
}
|
|
142
|
-
var PLACEHOLDER_RE = /\{([A-Za-z_][A-Za-z0-9_.]*)\}/g;
|
|
143
|
-
var PLACEHOLDER_TEST = /\{[A-Za-z_][A-Za-z0-9_.]*\}/;
|
|
144
|
-
var UNSAFE_PARAGRAPH_RE = /<w:(drawing|pict|hyperlink|fldSimple|sdt|object|txbxContent)\b/;
|
|
145
|
-
function splitParagraph(paraXml) {
|
|
146
|
-
const openMatch = /^<w:p(?:\s[^>]*)?>/.exec(paraXml);
|
|
147
|
-
const open = openMatch ? openMatch[0] : "<w:p>";
|
|
148
|
-
let body = paraXml.slice(open.length).replace(/<\/w:p>\s*$/, "");
|
|
149
|
-
let pPr = "";
|
|
150
|
-
const pPrMatch = /^<w:pPr>[\s\S]*?<\/w:pPr>/.exec(body);
|
|
151
|
-
if (pPrMatch) {
|
|
152
|
-
pPr = pPrMatch[0];
|
|
153
|
-
body = body.slice(pPr.length);
|
|
154
|
-
}
|
|
155
|
-
return { open, pPr, body };
|
|
156
|
-
}
|
|
157
|
-
function parseRuns(body) {
|
|
158
|
-
const runs = [];
|
|
159
|
-
const runRe = /<w:r(?:\s[^>]*)?>([\s\S]*?)<\/w:r>/g;
|
|
160
|
-
let match;
|
|
161
|
-
while ((match = runRe.exec(body)) !== null) {
|
|
162
|
-
const inner = match[1];
|
|
163
|
-
const rPrMatch = /<w:rPr>[\s\S]*?<\/w:rPr>/.exec(inner);
|
|
164
|
-
const rPr = rPrMatch ? rPrMatch[0] : "";
|
|
165
|
-
let text = "";
|
|
166
|
-
const tRe = /<w:t(?:\s[^>]*)?>([\s\S]*?)<\/w:t>/g;
|
|
167
|
-
let tMatch;
|
|
168
|
-
while ((tMatch = tRe.exec(inner)) !== null) text += unescapeXml(tMatch[1]);
|
|
169
|
-
runs.push({ rPr, text });
|
|
170
|
-
}
|
|
171
|
-
return runs;
|
|
172
|
-
}
|
|
173
|
-
function withHighlight(rPr) {
|
|
174
|
-
const highlight = '<w:highlight w:val="yellow"/>';
|
|
175
|
-
if (!rPr) return `<w:rPr>${highlight}</w:rPr>`;
|
|
176
|
-
if (rPr.includes("<w:highlight")) return rPr;
|
|
177
|
-
return rPr.replace(/<\/w:rPr>$/, `${highlight}</w:rPr>`);
|
|
178
|
-
}
|
|
179
|
-
function emitRun(rPr, text) {
|
|
180
|
-
return `<w:r>${rPr}<w:t xml:space="preserve">${escapeXml(text)}</w:t></w:r>`;
|
|
181
|
-
}
|
|
182
|
-
function replaceInParagraph(paraXml, resolver, filled, pending) {
|
|
183
|
-
if (!paraXml.includes("{")) return null;
|
|
184
|
-
const { open, pPr, body } = splitParagraph(paraXml);
|
|
185
|
-
const runs = parseRuns(body);
|
|
186
|
-
if (runs.length === 0) return null;
|
|
187
|
-
const concat = runs.map((run) => run.text).join("");
|
|
188
|
-
if (!PLACEHOLDER_TEST.test(concat)) return null;
|
|
189
|
-
if (UNSAFE_PARAGRAPH_RE.test(paraXml)) return "unsafe";
|
|
190
|
-
PLACEHOLDER_RE.lastIndex = 0;
|
|
191
|
-
const matches = [...concat.matchAll(PLACEHOLDER_RE)];
|
|
192
|
-
if (matches.length === 0) return null;
|
|
193
|
-
const spans = [];
|
|
194
|
-
let cursor = 0;
|
|
195
|
-
for (const run of runs) {
|
|
196
|
-
spans.push({ start: cursor, end: cursor + run.text.length });
|
|
197
|
-
cursor += run.text.length;
|
|
198
|
-
}
|
|
199
|
-
const runAt = (pos) => {
|
|
200
|
-
for (let i = 0; i < spans.length; i += 1) if (pos >= spans[i].start && pos < spans[i].end) return i;
|
|
201
|
-
return spans.length - 1;
|
|
202
|
-
};
|
|
203
|
-
const units = [];
|
|
204
|
-
runs.forEach((run, index) => {
|
|
205
|
-
for (const ch of run.text) units.push({ ch, run: index, highlight: false });
|
|
206
|
-
});
|
|
207
|
-
for (const match of [...matches].reverse()) {
|
|
208
|
-
const key = match[1];
|
|
209
|
-
const start = match.index ?? 0;
|
|
210
|
-
const end = start + match[0].length;
|
|
211
|
-
const value = resolver(key);
|
|
212
|
-
const text = value.pending ? PENDING_MARK : value.text;
|
|
213
|
-
(value.pending ? pending : filled).push(key);
|
|
214
|
-
const firstRun = runAt(start);
|
|
215
|
-
const replacement = [...text].map((ch) => ({ ch, run: firstRun, highlight: Boolean(value.pending) }));
|
|
216
|
-
units.splice(start, end - start, ...replacement);
|
|
217
|
-
}
|
|
218
|
-
const merged = [];
|
|
219
|
-
for (const unit of units) {
|
|
220
|
-
const rPr = runs[unit.run]?.rPr ?? "";
|
|
221
|
-
const last = merged[merged.length - 1];
|
|
222
|
-
if (last && last.rPr === rPr && last.highlight === unit.highlight) last.text += unit.ch;
|
|
223
|
-
else merged.push({ text: unit.ch, rPr, highlight: unit.highlight });
|
|
224
|
-
}
|
|
225
|
-
const rendered = merged.map((run) => emitRun(run.highlight ? withHighlight(run.rPr) : run.rPr, run.text)).join("");
|
|
226
|
-
return `${open}${pPr}${rendered}</w:p>`;
|
|
227
|
-
}
|
|
228
|
-
function replacePlaceholdersInXml(xml, resolver) {
|
|
229
|
-
const filled = [];
|
|
230
|
-
const pending = [];
|
|
231
|
-
let skippedParagraphs = 0;
|
|
232
|
-
const output = xml.replace(/<w:p(?:\s[^>]*)?>[\s\S]*?<\/w:p>/g, (paraXml) => {
|
|
233
|
-
if (!paraXml.includes("{")) return paraXml;
|
|
234
|
-
const replaced = replaceInParagraph(paraXml, resolver, filled, pending);
|
|
235
|
-
if (replaced === "unsafe") {
|
|
236
|
-
skippedParagraphs += 1;
|
|
237
|
-
return paraXml;
|
|
238
|
-
}
|
|
239
|
-
if (replaced === null) return paraXml;
|
|
240
|
-
return replaced;
|
|
241
|
-
});
|
|
242
|
-
return {
|
|
243
|
-
xml: output,
|
|
244
|
-
filled: [...new Set(filled)],
|
|
245
|
-
pending: [...new Set(pending)],
|
|
246
|
-
skippedParagraphs
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
var TR_RE = /<w:tr(?:\s[^>]*)?>[\s\S]*?<\/w:tr>/g;
|
|
250
|
-
var TC_RE = /<w:tc(?:\s[^>]*)?>[\s\S]*?<\/w:tc>/g;
|
|
251
|
-
var WT_RE = /<w:t(?:\s[^>]*)?>([^<]*)<\/w:t>/g;
|
|
252
|
-
function cellText(tc) {
|
|
253
|
-
return [...tc.matchAll(WT_RE)].map((match) => unescapeXml(match[1])).join("");
|
|
254
|
-
}
|
|
255
|
-
function setCellText(tc, text) {
|
|
256
|
-
const tcOpen = /^<w:tc(?:\s[^>]*)?>/.exec(tc)?.[0] ?? "<w:tc>";
|
|
257
|
-
const tcPr = /<w:tcPr>[\s\S]*?<\/w:tcPr>/.exec(tc)?.[0] ?? "";
|
|
258
|
-
const paragraphs = tc.match(/<w:p(?:\s[^>]*)?>[\s\S]*?<\/w:p>/g) ?? [];
|
|
259
|
-
const firstParagraph = paragraphs[0] ?? "<w:p></w:p>";
|
|
260
|
-
const pOpen = /^<w:p(?:\s[^>]*)?>/.exec(firstParagraph)?.[0] ?? "<w:p>";
|
|
261
|
-
const pPr = /<w:pPr>[\s\S]*?<\/w:pPr>/.exec(firstParagraph)?.[0] ?? "";
|
|
262
|
-
const firstRun = /<w:r(?:\s[^>]*)?>[\s\S]*?<\/w:r>/.exec(firstParagraph)?.[0] ?? "";
|
|
263
|
-
const rPr = /<w:rPr>[\s\S]*?<\/w:rPr>/.exec(firstRun)?.[0] ?? /<w:rPr>[\s\S]*?<\/w:rPr>/.exec(pPr)?.[0] ?? "";
|
|
264
|
-
const run = text ? `<w:r>${rPr}<w:t xml:space="preserve">${escapeXml(text)}</w:t></w:r>` : "";
|
|
265
|
-
return `${tcOpen}${tcPr}${pOpen}${pPr}${run}</w:p></w:tc>`;
|
|
266
|
-
}
|
|
267
|
-
function fillTableRowsInXml(xml, option) {
|
|
268
|
-
const rows = option.rows.filter((row) => row.some((cell) => String(cell ?? "").trim() !== ""));
|
|
269
|
-
if (rows.length === 0) return { xml, filled: false, rowCount: 0 };
|
|
270
|
-
const tables = [...xml.matchAll(/<w:tbl(?:\s[^>]*)?>[\s\S]*?<\/w:tbl>/g)];
|
|
271
|
-
for (const table of tables) {
|
|
272
|
-
const tableXml = table[0];
|
|
273
|
-
const tableRows = tableXml.match(TR_RE) ?? [];
|
|
274
|
-
if (tableRows.length < 2) continue;
|
|
275
|
-
const headerRow = tableRows[0];
|
|
276
|
-
const headerText = (headerRow.match(TC_RE) ?? []).map(cellText).join(" ");
|
|
277
|
-
if (!headerText.includes(option.headerKeyword)) continue;
|
|
278
|
-
const dataRows = tableRows.slice(1);
|
|
279
|
-
const cloneSource = dataRows[dataRows.length - 1];
|
|
280
|
-
const shadingFill = (rowXml) => {
|
|
281
|
-
const matched = /<w:shd\b[^>]*w:fill="([^"]*)"/.exec(rowXml);
|
|
282
|
-
return (matched?.[1] ?? "").trim().toUpperCase();
|
|
283
|
-
};
|
|
284
|
-
const isShadedRow = (rowXml) => {
|
|
285
|
-
const fill = shadingFill(rowXml);
|
|
286
|
-
return fill !== "" && fill !== "AUTO" && fill !== "FFFFFF";
|
|
287
|
-
};
|
|
288
|
-
const shadedRow = dataRows.find((row) => isShadedRow(row));
|
|
289
|
-
const plainRow = dataRows.find((row) => !isShadedRow(row));
|
|
290
|
-
const hasZebra = Boolean(shadedRow && plainRow);
|
|
291
|
-
const rebuilt = [headerRow];
|
|
292
|
-
rows.forEach((values, index) => {
|
|
293
|
-
const base = hasZebra ? index % 2 === 0 ? shadedRow : plainRow : dataRows[index] ?? cloneSource;
|
|
294
|
-
const trOpen = /^<w:tr(?:\s[^>]*)?>/.exec(base)?.[0] ?? "<w:tr>";
|
|
295
|
-
const trPr = /<w:trPr>[\s\S]*?<\/w:trPr>/.exec(base)?.[0] ?? "";
|
|
296
|
-
const cells = base.match(TC_RE) ?? [];
|
|
297
|
-
const rebuiltCells = cells.map((cell, cellIndex) => setCellText(cell, values[cellIndex] ?? ""));
|
|
298
|
-
rebuilt.push(`${trOpen}${trPr}${rebuiltCells.join("")}</w:tr>`);
|
|
299
|
-
});
|
|
300
|
-
const firstRowIndex = tableXml.indexOf(headerRow);
|
|
301
|
-
const head = tableXml.slice(0, firstRowIndex);
|
|
302
|
-
const newTableXml = `${head}${rebuilt.join("")}</w:tbl>`;
|
|
303
|
-
const start = table.index ?? 0;
|
|
304
|
-
return {
|
|
305
|
-
xml: `${xml.slice(0, start)}${newTableXml}${xml.slice(start + tableXml.length)}`,
|
|
306
|
-
filled: true,
|
|
307
|
-
rowCount: rows.length
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
return { xml, filled: false, rowCount: 0 };
|
|
311
|
-
}
|
|
312
|
-
var TEXT_PART_RE = /^word\/(document|header\d*|footer\d*|footnotes|endnotes)\.xml$/;
|
|
313
|
-
function renderDocx(template, resolver, options = {}) {
|
|
314
|
-
const entries = readDocxEntries(template);
|
|
315
|
-
const filled = /* @__PURE__ */ new Set();
|
|
316
|
-
const pending = /* @__PURE__ */ new Set();
|
|
317
|
-
let skippedParagraphs = 0;
|
|
318
|
-
let agenda;
|
|
319
|
-
const updated = entries.map((entry) => {
|
|
320
|
-
if (!TEXT_PART_RE.test(entry.name)) return entry;
|
|
321
|
-
let xml = entry.data.toString("utf8");
|
|
322
|
-
if (options.agenda && entry.name === "word/document.xml") {
|
|
323
|
-
const tableResult = fillTableRowsInXml(xml, options.agenda);
|
|
324
|
-
agenda = { filled: tableResult.filled, rowCount: tableResult.rowCount };
|
|
325
|
-
xml = tableResult.xml;
|
|
326
|
-
}
|
|
327
|
-
if (!xml.includes("{")) {
|
|
328
|
-
return xml === entry.data.toString("utf8") ? entry : { name: entry.name, data: Buffer.from(xml, "utf8") };
|
|
329
|
-
}
|
|
330
|
-
const result = replacePlaceholdersInXml(xml, resolver);
|
|
331
|
-
result.filled.forEach((key) => filled.add(key));
|
|
332
|
-
result.pending.forEach((key) => pending.add(key));
|
|
333
|
-
skippedParagraphs += result.skippedParagraphs;
|
|
334
|
-
return { name: entry.name, data: Buffer.from(result.xml, "utf8") };
|
|
335
|
-
});
|
|
336
|
-
return {
|
|
337
|
-
buffer: writeDocxEntries(updated),
|
|
338
|
-
filled: [...filled],
|
|
339
|
-
pending: [...pending],
|
|
340
|
-
skippedParagraphs,
|
|
341
|
-
...options.agenda ? { agenda: agenda ?? { filled: false, rowCount: 0 } } : {}
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// src/shortcuts/meeting/operations/attachment-content.ts
|
|
346
19
|
var MEETING_FILE_FIELDS = ["mt_accessorys", "project_files"];
|
|
347
20
|
var FIELD_LABELS = {
|
|
348
21
|
mt_accessorys: "\u4F1A\u8BAE\u9644\u4EF6",
|
|
@@ -694,8 +367,6 @@ var meetingAttachmentContentOperations = [
|
|
|
694
367
|
];
|
|
695
368
|
|
|
696
369
|
export {
|
|
697
|
-
PENDING_MARK,
|
|
698
|
-
renderDocx,
|
|
699
370
|
looksLikeFileId,
|
|
700
371
|
parseFileIdList,
|
|
701
372
|
listMeetingAttachments,
|