@uipath/maestro-builder-sdk 6.120.25 → 6.120.27

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.
@@ -2870,6 +2870,10 @@ rehome,
2870
2870
  lifted = new Set()) {
2871
2871
  // var id -> the declaration `implicitNodeVars` would derive for it
2872
2872
  const candidates = new Map();
2873
+ // Variables more than one candidate row writes. Never derived: which writer
2874
+ // `implicitNodeVars` would pick depends on the source's node order, so the
2875
+ // declaration stays an explicit `.var()` and keeps its own `elementId`.
2876
+ const writtenTwice = new Set();
2873
2877
  const walk = (container) => {
2874
2878
  for (const el of container.flowElements ?? []) {
2875
2879
  const payload = payloadOf(el);
@@ -2905,6 +2909,8 @@ lifted = new Set()) {
2905
2909
  for (const row of payload.output ?? []) {
2906
2910
  if (!row.var)
2907
2911
  continue;
2912
+ if (candidates.has(row.var))
2913
+ writtenTwice.add(row.var);
2908
2914
  // A lifted connector's two variables are claimed the way `.connector()` claims
2909
2915
  // them — `json`, named after the id, no schema — so a file's own `jsonSchema`
2910
2916
  // declaration with a body stays an explicit `.var()` rather than being folded
@@ -2930,8 +2936,8 @@ lifted = new Set()) {
2930
2936
  : { owner: el.id, ...rowDeclaration({ name: row.name, type: row.type, schema: row.body }) });
2931
2937
  }
2932
2938
  }
2933
- if (el.$type === 'bpmn:SubProcess')
2934
- walk(el);
2939
+ // No recursion into a sub-process: `implicitNodeVars` derives a nested node's
2940
+ // declaration into its sub-process, so no process-level declaration is derived from it.
2935
2941
  }
2936
2942
  };
2937
2943
  walk(process);
