@uipath/maestro-builder-sdk 6.91.0 → 6.91.2

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.
@@ -7,9 +7,11 @@
7
7
  * `references/implementation.md` Check 13, `references/case-schema.md`,
8
8
  * `references/sla-response-shapes.md` §5).
9
9
  *
10
- * All five are `lint`: compile still writes the plan as authored, so a
10
+ * All six are `lint`: compile still writes the plan as authored, so a
11
11
  * decompiled source keeps the condition and `check` reports it again. Each is a
12
- * warning wherever `validate --strict` accepts the plan as a working design.
12
+ * warning wherever `validate --strict` accepts the plan as a working design,
13
+ * and an error where the platform cannot run it as written
14
+ * (RUNS_SEQUENTIALLY_MIXED: the converter discards part of the entry).
13
15
  *
14
16
  * Not ported, on evidence: the skill's "a breach rule must not carry
15
17
  * `escalationId`". The converter derives a `sla-status-change` rule's status
@@ -237,6 +237,90 @@ function anyEscalationWithoutAtRisk(built, decls, diags) {
237
237
  });
238
238
  }
239
239
  }
240
+ /**
241
+ * A task entry that mixes `runs-sequentially` with any other rule, in any
242
+ * group or condition. `validate` accepts it; the converter
243
+ * (`CaseManagementGenerateTaskEntryConditionsJSON.ts`, vendored in
244
+ * `local-engine/vendor/case-to-bpmn.mjs`) does not run it as written:
245
+ *
246
+ * - a task is sequential only when every rule of every entry condition is
247
+ * `runs-sequentially` (`taskOnlyRunsSequentiallyInStage`);
248
+ * - for any other task it drops each condition whose first rule is
249
+ * `runs-sequentially`, and writes nothing for that rule elsewhere.
250
+ *
251
+ * `[[rs, stc]]` and `[[rs], [stc]]` give the task no entry condition, so it
252
+ * never starts; `[[stc, rs]]` or two conditions lose the `runs-sequentially`.
253
+ *
254
+ * Sequential sets are built only from sequential tasks, so "the lane after X"
255
+ * waits for X only when X is sequential itself; otherwise the task starts at
256
+ * stage entry. The suggestion offers the lane only then.
257
+ *
258
+ * Stage and case conditions are not checked: there the converter ignores
259
+ * `runs-sequentially` and keeps the other rules.
260
+ */
261
+ function runsSequentiallyMixed(built, diags) {
262
+ const sequential = (task) => {
263
+ const rules = rulesOf(task.entry);
264
+ return rules.length > 0 && rules.every((r) => r.rule === 'runs-sequentially');
265
+ };
266
+ for (const stage of built.stages) {
267
+ // Every key a `selected-tasks-completed` rule names a task of this stage by (`taskIdByKey`).
268
+ const own = new Map();
269
+ stage.lanes.forEach((lane, index) => {
270
+ for (const task of lane) {
271
+ own.set(task.name, { lane: index, task });
272
+ own.set(`${stage.label}/${task.name}`, { lane: index, task });
273
+ }
274
+ });
275
+ for (const lane of stage.lanes)
276
+ for (const task of lane) {
277
+ const rules = rulesOf(task.entry);
278
+ if (!rules.some((r) => r.rule === 'runs-sequentially') || rules.every((r) => r.rule === 'runs-sequentially'))
279
+ continue;
280
+ const others = [...new Set(rules.filter((r) => r.rule !== 'runs-sequentially').map((r) => r.rule))];
281
+ const dropped = task.entry.filter((c) => c.rules[0]?.[0]?.rule === 'runs-sequentially');
282
+ const effect = dropped.length > 0
283
+ ? `It drops ${dropped.length === task.entry.length ? 'every entry condition of this task, so the task never starts' : 'each entry condition whose first rule is `runs-sequentially`, with the other rules in it'}`
284
+ : 'It ignores the `runs-sequentially` rule, so the task does not wait for the set before it';
285
+ const predecessors = [...new Set(rules.filter((r) => r.rule === 'selected-tasks-completed').flatMap((r) => r.tasks ?? []))];
286
+ const resolved = predecessors.map((key) => own.get(key));
287
+ const laneOk = others.length === 1 && others[0] === 'selected-tasks-completed' && predecessors.length > 0
288
+ && resolved.every((p) => p !== undefined && sequential(p.task));
289
+ const keep = others.map((r) => (r === 'selected-tasks-completed' && predecessors.length > 0
290
+ ? `rule('selected-tasks-completed', { tasks: [${predecessors.map((n) => `'${n}'`).join(', ')}] })`
291
+ : `rule('${r}'${r === 'adhoc' || r === 'current-stage-entered' ? '' : ', { … }'})`));
292
+ const keepCall = `.entryWhen(${keep.length === 1 ? keep[0] : `[${keep.join(', ')}]`})`;
293
+ const parts = [`Remove "runs-sequentially" and keep the other rule${others.length > 1 ? 's' : ''}: ${keepCall}.`];
294
+ if (laneOk) {
295
+ const next = Math.max(...resolved.map((p) => p.lane)) + 1;
296
+ parts.push(`Or, since ${predecessors.map((n) => `"${n}"`).join(', ')} ${predecessors.length > 1 ? 'run' : 'runs'} sequentially, `
297
+ + `keep "runs-sequentially" alone and put the task in the next lane: .entryWhen(rule('runs-sequentially')) with { lane: ${next} }.`);
298
+ }
299
+ else {
300
+ const notSequential = predecessors.filter((_, i) => resolved[i] !== undefined && !sequential(resolved[i].task));
301
+ const why = resolved.some((p) => p === undefined)
302
+ ? 'a task it names is in another stage'
303
+ : notSequential.length > 0
304
+ ? `${notSequential.map((n) => `"${n}"`).join(', ')} ${notSequential.length > 1 ? 'are' : 'is'} not`
305
+ : undefined;
306
+ if (why)
307
+ parts.push(`Do not use "runs-sequentially" in a later lane instead: it waits only for tasks that are themselves "runs-sequentially" in this stage, `
308
+ + `and ${why}, so the task would start at stage entry.`);
309
+ else if (predecessors.length === 0 && !others.includes('adhoc'))
310
+ parts.push(`To start it after a task, add rule('selected-tasks-completed', { tasks: ['<task>'] }) to the same AND-group.`);
311
+ }
312
+ diags.push({
313
+ level: 'error',
314
+ code: 'RUNS_SEQUENTIALLY_MIXED',
315
+ message: `Task "${task.name}" mixes rule "runs-sequentially" with ${others.map((r) => `"${r}"`).join(', ')} in its entry. `
316
+ + 'The platform runs a task sequentially only when every rule of every entry condition is "runs-sequentially". '
317
+ + `${effect}. \`uip maestro case validate\` accepts this; the task just does not run as written.`,
318
+ suggestion: parts.join(' '),
319
+ where: `task "${task.name}" entry`,
320
+ });
321
+ }
322
+ }
323
+ }
240
324
  /** The rules above, in the order `check` reports them. */
