@uipath/maestro-builder-sdk 6.17.6 → 6.18.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.
Files changed (67) hide show
  1. package/dist/bindings-v2.js +15 -17
  2. package/dist/bpmn/bpmn-sdk.js +3 -2
  3. package/dist/bpmn/check.js +3 -2
  4. package/dist/bpmn/decompile.js +123 -137
  5. package/dist/bpmn/intsvc.js +7 -2
  6. package/dist/bpmn/serialize.js +1 -1
  7. package/dist/bpmn/typed-node.js +5 -4
  8. package/dist/case/check-cli.js +18 -4
  9. package/dist/case/check.d.ts +26 -1
  10. package/dist/case/check.js +80 -2
  11. package/dist/case/cli-library.d.ts +14 -0
  12. package/dist/case/cli-library.js +31 -0
  13. package/dist/case/compile-cli.js +12 -12
  14. package/dist/case/decompile.js +103 -109
  15. package/dist/case/entry-points.js +2 -1
  16. package/dist/case/merge.js +3 -5
  17. package/dist/case/serialize.js +1 -1
  18. package/dist/check.js +26 -10
  19. package/dist/cli/commands/case.js +10 -1
  20. package/dist/core/ceql.js +5 -2
  21. package/dist/core/connector-inputs.js +4 -4
  22. package/dist/core/event-checks.js +17 -2
  23. package/dist/core/event-filters.d.ts +38 -4
  24. package/dist/core/event-filters.js +63 -7
  25. package/dist/core/expr.d.ts +1 -1
  26. package/dist/core/expr.js +3 -3
  27. package/dist/core/json-file.d.ts +2 -0
  28. package/dist/core/json-file.js +4 -0
  29. package/dist/core/library.js +2 -1
  30. package/dist/core/node-envelope.d.ts +1 -0
  31. package/dist/core/node-envelope.js +1 -1
  32. package/dist/core/own-entry.d.ts +9 -0
  33. package/dist/core/own-entry.js +11 -0
  34. package/dist/core/ts-literal.d.ts +22 -0
  35. package/dist/core/ts-literal.js +37 -0
  36. package/dist/core/typed-raw-node.js +4 -3
  37. package/dist/decompile.js +238 -255
  38. package/dist/merge.js +10 -12
  39. package/dist/registry/compat/pystr.d.ts +2 -0
  40. package/dist/registry/compat/pystr.js +35 -0
  41. package/dist/registry/compat/pyvalue.d.ts +16 -0
  42. package/dist/registry/compat/pyvalue.js +35 -0
  43. package/dist/registry/generators/markdown/pyvalue.d.ts +1 -4
  44. package/dist/registry/generators/markdown/pyvalue.js +2 -30
  45. package/dist/registry/generators/markdown/sections/inputs.js +3 -2
  46. package/dist/registry/generators/type-tree.d.ts +1 -7
  47. package/dist/registry/generators/type-tree.js +5 -22
  48. package/dist/registry/library-build/build.js +6 -6
  49. package/dist/registry/library-build/canonical.js +25 -25
  50. package/dist/registry/library-build/context.js +5 -5
  51. package/dist/registry/library-build/enrich.js +18 -18
  52. package/dist/registry/library-build/events.js +25 -24
  53. package/dist/registry/library-build/generic-expand.js +21 -20
  54. package/dist/registry/library-build/plan.js +8 -8
  55. package/dist/registry/library-build/py.d.ts +3 -10
  56. package/dist/registry/library-build/py.js +9 -52
  57. package/dist/registry/library-build/schema-action.js +6 -6
  58. package/dist/registry/prepare/event.js +2 -2
  59. package/dist/registry/prepare/source-import.js +2 -9
  60. package/dist/registry/prepare/source-labels.js +2 -9
  61. package/dist/registry/prepare/support.d.ts +2 -6
  62. package/dist/registry/prepare/support.js +3 -58
  63. package/dist/registry/pull-cli.js +6 -14
  64. package/dist/registry/search-cli.js +2 -2
  65. package/dist/schema-version.js +0 -1
  66. package/dist/serialize.js +86 -76
  67. package/package.json +2 -2
