@uipath/maestro-builder-sdk 6.121.0 → 6.122.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.
@@ -1274,10 +1274,11 @@ export interface DataServiceOpts extends ActivityOpts {
1274
1274
  * selects — by the folder's PATH, `{ name: 'Orders', folder: 'Finance/Prod' }`.
1275
1275
  * `check` prints the `registry prepare --entity` command that records its keys, and
1276
1276
  * `compile` writes them; with no `folder`, prepare searches every folder. The keyed
1277
- * form `{ name, folderKey }` takes a folder key already in hand ({@link DataServiceFolderEntity}).
1278
- * A folder-scoped entity is written with the connector's `_V3` operations, as V1 nodes
1279
- * (`entityScope=folder`, `folderEntityName`, `folderEntityName_folderKey`). Not to be
1280
- * confused with `folder`, which is where the CONNECTION lives.
1277
+ * form `{ name, folderKey }` takes a folder key already in hand ({@link DataServiceFolderEntity});
1278
+ * its keys are recorded with `registry prepare --entity <name> --folder-key <key>`.
1279
+ * A folder-scoped entity is written with the connector's `_V3` operations, as the V2
1280
+ * nodes Studio Web saves with the entity as a solution-resource picker (delete as a V1
1281
+ * node). Not to be confused with `folder`, which is where the CONNECTION lives.
1281
1282
  */
1282
1283
  entity: DataServiceEntity;
1283
1284
  /**
@@ -2781,12 +2782,13 @@ declare abstract class ScopeBuilder {
2781
2782
  * **A folder-scoped entity** — one Studio Web's entity picker lists under an
2782
2783
  * Orchestrator folder rather than at tenant level — is `entity: { name, folder }`, the
2783
2784
  * folder's PATH. `check` prints the `registry prepare --entity` command that records its
2784
- * keys, and `compile` writes them: the record operations (create, update, get, query,
2785
- * delete) then write the connector's `_V3` operation as a V1 node (the V2 catalog does
2786
- * not list `_V3`), which selects the entity with
2787
- * `entityScope=folder`, `folderEntityName` and `folderEntityName_folderKey` query rows,
2788
- * and the process carries the entity's two `Entity` bindings for `bpmn refresh`. The file
2789
- * operations refuse it. `entity.folder` is the entity's folder; `folder` stays the
2785
+ * keys, and `compile` writes them: create, update, get and query then write the
2786
+ * connector's `_V3` operation as the V2 node Studio Web's panel saves, the entity a
2787
+ * solution-resource picker on its `resource="entity"` binding pair, which `bpmn refresh`
2788
+ * packages so a deploy can re-point it. Delete writes the `_V3` operation as a V1 node,
2789
+ * the pair beside it; the design-time client cannot build its V2 form. `{ name, folderKey }`
2790
+ * compiles from the same row, recorded with `--folder-key`. The file operations refuse a
2791
+ * folder-scoped entity. `entity.folder` is the entity's folder; `folder` stays the
2790
2792
  * connection's.
2791
2793
  *
2792
2794
  * @example
@@ -5,7 +5,7 @@ import { bindingRequiredFields, REGISTRY_GAPS, registryType } from './typed-node
5
5
  import { resolveResourceKeyPattern } from './resource-key-pattern.js';
6
6
  import { quickHumanTaskRows } from './human-task-form.js';
7
7
  import { CompileRefusal } from '../core/compile-refusal.js';
8
- import { DATA_SERVICE_ACTIVITY_TYPE, dataServiceContext, dataServiceWire, isPendingEntity, refuseEntityShape, } from './data-service.js';
8
+ import { DATA_SERVICE_ACTIVITY_TYPE, dataServiceContext, dataServiceWire, isPendingEntity, pendsOnFolderKeyRow, refuseEntityShape, } from './data-service.js';
9
9
  import { IMPLICIT_CONNECTION, IMPLICIT_CONNECTION_BINDING_ID, MANAGED_HTTP_CONNECTION_NAME, MANAGED_HTTP_CONNECTOR_KEY, MANAGED_HTTP_FOLDER_NAME, MANAGED_HTTP_TYPE, managedHttpContext, managedHttpInputs, managedHttpOutputs, } from './managed-http.js';
10
10
  import { ownEntry } from '../core/own-entry.js';
11
11
  export { BpmnBuildError } from './bpmn-expr-check.js';
@@ -1188,12 +1188,13 @@ class ScopeBuilder {
1188
1188
  * **A folder-scoped entity** — one Studio Web's entity picker lists under an
1189
1189
  * Orchestrator folder rather than at tenant level — is `entity: { name, folder }`, the
1190
1190
  * folder's PATH. `check` prints the `registry prepare --entity` command that records its
1191
- * keys, and `compile` writes them: the record operations (create, update, get, query,
1192
- * delete) then write the connector's `_V3` operation as a V1 node (the V2 catalog does
1193
- * not list `_V3`), which selects the entity with
1194
- * `entityScope=folder`, `folderEntityName` and `folderEntityName_folderKey` query rows,
1195
- * and the process carries the entity's two `Entity` bindings for `bpmn refresh`. The file
1196
- * operations refuse it. `entity.folder` is the entity's folder; `folder` stays the
1191
+ * keys, and `compile` writes them: create, update, get and query then write the
1192
+ * connector's `_V3` operation as the V2 node Studio Web's panel saves, the entity a
1193
+ * solution-resource picker on its `resource="entity"` binding pair, which `bpmn refresh`
1194
+ * packages so a deploy can re-point it. Delete writes the `_V3` operation as a V1 node,
1195
+ * the pair beside it; the design-time client cannot build its V2 form. `{ name, folderKey }`
1196
+ * compiles from the same row, recorded with `--folder-key`. The file operations refuse a
1197
+ * folder-scoped entity. `entity.folder` is the entity's folder; `folder` stays the
1197
1198
  * connection's.
1198
1199
  *
1199
1200
  * @example
@@ -1221,12 +1222,16 @@ class ScopeBuilder {
1221
1222
  */
1222
1223
  dataService(id, opts, body) {
1223
1224
  refuseEntityShape(id, opts.entity);
1224
- // `{ name, folder }` carries the tenant form until serialize lowers it from the row.
1225
- const pending = isPendingEntity(opts.entity)
1226
- ? { ref: { name: opts.entity.name, ...(opts.entity.folder !== undefined ? { folder: opts.entity.folder } : {}) }, operation: opts }
1227
- : undefined;
1228
- const wire = dataServiceWire(pending ? pending.ref.name : opts.entity, opts);
1225
+ // `{ name, folder }`, and `{ name, folderKey }` on a record operation with a V2 form,
1226
+ // carry a placeholder wire until serialize lowers them from the recorded row: the
1227
+ // tenant form for the first, the V1 form (which also validates the entity) for the second.
1228
+ const entity = opts.entity;
1229
+ const ref = isPendingEntity(entity)
1230
+ ? { name: entity.name, ...(entity.folder !== undefined ? { folder: entity.folder } : {}) }
1231
+ : pendsOnFolderKeyRow(entity, opts) ? { name: entity.name, folderKey: entity.folderKey } : undefined;
1232
+ const wire = dataServiceWire(isPendingEntity(entity) ? entity.name : entity, opts);
1229
1233
  const connection = this.dataServiceBinding(id, 'connection', opts.connection, 'ConnectionId', 'Data Fabric connection');
1234
+ const pending = ref !== undefined ? { ref, operation: opts, connectionKey: connection.key } : undefined;
1230
1235
  const folder = opts.folder !== undefined
1231
1236
  ? this.dataServiceBinding(id, 'folder', opts.folder, 'folderKey', 'Data Fabric folder', connection.key)
1232
1237
  : undefined;
@@ -7,7 +7,8 @@
7
7
  * `telemetryData`), the `operation` verb, the `type` of each scalar row, the response
8
8
  * row's schema body, `activityConfigurationVersion`. Everything else about the task
9
9
  * must come back exactly: the element and its name, every other context row, every
10
- * payload row's name, target and value, every output row's name, source and variable.
10
+ * payload row's name, target and value, every output row's name, source and variable,
11
+ * and a resource picker's selections inside `metadata` ({@link pickerOf}).
11
12
  * This builds the lifted source, compiles it with the same library, and compares each
12
13
  * lifted element against the original under exactly that list — so a lift that lost
13
14
  * an input, picked the wrong action or renamed a variable is refused, element by
@@ -18,6 +19,7 @@
18
19
  */
19
20
  import BpmnModdle from 'bpmn-moddle';
20
21
  import { createRequire } from 'node:module';
22
+ import { isRecord } from '../core/node-envelope.js';
21
23
  import { buildSource } from './lift-verify.js';
22
24
  import { builtChainSource } from '../core/builder-chain.js';
23
25
  import { serialize } from './serialize.js';
@@ -51,6 +53,51 @@ function bodyText(body) {
51
53
  function payloadOf(el) {
52
54
  return (el.extensionElements?.values ?? []).find((x) => x.$type === 'uipath:Activity');
53
55
  }
56
+ /**
57
+ * A resource picker's selections, out of the regenerated `metadata` row: the
58
+ * `savedResourceSelections` and the `bindings` entries they name, less the
59
+ * per-save `activityIdRef`. `.connector()` does not write a picker, so a lift of
60
+ * a picker node loses them, and comparing them here is what keeps that node
61
+ * verbatim. A node without a picker (no metadata, `null`, no saved selections)
62
+ * gives `null`, as before. Selections this cannot read give their raw text, which
63
+ * no lift reproduces, so the node stays verbatim.
64
+ */
65
+ function pickerOf(metadataBody) {
66
+ let meta;
67
+ try {
68
+ meta = JSON.parse(String(metadataBody));
69
+ }
70
+ catch {
71
+ return null;
72
+ }
73
+ if (!isRecord(meta) || !isRecord(meta.activityPropertyConfiguration))
74
+ return null;
75
+ const configuration = meta.activityPropertyConfiguration.configuration;
76
+ if (typeof configuration !== 'string' || !configuration.startsWith('=jsonString:'))
77
+ return null;
78
+ let essential;
79
+ try {
80
+ essential = JSON.parse(configuration.slice('=jsonString:'.length));
81
+ }
82
+ catch {
83
+ return { unreadable: configuration };
84
+ }
85
+ const saved = isRecord(essential) && isRecord(essential.essentialConfiguration)
86
+ ? essential.essentialConfiguration.savedResourceSelections
87
+ : undefined;
88
+ if (saved === undefined || saved === null)
89
+ return null;
90
+ if (!isRecord(saved) || !Object.values(saved).every((v) => typeof v === 'string'))
91
+ return { unreadable: stableJson(saved) };
92
+ if (Object.keys(saved).length === 0)
93
+ return null;
94
+ const keys = new Set(Object.values(saved));
95
+ const bindings = (Array.isArray(meta.bindings) ? meta.bindings : [])
96
+ .filter((b) => isRecord(b) && keys.has(String(b.key)))
97
+ .map(({ activityIdRef: _id, ...rest }) => stableJson(rest))
98
+ .sort();
99
+ return { saved, bindings };
100
+ }
54
101
  /**
55
102
  * The part of a connector task that a lift must reproduce, as one comparable
56
103
  * string. Row order does not matter (rows are sorted by name); a scalar row's
@@ -86,6 +133,7 @@ export function canonicalConnectorTask(el) {
86
133
  outputs,
87
134
  extensions,
88
135
  loop: el.loopCharacteristics ? plain(el.loopCharacteristics) : null,
136
+ picker: pickerOf((payload?.context?.input ?? []).find((r) => r.name === 'metadata')?.body),
89
137
  });
90
138
  }
91
139
  /** A moddle element as plain data: its own properties, recursively, without the `$`-prefixed bookkeeping. */
@@ -24,11 +24,26 @@
24
24
  * design-time `metadata` (`core/connector-v2-metadata.ts`). The parameter names,
25
25
  * targets, paths and catalog ids are `registry get`'s for those operations.
26
26
  *
27
- * A FOLDER-scoped entity (`entity: { name, folderKey }`, #1392) stays V1. Only the
28
- * connector's `_V3` operations (`CreateEntityRecord_V3`, …) take a folder, selecting the
29
- * entity with query parameters (`entityScope`, `folderEntityName` and
30
- * `folderEntityName_folderKey`), and Studio Web's V2 catalog does not list them: they
31
- * are "(Preview)" in the connector, and `registry get` finds no V2 element for them.
27
+ * A FOLDER-scoped entity (`{ name, folder }` or `{ name, folderKey }`, #1392) is
28
+ * addressed through the connector's `_V3` operations, the only ones that take a folder:
29
+ * they select the entity with query parameters (`entityScope`, `folderEntityName` and
30
+ * `folderEntityName_folderKey`). Studio Web's V2 panel saves create, update, get and
31
+ * query as V2 nodes on them, with `folderEntityName` a solution-resource picker
32
+ * (`core/resource-picker.ts`), and so does this: the picker and its folder are
33
+ * `=bindings.<id>` references to the entity's `resource="entity"` name / folderKey pair,
34
+ * the metadata saves the selection and the folder-entity schema replay, and `bpmn
35
+ * refresh` packages the entity into `bindings_v2.json` with `Scope: Folder`, so a deploy
36
+ * can re-point it. The picker saves the entity's resource KEY, which only `registry
37
+ * prepare --entity` knows, so both forms compile from its recorded row
38
+ * (docs/ENTITY_RESOLUTION_DESIGN.md §4.4; `--folder-key` for the keyed form). The
39
+ * shapes are `registry get --input-details --solution-folder`'s, captured in
40
+ * `tests/fixtures/bpmn/dataservice-folder-v2/`.
41
+ *
42
+ * Delete stays V1: the design-time client itself fails to build `DeleteEntityRecord_V3`
43
+ * with a picker, so there is no V2 save to match. Its entity's pair is still written,
44
+ * unreferenced, beside the literal task rows: the only place the process carries the
45
+ * resource key `bpmn refresh` declares the entity from. An `=`-expression folder key is
46
+ * V1 too, since no row can be recorded for it, and needs no prepare.
32
47
  *
33
48
  * The three FILE operations stay V1 too, in the curated form the Flow→BPMN converter
34
49
  * writes: `objectName` is the curated operation (`DownloadFileFromRecordField`, …), the
@@ -36,22 +51,10 @@
36
51
  * `_V3` operations declare no field-name parameter (the file field is a dynamic field
37
52
  * from the entity's schema), so where they take it is not known here, and they refuse a
38
53
  * folder-scoped entity rather than guess. Nothing here needs the connector library.
39
- *
40
- * **The task references no binding for the entity.** The Maestro designer's V2 path
41
- * mints a `resource="entity"` `name` / `folderKey` binding pair for the picker
42
- * (`createActivityBindingMinter`), records `savedResourceSelections`, and packages a
43
- * `Scope: "Folder"` entry into `bindings_v2.json`. This writes the picker's value as a
44
- * literal query parameter instead (#849), so a folder-scoped entity is fixed at compile
45
- * time, not re-pointable per environment at deploy.
46
- *
47
- * An entity named as `{ name, folder }` and resolved through `registry prepare --entity`
48
- * (docs/ENTITY_RESOLUTION_DESIGN.md §4.4) still writes the two `Entity` binding rows Flow
49
- * writes, unreferenced, beside the literal task rows: they are the only place the process
50
- * carries the entity's resource key, which `bpmn refresh` needs to declare the entity as a
51
- * solution resource. `validate` accepts them, and the decompiler keeps them.
52
54
  */
53
55
  import type { TypedInputRow } from './typed-node.js';
54
56
  import { type EntityRef, type ResourceResolutions } from '../core/resource-resolution.js';
57
+ import { type ResourcePickerSelection, PICKER_ENTITY_RESOURCE } from '../core/resource-picker.js';
55
58
  /** The connector key the tenant lists Data Fabric under. */
56
59
  export declare const DATA_SERVICE_CONNECTOR_KEY = "uipath-uipath-dataservice";
57
60
  /** The extension type every Integration Service activity dispatches through. */
@@ -144,7 +147,9 @@ export interface DataServiceFolderEntity {
144
147
  * The key of the Orchestrator folder the entity lives in (a GUID), or a `=`-expression
145
148
  * yielding it. An author who knows the folder's PATH writes `{ name, folder }` instead
146
149
  * ({@link EntityRef}) and lets `registry prepare --entity` find the key. A path here (`'Shared'`) is refused, since it would compile,
147
- * validate and fail at run time.
150
+ * validate and fail at run time. A key compiles from the row `registry prepare --entity
151
+ * <name> --folder-key <key>` records (a record operation's V2 form saves the entity's own
152
+ * key); an `=`-expression is written as given, in the V1 form, with no row.
148
153
  */
149
154
  folderKey: string;
150
155
  }
@@ -167,17 +172,21 @@ export declare function isFolderEntity(entity: DataServiceEntity): entity is Dat
167
172
  * reference and the operation until `serialize` has the rows (`lowerDataServiceEntity`).
168
173
  */
169
174
  export interface PendingDataServiceEntity {
170
- /** The entity as authored: its name, and the folder path it lives in. */
171
- ref: EntityRef;
175
+ /** The entity as authored: its name, and the folder path or folder key it lives in. */
176
+ ref: EntityRef & {
177
+ folderKey?: string;
178
+ };
172
179
  /** The operation and its parameters, for the wire the recorded row selects. */
173
180
  operation: DataServiceOperation;
181
+ /** The connection's key, which a V2 wire carries as `resourceKey`. */
182
+ connectionKey?: string;
174
183
  }
175
- /** One `Entity` binding row, in the order the serializer writes a binding's attributes. */
184
+ /** One entity binding row, in the order the serializer writes a binding's attributes. */
176
185
  export interface EntityBindingRow {
177
186
  id: string;
178
187
  name: string;
179
188
  type: 'string';
180
- resource: 'Entity';
189
+ resource: typeof PICKER_ENTITY_RESOURCE | 'Entity';
181
190
  resourceKey: string;
182
191
  default: string;
183
192
  propertyAttribute: 'name' | 'folderKey';
@@ -198,6 +207,20 @@ export interface DataServiceWire {
198
207
  queryParameters: Record<string, unknown>;
199
208
  bodyParameters: Record<string, unknown>;
200
209
  };
210
+ /** A V2 folder-entity wire's picker, which its metadata saves; the element id is the context's to add. */
211
+ picker?: Omit<ResourcePickerSelection, 'elementId'>;
212
+ }
213
+ /**
214
+ * A folder-scoped entity's recorded keys and its binding pair's ids: what the V2 `_V3`
215
+ * wire needs. The picker and its folder are `=bindings.<id>` references to the pair.
216
+ */
217
+ export interface FolderEntityPicker {
218
+ /** The entity's solution resource key. */
219
+ resourceKey: string;
220
+ /** The id of the pair's `name` binding. */
221
+ nameBinding: string;
222
+ /** The id of the pair's `folderKey` binding. */
223
+ folderBinding: string;
201
224
  }
202
225
  /**
203
226
  * The context and payload rows for one operation on one entity.
@@ -205,6 +228,8 @@ export interface DataServiceWire {
205
228
  * @param entity - The Data Service entity: a name, e.g. `'ContractRegistry'`, or a
206
229
  * folder-scoped `{ name, folderKey }`.
207
230
  * @param operation - Which operation, and its parameters.
231
+ * @param picker - For a folder-scoped entity, its recorded resource key and binding
232
+ * ids: a record operation other than delete is then the V2 `_V3` wire.
208
233
  * @returns The wire shape, without the connection/folder wiring the builder adds.
209
234
  * @throws CompileRefusal for a folder-scoped entity on a file operation (`BPMN_DATA_SERVICE_FOLDER_FILE_OP`), or one with no name
210
235
  * (`BPMN_DATA_SERVICE_ENTITY_NO_NAME`), no folder key (`BPMN_DATA_SERVICE_FOLDER_KEY_MISSING`) or a folder key that is not a
@@ -212,7 +237,7 @@ export interface DataServiceWire {
212
237
  * (`BPMN_DATA_SERVICE_QUERY_START_INVALID`) or whose literal `limit` is not one from 1 to 1000
213
238
  * (`BPMN_DATA_SERVICE_QUERY_LIMIT_INVALID`).
214
239
  */
215
- export declare function dataServiceWire(entity: string | DataServiceFolderEntity, operation: DataServiceOperation): DataServiceWire;
240
+ export declare function dataServiceWire(entity: string | DataServiceFolderEntity, operation: DataServiceOperation, picker?: FolderEntityPicker): DataServiceWire;
216
241
  /**
217
242
  * Refuse an entity whose shape cannot compile, at the call that wrote it:
218
243
  * `{ folder }` beside `{ folderKey }` (ENTITY_SCOPE_MIXED — `folder` resolves its
@@ -224,18 +249,35 @@ export declare function refuseEntityShape(id: string, entity: DataServiceEntity)
224
249
  /** True when `entity` is `{ name, folder }`, whose wire waits for the recorded row. */
225
250
  export declare function isPendingEntity(entity: DataServiceEntity): entity is EntityRef;
226
251
  /**
227
- * The wire for a `{ name, folder }` entity from the row `registry prepare --entity`
228
- * recorded: the V1 `_V3` folder form and the two `Entity` binding rows for a folder-scoped
229
- * entity, exactly as `{ name, folderKey }` writes the task; the tenant form and no
230
- * bindings for a tenant-level one. `check` calls this too, so the two cannot disagree.
252
+ * True when a `{ name, folderKey }` entity's wire waits for the recorded row too: a
253
+ * record operation that has a V2 `_V3` form ({@link FOLDER_RECORD_OPERATIONS}), on a
254
+ * folder KEY rather than an `=`-expression. The V2 wire saves the entity's resource
255
+ * key, which the folder key alone does not give, so `prepare --entity <name>
256
+ * --folder-key <key>` records it. Delete, the file operations and an expression
257
+ * folder stay the V1 form, which needs no row.
258
+ */
259
+ export declare function pendsOnFolderKeyRow(entity: DataServiceEntity, operation: DataServiceOperation): entity is DataServiceFolderEntity;
260
+ /**
261
+ * The wire for a pending entity from the row `registry prepare --entity` recorded.
262
+ *
263
+ * A folder-scoped row gives the entity's binding pair, and a wire that takes the pair's
264
+ * final ids: the serializer settles them first (two entities cannot share one). A record
265
+ * operation other than delete is then the V2 `_V3` form, which references the pair as
266
+ * Studio Web's picker does; delete and the file operations are the V1 form, beside which
267
+ * the pair is unreferenced and carries the resource key `bpmn refresh` declares the
268
+ * entity from. A tenant row gives the tenant form and no bindings. `check` runs the
269
+ * serializer, so the two cannot disagree.
231
270
  *
232
271
  * @throws CompileRefusal `RESOURCE_UNRESOLVED` or `RESOURCE_ROW_INCOMPLETE` from
233
- * `resolveEntityRef`, prefixed with the node; `BPMN_DATA_SERVICE_FOLDER_FILE_OP` for a
234
- * file operation on an entity that resolved to a folder.
272
+ * `resolveRecordedResource`, prefixed with the node; `BPMN_DATA_SERVICE_FOLDER_FILE_OP`
273
+ * (from the wire) for a file operation on an entity that resolved to a folder.
235
274
  */
236
275
  export declare function lowerDataServiceEntity(id: string, pending: PendingDataServiceEntity, resources: ResourceResolutions | undefined): {
237
- wire: DataServiceWire;
238
276
  bindings: EntityBindingRow[];
277
+ wire: (ids?: {
278
+ name: string;
279
+ folder: string;
280
+ }) => DataServiceWire;
239
281
  };
240
282
  /** The connection wiring of a `.dataService()` task: `=bindings.<id>` references, and the connection's key. */
241
283
  export interface DataServiceWiring {
@@ -243,6 +285,8 @@ export interface DataServiceWiring {
243
285
  /** The connection's key, which a V2 node also carries as `resourceKey`. */
244
286
  resourceKey: string;
245
287
  folderKey?: string;
288
+ /** The task's element id, which seeds a picker's `activityIdRef`; needed only for a wire with a picker. */
289
+ elementId?: string;
246
290
  }
247
291
  /**
248
292
  * The `uipath:context` values of a `.dataService()` task, in the order the canvas writes