241
325
  export function checkRuleSemantics(built, diags) {
242
326
  adhocSelections(built, diags);
@@ -245,4 +329,5 @@ export function checkRuleSemantics(built, diags) {
245
329
  slaReentry(built, decls, diags);
246
330
  slaNameDuplicates(built, decls, diags);
247
331
  anyEscalationWithoutAtRisk(built, decls, diags);
332
+ runsSequentiallyMixed(built, diags);
248
333
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { Library } from '../core/library.js';
7
7
  import { type ConnectorTaskIdentity } from './connector-saved-config.js';
8
- import { type PreservedFilterLeafId } from './preserve.js';
8
+ import { type PreservedFilterLeafId, type PreservedTriggerDisplayFields } from './preserve.js';
9
9
  import { type PreservedResourceWire } from './resource-wire.js';
10
10
  interface IoRow {
11
11
  id?: string;
@@ -286,6 +286,7 @@ type Preservation = {
286
286
  index: number;
287
287
  fields: string[];
288
288
  }>;
289
+ triggerDisplayFields?: PreservedTriggerDisplayFields[];
289
290
  manualTriggerServiceTypeNone?: number[];
290
291
  omitTriggerLabels?: number[];
291
292
  omitStagePositions?: string[];
@@ -17,7 +17,7 @@ import { preserveSchemaVersion } from '../schema-version.js';
17
17
  import { ownEntry } from '../core/own-entry.js';
18
18
  import { EVENT_FILTER_OPERATORS, eventFilterExpressionOf, eventFilterFromTreeLeaf, eventFilterProblem, EXPRESSION_FILTER_OPERATORS, filterExprFromLeaf } from '../core/event-filters.js';
19
19
  import { CASE_FILTER_SPELLING, caseSubscriptionBody, caseSubscriptionOwners } from './subscription.js';
20
- import { CASE_NODE_CANVAS_FIELDS, CASE_NODE_LAYOUT_FIELDS, isTypedInputField, isUnrestorableSlotId, PRESERVED_STAGE_DATA_KEYS, PRESERVED_TRIGGER_DATA_KEYS, RESOURCE_INPUT_WRITTEN, RESOURCE_OUTPUT_WRITTEN, CASE_EMPTY_LISTS, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, PRESERVED_ACTION_DATA_KEYS, } from './preserve.js';
20
+ import { CASE_NODE_CANVAS_FIELDS, CASE_NODE_LAYOUT_FIELDS, isTypedInputField, isUnrestorableSlotId, PRESERVED_STAGE_DATA_KEYS, PRESERVED_TRIGGER_DATA_KEYS, RESOURCE_INPUT_WRITTEN, RESOURCE_OUTPUT_WRITTEN, CASE_EMPTY_LISTS, STAGE_EMPTY_LISTS, TASK_EMPTY_LISTS, taskFingerprint, PRESERVED_ACTION_DATA_KEYS, TYPED_TRIGGER_DISPLAY_KEYS, } from './preserve.js';
21
21
  import { stableId } from '../core/stable-id.js';
22
22
  import { ACTION_CONTEXT_COPIES, ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
23
23
  import { resourceIdentity, SOLUTION_FOLDER } from './resource-identity.js';
@@ -2596,6 +2596,20 @@ export function collectPreservation(plan) {
2596
2596
  throw new Error(`trigger ${index + 1} has unsupported data field "${field}", which is not allowed in the collision-refusing preservation channel.`);
2597
2597
  if (triggerDataFields.some((fields) => Object.keys(fields).length))
2598
2598
  preservation.triggerDataFields = triggerDataFields;
2599
+ // The Designer's `display` fields beside the label (an event trigger's
2600
+ // connector `icon`): the source has no place for them.
2601
+ const triggerDisplayFields = (plan.nodes ?? []).filter(isTrigger).flatMap((trigger) => {
2602
+ const display = trigger.data?.display;
2603
+ if (!display || typeof display !== 'object' || Array.isArray(display) || typeof trigger.id !== 'string')
2604
+ return [];
2605
+ const fields = Object.fromEntries(Object.entries(display).filter(([name]) => !TYPED_TRIGGER_DISPLAY_KEYS.has(name)));
2606
+ if (!Object.keys(fields).length)
2607
+ return [];
2608
+ const connector = contextMap(triggerData(trigger).bag).get('connectorKey')?.value;
2609
+ return [{ trigger: trigger.id, ...(typeof connector === 'string' ? { connector } : {}), fields }];
2610
+ });
2611
+ if (triggerDisplayFields.length)
2612
+ preservation.triggerDisplayFields = triggerDisplayFields;
2599
2613
  // `emitTrigger` writes a root `parentElement` on every trigger after the
2600
2614
  // first; a source trigger without one keeps not having it.
2601
2615
  const omitTriggerDataFields = (plan.nodes ?? []).filter(isTrigger).flatMap((trigger, index) => index > 0 && !Object.prototype.hasOwnProperty.call(trigger.data ?? {}, 'parentElement')
@@ -384,6 +384,15 @@ export interface CaseJsonPreservation {
384
384
  subscriptionFilters?: PreservedSubscriptionFilter[];
385
385
  /** Platform-owned trigger data fields aligned by trigger order. */
386
386
  triggerDataFields?: Array<Record<string, unknown>>;
387
+ /**
388
+ * A trigger's `data.display` fields other than `label` and `description`
389
+ * (which the source authors), keyed by trigger node id: Studio Web saves an
390
+ * event trigger's connector `icon` there. No converter reads it. `connector`
391
+ * is the trigger's `connectorKey` when it had one: compile writes the
392
+ * fields back only while the trigger still calls that connector, since the
393
+ * icon is that connector's.
394
+ */
395
+ triggerDisplayFields?: PreservedTriggerDisplayFields[];
387
396
  /**
388
397
  * Trigger data fields the serializer writes (a later trigger's root
389
398
  * `parentElement`) that the source trigger at `index` (in trigger order) did
@@ -518,6 +527,17 @@ export interface PreservedSubscriptionFilter {
518
527
  /** Each tree leaf's `uiId`, in tree order, with the condition it holds. */
519
528
  leaves?: PreservedFilterLeafId[];
520
529
  }
530
+ /** One trigger's Designer `display` fields ({@link CaseJsonPreservation.triggerDisplayFields}). */
531
+ export interface PreservedTriggerDisplayFields {
532
+ /** The trigger's node id. */
533
+ trigger: string;
534
+ /** The trigger's `connectorKey`, when its context named one. */
535
+ connector?: string;
536
+ /** The saved fields, verbatim. Never `label` or `description`. */
537
+ fields: Record<string, unknown>;
538
+ }
539
+ /** `data.display` fields the source authors, so the channel never carries them. */
540
+ export declare const TYPED_TRIGGER_DISPLAY_KEYS: ReadonlySet<string>;
521
541
  /** Attach decompiler-owned, non-authoring wire data to a built case. */
522
542
  export declare function preserveCaseJson(built: BuiltCase, payload: CaseJsonPreservation): BuiltCase;
523
543
  /** @internal Read the preservation payload attached by `preserveCaseJson`. */
@@ -118,6 +118,8 @@ export function filterLeafKey(read) {
118
118
  export function preservedLeafKey(leaf) {
119
119
  return JSON.stringify([leaf.field, leaf.operator, leaf.value]);
120
120
  }
121
+ /** `data.display` fields the source authors, so the channel never carries them. */
122
+ export const TYPED_TRIGGER_DISPLAY_KEYS = new Set(['label', 'description']);
121
123
  const preserved = new WeakMap();
122
124
  /** Attach decompiler-owned, non-authoring wire data to a built case. */
123
125
  export function preserveCaseJson(built, payload) {
@@ -457,6 +459,19 @@ export function caseJsonPreservationErrors(payload) {
457
459
  for (const index of payload.omitTriggerLabels ?? [])
458
460
  if (!Number.isInteger(index) || index < 0)
459
461
  errors.push(`unlabeled trigger position "${index}" is not a non-negative integer`);
462
+ for (const entry of payload.triggerDisplayFields ?? []) {
463
+ if (typeof entry?.trigger !== 'string' || !entry.trigger)
464
+ errors.push(`preserved trigger display fields must name a trigger id`);
465
+ if (entry?.connector !== undefined && typeof entry.connector !== 'string')
466
+ errors.push(`preserved trigger display fields of "${entry.trigger}" have a connector that is not a string`);
467
+ const fields = entry?.fields;
468
+ if (!fields || typeof fields !== 'object' || Array.isArray(fields) || !Object.keys(fields).length)
469
+ errors.push(`preserved trigger display fields of "${entry?.trigger}" must be a non-empty object`);
470
+ else
471
+ for (const field of Object.keys(fields))
472
+ if (TYPED_TRIGGER_DISPLAY_KEYS.has(field))
473
+ errors.push(`trigger "${entry.trigger}" display field "${field}" is owned by the typed Case serializer`);
474
+ }
460
475
  for (const [index, fields] of (payload.triggerDataFields ?? []).entries())
461
476
  for (const field of Object.keys(fields))
462
477
  if (!PRESERVED_TRIGGER_DATA_KEYS.has(field))
@@ -815,6 +815,24 @@ export function applyPreservation(result, preservation, options = {}) {
815
815
  throw new CompileRefusal('PRESERVATION_TARGET_MISSING', `trigger ${index + 1} was not regenerated for preserved data fields.`);
816
816
  Object.assign(trigger.data, fields);
817
817
  }
818
+ // A trigger's Designer `display` fields, by its final (restored) id, while
819
+ // it still calls the connector they were saved for.
820
+ for (const entry of preservation.triggerDisplayFields ?? []) {
821
+ const trigger = triggerNodes.find((node) => node.id === entry.trigger);
822
+ const data = trigger?.data;
823
+ if (!data)
824
+ continue;
825
+ const bag = data[CASE_FORMAT_PROFILE.triggerBagField];
826
+ const connector = bag?.context?.find((row) => row?.name === 'connectorKey')?.value;
827
+ if (entry.connector !== undefined ? connector !== entry.connector : connector !== undefined)
828
+ continue;
829
+ const display = (data.display ??= {});
830
+ for (const [field, value] of Object.entries(entry.fields)) {
831
+ if (Object.prototype.hasOwnProperty.call(display, field) && display[field] !== value && !options.overwrite)
832
+ throw new CompileRefusal('PRESERVATION_FIELD_COLLISION', `preserved trigger "${entry.trigger}" display field "${field}" collides with serializer-owned output.`);
833
+ display[field] = value;
834
+ }
835
+ }
818
836
  for (const entry of preservation.omitTriggerDataFields ?? []) {
819
837
  const data = triggerNodes[entry.index]?.data;
820
838
  if (data)
@@ -22,7 +22,15 @@
22
22
  * (emitted JSON) apply the one rule.
23
23
  */
24
24
  export declare function v31TaskSets<T>(sets: readonly (readonly T[])[], runsSequentially: (task: T) => boolean): T[][];
25
- /** The V30→V31 migration's own test, on emitted task JSON: any rule of any entry condition is `runs-sequentially`. */
25
+ /**
26
+ * The V30→V31 migration's own test, on emitted task JSON: any rule of any entry condition is `runs-sequentially`.
27
+ *
28
+ * The converter's test is stricter (EVERY rule of every condition,
29
+ * `taskOnlyRunsSequentiallyInStage`). The two differ only on a task that mixes
30
+ * `runs-sequentially` with another rule, which `check` reports as
31
+ * RUNS_SEQUENTIALLY_MIXED because the converter drops part of it; on every
32
+ * task `check` passes they agree.
33
+ */
26
34
  export declare function taskJsonRunsSequentially(task: {
27
35
  entryConditions?: Array<{
28
36
  rules?: Array<Array<{
@@ -37,7 +37,15 @@ export function v31TaskSets(sets, runsSequentially) {
37
37
  }
38
38
  return out;
39
39
  }
40
- /** The V30→V31 migration's own test, on emitted task JSON: any rule of any entry condition is `runs-sequentially`. */
40
+ /**
41
+ * The V30→V31 migration's own test, on emitted task JSON: any rule of any entry condition is `runs-sequentially`.
42
+ *
43
+ * The converter's test is stricter (EVERY rule of every condition,
44
+ * `taskOnlyRunsSequentiallyInStage`). The two differ only on a task that mixes
45
+ * `runs-sequentially` with another rule, which `check` reports as
46
+ * RUNS_SEQUENTIALLY_MIXED because the converter drops part of it; on every
47
+ * task `check` passes they agree.
48
+ */
41
49
  export function taskJsonRunsSequentially(task) {
42
50
  return (task.entryConditions ?? []).some((condition) => (condition.rules ?? []).some((group) => group.some((r) => r?.rule === 'runs-sequentially')));
43
51
  }
@@ -188,6 +188,7 @@ export declare const REFUSALS: {
188
188
  readonly SLA_RESPONSE_REENTERS_STAGE: "lint";
189
189
  readonly SLA_NAME_DUPLICATE: "lint";
190
190
  readonly ANY_ESCALATION_NO_AT_RISK: "lint";
191
+ readonly RUNS_SEQUENTIALLY_MIXED: "lint";
191
192
  readonly CASE_MGMT_BINDING_KEY_MISMATCH: "lint";
192
193
  readonly CASE_MGMT_NODE_ID_DUPLICATE: "lint";
193
194
  readonly CASE_MGMT_OUTPUT_ID_DUPLICATE: "lint";
@@ -253,6 +253,7 @@ export const REFUSALS = {
253
253
  SLA_RESPONSE_REENTERS_STAGE: 'lint',
254
254
  SLA_NAME_DUPLICATE: 'lint',
255
255
  ANY_ESCALATION_NO_AT_RISK: 'lint',
256
+ RUNS_SEQUENTIALLY_MIXED: 'lint',
256
257
  // `uip maestro case validate`'s own codes, ported to case/plan-check/. All
257
258
  // `lint` for now: only `check` reports them. The four on fields compile writes
258
259
  // (ids, binding keys) are also carried from a decompiled plan's preserved
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.91.0",
3
+ "version": "6.91.2",
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": "ebc34129dfd4dc427791db0a25d2c4652c73f63c"
114
+ "gitref": "a6c4e085c2066018e9c0e4d3b87257130920440a"
115
115
  }