@@ -10,7 +10,7 @@
10
10
  * discoverable from the catalog, because the library drops
11
11
  * `connectorMethodInfo.design`; this is what keeps the recipe.
12
12
  */
13
- import { get, isRecord, pyIter, pyOr, truthy } from "./py.js";
13
+ import { get, isPyDict, pyIter, pyOr, pyTruthy } from "./py.js";
14
14
  /**
15
15
  * Cascade order for parent fields: a parent another one needs comes first.
16
16
  *
@@ -70,9 +70,9 @@ export function schemaAction(connectorMethodInfo, inputFields) {
70
70
  let trigger = null;
71
71
  for (const rule of pyIter(pyOr(get(action, "rules"), []))) {
72
72
  const name = get(rule, "refFieldName");
73
- if (!truthy(name))
73
+ if (!pyTruthy(name))
74
74
  continue;
75
- if (truthy(get(rule, "refFieldValues")))
75
+ if (pyTruthy(get(rule, "refFieldValues")))
76
76
  parents.push(name);
77
77
  else if (trigger === null)
78
78
  trigger = name;
@@ -93,10 +93,10 @@ export function schemaAction(connectorMethodInfo, inputFields) {
93
93
  name: pyOr(get(action, "name"), ""),
94
94
  parents: orderByDependency(parents, inputFields),
95
95
  };
96
- if (truthy(trigger))
96
+ if (pyTruthy(trigger))
97
97
  record.trigger = trigger;
98
- const replacesInput = isRecord(remap) && get(remap, "input") === "replace";
99
- const replacesOutput = isRecord(remap) && get(remap, "output") === "replace";
98
+ const replacesInput = isPyDict(remap) && get(remap, "input") === "replace";
99
+ const replacesOutput = isPyDict(remap) && get(remap, "output") === "replace";
100
100
  if (replacesInput && replacesOutput)
101
101
  record.replaces = "both";
102
102
  else if (replacesInput)
@@ -22,7 +22,7 @@
22
22
  import { extractCanonical, nodeOf } from "../library-build/canonical.js";
23
23
  import { registryProbe } from "../library-build/context.js";
24
24
  import { EventDiscoveryError, eventFacts, mergeDescribeIntoNode, resolveEventFacts, triggersDescribe, triggersObjects, unionEventParameters, } from "../library-build/events.js";
25
- import { get, isRecord } from "../library-build/py.js";
25
+ import { get, isPyDict } from "../library-build/py.js";
26
26
  import { planLibrary } from "../library-build/plan.js";
27
27
  import { recordByoaVerification } from "./byoa-ledger.js";
28
28
  import { ConnectionRefusal, byoaConnections, byoaListing, restoreBindings } from "./connections.js";
@@ -153,7 +153,7 @@ export async function prepareEvent(ctx, options) {
153
153
  if (options.allObjects)
154
154
  throw new PrepareRefusal(eventAllObjectsMessage(), "EVENT_NO_ALL_OBJECTS");
155
155
  // `(raw.get("Data") or {}).get("Node") or raw.get("Node") or {}`.
156
- const raw = isRecord(payload) ? payload : {};
156
+ const raw = isPyDict(payload) ? payload : {};
157
157
  const node = pyOr(pyOr(get(pyOr(get(raw, "Data"), {}), "Node"), get(raw, "Node")), {});
158
158
  const entry = { ...canonical, operation: { ...canonical.operation } };
159
159
  const op = entry.operation;
@@ -19,11 +19,12 @@
19
19
  * Ported from `_IMPORT_RE`, `_resolves_to`, `_sources_importing`,
20
20
  * `_repoint_import` and `_repoint_source` in `prepare_connector.py`.
21
21
  */
