@uipath/maestro-builder-sdk 6.94.0 → 6.94.2
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/decompile.js +52 -1
- package/dist/case/preserve.d.ts +38 -12
- package/dist/case/serialize.d.ts +3 -1
- package/dist/case/serialize.js +112 -4
- package/dist/core/refusals.d.ts +1 -0
- package/dist/core/refusals.js +1 -0
- package/package.json +2 -2
package/dist/case/decompile.js
CHANGED
|
@@ -2237,7 +2237,33 @@ function stageDataPreservation(data, stageName, generation) {
|
|
|
2237
2237
|
return undefined;
|
|
2238
2238
|
return { ...(Object.keys(fields).length ? { fields } : {}), ...(omit.length ? { omit } : {}) };
|
|
2239
2239
|
}
|
|
2240
|
-
|
|
2240
|
+
/**
|
|
2241
|
+
* The ids of SLAs whose displayName another SLA of the plan shares. The source
|
|
2242
|
+
* names an SLA by displayName (`rule('sla-status-change', { sla })`), which
|
|
2243
|
+
* compile resolves to the last SLA declared with it, so a rule on any other
|
|
2244
|
+
* of them keeps its `slaId` in the payload.
|
|
2245
|
+
*/
|
|
2246
|
+
function ambiguousSlaIds(plan) {
|
|
2247
|
+
const slas = [...(plan.metadata?.slaRules ?? []), ...(plan.nodes ?? []).filter(isStage).flatMap((stage) => stage.data?.slaRules ?? [])];
|
|
2248
|
+
const count = new Map();
|
|
2249
|
+
for (const sla of slas)
|
|
2250
|
+
if (sla.displayName)
|
|
2251
|
+
count.set(sla.displayName, (count.get(sla.displayName) ?? 0) + 1);
|
|
2252
|
+
// Each such SLA's id, with the displayName it shares.
|
|
2253
|
+
return new Map(slas.flatMap((sla) => (sla.id && sla.displayName && (count.get(sla.displayName) ?? 0) > 1 ? [[sla.id, sla.displayName]] : [])));
|
|
2254
|
+
}
|
|
2255
|
+
function conditionIdentityOf(condition, ambiguousSlas = new Map(), siblings = [condition]) {
|
|
2256
|
+
// Another condition of the same list with this name: the name alone does not
|
|
2257
|
+
// say which one a pin was saved on.
|
|
2258
|
+
const nameShared = siblings.filter((other) => (other.displayName ?? '') === (condition.displayName ?? '')).length > 1;
|
|
2259
|
+
// A pinned rule is found again, inside its condition, as the n-th
|
|
2260
|
+
// `sla-status-change` rule on an SLA of that name: a rule group added or
|
|
2261
|
+
// removed before it shifts its `[group][rule]` slot, not its order.
|
|
2262
|
+
const flat = (condition.rules ?? []).flat();
|
|
2263
|
+
const ordinal = (rule) => {
|
|
2264
|
+
const name = ambiguousSlas.get(rule.slaId ?? '');
|
|
2265
|
+
return flat.slice(0, flat.indexOf(rule)).filter((other) => other.rule === 'sla-status-change' && ambiguousSlas.get(other.slaId ?? '') === name).length;
|
|
2266
|
+
};
|
|
2241
2267
|
if (condition.edgeIds !== undefined
|
|
2242
2268
|
&& (!Array.isArray(condition.edgeIds) || !condition.edgeIds.every((id) => typeof id === 'string')))
|
|
2243
2269
|
throw new Error(`condition "${condition.displayName ?? condition.id ?? '?'}" has edgeIds that is not a list of edge id strings. The Case Designer writes an array of edge ids; fix or remove the field.`);
|
|
@@ -2248,6 +2274,14 @@ function conditionIdentity(condition) {
|
|
|
2248
2274
|
...(condition.edgeIds !== undefined ? { edgeIds: condition.edgeIds } : {}),
|
|
2249
2275
|
rules: (condition.rules ?? []).map((group) => group.map((rule) => ({
|
|
2250
2276
|
...(rule.id ? { id: rule.id } : {}),
|
|
2277
|
+
// Which of several same-named SLAs the rule watches (see `ambiguousSlaIds`).
|
|
2278
|
+
// The condition's name, as the source spells it, rides with it, and so
|
|
2279
|
+
// does the rule's order among its condition's rules on that SLA name:
|
|
2280
|
+
// conditions pair up by position, and an edit that deletes an earlier
|
|
2281
|
+
// sibling, or adds a rule group, must not move the pin.
|
|
2282
|
+
...(rule.rule === 'sla-status-change' && rule.slaId && ambiguousSlas.has(rule.slaId)
|
|
2283
|
+
? { slaId: rule.slaId, slaCondition: condition.displayName ?? '', ...(nameShared ? { slaConditionShared: true } : {}), ...(ordinal(rule) > 0 ? { slaOrdinal: ordinal(rule) } : {}) }
|
|
2284
|
+
: {}),
|
|
2251
2285
|
// A wait-for-connector rule's rows take their ids from the plan-wide pool,
|
|
2252
2286
|
// so deleting an earlier output would renumber them.
|
|
2253
2287
|
...(rule.uipath?.outputs?.length
|
|
@@ -2410,7 +2444,23 @@ function customRowLabel(row, plan) {
|
|
|
2410
2444
|
const variable = (plan.variables?.inputOutputs ?? []).find((entry) => entry.id === row.var);
|
|
2411
2445
|
return row.name === (variable?.name ?? row.var) ? {} : { var: row.var, custom: true };
|
|
2412
2446
|
}
|
|
2447
|
+
/**
|
|
2448
|
+
* An own-name output (`id == var`) saved with no `originalVar` while a root
|
|
2449
|
+
* variable has its id. Compile writes such a row as the controlled alias of
|
|
2450
|
+
* that variable (`originalVar: <id>`); the Designer reads the row the same way
|
|
2451
|
+
* with or without it, and saves it without. Recorded as `noAlias: true`, so
|
|
2452
|
+
* compile writes it back without. For example an agent output
|
|
2453
|
+
* `{ id: 'error', var: 'error' }` beside the trigger's root `error` row.
|
|
2454
|
+
*/
|
|
2455
|
+
function unaliasedOwnNameRow(row, plan) {
|
|
2456
|
+
if (row.custom === true || row.originalVar !== undefined || typeof row.id !== 'string' || row.id !== row.var)
|
|
2457
|
+
return {};
|
|
2458
|
+
const root = [...(plan.variables?.inputOutputs ?? []), ...(plan.variables?.inputs ?? []), ...(plan.variables?.outputs ?? [])];
|
|
2459
|
+
return root.some((entry) => entry?.id === row.id) ? { noAlias: true } : {};
|
|
2460
|
+
}
|
|
2413
2461
|
function identityPreservation(plan) {
|
|
2462
|
+
const ambiguous = ambiguousSlaIds(plan);
|
|
2463
|
+
const conditionIdentity = (condition, _index, list) => conditionIdentityOf(condition, ambiguous, list);
|
|
2414
2464
|
return {
|
|
2415
2465
|
...(plan.id ? { id: plan.id } : {}),
|
|
2416
2466
|
triggers: (plan.nodes ?? []).filter(isTrigger).map((node) => ({ ...(node.id ? { id: node.id } : {}) })),
|
|
@@ -2436,6 +2486,7 @@ function identityPreservation(plan) {
|
|
|
2436
2486
|
// or the variable an own-name extract wrote first (`firstResults`).
|
|
2437
2487
|
...(typeof row.originalVar === 'string' && row.originalVar !== row.id && (row.custom !== true || task.type === 'action')
|
|
2438
2488
|
? { originalVar: row.originalVar } : {}),
|
|
2489
|
+
...unaliasedOwnNameRow(row, plan),
|
|
2439
2490
|
...actionOutputShape(task, row),
|
|
2440
2491
|
...resourceRowShape(task, row, 'outputs'),
|
|
2441
2492
|
})),
|
package/dist/case/preserve.d.ts
CHANGED
|
@@ -159,8 +159,27 @@ interface ConditionIdentity {
|
|
|
159
159
|
id?: string;
|
|
160
160
|
/** The Designer's ids of the canvas edges drawn for the condition. */
|
|
161
161
|
edgeIds?: string[];
|
|
162
|
+
/**
|
|
163
|
+
* `slaId`: on a `sla-status-change` rule whose SLA shares its displayName with
|
|
164
|
+
* another SLA, the one the rule watches. The source names the SLA by
|
|
165
|
+
* displayName only, and compile resolves that to the last declaration.
|
|
166
|
+
* `slaCondition` is the displayName of the condition that held the rule, as
|
|
167
|
+
* the source spells it (`slaConditionShared` when another condition of the
|
|
168
|
+
* list has that name too), and `slaOrdinal` (absent for 0) the rule's place
|
|
169
|
+
* among that condition's `sla-status-change` rules on an SLA of the same
|
|
170
|
+
* name. Compile gives the pin to the one condition of the list with that
|
|
171
|
+
* name, when the name is unique on both sides; else to the condition at the
|
|
172
|
+
* same position, when no other pin owns that slot by name and either the
|
|
173
|
+
* saved name was unique (the condition was renamed) or the list kept its
|
|
174
|
+
* length. Each condition takes at most one pin per rule, and a pin with no
|
|
175
|
+
* owner is dropped with a `SLA_PIN_DROPPED` warning.
|
|
176
|
+
*/
|
|
162
177
|
rules?: Array<Array<{
|
|
163
178
|
id?: string;
|
|
179
|
+
slaId?: string;
|
|
180
|
+
slaCondition?: string;
|
|
181
|
+
slaConditionShared?: boolean;
|
|
182
|
+
slaOrdinal?: number;
|
|
164
183
|
outputs?: Array<{
|
|
165
184
|
name: string;
|
|
166
185
|
id?: string;
|
|
@@ -200,18 +219,8 @@ interface StageIdentity {
|
|
|
200
219
|
}>;
|
|
201
220
|
/** `originalVar` only when it is not the row's `id` (the serializer's own spelling). `elementId` when an action form output names another element than its task. `fields` as on an input. `omit`: the fields an action form output (`target`, `_jsonSchema`, `elementId`) or a resource extract (`target`) was saved without that compile writes. `target`: which of the row's variables its saved `target` names when that is not its id (`=<var>` or `=<originalVar>`; compile writes `=<id>`). `bodyCopies`: the extra copies of its `body` an action form output was saved with (`jsonSchema`), which compile writes back from the body. */
|
|
202
221
|
/** `var` and `custom: true`: a custom row whose label (`name`) is not the name of the variable it assigns. */
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
id?: string;
|
|
206
|
-
originalVar?: string;
|
|
207
|
-
elementId?: string;
|
|
208
|
-
fields?: Record<string, unknown>;
|
|
209
|
-
omit?: string[];
|
|
210
|
-
target?: 'var' | 'originalVar';
|
|
211
|
-
bodyCopies?: string[];
|
|
212
|
-
var?: string;
|
|
213
|
-
custom?: true;
|
|
214
|
-
}>;
|
|
222
|
+
/** `noAlias: true`: an own-name row saved with no `originalVar` beside a root variable of its id, which compile writes as the alias `originalVar: <id>`. */
|
|
223
|
+
outputs?: PreservedOutputRow[];
|
|
215
224
|
/** The io lists a resource task saved empty (`inputs: []`), which compile writes only when it binds a row. */
|
|
216
225
|
emptyIo?: Array<'inputs' | 'outputs'>;
|
|
217
226
|
/** `taskFingerprint`, for a task a sibling shares its row names with. */
|
|
@@ -284,6 +293,23 @@ interface CaseIdentityPreservation {
|
|
|
284
293
|
* variable fields. Those constructs must use the typed builder or fail with a
|
|
285
294
|
* named refusal.
|
|
286
295
|
*/
|
|
296
|
+
/**
|
|
297
|
+
* One output row of a task in the payload's `identities` (see `outputs` there):
|
|
298
|
+
* the row's name and id, and the Designer-saved spellings compile puts back.
|
|
299
|
+
*/
|
|
300
|
+
export interface PreservedOutputRow {
|
|
301
|
+
name: string;
|
|
302
|
+
id?: string;
|
|
303
|
+
originalVar?: string;
|
|
304
|
+
elementId?: string;
|
|
305
|
+
fields?: Record<string, unknown>;
|
|
306
|
+
omit?: string[];
|
|
307
|
+
target?: 'var' | 'originalVar';
|
|
308
|
+
bodyCopies?: string[];
|
|
309
|
+
var?: string;
|
|
310
|
+
custom?: true;
|
|
311
|
+
noAlias?: true;
|
|
312
|
+
}
|
|
287
313
|
export interface CaseJsonPreservation {
|
|
288
314
|
/** Unknown document-root fields. */
|
|
289
315
|
topLevel?: Record<string, unknown>;
|
package/dist/case/serialize.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface CaseSerializeOpts {
|
|
|
62
62
|
}
|
|
63
63
|
/** A warning `serialize` reports through {@link CaseSerializeOpts.warn}. */
|
|
64
64
|
export interface CaseSerializeWarning {
|
|
65
|
-
code: 'CONNECTION_STUB';
|
|
65
|
+
code: 'CONNECTION_STUB' | 'SLA_PIN_DROPPED';
|
|
66
66
|
message: string;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
@@ -90,6 +90,8 @@ export interface ApplyPreservationOptions {
|
|
|
90
90
|
* of the merge is that the original wins on exactly those.
|
|
91
91
|
*/
|
|
92
92
|
overwrite?: boolean;
|
|
93
|
+
/** The serializer's warning sink: a preserved fact the edit left no place for (`SLA_PIN_DROPPED`). */
|
|
94
|
+
warn?: (warning: CaseSerializeWarning) => void;
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
95
97
|
* Stamp a preservation payload onto a caseplan-shaped document. Exported for
|
package/dist/case/serialize.js
CHANGED
|
@@ -428,7 +428,7 @@ function serializeCase(built, opts) {
|
|
|
428
428
|
};
|
|
429
429
|
ELEMENT_SEEDED_IDS.set(result, resolver.elementSeededIds);
|
|
430
430
|
WRITTEN_SUBSCRIPTIONS.set(result, resolver.subscriptions);
|
|
431
|
-
const plan = stampConnectorConfigVersion(applyAuthorLayout(applyPreservation(result, caseJsonPreservation(built)), built.layout));
|
|
431
|
+
const plan = stampConnectorConfigVersion(applyAuthorLayout(applyPreservation(result, caseJsonPreservation(built), opts.warn ? { warn: opts.warn } : {}), built.layout));
|
|
432
432
|
// Last, over the finished document: V32 requires case-unique condition names,
|
|
433
433
|
// and an author (or a decompiled pre-V32 plan) can repeat one. Rename the
|
|
434
434
|
// repeats the way the platform's V31/V32.0.1 migrations would, so the file is
|
|
@@ -586,7 +586,7 @@ export function applyPreservation(result, preservation, options = {}) {
|
|
|
586
586
|
if (errors.length)
|
|
587
587
|
throw new CompileRefusal('PRESERVATION_COLLISION', `invalid Case JSON preservation payload: ${errors.join('; ')}`);
|
|
588
588
|
preservation = followRenames(result, preservation);
|
|
589
|
-
applyPreservedIdentities(result, preservation);
|
|
589
|
+
applyPreservedIdentities(result, preservation, options.warn);
|
|
590
590
|
applySubscriptionFilters(result, preservation);
|
|
591
591
|
Object.assign(result, preservation.topLevel ?? {});
|
|
592
592
|
Object.assign(result.metadata, preservation.metadata ?? {});
|
|
@@ -1308,7 +1308,7 @@ function restoreNoTasks(data, spelling) {
|
|
|
1308
1308
|
else
|
|
1309
1309
|
data.tasks = [];
|
|
1310
1310
|
}
|
|
1311
|
-
function applyPreservedIdentities(result, preservation) {
|
|
1311
|
+
function applyPreservedIdentities(result, preservation, warn) {
|
|
1312
1312
|
const identities = preservation.identities;
|
|
1313
1313
|
if (!identities)
|
|
1314
1314
|
return;
|
|
@@ -1387,8 +1387,15 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
1387
1387
|
// the id renames. Example: `{ name: 'echoIn', fields: { displayName: 'echoIn',
|
|
1388
1388
|
// title: 'echoIn' } }` gives the compiled `echoIn` row both back.
|
|
1389
1389
|
const carryRowShape = (row, wanted) => {
|
|
1390
|
-
if (!row || row.name !== wanted.name || (!wanted.fields && !wanted.omit && !wanted.target && wanted.originalVar === undefined))
|
|
1390
|
+
if (!row || row.name !== wanted.name || (!wanted.fields && !wanted.omit && !wanted.target && wanted.originalVar === undefined && wanted.noAlias !== true))
|
|
1391
1391
|
return;
|
|
1392
|
+
// An own-name row the Designer saved without the controlled alias compile
|
|
1393
|
+
// writes (`originalVar: <id>`) loses it again, once every id is final, while
|
|
1394
|
+
// it is still own-name and still spelled as the alias.
|
|
1395
|
+
// Only the literal `true` decompile writes: a hand-edited `"yes"` is no marker.
|
|
1396
|
+
if (wanted.noAlias === true)
|
|
1397
|
+
targetSpellings.push(() => { if (row.id === row.var && row.originalVar === row.id)
|
|
1398
|
+
delete row.originalVar; });
|
|
1392
1399
|
rowRenames.push(() => {
|
|
1393
1400
|
// A key the compiled row already has is typed (an input `required` /
|
|
1394
1401
|
// `default` the source now gives), so the author's value wins.
|
|
@@ -1543,6 +1550,7 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
1543
1550
|
});
|
|
1544
1551
|
};
|
|
1545
1552
|
const takeConditions = (current, wanted) => {
|
|
1553
|
+
const pins = [];
|
|
1546
1554
|
(wanted ?? []).forEach((condition, index) => {
|
|
1547
1555
|
const target = current?.[index];
|
|
1548
1556
|
take(target, condition.id);
|
|
@@ -1551,11 +1559,41 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
1551
1559
|
(condition.rules ?? []).forEach((group, groupIndex) => group.forEach((rule, ruleIndex) => {
|
|
1552
1560
|
const ruleTarget = target?.rules?.[groupIndex]?.[ruleIndex];
|
|
1553
1561
|
take(ruleTarget, rule.id);
|
|
1562
|
+
if (typeof rule.slaId === 'string')
|
|
1563
|
+
pins.push({ index, rule });
|
|
1554
1564
|
if (rule.outputs)
|
|
1555
1565
|
takeOutputRows(ruleTarget?.[bagField]?.outputs ?? [], rule.outputs);
|
|
1556
1566
|
}));
|
|
1557
1567
|
});
|
|
1568
|
+
// Each pin goes to the condition it was saved on. Ids pair up by position,
|
|
1569
|
+
// and an edit that deletes an earlier sibling shifts the next condition into
|
|
1570
|
+
// its slot, so a pin is found by the condition's name when that name is one
|
|
1571
|
+
// condition's on both sides. Else, by position: only when no other pin owns
|
|
1572
|
+
// that slot by name, and the saved name was unique (the condition was
|
|
1573
|
+
// renamed) or the list kept its length (nothing shifted). A pin with no
|
|
1574
|
+
// owner is dropped, and so is a second pin for the same rule, which
|
|
1575
|
+
// `restoreRuleSlas` decides once it has found the rule (it warns).
|
|
1576
|
+
const list = current ?? [];
|
|
1577
|
+
const nameOf = (condition) => condition?.displayName ?? '';
|
|
1578
|
+
const byName = (pin) => {
|
|
1579
|
+
const name = pin.rule.slaCondition;
|
|
1580
|
+
if (typeof name !== 'string' || pin.rule.slaConditionShared === true)
|
|
1581
|
+
return undefined;
|
|
1582
|
+
const named = list.filter((candidate) => nameOf(candidate) === name);
|
|
1583
|
+
return named.length === 1 ? named[0] : undefined;
|
|
1584
|
+
};
|
|
1585
|
+
const ownedByName = new Set(pins.map(byName).filter(Boolean));
|
|
1586
|
+
for (const pin of pins) {
|
|
1587
|
+
const atSlot = list[pin.index];
|
|
1588
|
+
const owner = byName(pin)
|
|
1589
|
+
?? (atSlot && !ownedByName.has(atSlot) && (pin.rule.slaConditionShared !== true || list.length === (wanted ?? []).length) ? atSlot : undefined);
|
|
1590
|
+
const ordinal = typeof pin.rule.slaOrdinal === 'number' ? pin.rule.slaOrdinal : 0;
|
|
1591
|
+
wantedRuleSlas.push({ condition: owner, ordinal, slaId: pin.rule.slaId, conditionName: pin.rule.slaCondition ?? nameOf(atSlot) });
|
|
1592
|
+
}
|
|
1558
1593
|
};
|
|
1594
|
+
// `sla-status-change` rules whose payload names which of several same-named
|
|
1595
|
+
// SLAs they watch, settled by `restoreRuleSlas` once SLA ids are final.
|
|
1596
|
+
const wantedRuleSlas = [];
|
|
1559
1597
|
// Preserved SLA and escalation ids, restored by `restoreSlaIds` once every
|
|
1560
1598
|
// other id is in place.
|
|
1561
1599
|
const wantedSlaIds = new Map();
|
|
@@ -1670,6 +1708,7 @@ function applyPreservedIdentities(result, preservation) {
|
|
|
1670
1708
|
takeSlas(metadata.slaRules, identities.slaRules);
|
|
1671
1709
|
restoreEmptyLists(metadata, identities.emptyLists, CASE_EMPTY_LISTS);
|
|
1672
1710
|
restoreSlaIds();
|
|
1711
|
+
restoreRuleSlas(result, stages, wantedRuleSlas, (id) => replacements.get(id) ?? id, warn);
|
|
1673
1712
|
const variables = result.variables;
|
|
1674
1713
|
if (carriedCompanions.size) {
|
|
1675
1714
|
const inputOutputs = (variables.inputOutputs ??= []);
|
|
@@ -2631,6 +2670,75 @@ function refreshedActionContext(context, data, saved, formKindChanged) {
|
|
|
2631
2670
|
}
|
|
2632
2671
|
return out;
|
|
2633
2672
|
}
|
|
2673
|
+
/**
|
|
2674
|
+
* Point each `sla-status-change` rule the payload pinned back at the SLA it
|
|
2675
|
+
* watched. The source names an SLA by displayName, which compile resolves to
|
|
2676
|
+
* the last SLA declared with it; a rule on another SLA of that name gets its
|
|
2677
|
+
* own `slaId` back, and an at-risk rule the same-named escalation of that SLA.
|
|
2678
|
+
* The rule is the `ordinal`-th `sla-status-change` rule of its condition on an
|
|
2679
|
+
* SLA of the pinned SLA's name, so a rule group added before it does not hide
|
|
2680
|
+
* it. A pin the edit left no place for (no condition, no such rule, the SLA
|
|
2681
|
+
* renamed or removed, no same-named escalation) keeps compile's answer, with a
|
|
2682
|
+
* `SLA_PIN_DROPPED` warning that names the condition and both SLA ids.
|
|
2683
|
+
*/
|
|
2684
|
+
function restoreRuleSlas(result, stages, wanted,
|
|
2685
|
+
// The final id of an id this pass generated: the rule still holds the
|
|
2686
|
+
// generated SLA and escalation ids until the reference rewrite runs.
|
|
2687
|
+
final, warn) {
|
|
2688
|
+
if (!wanted.length)
|
|
2689
|
+
return;
|
|
2690
|
+
const slas = [...(result.metadata?.slaRules ?? []), ...stages.flatMap((stage) => stage.data?.slaRules ?? [])];
|
|
2691
|
+
const byId = new Map(slas.filter((sla) => typeof sla?.id === 'string').map((sla) => [sla.id, sla]));
|
|
2692
|
+
// Each rule takes at most one pin. The rule is found by its condition, the
|
|
2693
|
+
// pinned SLA's name and its place among that condition's rules on the name,
|
|
2694
|
+
// so two pins in one condition on SLAs of different names (each the first on
|
|
2695
|
+
// its own name) are two rules, not one.
|
|
2696
|
+
const claimed = new Set();
|
|
2697
|
+
for (const { condition, ordinal, slaId, conditionName } of wanted) {
|
|
2698
|
+
const pinned = byId.get(slaId);
|
|
2699
|
+
const name = pinned?.displayName;
|
|
2700
|
+
const lastNamed = name ? [...slas].reverse().find((sla) => sla?.displayName === name) : undefined;
|
|
2701
|
+
const drop = (why) => warn?.({
|
|
2702
|
+
code: 'SLA_PIN_DROPPED',
|
|
2703
|
+
message: `Condition "${conditionName}": its sla-status-change rule watched SLA ${slaId}${name ? ` ("${name}")` : ''}, but ${why}. `
|
|
2704
|
+
+ (lastNamed?.id ? `The rule now watches ${lastNamed.id}, the last SLA of that name. ` : '')
|
|
2705
|
+
+ 'Several SLAs share that name and the source names an SLA by displayName only; give each SLA its own displayName to pick one.',
|
|
2706
|
+
});
|
|
2707
|
+
if (!pinned || !name) {
|
|
2708
|
+
drop('that SLA is no longer in the plan');
|
|
2709
|
+
continue;
|
|
2710
|
+
}
|
|
2711
|
+
if (!condition) {
|
|
2712
|
+
drop('the edit left no condition that is clearly the one it was saved on');
|
|
2713
|
+
continue;
|
|
2714
|
+
}
|
|
2715
|
+
const onName = (condition.rules ?? []).flat()
|
|
2716
|
+
.filter((rule) => rule?.rule === 'sla-status-change' && typeof rule.slaId === 'string' && byId.get(final(rule.slaId))?.displayName === name);
|
|
2717
|
+
const rule = onName[ordinal];
|
|
2718
|
+
if (!rule) {
|
|
2719
|
+
drop('the condition no longer has that rule');
|
|
2720
|
+
continue;
|
|
2721
|
+
}
|
|
2722
|
+
if (claimed.has(rule)) {
|
|
2723
|
+
drop('another pin already claims that rule');
|
|
2724
|
+
continue;
|
|
2725
|
+
}
|
|
2726
|
+
claimed.add(rule);
|
|
2727
|
+
if (final(rule.slaId) === slaId)
|
|
2728
|
+
continue;
|
|
2729
|
+
if (rule.escalationId !== undefined && rule.escalationId !== ANY_ESCALATION_ID) {
|
|
2730
|
+
const current = byId.get(final(rule.slaId));
|
|
2731
|
+
const escalationName = (current?.escalationRule ?? []).find((entry) => entry?.id === final(String(rule.escalationId)))?.displayName;
|
|
2732
|
+
const escalation = escalationName === undefined ? undefined : (pinned.escalationRule ?? []).find((entry) => entry?.displayName === escalationName);
|
|
2733
|
+
if (!escalation?.id) {
|
|
2734
|
+
drop('that SLA has no escalation of the name the rule waits for');
|
|
2735
|
+
continue;
|
|
2736
|
+
}
|
|
2737
|
+
rule.escalationId = escalation.id;
|
|
2738
|
+
}
|
|
2739
|
+
rule.slaId = slaId;
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2634
2742
|
/**
|
|
2635
2743
|
* Put back the own-name shape of `restored` rows whose variable the source plan
|
|
2636
2744
|
* had no root entry for: no `originalVar`, and no root companion, as the
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -700,6 +700,7 @@ export declare const REFUSALS: {
|
|
|
700
700
|
readonly SLA_COUNT_RANGE: "lint";
|
|
701
701
|
readonly SLA_NONPOSITIVE: "lint";
|
|
702
702
|
readonly SLA_NO_ESCALATIONS: "lint";
|
|
703
|
+
readonly SLA_PIN_DROPPED: "lint";
|
|
703
704
|
readonly STAGE_NO_COMPLETION: "lint";
|
|
704
705
|
readonly STEP_ID_COLLISION: "lowering";
|
|
705
706
|
readonly STEP_NOT_ACTION: "lowering";
|
package/dist/core/refusals.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.94.
|
|
3
|
+
"version": "6.94.2",
|
|
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",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"@types/node": "^22.7.0",
|
|
112
112
|
"esbuild": "^0.28.1"
|
|
113
113
|
},
|
|
114
|
-
"gitref": "
|
|
114
|
+
"gitref": "32128da37ad09d34ff04fae56bd1c0d50d30bab5"
|
|
115
115
|
}
|