@uipath/maestro-builder-sdk 6.18.0 → 6.18.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/case/check-cli.js +18 -4
- package/dist/case/check.d.ts +26 -1
- package/dist/case/check.js +80 -2
- package/dist/case/cli-library.d.ts +14 -0
- package/dist/case/cli-library.js +31 -0
- package/dist/case/compile-cli.js +11 -9
- package/dist/cli/commands/case.js +10 -1
- package/package.json +2 -2
package/dist/case/check-cli.js
CHANGED
|
@@ -2,23 +2,37 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* check-cli — fast static validation of <Name>.case.ts (no output file).
|
|
4
4
|
*
|
|
5
|
-
* Usage: node --experimental-strip-types check-cli.js <case.ts | BaseName>
|
|
5
|
+
* Usage: node --experimental-strip-types check-cli.js <case.ts | BaseName> \
|
|
6
|
+
* [--library <library-json dir>] [--connectors-local <overlay dir>]
|
|
6
7
|
* Exits 0 when clean (warnings allowed), 1 on any error.
|
|
8
|
+
*
|
|
9
|
+
* The library is opened exactly as `compile-cli` opens it (`openCliLibrary`), so
|
|
10
|
+
* a connector task `compile` cannot resolve fails here first (#1014).
|
|
7
11
|
*/
|
|
8
12
|
import { reportDiagnostics } from '../cli-result.js';
|
|
9
13
|
import { resolveCaseFile, loadBuiltCase } from './load.js';
|
|
10
14
|
import { check } from './check.js';
|
|
15
|
+
import { caseCheckOpts } from './cli-library.js';
|
|
16
|
+
import { openCliLibrary } from '../core/cli-library.js';
|
|
11
17
|
import { runWhenInvokedDirectly } from '../cli-run.js';
|
|
12
18
|
import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
19
|
+
/** Flags that take a value: their argument is never the source positional. */
|
|
20
|
+
const VALUE_FLAGS = new Set(['--library', '--connectors-local']);
|
|
21
|
+
const USAGE = 'usage: check <case.ts | BaseName> [--library <dir>] [--connectors-local <dir>]';
|
|
13
22
|
export async function run(argv) {
|
|
14
23
|
if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
|
|
15
|
-
console.error(
|
|
24
|
+
console.error(USAGE);
|
|
25
|
+
return 2;
|
|
26
|
+
}
|
|
27
|
+
const input = argv.find((a, i) => !a.startsWith('--') && !VALUE_FLAGS.has(argv[i - 1]));
|
|
28
|
+
if (input === undefined) {
|
|
29
|
+
console.error(USAGE);
|
|
16
30
|
return 2;
|
|
17
31
|
}
|
|
18
|
-
const file = resolveCaseFile(
|
|
32
|
+
const file = resolveCaseFile(input);
|
|
19
33
|
ensureTypeScriptRuntime();
|
|
20
34
|
const built = await loadBuiltCase(file);
|
|
21
|
-
const diags = check(built);
|
|
35
|
+
const diags = check(built, caseCheckOpts(openCliLibrary(argv)));
|
|
22
36
|
reportDiagnostics(diags);
|
|
23
37
|
for (const d of diags)
|
|
24
38
|
console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
|
package/dist/case/check.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* `uip maestro case validate` / `@uipath/case-schema` on the emitted file.
|
|
9
9
|
*/
|
|
10
10
|
import type { BuiltCase } from './case-sdk.js';
|
|
11
|
+
import { type ConnectorCheckOpts } from '../core/connector-checks.js';
|
|
12
|
+
import type { EventCheckOpts } from '../core/event-checks.js';
|
|
11
13
|
export interface Diagnostic {
|
|
12
14
|
level: 'error' | 'warning';
|
|
13
15
|
code: string;
|
|
@@ -15,4 +17,27 @@ export interface Diagnostic {
|
|
|
15
17
|
where?: string;
|
|
16
18
|
suggestion?: string;
|
|
17
19
|
}
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The connector-library facts Case `check` reads, from the same `Library`
|
|
22
|
+
* instance `compile` serializes against (`caseCheckOpts` in `./cli-library.ts`).
|
|
23
|
+
*
|
|
24
|
+
* Deliberately NARROWER than Flow's and BPMN's bag. An error here must be a
|
|
25
|
+
* refusal Case `compile` actually makes, and Case `serialize` resolves the
|
|
26
|
+
* connector operation and the event (`library.resolve` / `resolveEvent`) but does
|
|
27
|
+
* not validate connector inputs, binding labels or BYOA. Those rules stay off
|
|
28
|
+
* until Case compile enforces them; passing them here would refuse sources that
|
|
29
|
+
* compile accepts.
|
|
30
|
+
*
|
|
31
|
+
* Every hook fails open: without a library, `check` stays a pure function of the
|
|
32
|
+
* built model.
|
|
33
|
+
*/
|
|
34
|
+
export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'connectorResolveError' | 'schemaReadiness'> & Pick<EventCheckOpts, 'eventResolveError'>;
|
|
35
|
+
/**
|
|
36
|
+
* Validate a built case.
|
|
37
|
+
*
|
|
38
|
+
* @param built - The case `casePlan(...).build()` returned.
|
|
39
|
+
* @param opts - Connector-library facts (see {@link CaseCheckOpts}); omit them to
|
|
40
|
+
* check only the model itself.
|
|
41
|
+
* @returns Every diagnostic found; any `error` means `compile` refuses the case.
|
|
42
|
+
*/
|
|
43
|
+
export declare function check(built: BuiltCase, opts?: CaseCheckOpts): Diagnostic[];
|
package/dist/case/check.js
CHANGED
|
@@ -2,13 +2,21 @@ import { types } from '../core/expr.js';
|
|
|
2
2
|
import { authoredCaseVersion, CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
|
|
3
3
|
import { schemaVersionRefusal } from '../schema-version.js';
|
|
4
4
|
import { caseJsonPreservation, caseJsonPreservationErrors } from './preserve.js';
|
|
5
|
+
import { EQUALS_EXPR_DIALECT, checkConnectorContract, checkConnectorSchema, } from '../core/connector-checks.js';
|
|
5
6
|
const TYPE_NAMES = new Set(Object.values(types));
|
|
6
7
|
// audit-case-coverage: rule-slot table start
|
|
7
8
|
// This runtime table must equal the committed matrix's rejected cells. The audit
|
|
8
9
|
// parses these object literals; the product-pin matrix currently rejects none.
|
|
9
10
|
const ILLEGAL = [];
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Validate a built case.
|
|
13
|
+
*
|
|
14
|
+
* @param built - The case `casePlan(...).build()` returned.
|
|
15
|
+
* @param opts - Connector-library facts (see {@link CaseCheckOpts}); omit them to
|
|
16
|
+
* check only the model itself.
|
|
17
|
+
* @returns Every diagnostic found; any `error` means `compile` refuses the case.
|
|
18
|
+
*/
|
|
19
|
+
export function check(built, opts = {}) {
|
|
12
20
|
const diags = [];
|
|
13
21
|
for (const message of caseJsonPreservationErrors(caseJsonPreservation(built)))
|
|
14
22
|
diags.push({
|
|
@@ -252,8 +260,78 @@ export function check(built) {
|
|
|
252
260
|
refStage(r, 'case-exit');
|
|
253
261
|
refPlacement(r, 'case-exit', 'case-exit');
|
|
254
262
|
}
|
|
263
|
+
checkLibraryConnectors(built, opts, diags);
|
|
255
264
|
return diags;
|
|
256
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* The connector-library rules (#1014): every place Case `serialize` resolves a
|
|
268
|
+
* connector against the library, checked with the same call and the same text.
|
|
269
|
+
*
|
|
270
|
+
* - a connector task and an External Agent / External Workflow task resolve
|
|
271
|
+
* their operation (`library.resolve`): CONNECTOR_NOT_IN_LIBRARY,
|
|
272
|
+
* CONNECTOR_OBJECT_REQUIRED, CONNECTOR_OBJECT_NOT_GENERIC;
|
|
273
|
+
* - an event trigger, a wait-for-connector task and a wait-for-connector rule
|
|
274
|
+
* resolve their subscription (`library.resolveEvent`): EVENT_UNKNOWN.
|
|
275
|
+
*
|
|
276
|
+
* A connector task also gets the schema-readiness warnings, because the
|
|
277
|
+
* `connectors-local` overlay `registry prepare` writes is what Case compile
|
|
278
|
+
* resolves against too.
|
|
279
|
+
*/
|
|
280
|
+
function checkLibraryConnectors(built, opts, diags) {
|
|
281
|
+
const reporter = (_where, at) => (d) => {
|
|
282
|
+
diags.push({ level: d.level, code: d.code, message: d.message, where: at, ...(d.suggestion ? { suggestion: d.suggestion } : {}) });
|
|
283
|
+
};
|
|
284
|
+
const subscription = (kind, sub, where, at) => {
|
|
285
|
+
// Exactly the arguments `resolvedSubscriptionBag` passes to `resolveEvent`.
|
|
286
|
+
// It passes no `object` (a Case compile gap, tracked separately), so neither
|
|
287
|
+
// does this: check must refuse what compile refuses, no more.
|
|
288
|
+
const unresolved = opts.eventResolveError?.(kind, {
|
|
289
|
+
connector: sub.connector,
|
|
290
|
+
event: sub.event,
|
|
291
|
+
...(sub.version !== undefined ? { version: sub.version } : {}),
|
|
292
|
+
});
|
|
293
|
+
if (unresolved !== undefined)
|
|
294
|
+
diags.push({ level: 'error', code: 'EVENT_UNKNOWN', message: `${where}: ${unresolved}`, where: at });
|
|
295
|
+
};
|
|
296
|
+
const rules = (conditions, where) => {
|
|
297
|
+
for (const c of conditions)
|
|
298
|
+
for (const g of c.rules)
|
|
299
|
+
for (const r of g)
|
|
300
|
+
if (r.rule === 'wait-for-connector' && isSubscription(r.connector))
|
|
301
|
+
subscription('event', r.connector, `wait-for-connector rule in ${where}`, where);
|
|
302
|
+
};
|
|
303
|
+
built.triggers.forEach((t, i) => {
|
|
304
|
+
if (t.kind !== 'event' || !t.eventSubscription)
|
|
305
|
+
return;
|
|
306
|
+
const name = t.name ?? `Trigger ${i + 1}`;
|
|
307
|
+
subscription('trigger', t.eventSubscription, `Event trigger "${name}"`, name);
|
|
308
|
+
});
|
|
309
|
+
for (const stage of built.stages) {
|
|
310
|
+
rules(stage.entry, `stage "${stage.label}" entry`);
|
|
311
|
+
rules(stage.exit, `stage "${stage.label}" exit`);
|
|
312
|
+
for (const t of stage.lanes.flat()) {
|
|
313
|
+
rules(t.entry, `task "${t.name}" entry`);
|
|
314
|
+
if (t.kind === 'connector' && t.connector) {
|
|
315
|
+
const where = `Connector task "${t.name}"`;
|
|
316
|
+
const spec = t.connector;
|
|
317
|
+
checkConnectorSchema(where, spec, opts, EQUALS_EXPR_DIALECT, reporter(where, t.name));
|
|
318
|
+
checkConnectorContract(where, spec, opts, reporter(where, t.name));
|
|
319
|
+
}
|
|
320
|
+
if ((t.kind === 'external-agent' || t.kind === 'external-workflow')
|
|
321
|
+
&& t.external?.connector?.key?.trim() && t.external.connector.action?.trim()) {
|
|
322
|
+
const where = `${t.kind === 'external-agent' ? 'External Agent' : 'External Workflow'} task "${t.name}"`;
|
|
323
|
+
checkConnectorContract(where, t.external.connector, opts, reporter(where, t.name));
|
|
324
|
+
}
|
|
325
|
+
if (t.kind === 'wait-for-connector' && isSubscription(t.waitConnector))
|
|
326
|
+
subscription('event', t.waitConnector, `Wait-for-connector task "${t.name}"`, t.name);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
rules(built.caseExit, 'case exit');
|
|
330
|
+
}
|
|
331
|
+
/** A resolved subscription, not a placeholder; the test `serialize`'s `isResolvedSubscription` makes. */
|
|
332
|
+
function isSubscription(spec) {
|
|
333
|
+
return !!spec && typeof spec === 'object' && 'connector' in spec && 'event' in spec;
|
|
334
|
+
}
|
|
257
335
|
/**
|
|
258
336
|
* SLA guardrails surfaced early: zero at-risk percentages that the engine
|
|
259
337
|
* coerces to 100, empty recipient lists, and deadlines with no escalations.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Library } from '../core/library.js';
|
|
2
|
+
import type { CaseCheckOpts } from './check.js';
|
|
3
|
+
/**
|
|
4
|
+
* Case's check options from a library the CLI already opened, or `{}` without one.
|
|
5
|
+
*
|
|
6
|
+
* Only the hooks for refusals Case `compile` makes (see {@link CaseCheckOpts}):
|
|
7
|
+
* the operation and event resolution, and the schema-readiness warnings. The
|
|
8
|
+
* field-contract, binding-label and BYOA hooks of the shared bag are left out,
|
|
9
|
+
* because Case `serialize` does not enforce them.
|
|
10
|
+
*
|
|
11
|
+
* @param library - The library `openCliLibrary` returned, or `undefined`.
|
|
12
|
+
* @returns The options for Case `check`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function caseCheckOpts(library: Library | undefined): CaseCheckOpts;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* case/cli-library — Case's check options, built from the shared connector hooks.
|
|
3
|
+
*
|
|
4
|
+
* `case check` took no options at all, so a connector task naming an operation
|
|
5
|
+
* the library does not carry passed `check` and failed at `compile` (#1014).
|
|
6
|
+
* Flow and BPMN read their connector facts from `connectorCheckOpts`
|
|
7
|
+
* (`core/cli-library.ts`); Case now does too, through this one builder, which
|
|
8
|
+
* both `case check` and `case compile`'s check pass call.
|
|
9
|
+
*/
|
|
10
|
+
import { connectorCheckOpts } from '../core/cli-library.js';
|
|
11
|
+
/**
|
|
12
|
+
* Case's check options from a library the CLI already opened, or `{}` without one.
|
|
13
|
+
*
|
|
14
|
+
* Only the hooks for refusals Case `compile` makes (see {@link CaseCheckOpts}):
|
|
15
|
+
* the operation and event resolution, and the schema-readiness warnings. The
|
|
16
|
+
* field-contract, binding-label and BYOA hooks of the shared bag are left out,
|
|
17
|
+
* because Case `serialize` does not enforce them.
|
|
18
|
+
*
|
|
19
|
+
* @param library - The library `openCliLibrary` returned, or `undefined`.
|
|
20
|
+
* @returns The options for Case `check`.
|
|
21
|
+
*/
|
|
22
|
+
export function caseCheckOpts(library) {
|
|
23
|
+
if (!library)
|
|
24
|
+
return {};
|
|
25
|
+
const shared = connectorCheckOpts(library);
|
|
26
|
+
return {
|
|
27
|
+
connectorResolveError: shared.connectorResolveError,
|
|
28
|
+
schemaReadiness: shared.schemaReadiness,
|
|
29
|
+
eventResolveError: shared.eventResolveError,
|
|
30
|
+
};
|
|
31
|
+
}
|
package/dist/case/compile-cli.js
CHANGED
|
@@ -16,6 +16,7 @@ import { join, dirname, basename, resolve } from 'node:path';
|
|
|
16
16
|
import { resolveCaseFile, loadBuiltCase } from './load.js';
|
|
17
17
|
import { serialize } from './serialize.js';
|
|
18
18
|
import { check } from './check.js';
|
|
19
|
+
import { caseCheckOpts } from './cli-library.js';
|
|
19
20
|
import { entryPointIO } from './entry-points.js';
|
|
20
21
|
import { Bindings } from '../core/bindings.js';
|
|
21
22
|
import { openCliLibrary } from '../core/cli-library.js';
|
|
@@ -39,7 +40,16 @@ export async function run(argv) {
|
|
|
39
40
|
const file = resolveCaseFile(pos);
|
|
40
41
|
ensureTypeScriptRuntime();
|
|
41
42
|
const built = await loadBuiltCase(file);
|
|
42
|
-
|
|
43
|
+
// Connector tasks resolve against the library; load it only when present, and
|
|
44
|
+
// bindings.json from alongside the case when present. Resolved through the same
|
|
45
|
+
// helper Flow and BPMN use, so `registry pull` serves all three families —
|
|
46
|
+
// reading the env directly skipped the shared cache, and a Case that compiled
|
|
47
|
+
// fine right after a pull on Flow failed here for no visible reason. The helper
|
|
48
|
+
// also auto-detects the `connectors-local/` overlay `registry prepare` writes,
|
|
49
|
+
// which is what the three copies of these lines used to each decide for itself.
|
|
50
|
+
// Opened BEFORE the check pass, which reads the same library (#1014).
|
|
51
|
+
const library = openCliLibrary(argv);
|
|
52
|
+
const diags = check(built, caseCheckOpts(library));
|
|
43
53
|
for (const d of diags)
|
|
44
54
|
console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
|
|
45
55
|
// Reported before serialize, so every exit path carries what stderr printed.
|
|
@@ -49,14 +59,6 @@ export async function run(argv) {
|
|
|
49
59
|
console.error(`compile: ${errors.length} error(s); not emitting.`);
|
|
50
60
|
return 1;
|
|
51
61
|
}
|
|
52
|
-
// Connector tasks resolve against the library; load it only when present, and
|
|
53
|
-
// bindings.json from alongside the case when present. Resolved through the same
|
|
54
|
-
// helper Flow and BPMN use, so `registry pull` serves all three families —
|
|
55
|
-
// reading the env directly skipped the shared cache, and a Case that compiled
|
|
56
|
-
// fine right after a pull on Flow failed here for no visible reason. The helper
|
|
57
|
-
// also auto-detects the `connectors-local/` overlay `registry prepare` writes,
|
|
58
|
-
// which is what the three copies of these lines used to each decide for itself.
|
|
59
|
-
const library = openCliLibrary(argv);
|
|
60
62
|
const bindFile = flagValue(argv, '--bindings') ?? defaultBindingsFile();
|
|
61
63
|
const bindings = new Bindings(bindFile);
|
|
62
64
|
let caseplan;
|
|
@@ -20,6 +20,12 @@ export function registerCaseCommands(program) {
|
|
|
20
20
|
.description('Check authored TypeScript. Check a caseplan.json with `uip maestro case validate`.')
|
|
21
21
|
.argument('<input>', 'a .case.ts path or bare name')
|
|
22
22
|
.option('--source', 'check authored TypeScript')
|
|
23
|
+
// The library and its overlay, as `case compile` takes them: check resolves
|
|
24
|
+
// connector tasks and event subscriptions against the same library (#1014),
|
|
25
|
+
// and an option this parser does not declare is `unknown option` before
|
|
26
|
+
// check-cli sees argv.
|
|
27
|
+
.option('--library <dir>', 'connector library directory')
|
|
28
|
+
.option('--connectors-local <dir>', 'connection-resolved connector overlay')
|
|
23
29
|
.addOption(retiredCompiledOption())
|
|
24
30
|
.action(async (input, options) => {
|
|
25
31
|
let mode;
|
|
@@ -34,7 +40,10 @@ export function registerCaseCommands(program) {
|
|
|
34
40
|
refuse('flow-sdk case check --compiled: use `uip maestro case validate caseplan.json`');
|
|
35
41
|
return;
|
|
36
42
|
}
|
|
37
|
-
|
|
43
|
+
const argv = [input];
|
|
44
|
+
addValue(argv, '--library', options.library);
|
|
45
|
+
addValue(argv, '--connectors-local', options.connectorsLocal);
|
|
46
|
+
await invoke('case check', () => loadTool(import.meta.url, '../../case/check-cli.js'), argv);
|
|
38
47
|
});
|
|
39
48
|
family.command('decompile')
|
|
40
49
|
.description('Convert a caseplan.json to authored TypeScript.')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.18.
|
|
3
|
+
"version": "6.18.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": "6598e64a2bc931298fcb9938dc4868d5760243e6"
|
|
96
96
|
}
|