@uipath/maestro-builder-sdk 6.4.0 → 6.5.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 (161) hide show
  1. package/dist/bpmn/uipath-moddle.v1.json +21 -0
  2. package/dist/cli/commands/registry.js +68 -12
  3. package/dist/registry/archive/entry-policy.d.ts +36 -0
  4. package/dist/registry/archive/entry-policy.js +60 -0
  5. package/dist/registry/archive/extract.d.ts +31 -0
  6. package/dist/registry/archive/extract.js +92 -0
  7. package/dist/registry/archive/zip-reader.d.ts +38 -0
  8. package/dist/registry/archive/zip-reader.js +256 -0
  9. package/dist/registry/codecs/pyjson.d.ts +62 -0
  10. package/dist/registry/codecs/pyjson.js +208 -0
  11. package/dist/registry/compat/compare.d.ts +18 -0
  12. package/dist/registry/compat/compare.js +32 -0
  13. package/dist/registry/compat/paths.d.ts +4 -0
  14. package/dist/registry/compat/paths.js +17 -0
  15. package/dist/registry/compat/pystr.d.ts +50 -0
  16. package/dist/registry/compat/pystr.js +221 -0
  17. package/dist/registry/concurrency.d.ts +10 -0
  18. package/dist/registry/concurrency.js +34 -0
  19. package/dist/registry/curated-overlay.d.ts +36 -4
  20. package/dist/registry/curated-overlay.js +87 -14
  21. package/dist/registry/errors.d.ts +26 -0
  22. package/dist/registry/errors.js +38 -0
  23. package/dist/registry/extractor.d.ts +9 -10
  24. package/dist/registry/extractor.js +5 -15
  25. package/dist/registry/files.d.ts +26 -0
  26. package/dist/registry/files.js +160 -0
  27. package/dist/registry/generators/descriptors.d.ts +81 -0
  28. package/dist/registry/generators/descriptors.js +405 -0
  29. package/dist/registry/generators/fields.d.ts +46 -0
  30. package/dist/registry/generators/fields.js +111 -0
  31. package/dist/registry/generators/markdown/common.d.ts +21 -0
  32. package/dist/registry/generators/markdown/common.js +55 -0
  33. package/dist/registry/generators/markdown/index.d.ts +33 -0
  34. package/dist/registry/generators/markdown/index.js +37 -0
  35. package/dist/registry/generators/markdown/page.d.ts +8 -0
  36. package/dist/registry/generators/markdown/page.js +52 -0
  37. package/dist/registry/generators/markdown/pyvalue.d.ts +34 -0
  38. package/dist/registry/generators/markdown/pyvalue.js +106 -0
  39. package/dist/registry/generators/markdown/sections/choosing-object.d.ts +2 -0
  40. package/dist/registry/generators/markdown/sections/choosing-object.js +52 -0
  41. package/dist/registry/generators/markdown/sections/example.d.ts +22 -0
  42. package/dist/registry/generators/markdown/sections/example.js +295 -0
  43. package/dist/registry/generators/markdown/sections/filtering.d.ts +2 -0
  44. package/dist/registry/generators/markdown/sections/filtering.js +76 -0
  45. package/dist/registry/generators/markdown/sections/header.d.ts +2 -0
  46. package/dist/registry/generators/markdown/sections/header.js +37 -0
  47. package/dist/registry/generators/markdown/sections/inputs.d.ts +30 -0
  48. package/dist/registry/generators/markdown/sections/inputs.js +151 -0
  49. package/dist/registry/generators/markdown/sections/lookups.d.ts +12 -0
  50. package/dist/registry/generators/markdown/sections/lookups.js +150 -0
  51. package/dist/registry/generators/markdown/sections/outputs.d.ts +3 -0
  52. package/dist/registry/generators/markdown/sections/outputs.js +9 -0
  53. package/dist/registry/generators/markdown/sections/resolving-fields.d.ts +2 -0
  54. package/dist/registry/generators/markdown/sections/resolving-fields.js +139 -0
  55. package/dist/registry/generators/markdown/sections/schema-dynamic.d.ts +2 -0
  56. package/dist/registry/generators/markdown/sections/schema-dynamic.js +86 -0
  57. package/dist/registry/generators/materialize.d.ts +30 -0
  58. package/dist/registry/generators/materialize.js +132 -0
  59. package/dist/registry/generators/md-symbols.d.ts +22 -0
  60. package/dist/registry/generators/md-symbols.js +58 -0
  61. package/dist/registry/generators/triggers.d.ts +15 -0
  62. package/dist/registry/generators/triggers.js +85 -0
  63. package/dist/registry/generators/type-registry.d.ts +50 -0
  64. package/dist/registry/generators/type-registry.js +154 -0
  65. package/dist/registry/generators/type-tree.d.ts +65 -0
  66. package/dist/registry/generators/type-tree.js +179 -0
  67. package/dist/registry/library-build/build.d.ts +57 -0
  68. package/dist/registry/library-build/build.js +286 -0
  69. package/dist/registry/library-build/canonical.d.ts +119 -0
  70. package/dist/registry/library-build/canonical.js +512 -0
  71. package/dist/registry/library-build/cli.d.ts +45 -0
  72. package/dist/registry/library-build/cli.js +182 -0
  73. package/dist/registry/library-build/context.d.ts +107 -0
  74. package/dist/registry/library-build/context.js +267 -0
  75. package/dist/registry/library-build/enrich.d.ts +36 -0
  76. package/dist/registry/library-build/enrich.js +158 -0
  77. package/dist/registry/library-build/events.d.ts +108 -0
  78. package/dist/registry/library-build/events.js +476 -0
  79. package/dist/registry/library-build/generic-expand.d.ts +77 -0
  80. package/dist/registry/library-build/generic-expand.js +363 -0
  81. package/dist/registry/library-build/plan.d.ts +71 -0
  82. package/dist/registry/library-build/plan.js +270 -0
  83. package/dist/registry/library-build/py.d.ts +45 -0
  84. package/dist/registry/library-build/py.js +167 -0
  85. package/dist/registry/library-build/schema-action.d.ts +38 -0
  86. package/dist/registry/library-build/schema-action.js +107 -0
  87. package/dist/registry/library-build/write.d.ts +6 -0
  88. package/dist/registry/library-build/write.js +26 -0
  89. package/dist/registry/library-reader.d.ts +20 -0
  90. package/dist/registry/library-reader.js +50 -0
  91. package/dist/registry/lookup-specs.d.ts +55 -0
  92. package/dist/registry/lookup-specs.js +140 -0
  93. package/dist/registry/materialize-cli.js +28 -14
  94. package/dist/registry/materializer.d.ts +25 -3
  95. package/dist/registry/materializer.js +45 -29
  96. package/dist/registry/model/library.d.ts +254 -0
  97. package/dist/registry/model/library.js +23 -0
  98. package/dist/registry/naming.d.ts +54 -0
  99. package/dist/registry/naming.js +142 -0
  100. package/dist/registry/orphans.d.ts +4 -0
  101. package/dist/registry/orphans.js +86 -0
  102. package/dist/registry/prepare/actions.d.ts +26 -0
  103. package/dist/registry/prepare/actions.js +94 -0
  104. package/dist/registry/prepare/connections.d.ts +181 -0
  105. package/dist/registry/prepare/connections.js +399 -0
  106. package/dist/registry/prepare/event.d.ts +96 -0
  107. package/dist/registry/prepare/event.js +268 -0
  108. package/dist/registry/prepare/handoff.d.ts +21 -0
  109. package/dist/registry/prepare/handoff.js +91 -0
  110. package/dist/registry/prepare/ledger.d.ts +104 -0
  111. package/dist/registry/prepare/ledger.js +216 -0
  112. package/dist/registry/prepare/messages.d.ts +190 -0
  113. package/dist/registry/prepare/messages.js +472 -0
  114. package/dist/registry/prepare/objects.d.ts +130 -0
  115. package/dist/registry/prepare/objects.js +318 -0
  116. package/dist/registry/prepare/overlay.d.ts +149 -0
  117. package/dist/registry/prepare/overlay.js +487 -0
  118. package/dist/registry/prepare/parents.d.ts +41 -0
  119. package/dist/registry/prepare/parents.js +122 -0
  120. package/dist/registry/prepare/pipeline.d.ts +91 -0
  121. package/dist/registry/prepare/pipeline.js +376 -0
  122. package/dist/registry/prepare/regenerate.d.ts +9 -0
  123. package/dist/registry/prepare/regenerate.js +50 -0
  124. package/dist/registry/prepare/resolve.d.ts +199 -0
  125. package/dist/registry/prepare/resolve.js +470 -0
  126. package/dist/registry/prepare/retry.d.ts +83 -0
  127. package/dist/registry/prepare/retry.js +109 -0
  128. package/dist/registry/prepare/source-import.d.ts +54 -0
  129. package/dist/registry/prepare/source-import.js +192 -0
  130. package/dist/registry/prepare/support.d.ts +41 -0
  131. package/dist/registry/prepare/support.js +178 -0
  132. package/dist/registry/prepare-cli.d.ts +16 -5
  133. package/dist/registry/prepare-cli.js +60 -53
  134. package/dist/registry/pull-cli.js +8 -7
  135. package/dist/registry/reporter.d.ts +26 -0
  136. package/dist/registry/reporter.js +41 -0
  137. package/dist/registry/uip/client.d.ts +99 -0
  138. package/dist/registry/uip/client.js +226 -0
  139. package/dist/registry/uip/commands.d.ts +40 -0
  140. package/dist/registry/uip/commands.js +80 -0
  141. package/dist/registry/uip/envelope.d.ts +37 -0
  142. package/dist/registry/uip/envelope.js +84 -0
  143. package/dist/registry/uip/response-cache.d.ts +28 -0
  144. package/dist/registry/uip/response-cache.js +57 -0
  145. package/lib/README.md +10 -8
  146. package/package.json +3 -3
  147. package/dist/generators/_connections.py +0 -331
  148. package/dist/generators/_events.py +0 -355
  149. package/dist/generators/_lookups.py +0 -114
  150. package/dist/generators/_naming.py +0 -185
  151. package/dist/generators/_objects.py +0 -299
  152. package/dist/generators/_resolve.py +0 -319
  153. package/dist/generators/convert_library_to_md.py +0 -1441
  154. package/dist/generators/extract_library.py +0 -125
  155. package/dist/generators/generate_connectors_ts.py +0 -936
  156. package/dist/generators/generate_library_json.py +0 -2527
  157. package/dist/generators/generate_triggers_ts.py +0 -110
  158. package/dist/generators/materialize_registry.py +0 -155
  159. package/dist/generators/prepare_connector.py +0 -1860
  160. package/dist/registry/python.d.ts +0 -26
  161. package/dist/registry/python.js +0 -46
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Which fields an operation exposes to an author.
3
+ *
4
+ * Body fields live in the sidecar's `inputDefinition.fields`; query, path and
5
+ * FILE multipart parameters live in the entry's `operation.parameters`. The
6
+ * descriptor generator, the Markdown generator and `prepare` all need the same
7
+ * answer, so the rules live here once. Ported from the top of
8
+ * `generate_connectors_ts.py`.
9
+ */
10
+ import { type LibraryEntry, type LibraryField, type V1Definition } from "../model/library.js";
11
+ import { type LookupSpecData } from "../lookup-specs.js";
12
+ /**
13
+ * A multipart parameter that is not a file. The runtime composes it from the
14
+ * body parameters; the author never fills it. Same rule as `core/library.ts`.
15
+ */
16
+ export declare function isContainerPart(parameter: {
17
+ type?: unknown;
18
+ dataType?: unknown;
19
+ }): boolean;
20
+ /**
21
+ * The complete input vocabulary the SDK runtime consumes: sidecar body fields,
22
+ * then query/path/file-multipart parameters, a parameter replacing a same-named
23
+ * body field in place because its wire location is authoritative.
24
+ */
25
+ export declare function authoritativeInputFields(entry: LibraryEntry, v1def: V1Definition | undefined): LibraryField[];
26
+ /**
27
+ * {@link authoritativeInputFields}, falling back to the catalog's
28
+ * `inputSchema.fields` when the union is empty and the catalog declares a
29
+ * required field, then appending the catalog's file-typed fields.
30
+ */
31
+ export declare function inputFields(entry: LibraryEntry, v1def: V1Definition | undefined): LibraryField[];
32
+ /**
33
+ * The one field list a descriptor's inputs — or an event's `where` — come from.
34
+ * An event's authored inputs are its subscription parameters, held only in the
35
+ * sidecar's `eventParameters.fields`.
36
+ */
37
+ export declare function descriptorInputFields(entry: LibraryEntry, v1def: V1Definition | undefined): LibraryField[];
38
+ /** `{ fieldName → spec }` for every input field that earns a `.by*` helper. */
39
+ export declare function lookupSpecs(entry: LibraryEntry, v1def: V1Definition | undefined, invariant: ReadonlySet<string>): Map<string, LookupSpecData>;
40
+ /**
41
+ * The fields whose TypeScript type must also accept a `LookupToken`: exactly the
42
+ * set {@link lookupSpecs} generates helpers for, decided by the same call.
43
+ */
44
+ export declare function markLookupFields(entry: LibraryEntry, fields: readonly LibraryField[], invariant: ReadonlySet<string>): Array<LibraryField & {
45
+ __lookup?: true;
46
+ }>;
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Which fields an operation exposes to an author.
3
+ *
4
+ * Body fields live in the sidecar's `inputDefinition.fields`; query, path and
5
+ * FILE multipart parameters live in the entry's `operation.parameters`. The
6
+ * descriptor generator, the Markdown generator and `prepare` all need the same
7
+ * answer, so the rules live here once. Ported from the top of
8
+ * `generate_connectors_ts.py`.
9
+ */
10
+ import { isEventNodeType } from "../model/library.js";
11
+ import { catalogReferences, classify, specsFromFields } from "../lookup-specs.js";
12
+ /**
13
+ * A multipart parameter that is not a file. The runtime composes it from the
14
+ * body parameters; the author never fills it. Same rule as `core/library.ts`.
15
+ */
16
+ export function isContainerPart(parameter) {
17
+ return parameter.type === "multipart" && String(parameter.dataType || "string").toLowerCase() !== "file";
18
+ }
19
+ /**
20
+ * The complete input vocabulary the SDK runtime consumes: sidecar body fields,
21
+ * then query/path/file-multipart parameters, a parameter replacing a same-named
22
+ * body field in place because its wire location is authoritative.
23
+ */
24
+ export function authoritativeInputFields(entry, v1def) {
25
+ const fields = (v1def?.inputDefinition?.fields ?? []).map((f) => ({ ...f }));
26
+ const positions = new Map();
27
+ fields.forEach((field, index) => positions.set(field.name, index));
28
+ for (const parameter of entry.operation?.parameters ?? []) {
29
+ const name = parameter.name;
30
+ const location = parameter.type;
31
+ if (!name || (location !== "query" && location !== "path" && location !== "multipart"))
32
+ continue;
33
+ if (isContainerPart(parameter))
34
+ continue;
35
+ const field = {
36
+ name,
37
+ type: parameter.dataType,
38
+ required: parameter.required === true,
39
+ };
40
+ if (parameter.displayName)
41
+ field.displayName = parameter.displayName;
42
+ if (parameter.description)
43
+ field.description = parameter.description;
44
+ // A QUERY parameter can carry a `reference` too — Slack's `send_as` does.
45
+ if (parameter.reference && typeof parameter.reference === "object")
46
+ field.reference = parameter.reference;
47
+ const at = positions.get(name);
48
+ if (at !== undefined) {
49
+ fields[at] = field;
50
+ }
51
+ else {
52
+ positions.set(name, fields.length);
53
+ fields.push(field);
54
+ }
55
+ }
56
+ return fields;
57
+ }
58
+ /**
59
+ * {@link authoritativeInputFields}, falling back to the catalog's
60
+ * `inputSchema.fields` when the union is empty and the catalog declares a
61
+ * required field, then appending the catalog's file-typed fields.
62
+ */
63
+ export function inputFields(entry, v1def) {
64
+ let fields = authoritativeInputFields(entry, v1def);
65
+ const catalogFields = entry.inputSchema?.fields ?? [];
66
+ if (fields.length === 0 && catalogFields.some((f) => f.required === true)) {
67
+ fields = catalogFields.map((f) => ({ ...f }));
68
+ }
69
+ const positions = new Set(fields.map((f) => f.name));
70
+ for (const catalogField of catalogFields) {
71
+ const name = catalogField.name;
72
+ if (!name || String(catalogField.type || "").toLowerCase() !== "file" || positions.has(name))
73
+ continue;
74
+ positions.add(name);
75
+ fields.push({ ...catalogField });
76
+ }
77
+ return fields;
78
+ }
79
+ /**
80
+ * The one field list a descriptor's inputs — or an event's `where` — come from.
81
+ * An event's authored inputs are its subscription parameters, held only in the
82
+ * sidecar's `eventParameters.fields`.
83
+ */
84
+ export function descriptorInputFields(entry, v1def) {
85
+ if (isEventNodeType(entry.nodeType || ""))
86
+ return v1def?.eventParameters?.fields ?? [];
87
+ return inputFields(entry, v1def);
88
+ }
89
+ /** `{ fieldName → spec }` for every input field that earns a `.by*` helper. */
90
+ export function lookupSpecs(entry, v1def, invariant) {
91
+ return specsFromFields(inputFields(entry, v1def), invariant, catalogReferences(entry));
92
+ }
93
+ /**
94
+ * The fields whose TypeScript type must also accept a `LookupToken`: exactly the
95
+ * set {@link lookupSpecs} generates helpers for, decided by the same call.
96
+ */
97
+ export function markLookupFields(entry, fields, invariant) {
98
+ // The catalog's `reference` is merged INTO the returned field, not only
99
+ // consulted: the descriptor's lookup note reads target and value from it.
100
+ const references = catalogReferences(entry);
101
+ return fields.map((field) => {
102
+ const merged = { ...field };
103
+ const name = merged.name;
104
+ if (!(merged.reference && typeof merged.reference === "object") && name !== undefined && references.has(name)) {
105
+ merged.reference = references.get(name);
106
+ }
107
+ if (classify(merged, invariant) === "lookup")
108
+ merged.__lookup = true;
109
+ return merged;
110
+ });
111
+ }
@@ -0,0 +1,21 @@
1
+ import { type Dict } from "./pyvalue.js";
2
+ /**
3
+ * One enum choice, as the literal an author would write. `inputSchema` uses
4
+ * plain strings; `inputDefinition` uses `{ name, value }` objects, and `value`
5
+ * is what the flow has to send.
6
+ */
7
+ export declare function enumValue(v: unknown): string;
8
+ /**
9
+ * The collection to call to resolve a field's value, or `""`. `path` is
10
+ * preferred over `objectName` because the schema documents `path` as the one
11
+ * used for the call; either may carry a `?query`, which is split off.
12
+ */
13
+ export declare function referenceCollection(f: Dict): string;
14
+ /** The `?query` half of whichever side {@link referenceCollection} used, or `""`. */
15
+ export declare function referenceQuery(f: Dict): string;
16
+ /**
17
+ * `[name, type, wireName]`: the source-facing name and type, plus the distinct
18
+ * wire name when there is one. A top-level `users[*]` is flattened wire
19
+ * notation the descriptor exposes as `users: string[]`.
20
+ */
21
+ export declare function authoringField(f: Dict): [name: string, type: string, wireName: string];
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Field-level helpers several sections share: how an enum choice prints, which
3
+ * collection a `reference` points at, and the authoring name of a field.
4
+ * Ported from the top of `convert_library_to_md.py`.
5
+ */
6
+ import { pyStr, pyStripChars, splitOnce } from "../../compat/pystr.js";
7
+ import { getStr, isDict, pyOr } from "./pyvalue.js";
8
+ /**
9
+ * One enum choice, as the literal an author would write. `inputSchema` uses
10
+ * plain strings; `inputDefinition` uses `{ name, value }` objects, and `value`
11
+ * is what the flow has to send.
12
+ */
13
+ export function enumValue(v) {
14
+ if (isDict(v))
15
+ return pyStr("value" in v ? v.value : "name" in v ? v.name : "");
16
+ return pyStr(v);
17
+ }
18
+ /** `reference.path or reference.objectName or ""`, when it is a string. */
19
+ function referenceSource(f) {
20
+ const reference = f.reference;
21
+ if (!isDict(reference))
22
+ return undefined;
23
+ const source = pyOr(reference.path, reference.objectName, "");
24
+ return typeof source === "string" ? source : undefined;
25
+ }
26
+ /**
27
+ * The collection to call to resolve a field's value, or `""`. `path` is
28
+ * preferred over `objectName` because the schema documents `path` as the one
29
+ * used for the call; either may carry a `?query`, which is split off.
30
+ */
31
+ export function referenceCollection(f) {
32
+ const source = referenceSource(f);
33
+ if (!source)
34
+ return "";
35
+ return pyStripChars(splitOnce(source, "?")[0], "/");
36
+ }
37
+ /** The `?query` half of whichever side {@link referenceCollection} used, or `""`. */
38
+ export function referenceQuery(f) {
39
+ const source = referenceSource(f);
40
+ if (source === undefined)
41
+ return "";
42
+ return splitOnce(source, "?")[1] ?? "";
43
+ }
44
+ /**
45
+ * `[name, type, wireName]`: the source-facing name and type, plus the distinct
46
+ * wire name when there is one. A top-level `users[*]` is flattened wire
47
+ * notation the descriptor exposes as `users: string[]`.
48
+ */
49
+ export function authoringField(f) {
50
+ const wireName = getStr(f, "name", "?");
51
+ const type = getStr(f, "type", "?");
52
+ if (wireName.endsWith("[*]") && !wireName.includes("."))
53
+ return [wireName.slice(0, -3), `${type}[]`, wireName];
54
+ return [wireName, type, ""];
55
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The Markdown library: one page per operation plus a rewritten `index.json`.
3
+ *
4
+ * Reads an extracted `library-json/` tree and renders the parallel tree of
5
+ * `.md` pages agents read for connector discovery, with an index whose `path`s
6
+ * point at the pages. Symbol names the pages cite (`connector(SendMessageToUser,
7
+ * …)`) are derived by `naming.symbolIndex`, the same map the descriptor
8
+ * generator uses, so a page cannot cite a symbol that module did not emit.
9
+ *
10
+ * Ported from `integrations/scripts/convert_library_to_md.py`; the output is
11
+ * byte-for-byte that script's. A caller writes each page as-is and the index
12
+ * with `pyJsonDocument(index)`.
13
+ */
14
+ import type { LoadedLibrary } from "../../library-reader.js";
15
+ import type { LibraryEntry, LibraryIndex, V1Definition } from "../../model/library.js";
16
+ export interface MarkdownContext {
17
+ /** `naming.symbolIndex` over the index: `nodeType → exported descriptor name`. */
18
+ symbols: ReadonlyMap<string, string>;
19
+ /** `objectName`s the curated ledger declares connector-invariant. */
20
+ invariant: ReadonlySet<string>;
21
+ }
22
+ /** One operation's page. `v1def` is the sidecar already unwrapped from a one-element list. */
23
+ export declare function renderMarkdownPage(entry: LibraryEntry, v1def: V1Definition | undefined, ctx: MarkdownContext): string;
24
+ export interface MarkdownOutput {
25
+ /** `<index path with .json → .md>` → page text, in index order. */
26
+ pages: Map<string, string>;
27
+ /** The source index with each converted row's `path` rewritten; other keys untouched. */
28
+ index: LibraryIndex;
29
+ /** One ` WARN: missing source entry <path>` line per row whose entry file is absent. */
30
+ warnings: string[];
31
+ }
32
+ /** Every operation the index names, rendered. Rows whose path is not a `.json` or whose file is missing are left as they are. */
33
+ export declare function renderMarkdownLibrary(library: LoadedLibrary): MarkdownOutput;
@@ -0,0 +1,37 @@
1
+ import { pyStr } from "../../compat/pystr.js";
2
+ import { symbolIndex } from "../../naming.js";
3
+ import { renderOp } from "./page.js";
4
+ import { pyOr } from "./pyvalue.js";
5
+ /** One operation's page. `v1def` is the sidecar already unwrapped from a one-element list. */
6
+ export function renderMarkdownPage(entry, v1def, ctx) {
7
+ return renderOp(entry, v1def, ctx.symbols.get(entry.nodeType), ctx.invariant);
8
+ }
9
+ /** Every operation the index names, rendered. Rows whose path is not a `.json` or whose file is missing are left as they are. */
10
+ export function renderMarkdownLibrary(library) {
11
+ const index = library.index;
12
+ const pages = new Map();
13
+ const warnings = [];
14
+ const entries = index.entries;
15
+ if (!Array.isArray(entries))
16
+ return { pages, index, warnings };
17
+ // The SAME map the descriptor generator uses.
18
+ const symbols = symbolIndex(entries);
19
+ const rows = entries.map((row) => {
20
+ const relJson = pyStr(pyOr(row.path, ""));
21
+ if (!relJson || !relJson.endsWith(".json"))
22
+ return row;
23
+ const entry = library.readEntry(row);
24
+ if (entry === undefined) {
25
+ warnings.push(` WARN: missing source entry ${library.entryPath(row)}`);
26
+ return row;
27
+ }
28
+ // The Flow node shape lives beside the entry as `<op>.v1def.json`; its
29
+ // inputDefinition is what the compiler validates, so inputs render from it.
30
+ const v1def = library.readV1Def(row);
31
+ const md = renderOp(entry, v1def, symbols.get(row.nodeType), library.invariant);
32
+ const relMd = `${relJson.slice(0, -".json".length)}.md`;
33
+ pages.set(relMd, md);
34
+ return { ...row, path: relMd };
35
+ });
36
+ return { pages, index: { ...index, entries: rows }, warnings };
37
+ }
@@ -0,0 +1,8 @@
1
+ import { type Dict } from "./pyvalue.js";
2
+ /**
3
+ * @param j the canonical entry
4
+ * @param v1def the sidecar, or `undefined` when the operation ships none
5
+ * @param symbol the generated descriptor's exported name, or `undefined` when there is no descriptor
6
+ * @param invariant `objectName`s the curated ledger declares connector-invariant
7
+ */
8
+ export declare function renderOp(j: Dict, v1def: Dict | undefined, symbol: string | undefined, invariant: ReadonlySet<string>): string;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * One library entry rendered to Markdown: header → schema-dynamic notice →
3
+ * choosing the object → resolving the field set → required inputs → optional
4
+ * inputs → resolving lookups → example → filtering → outputs. Ported from
5
+ * `render_op`; the page is `"\n".join(lines)` with no trailing newline.
6
+ */
7
+ import { afterLast, pyStr } from "../../compat/pystr.js";
8
+ import { dictOf, getStr, pyOr, pyTruthy } from "./pyvalue.js";
9
+ import { choosingObjectLines } from "./sections/choosing-object.js";
10
+ import { exampleLines } from "./sections/example.js";
11
+ import { eventFilterLines } from "./sections/filtering.js";
12
+ import { headerLines } from "./sections/header.js";
13
+ import { assembleFields, optionalInputsLines, requiredInputsLines } from "./sections/inputs.js";
14
+ import { lookupLines } from "./sections/lookups.js";
15
+ import { outputsLines } from "./sections/outputs.js";
16
+ import { schemaActionLines } from "./sections/resolving-fields.js";
17
+ import { schemaDynamicLines } from "./sections/schema-dynamic.js";
18
+ /**
19
+ * @param j the canonical entry
20
+ * @param v1def the sidecar, or `undefined` when the operation ships none
21
+ * @param symbol the generated descriptor's exported name, or `undefined` when there is no descriptor
22
+ * @param invariant `objectName`s the curated ledger declares connector-invariant
23
+ */
24
+ export function renderOp(j, v1def, symbol, invariant) {
25
+ const nodeType = getStr(j, "nodeType", "?");
26
+ const conn = dictOf(j.connector);
27
+ const op = dictOf(j.operation);
28
+ const out = [];
29
+ out.push(...headerLines(j, nodeType));
30
+ out.push(...schemaDynamicLines(j, nodeType));
31
+ const fields = assembleFields(j, v1def);
32
+ const required = fields.filter((f) => pyTruthy(f.required));
33
+ const optional = fields.filter((f) => !pyTruthy(f.required));
34
+ out.push(...choosingObjectLines(j, nodeType));
35
+ const action = op.schemaAction;
36
+ if (pyTruthy(action)) {
37
+ out.push(...schemaActionLines(pyStr(pyOr(conn.key, "<connector>")), pyStr(pyOr(op.objectName, "")), pyStr(pyOr(op.name, "<operation>")), dictOf(action), fields));
38
+ }
39
+ out.push(...requiredInputsLines(required));
40
+ out.push(...optionalInputsLines(optional));
41
+ const lookups = lookupLines(pyStr(pyOr(conn.key, "<connector>")), afterLast(nodeType, "."), fields, symbol, invariant);
42
+ if (lookups.length) {
43
+ out.push("## Resolving lookups", "");
44
+ out.push(...lookups);
45
+ out.push("");
46
+ }
47
+ // The example goes AFTER the lookups section: it uses the helpers that section introduces.
48
+ out.push(...exampleLines(j, fields, symbol, invariant, v1def));
49
+ out.push(...eventFilterLines(j, v1def));
50
+ out.push(...outputsLines(j));
51
+ return out.join("\n");
52
+ }
@@ -0,0 +1,34 @@
1
+ export type Dict = Record<string, unknown>;
2
+ /** Python truthiness for JSON-shaped values: empty strings and containers are false, `NaN` is true. */
3
+ export declare function pyTruthy(v: unknown): boolean;
4
+ /** `a or b or …`: the first Python-truthy operand, else the last one. */
5
+ export declare function pyOr<T>(...values: T[]): T;
6
+ /** `isinstance(v, dict)`. */
7
+ export declare function isDict(v: unknown): v is Dict;
8
+ /** `(v or {})` where the Python goes on to call `.get` — a non-dict reads as empty. */
9
+ export declare function dictOf(v: unknown): Dict;
10
+ /**
11
+ * The items Python's `for x in (v or [])` would visit: a list's items, a
12
+ * string's code points, a dict's keys; nothing for anything else.
13
+ */
14
+ export declare function listOf(v: unknown): unknown[];
15
+ /** `str(d.get(key, default))`: a missing key yields `default`, a present `None` yields `"None"`. */
16
+ export declare function getStr(d: Dict, key: string, fallback: string): string;
17
+ /** `[str(x) for x in (v or [])]`. */
18
+ export declare function strList(v: unknown): string[];
19
+ /** The first value of an insertion-ordered map: `next(iter(d.values()))`. Callers check emptiness first. */
20
+ export declare function firstValue<V>(map: ReadonlyMap<unknown, V>): V;
21
+ /** `re.compile(r"[A-Za-z_$][A-Za-z0-9_$]*").fullmatch`: a bare object key. */
22
+ export declare const IDENT: RegExp;
23
+ /**
24
+ * Whether Python's `float(s)` accepts the string.
25
+ *
26
+ * `float()` strips whitespace (see {@link FLOAT_SPACE}), maps every `Nd`
27
+ * digit to ASCII, allows a single `_` between digits (PEP 515), and takes
28
+ * `inf`/`infinity`/`nan` in any ASCII case with an optional sign. It rejects
29
+ * the empty string, hex, a dangling exponent, an embedded NUL and underscores
30
+ * anywhere but between digits. The generator uses the verdict, not the value:
31
+ * an enum choice a number-typed field can carry prints bare, anything else
32
+ * falls through.
33
+ */
34
+ export declare function pyFloatAccepts(s: string): boolean;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Python value semantics the Markdown generator leans on.
3
+ *
4
+ * `convert_library_to_md.py` is written against dicts — `.get()`, `or`
5
+ * fallbacks, truthiness tests — and its output is byte-locked. These helpers
6
+ * spell those semantics once so each section module can be read beside the
7
+ * Python line for line. JSON has no `undefined`, so after `JSON.parse` an
8
+ * absent key is `undefined` and an explicit `null` is `null`: the same
9
+ * distinction Python's `d.get(k, default)` draws between a missing key (the
10
+ * default) and a `None` value (printed as `None`).
11
+ */
12
+ import { pyStr, pyStripChars } from "../../compat/pystr.js";
13
+ /** Python truthiness for JSON-shaped values: empty strings and containers are false, `NaN` is true. */
14
+ export function pyTruthy(v) {
15
+ if (v === null || v === undefined)
16
+ return false;
17
+ switch (typeof v) {
18
+ case "boolean":
19
+ return v;
20
+ case "number":
21
+ return v !== 0;
22
+ case "bigint":
23
+ return v !== 0n;
24
+ case "string":
25
+ return v.length > 0;
26
+ case "object":
27
+ if (Array.isArray(v))
28
+ return v.length > 0;
29
+ if (v instanceof Map || v instanceof Set)
30
+ return v.size > 0;
31
+ return Object.keys(v).length > 0;
32
+ default:
33
+ return true;
34
+ }
35
+ }
36
+ /** `a or b or …`: the first Python-truthy operand, else the last one. */
37
+ export function pyOr(...values) {
38
+ for (const v of values)
39
+ if (pyTruthy(v))
40
+ return v;
41
+ return values[values.length - 1];
42
+ }
43
+ /** `isinstance(v, dict)`. */
44
+ export function isDict(v) {
45
+ return v !== null && typeof v === "object" && !Array.isArray(v);
46
+ }
47
+ /** `(v or {})` where the Python goes on to call `.get` — a non-dict reads as empty. */
48
+ export function dictOf(v) {
49
+ return isDict(v) ? v : {};
50
+ }
51
+ /**
52
+ * The items Python's `for x in (v or [])` would visit: a list's items, a
53
+ * string's code points, a dict's keys; nothing for anything else.
54
+ */
55
+ export function listOf(v) {
56
+ if (Array.isArray(v))
57
+ return v;
58
+ if (typeof v === "string")
59
+ return Array.from(v);
60
+ if (isDict(v))
61
+ return Object.keys(v);
62
+ return [];
63
+ }
64
+ /** `str(d.get(key, default))`: a missing key yields `default`, a present `None` yields `"None"`. */
65
+ export function getStr(d, key, fallback) {
66
+ const v = d[key];
67
+ return v === undefined ? fallback : pyStr(v);
68
+ }
69
+ /** `[str(x) for x in (v or [])]`. */
70
+ export function strList(v) {
71
+ return listOf(pyOr(v, [])).map((x) => pyStr(x));
72
+ }
73
+ /** The first value of an insertion-ordered map: `next(iter(d.values()))`. Callers check emptiness first. */
74
+ export function firstValue(map) {
75
+ return map.values().next().value;
76
+ }
77
+ /** `re.compile(r"[A-Za-z_$][A-Za-z0-9_$]*").fullmatch`: a bare object key. */
78
+ export const IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
79
+ /** `digitpart ::= digit (["_"] digit)*` over every Unicode decimal digit, as `float()` accepts. */
80
+ const DIGITS = "\\p{Nd}(?:_?\\p{Nd})*";
81
+ const FLOAT_LITERAL = new RegExp(`^[+-]?(?:${DIGITS}(?:\\.(?:${DIGITS})?)?|\\.${DIGITS})(?:[eE][+-]?${DIGITS})?$`, "u");
82
+ const SPECIAL_FLOAT = /^[+-]?(?:inf|infinity|nan)$/i;
83
+ /**
84
+ * What `float()` strips: the C `isspace` set for ASCII (the transform copies
85
+ * ASCII verbatim, so `\x1c`–`\x1f` are NOT whitespace here although
86
+ * `str.strip()` removes them) plus every non-ASCII character `str.isspace()`
87
+ * is true for, which the transform maps to a space first.
88
+ */
89
+ const FLOAT_SPACE = " \t\n\u000b\u000c\r\u0085\u00a0\u1680" +
90
+ "\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a" +
91
+ "\u2028\u2029\u202f\u205f\u3000";
92
+ /**
93
+ * Whether Python's `float(s)` accepts the string.
94
+ *
95
+ * `float()` strips whitespace (see {@link FLOAT_SPACE}), maps every `Nd`
96
+ * digit to ASCII, allows a single `_` between digits (PEP 515), and takes
97
+ * `inf`/`infinity`/`nan` in any ASCII case with an optional sign. It rejects
98
+ * the empty string, hex, a dangling exponent, an embedded NUL and underscores
99
+ * anywhere but between digits. The generator uses the verdict, not the value:
100
+ * an enum choice a number-typed field can carry prints bare, anything else
101
+ * falls through.
102
+ */
103
+ export function pyFloatAccepts(s) {
104
+ const text = pyStripChars(s, FLOAT_SPACE);
105
+ return FLOAT_LITERAL.test(text) || SPECIAL_FLOAT.test(text);
106
+ }
@@ -0,0 +1,2 @@
1
+ import { type Dict } from "../pyvalue.js";
2
+ export declare function choosingObjectLines(j: Dict, nodeType: string): string[];
@@ -0,0 +1,52 @@
1
+ /**
2
+ * `## Choosing the object`, on an operation that works on any object of the
3
+ * connection (`objectFromDiscovery`). Object selection precedes field
4
+ * selection, so this sits above the inputs.
5
+ */
6
+ import { afterLast, pyStr } from "../../../compat/pystr.js";
7
+ import { dictOf, pyOr, pyTruthy } from "../pyvalue.js";
8
+ export function choosingObjectLines(j, nodeType) {
9
+ const op = dictOf(j.operation);
10
+ if (!pyTruthy(op.objectFromDiscovery))
11
+ return [];
12
+ const conn = dictOf(j.connector);
13
+ const connectorKey = pyStr(pyOr(conn.key, "<connector>"));
14
+ const verb = pyStr(pyOr(op.name, "<operation>"));
15
+ const prefix = `uipath.connector.${connectorKey}.`;
16
+ const mdAction = nodeType.startsWith(prefix) ? nodeType.slice(prefix.length) : afterLast(nodeType, ".");
17
+ return [
18
+ "## Choosing the object",
19
+ "",
20
+ "This operation works on any object in the connection, including " +
21
+ "custom ones, so the object list is not in this catalog. Do not " +
22
+ "run discovery commands and do not hand-filter the catalog — " +
23
+ "author the step with the object name as the task said it (any " +
24
+ "casing), then one command matches it deterministically:",
25
+ "",
26
+ "```bash",
27
+ `npx flow-sdk registry prepare ${connectorKey} ${mdAction} --object <name-as-the-task-said-it>`,
28
+ "```",
29
+ "",
30
+ "The name is matched, never equality-tested: exact, then " +
31
+ "case-insensitive on API name and display name (`matched " +
32
+ "\"Company__C\" -> Company__c` is printed), narrowed to objects " +
33
+ `that support ${verb}. It then fetches the object's ` +
34
+ "connection-resolved fields, generates the typed descriptor, and " +
35
+ "prints the import line to use.",
36
+ "",
37
+ "**If the name matches several objects, the command refuses and " +
38
+ "prints the candidates** (API name, display name, custom, " +
39
+ "operations). `Custom: yes` marks an object that exists only on " +
40
+ "this tenant, so it could never have been in this catalog — a " +
41
+ "task that says \"custom\" means one of those rows. Pick by the " +
42
+ "task's wording, or present the candidates and let the user " +
43
+ "choose; never pick for them, and do not assume the user's " +
44
+ "wording is the API name. Then re-run with the chosen name.",
45
+ "",
46
+ "**If nothing matches**, the command has already retried against " +
47
+ "a refreshed catalog before saying so — the object genuinely is " +
48
+ "not on this connection. Check the value against the task's " +
49
+ "words, or surface it to the user rather than inventing one.",
50
+ "",
51
+ ];
52
+ }
@@ -0,0 +1,22 @@
1
+ import { type Dict } from "../pyvalue.js";
2
+ /** `fields.project.key` → `projectKey`: a readable input name, not a path. */
3
+ export declare function leafName(fieldName: string): string;
4
+ /** `send-message-to-user` → `sendMessageToUser`, a usable step name. */
5
+ export declare function pascalStep(action: string): string;
6
+ /** Render `[name, value]` pairs as the nested object literal an author writes. */
7
+ export declare function nestInputs(pairs: ReadonlyArray<readonly [unknown, string]>): string[];
8
+ /**
9
+ * The value to show for one required input: a resolvable lookup shows its
10
+ * helper; an enum shows its FIRST DECLARED CHOICE, typed to the declaration
11
+ * where it can be; anything else shows `input('<name>')`.
12
+ */
13
+ export declare function exampleValue(f: Dict, symbol: string | undefined, invariant: ReadonlySet<string>, connectorKey?: string, action?: string): string;
14
+ /** A compilable `connector(...)` call for this operation; events go to {@link eventExampleLines}. */
15
+ export declare function exampleLines(j: Dict, fields: readonly Dict[], symbol: string | undefined, invariant: ReadonlySet<string>, v1def: Dict | undefined): string[];
16
+ /**
17
+ * A compilable `onEvent(...)` / `waitForEvent(...)` call for a connector
18
+ * EVENT. A GENERIC event (`GenericTrigger`) watches ONE object the entry does
19
+ * not name, so the example shows the `object` option; a curated event shows
20
+ * `where` with the sidecar's event parameters.
21
+ */
22
+ export declare function eventExampleLines(j: Dict, symbol: string | undefined, connectorKey: string, action: string, step: string, v1def: Dict | undefined): string[];