@uipath/maestro-builder-sdk 6.120.11 → 6.120.13
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 +10 -9
- package/dist/api-members.md +15 -15
- package/dist/case/connector-saved-rows.js +20 -3
- package/dist/case/decompile.d.ts +6 -0
- package/dist/case/decompile.js +97 -21
- package/dist/case/preserve.d.ts +17 -3
- package/dist/case/preserve.js +11 -3
- package/dist/case/rule-names.d.ts +14 -6
- package/dist/case/rule-names.js +88 -17
- package/dist/case/serialize.js +158 -19
- package/dist/case/subscription.js +2 -0
- package/dist/core/actions.d.ts +22 -7
- package/dist/core/event-filters.d.ts +68 -6
- package/dist/core/event-filters.js +120 -12
- package/package.json +2 -2
package/dist/case/rule-names.js
CHANGED
|
@@ -24,24 +24,95 @@
|
|
|
24
24
|
* exit conditions, then its tasks' entry conditions set by set), then
|
|
25
25
|
* `metadata.caseExitRules`, then a preserved Case Manager configuration's tasks.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* The platform's numbered templates are localized (68 of them, in nine
|
|
28
|
+
* languages), and all are mirrored here: a decompiled pre-V32 document saved
|
|
29
|
+
* by a localized Designer repeats them (`開始ルール 1` on every task of a
|
|
30
|
+
* Japanese plan), and the platform renumbers each repeat (`開始ルール 2`). With
|
|
31
|
+
* the English list only, compile suffixed them instead (`開始ルール 1 2`), so an
|
|
32
|
+
* unedited round trip renamed every such condition.
|
|
33
|
+
* `tests/case-v32-native.test.ts` checks the list against the pin's.
|
|
33
34
|
*/
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'
|
|
35
|
+
/**
|
|
36
|
+
* The Designer's numbered condition names, every language
|
|
37
|
+
* (`NUMBERED_RULE_NAME_TEMPLATES` in `CaseManagementRuleNameTemplates.ts`,
|
|
38
|
+
* `@uipath/case-schema` 0.1173.0), verbatim: `{{number}}` is the counter, and
|
|
39
|
+
* the French ones put a no-break space (U+00A0) before it.
|
|
40
|
+
*/
|
|
41
|
+
export const NUMBERED_RULE_NAME_TEMPLATES = [
|
|
42
|
+
'Abschlussregel {{number}}',
|
|
43
|
+
'Austrittsregel {{number}}',
|
|
44
|
+
'Bedingung {{number}}',
|
|
45
|
+
'Case completion rule {{number}}',
|
|
46
|
+
'Case exit {{number}}',
|
|
47
|
+
'Completion rule {{number}}',
|
|
48
|
+
'Condición {{number}}',
|
|
49
|
+
'Condition {{number}}',
|
|
50
|
+
'Condição {{number}}',
|
|
51
|
+
'Condiție {{number}}',
|
|
52
|
+
'Eintrittsregel {{number}}',
|
|
53
|
+
'Entry rule {{number}}',
|
|
54
|
+
'Exit rule {{number}}',
|
|
55
|
+
'Fallabschlussregel {{number}}',
|
|
56
|
+
'Fallaustritt {{number}}',
|
|
57
|
+
'Giriş kuralı {{number}}',
|
|
58
|
+
'Ieșire din caz {{number}}',
|
|
59
|
+
'Koşul {{number}}',
|
|
60
|
+
'Regla de entrada {{number}}',
|
|
61
|
+
'Regla de finalización de caso {{number}}',
|
|
62
|
+
'Regla de finalización del caso {{number}}',
|
|
63
|
+
'Regla de finalización {{number}}',
|
|
64
|
+
'Regla de salida {{number}}',
|
|
65
|
+
'Regra de conclusão de caso {{number}}',
|
|
66
|
+
'Regra de conclusão do caso {{number}}',
|
|
67
|
+
'Regra de conclusão {{number}}',
|
|
68
|
+
'Regra de entrada {{number}}',
|
|
69
|
+
'Regra de saída {{number}}',
|
|
70
|
+
'Regulă de finalizare a cazului {{number}}',
|
|
71
|
+
'Regulă de finalizare {{number}}',
|
|
72
|
+
'Regulă de ieșire {{number}}',
|
|
73
|
+
'Regulă de intrare {{number}}',
|
|
74
|
+
'Règle de fin du cas\u00A0{{number}}',
|
|
75
|
+
'Règle de fin\u00A0{{number}}',
|
|
76
|
+
'Règle d’entrée\u00A0{{number}}',
|
|
77
|
+
'Règles de sortie\u00A0{{number}}',
|
|
78
|
+
'Salida de caso {{number}}',
|
|
79
|
+
'Salida del caso {{number}}',
|
|
80
|
+
'Saída de caso {{number}}',
|
|
81
|
+
'Saída do caso: {{number}}',
|
|
82
|
+
'Sortie de cas\u00A0{{number}}',
|
|
83
|
+
'Tamamlama kuralı {{number}}',
|
|
84
|
+
'Çıkış kuralı {{number}}',
|
|
85
|
+
'İşlem birimi tamamlama kuralı {{number}}',
|
|
86
|
+
'İşlem birimi çıkışı {{number}}',
|
|
87
|
+
'ケースの終了 {{number}}',
|
|
88
|
+
'ケース完了ルール {{number}}',
|
|
89
|
+
'完了ルール {{number}}',
|
|
90
|
+
'完成規則 {{number}}',
|
|
91
|
+
'完成规则 {{number}}',
|
|
92
|
+
'条件 {{number}}',
|
|
93
|
+
'案件完成規則 {{number}}',
|
|
94
|
+
'案件結束 {{number}}',
|
|
95
|
+
'案例完成规则 {{number}}',
|
|
96
|
+
'案例退出 {{number}}',
|
|
97
|
+
'條件 {{number}}',
|
|
98
|
+
'終了ルール {{number}}',
|
|
99
|
+
'輸入規則 {{number}}',
|
|
100
|
+
'进入规则 {{number}}',
|
|
101
|
+
'退出規則 {{number}}',
|
|
102
|
+
'退出规则 {{number}}',
|
|
103
|
+
'開始ルール {{number}}',
|
|
104
|
+
'사례 완료 규칙 {{number}}',
|
|
105
|
+
'사례 종료 {{number}}',
|
|
106
|
+
'완료 규칙 {{number}}',
|
|
107
|
+
'조건 {{number}}',
|
|
108
|
+
'종료 규칙 {{number}}',
|
|
109
|
+
'진입 규칙 {{number}}',
|
|
42
110
|
];
|
|
43
111
|
const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
44
|
-
const numbered = (flags) =>
|
|
112
|
+
const numbered = (flags) => NUMBERED_RULE_NAME_TEMPLATES.map((template) => ({
|
|
113
|
+
template,
|
|
114
|
+
pattern: new RegExp(`^${escapeRegex(template).replace('\\{\\{number\\}\\}', '\\d+')}$`, flags),
|
|
115
|
+
}));
|
|
45
116
|
const NUMBERED_EXACT = numbered('');
|
|
46
117
|
const NUMBERED_LOOSE = numbered('i');
|
|
47
118
|
const TRAILING_NUMBER = /^(.*\D)(\d+)$/;
|
|
@@ -123,8 +194,8 @@ export function dedupeConditionNames(plan) {
|
|
|
123
194
|
};
|
|
124
195
|
// V31 -> V32: only a repeated generated name, renumbered from 1.
|
|
125
196
|
pass((name, taken) => {
|
|
126
|
-
const
|
|
127
|
-
return
|
|
197
|
+
const match = NUMBERED_EXACT.find(({ pattern }) => pattern.test(name));
|
|
198
|
+
return match ? nextNumberedName(taken, (n) => match.template.replace('{{number}}', String(n))) : undefined;
|
|
128
199
|
});
|
|
129
200
|
// V32 -> V32.0.1: every remaining repeat.
|
|
130
201
|
pass((name, taken) => {
|
package/dist/case/serialize.js
CHANGED
|
@@ -556,8 +556,10 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
556
556
|
// After the ids are restored: an unchanged connector element takes its saved own io rows.
|
|
557
557
|
applyConnectorRows(result, preservation.connectorRows);
|
|
558
558
|
applySubscriptionBindings(result, preservation.subscriptionBindings);
|
|
559
|
-
//
|
|
559
|
+
// Once every row has its saved name and the connector rows are back.
|
|
560
560
|
restoreOutputInterleaving(result, preservation.identities);
|
|
561
|
+
// Last: an unchanged task's output rows take their full saved order.
|
|
562
|
+
restoreOutputRowOrder(result, preservation.identities);
|
|
561
563
|
Object.assign(result, preservation.topLevel ?? {});
|
|
562
564
|
Object.assign(result.metadata, preservation.metadata ?? {});
|
|
563
565
|
const metadata = result.metadata;
|
|
@@ -594,10 +596,21 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
594
596
|
const variables = result.variables;
|
|
595
597
|
for (const [lane, order] of Object.entries(preservation.variableOrder ?? {})) {
|
|
596
598
|
const rows = variables[lane] ?? [];
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
// Each name holds its rows in compile order, and the n-th time `order` lists
|
|
600
|
+
// a name takes the n-th row: two variables can share a name (two In-args
|
|
601
|
+
// both named `PRODUCER`), and a one-row-per-name map put the last of them
|
|
602
|
+
// in both places, so the first was lost from the plan.
|
|
603
|
+
const byName = new Map();
|
|
604
|
+
for (const row of rows) {
|
|
605
|
+
const name = String(row.name ?? '');
|
|
606
|
+
byName.set(name, [...(byName.get(name) ?? []), row]);
|
|
607
|
+
}
|
|
608
|
+
const ordered = (order ?? []).flatMap((name) => {
|
|
609
|
+
const row = byName.get(name)?.shift();
|
|
610
|
+
return row ? [row] : [];
|
|
611
|
+
});
|
|
612
|
+
const placed = new Set(ordered);
|
|
613
|
+
variables[lane] = [...ordered, ...rows.filter((row) => !placed.has(row))];
|
|
601
614
|
}
|
|
602
615
|
let elementIds;
|
|
603
616
|
for (const [lane, byName] of Object.entries(preservation.variableFields ?? {})) {
|
|
@@ -690,6 +703,7 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
690
703
|
if (!Object.keys(bag).length)
|
|
691
704
|
delete node.data[CASE_FORMAT_PROFILE.triggerBagField];
|
|
692
705
|
}
|
|
706
|
+
restoreTriggerlessInArgs(result, preservation.triggerlessInArgs);
|
|
693
707
|
for (const name of preservation.omitInputDefaults ?? []) {
|
|
694
708
|
const row = (variables.inputs ?? []).find((candidate) => candidate.name === name);
|
|
695
709
|
if (row?.default === '')
|
|
@@ -1286,6 +1300,51 @@ function restoreNoTasks(data, spelling) {
|
|
|
1286
1300
|
else
|
|
1287
1301
|
data.tasks = [];
|
|
1288
1302
|
}
|
|
1303
|
+
/** The fields compile writes on a resource task's input that the row can be saved without (decompile's `resourceRowShape`). */
|
|
1304
|
+
const RESOURCE_INPUT_OMITTABLE = new Set(['id', 'var', 'elementId']);
|
|
1305
|
+
/**
|
|
1306
|
+
* Each task's output rows back in the order they were saved in, while the task
|
|
1307
|
+
* still has exactly the rows it was saved with.
|
|
1308
|
+
*
|
|
1309
|
+
* Compile writes a connector task's rows as `uip maestro case sdd convert`
|
|
1310
|
+
* does: `response`, `Error`, then the author's extracts. The Case Designer
|
|
1311
|
+
* writes the extracts before `Error`:
|
|
1312
|
+
*
|
|
1313
|
+
* saved: response4, createdById, id, updatedById, error12
|
|
1314
|
+
* compiled: response4, error12, createdById, id, updatedById
|
|
1315
|
+
*
|
|
1316
|
+
* Row order is part of the plan the Designer reads, so an unedited round trip
|
|
1317
|
+
* keeps it. The saved order is the identity's `outputs`, read once every id is
|
|
1318
|
+
* final. A task whose rows the edit changed (a row added or removed, or one
|
|
1319
|
+
* with no id to match on) keeps compile's order.
|
|
1320
|
+
*/
|
|
1321
|
+
function restoreOutputRowOrder(result, identities) {
|
|
1322
|
+
const savedOrder = new Map();
|
|
1323
|
+
for (const stage of identities?.stages ?? [])
|
|
1324
|
+
for (const lane of stage.tasks ?? [])
|
|
1325
|
+
for (const task of lane)
|
|
1326
|
+
if (typeof task.id === 'string' && task.outputs?.length && task.outputs.every((row) => typeof row.id === 'string'))
|
|
1327
|
+
savedOrder.set(task.id, task.outputs.map((row) => row.id));
|
|
1328
|
+
if (!savedOrder.size)
|
|
1329
|
+
return;
|
|
1330
|
+
for (const node of result.nodes ?? []) {
|
|
1331
|
+
if (!String(node?.type ?? '').endsWith('Stage'))
|
|
1332
|
+
continue;
|
|
1333
|
+
for (const task of (node.data?.tasks ?? []).flat()) {
|
|
1334
|
+
const order = savedOrder.get(task?.id);
|
|
1335
|
+
const rows = task?.data?.outputs;
|
|
1336
|
+
if (!order || !Array.isArray(rows) || rows.length !== order.length)
|
|
1337
|
+
continue;
|
|
1338
|
+
const at = new Map(order.map((id, index) => [id, index]));
|
|
1339
|
+
if (at.size !== order.length)
|
|
1340
|
+
continue;
|
|
1341
|
+
const ids = rows.map((row) => row?.id);
|
|
1342
|
+
if (!ids.every((id) => typeof id === 'string' && at.has(id)) || new Set(ids).size !== ids.length)
|
|
1343
|
+
continue;
|
|
1344
|
+
rows.sort((left, right) => at.get(left.id) - at.get(right.id));
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1289
1348
|
/**
|
|
1290
1349
|
* A task entry condition's saved `isInterrupting`, and the absence of a name
|
|
1291
1350
|
* it was saved with (`ConditionIdentity`), by position. The name goes only
|
|
@@ -1448,7 +1507,7 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1448
1507
|
// it was saved without (`omit`), put back on the row of the same name after
|
|
1449
1508
|
// the id renames. Example: `{ name: 'echoIn', fields: { displayName: 'echoIn',
|
|
1450
1509
|
// title: 'echoIn' } }` gives the compiled `echoIn` row both back.
|
|
1451
|
-
const carryRowShape = (row, wanted) => {
|
|
1510
|
+
const carryRowShape = (row, wanted, input = false) => {
|
|
1452
1511
|
if (!row || row.name !== wanted.name || (!wanted.fields && !wanted.omit && !wanted.target && wanted.originalVar === undefined && wanted.noAlias !== true))
|
|
1453
1512
|
return;
|
|
1454
1513
|
// An own-name row the Designer saved without the controlled alias compile
|
|
@@ -1464,9 +1523,12 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1464
1523
|
for (const [key, value] of Object.entries(wanted.fields ?? {}))
|
|
1465
1524
|
if (!Object.prototype.hasOwnProperty.call(row, key))
|
|
1466
1525
|
row[key] = structuredClone(value);
|
|
1526
|
+
// An extract saved with no `target`, and a resource input saved without
|
|
1527
|
+
// a field compile writes on every input (`resourceRowShape`), stay so.
|
|
1528
|
+
// An output's other `omit` entries are an action form row's (`takeOutputRows`).
|
|
1467
1529
|
for (const key of wanted.omit ?? [])
|
|
1468
|
-
if (key === 'target')
|
|
1469
|
-
delete row
|
|
1530
|
+
if (input ? RESOURCE_INPUT_OMITTABLE.has(key) : key === 'target')
|
|
1531
|
+
delete row[key];
|
|
1470
1532
|
});
|
|
1471
1533
|
// Two Designer spellings, applied once every row id is final:
|
|
1472
1534
|
// - An own-name row (`id == var`) saved with the variable it wrote before a
|
|
@@ -1807,7 +1869,7 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1807
1869
|
return;
|
|
1808
1870
|
}
|
|
1809
1871
|
takeRow(input, row.id, false);
|
|
1810
|
-
carryRowShape(input, rowShape(row));
|
|
1872
|
+
carryRowShape(input, rowShape(row), true);
|
|
1811
1873
|
});
|
|
1812
1874
|
// A non-action task's row `fields` / `omit` are a resource's (only
|
|
1813
1875
|
// decompile's `resourceRowShape` writes them), so they need the same
|
|
@@ -1864,9 +1926,14 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1864
1926
|
// `variableKeys`) get the Designer's name back, and so does each custom row
|
|
1865
1927
|
// that assigns one, which the Designer labels with the variable's name.
|
|
1866
1928
|
const renamedVariables = new Map();
|
|
1867
|
-
for (const [lane, rows] of Object.entries(identities.variables ?? {}))
|
|
1929
|
+
for (const [lane, rows] of Object.entries(identities.variables ?? {})) {
|
|
1930
|
+
// The n-th identity row of a name restores the n-th variable of that name:
|
|
1931
|
+
// two variables can share a name (see `emitVariables`' `companionId`).
|
|
1932
|
+
const claimed = new Set();
|
|
1868
1933
|
(rows ?? []).forEach((row) => {
|
|
1869
|
-
let variable = variables[lane]?.find((candidate) => candidate.name === row.name);
|
|
1934
|
+
let variable = variables[lane]?.find((candidate) => candidate.name === row.name && !claimed.has(candidate));
|
|
1935
|
+
if (variable)
|
|
1936
|
+
claimed.add(variable);
|
|
1870
1937
|
if (!variable && lane === 'inputOutputs' && typeof row.id === 'string') {
|
|
1871
1938
|
variable = variables[lane]?.find((candidate) => candidate.id === row.id && candidate.name === row.id);
|
|
1872
1939
|
if (variable) {
|
|
@@ -1881,6 +1948,7 @@ function applyPreservedIdentities(result, preservation, warn) {
|
|
|
1881
1948
|
return;
|
|
1882
1949
|
take(variable, row.id);
|
|
1883
1950
|
});
|
|
1951
|
+
}
|
|
1884
1952
|
if (renamedVariables.size)
|
|
1885
1953
|
for (const row of [...planOutputRows(result, stages), ...triggerOutputRows(nodes)])
|
|
1886
1954
|
if (row?.custom === true && row.name === row.var && renamedVariables.has(row.var))
|
|
@@ -2206,8 +2274,26 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2206
2274
|
throw new CompileRefusal('CASE_VAR_DESCRIPTION_NOT_STRING', `Case variable "${vd.name}" has a non-string description.`);
|
|
2207
2275
|
return { description: vd.description };
|
|
2208
2276
|
};
|
|
2209
|
-
|
|
2210
|
-
|
|
2277
|
+
// A companion's id is the variable's name. Two variables can share a name (a
|
|
2278
|
+
// Designer case with two In-args both named `PRODUCER`, on ids `producer` and
|
|
2279
|
+
// `producer2`): each still takes its own companion id, else both compile to
|
|
2280
|
+
// `id: "PRODUCER"` and the payload's id restore (`take`, keyed by id) cannot
|
|
2281
|
+
// tell them apart, so the second one's references collapse onto the first.
|
|
2282
|
+
const companionIds = new Set(vars.map((vd) => vd.name));
|
|
2283
|
+
const namesSeen = new Set();
|
|
2284
|
+
const companionIdOf = (vd) => {
|
|
2285
|
+
if (!namesSeen.has(vd.name)) {
|
|
2286
|
+
namesSeen.add(vd.name);
|
|
2287
|
+
return vd.name;
|
|
2288
|
+
}
|
|
2289
|
+
let id = '';
|
|
2290
|
+
for (let n = 2; companionIds.has((id = `${vd.name}_${n}`)); n++)
|
|
2291
|
+
;
|
|
2292
|
+
companionIds.add(id);
|
|
2293
|
+
return id;
|
|
2294
|
+
};
|
|
2295
|
+
const readableCompanion = (vd, declares, id) => ({
|
|
2296
|
+
id,
|
|
2211
2297
|
name: vd.name,
|
|
2212
2298
|
type: vd.type,
|
|
2213
2299
|
...encodedDefault(vd),
|
|
@@ -2217,6 +2303,7 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2217
2303
|
});
|
|
2218
2304
|
for (const vd of vars) {
|
|
2219
2305
|
const slotId = ids.make('v', 8, `var:${vd.name}`);
|
|
2306
|
+
const varId = companionIdOf(vd);
|
|
2220
2307
|
const entry = {
|
|
2221
2308
|
id: slotId,
|
|
2222
2309
|
name: vd.name,
|
|
@@ -2226,7 +2313,7 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2226
2313
|
// converter's end event finds that companion by `output.var` alone
|
|
2227
2314
|
// (PO.Frontend `buildOutputArgEndEventData`); a slot without it is dropped
|
|
2228
2315
|
// from the end event, so the case finishes with the output never written.
|
|
2229
|
-
...(vd.direction === 'out' ? { var:
|
|
2316
|
+
...(vd.direction === 'out' ? { var: varId } : {}),
|
|
2230
2317
|
// A trigger-bound In-arg always carries a default, `""` when none was
|
|
2231
2318
|
// authored. It is written here, ahead of a structured var's schema, so
|
|
2232
2319
|
// `{ type }` and `{ type, default: "" }` emit the same bytes and a
|
|
@@ -2270,16 +2357,16 @@ function emitVariables(vars, ids, triggerNodeByRef, triggerNodes, triggers, coll
|
|
|
2270
2357
|
entry.required = vd.required;
|
|
2271
2358
|
}
|
|
2272
2359
|
inputs.push(entry);
|
|
2273
|
-
inputOutputs.push({ id:
|
|
2274
|
-
appendTriggerBridge(node, { name: vd.name, type: vd.type, source: `=vars.${slotId}`, var:
|
|
2360
|
+
inputOutputs.push({ id: varId, name: vd.name, type: vd.type, elementId: node.id, ...jsonSchemaFields(vd) });
|
|
2361
|
+
appendTriggerBridge(node, { name: vd.name, type: vd.type, source: `=vars.${slotId}`, var: varId });
|
|
2275
2362
|
}
|
|
2276
2363
|
else if (vd.direction === 'out') {
|
|
2277
2364
|
outputs.push(entry); // formal declaration
|
|
2278
|
-
inputOutputs.push(readableCompanion(vd, false)); // …made readable as `vars.<name>`
|
|
2365
|
+
inputOutputs.push(readableCompanion(vd, false, varId)); // …made readable as `vars.<name>`
|
|
2279
2366
|
}
|
|
2280
2367
|
else {
|
|
2281
2368
|
// inout: the root companion IS its declaration (nothing references the slot).
|
|
2282
|
-
inputOutputs.push(readableCompanion(vd, true));
|
|
2369
|
+
inputOutputs.push(readableCompanion(vd, true, varId));
|
|
2283
2370
|
}
|
|
2284
2371
|
}
|
|
2285
2372
|
const out = { inputOutputs };
|
|
@@ -3103,7 +3190,6 @@ function ruleOutputRows(conditions) {
|
|
|
3103
3190
|
const bag = CASE_FORMAT_PROFILE.waitConnectorRuleBagField;
|
|
3104
3191
|
return (conditions ?? []).flatMap((condition) => (condition?.rules ?? []).flat().flatMap((rule) => rule?.[bag]?.outputs ?? []));
|
|
3105
3192
|
}
|
|
3106
|
-
/** Every output row in the plan: stage and task rule rows, task rows, and case-exit rule rows. */
|
|
3107
3193
|
/** Every wait-for-connector rule's own output row in the plan: stage and task conditions, and the case exit rules. */
|
|
3108
3194
|
function planRuleOutputRows(result, stages) {
|
|
3109
3195
|
return [
|
|
@@ -3115,6 +3201,59 @@ function planRuleOutputRows(result, stages) {
|
|
|
3115
3201
|
...ruleOutputRows(result.metadata?.caseExitRules),
|
|
3116
3202
|
].filter((row) => row && typeof row === 'object');
|
|
3117
3203
|
}
|
|
3204
|
+
/**
|
|
3205
|
+
* Put back each In-arg saved bound to no trigger (`triggerlessInArgs` in
|
|
3206
|
+
* decompile.ts) while the source still binds it to the trigger its bare
|
|
3207
|
+
* `.input()` binds to: its saved `elementId`, no bridge row on that trigger,
|
|
3208
|
+
* and the root row of its name as it was saved: re-keyed to its saved
|
|
3209
|
+
* `elementId`, or, when the plan had none, gone. A controlled alias
|
|
3210
|
+
* (`originalVar == id`) that compile wrote on an own-name output only because
|
|
3211
|
+
* that companion existed goes with it.
|
|
3212
|
+
*
|
|
3213
|
+
* An edit that renames the In-arg or binds it to another trigger gets
|
|
3214
|
+
* compile's binding.
|
|
3215
|
+
*/
|
|
3216
|
+
function restoreTriggerlessInArgs(result, entries) {
|
|
3217
|
+
if (!entries?.length)
|
|
3218
|
+
return;
|
|
3219
|
+
const variables = result.variables;
|
|
3220
|
+
const nodes = result.nodes;
|
|
3221
|
+
const removed = new Set();
|
|
3222
|
+
for (const { name, elementId, trigger, companion } of entries) {
|
|
3223
|
+
const matching = (variables.inputs ?? []).filter((candidate) => candidate.name === name);
|
|
3224
|
+
const input = matching[0];
|
|
3225
|
+
if (matching.length !== 1 || !input || typeof input.id !== 'string' || input.elementId !== trigger)
|
|
3226
|
+
continue;
|
|
3227
|
+
const node = nodes.find((candidate) => candidate.id === trigger);
|
|
3228
|
+
if (!node)
|
|
3229
|
+
continue;
|
|
3230
|
+
const roots = (variables.inputOutputs ?? []).filter((row) => row.name === name);
|
|
3231
|
+
if (roots.length !== 1 || roots[0].elementId !== trigger)
|
|
3232
|
+
continue;
|
|
3233
|
+
input.elementId = elementId;
|
|
3234
|
+
const bag = node.data?.[CASE_FORMAT_PROFILE.triggerBagField];
|
|
3235
|
+
if (Array.isArray(bag?.outputs)) {
|
|
3236
|
+
bag.outputs = bag.outputs.filter((row) => row?.source !== `=vars.${input.id}`);
|
|
3237
|
+
if (!bag.outputs.length)
|
|
3238
|
+
delete bag.outputs;
|
|
3239
|
+
if (!Object.keys(bag).length)
|
|
3240
|
+
delete node.data[CASE_FORMAT_PROFILE.triggerBagField];
|
|
3241
|
+
}
|
|
3242
|
+
if (companion !== undefined)
|
|
3243
|
+
roots[0].elementId = companion;
|
|
3244
|
+
else {
|
|
3245
|
+
variables.inputOutputs = (variables.inputOutputs ?? []).filter((row) => row !== roots[0]);
|
|
3246
|
+
removed.add(name);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
if (!removed.size)
|
|
3250
|
+
return;
|
|
3251
|
+
const stages = nodes.filter((node) => String(node.type ?? '').endsWith('Stage'));
|
|
3252
|
+
for (const row of planOutputRows(result, stages))
|
|
3253
|
+
if (typeof row?.id === 'string' && removed.has(row.id) && row.var === row.id && row.originalVar === row.id)
|
|
3254
|
+
delete row.originalVar;
|
|
3255
|
+
}
|
|
3256
|
+
/** Every output row in the plan: stage and task rule rows, task rows, and case-exit rule rows. */
|
|
3118
3257
|
function planOutputRows(result, stages) {
|
|
3119
3258
|
return [
|
|
3120
3259
|
...stages.flatMap((stage) => [
|
|
@@ -151,6 +151,8 @@ export function caseSubscriptionBody(rc, where, conditions, elementId, spelling
|
|
|
151
151
|
const literals = [
|
|
152
152
|
...Object.values(eventParameters).map(String),
|
|
153
153
|
...conditions.filter((c) => c.expression === undefined && typeof c.value === 'string').map((c) => String(c.value)),
|
|
154
|
+
// An `isOneOf` list's text values sit in the expression too.
|
|
155
|
+
...conditions.flatMap((c) => (Array.isArray(c.value) ? c.value.filter((v) => typeof v === 'string') : [])),
|
|
154
156
|
];
|
|
155
157
|
for (const literal of literals) {
|
|
156
158
|
const problem = literalProblem(literal, computed);
|
package/dist/core/actions.d.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Expr } from './expr.js';
|
|
11
11
|
import type { LookupToken } from './lookups.js';
|
|
12
|
-
import type { EventFilterExpression } from './event-filters.js';
|
|
13
|
-
export type { EventFilterExpression } from './event-filters.js';
|
|
12
|
+
import type { EventFilterExpression, EventFilterList } from './event-filters.js';
|
|
13
|
+
export type { EventFilterExpression, EventFilterList } from './event-filters.js';
|
|
14
14
|
import { type ConnectorDescriptor, type TriggerDescriptor } from './connectors.js';
|
|
15
15
|
import type { CarriedConnectorOperation } from './carried-connector-operation.js';
|
|
16
16
|
export interface ConnectorOpts {
|
|
@@ -1106,20 +1106,35 @@ export type EventFilter = {
|
|
|
1106
1106
|
isNot: true;
|
|
1107
1107
|
});
|
|
1108
1108
|
/**
|
|
1109
|
-
* A Case event filter: an {@link EventFilter},
|
|
1109
|
+
* A Case event filter: an {@link EventFilter}, a text test or equality whose
|
|
1110
1110
|
* value is computed at runtime from a Case expression ({@link EventFilterExpression}):
|
|
1111
|
-
* `{ expression: '=vars.<path>' }` or `{ expression: '=js:<expression>' }
|
|
1111
|
+
* `{ expression: '=vars.<path>' }` or `{ expression: '=js:<expression>' }`,
|
|
1112
|
+
* or one of the Case designer's own tests:
|
|
1112
1113
|
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1114
|
+
* - `isOneOf`: the field is one of the listed values ({@link EventFilterList}).
|
|
1115
|
+
* Numbers compare as numbers (`` contains(`[0,5]`, Status) ``, a choice
|
|
1116
|
+
* set's option values), strings as text. On an array field (`decision[*]`)
|
|
1117
|
+
* it matches an element (`` decision[?contains(`[1]`, @)] ``);
|
|
1118
|
+
* - `isEmpty: true` / `isNotEmpty: true`: the field has no value / has one
|
|
1119
|
+
* (`not_null(reviewDate, '')!=''`).
|
|
1120
|
+
*
|
|
1121
|
+
* The expression form is for a wait-for-connector task or rule only; an event
|
|
1122
|
+
* trigger refuses it, because its subscription registers before any case exists.
|
|
1115
1123
|
* Flow and BPMN filters are {@link EventFilter}.
|
|
1116
1124
|
*
|
|
1117
1125
|
* @remarks
|
|
1118
|
-
* `{ field: 'Id', equals: { expression: '=vars.request.Id' } }
|
|
1126
|
+
* `{ field: 'Id', equals: { expression: '=vars.request.Id' } }`,
|
|
1127
|
+
* `{ field: 'Status', isOneOf: [0, 5] }`, `{ field: 'reviewDate', isNotEmpty: true }`.
|
|
1119
1128
|
*/
|
|
1120
1129
|
export type CaseEventFilter = EventFilter | ({
|
|
1121
1130
|
field: string;
|
|
1122
1131
|
} & ({
|
|
1132
|
+
isOneOf: EventFilterList;
|
|
1133
|
+
} | {
|
|
1134
|
+
isEmpty: true;
|
|
1135
|
+
} | {
|
|
1136
|
+
isNotEmpty: true;
|
|
1137
|
+
} | {
|
|
1123
1138
|
contains: EventFilterExpression;
|
|
1124
1139
|
} | {
|
|
1125
1140
|
startsWith: EventFilterExpression;
|
|
@@ -111,7 +111,51 @@ export declare const EVENT_FILTER_OPERATORS: {
|
|
|
111
111
|
readonly jmes: "!=";
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* The Case designer's operators beyond {@link EVENT_FILTER_OPERATORS}, read and
|
|
116
|
+
* written in the `'case'` dialect only. Studio Web's Case canvas offers them on
|
|
117
|
+
* a Data Fabric entity event, and its filter compiler (`@uipath/maestro-sdk`
|
|
118
|
+
* `JmesHelper._buildJmesPathExpression`) lowers them as:
|
|
119
|
+
*
|
|
120
|
+
* | authored | designer operator | JMESPath |
|
|
121
|
+
* |--------------------------------|-------------------|--------------------------------------------|
|
|
122
|
+
* | `isOneOf: [5, 6]` (numbers) | `IsOneOf` | `` contains(`[5,6]`, f) `` |
|
|
123
|
+
* | `isOneOf: ['a', 'b']` (text) | `IsOneOf` | `` contains(`["a","b"]`, f) `` |
|
|
124
|
+
* | `isOneOf: [1]` on `f[*]` | `IsOneOf` | `` f[?contains(`[1]`, @)] `` |
|
|
125
|
+
* | `isEmpty: true` | `IsEmpty` | `not_null(f, '')==''` |
|
|
126
|
+
* | `isNotEmpty: true` | `IsNotEmpty` | `not_null(f, '')!=''` |
|
|
127
|
+
*
|
|
128
|
+
* The designer decides numbers or text from the field's type (a choice set's
|
|
129
|
+
* option values are numbers); offline the SDK has no field types, so the
|
|
130
|
+
* authored values decide, as they do for a date. The canvas tree stores the
|
|
131
|
+
* values as text either way (`value: ["5"]`). Flow and BPMN do not read these
|
|
132
|
+
* keys: their designers' saved shape is not measured.
|
|
133
|
+
*/
|
|
134
|
+
export declare const CASE_EVENT_FILTER_OPERATORS: {
|
|
135
|
+
readonly isOneOf: {
|
|
136
|
+
readonly designer: "IsOneOf";
|
|
137
|
+
readonly kind: "list";
|
|
138
|
+
readonly jmes: "contains";
|
|
139
|
+
};
|
|
140
|
+
readonly isEmpty: {
|
|
141
|
+
readonly designer: "IsEmpty";
|
|
142
|
+
readonly kind: "presence";
|
|
143
|
+
readonly jmes: "==";
|
|
144
|
+
};
|
|
145
|
+
readonly isNotEmpty: {
|
|
146
|
+
readonly designer: "IsNotEmpty";
|
|
147
|
+
readonly kind: "presence";
|
|
148
|
+
readonly jmes: "!=";
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export type EventFilterOperatorKey = keyof typeof EVENT_FILTER_OPERATORS | keyof typeof CASE_EVENT_FILTER_OPERATORS;
|
|
152
|
+
type EventFilterOperatorSpec = {
|
|
153
|
+
designer: string;
|
|
154
|
+
kind: 'function' | 'comparison' | 'boolean' | 'list' | 'presence';
|
|
155
|
+
jmes: string;
|
|
156
|
+
};
|
|
157
|
+
/** The spec of an operator key, from either table; `undefined` for any other key. */
|
|
158
|
+
export declare function eventFilterOperator(key: string): EventFilterOperatorSpec | undefined;
|
|
115
159
|
/** One authored filter, read structurally: which operator, and its value. */
|
|
116
160
|
export interface ReadEventFilter {
|
|
117
161
|
field: string;
|
|
@@ -121,13 +165,24 @@ export interface ReadEventFilter {
|
|
|
121
165
|
* (`expression` set) it is the text the lowering splices in its place: `''`
|
|
122
166
|
* as read, a `{var_0}` or `${vars.x}` placeholder when Case lowers it.
|
|
123
167
|
*/
|
|
124
|
-
value: string | number | boolean;
|
|
168
|
+
value: string | number | boolean | EventFilterList;
|
|
125
169
|
/**
|
|
126
170
|
* The JavaScript the field is compared against, evaluated at runtime (Case
|
|
127
171
|
* only): `vars.response.Id` for an authored `{ expression: '=vars.response.Id' }`.
|
|
128
172
|
*/
|
|
129
173
|
expression?: string;
|
|
130
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* The values an `isOneOf` filter (Case only) matches: all numbers, or all
|
|
177
|
+
* strings. Numbers are compared as numbers (`` contains(`[5,6]`, f) ``), text as
|
|
178
|
+
* text (`` contains(`["a","b"]`, f) ``).
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* const filter = { field: 'Status', isOneOf: [0, 5] };
|
|
182
|
+
*/
|
|
183
|
+
export type EventFilterList = readonly number[] | readonly string[];
|
|
184
|
+
/** Whether a value is an {@link EventFilterList}: a non-empty array of all numbers or all strings. */
|
|
185
|
+
export declare function isEventFilterList(value: unknown): value is EventFilterList;
|
|
131
186
|
/**
|
|
132
187
|
* A filter value computed at runtime: the field is compared against a Case
|
|
133
188
|
* expression, `=vars.<path>` or `=js:<expression>`, the same spelling every
|
|
@@ -254,9 +309,12 @@ export declare function eventFilterJmes(read: ReadEventFilter): string;
|
|
|
254
309
|
* `{ "rawString": "=js:(vars.request.Id)", "isLiteral": false, "value": "=js:(vars.request.Id)" }`.
|
|
255
310
|
*/
|
|
256
311
|
export type EventFilterLeafForm = 'path' | 'js';
|
|
257
|
-
/**
|
|
312
|
+
/**
|
|
313
|
+
* A tree leaf's `value`: a literal, an expression (`isLiteral: false`), `null`
|
|
314
|
+
* for a boolean or presence test, or an `isOneOf` list (always text, `["5"]`).
|
|
315
|
+
*/
|
|
258
316
|
export type EventFilterTreeValue = {
|
|
259
|
-
value: string | number | boolean;
|
|
317
|
+
value: string | number | boolean | readonly string[];
|
|
260
318
|
rawString: string;
|
|
261
319
|
isLiteral: boolean;
|
|
262
320
|
} | null;
|
|
@@ -272,7 +330,10 @@ export declare function eventFilterTreeLeaf(read: ReadEventFilter, form?: EventF
|
|
|
272
330
|
};
|
|
273
331
|
/**
|
|
274
332
|
* Read a designer tree leaf back into the authored key + value (decompile).
|
|
275
|
-
* Returns `undefined` for an operator this SDK does not author (`In`, `
|
|
333
|
+
* Returns `undefined` for an operator this SDK does not author (`In`, `DateTimeEquals` as its own key, …).
|
|
334
|
+
* The `'case'` dialect also reads {@link CASE_EVENT_FILTER_OPERATORS}; an
|
|
335
|
+
* `isOneOf` list reads back as the tree's text values (the caller decides
|
|
336
|
+
* whether the plan's expression compared them as numbers).
|
|
276
337
|
*/
|
|
277
338
|
export declare function eventFilterFromTreeLeaf(leaf: {
|
|
278
339
|
id?: unknown;
|
|
@@ -280,7 +341,7 @@ export declare function eventFilterFromTreeLeaf(leaf: {
|
|
|
280
341
|
value?: {
|
|
281
342
|
value?: unknown;
|
|
282
343
|
} | null;
|
|
283
|
-
}): ReadEventFilter | undefined;
|
|
344
|
+
}, dialect?: EventFilterDialect): ReadEventFilter | undefined;
|
|
284
345
|
/**
|
|
285
346
|
* Read an expression-valued tree leaf (`isLiteral: false`) back: its JavaScript
|
|
286
347
|
* and the form the plan spelled it in, or `undefined` when the leaf is not one
|
|
@@ -290,3 +351,4 @@ export declare function filterExprFromLeaf(value: unknown): {
|
|
|
290
351
|
expression: string;
|
|
291
352
|
form: EventFilterLeafForm;
|
|
292
353
|
} | undefined;
|
|
354
|
+
export {};
|