bpmax-cli 0.2.1-beta.45 → 0.2.1-beta.47
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 +128 -17
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -496,7 +496,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
|
|
|
496
496
|
// package.json
|
|
497
497
|
var package_default = {
|
|
498
498
|
name: "bpmax-cli",
|
|
499
|
-
version: "0.2.1-beta.
|
|
499
|
+
version: "0.2.1-beta.47",
|
|
500
500
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
501
501
|
type: "module",
|
|
502
502
|
bin: {
|
|
@@ -8231,8 +8231,11 @@ function validateDatasetPayload(payload, mode) {
|
|
|
8231
8231
|
if (mode === "create" && payload.id !== void 0 && payload.id !== null && String(payload.id).trim() !== "") {
|
|
8232
8232
|
throw new Error("dataset create \u7981\u6B62\u643A\u5E26 payload.id\uFF1B\u6570\u636E\u96C6 ID \u5FC5\u987B\u7531\u5E73\u53F0\u751F\u6210\u3002");
|
|
8233
8233
|
}
|
|
8234
|
-
if (!Array.isArray(payload.fields)
|
|
8235
|
-
throw new Error(`dataset ${mode}
|
|
8234
|
+
if (!Array.isArray(payload.fields)) {
|
|
8235
|
+
throw new Error(`dataset ${mode} relationFields must be an array.`);
|
|
8236
|
+
}
|
|
8237
|
+
if (mode === "edit" && payload.fields.length === 0) {
|
|
8238
|
+
throw new Error("dataset edit requires at least one relationFields field key.");
|
|
8236
8239
|
}
|
|
8237
8240
|
const fieldKeys = payload.fields.filter((field) => typeof field === "string" && field.trim().length > 0);
|
|
8238
8241
|
if (fieldKeys.length !== payload.fields.length || new Set(fieldKeys).size !== fieldKeys.length) {
|
|
@@ -8331,11 +8334,14 @@ function validateDatasetFieldCreatePayload(payload) {
|
|
|
8331
8334
|
}
|
|
8332
8335
|
const missingSource = [
|
|
8333
8336
|
["payload.flow_type", payload.flow_type],
|
|
8334
|
-
["payload.data_set_id", payload.data_set_id],
|
|
8335
8337
|
["payload.source_table", payload.source_table],
|
|
8336
8338
|
["payload.source_field", payload.source_field],
|
|
8337
8339
|
["payload.source_fk", payload.source_fk]
|
|
8338
8340
|
].filter(([, value]) => typeof value !== "string" || value.trim() === "");
|
|
8341
|
+
const datasetId = payload.data_set_id;
|
|
8342
|
+
if (datasetId === void 0 || datasetId === null || typeof datasetId === "string" && datasetId.trim() === "" || typeof datasetId !== "string" && (typeof datasetId !== "number" || !Number.isFinite(datasetId) || datasetId <= 0)) {
|
|
8343
|
+
missingSource.splice(1, 0, ["payload.data_set_id", datasetId]);
|
|
8344
|
+
}
|
|
8339
8345
|
if (missingSource.length > 0) {
|
|
8340
8346
|
throw new Error(`dataset-field create requires dataset and source mapping fields: ${missingSource.map(([key]) => key).join(", ")}.`);
|
|
8341
8347
|
}
|
|
@@ -12683,6 +12689,10 @@ async function exportConfigDomain(config, profile, domain, id, outDir, options =
|
|
|
12683
12689
|
id,
|
|
12684
12690
|
profile: profile.name,
|
|
12685
12691
|
workspace: profile.config.workspace,
|
|
12692
|
+
...domain === "workspace-flow" ? {
|
|
12693
|
+
transport_workspace: profile.config.workspace,
|
|
12694
|
+
target_workspace: normalizeWorkspaceKey(id)
|
|
12695
|
+
} : {},
|
|
12686
12696
|
exported_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12687
12697
|
base_hash: baseHash,
|
|
12688
12698
|
raw_file: rawFile,
|
|
@@ -13050,9 +13060,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
13050
13060
|
}
|
|
13051
13061
|
await ensureConfigCapability(profile, `${definition.capability}.${createMode ? "create" : "submit"}`);
|
|
13052
13062
|
const workspace = normalizeWorkspaceKey(String(submit2.payload.workspace || id));
|
|
13053
|
-
const
|
|
13054
|
-
if (
|
|
13055
|
-
throw new Error(`Config submit
|
|
13063
|
+
const expectedTargetWorkspace = normalizeWorkspaceKey(String(meta2.target_workspace || meta2.id || ""));
|
|
13064
|
+
if (expectedTargetWorkspace && expectedTargetWorkspace !== workspace) {
|
|
13065
|
+
throw new Error(`Config submit target workspace mismatch. Expected ${expectedTargetWorkspace}, got ${workspace}.`);
|
|
13056
13066
|
}
|
|
13057
13067
|
const endpoint2 = "/workspace/workspace_flow";
|
|
13058
13068
|
const normalizedWorkspaceFlow = normalizeWorkspaceFlowItems(submit2.payload.workspace_flow);
|
|
@@ -13891,18 +13901,97 @@ async function runDatasetLifecycleAction(config, profile, action, id, confirm3)
|
|
|
13891
13901
|
const currentStatus = isRecord3(current) ? Number(current.status) : NaN;
|
|
13892
13902
|
const executableOperations = normalizedAction === "refresh" && currentStatus !== 1 && currentStatus !== 3 ? operations.filter((operation) => operation.action !== "pause") : operations;
|
|
13893
13903
|
const responses = [];
|
|
13904
|
+
let mutationError;
|
|
13905
|
+
let failedOperation;
|
|
13894
13906
|
for (const operation of executableOperations) {
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13907
|
+
try {
|
|
13908
|
+
responses.push({
|
|
13909
|
+
action: operation.action,
|
|
13910
|
+
status: "completed",
|
|
13911
|
+
response: await apiRequest(
|
|
13912
|
+
client,
|
|
13913
|
+
operation.method,
|
|
13914
|
+
operation.endpoint,
|
|
13915
|
+
{ data: {}, capability: operation.capability }
|
|
13916
|
+
)
|
|
13917
|
+
});
|
|
13918
|
+
} catch (error) {
|
|
13919
|
+
mutationError = error;
|
|
13920
|
+
failedOperation = operation;
|
|
13921
|
+
responses.push({
|
|
13922
|
+
action: operation.action,
|
|
13923
|
+
status: "request_failed",
|
|
13924
|
+
error: error instanceof Error ? error.message : String(error ?? ""),
|
|
13925
|
+
http_status: errorStatus(error) ?? null
|
|
13926
|
+
});
|
|
13927
|
+
break;
|
|
13928
|
+
}
|
|
13929
|
+
}
|
|
13930
|
+
let readback;
|
|
13931
|
+
let readbackError;
|
|
13932
|
+
try {
|
|
13933
|
+
readback = await readRemoteConfigDomain(profile, "dataset", id, definition);
|
|
13934
|
+
} catch (error) {
|
|
13935
|
+
readbackError = error;
|
|
13936
|
+
}
|
|
13937
|
+
const readbackStatus = isRecord3(readback) ? Number(readback.status) : NaN;
|
|
13938
|
+
const targetConfirmed = Number.isFinite(readbackStatus) && (normalizedAction === "pause" && readbackStatus === 2 || normalizedAction === "cancel-refresh" && readbackStatus !== 3 || (normalizedAction === "publish" || normalizedAction === "refresh") && (readbackStatus === 1 || readbackStatus === 3));
|
|
13939
|
+
if (mutationError) {
|
|
13940
|
+
const evidence = {
|
|
13941
|
+
code: "config_dataset_lifecycle_failed",
|
|
13942
|
+
rule_id: "config.dataset.lifecycle.remote_mutation",
|
|
13943
|
+
domain: "dataset",
|
|
13944
|
+
id,
|
|
13945
|
+
action: commandAction,
|
|
13946
|
+
failed_operation: failedOperation?.action ?? null,
|
|
13947
|
+
operations: executableOperations,
|
|
13948
|
+
operation_responses: responses,
|
|
13949
|
+
remote_write_state: targetConfirmed ? "confirmed" : "uncertain",
|
|
13950
|
+
remote_submitted: targetConfirmed ? true : null,
|
|
13951
|
+
readback_confirmed: targetConfirmed,
|
|
13952
|
+
...readback === void 0 ? {} : {
|
|
13953
|
+
readback_hash: hashJson(readback),
|
|
13954
|
+
readback
|
|
13955
|
+
},
|
|
13956
|
+
...readbackError ? {
|
|
13957
|
+
readback_error: readbackError instanceof Error ? readbackError.message : String(readbackError ?? "")
|
|
13958
|
+
} : {},
|
|
13959
|
+
readback_hint: configReadbackHint("dataset", id),
|
|
13960
|
+
suggestion: targetConfirmed ? "\u56DE\u8BFB\u5DF2\u786E\u8BA4\u76EE\u6807\u72B6\u6001\uFF0C\u65E0\u9700\u76F2\u76EE\u91CD\u8BD5\u672C\u6B21\u751F\u547D\u5468\u671F\u547D\u4EE4\u3002" : `\u5148\u6267\u884C bpmax-cli config readback dataset --id ${id} --format json \u5BF9\u8D26\uFF1B\u786E\u8BA4\u5F53\u524D\u72B6\u6001\u540E\u518D\u51B3\u5B9A\u662F\u5426\u7EE7\u7EED\u3002`
|
|
13961
|
+
};
|
|
13962
|
+
if (targetConfirmed) {
|
|
13963
|
+
return {
|
|
13964
|
+
...executedFields(),
|
|
13965
|
+
status: "reconciled",
|
|
13966
|
+
partial_success: false,
|
|
13967
|
+
...evidence
|
|
13968
|
+
};
|
|
13969
|
+
}
|
|
13970
|
+
throw configWorkflowError(
|
|
13971
|
+
`dataset ${commandAction} \u8BF7\u6C42\u5931\u8D25\uFF0C\u8FDC\u7AEF\u5199\u5165\u72B6\u6001\u4E0D\u786E\u5B9A\uFF1B\u5728\u5B8C\u6210\u53EA\u8BFB\u56DE\u8BFB\u524D\u4E0D\u8981\u76F2\u76EE\u91CD\u8BD5\u3002`,
|
|
13972
|
+
evidence
|
|
13973
|
+
);
|
|
13974
|
+
}
|
|
13975
|
+
if (readbackError) {
|
|
13976
|
+
throw configWorkflowError(
|
|
13977
|
+
`dataset ${commandAction} \u8BF7\u6C42\u5DF2\u5B8C\u6210\uFF0C\u4F46\u7EC8\u6001\u56DE\u8BFB\u5931\u8D25\uFF1B\u8FDC\u7AEF\u72B6\u6001\u4E0D\u786E\u5B9A\u3002`,
|
|
13978
|
+
{
|
|
13979
|
+
code: "config_dataset_lifecycle_readback_failed",
|
|
13980
|
+
rule_id: "config.dataset.lifecycle.readback",
|
|
13981
|
+
domain: "dataset",
|
|
13982
|
+
id,
|
|
13983
|
+
action: commandAction,
|
|
13984
|
+
operations: executableOperations,
|
|
13985
|
+
operation_responses: responses,
|
|
13986
|
+
remote_write_state: "uncertain",
|
|
13987
|
+
remote_submitted: true,
|
|
13988
|
+
readback_confirmed: false,
|
|
13989
|
+
readback_error: readbackError instanceof Error ? readbackError.message : String(readbackError ?? ""),
|
|
13990
|
+
readback_hint: configReadbackHint("dataset", id),
|
|
13991
|
+
suggestion: `\u5148\u6267\u884C bpmax-cli config readback dataset --id ${id} --format json \u5BF9\u8D26\uFF0C\u4E0D\u8981\u76F4\u63A5\u91CD\u590D\u751F\u547D\u5468\u671F\u547D\u4EE4\u3002`
|
|
13992
|
+
}
|
|
13993
|
+
);
|
|
13904
13994
|
}
|
|
13905
|
-
const readback = await readRemoteConfigDomain(profile, "dataset", id, definition);
|
|
13906
13995
|
return {
|
|
13907
13996
|
...executedFields(),
|
|
13908
13997
|
domain: "dataset",
|
|
@@ -13910,6 +13999,8 @@ async function runDatasetLifecycleAction(config, profile, action, id, confirm3)
|
|
|
13910
13999
|
action: commandAction,
|
|
13911
14000
|
operations: executableOperations,
|
|
13912
14001
|
operation_responses: responses,
|
|
14002
|
+
remote_write_state: "confirmed",
|
|
14003
|
+
readback_confirmed: true,
|
|
13913
14004
|
readback_hash: hashJson(readback),
|
|
13914
14005
|
readback_hint: configReadbackHint("dataset", id),
|
|
13915
14006
|
readback
|
|
@@ -14484,6 +14575,26 @@ function nextStepForDomain(domain) {
|
|
|
14484
14575
|
}
|
|
14485
14576
|
async function analyzeConfigImpact(options) {
|
|
14486
14577
|
const workspaceRoot = path6.resolve(options.workspaceRoot);
|
|
14578
|
+
if (JSON.stringify(options.raw) === JSON.stringify(options.work)) {
|
|
14579
|
+
return {
|
|
14580
|
+
ok: true,
|
|
14581
|
+
domain: options.domain,
|
|
14582
|
+
impact_status: "no_identifier_changes",
|
|
14583
|
+
changed_identifiers: [],
|
|
14584
|
+
references_found: [],
|
|
14585
|
+
impacted_config_domains: [],
|
|
14586
|
+
required_collateral_candidates: [],
|
|
14587
|
+
recommended_next_steps: [],
|
|
14588
|
+
unverified_surfaces: [],
|
|
14589
|
+
scan: {
|
|
14590
|
+
workspace_root: workspaceRoot,
|
|
14591
|
+
scanned_directories: [],
|
|
14592
|
+
scanned_files: 0,
|
|
14593
|
+
skipped_large_files: 0,
|
|
14594
|
+
reference_limit_reached: false
|
|
14595
|
+
}
|
|
14596
|
+
};
|
|
14597
|
+
}
|
|
14487
14598
|
const changedIdentifiers = collectChangedIdentifiers(options.raw, options.work);
|
|
14488
14599
|
const { directories, files } = await collectConfigFiles(workspaceRoot);
|
|
14489
14600
|
const references = [];
|