@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/case/compile-cli.js
CHANGED
|
@@ -28,7 +28,7 @@ import { serialize } from './serialize.js';
|
|
|
28
28
|
import { entryPointIO } from './entry-points.js';
|
|
29
29
|
import { Bindings } from '../core/bindings.js';
|
|
30
30
|
import { offlineBindingLabel } from './ids.js';
|
|
31
|
-
import {
|
|
31
|
+
import { withFetchedDefinitions } from '../registry/fetch/with-fetched-definitions.js';
|
|
32
32
|
import { defaultBindingsFile, defaultResourcesFile } from '../workdir.js';
|
|
33
33
|
import { readCliResources } from '../registry/prepare/resources.js';
|
|
34
34
|
import { flagValue, runWhenInvokedDirectly } from '../cli-run.js';
|
|
@@ -60,8 +60,9 @@ export async function run(argv) {
|
|
|
60
60
|
// fine right after a pull on Flow failed here for no visible reason. The helper
|
|
61
61
|
// also auto-detects the `connectors-local/` overlay `registry prepare` writes,
|
|
62
62
|
// which is what the three copies of these lines used to each decide for itself.
|
|
63
|
-
// `case check` opens it the same way (#1014).
|
|
64
|
-
|
|
63
|
+
// `case check` opens it the same way (#1014). A connector operation no layer
|
|
64
|
+
// carries is fetched through `uip` and the serializer runs again
|
|
65
|
+
// (`withFetchedDefinitions`, docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
65
66
|
const { out, bindings } = caseCompileTarget(argv);
|
|
66
67
|
// The resource ledger `registry prepare` writes, for a `resource()` / `entity()` connector input.
|
|
67
68
|
const ledger = readCliResources(argv, defaultResourcesFile());
|
|
@@ -77,12 +78,16 @@ export async function run(argv) {
|
|
|
77
78
|
// resource key, #1567); they are printed, and reported, as `case check` reports them.
|
|
78
79
|
const warnings = [];
|
|
79
80
|
try {
|
|
80
|
-
caseplan =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
caseplan = await withFetchedDefinitions(argv, (library) => {
|
|
82
|
+
// One pass's warnings: a pass that missed a definition runs again.
|
|
83
|
+
warnings.length = 0;
|
|
84
|
+
return serialize(built, {
|
|
85
|
+
library, bindings, resources: ledger,
|
|
86
|
+
warn: (w) => {
|
|
87
|
+
if (!warnings.some((d) => d.code === w.code && d.message === w.message))
|
|
88
|
+
warnings.push({ level: 'warning', code: w.code, message: w.message });
|
|
89
|
+
},
|
|
90
|
+
});
|
|
86
91
|
});
|
|
87
92
|
}
|
|
88
93
|
catch (error) {
|
|
@@ -6,4 +6,4 @@ import { type CliExitCode } from '../cli-run.js';
|
|
|
6
6
|
* unified CLI that still holds `case decompile …`, so the positional scan would
|
|
7
7
|
* pick up the family word. Errors throw; both callers report and set exit 1.
|
|
8
8
|
*/
|
|
9
|
-
export declare function run(argv: string[]): CliExitCode
|
|
9
|
+
export declare function run(argv: string[]): Promise<CliExitCode>;
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
import { reportResult } from '../cli-result.js';
|
|
29
29
|
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
30
30
|
import { openCliLibrary } from '../core/cli-library.js';
|
|
31
|
+
import { fetchDefinitionsEnabled } from '../registry/fetch/fetch-definitions.js';
|
|
32
|
+
import { fetchMissedBy } from '../registry/fetch/with-fetched-definitions.js';
|
|
31
33
|
import { resolveLibraryDir } from '../core/library-cache.js';
|
|
32
34
|
import { basename, join, resolve } from 'node:path';
|
|
33
35
|
import { defaultOverlayDir, defaultSourceOut, workDirBeside, workPath, writeSource } from '../workdir.js';
|
|
@@ -53,7 +55,7 @@ function baseName(plan) {
|
|
|
53
55
|
* unified CLI that still holds `case decompile …`, so the positional scan would
|
|
54
56
|
* pick up the family word. Errors throw; both callers report and set exit 1.
|
|
55
57
|
*/
|
|
56
|
-
export function run(argv) {
|
|
58
|
+
export async function run(argv) {
|
|
57
59
|
if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
|
|
58
60
|
console.error('usage: decompile <caseplan.json> [-o Name.case.ts] [--import <specifier>] [--library <dir>] [--connectors-local <dir>] [--best-effort] [--no-pipeline]');
|
|
59
61
|
return 2;
|
|
@@ -71,7 +73,15 @@ export function run(argv) {
|
|
|
71
73
|
const importSpecifier = flagValue(argv, '--import') ?? CASE_IMPORT;
|
|
72
74
|
const bestEffort = argv.includes('--best-effort');
|
|
73
75
|
const run = (library) => decompileWithDiagnostics(plan, { importSpecifier, library, bestEffort });
|
|
74
|
-
|
|
76
|
+
// A connector the plan uses and no layer carries is fetched through `uip`
|
|
77
|
+
// first, with its typed module (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md):
|
|
78
|
+
// one probing decompile records what it could not identify, then the real one
|
|
79
|
+
// runs against what the tenant serves. Only what the tenant does not serve is
|
|
80
|
+
// left for the plan's own description below.
|
|
81
|
+
await fetchMissedBy(argv, (probe) => run(probe), { who: 'case-decompile' });
|
|
82
|
+
// A fetch may have created the overlay: look again, so the pipeline helper records it.
|
|
83
|
+
overlayDir = flagValue(argv, '--connectors-local') ?? defaultOverlayDir();
|
|
84
|
+
const library = openCliLibrary(argv, { always: fetchDefinitionsEnabled() });
|
|
75
85
|
let result;
|
|
76
86
|
if (!library)
|
|
77
87
|
result = run(undefined);
|
package/dist/check-cli.js
CHANGED
|
@@ -20,7 +20,8 @@ import { defaultBindingsFile, defaultResourcesFile } from './workdir.js';
|
|
|
20
20
|
import { readCliResources } from './registry/prepare/resources.js';
|
|
21
21
|
import { resolveFlowFile, loadBuiltFlow } from './load.js';
|
|
22
22
|
import { check, checkCompiled, scopeToEdit } from './check.js';
|
|
23
|
-
import { flowCheckOpts
|
|
23
|
+
import { flowCheckOpts } from './cli-library.js';
|
|
24
|
+
import { withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
24
25
|
import { Bindings } from './bindings.js';
|
|
25
26
|
import { flagValue, flagValues, runWhenInvokedDirectly } from './cli-run.js';
|
|
26
27
|
import { ensureTypeScriptRuntime } from './node-runtime.js';
|
|
@@ -38,9 +39,10 @@ const VALUE_FLAGS = new Set(['--library', '--bindings', '--connectors-local', '-
|
|
|
38
39
|
* empty `where` is correct, or lower a connector step, so it fails open (a
|
|
39
40
|
* warning, or nothing). Given a library, `compile` and `check` make the same
|
|
40
41
|
* call with the facts in hand. `--library` and `--connectors-local` mirror
|
|
41
|
-
* compile-cli's flags and defaults
|
|
42
|
+
* compile-cli's flags and defaults: the library is the one
|
|
43
|
+
* `withFetchedDefinitions` opens for compile.
|
|
42
44
|
*/
|
|
43
|
-
function checkOpts(argv) {
|
|
45
|
+
function checkOpts(argv, library) {
|
|
44
46
|
// The default bindings.json (workdir.ts), exactly as compile-cli finds it — so the
|
|
45
47
|
// own-name refusal compile would raise is reported here first.
|
|
46
48
|
const bindFlag = argv.indexOf('--bindings');
|
|
@@ -51,7 +53,7 @@ function checkOpts(argv) {
|
|
|
51
53
|
// as still owed — telling the author to re-run a `prepare` they already ran.
|
|
52
54
|
// The resource ledger `prepare` writes, the default found as bindings.json is.
|
|
53
55
|
const resources = readCliResources(argv, defaultResourcesFile());
|
|
54
|
-
return { ...flowCheckOpts(
|
|
56
|
+
return { ...flowCheckOpts(library, bindings), ...(resources ? { resources } : {}) };
|
|
55
57
|
}
|
|
56
58
|
export async function run(argv) {
|
|
57
59
|
const arg = argv.find((a, i) => !a.startsWith('--') && !VALUE_FLAGS.has(argv[i - 1])) ?? argv[0];
|
|
@@ -69,8 +71,12 @@ export async function run(argv) {
|
|
|
69
71
|
const file = resolveFlowFile(arg);
|
|
70
72
|
ensureTypeScriptRuntime();
|
|
71
73
|
const built = await loadBuiltFlow(file);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
// A connector operation no layer carries is fetched through `uip` and the
|
|
75
|
+
// check runs again, as `compile` does (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
76
|
+
const diags = await withFetchedDefinitions(argv, (library) => {
|
|
77
|
+
const opts = checkOpts(argv, library);
|
|
78
|
+
return baselinePath !== undefined ? checkAgainstBaseline(built, baselinePath, original, opts, flagValues(argv, '--package')) : check(built, opts);
|
|
79
|
+
}, { who: 'check' });
|
|
74
80
|
reportDiagnostics(diags);
|
|
75
81
|
if (diags.length === 0) {
|
|
76
82
|
console.log('✓ no issues');
|
|
@@ -21,6 +21,7 @@ export function registerRegistryCommands(program) {
|
|
|
21
21
|
.option('--library-md <dir>', 'markdown output (default: ./library-md)')
|
|
22
22
|
.option('--connectors <dir>', 'TypeScript descriptor output (default: ./.flow-sdk/connectors)')
|
|
23
23
|
.option('--connector <key>', 'only generate this connector (repeatable; default: whatever the project references)', collect, [])
|
|
24
|
+
.option('--connectors-local <dir>', 'where connectors fetched through uip land when the library cannot be downloaded (default: ./.flow-sdk/connectors-local)')
|
|
24
25
|
.option('--url <url>', 'archive URL to pull from')
|
|
25
26
|
.option('--archive <zip>', 'use a zip already on disk instead of downloading')
|
|
26
27
|
.option('--cache <dir>', 'where downloaded archives are kept')
|
|
@@ -38,6 +39,7 @@ export function registerRegistryCommands(program) {
|
|
|
38
39
|
addValue(argv, '--connectors', options.connectors);
|
|
39
40
|
for (const key of options.connector ?? [])
|
|
40
41
|
argv.push('--connector', key);
|
|
42
|
+
addValue(argv, '--connectors-local', options.connectorsLocal);
|
|
41
43
|
addValue(argv, '--url', options.url);
|
|
42
44
|
addValue(argv, '--archive', options.archive);
|
|
43
45
|
addValue(argv, '--cache', options.cache);
|
package/dist/compile-cli.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* [--no-check]
|
|
9
9
|
*
|
|
10
10
|
* --library defaults to $FLOW_SDK_LIBRARY_JSON; --bindings defaults to
|
|
11
|
-
* .flow-sdk/bindings.json (or a legacy ./bindings.json) when present.
|
|
11
|
+
* .flow-sdk/bindings.json (or a legacy ./bindings.json) when present. A connector
|
|
12
|
+
* operation no library layer carries is fetched through `uip` into connectors-local.
|
|
12
13
|
*
|
|
13
14
|
* `compile` only serializes (docs/CHECK_COMPILE_CONTRACT_DESIGN.md D1, D2). It
|
|
14
15
|
* does not run `check()`'s lint rules: run `flow check` first for those. It
|
|
@@ -29,7 +30,7 @@ import { basename, dirname, join, relative, resolve } from 'node:path';
|
|
|
29
30
|
import { resolveFlowFile, loadBuiltFlow } from './load.js';
|
|
30
31
|
import { serializeWithSidecars } from './serialize.js';
|
|
31
32
|
import { compileOwnsResource } from './core/agent-tool-resources.js';
|
|
32
|
-
import {
|
|
33
|
+
import { withFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
33
34
|
import { Bindings } from './bindings.js';
|
|
34
35
|
import { flagValue, runWhenInvokedDirectly } from './cli-run.js';
|
|
35
36
|
import { connectionResources, inlineAgentResources, mergeBindingsV2, projectBindingRows, refreshInlineAgentRows } from './bindings-v2.js';
|
|
@@ -68,11 +69,12 @@ export async function run(argv) {
|
|
|
68
69
|
// shadows the baked library with full, connection-resolved field schemas. See
|
|
69
70
|
// core/library.ts (LibraryOpts.overlayDir). `check-cli` opens it the same way.
|
|
70
71
|
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
72
|
+
// A connector operation no layer carries is fetched through `uip` into the
|
|
73
|
+
// overlay and the serializer runs again (`withFetchedDefinitions`), so the
|
|
74
|
+
// pulled library is an optimization, not a requirement
|
|
75
|
+
// (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md). With the fetch off
|
|
76
|
+
// (FLOW_SDK_FETCH_DEFINITIONS=0) the library is loaded only when it is
|
|
77
|
+
// present, and a connector action with none is LIBRARY_REQUIRED.
|
|
76
78
|
const bindFile = flagValue(argv, '--bindings') ?? defaultBindingsFile();
|
|
77
79
|
const bindings = new Bindings(bindFile);
|
|
78
80
|
// The resource ledger `registry prepare` writes (docs/ENTITY_RESOLUTION_DESIGN.md);
|
|
@@ -152,9 +154,13 @@ export async function run(argv) {
|
|
|
152
154
|
const warnings = [];
|
|
153
155
|
let emitted;
|
|
154
156
|
try {
|
|
155
|
-
emitted =
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
emitted = await withFetchedDefinitions(argv, (library) => {
|
|
158
|
+
// One pass's warnings: a pass that missed a definition runs again.
|
|
159
|
+
warnings.length = 0;
|
|
160
|
+
return serializeWithSidecars(built, {
|
|
161
|
+
library, bindings, warn: (w) => warnings.push(w), resources, agentSource,
|
|
162
|
+
carriedDrafts: (d) => warnings.push(draftWarning(d)),
|
|
163
|
+
});
|
|
158
164
|
});
|
|
159
165
|
}
|
|
160
166
|
catch (error) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectorResolveError, Library, type ResolvedConnector } from './library.js';
|
|
1
|
+
import { ConnectorResolveError, Library, type LibraryOpts, type ResolvedConnector } from './library.js';
|
|
2
2
|
import type { BindingsView } from './binding-messages.js';
|
|
3
3
|
import { type ConnectorCheckOpts } from './connector-checks.js';
|
|
4
4
|
import type { LookupResolutions, LookupSpec } from './lookups.js';
|
|
@@ -10,8 +10,24 @@ import type { EventCheckOpts } from './event-checks.js';
|
|
|
10
10
|
* pull` filled (`resolveLibraryDir`). The overlay is `--connectors-local <dir>`,
|
|
11
11
|
* else `.flow-sdk/connectors-local` (or a legacy `./connectors-local`) when it
|
|
12
12
|
* has an `index.json` — the directory `registry prepare` writes by default.
|
|
13
|
+
*
|
|
14
|
+
* Either one is enough. With no pre-cache library the overlay is the whole
|
|
15
|
+
* library, so what `prepare` (or a fetch through `uip`) wrote is read even
|
|
16
|
+
* when the published zip was never pulled (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
17
|
+
* With neither there is no library, unless `opts.always` asks for an empty one:
|
|
18
|
+
* the CLIs that fetch a missing definition through `uip` need every connector
|
|
19
|
+
* step to be a miss they can record, not a LIBRARY_REQUIRED.
|
|
20
|
+
*
|
|
21
|
+
* A `--library` named on the command line is used or refused, never stepped
|
|
22
|
+
* around: one with no `index.json` is LIBRARY_NOT_FOUND, so a typo cannot
|
|
23
|
+
* quietly build from an older overlay instead. Only the defaults (the
|
|
24
|
+
* environment and the pulled cache) fall back to the overlay alone.
|
|
13
25
|
*/
|
|
14
|
-
export declare function openCliLibrary(argv: readonly string[]): Library | undefined;
|
|
26
|
+
export declare function openCliLibrary(argv: readonly string[], opts?: CliLibraryOpts): Library | undefined;
|
|
27
|
+
/** {@link openCliLibrary}'s options: the miss hooks it passes on, and whether to open an empty library. */
|
|
28
|
+
export interface CliLibraryOpts extends Pick<LibraryOpts, 'onMiss' | 'missNote' | 'hide' | 'onConnectorMiss'> {
|
|
29
|
+
always?: boolean;
|
|
30
|
+
}
|
|
15
31
|
/**
|
|
16
32
|
* The connector half of a family's check options, from a library the CLI already
|
|
17
33
|
* opened.
|
package/dist/core/cli-library.js
CHANGED
|
@@ -29,14 +29,34 @@ import { connectorInputErrors, connectorResourceRefusals } from './connector-inp
|
|
|
29
29
|
* pull` filled (`resolveLibraryDir`). The overlay is `--connectors-local <dir>`,
|
|
30
30
|
* else `.flow-sdk/connectors-local` (or a legacy `./connectors-local`) when it
|
|
31
31
|
* has an `index.json` — the directory `registry prepare` writes by default.
|
|
32
|
+
*
|
|
33
|
+
* Either one is enough. With no pre-cache library the overlay is the whole
|
|
34
|
+
* library, so what `prepare` (or a fetch through `uip`) wrote is read even
|
|
35
|
+
* when the published zip was never pulled (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
|
|
36
|
+
* With neither there is no library, unless `opts.always` asks for an empty one:
|
|
37
|
+
* the CLIs that fetch a missing definition through `uip` need every connector
|
|
38
|
+
* step to be a miss they can record, not a LIBRARY_REQUIRED.
|
|
39
|
+
*
|
|
40
|
+
* A `--library` named on the command line is used or refused, never stepped
|
|
41
|
+
* around: one with no `index.json` is LIBRARY_NOT_FOUND, so a typo cannot
|
|
42
|
+
* quietly build from an older overlay instead. Only the defaults (the
|
|
43
|
+
* environment and the pulled cache) fall back to the overlay alone.
|
|
32
44
|
*/
|
|
33
|
-
export function openCliLibrary(argv) {
|
|
34
|
-
const libDir = resolveLibraryDir(flagValue(argv, '--library'));
|
|
45
|
+
export function openCliLibrary(argv, opts = {}) {
|
|
35
46
|
// Through the reader, not `existsSync`: a host's reader serves a library that is on no disk.
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
const read = defaultReadText();
|
|
48
|
+
const hasIndex = (dir) => dir !== undefined && read(join(dir, 'index.json')) !== undefined;
|
|
49
|
+
const named = flagValue(argv, '--library');
|
|
50
|
+
if (named !== undefined && !hasIndex(named))
|
|
51
|
+
return new Library(named, { overlayDir: flagValue(argv, '--connectors-local') ?? defaultOverlayDir() });
|
|
52
|
+
const libDir = resolveLibraryDir(named);
|
|
38
53
|
const overlayDir = flagValue(argv, '--connectors-local') ?? defaultOverlayDir();
|
|
39
|
-
|
|
54
|
+
const { always, ...hooks } = opts;
|
|
55
|
+
if (hasIndex(libDir))
|
|
56
|
+
return new Library(libDir, { overlayDir, ...hooks });
|
|
57
|
+
if (hasIndex(overlayDir))
|
|
58
|
+
return new Library(undefined, { overlayDir, ...hooks });
|
|
59
|
+
return always ? new Library(undefined, hooks) : undefined;
|
|
40
60
|
}
|
|
41
61
|
/**
|
|
42
62
|
* The connector half of a family's check options, from a library the CLI already
|
package/dist/core/library.d.ts
CHANGED
|
@@ -230,6 +230,49 @@ export interface LibraryOpts {
|
|
|
230
230
|
readText?: ReadText;
|
|
231
231
|
/** Receives the library's warnings. Defaults to stderr; a host without `process` passes its own. */
|
|
232
232
|
warn?: (message: string) => void;
|
|
233
|
+
/**
|
|
234
|
+
* Told about every node type a resolve found in NO layer, before the
|
|
235
|
+
* CONNECTOR_NOT_IN_LIBRARY it throws. A CLI records these, fetches them
|
|
236
|
+
* through `uip` into the overlay, and runs again with a fresh `Library`
|
|
237
|
+
* (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md §3.2). Only a miss of the whole
|
|
238
|
+
* node type (or of the object asked for) is reported: a version or object
|
|
239
|
+
* the library refuses on a node type it does carry is the library's answer.
|
|
240
|
+
*/
|
|
241
|
+
onMiss?: (miss: LibraryMiss) => void;
|
|
242
|
+
/**
|
|
243
|
+
* A sentence appended to CONNECTOR_NOT_IN_LIBRARY for a node type no layer
|
|
244
|
+
* carries: why fetching it did not help (the tenant was asked and does not
|
|
245
|
+
* serve it, or `uip` could not be asked). The CLIs set it on the run after a
|
|
246
|
+
* fetch, so the refusal says what to do next.
|
|
247
|
+
*/
|
|
248
|
+
missNote?: (nodeType: string) => string | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Index rows to leave out of every layer. `flow merge` derives its baseline
|
|
251
|
+
* from the library as the decompile saw it: the node types its stamp records
|
|
252
|
+
* as lacked (`lacked=`) are hidden, whatever has been fetched or prepared for
|
|
253
|
+
* them since, so the stamped source comes back.
|
|
254
|
+
*/
|
|
255
|
+
hide?: (row: {
|
|
256
|
+
nodeType?: unknown;
|
|
257
|
+
connectorKey?: unknown;
|
|
258
|
+
provenance?: unknown;
|
|
259
|
+
}) => boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Told about a connector key whose saved wire `identifyAction` or
|
|
262
|
+
* `identifyEvent` could not reverse to an operation, before the refusal it
|
|
263
|
+
* throws. They match on method and path (or event operation), not on a node
|
|
264
|
+
* type, so what is missing is named by connector: the decompilers record these
|
|
265
|
+
* and fetch the connector's operations no layer holds through `uip`
|
|
266
|
+
* (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md). Reported whether or not other
|
|
267
|
+
* operations of the connector are held: a partial cache lacks the rest.
|
|
268
|
+
*/
|
|
269
|
+
onConnectorMiss?: (connectorKey: string) => void;
|
|
270
|
+
}
|
|
271
|
+
/** A node type no layer of a {@link Library} carries, as {@link LibraryOpts.onMiss} receives it. */
|
|
272
|
+
export interface LibraryMiss {
|
|
273
|
+
nodeType: string;
|
|
274
|
+
version?: string;
|
|
275
|
+
objectName?: string;
|
|
233
276
|
}
|
|
234
277
|
export { ConnectorResolveError, type ConnectorResolveCode } from './connector-resolve-error.js';
|
|
235
278
|
/** What `registry describe` renders one operation's page from. */
|
|
@@ -247,6 +290,13 @@ export interface PageSource {
|
|
|
247
290
|
/** `objectName`s the ledgers declare connector-invariant. */
|
|
248
291
|
invariant: ReadonlySet<string>;
|
|
249
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* The `provenance` a definition fetched through `uip` carries, on its entry and
|
|
295
|
+
* its index row (`registry/fetch/`). It sits in the overlay beside what
|
|
296
|
+
* `registry prepare` wrote, but has no connection behind it, so it never counts
|
|
297
|
+
* as prepared.
|
|
298
|
+
*/
|
|
299
|
+
export declare const FETCHED_PROVENANCE = "uip-fetch";
|
|
250
300
|
export declare class Library {
|
|
251
301
|
private layers;
|
|
252
302
|
/** The LIST-ENVELOPE LEDGER, overlay first so a prepared entry can add a row. */
|
|
@@ -269,7 +319,20 @@ export declare class Library {
|
|
|
269
319
|
private readonly invariantCollections;
|
|
270
320
|
private readonly read;
|
|
271
321
|
private readonly warn;
|
|
272
|
-
|
|
322
|
+
private readonly onMiss?;
|
|
323
|
+
private readonly missNote?;
|
|
324
|
+
private readonly onConnectorMiss?;
|
|
325
|
+
/**
|
|
326
|
+
* @param dir - The pre-cache library (`registry pull`'s `library-json`), or
|
|
327
|
+
* `undefined` when there is none: the library then resolves from the
|
|
328
|
+
* overlay alone, and with no overlay either it resolves nothing, so every
|
|
329
|
+
* connector operation is CONNECTOR_NOT_IN_LIBRARY
|
|
330
|
+
* (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md). A `dir` that is given but
|
|
331
|
+
* has no index is still LIBRARY_NOT_FOUND: a named library that is not
|
|
332
|
+
* there is a mistake, not an absence. `openCliLibrary` builds one that way
|
|
333
|
+
* for a `--library` flag with no index, which is how the CLIs refuse it.
|
|
334
|
+
*/
|
|
335
|
+
constructor(dir: string | undefined, opts?: LibraryOpts);
|
|
273
336
|
/**
|
|
274
337
|
* Resolve a connector ACTION (`uipath.connector.<key>.<action>`).
|
|
275
338
|
*
|
|
@@ -308,7 +371,7 @@ export declare class Library {
|
|
|
308
371
|
* For instance `indexes('uipath.connector.uipath-salesforce-slack.send-message-to-channel')`
|
|
309
372
|
* is `true` on the shipped library.
|
|
310
373
|
*/
|
|
311
|
-
indexes(nodeType: string): boolean;
|
|
374
|
+
indexes(nodeType: string, objectName?: string): boolean;
|
|
312
375
|
/**
|
|
313
376
|
* One operation's page source, for `registry describe`: the entry and definition
|
|
314
377
|
* of one index row, from the first layer that carries it. That is the prepared
|
|
@@ -504,7 +567,16 @@ export declare class Library {
|
|
|
504
567
|
private describeMiss;
|
|
505
568
|
/** Every direct operation id under `prefix` (no further dot), across layers, sorted and de-duplicated. */
|
|
506
569
|
private opsUnder;
|
|
570
|
+
/**
|
|
571
|
+
* Whether `nodeType` is a GENERIC operation the layers carry for other objects
|
|
572
|
+
* but not for `objectName` (in any case). False for a curated operation, where
|
|
573
|
+
* an object is the author's mistake, and for one whose objects come from the
|
|
574
|
+
* connection (`objectFromDiscovery`), which only `prepare --object` can fill.
|
|
575
|
+
*/
|
|
576
|
+
private variantMissing;
|
|
507
577
|
/** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
|
|
578
|
+
/** {@link LibraryOpts.onConnectorMiss}, for a wire of `connectorKey` no layer could identify. */
|
|
579
|
+
private noteConnectorMiss;
|
|
508
580
|
private carries;
|
|
509
581
|
/** The connector key is in no entry at all. */
|
|
510
582
|
private noConnector;
|
package/dist/core/library.js
CHANGED
|
@@ -18,6 +18,13 @@ import { CompileRefusal } from './compile-refusal.js';
|
|
|
18
18
|
import { transportHttpMethod } from './connector-inputs.js';
|
|
19
19
|
import { wireActivityTypeMatches } from './connector-configuration.js';
|
|
20
20
|
export { ConnectorResolveError } from './connector-resolve-error.js';
|
|
21
|
+
/**
|
|
22
|
+
* The `provenance` a definition fetched through `uip` carries, on its entry and
|
|
23
|
+
* its index row (`registry/fetch/`). It sits in the overlay beside what
|
|
24
|
+
* `registry prepare` wrote, but has no connection behind it, so it never counts
|
|
25
|
+
* as prepared.
|
|
26
|
+
*/
|
|
27
|
+
export const FETCHED_PROVENANCE = 'uip-fetch';
|
|
21
28
|
export class Library {
|
|
22
29
|
layers = [];
|
|
23
30
|
/** The LIST-ENVELOPE LEDGER, overlay first so a prepared entry can add a row. */
|
|
@@ -40,9 +47,25 @@ export class Library {
|
|
|
40
47
|
invariantCollections;
|
|
41
48
|
read;
|
|
42
49
|
warn;
|
|
50
|
+
onMiss;
|
|
51
|
+
missNote;
|
|
52
|
+
onConnectorMiss;
|
|
53
|
+
/**
|
|
54
|
+
* @param dir - The pre-cache library (`registry pull`'s `library-json`), or
|
|
55
|
+
* `undefined` when there is none: the library then resolves from the
|
|
56
|
+
* overlay alone, and with no overlay either it resolves nothing, so every
|
|
57
|
+
* connector operation is CONNECTOR_NOT_IN_LIBRARY
|
|
58
|
+
* (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md). A `dir` that is given but
|
|
59
|
+
* has no index is still LIBRARY_NOT_FOUND: a named library that is not
|
|
60
|
+
* there is a mistake, not an absence. `openCliLibrary` builds one that way
|
|
61
|
+
* for a `--library` flag with no index, which is how the CLIs refuse it.
|
|
62
|
+
*/
|
|
43
63
|
constructor(dir, opts = {}) {
|
|
44
64
|
const read = (this.read = opts.readText ?? defaultReadText());
|
|
45
65
|
this.warn = opts.warn ?? ((message) => { globalThis.process?.stderr?.write(message); });
|
|
66
|
+
this.onMiss = opts.onMiss;
|
|
67
|
+
this.missNote = opts.missNote;
|
|
68
|
+
this.onConnectorMiss = opts.onConnectorMiss;
|
|
46
69
|
// A new identity per Library, so the per-reader caches never keep an overlay file: `prepare` rewrites them.
|
|
47
70
|
const readOverlay = (path) => read(path);
|
|
48
71
|
this.lookupResolutions = loadLookupResolutions(opts.overlayDir, readOverlay);
|
|
@@ -55,10 +78,16 @@ export class Library {
|
|
|
55
78
|
if (opts.overlayDir) {
|
|
56
79
|
const overlayIndex = readOverlay(libraryPath(opts.overlayDir, 'index.json'));
|
|
57
80
|
if (overlayIndex !== undefined)
|
|
58
|
-
this.layers.push({
|
|
81
|
+
this.layers.push({
|
|
82
|
+
dir: opts.overlayDir,
|
|
83
|
+
entries: (JSON.parse(overlayIndex).entries ?? []).filter((row) => !opts.hide?.(row)),
|
|
84
|
+
overlay: true,
|
|
85
|
+
});
|
|
59
86
|
this.envelopeRows.push(...loadListEnvelopes(opts.overlayDir, readOverlay));
|
|
60
87
|
}
|
|
61
88
|
this.envelopeRows.push(...loadListEnvelopes(dir, read));
|
|
89
|
+
if (dir === undefined)
|
|
90
|
+
return;
|
|
62
91
|
const idx = libraryPath(dir, 'index.json');
|
|
63
92
|
const entries = libraryEntries(read, idx);
|
|
64
93
|
if (entries === undefined)
|
|
@@ -66,7 +95,7 @@ export class Library {
|
|
|
66
95
|
+ (read === readTextFromDisk
|
|
67
96
|
? `Run \`${PULL_COMMAND}\`, or point --library / $FLOW_SDK_LIBRARY_JSON at a library-json dir.`
|
|
68
97
|
: 'The reader passed to Library has no such file.'));
|
|
69
|
-
this.layers.push({ dir, entries });
|
|
98
|
+
this.layers.push({ dir, entries: opts.hide ? entries.filter((row) => !opts.hide(row)) : entries });
|
|
70
99
|
}
|
|
71
100
|
/**
|
|
72
101
|
* Resolve a connector ACTION (`uipath.connector.<key>.<action>`).
|
|
@@ -123,8 +152,8 @@ export class Library {
|
|
|
123
152
|
* For instance `indexes('uipath.connector.uipath-salesforce-slack.send-message-to-channel')`
|
|
124
153
|
* is `true` on the shipped library.
|
|
125
154
|
*/
|
|
126
|
-
indexes(nodeType) {
|
|
127
|
-
return this.carries(nodeType);
|
|
155
|
+
indexes(nodeType, objectName) {
|
|
156
|
+
return this.carries(nodeType) && !(objectName && this.variantMissing(nodeType, objectName));
|
|
128
157
|
}
|
|
129
158
|
/**
|
|
130
159
|
* One operation's page source, for `registry describe`: the entry and definition
|
|
@@ -266,7 +295,8 @@ export class Library {
|
|
|
266
295
|
|| entry?.connector?.discovery?.hasCustomFieldDiscovery === true;
|
|
267
296
|
if (!connectionResolved)
|
|
268
297
|
return { kind: 'static', prepared: true };
|
|
269
|
-
|
|
298
|
+
// A row fetched through `uip` has no connection behind it: only a `prepare` row counts.
|
|
299
|
+
if (rows.some(({ overlay, row }) => overlay && row.provenance !== FETCHED_PROVENANCE))
|
|
270
300
|
return { kind: 'customFields', prepared: true };
|
|
271
301
|
let bakedFields = [];
|
|
272
302
|
try {
|
|
@@ -338,6 +368,7 @@ export class Library {
|
|
|
338
368
|
}
|
|
339
369
|
}
|
|
340
370
|
}
|
|
371
|
+
this.noteConnectorMiss(wire.connectorKey);
|
|
341
372
|
throw new CompileRefusal('CONNECTOR_NOT_IN_LIBRARY', `connector activity not found in library: ${wire.connectorKey} ${wire.httpMethod ?? '?'} ${wire.endpoint ?? '?'}`);
|
|
342
373
|
}
|
|
343
374
|
/**
|
|
@@ -377,7 +408,9 @@ export class Library {
|
|
|
377
408
|
const nodeType = `uipath.connector.${kind}.${key}.${event}`;
|
|
378
409
|
let rc;
|
|
379
410
|
try {
|
|
380
|
-
|
|
411
|
+
// A start form missing while its wait form resolves is no miss: the start
|
|
412
|
+
// form is derived from the wait form below. Reported only when both miss.
|
|
413
|
+
rc = this.resolveType(nodeType, version, objectName, eventFallback(kind) === undefined);
|
|
381
414
|
}
|
|
382
415
|
catch (error) {
|
|
383
416
|
// The registry dump carries the WAIT form of every connector event and the
|
|
@@ -393,7 +426,7 @@ export class Library {
|
|
|
393
426
|
const siblingType = `uipath.connector.${fallback.ns}.${key}.${event}`;
|
|
394
427
|
let sibling;
|
|
395
428
|
try {
|
|
396
|
-
sibling = this.resolveType(siblingType, version, objectName);
|
|
429
|
+
sibling = this.resolveType(siblingType, version, objectName, false);
|
|
397
430
|
}
|
|
398
431
|
catch (siblingError) {
|
|
399
432
|
// The wait form IS in the library and refused the request itself — a
|
|
@@ -402,8 +435,14 @@ export class Library {
|
|
|
402
435
|
// told the author the connector was missing.
|
|
403
436
|
if (this.carries(siblingType, version))
|
|
404
437
|
throw siblingError;
|
|
438
|
+
if (!this.carries(nodeType, version)) {
|
|
439
|
+
this.onMiss?.({ nodeType, ...(version ? { version } : {}), ...(objectName ? { objectName } : {}) });
|
|
440
|
+
}
|
|
405
441
|
throw error;
|
|
406
442
|
}
|
|
443
|
+
if (objectName && this.variantMissing(siblingType, objectName, version)) {
|
|
444
|
+
this.onMiss?.({ nodeType, ...(version ? { version } : {}), objectName });
|
|
445
|
+
}
|
|
407
446
|
rc = fallback.derive(sibling, nodeType);
|
|
408
447
|
}
|
|
409
448
|
return normalizeEventOperation(rc);
|
|
@@ -450,6 +489,7 @@ export class Library {
|
|
|
450
489
|
}
|
|
451
490
|
}
|
|
452
491
|
}
|
|
492
|
+
this.noteConnectorMiss(wire.connectorKey);
|
|
453
493
|
throw new CompileRefusal('EVENT_UNKNOWN', `connector ${kind} event not found in library: ${wire.connectorKey} `
|
|
454
494
|
+ `${wire.eventOperation ?? '?'} ${wire.objectName ?? '?'}`);
|
|
455
495
|
}
|
|
@@ -553,7 +593,8 @@ export class Library {
|
|
|
553
593
|
if (nodeType !== `uipath.connector.event.${key}.${event}`
|
|
554
594
|
&& nodeType !== `uipath.connector.trigger.${key}.${event}`)
|
|
555
595
|
continue;
|
|
556
|
-
|
|
596
|
+
// A row fetched through `uip` has no connection behind it: only a `prepare` row counts.
|
|
597
|
+
if (layer.overlay === true && row.provenance !== FETCHED_PROVENANCE)
|
|
557
598
|
overlayPrepared = true;
|
|
558
599
|
if (objectName && row.objectName === objectName)
|
|
559
600
|
objectPrepared = true;
|
|
@@ -697,7 +738,14 @@ export class Library {
|
|
|
697
738
|
* of the entries each layer resolves are UNIONED: the overlay can ADD fields
|
|
698
739
|
* but never drop ones the baked library already exposed (C4).
|
|
699
740
|
*/
|
|
700
|
-
resolveType(nodeType, version, objectName) {
|
|
741
|
+
resolveType(nodeType, version, objectName, report = true) {
|
|
742
|
+
// A generic operation that carries other objects but not this one is a miss
|
|
743
|
+
// too: a fetch writes only the objects asked for, so a second object is
|
|
744
|
+
// fetched when it is first asked for. Reported before resolving, because
|
|
745
|
+
// the layers may refuse the object or answer from a sibling's schema.
|
|
746
|
+
if (report && objectName && this.variantMissing(nodeType, objectName, version)) {
|
|
747
|
+
this.onMiss?.({ nodeType, ...(version ? { version } : {}), objectName });
|
|
748
|
+
}
|
|
701
749
|
// Resolve the op within each layer (overlay first), then union fields across
|
|
702
750
|
// the layers that carry it.
|
|
703
751
|
const resolved = [];
|
|
@@ -721,6 +769,10 @@ export class Library {
|
|
|
721
769
|
}
|
|
722
770
|
return { ...primary, fields: [...byName.values()] };
|
|
723
771
|
}
|
|
772
|
+
const missing = !this.carries(nodeType);
|
|
773
|
+
if (missing && report)
|
|
774
|
+
this.onMiss?.({ nodeType, ...(version ? { version } : {}), ...(objectName ? { objectName } : {}) });
|
|
775
|
+
const note = missing ? this.missNote?.(nodeType) : undefined;
|
|
724
776
|
// Name the two event namespaces when the caller asked for one, so a typo in
|
|
725
777
|
// an event name does not read as "this connector is missing".
|
|
726
778
|
const hint = /^uipath\.connector\.(trigger|event)\./.test(nodeType)
|
|
@@ -729,7 +781,8 @@ export class Library {
|
|
|
729
781
|
+ `\`…connector.trigger.…\` starts a flow, \`…connector.event.…\` waits mid-flow.`
|
|
730
782
|
: '';
|
|
731
783
|
throw new ConnectorResolveError('CONNECTOR_NOT_IN_LIBRARY', `connector not in library: ${nodeType}${version ? '@' + version : ''}.${hint}`
|
|
732
|
-
+ this.describeMiss(nodeType, version, objectName)
|
|
784
|
+
+ this.describeMiss(nodeType, version, objectName)
|
|
785
|
+
+ (note ? ` ${note}` : ''));
|
|
733
786
|
}
|
|
734
787
|
/**
|
|
735
788
|
* Turn a lookup miss into something actionable: which operations this connector
|
|
@@ -752,7 +805,8 @@ export class Library {
|
|
|
752
805
|
if (!key)
|
|
753
806
|
return '';
|
|
754
807
|
// `describe` names no folder: on a browser host it is a store the agent cannot open.
|
|
755
|
-
|
|
808
|
+
// No layer at all (nothing pulled, nothing fetched yet) searched nothing worth naming.
|
|
809
|
+
const where = searched && this.layers.length > 0 ? ` Searched: ${this.layers.map((l) => l.dir).join(', ')}.` : '';
|
|
756
810
|
if (eventNs)
|
|
757
811
|
return this.describeEventMiss(parts[2], key, asked, where, version, objectName);
|
|
758
812
|
const ops = this.opsUnder(`uipath.connector.${key}.`);
|
|
@@ -779,7 +833,30 @@ export class Library {
|
|
|
779
833
|
.map((t) => t.slice(prefix.length))
|
|
780
834
|
.filter((op) => op !== '' && !op.includes('.'))))].sort();
|
|
781
835
|
}
|
|
836
|
+
/**
|
|
837
|
+
* Whether `nodeType` is a GENERIC operation the layers carry for other objects
|
|
838
|
+
* but not for `objectName` (in any case). False for a curated operation, where
|
|
839
|
+
* an object is the author's mistake, and for one whose objects come from the
|
|
840
|
+
* connection (`objectFromDiscovery`), which only `prepare --object` can fill.
|
|
841
|
+
*/
|
|
842
|
+
variantMissing(nodeType, objectName, version) {
|
|
843
|
+
const rows = this.layers.flatMap((l) => l.entries.filter((e) => e.nodeType === nodeType && (!version || e.version === version)));
|
|
844
|
+
if (rows.length === 0)
|
|
845
|
+
return false;
|
|
846
|
+
if (rows.some((row) => row.objectFromDiscovery === true))
|
|
847
|
+
return false;
|
|
848
|
+
// A generic event (start or wait form) is expanded per object too, and fetched per object.
|
|
849
|
+
const generic = rows.some((row) => row.activityType === 'Generic' || row.activityType === 'GenericExpanded' || row.activityType === 'GenericTrigger');
|
|
850
|
+
if (!generic)
|
|
851
|
+
return false;
|
|
852
|
+
const wanted = objectName.toLowerCase();
|
|
853
|
+
return !rows.some((row) => typeof row.objectName === 'string' && row.objectName.toLowerCase() === wanted);
|
|
854
|
+
}
|
|
782
855
|
/** Whether any layer indexes `nodeType` (at `version`, when one is asked for). */
|
|
856
|
+
/** {@link LibraryOpts.onConnectorMiss}, for a wire of `connectorKey` no layer could identify. */
|
|
857
|
+
noteConnectorMiss(connectorKey) {
|
|
858
|
+
this.onConnectorMiss?.(connectorKey);
|
|
859
|
+
}
|
|
783
860
|
carries(nodeType, version) {
|
|
784
861
|
return this.layers.some((l) => l.entries.some((e) => e.nodeType === nodeType && (!version || e.version === version)));
|
|
785
862
|
}
|