weaver-work-cli 0.1.29 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/archive-UMGX72K6.js +2537 -0
- package/dist/chunks/archive-oa-N2IYBLF3.js +1317 -0
- package/dist/chunks/asset-GLEGKFG5.js +2109 -0
- package/dist/chunks/attachment-content-AQNX5N3S.js +23 -0
- package/dist/chunks/blog-E44OTVDA.js +2157 -0
- package/dist/chunks/caizhilian-DQUFZXZL.js +10087 -0
- package/dist/chunks/calendar-JKPIRKFD.js +1195 -0
- package/dist/chunks/chunk-2GA5ZIQL.js +1615 -0
- package/dist/chunks/chunk-4YC43QQ4.js +403 -0
- package/dist/chunks/chunk-6EFWDL7Y.js +161 -0
- package/dist/chunks/chunk-6RKD4DRZ.js +5556 -0
- package/dist/chunks/chunk-AJ62BGAW.js +29 -0
- package/dist/chunks/chunk-BUSC6UAE.js +43 -0
- package/dist/chunks/chunk-C6R3B2ML.js +358 -0
- package/dist/chunks/chunk-CVZ2JOSW.js +62 -0
- package/dist/chunks/chunk-DW6AUUKS.js +508 -0
- package/dist/chunks/chunk-E4Z23GHM.js +6962 -0
- package/dist/chunks/chunk-EG6ZU444.js +654 -0
- package/dist/chunks/chunk-EZALDOQH.js +383 -0
- package/dist/chunks/chunk-FMPJJYYI.js +106 -0
- package/dist/chunks/chunk-G2JSIUWF.js +769 -0
- package/dist/chunks/chunk-G3QJULO2.js +387 -0
- package/dist/chunks/chunk-GCG2NMWR.js +703 -0
- package/dist/chunks/chunk-GPMFD4RD.js +75 -0
- package/dist/chunks/chunk-H6XSTSLM.js +2357 -0
- package/dist/chunks/chunk-H7J4DC5R.js +464 -0
- package/dist/chunks/chunk-IURUFGZK.js +477 -0
- package/dist/chunks/chunk-LUSPKZKY.js +53 -0
- package/dist/chunks/chunk-NIAJ5ZCG.js +73 -0
- package/dist/chunks/chunk-NOODWMCL.js +584 -0
- package/dist/chunks/chunk-OOUTBLZ4.js +51 -0
- package/dist/chunks/chunk-P26ZWSKU.js +73 -0
- package/dist/chunks/chunk-QWY6PGL6.js +3472 -0
- package/dist/chunks/chunk-WKI2FBIQ.js +15606 -0
- package/dist/chunks/chunk-WSKBSQ2U.js +231 -0
- package/dist/chunks/chunk-YLCYX7LE.js +371 -0
- package/dist/chunks/chunk-YRVDW4WN.js +205 -0
- package/dist/chunks/chunk-ZEDWSH32.js +68 -0
- package/dist/chunks/continuation-2CKSBLA6.js +11 -0
- package/dist/chunks/continuation-HZIZRZBX.js +13 -0
- package/dist/chunks/continuation-NLECEJPX.js +11 -0
- package/dist/chunks/ebuilder-form-V5FG2EHC.js +2276 -0
- package/dist/chunks/ehr-HMFY6VIL.js +5241 -0
- package/dist/chunks/employee-SAK2QYXX.js +11 -0
- package/dist/chunks/esb-ZYSVB7SG.js +141 -0
- package/dist/chunks/fna-B7RKPAZD.js +1444 -0
- package/dist/chunks/host-45WED2KK.js +21 -0
- package/dist/chunks/host-I4Z6BFYX.js +23 -0
- package/dist/chunks/host-KNZ52LJZ.js +17 -0
- package/dist/chunks/host-OCH2BCCV.js +19 -0
- package/dist/chunks/hrm-2KAZGUHI.js +244 -0
- package/dist/chunks/im-ACJJWH4U.js +252 -0
- package/dist/chunks/invoice-ZK3WCX2U.js +5179 -0
- package/dist/chunks/jiuchuanhui-5PQD3IL2.js +1940 -0
- package/dist/chunks/lazy-dispatch-JQXBW3GM.js +28 -0
- package/dist/chunks/mail-S2HDDXO2.js +2695 -0
- package/dist/chunks/meeting-QVN3I37L.js +504 -0
- package/dist/chunks/msg-parse-4GSQ2WTO.js +41 -0
- package/dist/chunks/okr-QNG4VC2Q.js +2482 -0
- package/dist/chunks/plan-A25EMW6U.js +2025 -0
- package/dist/chunks/project-G6XV66DZ.js +1361 -0
- package/dist/chunks/registry-2VLUAESA.js +14 -0
- package/dist/chunks/registry-7C5UMIPL.js +19 -0
- package/dist/chunks/registry-DC6KR3NH.js +18 -0
- package/dist/chunks/registry-NYPYMZXG.js +16 -0
- package/dist/chunks/registry-TI3CIUXF.js +19 -0
- package/dist/chunks/room-recommend-WRTHO6Y2.js +20 -0
- package/dist/chunks/schedule-KFIITGSK.js +24 -0
- package/dist/chunks/state-Y2XBP6YE.js +15 -0
- package/dist/chunks/workflow-DJ7SYWAF.js +245 -0
- package/dist/cmd/argv.js +45 -0
- package/dist/cmd/docs/index.js +3 -3
- package/dist/cmd/lazy-dispatch.js +20 -0
- package/dist/cmd/root.js +2 -4
- package/dist/cmd/setup/index.js +2 -2
- package/dist/cmd/skills/index.js +2 -2
- package/dist/core/package-paths.js +61 -0
- package/dist/index.js +163 -7
- package/dist/internal/e10/auth/xiaoe.js +3 -3
- package/dist/internal/e10/request-runtime.js +18 -62
- package/dist/internal/skills/detector.js +2 -2
- package/dist/shortcuts/contract/data/performance-catalog.js +1306 -0
- package/dist/shortcuts/contract/host.js +91 -35
- package/dist/shortcuts/contract/index.js +213 -0
- package/dist/shortcuts/contract/manifest.js +928 -0
- package/dist/shortcuts/contract/ooxml/docx.js +295 -0
- package/dist/shortcuts/contract/ooxml/xlsx.js +221 -0
- package/dist/shortcuts/contract/ooxml/zip.js +158 -0
- package/dist/shortcuts/contract/operations/assistant.js +1156 -0
- package/dist/shortcuts/contract/operations/clause-library.js +522 -0
- package/dist/shortcuts/contract/operations/compare.js +193 -0
- package/dist/shortcuts/contract/operations/credit-page.js +34 -0
- package/dist/shortcuts/contract/operations/flow.js +98 -0
- package/dist/shortcuts/contract/operations/page.js +66 -0
- package/dist/shortcuts/contract/operations/performance.js +733 -0
- package/dist/shortcuts/contract/operations/quote.js +557 -0
- package/dist/shortcuts/contract/operations/recommend.js +78 -0
- package/dist/shortcuts/contract/operations/registry.js +18 -0
- package/dist/shortcuts/contract/operations/review.js +83 -0
- package/dist/shortcuts/contract/operations/shared.js +37 -0
- package/dist/shortcuts/contract/operations/upload.js +108 -0
- package/dist/shortcuts/contract/operations/write.js +3 -2
- package/dist/shortcuts/index.js +140 -40
- package/dist/shortcuts/invoice/manifest.js +34 -11
- package/dist/shortcuts/invoice/operations/reim-auto.js +9 -0
- package/dist/shortcuts/invoice/operations/reim.js +81 -5
- package/dist/shortcuts/invoice/operations/shared.js +12 -5
- package/dist/shortcuts/meeting/host.js +45 -3
- package/dist/shortcuts/meeting/invitation/docx.js +442 -0
- package/dist/shortcuts/meeting/operations/attachment-content.js +418 -0
- package/dist/shortcuts/meeting/operations/attachment.js +442 -0
- package/dist/shortcuts/meeting/operations/eb/cache.js +57 -0
- package/dist/shortcuts/meeting/operations/eb/catalog.js +343 -28
- package/dist/shortcuts/meeting/operations/eb/conflict.js +372 -11
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +710 -0
- package/dist/shortcuts/meeting/operations/eb/decision.js +47 -1
- package/dist/shortcuts/meeting/operations/eb/factory.js +129 -11
- package/dist/shortcuts/meeting/operations/eb/index.js +122 -2
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +378 -0
- package/dist/shortcuts/meeting/operations/eb/room-summary.js +84 -0
- package/dist/shortcuts/meeting/operations/eb/schedule.js +450 -0
- package/dist/shortcuts/meeting/operations/from-group-chat.js +576 -0
- package/dist/shortcuts/meeting/operations/invitation.js +458 -0
- package/dist/shortcuts/meeting/operations/minute-content.js +266 -0
- package/dist/shortcuts/meeting/operations/pipeline.js +489 -0
- package/dist/shortcuts/meeting/operations/qrcode.js +131 -0
- package/dist/shortcuts/meeting/operations/receipts.js +1 -1
- package/dist/shortcuts/meeting/operations/registry.js +18 -0
- package/dist/shortcuts/meeting/operations/summary.js +276 -0
- package/dist/shortcuts/meeting/operations/task-notify.js +325 -0
- package/dist/shortcuts/meeting/operations.js +42 -1
- package/dist/shortcuts/meeting/qr/encoder.js +427 -0
- package/dist/shortcuts/meeting/qr/render.js +103 -0
- package/dist/shortcuts/workflow/operations/form.js +17 -5
- package/docs/contract.md +39 -4
- package/docs/invoice.md +5 -5
- package/package.json +3 -2
- package/scripts/bundle.mjs +63 -0
- package/skill-template/business-info.json +25 -4
- package/skill-template/domains/jinchengda.md +16 -3
- package/skill-template/domains/yepiaotong.md +1 -1
- package/skills/weaver-e10-jinchengda/SKILL.md +111 -31
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +7 -13
- package/skills/weaver-e10-jinchengda/references/contract-ai-assistant.md +150 -0
- package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +87 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +111 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +0 -13
- package/skills/weaver-e10-jinchengda/references/contract-credit-page.md +50 -0
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +4 -2
- package/skills/weaver-e10-jinchengda/references/contract-doc-compare.md +74 -0
- package/skills/weaver-e10-jinchengda/references/contract-flow-launch.md +84 -0
- package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +29 -0
- package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +28 -0
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +2 -21
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +0 -24
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +0 -17
- package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +70 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +0 -15
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +0 -15
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +1168 -152
- package/skills/weaver-e10-meeting/SKILL.md +493 -17
- package/skills/weaver-e10-meeting/references/meeting-change.md +4 -4
- package/skills/weaver-e10-meeting/references/meeting-create.md +6 -6
- package/skills/weaver-e10-meeting/references/meeting-eb.md +503 -27
- package/skills/weaver-e10-meeting/references/meeting-invitation.md +113 -0
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +6 -6
- package/skills/weaver-e10-meeting/references/meeting-minute-file.md +425 -0
- package/skills/weaver-e10-meeting/references/meeting-queries.md +4 -4
- package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +15 -15
- package/skills/weaver-e10-meeting/references/meeting-verification.md +19 -11
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-yepiaotong/SKILL.md +9 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +6 -5
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +14 -11
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +97 -56
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +84 -60
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +142 -105
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +53 -194
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -7
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +164 -72
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +6 -0
- package/templates/meeting/invitation.docx +0 -0
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ImCliError,
|
|
5
|
+
imAuthError,
|
|
6
|
+
imNetworkError,
|
|
7
|
+
imValidationError
|
|
8
|
+
} from "./chunk-ZEDWSH32.js";
|
|
9
|
+
import {
|
|
10
|
+
E10ApiError,
|
|
11
|
+
createE10RequestRuntime,
|
|
12
|
+
requireE10Session
|
|
13
|
+
} from "./chunk-DW6AUUKS.js";
|
|
14
|
+
import {
|
|
15
|
+
E10_SESSION_EXPIRED_MESSAGE,
|
|
16
|
+
getActiveProfile
|
|
17
|
+
} from "./chunk-2GA5ZIQL.js";
|
|
18
|
+
|
|
19
|
+
// src/shortcuts/im/host.ts
|
|
20
|
+
import { createHash } from "node:crypto";
|
|
21
|
+
import { existsSync } from "node:fs";
|
|
22
|
+
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
23
|
+
import { dirname, extname, resolve } from "node:path";
|
|
24
|
+
var IM_PREFIX = "/api/em/msg/executeIm";
|
|
25
|
+
function inferProfile(ctx) {
|
|
26
|
+
const options = ctx.getGlobalOptions();
|
|
27
|
+
return options.profile || getActiveProfile();
|
|
28
|
+
}
|
|
29
|
+
function assertPath(requestPath) {
|
|
30
|
+
if (typeof requestPath !== "string" || !requestPath.startsWith("/") || requestPath.startsWith("//")) {
|
|
31
|
+
throw imValidationError("path_invalid", "\u8BF7\u6C42\u8DEF\u5F84\u5FC5\u987B\u662F\u76F8\u5BF9\u7EDD\u5BF9\u8DEF\u5F84");
|
|
32
|
+
}
|
|
33
|
+
if (/^https?:/i.test(requestPath) || /[\r\n]/.test(requestPath) || requestPath.includes("/../")) {
|
|
34
|
+
throw imValidationError("path_invalid", "\u8BF7\u6C42\u8DEF\u5F84\u4E0D\u5141\u8BB8\u8DE8\u57DF\u6216\u8DEF\u5F84\u9003\u9038");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function formBody(form) {
|
|
38
|
+
if (!form) return void 0;
|
|
39
|
+
const params = new URLSearchParams();
|
|
40
|
+
for (const [key, value] of Object.entries(form)) {
|
|
41
|
+
if (value === void 0 || value === null) continue;
|
|
42
|
+
params.set(key, typeof value === "string" ? value : JSON.stringify(value));
|
|
43
|
+
}
|
|
44
|
+
return params;
|
|
45
|
+
}
|
|
46
|
+
function mapRuntimeNetworkError(error) {
|
|
47
|
+
if (error instanceof E10ApiError && error.type === "network") {
|
|
48
|
+
throw imNetworkError(error.subtype, error.message, {
|
|
49
|
+
retryable: error.retryable,
|
|
50
|
+
details: error.details
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
function guessMime(name) {
|
|
56
|
+
const ext = extname(String(name || "")).toLowerCase();
|
|
57
|
+
const map = {
|
|
58
|
+
".jpg": "image/jpeg",
|
|
59
|
+
".jpeg": "image/jpeg",
|
|
60
|
+
".png": "image/png",
|
|
61
|
+
".gif": "image/gif",
|
|
62
|
+
".webp": "image/webp",
|
|
63
|
+
".bmp": "image/bmp",
|
|
64
|
+
".svg": "image/svg+xml",
|
|
65
|
+
".pdf": "application/pdf",
|
|
66
|
+
".txt": "text/plain",
|
|
67
|
+
".md": "text/markdown",
|
|
68
|
+
".doc": "application/msword",
|
|
69
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
70
|
+
".xls": "application/vnd.ms-excel",
|
|
71
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
72
|
+
".ppt": "application/vnd.ms-powerpoint",
|
|
73
|
+
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
74
|
+
".zip": "application/zip",
|
|
75
|
+
".rar": "application/x-rar-compressed",
|
|
76
|
+
".mp4": "video/mp4",
|
|
77
|
+
".mp3": "audio/mpeg"
|
|
78
|
+
};
|
|
79
|
+
return map[ext] || "application/octet-stream";
|
|
80
|
+
}
|
|
81
|
+
async function md5File(filePath) {
|
|
82
|
+
const hash = createHash("md5");
|
|
83
|
+
const { createReadStream } = await import("node:fs");
|
|
84
|
+
const stream = createReadStream(filePath);
|
|
85
|
+
for await (const chunk of stream) hash.update(chunk);
|
|
86
|
+
return hash.digest("hex");
|
|
87
|
+
}
|
|
88
|
+
function createImHost(ctx, dependencies = {}) {
|
|
89
|
+
let e10Session = null;
|
|
90
|
+
let sessionContext = null;
|
|
91
|
+
let selfIdentity = null;
|
|
92
|
+
const personCache = /* @__PURE__ */ new Map();
|
|
93
|
+
const i18nCache = /* @__PURE__ */ new Map();
|
|
94
|
+
const requireSession = dependencies.requireSession || requireE10Session;
|
|
95
|
+
async function ensureSession() {
|
|
96
|
+
if (!e10Session) {
|
|
97
|
+
e10Session = await requireSession(ctx);
|
|
98
|
+
sessionContext = {
|
|
99
|
+
baseUrl: e10Session.getBaseUrl(),
|
|
100
|
+
profile: inferProfile(ctx),
|
|
101
|
+
userId: e10Session.userId,
|
|
102
|
+
tenantKey: e10Session.tenantKey,
|
|
103
|
+
eteamsId: e10Session.eteamsId,
|
|
104
|
+
agentType: e10Session.agentType
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return e10Session;
|
|
108
|
+
}
|
|
109
|
+
async function getSession() {
|
|
110
|
+
await ensureSession();
|
|
111
|
+
return sessionContext;
|
|
112
|
+
}
|
|
113
|
+
async function runtime() {
|
|
114
|
+
return createE10RequestRuntime(ctx, await ensureSession(), {
|
|
115
|
+
interceptors: dependencies.interceptors,
|
|
116
|
+
fetch: dependencies.fetch
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async function request(request2) {
|
|
120
|
+
const {
|
|
121
|
+
method,
|
|
122
|
+
path,
|
|
123
|
+
query,
|
|
124
|
+
body,
|
|
125
|
+
operation,
|
|
126
|
+
form,
|
|
127
|
+
multipart,
|
|
128
|
+
headers: extraHeaders = {},
|
|
129
|
+
// 与源 skill 一致:普通 JSON 请求 15 秒超时即视为失败(超时不做重试)
|
|
130
|
+
timeoutMs = 15e3
|
|
131
|
+
} = request2;
|
|
132
|
+
assertPath(path);
|
|
133
|
+
const resolvedMethod = method || (body === void 0 && form === void 0 && multipart === void 0 ? "GET" : "POST");
|
|
134
|
+
let response;
|
|
135
|
+
try {
|
|
136
|
+
response = await (await runtime()).requestJson({
|
|
137
|
+
module: "im",
|
|
138
|
+
operation,
|
|
139
|
+
method: resolvedMethod,
|
|
140
|
+
path,
|
|
141
|
+
query,
|
|
142
|
+
body: multipart === void 0 ? body : void 0,
|
|
143
|
+
form: multipart === void 0 && form === void 0 ? void 0 : formBody(form ?? {}),
|
|
144
|
+
formData: multipart,
|
|
145
|
+
headers: { "X-Requested-With": "XMLHttpRequest", ...extraHeaders },
|
|
146
|
+
timeoutMs
|
|
147
|
+
});
|
|
148
|
+
} catch (error) {
|
|
149
|
+
mapRuntimeNetworkError(error);
|
|
150
|
+
}
|
|
151
|
+
if (response.status === 401 || response.status === 302) {
|
|
152
|
+
throw imAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE, { httpStatus: response.status });
|
|
153
|
+
}
|
|
154
|
+
if (response.parseError) {
|
|
155
|
+
if (response.status < 200 || response.status >= 300) {
|
|
156
|
+
throw new ImCliError("api", "http_error", `\u6CDB\u5FAE\u63A5\u53E3 HTTP ${response.status}`, {
|
|
157
|
+
code: response.status,
|
|
158
|
+
details: { status: response.status },
|
|
159
|
+
exitCode: 1
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
throw imNetworkError("protocol", `\u63A5\u53E3\u8FD4\u56DE\u4E0D\u662F\u5408\u6CD5 JSON\uFF08HTTP ${response.status}\uFF09`, { retryable: false });
|
|
163
|
+
}
|
|
164
|
+
if (response.status < 200 || response.status >= 300) {
|
|
165
|
+
throw new ImCliError("api", "http_error", `\u6CDB\u5FAE\u63A5\u53E3 HTTP ${response.status}`, {
|
|
166
|
+
code: response.status,
|
|
167
|
+
details: { status: response.status },
|
|
168
|
+
exitCode: 1
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return response.value;
|
|
172
|
+
}
|
|
173
|
+
async function requestBinary(url, headers = {}) {
|
|
174
|
+
const session = await ensureSession();
|
|
175
|
+
const controller = new AbortController();
|
|
176
|
+
const timer = setTimeout(() => controller.abort(), 6e4);
|
|
177
|
+
try {
|
|
178
|
+
const resp = await (dependencies.fetch || globalThis.fetch)(url, {
|
|
179
|
+
headers: {
|
|
180
|
+
accept: "application/json, text/plain, */*",
|
|
181
|
+
cookie: session.cookieHeader(),
|
|
182
|
+
eteamsid: session.eteamsId,
|
|
183
|
+
"user-agent": session.uaHeader(),
|
|
184
|
+
origin: session.getBaseUrl(),
|
|
185
|
+
...headers
|
|
186
|
+
},
|
|
187
|
+
redirect: "manual",
|
|
188
|
+
signal: controller.signal
|
|
189
|
+
});
|
|
190
|
+
if (resp.status === 401 || resp.status === 302) {
|
|
191
|
+
throw imAuthError("session_expired", E10_SESSION_EXPIRED_MESSAGE);
|
|
192
|
+
}
|
|
193
|
+
if (resp.status !== 200) {
|
|
194
|
+
throw new ImCliError("api", "download_failed", `\u4E0B\u8F7D\u5931\u8D25 HTTP ${resp.status}`, {
|
|
195
|
+
code: resp.status,
|
|
196
|
+
exitCode: 1
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return Buffer.from(await resp.arrayBuffer());
|
|
200
|
+
} catch (error) {
|
|
201
|
+
if (error instanceof ImCliError) throw error;
|
|
202
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
203
|
+
throw imNetworkError("transport", `\u4E0B\u8F7D\u5931\u8D25\uFF1A${message}`, { retryable: true });
|
|
204
|
+
} finally {
|
|
205
|
+
clearTimeout(timer);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async function getSelfIdentity() {
|
|
209
|
+
if (selfIdentity) return selfIdentity;
|
|
210
|
+
await ensureSession();
|
|
211
|
+
const base = sessionContext?.baseUrl || "";
|
|
212
|
+
if (!base) throw imAuthError("self_identity_unavailable", "\u7F3A\u5C11 baseUrl\uFF0C\u8BF7\u5148\u767B\u5F55");
|
|
213
|
+
const res = await request({
|
|
214
|
+
method: "POST",
|
|
215
|
+
path: `/api/baseserver/layout/teamsCheck?clientType=not_xinchuang&client=WEB&domainName=${encodeURIComponent(base)}`,
|
|
216
|
+
body: {},
|
|
217
|
+
operation: "im.self.identity"
|
|
218
|
+
});
|
|
219
|
+
const cur = res?.currentUser || res?.data?.currentUser || {};
|
|
220
|
+
const uid = String(cur.imUid || sessionContext?.userId || "");
|
|
221
|
+
const cid = String(cur.imCid || "");
|
|
222
|
+
const name = cur.name || cur.realName || cur.userName || "";
|
|
223
|
+
if (!uid || !cid) {
|
|
224
|
+
throw imAuthError("self_identity_incomplete", `teamsCheck \u672A\u8FD4\u56DE\u5B8C\u6574 IM \u8EAB\u4EFD\uFF08imUid=${uid || "-"}, imCid=${cid || "-"}\uFF09\uFF0C\u8BF7\u786E\u8BA4\u767B\u5F55\u6001\u540E\u91CD\u8BD5`);
|
|
225
|
+
}
|
|
226
|
+
selfIdentity = { uid, cid, name };
|
|
227
|
+
return selfIdentity;
|
|
228
|
+
}
|
|
229
|
+
async function uploadFile(filePath, options = {}) {
|
|
230
|
+
const abs = resolve(filePath);
|
|
231
|
+
if (!existsSync(abs)) throw imValidationError("file_not_found", `\u6587\u4EF6\u4E0D\u5B58\u5728: ${abs}`);
|
|
232
|
+
const st = await stat(abs);
|
|
233
|
+
if (!st.isFile()) throw imValidationError("file_invalid", `\u4E0D\u662F\u6587\u4EF6: ${abs}`);
|
|
234
|
+
const name = options.name || filePath.split(/[\\/]/).pop() || "file";
|
|
235
|
+
const size = st.size;
|
|
236
|
+
const md5 = await md5File(abs);
|
|
237
|
+
const data = await readFile(abs);
|
|
238
|
+
const mime = guessMime(name);
|
|
239
|
+
const permission = options.permission !== void 0 ? String(options.permission) : "3";
|
|
240
|
+
const shareUsers = options.shareUsers !== void 0 ? String(options.shareUsers) : "";
|
|
241
|
+
const shareGroups = options.shareGroups !== void 0 ? String(options.shareGroups) : "";
|
|
242
|
+
const lastModified = Math.round(st.mtimeMs);
|
|
243
|
+
const base = sessionContext?.baseUrl || (await getSession()).baseUrl;
|
|
244
|
+
const uploadHeaders = { devtype: "5", langtype: "zh_CN", timezoneoffset: String((/* @__PURE__ */ new Date()).getTimezoneOffset()) };
|
|
245
|
+
const preForm = new FormData();
|
|
246
|
+
const preFields = {
|
|
247
|
+
module: "im",
|
|
248
|
+
size: String(size),
|
|
249
|
+
name,
|
|
250
|
+
lastModified: String(lastModified),
|
|
251
|
+
lastModifiedDate: String(lastModified),
|
|
252
|
+
MD5: md5,
|
|
253
|
+
permission,
|
|
254
|
+
shareUsers,
|
|
255
|
+
shareGroups,
|
|
256
|
+
shareExternals: ""
|
|
257
|
+
};
|
|
258
|
+
for (const [k, v] of Object.entries(preFields)) preForm.append(k, v);
|
|
259
|
+
const preRes = await request({
|
|
260
|
+
method: "POST",
|
|
261
|
+
path: "/api/file/preUploadCheck",
|
|
262
|
+
multipart: preForm,
|
|
263
|
+
headers: uploadHeaders,
|
|
264
|
+
operation: "im.file.upload.check",
|
|
265
|
+
timeoutMs: 15e3
|
|
266
|
+
});
|
|
267
|
+
const preData = preRes?.data || {};
|
|
268
|
+
if (!preData.preUploadId) {
|
|
269
|
+
throw new ImCliError("api", "upload_check_failed", `preUploadCheck \u5931\u8D25`, { details: preRes, exitCode: 1 });
|
|
270
|
+
}
|
|
271
|
+
const preUploadId = String(preData.preUploadId);
|
|
272
|
+
const uploadType = preData.uploadType || "common";
|
|
273
|
+
const upForm = new FormData();
|
|
274
|
+
upForm.append("data", new Blob([data], { type: mime }), name);
|
|
275
|
+
for (const [k, v] of Object.entries({ module: "im", permission, shareUsers, shareGroups, shareExternals: "", uploadType, preUploadId, MD5: md5 })) {
|
|
276
|
+
upForm.append(k, v);
|
|
277
|
+
}
|
|
278
|
+
const upRes = await request({
|
|
279
|
+
method: "POST",
|
|
280
|
+
path: "/api/file/valid/upload",
|
|
281
|
+
multipart: upForm,
|
|
282
|
+
headers: uploadHeaders,
|
|
283
|
+
operation: "im.file.upload.do",
|
|
284
|
+
timeoutMs: 6e4
|
|
285
|
+
});
|
|
286
|
+
const upData = upRes?.data || {};
|
|
287
|
+
if (!upData.fileObj || !upData.fileObj.id && !upData.fileObj.fileid) {
|
|
288
|
+
throw new ImCliError("api", "upload_failed", `valid/upload \u5931\u8D25`, { details: upRes, exitCode: 1 });
|
|
289
|
+
}
|
|
290
|
+
return upData.fileObj;
|
|
291
|
+
}
|
|
292
|
+
async function resolveUsersByIds(ids) {
|
|
293
|
+
const unique = [...new Set(ids.map((x) => String(x)).filter(Boolean))];
|
|
294
|
+
const miss = unique.filter((id) => !personCache.has(id));
|
|
295
|
+
const result = {};
|
|
296
|
+
for (const id of unique) {
|
|
297
|
+
const hit = personCache.get(id);
|
|
298
|
+
if (hit) result[id] = hit;
|
|
299
|
+
}
|
|
300
|
+
for (let i = 0; i < miss.length; i += 100) {
|
|
301
|
+
const batch = miss.slice(i, i + 100);
|
|
302
|
+
const res = await request({
|
|
303
|
+
method: "POST",
|
|
304
|
+
path: "/api/hrm/common/getEmployeeByIds",
|
|
305
|
+
body: { userIdList: batch, externalIdList: [] },
|
|
306
|
+
headers: { devtype: "5" },
|
|
307
|
+
operation: "im.person.resolveByIds",
|
|
308
|
+
timeoutMs: 15e3
|
|
309
|
+
});
|
|
310
|
+
const list = res?.data?.userList;
|
|
311
|
+
if (Array.isArray(list)) {
|
|
312
|
+
for (const u of list) {
|
|
313
|
+
const brief = {
|
|
314
|
+
uid: String(u.id ?? ""),
|
|
315
|
+
name: String(u.name ?? ""),
|
|
316
|
+
cid: String(u.imCid ?? u.cid ?? ""),
|
|
317
|
+
jobNum: String(u.jobNum ?? u.job_num ?? ""),
|
|
318
|
+
department: String(u.department ?? ""),
|
|
319
|
+
departmentId: String(u.departmentId ?? u.department_id ?? ""),
|
|
320
|
+
subCompany: String(u.subCompany ?? u.subcompany ?? ""),
|
|
321
|
+
position: String(u.position ?? ""),
|
|
322
|
+
mobile: String(u.mobile ?? "")
|
|
323
|
+
};
|
|
324
|
+
if (brief.uid) {
|
|
325
|
+
personCache.set(brief.uid, brief);
|
|
326
|
+
result[brief.uid] = brief;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return result;
|
|
332
|
+
}
|
|
333
|
+
async function searchEmployeeByName(name) {
|
|
334
|
+
const baseForm = {
|
|
335
|
+
browserMultiple: true,
|
|
336
|
+
authWecahtBook: false,
|
|
337
|
+
wxDepNeedConvertCount: 0,
|
|
338
|
+
wxEmpNeedConvertCount: 0,
|
|
339
|
+
wxTotalNeedConvertCount: 0
|
|
340
|
+
};
|
|
341
|
+
const formDatas = {
|
|
342
|
+
status: [{ statusSelect: ["normal"] }],
|
|
343
|
+
subcompany: [{ subcompanyOpt: "in" }],
|
|
344
|
+
department: [{ departmentOpt: "in" }],
|
|
345
|
+
role: [{ roleOpt: "in" }],
|
|
346
|
+
position: [{ positionOpt: "in" }],
|
|
347
|
+
superior: [{ superiorOpt: "in" }]
|
|
348
|
+
};
|
|
349
|
+
if (/@/.test(name)) formDatas.email = [{ emailOpt: "in", emailInput: name }];
|
|
350
|
+
else if (/^\d{11}$/.test(name)) formDatas.mobile = [{ mobileOpt: "in", mobileInput: name }];
|
|
351
|
+
else if (/^\d+$/.test(name) || /^[A-Za-z][A-Za-z0-9]*\d[A-Za-z0-9]*$/.test(name)) formDatas.job_num = [{ job_numOpt: "in", job_numInput: name }];
|
|
352
|
+
else formDatas.username = [{ usernameOpt: "in", usernameInput: name }];
|
|
353
|
+
const out = [];
|
|
354
|
+
let current = 1;
|
|
355
|
+
const pageSize = 200;
|
|
356
|
+
for (; ; ) {
|
|
357
|
+
const res = await request({
|
|
358
|
+
method: "POST",
|
|
359
|
+
path: "/api/hrm/common/browser/data/resource",
|
|
360
|
+
body: { ...baseForm, cmd: "all", formDatas, quickSearchDatas: {}, type: "and", current, pageSize, containsNoneAccount: false, containsPartTimeEmployee: false, containsDls: false },
|
|
361
|
+
operation: "im.person.search",
|
|
362
|
+
timeoutMs: 15e3
|
|
363
|
+
});
|
|
364
|
+
const rows = res?.data?.data;
|
|
365
|
+
if (!Array.isArray(rows)) break;
|
|
366
|
+
for (const r of rows) {
|
|
367
|
+
if (!r?.name) continue;
|
|
368
|
+
const brief = {
|
|
369
|
+
uid: String(r.id ?? ""),
|
|
370
|
+
name: String(r.name),
|
|
371
|
+
cid: String(r.imCid ?? r.cid ?? ""),
|
|
372
|
+
jobNum: String(r.jobNum ?? r.job_num ?? ""),
|
|
373
|
+
department: String(r.department ?? ""),
|
|
374
|
+
departmentId: String(r.departmentId ?? r.department_id ?? ""),
|
|
375
|
+
subCompany: String(r.subCompany ?? r.subcompany ?? ""),
|
|
376
|
+
position: String(r.position ?? ""),
|
|
377
|
+
mobile: String(r.mobile ?? "")
|
|
378
|
+
};
|
|
379
|
+
if (brief.uid) personCache.set(brief.uid, brief);
|
|
380
|
+
out.push(brief);
|
|
381
|
+
}
|
|
382
|
+
if (rows.length < pageSize) break;
|
|
383
|
+
current++;
|
|
384
|
+
if (current > 5) break;
|
|
385
|
+
}
|
|
386
|
+
return out;
|
|
387
|
+
}
|
|
388
|
+
async function fetchI18nLabels(ids) {
|
|
389
|
+
const result = {};
|
|
390
|
+
const unique = [...new Set(ids.map((x) => String(x)).filter((x) => /^\d+$/.test(x)))];
|
|
391
|
+
const miss = unique.filter((id) => !i18nCache.has(id));
|
|
392
|
+
for (const id of unique) {
|
|
393
|
+
const hit = i18nCache.get(id);
|
|
394
|
+
if (hit !== void 0) result[id] = hit;
|
|
395
|
+
}
|
|
396
|
+
if (miss.length === 0) return result;
|
|
397
|
+
try {
|
|
398
|
+
const res = await request({
|
|
399
|
+
method: "POST",
|
|
400
|
+
path: "/api/bs/i18n/labelmanage/getHtmlLabelNames",
|
|
401
|
+
body: miss,
|
|
402
|
+
operation: "im.i18n.labels",
|
|
403
|
+
timeoutMs: 15e3
|
|
404
|
+
});
|
|
405
|
+
const data = res?.data || {};
|
|
406
|
+
for (const id of miss) {
|
|
407
|
+
if (data[id] !== void 0 && data[id] !== null) {
|
|
408
|
+
const text = String(data[id]);
|
|
409
|
+
i18nCache.set(id, text);
|
|
410
|
+
result[id] = text;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
} catch {
|
|
414
|
+
}
|
|
415
|
+
return result;
|
|
416
|
+
}
|
|
417
|
+
async function buildPreviewUrl(options) {
|
|
418
|
+
await ensureSession();
|
|
419
|
+
const kind = options.kind === "video" ? "video" : "img";
|
|
420
|
+
const payload = { tag: kind === "video" ? "1" : "0", msgid: String(options.msgid) };
|
|
421
|
+
if (options.groupId !== void 0 && options.groupId !== null && String(options.groupId) !== "") {
|
|
422
|
+
payload.flag = 1;
|
|
423
|
+
payload.group_id = String(options.groupId);
|
|
424
|
+
} else {
|
|
425
|
+
payload.flag = 0;
|
|
426
|
+
payload.user = { cid: String(options.user?.cid ?? ""), uid: String(options.user?.uid ?? "") };
|
|
427
|
+
}
|
|
428
|
+
const weappAuthStr = Buffer.from(JSON.stringify(payload), "utf-8").toString("base64");
|
|
429
|
+
const params = new URLSearchParams();
|
|
430
|
+
params.set("fileId", String(options.fileId));
|
|
431
|
+
params.set("type", kind === "video" ? "video" : "imgs");
|
|
432
|
+
if (kind !== "video") params.set("imgFormat", options.imgFormat || "small");
|
|
433
|
+
params.set("authModule", "im");
|
|
434
|
+
params.set("weappAuthStr", weappAuthStr);
|
|
435
|
+
return `${(sessionContext?.baseUrl || "").replace(/\/+$/, "")}/api/file/preview?${params.toString()}`;
|
|
436
|
+
}
|
|
437
|
+
async function buildDownloadUrl(options) {
|
|
438
|
+
await ensureSession();
|
|
439
|
+
const kind = options.kind === "video" ? "video" : "img";
|
|
440
|
+
const payload = { tag: kind === "video" ? "1" : "0", msgid: String(options.msgid) };
|
|
441
|
+
if (options.groupId !== void 0 && options.groupId !== null && String(options.groupId) !== "") {
|
|
442
|
+
payload.flag = 1;
|
|
443
|
+
payload.group_id = String(options.groupId);
|
|
444
|
+
} else {
|
|
445
|
+
payload.flag = 0;
|
|
446
|
+
payload.user = { cid: String(options.user?.cid ?? ""), uid: String(options.user?.uid ?? "") };
|
|
447
|
+
}
|
|
448
|
+
const weappAuthStr = Buffer.from(JSON.stringify(payload), "utf-8").toString("base64");
|
|
449
|
+
const params = new URLSearchParams();
|
|
450
|
+
params.set("type", kind === "video" ? "video" : "imgs");
|
|
451
|
+
if (kind !== "video") params.set("imgFormat", options.imgFormat || "small");
|
|
452
|
+
params.set("authModule", "im");
|
|
453
|
+
params.set("weappAuthStr", weappAuthStr);
|
|
454
|
+
return `${(sessionContext?.baseUrl || "").replace(/\/+$/, "")}/api/file/remotedownload/${String(options.fileId)}/im/true?${params.toString()}`;
|
|
455
|
+
}
|
|
456
|
+
return {
|
|
457
|
+
request,
|
|
458
|
+
requestBinary,
|
|
459
|
+
getSession,
|
|
460
|
+
getSelfIdentity,
|
|
461
|
+
uploadFile,
|
|
462
|
+
resolveUsersByIds,
|
|
463
|
+
searchEmployeeByName,
|
|
464
|
+
fetchI18nLabels,
|
|
465
|
+
buildPreviewUrl,
|
|
466
|
+
buildDownloadUrl
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export {
|
|
471
|
+
mkdir,
|
|
472
|
+
writeFile,
|
|
473
|
+
dirname,
|
|
474
|
+
IM_PREFIX,
|
|
475
|
+
assertPath,
|
|
476
|
+
createImHost
|
|
477
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/core/errors.ts
|
|
5
|
+
var CliError = class extends Error {
|
|
6
|
+
exitCode;
|
|
7
|
+
constructor(message, exitCode = 1 /* GeneralError */) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "CliError";
|
|
10
|
+
this.exitCode = exitCode;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function isCliError(error) {
|
|
14
|
+
return error instanceof CliError;
|
|
15
|
+
}
|
|
16
|
+
function isStructuredError(error) {
|
|
17
|
+
return Boolean(
|
|
18
|
+
error && typeof error === "object" && "type" in error && "subtype" in error && "message" in error && typeof error.type === "string" && typeof error.subtype === "string" && typeof error.message === "string"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function toErrorEnvelope(error) {
|
|
22
|
+
if (isStructuredError(error)) {
|
|
23
|
+
return {
|
|
24
|
+
type: error.type,
|
|
25
|
+
subtype: error.subtype,
|
|
26
|
+
...error.code === void 0 ? {} : { code: error.code },
|
|
27
|
+
message: error.message,
|
|
28
|
+
retryable: error.retryable ?? false,
|
|
29
|
+
...error.stage ? { stage: error.stage } : {},
|
|
30
|
+
...error.details === void 0 ? {} : { details: error.details }
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (isCliError(error)) {
|
|
34
|
+
return {
|
|
35
|
+
type: error.exitCode === 3 /* AuthError */ ? "authentication" : "cli",
|
|
36
|
+
subtype: error.exitCode === 2 /* UsageError */ ? "usage" : "error",
|
|
37
|
+
message: error.message,
|
|
38
|
+
retryable: false
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
type: "internal",
|
|
43
|
+
subtype: "unexpected",
|
|
44
|
+
message: error instanceof Error ? error.message : String(error),
|
|
45
|
+
retryable: false
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
CliError,
|
|
51
|
+
isCliError,
|
|
52
|
+
toErrorEnvelope
|
|
53
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
|
+
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
esbValidationError
|
|
5
|
+
} from "./chunk-GPMFD4RD.js";
|
|
6
|
+
|
|
7
|
+
// src/shortcuts/esb/continuation.ts
|
|
8
|
+
import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
|
+
import { resolve } from "node:path";
|
|
13
|
+
function stateRoot(ctx) {
|
|
14
|
+
const configured = ctx?.config?.path();
|
|
15
|
+
if (configured) return resolve(configured, "..");
|
|
16
|
+
return process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), ".weaver-work-cli");
|
|
17
|
+
}
|
|
18
|
+
async function loadKey(ctx) {
|
|
19
|
+
const keysDir = resolve(stateRoot(ctx), "keys");
|
|
20
|
+
const filename = resolve(keysDir, "esb-continuation.key");
|
|
21
|
+
await mkdir(keysDir, { recursive: true, mode: 448 });
|
|
22
|
+
if (existsSync(filename)) return readFile(filename);
|
|
23
|
+
const key = randomBytes(32);
|
|
24
|
+
try {
|
|
25
|
+
await writeFile(filename, key, { flag: "wx", mode: 384 });
|
|
26
|
+
if (process.platform !== "win32") await chmod(filename, 384).catch(() => void 0);
|
|
27
|
+
return key;
|
|
28
|
+
} catch {
|
|
29
|
+
return readFile(filename);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function encode(value) {
|
|
33
|
+
return Buffer.from(JSON.stringify(value)).toString("base64url");
|
|
34
|
+
}
|
|
35
|
+
function signature(payload, key) {
|
|
36
|
+
return createHmac("sha256", key).update(payload).digest("base64url");
|
|
37
|
+
}
|
|
38
|
+
function createEsbContinuationSigner(ctx) {
|
|
39
|
+
return {
|
|
40
|
+
async issue(payload, ttlMs = 10 * 6e4) {
|
|
41
|
+
const issuedAt = Date.now();
|
|
42
|
+
const body = encode({ ...payload, issuedAt, expiresAt: issuedAt + ttlMs });
|
|
43
|
+
const sig = signature(body, await loadKey(ctx));
|
|
44
|
+
return `${body}.${sig}`;
|
|
45
|
+
},
|
|
46
|
+
async verify(token, expectedOperation) {
|
|
47
|
+
if (typeof token !== "string" || !token.includes(".")) {
|
|
48
|
+
throw esbValidationError("continuation_invalid", "continuation \u65E0\u6548");
|
|
49
|
+
}
|
|
50
|
+
const [body, provided] = token.split(".");
|
|
51
|
+
const expected = signature(body, await loadKey(ctx));
|
|
52
|
+
const valid = provided.length === expected.length && timingSafeEqual(Buffer.from(provided), Buffer.from(expected));
|
|
53
|
+
if (!valid) throw esbValidationError("continuation_invalid", "continuation \u7B7E\u540D\u6821\u9A8C\u5931\u8D25");
|
|
54
|
+
let value;
|
|
55
|
+
try {
|
|
56
|
+
value = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
|
|
57
|
+
} catch {
|
|
58
|
+
throw esbValidationError("continuation_invalid", "continuation \u5185\u5BB9\u65E0\u6CD5\u89E3\u6790");
|
|
59
|
+
}
|
|
60
|
+
if (value.operation !== expectedOperation) {
|
|
61
|
+
throw esbValidationError("continuation_mismatch", "continuation \u4E0D\u5C5E\u4E8E\u5F53\u524D\u64CD\u4F5C");
|
|
62
|
+
}
|
|
63
|
+
if (!Number.isSafeInteger(value.expiresAt) || value.expiresAt < Date.now()) {
|
|
64
|
+
throw esbValidationError("continuation_expired", "continuation \u5DF2\u8FC7\u671F");
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
createEsbContinuationSigner
|
|
73
|
+
};
|