@uipath/maestro-builder-sdk 6.122.11 → 6.123.0

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.
@@ -26,6 +26,7 @@ import type { RegistryTypeSpec, TypedContextRow, TypedInputRow, TypedOutputRow }
26
26
  import { type HumanTaskForm } from './human-task-form.js';
27
27
  export type { HumanTaskForm, HumanTaskFormField, HumanTaskShownField, HumanTaskAskedField, HumanTaskInOutField, HumanTaskOutcome, } from './human-task-form.js';
28
28
  import { type DataServiceEntity, type DataServiceOperation, type PendingDataServiceEntity } from './data-service.js';
29
+ import type { EntityRef } from '../core/resource-resolution.js';
29
30
  export type { DataServiceEntity, DataServiceFolderEntity, DataServiceOperation } from './data-service.js';
30
31
  export { BpmnBuildError } from './bpmn-expr-check.js';
31
32
  export type { BpmnLocatedDiagnostic } from './bpmn-expr-check.js';
@@ -303,6 +304,8 @@ export type BpmnNode = {
303
304
  /** The `where` scope and extra event parameters, when the operation declares any. */
304
305
  filter?: Record<string, unknown>;
305
306
  parameters?: Record<string, unknown>;
307
+ /** The folder entity the event watches — see {@link ConnectorEventOpts.entity}. */
308
+ entity?: EntityRef;
306
309
  /** Payload conditions — see {@link ConnectorEventOpts.filters}. */
307
310
  filters?: EventFilter[];
308
311
  outputVar?: string;
@@ -1828,6 +1831,21 @@ export interface ConnectorEventOpts extends ActivityOpts {
1828
1831
  filters?: EventFilter[];
1829
1832
  /** Extra event parameters, for operations that declare them. */
1830
1833
  parameters?: Record<string, unknown>;
1834
+ /**
1835
+ * The folder-scoped Data Fabric entity a `EntityTriggers_V3` event (`record-updated-preview-`,
1836
+ * `record-created-preview-`, …) watches: `{ name, folder: '<folder path>' }`, never a
1837
+ * hand-written `filter: { folderEntityName }`, which watches the right records but is no
1838
+ * picker, so a deploy cannot re-point it and `bpmn refresh` declares no entity for it.
1839
+ *
1840
+ * @remarks
1841
+ * Written as Studio Web's connector panel saves it (`registry get Intsvc.EventTrigger
1842
+ * --input-details '{"queryParameters":{…}}'`): `body.parameters` reads the entity's
1843
+ * `resource="entity"` binding pair, the metadata saves the selection, and `bpmn refresh`
1844
+ * packages the entity. The keys come from `uip maestro registry prepare --entity <name>
1845
+ * --folder-path <path>` (`check` prints it as `RESOURCE_UNRESOLVED`), the same row a
1846
+ * `.dataService()` on this entity uses, and the pair is shared with it.
1847
+ */
1848
+ entity?: EntityRef;
1831
1849
  /**
1832
1850
  * Variable the event payload lands in. Defaults to `<id>_result`. The node's
1833
1851
  * `response` row (`source="=response"`) writes the payload itself, so a downstream
@@ -2008,6 +2008,7 @@ class ScopeBuilder {
2008
2008
  filter: opts.filter,
2009
2009
  filters: opts.filters,
2010
2010
  parameters: opts.parameters,
2011
+ entity: opts.entity,
2011
2012
  outputVar: opts.outputVar,
2012
2013
  outputs: opts.outputs,
2013
2014
  skipCondition: opts.skipCondition,
@@ -2058,6 +2059,7 @@ class ScopeBuilder {
2058
2059
  filter: opts.filter,
2059
2060
  filters: opts.filters,
2060
2061
  parameters: opts.parameters,
2062
+ entity: opts.entity,
2061
2063
  outputVar: opts.outputVar,
2062
2064
  outputs: opts.outputs,
2063
2065
  skipCondition: opts.skipCondition,
@@ -356,6 +356,7 @@ function checkConnectorEvents(built, opts, diags) {
356
356
  event: n.eventName,
357
357
  ...(n.version !== undefined ? { version: n.version } : {}),
358
358
  ...(n.object !== undefined ? { object: n.object } : {}),
359
+ ...(n.entity !== undefined ? { entity: n.entity } : {}),
359
360
  ...(n.filter !== undefined ? { where: n.filter } : {}),
360
361
  ...(n.filters !== undefined ? { filters: n.filters } : {}),
361
362
  ...(n.connection !== undefined ? { connection: n.connection } : {}),
@@ -279,6 +279,13 @@ export declare function lowerDataServiceEntity(id: string, pending: PendingDataS
279
279
  folder: string;
280
280
  }) => DataServiceWire;
281
281
  };
282
+ /**
283
+ * The picker binding pair of a folder-scoped entity, as Studio Web's V2 panel writes it
284
+ * (`resource="entity"`, names `Entity` and `Entity folder`): name first, folder key second.
285
+ * A connector event's entity picker (`.eventTrigger({ entity })`) shares it with a
286
+ * `.dataService()` task on the same entity.
287
+ */
288
+ export declare function pickerEntityBindings(name: string, folderKey: string, resourceKey: string): EntityBindingRow[];
282
289
  /** The connection wiring of a `.dataService()` task: `=bindings.<id>` references, and the connection's key. */
283
290
  export interface DataServiceWiring {
284
291
  connection: string;
@@ -310,3 +317,10 @@ export interface CatalogOperation {
310
317
  description: string;
311
318
  label: (entity: string) => string;
312
319
  }
320
+ /** The `_V3` scope rows' wire names, as `describe` declares them and the canvas writes them. */
321
+ export declare const FOLDER_SCOPE: {
322
+ readonly scopeParameter: "entityScope";
323
+ readonly scopeValue: "folder";
324
+ readonly nameParameter: "folderEntityName";
325
+ readonly folderKeyParameter: "folderEntityName_folderKey";
326
+ };
@@ -167,6 +167,15 @@ function entityBindings(name, folderKey, resourceKey, form) {
167
167
  ? [row('Name', 'Entity', name, 'name'), row('Folder', 'Entity folder', folderKey, 'folderKey')]
168
168
  : [row('Name', name, name, 'name'), row('Folder', `${name}Folder`, folderKey, 'folderKey')];
169
169
  }
170
+ /**
171
+ * The picker binding pair of a folder-scoped entity, as Studio Web's V2 panel writes it
172
+ * (`resource="entity"`, names `Entity` and `Entity folder`): name first, folder key second.
173
+ * A connector event's entity picker (`.eventTrigger({ entity })`) shares it with a
174
+ * `.dataService()` task on the same entity.
175
+ */
176
+ export function pickerEntityBindings(name, folderKey, resourceKey) {
177
+ return entityBindings(name, folderKey, resourceKey, EntityBindingForm.Picker);
178
+ }
170
179
  /** Which wire contract a folder entity's binding pair follows; see {@link entityBindings}. */
171
180
  var EntityBindingForm;
172
181
  (function (EntityBindingForm) {
@@ -311,7 +320,7 @@ const FOLDER_RECORD_OPERATIONS = {
311
320
  },
312
321
  };
313
322
  /** The `_V3` scope rows' wire names, as `describe` declares them and the canvas writes them. */
314
- const FOLDER_SCOPE = {
323
+ export const FOLDER_SCOPE = {
315
324
  scopeParameter: 'entityScope',
316
325
  scopeValue: 'folder',
317
326
  nameParameter: 'folderEntityName',
@@ -35,6 +35,18 @@ type EventNode = Extract<BpmnNode, {
35
35
  type ExternalNode = Extract<BpmnNode, {
36
36
  kind: 'externalTask';
37
37
  }>;
38
+ /**
39
+ * A connector event's folder entity as the serializer settled it: the recorded keys and the
40
+ * ids of the picker binding pair the node reads (`serialize.ts` `eventEntityPicker`).
41
+ */
42
+ export interface EventEntityPicker {
43
+ name: string;
44
+ folderKey: string;
45
+ /** The entity's solution resource key. */
46
+ resourceKey: string;
47
+ nameBinding: string;
48
+ folderBinding: string;
49
+ }
38
50
  /**
39
51
  * A connector event node — `Intsvc.EventTrigger` or `Intsvc.WaitForEvent`.
40
52
  *
@@ -47,7 +59,7 @@ type ExternalNode = Extract<BpmnNode, {
47
59
  * @param n - The authored node.
48
60
  * @returns The moddle element.
49
61
  */
50
- export declare function createConnectorEvent(ctx: ConnectorCtx, n: EventNode): El;
62
+ export declare function createConnectorEvent(ctx: ConnectorCtx, n: EventNode, resolvePicker?: () => EventEntityPicker): El;
51
63
  /**
52
64
  * The `body` of a connector event node: the subscription's filter in the one place the
53
65
  * platform reads it. `scope` (the `filter` option — the operation's event parameters, by
@@ -8,6 +8,9 @@ import { genericEventObjectRefusal } from '../core/event-checks.js';
8
8
  import { EVENT_FILTER_OPERATORS, eventFilterJmes, eventFiltersNotArray, jmesString, jmesStringProblem, readEventFilterLeaf } from '../core/event-filters.js';
9
9
  import { resolveEventWhere } from '../core/lookups.js';
10
10
  import { CompileRefusal } from '../core/compile-refusal.js';
11
+ import { FOLDER_SCOPE } from './data-service.js';
12
+ /** The only event object whose entity is a solution-resource picker: the Data Fabric entity triggers. */
13
+ const ENTITY_TRIGGER_OBJECT = 'EntityTriggers_V3';
11
14
  /** The descriptor `subType` each family requires, per `case/serialize.ts`. */
12
15
  const EXTERNAL_SUBTYPE = { agent: 'AgentExecution', workflow: 'ProcessExecution' };
13
16
  /**
@@ -22,7 +25,7 @@ const EXTERNAL_SUBTYPE = { agent: 'AgentExecution', workflow: 'ProcessExecution'
22
25
  * @param n - The authored node.
23
26
  * @returns The moddle element.
24
27
  */
25
- export function createConnectorEvent(ctx, n) {
28
+ export function createConnectorEvent(ctx, n, resolvePicker) {
26
29
  refuseBindingLabels(ctx, n, `${n.subscribe === 'trigger' ? 'Event trigger' : 'waitForEvent'} "${n.id}"`, { key: n.key, action: n.eventName });
27
30
  // Filters that are no array at all need no library to refuse either, so a run
28
31
  // without one hears the same code (in Case's order: the labels, then these).
@@ -105,12 +108,43 @@ export function createConnectorEvent(ctx, n) {
105
108
  // A `lookup()` token in the scope is replaced by the id `prepare --resolve`
106
109
  // recorded, as Flow's and Case's serializers do; an unrecorded one is refused
107
110
  // with the command that records it. Stringified, a token was `[object Object]`.
111
+ // `entity` is the whole scope of a folder entity trigger: the object must be the entity
112
+ // trigger's and nothing else may write the scope keys beside the picker. Checked before
113
+ // the entity's keys are looked up, so a wrong event never sends the author to `prepare`.
114
+ let picker;
115
+ const objectOf = String(n.object ?? op.objectName ?? '');
116
+ if (resolvePicker !== undefined) {
117
+ if (objectOf !== ENTITY_TRIGGER_OBJECT) {
118
+ throw new CompileRefusal('EVENT_ENTITY_UNSUPPORTED', `${where}: \`entity\` is for the Data Fabric entity events (object ${ENTITY_TRIGGER_OBJECT}), and ${n.key}/${n.eventName} watches ${JSON.stringify(objectOf)}. `
119
+ + 'Scope any other event with `filter`.');
120
+ }
121
+ const scopeKeys = new Set([FOLDER_SCOPE.scopeParameter, FOLDER_SCOPE.nameParameter, FOLDER_SCOPE.folderKeyParameter]);
122
+ const clash = [...Object.keys(n.filter ?? {}), ...Object.keys(n.parameters ?? {})].filter((k) => scopeKeys.has(k));
123
+ if (n.filter !== undefined && Object.keys(n.filter).length > 0) {
124
+ throw new CompileRefusal('EVENT_ENTITY_FILTER', `${where}: \`entity\` is the entity trigger's scope; drop \`filter\` (${Object.keys(n.filter).join(', ')}), which would write a second, literal scope beside the picker.`);
125
+ }
126
+ if (clash.length > 0) {
127
+ throw new CompileRefusal('EVENT_ENTITY_FILTER', `${where}: \`entity\` writes ${[...new Set(clash)].join(', ')}; drop ${clash.length > 1 ? 'them' : 'it'} from \`parameters\`.`);
128
+ }
129
+ picker = resolvePicker();
130
+ }
108
131
  const scope = resolveEventWhere(n.filter, library.lookupResolutions, where);
109
132
  const conditions = eventFilterReads(n.id, n.filters);
110
133
  const body = eventFilterBody(n.id, scope, conditions);
111
134
  // The operation's query and path parameters, which Studio Web writes beside the filter.
112
135
  if (n.parameters !== undefined)
113
136
  body.parameters = n.parameters;
137
+ const objectName = String(n.object ?? op.objectName ?? '');
138
+ if (picker !== undefined) {
139
+ // The picker form Studio Web saves: the scope, the entity and its folder, the last two as
140
+ // `=bindings.<id>` reads of the entity's pair.
141
+ body.parameters = {
142
+ [FOLDER_SCOPE.scopeParameter]: FOLDER_SCOPE.scopeValue,
143
+ [FOLDER_SCOPE.nameParameter]: `=bindings.${picker.nameBinding}`,
144
+ ...(n.parameters ?? {}),
145
+ [FOLDER_SCOPE.folderKeyParameter]: `=bindings.${picker.folderBinding}`,
146
+ };
147
+ }
114
148
  // The designer's filter tree of the same `filters`, and their expression, in the metadata.
115
149
  const tree = connectorEventFilterTree(conditions, (suffix) => stableId(`${n.id}${suffix}`));
116
150
  const expression = body.filters?.expression;
@@ -130,9 +164,9 @@ export function createConnectorEvent(ctx, n) {
130
164
  { name: 'folderKey', value: `=bindings.${folder.id}` },
131
165
  { name: 'method' },
132
166
  { name: 'path' },
133
- { name: 'objectName', value: String(n.object ?? op.objectName ?? '') },
167
+ { name: 'objectName', value: objectName },
134
168
  { name: 'operation', value: String(op.eventOperation ?? '') },
135
- { name: 'metadata', type: 'json', body: connectorEventMetadata(rc, { ...op, objectName: n.object ?? op.objectName }, tree, expression) },
169
+ { name: 'metadata', type: 'json', body: connectorEventMetadata(rc, { ...op, objectName: n.object ?? op.objectName }, tree, expression, picker && { ...picker, elementId: n.id, connectionKey: conn.resourceKey, parameters: body.parameters }) },
136
170
  { name: 'activityConfigurationVersion', value: ACTIVITY_CONFIGURATION_V2 },
137
171
  ];
138
172
  return createTypedNode(ctx.m, n.id,
@@ -28,7 +28,8 @@ import { isExpressionValue } from './expression-value.js';
28
28
  import { parseXmlRanges } from './xml-ranges.js';
29
29
  import { ownEntry } from '../core/own-entry.js';
30
30
  import { CompileRefusal } from '../core/compile-refusal.js';
31
- import { dataServiceContext, lowerDataServiceEntity } from './data-service.js';
31
+ import { dataServiceContext, lowerDataServiceEntity, pickerEntityBindings } from './data-service.js';
32
+ import { ENTITY_KIND, resolveRecordedResource } from '../core/resource-resolution.js';
32
33
  const require = createRequire(import.meta.url);
33
34
  const uipathDescriptor = require('./uipath-moddle.v1.json');
34
35
  const NS = {
@@ -780,8 +781,10 @@ function createNode(ctx, n) {
780
781
  return applyActivityFields(ctx, ctx.m.create(moddleTaskType(n.element), { id: n.id, name: n.name }), n);
781
782
  case 'connector':
782
783
  return applyActivityFields(ctx, createConnectorTask(ctx, n), n);
783
- case 'connectorEvent':
784
- return applyActivityFields(ctx, createConnectorEvent(ctx, n), n);
784
+ case 'connectorEvent': {
785
+ const event = n;
786
+ return applyActivityFields(ctx, createConnectorEvent(ctx, event, event.entity ? () => eventEntityPicker(ctx, event) : undefined), n);
787
+ }
785
788
  case 'externalTask':
786
789
  return applyActivityFields(ctx, createExternalTask(ctx, n), n);
787
790
  case 'typed':
@@ -809,24 +812,46 @@ function createNode(ctx, n) {
809
812
  }
810
813
  }
811
814
  /**
812
- * A pending `.dataService()` (`{ name, folder }`, or `{ name, folderKey }` on a record
813
- * operation with a V2 form) as it compiles: the entity's binding pair into the sink, and
814
- * the wire from the recorded row, built on the pair's settled ids (`lowerDataServiceEntity`).
815
- *
816
- * A pair's id is taken only when nothing else holds it, or what holds it is the same
817
- * entity (the same resource key): another task's pair, or the pair a decompiled
818
- * source declares, which then stands for this one. Anything else — another entity's
819
- * pair, one name in two folders, names that differ only in punctuation, or a task or
820
- * variable with that id — gets `2`, `3`, … on this pair, since one id cannot carry
821
- * two resource keys and the XML keeps only the first element with an id.
822
- *
823
- * Which entity gets the unsuffixed id follows task order, so reordering tasks
824
- * can move it. Nothing reads these ids — the task names the entity through its
825
- * literal rows, and `bpmn refresh` matches a pair by its resource key — so the
826
- * id is a label only; a tool that keys on it must not assume it is stable.
815
+ * A connector event's `entity: { name, folder }`: the recorded row it compiles from, and
816
+ * the entity's picker binding pair in the sink, shared with any `.dataService()` task on
817
+ * the same entity. A tenant entity has no picker (the folder scope is the only one a
818
+ * trigger saves one for), so it is refused.
827
819
  */
828
- function lowerPendingDataService(ctx, n) {
829
- const { bindings, wire: wireFor } = lowerDataServiceEntity(n.id, n.dataServiceEntity, ctx.resources);
820
+ function eventEntityPicker(ctx, n) {
821
+ const { name, folder } = n.entity;
822
+ const where = `${n.subscribe === 'trigger' ? 'Event trigger' : 'waitForEvent'} "${n.id}"`;
823
+ if (folder === undefined) {
824
+ throw new CompileRefusal('EVENT_ENTITY_TENANT', `${where}: the folder entity trigger watches folder entities only. Name the folder ${JSON.stringify(name)} lives in: entity: { name, folder: '<folder path>' }.`);
825
+ }
826
+ let row;
827
+ try {
828
+ row = resolveRecordedResource({ kind: ENTITY_KIND, name, folder }, ctx.resources);
829
+ }
830
+ catch (error) {
831
+ if (error instanceof CompileRefusal)
832
+ throw new CompileRefusal(error.code, `${where}: ${error.message}`, error.suggestion);
833
+ throw error;
834
+ }
835
+ if (row.scope !== 'folder') {
836
+ throw new CompileRefusal('EVENT_ENTITY_TENANT', `${where}: entity ${JSON.stringify(row.name)} is a tenant-level entity, and the folder entity trigger watches folder entities only. `
837
+ + `Name the folder it lives in: entity: { name, folder: '<folder path>' }.`);
838
+ }
839
+ const bindings = pickerEntityBindings(row.name, row.folderKey, row.key);
840
+ const suffix = claimEntityBindings(ctx, bindings);
841
+ return {
842
+ name: row.name,
843
+ folderKey: row.folderKey,
844
+ resourceKey: row.key,
845
+ nameBinding: withSuffix(bindings[0].id, suffix),
846
+ folderBinding: withSuffix(bindings[1].id, suffix),
847
+ };
848
+ }
849
+ /**
850
+ * Put an entity's binding pair into the sink under ids nothing else holds, and return the
851
+ * suffix that made them free (`''` when the plain ids were). The id rule is
852
+ * {@link lowerPendingDataService}'s.
853
+ */
854
+ function claimEntityBindings(ctx, bindings) {
830
855
  const free = (suffix) => bindings.every((b) => {
831
856
  const id = withSuffix(b.id, suffix);
832
857
  const held = ctx.bindingSink.get(id);
@@ -851,6 +876,28 @@ function lowerPendingDataService(ctx, n) {
851
876
  if (held === undefined || b.resource === PICKER_ENTITY_RESOURCE)
852
877
  ctx.bindingSink.set(id, { ...b, id });
853
878
  }
879
+ return suffix;
880
+ }
881
+ /**
882
+ * A pending `.dataService()` (`{ name, folder }`, or `{ name, folderKey }` on a record
883
+ * operation with a V2 form) as it compiles: the entity's binding pair into the sink, and
884
+ * the wire from the recorded row, built on the pair's settled ids (`lowerDataServiceEntity`).
885
+ *
886
+ * A pair's id is taken only when nothing else holds it, or what holds it is the same
887
+ * entity (the same resource key): another task's pair, or the pair a decompiled
888
+ * source declares, which then stands for this one. Anything else — another entity's
889
+ * pair, one name in two folders, names that differ only in punctuation, or a task or
890
+ * variable with that id — gets `2`, `3`, … on this pair, since one id cannot carry
891
+ * two resource keys and the XML keeps only the first element with an id.
892
+ *
893
+ * Which entity gets the unsuffixed id follows task order, so reordering tasks
894
+ * can move it. Nothing reads these ids — the task names the entity through its
895
+ * literal rows, and `bpmn refresh` matches a pair by its resource key — so the
896
+ * id is a label only; a tool that keys on it must not assume it is stable.
897
+ */
898
+ function lowerPendingDataService(ctx, n) {
899
+ const { bindings, wire: wireFor } = lowerDataServiceEntity(n.id, n.dataServiceEntity, ctx.resources);
900
+ const suffix = claimEntityBindings(ctx, bindings);
854
901
  const wire = bindings.length === 2
855
902
  ? wireFor({ name: withSuffix(bindings[0].id, suffix), folder: withSuffix(bindings[1].id, suffix) })
856
903
  : wireFor();
package/dist/bpmn-api.md CHANGED
@@ -371,6 +371,7 @@ Extends `ActivityOpts` — its fields and methods apply here too.
371
371
  - `ConnectorEventOpts.filter?: Record<string, unknown>` — The subscription's SCOPE — the operation's own event parameters, by equality (`{ parentFolderId: '<mail folder id>' }`…
372
372
  - `ConnectorEventOpts.filters?: EventFilter[]` — Conditions on the event PAYLOAD, AND-joined after the scope: `[{ field: 'subject', contains: 'TestWaitFor' }]`.
373
373
  - `ConnectorEventOpts.parameters?: Record<string, unknown>` — Extra event parameters, for operations that declare them.
374
+ - `ConnectorEventOpts.entity?: EntityRef` — The folder-scoped Data Fabric entity a `EntityTriggers_V3` event (`record-updated-preview-`, `record-created-preview-`,…
374
375
  - `ConnectorEventOpts.outputVar?: string` — Variable the event payload lands in.
375
376
  - `ConnectorEventOpts.outputs?: Record<string, string>` — Fields to pull out of the payload into variables of their own, e.g. `{ amount: '=response.amount' }`.
376
377
  - `ConnectorEventOpts.skipCondition?: string` — `=`-expression that skips the node when truthy.
@@ -625,7 +626,7 @@ The built in-memory process graph `.build()` returns — the IR `serialize()` wa
625
626
 
626
627
  One node in the built graph — a discriminated union with one arm per BPMN element kind, which the serializer walks into…
627
628
 
628
- - `type BpmnNode` — 2799 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
629
+ - `type BpmnNode` — 2819 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
629
630
 
630
631
  ### `BpmnFlow`
631
632
 
@@ -974,6 +975,13 @@ The BPMN activity elements the builder can write with NO `uipath:*` payload.
974
975
 
975
976
  - `type PlainTaskElement` — 181 characters; read it in the declaration ([`api-index.md`](api-index.md) has the span).
976
977
 
978
+ ### `EntityRef`
979
+
980
+ A Data Fabric entity by name and folder path: a ResourceRef of kind `Entity`, spelled as the plain object a field that…
981
+
982
+ - `EntityRef.name: string` — The entity's name, exactly as Data Fabric spells it (names are case-sensitive).
983
+ - `EntityRef.folder?: string` — The Orchestrator folder path the entity lives in, e.g. `'Shared'` or `'Finance/Prod'`.
984
+
977
985
  ### `EventFilter`
978
986
 
979
987
  One filter condition on the event payload.
@@ -1073,13 +1081,6 @@ One row of `uipath:errorMapping` — how an activity classifies one kind of fail
1073
1081
  - `ErrorMappingRow.condition?: string` — `=`-expression narrowing when this row applies.
1074
1082
  - `ErrorMappingRow.detail?: string` — Human-facing detail.
1075
1083
 
1076
- ### `EntityRef`
1077
-
1078
- A Data Fabric entity by name and folder path: a ResourceRef of kind `Entity`, spelled as the plain object a field that…
1079
-
1080
- - `EntityRef.name: string` — The entity's name, exactly as Data Fabric spells it (names are case-sensitive).
1081
- - `EntityRef.folder?: string` — The Orchestrator folder path the entity lives in, e.g. `'Shared'` or `'Finance/Prod'`.
1082
-
1083
1084
  ### `RegistryContextField`
1084
1085
 
1085
1086
  One context field of a typed node, as the registry describes it.
@@ -68,4 +68,18 @@ export declare function connectorEventFilterTree(conditions: readonly ReadEventF
68
68
  * Web also records here (`activityPropertyConfiguration.filterExpression`); omitted
69
69
  * when there is none.
70
70
  */
71
- export declare function connectorEventMetadata(rc: ReturnType<Library['resolveEvent']>, op: any, filter: Record<string, unknown> | null, filterExpression?: string): Record<string, unknown>;
71
+ export declare function connectorEventMetadata(rc: ReturnType<Library['resolveEvent']>, op: any, filter: Record<string, unknown> | null, filterExpression?: string, entity?: EventEntityMetadata): Record<string, unknown>;
72
+ /**
73
+ * A connector event's folder entity as its metadata saves it: the entity, the ids of the
74
+ * binding pair the node's parameters read, and the node's connection.
75
+ */
76
+ export interface EventEntityMetadata {
77
+ name: string;
78
+ folderKey: string;
79
+ resourceKey: string;
80
+ elementId: string;
81
+ /** The connection's resource key, which the trigger resource hangs off. */
82
+ connectionKey: string;
83
+ /** The node's `body.parameters`, which Studio Web repeats as `triggerQueryParameters`. */
84
+ parameters: Record<string, unknown>;
85
+ }
@@ -1,7 +1,7 @@
1
1
  import { replayInputsOf } from './connector-inputs.js';
2
2
  import { buildEssentialConfiguration } from './connector-configuration.js';
3
3
  import { eventFilterTreeLeaf } from './event-filters.js';
4
- import { pickerMetadataBindings, savedResourceSelections } from './resource-picker.js';
4
+ import { pickerFolderField, pickerMetadataBindings, savedResourceSelections } from './resource-picker.js';
5
5
  /**
6
6
  * The `metadata` of a connector activity: the FUNCTIONAL essentialConfiguration +
7
7
  * activityTypeId, and the multipart wire of a multipart operation.
@@ -97,7 +97,7 @@ export function connectorEventFilterTree(conditions, seededId) {
97
97
  * Web also records here (`activityPropertyConfiguration.filterExpression`); omitted
98
98
  * when there is none.
99
99
  */
100
- export function connectorEventMetadata(rc, op, filter, filterExpression) {
100
+ export function connectorEventMetadata(rc, op, filter, filterExpression, entity) {
101
101
  const instanceParameters = {
102
102
  connectorKey: rc.connectorKey,
103
103
  objectName: op.objectName ?? rc.nodeType.split('.').pop(),
@@ -111,13 +111,16 @@ export function connectorEventMetadata(rc, op, filter, filterExpression) {
111
111
  essentialConfiguration: {
112
112
  connectorVersion: null,
113
113
  executionType: null,
114
- customFieldsRequestDetails: null,
114
+ customFieldsRequestDetails: entity
115
+ ? { objectActionName: 'FetchObjectMetadataFolder', parameterValues: [[ENTITY_PICKER_FIELD, entity.name]] }
116
+ : null,
115
117
  instanceParameters,
116
118
  objectName: instanceParameters.objectName,
117
119
  packageVersion: rc.version,
118
120
  httpMethod: null,
119
121
  path: null,
120
122
  filter,
123
+ ...(entity ? { savedResourceSelections: savedResourceSelections([selectionOf(entity)]) } : {}),
121
124
  },
122
125
  };
123
126
  return {
@@ -140,11 +143,56 @@ export function connectorEventMetadata(rc, op, filter, filterExpression) {
140
143
  isEnabled: true,
141
144
  },
142
145
  },
146
+ ...(entity ? { inputMetadata: { triggerQueryParameters: entity.parameters } } : {}),
143
147
  telemetryData: {
144
148
  connectorKey: rc.connectorKey,
145
149
  connectorName: rc.connectorName,
146
150
  objectName: instanceParameters.objectName,
147
151
  objectDisplayName: op.objectDisplayName ?? rc.entry.display?.operationLabel ?? '',
148
152
  },
153
+ ...(entity ? { bindings: eventEntityBindings(entity, instanceParameters.objectName, String(op.eventOperation ?? '')) } : {}),
149
154
  };
150
155
  }
156
+ /** The wire name of the folder entity picker on a Data Fabric entity trigger. */
157
+ const ENTITY_PICKER_FIELD = 'folderEntityName';
158
+ function selectionOf(entity) {
159
+ return {
160
+ elementId: entity.elementId,
161
+ field: ENTITY_PICKER_FIELD,
162
+ bucket: 'queryParameters',
163
+ name: entity.name,
164
+ folderKey: entity.folderKey,
165
+ resourceKey: entity.resourceKey,
166
+ };
167
+ }
168
+ /**
169
+ * The `metadata.bindings` of a folder entity trigger: the entity's picker binding, as a
170
+ * connector activity saves it, and the trigger's `Property` binding, which records the
171
+ * parameters the trigger is created and debugged with and what each one reads of the entity.
172
+ * Both are what `registry get Intsvc.EventTrigger --input-details` returns for the node.
173
+ */
174
+ function eventEntityBindings(entity, objectName, operation) {
175
+ const folderField = pickerFolderField(ENTITY_PICKER_FIELD);
176
+ const fixed = (defaultValue) => ({ defaultValue, isExpression: false });
177
+ const parameterNames = ['entityScope', ENTITY_PICKER_FIELD, folderField].join(',');
178
+ const reference = (field) => ({ resourceKey: `entity.${entity.resourceKey}`, field });
179
+ return [
180
+ ...pickerMetadataBindings([selectionOf(entity)]),
181
+ {
182
+ resource: 'Property',
183
+ key: operation,
184
+ value: { entityScope: fixed('folder'), [ENTITY_PICKER_FIELD]: fixed(entity.name), [folderField]: fixed(entity.folderKey) },
185
+ activityDisplayName: 'connector-activity',
186
+ metadata: {
187
+ ActivityName: 'connector-activity',
188
+ BindingsVersion: '2.2',
189
+ ObjectName: objectName,
190
+ Operation: operation,
191
+ ParentResourceKey: `EventTrigger.${entity.connectionKey}`,
192
+ FieldReferences: JSON.stringify({ [ENTITY_PICKER_FIELD]: reference('name'), [folderField]: reference('folderKey') }),
193
+ TriggerCreateParameters: parameterNames,
194
+ DebugQueryParameters: parameterNames,
195
+ },
196
+ },
197
+ ];
198
+ }
@@ -345,7 +345,8 @@ compileRefusals = true) {
345
345
  : `where: {}`);
346
346
  }
347
347
  }
348
- else if (scopeKeys.length === 0 && !eventParams?.generic) {
348
+ else if (scopeKeys.length === 0 && !eventParams?.generic && sub.entity === undefined) {
349
+ // (An `entity` is a scope too: the folder entity picker.)
349
350
  // Whether omitting the scope is a mistake is not knowable here — the platform
350
351
  // accepts an unscoped subscription (it listens to everything the connection can
351
352
  // see) and 12 deployed Outlook flows that do exactly that scored 1.0. Name the
@@ -341,6 +341,9 @@ export declare const REFUSALS: {
341
341
  readonly ESCALATION_RECIPIENT_UNRESOLVED: "lint";
342
342
  readonly ESCALATION_ZERO_ATRISK_PCT: "lint";
343
343
  readonly EVENT_BYOA_UNVERIFIED: "lowering";
344
+ readonly EVENT_ENTITY_FILTER: "lowering";
345
+ readonly EVENT_ENTITY_TENANT: "lowering";
346
+ readonly EVENT_ENTITY_UNSUPPORTED: "lowering";
344
347
  readonly EVENT_FILTERS_NOT_ARRAY: "lowering";
345
348
  readonly EVENT_FILTER_BACKSLASH: "lowering";
346
349
  readonly EVENT_FILTER_BAD_VALUE: "lowering";
@@ -415,6 +415,9 @@ export const REFUSALS = {
415
415
  ESCALATION_RECIPIENT_UNRESOLVED: 'lint',
416
416
  ESCALATION_ZERO_ATRISK_PCT: 'lint',
417
417
  EVENT_BYOA_UNVERIFIED: 'lowering',
418
+ EVENT_ENTITY_FILTER: 'lowering',
419
+ EVENT_ENTITY_TENANT: 'lowering',
420
+ EVENT_ENTITY_UNSUPPORTED: 'lowering',
418
421
  EVENT_FILTERS_NOT_ARRAY: 'lowering',
419
422
  EVENT_FILTER_BACKSLASH: 'lowering',
420
423
  EVENT_FILTER_BAD_VALUE: 'lowering',
package/dist/merge.js CHANGED
@@ -958,6 +958,9 @@ function withoutStaleConnectionRows(rows, originalNodes, mergedNodes) {
958
958
  *
959
959
  * Kept: a row no edited node references (one a sidecar file uses, say), a row
960
960
  * a subflow node or an edited node references, and every row without a baseline.
961
+ * Except: an unreferenced row the baseline lacks goes when the original's row
962
+ * with its id is referenced by a kept node (the recompile resolved a label stub
963
+ * for a node the merge discarded).
961
964
  */
962
965
  function withoutRowsMintedForKeptNodes(rows, original, edited, baseline, keptFromOriginal, fieldwise) {
963
966
  if (!baseline || !rows || (keptFromOriginal.size === 0 && fieldwise.size === 0))
@@ -978,25 +981,33 @@ function withoutRowsMintedForKeptNodes(rows, original, edited, baseline, keptFro
978
981
  const all = (edited.bindings ?? []);
979
982
  const fromOriginal = new Set((original.bindings ?? []).map(bindingIdentity));
980
983
  const inBaseline = new Set((baseline.bindings ?? []).map(bindingIdentity));
984
+ const originalRows = (original.bindings ?? []);
985
+ const originalById = new Map(originalRows.map((o) => [o.id, o]));
986
+ const editedIds = new Map(all.map((o) => [bindingIdentity(o), o.id]));
987
+ const refersTo = (row, pool, text) => {
988
+ const key = keyOf(row);
989
+ if (key !== '' && text.includes(spelled(key)))
990
+ return true;
991
+ const placeholder = typeof row.name === 'string' ? spelled(`<bindings.${row.name}>`) : undefined;
992
+ if (placeholder === undefined || !text.includes(placeholder))
993
+ return false;
994
+ const others = pool.filter((o) => o.name === row.name && keyOf(o) !== key);
995
+ return key === ''
996
+ ? !others.some((o) => text.includes(spelled(keyOf(o))))
997
+ : others.length === 0;
998
+ };
981
999
  return rows.filter((b) => {
982
1000
  const identity = bindingIdentity(b);
983
- if (fromOriginal.has(identity) || !inBaseline.has(identity))
1001
+ if (fromOriginal.has(identity))
984
1002
  return true;
985
- const key = keyOf(b);
986
- const others = typeof b.name === 'string'
987
- ? all.filter((o) => o.name === b.name && keyOf(o) !== key)
988
- : [];
989
- const placeholder = typeof b.name === 'string' ? spelled(`<bindings.${b.name}>`) : undefined;
990
- const references = (text) => {
991
- if (key !== '' && text.includes(spelled(key)))
992
- return true;
993
- if (placeholder === undefined || !text.includes(placeholder))
994
- return false;
995
- return key === ''
996
- ? !others.some((o) => text.includes(spelled(keyOf(o))))
997
- : others.length === 0;
998
- };
1003
+ const references = (text) => refersTo(b, all, text);
999
1004
  const referencers = nodes.filter((n) => references(n.text));
1005
+ if (!inBaseline.has(identity)) {
1006
+ if (referencers.length > 0)
1007
+ return true;
1008
+ const counterpart = originalById.get(editedIds.get(identity));
1009
+ return !counterpart || !nodes.some((n) => n.kept && refersTo(counterpart, originalRows, n.text));
1010
+ }
1000
1011
  const needs = (n) => !n.kept && (n.changed === undefined || references(n.changed));
1001
1012
  return !(referencers.length > 0 && !referencers.some(needs));
1002
1013
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.122.11",
3
+ "version": "6.123.0",
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",
@@ -126,5 +126,5 @@
126
126
  "@types/node": "^22.7.0",
127
127
  "esbuild": "^0.28.1"
128
128
  },
129
- "gitref": "3187f53215450e0ef8d2e8d45caf86d1aa285338"
129
+ "gitref": "f74d1402602900485e971c6012bb1eeff17520f1"
130
130
  }