@uipath/maestro-builder-sdk 6.93.7 → 6.93.8

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.
@@ -1012,13 +1012,23 @@ export interface ScriptTaskOpts extends ActivityOpts {
1012
1012
  * is anything else. `uip maestro bpmn validate` accepts both, so nothing in the
1013
1013
  * toolchain catches the wrong one — which is why the SDK emitted it for so long.
1014
1014
  *
1015
- * The option is kept rather than removed because it shipped (v3.25.0), and an
1016
- * importer may still meet a legacy artifact carrying the invalid value. Decompile
1017
- * does NOT preserve it: reproducing markup the contract rejects is propagating a
1018
- * defect, not fidelity — the same call the round trip already makes for a bare
1019
- * `<uipath:input name="args">`.
1020
- */
1021
- type?: string;
1015
+ * Any other value replaces the script's extension type, so the script never runs
1016
+ * and its outputs read back null — and `uip maestro bpmn validate` and a live
1017
+ * debug both still pass. So `.scriptTask()` refuses every value but
1018
+ * `BPMN.Variables` with `BPMN_SCRIPT_TASK_TYPE_INVALID`, the same way
1019
+ * `.plainTask()` refuses an element it cannot emit. `uip maestro bpmn registry get
1020
+ * BPMN.ScriptTask` lists `BPMN.ScriptTask`; do not copy it here. `.activity()`
1021
+ * refuses that type too (`BPMN_ACTIVITY_SCRIPT_TASK_TYPE`).
1022
+ *
1023
+ * The option is kept rather than removed because it shipped (v3.25.0) and code
1024
+ * that spells the default out still compiles. Decompile does NOT preserve any
1025
+ * other type an artifact may carry (the legacy `BPMN.ScriptTask` included): it
1026
+ * writes none, so the source is one this method accepts, and the header of the
1027
+ * decompiled source lists each task it normalised. Reproducing markup the contract
1028
+ * rejects is propagating a defect, not fidelity — the same call the round trip
1029
+ * already makes for a bare `<uipath:input name="args">`.
1030
+ */
1031
+ type?: 'BPMN.Variables';
1022
1032
  }
1023
1033
  /** Options for `.task()` — a display name and the variable assignments the task makes. */
