@uipath/maestro-builder-sdk 6.17.5 → 6.18.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.
Files changed (61) hide show
  1. package/dist/bindings-v2.js +15 -17
  2. package/dist/bpmn/bpmn-sdk.js +3 -2
  3. package/dist/bpmn/check.js +3 -2
  4. package/dist/bpmn/decompile.js +123 -137
  5. package/dist/bpmn/intsvc.js +7 -2
  6. package/dist/bpmn/serialize.js +1 -1
  7. package/dist/bpmn/typed-node.js +5 -4
  8. package/dist/case/compile-cli.js +1 -3
  9. package/dist/case/decompile.js +103 -109
  10. package/dist/case/entry-points.js +2 -1
  11. package/dist/case/merge.js +3 -5
  12. package/dist/case/serialize.js +1 -1
  13. package/dist/check.js +26 -10
  14. package/dist/core/ceql.js +5 -2
  15. package/dist/core/connector-inputs.js +4 -4
  16. package/dist/core/event-checks.js +17 -2
  17. package/dist/core/event-filters.d.ts +38 -4
  18. package/dist/core/event-filters.js +63 -7
  19. package/dist/core/expr.d.ts +1 -1
  20. package/dist/core/expr.js +3 -3
  21. package/dist/core/json-file.d.ts +2 -0
  22. package/dist/core/json-file.js +4 -0
  23. package/dist/core/library.js +2 -1
  24. package/dist/core/node-envelope.d.ts +1 -0
  25. package/dist/core/node-envelope.js +1 -1
  26. package/dist/core/own-entry.d.ts +9 -0
  27. package/dist/core/own-entry.js +11 -0
  28. package/dist/core/ts-literal.d.ts +22 -0
  29. package/dist/core/ts-literal.js +37 -0
  30. package/dist/core/typed-raw-node.js +4 -3
  31. package/dist/decompile.js +272 -300
  32. package/dist/merge.js +10 -12
  33. package/dist/registry/compat/pystr.d.ts +2 -0
  34. package/dist/registry/compat/pystr.js +35 -0
  35. package/dist/registry/compat/pyvalue.d.ts +16 -0
  36. package/dist/registry/compat/pyvalue.js +35 -0
  37. package/dist/registry/generators/markdown/pyvalue.d.ts +1 -4
  38. package/dist/registry/generators/markdown/pyvalue.js +2 -30
  39. package/dist/registry/generators/markdown/sections/inputs.js +3 -2
  40. package/dist/registry/generators/type-tree.d.ts +1 -7
  41. package/dist/registry/generators/type-tree.js +5 -22
  42. package/dist/registry/library-build/build.js +6 -6
  43. package/dist/registry/library-build/canonical.js +25 -25
  44. package/dist/registry/library-build/context.js +5 -5
  45. package/dist/registry/library-build/enrich.js +18 -18
  46. package/dist/registry/library-build/events.js +25 -24
  47. package/dist/registry/library-build/generic-expand.js +21 -20
  48. package/dist/registry/library-build/plan.js +8 -8
  49. package/dist/registry/library-build/py.d.ts +3 -10
  50. package/dist/registry/library-build/py.js +9 -52
  51. package/dist/registry/library-build/schema-action.js +6 -6
  52. package/dist/registry/prepare/event.js +2 -2
  53. package/dist/registry/prepare/source-import.js +2 -9
  54. package/dist/registry/prepare/source-labels.js +2 -9
  55. package/dist/registry/prepare/support.d.ts +2 -6
  56. package/dist/registry/prepare/support.js +3 -58
  57. package/dist/registry/pull-cli.js +6 -14
  58. package/dist/registry/search-cli.js +2 -2
  59. package/dist/schema-version.js +0 -1
  60. package/dist/serialize.js +86 -76
  61. package/package.json +2 -2
@@ -60,6 +60,7 @@ import { SCRIPT_ARGS_ENVELOPE, defaultScriptInputSchema } from './serialize.js';
60
60
  import { BPMN_SCHEMA_VERSIONS } from './format-profile.js';
61
61
  import { preserveSchemaVersion } from '../schema-version.js';
62
62
  import { commentText } from '../core/comment-text.js';
63
+ import { tsLiteral, tsText } from '../core/ts-literal.js';
63
64
  const require = createRequire(import.meta.url);
64
65
  const uipathDescriptor = require('./uipath-moddle.v1.json');
65
66
  /**
@@ -78,21 +79,6 @@ let pinExplicitInBodies = false;
78
79
  */
79
80
  let foldedVarSchemas;
80
81
  // ─── Source emitters ──────────────────────────────────────────────────────────
81
- /**
82
- * A JS/TS string literal.
83
- *
84
- * `JSON.stringify` escapes quotes, backslashes and control characters, so a value
85
- * out of an untrusted `.bpmn` — a label, an expression, a URL — can never break
86
- * out of the literal and become code in the emitted source. U+2028/U+2029 are
87
- * escaped too: legal in JSON, historically illegal in JS string literals.
88
- */
89
- function str(s) {
90
- return JSON.stringify(String(s ?? '')).replace(/[\u2028\u2029]/g, (c) => `\\u${c.charCodeAt(0).toString(16)}`);
91
- }
92
- /** An arbitrary JSON value as an inert TS literal. Never executable. */
93
- function literal(v) {
94
- return JSON.stringify(v ?? null);
95
- }
96
82
  /**
97
83
  * Schema bodies that need no declaration, because the platform defines them.
98
84
  *
@@ -144,7 +130,7 @@ function planSchemas(rows) {
144
130
  }
145
131
  else if (count > 1) {
146
132
  const id = schemaIdFrom(firstName.get(text), taken);
147
- plan.ref.set(text, str(id));
133
+ plan.ref.set(text, tsText(id));
148
134
  plan.declare.push([id, jsonLiteral(text)]);
149
135
  }
150
136
  }
@@ -165,7 +151,7 @@ function planSchemas(rows) {
165
151
  */
166
152
  function jsonLiteral(body) {
167
153
  const value = jsonValue(body);
168
- return typeof value === 'string' ? str(value) : literal(value);
154
+ return typeof value === 'string' ? tsText(value) : tsLiteral(value ?? null);
169
155
  }
