@uipath/maestro-builder-sdk 6.86.8 → 6.86.10

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.
@@ -2098,6 +2098,16 @@ function emptyLists(owner, fields) {
2098
2098
  });
2099
2099
  return empty.length ? { emptyLists: empty } : {};
2100
2100
  }
2101
+ /**
2102
+ * `{ noTasks }` when a stage with no task spells it as no `tasks` field
2103
+ * (`'absent'`) or as `tasks: []` (`'empty'`), not as the one empty task set
2104
+ * the serializer writes (`[[]]`); see `noTasks` in preserve.ts.
2105
+ */
2106
+ function noTasksSpelling(data) {
2107
+ if (data.tasks === undefined)
2108
+ return { noTasks: 'absent' };
2109
+ return Array.isArray(data.tasks) && data.tasks.length === 0 ? { noTasks: 'empty' } : {};
2110
+ }
2101
2111
  /**
2102
2112
  * A structured root variable the Designer saved with its schema in `body`
2103
2113
  * only. Compile writes a structured variable's schema twice, `body` and the
@@ -2155,6 +2165,7 @@ function identityPreservation(plan) {
2155
2165
  exitConditions: (stage.data?.exitConditions ?? []).map(conditionIdentity),
2156
2166
  slaRules: (stage.data?.slaRules ?? []).map(slaIdentity),
2157
2167
  ...emptyLists(stage.data ?? {}, STAGE_EMPTY_LISTS),
2168
+ ...noTasksSpelling(stage.data ?? {}),
2158
2169
  };
2159
2170
  }),
2160
2171
  caseExitRules: (plan.metadata?.caseExitRules ?? []).map(conditionIdentity),
@@ -212,6 +212,15 @@ interface StageIdentity {
212
212
  slaRules?: SlaIdentity[];
213
213
  /** Fields of `STAGE_EMPTY_LISTS` the read stage's `data` spelled `[]`. */
214
214
  emptyLists?: string[];
215
+ /**
216
+ * How the read stage spelled "no tasks", when not as one empty task set:
217
+ * `'absent'` (no `tasks` field) or `'empty'` (`tasks: []`). The builder holds
218
+ * a stage with no task as one empty set and the serializer writes
219
+ * `tasks: [[]]`; the Designer writes all three. The platform reads them
220
+ * alike (`tasks ?? []`, flattened), so this is the Designer's spelling only.
221
+ * Compile writes it back while every task set of the stage is still empty.
222
+ */
223
+ noTasks?: 'absent' | 'empty';
215
224
  }
216
225
  /**
217
226
  * The lists the serializer omits when empty, which the Designer writes both as
@@ -1202,6 +1202,21 @@ function restoreEmptyLists(owner, wanted, fields) {
1202
1202
  if (typeof field === 'string' && fields.includes(field) && owner[field] === undefined)
1203
1203
  owner[field] = [];
1204
1204
  }
1205
+ /**
1206
+ * Write a stage's read "no tasks" spelling back (`noTasks` in preserve.ts):
1207
+ * no `tasks` field, or `tasks: []`, in place of the serializer's `[[]]`. A
1208
+ * stage an edit gave a task is left alone.
1209
+ */
1210
+ function restoreNoTasks(data, spelling) {
1211
+ if (!data || (spelling !== 'absent' && spelling !== 'empty'))
1212
+ return;
1213
+ if (!Array.isArray(data.tasks) || !data.tasks.every((set) => Array.isArray(set) && set.length === 0))
1214
+ return;
1215
+ if (spelling === 'absent')
1216
+ delete data.tasks;
1217
+ else
1218
+ data.tasks = [];
1219
+ }
1205
1220
  function applyPreservedIdentities(result, preservation) {
1206
1221
  const identities = preservation.identities;
1207
1222
  if (!identities)
@@ -1440,6 +1455,7 @@ function applyPreservedIdentities(result, preservation) {
1440
1455
  takeConditions(stage?.data?.exitConditions, stageIdentity.exitConditions);
1441
1456
  takeSlas(stage?.data?.slaRules, stageIdentity.slaRules);
1442
1457
  restoreEmptyLists(stage?.data, stageIdentity.emptyLists, STAGE_EMPTY_LISTS);
1458
+ restoreNoTasks(stage?.data, stageIdentity.noTasks);
1443
1459
  (stageIdentity.tasks ?? []).forEach((lane) => lane.forEach((taskIdentity) => {
1444
1460
  const task = stageTask(stage, taskIdentity.name);
1445
1461
  // Rows' carried fields describe the resource the task named when it was
@@ -3322,9 +3338,11 @@ function emitRule(r, seed, ownerId, ids, resolver, site) {
3322
3338
  throw new CompileRefusal('RULE_STAGES_SINGULAR', `rule "${r.rule}" selects ${sids.length} stages, but this format writes one selectedStageId.`);
3323
3339
  out[CASE_FORMAT_PROFILE.selectedStageField] = CASE_FORMAT_PROFILE.selectedStageCardinality === 'singular' ? sids[0] : sids;
3324
3340
  }
3325
- if (r.rule === 'selected-tasks-completed') {
3326
- const names = r.tasks ?? [];
3327
- out.selectedTasksIds = names.map((n) => {
3341
+ // No `tasks` writes no `selectedTasksIds`, as Studio Web saves a rule gated
3342
+ // by its expression alone; the platform reads an absent list as an empty one
3343
+ // (its converter takes `selectedTasksIds ?? []`). `tasks: []` writes `[]`.
3344
+ if (r.rule === 'selected-tasks-completed' && r.tasks !== undefined) {
3345
+ out.selectedTasksIds = r.tasks.map((n) => {
3328
3346
  const tid = resolver.taskIdByKey.get(n);
3329
3347
  if (!tid)
3330
3348
  throw new CompileRefusal('UNKNOWN_TASK_REF', `rule "selected-tasks-completed" references unknown task "${n}".`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.86.8",
3
+ "version": "6.86.10",
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",
@@ -103,5 +103,5 @@
103
103
  "@types/node": "^22.7.0",
104
104
  "esbuild": "^0.28.1"
105
105
  },
106
- "gitref": "a0113ad6c8144e78d2bb8b9b33cb3c0e814fc51b"
106
+ "gitref": "9a0411e55fee0c624976b81d7f3f90c7c3c16a33"
107
107
  }