@uipath/maestro-builder-sdk 6.86.27 → 6.87.1

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/README.md CHANGED
@@ -158,6 +158,8 @@ The same builder core, the same four verbs. Import from
158
158
  `uip maestro case compile` / `uip maestro bpmn compile`. Their builder surfaces are in the same
159
159
  generated indexes as Flow's — `api-index.md` by symbol name, `api-members.md` by
160
160
  field or method name — which cover all three entry points.
161
+ BPMN also gets `dist/bpmn-api.md`: every builder method and option field, one line each, with its type and one-line doc.
162
+ `uip maestro bpmn check --source` type-checks the `.bpmn.ts` before running it, so a misspelled option or a value of the wrong type is a `TS<code>` error at `file:line:col` rather than a crash; `--no-types` skips that pass.
161
163
 
162
164
  The package is ESM.
163
165
  Every entry also answers CommonJS resolution, so `require.resolve` of a subpath such as `@uipath/maestro-builder-sdk/bpmn` finds the file on disk, and on Node 22.12 or later `require()` loads it too.
package/dist/api-index.md CHANGED
@@ -14,6 +14,10 @@ reference pages are "one line per field". Those are not here — they are in
14
14
  [`api-members.md`](api-members.md), keyed by the member's own name. This file
15
15
  indexes the exports: interfaces, types, functions, classes, consts.
16
16
 
17
+ **Authoring BPMN? Start in [`bpmn-api.md`](bpmn-api.md), not here.** It lists every
18
+ builder method and option field of `@uipath/maestro-builder-sdk/bpmn` with its type and
19
+ one-line doc, so the row you land on is the answer and no `.d.ts` read follows.
20
+
17
21
  **Read the declaration, not a description of it.** The `.d.ts` is what the
18
22
  compiler checks your source against, and it carries the `@remarks` and
19
23
  `@example` bodies the reference pages leave out. The span below is the whole
@@ -404,7 +408,7 @@ could hand you spans for a version you do not have.
404
408
 
405
409
  ## `@uipath/maestro-builder-sdk/bpmn`
406
410
 
407
- 115 symbol(s). Import from `@uipath/maestro-builder-sdk/bpmn`.
411
+ 115 symbol(s). Import from `@uipath/maestro-builder-sdk/bpmn`. Every method and option field below, with its type and doc, is in [`bpmn-api.md`](bpmn-api.md) — read that first.
408
412
 
409
413
  | Symbol | Kind | Declaration | Area | Summary |
410
414
  | --- | --- | --- | --- | --- |
@@ -18,6 +18,10 @@ the case: the reference pages are "one line per field", so you arrive holding
18
18
  `outcomePorts`, not `HitlInputs`. Look it up here and you get the shape that
19
19
  declares it and the exact lines that declare it.
20
20
 
21
+ **Authoring BPMN? Search [`bpmn-api.md`](bpmn-api.md) instead.** It has the same members
22
+ of `@uipath/maestro-builder-sdk/bpmn` WITH their type and one-line doc, so the row is the
23
+ answer and there is no span to follow.
24
+
21
25
  [`api-index.md`](api-index.md) is the other half: the same thing keyed by the
22
26
  exported symbol (interfaces, types, functions, classes, consts).
23
27
 
@@ -3,7 +3,7 @@
3
3
  * check-cli — fast static validation of a <Name>.bpmn.ts (no output file).
4
4
  *
5
5
  * Usage:
6
- * node --experimental-strip-types check-cli.js <bpmn.ts | BaseName> [--graph] \
6
+ * node --experimental-strip-types check-cli.js <bpmn.ts | BaseName> [--graph] [--no-types] \
7
7
  * [--library <library-json dir>] [--connectors-local <overlay dir>] [--bindings <bindings.json>] \
8
8
  * [--resources <resources.json>]
9
9
  *
@@ -13,11 +13,17 @@
13
13
  * Exit 0 = clean; exit 1 = at least one error. Warnings print but do not fail.
14
14
  * `--graph` also prints the resolved wiring to stdout — every element with the flows
15
15
  * leaving it, implied edges marked — see graph.ts.
16
+ *
17
+ * The source is type-checked first (source-types.ts): a wrong option name or a
18
+ * value of the wrong type is a `TS<code>` error with its `file:line:col`, and it
19
+ * is reported even when the source then crashes on load or in the check.
20
+ * `--no-types` skips it.
16
21
  */
17
22
  import { existsSync } from 'node:fs';
18
23
  import { printResult, reportDiagnostics, reportResult } from '../cli-result.js';
