bpmax-cli 0.2.1-beta.20 → 0.2.1-beta.22
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 +176 -44
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-builder-shared/__pycache__/base_url.cpython-313.pyc +0 -0
- package/skills/bpmax-builder-shared/__pycache__/template_script_hard_rules.cpython-313.pyc +0 -0
- package/skills/bpmax-dataset-template-editor/scripts/__pycache__/dataset_editor_common.cpython-313.pyc +0 -0
- package/skills/bpmax-dataset-template-editor/tests/__pycache__/test_dataset_editor.cpython-313.pyc +0 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/__pycache__/bpmax_session.cpython-313.pyc +0 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/__pycache__/e2e_state.cpython-313.pyc +0 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/__pycache__/flow_api_matrix.cpython-313.pyc +0 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/__pycache__/flow_filter_fields.cpython-313.pyc +0 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/__pycache__/flow_form_runtime.cpython-313.pyc +0 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/__pycache__/flow_test_profile.cpython-313.pyc +0 -0
- package/skills/bpmax-e2e-flow-test-operator/tests/__pycache__/test_negative_sale_api_tools.cpython-313.pyc +0 -0
- package/skills/bpmax-flow-template-editor/scripts/__pycache__/flow_template_editor_common.cpython-313.pyc +0 -0
- package/skills/bpmax-flow-template-editor/scripts/__pycache__/submit_flow_template.cpython-313.pyc +0 -0
- package/skills/bpmax-flow-template-editor/tests/__pycache__/test_flow_template_editor.cpython-313.pyc +0 -0
- package/skills/bpmax-form-template-editor/scripts/__pycache__/form_template_editor_common.cpython-313.pyc +0 -0
- package/skills/bpmax-form-template-editor/scripts/__pycache__/submit_form_template.cpython-313.pyc +0 -0
- package/skills/bpmax-form-template-editor/tests/__pycache__/test_form_template_editor.cpython-313.pyc +0 -0
- package/skills/bpmax-plugin-config/SKILL.md +4 -0
package/dist/bin.js
CHANGED
|
@@ -469,7 +469,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
|
|
|
469
469
|
// package.json
|
|
470
470
|
var package_default = {
|
|
471
471
|
name: "bpmax-cli",
|
|
472
|
-
version: "0.2.1-beta.
|
|
472
|
+
version: "0.2.1-beta.22",
|
|
473
473
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
474
474
|
type: "module",
|
|
475
475
|
bin: {
|
|
@@ -3595,6 +3595,11 @@ function collectFlowTemplatePluginKeys(flowWork) {
|
|
|
3595
3595
|
});
|
|
3596
3596
|
return [...keys];
|
|
3597
3597
|
}
|
|
3598
|
+
function isExplicitlyDisabledPluginConfig(config) {
|
|
3599
|
+
return Boolean(
|
|
3600
|
+
config && typeof config === "object" && !Array.isArray(config) && config.enabled === false
|
|
3601
|
+
);
|
|
3602
|
+
}
|
|
3598
3603
|
async function readPluginLintRuleFile(skillInstallPath, lintManifest) {
|
|
3599
3604
|
const fullPath = path4.join(skillInstallPath, lintManifest.path);
|
|
3600
3605
|
const value = JSON.parse(await readFile7(fullPath, "utf8"));
|
|
@@ -3630,6 +3635,7 @@ async function lintFlowTemplatePluginExtensions(options) {
|
|
|
3630
3635
|
)
|
|
3631
3636
|
).filter((item) => item.lint.domain === "flow-template-node");
|
|
3632
3637
|
const usedPluginKeys = new Set(collectFlowTemplatePluginKeys(options.flowWork));
|
|
3638
|
+
const hasRemoteFlowIdentity = typeof options.flowWork.flow_type === "string" && options.flowWork.flow_type.trim().length > 0;
|
|
3633
3639
|
if (!usedPluginKeys.size && !platformLintDeclarations.length && !installedLintDeclarations.length) {
|
|
3634
3640
|
return {
|
|
3635
3641
|
ok: true,
|
|
@@ -3646,8 +3652,11 @@ async function lintFlowTemplatePluginExtensions(options) {
|
|
|
3646
3652
|
if (allPluginKeys.has(pluginKey)) {
|
|
3647
3653
|
continue;
|
|
3648
3654
|
}
|
|
3649
|
-
const
|
|
3650
|
-
|
|
3655
|
+
const occurrences = collectFlowTemplatePluginConfigs(options.flowWork, pluginKey);
|
|
3656
|
+
const preservesExistingExtension = hasRemoteFlowIdentity && occurrences.length > 0;
|
|
3657
|
+
const preservesExistingDisabledExtension = preservesExistingExtension && occurrences.every((occurrence) => isExplicitlyDisabledPluginConfig(occurrence.config));
|
|
3658
|
+
const message = preservesExistingDisabledExtension ? `Flow template preserves disabled plugin extension ${pluginKey} without a platform or installed flow-template lint declaration; skipped plugin-specific lint because every occurrence explicitly sets enabled=false.` : preservesExistingExtension ? `Flow template preserves existing plugin extension ${pluginKey} without a platform or installed flow-template lint declaration; skipped plugin-specific lint for compatibility with the existing remote flow.` : `Flow template uses unknown plugin extension ${pluginKey}; no platform or installed flow-template lint declaration was found.`;
|
|
3659
|
+
if (options.requireInstalled && !preservesExistingExtension) {
|
|
3651
3660
|
errors.push(message);
|
|
3652
3661
|
} else {
|
|
3653
3662
|
warnings.push(message);
|
|
@@ -3656,9 +3665,9 @@ async function lintFlowTemplatePluginExtensions(options) {
|
|
|
3656
3665
|
plugin: pluginKey,
|
|
3657
3666
|
plugin_key: pluginKey,
|
|
3658
3667
|
domain: "flow-template-node",
|
|
3659
|
-
checked_locations:
|
|
3660
|
-
errors: options.requireInstalled ? [message] : [],
|
|
3661
|
-
warnings: options.requireInstalled ? [] : [message]
|
|
3668
|
+
checked_locations: occurrences.map((occurrence) => occurrence.location),
|
|
3669
|
+
errors: options.requireInstalled && !preservesExistingExtension ? [message] : [],
|
|
3670
|
+
warnings: options.requireInstalled && !preservesExistingExtension ? [] : [message]
|
|
3662
3671
|
});
|
|
3663
3672
|
}
|
|
3664
3673
|
for (const pluginKey of allPluginKeys) {
|
|
@@ -5854,18 +5863,60 @@ function normalizeFlowTemplatePayload(work) {
|
|
|
5854
5863
|
}
|
|
5855
5864
|
return payload;
|
|
5856
5865
|
}
|
|
5866
|
+
function validateNonEmptyFlowCreatePayload(payload) {
|
|
5867
|
+
const data = payload.data;
|
|
5868
|
+
if (!isRecord3(data) || !Array.isArray(data.nodes) || data.nodes.length === 0) {
|
|
5869
|
+
throw new Error("flow-template create refuses an empty flow; data.nodes must contain at least one node.");
|
|
5870
|
+
}
|
|
5871
|
+
}
|
|
5872
|
+
function validateNonEmptyFormCreatePayload(payload) {
|
|
5873
|
+
if (!String(payload.name ?? "").trim()) {
|
|
5874
|
+
throw new Error("form-template create requires name.");
|
|
5875
|
+
}
|
|
5876
|
+
if (!Array.isArray(payload.rule) || payload.rule.flat().length === 0 || !Array.isArray(payload.value) || payload.value.length === 0) {
|
|
5877
|
+
throw new Error("form-template create refuses an empty form; rule and value must contain at least one field.");
|
|
5878
|
+
}
|
|
5879
|
+
}
|
|
5857
5880
|
function buildWorkspaceFlowBindingKey(flowType, flowKey) {
|
|
5858
5881
|
return `${String(flowType || "default")}:${String(flowKey || "")}`;
|
|
5859
5882
|
}
|
|
5860
5883
|
function normalizeWorkspaceFlowItems(value) {
|
|
5861
5884
|
if (!Array.isArray(value)) {
|
|
5862
|
-
|
|
5885
|
+
throw new Error("workspace_flow must be an array.");
|
|
5863
5886
|
}
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5887
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5888
|
+
return value.map((item, index) => {
|
|
5889
|
+
if (!isRecord3(item)) {
|
|
5890
|
+
throw new Error(`workspace_flow[${index}] must be an object.`);
|
|
5891
|
+
}
|
|
5892
|
+
if (typeof item.flow_type !== "string" || !item.flow_type.trim()) {
|
|
5893
|
+
throw new Error(`workspace_flow[${index}].flow_type must be a non-empty string.`);
|
|
5894
|
+
}
|
|
5895
|
+
if (item.flow_key !== void 0 && typeof item.flow_key !== "string") {
|
|
5896
|
+
throw new Error(`workspace_flow[${index}].flow_key must be a string when provided.`);
|
|
5897
|
+
}
|
|
5898
|
+
if (item.only_in_workspace !== void 0 && item.only_in_workspace !== 0 && item.only_in_workspace !== 1 && item.only_in_workspace !== "0" && item.only_in_workspace !== "1") {
|
|
5899
|
+
throw new Error(`workspace_flow[${index}].only_in_workspace must be 0 or 1.`);
|
|
5900
|
+
}
|
|
5901
|
+
const normalized = {
|
|
5902
|
+
flow_type: item.flow_type.trim(),
|
|
5903
|
+
flow_key: typeof item.flow_key === "string" ? item.flow_key.trim() : "",
|
|
5904
|
+
only_in_workspace: normalizeInt(item.only_in_workspace ?? 0)
|
|
5905
|
+
};
|
|
5906
|
+
const key = buildWorkspaceFlowBindingKey(normalized.flow_type, normalized.flow_key);
|
|
5907
|
+
if (seen.has(key)) {
|
|
5908
|
+
throw new Error(`workspace_flow contains duplicate binding ${key}.`);
|
|
5909
|
+
}
|
|
5910
|
+
seen.add(key);
|
|
5911
|
+
return normalized;
|
|
5912
|
+
});
|
|
5913
|
+
}
|
|
5914
|
+
function workspaceFlowClearIntent(work) {
|
|
5915
|
+
const intent = work.destructive_intent;
|
|
5916
|
+
return work.clear_workspace_flow === true || work.allow_empty_workspace_flow === true || intent === "clear_workspace_flow" || isRecord3(intent) && (intent.clear_workspace_flow === true || intent.clear === true);
|
|
5917
|
+
}
|
|
5918
|
+
function canonicalWorkspaceFlowItems(value) {
|
|
5919
|
+
return normalizeWorkspaceFlowItems(value).sort((left, right) => buildWorkspaceFlowBindingKey(left.flow_type, left.flow_key).localeCompare(buildWorkspaceFlowBindingKey(right.flow_type, right.flow_key)) || Number(left.only_in_workspace) - Number(right.only_in_workspace));
|
|
5869
5920
|
}
|
|
5870
5921
|
function buildWorkspaceFlowSubmitPayload(work) {
|
|
5871
5922
|
const workspace = normalizeWorkspaceKey(String(work.workspace || work.key || ""));
|
|
@@ -5873,6 +5924,9 @@ function buildWorkspaceFlowSubmitPayload(work) {
|
|
|
5873
5924
|
throw new Error("workspace-flow work requires workspace.");
|
|
5874
5925
|
}
|
|
5875
5926
|
const workspaceFlow = normalizeWorkspaceFlowItems(work.workspace_flow ?? work.flows);
|
|
5927
|
+
if (workspaceFlow.length === 0 && !workspaceFlowClearIntent(work)) {
|
|
5928
|
+
throw new Error("workspace-flow refuses to clear all bindings without destructive_intent.clear_workspace_flow=true.");
|
|
5929
|
+
}
|
|
5876
5930
|
return {
|
|
5877
5931
|
workspace,
|
|
5878
5932
|
workspace_flow: workspaceFlow
|
|
@@ -5911,8 +5965,26 @@ function normalizeDatasetPayload(work) {
|
|
|
5911
5965
|
if (id !== void 0 && id !== null && id !== "") {
|
|
5912
5966
|
payload.id = id;
|
|
5913
5967
|
}
|
|
5968
|
+
validateDatasetPayload(payload, mode === "create" ? "create" : "edit");
|
|
5914
5969
|
return payload;
|
|
5915
5970
|
}
|
|
5971
|
+
function validateDatasetPayload(payload, mode) {
|
|
5972
|
+
const required = [
|
|
5973
|
+
["payload.name", payload.name],
|
|
5974
|
+
["payload.basic_table", payload.basic_table],
|
|
5975
|
+
["payload.custom_key", payload.custom_key],
|
|
5976
|
+
["payload.flow_type", payload.flow_type]
|
|
5977
|
+
].filter(([, value]) => typeof value !== "string" || value.trim() === "");
|
|
5978
|
+
if (required.length) {
|
|
5979
|
+
throw new Error(`dataset ${mode} requires identity fields: ${required.map(([key]) => key).join(", ")}.`);
|
|
5980
|
+
}
|
|
5981
|
+
if (mode === "edit" && (payload.id === void 0 || payload.id === null || String(payload.id).trim() === "")) {
|
|
5982
|
+
throw new Error("dataset edit requires payload.id to preserve dataset identity.");
|
|
5983
|
+
}
|
|
5984
|
+
if (!Array.isArray(payload.fields) || payload.fields.length === 0) {
|
|
5985
|
+
throw new Error(`dataset ${mode} requires at least one relationFields field key.`);
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5916
5988
|
function firstNonEmpty(...values) {
|
|
5917
5989
|
for (const value of values) {
|
|
5918
5990
|
if (value === null || value === void 0) {
|
|
@@ -6005,6 +6077,20 @@ function validateDatasetFieldCreatePayload(payload) {
|
|
|
6005
6077
|
if (missingSource.length > 0) {
|
|
6006
6078
|
throw new Error(`dataset-field create requires dataset and source mapping fields: ${missingSource.map(([key]) => key).join(", ")}.`);
|
|
6007
6079
|
}
|
|
6080
|
+
validateDatasetFieldRelationMapping(payload);
|
|
6081
|
+
}
|
|
6082
|
+
function validateDatasetFieldRelationMapping(payload) {
|
|
6083
|
+
const relationValues = [payload.source_relation_table, payload.source_relation_field, payload.source_relation_fk];
|
|
6084
|
+
const populated = relationValues.filter((value) => typeof value === "string" && value.trim() !== "").length;
|
|
6085
|
+
if (populated !== 0 && populated !== relationValues.length) {
|
|
6086
|
+
throw new Error("dataset-field relation source mapping requires source_relation_table, source_relation_field, and source_relation_fk together.");
|
|
6087
|
+
}
|
|
6088
|
+
}
|
|
6089
|
+
function assertNoConflictingSourceAliases(source, aliases, label) {
|
|
6090
|
+
const values = aliases.filter((key) => source[key] !== void 0 && source[key] !== null && String(source[key]).trim() !== "").map((key) => String(source[key]).trim());
|
|
6091
|
+
if (new Set(values).size > 1) {
|
|
6092
|
+
throw new Error(`dataset-field ${label} aliases disagree; provide one consistent source mapping value.`);
|
|
6093
|
+
}
|
|
6008
6094
|
}
|
|
6009
6095
|
function normalizeDatasetFieldPayload(work) {
|
|
6010
6096
|
const mode = work.mode;
|
|
@@ -6013,6 +6099,11 @@ function normalizeDatasetFieldPayload(work) {
|
|
|
6013
6099
|
}
|
|
6014
6100
|
const hasSourceObject = isRecord3(work.source);
|
|
6015
6101
|
const source = hasSourceObject ? work.source : work;
|
|
6102
|
+
if (mode === "create") {
|
|
6103
|
+
assertNoConflictingSourceAliases(source, ["table", "sourceTable", "source_table"], "source table");
|
|
6104
|
+
assertNoConflictingSourceAliases(source, ["field", "sourceField", "source_field"], "source field");
|
|
6105
|
+
assertNoConflictingSourceAliases(source, ["fk", "sourceFk", "source_fk"], "source fk");
|
|
6106
|
+
}
|
|
6016
6107
|
const sourcePayload = isRecord3(work.x_wewf_source_payload) ? work.x_wewf_source_payload : {};
|
|
6017
6108
|
const payload = {
|
|
6018
6109
|
data_set_id: firstNonEmpty(work.data_set_id, work.dataSetId, work.dataset_id, sourcePayload.data_set_id, sourcePayload.dataSetId, sourcePayload.dataset_id),
|
|
@@ -6044,6 +6135,8 @@ function normalizeDatasetFieldPayload(work) {
|
|
|
6044
6135
|
payload.sourceFk = payload.source_fk;
|
|
6045
6136
|
if (mode === "create") {
|
|
6046
6137
|
validateDatasetFieldCreatePayload(payload);
|
|
6138
|
+
} else {
|
|
6139
|
+
validateDatasetFieldRelationMapping(payload);
|
|
6047
6140
|
}
|
|
6048
6141
|
const advanced = isRecord3(work.advanced) ? work.advanced : {};
|
|
6049
6142
|
if (Object.prototype.hasOwnProperty.call(advanced, "sourceComputed")) {
|
|
@@ -6931,23 +7024,42 @@ function validateWorkspacePayload(payload) {
|
|
|
6931
7024
|
throw new Error("workspace entry_path is required.");
|
|
6932
7025
|
}
|
|
6933
7026
|
}
|
|
6934
|
-
|
|
7027
|
+
var WORKSPACE_EDITABLE_FIELDS = [
|
|
7028
|
+
"id",
|
|
7029
|
+
"name",
|
|
7030
|
+
"key",
|
|
7031
|
+
"logo",
|
|
7032
|
+
"bg_img",
|
|
7033
|
+
"icon",
|
|
7034
|
+
"description",
|
|
7035
|
+
"is_system_admin",
|
|
7036
|
+
"admin_ids",
|
|
7037
|
+
"entry_path",
|
|
7038
|
+
"m_entry_path",
|
|
7039
|
+
"origin",
|
|
7040
|
+
"white_list"
|
|
7041
|
+
];
|
|
7042
|
+
function isEmptyConfigValue(value) {
|
|
7043
|
+
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || isRecord3(value) && Object.keys(value).length === 0;
|
|
7044
|
+
}
|
|
7045
|
+
function workspaceClearFields(work) {
|
|
7046
|
+
const intent = isRecord3(work.destructive_intent) ? work.destructive_intent : {};
|
|
7047
|
+
const values = Array.isArray(intent.clear_fields) ? intent.clear_fields : Array.isArray(work.clear_fields) ? work.clear_fields : [];
|
|
7048
|
+
return new Set(values.filter((value) => typeof value === "string"));
|
|
7049
|
+
}
|
|
7050
|
+
function normalizeWorkspacePayload(work, raw) {
|
|
6935
7051
|
const source = isRecord3(work.basic) ? { ...work, ...work.basic } : work;
|
|
6936
|
-
const
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
"m_entry_path",
|
|
6948
|
-
"origin",
|
|
6949
|
-
"white_list"
|
|
6950
|
-
]);
|
|
7052
|
+
const editMode = work.mode !== "create" && raw !== void 0;
|
|
7053
|
+
const baseline = editMode ? pickDefined(raw, WORKSPACE_EDITABLE_FIELDS) : {};
|
|
7054
|
+
const payload = { ...baseline, ...pickDefined(source, WORKSPACE_EDITABLE_FIELDS) };
|
|
7055
|
+
const clearFields = workspaceClearFields(work);
|
|
7056
|
+
if (editMode) {
|
|
7057
|
+
for (const field of WORKSPACE_EDITABLE_FIELDS) {
|
|
7058
|
+
if (Object.prototype.hasOwnProperty.call(source, field) && isEmptyConfigValue(source[field]) && !isEmptyConfigValue(raw?.[field]) && !clearFields.has(field)) {
|
|
7059
|
+
throw new Error(`workspace edit refuses to clear ${field} without destructive_intent.clear_fields including ${field}.`);
|
|
7060
|
+
}
|
|
7061
|
+
}
|
|
7062
|
+
}
|
|
6951
7063
|
payload.name = String(payload.name ?? "").trim();
|
|
6952
7064
|
payload.key = normalizeWorkspaceConfigKey(payload.key);
|
|
6953
7065
|
payload.entry_path = String(payload.entry_path ?? "/myProject").trim() || "/myProject";
|
|
@@ -7489,11 +7601,17 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
|
|
|
7489
7601
|
if (domain === "form-template") {
|
|
7490
7602
|
validateFormTemplateNameLength(work);
|
|
7491
7603
|
if (isRecord3(work.basic) && Array.isArray(work.layout) && isRecord3(work.fields)) {
|
|
7492
|
-
|
|
7604
|
+
const payload2 = buildStructuredFormTemplatePayload(work);
|
|
7605
|
+
if (work.mode === "create") {
|
|
7606
|
+
validateNonEmptyFormCreatePayload(payload2);
|
|
7607
|
+
}
|
|
7608
|
+
return payload2;
|
|
7493
7609
|
}
|
|
7494
7610
|
const payload = pickDefined(work, ["name", "desc", "category", "option", "rule", "value"]);
|
|
7495
7611
|
if (work.mode === "create") {
|
|
7496
|
-
|
|
7612
|
+
const createPayload = stripFormTemplateCreateIds(payload);
|
|
7613
|
+
validateNonEmptyFormCreatePayload(createPayload);
|
|
7614
|
+
return createPayload;
|
|
7497
7615
|
}
|
|
7498
7616
|
if (Array.isArray(payload.value)) {
|
|
7499
7617
|
payload.value = normalizeFormTemplateValueItems(payload.value);
|
|
@@ -7501,13 +7619,17 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
|
|
|
7501
7619
|
return payload;
|
|
7502
7620
|
}
|
|
7503
7621
|
if (domain === "flow-template") {
|
|
7504
|
-
|
|
7622
|
+
const payload = normalizeFlowTemplatePayload(work);
|
|
7623
|
+
if (work.mode === "create") {
|
|
7624
|
+
validateNonEmptyFlowCreatePayload(payload);
|
|
7625
|
+
}
|
|
7626
|
+
return payload;
|
|
7505
7627
|
}
|
|
7506
7628
|
if (domain === "workspace-flow") {
|
|
7507
7629
|
return buildWorkspaceFlowSubmitPayload(work);
|
|
7508
7630
|
}
|
|
7509
7631
|
if (domain === "workspace") {
|
|
7510
|
-
return normalizeWorkspacePayload(work);
|
|
7632
|
+
return normalizeWorkspacePayload(work, isRecord3(raw) ? raw : void 0);
|
|
7511
7633
|
}
|
|
7512
7634
|
if (domain === "dataset") {
|
|
7513
7635
|
return normalizeDatasetPayload(work);
|
|
@@ -7807,6 +7929,7 @@ async function createFlowTemplateFromWork(config, profile, workFile, confirm3, o
|
|
|
7807
7929
|
validateFlowTemplateRuntimeScripts(work);
|
|
7808
7930
|
validateFlowTemplateFeishuChatPlugin(work);
|
|
7809
7931
|
validateFlowTemplateFormDrivenCreateBaseline(work, void 0, { context: "flow-template create" });
|
|
7932
|
+
validateNonEmptyFlowCreatePayload(work);
|
|
7810
7933
|
const createShell = {
|
|
7811
7934
|
name: String(work.name || ""),
|
|
7812
7935
|
category: work.category || "system",
|
|
@@ -7947,6 +8070,7 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
|
|
|
7947
8070
|
}
|
|
7948
8071
|
const formPayload = buildDomainSubmitPayload("form-template", formWork);
|
|
7949
8072
|
const flowWorkRecord = isRecord3(flowWork) ? flowWork : {};
|
|
8073
|
+
validateNonEmptyFlowCreatePayload(flowWorkRecord);
|
|
7950
8074
|
const flowShell = {
|
|
7951
8075
|
name: String(flowWorkRecord.name || name),
|
|
7952
8076
|
category: flowWorkRecord.category || "system",
|
|
@@ -8113,9 +8237,9 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
|
|
|
8113
8237
|
"/workspace/by_key",
|
|
8114
8238
|
{ params: { key: workspace }, capability: `${workspaceDefinition.capability}.export` }
|
|
8115
8239
|
);
|
|
8116
|
-
const readbackBindings = isRecord3(workspaceReadback) ?
|
|
8117
|
-
if (
|
|
8118
|
-
throw new Error(`flow-app create workspace binding verification failed for ${workspace}
|
|
8240
|
+
const readbackBindings = isRecord3(workspaceReadback) ? canonicalWorkspaceFlowItems(workspaceReadback.workspace_flow) : [];
|
|
8241
|
+
if (JSON.stringify(readbackBindings) !== JSON.stringify(canonicalWorkspaceFlowItems(nextBindings))) {
|
|
8242
|
+
throw new Error(`flow-app create workspace binding verification failed for ${workspace}; exact workspace_flow collection mismatch.`);
|
|
8119
8243
|
}
|
|
8120
8244
|
const flowTemplateId = isRecord3(flowCreateResponse) ? isRecord3(flowCreateResponse.data) ? flowCreateResponse.data.id : flowCreateResponse.id : null;
|
|
8121
8245
|
const evidence = {
|
|
@@ -8852,15 +8976,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
8852
8976
|
{ data: submitPayload2, params: { workspace }, capability: `${definition.capability}.${createMode ? "create" : "submit"}` }
|
|
8853
8977
|
);
|
|
8854
8978
|
const readback2 = await readRemoteConfigDomain(profile, domain, workspace, definition);
|
|
8855
|
-
const bindings = isRecord3(readback2) ?
|
|
8856
|
-
const expectedBindings =
|
|
8857
|
-
|
|
8858
|
-
(expected)
|
|
8859
|
-
(actual) => buildWorkspaceFlowBindingKey(actual.flow_type, actual.flow_key) === buildWorkspaceFlowBindingKey(expected.flow_type, expected.flow_key)
|
|
8860
|
-
)
|
|
8861
|
-
);
|
|
8862
|
-
if (missingBindings.length) {
|
|
8863
|
-
throw new Error(`workspace-flow submit verification failed; missing bindings: ${missingBindings.map((item) => buildWorkspaceFlowBindingKey(item.flow_type, item.flow_key)).join(", ")}`);
|
|
8979
|
+
const bindings = isRecord3(readback2) ? canonicalWorkspaceFlowItems(readback2.workspace_flow) : [];
|
|
8980
|
+
const expectedBindings = canonicalWorkspaceFlowItems(submitPayload2.workspace_flow);
|
|
8981
|
+
if (JSON.stringify(bindings) !== JSON.stringify(expectedBindings)) {
|
|
8982
|
+
throw new Error(`workspace-flow submit verification failed; exact collection mismatch. expected=${JSON.stringify(expectedBindings)} actual=${JSON.stringify(bindings)}`);
|
|
8864
8983
|
}
|
|
8865
8984
|
return {
|
|
8866
8985
|
...executedFields(),
|
|
@@ -9075,6 +9194,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
9075
9194
|
if (domain === "dataset-field") {
|
|
9076
9195
|
validateDatasetFieldCreatePayload(submit.payload);
|
|
9077
9196
|
}
|
|
9197
|
+
if (domain === "dataset") {
|
|
9198
|
+
validateDatasetPayload(submit.payload, "create");
|
|
9199
|
+
}
|
|
9078
9200
|
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
9079
9201
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
9080
9202
|
if (confirm3 !== expectedConfirm2) {
|
|
@@ -9152,6 +9274,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
9152
9274
|
}
|
|
9153
9275
|
}
|
|
9154
9276
|
if (domain === "form-template" && submitMode === "create") {
|
|
9277
|
+
validateNonEmptyFormCreatePayload(submit.payload);
|
|
9155
9278
|
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
9156
9279
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
9157
9280
|
const endpoint2 = "/form_template";
|
|
@@ -9216,6 +9339,15 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
9216
9339
|
if (domain === "form-template") {
|
|
9217
9340
|
assertFormTemplateDraftId(id, current, "submit");
|
|
9218
9341
|
}
|
|
9342
|
+
if (domain === "dataset") {
|
|
9343
|
+
validateDatasetPayload(submit.payload, "edit");
|
|
9344
|
+
if (String(submit.payload.id) !== id || isRecord3(current) && String(current.id) !== id) {
|
|
9345
|
+
throw new Error(`dataset edit identity mismatch; request id, payload.id, and readback id must all equal ${id}.`);
|
|
9346
|
+
}
|
|
9347
|
+
if (isRecord3(current) && String(current.custom_key ?? "") !== String(submit.payload.custom_key ?? "")) {
|
|
9348
|
+
throw new Error("dataset edit refuses to change custom_key identity through relationFields.");
|
|
9349
|
+
}
|
|
9350
|
+
}
|
|
9219
9351
|
validateExpectedType(domain, definition, current);
|
|
9220
9352
|
const currentHash = hashJson(current);
|
|
9221
9353
|
if (currentHash !== submit.base_hash) {
|