22
- import { readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
22
+ import { readFileSync, readdirSync, realpathSync, writeFileSync } from "node:fs";
23
23
  import { basename, dirname, join, resolve } from "node:path";
24
24
  import { compareCodePoints } from "../compat/compare.js";
25
25
  import { relativePosix } from "../compat/paths.js";
26
26
  import { workPath } from "../../workdir.js";
27
+ import { isFile } from "../files.js";
27
28
  import { repointedLine, severalSourcesLine, sourceNotAFileLine } from "./messages.js";
28
29
  /**
29
30
  * `import … from "<specifier>"` — the specifier is group 3, quotes preserved.
@@ -170,14 +171,6 @@ export function repointImport(source, baked, prepared) {
170
171
  writeFileSync(source, rewritten, "utf8");
171
172
  return specifier;
172
173
  }
173
- function isFile(path) {
174
- try {
175
- return statSync(path).isFile();
176
- }
177
- catch {
178
- return false;
179
- }
180
- }
181
174
  /**
182
175
  * `_repoint_source`: repoint the author's import, or say why it was left
183
176
  * alone. The lines come back unprefixed; the caller prints each as
@@ -43,13 +43,14 @@
43
43
  * GUID-shaped labels are dropped: they are resource keys written directly, not
44
44
  * names to bind.
45
45
  */
46
- import { readFileSync, statSync } from "node:fs";
46
+ import { readFileSync } from "node:fs";
47
47
  import { basename, dirname, extname, resolve } from "node:path";
48
48
  import * as ts from "typescript";
49
49
  import { GUID_RE } from "../../core/binding-messages.js";
50
50
  import { relativePosix } from "../compat/paths.js";
51
51
  import { canonicalPath, flowSources, isRelativeSpecifier } from "./source-import.js";
52
52
  import { inWorkDir } from "../../workdir.js";
53
+ import { isFile } from "../files.js";
53
54
  const CALLEES = new Set([
54
55
  "connector", "onEvent", "waitForEvent", "eventTrigger", "dataService", "inlineAgent",
55
56
  ]);
@@ -59,14 +60,6 @@ const CALLEES = new Set([
59
60
  * `.dataService()` is the one call that binds a connection without naming one.
60
61
  */
61
62
  const DATA_SERVICE_KEY = "uipath-uipath-dataservice";
62
- function isFile(path) {
63
- try {
64
- return statSync(path).isFile();
65
- }
66
- catch {
67
- return false;
68
- }
69
- }
70
63
  /** Every label the sources under `cwd` (or `--source`) use for `connectorKey`. Reads files, writes nothing. */
71
64
  export function sourceBindingLabels(options) {
72
65
  const result = { connection: new Map(), folder: new Map(), otherConnectors: new Map(), unreadable: { connection: [], folder: [] } };
@@ -1,14 +1,10 @@
1
+ export { pyTruthy, pyOr } from "../compat/pyvalue.js";
2
+ export { pyReprString } from "../compat/pystr.js";
1
3
  export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
2
- /** `bool(value)` for JSON-shaped values: `[]`, `{}`, `""`, `0`, `None` are false. */
3
- export declare function pyTruthy(value: unknown): boolean;
4
- /** `a or b`. */
5
- export declare function pyOr<A, B>(a: A, b: B): A | B;
6
4
  /** `mapping.get(key, default)`: the value when the key is PRESENT (even as `null`), else the default. */
7
5
  export declare function pyGet<D>(mapping: Record<string, unknown>, key: string, dflt: D): unknown | D;
8
6
  /** `type(value).__name__` for JSON-shaped values. */
9
7
  export declare function pyTypeName(value: unknown): string;
10
- /** `repr(str)`: single quotes unless the text has a `'` and no `"`; escapes as CPython does. */
11
- export declare function pyReprString(s: string): string;
12
8
  /** `repr(value)` for JSON-shaped values (`'x'`, `True`, `None`, `[1, 'a']`, `{'k': 1}`). */
13
9
  export declare function pyRepr(value: unknown): string;
14
10
  /** `str(value)` for any JSON-shaped value: `pyStr` for scalars, `repr` for containers, as Python does. */
@@ -9,7 +9,9 @@
9
9
  * was about to explain it. Everything in this module is private to `prepare/`.
10
10
  */
11
11
  import { sep } from "node:path";
12
- import { pyStr } from "../compat/pystr.js";
12
+ import { pyReprString, pyStr } from "../compat/pystr.js";
13
+ export { pyTruthy, pyOr } from "../compat/pyvalue.js";
14
+ export { pyReprString } from "../compat/pystr.js";
13
15
  export function isPlainObject(value) {
14
16
  return (typeof value === "object" &&
15
17
  value !== null &&
@@ -17,28 +19,6 @@ export function isPlainObject(value) {
17
19
  !(value instanceof Map) &&
18
20
  !(value instanceof Set));
19
21
  }
20
- /** `bool(value)` for JSON-shaped values: `[]`, `{}`, `""`, `0`, `None` are false. */
21
- export function pyTruthy(value) {
22
- if (value === null || value === undefined)
23
- return false;
24
- if (typeof value === "boolean")
25
- return value;
26
- if (typeof value === "number")
27
- return value !== 0;
28
- if (typeof value === "string")
29
- return value.length > 0;
30
- if (Array.isArray(value))
31
- return value.length > 0;
32
- if (value instanceof Map || value instanceof Set)
33
- return value.size > 0;
34
- if (typeof value === "object")
35
- return Object.keys(value).length > 0;
36
- return true;
37
- }
38
- /** `a or b`. */
39
- export function pyOr(a, b) {
40
- return pyTruthy(a) ? a : b;
41
- }
42
22
  /** `mapping.get(key, default)`: the value when the key is PRESENT (even as `null`), else the default. */
43
23
  export function pyGet(mapping, key, dflt) {
44
24
  return Object.prototype.hasOwnProperty.call(mapping, key) ? mapping[key] : dflt;
@@ -64,41 +44,6 @@ export function pyTypeName(value) {
64
44
  return typeof value;
65
45
  }
66
46
  }
67
- /**
68
- * `str.isprintable()` is false for these categories (and true for the ASCII
69
- * space, which is in Zs). `repr` escapes exactly the non-printable ones.
70
- */
71
- const NOT_PRINTABLE = /[\p{Cc}\p{Cf}\p{Cs}\p{Co}\p{Cn}\p{Zl}\p{Zp}\p{Zs}]/u;
72
- function hex(codePoint, width) {
73
- return codePoint.toString(16).padStart(width, "0");
74
- }
75
- /** `repr(str)`: single quotes unless the text has a `'` and no `"`; escapes as CPython does. */
76
- export function pyReprString(s) {
77
- const quote = s.includes("'") && !s.includes('"') ? '"' : "'";
78
- let out = quote;
79
- for (const ch of s) {
80
- if (ch === quote || ch === "\\")
81
- out += `\\${ch}`;
82
- else if (ch === "\n")
83
- out += "\\n";
84
- else if (ch === "\r")
85
- out += "\\r";
86
- else if (ch === "\t")
87
- out += "\\t";
88
- else if (ch !== " " && NOT_PRINTABLE.test(ch)) {
89
- const codePoint = ch.codePointAt(0);
90
- out +=
91
- codePoint < 0x100
92
- ? `\\x${hex(codePoint, 2)}`
93
- : codePoint < 0x10000
94
- ? `\\u${hex(codePoint, 4)}`
95
- : `\\U${hex(codePoint, 8)}`;
96
- }
97
- else
98
- out += ch;
99
- }
100
- return out + quote;
101
- }
102
47
  /** `repr(value)` for JSON-shaped values (`'x'`, `True`, `None`, `[1, 'a']`, `{'k': 1}`). */
103
48
  export function pyRepr(value) {
104
49
  if (typeof value === "string")
@@ -106,7 +106,7 @@ function expectedChecksum(body) {
106
106
  }
107
107
  return hash;
108
108
  }
109
- async function isFile(path) {
109
+ async function isFileAsync(path) {
110
110
  try {
111
111
  return (await stat(path)).isFile();
112
112
  }
@@ -114,14 +114,6 @@ async function isFile(path) {
114
114
  return false;
115
115
  }
116
116
  }
117
- async function isDirectory(path) {
118
- try {
119
- return (await stat(path)).isDirectory();
120
- }
121
- catch {
122
- return false;
123
- }
124
- }
125
117
  async function download(url) {
126
118
  const response = await fetch(url);
127
119
  if (!response.ok) {
@@ -151,7 +143,7 @@ async function resolveArchive(argv, cacheDir, force) {
151
143
  // The caller's own file: no sidecar to check it against, and demanding one
152
144
  // would defeat the escape hatch this exists to be. It is hashed anyway, so
153
145
  // it still gets a cache entry of its own.
154
- if (!(await isFile(local))) {
146
+ if (!(await isFileAsync(local))) {
155
147
  throw new Error(`No such archive: ${local}`);
156
148
  }
157
149
  return { path: local };
@@ -169,7 +161,7 @@ async function resolveArchive(argv, cacheDir, force) {
169
161
  const expected = expectedChecksum(await checksumResponse.text());
170
162
  await mkdir(cacheDir, { recursive: true });
171
163
  const cached = join(cacheDir, `${expected}.zip`);
172
- if (!force && (await isFile(cached))) {
164
+ if (!force && (await isFileAsync(cached))) {
173
165
  console.error(`registry pull: reusing cached ${expected.slice(0, 12)}…`);
174
166
  return { path: cached, checksum: expected, url };
175
167
  }
@@ -200,7 +192,7 @@ function libraryIdentity(archiveSha256, overlaySha256) {
200
192
  .digest("hex");
201
193
  }
202
194
  async function isCurrentLibrary(libraryPath, sha256) {
203
- if (!(await isFile(join(libraryPath, "index.json"))))
195
+ if (!(await isFileAsync(join(libraryPath, "index.json"))))
204
196
  return false;
205
197
  try {
206
198
  const source = JSON.parse(await readFile(join(libraryPath, SOURCE_FILE), "utf8"));
@@ -287,7 +279,7 @@ export async function run(argv) {
287
279
  // Generate only what is missing. The Markdown is 2,472 pages and a pure
288
280
  // function of the library JSON, so regenerating it to add one descriptor is
289
281
  // pure waste — and it is what the first run of this design did.
290
- const haveMarkdown = !force && haveLibrary && (await isFile(join(markdownPath, "index.json")));
282
+ const haveMarkdown = !force && haveLibrary && (await isFileAsync(join(markdownPath, "index.json")));
291
283
  if (haveMarkdown) {
292
284
  console.error(`registry pull: markdown ${sha256.slice(0, 12)}… already generated`);
293
285
  }
@@ -303,7 +295,7 @@ export async function run(argv) {
303
295
  triggersPath: value(argv, "--triggers"),
304
296
  });
305
297
  }
306
- if (!(await isFile(join(markdownPath, "index.json")))) {
298
+ if (!(await isFileAsync(join(markdownPath, "index.json")))) {
307
299
  throw new Error(`Registry materialization did not produce ${join(markdownPath, "index.json")}.`);
308
300
  }
309
301
  if (!value(argv, "--library")) {
@@ -23,7 +23,7 @@ export function queryTokens(query) {
23
23
  .split(/\s+/)
24
24
  .filter((token) => token.length > 0);
25
25
  }
26
- async function isDirectory(path) {
26
+ async function isDirectoryAsync(path) {
27
27
  try {
28
28
  return (await stat(path)).isDirectory();
29
29
  }
@@ -43,7 +43,7 @@ async function resolveMarkdownRoot(libraryPath, explicit) {
43
43
  if (explicit)
44
44
  return explicit;
45
45
  const sibling = join(dirname(libraryPath), "library-md");
46
- return (await isDirectory(sibling)) ? sibling : undefined;
46
+ return (await isDirectoryAsync(sibling)) ? sibling : undefined;
47
47
  }
48
48
  export async function searchRegistryOperations(options) {
49
49
  const indexPath = join(options.libraryPath, "index.json");
@@ -106,7 +106,6 @@ export function schemaVersionRefusal(policy, requested) {
106
106
  if (isWritableSchemaVersion(policy, requested))
107
107
  return undefined;
108
108
  const writable = writableSchemaVersions(policy);
109
- const newest = writable[writable.length - 1];
110
109
  const direction = policy.latestKnown !== undefined && schemaVersionAtLeast(requested, policy.latestKnown)
111
110
  ? compareSchemaVersions(requested, policy.latestKnown) > 0
112
111
  ? `The platform's newest known ${family} schema version is ${policy.latestKnown}, so ${requested} is newer than anything this SDK has read.`