bpmax-cli 0.1.44-beta.1 → 0.1.44-beta.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/bin.js +1622 -85
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install-skills.mjs +98 -0
- package/skills/bpmax-api-platform-editor/SKILL.md +1 -1
- package/skills/bpmax-console-template-editor/SKILL.md +1 -1
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +3 -3
- package/skills/bpmax-dataset-template-editor/SKILL.md +3 -3
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +28 -2
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +26 -3
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +8 -0
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +9 -4
- package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +25 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +26 -0
- package/skills/bpmax-filter-template-editor/SKILL.md +1 -1
- package/skills/bpmax-flow-template-editor/SKILL.md +25 -10
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +17 -2
- package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +2 -0
- package/skills/bpmax-form-template-editor/SKILL.md +31 -6
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +15 -5
- package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +1 -1
- package/skills/bpmax-form-template-editor/scripts/export_form_template.py +2 -0
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +17 -0
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +6 -17
- package/skills/bpmax-list-template-editor/SKILL.md +5 -1
- package/skills/bpmax-list-template-editor/references/content-config-shape.md +17 -0
- package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +9 -4
- package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +17 -10
- package/skills/bpmax-list-template-editor/references/special-formats.md +17 -0
- package/skills/bpmax-memory-protocol/SKILL.md +72 -0
- package/skills/bpmax-nav-config-editor/SKILL.md +1 -1
- package/skills/bpmax-project-detail-template-editor/SKILL.md +1 -1
- package/skills/bpmax-role-editor/SKILL.md +2 -2
- package/skills/bpmax-user-mock-operator/SKILL.md +106 -0
- package/skills/bpmax-user-mock-operator/agents/openai.yaml +4 -0
- package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +37 -0
- package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +136 -0
- package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +138 -0
- package/skills/form-control-library/SKILL.md +1 -1
package/dist/bin.js
CHANGED
|
@@ -206,7 +206,10 @@ var CLI_GOVERNANCE_PATHS = [
|
|
|
206
206
|
"/api/cli/audit/start",
|
|
207
207
|
"/api/cli/audit/finish",
|
|
208
208
|
"/api/cli/bbs_invocations/start",
|
|
209
|
-
"/api/cli/bbs_invocations/finish"
|
|
209
|
+
"/api/cli/bbs_invocations/finish",
|
|
210
|
+
"/api/cli/memory/status",
|
|
211
|
+
"/api/cli/memory/search",
|
|
212
|
+
"/api/cli/memory"
|
|
210
213
|
];
|
|
211
214
|
var CLI_GOVERNANCE_UNSUPPORTED_MESSAGE = "\u5F53\u524D BPMAX \u5E73\u53F0\u7248\u672C\u4E0D\u652F\u6301 CLI \u6CBB\u7406\u80FD\u529B\uFF0C\u8BF7\u5347\u7EA7 huanpingtong-server \u540E\u518D\u4F7F\u7528 bpmax-cli 0.1.42+ \u7684\u8FDC\u7AEF\u4E1A\u52A1\u547D\u4EE4\u3002";
|
|
212
215
|
function toCliGovernanceUnsupportedError(error, fallbackPath) {
|
|
@@ -262,18 +265,73 @@ function getValue(value, path9) {
|
|
|
262
265
|
function capabilityForRequest(method, path9) {
|
|
263
266
|
const normalizedMethod = method.toUpperCase();
|
|
264
267
|
const normalizedPath = normalizePath2(path9);
|
|
268
|
+
const pageTemplatePrefix = flowPageTemplateCapabilityPrefix(path9);
|
|
265
269
|
if (normalizedPath === "/cli/capabilities") {
|
|
266
270
|
return void 0;
|
|
267
271
|
}
|
|
268
272
|
if (normalizedPath.startsWith("/cli/bbs_invocations/")) {
|
|
269
273
|
return void 0;
|
|
270
274
|
}
|
|
275
|
+
if (normalizedMethod === "GET" && normalizedPath === "/cli/memory/status") return "memory.status";
|
|
276
|
+
if (normalizedMethod === "POST" && normalizedPath === "/cli/memory/search") return "memory.search";
|
|
277
|
+
if (normalizedMethod === "GET" && normalizedPath === "/cli/memory") return "memory.list";
|
|
278
|
+
if (normalizedMethod === "POST" && normalizedPath === "/cli/memory") return "memory.add";
|
|
279
|
+
if (normalizedMethod === "GET" && /^\/cli\/memory\/[^/]+$/.test(normalizedPath)) return "memory.get";
|
|
280
|
+
if (normalizedMethod === "PUT" && /^\/cli\/memory\/[^/]+$/.test(normalizedPath)) return "memory.update";
|
|
281
|
+
if (normalizedMethod === "DELETE" && /^\/cli\/memory\/[^/]+$/.test(normalizedPath)) return "memory.delete";
|
|
271
282
|
if (normalizedMethod === "GET" && normalizedPath === "/user/current") return "user.current";
|
|
272
|
-
if (normalizedMethod === "GET" && normalizedPath === "/workspace/by_key") return "
|
|
283
|
+
if (normalizedMethod === "GET" && normalizedPath === "/workspace/by_key") return "config.workspace_flow.export";
|
|
273
284
|
if (normalizedMethod === "GET" && normalizedPath === "/flow/flow_type") return "flow.list";
|
|
285
|
+
if (normalizedMethod === "POST" && normalizedPath === "/flow/flow_type") return "config.flow_template.create";
|
|
274
286
|
if (normalizedMethod === "GET" && normalizedPath === "/flow/options") return "flow.options";
|
|
287
|
+
if (normalizedMethod === "GET" && normalizedPath === "/flow") return "config.flow_template.export";
|
|
288
|
+
if (normalizedMethod === "PUT" && normalizedPath === "/flow") return "config.flow_template.submit";
|
|
289
|
+
if (normalizedMethod === "DELETE" && normalizedPath === "/flow") return "config.flow_template.delete";
|
|
275
290
|
if (normalizedMethod === "POST" && normalizedPath === "/flow/batch_get") return "flow.get";
|
|
276
|
-
if (normalizedMethod === "GET" && normalizedPath.startsWith("/form_template/")) return "
|
|
291
|
+
if (normalizedMethod === "GET" && normalizedPath.startsWith("/form_template/")) return "config.form_template.export";
|
|
292
|
+
if (normalizedMethod === "POST" && normalizedPath === "/form_template") return "config.form_template.create";
|
|
293
|
+
if (normalizedMethod === "PUT" && /^\/form_template\/[^/]+$/.test(normalizedPath)) return "config.form_template.submit";
|
|
294
|
+
if (normalizedMethod === "DELETE" && /^\/form_template\/[^/]+$/.test(normalizedPath)) return "config.form_template.delete";
|
|
295
|
+
if (normalizedMethod === "POST" && normalizedPath === "/form_template/publish") return "config.form_template.submit";
|
|
296
|
+
if (normalizedMethod === "POST" && normalizedPath === "/flow_page_template") return `${pageTemplatePrefix}.create`;
|
|
297
|
+
if (normalizedMethod === "GET" && /^\/flow_page_template\/[^/]+$/.test(normalizedPath)) return `${pageTemplatePrefix}.export`;
|
|
298
|
+
if (normalizedMethod === "PUT" && /^\/flow_page_template\/[^/]+$/.test(normalizedPath)) return `${pageTemplatePrefix}.submit`;
|
|
299
|
+
if (normalizedMethod === "DELETE" && /^\/flow_page_template\/[^/]+$/.test(normalizedPath)) return `${pageTemplatePrefix}.delete`;
|
|
300
|
+
if (normalizedMethod === "POST" && normalizedPath === "/data_set") return "config.dataset.create";
|
|
301
|
+
if (normalizedMethod === "GET" && /^\/data_set\/[^/]+$/.test(normalizedPath)) return "config.dataset.export";
|
|
302
|
+
if (normalizedMethod === "POST" && /^\/data_set\/relationFields\/[^/]+$/.test(normalizedPath)) return "config.dataset.submit";
|
|
303
|
+
if (normalizedMethod === "POST" && /^\/data_set\/publish\/[^/]+$/.test(normalizedPath)) return "config.dataset.publish";
|
|
304
|
+
if (normalizedMethod === "POST" && /^\/data_set\/pause\/[^/]+$/.test(normalizedPath)) return "config.dataset.pause";
|
|
305
|
+
if (normalizedMethod === "POST" && /^\/data_set\/cancel-refresh\/[^/]+$/.test(normalizedPath)) return "config.dataset.cancel_refresh";
|
|
306
|
+
if (normalizedMethod === "DELETE" && /^\/data_set\/[^/]+$/.test(normalizedPath)) return "config.dataset.delete";
|
|
307
|
+
if (normalizedMethod === "POST" && normalizedPath === "/data_set_field") return "config.dataset_field.create";
|
|
308
|
+
if (normalizedMethod === "GET" && /^\/data_set_field\/[^/]+$/.test(normalizedPath)) return "config.dataset_field.export";
|
|
309
|
+
if (normalizedMethod === "PUT" && /^\/data_set_field\/[^/]+$/.test(normalizedPath)) return "config.dataset_field.submit";
|
|
310
|
+
if (normalizedMethod === "DELETE" && /^\/data_set_field\/[^/]+$/.test(normalizedPath)) return "config.dataset_field.delete";
|
|
311
|
+
if (normalizedMethod === "POST" && normalizedPath === "/api_platform") return "config.api_platform.create";
|
|
312
|
+
if (normalizedMethod === "POST" && normalizedPath === "/api_platform_instance") return "config.api_platform.create";
|
|
313
|
+
if (normalizedMethod === "POST" && normalizedPath === "/api_proxy") return "config.api_platform.create";
|
|
314
|
+
if (normalizedMethod === "POST" && normalizedPath === "/api_proxy_entity_binding") return "config.api_platform.create";
|
|
315
|
+
if (normalizedMethod === "PUT" && /^\/api_platform\/[^/]+$/.test(normalizedPath)) return "config.api_platform.submit";
|
|
316
|
+
if (normalizedMethod === "PUT" && /^\/api_platform_instance\/[^/]+$/.test(normalizedPath)) return "config.api_platform.submit";
|
|
317
|
+
if (normalizedMethod === "PUT" && /^\/api_proxy\/[^/]+$/.test(normalizedPath)) return "config.api_platform.submit";
|
|
318
|
+
if (normalizedMethod === "PUT" && /^\/api_proxy_entity_binding\/[^/]+$/.test(normalizedPath)) return "config.api_platform.submit";
|
|
319
|
+
if (normalizedMethod === "DELETE" && /^\/api_platform\/[^/]+$/.test(normalizedPath)) return "config.api_platform.delete";
|
|
320
|
+
if (normalizedMethod === "DELETE" && /^\/api_platform_instance\/[^/]+$/.test(normalizedPath)) return "config.api_platform.delete";
|
|
321
|
+
if (normalizedMethod === "DELETE" && /^\/api_proxy\/[^/]+$/.test(normalizedPath)) return "config.api_platform.delete";
|
|
322
|
+
if (normalizedMethod === "DELETE" && /^\/api_proxy_entity_binding\/[^/]+$/.test(normalizedPath)) return "config.api_platform.delete";
|
|
323
|
+
if (normalizedMethod === "POST" && normalizedPath === "/role") return "config.role.create";
|
|
324
|
+
if (normalizedMethod === "POST" && normalizedPath === "/point") return "config.role.create";
|
|
325
|
+
if (normalizedMethod === "POST" && normalizedPath === "/user_role") return "config.role.create";
|
|
326
|
+
if (normalizedMethod === "PUT" && /^\/role\/[^/]+$/.test(normalizedPath)) return "config.role.submit";
|
|
327
|
+
if (normalizedMethod === "PUT" && /^\/point\/[^/]+$/.test(normalizedPath)) return "config.role.submit";
|
|
328
|
+
if (normalizedMethod === "DELETE" && /^\/role\/[^/]+$/.test(normalizedPath)) return "config.role.delete";
|
|
329
|
+
if (normalizedMethod === "DELETE" && /^\/point\/[^/]+$/.test(normalizedPath)) return "config.role.delete";
|
|
330
|
+
if (normalizedMethod === "DELETE" && /^\/user_role\/[^/]+$/.test(normalizedPath)) return "config.role.delete";
|
|
331
|
+
if (normalizedMethod === "POST" && normalizedPath === "/configuration") return "config.nav_config.create";
|
|
332
|
+
if (normalizedMethod === "PUT" && /^\/configuration\/[^/]+$/.test(normalizedPath)) return "config.nav_config.submit";
|
|
333
|
+
if (normalizedMethod === "DELETE" && /^\/configuration\/[^/]+$/.test(normalizedPath)) return "config.nav_config.delete";
|
|
334
|
+
if (normalizedMethod === "PUT" && normalizedPath === "/workspace/workspace_flow") return "config.workspace_flow.submit";
|
|
277
335
|
if (normalizedMethod === "POST" && normalizedPath === "/project_staging/prefill") return "project.create";
|
|
278
336
|
if (normalizedMethod === "POST" && normalizedPath === "/project/search") return "project.search";
|
|
279
337
|
if (normalizedMethod === "POST" && normalizedPath === "/project/list") return "project.list";
|
|
@@ -354,6 +412,20 @@ async function updateProfileCapabilities(profileName, cache) {
|
|
|
354
412
|
};
|
|
355
413
|
await saveConfig(config);
|
|
356
414
|
}
|
|
415
|
+
function flowPageTemplateCapabilityPrefix(path9) {
|
|
416
|
+
const query = path9.includes("?") ? path9.slice(path9.indexOf("?") + 1) : "";
|
|
417
|
+
const type = new URLSearchParams(query).get("type");
|
|
418
|
+
if (type === "2") {
|
|
419
|
+
return "config.project_detail_template";
|
|
420
|
+
}
|
|
421
|
+
if (type === "3") {
|
|
422
|
+
return "config.filter_template";
|
|
423
|
+
}
|
|
424
|
+
if (type === "4") {
|
|
425
|
+
return "config.console_template";
|
|
426
|
+
}
|
|
427
|
+
return "config.list_template";
|
|
428
|
+
}
|
|
357
429
|
function normalizePath2(path9) {
|
|
358
430
|
let normalized = path9.split("?")[0] || "/";
|
|
359
431
|
if (!normalized.startsWith("/")) {
|
|
@@ -372,7 +444,7 @@ function normalizePath2(path9) {
|
|
|
372
444
|
// package.json
|
|
373
445
|
var package_default = {
|
|
374
446
|
name: "bpmax-cli",
|
|
375
|
-
version: "0.1.44-beta.
|
|
447
|
+
version: "0.1.44-beta.11",
|
|
376
448
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
377
449
|
type: "module",
|
|
378
450
|
bin: {
|
|
@@ -732,14 +804,24 @@ function createApiClient(profile) {
|
|
|
732
804
|
$workspace: normalizeWorkspaceForApi(String(workspaceParam)),
|
|
733
805
|
$language: config.params?.$language ?? profile.config.language
|
|
734
806
|
};
|
|
735
|
-
|
|
807
|
+
const executionToken = process.env.BPMAX_EXECUTION_TOKEN;
|
|
808
|
+
if (executionToken || profile.config.api_key) {
|
|
736
809
|
const headers = AxiosHeaders.from(config.headers || {});
|
|
737
|
-
headers.set("Authorization", `Bearer ${profile.config.api_key}`);
|
|
810
|
+
headers.set("Authorization", `Bearer ${executionToken || profile.config.api_key}`);
|
|
738
811
|
if (profile.config.terminal_id) {
|
|
739
812
|
headers.set("X-BPMAX-CLI-Terminal-Id", profile.config.terminal_id);
|
|
740
813
|
}
|
|
741
814
|
headers.set("X-BPMAX-CLI-Version", VERSION);
|
|
742
815
|
headers.set("X-BPMAX-CLI-Command", commandHeaderSummary());
|
|
816
|
+
if (process.env.BPMAX_AI_ACTION_KEY) {
|
|
817
|
+
headers.set("X-BPMAX-AI-Action-Key", process.env.BPMAX_AI_ACTION_KEY);
|
|
818
|
+
}
|
|
819
|
+
if (process.env.BPMAX_AI_SESSION_KEY) {
|
|
820
|
+
headers.set("X-BPMAX-AI-Session-Key", process.env.BPMAX_AI_SESSION_KEY);
|
|
821
|
+
}
|
|
822
|
+
if (process.env.BPMAX_AI_TRACE_ID) {
|
|
823
|
+
headers.set("X-BPMAX-AI-Trace-Id", process.env.BPMAX_AI_TRACE_ID);
|
|
824
|
+
}
|
|
743
825
|
config.headers = headers;
|
|
744
826
|
}
|
|
745
827
|
return config;
|
|
@@ -2574,11 +2656,15 @@ var CONFIG_DOMAINS = {
|
|
|
2574
2656
|
exportStatus: "supported",
|
|
2575
2657
|
buildStatus: "supported",
|
|
2576
2658
|
submitStatus: "supported",
|
|
2659
|
+
createPath: "/form_template",
|
|
2660
|
+
createMethod: "POST",
|
|
2661
|
+
deletePath: (id) => `/form_template/${id}`,
|
|
2662
|
+
deleteMethod: "DELETE",
|
|
2577
2663
|
submitPath: (id) => `/form_template/${id}`,
|
|
2578
2664
|
submitMethod: "PUT",
|
|
2579
2665
|
readEndpoints: ["GET /api/form_template/:id"],
|
|
2580
|
-
writeEndpoints: ["PUT /api/form_template/:id", "POST /api/form_template/publish"],
|
|
2581
|
-
notes: ["Edit
|
|
2666
|
+
writeEndpoints: ["POST /api/form_template", "PUT /api/form_template/:id", "DELETE /api/form_template/:id", "POST /api/form_template/publish"],
|
|
2667
|
+
notes: ["Supports edit and create modes. Edit updates the draft/current template and publishes after update; create posts a new draft and publishes it through the typed adapter."]
|
|
2582
2668
|
},
|
|
2583
2669
|
"flow-template": {
|
|
2584
2670
|
capability: "config.flow_template",
|
|
@@ -2586,11 +2672,27 @@ var CONFIG_DOMAINS = {
|
|
|
2586
2672
|
exportStatus: "supported",
|
|
2587
2673
|
buildStatus: "supported",
|
|
2588
2674
|
submitStatus: "supported",
|
|
2675
|
+
deletePath: (id) => `/flow?${flowIdentityQuery(parseFlowIdentity(id))}`,
|
|
2676
|
+
deleteMethod: "DELETE",
|
|
2589
2677
|
submitPath: (id) => `/flow?${flowIdentityQuery(parseFlowIdentity(id), { publish: 2 })}`,
|
|
2590
2678
|
submitMethod: "PUT",
|
|
2591
2679
|
readEndpoints: ["GET /api/flow?flow_type=:flow_type&draft=1", "GET /api/flow?key=:key&draft=1", "POST /api/flow/batch_get"],
|
|
2592
|
-
writeEndpoints: ["PUT /api/flow?flow_type=:flow_type&publish=2", "PUT /api/flow?key=:key&publish=2", "PUT /api/flow?flow_type=:flow_type&publish=1", "PUT /api/flow?key=:key&publish=1"],
|
|
2593
|
-
notes: ["Flow config is keyed by flow_type for main flows or key for subflows. Export id format: flow_type, flow_type:<type>, or key:<subflowKey>. Submit writes draft by default and only publishes when payload.publish_live=true."]
|
|
2680
|
+
writeEndpoints: ["POST /api/flow/flow_type", "PUT /api/flow?flow_type=:flow_type&publish=2", "PUT /api/flow?key=:key&publish=2", "PUT /api/flow?flow_type=:flow_type&publish=1", "PUT /api/flow?key=:key&publish=1", "DELETE /api/flow?flow_type=:flow_type&key=:key"],
|
|
2681
|
+
notes: ["Flow config is keyed by flow_type for main flows or key for subflows. Export id format: flow_type, flow_type:<type>, or key:<subflowKey>. Submit writes draft by default and only publishes when payload.publish_live=true. Create first asks the platform for a flow<number> and never accepts a hand-authored main flow_type."]
|
|
2682
|
+
},
|
|
2683
|
+
"workspace-flow": {
|
|
2684
|
+
capability: "config.workspace_flow",
|
|
2685
|
+
exportPath: (id) => `/workspace/by_key?key=${encodeURIComponent(normalizeWorkspaceKey(id))}`,
|
|
2686
|
+
exportStatus: "supported",
|
|
2687
|
+
buildStatus: "supported",
|
|
2688
|
+
submitStatus: "supported",
|
|
2689
|
+
createPath: "/workspace/workspace_flow",
|
|
2690
|
+
createMethod: "PUT",
|
|
2691
|
+
submitPath: () => "/workspace/workspace_flow",
|
|
2692
|
+
submitMethod: "PUT",
|
|
2693
|
+
readEndpoints: ["GET /api/workspace/by_key?key=:workspace"],
|
|
2694
|
+
writeEndpoints: ["PUT /api/workspace/workspace_flow"],
|
|
2695
|
+
notes: ["Workspace flow create/submit replaces the workspace_flow relation list for one workspace, then verifies by /workspace/by_key. Create is a capability alias for adding a new binding through the typed submit adapter."]
|
|
2594
2696
|
},
|
|
2595
2697
|
"list-template": {
|
|
2596
2698
|
capability: "config.list_template",
|
|
@@ -2598,12 +2700,16 @@ var CONFIG_DOMAINS = {
|
|
|
2598
2700
|
exportStatus: "supported",
|
|
2599
2701
|
buildStatus: "supported",
|
|
2600
2702
|
submitStatus: "supported",
|
|
2703
|
+
createPath: "/flow_page_template",
|
|
2704
|
+
createMethod: "POST",
|
|
2705
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2706
|
+
deleteMethod: "DELETE",
|
|
2601
2707
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2602
2708
|
submitMethod: "PUT",
|
|
2603
2709
|
expectedType: 1,
|
|
2604
2710
|
readEndpoints: ["GET /api/flow_page_template/:id?skip_i18n=true"],
|
|
2605
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2606
|
-
notes: ["type=1 list template."]
|
|
2711
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2712
|
+
notes: ["type=1 list template. Create and edit both use the typed flow_page_template adapter."]
|
|
2607
2713
|
},
|
|
2608
2714
|
"filter-template": {
|
|
2609
2715
|
capability: "config.filter_template",
|
|
@@ -2611,12 +2717,16 @@ var CONFIG_DOMAINS = {
|
|
|
2611
2717
|
exportStatus: "supported",
|
|
2612
2718
|
buildStatus: "supported",
|
|
2613
2719
|
submitStatus: "supported",
|
|
2720
|
+
createPath: "/flow_page_template",
|
|
2721
|
+
createMethod: "POST",
|
|
2722
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2723
|
+
deleteMethod: "DELETE",
|
|
2614
2724
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2615
2725
|
submitMethod: "PUT",
|
|
2616
2726
|
expectedType: 3,
|
|
2617
2727
|
readEndpoints: ["GET /api/flow_page_template/:id?skip_i18n=true"],
|
|
2618
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2619
|
-
notes: ["type=3 filter template."]
|
|
2728
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2729
|
+
notes: ["type=3 filter template. Create and edit both use the typed flow_page_template adapter."]
|
|
2620
2730
|
},
|
|
2621
2731
|
"project-detail-template": {
|
|
2622
2732
|
capability: "config.project_detail_template",
|
|
@@ -2624,12 +2734,16 @@ var CONFIG_DOMAINS = {
|
|
|
2624
2734
|
exportStatus: "supported",
|
|
2625
2735
|
buildStatus: "supported",
|
|
2626
2736
|
submitStatus: "supported",
|
|
2737
|
+
createPath: "/flow_page_template",
|
|
2738
|
+
createMethod: "POST",
|
|
2739
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2740
|
+
deleteMethod: "DELETE",
|
|
2627
2741
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2628
2742
|
submitMethod: "PUT",
|
|
2629
2743
|
expectedType: 2,
|
|
2630
2744
|
readEndpoints: ["GET /api/flow_page_template/:id?type=2&create=&skip_i18n=true"],
|
|
2631
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2632
|
-
notes: ["type=2 project detail template; activate/delete remain domain-specific operations."]
|
|
2745
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2746
|
+
notes: ["type=2 project detail template. Create and edit both use the typed flow_page_template adapter; activate/delete remain domain-specific operations."]
|
|
2633
2747
|
},
|
|
2634
2748
|
"console-template": {
|
|
2635
2749
|
capability: "config.console_template",
|
|
@@ -2637,12 +2751,16 @@ var CONFIG_DOMAINS = {
|
|
|
2637
2751
|
exportStatus: "supported",
|
|
2638
2752
|
buildStatus: "supported",
|
|
2639
2753
|
submitStatus: "supported",
|
|
2754
|
+
createPath: "/flow_page_template",
|
|
2755
|
+
createMethod: "POST",
|
|
2756
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2757
|
+
deleteMethod: "DELETE",
|
|
2640
2758
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2641
2759
|
submitMethod: "PUT",
|
|
2642
2760
|
expectedType: 4,
|
|
2643
2761
|
readEndpoints: ["GET /api/flow_page_template/:id?skip_i18n=true"],
|
|
2644
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2645
|
-
notes: ["type=4 console template; this is not /api/configuration."]
|
|
2762
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2763
|
+
notes: ["type=4 console template; this is not /api/configuration. Create and edit both use the typed flow_page_template adapter."]
|
|
2646
2764
|
},
|
|
2647
2765
|
dataset: {
|
|
2648
2766
|
capability: "config.dataset",
|
|
@@ -2650,11 +2768,23 @@ var CONFIG_DOMAINS = {
|
|
|
2650
2768
|
exportStatus: "supported",
|
|
2651
2769
|
buildStatus: "supported",
|
|
2652
2770
|
submitStatus: "supported",
|
|
2771
|
+
createPath: "/data_set",
|
|
2772
|
+
createMethod: "POST",
|
|
2773
|
+
deletePath: (id) => `/data_set/${id}`,
|
|
2774
|
+
deleteMethod: "DELETE",
|
|
2653
2775
|
submitPath: (id) => `/data_set/relationFields/${id}`,
|
|
2654
2776
|
submitMethod: "POST",
|
|
2655
2777
|
readEndpoints: ["GET /api/data_set/:id", "POST /api/data_set/list"],
|
|
2656
|
-
writeEndpoints: [
|
|
2657
|
-
|
|
2778
|
+
writeEndpoints: [
|
|
2779
|
+
"POST /api/data_set",
|
|
2780
|
+
"POST /api/data_set/relationFields/:id",
|
|
2781
|
+
"DELETE /api/data_set/:id",
|
|
2782
|
+
"POST /api/data_set/publish/:id",
|
|
2783
|
+
"POST /api/data_set/pause/:id",
|
|
2784
|
+
"POST /api/data_set/cancel-refresh/:id",
|
|
2785
|
+
"POST /api/data_set/pause/:id + POST /api/data_set/publish/:id (refresh/reindex)"
|
|
2786
|
+
],
|
|
2787
|
+
notes: ["Create posts a new dataset through the huanpingtong API-Key proxy. Edit submit updates dataset basics and selected field relations. Publish, pause, cancel-refresh, and refresh/reindex are explicit lifecycle commands."]
|
|
2658
2788
|
},
|
|
2659
2789
|
"dataset-field": {
|
|
2660
2790
|
capability: "config.dataset_field",
|
|
@@ -2662,28 +2792,35 @@ var CONFIG_DOMAINS = {
|
|
|
2662
2792
|
exportStatus: "supported",
|
|
2663
2793
|
buildStatus: "supported",
|
|
2664
2794
|
submitStatus: "supported",
|
|
2795
|
+
createPath: "/data_set_field",
|
|
2796
|
+
createMethod: "POST",
|
|
2797
|
+
deletePath: (id) => `/data_set_field/${id}`,
|
|
2798
|
+
deleteMethod: "DELETE",
|
|
2665
2799
|
submitPath: (id) => `/data_set_field/${id}`,
|
|
2666
2800
|
submitMethod: "PUT",
|
|
2667
2801
|
readEndpoints: ["GET /api/data_set_field/:id", "GET /api/data_set_field/getBatchByFlow"],
|
|
2668
|
-
writeEndpoints: ["PUT /api/data_set_field/:id"],
|
|
2669
|
-
notes: ["
|
|
2802
|
+
writeEndpoints: ["POST /api/data_set_field", "PUT /api/data_set_field/:id", "DELETE /api/data_set_field/:id"],
|
|
2803
|
+
notes: ["Create, edit, and delete one dataset field through the huanpingtong API-Key proxy."]
|
|
2670
2804
|
},
|
|
2671
2805
|
"api-platform": {
|
|
2672
2806
|
capability: "config.api_platform",
|
|
2673
2807
|
exportStatus: "supported",
|
|
2674
2808
|
buildStatus: "supported",
|
|
2675
2809
|
submitStatus: "supported",
|
|
2810
|
+
deleteMethod: "DELETE",
|
|
2676
2811
|
readEndpoints: ["GET /api/api_platform/by_key/:key", "GET /api/api_platform_instance/:id", "GET /api/api_platform_instance?api_platform_guid=:guid", "GET /api/api_proxy/:id", "GET /api/api_proxy?api_platform_guid=:guid", "GET /api/api_proxy_entity_binding?q_proxy_guid=:guid&q_direction=response"],
|
|
2677
|
-
writeEndpoints: ["PUT /api/api_platform/:id", "PUT /api/api_platform_instance/:id", "PUT /api/api_proxy/:id", "PUT /api/api_proxy_entity_binding/:id", "POST /api/api_platform", "POST /api/api_platform_instance", "POST /api/api_proxy", "POST /api/api_proxy_entity_binding"],
|
|
2678
|
-
notes: ["API platform config is layered. Export id format: platform:<platform_key>, instance:<id>, or
|
|
2812
|
+
writeEndpoints: ["PUT /api/api_platform/:id", "PUT /api/api_platform_instance/:id", "PUT /api/api_proxy/:id", "PUT /api/api_proxy_entity_binding/:id", "POST /api/api_platform", "POST /api/api_platform_instance", "POST /api/api_proxy", "POST /api/api_proxy_entity_binding", "DELETE /api/api_platform/:id", "DELETE /api/api_platform_instance/:id", "DELETE /api/api_proxy/:id", "DELETE /api/api_proxy_entity_binding/:id"],
|
|
2813
|
+
notes: ["API platform config is layered. Export id format: platform:<platform_key>, instance:<id>, api:<id>, or binding:<id>. Submit supports create/edit operation plans for platform, instance, API, and optional response binding."]
|
|
2679
2814
|
},
|
|
2680
2815
|
role: {
|
|
2681
2816
|
capability: "config.role",
|
|
2682
2817
|
exportStatus: "supported",
|
|
2683
2818
|
buildStatus: "supported",
|
|
2684
2819
|
submitStatus: "supported",
|
|
2820
|
+
deletePath: (id) => `/role/${id}`,
|
|
2821
|
+
deleteMethod: "DELETE",
|
|
2685
2822
|
readEndpoints: ["GET /api/role?page=1&page_size=1000&sort=-id", "GET /api/point/point_list", "GET /api/user_role?role_id=:id", "GET /api/workspace?page_size=10000", "POST /api/flow/list/lightweight?page_size=1000"],
|
|
2686
|
-
writeEndpoints: ["POST /api/role", "PUT /api/role/:id", "POST/PUT/DELETE /api/point", "POST/DELETE /api/user_role"],
|
|
2823
|
+
writeEndpoints: ["POST /api/role", "PUT /api/role/:id", "DELETE /api/role/:id", "POST/PUT/DELETE /api/point", "POST/DELETE /api/user_role"],
|
|
2687
2824
|
notes: ["Role submit executes point operations, role create/update, then member operations with role_id injection."]
|
|
2688
2825
|
},
|
|
2689
2826
|
"nav-config": {
|
|
@@ -2692,22 +2829,30 @@ var CONFIG_DOMAINS = {
|
|
|
2692
2829
|
buildStatus: "supported",
|
|
2693
2830
|
submitStatus: "supported",
|
|
2694
2831
|
readEndpoints: ["GET /api/configuration?q_type=:type&is_default_action=1&page=1&page_size=10000", "GET /api/point/point_list", "GET /api/group/sub_groups"],
|
|
2695
|
-
writeEndpoints: ["PUT /api/configuration/:id?is_default_action=1", "POST /api/configuration?is_default_action=1"],
|
|
2832
|
+
writeEndpoints: ["PUT /api/configuration/:id?is_default_action=1", "POST /api/configuration?is_default_action=1", "DELETE /api/configuration/:id?is_default_action=1"],
|
|
2696
2833
|
notes: ["Nav config is four configuration records (navmenu/shortcut/navmenu_mobile/shortcut_mobile). Export id is the workspace key. Submit writes all four records as an operation plan."]
|
|
2697
2834
|
}
|
|
2698
2835
|
};
|
|
2699
2836
|
var CONFIG_SUBMIT_UNSUPPORTED_MESSAGE = "Typed config build/submit adapters are not implemented for this domain yet. Stop before remote writes and use the matching editor Skill verified scripts until bpmax-cli adds a domain-specific adapter.";
|
|
2700
2837
|
function configAdapterMatrix() {
|
|
2701
|
-
return Object.entries(CONFIG_DOMAINS).map(([domain, definition]) =>
|
|
2702
|
-
domain
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2838
|
+
return Object.entries(CONFIG_DOMAINS).map(([domain, definition]) => {
|
|
2839
|
+
const supportsCreate = Boolean(definition.createPath) || ["flow-template", "api-platform", "role", "nav-config"].includes(domain);
|
|
2840
|
+
const supportsDelete = Boolean(definition.deletePath) || ["workspace-flow", "api-platform", "nav-config"].includes(domain);
|
|
2841
|
+
return {
|
|
2842
|
+
domain,
|
|
2843
|
+
capability_prefix: definition.capability,
|
|
2844
|
+
export_status: definition.exportStatus,
|
|
2845
|
+
create_status: supportsCreate ? "supported" : "blocked",
|
|
2846
|
+
build_status: definition.buildStatus,
|
|
2847
|
+
submit_status: definition.submitStatus,
|
|
2848
|
+
delete_status: supportsDelete ? "supported" : "blocked",
|
|
2849
|
+
create_capability: supportsCreate ? `${definition.capability}.create` : null,
|
|
2850
|
+
delete_capability: supportsDelete ? `${definition.capability}.delete` : null,
|
|
2851
|
+
read_endpoints: definition.readEndpoints,
|
|
2852
|
+
write_endpoints: definition.writeEndpoints,
|
|
2853
|
+
notes: definition.notes
|
|
2854
|
+
};
|
|
2855
|
+
});
|
|
2711
2856
|
}
|
|
2712
2857
|
function hashJson(value) {
|
|
2713
2858
|
return createHash3("sha256").update(JSON.stringify(value)).digest("hex");
|
|
@@ -2727,6 +2872,34 @@ function pickDefined(source, keys) {
|
|
|
2727
2872
|
}
|
|
2728
2873
|
return result;
|
|
2729
2874
|
}
|
|
2875
|
+
function normalizeWorkspaceKey(workspace) {
|
|
2876
|
+
const nextWorkspace = workspace.trim().replace(/^\/+|\/+$/g, "");
|
|
2877
|
+
return nextWorkspace.startsWith("w:") ? nextWorkspace.slice(2) : nextWorkspace;
|
|
2878
|
+
}
|
|
2879
|
+
function numericId(value) {
|
|
2880
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
2881
|
+
return value;
|
|
2882
|
+
}
|
|
2883
|
+
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
2884
|
+
return Number(value);
|
|
2885
|
+
}
|
|
2886
|
+
return void 0;
|
|
2887
|
+
}
|
|
2888
|
+
function formTemplateDetail(value) {
|
|
2889
|
+
if (isRecord3(value) && isRecord3(value.data)) {
|
|
2890
|
+
return value.data;
|
|
2891
|
+
}
|
|
2892
|
+
return isRecord3(value) ? value : {};
|
|
2893
|
+
}
|
|
2894
|
+
function assertFormTemplateDraftId(id, data, action) {
|
|
2895
|
+
const detail = formTemplateDetail(data);
|
|
2896
|
+
const originTemplateId = numericId(detail.origin_template_id);
|
|
2897
|
+
if (originTemplateId && originTemplateId > 0) {
|
|
2898
|
+
throw new Error(
|
|
2899
|
+
`Refusing to ${action} published form-template id ${id}. Use draft id ${originTemplateId}; published ids are readback-only and must not be used for export/submit/publish.`
|
|
2900
|
+
);
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2730
2903
|
function jsonPointerSegment(value) {
|
|
2731
2904
|
return value.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2732
2905
|
}
|
|
@@ -2857,7 +3030,7 @@ function lintDatasetFieldWork(value, errors) {
|
|
|
2857
3030
|
}
|
|
2858
3031
|
function isFlowTemplateWork(value) {
|
|
2859
3032
|
const data = value.data;
|
|
2860
|
-
return isRecord3(data) && (Array.isArray(data.nodes) || Array.isArray(data.periods) || Object.prototype.hasOwnProperty.call(value, "flow_type") || Object.prototype.hasOwnProperty.call(value, "flowType"));
|
|
3033
|
+
return isRecord3(data) && (Array.isArray(data.nodes) || Array.isArray(data.periods) || value.mode === "create" || Object.prototype.hasOwnProperty.call(value, "flow_type") || Object.prototype.hasOwnProperty.call(value, "flowType"));
|
|
2861
3034
|
}
|
|
2862
3035
|
function flowTemplateMainFlowTypeError(flowType) {
|
|
2863
3036
|
if (typeof flowType !== "string" || !flowType.trim()) {
|
|
@@ -2895,6 +3068,102 @@ function validateFlowTemplateIdentityStandard(id, payload) {
|
|
|
2895
3068
|
key: payload?.key ?? payload?.flow_key ?? payload?.flowKey ?? ""
|
|
2896
3069
|
});
|
|
2897
3070
|
}
|
|
3071
|
+
var FORM_DRIVEN_CREATE_HIDE_FIELDS = ["project.name", "project.brief", "project.plan_end_time"];
|
|
3072
|
+
function hasConfiguredFormTemplate(meta) {
|
|
3073
|
+
const value = meta.form_template ?? meta.formTemplate;
|
|
3074
|
+
return value !== void 0 && value !== null && String(value).trim() !== "" && String(value).trim() !== "0";
|
|
3075
|
+
}
|
|
3076
|
+
function hasConfiguredFlowTemplateFormSource(value, meta) {
|
|
3077
|
+
return hasConfiguredFormTemplate(meta) || !isEmptyTemplateReference(value.meta_form_id);
|
|
3078
|
+
}
|
|
3079
|
+
function validateFlowTemplateFormDrivenCreateBaseline(value, errors, options = {}) {
|
|
3080
|
+
const data = isRecord3(value.data) ? value.data : {};
|
|
3081
|
+
const meta = isRecord3(data.meta) ? data.meta : {};
|
|
3082
|
+
if (!options.force && !hasConfiguredFlowTemplateFormSource(value, meta)) {
|
|
3083
|
+
return;
|
|
3084
|
+
}
|
|
3085
|
+
const context = options.context || "flow-template create";
|
|
3086
|
+
const missing = [];
|
|
3087
|
+
const hideFields = Array.isArray(meta.hide_fields) ? meta.hide_fields.map(String) : [];
|
|
3088
|
+
for (const field of FORM_DRIVEN_CREATE_HIDE_FIELDS) {
|
|
3089
|
+
if (!hideFields.includes(field)) {
|
|
3090
|
+
missing.push(`data.meta.hide_fields must include ${field}`);
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
if (meta.use_template_project_name !== true) {
|
|
3094
|
+
missing.push("data.meta.use_template_project_name must be true");
|
|
3095
|
+
}
|
|
3096
|
+
if (typeof meta.project_name_template !== "string" || !meta.project_name_template.trim()) {
|
|
3097
|
+
missing.push("data.meta.project_name_template must be a non-empty string");
|
|
3098
|
+
}
|
|
3099
|
+
if (missing.length === 0) {
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
const message = `${context} for form-driven project creation requires default system-field hiding and a project name template: ${missing.join("; ")}.`;
|
|
3103
|
+
if (errors) {
|
|
3104
|
+
errors.push(message);
|
|
3105
|
+
return;
|
|
3106
|
+
}
|
|
3107
|
+
throw new Error(message);
|
|
3108
|
+
}
|
|
3109
|
+
function isEmptyTemplateReference(value) {
|
|
3110
|
+
return value === void 0 || value === null || value === "" || value === 0 || value === "0";
|
|
3111
|
+
}
|
|
3112
|
+
function isRemoteNumericTemplateId(value) {
|
|
3113
|
+
if (typeof value === "number") {
|
|
3114
|
+
return Number.isInteger(value) && Number.isFinite(value) && value > 0;
|
|
3115
|
+
}
|
|
3116
|
+
if (typeof value === "string") {
|
|
3117
|
+
return /^[1-9]\d*$/.test(value.trim());
|
|
3118
|
+
}
|
|
3119
|
+
return false;
|
|
3120
|
+
}
|
|
3121
|
+
function addFlowTemplateRemoteIdError(errors, pathName, value) {
|
|
3122
|
+
errors.push(
|
|
3123
|
+
`${pathName} must be a current-environment remote numeric id; got ${JSON.stringify(value)}. Do not write local uuid or directory references into flow-template payloads.`
|
|
3124
|
+
);
|
|
3125
|
+
}
|
|
3126
|
+
function validateFlowTemplateRemoteTemplateRefs(value, errors) {
|
|
3127
|
+
const nextErrors = [];
|
|
3128
|
+
const data = isRecord3(value.data) ? value.data : {};
|
|
3129
|
+
const meta = isRecord3(data.meta) ? data.meta : {};
|
|
3130
|
+
const metaRefs = [
|
|
3131
|
+
["meta_form_id", value.meta_form_id],
|
|
3132
|
+
["data.meta.form_template", meta.form_template],
|
|
3133
|
+
["data.meta.table_list_template", meta.table_list_template],
|
|
3134
|
+
["data.meta.table_filter_template", meta.table_filter_template],
|
|
3135
|
+
["data.meta.step_detail_id", meta.step_detail_id]
|
|
3136
|
+
];
|
|
3137
|
+
for (const [pathName, refValue] of metaRefs) {
|
|
3138
|
+
if (!isEmptyTemplateReference(refValue) && !isRemoteNumericTemplateId(refValue)) {
|
|
3139
|
+
addFlowTemplateRemoteIdError(nextErrors, pathName, refValue);
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
3143
|
+
nodes.forEach((node, index) => {
|
|
3144
|
+
if (!isRecord3(node)) {
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
const nodeName = typeof node.name === "string" && node.name.trim() ? node.name.trim() : `nodes[${index}]`;
|
|
3148
|
+
const nodeRefs = [
|
|
3149
|
+
[`data.nodes[${index}].form_template (${nodeName})`, node.form_template],
|
|
3150
|
+
[`data.nodes[${index}].step_detail_id (${nodeName})`, node.step_detail_id]
|
|
3151
|
+
];
|
|
3152
|
+
for (const [pathName, refValue] of nodeRefs) {
|
|
3153
|
+
if (!isEmptyTemplateReference(refValue) && !isRemoteNumericTemplateId(refValue)) {
|
|
3154
|
+
addFlowTemplateRemoteIdError(nextErrors, pathName, refValue);
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
});
|
|
3158
|
+
if (!nextErrors.length) {
|
|
3159
|
+
return;
|
|
3160
|
+
}
|
|
3161
|
+
if (errors) {
|
|
3162
|
+
errors.push(...nextErrors);
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3165
|
+
throw new Error(`flow-template online template reference gate failed: ${nextErrors.join("; ")}`);
|
|
3166
|
+
}
|
|
2898
3167
|
function lintTemplateFieldReferences(value, errors) {
|
|
2899
3168
|
const content = typeof value.content === "string" ? (() => {
|
|
2900
3169
|
try {
|
|
@@ -2911,6 +3180,255 @@ function lintTemplateFieldReferences(value, errors) {
|
|
|
2911
3180
|
}
|
|
2912
3181
|
}
|
|
2913
3182
|
}
|
|
3183
|
+
function parseTemplateContent(value, errors) {
|
|
3184
|
+
const basic = isRecord3(value.basic) ? value.basic : {};
|
|
3185
|
+
const rawContent = value.content ?? basic.content;
|
|
3186
|
+
if (typeof rawContent === "string") {
|
|
3187
|
+
try {
|
|
3188
|
+
return JSON.parse(rawContent);
|
|
3189
|
+
} catch {
|
|
3190
|
+
errors?.push("template.content must be valid JSON when it is a string.");
|
|
3191
|
+
return void 0;
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
return rawContent;
|
|
3195
|
+
}
|
|
3196
|
+
function pageTemplateType(value) {
|
|
3197
|
+
const basic = isRecord3(value.basic) ? value.basic : {};
|
|
3198
|
+
const rawType = value.type ?? basic.type;
|
|
3199
|
+
const parsed = Number(rawType);
|
|
3200
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
3201
|
+
}
|
|
3202
|
+
function textOf(value) {
|
|
3203
|
+
if (typeof value === "string") {
|
|
3204
|
+
return value;
|
|
3205
|
+
}
|
|
3206
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
3207
|
+
return String(value);
|
|
3208
|
+
}
|
|
3209
|
+
if (Array.isArray(value)) {
|
|
3210
|
+
return value.map(textOf).join(" ");
|
|
3211
|
+
}
|
|
3212
|
+
if (isRecord3(value)) {
|
|
3213
|
+
return Object.values(value).map(textOf).join(" ");
|
|
3214
|
+
}
|
|
3215
|
+
return "";
|
|
3216
|
+
}
|
|
3217
|
+
function collectTextAtKeys(value, keys, result = []) {
|
|
3218
|
+
if (Array.isArray(value)) {
|
|
3219
|
+
value.forEach((item) => collectTextAtKeys(item, keys, result));
|
|
3220
|
+
return result;
|
|
3221
|
+
}
|
|
3222
|
+
if (!isRecord3(value)) {
|
|
3223
|
+
return result;
|
|
3224
|
+
}
|
|
3225
|
+
Object.entries(value).forEach(([key, item]) => {
|
|
3226
|
+
if (keys.has(key)) {
|
|
3227
|
+
result.push(textOf(item));
|
|
3228
|
+
}
|
|
3229
|
+
collectTextAtKeys(item, keys, result);
|
|
3230
|
+
});
|
|
3231
|
+
return result;
|
|
3232
|
+
}
|
|
3233
|
+
function lintListTemplateQuerySafety(content, errors) {
|
|
3234
|
+
const queryTexts = collectTextAtKeys(
|
|
3235
|
+
{
|
|
3236
|
+
config: content.config,
|
|
3237
|
+
customQuery: content.customQuery,
|
|
3238
|
+
beforeSearch: content.beforeSearch,
|
|
3239
|
+
tabFilters: content.tabFilters
|
|
3240
|
+
},
|
|
3241
|
+
/* @__PURE__ */ new Set(["$template", "customQuery", "beforeSearch", "tabFilters", "query", "url", "api", "dataSource"])
|
|
3242
|
+
);
|
|
3243
|
+
queryTexts.forEach((text5) => {
|
|
3244
|
+
if (!text5.trim() || /bpmax-allow-user-scope-project-list\s*:/i.test(text5)) {
|
|
3245
|
+
return;
|
|
3246
|
+
}
|
|
3247
|
+
if (/(\/bpmax\/project\/list|\/api\/project\/list|ESProjectList)/i.test(text5)) {
|
|
3248
|
+
errors.push("list-template query safety gate forbids /bpmax/project/list, /api/project/list, or ESProjectList unless the script includes bpmax-allow-user-scope-project-list: <reason>.");
|
|
3249
|
+
}
|
|
3250
|
+
if (/\bdata_set_id\b/i.test(text5) && /(raw-es-search|project\/list|ESProjectList|\$esQuery|query|search)/i.test(text5)) {
|
|
3251
|
+
errors.push("list-template query safety gate forbids using data_set_id as an ES/project query entrypoint; use data_set_key with raw-es-search or ctx.$esQuery instead.");
|
|
3252
|
+
}
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
3255
|
+
function listTemplateNodeLabel(node) {
|
|
3256
|
+
return [
|
|
3257
|
+
node.title,
|
|
3258
|
+
node.label,
|
|
3259
|
+
node.text,
|
|
3260
|
+
node.children,
|
|
3261
|
+
node.name
|
|
3262
|
+
].map(textOf).join(" ");
|
|
3263
|
+
}
|
|
3264
|
+
function nodeIcon(node) {
|
|
3265
|
+
const attribute = isRecord3(node.attribute) ? node.attribute : {};
|
|
3266
|
+
const props = isRecord3(attribute.props) ? attribute.props : {};
|
|
3267
|
+
const directIcon = typeof node.icon === "string" ? node.icon : "";
|
|
3268
|
+
const propsIcon = typeof props.icon === "string" ? props.icon : "";
|
|
3269
|
+
const inlineIcon = findInlineIconClass(node.children);
|
|
3270
|
+
return directIcon || propsIcon || inlineIcon;
|
|
3271
|
+
}
|
|
3272
|
+
function findInlineIconClass(value) {
|
|
3273
|
+
if (Array.isArray(value)) {
|
|
3274
|
+
for (const item of value) {
|
|
3275
|
+
const found = findInlineIconClass(item);
|
|
3276
|
+
if (found) {
|
|
3277
|
+
return found;
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
return "";
|
|
3281
|
+
}
|
|
3282
|
+
if (!isRecord3(value)) {
|
|
3283
|
+
return "";
|
|
3284
|
+
}
|
|
3285
|
+
const isValue = typeof value.is === "string" ? value.is.toLowerCase() : "";
|
|
3286
|
+
const attribute = isRecord3(value.attribute) ? value.attribute : {};
|
|
3287
|
+
const className = typeof attribute.class === "string" ? attribute.class : typeof value.class === "string" ? value.class : "";
|
|
3288
|
+
if (isValue === "i" && /\b(ri|el-icon)\b/.test(className)) {
|
|
3289
|
+
return className;
|
|
3290
|
+
}
|
|
3291
|
+
return findInlineIconClass(value.children);
|
|
3292
|
+
}
|
|
3293
|
+
function listTemplateNodeGuardText(node) {
|
|
3294
|
+
const attribute = isRecord3(node.attribute) ? node.attribute : {};
|
|
3295
|
+
const props = isRecord3(attribute.props) ? attribute.props : {};
|
|
3296
|
+
return [
|
|
3297
|
+
node.if,
|
|
3298
|
+
node.show,
|
|
3299
|
+
node.visible,
|
|
3300
|
+
node.disabled,
|
|
3301
|
+
props.disabled,
|
|
3302
|
+
props.confirm,
|
|
3303
|
+
props.confirmText,
|
|
3304
|
+
props.beforeClick,
|
|
3305
|
+
props.onClick,
|
|
3306
|
+
node.on,
|
|
3307
|
+
node.events
|
|
3308
|
+
].map(textOf).join(" ");
|
|
3309
|
+
}
|
|
3310
|
+
function collectListTemplateActionNodes(value, result = [], inheritedGuardText = "") {
|
|
3311
|
+
if (Array.isArray(value)) {
|
|
3312
|
+
value.forEach((item) => collectListTemplateActionNodes(item, result, inheritedGuardText));
|
|
3313
|
+
return result;
|
|
3314
|
+
}
|
|
3315
|
+
if (!isRecord3(value)) {
|
|
3316
|
+
return result;
|
|
3317
|
+
}
|
|
3318
|
+
const isValue = typeof value.is === "string" ? value.is.toLowerCase() : "";
|
|
3319
|
+
const guardText = [inheritedGuardText, listTemplateNodeGuardText(value)].filter(Boolean).join(" ");
|
|
3320
|
+
if (isValue.includes("button") || isValue.includes("dropdown-item")) {
|
|
3321
|
+
result.push({ node: value, inheritedGuardText });
|
|
3322
|
+
}
|
|
3323
|
+
Object.values(value).forEach((item) => collectListTemplateActionNodes(item, result, guardText));
|
|
3324
|
+
return result;
|
|
3325
|
+
}
|
|
3326
|
+
function isListTemplateOperationColumn(column) {
|
|
3327
|
+
const title = typeof column.title === "string" ? column.title.trim() : "";
|
|
3328
|
+
const props = isRecord3(column.props) ? column.props : {};
|
|
3329
|
+
const fixed = typeof props.fixed === "string" ? props.fixed : "";
|
|
3330
|
+
if (/^(操作|动作|Action|Actions|Operate|Operations)$/i.test(title)) {
|
|
3331
|
+
return true;
|
|
3332
|
+
}
|
|
3333
|
+
if (fixed === "right" && collectListTemplateActionNodes(column.createElement).length > 0) {
|
|
3334
|
+
return true;
|
|
3335
|
+
}
|
|
3336
|
+
return collectListTemplateActionNodes(column.createElement).length >= 2;
|
|
3337
|
+
}
|
|
3338
|
+
function classifyListTemplateAction(label) {
|
|
3339
|
+
if (/(删除|移除|作废|delete|remove|discard)/i.test(label)) {
|
|
3340
|
+
return "delete";
|
|
3341
|
+
}
|
|
3342
|
+
if (/(详情|查看|明细|detail|view|open)/i.test(label)) {
|
|
3343
|
+
return "view";
|
|
3344
|
+
}
|
|
3345
|
+
if (/(编辑|修改|edit|update)/i.test(label)) {
|
|
3346
|
+
return "edit";
|
|
3347
|
+
}
|
|
3348
|
+
return "other";
|
|
3349
|
+
}
|
|
3350
|
+
function iconMatchesAction(kind, icon) {
|
|
3351
|
+
if (!icon.trim()) {
|
|
3352
|
+
return false;
|
|
3353
|
+
}
|
|
3354
|
+
const normalized = icon.toLowerCase();
|
|
3355
|
+
if (kind === "delete") {
|
|
3356
|
+
return /(delete|trash|remove|close|clear|forbid|ri_delete|el-icon-delete)/.test(normalized);
|
|
3357
|
+
}
|
|
3358
|
+
if (kind === "view") {
|
|
3359
|
+
return /(eye|view|detail|search|document|tickets|ri_eye|el-icon-view)/.test(normalized);
|
|
3360
|
+
}
|
|
3361
|
+
if (kind === "edit") {
|
|
3362
|
+
return /(edit|pencil|write|ri_edit|el-icon-edit)/.test(normalized);
|
|
3363
|
+
}
|
|
3364
|
+
return true;
|
|
3365
|
+
}
|
|
3366
|
+
function hasDeleteAvailabilityGuard(item) {
|
|
3367
|
+
const guardText = [item.inheritedGuardText, listTemplateNodeGuardText(item.node)].filter(Boolean).join(" ");
|
|
3368
|
+
if (!guardText.trim()) {
|
|
3369
|
+
return false;
|
|
3370
|
+
}
|
|
3371
|
+
const hasInitialStatusCheck = /(status|project_status)[^;&|)]*(={2,3}|==)\s*['"]?0['"]?/i.test(guardText) || /['"]?0['"]?\s*(={2,3}|==)[^;&|)]*(status|project_status)/i.test(guardText) || /(draft|newly|created|unstarted|未开始|刚创建|新建)/i.test(guardText);
|
|
3372
|
+
const hasNotAdvancedCheck = /!\s*[^&|;]*(current_flow_step|flow_step|step|node)/i.test(guardText) || /(current_flow_step|flow_step|step|node)[^&|;]*(={2,3}|==)\s*(null|undefined|false|['"]{2})/i.test(guardText) || /(first_node|before_first|未推进|第一个节点前)/i.test(guardText);
|
|
3373
|
+
return hasInitialStatusCheck && hasNotAdvancedCheck;
|
|
3374
|
+
}
|
|
3375
|
+
function validateListTemplateActionGate(value, errors) {
|
|
3376
|
+
const nextErrors = [];
|
|
3377
|
+
const content = parseTemplateContent(value, nextErrors);
|
|
3378
|
+
if (!isRecord3(content)) {
|
|
3379
|
+
if (errors) {
|
|
3380
|
+
errors.push(...nextErrors);
|
|
3381
|
+
return;
|
|
3382
|
+
}
|
|
3383
|
+
if (nextErrors.length) {
|
|
3384
|
+
throw new Error(`list-template action gate failed: ${nextErrors.join("; ")}`);
|
|
3385
|
+
}
|
|
3386
|
+
return;
|
|
3387
|
+
}
|
|
3388
|
+
const columns = Array.isArray(content.config) ? content.config : Array.isArray(content.columns) ? content.columns : [];
|
|
3389
|
+
if (columns.length === 0) {
|
|
3390
|
+
if (errors) errors.push(...nextErrors);
|
|
3391
|
+
return;
|
|
3392
|
+
}
|
|
3393
|
+
lintListTemplateQuerySafety(content, nextErrors);
|
|
3394
|
+
const operationColumn = columns.filter(isRecord3).find(isListTemplateOperationColumn);
|
|
3395
|
+
if (!operationColumn) {
|
|
3396
|
+
nextErrors.push("list-template action gate requires an operation column when content.config has columns.");
|
|
3397
|
+
} else {
|
|
3398
|
+
const actionNodes = collectListTemplateActionNodes(operationColumn.createElement);
|
|
3399
|
+
const classified = actionNodes.map((item) => ({
|
|
3400
|
+
...item,
|
|
3401
|
+
label: listTemplateNodeLabel(item.node),
|
|
3402
|
+
icon: nodeIcon(item.node),
|
|
3403
|
+
kind: classifyListTemplateAction(listTemplateNodeLabel(item.node))
|
|
3404
|
+
}));
|
|
3405
|
+
if (!classified.some((item) => item.kind === "view")) {
|
|
3406
|
+
nextErrors.push("list-template operation column must include a view/detail action.");
|
|
3407
|
+
}
|
|
3408
|
+
if (!classified.some((item) => item.kind === "delete")) {
|
|
3409
|
+
nextErrors.push("list-template operation column must include a delete/remove action.");
|
|
3410
|
+
} else {
|
|
3411
|
+
classified.filter((item) => item.kind === "delete").forEach((item) => {
|
|
3412
|
+
if (!hasDeleteAvailabilityGuard(item)) {
|
|
3413
|
+
nextErrors.push("list-template delete action must include an availability guard based on project status/current step so only newly created projects can be deleted.");
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
}
|
|
3417
|
+
classified.filter((item) => item.kind !== "other").forEach((item) => {
|
|
3418
|
+
if (!iconMatchesAction(item.kind, item.icon)) {
|
|
3419
|
+
nextErrors.push(`list-template ${item.kind} action must use a matching icon; got ${JSON.stringify(item.icon)} for ${JSON.stringify(item.label.trim())}.`);
|
|
3420
|
+
}
|
|
3421
|
+
});
|
|
3422
|
+
}
|
|
3423
|
+
if (!nextErrors.length) {
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
if (errors) {
|
|
3427
|
+
errors.push(...nextErrors);
|
|
3428
|
+
return;
|
|
3429
|
+
}
|
|
3430
|
+
throw new Error(`list-template action gate failed: ${nextErrors.join("; ")}`);
|
|
3431
|
+
}
|
|
2914
3432
|
function validateExpectedType(domain, definition, data) {
|
|
2915
3433
|
if (definition.expectedType === void 0) {
|
|
2916
3434
|
return;
|
|
@@ -2924,6 +3442,9 @@ function validateExpectedType(domain, definition, data) {
|
|
|
2924
3442
|
}
|
|
2925
3443
|
function normalizePageTemplatePayload(domain, work) {
|
|
2926
3444
|
const definition = CONFIG_DOMAINS[domain];
|
|
3445
|
+
if (domain === "list-template") {
|
|
3446
|
+
validateListTemplateActionGate(work);
|
|
3447
|
+
}
|
|
2927
3448
|
const basic = isRecord3(work.basic) ? work.basic : work;
|
|
2928
3449
|
const rawContent = work.content ?? basic.content;
|
|
2929
3450
|
const type = definition.expectedType;
|
|
@@ -3019,6 +3540,7 @@ function normalizeFlowTemplatePayload(work) {
|
|
|
3019
3540
|
meta.form_template = work.meta_form_id;
|
|
3020
3541
|
}
|
|
3021
3542
|
data.meta = meta;
|
|
3543
|
+
validateFlowTemplateRemoteTemplateRefs({ ...work, data });
|
|
3022
3544
|
const payload = pickDefined(work, [
|
|
3023
3545
|
"name",
|
|
3024
3546
|
"flow_type",
|
|
@@ -3045,10 +3567,34 @@ function normalizeFlowTemplatePayload(work) {
|
|
|
3045
3567
|
}
|
|
3046
3568
|
return payload;
|
|
3047
3569
|
}
|
|
3570
|
+
function buildWorkspaceFlowBindingKey(flowType, flowKey) {
|
|
3571
|
+
return `${String(flowType || "default")}:${String(flowKey || "")}`;
|
|
3572
|
+
}
|
|
3573
|
+
function normalizeWorkspaceFlowItems(value) {
|
|
3574
|
+
if (!Array.isArray(value)) {
|
|
3575
|
+
return [];
|
|
3576
|
+
}
|
|
3577
|
+
return value.filter((item) => isRecord3(item)).map((item) => ({
|
|
3578
|
+
flow_type: String(item.flow_type || "default"),
|
|
3579
|
+
flow_key: String(item.flow_key || ""),
|
|
3580
|
+
only_in_workspace: normalizeInt(item.only_in_workspace ?? 0)
|
|
3581
|
+
}));
|
|
3582
|
+
}
|
|
3583
|
+
function buildWorkspaceFlowSubmitPayload(work) {
|
|
3584
|
+
const workspace = normalizeWorkspaceKey(String(work.workspace || work.key || ""));
|
|
3585
|
+
if (!workspace) {
|
|
3586
|
+
throw new Error("workspace-flow work requires workspace.");
|
|
3587
|
+
}
|
|
3588
|
+
const workspaceFlow = normalizeWorkspaceFlowItems(work.workspace_flow ?? work.flows);
|
|
3589
|
+
return {
|
|
3590
|
+
workspace,
|
|
3591
|
+
workspace_flow: workspaceFlow
|
|
3592
|
+
};
|
|
3593
|
+
}
|
|
3048
3594
|
function normalizeDatasetPayload(work) {
|
|
3049
3595
|
const mode = work.mode;
|
|
3050
|
-
if (mode !== void 0 && mode !== "edit") {
|
|
3051
|
-
throw new Error("dataset typed adapter
|
|
3596
|
+
if (mode !== void 0 && mode !== "edit" && mode !== "create") {
|
|
3597
|
+
throw new Error("dataset typed adapter supports mode edit or create. Publish/pause/cancel-refresh require dedicated lifecycle commands.");
|
|
3052
3598
|
}
|
|
3053
3599
|
const basic = isRecord3(work.basic) ? work.basic : work;
|
|
3054
3600
|
const scripts = isRecord3(work.scripts) ? work.scripts : work;
|
|
@@ -3082,8 +3628,8 @@ function normalizeDatasetPayload(work) {
|
|
|
3082
3628
|
}
|
|
3083
3629
|
function normalizeDatasetFieldPayload(work) {
|
|
3084
3630
|
const mode = work.mode;
|
|
3085
|
-
if (mode !== void 0 && mode !== "edit") {
|
|
3086
|
-
throw new Error("dataset-field typed adapter
|
|
3631
|
+
if (mode !== void 0 && mode !== "edit" && mode !== "create") {
|
|
3632
|
+
throw new Error("dataset-field typed adapter supports mode edit or create. Delete requires a dedicated adapter.");
|
|
3087
3633
|
}
|
|
3088
3634
|
const source = isRecord3(work.source) ? work.source : work;
|
|
3089
3635
|
const payload = {
|
|
@@ -3186,6 +3732,17 @@ function refreshSettingToSubmit(value) {
|
|
|
3186
3732
|
stop_refresh_count: normalizeInt(value.stopRefreshCount ?? value.stop_refresh_count ?? fallback.stop_refresh_count)
|
|
3187
3733
|
};
|
|
3188
3734
|
}
|
|
3735
|
+
var FORM_RULE_ID_KEYS = /* @__PURE__ */ new Set(["form_rule_id", "form_template_id", "id"]);
|
|
3736
|
+
var FORM_VALUE_ID_KEYS = /* @__PURE__ */ new Set(["template_id", "id"]);
|
|
3737
|
+
function stripKeys(source, keys) {
|
|
3738
|
+
const result = {};
|
|
3739
|
+
for (const [key, value] of Object.entries(source)) {
|
|
3740
|
+
if (!keys.has(key)) {
|
|
3741
|
+
result[key] = value;
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
return result;
|
|
3745
|
+
}
|
|
3189
3746
|
function normalizeRemovedFields(value) {
|
|
3190
3747
|
if (!Array.isArray(value)) {
|
|
3191
3748
|
return /* @__PURE__ */ new Set();
|
|
@@ -3194,8 +3751,8 @@ function normalizeRemovedFields(value) {
|
|
|
3194
3751
|
}
|
|
3195
3752
|
function buildStructuredFormTemplatePayload(work) {
|
|
3196
3753
|
const mode = work.mode;
|
|
3197
|
-
if (mode !== "edit") {
|
|
3198
|
-
throw new Error("form-template structured work
|
|
3754
|
+
if (mode !== "edit" && mode !== "create") {
|
|
3755
|
+
throw new Error("form-template structured work requires mode edit or create.");
|
|
3199
3756
|
}
|
|
3200
3757
|
if (!isRecord3(work.basic)) {
|
|
3201
3758
|
throw new Error("form-template structured work requires basic object.");
|
|
@@ -3236,8 +3793,8 @@ function buildStructuredFormTemplatePayload(work) {
|
|
|
3236
3793
|
if (bundle.value.field_type !== bundle.rule.type) {
|
|
3237
3794
|
throw new Error(`form-template field_type mismatch for ${ref}.`);
|
|
3238
3795
|
}
|
|
3239
|
-
const rule = { ...bundle.rule };
|
|
3240
|
-
const value = { ...bundle.value };
|
|
3796
|
+
const rule = mode === "create" ? stripKeys(bundle.rule, FORM_RULE_ID_KEYS) : { ...bundle.rule };
|
|
3797
|
+
const value = mode === "create" ? stripKeys(bundle.value, FORM_VALUE_ID_KEYS) : { ...bundle.value };
|
|
3241
3798
|
submitRow.push(rule);
|
|
3242
3799
|
valueItems.push(value);
|
|
3243
3800
|
seen.add(ref);
|
|
@@ -3265,6 +3822,16 @@ function buildStructuredFormTemplatePayload(work) {
|
|
|
3265
3822
|
value: valueItems
|
|
3266
3823
|
};
|
|
3267
3824
|
}
|
|
3825
|
+
function stripFormTemplateCreateIds(payload) {
|
|
3826
|
+
const next = { ...payload };
|
|
3827
|
+
if (Array.isArray(next.rule)) {
|
|
3828
|
+
next.rule = next.rule.map((row) => Array.isArray(row) ? row.map((item) => isRecord3(item) ? stripKeys(item, FORM_RULE_ID_KEYS) : item) : row);
|
|
3829
|
+
}
|
|
3830
|
+
if (Array.isArray(next.value)) {
|
|
3831
|
+
next.value = next.value.map((item) => isRecord3(item) ? stripKeys(item, FORM_VALUE_ID_KEYS) : item);
|
|
3832
|
+
}
|
|
3833
|
+
return next;
|
|
3834
|
+
}
|
|
3268
3835
|
function formTemplateRawToStructured(raw) {
|
|
3269
3836
|
const ruleRows = Array.isArray(raw.rule) ? raw.rule : [];
|
|
3270
3837
|
const values = Array.isArray(raw.value) ? raw.value : [];
|
|
@@ -3527,6 +4094,13 @@ function parseApiPlatformIdentity(id) {
|
|
|
3527
4094
|
}
|
|
3528
4095
|
return { layer: "api", value };
|
|
3529
4096
|
}
|
|
4097
|
+
if (trimmed.startsWith("binding:")) {
|
|
4098
|
+
const value = trimmed.slice("binding:".length).trim();
|
|
4099
|
+
if (!value) {
|
|
4100
|
+
throw new Error("api-platform binding id must include id.");
|
|
4101
|
+
}
|
|
4102
|
+
return { layer: "binding", value };
|
|
4103
|
+
}
|
|
3530
4104
|
return { layer: "platform", value: trimmed };
|
|
3531
4105
|
}
|
|
3532
4106
|
function firstRecord(value) {
|
|
@@ -3926,11 +4500,15 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
|
|
|
3926
4500
|
if (isRecord3(work.basic) && Array.isArray(work.layout) && isRecord3(work.fields)) {
|
|
3927
4501
|
return buildStructuredFormTemplatePayload(work);
|
|
3928
4502
|
}
|
|
3929
|
-
|
|
4503
|
+
const payload = pickDefined(work, ["name", "desc", "category", "option", "rule", "value"]);
|
|
4504
|
+
return work.mode === "create" ? stripFormTemplateCreateIds(payload) : payload;
|
|
3930
4505
|
}
|
|
3931
4506
|
if (domain === "flow-template") {
|
|
3932
4507
|
return normalizeFlowTemplatePayload(work);
|
|
3933
4508
|
}
|
|
4509
|
+
if (domain === "workspace-flow") {
|
|
4510
|
+
return buildWorkspaceFlowSubmitPayload(work);
|
|
4511
|
+
}
|
|
3934
4512
|
if (domain === "dataset") {
|
|
3935
4513
|
return normalizeDatasetPayload(work);
|
|
3936
4514
|
}
|
|
@@ -3961,11 +4539,110 @@ function responseDataId(response) {
|
|
|
3961
4539
|
}
|
|
3962
4540
|
return void 0;
|
|
3963
4541
|
}
|
|
4542
|
+
function responseValue(response, keys) {
|
|
4543
|
+
if (!isRecord3(response)) {
|
|
4544
|
+
return void 0;
|
|
4545
|
+
}
|
|
4546
|
+
for (const key of keys) {
|
|
4547
|
+
if (response[key] !== void 0) return response[key];
|
|
4548
|
+
}
|
|
4549
|
+
if (isRecord3(response.data)) {
|
|
4550
|
+
for (const key of keys) {
|
|
4551
|
+
if (response.data[key] !== void 0) return response.data[key];
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
return void 0;
|
|
4555
|
+
}
|
|
4556
|
+
function responseFlowType(response) {
|
|
4557
|
+
const flowType = responseValue(response, ["flow_type", "flowType"]);
|
|
4558
|
+
if (typeof flowType !== "string" || !STANDARD_MAIN_FLOW_TYPE.test(flowType)) {
|
|
4559
|
+
throw new Error(`flow-template create did not return a platform flow_type; got ${String(flowType)}.`);
|
|
4560
|
+
}
|
|
4561
|
+
return flowType;
|
|
4562
|
+
}
|
|
4563
|
+
function operationMethod(value) {
|
|
4564
|
+
return isRecord3(value) && typeof value.method === "string" ? value.method.toUpperCase() : "";
|
|
4565
|
+
}
|
|
4566
|
+
function aggregatePayloadHasNonCreateOperations(domain, payload) {
|
|
4567
|
+
if (domain === "role") {
|
|
4568
|
+
return operationMethod(payload.role) !== "POST" || Array.isArray(payload.pointOps) && payload.pointOps.some((op) => operationMethod(op) !== "POST") || Array.isArray(payload.memberOps) && payload.memberOps.some((op) => operationMethod(op) !== "POST");
|
|
4569
|
+
}
|
|
4570
|
+
return Array.isArray(payload.operations) && payload.operations.some((op) => operationMethod(op) !== "POST");
|
|
4571
|
+
}
|
|
4572
|
+
function apiPlatformDeletePath(id) {
|
|
4573
|
+
const identity = parseApiPlatformIdentity(id);
|
|
4574
|
+
if (identity.layer === "platform") {
|
|
4575
|
+
if (/^\d+$/.test(identity.value)) {
|
|
4576
|
+
return `/api_platform/${identity.value}`;
|
|
4577
|
+
}
|
|
4578
|
+
throw new Error("api-platform delete for platform requires a numeric platform id. Use platform:<id>.");
|
|
4579
|
+
}
|
|
4580
|
+
if (identity.layer === "instance") {
|
|
4581
|
+
return `/api_platform_instance/${identity.value}`;
|
|
4582
|
+
}
|
|
4583
|
+
if (identity.layer === "api") {
|
|
4584
|
+
return `/api_proxy/${identity.value}`;
|
|
4585
|
+
}
|
|
4586
|
+
return `/api_proxy_entity_binding/${identity.value}`;
|
|
4587
|
+
}
|
|
4588
|
+
function parseWorkspaceFlowDeleteId(id, profile) {
|
|
4589
|
+
const [workspacePart = "", flowType = "", flowKey = ""] = id.split("|");
|
|
4590
|
+
const workspace = normalizeWorkspaceKey(workspacePart || profile.config.workspace || "");
|
|
4591
|
+
if (!workspace || !flowType) {
|
|
4592
|
+
throw new Error('workspace-flow delete id must be "<workspace>|<flow_type>|<flow_key>". Use an empty final flow_key for main flows.');
|
|
4593
|
+
}
|
|
4594
|
+
return { workspace, flowType, flowKey };
|
|
4595
|
+
}
|
|
4596
|
+
async function deleteWorkspaceFlowBinding(profile, id, confirm3) {
|
|
4597
|
+
const definition = CONFIG_DOMAINS["workspace-flow"];
|
|
4598
|
+
await ensureConfigCapability(profile, `${definition.capability}.delete`);
|
|
4599
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4600
|
+
const { workspace, flowType, flowKey } = parseWorkspaceFlowDeleteId(id, profile);
|
|
4601
|
+
const current = await readRemoteConfigDomain(profile, "workspace-flow", workspace, definition);
|
|
4602
|
+
const bindings = isRecord3(current) ? normalizeWorkspaceFlowItems(current.workspace_flow) : [];
|
|
4603
|
+
const nextBindings = bindings.filter(
|
|
4604
|
+
(item) => buildWorkspaceFlowBindingKey(item.flow_type, item.flow_key) !== buildWorkspaceFlowBindingKey(flowType, flowKey)
|
|
4605
|
+
);
|
|
4606
|
+
const expectedConfirm = `delete workspace-flow ${id}`;
|
|
4607
|
+
if (confirm3 !== expectedConfirm) {
|
|
4608
|
+
return {
|
|
4609
|
+
dry_run: true,
|
|
4610
|
+
domain: "workspace-flow",
|
|
4611
|
+
id,
|
|
4612
|
+
endpoint: "/workspace/workspace_flow",
|
|
4613
|
+
method: "PUT",
|
|
4614
|
+
params: { workspace },
|
|
4615
|
+
delete_binding: { flow_type: flowType, flow_key: flowKey },
|
|
4616
|
+
before_count: bindings.length,
|
|
4617
|
+
after_count: nextBindings.length,
|
|
4618
|
+
next: `Run again with --confirm "${expectedConfirm}" to delete.`
|
|
4619
|
+
};
|
|
4620
|
+
}
|
|
4621
|
+
const response = await apiRequest(
|
|
4622
|
+
createApiClient(profile),
|
|
4623
|
+
"PUT",
|
|
4624
|
+
"/workspace/workspace_flow",
|
|
4625
|
+
{ data: { workspace_flow: nextBindings }, params: { workspace }, capability: `${definition.capability}.delete` }
|
|
4626
|
+
);
|
|
4627
|
+
const readback = await readRemoteConfigDomain(profile, "workspace-flow", workspace, definition);
|
|
4628
|
+
return {
|
|
4629
|
+
dry_run: false,
|
|
4630
|
+
domain: "workspace-flow",
|
|
4631
|
+
id,
|
|
4632
|
+
endpoint: "/workspace/workspace_flow",
|
|
4633
|
+
method: "PUT",
|
|
4634
|
+
response,
|
|
4635
|
+
readback_hash: hashJson(readback)
|
|
4636
|
+
};
|
|
4637
|
+
}
|
|
3964
4638
|
async function submitRoleOperations(profile, id, submit) {
|
|
3965
4639
|
const definition = CONFIG_DOMAINS.role;
|
|
3966
|
-
const
|
|
3967
|
-
if (
|
|
3968
|
-
|
|
4640
|
+
const createMode = isRecord3(submit.meta) && submit.meta.mode === "create";
|
|
4641
|
+
if (!createMode) {
|
|
4642
|
+
const current = await collectRoleAggregate(profile, id);
|
|
4643
|
+
if (hashJson(current.raw) !== submit.base_hash) {
|
|
4644
|
+
throw new Error("Remote config changed after export. Re-export before submitting.");
|
|
4645
|
+
}
|
|
3969
4646
|
}
|
|
3970
4647
|
const payload = submit.payload;
|
|
3971
4648
|
if (!isRecord3(payload) || !isRecord3(payload.role)) {
|
|
@@ -3981,7 +4658,10 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
3981
4658
|
client,
|
|
3982
4659
|
op.method,
|
|
3983
4660
|
op.path,
|
|
3984
|
-
{
|
|
4661
|
+
{
|
|
4662
|
+
data: op.body === null ? void 0 : op.body,
|
|
4663
|
+
capability: op.method === "POST" ? `${definition.capability}.create` : op.method === "DELETE" ? `${definition.capability}.delete` : `${definition.capability}.submit`
|
|
4664
|
+
}
|
|
3985
4665
|
));
|
|
3986
4666
|
}
|
|
3987
4667
|
const roleMethod = String(payload.role.method || "");
|
|
@@ -3990,7 +4670,7 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
3990
4670
|
client,
|
|
3991
4671
|
roleMethod,
|
|
3992
4672
|
rolePath,
|
|
3993
|
-
{ data: payload.role.body, capability: `${definition.capability}.submit` }
|
|
4673
|
+
{ data: payload.role.body, capability: roleMethod === "POST" ? `${definition.capability}.create` : `${definition.capability}.submit` }
|
|
3994
4674
|
);
|
|
3995
4675
|
const resolvedRoleId = responseDataId(roleResponse) ?? payload.role.id ?? id;
|
|
3996
4676
|
const memberResponses = [];
|
|
@@ -4009,7 +4689,10 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
4009
4689
|
client,
|
|
4010
4690
|
op.method,
|
|
4011
4691
|
op.path,
|
|
4012
|
-
{
|
|
4692
|
+
{
|
|
4693
|
+
data: body,
|
|
4694
|
+
capability: op.method === "POST" ? `${definition.capability}.create` : op.method === "DELETE" ? `${definition.capability}.delete` : `${definition.capability}.submit`
|
|
4695
|
+
}
|
|
4013
4696
|
));
|
|
4014
4697
|
}
|
|
4015
4698
|
return {
|
|
@@ -4020,7 +4703,7 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
4020
4703
|
readback_hash: hashJson((await collectRoleAggregate(profile, String(resolvedRoleId))).raw)
|
|
4021
4704
|
};
|
|
4022
4705
|
}
|
|
4023
|
-
async function submitOperationPlan(profile,
|
|
4706
|
+
async function submitOperationPlan(profile, capabilityPrefix, operations) {
|
|
4024
4707
|
if (!Array.isArray(operations)) {
|
|
4025
4708
|
throw new Error("Config submit payload must contain operations array.");
|
|
4026
4709
|
}
|
|
@@ -4030,14 +4713,17 @@ async function submitOperationPlan(profile, capability, operations) {
|
|
|
4030
4713
|
if (!isRecord3(op) || typeof op.method !== "string" || typeof op.path !== "string") {
|
|
4031
4714
|
throw new Error("Invalid config submit operation.");
|
|
4032
4715
|
}
|
|
4033
|
-
if (op.method !== "POST" && op.method !== "PUT") {
|
|
4716
|
+
if (op.method !== "POST" && op.method !== "PUT" && op.method !== "DELETE") {
|
|
4034
4717
|
throw new Error(`Unsupported config submit operation method: ${op.method}.`);
|
|
4035
4718
|
}
|
|
4036
4719
|
responses.push(await apiRequest(
|
|
4037
4720
|
client,
|
|
4038
4721
|
op.method,
|
|
4039
4722
|
op.path,
|
|
4040
|
-
{
|
|
4723
|
+
{
|
|
4724
|
+
data: op.method === "DELETE" ? void 0 : op.payload,
|
|
4725
|
+
capability: op.method === "POST" ? `${capabilityPrefix}.create` : op.method === "DELETE" ? `${capabilityPrefix}.delete` : `${capabilityPrefix}.submit`
|
|
4726
|
+
}
|
|
4041
4727
|
));
|
|
4042
4728
|
}
|
|
4043
4729
|
return responses;
|
|
@@ -4047,15 +4733,299 @@ async function submitAggregateConfigDomain(profile, domain, id, submit) {
|
|
|
4047
4733
|
if (!isRecord3(payload) || !Array.isArray(payload.operations)) {
|
|
4048
4734
|
throw new Error(`${domain} submit payload must contain an operation plan.`);
|
|
4049
4735
|
}
|
|
4050
|
-
const responses = await submitOperationPlan(profile,
|
|
4736
|
+
const responses = await submitOperationPlan(profile, CONFIG_DOMAINS[domain].capability, payload.operations);
|
|
4737
|
+
if (isRecord3(submit.meta) && submit.meta.mode === "create") {
|
|
4738
|
+
return {
|
|
4739
|
+
operation_responses: responses,
|
|
4740
|
+
readback_hash: null
|
|
4741
|
+
};
|
|
4742
|
+
}
|
|
4051
4743
|
const current = domain === "api-platform" ? await collectApiPlatformAggregate(profile, id) : await collectNavConfigAggregate(profile, id);
|
|
4052
4744
|
return {
|
|
4053
4745
|
operation_responses: responses,
|
|
4054
4746
|
readback_hash: hashJson(current.raw)
|
|
4055
4747
|
};
|
|
4056
4748
|
}
|
|
4749
|
+
async function createFlowTemplateFromWork(config, profile, workFile, confirm3, options = {}) {
|
|
4750
|
+
void config;
|
|
4751
|
+
const definition = CONFIG_DOMAINS["flow-template"];
|
|
4752
|
+
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
4753
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
4754
|
+
const work = await readJsonFile(workFile);
|
|
4755
|
+
if (!isRecord3(work)) {
|
|
4756
|
+
throw new Error("flow-template create requires a work JSON object.");
|
|
4757
|
+
}
|
|
4758
|
+
validateFlowTemplateRemoteTemplateRefs(work);
|
|
4759
|
+
validateFlowTemplateFormDrivenCreateBaseline(work, void 0, { context: "flow-template create" });
|
|
4760
|
+
const createShell = {
|
|
4761
|
+
name: String(work.name || ""),
|
|
4762
|
+
category: work.category || "system",
|
|
4763
|
+
data: {
|
|
4764
|
+
nodes: [],
|
|
4765
|
+
periods: []
|
|
4766
|
+
}
|
|
4767
|
+
};
|
|
4768
|
+
if (!createShell.name) {
|
|
4769
|
+
throw new Error("flow-template create requires name.");
|
|
4770
|
+
}
|
|
4771
|
+
const expectedConfirm = `create flow-template ${createShell.name}`;
|
|
4772
|
+
if (confirm3 !== expectedConfirm) {
|
|
4773
|
+
return {
|
|
4774
|
+
dry_run: true,
|
|
4775
|
+
domain: "flow-template",
|
|
4776
|
+
create_endpoint: "/flow/flow_type",
|
|
4777
|
+
create_payload: createShell,
|
|
4778
|
+
draft_endpoint: "/flow?flow_type=<platform-flow-type>&publish=2",
|
|
4779
|
+
...options.publishLive ? { live_endpoint: "/flow?flow_type=<platform-flow-type>&publish=1" } : {},
|
|
4780
|
+
next: `Run again with --confirm "${expectedConfirm}" to create.`
|
|
4781
|
+
};
|
|
4782
|
+
}
|
|
4783
|
+
const client = createApiClient(profile);
|
|
4784
|
+
const createResponse = await apiRequest(
|
|
4785
|
+
client,
|
|
4786
|
+
"POST",
|
|
4787
|
+
"/flow/flow_type",
|
|
4788
|
+
{ data: createShell, capability: `${definition.capability}.create` }
|
|
4789
|
+
);
|
|
4790
|
+
const flowType = responseFlowType(createResponse);
|
|
4791
|
+
const payload = normalizeFlowTemplatePayload({
|
|
4792
|
+
...work,
|
|
4793
|
+
flow_type: flowType,
|
|
4794
|
+
key: "",
|
|
4795
|
+
type: work.type || "main"
|
|
4796
|
+
});
|
|
4797
|
+
const updateTime = payload.update_time;
|
|
4798
|
+
delete payload.publish_live;
|
|
4799
|
+
delete payload.update_time;
|
|
4800
|
+
const draftEndpoint = `/flow?${flowIdentityQuery({ kind: "flow_type", flowType }, {
|
|
4801
|
+
publish: 2,
|
|
4802
|
+
...updateTime !== void 0 && updateTime !== null && updateTime !== "" ? { update_time: String(updateTime) } : {}
|
|
4803
|
+
})}`;
|
|
4804
|
+
const draftResponse = await apiRequest(
|
|
4805
|
+
client,
|
|
4806
|
+
"PUT",
|
|
4807
|
+
draftEndpoint,
|
|
4808
|
+
{ data: payload, capability: `${definition.capability}.submit` }
|
|
4809
|
+
);
|
|
4810
|
+
let liveResponse = null;
|
|
4811
|
+
let liveEndpoint = null;
|
|
4812
|
+
if (options.publishLive) {
|
|
4813
|
+
liveEndpoint = `/flow?${flowIdentityQuery({ kind: "flow_type", flowType }, {
|
|
4814
|
+
publish: 1,
|
|
4815
|
+
...updateTime !== void 0 && updateTime !== null && updateTime !== "" ? { update_time: String(updateTime) } : {}
|
|
4816
|
+
})}`;
|
|
4817
|
+
liveResponse = await apiRequest(
|
|
4818
|
+
client,
|
|
4819
|
+
"PUT",
|
|
4820
|
+
liveEndpoint,
|
|
4821
|
+
{ data: payload, capability: `${definition.capability}.submit` }
|
|
4822
|
+
);
|
|
4823
|
+
}
|
|
4824
|
+
const readback = await apiRequest(
|
|
4825
|
+
client,
|
|
4826
|
+
"GET",
|
|
4827
|
+
`/flow?${flowIdentityQuery({ kind: "flow_type", flowType }, { draft: 1, skip_i18n: "true" })}`,
|
|
4828
|
+
{ capability: `${definition.capability}.export` }
|
|
4829
|
+
);
|
|
4830
|
+
return {
|
|
4831
|
+
dry_run: false,
|
|
4832
|
+
domain: "flow-template",
|
|
4833
|
+
flow_type: flowType,
|
|
4834
|
+
create_response: createResponse,
|
|
4835
|
+
draft_endpoint: draftEndpoint,
|
|
4836
|
+
draft_response: draftResponse,
|
|
4837
|
+
...liveEndpoint ? { live_endpoint: liveEndpoint, live_response: liveResponse } : {},
|
|
4838
|
+
readback_hash: hashJson(readback)
|
|
4839
|
+
};
|
|
4840
|
+
}
|
|
4841
|
+
async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile, confirm3, options = { workspace: "", name: "" }) {
|
|
4842
|
+
void config;
|
|
4843
|
+
const formDefinition = CONFIG_DOMAINS["form-template"];
|
|
4844
|
+
const flowDefinition = CONFIG_DOMAINS["flow-template"];
|
|
4845
|
+
const workspaceDefinition = CONFIG_DOMAINS["workspace-flow"];
|
|
4846
|
+
await ensureConfigCapability(profile, "config.flow_app.create");
|
|
4847
|
+
await ensureConfigCapability(profile, `${formDefinition.capability}.create`);
|
|
4848
|
+
await ensureConfigCapability(profile, `${formDefinition.capability}.submit`);
|
|
4849
|
+
await ensureConfigCapability(profile, `${formDefinition.capability}.export`);
|
|
4850
|
+
await ensureConfigCapability(profile, `${flowDefinition.capability}.create`);
|
|
4851
|
+
await ensureConfigCapability(profile, `${flowDefinition.capability}.submit`);
|
|
4852
|
+
await ensureConfigCapability(profile, `${flowDefinition.capability}.export`);
|
|
4853
|
+
await ensureConfigCapability(profile, `${workspaceDefinition.capability}.submit`);
|
|
4854
|
+
await ensureConfigCapability(profile, `${workspaceDefinition.capability}.export`);
|
|
4855
|
+
const workspace = normalizeWorkspaceKey(options.workspace || profile.config.workspace);
|
|
4856
|
+
const name = options.name.trim();
|
|
4857
|
+
if (!workspace) {
|
|
4858
|
+
throw new Error("flow-app create requires workspace.");
|
|
4859
|
+
}
|
|
4860
|
+
if (!name) {
|
|
4861
|
+
throw new Error("flow-app create requires name.");
|
|
4862
|
+
}
|
|
4863
|
+
const formWork = await readJsonFile(formWorkFile);
|
|
4864
|
+
const flowWork = await readJsonFile(flowWorkFile);
|
|
4865
|
+
if (!isRecord3(formWork) || formWork.mode !== "create") {
|
|
4866
|
+
throw new Error("flow-app create requires form work with mode=create.");
|
|
4867
|
+
}
|
|
4868
|
+
const formPayload = buildDomainSubmitPayload("form-template", formWork);
|
|
4869
|
+
const flowWorkRecord = isRecord3(flowWork) ? flowWork : {};
|
|
4870
|
+
validateFlowTemplateRemoteTemplateRefs(flowWorkRecord);
|
|
4871
|
+
validateFlowTemplateFormDrivenCreateBaseline(flowWorkRecord, void 0, {
|
|
4872
|
+
force: true,
|
|
4873
|
+
context: "flow-app create"
|
|
4874
|
+
});
|
|
4875
|
+
const flowShell = {
|
|
4876
|
+
name: String(flowWorkRecord.name || name),
|
|
4877
|
+
category: flowWorkRecord.category || "system",
|
|
4878
|
+
data: {
|
|
4879
|
+
nodes: [],
|
|
4880
|
+
periods: []
|
|
4881
|
+
}
|
|
4882
|
+
};
|
|
4883
|
+
const expectedConfirm = `create flow-app ${name} in ${workspace}`;
|
|
4884
|
+
const dryRunPlan = {
|
|
4885
|
+
operations: [
|
|
4886
|
+
{ step: "create_form_template", method: "POST", path: "/form_template", payload: formPayload },
|
|
4887
|
+
{ step: "publish_form_template", method: "POST", path: "/form_template/publish", payload: { id: "<draft-form-id>" } },
|
|
4888
|
+
{ step: "create_flow_template", method: "POST", path: "/flow/flow_type", payload: flowShell },
|
|
4889
|
+
{ step: "save_flow_draft", method: "PUT", path: "/flow?flow_type=<platform-flow-type>&publish=2" },
|
|
4890
|
+
...options.publishLive !== false ? [{ step: "publish_flow_live", method: "PUT", path: "/flow?flow_type=<platform-flow-type>&publish=1" }] : [],
|
|
4891
|
+
{ step: "bind_workspace_flow", method: "PUT", path: "/workspace/workspace_flow", params: { workspace } },
|
|
4892
|
+
{ step: "verify_workspace_binding", method: "GET", path: "/workspace/by_key", params: { key: workspace } }
|
|
4893
|
+
]
|
|
4894
|
+
};
|
|
4895
|
+
if (confirm3 !== expectedConfirm) {
|
|
4896
|
+
return {
|
|
4897
|
+
dry_run: true,
|
|
4898
|
+
domain: "flow-app",
|
|
4899
|
+
workspace,
|
|
4900
|
+
name,
|
|
4901
|
+
operation_plan: dryRunPlan,
|
|
4902
|
+
next: `Run again with --confirm "${expectedConfirm}" to create.`
|
|
4903
|
+
};
|
|
4904
|
+
}
|
|
4905
|
+
const client = createApiClient(profile);
|
|
4906
|
+
const createdResources = {};
|
|
4907
|
+
try {
|
|
4908
|
+
const formResponse = await apiRequest(
|
|
4909
|
+
client,
|
|
4910
|
+
"POST",
|
|
4911
|
+
"/form_template",
|
|
4912
|
+
{ data: formPayload, capability: `${formDefinition.capability}.create` }
|
|
4913
|
+
);
|
|
4914
|
+
const draftFormId = responseDataId(formResponse);
|
|
4915
|
+
if (draftFormId === void 0 || draftFormId === null || draftFormId === "") {
|
|
4916
|
+
throw new Error("flow-app create did not receive a draft form-template id.");
|
|
4917
|
+
}
|
|
4918
|
+
createdResources.draft_form_id = draftFormId;
|
|
4919
|
+
const formPublishResponse = await apiRequest(
|
|
4920
|
+
client,
|
|
4921
|
+
"POST",
|
|
4922
|
+
"/form_template/publish",
|
|
4923
|
+
{ data: { id: draftFormId }, capability: `${formDefinition.capability}.submit` }
|
|
4924
|
+
);
|
|
4925
|
+
const publishedFormId = responseDataId(formPublishResponse) ?? draftFormId;
|
|
4926
|
+
createdResources.published_form_id = publishedFormId;
|
|
4927
|
+
const flowCreateResponse = await apiRequest(
|
|
4928
|
+
client,
|
|
4929
|
+
"POST",
|
|
4930
|
+
"/flow/flow_type",
|
|
4931
|
+
{ data: flowShell, capability: `${flowDefinition.capability}.create` }
|
|
4932
|
+
);
|
|
4933
|
+
const flowType = responseFlowType(flowCreateResponse);
|
|
4934
|
+
createdResources.flow_type = flowType;
|
|
4935
|
+
const flowData = isRecord3(flowWorkRecord.data) ? { ...flowWorkRecord.data } : {};
|
|
4936
|
+
const flowMeta = isRecord3(flowData.meta) ? { ...flowData.meta } : {};
|
|
4937
|
+
flowMeta.form_template = publishedFormId;
|
|
4938
|
+
flowData.meta = flowMeta;
|
|
4939
|
+
const flowPayload = normalizeFlowTemplatePayload({
|
|
4940
|
+
...flowWorkRecord,
|
|
4941
|
+
name: flowShell.name,
|
|
4942
|
+
flow_type: flowType,
|
|
4943
|
+
key: "",
|
|
4944
|
+
type: flowWorkRecord.type || "main",
|
|
4945
|
+
meta_form_id: publishedFormId,
|
|
4946
|
+
data: flowData
|
|
4947
|
+
});
|
|
4948
|
+
const updateTime = flowPayload.update_time;
|
|
4949
|
+
delete flowPayload.publish_live;
|
|
4950
|
+
delete flowPayload.update_time;
|
|
4951
|
+
const draftEndpoint = `/flow?${flowIdentityQuery({ kind: "flow_type", flowType }, {
|
|
4952
|
+
publish: 2,
|
|
4953
|
+
...updateTime !== void 0 && updateTime !== null && updateTime !== "" ? { update_time: String(updateTime) } : {}
|
|
4954
|
+
})}`;
|
|
4955
|
+
const flowDraftResponse = await apiRequest(
|
|
4956
|
+
client,
|
|
4957
|
+
"PUT",
|
|
4958
|
+
draftEndpoint,
|
|
4959
|
+
{ data: flowPayload, capability: `${flowDefinition.capability}.submit` }
|
|
4960
|
+
);
|
|
4961
|
+
createdResources.flow_draft_saved = true;
|
|
4962
|
+
let flowLiveResponse = null;
|
|
4963
|
+
let liveEndpoint = null;
|
|
4964
|
+
if (options.publishLive !== false) {
|
|
4965
|
+
liveEndpoint = `/flow?${flowIdentityQuery({ kind: "flow_type", flowType }, {
|
|
4966
|
+
publish: 1,
|
|
4967
|
+
...updateTime !== void 0 && updateTime !== null && updateTime !== "" ? { update_time: String(updateTime) } : {}
|
|
4968
|
+
})}`;
|
|
4969
|
+
flowLiveResponse = await apiRequest(
|
|
4970
|
+
client,
|
|
4971
|
+
"PUT",
|
|
4972
|
+
liveEndpoint,
|
|
4973
|
+
{ data: flowPayload, capability: `${flowDefinition.capability}.submit` }
|
|
4974
|
+
);
|
|
4975
|
+
createdResources.flow_live_published = true;
|
|
4976
|
+
}
|
|
4977
|
+
const workspaceInfo = await apiRequest(
|
|
4978
|
+
client,
|
|
4979
|
+
"GET",
|
|
4980
|
+
"/workspace/by_key",
|
|
4981
|
+
{ params: { key: workspace }, capability: `${workspaceDefinition.capability}.export` }
|
|
4982
|
+
);
|
|
4983
|
+
const existingBindings = isRecord3(workspaceInfo) ? normalizeWorkspaceFlowItems(workspaceInfo.workspace_flow) : [];
|
|
4984
|
+
const bindingKey = buildWorkspaceFlowBindingKey(flowType, "");
|
|
4985
|
+
const nextBindings = existingBindings.some((item) => buildWorkspaceFlowBindingKey(item.flow_type, item.flow_key) === bindingKey) ? existingBindings : [...existingBindings, { flow_type: flowType, flow_key: "", only_in_workspace: 0 }];
|
|
4986
|
+
const workspaceBindResponse = await apiRequest(
|
|
4987
|
+
client,
|
|
4988
|
+
"PUT",
|
|
4989
|
+
"/workspace/workspace_flow",
|
|
4990
|
+
{ data: { workspace_flow: nextBindings }, params: { workspace }, capability: `${workspaceDefinition.capability}.submit` }
|
|
4991
|
+
);
|
|
4992
|
+
createdResources.workspace_binding_submitted = { workspace, flow_type: flowType, flow_key: "" };
|
|
4993
|
+
const workspaceReadback = await apiRequest(
|
|
4994
|
+
client,
|
|
4995
|
+
"GET",
|
|
4996
|
+
"/workspace/by_key",
|
|
4997
|
+
{ params: { key: workspace }, capability: `${workspaceDefinition.capability}.export` }
|
|
4998
|
+
);
|
|
4999
|
+
const readbackBindings = isRecord3(workspaceReadback) ? normalizeWorkspaceFlowItems(workspaceReadback.workspace_flow) : [];
|
|
5000
|
+
if (!readbackBindings.some((item) => buildWorkspaceFlowBindingKey(item.flow_type, item.flow_key) === bindingKey)) {
|
|
5001
|
+
throw new Error(`flow-app create workspace binding verification failed for ${workspace} ${bindingKey}.`);
|
|
5002
|
+
}
|
|
5003
|
+
return {
|
|
5004
|
+
dry_run: false,
|
|
5005
|
+
domain: "flow-app",
|
|
5006
|
+
workspace,
|
|
5007
|
+
name,
|
|
5008
|
+
draft_form_id: draftFormId,
|
|
5009
|
+
published_form_id: publishedFormId,
|
|
5010
|
+
flow_type: flowType,
|
|
5011
|
+
form_response: formResponse,
|
|
5012
|
+
form_publish_response: formPublishResponse,
|
|
5013
|
+
flow_create_response: flowCreateResponse,
|
|
5014
|
+
flow_draft_response: flowDraftResponse,
|
|
5015
|
+
...liveEndpoint ? { flow_live_response: flowLiveResponse, live_endpoint: liveEndpoint } : {},
|
|
5016
|
+
workspace_bind_response: workspaceBindResponse,
|
|
5017
|
+
workspace_readback_hash: hashJson(workspaceReadback)
|
|
5018
|
+
};
|
|
5019
|
+
} catch (error) {
|
|
5020
|
+
const message = error instanceof Error ? error.message : String(error || "");
|
|
5021
|
+
throw new Error(`flow-app create failed: ${message}. Created resources: ${JSON.stringify(createdResources)}. Next recovery: fix the failing step, then rerun the corresponding typed config command or rerun flow-app create only if duplicate resources are acceptable.`);
|
|
5022
|
+
}
|
|
5023
|
+
}
|
|
4057
5024
|
async function readBackConfigDomain(profile, domain, id, definition) {
|
|
4058
5025
|
const data = await readRemoteConfigDomain(profile, domain, id, definition);
|
|
5026
|
+
if (domain === "form-template") {
|
|
5027
|
+
assertFormTemplateDraftId(id, data, "verify");
|
|
5028
|
+
}
|
|
4059
5029
|
validateExpectedType(domain, definition, data);
|
|
4060
5030
|
return {
|
|
4061
5031
|
readback_hash: hashJson(data)
|
|
@@ -4148,6 +5118,9 @@ async function exportConfigDomain(config, profile, domain, id, outDir, options =
|
|
|
4148
5118
|
}
|
|
4149
5119
|
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4150
5120
|
const data = await readRemoteConfigDomain(profile, domain, id, definition);
|
|
5121
|
+
if (domain === "form-template") {
|
|
5122
|
+
assertFormTemplateDraftId(id, data, "export");
|
|
5123
|
+
}
|
|
4151
5124
|
validateExpectedType(domain, definition, data);
|
|
4152
5125
|
const baseHash = hashJson(data);
|
|
4153
5126
|
const stem = `${domain}-${id}`;
|
|
@@ -4177,7 +5150,8 @@ async function buildConfigSubmitPayload(domain, workFile, outFile, metaFile, opt
|
|
|
4177
5150
|
}
|
|
4178
5151
|
const work = await readJsonFile(workFile);
|
|
4179
5152
|
const meta = metaFile ? await readJsonFile(metaFile) : {};
|
|
4180
|
-
|
|
5153
|
+
const createMode = isRecord3(work) && work.mode === "create" || isRecord3(meta) && meta.mode === "create";
|
|
5154
|
+
if (!isRecord3(meta) || meta.domain !== domain || !createMode && typeof meta.base_hash !== "string") {
|
|
4181
5155
|
throw new Error("Config build requires a meta file produced by `bpmax-cli config <domain> export`.");
|
|
4182
5156
|
}
|
|
4183
5157
|
const raw = typeof meta.raw_file === "string" ? await readJsonFile(meta.raw_file) : void 0;
|
|
@@ -4193,7 +5167,7 @@ async function buildConfigSubmitPayload(domain, workFile, outFile, metaFile, opt
|
|
|
4193
5167
|
domain,
|
|
4194
5168
|
built_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4195
5169
|
meta,
|
|
4196
|
-
base_hash: meta.base_hash,
|
|
5170
|
+
base_hash: typeof meta.base_hash === "string" ? meta.base_hash : null,
|
|
4197
5171
|
payload
|
|
4198
5172
|
};
|
|
4199
5173
|
await writeJsonFile(outFile, result);
|
|
@@ -4208,29 +5182,114 @@ async function lintConfigWorkFile(file) {
|
|
|
4208
5182
|
if (Object.prototype.hasOwnProperty.call(value, "classify") && Object.prototype.hasOwnProperty.call(value, "source_table")) {
|
|
4209
5183
|
lintDatasetFieldWork(value, errors);
|
|
4210
5184
|
}
|
|
4211
|
-
if (Object.prototype.hasOwnProperty.call(value, "content")) {
|
|
4212
|
-
lintTemplateFieldReferences(value, errors);
|
|
5185
|
+
if (Object.prototype.hasOwnProperty.call(value, "content")) {
|
|
5186
|
+
lintTemplateFieldReferences(value, errors);
|
|
5187
|
+
}
|
|
5188
|
+
if ((Object.prototype.hasOwnProperty.call(value, "content") || isRecord3(value.basic)) && pageTemplateType(value) === 1) {
|
|
5189
|
+
validateListTemplateActionGate(value, errors);
|
|
5190
|
+
}
|
|
5191
|
+
if (isFlowTemplateWork(value)) {
|
|
5192
|
+
const flowWork = value;
|
|
5193
|
+
validateFlowTemplateRemoteTemplateRefs(flowWork, errors);
|
|
5194
|
+
if (flowWork.mode === "create") {
|
|
5195
|
+
validateFlowTemplateFormDrivenCreateBaseline(flowWork, errors, { context: "flow-template create" });
|
|
5196
|
+
} else {
|
|
5197
|
+
validateFlowTemplateStandardFlowType(flowWork, errors);
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
}
|
|
5201
|
+
return {
|
|
5202
|
+
file,
|
|
5203
|
+
ok: errors.length === 0,
|
|
5204
|
+
errors,
|
|
5205
|
+
checked_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
5206
|
+
};
|
|
5207
|
+
}
|
|
5208
|
+
async function submitConfigDomain(config, profile, domain, id, submitFile, confirm3, options = {}) {
|
|
5209
|
+
void config;
|
|
5210
|
+
const definition = CONFIG_DOMAINS[domain];
|
|
5211
|
+
if (domain === "workspace-flow") {
|
|
5212
|
+
if (definition.submitStatus !== "supported") {
|
|
5213
|
+
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
5214
|
+
}
|
|
5215
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
5216
|
+
const submit2 = await readJsonFile(submitFile);
|
|
5217
|
+
if (!isRecord3(submit2) || submit2.domain !== domain || !isRecord3(submit2.payload)) {
|
|
5218
|
+
throw new Error("Config submit requires a payload produced by `bpmax-cli config <domain> build`.");
|
|
5219
|
+
}
|
|
5220
|
+
const meta2 = submit2.meta;
|
|
5221
|
+
if (!isRecord3(meta2)) {
|
|
5222
|
+
throw new Error("Config submit payload is missing export metadata. Export the remote config first, then rebuild with --meta.");
|
|
5223
|
+
}
|
|
5224
|
+
if (meta2.domain !== domain) {
|
|
5225
|
+
throw new Error(`Config submit metadata domain mismatch. Expected ${domain}, got ${String(meta2.domain)}.`);
|
|
4213
5226
|
}
|
|
4214
|
-
if (
|
|
4215
|
-
|
|
5227
|
+
if (normalizeWorkspaceKey(String(meta2.id || "")) !== normalizeWorkspaceKey(id)) {
|
|
5228
|
+
throw new Error(`Config submit metadata id mismatch. Expected ${id}, got ${String(meta2.id || "")}.`);
|
|
5229
|
+
}
|
|
5230
|
+
if (meta2.profile !== profile.name) {
|
|
5231
|
+
throw new Error(`Config submit metadata profile mismatch. Expected ${profile.name}, got ${String(meta2.profile)}.`);
|
|
5232
|
+
}
|
|
5233
|
+
const createMode = meta2.mode === "create";
|
|
5234
|
+
await ensureConfigCapability(profile, `${definition.capability}.${createMode ? "create" : "submit"}`);
|
|
5235
|
+
const workspace = normalizeWorkspaceKey(String(submit2.payload.workspace || id));
|
|
5236
|
+
const metaWorkspace = normalizeWorkspaceKey(String(meta2.workspace || meta2.id || ""));
|
|
5237
|
+
if (metaWorkspace && metaWorkspace !== workspace) {
|
|
5238
|
+
throw new Error(`Config submit metadata workspace mismatch. Expected ${workspace}, got ${metaWorkspace}.`);
|
|
5239
|
+
}
|
|
5240
|
+
const endpoint2 = "/workspace/workspace_flow";
|
|
5241
|
+
const submitPayload2 = { workspace_flow: normalizeWorkspaceFlowItems(submit2.payload.workspace_flow) };
|
|
5242
|
+
const current2 = await readRemoteConfigDomain(profile, domain, workspace, definition);
|
|
5243
|
+
if (typeof submit2.base_hash === "string" && hashJson(current2) !== submit2.base_hash) {
|
|
5244
|
+
throw new Error("Remote config changed after export. Re-export before submitting.");
|
|
5245
|
+
}
|
|
5246
|
+
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
5247
|
+
if (confirm3 !== expectedConfirm2) {
|
|
5248
|
+
return {
|
|
5249
|
+
dry_run: true,
|
|
5250
|
+
domain,
|
|
5251
|
+
id,
|
|
5252
|
+
endpoint: endpoint2,
|
|
5253
|
+
method: "PUT",
|
|
5254
|
+
params: { workspace },
|
|
5255
|
+
payload: submitPayload2,
|
|
5256
|
+
current_hash: hashJson(current2),
|
|
5257
|
+
next: `Run again with --confirm "${expectedConfirm2}" to submit.`
|
|
5258
|
+
};
|
|
5259
|
+
}
|
|
5260
|
+
const client2 = createApiClient(profile);
|
|
5261
|
+
const response2 = await apiRequest(
|
|
5262
|
+
client2,
|
|
5263
|
+
"PUT",
|
|
5264
|
+
endpoint2,
|
|
5265
|
+
{ data: submitPayload2, params: { workspace }, capability: `${definition.capability}.${createMode ? "create" : "submit"}` }
|
|
5266
|
+
);
|
|
5267
|
+
const readback2 = await readRemoteConfigDomain(profile, domain, workspace, definition);
|
|
5268
|
+
const bindings = isRecord3(readback2) ? normalizeWorkspaceFlowItems(readback2.workspace_flow) : [];
|
|
5269
|
+
const expectedBindings = normalizeWorkspaceFlowItems(submitPayload2.workspace_flow);
|
|
5270
|
+
const missingBindings = expectedBindings.filter(
|
|
5271
|
+
(expected) => !bindings.some(
|
|
5272
|
+
(actual) => buildWorkspaceFlowBindingKey(actual.flow_type, actual.flow_key) === buildWorkspaceFlowBindingKey(expected.flow_type, expected.flow_key)
|
|
5273
|
+
)
|
|
5274
|
+
);
|
|
5275
|
+
if (missingBindings.length) {
|
|
5276
|
+
throw new Error(`workspace-flow submit verification failed; missing bindings: ${missingBindings.map((item) => buildWorkspaceFlowBindingKey(item.flow_type, item.flow_key)).join(", ")}`);
|
|
4216
5277
|
}
|
|
5278
|
+
return {
|
|
5279
|
+
dry_run: false,
|
|
5280
|
+
domain,
|
|
5281
|
+
id,
|
|
5282
|
+
endpoint: endpoint2,
|
|
5283
|
+
method: "PUT",
|
|
5284
|
+
params: { workspace },
|
|
5285
|
+
response: response2,
|
|
5286
|
+
readback_hash: hashJson(readback2)
|
|
5287
|
+
};
|
|
4217
5288
|
}
|
|
4218
|
-
return {
|
|
4219
|
-
file,
|
|
4220
|
-
ok: errors.length === 0,
|
|
4221
|
-
errors,
|
|
4222
|
-
checked_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
4223
|
-
};
|
|
4224
|
-
}
|
|
4225
|
-
async function submitConfigDomain(config, profile, domain, id, submitFile, confirm3, options = {}) {
|
|
4226
|
-
void config;
|
|
4227
|
-
const definition = CONFIG_DOMAINS[domain];
|
|
4228
5289
|
if (domain === "role" || domain === "api-platform" || domain === "nav-config") {
|
|
4229
5290
|
if (definition.submitStatus !== "supported") {
|
|
4230
5291
|
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
4231
5292
|
}
|
|
4232
|
-
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
4233
|
-
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4234
5293
|
const submit2 = await readJsonFile(submitFile);
|
|
4235
5294
|
if (!isRecord3(submit2) || submit2.domain !== domain || !isRecord3(submit2.payload)) {
|
|
4236
5295
|
throw new Error("Config submit requires a payload produced by `bpmax-cli config <domain> build`.");
|
|
@@ -4251,10 +5310,22 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4251
5310
|
if (meta2.workspace !== profile.config.workspace) {
|
|
4252
5311
|
throw new Error(`Config submit metadata workspace mismatch. Expected ${profile.config.workspace}, got ${String(meta2.workspace)}.`);
|
|
4253
5312
|
}
|
|
5313
|
+
const createMode = meta2.mode === "create";
|
|
5314
|
+
if (createMode) {
|
|
5315
|
+
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
5316
|
+
if (aggregatePayloadHasNonCreateOperations(domain, submit2.payload)) {
|
|
5317
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
5318
|
+
}
|
|
5319
|
+
} else {
|
|
5320
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
5321
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
5322
|
+
}
|
|
4254
5323
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
5324
|
+
if (!createMode) {
|
|
5325
|
+
const current2 = domain === "role" ? await collectRoleAggregate(profile, id) : domain === "api-platform" ? await collectApiPlatformAggregate(profile, id) : await collectNavConfigAggregate(profile, id);
|
|
5326
|
+
if (hashJson(current2.raw) !== submit2.base_hash) {
|
|
5327
|
+
throw new Error("Remote config changed after export. Re-export before submitting.");
|
|
5328
|
+
}
|
|
4258
5329
|
}
|
|
4259
5330
|
if (confirm3 !== expectedConfirm2) {
|
|
4260
5331
|
return {
|
|
@@ -4277,8 +5348,6 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4277
5348
|
if (definition.submitStatus !== "supported" || !definition.submitPath || !definition.submitMethod) {
|
|
4278
5349
|
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
4279
5350
|
}
|
|
4280
|
-
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
4281
|
-
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4282
5351
|
const submit = await readJsonFile(submitFile);
|
|
4283
5352
|
if (!isRecord3(submit) || submit.domain !== domain || !isRecord3(submit.payload)) {
|
|
4284
5353
|
throw new Error("Config submit requires a payload produced by `bpmax-cli config <domain> build`.");
|
|
@@ -4299,12 +5368,130 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4299
5368
|
if (meta.workspace !== profile.config.workspace) {
|
|
4300
5369
|
throw new Error(`Config submit metadata workspace mismatch. Expected ${profile.config.workspace}, got ${String(meta.workspace)}.`);
|
|
4301
5370
|
}
|
|
5371
|
+
const submitMode = isRecord3(meta) ? meta.mode : void 0;
|
|
5372
|
+
if (submitMode === "create" && domain !== "form-template") {
|
|
5373
|
+
if (!definition.createPath || !definition.createMethod) {
|
|
5374
|
+
throw new Error(`${domain} create is not implemented in the typed adapter.`);
|
|
5375
|
+
}
|
|
5376
|
+
if (domain === "list-template") {
|
|
5377
|
+
validateListTemplateActionGate(submit.payload);
|
|
5378
|
+
}
|
|
5379
|
+
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
5380
|
+
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
5381
|
+
if (confirm3 !== expectedConfirm2) {
|
|
5382
|
+
return {
|
|
5383
|
+
dry_run: true,
|
|
5384
|
+
domain,
|
|
5385
|
+
id,
|
|
5386
|
+
endpoint: definition.createPath,
|
|
5387
|
+
method: definition.createMethod,
|
|
5388
|
+
payload: submit.payload,
|
|
5389
|
+
next: `Run again with --confirm "${expectedConfirm2}" to submit.`
|
|
5390
|
+
};
|
|
5391
|
+
}
|
|
5392
|
+
const client2 = createApiClient(profile);
|
|
5393
|
+
const response2 = await apiRequest(
|
|
5394
|
+
client2,
|
|
5395
|
+
definition.createMethod,
|
|
5396
|
+
definition.createPath,
|
|
5397
|
+
{ data: submit.payload, capability: `${definition.capability}.create` }
|
|
5398
|
+
);
|
|
5399
|
+
const createdId = responseDataId(response2);
|
|
5400
|
+
let readbackHash = null;
|
|
5401
|
+
if (createdId !== void 0 && createdId !== null && createdId !== "" && definition.exportPath) {
|
|
5402
|
+
try {
|
|
5403
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
5404
|
+
readbackHash = hashJson(await readRemoteConfigDomain(profile, domain, String(createdId), definition));
|
|
5405
|
+
} catch {
|
|
5406
|
+
readbackHash = null;
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5409
|
+
return {
|
|
5410
|
+
dry_run: false,
|
|
5411
|
+
domain,
|
|
5412
|
+
id,
|
|
5413
|
+
created_id: createdId ?? null,
|
|
5414
|
+
endpoint: definition.createPath,
|
|
5415
|
+
method: definition.createMethod,
|
|
5416
|
+
response: response2,
|
|
5417
|
+
readback_hash: readbackHash
|
|
5418
|
+
};
|
|
5419
|
+
}
|
|
5420
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
5421
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4302
5422
|
if (domain === "flow-template") {
|
|
5423
|
+
validateFlowTemplateRemoteTemplateRefs(submit.payload);
|
|
4303
5424
|
validateFlowTemplateStandardFlowType(submit.payload);
|
|
4304
5425
|
validateFlowTemplateIdentityStandard(id, submit.payload);
|
|
4305
5426
|
}
|
|
5427
|
+
if (domain === "list-template") {
|
|
5428
|
+
validateListTemplateActionGate(submit.payload);
|
|
5429
|
+
}
|
|
5430
|
+
if (domain === "form-template" && submitMode === "create") {
|
|
5431
|
+
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
5432
|
+
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
5433
|
+
const endpoint2 = "/form_template";
|
|
5434
|
+
if (confirm3 !== expectedConfirm2) {
|
|
5435
|
+
return {
|
|
5436
|
+
dry_run: true,
|
|
5437
|
+
domain,
|
|
5438
|
+
id,
|
|
5439
|
+
endpoint: endpoint2,
|
|
5440
|
+
method: "POST",
|
|
5441
|
+
payload: submit.payload,
|
|
5442
|
+
publish_endpoint: "/form_template/publish",
|
|
5443
|
+
next: `Run again with --confirm "${expectedConfirm2}" to submit.`
|
|
5444
|
+
};
|
|
5445
|
+
}
|
|
5446
|
+
const client2 = createApiClient(profile);
|
|
5447
|
+
const response2 = await apiRequest(
|
|
5448
|
+
client2,
|
|
5449
|
+
"POST",
|
|
5450
|
+
endpoint2,
|
|
5451
|
+
{ data: submit.payload, capability: `${definition.capability}.create` }
|
|
5452
|
+
);
|
|
5453
|
+
const draftId = responseDataId(response2);
|
|
5454
|
+
if (draftId === void 0 || draftId === null || draftId === "") {
|
|
5455
|
+
throw new Error("form-template create did not return a draft id.");
|
|
5456
|
+
}
|
|
5457
|
+
const publishResponse2 = await apiRequest(
|
|
5458
|
+
client2,
|
|
5459
|
+
"POST",
|
|
5460
|
+
"/form_template/publish",
|
|
5461
|
+
{ data: { id: draftId }, capability: `${definition.capability}.submit` }
|
|
5462
|
+
);
|
|
5463
|
+
const publishedId = responseDataId(publishResponse2) ?? draftId;
|
|
5464
|
+
const draftReadback = await apiRequest(
|
|
5465
|
+
client2,
|
|
5466
|
+
"GET",
|
|
5467
|
+
`/form_template/${draftId}`,
|
|
5468
|
+
{ capability: `${definition.capability}.export` }
|
|
5469
|
+
);
|
|
5470
|
+
const publishedReadback = await apiRequest(
|
|
5471
|
+
client2,
|
|
5472
|
+
"GET",
|
|
5473
|
+
`/form_template/${publishedId}`,
|
|
5474
|
+
{ capability: `${definition.capability}.export` }
|
|
5475
|
+
);
|
|
5476
|
+
return {
|
|
5477
|
+
dry_run: false,
|
|
5478
|
+
domain,
|
|
5479
|
+
id,
|
|
5480
|
+
endpoint: endpoint2,
|
|
5481
|
+
method: "POST",
|
|
5482
|
+
response: response2,
|
|
5483
|
+
draft_id: draftId,
|
|
5484
|
+
published_id: publishedId,
|
|
5485
|
+
publish_response: publishResponse2,
|
|
5486
|
+
draft_readback_hash: hashJson(draftReadback),
|
|
5487
|
+
published_readback_hash: hashJson(publishedReadback)
|
|
5488
|
+
};
|
|
5489
|
+
}
|
|
4306
5490
|
const expectedConfirm = `submit ${domain} ${id}`;
|
|
4307
5491
|
const current = await readRemoteConfigDomain(profile, domain, id, definition);
|
|
5492
|
+
if (domain === "form-template") {
|
|
5493
|
+
assertFormTemplateDraftId(id, current, "submit");
|
|
5494
|
+
}
|
|
4308
5495
|
validateExpectedType(domain, definition, current);
|
|
4309
5496
|
const currentHash = hashJson(current);
|
|
4310
5497
|
if (currentHash !== submit.base_hash) {
|
|
@@ -4372,6 +5559,125 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4372
5559
|
...readback
|
|
4373
5560
|
};
|
|
4374
5561
|
}
|
|
5562
|
+
async function deleteConfigDomain(config, profile, domain, id, confirm3) {
|
|
5563
|
+
void config;
|
|
5564
|
+
const definition = CONFIG_DOMAINS[domain];
|
|
5565
|
+
if (domain === "workspace-flow") {
|
|
5566
|
+
return deleteWorkspaceFlowBinding(profile, id, confirm3);
|
|
5567
|
+
}
|
|
5568
|
+
await ensureConfigCapability(profile, `${definition.capability}.delete`);
|
|
5569
|
+
const expectedConfirm = `delete ${domain} ${id}`;
|
|
5570
|
+
const client = createApiClient(profile);
|
|
5571
|
+
if (domain === "nav-config") {
|
|
5572
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
5573
|
+
const current = await collectNavConfigAggregate(profile, id);
|
|
5574
|
+
const configs = isRecord3(current.raw.configs) ? current.raw.configs : {};
|
|
5575
|
+
const operations = [];
|
|
5576
|
+
for (const type of NAV_CONFIG_TYPES) {
|
|
5577
|
+
const item = isRecord3(configs[type]) ? configs[type] : {};
|
|
5578
|
+
const itemId = item.id;
|
|
5579
|
+
if (itemId !== void 0 && itemId !== null && itemId !== "") {
|
|
5580
|
+
operations.push({ type, method: "DELETE", path: `/configuration/${itemId}?is_default_action=1`, id: itemId });
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5583
|
+
if (confirm3 !== expectedConfirm) {
|
|
5584
|
+
return {
|
|
5585
|
+
dry_run: true,
|
|
5586
|
+
domain,
|
|
5587
|
+
id,
|
|
5588
|
+
operation_plan: { operations },
|
|
5589
|
+
next: `Run again with --confirm "${expectedConfirm}" to delete.`
|
|
5590
|
+
};
|
|
5591
|
+
}
|
|
5592
|
+
const responses = await submitOperationPlan(profile, definition.capability, operations);
|
|
5593
|
+
return {
|
|
5594
|
+
dry_run: false,
|
|
5595
|
+
domain,
|
|
5596
|
+
id,
|
|
5597
|
+
operation_responses: responses
|
|
5598
|
+
};
|
|
5599
|
+
}
|
|
5600
|
+
const endpoint = domain === "api-platform" ? apiPlatformDeletePath(id) : definition.deletePath?.(id);
|
|
5601
|
+
if (!endpoint || !definition.deleteMethod) {
|
|
5602
|
+
throw new Error(`${domain} delete is not implemented in the typed adapter.`);
|
|
5603
|
+
}
|
|
5604
|
+
if (confirm3 !== expectedConfirm) {
|
|
5605
|
+
return {
|
|
5606
|
+
dry_run: true,
|
|
5607
|
+
domain,
|
|
5608
|
+
id,
|
|
5609
|
+
endpoint,
|
|
5610
|
+
method: definition.deleteMethod,
|
|
5611
|
+
next: `Run again with --confirm "${expectedConfirm}" to delete.`
|
|
5612
|
+
};
|
|
5613
|
+
}
|
|
5614
|
+
const response = await apiRequest(
|
|
5615
|
+
client,
|
|
5616
|
+
definition.deleteMethod,
|
|
5617
|
+
endpoint,
|
|
5618
|
+
{ capability: `${definition.capability}.delete` }
|
|
5619
|
+
);
|
|
5620
|
+
return {
|
|
5621
|
+
dry_run: false,
|
|
5622
|
+
domain,
|
|
5623
|
+
id,
|
|
5624
|
+
endpoint,
|
|
5625
|
+
method: definition.deleteMethod,
|
|
5626
|
+
response
|
|
5627
|
+
};
|
|
5628
|
+
}
|
|
5629
|
+
async function runDatasetLifecycleAction(config, profile, action, id, confirm3) {
|
|
5630
|
+
void config;
|
|
5631
|
+
const commandAction = action;
|
|
5632
|
+
const normalizedAction = action === "reindex" ? "refresh" : action;
|
|
5633
|
+
const definition = CONFIG_DOMAINS.dataset;
|
|
5634
|
+
const capability = `${definition.capability}.${normalizedAction === "cancel-refresh" ? "cancel_refresh" : normalizedAction}`;
|
|
5635
|
+
await ensureConfigCapability(profile, capability);
|
|
5636
|
+
const method = "POST";
|
|
5637
|
+
const expectedConfirm = `${commandAction} dataset ${id}`;
|
|
5638
|
+
const operations = normalizedAction === "refresh" ? [
|
|
5639
|
+
{ action: "pause", method, endpoint: `/data_set/pause/${id}`, capability: `${definition.capability}.pause`, optional: true },
|
|
5640
|
+
{ action: "publish", method, endpoint: `/data_set/publish/${id}`, capability: `${definition.capability}.publish` }
|
|
5641
|
+
] : [
|
|
5642
|
+
{ action: normalizedAction, method, endpoint: `/data_set/${normalizedAction}/${id}`, capability }
|
|
5643
|
+
];
|
|
5644
|
+
if (confirm3 !== expectedConfirm) {
|
|
5645
|
+
return {
|
|
5646
|
+
dry_run: true,
|
|
5647
|
+
domain: "dataset",
|
|
5648
|
+
id,
|
|
5649
|
+
action: commandAction,
|
|
5650
|
+
operations,
|
|
5651
|
+
next: `Run again with --confirm "${expectedConfirm}" to ${commandAction} dataset ${id}.`
|
|
5652
|
+
};
|
|
5653
|
+
}
|
|
5654
|
+
const client = createApiClient(profile);
|
|
5655
|
+
const current = await readRemoteConfigDomain(profile, "dataset", id, definition);
|
|
5656
|
+
const currentStatus = isRecord3(current) ? Number(current.status) : NaN;
|
|
5657
|
+
const executableOperations = normalizedAction === "refresh" && currentStatus !== 1 && currentStatus !== 3 ? operations.filter((operation) => operation.action !== "pause") : operations;
|
|
5658
|
+
const responses = [];
|
|
5659
|
+
for (const operation of executableOperations) {
|
|
5660
|
+
responses.push({
|
|
5661
|
+
action: operation.action,
|
|
5662
|
+
response: await apiRequest(
|
|
5663
|
+
client,
|
|
5664
|
+
operation.method,
|
|
5665
|
+
operation.endpoint,
|
|
5666
|
+
{ data: {}, capability: operation.capability }
|
|
5667
|
+
)
|
|
5668
|
+
});
|
|
5669
|
+
}
|
|
5670
|
+
const readback = await readRemoteConfigDomain(profile, "dataset", id, definition);
|
|
5671
|
+
return {
|
|
5672
|
+
dry_run: false,
|
|
5673
|
+
domain: "dataset",
|
|
5674
|
+
id,
|
|
5675
|
+
action: commandAction,
|
|
5676
|
+
operations: executableOperations,
|
|
5677
|
+
operation_responses: responses,
|
|
5678
|
+
readback
|
|
5679
|
+
};
|
|
5680
|
+
}
|
|
4375
5681
|
|
|
4376
5682
|
// src/core/config-workspace.ts
|
|
4377
5683
|
import { mkdir as mkdir4, readFile as readFile7, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -4459,6 +5765,7 @@ ${configEnabled ? "" : "> \u5F53\u524D profile \u7684 API Key \u5C1A\u672A\u5F00
|
|
|
4459
5765
|
| --- | --- | --- |
|
|
4460
5766
|
${rows}
|
|
4461
5767
|
| \u6700\u65B0\u914D\u7F6E\u540C\u6B65 | \`bpmax-config-latest\` | \`${commandPrefix3} config latest pull ${options.env}\` |
|
|
5768
|
+
| \u957F\u671F\u8BB0\u5FC6 | \`bpmax-memory-protocol\` | \`${commandPrefix3} memory search --scope all --query "<workspace> <flow_type> <task>"\` |
|
|
4462
5769
|
| \u5B8C\u6574\u914D\u7F6E\u7F16\u6392 | \`bpmax-e2e-flow-config-orchestrator\` | \u6309\u7F16\u6392 Skill \u6267\u884C |
|
|
4463
5770
|
| \u7AEF\u5230\u7AEF\u56DE\u5F52 | \`bpmax-e2e-flow-test-operator\` | \u6309\u56DE\u5F52 Skill \u6267\u884C |
|
|
4464
5771
|
|
|
@@ -4487,6 +5794,20 @@ ${commandPrefix3} config <domain> verify --id <id> --expect <work-file> --profil
|
|
|
4487
5794
|
${commandPrefix3} config workspace init ${envArg} --profile ${profileArg} --workspace-dir ${shellQuote3(options.environment.sysconfig_repo_path)} --format json
|
|
4488
5795
|
${commandPrefix3} config latest pull ${envArg} --profile ${profileArg} --format json
|
|
4489
5796
|
\`\`\`
|
|
5797
|
+
|
|
5798
|
+
## Memory \u4F7F\u7528\u89C4\u5219
|
|
5799
|
+
\u5F00\u59CB\u914D\u7F6E\u3001\u6392\u67E5\u6216\u6D4B\u8BD5\u524D\uFF0C\u5148\u8C03\u7528 \`bpmax-memory-protocol\` \u6216\u76F4\u63A5\u641C\u7D22 BPMAX memory\u3002\u67E5\u8BE2\u8BCD\u81F3\u5C11\u5305\u542B\u4E1A\u52A1\u540D\u3001workspace\u3001flow_type\u3001\u6A21\u677F/\u6570\u636E\u96C6/\u5BF9\u8C61 id \u548C\u76EE\u6807\u52A8\u4F5C\u3002
|
|
5800
|
+
|
|
5801
|
+
\`\`\`bash
|
|
5802
|
+
${commandPrefix3} memory status --profile ${profileArg} --format json
|
|
5803
|
+
${commandPrefix3} memory search --profile ${profileArg} --scope all --query "${display(options.environment.workspace || options.profile.workspace)} <flow_type> <task>" --format json
|
|
5804
|
+
\`\`\`
|
|
5805
|
+
|
|
5806
|
+
\u9A8C\u8BC1\u901A\u8FC7\u540E\uFF0C\u53EA\u5199\u53EF\u590D\u7528\u7ED3\u8BBA\uFF1A\`decision\`\u3001\`task_learning\`\u3001\`anti_pattern\`\u3001\`environmental\` \u6216 \`convention\`\u3002\u672A\u5B8C\u6210\u6216\u4E2D\u65AD\u6001\u53EA\u5199 \`session_state\`\u3002\u7981\u6B62\u5199\u5165 API Key\u3001Authorization\u3001token\u3001password\u3001\u9A8C\u8BC1\u7801\u3001\u624B\u673A\u53F7\u3001\u5B8C\u6574 payload \u6216\u5927\u6BB5\u63A5\u53E3\u54CD\u5E94\u3002
|
|
5807
|
+
|
|
5808
|
+
\`\`\`bash
|
|
5809
|
+
${commandPrefix3} memory add --profile ${profileArg} --scope user --text "<learning>" --metadata '{"type":"task_learning","project_id":"bpmax","workspace":"${display(options.environment.workspace || options.profile.workspace)}"}' --format json
|
|
5810
|
+
\`\`\`
|
|
4490
5811
|
${end}
|
|
4491
5812
|
`;
|
|
4492
5813
|
}
|
|
@@ -5256,6 +6577,24 @@ function registerConfigCommands(program2) {
|
|
|
5256
6577
|
next: `Run git -C ${environment.sysconfig_repo_path} status --short and git diff to inspect local changes.`
|
|
5257
6578
|
});
|
|
5258
6579
|
});
|
|
6580
|
+
config.command("flow-app").description("Create an end-to-end BPMAX flow app from form and flow work files").command("create").description("Create a form template, create a main flow, bind the published form, and bind the flow to a workspace").requiredOption("--workspace <workspace>", "Target workspace key, e.g. oa or w:oa").requiredOption("--form-work <file>", "Form-template work JSON file").requiredOption("--flow-work <file>", "Flow-template work JSON file").requiredOption("--name <name>", "Flow app name used in the confirmation text").option("--profile <profile>", "Profile name").option("--draft-only", "Save the created flow as draft only instead of publishing live").option("--confirm <text>", "Exact confirmation text").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
6581
|
+
const configData = await loadConfig();
|
|
6582
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
6583
|
+
const result = await createFlowAppFromWork(
|
|
6584
|
+
configData,
|
|
6585
|
+
resolved,
|
|
6586
|
+
options.formWork,
|
|
6587
|
+
options.flowWork,
|
|
6588
|
+
options.confirm,
|
|
6589
|
+
{
|
|
6590
|
+
workspace: options.workspace,
|
|
6591
|
+
name: options.name,
|
|
6592
|
+
publishLive: !options.draftOnly
|
|
6593
|
+
}
|
|
6594
|
+
);
|
|
6595
|
+
await saveConfig(configData);
|
|
6596
|
+
printResult(options.format, result);
|
|
6597
|
+
});
|
|
5259
6598
|
const init = config.command("init").description("Initialize BPMAX configuration helper files");
|
|
5260
6599
|
init.command("workspace").description("Create or update an AGENTS.md BPMAX configuration guide in a workspace directory").requiredOption("--env <env>", "Configuration environment key").option("--profile <profile>", "Profile name").option("--cwd <dir>", "Target workspace directory", process.cwd()).option("--file <file>", "Agent guide file name", DEFAULT_AGENT_GUIDE_FILE).option("--dry-run", "Print the generated content without writing the file").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
5261
6600
|
const configData = await loadConfig();
|
|
@@ -5272,6 +6611,33 @@ function registerConfigCommands(program2) {
|
|
|
5272
6611
|
});
|
|
5273
6612
|
Object.keys(CONFIG_DOMAINS).forEach((domain) => {
|
|
5274
6613
|
const domainCommand = config.command(domain).description(`Manage BPMAX ${domain} configuration`);
|
|
6614
|
+
const createCommand = domainCommand.command("create").description(domain === "flow-template" ? "Create a new main flow template through the typed adapter" : `Create a ${domain} config object through a verified typed adapter; dry-run unless --confirm is exact`).option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--publish-live", "For flow-template, publish the created flow to live after saving draft").option("--format <format>", "Output format", "pretty");
|
|
6615
|
+
if (domain === "flow-template") {
|
|
6616
|
+
createCommand.requiredOption("--work <file>", "Flow-template work JSON file");
|
|
6617
|
+
} else {
|
|
6618
|
+
createCommand.requiredOption("--id <id>", "Create operation id used in payload metadata, for example create:<domain>").requiredOption("--payload <file>", "Create submit payload JSON file produced by build");
|
|
6619
|
+
}
|
|
6620
|
+
createCommand.action(async (options) => {
|
|
6621
|
+
const configData = await loadConfig();
|
|
6622
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
6623
|
+
const result = domain === "flow-template" ? await createFlowTemplateFromWork(
|
|
6624
|
+
configData,
|
|
6625
|
+
resolved,
|
|
6626
|
+
String(options.work || ""),
|
|
6627
|
+
options.confirm,
|
|
6628
|
+
{ publishLive: Boolean(options.publishLive) }
|
|
6629
|
+
) : await submitConfigDomain(
|
|
6630
|
+
configData,
|
|
6631
|
+
resolved,
|
|
6632
|
+
domain,
|
|
6633
|
+
String(options.id || ""),
|
|
6634
|
+
String(options.payload || ""),
|
|
6635
|
+
options.confirm,
|
|
6636
|
+
{ publishLive: Boolean(options.publishLive) }
|
|
6637
|
+
);
|
|
6638
|
+
await saveConfig(configData);
|
|
6639
|
+
printResult(options.format, result);
|
|
6640
|
+
});
|
|
5275
6641
|
domainCommand.command("export").description(`Export remote ${domain} configuration into raw/work/meta files`).requiredOption("--id <id>", "Remote config id").option("--profile <profile>", "Profile name").option("--out <outDir>", "Output directory", `.codex/tmp/${domain}-editor`).option("--work-format <format>", "Work file format for supported domains: raw | structured", "raw").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
5276
6642
|
const configData = await loadConfig();
|
|
5277
6643
|
const resolved = resolveProfile(configData, options.profile);
|
|
@@ -5324,6 +6690,42 @@ function registerConfigCommands(program2) {
|
|
|
5324
6690
|
await saveConfig(configData);
|
|
5325
6691
|
printResult(options.format, result);
|
|
5326
6692
|
});
|
|
6693
|
+
domainCommand.command("delete").description(`Delete a ${domain} config object through a verified typed adapter; dry-run unless --confirm is exact`).requiredOption("--id <id>", "Remote config id").option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
6694
|
+
const configData = await loadConfig();
|
|
6695
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
6696
|
+
const result = await deleteConfigDomain(
|
|
6697
|
+
configData,
|
|
6698
|
+
resolved,
|
|
6699
|
+
domain,
|
|
6700
|
+
options.id,
|
|
6701
|
+
options.confirm
|
|
6702
|
+
);
|
|
6703
|
+
await saveConfig(configData);
|
|
6704
|
+
printResult(options.format, result);
|
|
6705
|
+
});
|
|
6706
|
+
if (domain === "dataset") {
|
|
6707
|
+
[
|
|
6708
|
+
["publish", "Publish/start a dataset and trigger ES batch generation"],
|
|
6709
|
+
["pause", "Pause a published or pending dataset"],
|
|
6710
|
+
["cancel-refresh", "Cancel a stuck dataset refresh without changing publish status"],
|
|
6711
|
+
["refresh", "Refresh/reindex a dataset and generate a new ES batch"],
|
|
6712
|
+
["reindex", "Alias of refresh; regenerate the dataset ES batch"]
|
|
6713
|
+
].forEach(([action, description]) => {
|
|
6714
|
+
domainCommand.command(action).description(`${description}; dry-run unless --confirm is exact`).requiredOption("--id <id>", "Remote dataset id").option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
6715
|
+
const configData = await loadConfig();
|
|
6716
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
6717
|
+
const result = await runDatasetLifecycleAction(
|
|
6718
|
+
configData,
|
|
6719
|
+
resolved,
|
|
6720
|
+
action,
|
|
6721
|
+
options.id,
|
|
6722
|
+
options.confirm
|
|
6723
|
+
);
|
|
6724
|
+
await saveConfig(configData);
|
|
6725
|
+
printResult(options.format, result);
|
|
6726
|
+
});
|
|
6727
|
+
});
|
|
6728
|
+
}
|
|
5327
6729
|
domainCommand.command("verify").description(`Read back a ${domain} config and optionally compare with an expected JSON file`).requiredOption("--id <id>", "Remote config id").option("--expect <file>", "Expected JSON file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
5328
6730
|
const configData = await loadConfig();
|
|
5329
6731
|
const resolved = resolveProfile(configData, options.profile);
|
|
@@ -5401,7 +6803,7 @@ function registerEsCommands(program2) {
|
|
|
5401
6803
|
}
|
|
5402
6804
|
|
|
5403
6805
|
// src/commands/flow.ts
|
|
5404
|
-
function
|
|
6806
|
+
function normalizeWorkspaceKey2(workspace) {
|
|
5405
6807
|
const nextWorkspace = workspace.trim().replace(/^\/+|\/+$/g, "");
|
|
5406
6808
|
return nextWorkspace.startsWith("w:") ? nextWorkspace.slice(2) : nextWorkspace;
|
|
5407
6809
|
}
|
|
@@ -5412,11 +6814,12 @@ async function getWorkspaceFlowBindings(client, profile, options) {
|
|
|
5412
6814
|
if (options.all) {
|
|
5413
6815
|
return void 0;
|
|
5414
6816
|
}
|
|
5415
|
-
const workspace =
|
|
6817
|
+
const workspace = normalizeWorkspaceKey2(options.workspace || profile.config.workspace);
|
|
5416
6818
|
const workspaceInfo = await apiRequest(client, "GET", "/workspace/by_key", {
|
|
5417
6819
|
params: {
|
|
5418
6820
|
key: workspace
|
|
5419
|
-
}
|
|
6821
|
+
},
|
|
6822
|
+
capability: "flow.list"
|
|
5420
6823
|
});
|
|
5421
6824
|
return new Set(
|
|
5422
6825
|
(workspaceInfo.workspace_flow || []).map((item) => flowBindingKey(item.flow_type, item.flow_key))
|
|
@@ -5784,6 +7187,85 @@ function registerInitCommand(program2, deps = {}) {
|
|
|
5784
7187
|
});
|
|
5785
7188
|
}
|
|
5786
7189
|
|
|
7190
|
+
// src/commands/memory.ts
|
|
7191
|
+
function parseLimit(input, fallback) {
|
|
7192
|
+
const value = Number(input ?? fallback);
|
|
7193
|
+
if (!Number.isInteger(value) || value <= 0 || value > 100) {
|
|
7194
|
+
throw new Error("limit must be an integer between 1 and 100.");
|
|
7195
|
+
}
|
|
7196
|
+
return value;
|
|
7197
|
+
}
|
|
7198
|
+
function normalizeScope(scope, allowAll) {
|
|
7199
|
+
const value = scope || "user";
|
|
7200
|
+
const allowed = allowAll ? ["user", "organization", "all"] : ["user", "organization"];
|
|
7201
|
+
if (!allowed.includes(value)) {
|
|
7202
|
+
throw new Error(`scope must be one of: ${allowed.join(", ")}.`);
|
|
7203
|
+
}
|
|
7204
|
+
return value;
|
|
7205
|
+
}
|
|
7206
|
+
async function parseOptionalJson(input, label) {
|
|
7207
|
+
if (!input) {
|
|
7208
|
+
return void 0;
|
|
7209
|
+
}
|
|
7210
|
+
return parseJsonInput(input, label);
|
|
7211
|
+
}
|
|
7212
|
+
async function memoryRequest(options, method, path9, capability, data, params) {
|
|
7213
|
+
const profile = resolveProfile(await loadConfig(), options.profile);
|
|
7214
|
+
const client = createApiClient(profile);
|
|
7215
|
+
return apiRequest(client, method, path9, {
|
|
7216
|
+
capability,
|
|
7217
|
+
data: redactAuditValue(data),
|
|
7218
|
+
params: params ? redactAuditValue(params) : void 0
|
|
7219
|
+
});
|
|
7220
|
+
}
|
|
7221
|
+
function registerMemoryCommands(program2) {
|
|
7222
|
+
const memory = program2.command("memory").description("Search and write BPMAX agent-scoped memory through the platform proxy");
|
|
7223
|
+
memory.command("status").description("Check BPMAX memory proxy and backend status").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
7224
|
+
const result = await memoryRequest(options, "GET", "/cli/memory/status", "memory.status");
|
|
7225
|
+
printResult(options.format, result);
|
|
7226
|
+
});
|
|
7227
|
+
memory.command("search").description("Search BPMAX memory for the current API-key agent").requiredOption("--query <text>", "Search query").option("--scope <scope>", "Memory scope: user, organization, or all", "user").option("--limit <limit>", "Maximum result count", "10").option("--filters <json>", "Optional JSON filters or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
7228
|
+
const result = await memoryRequest(options, "POST", "/cli/memory/search", "memory.search", {
|
|
7229
|
+
query: options.query,
|
|
7230
|
+
scope: normalizeScope(options.scope, true),
|
|
7231
|
+
limit: parseLimit(options.limit, 10),
|
|
7232
|
+
filters: await parseOptionalJson(options.filters, "--filters")
|
|
7233
|
+
});
|
|
7234
|
+
printResult(options.format, result);
|
|
7235
|
+
});
|
|
7236
|
+
memory.command("add").description("Add BPMAX memory for the current API-key agent").requiredOption("--text <text>", "Memory text").option("--scope <scope>", "Memory scope: user or organization", "user").option("--metadata <json>", "Optional JSON metadata or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
7237
|
+
const result = await memoryRequest(options, "POST", "/cli/memory", "memory.add", {
|
|
7238
|
+
text: options.text,
|
|
7239
|
+
scope: normalizeScope(options.scope, false),
|
|
7240
|
+
metadata: await parseOptionalJson(options.metadata, "--metadata")
|
|
7241
|
+
});
|
|
7242
|
+
printResult(options.format, result);
|
|
7243
|
+
});
|
|
7244
|
+
memory.command("list").description("List BPMAX memory when supported by the platform proxy").option("--scope <scope>", "Memory scope: user, organization, or all", "user").option("--limit <limit>", "Maximum result count", "20").option("--filters <json>", "Optional JSON filters or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
7245
|
+
const result = await memoryRequest(options, "GET", "/cli/memory", "memory.list", void 0, {
|
|
7246
|
+
scope: normalizeScope(options.scope, true),
|
|
7247
|
+
limit: parseLimit(options.limit, 20),
|
|
7248
|
+
filters: options.filters ? JSON.stringify(await parseOptionalJson(options.filters, "--filters")) : void 0
|
|
7249
|
+
});
|
|
7250
|
+
printResult(options.format, result);
|
|
7251
|
+
});
|
|
7252
|
+
memory.command("get <id>").description("Get one BPMAX memory item when supported by the platform proxy").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (id, options) => {
|
|
7253
|
+
const result = await memoryRequest(options, "GET", `/cli/memory/${encodeURIComponent(id)}`, "memory.get");
|
|
7254
|
+
printResult(options.format, result);
|
|
7255
|
+
});
|
|
7256
|
+
memory.command("update <id>").description("Update one BPMAX memory item when supported by the platform proxy").requiredOption("--text <text>", "Replacement memory text").option("--metadata <json>", "Optional JSON metadata or @file").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (id, options) => {
|
|
7257
|
+
const result = await memoryRequest(options, "PUT", `/cli/memory/${encodeURIComponent(id)}`, "memory.update", {
|
|
7258
|
+
text: options.text,
|
|
7259
|
+
metadata: await parseOptionalJson(options.metadata, "--metadata")
|
|
7260
|
+
});
|
|
7261
|
+
printResult(options.format, result);
|
|
7262
|
+
});
|
|
7263
|
+
memory.command("delete <id>").description("Delete one BPMAX memory item when supported by the platform proxy").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "json").action(async (id, options) => {
|
|
7264
|
+
const result = await memoryRequest(options, "DELETE", `/cli/memory/${encodeURIComponent(id)}`, "memory.delete");
|
|
7265
|
+
printResult(options.format, result);
|
|
7266
|
+
});
|
|
7267
|
+
}
|
|
7268
|
+
|
|
5787
7269
|
// src/core/form-schema.ts
|
|
5788
7270
|
var FIELD_KEY_NAMES = [
|
|
5789
7271
|
"key",
|
|
@@ -6295,7 +7777,9 @@ async function fetchProjectFormTemplate(client, flowDetail) {
|
|
|
6295
7777
|
if (!templateId) {
|
|
6296
7778
|
return void 0;
|
|
6297
7779
|
}
|
|
6298
|
-
const template = await apiRequest(client, "GET", `/form_template/${templateId}
|
|
7780
|
+
const template = await apiRequest(client, "GET", `/form_template/${templateId}`, {
|
|
7781
|
+
capability: "project.create"
|
|
7782
|
+
});
|
|
6299
7783
|
return { templateId, template };
|
|
6300
7784
|
}
|
|
6301
7785
|
function hasAutoInitLambda(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
@@ -6438,7 +7922,9 @@ async function validateCreateForm(client, options) {
|
|
|
6438
7922
|
}
|
|
6439
7923
|
const templateId = getFlowFormTemplateId(flowDetail);
|
|
6440
7924
|
if (options.projectFormTemplate || templateId) {
|
|
6441
|
-
const template = options.projectFormTemplate?.template ?? (templateId ? await apiRequest(client, "GET", `/form_template/${templateId}
|
|
7925
|
+
const template = options.projectFormTemplate?.template ?? (templateId ? await apiRequest(client, "GET", `/form_template/${templateId}`, {
|
|
7926
|
+
capability: "project.create"
|
|
7927
|
+
}) : void 0);
|
|
6442
7928
|
const templateFields = extractFormFields(template);
|
|
6443
7929
|
if (templateFields.length > 0) {
|
|
6444
7930
|
const result2 = validateFormAgainstFields(options.form, templateFields);
|
|
@@ -7399,31 +8885,69 @@ var schemaEntries = [
|
|
|
7399
8885
|
{ name: "config.adapters", description: "Show typed config adapter coverage and verified API surfaces.", bootstrap: true },
|
|
7400
8886
|
{ name: "config.init.workspace", description: "Create or update a local AGENTS.md BPMAX config guide.", bootstrap: true },
|
|
7401
8887
|
{ name: "config.form_template.export", description: "Export form template config.", method: "GET", path: "/api/form_template/:id" },
|
|
8888
|
+
{ name: "config.form_template.create", description: "Create and publish a form template through a verified typed adapter.", method: "POST", path: "/api/form_template + /api/form_template/publish" },
|
|
8889
|
+
{ name: "config.form_template.delete", description: "Delete a form template through a verified typed adapter.", method: "DELETE", path: "/api/form_template/:id" },
|
|
7402
8890
|
{ name: "config.form_template.submit", description: "Submit form template edits through a verified typed adapter.", method: "PUT/POST", path: "/api/form_template/:id + /api/form_template/publish" },
|
|
7403
8891
|
{ name: "config.flow_template.export", description: "Export flow template config when a verified draft-aware adapter is available.", method: "GET", path: "/api/flow?flow_type=:flow_type&key=:key&draft=1" },
|
|
8892
|
+
{ name: "config.flow_template.create", description: "Create a platform-generated main flow shell through a verified typed adapter.", method: "POST", path: "/api/flow/flow_type" },
|
|
8893
|
+
{ name: "config.flow_template.delete", description: "Delete a flow template by flow_type or key through a verified typed adapter.", method: "DELETE", path: "/api/flow?flow_type=:flow_type&key=:key" },
|
|
7404
8894
|
{ name: "config.flow_template.submit", description: "Submit flow template config when a verified draft-aware adapter is available.", method: "PUT", path: "/api/flow?flow_type=:flow_type&key=:key&publish=:publish" },
|
|
8895
|
+
{ name: "config.workspace_flow.export", description: "Export workspace-bound flow relations.", method: "GET", path: "/api/workspace/by_key?key=:workspace" },
|
|
8896
|
+
{ name: "config.workspace_flow.create", description: "Create one workspace-flow binding through the verified workspace-flow adapter.", method: "PUT", path: "/api/workspace/workspace_flow" },
|
|
8897
|
+
{ name: "config.workspace_flow.delete", description: "Delete one workspace-flow binding through a typed adapter.", method: "PUT", path: "/api/workspace/workspace_flow" },
|
|
8898
|
+
{ name: "config.workspace_flow.submit", description: "Submit workspace-bound flow relations through a verified typed adapter.", method: "PUT", path: "/api/workspace/workspace_flow" },
|
|
8899
|
+
{ name: "config.flow_app.create", description: "Create form template, create flow template, bind form, and bind the flow to a workspace.", method: "POST/PUT", path: "/api/form_template + /api/flow/flow_type + /api/flow + /api/workspace/workspace_flow" },
|
|
7405
8900
|
{ name: "config.list_template.export", description: "Export list template config.", method: "GET", path: "/api/flow_page_template/:id?skip_i18n=true" },
|
|
8901
|
+
{ name: "config.list_template.create", description: "Create list template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8902
|
+
{ name: "config.list_template.delete", description: "Delete list template config through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id" },
|
|
7406
8903
|
{ name: "config.list_template.submit", description: "Submit list template edits through a verified typed adapter.", method: "PUT", path: "/api/flow_page_template/:id" },
|
|
7407
8904
|
{ name: "config.filter_template.export", description: "Export filter template config.", method: "GET", path: "/api/flow_page_template/:id?skip_i18n=true" },
|
|
8905
|
+
{ name: "config.filter_template.create", description: "Create filter template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8906
|
+
{ name: "config.filter_template.delete", description: "Delete filter template config through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id" },
|
|
7408
8907
|
{ name: "config.filter_template.submit", description: "Submit filter template edits through a verified typed adapter.", method: "PUT", path: "/api/flow_page_template/:id" },
|
|
7409
8908
|
{ name: "config.project_detail_template.export", description: "Export project detail template config.", method: "GET", path: "/api/flow_page_template/:id?type=2&create=&skip_i18n=true" },
|
|
8909
|
+
{ name: "config.project_detail_template.create", description: "Create project detail template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8910
|
+
{ name: "config.project_detail_template.delete", description: "Delete project detail template config through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id" },
|
|
7410
8911
|
{ name: "config.project_detail_template.submit", description: "Submit project detail template edits through a verified typed adapter.", method: "PUT", path: "/api/flow_page_template/:id" },
|
|
7411
8912
|
{ name: "config.console_template.export", description: "Export console template config.", method: "GET", path: "/api/flow_page_template/:id?skip_i18n=true" },
|
|
8913
|
+
{ name: "config.console_template.create", description: "Create console template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8914
|
+
{ name: "config.console_template.delete", description: "Delete console template config through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id" },
|
|
7412
8915
|
{ name: "config.console_template.submit", description: "Submit console template edits through a verified typed adapter.", method: "PUT", path: "/api/flow_page_template/:id" },
|
|
7413
8916
|
{ name: "config.dataset.export", description: "Export dataset config through huanpingtong API-key proxy.", method: "GET/POST", path: "/api/data_set/:id + /api/data_set/list" },
|
|
8917
|
+
{ name: "config.dataset.create", description: "Create dataset config through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set" },
|
|
8918
|
+
{ name: "config.dataset.delete", description: "Delete dataset config through the huanpingtong API-key proxy.", method: "DELETE", path: "/api/data_set/:id" },
|
|
7414
8919
|
{ name: "config.dataset.submit", description: "Submit dataset edit payloads through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set/relationFields/:id" },
|
|
8920
|
+
{ name: "config.dataset.publish", description: "Publish/start a dataset and trigger ES batch generation through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set/publish/:id" },
|
|
8921
|
+
{ name: "config.dataset.pause", description: "Pause a published or pending dataset before a republish lifecycle.", method: "POST", path: "/api/data_set/pause/:id" },
|
|
8922
|
+
{ name: "config.dataset.cancel_refresh", description: "Cancel a stuck dataset refresh without changing dataset publish status.", method: "POST", path: "/api/data_set/cancel-refresh/:id" },
|
|
8923
|
+
{ name: "config.dataset.refresh", description: "Refresh/reindex a dataset by running the pause/publish lifecycle through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set/pause/:id + /api/data_set/publish/:id" },
|
|
7415
8924
|
{ name: "config.dataset_field.export", description: "Export dataset field config through huanpingtong API-key proxy.", method: "GET", path: "/api/data_set_field/:id + /api/data_set_field/getBatchByFlow" },
|
|
8925
|
+
{ name: "config.dataset_field.create", description: "Create dataset field config through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set_field" },
|
|
8926
|
+
{ name: "config.dataset_field.delete", description: "Delete dataset field config through the huanpingtong API-key proxy.", method: "DELETE", path: "/api/data_set_field/:id" },
|
|
7416
8927
|
{ name: "config.dataset_field.submit", description: "Submit dataset field edit payloads through the huanpingtong API-key proxy.", method: "PUT", path: "/api/data_set_field/:id" },
|
|
7417
8928
|
{ name: "config.api_platform.export", description: "Export API platform, instance, API proxy, and response binding config through a typed layered adapter.", method: "GET", path: "/api/api_platform/by_key/:key + /api/api_platform_instance/:id + /api/api_proxy/:id + /api/api_proxy_entity_binding" },
|
|
8929
|
+
{ name: "config.api_platform.create", description: "Create API platform, instance, API proxy, or response binding through typed operation plans.", method: "POST", path: "/api/api_platform + /api/api_platform_instance + /api/api_proxy + /api/api_proxy_entity_binding" },
|
|
8930
|
+
{ name: "config.api_platform.delete", description: "Delete API platform, instance, API proxy, or response binding through typed adapters.", method: "DELETE", path: "/api/api_platform/:id + /api/api_platform_instance/:id + /api/api_proxy/:id + /api/api_proxy_entity_binding/:id" },
|
|
7418
8931
|
{ name: "config.api_platform.submit", description: "Submit API platform layered operation plans through verified typed endpoints.", method: "POST/PUT", path: "/api/api_platform + /api/api_platform_instance + /api/api_proxy + /api/api_proxy_entity_binding" },
|
|
7419
8932
|
{ name: "config.role.export", description: "Export role, points, workspaces, flows, and members.", method: "GET", path: "/api/role + /api/point/point_list + /api/user_role + /api/workspace + /api/flow/list/lightweight" },
|
|
8933
|
+
{ name: "config.role.create", description: "Create roles, custom points, and role members through typed operation plans.", method: "POST", path: "/api/role + /api/point + /api/user_role" },
|
|
8934
|
+
{ name: "config.role.delete", description: "Delete roles, custom points, or role members through typed adapters.", method: "DELETE", path: "/api/role/:id + /api/point/:id + /api/user_role/:id" },
|
|
7420
8935
|
{ name: "config.role.submit", description: "Submit role operation plan through a verified typed adapter.", method: "POST/PUT/DELETE", path: "/api/role + /api/point + /api/user_role" },
|
|
7421
8936
|
{ name: "config.nav_config.export", description: "Export all workspace navigation config records.", method: "GET", path: "/api/configuration?q_type=:type&is_default_action=1" },
|
|
8937
|
+
{ name: "config.nav_config.create", description: "Create workspace navigation config records through a typed operation plan.", method: "POST", path: "/api/configuration?is_default_action=1" },
|
|
8938
|
+
{ name: "config.nav_config.delete", description: "Delete workspace navigation config records through a typed operation plan.", method: "DELETE", path: "/api/configuration/:id?is_default_action=1" },
|
|
7422
8939
|
{ name: "config.nav_config.submit", description: "Submit all workspace navigation config records through a typed operation plan.", method: "POST/PUT", path: "/api/configuration?is_default_action=1 + /api/configuration/:id?is_default_action=1" },
|
|
7423
8940
|
{ name: "config.repository.view", description: "View sysconfig repository environment details from BPMAX.", method: "GET", path: "/api/config_repository + /api/config_repository/:env" },
|
|
7424
8941
|
{ name: "config.repository.sync", description: "Run platform sysconfigdiff pullcommit/extract/pushcommit steps.", method: "POST", path: "/api/config_repository/:env?action=sync" },
|
|
7425
8942
|
{ name: "config.latest.pull", description: "Sync latest BPMAX sysconfig repositories for a configured environment.", method: "external", path: "external:sysconfigdiff + git" },
|
|
7426
8943
|
{ name: "config.e2e.run", description: "Run BPMAX config end-to-end validation orchestration.", method: "local+remote", path: "cli:e2e" },
|
|
8944
|
+
{ name: "memory.status", description: "Check BPMAX memory backend status.", method: "GET", path: "/api/cli/memory/status" },
|
|
8945
|
+
{ name: "memory.search", description: "Search BPMAX memory for the current API-key agent.", method: "POST", path: "/api/cli/memory/search" },
|
|
8946
|
+
{ name: "memory.add", description: "Add BPMAX memory for the current API-key agent.", method: "POST", path: "/api/cli/memory" },
|
|
8947
|
+
{ name: "memory.list", description: "List BPMAX memory when supported by the platform proxy.", method: "GET", path: "/api/cli/memory" },
|
|
8948
|
+
{ name: "memory.get", description: "Get a BPMAX memory item when supported by the platform proxy.", method: "GET", path: "/api/cli/memory/:id" },
|
|
8949
|
+
{ name: "memory.update", description: "Update a BPMAX memory item when supported by the platform proxy.", method: "PUT", path: "/api/cli/memory/:id" },
|
|
8950
|
+
{ name: "memory.delete", description: "Delete a BPMAX memory item when supported by the platform proxy.", method: "DELETE", path: "/api/cli/memory/:id" },
|
|
7427
8951
|
{ name: "api.raw", description: "Call raw BPMAX API paths allowed by server capability whitelist.", method: "*", path: "/api/*" }
|
|
7428
8952
|
];
|
|
7429
8953
|
|
|
@@ -8614,10 +10138,22 @@ function configDirFromArgv(argv) {
|
|
|
8614
10138
|
}
|
|
8615
10139
|
return void 0;
|
|
8616
10140
|
}
|
|
8617
|
-
program.name(CLI_NAME).description("BPMAX multi-environment CLI").version(VERSION).option("--config-dir <dir>", "Root directory for bpmax-cli local state");
|
|
10141
|
+
program.name(CLI_NAME).description("BPMAX multi-environment CLI").version(VERSION).option("--config-dir <dir>", "Root directory for bpmax-cli local state").option("--execution-token <token>", "Short-lived BPMAX AI execution token").option("--action-key <actionKey>", "AI action key for execution audit").option("--session-key <sessionKey>", "AI conversation session key").option("--trace-id <traceId>", "AI execution trace id");
|
|
8618
10142
|
program.hook("preAction", (thisCommand) => {
|
|
8619
10143
|
const options = thisCommand.optsWithGlobals();
|
|
8620
10144
|
setConfigDir(options.configDir);
|
|
10145
|
+
if (options.executionToken) {
|
|
10146
|
+
process.env.BPMAX_EXECUTION_TOKEN = options.executionToken;
|
|
10147
|
+
}
|
|
10148
|
+
if (options.actionKey) {
|
|
10149
|
+
process.env.BPMAX_AI_ACTION_KEY = options.actionKey;
|
|
10150
|
+
}
|
|
10151
|
+
if (options.sessionKey) {
|
|
10152
|
+
process.env.BPMAX_AI_SESSION_KEY = options.sessionKey;
|
|
10153
|
+
}
|
|
10154
|
+
if (options.traceId) {
|
|
10155
|
+
process.env.BPMAX_AI_TRACE_ID = options.traceId;
|
|
10156
|
+
}
|
|
8621
10157
|
beginCommandAuditScope();
|
|
8622
10158
|
});
|
|
8623
10159
|
program.hook("postAction", async () => {
|
|
@@ -8633,6 +10169,7 @@ registerSchemaCommands(program);
|
|
|
8633
10169
|
registerUserCommands(program);
|
|
8634
10170
|
registerEsCommands(program);
|
|
8635
10171
|
registerFlowCommands(program);
|
|
10172
|
+
registerMemoryCommands(program);
|
|
8636
10173
|
registerProjectCommands(program);
|
|
8637
10174
|
registerStepCommands(program);
|
|
8638
10175
|
registerRecipeCommands(program);
|