@uipath/maestro-builder-sdk 6.96.6 → 6.97.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/README.md +2 -1
- package/dist/bpmn/check-cli.js +8 -4
- package/dist/bpmn/compile-cli.js +4 -3
- package/dist/bpmn/decompile-cli.js +15 -1
- package/dist/bpmn/decompile-pipeline.d.ts +5 -0
- package/dist/bpmn/decompile-pipeline.js +3 -3
- package/dist/bpmn/decompile-stamp.d.ts +13 -0
- package/dist/bpmn/decompile-stamp.js +8 -0
- package/dist/bpmn/decompile.d.ts +17 -4
- package/dist/bpmn/decompile.js +9 -4
- package/dist/bpmn/merge-cli.js +32 -4
- package/dist/bpmn/merge-source.d.ts +2 -0
- package/dist/bpmn/merge-source.js +1 -0
- package/dist/case/check-cli.js +4 -2
- package/dist/case/compile-cli.js +14 -9
- package/dist/case/decompile-cli.d.ts +1 -1
- package/dist/case/decompile-cli.js +12 -2
- package/dist/check-cli.js +12 -6
- package/dist/cli/commands/registry.js +2 -0
- package/dist/compile-cli.js +16 -10
- package/dist/core/agent-sidecar.d.ts +16 -4
- package/dist/core/agent-sidecar.js +20 -7
- package/dist/core/cli-library.d.ts +18 -2
- package/dist/core/cli-library.js +25 -5
- package/dist/core/library.d.ts +74 -2
- package/dist/core/library.js +88 -11
- package/dist/decompile-cli.js +17 -2
- package/dist/decompile-stamp.d.ts +13 -0
- package/dist/decompile-stamp.js +7 -1
- package/dist/emit.js +5 -8
- package/dist/merge-cli.js +51 -1
- package/dist/nodes/agent/flow/check.js +13 -2
- package/dist/registry/curated-overlay.d.ts +11 -0
- package/dist/registry/curated-overlay.js +27 -0
- package/dist/registry/describe-cli.d.ts +3 -0
- package/dist/registry/describe-cli.js +38 -6
- package/dist/registry/fetch/fetch-connectors.d.ts +21 -0
- package/dist/registry/fetch/fetch-connectors.js +84 -0
- package/dist/registry/fetch/fetch-definitions.d.ts +61 -0
- package/dist/registry/fetch/fetch-definitions.js +447 -0
- package/dist/registry/fetch/flow-requests.d.ts +14 -0
- package/dist/registry/fetch/flow-requests.js +81 -0
- package/dist/registry/fetch/with-fetched-definitions.d.ts +46 -0
- package/dist/registry/fetch/with-fetched-definitions.js +211 -0
- package/dist/registry/library-build/events.d.ts +9 -2
- package/dist/registry/library-build/events.js +4 -10
- package/dist/registry/pull-cli.d.ts +9 -0
- package/dist/registry/pull-cli.js +150 -10
- package/dist/registry/search-cli.d.ts +25 -0
- package/dist/registry/search-cli.js +94 -10
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -212,7 +212,8 @@ $ npx flow-sdk flow compile Hello -o Hello.flow --json
|
|
|
212
212
|
and `merge` report the `path` they wrote. A verb whose plain output is the
|
|
213
213
|
result itself (`registry search`, `registry path`, `bpmn check --graph`) prints it
|
|
214
214
|
only as that object under `--json`, never a second copy on stderr. `package.json` lists the optional
|
|
215
|
-
surface a caller may probe for in `cliCapabilities` (`json-result`
|
|
215
|
+
surface a caller may probe for in `cliCapabilities` (`json-result`; `fetch-definitions` when a
|
|
216
|
+
connector definition no library carries is fetched through `uip`, so no library has to be pulled).
|
|
216
217
|
|
|
217
218
|
The stable argv grammar is family first: `flow|case|bpmn`, then the SDK verb and
|
|
218
219
|
its documented options. The process exit contract is `0` for success, `1` for
|
package/dist/bpmn/check-cli.js
CHANGED
|
@@ -26,7 +26,8 @@ import { check } from './check.js';
|
|
|
26
26
|
import { sourceTypeDiagnostics } from './source-types.js';
|
|
27
27
|
import { graphModel, renderGraph } from './graph.js';
|
|
28
28
|
import { Bindings } from '../core/bindings.js';
|
|
29
|
-
import { connectorCheckOpts
|
|
29
|
+
import { connectorCheckOpts } from '../core/cli-library.js';
|
|
30
|
+
import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
30
31
|
import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
|
|
31
32
|
import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
32
33
|
import { readCliResources } from '../registry/prepare/resources.js';
|
|
@@ -39,11 +40,11 @@ const VALUE_FLAGS = new Set(['--library', '--connectors-local', '--bindings', '-
|
|
|
39
40
|
* binding name. Silent when there is no library and no bindings.json — `check`
|
|
40
41
|
* stays a pure function of the built model then, as it always was.
|
|
41
42
|
*/
|
|
42
|
-
function bpmnCheckOpts(argv) {
|
|
43
|
+
function bpmnCheckOpts(argv, library) {
|
|
43
44
|
const bindFile = flagValue(argv, '--bindings')
|
|
44
45
|
?? (existsSync('bindings.json') ? 'bindings.json' : undefined);
|
|
45
46
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
46
|
-
return { ...connectorCheckOpts(
|
|
47
|
+
return { ...connectorCheckOpts(library, bindFile ? new Bindings(bindFile) : undefined), ...(resources ? { resources } : {}) };
|
|
47
48
|
}
|
|
48
49
|
function printDiagnostics(diags) {
|
|
49
50
|
for (const d of diags)
|
|
@@ -72,7 +73,10 @@ export async function run(argv) {
|
|
|
72
73
|
let diags;
|
|
73
74
|
try {
|
|
74
75
|
built = await loadBuiltBpmn(file);
|
|
75
|
-
|
|
76
|
+
// A connector operation no layer carries is fetched through `uip` and the check
|
|
77
|
+
// runs again, as `compile` does (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
78
|
+
const loaded = built;
|
|
79
|
+
diags = [...typeDiags, ...(await withFetchedDefinitions(argv, (library) => check(loaded, bpmnCheckOpts(argv, library)), { who: 'check' }))];
|
|
76
80
|
}
|
|
77
81
|
catch (error) {
|
|
78
82
|
// A value of the wrong type usually crashes the build or the check before
|
package/dist/bpmn/compile-cli.js
CHANGED
|
@@ -29,7 +29,7 @@ import { basename, resolve } from 'node:path';
|
|
|
29
29
|
import { resolveBpmnFile, loadBuiltBpmn } from './load.js';
|
|
30
30
|
import { serialize } from './serialize.js';
|
|
31
31
|
import { Bindings } from '../core/bindings.js';
|
|
32
|
-
import {
|
|
32
|
+
import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
33
33
|
import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
|
|
34
34
|
import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
35
35
|
import { defaultBindingsFile, defaultResourcesFile } from '../workdir.js';
|
|
@@ -63,13 +63,14 @@ export async function run(argv) {
|
|
|
63
63
|
// `uip maestro registry prepare` writes. BPMN used to construct the library
|
|
64
64
|
// without it, so a prepare resolved an operation against the live connection,
|
|
65
65
|
// wrote the overlay, and compile ignored it.
|
|
66
|
-
|
|
66
|
+
// A connector operation no layer carries is fetched through `uip` and the
|
|
67
|
+
// serializer runs again (`withFetchedDefinitions`, docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
67
68
|
const bindFile = flagValue(argv, '--bindings') ?? defaultBindingsFile();
|
|
68
69
|
const bindings = new Bindings(bindFile);
|
|
69
70
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
70
71
|
let xml;
|
|
71
72
|
try {
|
|
72
|
-
xml = await serialize(built, { library, bindings, resources });
|
|
73
|
+
xml = await withFetchedDefinitions(argv, (library) => serialize(built, { library, bindings, resources }));
|
|
73
74
|
}
|
|
74
75
|
catch (error) {
|
|
75
76
|
// The serializer cannot write a correct `.bpmn`: a coded refusal, or a throw it
|
|
@@ -45,6 +45,8 @@ import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
|
|
|
45
45
|
import { decompilePipeline } from './decompile-pipeline.js';
|
|
46
46
|
import { sourceDigest, stampSource } from './decompile-stamp.js';
|
|
47
47
|
import { openCliLibrary } from '../core/cli-library.js';
|
|
48
|
+
import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
|
|
49
|
+
import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
|
|
48
50
|
import { BPMN_IMPORT } from '../package-name.js';
|
|
49
51
|
import { fileURLToPath } from 'node:url';
|
|
50
52
|
/**
|
|
@@ -98,8 +100,15 @@ export async function run(argv) {
|
|
|
98
100
|
// The connector lift (`--connectors lift`, the default when a library opens) and
|
|
99
101
|
// the nested lift, each verified before it is written: decompile-pipeline.ts, which
|
|
100
102
|
// `bpmn merge` also runs to derive its baseline from an original.
|
|
101
|
-
const library = connectors === 'lift' ? openCliLibrary(argv) : undefined;
|
|
102
103
|
const sdkEntry = fileURLToPath(new URL('./bpmn-sdk.js', import.meta.url));
|
|
104
|
+
// A connector a task uses and no layer carries is fetched through `uip` first,
|
|
105
|
+
// with its typed module (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md): one probing
|
|
106
|
+
// lift records what it could not identify, then the real one lifts against what
|
|
107
|
+
// the tenant serves. `merge` fetches the same way, so it derives the same source.
|
|
108
|
+
if (connectors === 'lift') {
|
|
109
|
+
await fetchMissedBy(argv, (probe) => decompilePipeline(xml, { importSpecifier, style, keepFlowIds, keepUnusedBindings, sdkEntry, library: probe }), { who: 'decompile' });
|
|
110
|
+
}
|
|
111
|
+
const library = connectors === 'lift' ? openCliLibrary(argv, { always: fetchDefinitionsEnabled() }) : undefined;
|
|
103
112
|
const { source, pruned, connectors: connectorSummary, lifted, fallback } = await decompilePipeline(xml, {
|
|
104
113
|
importSpecifier, style, keepFlowIds, keepUnusedBindings, sdkEntry, ...(library ? { library } : {}),
|
|
105
114
|
});
|
|
@@ -115,6 +124,11 @@ export async function run(argv) {
|
|
|
115
124
|
connectors: library ? 'lift' : 'verbatim',
|
|
116
125
|
keepFlowIds,
|
|
117
126
|
keepUnusedBindings,
|
|
127
|
+
// Tasks kept verbatim because the library could not name them, so `bpmn merge`
|
|
128
|
+
// keeps them verbatim too after the definitions are fetched (decompile-stamp.ts).
|
|
129
|
+
// Every skip whose outcome depends on what the library holds (LiftSkipKind).
|
|
130
|
+
verbatim: (connectorSummary?.verbatim ?? []).filter((v) => v.kind !== undefined).map((v) => v.id).sort(),
|
|
131
|
+
fetch: true,
|
|
118
132
|
}));
|
|
119
133
|
console.log(`decompile: wrote ${out}`);
|
|
120
134
|
if (pruned.length) {
|
|
@@ -25,6 +25,11 @@ export interface DecompilePipelineOptions {
|
|
|
25
25
|
keepUnusedBindings?: boolean;
|
|
26
26
|
/** The connector library; given, connector tasks it can name are lifted to `.connector()`. */
|
|
27
27
|
library?: Library;
|
|
28
|
+
/**
|
|
29
|
+
* Connector tasks to keep verbatim whatever the library now names: the ones
|
|
30
|
+
* the decompile being reproduced could not name (`verbatim=` in its stamp).
|
|
31
|
+
*/
|
|
32
|
+
keepVerbatim?: ReadonlySet<string>;
|
|
28
33
|
/** Absolute path of the `bpmn-sdk.js` the verifications build against. */
|
|
29
34
|
sdkEntry: string;
|
|
30
35
|
}
|
|
@@ -17,7 +17,7 @@ export async function decompilePipeline(xml, opts) {
|
|
|
17
17
|
// then rides into the nested-style passes below, so the flat and nested sources the
|
|
18
18
|
// nested verify compares make the same connector decisions.
|
|
19
19
|
let connectors;
|
|
20
|
-
let verbatimConnectors = new Set();
|
|
20
|
+
let verbatimConnectors = new Set(opts.keepVerbatim ?? []);
|
|
21
21
|
const base0 = {
|
|
22
22
|
importSpecifier: opts.importSpecifier,
|
|
23
23
|
keepUnusedBindings: opts.keepUnusedBindings === true,
|
|
@@ -33,12 +33,12 @@ export async function decompilePipeline(xml, opts) {
|
|
|
33
33
|
if (library && planned && planned.lifted.length > 0) {
|
|
34
34
|
const verdict = await verifyConnectorLifts(xml, planned, sdkEntry, library);
|
|
35
35
|
if (verdict.failed.size > 0) {
|
|
36
|
-
verbatimConnectors = new Set(verdict.failed.keys());
|
|
36
|
+
verbatimConnectors = new Set([...verbatimConnectors, ...verdict.failed.keys()]);
|
|
37
37
|
source = await decompile(xml, { ...base0, verbatimConnectors });
|
|
38
38
|
// The summary from the second pass says "did not verify"; carry the measured reason.
|
|
39
39
|
const second = summary0();
|
|
40
40
|
if (second) {
|
|
41
|
-
second.verbatim = second.verbatim.map((v) => ({
|
|
41
|
+
second.verbatim = second.verbatim.map((v) => ({ ...v, reason: verdict.failed.get(v.id) ?? v.reason }));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -13,6 +13,19 @@ export interface DecompileStamp {
|
|
|
13
13
|
keepFlowIds: boolean;
|
|
14
14
|
/** Decompile was given `--keep-unused-bindings`. */
|
|
15
15
|
keepUnusedBindings: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Connector tasks the lift kept verbatim because no library layer could name
|
|
18
|
+
* them. `bpmn merge` keeps them verbatim again to derive the baseline,
|
|
19
|
+
* whatever has been fetched or prepared for them since.
|
|
20
|
+
*/
|
|
21
|
+
verbatim: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Written by a decompile that records `verbatim` (the `fetch` token). Without
|
|
24
|
+
* it the stamp predates fetching through `uip`, and an empty `verbatim` says
|
|
25
|
+
* nothing: `bpmn merge` then hides every fetched row instead, which is the
|
|
26
|
+
* library such a decompile saw.
|
|
27
|
+
*/
|
|
28
|
+
fetch: boolean;
|
|
16
29
|
}
|
|
17
30
|
/** The stamp line, without a line terminator. */
|
|
18
31
|
export declare function formatStamp(stamp: DecompileStamp): string;
|
|
@@ -51,6 +51,8 @@ export function formatStamp(stamp) {
|
|
|
51
51
|
`connectors=${stamp.connectors}`,
|
|
52
52
|
...(stamp.keepFlowIds ? ['keep-flow-ids'] : []),
|
|
53
53
|
...(stamp.keepUnusedBindings ? ['keep-unused-bindings'] : []),
|
|
54
|
+
...(stamp.verbatim.length > 0 ? [`verbatim=${stamp.verbatim.join(',')}`] : []),
|
|
55
|
+
...(stamp.fetch ? ['fetch'] : []),
|
|
54
56
|
],
|
|
55
57
|
});
|
|
56
58
|
}
|
|
@@ -77,6 +79,8 @@ export function readStamp(source) {
|
|
|
77
79
|
connectors: 'verbatim',
|
|
78
80
|
keepFlowIds: false,
|
|
79
81
|
keepUnusedBindings: false,
|
|
82
|
+
verbatim: [],
|
|
83
|
+
fetch: false,
|
|
80
84
|
};
|
|
81
85
|
const seen = new Set();
|
|
82
86
|
for (const token of read.options) {
|
|
@@ -92,6 +96,10 @@ export function readStamp(source) {
|
|
|
92
96
|
stamp.keepFlowIds = true;
|
|
93
97
|
else if (key === 'keep-unused-bindings' && value === undefined)
|
|
94
98
|
stamp.keepUnusedBindings = true;
|
|
99
|
+
else if (key === 'verbatim' && value)
|
|
100
|
+
stamp.verbatim = value.split(',');
|
|
101
|
+
else if (key === 'fetch' && value === undefined)
|
|
102
|
+
stamp.fetch = true;
|
|
95
103
|
else
|
|
96
104
|
return { error: `unknown option \`${token}\`: ${line}` };
|
|
97
105
|
}
|
package/dist/bpmn/decompile.d.ts
CHANGED
|
@@ -129,15 +129,28 @@ export interface LiftSummary {
|
|
|
129
129
|
/** Whether the top level was written in `.flowMode('sequence')`. */
|
|
130
130
|
sequence: boolean;
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Why a connector task stayed verbatim, for the reasons that depend on what the
|
|
134
|
+
* library holds, so fetching or preparing a definition later changes the
|
|
135
|
+
* decision: `not-in-library`, no layer could name its operation;
|
|
136
|
+
* `library-cannot-resolve`, the operation was named but its entry (or the
|
|
137
|
+
* object asked for) could not be resolved; `field-not-in-library`, an input the
|
|
138
|
+
* entry does not declare. `bpmn decompile` records every such task in its
|
|
139
|
+
* stamp (`verbatim=`).
|
|
140
|
+
*/
|
|
141
|
+
export type LiftSkipKind = 'not-in-library' | 'library-cannot-resolve' | 'field-not-in-library';
|
|
142
|
+
/** A connector task the lift keeps verbatim: why, and its kind when it is one a caller acts on. */
|
|
143
|
+
export interface LiftSkip {
|
|
144
|
+
id: string;
|
|
145
|
+
reason: string;
|
|
146
|
+
kind?: LiftSkipKind;
|
|
147
|
+
}
|
|
132
148
|
/** What the connector lift did on one decompile — see `BpmnDecompileOptions.connectors`. */
|
|
133
149
|
export interface ConnectorLiftSummary {
|
|
134
150
|
/** Element ids written as `.connector()`. */
|
|
135
151
|
lifted: string[];
|
|
136
152
|
/** Connector tasks written verbatim, each with the reason. */
|
|
137
|
-
verbatim:
|
|
138
|
-
id: string;
|
|
139
|
-
reason: string;
|
|
140
|
-
}>;
|
|
153
|
+
verbatim: LiftSkip[];
|
|
141
154
|
/**
|
|
142
155
|
* The source up to the first element — the import, the process call, its metadata,
|
|
143
156
|
* schemas, bindings and variables — so a verifier can compile one lifted call on its
|
package/dist/bpmn/decompile.js
CHANGED
|
@@ -327,6 +327,8 @@ function planConnectorLifts(container, skip) {
|
|
|
327
327
|
const outcome = planConnectorLift(el, payload);
|
|
328
328
|
if (typeof outcome === 'string')
|
|
329
329
|
runLiftSkipped.push({ id: el.id, reason: outcome });
|
|
330
|
+
else if ('reason' in outcome)
|
|
331
|
+
runLiftSkipped.push({ id: el.id, ...outcome });
|
|
330
332
|
else
|
|
331
333
|
runLiftPlans.set(el.id, outcome);
|
|
332
334
|
}
|
|
@@ -390,7 +392,7 @@ function planConnectorLift(el, payload) {
|
|
|
390
392
|
});
|
|
391
393
|
}
|
|
392
394
|
catch (e) {
|
|
393
|
-
return `not in the library: ${e.message}
|
|
395
|
+
return { reason: `not in the library: ${e.message}`, kind: 'not-in-library' };
|
|
394
396
|
}
|
|
395
397
|
const connection = bindingIdOf(ctx.connection);
|
|
396
398
|
if (!connection)
|
|
@@ -406,7 +408,7 @@ function planConnectorLift(el, payload) {
|
|
|
406
408
|
declared = new Set([...params.keys(), ...resolved.fields.map((f) => f.name)]);
|
|
407
409
|
}
|
|
408
410
|
catch (e) {
|
|
409
|
-
return `the library cannot resolve ${identity.key}/${identity.action}: ${e.message}
|
|
411
|
+
return { reason: `the library cannot resolve ${identity.key}/${identity.action}: ${e.message}`, kind: 'library-cannot-resolve' };
|
|
410
412
|
}
|
|
411
413
|
const inputs = {};
|
|
412
414
|
// `.connector()` validates every input against the library, and a field the static
|
|
@@ -415,8 +417,11 @@ function planConnectorLift(el, payload) {
|
|
|
415
417
|
// given for every operation: the registry's own schema flags are not evidence that
|
|
416
418
|
// prepare cannot help (it marks Jira `create-issue` `requiresConnectionForSchema:
|
|
417
419
|
// false`, and `prepare -f` takes that operation from 5 fields to about 20).
|
|
418
|
-
const notInLibrary = (where, k) =>
|
|
419
|
-
|
|
420
|
+
const notInLibrary = (where, k) => ({
|
|
421
|
+
reason: `${where} field "${k}" is not in the library for ${identity.key}/${identity.action} ` +
|
|
422
|
+
'(if it is connection-specific, `registry prepare` loads it; `prepare -f <parent>=<value>` adds the fields a parent value unlocks)',
|
|
423
|
+
kind: 'field-not-in-library',
|
|
424
|
+
});
|
|
420
425
|
const put = (k, v, where) => {
|
|
421
426
|
if (k in inputs)
|
|
422
427
|
return `"${k}" appears both in ${where} and in another row`;
|
package/dist/bpmn/merge-cli.js
CHANGED
|
@@ -49,6 +49,9 @@ import { loadBuiltBpmn } from './load.js';
|
|
|
49
49
|
import { serialize } from './serialize.js';
|
|
50
50
|
import { Bindings } from '../core/bindings.js';
|
|
51
51
|
import { openCliLibrary } from '../core/cli-library.js';
|
|
52
|
+
import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
|
|
53
|
+
import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
|
|
54
|
+
import { FETCHED_PROVENANCE } from '../core/library.js';
|
|
52
55
|
import { readCliResources } from '../registry/prepare/resources.js';
|
|
53
56
|
import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
54
57
|
import { defaultBindingsFile, defaultResourcesFile } from '../workdir.js';
|
|
@@ -74,6 +77,9 @@ function stampedDecompile(stamp, library) {
|
|
|
74
77
|
keepFlowIds: stamp.keepFlowIds,
|
|
75
78
|
keepUnusedBindings: stamp.keepUnusedBindings,
|
|
76
79
|
...(stamp.connectors === 'lift' && library ? { liftLibrary: library } : {}),
|
|
80
|
+
// The tasks that decompile could not name stay verbatim, whatever has been
|
|
81
|
+
// fetched for them since, so the stamped source comes back.
|
|
82
|
+
...(stamp.verbatim.length > 0 ? { keepVerbatim: new Set(stamp.verbatim) } : {}),
|
|
77
83
|
};
|
|
78
84
|
}
|
|
79
85
|
/** Refuse the merge with a coded diagnostic; nothing has been written. */
|
|
@@ -146,13 +152,27 @@ async function compileSides(argv, editedPath, originalPath, original, explicitBa
|
|
|
146
152
|
// `.ts`; this re-executes under --experimental-strip-types where Node needs the flag.
|
|
147
153
|
ensureTypeScriptRuntime();
|
|
148
154
|
// `compile`'s context, shared by both compiles so they differ only by the edit.
|
|
149
|
-
const library = openCliLibrary(argv);
|
|
150
155
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
151
|
-
const
|
|
156
|
+
const base = {
|
|
152
157
|
bindings: new Bindings(flagValue(argv, '--bindings') ?? defaultBindingsFile()),
|
|
153
|
-
...(library ? { library } : {}),
|
|
154
158
|
...(resources ? { resources } : {}),
|
|
155
159
|
};
|
|
160
|
+
// What either side uses and no layer carries is fetched through `uip` first
|
|
161
|
+
// (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md): one probing compile of the edit
|
|
162
|
+
// and derivation of the baseline record it, and both sides then compile against
|
|
163
|
+
// one library, as `decompile` lifted against it.
|
|
164
|
+
// Each side on its own: a refusal in the edit must not keep the baseline's
|
|
165
|
+
// connectors from being found, or the derived baseline differs from the stamp.
|
|
166
|
+
await fetchMissedBy(argv, async (probe) => {
|
|
167
|
+
const probeOpts = { ...base, library: probe };
|
|
168
|
+
const edit = async () => serialize(await loadBuiltBpmn(resolve(editedPath)), probeOpts);
|
|
169
|
+
await Promise.allSettled([
|
|
170
|
+
edit(),
|
|
171
|
+
...(decompiled !== undefined ? [deriveBaseline(original, { serialize: probeOpts, ...stampedDecompile(decompiled, probe) })] : []),
|
|
172
|
+
]);
|
|
173
|
+
}, { who: 'bpmn-merge' });
|
|
174
|
+
const library = openCliLibrary(argv, { always: fetchDefinitionsEnabled() });
|
|
175
|
+
const opts = { ...base, ...(library ? { library } : {}) };
|
|
156
176
|
// Two catches, as `compile` has them, so a broken source fails here exactly as it
|
|
157
177
|
// fails there. While the source loads, only a builder refusal is printed by its code;
|
|
158
178
|
// a syntax error or a missing import propagates with its own code and the JSON
|
|
@@ -175,7 +195,15 @@ async function compileSides(argv, editedPath, originalPath, original, explicitBa
|
|
|
175
195
|
// No stamp options means `--baseline` was given: the baseline is the caller's.
|
|
176
196
|
if (decompiled === undefined)
|
|
177
197
|
return { edited, baseline: explicitBaseline };
|
|
178
|
-
|
|
198
|
+
// A stamp with no `fetch` token predates fetching through `uip`: that decompile
|
|
199
|
+
// saw no fetched row, so the baseline is derived with every one hidden.
|
|
200
|
+
const seen = decompiled.fetch || !library
|
|
201
|
+
? library
|
|
202
|
+
: openCliLibrary(argv, { always: true, hide: (row) => row.provenance === FETCHED_PROVENANCE });
|
|
203
|
+
const derive = {
|
|
204
|
+
serialize: { ...base, ...(seen ? { library: seen } : {}) },
|
|
205
|
+
...stampedDecompile(decompiled, seen),
|
|
206
|
+
};
|
|
179
207
|
let derived;
|
|
180
208
|
try {
|
|
181
209
|
derived = await deriveBaseline(original, derive);
|
|
@@ -58,6 +58,8 @@ export interface SourceMergeOptions {
|
|
|
58
58
|
keepFlowIds?: boolean;
|
|
59
59
|
/** As `bpmn decompile --keep-unused-bindings`. */
|
|
60
60
|
keepUnusedBindings?: boolean;
|
|
61
|
+
/** The tasks the decompile kept verbatim because its library could not name them (its stamp's `verbatim=`). */
|
|
62
|
+
keepVerbatim?: ReadonlySet<string>;
|
|
61
63
|
}
|
|
62
64
|
/** The baseline merge derived from the original. */
|
|
63
65
|
export interface DerivedBaseline {
|
|
@@ -34,6 +34,7 @@ function decompileAs(xml, opts) {
|
|
|
34
34
|
keepFlowIds: opts.keepFlowIds === true,
|
|
35
35
|
keepUnusedBindings: opts.keepUnusedBindings === true,
|
|
36
36
|
sdkEntry: opts.sdkEntry,
|
|
37
|
+
...(opts.keepVerbatim ? { keepVerbatim: opts.keepVerbatim } : {}),
|
|
37
38
|
...(opts.liftLibrary ? { library: opts.liftLibrary } : {}),
|
|
38
39
|
});
|
|
39
40
|
}
|
package/dist/case/check-cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import { reportDiagnostics } from '../cli-result.js';
|
|
|
14
14
|
import { resolveCaseFile, loadBuiltCase } from './load.js';
|
|
15
15
|
import { check } from './check.js';
|
|
16
16
|
import { caseCheckOpts } from './cli-library.js';
|
|
17
|
-
import {
|
|
17
|
+
import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
18
18
|
import { caseCompileTarget } from './compile-cli.js';
|
|
19
19
|
import { runWhenInvokedDirectly } from '../cli-run.js';
|
|
20
20
|
import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
@@ -40,7 +40,9 @@ export async function run(argv) {
|
|
|
40
40
|
// binding-label rules (#1034): `-o` names the plan as it does for compile.
|
|
41
41
|
const { bindings } = caseCompileTarget(argv);
|
|
42
42
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
43
|
-
|
|
43
|
+
// A connector operation no layer carries is fetched through `uip` and the check
|
|
44
|
+
// runs again, as `compile` does (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
45
|
+
const diags = await withFetchedDefinitions(argv, (library) => check(built, { ...caseCheckOpts(library, bindings), ...(resources ? { resources } : {}) }), { who: 'check' });
|
|
44
46
|
reportDiagnostics(diags);
|
|
45
47
|
for (const d of diags)
|
|
46
48
|
console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
|
package/dist/case/compile-cli.js
CHANGED
|
@@ -28,7 +28,7 @@ import { serialize } from './serialize.js';
|
|
|
28
28
|
import { entryPointIO } from './entry-points.js';
|
|
29
29
|
import { Bindings } from '../core/bindings.js';
|
|
30
30
|
import { offlineBindingLabel } from './ids.js';
|
|
31
|
-
import {
|
|
31
|
+
import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
32
32
|
import { defaultBindingsFile, defaultResourcesFile } from '../workdir.js';
|
|
33
33
|
import { readCliResources } from '../registry/prepare/resources.js';
|
|
34
34
|
import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
|
|
@@ -60,8 +60,9 @@ export async function run(argv) {
|
|
|
60
60
|
// fine right after a pull on Flow failed here for no visible reason. The helper
|
|
61
61
|
// also auto-detects the `connectors-local/` overlay `registry prepare` writes,
|
|
62
62
|
// which is what the three copies of these lines used to each decide for itself.
|
|
63
|
-
// `case check` opens it the same way (#1014).
|
|
64
|
-
|
|
63
|
+
// `case check` opens it the same way (#1014). A connector operation no layer
|
|
64
|
+
// carries is fetched through `uip` and the serializer runs again
|
|
65
|
+
// (`withFetchedDefinitions`, docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
65
66
|
const { out, bindings } = caseCompileTarget(argv);
|
|
66
67
|
// The resource ledger `registry prepare` writes, for a `resource()` / `entity()` connector input.
|
|
67
68
|
const ledger = readCliResources(argv, defaultResourcesFile());
|
|
@@ -77,12 +78,16 @@ export async function run(argv) {
|
|
|
77
78
|
// resource key, #1567); they are printed, and reported, as `case check` reports them.
|
|
78
79
|
const warnings = [];
|
|
79
80
|
try {
|
|
80
|
-
caseplan =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
caseplan = await withFetchedDefinitions(argv, (library) => {
|
|
82
|
+
// One pass's warnings: a pass that missed a definition runs again.
|
|
83
|
+
warnings.length = 0;
|
|
84
|
+
return serialize(built, {
|
|
85
|
+
library, bindings, resources: ledger,
|
|
86
|
+
warn: (w) => {
|
|
87
|
+
if (!warnings.some((d) => d.code === w.code && d.message === w.message))
|
|
88
|
+
warnings.push({ level: 'warning', code: w.code, message: w.message });
|
|
89
|
+
},
|
|
90
|
+
});
|
|
86
91
|
});
|
|
87
92
|
}
|
|
88
93
|
catch (error) {
|
|
@@ -6,4 +6,4 @@ import { type CliExitCode } from '../cli-run.js';
|
|
|
6
6
|
* unified CLI that still holds `case decompile …`, so the positional scan would
|
|
7
7
|
* pick up the family word. Errors throw; both callers report and set exit 1.
|
|
8
8
|
*/
|
|
9
|
-
export declare function run(argv: string[]): CliExitCode
|
|
9
|
+
export declare function run(argv: string[]): Promise<CliExitCode>;
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
import { reportResult } from '../cli-result.js';
|
|
29
29
|
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
30
30
|
import { openCliLibrary } from '../core/cli-library.js';
|
|
31
|
+
import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
|
|
32
|
+
import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
|
|
31
33
|
import { resolveLibraryDir } from '../core/library-cache.js';
|
|
32
34
|
import { basename, join, resolve } from 'node:path';
|
|
33
35
|
import { defaultOverlayDir, defaultSourceOut, workDirBeside, workPath, writeSource } from '../workdir.js';
|
|
@@ -53,7 +55,7 @@ function baseName(plan) {
|
|
|
53
55
|
* unified CLI that still holds `case decompile …`, so the positional scan would
|
|
54
56
|
* pick up the family word. Errors throw; both callers report and set exit 1.
|
|
55
57
|
*/
|
|
56
|
-
export function run(argv) {
|
|
58
|
+
export async function run(argv) {
|
|
57
59
|
if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
|
|
58
60
|
console.error('usage: decompile <caseplan.json> [-o Name.case.ts] [--import <specifier>] [--library <dir>] [--connectors-local <dir>] [--best-effort] [--no-pipeline]');
|
|
59
61
|
return 2;
|
|
@@ -71,7 +73,15 @@ export function run(argv) {
|
|
|
71
73
|
const importSpecifier = flagValue(argv, '--import') ?? CASE_IMPORT;
|
|
72
74
|
const bestEffort = argv.includes('--best-effort');
|
|
73
75
|
const run = (library) => decompileWithDiagnostics(plan, { importSpecifier, library, bestEffort });
|
|
74
|
-
|
|
76
|
+
// A connector the plan uses and no layer carries is fetched through `uip`
|
|
77
|
+
// first, with its typed module (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md):
|
|
78
|
+
// one probing decompile records what it could not identify, then the real one
|
|
79
|
+
// runs against what the tenant serves. Only what the tenant does not serve is
|
|
80
|
+
// left for the plan's own description below.
|
|
81
|
+
await fetchMissedBy(argv, (probe) => run(probe), { who: 'case-decompile' });
|
|
82
|
+
// A fetch may have created the overlay: look again, so the pipeline helper records it.
|
|
83
|
+
overlayDir = flagValue(argv, '--connectors-local') ?? defaultOverlayDir();
|
|
84
|
+
const library = openCliLibrary(argv, { always: fetchDefinitionsEnabled() });
|
|
75
85
|
let result;
|
|
76
86
|
if (!library)
|
|
77
87
|
result = run(undefined);
|
package/dist/check-cli.js
CHANGED
|
@@ -20,7 +20,8 @@ import { defaultBindingsFile, defaultResourcesFile } from './workdir.js';
|
|
|
20
20
|
import { readCliResources } from './registry/prepare/resources.js';
|
|
21
21
|
import { resolveFlowFile, loadBuiltFlow } from './load.js';
|
|
22
22
|
import { check, checkCompiled, scopeToEdit } from './check.js';
|
|
23
|
-
import { flowCheckOpts
|
|
23
|
+
import { flowCheckOpts } from './cli-library.js';
|
|
24
|
+
import { withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
24
25
|
import { Bindings } from './bindings.js';
|
|
25
26
|
import { flagValue, flagValues, runWhenInvokedDirectly } from './cli-run.js';
|
|
26
27
|
import { ensureTypeScriptRuntime } from './node-runtime.js';
|
|
@@ -38,9 +39,10 @@ const VALUE_FLAGS = new Set(['--library', '--bindings', '--connectors-local', '-
|
|
|
38
39
|
* empty `where` is correct, or lower a connector step, so it fails open (a
|
|
39
40
|
* warning, or nothing). Given a library, `compile` and `check` make the same
|
|
40
41
|
* call with the facts in hand. `--library` and `--connectors-local` mirror
|
|
41
|
-
* compile-cli's flags and defaults
|
|
42
|
+
* compile-cli's flags and defaults: the library is the one
|
|
43
|
+
* `withFetchedDefinitions` opens for compile.
|
|
42
44
|
*/
|
|
43
|
-
function checkOpts(argv) {
|
|
45
|
+
function checkOpts(argv, library) {
|
|
44
46
|
// The default bindings.json (workdir.ts), exactly as compile-cli finds it — so the
|
|
45
47
|
// own-name refusal compile would raise is reported here first.
|
|
46
48
|
const bindFlag = argv.indexOf('--bindings');
|
|
@@ -51,7 +53,7 @@ function checkOpts(argv) {
|
|
|
51
53
|
// as still owed — telling the author to re-run a `prepare` they already ran.
|
|
52
54
|
// The resource ledger `prepare` writes, the default found as bindings.json is.
|
|
53
55
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
54
|
-
return { ...flowCheckOpts(
|
|
56
|
+
return { ...flowCheckOpts(library, bindings), ...(resources ? { resources } : {}) };
|
|
55
57
|
}
|
|
56
58
|
export async function run(argv) {
|
|
57
59
|
const arg = argv.find((a, i) => !a.startsWith('--') && !VALUE_FLAGS.has(argv[i - 1])) ?? argv[0];
|
|
@@ -69,8 +71,12 @@ export async function run(argv) {
|
|
|
69
71
|
const file = resolveFlowFile(arg);
|
|
70
72
|
ensureTypeScriptRuntime();
|
|
71
73
|
const built = await loadBuiltFlow(file);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
// A connector operation no layer carries is fetched through `uip` and the
|
|
75
|
+
// check runs again, as `compile` does (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
76
|
+
const diags = await withFetchedDefinitions(argv, (library) => {
|
|
77
|
+
const opts = checkOpts(argv, library);
|
|
78
|
+
return baselinePath !== undefined ? checkAgainstBaseline(built, baselinePath, original, opts, flagValues(argv, '--package')) : check(built, opts);
|
|
79
|
+
}, { who: 'check' });
|
|
74
80
|
reportDiagnostics(diags);
|
|
75
81
|
if (diags.length === 0) {
|
|
76
82
|
console.log('✓ no issues');
|
|
@@ -21,6 +21,7 @@ export function registerRegistryCommands(program) {
|
|
|
21
21
|
.option('--library-md <dir>', 'markdown output (default: ./library-md)')
|
|
22
22
|
.option('--connectors <dir>', 'TypeScript descriptor output (default: ./.flow-sdk/connectors)')
|
|
23
23
|
.option('--connector <key>', 'only generate this connector (repeatable; default: whatever the project references)', collect, [])
|
|
24
|
+
.option('--connectors-local <dir>', 'where connectors fetched through uip land when the library cannot be downloaded (default: ./.flow-sdk/connectors-local)')
|
|
24
25
|
.option('--url <url>', 'archive URL to pull from')
|
|
25
26
|
.option('--archive <zip>', 'use a zip already on disk instead of downloading')
|
|
26
27
|
.option('--cache <dir>', 'where downloaded archives are kept')
|
|
@@ -38,6 +39,7 @@ export function registerRegistryCommands(program) {
|
|
|
38
39
|
addValue(argv, '--connectors', options.connectors);
|
|
39
40
|
for (const key of options.connector ?? [])
|
|
40
41
|
argv.push('--connector', key);
|
|
42
|
+
addValue(argv, '--connectors-local', options.connectorsLocal);
|
|
41
43
|
addValue(argv, '--url', options.url);
|
|
42
44
|
addValue(argv, '--archive', options.archive);
|
|
43
45
|
addValue(argv, '--cache', options.cache);
|
package/dist/compile-cli.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* [--no-check]
|
|
9
9
|
*
|
|
10
10
|
* --library defaults to $FLOW_SDK_LIBRARY_JSON; --bindings defaults to
|
|
11
|
-
* .flow-sdk/bindings.json (or a legacy ./bindings.json) when present.
|
|
11
|
+
* .flow-sdk/bindings.json (or a legacy ./bindings.json) when present. A connector
|
|
12
|
+
* operation no library layer carries is fetched through `uip` into connectors-local.
|
|
12
13
|
*
|
|
13
14
|
* `compile` only serializes (docs/CHECK_COMPILE_CONTRACT_DESIGN.md D1, D2). It
|
|
14
15
|
* does not run `check()`'s lint rules: run `flow check` first for those. It
|
|
@@ -29,7 +30,7 @@ import { basename, dirname, join, relative, resolve } from 'node:path';
|
|
|
29
30
|
import { resolveFlowFile, loadBuiltFlow } from './load.js';
|
|
30
31
|
import { serializeWithSidecars } from './serialize.js';
|
|
31
32
|
import { compileOwnsResource } from './core/agent-tool-resources.js';
|
|
32
|
-
import {
|
|
33
|
+
import { withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
33
34
|
import { Bindings } from './bindings.js';
|
|
34
35
|
import { flagValue, runWhenInvokedDirectly } from './cli-run.js';
|
|
35
36
|
import { connectionResources, inlineAgentResources, mergeBindingsV2, projectBindingRows, refreshInlineAgentRows } from './bindings-v2.js';
|
|
@@ -68,11 +69,12 @@ export async function run(argv) {
|
|
|
68
69
|
// shadows the baked library with full, connection-resolved field schemas. See
|
|
69
70
|
// core/library.ts (LibraryOpts.overlayDir). `check-cli` opens it the same way.
|
|
70
71
|
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
72
|
+
// A connector operation no layer carries is fetched through `uip` into the
|
|
73
|
+
// overlay and the serializer runs again (`withFetchedDefinitions`), so the
|
|
74
|
+
// pulled library is an optimization, not a requirement
|
|
75
|
+
// (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md). With the fetch off
|
|
76
|
+
// (FLOW_SDK_FETCH_DEFINITIONS=0) the library is loaded only when it is
|
|
77
|
+
// present, and a connector action with none is LIBRARY_REQUIRED.
|
|
76
78
|
const bindFile = flagValue(argv, '--bindings') ?? defaultBindingsFile();
|
|
77
79
|
const bindings = new Bindings(bindFile);
|
|
78
80
|
// The resource ledger `registry prepare` writes (docs/ENTITY_RESOLUTION_DESIGN.md);
|
|
@@ -152,9 +154,13 @@ export async function run(argv) {
|
|
|
152
154
|
const warnings = [];
|
|
153
155
|
let emitted;
|
|
154
156
|
try {
|
|
155
|
-
emitted =
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
emitted = await withFetchedDefinitions(argv, (library) => {
|
|
158
|
+
// One pass's warnings: a pass that missed a definition runs again.
|
|
159
|
+
warnings.length = 0;
|
|
160
|
+
return serializeWithSidecars(built, {
|
|
161
|
+
library, bindings, warn: (w) => warnings.push(w), resources, agentSource,
|
|
162
|
+
carriedDrafts: (d) => warnings.push(draftWarning(d)),
|
|
163
|
+
});
|
|
158
164
|
});
|
|
159
165
|
}
|
|
160
166
|
catch (error) {
|
|
@@ -168,12 +168,24 @@ export declare function promptPlaceholders(s: {
|
|
|
168
168
|
/** Which writer produced an `agent.json`: the inline, conversational or voice agent's. */
|
|
169
169
|
export type AgentSidecarDialect = 'inline' | 'conversational' | 'voice';
|
|
170
170
|
/**
|
|
171
|
-
* The agent configuration
|
|
171
|
+
* The agent configuration an agent node keeps in its sidecar, read from
|
|
172
172
|
* `<source>/agent.json` in the node's own input names: the prompts, the model,
|
|
173
173
|
* the run settings (`temperature`, `maxTokenPerResponse`, `maxIterations`,
|
|
174
|
-
* `mode`), the `guardrails` and (voice) the `voice` settings. Empty when
|
|
175
|
-
*
|
|
176
|
-
*
|
|
174
|
+
* `mode`), the `guardrails` and (voice) the `voice` settings. Empty when no
|
|
175
|
+
* sidecar can be read. The caller spreads the node's own inputs over this, so
|
|
176
|
+
* a key on the node wins.
|
|
177
|
+
*
|
|
178
|
+
* The sidecar is read for an EMBEDDED node too (one that carries prompts
|
|
179
|
+
* itself, e.g. a `.flow` saved by Studio Web with the self-contained flag on,
|
|
180
|
+
* or a hand-built one): such a node often carries its prompts and no `model`,
|
|
181
|
+
* and the model is then only in `settings.model`. That is how the platform
|
|
182
|
+
* reads it as well: `uip maestro flow validate` and `flow pack` copy each
|
|
183
|
+
* sidecar value onto the node unless the node already has that key
|
|
184
|
+
* (`hydrateAgentNodeInputs`, uipath-cli `packager-tool-flow/src/flow-validation.ts`),
|
|
185
|
+
* and the packaged agent is built from `agent.json`. Skipping the sidecar for
|
|
186
|
+
* such a node decompiled `model: ""`, and compile then wrote `"model": ""`
|
|
187
|
+
* over the sidecar's real model. For an embedded node a missing sidecar is
|
|
188
|
+
* normal (a self-contained `.flow` needs none), so it is not warned about.
|
|
177
189
|
*
|
|
178
190
|
* A run setting equal to the default a sidecar writer fills in (`temperature`
|
|
179
191
|
* 0, `maxTokens` 16384, `mode` `'standard'`) is not recovered: recompiling
|