@uipath/maestro-builder-sdk 6.83.0 → 6.84.1
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 +78 -31
- 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-inputs.d.ts +44 -0
- package/dist/core/connector-inputs.js +106 -0
- 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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bpmn/intsvc-vars — the extension type and output variables of a Phase 3d
|
|
3
|
+
* Integration Service node (`bpmn/intsvc.ts`).
|
|
4
|
+
*
|
|
5
|
+
* A leaf module, so the expression check's declaration source (`declared-vars.ts`)
|
|
6
|
+
* reads the same names the emitter writes without importing the emitter, which
|
|
7
|
+
* imports `connector.ts` and would close a runtime cycle (FB003).
|
|
8
|
+
*/
|
|
9
|
+
import type { BpmnNode } from './bpmn-sdk.js';
|
|
10
|
+
type EventNode = Extract<BpmnNode, {
|
|
11
|
+
kind: 'connectorEvent';
|
|
12
|
+
}>;
|
|
13
|
+
type ExternalNode = Extract<BpmnNode, {
|
|
14
|
+
kind: 'externalTask';
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* The extension type a Phase 3d node lowers to, WITHOUT consulting the library.
|
|
18
|
+
*
|
|
19
|
+
* The method the author called decides the placement — `.eventTrigger()` a start
|
|
20
|
+
* event, `.waitForEvent()` a receive task — so the type is known from the node alone,
|
|
21
|
+
* and the serializer can declare the node's output variable before it has resolved
|
|
22
|
+
* anything. The emitter uses this same value; the library only has to say the
|
|
23
|
+
* operation is a connector event.
|
|
24
|
+
*/
|
|
25
|
+
export declare function intsvcServiceType(n: EventNode | ExternalNode): string;
|
|
26
|
+
/**
|
|
27
|
+
* The variable a Phase 3d node's own output row writes.
|
|
28
|
+
*
|
|
29
|
+
* Derived from the registry spec's OUTPUT NAME rather than assumed: the event
|
|
30
|
+
* family names its output `result` and the agent/workflow family names it
|
|
31
|
+
* `response`, so hardcoding either one declares a variable the row does not use.
|
|
32
|
+
* That mismatch is invisible to both validators and was caught only by the
|
|
33
|
+
* round-trip gate.
|
|
34
|
+
*/
|
|
35
|
+
export declare function intsvcOutputVar(n: EventNode | ExternalNode): string | undefined;
|
|
36
|
+
/** The variable a connector event's `Error` output row writes, beside `response` (#1298). */
|
|
37
|
+
export declare function connectorEventErrorVar(n: EventNode): string;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { typedNodeOutputVar } from './typed-node.js';
|
|
2
|
+
/**
|
|
3
|
+
* Which extension type an external invocation lowers to.
|
|
4
|
+
*
|
|
5
|
+
* Kept as a literal table rather than string-built so a typo is a compile error,
|
|
6
|
+
* and mirrored field-for-field from `CASE_FORMAT_PROFILE` — the Case SDK reaches
|
|
7
|
+
* the same four types, and the two must agree.
|
|
8
|
+
*/
|
|
9
|
+
const EXTERNAL_SERVICE_TYPE = {
|
|
10
|
+
agent: { sync: 'Intsvc.SyncAgentExecution', async: 'Intsvc.AsyncAgentExecution' },
|
|
11
|
+
workflow: { sync: 'Intsvc.SyncWorkflowExecution', async: 'Intsvc.AsyncWorkflowExecution' },
|
|
12
|
+
};
|
|
13
|
+
/** Which extension type a connector-event node lowers to, by placement. */
|
|
14
|
+
const EVENT_SERVICE_TYPE = { trigger: 'Intsvc.EventTrigger', event: 'Intsvc.WaitForEvent' };
|
|
15
|
+
/**
|
|
16
|
+
* The extension type a Phase 3d node lowers to, WITHOUT consulting the library.
|
|
17
|
+
*
|
|
18
|
+
* The method the author called decides the placement — `.eventTrigger()` a start
|
|
19
|
+
* event, `.waitForEvent()` a receive task — so the type is known from the node alone,
|
|
20
|
+
* and the serializer can declare the node's output variable before it has resolved
|
|
21
|
+
* anything. The emitter uses this same value; the library only has to say the
|
|
22
|
+
* operation is a connector event.
|
|
23
|
+
*/
|
|
24
|
+
export function intsvcServiceType(n) {
|
|
25
|
+
return n.kind === 'connectorEvent'
|
|
26
|
+
? EVENT_SERVICE_TYPE[n.subscribe]
|
|
27
|
+
: EXTERNAL_SERVICE_TYPE[n.family][n.mode];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The variable a Phase 3d node's own output row writes.
|
|
31
|
+
*
|
|
32
|
+
* Derived from the registry spec's OUTPUT NAME rather than assumed: the event
|
|
33
|
+
* family names its output `result` and the agent/workflow family names it
|
|
34
|
+
* `response`, so hardcoding either one declares a variable the row does not use.
|
|
35
|
+
* That mismatch is invisible to both validators and was caught only by the
|
|
36
|
+
* round-trip gate.
|
|
37
|
+
*/
|
|
38
|
+
export function intsvcOutputVar(n) {
|
|
39
|
+
return typedNodeOutputVar(n.id, intsvcServiceType(n), n.outputVar);
|
|
40
|
+
}
|
|
41
|
+
/** The variable a connector event's `Error` output row writes, beside `response` (#1298). */
|
|
42
|
+
export function connectorEventErrorVar(n) {
|
|
43
|
+
return `${n.id}_Error`;
|
|
44
|
+
}
|
package/dist/bpmn/intsvc.d.ts
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* connector operation, two placements. `trigger` starts the process, `event`
|
|
15
15
|
* pauses one mid-flow; the platform ships both with the same operation and only
|
|
16
16
|
* the library namespace differs, exactly as Flow's `onEvent()` / `waitForEvent()`
|
|
17
|
-
* pair does.
|
|
17
|
+
* pair does. Both are V2 nodes (#1298): the V1 template's shape, a `connectionId`
|
|
18
|
+
* input and no `connection` context row, is one the runtime runs as V2 and faults
|
|
19
|
+
* on (`Value cannot be null. (Parameter 'Connection')`).
|
|
18
20
|
* - **External agent / workflow** (`Intsvc.{Sync,Async}AgentExecution`,
|
|
19
21
|
* `Intsvc.{Sync,Async}WorkflowExecution`) — an invocation of something outside
|
|
20
22
|
* this process, picked by the descriptor's `operation.subType` and the author's
|
|
@@ -25,6 +27,7 @@
|
|
|
25
27
|
import type { ModdleElement } from 'bpmn-moddle';
|
|
26
28
|
import type { BpmnNode } from './bpmn-sdk.js';
|
|
27
29
|
import { type ConnectorCtx } from './connector.js';
|
|
30
|
+
import { type ReadEventFilter } from '../core/event-filters.js';
|
|
28
31
|
type El = ModdleElement;
|
|
29
32
|
type EventNode = Extract<BpmnNode, {
|
|
30
33
|
kind: 'connectorEvent';
|
|
@@ -32,26 +35,6 @@ type EventNode = Extract<BpmnNode, {
|
|
|
32
35
|
type ExternalNode = Extract<BpmnNode, {
|
|
33
36
|
kind: 'externalTask';
|
|
34
37
|
}>;
|
|
35
|
-
/**
|
|
36
|
-
* The extension type a Phase 3d node lowers to, WITHOUT consulting the library.
|
|
37
|
-
*
|
|
38
|
-
* The method the author called decides the placement — `.eventTrigger()` a start
|
|
39
|
-
* event, `.waitForEvent()` a receive task — so the type is known from the node alone,
|
|
40
|
-
* and the serializer can declare the node's output variable before it has resolved
|
|
41
|
-
* anything. The emitter uses this same value; the library only has to say the
|
|
42
|
-
* operation is a connector event.
|
|
43
|
-
*/
|
|
44
|
-
export declare function intsvcServiceType(n: EventNode | ExternalNode): string;
|
|
45
|
-
/**
|
|
46
|
-
* The variable a Phase 3d node's own output row writes.
|
|
47
|
-
*
|
|
48
|
-
* Derived from the registry spec's OUTPUT NAME rather than assumed: the event
|
|
49
|
-
* family names its output `result` and the agent/workflow family names it
|
|
50
|
-
* `response`, so hardcoding either one declares a variable the row does not use.
|
|
51
|
-
* That mismatch is invisible to both validators and was caught only by the
|
|
52
|
-
* round-trip gate.
|
|
53
|
-
*/
|
|
54
|
-
export declare function intsvcOutputVar(n: EventNode | ExternalNode): string | undefined;
|
|
55
38
|
/**
|
|
56
39
|
* A connector event node — `Intsvc.EventTrigger` or `Intsvc.WaitForEvent`.
|
|
57
40
|
*
|
|
@@ -69,10 +52,10 @@ export declare function createConnectorEvent(ctx: ConnectorCtx, n: EventNode): E
|
|
|
69
52
|
* The `body` of a connector event node: the subscription's filter in the one place the
|
|
70
53
|
* platform reads it. `scope` (the `filter` option — the operation's event parameters, by
|
|
71
54
|
* equality) becomes both the `queryParams` and the leading `(k == 'v')` clauses;
|
|
72
|
-
* `
|
|
55
|
+
* `conditions` (the read `filters`) follow, each in parentheses, all AND-joined. No scope and
|
|
73
56
|
* no filters is `{}`, which is what the designer writes for an unfiltered subscription.
|
|
74
57
|
*/
|
|
75
|
-
export declare function eventFilterBody(nodeId: string, scope: Record<string, unknown> | undefined,
|
|
58
|
+
export declare function eventFilterBody(nodeId: string, scope: Record<string, unknown> | undefined, conditions: readonly ReadEventFilter[]): Record<string, unknown>;
|
|
76
59
|
/**
|
|
77
60
|
* An external agent / workflow invocation.
|
|
78
61
|
*
|
package/dist/bpmn/intsvc.js
CHANGED
|
@@ -1,51 +1,15 @@
|
|
|
1
|
-
import { createTypedNode
|
|
2
|
-
import {
|
|
1
|
+
import { createTypedNode } from './typed-node.js';
|
|
2
|
+
import { connectorEventErrorVar, intsvcOutputVar, intsvcServiceType } from './intsvc-vars.js';
|
|
3
|
+
import { ACTIVITY_CONFIGURATION_V2, connectorBindingRef, onSite, refuseBindingLabels, resolveOperation } from './connector.js';
|
|
4
|
+
import { connectorEventFilterTree, connectorEventMetadata } from '../core/connector-v2-metadata.js';
|
|
5
|
+
import { stableId } from '../core/stable-id.js';
|
|
3
6
|
import { ByoaRefusal, byoaUnverified } from '../core/byoa.js';
|
|
4
7
|
import { genericEventObjectRefusal } from '../core/event-checks.js';
|
|
5
8
|
import { EVENT_FILTER_OPERATORS, eventFilterJmes, eventFiltersNotArray, jmesString, jmesStringProblem, readEventFilterLeaf } from '../core/event-filters.js';
|
|
6
9
|
import { resolveEventWhere } from '../core/lookups.js';
|
|
7
10
|
import { CompileRefusal } from '../core/compile-refusal.js';
|
|
8
|
-
/**
|
|
9
|
-
* Which extension type an external invocation lowers to.
|
|
10
|
-
*
|
|
11
|
-
* Kept as a literal table rather than string-built so a typo is a compile error,
|
|
12
|
-
* and mirrored field-for-field from `CASE_FORMAT_PROFILE` — the Case SDK reaches
|
|
13
|
-
* the same four types, and the two must agree.
|
|
14
|
-
*/
|
|
15
|
-
const EXTERNAL_SERVICE_TYPE = {
|
|
16
|
-
agent: { sync: 'Intsvc.SyncAgentExecution', async: 'Intsvc.AsyncAgentExecution' },
|
|
17
|
-
workflow: { sync: 'Intsvc.SyncWorkflowExecution', async: 'Intsvc.AsyncWorkflowExecution' },
|
|
18
|
-
};
|
|
19
11
|
/** The descriptor `subType` each family requires, per `case/serialize.ts`. */
|
|
20
12
|
const EXTERNAL_SUBTYPE = { agent: 'AgentExecution', workflow: 'ProcessExecution' };
|
|
21
|
-
/** Which extension type a connector-event node lowers to, by placement. */
|
|
22
|
-
const EVENT_SERVICE_TYPE = { trigger: 'Intsvc.EventTrigger', event: 'Intsvc.WaitForEvent' };
|
|
23
|
-
/**
|
|
24
|
-
* The extension type a Phase 3d node lowers to, WITHOUT consulting the library.
|
|
25
|
-
*
|
|
26
|
-
* The method the author called decides the placement — `.eventTrigger()` a start
|
|
27
|
-
* event, `.waitForEvent()` a receive task — so the type is known from the node alone,
|
|
28
|
-
* and the serializer can declare the node's output variable before it has resolved
|
|
29
|
-
* anything. The emitter uses this same value; the library only has to say the
|
|
30
|
-
* operation is a connector event.
|
|
31
|
-
*/
|
|
32
|
-
export function intsvcServiceType(n) {
|
|
33
|
-
return n.kind === 'connectorEvent'
|
|
34
|
-
? EVENT_SERVICE_TYPE[n.subscribe]
|
|
35
|
-
: EXTERNAL_SERVICE_TYPE[n.family][n.mode];
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The variable a Phase 3d node's own output row writes.
|
|
39
|
-
*
|
|
40
|
-
* Derived from the registry spec's OUTPUT NAME rather than assumed: the event
|
|
41
|
-
* family names its output `result` and the agent/workflow family names it
|
|
42
|
-
* `response`, so hardcoding either one declares a variable the row does not use.
|
|
43
|
-
* That mismatch is invisible to both validators and was caught only by the
|
|
44
|
-
* round-trip gate.
|
|
45
|
-
*/
|
|
46
|
-
export function intsvcOutputVar(n) {
|
|
47
|
-
return typedNodeOutputVar(n.id, intsvcServiceType(n), n.outputVar);
|
|
48
|
-
}
|
|
49
13
|
/**
|
|
50
14
|
* A connector event node — `Intsvc.EventTrigger` or `Intsvc.WaitForEvent`.
|
|
51
15
|
*
|
|
@@ -125,23 +89,8 @@ export function createConnectorEvent(ctx, n) {
|
|
|
125
89
|
const folder = connectorBindingRef(ctx, n.folder, 'Connection', 'folderKey', 'FolderKey', conn?.resourceKey);
|
|
126
90
|
if (!conn || !folder) {
|
|
127
91
|
throw new CompileRefusal('BPMN_EVENT_BINDINGS_MISSING', `connector event "${n.id}" needs both a connection and a folder binding name — ` +
|
|
128
|
-
`the
|
|
92
|
+
`the trigger is created on deploy in the connection's folder.`);
|
|
129
93
|
}
|
|
130
|
-
// The registry marks `operation` and `objectName` required AND hidden, so an
|
|
131
|
-
// author never passes them; they come off the descriptor, the same way `.http()`
|
|
132
|
-
// takes `mode` from a registry default.
|
|
133
|
-
const inputs = {
|
|
134
|
-
connectionId: `=bindings.${conn.id}`,
|
|
135
|
-
connectorKey: rc.connectorKey,
|
|
136
|
-
folderId: `=bindings.${folder.id}`,
|
|
137
|
-
folderPath: n.folderPath ?? '/Shared',
|
|
138
|
-
folderKey: `=bindings.${folder.id}`,
|
|
139
|
-
operation: op.eventOperation ?? '',
|
|
140
|
-
// A GENERIC event's library entry names no object — the author's is the only
|
|
141
|
-
// one there is, and without it the node emits `objectName: ""`, validates,
|
|
142
|
-
// and watches nothing. A curated entry carries its own and the author passes none.
|
|
143
|
-
objectName: n.object ?? op.objectName ?? '',
|
|
144
|
-
};
|
|
145
94
|
// The subscription's filter goes in the `body` row, where the platform reads it:
|
|
146
95
|
// `PO.BpmnEngine` `BpmnInputExtensions.GetEventFilters` takes `body.filters.expression`
|
|
147
96
|
// (and `queryParams` registers the scope with the connector). This emitter used to write
|
|
@@ -157,28 +106,78 @@ export function createConnectorEvent(ctx, n) {
|
|
|
157
106
|
// recorded, as Flow's and Case's serializers do; an unrecorded one is refused
|
|
158
107
|
// with the command that records it. Stringified, a token was `[object Object]`.
|
|
159
108
|
const scope = resolveEventWhere(n.filter, library.lookupResolutions, where);
|
|
160
|
-
|
|
109
|
+
const conditions = eventFilterReads(n.id, n.filters);
|
|
110
|
+
const body = eventFilterBody(n.id, scope, conditions);
|
|
111
|
+
// The operation's query and path parameters, which Studio Web writes beside the filter.
|
|
161
112
|
if (n.parameters !== undefined)
|
|
162
|
-
|
|
113
|
+
body.parameters = n.parameters;
|
|
114
|
+
// The designer's filter tree of the same `filters`, and their expression, in the metadata.
|
|
115
|
+
const tree = connectorEventFilterTree(conditions, (suffix) => stableId(`${n.id}${suffix}`));
|
|
116
|
+
const expression = body.filters?.expression;
|
|
117
|
+
// The registry marks `operation` and `objectName` required AND hidden, so an
|
|
118
|
+
// author never passes them; they come off the descriptor. A GENERIC event's library
|
|
119
|
+
// entry names no object — the author's is the only one there is, and without it the
|
|
120
|
+
// node emits `objectName: ""`, validates, and watches nothing. A curated entry
|
|
121
|
+
// carries its own and the author passes none.
|
|
122
|
+
//
|
|
123
|
+
// The context is the one `uip maestro bpmn registry get Intsvc.EventTrigger
|
|
124
|
+
// --input-details` builds (`buildTriggerContext`): `method` and `path` are written
|
|
125
|
+
// with no value, as Studio Web writes them for an event.
|
|
126
|
+
const contextRows = [
|
|
127
|
+
{ name: 'connectorKey', value: rc.connectorKey },
|
|
128
|
+
{ name: 'connection', value: `=bindings.${conn.id}` },
|
|
129
|
+
{ name: 'resourceKey', value: conn.resourceKey },
|
|
130
|
+
{ name: 'folderKey', value: `=bindings.${folder.id}` },
|
|
131
|
+
{ name: 'method' },
|
|
132
|
+
{ name: 'path' },
|
|
133
|
+
{ name: 'objectName', value: String(n.object ?? op.objectName ?? '') },
|
|
134
|
+
{ name: 'operation', value: String(op.eventOperation ?? '') },
|
|
135
|
+
{ name: 'metadata', type: 'json', body: connectorEventMetadata(rc, { ...op, objectName: n.object ?? op.objectName }, tree, expression) },
|
|
136
|
+
{ name: 'activityConfigurationVersion', value: ACTIVITY_CONFIGURATION_V2 },
|
|
137
|
+
];
|
|
163
138
|
return createTypedNode(ctx.m, n.id,
|
|
164
139
|
// The placement's type, so a prepared `.event.` entry carrying the start form's
|
|
165
140
|
// runtime cannot turn a wait into a start event (see the check above).
|
|
166
141
|
expected, {
|
|
167
142
|
name: n.name ?? rc.entry.display?.label ?? n.eventName,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
143
|
+
contextRows,
|
|
144
|
+
inputRows: [{ name: 'body', type: 'json', target: 'body', body }],
|
|
145
|
+
outputRows: [
|
|
146
|
+
// The event's payload, in the variable the V1 `result` row wrote, so a
|
|
147
|
+
// downstream `vars.<id>_result` reads the same thing.
|
|
148
|
+
{ name: 'response', type: 'jsonSchema', source: '=response', var: intsvcOutputVar(n) },
|
|
149
|
+
{ name: 'Error', type: 'jsonSchema', source: '=Error', var: connectorEventErrorVar(n) },
|
|
150
|
+
],
|
|
151
|
+
mappedOutputRows: Object.entries(n.outputs ?? {}).map(([varId, source]) => ({ name: varId, source, var: varId })),
|
|
171
152
|
skipCondition: n.skipCondition,
|
|
172
153
|
}, (varId) => ctx.varTypeOf?.(varId));
|
|
173
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Each authored `filters` leaf read structurally, or the refusal of the first one
|
|
157
|
+
* compile cannot lower. The body's expression and the metadata's filter tree are
|
|
158
|
+
* both built from these reads.
|
|
159
|
+
*/
|
|
160
|
+
function eventFilterReads(nodeId, filters) {
|
|
161
|
+
return (filters ?? []).map((leaf, i) => {
|
|
162
|
+
// The code `check` gives the same leaf (`core/event-checks.ts`).
|
|
163
|
+
const judged = readEventFilterLeaf(leaf);
|
|
164
|
+
if (judged.code !== undefined) {
|
|
165
|
+
throw new CompileRefusal(judged.code, judged.problem !== undefined
|
|
166
|
+
? `connector event "${nodeId}": filters[${i}] on \`${judged.read?.field}\`: ${judged.problem}`
|
|
167
|
+
: `connector event "${nodeId}": filters[${i}] must carry a field and exactly ONE operator ` +
|
|
168
|
+
`(${Object.keys(EVENT_FILTER_OPERATORS).join(', ')}) — got ${JSON.stringify(leaf)}.`);
|
|
169
|
+
}
|
|
170
|
+
return judged.read;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
174
173
|
/**
|
|
175
174
|
* The `body` of a connector event node: the subscription's filter in the one place the
|
|
176
175
|
* platform reads it. `scope` (the `filter` option — the operation's event parameters, by
|
|
177
176
|
* equality) becomes both the `queryParams` and the leading `(k == 'v')` clauses;
|
|
178
|
-
* `
|
|
177
|
+
* `conditions` (the read `filters`) follow, each in parentheses, all AND-joined. No scope and
|
|
179
178
|
* no filters is `{}`, which is what the designer writes for an unfiltered subscription.
|
|
180
179
|
*/
|
|
181
|
-
export function eventFilterBody(nodeId, scope,
|
|
180
|
+
export function eventFilterBody(nodeId, scope, conditions) {
|
|
182
181
|
const scopeEntries = Object.entries(scope ?? {}).filter(([, v]) => v !== undefined && v !== null && String(v) !== '');
|
|
183
182
|
const scopeClauses = scopeEntries.map(([k, v]) => {
|
|
184
183
|
const problem = jmesStringProblem(String(v));
|
|
@@ -186,18 +185,8 @@ export function eventFilterBody(nodeId, scope, filters) {
|
|
|
186
185
|
throw new CompileRefusal('EVENT_FILTER_BACKSLASH', `connector event "${nodeId}": \`filter.${k}\`: ${problem}`);
|
|
187
186
|
return `(${k} == ${jmesString(String(v))})`;
|
|
188
187
|
});
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
const judged = readEventFilterLeaf(leaf);
|
|
192
|
-
if (judged.code !== undefined) {
|
|
193
|
-
throw new CompileRefusal(judged.code, judged.problem !== undefined
|
|
194
|
-
? `connector event "${nodeId}": filters[${i}] on \`${judged.read?.field}\`: ${judged.problem}`
|
|
195
|
-
: `connector event "${nodeId}": filters[${i}] must carry a field and exactly ONE operator ` +
|
|
196
|
-
`(${Object.keys(EVENT_FILTER_OPERATORS).join(', ')}) — got ${JSON.stringify(leaf)}.`);
|
|
197
|
-
}
|
|
198
|
-
return `(${eventFilterJmes(judged.read)})`;
|
|
199
|
-
});
|
|
200
|
-
const expression = [...scopeClauses, ...conditions].join(' && ');
|
|
188
|
+
const clauses = conditions.map((read) => `(${eventFilterJmes(read)})`);
|
|
189
|
+
const expression = [...scopeClauses, ...clauses].join(' && ');
|
|
201
190
|
const body = {};
|
|
202
191
|
if (expression !== '')
|
|
203
192
|
body.filters = { expression };
|
|
@@ -244,7 +233,7 @@ export function createExternalTask(ctx, n) {
|
|
|
244
233
|
if (!conn || !folder) {
|
|
245
234
|
throw new CompileRefusal(conn ? 'EXTERNAL_TASK_FOLDER' : 'EXTERNAL_TASK_CONNECTION', `external ${n.family} "${n.id}" needs both a connection and a folder binding name.`);
|
|
246
235
|
}
|
|
247
|
-
return createTypedNode(ctx.m, n.id,
|
|
236
|
+
return createTypedNode(ctx.m, n.id, intsvcServiceType(n), {
|
|
248
237
|
name: n.name ?? rc.entry.display?.label ?? n.action,
|
|
249
238
|
context: {
|
|
250
239
|
// `activity` is the ACTIVITY TYPE ID, not the operation name — the one place
|
package/dist/bpmn/serialize.js
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
import BpmnModdle from 'bpmn-moddle';
|
|
17
17
|
import { createRequire } from 'node:module';
|
|
18
18
|
import { createConnectorTask } from './connector.js';
|
|
19
|
-
import { createConnectorEvent, createExternalTask
|
|
19
|
+
import { createConnectorEvent, createExternalTask } from './intsvc.js';
|
|
20
|
+
import { connectorEventErrorVar, intsvcOutputVar } from './intsvc-vars.js';
|
|
20
21
|
import { createExtensionPayload, createTypedNode, rowDeclaration, typedNodeOutputVar, verbatimOutputRows } from './typed-node.js';
|
|
21
22
|
import { connectorOutputVars, nodeDeclaredVars, typedNodeDeclaredVars } from './declared-vars.js';
|
|
22
23
|
import { defaultEntryPointId } from './entry-point-id.js';
|
|
@@ -212,7 +213,9 @@ function buildDefinitions(built, opts) {
|
|
|
212
213
|
version: meta.caseManagement.version,
|
|
213
214
|
value: meta.caseManagement.value,
|
|
214
215
|
}));
|
|
215
|
-
// No process `intsvcActivityConfig`:
|
|
216
|
+
// No process `intsvcActivityConfig`: each connector node declares its own version, which
|
|
217
|
+
// the CLI and Studio Web read first, and a marker would make Studio Web read an existing
|
|
218
|
+
// unversioned V1 node as V2 (https://github.com/UiPath/builder-sdk/issues/1298).
|
|
216
219
|
if (processExt.length)
|
|
217
220
|
processProps.extensionElements = m.create('bpmn:ExtensionElements', { values: processExt });
|
|
218
221
|
processProps.flowElements = flowElements;
|
|
@@ -811,7 +814,10 @@ function lowerPendingDataService(ctx, n) {
|
|
|
811
814
|
ctx.bindingSink.set(id, { ...b, id });
|
|
812
815
|
}
|
|
813
816
|
const context = n.context;
|
|
814
|
-
|
|
817
|
+
// A record operation's tenant wire, which the builder wrote, is V2 and carries the
|
|
818
|
+
// connection's key; a file operation's is V1 and needs none.
|
|
819
|
+
const wiring = { connection: context.connection, resourceKey: context.resourceKey ?? '', folderKey: context.folderKey };
|
|
820
|
+
return { ...n, context: dataServiceContext(wire, wiring), inputRows: wire.inputRows };
|
|
815
821
|
}
|
|
816
822
|
/** `bOrdersEntityName` with suffix `2` → `bOrdersEntity2Name`: the pair keeps its shared stem. */
|
|
817
823
|
function withSuffix(id, suffix) {
|
|
@@ -1188,6 +1194,8 @@ export function implicitNodeVars(nodes, declared) {
|
|
|
1188
1194
|
// reference variables the process must declare, or the canvas validator
|
|
1189
1195
|
// reports MISSING_ROOT_VARIABLE.
|
|
1190
1196
|
claim(intsvcOutputVar(n), n.id);
|
|
1197
|
+
if (n.kind === 'connectorEvent')
|
|
1198
|
+
claim(connectorEventErrorVar(n), n.id);
|
|
1191
1199
|
for (const varId of Object.keys(n.outputs ?? {}))
|
|
1192
1200
|
claim(varId, n.id);
|
|
1193
1201
|
}
|
package/dist/case/serialize.js
CHANGED
|
@@ -13,10 +13,10 @@ import { isUnrestorableSlotId, METADATA_ABSENT_READING, STAGE_EMPTY_LISTS, TASK_
|
|
|
13
13
|
import { v31TaskSets } from './task-sets.js';
|
|
14
14
|
import { camelizeName, defaultActionOutputVar } from './action-output-var.js';
|
|
15
15
|
import { ACTION_CONTEXT_COPIES, ACTION_FORM_KIND_CONTEXT, ACTION_PASSTHROUGH_SETTINGS } from './action-settings.js';
|
|
16
|
-
import { buildConnectorInputs, nestConnectorBody,
|
|
16
|
+
import { buildConnectorInputs, nestConnectorBody, transportHttpMethod } from '../core/connector-inputs.js';
|
|
17
17
|
import { carriedConnectorFieldsRefusal, withCarriedFields } from '../core/carried-connector-fields.js';
|
|
18
18
|
import { connectorTaskIdentity, sameConnectorOperation, withCurrentCaches, writeOptionalConfiguration } from './connector-saved-config.js';
|
|
19
|
-
import {
|
|
19
|
+
import { connectorActivityMetadata, connectorEventFilterTree, connectorEventMetadata } from '../core/connector-v2-metadata.js';
|
|
20
20
|
import { EQUALS_EXPR_DIALECT } from '../core/connector-checks.js';
|
|
21
21
|
import { bindingLabelRefusal, connectionStubMessage } from '../core/binding-messages.js';
|
|
22
22
|
import { resolveEventWhere } from '../core/lookups.js';
|
|
@@ -2240,7 +2240,9 @@ function resolvedSubscriptionBag(kind, spec, resolver, elementId, where) {
|
|
|
2240
2240
|
if (folder)
|
|
2241
2241
|
context.push(io('folderKey', 'string', { value: `=bindings.${folder.id}` }));
|
|
2242
2242
|
const conditions = caseEventFilterReads(spec.filters ?? [], kind);
|
|
2243
|
-
const metadataRow = io('metadata', 'json', {
|
|
2243
|
+
const metadataRow = io('metadata', 'json', {
|
|
2244
|
+
body: connectorEventMetadata(rc, op, connectorEventFilterTree(conditions, (suffix) => elementSeededId(resolver, elementId, suffix))),
|
|
2245
|
+
});
|
|
2244
2246
|
context.push(io('method', 'string', {}), io('path', 'string', {}), io('objectName', 'string', { value: op.objectName ?? spec.event }), io('operation', 'string', { value: op.eventOperation ?? spec.event }), metadataRow);
|
|
2245
2247
|
const resolvedWhere = resolveEventWhere(spec.where, library.lookupResolutions, where);
|
|
2246
2248
|
const inputRow = eventInput(caseSubscriptionBody(rc, resolvedWhere, conditions, elementId), elementId);
|
|
@@ -2283,73 +2285,6 @@ function caseEventFilterReads(filters, kind) {
|
|
|
2283
2285
|
return judged.read;
|
|
2284
2286
|
});
|
|
2285
2287
|
}
|
|
2286
|
-
function subscriptionMetadata(rc, op, conditions, elementId, resolver) {
|
|
2287
|
-
const instanceParameters = {
|
|
2288
|
-
connectorKey: rc.connectorKey,
|
|
2289
|
-
objectName: op.objectName ?? rc.nodeType.split('.').pop(),
|
|
2290
|
-
activityType: op.activityType,
|
|
2291
|
-
version: rc.version,
|
|
2292
|
-
eventOperation: op.eventOperation,
|
|
2293
|
-
eventMode: op.eventMode,
|
|
2294
|
-
supportsStreaming: op.supportsStreaming ?? false,
|
|
2295
|
-
};
|
|
2296
|
-
const filter = conditions.length ? {
|
|
2297
|
-
groupOperator: 0,
|
|
2298
|
-
index: 0,
|
|
2299
|
-
filters: conditions.map((read, index) => {
|
|
2300
|
-
return {
|
|
2301
|
-
...eventFilterTreeLeaf(read),
|
|
2302
|
-
uiId: elementSeededId(resolver, elementId, `:${read.field}:${read.expression ?? String(read.value)}:${index}`),
|
|
2303
|
-
};
|
|
2304
|
-
}).map((leaf) => ({
|
|
2305
|
-
id: leaf.id,
|
|
2306
|
-
operator: leaf.operator,
|
|
2307
|
-
value: leaf.value,
|
|
2308
|
-
uiId: leaf.uiId,
|
|
2309
|
-
})),
|
|
2310
|
-
groups: [],
|
|
2311
|
-
uuId: elementSeededId(resolver, elementId, ':filters'),
|
|
2312
|
-
} : null;
|
|
2313
|
-
const configuration = {
|
|
2314
|
-
essentialConfiguration: {
|
|
2315
|
-
connectorVersion: null,
|
|
2316
|
-
executionType: null,
|
|
2317
|
-
customFieldsRequestDetails: null,
|
|
2318
|
-
instanceParameters,
|
|
2319
|
-
objectName: instanceParameters.objectName,
|
|
2320
|
-
packageVersion: rc.version,
|
|
2321
|
-
httpMethod: null,
|
|
2322
|
-
path: null,
|
|
2323
|
-
filter,
|
|
2324
|
-
},
|
|
2325
|
-
};
|
|
2326
|
-
return {
|
|
2327
|
-
activityPropertyConfiguration: {
|
|
2328
|
-
objectName: instanceParameters.objectName,
|
|
2329
|
-
eventType: op.eventOperation,
|
|
2330
|
-
eventMode: op.eventMode,
|
|
2331
|
-
configuration: `=jsonString:${JSON.stringify(configuration)}`,
|
|
2332
|
-
uiPathActivityTypeId: rc.activityTypeId ?? '',
|
|
2333
|
-
errorState: { issues: [] },
|
|
2334
|
-
},
|
|
2335
|
-
activityMetadata: {
|
|
2336
|
-
activity: {
|
|
2337
|
-
displayName: rc.entry.display?.label ?? instanceParameters.objectName,
|
|
2338
|
-
description: rc.entry.display?.description ?? '',
|
|
2339
|
-
category: rc.connectorName,
|
|
2340
|
-
configuration: JSON.stringify(instanceParameters),
|
|
2341
|
-
uiPathActivityTypeId: rc.activityTypeId ?? '',
|
|
2342
|
-
isEnabled: true,
|
|
2343
|
-
},
|
|
2344
|
-
},
|
|
2345
|
-
telemetryData: {
|
|
2346
|
-
connectorKey: rc.connectorKey,
|
|
2347
|
-
connectorName: rc.connectorName,
|
|
2348
|
-
objectName: instanceParameters.objectName,
|
|
2349
|
-
objectDisplayName: op.objectDisplayName ?? rc.entry.display?.operationLabel ?? '',
|
|
2350
|
-
},
|
|
2351
|
-
};
|
|
2352
|
-
}
|
|
2353
2288
|
// ─── Reference-mode task io-binding (data.inputs[] / data.outputs[]) ───────────
|
|
2354
2289
|
//
|
|
2355
2290
|
// Wire shape verified against a real `uip maestro case` caseplan (the io-binding
|
|
@@ -2742,7 +2677,7 @@ function connectorTaskData(spec, resolver, elementId, where, executionType, even
|
|
|
2742
2677
|
// from the `body` slot. This used to drop the whole wire and push a filled
|
|
2743
2678
|
// file part into the body, where the runtime does not look for it (#1420).
|
|
2744
2679
|
const fileParts = (slots.multipartParameters ?? []).filter((part) => part.dataType.toLowerCase() === 'file');
|
|
2745
|
-
context.push(io('metadata', 'json', { body:
|
|
2680
|
+
context.push(io('metadata', 'json', { body: connectorActivityMetadata(rc, op, slots, elementId, executionType, event) }));
|
|
2746
2681
|
const inputs = [
|
|
2747
2682
|
ioSlot('pathParameters', pathParameters, `${elementId}`),
|
|
2748
2683
|
ioSlot('queryParameters', queryParameters, `${elementId}`),
|
|
@@ -3175,60 +3110,6 @@ function folderBindingRef(resolver, name, connection, site) {
|
|
|
3175
3110
|
}
|
|
3176
3111
|
return { id };
|
|
3177
3112
|
}
|
|
3178
|
-
/**
|
|
3179
|
-
* The connector `metadata` json blob: the FUNCTIONAL essentialConfiguration +
|
|
3180
|
-
* activityTypeId, and the multipart wire of a multipart operation. Designer
|
|
3181
|
-
* cosmetics (packageId/activityColor/…) are omitted — the caseplan
|
|
3182
|
-
* schema-validates without them (see design §C).
|
|
3183
|
-
*
|
|
3184
|
-
* The configuration is the one Flow writes, from the shared
|
|
3185
|
-
* {@link buildEssentialConfiguration}. Case used to build its own, thinner copy:
|
|
3186
|
-
* no `operation` verb, `customFieldsRequestDetails`, `connectorVersion` or
|
|
3187
|
-
* `unifiedTypesCompatible`, a curated-only `instanceParameters` even for a
|
|
3188
|
-
* Generic activity, and the library version where the platform writes
|
|
3189
|
-
* `packageVersion: "1.0.0"` (#1420).
|
|
3190
|
-
*/
|
|
3191
|
-
function connectorMetadata(rc, op, slots, seed, executionType, event) {
|
|
3192
|
-
// The part DECLARATIONS only: a file part's value rides on its `file` input.
|
|
3193
|
-
const multipartParameters = (slots.multipartParameters ?? []).map(({ name, dataType }) => ({ name, dataType }));
|
|
3194
|
-
// The configuration replays the authored values (a schema action's parent
|
|
3195
|
-
// fields, a CEQL filter's tree), keyed by the library's own names, as Flow's.
|
|
3196
|
-
const essential = buildEssentialConfiguration(rc.entry, rc.version, replayInputsOf(slots), seed, executionType ?? null);
|
|
3197
|
-
const configuration = `=jsonString:${JSON.stringify({ essentialConfiguration: essential })}`;
|
|
3198
|
-
const instanceParameters = essential.instanceParameters;
|
|
3199
|
-
const objectName = String(op.objectName ?? rc.nodeType.split('.').pop());
|
|
3200
|
-
return {
|
|
3201
|
-
activityPropertyConfiguration: {
|
|
3202
|
-
...(multipartParameters.length ? { multipartParameters } : {}),
|
|
3203
|
-
configuration,
|
|
3204
|
-
uiPathActivityTypeId: rc.activityTypeId ?? '',
|
|
3205
|
-
errorState: { issues: [] },
|
|
3206
|
-
...(executionType ? { executionType } : {}),
|
|
3207
|
-
// The event an async / hybrid object answers with, named as the Designer
|
|
3208
|
-
// names it here (`eventType`, where the context row is `operation`).
|
|
3209
|
-
...(event ? { eventType: event.operation, eventMode: event.mode } : {}),
|
|
3210
|
-
},
|
|
3211
|
-
activityMetadata: {
|
|
3212
|
-
activity: {
|
|
3213
|
-
displayName: rc.entry.display?.label ?? objectName,
|
|
3214
|
-
description: rc.entry.display?.description ?? '',
|
|
3215
|
-
category: rc.connectorName,
|
|
3216
|
-
configuration: JSON.stringify(instanceParameters),
|
|
3217
|
-
uiPathActivityTypeId: rc.activityTypeId ?? '',
|
|
3218
|
-
isEnabled: true,
|
|
3219
|
-
},
|
|
3220
|
-
},
|
|
3221
|
-
// `{}` unless the operation is multipart, as the Designer saves every
|
|
3222
|
-
// connector activity, external tasks included.
|
|
3223
|
-
inputMetadata: slots.inputMetadata ?? {},
|
|
3224
|
-
telemetryData: {
|
|
3225
|
-
connectorKey: rc.connectorKey,
|
|
3226
|
-
connectorName: rc.connectorName,
|
|
3227
|
-
objectName,
|
|
3228
|
-
objectDisplayName: op.objectDisplayName ?? rc.entry.display?.operationLabel ?? '',
|
|
3229
|
-
},
|
|
3230
|
-
};
|
|
3231
|
-
}
|
|
3232
3113
|
/** The `outputs[]`: a `response` json-schema from the op's output schema, plus a
|
|
3233
3114
|
* standard `Error` schema. */
|
|
3234
3115
|
function connectorOutputVar(resolver, base) {
|
|
@@ -57,7 +57,8 @@ function ceqlParameterNames(op) {
|
|
|
57
57
|
* artifacts carry.
|
|
58
58
|
*
|
|
59
59
|
* Only a LITERAL string is parsed. A filter built from a runtime expression
|
|
60
|
-
* renders as
|
|
60
|
+
* renders as an `=`-expression here (Flow's `=js:…`, BPMN's `=vars.…`; no CEQL
|
|
61
|
+
* clause starts with `=`), and the v1 authoring path turns that into a
|
|
61
62
|
* `{var_…}` placeholder plus `inputs.detail.filterVariables`; nothing offline
|
|
62
63
|
* can reproduce that pairing, and a tree that disagrees with the query string is
|
|
63
64
|
* the one outcome worse than no tree. Those keep their runtime half and get no
|
|
@@ -69,7 +70,7 @@ function savedFilterTrees(op, inputValues, seed) {
|
|
|
69
70
|
const trees = {};
|
|
70
71
|
for (const name of ceqlParameterNames(op)) {
|
|
71
72
|
const raw = inputValues[name];
|
|
72
|
-
if (typeof raw !== 'string' || raw.trim() === '' || raw.startsWith('=
|
|
73
|
+
if (typeof raw !== 'string' || raw.trim() === '' || raw.startsWith('='))
|
|
73
74
|
continue;
|
|
74
75
|
trees[name] = parseCeql(raw, `${seed}:${name}`);
|
|
75
76
|
}
|
|
@@ -136,6 +136,50 @@ interface ConnectorSlots {
|
|
|
136
136
|
* author already wrote under a plain key is merged into, not replaced.
|
|
137
137
|
*/
|
|
138
138
|
export declare function nestConnectorBody(flat: Record<string, unknown>): Record<string, unknown>;
|
|
139
|
+
/** Why a written request body has no `.connector()` inputs: the body field, and what is wrong with it. */
|
|
140
|
+
export interface ConnectorBodyRefusal {
|
|
141
|
+
/** The body field, as a dotted path into the written body (`fields.project`). */
|
|
142
|
+
field: string;
|
|
143
|
+
/**
|
|
144
|
+
* `undeclared` — the operation declares no field at that path; `literal-dotted` — a
|
|
145
|
+
* property NAME holds a dot, which `nestConnectorBody` would split into objects;
|
|
146
|
+
* `shape` — the library declares the path, but the value is not one compile could
|
|
147
|
+
* have written there (a non-array at a `[*]` field, a scalar or an empty object
|
|
148
|
+
* where the library has only sub-fields).
|
|
149
|
+
*/
|
|
150
|
+
kind: 'undeclared' | 'literal-dotted' | 'shape';
|
|
151
|
+
message: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The inverse of {@link nestConnectorBody}: a request body as the BPMN file writes it
|
|
155
|
+
* (nested), read back into the `.connector()` inputs it compiles from, keyed by the
|
|
156
|
+
* registry's dotted field ids — `{"fields":{"project":{"key":"CE"}}}` →
|
|
157
|
+
* `{"fields.project.key":"CE"}`. `fieldNames` are the operation's declared field ids
|
|
158
|
+
* (`fields.project.key`, `sendSettings.selectedCampaigns[*]`); a top-level parameter
|
|
159
|
+
* name is a field id too.
|
|
160
|
+
*
|
|
161
|
+
* A key is emitted under the field id exactly as the library spells it, `[*]` marker
|
|
162
|
+
* included, so the inputs say what `prepare -f` and `lookup()` say. A path the library
|
|
163
|
+
* declares as a field in its own right keeps its whole value there, even when the
|
|
164
|
+
* library declares sub-fields under it too (`meta` and `meta.id`): compile reads the
|
|
165
|
+
* whole value for the parent, so a required parent stays filled.
|
|
166
|
+
*
|
|
167
|
+
* One shape has no dotted spelling: an array of OBJECTS (`attachments[*].url` — a flat
|
|
168
|
+
* key cannot carry one value per element). The whole top-level key that holds one is
|
|
169
|
+
* kept in the natural nested form, which `buildConnectorInputs` reads too
|
|
170
|
+
* (`readConnectorPath`). Its subtree is still walked to the end, so the refusals below
|
|
171
|
+
* apply to it whatever order its keys come in.
|
|
172
|
+
*
|
|
173
|
+
* Returns the refusal instead when a key is not declared, when a property NAME holds a
|
|
174
|
+
* dot (a literal `"fields.summary"` property — nesting would split it, so it is not the
|
|
175
|
+
* request the file sends), or when a value is not one compile could have written at its
|
|
176
|
+
* path.
|
|
177
|
+
*/
|
|
178
|
+
export declare function flattenConnectorBody(body: Record<string, unknown>, fieldNames: Iterable<string>): {
|
|
179
|
+
inputs: Record<string, unknown>;
|
|
180
|
+
} | {
|
|
181
|
+
refusal: ConnectorBodyRefusal;
|
|
182
|
+
};
|
|
139
183
|
/**
|
|
140
184
|
* Convert an Integration Service operation discriminator into an HTTP transport
|
|
141
185
|
* verb. `GETBYID` identifies a curated Retrieve operation in the connector
|