bpmax-cli 0.1.44-beta.7 → 0.1.44-beta.9
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 +635 -69
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +2 -2
- package/skills/bpmax-dataset-template-editor/SKILL.md +2 -2
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +1 -0
- package/skills/bpmax-flow-template-editor/SKILL.md +3 -1
- package/skills/bpmax-role-editor/SKILL.md +1 -1
package/dist/bin.js
CHANGED
|
@@ -265,6 +265,7 @@ function getValue(value, path9) {
|
|
|
265
265
|
function capabilityForRequest(method, path9) {
|
|
266
266
|
const normalizedMethod = method.toUpperCase();
|
|
267
267
|
const normalizedPath = normalizePath2(path9);
|
|
268
|
+
const pageTemplatePrefix = flowPageTemplateCapabilityPrefix(path9);
|
|
268
269
|
if (normalizedPath === "/cli/capabilities") {
|
|
269
270
|
return void 0;
|
|
270
271
|
}
|
|
@@ -285,11 +286,51 @@ function capabilityForRequest(method, path9) {
|
|
|
285
286
|
if (normalizedMethod === "GET" && normalizedPath === "/flow/options") return "flow.options";
|
|
286
287
|
if (normalizedMethod === "GET" && normalizedPath === "/flow") return "config.flow_template.export";
|
|
287
288
|
if (normalizedMethod === "PUT" && normalizedPath === "/flow") return "config.flow_template.submit";
|
|
289
|
+
if (normalizedMethod === "DELETE" && normalizedPath === "/flow") return "config.flow_template.delete";
|
|
288
290
|
if (normalizedMethod === "POST" && normalizedPath === "/flow/batch_get") return "flow.get";
|
|
289
291
|
if (normalizedMethod === "GET" && normalizedPath.startsWith("/form_template/")) return "config.form_template.export";
|
|
290
292
|
if (normalizedMethod === "POST" && normalizedPath === "/form_template") return "config.form_template.create";
|
|
291
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";
|
|
292
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";
|
|
293
334
|
if (normalizedMethod === "PUT" && normalizedPath === "/workspace/workspace_flow") return "config.workspace_flow.submit";
|
|
294
335
|
if (normalizedMethod === "POST" && normalizedPath === "/project_staging/prefill") return "project.create";
|
|
295
336
|
if (normalizedMethod === "POST" && normalizedPath === "/project/search") return "project.search";
|
|
@@ -371,6 +412,20 @@ async function updateProfileCapabilities(profileName, cache) {
|
|
|
371
412
|
};
|
|
372
413
|
await saveConfig(config);
|
|
373
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
|
+
}
|
|
374
429
|
function normalizePath2(path9) {
|
|
375
430
|
let normalized = path9.split("?")[0] || "/";
|
|
376
431
|
if (!normalized.startsWith("/")) {
|
|
@@ -389,7 +444,7 @@ function normalizePath2(path9) {
|
|
|
389
444
|
// package.json
|
|
390
445
|
var package_default = {
|
|
391
446
|
name: "bpmax-cli",
|
|
392
|
-
version: "0.1.44-beta.
|
|
447
|
+
version: "0.1.44-beta.9",
|
|
393
448
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
394
449
|
type: "module",
|
|
395
450
|
bin: {
|
|
@@ -2591,10 +2646,14 @@ var CONFIG_DOMAINS = {
|
|
|
2591
2646
|
exportStatus: "supported",
|
|
2592
2647
|
buildStatus: "supported",
|
|
2593
2648
|
submitStatus: "supported",
|
|
2649
|
+
createPath: "/form_template",
|
|
2650
|
+
createMethod: "POST",
|
|
2651
|
+
deletePath: (id) => `/form_template/${id}`,
|
|
2652
|
+
deleteMethod: "DELETE",
|
|
2594
2653
|
submitPath: (id) => `/form_template/${id}`,
|
|
2595
2654
|
submitMethod: "PUT",
|
|
2596
2655
|
readEndpoints: ["GET /api/form_template/:id"],
|
|
2597
|
-
writeEndpoints: ["POST /api/form_template", "PUT /api/form_template/:id", "POST /api/form_template/publish"],
|
|
2656
|
+
writeEndpoints: ["POST /api/form_template", "PUT /api/form_template/:id", "DELETE /api/form_template/:id", "POST /api/form_template/publish"],
|
|
2598
2657
|
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."]
|
|
2599
2658
|
},
|
|
2600
2659
|
"flow-template": {
|
|
@@ -2603,10 +2662,12 @@ var CONFIG_DOMAINS = {
|
|
|
2603
2662
|
exportStatus: "supported",
|
|
2604
2663
|
buildStatus: "supported",
|
|
2605
2664
|
submitStatus: "supported",
|
|
2665
|
+
deletePath: (id) => `/flow?${flowIdentityQuery(parseFlowIdentity(id))}`,
|
|
2666
|
+
deleteMethod: "DELETE",
|
|
2606
2667
|
submitPath: (id) => `/flow?${flowIdentityQuery(parseFlowIdentity(id), { publish: 2 })}`,
|
|
2607
2668
|
submitMethod: "PUT",
|
|
2608
2669
|
readEndpoints: ["GET /api/flow?flow_type=:flow_type&draft=1", "GET /api/flow?key=:key&draft=1", "POST /api/flow/batch_get"],
|
|
2609
|
-
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"],
|
|
2670
|
+
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"],
|
|
2610
2671
|
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."]
|
|
2611
2672
|
},
|
|
2612
2673
|
"workspace-flow": {
|
|
@@ -2615,11 +2676,13 @@ var CONFIG_DOMAINS = {
|
|
|
2615
2676
|
exportStatus: "supported",
|
|
2616
2677
|
buildStatus: "supported",
|
|
2617
2678
|
submitStatus: "supported",
|
|
2679
|
+
createPath: "/workspace/workspace_flow",
|
|
2680
|
+
createMethod: "PUT",
|
|
2618
2681
|
submitPath: () => "/workspace/workspace_flow",
|
|
2619
2682
|
submitMethod: "PUT",
|
|
2620
2683
|
readEndpoints: ["GET /api/workspace/by_key?key=:workspace"],
|
|
2621
2684
|
writeEndpoints: ["PUT /api/workspace/workspace_flow"],
|
|
2622
|
-
notes: ["Workspace flow submit replaces the workspace_flow relation list for one workspace, then verifies by /workspace/by_key."]
|
|
2685
|
+
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."]
|
|
2623
2686
|
},
|
|
2624
2687
|
"list-template": {
|
|
2625
2688
|
capability: "config.list_template",
|
|
@@ -2627,12 +2690,16 @@ var CONFIG_DOMAINS = {
|
|
|
2627
2690
|
exportStatus: "supported",
|
|
2628
2691
|
buildStatus: "supported",
|
|
2629
2692
|
submitStatus: "supported",
|
|
2693
|
+
createPath: "/flow_page_template",
|
|
2694
|
+
createMethod: "POST",
|
|
2695
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2696
|
+
deleteMethod: "DELETE",
|
|
2630
2697
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2631
2698
|
submitMethod: "PUT",
|
|
2632
2699
|
expectedType: 1,
|
|
2633
2700
|
readEndpoints: ["GET /api/flow_page_template/:id?skip_i18n=true"],
|
|
2634
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2635
|
-
notes: ["type=1 list template."]
|
|
2701
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2702
|
+
notes: ["type=1 list template. Create and edit both use the typed flow_page_template adapter."]
|
|
2636
2703
|
},
|
|
2637
2704
|
"filter-template": {
|
|
2638
2705
|
capability: "config.filter_template",
|
|
@@ -2640,12 +2707,16 @@ var CONFIG_DOMAINS = {
|
|
|
2640
2707
|
exportStatus: "supported",
|
|
2641
2708
|
buildStatus: "supported",
|
|
2642
2709
|
submitStatus: "supported",
|
|
2710
|
+
createPath: "/flow_page_template",
|
|
2711
|
+
createMethod: "POST",
|
|
2712
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2713
|
+
deleteMethod: "DELETE",
|
|
2643
2714
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2644
2715
|
submitMethod: "PUT",
|
|
2645
2716
|
expectedType: 3,
|
|
2646
2717
|
readEndpoints: ["GET /api/flow_page_template/:id?skip_i18n=true"],
|
|
2647
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2648
|
-
notes: ["type=3 filter template."]
|
|
2718
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2719
|
+
notes: ["type=3 filter template. Create and edit both use the typed flow_page_template adapter."]
|
|
2649
2720
|
},
|
|
2650
2721
|
"project-detail-template": {
|
|
2651
2722
|
capability: "config.project_detail_template",
|
|
@@ -2653,12 +2724,16 @@ var CONFIG_DOMAINS = {
|
|
|
2653
2724
|
exportStatus: "supported",
|
|
2654
2725
|
buildStatus: "supported",
|
|
2655
2726
|
submitStatus: "supported",
|
|
2727
|
+
createPath: "/flow_page_template",
|
|
2728
|
+
createMethod: "POST",
|
|
2729
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2730
|
+
deleteMethod: "DELETE",
|
|
2656
2731
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2657
2732
|
submitMethod: "PUT",
|
|
2658
2733
|
expectedType: 2,
|
|
2659
2734
|
readEndpoints: ["GET /api/flow_page_template/:id?type=2&create=&skip_i18n=true"],
|
|
2660
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2661
|
-
notes: ["type=2 project detail template; activate/delete remain domain-specific operations."]
|
|
2735
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2736
|
+
notes: ["type=2 project detail template. Create and edit both use the typed flow_page_template adapter; activate/delete remain domain-specific operations."]
|
|
2662
2737
|
},
|
|
2663
2738
|
"console-template": {
|
|
2664
2739
|
capability: "config.console_template",
|
|
@@ -2666,12 +2741,16 @@ var CONFIG_DOMAINS = {
|
|
|
2666
2741
|
exportStatus: "supported",
|
|
2667
2742
|
buildStatus: "supported",
|
|
2668
2743
|
submitStatus: "supported",
|
|
2744
|
+
createPath: "/flow_page_template",
|
|
2745
|
+
createMethod: "POST",
|
|
2746
|
+
deletePath: (id) => `/flow_page_template/${id}`,
|
|
2747
|
+
deleteMethod: "DELETE",
|
|
2669
2748
|
submitPath: (id) => `/flow_page_template/${id}`,
|
|
2670
2749
|
submitMethod: "PUT",
|
|
2671
2750
|
expectedType: 4,
|
|
2672
2751
|
readEndpoints: ["GET /api/flow_page_template/:id?skip_i18n=true"],
|
|
2673
|
-
writeEndpoints: ["PUT /api/flow_page_template/:id"],
|
|
2674
|
-
notes: ["type=4 console template; this is not /api/configuration."]
|
|
2752
|
+
writeEndpoints: ["POST /api/flow_page_template", "PUT /api/flow_page_template/:id", "DELETE /api/flow_page_template/:id"],
|
|
2753
|
+
notes: ["type=4 console template; this is not /api/configuration. Create and edit both use the typed flow_page_template adapter."]
|
|
2675
2754
|
},
|
|
2676
2755
|
dataset: {
|
|
2677
2756
|
capability: "config.dataset",
|
|
@@ -2679,11 +2758,23 @@ var CONFIG_DOMAINS = {
|
|
|
2679
2758
|
exportStatus: "supported",
|
|
2680
2759
|
buildStatus: "supported",
|
|
2681
2760
|
submitStatus: "supported",
|
|
2761
|
+
createPath: "/data_set",
|
|
2762
|
+
createMethod: "POST",
|
|
2763
|
+
deletePath: (id) => `/data_set/${id}`,
|
|
2764
|
+
deleteMethod: "DELETE",
|
|
2682
2765
|
submitPath: (id) => `/data_set/relationFields/${id}`,
|
|
2683
2766
|
submitMethod: "POST",
|
|
2684
2767
|
readEndpoints: ["GET /api/data_set/:id", "POST /api/data_set/list"],
|
|
2685
|
-
writeEndpoints: [
|
|
2686
|
-
|
|
2768
|
+
writeEndpoints: [
|
|
2769
|
+
"POST /api/data_set",
|
|
2770
|
+
"POST /api/data_set/relationFields/:id",
|
|
2771
|
+
"DELETE /api/data_set/:id",
|
|
2772
|
+
"POST /api/data_set/publish/:id",
|
|
2773
|
+
"POST /api/data_set/pause/:id",
|
|
2774
|
+
"POST /api/data_set/cancel-refresh/:id",
|
|
2775
|
+
"POST /api/data_set/pause/:id + POST /api/data_set/publish/:id (refresh/reindex)"
|
|
2776
|
+
],
|
|
2777
|
+
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."]
|
|
2687
2778
|
},
|
|
2688
2779
|
"dataset-field": {
|
|
2689
2780
|
capability: "config.dataset_field",
|
|
@@ -2691,28 +2782,35 @@ var CONFIG_DOMAINS = {
|
|
|
2691
2782
|
exportStatus: "supported",
|
|
2692
2783
|
buildStatus: "supported",
|
|
2693
2784
|
submitStatus: "supported",
|
|
2785
|
+
createPath: "/data_set_field",
|
|
2786
|
+
createMethod: "POST",
|
|
2787
|
+
deletePath: (id) => `/data_set_field/${id}`,
|
|
2788
|
+
deleteMethod: "DELETE",
|
|
2694
2789
|
submitPath: (id) => `/data_set_field/${id}`,
|
|
2695
2790
|
submitMethod: "PUT",
|
|
2696
2791
|
readEndpoints: ["GET /api/data_set_field/:id", "GET /api/data_set_field/getBatchByFlow"],
|
|
2697
|
-
writeEndpoints: ["PUT /api/data_set_field/:id"],
|
|
2698
|
-
notes: ["
|
|
2792
|
+
writeEndpoints: ["POST /api/data_set_field", "PUT /api/data_set_field/:id", "DELETE /api/data_set_field/:id"],
|
|
2793
|
+
notes: ["Create, edit, and delete one dataset field through the huanpingtong API-Key proxy."]
|
|
2699
2794
|
},
|
|
2700
2795
|
"api-platform": {
|
|
2701
2796
|
capability: "config.api_platform",
|
|
2702
2797
|
exportStatus: "supported",
|
|
2703
2798
|
buildStatus: "supported",
|
|
2704
2799
|
submitStatus: "supported",
|
|
2800
|
+
deleteMethod: "DELETE",
|
|
2705
2801
|
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"],
|
|
2706
|
-
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"],
|
|
2707
|
-
notes: ["API platform config is layered. Export id format: platform:<platform_key>, instance:<id>, or
|
|
2802
|
+
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"],
|
|
2803
|
+
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."]
|
|
2708
2804
|
},
|
|
2709
2805
|
role: {
|
|
2710
2806
|
capability: "config.role",
|
|
2711
2807
|
exportStatus: "supported",
|
|
2712
2808
|
buildStatus: "supported",
|
|
2713
2809
|
submitStatus: "supported",
|
|
2810
|
+
deletePath: (id) => `/role/${id}`,
|
|
2811
|
+
deleteMethod: "DELETE",
|
|
2714
2812
|
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"],
|
|
2715
|
-
writeEndpoints: ["POST /api/role", "PUT /api/role/:id", "POST/PUT/DELETE /api/point", "POST/DELETE /api/user_role"],
|
|
2813
|
+
writeEndpoints: ["POST /api/role", "PUT /api/role/:id", "DELETE /api/role/:id", "POST/PUT/DELETE /api/point", "POST/DELETE /api/user_role"],
|
|
2716
2814
|
notes: ["Role submit executes point operations, role create/update, then member operations with role_id injection."]
|
|
2717
2815
|
},
|
|
2718
2816
|
"nav-config": {
|
|
@@ -2721,22 +2819,30 @@ var CONFIG_DOMAINS = {
|
|
|
2721
2819
|
buildStatus: "supported",
|
|
2722
2820
|
submitStatus: "supported",
|
|
2723
2821
|
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"],
|
|
2724
|
-
writeEndpoints: ["PUT /api/configuration/:id?is_default_action=1", "POST /api/configuration?is_default_action=1"],
|
|
2822
|
+
writeEndpoints: ["PUT /api/configuration/:id?is_default_action=1", "POST /api/configuration?is_default_action=1", "DELETE /api/configuration/:id?is_default_action=1"],
|
|
2725
2823
|
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."]
|
|
2726
2824
|
}
|
|
2727
2825
|
};
|
|
2728
2826
|
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.";
|
|
2729
2827
|
function configAdapterMatrix() {
|
|
2730
|
-
return Object.entries(CONFIG_DOMAINS).map(([domain, definition]) =>
|
|
2731
|
-
domain
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2828
|
+
return Object.entries(CONFIG_DOMAINS).map(([domain, definition]) => {
|
|
2829
|
+
const supportsCreate = Boolean(definition.createPath) || ["flow-template", "api-platform", "role", "nav-config"].includes(domain);
|
|
2830
|
+
const supportsDelete = Boolean(definition.deletePath) || ["workspace-flow", "api-platform", "nav-config"].includes(domain);
|
|
2831
|
+
return {
|
|
2832
|
+
domain,
|
|
2833
|
+
capability_prefix: definition.capability,
|
|
2834
|
+
export_status: definition.exportStatus,
|
|
2835
|
+
create_status: supportsCreate ? "supported" : "blocked",
|
|
2836
|
+
build_status: definition.buildStatus,
|
|
2837
|
+
submit_status: definition.submitStatus,
|
|
2838
|
+
delete_status: supportsDelete ? "supported" : "blocked",
|
|
2839
|
+
create_capability: supportsCreate ? `${definition.capability}.create` : null,
|
|
2840
|
+
delete_capability: supportsDelete ? `${definition.capability}.delete` : null,
|
|
2841
|
+
read_endpoints: definition.readEndpoints,
|
|
2842
|
+
write_endpoints: definition.writeEndpoints,
|
|
2843
|
+
notes: definition.notes
|
|
2844
|
+
};
|
|
2845
|
+
});
|
|
2740
2846
|
}
|
|
2741
2847
|
function hashJson(value) {
|
|
2742
2848
|
return createHash3("sha256").update(JSON.stringify(value)).digest("hex");
|
|
@@ -2914,7 +3020,7 @@ function lintDatasetFieldWork(value, errors) {
|
|
|
2914
3020
|
}
|
|
2915
3021
|
function isFlowTemplateWork(value) {
|
|
2916
3022
|
const data = value.data;
|
|
2917
|
-
return isRecord3(data) && (Array.isArray(data.nodes) || Array.isArray(data.periods) || Object.prototype.hasOwnProperty.call(value, "flow_type") || Object.prototype.hasOwnProperty.call(value, "flowType"));
|
|
3023
|
+
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"));
|
|
2918
3024
|
}
|
|
2919
3025
|
function flowTemplateMainFlowTypeError(flowType) {
|
|
2920
3026
|
if (typeof flowType !== "string" || !flowType.trim()) {
|
|
@@ -2952,6 +3058,102 @@ function validateFlowTemplateIdentityStandard(id, payload) {
|
|
|
2952
3058
|
key: payload?.key ?? payload?.flow_key ?? payload?.flowKey ?? ""
|
|
2953
3059
|
});
|
|
2954
3060
|
}
|
|
3061
|
+
var FORM_DRIVEN_CREATE_HIDE_FIELDS = ["project.name", "project.brief", "project.plan_end_time"];
|
|
3062
|
+
function hasConfiguredFormTemplate(meta) {
|
|
3063
|
+
const value = meta.form_template ?? meta.formTemplate;
|
|
3064
|
+
return value !== void 0 && value !== null && String(value).trim() !== "" && String(value).trim() !== "0";
|
|
3065
|
+
}
|
|
3066
|
+
function hasConfiguredFlowTemplateFormSource(value, meta) {
|
|
3067
|
+
return hasConfiguredFormTemplate(meta) || !isEmptyTemplateReference(value.meta_form_id);
|
|
3068
|
+
}
|
|
3069
|
+
function validateFlowTemplateFormDrivenCreateBaseline(value, errors, options = {}) {
|
|
3070
|
+
const data = isRecord3(value.data) ? value.data : {};
|
|
3071
|
+
const meta = isRecord3(data.meta) ? data.meta : {};
|
|
3072
|
+
if (!options.force && !hasConfiguredFlowTemplateFormSource(value, meta)) {
|
|
3073
|
+
return;
|
|
3074
|
+
}
|
|
3075
|
+
const context = options.context || "flow-template create";
|
|
3076
|
+
const missing = [];
|
|
3077
|
+
const hideFields = Array.isArray(meta.hide_fields) ? meta.hide_fields.map(String) : [];
|
|
3078
|
+
for (const field of FORM_DRIVEN_CREATE_HIDE_FIELDS) {
|
|
3079
|
+
if (!hideFields.includes(field)) {
|
|
3080
|
+
missing.push(`data.meta.hide_fields must include ${field}`);
|
|
3081
|
+
}
|
|
3082
|
+
}
|
|
3083
|
+
if (meta.use_template_project_name !== true) {
|
|
3084
|
+
missing.push("data.meta.use_template_project_name must be true");
|
|
3085
|
+
}
|
|
3086
|
+
if (typeof meta.project_name_template !== "string" || !meta.project_name_template.trim()) {
|
|
3087
|
+
missing.push("data.meta.project_name_template must be a non-empty string");
|
|
3088
|
+
}
|
|
3089
|
+
if (missing.length === 0) {
|
|
3090
|
+
return;
|
|
3091
|
+
}
|
|
3092
|
+
const message = `${context} for form-driven project creation requires default system-field hiding and a project name template: ${missing.join("; ")}.`;
|
|
3093
|
+
if (errors) {
|
|
3094
|
+
errors.push(message);
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
throw new Error(message);
|
|
3098
|
+
}
|
|
3099
|
+
function isEmptyTemplateReference(value) {
|
|
3100
|
+
return value === void 0 || value === null || value === "" || value === 0 || value === "0";
|
|
3101
|
+
}
|
|
3102
|
+
function isRemoteNumericTemplateId(value) {
|
|
3103
|
+
if (typeof value === "number") {
|
|
3104
|
+
return Number.isInteger(value) && Number.isFinite(value) && value > 0;
|
|
3105
|
+
}
|
|
3106
|
+
if (typeof value === "string") {
|
|
3107
|
+
return /^[1-9]\d*$/.test(value.trim());
|
|
3108
|
+
}
|
|
3109
|
+
return false;
|
|
3110
|
+
}
|
|
3111
|
+
function addFlowTemplateRemoteIdError(errors, pathName, value) {
|
|
3112
|
+
errors.push(
|
|
3113
|
+
`${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.`
|
|
3114
|
+
);
|
|
3115
|
+
}
|
|
3116
|
+
function validateFlowTemplateRemoteTemplateRefs(value, errors) {
|
|
3117
|
+
const nextErrors = [];
|
|
3118
|
+
const data = isRecord3(value.data) ? value.data : {};
|
|
3119
|
+
const meta = isRecord3(data.meta) ? data.meta : {};
|
|
3120
|
+
const metaRefs = [
|
|
3121
|
+
["meta_form_id", value.meta_form_id],
|
|
3122
|
+
["data.meta.form_template", meta.form_template],
|
|
3123
|
+
["data.meta.table_list_template", meta.table_list_template],
|
|
3124
|
+
["data.meta.table_filter_template", meta.table_filter_template],
|
|
3125
|
+
["data.meta.step_detail_id", meta.step_detail_id]
|
|
3126
|
+
];
|
|
3127
|
+
for (const [pathName, refValue] of metaRefs) {
|
|
3128
|
+
if (!isEmptyTemplateReference(refValue) && !isRemoteNumericTemplateId(refValue)) {
|
|
3129
|
+
addFlowTemplateRemoteIdError(nextErrors, pathName, refValue);
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
const nodes = Array.isArray(data.nodes) ? data.nodes : [];
|
|
3133
|
+
nodes.forEach((node, index) => {
|
|
3134
|
+
if (!isRecord3(node)) {
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3137
|
+
const nodeName = typeof node.name === "string" && node.name.trim() ? node.name.trim() : `nodes[${index}]`;
|
|
3138
|
+
const nodeRefs = [
|
|
3139
|
+
[`data.nodes[${index}].form_template (${nodeName})`, node.form_template],
|
|
3140
|
+
[`data.nodes[${index}].step_detail_id (${nodeName})`, node.step_detail_id]
|
|
3141
|
+
];
|
|
3142
|
+
for (const [pathName, refValue] of nodeRefs) {
|
|
3143
|
+
if (!isEmptyTemplateReference(refValue) && !isRemoteNumericTemplateId(refValue)) {
|
|
3144
|
+
addFlowTemplateRemoteIdError(nextErrors, pathName, refValue);
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
});
|
|
3148
|
+
if (!nextErrors.length) {
|
|
3149
|
+
return;
|
|
3150
|
+
}
|
|
3151
|
+
if (errors) {
|
|
3152
|
+
errors.push(...nextErrors);
|
|
3153
|
+
return;
|
|
3154
|
+
}
|
|
3155
|
+
throw new Error(`flow-template online template reference gate failed: ${nextErrors.join("; ")}`);
|
|
3156
|
+
}
|
|
2955
3157
|
function lintTemplateFieldReferences(value, errors) {
|
|
2956
3158
|
const content = typeof value.content === "string" ? (() => {
|
|
2957
3159
|
try {
|
|
@@ -3076,6 +3278,7 @@ function normalizeFlowTemplatePayload(work) {
|
|
|
3076
3278
|
meta.form_template = work.meta_form_id;
|
|
3077
3279
|
}
|
|
3078
3280
|
data.meta = meta;
|
|
3281
|
+
validateFlowTemplateRemoteTemplateRefs({ ...work, data });
|
|
3079
3282
|
const payload = pickDefined(work, [
|
|
3080
3283
|
"name",
|
|
3081
3284
|
"flow_type",
|
|
@@ -3128,8 +3331,8 @@ function buildWorkspaceFlowSubmitPayload(work) {
|
|
|
3128
3331
|
}
|
|
3129
3332
|
function normalizeDatasetPayload(work) {
|
|
3130
3333
|
const mode = work.mode;
|
|
3131
|
-
if (mode !== void 0 && mode !== "edit") {
|
|
3132
|
-
throw new Error("dataset typed adapter
|
|
3334
|
+
if (mode !== void 0 && mode !== "edit" && mode !== "create") {
|
|
3335
|
+
throw new Error("dataset typed adapter supports mode edit or create. Publish/pause/cancel-refresh require dedicated lifecycle commands.");
|
|
3133
3336
|
}
|
|
3134
3337
|
const basic = isRecord3(work.basic) ? work.basic : work;
|
|
3135
3338
|
const scripts = isRecord3(work.scripts) ? work.scripts : work;
|
|
@@ -3163,8 +3366,8 @@ function normalizeDatasetPayload(work) {
|
|
|
3163
3366
|
}
|
|
3164
3367
|
function normalizeDatasetFieldPayload(work) {
|
|
3165
3368
|
const mode = work.mode;
|
|
3166
|
-
if (mode !== void 0 && mode !== "edit") {
|
|
3167
|
-
throw new Error("dataset-field typed adapter
|
|
3369
|
+
if (mode !== void 0 && mode !== "edit" && mode !== "create") {
|
|
3370
|
+
throw new Error("dataset-field typed adapter supports mode edit or create. Delete requires a dedicated adapter.");
|
|
3168
3371
|
}
|
|
3169
3372
|
const source = isRecord3(work.source) ? work.source : work;
|
|
3170
3373
|
const payload = {
|
|
@@ -3629,6 +3832,13 @@ function parseApiPlatformIdentity(id) {
|
|
|
3629
3832
|
}
|
|
3630
3833
|
return { layer: "api", value };
|
|
3631
3834
|
}
|
|
3835
|
+
if (trimmed.startsWith("binding:")) {
|
|
3836
|
+
const value = trimmed.slice("binding:".length).trim();
|
|
3837
|
+
if (!value) {
|
|
3838
|
+
throw new Error("api-platform binding id must include id.");
|
|
3839
|
+
}
|
|
3840
|
+
return { layer: "binding", value };
|
|
3841
|
+
}
|
|
3632
3842
|
return { layer: "platform", value: trimmed };
|
|
3633
3843
|
}
|
|
3634
3844
|
function firstRecord(value) {
|
|
@@ -4088,11 +4298,89 @@ function responseFlowType(response) {
|
|
|
4088
4298
|
}
|
|
4089
4299
|
return flowType;
|
|
4090
4300
|
}
|
|
4301
|
+
function operationMethod(value) {
|
|
4302
|
+
return isRecord3(value) && typeof value.method === "string" ? value.method.toUpperCase() : "";
|
|
4303
|
+
}
|
|
4304
|
+
function aggregatePayloadHasNonCreateOperations(domain, payload) {
|
|
4305
|
+
if (domain === "role") {
|
|
4306
|
+
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");
|
|
4307
|
+
}
|
|
4308
|
+
return Array.isArray(payload.operations) && payload.operations.some((op) => operationMethod(op) !== "POST");
|
|
4309
|
+
}
|
|
4310
|
+
function apiPlatformDeletePath(id) {
|
|
4311
|
+
const identity = parseApiPlatformIdentity(id);
|
|
4312
|
+
if (identity.layer === "platform") {
|
|
4313
|
+
if (/^\d+$/.test(identity.value)) {
|
|
4314
|
+
return `/api_platform/${identity.value}`;
|
|
4315
|
+
}
|
|
4316
|
+
throw new Error("api-platform delete for platform requires a numeric platform id. Use platform:<id>.");
|
|
4317
|
+
}
|
|
4318
|
+
if (identity.layer === "instance") {
|
|
4319
|
+
return `/api_platform_instance/${identity.value}`;
|
|
4320
|
+
}
|
|
4321
|
+
if (identity.layer === "api") {
|
|
4322
|
+
return `/api_proxy/${identity.value}`;
|
|
4323
|
+
}
|
|
4324
|
+
return `/api_proxy_entity_binding/${identity.value}`;
|
|
4325
|
+
}
|
|
4326
|
+
function parseWorkspaceFlowDeleteId(id, profile) {
|
|
4327
|
+
const [workspacePart = "", flowType = "", flowKey = ""] = id.split("|");
|
|
4328
|
+
const workspace = normalizeWorkspaceKey(workspacePart || profile.config.workspace || "");
|
|
4329
|
+
if (!workspace || !flowType) {
|
|
4330
|
+
throw new Error('workspace-flow delete id must be "<workspace>|<flow_type>|<flow_key>". Use an empty final flow_key for main flows.');
|
|
4331
|
+
}
|
|
4332
|
+
return { workspace, flowType, flowKey };
|
|
4333
|
+
}
|
|
4334
|
+
async function deleteWorkspaceFlowBinding(profile, id, confirm3) {
|
|
4335
|
+
const definition = CONFIG_DOMAINS["workspace-flow"];
|
|
4336
|
+
await ensureConfigCapability(profile, `${definition.capability}.delete`);
|
|
4337
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4338
|
+
const { workspace, flowType, flowKey } = parseWorkspaceFlowDeleteId(id, profile);
|
|
4339
|
+
const current = await readRemoteConfigDomain(profile, "workspace-flow", workspace, definition);
|
|
4340
|
+
const bindings = isRecord3(current) ? normalizeWorkspaceFlowItems(current.workspace_flow) : [];
|
|
4341
|
+
const nextBindings = bindings.filter(
|
|
4342
|
+
(item) => buildWorkspaceFlowBindingKey(item.flow_type, item.flow_key) !== buildWorkspaceFlowBindingKey(flowType, flowKey)
|
|
4343
|
+
);
|
|
4344
|
+
const expectedConfirm = `delete workspace-flow ${id}`;
|
|
4345
|
+
if (confirm3 !== expectedConfirm) {
|
|
4346
|
+
return {
|
|
4347
|
+
dry_run: true,
|
|
4348
|
+
domain: "workspace-flow",
|
|
4349
|
+
id,
|
|
4350
|
+
endpoint: "/workspace/workspace_flow",
|
|
4351
|
+
method: "PUT",
|
|
4352
|
+
params: { workspace },
|
|
4353
|
+
delete_binding: { flow_type: flowType, flow_key: flowKey },
|
|
4354
|
+
before_count: bindings.length,
|
|
4355
|
+
after_count: nextBindings.length,
|
|
4356
|
+
next: `Run again with --confirm "${expectedConfirm}" to delete.`
|
|
4357
|
+
};
|
|
4358
|
+
}
|
|
4359
|
+
const response = await apiRequest(
|
|
4360
|
+
createApiClient(profile),
|
|
4361
|
+
"PUT",
|
|
4362
|
+
"/workspace/workspace_flow",
|
|
4363
|
+
{ data: { workspace_flow: nextBindings }, params: { workspace }, capability: `${definition.capability}.delete` }
|
|
4364
|
+
);
|
|
4365
|
+
const readback = await readRemoteConfigDomain(profile, "workspace-flow", workspace, definition);
|
|
4366
|
+
return {
|
|
4367
|
+
dry_run: false,
|
|
4368
|
+
domain: "workspace-flow",
|
|
4369
|
+
id,
|
|
4370
|
+
endpoint: "/workspace/workspace_flow",
|
|
4371
|
+
method: "PUT",
|
|
4372
|
+
response,
|
|
4373
|
+
readback_hash: hashJson(readback)
|
|
4374
|
+
};
|
|
4375
|
+
}
|
|
4091
4376
|
async function submitRoleOperations(profile, id, submit) {
|
|
4092
4377
|
const definition = CONFIG_DOMAINS.role;
|
|
4093
|
-
const
|
|
4094
|
-
if (
|
|
4095
|
-
|
|
4378
|
+
const createMode = isRecord3(submit.meta) && submit.meta.mode === "create";
|
|
4379
|
+
if (!createMode) {
|
|
4380
|
+
const current = await collectRoleAggregate(profile, id);
|
|
4381
|
+
if (hashJson(current.raw) !== submit.base_hash) {
|
|
4382
|
+
throw new Error("Remote config changed after export. Re-export before submitting.");
|
|
4383
|
+
}
|
|
4096
4384
|
}
|
|
4097
4385
|
const payload = submit.payload;
|
|
4098
4386
|
if (!isRecord3(payload) || !isRecord3(payload.role)) {
|
|
@@ -4108,7 +4396,10 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
4108
4396
|
client,
|
|
4109
4397
|
op.method,
|
|
4110
4398
|
op.path,
|
|
4111
|
-
{
|
|
4399
|
+
{
|
|
4400
|
+
data: op.body === null ? void 0 : op.body,
|
|
4401
|
+
capability: op.method === "POST" ? `${definition.capability}.create` : op.method === "DELETE" ? `${definition.capability}.delete` : `${definition.capability}.submit`
|
|
4402
|
+
}
|
|
4112
4403
|
));
|
|
4113
4404
|
}
|
|
4114
4405
|
const roleMethod = String(payload.role.method || "");
|
|
@@ -4117,7 +4408,7 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
4117
4408
|
client,
|
|
4118
4409
|
roleMethod,
|
|
4119
4410
|
rolePath,
|
|
4120
|
-
{ data: payload.role.body, capability: `${definition.capability}.submit` }
|
|
4411
|
+
{ data: payload.role.body, capability: roleMethod === "POST" ? `${definition.capability}.create` : `${definition.capability}.submit` }
|
|
4121
4412
|
);
|
|
4122
4413
|
const resolvedRoleId = responseDataId(roleResponse) ?? payload.role.id ?? id;
|
|
4123
4414
|
const memberResponses = [];
|
|
@@ -4136,7 +4427,10 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
4136
4427
|
client,
|
|
4137
4428
|
op.method,
|
|
4138
4429
|
op.path,
|
|
4139
|
-
{
|
|
4430
|
+
{
|
|
4431
|
+
data: body,
|
|
4432
|
+
capability: op.method === "POST" ? `${definition.capability}.create` : op.method === "DELETE" ? `${definition.capability}.delete` : `${definition.capability}.submit`
|
|
4433
|
+
}
|
|
4140
4434
|
));
|
|
4141
4435
|
}
|
|
4142
4436
|
return {
|
|
@@ -4147,7 +4441,7 @@ async function submitRoleOperations(profile, id, submit) {
|
|
|
4147
4441
|
readback_hash: hashJson((await collectRoleAggregate(profile, String(resolvedRoleId))).raw)
|
|
4148
4442
|
};
|
|
4149
4443
|
}
|
|
4150
|
-
async function submitOperationPlan(profile,
|
|
4444
|
+
async function submitOperationPlan(profile, capabilityPrefix, operations) {
|
|
4151
4445
|
if (!Array.isArray(operations)) {
|
|
4152
4446
|
throw new Error("Config submit payload must contain operations array.");
|
|
4153
4447
|
}
|
|
@@ -4157,14 +4451,17 @@ async function submitOperationPlan(profile, capability, operations) {
|
|
|
4157
4451
|
if (!isRecord3(op) || typeof op.method !== "string" || typeof op.path !== "string") {
|
|
4158
4452
|
throw new Error("Invalid config submit operation.");
|
|
4159
4453
|
}
|
|
4160
|
-
if (op.method !== "POST" && op.method !== "PUT") {
|
|
4454
|
+
if (op.method !== "POST" && op.method !== "PUT" && op.method !== "DELETE") {
|
|
4161
4455
|
throw new Error(`Unsupported config submit operation method: ${op.method}.`);
|
|
4162
4456
|
}
|
|
4163
4457
|
responses.push(await apiRequest(
|
|
4164
4458
|
client,
|
|
4165
4459
|
op.method,
|
|
4166
4460
|
op.path,
|
|
4167
|
-
{
|
|
4461
|
+
{
|
|
4462
|
+
data: op.method === "DELETE" ? void 0 : op.payload,
|
|
4463
|
+
capability: op.method === "POST" ? `${capabilityPrefix}.create` : op.method === "DELETE" ? `${capabilityPrefix}.delete` : `${capabilityPrefix}.submit`
|
|
4464
|
+
}
|
|
4168
4465
|
));
|
|
4169
4466
|
}
|
|
4170
4467
|
return responses;
|
|
@@ -4174,7 +4471,13 @@ async function submitAggregateConfigDomain(profile, domain, id, submit) {
|
|
|
4174
4471
|
if (!isRecord3(payload) || !Array.isArray(payload.operations)) {
|
|
4175
4472
|
throw new Error(`${domain} submit payload must contain an operation plan.`);
|
|
4176
4473
|
}
|
|
4177
|
-
const responses = await submitOperationPlan(profile,
|
|
4474
|
+
const responses = await submitOperationPlan(profile, CONFIG_DOMAINS[domain].capability, payload.operations);
|
|
4475
|
+
if (isRecord3(submit.meta) && submit.meta.mode === "create") {
|
|
4476
|
+
return {
|
|
4477
|
+
operation_responses: responses,
|
|
4478
|
+
readback_hash: null
|
|
4479
|
+
};
|
|
4480
|
+
}
|
|
4178
4481
|
const current = domain === "api-platform" ? await collectApiPlatformAggregate(profile, id) : await collectNavConfigAggregate(profile, id);
|
|
4179
4482
|
return {
|
|
4180
4483
|
operation_responses: responses,
|
|
@@ -4190,6 +4493,8 @@ async function createFlowTemplateFromWork(config, profile, workFile, confirm3, o
|
|
|
4190
4493
|
if (!isRecord3(work)) {
|
|
4191
4494
|
throw new Error("flow-template create requires a work JSON object.");
|
|
4192
4495
|
}
|
|
4496
|
+
validateFlowTemplateRemoteTemplateRefs(work);
|
|
4497
|
+
validateFlowTemplateFormDrivenCreateBaseline(work, void 0, { context: "flow-template create" });
|
|
4193
4498
|
const createShell = {
|
|
4194
4499
|
name: String(work.name || ""),
|
|
4195
4500
|
category: work.category || "system",
|
|
@@ -4300,6 +4605,11 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
|
|
|
4300
4605
|
}
|
|
4301
4606
|
const formPayload = buildDomainSubmitPayload("form-template", formWork);
|
|
4302
4607
|
const flowWorkRecord = isRecord3(flowWork) ? flowWork : {};
|
|
4608
|
+
validateFlowTemplateRemoteTemplateRefs(flowWorkRecord);
|
|
4609
|
+
validateFlowTemplateFormDrivenCreateBaseline(flowWorkRecord, void 0, {
|
|
4610
|
+
force: true,
|
|
4611
|
+
context: "flow-app create"
|
|
4612
|
+
});
|
|
4303
4613
|
const flowShell = {
|
|
4304
4614
|
name: String(flowWorkRecord.name || name),
|
|
4305
4615
|
category: flowWorkRecord.category || "system",
|
|
@@ -4614,7 +4924,13 @@ async function lintConfigWorkFile(file) {
|
|
|
4614
4924
|
lintTemplateFieldReferences(value, errors);
|
|
4615
4925
|
}
|
|
4616
4926
|
if (isFlowTemplateWork(value)) {
|
|
4617
|
-
|
|
4927
|
+
const flowWork = value;
|
|
4928
|
+
validateFlowTemplateRemoteTemplateRefs(flowWork, errors);
|
|
4929
|
+
if (flowWork.mode === "create") {
|
|
4930
|
+
validateFlowTemplateFormDrivenCreateBaseline(flowWork, errors, { context: "flow-template create" });
|
|
4931
|
+
} else {
|
|
4932
|
+
validateFlowTemplateStandardFlowType(flowWork, errors);
|
|
4933
|
+
}
|
|
4618
4934
|
}
|
|
4619
4935
|
}
|
|
4620
4936
|
return {
|
|
@@ -4631,7 +4947,6 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4631
4947
|
if (definition.submitStatus !== "supported") {
|
|
4632
4948
|
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
4633
4949
|
}
|
|
4634
|
-
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
4635
4950
|
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4636
4951
|
const submit2 = await readJsonFile(submitFile);
|
|
4637
4952
|
if (!isRecord3(submit2) || submit2.domain !== domain || !isRecord3(submit2.payload)) {
|
|
@@ -4650,6 +4965,8 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4650
4965
|
if (meta2.profile !== profile.name) {
|
|
4651
4966
|
throw new Error(`Config submit metadata profile mismatch. Expected ${profile.name}, got ${String(meta2.profile)}.`);
|
|
4652
4967
|
}
|
|
4968
|
+
const createMode = meta2.mode === "create";
|
|
4969
|
+
await ensureConfigCapability(profile, `${definition.capability}.${createMode ? "create" : "submit"}`);
|
|
4653
4970
|
const workspace = normalizeWorkspaceKey(String(submit2.payload.workspace || id));
|
|
4654
4971
|
const metaWorkspace = normalizeWorkspaceKey(String(meta2.workspace || meta2.id || ""));
|
|
4655
4972
|
if (metaWorkspace && metaWorkspace !== workspace) {
|
|
@@ -4680,7 +4997,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4680
4997
|
client2,
|
|
4681
4998
|
"PUT",
|
|
4682
4999
|
endpoint2,
|
|
4683
|
-
{ data: submitPayload2, params: { workspace }, capability: `${definition.capability}
|
|
5000
|
+
{ data: submitPayload2, params: { workspace }, capability: `${definition.capability}.${createMode ? "create" : "submit"}` }
|
|
4684
5001
|
);
|
|
4685
5002
|
const readback2 = await readRemoteConfigDomain(profile, domain, workspace, definition);
|
|
4686
5003
|
const bindings = isRecord3(readback2) ? normalizeWorkspaceFlowItems(readback2.workspace_flow) : [];
|
|
@@ -4708,8 +5025,6 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4708
5025
|
if (definition.submitStatus !== "supported") {
|
|
4709
5026
|
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
4710
5027
|
}
|
|
4711
|
-
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
4712
|
-
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4713
5028
|
const submit2 = await readJsonFile(submitFile);
|
|
4714
5029
|
if (!isRecord3(submit2) || submit2.domain !== domain || !isRecord3(submit2.payload)) {
|
|
4715
5030
|
throw new Error("Config submit requires a payload produced by `bpmax-cli config <domain> build`.");
|
|
@@ -4730,10 +5045,22 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4730
5045
|
if (meta2.workspace !== profile.config.workspace) {
|
|
4731
5046
|
throw new Error(`Config submit metadata workspace mismatch. Expected ${profile.config.workspace}, got ${String(meta2.workspace)}.`);
|
|
4732
5047
|
}
|
|
5048
|
+
const createMode = meta2.mode === "create";
|
|
5049
|
+
if (createMode) {
|
|
5050
|
+
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
5051
|
+
if (aggregatePayloadHasNonCreateOperations(domain, submit2.payload)) {
|
|
5052
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
5053
|
+
}
|
|
5054
|
+
} else {
|
|
5055
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
5056
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
5057
|
+
}
|
|
4733
5058
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
5059
|
+
if (!createMode) {
|
|
5060
|
+
const current2 = domain === "role" ? await collectRoleAggregate(profile, id) : domain === "api-platform" ? await collectApiPlatformAggregate(profile, id) : await collectNavConfigAggregate(profile, id);
|
|
5061
|
+
if (hashJson(current2.raw) !== submit2.base_hash) {
|
|
5062
|
+
throw new Error("Remote config changed after export. Re-export before submitting.");
|
|
5063
|
+
}
|
|
4737
5064
|
}
|
|
4738
5065
|
if (confirm3 !== expectedConfirm2) {
|
|
4739
5066
|
return {
|
|
@@ -4756,8 +5083,6 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4756
5083
|
if (definition.submitStatus !== "supported" || !definition.submitPath || !definition.submitMethod) {
|
|
4757
5084
|
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
4758
5085
|
}
|
|
4759
|
-
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
4760
|
-
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4761
5086
|
const submit = await readJsonFile(submitFile);
|
|
4762
5087
|
if (!isRecord3(submit) || submit.domain !== domain || !isRecord3(submit.payload)) {
|
|
4763
5088
|
throw new Error("Config submit requires a payload produced by `bpmax-cli config <domain> build`.");
|
|
@@ -4778,11 +5103,59 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4778
5103
|
if (meta.workspace !== profile.config.workspace) {
|
|
4779
5104
|
throw new Error(`Config submit metadata workspace mismatch. Expected ${profile.config.workspace}, got ${String(meta.workspace)}.`);
|
|
4780
5105
|
}
|
|
5106
|
+
const submitMode = isRecord3(meta) ? meta.mode : void 0;
|
|
5107
|
+
if (submitMode === "create" && domain !== "form-template") {
|
|
5108
|
+
if (!definition.createPath || !definition.createMethod) {
|
|
5109
|
+
throw new Error(`${domain} create is not implemented in the typed adapter.`);
|
|
5110
|
+
}
|
|
5111
|
+
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
5112
|
+
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
5113
|
+
if (confirm3 !== expectedConfirm2) {
|
|
5114
|
+
return {
|
|
5115
|
+
dry_run: true,
|
|
5116
|
+
domain,
|
|
5117
|
+
id,
|
|
5118
|
+
endpoint: definition.createPath,
|
|
5119
|
+
method: definition.createMethod,
|
|
5120
|
+
payload: submit.payload,
|
|
5121
|
+
next: `Run again with --confirm "${expectedConfirm2}" to submit.`
|
|
5122
|
+
};
|
|
5123
|
+
}
|
|
5124
|
+
const client2 = createApiClient(profile);
|
|
5125
|
+
const response2 = await apiRequest(
|
|
5126
|
+
client2,
|
|
5127
|
+
definition.createMethod,
|
|
5128
|
+
definition.createPath,
|
|
5129
|
+
{ data: submit.payload, capability: `${definition.capability}.create` }
|
|
5130
|
+
);
|
|
5131
|
+
const createdId = responseDataId(response2);
|
|
5132
|
+
let readbackHash = null;
|
|
5133
|
+
if (createdId !== void 0 && createdId !== null && createdId !== "" && definition.exportPath) {
|
|
5134
|
+
try {
|
|
5135
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
5136
|
+
readbackHash = hashJson(await readRemoteConfigDomain(profile, domain, String(createdId), definition));
|
|
5137
|
+
} catch {
|
|
5138
|
+
readbackHash = null;
|
|
5139
|
+
}
|
|
5140
|
+
}
|
|
5141
|
+
return {
|
|
5142
|
+
dry_run: false,
|
|
5143
|
+
domain,
|
|
5144
|
+
id,
|
|
5145
|
+
created_id: createdId ?? null,
|
|
5146
|
+
endpoint: definition.createPath,
|
|
5147
|
+
method: definition.createMethod,
|
|
5148
|
+
response: response2,
|
|
5149
|
+
readback_hash: readbackHash
|
|
5150
|
+
};
|
|
5151
|
+
}
|
|
5152
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
5153
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4781
5154
|
if (domain === "flow-template") {
|
|
5155
|
+
validateFlowTemplateRemoteTemplateRefs(submit.payload);
|
|
4782
5156
|
validateFlowTemplateStandardFlowType(submit.payload);
|
|
4783
5157
|
validateFlowTemplateIdentityStandard(id, submit.payload);
|
|
4784
5158
|
}
|
|
4785
|
-
const submitMode = isRecord3(meta) ? meta.mode : void 0;
|
|
4786
5159
|
if (domain === "form-template" && submitMode === "create") {
|
|
4787
5160
|
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
4788
5161
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
@@ -4915,6 +5288,125 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4915
5288
|
...readback
|
|
4916
5289
|
};
|
|
4917
5290
|
}
|
|
5291
|
+
async function deleteConfigDomain(config, profile, domain, id, confirm3) {
|
|
5292
|
+
void config;
|
|
5293
|
+
const definition = CONFIG_DOMAINS[domain];
|
|
5294
|
+
if (domain === "workspace-flow") {
|
|
5295
|
+
return deleteWorkspaceFlowBinding(profile, id, confirm3);
|
|
5296
|
+
}
|
|
5297
|
+
await ensureConfigCapability(profile, `${definition.capability}.delete`);
|
|
5298
|
+
const expectedConfirm = `delete ${domain} ${id}`;
|
|
5299
|
+
const client = createApiClient(profile);
|
|
5300
|
+
if (domain === "nav-config") {
|
|
5301
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
5302
|
+
const current = await collectNavConfigAggregate(profile, id);
|
|
5303
|
+
const configs = isRecord3(current.raw.configs) ? current.raw.configs : {};
|
|
5304
|
+
const operations = [];
|
|
5305
|
+
for (const type of NAV_CONFIG_TYPES) {
|
|
5306
|
+
const item = isRecord3(configs[type]) ? configs[type] : {};
|
|
5307
|
+
const itemId = item.id;
|
|
5308
|
+
if (itemId !== void 0 && itemId !== null && itemId !== "") {
|
|
5309
|
+
operations.push({ type, method: "DELETE", path: `/configuration/${itemId}?is_default_action=1`, id: itemId });
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
if (confirm3 !== expectedConfirm) {
|
|
5313
|
+
return {
|
|
5314
|
+
dry_run: true,
|
|
5315
|
+
domain,
|
|
5316
|
+
id,
|
|
5317
|
+
operation_plan: { operations },
|
|
5318
|
+
next: `Run again with --confirm "${expectedConfirm}" to delete.`
|
|
5319
|
+
};
|
|
5320
|
+
}
|
|
5321
|
+
const responses = await submitOperationPlan(profile, definition.capability, operations);
|
|
5322
|
+
return {
|
|
5323
|
+
dry_run: false,
|
|
5324
|
+
domain,
|
|
5325
|
+
id,
|
|
5326
|
+
operation_responses: responses
|
|
5327
|
+
};
|
|
5328
|
+
}
|
|
5329
|
+
const endpoint = domain === "api-platform" ? apiPlatformDeletePath(id) : definition.deletePath?.(id);
|
|
5330
|
+
if (!endpoint || !definition.deleteMethod) {
|
|
5331
|
+
throw new Error(`${domain} delete is not implemented in the typed adapter.`);
|
|
5332
|
+
}
|
|
5333
|
+
if (confirm3 !== expectedConfirm) {
|
|
5334
|
+
return {
|
|
5335
|
+
dry_run: true,
|
|
5336
|
+
domain,
|
|
5337
|
+
id,
|
|
5338
|
+
endpoint,
|
|
5339
|
+
method: definition.deleteMethod,
|
|
5340
|
+
next: `Run again with --confirm "${expectedConfirm}" to delete.`
|
|
5341
|
+
};
|
|
5342
|
+
}
|
|
5343
|
+
const response = await apiRequest(
|
|
5344
|
+
client,
|
|
5345
|
+
definition.deleteMethod,
|
|
5346
|
+
endpoint,
|
|
5347
|
+
{ capability: `${definition.capability}.delete` }
|
|
5348
|
+
);
|
|
5349
|
+
return {
|
|
5350
|
+
dry_run: false,
|
|
5351
|
+
domain,
|
|
5352
|
+
id,
|
|
5353
|
+
endpoint,
|
|
5354
|
+
method: definition.deleteMethod,
|
|
5355
|
+
response
|
|
5356
|
+
};
|
|
5357
|
+
}
|
|
5358
|
+
async function runDatasetLifecycleAction(config, profile, action, id, confirm3) {
|
|
5359
|
+
void config;
|
|
5360
|
+
const commandAction = action;
|
|
5361
|
+
const normalizedAction = action === "reindex" ? "refresh" : action;
|
|
5362
|
+
const definition = CONFIG_DOMAINS.dataset;
|
|
5363
|
+
const capability = `${definition.capability}.${normalizedAction === "cancel-refresh" ? "cancel_refresh" : normalizedAction}`;
|
|
5364
|
+
await ensureConfigCapability(profile, capability);
|
|
5365
|
+
const method = "POST";
|
|
5366
|
+
const expectedConfirm = `${commandAction} dataset ${id}`;
|
|
5367
|
+
const operations = normalizedAction === "refresh" ? [
|
|
5368
|
+
{ action: "pause", method, endpoint: `/data_set/pause/${id}`, capability: `${definition.capability}.pause`, optional: true },
|
|
5369
|
+
{ action: "publish", method, endpoint: `/data_set/publish/${id}`, capability: `${definition.capability}.publish` }
|
|
5370
|
+
] : [
|
|
5371
|
+
{ action: normalizedAction, method, endpoint: `/data_set/${normalizedAction}/${id}`, capability }
|
|
5372
|
+
];
|
|
5373
|
+
if (confirm3 !== expectedConfirm) {
|
|
5374
|
+
return {
|
|
5375
|
+
dry_run: true,
|
|
5376
|
+
domain: "dataset",
|
|
5377
|
+
id,
|
|
5378
|
+
action: commandAction,
|
|
5379
|
+
operations,
|
|
5380
|
+
next: `Run again with --confirm "${expectedConfirm}" to ${commandAction} dataset ${id}.`
|
|
5381
|
+
};
|
|
5382
|
+
}
|
|
5383
|
+
const client = createApiClient(profile);
|
|
5384
|
+
const current = await readRemoteConfigDomain(profile, "dataset", id, definition);
|
|
5385
|
+
const currentStatus = isRecord3(current) ? Number(current.status) : NaN;
|
|
5386
|
+
const executableOperations = normalizedAction === "refresh" && currentStatus !== 1 && currentStatus !== 3 ? operations.filter((operation) => operation.action !== "pause") : operations;
|
|
5387
|
+
const responses = [];
|
|
5388
|
+
for (const operation of executableOperations) {
|
|
5389
|
+
responses.push({
|
|
5390
|
+
action: operation.action,
|
|
5391
|
+
response: await apiRequest(
|
|
5392
|
+
client,
|
|
5393
|
+
operation.method,
|
|
5394
|
+
operation.endpoint,
|
|
5395
|
+
{ data: {}, capability: operation.capability }
|
|
5396
|
+
)
|
|
5397
|
+
});
|
|
5398
|
+
}
|
|
5399
|
+
const readback = await readRemoteConfigDomain(profile, "dataset", id, definition);
|
|
5400
|
+
return {
|
|
5401
|
+
dry_run: false,
|
|
5402
|
+
domain: "dataset",
|
|
5403
|
+
id,
|
|
5404
|
+
action: commandAction,
|
|
5405
|
+
operations: executableOperations,
|
|
5406
|
+
operation_responses: responses,
|
|
5407
|
+
readback
|
|
5408
|
+
};
|
|
5409
|
+
}
|
|
4918
5410
|
|
|
4919
5411
|
// src/core/config-workspace.ts
|
|
4920
5412
|
import { mkdir as mkdir4, readFile as readFile7, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -5848,21 +6340,33 @@ function registerConfigCommands(program2) {
|
|
|
5848
6340
|
});
|
|
5849
6341
|
Object.keys(CONFIG_DOMAINS).forEach((domain) => {
|
|
5850
6342
|
const domainCommand = config.command(domain).description(`Manage BPMAX ${domain} configuration`);
|
|
6343
|
+
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");
|
|
5851
6344
|
if (domain === "flow-template") {
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
const result = await createFlowTemplateFromWork(
|
|
5856
|
-
configData,
|
|
5857
|
-
resolved,
|
|
5858
|
-
options.work,
|
|
5859
|
-
options.confirm,
|
|
5860
|
-
{ publishLive: Boolean(options.publishLive) }
|
|
5861
|
-
);
|
|
5862
|
-
await saveConfig(configData);
|
|
5863
|
-
printResult(options.format, result);
|
|
5864
|
-
});
|
|
6345
|
+
createCommand.requiredOption("--work <file>", "Flow-template work JSON file");
|
|
6346
|
+
} else {
|
|
6347
|
+
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");
|
|
5865
6348
|
}
|
|
6349
|
+
createCommand.action(async (options) => {
|
|
6350
|
+
const configData = await loadConfig();
|
|
6351
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
6352
|
+
const result = domain === "flow-template" ? await createFlowTemplateFromWork(
|
|
6353
|
+
configData,
|
|
6354
|
+
resolved,
|
|
6355
|
+
String(options.work || ""),
|
|
6356
|
+
options.confirm,
|
|
6357
|
+
{ publishLive: Boolean(options.publishLive) }
|
|
6358
|
+
) : await submitConfigDomain(
|
|
6359
|
+
configData,
|
|
6360
|
+
resolved,
|
|
6361
|
+
domain,
|
|
6362
|
+
String(options.id || ""),
|
|
6363
|
+
String(options.payload || ""),
|
|
6364
|
+
options.confirm,
|
|
6365
|
+
{ publishLive: Boolean(options.publishLive) }
|
|
6366
|
+
);
|
|
6367
|
+
await saveConfig(configData);
|
|
6368
|
+
printResult(options.format, result);
|
|
6369
|
+
});
|
|
5866
6370
|
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) => {
|
|
5867
6371
|
const configData = await loadConfig();
|
|
5868
6372
|
const resolved = resolveProfile(configData, options.profile);
|
|
@@ -5915,6 +6419,42 @@ function registerConfigCommands(program2) {
|
|
|
5915
6419
|
await saveConfig(configData);
|
|
5916
6420
|
printResult(options.format, result);
|
|
5917
6421
|
});
|
|
6422
|
+
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) => {
|
|
6423
|
+
const configData = await loadConfig();
|
|
6424
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
6425
|
+
const result = await deleteConfigDomain(
|
|
6426
|
+
configData,
|
|
6427
|
+
resolved,
|
|
6428
|
+
domain,
|
|
6429
|
+
options.id,
|
|
6430
|
+
options.confirm
|
|
6431
|
+
);
|
|
6432
|
+
await saveConfig(configData);
|
|
6433
|
+
printResult(options.format, result);
|
|
6434
|
+
});
|
|
6435
|
+
if (domain === "dataset") {
|
|
6436
|
+
[
|
|
6437
|
+
["publish", "Publish/start a dataset and trigger ES batch generation"],
|
|
6438
|
+
["pause", "Pause a published or pending dataset"],
|
|
6439
|
+
["cancel-refresh", "Cancel a stuck dataset refresh without changing publish status"],
|
|
6440
|
+
["refresh", "Refresh/reindex a dataset and generate a new ES batch"],
|
|
6441
|
+
["reindex", "Alias of refresh; regenerate the dataset ES batch"]
|
|
6442
|
+
].forEach(([action, description]) => {
|
|
6443
|
+
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) => {
|
|
6444
|
+
const configData = await loadConfig();
|
|
6445
|
+
const resolved = resolveProfile(configData, options.profile);
|
|
6446
|
+
const result = await runDatasetLifecycleAction(
|
|
6447
|
+
configData,
|
|
6448
|
+
resolved,
|
|
6449
|
+
action,
|
|
6450
|
+
options.id,
|
|
6451
|
+
options.confirm
|
|
6452
|
+
);
|
|
6453
|
+
await saveConfig(configData);
|
|
6454
|
+
printResult(options.format, result);
|
|
6455
|
+
});
|
|
6456
|
+
});
|
|
6457
|
+
}
|
|
5918
6458
|
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) => {
|
|
5919
6459
|
const configData = await loadConfig();
|
|
5920
6460
|
const resolved = resolveProfile(configData, options.profile);
|
|
@@ -8075,30 +8615,56 @@ var schemaEntries = [
|
|
|
8075
8615
|
{ name: "config.init.workspace", description: "Create or update a local AGENTS.md BPMAX config guide.", bootstrap: true },
|
|
8076
8616
|
{ name: "config.form_template.export", description: "Export form template config.", method: "GET", path: "/api/form_template/:id" },
|
|
8077
8617
|
{ 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" },
|
|
8618
|
+
{ name: "config.form_template.delete", description: "Delete a form template through a verified typed adapter.", method: "DELETE", path: "/api/form_template/:id" },
|
|
8078
8619
|
{ 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" },
|
|
8079
8620
|
{ 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" },
|
|
8080
8621
|
{ 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" },
|
|
8622
|
+
{ 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" },
|
|
8081
8623
|
{ 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" },
|
|
8082
8624
|
{ name: "config.workspace_flow.export", description: "Export workspace-bound flow relations.", method: "GET", path: "/api/workspace/by_key?key=:workspace" },
|
|
8625
|
+
{ name: "config.workspace_flow.create", description: "Create one workspace-flow binding through the verified workspace-flow adapter.", method: "PUT", path: "/api/workspace/workspace_flow" },
|
|
8626
|
+
{ name: "config.workspace_flow.delete", description: "Delete one workspace-flow binding through a typed adapter.", method: "PUT", path: "/api/workspace/workspace_flow" },
|
|
8083
8627
|
{ name: "config.workspace_flow.submit", description: "Submit workspace-bound flow relations through a verified typed adapter.", method: "PUT", path: "/api/workspace/workspace_flow" },
|
|
8084
8628
|
{ 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" },
|
|
8085
8629
|
{ name: "config.list_template.export", description: "Export list template config.", method: "GET", path: "/api/flow_page_template/:id?skip_i18n=true" },
|
|
8630
|
+
{ name: "config.list_template.create", description: "Create list template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8631
|
+
{ name: "config.list_template.delete", description: "Delete list template config through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id" },
|
|
8086
8632
|
{ name: "config.list_template.submit", description: "Submit list template edits through a verified typed adapter.", method: "PUT", path: "/api/flow_page_template/:id" },
|
|
8087
8633
|
{ name: "config.filter_template.export", description: "Export filter template config.", method: "GET", path: "/api/flow_page_template/:id?skip_i18n=true" },
|
|
8634
|
+
{ name: "config.filter_template.create", description: "Create filter template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8635
|
+
{ name: "config.filter_template.delete", description: "Delete filter template config through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id" },
|
|
8088
8636
|
{ name: "config.filter_template.submit", description: "Submit filter template edits through a verified typed adapter.", method: "PUT", path: "/api/flow_page_template/:id" },
|
|
8089
8637
|
{ 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" },
|
|
8638
|
+
{ name: "config.project_detail_template.create", description: "Create project detail template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8639
|
+
{ 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" },
|
|
8090
8640
|
{ 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" },
|
|
8091
8641
|
{ name: "config.console_template.export", description: "Export console template config.", method: "GET", path: "/api/flow_page_template/:id?skip_i18n=true" },
|
|
8642
|
+
{ name: "config.console_template.create", description: "Create console template config through a verified typed adapter.", method: "POST", path: "/api/flow_page_template" },
|
|
8643
|
+
{ name: "config.console_template.delete", description: "Delete console template config through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id" },
|
|
8092
8644
|
{ name: "config.console_template.submit", description: "Submit console template edits through a verified typed adapter.", method: "PUT", path: "/api/flow_page_template/:id" },
|
|
8093
8645
|
{ 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" },
|
|
8646
|
+
{ name: "config.dataset.create", description: "Create dataset config through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set" },
|
|
8647
|
+
{ name: "config.dataset.delete", description: "Delete dataset config through the huanpingtong API-key proxy.", method: "DELETE", path: "/api/data_set/:id" },
|
|
8094
8648
|
{ name: "config.dataset.submit", description: "Submit dataset edit payloads through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set/relationFields/:id" },
|
|
8649
|
+
{ 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" },
|
|
8650
|
+
{ name: "config.dataset.pause", description: "Pause a published or pending dataset before a republish lifecycle.", method: "POST", path: "/api/data_set/pause/:id" },
|
|
8651
|
+
{ 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" },
|
|
8652
|
+
{ 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" },
|
|
8095
8653
|
{ 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" },
|
|
8654
|
+
{ name: "config.dataset_field.create", description: "Create dataset field config through the huanpingtong API-key proxy.", method: "POST", path: "/api/data_set_field" },
|
|
8655
|
+
{ name: "config.dataset_field.delete", description: "Delete dataset field config through the huanpingtong API-key proxy.", method: "DELETE", path: "/api/data_set_field/:id" },
|
|
8096
8656
|
{ 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" },
|
|
8097
8657
|
{ 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" },
|
|
8658
|
+
{ 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" },
|
|
8659
|
+
{ 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" },
|
|
8098
8660
|
{ 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" },
|
|
8099
8661
|
{ 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" },
|
|
8662
|
+
{ 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" },
|
|
8663
|
+
{ 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" },
|
|
8100
8664
|
{ 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" },
|
|
8101
8665
|
{ name: "config.nav_config.export", description: "Export all workspace navigation config records.", method: "GET", path: "/api/configuration?q_type=:type&is_default_action=1" },
|
|
8666
|
+
{ 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" },
|
|
8667
|
+
{ 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" },
|
|
8102
8668
|
{ 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" },
|
|
8103
8669
|
{ name: "config.repository.view", description: "View sysconfig repository environment details from BPMAX.", method: "GET", path: "/api/config_repository + /api/config_repository/:env" },
|
|
8104
8670
|
{ name: "config.repository.sync", description: "Run platform sysconfigdiff pullcommit/extract/pushcommit steps.", method: "POST", path: "/api/config_repository/:env?action=sync" },
|