bpmax-cli 0.2.1-beta.20 → 0.2.1-beta.21
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 +175 -44
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- 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.21",
|
|
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,10 @@ 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 preservesExistingDisabledExtension = hasRemoteFlowIdentity && occurrences.length > 0 && occurrences.every((occurrence) => isExplicitlyDisabledPluginConfig(occurrence.config));
|
|
3657
|
+
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.` : `Flow template uses unknown plugin extension ${pluginKey}; no platform or installed flow-template lint declaration was found.`;
|
|
3658
|
+
if (options.requireInstalled && !preservesExistingDisabledExtension) {
|
|
3651
3659
|
errors.push(message);
|
|
3652
3660
|
} else {
|
|
3653
3661
|
warnings.push(message);
|
|
@@ -3656,9 +3664,9 @@ async function lintFlowTemplatePluginExtensions(options) {
|
|
|
3656
3664
|
plugin: pluginKey,
|
|
3657
3665
|
plugin_key: pluginKey,
|
|
3658
3666
|
domain: "flow-template-node",
|
|
3659
|
-
checked_locations:
|
|
3660
|
-
errors: options.requireInstalled ? [message] : [],
|
|
3661
|
-
warnings: options.requireInstalled ? [] : [message]
|
|
3667
|
+
checked_locations: occurrences.map((occurrence) => occurrence.location),
|
|
3668
|
+
errors: options.requireInstalled && !preservesExistingDisabledExtension ? [message] : [],
|
|
3669
|
+
warnings: options.requireInstalled && !preservesExistingDisabledExtension ? [] : [message]
|
|
3662
3670
|
});
|
|
3663
3671
|
}
|
|
3664
3672
|
for (const pluginKey of allPluginKeys) {
|
|
@@ -5854,18 +5862,60 @@ function normalizeFlowTemplatePayload(work) {
|
|
|
5854
5862
|
}
|
|
5855
5863
|
return payload;
|
|
5856
5864
|
}
|
|
5865
|
+
function validateNonEmptyFlowCreatePayload(payload) {
|
|
5866
|
+
const data = payload.data;
|
|
5867
|
+
if (!isRecord3(data) || !Array.isArray(data.nodes) || data.nodes.length === 0) {
|
|
5868
|
+
throw new Error("flow-template create refuses an empty flow; data.nodes must contain at least one node.");
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5871
|
+
function validateNonEmptyFormCreatePayload(payload) {
|
|
5872
|
+
if (!String(payload.name ?? "").trim()) {
|
|
5873
|
+
throw new Error("form-template create requires name.");
|
|
5874
|
+
}
|
|
5875
|
+
if (!Array.isArray(payload.rule) || payload.rule.flat().length === 0 || !Array.isArray(payload.value) || payload.value.length === 0) {
|
|
5876
|
+
throw new Error("form-template create refuses an empty form; rule and value must contain at least one field.");
|
|
5877
|
+
}
|
|
5878
|
+
}
|
|
5857
5879
|
function buildWorkspaceFlowBindingKey(flowType, flowKey) {
|
|
5858
5880
|
return `${String(flowType || "default")}:${String(flowKey || "")}`;
|
|
5859
5881
|
}
|
|
5860
5882
|
function normalizeWorkspaceFlowItems(value) {
|
|
5861
5883
|
if (!Array.isArray(value)) {
|
|
5862
|
-
|
|
5884
|
+
throw new Error("workspace_flow must be an array.");
|
|
5863
5885
|
}
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5886
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5887
|
+
return value.map((item, index) => {
|
|
5888
|
+
if (!isRecord3(item)) {
|
|
5889
|
+
throw new Error(`workspace_flow[${index}] must be an object.`);
|
|
5890
|
+
}
|
|
5891
|
+
if (typeof item.flow_type !== "string" || !item.flow_type.trim()) {
|
|
5892
|
+
throw new Error(`workspace_flow[${index}].flow_type must be a non-empty string.`);
|
|
5893
|
+
}
|
|
5894
|
+
if (item.flow_key !== void 0 && typeof item.flow_key !== "string") {
|
|
5895
|
+
throw new Error(`workspace_flow[${index}].flow_key must be a string when provided.`);
|
|
5896
|
+
}
|
|
5897
|
+
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") {
|
|
5898
|
+
throw new Error(`workspace_flow[${index}].only_in_workspace must be 0 or 1.`);
|
|
5899
|
+
}
|
|
5900
|
+
const normalized = {
|
|
5901
|
+
flow_type: item.flow_type.trim(),
|
|
5902
|
+
flow_key: typeof item.flow_key === "string" ? item.flow_key.trim() : "",
|
|
5903
|
+
only_in_workspace: normalizeInt(item.only_in_workspace ?? 0)
|
|
5904
|
+
};
|
|
5905
|
+
const key = buildWorkspaceFlowBindingKey(normalized.flow_type, normalized.flow_key);
|
|
5906
|
+
if (seen.has(key)) {
|
|
5907
|
+
throw new Error(`workspace_flow contains duplicate binding ${key}.`);
|
|
5908
|
+
}
|
|
5909
|
+
seen.add(key);
|
|
5910
|
+
return normalized;
|
|
5911
|
+
});
|
|
5912
|
+
}
|
|
5913
|
+
function workspaceFlowClearIntent(work) {
|
|
5914
|
+
const intent = work.destructive_intent;
|
|
5915
|
+
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);
|
|
5916
|
+
}
|
|
5917
|
+
function canonicalWorkspaceFlowItems(value) {
|
|
5918
|
+
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
5919
|
}
|
|
5870
5920
|
function buildWorkspaceFlowSubmitPayload(work) {
|
|
5871
5921
|
const workspace = normalizeWorkspaceKey(String(work.workspace || work.key || ""));
|
|
@@ -5873,6 +5923,9 @@ function buildWorkspaceFlowSubmitPayload(work) {
|
|
|
5873
5923
|
throw new Error("workspace-flow work requires workspace.");
|
|
5874
5924
|
}
|
|
5875
5925
|
const workspaceFlow = normalizeWorkspaceFlowItems(work.workspace_flow ?? work.flows);
|
|
5926
|
+
if (workspaceFlow.length === 0 && !workspaceFlowClearIntent(work)) {
|
|
5927
|
+
throw new Error("workspace-flow refuses to clear all bindings without destructive_intent.clear_workspace_flow=true.");
|
|
5928
|
+
}
|
|
5876
5929
|
return {
|
|
5877
5930
|
workspace,
|
|
5878
5931
|
workspace_flow: workspaceFlow
|
|
@@ -5911,8 +5964,26 @@ function normalizeDatasetPayload(work) {
|
|
|
5911
5964
|
if (id !== void 0 && id !== null && id !== "") {
|
|
5912
5965
|
payload.id = id;
|
|
5913
5966
|
}
|
|
5967
|
+
validateDatasetPayload(payload, mode === "create" ? "create" : "edit");
|
|
5914
5968
|
return payload;
|
|
5915
5969
|
}
|
|
5970
|
+
function validateDatasetPayload(payload, mode) {
|
|
5971
|
+
const required = [
|
|
5972
|
+
["payload.name", payload.name],
|
|
5973
|
+
["payload.basic_table", payload.basic_table],
|
|
5974
|
+
["payload.custom_key", payload.custom_key],
|
|
5975
|
+
["payload.flow_type", payload.flow_type]
|
|
5976
|
+
].filter(([, value]) => typeof value !== "string" || value.trim() === "");
|
|
5977
|
+
if (required.length) {
|
|
5978
|
+
throw new Error(`dataset ${mode} requires identity fields: ${required.map(([key]) => key).join(", ")}.`);
|
|
5979
|
+
}
|
|
5980
|
+
if (mode === "edit" && (payload.id === void 0 || payload.id === null || String(payload.id).trim() === "")) {
|
|
5981
|
+
throw new Error("dataset edit requires payload.id to preserve dataset identity.");
|
|
5982
|
+
}
|
|
5983
|
+
if (!Array.isArray(payload.fields) || payload.fields.length === 0) {
|
|
5984
|
+
throw new Error(`dataset ${mode} requires at least one relationFields field key.`);
|
|
5985
|
+
}
|
|
5986
|
+
}
|
|
5916
5987
|
function firstNonEmpty(...values) {
|
|
5917
5988
|
for (const value of values) {
|
|
5918
5989
|
if (value === null || value === void 0) {
|
|
@@ -6005,6 +6076,20 @@ function validateDatasetFieldCreatePayload(payload) {
|
|
|
6005
6076
|
if (missingSource.length > 0) {
|
|
6006
6077
|
throw new Error(`dataset-field create requires dataset and source mapping fields: ${missingSource.map(([key]) => key).join(", ")}.`);
|
|
6007
6078
|
}
|
|
6079
|
+
validateDatasetFieldRelationMapping(payload);
|
|
6080
|
+
}
|
|
6081
|
+
function validateDatasetFieldRelationMapping(payload) {
|
|
6082
|
+
const relationValues = [payload.source_relation_table, payload.source_relation_field, payload.source_relation_fk];
|
|
6083
|
+
const populated = relationValues.filter((value) => typeof value === "string" && value.trim() !== "").length;
|
|
6084
|
+
if (populated !== 0 && populated !== relationValues.length) {
|
|
6085
|
+
throw new Error("dataset-field relation source mapping requires source_relation_table, source_relation_field, and source_relation_fk together.");
|
|
6086
|
+
}
|
|
6087
|
+
}
|
|
6088
|
+
function assertNoConflictingSourceAliases(source, aliases, label) {
|
|
6089
|
+
const values = aliases.filter((key) => source[key] !== void 0 && source[key] !== null && String(source[key]).trim() !== "").map((key) => String(source[key]).trim());
|
|
6090
|
+
if (new Set(values).size > 1) {
|
|
6091
|
+
throw new Error(`dataset-field ${label} aliases disagree; provide one consistent source mapping value.`);
|
|
6092
|
+
}
|
|
6008
6093
|
}
|
|
6009
6094
|
function normalizeDatasetFieldPayload(work) {
|
|
6010
6095
|
const mode = work.mode;
|
|
@@ -6013,6 +6098,11 @@ function normalizeDatasetFieldPayload(work) {
|
|
|
6013
6098
|
}
|
|
6014
6099
|
const hasSourceObject = isRecord3(work.source);
|
|
6015
6100
|
const source = hasSourceObject ? work.source : work;
|
|
6101
|
+
if (mode === "create") {
|
|
6102
|
+
assertNoConflictingSourceAliases(source, ["table", "sourceTable", "source_table"], "source table");
|
|
6103
|
+
assertNoConflictingSourceAliases(source, ["field", "sourceField", "source_field"], "source field");
|
|
6104
|
+
assertNoConflictingSourceAliases(source, ["fk", "sourceFk", "source_fk"], "source fk");
|
|
6105
|
+
}
|
|
6016
6106
|
const sourcePayload = isRecord3(work.x_wewf_source_payload) ? work.x_wewf_source_payload : {};
|
|
6017
6107
|
const payload = {
|
|
6018
6108
|
data_set_id: firstNonEmpty(work.data_set_id, work.dataSetId, work.dataset_id, sourcePayload.data_set_id, sourcePayload.dataSetId, sourcePayload.dataset_id),
|
|
@@ -6044,6 +6134,8 @@ function normalizeDatasetFieldPayload(work) {
|
|
|
6044
6134
|
payload.sourceFk = payload.source_fk;
|
|
6045
6135
|
if (mode === "create") {
|
|
6046
6136
|
validateDatasetFieldCreatePayload(payload);
|
|
6137
|
+
} else {
|
|
6138
|
+
validateDatasetFieldRelationMapping(payload);
|
|
6047
6139
|
}
|
|
6048
6140
|
const advanced = isRecord3(work.advanced) ? work.advanced : {};
|
|
6049
6141
|
if (Object.prototype.hasOwnProperty.call(advanced, "sourceComputed")) {
|
|
@@ -6931,23 +7023,42 @@ function validateWorkspacePayload(payload) {
|
|
|
6931
7023
|
throw new Error("workspace entry_path is required.");
|
|
6932
7024
|
}
|
|
6933
7025
|
}
|
|
6934
|
-
|
|
7026
|
+
var WORKSPACE_EDITABLE_FIELDS = [
|
|
7027
|
+
"id",
|
|
7028
|
+
"name",
|
|
7029
|
+
"key",
|
|
7030
|
+
"logo",
|
|
7031
|
+
"bg_img",
|
|
7032
|
+
"icon",
|
|
7033
|
+
"description",
|
|
7034
|
+
"is_system_admin",
|
|
7035
|
+
"admin_ids",
|
|
7036
|
+
"entry_path",
|
|
7037
|
+
"m_entry_path",
|
|
7038
|
+
"origin",
|
|
7039
|
+
"white_list"
|
|
7040
|
+
];
|
|
7041
|
+
function isEmptyConfigValue(value) {
|
|
7042
|
+
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || isRecord3(value) && Object.keys(value).length === 0;
|
|
7043
|
+
}
|
|
7044
|
+
function workspaceClearFields(work) {
|
|
7045
|
+
const intent = isRecord3(work.destructive_intent) ? work.destructive_intent : {};
|
|
7046
|
+
const values = Array.isArray(intent.clear_fields) ? intent.clear_fields : Array.isArray(work.clear_fields) ? work.clear_fields : [];
|
|
7047
|
+
return new Set(values.filter((value) => typeof value === "string"));
|
|
7048
|
+
}
|
|
7049
|
+
function normalizeWorkspacePayload(work, raw) {
|
|
6935
7050
|
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
|
-
]);
|
|
7051
|
+
const editMode = work.mode !== "create" && raw !== void 0;
|
|
7052
|
+
const baseline = editMode ? pickDefined(raw, WORKSPACE_EDITABLE_FIELDS) : {};
|
|
7053
|
+
const payload = { ...baseline, ...pickDefined(source, WORKSPACE_EDITABLE_FIELDS) };
|
|
7054
|
+
const clearFields = workspaceClearFields(work);
|
|
7055
|
+
if (editMode) {
|
|
7056
|
+
for (const field of WORKSPACE_EDITABLE_FIELDS) {
|
|
7057
|
+
if (Object.prototype.hasOwnProperty.call(source, field) && isEmptyConfigValue(source[field]) && !isEmptyConfigValue(raw?.[field]) && !clearFields.has(field)) {
|
|
7058
|
+
throw new Error(`workspace edit refuses to clear ${field} without destructive_intent.clear_fields including ${field}.`);
|
|
7059
|
+
}
|
|
7060
|
+
}
|
|
7061
|
+
}
|
|
6951
7062
|
payload.name = String(payload.name ?? "").trim();
|
|
6952
7063
|
payload.key = normalizeWorkspaceConfigKey(payload.key);
|
|
6953
7064
|
payload.entry_path = String(payload.entry_path ?? "/myProject").trim() || "/myProject";
|
|
@@ -7489,11 +7600,17 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
|
|
|
7489
7600
|
if (domain === "form-template") {
|
|
7490
7601
|
validateFormTemplateNameLength(work);
|
|
7491
7602
|
if (isRecord3(work.basic) && Array.isArray(work.layout) && isRecord3(work.fields)) {
|
|
7492
|
-
|
|
7603
|
+
const payload2 = buildStructuredFormTemplatePayload(work);
|
|
7604
|
+
if (work.mode === "create") {
|
|
7605
|
+
validateNonEmptyFormCreatePayload(payload2);
|
|
7606
|
+
}
|
|
7607
|
+
return payload2;
|
|
7493
7608
|
}
|
|
7494
7609
|
const payload = pickDefined(work, ["name", "desc", "category", "option", "rule", "value"]);
|
|
7495
7610
|
if (work.mode === "create") {
|
|
7496
|
-
|
|
7611
|
+
const createPayload = stripFormTemplateCreateIds(payload);
|
|
7612
|
+
validateNonEmptyFormCreatePayload(createPayload);
|
|
7613
|
+
return createPayload;
|
|
7497
7614
|
}
|
|
7498
7615
|
if (Array.isArray(payload.value)) {
|
|
7499
7616
|
payload.value = normalizeFormTemplateValueItems(payload.value);
|
|
@@ -7501,13 +7618,17 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
|
|
|
7501
7618
|
return payload;
|
|
7502
7619
|
}
|
|
7503
7620
|
if (domain === "flow-template") {
|
|
7504
|
-
|
|
7621
|
+
const payload = normalizeFlowTemplatePayload(work);
|
|
7622
|
+
if (work.mode === "create") {
|
|
7623
|
+
validateNonEmptyFlowCreatePayload(payload);
|
|
7624
|
+
}
|
|
7625
|
+
return payload;
|
|
7505
7626
|
}
|
|
7506
7627
|
if (domain === "workspace-flow") {
|
|
7507
7628
|
return buildWorkspaceFlowSubmitPayload(work);
|
|
7508
7629
|
}
|
|
7509
7630
|
if (domain === "workspace") {
|
|
7510
|
-
return normalizeWorkspacePayload(work);
|
|
7631
|
+
return normalizeWorkspacePayload(work, isRecord3(raw) ? raw : void 0);
|
|
7511
7632
|
}
|
|
7512
7633
|
if (domain === "dataset") {
|
|
7513
7634
|
return normalizeDatasetPayload(work);
|
|
@@ -7807,6 +7928,7 @@ async function createFlowTemplateFromWork(config, profile, workFile, confirm3, o
|
|
|
7807
7928
|
validateFlowTemplateRuntimeScripts(work);
|
|
7808
7929
|
validateFlowTemplateFeishuChatPlugin(work);
|
|
7809
7930
|
validateFlowTemplateFormDrivenCreateBaseline(work, void 0, { context: "flow-template create" });
|
|
7931
|
+
validateNonEmptyFlowCreatePayload(work);
|
|
7810
7932
|
const createShell = {
|
|
7811
7933
|
name: String(work.name || ""),
|
|
7812
7934
|
category: work.category || "system",
|
|
@@ -7947,6 +8069,7 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
|
|
|
7947
8069
|
}
|
|
7948
8070
|
const formPayload = buildDomainSubmitPayload("form-template", formWork);
|
|
7949
8071
|
const flowWorkRecord = isRecord3(flowWork) ? flowWork : {};
|
|
8072
|
+
validateNonEmptyFlowCreatePayload(flowWorkRecord);
|
|
7950
8073
|
const flowShell = {
|
|
7951
8074
|
name: String(flowWorkRecord.name || name),
|
|
7952
8075
|
category: flowWorkRecord.category || "system",
|
|
@@ -8113,9 +8236,9 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
|
|
|
8113
8236
|
"/workspace/by_key",
|
|
8114
8237
|
{ params: { key: workspace }, capability: `${workspaceDefinition.capability}.export` }
|
|
8115
8238
|
);
|
|
8116
|
-
const readbackBindings = isRecord3(workspaceReadback) ?
|
|
8117
|
-
if (
|
|
8118
|
-
throw new Error(`flow-app create workspace binding verification failed for ${workspace}
|
|
8239
|
+
const readbackBindings = isRecord3(workspaceReadback) ? canonicalWorkspaceFlowItems(workspaceReadback.workspace_flow) : [];
|
|
8240
|
+
if (JSON.stringify(readbackBindings) !== JSON.stringify(canonicalWorkspaceFlowItems(nextBindings))) {
|
|
8241
|
+
throw new Error(`flow-app create workspace binding verification failed for ${workspace}; exact workspace_flow collection mismatch.`);
|
|
8119
8242
|
}
|
|
8120
8243
|
const flowTemplateId = isRecord3(flowCreateResponse) ? isRecord3(flowCreateResponse.data) ? flowCreateResponse.data.id : flowCreateResponse.id : null;
|
|
8121
8244
|
const evidence = {
|
|
@@ -8852,15 +8975,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
8852
8975
|
{ data: submitPayload2, params: { workspace }, capability: `${definition.capability}.${createMode ? "create" : "submit"}` }
|
|
8853
8976
|
);
|
|
8854
8977
|
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(", ")}`);
|
|
8978
|
+
const bindings = isRecord3(readback2) ? canonicalWorkspaceFlowItems(readback2.workspace_flow) : [];
|
|
8979
|
+
const expectedBindings = canonicalWorkspaceFlowItems(submitPayload2.workspace_flow);
|
|
8980
|
+
if (JSON.stringify(bindings) !== JSON.stringify(expectedBindings)) {
|
|
8981
|
+
throw new Error(`workspace-flow submit verification failed; exact collection mismatch. expected=${JSON.stringify(expectedBindings)} actual=${JSON.stringify(bindings)}`);
|
|
8864
8982
|
}
|
|
8865
8983
|
return {
|
|
8866
8984
|
...executedFields(),
|
|
@@ -9075,6 +9193,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
9075
9193
|
if (domain === "dataset-field") {
|
|
9076
9194
|
validateDatasetFieldCreatePayload(submit.payload);
|
|
9077
9195
|
}
|
|
9196
|
+
if (domain === "dataset") {
|
|
9197
|
+
validateDatasetPayload(submit.payload, "create");
|
|
9198
|
+
}
|
|
9078
9199
|
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
9079
9200
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
9080
9201
|
if (confirm3 !== expectedConfirm2) {
|
|
@@ -9152,6 +9273,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
9152
9273
|
}
|
|
9153
9274
|
}
|
|
9154
9275
|
if (domain === "form-template" && submitMode === "create") {
|
|
9276
|
+
validateNonEmptyFormCreatePayload(submit.payload);
|
|
9155
9277
|
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
9156
9278
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
9157
9279
|
const endpoint2 = "/form_template";
|
|
@@ -9216,6 +9338,15 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
9216
9338
|
if (domain === "form-template") {
|
|
9217
9339
|
assertFormTemplateDraftId(id, current, "submit");
|
|
9218
9340
|
}
|
|
9341
|
+
if (domain === "dataset") {
|
|
9342
|
+
validateDatasetPayload(submit.payload, "edit");
|
|
9343
|
+
if (String(submit.payload.id) !== id || isRecord3(current) && String(current.id) !== id) {
|
|
9344
|
+
throw new Error(`dataset edit identity mismatch; request id, payload.id, and readback id must all equal ${id}.`);
|
|
9345
|
+
}
|
|
9346
|
+
if (isRecord3(current) && String(current.custom_key ?? "") !== String(submit.payload.custom_key ?? "")) {
|
|
9347
|
+
throw new Error("dataset edit refuses to change custom_key identity through relationFields.");
|
|
9348
|
+
}
|
|
9349
|
+
}
|
|
9219
9350
|
validateExpectedType(domain, definition, current);
|
|
9220
9351
|
const currentHash = hashJson(current);
|
|
9221
9352
|
if (currentHash !== submit.base_hash) {
|