@uipath/maestro-builder-sdk 6.82.8 → 6.83.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 +85 -84
- package/dist/api-members.md +268 -268
- 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 +7 -2
- package/dist/core/refusals.d.ts +1 -0
- package/dist/core/refusals.js +1 -0
- package/package.json +2 -2
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 = {
|
package/dist/case/serialize.js
CHANGED
|
@@ -33,7 +33,7 @@ import { CASE_NODE_LAYOUT_FIELDS, caseJsonPreservation, caseJsonPreservationErro
|
|
|
33
33
|
import { businessEventProblems } from './business-event-shape.js';
|
|
34
34
|
import { eventFiltersNotArray, readEventFilter, readEventFilterLeaf, eventFilterTreeLeaf } from '../core/event-filters.js';
|
|
35
35
|
import { responseJsonSchema } from '../core/connector-response-schema.js';
|
|
36
|
-
import { ruleShapeProblems } from './rule-options.js';
|
|
36
|
+
import { ANY_ESCALATION_ID, ANY_ESCALATION_KEY, ruleShapeProblems } from './rule-options.js';
|
|
37
37
|
import { CompileRefusal } from '../core/compile-refusal.js';
|
|
38
38
|
import { expressionBindingId } from '../core/expression-binding-id.js';
|
|
39
39
|
import { implicitInArgBuiltTrigger, unboundInArgMessage } from './in-arg-binding.js';
|
|
@@ -3438,7 +3438,12 @@ function emitRule(r, seed, ownerId, ids, resolver, site) {
|
|
|
3438
3438
|
if (!slaId)
|
|
3439
3439
|
throw new CompileRefusal('UNKNOWN_SLA_REF', `rule "sla-status-change" references unknown SLA "${r.sla}" — declare it with .sla({ displayName: "${r.sla}", … }).`);
|
|
3440
3440
|
out.slaId = slaId;
|
|
3441
|
-
|
|
3441
|
+
// `ANY_ESCALATION` (case-sdk), matched by its registered key, so a second copy of the SDK matches too.
|
|
3442
|
+
if (r.escalation === Symbol.for(ANY_ESCALATION_KEY))
|
|
3443
|
+
out.escalationId = ANY_ESCALATION_ID;
|
|
3444
|
+
else if (r.escalation) {
|
|
3445
|
+
if (typeof r.escalation !== 'string')
|
|
3446
|
+
throw new CompileRefusal('UNKNOWN_ESCALATION_REF', `rule "sla-status-change" escalation must be an escalation displayName or ANY_ESCALATION.`);
|
|
3442
3447
|
const escId = resolver.escalationIdByName.get(r.escalation);
|
|
3443
3448
|
if (!escId)
|
|
3444
3449
|
throw new CompileRefusal('UNKNOWN_ESCALATION_REF', `rule "sla-status-change" references unknown escalation "${r.escalation}".`);
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -185,6 +185,7 @@ export declare const REFUSALS: {
|
|
|
185
185
|
readonly SELECTED_STAGE_EXITED_NO_EXIT: "lint";
|
|
186
186
|
readonly SLA_RESPONSE_REENTERS_STAGE: "lint";
|
|
187
187
|
readonly SLA_NAME_DUPLICATE: "lint";
|
|
188
|
+
readonly ANY_ESCALATION_NO_AT_RISK: "lint";
|
|
188
189
|
readonly CASE_MGMT_BINDING_KEY_MISMATCH: "lint";
|
|
189
190
|
readonly CASE_MGMT_NODE_ID_DUPLICATE: "lint";
|
|
190
191
|
readonly CASE_MGMT_OUTPUT_ID_DUPLICATE: "lint";
|
package/dist/core/refusals.js
CHANGED
|
@@ -249,6 +249,7 @@ export const REFUSALS = {
|
|
|
249
249
|
SELECTED_STAGE_EXITED_NO_EXIT: 'lint',
|
|
250
250
|
SLA_RESPONSE_REENTERS_STAGE: 'lint',
|
|
251
251
|
SLA_NAME_DUPLICATE: 'lint',
|
|
252
|
+
ANY_ESCALATION_NO_AT_RISK: 'lint',
|
|
252
253
|
// `uip maestro case validate`'s own codes, ported to case/plan-check/. All
|
|
253
254
|
// `lint` for now: only `check` reports them. The four on fields compile writes
|
|
254
255
|
// (ids, binding keys) are also carried from a decompiled plan's preserved
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.83.0",
|
|
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",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"@types/node": "^22.7.0",
|
|
104
104
|
"esbuild": "^0.28.1"
|
|
105
105
|
},
|
|
106
|
-
"gitref": "
|
|
106
|
+
"gitref": "8083a43e2cb53d4c0eb99e508b06d3d4a35f4386"
|
|
107
107
|
}
|