@uipath/maestro-builder-sdk 6.82.8 → 6.84.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.
@@ -12,47 +12,37 @@
12
12
  * a bare UUID JSON-quoted, and no folder binding at all — every one a reason a task
13
13
  * that the Flow arm passed failed here.
14
14
  *
15
- * The shapes below are copied from what the Flow→BPMN converter writes for the same
16
- * operations (the `v1` arm of the same run; `research/bpmn-roundtrip/corpus/` has the
17
- * Studio Web originals for the query and get forms), which is the shape the graders
18
- * compare against and the one the platform dispatches on. Two forms exist and both
19
- * are real:
15
+ * A tenant-level entity's five RECORD operations are V2 nodes
16
+ * (`activityConfigurationVersion: v2`, #1298), in the shape `uip maestro bpmn registry
17
+ * get Intsvc.ActivityExecution --object-name <Op> --input-details …` builds, which is the
18
+ * one Studio Web's V2 connector panel saves. They are the curated operations Studio
19
+ * Web's V2 catalog lists (`CreateEntityRecordCurated`, `UpdateEntityRecordV2`,
20
+ * `GetEntityRecordByIdCurated`, `QueryEntityRecordsCurated`,
21
+ * `DeleteEntityRecordCurated`): the entity is the `entityName` path parameter, in the
22
+ * `pathParameters` json row, the record id and the query's options are the
23
+ * `queryParameters` row, the record is the `body` row, and the context carries the
24
+ * design-time `metadata` (`core/connector-v2-metadata.ts`). The parameter names,
25
+ * targets, paths and catalog ids are `registry get`'s for those operations.
20
26
  *
21
- * - the **entity form** for create and update — `objectName` is the ENTITY, the path
22
- * is `/<Entity>` or `/<Entity>/{id}`, and `operation` is `Create` / `Replace`;
23
- * - the **curated form** for everything else — `objectName` is a curated operation
24
- * (`GetEntityRecordByIdCurated`, `QueryEntityRecordsCurated`,
25
- * `DeleteEntityRecordCurated`, `DownloadFileFromRecordField`, …), the entity travels
26
- * as the `entityName` PATH parameter, and `operation` is the CRUD verb of the
27
- * underlying HTTP method (`List` for GET, `Create` for POST, `Delete` for DELETE).
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.
28
32
  *
29
- * Every parameter is its own `uipath:input` row, `target`-tagged `path` / `query` /
30
- * `file`, and typed as the converter types it (`integer` for `start`, `limit`,
31
- * `expansionLevel`); only the record itself is a json `body` row. Nothing here needs
32
- * the connector library.
33
+ * The three FILE operations stay V1 too, in the curated form the Flow→BPMN converter
34
+ * writes: `objectName` is the curated operation (`DownloadFileFromRecordField`, …), the
35
+ * entity, record and field travel as PATH rows, and `operation` is the CRUD verb. Their
36
+ * `_V3` operations declare no field-name parameter (the file field is a dynamic field
37
+ * from the entity's schema), so where they take it is not known here, and they refuse a
38
+ * folder-scoped entity rather than guess. Nothing here needs the connector library.
33
39
  *
34
- * A **folder-scoped** entity (`entity: { name, folderKey }`, #1392) has a third form: the
35
- * connector's `_V3` operations (`CreateEntityRecord_V3`, …), which select the entity with
36
- * query parameters instead of the path — `entityScope=folder`, the solution-resource
37
- * picker `folderEntityName`, and its companion `folderEntityName_folderKey`, the
38
- * Orchestrator folder the entity lives in. The parameter names, targets and paths are
39
- * `uip is resources describe uipath-uipath-dataservice <Op>_V3`'s. The `_V3` file operations
40
- * declare no field-name parameter (the file field is a dynamic field from the entity's
41
- * schema), so where they take it is not known here, and they refuse a folder-scoped
42
- * entity rather than guess.
43
- *
44
- * **The task references no binding for the entity.** The Maestro designer (PO.Frontend
45
- * `IntsvcActivityProperties.tsx`) has two paths. Its V1 path, which writes this per-row
46
- * shape, renders the connector with `enableResourceFields: false`: there is no resource
47
- * picker, so the entity and folder are literal rows. Only its V2 path — a solution, an
48
- * `activityConfigurationVersion` of `v2`, the parameters as one `queryParameters` json
49
- * input and Studio Web's serialized configuration in `metadata` — mints the
50
- * `resource="entity"` `name` / `folderKey` binding pair (`createActivityBindingMinter`),
51
- * records `savedResourceSelections`, and packages a `Scope: "Folder"` entry into
52
- * `bindings_v2.json`. That configuration blob is the design-time client's output, which
53
- * nothing in the SDK can build offline — the same gap as Flow's #849. Until a V2 connector
54
- * emitter exists, a folder-scoped entity is fixed at compile time, not re-pointable per
55
- * environment at deploy.
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.
56
46
  *
57
47
  * An entity named as `{ name, folder }` and resolved through `registry prepare --entity`
58
48
  * (docs/ENTITY_RESOLUTION_DESIGN.md §4.4) still writes the two `Entity` binding rows Flow
@@ -73,26 +63,26 @@ export declare const DATA_SERVICE_ACTIVITY_TYPE = "Intsvc.ActivityExecution";
73
63
  * `'=js:`dueDate < \'${vars.cutoff}\'`'`) exactly as any other input does.
74
64
  */
75
65
  export type DataServiceOperation = {
76
- /** Create one record — `POST /<Entity>`. The response is the created record, `Id` included. */
66
+ /** Create one record — `CreateEntityRecordCurated`. The response is the created record, `Id` included. */
77
67
  op: 'create';
78
68
  /** The record's fields, by the entity's field names. */
79
69
  record: Record<string, unknown>;
80
70
  } | {
81
- /** Replace one record — `PUT /<Entity>/{id}`. */
71
+ /** Replace one record — `UpdateEntityRecordV2`. */
82
72
  op: 'update';
83
73
  /** The record's `Id`. */
84
74
  id: string;
85
75
  /** The record's fields, by the entity's field names. */
86
76
  record: Record<string, unknown>;
87
77
  } | {
88
- /** Read one record by id — the curated `GetEntityRecordByIdCurated`. */
78
+ /** Read one record by id — `GetEntityRecordByIdCurated`. */
89
79
  op: 'get';
90
80
  /** The record's `Id`. */
91
81
  recordId: string;
92
82
  /** How many levels of related records to expand into the response. */
93
83
  expansionLevel?: number;
94
84
  } | {
95
- /** Query records with a filter — the curated `QueryEntityRecordsCurated`. */
85
+ /** Query records with a filter — `QueryEntityRecordsCurated`. */
96
86
  op: 'query';
97
87
  /** The filter, in the Data Service query language, e.g. `"status = 'Open'"` or `"contractTitle IS NULL"`. Omit for every record. */
98
88
  where?: string;
@@ -115,7 +105,7 @@ export type DataServiceOperation = {
115
105
  /** How many levels of related records to expand into each result. */
116
106
  expansionLevel?: number;
117
107
  } | {
118
- /** Delete one record — the curated `DeleteEntityRecordCurated`. */
108
+ /** Delete one record — `DeleteEntityRecordCurated`. */
119
109
  op: 'delete';
120
110
  /** The record's `Id`. */
121
111
  recordId: string;
@@ -196,10 +186,18 @@ export interface EntityBindingRow {
196
186
  export interface DataServiceWire {
197
187
  /** A display name when the author gave none, e.g. `Create ContractRegistry`. */
198
188
  label: string;
199
- /** The `uipath:context` rows that identify the operation — `operation`, `objectName`, `method`, `path`. */
189
+ /** The `uipath:context` rows that identify the operation — `objectName`, `method`, `path`, and a V1 one's `operation`. */
200
190
  context: Record<string, string>;
201
- /** The payload rows, one per parameter plus the body. */
191
+ /** The payload rows: a V2 operation's json `queryParameters` / `body` rows, a V1 one's row per parameter plus the body. */
202
192
  inputRows: TypedInputRow[];
193
+ /** The catalog operation of a V2 wire; absent on a V1 (file or folder-entity) one. */
194
+ catalog?: CatalogOperation;
195
+ /** The routed parameters a V2 wire's metadata replays. */
196
+ slots?: {
197
+ pathParameters: Record<string, unknown>;
198
+ queryParameters: Record<string, unknown>;
199
+ bodyParameters: Record<string, unknown>;
200
+ };
203
201
  }
204
202
  /**
205
203
  * The context and payload rows for one operation on one entity.
@@ -225,7 +223,7 @@ export declare function refuseEntityShape(id: string, entity: DataServiceEntity)
225
223
  export declare function isPendingEntity(entity: DataServiceEntity): entity is EntityRef;
226
224
  /**
227
225
  * The wire for a `{ name, folder }` entity from the row `registry prepare --entity`
228
- * recorded: the `_V3` folder form and the two `Entity` binding rows for a folder-scoped
226
+ * recorded: the V1 `_V3` folder form and the two `Entity` binding rows for a folder-scoped
229
227
  * entity, exactly as `{ name, folderKey }` writes the task; the tenant form and no
230
228
  * bindings for a tenant-level one. `check` calls this too, so the two cannot disagree.
231
229
  *
@@ -237,9 +235,32 @@ export declare function lowerDataServiceEntity(id: string, pending: PendingDataS
237
235
  wire: DataServiceWire;
238
236
  bindings: EntityBindingRow[];
239
237
  };
238
+ /** The connection wiring of a `.dataService()` task: `=bindings.<id>` references, and the connection's key. */
239
+ export interface DataServiceWiring {
240
+ connection: string;
241
+ /** The connection's key, which a V2 node also carries as `resourceKey`. */
242
+ resourceKey: string;
243
+ folderKey?: string;
244
+ }
240
245
  /**
241
246
  * The `uipath:context` values of a `.dataService()` task, in the order the canvas writes
242
- * them. `connection` and `folderKey` are the `=bindings.<id>` references to the
243
- * connection's bindings; the rest is the operation's.
247
+ * them: the connection wiring, the operation's identity, and for a V2 operation the
248
+ * design-time `metadata` and the version.
244
249
  */
245
- export declare function dataServiceContext(wire: DataServiceWire, connection: string, folderKey: string | undefined): Record<string, unknown>;
250
+ export declare function dataServiceContext(wire: DataServiceWire, wiring: DataServiceWiring): Record<string, unknown>;
251
+ /**
252
+ * One curated record operation as Studio Web's V2 catalog lists it: the context rows
253
+ * that name it, the configuration's verb, and the catalog entry.
254
+ */
255
+ export interface CatalogOperation {
256
+ objectName: string;
257
+ /** The operation's verb, as the configuration and telemetry spell it. */
258
+ verb: string;
259
+ method: string;
260
+ path: string;
261
+ /** Studio Web's catalog type id. */
262
+ activityTypeId: string;
263
+ displayName: string;
264
+ description: string;
265
+ label: (entity: string) => string;
266
+ }
@@ -1,6 +1,8 @@
1
1
  import { CompileRefusal } from '../core/compile-refusal.js';
2
2
  import { entityPrepareCommand, isEntityRef, resolveEntityRef } from '../core/resource-resolution.js';
3
3
  import { ownEntry } from '../core/own-entry.js';
4
+ import { connectorActivityMetadata } from '../core/connector-v2-metadata.js';
5
+ import { ACTIVITY_CONFIGURATION_V2 } from './connector.js';
4
6
  /** The connector key the tenant lists Data Fabric under. */
5
7
  export const DATA_SERVICE_CONNECTOR_KEY = 'uipath-uipath-dataservice';
6
8
  /** The extension type every Integration Service activity dispatches through. */
@@ -30,56 +32,11 @@ export function dataServiceWire(entity, operation) {
30
32
  const attachment = '/Attachment/{entityName}/{recordId}/{fieldName}';
31
33
  switch (operation.op) {
32
34
  case 'create':
33
- return {
34
- label: `Create ${entity}`,
35
- context: { operation: 'Create', objectName: entity, method: 'POST', path: `/${entity}` },
36
- inputRows: [bodyRow(operation.record)],
37
- };
38
35
  case 'update':
39
- return {
40
- label: `Update ${entity}`,
41
- context: { operation: 'Replace', objectName: entity, method: 'PUT', path: `/${entity}/{id}` },
42
- inputRows: [scalarRow('id', 'path', operation.id), bodyRow(operation.record)],
43
- };
44
36
  case 'get':
45
- return {
46
- label: `Get ${entity} record`,
47
- context: { operation: 'List', objectName: 'GetEntityRecordByIdCurated', method: 'GET', path: '/v2/{entityName}/GetEntityRecord' },
48
- inputRows: [
49
- scalarRow('entityName', 'path', entity),
50
- scalarRow('recordId', 'query', operation.recordId),
51
- ...optionalRow('expansionLevel', 'query', operation.expansionLevel),
52
- ],
53
- };
54
37
  case 'query':
55
- return {
56
- label: `Query ${entity}`,
57
- context: { operation: 'Create', objectName: 'QueryEntityRecordsCurated', method: 'POST', path: '/v2/{entityName}/qer' },
58
- inputRows: [
59
- scalarRow('entityName', 'path', entity),
60
- ...optionalRow('queryExpression', 'query', operation.where),
61
- scalarRow('start', 'query', operation.start ?? 0),
62
- scalarRow('limit', 'query', operation.limit ?? 100),
63
- ...optionalRow('isAscending', 'query', operation.ascending),
64
- ...optionalRow('expansionLevel', 'query', operation.expansionLevel),
65
- // The sort FIELD rides in the body as `_sortFieldName` — the name the curated
66
- // operation's `RequestFields` declare (`uip is resources describe
67
- // uipath-uipath-dataservice QueryEntityRecordsCurated --operation Create`), and
68
- // the only place the connector reads it: as a query parameter it is ignored and
69
- // the query comes back in default order. This used to write `sortBy` as a query
70
- // row; on flow-v2-run-12 the Query node so built validated and failed
71
- // `no Query node sorted by priority DESC` (datafabric-e2e-contract-intake-pipeline
72
- // 1.00 → 0.45) while the v1 arm wrote `{"_sortFieldName":"priority"}` by hand.
73
- // `isAscending` stays a query parameter, which is where the connector reads it.
74
- ...(operation.sortBy !== undefined ? [bodyRow({ _sortFieldName: operation.sortBy })] : []),
75
- ],
76
- };
77
38
  case 'delete':
