@uipath/maestro-builder-sdk 6.91.1 → 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.
@@ -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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.91.1",
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": "1a23673ee955694372b97478f0e031bdf861f6f1"
114
+ "gitref": "a6c4e085c2066018e9c0e4d3b87257130920440a"
115
115
  }