bpmax-cli 0.1.44-beta.4 → 0.1.44-beta.5
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 +34 -1
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -382,7 +382,7 @@ function normalizePath2(path9) {
|
|
|
382
382
|
// package.json
|
|
383
383
|
var package_default = {
|
|
384
384
|
name: "bpmax-cli",
|
|
385
|
-
version: "0.1.44-beta.
|
|
385
|
+
version: "0.1.44-beta.5",
|
|
386
386
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
387
387
|
type: "module",
|
|
388
388
|
bin: {
|
|
@@ -2737,6 +2737,30 @@ function pickDefined(source, keys) {
|
|
|
2737
2737
|
}
|
|
2738
2738
|
return result;
|
|
2739
2739
|
}
|
|
2740
|
+
function numericId(value) {
|
|
2741
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
2742
|
+
return value;
|
|
2743
|
+
}
|
|
2744
|
+
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
2745
|
+
return Number(value);
|
|
2746
|
+
}
|
|
2747
|
+
return void 0;
|
|
2748
|
+
}
|
|
2749
|
+
function formTemplateDetail(value) {
|
|
2750
|
+
if (isRecord3(value) && isRecord3(value.data)) {
|
|
2751
|
+
return value.data;
|
|
2752
|
+
}
|
|
2753
|
+
return isRecord3(value) ? value : {};
|
|
2754
|
+
}
|
|
2755
|
+
function assertFormTemplateDraftId(id, data, action) {
|
|
2756
|
+
const detail = formTemplateDetail(data);
|
|
2757
|
+
const originTemplateId = numericId(detail.origin_template_id);
|
|
2758
|
+
if (originTemplateId && originTemplateId > 0) {
|
|
2759
|
+
throw new Error(
|
|
2760
|
+
`Refusing to ${action} published form-template id ${id}. Use draft id ${originTemplateId}; published ids are readback-only and must not be used for export/submit/publish.`
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2740
2764
|
function jsonPointerSegment(value) {
|
|
2741
2765
|
return value.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2742
2766
|
}
|
|
@@ -4066,6 +4090,9 @@ async function submitAggregateConfigDomain(profile, domain, id, submit) {
|
|
|
4066
4090
|
}
|
|
4067
4091
|
async function readBackConfigDomain(profile, domain, id, definition) {
|
|
4068
4092
|
const data = await readRemoteConfigDomain(profile, domain, id, definition);
|
|
4093
|
+
if (domain === "form-template") {
|
|
4094
|
+
assertFormTemplateDraftId(id, data, "verify");
|
|
4095
|
+
}
|
|
4069
4096
|
validateExpectedType(domain, definition, data);
|
|
4070
4097
|
return {
|
|
4071
4098
|
readback_hash: hashJson(data)
|
|
@@ -4158,6 +4185,9 @@ async function exportConfigDomain(config, profile, domain, id, outDir, options =
|
|
|
4158
4185
|
}
|
|
4159
4186
|
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
4160
4187
|
const data = await readRemoteConfigDomain(profile, domain, id, definition);
|
|
4188
|
+
if (domain === "form-template") {
|
|
4189
|
+
assertFormTemplateDraftId(id, data, "export");
|
|
4190
|
+
}
|
|
4161
4191
|
validateExpectedType(domain, definition, data);
|
|
4162
4192
|
const baseHash = hashJson(data);
|
|
4163
4193
|
const stem = `${domain}-${id}`;
|
|
@@ -4315,6 +4345,9 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
4315
4345
|
}
|
|
4316
4346
|
const expectedConfirm = `submit ${domain} ${id}`;
|
|
4317
4347
|
const current = await readRemoteConfigDomain(profile, domain, id, definition);
|
|
4348
|
+
if (domain === "form-template") {
|
|
4349
|
+
assertFormTemplateDraftId(id, current, "submit");
|
|
4350
|
+
}
|
|
4318
4351
|
validateExpectedType(domain, definition, current);
|
|
4319
4352
|
const currentHash = hashJson(current);
|
|
4320
4353
|
if (currentHash !== submit.base_hash) {
|