@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.
- package/dist/bpmn/uipath-moddle.v1.json +21 -0
- package/dist/cli/commands/registry.js +68 -12
- package/dist/registry/archive/entry-policy.d.ts +36 -0
- package/dist/registry/archive/entry-policy.js +60 -0
- package/dist/registry/archive/extract.d.ts +31 -0
- package/dist/registry/archive/extract.js +92 -0
- package/dist/registry/archive/zip-reader.d.ts +38 -0
- package/dist/registry/archive/zip-reader.js +256 -0
- package/dist/registry/codecs/pyjson.d.ts +62 -0
- package/dist/registry/codecs/pyjson.js +208 -0
- package/dist/registry/compat/compare.d.ts +18 -0
- package/dist/registry/compat/compare.js +32 -0
- package/dist/registry/compat/paths.d.ts +4 -0
- package/dist/registry/compat/paths.js +17 -0
- package/dist/registry/compat/pystr.d.ts +50 -0
- package/dist/registry/compat/pystr.js +221 -0
- package/dist/registry/concurrency.d.ts +10 -0
- package/dist/registry/concurrency.js +34 -0
- package/dist/registry/curated-overlay.d.ts +36 -4
- package/dist/registry/curated-overlay.js +87 -14
- package/dist/registry/errors.d.ts +26 -0
- package/dist/registry/errors.js +38 -0
- package/dist/registry/extractor.d.ts +9 -10
- package/dist/registry/extractor.js +5 -15
- package/dist/registry/files.d.ts +26 -0
- package/dist/registry/files.js +160 -0
- package/dist/registry/generators/descriptors.d.ts +81 -0
- package/dist/registry/generators/descriptors.js +405 -0
- package/dist/registry/generators/fields.d.ts +46 -0
- package/dist/registry/generators/fields.js +111 -0
- package/dist/registry/generators/markdown/common.d.ts +21 -0
- package/dist/registry/generators/markdown/common.js +55 -0
- package/dist/registry/generators/markdown/index.d.ts +33 -0
- package/dist/registry/generators/markdown/index.js +37 -0
- package/dist/registry/generators/markdown/page.d.ts +8 -0
- package/dist/registry/generators/markdown/page.js +52 -0
- package/dist/registry/generators/markdown/pyvalue.d.ts +34 -0
- package/dist/registry/generators/markdown/pyvalue.js +106 -0
- package/dist/registry/generators/markdown/sections/choosing-object.d.ts +2 -0
- package/dist/registry/generators/markdown/sections/choosing-object.js +52 -0
- package/dist/registry/generators/markdown/sections/example.d.ts +22 -0
- package/dist/registry/generators/markdown/sections/example.js +295 -0
- package/dist/registry/generators/markdown/sections/filtering.d.ts +2 -0
- package/dist/registry/generators/markdown/sections/filtering.js +76 -0
- package/dist/registry/generators/markdown/sections/header.d.ts +2 -0
- package/dist/registry/generators/markdown/sections/header.js +37 -0
- package/dist/registry/generators/markdown/sections/inputs.d.ts +30 -0
- package/dist/registry/generators/markdown/sections/inputs.js +151 -0
- package/dist/registry/generators/markdown/sections/lookups.d.ts +12 -0
- package/dist/registry/generators/markdown/sections/lookups.js +150 -0
- package/dist/registry/generators/markdown/sections/outputs.d.ts +3 -0
- package/dist/registry/generators/markdown/sections/outputs.js +9 -0
- package/dist/registry/generators/markdown/sections/resolving-fields.d.ts +2 -0
- package/dist/registry/generators/markdown/sections/resolving-fields.js +139 -0
- package/dist/registry/generators/markdown/sections/schema-dynamic.d.ts +2 -0
- package/dist/registry/generators/markdown/sections/schema-dynamic.js +86 -0
- package/dist/registry/generators/materialize.d.ts +30 -0
- package/dist/registry/generators/materialize.js +132 -0
- package/dist/registry/generators/md-symbols.d.ts +22 -0
- package/dist/registry/generators/md-symbols.js +58 -0
- package/dist/registry/generators/triggers.d.ts +15 -0
- package/dist/registry/generators/triggers.js +85 -0
- package/dist/registry/generators/type-registry.d.ts +50 -0
- package/dist/registry/generators/type-registry.js +154 -0
- package/dist/registry/generators/type-tree.d.ts +65 -0
- package/dist/registry/generators/type-tree.js +179 -0
- package/dist/registry/library-build/build.d.ts +57 -0
- package/dist/registry/library-build/build.js +286 -0
- package/dist/registry/library-build/canonical.d.ts +119 -0
- package/dist/registry/library-build/canonical.js +512 -0
- package/dist/registry/library-build/cli.d.ts +45 -0
- package/dist/registry/library-build/cli.js +182 -0
- package/dist/registry/library-build/context.d.ts +107 -0
- package/dist/registry/library-build/context.js +267 -0
- package/dist/registry/library-build/enrich.d.ts +36 -0
- package/dist/registry/library-build/enrich.js +158 -0
- package/dist/registry/library-build/events.d.ts +108 -0
- package/dist/registry/library-build/events.js +476 -0
- package/dist/registry/library-build/generic-expand.d.ts +77 -0
- package/dist/registry/library-build/generic-expand.js +363 -0
- package/dist/registry/library-build/plan.d.ts +71 -0
- package/dist/registry/library-build/plan.js +270 -0
- package/dist/registry/library-build/py.d.ts +45 -0
- package/dist/registry/library-build/py.js +167 -0
- package/dist/registry/library-build/schema-action.d.ts +38 -0
- package/dist/registry/library-build/schema-action.js +107 -0
- package/dist/registry/library-build/write.d.ts +6 -0
- package/dist/registry/library-build/write.js +26 -0
- package/dist/registry/library-reader.d.ts +20 -0
- package/dist/registry/library-reader.js +50 -0
- package/dist/registry/lookup-specs.d.ts +55 -0
- package/dist/registry/lookup-specs.js +140 -0
- package/dist/registry/materialize-cli.js +28 -14
- package/dist/registry/materializer.d.ts +25 -3
- package/dist/registry/materializer.js +45 -29
- package/dist/registry/model/library.d.ts +254 -0
- package/dist/registry/model/library.js +23 -0
- package/dist/registry/naming.d.ts +54 -0
- package/dist/registry/naming.js +142 -0
- package/dist/registry/orphans.d.ts +4 -0
- package/dist/registry/orphans.js +86 -0
- package/dist/registry/prepare/actions.d.ts +26 -0
- package/dist/registry/prepare/actions.js +94 -0
- package/dist/registry/prepare/connections.d.ts +181 -0
- package/dist/registry/prepare/connections.js +399 -0
- package/dist/registry/prepare/event.d.ts +96 -0
- package/dist/registry/prepare/event.js +268 -0
- package/dist/registry/prepare/handoff.d.ts +21 -0
- package/dist/registry/prepare/handoff.js +91 -0
- package/dist/registry/prepare/ledger.d.ts +104 -0
- package/dist/registry/prepare/ledger.js +216 -0
- package/dist/registry/prepare/messages.d.ts +190 -0
- package/dist/registry/prepare/messages.js +472 -0
- package/dist/registry/prepare/objects.d.ts +130 -0
- package/dist/registry/prepare/objects.js +318 -0
- package/dist/registry/prepare/overlay.d.ts +149 -0
- package/dist/registry/prepare/overlay.js +487 -0
- package/dist/registry/prepare/parents.d.ts +41 -0
- package/dist/registry/prepare/parents.js +122 -0
- package/dist/registry/prepare/pipeline.d.ts +91 -0
- package/dist/registry/prepare/pipeline.js +376 -0
- package/dist/registry/prepare/regenerate.d.ts +9 -0
- package/dist/registry/prepare/regenerate.js +50 -0
- package/dist/registry/prepare/resolve.d.ts +199 -0
- package/dist/registry/prepare/resolve.js +470 -0
- package/dist/registry/prepare/retry.d.ts +83 -0
- package/dist/registry/prepare/retry.js +109 -0
- package/dist/registry/prepare/source-import.d.ts +54 -0
- package/dist/registry/prepare/source-import.js +192 -0
- package/dist/registry/prepare/support.d.ts +41 -0
- package/dist/registry/prepare/support.js +178 -0
- package/dist/registry/prepare-cli.d.ts +16 -5
- package/dist/registry/prepare-cli.js +60 -53
- package/dist/registry/pull-cli.js +8 -7
- package/dist/registry/reporter.d.ts +26 -0
- package/dist/registry/reporter.js +41 -0
- package/dist/registry/uip/client.d.ts +99 -0
- package/dist/registry/uip/client.js +226 -0
- package/dist/registry/uip/commands.d.ts +40 -0
- package/dist/registry/uip/commands.js +80 -0
- package/dist/registry/uip/envelope.d.ts +37 -0
- package/dist/registry/uip/envelope.js +84 -0
- package/dist/registry/uip/response-cache.d.ts +28 -0
- package/dist/registry/uip/response-cache.js +57 -0
- package/lib/README.md +10 -8
- package/package.json +3 -3
- package/dist/generators/_connections.py +0 -331
- package/dist/generators/_events.py +0 -355
- package/dist/generators/_lookups.py +0 -114
- package/dist/generators/_naming.py +0 -185
- package/dist/generators/_objects.py +0 -299
- package/dist/generators/_resolve.py +0 -319
- package/dist/generators/convert_library_to_md.py +0 -1441
- package/dist/generators/extract_library.py +0 -125
- package/dist/generators/generate_connectors_ts.py +0 -936
- package/dist/generators/generate_library_json.py +0 -2527
- package/dist/generators/generate_triggers_ts.py +0 -110
- package/dist/generators/materialize_registry.py +0 -155
- package/dist/generators/prepare_connector.py +0 -1860
- package/dist/registry/python.d.ts +0 -26
- package/dist/registry/python.js +0 -46
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `connectors-local/resolutions.json`, the lookup half: recording what
|
|
3
|
+
* `--resolve` answered and reading it back for the paste-ready re-run.
|
|
4
|
+
*
|
|
5
|
+
* A SEPARATE FILE from the schema overlay, deliberately. A prepared schema is a
|
|
6
|
+
* fact about the connector; a resolution is a fact about one tenant's data, so
|
|
7
|
+
* it ages differently and most consumers will want to gitignore it. Existing
|
|
8
|
+
* entries STAND rather than being re-resolved: a resolved id is a snapshot
|
|
9
|
+
* either way, and re-resolving on every call would make an unrelated `prepare`
|
|
10
|
+
* silently change an artifact. Re-resolving is `--refresh-lookups`, a
|
|
11
|
+
* deliberate act with a visible diff.
|
|
12
|
+
*
|
|
13
|
+
* The object half of the ledger (`objects[nodeType][requested]`) lives in
|
|
14
|
+
* `objects.ts`; this module reads and rewrites the WHOLE file so neither
|
|
15
|
+
* section drops the other.
|
|
16
|
+
*
|
|
17
|
+
* Ported from `_write_resolutions` and `_resolved_parent_values` in
|
|
18
|
+
* `prepare_connector.py`.
|
|
19
|
+
*/
|
|
20
|
+
import { lookupKey } from "../../core/lookups.js";
|
|
21
|
+
import { pyJsonStringify } from "../codecs/pyjson.js";
|
|
22
|
+
import { sortedStrings } from "../compat/compare.js";
|
|
23
|
+
import { PrepareRefusal, resolutionLine, unknownLookupMessage, wroteResolutionsLine } from "./messages.js";
|
|
24
|
+
import { LedgerRefusal, RESOLUTIONS_FILENAME, ledgerPath, readLedger, writeLedger } from "./objects.js";
|
|
25
|
+
import { lookupSpecsFromOverlay } from "./overlay.js";
|
|
26
|
+
import { LookupExhausted, orderResolutions, parseResolveFlag, resolveOne } from "./resolve.js";
|
|
27
|
+
import { isPlainObject, pyGet, pyPathJoin, pyStrAny } from "./support.js";
|
|
28
|
+
/**
|
|
29
|
+
* The key a resolution is recorded under: `JSON.stringify([nodeType, field,
|
|
30
|
+
* by, value])`, the same bytes `core/lookups.ts`'s `lookupKey` computes when
|
|
31
|
+
* `compile` looks one up.
|
|
32
|
+
*
|
|
33
|
+
* INTENTIONAL DIVERGENCE from the Python, which built the key with
|
|
34
|
+
* `json.dumps(..., separators=(",", ":"))` — compact like JavaScript, but with
|
|
35
|
+
* `ensure_ascii` left on, so a value with any character outside ASCII was
|
|
36
|
+
* written as `\uXXXX` INSIDE the key string. `JSON.stringify` writes the
|
|
37
|
+
* character itself. The two spellings of the same tuple are different strings,
|
|
38
|
+
* so every such resolution `prepare` recorded was invisible to the `compile`
|
|
39
|
+
* that had asked for it. Written raw here to match the reader;
|
|
40
|
+
* {@link findResolution} still reads the escaped spelling so a ledger the
|
|
41
|
+
* Python wrote keeps loading.
|
|
42
|
+
*/
|
|
43
|
+
export function resolutionKey(nodeType, field, by, value) {
|
|
44
|
+
return lookupKey(nodeType, field, by, value);
|
|
45
|
+
}
|
|
46
|
+
/** The Python's spelling of the same key: compact separators, `ensure_ascii=True`. */
|
|
47
|
+
export function escapedResolutionKey(nodeType, field, by, value) {
|
|
48
|
+
return pyJsonStringify([nodeType, field, by, value], { separators: [",", ":"] });
|
|
49
|
+
}
|
|
50
|
+
/** `[nodeType, field, by, match]` out of a recorded key, in either spelling, or `undefined`. */
|
|
51
|
+
export function parseResolutionKey(key) {
|
|
52
|
+
let parsed;
|
|
53
|
+
try {
|
|
54
|
+
parsed = JSON.parse(key);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (!Array.isArray(parsed) || parsed.length !== 4)
|
|
60
|
+
return undefined;
|
|
61
|
+
return parsed.map(pyStrAny);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The recorded row for `(nodeType, field, by, value)`, whichever spelling it
|
|
65
|
+
* was written under — raw first, then the Python's escaped form. For a pure
|
|
66
|
+
* ASCII tuple the two are the same string.
|
|
67
|
+
*/
|
|
68
|
+
export function findResolution(existing, nodeType, field, by, value) {
|
|
69
|
+
for (const key of new Set([resolutionKey(nodeType, field, by, value), escapedResolutionKey(nodeType, field, by, value)])) {
|
|
70
|
+
if (Object.prototype.hasOwnProperty.call(existing, key)) {
|
|
71
|
+
const row = existing[key];
|
|
72
|
+
if (isPlainObject(row))
|
|
73
|
+
return { key, row };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A {@link LookupExhausted} as {@link writeResolutions} surfaces it: the
|
|
80
|
+
* exhausted lookup plus the plan it belonged to. Same message, same facts,
|
|
81
|
+
* still a `LookupExhausted` — the pipeline catches this one class and has
|
|
82
|
+
* everything the retry needs, whichever path (action or event) was running.
|
|
83
|
+
*
|
|
84
|
+
* Raised ONLY for a scan that reached the collection's end. A capped scan is
|
|
85
|
+
* a `LookupExhausted` too and is deliberately NOT wrapped; see the throw site.
|
|
86
|
+
*/
|
|
87
|
+
export class ResolutionsExhausted extends LookupExhausted {
|
|
88
|
+
first;
|
|
89
|
+
plan;
|
|
90
|
+
constructor(first, plan) {
|
|
91
|
+
super(first.message, first);
|
|
92
|
+
this.first = first;
|
|
93
|
+
this.plan = plan;
|
|
94
|
+
this.name = "ResolutionsExhausted";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* `_write_resolutions`: resolve every `--resolve` and merge the answers into
|
|
99
|
+
* the ledger. Reads and rewrites the WHOLE ledger, not just `resolutions` —
|
|
100
|
+
* the file also carries the `objects` section, and rewriting one section used
|
|
101
|
+
* to silently drop the other. A file that will not parse is REFUSED rather
|
|
102
|
+
* than reset (`readLedger`), the same rule `bindings.json` follows.
|
|
103
|
+
*
|
|
104
|
+
* `specs` defaults to the overlay's, read back from what was just written;
|
|
105
|
+
* a caller that already holds them passes them in.
|
|
106
|
+
*/
|
|
107
|
+
export async function writeResolutions(run, specs) {
|
|
108
|
+
const table = specs ?? lookupSpecsFromOverlay(run.out, run.nodeType, run.objectName);
|
|
109
|
+
const requested = run.resolve.map(parseResolveFlag);
|
|
110
|
+
const unknown = requested.map(([field]) => field).filter((field) => !table.has(field));
|
|
111
|
+
if (unknown.length > 0) {
|
|
112
|
+
throw new PrepareRefusal(unknownLookupMessage(unknown, run.nodeType, sortedStrings(table.keys())), "RESOLVE_UNKNOWN_FIELD");
|
|
113
|
+
}
|
|
114
|
+
const ordered = orderResolutions(requested, table);
|
|
115
|
+
const path = ledgerPath(run.out);
|
|
116
|
+
const ledger = readLedger(path);
|
|
117
|
+
const recorded = pyGet(ledger, "resolutions", null);
|
|
118
|
+
const existing = isPlainObject(recorded) ? { ...recorded } : {};
|
|
119
|
+
const resolved = new Map();
|
|
120
|
+
for (const [field, by, value] of ordered) {
|
|
121
|
+
const key = resolutionKey(run.nodeType, field, by, value);
|
|
122
|
+
const found = findResolution(existing, run.nodeType, field, by, value);
|
|
123
|
+
if (found && !run.refreshLookups) {
|
|
124
|
+
const kept = pyStrAny(pyGet(found.row, "value", null));
|
|
125
|
+
resolved.set(field, kept);
|
|
126
|
+
run.reporter.info(resolutionLine(field, by, value, kept, true));
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
let got;
|
|
130
|
+
try {
|
|
131
|
+
got = await resolveOne(run.client, run.connectorKey, table.get(field), field, by, value, run.connectionId, resolved);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
// The collection was read to the END on this connection and the value
|
|
135
|
+
// is not in it. That is evidence about the CONNECTION, not only about
|
|
136
|
+
// the value — so before failing, the pipeline tries the other enabled
|
|
137
|
+
// connections for this connector, and needs the plan this lookup was
|
|
138
|
+
// part of to probe them. A transport failure is the parent class and
|
|
139
|
+
// passes through untouched: retrying it would dress a broken call up as
|
|
140
|
+
// "no connection has it".
|
|
141
|
+
//
|
|
142
|
+
// `capped` is the fourth row of #746's table and the reason the flag
|
|
143
|
+
// exists: a scan the record cap stopped did NOT reach the end, so it is
|
|
144
|
+
// not evidence of absence and "must not demote anything"
|
|
145
|
+
// (`LookupExhausted`'s own docstring, ported verbatim). DELIBERATE
|
|
146
|
+
// DIVERGENCE FROM THE PYTHON'S CODE, in favour of the Python's stated
|
|
147
|
+
// contract: `prepare_connector.py` never reads `capped` anywhere, so
|
|
148
|
+
// upstream `_write_resolutions` hands a capped miss to `_retry_or_exit`
|
|
149
|
+
// like any other and spends a full probe of every other connection on a
|
|
150
|
+
// scan that proved nothing — then reports "every candidate was read to
|
|
151
|
+
// the end", which is exactly false. Here a capped miss keeps its own
|
|
152
|
+
// refusal, whose text already names the remedy ("the value may be
|
|
153
|
+
// further in"). Upstream's own tests never covered the row, which is
|
|
154
|
+
// how it shipped unimplemented.
|
|
155
|
+
if (error instanceof LookupExhausted && !error.capped)
|
|
156
|
+
throw new ResolutionsExhausted(error, { specs: table, ordered });
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
resolved.set(field, got);
|
|
160
|
+
// A refresh of a row the Python recorded under the escaped key replaces
|
|
161
|
+
// it under the raw one, so the tuple does not end up recorded twice.
|
|
162
|
+
if (found && found.key !== key)
|
|
163
|
+
delete existing[found.key];
|
|
164
|
+
existing[key] = { nodeType: run.nodeType, field, by, match: value, value: got };
|
|
165
|
+
run.reporter.info(resolutionLine(field, by, value, got));
|
|
166
|
+
}
|
|
167
|
+
const written = { ...ledger, schemaVersion: "1", resolutions: existing };
|
|
168
|
+
writeLedger(path, written);
|
|
169
|
+
const count = Object.keys(existing).length;
|
|
170
|
+
// Printed as the author spelled `--out` (`os.path.join(args.out, …)`), not
|
|
171
|
+
// as the resolved path the file was written to.
|
|
172
|
+
run.reporter.info(wroteResolutionsLine(count, pyPathJoin(run.outShown ?? run.out, RESOLUTIONS_FILENAME)));
|
|
173
|
+
return { path, count, resolved };
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* `_resolved_parent_values`: `{parent → resolved id}` for every parent with a
|
|
177
|
+
* recorded resolution on `nodeType`, read from the ledger just written so the
|
|
178
|
+
* paste-ready `-f` re-run carries the ids THIS invocation resolved — never
|
|
179
|
+
* guessed, never retyped. A ledger that will not load answers nothing; the
|
|
180
|
+
* refusal for that belongs to the write that found it.
|
|
181
|
+
*/
|
|
182
|
+
export function resolvedParentValues(out, nodeType, parents) {
|
|
183
|
+
let ledger;
|
|
184
|
+
try {
|
|
185
|
+
ledger = readLedger(ledgerPath(out));
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (error instanceof LedgerRefusal)
|
|
189
|
+
return new Map();
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
const wanted = new Set(parents);
|
|
193
|
+
const out_ = new Map();
|
|
194
|
+
const rows = pyGet(ledger, "resolutions", null);
|
|
195
|
+
if (!isPlainObject(rows))
|
|
196
|
+
return new Map();
|
|
197
|
+
for (const [key, row] of Object.entries(rows)) {
|
|
198
|
+
const parsed = parseResolutionKey(key);
|
|
199
|
+
if (parsed === undefined)
|
|
200
|
+
continue;
|
|
201
|
+
const [keyNode, field] = parsed;
|
|
202
|
+
if (keyNode === nodeType && wanted.has(field) && isPlainObject(row))
|
|
203
|
+
out_.set(field, pyGet(row, "value", null));
|
|
204
|
+
}
|
|
205
|
+
const values = new Map();
|
|
206
|
+
for (const [field, value] of out_) {
|
|
207
|
+
if (value !== null && value !== undefined && value !== "")
|
|
208
|
+
values.set(field, pyStrAny(value));
|
|
209
|
+
}
|
|
210
|
+
return values;
|
|
211
|
+
}
|
|
212
|
+
/** `set(resolved_parents) == set(action_parents)`: every schema parent has a recorded resolution, the paste-ready re-run condition. */
|
|
213
|
+
export function allParentsResolved(actionParents, resolvedParents) {
|
|
214
|
+
const wanted = new Set(actionParents);
|
|
215
|
+
return wanted.size === resolvedParents.size && [...wanted].every((name) => resolvedParents.has(name));
|
|
216
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every line `prepare_connector.py` printed, as functions that RETURN the text.
|
|
3
|
+
*
|
|
4
|
+
* The messages are the product. An agent reads "prepare-connector: …" and does
|
|
5
|
+
* what it says, so each string here is kept verbatim from the Python — the
|
|
6
|
+
* same words, the same arrows, the same `…` — and the only thing that changed
|
|
7
|
+
* is that nothing in this module writes to a stream. The orchestration decides
|
|
8
|
+
* where a line goes (stdout for progress, stderr for `WARN:` and `note:`), and a
|
|
9
|
+
* test asserts on the text without capturing anything.
|
|
10
|
+
*
|
|
11
|
+
* Two conventions the Python had are made explicit:
|
|
12
|
+
*
|
|
13
|
+
* - `sys.exit("prepare-connector: …")` texts carry their prefix INSIDE the
|
|
14
|
+
* string, while a helper's exception was prefixed at the exit site
|
|
15
|
+
* (`sys.exit(f"prepare-connector: {error}")`). {@link PrepareRefusal} is a
|
|
16
|
+
* refusal whose message is already the full text; {@link exitText} spells
|
|
17
|
+
* both kinds the way the terminal saw them.
|
|
18
|
+
* - the pasteable `npx flow-sdk registry prepare` spelling is a parameter with
|
|
19
|
+
* the Python's literal as its default, so a caller driven from `uip` can
|
|
20
|
+
* spell the command for the binary in the reader's hand (see
|
|
21
|
+
* `core/cli-spelling.ts`) without this module reading the environment.
|
|
22
|
+
*/
|
|
23
|
+
import { Refusal } from "../errors.js";
|
|
24
|
+
export declare const PREFIX = "prepare-connector: ";
|
|
25
|
+
/** The spelling the Python hard-coded into every pasteable re-run. */
|
|
26
|
+
export declare const PREPARE_COMMAND = "npx flow-sdk registry prepare";
|
|
27
|
+
/** `prepare-connector: <text>`. */
|
|
28
|
+
export declare function prefixed(text: string): string;
|
|
29
|
+
/** `prepare-connector: next: <text>` — the last lines of a run, each one a call the reader can paste. */
|
|
30
|
+
export declare function nextLine(text: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* A refusal whose message is the COMPLETE text the Python passed to
|
|
33
|
+
* `sys.exit`, prefix included. Every other {@link Refusal} reaching the exit
|
|
34
|
+
* boundary is a helper's and gets the prefix there, as the Python's
|
|
35
|
+
* `sys.exit(f"prepare-connector: {error}")` did.
|
|
36
|
+
*/
|
|
37
|
+
export declare class PrepareRefusal extends Refusal {
|
|
38
|
+
constructor(message: string, code: string);
|
|
39
|
+
}
|
|
40
|
+
/** What the terminal showed for a thrown value: the Python's `sys.exit` text. */
|
|
41
|
+
export declare function exitText(error: unknown): string;
|
|
42
|
+
/** ` connection: <Name> (<id>)` — `found.get('Name')` renders `None` when the row has none, as Python did. */
|
|
43
|
+
export declare function connectionLine(row: Record<string, unknown>, connectionId: string): string;
|
|
44
|
+
/** ` bindings: <symbolic name> -> <bindings.json>`, once per row this run changed. */
|
|
45
|
+
export declare function bindingsLine(symbolicName: string, bindingsPath: string): string;
|
|
46
|
+
/** `_missing_generic_schema_message`: a Generic action that expanded to nothing. */
|
|
47
|
+
export declare function missingGenericSchemaMessage(operation: string, objectName?: string | null): string;
|
|
48
|
+
/**
|
|
49
|
+
* `_unresolved_action_message`: what to do when the action id is not a
|
|
50
|
+
* registry key. `actions` is what `registry search <key>` served (see
|
|
51
|
+
* `actions.ts`); the message is pure over it.
|
|
52
|
+
*
|
|
53
|
+
* NOT auto-substituted, deliberately: the baked action id and the registry key
|
|
54
|
+
* are different namespaces, and guessing between them would emit a node both
|
|
55
|
+
* offline validators accept and the runtime dispatches to the wrong operation.
|
|
56
|
+
*/
|
|
57
|
+
export declare function unresolvedActionMessage(connectorKey: string, action: string, nodeType: string, actions: readonly string[]): string;
|
|
58
|
+
export declare function noCanonicalEntryMessage(nodeType: string): string;
|
|
59
|
+
/** The `-f` names do not match any api-type ObjectAction; `specs` are the actions' parent lists. */
|
|
60
|
+
export declare function parentFieldNamesMismatchMessage(given: readonly string[], specs: ReadonlyArray<readonly [string, readonly string[]]>): string;
|
|
61
|
+
export declare function genericActionNeedsObjectMessage(): string;
|
|
62
|
+
export declare function objectFlagsOnlyForGenericMessage(): string;
|
|
63
|
+
/** `_parse_fields`'s refusal of a `-f` without `=`. */
|
|
64
|
+
export declare function fieldFlagMessage(pair: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* `_rejected_parent_fields_message`: the CLI's own rejection is the actionable
|
|
67
|
+
* half and the pipeline otherwise swallows it, so quote the service.
|
|
68
|
+
* `failures` are `(connector, object, operation, message)` tuples; the first
|
|
69
|
+
* non-empty message is the one quoted.
|
|
70
|
+
*/
|
|
71
|
+
export declare function rejectedParentFieldsMessage(pairs: readonly string[], failures?: ReadonlyArray<readonly unknown[]>): string;
|
|
72
|
+
/** ` object: <note>` — the ladder's normalization sentence. */
|
|
73
|
+
export declare function objectNoteLine(note: string): string;
|
|
74
|
+
/** ` object: <requested> -> <matched> recorded in <ledger>`. */
|
|
75
|
+
export declare function objectRecordedLine(requested: string, matched: string, ledgerPath: string): string;
|
|
76
|
+
/** `_input_field_note`: `N input field(s)`, or the unavailable marker when the count could not be read. */
|
|
77
|
+
export declare function inputFieldNote(count: number | undefined | null): string;
|
|
78
|
+
/** `JSON overlay only` or `overlay + <key>.ts`. */
|
|
79
|
+
export declare function tsNote(jsonOnly: boolean, connectorKey: string): string;
|
|
80
|
+
/** The action path's success line. */
|
|
81
|
+
export declare function preparedSummaryLine(nodeType: string, out: string, ts: string, variants: number, fieldNote: string): string;
|
|
82
|
+
/** Why this run did not overwrite the overlay (`_keep_prepared_schema`). */
|
|
83
|
+
export declare function keptSchemaMessage(action: string, kept: number, discarded: number): string;
|
|
84
|
+
/** The set was SHAPED right but resolved to nothing new: a VALUE is wrong for this connection. */
|
|
85
|
+
export declare function parentOnlyMessage(parents: readonly string[], fieldPairs: readonly string[]): string;
|
|
86
|
+
type Values = ReadonlyMap<string, string> | Readonly<Record<string, string>>;
|
|
87
|
+
/**
|
|
88
|
+
* The paste-ready re-run when every schema parent already has a recorded
|
|
89
|
+
* resolution: the ids `--resolve` just wrote ARE the `-f` values.
|
|
90
|
+
*/
|
|
91
|
+
export declare function resolvedParentsNote(connectorKey: string, action: string, actionParents: readonly string[], resolvedParents: Values, command?: string): string;
|
|
92
|
+
/** The note when some schema parent did not arrive as `-f`, with the example re-run. */
|
|
93
|
+
export declare function missingParentsNote(connectorKey: string, action: string, actionParents: readonly string[], missing: readonly string[], parentFields: Values, command?: string): string;
|
|
94
|
+
/** The parts of a lookup spec the vocabulary print reads. */
|
|
95
|
+
export interface VocabularySpec {
|
|
96
|
+
by?: readonly string[];
|
|
97
|
+
objectName?: string;
|
|
98
|
+
path?: string;
|
|
99
|
+
value?: string;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* `_print_lookup_vocabulary`: the lookup table for the operation just
|
|
104
|
+
* prepared, or no lines at all when it has no lookups. The markdown catalog
|
|
105
|
+
* renders this for BAKED schemas; a schema that only exists because `prepare`
|
|
106
|
+
* ran has no page, so the command is where the vocabulary first becomes
|
|
107
|
+
* knowable.
|
|
108
|
+
*/
|
|
109
|
+
export declare function lookupVocabularyLines(connectorKey: string, action: string, objectName: string | undefined | null, specs: ReadonlyMap<string, VocabularySpec>, command?: string): string[];
|
|
110
|
+
/** A `--resolve` names a field with no lookup; `known` are the fields that have one, sorted. */
|
|
111
|
+
export declare function unknownLookupMessage(unknown: readonly string[], nodeType: string, known: readonly string[]): string;
|
|
112
|
+
/** ` <field>: <by>=<value> -> <id>`, with ` (already resolved)` when the ledger answered. */
|
|
113
|
+
export declare function resolutionLine(field: string, by: string, value: string, got: unknown, alreadyResolved?: boolean): string;
|
|
114
|
+
export declare function wroteResolutionsLine(count: number, ledgerPath: string): string;
|
|
115
|
+
/**
|
|
116
|
+
* `generated N connector module(s) → <out>` — the descriptor generator's own
|
|
117
|
+
* last line (`generate_connectors_ts.py`), which `prepare` spawned between
|
|
118
|
+
* the resolution lines and its summary. `outDir` is `str(Path(args.output))`.
|
|
119
|
+
*/
|
|
120
|
+
export declare function generatedModulesLine(count: number, outDir: string): string;
|
|
121
|
+
/** `<Name> (<Folder>)` for a per-candidate report line (`_candidate_label`). */
|
|
122
|
+
export declare function candidateLabel(row: Record<string, unknown>): string;
|
|
123
|
+
/** ` <field>: not on this connection; trying N other <key> connection(s)`. */
|
|
124
|
+
export declare function tryingOtherConnectionsLine(field: string, count: number, connectorKey: string): string;
|
|
125
|
+
/** ` connection: <label> resolves <field>; re-running against it (--connection-id <id>)`. */
|
|
126
|
+
export declare function rerunAgainstLine(label: string, field: string, connectionId: string): string;
|
|
127
|
+
/** The terminal report's line for a candidate that resolved every requested lookup. */
|
|
128
|
+
export declare function candidateResolvesAllLine(label: string, lookups: number): string;
|
|
129
|
+
/** The terminal report's line for a candidate whose collection was read to the end. */
|
|
130
|
+
export declare function candidateExhaustedLine(label: string, field: string, scanned: number): string;
|
|
131
|
+
/** The terminal report's line for a candidate whose lookup failed for another reason: the error, verbatim. */
|
|
132
|
+
export declare function candidateErrorLine(label: string, error: unknown): string;
|
|
133
|
+
/**
|
|
134
|
+
* An explicit `--connection-id` / `--connection` is the author's decision and
|
|
135
|
+
* is not overridden. The alternatives are still named, because the whole cost
|
|
136
|
+
* of this bug was not knowing they existed. `first` is the exhausted lookup's
|
|
137
|
+
* own message; `others` the pasteable listing of the other candidates.
|
|
138
|
+
*/
|
|
139
|
+
export declare function pinnedConnectionExhaustedMessage(first: string, connectorKey: string, othersCount: number, othersListing: string): string;
|
|
140
|
+
/** The listing of other connections itself failed; the original lookup failure is what the author asked about. */
|
|
141
|
+
export declare function candidateListingFailedMessage(first: string, error: unknown): string;
|
|
142
|
+
export declare function onlyConnectionMessage(first: string, connectorKey: string): string;
|
|
143
|
+
/** Two or more candidates resolve everything: reported, never chosen between. */
|
|
144
|
+
export declare function severalConnectionsResolveMessage(count: number, connectorKey: string, listing: string): string;
|
|
145
|
+
/**
|
|
146
|
+
* Nothing resolved anywhere: every candidate and what it held, one per line.
|
|
147
|
+
* HERE is where the collection listing finally belongs — every connection has
|
|
148
|
+
* been tried, so seeing what the collection actually holds is the next step
|
|
149
|
+
* rather than the detour it is while a retry is still available.
|
|
150
|
+
*/
|
|
151
|
+
export declare function noConnectionResolvesMessage(connectorKey: string, first: {
|
|
152
|
+
field: string;
|
|
153
|
+
by: string;
|
|
154
|
+
value: string;
|
|
155
|
+
collection: string;
|
|
156
|
+
}, lines: readonly string[], connectionId: string): string;
|
|
157
|
+
export declare function eventParentFieldsMessage(): string;
|
|
158
|
+
export declare function eventAllObjectsMessage(): string;
|
|
159
|
+
/** A Generic event fires for ONE object; name it. `rows` is the `triggers objects` catalog. */
|
|
160
|
+
export declare function genericEventNeedsObjectMessage(action: string, rows: ReadonlyArray<Record<string, unknown>>): string;
|
|
161
|
+
export declare function objectOnCuratedEventMessage(action: string, builtInObject: unknown): string;
|
|
162
|
+
/** ` WARN: <error>` — a listing failure a curated event survives. */
|
|
163
|
+
export declare function warnLine(error: unknown): string;
|
|
164
|
+
/** The describe could not answer for a curated event; the definition's own sections stand in. */
|
|
165
|
+
export declare function describeFallbackWarning(error: unknown, bakedObject: string): string;
|
|
166
|
+
export declare function byoaListingFailedMessage(connectionId: string, error: unknown): string;
|
|
167
|
+
export declare function byoaRequiredMessage(connectionId: string, connectorKey: string, listing: string): string;
|
|
168
|
+
export declare function eventSummaryLine(eventNodeType: string, out: string, operation: string, mode: string, whereParameters: number, filterFields: number): string;
|
|
169
|
+
/** The first eight filterable field names, or nothing when the event has none. */
|
|
170
|
+
export declare function filterableFieldsLine(filterFields: ReadonlyArray<Record<string, unknown>>): string | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* The webhook note and the connector's own registration text, or nothing for a
|
|
173
|
+
* polling event. Registration is an act on the external service — the one step
|
|
174
|
+
* the loop cannot make deterministic — so the connector's words are handed over
|
|
175
|
+
* instead of leaving `uip is webhooks config` to be discovered.
|
|
176
|
+
*/
|
|
177
|
+
export declare function webhookNoteLines(mode: string, textBlocks: readonly string[]): string[];
|
|
178
|
+
/** `{ connector: '…', event: '…'[, object: '…'], connection: '…', folder: '…' }`. */
|
|
179
|
+
export declare function eventSubscription(connectorKey: string, action: string, objectName: string | undefined | null, connectionName: string, folderName: string): string;
|
|
180
|
+
export declare function eventNextLine(subscription: string): string;
|
|
181
|
+
export declare function sourceNotAFileLine(source: string): string;
|
|
182
|
+
export declare function severalSourcesLine(names: readonly string[]): string;
|
|
183
|
+
export declare function repointedLine(sourceRelative: string, specifier: string): string;
|
|
184
|
+
/** The two-line fallback when the module could not be read or exports several descriptors. */
|
|
185
|
+
export declare function descriptorUsageFallbackLines(sourcePosix: string): string[];
|
|
186
|
+
/** The module has one descriptor but its inputs interface could not be parsed. */
|
|
187
|
+
export declare function descriptorUsageUnparsedLines(sourcePosix: string, descriptorName: string): string[];
|
|
188
|
+
/** The ready-to-paste handoff for a module with exactly one descriptor. */
|
|
189
|
+
export declare function descriptorUsageLines(descriptorName: string, importPath: string, requiredFields: ReadonlyArray<readonly [name: string, type: string]>, boundConnection: string, boundFolder: string): string[];
|
|
190
|
+
export {};
|