@uipath/maestro-builder-sdk 6.96.7 → 6.97.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 -1
- package/dist/api-index.md +62 -62
- package/dist/api-members.md +292 -289
- package/dist/bpmn/bpmn-sdk.d.ts +36 -0
- 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 +19 -10
- 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/bpmn/serialize.js +7 -1
- package/dist/bpmn/typed-node.d.ts +7 -0
- package/dist/bpmn/typed-node.js +50 -26
- package/dist/bpmn-api.md +3 -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/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/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/dist/decompile-cli.js
CHANGED
|
@@ -39,7 +39,9 @@ import { PACKAGE_NAME } from './package-name.js';
|
|
|
39
39
|
import { commentText } from './core/comment-text.js';
|
|
40
40
|
import { loadNodePackages } from './node-packages.js';
|
|
41
41
|
import { pipelineFrontDoor } from './registry/uip/pipeline-front-door.js';
|
|
42
|
-
import {
|
|
42
|
+
import { flowConnectorRequests } from './registry/fetch/flow-requests.js';
|
|
43
|
+
import { openWithFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
44
|
+
import { fetchableNodeType } from './registry/fetch/fetch-definitions.js';
|
|
43
45
|
/** Derive a PascalCase base name from the flow name/id for the default output file. */
|
|
44
46
|
function baseName(flow) {
|
|
45
47
|
const src = flow.name ?? flow.id ?? 'Flow';
|
|
@@ -83,15 +85,26 @@ export async function run(argv) {
|
|
|
83
85
|
// for is carried from the file instead of being refused on recompile. Decompile
|
|
84
86
|
// needs no library otherwise: one it cannot read (a corrupt or half-written
|
|
85
87
|
// cache) is a warning, and the source is written with nothing carried.
|
|
88
|
+
//
|
|
89
|
+
// What the file uses and no layer carries is fetched through `uip` first
|
|
90
|
+
// (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md), so the carry decision is made
|
|
91
|
+
// against what the tenant serves: only an operation the tenant does not serve
|
|
92
|
+
// is carried from the file.
|
|
86
93
|
let library;
|
|
87
94
|
try {
|
|
88
|
-
library =
|
|
95
|
+
library = await openWithFetchedDefinitions(argv, flowConnectorRequests(flow), { who: 'flow-decompile' });
|
|
89
96
|
}
|
|
90
97
|
catch (error) {
|
|
91
98
|
console.error(`flow-decompile: warning: connector library unreadable (${error instanceof Error ? error.message : String(error)}); nothing is carried`);
|
|
92
99
|
library = undefined;
|
|
93
100
|
}
|
|
94
101
|
const strict = argv.includes('--strict');
|
|
102
|
+
// What the library lacked as decompile saw it: those operations are carried
|
|
103
|
+
// from the file. Recorded in the stamp, so `flow merge` can hide them again and
|
|
104
|
+
// derive the same source even after they have been fetched (decompile-stamp.ts).
|
|
105
|
+
const lacked = library === undefined ? [] : [...new Set(flowConnectorRequests(flow)
|
|
106
|
+
.map((r) => r.nodeType)
|
|
107
|
+
.filter((nodeType) => !library.indexes(nodeType) && !library.indexes(fetchableNodeType(nodeType))))].sort();
|
|
95
108
|
const ts = decompileFlowFile(pos, flow, {
|
|
96
109
|
importSpecifier: flagValue(argv, '--import') ?? PACKAGE_NAME,
|
|
97
110
|
...(library ? { library } : {}),
|
|
@@ -112,6 +125,8 @@ export async function run(argv) {
|
|
|
112
125
|
scripts,
|
|
113
126
|
strict,
|
|
114
127
|
packages: packages.loaded.map((p) => p.package),
|
|
128
|
+
lacked,
|
|
129
|
+
fetch: true,
|
|
115
130
|
});
|
|
116
131
|
const out = flagValue(argv, '-o') ?? defaultSourceOut(`${baseName(flow)}.flow.ts`);
|
|
117
132
|
writeSource(out, stamped);
|
|
@@ -11,6 +11,19 @@ export interface FlowDecompileStamp {
|
|
|
11
11
|
strict: boolean;
|
|
12
12
|
/** The node-type packages decompile loaded. */
|
|
13
13
|
packages: string[];
|
|
14
|
+
/**
|
|
15
|
+
* The connector node types no library layer held when decompiled, so decompile
|
|
16
|
+
* carried them from the file. `flow merge` hides them again to derive the
|
|
17
|
+
* baseline, whatever has been fetched or prepared for them since.
|
|
18
|
+
*/
|
|
19
|
+
lacked: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Written by a decompile that records `lacked` (the `fetch` token). Without
|
|
22
|
+
* it the stamp predates fetching through `uip`, and an empty `lacked` says
|
|
23
|
+
* nothing: `flow merge` then hides every fetched row instead, which is the
|
|
24
|
+
* library such a decompile saw.
|
|
25
|
+
*/
|
|
26
|
+
fetch: boolean;
|
|
14
27
|
}
|
|
15
28
|
/** The stamp line, without a line terminator. */
|
|
16
29
|
export declare function formatFlowStamp(stamp: FlowDecompileStamp): string;
|
package/dist/decompile-stamp.js
CHANGED
|
@@ -30,6 +30,8 @@ export function formatFlowStamp(stamp) {
|
|
|
30
30
|
`scripts=${stamp.scripts}`,
|
|
31
31
|
...(stamp.strict ? ['strict'] : []),
|
|
32
32
|
...(stamp.packages.length > 0 ? [`packages=${stamp.packages.join(',')}`] : []),
|
|
33
|
+
...(stamp.lacked.length > 0 ? [`lacked=${stamp.lacked.join(',')}`] : []),
|
|
34
|
+
...(stamp.fetch ? ['fetch'] : []),
|
|
33
35
|
],
|
|
34
36
|
});
|
|
35
37
|
}
|
|
@@ -49,7 +51,7 @@ export function readFlowStamp(source) {
|
|
|
49
51
|
if (read === undefined || 'error' in read)
|
|
50
52
|
return read;
|
|
51
53
|
const { line } = read;
|
|
52
|
-
const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [] };
|
|
54
|
+
const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [], lacked: [], fetch: false };
|
|
53
55
|
const seen = new Set();
|
|
54
56
|
for (const token of read.options) {
|
|
55
57
|
const [key, value] = token.split('=', 2);
|
|
@@ -62,6 +64,10 @@ export function readFlowStamp(source) {
|
|
|
62
64
|
stamp.strict = true;
|
|
63
65
|
else if (key === 'packages' && value)
|
|
64
66
|
stamp.packages = value.split(',');
|
|
67
|
+
else if (key === 'lacked' && value)
|
|
68
|
+
stamp.lacked = value.split(',');
|
|
69
|
+
else if (key === 'fetch' && value === undefined)
|
|
70
|
+
stamp.fetch = true;
|
|
65
71
|
else
|
|
66
72
|
return { error: `unknown option \`${token}\`: ${line}` };
|
|
67
73
|
}
|
package/dist/emit.js
CHANGED
|
@@ -26,25 +26,22 @@
|
|
|
26
26
|
* the static pass should call `check()` — or use `compile-cli`.
|
|
27
27
|
*/
|
|
28
28
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
29
|
-
import { dirname
|
|
29
|
+
import { dirname } from 'node:path';
|
|
30
30
|
import { serialize } from './serialize.js';
|
|
31
|
-
import { Library } from './library.js';
|
|
32
31
|
import { Bindings } from './bindings.js';
|
|
33
|
-
import {
|
|
32
|
+
import { openCliLibrary } from './core/cli-library.js';
|
|
34
33
|
import { defaultBindingsFile, defaultResourcesFile } from './workdir.js';
|
|
35
34
|
import { readCliResources } from './registry/prepare/resources.js';
|
|
36
35
|
import { writeJsonFile } from './core/json-file.js';
|
|
37
36
|
/**
|
|
38
|
-
* Resolve the connector library the
|
|
37
|
+
* Resolve the connector library the way `compile-cli` does (`openCliLibrary`),
|
|
38
|
+
* with the `connectors-local` overlay `registry prepare` writes: only load it
|
|
39
39
|
* when it is actually there, so a flow with no connectors emits fine without a
|
|
40
40
|
* built library. A connector action with no library then fails inside
|
|
41
41
|
* `serialize()` with its own clear error.
|
|
42
42
|
*/
|
|
43
43
|
function defaultLibrary(dir) {
|
|
44
|
-
|
|
45
|
-
if (!libDir || !existsSync(join(libDir, 'index.json')))
|
|
46
|
-
return undefined;
|
|
47
|
-
return new Library(libDir);
|
|
44
|
+
return openCliLibrary(dir === undefined ? [] : ['--library', dir]);
|
|
48
45
|
}
|
|
49
46
|
/** The default resource ledger, parsed, when there is one. */
|
|
50
47
|
function defaultResources() {
|
package/dist/merge-cli.js
CHANGED
|
@@ -87,6 +87,10 @@ import { readFlowFile } from './decompile-file.js';
|
|
|
87
87
|
import { readFlowStamp, restampFlowSource, sourceDigest, STAMP_MARKER } from './decompile-stamp.js';
|
|
88
88
|
import { ensureTypeScriptRuntime } from './node-runtime.js';
|
|
89
89
|
import { flowCheckOpts, openCliLibrary } from './cli-library.js';
|
|
90
|
+
import { FETCHED_PROVENANCE } from './core/library.js';
|
|
91
|
+
import { flowConnectorRequests, hidesLacked } from './registry/fetch/flow-requests.js';
|
|
92
|
+
import { fetchDefinitionsEnabled } from './registry/fetch/fetch-definitions.js';
|
|
93
|
+
import { openWithFetchedDefinitions, withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
90
94
|
import { Bindings } from './bindings.js';
|
|
91
95
|
import { defaultBindingsFile } from './workdir.js';
|
|
92
96
|
import { loadNodePackages } from './node-packages.js';
|
|
@@ -276,7 +280,29 @@ export async function run(argv) {
|
|
|
276
280
|
// source; both load TypeScript, so both need the type-stripping runtime.
|
|
277
281
|
if (derivedFrom || editedIsSource)
|
|
278
282
|
ensureTypeScriptRuntime();
|
|
279
|
-
const
|
|
283
|
+
const fetchedLibrary = derivedFrom || editedIsSource ? await mergeLibrary(argv, originalPath, editedIsSource ? resolve(editedPath) : undefined) : undefined;
|
|
284
|
+
// Both sides compile against the library as decompile saw it: the operations
|
|
285
|
+
// its stamp records as lacked (carried from the file) are hidden, whatever has
|
|
286
|
+
// been fetched or prepared for them since. So the baseline gives back the
|
|
287
|
+
// stamped source, and an untouched carried step compiles from what it carries
|
|
288
|
+
// on both sides rather than from the tenant on one (decompile-stamp.ts).
|
|
289
|
+
const lacked = stamp?.lacked ?? [];
|
|
290
|
+
// A stamp from before fetching records no `lacked`: that decompile saw no
|
|
291
|
+
// fetched row at all, so those are what is hidden.
|
|
292
|
+
const preFetch = stamp !== undefined && !stamp.fetch;
|
|
293
|
+
const hide = preFetch
|
|
294
|
+
? (row) => row.provenance === FETCHED_PROVENANCE
|
|
295
|
+
: hidesLacked(lacked);
|
|
296
|
+
const library = (lacked.length > 0 || preFetch) && fetchedLibrary !== undefined
|
|
297
|
+
? openCliLibrary(argv, {
|
|
298
|
+
always: true,
|
|
299
|
+
hide,
|
|
300
|
+
missNote: (nodeType) => (hidesLacked(lacked)({ nodeType })
|
|
301
|
+
? 'This source carries it from the file it was decompiled from; '
|
|
302
|
+
+ 'to compile a step against the tenant’s definition, decompile the original again.'
|
|
303
|
+
: undefined),
|
|
304
|
+
})
|
|
305
|
+
: fetchedLibrary;
|
|
280
306
|
const bindings = derivedFrom || editedIsSource ? new Bindings(flagValue(argv, '--bindings') ?? defaultBindingsFile()) : undefined;
|
|
281
307
|
const compileOpts = { library, bindings };
|
|
282
308
|
// Resolved as decompile resolves it, so a split `.flow` merges as the document the
|
|
@@ -563,3 +589,27 @@ function onNode(r) {
|
|
|
563
589
|
return { nodeId: r.nodeId ?? '', code: r.code, message: r.message };
|
|
564
590
|
}
|
|
565
591
|
runWhenInvokedDirectly(import.meta.url, 'flow-merge', run);
|
|
592
|
+
/**
|
|
593
|
+
* The library merge compiles with, holding every connector definition either
|
|
594
|
+
* side needs (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
595
|
+
*
|
|
596
|
+
* The original's operations are read from the file and fetched through `uip`
|
|
597
|
+
* when no layer carries them, as `flow decompile` fetches them, so the derived
|
|
598
|
+
* baseline is decompiled and compiled against what the tenant serves. An edited
|
|
599
|
+
* `.flow.ts` can name an operation the original did not: one compile of it with
|
|
600
|
+
* a recording library finds those, and they are fetched too. With the fetch off
|
|
601
|
+
* this is `openCliLibrary(argv)`, as before.
|
|
602
|
+
*/
|
|
603
|
+
async function mergeLibrary(argv, originalPath, editedSource) {
|
|
604
|
+
const original = readFlowFile(originalPath);
|
|
605
|
+
// One set of notes for both steps, so the merge's refusal of an operation the
|
|
606
|
+
// edit added still says why it could not be fetched.
|
|
607
|
+
const notes = new Map();
|
|
608
|
+
const library = await openWithFetchedDefinitions(argv, flowConnectorRequests(original), { who: 'flow-merge', notes });
|
|
609
|
+
if (editedSource === undefined || !fetchDefinitionsEnabled())
|
|
610
|
+
return library;
|
|
611
|
+
// A recording pass only, its result discarded: the merge compiles with the
|
|
612
|
+
// library opened after it, which reads whatever it fetched.
|
|
613
|
+
await withFetchedDefinitions(argv, (pass) => compileSourceDraftTolerant(editedSource, { library: pass }), { who: 'flow-merge', notes });
|
|
614
|
+
return openWithFetchedDefinitions(argv, flowConnectorRequests(original), { who: 'flow-merge', notes });
|
|
615
|
+
}
|
|
@@ -105,3 +105,14 @@ export interface CuratedOverlayCheck {
|
|
|
105
105
|
* because readers that load that archive directly apply no overlay.
|
|
106
106
|
*/
|
|
107
107
|
export declare function checkCuratedOverlay(libraryPath: string, overlayPath?: string): Promise<CuratedOverlayCheck>;
|
|
108
|
+
/**
|
|
109
|
+
* The curated overlay's two connection-free contributions to a library that
|
|
110
|
+
* was not pulled: the corrections ledger's patches for the entries `libraryPath`
|
|
111
|
+
* holds, and the side-tables, each copied only when `libraryPath` has none.
|
|
112
|
+
*
|
|
113
|
+
* For a partial library fetched one operation at a time through `uip`
|
|
114
|
+
* (`registry/fetch/`), where {@link applyCuratedOverlay} would be wrong: it also
|
|
115
|
+
* adds every definition this directory carries, and those are fixtures, not
|
|
116
|
+
* operations the tenant was asked about. Returns the corrected entry paths.
|
|
117
|
+
*/
|
|
118
|
+
export declare function applyCorrectionsAndSideTables(libraryPath: string, sideTablesTo: string, overlayPath?: string): Promise<string[]>;
|
|
@@ -444,3 +444,30 @@ export async function checkCuratedOverlay(libraryPath, overlayPath = bundledOver
|
|
|
444
444
|
}
|
|
445
445
|
return { missing, staleCorrections };
|
|
446
446
|
}
|
|
447
|
+
/**
|
|
448
|
+
* The curated overlay's two connection-free contributions to a library that
|
|
449
|
+
* was not pulled: the corrections ledger's patches for the entries `libraryPath`
|
|
450
|
+
* holds, and the side-tables, each copied only when `libraryPath` has none.
|
|
451
|
+
*
|
|
452
|
+
* For a partial library fetched one operation at a time through `uip`
|
|
453
|
+
* (`registry/fetch/`), where {@link applyCuratedOverlay} would be wrong: it also
|
|
454
|
+
* adds every definition this directory carries, and those are fixtures, not
|
|
455
|
+
* operations the tenant was asked about. Returns the corrected entry paths.
|
|
456
|
+
*/
|
|
457
|
+
export async function applyCorrectionsAndSideTables(libraryPath, sideTablesTo, overlayPath = bundledOverlayPath()) {
|
|
458
|
+
const corrected = [];
|
|
459
|
+
for (const correction of await readOverlayCorrections(overlayPath)) {
|
|
460
|
+
if (!(await exists(join(libraryPath, correction.path))))
|
|
461
|
+
continue;
|
|
462
|
+
if ((await patchCorrection(libraryPath, overlayPath, correction)).added.length > 0)
|
|
463
|
+
corrected.push(correction.path);
|
|
464
|
+
}
|
|
465
|
+
for (const table of SIDE_TABLES) {
|
|
466
|
+
const target = join(sideTablesTo, table);
|
|
467
|
+
if (await exists(target))
|
|
468
|
+
continue;
|
|
469
|
+
await mkdir(sideTablesTo, { recursive: true });
|
|
470
|
+
await cp(join(overlayPath, table), target);
|
|
471
|
+
}
|
|
472
|
+
return sortedStrings(corrected);
|
|
473
|
+
}
|
|
@@ -6,5 +6,8 @@
|
|
|
6
6
|
* `connectors-local` overlay first, then the library. So after `registry prepare`
|
|
7
7
|
* it shows the connection's real fields. It is rendered from the entry on each call,
|
|
8
8
|
* so it needs no `library-md` tree and no file the agent must keep a path to.
|
|
9
|
+
*
|
|
10
|
+
* An operation no layer carries is fetched through `uip` into `connectors-local`
|
|
11
|
+
* first, and its page says it came from the tenant.
|
|
9
12
|
*/
|
|
10
13
|
export declare function run(argv: string[]): Promise<number>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { printResult, reportResult } from '../cli-result.js';
|
|
2
2
|
import { flagValue } from '../cli-run.js';
|
|
3
3
|
import { openCliLibrary } from '../core/cli-library.js';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { FETCHED_SOURCE, fetchableNodeType } from './fetch/fetch-definitions.js';
|
|
7
|
+
import { openWithFetchedDefinitions } from './fetch/with-fetched-definitions.js';
|
|
4
8
|
import { PULL_COMMAND } from '../core/cli-spelling.js';
|
|
5
9
|
import { renderMarkdownPage } from './generators/markdown/index.js';
|
|
6
10
|
import { symbolIndex } from './naming.js';
|
|
@@ -12,28 +16,56 @@ import { symbolIndex } from './naming.js';
|
|
|
12
16
|
* `connectors-local` overlay first, then the library. So after `registry prepare`
|
|
13
17
|
* it shows the connection's real fields. It is rendered from the entry on each call,
|
|
14
18
|
* so it needs no `library-md` tree and no file the agent must keep a path to.
|
|
19
|
+
*
|
|
20
|
+
* An operation no layer carries is fetched through `uip` into `connectors-local`
|
|
21
|
+
* first, and its page says it came from the tenant.
|
|
15
22
|
*/
|
|
16
23
|
export async function run(argv) {
|
|
17
24
|
const nodeType = argv[0];
|
|
18
|
-
|
|
25
|
+
// An operation no layer carries is fetched through `uip` first, so a page can
|
|
26
|
+
// be read with no library pulled (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
27
|
+
const library = nodeType && !nodeType.startsWith('-')
|
|
28
|
+
? await openWithFetchedDefinitions(argv, [{ nodeType, ...(flagValue(argv, '--object') ? { objectName: flagValue(argv, '--object') } : {}) }], { who: 'registry describe' })
|
|
29
|
+
: openCliLibrary(argv);
|
|
19
30
|
if (!library) {
|
|
20
31
|
console.error(`No connector library is cached. Run \`${PULL_COMMAND}\`, or pass --library <dir>.`);
|
|
21
32
|
return 2;
|
|
22
33
|
}
|
|
23
34
|
let source;
|
|
35
|
+
let derived = false;
|
|
24
36
|
try {
|
|
25
37
|
source = library.pageSource(nodeType, flagValue(argv, '--connector-version'), flagValue(argv, '--object'));
|
|
26
38
|
}
|
|
27
39
|
catch (error) {
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
// A start trigger is held (and fetched) as its wait form, which the start
|
|
41
|
+
// form is derived from: show that page, and say so.
|
|
42
|
+
const wait = fetchableNodeType(nodeType);
|
|
43
|
+
try {
|
|
44
|
+
if (wait === nodeType)
|
|
45
|
+
throw error;
|
|
46
|
+
source = library.pageSource(wait, flagValue(argv, '--connector-version'), flagValue(argv, '--object'));
|
|
47
|
+
derived = true;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
30
53
|
}
|
|
54
|
+
const fetched = source.entry?.provenance?.source === FETCHED_SOURCE;
|
|
31
55
|
// The symbol names `prepare`'s module exports: it counts GenericExpanded entries only when the overlay has one.
|
|
56
|
+
// A fetched definition has a module only once `registry pull` generated it; without one the page's example uses
|
|
57
|
+
// the string form, so it never imports a module that is not there.
|
|
58
|
+
const key = source.entry?.connector?.key;
|
|
59
|
+
const hasModule = !fetched || (typeof key === 'string' && existsSync(join(source.dir, `${key}.ts`)));
|
|
32
60
|
const expanded = source.prepared && source.rows.some((e) => e?.activityType === 'GenericExpanded');
|
|
33
|
-
const
|
|
61
|
+
const symbols = hasModule ? symbolIndex(source.rows, expanded) : new Map();
|
|
62
|
+
const body = renderMarkdownPage(source.entry, source.v1def, { symbols, invariant: source.invariant });
|
|
34
63
|
// No path: on a browser host it names a store the agent cannot open.
|
|
35
|
-
const origin =
|
|
36
|
-
|
|
64
|
+
const origin = fetched
|
|
65
|
+
? 'the tenant, fetched through uip'
|
|
66
|
+
: source.prepared ? 'the prepared copy from `registry prepare`' : 'the connector library';
|
|
67
|
+
const note = derived ? `\n> ${nodeType} starts a flow; it is derived from this wait-form operation, which it shares its inputs with.` : '';
|
|
68
|
+
const page = `> Source: ${origin}${note}\n\n${body.replace(/\n$/, '')}`;
|
|
37
69
|
// The page alone, so `uip … --output plain` prints just the Markdown.
|
|
38
70
|
reportResult({ page });
|
|
39
71
|
printResult(page);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Reporter } from "../reporter.js";
|
|
2
|
+
import { type UipClient } from "../uip/client.js";
|
|
3
|
+
import { type FetchDefinitionsResult } from "./fetch-definitions.js";
|
|
4
|
+
export interface FetchConnectorsOptions {
|
|
5
|
+
overlayDir: string;
|
|
6
|
+
/** The module specifier the generated `<key>.ts` modules import the SDK by. */
|
|
7
|
+
importSpecifier: string;
|
|
8
|
+
client?: UipClient;
|
|
9
|
+
reporter?: Reporter;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
/** Node types not to fetch: the ones a library layer already holds. */
|
|
12
|
+
skip?: (nodeType: string) => boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface FetchConnectorsResult extends FetchDefinitionsResult {
|
|
15
|
+
/** Connector keys the tenant's catalog lists nothing for, sorted. */
|
|
16
|
+
unlisted: string[];
|
|
17
|
+
/** The typed modules written into the overlay. */
|
|
18
|
+
modules: string[];
|
|
19
|
+
}
|
|
20
|
+
/** Fetch every operation the tenant serves for `keys` into `overlayDir`. */
|
|
21
|
+
export declare function fetchConnectors(keys: readonly string[], options: FetchConnectorsOptions): Promise<FetchConnectorsResult>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `registry pull` for a connector when there is no library to pull it from:
|
|
3
|
+
* every action and event the tenant serves for it, fetched into
|
|
4
|
+
* `connectors-local`, with the typed modules an author imports.
|
|
5
|
+
*
|
|
6
|
+
* The connector's operations are what `uip maestro flow registry search <key>`
|
|
7
|
+
* lists — the tenant's live catalog, which on Automation Suite is the curated
|
|
8
|
+
* one. Each is fetched by {@link fetchDefinitions}, so this writes exactly what
|
|
9
|
+
* a later compile would have fetched on its own, ahead of time, plus the
|
|
10
|
+
* modules (`<key>.ts`) that `registry prepare` writes beside them.
|
|
11
|
+
*/
|
|
12
|
+
import { regenerateDescriptors } from "../prepare/regenerate.js";
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { catalogServesNothing, refreshRegistryCatalog, registryCatalog } from "../prepare/actions.js";
|
|
16
|
+
import { INDEX_FILENAME } from "../prepare/overlay.js";
|
|
17
|
+
import { silentReporter } from "../reporter.js";
|
|
18
|
+
import { defaultUipClient } from "../uip/client.js";
|
|
19
|
+
import { fetchDefinitions, uipUnavailableReason, } from "./fetch-definitions.js";
|
|
20
|
+
/** Fetch every operation the tenant serves for `keys` into `overlayDir`. */
|
|
21
|
+
export async function fetchConnectors(keys, options) {
|
|
22
|
+
const empty = { fetched: [], notServed: [], failed: [], unlisted: [], modules: [] };
|
|
23
|
+
if (keys.length === 0)
|
|
24
|
+
return empty;
|
|
25
|
+
const client = options.client ?? defaultUipClient();
|
|
26
|
+
const reporter = options.reporter ?? silentReporter;
|
|
27
|
+
const unavailable = await uipUnavailableReason(client);
|
|
28
|
+
if (unavailable !== undefined)
|
|
29
|
+
return { ...empty, unavailable };
|
|
30
|
+
const requests = [];
|
|
31
|
+
const unlisted = [];
|
|
32
|
+
const failed = [];
|
|
33
|
+
// `registry search` answers from uip's copy of the tenant catalog, refetched
|
|
34
|
+
// when it is older than 30 minutes or another tenant's. A connector it lists
|
|
35
|
+
// nothing for is believed only after one `registry pull --force`, as
|
|
36
|
+
// `prepare` does; a refresh that fails or is partial makes it a failure.
|
|
37
|
+
let refresh;
|
|
38
|
+
for (const key of [...new Set(keys)].sort()) {
|
|
39
|
+
let catalog = await registryCatalog(client, key, options.timeoutMs);
|
|
40
|
+
if (catalog.failure === undefined && catalogServesNothing(catalog)) {
|
|
41
|
+
refresh ??= await refreshRegistryCatalog(client, options.timeoutMs);
|
|
42
|
+
catalog = await registryCatalog(client, key, options.timeoutMs);
|
|
43
|
+
const doubt = !refresh.ok ? `the catalog refresh failed: ${refresh.reason}` : refresh.partial;
|
|
44
|
+
if (catalogServesNothing(catalog) && doubt !== undefined) {
|
|
45
|
+
failed.push({ nodeType: key, reason: `uip's catalog lists nothing for it, and ${doubt}` });
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (catalog.failure !== undefined) {
|
|
50
|
+
failed.push({ nodeType: key, reason: catalog.failure });
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (catalogServesNothing(catalog)) {
|
|
54
|
+
unlisted.push(key);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const wanted = (nodeType) => !options.skip?.(nodeType);
|
|
58
|
+
for (const action of catalog.actions) {
|
|
59
|
+
const nodeType = `uipath.connector.${key}.${action}`;
|
|
60
|
+
if (wanted(nodeType))
|
|
61
|
+
requests.push({ nodeType });
|
|
62
|
+
}
|
|
63
|
+
// The wait form: what `registry get` serves without a connection, and what
|
|
64
|
+
// the library derives a start trigger from.
|
|
65
|
+
for (const event of catalog.events) {
|
|
66
|
+
const nodeType = `uipath.connector.event.${key}.${event.id}`;
|
|
67
|
+
if (wanted(nodeType))
|
|
68
|
+
requests.push({ nodeType });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const fetched = await fetchDefinitions(requests, {
|
|
72
|
+
overlayDir: options.overlayDir,
|
|
73
|
+
client,
|
|
74
|
+
reporter,
|
|
75
|
+
...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
|
|
76
|
+
});
|
|
77
|
+
// Whenever the overlay holds anything, not only when this call added to it:
|
|
78
|
+
// a module deleted, or an overlay `prepare --json-only` wrote, still gets one,
|
|
79
|
+
// and a changed import specifier applies.
|
|
80
|
+
const modules = existsSync(join(options.overlayDir, INDEX_FILENAME))
|
|
81
|
+
? regenerateDescriptors(options.overlayDir, options.importSpecifier)
|
|
82
|
+
: [];
|
|
83
|
+
return { ...fetched, failed: [...failed, ...fetched.failed], unlisted, modules };
|
|
84
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Reporter } from "../reporter.js";
|
|
2
|
+
import { type UipClient } from "../uip/client.js";
|
|
3
|
+
/** The provenance every fetched entry carries. */
|
|
4
|
+
export declare const FETCHED_SOURCE = "uip-fetch";
|
|
5
|
+
/** Set `FLOW_SDK_FETCH_DEFINITIONS=0` to never call `uip` for a missing definition. */
|
|
6
|
+
export declare const FETCH_DEFINITIONS_ENV = "FLOW_SDK_FETCH_DEFINITIONS";
|
|
7
|
+
/** Whether a missing definition may be fetched through `uip` in this process. */
|
|
8
|
+
export declare function fetchDefinitionsEnabled(env?: Record<string, string | undefined>): boolean;
|
|
9
|
+
/** One node type to fetch, as `Library`'s `onMiss` reports it. */
|
|
10
|
+
export interface DefinitionRequest {
|
|
11
|
+
nodeType: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
objectName?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FetchDefinitionsOptions {
|
|
16
|
+
/** The `connectors-local` directory to merge into; created when missing. */
|
|
17
|
+
overlayDir: string;
|
|
18
|
+
client?: UipClient;
|
|
19
|
+
reporter?: Reporter;
|
|
20
|
+
/** Parallel `uip` calls. */
|
|
21
|
+
concurrency?: number;
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface FetchDefinitionsResult {
|
|
25
|
+
/** Node types written into the overlay, sorted. */
|
|
26
|
+
fetched: string[];
|
|
27
|
+
/** Node types the tenant answered "not found" for, sorted. */
|
|
28
|
+
notServed: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Why nothing could be asked, when nothing could: `uip` is not installed, or
|
|
31
|
+
* not logged in. Set only when no request reached the tenant.
|
|
32
|
+
*/
|
|
33
|
+
unavailable?: string;
|
|
34
|
+
/** Node types whose fetch failed for another reason, with the reason. */
|
|
35
|
+
failed: Array<{
|
|
36
|
+
nodeType: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The node type to ask the registry for: a start trigger as its wait form.
|
|
42
|
+
* `registry get` refuses the start form without `--connection-id`, and the
|
|
43
|
+
* library derives the start form from the wait form (`Library.resolveEvent`).
|
|
44
|
+
*/
|
|
45
|
+
export declare function fetchableNodeType(nodeType: string): string;
|
|
46
|
+
/** Why `uip` cannot be asked anything, or `undefined` when it is logged in. */
|
|
47
|
+
export declare function uipUnavailableReason(client: UipClient): Promise<string | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Fetch every requested node type the tenant serves into `overlayDir`.
|
|
50
|
+
*
|
|
51
|
+
* Never throws for a tenant answer: a node type the tenant does not serve is
|
|
52
|
+
* `notServed`, any other failure is `failed`, and a `uip` that cannot be asked
|
|
53
|
+
* at all is `unavailable`. The caller turns those into its own refusals.
|
|
54
|
+
*
|
|
55
|
+
* `registry get` answers from `uip`'s local copy of the tenant catalog, so a
|
|
56
|
+
* "not found" is believed only after one `uip maestro flow registry pull
|
|
57
|
+
* --force` and a second probe, as `prepare` does (`prepare/actions.ts`). When
|
|
58
|
+
* that refresh fails, or writes only part of the catalog, a node type still
|
|
59
|
+
* not found is `failed` with the reason, not `notServed`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function fetchDefinitions(requests: readonly DefinitionRequest[], options: FetchDefinitionsOptions): Promise<FetchDefinitionsResult>;
|