@uipath/maestro-builder-sdk 6.96.6 → 6.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/bpmn/check-cli.js +8 -4
- package/dist/bpmn/compile-cli.js +4 -3
- package/dist/bpmn/decompile-cli.js +15 -1
- package/dist/bpmn/decompile-pipeline.d.ts +5 -0
- package/dist/bpmn/decompile-pipeline.js +3 -3
- package/dist/bpmn/decompile-stamp.d.ts +13 -0
- package/dist/bpmn/decompile-stamp.js +8 -0
- package/dist/bpmn/decompile.d.ts +17 -4
- package/dist/bpmn/decompile.js +9 -4
- package/dist/bpmn/merge-cli.js +32 -4
- package/dist/bpmn/merge-source.d.ts +2 -0
- package/dist/bpmn/merge-source.js +1 -0
- package/dist/case/check-cli.js +4 -2
- package/dist/case/compile-cli.js +14 -9
- package/dist/case/decompile-cli.d.ts +1 -1
- package/dist/case/decompile-cli.js +12 -2
- package/dist/check-cli.js +12 -6
- package/dist/cli/commands/registry.js +2 -0
- package/dist/compile-cli.js +16 -10
- package/dist/core/agent-sidecar.d.ts +16 -4
- package/dist/core/agent-sidecar.js +20 -7
- package/dist/core/cli-library.d.ts +18 -2
- package/dist/core/cli-library.js +25 -5
- package/dist/core/library.d.ts +74 -2
- package/dist/core/library.js +88 -11
- package/dist/decompile-cli.js +17 -2
- package/dist/decompile-stamp.d.ts +13 -0
- package/dist/decompile-stamp.js +7 -1
- package/dist/emit.js +5 -8
- package/dist/merge-cli.js +51 -1
- package/dist/nodes/agent/flow/check.js +13 -2
- package/dist/registry/curated-overlay.d.ts +11 -0
- package/dist/registry/curated-overlay.js +27 -0
- package/dist/registry/describe-cli.d.ts +3 -0
- package/dist/registry/describe-cli.js +38 -6
- package/dist/registry/fetch/fetch-connectors.d.ts +21 -0
- package/dist/registry/fetch/fetch-connectors.js +84 -0
- package/dist/registry/fetch/fetch-definitions.d.ts +61 -0
- package/dist/registry/fetch/fetch-definitions.js +447 -0
- package/dist/registry/fetch/flow-requests.d.ts +14 -0
- package/dist/registry/fetch/flow-requests.js +81 -0
- package/dist/registry/fetch/with-fetched-definitions.d.ts +46 -0
- package/dist/registry/fetch/with-fetched-definitions.js +211 -0
- package/dist/registry/library-build/events.d.ts +9 -2
- package/dist/registry/library-build/events.js +4 -10
- package/dist/registry/pull-cli.d.ts +9 -0
- package/dist/registry/pull-cli.js +150 -10
- package/dist/registry/search-cli.d.ts +25 -0
- package/dist/registry/search-cli.js +94 -10
- package/package.json +4 -3
|
@@ -324,12 +324,24 @@ function promptTokens(content) {
|
|
|
324
324
|
/** The `maxIterations` Studio Web writes into every inline agent's `agent.json` (flow-workbench `getDefaultAgentContent()`). */
|
|
325
325
|
const STUDIO_WEB_DEFAULT_MAX_ITERATIONS = 25;
|
|
326
326
|
/**
|
|
327
|
-
* The agent configuration
|
|
327
|
+
* The agent configuration an agent node keeps in its sidecar, read from
|
|
328
328
|
* `<source>/agent.json` in the node's own input names: the prompts, the model,
|
|
329
329
|
* the run settings (`temperature`, `maxTokenPerResponse`, `maxIterations`,
|
|
330
|
-
* `mode`), the `guardrails` and (voice) the `voice` settings. Empty when
|
|
331
|
-
*
|
|
332
|
-
*
|
|
330
|
+
* `mode`), the `guardrails` and (voice) the `voice` settings. Empty when no
|
|
331
|
+
* sidecar can be read. The caller spreads the node's own inputs over this, so
|
|
332
|
+
* a key on the node wins.
|
|
333
|
+
*
|
|
334
|
+
* The sidecar is read for an EMBEDDED node too (one that carries prompts
|
|
335
|
+
* itself, e.g. a `.flow` saved by Studio Web with the self-contained flag on,
|
|
336
|
+
* or a hand-built one): such a node often carries its prompts and no `model`,
|
|
337
|
+
* and the model is then only in `settings.model`. That is how the platform
|
|
338
|
+
* reads it as well: `uip maestro flow validate` and `flow pack` copy each
|
|
339
|
+
* sidecar value onto the node unless the node already has that key
|
|
340
|
+
* (`hydrateAgentNodeInputs`, uipath-cli `packager-tool-flow/src/flow-validation.ts`),
|
|
341
|
+
* and the packaged agent is built from `agent.json`. Skipping the sidecar for
|
|
342
|
+
* such a node decompiled `model: ""`, and compile then wrote `"model": ""`
|
|
343
|
+
* over the sidecar's real model. For an embedded node a missing sidecar is
|
|
344
|
+
* normal (a self-contained `.flow` needs none), so it is not warned about.
|
|
333
345
|
*
|
|
334
346
|
* A run setting equal to the default a sidecar writer fills in (`temperature`
|
|
335
347
|
* 0, `maxTokens` 16384, `mode` `'standard'`) is not recovered: recompiling
|
|
@@ -342,13 +354,14 @@ const STUDIO_WEB_DEFAULT_MAX_ITERATIONS = 25;
|
|
|
342
354
|
*/
|
|
343
355
|
export function agentSidecarInputs(o) {
|
|
344
356
|
const { inputs, source, dialect } = o;
|
|
345
|
-
|
|
346
|
-
return {};
|
|
357
|
+
const embedded = typeof inputs.systemPrompt === 'string' || typeof inputs.userPrompt === 'string';
|
|
347
358
|
if (!source)
|
|
348
359
|
return {};
|
|
349
360
|
const path = `${source}/agent.json`;
|
|
350
361
|
const raw = o.read?.(path);
|
|
351
362
|
if (raw === undefined) {
|
|
363
|
+
if (embedded)
|
|
364
|
+
return {};
|
|
352
365
|
o.warn(`agent step "${o.nodeId}" carries no prompts and ${path} was not found beside the .flow, `
|
|
353
366
|
+ 'so its prompts, model and run settings decompile empty. Keep <source>/agent.json beside the .flow '
|
|
354
367
|
+ '(download the whole project, not just the .flow).');
|
|
@@ -359,7 +372,7 @@ export function agentSidecarInputs(o) {
|
|
|
359
372
|
agent = JSON.parse(raw);
|
|
360
373
|
}
|
|
361
374
|
catch {
|
|
362
|
-
o.warn(`agent step "${o.nodeId}": ${path} is not valid JSON, so its prompts, model and run settings decompile empty.`);
|
|
375
|
+
o.warn(`agent step "${o.nodeId}": ${path} is not valid JSON, so its ${embedded ? '' : 'prompts, '}model and run settings decompile empty.`);
|
|
363
376
|
return {};
|
|
364
377
|
}
|
|
365
378
|
const messages = (Array.isArray(agent?.messages) ? agent.messages : []);
|
|
@@ -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
|
}
|
package/dist/decompile-cli.js
CHANGED
|
@@ -39,7 +39,9 @@ import { PACKAGE_NAME } from './package-name.js';
|
|
|
39
39
|
import { commentText } from './core/comment-text.js';
|
|
40
40
|
import { loadNodePackages } from './node-packages.js';
|
|
41
41
|
import { pipelineFrontDoor } from './registry/uip/pipeline-front-door.js';
|
|
42
|
-
import {
|
|
42
|
+
import { flowConnectorRequests } from './registry/fetch/flow-requests.js';
|
|
43
|
+
import { openWithFetchedDefinitions } from './registry/fetch/with-fetched-definitions.js';
|
|
44
|
+
import { fetchableNodeType } from './registry/fetch/fetch-definitions.js';
|
|
43
45
|
/** Derive a PascalCase base name from the flow name/id for the default output file. */
|
|
44
46
|
function baseName(flow) {
|
|
45
47
|
const src = flow.name ?? flow.id ?? 'Flow';
|
|
@@ -83,15 +85,26 @@ export async function run(argv) {
|
|
|
83
85
|
// for is carried from the file instead of being refused on recompile. Decompile
|
|
84
86
|
// needs no library otherwise: one it cannot read (a corrupt or half-written
|
|
85
87
|
// cache) is a warning, and the source is written with nothing carried.
|
|
88
|
+
//
|
|
89
|
+
// What the file uses and no layer carries is fetched through `uip` first
|
|
90
|
+
// (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md), so the carry decision is made
|
|
91
|
+
// against what the tenant serves: only an operation the tenant does not serve
|
|
92
|
+
// is carried from the file.
|
|
86
93
|
let library;
|
|
87
94
|
try {
|
|
88
|
-
library =
|
|
95
|
+
library = await openWithFetchedDefinitions(argv, flowConnectorRequests(flow), { who: 'flow-decompile' });
|
|
89
96
|
}
|
|
90
97
|
catch (error) {
|
|
91
98
|
console.error(`flow-decompile: warning: connector library unreadable (${error instanceof Error ? error.message : String(error)}); nothing is carried`);
|
|
92
99
|
library = undefined;
|
|
93
100
|
}
|
|
94
101
|
const strict = argv.includes('--strict');
|
|
102
|
+
// What the library lacked as decompile saw it: those operations are carried
|
|
103
|
+
// from the file. Recorded in the stamp, so `flow merge` can hide them again and
|
|
104
|
+
// derive the same source even after they have been fetched (decompile-stamp.ts).
|
|
105
|
+
const lacked = library === undefined ? [] : [...new Set(flowConnectorRequests(flow)
|
|
106
|
+
.map((r) => r.nodeType)
|
|
107
|
+
.filter((nodeType) => !library.indexes(nodeType) && !library.indexes(fetchableNodeType(nodeType))))].sort();
|
|
95
108
|
const ts = decompileFlowFile(pos, flow, {
|
|
96
109
|
importSpecifier: flagValue(argv, '--import') ?? PACKAGE_NAME,
|
|
97
110
|
...(library ? { library } : {}),
|
|
@@ -112,6 +125,8 @@ export async function run(argv) {
|
|
|
112
125
|
scripts,
|
|
113
126
|
strict,
|
|
114
127
|
packages: packages.loaded.map((p) => p.package),
|
|
128
|
+
lacked,
|
|
129
|
+
fetch: true,
|
|
115
130
|
});
|
|
116
131
|
const out = flagValue(argv, '-o') ?? defaultSourceOut(`${baseName(flow)}.flow.ts`);
|
|
117
132
|
writeSource(out, stamped);
|
|
@@ -11,6 +11,19 @@ export interface FlowDecompileStamp {
|
|
|
11
11
|
strict: boolean;
|
|
12
12
|
/** The node-type packages decompile loaded. */
|
|
13
13
|
packages: string[];
|
|
14
|
+
/**
|
|
15
|
+
* The connector node types no library layer held when decompiled, so decompile
|
|
16
|
+
* carried them from the file. `flow merge` hides them again to derive the
|
|
17
|
+
* baseline, whatever has been fetched or prepared for them since.
|
|
18
|
+
*/
|
|
19
|
+
lacked: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Written by a decompile that records `lacked` (the `fetch` token). Without
|
|
22
|
+
* it the stamp predates fetching through `uip`, and an empty `lacked` says
|
|
23
|
+
* nothing: `flow merge` then hides every fetched row instead, which is the
|
|
24
|
+
* library such a decompile saw.
|
|
25
|
+
*/
|
|
26
|
+
fetch: boolean;
|
|
14
27
|
}
|
|
15
28
|
/** The stamp line, without a line terminator. */
|
|
16
29
|
export declare function formatFlowStamp(stamp: FlowDecompileStamp): string;
|
package/dist/decompile-stamp.js
CHANGED
|
@@ -30,6 +30,8 @@ export function formatFlowStamp(stamp) {
|
|
|
30
30
|
`scripts=${stamp.scripts}`,
|
|
31
31
|
...(stamp.strict ? ['strict'] : []),
|
|
32
32
|
...(stamp.packages.length > 0 ? [`packages=${stamp.packages.join(',')}`] : []),
|
|
33
|
+
...(stamp.lacked.length > 0 ? [`lacked=${stamp.lacked.join(',')}`] : []),
|
|
34
|
+
...(stamp.fetch ? ['fetch'] : []),
|
|
33
35
|
],
|
|
34
36
|
});
|
|
35
37
|
}
|
|
@@ -49,7 +51,7 @@ export function readFlowStamp(source) {
|
|
|
49
51
|
if (read === undefined || 'error' in read)
|
|
50
52
|
return read;
|
|
51
53
|
const { line } = read;
|
|
52
|
-
const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [] };
|
|
54
|
+
const stamp = { file: read.file, sha256: read.sha256, scripts: 'function', strict: false, packages: [], lacked: [], fetch: false };
|
|
53
55
|
const seen = new Set();
|
|
54
56
|
for (const token of read.options) {
|
|
55
57
|
const [key, value] = token.split('=', 2);
|
|
@@ -62,6 +64,10 @@ export function readFlowStamp(source) {
|
|
|
62
64
|
stamp.strict = true;
|
|
63
65
|
else if (key === 'packages' && value)
|
|
64
66
|
stamp.packages = value.split(',');
|
|
67
|
+
else if (key === 'lacked' && value)
|
|
68
|
+
stamp.lacked = value.split(',');
|
|
69
|
+
else if (key === 'fetch' && value === undefined)
|
|
70
|
+
stamp.fetch = true;
|
|
65
71
|
else
|
|
66
72
|
return { error: `unknown option \`${token}\`: ${line}` };
|
|
67
73
|
}
|
package/dist/emit.js
CHANGED
|
@@ -26,25 +26,22 @@
|
|
|
26
26
|
* the static pass should call `check()` — or use `compile-cli`.
|
|
27
27
|
*/
|
|
28
28
|
import { existsSync, mkdirSync } from 'node:fs';
|
|
29
|
-
import { dirname
|
|
29
|
+
import { dirname } from 'node:path';
|
|
30
30
|
import { serialize } from './serialize.js';
|
|
31
|
-
import { Library } from './library.js';
|
|
32
31
|
import { Bindings } from './bindings.js';
|
|
33
|
-
import {
|
|
32
|
+
import { openCliLibrary } from './core/cli-library.js';
|
|
34
33
|
import { defaultBindingsFile, defaultResourcesFile } from './workdir.js';
|
|
35
34
|
import { readCliResources } from './registry/prepare/resources.js';
|
|
36
35
|
import { writeJsonFile } from './core/json-file.js';
|
|
37
36
|
/**
|
|
38
|
-
* Resolve the connector library the
|
|
37
|
+
* Resolve the connector library the way `compile-cli` does (`openCliLibrary`),
|
|
38
|
+
* with the `connectors-local` overlay `registry prepare` writes: only load it
|
|
39
39
|
* when it is actually there, so a flow with no connectors emits fine without a
|
|
40
40
|
* built library. A connector action with no library then fails inside
|
|
41
41
|
* `serialize()` with its own clear error.
|
|
42
42
|
*/
|
|
43
43
|
function defaultLibrary(dir) {
|
|
44
|
-
|
|
45
|
-
if (!libDir || !existsSync(join(libDir, 'index.json')))
|
|
46
|
-
return undefined;
|
|
47
|
-
return new Library(libDir);
|
|
44
|
+
return openCliLibrary(dir === undefined ? [] : ['--library', dir]);
|
|
48
45
|
}
|
|
49
46
|
/** The default resource ledger, parsed, when there is one. */
|
|
50
47
|
function defaultResources() {
|