@uipath/maestro-builder-sdk 6.87.1 → 6.87.3

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.
@@ -650,10 +650,15 @@ export interface StartOpts {
650
650
  * reports that as `ERROR_START_OUTSIDE_EVENT_SUBPROCESS` rather than leaving it to
651
651
  * be discovered at run time, because `uip maestro bpmn validate` accepts it.
652
652
  *
653
- * Interrupting is the only form emitted: `isInterrupting` is left unset, which is
654
- * BPMN's default and what the platform's own templates produce. A
655
- * non-interrupting error start is not a thing — the throw has already ended its
656
- * scope by the time the handler sees it.
653
+ * Interrupting is the form to author: `isInterrupting` is left unset, which is
654
+ * BPMN's default and what the platform's own templates produce. On a
655
+ * NON-interrupting error start the engine never starts the event sub-process: both
656
+ * the platform (`EventSubProcessPredicates.IsInterruptingErrorEventSubProcess`) and
657
+ * the local engine require an interrupting error start, so the handler does not run
658
+ * and the error faults the scope. Deployed processes still carry
659
+ * `isInterrupting="false"` on one and `uip maestro bpmn validate` accepts it, so
660
+ * `interrupting: false` is kept as written and `check` warns
661
+ * (BPMN_ERROR_START_NOT_INTERRUPTING). Drop it to make the handler run.
657
662
  */
658
663
  error?: ErrorLike;
659
664
  /** Start on a timer — an ISO-8601 duration string, or a full {@link TimerSpec}. */
@@ -712,9 +717,11 @@ export interface StartOpts {
712
717
  * `false` makes a message or timer start NON-interrupting: the event sub-process it
713
718
  * starts runs beside the container instead of cancelling it (`isInterrupting="false"`).
714
719
  *
715
- * Only meaningful on the start event of an event sub-process, and never for an
716
- * `error` start, which BPMN defines as interrupting — the throw has already ended its
717
- * scope. Defaults to `true`, the BPMN default, which writes no attribute.
720
+ * Only meaningful on the start event of an event sub-process. Never set it on an
721
+ * `error` start: the engine never starts the event sub-process, so the handler does
722
+ * not run and the error faults the scope. It is still written as given there
723
+ * (deployed processes carry it), and `check` warns (BPMN_ERROR_START_NOT_INTERRUPTING).
724
+ * Defaults to `true`, the BPMN default, which writes no attribute.
718
725
  * {@link ScopeBuilder.eventSubProcess} sets this from its own `interrupting` option.
719
726
  */
720
727
  interrupting?: boolean;
@@ -1980,7 +1987,9 @@ export interface EventSubProcessOpts {
1980
1987
  /**
1981
1988
  * For a `message` or `timer` start: `false` lets the container keep running while
1982
1989
  * the sub-process handles the event (`isInterrupting="false"`). Defaults to `true`.
1983
- * Refused with `error`, which BPMN defines as interrupting.
1990
+ * Do not set it with `error`: the engine never starts the event sub-process, so the
1991
+ * handler does not run and the error faults the scope. It is written as given
1992
+ * (deployed processes carry it) and `check` warns (BPMN_ERROR_START_NOT_INTERRUPTING).
1984
1993
  */
1985
1994
  interrupting?: boolean;
1986
1995
  /**
@@ -3130,8 +3139,8 @@ declare abstract class ScopeBuilder {
3130
3139
  * @param opts - What starts it — exactly one of `error` / `message` / `timer` — and the rest of {@link EventSubProcessOpts}.
3131
3140
  * @param fn - Receives the body builder; elements chain in the order they are written.
3132
3141
  * @returns This builder, so calls chain.
3133
- * @throws If none or several of `error` / `message` / `timer` are given, if an error start
3134
- * is asked to be non-interrupting, or if a path in the body is left open.
3142
+ * @throws If none or several of `error` / `message` / `timer` are given, or if a path in the
3143
+ * body is left open.
3135
3144
  */
3136
3145
  eventSubProcess(id: string, opts: EventSubProcessOpts, fn: (sp: SubProcessBuilder) => void): this;
3137
3146
  /**
@@ -716,9 +716,6 @@ class ScopeBuilder {
716
716
  if (opts.trigger !== undefined && opts.payload !== undefined) {
717
717
  throw new CompileRefusal('BPMN_START_TRIGGER_AND_PAYLOAD', `startEvent "${id}": \`trigger\` and \`payload\` both write the event's extension element; pass one.`);
718
718
  }
719
- if (opts.interrupting === false && opts.error !== undefined) {
720
- throw new CompileRefusal('BPMN_ERROR_START_NOT_INTERRUPTING', `startEvent "${id}": an error start is always interrupting — the throw has already ended the scope it came from.`);
721
- }
722
719
  return this.push({
723
720
  kind: 'startEvent',
724
721
  id,
@@ -2073,17 +2070,14 @@ class ScopeBuilder {
2073
2070
  * @param opts - What starts it — exactly one of `error` / `message` / `timer` — and the rest of {@link EventSubProcessOpts}.
2074
2071
  * @param fn - Receives the body builder; elements chain in the order they are written.
2075
2072
  * @returns This builder, so calls chain.
2076
- * @throws If none or several of `error` / `message` / `timer` are given, if an error start
2077
- * is asked to be non-interrupting, or if a path in the body is left open.
2073
+ * @throws If none or several of `error` / `message` / `timer` are given, or if a path in the
2074
+ * body is left open.
2078
2075
  */
2079
2076
  eventSubProcess(id, opts, fn) {
2080
2077
  const given = [opts.error !== undefined, opts.message !== undefined, opts.timer !== undefined].filter(Boolean).length;
2081
2078
  if (given !== 1) {
2082
2079
  throw new CompileRefusal('BPMN_EVENT_SUBPROCESS_START_COUNT', `eventSubProcess "${id}" needs exactly one of { error, message, timer } — that is what starts it.`);
2083
2080
  }
2084
- if (opts.error !== undefined && opts.interrupting === false) {
2085
- throw new CompileRefusal('BPMN_ERROR_START_NOT_INTERRUPTING', `eventSubProcess "${id}": an error start is always interrupting — the throw has already ended the scope it came from.`);
2086
- }
2087
2081
  if (opts.errorVar !== undefined && opts.errorVar !== false && opts.error === undefined) {
2088
2082
  throw new CompileRefusal('BPMN_ERROR_VAR_WITHOUT_ERROR', `eventSubProcess "${id}": \`errorVar\` captures an error, so it needs \`error\`.`);
2089
2083
  }
@@ -1451,6 +1451,16 @@ inEventSubProcess = false) {
1451
1451
  where: n.id,
1452
1452
  });
1453
1453
  }
1454
+ // Dead handler: both engines start an error ESP only when its start is interrupting.
1455
+ if (n.kind === 'startEvent' && n.event?.type === 'error' && n.interrupting === false) {
1456
+ diags.push({
1457
+ level: 'warning',
1458
+ code: 'BPMN_ERROR_START_NOT_INTERRUPTING',
1459
+ message: `Error start event "${n.id}" is marked non-interrupting, so the engine never starts this event ` +
1460
+ 'sub-process and the error faults the scope. Drop `interrupting: false`.',
1461
+ where: n.id,
1462
+ });
1463
+ }
1454
1464
  if (n.kind !== 'subProcess' && 'event' in n && n.event?.type === 'timer') {
1455
1465
  const t = n.event.timer;
1456
1466
  const blank = [t.duration, t.date, t.cycle].find(isBlankTimerValue) !== undefined;
@@ -1741,8 +1741,6 @@ function renderEventSubProcess(plan, sp, depth, indent) {
1741
1741
  const def = singleDefinition(start);
1742
1742
  if (!def)
1743
1743
  return reject('its start carries no single error, timer or message definition');
1744
- if (def === 'error' && start.isInterrupting === false)
1745
- return reject('a non-interrupting error start is not a thing');
1746
1744
  const outs = g.outs.get(start.id) ?? [];
1747
1745
  if (outs.length !== 1)
1748
1746
  return reject(`its start has ${outs.length} outgoing flows`);
@@ -1803,7 +1801,9 @@ function renderEventSubProcess(plan, sp, depth, indent) {
1803
1801
  const optsText = opts([
1804
1802
  ['name', sp.name !== undefined ? tsText(sp.name) : undefined],
1805
1803
  [def, defExpr],
1806
- ['interrupting', def !== 'error' && start.isInterrupting === false ? 'false' : undefined],
1804
+ // Written for an error start too: a deployed one can carry `isInterrupting="false"`
1805
+ // (which makes it a dead handler; check warns), and dropping it would change the file.
1806
+ ['interrupting', start.isInterrupting === false ? 'false' : undefined],
1807
1807
  // `` `${id}_Error` `` is compile's default and `false` its opt-out, so neither is
1808
1808
  // left implicit the wrong way round: an error start with no capture row recompiles
1809
1809
  // without one, and a capture the designer named something else is spelled out.
@@ -83,7 +83,7 @@ export declare const REFUSALS: {
83
83
  readonly BPMN_DUP_BOUNDARY_ID: "lowering";
84
84
  readonly BPMN_DUP_ERROR_CATCH: "lowering";
85
85
  readonly BPMN_ERROR_NAME_EMPTY: "lowering";
86
- readonly BPMN_ERROR_START_NOT_INTERRUPTING: "lowering";
86
+ readonly BPMN_ERROR_START_NOT_INTERRUPTING: "lint";
87
87
  readonly BPMN_ERROR_VAR_AND_PAYLOAD: "lowering";
88
88
  readonly BPMN_ERROR_VAR_WITHOUT_ERROR: "lowering";
89
89
  readonly BPMN_EVENT_BINDINGS_MISSING: "lowering";
@@ -132,7 +132,7 @@ export const REFUSALS = {
132
132
  BPMN_DUP_BOUNDARY_ID: 'lowering',
133
133
  BPMN_DUP_ERROR_CATCH: 'lowering',
134
134
  BPMN_ERROR_NAME_EMPTY: 'lowering',
135
- BPMN_ERROR_START_NOT_INTERRUPTING: 'lowering',
135
+ BPMN_ERROR_START_NOT_INTERRUPTING: 'lint',
136
136
  BPMN_ERROR_VAR_AND_PAYLOAD: 'lowering',
137
137
  BPMN_ERROR_VAR_WITHOUT_ERROR: 'lowering',
138
138
  BPMN_EVENT_BINDINGS_MISSING: 'lowering',
package/dist/decompile.js CHANGED
@@ -2936,7 +2936,9 @@ function canonicalJson(v) {
2936
2936
  * a script body, a decision or switch `expression`, a loop's `condition` and
2937
2937
  * `completionCondition`, an HTTP branch's `conditionExpression`, a transform's
2938
2938
  * `collection`. `serialize` renames `$vars` reads in exactly these and in
2939
- * `=js:` values.
2939
+ * `=js:` values. A loop's `completionCondition` is listed for files written
2940
+ * before #1763: the SDK now writes it as a jsExpression envelope, because the
2941
+ * runtime ignores the bare string.
2940
2942
  */
2941
2943
  const RAW_JS_FIELDS = new Set(['script', 'expression', 'condition', 'completionCondition', 'conditionExpression', 'collection']);
2942
2944
  /**
@@ -34,6 +34,68 @@ function liftPageRange(node) {
34
34
  const p = node.inputs?.pageRange;
35
35
  return typeof p === 'string' && p !== '' ? p : undefined;
36
36
  }
37
+ /**
38
+ * An object input of the node when it differs from the definition's default for
39
+ * it, as the lift keeps it: the designer writes the default on every node, and
40
+ * an author who leaves the field out gets that default back from serialize.
41
+ * Absent: undefined. Present but not a plain object (an expression such as
42
+ * `=js:vars.taxonomy`): reported as lossy, since the option takes an object only.
43
+ */
44
+ function liftObjectInput(node, key, ctx) {
45
+ const value = node.inputs?.[key];
46
+ if (value === undefined)
47
+ return undefined;
48
+ const raw = ctx.plainValue(value);
49
+ // sourceText is defined for a string and for an expression envelope.
50
+ const text = ctx.sourceText(raw);
51
+ if (text !== undefined || raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
52
+ ctx.lossy(classifyLoss(ctx, key, `is ${JSON.stringify(text ?? raw)}, not an object`));
53
+ return undefined;
54
+ }
55
+ const fallback = ctx.definition()?.inputDefaults?.[key];
56
+ return JSON.stringify(raw) === JSON.stringify(fallback) ? undefined : raw;
57
+ }
58
+ function classifyLoss(ctx, key, what) {
59
+ return `classify step ${JSON.stringify(ctx.nodeId)}: ${key} ${what}, which documentClassify() cannot express, `
60
+ + `so compile writes the definition's default instead.`;
61
+ }
62
+ const SCHEMA_KEYS = new Set(['generalInstructions', 'classes']);
63
+ const CLASS_KEYS = new Set(['id', 'name', 'instructions']);
64
+ const optionalString = (v) => v === undefined || typeof v === 'string';
65
+ /** Why a lifted `classificationSchema` does not fit {@link ClassificationSchema}; undefined when it does. */
66
+ function classificationSchemaMismatch(raw) {
67
+ const extra = Object.keys(raw).filter((k) => !SCHEMA_KEYS.has(k));
68
+ if (extra.length > 0)
69
+ return `has key(s) ${extra.join(', ')}`;
70
+ if (!optionalString(raw.generalInstructions))
71
+ return 'has a generalInstructions that is not a string';
72
+ if (!Array.isArray(raw.classes))
73
+ return 'has no classes array';
74
+ for (const [i, c] of raw.classes.entries()) {
75
+ if (c === null || typeof c !== 'object' || Array.isArray(c))
76
+ return `has a classes[${i}] that is not an object`;
77
+ const cls = c;
78
+ const extraC = Object.keys(cls).filter((k) => !CLASS_KEYS.has(k));
79
+ if (extraC.length > 0)
80
+ return `has classes[${i}] key(s) ${extraC.join(', ')}`;
81
+ if (typeof cls.id !== 'string' || typeof cls.name !== 'string' || !optionalString(cls.instructions)) {
82
+ return `has a classes[${i}] whose id, name or instructions is not a string`;
83
+ }
84
+ }
85
+ return undefined;
86
+ }
87
+ /** `classificationSchema` as the lift keeps it: only a value that type-checks as {@link ClassificationSchema}. */
88
+ function liftClassificationSchema(node, ctx) {
89
+ const raw = liftObjectInput(node, 'classificationSchema', ctx);
90
+ if (raw === undefined)
91
+ return undefined;
92
+ const mismatch = classificationSchemaMismatch(raw);
93
+ if (mismatch !== undefined) {
94
+ ctx.lossy(classifyLoss(ctx, 'classificationSchema', mismatch));
95
+ return undefined;
96
+ }
97
+ return raw;
98
+ }
37
99
  export const documentClassifyNodeType = {
38
100
  kind: 'documentClassify', typeName: 'uipath.document.classify', version: '1.0', factory: 'documentClassify',
39
101
  definition: 'bundled', rawNode: { factory: 'documentClassify()' },
@@ -50,18 +112,23 @@ export const documentClassifyNodeType = {
50
112
  ...(inputs.modelConfig !== undefined
51
113
  ? { modelConfig: { ...(d.modelConfig ?? {}), ...inputs.modelConfig } }
52
114
  : {}),
115
+ ...(inputs.classificationSchema !== undefined ? { classificationSchema: jsonClone(inputs.classificationSchema) } : {}),
53
116
  },
54
117
  };
55
118
  },
56
119
  deserialize: (node, ctx) => {
57
120
  const pageRange = liftPageRange(node);
58
121
  const split = ctx.plainValue(node.inputs?.splitPages);
122
+ const modelConfig = liftObjectInput(node, 'modelConfig', ctx);
123
+ const classificationSchema = liftClassificationSchema(node, ctx);
59
124
  return {
60
125
  kind: 'documentClassify',
61
126
  inputs: {
62
127
  fileRef: liftFileRef(node, ctx),
63
128
  ...(pageRange !== undefined ? { pageRange } : {}),
64
129
  ...(split === true ? { splitPages: true } : {}),
130
+ ...(modelConfig !== undefined ? { modelConfig } : {}),
131
+ ...(classificationSchema !== undefined ? { classificationSchema } : {}),
65
132
  },
66
133
  };
67
134
  },
@@ -71,6 +138,8 @@ export const documentClassifyNodeType = {
71
138
  ['fileRef', ctx.value(inputs.fileRef)],
72
139
  ['pageRange', inputs.pageRange !== undefined ? ctx.string(inputs.pageRange) : undefined],
73
140
  ['splitPages', inputs.splitPages === true ? 'true' : undefined],
141
+ ['modelConfig', inputs.modelConfig !== undefined ? ctx.json(inputs.modelConfig) : undefined],
142
+ ['classificationSchema', inputs.classificationSchema !== undefined ? ctx.json(inputs.classificationSchema) : undefined],
74
143
  ],
75
144
  }),
76
145
  check: ({ inputs }, ctx) => checkFileRef(inputs, 'classify', ctx),
@@ -17,6 +17,41 @@ export interface DocumentClassifyInputs {
17
17
  splitPages?: boolean;
18
18
  /** Model configuration overrides; omit for the platform defaults (gemini_2_5_flash). */
19
19
  modelConfig?: Record<string, unknown>;
20
+ /**
21
+ * The document types to classify into (the node's taxonomy), as the
22
+ * designer's Classes editor writes it. Omit for the definition's default.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * documentClassify({
27
+ * fileRef: input('file'),
28
+ * classificationSchema: {
29
+ * generalInstructions: 'Classify supplier paperwork.',
30
+ * classes: [
31
+ * { id: 'c1', name: 'invoice', instructions: 'A bill asking for payment.' },
32
+ * { id: 'c2', name: 'receipt', instructions: 'Proof that a payment was made.' },
33
+ * ],
34
+ * },
35
+ * })
36
+ * ```
37
+ */
38
+ classificationSchema?: ClassificationSchema;
39
+ }
40
+ /** The taxonomy of a `documentClassify()` step: what the classifier chooses between. */
41
+ export interface ClassificationSchema {
42
+ /** Instructions that apply to every class. */
43
+ generalInstructions?: string;
44
+ /** One entry per document type, in the order the designer lists them. */
45
+ classes: ClassificationClass[];
46
+ }
47
+ /** One document type in a {@link ClassificationSchema}. */
48
+ export interface ClassificationClass {
49
+ /** The class's id, unique in the schema (the designer mints a UUID). */
50
+ id: string;
51
+ /** The document type's name, which the classifier answers with, e.g. `'invoice'`. */
52
+ name: string;
53
+ /** What makes a document this type. */
54
+ instructions?: string;
20
55
  }
21
56
  /** What `dynamicExtract()` takes: the document and the fields to extract from it. */
22
57
  export interface DynamicExtractInputs {
package/dist/serialize.js CHANGED
@@ -3254,7 +3254,8 @@ function serializeFlow(built, opts) {
3254
3254
  collection: renderValue(step.collection, scope.rename),
3255
3255
  parallel: o.parallel ?? false,
3256
3256
  ...(o.completionCondition !== undefined && (v24 || 'completionCondition' in declared)
3257
- ? { completionCondition: renameRefs(o.completionCondition.js, scope.rename) }
3257
+ // =js: so migrate writes the envelope; a bare string reaches the BPMN condition as text and never fires (#1763).
3258
+ ? { completionCondition: '=js:' + renameRefs(o.completionCondition.js, scope.rename) }
3258
3259
  : {}),
3259
3260
  ...(v24 || 'breakEnabled' in declared ? { breakEnabled: (o.breakEnabled ?? false) || usesBreak } : {}),
3260
3261
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.87.1",
3
+ "version": "6.87.3",
4
4
  "description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.uipath.com/maestro",
@@ -110,5 +110,5 @@
110
110
  "@types/node": "^22.7.0",
111
111
  "esbuild": "^0.28.1"
112
112
  },
113
- "gitref": "0f035f2ff693d92e026d4287d7993fef4959f7d9"
113
+ "gitref": "39ebb67c20d4fbb730c1c5345fff135c19dcf34b"
114
114
  }