@@ -2947,7 +2953,7 @@ lifted = new Set()) {
2947
2953
  const folds = new Map();
2948
2954
  for (const v of varsExt?.inputOutput ?? []) {
2949
2955
  const c = candidates.get(v.id);
2950
- if (!c)
2956
+ if (!c || writtenTwice.has(v.id))
2951
2957
  continue;
2952
2958
  // The derived declaration takes the ROW's name when it has one, the id otherwise.
2953
2959
  if ((v.name ?? v.id) !== (c.name ?? v.id))
@@ -747,6 +747,30 @@ export interface TaskRef {
747
747
  name: string;
748
748
  folderPath: string;
749
749
  }
750
+ /**
751
+ * The entry point a process task runs, for a published package with several
752
+ * (a coded package whose functions are each an entry point). Studio Web saves
753
+ * the one picked as `data.entryPointName`, `data.entryPointPath` and
754
+ * `data.entryPointUniqueId`; a task with none runs the package's default
755
+ * entry point.
756
+ *
757
+ * @example
758
+ * ```ts
759
+ * casePlan('billing').stage('Post', (s) => s
760
+ * .task('Post invoice', (t) => t.process('Billing helpers', {
761
+ * folder: 'Shared',
762
+ * entryPoint: { name: 'post_invoice', path: 'content/functions/post_invoice.ts', uniqueId: '00000000-0000-4000-8000-000000000001' },
763
+ * })))
764
+ * ```
765
+ */
766
+ export interface ProcessEntryPoint {
767
+ /** The entry point's name, e.g. `post_invoice` (`data.entryPointName`). */
768
+ name: string;
769
+ /** The entry point's file in the package, e.g. `content/functions/post_invoice.ts` (`data.entryPointPath`). */
770
+ path: string;
771
+ /** The entry point's id in the package (`data.entryPointUniqueId`). */
772
+ uniqueId: string;
773
+ }
750
774
  /**
751
775
  * Options for {@link TaskBuilder.businessRule}.
752
776
  */
@@ -995,6 +1019,8 @@ export interface BuiltTask {
995
1019
  kind: TaskKind;
996
1020
  /** The published resource the task binds: a reference task's process, agent, … or an action task's Action App. */
997
1021
  ref?: TaskRef;
1022
+ /** process task: the package entry point it runs, when it names one. */
1023
+ entryPoint?: ProcessEntryPoint;
998
1024
  /** business-rule task: the rule's decision-keyed result schema, when known. */
999
1025
  businessRule?: BusinessRuleSpecData;
1000
1026
  action?: ActionSpecData;
@@ -1264,6 +1290,7 @@ declare class TaskBuilder {
1264
1290
  private readonly _name;
1265
1291
  private _kind?;
1266
1292
  private _ref?;
1293
+ private _entryPoint?;
1267
1294
  private _businessRule?;
1268
1295
  private _action?;
1269
1296
  private _connector?;
@@ -1289,11 +1316,12 @@ declare class TaskBuilder {
1289
1316
  * Reference a published Maestro process.
1290
1317
  *
1291
1318
  * @param name - The published process's name.
1292
- * @param opts - `folder` — the Orchestrator folder it lives in, or `'solution_folder'` (the default when omitted) for one built in this solution. Compile binds the task through a name/folderPath pair of root bindings keyed `<folder>.<name>`.
1319
+ * @param opts - `folder` — the Orchestrator folder it lives in, or `'solution_folder'` (the default when omitted) for one built in this solution. Compile binds the task through a name/folderPath pair of root bindings keyed `<folder>.<name>`. `entryPoint` — the package entry point the task runs ({@link ProcessEntryPoint}), for a package with several; omit it for the default one.
1293
1320
  * @returns This builder, so calls chain.
1294
1321
  */
1295
1322
  process(name: string, opts?: {
1296
1323
  folder?: string;
1324
+ entryPoint?: ProcessEntryPoint;
1297
1325
  }): this;
1298
1326
  /**
1299
1327
  * Preserve an explicitly unresolved task as a typed skeleton whose serialized
@@ -262,6 +262,7 @@ class TaskBuilder {
262
262
  _name;
263
263
  _kind;
264
264
  _ref;
265
+ _entryPoint;
265
266
  _businessRule;
266
267
  _action;
267
268
  _connector;
@@ -297,11 +298,17 @@ class TaskBuilder {
297
298
  * Reference a published Maestro process.
298
299
  *
299
300
  * @param name - The published process's name.
300
- * @param opts - `folder` — the Orchestrator folder it lives in, or `'solution_folder'` (the default when omitted) for one built in this solution. Compile binds the task through a name/folderPath pair of root bindings keyed `<folder>.<name>`.
301
+ * @param opts - `folder` — the Orchestrator folder it lives in, or `'solution_folder'` (the default when omitted) for one built in this solution. Compile binds the task through a name/folderPath pair of root bindings keyed `<folder>.<name>`. `entryPoint` — the package entry point the task runs ({@link ProcessEntryPoint}), for a package with several; omit it for the default one.
301
302
  * @returns This builder, so calls chain.
302
303
  */
303
304
  process(name, opts) {
304
- return this.reference('process', name, opts);
305
+ if (opts?.entryPoint) {
306
+ const bad = ['name', 'path', 'uniqueId'].find((field) => typeof opts.entryPoint[field] !== 'string' || !opts.entryPoint[field]);
307
+ if (bad)
308
+ throw new CompileRefusal('TASK_ENTRY_POINT_INCOMPLETE', `task "${this._name}": entryPoint.${bad} must be a non-empty string; an entry point names its name, path and uniqueId together.`);
309
+ this._entryPoint = { name: opts.entryPoint.name, path: opts.entryPoint.path, uniqueId: opts.entryPoint.uniqueId };
310
+ }
311
+ return this.reference('process', name, { folder: opts?.folder });
305
312
  }
306
313
  /**
307
314
  * Preserve an explicitly unresolved task as a typed skeleton whose serialized
@@ -923,6 +930,7 @@ class TaskBuilder {
923
930
  name: this._name,
924
931
  kind: this._kind,
925
932
  ref: this._ref,
933
+ ...(this._entryPoint ? { entryPoint: this._entryPoint } : {}),
926
934
  businessRule: this._businessRule,
927
935
  action: this._action,
928
936
  connector: this._connector,
@@ -1263,6 +1263,26 @@ function externalCall(task, refs, library) {
1263
1263
  const method = kind === 'external-agent' ? 'externalAgent' : 'externalWorkflow';
1264
1264
  return `.${method}(${descriptor}, ${options})`;
1265
1265
  }
1266
+ /** The `data` fields every reference task (`TASK_KIND_METHOD`) lifts: its resource pair and io rows. */
1267
+ const REFERENCE_DATA_KEYS = new Set(['name', 'folderPath', 'inputs', 'outputs']);
1268
+ /** A process task's saved entry point (`ProcessEntryPoint`), which `.process(..., { entryPoint })` writes. */
1269
+ const ENTRY_POINT_DATA_KEYS = new Set(['entryPointName', 'entryPointPath', 'entryPointUniqueId']);
1270
+ /**
1271
+ * The `entryPoint` option a process task's saved `data.entryPointName`,
1272
+ * `entryPointPath` and `entryPointUniqueId` lift to, or `undefined` when it
1273
+ * names none. Studio Web saves the three together; a task with only some of
1274
+ * them is refused by name, since the source names an entry point whole.
1275
+ */
1276
+ function entryPointOption(data, owner) {
1277
+ const saved = { name: data.entryPointName, path: data.entryPointPath, uniqueId: data.entryPointUniqueId };
1278
+ if (Object.values(saved).every((value) => value === undefined))
1279
+ return undefined;
1280
+ const bad = Object.entries(saved).find(([, value]) => typeof value !== 'string' || !value);
1281
+ if (bad)
1282
+ throw new Error(`${owner} names an entry point without a non-empty data.entryPoint${bad[0][0].toUpperCase()}${bad[0].slice(1)}; `
1283
+ + `Studio Web saves entryPointName, entryPointPath and entryPointUniqueId together. Re-pick the entry point in Studio Web, then decompile again.`);
1284
+ return tsLiteral(saved);
1285
+ }
1266
1286
  function emitTaskKind(task, refs, library) {
1267
1287
  const kind = task.type;
1268
1288
  const data = task.data ?? {};
@@ -1274,7 +1294,15 @@ function emitTaskKind(task, refs, library) {
1274
1294
  return `.unresolved(${tsLiteral(placeholder)})`;
1275
1295
  const method = ownEntry(TASK_KIND_METHOD, kind);
1276
1296
  if (method) {
1297
+ // Every `data` field a reference task can carry is lifted or refused by
1298
+ // name: one the source has no place for would be dropped on the round trip
1299
+ // unseen, and the task would run something else.
1300
+ const unknown = Object.keys(data).find((field) => !REFERENCE_DATA_KEYS.has(field) && !(kind === 'process' && ENTRY_POINT_DATA_KEYS.has(field)));
1301
+ if (unknown)
1302
+ throw new Error(`${kind} task "${task.displayName ?? task.id ?? '?'}" has unsupported data field "${unknown}".`);
1277
1303
  if (kind !== 'flow-process' && data.name === undefined && data.folderPath === undefined) {
1304
+ if (Object.keys(data).some((field) => ENTRY_POINT_DATA_KEYS.has(field)))
1305
+ throw new Error(`unresolved ${kind} task "${task.displayName ?? task.id ?? '?'}" cannot name an entry point (data.entryPointName / entryPointPath / entryPointUniqueId) without its process.`);
1278
1306
  if ((Array.isArray(data.inputs) && data.inputs.length) || (Array.isArray(data.outputs) && data.outputs.length))
1279
1307
  throw new Error(`unresolved ${kind} task "${task.displayName ?? task.id ?? '?'}" cannot carry input or output bindings.`);
1280
1308
  return `.unresolved(${tsLiteral(kind)})`;
@@ -1284,8 +1312,11 @@ function emitTaskKind(task, refs, library) {
1284
1312
  const folderPath = bindingFolder(data.folderPath, refs, owner, name);
1285
1313
  // No folder already means the case's own solution folder
1286
1314
  // (resource-identity.ts), so an in-solution resource decompiles to none.
1287
- const folder = folderPath && folderPath !== SOLUTION_FOLDER ? `, ${opts([['folder', tsLiteral(folderPath)]])}` : '';
1288
- return `.${method}(${tsLiteral(name ?? '')}${folder})`;
1315
+ const options = opts([
1316
+ ['folder', folderPath && folderPath !== SOLUTION_FOLDER ? tsLiteral(folderPath) : undefined],
1317
+ ['entryPoint', kind === 'process' ? entryPointOption(data, owner) : undefined],
1318
+ ]);
1319
+ return `.${method}(${tsLiteral(name ?? '')}${options ? `, ${options}` : ''})`;
1289
1320
  }
1290
1321
  if (isAuthorableBusinessRule(task))
1291
1322
  return businessRuleCall(task, refs);
@@ -2755,6 +2755,12 @@ function taskData(task, resolver, taskId, stageId, ids) {
2755
2755
  // LITERAL_BINDING), and deploy re-targets a resource only through its
2756
2756
  // binding (#1240).
2757
2757
  const data = { ...referenceBindings(task.kind, task.ref, resolver, ids, task.name) };
2758
+ // The package entry point the task runs (a process with several), as Studio Web saves it.
2759
+ if (task.kind === 'process' && task.entryPoint) {
2760
+ data.entryPointPath = task.entryPoint.path;
2761
+ data.entryPointUniqueId = task.entryPoint.uniqueId;
2762
+ data.entryPointName = task.entryPoint.name;
2763
+ }
2758
2764
  const elementId = `${stageId}-${taskId}`;
2759
2765
  if (task.inputs?.length)
2760
2766
  data.inputs = task.inputs.map((inp, i) => emitTaskInput(inp, elementId, ids, `${elementId}:in:${i}:${inp.name}`));
@@ -798,6 +798,7 @@ export declare const REFUSALS: {
798
798
  readonly SWITCH_HAS_NO_OUTPUT: "lint";
799
799
  readonly SWITCH_NO_CASES: "lint";
800
800
  readonly SWITCH_ON_UNUSED: "lint";
801
+ readonly TASK_ENTRY_POINT_INCOMPLETE: "lowering";
801
802
  readonly TASK_INPUTS_UNSUPPORTED: "lowering";
802
803
  readonly TASK_IO_TYPE: "lint";
803
804
  readonly TASK_IO_UNRESOLVED_REFERENCE: "lowering";
@@ -874,6 +874,7 @@ export const REFUSALS = {
874
874
  SWITCH_HAS_NO_OUTPUT: 'lint',
875
875
  SWITCH_NO_CASES: 'lint',
876
876
  SWITCH_ON_UNUSED: 'lint',
877
+ TASK_ENTRY_POINT_INCOMPLETE: 'lowering',
877
878
  TASK_INPUTS_UNSUPPORTED: 'lowering',
878
879
  TASK_IO_TYPE: 'lint',
879
880
  TASK_IO_UNRESOLVED_REFERENCE: 'lowering',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.120.25",
3
+ "version": "6.120.27",
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",
@@ -124,5 +124,5 @@
124
124
  "@types/node": "^22.7.0",
125
125
  "esbuild": "^0.28.1"
126
126
  },
127
- "gitref": "24ba858ca7c1b24d2f464a901824441668983a52"
127
+ "gitref": "e2286e821c50dabec57ad7c8d0ec9b70815af67b"
128
128
  }