@uipath/maestro-builder-sdk 6.87.0 → 6.87.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/README.md +2 -0
- package/dist/api-index.md +5 -1
- package/dist/api-members.md +4 -0
- package/dist/bpmn/check-cli.js +38 -7
- package/dist/bpmn/source-types.d.ts +17 -0
- package/dist/bpmn/source-types.js +136 -0
- package/dist/bpmn-api.md +1201 -0
- package/dist/cli/commands/bpmn.js +3 -0
- package/dist/script-function-scope.d.ts +38 -0
- package/dist/script-function-scope.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -158,6 +158,8 @@ The same builder core, the same four verbs. Import from
|
|
|
158
158
|
`uip maestro case compile` / `uip maestro bpmn compile`. Their builder surfaces are in the same
|
|
159
159
|
generated indexes as Flow's — `api-index.md` by symbol name, `api-members.md` by
|
|
160
160
|
field or method name — which cover all three entry points.
|
|
161
|
+
BPMN also gets `dist/bpmn-api.md`: every builder method and option field, one line each, with its type and one-line doc.
|
|
162
|
+
`uip maestro bpmn check --source` type-checks the `.bpmn.ts` before running it, so a misspelled option or a value of the wrong type is a `TS<code>` error at `file:line:col` rather than a crash; `--no-types` skips that pass.
|
|
161
163
|
|
|
162
164
|
The package is ESM.
|
|
163
165
|
Every entry also answers CommonJS resolution, so `require.resolve` of a subpath such as `@uipath/maestro-builder-sdk/bpmn` finds the file on disk, and on Node 22.12 or later `require()` loads it too.
|
package/dist/api-index.md
CHANGED
|
@@ -14,6 +14,10 @@ reference pages are "one line per field". Those are not here — they are in
|
|
|
14
14
|
[`api-members.md`](api-members.md), keyed by the member's own name. This file
|
|
15
15
|
indexes the exports: interfaces, types, functions, classes, consts.
|
|
16
16
|
|
|
17
|
+
**Authoring BPMN? Start in [`bpmn-api.md`](bpmn-api.md), not here.** It lists every
|
|
18
|
+
builder method and option field of `@uipath/maestro-builder-sdk/bpmn` with its type and
|
|
19
|
+
one-line doc, so the row you land on is the answer and no `.d.ts` read follows.
|
|
20
|
+
|
|
17
21
|
**Read the declaration, not a description of it.** The `.d.ts` is what the
|
|
18
22
|
compiler checks your source against, and it carries the `@remarks` and
|
|
19
23
|
`@example` bodies the reference pages leave out. The span below is the whole
|
|
@@ -404,7 +408,7 @@ could hand you spans for a version you do not have.
|
|
|
404
408
|
|
|
405
409
|
## `@uipath/maestro-builder-sdk/bpmn`
|
|
406
410
|
|
|
407
|
-
115 symbol(s). Import from `@uipath/maestro-builder-sdk/bpmn`.
|
|
411
|
+
115 symbol(s). Import from `@uipath/maestro-builder-sdk/bpmn`. Every method and option field below, with its type and doc, is in [`bpmn-api.md`](bpmn-api.md) — read that first.
|
|
408
412
|
|
|
409
413
|
| Symbol | Kind | Declaration | Area | Summary |
|
|
410
414
|
| --- | --- | --- | --- | --- |
|
package/dist/api-members.md
CHANGED
|
@@ -18,6 +18,10 @@ the case: the reference pages are "one line per field", so you arrive holding
|
|
|
18
18
|
`outcomePorts`, not `HitlInputs`. Look it up here and you get the shape that
|
|
19
19
|
declares it and the exact lines that declare it.
|
|
20
20
|
|
|
21
|
+
**Authoring BPMN? Search [`bpmn-api.md`](bpmn-api.md) instead.** It has the same members
|
|
22
|
+
of `@uipath/maestro-builder-sdk/bpmn` WITH their type and one-line doc, so the row is the
|
|
23
|
+
answer and there is no span to follow.
|
|
24
|
+
|
|
21
25
|
[`api-index.md`](api-index.md) is the other half: the same thing keyed by the
|
|
22
26
|
exported symbol (interfaces, types, functions, classes, consts).
|
|
23
27
|
|
package/dist/bpmn/check-cli.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* check-cli — fast static validation of a <Name>.bpmn.ts (no output file).
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* node --experimental-strip-types check-cli.js <bpmn.ts | BaseName> [--graph] \
|
|
6
|
+
* node --experimental-strip-types check-cli.js <bpmn.ts | BaseName> [--graph] [--no-types] \
|
|
7
7
|
* [--library <library-json dir>] [--connectors-local <overlay dir>] [--bindings <bindings.json>] \
|
|
8
8
|
* [--resources <resources.json>]
|
|
9
9
|
*
|
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
* Exit 0 = clean; exit 1 = at least one error. Warnings print but do not fail.
|
|
14
14
|
* `--graph` also prints the resolved wiring to stdout — every element with the flows
|
|
15
15
|
* leaving it, implied edges marked — see graph.ts.
|
|
16
|
+
*
|
|
17
|
+
* The source is type-checked first (source-types.ts): a wrong option name or a
|
|
18
|
+
* value of the wrong type is a `TS<code>` error with its `file:line:col`, and it
|
|
19
|
+
* is reported even when the source then crashes on load or in the check.
|
|
20
|
+
* `--no-types` skips it.
|
|
16
21
|
*/
|
|
17
22
|
import { existsSync } from 'node:fs';
|
|
18
23
|
import { printResult, reportDiagnostics, reportResult } from '../cli-result.js';
|
|
19
24
|
import { resolveBpmnFile, loadBuiltBpmn } from './load.js';
|
|
20
25
|
import { check } from './check.js';
|
|
26
|
+
import { sourceTypeDiagnostics } from './source-types.js';
|
|
21
27
|
import { graphModel, renderGraph } from './graph.js';
|
|
22
28
|
import { Bindings } from '../core/bindings.js';
|
|
23
29
|
import { connectorCheckOpts, openCliLibrary } from '../core/cli-library.js';
|
|
@@ -39,20 +45,46 @@ function bpmnCheckOpts(argv) {
|
|
|
39
45
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
40
46
|
return { ...connectorCheckOpts(openCliLibrary(argv), bindFile ? new Bindings(bindFile) : undefined), ...(resources ? { resources } : {}) };
|
|
41
47
|
}
|
|
48
|
+
function printDiagnostics(diags) {
|
|
49
|
+
for (const d of diags)
|
|
50
|
+
console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
|
|
51
|
+
}
|
|
52
|
+
/** The diagnostics, both as the `--json` result and as the printed lines. */
|
|
53
|
+
function report(diags) {
|
|
54
|
+
reportDiagnostics(diags);
|
|
55
|
+
printDiagnostics(diags);
|
|
56
|
+
}
|
|
42
57
|
export async function run(argv) {
|
|
43
58
|
if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
|
|
44
|
-
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
59
|
+
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--no-types] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
45
60
|
return 2;
|
|
46
61
|
}
|
|
47
62
|
ensureTypeScriptRuntime();
|
|
48
63
|
const graph = argv.includes('--graph');
|
|
49
64
|
const input = argv.find((a, i) => !a.startsWith('--') && !VALUE_FLAGS.has(argv[i - 1]));
|
|
50
65
|
if (input === undefined) {
|
|
51
|
-
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
66
|
+
console.error('usage: check <bpmn.ts | BaseName> [--graph] [--no-types] [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>]');
|
|
52
67
|
return 2;
|
|
53
68
|
}
|
|
54
|
-
const
|
|
55
|
-
const
|
|
69
|
+
const file = resolveBpmnFile(input);
|
|
70
|
+
const typeDiags = argv.includes('--no-types') ? [] : sourceTypeDiagnostics(file);
|
|
71
|
+
let built;
|
|
72
|
+
let diags;
|
|
73
|
+
try {
|
|
74
|
+
built = await loadBuiltBpmn(file);
|
|
75
|
+
diags = [...typeDiags, ...check(built, bpmnCheckOpts(argv))];
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
// A value of the wrong type usually crashes the build or the check before
|
|
79
|
+
// either reports anything (`expr.startsWith is not a function`). The type
|
|
80
|
+
// errors are the explanation, so they go out first, then the crash.
|
|
81
|
+
if (!typeDiags.some((d) => d.level === 'error'))
|
|
82
|
+
throw error;
|
|
83
|
+
report(typeDiags);
|
|
84
|
+
console.error(`check: the source also failed to run: ${error instanceof Error ? error.message : String(error)}`);
|
|
85
|
+
console.error(`check: ${typeDiags.filter((d) => d.level === 'error').length} type error(s); fix them first.`);
|
|
86
|
+
return 1;
|
|
87
|
+
}
|
|
56
88
|
reportDiagnostics(diags);
|
|
57
89
|
if (graph) {
|
|
58
90
|
// The graph goes to stdout and the diagnostics to stderr, so a reviewer can
|
|
@@ -61,8 +93,7 @@ export async function run(argv) {
|
|
|
61
93
|
printResult(renderGraph(built).trimEnd());
|
|
62
94
|
reportResult({ graph: graphModel(built) });
|
|
63
95
|
}
|
|
64
|
-
|
|
65
|
-
console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
|
|
96
|
+
printDiagnostics(diags);
|
|
66
97
|
const errors = diags.filter((d) => d.level === 'error').length;
|
|
67
98
|
if (errors) {
|
|
68
99
|
console.error(`check: ${errors} error(s).`);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Diagnostic } from './check.js';
|
|
2
|
+
/**
|
|
3
|
+
* The libraries the program reads: what Node >= 22.6 implements. ES2024
|
|
4
|
+
* (`toSorted`, `Object.groupBy`) plus the later pieces Node 22 already ships:
|
|
5
|
+
* the Set methods (`union`), the iterator helpers (`Iterator.from`) and
|
|
6
|
+
* `Array.fromAsync`. No DOM: `lib.dom.d.ts` is two thirds of the text a DOM
|
|
7
|
+
* program reads and tripled its cold build. Node's own globals come from
|
|
8
|
+
* RUNTIME_GLOBALS instead.
|
|
9
|
+
*
|
|
10
|
+
* The `esnext.*` files are not a fixed set: a later TypeScript can add an API
|
|
11
|
+
* to one that Node 22 lacks, and `check` would then pass a call that throws.
|
|
12
|
+
* `bpmn-cli.test.ts` pins every declaration they make, so such an addition
|
|
13
|
+
* fails a test instead of reaching an author.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TYPE_CHECK_LIBS: readonly ["lib.es2024.d.ts", "lib.esnext.collection.d.ts", "lib.esnext.iterator.d.ts", "lib.esnext.array.d.ts"];
|
|
16
|
+
/** Every type error in `file` and the author's files it imports, or none. */
|
|
17
|
+
export declare function sourceTypeDiagnostics(file: string): Diagnostic[];
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { dirname, isAbsolute, join, relative } from 'node:path';
|
|
2
|
+
import { typescript } from '../core/typescript-module.js';
|
|
3
|
+
import { sdkResolvingHost } from '../script-function-scope.js';
|
|
4
|
+
/**
|
|
5
|
+
* TypeScript codes that mean "the program could not see something", not "the
|
|
6
|
+
* call is wrong": cannot find module (2307, 2792), the "install type
|
|
7
|
+
* definitions for node" family (2580, 2591, 2592, 2593) for a name the shim
|
|
8
|
+
* leaves out, a DOM-only global (2584), a missing type library (2688). A plain
|
|
9
|
+
* missing name (2304) stays an error: it is usually a typo, or a CommonJS name
|
|
10
|
+
* (`__dirname`) that an ES module does not have when it runs either.
|
|
11
|
+
*/
|
|
12
|
+
const ENVIRONMENT_CODES = new Set([2307, 2580, 2584, 2591, 2592, 2593, 2688, 2792]);
|
|
13
|
+
/**
|
|
14
|
+
* Node's runtime globals, declared loosely, for a program that loads neither
|
|
15
|
+
* `@types/node` nor the DOM lib.
|
|
16
|
+
*
|
|
17
|
+
* The authored source runs on Node, so `setTimeout`, `fetch`, `URL`,
|
|
18
|
+
* `structuredClone`, `process` and `import.meta.url` all exist when it runs; a
|
|
19
|
+
* program without them fails `check` on a source that works. Loading
|
|
20
|
+
* `@types/node` instead would make the result depend on what the author's tree
|
|
21
|
+
* happens to have installed, and would cost more than the rest of the program,
|
|
22
|
+
* so the names are declared here as loosely as still lets them be used as
|
|
23
|
+
* values, types and constructors. Checking the author's NODE calls is not this
|
|
24
|
+
* pass's job; checking the SDK calls is. Served as a virtual `.d.ts`, so
|
|
25
|
+
* `skipLibCheck` covers it and no diagnostic is reported against it.
|
|
26
|
+
*/
|
|
27
|
+
const RUNTIME_GLOBALS = [
|
|
28
|
+
'interface ImportMeta { url: string; dirname: string; filename: string; resolve(specifier: string): string; }',
|
|
29
|
+
'declare var process: any;',
|
|
30
|
+
'declare var Buffer: any;',
|
|
31
|
+
'declare var global: typeof globalThis;',
|
|
32
|
+
'declare var console: any;',
|
|
33
|
+
'declare var crypto: any;',
|
|
34
|
+
'declare var performance: any;',
|
|
35
|
+
'declare function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): any;',
|
|
36
|
+
'declare function setInterval(callback: (...args: any[]) => void, ms?: number, ...args: any[]): any;',
|
|
37
|
+
'declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;',
|
|
38
|
+
'declare function clearTimeout(handle?: any): void;',
|
|
39
|
+
'declare function clearInterval(handle?: any): void;',
|
|
40
|
+
'declare function clearImmediate(handle?: any): void;',
|
|
41
|
+
'declare function queueMicrotask(callback: () => void): void;',
|
|
42
|
+
'declare function structuredClone<T>(value: T, options?: any): T;',
|
|
43
|
+
'declare function fetch(input: any, init?: any): Promise<any>;',
|
|
44
|
+
'declare function atob(data: string): string;',
|
|
45
|
+
'declare function btoa(data: string): string;',
|
|
46
|
+
'declare var navigator: any;',
|
|
47
|
+
'declare var WebAssembly: any;',
|
|
48
|
+
...[
|
|
49
|
+
'URL', 'URLSearchParams', 'URLPattern', 'DOMException', 'AbortController', 'AbortSignal',
|
|
50
|
+
'Event', 'EventTarget', 'CustomEvent', 'MessageEvent', 'CloseEvent', 'TextEncoder', 'TextDecoder',
|
|
51
|
+
'TransformStream', 'TransformStreamDefaultController', 'WritableStream', 'WritableStreamDefaultController',
|
|
52
|
+
'WritableStreamDefaultWriter', 'ReadableStream', 'ReadableStreamDefaultReader', 'ReadableStreamBYOBReader',
|
|
53
|
+
'ReadableStreamBYOBRequest', 'ReadableByteStreamController', 'ReadableStreamDefaultController',
|
|
54
|
+
'ByteLengthQueuingStrategy', 'CountQueuingStrategy', 'TextEncoderStream', 'TextDecoderStream',
|
|
55
|
+
'CompressionStream', 'DecompressionStream', 'BroadcastChannel', 'MessageChannel', 'MessagePort', 'Blob', 'File',
|
|
56
|
+
'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure', 'PerformanceObserver',
|
|
57
|
+
'PerformanceObserverEntryList', 'PerformanceResourceTiming', 'FormData', 'Headers', 'Request', 'Response',
|
|
58
|
+
'WebSocket', 'Crypto', 'CryptoKey', 'SubtleCrypto', 'Navigator', 'SuppressedError', 'DisposableStack',
|
|
59
|
+
'AsyncDisposableStack', 'Float16Array',
|
|
60
|
+
].map((name) => `declare class ${name} { constructor(...args: any[]); [key: string]: any; static [key: string]: any; }`),
|
|
61
|
+
].join('\n');
|
|
62
|
+
/**
|
|
63
|
+
* The libraries the program reads: what Node >= 22.6 implements. ES2024
|
|
64
|
+
* (`toSorted`, `Object.groupBy`) plus the later pieces Node 22 already ships:
|
|
65
|
+
* the Set methods (`union`), the iterator helpers (`Iterator.from`) and
|
|
66
|
+
* `Array.fromAsync`. No DOM: `lib.dom.d.ts` is two thirds of the text a DOM
|
|
67
|
+
* program reads and tripled its cold build. Node's own globals come from
|
|
68
|
+
* RUNTIME_GLOBALS instead.
|
|
69
|
+
*
|
|
70
|
+
* The `esnext.*` files are not a fixed set: a later TypeScript can add an API
|
|
71
|
+
* to one that Node 22 lacks, and `check` would then pass a call that throws.
|
|
72
|
+
* `bpmn-cli.test.ts` pins every declaration they make, so such an addition
|
|
73
|
+
* fails a test instead of reaching an author.
|
|
74
|
+
*/
|
|
75
|
+
export const TYPE_CHECK_LIBS = [
|
|
76
|
+
'lib.es2024.d.ts', 'lib.esnext.collection.d.ts', 'lib.esnext.iterator.d.ts', 'lib.esnext.array.d.ts',
|
|
77
|
+
];
|
|
78
|
+
/** The virtual file the runtime globals are served as, beside the source. */
|
|
79
|
+
const RUNTIME_GLOBALS_FILE = '__maestro-bpmn-runtime-globals__.d.ts';
|
|
80
|
+
/** Every type error in `file` and the author's files it imports, or none. */
|
|
81
|
+
export function sourceTypeDiagnostics(file) {
|
|
82
|
+
const ts = typescript();
|
|
83
|
+
const options = {
|
|
84
|
+
noEmit: true, skipLibCheck: true, allowImportingTsExtensions: true, allowJs: false,
|
|
85
|
+
// Every file is a module, as the loader runs it: Node detects a `.ts` file's
|
|
86
|
+
// ESM syntax with no `"type": "module"` (so top-level `await` works), where
|
|
87
|
+
// NodeNext would type it as CommonJS and refuse the `await` (TS1309).
|
|
88
|
+
// Bundler resolution still honours the SDK's `exports` and their `types`.
|
|
89
|
+
target: ts.ScriptTarget.ES2023, module: ts.ModuleKind.ESNext, moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
90
|
+
moduleDetection: ts.ModuleDetectionKind.Force,
|
|
91
|
+
lib: [...TYPE_CHECK_LIBS],
|
|
92
|
+
// No automatic `@types` walk up the tree, so the result does not depend on
|
|
93
|
+
// what the author's folder happens to have installed.
|
|
94
|
+
types: [],
|
|
95
|
+
};
|
|
96
|
+
const shim = join(dirname(file), RUNTIME_GLOBALS_FILE);
|
|
97
|
+
const host = sdkResolvingHost(ts, options);
|
|
98
|
+
const getSourceFile = host.getSourceFile.bind(host);
|
|
99
|
+
host.getSourceFile = (name, language, ...rest) => (name === shim
|
|
100
|
+
? ts.createSourceFile(name, RUNTIME_GLOBALS, language)
|
|
101
|
+
: getSourceFile(name, language, ...rest));
|
|
102
|
+
const fileExists = host.fileExists.bind(host);
|
|
103
|
+
host.fileExists = (name) => name === shim || fileExists(name);
|
|
104
|
+
const program = ts.createProgram([file, shim], options, host);
|
|
105
|
+
const cwd = process.cwd();
|
|
106
|
+
const out = [];
|
|
107
|
+
for (const sf of program.getSourceFiles()) {
|
|
108
|
+
if (sf.isDeclarationFile || sf.fileName.includes('/node_modules/'))
|
|
109
|
+
continue;
|
|
110
|
+
const found = [...program.getSyntacticDiagnostics(sf), ...program.getSemanticDiagnostics(sf)];
|
|
111
|
+
for (const d of found)
|
|
112
|
+
out.push(toDiagnostic(ts, d, cwd));
|
|
113
|
+
}
|
|
114
|
+
// Program-wide ones (a bad option, a missing lib) carry no file; report them too.
|
|
115
|
+
for (const d of program.getGlobalDiagnostics())
|
|
116
|
+
out.push(toDiagnostic(ts, d, cwd));
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
function toDiagnostic(ts, d, cwd) {
|
|
120
|
+
const text = ts.flattenDiagnosticMessageText(d.messageText, '\n ');
|
|
121
|
+
let where;
|
|
122
|
+
if (d.file && d.start !== undefined) {
|
|
123
|
+
const { line, character } = d.file.getLineAndCharacterOfPosition(d.start);
|
|
124
|
+
// Relative when the file is under the working directory, as an author types it; absolute otherwise.
|
|
125
|
+
const rel = relative(cwd, d.file.fileName);
|
|
126
|
+
const shown = rel && !rel.startsWith('..') && !isAbsolute(rel) ? rel : d.file.fileName;
|
|
127
|
+
where = `${shown}:${line + 1}:${character + 1}`;
|
|
128
|
+
}
|
|
129
|
+
const environment = ENVIRONMENT_CODES.has(d.code);
|
|
130
|
+
return {
|
|
131
|
+
level: environment || d.category !== ts.DiagnosticCategory.Error ? 'warning' : 'error',
|
|
132
|
+
code: `TS${d.code}`,
|
|
133
|
+
message: where ? `${where} ${text}` : text,
|
|
134
|
+
...(where ? { where } : {}),
|
|
135
|
+
};
|
|
136
|
+
}
|