78
- return {
79
- label: `Delete ${entity} record`,
80
- context: { operation: 'Create', objectName: 'DeleteEntityRecordCurated', method: 'POST', path: '/v2/{entityName}/DeleteEntityRecord' },
81
- inputRows: [scalarRow('entityName', 'path', entity), scalarRow('recordId', 'query', operation.recordId)],
82
- };
39
+ return recordWire(entity, operation);
83
40
  case 'downloadFile':
84
41
  return {
85
42
  label: `Download ${entity}.${operation.field}`,
@@ -130,7 +87,7 @@ export function isPendingEntity(entity) {
130
87
  }
131
88
  /**
132
89
  * The wire for a `{ name, folder }` entity from the row `registry prepare --entity`
133
- * recorded: the `_V3` folder form and the two `Entity` binding rows for a folder-scoped
90
+ * recorded: the V1 `_V3` folder form and the two `Entity` binding rows for a folder-scoped
134
91
  * entity, exactly as `{ name, folderKey }` writes the task; the tenant form and no
135
92
  * bindings for a tenant-level one. `check` calls this too, so the two cannot disagree.
136
93
  *
@@ -172,23 +129,97 @@ function entityBindings(name, folderKey, resourceKey) {
172
129
  }
173
130
  /**
174
131
  * The `uipath:context` values of a `.dataService()` task, in the order the canvas writes
175
- * them. `connection` and `folderKey` are the `=bindings.<id>` references to the
176
- * connection's bindings; the rest is the operation's.
132
+ * them: the connection wiring, the operation's identity, and for a V2 operation the
133
+ * design-time `metadata` and the version.
177
134
  */
178
- export function dataServiceContext(wire, connection, folderKey) {
135
+ export function dataServiceContext(wire, wiring) {
136
+ const { connection, resourceKey, folderKey } = wiring;
137
+ if (wire.catalog === undefined) {
138
+ return {
139
+ // `activity` is the selected-operation key the canvas validator requires of a
140
+ // V1 node (EMPTY_REQUIRED_FIELD without it); the converter omits it and the CLI
141
+ // accepts both, so it carries the same verb `operation` does.
142
+ activity: wire.context.operation,
143
+ connectorKey: DATA_SERVICE_CONNECTOR_KEY,
144
+ connection,
145
+ ...(folderKey !== undefined ? { folderKey } : {}),
146
+ ...wire.context,
147
+ activityConfigurationVersion: 'v1',
148
+ metadata: {},
149
+ };
150
+ }
179
151
  return {
180
- // `activity` is the selected-operation key the canvas validator requires
181
- // (EMPTY_REQUIRED_FIELD without it); the converter omits it and the CLI accepts
182
- // both, so it carries the same verb `operation` does — as `.connector()` writes it.
183
- activity: wire.context.operation,
184
152
  connectorKey: DATA_SERVICE_CONNECTOR_KEY,
185
153
  connection,
154
+ resourceKey,
186
155
  ...(folderKey !== undefined ? { folderKey } : {}),
187
156
  ...wire.context,
188
- activityConfigurationVersion: 'v1',
189
- metadata: {},
157
+ metadata: dataServiceMetadata(wire.catalog, wire.slots),
158
+ activityConfigurationVersion: ACTIVITY_CONFIGURATION_V2,
190
159
  };
191
160
  }
161
+ /** The connector as Studio Web's catalog names it, for the metadata's catalog entry. */
162
+ const DATA_SERVICE_CONNECTOR_NAME = 'UiPath Data Fabric';
163
+ /**
164
+ * The design-time `metadata` of a V2 record operation, from the shared builder: the
165
+ * operation is described here rather than resolved from the library, which ships
166
+ * only `query-entity-records`.
167
+ */
168
+ function dataServiceMetadata(catalog, slots) {
169
+ const operation = {
170
+ name: catalog.verb,
171
+ objectName: catalog.objectName,
172
+ objectDisplayName: catalog.displayName,
173
+ httpMethod: catalog.method,
174
+ path: catalog.path,
175
+ activityType: 'Curated',
176
+ supportsStreaming: false,
177
+ subType: 'standard',
178
+ };
179
+ const metadata = connectorActivityMetadata({
180
+ entry: { connector: { key: DATA_SERVICE_CONNECTOR_KEY }, operation, display: { label: catalog.displayName, description: catalog.description } },
181
+ version: '1.0.0',
182
+ activityTypeId: catalog.activityTypeId,
183
+ nodeType: `uipath.connector.${DATA_SERVICE_CONNECTOR_KEY}.${catalog.objectName}`,
184
+ connectorKey: DATA_SERVICE_CONNECTOR_KEY,
185
+ connectorName: DATA_SERVICE_CONNECTOR_NAME,
186
+ }, operation, slots, catalog.objectName);
187
+ // A list operation's paging, as Studio Web saves the query (`maxPageSize` is the connector's).
188
+ return catalog.verb === 'list' ? { ...metadata, inputMetadata: { operation: 'list', pagination: { maxPageSize: 1000 } } } : metadata;
189
+ }
190
+ /**
191
+ * The five curated record operations, from `uip maestro bpmn registry get
192
+ * Intsvc.ActivityExecution --object-name <Op> --input-details '{}'` after a forced
193
+ * `registry pull` (uip 1.206, alpha, 2026-11-05).
194
+ */
195
+ const RECORD_OPERATIONS = {
196
+ create: {
197
+ objectName: 'CreateEntityRecordCurated', verb: 'create', method: 'POST', path: '/v2/{entityName}/CreateEntityRecord',
198
+ activityTypeId: 'dfd2bc7a-ca4b-3316-8a1f-57c9e106dfbf', displayName: 'Create Entity Record',
199
+ description: 'Creates a new record for the selected Entity in Data Fabric', label: (e) => `Create ${e}`,
200
+ },
201
+ update: {
202
+ objectName: 'UpdateEntityRecordV2', verb: 'replace', method: 'PUT', path: '/v2/{entityName}/UpdateEntityRecord',
203
+ activityTypeId: '718fdc36-73a8-3607-8604-ddef95bb9967', displayName: 'Update Entity Record',
204
+ description: 'Updates an existing record in a Data Fabric entity', label: (e) => `Update ${e}`,
205
+ },
206
+ get: {
207
+ objectName: 'GetEntityRecordByIdCurated', verb: 'retrieve', method: 'GET', path: '/v2/{entityName}/GetEntityRecord',
208
+ activityTypeId: '81291b95-ff0c-3822-bdaa-3065391c1997', displayName: 'Get Entity Record by ID',
209
+ description: 'Reads an existing record for the selected entity from Data Fabric', label: (e) => `Get ${e} record`,
210
+ },
211
+ query: {
212
+ objectName: 'QueryEntityRecordsCurated', verb: 'list', method: 'POST', path: '/v2/{entityName}/qer',
213
+ activityTypeId: '703065b9-a310-33b8-9d4d-12df0a6f520b', displayName: 'Query Entity Records',
214
+ description: 'Retrieves a list of records for the selected Entity from Data Fabric, according to specified filters.',
215
+ label: (e) => `Query ${e}`,
216
+ },
217
+ delete: {
218
+ objectName: 'DeleteEntityRecordCurated', verb: 'delete', method: 'POST', path: '/v2/{entityName}/DeleteEntityRecord',
219
+ activityTypeId: '9c8029ee-ff5f-3b82-92cc-34cee15e9f1d', displayName: 'Delete Entity Record',
220
+ description: 'Deletes an existing record for the selected entity from Data Fabric', label: (e) => `Delete ${e} record`,
221
+ },
222
+ };
192
223
  /** The `_V3` scope rows' wire names, as `describe` declares them and the canvas writes them. */
193
224
  const FOLDER_SCOPE = {
194
225
  scopeParameter: 'entityScope',
@@ -227,8 +258,8 @@ function validateFolderEntity(entity) {
227
258
  }
228
259
  }
229
260
  /**
230
- * The `_V3` form for a folder-scoped entity. The three scope rows come first, then the
231
- * operation's own parameters, which `_V3` takes as query rows where the tenant forms
261
+ * The V1 `_V3` form for a folder-scoped entity. The three scope rows come first, then
262
+ * the operation's own parameters, which `_V3` takes as query rows where the tenant forms
232
263
  * use the path (`recordId`, never `id`).
233
264
  */
234
265
  function folderEntityWire(entity, operation) {
@@ -271,6 +302,66 @@ function folderEntityWire(entity, operation) {
271
302
  return wire([scalarRow('recordId', 'query', operation.recordId)]);
272
303
  }
273
304
  }
305
+ /**
306
+ * The V2 curated wire for a tenant-level entity's record operation: the entity as the
307
+ * `entityName` path parameter, the record id (`recordId`, never `id`) and the query's
308
+ * options as the `queryParameters` row, and the record, or a query's sort field, as
309
+ * the `body` row.
310
+ */
311
+ function recordWire(entity, operation) {
312
+ const catalog = ownEntry(RECORD_OPERATIONS, operation.op);
313
+ const defined = (params) => Object.fromEntries(Object.entries(params).filter(([, v]) => v !== undefined));
314
+ let query;
315
+ let body;
316
+ switch (operation.op) {
317
+ case 'create':
318
+ query = {};
319
+ body = operation.record;
320
+ break;
321
+ case 'update':
322
+ query = { recordId: operation.id };
323
+ body = operation.record;
324
+ break;
325
+ case 'get':
326
+ query = defined({ recordId: operation.recordId, expansionLevel: operation.expansionLevel });
327
+ break;
328
+ case 'query':
329
+ query = defined({
330
+ queryExpression: operation.where,
331
+ start: operation.start ?? 0,
332
+ limit: operation.limit ?? 100,
333
+ isAscending: operation.ascending,
334
+ expansionLevel: operation.expansionLevel,
335
+ });
336
+ // The sort FIELD rides in the body as `_sortFieldName` — the name the curated
337
+ // operation's `RequestFields` declare (`uip is resources describe
338
+ // uipath-uipath-dataservice QueryEntityRecordsCurated --operation Create`), and
339
+ // the only place the connector reads it: as a query parameter it is ignored and
340
+ // the query comes back in default order. This used to write `sortBy` as a query
341
+ // row; on flow-v2-run-12 the Query node so built validated and failed
342
+ // `no Query node sorted by priority DESC` (datafabric-e2e-contract-intake-pipeline
343
+ // 1.00 → 0.45). `isAscending` stays a query parameter, which is where the
344
+ // connector reads it.
345
+ if (operation.sortBy !== undefined)
346
+ body = { _sortFieldName: operation.sortBy };
347
+ break;
348
+ case 'delete':
349
+ query = { recordId: operation.recordId };
350
+ break;
351
+ }
352
+ const pathParameters = { entityName: entity };
353
+ return {
354
+ label: catalog.label(entity),
355
+ context: { objectName: catalog.objectName, method: catalog.method, path: catalog.path },
356
+ inputRows: [
357
+ { name: 'pathParameters', type: 'json', target: 'pathParameters', body: pathParameters },
358
+ { name: 'queryParameters', type: 'json', target: 'queryParameters', body: query },
359
+ ...(body !== undefined ? [bodyRow(body)] : []),
360
+ ],
361
+ catalog,
362
+ slots: { pathParameters, queryParameters: query, bodyParameters: body ?? {} },
363
+ };
364
+ }
274
365
  function fileFieldRows(entity, recordId, field) {
275
366
  return [scalarRow('entityName', 'path', entity), scalarRow('recordId', 'path', recordId), scalarRow('fieldName', 'path', field)];
276
367
  }
@@ -1,4 +1,5 @@
1
1
  import { typedNodeAdditionalOutputVars, typedNodeOutputVar } from './typed-node.js';
2
+ import { connectorEventErrorVar, intsvcOutputVar } from './intsvc-vars.js';
2
3
  /**
3
4
  * The variables a connector task's output rows land in.
4
5
  *
@@ -59,6 +60,13 @@ export function nodeDeclaredVars(n) {
59
60
  }
60
61
  if (n.kind === 'typed')
61
62
  return typedNodeDeclaredVars(n);
63
+ // A connector event or external task writes its own `response` row, and a
64
+ // connector event its `Error` row too; the serializer declares the same names.
65
+ if (n.kind === 'connectorEvent' || n.kind === 'externalTask') {
66
+ const response = intsvcOutputVar(n);
67
+ const error = n.kind === 'connectorEvent' ? [connectorEventErrorVar(n)] : [];
68
+ return [...(response ? [response] : []), ...error, ...Object.keys(n.outputs ?? {})];
69
+ }
62
70
  // Spelled-out rows REPLACE the derived ones, so they are the whole answer — the
63
71
  // same rule as `typedNodeDeclaredVars`. Reading only `outputs` here left a script
64
72
  // task authored with `outputRows` (the form decompile writes) declaring nothing,
@@ -20,6 +20,8 @@ export interface BpmnDecompileOptions {
20
20
  * it. A lift is best effort by construction and safe only with the check
21
21
  * `decompile-cli` runs (`verifyConnectorLifts`): the lifted call must compile to the
22
22
  * same task, those regenerated fields aside, or the element is written verbatim.
23
+ * Only a V2 task is lifted: `.connector()` writes V2, so a lifted V1 task would
24
+ * come back rewritten, and a V1 task stays verbatim whatever this says.
23
25
  */
24
26
  connectors?: 'lift' | 'verbatim';
25
27
  /** Connector tasks to write verbatim whatever `connectors` says — the ones a verify refused. */
@@ -270,8 +270,8 @@ const CONNECTOR_CONTEXT_ROWS = new Set([
270
270
  'connectorKey', 'operation', 'objectName', 'method', 'path', 'connection', 'folderKey', 'resourceKey',
271
271
  'metadata', 'activityConfigurationVersion', 'activity',
272
272
  ]);
273
- /** Row targets `.connector()` can address — the library's parameter locations plus the body. */
274
- const CONNECTOR_ROW_TARGETS = new Set(['path', 'query', 'body', 'multipart', 'file']);
273
+ /** The json payload rows of a V2 connector task that carry the parameters, by location. */
274
+ const CONNECTOR_PARAMETER_ROWS = new Set(['pathParameters', 'queryParameters']);
275
275
  /**
276
276
  * Plan every connector task's lift in `container` (sub-processes included): the id →
277
277
  * plan for the ones `.connector()` can express, and a reason for each one it cannot.
@@ -300,11 +300,10 @@ function bindingIdOf(value) {
300
300
  return m ? m[1] : undefined;
301
301
  }
302
302
  /**
303
- * A row's value as `.connector()` takes it: an `=`-expression as the string it is;
304
- * otherwise the literal, coerced to the type the library declares for the parameter,
305
- * because the file writes every scalar row as `type="string"` (`value="false"`,
306
- * `value="0"`) and the shared validator refuses a string where it declares a boolean
307
- * or an integer.
303
+ * A parameter's text as `.connector()` takes it: an `=`-expression as the string it
304
+ * is; otherwise the literal, coerced to the type the library declares for the
305
+ * parameter, because the shared validator refuses a string where it declares a
306
+ * boolean or an integer.
308
307
  */
309
308
  function liftedInputValue(raw, dataType) {
310
309
  if (raw.startsWith('='))
@@ -336,6 +335,11 @@ function planConnectorLift(el, payload) {
336
335
  if (rows.some((r) => r.required !== undefined || r.target !== undefined))
337
336
  return 'a context row carries attributes the record form cannot';
338
337
  const ctxString = (k) => (typeof ctx[k] === 'string' ? ctx[k] : undefined);
338
+ // `.connector()` writes a V2 node (#1298). A V1 one lifted would come back V2, and
339
+ // an edit of an existing workflow has to leave its V1 nodes as they are, so it
340
+ // stays verbatim.
341
+ if (ctxString('activityConfigurationVersion') !== 'v2')
342
+ return 'a V1 connector task, kept verbatim so it stays V1';
339
343
  const connectorKey = ctxString('connectorKey');
340
344
  if (!connectorKey)
341
345
  return 'no connectorKey';
@@ -368,35 +372,46 @@ function planConnectorLift(el, payload) {
368
372
  return `the library cannot resolve ${identity.key}/${identity.action}: ${e.message}`;
369
373
  }
370
374
  const inputs = {};
375
+ const take = (k, v, where) => {
376
+ if (k in inputs)
377
+ return `"${k}" appears both in ${where} and in another row`;
378
+ // `.connector()` validates every input against the library, and a field the
379
+ // static library does not declare — an entity's own columns on a Data Fabric
380
+ // update, a form's fields — is refused until `registry prepare` loads it.
381
+ if (!declared.has(k) && !declared.has(k.split('.')[0])) {
382
+ return `${where} field "${k}" is not in the library for ${identity.key}/${identity.action} (connection-specific; \`registry prepare\` loads it)`;
383
+ }
384
+ inputs[k] = v;
385
+ return undefined;
386
+ };
371
387
  for (const row of payload.input ?? []) {
372
388
  const target = row.target;
373
- if (target === undefined || !CONNECTOR_ROW_TARGETS.has(target)) {
389
+ if (target === 'file') {
390
+ if (row.type !== 'file')
391
+ return `file row "${row.name}" is not type="file"`;
392
+ // An unfilled file part is written with no value; there is nothing to lift.
393
+ if (row.value === undefined)
394
+ continue;
395
+ const refused = take(row.name, String(row.value), 'a file row');
396
+ if (refused)
397
+ return refused;
398
+ continue;
399
+ }
400
+ const json = target === 'body' || CONNECTOR_PARAMETER_ROWS.has(target ?? '');
401
+ if (!json || row.name !== target) {
374
402
  return `payload row "${row.name}" has ${target === undefined ? 'no target' : `target "${target}"`}`;
375
403
  }
376
- if (target === 'body') {
377
- if (row.name !== 'body')
378
- return `body row is named "${row.name}"`;
379
- const body = safeJson(row.body ?? '{}');
380
- if (!body || typeof body !== 'object' || Array.isArray(body))
381
- return 'the body row is not a JSON object';
382
- for (const [k, v] of Object.entries(body)) {
383
- if (k in inputs)
384
- return `"${k}" appears both as a parameter row and in the body`;
385
- // `.connector()` validates every input against the library, and a field the
386
- // static library does not declare — an entity's own columns on a Data Fabric
387
- // update, a form's fields — is refused until `registry prepare` loads it.
388
- if (!declared.has(k) && !declared.has(k.split('.')[0])) {
389
- return `body field "${k}" is not in the library for ${identity.key}/${identity.action} (connection-specific; \`registry prepare\` loads it)`;
390
- }
391
- inputs[k] = v;
392
- }
393
- continue;
404
+ const value = safeJson(row.body ?? '{}');
405
+ if (!value || typeof value !== 'object' || Array.isArray(value))
406
+ return `the ${row.name} row is not a JSON object`;
407
+ for (const [k, v] of Object.entries(value)) {
408
+ // A parameter Studio Web saved as text (`"start": "0"`) is coerced to the type
409
+ // the library declares, which the shared validator checks.
410
+ const lifted = row.name !== 'body' && typeof v === 'string' ? liftedInputValue(v, params.get(k)) : v;
411
+ const refused = take(k, lifted, `the ${row.name} row`);
412
+ if (refused)
413
+ return refused;
394
414
  }
395
- if (row.value === undefined)
396
- return `payload row "${row.name}" carries no value attribute`;
397
- if (row.name in inputs)
398
- return `payload row "${row.name}" appears twice`;
399
- inputs[row.name] = liftedInputValue(String(row.value), params.get(row.name));
400
415
  }
401
416
  let outputVar;
402
417
  let errorVar;
@@ -2130,7 +2145,7 @@ function bindingIsReferenced(xml, id) {
2130
2145
  * `bpmn refresh` learns the entity's resource key. Nothing names the pair by id, so
2131
2146
  * {@link bindingIsReferenced} would prune it; a pair is in use when some
2132
2147
  * `Intsvc.ActivityExecution` task's `folderEntityName` and `folderEntityName_folderKey`
2133
- * rows hold its name and folder key.
2148
+ * parameters hold its name and folder key.
2134
2149
  */
2135
2150
  function usedEntityKeys(bindings, container) {
2136
2151
  const used = new Set();
@@ -2141,7 +2156,12 @@ function usedEntityKeys(bindings, container) {
2141
2156
  const payload = payloadOf(el);
2142
2157
  if (!payload || extensionTypeOf(payload) !== 'Intsvc.ActivityExecution')
2143
2158
  continue;
2144
- const row = (name) => (payload.input ?? []).find((r) => r.name === name)?.value;
2159
+ // A V2 task carries the parameters in its `queryParameters` json row, a V1 one
2160
+ // as a row each.
2161
+ const rows = payload.input ?? [];
2162
+ const query = safeJson(rows.find((r) => r.name === 'queryParameters' && r.target === 'queryParameters')?.body ?? '{}');
2163
+ const row = (name) => (query && typeof query === 'object' && !Array.isArray(query) ? query[name] : undefined)
2164
+ ?? rows.find((r) => r.name === name)?.value;
2145
2165
  const name = row('folderEntityName');
2146
2166
  const folderKey = row('folderEntityName_folderKey');
2147
2167
  if (typeof name !== 'string' || typeof folderKey !== 'string')