weaver-e9-assistant-cli 1.1.5 → 1.1.11
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/auth-token.js +4 -4
- package/dist/cache-store.js +73 -0
- package/dist/cli.js +714 -57
- package/dist/client.js +1 -1
- package/dist/cube.js +16 -38
- package/dist/formula.js +246 -0
- package/dist/hrm.js +33 -19
- package/dist/memory.js +968 -0
- package/dist/nodemap.js +232 -242
- package/dist/subordinate.js +86 -35
- package/dist/teamreport.js +77 -0
- package/dist/tododetail.js +516 -0
- package/dist/todosubmit.js +619 -26
- package/dist/util.js +21 -0
- package/dist/wfcodeblock.js +761 -0
- package/dist/wfcreate.js +29 -1
- package/dist/wfform.js +286 -67
- package/dist/wfstart.js +516 -81
- package/dist/wfsummary.js +1 -1
- package/dist/wfupload.js +48 -4
- package/dist/workflow.js +4 -2
- package/dist/workplan.js +21 -6
- package/package.json +2 -2
package/dist/util.js
CHANGED
|
@@ -17,6 +17,27 @@ export function nowTimeStr() {
|
|
|
17
17
|
export function sleep(ms) {
|
|
18
18
|
return new Promise((r) => setTimeout(r, ms));
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* 并发受限的 map:保持返回顺序与 items 一致,最多 limit 个任务同时执行。
|
|
22
|
+
* 用于组织树/多页数据等「彼此独立但数量可能很大」的请求,避免串行排队拖慢,
|
|
23
|
+
* 也避免一次性打满服务端。
|
|
24
|
+
*/
|
|
25
|
+
export async function mapLimit(items, limit, fn) {
|
|
26
|
+
const list = Array.from(items ?? []);
|
|
27
|
+
const results = new Array(list.length);
|
|
28
|
+
const max = Math.max(1, Number(limit) || 1);
|
|
29
|
+
let next = 0;
|
|
30
|
+
const worker = async () => {
|
|
31
|
+
while (true) {
|
|
32
|
+
const i = next++;
|
|
33
|
+
if (i >= list.length)
|
|
34
|
+
return;
|
|
35
|
+
results[i] = await fn(list[i], i);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
await Promise.all(Array.from({ length: Math.min(max, list.length) }, worker));
|
|
39
|
+
return results;
|
|
40
|
+
}
|
|
20
41
|
/** 非空字符串化:null/undefined/'' → undefined,否则 String(v)。 */
|
|
21
42
|
export function stringify(v) {
|
|
22
43
|
if (v === undefined || v === null || v === '')
|