170
156
  /**
171
157
  * The same decision, as a VALUE rather than as source text — for a body that lands
@@ -195,7 +181,7 @@ function jsonValue(body) {
195
181
  }
196
182
  /** An object key: a bare identifier when legal, otherwise a quoted string. */
197
183
  function key(k) {
198
- return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(k) ? k : str(k);
184
+ return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(k) ? k : tsText(k);
199
185
  }
200
186
  /** Render `{ a: 1, b: 2 }` from the entries that are present; `''` when none are. */
201
187
  function opts(entries) {
@@ -215,7 +201,7 @@ function record(r) {
215
201
  if (!r || Object.keys(r).length === 0)
216
202
  return undefined;
217
203
  return `{ ${Object.entries(r)
218
- .map(([k, v]) => `${key(k)}: ${typeof v === 'string' ? str(v) : literal(v)}`)
204
+ .map(([k, v]) => `${key(k)}: ${typeof v === 'string' ? tsText(v) : tsLiteral(v ?? null)}`)
219
205
  .join(', ')} }`;
220
206
  }
221
207
  /**
@@ -309,12 +295,12 @@ function emitContextRows(payload) {
309
295
  return undefined;
310
296
  return `[${rows
311
297
  .map((r) => opts([
312
- ['name', str(r.name)],
313
- ['type', r.type !== undefined ? str(r.type) : undefined],
298
+ ['name', tsText(r.name)],
299
+ ['type', r.type !== undefined ? tsText(r.type) : undefined],
314
300
  ['required', r.required !== undefined ? 'true' : undefined],
315
- ['target', r.target !== undefined ? str(r.target) : undefined],
316
- ['value', r.value !== undefined ? str(r.value) : undefined],
317
- ['body', r.body !== undefined ? (r.type === 'json' ? jsonLiteral(r.body) : str(String(r.body))) : undefined],
301
+ ['target', r.target !== undefined ? tsText(r.target) : undefined],
302
+ ['value', r.value !== undefined ? tsText(r.value) : undefined],
303
+ ['body', r.body !== undefined ? (r.type === 'json' ? jsonLiteral(r.body) : tsText(String(r.body))) : undefined],
318
304
  ]))
319
305
  .join(', ')}]`;
320
306
  }
@@ -339,11 +325,11 @@ function emitRetry(retry) {
339
325
  return undefined;
340
326
  return opts([
341
327
  ['maxRetries', String(count)],
342
- ['backoff', retry.retryBackoff ? str(retry.retryBackoff) : undefined],
343
- ['backoffType', retry.retryBackoffType === 'Exponential' ? str('exponential') : undefined],
328
+ ['backoff', retry.retryBackoff ? tsText(retry.retryBackoff) : undefined],
329
+ ['backoffType', retry.retryBackoffType === 'Exponential' ? tsText('exponential') : undefined],
344
330
  ['exponentialBase', retry.exponentialBase !== undefined ? String(Number(retry.exponentialBase)) : undefined],
345
331
  ['allErrors', retry.retryAllErrors === 'true' || retry.retryAllErrors === true ? 'true' : undefined],
346
- ['maxDuration', retry.maxDuration ? str(retry.maxDuration) : undefined],
332
+ ['maxDuration', retry.maxDuration ? tsText(retry.maxDuration) : undefined],
347
333
  ]);
348
334
  }
349
335
  /** The `uipath:ErrorMapping` element on an element, if it has one. */
@@ -366,14 +352,14 @@ function emitErrorMapping(em) {
366
352
  if (!rows.length)
367
353
  return undefined;
368
354
  const parts = rows.map((r) => opts([
369
- ['code', str(r.errorRef ?? '')],
355
+ ['code', tsText(r.errorRef ?? '')],
370
356
  ['retryable', r.retryable === undefined ? undefined : r.retryable === 'true' || r.retryable === true ? 'true' : 'false'],
371
- ['id', r.id !== undefined ? str(r.id) : undefined],
357
+ ['id', r.id !== undefined ? tsText(r.id) : undefined],
372
358
  // A numeric-looking priority round-trips as a number; anything else stays a
373
359
  // string, since the wire is a string either way and the author's form is unknown.
374
- ['priority', r.priority === undefined ? undefined : /^-?\d+$/.test(String(r.priority)) ? String(Number(r.priority)) : str(r.priority)],
375
- ['condition', r.condition !== undefined ? str(r.condition) : undefined],
376
- ['detail', r.detail !== undefined ? str(r.detail) : undefined],
360
+ ['priority', r.priority === undefined ? undefined : /^-?\d+$/.test(String(r.priority)) ? String(Number(r.priority)) : tsText(r.priority)],
361
+ ['condition', r.condition !== undefined ? tsText(r.condition) : undefined],
362
+ ['detail', r.detail !== undefined ? tsText(r.detail) : undefined],
377
363
  ]));
378
364
  return `[${parts.join(', ')}]`;
379
365
  }
@@ -386,10 +372,10 @@ function emitLoop(el) {
386
372
  if (!uip)
387
373
  return undefined;
388
374
  return opts([
389
- ['collection', str(uip.inputCollection ?? '')],
390
- ['itemVar', str(uip.inputElement ?? 'item')],
375
+ ['collection', tsText(uip.inputCollection ?? '')],
376
+ ['itemVar', tsText(uip.inputElement ?? 'item')],
391
377
  ['sequential', loop.isSequential ? 'true' : undefined],
392
- ['completion', loop.completionCondition?.body ? str(loop.completionCondition.body) : undefined],
378
+ ['completion', loop.completionCondition?.body ? tsText(loop.completionCondition.body) : undefined],
393
379
  ]);
394
380
  }
395
381
  /** An event definition back into the `{ message | timer | error | terminate }` option. */
@@ -399,7 +385,7 @@ function eventOptions(el) {
399
385
  return [];
400
386
  switch (def.$type) {
401
387
  case 'bpmn:MessageEventDefinition':
402
- return [['message', str(def.messageRef?.name ?? '')]];
388
+ return [['message', tsText(def.messageRef?.name ?? '')]];
403
389
  case 'bpmn:TerminateEventDefinition':
404
390
  return [['terminate', 'true']];
405
391
  case 'bpmn:ErrorEventDefinition': {
@@ -412,7 +398,7 @@ function eventOptions(el) {
412
398
  // The builder defaults an error's code to its name, so re-emitting the pair
413
399
  // only matters when they differ — otherwise the shorter form round-trips.
414
400
  return [
415
- ['error', ref.errorCode && ref.errorCode !== ref.name ? opts([['name', str(ref.name)], ['code', str(ref.errorCode)]]) : str(ref.name)],
401
+ ['error', ref.errorCode && ref.errorCode !== ref.name ? opts([['name', tsText(ref.name)], ['code', tsText(ref.errorCode)]]) : tsText(ref.name)],
416
402
  ];
417
403
  }
418
404
  case 'bpmn:TimerEventDefinition': {
@@ -421,15 +407,15 @@ function eventOptions(el) {
421
407
  const cycle = def.timeCycle?.body;
422
408
  // A bare duration is the shorthand the builder accepts directly.
423
409
  if (d !== undefined && date === undefined && cycle === undefined)
424
- return [['timer', str(d)]];
425
- return [['timer', opts([['duration', d !== undefined ? str(d) : undefined], ['date', date !== undefined ? str(date) : undefined], ['cycle', cycle !== undefined ? str(cycle) : undefined]])]];
410
+ return [['timer', tsText(d)]];
411
+ return [['timer', opts([['duration', d !== undefined ? tsText(d) : undefined], ['date', date !== undefined ? tsText(date) : undefined], ['cycle', cycle !== undefined ? tsText(cycle) : undefined]])]];
426
412
  }
427
413
  default:
428
414
  return [];
429
415
  }
430
416
  }
431
417
  /** `uipath:output` rows split into the type's own row and the author-mapped extras. */
432
- function outputsOf(payload, id, type) {
418
+ function outputsOf(payload, _id, type) {
433
419
  const rows = payload?.output ?? [];
434
420
  const extras = {};
435
421
  let outputVar;
@@ -476,13 +462,13 @@ function emitOutputRows(payload) {
476
462
  if (!rows.length)
477
463
  return undefined;
478
464
  const rendered = rows.map((row) => opts([
479
- ['name', str(row.name)],
480
- ['type', row.type !== undefined ? str(row.type) : undefined],
481
- ['var', row.var !== undefined ? str(row.var) : undefined],
482
- ['source', row.source !== undefined ? str(row.source) : undefined],
465
+ ['name', tsText(row.name)],
466
+ ['type', row.type !== undefined ? tsText(row.type) : undefined],
467
+ ['var', row.var !== undefined ? tsText(row.var) : undefined],
468
+ ['source', row.source !== undefined ? tsText(row.source) : undefined],
483
469
  ['custom', row.custom ? 'true' : undefined],
484
- ['description', row.description !== undefined ? str(row.description) : undefined],
485
- ['target', row.target !== undefined ? str(row.target) : undefined],
470
+ ['description', row.description !== undefined ? tsText(row.description) : undefined],
471
+ ['target', row.target !== undefined ? tsText(row.target) : undefined],
486
472
  // The body goes back as the STRING it was, not as a re-serialized object: a
487
473
  // schema is carried, never interpreted, so nothing here can reorder its keys
488
474
  // or drop a field this SDK does not know about.
@@ -537,20 +523,20 @@ function emitTypedNode(chain, el, payload, type) {
537
523
  const { outputVar, extras } = outputsOf(payload, id, type);
538
524
  const defaultVar = spec.output ? `${id}_${identifierize(spec.output.name)}` : undefined;
539
525
  const verbatimRows = outputRowsNeedSpellingOut(payload) ? emitOutputRows(payload) : undefined;
540
- chain.add(`.activity(${str(id)}, ${str(type)}${optionalArg(opts([
541
- ['name', el.name !== undefined ? str(el.name) : undefined],
526
+ chain.add(`.activity(${tsText(id)}, ${tsText(type)}${optionalArg(opts([
527
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
542
528
  // Only when it differs from the registry's own template, so an
543
529
  // SDK-authored node keeps the shorter source it had.
544
- ['typeVersion', payload.type?.version && payload.type.version !== 'v1' ? str(payload.type.version) : undefined],
530
+ ['typeVersion', payload.type?.version && payload.type.version !== 'v1' ? tsText(payload.type.version) : undefined],
545
531
  ['context', verbatimContext ? undefined : record(ctx)],
546
532
  ['contextRows', verbatimContext],
547
533
  ['inputSchema', payload.context?.inputSchema?.body !== undefined ? jsonLiteral(payload.context.inputSchema.body) : undefined],
548
534
  ['inputs', record(inputs)],
549
535
  ['inputRows', verbatimInputs],
550
536
  ['outputRows', verbatimRows],
551
- ['outputVar', verbatimRows === undefined && outputVar !== undefined && outputVar !== defaultVar ? str(outputVar) : undefined],
537
+ ['outputVar', verbatimRows === undefined && outputVar !== undefined && outputVar !== defaultVar ? tsText(outputVar) : undefined],
552
538
  ['outputs', verbatimRows === undefined ? record(extras) : undefined],
553
- ['skipCondition', payload.skipCondition !== undefined ? str(payload.skipCondition) : undefined],
539
+ ['skipCondition', payload.skipCondition !== undefined ? tsText(payload.skipCondition) : undefined],
554
540
  ['contextVerbatim', Object.keys(ctx).length ? 'true' : undefined],
555
541
  ['tags', tagsOf(el)],
556
542
  ['retry', emitRetry(retryOf(el))],
@@ -585,11 +571,11 @@ function emitInputRows(rows) {
585
571
  return undefined;
586
572
  return `[${rows
587
573
  .map((r) => opts([
588
- ['name', str(r.name)],
589
- ['type', r.type !== undefined ? str(r.type) : undefined],
590
- ['target', r.target !== undefined ? str(r.target) : undefined],
591
- ['value', r.value !== undefined ? str(r.value) : undefined],
592
- ['body', r.body !== undefined ? (r.type === 'json' ? jsonLiteral(r.body) : str(String(r.body))) : undefined],
574
+ ['name', tsText(r.name)],
575
+ ['type', r.type !== undefined ? tsText(r.type) : undefined],
576
+ ['target', r.target !== undefined ? tsText(r.target) : undefined],
577
+ ['value', r.value !== undefined ? tsText(r.value) : undefined],
578
+ ['body', r.body !== undefined ? (r.type === 'json' ? jsonLiteral(r.body) : tsText(String(r.body))) : undefined],
593
579
  ]))
594
580
  .join(', ')}]`;
595
581
  }
@@ -663,7 +649,7 @@ function emitScriptTask(chain, el, payload, type) {
663
649
  // schema that differs from the default (the designer's carries `$schema`) is kept.
664
650
  const rawInputs = args ? safeJson(args.body) : undefined;
665
651
  const inputs = rawInputs
666
- ? Object.fromEntries(Object.entries(rawInputs).filter(([k, v]) => !(k in SCRIPT_ARGS_ENVELOPE) || v !== SCRIPT_ARGS_ENVELOPE[k]))
652
+ ? Object.fromEntries(Object.entries(rawInputs).filter(([k, v]) => !(Object.hasOwn(SCRIPT_ARGS_ENVELOPE, k) && v === SCRIPT_ARGS_ENVELOPE[k])))
667
653
  : undefined;
668
654
  const schemaBody = payload?.context?.inputSchema?.body;
669
655
  const schemaIsDefault = schemaBody !== undefined && rawInputs !== undefined && JSON.stringify(safeJson(schemaBody)) === JSON.stringify(defaultScriptInputSchema(rawInputs));
@@ -675,14 +661,14 @@ function emitScriptTask(chain, el, payload, type) {
675
661
  // `Error`) while binding a differently-named variable, and the derived form
676
662
  // names it after the variable.
677
663
  const verbatim = outputRowsNeedSpellingOut(payload) ? emitOutputRows(payload) : undefined;
678
- chain.add(`.scriptTask(${str(el.id)}, ${opts([
679
- ['name', el.name !== undefined ? str(el.name) : undefined],
680
- ['script', str(el.script ?? '')],
681
- ['scriptFormat', el.scriptFormat && el.scriptFormat !== 'JavaScript' ? str(el.scriptFormat) : undefined],
664
+ chain.add(`.scriptTask(${tsText(el.id)}, ${opts([
665
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
666
+ ['script', tsText(el.script ?? '')],
667
+ ['scriptFormat', el.scriptFormat && el.scriptFormat !== 'JavaScript' ? tsText(el.scriptFormat) : undefined],
682
668
  // The builder's default is v3; anything else is load-bearing (it selects the
683
669
  // runtime's result shape) and must survive the round trip. An absent element
684
670
  // is spelled `'v1'`, the meaning it has to the runtime.
685
- ['scriptVersion', scriptVersionOf(el) !== 'v3' ? str(scriptVersionOf(el)) : undefined],
671
+ ['scriptVersion', scriptVersionOf(el) !== 'v3' ? tsText(scriptVersionOf(el)) : undefined],
686
672
  // Only when it is neither the contract's value nor the invalid one this SDK
687
673
  // used to emit. `BPMN.ScriptTask` is NORMALISED AWAY rather than preserved:
688
674
  // the runtime contract has no such type, so reproducing it would propagate a
@@ -690,7 +676,7 @@ function emitScriptTask(chain, el, payload, type) {
690
676
  // already makes for a bare `<uipath:input name="args">`.
691
677
  [
692
678
  'type',
693
- type !== undefined && type !== 'BPMN.Variables' && type !== 'BPMN.ScriptTask' ? str(type) : undefined,
679
+ type !== undefined && type !== 'BPMN.Variables' && type !== 'BPMN.ScriptTask' ? tsText(type) : undefined,
694
680
  ],
695
681
  ['inputSchema', schemaBody !== undefined && !schemaIsDefault ? jsonLiteral(schemaBody) : undefined],
696
682
  ['inputs', record(inputs)],
@@ -712,8 +698,8 @@ function emitVariableTask(chain, el, payload) {
712
698
  const asLiteral = /^=js:(".*")$/.exec(source);
713
699
  set[row.var ?? row.name] = asLiteral ? JSON.parse(asLiteral[1]) : source;
714
700
  }
715
- chain.add(`.task(${str(el.id)}, ${opts([
716
- ['name', el.name !== undefined ? str(el.name) : undefined],
701
+ chain.add(`.task(${tsText(el.id)}, ${opts([
702
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
717
703
  ['set', record(set)],
718
704
  ['tags', tagsOf(el)],
719
705
  ['retry', emitRetry(retryOf(el))],
@@ -733,10 +719,10 @@ function emitScope(chain, container, depth, indent) {
733
719
  }
734
720
  for (const f of flows) {
735
721
  const auto = `Flow_${f.sourceRef?.id}_${f.targetRef?.id}`;
736
- chain.add(`.sequenceFlow(${str(f.sourceRef?.id)}, ${str(f.targetRef?.id)}${optionalArg(opts([
737
- ['id', f.id !== auto ? str(f.id) : undefined],
738
- ['name', f.name !== undefined ? str(f.name) : undefined],
739
- ['condition', f.conditionExpression?.body !== undefined ? str(f.conditionExpression.body) : undefined],
722
+ chain.add(`.sequenceFlow(${tsText(f.sourceRef?.id)}, ${tsText(f.targetRef?.id)}${optionalArg(opts([
723
+ ['id', f.id !== auto ? tsText(f.id) : undefined],
724
+ ['name', f.name !== undefined ? tsText(f.name) : undefined],
725
+ ['condition', f.conditionExpression?.body !== undefined ? tsText(f.conditionExpression.body) : undefined],
740
726
  ]))})`);
741
727
  }
742
728
  }
@@ -1109,7 +1095,7 @@ function renderElementNested(plan, el, depth, indent) {
1109
1095
  function renderArmLines(plan, arm, depth, indent) {
1110
1096
  const lines = arm.items.map((item) => ('el' in item ? renderElementNested(plan, item.el, depth, indent) : renderBranch(plan, item.lift, depth, indent)));
1111
1097
  if (arm.end === 'goto')
1112
- lines.push(`.goto(${str(arm.gotoTarget)})`);
1098
+ lines.push(`.goto(${tsText(arm.gotoTarget)})`);
1113
1099
  return lines;
1114
1100
  }
1115
1101
  function renderArmBody(plan, arm, depth, indent) {
@@ -1128,10 +1114,10 @@ function renderHandler(plan, h, depth, indent) {
1128
1114
  const payload = payloadOf(b);
1129
1115
  const type = extensionTypeOf(payload);
1130
1116
  const optsText = opts([
1131
- ['id', b.id !== `${host}_${method}` ? str(b.id) : undefined],
1132
- ['name', b.name !== undefined ? str(b.name) : undefined],
1117
+ ['id', b.id !== `${host}_${method}` ? tsText(b.id) : undefined],
1118
+ ['name', b.name !== undefined ? tsText(b.name) : undefined],
1133
1119
  ['interrupting', def !== 'error' && b.cancelActivity === false ? 'false' : undefined],
1134
- ['payload', payload && type ? opts([['type', str(type)], ['outputRows', emitOutputRows(payload) ?? '[]']]) : undefined],
1120
+ ['payload', payload && type ? opts([['type', tsText(type)], ['outputRows', emitOutputRows(payload) ?? '[]']]) : undefined],
1135
1121
  ]);
1136
1122
  const body = renderArmBody(plan, h.arm, depth, indent);
1137
1123
  const args = [defExpr, ...(optsText !== '' && optsText !== '{}' ? [optsText] : []), ...(body ? [body] : [])];
@@ -1145,12 +1131,12 @@ function renderBranch(plan, lift, depth, indent) {
1145
1131
  const gw = lift.gateway;
1146
1132
  const joinOpt = lift.join !== undefined
1147
1133
  ? opts([
1148
- ['id', lift.join.id !== `${gw.id}_join` ? str(lift.join.id) : undefined],
1149
- ['name', lift.join.name !== undefined ? str(lift.join.name) : undefined],
1134
+ ['id', lift.join.id !== `${gw.id}_join` ? tsText(lift.join.id) : undefined],
1135
+ ['name', lift.join.name !== undefined ? tsText(lift.join.name) : undefined],
1150
1136
  ])
1151
1137
  : undefined;
1152
1138
  const optsText = opts([
1153
- ['name', gw.name !== undefined ? str(gw.name) : undefined],
1139
+ ['name', gw.name !== undefined ? tsText(gw.name) : undefined],
1154
1140
  ['inclusive', lift.inclusive ? 'true' : undefined],
1155
1141
  ['join', joinOpt !== undefined && joinOpt !== '' && joinOpt !== '{}' ? joinOpt : undefined],
1156
1142
  ]);
@@ -1159,13 +1145,13 @@ function renderBranch(plan, lift, depth, indent) {
1159
1145
  if (lift.construct !== 'choose')
1160
1146
  return body ?? '() => {}';
1161
1147
  return opts([
1162
- otherwise ? ['otherwise', 'true'] : ['when', str(flow.conditionExpression?.body)],
1163
- ['label', flow.name !== undefined ? str(flow.name) : undefined],
1148
+ otherwise ? ['otherwise', 'true'] : ['when', tsText(flow.conditionExpression?.body)],
1149
+ ['label', flow.name !== undefined ? tsText(flow.name) : undefined],
1164
1150
  ['body', body],
1165
1151
  ]);
1166
1152
  });
1167
1153
  const arms = `[\n${pad}${armTexts.join(`,\n${pad}`)},\n${indent.repeat(depth + 1)}]`;
1168
- return `.${lift.construct}(${str(gw.id)}, ${arms}${optionalArg(optsText)})`;
1154
+ return `.${lift.construct}(${tsText(gw.id)}, ${arms}${optionalArg(optsText)})`;
1169
1155
  }
1170
1156
  /**
1171
1157
  * An event sub-process as `.eventSubProcess()`, or nothing.
@@ -1253,7 +1239,7 @@ function renderEventSubProcess(plan, sp, depth, indent) {
1253
1239
  const spPayload = payloadOf(sp);
1254
1240
  const spType = extensionTypeOf(spPayload);
1255
1241
  const optsText = opts([
1256
- ['name', sp.name !== undefined ? str(sp.name) : undefined],
1242
+ ['name', sp.name !== undefined ? tsText(sp.name) : undefined],
1257
1243
  [def, defExpr],
1258
1244
  ['interrupting', def !== 'error' && start.isInterrupting === false ? 'false' : undefined],
1259
1245
  // `` `${id}_Error` `` is compile's default and `false` its opt-out, so neither is
@@ -1261,13 +1247,13 @@ function renderEventSubProcess(plan, sp, depth, indent) {
1261
1247
  // without one, and a capture the designer named something else is spelled out.
1262
1248
  [
1263
1249
  'errorVar',
1264
- capture === `${sp.id}_Error` ? undefined : capture !== undefined ? str(capture) : def === 'error' ? 'false' : undefined,
1250
+ capture === `${sp.id}_Error` ? undefined : capture !== undefined ? tsText(capture) : def === 'error' ? 'false' : undefined,
1265
1251
  ],
1266
- ['startId', start.id !== `${sp.id}_start` ? str(start.id) : undefined],
1267
- ['startName', start.name !== undefined ? str(start.name) : undefined],
1268
- ['startPayload', payload && type && capture === undefined ? opts([['type', str(type)], ['outputRows', emitOutputRows(payload) ?? '[]']]) : undefined],
1252
+ ['startId', start.id !== `${sp.id}_start` ? tsText(start.id) : undefined],
1253
+ ['startName', start.name !== undefined ? tsText(start.name) : undefined],
1254
+ ['startPayload', payload && type && capture === undefined ? opts([['type', tsText(type)], ['outputRows', emitOutputRows(payload) ?? '[]']]) : undefined],
1269
1255
  ['tags', tagsOf(sp)],
1270
- ['payload', spPayload && spType ? opts([['type', str(spType)], ['outputRows', emitOutputRows(spPayload) ?? '[]']]) : undefined],
1256
+ ['payload', spPayload && spType ? opts([['type', tsText(spType)], ['outputRows', emitOutputRows(spPayload) ?? '[]']]) : undefined],
1271
1257
  ]);
1272
1258
  const vars = new Chain('');
1273
1259
  emitVariablesInto(vars, sp, sp.id, capture !== undefined && captureDeclLooksDerived(sp, capture, start.id) ? new Set([capture]) : undefined);
@@ -1275,7 +1261,7 @@ function renderEventSubProcess(plan, sp, depth, indent) {
1275
1261
  const pad = indent.repeat(depth + 2);
1276
1262
  const body = bodyLines.length ? `(h) => h\n${pad}${bodyLines.join(`\n${pad}`)}` : '(h) => h';
1277
1263
  plan.summary.nets++;
1278
- return `.eventSubProcess(${str(sp.id)}, ${optsText}, ${body})`;
1264
+ return `.eventSubProcess(${tsText(sp.id)}, ${optsText}, ${body})`;
1279
1265
  }
1280
1266
  /** `emitScope`, with the liftable regions written as constructs. */
1281
1267
  function emitScopeNested(chain, container, depth, indent, summary, relabel, sequence) {
@@ -1286,10 +1272,10 @@ function emitScopeNested(chain, container, depth, indent, summary, relabel, sequ
1286
1272
  const written = new Set();
1287
1273
  if (sequence)
1288
1274
  chain.add(".flowMode('sequence')");
1289
- const renderFlow = (f) => `.sequenceFlow(${str(f.sourceRef?.id)}, ${str(f.targetRef?.id)}${optionalArg(opts([
1290
- ['id', f.id !== derivedFlowId(f) ? str(f.id) : undefined],
1291
- ['name', f.name !== undefined ? str(f.name) : undefined],
1292
- ['condition', f.conditionExpression?.body !== undefined ? str(f.conditionExpression.body) : undefined],
1275
+ const renderFlow = (f) => `.sequenceFlow(${tsText(f.sourceRef?.id)}, ${tsText(f.targetRef?.id)}${optionalArg(opts([
1276
+ ['id', f.id !== derivedFlowId(f) ? tsText(f.id) : undefined],
1277
+ ['name', f.name !== undefined ? tsText(f.name) : undefined],
1278
+ ['condition', f.conditionExpression?.body !== undefined ? tsText(f.conditionExpression.body) : undefined],
1293
1279
  ]))})`;
1294
1280
  /** Write an element's remaining flows now, before the next statement — so "explicit wins" applies. */
1295
1281
  const writeNow = (flows) => {
@@ -1386,17 +1372,17 @@ function emitScopeNested(chain, container, depth, indent, summary, relabel, sequ
1386
1372
  if (plan.impliedFlows.has(f.id) || written.has(f.id))
1387
1373
  continue;
1388
1374
  const auto = `Flow_${f.sourceRef?.id}_${f.targetRef?.id}`;
1389
- chain.add(`.sequenceFlow(${str(f.sourceRef?.id)}, ${str(f.targetRef?.id)}${optionalArg(opts([
1390
- ['id', f.id !== auto ? str(f.id) : undefined],
1391
- ['name', f.name !== undefined ? str(f.name) : undefined],
1392
- ['condition', f.conditionExpression?.body !== undefined ? str(f.conditionExpression.body) : undefined],
1375
+ chain.add(`.sequenceFlow(${tsText(f.sourceRef?.id)}, ${tsText(f.targetRef?.id)}${optionalArg(opts([
1376
+ ['id', f.id !== auto ? tsText(f.id) : undefined],
1377
+ ['name', f.name !== undefined ? tsText(f.name) : undefined],
1378
+ ['condition', f.conditionExpression?.body !== undefined ? tsText(f.conditionExpression.body) : undefined],
1393
1379
  ]))})`);
1394
1380
  }
1395
1381
  // Last, so it is first: the implied edges whose id is not the one the construct
1396
1382
  // derives. Emitted at the front of the chain because it is a declaration about the
1397
1383
  // whole scope, and only knowable once the walk has decided what to imply.
1398
1384
  if (plan.pinned.length) {
1399
- const rows = plan.pinned.map((e) => `{ source: ${str(e.source)}, target: ${str(e.target)}, id: ${str(e.id)} }`);
1385
+ const rows = plan.pinned.map((e) => `{ source: ${tsText(e.source)}, target: ${tsText(e.target)}, id: ${tsText(e.id)} }`);
1400
1386
  chain.addFirst(`.flowIds([${rows.join(', ')}])`);
1401
1387
  }
1402
1388
  }
@@ -1436,9 +1422,9 @@ function emitTriggerStartEvent(chain, el, payload, type) {
1436
1422
  const row = (payload.output ?? [])[0];
1437
1423
  const defaultVar = spec.output ? `${el.id}_${identifierize(spec.output.name)}` : undefined;
1438
1424
  const outputVar = row?.var;
1439
- const trigger = outputVar !== undefined && outputVar !== defaultVar ? opts([['outputVar', str(outputVar)]]) : 'true';
1440
- chain.add(`.startEvent(${str(el.id)}, ${opts([
1441
- ['name', el.name !== undefined ? str(el.name) : undefined],
1425
+ const trigger = outputVar !== undefined && outputVar !== defaultVar ? opts([['outputVar', tsText(outputVar)]]) : 'true';
1426
+ chain.add(`.startEvent(${tsText(el.id)}, ${opts([
1427
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
1442
1428
  ...eventOptions(el),
1443
1429
  ['trigger', trigger],
1444
1430
  ])})`);
@@ -1503,14 +1489,14 @@ function emitEvent(chain, el, kind, payload, type) {
1503
1489
  // after all, which is the branch this function is not on.
1504
1490
  const eventPayload = payload && type
1505
1491
  ? opts([
1506
- ['type', str(type)],
1492
+ ['type', tsText(type)],
1507
1493
  ['outputRows', emitOutputRows(payload) ?? '[]'],
1508
1494
  ])
1509
1495
  : undefined;
1510
1496
  if (kind === 'boundaryEvent') {
1511
- chain.add(`.boundaryEvent(${str(el.id)}, ${opts([
1512
- ['name', el.name !== undefined ? str(el.name) : undefined],
1513
- ['attachedTo', str(el.attachedToRef?.id)],
1497
+ chain.add(`.boundaryEvent(${tsText(el.id)}, ${opts([
1498
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
1499
+ ['attachedTo', tsText(el.attachedToRef?.id)],
1514
1500
  // The builder defaults to interrupting; only the exception is worth saying.
1515
1501
  ['cancelActivity', el.cancelActivity === false ? 'false' : undefined],
1516
1502
  ...eventOptions(el),
@@ -1518,8 +1504,8 @@ function emitEvent(chain, el, kind, payload, type) {
1518
1504
  ])})`);
1519
1505
  return;
1520
1506
  }
1521
- chain.add(`.${kind}(${str(el.id)}${optionalArg(opts([
1522
- ['name', el.name !== undefined ? str(el.name) : undefined],
1507
+ chain.add(`.${kind}(${tsText(el.id)}${optionalArg(opts([
1508
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
1523
1509
  ...eventOptions(el),
1524
1510
  // Only a start event can be non-interrupting, and only the exception is
1525
1511
  // spelled — the builder's default is BPMN's.
@@ -1583,14 +1569,14 @@ function emitElement(chain, el, depth, indent) {
1583
1569
  switch (kind) {
1584
1570
  case 'exclusiveGateway':
1585
1571
  case 'inclusiveGateway':
1586
- chain.add(`.${kind}(${str(el.id)}${optionalArg(opts([
1587
- ['name', el.name !== undefined ? str(el.name) : undefined],
1588
- ['default', el.default?.id !== undefined ? str(el.default.id) : undefined],
1572
+ chain.add(`.${kind}(${tsText(el.id)}${optionalArg(opts([
1573
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
1574
+ ['default', el.default?.id !== undefined ? tsText(el.default.id) : undefined],
1589
1575
  ]))})`);
1590
1576
  return;
1591
1577
  case 'parallelGateway':
1592
1578
  case 'eventBasedGateway':
1593
- chain.add(`.${kind}(${str(el.id)}${optionalArg(opts([['name', el.name !== undefined ? str(el.name) : undefined]]))})`);
1579
+ chain.add(`.${kind}(${tsText(el.id)}${optionalArg(opts([['name', el.name !== undefined ? tsText(el.name) : undefined]]))})`);
1594
1580
  return;
1595
1581
  // A task element with no `uipath:*` payload — an abstract task. All seven kinds are
1596
1582
  // legal bare and `validate` accepts every one, so they decompile through
@@ -1608,11 +1594,11 @@ function emitElement(chain, el, depth, indent) {
1608
1594
  case 'manualTask':
1609
1595
  case 'businessRuleTask':
1610
1596
  case 'receiveTask':
1611
- chain.add(`.plainTask(${str(el.id)}${optionalArg(opts([
1612
- ['name', el.name !== undefined ? str(el.name) : undefined],
1597
+ chain.add(`.plainTask(${tsText(el.id)}${optionalArg(opts([
1598
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
1613
1599
  // Only when it is not the default, so the common case stays terse. Spelled
1614
1600
  // the way the XML is, not the way moddle types it.
1615
- ['element', kind === 'task' ? undefined : str(`bpmn:${kind}`)],
1601
+ ['element', kind === 'task' ? undefined : tsText(`bpmn:${kind}`)],
1616
1602
  ['tags', tagsOf(el)],
1617
1603
  ['retry', emitRetry(retryOf(el))],
1618
1604
  ['errorMapping', emitErrorMapping(errorMappingOf(el))],
@@ -1633,13 +1619,13 @@ function emitElement(chain, el, depth, indent) {
1633
1619
  // `emitVariablesInto` has already written into the body above.
1634
1620
  const spPayload = payloadOf(el);
1635
1621
  const spType = extensionTypeOf(spPayload);
1636
- chain.add(`.subProcess(${str(el.id)}, ${body}${optionalArg(opts([
1637
- ['name', el.name !== undefined ? str(el.name) : undefined],
1622
+ chain.add(`.subProcess(${tsText(el.id)}, ${body}${optionalArg(opts([
1623
+ ['name', el.name !== undefined ? tsText(el.name) : undefined],
1638
1624
  [
1639
1625
  'payload',
1640
1626
  spPayload && spType
1641
1627
  ? opts([
1642
- ['type', str(spType)],
1628
+ ['type', tsText(spType)],
1643
1629
  ['outputRows', emitOutputRows(spPayload) ?? '[]'],
1644
1630
  ])
1645
1631
  : undefined,
@@ -1675,7 +1661,7 @@ function emitElementId(elementId, ownerId, rehome) {
1675
1661
  if (elementId === undefined)
1676
1662
  return 'null';
1677
1663
  const effective = rehome && elementId === rehome.from ? rehome.to : elementId;
1678
- return effective === ownerId ? undefined : str(effective);
1664
+ return effective === ownerId ? undefined : tsText(effective);
1679
1665
  }
1680
1666
  /**
1681
1667
  * Whether an error net's capture variable is declared exactly as `errorVar` would
@@ -1729,15 +1715,15 @@ defaultScope = () => ownerId) {
1729
1715
  continue;
1730
1716
  const type = varType(v.type);
1731
1717
  const def = v.default === undefined ? undefined : decodeDefault(v.default, v.type);
1732
- entries.push(`{ id: ${str(v.id)}, type: ${str(type)}${inner([
1733
- ['direction', direction === 'inputOutput' ? undefined : str(direction)],
1734
- ['name', v.name !== undefined && v.name !== v.id ? str(v.name) : undefined],
1718
+ entries.push(`{ id: ${tsText(v.id)}, type: ${tsText(type)}${inner([
1719
+ ['direction', direction === 'inputOutput' ? undefined : tsText(direction)],
1720
+ ['name', v.name !== undefined && v.name !== v.id ? tsText(v.name) : undefined],
1735
1721
  ['default', def],
1736
1722
  ['schema', v.body !== undefined ? (plan?.ref.get(String(v.body)) ?? jsonLiteral(v.body)) : undefined],
1737
1723
  ['required', v.required !== undefined ? 'true' : undefined],
1738
1724
  ['custom', v.custom !== undefined ? 'true' : undefined],
1739
1725
  ['internal', v.internal !== undefined ? 'true' : undefined],
1740
- ['subType', v.subType !== undefined ? str(v.subType) : undefined],
1726
+ ['subType', v.subType !== undefined ? tsText(v.subType) : undefined],
1741
1727
  ['elementId', emitElementId(v.elementId, defaultScope(prop, v), rehome)],
1742
1728
  ])} }`);
1743
1729
  }
@@ -1777,17 +1763,17 @@ function bindingIsReferenced(xml, id) {
1777
1763
  */
1778
1764
  function decodeDefault(raw, wire) {
1779
1765
  if (raw.startsWith('='))
1780
- return str(raw); // an expression, not a value of `wire`
1766
+ return tsText(raw); // an expression, not a value of `wire`
1781
1767
  if (wire === 'json')
1782
1768
  return raw; // already JSON — emit it verbatim
1783
1769
  if (wire === 'number')
1784
- return Number.isFinite(Number(raw)) ? String(Number(raw)) : str(raw);
1770
+ return Number.isFinite(Number(raw)) ? String(Number(raw)) : tsText(raw);
1785
1771
  // Only the two literals are booleans. Anything else — an empty `default=""`, which
1786
1772
  // a real export writes to mean "no value" — is text, and collapsing it to `false`
1787
1773
  // is the same silent inversion as the expression case above.
1788
1774
  if (wire === 'boolean' || wire === 'bool')
1789
- return raw === 'true' || raw === 'false' ? raw : str(raw);
1790
- return str(raw);
1775
+ return raw === 'true' || raw === 'false' ? raw : tsText(raw);
1776
+ return tsText(raw);
1791
1777
  }
1792
1778
  // ─── Entry point ──────────────────────────────────────────────────────────────
1793
1779
  /**
@@ -1880,12 +1866,12 @@ export async function decompile(xml, options = {}) {
1880
1866
  nonExecutable) {
1881
1867
  chain.add(`.metadata(${opts([
1882
1868
  ['executable', nonExecutable ? 'false' : undefined],
1883
- ['entryPointId', entryPoint?.value !== undefined ? str(entryPoint.value) : undefined],
1884
- ['tags', tagValues.length > 0 ? `[${tagValues.map((t) => str(t)).join(', ')}]` : undefined],
1869
+ ['entryPointId', entryPoint?.value !== undefined ? tsText(entryPoint.value) : undefined],
1870
+ ['tags', tagValues.length > 0 ? `[${tagValues.map((t) => tsText(t)).join(', ')}]` : undefined],
1885
1871
  [
1886
1872
  'caseManagement',
1887
1873
  caseMgmt?.version !== undefined
1888
- ? `{ version: ${str(caseMgmt.version)}${caseMgmt.value !== undefined ? `, value: ${str(caseMgmt.value)}` : ''} }`
1874
+ ? `{ version: ${tsText(caseMgmt.version)}${caseMgmt.value !== undefined ? `, value: ${tsText(caseMgmt.value)}` : ''} }`
1889
1875
  : undefined,
1890
1876
  ],
1891
1877
  ])})`);
@@ -1900,13 +1886,13 @@ export async function decompile(xml, options = {}) {
1900
1886
  droppedBindings.push(b.id);
1901
1887
  continue;
1902
1888
  }
1903
- bindingEntries.push(`{ id: ${str(b.id)}${inner([
1904
- ['name', b.name !== undefined && b.name !== b.id ? str(b.name) : undefined],
1905
- ['value', b.default !== undefined ? str(b.default) : undefined],
1906
- ['resource', b.resource !== undefined && b.resource !== 'custom' ? str(b.resource) : undefined],
1907
- ['resourceKey', b.resourceKey !== undefined && b.resourceKey !== b.default ? str(b.resourceKey) : undefined],
1908
- ['propertyAttribute', b.propertyAttribute !== undefined && b.propertyAttribute !== 'value' ? str(b.propertyAttribute) : undefined],
1909
- ['resourceSubType', b.resourceSubType !== undefined ? str(b.resourceSubType) : undefined],
1889
+ bindingEntries.push(`{ id: ${tsText(b.id)}${inner([
1890
+ ['name', b.name !== undefined && b.name !== b.id ? tsText(b.name) : undefined],
1891
+ ['value', b.default !== undefined ? tsText(b.default) : undefined],
1892
+ ['resource', b.resource !== undefined && b.resource !== 'custom' ? tsText(b.resource) : undefined],
1893
+ ['resourceKey', b.resourceKey !== undefined && b.resourceKey !== b.default ? tsText(b.resourceKey) : undefined],
1894
+ ['propertyAttribute', b.propertyAttribute !== undefined && b.propertyAttribute !== 'value' ? tsText(b.propertyAttribute) : undefined],
1895
+ ['resourceSubType', b.resourceSubType !== undefined ? tsText(b.resourceSubType) : undefined],
1910
1896
  ])} }`);
1911
1897
  }
1912
1898
  if (bindingEntries.length)
@@ -1930,7 +1916,7 @@ export async function decompile(xml, options = {}) {
1930
1916
  ...(varsExt?.inputOutput ?? []),
1931
1917
  ...(varsExt?.output ?? []),
1932
1918
  ]);
1933
- const schemaEntries = [...schemaPlan.declare].map(([id, body]) => `{ id: ${str(id)}, body: ${body} }`);
1919
+ const schemaEntries = [...schemaPlan.declare].map(([id, body]) => `{ id: ${tsText(id)}, body: ${body} }`);
1934
1920
  if (schemaEntries.length)
1935
1921
  chain.add(arrayCall('schemas', schemaEntries, chain.indent));
1936
1922
  // A folded body is written the way a declaration's would be — through the shared
@@ -1947,7 +1933,7 @@ export async function decompile(xml, options = {}) {
1947
1933
  // be noise.
1948
1934
  if (derived.size) {
1949
1935
  const ids = [...(varsExt?.input ?? []), ...(varsExt?.inputOutput ?? []), ...(varsExt?.output ?? [])].map((v) => v.id);
1950
- chain.add(`.preserve({ variableOrder: [${ids.map(str).join(', ')}] })`);
1936
+ chain.add(`.preserve({ variableOrder: [${ids.map(tsText).join(', ')}] })`);
1951
1937
  }
1952
1938
  try {
1953
1939
  emitVariablesInto(chain, host.container, host.rehome?.to ?? host.container.id, derived, host.rehome, schemaPlan, publicDeclarationScopeOf(process, host.rehome?.to ?? host.container.id));
@@ -1972,8 +1958,8 @@ export async function decompile(xml, options = {}) {
1972
1958
  }
1973
1959
  const importFrom = options.importSpecifier ?? './bpmn-sdk.js';
1974
1960
  const imported = ['bpmn', ...[...schemaPlan.imports].sort()].join(', ');
1975
- const head = `import { ${imported} } from ${str(importFrom)};\n\nexport default bpmn(${str(process.id)})`;
1976
- const name = process.name !== undefined ? `\n${indent}.name(${str(process.name)})` : '';
1961
+ const head = `import { ${imported} } from ${tsText(importFrom)};\n\nexport default bpmn(${tsText(process.id)})`;
1962
+ const name = process.name !== undefined ? `\n${indent}.name(${tsText(process.name)})` : '';
1977
1963
  return `${host.note}${head}${name}\n${chain.all.join('\n')}\n${indent}.build();\n`;
1978
1964
  }
1979
1965
  /**