@uipath/maestro-builder-sdk 6.105.0 → 6.105.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/bpmn/check-cli.js +2 -2
- package/dist/bpmn/decompile-cli.js +2 -3
- package/dist/bpmn/merge-cli.js +2 -3
- package/dist/case/decompile-cli.js +2 -3
- package/dist/core/cli-library.d.ts +8 -0
- package/dist/core/cli-library.js +17 -3
- package/dist/core/library-cache.d.ts +7 -1
- package/dist/core/library-cache.js +23 -2
- package/dist/core/library.d.ts +1 -1
- package/dist/core/library.js +8 -3
- package/dist/decompile-cli.js +6 -3
- package/dist/decompile-stamp.d.ts +7 -0
- package/dist/decompile-stamp.js +4 -1
- package/dist/merge-cli.js +23 -8
- package/dist/nodes/connector/flow/node-type.js +9 -3
- package/dist/registry/fetch/fetch-connectors.d.ts +8 -0
- package/dist/registry/fetch/fetch-connectors.js +32 -9
- package/dist/registry/fetch/fetch-definitions.d.ts +17 -0
- package/dist/registry/fetch/fetch-definitions.js +54 -9
- package/dist/registry/fetch/flow-requests.d.ts +16 -5
- package/dist/registry/fetch/flow-requests.js +28 -7
- package/dist/registry/fetch/with-fetched-definitions.d.ts +8 -0
- package/dist/registry/fetch/with-fetched-definitions.js +45 -18
- package/dist/registry/prepare/overlay.js +4 -1
- package/dist/registry/pull-cli.d.ts +6 -1
- package/dist/registry/pull-cli.js +33 -6
- package/dist/registry/search-cli.js +29 -4
- package/package.json +2 -2
package/dist/bpmn/check-cli.js
CHANGED
|
@@ -34,7 +34,7 @@ import { sourceTypeDiagnostics } from './source-types.js';
|
|
|
34
34
|
import { graphModel, renderGraph } from './graph.js';
|
|
35
35
|
import { Bindings } from '../core/bindings.js';
|
|
36
36
|
import { connectorCheckOpts, openCliLibrary } from '../core/cli-library.js';
|
|
37
|
-
import {
|
|
37
|
+
import { fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
38
38
|
import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
39
39
|
import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
|
|
40
40
|
import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
@@ -90,7 +90,7 @@ export async function run(argv) {
|
|
|
90
90
|
let baselineBuilt;
|
|
91
91
|
if (original !== undefined) {
|
|
92
92
|
try {
|
|
93
|
-
const library = openCliLibrary(argv, { always:
|
|
93
|
+
const library = openCliLibrary(argv, { always: fetchesDefinitions(argv) });
|
|
94
94
|
baselineBuilt = await buildOriginal(original, {
|
|
95
95
|
...(library ? { library } : {}),
|
|
96
96
|
source: readFileSync(file, 'utf8'),
|
|
@@ -45,8 +45,7 @@ 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 {
|
|
49
|
-
import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
|
|
48
|
+
import { fetchMissedBy, fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
50
49
|
import { BPMN_IMPORT } from '../package-name.js';
|
|
51
50
|
import { fileURLToPath } from 'node:url';
|
|
52
51
|
/**
|
|
@@ -108,7 +107,7 @@ export async function run(argv) {
|
|
|
108
107
|
if (connectors === 'lift') {
|
|
109
108
|
await fetchMissedBy(argv, (probe) => decompilePipeline(xml, { importSpecifier, style, keepFlowIds, keepUnusedBindings, sdkEntry, library: probe }), { who: 'decompile' });
|
|
110
109
|
}
|
|
111
|
-
const library = connectors === 'lift' ? openCliLibrary(argv, { always:
|
|
110
|
+
const library = connectors === 'lift' ? openCliLibrary(argv, { always: fetchesDefinitions(argv) }) : undefined;
|
|
112
111
|
const { source, pruned, connectors: connectorSummary, lifted, fallback } = await decompilePipeline(xml, {
|
|
113
112
|
importSpecifier, style, keepFlowIds, keepUnusedBindings, sdkEntry, ...(library ? { library } : {}),
|
|
114
113
|
});
|
package/dist/bpmn/merge-cli.js
CHANGED
|
@@ -48,8 +48,7 @@ import { loadBuiltBpmn } from './load.js';
|
|
|
48
48
|
import { serialize } from './serialize.js';
|
|
49
49
|
import { Bindings } from '../core/bindings.js';
|
|
50
50
|
import { openCliLibrary } from '../core/cli-library.js';
|
|
51
|
-
import {
|
|
52
|
-
import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
|
|
51
|
+
import { fetchMissedBy, fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
53
52
|
import { FETCHED_PROVENANCE } from '../core/library.js';
|
|
54
53
|
import { readCliResources } from '../registry/prepare/resources.js';
|
|
55
54
|
import { ensureTypeScriptRuntime } from '../node-runtime.js';
|
|
@@ -157,7 +156,7 @@ async function compileSides(argv, editedPath, originalPath, original, explicitBa
|
|
|
157
156
|
...(decompiled !== undefined ? [deriveBaseline(original, { serialize: probeOpts, ...stampedDecompile(decompiled, probe) })] : []),
|
|
158
157
|
]);
|
|
159
158
|
}, { who: 'bpmn-merge' });
|
|
160
|
-
const library = openCliLibrary(argv, { always:
|
|
159
|
+
const library = openCliLibrary(argv, { always: fetchesDefinitions(argv) });
|
|
161
160
|
const opts = { ...base, ...(library ? { library } : {}) };
|
|
162
161
|
// Two catches, as `compile` has them, so a broken source fails here exactly as it
|
|
163
162
|
// fails there. While the source loads, only a builder refusal is printed by its code;
|
|
@@ -28,8 +28,7 @@
|
|
|
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 {
|
|
32
|
-
import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
|
|
31
|
+
import { fetchMissedBy, fetchesDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
33
32
|
import { resolveLibraryDir } from '../core/library-cache.js';
|
|
34
33
|
import { basename, join, resolve } from 'node:path';
|
|
35
34
|
import { defaultOverlayDir, defaultSourceOut, workDirBeside, workPath, writeSource } from '../workdir.js';
|
|
@@ -81,7 +80,7 @@ export async function run(argv) {
|
|
|
81
80
|
await fetchMissedBy(argv, (probe) => run(probe), { who: 'case-decompile' });
|
|
82
81
|
// A fetch may have created the overlay: look again, so the pipeline helper records it.
|
|
83
82
|
overlayDir = flagValue(argv, '--connectors-local') ?? defaultOverlayDir();
|
|
84
|
-
const library = openCliLibrary(argv, { always:
|
|
83
|
+
const library = openCliLibrary(argv, { always: fetchesDefinitions(argv) });
|
|
85
84
|
let result;
|
|
86
85
|
if (!library)
|
|
87
86
|
result = run(undefined);
|
|
@@ -24,6 +24,14 @@ import type { EventCheckOpts } from './event-checks.js';
|
|
|
24
24
|
* environment and the pulled cache) fall back to the overlay alone.
|
|
25
25
|
*/
|
|
26
26
|
export declare function openCliLibrary(argv: readonly string[], opts?: CliLibraryOpts): Library | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Whether this invocation has a pre-cache library: one named by `--library`
|
|
29
|
+
* (even one that is not there, which {@link openCliLibrary} refuses), or a
|
|
30
|
+
* default (the environment, the pulled cache) with an index. Only without one
|
|
31
|
+
* is a missing definition fetched through `uip`: an operation a pulled library
|
|
32
|
+
* lacks is refused as it always was.
|
|
33
|
+
*/
|
|
34
|
+
export declare function hasPulledLibrary(argv: readonly string[]): boolean;
|
|
27
35
|
/** {@link openCliLibrary}'s options: the miss hooks it passes on, and whether to open an empty library. */
|
|
28
36
|
export interface CliLibraryOpts extends Pick<LibraryOpts, 'onMiss' | 'missNote' | 'hide' | 'onConnectorMiss'> {
|
|
29
37
|
always?: boolean;
|
package/dist/core/cli-library.js
CHANGED
|
@@ -43,9 +43,7 @@ import { connectorInputErrors, connectorResourceRefusals } from './connector-inp
|
|
|
43
43
|
* environment and the pulled cache) fall back to the overlay alone.
|
|
44
44
|
*/
|
|
45
45
|
export function openCliLibrary(argv, opts = {}) {
|
|
46
|
-
|
|
47
|
-
const read = defaultReadText();
|
|
48
|
-
const hasIndex = (dir) => dir !== undefined && read(join(dir, 'index.json')) !== undefined;
|
|
46
|
+
const hasIndex = indexReader();
|
|
49
47
|
const named = flagValue(argv, '--library');
|
|
50
48
|
if (named !== undefined && !hasIndex(named))
|
|
51
49
|
return new Library(named, { overlayDir: flagValue(argv, '--connectors-local') ?? defaultOverlayDir() });
|
|
@@ -58,6 +56,22 @@ export function openCliLibrary(argv, opts = {}) {
|
|
|
58
56
|
return new Library(undefined, { overlayDir, ...hooks });
|
|
59
57
|
return always ? new Library(undefined, hooks) : undefined;
|
|
60
58
|
}
|
|
59
|
+
/** Whether `dir` holds a library index. Through the reader, not `existsSync`: a host's reader serves a library that is on no disk. */
|
|
60
|
+
function indexReader() {
|
|
61
|
+
const read = defaultReadText();
|
|
62
|
+
return (dir) => dir !== undefined && read(join(dir, 'index.json')) !== undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether this invocation has a pre-cache library: one named by `--library`
|
|
66
|
+
* (even one that is not there, which {@link openCliLibrary} refuses), or a
|
|
67
|
+
* default (the environment, the pulled cache) with an index. Only without one
|
|
68
|
+
* is a missing definition fetched through `uip`: an operation a pulled library
|
|
69
|
+
* lacks is refused as it always was.
|
|
70
|
+
*/
|
|
71
|
+
export function hasPulledLibrary(argv) {
|
|
72
|
+
const named = flagValue(argv, '--library');
|
|
73
|
+
return named !== undefined || indexReader()(resolveLibraryDir(undefined));
|
|
74
|
+
}
|
|
61
75
|
/**
|
|
62
76
|
* The connector half of a family's check options, from a library the CLI already
|
|
63
77
|
* opened.
|
|
@@ -47,7 +47,13 @@ export declare function resolveCachedMarkdown(root?: string): string | undefined
|
|
|
47
47
|
* The library a command should use: what the caller named, else the environment,
|
|
48
48
|
* else the cache. Every compile entry point resolves through this so `pull` and
|
|
49
49
|
* `compile` cannot disagree about where the library is — they did, and a library
|
|
50
|
-
* written by `pull` was invisible to the SDK's own compile.
|
|
50
|
+
* written by `pull` was invisible to the SDK's own compile. An empty
|
|
51
|
+
* FLOW_SDK_LIBRARY_JSON is unset, not a library at the working directory.
|
|
52
|
+
*
|
|
53
|
+
* An environment value that names no index gives way to a pulled cache, as
|
|
54
|
+
* `registry pull` reads it: otherwise a stale variable would hide a library on
|
|
55
|
+
* disk, and a missing definition would be fetched beside it. With no cache it is
|
|
56
|
+
* returned as before (the overlay alone, or a host's reader, then answers).
|
|
51
57
|
*/
|
|
52
58
|
export declare function resolveLibraryDir(named?: string): string | undefined;
|
|
53
59
|
/** What `current` points at, for reporting. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { defaultReadText } from "./read-text.js";
|
|
4
5
|
/**
|
|
5
6
|
* Where the connector library lives.
|
|
6
7
|
*
|
|
@@ -65,10 +66,30 @@ export function resolveCachedMarkdown(root = libraryCacheRoot()) {
|
|
|
65
66
|
* The library a command should use: what the caller named, else the environment,
|
|
66
67
|
* else the cache. Every compile entry point resolves through this so `pull` and
|
|
67
68
|
* `compile` cannot disagree about where the library is — they did, and a library
|
|
68
|
-
* written by `pull` was invisible to the SDK's own compile.
|
|
69
|
+
* written by `pull` was invisible to the SDK's own compile. An empty
|
|
70
|
+
* FLOW_SDK_LIBRARY_JSON is unset, not a library at the working directory.
|
|
71
|
+
*
|
|
72
|
+
* An environment value that names no index gives way to a pulled cache, as
|
|
73
|
+
* `registry pull` reads it: otherwise a stale variable would hide a library on
|
|
74
|
+
* disk, and a missing definition would be fetched beside it. With no cache it is
|
|
75
|
+
* returned as before (the overlay alone, or a host's reader, then answers).
|
|
69
76
|
*/
|
|
70
77
|
export function resolveLibraryDir(named) {
|
|
71
|
-
|
|
78
|
+
if (named !== undefined)
|
|
79
|
+
return named;
|
|
80
|
+
const env = process.env.FLOW_SDK_LIBRARY_JSON || undefined;
|
|
81
|
+
if (env !== undefined && !hasIndexThroughReader(env))
|
|
82
|
+
return resolveCachedLibrary() ?? env;
|
|
83
|
+
return env ?? resolveCachedLibrary();
|
|
84
|
+
}
|
|
85
|
+
/** Whether `dir` holds an index, through the host's reader when one is set (a library on no disk). */
|
|
86
|
+
function hasIndexThroughReader(dir) {
|
|
87
|
+
try {
|
|
88
|
+
return defaultReadText()(join(dir, "index.json")) !== undefined;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return hasIndex(dir);
|
|
92
|
+
}
|
|
72
93
|
}
|
|
73
94
|
/** What `current` points at, for reporting. */
|
|
74
95
|
export function currentEntrySha(root = libraryCacheRoot()) {
|
package/dist/core/library.d.ts
CHANGED
|
@@ -574,9 +574,9 @@ export declare class Library {
|
|
|
574
574
|
* connection (`objectFromDiscovery`), which only `prepare --object` can fill.
|
|
575
575
|
*/
|
|
576
576
|
private variantMissing;
|
|
577
|
-
/** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
|
|
578
577
|
/** {@link LibraryOpts.onConnectorMiss}, for a wire of `connectorKey` no layer could identify. */
|
|
579
578
|
private noteConnectorMiss;
|
|
579
|
+
/** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
|
|
580
580
|
private carries;
|
|
581
581
|
/** The connector key is in no entry at all. */
|
|
582
582
|
private noConnector;
|
package/dist/core/library.js
CHANGED
|
@@ -25,6 +25,8 @@ export { ConnectorResolveError } from './connector-resolve-error.js';
|
|
|
25
25
|
* as prepared.
|
|
26
26
|
*/
|
|
27
27
|
export const FETCHED_PROVENANCE = 'uip-fetch';
|
|
28
|
+
/** The closing advice of a miss's description, which a caller's `missNote` replaces. */
|
|
29
|
+
const PULL_ADVICE = / If the (?:operation|connector|event) is newer than the library, refresh it with `[^`]+`\./;
|
|
28
30
|
export class Library {
|
|
29
31
|
layers = [];
|
|
30
32
|
/** The LIST-ENVELOPE LEDGER, overlay first so a prepared entry can add a row. */
|
|
@@ -780,9 +782,12 @@ export class Library {
|
|
|
780
782
|
+ `the library index (\`index.json\`), and remember the two namespaces: `
|
|
781
783
|
+ `\`…connector.trigger.…\` starts a flow, \`…connector.event.…\` waits mid-flow.`
|
|
782
784
|
: '';
|
|
785
|
+
// A caller's note says why it is missing (the tenant does not serve it, uip
|
|
786
|
+
// cannot be asked, merge hides it): it replaces the advice to pull, which
|
|
787
|
+
// cannot help there.
|
|
788
|
+
const described = this.describeMiss(nodeType, version, objectName);
|
|
783
789
|
throw new ConnectorResolveError('CONNECTOR_NOT_IN_LIBRARY', `connector not in library: ${nodeType}${version ? '@' + version : ''}.${hint}`
|
|
784
|
-
+
|
|
785
|
-
+ (note ? ` ${note}` : ''));
|
|
790
|
+
+ (note ? `${described.replace(PULL_ADVICE, '')} ${note}` : described));
|
|
786
791
|
}
|
|
787
792
|
/**
|
|
788
793
|
* Turn a lookup miss into something actionable: which operations this connector
|
|
@@ -852,11 +857,11 @@ export class Library {
|
|
|
852
857
|
const wanted = objectName.toLowerCase();
|
|
853
858
|
return !rows.some((row) => typeof row.objectName === 'string' && row.objectName.toLowerCase() === wanted);
|
|
854
859
|
}
|
|
855
|
-
/** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
|
|
856
860
|
/** {@link LibraryOpts.onConnectorMiss}, for a wire of `connectorKey` no layer could identify. */
|
|
857
861
|
noteConnectorMiss(connectorKey) {
|
|
858
862
|
this.onConnectorMiss?.(connectorKey);
|
|
859
863
|
}
|
|
864
|
+
/** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
|
|
860
865
|
carries(nodeType, version) {
|
|
861
866
|
return this.layers.some((l) => l.entries.some((e) => e.nodeType === nodeType && (!version || e.version === version)));
|
|
862
867
|
}
|
package/dist/decompile-cli.js
CHANGED
|
@@ -39,7 +39,7 @@ 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 { flowConnectorRequests } from './registry/fetch/flow-requests.js';
|
|
42
|
+
import { flowConnectorRequests, lackedToken } from './registry/fetch/flow-requests.js';
|
|
43
43
|
import { openWithFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
44
44
|
import { fetchableNodeType } from './registry/fetch/fetch-definitions.js';
|
|
45
45
|
/** Derive a PascalCase base name from the flow name/id for the default output file. */
|
|
@@ -102,9 +102,11 @@ export async function run(argv) {
|
|
|
102
102
|
// What the library lacked as decompile saw it: those operations are carried
|
|
103
103
|
// from the file. Recorded in the stamp, so `flow merge` can hide them again and
|
|
104
104
|
// derive the same source even after they have been fetched (decompile-stamp.ts).
|
|
105
|
+
// Per object: a generic operation held for one object can lack another. With
|
|
106
|
+
// no library at all the stamp says so instead (`no-library`).
|
|
105
107
|
const lacked = library === undefined ? [] : [...new Set(flowConnectorRequests(flow)
|
|
106
|
-
.
|
|
107
|
-
.
|
|
108
|
+
.filter((r) => !library.indexes(r.nodeType, r.objectName) && !library.indexes(fetchableNodeType(r.nodeType), r.objectName))
|
|
109
|
+
.map(lackedToken))].sort();
|
|
108
110
|
const ts = decompileFlowFile(pos, flow, {
|
|
109
111
|
importSpecifier: flagValue(argv, '--import') ?? PACKAGE_NAME,
|
|
110
112
|
...(library ? { library } : {}),
|
|
@@ -127,6 +129,7 @@ export async function run(argv) {
|
|
|
127
129
|
packages: packages.loaded.map((p) => p.package),
|
|
128
130
|
lacked,
|
|
129
131
|
fetch: true,
|
|
132
|
+
noLibrary: library === undefined,
|
|
130
133
|
});
|
|
131
134
|
const out = flagValue(argv, '-o') ?? defaultSourceOut(`${baseName(flow)}.flow.ts`);
|
|
132
135
|
writeSource(out, stamped);
|
|
@@ -24,6 +24,13 @@ export interface FlowDecompileStamp {
|
|
|
24
24
|
* library such a decompile saw.
|
|
25
25
|
*/
|
|
26
26
|
fetch: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The decompile opened no library at all (the `no-library` token): nothing
|
|
29
|
+
* pulled or fetched, and fetching off. Such a decompile writes another source
|
|
30
|
+
* than one whose library lacks an operation, so `flow merge` decompiles the
|
|
31
|
+
* baseline with no library too.
|
|
32
|
+
*/
|
|
33
|
+
noLibrary: boolean;
|
|
27
34
|
}
|
|
28
35
|
/** The stamp line, without a line terminator. */
|
|
29
36
|
export declare function formatFlowStamp(stamp: FlowDecompileStamp): string;
|
package/dist/decompile-stamp.js
CHANGED
|
@@ -32,6 +32,7 @@ export function formatFlowStamp(stamp) {
|
|
|
32
32
|
...(stamp.packages.length > 0 ? [`packages=${stamp.packages.join(',')}`] : []),
|
|
33
33
|
...(stamp.lacked.length > 0 ? [`lacked=${stamp.lacked.join(',')}`] : []),
|
|
34
34
|
...(stamp.fetch ? ['fetch'] : []),
|
|
35
|
+
...(stamp.noLibrary ? ['no-library'] : []),
|
|
35
36
|
],
|
|
36
37
|
});
|
|
37
38
|
}
|
|
@@ -51,7 +52,7 @@ export function readFlowStamp(source) {
|
|
|
51
52
|
if (read === undefined || 'error' in read)
|
|
52
53
|
return read;
|
|
53
54
|
const { line } = read;
|
|
54
|
-
const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [], lacked: [], fetch: false };
|
|
55
|
+
const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [], lacked: [], fetch: false, noLibrary: false };
|
|
55
56
|
const seen = new Set();
|
|
56
57
|
for (const token of read.options) {
|
|
57
58
|
const [key, value] = token.split('=', 2);
|
|
@@ -68,6 +69,8 @@ export function readFlowStamp(source) {
|
|
|
68
69
|
stamp.lacked = value.split(',');
|
|
69
70
|
else if (key === 'fetch' && value === undefined)
|
|
70
71
|
stamp.fetch = true;
|
|
72
|
+
else if (key === 'no-library' && value === undefined)
|
|
73
|
+
stamp.noLibrary = true;
|
|
71
74
|
else
|
|
72
75
|
return { error: `unknown option \`${token}\`: ${line}` };
|
|
73
76
|
}
|
package/dist/merge-cli.js
CHANGED
|
@@ -87,11 +87,12 @@ 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 { hasPulledLibrary } from './core/cli-library.js';
|
|
90
91
|
import { FETCHED_PROVENANCE } from './core/library.js';
|
|
91
92
|
import { readNodeCatalog } from './node-catalog-files.js';
|
|
92
|
-
import { flowConnectorRequests, hidesLacked } from './registry/fetch/flow-requests.js';
|
|
93
|
-
import {
|
|
94
|
-
import { openWithFetchedDefinitions, withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
93
|
+
import { flowConnectorRequests, hidesLacked, lacksNodeType } from './registry/fetch/flow-requests.js';
|
|
94
|
+
import { fetchableNodeType } from './registry/fetch/fetch-definitions.js';
|
|
95
|
+
import { fetchesDefinitions, openWithFetchedDefinitions, withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
95
96
|
import { Bindings } from './bindings.js';
|
|
96
97
|
import { defaultBindingsFile } from './workdir.js';
|
|
97
98
|
import { loadNodePackages } from './node-packages.js';
|
|
@@ -298,7 +299,7 @@ export async function run(argv) {
|
|
|
298
299
|
? openCliLibrary(argv, {
|
|
299
300
|
always: true,
|
|
300
301
|
hide,
|
|
301
|
-
missNote: (nodeType) => (
|
|
302
|
+
missNote: (nodeType) => (lacksNodeType(lacked, nodeType)
|
|
302
303
|
? 'This source carries it from the file it was decompiled from; '
|
|
303
304
|
+ 'to compile a step against the tenant’s definition, decompile the original again.'
|
|
304
305
|
: undefined),
|
|
@@ -347,7 +348,12 @@ export async function run(argv) {
|
|
|
347
348
|
// Decompiled as the stamp records, so the baseline is built from the source the
|
|
348
349
|
// author started from; without a stamp, with decompile's defaults.
|
|
349
350
|
// The library decompile carried connector operations against: the one compile opens.
|
|
350
|
-
|
|
351
|
+
// A decompile that had no library at all is reproduced with none; both sides
|
|
352
|
+
// still compile against `library`.
|
|
353
|
+
const decompileLibrary = stamp?.noLibrary ? undefined : library;
|
|
354
|
+
// `library` is always named, `undefined` included: `baselineFromOriginal` sets the
|
|
355
|
+
// compile library first, and only an explicit key overrides it.
|
|
356
|
+
const decompileOpts = { ...(stamp ? { scripts: stamp.scripts, strict: stamp.strict } : {}), library: decompileLibrary };
|
|
351
357
|
let baselineCompile;
|
|
352
358
|
if (derivedFrom) {
|
|
353
359
|
try {
|
|
@@ -372,7 +378,14 @@ export async function run(argv) {
|
|
|
372
378
|
const packages = stamp.packages.length > 0 ? ', or a node-type package it loads,' : '';
|
|
373
379
|
return refuseMerge('MERGE_ORIGINAL_CHANGED', `${name}${packages} changed since ${basename(editedPath)} was decompiled from ${stamp.file === name ? 'it' : stamp.file}: `
|
|
374
380
|
+ `decompiling it now gives a different source (sha256 ${stamp.sha256} recorded, ${actual} now). `
|
|
375
|
-
+ `Merging would read those changes as the edit's deletions and revert them, so nothing was written.
|
|
381
|
+
+ `Merging would read those changes as the edit's deletions and revert them, so nothing was written. `
|
|
382
|
+
// A stamp from before fetching existed, with no pulled library now: the
|
|
383
|
+
// library that decompile read may be what is gone, not the original.
|
|
384
|
+
+ (preFetch && !hasPulledLibrary(argv)
|
|
385
|
+
? 'This source was decompiled by an SDK that did not fetch through uip, likely against a pulled library that is no longer here: '
|
|
386
|
+
+ 'pass it with --library (or run `uip maestro registry pull`), or decompile the original again. '
|
|
387
|
+
: '')
|
|
388
|
+
+ redoAdvice(derivedFrom));
|
|
376
389
|
}
|
|
377
390
|
}
|
|
378
391
|
const baselineSidecars = baselineCompile?.sidecars;
|
|
@@ -609,10 +622,12 @@ async function mergeLibrary(argv, originalPath, editedSource) {
|
|
|
609
622
|
// edit added still says why it could not be fetched.
|
|
610
623
|
const notes = new Map();
|
|
611
624
|
const library = await openWithFetchedDefinitions(argv, flowConnectorRequests(original), { who: 'flow-merge', notes });
|
|
612
|
-
if (editedSource === undefined || !
|
|
625
|
+
if (editedSource === undefined || !fetchesDefinitions(argv))
|
|
613
626
|
return library;
|
|
614
627
|
// A recording pass only, its result discarded: the merge compiles with the
|
|
615
628
|
// library opened after it, which reads whatever it fetched.
|
|
616
629
|
await withFetchedDefinitions(argv, (pass) => compileSourceDraftTolerant(editedSource, { library: pass, nodeCatalog: readNodeCatalog() }), { who: 'flow-merge', notes });
|
|
617
|
-
|
|
630
|
+
// Opened only: both steps above asked for everything, and asking again for
|
|
631
|
+
// what the tenant does not serve would repeat the uip calls and the notes.
|
|
632
|
+
return openCliLibrary(argv, { always: true, missNote: (nodeType) => notes.get(fetchableNodeType(nodeType)) });
|
|
618
633
|
}
|
|
@@ -425,13 +425,19 @@ const connector10 = {
|
|
|
425
425
|
deserialize: (node, ctx) => liftConnector(node, ctx),
|
|
426
426
|
isDraft: (node, definition) => isConnectorDraft(node, definition),
|
|
427
427
|
// An operation the decompile's library has no entry for is carried from the
|
|
428
|
-
// file, when its saved detail describes one compile can rebuild.
|
|
428
|
+
// file, when its saved detail describes one compile can rebuild. Per object: a
|
|
429
|
+
// generic operation held for another object still lacks this one, as the
|
|
430
|
+
// stamp's `lacked=` records it.
|
|
429
431
|
carriesFromFile: (node, library) => {
|
|
430
432
|
const n = node;
|
|
431
|
-
if (typeof n.type !== 'string' || splitOperation(n.type) === undefined
|
|
433
|
+
if (typeof n.type !== 'string' || splitOperation(n.type) === undefined)
|
|
432
434
|
return false;
|
|
433
435
|
const detail = n.inputs?.detail;
|
|
434
|
-
|
|
436
|
+
if (!detail || typeof detail !== 'object')
|
|
437
|
+
return false;
|
|
438
|
+
if (library.indexes(n.type, liftedObject(detail)))
|
|
439
|
+
return false;
|
|
440
|
+
return carriedOperationOf(detail) !== undefined;
|
|
435
441
|
},
|
|
436
442
|
print: (spec, ctx) => printConnector(spec, ctx),
|
|
437
443
|
check: (spec, ctx) => ctx.connector(spec),
|
|
@@ -8,8 +8,16 @@ export interface FetchConnectorsOptions {
|
|
|
8
8
|
client?: UipClient;
|
|
9
9
|
reporter?: Reporter;
|
|
10
10
|
timeoutMs?: number;
|
|
11
|
+
/** Parallel catalog lookups. */
|
|
12
|
+
concurrency?: number;
|
|
11
13
|
/** Node types not to fetch: the ones a library layer already holds. */
|
|
12
14
|
skip?: (nodeType: string) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Regenerate the typed `<key>.ts` modules (the default, for `pull`). A
|
|
17
|
+
* decompile or merge passes `false`: it names an operation by strings, and must
|
|
18
|
+
* not rewrite a module the author edited or `prepare --import` wrote.
|
|
19
|
+
*/
|
|
20
|
+
modules?: boolean;
|
|
13
21
|
}
|
|
14
22
|
export interface FetchConnectorsResult extends FetchDefinitionsResult {
|
|
15
23
|
/** Connector keys the tenant's catalog lists nothing for, sorted. */
|
|
@@ -16,17 +16,26 @@ import { catalogServesNothing, refreshRegistryCatalog, registryCatalog } from ".
|
|
|
16
16
|
import { INDEX_FILENAME } from "../prepare/overlay.js";
|
|
17
17
|
import { silentReporter } from "../reporter.js";
|
|
18
18
|
import { defaultUipClient } from "../uip/client.js";
|
|
19
|
-
import {
|
|
19
|
+
import { mapConcurrent } from "../concurrency.js";
|
|
20
|
+
import { loginScope } from "../prepare/catalog-absence.js";
|
|
21
|
+
import { loginStatusData } from "../uip/login-status.js";
|
|
22
|
+
import { FETCH_REFRESH_TIMEOUT_MS, FETCH_TIMEOUT_MS, boundedUipClient, fetchDefinitions, readNotServed, rememberNotServedQuietly, uipUnavailableReason, } from "./fetch-definitions.js";
|
|
20
23
|
/** Fetch every operation the tenant serves for `keys` into `overlayDir`. */
|
|
21
24
|
export async function fetchConnectors(keys, options) {
|
|
22
25
|
const empty = { fetched: [], notServed: [], failed: [], unlisted: [], modules: [] };
|
|
23
26
|
if (keys.length === 0)
|
|
24
27
|
return empty;
|
|
25
|
-
const client = options.client ?? defaultUipClient();
|
|
28
|
+
const client = boundedUipClient(options.client ?? defaultUipClient(), options.timeoutMs ?? FETCH_TIMEOUT_MS);
|
|
26
29
|
const reporter = options.reporter ?? silentReporter;
|
|
27
30
|
const unavailable = await uipUnavailableReason(client);
|
|
28
31
|
if (unavailable !== undefined)
|
|
29
32
|
return { ...empty, unavailable };
|
|
33
|
+
// A connector the catalog listed nothing for is remembered as a node type the
|
|
34
|
+
// tenant does not serve is (`.not-served.json`), so a decompile or merge
|
|
35
|
+
// re-run does not search and refresh the catalog for it again.
|
|
36
|
+
const scope = loginScope((await loginStatusData(client)).data);
|
|
37
|
+
const now = Date.now();
|
|
38
|
+
const remembered = readNotServed(options.overlayDir, scope, now);
|
|
30
39
|
const requests = [];
|
|
31
40
|
const unlisted = [];
|
|
32
41
|
const failed = [];
|
|
@@ -34,12 +43,20 @@ export async function fetchConnectors(keys, options) {
|
|
|
34
43
|
// when it is older than 30 minutes or another tenant's. A connector it lists
|
|
35
44
|
// nothing for is believed only after one `registry pull --force`, as
|
|
36
45
|
// `prepare` does; a refresh that fails or is partial makes it a failure.
|
|
46
|
+
// Every key is looked up at once, and the ones listing nothing again after
|
|
47
|
+
// one shared refresh.
|
|
48
|
+
const sorted = [...new Set(keys)].filter((key) => !remembered.has(key)).sort();
|
|
49
|
+
const catalogs = await mapConcurrent(sorted, options.concurrency ?? 4, (key) => registryCatalog(client, key, options.timeoutMs));
|
|
50
|
+
const listsNothing = sorted.filter((_, i) => catalogs[i].failure === undefined && catalogServesNothing(catalogs[i]));
|
|
37
51
|
let refresh;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
if (listsNothing.length > 0) {
|
|
53
|
+
refresh = await refreshRegistryCatalog(client, options.timeoutMs ?? FETCH_REFRESH_TIMEOUT_MS);
|
|
54
|
+
const again = await mapConcurrent(listsNothing, options.concurrency ?? 4, (key) => registryCatalog(client, key, options.timeoutMs));
|
|
55
|
+
listsNothing.forEach((key, i) => { catalogs[sorted.indexOf(key)] = again[i]; });
|
|
56
|
+
}
|
|
57
|
+
for (const [i, key] of sorted.entries()) {
|
|
58
|
+
const catalog = catalogs[i];
|
|
59
|
+
if (refresh !== undefined && listsNothing.includes(key)) {
|
|
43
60
|
const doubt = !refresh.ok ? `the catalog refresh failed: ${refresh.reason}` : refresh.partial;
|
|
44
61
|
if (catalogServesNothing(catalog) && doubt !== undefined) {
|
|
45
62
|
failed.push({ nodeType: key, reason: `uip's catalog lists nothing for it, and ${doubt}` });
|
|
@@ -77,8 +94,14 @@ export async function fetchConnectors(keys, options) {
|
|
|
77
94
|
// Whenever the overlay holds anything, not only when this call added to it:
|
|
78
95
|
// a module deleted, or an overlay `prepare --json-only` wrote, still gets one,
|
|
79
96
|
// and a changed import specifier applies.
|
|
80
|
-
const modules = existsSync(join(options.overlayDir, INDEX_FILENAME))
|
|
97
|
+
const modules = options.modules !== false && existsSync(join(options.overlayDir, INDEX_FILENAME))
|
|
81
98
|
? regenerateDescriptors(options.overlayDir, options.importSpecifier)
|
|
82
99
|
: [];
|
|
83
|
-
|
|
100
|
+
rememberNotServedQuietly(options.overlayDir, scope, unlisted, now);
|
|
101
|
+
return {
|
|
102
|
+
...fetched,
|
|
103
|
+
failed: [...failed, ...fetched.failed],
|
|
104
|
+
unlisted: [...unlisted, ...[...new Set(keys)].filter((key) => remembered.has(key))].sort(),
|
|
105
|
+
modules,
|
|
106
|
+
};
|
|
84
107
|
}
|
|
@@ -19,8 +19,19 @@ export interface FetchDefinitionsOptions {
|
|
|
19
19
|
reporter?: Reporter;
|
|
20
20
|
/** Parallel `uip` calls. */
|
|
21
21
|
concurrency?: number;
|
|
22
|
+
/** Kill each `uip` call after this long; {@link FETCH_TIMEOUT_MS} when unset. */
|
|
22
23
|
timeoutMs?: number;
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* How long one `uip` call may take before the fetch gives up on it. A `uip`
|
|
27
|
+
* waiting on an auth prompt or a dead tenant would otherwise hang the compile
|
|
28
|
+
* that asked, with nothing said. The catalog refresh downloads the whole
|
|
29
|
+
* catalog, so it gets {@link FETCH_REFRESH_TIMEOUT_MS}.
|
|
30
|
+
*/
|
|
31
|
+
export declare const FETCH_TIMEOUT_MS = 60000;
|
|
32
|
+
export declare const FETCH_REFRESH_TIMEOUT_MS = 300000;
|
|
33
|
+
/** `client` with `timeoutMs` for every call that names none. */
|
|
34
|
+
export declare function boundedUipClient(client: UipClient, timeoutMs: number): UipClient;
|
|
24
35
|
export interface FetchDefinitionsResult {
|
|
25
36
|
/** Node types written into the overlay, sorted. */
|
|
26
37
|
fetched: string[];
|
|
@@ -45,6 +56,12 @@ export interface FetchDefinitionsResult {
|
|
|
45
56
|
export declare function fetchableNodeType(nodeType: string): string;
|
|
46
57
|
/** Why `uip` cannot be asked anything, or `undefined` when it is logged in. */
|
|
47
58
|
export declare function uipUnavailableReason(client: UipClient): Promise<string | undefined>;
|
|
59
|
+
/** How long a "the tenant does not serve it" answer is believed without asking again: `uip`'s own catalog lifetime. */
|
|
60
|
+
export declare const NOT_SERVED_TTL_MS: number;
|
|
61
|
+
export declare const NOT_SERVED_FILE = ".not-served.json";
|
|
62
|
+
export declare function readNotServed(overlayDir: string, scope: string | undefined, now: number): Set<string>;
|
|
63
|
+
/** {@link rememberNotServed}, which is only a cache: a write that fails costs a repeated lookup, nothing more. */
|
|
64
|
+
export declare function rememberNotServedQuietly(overlayDir: string, scope: string | undefined, nodeTypes: readonly string[], now: number): void;
|
|
48
65
|
/**
|
|
49
66
|
* Fetch every requested node type the tenant serves into `overlayDir`.
|
|
50
67
|
*
|
|
@@ -62,6 +62,32 @@ export function fetchDefinitionsEnabled(env = process.env) {
|
|
|
62
62
|
const value = env[FETCH_DEFINITIONS_ENV]?.trim().toLowerCase();
|
|
63
63
|
return value !== "0" && value !== "false";
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* How long one `uip` call may take before the fetch gives up on it. A `uip`
|
|
67
|
+
* waiting on an auth prompt or a dead tenant would otherwise hang the compile
|
|
68
|
+
* that asked, with nothing said. The catalog refresh downloads the whole
|
|
69
|
+
* catalog, so it gets {@link FETCH_REFRESH_TIMEOUT_MS}.
|
|
70
|
+
*/
|
|
71
|
+
export const FETCH_TIMEOUT_MS = 60_000;
|
|
72
|
+
export const FETCH_REFRESH_TIMEOUT_MS = 300_000;
|
|
73
|
+
/** `client` with `timeoutMs` for every call that names none. */
|
|
74
|
+
export function boundedUipClient(client, timeoutMs) {
|
|
75
|
+
return new BoundedUipClient(client, timeoutMs);
|
|
76
|
+
}
|
|
77
|
+
class BoundedUipClient {
|
|
78
|
+
inner;
|
|
79
|
+
timeoutMs;
|
|
80
|
+
constructor(inner, timeoutMs) {
|
|
81
|
+
this.inner = inner;
|
|
82
|
+
this.timeoutMs = timeoutMs;
|
|
83
|
+
}
|
|
84
|
+
run(argv, options = {}) {
|
|
85
|
+
return this.inner.run(argv, { ...options, timeoutMs: options.timeoutMs ?? this.timeoutMs });
|
|
86
|
+
}
|
|
87
|
+
close() {
|
|
88
|
+
this.inner.close?.();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
65
91
|
const EVENT_NS = "uipath.connector.event.";
|
|
66
92
|
const TRIGGER_NS = "uipath.connector.trigger.";
|
|
67
93
|
/**
|
|
@@ -72,7 +98,6 @@ const TRIGGER_NS = "uipath.connector.trigger.";
|
|
|
72
98
|
export function fetchableNodeType(nodeType) {
|
|
73
99
|
return nodeType.startsWith(TRIGGER_NS) ? EVENT_NS + nodeType.slice(TRIGGER_NS.length) : nodeType;
|
|
74
100
|
}
|
|
75
|
-
/** The requests grouped by the node type fetched, with the objects asked for (none means every object). */
|
|
76
101
|
/** The versions asked for, by the node type fetched; a request with none asks for whichever the tenant serves. */
|
|
77
102
|
function requestedVersions(requests) {
|
|
78
103
|
const versions = new Map();
|
|
@@ -84,6 +109,7 @@ function requestedVersions(requests) {
|
|
|
84
109
|
}
|
|
85
110
|
return versions;
|
|
86
111
|
}
|
|
112
|
+
/** The requests grouped by the node type fetched, with the objects asked for (none means every object). */
|
|
87
113
|
function groupRequests(requests) {
|
|
88
114
|
const grouped = new Map();
|
|
89
115
|
for (const request of requests) {
|
|
@@ -112,6 +138,8 @@ export async function uipUnavailableReason(client) {
|
|
|
112
138
|
catch (error) {
|
|
113
139
|
return messageOf(error);
|
|
114
140
|
}
|
|
141
|
+
if (status.result.timedOut === true)
|
|
142
|
+
return "`uip login status` did not answer in time (is it waiting on a prompt?)";
|
|
115
143
|
const state = getCI(status.data, "Status");
|
|
116
144
|
if (status.result.code === 0 && typeof state === "string" && /^logged in$/i.test(state.trim()))
|
|
117
145
|
return undefined;
|
|
@@ -227,9 +255,9 @@ function planEach(entries, loadNode, failed) {
|
|
|
227
255
|
}
|
|
228
256
|
}
|
|
229
257
|
/** How long a "the tenant does not serve it" answer is believed without asking again: `uip`'s own catalog lifetime. */
|
|
230
|
-
const NOT_SERVED_TTL_MS = 30 * 60 * 1000;
|
|
231
|
-
const NOT_SERVED_FILE = ".not-served.json";
|
|
232
|
-
function readNotServed(overlayDir, scope, now) {
|
|
258
|
+
export const NOT_SERVED_TTL_MS = 30 * 60 * 1000;
|
|
259
|
+
export const NOT_SERVED_FILE = ".not-served.json";
|
|
260
|
+
export function readNotServed(overlayDir, scope, now) {
|
|
233
261
|
try {
|
|
234
262
|
const memory = JSON.parse(readFileSync(join(overlayDir, NOT_SERVED_FILE), "utf8"));
|
|
235
263
|
if (memory.scope !== scope)
|
|
@@ -257,6 +285,15 @@ function rememberNotServed(overlayDir, scope, nodeTypes, now) {
|
|
|
257
285
|
mkdirSync(overlayDir, { recursive: true });
|
|
258
286
|
writeInsideSync(overlayDir, join(overlayDir, NOT_SERVED_FILE), `${JSON.stringify({ scope, until }, null, 2)}\n`);
|
|
259
287
|
}
|
|
288
|
+
/** {@link rememberNotServed}, which is only a cache: a write that fails costs a repeated lookup, nothing more. */
|
|
289
|
+
export function rememberNotServedQuietly(overlayDir, scope, nodeTypes, now) {
|
|
290
|
+
try {
|
|
291
|
+
rememberNotServed(overlayDir, scope, nodeTypes, now);
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
// Asked again next time.
|
|
295
|
+
}
|
|
296
|
+
}
|
|
260
297
|
/**
|
|
261
298
|
* Fetch every requested node type the tenant serves into `overlayDir`.
|
|
262
299
|
*
|
|
@@ -275,7 +312,7 @@ export async function fetchDefinitions(requests, options) {
|
|
|
275
312
|
const grouped = groupRequests(requests);
|
|
276
313
|
if (grouped.size === 0)
|
|
277
314
|
return result;
|
|
278
|
-
const client = options.client ?? defaultUipClient();
|
|
315
|
+
const client = new BoundedUipClient(options.client ?? defaultUipClient(), options.timeoutMs ?? FETCH_TIMEOUT_MS);
|
|
279
316
|
const reporter = options.reporter ?? silentReporter;
|
|
280
317
|
const unavailable = await uipUnavailableReason(client);
|
|
281
318
|
if (unavailable !== undefined)
|
|
@@ -297,14 +334,13 @@ export async function fetchDefinitions(requests, options) {
|
|
|
297
334
|
caches: { registry: new MemoryResponseCache(), is: new MemoryResponseCache(), connectors: new MemoryResponseCache() },
|
|
298
335
|
reporter: silentReporter,
|
|
299
336
|
concurrency: options.concurrency ?? 4,
|
|
300
|
-
...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
|
|
301
337
|
});
|
|
302
338
|
// 1. The node of every requested node type, with a "not found" checked
|
|
303
339
|
// against a refreshed catalog before it is believed.
|
|
304
340
|
const nodeTypes = [...grouped.keys()].sort();
|
|
305
341
|
const probes = await mapConcurrent(nodeTypes, ctx.concurrency, (nodeType) => probe(ctx, nodeType));
|
|
306
342
|
if (probes.some((p) => "miss" in p && p.miss.notFound)) {
|
|
307
|
-
const refresh = await refreshRegistryCatalog(client, options.timeoutMs);
|
|
343
|
+
const refresh = await refreshRegistryCatalog(client, options.timeoutMs ?? FETCH_REFRESH_TIMEOUT_MS);
|
|
308
344
|
const doubt = !refresh.ok ? `the catalog refresh failed: ${refresh.reason}` : refresh.partial;
|
|
309
345
|
await Promise.all(nodeTypes.map(async (nodeType, i) => {
|
|
310
346
|
const first = probes[i];
|
|
@@ -349,7 +385,7 @@ export async function fetchDefinitions(requests, options) {
|
|
|
349
385
|
entries.push(entry);
|
|
350
386
|
});
|
|
351
387
|
if (entries.length === 0) {
|
|
352
|
-
|
|
388
|
+
rememberNotServedQuietly(options.overlayDir, scope, result.notServed.filter((n) => !remembered.has(n)), now);
|
|
353
389
|
return finish(result);
|
|
354
390
|
}
|
|
355
391
|
// 2–3. Fields, then the connector records the object decisions read.
|
|
@@ -408,6 +444,15 @@ export async function fetchDefinitions(requests, options) {
|
|
|
408
444
|
await applyCorrectionsAndSideTables(staging, options.overlayDir);
|
|
409
445
|
mergeInto(staging, options.overlayDir);
|
|
410
446
|
}
|
|
447
|
+
catch (error) {
|
|
448
|
+
// A full disk or a read-only project: each node type it was writing
|
|
449
|
+
// fails with the reason, rather than the whole fetch throwing.
|
|
450
|
+
for (const nodeType of new Set(rows.map((row) => row.nodeType))) {
|
|
451
|
+
result.failed.push({ nodeType, reason: `could not write to ${options.overlayDir}: ${messageOf(error)}` });
|
|
452
|
+
}
|
|
453
|
+
rememberNotServedQuietly(options.overlayDir, scope, result.notServed.filter((n) => !remembered.has(n)), now);
|
|
454
|
+
return finish(result);
|
|
455
|
+
}
|
|
411
456
|
finally {
|
|
412
457
|
rmSync(staging, { recursive: true, force: true });
|
|
413
458
|
}
|
|
@@ -433,7 +478,7 @@ export async function fetchDefinitions(requests, options) {
|
|
|
433
478
|
}
|
|
434
479
|
}
|
|
435
480
|
}
|
|
436
|
-
|
|
481
|
+
rememberNotServedQuietly(options.overlayDir, scope, result.notServed.filter((n) => !remembered.has(n)), now);
|
|
437
482
|
result.fetched = [...new Set(rows.map((row) => row.nodeType))].sort();
|
|
438
483
|
for (const nodeType of result.fetched)
|
|
439
484
|
reporter.info(`fetched ${nodeType} from the tenant into ${options.overlayDir}`);
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { type DefinitionRequest } from "./fetch-definitions.js";
|
|
2
2
|
/** The connector node types `flow` uses, root and subflows, deduplicated, each with its saved object when it has one. */
|
|
3
3
|
export declare function flowConnectorRequests(flow: unknown): DefinitionRequest[];
|
|
4
|
+
/**
|
|
5
|
+
* A request as its stamp's `lacked=` token: the node type, and `#<object>`
|
|
6
|
+
* (URI-encoded, so `,` and spaces stay inside the token) when it names one. A
|
|
7
|
+
* generic operation decompile held for one object and lacked for another is
|
|
8
|
+
* lacked for that object alone.
|
|
9
|
+
*/
|
|
10
|
+
export declare function lackedToken(request: DefinitionRequest): string;
|
|
4
11
|
/**
|
|
5
12
|
* The `LibraryOpts.hide` predicate that reproduces a decompile's library from
|
|
6
|
-
* its stamp's `lacked=`: every row of
|
|
7
|
-
* the name the fetch writes it as too. A start
|
|
8
|
-
* `uipath.connector.trigger.K.E` is fetched (and
|
|
9
|
-
* `uipath.connector.event.K.E`, from which the
|
|
10
|
-
* so hiding only the trigger name would leave
|
|
13
|
+
* its stamp's `lacked=`: every row of what that decompile lacked (a node type,
|
|
14
|
+
* or one object of it), under the name the fetch writes it as too. A start
|
|
15
|
+
* trigger the `.flow` names as `uipath.connector.trigger.K.E` is fetched (and
|
|
16
|
+
* indexed) as its wait form `uipath.connector.event.K.E`, from which the
|
|
17
|
+
* library derives the start form, so hiding only the trigger name would leave
|
|
18
|
+
* the trigger resolvable.
|
|
11
19
|
*/
|
|
12
20
|
export declare function hidesLacked(lacked: readonly string[]): (row: {
|
|
13
21
|
nodeType?: unknown;
|
|
22
|
+
objectName?: unknown;
|
|
14
23
|
}) => boolean;
|
|
24
|
+
/** Whether `lacked` names `nodeType`, for any object or none. */
|
|
25
|
+
export declare function lacksNodeType(lacked: readonly string[], nodeType: string): boolean;
|
|
@@ -67,15 +67,36 @@ export function flowConnectorRequests(flow) {
|
|
|
67
67
|
}
|
|
68
68
|
return [...requests.values()];
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* A request as its stamp's `lacked=` token: the node type, and `#<object>`
|
|
72
|
+
* (URI-encoded, so `,` and spaces stay inside the token) when it names one. A
|
|
73
|
+
* generic operation decompile held for one object and lacked for another is
|
|
74
|
+
* lacked for that object alone.
|
|
75
|
+
*/
|
|
76
|
+
export function lackedToken(request) {
|
|
77
|
+
return request.objectName ? `${request.nodeType}#${encodeURIComponent(request.objectName)}` : request.nodeType;
|
|
78
|
+
}
|
|
79
|
+
function parseLacked(token) {
|
|
80
|
+
const hash = token.indexOf("#");
|
|
81
|
+
const nodeType = hash < 0 ? token : token.slice(0, hash);
|
|
82
|
+
const nodeTypes = [nodeType, fetchableNodeType(nodeType)];
|
|
83
|
+
return hash < 0 ? { nodeTypes } : { nodeTypes, objectName: decodeURIComponent(token.slice(hash + 1)).toLowerCase() };
|
|
84
|
+
}
|
|
70
85
|
/**
|
|
71
86
|
* The `LibraryOpts.hide` predicate that reproduces a decompile's library from
|
|
72
|
-
* its stamp's `lacked=`: every row of
|
|
73
|
-
* the name the fetch writes it as too. A start
|
|
74
|
-
* `uipath.connector.trigger.K.E` is fetched (and
|
|
75
|
-
* `uipath.connector.event.K.E`, from which the
|
|
76
|
-
* so hiding only the trigger name would leave
|
|
87
|
+
* its stamp's `lacked=`: every row of what that decompile lacked (a node type,
|
|
88
|
+
* or one object of it), under the name the fetch writes it as too. A start
|
|
89
|
+
* trigger the `.flow` names as `uipath.connector.trigger.K.E` is fetched (and
|
|
90
|
+
* indexed) as its wait form `uipath.connector.event.K.E`, from which the
|
|
91
|
+
* library derives the start form, so hiding only the trigger name would leave
|
|
92
|
+
* the trigger resolvable.
|
|
77
93
|
*/
|
|
78
94
|
export function hidesLacked(lacked) {
|
|
79
|
-
const
|
|
80
|
-
return (row) => typeof row.nodeType === "string" &&
|
|
95
|
+
const parsed = lacked.map(parseLacked);
|
|
96
|
+
return (row) => typeof row.nodeType === "string" && parsed.some(({ nodeTypes, objectName }) => nodeTypes.includes(row.nodeType)
|
|
97
|
+
&& (objectName === undefined || (typeof row.objectName === "string" && row.objectName.toLowerCase() === objectName)));
|
|
98
|
+
}
|
|
99
|
+
/** Whether `lacked` names `nodeType`, for any object or none. */
|
|
100
|
+
export function lacksNodeType(lacked, nodeType) {
|
|
101
|
+
return lacked.some((token) => parseLacked(token).nodeTypes.includes(nodeType));
|
|
81
102
|
}
|
|
@@ -14,6 +14,12 @@ export interface WithFetchedDefinitionsOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
notes?: Map<string, string>;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Whether this invocation fetches a missing definition through `uip`: fetching
|
|
19
|
+
* is on, and no pre-cache library was pulled or named. The published library is
|
|
20
|
+
* the catalog when there is one; a typo against it is refused, not looked up.
|
|
21
|
+
*/
|
|
22
|
+
export declare function fetchesDefinitions(argv: readonly string[]): boolean;
|
|
17
23
|
/** The overlay a fetch writes into: the one the library opens, else `.flow-sdk/connectors-local`. */
|
|
18
24
|
export declare function fetchOverlayDir(argv: readonly string[]): string;
|
|
19
25
|
/**
|
|
@@ -44,3 +50,5 @@ export declare function openWithFetchedDefinitions(argv: readonly string[], requ
|
|
|
44
50
|
* not be fetched is a warning; the caller's own refusal says the rest.
|
|
45
51
|
*/
|
|
46
52
|
export declare function fetchMissedBy(argv: readonly string[], probe: (library: Library) => unknown, options?: WithFetchedDefinitionsOptions): Promise<void>;
|
|
53
|
+
/** Why a node type is missing when the tenant does not serve it, and how to ask again before the answer expires. */
|
|
54
|
+
export declare function notServedNote(overlayDir: string): string;
|
|
@@ -14,16 +14,19 @@
|
|
|
14
14
|
* The last pass's library carries a `missNote` for what is still missing, so
|
|
15
15
|
* the refusal says why: the tenant does not serve it, or `uip` cannot be asked.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Only with no pulled library (`fetchesDefinitions`): an operation a pulled
|
|
18
|
+
* library lacks is refused, not fetched. With one, or with
|
|
19
|
+
* `FLOW_SDK_FETCH_DEFINITIONS=0`, nothing is fetched and the library is opened
|
|
20
|
+
* exactly as `openCliLibrary(argv)` opens it.
|
|
19
21
|
*/
|
|
20
|
-
import { openCliLibrary } from "../../core/cli-library.js";
|
|
22
|
+
import { hasPulledLibrary, openCliLibrary } from "../../core/cli-library.js";
|
|
21
23
|
import { flagValue } from "../../cli-run.js";
|
|
22
24
|
import { defaultOverlayDir, workPath } from "../../workdir.js";
|
|
23
25
|
import { PACKAGE_NAME } from "../../package-name.js";
|
|
24
26
|
import { stderrReporter } from "../reporter.js";
|
|
25
27
|
import { fetchConnectors } from "./fetch-connectors.js";
|
|
26
|
-
import {
|
|
28
|
+
import { join } from "node:path";
|
|
29
|
+
import { NOT_SERVED_FILE, NOT_SERVED_TTL_MS, fetchDefinitions, fetchDefinitionsEnabled, fetchableNodeType, } from "./fetch-definitions.js";
|
|
27
30
|
/** The identity of a miss, as fetched: a start trigger as its wait form, and the object asked for. */
|
|
28
31
|
function missKey(miss) {
|
|
29
32
|
return JSON.stringify([fetchableNodeType(miss.nodeType), miss.objectName?.toLowerCase() ?? null]);
|
|
@@ -41,6 +44,14 @@ const settled = (pass) => {
|
|
|
41
44
|
throw pass.error;
|
|
42
45
|
return pass.value;
|
|
43
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Whether this invocation fetches a missing definition through `uip`: fetching
|
|
49
|
+
* is on, and no pre-cache library was pulled or named. The published library is
|
|
50
|
+
* the catalog when there is one; a typo against it is refused, not looked up.
|
|
51
|
+
*/
|
|
52
|
+
export function fetchesDefinitions(argv) {
|
|
53
|
+
return fetchDefinitionsEnabled() && !hasPulledLibrary(argv);
|
|
54
|
+
}
|
|
44
55
|
/** The overlay a fetch writes into: the one the library opens, else `.flow-sdk/connectors-local`. */
|
|
45
56
|
export function fetchOverlayDir(argv) {
|
|
46
57
|
return flagValue(argv, "--connectors-local") ?? defaultOverlayDir() ?? workPath("connectors-local");
|
|
@@ -50,7 +61,7 @@ export function fetchOverlayDir(argv) {
|
|
|
50
61
|
* what its last pass threw.
|
|
51
62
|
*/
|
|
52
63
|
export async function withFetchedDefinitions(argv, work, options = {}) {
|
|
53
|
-
if (!
|
|
64
|
+
if (!fetchesDefinitions(argv))
|
|
54
65
|
return work(openCliLibrary(argv));
|
|
55
66
|
const reporter = options.reporter ?? stderrReporter;
|
|
56
67
|
const who = options.who ?? "compile";
|
|
@@ -77,7 +88,7 @@ export async function withFetchedDefinitions(argv, work, options = {}) {
|
|
|
77
88
|
reporter,
|
|
78
89
|
...(options.client ? { client: options.client } : {}),
|
|
79
90
|
});
|
|
80
|
-
noteResult(notes, fresh, result);
|
|
91
|
+
noteResult(notes, fresh, result, overlayDir);
|
|
81
92
|
// Nothing new to read: one more pass, so the refusal carries its note.
|
|
82
93
|
if (result.fetched.length === 0) {
|
|
83
94
|
const last = await settle(() => work(openCliLibrary(argv, { always: true, missNote })));
|
|
@@ -86,14 +97,14 @@ export async function withFetchedDefinitions(argv, work, options = {}) {
|
|
|
86
97
|
}
|
|
87
98
|
}
|
|
88
99
|
/** Record, per node type fetched, why fetching it did not help. */
|
|
89
|
-
function noteResult(notes, asked, result) {
|
|
100
|
+
function noteResult(notes, asked, result, overlayDir) {
|
|
90
101
|
if (result.unavailable !== undefined) {
|
|
91
102
|
const note = `The connector library was not pulled, and the definition could not be fetched through uip: ${sentence(result.unavailable)}`;
|
|
92
103
|
for (const request of asked)
|
|
93
104
|
notes.set(fetchableNodeType(request.nodeType), note);
|
|
94
105
|
}
|
|
95
106
|
for (const nodeType of result.notServed) {
|
|
96
|
-
notes.set(nodeType,
|
|
107
|
+
notes.set(nodeType, notServedNote(overlayDir));
|
|
97
108
|
}
|
|
98
109
|
for (const failure of result.failed) {
|
|
99
110
|
notes.set(failure.nodeType, `Fetching it through uip failed: ${sentence(failure.reason)}`);
|
|
@@ -108,7 +119,7 @@ function noteResult(notes, asked, result) {
|
|
|
108
119
|
* With the fetch off it is `openCliLibrary(argv)`, as before.
|
|
109
120
|
*/
|
|
110
121
|
export async function openWithFetchedDefinitions(argv, requests, options = {}) {
|
|
111
|
-
if (!
|
|
122
|
+
if (!fetchesDefinitions(argv))
|
|
112
123
|
return openCliLibrary(argv);
|
|
113
124
|
const library = openCliLibrary(argv, { always: true });
|
|
114
125
|
// A start trigger is carried as its wait form: either one in a layer is enough.
|
|
@@ -127,7 +138,7 @@ export async function openWithFetchedDefinitions(argv, requests, options = {}) {
|
|
|
127
138
|
...(options.client ? { client: options.client } : {}),
|
|
128
139
|
});
|
|
129
140
|
const notes = options.notes ?? new Map();
|
|
130
|
-
noteResult(notes, missing, result);
|
|
141
|
+
noteResult(notes, missing, result, fetchOverlayDir(argv));
|
|
131
142
|
// Decompile goes on either way (what the tenant does not serve is carried
|
|
132
143
|
// from the file), so say what was not fetched and why.
|
|
133
144
|
for (const [nodeType, note] of [...notes].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {
|
|
@@ -149,7 +160,7 @@ export async function openWithFetchedDefinitions(argv, requests, options = {}) {
|
|
|
149
160
|
* not be fetched is a warning; the caller's own refusal says the rest.
|
|
150
161
|
*/
|
|
151
162
|
export async function fetchMissedBy(argv, probe, options = {}) {
|
|
152
|
-
if (!
|
|
163
|
+
if (!fetchesDefinitions(argv))
|
|
153
164
|
return;
|
|
154
165
|
const reporter = options.reporter ?? stderrReporter;
|
|
155
166
|
const who = options.who ?? "decompile";
|
|
@@ -181,13 +192,24 @@ export async function fetchMissedBy(argv, probe, options = {}) {
|
|
|
181
192
|
askedMisses.add(missKey(miss));
|
|
182
193
|
const names = [...freshKeys, ...new Set(freshMisses.map((m) => m.nodeType))];
|
|
183
194
|
reporter.info(`${who}: ${names.join(", ")} not in the connector library; fetching through uip.`);
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
195
|
+
// Definitions only, no typed modules: the source names an operation by
|
|
196
|
+
// strings, and a module the author edited (or `prepare --import` wrote) must
|
|
197
|
+
// not be rewritten. Only the operations no layer holds: a partially cached
|
|
198
|
+
// connector keeps its rows.
|
|
199
|
+
let connectors;
|
|
200
|
+
let definitions;
|
|
201
|
+
try {
|
|
202
|
+
connectors = freshKeys.length > 0
|
|
203
|
+
? await fetchConnectors(freshKeys, { overlayDir, importSpecifier: PACKAGE_NAME, reporter, skip: (nodeType) => library.indexes(nodeType), modules: false, ...client })
|
|
204
|
+
: undefined;
|
|
205
|
+
definitions = freshMisses.length > 0 ? await fetchDefinitions(freshMisses, { overlayDir, reporter, ...client }) : undefined;
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
// As Flow decompile treats an unreadable library: a warning, and the run
|
|
209
|
+
// goes on with the library as it is.
|
|
210
|
+
reporter.warn(`${who}: warning: fetching through uip failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
191
213
|
const unavailable = connectors?.unavailable ?? definitions?.unavailable;
|
|
192
214
|
if (unavailable !== undefined) {
|
|
193
215
|
reporter.warn(`${who}: warning: nothing was fetched through uip: ${unavailable}.`);
|
|
@@ -205,6 +227,11 @@ export async function fetchMissedBy(argv, probe, options = {}) {
|
|
|
205
227
|
return;
|
|
206
228
|
}
|
|
207
229
|
}
|
|
230
|
+
/** Why a node type is missing when the tenant does not serve it, and how to ask again before the answer expires. */
|
|
231
|
+
export function notServedNote(overlayDir) {
|
|
232
|
+
return "The tenant was asked through uip (`uip maestro flow registry get`) and does not serve it. " +
|
|
233
|
+
`That answer is kept for ${NOT_SERVED_TTL_MS / 60_000} minutes in ${join(overlayDir, NOT_SERVED_FILE)}; delete that file to ask again sooner.`;
|
|
234
|
+
}
|
|
208
235
|
/** `text` as the end of a sentence: one closing period, whatever `uip`'s reason ended with. */
|
|
209
236
|
function sentence(text) {
|
|
210
237
|
return `${text.replace(/[\s.]+$/, "")}.`;
|
|
@@ -299,7 +299,9 @@ export function mergeFilesInto(files, dst) {
|
|
|
299
299
|
return false;
|
|
300
300
|
});
|
|
301
301
|
dstIdx.entries = mergeIndexEntries(kept, srcRows);
|
|
302
|
-
|
|
302
|
+
// The descriptors first, then the index: a write that stops part way leaves
|
|
303
|
+
// files no row names, never a row with no file. No rename: Studio Web's file
|
|
304
|
+
// system refuses one (see staged-files.ts).
|
|
303
305
|
for (const [rel, content] of files) {
|
|
304
306
|
if (basename(rel) === INDEX_FILENAME)
|
|
305
307
|
continue;
|
|
@@ -307,6 +309,7 @@ export function mergeFilesInto(files, dst) {
|
|
|
307
309
|
mkdirSync(dirname(out), { recursive: true });
|
|
308
310
|
writeInsideSync(dst, out, content);
|
|
309
311
|
}
|
|
312
|
+
writeInsideSync(dst, join(dst, INDEX_FILENAME), formatOverlayIndex(dstIdx));
|
|
310
313
|
return { replacedPlanRows: replaced };
|
|
311
314
|
}
|
|
312
315
|
/** Every file under `root`, as `POSIX-relative path → bytes`. */
|
|
@@ -27,7 +27,12 @@ export declare function connectorsLibraryUrl(argv: string[], env?: Record<string
|
|
|
27
27
|
* of these: bytes that do not match their sidecar are refused, not routed around.
|
|
28
28
|
*/
|
|
29
29
|
export declare class ArchiveUnavailableError extends Error {
|
|
30
|
-
|
|
30
|
+
readonly status?: number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* @param status The HTTP status when the server answered one: a 404 says no
|
|
33
|
+
* library is published there, anything else may pass.
|
|
34
|
+
*/
|
|
35
|
+
constructor(message: string, status?: number | undefined);
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
33
38
|
* Point `current` at an entry, replacing whatever it named.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { reportResult } from '../cli-result.js';
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { mkdir, readFile, realpath, rename, rm, stat, symlink, unlink, writeFile, } from "node:fs/promises";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
4
5
|
import { join, resolve } from "node:path";
|
|
5
6
|
import { writeJsonFile } from "../core/json-file.js";
|
|
6
|
-
import { CURRENT_LINK, LIBRARY_JSON_DIR, LIBRARY_MARKDOWN_DIR, cacheEntry, libraryCacheRoot, referencedConnectorKeys, } from "../core/library-cache.js";
|
|
7
|
+
import { CURRENT_LINK, LIBRARY_JSON_DIR, LIBRARY_MARKDOWN_DIR, cacheEntry, libraryCacheRoot, referencedConnectorKeys, resolveCachedLibrary, } from "../core/library-cache.js";
|
|
7
8
|
import { extractLibrary } from "./extractor.js";
|
|
8
9
|
import { materializeRegistry } from "./materializer.js";
|
|
9
10
|
import { curatedOverlayIdentity } from "./curated-overlay.js";
|
|
@@ -136,8 +137,14 @@ async function isFileAsync(path) {
|
|
|
136
137
|
* of these: bytes that do not match their sidecar are refused, not routed around.
|
|
137
138
|
*/
|
|
138
139
|
export class ArchiveUnavailableError extends Error {
|
|
139
|
-
|
|
140
|
+
status;
|
|
141
|
+
/**
|
|
142
|
+
* @param status The HTTP status when the server answered one: a 404 says no
|
|
143
|
+
* library is published there, anything else may pass.
|
|
144
|
+
*/
|
|
145
|
+
constructor(message, status) {
|
|
140
146
|
super(message);
|
|
147
|
+
this.status = status;
|
|
141
148
|
this.name = "ArchiveUnavailableError";
|
|
142
149
|
}
|
|
143
150
|
}
|
|
@@ -153,7 +160,7 @@ async function reach(url) {
|
|
|
153
160
|
throw new ArchiveUnavailableError(`Could not download ${url}: ${detail}`);
|
|
154
161
|
}
|
|
155
162
|
if (!response.ok) {
|
|
156
|
-
throw new ArchiveUnavailableError(`Could not download ${url}: HTTP ${response.status} ${response.statusText}
|
|
163
|
+
throw new ArchiveUnavailableError(`Could not download ${url}: HTTP ${response.status} ${response.statusText}`, response.status);
|
|
157
164
|
}
|
|
158
165
|
return response;
|
|
159
166
|
}
|
|
@@ -376,7 +383,17 @@ export async function run(argv) {
|
|
|
376
383
|
catch (error) {
|
|
377
384
|
if (!(error instanceof ArchiveUnavailableError))
|
|
378
385
|
throw error;
|
|
379
|
-
|
|
386
|
+
// A library pulled earlier is still the library: compile keeps using
|
|
387
|
+
// it, so fetching beside it would mix the two. Say the download failed.
|
|
388
|
+
// The pulled cache, or a library FLOW_SDK_LIBRARY_JSON names: either is
|
|
389
|
+
// what compile reads, and a fetch beside it would bypass it.
|
|
390
|
+
const cached = resolveCachedLibrary(cacheDir) ?? configuredLibrary();
|
|
391
|
+
if (cached !== undefined && explicitLibraryRequest(argv) === undefined) {
|
|
392
|
+
console.error(`registry pull: ${error.message}. The library pulled earlier is kept (${cached}); ` +
|
|
393
|
+
"run the pull again once the download can be reached.");
|
|
394
|
+
return 1;
|
|
395
|
+
}
|
|
396
|
+
return await pullWithoutArchive(argv, error);
|
|
380
397
|
}
|
|
381
398
|
const archiveSha256 = await archiveIdentity(archive);
|
|
382
399
|
const overlaySha256 = await curatedOverlayIdentity();
|
|
@@ -473,7 +490,8 @@ export async function run(argv) {
|
|
|
473
490
|
* author's next `check` names it, and on Automation Suite it may simply not be
|
|
474
491
|
* approved.
|
|
475
492
|
*/
|
|
476
|
-
async function pullWithoutArchive(argv,
|
|
493
|
+
async function pullWithoutArchive(argv, unavailable) {
|
|
494
|
+
const why = unavailable.message;
|
|
477
495
|
const overlayDir = value(argv, "--connectors-local") ?? workPath("connectors-local");
|
|
478
496
|
const named = repeated(argv, "--connector");
|
|
479
497
|
const keys = named.length > 0
|
|
@@ -496,7 +514,11 @@ async function pullWithoutArchive(argv, why) {
|
|
|
496
514
|
console.error("registry pull: the connector library is unavailable and no connector is referenced by this project yet. " +
|
|
497
515
|
"Name one with `--connector <key>` to fetch it through uip.");
|
|
498
516
|
reportResult({ library: null, overlay: resolve(overlayDir), fetched: [] });
|
|
499
|
-
|
|
517
|
+
// Nothing published there (a 404), or no route to it at all, as on an
|
|
518
|
+
// air-gapped Automation Suite: no library is to be had, and nothing is
|
|
519
|
+
// referenced yet, so there is nothing to fail. A server error may pass,
|
|
520
|
+
// and a CI step must not read it as success.
|
|
521
|
+
return unavailable.status === undefined || unavailable.status === 404 ? 0 : 1;
|
|
500
522
|
}
|
|
501
523
|
console.error(`registry pull: fetching ${keys.join(", ")} through uip into ${overlayDir} instead.`);
|
|
502
524
|
const result = await fetchConnectors(keys, {
|
|
@@ -532,6 +554,11 @@ async function pullWithoutArchive(argv, why) {
|
|
|
532
554
|
(result.modules.length > 0 ? `, with ${result.modules.join(", ")}` : "") + ".");
|
|
533
555
|
return result.failed.length > 0 || namedUnlisted.length > 0 ? 1 : 0;
|
|
534
556
|
}
|
|
557
|
+
/** The library FLOW_SDK_LIBRARY_JSON names, when it holds an index. */
|
|
558
|
+
function configuredLibrary() {
|
|
559
|
+
const dir = process.env.FLOW_SDK_LIBRARY_JSON || undefined;
|
|
560
|
+
return dir !== undefined && existsSync(join(dir, "index.json")) ? dir : undefined;
|
|
561
|
+
}
|
|
535
562
|
/**
|
|
536
563
|
* The flag (with its value) that asked for a specific library, or `undefined`
|
|
537
564
|
* for the default request the uip fallback may answer.
|
|
@@ -156,6 +156,10 @@ export async function searchTenantOperations(options, client = defaultUipClient(
|
|
|
156
156
|
const key = catalogConnectorKey(nodeType);
|
|
157
157
|
if (key === null)
|
|
158
158
|
continue;
|
|
159
|
+
// A node the tenant lists but has gated off (a feature flag): describe and
|
|
160
|
+
// check could not fetch it, so it is not offered.
|
|
161
|
+
if (getCI(row, "AvailableOnTenant") === false)
|
|
162
|
+
continue;
|
|
159
163
|
if (connector && key.toLowerCase() !== connector)
|
|
160
164
|
continue;
|
|
161
165
|
const label = text(getCI(row, "DisplayName"));
|
|
@@ -176,14 +180,36 @@ export async function searchTenantOperations(options, client = defaultUipClient(
|
|
|
176
180
|
definitionPath: "",
|
|
177
181
|
});
|
|
178
182
|
}
|
|
179
|
-
const
|
|
183
|
+
const warnings = [getCI(envelope, "Warning")].filter((w) => typeof w === "string" && w.trim() !== "").map((w) => w.trim());
|
|
184
|
+
// The catalog lists operations, not the objects a generic operation takes, so
|
|
185
|
+
// a query naming an object can miss here where the library would hit.
|
|
186
|
+
if (matches.length === 0 && tokens.length > 0) {
|
|
187
|
+
warnings.push("The tenant's catalog names operations, not the objects a generic operation works on, " +
|
|
188
|
+
"so a query naming an object (\"salesforce contact\") can find nothing here. " +
|
|
189
|
+
"Search by the connector and operation (\"salesforce create record\") before treating this as a miss.");
|
|
190
|
+
}
|
|
180
191
|
return {
|
|
181
192
|
total: matches.length,
|
|
182
193
|
operations: matches.slice(0, options.limit ?? DEFAULT_SEARCH_LIMIT),
|
|
183
194
|
source: "tenant",
|
|
184
|
-
...(
|
|
195
|
+
...(warnings.length > 0 ? { warning: warnings.join(" ") } : {}),
|
|
185
196
|
};
|
|
186
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Whether `dir` holds a library index. A reader that throws (outside Node with
|
|
200
|
+
* no host reader: READ_TEXT_UNAVAILABLE) reads as none, so the search answers
|
|
201
|
+
* from the tenant or says why, rather than rejecting.
|
|
202
|
+
*/
|
|
203
|
+
function hasIndex(dir) {
|
|
204
|
+
if (dir === undefined)
|
|
205
|
+
return false;
|
|
206
|
+
try {
|
|
207
|
+
return defaultReadText()(join(dir, "index.json")) !== undefined;
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
187
213
|
function value(args, name) {
|
|
188
214
|
const index = args.indexOf(name);
|
|
189
215
|
return index >= 0 ? args[index + 1] : undefined;
|
|
@@ -198,8 +224,7 @@ export async function run(argv) {
|
|
|
198
224
|
// A named library, by `--library` or FLOW_SDK_LIBRARY_JSON, is searched (or
|
|
199
225
|
// refused) as it always was.
|
|
200
226
|
const named = explicit ?? (process.env.FLOW_SDK_LIBRARY_JSON || undefined);
|
|
201
|
-
const tenant = named === undefined && fetchDefinitionsEnabled()
|
|
202
|
-
&& (resolved === undefined || defaultReadText()(join(resolved, "index.json")) === undefined);
|
|
227
|
+
const tenant = named === undefined && fetchDefinitionsEnabled() && !hasIndex(resolved);
|
|
203
228
|
const libraryPath = tenant ? undefined : resolved;
|
|
204
229
|
if (!libraryPath && !tenant) {
|
|
205
230
|
// Say why. A bare usage line here read as "no match" to an agent deciding
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.105.
|
|
3
|
+
"version": "6.105.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",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"@types/node": "^22.7.0",
|
|
122
122
|
"esbuild": "^0.28.1"
|
|
123
123
|
},
|
|
124
|
-
"gitref": "
|
|
124
|
+
"gitref": "187db960348287f6543d4824b9c5d9f865f86c7a"
|
|
125
125
|
}
|