1024
1034
  export interface TaskOpts extends ActivityOpts {
@@ -3100,6 +3110,11 @@ declare abstract class ScopeBuilder {
3100
3110
  * .build();
3101
3111
  * ```
3102
3112
  *
3113
+ * A script task is not built here: `'BPMN.ScriptTask'`, the type `registry get`
3114
+ * lists, is refused with `BPMN_ACTIVITY_SCRIPT_TASK_TYPE`. It would emit a script
3115
+ * task with no script whose mapping type replaces the script's extension type, so
3116
+ * nothing runs, and `check` and validate both pass it. Use {@link ScopeBuilder.scriptTask}.
3117
+ *
3103
3118
  * @param id - The element id, unique in the process and used by `sequenceFlow`.
3104
3119
  * @param type - The registry extension type, e.g. `'A2A.AgentExecution'`.
3105
3120
  * @param opts - Context values, payload, output mapping and the shared activity options.
@@ -878,6 +878,12 @@ class ScopeBuilder {
878
878
  * @returns This builder, so calls chain.
879
879
  */
880
880
  scriptTask(id, opts, body) {
881
+ // `type` is only type-restricted, and a `.bpmn.ts` loads without a type check.
882
+ const type = opts.type ?? 'BPMN.Variables';
883
+ if (type !== 'BPMN.Variables') {
884
+ throw new CompileRefusal('BPMN_SCRIPT_TASK_TYPE_INVALID', `.scriptTask('${id}'): type "${type}" replaces the script's extension type, so the script never runs and its outputs read back null. ` +
885
+ `A script task's only type is 'BPMN.Variables' (the default) — drop \`type\`.`);
886
+ }
881
887
  return this.pushActivity({
882
888
  kind: 'scriptTask',
883
889
  id,
@@ -888,7 +894,7 @@ class ScopeBuilder {
888
894
  inputs: opts.inputs ?? {},
889
895
  outputs: opts.outputs ?? {},
890
896
  outputRows: opts.outputRows,
891
- type: opts.type ?? 'BPMN.Variables',
897
+ type,
892
898
  inputSchema: opts.inputSchema,
893
899
  tags: opts.tags,
894
900
  retry: opts.retry,
@@ -1992,6 +1998,11 @@ class ScopeBuilder {
1992
1998
  * .build();
1993
1999
  * ```
1994
2000
  *
2001
+ * A script task is not built here: `'BPMN.ScriptTask'`, the type `registry get`
2002
+ * lists, is refused with `BPMN_ACTIVITY_SCRIPT_TASK_TYPE`. It would emit a script
2003
+ * task with no script whose mapping type replaces the script's extension type, so
2004
+ * nothing runs, and `check` and validate both pass it. Use {@link ScopeBuilder.scriptTask}.
2005
+ *
1995
2006
  * @param id - The element id, unique in the process and used by `sequenceFlow`.
1996
2007
  * @param type - The registry extension type, e.g. `'A2A.AgentExecution'`.
1997
2008
  * @param opts - Context values, payload, output mapping and the shared activity options.
@@ -1999,6 +2010,10 @@ class ScopeBuilder {
1999
2010
  * @returns This builder, so calls chain.
2000
2011
  */
2001
2012
  activity(id, type, opts = {}, body) {
2013
+ if (type === 'BPMN.ScriptTask') {
2014
+ throw new CompileRefusal('BPMN_ACTIVITY_SCRIPT_TASK_TYPE', `.activity('${id}', 'BPMN.ScriptTask'): this writes a script task with no script, whose mapping type replaces the script's extension type, so nothing runs and its outputs read back null. ` +
2015
+ `Use .scriptTask('${id}', { script, outputs }) instead; its mapping type is 'BPMN.Variables'.`);
2016
+ }
2002
2017
  return this.pushActivity({
2003
2018
  kind: 'typed',
2004
2019
  id,
@@ -293,6 +293,11 @@ let runLibrary;
293
293
  * header, so the omission is stated where the author reads the file.
294
294
  */
295
295
  let runUnmodelled = new Map();
296
+ /**
297
+ * The script tasks whose mapping type this run normalised to `BPMN.Variables`, by id:
298
+ * what each carried. Announced in the source header, like `runUnmodelled`.
299
+ */
300
+ let runScriptTypes = new Map();
296
301
  let runLiftPlans = new Map();
297
302
  let runLiftSkipped = [];
298
303
  let runLiftCalls = new Map();
@@ -1202,6 +1207,13 @@ function emitScriptTask(chain, el, payload, type) {
1202
1207
  // `Error`) while binding a differently-named variable, and the derived form
1203
1208
  // names it after the variable.
1204
1209
  const verbatim = outputRowsNeedSpellingOut(payload) ? emitOutputRows(payload) : undefined;
1210
+ // A script task's only mapping type is `BPMN.Variables`: any other replaces the
1211
+ // script's extension type, so the script never runs and its outputs read back null.
1212
+ // `.scriptTask()` refuses one (`BPMN_SCRIPT_TASK_TYPE_INVALID`), so the source writes
1213
+ // none and the recompile gets `BPMN.Variables` — repairing the task rather than
1214
+ // reproducing a defect `uip maestro bpmn validate` does not catch. The header says so.
1215
+ if (type !== undefined && type !== 'BPMN.Variables')
1216
+ runScriptTypes.set(el.id, `${el.id}: ${type}`);
1205
1217
  chain.add(`.scriptTask(${tsText(el.id)}, ${opts([
1206
1218
  ['name', el.name !== undefined ? tsText(el.name) : undefined],
1207
1219
  ['script', tsText(el.script ?? '')],
@@ -1210,15 +1222,8 @@ function emitScriptTask(chain, el, payload, type) {
1210
1222
  // runtime's result shape) and must survive the round trip. An absent element
1211
1223
  // is spelled `'v1'`, the meaning it has to the runtime.
1212
1224
  ['scriptVersion', scriptVersionOf(el) !== 'v3' ? tsText(scriptVersionOf(el)) : undefined],
1213
- // Only when it is neither the contract's value nor the invalid one this SDK
1214
- // used to emit. `BPMN.ScriptTask` is NORMALISED AWAY rather than preserved:
1215
- // the runtime contract has no such type, so reproducing it would propagate a
1216
- // defect `uip maestro bpmn validate` does not catch. Same call the round trip
1217
- // already makes for a bare `<uipath:input name="args">`.
1218
- [
1219
- 'type',
1220
- type !== undefined && type !== 'BPMN.Variables' && type !== 'BPMN.ScriptTask' ? tsText(type) : undefined,
1221
- ],
1225
+ // No `type`: every type but `BPMN.Variables` is NORMALISED AWAY (below), so the
1226
+ // source is one `.scriptTask()` accepts.
1222
1227
  ['inputSchema', schemaBody !== undefined && !schemaIsDefault ? jsonLiteral(schemaBody) : undefined],
1223
1228
  ['inputs', record(inputs)],
1224
1229
  ['outputs', verbatim ? undefined : record(outputs)],
@@ -2617,6 +2622,7 @@ export async function decompile(xml, options = {}) {
2617
2622
  // tasks come back as `.connector()`, whose declarations derive as a connector's.
2618
2623
  runLibrary = options.library;
2619
2624
  runUnmodelled = new Map();
2625
+ runScriptTypes = new Map();
2620
2626
  runLiftPlans = new Map();
2621
2627
  runLiftSkipped = [];
2622
2628
  runLiftCalls = new Map();
@@ -2688,13 +2694,22 @@ export async function decompile(xml, options = {}) {
2688
2694
  '\n'
2689
2695
  : '';
2690
2696
  runUnmodelled = new Map();
2697
+ const scriptTypeNote = runScriptTypes.size
2698
+ ? `// SCRIPT TASK TYPES NORMALISED. A script task's only mapping type is\n` +
2699
+ `// BPMN.Variables: any other replaces the script's extension type, so the script\n` +
2700
+ `// never runs and its outputs read back null. These tasks carried another type,\n` +
2701
+ `// and this source gives them BPMN.Variables (the .scriptTask() default):\n` +
2702
+ [...runScriptTypes.values()].map((d) => `// - ${commentText(d)}\n`).join('') +
2703
+ '\n'
2704
+ : '';
2705
+ runScriptTypes = new Map();
2691
2706
  const imports = `import { ${imported} } from ${tsText(importFrom)};\n\n`;
2692
2707
  const nameCall = process.name !== undefined ? `${indent}.name(${tsText(process.name)})` : undefined;
2693
2708
  options.onConnectorLift?.({
2694
2709
  lifted: [...runLiftPlans.keys()],
2695
2710
  verbatim: runLiftSkipped,
2696
2711
  preamble: {
2697
- prefix: `${host.note}${unmodelledNote}${imports}`,
2712
+ prefix: `${host.note}${unmodelledNote}${scriptTypeNote}${imports}`,
2698
2713
  head: `bpmn(${tsText(process.id)})`,
2699
2714
  calls: [...(nameCall !== undefined ? [nameCall] : []), ...chain.all.slice(0, preambleLines)],
2700
2715
  },
@@ -2710,7 +2725,7 @@ export async function decompile(xml, options = {}) {
2710
2725
  binding: 'processBuilder',
2711
2726
  indent,
2712
2727
  });
2713
- return `${host.note}${unmodelledNote}${imports}${body}\n`;
2728
+ return `${host.note}${unmodelledNote}${scriptTypeNote}${imports}${body}\n`;
2714
2729
  }
2715
2730
  /**
2716
2731
  * Variable ids the serializer creates on its own from a node's output rows.
package/dist/bpmn-api.md CHANGED
@@ -223,7 +223,7 @@ Extends `ActivityOpts` — its fields and methods apply here too.
223
223
  - `ScriptTaskOpts.outputs?: Record<string, string>` — `uipath:output` rows: variable id → `=`-expression.
224
224
  - `ScriptTaskOpts.outputRows?: TypedOutputRow[]` — Output rows spelled out, replacing the ones `outputs` derives — see TypedOutputRow.
225
225
  - `ScriptTaskOpts.inputSchema?: unknown` — The `uipath:inputSchema` body inside the mapping's `uipath:context` — a JSON Schema for the `args` the script receives.
226
- - `ScriptTaskOpts.type?: string` — The mapping's extension type.
226
+ - `ScriptTaskOpts.type?: 'BPMN.Variables'` — The mapping's extension type.
227
227
 
228
228
  ### `TaskOpts`
229
229
 
@@ -65,6 +65,7 @@ export declare const REFUSALS: {
65
65
  readonly BINDING_UNDECLARED: "draft";
66
66
  readonly BOUNDARY_NOT_ACTIVITY: "lint";
67
67
  readonly BOUNDARY_UNATTACHED: "lowering";
68
+ readonly BPMN_ACTIVITY_SCRIPT_TASK_TYPE: "lowering";
68
69
  readonly BPMN_BINDING_READ_BEFORE_DECLARED: "lowering";
69
70
  readonly BPMN_BINDING_RESOURCE_KEY_CONFLICT: "lowering";
70
71
  readonly BPMN_BOUNDARY_NO_EVENT: "lint";
@@ -123,6 +124,7 @@ export declare const REFUSALS: {
123
124
  readonly BPMN_PATH_NOT_CONTINUED: "lowering";
124
125
  readonly BPMN_PLAIN_TASK_ELEMENT_INVALID: "lowering";
125
126
  readonly BPMN_RACE_ARM_NOT_WAIT: "lowering";
127
+ readonly BPMN_SCRIPT_TASK_TYPE_INVALID: "lowering";
126
128
  readonly BPMN_SEQUENCE_NO_INCOMING: "lowering";
127
129
  readonly BPMN_SOURCE_NOT_FOUND: "lowering";
128
130
  readonly BPMN_START_ALREADY_SYNTHESIZED: "lowering";
@@ -114,6 +114,7 @@ export const REFUSALS = {
114
114
  BINDING_UNDECLARED: 'draft',
115
115
  BOUNDARY_NOT_ACTIVITY: 'lint',
116
116
  BOUNDARY_UNATTACHED: 'lowering',
117
+ BPMN_ACTIVITY_SCRIPT_TASK_TYPE: 'lowering',
117
118
  BPMN_BINDING_READ_BEFORE_DECLARED: 'lowering',
118
119
  BPMN_BINDING_RESOURCE_KEY_CONFLICT: 'lowering',
119
120
  BPMN_BOUNDARY_NO_EVENT: 'lint',
@@ -172,6 +173,7 @@ export const REFUSALS = {
172
173
  BPMN_PATH_NOT_CONTINUED: 'lowering',
173
174
  BPMN_PLAIN_TASK_ELEMENT_INVALID: 'lowering',
174
175
  BPMN_RACE_ARM_NOT_WAIT: 'lowering',
176
+ BPMN_SCRIPT_TASK_TYPE_INVALID: 'lowering',
175
177
  BPMN_SEQUENCE_NO_INCOMING: 'lowering',
176
178
  BPMN_SOURCE_NOT_FOUND: 'lowering',
177
179
  BPMN_START_ALREADY_SYNTHESIZED: 'lowering',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.93.7",
3
+ "version": "6.93.8",
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",
@@ -111,5 +111,5 @@
111
111
  "@types/node": "^22.7.0",
112
112
  "esbuild": "^0.28.1"
113
113
  },
114
- "gitref": "9049e7872b34bee80a23919e5a9b3bcf9000fca2"
114
+ "gitref": "f6fd09112d497419d811bc3148995b02ceb651e0"
115
115
  }