@uipath/maestro-builder-sdk 6.20.1 → 6.20.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/api-index.md
CHANGED
|
@@ -219,8 +219,8 @@ could hand you spans for a version you do not have.
|
|
|
219
219
|
| `SchedulePreset` | type | `dist/flow-sdk.d.ts:131` | Supporting types | |
|
|
220
220
|
| `script` | function | `dist/nodes/script/flow/factories.d.ts:7-14` | Actions | Declare an inline script action. |
|
|
221
221
|
| `ScriptInputs` | interface | `dist/nodes/script/flow/spec.d.ts:7-44` | Option shapes | 2 field(s) |
|
|
222
|
-
| `ScriptReturns` | type | `dist/core/script-return.d.ts:
|
|
223
|
-
| `ScriptReturnType` | type | `dist/core/script-return.d.ts:31-
|
|
222
|
+
| `ScriptReturns` | type | `dist/core/script-return.d.ts:42-48` | Supporting types | What an author may write for `script({ returns })`: the type outright, or — for an object return — the FIELDS, which is… |
|
|
223
|
+
| `ScriptReturnType` | type | `dist/core/script-return.d.ts:31-41` | Supporting types | The vocabulary a script's output can be declared as. |
|
|
224
224
|
| `sendMessage` | function | `dist/core/actions.d.ts:2438-2456` | Actions | Post an assistant message into a live conversation (`uipath.conversational.send-message`). |
|
|
225
225
|
| `SendMessageInputs` | interface | `dist/core/actions.d.ts:492-511` | Option shapes | 4 field(s) |
|
|
226
226
|
| `ShownField` | interface | `dist/core/actions.d.ts:198-213` | Supporting types | A value the reviewer READS: shown on the form, filled in from the flow. |
|
package/dist/check.js
CHANGED
|
@@ -4814,6 +4814,7 @@ function checkRegisteredStep(entry, s, exprs, errorSource, opts, diags, typeOf,
|
|
|
4814
4814
|
const ctx = {
|
|
4815
4815
|
step: s.name,
|
|
4816
4816
|
version: impl.version,
|
|
4817
|
+
definition: () => bundledDefinition(impl.typeName, impl.version),
|
|
4817
4818
|
report: (code, message, suggestion) => diags.push(catalogued(entry, s.name, code, message, suggestion)),
|
|
4818
4819
|
declaredRef: (js) => {
|
|
4819
4820
|
const name = declaredRefName(js, triggerId);
|
|
@@ -28,14 +28,24 @@
|
|
|
28
28
|
* into a designer error — the exact defect this file exists to remove, pointed
|
|
29
29
|
* the other way.
|
|
30
30
|
*/
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The vocabulary a script's output can be declared as.
|
|
33
|
+
*
|
|
34
|
+
* `'any'` is the platform's own declaration on `core.action.script@1.1` (the
|
|
35
|
+
* 1.0.0 definition says `'object'`), so it is valid only as the top-level
|
|
36
|
+
* `returns` of a 1.1 step; `check` refuses it on 1.0.0 and as a field type.
|
|
37
|
+
* Declaring it keeps the output open even when the body plainly returns one
|
|
38
|
+
* type; it is also how decompile writes back a 1.1 node whose output a designer
|
|
39
|
+
* left at that default.
|
|
40
|
+
*/
|
|
41
|
+
export type ScriptReturnType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'any';
|
|
33
42
|
/**
|
|
34
43
|
* What an author may write for `script({ returns })`: the type outright, or —
|
|
35
44
|
* for an object return — the FIELDS, which is the spelling every other action's
|
|
36
|
-
* `returns` uses (`http`, `rpaWorkflow`, `agent`).
|
|
45
|
+
* `returns` uses (`http`, `rpaWorkflow`, `agent`). A field's type is never
|
|
46
|
+
* `'any'`.
|
|
37
47
|
*/
|
|
38
|
-
export type ScriptReturns = ScriptReturnType | Record<string, ScriptReturnType
|
|
48
|
+
export type ScriptReturns = ScriptReturnType | Record<string, Exclude<ScriptReturnType, 'any'>>;
|
|
39
49
|
/** A resolved output declaration: a type, and for objects the fields we know. */
|
|
40
50
|
export interface ScriptOutputShape {
|
|
41
51
|
type: ScriptReturnType;
|
package/dist/decompile.js
CHANGED
|
@@ -563,7 +563,9 @@ function emitRegisteredSpec(node, imp, inputNames) {
|
|
|
563
563
|
sourceText: unwrapSource,
|
|
564
564
|
plainValue: unwrapPlain,
|
|
565
565
|
stepName: (nodeId) => nodeId,
|
|
566
|
-
definition
|
|
566
|
+
// The file's carried definition first; the bundled one at the node's version
|
|
567
|
+
// when the file carries none (a hand-trimmed or SDK-written file).
|
|
568
|
+
definition: () => runDefs.get(`${node.type}@${version}`) ?? BUNDLED_DEFINITIONS[`${node.type}@${version}`] ?? runDefs.get(node.type),
|
|
567
569
|
warn: warnOnce,
|
|
568
570
|
};
|
|
569
571
|
const spec = impl.deserialize(node, ctx);
|
package/dist/flow-node-type.d.ts
CHANGED
|
@@ -92,7 +92,10 @@ export interface FlowDeserializeContext {
|
|
|
92
92
|
plainValue(raw: unknown): unknown;
|
|
93
93
|
/** The step name a node id was emitted for. */
|
|
94
94
|
stepName(nodeId: string): string;
|
|
95
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* The node's definition: the file's own `definitions[]` entry for it, else the
|
|
97
|
+
* SDK's bundled definition at the node's version; undefined when neither exists.
|
|
98
|
+
*/
|
|
96
99
|
definition(): unknown;
|
|
97
100
|
/** Report something the lift could not keep. Decompile prints it once. */
|
|
98
101
|
warn(message: string): void;
|
|
@@ -119,6 +122,11 @@ export interface FlowCheckContext {
|
|
|
119
122
|
readonly step: string;
|
|
120
123
|
/** The version the node will be emitted at. */
|
|
121
124
|
readonly version: string;
|
|
125
|
+
/**
|
|
126
|
+
* The SDK's bundled definition of this step's node type at `version` (the one
|
|
127
|
+
* serialize emits from), or undefined when the SDK does not ship it.
|
|
128
|
+
*/
|
|
129
|
+
definition(): unknown;
|
|
122
130
|
/** Report a diagnostic on this step. Its severity is the family catalog's for `code`. */
|
|
123
131
|
report(code: string, message: string, suggestion?: string): void;
|
|
124
132
|
/**
|
|
@@ -2,8 +2,22 @@ export const SCRIPT_DIAGNOSTICS = {
|
|
|
2
2
|
SCRIPT_RETURNS_UNKNOWN_TYPE: { severity: 'error', summary: '`returns` names a type the wire format does not know' },
|
|
3
3
|
SCRIPT_EMPTY_RETURNS: { severity: 'warning', summary: '`returns: {}` names no fields' },
|
|
4
4
|
};
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The types a script's `returns` may name for a FIELD, and at the top level on
|
|
7
|
+
* every version. `any` is not one: no definition declares a field as `any`.
|
|
8
|
+
*/
|
|
9
|
+
const SCRIPT_FIELD_TYPES = new Set(['string', 'number', 'boolean', 'object', 'array']);
|
|
10
|
+
/**
|
|
11
|
+
* The types a top-level `returns` may name at this step's version: the field
|
|
12
|
+
* types, plus the output type the node's own definition declares at that version
|
|
13
|
+
* (`any` on `core.action.script@1.1`, `object` on 1.0.0).
|
|
14
|
+
*/
|
|
15
|
+
function topLevelTypes(ctx) {
|
|
16
|
+
const declared = ctx.definition()
|
|
17
|
+
?.outputDefinition?.output?.type;
|
|
18
|
+
return typeof declared === 'string' ? new Set([...SCRIPT_FIELD_TYPES, declared]) : SCRIPT_FIELD_TYPES;
|
|
19
|
+
}
|
|
20
|
+
const quoted = (types) => [...types].map((t) => `"${t}"`).join(', ');
|
|
7
21
|
/**
|
|
8
22
|
* A script step's `returns` — the author overriding what the body looks like.
|
|
9
23
|
*
|
|
@@ -19,9 +33,10 @@ export function checkScript(inputs, ctx) {
|
|
|
19
33
|
if (returns === undefined)
|
|
20
34
|
return;
|
|
21
35
|
if (typeof returns === 'string') {
|
|
22
|
-
|
|
36
|
+
const allowed = topLevelTypes(ctx);
|
|
37
|
+
if (!allowed.has(returns)) {
|
|
23
38
|
ctx.report('SCRIPT_RETURNS_UNKNOWN_TYPE', `Script step "${step}" declares \`returns: ${JSON.stringify(returns)}\`, which is not a type the `
|
|
24
|
-
+ `wire format knows. Use one of ${
|
|
39
|
+
+ `wire format knows at ${ctx.version}. Use one of ${quoted(allowed)}, or a `
|
|
25
40
|
+ `field map like \`{ total: "number" }\` to name an object's fields.`);
|
|
26
41
|
}
|
|
27
42
|
return;
|
|
@@ -41,9 +56,9 @@ export function checkScript(inputs, ctx) {
|
|
|
41
56
|
return;
|
|
42
57
|
}
|
|
43
58
|
for (const [name, type] of Object.entries(fields)) {
|
|
44
|
-
if (typeof type !== 'string' || !
|
|
59
|
+
if (typeof type !== 'string' || !SCRIPT_FIELD_TYPES.has(type)) {
|
|
45
60
|
ctx.report('SCRIPT_RETURNS_UNKNOWN_TYPE', `Script step "${step}" declares field "${name}" as ${JSON.stringify(type)}, which is not a type the `
|
|
46
|
-
+ `wire format knows. Use one of ${
|
|
61
|
+
+ `wire format knows for a field. Use one of ${quoted(SCRIPT_FIELD_TYPES)}.`);
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
}
|
|
@@ -23,9 +23,13 @@ import { checkScript } from './check.js';
|
|
|
23
23
|
*/
|
|
24
24
|
function scriptOutputs(base, returns, code) {
|
|
25
25
|
const shape = returns !== undefined ? declaredScriptShape(returns) : inferScriptShape(code);
|
|
26
|
-
// Nothing knowable
|
|
27
|
-
//
|
|
28
|
-
|
|
26
|
+
// Nothing knowable — leave the node exactly as it was. An INFERRED bare object
|
|
27
|
+
// is nothing knowable either: the inference never enumerates fields, so it
|
|
28
|
+
// only says "some object", and the definition's own declaration stands. A
|
|
29
|
+
// DECLARED type always lands, even `object`: the definition's default is
|
|
30
|
+
// version-dependent (`object` on script 1.0.0, `any` on 1.1), so "the same as
|
|
31
|
+
// the default" is not a property of the word `object`.
|
|
32
|
+
if (!shape || (returns === undefined && shape.type === 'object' && !shape.properties))
|
|
29
33
|
return base;
|
|
30
34
|
if (!base || typeof base !== 'object')
|
|
31
35
|
return base;
|
|
@@ -46,7 +50,7 @@ function scriptOutputs(base, returns, code) {
|
|
|
46
50
|
* the same way — a property map the body does not produce is one the author gave
|
|
47
51
|
* as `returns: {…}`.
|
|
48
52
|
*/
|
|
49
|
-
function liftReturns(node, code) {
|
|
53
|
+
function liftReturns(node, code, definitionType) {
|
|
50
54
|
const out = node.outputs?.output;
|
|
51
55
|
const declared = typeof out?.type === 'string' ? out.type : undefined;
|
|
52
56
|
if (!declared)
|
|
@@ -54,11 +58,14 @@ function liftReturns(node, code) {
|
|
|
54
58
|
const props = out?.properties;
|
|
55
59
|
// What re-compiling this body with NO `returns` would declare. Mirror
|
|
56
60
|
// `scriptOutputs` exactly: an inference of a bare `object` (or none at all)
|
|
57
|
-
// leaves the definition's own
|
|
61
|
+
// leaves the definition's own output type standing, untouched. That type is
|
|
62
|
+
// the node's definition AT ITS VERSION (`definitionType`): `object` on script
|
|
63
|
+
// 1.0.0 but `any` on 1.1, so a 1.1 node's untouched `any` is the default, not
|
|
64
|
+
// an author override.
|
|
58
65
|
const inferred = inferScriptShape(code);
|
|
59
66
|
const effective = inferred && !(inferred.type === 'object' && !inferred.properties)
|
|
60
67
|
? inferred
|
|
61
|
-
: { type:
|
|
68
|
+
: { type: definitionType, properties: undefined };
|
|
62
69
|
const same = effective.type === declared
|
|
63
70
|
&& JSON.stringify(sortKeys(effective.properties ?? {})) === JSON.stringify(sortKeys(props ?? {}));
|
|
64
71
|
if (same)
|
|
@@ -95,14 +102,16 @@ function scriptAt(version) {
|
|
|
95
102
|
...(typed !== base ? { outputs: typed } : {}),
|
|
96
103
|
};
|
|
97
104
|
},
|
|
98
|
-
deserialize: (node) => {
|
|
105
|
+
deserialize: (node, ctx) => {
|
|
99
106
|
const raw = node.inputs?.script;
|
|
100
107
|
const code = typeof raw === 'string' ? raw : '';
|
|
101
108
|
// `returns` is recovered only when the node's declared output is something
|
|
102
109
|
// re-compiling the body would NOT produce on its own: serialize infers from
|
|
103
110
|
// the body first, so a script whose type is already plain in its code
|
|
104
111
|
// round-trips without it.
|
|
105
|
-
const
|
|
112
|
+
const defType = ctx.definition()
|
|
113
|
+
?.outputDefinition?.output?.type;
|
|
114
|
+
const returns = liftReturns(node, code, typeof defType === 'string' ? defType : 'object');
|
|
106
115
|
return { kind: 'script', inputs: { code, ...(returns !== undefined ? { returns } : {}) } };
|
|
107
116
|
},
|
|
108
117
|
print: ({ inputs }, ctx) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.20.
|
|
3
|
+
"version": "6.20.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",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"@types/node": "^22.7.0",
|
|
93
93
|
"esbuild": "^0.28.1"
|
|
94
94
|
},
|
|
95
|
-
"gitref": "
|
|
95
|
+
"gitref": "b82dedf06e578750e6cb85ed825d25cec1745b09"
|
|
96
96
|
}
|