weaver-work-cli 0.1.32 → 0.1.33
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 +2 -2
- package/dist/chunks/{archive-UMGX72K6.js → archive-FVFY6GZN.js} +2 -2
- package/dist/chunks/{archive-oa-N2IYBLF3.js → archive-oa-NW3OD4UV.js} +2 -2
- package/dist/chunks/{asset-GLEGKFG5.js → asset-7QJKMIDV.js} +2 -2
- package/dist/chunks/{attachment-content-AQNX5N3S.js → attachment-content-OSAVA6K3.js} +3 -2
- package/dist/chunks/{blog-E44OTVDA.js → blog-I7SDPNW4.js} +2 -2
- package/dist/chunks/{caizhilian-DQUFZXZL.js → caizhilian-O37ZIQNY.js} +2 -2
- package/dist/chunks/{calendar-JKPIRKFD.js → calendar-7KXE4ED3.js} +2 -2
- package/dist/chunks/{chunk-4YC43QQ4.js → chunk-2FLWXFVS.js} +4 -4
- package/dist/chunks/{chunk-QWY6PGL6.js → chunk-2LV74IWP.js} +361 -56
- package/dist/chunks/chunk-3SO6QL6U.js +73 -0
- package/dist/chunks/{chunk-DW6AUUKS.js → chunk-6ATGWRZM.js} +6 -4
- package/dist/chunks/chunk-BYATLLEF.js +68 -0
- package/dist/chunks/chunk-BYBSCN4X.js +932 -0
- package/dist/chunks/{chunk-2GA5ZIQL.js → chunk-D223PTXU.js} +1 -0
- package/dist/chunks/{chunk-H7J4DC5R.js → chunk-EEWPQE3O.js} +2 -2
- package/dist/chunks/{chunk-6RKD4DRZ.js → chunk-GFPXQIY2.js} +2 -2
- package/dist/chunks/{chunk-C6R3B2ML.js → chunk-HEL5XTYI.js} +12 -6
- package/dist/chunks/{chunk-CVZ2JOSW.js → chunk-IHUYP6LO.js} +1 -1
- package/dist/chunks/{chunk-YRVDW4WN.js → chunk-ILMBNVSG.js} +2 -2
- package/dist/chunks/{chunk-G3QJULO2.js → chunk-KAS45KNR.js} +1 -1
- package/dist/chunks/{chunk-H6XSTSLM.js → chunk-MEEFGWTM.js} +54 -196
- package/dist/chunks/{chunk-GCG2NMWR.js → chunk-MQ2I5AA3.js} +4 -2
- package/dist/chunks/chunk-NHA62QD7.js +774 -0
- package/dist/chunks/{chunk-WKI2FBIQ.js → chunk-OCU4RLHC.js} +641 -309
- package/dist/chunks/{chunk-WSKBSQ2U.js → chunk-PRHJGPMA.js} +2 -2
- package/dist/chunks/{chunk-6EFWDL7Y.js → chunk-Q6LWB5HX.js} +2 -2
- package/dist/chunks/{chunk-IURUFGZK.js → chunk-RBGOMK4Y.js} +50 -33
- package/dist/chunks/chunk-VBCFFFGT.js +226 -0
- package/dist/chunks/{ebuilder-form-V5FG2EHC.js → chunk-WRRJ4GG2.js} +22 -1148
- package/dist/chunks/{chunk-E4Z23GHM.js → chunk-WY74UBJ6.js} +264 -750
- package/dist/chunks/conflict-SFNEVJY5.js +21 -0
- package/dist/chunks/continuation-RN6PZN2M.js +11 -0
- package/dist/chunks/cowork-CKWYHXYB.js +2508 -0
- package/dist/chunks/ebuilder-form-KOLJRVZD.js +121 -0
- package/dist/chunks/{ehr-HMFY6VIL.js → ehr-WFOC3B4D.js} +1174 -20
- package/dist/chunks/{esb-ZYSVB7SG.js → esb-LJZTN663.js} +4 -4
- package/dist/chunks/{fna-B7RKPAZD.js → fna-F7QRIIZC.js} +2 -2
- package/dist/chunks/{host-45WED2KK.js → host-BCGUVEWX.js} +3 -3
- package/dist/chunks/host-BQBRHVR3.js +23 -0
- package/dist/chunks/{host-I4Z6BFYX.js → host-DGE2TZD4.js} +3 -3
- package/dist/chunks/{host-KNZ52LJZ.js → host-KXPTEWFS.js} +3 -3
- package/dist/chunks/{host-OCH2BCCV.js → host-VQ6JJXGQ.js} +3 -3
- package/dist/chunks/{hrm-2KAZGUHI.js → hrm-NI6XAKW5.js} +3 -3
- package/dist/chunks/{im-ACJJWH4U.js → im-7TRTF3KT.js} +88 -12
- package/dist/chunks/{invoice-ZK3WCX2U.js → invoice-AOXWJKYT.js} +3 -3
- package/dist/chunks/{jiuchuanhui-5PQD3IL2.js → jiuchuanhui-7NQWEZAW.js} +2 -2
- package/dist/chunks/{lazy-dispatch-JQXBW3GM.js → lazy-dispatch-RNS4EE4S.js} +4 -4
- package/dist/chunks/{mail-S2HDDXO2.js → mail-VDHJAB4O.js} +3 -3
- package/dist/chunks/{meeting-QVN3I37L.js → meeting-GA7XCNNP.js} +214 -43
- package/dist/chunks/{okr-QNG4VC2Q.js → okr-TQIRERPQ.js} +2 -2
- package/dist/chunks/operations-5QL3AECO.js +11 -0
- package/dist/chunks/{plan-A25EMW6U.js → plan-4RY4LN2P.js} +2 -2
- package/dist/chunks/{project-G6XV66DZ.js → project-D6XT2OC5.js} +2 -2
- package/dist/chunks/{registry-DC6KR3NH.js → registry-JHRIDQ3A.js} +4 -4
- package/dist/chunks/{registry-2VLUAESA.js → registry-OZSMDVPP.js} +2 -2
- package/dist/chunks/{registry-TI3CIUXF.js → registry-QKMI43Q6.js} +8 -6
- package/dist/chunks/{registry-7C5UMIPL.js → registry-VOGKFFTR.js} +2 -2
- package/dist/chunks/{room-recommend-WRTHO6Y2.js → room-recommend-D4EUOOWY.js} +4 -3
- package/dist/chunks/{schedule-KFIITGSK.js → schedule-XPFBHPCV.js} +4 -3
- package/dist/chunks/{workflow-DJ7SYWAF.js → workflow-HLBZRWIY.js} +172 -6
- package/dist/index.js +30 -25
- package/dist/internal/e10/auth-recovery.js +14 -4
- package/dist/shortcuts/contract/host.js +34 -59
- package/dist/shortcuts/cowork/continuation.js +70 -0
- package/dist/shortcuts/cowork/errors.js +59 -0
- package/dist/shortcuts/cowork/host.js +172 -0
- package/dist/shortcuts/cowork/index.js +166 -0
- package/dist/shortcuts/cowork/manifest.js +65 -0
- package/dist/shortcuts/cowork/operations/discuss-write.js +277 -0
- package/dist/shortcuts/cowork/operations/item-write.js +380 -0
- package/dist/shortcuts/cowork/operations/member-write.js +283 -0
- package/dist/shortcuts/cowork/operations/permission-write.js +286 -0
- package/dist/shortcuts/cowork/operations/read.js +423 -0
- package/dist/shortcuts/cowork/operations/registry.js +39 -0
- package/dist/shortcuts/cowork/operations/review-write.js +157 -0
- package/dist/shortcuts/cowork/operations/shared.js +215 -0
- package/dist/shortcuts/cowork/operations/types.js +24 -0
- package/dist/shortcuts/cowork/operations.js +19 -0
- package/dist/shortcuts/ehr/host.js +4 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +757 -0
- package/dist/shortcuts/ehr/operations/recruit-position.js +367 -0
- package/dist/shortcuts/ehr/operations/recruit-stats.js +133 -0
- package/dist/shortcuts/ehr/operations/recruit-write.js +8 -16
- package/dist/shortcuts/ehr/operations/recruit.js +35 -10
- package/dist/shortcuts/ehr/operations/registry.js +6 -0
- package/dist/shortcuts/im/diagnostics.js +97 -0
- package/dist/shortcuts/im/host.js +58 -31
- package/dist/shortcuts/im/index.js +7 -2
- package/dist/shortcuts/im/operations/at-mention.js +127 -0
- package/dist/shortcuts/im/operations/file-user.js +10 -2
- package/dist/shortcuts/im/operations/group-read.js +26 -5
- package/dist/shortcuts/im/operations/group-write.js +35 -28
- package/dist/shortcuts/im/operations/msg-sync.js +7 -2
- package/dist/shortcuts/im/operations/msg-write.js +76 -10
- package/dist/shortcuts/im/operations/quote-mention.js +119 -0
- package/dist/shortcuts/im/operations/session.js +1 -1
- package/dist/shortcuts/im/operations/shared.js +10 -0
- package/dist/shortcuts/im/operations/types.js +13 -0
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/mail/host.js +4 -1
- package/dist/shortcuts/meeting/host.js +27 -34
- package/dist/shortcuts/meeting/operations/create.js +4 -1
- package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -0
- package/dist/shortcuts/meeting/operations/eb/conflict.js +78 -7
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +168 -26
- package/dist/shortcuts/meeting/operations/eb/factory.js +69 -1
- package/dist/shortcuts/meeting/operations/eb/index.js +16 -3
- package/dist/shortcuts/meeting/operations/eb/room-recommend.js +14 -3
- package/dist/shortcuts/meeting/operations/eb-fallback.js +159 -0
- package/dist/shortcuts/meeting/operations/env.js +93 -46
- package/dist/shortcuts/meeting/operations/form-fields.js +110 -0
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/meeting/operations/standard-guard.js +71 -0
- package/dist/shortcuts/meeting/operations.js +16 -0
- package/dist/shortcuts/workflow/index.js +110 -1
- package/dist/shortcuts/workflow/operations/form.js +24 -3
- package/dist/shortcuts/workflow/operations/read.js +104 -23
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupRules.js +448 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/aigroupStore.js +106 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/businessRules.js +47 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.collect.js +30 -23
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.core.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.group.js +1 -0
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.groupSummary.js +2 -1
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.js +2 -4
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.smartGroup.js +138 -181
- package/dist/shortcuts/workflow/operations/todoSmartConvert/todoSmartConvert.summary.js +12 -7
- package/docs/e10-auth.md +1 -1
- package/docs/im.md +8 -1
- package/docs/todo-smart-convert/README.md +1 -1
- package/docs/todo-smart-convert/data-contract.md +2 -2
- package/docs/todo-smart-convert/subgroup-rules.md +6 -0
- package/package.json +1 -1
- package/skill-template/domains/yimiaoban.md +3 -3
- package/skill-template/skill-template.md +1 -1
- package/skills/weaver-e10-blog/SKILL.md +5 -5
- package/skills/weaver-e10-caizhilian/SKILL.md +5 -5
- package/skills/weaver-e10-calendar/SKILL.md +5 -5
- package/skills/weaver-e10-esb/SKILL.md +5 -5
- package/skills/weaver-e10-hrm/SKILL.md +5 -5
- package/skills/weaver-e10-jinchengda/SKILL.md +2 -2
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -5
- package/skills/weaver-e10-jucailin/SKILL.md +18 -12
- package/skills/weaver-e10-jucailin/references/recruit-create.md +104 -0
- package/skills/weaver-e10-mail/SKILL.md +5 -5
- package/skills/weaver-e10-meeting/SKILL.md +171 -25
- package/skills/weaver-e10-meeting/references/meeting-eb.md +4 -3
- package/skills/weaver-e10-meeting/references/meeting-queries.md +9 -6
- package/skills/weaver-e10-meeting/references/meeting-verification.md +8 -6
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-okr/SKILL.md +5 -5
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-plan/SKILL.md +5 -5
- package/skills/weaver-e10-shared/SKILL.md +12 -12
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +4 -4
- package/skills/weaver-e10-wenshuding/SKILL.md +5 -5
- package/skills/weaver-e10-workflow/SKILL.md +29 -5
- package/skills/weaver-e10-workflow/aigroup/default.json +88 -0
- package/skills/weaver-e10-workflow/references/todo-smart-convert.md +66 -14
- package/skills/weaver-e10-workflow/references/workflow-agent-entry.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-memory.md +1 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +12 -10
- package/skills/weaver-e10-workflow/references/workflow-view.md +2 -2
- package/skills/weaver-e10-workflow/tools/todo-serve.cjs +239 -0
- package/skills/weaver-e10-workflow/{scripts → tools}/todo-summary.cjs +218 -28
- package/skills/weaver-e10-yepiaotong/SKILL.md +10 -8
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +7 -7
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +10 -10
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +40 -37
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +27 -38
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +4 -4
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +37 -29
- package/skills/weaver-e10-yimiaoban/SKILL.md +156 -33
- package/skills/weaver-e10-yimiaoban/references/ding-write.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/error-codes.md +5 -1
- package/skills/weaver-e10-yimiaoban/references/group-read.md +5 -1
- package/skills/weaver-e10-yimiaoban/references/group-write.md +6 -4
- package/skills/weaver-e10-yimiaoban/references/msg-read.md +1 -0
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +34 -2
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +5 -2
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +79 -58
- package/skills/weaver-e10-yimiaoban/references/user-remind.md +2 -2
- package/skills/weaver-e10-ziguanjia/SKILL.md +5 -5
|
@@ -1,142 +1,18 @@
|
|
|
1
1
|
import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
2
2
|
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
ebuilderAuthError,
|
|
5
|
+
ebuilderBusinessError,
|
|
6
|
+
ebuilderNetworkError,
|
|
7
|
+
ebuilderValidationError
|
|
8
|
+
} from "./chunk-BYATLLEF.js";
|
|
3
9
|
import {
|
|
4
10
|
createE10RequestRuntime,
|
|
5
11
|
requireE10Session
|
|
6
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6ATGWRZM.js";
|
|
7
13
|
import {
|
|
8
14
|
getActiveProfile
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
CliError,
|
|
12
|
-
isCliError,
|
|
13
|
-
toErrorEnvelope
|
|
14
|
-
} from "./chunk-LUSPKZKY.js";
|
|
15
|
-
import "./chunk-BUSC6UAE.js";
|
|
16
|
-
|
|
17
|
-
// src/shortcuts/ebuilder-form/index.ts
|
|
18
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
19
|
-
|
|
20
|
-
// src/shortcuts/ebuilder-form/continuation.ts
|
|
21
|
-
import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
22
|
-
import { existsSync } from "node:fs";
|
|
23
|
-
import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
24
|
-
import { homedir } from "node:os";
|
|
25
|
-
import { resolve } from "node:path";
|
|
26
|
-
|
|
27
|
-
// src/shortcuts/ebuilder-form/errors.ts
|
|
28
|
-
var EbuilderFormCliError = class extends CliError {
|
|
29
|
-
type;
|
|
30
|
-
subtype;
|
|
31
|
-
code;
|
|
32
|
-
retryable;
|
|
33
|
-
stage;
|
|
34
|
-
details;
|
|
35
|
-
constructor(type, subtype, message, options = {}) {
|
|
36
|
-
super(message, options.exitCode ?? 5 /* InternalError */);
|
|
37
|
-
this.name = "EbuilderFormCliError";
|
|
38
|
-
this.type = type;
|
|
39
|
-
this.subtype = subtype;
|
|
40
|
-
this.code = options.code;
|
|
41
|
-
this.retryable = options.retryable ?? false;
|
|
42
|
-
this.stage = options.stage;
|
|
43
|
-
this.details = options.details;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
function ebuilderValidationError(subtype, message, details) {
|
|
47
|
-
return new EbuilderFormCliError("validation", subtype, message, {
|
|
48
|
-
details,
|
|
49
|
-
exitCode: 2 /* UsageError */
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function ebuilderAuthError(subtype, message, details) {
|
|
53
|
-
return new EbuilderFormCliError("authentication", subtype, message, {
|
|
54
|
-
details,
|
|
55
|
-
exitCode: 3 /* AuthError */
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function ebuilderBusinessError(subtype, message, options = {}) {
|
|
59
|
-
return new EbuilderFormCliError("api", subtype, message, {
|
|
60
|
-
code: options.code,
|
|
61
|
-
details: options.details,
|
|
62
|
-
retryable: options.retryable ?? false,
|
|
63
|
-
stage: options.stage,
|
|
64
|
-
exitCode: 1 /* GeneralError */
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function ebuilderNetworkError(subtype, message, options = {}) {
|
|
68
|
-
return new EbuilderFormCliError("network", subtype, message, {
|
|
69
|
-
details: options.details,
|
|
70
|
-
retryable: options.retryable ?? true,
|
|
71
|
-
stage: options.stage,
|
|
72
|
-
exitCode: 4 /* NetworkError */
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function ebuilderConfirmationError(action, details) {
|
|
76
|
-
return new EbuilderFormCliError("confirmation", "required", "\u8BE5 eBuilder \u8868\u5355\u5199\u64CD\u4F5C\u9700\u8981\u660E\u786E\u786E\u8BA4", {
|
|
77
|
-
details: { action, ...details },
|
|
78
|
-
exitCode: 10 /* ConfirmationRequired */
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// src/shortcuts/ebuilder-form/continuation.ts
|
|
83
|
-
function stateRoot(ctx) {
|
|
84
|
-
const configured = ctx?.config?.path();
|
|
85
|
-
if (configured) return resolve(configured, "..");
|
|
86
|
-
return process.env.WEAVER_WORK_CLI_HOME || process.env.WORK_CLI_HOME || resolve(homedir(), ".weaver-work-cli");
|
|
87
|
-
}
|
|
88
|
-
async function loadKey(ctx) {
|
|
89
|
-
const keysDir = resolve(stateRoot(ctx), "keys");
|
|
90
|
-
const filename = resolve(keysDir, "ebuilder-form-continuation.key");
|
|
91
|
-
await mkdir(keysDir, { recursive: true, mode: 448 });
|
|
92
|
-
if (existsSync(filename)) return readFile(filename);
|
|
93
|
-
const key = randomBytes(32);
|
|
94
|
-
try {
|
|
95
|
-
await writeFile(filename, key, { flag: "wx", mode: 384 });
|
|
96
|
-
if (process.platform !== "win32") await chmod(filename, 384).catch(() => void 0);
|
|
97
|
-
return key;
|
|
98
|
-
} catch {
|
|
99
|
-
return readFile(filename);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function encode(value) {
|
|
103
|
-
return Buffer.from(JSON.stringify(value)).toString("base64url");
|
|
104
|
-
}
|
|
105
|
-
function signature(payload, key) {
|
|
106
|
-
return createHmac("sha256", key).update(payload).digest("base64url");
|
|
107
|
-
}
|
|
108
|
-
function createEbuilderFormContinuationSigner(ctx) {
|
|
109
|
-
return {
|
|
110
|
-
async issue(payload, ttlMs = 10 * 6e4) {
|
|
111
|
-
const issuedAt = Date.now();
|
|
112
|
-
const body = encode({ ...payload, issuedAt, expiresAt: issuedAt + ttlMs });
|
|
113
|
-
const sig = signature(body, await loadKey(ctx));
|
|
114
|
-
return `${body}.${sig}`;
|
|
115
|
-
},
|
|
116
|
-
async verify(token, expectedOperation) {
|
|
117
|
-
if (typeof token !== "string" || !token.includes(".")) {
|
|
118
|
-
throw ebuilderValidationError("continuation_invalid", "continuation \u65E0\u6548");
|
|
119
|
-
}
|
|
120
|
-
const [body, provided] = token.split(".");
|
|
121
|
-
const expected = signature(body, await loadKey(ctx));
|
|
122
|
-
const valid = provided.length === expected.length && timingSafeEqual(Buffer.from(provided), Buffer.from(expected));
|
|
123
|
-
if (!valid) throw ebuilderValidationError("continuation_invalid", "continuation \u7B7E\u540D\u6821\u9A8C\u5931\u8D25");
|
|
124
|
-
let value;
|
|
125
|
-
try {
|
|
126
|
-
value = JSON.parse(Buffer.from(body, "base64url").toString("utf8"));
|
|
127
|
-
} catch {
|
|
128
|
-
throw ebuilderValidationError("continuation_invalid", "continuation \u5185\u5BB9\u65E0\u6CD5\u89E3\u6790");
|
|
129
|
-
}
|
|
130
|
-
if (value.operation !== expectedOperation) {
|
|
131
|
-
throw ebuilderValidationError("continuation_mismatch", "continuation \u4E0D\u5C5E\u4E8E\u5F53\u524D\u64CD\u4F5C");
|
|
132
|
-
}
|
|
133
|
-
if (!Number.isSafeInteger(value.expiresAt) || value.expiresAt < Date.now()) {
|
|
134
|
-
throw ebuilderValidationError("continuation_expired", "continuation \u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare");
|
|
135
|
-
}
|
|
136
|
-
return value;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
15
|
+
} from "./chunk-D223PTXU.js";
|
|
140
16
|
|
|
141
17
|
// src/shortcuts/ebuilder-form/host.ts
|
|
142
18
|
import { randomUUID } from "node:crypto";
|
|
@@ -300,6 +176,14 @@ function encodeNlistCustomConfig(value) {
|
|
|
300
176
|
output.push(codeFor(current));
|
|
301
177
|
return output.join(",");
|
|
302
178
|
}
|
|
179
|
+
function pickEbuilderDataKey(field) {
|
|
180
|
+
const config = record(field.config);
|
|
181
|
+
const name = stringValue(field.name);
|
|
182
|
+
const id = stringValue(field.id);
|
|
183
|
+
const dataKey = stringValue(config.dataKey);
|
|
184
|
+
if (name && name !== id) return name;
|
|
185
|
+
return dataKey || name;
|
|
186
|
+
}
|
|
303
187
|
function createEbuilderFormHost(ctx) {
|
|
304
188
|
let e10Session = null;
|
|
305
189
|
let sessionContext = null;
|
|
@@ -1256,1021 +1140,11 @@ function cleanPathSegment(value, field) {
|
|
|
1256
1140
|
return text;
|
|
1257
1141
|
}
|
|
1258
1142
|
|
|
1259
|
-
// src/shortcuts/ebuilder-form/manifest.ts
|
|
1260
|
-
var contextProperties = {
|
|
1261
|
-
context: { type: "object", description: "\u5DF2\u89E3\u6790\u7684 eBuilder \u4E0A\u4E0B\u6587\uFF0C\u53EF\u7531 ebuilder-form.context.resolve \u8FD4\u56DE" },
|
|
1262
|
-
menuKeywords: { type: "array", items: { type: "string" }, minItems: 1, maxItems: 5 },
|
|
1263
|
-
menu: { type: "string" },
|
|
1264
|
-
menuId: { type: "string", pattern: "^\\d+$" },
|
|
1265
|
-
url: { type: "string", description: "E10 \u5217\u8868\u9875\u9762 URL\uFF1B\u652F\u6301 /sp/ebdfpage/list\u3001viewport \u548C /ebdapp/view" },
|
|
1266
|
-
appId: { type: "string", pattern: "^\\d+$" },
|
|
1267
|
-
apiPrefix: { type: "string", pattern: "^/api/ebuilder\\d*$" },
|
|
1268
|
-
objId: { type: "string", pattern: "^\\d+$" },
|
|
1269
|
-
listId: { type: "string", pattern: "^\\d+$" },
|
|
1270
|
-
hostPageId: { type: "string", pattern: "^\\d+$" },
|
|
1271
|
-
listKind: { type: "string", enum: ["List", "NList"] },
|
|
1272
|
-
menuUrl: { type: "string" },
|
|
1273
|
-
entryUrl: { type: "string" }
|
|
1274
|
-
};
|
|
1275
|
-
var preparedWriteProperties = {
|
|
1276
|
-
confirm: { const: true },
|
|
1277
|
-
continuation: { type: "string", minLength: 1 }
|
|
1278
|
-
};
|
|
1279
|
-
function schema(properties, options = {}) {
|
|
1280
|
-
return {
|
|
1281
|
-
type: "object",
|
|
1282
|
-
additionalProperties: false,
|
|
1283
|
-
properties,
|
|
1284
|
-
...options.required?.length ? { required: options.required } : {},
|
|
1285
|
-
...options.anyOf ? { anyOf: options.anyOf } : {},
|
|
1286
|
-
...options.oneOf ? { oneOf: options.oneOf } : {},
|
|
1287
|
-
...options.description ? { description: options.description } : {}
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
var ebuilderFormOperations = [
|
|
1291
|
-
{
|
|
1292
|
-
name: "ebuilder-form.menu.search",
|
|
1293
|
-
summary: "\u6309\u4E1A\u52A1\u5173\u952E\u8BCD\u67E5\u8BE2\u5F53\u524D\u8D26\u53F7\u6709\u6743\u9650\u8BBF\u95EE\u7684 eBuilder \u8868\u683C/\u6570\u636E\u5217\u8868\u83DC\u5355",
|
|
1294
|
-
risk: "read",
|
|
1295
|
-
inputSchema: schema({
|
|
1296
|
-
menuKeywords: { type: "array", items: { type: "string" }, minItems: 1, maxItems: 5 }
|
|
1297
|
-
}, { required: ["menuKeywords"] })
|
|
1298
|
-
},
|
|
1299
|
-
{
|
|
1300
|
-
name: "ebuilder-form.context.resolve",
|
|
1301
|
-
summary: "\u4ECE\u83DC\u5355\u5173\u952E\u8BCD\u3001\u9875\u9762 URL\u3001objId \u6216\u73B0\u6709 context \u89E3\u6790 appId\u3001apiPrefix\u3001listId\u3001objId \u548C\u9875\u9762\u5730\u5740\u4E0A\u4E0B\u6587",
|
|
1302
|
-
risk: "read",
|
|
1303
|
-
inputSchema: schema(contextProperties, {
|
|
1304
|
-
anyOf: [
|
|
1305
|
-
{ required: ["context"] },
|
|
1306
|
-
{ required: ["url"] },
|
|
1307
|
-
{ required: ["menuKeywords"] },
|
|
1308
|
-
{ required: ["menu"] },
|
|
1309
|
-
{ required: ["objId"] },
|
|
1310
|
-
{ required: ["listId", "appId", "listKind"] }
|
|
1311
|
-
]
|
|
1312
|
-
})
|
|
1313
|
-
},
|
|
1314
|
-
{
|
|
1315
|
-
name: "ebuilder-form.views.list",
|
|
1316
|
-
summary: "\u679A\u4E3E\u67D0\u4E2A\u8868\u5355\u5BF9\u8C61\u4E0B\u7684 List/NList \u89C6\u56FE",
|
|
1317
|
-
risk: "read",
|
|
1318
|
-
inputSchema: schema(contextProperties, { required: ["objId"] })
|
|
1319
|
-
},
|
|
1320
|
-
{
|
|
1321
|
-
name: "ebuilder-form.list.config",
|
|
1322
|
-
summary: "\u8BFB\u53D6\u4F20\u7EDF\u8868\u683C List \u7684\u57FA\u7840\u8BBE\u7F6E\u3001\u663E\u793A\u5217\u3001\u6392\u5E8F\u3001\u641C\u7D22\u3001\u7EDF\u8BA1\u548C\u56FA\u5B9A\u6761\u4EF6\u914D\u7F6E",
|
|
1323
|
-
risk: "read",
|
|
1324
|
-
inputSchema: schema(contextProperties, {
|
|
1325
|
-
anyOf: [{ required: ["context"] }, { required: ["listId", "appId"] }, { required: ["menuKeywords"] }, { required: ["url"] }]
|
|
1326
|
-
})
|
|
1327
|
-
},
|
|
1328
|
-
{
|
|
1329
|
-
name: "ebuilder-form.list.query",
|
|
1330
|
-
summary: "\u6309 List \u8FD0\u884C\u65F6\u63A5\u53E3\u67E5\u8BE2\u5206\u9875\u6570\u636E\u548C\u771F\u5B9E\u603B\u6570\uFF0C\u4FDD\u7559\u660E\u7EC6\u5C55\u5F00\u91CD\u590D\u884C",
|
|
1331
|
-
risk: "read",
|
|
1332
|
-
inputSchema: schema({
|
|
1333
|
-
...contextProperties,
|
|
1334
|
-
pageNo: { type: "integer", minimum: 1, default: 1 },
|
|
1335
|
-
pageSize: { type: "integer", minimum: 1, maximum: 200 },
|
|
1336
|
-
allPages: { type: "boolean", default: false },
|
|
1337
|
-
tableuid: { type: "string" },
|
|
1338
|
-
searchParamData: { type: "object" },
|
|
1339
|
-
filterCondition: { type: "object" },
|
|
1340
|
-
orderParams: { type: "array" },
|
|
1341
|
-
passid: { type: "string" },
|
|
1342
|
-
cid: { type: "string" }
|
|
1343
|
-
})
|
|
1344
|
-
},
|
|
1345
|
-
{
|
|
1346
|
-
name: "ebuilder-form.nlist.config",
|
|
1347
|
-
summary: "\u8BFB\u53D6\u6570\u636E\u5217\u8868 NList \u7684\u9875\u9762\u3001\u7EC4\u4EF6\u4E0E comps[1].config \u8FD0\u884C\u65F6\u914D\u7F6E",
|
|
1348
|
-
risk: "read",
|
|
1349
|
-
inputSchema: schema(contextProperties, {
|
|
1350
|
-
anyOf: [{ required: ["context"] }, { required: ["hostPageId", "appId"] }, { required: ["menuKeywords"] }, { required: ["url"] }]
|
|
1351
|
-
})
|
|
1352
|
-
},
|
|
1353
|
-
{
|
|
1354
|
-
name: "ebuilder-form.nlist.query",
|
|
1355
|
-
summary: "\u6309 NList eblist \u8FD0\u884C\u65F6\u63A5\u53E3\u67E5\u8BE2\u5206\u9875\u6570\u636E\u548C\u771F\u5B9E\u603B\u6570\uFF0C\u4F7F\u7528 customConfig LZW \u6570\u5B57\u4E32\u7F16\u7801",
|
|
1356
|
-
risk: "read",
|
|
1357
|
-
inputSchema: schema({
|
|
1358
|
-
...contextProperties,
|
|
1359
|
-
pageNo: { type: "integer", minimum: 1, default: 1 },
|
|
1360
|
-
pageSize: { type: "integer", minimum: 1, maximum: 200 },
|
|
1361
|
-
allPages: { type: "boolean", default: false },
|
|
1362
|
-
compId: { type: "string" },
|
|
1363
|
-
tableuid: { type: "string" },
|
|
1364
|
-
filter: {},
|
|
1365
|
-
fieldFilter: {},
|
|
1366
|
-
pageFilter: {},
|
|
1367
|
-
customConfig: { type: "object" },
|
|
1368
|
-
refPluginPackageId: { type: "string" }
|
|
1369
|
-
})
|
|
1370
|
-
},
|
|
1371
|
-
{
|
|
1372
|
-
name: "ebuilder-form.fields.get",
|
|
1373
|
-
summary: "\u8BFB\u53D6 eBuilder \u5B57\u6BB5\u5B9A\u4E49\uFF0C\u8FD4\u56DE\u4E3B\u8868\u4E0E\u660E\u7EC6\u8868\u5B57\u6BB5\u3001config.dataKey\u3001browserParams \u548C\u7EC4\u4EF6\u7C7B\u578B",
|
|
1374
|
-
risk: "read",
|
|
1375
|
-
fixed: { path: "/api/ebuilder/common/ds/fields" },
|
|
1376
|
-
inputSchema: schema({
|
|
1377
|
-
...contextProperties,
|
|
1378
|
-
groupId: { type: "string" },
|
|
1379
|
-
sourceId: { type: "string" },
|
|
1380
|
-
sourceType: { type: "string", default: "FORM" },
|
|
1381
|
-
detailFieldsGroup: { type: ["boolean", "string"], default: true },
|
|
1382
|
-
enableMerge: { type: ["boolean", "string"], default: true },
|
|
1383
|
-
customParam: {},
|
|
1384
|
-
params: {}
|
|
1385
|
-
})
|
|
1386
|
-
},
|
|
1387
|
-
{
|
|
1388
|
-
name: "ebuilder-form.options.get",
|
|
1389
|
-
summary: "\u6309\u5B57\u6BB5\u5143\u6570\u636E ID \u8BFB\u53D6\u9009\u62E9\u7C7B\u5B57\u6BB5\u9009\u9879",
|
|
1390
|
-
risk: "read",
|
|
1391
|
-
fixed: { path: "/api/ebuilder/common/ds/options" },
|
|
1392
|
-
inputSchema: schema({
|
|
1393
|
-
...contextProperties,
|
|
1394
|
-
fieldName: { type: "string", pattern: "^\\d+$" },
|
|
1395
|
-
fieldId: { type: "string", pattern: "^\\d+$" },
|
|
1396
|
-
sourceType: { type: "string", default: "FORM" },
|
|
1397
|
-
groupId: { type: "string" },
|
|
1398
|
-
optionLevel: { type: ["integer", "string"], default: 1 }
|
|
1399
|
-
}, {
|
|
1400
|
-
anyOf: [{ required: ["fieldName"] }, { required: ["fieldId"] }]
|
|
1401
|
-
})
|
|
1402
|
-
},
|
|
1403
|
-
{
|
|
1404
|
-
name: "ebuilder-form.mapping.get",
|
|
1405
|
-
summary: "\u8BFB\u53D6 objId \u7684 mainTable/detailN \u4E0E\u4E3B\u8868/\u660E\u7EC6\u8868\u6807\u8BC6\u6620\u5C04",
|
|
1406
|
-
risk: "read",
|
|
1407
|
-
fixed: { path: "/api/ebuilder/form/dataset/v1/getTableMapping" },
|
|
1408
|
-
inputSchema: schema({
|
|
1409
|
-
...contextProperties,
|
|
1410
|
-
reverse: { type: "boolean", default: false }
|
|
1411
|
-
}, { required: ["objId"] })
|
|
1412
|
-
},
|
|
1413
|
-
{
|
|
1414
|
-
name: "ebuilder-form.browser.resolve",
|
|
1415
|
-
summary: "\u8C03\u7528\u5B57\u6BB5\u914D\u7F6E\u6216\u5DF2\u77E5\u6A21\u5757\u5BF9\u5E94\u7684\u901A\u7528\u6D4F\u89C8 complete \u63A5\u53E3\uFF0C\u5C06\u540D\u79F0\u89E3\u6790\u4E3A\u53EF\u9009\u9879 ID",
|
|
1416
|
-
risk: "read",
|
|
1417
|
-
inputSchema: schema({
|
|
1418
|
-
module: { type: "string", description: "\u6D4F\u89C8\u63A5\u53E3\u6A21\u5757\uFF0C\u4F8B\u5982 hrm\u3001workflow/core\u3001doc\u3001task" },
|
|
1419
|
-
browserType: { type: "string", description: "\u6D4F\u89C8\u7C7B\u578B\uFF0C\u4F8B\u5982 resource\u3001department\u3001wfcRequest" },
|
|
1420
|
-
query: { type: "string", minLength: 1 },
|
|
1421
|
-
multiple: { type: "boolean", default: false },
|
|
1422
|
-
limit: { type: "integer", minimum: 1, maximum: 50, default: 20 },
|
|
1423
|
-
extra: { type: "object" }
|
|
1424
|
-
}, { required: ["module", "browserType", "query"] })
|
|
1425
|
-
},
|
|
1426
|
-
{
|
|
1427
|
-
name: "ebuilder-form.openapi.detail",
|
|
1428
|
-
summary: "OpenAPI getDataById \u83B7\u53D6\u5355\u6761\u8868\u5355\u6570\u636E\u8BE6\u60C5",
|
|
1429
|
-
risk: "read",
|
|
1430
|
-
fixed: { path: "/api/ebuilder/form/dataset/v2/getDataById" },
|
|
1431
|
-
inputSchema: schema({
|
|
1432
|
-
...contextProperties,
|
|
1433
|
-
dataId: { type: "string", pattern: "^\\d+$" },
|
|
1434
|
-
isReturnDetail: { type: ["boolean", "string"], default: "y" },
|
|
1435
|
-
fieldNoFindIgnore: { type: ["boolean", "string"], default: "false" }
|
|
1436
|
-
}, { required: ["objId", "dataId"] })
|
|
1437
|
-
},
|
|
1438
|
-
{
|
|
1439
|
-
name: "ebuilder-form.openapi.query",
|
|
1440
|
-
summary: "OpenAPI getAllData \u8868\u5355\u7EA7\u5206\u9875\u67E5\u8BE2",
|
|
1441
|
-
risk: "read",
|
|
1442
|
-
fixed: { path: "/api/ebuilder/form/dataset/v2/getAllData" },
|
|
1443
|
-
inputSchema: schema({
|
|
1444
|
-
...contextProperties,
|
|
1445
|
-
mainTable: { type: "object" },
|
|
1446
|
-
pageNo: { type: "integer", minimum: 1, default: 1 },
|
|
1447
|
-
pageSize: { type: "integer", minimum: 1, maximum: 1e3, default: 10 },
|
|
1448
|
-
isReturnDetail: { type: ["boolean", "string"], default: "n" },
|
|
1449
|
-
fieldNoFindIgnore: { type: ["boolean", "string"], default: "false" }
|
|
1450
|
-
}, { required: ["objId"] })
|
|
1451
|
-
},
|
|
1452
|
-
{
|
|
1453
|
-
name: "ebuilder-form.openapi.count",
|
|
1454
|
-
summary: "OpenAPI getAllDataCount \u8868\u5355\u7EA7\u603B\u6570\u67E5\u8BE2",
|
|
1455
|
-
risk: "read",
|
|
1456
|
-
fixed: { path: "/api/ebuilder/form/dataset/v2/getAllDataCount" },
|
|
1457
|
-
inputSchema: schema({
|
|
1458
|
-
...contextProperties,
|
|
1459
|
-
mainTable: { type: "object" },
|
|
1460
|
-
fieldNoFindIgnore: { type: ["boolean", "string"], default: "false" }
|
|
1461
|
-
}, { required: ["objId"] })
|
|
1462
|
-
},
|
|
1463
|
-
{
|
|
1464
|
-
name: "ebuilder-form.openapi.add.prepare",
|
|
1465
|
-
summary: "\u51C6\u5907 OpenAPI saveFormData \u65B0\u589E\u8BF7\u6C42\uFF0C\u7B7E\u53D1 continuation\uFF0C\u4E0D\u5199\u5165",
|
|
1466
|
-
risk: "read-before-write",
|
|
1467
|
-
inputSchema: schema({
|
|
1468
|
-
...contextProperties,
|
|
1469
|
-
datas: { type: "array", minItems: 1 },
|
|
1470
|
-
operationinfo: { type: "object" }
|
|
1471
|
-
}, { required: ["objId", "datas"] })
|
|
1472
|
-
},
|
|
1473
|
-
{
|
|
1474
|
-
name: "ebuilder-form.openapi.add.apply",
|
|
1475
|
-
summary: "\u786E\u8BA4\u540E\u6267\u884C OpenAPI saveFormData \u65B0\u589E\u8BF7\u6C42",
|
|
1476
|
-
risk: "high-risk-write",
|
|
1477
|
-
inputSchema: schema(preparedWriteProperties, { required: ["confirm", "continuation"] })
|
|
1478
|
-
},
|
|
1479
|
-
{
|
|
1480
|
-
name: "ebuilder-form.openapi.update.prepare",
|
|
1481
|
-
summary: "\u51C6\u5907 OpenAPI updateFormData \u4FEE\u6539\u8BF7\u6C42\uFF0C\u7B7E\u53D1 continuation\uFF0C\u4E0D\u5199\u5165",
|
|
1482
|
-
risk: "read-before-write",
|
|
1483
|
-
inputSchema: schema({
|
|
1484
|
-
...contextProperties,
|
|
1485
|
-
datas: { type: "array", minItems: 1 },
|
|
1486
|
-
operationinfo: { type: "object" }
|
|
1487
|
-
}, { required: ["objId", "datas"] })
|
|
1488
|
-
},
|
|
1489
|
-
{
|
|
1490
|
-
name: "ebuilder-form.openapi.update.apply",
|
|
1491
|
-
summary: "\u786E\u8BA4\u540E\u6267\u884C OpenAPI updateFormData \u4FEE\u6539\u8BF7\u6C42",
|
|
1492
|
-
risk: "high-risk-write",
|
|
1493
|
-
inputSchema: schema(preparedWriteProperties, { required: ["confirm", "continuation"] })
|
|
1494
|
-
},
|
|
1495
|
-
{
|
|
1496
|
-
name: "ebuilder-form.openapi.delete.prepare",
|
|
1497
|
-
summary: "\u51C6\u5907 OpenAPI deleteData \u5220\u9664\u8BF7\u6C42\uFF0C\u7B7E\u53D1 continuation\uFF0C\u4E0D\u5199\u5165",
|
|
1498
|
-
risk: "read-before-write",
|
|
1499
|
-
inputSchema: schema({
|
|
1500
|
-
...contextProperties,
|
|
1501
|
-
mainTable: { type: "object", description: '\u5220\u9664\u6761\u4EF6\uFF1B\u6309\u6570\u636E ID \u5220\u9664\u65F6\u4F20 {"id":"..."}' },
|
|
1502
|
-
dataId: { type: "string", pattern: "^\\d+$" },
|
|
1503
|
-
operationinfo: { type: "object" }
|
|
1504
|
-
}, {
|
|
1505
|
-
required: ["objId"],
|
|
1506
|
-
anyOf: [{ required: ["dataId"] }, { required: ["mainTable"] }]
|
|
1507
|
-
})
|
|
1508
|
-
},
|
|
1509
|
-
{
|
|
1510
|
-
name: "ebuilder-form.openapi.delete.apply",
|
|
1511
|
-
summary: "\u786E\u8BA4\u540E\u6267\u884C OpenAPI deleteData \u5220\u9664\u8BF7\u6C42",
|
|
1512
|
-
risk: "high-risk-write",
|
|
1513
|
-
inputSchema: schema(preparedWriteProperties, { required: ["confirm", "continuation"] })
|
|
1514
|
-
},
|
|
1515
|
-
{
|
|
1516
|
-
name: "ebuilder-form.custom.detail",
|
|
1517
|
-
summary: "\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 getFormDataByPk \u6839\u636E\u4E3B\u952E\u67E5\u8BE2\u8BE6\u60C5",
|
|
1518
|
-
risk: "read",
|
|
1519
|
-
fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataByPk/{interfacePk}" },
|
|
1520
|
-
inputSchema: schema({
|
|
1521
|
-
...contextProperties,
|
|
1522
|
-
interfacePk: { type: "string", minLength: 1 },
|
|
1523
|
-
dataId: { type: "string", pattern: "^\\d+$" }
|
|
1524
|
-
}, { required: ["interfacePk", "dataId"] })
|
|
1525
|
-
},
|
|
1526
|
-
{
|
|
1527
|
-
name: "ebuilder-form.custom.query",
|
|
1528
|
-
summary: "\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 getFormDataList \u5206\u9875\u67E5\u8BE2",
|
|
1529
|
-
risk: "read",
|
|
1530
|
-
fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataList/{interfacePk}" },
|
|
1531
|
-
inputSchema: schema({
|
|
1532
|
-
...contextProperties,
|
|
1533
|
-
interfacePk: { type: "string", minLength: 1 },
|
|
1534
|
-
mainTable: { type: "object" },
|
|
1535
|
-
pageNo: { type: "integer", minimum: 1, default: 1 },
|
|
1536
|
-
pageSize: { type: "integer", minimum: 1, maximum: 1e3, default: 10 }
|
|
1537
|
-
}, { required: ["interfacePk"] })
|
|
1538
|
-
},
|
|
1539
|
-
{
|
|
1540
|
-
name: "ebuilder-form.custom.count",
|
|
1541
|
-
summary: "\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 getFormDataCount \u67E5\u8BE2\u603B\u6570",
|
|
1542
|
-
risk: "read",
|
|
1543
|
-
fixed: { path: "/api/ebuilder/form/formdata/v2/getFormDataCount/{interfacePk}" },
|
|
1544
|
-
inputSchema: schema({
|
|
1545
|
-
...contextProperties,
|
|
1546
|
-
interfacePk: { type: "string", minLength: 1 },
|
|
1547
|
-
mainTable: { type: "object" }
|
|
1548
|
-
}, { required: ["interfacePk"] })
|
|
1549
|
-
},
|
|
1550
|
-
{
|
|
1551
|
-
name: "ebuilder-form.custom.add.prepare",
|
|
1552
|
-
summary: "\u51C6\u5907\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 saveFormData \u65B0\u589E\u8BF7\u6C42\uFF0C\u7B7E\u53D1 continuation",
|
|
1553
|
-
risk: "read-before-write",
|
|
1554
|
-
inputSchema: schema({
|
|
1555
|
-
...contextProperties,
|
|
1556
|
-
interfacePk: { type: "string", minLength: 1 },
|
|
1557
|
-
datas: { type: "array", minItems: 1 },
|
|
1558
|
-
operationinfo: { type: "object" }
|
|
1559
|
-
}, { required: ["interfacePk", "datas"] })
|
|
1560
|
-
},
|
|
1561
|
-
{
|
|
1562
|
-
name: "ebuilder-form.custom.add.apply",
|
|
1563
|
-
summary: "\u786E\u8BA4\u540E\u6267\u884C\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 saveFormData \u65B0\u589E\u8BF7\u6C42",
|
|
1564
|
-
risk: "high-risk-write",
|
|
1565
|
-
inputSchema: schema(preparedWriteProperties, { required: ["confirm", "continuation"] })
|
|
1566
|
-
},
|
|
1567
|
-
{
|
|
1568
|
-
name: "ebuilder-form.custom.update.prepare",
|
|
1569
|
-
summary: "\u51C6\u5907\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 updateFormData \u4FEE\u6539\u8BF7\u6C42\uFF0C\u7B7E\u53D1 continuation",
|
|
1570
|
-
risk: "read-before-write",
|
|
1571
|
-
inputSchema: schema({
|
|
1572
|
-
...contextProperties,
|
|
1573
|
-
interfacePk: { type: "string", minLength: 1 },
|
|
1574
|
-
datas: { type: "array", minItems: 1 },
|
|
1575
|
-
operationinfo: { type: "object" }
|
|
1576
|
-
}, { required: ["interfacePk", "datas"] })
|
|
1577
|
-
},
|
|
1578
|
-
{
|
|
1579
|
-
name: "ebuilder-form.custom.update.apply",
|
|
1580
|
-
summary: "\u786E\u8BA4\u540E\u6267\u884C\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 updateFormData \u4FEE\u6539\u8BF7\u6C42",
|
|
1581
|
-
risk: "high-risk-write",
|
|
1582
|
-
inputSchema: schema(preparedWriteProperties, { required: ["confirm", "continuation"] })
|
|
1583
|
-
},
|
|
1584
|
-
{
|
|
1585
|
-
name: "ebuilder-form.custom.delete.prepare",
|
|
1586
|
-
summary: "\u51C6\u5907\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 deleteFormData \u5220\u9664\u8BF7\u6C42\uFF0C\u7B7E\u53D1 continuation",
|
|
1587
|
-
risk: "read-before-write",
|
|
1588
|
-
inputSchema: schema({
|
|
1589
|
-
...contextProperties,
|
|
1590
|
-
interfacePk: { type: "string", minLength: 1 },
|
|
1591
|
-
dataIds: { type: "array", items: { type: "string", pattern: "^\\d+$" }, minItems: 1 },
|
|
1592
|
-
operationinfo: { type: "object" }
|
|
1593
|
-
}, { required: ["interfacePk", "dataIds"] })
|
|
1594
|
-
},
|
|
1595
|
-
{
|
|
1596
|
-
name: "ebuilder-form.custom.delete.apply",
|
|
1597
|
-
summary: "\u786E\u8BA4\u540E\u6267\u884C\u5DF2\u53D1\u5E03\u81EA\u5B9A\u4E49\u63A5\u53E3 deleteFormData \u5220\u9664\u8BF7\u6C42",
|
|
1598
|
-
risk: "high-risk-write",
|
|
1599
|
-
inputSchema: schema(preparedWriteProperties, { required: ["confirm", "continuation"] })
|
|
1600
|
-
}
|
|
1601
|
-
];
|
|
1602
|
-
var ebuilderFormManifest = {
|
|
1603
|
-
module: "ebuilder-form",
|
|
1604
|
-
version: 1,
|
|
1605
|
-
operations: ebuilderFormOperations
|
|
1606
|
-
};
|
|
1607
|
-
|
|
1608
|
-
// src/shortcuts/ebuilder-form/operations/types.ts
|
|
1609
|
-
function ebuilderSuccess(action, data, meta, warnings = []) {
|
|
1610
|
-
const payload = { ok: true, action, data };
|
|
1611
|
-
if (meta && Object.keys(meta).length > 0) payload.meta = meta;
|
|
1612
|
-
if (warnings.length > 0) payload.warnings = warnings;
|
|
1613
|
-
return payload;
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
// src/shortcuts/ebuilder-form/operations/shared.ts
|
|
1617
|
-
var FORBIDDEN_KEYS = /* @__PURE__ */ new Set([
|
|
1618
|
-
"__proto__",
|
|
1619
|
-
"constructor",
|
|
1620
|
-
"prototype",
|
|
1621
|
-
"access_token",
|
|
1622
|
-
"app_key",
|
|
1623
|
-
"app_secret",
|
|
1624
|
-
"authorization",
|
|
1625
|
-
"cookie",
|
|
1626
|
-
"eteamsid",
|
|
1627
|
-
"sedit",
|
|
1628
|
-
"token"
|
|
1629
|
-
]);
|
|
1630
|
-
function asObject(value, field = "input") {
|
|
1631
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1632
|
-
throw ebuilderValidationError("input_not_object", `${field} \u5FC5\u987B\u662F JSON \u5BF9\u8C61`);
|
|
1633
|
-
}
|
|
1634
|
-
return value;
|
|
1635
|
-
}
|
|
1636
|
-
function optionalObject(value, field) {
|
|
1637
|
-
if (value === void 0 || value === null) return void 0;
|
|
1638
|
-
return asObject(value, field);
|
|
1639
|
-
}
|
|
1640
|
-
function requiredArray(value, field) {
|
|
1641
|
-
if (!Array.isArray(value)) throw ebuilderValidationError("field_invalid", `${field} \u5FC5\u987B\u662F\u6570\u7EC4`);
|
|
1642
|
-
return value;
|
|
1643
|
-
}
|
|
1644
|
-
function optionalArray(value, field) {
|
|
1645
|
-
if (value === void 0 || value === null) return void 0;
|
|
1646
|
-
return requiredArray(value, field);
|
|
1647
|
-
}
|
|
1648
|
-
function requiredString(value, field) {
|
|
1649
|
-
if (value === void 0 || value === null || value === "") {
|
|
1650
|
-
throw ebuilderValidationError("field_required", `${field} \u5FC5\u586B`);
|
|
1651
|
-
}
|
|
1652
|
-
if (typeof value === "object") throw ebuilderValidationError("field_invalid", `${field} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
|
|
1653
|
-
return String(value);
|
|
1654
|
-
}
|
|
1655
|
-
function optionalString(value, field) {
|
|
1656
|
-
if (value === void 0 || value === null || value === "") return void 0;
|
|
1657
|
-
if (typeof value === "object") throw ebuilderValidationError("field_invalid", `${field} \u5FC5\u987B\u662F\u5B57\u7B26\u4E32`);
|
|
1658
|
-
return String(value);
|
|
1659
|
-
}
|
|
1660
|
-
function assertKnownKeys(input, allowed, operation) {
|
|
1661
|
-
const unknown = Object.keys(input).filter((key) => !allowed.includes(key));
|
|
1662
|
-
if (unknown.length > 0) {
|
|
1663
|
-
throw ebuilderValidationError("unknown_field", `${operation} \u4E0D\u652F\u6301\u5B57\u6BB5\uFF1A${unknown.join("\u3001")}`, { unknown });
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
function assertNoForbiddenKeys(value, location = "input") {
|
|
1667
|
-
if (!value || typeof value !== "object") return;
|
|
1668
|
-
if (Array.isArray(value)) {
|
|
1669
|
-
value.forEach((item, index) => assertNoForbiddenKeys(item, `${location}[${index}]`));
|
|
1670
|
-
return;
|
|
1671
|
-
}
|
|
1672
|
-
for (const [key, child] of Object.entries(value)) {
|
|
1673
|
-
if (FORBIDDEN_KEYS.has(key) || FORBIDDEN_KEYS.has(key.toLowerCase())) {
|
|
1674
|
-
throw ebuilderValidationError("field_forbidden", `\u7981\u6B62\u4E1A\u52A1\u8F93\u5165\u5B57\u6BB5\uFF1A${location}.${key}`);
|
|
1675
|
-
}
|
|
1676
|
-
assertNoForbiddenKeys(child, `${location}.${key}`);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
function compactJson(value) {
|
|
1680
|
-
return JSON.stringify(value);
|
|
1681
|
-
}
|
|
1682
|
-
function sha256VisibleFingerprint(value) {
|
|
1683
|
-
const json = compactJson(value);
|
|
1684
|
-
let hash = 0;
|
|
1685
|
-
for (let index = 0; index < json.length; index += 1) {
|
|
1686
|
-
hash = (hash << 5) - hash + json.charCodeAt(index) | 0;
|
|
1687
|
-
}
|
|
1688
|
-
return `len:${json.length}:h:${(hash >>> 0).toString(16)}`;
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
// src/shortcuts/ebuilder-form/operations/read.ts
|
|
1692
|
-
var CONTEXT_KEYS = [
|
|
1693
|
-
"context",
|
|
1694
|
-
"menuKeywords",
|
|
1695
|
-
"menu",
|
|
1696
|
-
"menuId",
|
|
1697
|
-
"url",
|
|
1698
|
-
"appId",
|
|
1699
|
-
"apiPrefix",
|
|
1700
|
-
"objId",
|
|
1701
|
-
"listId",
|
|
1702
|
-
"hostPageId",
|
|
1703
|
-
"listKind",
|
|
1704
|
-
"menuUrl",
|
|
1705
|
-
"entryUrl"
|
|
1706
|
-
];
|
|
1707
|
-
var EbuilderMenuSearchOperation = class {
|
|
1708
|
-
name = "ebuilder-form.menu.search";
|
|
1709
|
-
async execute(input, { host }) {
|
|
1710
|
-
assertKnownKeys(input, ["menuKeywords"], this.name);
|
|
1711
|
-
const keywords = requiredArray(input.menuKeywords, "menuKeywords").map((item) => String(item));
|
|
1712
|
-
const menus = await host.searchMenus(keywords);
|
|
1713
|
-
return ebuilderSuccess(this.name, { menus, count: menus.length }, { status: "COMPLETE" });
|
|
1714
|
-
}
|
|
1715
|
-
};
|
|
1716
|
-
var EbuilderContextResolveOperation = class {
|
|
1717
|
-
name = "ebuilder-form.context.resolve";
|
|
1718
|
-
async execute(input, { host }) {
|
|
1719
|
-
const context = await host.resolveContext(input);
|
|
1720
|
-
return ebuilderSuccess(this.name, {
|
|
1721
|
-
context,
|
|
1722
|
-
listUrl: host.buildListUrl(context)
|
|
1723
|
-
}, { status: "COMPLETE" });
|
|
1724
|
-
}
|
|
1725
|
-
};
|
|
1726
|
-
var EbuilderViewsListOperation = class {
|
|
1727
|
-
name = "ebuilder-form.views.list";
|
|
1728
|
-
async execute(input, { host }) {
|
|
1729
|
-
const result = await host.formViews(input);
|
|
1730
|
-
return ebuilderSuccess(this.name, result, { status: "COMPLETE" });
|
|
1731
|
-
}
|
|
1732
|
-
};
|
|
1733
|
-
var EbuilderListConfigOperation = class {
|
|
1734
|
-
name = "ebuilder-form.list.config";
|
|
1735
|
-
async execute(input, { host }) {
|
|
1736
|
-
const context = await host.resolveContext({ ...input, listKind: input.listKind || input.context?.listKind || "List" });
|
|
1737
|
-
const result = await host.listConfig(context, this.name);
|
|
1738
|
-
return ebuilderSuccess(this.name, result, { status: "COMPLETE" });
|
|
1739
|
-
}
|
|
1740
|
-
};
|
|
1741
|
-
var EbuilderListQueryOperation = class {
|
|
1742
|
-
name = "ebuilder-form.list.query";
|
|
1743
|
-
async execute(input, { host }) {
|
|
1744
|
-
const result = await host.listQuery(input, this.name);
|
|
1745
|
-
return ebuilderSuccess(this.name, result, { status: "COMPLETE" });
|
|
1746
|
-
}
|
|
1747
|
-
};
|
|
1748
|
-
var EbuilderNlistConfigOperation = class {
|
|
1749
|
-
name = "ebuilder-form.nlist.config";
|
|
1750
|
-
async execute(input, { host }) {
|
|
1751
|
-
const context = await host.resolveContext({ ...input, listKind: input.listKind || input.context?.listKind || "NList" });
|
|
1752
|
-
const result = await host.nlistConfig(context, this.name);
|
|
1753
|
-
return ebuilderSuccess(this.name, result, { status: "COMPLETE" });
|
|
1754
|
-
}
|
|
1755
|
-
};
|
|
1756
|
-
var EbuilderNlistQueryOperation = class {
|
|
1757
|
-
name = "ebuilder-form.nlist.query";
|
|
1758
|
-
async execute(input, { host }) {
|
|
1759
|
-
const result = await host.nlistQuery(input, this.name);
|
|
1760
|
-
return ebuilderSuccess(this.name, result, { status: "COMPLETE" });
|
|
1761
|
-
}
|
|
1762
|
-
};
|
|
1763
|
-
var EbuilderFieldsGetOperation = class {
|
|
1764
|
-
name = "ebuilder-form.fields.get";
|
|
1765
|
-
async execute(input, { host }) {
|
|
1766
|
-
const result = await host.fields(input, this.name);
|
|
1767
|
-
return ebuilderSuccess(this.name, { result }, { status: "COMPLETE" });
|
|
1768
|
-
}
|
|
1769
|
-
};
|
|
1770
|
-
var EbuilderOptionsGetOperation = class {
|
|
1771
|
-
name = "ebuilder-form.options.get";
|
|
1772
|
-
async execute(input, { host }) {
|
|
1773
|
-
const result = await host.options(input, this.name);
|
|
1774
|
-
return ebuilderSuccess(this.name, { result }, { status: "COMPLETE" });
|
|
1775
|
-
}
|
|
1776
|
-
};
|
|
1777
|
-
var EbuilderMappingGetOperation = class {
|
|
1778
|
-
name = "ebuilder-form.mapping.get";
|
|
1779
|
-
async execute(input, { host }) {
|
|
1780
|
-
const result = await host.mapping(input, this.name);
|
|
1781
|
-
return ebuilderSuccess(this.name, { result }, { status: "COMPLETE" });
|
|
1782
|
-
}
|
|
1783
|
-
};
|
|
1784
|
-
var EbuilderBrowserResolveOperation = class {
|
|
1785
|
-
name = "ebuilder-form.browser.resolve";
|
|
1786
|
-
async execute(input, { host }) {
|
|
1787
|
-
assertKnownKeys(input, ["module", "browserType", "query", "multiple", "limit", "extra"], this.name);
|
|
1788
|
-
const result = await host.browserResolve(input, this.name);
|
|
1789
|
-
return ebuilderSuccess(this.name, result, { status: "COMPLETE" });
|
|
1790
|
-
}
|
|
1791
|
-
};
|
|
1792
|
-
var EbuilderOpenapiReadOperation = class {
|
|
1793
|
-
constructor(endpoint) {
|
|
1794
|
-
this.endpoint = endpoint;
|
|
1795
|
-
this.name = `ebuilder-form.openapi.${endpoint}`;
|
|
1796
|
-
}
|
|
1797
|
-
endpoint;
|
|
1798
|
-
name;
|
|
1799
|
-
async execute(input, { host }) {
|
|
1800
|
-
const allowed = [
|
|
1801
|
-
...CONTEXT_KEYS,
|
|
1802
|
-
"dataId",
|
|
1803
|
-
"mainTable",
|
|
1804
|
-
"pageNo",
|
|
1805
|
-
"pageSize",
|
|
1806
|
-
"isReturnDetail",
|
|
1807
|
-
"fieldNoFindIgnore"
|
|
1808
|
-
];
|
|
1809
|
-
assertKnownKeys(input, allowed, this.name);
|
|
1810
|
-
const result = await host.openapiRead(this.endpoint, input, this.name);
|
|
1811
|
-
const data = addLinks(result, host, this.endpoint === "detail" ? optionalString(input.dataId, "dataId") : void 0);
|
|
1812
|
-
return ebuilderSuccess(this.name, data, { status: "COMPLETE" });
|
|
1813
|
-
}
|
|
1814
|
-
};
|
|
1815
|
-
var EbuilderCustomReadOperation = class {
|
|
1816
|
-
constructor(endpoint) {
|
|
1817
|
-
this.endpoint = endpoint;
|
|
1818
|
-
this.name = `ebuilder-form.custom.${endpoint}`;
|
|
1819
|
-
}
|
|
1820
|
-
endpoint;
|
|
1821
|
-
name;
|
|
1822
|
-
async execute(input, { host }) {
|
|
1823
|
-
const allowed = [
|
|
1824
|
-
...CONTEXT_KEYS,
|
|
1825
|
-
"interfacePk",
|
|
1826
|
-
"dataId",
|
|
1827
|
-
"mainTable",
|
|
1828
|
-
"pageNo",
|
|
1829
|
-
"pageSize"
|
|
1830
|
-
];
|
|
1831
|
-
assertKnownKeys(input, allowed, this.name);
|
|
1832
|
-
const result = await host.customRead(this.endpoint, input, this.name);
|
|
1833
|
-
const data = addLinks(result, host, this.endpoint === "detail" ? optionalString(input.dataId, "dataId") : void 0);
|
|
1834
|
-
return ebuilderSuccess(this.name, data, { status: "COMPLETE" });
|
|
1835
|
-
}
|
|
1836
|
-
};
|
|
1837
|
-
function addLinks(result, host, dataId) {
|
|
1838
|
-
const context = asObject(result.context || {}, "context");
|
|
1839
|
-
const payload = asObject(result.result || {}, "result");
|
|
1840
|
-
return {
|
|
1841
|
-
context,
|
|
1842
|
-
result: payload,
|
|
1843
|
-
...dataId ? { dataUrl: host.buildDataUrl(context, dataId) } : {},
|
|
1844
|
-
listUrl: host.buildListUrl(context)
|
|
1845
|
-
};
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
// src/shortcuts/ebuilder-form/operations/write.ts
|
|
1849
|
-
var CONTEXT_KEYS2 = [
|
|
1850
|
-
"context",
|
|
1851
|
-
"menuKeywords",
|
|
1852
|
-
"menu",
|
|
1853
|
-
"menuId",
|
|
1854
|
-
"url",
|
|
1855
|
-
"appId",
|
|
1856
|
-
"apiPrefix",
|
|
1857
|
-
"objId",
|
|
1858
|
-
"listId",
|
|
1859
|
-
"hostPageId",
|
|
1860
|
-
"listKind",
|
|
1861
|
-
"menuUrl",
|
|
1862
|
-
"entryUrl"
|
|
1863
|
-
];
|
|
1864
|
-
var EbuilderOpenapiPrepareOperation = class {
|
|
1865
|
-
constructor(endpoint) {
|
|
1866
|
-
this.endpoint = endpoint;
|
|
1867
|
-
this.name = `ebuilder-form.openapi.${endpoint}.prepare`;
|
|
1868
|
-
this.applyName = `ebuilder-form.openapi.${endpoint}.apply`;
|
|
1869
|
-
}
|
|
1870
|
-
endpoint;
|
|
1871
|
-
name;
|
|
1872
|
-
applyName;
|
|
1873
|
-
async execute(input, env) {
|
|
1874
|
-
const allowed = [
|
|
1875
|
-
...CONTEXT_KEYS2,
|
|
1876
|
-
"dataId",
|
|
1877
|
-
"mainTable",
|
|
1878
|
-
"datas",
|
|
1879
|
-
"operationinfo"
|
|
1880
|
-
];
|
|
1881
|
-
assertKnownKeys(input, allowed, this.name);
|
|
1882
|
-
assertNoForbiddenKeys(input);
|
|
1883
|
-
const prepared = await prepareOpenapi(this.endpoint, input, env.host);
|
|
1884
|
-
const session = await env.host.getSession();
|
|
1885
|
-
const continuation = await env.continuation.issue({
|
|
1886
|
-
operation: this.applyName,
|
|
1887
|
-
actor: { userId: session.userId, baseUrl: session.baseUrl, profile: session.profile },
|
|
1888
|
-
kind: "openapi",
|
|
1889
|
-
endpoint: this.endpoint,
|
|
1890
|
-
datajson: { ...prepared.datajson, __context: prepared.context },
|
|
1891
|
-
target: prepared.target,
|
|
1892
|
-
fingerprint: sha256VisibleFingerprint(prepared.datajson)
|
|
1893
|
-
});
|
|
1894
|
-
return ebuilderSuccess(this.name, {
|
|
1895
|
-
context: prepared.context,
|
|
1896
|
-
target: prepared.target,
|
|
1897
|
-
requestPreview: { datajson: prepared.datajson },
|
|
1898
|
-
continuation,
|
|
1899
|
-
expiresInSeconds: 600
|
|
1900
|
-
}, { status: "PREPARED" }, prepared.warnings);
|
|
1901
|
-
}
|
|
1902
|
-
};
|
|
1903
|
-
var EbuilderOpenapiApplyOperation = class {
|
|
1904
|
-
constructor(endpoint) {
|
|
1905
|
-
this.endpoint = endpoint;
|
|
1906
|
-
this.name = `ebuilder-form.openapi.${endpoint}.apply`;
|
|
1907
|
-
}
|
|
1908
|
-
endpoint;
|
|
1909
|
-
name;
|
|
1910
|
-
async execute(input, env) {
|
|
1911
|
-
assertKnownKeys(input, ["confirm", "continuation"], this.name);
|
|
1912
|
-
if (input.confirm !== true) throw ebuilderConfirmationError(this.name);
|
|
1913
|
-
const record2 = await env.continuation.verify(requiredString(input.continuation, "continuation"), this.name);
|
|
1914
|
-
assertContinuation(record2, await env.host.getSession(), "openapi", this.endpoint);
|
|
1915
|
-
const datajson = asObject(record2.datajson, "continuation.datajson");
|
|
1916
|
-
const result = await env.host.openapiWrite(this.endpoint, datajson, this.name);
|
|
1917
|
-
return ebuilderSuccess(this.name, summarizeWriteResult(result, env.host, this.endpoint === "delete"), { status: "COMPLETE" });
|
|
1918
|
-
}
|
|
1919
|
-
};
|
|
1920
|
-
var EbuilderCustomPrepareOperation = class {
|
|
1921
|
-
constructor(endpoint) {
|
|
1922
|
-
this.endpoint = endpoint;
|
|
1923
|
-
this.name = `ebuilder-form.custom.${endpoint}.prepare`;
|
|
1924
|
-
this.applyName = `ebuilder-form.custom.${endpoint}.apply`;
|
|
1925
|
-
}
|
|
1926
|
-
endpoint;
|
|
1927
|
-
name;
|
|
1928
|
-
applyName;
|
|
1929
|
-
async execute(input, env) {
|
|
1930
|
-
const allowed = [
|
|
1931
|
-
...CONTEXT_KEYS2,
|
|
1932
|
-
"interfacePk",
|
|
1933
|
-
"dataIds",
|
|
1934
|
-
"datas",
|
|
1935
|
-
"operationinfo"
|
|
1936
|
-
];
|
|
1937
|
-
assertKnownKeys(input, allowed, this.name);
|
|
1938
|
-
assertNoForbiddenKeys(input);
|
|
1939
|
-
const prepared = await prepareCustom(this.endpoint, input, env.host);
|
|
1940
|
-
const session = await env.host.getSession();
|
|
1941
|
-
const continuation = await env.continuation.issue({
|
|
1942
|
-
operation: this.applyName,
|
|
1943
|
-
actor: { userId: session.userId, baseUrl: session.baseUrl, profile: session.profile },
|
|
1944
|
-
kind: "custom",
|
|
1945
|
-
endpoint: this.endpoint,
|
|
1946
|
-
interfacePk: prepared.interfacePk,
|
|
1947
|
-
datajson: { ...prepared.datajson, __context: prepared.context },
|
|
1948
|
-
target: prepared.target,
|
|
1949
|
-
fingerprint: sha256VisibleFingerprint(prepared.datajson)
|
|
1950
|
-
});
|
|
1951
|
-
return ebuilderSuccess(this.name, {
|
|
1952
|
-
context: prepared.context,
|
|
1953
|
-
interfacePk: prepared.interfacePk,
|
|
1954
|
-
target: prepared.target,
|
|
1955
|
-
requestPreview: { datajson: prepared.datajson },
|
|
1956
|
-
continuation,
|
|
1957
|
-
expiresInSeconds: 600
|
|
1958
|
-
}, { status: "PREPARED" }, prepared.warnings);
|
|
1959
|
-
}
|
|
1960
|
-
};
|
|
1961
|
-
var EbuilderCustomApplyOperation = class {
|
|
1962
|
-
constructor(endpoint) {
|
|
1963
|
-
this.endpoint = endpoint;
|
|
1964
|
-
this.name = `ebuilder-form.custom.${endpoint}.apply`;
|
|
1965
|
-
}
|
|
1966
|
-
endpoint;
|
|
1967
|
-
name;
|
|
1968
|
-
async execute(input, env) {
|
|
1969
|
-
assertKnownKeys(input, ["confirm", "continuation"], this.name);
|
|
1970
|
-
if (input.confirm !== true) throw ebuilderConfirmationError(this.name);
|
|
1971
|
-
const record2 = await env.continuation.verify(requiredString(input.continuation, "continuation"), this.name);
|
|
1972
|
-
assertContinuation(record2, await env.host.getSession(), "custom", this.endpoint);
|
|
1973
|
-
const datajson = asObject(record2.datajson, "continuation.datajson");
|
|
1974
|
-
const interfacePk = requiredString(record2.interfacePk, "continuation.interfacePk");
|
|
1975
|
-
const result = await env.host.customWrite(this.endpoint, interfacePk, datajson, this.name);
|
|
1976
|
-
return ebuilderSuccess(this.name, summarizeWriteResult(result, env.host, this.endpoint === "delete"), { status: "COMPLETE" });
|
|
1977
|
-
}
|
|
1978
|
-
};
|
|
1979
|
-
async function prepareOpenapi(endpoint, input, host) {
|
|
1980
|
-
const context = await host.resolveContext(input);
|
|
1981
|
-
const operationinfo = optionalObject(input.operationinfo, "operationinfo") || {};
|
|
1982
|
-
if (endpoint === "add") {
|
|
1983
|
-
const datas = requiredArray(input.datas, "datas");
|
|
1984
|
-
return {
|
|
1985
|
-
context,
|
|
1986
|
-
datajson: {
|
|
1987
|
-
datas,
|
|
1988
|
-
header: { objId: context.objId },
|
|
1989
|
-
operationinfo: {
|
|
1990
|
-
fieldNoFindIgnore: "false",
|
|
1991
|
-
checkRight: "true",
|
|
1992
|
-
doAction: "false",
|
|
1993
|
-
printCost: "true",
|
|
1994
|
-
...operationinfo
|
|
1995
|
-
}
|
|
1996
|
-
},
|
|
1997
|
-
target: { endpoint, objId: context.objId, count: datas.length },
|
|
1998
|
-
warnings: fieldKeyWarnings(datas)
|
|
1999
|
-
};
|
|
2000
|
-
}
|
|
2001
|
-
if (endpoint === "update") {
|
|
2002
|
-
const datas = requiredArray(input.datas, "datas");
|
|
2003
|
-
return {
|
|
2004
|
-
context,
|
|
2005
|
-
datajson: {
|
|
2006
|
-
datas,
|
|
2007
|
-
header: { objId: context.objId },
|
|
2008
|
-
operationinfo: {
|
|
2009
|
-
updateType: "ids",
|
|
2010
|
-
needAdd: "false",
|
|
2011
|
-
fieldNoFindIgnore: "false",
|
|
2012
|
-
checkRight: "true",
|
|
2013
|
-
doAction: "false",
|
|
2014
|
-
printCost: "true",
|
|
2015
|
-
...operationinfo
|
|
2016
|
-
}
|
|
2017
|
-
},
|
|
2018
|
-
target: { endpoint, objId: context.objId, dataIds: collectDataIds(datas) },
|
|
2019
|
-
warnings: fieldKeyWarnings(datas)
|
|
2020
|
-
};
|
|
2021
|
-
}
|
|
2022
|
-
const mainTable = {
|
|
2023
|
-
...optionalObject(input.mainTable, "mainTable") || {},
|
|
2024
|
-
...input.dataId ? { id: requiredString(input.dataId, "dataId") } : {}
|
|
2025
|
-
};
|
|
2026
|
-
if (Object.keys(mainTable).length === 0) {
|
|
2027
|
-
throw ebuilderValidationError("delete_target_required", "\u5220\u9664\u5FC5\u987B\u63D0\u4F9B dataId \u6216 mainTable \u6761\u4EF6");
|
|
2028
|
-
}
|
|
2029
|
-
return {
|
|
2030
|
-
context,
|
|
2031
|
-
datajson: {
|
|
2032
|
-
header: { objId: context.objId },
|
|
2033
|
-
mainTable,
|
|
2034
|
-
operationinfo: {
|
|
2035
|
-
fieldNoFindIgnore: "false",
|
|
2036
|
-
checkRight: "true",
|
|
2037
|
-
doAction: "false",
|
|
2038
|
-
printCost: "true",
|
|
2039
|
-
...operationinfo
|
|
2040
|
-
}
|
|
2041
|
-
},
|
|
2042
|
-
target: { endpoint, objId: context.objId, mainTable },
|
|
2043
|
-
warnings: ["\u5220\u9664\u4E0D\u53EF\u9006\uFF1Bapply \u524D\u5FC5\u987B\u786E\u8BA4 objId\u3001\u5220\u9664\u6761\u4EF6\u548C\u5F53\u524D\u64CD\u4F5C\u4EBA\u5747\u6B63\u786E"]
|
|
2044
|
-
};
|
|
2045
|
-
}
|
|
2046
|
-
async function prepareCustom(endpoint, input, host) {
|
|
2047
|
-
const context = await host.resolveContext(input);
|
|
2048
|
-
const interfacePk = requiredString(input.interfacePk, "interfacePk");
|
|
2049
|
-
const operationinfo = {
|
|
2050
|
-
printCost: false,
|
|
2051
|
-
asyncPostProcess: false,
|
|
2052
|
-
asyncMark: false,
|
|
2053
|
-
...optionalObject(input.operationinfo, "operationinfo") || {}
|
|
2054
|
-
};
|
|
2055
|
-
const session = await host.getSession();
|
|
2056
|
-
if (endpoint === "delete") {
|
|
2057
|
-
const dataIds = requiredArray(input.dataIds, "dataIds").map((item) => requiredString(item, "dataIds[]"));
|
|
2058
|
-
return {
|
|
2059
|
-
context,
|
|
2060
|
-
interfacePk,
|
|
2061
|
-
datajson: {
|
|
2062
|
-
datas: dataIds.map((id) => ({ mainTable: { id } })),
|
|
2063
|
-
header: { operator: session.userId }
|
|
2064
|
-
},
|
|
2065
|
-
target: { endpoint, interfacePk, dataIds },
|
|
2066
|
-
warnings: ["\u5220\u9664\u4E0D\u53EF\u9006\uFF1Bapply \u524D\u5FC5\u987B\u786E\u8BA4 interfacePk\u3001\u76EE\u6807 dataId \u548C\u5F53\u524D\u64CD\u4F5C\u4EBA\u5747\u6B63\u786E"]
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
const datas = requiredArray(input.datas, "datas");
|
|
2070
|
-
return {
|
|
2071
|
-
context,
|
|
2072
|
-
interfacePk,
|
|
2073
|
-
datajson: {
|
|
2074
|
-
operationinfo,
|
|
2075
|
-
datas,
|
|
2076
|
-
header: { operator: session.userId }
|
|
2077
|
-
},
|
|
2078
|
-
target: { endpoint, interfacePk, count: datas.length, dataIds: collectDataIds(datas) },
|
|
2079
|
-
warnings: fieldKeyWarnings(datas)
|
|
2080
|
-
};
|
|
2081
|
-
}
|
|
2082
|
-
function assertContinuation(record2, session, kind, endpoint) {
|
|
2083
|
-
if (record2.kind !== kind || record2.endpoint !== endpoint) {
|
|
2084
|
-
throw ebuilderValidationError("continuation_mismatch", "continuation \u7684\u63A5\u53E3\u65CF\u6216 operation \u4E0E\u5F53\u524D apply \u4E0D\u4E00\u81F4");
|
|
2085
|
-
}
|
|
2086
|
-
const actor = asObject(record2.actor, "continuation.actor");
|
|
2087
|
-
if (actor.userId !== session.userId || actor.baseUrl !== session.baseUrl) {
|
|
2088
|
-
throw ebuilderValidationError("continuation_actor_changed", "continuation \u7B7E\u53D1\u65F6\u7684\u767B\u5F55\u73AF\u5883\u6216\u7528\u6237\u4E0E\u5F53\u524D\u4F1A\u8BDD\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u6267\u884C prepare");
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
function summarizeWriteResult(result, host, deleted) {
|
|
2092
|
-
const context = asObject(result.context || {}, "context");
|
|
2093
|
-
const payload = asObject(result.result || {}, "result");
|
|
2094
|
-
const dataIds = Array.isArray(payload.dataIds) ? payload.dataIds : [];
|
|
2095
|
-
return {
|
|
2096
|
-
context,
|
|
2097
|
-
result: payload,
|
|
2098
|
-
records: dataIds.map((dataId) => ({
|
|
2099
|
-
dataId,
|
|
2100
|
-
url: host.buildDataUrl(context, dataId, deleted)
|
|
2101
|
-
})),
|
|
2102
|
-
listUrl: host.buildListUrl(context)
|
|
2103
|
-
};
|
|
2104
|
-
}
|
|
2105
|
-
function collectDataIds(datas) {
|
|
2106
|
-
return datas.map((item) => optionalString(asObject(item, "datas[]").mainTable?.id, "mainTable.id")).filter((item) => Boolean(item));
|
|
2107
|
-
}
|
|
2108
|
-
function fieldKeyWarnings(datas) {
|
|
2109
|
-
const warnings = [];
|
|
2110
|
-
const text = JSON.stringify(datas);
|
|
2111
|
-
if (/"\d{16,}"/u.test(text)) {
|
|
2112
|
-
warnings.push("\u68C0\u6D4B\u5230\u957F\u6570\u5B57\u5B57\u6BB5\u952E\uFF1B\u5982\u679C\u5B57\u6BB5\u5B9A\u4E49\u4E2D name \u7B49\u4E8E id\uFF0C\u8BF7\u786E\u8BA4\u5199\u5165\u952E\u5DF2\u6539\u7528 config.dataKey\uFF0C\u5426\u5219 eBuilder \u53EF\u80FD\u8FD4\u56DE\u6210\u529F\u4F46\u5B57\u6BB5\u503C\u4E3A\u7A7A");
|
|
2113
|
-
}
|
|
2114
|
-
if (optionalArray(datas, "datas")?.some((item) => JSON.stringify(item).includes('"fieldNoFindIgnore"'))) {
|
|
2115
|
-
warnings.push("fieldNoFindIgnore \u5E94\u653E\u5728 operationinfo\uFF1B\u5B57\u6BB5\u540D\u9519\u8BEF\u4E0D\u80FD\u901A\u8FC7\u5FFD\u7565\u5B57\u6BB5\u7ED5\u8FC7");
|
|
2116
|
-
}
|
|
2117
|
-
return warnings;
|
|
2118
|
-
}
|
|
2119
|
-
|
|
2120
|
-
// src/shortcuts/ebuilder-form/operations/registry.ts
|
|
2121
|
-
function buildRegistry() {
|
|
2122
|
-
const handlers = [
|
|
2123
|
-
new EbuilderMenuSearchOperation(),
|
|
2124
|
-
new EbuilderContextResolveOperation(),
|
|
2125
|
-
new EbuilderViewsListOperation(),
|
|
2126
|
-
new EbuilderListConfigOperation(),
|
|
2127
|
-
new EbuilderListQueryOperation(),
|
|
2128
|
-
new EbuilderNlistConfigOperation(),
|
|
2129
|
-
new EbuilderNlistQueryOperation(),
|
|
2130
|
-
new EbuilderFieldsGetOperation(),
|
|
2131
|
-
new EbuilderOptionsGetOperation(),
|
|
2132
|
-
new EbuilderMappingGetOperation(),
|
|
2133
|
-
new EbuilderBrowserResolveOperation(),
|
|
2134
|
-
new EbuilderOpenapiReadOperation("detail"),
|
|
2135
|
-
new EbuilderOpenapiReadOperation("query"),
|
|
2136
|
-
new EbuilderOpenapiReadOperation("count"),
|
|
2137
|
-
new EbuilderOpenapiPrepareOperation("add"),
|
|
2138
|
-
new EbuilderOpenapiApplyOperation("add"),
|
|
2139
|
-
new EbuilderOpenapiPrepareOperation("update"),
|
|
2140
|
-
new EbuilderOpenapiApplyOperation("update"),
|
|
2141
|
-
new EbuilderOpenapiPrepareOperation("delete"),
|
|
2142
|
-
new EbuilderOpenapiApplyOperation("delete"),
|
|
2143
|
-
new EbuilderCustomReadOperation("detail"),
|
|
2144
|
-
new EbuilderCustomReadOperation("query"),
|
|
2145
|
-
new EbuilderCustomReadOperation("count"),
|
|
2146
|
-
new EbuilderCustomPrepareOperation("add"),
|
|
2147
|
-
new EbuilderCustomApplyOperation("add"),
|
|
2148
|
-
new EbuilderCustomPrepareOperation("update"),
|
|
2149
|
-
new EbuilderCustomApplyOperation("update"),
|
|
2150
|
-
new EbuilderCustomPrepareOperation("delete"),
|
|
2151
|
-
new EbuilderCustomApplyOperation("delete")
|
|
2152
|
-
];
|
|
2153
|
-
const registry2 = /* @__PURE__ */ new Map();
|
|
2154
|
-
for (const handler of handlers) {
|
|
2155
|
-
if (registry2.has(handler.name)) throw new Error(`duplicate ebuilder-form operation handler: ${handler.name}`);
|
|
2156
|
-
registry2.set(handler.name, handler);
|
|
2157
|
-
}
|
|
2158
|
-
for (const contract of ebuilderFormOperations) {
|
|
2159
|
-
if (!registry2.has(contract.name)) throw new Error(`missing ebuilder-form operation handler: ${contract.name}`);
|
|
2160
|
-
}
|
|
2161
|
-
return registry2;
|
|
2162
|
-
}
|
|
2163
|
-
var registry = buildRegistry();
|
|
2164
|
-
function getEbuilderFormOperation(operation) {
|
|
2165
|
-
const handler = registry.get(operation);
|
|
2166
|
-
if (!handler) {
|
|
2167
|
-
throw ebuilderValidationError("operation_unknown", `eBuilder \u8868\u5355\u4E0D\u652F\u6301\u64CD\u4F5C\uFF1A${operation}`);
|
|
2168
|
-
}
|
|
2169
|
-
return handler;
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
|
-
// src/shortcuts/ebuilder-form/operations.ts
|
|
2173
|
-
async function executeEbuilderFormOperation(operation, rawInput, context) {
|
|
2174
|
-
const handler = getEbuilderFormOperation(operation);
|
|
2175
|
-
const input = asObject(rawInput);
|
|
2176
|
-
assertNoForbiddenKeys(input);
|
|
2177
|
-
return handler.execute(input, context);
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
// src/shortcuts/ebuilder-form/index.ts
|
|
2181
|
-
function asOptions(value) {
|
|
2182
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
2183
|
-
}
|
|
2184
|
-
async function readStdin() {
|
|
2185
|
-
const chunks = [];
|
|
2186
|
-
for await (const chunk of process.stdin) {
|
|
2187
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
2188
|
-
}
|
|
2189
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
2190
|
-
}
|
|
2191
|
-
function stripBom(value) {
|
|
2192
|
-
return value.replace(/^\uFEFF+/u, "");
|
|
2193
|
-
}
|
|
2194
|
-
function parseJsonInput(raw, label) {
|
|
2195
|
-
try {
|
|
2196
|
-
const parsed = JSON.parse(stripBom(raw));
|
|
2197
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
2198
|
-
throw new Error("input must be an object");
|
|
2199
|
-
}
|
|
2200
|
-
return parsed;
|
|
2201
|
-
} catch {
|
|
2202
|
-
throw ebuilderValidationError("input_invalid", `${label} \u4E0D\u662F\u5408\u6CD5 JSON \u5BF9\u8C61`);
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2205
|
-
async function inputFrom(options, extra = {}) {
|
|
2206
|
-
const opts = asOptions(options);
|
|
2207
|
-
let input = {};
|
|
2208
|
-
if (opts.input && opts.inputJson) {
|
|
2209
|
-
throw ebuilderValidationError("input_conflict", "\u4E0D\u80FD\u540C\u65F6\u4F20 --input \u548C --input-json");
|
|
2210
|
-
}
|
|
2211
|
-
if (opts.inputJson) {
|
|
2212
|
-
input = parseJsonInput(String(opts.inputJson), "--input-json");
|
|
2213
|
-
}
|
|
2214
|
-
if (opts.input) {
|
|
2215
|
-
let raw;
|
|
2216
|
-
try {
|
|
2217
|
-
raw = stripBom(opts.input === "-" ? await readStdin() : await readFile2(String(opts.input), "utf8"));
|
|
2218
|
-
} catch {
|
|
2219
|
-
throw ebuilderValidationError("input_unreadable", `\u65E0\u6CD5\u8BFB\u53D6 --input\uFF1A${String(opts.input)}`);
|
|
2220
|
-
}
|
|
2221
|
-
input = parseJsonInput(raw, "--input");
|
|
2222
|
-
}
|
|
2223
|
-
return {
|
|
2224
|
-
...input,
|
|
2225
|
-
...Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== void 0 && value !== ""))
|
|
2226
|
-
};
|
|
2227
|
-
}
|
|
2228
|
-
function successEnvelope(operation, result) {
|
|
2229
|
-
return {
|
|
2230
|
-
schemaVersion: 1,
|
|
2231
|
-
ok: true,
|
|
2232
|
-
operation,
|
|
2233
|
-
data: result.data === void 0 ? null : result.data,
|
|
2234
|
-
...result.meta ? { meta: result.meta } : {},
|
|
2235
|
-
warnings: result.warnings ?? []
|
|
2236
|
-
};
|
|
2237
|
-
}
|
|
2238
|
-
function failureEnvelope(error) {
|
|
2239
|
-
return {
|
|
2240
|
-
schemaVersion: 1,
|
|
2241
|
-
ok: false,
|
|
2242
|
-
error: toErrorEnvelope(error)
|
|
2243
|
-
};
|
|
2244
|
-
}
|
|
2245
|
-
async function executeAndPrint(ctx, operation, input) {
|
|
2246
|
-
try {
|
|
2247
|
-
const result = await executeEbuilderFormOperation(operation, input, {
|
|
2248
|
-
ctx,
|
|
2249
|
-
host: createEbuilderFormHost(ctx),
|
|
2250
|
-
continuation: createEbuilderFormContinuationSigner(ctx)
|
|
2251
|
-
});
|
|
2252
|
-
ctx.output.write(successEnvelope(operation, result), { json: true });
|
|
2253
|
-
} catch (error) {
|
|
2254
|
-
console.error(JSON.stringify(failureEnvelope(error), null, 2));
|
|
2255
|
-
process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
var ebuilderFormShortcut = {
|
|
2259
|
-
name: "ebuilder-form",
|
|
2260
|
-
description: "\u6CDB\u5FAEE10 eBuilder \u8868\u5355\u83DC\u5355\u3001\u5217\u8868\u548C\u8868\u5355\u6570\u636E CLI",
|
|
2261
|
-
category: "shortcut",
|
|
2262
|
-
register({ program, action }) {
|
|
2263
|
-
const ebuilder = program.command("ebuilder-form").description("\u6CDB\u5FAEE10 eBuilder \u8868\u5355\u83DC\u5355\u3001List/NList\u3001OpenAPI \u4E0E\u81EA\u5B9A\u4E49\u63A5\u53E3\u80FD\u529B");
|
|
2264
|
-
ebuilder.command("schema").description("Print ebuilder-form operation manifest for agents").action(action((ctx) => {
|
|
2265
|
-
ctx.output.write(ebuilderFormManifest, { json: true });
|
|
2266
|
-
}));
|
|
2267
|
-
ebuilder.command("run").description("Run an ebuilder-form operation with JSON input").argument("<operation>", "operation name, e.g. ebuilder-form.context.resolve").option("--input <path>", "JSON input file, or - for stdin").option("--input-json <json>", "inline JSON input object").action(action(async (ctx, operation, options) => {
|
|
2268
|
-
await executeAndPrint(ctx, String(operation), await inputFrom(options));
|
|
2269
|
-
}));
|
|
2270
|
-
}
|
|
2271
|
-
};
|
|
2272
1143
|
export {
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
1144
|
+
resolveApiPrefix,
|
|
1145
|
+
routeEbuilderPath,
|
|
1146
|
+
parseDirectListUrl,
|
|
1147
|
+
encodeNlistCustomConfig,
|
|
1148
|
+
pickEbuilderDataKey,
|
|
1149
|
+
createEbuilderFormHost
|
|
2276
1150
|
};
|