@uipath/maestro-builder-sdk 6.56.0 → 6.57.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 +6 -2
- package/dist/api-members.md +1 -1
- package/dist/cli/commands/flow.js +2 -0
- package/dist/core/script-function.d.ts +126 -0
- package/dist/core/script-function.js +510 -0
- package/dist/decompile-cli.js +11 -3
- package/dist/decompile.d.ts +9 -0
- package/dist/decompile.js +76 -3
- package/dist/flow-node-type.d.ts +21 -0
- package/dist/load.js +13 -0
- package/dist/nodes/script/flow/factories.d.ts +42 -1
- package/dist/nodes/script/flow/factories.js +8 -9
- package/dist/nodes/script/flow/node-type.js +71 -0
- package/dist/nodes/script/flow/runtime.d.ts +20 -0
- package/dist/nodes/script/flow/runtime.js +29 -0
- package/dist/nodes/script/flow/spec.d.ts +32 -1
- package/dist/script-function-scope.d.ts +57 -0
- package/dist/script-function-scope.js +203 -0
- package/package.json +2 -2
package/dist/api-index.md
CHANGED
|
@@ -37,7 +37,7 @@ could hand you spans for a version you do not have.
|
|
|
37
37
|
|
|
38
38
|
## `@uipath/maestro-builder-sdk`
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
236 symbol(s). Import from `@uipath/maestro-builder-sdk`.
|
|
41
41
|
|
|
42
42
|
| Symbol | Kind | Declaration | Area | Summary |
|
|
43
43
|
| --- | --- | --- | --- | --- |
|
|
@@ -229,10 +229,14 @@ could hand you spans for a version you do not have.
|
|
|
229
229
|
| `ScheduledInputs` | interface | `dist/flow-sdk.d.ts:151-163` | Option shapes | 1 field(s) |
|
|
230
230
|
| `ScheduleEvery` | type | `dist/flow-sdk.d.ts:139-150` | Supporting types | How often a scheduled flow runs, as an ISO-8601 repeating interval: `R/` followed by a duration. |
|
|
231
231
|
| `SchedulePreset` | type | `dist/flow-sdk.d.ts:138` | Supporting types | |
|
|
232
|
-
| `script` | function | `dist/nodes/script/flow/factories.d.ts:
|
|
232
|
+
| `script` | function | `dist/nodes/script/flow/factories.d.ts:8-36` | Actions | Declare an inline script action, as a TypeScript function the compiler checks. |
|
|
233
|
+
| `script` | function | `dist/nodes/script/flow/factories.d.ts:37-47` | Actions | Declare an inline script action, as a TypeScript function, with no declared return: the body's type is inferred as it is… |
|
|
234
|
+
| `script` | function | `dist/nodes/script/flow/factories.d.ts:48-55` | Actions | Declare an inline script action. |
|
|
233
235
|
| `ScriptInputs` | interface | `dist/nodes/script/flow/spec.d.ts:7-44` | Option shapes | 2 field(s) |
|
|
234
236
|
| `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… |
|
|
235
237
|
| `ScriptReturnType` | type | `dist/core/script-return.d.ts:31-41` | Supporting types | The vocabulary a script's output can be declared as. |
|
|
238
|
+
| `ScriptValue` | type | `dist/nodes/script/flow/spec.d.ts:65-75` | Supporting types | What a script function must return for a given `returns`: the type a name stands for, or, for a field map, an object… |
|
|
239
|
+
| `ScriptValueOf` | type | `dist/nodes/script/flow/spec.d.ts:63-64` | Supporting types | The TypeScript type one of ScriptReturnType's names stands for. |
|
|
236
240
|
| `sendMessage` | function | `dist/nodes/conversation/flow/factories.d.ts:8-26` | Actions | Post an assistant message into a live conversation (`uipath.conversational.send-message`). |
|
|
237
241
|
| `SendMessageInputs` | interface | `dist/nodes/conversation/flow/spec.d.ts:8-27` | Option shapes | 4 field(s) |
|
|
238
242
|
| `ShownField` | interface | `dist/core/actions.d.ts:205-220` | Supporting types | A value the reviewer READS: shown on the form, filled in from the flow. |
|
package/dist/api-members.md
CHANGED
|
@@ -976,7 +976,7 @@ not find it either.
|
|
|
976
976
|
| `schemaVersion` | method | `FlowBuilder` | `dist/flow-sdk.d.ts:1581-1620` |
|
|
977
977
|
| `scope` | property | `EscalationRecipient` | `dist/case/case-sdk.d.ts:129` |
|
|
978
978
|
| `scopes` | property | `GuardrailSelector` | `dist/core/actions.d.ts:290` |
|
|
979
|
-
| `script` | property | `FlowActionSpecs` | `dist/nodes/script/flow/spec.d.ts:
|
|
979
|
+
| `script` | property | `FlowActionSpecs` | `dist/nodes/script/flow/spec.d.ts:78-81` |
|
|
980
980
|
| `script` | property | `ScriptTaskOpts` | `dist/bpmn/bpmn-sdk.d.ts:880-896` |
|
|
981
981
|
| `scriptFormat` | property | `ScriptTaskOpts` | `dist/bpmn/bpmn-sdk.d.ts:897-898` |
|
|
982
982
|
| `scriptTask` | method | `ScopeBuilder` | `dist/bpmn/bpmn-sdk.d.ts:2380-2388` |
|
|
@@ -93,10 +93,12 @@ export function registerFlowCommands(program) {
|
|
|
93
93
|
.option('--strict', 'fail on unsupported constructs')
|
|
94
94
|
.option('--no-pipeline', 'do not emit a brownfield pipeline helper')
|
|
95
95
|
.option('--package <name...>', 'trust and load this node-type package (repeatable); otherwise package.json "maestroBuilderSdk".nodePackages decides')
|
|
96
|
+
.option('--scripts <form>', 'print script steps as "function" (the default) or "string"')
|
|
96
97
|
.action(async (input, options) => {
|
|
97
98
|
const argv = [input];
|
|
98
99
|
addValue(argv, '-o', options.output);
|
|
99
100
|
addValue(argv, '--import', options.import);
|
|
101
|
+
addValue(argv, '--scripts', options.scripts);
|
|
100
102
|
if (options.strict)
|
|
101
103
|
argv.push('--strict');
|
|
102
104
|
if (options.pipeline === false)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* core/script-function — a TypeScript function lowered to a script body.
|
|
3
|
+
*
|
|
4
|
+
* A script body is a string the editor and tsc never see. Authoring it as a
|
|
5
|
+
* function lets the compiler check it like the rest of the module, and this file
|
|
6
|
+
* turns that function back into the body a script node carries
|
|
7
|
+
* (docs/SCRIPT_FUNCTION_DESIGN.md).
|
|
8
|
+
*
|
|
9
|
+
* The body is kept EXACTLY as `Function.prototype.toString()` returned it: the
|
|
10
|
+
* artifact goes to a designer, and the author expects to see the script they
|
|
11
|
+
* wrote. Only two edits are made, both because the runtime requires them:
|
|
12
|
+
*
|
|
13
|
+
* 1. the parameter is renamed to the runtime's own scope global (`$vars` in
|
|
14
|
+
* Flow). The parameter is an authoring-time name for that global; the SDK
|
|
15
|
+
* never calls the function or passes it anything.
|
|
16
|
+
* 2. esbuild's `keepNames` wrappers (`__name(fn, "fn")`) are removed. A loader
|
|
17
|
+
* such as tsx adds them, and the script runtime has no `__name`.
|
|
18
|
+
*
|
|
19
|
+
* Everything else that would make the lowered body behave differently from the
|
|
20
|
+
* function is refused rather than rewritten: a name the runtime does not
|
|
21
|
+
* provide, a `$vars` binding that would capture the rename, a destructured
|
|
22
|
+
* parameter whose step reads `renameRefs` could not see, a reference to the
|
|
23
|
+
* function's own name, which only the body loses.
|
|
24
|
+
*
|
|
25
|
+
* Names are resolved with the checker of a one-file program over the function's
|
|
26
|
+
* source, not by text: `a.vars`, `{ vars: 1 }` and an inner `(vars) => …` are
|
|
27
|
+
* not references to the parameter, and only a checker knows that.
|
|
28
|
+
*/
|
|
29
|
+
import type * as TS from 'typescript';
|
|
30
|
+
/** How a runtime receives a lowered script: its scope global, and every other name it provides. */
|
|
31
|
+
export interface ScriptRuntime {
|
|
32
|
+
/** The identifier the runtime binds the variable scope to (`$vars` in Flow). */
|
|
33
|
+
scopeGlobal: string;
|
|
34
|
+
/** Every other global name the runtime provides: the language built-ins it has, `console`. */
|
|
35
|
+
globals: ReadonlySet<string>;
|
|
36
|
+
/** How errors name the runtime: `the Flow script runtime`. */
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
/** A function, or its source text, as `Function.prototype.toString()` returns it. */
|
|
40
|
+
export type ScriptFunctionSource = ((...args: never[]) => unknown) | string;
|
|
41
|
+
/**
|
|
42
|
+
* The body a script node carries for `fn`, or a thrown error naming every
|
|
43
|
+
* reason it cannot be one.
|
|
44
|
+
*
|
|
45
|
+
* @param fn - The function, or its source text (what `fn.toString()` returns).
|
|
46
|
+
* @param runtime - The runtime the body will run in.
|
|
47
|
+
* @param label - How errors name the call, e.g. `script(parseMessage)`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function lowerScriptFunction(fn: ScriptFunctionSource, runtime: ScriptRuntime, label?: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* The source of every function {@link lowerScriptFunction} has lowered in this
|
|
52
|
+
* process, in order, one entry per call.
|
|
53
|
+
*
|
|
54
|
+
* The CLIs that load a `.flow.ts` take the entries added while it imported,
|
|
55
|
+
* twice over: to decide whether the module-scope pass
|
|
56
|
+
* (`script-function-scope.ts`) has anything to look at, so a flow with no
|
|
57
|
+
* function scripts pays nothing for it; and to fail closed, by matching each
|
|
58
|
+
* lowered text to a declaration that pass followed, so a function it could not
|
|
59
|
+
* see is refused. Taken per load because one process may load two sources
|
|
60
|
+
* (`merge --baseline-from`).
|
|
61
|
+
*/
|
|
62
|
+
export declare function scriptFunctionLowerings(): readonly string[];
|
|
63
|
+
/** Options for {@link tryLowerScriptFunction}. */
|
|
64
|
+
export interface LowerOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Refuse any use of the parameter other than a dotted read (`vars.start…`):
|
|
67
|
+
* an alias (`const v = vars`), a computed read (`vars['start']`), an optional
|
|
68
|
+
* read (`vars?.start`), or passing it on (`pick(vars)`, `{ vars }`) each hides
|
|
69
|
+
* the step it reads from `renameRefs` and the reference check, which see only
|
|
70
|
+
* `$vars.<name>`. Authoring (`script(fn)`) sets it; decompile's gate does not,
|
|
71
|
+
* because there the text is the node's own either way.
|
|
72
|
+
*/
|
|
73
|
+
scopeReadsOnly?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** What lowering a function's source produced: its body, or every problem with it. */
|
|
76
|
+
export type LoweredScript = {
|
|
77
|
+
ok: true;
|
|
78
|
+
code: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* `free` is the names the runtime would not have, also described in `problems`;
|
|
82
|
+
* `syntax` is set when the source did not parse as one function at all.
|
|
83
|
+
*/
|
|
84
|
+
| {
|
|
85
|
+
ok: false;
|
|
86
|
+
problems: string[];
|
|
87
|
+
free: string[];
|
|
88
|
+
syntax?: true;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* {@link lowerScriptFunction} without the throw, for a caller that falls back
|
|
92
|
+
* when the source cannot be lowered (decompile's function-form gate).
|
|
93
|
+
*/
|
|
94
|
+
export declare function tryLowerScriptFunction(source: string, runtime: ScriptRuntime, options?: LowerOptions): LoweredScript;
|
|
95
|
+
/**
|
|
96
|
+
* The first syntax error in a script BODY (the text a script node carries), as
|
|
97
|
+
* `line N: message`, or undefined when it parses. Lines are the body's own.
|
|
98
|
+
*/
|
|
99
|
+
export declare function scriptBodySyntaxError(code: string): string | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* The JavaScript engine's early error for a body run as
|
|
102
|
+
* `function (<scopeGlobal>) { "use strict"; <code> }`, or undefined when it has
|
|
103
|
+
* none.
|
|
104
|
+
*
|
|
105
|
+
* TypeScript's parser does not report early errors (a duplicate `let`, a
|
|
106
|
+
* `const $vars` that clashes with the parameter, an octal literal in strict
|
|
107
|
+
* code), and the printed function lives in an ES module, which is strict. A body
|
|
108
|
+
* with one would make the whole module unloadable, so decompile asks the engine.
|
|
109
|
+
* The body is compiled, never called. A host without the `Function`
|
|
110
|
+
* constructor (a strict content-security policy) cannot answer, which is
|
|
111
|
+
* reported as an error too, so the caller keeps the string form.
|
|
112
|
+
*/
|
|
113
|
+
export declare function scriptBodyEarlyError(code: string, runtime: ScriptRuntime): string | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* The first piece of TypeScript-only syntax in a body, described, or undefined.
|
|
116
|
+
*
|
|
117
|
+
* A string body is JavaScript, but the printed function is read by a TypeScript
|
|
118
|
+
* loader, which erases type syntax before the runtime ever sees it: a body with
|
|
119
|
+
* `const n: number = 1` would come back from compile as `const n = 1`,
|
|
120
|
+
* and `f<T>(x)`, which JavaScript reads as two comparisons, would come back as a
|
|
121
|
+
* call. Either silently changes the stored script, so such a body keeps the
|
|
122
|
+
* string form.
|
|
123
|
+
*/
|
|
124
|
+
export declare function scriptBodyTypeScriptSyntax(code: string): string | undefined;
|
|
125
|
+
/** Whether `id` is read as a value, not a property name, label, or type. */
|
|
126
|
+
export declare function isReference(ts: typeof TS, id: TS.Identifier): boolean;
|