19
24
  import { resolveBpmnFile, loadBuiltBpmn } from './load.js';
20
25
  import { check } from './check.js';
26
+ import { sourceTypeDiagnostics } from './source-types.js';
21
27
  import { graphModel, renderGraph } from './graph.js';
22
28
  import { Bindings } from '../core/bindings.js';
23
29
  import { connectorCheckOpts, openCliLibrary } from '../core/cli-library.js';
@@ -39,20 +45,46 @@ function bpmnCheckOpts(argv) {
39
45
  const resources = readCliResources(argv, defaultResourcesFile());
40
46
  return { ...connectorCheckOpts(openCliLibrary(argv), bindFile ? new Bindings(bindFile) : undefined), ...(resources ? { resources } : {}) };
41
47
  }
48
+ function printDiagnostics(diags) {
49
+ for (const d of diags)
50
+ console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
51
+ }
52
+ /** The diagnostics, both as the `--json` result and as the printed lines. */
53
+ function report(diags) {
54
+ reportDiagnostics(diags);
55
+ printDiagnostics(diags);
56
+ }
42
57
  export async function run(argv) {
43
58
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
44
- console.error('usage: check <bpmn.ts | BaseName> [--graph] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
59
+ console.error('usage: check <bpmn.ts | BaseName> [--graph] [--no-types] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
45
60
  return 2;
46
61
  }
47
62
  ensureTypeScriptRuntime();
48
63
  const graph = argv.includes('--graph');
49
64
  const input = argv.find((a, i) => !a.startsWith('--') && !VALUE_FLAGS.has(argv[i - 1]));
50
65
  if (input === undefined) {
51
- console.error('usage: check <bpmn.ts | BaseName> [--graph] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
66
+ console.error('usage: check <bpmn.ts | BaseName> [--graph] [--no-types] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
52
67
  return 2;
53
68
  }
54
- const built = await loadBuiltBpmn(resolveBpmnFile(input));
55
- const diags = check(built, bpmnCheckOpts(argv));
69
+ const file = resolveBpmnFile(input);
70
+ const typeDiags = argv.includes('--no-types') ? [] : sourceTypeDiagnostics(file);
71
+ let built;
72
+ let diags;
73
+ try {
74
+ built = await loadBuiltBpmn(file);
75
+ diags = [...typeDiags, ...check(built, bpmnCheckOpts(argv))];
76
+ }
77
+ catch (error) {
78
+ // A value of the wrong type usually crashes the build or the check before
79
+ // either reports anything (`expr.startsWith is not a function`). The type
80
+ // errors are the explanation, so they go out first, then the crash.
81
+ if (!typeDiags.some((d) => d.level === 'error'))
82
+ throw error;
83
+ report(typeDiags);
84
+ console.error(`check: the source also failed to run: ${error instanceof Error ? error.message : String(error)}`);
85
+ console.error(`check: ${typeDiags.filter((d) => d.level === 'error').length} type error(s); fix them first.`);
86
+ return 1;
87
+ }
56
88
  reportDiagnostics(diags);
57
89
  if (graph) {
58
90
  // The graph goes to stdout and the diagnostics to stderr, so a reviewer can
@@ -61,8 +93,7 @@ export async function run(argv) {
61
93
  printResult(renderGraph(built).trimEnd());
62
94
  reportResult({ graph: graphModel(built) });
63
95
  }
64
- for (const d of diags)
65
- console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
96
+ printDiagnostics(diags);
66
97
  const errors = diags.filter((d) => d.level === 'error').length;
67
98
  if (errors) {
68
99
  console.error(`check: ${errors} error(s).`);
@@ -21,9 +21,10 @@
21
21
  * resolves for a package consumer; the library default in `decompile.ts` stays
22
22
  * repo-relative for in-tree callers, mirroring the Flow and Case arms.
23
23
  *
24
- * Diagram layout is not read or emitted — the SDK emits semantic-only XML and
25
- * `uip maestro bpmn format` regenerates `bpmndi`. Run it on the recompiled artifact
26
- * when a canvas needs one.
24
+ * Diagram layout is not read or emitted — the SDK emits semantic-only XML. For a
25
+ * brownfield edit, `bpmn-merge` puts the original diagram back and draws only what the
26
+ * edit added (merge-placement.ts); `uip maestro bpmn format`, which lays the whole
27
+ * diagram out again, is for a greenfield file.
27
28
  *
28
29
  * `--style nested` lifts the regions the builder's nesting constructs lower to —
29
30
  * see `BpmnDecompileOptions.style`. It is written only after both sources have been
@@ -16,9 +16,10 @@
16
16
  *
17
17
  * What does NOT survive, and why:
18
18
  *
19
- * - **`bpmndi` diagram layout.** The SDK emits none and `uip maestro bpmn format`
20
- * regenerates it, so there is nothing to preserve. A decompiled file recompiles
21
- * to semantic-only XML; re-run `format` for a canvas.
19
+ * - **`bpmndi` diagram layout.** The SDK emits none, so there is nothing to
20
+ * preserve here. A decompiled file recompiles to semantic-only XML; `bpmn-merge`
21
+ * puts the original diagram back and draws only what the edit added
22
+ * (merge-placement.ts). `format` is for a greenfield file.
22
23
  * - **Comments, method order, and formatting.** Regenerated, not preserved.
23
24
  *
24
25
  * Everything else round-trips: events and their definitions, all four gateways,
@@ -33,11 +33,29 @@ export function run(argv) {
33
33
  });
34
34
  const out = flagValue(argv, '-o') ?? 'merged.bpmn';
35
35
  writeFileSync(out, result.xml);
36
- reportResult({ path: resolve(out), preserved: result.preserved.length, authored: result.authored.length, removed: result.removed.length });
36
+ const { layout } = result;
37
+ reportResult({
38
+ path: resolve(out),
39
+ preserved: result.preserved.length,
40
+ authored: result.authored.length,
41
+ removed: result.removed.length,
42
+ placed: layout.placed.length,
43
+ routed: layout.routed.length + layout.rerouted.length,
44
+ ...(layout.resized.length || layout.moved.length ? { resized: layout.resized, moved: layout.moved } : {}),
45
+ });
37
46
  // Say what was kept and what was rewritten: on a surgical edit the preserved count
38
47
  // should dwarf the authored one, and a reader who sees otherwise has learned something.
39
48
  console.log(`bpmn-merge: wrote ${basename(out)} (${result.preserved.length} preserved, ` +
40
49
  `${result.authored.length} authored, ${result.removed.length} removed)`);
50
+ // The diagram: what the edit added is drawn, and an existing shape moves only when a
51
+ // full lane, pool or sub-process had to grow — say so, by id, when it did.
52
+ if (layout.placed.length || layout.routed.length || layout.rerouted.length) {
53
+ console.log(`bpmn-merge: drew ${layout.placed.length} new shape(s) and ${layout.routed.length + layout.rerouted.length} edge(s); ` +
54
+ (layout.resized.length || layout.moved.length
55
+ ? `no room in its container, so grew ${layout.resized.join(', ') || 'nothing'}` +
56
+ (layout.moved.length ? ` and moved ${layout.moved.join(', ')} down by the same offset` : '')
57
+ : 'every existing shape kept its bounds'));
58
+ }
41
59
  return 0;
42
60
  }
43
61
  runWhenInvokedDirectly(import.meta.url, 'bpmn-merge', run);
@@ -0,0 +1,33 @@
1
+ /** What placement did to the diagram, by semantic element id. */
2
+ export interface BpmnPlacementReport {
3
+ /** Flow nodes the edit added that now have a shape. */
4
+ placed: string[];
5
+ /** Sequence flows the edit added that now have an edge. */
6
+ routed: string[];
7
+ /** Sequence flows kept by id but rewired, whose existing edge got a new route. */
8
+ rerouted: string[];
9
+ /** Existing containers (lane, pool, expanded sub-process) grown to fit a placed node. */
10
+ resized: string[];
11
+ /** Existing shapes shifted, with every other shape below a grown container. */
12
+ moved: string[];
13
+ }
14
+ export interface BpmnPlacementOptions {
15
+ /** True for an element id the edit added (absent from the original). Only those are drawn. */
16
+ isAdded: (id: string) => boolean;
17
+ /** Ids of existing sequence flows whose source or target the edit changed. */
18
+ rewired?: ReadonlySet<string>;
19
+ /**
20
+ * Ids of existing flow nodes the edit moved into another scope (into a sub-process it
21
+ * added, say). Their old shapes sit outside their new parent, so they are drawn again
22
+ * inside it, and their flows rerouted; they are reported as `moved`.
23
+ */
24
+ rescoped?: ReadonlySet<string>;
25
+ }
26
+ /**
27
+ * Draw the flow nodes and sequence flows the edit added, and only those, into the
28
+ * document's existing diagram. See the file header for the rules.
29
+ */
30
+ export declare function placeAddedElements(xml: string, options: BpmnPlacementOptions): {
31
+ xml: string;
32
+ report: BpmnPlacementReport;
33
+ };