@uipath/maestro-builder-sdk 6.26.0 → 6.27.1
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 +22 -21
- package/dist/api-members.md +87 -86
- package/dist/check.js +47 -5
- package/dist/cli/commands/bpmn.js +6 -6
- package/dist/cli/commands/case.js +5 -5
- package/dist/cli/commands/flow.js +5 -5
- package/dist/cli/commands/registry.js +7 -7
- package/dist/cli/common.d.ts +0 -3
- package/dist/cli/common.js +3 -3
- package/dist/cli-run.js +10 -0
- package/dist/core/sha.d.ts +16 -0
- package/dist/core/sha.js +118 -0
- package/dist/core/stable-id.js +5 -6
- package/dist/decompile.js +35 -45
- package/dist/flow-definitions.js +2 -4
- package/dist/flow-expr-check.js +6 -1
- package/dist/flow-sdk.d.ts +43 -12
- package/dist/flow-sdk.js +25 -6
- package/dist/sdk-resolve.d.ts +5 -3
- package/dist/sdk-resolve.js +15 -6
- package/dist/serialize.js +8 -7
- package/package.json +2 -2
package/dist/flow-sdk.js
CHANGED
|
@@ -612,11 +612,23 @@ class StepList {
|
|
|
612
612
|
* ], (other) => other.step('unknown', script({ code: 'return "Unknown";' })))
|
|
613
613
|
* ```
|
|
614
614
|
*
|
|
615
|
+
* @example
|
|
616
|
+
* **Cases with their own conditions** (`on` is `undefined`)
|
|
617
|
+
* ```ts
|
|
618
|
+
* .switch('route', undefined, [
|
|
619
|
+
* { when: js`$vars.start.output.amount > 100`, label: 'High', body: (b) => b.step('review', script({ code: 'return 1;' })) },
|
|
620
|
+
* { when: js`$vars.start.output.amount <= 100`, label: 'Low', body: (b) => b.step('auto', script({ code: 'return 2;' })) },
|
|
621
|
+
* ])
|
|
622
|
+
* ```
|
|
623
|
+
*
|
|
615
624
|
* @param name - The switch node's id.
|
|
616
|
-
* @param on - The value to compare each case against
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
625
|
+
* @param on - The value to compare each `value` case against; `undefined`
|
|
626
|
+
* when every case carries its own `when` condition.
|
|
627
|
+
* @param cases - One entry per arm, evaluated top to bottom; the first match
|
|
628
|
+
* wins. A case is `{ value }` (strict `on === value`) or `{ when }` (its own
|
|
629
|
+
* boolean expression). `label` names the arm's outgoing edge. `id` keeps a
|
|
630
|
+
* case's wire id (`inputs.cases[].id`, port `case-<id>`); omitted, it is
|
|
631
|
+
* `case_<n>`.
|
|
620
632
|
* @param defaultFn - Receives a sub-builder for the arm taken when nothing
|
|
621
633
|
* matches. Omit it and an unmatched value simply continues.
|
|
622
634
|
* @param options - Node options; `version` selects the exact definition
|
|
@@ -634,7 +646,14 @@ class StepList {
|
|
|
634
646
|
// An arm's own `.label(...)` wins over the case config's `label`; either
|
|
635
647
|
// overrides the serializer's derived `Case "<value>"`.
|
|
636
648
|
const label = arm.armLabel ?? c.label;
|
|
637
|
-
return {
|
|
649
|
+
return {
|
|
650
|
+
// Both kept as given, so check can refuse a case with both or neither.
|
|
651
|
+
...(c.value !== undefined ? { value: c.value } : {}),
|
|
652
|
+
...(c.when !== undefined ? { when: toExpr(c.when) } : {}),
|
|
653
|
+
...(label !== undefined ? { label } : {}),
|
|
654
|
+
...(c.id !== undefined ? { id: c.id } : {}),
|
|
655
|
+
body: arm.steps,
|
|
656
|
+
};
|
|
638
657
|
});
|
|
639
658
|
let dflt;
|
|
640
659
|
if (defaultFn) {
|
|
@@ -649,7 +668,7 @@ class StepList {
|
|
|
649
668
|
this.steps.push({
|
|
650
669
|
kind: 'switch',
|
|
651
670
|
name,
|
|
652
|
-
on: toExpr(on),
|
|
671
|
+
...(on !== undefined ? { on: toExpr(on) } : {}),
|
|
653
672
|
cases: arms,
|
|
654
673
|
...(dflt !== undefined ? { default: dflt } : {}),
|
|
655
674
|
...(options ? { options } : {}),
|
package/dist/sdk-resolve.d.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* `sdk-resolve-hook.ts` for why. Idempotent; call it before importing authored
|
|
5
5
|
* source.
|
|
6
6
|
*
|
|
7
|
-
* Does nothing when the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Does nothing when the SDK runs from its TypeScript source under the test
|
|
8
|
+
* runner, which resolves imports itself. Anywhere else a missing hook means the
|
|
9
|
+
* SDK was bundled: authored source would then load a second copy of the
|
|
10
|
+
* package, its expressions would fail this copy's `instanceof` checks, and the
|
|
11
|
+
* `.flow` would come out wrong with no error. That throws instead.
|
|
10
12
|
*/
|
|
11
13
|
export declare function useThisSdkForAuthoredSource(): void;
|
package/dist/sdk-resolve.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { register } from 'node:module';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { PACKAGE_NAME } from './package-name.js';
|
|
5
6
|
let registered = false;
|
|
6
7
|
/**
|
|
7
8
|
* Make `import … from '@uipath/maestro-builder-sdk'` in authored source resolve
|
|
@@ -9,16 +10,24 @@ let registered = false;
|
|
|
9
10
|
* `sdk-resolve-hook.ts` for why. Idempotent; call it before importing authored
|
|
10
11
|
* source.
|
|
11
12
|
*
|
|
12
|
-
* Does nothing when the
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Does nothing when the SDK runs from its TypeScript source under the test
|
|
14
|
+
* runner, which resolves imports itself. Anywhere else a missing hook means the
|
|
15
|
+
* SDK was bundled: authored source would then load a second copy of the
|
|
16
|
+
* package, its expressions would fail this copy's `instanceof` checks, and the
|
|
17
|
+
* `.flow` would come out wrong with no error. That throws instead.
|
|
15
18
|
*/
|
|
16
19
|
export function useThisSdkForAuthoredSource() {
|
|
17
20
|
if (registered)
|
|
18
21
|
return;
|
|
19
|
-
registered = true;
|
|
20
22
|
const hook = new URL('./sdk-resolve-hook.js', import.meta.url);
|
|
21
|
-
if (!existsSync(fileURLToPath(hook)))
|
|
22
|
-
|
|
23
|
+
if (!existsSync(fileURLToPath(hook))) {
|
|
24
|
+
if (import.meta.url.endsWith('.ts')) {
|
|
25
|
+
registered = true;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
throw new Error(`cannot point authored source at this copy of ${PACKAGE_NAME}: ${fileURLToPath(hook)} is missing, as in a bundle, `
|
|
29
|
+
+ 'so its imports would load a second copy and serialize wrong. Run the installed package, or load authored source yourself.');
|
|
30
|
+
}
|
|
23
31
|
register(hook);
|
|
32
|
+
registered = true;
|
|
24
33
|
}
|
package/dist/serialize.js
CHANGED
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
* resolved from the connector library (entry + v1def sidecar), matching what
|
|
7
7
|
* the platform emits, so the result passes `uip maestro flow validate`.
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
10
|
-
import { fileURLToPath } from 'node:url';
|
|
11
|
-
import { dirname, join } from 'node:path';
|
|
9
|
+
import ixpDefinition from './ixp-definition.json' with { type: 'json' };
|
|
12
10
|
import { BUNDLED_DEFINITIONS, bundledVersions } from './flow-definitions.js';
|
|
13
11
|
import { Expr, toExpr, SCHEDULE_PRESETS, parseIxpProjectType, flatNameOf, flatNameSegmentsOf } from './flow-sdk.js';
|
|
14
12
|
import { FlowAction, FlowTrigger } from './core/node-classes.js';
|
|
@@ -65,7 +63,6 @@ import { types } from './core/expr.js';
|
|
|
65
63
|
import { SUBFLOW_START_LABEL } from './core/subflow-start.js';
|
|
66
64
|
import { ownEntry } from './core/own-entry.js';
|
|
67
65
|
import { jsonClone } from './core/json-file.js';
|
|
68
|
-
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
69
66
|
// core-definitions.json is an object keyed by "<nodeType>@<version>".
|
|
70
67
|
const DEFS = BUNDLED_DEFINITIONS;
|
|
71
68
|
// FIRST occurrence wins: with multiple bundled versions of one family (HITL
|
|
@@ -2592,7 +2589,7 @@ function promptTokens(content) {
|
|
|
2592
2589
|
* ["fileRef"]` (the pre-pull answer) instead of the three the platform's
|
|
2593
2590
|
* `ixp-node` validator actually enforces.
|
|
2594
2591
|
*/
|
|
2595
|
-
const IXP_DEF =
|
|
2592
|
+
const IXP_DEF = ixpDefinition;
|
|
2596
2593
|
/**
|
|
2597
2594
|
* Build the definition for one published IxP project.
|
|
2598
2595
|
*
|
|
@@ -6171,8 +6168,12 @@ export function serialize(built, opts = {}) {
|
|
|
6171
6168
|
// must leave from ITS handles), else positional (#1130).
|
|
6172
6169
|
const cases = step.cases.map((c, i) => ({
|
|
6173
6170
|
id: c.id ?? `case_${i + 1}`,
|
|
6174
|
-
|
|
6175
|
-
|
|
6171
|
+
// A `when` case writes its own condition — the product's per-case form,
|
|
6172
|
+
// first truthy case wins (#1131). A `value` case compares with `on`.
|
|
6173
|
+
label: c.label ?? (c.when !== undefined ? `Case ${i + 1}` : `Case ${caseLiteral(c.value)}`),
|
|
6174
|
+
expression: c.when !== undefined
|
|
6175
|
+
? renameRefs(c.when.js, scope.rename)
|
|
6176
|
+
: `${renameRefs(step.on?.js ?? 'undefined', scope.rename)} === ${caseLiteral(c.value)}`,
|
|
6176
6177
|
}));
|
|
6177
6178
|
node.inputs = { cases, hasDefault: step.default !== undefined };
|
|
6178
6179
|
scope.nodes.push(node);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.27.1",
|
|
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",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"@types/node": "^22.7.0",
|
|
93
93
|
"esbuild": "^0.28.1"
|
|
94
94
|
},
|
|
95
|
-
"gitref": "
|
|
95
|
+
"gitref": "c635f8993b10e795715c85109080ec8e2e2f28d2"
|
|
96
96
|
}
|