@uipath/maestro-builder-sdk 6.96.7 → 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.
Files changed (48) hide show
  1. package/README.md +2 -1
  2. package/dist/bpmn/check-cli.js +8 -4
  3. package/dist/bpmn/compile-cli.js +4 -3
  4. package/dist/bpmn/decompile-cli.js +15 -1
  5. package/dist/bpmn/decompile-pipeline.d.ts +5 -0
  6. package/dist/bpmn/decompile-pipeline.js +3 -3
  7. package/dist/bpmn/decompile-stamp.d.ts +13 -0
  8. package/dist/bpmn/decompile-stamp.js +8 -0
  9. package/dist/bpmn/decompile.d.ts +17 -4
  10. package/dist/bpmn/decompile.js +9 -4
  11. package/dist/bpmn/merge-cli.js +32 -4
  12. package/dist/bpmn/merge-source.d.ts +2 -0
  13. package/dist/bpmn/merge-source.js +1 -0
  14. package/dist/case/check-cli.js +4 -2
  15. package/dist/case/compile-cli.js +14 -9
  16. package/dist/case/decompile-cli.d.ts +1 -1
  17. package/dist/case/decompile-cli.js +12 -2
  18. package/dist/check-cli.js +12 -6
  19. package/dist/cli/commands/registry.js +2 -0
  20. package/dist/compile-cli.js +16 -10
  21. package/dist/core/cli-library.d.ts +18 -2
  22. package/dist/core/cli-library.js +25 -5
  23. package/dist/core/library.d.ts +74 -2
  24. package/dist/core/library.js +88 -11
  25. package/dist/decompile-cli.js +17 -2
  26. package/dist/decompile-stamp.d.ts +13 -0
  27. package/dist/decompile-stamp.js +7 -1
  28. package/dist/emit.js +5 -8
  29. package/dist/merge-cli.js +51 -1
  30. package/dist/registry/curated-overlay.d.ts +11 -0
  31. package/dist/registry/curated-overlay.js +27 -0
  32. package/dist/registry/describe-cli.d.ts +3 -0
  33. package/dist/registry/describe-cli.js +38 -6
  34. package/dist/registry/fetch/fetch-connectors.d.ts +21 -0
  35. package/dist/registry/fetch/fetch-connectors.js +84 -0
  36. package/dist/registry/fetch/fetch-definitions.d.ts +61 -0
  37. package/dist/registry/fetch/fetch-definitions.js +447 -0
  38. package/dist/registry/fetch/flow-requests.d.ts +14 -0
  39. package/dist/registry/fetch/flow-requests.js +81 -0
  40. package/dist/registry/fetch/with-fetched-definitions.d.ts +46 -0
  41. package/dist/registry/fetch/with-fetched-definitions.js +211 -0
  42. package/dist/registry/library-build/events.d.ts +9 -2
  43. package/dist/registry/library-build/events.js +4 -10
  44. package/dist/registry/pull-cli.d.ts +9 -0
  45. package/dist/registry/pull-cli.js +150 -10
  46. package/dist/registry/search-cli.d.ts +25 -0
  47. package/dist/registry/search-cli.js +94 -10
  48. package/package.json +4 -3
@@ -1,6 +1,10 @@
1
1
  import { printResult, reportResult } from '../cli-result.js';
2
2
  import { flagValue } from '../cli-run.js';
3
3
  import { openCliLibrary } from '../core/cli-library.js';
