@uipath/maestro-builder-sdk 6.120.8 → 6.120.9
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/case/connector-saved-context.js +6 -2
- package/dist/case/connector-saved-rows.d.ts +7 -0
- package/dist/case/connector-saved-rows.js +26 -10
- package/dist/case/decompile.d.ts +4 -0
- package/dist/case/decompile.js +22 -1
- package/dist/case/preserve.d.ts +26 -0
- package/dist/case/preserve.js +6 -0
- package/dist/case/serialize.js +42 -0
- package/dist/case/subscription.d.ts +21 -0
- package/dist/case/subscription.js +39 -0
- package/package.json +2 -2
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* for `parentFolderId` keeps both while the source still filters on that
|
|
35
35
|
* folder. Point it at another folder and compile writes its own body.
|
|
36
36
|
*/
|
|
37
|
-
import { caseSubscriptionOwners } from './subscription.js';
|
|
37
|
+
import { caseSubscriptionOwners, withScopeExpression } from './subscription.js';
|
|
38
38
|
const CONNECTOR_ACTIVITY_TYPE = 'execute-connector-activity';
|
|
39
39
|
/**
|
|
40
40
|
* Every connector element in a plan with the bag that holds its `context`:
|
|
@@ -180,7 +180,11 @@ export function savedConnectorContext(owner, bag) {
|
|
|
180
180
|
return undefined;
|
|
181
181
|
if (sdkShaped(bag, context))
|
|
182
182
|
return undefined;
|
|
183
|
-
|
|
183
|
+
const inputs = inputValues(bag);
|
|
184
|
+
// A subscription body saved with no match expression compares as compile writes it.
|
|
185
|
+
if (EVENT_SERVICE_TYPES.has(bag.serviceType) && inputs.body !== undefined)
|
|
186
|
+
inputs.body = withScopeExpression(inputs.body, owner);
|
|
187
|
+
return { owner, context: structuredClone(context), inputs };
|
|
184
188
|
}
|
|
185
189
|
/** Whether a wire `activityType` is a generic CRUD one (`Generic`, `GenericExpanded`, `GenericTrigger`). */
|
|
186
190
|
const isGenericKind = (activityType) => activityType.startsWith('Generic');
|
|
@@ -15,6 +15,13 @@ export interface PreservedExtractShape {
|
|
|
15
15
|
fields?: Record<string, unknown>;
|
|
16
16
|
/** The row was saved with no `target`. */
|
|
17
17
|
omit?: ['target'];
|
|
18
|
+
/**
|
|
19
|
+
* The row's saved `target`, when it names neither the row's id nor its
|
|
20
|
+
* variable: a copied task keeps the `target` of the row it was copied from
|
|
21
|
+
* (`target: '=id15'` on the row `{ id: 'id16', var: 'id16' }`). The row's
|
|
22
|
+
* `var` decides what it writes, so the target is the Designer's spelling.
|
|
23
|
+
*/
|
|
24
|
+
target?: string;
|
|
18
25
|
}
|
|
19
26
|
/** One saved connector element's own rows, as `preserveCaseJson` carries them. */
|
|
20
27
|
export interface PreservedConnectorRows {
|
|
@@ -49,15 +49,16 @@
|
|
|
49
49
|
*
|
|
50
50
|
* The author's extracts (`.outputs({ createdById: '=response.CreatedBy.Id' })`)
|
|
51
51
|
* are compile's to write, but the Designer saves them with a field compile
|
|
52
|
-
* does not write (`displayName: 'CreatedBy.Id'`) and without one it does
|
|
53
|
-
* (`target`)
|
|
52
|
+
* does not write (`displayName: 'CreatedBy.Id'`), and without one it does
|
|
53
|
+
* (`target`) or with a stale one (`target: '=id15'` on the row `id16`, kept
|
|
54
|
+
* from the task it was copied from). `extracts` records that difference per extract, keyed by the
|
|
54
55
|
* `source` it reads and the `var` it writes, and compile puts it back on the
|
|
55
56
|
* row that still reads that source into that variable, while the element calls
|
|
56
57
|
* the same operation. An extract the author edits (another source or
|
|
57
58
|
* variable) gets compile's row.
|
|
58
59
|
*/
|
|
59
60
|
import { comparesContextRow } from './connector-saved-context.js';
|
|
60
|
-
import { caseSubscriptionOwners } from './subscription.js';
|
|
61
|
+
import { caseSubscriptionOwners, withScopeExpression } from './subscription.js';
|
|
61
62
|
const CONNECTOR_ACTIVITY_TYPE = 'execute-connector-activity';
|
|
62
63
|
/** The context rows that name the operation an element calls. */
|
|
63
64
|
const OPERATION_ROWS = ['connectorKey', 'objectName', 'method', 'path', 'operation'];
|
|
@@ -199,7 +200,7 @@ function savedOutputs(bag, elementIds) {
|
|
|
199
200
|
return { rows: structuredClone(rows), ...(bag.outputs === undefined ? { absent: true } : {}) };
|
|
200
201
|
}
|
|
201
202
|
/** The saved inputs half, when compile would not write it as it is. */
|
|
202
|
-
function savedInputs(bag, activity, elementIds) {
|
|
203
|
+
function savedInputs(bag, activity, elementIds, owner) {
|
|
203
204
|
if (bag.inputs !== undefined && !Array.isArray(bag.inputs))
|
|
204
205
|
return undefined;
|
|
205
206
|
const rows = bag.inputs ?? [];
|
|
@@ -212,7 +213,11 @@ function savedInputs(bag, activity, elementIds) {
|
|
|
212
213
|
const complete = activity ? ACTIVITY_CONTAINERS.every((name) => names.has(name)) : rows.length === 1;
|
|
213
214
|
if (bag.inputs !== undefined && complete && rows.every((row) => sdkShapedInput(row, elementIds)))
|
|
214
215
|
return undefined;
|
|
215
|
-
|
|
216
|
+
// A subscription body saved with no match expression is carried as compile
|
|
217
|
+
// writes it (`withScopeExpression`): the engine needs the expression.
|
|
218
|
+
const carried = structuredClone(rows).map((row) => (!activity && row.name === 'body' && row.body !== undefined
|
|
219
|
+
? { ...row, body: withScopeExpression(row.body, owner) } : row));
|
|
220
|
+
return { rows: carried, ...(bag.inputs === undefined ? { absent: true } : {}) };
|
|
216
221
|
}
|
|
217
222
|
/**
|
|
218
223
|
* The saved own rows of a connector element, for each half compile would not
|
|
@@ -226,7 +231,7 @@ export function savedConnectorRows(owner, bag, elementIds) {
|
|
|
226
231
|
return undefined;
|
|
227
232
|
const activity = bag.serviceType !== 'Intsvc.EventTrigger' && bag.serviceType !== 'Intsvc.WaitForEvent';
|
|
228
233
|
const outputs = savedOutputs(bag, elementIds);
|
|
229
|
-
const inputs = savedInputs(bag, activity, elementIds);
|
|
234
|
+
const inputs = savedInputs(bag, activity, elementIds, owner);
|
|
230
235
|
const extracts = savedExtracts(bag);
|
|
231
236
|
if (!outputs && !inputs && !extracts)
|
|
232
237
|
return undefined;
|
|
@@ -261,9 +266,16 @@ function savedExtracts(bag) {
|
|
|
261
266
|
continue;
|
|
262
267
|
const fields = Object.fromEntries(Object.entries(row).filter(([key]) => !EXTRACT_WRITTEN_FIELDS.has(key)).map(([key, value]) => [key, structuredClone(value)]));
|
|
263
268
|
const omit = row.target === undefined;
|
|
264
|
-
|
|
269
|
+
// Compile writes `target: "=<id>"`; an own-name extract's id is its variable.
|
|
270
|
+
const target = typeof row.target === 'string' && row.target !== `=${row.id}` && row.target !== `=${row.var}` ? row.target : undefined;
|
|
271
|
+
if (!Object.keys(fields).length && !omit && target === undefined)
|
|
265
272
|
continue;
|
|
266
|
-
out.push({
|
|
273
|
+
out.push({
|
|
274
|
+
source: row.source, var: row.var,
|
|
275
|
+
...(Object.keys(fields).length ? { fields } : {}),
|
|
276
|
+
...(omit ? { omit: ['target'] } : {}),
|
|
277
|
+
...(target !== undefined ? { target } : {}),
|
|
278
|
+
});
|
|
267
279
|
}
|
|
268
280
|
return out.length ? out : undefined;
|
|
269
281
|
}
|
|
@@ -280,6 +292,9 @@ function extractsBack(bag, shapes) {
|
|
|
280
292
|
row[key] = structuredClone(value);
|
|
281
293
|
if (shape.omit?.includes('target'))
|
|
282
294
|
delete row.target;
|
|
295
|
+
// Only over the target compile writes, so an id compile changed keeps its own.
|
|
296
|
+
else if (shape.target !== undefined && row.target === `=${row.id}`)
|
|
297
|
+
row.target = shape.target;
|
|
283
298
|
}
|
|
284
299
|
}
|
|
285
300
|
/**
|
|
@@ -446,11 +461,12 @@ export function connectorRowErrors(entries) {
|
|
|
446
461
|
const { extracts } = entry;
|
|
447
462
|
if (extracts !== undefined) {
|
|
448
463
|
const shapeOk = (shape) => isObject(shape) && typeof shape.source === 'string' && /^=(?:response|Error)[.[]/.test(shape.source)
|
|
449
|
-
&& typeof shape.var === 'string' && Object.keys(shape).every((key) => ['source', 'var', 'fields', 'omit'].includes(key))
|
|
464
|
+
&& typeof shape.var === 'string' && Object.keys(shape).every((key) => ['source', 'var', 'fields', 'omit', 'target'].includes(key))
|
|
465
|
+
&& (shape.target === undefined || (typeof shape.target === 'string' && shape.target.startsWith('=') && shape.omit === undefined))
|
|
450
466
|
&& (shape.fields === undefined || (isObject(shape.fields) && Object.keys(shape.fields).every((key) => !EXTRACT_WRITTEN_FIELDS.has(key))))
|
|
451
467
|
&& (shape.omit === undefined || (Array.isArray(shape.omit) && shape.omit.length === 1 && shape.omit[0] === 'target'));
|
|
452
468
|
if (!Array.isArray(extracts) || !extracts.every(shapeOk))
|
|
453
|
-
errors.push(`preserved connector rows "${owner}" extracts must each name a source and a var, with only fields compile does not write and omit ["target"]`);
|
|
469
|
+
errors.push(`preserved connector rows "${owner}" extracts must each name a source and a var, with only fields compile does not write, and omit ["target"] or a "=" target`);
|
|
454
470
|
else if (new Set(extracts.map(extractKey)).size !== extracts.length)
|
|
455
471
|
errors.push(`preserved connector rows "${owner}" extracts name a source and var twice`);
|
|
456
472
|
}
|
package/dist/case/decompile.d.ts
CHANGED
|
@@ -283,6 +283,10 @@ type Preservation = {
|
|
|
283
283
|
connectorContexts?: PreservedConnectorContext[];
|
|
284
284
|
connectorConfigV2?: string[];
|
|
285
285
|
connectorRows?: PreservedConnectorRows[];
|
|
286
|
+
subscriptionBindings?: Array<{
|
|
287
|
+
owner: string;
|
|
288
|
+
bindings: Array<Record<string, unknown>>;
|
|
289
|
+
}>;
|
|
286
290
|
subscriptionFilters?: Array<{
|
|
287
291
|
owner: string;
|
|
288
292
|
expression?: 'inline';
|
package/dist/case/decompile.js
CHANGED
|
@@ -2352,6 +2352,17 @@ function ruleInputIdentity(inputs) {
|
|
|
2352
2352
|
return {};
|
|
2353
2353
|
return { inputs: rows.map((row) => ({ name: typeof row?.name === 'string' ? row.name : '', ...(typeof row?.id === 'string' ? { id: row.id } : {}) })) };
|
|
2354
2354
|
}
|
|
2355
|
+
/**
|
|
2356
|
+
* What a task entry condition was saved with that the builder does not author:
|
|
2357
|
+
* `isInterrupting` (the platform reads it on stage conditions only) and the
|
|
2358
|
+
* absence of a `displayName` (compile derives `"<task> entry"`).
|
|
2359
|
+
*/
|
|
2360
|
+
function taskEntryConditionShape(condition) {
|
|
2361
|
+
return {
|
|
2362
|
+
...(typeof condition.isInterrupting === 'boolean' ? { isInterrupting: condition.isInterrupting } : {}),
|
|
2363
|
+
...(condition.displayName === undefined ? { noDisplayName: true } : {}),
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2355
2366
|
function slaIdentity(sla) {
|
|
2356
2367
|
return {
|
|
2357
2368
|
...(sla.id ? { id: sla.id } : {}),
|
|
@@ -2633,7 +2644,10 @@ function identityPreservation(plan) {
|
|
|
2633
2644
|
name: taskSourceName(task),
|
|
2634
2645
|
...(task.id ? { id: task.id } : {}),
|
|
2635
2646
|
...savedTaskElementId(stage, task),
|
|
2636
|
-
entryConditions: (task.entryConditions ?? []).map(
|
|
2647
|
+
entryConditions: (task.entryConditions ?? []).map((condition, index, list) => ({
|
|
2648
|
+
...conditionIdentity(condition, index, list),
|
|
2649
|
+
...taskEntryConditionShape(condition),
|
|
2650
|
+
})),
|
|
2637
2651
|
...emptyLists(task, TASK_EMPTY_LISTS),
|
|
2638
2652
|
inputs: (task.data?.inputs ?? []).map((row) => ({ name: row.name ?? '', ...(row.id ? { id: row.id } : {}), ...actionInputShape(task, row), ...resourceRowShape(task, row, 'inputs'), ...rowHoldsSavedTaskElementId(stage, task, row) })),
|
|
2639
2653
|
outputs: (task.data?.outputs ?? []).map((row) => ({
|
|
@@ -3055,6 +3069,13 @@ export function collectPreservation(plan) {
|
|
|
3055
3069
|
.filter((entry) => entry !== undefined);
|
|
3056
3070
|
if (connectorRows.length)
|
|
3057
3071
|
preservation.connectorRows = connectorRows;
|
|
3072
|
+
// A subscription's own non-empty `bindings` (copies of the root Property rows
|
|
3073
|
+
// its filter reads), which compile writes empty (preserve.ts).
|
|
3074
|
+
const subscriptionBindings = caseSubscriptionOwners(plan)
|
|
3075
|
+
.filter(({ bag }) => Array.isArray(bag.bindings) && bag.bindings.length > 0)
|
|
3076
|
+
.map(({ key, bag }) => ({ owner: key, bindings: structuredClone(bag.bindings) }));
|
|
3077
|
+
if (subscriptionBindings.length)
|
|
3078
|
+
preservation.subscriptionBindings = subscriptionBindings;
|
|
3058
3079
|
const subscriptionFilterEntries = preservedSubscriptionFilters(plan);
|
|
3059
3080
|
if (subscriptionFilterEntries.length)
|
|
3060
3081
|
preservation.subscriptionFilters = subscriptionFilterEntries;
|
package/dist/case/preserve.d.ts
CHANGED
|
@@ -159,6 +159,19 @@ export interface PreservedActionDataFields extends PreservedTaskRef {
|
|
|
159
159
|
}
|
|
160
160
|
interface ConditionIdentity {
|
|
161
161
|
id?: string;
|
|
162
|
+
/**
|
|
163
|
+
* A task entry condition's saved `isInterrupting`. Studio Web writes it on
|
|
164
|
+
* some task entry conditions; the platform reads it only on a stage's
|
|
165
|
+
* (`cancelStagesAndTasks`), so the builder has no task option for it and it
|
|
166
|
+
* rides in the payload. Ignored on any other condition.
|
|
167
|
+
*/
|
|
168
|
+
isInterrupting?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* The task entry condition was saved with no `displayName`. Compile names
|
|
171
|
+
* every condition (`"<task> entry"`); the name goes again while the source
|
|
172
|
+
* still gives the condition none (the name compile wrote is the derived one).
|
|
173
|
+
*/
|
|
174
|
+
noDisplayName?: true;
|
|
162
175
|
/** The Designer's ids of the canvas edges drawn for the condition. */
|
|
163
176
|
edgeIds?: string[];
|
|
164
177
|
/**
|
|
@@ -503,6 +516,19 @@ export interface CaseJsonPreservation {
|
|
|
503
516
|
* (`case/connector-saved-rows.ts`).
|
|
504
517
|
*/
|
|
505
518
|
connectorRows?: PreservedConnectorRows[];
|
|
519
|
+
/**
|
|
520
|
+
* A subscription's own `bindings` (a wait-for-connector task or rule, an
|
|
521
|
+
* event trigger), saved non-empty, keyed by owner (`task:<stageId>:<taskId>`).
|
|
522
|
+
* Studio Web copies there the root `Property` binding rows its filter reads
|
|
523
|
+
* (`{ id, resource: 'Property', resourceKey: '<stageId>-<taskId>',
|
|
524
|
+
* propertyAttribute: 'entityScope', ... }`); compile writes `bindings: []`.
|
|
525
|
+
* Compile writes back each saved row whose id the subscription still reads
|
|
526
|
+
* (`=bindings.<id>`), and only where it wrote the list empty.
|
|
527
|
+
*/
|
|
528
|
+
subscriptionBindings?: Array<{
|
|
529
|
+
owner: string;
|
|
530
|
+
bindings: Array<Record<string, unknown>>;
|
|
531
|
+
}>;
|
|
506
532
|
/**
|
|
507
533
|
* Action tasks' Designer-owned `data` fields: the `context` rows the Designer
|
|
508
534
|
* saves with a form (its `hitlType`, quick-form schema ids, and a copy of the
|
package/dist/case/preserve.js
CHANGED
|
@@ -494,6 +494,12 @@ export function caseJsonPreservationErrors(payload) {
|
|
|
494
494
|
&& (!Array.isArray(payload.connectorConfigV2) || payload.connectorConfigV2.some((key) => typeof key !== 'string' || !key)))
|
|
495
495
|
errors.push('preserved connectorConfigV2 must be a list of connector element keys (task:<id>, rule:<id> or trigger:<id>)');
|
|
496
496
|
errors.push(...connectorRowErrors(payload.connectorRows));
|
|
497
|
+
for (const entry of payload.subscriptionBindings ?? []) {
|
|
498
|
+
if (typeof entry?.owner !== 'string' || !/^(trigger|task|rule):/.test(entry.owner))
|
|
499
|
+
errors.push(`preserved subscription bindings owner ${JSON.stringify(entry?.owner)} is not a trigger, task or rule key`);
|
|
500
|
+
else if (!Array.isArray(entry.bindings) || !entry.bindings.every((row) => row !== null && typeof row === 'object' && !Array.isArray(row) && typeof row.id === 'string' && row.id !== ''))
|
|
501
|
+
errors.push(`preserved subscription bindings of "${entry.owner}" must be binding rows with an id`);
|
|
502
|
+
}
|
|
497
503
|
for (const index of payload.manualTriggerServiceTypeNone ?? [])
|
|
498
504
|
if (!Number.isInteger(index) || index < 0)
|
|
499
505
|
errors.push(`manual trigger position "${index}" is not a non-negative integer`);
|
package/dist/case/serialize.js
CHANGED
|
@@ -555,6 +555,7 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
555
555
|
applySubscriptionFilters(result, preservation);
|
|
556
556
|
// After the ids are restored: an unchanged connector element takes its saved own io rows.
|
|
557
557
|
applyConnectorRows(result, preservation.connectorRows);
|
|
558
|
+
applySubscriptionBindings(result, preservation.subscriptionBindings);
|
|
558
559
|
// Last, once every row has its saved name and the connector rows are back.
|
|
559
560
|
restoreOutputInterleaving(result, preservation.identities);
|
|
560
561
|
Object.assign(result, preservation.topLevel ?? {});
|
|
@@ -1282,6 +1283,25 @@ function restoreNoTasks(data, spelling) {
|
|
|
1282
1283
|
else
|
|
1283
1284
|
data.tasks = [];
|
|
1284
1285
|
}
|
|
1286
|
+
/**
|
|
1287
|
+
* A task entry condition's saved `isInterrupting`, and the absence of a name
|
|
1288
|
+
* it was saved with (`ConditionIdentity`), by position. The name goes only
|
|
1289
|
+
* while it is the one compile derives for an unnamed condition, `"<task>
|
|
1290
|
+
* entry"` (with the suffix a repeat gets): a name the author typed stays.
|
|
1291
|
+
*/
|
|
1292
|
+
function restoreTaskEntryShape(task, wanted) {
|
|
1293
|
+
const conditions = Array.isArray(task?.entryConditions) ? task.entryConditions : [];
|
|
1294
|
+
const derived = new RegExp(`^${String(task?.displayName ?? '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&')} entry( \\d+)?$`);
|
|
1295
|
+
(wanted ?? []).forEach((shape, index) => {
|
|
1296
|
+
const condition = conditions[index];
|
|
1297
|
+
if (!condition)
|
|
1298
|
+
return;
|
|
1299
|
+
if (typeof shape.isInterrupting === 'boolean' && condition.isInterrupting === undefined)
|
|
1300
|
+
condition.isInterrupting = shape.isInterrupting;
|
|
1301
|
+
if (shape.noDisplayName === true && typeof condition.displayName === 'string' && derived.test(condition.displayName))
|
|
1302
|
+
delete condition.displayName;
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1285
1305
|
/**
|
|
1286
1306
|
* Retry the output-id claims that found their carried id held by another row
|
|
1287
1307
|
* (`claimRowId` returned `false`), until none moves.
|
|
@@ -1736,6 +1756,7 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1736
1756
|
savedTaskElementIds.push({ stage, task, elementId: taskIdentity.elementId, rows: elementIdRows });
|
|
1737
1757
|
restoreEmptyLists(task, taskIdentity.emptyLists, TASK_EMPTY_LISTS);
|
|
1738
1758
|
takeConditions(task?.entryConditions, taskIdentity.entryConditions);
|
|
1759
|
+
restoreTaskEntryShape(task, taskIdentity.entryConditions);
|
|
1739
1760
|
// An input row is matched by name when the name is unique on both sides
|
|
1740
1761
|
// (an input the author removed leaves the rows after it in place), else
|
|
1741
1762
|
// by position.
|
|
@@ -1970,6 +1991,27 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1970
1991
|
for (const { condition, edgeIds } of edgeLinked)
|
|
1971
1992
|
condition.edgeIds = [...edgeIds];
|
|
1972
1993
|
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Write each subscription's saved own `bindings` back
|
|
1996
|
+
* ({@link CaseJsonPreservation.subscriptionBindings}), after the ids are
|
|
1997
|
+
* restored, so an owner key names the same element. Only where compile wrote
|
|
1998
|
+
* the list empty, and only the rows the subscription still reads
|
|
1999
|
+
* (`=bindings.<id>` anywhere in it): an edit that drops a filter drops its row.
|
|
2000
|
+
*/
|
|
2001
|
+
function applySubscriptionBindings(result, entries) {
|
|
2002
|
+
if (!entries?.length)
|
|
2003
|
+
return;
|
|
2004
|
+
const byOwner = new Map(entries.map((entry) => [entry.owner, entry.bindings]));
|
|
2005
|
+
for (const { key, bag } of caseSubscriptionOwners(result)) {
|
|
2006
|
+
const saved = byOwner.get(key);
|
|
2007
|
+
if (!saved || !Array.isArray(bag.bindings) || bag.bindings.length !== 0)
|
|
2008
|
+
continue;
|
|
2009
|
+
const text = JSON.stringify({ ...bag, bindings: undefined });
|
|
2010
|
+
const read = saved.filter((row) => new RegExp(`bindings\\.${String(row.id).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?![\\w$])`).test(text));
|
|
2011
|
+
if (read.length)
|
|
2012
|
+
bag.bindings = read.map((row) => structuredClone(row));
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
1973
2015
|
/** Every condition and rule id in a plan: the conditions under `entryConditions`, `exitConditions` and `caseExitRules`, and their rules. */
|
|
1974
2016
|
function conditionAndRuleIds(plan) {
|
|
1975
2017
|
const ids = new Set();
|
|
@@ -110,6 +110,27 @@ export declare const CASE_FILTER_SPELLING: CaseFilterSpelling;
|
|
|
110
110
|
* // { filters: { expression: "=js:(`((Id=='{var_0}'))`)", variables: { var_0: '=js:(vars.request.Id)' } } }
|
|
111
111
|
*/
|
|
112
112
|
export declare function caseSubscriptionBody(rc: ResolvedConnector, where: Record<string, unknown>, conditions: readonly ReadEventFilter[], elementId: string, spelling?: CaseFilterSpelling): Record<string, unknown> | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* A saved subscription `body` with event parameters in `queryParams` and no
|
|
115
|
+
* `filters`, as compile writes it back: with the match expression those
|
|
116
|
+
* parameters give (`filters: { expression: "(k == 'v') && ..." }`), first, as
|
|
117
|
+
* {@link caseSubscriptionBody} orders it. Any other body comes back as it is.
|
|
118
|
+
*
|
|
119
|
+
* Such a body is what the SDK wrote before it wrote the expression (one Studio
|
|
120
|
+
* Web plan in the brownfield corpus has it too). The engine reads only
|
|
121
|
+
* `filters.expression` to match an event, so decompile reads the body back and
|
|
122
|
+
* compile adds the expression (`checkSubscriptionExpression` in decompile.ts).
|
|
123
|
+
* The carries that keep a saved element while it is unchanged
|
|
124
|
+
* (`connector-saved-context.ts`, `connector-saved-rows.ts`) compare the input
|
|
125
|
+
* values compile writes with the saved ones; they record the saved body this
|
|
126
|
+
* way, so the added expression is not read as an edit that drops the element's
|
|
127
|
+
* saved context and rows.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* // { queryParams: { entityScope: 'tenant' } }
|
|
131
|
+
* // -> { filters: { expression: "(entityScope == 'tenant')" }, queryParams: { entityScope: 'tenant' } }
|
|
132
|
+
*/
|
|
133
|
+
export declare function withScopeExpression(body: unknown, owner: string): unknown;
|
|
113
134
|
/** One subscription in a Case plan: the bag that carries it, keyed by its owner. */
|
|
114
135
|
export interface CaseSubscriptionOwner {
|
|
115
136
|
/** `trigger:<node id>`, `task:<stage id>:<task id>` or `rule:<stage id>:<rule id>`. */
|
|
@@ -185,6 +185,45 @@ export function caseSubscriptionBody(rc, where, conditions, elementId, spelling
|
|
|
185
185
|
body.parameters = parameters;
|
|
186
186
|
return Object.keys(body).length ? body : undefined;
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* A saved subscription `body` with event parameters in `queryParams` and no
|
|
190
|
+
* `filters`, as compile writes it back: with the match expression those
|
|
191
|
+
* parameters give (`filters: { expression: "(k == 'v') && ..." }`), first, as
|
|
192
|
+
* {@link caseSubscriptionBody} orders it. Any other body comes back as it is.
|
|
193
|
+
*
|
|
194
|
+
* Such a body is what the SDK wrote before it wrote the expression (one Studio
|
|
195
|
+
* Web plan in the brownfield corpus has it too). The engine reads only
|
|
196
|
+
* `filters.expression` to match an event, so decompile reads the body back and
|
|
197
|
+
* compile adds the expression (`checkSubscriptionExpression` in decompile.ts).
|
|
198
|
+
* The carries that keep a saved element while it is unchanged
|
|
199
|
+
* (`connector-saved-context.ts`, `connector-saved-rows.ts`) compare the input
|
|
200
|
+
* values compile writes with the saved ones; they record the saved body this
|
|
201
|
+
* way, so the added expression is not read as an edit that drops the element's
|
|
202
|
+
* saved context and rows.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* // { queryParams: { entityScope: 'tenant' } }
|
|
206
|
+
* // -> { filters: { expression: "(entityScope == 'tenant')" }, queryParams: { entityScope: 'tenant' } }
|
|
207
|
+
*/
|
|
208
|
+
export function withScopeExpression(body, owner) {
|
|
209
|
+
if (!body || typeof body !== 'object' || Array.isArray(body))
|
|
210
|
+
return body;
|
|
211
|
+
const saved = body;
|
|
212
|
+
const params = saved.queryParams;
|
|
213
|
+
if (saved.filters !== undefined || !params || typeof params !== 'object' || Array.isArray(params))
|
|
214
|
+
return body;
|
|
215
|
+
let expression;
|
|
216
|
+
try {
|
|
217
|
+
expression = eventMatchExpression(eventScopeClauses(params, owner).map((c) => `(${c})`), []);
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return body;
|
|
221
|
+
}
|
|
222
|
+
if (expression === '' || literalsOf(params).some((v) => literalProblem(v, false)))
|
|
223
|
+
return body;
|
|
224
|
+
return { filters: { expression }, ...saved };
|
|
225
|
+
}
|
|
226
|
+
const literalsOf = (params) => Object.values(params).map(String);
|
|
188
227
|
const SUBSCRIPTION_SERVICE_TYPES = new Set(['Intsvc.EventTrigger', 'Intsvc.WaitForEvent']);
|
|
189
228
|
/**
|
|
190
229
|
* Every connector event subscription in a plan, keyed by the ids of what owns
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.120.
|
|
3
|
+
"version": "6.120.9",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"@types/node": "^22.7.0",
|
|
125
125
|
"esbuild": "^0.28.1"
|
|
126
126
|
},
|
|
127
|
-
"gitref": "
|
|
127
|
+
"gitref": "47f18663967be1967931c35b6637a3c334bd427f"
|
|
128
128
|
}
|