@camunda8/cli 4.6.0-alpha.7 → 4.6.0
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.
|
@@ -16,7 +16,6 @@ version resolution.
|
|
|
16
16
|
| `cache.ts` | Cache I/O, sync, search, version resolution |
|
|
17
17
|
| `releases.ts` | `camunda/connectors` GitHub releases: listing, newest-release-per-minor selection, bundle download, tar.gz reader |
|
|
18
18
|
| `helpers.ts` | `--set` parsing, file/URL fetch, glob → regex, multi-binding lookup, condition warnings, `atomicOverwriteFile` |
|
|
19
|
-
| `binding.ts` | Binding-target resolution shared by `apply`/`edit` — which moddle child + property a `zeebe:input`/etc. binding writes to. Hand-rolled stand-in for bpmn-js-element-templates' internal `setPropertyValue`; see the note at the top of the file about replacing it once bpmn-io/bpmn-js-element-templates#236 ships. |
|
|
20
19
|
| `vendor.ts` | `resolveVendorBundle()` + the minimal bpmn-js `Modeler`/`modeling` type surface shared by `apply`/`edit` |
|
|
21
20
|
| `vendor-src/bundle-entry.js` | esbuild entry — re-exports `Modeler`, `CloudElementTemplatesCoreModule`, `ZeebeModdleExtension` |
|
|
22
21
|
|
|
@@ -69,12 +68,14 @@ version resolution.
|
|
|
69
68
|
call — correct for first-time application or a version upgrade, but
|
|
70
69
|
it silently clobbers any hand-authored customization layered into a
|
|
71
70
|
Hidden-owned extension attribute (see c8ctl#466). `edit` never calls
|
|
72
|
-
`applyTemplate()` — it only writes
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
`applyTemplate()` — it only writes the `--set` properties via the
|
|
72
|
+
library's `elementTemplates.setPropertyValue` (gated by
|
|
73
|
+
`isConditionMet`), so it can't reset anything the template doesn't
|
|
74
|
+
explicitly touch. `edit` must also never register the template via
|
|
75
|
+
`elementTemplates.set()`: the library's ConditionalBehavior would then
|
|
76
|
+
re-run template application whenever a write changes the active
|
|
77
|
+
property set. Don't collapse these back into one code path without
|
|
78
|
+
re-solving that tension.
|
|
78
79
|
- **JSON output uses element-templates schema field names verbatim.**
|
|
79
80
|
No invented derivations — `binding`, `optional`, `value`, `condition`,
|
|
80
81
|
`group` (id), `elementType: { value }`, `engines: { camunda }`. The
|
|
@@ -8261,6 +8261,18 @@ var init_dist5 = __esm({
|
|
|
8261
8261
|
import { createRequire as createRequire2 } from "node:module";
|
|
8262
8262
|
import { dirname as dirname3 } from "node:path";
|
|
8263
8263
|
|
|
8264
|
+
// default-plugins/element-template/helpers.ts
|
|
8265
|
+
var import_semver = __toESM(require_semver2(), 1);
|
|
8266
|
+
import {
|
|
8267
|
+
existsSync,
|
|
8268
|
+
readFileSync,
|
|
8269
|
+
realpathSync,
|
|
8270
|
+
renameSync,
|
|
8271
|
+
unlinkSync,
|
|
8272
|
+
writeFileSync
|
|
8273
|
+
} from "node:fs";
|
|
8274
|
+
import { resolve as resolvePath } from "node:path";
|
|
8275
|
+
|
|
8264
8276
|
// default-plugins/element-template/migration/moddle.ts
|
|
8265
8277
|
function isModdleElement(value) {
|
|
8266
8278
|
if (typeof value !== "object" || value === null) {
|
|
@@ -8291,67 +8303,6 @@ function getModdleList(element, name2) {
|
|
|
8291
8303
|
return Array.isArray(value) ? value.filter(isModdleElement) : [];
|
|
8292
8304
|
}
|
|
8293
8305
|
|
|
8294
|
-
// default-plugins/element-template/binding.ts
|
|
8295
|
-
function findExtensionByType(extensionElements, type) {
|
|
8296
|
-
if (!extensionElements) {
|
|
8297
|
-
return void 0;
|
|
8298
|
-
}
|
|
8299
|
-
const values = getModdleList(extensionElements, "values");
|
|
8300
|
-
return values.find((v) => v.$type === type);
|
|
8301
|
-
}
|
|
8302
|
-
function findExtensionContainers(extensionElements) {
|
|
8303
|
-
return {
|
|
8304
|
-
ioMapping: findExtensionByType(extensionElements, "zeebe:IoMapping"),
|
|
8305
|
-
taskHeaders: findExtensionByType(extensionElements, "zeebe:TaskHeaders"),
|
|
8306
|
-
taskDefinition: findExtensionByType(
|
|
8307
|
-
extensionElements,
|
|
8308
|
-
"zeebe:TaskDefinition"
|
|
8309
|
-
),
|
|
8310
|
-
zeebeProperties: findExtensionByType(extensionElements, "zeebe:Properties")
|
|
8311
|
-
};
|
|
8312
|
-
}
|
|
8313
|
-
function resolveBindingTarget(binding, containers) {
|
|
8314
|
-
switch (binding.type) {
|
|
8315
|
-
case "zeebe:input": {
|
|
8316
|
-
const inputs = getModdleList(containers.ioMapping, "inputParameters");
|
|
8317
|
-
const child = inputs.find((p) => p.target === binding.name);
|
|
8318
|
-
return child ? { child, property: "source" } : void 0;
|
|
8319
|
-
}
|
|
8320
|
-
case "zeebe:output": {
|
|
8321
|
-
const outputs = getModdleList(containers.ioMapping, "outputParameters");
|
|
8322
|
-
const child = outputs.find((p) => p.source === binding.source);
|
|
8323
|
-
return child ? { child, property: "target" } : void 0;
|
|
8324
|
-
}
|
|
8325
|
-
case "zeebe:taskHeader": {
|
|
8326
|
-
const headers = getModdleList(containers.taskHeaders, "values");
|
|
8327
|
-
const child = headers.find((h) => h.key === binding.key);
|
|
8328
|
-
return child ? { child, property: "value" } : void 0;
|
|
8329
|
-
}
|
|
8330
|
-
case "zeebe:property": {
|
|
8331
|
-
const props = getModdleList(containers.zeebeProperties, "properties");
|
|
8332
|
-
const child = props.find((p) => p.name === binding.name);
|
|
8333
|
-
return child ? { child, property: "value" } : void 0;
|
|
8334
|
-
}
|
|
8335
|
-
case "zeebe:taskDefinition": {
|
|
8336
|
-
return containers.taskDefinition && binding.property ? { child: containers.taskDefinition, property: binding.property } : void 0;
|
|
8337
|
-
}
|
|
8338
|
-
default:
|
|
8339
|
-
return void 0;
|
|
8340
|
-
}
|
|
8341
|
-
}
|
|
8342
|
-
|
|
8343
|
-
// default-plugins/element-template/helpers.ts
|
|
8344
|
-
var import_semver = __toESM(require_semver2(), 1);
|
|
8345
|
-
import {
|
|
8346
|
-
existsSync,
|
|
8347
|
-
readFileSync,
|
|
8348
|
-
realpathSync,
|
|
8349
|
-
renameSync,
|
|
8350
|
-
unlinkSync,
|
|
8351
|
-
writeFileSync
|
|
8352
|
-
} from "node:fs";
|
|
8353
|
-
import { resolve as resolvePath } from "node:path";
|
|
8354
|
-
|
|
8355
8306
|
// default-plugins/element-template/migration/binding.ts
|
|
8356
8307
|
var BINDING_TYPE_PREFIXES = {
|
|
8357
8308
|
input: "zeebe:input",
|
|
@@ -8376,7 +8327,7 @@ function bindingPath(bindingType, key) {
|
|
|
8376
8327
|
const prefix2 = bindingType === "zeebe:taskHeader" ? "header" : bindingType?.replace("zeebe:", "");
|
|
8377
8328
|
return `${prefix2}:${key}`;
|
|
8378
8329
|
}
|
|
8379
|
-
function
|
|
8330
|
+
function findExtensionByType(extensionElements, type) {
|
|
8380
8331
|
const matches = getModdleList(extensionElements, "values").filter(
|
|
8381
8332
|
(v) => v.$type === type
|
|
8382
8333
|
);
|
|
@@ -8386,20 +8337,20 @@ function findExtensionByType2(extensionElements, type) {
|
|
|
8386
8337
|
);
|
|
8387
8338
|
return matches[0];
|
|
8388
8339
|
}
|
|
8389
|
-
function
|
|
8340
|
+
function findExtensionContainers(extensionElements) {
|
|
8390
8341
|
const containers = {
|
|
8391
|
-
ioMapping:
|
|
8392
|
-
taskHeaders:
|
|
8393
|
-
taskDefinition:
|
|
8342
|
+
ioMapping: findExtensionByType(extensionElements, "zeebe:IoMapping"),
|
|
8343
|
+
taskHeaders: findExtensionByType(extensionElements, "zeebe:TaskHeaders"),
|
|
8344
|
+
taskDefinition: findExtensionByType(
|
|
8394
8345
|
extensionElements,
|
|
8395
8346
|
"zeebe:TaskDefinition"
|
|
8396
8347
|
),
|
|
8397
|
-
zeebeProperties:
|
|
8398
|
-
agentDefinition:
|
|
8348
|
+
zeebeProperties: findExtensionByType(extensionElements, "zeebe:Properties"),
|
|
8349
|
+
agentDefinition: findExtensionByType(
|
|
8399
8350
|
extensionElements,
|
|
8400
8351
|
"zeebe:AgentDefinition"
|
|
8401
8352
|
),
|
|
8402
|
-
adHoc:
|
|
8353
|
+
adHoc: findExtensionByType(extensionElements, "zeebe:AdHoc")
|
|
8403
8354
|
};
|
|
8404
8355
|
for (const [container, list, key, prefix2] of [
|
|
8405
8356
|
[containers.ioMapping, "inputParameters", "target", "input"],
|
|
@@ -8420,7 +8371,7 @@ function findExtensionContainers2(extensionElements) {
|
|
|
8420
8371
|
}
|
|
8421
8372
|
return containers;
|
|
8422
8373
|
}
|
|
8423
|
-
function
|
|
8374
|
+
function resolveBindingTarget(binding, containers) {
|
|
8424
8375
|
switch (binding.type) {
|
|
8425
8376
|
case "zeebe:input": {
|
|
8426
8377
|
const inputs = getModdleList(containers.ioMapping, "inputParameters");
|
|
@@ -10168,16 +10119,7 @@ async function loadTemplate(templateArg, {
|
|
|
10168
10119
|
if (!globalThis.c8ctl) throw new Error("c8ctl runtime not initialised");
|
|
10169
10120
|
var c8ctl3 = globalThis.c8ctl;
|
|
10170
10121
|
var require3 = createRequire2(import.meta.url);
|
|
10171
|
-
function forceSetValues(
|
|
10172
|
-
const modeling = modeler.get("modeling");
|
|
10173
|
-
const extensionElements = getModdleElement(
|
|
10174
|
-
element.businessObject,
|
|
10175
|
-
"extensionElements"
|
|
10176
|
-
);
|
|
10177
|
-
if (!extensionElements) {
|
|
10178
|
-
return;
|
|
10179
|
-
}
|
|
10180
|
-
const containers = findExtensionContainers(extensionElements);
|
|
10122
|
+
function forceSetValues(element, elementTemplates, template, setArgs) {
|
|
10181
10123
|
for (const arg of setArgs) {
|
|
10182
10124
|
const { bindingTypeFilter, name: name2, value } = parseSetArg(arg);
|
|
10183
10125
|
const matches = findPropertiesByBindingName(
|
|
@@ -10186,13 +10128,8 @@ function forceSetValues(modeler, element, template, setArgs) {
|
|
|
10186
10128
|
bindingTypeFilter
|
|
10187
10129
|
);
|
|
10188
10130
|
for (const prop of matches) {
|
|
10189
|
-
if (
|
|
10190
|
-
|
|
10191
|
-
const target = resolveBindingTarget(prop.binding, containers);
|
|
10192
|
-
if (target) {
|
|
10193
|
-
modeling.updateModdleProperties(element, target.child, {
|
|
10194
|
-
[target.property]: effectiveValue
|
|
10195
|
-
});
|
|
10131
|
+
if (prop.binding && elementTemplates.isConditionMet(element, template.properties, prop)) {
|
|
10132
|
+
elementTemplates.setPropertyValue(element, prop, value);
|
|
10196
10133
|
}
|
|
10197
10134
|
}
|
|
10198
10135
|
}
|
|
@@ -10221,10 +10158,10 @@ async function applyElementTemplate(xml2, template, elementId, setArgs) {
|
|
|
10221
10158
|
}
|
|
10222
10159
|
const elementTemplates = modeler.get("elementTemplates");
|
|
10223
10160
|
elementTemplates.set([template]);
|
|
10224
|
-
elementTemplates.applyTemplate(element, template);
|
|
10161
|
+
let current = elementTemplates.applyTemplate(element, template) ?? element;
|
|
10225
10162
|
if (setArgs.length > 0) {
|
|
10226
|
-
forceSetValues(
|
|
10227
|
-
elementTemplates.applyTemplate(
|
|
10163
|
+
forceSetValues(current, elementTemplates, template, setArgs);
|
|
10164
|
+
current = elementTemplates.applyTemplate(current, template) ?? current;
|
|
10228
10165
|
}
|
|
10229
10166
|
const result = await modeler.saveXML({ format: true });
|
|
10230
10167
|
return result.xml;
|
|
@@ -10355,6 +10292,51 @@ import { parseArgs as parseArgv } from "node:util";
|
|
|
10355
10292
|
if (!globalThis.c8ctl) throw new Error("c8ctl runtime not initialised");
|
|
10356
10293
|
var c8ctl4 = globalThis.c8ctl;
|
|
10357
10294
|
var require4 = createRequire3(import.meta.url);
|
|
10295
|
+
var ORDERED_LISTS = [
|
|
10296
|
+
["zeebe:IoMapping", "inputParameters"],
|
|
10297
|
+
["zeebe:IoMapping", "outputParameters"],
|
|
10298
|
+
["zeebe:TaskHeaders", "values"],
|
|
10299
|
+
["zeebe:Properties", "properties"]
|
|
10300
|
+
];
|
|
10301
|
+
function entryIdentity(entry) {
|
|
10302
|
+
const id = getModdleString(entry, "target") ?? getModdleString(entry, "source") ?? getModdleString(entry, "key") ?? getModdleString(entry, "name");
|
|
10303
|
+
return `${entry.$type}:${id}`;
|
|
10304
|
+
}
|
|
10305
|
+
function findContainer(element, type) {
|
|
10306
|
+
return getModdleList(
|
|
10307
|
+
getModdleElement(element.businessObject, "extensionElements"),
|
|
10308
|
+
"values"
|
|
10309
|
+
).find((v) => v.$type === type);
|
|
10310
|
+
}
|
|
10311
|
+
function snapshotOrder(element) {
|
|
10312
|
+
const order = /* @__PURE__ */ new Map();
|
|
10313
|
+
for (const [type, prop] of ORDERED_LISTS) {
|
|
10314
|
+
order.set(
|
|
10315
|
+
`${type}/${prop}`,
|
|
10316
|
+
getModdleList(findContainer(element, type), prop).map(entryIdentity)
|
|
10317
|
+
);
|
|
10318
|
+
}
|
|
10319
|
+
return order;
|
|
10320
|
+
}
|
|
10321
|
+
function restoreOrder({
|
|
10322
|
+
element,
|
|
10323
|
+
order,
|
|
10324
|
+
modeling
|
|
10325
|
+
}) {
|
|
10326
|
+
for (const [type, prop] of ORDERED_LISTS) {
|
|
10327
|
+
const container = findContainer(element, type);
|
|
10328
|
+
const before = order.get(`${type}/${prop}`) ?? [];
|
|
10329
|
+
const current = getModdleList(container, prop);
|
|
10330
|
+
const rank = (e) => {
|
|
10331
|
+
const i = before.indexOf(entryIdentity(e));
|
|
10332
|
+
return i === -1 ? before.length : i;
|
|
10333
|
+
};
|
|
10334
|
+
const sorted = [...current].sort((a, b) => rank(a) - rank(b));
|
|
10335
|
+
if (container && sorted.some((e, i) => e !== current[i])) {
|
|
10336
|
+
modeling.updateModdleProperties(element, container, { [prop]: sorted });
|
|
10337
|
+
}
|
|
10338
|
+
}
|
|
10339
|
+
}
|
|
10358
10340
|
function extractTemplateFlag(args) {
|
|
10359
10341
|
const { tokens } = parseArgv({
|
|
10360
10342
|
args,
|
|
@@ -10405,80 +10387,6 @@ For a custom template, place it under .camunda/element-templates/ next to the BP
|
|
|
10405
10387
|
);
|
|
10406
10388
|
}
|
|
10407
10389
|
}
|
|
10408
|
-
async function planEdit(modeler, elementId, setArgs, templateArg, searchDir) {
|
|
10409
|
-
const elementRegistry = modeler.get("elementRegistry");
|
|
10410
|
-
const element = elementRegistry.get(elementId);
|
|
10411
|
-
if (!element) {
|
|
10412
|
-
throw new Error(`Element "${elementId}" not found in the BPMN diagram`);
|
|
10413
|
-
}
|
|
10414
|
-
const templateId = getModdleString(element.businessObject, "modelerTemplate");
|
|
10415
|
-
if (!templateId) {
|
|
10416
|
-
throw new Error(
|
|
10417
|
-
`Element "${elementId}" has no element template applied (no zeebe:modelerTemplate attribute). Use 'apply' to apply one first.`
|
|
10418
|
-
);
|
|
10419
|
-
}
|
|
10420
|
-
const templateVersion = getModdleNumber(
|
|
10421
|
-
element.businessObject,
|
|
10422
|
-
"modelerTemplateVersion"
|
|
10423
|
-
);
|
|
10424
|
-
if (templateVersion === void 0) {
|
|
10425
|
-
throw new Error(
|
|
10426
|
-
`Element "${elementId}" has zeebe:modelerTemplate="${templateId}" but no recorded zeebe:modelerTemplateVersion. 'edit' requires a pinned version to resolve the exact template that was applied \u2014 use 'apply' with an explicit template reference instead.`
|
|
10427
|
-
);
|
|
10428
|
-
}
|
|
10429
|
-
const template = await resolveEditTemplate(
|
|
10430
|
-
templateArg,
|
|
10431
|
-
templateId,
|
|
10432
|
-
templateVersion,
|
|
10433
|
-
searchDir
|
|
10434
|
-
);
|
|
10435
|
-
const extensionElements = getModdleElement(
|
|
10436
|
-
element.businessObject,
|
|
10437
|
-
"extensionElements"
|
|
10438
|
-
);
|
|
10439
|
-
const containers = findExtensionContainers(extensionElements);
|
|
10440
|
-
const writesByChild = /* @__PURE__ */ new Map();
|
|
10441
|
-
for (const arg of setArgs) {
|
|
10442
|
-
const { bindingTypeFilter, name: name2, value } = parseSetArg(arg);
|
|
10443
|
-
const matches = findPropertiesByBindingName(
|
|
10444
|
-
template.properties,
|
|
10445
|
-
name2,
|
|
10446
|
-
bindingTypeFilter
|
|
10447
|
-
);
|
|
10448
|
-
let materialized = false;
|
|
10449
|
-
for (const prop of matches) {
|
|
10450
|
-
if (!prop.binding) continue;
|
|
10451
|
-
const effectiveValue = maybePrependFeel(prop, value);
|
|
10452
|
-
if (prop.choices) {
|
|
10453
|
-
validateDropdownValue(prop, name2, effectiveValue);
|
|
10454
|
-
}
|
|
10455
|
-
const target = resolveBindingTarget(prop.binding, containers);
|
|
10456
|
-
if (target) {
|
|
10457
|
-
materialized = true;
|
|
10458
|
-
let byProperty = writesByChild.get(target.child);
|
|
10459
|
-
if (!byProperty) {
|
|
10460
|
-
byProperty = /* @__PURE__ */ new Map();
|
|
10461
|
-
writesByChild.set(target.child, byProperty);
|
|
10462
|
-
}
|
|
10463
|
-
byProperty.set(target.property, {
|
|
10464
|
-
child: target.child,
|
|
10465
|
-
property: target.property,
|
|
10466
|
-
value: effectiveValue
|
|
10467
|
-
});
|
|
10468
|
-
}
|
|
10469
|
-
}
|
|
10470
|
-
if (!materialized) {
|
|
10471
|
-
throw new Error(
|
|
10472
|
-
`Property "${name2}" has no existing value on this element to edit (its condition may not be met, its binding type isn't supported by 'edit', or the template was never fully applied). Use 'apply --set ${name2}=...' to materialize it first.`
|
|
10473
|
-
);
|
|
10474
|
-
}
|
|
10475
|
-
}
|
|
10476
|
-
const writes = [];
|
|
10477
|
-
for (const byProperty of writesByChild.values()) {
|
|
10478
|
-
writes.push(...byProperty.values());
|
|
10479
|
-
}
|
|
10480
|
-
return { element, template, writes };
|
|
10481
|
-
}
|
|
10482
10390
|
async function editSubcommand(args) {
|
|
10483
10391
|
const logger = c8ctl4.getLogger();
|
|
10484
10392
|
installStdoutEpipeHandler();
|
|
@@ -10515,21 +10423,81 @@ async function editSubcommand(args) {
|
|
|
10515
10423
|
}
|
|
10516
10424
|
const vendorPath = resolveVendorBundle();
|
|
10517
10425
|
const vendor = require4(vendorPath);
|
|
10518
|
-
const {
|
|
10426
|
+
const {
|
|
10427
|
+
Modeler,
|
|
10428
|
+
CloudElementTemplatesCoreModule,
|
|
10429
|
+
ZeebeModdleExtension,
|
|
10430
|
+
HeadlessTextRendererModule
|
|
10431
|
+
} = vendor;
|
|
10519
10432
|
const modeler = new Modeler({
|
|
10520
|
-
additionalModules: [
|
|
10433
|
+
additionalModules: [
|
|
10434
|
+
HeadlessTextRendererModule,
|
|
10435
|
+
CloudElementTemplatesCoreModule
|
|
10436
|
+
],
|
|
10521
10437
|
moddleExtensions: { zeebe: ZeebeModdleExtension }
|
|
10522
10438
|
});
|
|
10523
|
-
|
|
10439
|
+
const searchDir = bpmnFilePath ? dirname4(input.source) : process.cwd();
|
|
10440
|
+
let template;
|
|
10524
10441
|
try {
|
|
10525
10442
|
await modeler.importXML(input.xml);
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10443
|
+
const elementRegistry = modeler.get("elementRegistry");
|
|
10444
|
+
const element = elementRegistry.get(elementId);
|
|
10445
|
+
if (!element) {
|
|
10446
|
+
throw new Error(`Element "${elementId}" not found in the BPMN diagram`);
|
|
10447
|
+
}
|
|
10448
|
+
const templateId = getModdleString(
|
|
10449
|
+
element.businessObject,
|
|
10450
|
+
"modelerTemplate"
|
|
10451
|
+
);
|
|
10452
|
+
if (!templateId) {
|
|
10453
|
+
throw new Error(
|
|
10454
|
+
`Element "${elementId}" has no element template applied (no zeebe:modelerTemplate attribute). Use 'apply' to apply one first.`
|
|
10455
|
+
);
|
|
10456
|
+
}
|
|
10457
|
+
const templateVersion = getModdleNumber(
|
|
10458
|
+
element.businessObject,
|
|
10459
|
+
"modelerTemplateVersion"
|
|
10460
|
+
);
|
|
10461
|
+
if (templateVersion === void 0) {
|
|
10462
|
+
throw new Error(
|
|
10463
|
+
`Element "${elementId}" has zeebe:modelerTemplate="${templateId}" but no recorded zeebe:modelerTemplateVersion. 'edit' requires a pinned version to resolve the exact template that was applied \u2014 use 'apply' with an explicit template reference instead.`
|
|
10464
|
+
);
|
|
10465
|
+
}
|
|
10466
|
+
template = await resolveEditTemplate(
|
|
10530
10467
|
templateArg,
|
|
10531
|
-
|
|
10468
|
+
templateId,
|
|
10469
|
+
templateVersion,
|
|
10470
|
+
searchDir
|
|
10532
10471
|
);
|
|
10472
|
+
const elementTemplates = modeler.get("elementTemplates");
|
|
10473
|
+
const order = snapshotOrder(element);
|
|
10474
|
+
for (const arg of parsed.setArgs) {
|
|
10475
|
+
const { bindingTypeFilter, name: name2, value } = parseSetArg(arg);
|
|
10476
|
+
const matches = findPropertiesByBindingName(
|
|
10477
|
+
template.properties,
|
|
10478
|
+
name2,
|
|
10479
|
+
bindingTypeFilter
|
|
10480
|
+
);
|
|
10481
|
+
const active = matches.filter(
|
|
10482
|
+
(prop) => prop.binding && elementTemplates.isConditionMet(element, template.properties, prop)
|
|
10483
|
+
);
|
|
10484
|
+
if (active.length === 0) {
|
|
10485
|
+
throw new Error(
|
|
10486
|
+
`Property "${name2}" cannot be edited on this element: its condition is not met or it has no binding. Set the property its condition depends on first (in the same edit, earlier in the --set order).`
|
|
10487
|
+
);
|
|
10488
|
+
}
|
|
10489
|
+
for (const prop of active) {
|
|
10490
|
+
if (prop.choices) {
|
|
10491
|
+
validateDropdownValue(prop, name2, value);
|
|
10492
|
+
}
|
|
10493
|
+
const invalid = elementTemplates.validateProperty(value, prop);
|
|
10494
|
+
if (invalid) {
|
|
10495
|
+
throw new Error(`Invalid value for "${name2}": ${invalid}`);
|
|
10496
|
+
}
|
|
10497
|
+
elementTemplates.setPropertyValue(element, prop, value);
|
|
10498
|
+
}
|
|
10499
|
+
}
|
|
10500
|
+
restoreOrder({ element, order, modeling: modeler.get("modeling") });
|
|
10533
10501
|
} catch (error3) {
|
|
10534
10502
|
const message = error3 instanceof Error ? error3.message : String(error3);
|
|
10535
10503
|
throw new Error(`Error editing element: ${message}`);
|
|
@@ -10539,9 +10507,9 @@ async function editSubcommand(args) {
|
|
|
10539
10507
|
dryRun: true,
|
|
10540
10508
|
command: "element-template edit",
|
|
10541
10509
|
template: {
|
|
10542
|
-
id:
|
|
10543
|
-
name:
|
|
10544
|
-
version:
|
|
10510
|
+
id: template.id,
|
|
10511
|
+
name: template.name,
|
|
10512
|
+
version: template.version
|
|
10545
10513
|
},
|
|
10546
10514
|
elementId,
|
|
10547
10515
|
source: input.source,
|
|
@@ -10566,12 +10534,6 @@ async function editSubcommand(args) {
|
|
|
10566
10534
|
}
|
|
10567
10535
|
return;
|
|
10568
10536
|
}
|
|
10569
|
-
const modeling = modeler.get("modeling");
|
|
10570
|
-
for (const write of plan.writes) {
|
|
10571
|
-
modeling.updateModdleProperties(plan.element, write.child, {
|
|
10572
|
-
[write.property]: write.value
|
|
10573
|
-
});
|
|
10574
|
-
}
|
|
10575
10537
|
const result = await modeler.saveXML({ format: true });
|
|
10576
10538
|
const resultXml = result.xml;
|
|
10577
10539
|
if (writePath) {
|
|
@@ -11259,7 +11221,7 @@ var AD_HOC_PROPERTIES = [
|
|
|
11259
11221
|
"outputElement"
|
|
11260
11222
|
];
|
|
11261
11223
|
function enumerateElementValues(extensionElements) {
|
|
11262
|
-
const containers =
|
|
11224
|
+
const containers = findExtensionContainers(extensionElements);
|
|
11263
11225
|
const out = [];
|
|
11264
11226
|
const push = (bindingType, key, value) => {
|
|
11265
11227
|
if (key === void 0 || value === void 0) {
|
|
@@ -12462,7 +12424,7 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
|
|
|
12462
12424
|
)
|
|
12463
12425
|
);
|
|
12464
12426
|
let current = modeler.elementTemplates.applyTemplate(element, clone) ?? element;
|
|
12465
|
-
const containers =
|
|
12427
|
+
const containers = findExtensionContainers(
|
|
12466
12428
|
getExtensionElements(current.businessObject)
|
|
12467
12429
|
);
|
|
12468
12430
|
for (const w of writes) {
|
|
@@ -12475,7 +12437,7 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
|
|
|
12475
12437
|
if (!property.binding) {
|
|
12476
12438
|
continue;
|
|
12477
12439
|
}
|
|
12478
|
-
const target =
|
|
12440
|
+
const target = resolveBindingTarget(property.binding, containers);
|
|
12479
12441
|
if (target) {
|
|
12480
12442
|
modeler.modeling.updateModdleProperties(current, target.child, {
|
|
12481
12443
|
[target.property]: normalizeDestinationValue(property, w.value)
|
|
@@ -14164,7 +14126,7 @@ var metadata = {
|
|
|
14164
14126
|
commands: {
|
|
14165
14127
|
"element-template": {
|
|
14166
14128
|
description: "Apply, inspect, and export Camunda element templates",
|
|
14167
|
-
helpDescription: "Apply Camunda element templates to BPMN elements, inspect template metadata and properties, search the out-of-the-box template catalogue, export raw template JSON, and manage the local template cache.\n\n<template> is a local path, an https:// URL, or a template id (optionally @<version>). An id is looked up in .camunda/element-templates/ (next to the BPMN file, or in the current directory, or any parent of either) and in Desktop Modeler's resources/element-templates/ before the OOTB cache.\n\napply --set name=value targets a property by binding name (run `get-properties` to discover names). Pass --set multiple times to set multiple properties. Prefix with a binding type (input | output | header | property | taskDefinition) when the same name is bound across multiple types \u2014 e.g. --set input:correlationKey=order-42.\n\nedit --set name=value updates a property on an element that already has a template applied, without re-running template application \u2014 it never resets other template-owned content (including hand-customized extension values a template doesn't fully control) and doesn't need a <template> argument (it reads zeebe:modelerTemplate/-Version off the element and resolves it from .camunda/element-templates/ next to the BPMN file or a parent directory, then the OOTB cache). Pass --template <template> to point at a custom template explicitly; it must match the element's recorded id/version.
|
|
14129
|
+
helpDescription: "Apply Camunda element templates to BPMN elements, inspect template metadata and properties, search the out-of-the-box template catalogue, export raw template JSON, and manage the local template cache.\n\n<template> is a local path, an https:// URL, or a template id (optionally @<version>). An id is looked up in .camunda/element-templates/ (next to the BPMN file, or in the current directory, or any parent of either) and in Desktop Modeler's resources/element-templates/ before the OOTB cache.\n\napply --set name=value targets a property by binding name (run `get-properties` to discover names). Pass --set multiple times to set multiple properties. Prefix with a binding type (input | output | header | property | taskDefinition) when the same name is bound across multiple types \u2014 e.g. --set input:correlationKey=order-42.\n\nedit --set name=value updates a property on an element that already has a template applied, without re-running template application \u2014 it never resets other template-owned content (including hand-customized extension values a template doesn't fully control) and doesn't need a <template> argument (it reads zeebe:modelerTemplate/-Version off the element and resolves it from .camunda/element-templates/ next to the BPMN file or a parent directory, then the OOTB cache). Pass --template <template> to point at a custom template explicitly; it must match the element's recorded id/version. A property whose condition is not met is rejected; --set args apply in order, so set the property a condition depends on first (e.g. --set method=POST --set body=...). Values are checked against the property's constraints (notEmpty, pattern, length, dropdown choices).\n\nupdate <template-id> moves every element that uses that template to its latest compatible version, or to the template given with --to <template>[@<n>] (an id, path or URL; an id resolves as above, local templates first); pass an element id to update only that element. Values the target binds under another key are moved when it carries a migration recipe (metadata.migratesFrom) or one is passed with --recipe <file>; --map <from>=<to> moves a value per element when no recipe covers it; the rest carry over by key. A report lists what was dropped, added, moved and changed. --dry-run previews the migration and writes nothing; it exits 1 when an element would fail to migrate or the write would need --allow-lossy. The file is written once, and only if every element migrates.\n\nFEEL values: properties with feel=required always store a FEEL expression (prefixed with `=`). For those properties, c8ctl auto-prepends `=` when it is missing, so `--set key=orderId` writes `=orderId` to the BPMN \u2014 equivalent to `--set key==orderId`. Properties with feel=optional keep the value verbatim; you must supply the `=` prefix yourself when you want to write a FEEL expression for those. Boolean and Number inputs/outputs (and any Boolean/Number property declaring feel) are stored as FEEL, as the Modeler does \u2014 `--set timeout=30` writes `=30`. Three forms for feel=required properties:\n --set key='=value' canonical: single-quoted FEEL value (explicit =)\n --set 'key==value' compact: whole argument single-quoted (explicit =)\n --set key=value shorthand: = auto-prepended (feel=required only)\nLeading/trailing whitespace is stripped from values, and whitespace immediately after a FEEL `=` prefix is also stripped, so `--set 'key== value'` is equivalent to `--set 'key==value'`.",
|
|
14168
14130
|
subcommands: [
|
|
14169
14131
|
{
|
|
14170
14132
|
name: "search",
|