@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.
- package/dist/api-index.md +126 -125
- package/dist/api-members.md +428 -428
- 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/case-sdk.d.ts +24 -3
- package/dist/case/case-sdk.js +21 -0
- package/dist/case/check-rule-semantics.d.ts +4 -2
- package/dist/case/check-rule-semantics.js +34 -0
- package/dist/case/decompile.js +9 -1
- package/dist/case/rule-options.d.ts +7 -0
- package/dist/case/rule-options.js +7 -0
- package/dist/case/serialize.js +13 -127
- 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 +2 -0
- package/dist/core/refusals.js +2 -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/case-sdk.d.ts
CHANGED
|
@@ -64,10 +64,11 @@ export interface RuleOpts {
|
|
|
64
64
|
sla?: string;
|
|
65
65
|
/**
|
|
66
66
|
* For an **at-risk** `sla-status-change` rule — the displayName of the escalation
|
|
67
|
-
* (declared on the referenced SLA, `trigger: 'at-risk'`) that fires it
|
|
68
|
-
*
|
|
67
|
+
* (declared on the referenced SLA, `trigger: 'at-risk'`) that fires it, or
|
|
68
|
+
* {@link ANY_ESCALATION} to fire on every at-risk escalation of that SLA. Omit
|
|
69
|
+
* for a **breach** rule (`slaId` alone). Resolved to `escalationId`.
|
|
69
70
|
*/
|
|
70
|
-
escalation?: string;
|
|
71
|
+
escalation?: string | typeof ANY_ESCALATION;
|
|
71
72
|
/**
|
|
72
73
|
* For an `api-event` rule — the **name of the business event** it listens for,
|
|
73
74
|
* e.g. `rule('api-event', { businessEvent: 'Invoice Approved' })`. Declare the
|
|
@@ -83,6 +84,26 @@ export interface RuleOpts {
|
|
|
83
84
|
export interface CaseRule extends RuleOpts {
|
|
84
85
|
rule: CaseRuleType;
|
|
85
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* The escalation of an at-risk `sla-status-change` rule that fires on **any**
|
|
89
|
+
* at-risk escalation of the referenced SLA: the Case Designer's "Any" choice,
|
|
90
|
+
* which it writes by default when a rule's status is At risk. Written as
|
|
91
|
+
* `escalationId: "any"`; the platform runs it as one at-risk condition per
|
|
92
|
+
* at-risk escalation of that SLA. A symbol, not the string `'any'`, so it
|
|
93
|
+
* never names a real escalation whose displayName is "any".
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* **Enter a lane as soon as the case SLA is at risk, whichever escalation fires**
|
|
97
|
+
* ```ts
|
|
98
|
+
* casePlan('claims')
|
|
99
|
+
* .sla({ displayName: 'Resolution SLA', count: 10, unit: 'd', escalations: [
|
|
100
|
+
* escalation({ displayName: 'Warn owner', trigger: 'at-risk', atRiskPercentage: 80, notify: [toUser('owner@example.com')] }),
|
|
101
|
+
* ] })
|
|
102
|
+
* .exceptionStage('Escalation Review', (s) => s
|
|
103
|
+
* .entryWhen(rule('sla-status-change', { sla: 'Resolution SLA', escalation: ANY_ESCALATION })))
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare const ANY_ESCALATION: unique symbol;
|
|
86
107
|
/**
|
|
87
108
|
* Declare a condition rule. Pass one rule, an array for an AND-group, or an
|
|
88
109
|
* array of arrays for the complete OR-of-AND grid to
|
package/dist/case/case-sdk.js
CHANGED
|
@@ -29,8 +29,29 @@ import { schemaVersionRefusal } from '../schema-version.js';
|
|
|
29
29
|
import { CompileRefusal } from '../core/compile-refusal.js';
|
|
30
30
|
import { isConnectorPlaceholder } from './connector-placeholder.js';
|
|
31
31
|
import { unquoteLiteral } from './literal.js';
|
|
32
|
+
import { ANY_ESCALATION_KEY } from './rule-options.js';
|
|
32
33
|
export { preserveCaseJson } from './preserve.js';
|
|
33
34
|
export { CaseBuildError } from './case-expr-check.js';
|
|
35
|
+
/**
|
|
36
|
+
* The escalation of an at-risk `sla-status-change` rule that fires on **any**
|
|
37
|
+
* at-risk escalation of the referenced SLA: the Case Designer's "Any" choice,
|
|
38
|
+
* which it writes by default when a rule's status is At risk. Written as
|
|
39
|
+
* `escalationId: "any"`; the platform runs it as one at-risk condition per
|
|
40
|
+
* at-risk escalation of that SLA. A symbol, not the string `'any'`, so it
|
|
41
|
+
* never names a real escalation whose displayName is "any".
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* **Enter a lane as soon as the case SLA is at risk, whichever escalation fires**
|
|
45
|
+
* ```ts
|
|
46
|
+
* casePlan('claims')
|
|
47
|
+
* .sla({ displayName: 'Resolution SLA', count: 10, unit: 'd', escalations: [
|
|
48
|
+
* escalation({ displayName: 'Warn owner', trigger: 'at-risk', atRiskPercentage: 80, notify: [toUser('owner@example.com')] }),
|
|
49
|
+
* ] })
|
|
50
|
+
* .exceptionStage('Escalation Review', (s) => s
|
|
51
|
+
* .entryWhen(rule('sla-status-change', { sla: 'Resolution SLA', escalation: ANY_ESCALATION })))
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export const ANY_ESCALATION = Symbol.for(ANY_ESCALATION_KEY);
|
|
34
55
|
/**
|
|
35
56
|
* Declare a condition rule. Pass one rule, an array for an AND-group, or an
|
|
36
57
|
* array of arrays for the complete OR-of-AND grid to
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `references/implementation.md` Check 13, `references/case-schema.md`,
|
|
8
8
|
* `references/sla-response-shapes.md` §5).
|
|
9
9
|
*
|
|
10
|
-
* All
|
|
10
|
+
* All five are `lint`: compile still writes the plan as authored, so a
|
|
11
11
|
* decompiled source keeps the condition and `check` reports it again. Each is a
|
|
12
12
|
* warning wherever `validate --strict` accepts the plan as a working design.
|
|
13
13
|
*
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
* "AtRisk" : "Breached"`, PO.Frontend `GenerateCasePlanJsonConditionSlaStatusChangeRuleUtils.ts`),
|
|
18
18
|
* and `rule('sla-status-change', { sla, escalation })` names one escalation by
|
|
19
19
|
* its displayName, whose own `trigger` decides. The defect the skill describes
|
|
20
|
-
* comes from repairing `escalationId: "any"` by hand
|
|
20
|
+
* comes from repairing `escalationId: "any"` by hand; `ANY_ESCALATION` writes
|
|
21
|
+
* that value, and {@link anyEscalationWithoutAtRisk} covers the one way it
|
|
22
|
+
* goes wrong.
|
|
21
23
|
*/
|
|
22
24
|
import type { Diagnostic } from './check.js';
|
|
23
25
|
import type { BuiltCase } from './case-sdk.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ANY_ESCALATION_KEY } from './rule-options.js';
|
|
1
2
|
/** Every rule of a condition list, flattened. */
|
|
2
3
|
const rulesOf = (conditions) => conditions.flatMap((c) => c.rules.flat());
|
|
3
4
|
/** Every rule in the case, with the place `check` names for it. */
|
|
@@ -204,6 +205,38 @@ function slaReentry(built, decls, diags) {
|
|
|
204
205
|
}
|
|
205
206
|
}
|
|
206
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* A `sla-status-change` rule with `escalation: ANY_ESCALATION` on an SLA that
|
|
210
|
+
* declares no `at-risk` escalation. The converter expands `"any"` to one
|
|
211
|
+
* AtRisk condition per at-risk escalation of the SLA
|
|
212
|
+
* (PO.Frontend `GenerateCasePlanJsonConditionSlaStatusChangeRuleUtils.ts`), so
|
|
213
|
+
* with none it writes no condition at all and the rule never fires. The
|
|
214
|
+
* Designer validator skips `"any"`, so `validate` accepts the plan; a warning,
|
|
215
|
+
* like {@link exitedWithoutExit}. The SLA is the one the rule binds to (see
|
|
216
|
+
* {@link slaDecls}); an unknown name is UNKNOWN_SLA_REF.
|
|
217
|
+
*/
|
|
218
|
+
function anyEscalationWithoutAtRisk(built, decls, diags) {
|
|
219
|
+
// `ANY_ESCALATION` (case-sdk), matched by its registered key the way serialize does.
|
|
220
|
+
const any = Symbol.for(ANY_ESCALATION_KEY);
|
|
221
|
+
for (const { rule, where } of everyRule(built)) {
|
|
222
|
+
const named = rule.escalation;
|
|
223
|
+
if (rule.rule !== 'sla-status-change' || named !== any || rule.sla === undefined)
|
|
224
|
+
continue;
|
|
225
|
+
const bound = decls.get(rule.sla)?.at(-1)?.sla;
|
|
226
|
+
if (bound === undefined || bound.escalations.some((e) => e.trigger === 'at-risk'))
|
|
227
|
+
continue;
|
|
228
|
+
diags.push({
|
|
229
|
+
level: 'warning',
|
|
230
|
+
code: 'ANY_ESCALATION_NO_AT_RISK',
|
|
231
|
+
message: `Rule "sla-status-change" fires on ANY_ESCALATION of SLA "${rule.sla}", which declares no 'at-risk' escalation. `
|
|
232
|
+
+ 'The platform turns the wildcard into one at-risk condition per at-risk escalation of the SLA, so this rule '
|
|
233
|
+
+ 'gets none and never fires.',
|
|
234
|
+
suggestion: `For a breach response, drop the escalation: rule('sla-status-change', { sla: '${rule.sla}' }). For an `
|
|
235
|
+
+ `at-risk response, declare an escalation with trigger: 'at-risk' on "${rule.sla}".`,
|
|
236
|
+
where,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
207
240
|
/** The rules above, in the order `check` reports them. */
|
|
208
241
|
export function checkRuleSemantics(built, diags) {
|
|
209
242
|
adhocSelections(built, diags);
|
|
@@ -211,4 +244,5 @@ export function checkRuleSemantics(built, diags) {
|
|
|
211
244
|
const decls = slaDecls(built);
|
|
212
245
|
slaReentry(built, decls, diags);
|
|
213
246
|
slaNameDuplicates(built, decls, diags);
|
|
247
|
+
anyEscalationWithoutAtRisk(built, decls, diags);
|
|
214
248
|
}
|
package/dist/case/decompile.js
CHANGED
|
@@ -10,6 +10,7 @@ import { isHttpRequestOwnOutput, liftHttpRequest } from './decompile-http-reques
|
|
|
10
10
|
import { savedHttpRequestMetadata } from './http-request.js';
|
|
11
11
|
import { builtChainSource, chainStatements } from '../core/builder-chain.js';
|
|
12
12
|
import { literalSource } from './literal.js';
|
|
13
|
+
import { ANY_ESCALATION_ID } from './rule-options.js';
|
|
13
14
|
import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
|
|
14
15
|
import { EXTERNAL_TASK_CONTEXT, EXTERNAL_TASK_EVENT_CONTEXT, externalDescriptorRefusal, externalEventRefusal, externalServiceType, isExternalExecutionMode, libraryExecution } from './external.js';
|
|
15
16
|
import { preserveSchemaVersion } from '../schema-version.js';
|
|
@@ -520,7 +521,12 @@ function emitRule(rule, refs) {
|
|
|
520
521
|
if (!sla)
|
|
521
522
|
throw new Error(`sla-status-change rule references unnamed or unknown SLA id "${rule.slaId ?? ''}".`);
|
|
522
523
|
entries.push(['sla', tsLiteral(sla)]);
|
|
523
|
-
if (rule.escalationId
|
|
524
|
+
if (rule.escalationId === ANY_ESCALATION_ID) {
|
|
525
|
+
// The Designer's "any at-risk escalation" choice, not a dangling id.
|
|
526
|
+
refs.usesAnyEscalation = true;
|
|
527
|
+
entries.push(['escalation', 'ANY_ESCALATION']);
|
|
528
|
+
}
|
|
529
|
+
else if (rule.escalationId !== undefined) {
|
|
524
530
|
const escalation = refs.escalationNameById.get(rule.escalationId);
|
|
525
531
|
if (!escalation)
|
|
526
532
|
throw new Error(`sla-status-change rule references unnamed or unknown escalation id "${rule.escalationId}".`);
|
|
@@ -2646,6 +2652,8 @@ export function decompileWithDiagnostics(plan, options = {}) {
|
|
|
2646
2652
|
const imports = ['casePlan', 'rule', 'manualTrigger', 'timerTrigger', 'eventTrigger', 'jsonSchema', 'escalation', 'toUser', 'toGroup'];
|
|
2647
2653
|
if (preservation)
|
|
2648
2654
|
imports.push('preserveCaseJson');
|
|
2655
|
+
if (refs.usesAnyEscalation)
|
|
2656
|
+
imports.push('ANY_ESCALATION');
|
|
2649
2657
|
const diagnosticHeader = diagnostics.length
|
|
2650
2658
|
? `${[
|
|
2651
2659
|
'// BEST-EFFORT DECOMPILE: this source is intentionally not buildable until every marker below is repaired.',
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** Options each rule kind reads; check and serialize refuse any other key. */
|
|
2
2
|
import type { CaseRule } from './case-sdk.js';
|
|
3
|
+
/** The `Symbol.for` key of `ANY_ESCALATION`, so serialize and every SDK copy match it. */
|
|
4
|
+
export declare const ANY_ESCALATION_KEY = "@uipath/maestro-builder-sdk/case/anyEscalation";
|
|
5
|
+
/**
|
|
6
|
+
* The `escalationId` the Case Designer persists for its "any at-risk escalation"
|
|
7
|
+
* choice (`SLA_ANY_ESCALATION_VALUE` in Studio Web), authored as `ANY_ESCALATION`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ANY_ESCALATION_ID = "any";
|
|
3
10
|
/** One problem with a rule's shape: an unknown kind, or an option its kind does not read. */
|
|
4
11
|
export interface RuleShapeProblem {
|
|
5
12
|
code: 'UNKNOWN_RULE' | 'RULE_UNKNOWN_OPTION';
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ownEntry } from '../core/own-entry.js';
|
|
2
|
+
/** The `Symbol.for` key of `ANY_ESCALATION`, so serialize and every SDK copy match it. */
|
|
3
|
+
export const ANY_ESCALATION_KEY = '@uipath/maestro-builder-sdk/case/anyEscalation';
|
|
4
|
+
/**
|
|
5
|
+
* The `escalationId` the Case Designer persists for its "any at-risk escalation"
|
|
6
|
+
* choice (`SLA_ANY_ESCALATION_VALUE` in Studio Web), authored as `ANY_ESCALATION`.
|
|
7
|
+
*/
|
|
8
|
+
export const ANY_ESCALATION_ID = 'any';
|
|
2
9
|
/** `expression` is a gate any rule can carry. */
|
|
3
10
|
const COMMON = ['expression'];
|
|
4
11
|
const RULE_OPTIONS = {
|