@uipath/maestro-builder-sdk 6.83.0 → 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.
- package/dist/api-index.md +41 -41
- package/dist/api-members.md +160 -160
- package/dist/bpmn/bpmn-sdk.d.ts +33 -22
- package/dist/bpmn/bpmn-sdk.js +12 -9
- package/dist/bpmn/check.js +32 -2
- package/dist/bpmn/connector-lift-verify.js +3 -3
- package/dist/bpmn/connector.d.ts +17 -5
- package/dist/bpmn/connector.js +63 -119
- package/dist/bpmn/data-service.d.ts +70 -49
- package/dist/bpmn/data-service.js +149 -58
- package/dist/bpmn/declared-vars.js +8 -0
- package/dist/bpmn/decompile.d.ts +2 -0
- package/dist/bpmn/decompile.js +53 -33
- package/dist/bpmn/intsvc-vars.d.ts +38 -0
- package/dist/bpmn/intsvc-vars.js +44 -0
- package/dist/bpmn/intsvc.d.ts +6 -23
- package/dist/bpmn/intsvc.js +66 -77
- package/dist/bpmn/serialize.js +11 -3
- package/dist/case/serialize.js +6 -125
- package/dist/core/connector-configuration.js +3 -2
- package/dist/core/connector-v2-metadata.d.ts +67 -0
- package/dist/core/connector-v2-metadata.js +145 -0
- package/dist/core/refusals.d.ts +1 -0
- package/dist/core/refusals.js +1 -0
- package/package.json +2 -2
package/dist/bpmn/bpmn-sdk.d.ts
CHANGED
|
@@ -250,7 +250,7 @@ export type BpmnNode = {
|
|
|
250
250
|
/** Symbolic binding names, as `.connector()` takes them. */
|
|
251
251
|
connection?: string;
|
|
252
252
|
folder?: string;
|
|
253
|
-
/**
|
|
253
|
+
/** Not written: see {@link ConnectorEventOpts.folderPath}. */
|
|
254
254
|
folderPath?: string;
|
|
255
255
|
/** The `where` scope and extra event parameters, when the operation declares any. */
|
|
256
256
|
filter?: Record<string, unknown>;
|
|
@@ -1134,7 +1134,7 @@ export interface DataServiceOpts extends ActivityOpts {
|
|
|
1134
1134
|
* `check` prints the `registry prepare --entity` command that records its keys, and
|
|
1135
1135
|
* `compile` writes them; with no `folder`, prepare searches every folder. The keyed
|
|
1136
1136
|
* form `{ name, folderKey }` takes a folder key already in hand ({@link DataServiceFolderEntity}).
|
|
1137
|
-
* A folder-scoped entity is written with the connector's `_V3` operations
|
|
1137
|
+
* A folder-scoped entity is written with the connector's `_V3` operations, as V1 nodes
|
|
1138
1138
|
* (`entityScope=folder`, `folderEntityName`, `folderEntityName_folderKey`). Not to be
|
|
1139
1139
|
* confused with `folder`, which is where the CONNECTION lives.
|
|
1140
1140
|
*/
|
|
@@ -1510,9 +1510,9 @@ export interface ReceiveMessageOpts extends ActivityOpts {
|
|
|
1510
1510
|
*
|
|
1511
1511
|
* `connection` and `folder` are SYMBOLIC binding names, exactly as `.connector()`
|
|
1512
1512
|
* takes them — the offline rungs compile them to `=bindings.<name>` and only a live
|
|
1513
|
-
* run needs real ids. Both are required
|
|
1514
|
-
*
|
|
1515
|
-
*
|
|
1513
|
+
* run needs real ids. Both are required: the trigger is created on deploy in the
|
|
1514
|
+
* connection's folder, so a node missing either is refused at serialize rather than
|
|
1515
|
+
* by the CLI a build later.
|
|
1516
1516
|
*/
|
|
1517
1517
|
export interface ConnectorEventOpts extends ActivityOpts {
|
|
1518
1518
|
/** Display name; defaults to the descriptor's own label. */
|
|
@@ -1521,7 +1521,12 @@ export interface ConnectorEventOpts extends ActivityOpts {
|
|
|
1521
1521
|
connection: string;
|
|
1522
1522
|
/** Symbolic binding name for the folder. */
|
|
1523
1523
|
folder: string;
|
|
1524
|
-
/**
|
|
1524
|
+
/**
|
|
1525
|
+
* The folder path. Accepted and not written: the V1 event template took it beside
|
|
1526
|
+
* the folder key, and the V2 node names its folder by the `folder` binding alone.
|
|
1527
|
+
*
|
|
1528
|
+
* @deprecated The V2 node has no folder path; drop it.
|
|
1529
|
+
*/
|
|
1525
1530
|
folderPath?: string;
|
|
1526
1531
|
/** Pin the descriptor version, as `.connector()` does. */
|
|
1527
1532
|
version?: string;
|
|
@@ -1569,17 +1574,20 @@ export interface ConnectorEventOpts extends ActivityOpts {
|
|
|
1569
1574
|
filters?: EventFilter[];
|
|
1570
1575
|
/** Extra event parameters, for operations that declare them. */
|
|
1571
1576
|
parameters?: Record<string, unknown>;
|
|
1572
|
-
/**
|
|
1577
|
+
/**
|
|
1578
|
+
* Variable the event payload lands in. Defaults to `<id>_result`. The node's
|
|
1579
|
+
* `response` row (`source="=response"`) writes the payload itself, so a downstream
|
|
1580
|
+
* read is `=vars.<id>_result.<field>`; its `Error` row writes `<id>_Error`.
|
|
1581
|
+
*/
|
|
1573
1582
|
outputVar?: string;
|
|
1574
1583
|
/**
|
|
1575
|
-
* Fields to pull out of the payload into variables, e.g.
|
|
1584
|
+
* Fields to pull out of the payload into variables of their own, e.g.
|
|
1585
|
+
* `{ amount: '=response.amount' }`.
|
|
1576
1586
|
*
|
|
1577
|
-
*
|
|
1578
|
-
* `
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
* this family accepts one: verified `Valid`, with both gateway arms exercised
|
|
1582
|
-
* offline via `--mock-data`.
|
|
1587
|
+
* A source reads the event under `response`, as the node's own `response` row
|
|
1588
|
+
* does: a bare `'=amount'` reads nothing, because the payload is not at the top
|
|
1589
|
+
* level; `check` warns on one (`EVENT_OUTPUT_NOT_RESPONSE`). Unlike
|
|
1590
|
+
* `Maestro.ReceiveMessageEvent`, this family accepts mapped rows.
|
|
1583
1591
|
*/
|
|
1584
1592
|
outputs?: Record<string, string>;
|
|
1585
1593
|
/** `=`-expression that skips the node when truthy. */
|
|
@@ -2520,19 +2528,21 @@ declare abstract class ScopeBuilder {
|
|
|
2520
2528
|
/**
|
|
2521
2529
|
* A UiPath **Data Fabric** (Data Service) record or file operation — create,
|
|
2522
2530
|
* update, get, query, delete a record, or download / upload / delete a record's
|
|
2523
|
-
* file field — as an `Intsvc.ActivityExecution` send task in the
|
|
2524
|
-
*
|
|
2531
|
+
* file field — as an `Intsvc.ActivityExecution` send task in the shape Studio Web
|
|
2532
|
+
* writes.
|
|
2525
2533
|
*
|
|
2526
2534
|
* @remarks
|
|
2527
2535
|
* The connector library ships one Data Service operation, so `.connector()` cannot
|
|
2528
2536
|
* author the rest, and hand-filling `.activity('Intsvc.ActivityExecution', …)` gets
|
|
2529
2537
|
* the wire details wrong in ways `validate` does not catch (a `recordId` in the body,
|
|
2530
2538
|
* a curated `objectName` on an entity-form path, a folder binding keyed by the folder).
|
|
2531
|
-
* This writes each of the eight operations the way the platform's own tools do
|
|
2532
|
-
*
|
|
2533
|
-
*
|
|
2534
|
-
*
|
|
2535
|
-
* `
|
|
2539
|
+
* This writes each of the eight operations the way the platform's own tools do. The
|
|
2540
|
+
* five record operations on a tenant-level entity are V2 nodes on the curated
|
|
2541
|
+
* operations Studio Web's V2 catalog lists (`CreateEntityRecordCurated`, …): the
|
|
2542
|
+
* entity as the json `pathParameters` row, the operation's parameters as the json
|
|
2543
|
+
* `queryParameters` row, the record as the json `body` row, and the design-time
|
|
2544
|
+
* `metadata` Studio Web opens the node from. The three file operations are V1 nodes in
|
|
2545
|
+
* the curated form (`entityName`, `recordId` and `fieldName` as path rows). Needs no
|
|
2536
2546
|
* connector library at compile time.
|
|
2537
2547
|
*
|
|
2538
2548
|
* The response lands in `outputVar` (default `<id>_response`) and the error payload in
|
|
@@ -2542,7 +2552,8 @@ declare abstract class ScopeBuilder {
|
|
|
2542
2552
|
* Orchestrator folder rather than at tenant level — is `entity: { name, folder }`, the
|
|
2543
2553
|
* folder's PATH. `check` prints the `registry prepare --entity` command that records its
|
|
2544
2554
|
* keys, and `compile` writes them: the record operations (create, update, get, query,
|
|
2545
|
-
* delete) then write the connector's `_V3` operation
|
|
2555
|
+
* delete) then write the connector's `_V3` operation as a V1 node (the V2 catalog does
|
|
2556
|
+
* not list `_V3`), which selects the entity with
|
|
2546
2557
|
* `entityScope=folder`, `folderEntityName` and `folderEntityName_folderKey` query rows,
|
|
2547
2558
|
* and the process carries the entity's two `Entity` bindings for `bpmn refresh`. The file
|
|
2548
2559
|
* operations refuse it. `entity.folder` is the entity's folder; `folder` stays the
|
package/dist/bpmn/bpmn-sdk.js
CHANGED
|
@@ -1105,19 +1105,21 @@ class ScopeBuilder {
|
|
|
1105
1105
|
/**
|
|
1106
1106
|
* A UiPath **Data Fabric** (Data Service) record or file operation — create,
|
|
1107
1107
|
* update, get, query, delete a record, or download / upload / delete a record's
|
|
1108
|
-
* file field — as an `Intsvc.ActivityExecution` send task in the
|
|
1109
|
-
*
|
|
1108
|
+
* file field — as an `Intsvc.ActivityExecution` send task in the shape Studio Web
|
|
1109
|
+
* writes.
|
|
1110
1110
|
*
|
|
1111
1111
|
* @remarks
|
|
1112
1112
|
* The connector library ships one Data Service operation, so `.connector()` cannot
|
|
1113
1113
|
* author the rest, and hand-filling `.activity('Intsvc.ActivityExecution', …)` gets
|
|
1114
1114
|
* the wire details wrong in ways `validate` does not catch (a `recordId` in the body,
|
|
1115
1115
|
* a curated `objectName` on an entity-form path, a folder binding keyed by the folder).
|
|
1116
|
-
* This writes each of the eight operations the way the platform's own tools do
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
* `
|
|
1116
|
+
* This writes each of the eight operations the way the platform's own tools do. The
|
|
1117
|
+
* five record operations on a tenant-level entity are V2 nodes on the curated
|
|
1118
|
+
* operations Studio Web's V2 catalog lists (`CreateEntityRecordCurated`, …): the
|
|
1119
|
+
* entity as the json `pathParameters` row, the operation's parameters as the json
|
|
1120
|
+
* `queryParameters` row, the record as the json `body` row, and the design-time
|
|
1121
|
+
* `metadata` Studio Web opens the node from. The three file operations are V1 nodes in
|
|
1122
|
+
* the curated form (`entityName`, `recordId` and `fieldName` as path rows). Needs no
|
|
1121
1123
|
* connector library at compile time.
|
|
1122
1124
|
*
|
|
1123
1125
|
* The response lands in `outputVar` (default `<id>_response`) and the error payload in
|
|
@@ -1127,7 +1129,8 @@ class ScopeBuilder {
|
|
|
1127
1129
|
* Orchestrator folder rather than at tenant level — is `entity: { name, folder }`, the
|
|
1128
1130
|
* folder's PATH. `check` prints the `registry prepare --entity` command that records its
|
|
1129
1131
|
* keys, and `compile` writes them: the record operations (create, update, get, query,
|
|
1130
|
-
* delete) then write the connector's `_V3` operation
|
|
1132
|
+
* delete) then write the connector's `_V3` operation as a V1 node (the V2 catalog does
|
|
1133
|
+
* not list `_V3`), which selects the entity with
|
|
1131
1134
|
* `entityScope=folder`, `folderEntityName` and `folderEntityName_folderKey` query rows,
|
|
1132
1135
|
* and the process carries the entity's two `Entity` bindings for `bpmn refresh`. The file
|
|
1133
1136
|
* operations refuse it. `entity.folder` is the entity's folder; `folder` stays the
|
|
@@ -1173,7 +1176,7 @@ class ScopeBuilder {
|
|
|
1173
1176
|
id,
|
|
1174
1177
|
name: opts.name ?? wire.label,
|
|
1175
1178
|
type: DATA_SERVICE_ACTIVITY_TYPE,
|
|
1176
|
-
context: dataServiceContext(wire, connection.ref, folder?.ref),
|
|
1179
|
+
context: dataServiceContext(wire, { connection: connection.ref, resourceKey: connection.key, folderKey: folder?.ref }),
|
|
1177
1180
|
inputs: {},
|
|
1178
1181
|
inputRows: wire.inputRows,
|
|
1179
1182
|
...(pending ? { dataServiceEntity: pending } : {}),
|
package/dist/bpmn/check.js
CHANGED
|
@@ -5,6 +5,7 @@ import { checkEventResolution, checkEventSubscription, eventParamsFor, } from '.
|
|
|
5
5
|
import { bindingRequiredFields, CASE_RUNTIME_INTERNAL_TYPES, CONNECTOR_ACTIVITY_TYPES, missingRequiredContext, missingRequiredInputs, REGISTRY_GAPS, registryType, } from './typed-node.js';
|
|
6
6
|
import { ownEntry } from '../core/own-entry.js';
|
|
7
7
|
import { isManagedHttpV2, managedHttpAbsoluteUrl, managedHttpMissing } from './managed-http.js';
|
|
8
|
+
import { connectorV2Missing, isConnectorV2 } from './connector.js';
|
|
8
9
|
/**
|
|
9
10
|
* The job-start family — the types whose engine handler switches addressing on the
|
|
10
11
|
* `uipath:type` version: v2 reads `name`/`folderPath`, v1 reads `releaseKey`/`folderKey`.
|
|
@@ -218,8 +219,33 @@ function checkConnectorEvents(built, opts, diags) {
|
|
|
218
219
|
// EVENT_UNKNOWN, an unverified BYOA connection, an unrecorded `where` lookup
|
|
219
220
|
// and the binding labels are the serializer's (`createConnectorEvent`, #1074).
|
|
220
221
|
checkEventResolution(subscription, where, n.subscribe, opts, at('error'), at('warning'), params, false);
|
|
222
|
+
checkEventOutputSources(n.outputs, at('warning'));
|
|
221
223
|
}
|
|
222
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* The scope a V2 connector event's mapped `outputs` read: the engine delivers the
|
|
227
|
+
* payload as `{ response: payload }` (PO.BpmnEngine `IntSvcReceiveTaskWorkflowV2`),
|
|
228
|
+
* beside the `Error` row and the process `vars`.
|
|
229
|
+
*/
|
|
230
|
+
const EVENT_OUTPUT_ROOTS = new Set(['response', 'Error', 'vars']);
|
|
231
|
+
/**
|
|
232
|
+
* A mapped event output whose source reads a bare field, `'=subject'`: the form
|
|
233
|
+
* the V1 JSDoc taught. It compiles and validates, and reads `undefined` at run
|
|
234
|
+
* time, because the field sits under `response`. A warning: the root may be a
|
|
235
|
+
* global the scan does not know (`=JSON.stringify(response)`), so it names the
|
|
236
|
+
* likely fix and does not refuse.
|
|
237
|
+
*/
|
|
238
|
+
function checkEventOutputSources(outputs, warn) {
|
|
239
|
+
for (const [varId, source] of Object.entries(outputs ?? {})) {
|
|
240
|
+
const root = /^=\s*([A-Za-z_$][\w$]*)\s*(?:[.[?]|$)/.exec(source)?.[1];
|
|
241
|
+
if (root === undefined || EVENT_OUTPUT_ROOTS.has(root) || EVENT_OUTPUT_GLOBALS.has(root))
|
|
242
|
+
continue;
|
|
243
|
+
warn('EVENT_OUTPUT_NOT_RESPONSE', `outputs.${varId} reads \`${root}\`, which is not in the event's scope: the payload arrives under \`response\`, ` +
|
|
244
|
+
`so \`${source}\` reads undefined. Write \`=response.${source.slice(1).trim()}\`.`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/** Expression globals a mapped output may legitimately start with. */
|
|
248
|
+
const EVENT_OUTPUT_GLOBALS = new Set(['JSON', 'Math', 'String', 'Number', 'Boolean', 'Date', 'Object', 'Array', 'parseInt', 'parseFloat']);
|
|
223
249
|
/**
|
|
224
250
|
* A known method NAMED but not CALLED — `=vars.s.ToUpper` where `ToUpper()` was meant.
|
|
225
251
|
*
|
|
@@ -1371,10 +1397,14 @@ inEventSubProcess = false) {
|
|
|
1371
1397
|
// has nothing to do with whether the field is set.
|
|
1372
1398
|
const contextNames = contextView;
|
|
1373
1399
|
const managedHttp = isManagedHttpV2(n.type, contextNames);
|
|
1400
|
+
// `registry-types.json` holds the V1 connector contract; a V2 node is judged by its own.
|
|
1401
|
+
const connectorV2 = isConnectorV2(n.type, contextNames);
|
|
1374
1402
|
const httpRequest = n.inputRows?.find((row) => row.name === 'body')?.body ?? n.inputs?.body;
|
|
1375
1403
|
const requiredContext = managedHttp
|
|
1376
1404
|
? managedHttpMissing(contextNames, httpRequest)
|
|
1377
|
-
:
|
|
1405
|
+
: connectorV2
|
|
1406
|
+
? connectorV2Missing(n.type, contextNames)
|
|
1407
|
+
: missingRequiredContext(n.type, contextNames, n.spec);
|
|
1378
1408
|
for (const field of requiredContext) {
|
|
1379
1409
|
diags.push({
|
|
1380
1410
|
level: 'error',
|
|
@@ -1401,7 +1431,7 @@ inEventSubProcess = false) {
|
|
|
1401
1431
|
const inputView = { ...n.inputs };
|
|
1402
1432
|
for (const row of n.inputRows ?? [])
|
|
1403
1433
|
inputView[row.name] = row.value ?? row.body ?? '';
|
|
1404
|
-
for (const field of missingRequiredInputs(n.type, inputView, contextNames, n.spec)) {
|
|
1434
|
+
for (const field of connectorV2 ? [] : missingRequiredInputs(n.type, inputView, contextNames, n.spec)) {
|
|
1405
1435
|
diags.push({
|
|
1406
1436
|
level: 'error',
|
|
1407
1437
|
code: 'EMPTY_REQUIRED_FIELD',
|
|
@@ -26,9 +26,9 @@ const uipathDescriptor = require('./uipath-moddle.v1.json');
|
|
|
26
26
|
/**
|
|
27
27
|
* Context rows the SDK regenerates from the library on compile; not compared.
|
|
28
28
|
* `activity` is the op identity the SDK writes beside `objectName` (the platform
|
|
29
|
-
* validator requires it, exports omit it) and `operation` the library's
|
|
30
|
-
* the canvas writes the curated name; `metadata` is the canvas blob; the
|
|
31
|
-
* configuration version is
|
|
29
|
+
* validator requires it of a V1 node, exports omit it) and `operation` the library's
|
|
30
|
+
* verb where the canvas writes the curated name; `metadata` is the canvas blob; the
|
|
31
|
+
* configuration version is the one `.connector()` writes.
|
|
32
32
|
*/
|
|
33
33
|
const REGENERATED_CONTEXT = new Set(['metadata', 'operation', 'activity', 'activityConfigurationVersion']);
|
|
34
34
|
function stableJson(value) {
|
package/dist/bpmn/connector.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* bpmn/connector — emit an Integration Service connector service task as a
|
|
3
|
-
* `bpmn:sendTask` carrying a `uipath:activity` (`Intsvc.ActivityExecution`)
|
|
3
|
+
* `bpmn:sendTask` carrying a `uipath:activity` (`Intsvc.ActivityExecution`), in the
|
|
4
|
+
* V2 shape (`activityConfigurationVersion: v2`) Studio Web's V2 connector panel saves
|
|
5
|
+
* and `uip maestro bpmn registry get --input-details` builds (`renderBpmnV2Element`).
|
|
4
6
|
*
|
|
5
7
|
* The connector DATA (wiring context, per-parameter path/query rows + one body row, output schema,
|
|
6
8
|
* metadata blob, connection/folder bindings) is exactly what the Flow node and the
|
|
@@ -10,10 +12,14 @@
|
|
|
10
12
|
* exports (`Intsvc.ActivityExecution` on a `bpmn:sendTask`; see CONNECTORS_DESIGN.md
|
|
11
13
|
* §D) and passes `uip maestro bpmn validate`.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* The `metadata` blob is the one Case writes, from `core/connector-v2-metadata.ts`:
|
|
16
|
+
* the CLI renders one connector spec into both artifacts.
|
|
17
|
+
*
|
|
18
|
+
* Every new node is V2, in a new workflow or an existing one, and the process gets
|
|
19
|
+
* no `uipath:intsvcActivityConfig` marker: Studio Web opens a node that declares v2
|
|
20
|
+
* with the V2 component whatever the workflow says, the CLI packs its connection
|
|
21
|
+
* from the node's own row, and a marker would make Studio Web read an existing
|
|
22
|
+
* unversioned V1 node as V2 (#1298). A V1 node a decompile keeps verbatim stays V1.
|
|
17
23
|
*
|
|
18
24
|
* All values are embedded via `bpmn-moddle` (`m.create`), which escapes attributes,
|
|
19
25
|
* text, and CDATA — never string-concatenated into XML.
|
|
@@ -28,6 +34,12 @@ type El = ModdleElement;
|
|
|
28
34
|
type ConnectorNode = Extract<BpmnNode, {
|
|
29
35
|
kind: 'connector';
|
|
30
36
|
}>;
|
|
37
|
+
/** The `activityConfigurationVersion` every node this module writes declares. */
|
|
38
|
+
export declare const ACTIVITY_CONFIGURATION_V2 = "v2";
|
|
39
|
+
/** True for a connector activity, trigger or wait that declares `activityConfigurationVersion: v2`. */
|
|
40
|
+
export declare function isConnectorV2(type: string, context: Record<string, unknown>): boolean;
|
|
41
|
+
/** The required context a V2 connector node leaves unset (see {@link isConnectorV2}). */
|
|
42
|
+
export declare function connectorV2Missing(type: string, context: Record<string, unknown>): string[];
|
|
31
43
|
/** The subset of the serializer context this emitter needs. */
|
|
32
44
|
export interface ConnectorCtx {
|
|
33
45
|
m: BpmnModdle;
|
package/dist/bpmn/connector.js
CHANGED
|
@@ -2,7 +2,32 @@ import { connectorOutputVars } from './declared-vars.js';
|
|
|
2
2
|
import { bindingLabelRefusal } from '../core/binding-messages.js';
|
|
3
3
|
import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
|
|
4
4
|
import { buildConnectorInputs, nestConnectorBody, transportHttpMethod } from '../core/connector-inputs.js';
|
|
5
|
+
import { connectorActivityMetadata } from '../core/connector-v2-metadata.js';
|
|
5
6
|
import { CompileRefusal } from '../core/compile-refusal.js';
|
|
7
|
+
import { ownEntry } from '../core/own-entry.js';
|
|
8
|
+
/** The `activityConfigurationVersion` every node this module writes declares. */
|
|
9
|
+
export const ACTIVITY_CONFIGURATION_V2 = 'v2';
|
|
10
|
+
/**
|
|
11
|
+
* The context a V2 connector node must carry, by extension type. `registry-types.json`
|
|
12
|
+
* holds the V1 template's contract, whose `operation` (activity) and `connectionId`,
|
|
13
|
+
* `folderId` and `folderPath` (event) inputs a V2 node does not have: it names its
|
|
14
|
+
* operation by `objectName`, `method` and `path` (an activity) or `objectName` and
|
|
15
|
+
* `operation` (an event), and its connection by the `connection` context row.
|
|
16
|
+
*/
|
|
17
|
+
const CONNECTOR_V2_REQUIRED_CONTEXT = {
|
|
18
|
+
'Intsvc.ActivityExecution': ['connectorKey', 'connection', 'objectName', 'method', 'path'],
|
|
19
|
+
'Intsvc.EventTrigger': ['connectorKey', 'connection', 'objectName', 'operation'],
|
|
20
|
+
'Intsvc.WaitForEvent': ['connectorKey', 'connection', 'objectName', 'operation'],
|
|
21
|
+
};
|
|
22
|
+
/** True for a connector activity, trigger or wait that declares `activityConfigurationVersion: v2`. */
|
|
23
|
+
export function isConnectorV2(type, context) {
|
|
24
|
+
return ownEntry(CONNECTOR_V2_REQUIRED_CONTEXT, type) !== undefined && context.activityConfigurationVersion === ACTIVITY_CONFIGURATION_V2;
|
|
25
|
+
}
|
|
26
|
+
/** The required context a V2 connector node leaves unset (see {@link isConnectorV2}). */
|
|
27
|
+
export function connectorV2Missing(type, context) {
|
|
28
|
+
const unset = (v) => v === undefined || v === null || (typeof v === 'string' && v.trim() === '');
|
|
29
|
+
return (ownEntry(CONNECTOR_V2_REQUIRED_CONTEXT, type) ?? []).filter((name) => unset(context[name]));
|
|
30
|
+
}
|
|
6
31
|
/**
|
|
7
32
|
* A connector operation from the library. A throw `library.resolve` makes on no
|
|
8
33
|
* purpose is still a refusal, CONNECTOR_RESOLVE_FAILED, the code `check` has
|
|
@@ -82,63 +107,13 @@ export function createConnectorTask(ctx, n) {
|
|
|
82
107
|
const rc = onSite(where, () => resolveOperation(library, n.key, n.action, n.version, n.object));
|
|
83
108
|
const outVars = connectorOutputVars(n);
|
|
84
109
|
const op = (rc.entry.operation ?? {});
|
|
85
|
-
// ──
|
|
86
|
-
// `activity` is the primary-key required field (the selected op identity).
|
|
87
|
-
const ctxInputs = [
|
|
88
|
-
ctxInput(m, 'activity', 'string', op.name ?? op.objectName ?? n.action),
|
|
89
|
-
// `operation` is required by the PRODUCT validator, which reports
|
|
90
|
-
// `EMPTY_REQUIRED_FIELD: The field 'operation' … is required but has no value` without it —
|
|
91
|
-
// so every connector task the SDK emitted was rejected by `uip maestro bpmn validate`,
|
|
92
|
-
// including the one in `example/`. The vendored maestro-sdk + canvas validator this
|
|
93
|
-
// package tests against does not check it, which is why the suite stayed green; the gap
|
|
94
|
-
// only shows against the shipped CLI.
|
|
95
|
-
//
|
|
96
|
-
// It carries the same CRUD op name as `activity` (both are `op.name`, e.g. `Create`)
|
|
97
|
-
// because that is the field the runtime reads for it: the dispatch layer's
|
|
98
|
-
// `authoredOperation` looks at `inputs.operation` first and only falls back to guessing
|
|
99
|
-
// the verb from the HTTP method. So this also makes a live run address the op it was
|
|
100
|
-
// authored for rather than an inferred one.
|
|
101
|
-
ctxInput(m, 'operation', 'string', op.name ?? op.objectName ?? n.action),
|
|
102
|
-
ctxInput(m, 'connectorKey', 'string', rc.connectorKey),
|
|
103
|
-
// The registry template's own value, and the one the CLI's V1 packaging path keys
|
|
104
|
-
// on; V2 (`Data.V2`) is tracked in https://github.com/UiPath/builder-sdk/issues/1298, blocked on UiPath/cli#5209.
|
|
105
|
-
ctxInput(m, 'activityConfigurationVersion', 'string', 'v1'),
|
|
106
|
-
];
|
|
107
|
-
const connRef = bindingRef(ctx, n.connection, 'Connection', 'ConnectionId', `${rc.connectorKey} connection`);
|
|
108
|
-
if (connRef) {
|
|
109
|
-
ctxInputs.push(ctxInput(m, 'connection', 'string', `=bindings.${connRef.id}`));
|
|
110
|
-
ctxInputs.push(ctxInput(m, 'resourceKey', 'string', connRef.resourceKey));
|
|
111
|
-
}
|
|
112
|
-
const folderRef = bindingRef(ctx, n.folder, 'Connection', 'folderKey', 'FolderKey', connRef?.resourceKey);
|
|
113
|
-
if (folderRef)
|
|
114
|
-
ctxInputs.push(ctxInput(m, 'folderKey', 'string', `=bindings.${folderRef.id}`));
|
|
115
|
-
ctxInputs.push(ctxInput(m, 'objectName', 'string', op.objectName ?? n.action), ctxInput(m, 'method', 'string', transportHttpMethod(rc.httpMethod)), ctxInput(m, 'path', 'string', rc.endpoint), jsonInput(m, 'metadata', undefined, connectorMetadata(rc, op)));
|
|
116
|
-
// ── request inputs — one ROW per path / query / file parameter, the body as one json row ──
|
|
117
|
-
//
|
|
118
|
-
// This is the shape every real Studio Web export and the Flow→BPMN converter write:
|
|
119
|
-
// `<uipath:input name="entityName" type="string" value="…" target="path"/>`,
|
|
120
|
-
// `<uipath:input name="start" type="string" value="0" target="query"/>`, then a single
|
|
121
|
-
// `<uipath:input name="body" type="json" target="body">{…}</uipath:input>` (57 flat
|
|
122
|
-
// rows and no merged one across the 12 connector nodes of `construction-invoices.bpmn`).
|
|
123
|
-
// The SDK used to merge the parameters into two json rows named `pathParameters` /
|
|
124
|
-
// `queryParameters` with camelCased keys — a shape nothing else on the platform
|
|
125
|
-
// produces, which the graders that compare against a real artifact rejected
|
|
126
|
-
// (`name="send_as" target="query"` expected, `{"sendAs":…}` found) and which hid the
|
|
127
|
-
// parameter names from anything reading the rows by name, the local engine included
|
|
128
|
-
// (`queryParamNamesOf` collects `target="query"` rows BY NAME).
|
|
110
|
+
// ── request inputs — the shared validator, then the V2 wire ──
|
|
129
111
|
//
|
|
130
|
-
// The parameter names stay as the library spells them; the location comes from the
|
|
131
|
-
// resolved field (`operation.parameters` for path/query, the multipart `file` part),
|
|
132
|
-
// and an input the library does not declare goes to the body, where an untagged
|
|
133
|
-
// input has always gone.
|
|
134
112
|
// The ROUTING is the shared validator's (`core/connector-inputs.ts`), the one
|
|
135
113
|
// Flow's serializer and both families' `check` already run: it reports a missing
|
|
136
|
-
// required field, an unknown or mistyped input, and
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
// so `skill-bpmn-paginated-reference-lookup` could resolve a Slack channel id
|
|
140
|
-
// and then emit a process that did not carry it. The values need no lowering:
|
|
141
|
-
// a BPMN input is already a plain value or an `=`-expression string.
|
|
114
|
+
// required field, an unknown or mistyped input, and swaps a `lookup()` token for
|
|
115
|
+
// the id `registry prepare --resolve` recorded. The values need no lowering: a
|
|
116
|
+
// BPMN input is already a plain value or an `=`-expression string.
|
|
142
117
|
const slots = onSite(where, () => buildConnectorInputs(rc, n.inputs ?? {}, {
|
|
143
118
|
dialect: EQUALS_EXPR_DIALECT,
|
|
144
119
|
resolutions: library.lookupResolutions,
|
|
@@ -147,23 +122,40 @@ export function createConnectorTask(ctx, n) {
|
|
|
147
122
|
? library.lookupSpecs(n.key, n.action, n.version, n.object)
|
|
148
123
|
: {},
|
|
149
124
|
}));
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (part.value !== undefined)
|
|
161
|
-
paramRows.push(paramInput(m, part.name, 'multipart', part.value));
|
|
125
|
+
// ── uipath:context — the connector wiring, in the order Studio Web writes it ──
|
|
126
|
+
//
|
|
127
|
+
// No `activity` or `operation` row: those are the V1 template's. A V2 node names
|
|
128
|
+
// its operation by `objectName`, `method` and `path`, and its verb inside the
|
|
129
|
+
// metadata's configuration (`essentialConfiguration.operation`).
|
|
130
|
+
const ctxInputs = [ctxInput(m, 'connectorKey', 'string', rc.connectorKey)];
|
|
131
|
+
const connRef = bindingRef(ctx, n.connection, 'Connection', 'ConnectionId', `${rc.connectorKey} connection`);
|
|
132
|
+
if (connRef) {
|
|
133
|
+
ctxInputs.push(ctxInput(m, 'connection', 'string', `=bindings.${connRef.id}`));
|
|
134
|
+
ctxInputs.push(ctxInput(m, 'resourceKey', 'string', connRef.resourceKey));
|
|
162
135
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
136
|
+
const folderRef = bindingRef(ctx, n.folder, 'Connection', 'folderKey', 'FolderKey', connRef?.resourceKey);
|
|
137
|
+
if (folderRef)
|
|
138
|
+
ctxInputs.push(ctxInput(m, 'folderKey', 'string', `=bindings.${folderRef.id}`));
|
|
139
|
+
ctxInputs.push(ctxInput(m, 'objectName', 'string', op.objectName ?? n.action), ctxInput(m, 'method', 'string', transportHttpMethod(rc.httpMethod)), ctxInput(m, 'path', 'string', rc.endpoint), jsonInput(m, 'metadata', undefined, connectorActivityMetadata(rc, op, slots, n.id)), ctxInput(m, 'activityConfigurationVersion', 'string', ACTIVITY_CONFIGURATION_V2));
|
|
140
|
+
// The parameters as one json row per location, keyed by the library's own names
|
|
141
|
+
// (`send_as`, as `registry get --input-details` writes them, not camelCased), then
|
|
142
|
+
// the body, nested: the BPMN runtime sends `body` as written (see
|
|
143
|
+
// `nestConnectorBody`) — a flat `fields.project.key` reached Jira as a literal
|
|
144
|
+
// property and drew a 400 on flow-v2-run-12. A multipart operation's FILE parts are
|
|
145
|
+
// one `file` input each, carrying the author's value when there is one; its
|
|
146
|
+
// container part has none, because the runtime composes it from the body.
|
|
147
|
+
const fileRows = (slots.multipartParameters ?? [])
|
|
148
|
+
.filter((part) => part.dataType.toLowerCase() === 'file')
|
|
149
|
+
.map((part) => m.create('uipath:Input', {
|
|
150
|
+
name: part.name, type: 'file', target: 'file',
|
|
151
|
+
...(part.value !== undefined ? { value: String(part.value) } : {}),
|
|
152
|
+
}));
|
|
153
|
+
const payloadRows = [
|
|
154
|
+
jsonInput(m, 'pathParameters', 'pathParameters', slots.pathParameters ?? {}),
|
|
155
|
+
jsonInput(m, 'queryParameters', 'queryParameters', slots.queryParameters ?? {}),
|
|
156
|
+
...fileRows,
|
|
157
|
+
jsonInput(m, 'body', 'body', nestConnectorBody(slots.bodyParameters ?? {})),
|
|
158
|
+
];
|
|
167
159
|
// ── outputs — response schema + standard Error ──
|
|
168
160
|
const responseSchema = rc.entry.outputSchema
|
|
169
161
|
? schemaFromFields(rc.entry.outputSchema.fields ?? [])
|
|
@@ -175,7 +167,7 @@ export function createConnectorTask(ctx, n) {
|
|
|
175
167
|
skipCondition: n.skipCondition,
|
|
176
168
|
type: m.create('uipath:Type', { value: 'Intsvc.ActivityExecution', version: 'v1' }),
|
|
177
169
|
context: m.create('uipath:Context', { input: ctxInputs }),
|
|
178
|
-
input:
|
|
170
|
+
input: payloadRows,
|
|
179
171
|
output: [
|
|
180
172
|
m.create('uipath:Output', {
|
|
181
173
|
name: 'response', type: 'jsonSchema', source: '=response', var: outVars.response,
|
|
@@ -218,26 +210,6 @@ export function createConnectorTask(ctx, n) {
|
|
|
218
210
|
function ctxInput(m, name, type, value) {
|
|
219
211
|
return m.create('uipath:Input', { name, type, value: String(value ?? '') });
|
|
220
212
|
}
|
|
221
|
-
/**
|
|
222
|
-
* One path / query / file parameter as its own `uipath:input` row, `target`-tagged with
|
|
223
|
-
* where it goes. A scalar is written as the `value` attribute with `type="string"` —
|
|
224
|
-
* the corpus writes `start="0"` and `isAscending="false"` that way, never typed — and
|
|
225
|
-
* a structured value falls back to a json body so nothing is flattened to
|
|
226
|
-
* `[object Object]`. A multipart `file` part is `type="file" target="file"`, the shape
|
|
227
|
-
* the Flow→BPMN converter writes for an upload.
|
|
228
|
-
*/
|
|
229
|
-
function paramInput(m, name, location, value) {
|
|
230
|
-
const target = location === 'multipart' ? 'file' : location;
|
|
231
|
-
if (value !== null && typeof value === 'object') {
|
|
232
|
-
return m.create('uipath:Input', { name, type: 'json', body: JSON.stringify(value), target });
|
|
233
|
-
}
|
|
234
|
-
return m.create('uipath:Input', {
|
|
235
|
-
name,
|
|
236
|
-
type: location === 'multipart' ? 'file' : 'string',
|
|
237
|
-
value: String(value ?? ''),
|
|
238
|
-
target,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
213
|
/** A json `uipath:input` — CDATA body, optionally `target`-tagged (`body`). */
|
|
242
214
|
function jsonInput(m, name, target, obj) {
|
|
243
215
|
const props = { name, type: 'json', body: JSON.stringify(obj ?? {}) };
|
|
@@ -294,34 +266,6 @@ function bindingRef(ctx, name, resource, propertyAttribute, displayName, compani
|
|
|
294
266
|
}
|
|
295
267
|
return { id, resourceKey };
|
|
296
268
|
}
|
|
297
|
-
/** The functional connector `metadata` blob (essentialConfiguration + activityTypeId);
|
|
298
|
-
* designer cosmetics are omitted (schema-valid without them — design §C/§D). */
|
|
299
|
-
function connectorMetadata(rc, op) {
|
|
300
|
-
const instanceParameters = {
|
|
301
|
-
connectorKey: rc.connectorKey,
|
|
302
|
-
objectName: op.objectName ?? rc.nodeType.split('.').pop(),
|
|
303
|
-
httpMethod: rc.httpMethod,
|
|
304
|
-
activityType: op.activityType ?? 'Curated',
|
|
305
|
-
version: rc.version,
|
|
306
|
-
supportsStreaming: op.supportsStreaming ?? false,
|
|
307
|
-
subType: op.subType ?? 'standard',
|
|
308
|
-
};
|
|
309
|
-
return {
|
|
310
|
-
activityPropertyConfiguration: {
|
|
311
|
-
configuration: `=jsonString:${JSON.stringify({
|
|
312
|
-
essentialConfiguration: {
|
|
313
|
-
instanceParameters,
|
|
314
|
-
objectName: instanceParameters.objectName,
|
|
315
|
-
httpMethod: transportHttpMethod(rc.httpMethod),
|
|
316
|
-
path: rc.endpoint,
|
|
317
|
-
packageVersion: rc.version,
|
|
318
|
-
},
|
|
319
|
-
})}`,
|
|
320
|
-
uiPathActivityTypeId: rc.activityTypeId ?? '',
|
|
321
|
-
errorState: { issues: [] },
|
|
322
|
-
},
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
269
|
function schemaFromFields(fields) {
|
|
326
270
|
const properties = {};
|
|
327
271
|
for (const f of fields) {
|