4
+ import { existsSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import { FETCHED_SOURCE, fetchableNodeType } from './fetch/fetch-definitions.js';
7
+ import { openWithFetchedDefinitions } from './fetch/with-fetched-definitions.js';
4
8
  import { PULL_COMMAND } from '../core/cli-spelling.js';
5
9
  import { renderMarkdownPage } from './generators/markdown/index.js';
6
10
  import { symbolIndex } from './naming.js';
@@ -12,28 +16,56 @@ import { symbolIndex } from './naming.js';
12
16
  * `connectors-local` overlay first, then the library. So after `registry prepare`
13
17
  * it shows the connection's real fields. It is rendered from the entry on each call,
14
18
  * so it needs no `library-md` tree and no file the agent must keep a path to.
19
+ *
20
+ * An operation no layer carries is fetched through `uip` into `connectors-local`
21
+ * first, and its page says it came from the tenant.
15
22
  */
16
23
  export async function run(argv) {
17
24
  const nodeType = argv[0];
18
- const library = openCliLibrary(argv);
25
+ // An operation no layer carries is fetched through `uip` first, so a page can
26
+ // be read with no library pulled (docs/CONNECTOR_LIBRARY_OPTIONAL_DESIGN.md).
27
+ const library = nodeType && !nodeType.startsWith('-')
28
+ ? await openWithFetchedDefinitions(argv, [{ nodeType, ...(flagValue(argv, '--object') ? { objectName: flagValue(argv, '--object') } : {}) }], { who: 'registry describe' })
29
+ : openCliLibrary(argv);
19
30
  if (!library) {
20
31
  console.error(`No connector library is cached. Run \`${PULL_COMMAND}\`, or pass --library <dir>.`);
21
32
  return 2;
22
33
  }
23
34
  let source;
35
+ let derived = false;
24
36
  try {
25
37
  source = library.pageSource(nodeType, flagValue(argv, '--connector-version'), flagValue(argv, '--object'));
26
38
  }
27
39
  catch (error) {
28
- console.error(error instanceof Error ? error.message : String(error));
29
- return 1;
40
+ // A start trigger is held (and fetched) as its wait form, which the start
41
+ // form is derived from: show that page, and say so.
42
+ const wait = fetchableNodeType(nodeType);
43
+ try {
44
+ if (wait === nodeType)
45
+ throw error;
46
+ source = library.pageSource(wait, flagValue(argv, '--connector-version'), flagValue(argv, '--object'));
47
+ derived = true;
48
+ }
49
+ catch {
50
+ console.error(error instanceof Error ? error.message : String(error));
51
+ return 1;
52
+ }
30
53
  }
54
+ const fetched = source.entry?.provenance?.source === FETCHED_SOURCE;
31
55
  // The symbol names `prepare`'s module exports: it counts GenericExpanded entries only when the overlay has one.
56
+ // A fetched definition has a module only once `registry pull` generated it; without one the page's example uses
57
+ // the string form, so it never imports a module that is not there.
58
+ const key = source.entry?.connector?.key;
59
+ const hasModule = !fetched || (typeof key === 'string' && existsSync(join(source.dir, `${key}.ts`)));
32
60
  const expanded = source.prepared && source.rows.some((e) => e?.activityType === 'GenericExpanded');
33
- const body = renderMarkdownPage(source.entry, source.v1def, { symbols: symbolIndex(source.rows, expanded), invariant: source.invariant });
61
+ const symbols = hasModule ? symbolIndex(source.rows, expanded) : new Map();
62
+ const body = renderMarkdownPage(source.entry, source.v1def, { symbols, invariant: source.invariant });
34
63
  // No path: on a browser host it names a store the agent cannot open.
35
- const origin = source.prepared ? 'the prepared copy from `registry prepare`' : 'the connector library';
36
- const page = `> Source: ${origin}\n\n${body.replace(/\n$/, '')}`;
64
+ const origin = fetched
65
+ ? 'the tenant, fetched through uip'
66
+ : source.prepared ? 'the prepared copy from `registry prepare`' : 'the connector library';
67
+ const note = derived ? `\n> ${nodeType} starts a flow; it is derived from this wait-form operation, which it shares its inputs with.` : '';
68
+ const page = `> Source: ${origin}${note}\n\n${body.replace(/\n$/, '')}`;
37
69
  // The page alone, so `uip … --output plain` prints just the Markdown.
38
70
  reportResult({ page });
39
71
  printResult(page);
@@ -0,0 +1,21 @@
1
+ import { type Reporter } from "../reporter.js";
2
+ import { type UipClient } from "../uip/client.js";
3
+ import { type FetchDefinitionsResult } from "./fetch-definitions.js";
4
+ export interface FetchConnectorsOptions {
5
+ overlayDir: string;
6
+ /** The module specifier the generated `<key>.ts` modules import the SDK by. */
7
+ importSpecifier: string;
8
+ client?: UipClient;
9
+ reporter?: Reporter;
10
+ timeoutMs?: number;
11
+ /** Node types not to fetch: the ones a library layer already holds. */
12
+ skip?: (nodeType: string) => boolean;
13
+ }
14
+ export interface FetchConnectorsResult extends FetchDefinitionsResult {
15
+ /** Connector keys the tenant's catalog lists nothing for, sorted. */
16
+ unlisted: string[];
17
+ /** The typed modules written into the overlay. */
18
+ modules: string[];
19
+ }
20
+ /** Fetch every operation the tenant serves for `keys` into `overlayDir`. */
21
+ export declare function fetchConnectors(keys: readonly string[], options: FetchConnectorsOptions): Promise<FetchConnectorsResult>;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `registry pull` for a connector when there is no library to pull it from:
3
+ * every action and event the tenant serves for it, fetched into
4
+ * `connectors-local`, with the typed modules an author imports.
5
+ *
6
+ * The connector's operations are what `uip maestro flow registry search <key>`
7
+ * lists — the tenant's live catalog, which on Automation Suite is the curated
8
+ * one. Each is fetched by {@link fetchDefinitions}, so this writes exactly what
9
+ * a later compile would have fetched on its own, ahead of time, plus the
10
+ * modules (`<key>.ts`) that `registry prepare` writes beside them.
11
+ */
12
+ import { regenerateDescriptors } from "../prepare/regenerate.js";
13
+ import { existsSync } from "node:fs";
14
+ import { join } from "node:path";
15
+ import { catalogServesNothing, refreshRegistryCatalog, registryCatalog } from "../prepare/actions.js";
16
+ import { INDEX_FILENAME } from "../prepare/overlay.js";
17
+ import { silentReporter } from "../reporter.js";
18
+ import { defaultUipClient } from "../uip/client.js";
19
+ import { fetchDefinitions, uipUnavailableReason, } from "./fetch-definitions.js";
20
+ /** Fetch every operation the tenant serves for `keys` into `overlayDir`. */
21
+ export async function fetchConnectors(keys, options) {
22
+ const empty = { fetched: [], notServed: [], failed: [], unlisted: [], modules: [] };
23
+ if (keys.length === 0)
24
+ return empty;
25
+ const client = options.client ?? defaultUipClient();
26
+ const reporter = options.reporter ?? silentReporter;
27
+ const unavailable = await uipUnavailableReason(client);
28
+ if (unavailable !== undefined)
29
+ return { ...empty, unavailable };
30
+ const requests = [];
31
+ const unlisted = [];
32
+ const failed = [];
33
+ // `registry search` answers from uip's copy of the tenant catalog, refetched
34
+ // when it is older than 30 minutes or another tenant's. A connector it lists
35
+ // nothing for is believed only after one `registry pull --force`, as
36
+ // `prepare` does; a refresh that fails or is partial makes it a failure.
37
+ let refresh;
38
+ for (const key of [...new Set(keys)].sort()) {
39
+ let catalog = await registryCatalog(client, key, options.timeoutMs);
40
+ if (catalog.failure === undefined && catalogServesNothing(catalog)) {
41
+ refresh ??= await refreshRegistryCatalog(client, options.timeoutMs);
42
+ catalog = await registryCatalog(client, key, options.timeoutMs);
43
+ const doubt = !refresh.ok ? `the catalog refresh failed: ${refresh.reason}` : refresh.partial;
44
+ if (catalogServesNothing(catalog) && doubt !== undefined) {
45
+ failed.push({ nodeType: key, reason: `uip's catalog lists nothing for it, and ${doubt}` });
46
+ continue;
47
+ }
48
+ }
49
+ if (catalog.failure !== undefined) {
50
+ failed.push({ nodeType: key, reason: catalog.failure });
51
+ continue;
52
+ }
53
+ if (catalogServesNothing(catalog)) {
54
+ unlisted.push(key);
55
+ continue;
56
+ }
57
+ const wanted = (nodeType) => !options.skip?.(nodeType);
58
+ for (const action of catalog.actions) {
59
+ const nodeType = `uipath.connector.${key}.${action}`;
60
+ if (wanted(nodeType))
61
+ requests.push({ nodeType });
62
+ }
63
+ // The wait form: what `registry get` serves without a connection, and what
64
+ // the library derives a start trigger from.
65
+ for (const event of catalog.events) {
66
+ const nodeType = `uipath.connector.event.${key}.${event.id}`;
67
+ if (wanted(nodeType))
68
+ requests.push({ nodeType });
69
+ }
70
+ }
71
+ const fetched = await fetchDefinitions(requests, {
72
+ overlayDir: options.overlayDir,
73
+ client,
74
+ reporter,
75
+ ...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
76
+ });
77
+ // Whenever the overlay holds anything, not only when this call added to it:
78
+ // a module deleted, or an overlay `prepare --json-only` wrote, still gets one,
79
+ // and a changed import specifier applies.
80
+ const modules = existsSync(join(options.overlayDir, INDEX_FILENAME))
81
+ ? regenerateDescriptors(options.overlayDir, options.importSpecifier)
82
+ : [];
83
+ return { ...fetched, failed: [...failed, ...fetched.failed], unlisted, modules };
84
+ }
@@ -0,0 +1,61 @@
1
+ import { type Reporter } from "../reporter.js";
2
+ import { type UipClient } from "../uip/client.js";
3
+ /** The provenance every fetched entry carries. */
4
+ export declare const FETCHED_SOURCE = "uip-fetch";
5
+ /** Set `FLOW_SDK_FETCH_DEFINITIONS=0` to never call `uip` for a missing definition. */
6
+ export declare const FETCH_DEFINITIONS_ENV = "FLOW_SDK_FETCH_DEFINITIONS";
7
+ /** Whether a missing definition may be fetched through `uip` in this process. */
8
+ export declare function fetchDefinitionsEnabled(env?: Record<string, string | undefined>): boolean;
9
+ /** One node type to fetch, as `Library`'s `onMiss` reports it. */
10
+ export interface DefinitionRequest {
11
+ nodeType: string;
12
+ version?: string;
13
+ objectName?: string;
14
+ }
15
+ export interface FetchDefinitionsOptions {
16
+ /** The `connectors-local` directory to merge into; created when missing. */
17
+ overlayDir: string;
18
+ client?: UipClient;
19
+ reporter?: Reporter;
20
+ /** Parallel `uip` calls. */
21
+ concurrency?: number;
22
+ timeoutMs?: number;
23
+ }
24
+ export interface FetchDefinitionsResult {
25
+ /** Node types written into the overlay, sorted. */
26
+ fetched: string[];
27
+ /** Node types the tenant answered "not found" for, sorted. */
28
+ notServed: string[];
29
+ /**
30
+ * Why nothing could be asked, when nothing could: `uip` is not installed, or
31
+ * not logged in. Set only when no request reached the tenant.
32
+ */
33
+ unavailable?: string;
34
+ /** Node types whose fetch failed for another reason, with the reason. */
35
+ failed: Array<{
36
+ nodeType: string;
37
+ reason: string;
38
+ }>;
39
+ }
40
+ /**
41
+ * The node type to ask the registry for: a start trigger as its wait form.
42
+ * `registry get` refuses the start form without `--connection-id`, and the
43
+ * library derives the start form from the wait form (`Library.resolveEvent`).
44
+ */
45
+ export declare function fetchableNodeType(nodeType: string): string;
46
+ /** Why `uip` cannot be asked anything, or `undefined` when it is logged in. */
47
+ export declare function uipUnavailableReason(client: UipClient): Promise<string | undefined>;
48
+ /**
49
+ * Fetch every requested node type the tenant serves into `overlayDir`.
50
+ *
51
+ * Never throws for a tenant answer: a node type the tenant does not serve is
52
+ * `notServed`, any other failure is `failed`, and a `uip` that cannot be asked
53
+ * at all is `unavailable`. The caller turns those into its own refusals.
54
+ *
55
+ * `registry get` answers from `uip`'s local copy of the tenant catalog, so a
56
+ * "not found" is believed only after one `uip maestro flow registry pull
57
+ * --force` and a second probe, as `prepare` does (`prepare/actions.ts`). When
58
+ * that refresh fails, or writes only part of the catalog, a node type still
59
+ * not found is `failed` with the reason, not `notServed`.
60
+ */
61
+ export declare function fetchDefinitions(requests: readonly DefinitionRequest[], options: FetchDefinitionsOptions): Promise<FetchDefinitionsResult>;