weaver-work-cli 0.1.50 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunks/{attachment-content-EJYIOJPH.js → attachment-content-W3TSJC3Y.js} +3 -3
- package/dist/chunks/{chunk-BFKLQLBK.js → chunk-2J3XY4ED.js} +7 -7
- package/dist/chunks/{chunk-K67FODVC.js → chunk-6GCXWKG6.js} +1 -1
- package/dist/chunks/{chunk-WNJUGI2F.js → chunk-76PRVYH4.js} +1 -1
- package/dist/chunks/{chunk-RYFRGTUV.js → chunk-DEHJ7PMA.js} +4 -4
- package/dist/chunks/{chunk-3NCFFHB2.js → chunk-IF33CG4V.js} +1 -1
- package/dist/chunks/{chunk-YB3AJYPY.js → chunk-PE334WL3.js} +4 -4
- package/dist/chunks/{chunk-MCZG6HPM.js → chunk-QQXMHM3J.js} +2 -2
- package/dist/chunks/{chunk-7ECB22G3.js → chunk-U7ROML5E.js} +23 -23
- package/dist/chunks/{chunk-7AYQJSFY.js → chunk-WTLQGS6D.js} +2 -2
- package/dist/chunks/{chunk-6T53BSWZ.js → chunk-XPQN4E5O.js} +50 -19
- package/dist/chunks/{chunk-HARQF5IP.js → chunk-Z4G7LLDD.js} +25 -25
- package/dist/chunks/{conflict-C4UDHCWV.js → conflict-57WDJWL7.js} +2 -2
- package/dist/chunks/{contract-VUC6JOPG.js → contract-LJRAXVZU.js} +8587 -1421
- package/dist/chunks/{create-flow-6OG2LYBD.js → create-flow-3FMMZBCA.js} +6 -6
- package/dist/chunks/{data-QO7QWOIV.js → data-WK5CQXNF.js} +17 -32
- package/dist/chunks/{env-WP57TF2S.js → env-JYZE3BZB.js} +2 -2
- package/dist/chunks/{factory-VUXI7N5C.js → factory-66SCIKW3.js} +1 -1
- package/dist/chunks/{group-chat-UQRGXILK.js → group-chat-MNRYMLNG.js} +3 -3
- package/dist/chunks/{invoice-E7GOITEU.js → invoice-V7ZTITUO.js} +725 -205
- package/dist/chunks/{meeting-4BBLVAWM.js → meeting-IIY4UAJL.js} +10 -10
- package/dist/chunks/{recruit-stage-FKWS5UQF.js → recruit-stage-XCMVEQA2.js} +718 -131
- package/dist/chunks/{registry-V4CHRQDI.js → registry-CJOVECZD.js} +1 -1
- package/dist/chunks/{registry-5CRCN2TV.js → registry-METZ2LWE.js} +10 -10
- package/dist/chunks/{room-recommend-AYR3UG7R.js → room-recommend-YFY7HTOF.js} +4 -4
- package/dist/chunks/{schedule-JZEFIXUS.js → schedule-6I63TERA.js} +4 -4
- package/dist/chunks/smart-extract-FOUYNIG3.js +2882 -0
- package/dist/chunks/{workflow-3ZAF2J5E.js → workflow-YHXFIU63.js} +1 -1
- package/dist/index.js +11 -6
- package/dist/shortcuts/contract/manifest.js +251 -0
- package/dist/shortcuts/contract/ooxml/docx-table.js +233 -0
- package/dist/shortcuts/contract/operations/card-action.js +1165 -0
- package/dist/shortcuts/contract/operations/card-ebdf-list.js +571 -0
- package/dist/shortcuts/contract/operations/card-plan.js +327 -0
- package/dist/shortcuts/contract/operations/card-risk-report.js +565 -0
- package/dist/shortcuts/contract/operations/card.js +6 -5
- package/dist/shortcuts/contract/operations/docx-fillfromquote.js +532 -0
- package/dist/shortcuts/contract/operations/docx-verify.js +258 -0
- package/dist/shortcuts/contract/operations/elements-build.js +761 -0
- package/dist/shortcuts/contract/operations/elements-spec.js +216 -0
- package/dist/shortcuts/contract/operations/first-screen.js +588 -0
- package/dist/shortcuts/contract/operations/flow.js +81 -25
- package/dist/shortcuts/contract/operations/ledger.js +438 -0
- package/dist/shortcuts/contract/operations/modeltext.js +132 -0
- package/dist/shortcuts/contract/operations/op-resolver.js +22 -0
- package/dist/shortcuts/contract/operations/performance.js +104 -3
- package/dist/shortcuts/contract/operations/quote.js +131 -25
- package/dist/shortcuts/contract/operations/quotescreen.js +529 -0
- package/dist/shortcuts/contract/operations/registry.js +30 -0
- package/dist/shortcuts/contract/operations/review.js +73 -58
- package/dist/shortcuts/contract/operations/summary-validate.js +293 -0
- package/dist/shortcuts/contract/operations/summary.js +4 -2
- package/dist/shortcuts/contract/operations/triage.js +1100 -0
- package/dist/shortcuts/contract/operations/upload.js +48 -7
- package/dist/shortcuts/contract/prewarm-cache.js +90 -0
- package/dist/shortcuts/contract/prewarm.js +88 -0
- package/dist/shortcuts/contract/upload-cache.js +49 -4
- package/dist/shortcuts/data/index.js +1 -6
- package/dist/shortcuts/data/manifest.js +2 -2
- package/dist/shortcuts/data/operations/index.js +1 -1
- package/dist/shortcuts/data/operations/query.js +23 -46
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/index.js +0 -12
- package/dist/shortcuts/invoice/manifest.js +200 -49
- package/dist/shortcuts/invoice/operations/registry.js +4 -2
- package/dist/shortcuts/invoice/operations/reim-relation.js +438 -0
- package/dist/shortcuts/invoice/operations/shared.js +3 -19
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +109 -73
- package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +4 -2
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +6 -2
- package/dist/shortcuts/recruit-stage/operations/list.js +217 -1
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +144 -158
- package/dist/shortcuts/recruit-stage/operations/search.js +348 -0
- package/dist/shortcuts/recruit-stage/shared.js +5 -0
- package/dist/shortcuts/recruit-stage/tag-lookup.js +136 -0
- package/dist/shortcuts/smart-extract/constants.js +79 -0
- package/dist/shortcuts/smart-extract/continuation.js +71 -0
- package/dist/shortcuts/smart-extract/errors.js +68 -0
- package/dist/shortcuts/smart-extract/host.js +191 -0
- package/dist/shortcuts/smart-extract/index.js +105 -0
- package/dist/shortcuts/smart-extract/ledger.js +70 -0
- package/dist/shortcuts/smart-extract/manifest.js +35 -0
- package/dist/shortcuts/smart-extract/operations/attachment.js +212 -0
- package/dist/shortcuts/smart-extract/operations/batch.js +67 -0
- package/dist/shortcuts/smart-extract/operations/config.js +118 -0
- package/dist/shortcuts/smart-extract/operations/fill.js +492 -0
- package/dist/shortcuts/smart-extract/operations/preview.js +174 -0
- package/dist/shortcuts/smart-extract/operations/registry.js +34 -0
- package/dist/shortcuts/smart-extract/operations/save.js +355 -0
- package/dist/shortcuts/smart-extract/operations/shared.js +191 -0
- package/dist/shortcuts/smart-extract/operations/structure.js +401 -0
- package/dist/shortcuts/smart-extract/operations/target.js +167 -0
- package/dist/shortcuts/smart-extract/operations/types.js +22 -0
- package/dist/shortcuts/smart-extract/operations/validate.js +454 -0
- package/dist/shortcuts/workflow/operations/form.js +68 -33
- package/dist/shortcuts/workflow/operations/read.js +19 -1
- package/docs/SKILL.md +1 -1
- package/docs/_catalog.md +3 -0
- package/docs/agent-invoice.md +5 -7
- package/docs/data.md +5 -1
- package/docs/fna.md +14 -1
- package/docs/invoice.md +7 -5
- package/docs/smart-extract.md +156 -0
- package/package.json +1 -1
- package/skill-template/business-info.json +16 -1
- package/skill-template/domains/qiyecheng.md +2 -0
- package/skill-template/domains/smart-extract.md +16 -0
- package/skill-template/domains/yepiaotong.md +2 -2
- package/skills/weaver-e10-data/references/scene-and-misc.md +4 -3
- package/skills/weaver-e10-jinchengda/SKILL.md +223 -35
- package/skills/weaver-e10-jinchengda/references/contract-action-card.md +47 -481
- package/skills/weaver-e10-jinchengda/references/contract-action-engine.md +11 -11
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +32 -16
- package/skills/weaver-e10-jinchengda/references/contract-card-render-internals.md +478 -0
- package/skills/weaver-e10-jinchengda/references/contract-command-index.md +4 -4
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +39 -61
- package/skills/weaver-e10-jinchengda/references/contract-element-save-record.md +18 -13
- package/skills/weaver-e10-jinchengda/references/contract-execution-rules.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-new-customer.md +21 -6
- package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +6 -4
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +3 -3
- package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +263 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +525 -0
- package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +36 -0
- package/skills/weaver-e10-jinchengda/references/contract-modeltext-library.md +128 -0
- package/skills/weaver-e10-jinchengda/references/contract-multi-file.md +87 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +80 -54
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +110 -14
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +19 -21
- package/skills/weaver-e10-jinchengda/references/orchestration.md +12 -12
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +1 -6
- package/skills/weaver-e10-jinchengda/scripts/fill_plan.py +2 -1
- package/skills/weaver-e10-qiyecheng/SKILL.md +37 -0
- package/skills/weaver-e10-qiyecheng/references/ai-check-audit.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/budget.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/catalog.md +25 -0
- package/skills/weaver-e10-qiyecheng/references/expense-center.md +8 -0
- package/skills/weaver-e10-qiyecheng/references/expense-chart.md +9 -0
- package/skills/weaver-e10-qiyecheng/references/invoice-writeoff.md +13 -0
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +14 -0
- package/skills/weaver-e10-qiyecheng/references/self-hosted-mode.md +239 -0
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +34 -27
- package/skills/weaver-e10-recruit-stage/SKILL.md +62 -4
- package/skills/weaver-e10-recruit-stage/agents/openai.yaml +42 -8
- package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +79 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +11 -3
- package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +3 -2
- package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +153 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +7 -4
- package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +1 -1
- package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +66 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +156 -42
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +122 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +36 -8
- package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +157 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +35 -0
- package/skills/weaver-e10-smart-extract/SKILL.md +180 -0
- package/skills/weaver-e10-smart-extract/references/api-contract.md +71 -0
- package/skills/weaver-e10-smart-extract/references/result-format.md +102 -0
- package/skills/weaver-e10-smart-extract/references/troubleshooting.md +106 -0
- package/skills/weaver-e10-workflow/references/workflow-create.md +6 -5
- package/skills/weaver-e10-workflow/references/workflow-edit.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-view.md +1 -1
- package/skills/weaver-e10-yepiaotong/SKILL.md +46 -33
- package/skills/weaver-e10-yepiaotong/references/invoice-add.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-import.md +19 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +8 -2
- package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +407 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +12 -8
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +97 -39
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +91 -2
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +12 -12
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +8 -4
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +136 -91
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +109 -23
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +110 -43
- package/dist/shortcuts/invoice/operations/validate-preview.js +0 -40
- package/skills/weaver-e10-jinchengda/scripts/plan_actions.py +0 -279
- package/skills/weaver-e10-jinchengda/scripts/render_action_card.py +0 -450
- package/skills/weaver-e10-jinchengda/scripts/render_ebdf_list_card.py +0 -265
- package/skills/weaver-e10-jinchengda/scripts/render_risk_report.py +0 -358
- package/skills/weaver-e10-jinchengda/scripts/validate_action_card.py +0 -588
- package/skills/weaver-e10-jinchengda/scripts/verify_docx_placeholders.py +0 -118
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +0 -40
|
@@ -2,7 +2,8 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { readFile, stat } from 'node:fs/promises';
|
|
3
3
|
import { basename, resolve } from 'node:path';
|
|
4
4
|
import { contractPolicyError, contractValidationError } from '../errors.js';
|
|
5
|
-
import { fingerprintKey, isCacheEnabled, lookupUpload, rememberUpload, sha256Of, } from '../upload-cache.js';
|
|
5
|
+
import { fingerprintKey, isCacheEnabled, lookupUpload, rememberFileModule, rememberUpload, sha256Of, } from '../upload-cache.js';
|
|
6
|
+
import { ensurePrewarmed } from '../prewarm.js';
|
|
6
7
|
const MAX_FILE_BYTES = 200 * 1024 * 1024;
|
|
7
8
|
const DEFAULT_UPLOAD_TIMEOUT_MS = 120_000;
|
|
8
9
|
const DOC_EXTENSIONS = new Set(['.doc', '.docx']);
|
|
@@ -22,6 +23,9 @@ function pickFileId(payload) {
|
|
|
22
23
|
/**
|
|
23
24
|
* 两段式文件上传:preUploadCheck 预检(命中秒传直接返回 fileId)→ module/upload 实传。
|
|
24
25
|
* 成功判据是拿到非空 fileId,HTTP 200 不算成功。
|
|
26
|
+
*
|
|
27
|
+
* 上传成功后**立即触发预审预热**(与 module 无关),由 `ensurePrewarmed` 做整轮去重:
|
|
28
|
+
* 后续预审复用同一个 fileId 时不会再重复调用预热接口。
|
|
25
29
|
*/
|
|
26
30
|
export async function uploadFile(host, options) {
|
|
27
31
|
const absolutePath = resolve(options.path);
|
|
@@ -55,7 +59,7 @@ export async function uploadFile(host, options) {
|
|
|
55
59
|
});
|
|
56
60
|
const hit = await lookupUpload(reuseKey);
|
|
57
61
|
if (hit) {
|
|
58
|
-
return {
|
|
62
|
+
return await finish({
|
|
59
63
|
fileId: hit.fileId,
|
|
60
64
|
docId: hit.docId,
|
|
61
65
|
name: hit.name || name,
|
|
@@ -63,7 +67,7 @@ export async function uploadFile(host, options) {
|
|
|
63
67
|
md5: hit.md5,
|
|
64
68
|
sha256,
|
|
65
69
|
reused: true,
|
|
66
|
-
};
|
|
70
|
+
});
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
catch {
|
|
@@ -105,7 +109,7 @@ export async function uploadFile(host, options) {
|
|
|
105
109
|
sha256,
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
|
-
return {
|
|
112
|
+
return await finish({
|
|
109
113
|
fileId: secondUploadId,
|
|
110
114
|
docId: reusedDocId,
|
|
111
115
|
name: reusedName,
|
|
@@ -113,7 +117,7 @@ export async function uploadFile(host, options) {
|
|
|
113
117
|
md5,
|
|
114
118
|
sha256,
|
|
115
119
|
reused: false,
|
|
116
|
-
};
|
|
120
|
+
});
|
|
117
121
|
}
|
|
118
122
|
const preUploadId = text(precheckData.preUploadId);
|
|
119
123
|
const uploadType = text(precheckData.uploadType) ?? 'common';
|
|
@@ -148,7 +152,7 @@ export async function uploadFile(host, options) {
|
|
|
148
152
|
sha256,
|
|
149
153
|
});
|
|
150
154
|
}
|
|
151
|
-
return {
|
|
155
|
+
return await finish({
|
|
152
156
|
fileId,
|
|
153
157
|
docId: finalDocId,
|
|
154
158
|
name: finalName,
|
|
@@ -156,7 +160,44 @@ export async function uploadFile(host, options) {
|
|
|
156
160
|
md5,
|
|
157
161
|
sha256,
|
|
158
162
|
reused: false,
|
|
159
|
-
};
|
|
163
|
+
});
|
|
164
|
+
/**
|
|
165
|
+
* 上传收口:三条返回路径共用。
|
|
166
|
+
* 1. 补记 fileId → module,供流程侧判断附件能否直接复用;
|
|
167
|
+
* 2. 触发预审预热(与 module 无关,默认开;同一 fileId 只触发一次)。
|
|
168
|
+
*/
|
|
169
|
+
async function finish(file) {
|
|
170
|
+
file.module = options.module;
|
|
171
|
+
const prewarmEnabled = options.prewarm !== false;
|
|
172
|
+
if (!prewarmEnabled)
|
|
173
|
+
return file;
|
|
174
|
+
try {
|
|
175
|
+
const session = await host.getSession();
|
|
176
|
+
await rememberFileModule({
|
|
177
|
+
fileId: file.fileId,
|
|
178
|
+
module: options.module,
|
|
179
|
+
baseUrl: session.baseUrl,
|
|
180
|
+
userId: session.userId ?? '',
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
// 记录失败只影响"能否复用",不影响上传结果。
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const summary = await ensurePrewarmed(host, [file.fileId]);
|
|
188
|
+
const result = summary.results[0];
|
|
189
|
+
const ok = result?.ok === true;
|
|
190
|
+
file.prewarmed = ok;
|
|
191
|
+
file.prewarmSkipped = result?.skipped === true;
|
|
192
|
+
if (!ok)
|
|
193
|
+
file.prewarmError = result?.error ?? '未知原因';
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
file.prewarmed = false;
|
|
197
|
+
file.prewarmError = error instanceof Error ? error.message : String(error);
|
|
198
|
+
}
|
|
199
|
+
return file;
|
|
200
|
+
}
|
|
160
201
|
}
|
|
161
202
|
export function assertContractDocument(path) {
|
|
162
203
|
const lower = path.toLowerCase();
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
const CACHE_VERSION = 1;
|
|
5
|
+
const MAX_ENTRIES = 500;
|
|
6
|
+
/** 预审记录本身有时效,预热标记 2 小时后失效,避免误跳过真正需要的重跑。 */
|
|
7
|
+
const DEFAULT_TTL_MS = 2 * 60 * 60 * 1000;
|
|
8
|
+
function cacheRoot() {
|
|
9
|
+
const home = process.env.WEAVER_WORK_CLI_HOME
|
|
10
|
+
|| process.env.WORK_CLI_HOME
|
|
11
|
+
|| resolve(homedir(), '.weaver-work-cli');
|
|
12
|
+
return resolve(home, 'contract');
|
|
13
|
+
}
|
|
14
|
+
export function prewarmCacheFilePath() {
|
|
15
|
+
return resolve(cacheRoot(), 'prewarm-cache.json');
|
|
16
|
+
}
|
|
17
|
+
function ttlMs() {
|
|
18
|
+
const raw = process.env.WEAVER_CONTRACT_PREWARM_CACHE_TTL_MS;
|
|
19
|
+
if (raw === undefined)
|
|
20
|
+
return DEFAULT_TTL_MS;
|
|
21
|
+
const parsed = Number(raw);
|
|
22
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : DEFAULT_TTL_MS;
|
|
23
|
+
}
|
|
24
|
+
export function isPrewarmCacheEnabled() {
|
|
25
|
+
return ttlMs() > 0;
|
|
26
|
+
}
|
|
27
|
+
/** 预热去重键:fileId + 环境 + 用户,任一不同都视为不同文件。 */
|
|
28
|
+
export function prewarmKey(input) {
|
|
29
|
+
return `${input.baseUrl}|${input.userId}|${input.fileId}`;
|
|
30
|
+
}
|
|
31
|
+
async function readCache() {
|
|
32
|
+
try {
|
|
33
|
+
const raw = (await readFile(prewarmCacheFilePath(), 'utf8')).replace(/^\uFEFF/u, '');
|
|
34
|
+
const parsed = JSON.parse(raw);
|
|
35
|
+
if (!parsed || parsed.version !== CACHE_VERSION || typeof parsed.entries !== 'object') {
|
|
36
|
+
return { version: CACHE_VERSION, entries: {} };
|
|
37
|
+
}
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return { version: CACHE_VERSION, entries: {} };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function writeCache(cache) {
|
|
45
|
+
try {
|
|
46
|
+
const path = prewarmCacheFilePath();
|
|
47
|
+
await mkdir(dirname(path), { recursive: true });
|
|
48
|
+
await writeFile(path, JSON.stringify(cache), 'utf8');
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// 缓存写不进去不影响业务:最坏情况就是多预热一次。
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** 该 fileId 是否已经预热过(未过期)。 */
|
|
55
|
+
export async function wasPrewarmed(key) {
|
|
56
|
+
if (!isPrewarmCacheEnabled())
|
|
57
|
+
return false;
|
|
58
|
+
const cache = await readCache();
|
|
59
|
+
const at = cache.entries[key];
|
|
60
|
+
if (at === undefined)
|
|
61
|
+
return false;
|
|
62
|
+
if (Date.now() - at > ttlMs()) {
|
|
63
|
+
delete cache.entries[key];
|
|
64
|
+
await writeCache(cache);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
/** 预热成功后登记,供同一轮后续步骤跳过重复调用。 */
|
|
70
|
+
export async function markPrewarmed(key) {
|
|
71
|
+
if (!isPrewarmCacheEnabled())
|
|
72
|
+
return;
|
|
73
|
+
const cache = await readCache();
|
|
74
|
+
cache.entries[key] = Date.now();
|
|
75
|
+
const keys = Object.keys(cache.entries);
|
|
76
|
+
if (keys.length > MAX_ENTRIES) {
|
|
77
|
+
keys
|
|
78
|
+
.sort((a, b) => cache.entries[a] - cache.entries[b])
|
|
79
|
+
.slice(0, keys.length - MAX_ENTRIES)
|
|
80
|
+
.forEach((stale) => delete cache.entries[stale]);
|
|
81
|
+
}
|
|
82
|
+
await writeCache(cache);
|
|
83
|
+
}
|
|
84
|
+
/** 清空预热标记,供排查或强制重跑使用。 */
|
|
85
|
+
export async function clearPrewarmCache() {
|
|
86
|
+
const cache = await readCache();
|
|
87
|
+
const count = Object.keys(cache.entries).length;
|
|
88
|
+
await writeCache({ version: CACHE_VERSION, entries: {} });
|
|
89
|
+
return count;
|
|
90
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isPrewarmCacheEnabled, markPrewarmed, prewarmKey, wasPrewarmed } from './prewarm-cache.js';
|
|
2
|
+
/**
|
|
3
|
+
* 合同预审预热(`saveInternalRecord`)。
|
|
4
|
+
*
|
|
5
|
+
* 业务口径(2026-11-12 用户定稿):
|
|
6
|
+
* 1. **文件上传后就触发预热**,与上传时用的 module 无关(workflow / ebContract / docCompared 都一样);
|
|
7
|
+
* 2. 一整轮处理**只需要预热一次**,因此这里用 `ensurePrewarmed` 做本地去重;
|
|
8
|
+
* 3. 预审与 module 无关,审查页直接用会话里已有的 fileId 即可。
|
|
9
|
+
*
|
|
10
|
+
* 预热只是加速手段:失败不抛异常,收敛成 `{ ok: false, error }` 交给调用方汇总成 warnings。
|
|
11
|
+
*/
|
|
12
|
+
/** 预审预热流程 ID(固定业务常量,禁止替换)。 */
|
|
13
|
+
export const AI_REVIEW_PREWARM_FLOW_ID = '1269716062340284522';
|
|
14
|
+
const PREWARM_PATH = '/api/ebd/contract/ai/saveInternalRecord';
|
|
15
|
+
const PREWARM_TIMEOUT_MS = 30_000;
|
|
16
|
+
async function prewarmOne(host, fileId) {
|
|
17
|
+
try {
|
|
18
|
+
await host.contractRequest({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
path: PREWARM_PATH,
|
|
21
|
+
body: { flowId: AI_REVIEW_PREWARM_FLOW_ID, fileId },
|
|
22
|
+
timeoutMs: PREWARM_TIMEOUT_MS,
|
|
23
|
+
// 触发型接口:成功时响应体为空,代表"预审已在执行"。
|
|
24
|
+
// 不能走业务码判定,否则空体会被判成业务失败。
|
|
25
|
+
okOnHttpSuccess: true,
|
|
26
|
+
});
|
|
27
|
+
return { fileId, ok: true };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
31
|
+
const structured = error;
|
|
32
|
+
const code = structured?.code === undefined ? '' : ` code=${String(structured.code)}`;
|
|
33
|
+
const raw = typeof structured?.details?.raw === 'string'
|
|
34
|
+
? ` raw=${String(structured.details.raw).slice(0, 300)}`
|
|
35
|
+
: '';
|
|
36
|
+
return { fileId, ok: false, error: `${message}${code}${raw}` };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 按需预热:已预热过的 fileId 直接跳过,未预热的并行触发。
|
|
41
|
+
*
|
|
42
|
+
* `force: true` 时会忽略去重标记强制重跑(仅用于显式补触发命令)。
|
|
43
|
+
* 本函数**不抛异常**,调用方据 `failCount` 汇总 warning 即可。
|
|
44
|
+
*/
|
|
45
|
+
export async function ensurePrewarmed(host, fileIds, options = {}) {
|
|
46
|
+
const unique = Array.from(new Set(fileIds.map((item) => String(item).trim()).filter(Boolean)));
|
|
47
|
+
const force = options.force === true;
|
|
48
|
+
let baseUrl = '';
|
|
49
|
+
let userId = '';
|
|
50
|
+
try {
|
|
51
|
+
const session = await host.getSession();
|
|
52
|
+
baseUrl = session.baseUrl ?? '';
|
|
53
|
+
userId = session.userId ?? '';
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// 拿不到会话时退化为"不去重",宁可多预热一次也不阻断主流程。
|
|
57
|
+
}
|
|
58
|
+
const results = await Promise.all(unique.map(async (fileId) => {
|
|
59
|
+
if (!force && isPrewarmCacheEnabled() && baseUrl) {
|
|
60
|
+
const key = prewarmKey({ fileId, baseUrl, userId });
|
|
61
|
+
if (await wasPrewarmed(key)) {
|
|
62
|
+
return { fileId, ok: true, skipped: true };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const result = await prewarmOne(host, fileId);
|
|
66
|
+
if (result.ok && isPrewarmCacheEnabled() && baseUrl) {
|
|
67
|
+
await markPrewarmed(prewarmKey({ fileId, baseUrl, userId }));
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}));
|
|
71
|
+
return {
|
|
72
|
+
flowId: AI_REVIEW_PREWARM_FLOW_ID,
|
|
73
|
+
enabled: true,
|
|
74
|
+
okCount: results.filter((item) => item.ok).length,
|
|
75
|
+
failCount: results.filter((item) => !item.ok).length,
|
|
76
|
+
skippedCount: results.filter((item) => item.skipped === true).length,
|
|
77
|
+
results,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** 无条件预热(显式补触发用),不去重。 */
|
|
81
|
+
export async function prewarmAll(host, fileIds) {
|
|
82
|
+
const unique = Array.from(new Set(fileIds.map((item) => String(item).trim()).filter(Boolean)));
|
|
83
|
+
return Promise.all(unique.map((fileId) => prewarmOne(host, fileId)));
|
|
84
|
+
}
|
|
85
|
+
/** 单文件无条件预热。 */
|
|
86
|
+
export async function prewarmOneFile(host, fileId) {
|
|
87
|
+
return prewarmOne(host, fileId);
|
|
88
|
+
}
|
|
@@ -4,6 +4,7 @@ import { homedir } from 'node:os';
|
|
|
4
4
|
import { dirname, resolve } from 'node:path';
|
|
5
5
|
const CACHE_VERSION = 1;
|
|
6
6
|
const MAX_ENTRIES = 200;
|
|
7
|
+
const MAX_FILE_MODULES = 500;
|
|
7
8
|
const DEFAULT_TTL_MS = 24 * 60 * 60 * 1000;
|
|
8
9
|
function cacheRoot() {
|
|
9
10
|
const home = process.env.WEAVER_WORK_CLI_HOME
|
|
@@ -39,12 +40,19 @@ async function readCache() {
|
|
|
39
40
|
const raw = (await readFile(cacheFilePath(), 'utf8')).replace(/^\uFEFF/u, '');
|
|
40
41
|
const parsed = JSON.parse(raw);
|
|
41
42
|
if (!parsed || parsed.version !== CACHE_VERSION || typeof parsed.entries !== 'object') {
|
|
42
|
-
return { version: CACHE_VERSION, entries: {} };
|
|
43
|
+
return { version: CACHE_VERSION, entries: {}, fileModules: {} };
|
|
43
44
|
}
|
|
44
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
version: CACHE_VERSION,
|
|
47
|
+
entries: parsed.entries ?? {},
|
|
48
|
+
// 旧版本缓存文件没有这个字段,读出来时补空对象即可。
|
|
49
|
+
fileModules: (parsed.fileModules && typeof parsed.fileModules === 'object')
|
|
50
|
+
? parsed.fileModules
|
|
51
|
+
: {},
|
|
52
|
+
};
|
|
45
53
|
}
|
|
46
54
|
catch {
|
|
47
|
-
return { version: CACHE_VERSION, entries: {} };
|
|
55
|
+
return { version: CACHE_VERSION, entries: {}, fileModules: {} };
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
async function writeCache(cache) {
|
|
@@ -95,10 +103,47 @@ export async function rememberUpload(key, entry) {
|
|
|
95
103
|
}
|
|
96
104
|
await writeCache(cache);
|
|
97
105
|
}
|
|
106
|
+
/** 登记 fileId → module,供流程侧判断能否直接复用附件文件。 */
|
|
107
|
+
export async function rememberFileModule(input) {
|
|
108
|
+
if (!isCacheEnabled() || !input.fileId)
|
|
109
|
+
return;
|
|
110
|
+
const cache = await readCache();
|
|
111
|
+
cache.fileModules[`${input.baseUrl}|${input.userId}|${input.fileId}`] = {
|
|
112
|
+
module: input.module,
|
|
113
|
+
updatedAt: Date.now(),
|
|
114
|
+
};
|
|
115
|
+
const keys = Object.keys(cache.fileModules);
|
|
116
|
+
if (keys.length > MAX_FILE_MODULES) {
|
|
117
|
+
keys
|
|
118
|
+
.sort((a, b) => cache.fileModules[a].updatedAt - cache.fileModules[b].updatedAt)
|
|
119
|
+
.slice(0, keys.length - MAX_FILE_MODULES)
|
|
120
|
+
.forEach((stale) => delete cache.fileModules[stale]);
|
|
121
|
+
}
|
|
122
|
+
await writeCache(cache);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 反查某个 fileId 当初是用哪个 module 上传的。
|
|
126
|
+
* 返回 null 表示未知(缓存过期、从未在本机上传、或换了环境/账号)。
|
|
127
|
+
* 调用方对 null 要按"不是 workflow"处理,即重新上传。
|
|
128
|
+
*/
|
|
129
|
+
export async function lookupFileModule(input) {
|
|
130
|
+
if (!isCacheEnabled() || !input.fileId)
|
|
131
|
+
return null;
|
|
132
|
+
const cache = await readCache();
|
|
133
|
+
const entry = cache.fileModules[`${input.baseUrl}|${input.userId}|${input.fileId}`];
|
|
134
|
+
if (!entry)
|
|
135
|
+
return null;
|
|
136
|
+
if (Date.now() - entry.updatedAt > ttlMs()) {
|
|
137
|
+
delete cache.fileModules[`${input.baseUrl}|${input.userId}|${input.fileId}`];
|
|
138
|
+
await writeCache(cache);
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
return entry.module;
|
|
142
|
+
}
|
|
98
143
|
/** 清空缓存,供显式刷新或多份副本排查时使用。 */
|
|
99
144
|
export async function clearUploadCache() {
|
|
100
145
|
const cache = await readCache();
|
|
101
146
|
const count = Object.keys(cache.entries).length;
|
|
102
|
-
await writeCache({ version: CACHE_VERSION, entries: {} });
|
|
147
|
+
await writeCache({ version: CACHE_VERSION, entries: {}, fileModules: {} });
|
|
103
148
|
return count;
|
|
104
149
|
}
|
|
@@ -109,12 +109,7 @@ export const dataShortcut = {
|
|
|
109
109
|
.option('--schema <schema>', '库名')
|
|
110
110
|
.option('--table-id <id>', '数据集 / 流程 ID')
|
|
111
111
|
.option('--dsl <json|@file>', 'DSL 查询体')
|
|
112
|
-
.
|
|
113
|
-
.option('--dimension <key>', '后端 confKey(URL query,恒定发送)')
|
|
114
|
-
.option('--conf-group <group>', 'confGroup(URL query,恒定发送)')
|
|
115
|
-
.option('--confGroup <group>', '同 --conf-group')
|
|
116
|
-
.option('--username <name>', '问句中出现的人名(无则传空)')
|
|
117
|
-
.option('--start-date <ym>', '问句日期起始年月(无则传空)')
|
|
112
|
+
.requiredOption('--question-context <json|@file>', '问句上下文,含 dimensions / timeRanges')
|
|
118
113
|
.action(action(async (ctx, options) => {
|
|
119
114
|
await run(ctx, 'data.dsl.query', toInput(options), false);
|
|
120
115
|
}));
|
|
@@ -7,8 +7,8 @@ import { operationDefinitions } from './operations/index.js';
|
|
|
7
7
|
*/
|
|
8
8
|
const INPUT_SCHEMAS = {
|
|
9
9
|
'data.dsl.query': {
|
|
10
|
-
required: ['conn', 'model', 'schema', 'dsl'],
|
|
11
|
-
optional: ['table_id'
|
|
10
|
+
required: ['conn', 'model', 'schema', 'dsl', 'question_context'],
|
|
11
|
+
optional: ['table_id'],
|
|
12
12
|
},
|
|
13
13
|
'data.ds.groups': { required: [], optional: ['pattern'] },
|
|
14
14
|
'data.ds.find': {
|
|
@@ -8,7 +8,7 @@ import { confAdd, confAddFile, confBatch, confBatchFile, confDelete, confGet, co
|
|
|
8
8
|
import { moduleCall } from './module.js';
|
|
9
9
|
import { sceneGroups, sceneItems, sceneSearch } from './scene.js';
|
|
10
10
|
const DEFINITIONS = [
|
|
11
|
-
{ name: 'data.dsl.query', summary: '直接执行 DSL 查询(executeQueryDsl
|
|
11
|
+
{ name: 'data.dsl.query', summary: '直接执行 DSL 查询(executeQueryDsl;与 ds list/chart/stat/count 为独立通道)', capability: 'dsl', handler: executeQuery, command: 'query' },
|
|
12
12
|
{ name: 'data.ds.groups', summary: '内置数据源分组清单(仅用于 ds find 的默认扫描候选集)', capability: 'discovery', handler: dsGroups, command: 'ds groups' },
|
|
13
13
|
{ name: 'data.ds.find', summary: '按关键词跨分组找表(进程内并发扇出 + 本地过滤 + 路由建议)', capability: 'discovery', handler: dsFind, command: 'ds find' },
|
|
14
14
|
{ name: 'data.ds.describe', summary: '一次并发取回字段元数据 + 词库,并给出关联字段/通道提示', capability: 'discovery', handler: dsDescribe, command: 'ds describe' },
|
|
@@ -1,68 +1,30 @@
|
|
|
1
1
|
import { needArg } from '../host.js';
|
|
2
2
|
import { dataValidationError } from '../errors.js';
|
|
3
|
-
import { readJsonArg, renderTable } from './shared.js';
|
|
4
|
-
/** `executeQueryDsl` 的 4 个 URL query 参数——**恒定发送**,值允许为空。 */
|
|
5
|
-
const QUERY_PARAM_ALIASES = [
|
|
6
|
-
['dimension', 'dimension'],
|
|
7
|
-
['confGroup', 'conf-group'],
|
|
8
|
-
['username', 'username'],
|
|
9
|
-
['startDate', 'start-date'],
|
|
10
|
-
];
|
|
11
|
-
function argStr(input, key) {
|
|
12
|
-
const value = input[key];
|
|
13
|
-
// 裸开关(只写 --username 不给值)与未传都归一为空值
|
|
14
|
-
if (value === undefined || value === null || value === true)
|
|
15
|
-
return '';
|
|
16
|
-
return String(value).trim();
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 拼 4 个恒定 query。
|
|
20
|
-
*
|
|
21
|
-
* 后端签名为 `executeQueryDsl(@RequestBody DslQueryVo, @RequestParam confKey,
|
|
22
|
-
* @RequestParam confGroup, @RequestParam username, @RequestParam startDate, Employee)`,
|
|
23
|
-
* `@RequestParam` 的 required 校验看「键是否存在」而非「值是否非空」——缺键即失败、空值合法。
|
|
24
|
-
* 早前「空串就不带」会把最常见的情况(问句里没有人名/日期)直接打成 400/500。
|
|
25
|
-
*/
|
|
26
|
-
function buildQueryString(input) {
|
|
27
|
-
return '?' + QUERY_PARAM_ALIASES
|
|
28
|
-
.map(([name, flag]) => {
|
|
29
|
-
const snake = flag.replace(/-/g, '_');
|
|
30
|
-
const raw = argStr(input, name) || argStr(input, snake) || argStr(input, flag);
|
|
31
|
-
return `${encodeURIComponent(name)}=${encodeURIComponent(raw)}`;
|
|
32
|
-
})
|
|
33
|
-
.join('&');
|
|
34
|
-
}
|
|
3
|
+
import { readJsonArg, renderTable, scanTips, tipsLines } from './shared.js';
|
|
35
4
|
/**
|
|
36
5
|
* DSL 直查:`POST /api/dw/dsl/executeQueryDsl`。
|
|
37
6
|
*
|
|
38
|
-
*
|
|
39
|
-
* 参数形式(`--conn/--model/--schema/--dsl`)必须逐字保留。
|
|
7
|
+
* 与 `ds list/chart/stat/count` 是独立通道:本命令发送 DslQuery,后者分别请求数据源的 get*Datas 接口。
|
|
40
8
|
*/
|
|
41
9
|
export async function executeQuery(input, host) {
|
|
42
10
|
const conn = needArg(input, 'conn');
|
|
43
11
|
const model = needArg(input, 'model');
|
|
44
12
|
const schema = needArg(input, 'schema');
|
|
45
13
|
const dslRaw = needArg(input, 'dsl');
|
|
14
|
+
const questionContextRaw = needArg(input, 'question_context', 'question-context');
|
|
46
15
|
const dslQuery = readJsonArg(dslRaw, '--dsl');
|
|
16
|
+
const questionContext = readJsonArg(questionContextRaw, '--question-context');
|
|
47
17
|
const body = {
|
|
48
18
|
connId: conn,
|
|
49
19
|
model,
|
|
50
20
|
schema,
|
|
51
21
|
tableId: input.table_id || input.tableId || '',
|
|
52
22
|
dslQuery,
|
|
23
|
+
questionContext,
|
|
53
24
|
};
|
|
54
|
-
if (input.debug !== undefined && input.debug !== null && input.debug !== '') {
|
|
55
|
-
const flag = String(input.debug).toLowerCase();
|
|
56
|
-
if (flag === 'true' || flag === '1')
|
|
57
|
-
body.debug = true;
|
|
58
|
-
else if (flag === 'false' || flag === '0')
|
|
59
|
-
body.debug = false;
|
|
60
|
-
else
|
|
61
|
-
throw dataValidationError('debug_invalid', `--debug 值必须为 true 或 false(当前: ${input.debug})`);
|
|
62
|
-
}
|
|
63
25
|
const response = await host.request({
|
|
64
26
|
method: 'POST',
|
|
65
|
-
path:
|
|
27
|
+
path: '/api/dw/dsl/executeQueryDsl',
|
|
66
28
|
body,
|
|
67
29
|
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
|
68
30
|
});
|
|
@@ -74,12 +36,27 @@ export async function executeQuery(input, host) {
|
|
|
74
36
|
}
|
|
75
37
|
}
|
|
76
38
|
const payload = response?.data;
|
|
77
|
-
const rows = Array.isArray(payload)
|
|
39
|
+
const rows = Array.isArray(payload)
|
|
40
|
+
? payload
|
|
41
|
+
: Array.isArray(payload?.dataList)
|
|
42
|
+
? payload.dataList
|
|
43
|
+
: Array.isArray(payload?.records)
|
|
44
|
+
? payload.records
|
|
45
|
+
: [];
|
|
46
|
+
const tips = scanTips(response);
|
|
78
47
|
const lines = [];
|
|
79
48
|
if (payload && !Array.isArray(payload) && payload.sql)
|
|
80
49
|
lines.push(`SQL: ${payload.sql}`);
|
|
81
50
|
if (String(code) !== '200' && code !== undefined)
|
|
82
51
|
lines.push(`code=${code} msg=${response?.msg || ''}`);
|
|
83
|
-
|
|
52
|
+
// 后端正常保证两类提示互斥;异常响应同时出现时,人读输出以 tipTimeout 为最高优先级。
|
|
53
|
+
lines.push(...tipsLines(tips.tipTimeout ? {
|
|
54
|
+
tipTimeout: true,
|
|
55
|
+
tipTimeoutMsg: tips.tipTimeoutMsg,
|
|
56
|
+
} : tips));
|
|
57
|
+
if (tips.tipTimeout)
|
|
58
|
+
lines.push('(平台未执行数据返回:请按上述提示收窄时间范围)');
|
|
59
|
+
else
|
|
60
|
+
lines.push(rows.length ? renderTable(`结果 ${rows.length} 行`, rows) : '(空:0 行)');
|
|
84
61
|
return { data: response, text: lines.join('\n') };
|
|
85
62
|
}
|
package/dist/shortcuts/index.js
CHANGED
|
@@ -150,6 +150,11 @@ export const builtinShortcuts = [
|
|
|
150
150
|
description: '泛微客户参观接待流程 CLI(面板/行程单与内部方案/填单页预填)',
|
|
151
151
|
load: async () => (await import('./reception/index.js')).receptionShortcut,
|
|
152
152
|
}),
|
|
153
|
+
lazyShortcut({
|
|
154
|
+
name: 'smart-extract',
|
|
155
|
+
description: '泛微E10智能抽取 CLI(表单结构 / 附件正文 / 校验并落库,返回 aiExtraId)',
|
|
156
|
+
load: async () => (await import('./smart-extract/index.js')).smartExtractShortcut,
|
|
157
|
+
}),
|
|
153
158
|
lazyShortcut({
|
|
154
159
|
name: 'data',
|
|
155
160
|
description: '泛微E10数据助手 CLI(数据源查询 / 配置中心 / 场景定位)',
|
|
@@ -219,18 +219,6 @@ export const invoiceShortcut = {
|
|
|
219
219
|
url: opts.url,
|
|
220
220
|
}), projectionFrom(options));
|
|
221
221
|
}));
|
|
222
|
-
const validate = invoice.command('validate').description('Invoice validation commands');
|
|
223
|
-
withInvoiceOptions(validate.command('preview')
|
|
224
|
-
.description('Validate an existing invoice without saving validation result')
|
|
225
|
-
.option('--fid <fid>', 'invoice fid')
|
|
226
|
-
.option('--scope <scope>', 'personal or enterprise'))
|
|
227
|
-
.action(action(async (ctx, options) => {
|
|
228
|
-
const opts = asOptions(options);
|
|
229
|
-
await executeAndPrint(ctx, 'invoice.validate.preview', await inputFrom(options, {
|
|
230
|
-
fid: opts.fid,
|
|
231
|
-
scope: opts.scope,
|
|
232
|
-
}), projectionFrom(options));
|
|
233
|
-
}));
|
|
234
222
|
const importCommand = invoice.command('import').description('Invoice file import commands');
|
|
235
223
|
withInvoiceOptions(importCommand.command('prepare')
|
|
236
224
|
.description('Prepare a confirmed invoice file import')
|