@uipath/maestro-builder-sdk 6.116.0 → 6.117.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/check.d.ts +7 -0
- package/dist/check.js +56 -8
- package/dist/cli-library.js +17 -0
- package/dist/core/connector-output-fields.d.ts +15 -0
- package/dist/core/connector-output-fields.js +24 -0
- package/dist/core/expr-check.d.ts +36 -0
- package/dist/core/expr-check.js +48 -0
- package/dist/core/nodes/family.d.ts +8 -0
- package/dist/core/nodes/node-type.d.ts +6 -0
- package/dist/core/refusals.d.ts +4 -0
- package/dist/core/refusals.js +4 -0
- package/dist/flow-expr-check.d.ts +21 -7
- package/dist/flow-expr-check.js +84 -16
- package/dist/flow-node-registry.d.ts +7 -0
- package/dist/flow-node-registry.js +9 -0
- package/dist/flow-node-type.d.ts +8 -1
- package/dist/merge-cli.js +20 -2
- package/dist/nodes/connector/flow/family.js +4 -2
- package/dist/nodes/connector/flow/node-type.js +3 -0
- package/dist/nodes/connector/flow/output-read.d.ts +37 -0
- package/dist/nodes/connector/flow/output-read.js +23 -0
- package/dist/nodes/http/flow/check.js +12 -8
- package/dist/nodes/http/flow/factories.js +1 -1
- package/dist/nodes/http/flow/spec.d.ts +3 -3
- package/package.json +2 -2
package/dist/check.d.ts
CHANGED
|
@@ -83,6 +83,13 @@ export interface CheckOpts extends ConnectorCheckOpts, EventCheckOpts {
|
|
|
83
83
|
* whether it grants an error port is then the same answer in both rungs.
|
|
84
84
|
*/
|
|
85
85
|
connectorDefinition?: (connector: string, operation: string, version?: string, object?: string) => unknown;
|
|
86
|
+
/**
|
|
87
|
+
* The top-level fields one connector operation declares it returns (its
|
|
88
|
+
* library entry's `outputSchema`), for the read rule on `out(step, field)`.
|
|
89
|
+
* Undefined when the library cannot say: no declared fields, a list
|
|
90
|
+
* operation, or a schema that depends on the connection.
|
|
91
|
+
*/
|
|
92
|
+
connectorOutputFields?: (connector: string, operation: string, version?: string, object?: string) => readonly string[] | undefined;
|
|
86
93
|
/**
|
|
87
94
|
* The connector library `compile` serializes with. `check` runs the
|
|
88
95
|
* serializer in collect mode, with this library and `bindings`, to report
|
package/dist/check.js
CHANGED
|
@@ -6,9 +6,9 @@ import { FlowNode } from './core/node-classes.js';
|
|
|
6
6
|
import { definitionHasErrorPort } from './core/error-port.js';
|
|
7
7
|
import { bundledDefinition, resolveContributionDefinition, serialize } from './serialize.js';
|
|
8
8
|
import { checkEventResolution, checkEventSubscription, eventParamsFor, } from './core/event-checks.js';
|
|
9
|
-
import { checkCookedEscapes, checkFlowExpressions, literalExprShape, literalLooksLikeExpr } from './flow-expr-check.js';
|
|
9
|
+
import { checkCookedEscapes, checkFlowExpressions, checkVarsOnlyInQuotes, literalExprShape, literalLooksLikeExpr } from './flow-expr-check.js';
|
|
10
10
|
import { FLOW_EXPR_DIALECT, checkBindingLabels, checkConnectorLookups as coreCheckConnectorLookups, checkConnectorResources as coreCheckConnectorResources, checkConnectorSchema as coreCheckConnectorSchema, } from './core/connector-checks.js';
|
|
11
|
-
import { nearestName } from './core/edit-distance.js';
|
|
11
|
+
import { editDistance, nearestName } from './core/edit-distance.js';
|
|
12
12
|
import { escapeRegExp } from './core/escape-regexp.js';
|
|
13
13
|
import { hasExits } from './core/step-ports.js';
|
|
14
14
|
import { actionTails, armReachesJoin } from './flow-parallel-hitl.js';
|
|
@@ -20,7 +20,7 @@ import { childStepLists } from './flow-step-tree.js';
|
|
|
20
20
|
import { VARS_READ_RE } from './core/vars-read.js';
|
|
21
21
|
import { FLOW_METADATA_KEYS, unknownMetadataKeys } from './core/flow-metadata.js';
|
|
22
22
|
import { endContentKey } from './flow-end-content.js';
|
|
23
|
-
import { FLOW_NODE_TYPES, FLOW_TRIGGER_TYPES } from './flow-node-registry.js';
|
|
23
|
+
import { FLOW_NODE_TYPES, FLOW_TRIGGER_TYPES, isNodeTypeFinding } from './flow-node-registry.js';
|
|
24
24
|
import { stepExits, stepRouting } from './flow-step-exits.js';
|
|
25
25
|
import { stepDeclaredVariables } from './flow-step-variables.js';
|
|
26
26
|
import { resolveVersion, resolveVersionCarried } from './core/nodes/versioned.js';
|
|
@@ -49,7 +49,7 @@ export function checkCompiled(built, opts = {}) {
|
|
|
49
49
|
const diags = checkFlow(built, [], opts);
|
|
50
50
|
// Once, from the top: the walk reaches child flows itself, so running it per
|
|
51
51
|
// `checkFlow` would report a child's escape twice.
|
|
52
|
-
for (const d of checkCookedEscapes(built)) {
|
|
52
|
+
for (const d of [...checkCookedEscapes(built), ...checkVarsOnlyInQuotes(built)]) {
|
|
53
53
|
diags.push({
|
|
54
54
|
level: d.level, code: d.code, message: `In ${d.where}: ${d.message}`,
|
|
55
55
|
...(d.step !== undefined ? { step: d.step } : {}),
|
|
@@ -103,7 +103,11 @@ export function scopeToEdit(edited, baseline) {
|
|
|
103
103
|
const sorted = classifyDrafts(baseline.flow ?? {}, edited.flow ?? {}, baseline.flow, placed);
|
|
104
104
|
const kept = new Set(sorted.kept.map((f) => f.index));
|
|
105
105
|
const unplaced = new Set(sorted.unplaced.map((f) => f.index));
|
|
106
|
-
|
|
106
|
+
// A finding about the node's type (a retired node, `aboutNodeType`) is not
|
|
107
|
+
// introduced by an edit to the node's content, so it is judged as if the node
|
|
108
|
+
// were unchanged: pre-existing when the baseline reports it on the same node.
|
|
109
|
+
// A node the edit added has no baseline finding, so it stays edited.
|
|
110
|
+
const preExisting = preExistingFindings(placed.map((f) => ({ level: f.level, code: f.code, message: f.message, place: unplaced.has(f.index) ? '' : f.nodeId, unchanged: kept.has(f.index) || isNodeTypeFinding(f.code) })), locate(baseline).map((b) => ({ level: b.level, code: b.code, message: b.message, place: b.nodeId })));
|
|
107
111
|
const out = scopeFindings(edited.diagnostics, preExisting, PRE_EXISTING_LOWERING_NOTE);
|
|
108
112
|
if (edited.stoppedAt) {
|
|
109
113
|
const at = edited.stoppedAt.code !== undefined ? `[${edited.stoppedAt.code}] ` : '';
|
|
@@ -1138,7 +1142,8 @@ function checkFlow(built, ancestors, opts = {}) {
|
|
|
1138
1142
|
// at the same point as the per-family no-output rules below.
|
|
1139
1143
|
const placed = checkedSteps.get(name);
|
|
1140
1144
|
if (placed) {
|
|
1141
|
-
const contract = placed.impl.
|
|
1145
|
+
const contract = placed.impl.checkOutput?.(placed.spec, opts)
|
|
1146
|
+
?? placed.impl.output(placed.spec, { resources: opts.resources });
|
|
1142
1147
|
if (contract.kind === 'none') {
|
|
1143
1148
|
diags.push(catalogued(placed.entry, step, contract.code, contract.message({ node: name, ref: `$vars.${name}${field ? '.' + field : ''}`, reader: step })));
|
|
1144
1149
|
continue;
|
|
@@ -1213,14 +1218,16 @@ function checkFlow(built, ancestors, opts = {}) {
|
|
|
1213
1218
|
// A registered node type that states its output's fields: the same read
|
|
1214
1219
|
// rule, worded by its contract and reported through its family's catalog.
|
|
1215
1220
|
const fieldsPlaced = checkedSteps.get(name);
|
|
1216
|
-
const fieldsContract = fieldsPlaced
|
|
1221
|
+
const fieldsContract = fieldsPlaced
|
|
1222
|
+
&& (fieldsPlaced.impl.checkOutput?.(fieldsPlaced.spec, opts)
|
|
1223
|
+
?? fieldsPlaced.impl.output(fieldsPlaced.spec, { resources: opts.resources }));
|
|
1217
1224
|
if (fieldsPlaced && fieldsContract?.kind === 'fields') {
|
|
1218
1225
|
const found = [];
|
|
1219
1226
|
checkDeclaredOutputRead({
|
|
1220
1227
|
prefix: fieldsContract.read.codePrefix, what: fieldsContract.read.label, name, field, rest, step,
|
|
1221
1228
|
diags: found, withoutReturns: fieldsContract.read.whenUndeclared,
|
|
1222
1229
|
declared: fieldsContract.fields === undefined ? undefined : Object.keys(fieldsContract.fields),
|
|
1223
|
-
open: fieldsContract.open,
|
|
1230
|
+
open: fieldsContract.open, partial: fieldsContract.partial,
|
|
1224
1231
|
});
|
|
1225
1232
|
for (const d of found)
|
|
1226
1233
|
diags.push(catalogued(fieldsPlaced.entry, step, d.code, d.message, d.suggestion));
|
|
@@ -2151,6 +2158,47 @@ function checkDeclaredOutputRead(o) {
|
|
|
2151
2158
|
if (o.declared.includes(wanted))
|
|
2152
2159
|
return;
|
|
2153
2160
|
const nearest = nearestName(wanted, o.declared);
|
|
2161
|
+
if (o.partial) {
|
|
2162
|
+
// A bracket or other non-identifier head (`output['updated-at']`) is not
|
|
2163
|
+
// judged: the split above cannot tell where its name ends.
|
|
2164
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(wanted))
|
|
2165
|
+
return;
|
|
2166
|
+
if (nearest !== undefined && nearest.toLowerCase() === wanted.toLowerCase()) {
|
|
2167
|
+
diags.push({
|
|
2168
|
+
level: 'error', code: `${prefix}_READ_FIELD_CASE`, step,
|
|
2169
|
+
message: `${what} "${name}" declares the output "${nearest}", but "$vars.${name}.output.${wanted}" (read in `
|
|
2170
|
+
+ `"${step}") spells it "${wanted}". Field names are case-sensitive, so unless the response itself uses `
|
|
2171
|
+
+ `"${wanted}", this read resolves to undefined at run time.`,
|
|
2172
|
+
suggestion: `out('${name}', '${nearest}')`,
|
|
2173
|
+
});
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
// Suggest only a close typo (`convrsationId` -> `conversationId`), at most
|
|
2177
|
+
// one edit per three letters: `ok` is two edits from `id`, and a declared
|
|
2178
|
+
// list of dozens nearly always has a short name (`id`) inside the read, so
|
|
2179
|
+
// `nearestName`'s looser match would point at an unrelated field.
|
|
2180
|
+
let suggested;
|
|
2181
|
+
let best = Math.min(2, Math.floor(wanted.length / 3)) + 1;
|
|
2182
|
+
for (const c of o.declared) {
|
|
2183
|
+
const d = editDistance(wanted.toLowerCase(), c.toLowerCase());
|
|
2184
|
+
if (d < best) {
|
|
2185
|
+
best = d;
|
|
2186
|
+
suggested = c;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
// A large response (Jira's get-issue) declares dozens of heads; name the first ones.
|
|
2190
|
+
const listed = o.declared.length > 20
|
|
2191
|
+
? `${o.declared.slice(0, 20).join(', ')} and ${o.declared.length - 20} more`
|
|
2192
|
+
: o.declared.join(', ');
|
|
2193
|
+
diags.push({
|
|
2194
|
+
level: 'error', code: `${prefix}_READ_UNKNOWN_FIELD`, step,
|
|
2195
|
+
message: `${what} "${name}" declares no output "${wanted}" (read as "$vars.${name}.output.${wanted}" in `
|
|
2196
|
+
+ `"${step}"). It declares: ${listed}. The declared list can miss a field the response `
|
|
2197
|
+
+ `really carries; keep the read only if you have seen "${wanted}" in a real response.`,
|
|
2198
|
+
...(suggested !== undefined ? { suggestion: `out('${name}', '${suggested}')` } : {}),
|
|
2199
|
+
});
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2154
2202
|
diags.push({
|
|
2155
2203
|
level: 'error', code: `${prefix}_READ_UNKNOWN_FIELD`, step,
|
|
2156
2204
|
message: `${what} "${name}" declares no output "${wanted}" (read as "$vars.${name}.output.${wanted}" in `
|
package/dist/cli-library.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { connectorCheckOpts } from './core/cli-library.js';
|
|
2
|
+
import { connectorOutputFields } from './core/connector-output-fields.js';
|
|
2
3
|
import { synthesizedDefinitionRefusal } from './core/synthesized-definition.js';
|
|
3
4
|
import { connectorInputErrors } from './serialize.js';
|
|
4
5
|
export { openCliLibrary, connectorCheckOpts, eventResolveErrorFor, byoaCheckOpts } from './core/cli-library.js';
|
|
@@ -20,6 +21,8 @@ export function flowCheckOpts(library, bindings) {
|
|
|
20
21
|
};
|
|
21
22
|
if (!library)
|
|
22
23
|
return shared;
|
|
24
|
+
// One resolve per operation per check; the read rule asks on every read.
|
|
25
|
+
const outputFields = new Map();
|
|
23
26
|
return {
|
|
24
27
|
...shared,
|
|
25
28
|
listEnvelope: (connector, operation, version, object) => {
|
|
@@ -38,5 +41,19 @@ export function flowCheckOpts(library, bindings) {
|
|
|
38
41
|
return undefined; // as above
|
|
39
42
|
}
|
|
40
43
|
},
|
|
44
|
+
connectorOutputFields: (connector, operation, version, object) => {
|
|
45
|
+
const id = JSON.stringify([connector, operation, version ?? null, object ?? null]);
|
|
46
|
+
if (outputFields.has(id))
|
|
47
|
+
return outputFields.get(id);
|
|
48
|
+
let fields;
|
|
49
|
+
try {
|
|
50
|
+
fields = connectorOutputFields(library.resolve(connector, operation, version, object), library.schemaReadiness(connector, operation, version, object));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
fields = undefined; // as above
|
|
54
|
+
}
|
|
55
|
+
outputFields.set(id, fields);
|
|
56
|
+
return fields;
|
|
57
|
+
},
|
|
41
58
|
};
|
|
42
59
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The top-level output fields a connector operation declares (the heads of its
|
|
3
|
+
* library entry's `outputSchema.fields`: `fields.issuetype.name` -> `fields`),
|
|
4
|
+
* for the read rule on `out(step, field)`. The list is not exhaustive.
|
|
5
|
+
*
|
|
6
|
+
* `undefined` means "the library cannot say", and the rule stays silent:
|
|
7
|
+
*
|
|
8
|
+
* - no declared fields;
|
|
9
|
+
* - a `List` operation: the output is the collection, the fields an item's;
|
|
10
|
+
* - a file response: an `octet-stream` field names the file, not a property;
|
|
11
|
+
* - an object no entry describes (`objectNameUnverified`);
|
|
12
|
+
* - a connection-resolved schema not yet prepared (`schemaReadiness`).
|
|
13
|
+
*/
|
|
14
|
+
import type { ResolvedConnector, SchemaReadiness } from './library.js';
|
|
15
|
+
export declare function connectorOutputFields(rc: ResolvedConnector, readiness: SchemaReadiness | undefined): readonly string[] | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function connectorOutputFields(rc, readiness) {
|
|
2
|
+
if (rc.objectNameUnverified)
|
|
3
|
+
return undefined;
|
|
4
|
+
if (readiness && !readiness.prepared)
|
|
5
|
+
return undefined;
|
|
6
|
+
const entry = rc.entry;
|
|
7
|
+
if (entry?.operation?.name === 'List')
|
|
8
|
+
return undefined;
|
|
9
|
+
const fields = entry?.outputSchema?.fields;
|
|
10
|
+
if (!Array.isArray(fields))
|
|
11
|
+
return undefined;
|
|
12
|
+
const heads = new Set();
|
|
13
|
+
for (const f of fields) {
|
|
14
|
+
if (f?.type === 'octet-stream')
|
|
15
|
+
return undefined;
|
|
16
|
+
const name = f?.name;
|
|
17
|
+
if (typeof name !== 'string')
|
|
18
|
+
continue;
|
|
19
|
+
const head = name.split(/[.[]/, 1)[0];
|
|
20
|
+
if (head)
|
|
21
|
+
heads.add(head);
|
|
22
|
+
}
|
|
23
|
+
return heads.size > 0 ? [...heads] : undefined;
|
|
24
|
+
}
|
|
@@ -114,6 +114,42 @@ export interface ExprScope {
|
|
|
114
114
|
* `namespace` defaults to `$vars` (Flow); Case passes `case`.
|
|
115
115
|
*/
|
|
116
116
|
export declare function extractRefs(expr: string, namespace?: string): ExprRef[];
|
|
117
|
+
/** A quoted mention of the namespace inside an expression that reads none (`quotedOnlyMentions`). */
|
|
118
|
+
export interface QuotedMention {
|
|
119
|
+
/** The string literal as written, quotes included: `'$vars.start.output.topic'`. */
|
|
120
|
+
literal: string;
|
|
121
|
+
/** The text inside the quotes. */
|
|
122
|
+
text: string;
|
|
123
|
+
/**
|
|
124
|
+
* Where `literal` sits in the expression (`expr.slice(start, end) === literal`), for a
|
|
125
|
+
* whole string: a quoted string or a template with no parts. Absent for a piece of a
|
|
126
|
+
* template with parts (head, middle, tail): its token carries the `` ` ``/`${`/`}`
|
|
127
|
+
* delimiters, so there is no quoted reference to unquote in place.
|
|
128
|
+
*/
|
|
129
|
+
start?: number;
|
|
130
|
+
end?: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The string literals that mention `<namespace>.` (or `<namespace>[`) in an
|
|
134
|
+
* expression that reads no variable, or `undefined` when the expression reads
|
|
135
|
+
* one, mentions the namespace in no string, or does not parse (that is
|
|
136
|
+
* EXPR_SYNTAX's). A read is the namespace itself or any other `$`-prefixed root
|
|
137
|
+
* (`$metadata.instanceId`): an expression that reads `$metadata` is not a
|
|
138
|
+
* constant, whatever its quoted text says.
|
|
139
|
+
*
|
|
140
|
+
* For instance `'"' + '$vars.start.output.topic' + '"'` reads no variable: the
|
|
141
|
+
* reference sits inside quotes, so the expression is the string constant
|
|
142
|
+
* `"$vars.start.output.topic"` on every run. `$vars.a.output + ' ($vars.b)'`
|
|
143
|
+
* reads `$vars.a`, so it is not reported: a mention in text beside a real read
|
|
144
|
+
* may well be deliberate.
|
|
145
|
+
*
|
|
146
|
+
* Parsed, not pattern-matched: a read is an identifier token in code (a member
|
|
147
|
+
* chain, `Object.keys($vars)`, a `${...}` part of a template), and a mention is
|
|
148
|
+
* a string or template text piece that contains the namespace. So an escaped
|
|
149
|
+
* quote, a comment, a regular expression and a string inside a template part
|
|
150
|
+
* are each read for what they are.
|
|
151
|
+
*/
|
|
152
|
+
export declare function quotedOnlyMentions(expr: string, namespace?: string): QuotedMention[] | undefined;
|
|
117
153
|
/**
|
|
118
154
|
* First-level check of ONE expression: every reference's root must resolve (or, for a
|
|
119
155
|
* root declared with a dot in its name, its leading segments; see `unresolvedDottedName`).
|
package/dist/core/expr-check.js
CHANGED
|
@@ -225,6 +225,54 @@ export function extractRefs(expr, namespace = DEFAULT_NAMESPACE) {
|
|
|
225
225
|
}
|
|
226
226
|
return refs;
|
|
227
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* The string literals that mention `<namespace>.` (or `<namespace>[`) in an
|
|
230
|
+
* expression that reads no variable, or `undefined` when the expression reads
|
|
231
|
+
* one, mentions the namespace in no string, or does not parse (that is
|
|
232
|
+
* EXPR_SYNTAX's). A read is the namespace itself or any other `$`-prefixed root
|
|
233
|
+
* (`$metadata.instanceId`): an expression that reads `$metadata` is not a
|
|
234
|
+
* constant, whatever its quoted text says.
|
|
235
|
+
*
|
|
236
|
+
* For instance `'"' + '$vars.start.output.topic' + '"'` reads no variable: the
|
|
237
|
+
* reference sits inside quotes, so the expression is the string constant
|
|
238
|
+
* `"$vars.start.output.topic"` on every run. `$vars.a.output + ' ($vars.b)'`
|
|
239
|
+
* reads `$vars.a`, so it is not reported: a mention in text beside a real read
|
|
240
|
+
* may well be deliberate.
|
|
241
|
+
*
|
|
242
|
+
* Parsed, not pattern-matched: a read is an identifier token in code (a member
|
|
243
|
+
* chain, `Object.keys($vars)`, a `${...}` part of a template), and a mention is
|
|
244
|
+
* a string or template text piece that contains the namespace. So an escaped
|
|
245
|
+
* quote, a comment, a regular expression and a string inside a template part
|
|
246
|
+
* are each read for what they are.
|
|
247
|
+
*/
|
|
248
|
+
export function quotedOnlyMentions(expr, namespace = DEFAULT_NAMESPACE) {
|
|
249
|
+
if (!expr.includes(namespace))
|
|
250
|
+
return undefined;
|
|
251
|
+
const ts = typescript();
|
|
252
|
+
const { source, problems } = parseExpression(expr);
|
|
253
|
+
if (problems.length)
|
|
254
|
+
return undefined;
|
|
255
|
+
const mention = new RegExp(`${escapeRegExp(namespace)}\\s*[.[]`);
|
|
256
|
+
let reads = 0;
|
|
257
|
+
const found = [];
|
|
258
|
+
const visit = (node) => {
|
|
259
|
+
if (ts.isIdentifier(node) && (node.text === namespace || node.text.startsWith('$')))
|
|
260
|
+
reads++;
|
|
261
|
+
else if (node.kind >= ts.SyntaxKind.FirstLiteralToken && node.kind <= ts.SyntaxKind.LastTemplateToken
|
|
262
|
+
&& node.kind !== ts.SyntaxKind.RegularExpressionLiteral) {
|
|
263
|
+
const text = node.text;
|
|
264
|
+
// The source is `(${expr}\n)`: one character before the expression starts.
|
|
265
|
+
const start = node.getStart(source) - 1;
|
|
266
|
+
const whole = node.kind === ts.SyntaxKind.StringLiteral || node.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral;
|
|
267
|
+
const literal = expr.slice(start, node.end - 1);
|
|
268
|
+
if (mention.test(text))
|
|
269
|
+
found.push(whole ? { literal, text, start, end: node.end - 1 } : { literal, text });
|
|
270
|
+
}
|
|
271
|
+
ts.forEachChild(node, visit);
|
|
272
|
+
};
|
|
273
|
+
visit(source);
|
|
274
|
+
return reads === 0 && found.length ? found : undefined;
|
|
275
|
+
}
|
|
228
276
|
/** True when `a` and `b` are equal or one edit (insert/delete/substitute) apart. */
|
|
229
277
|
function editDistanceLE1(a, b) {
|
|
230
278
|
if (a === b)
|
|
@@ -14,6 +14,14 @@ import type { AnyNodeType } from './versioned.js';
|
|
|
14
14
|
export type DiagnosticCatalog = Readonly<Record<string, {
|
|
15
15
|
readonly severity: 'error' | 'warning';
|
|
16
16
|
readonly summary: string;
|
|
17
|
+
/**
|
|
18
|
+
* The finding is about the node's type, not its content (a retired node type).
|
|
19
|
+
* An edit to the node's content does not introduce it, so under a baseline
|
|
20
|
+
* (`check --baseline`, `merge --baseline-from`) it is pre-existing when the
|
|
21
|
+
* baseline reports the same code on the same node, even when the edit changed
|
|
22
|
+
* that node. Unset for a finding about what the node holds.
|
|
23
|
+
*/
|
|
24
|
+
readonly aboutNodeType?: boolean;
|
|
17
25
|
}>>;
|
|
18
26
|
/** One placed node of a family, as the family-level check sees it. */
|
|
19
27
|
export interface Placement<Spec = unknown> {
|
|
@@ -94,6 +94,11 @@ export interface FieldsRead {
|
|
|
94
94
|
* states the fields a read may name — `undefined` when the author declared none,
|
|
95
95
|
* which makes any field read its own mistake — and `read` keeps the wording of
|
|
96
96
|
* the read rule it replaces, for the same reason. `open` admits any field.
|
|
97
|
+
* `partial` says the list may miss fields the value really carries (a
|
|
98
|
+
* connector operation's library schema): a read that differs from a declared
|
|
99
|
+
* field only in letter case is `<PREFIX>_READ_FIELD_CASE`, certain to read
|
|
100
|
+
* undefined, and any other miss is `<PREFIX>_READ_UNKNOWN_FIELD`, worded as a
|
|
101
|
+
* possible gap in the list, at the severity the family's catalog gives it.
|
|
97
102
|
*
|
|
98
103
|
* `reader` is for an output whose shape no field list states: an HTTP response is
|
|
99
104
|
* an envelope (`body`, `statusCode`, `headers`) whose `body` holds the author's
|
|
@@ -108,6 +113,7 @@ export type OutputContract = {
|
|
|
108
113
|
readonly kind: 'fields';
|
|
109
114
|
readonly fields: Readonly<Record<string, TypeDesc>> | undefined;
|
|
110
115
|
readonly open?: boolean;
|
|
116
|
+
readonly partial?: boolean;
|
|
111
117
|
readonly read: FieldsRead;
|
|
112
118
|
} | {
|
|
113
119
|
readonly kind: 'reader';
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -241,6 +241,9 @@ export declare const REFUSALS: {
|
|
|
241
241
|
readonly CONNECTOR_OBJECT_REQUIRED: "draft";
|
|
242
242
|
readonly CONNECTOR_OUTPUT_SOURCE: "lint";
|
|
243
243
|
readonly CONNECTOR_OUTPUT_VAR_CLASH: "lint";
|
|
244
|
+
readonly CONNECTOR_READ_FIELD_CASE: "lint";
|
|
245
|
+
readonly CONNECTOR_READ_NOT_OUTPUT: "lint";
|
|
246
|
+
readonly CONNECTOR_READ_UNKNOWN_FIELD: "lint";
|
|
244
247
|
readonly CONNECTOR_RESOLVE_FAILED: "lowering";
|
|
245
248
|
readonly CONTINUE_OUTSIDE_LOOP: "lowering";
|
|
246
249
|
readonly CONTRIBUTION_BINDING_UNRESOLVED: "draft";
|
|
@@ -351,6 +354,7 @@ export declare const REFUSALS: {
|
|
|
351
354
|
readonly EXPR_BARE_VAR_REF: "lint";
|
|
352
355
|
readonly EXPR_SYNTAX: "lowering";
|
|
353
356
|
readonly EXPR_UNDECLARED_REF: "lint";
|
|
357
|
+
readonly EXPR_VARS_ONLY_IN_QUOTES: "lint";
|
|
354
358
|
readonly EXTERNAL_TASK_CONNECTION: "lowering";
|
|
355
359
|
readonly EXTERNAL_TASK_DESCRIPTOR: "lint";
|
|
356
360
|
readonly EXTERNAL_TASK_DESCRIPTOR_CONTRACT: "lowering";
|
package/dist/core/refusals.js
CHANGED
|
@@ -315,6 +315,9 @@ export const REFUSALS = {
|
|
|
315
315
|
CONNECTOR_OBJECT_REQUIRED: 'draft',
|
|
316
316
|
CONNECTOR_OUTPUT_SOURCE: 'lint',
|
|
317
317
|
CONNECTOR_OUTPUT_VAR_CLASH: 'lint',
|
|
318
|
+
CONNECTOR_READ_FIELD_CASE: 'lint',
|
|
319
|
+
CONNECTOR_READ_NOT_OUTPUT: 'lint',
|
|
320
|
+
CONNECTOR_READ_UNKNOWN_FIELD: 'lint',
|
|
318
321
|
CONNECTOR_RESOLVE_FAILED: 'lowering',
|
|
319
322
|
CONTINUE_OUTSIDE_LOOP: 'lowering',
|
|
320
323
|
CONTRIBUTION_BINDING_UNRESOLVED: 'draft',
|
|
@@ -425,6 +428,7 @@ export const REFUSALS = {
|
|
|
425
428
|
EXPR_BARE_VAR_REF: 'lint',
|
|
426
429
|
EXPR_SYNTAX: 'lowering',
|
|
427
430
|
EXPR_UNDECLARED_REF: 'lint',
|
|
431
|
+
EXPR_VARS_ONLY_IN_QUOTES: 'lint',
|
|
428
432
|
EXTERNAL_TASK_CONNECTION: 'lowering',
|
|
429
433
|
EXTERNAL_TASK_DESCRIPTOR: 'lint',
|
|
430
434
|
EXTERNAL_TASK_DESCRIPTOR_CONTRACT: 'lowering',
|
|
@@ -23,19 +23,33 @@ export declare function checkFlowExpressions(built: BuiltFlow): LocatedDiagnosti
|
|
|
23
23
|
* Every `js` template escape that changed what its expression means
|
|
24
24
|
* (JS_ESCAPE_COOKED), each stamped with where it sits.
|
|
25
25
|
*
|
|
26
|
-
* WHY A GENERIC WALK. The two per-site walks (`walk` above and `check.ts`'s
|
|
27
|
-
* expression collection) each enumerate the positions an expression can sit in,
|
|
28
|
-
* and neither covers all of them — HTTP branch conditions, trigger filters and
|
|
29
|
-
* error-handler bodies each live in only one, or none. This warning is about the
|
|
30
|
-
* `Expr` itself, not about the field it fills, so it visits every `Expr` reachable
|
|
31
|
-
* from the built flow, child flows included: a new position cannot be missed.
|
|
32
|
-
*
|
|
33
26
|
* Only `meaning` effects are reported here. An escape that breaks the parse is
|
|
34
27
|
* named by EXPR_SYNTAX, which the serializer refuses.
|
|
35
28
|
*/
|
|
36
29
|
export declare function checkCookedEscapes(built: BuiltFlow): (LocatedDiagnostic & {
|
|
37
30
|
step?: string;
|
|
38
31
|
})[];
|
|
32
|
+
/**
|
|
33
|
+
* EXPR_VARS_ONLY_IN_QUOTES (warning, #1971): an expression whose every `$vars`
|
|
34
|
+
* mention sits inside a string literal, so it reads no variable and evaluates
|
|
35
|
+
* to the same constant on every run. For instance
|
|
36
|
+
* js`'"' + '$vars.start.output.topic' + '"'` is the text
|
|
37
|
+
* `"$vars.start.output.topic"`, not the topic: the reference was quoted.
|
|
38
|
+
*
|
|
39
|
+
* Only an expression that reads NO variable is reported (`quotedOnlyMentions`):
|
|
40
|
+
* `$vars.a.output + ' ($vars.b)'` and `$metadata.instanceId + ' $vars.b'` each
|
|
41
|
+
* read one, and a mention beside a real read may be deliberate text. A `lit(...)` is not an
|
|
42
|
+
* expression, and a script body (`code`) or a prompt is a plain string, so
|
|
43
|
+
* none of them is read here.
|
|
44
|
+
*
|
|
45
|
+
* The suggestion is the expression with each quoted whole reference unquoted
|
|
46
|
+
* (`'$vars.start.output.topic'` → `$vars.start.output.topic`), when every
|
|
47
|
+
* mention is one; a mention inside longer text (`'Hi $vars.x'`) has no
|
|
48
|
+
* mechanical fix, so the message points at `tmpl`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkVarsOnlyInQuotes(built: BuiltFlow): (LocatedDiagnostic & {
|
|
51
|
+
step?: string;
|
|
52
|
+
})[];
|
|
39
53
|
/**
|
|
40
54
|
* How a plain string looks like an expression: `text` = sent as written,
|
|
41
55
|
* `template` = interpolated through `{{ … }}`, `wire` = evaluated because it
|
package/dist/flow-expr-check.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* script body's `$vars.*` reads are `check.ts`'s UNKNOWN_REF.
|
|
33
33
|
*/
|
|
34
34
|
import { Expr, cookedEscapesOf } from './core/expr.js';
|
|
35
|
-
import { checkExpression, cookedEscapeDiagnostics, extractRefs } from './core/expr-check.js';
|
|
35
|
+
import { checkExpression, cookedEscapeDiagnostics, extractRefs, quotedOnlyMentions } from './core/expr-check.js';
|
|
36
36
|
import { refusalClass } from './core/refusals.js';
|
|
37
37
|
import { stepDeclaredVariables } from './flow-step-variables.js';
|
|
38
38
|
import { CompileRefusal } from './core/compile-refusal.js';
|
|
@@ -222,34 +222,31 @@ export function checkFlowExpressions(built) {
|
|
|
222
222
|
return out;
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
225
|
+
* Visit every `Expr` reachable from the built flow, child flows included, with
|
|
226
|
+
* where it sits.
|
|
227
227
|
*
|
|
228
228
|
* WHY A GENERIC WALK. The two per-site walks (`walk` above and `check.ts`'s
|
|
229
229
|
* expression collection) each enumerate the positions an expression can sit in,
|
|
230
230
|
* and neither covers all of them — HTTP branch conditions, trigger filters and
|
|
231
|
-
* error-handler bodies each live in only one, or none.
|
|
232
|
-
*
|
|
233
|
-
*
|
|
231
|
+
* error-handler bodies each live in only one, or none. A rule about the `Expr`
|
|
232
|
+
* itself, not about the field it fills (JS_ESCAPE_COOKED,
|
|
233
|
+
* EXPR_VARS_ONLY_IN_QUOTES), visits every `Expr` this way: a new position
|
|
234
|
+
* cannot be missed. Run it once, from the top: it reaches child flows itself.
|
|
234
235
|
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
236
|
+
* `onExpr` gets an `Expr`, or a value of another SDK copy that carries cooked
|
|
237
|
+
* escapes (`cookedEscapesOf`); the walk does not descend into either.
|
|
237
238
|
*/
|
|
238
|
-
|
|
239
|
-
const out = [];
|
|
239
|
+
function visitExprs(built, onExpr) {
|
|
240
240
|
const seen = new WeakSet();
|
|
241
241
|
const root = built;
|
|
242
242
|
const visit = (val, at) => {
|
|
243
243
|
if (val === null || typeof val !== 'object')
|
|
244
244
|
return;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
for (const d of cookedEscapeDiagnostics(val.js, escapes)) {
|
|
248
|
-
out.push({ ...d, where: at.where, ...(at.step !== undefined ? { step: at.step } : {}) });
|
|
249
|
-
}
|
|
245
|
+
if (val instanceof Expr || cookedEscapesOf(val).length) {
|
|
246
|
+
onExpr(val, at);
|
|
250
247
|
return;
|
|
251
248
|
}
|
|
252
|
-
if (
|
|
249
|
+
if (seen.has(val))
|
|
253
250
|
return;
|
|
254
251
|
seen.add(val);
|
|
255
252
|
if (Array.isArray(val)) {
|
|
@@ -278,6 +275,77 @@ export function checkCookedEscapes(built) {
|
|
|
278
275
|
visit(v, at);
|
|
279
276
|
};
|
|
280
277
|
visit(built, { where: 'flow', prefix: '' });
|
|
278
|
+
}
|
|
279
|
+
/** A finding stamped with where its `Expr` sits (`visitExprs`). */
|
|
280
|
+
function located(d, at) {
|
|
281
|
+
return { ...d, where: at.where, ...(at.step !== undefined ? { step: at.step } : {}) };
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Every `js` template escape that changed what its expression means
|
|
285
|
+
* (JS_ESCAPE_COOKED), each stamped with where it sits.
|
|
286
|
+
*
|
|
287
|
+
* Only `meaning` effects are reported here. An escape that breaks the parse is
|
|
288
|
+
* named by EXPR_SYNTAX, which the serializer refuses.
|
|
289
|
+
*/
|
|
290
|
+
export function checkCookedEscapes(built) {
|
|
291
|
+
const out = [];
|
|
292
|
+
visitExprs(built, (val, at) => {
|
|
293
|
+
const escapes = cookedEscapesOf(val);
|
|
294
|
+
if (!escapes.length)
|
|
295
|
+
return;
|
|
296
|
+
for (const d of cookedEscapeDiagnostics(val.js, escapes))
|
|
297
|
+
out.push(located(d, at));
|
|
298
|
+
});
|
|
299
|
+
return out;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* EXPR_VARS_ONLY_IN_QUOTES (warning, #1971): an expression whose every `$vars`
|
|
303
|
+
* mention sits inside a string literal, so it reads no variable and evaluates
|
|
304
|
+
* to the same constant on every run. For instance
|
|
305
|
+
* js`'"' + '$vars.start.output.topic' + '"'` is the text
|
|
306
|
+
* `"$vars.start.output.topic"`, not the topic: the reference was quoted.
|
|
307
|
+
*
|
|
308
|
+
* Only an expression that reads NO variable is reported (`quotedOnlyMentions`):
|
|
309
|
+
* `$vars.a.output + ' ($vars.b)'` and `$metadata.instanceId + ' $vars.b'` each
|
|
310
|
+
* read one, and a mention beside a real read may be deliberate text. A `lit(...)` is not an
|
|
311
|
+
* expression, and a script body (`code`) or a prompt is a plain string, so
|
|
312
|
+
* none of them is read here.
|
|
313
|
+
*
|
|
314
|
+
* The suggestion is the expression with each quoted whole reference unquoted
|
|
315
|
+
* (`'$vars.start.output.topic'` → `$vars.start.output.topic`), when every
|
|
316
|
+
* mention is one; a mention inside longer text (`'Hi $vars.x'`) has no
|
|
317
|
+
* mechanical fix, so the message points at `tmpl`.
|
|
318
|
+
*/
|
|
319
|
+
export function checkVarsOnlyInQuotes(built) {
|
|
320
|
+
const out = [];
|
|
321
|
+
visitExprs(built, (val, at) => {
|
|
322
|
+
if (!(val instanceof Expr) || val.literal)
|
|
323
|
+
return;
|
|
324
|
+
const mentions = quotedOnlyMentions(val.js);
|
|
325
|
+
if (!mentions)
|
|
326
|
+
return;
|
|
327
|
+
const wholeRef = /^\$vars(?:\.[A-Za-z_$][\w$]*|\[\d+\])+$/;
|
|
328
|
+
// Spliced by offset, last mention first, so an earlier splice never moves a later one
|
|
329
|
+
// and a mention's text is never matched elsewhere in the expression.
|
|
330
|
+
let fixed = val.js;
|
|
331
|
+
for (const m of [...mentions].sort((a, b) => (b.start ?? -1) - (a.start ?? -1))) {
|
|
332
|
+
// A template piece has no offsets (`QuotedMention.start`): nothing to unquote in place.
|
|
333
|
+
if (m.start === undefined || m.end === undefined || !wholeRef.test(m.text)) {
|
|
334
|
+
fixed = undefined;
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
fixed = fixed.slice(0, m.start) + m.text + fixed.slice(m.end);
|
|
338
|
+
}
|
|
339
|
+
const quoted = mentions.map((m) => m.literal).join(', ');
|
|
340
|
+
out.push(located({
|
|
341
|
+
level: 'warning',
|
|
342
|
+
code: 'EXPR_VARS_ONLY_IN_QUOTES',
|
|
343
|
+
message: `the expression \`${val.js.length > 120 ? `${val.js.slice(0, 117)}...` : val.js}\` mentions $vars only inside quotes (${quoted}), `
|
|
344
|
+
+ 'so it reads no variable: the quoted text is a string constant, and the expression has the same value on every run. '
|
|
345
|
+
+ 'Take the reference out of the quotes: js`\'"\' + ${input(\'topic\')} + \'"\'`, or tmpl`"${input(\'topic\')}"` for text around it.',
|
|
346
|
+
...(fixed !== undefined ? { suggestion: fixed } : {}),
|
|
347
|
+
}, at));
|
|
348
|
+
});
|
|
281
349
|
return out;
|
|
282
350
|
}
|
|
283
351
|
// ─── LITERAL_LOOKS_LIKE_EXPR (#1970) ────────────────────────────────────────
|
|
@@ -11,6 +11,13 @@ import type { FlowContexts, FlowNodeFamily, FlowTriggerFamily, FlowTriggerType }
|
|
|
11
11
|
/** The families, in no significant order. Adding one is the whole of registering it. */
|
|
12
12
|
export declare const FLOW_NODE_FAMILIES: readonly FlowNodeFamily[];
|
|
13
13
|
export declare const FLOW_NODE_TYPES: NodeTypeRegistry<FlowContexts>;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a family's catalog marks `code` as about the node's type, not its
|
|
16
|
+
* content (`aboutNodeType`): an edit to a node the baseline reports it on too
|
|
17
|
+
* does not introduce it. Read by `check --baseline` (`scopeToEdit`) and by
|
|
18
|
+
* `merge --baseline-from`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isNodeTypeFinding(code: string): boolean;
|
|
14
21
|
/**
|
|
15
22
|
* Register a node-type package's family with the Flow registry
|
|
16
23
|
* (`@uipath/maestro-builder-sdk/extend`'s `defineFlowNodeFamily` calls this).
|
|
@@ -27,6 +27,15 @@ import { triggerFlowFamily } from './nodes/trigger/flow/family.js';
|
|
|
27
27
|
/** The families, in no significant order. Adding one is the whole of registering it. */
|
|
28
28
|
export const FLOW_NODE_FAMILIES = [agentFlowFamily, aiPatternsFlowFamily, connectorFlowFamily, conversationFlowFamily, dataFabricFlowFamily, delayFlowFamily, documentFlowFamily, hitlFlowFamily, httpFlowFamily, mockFlowFamily, processFlowFamily, queueFlowFamily, scriptFlowFamily, transformFlowFamily];
|
|
29
29
|
export const FLOW_NODE_TYPES = new NodeTypeRegistry('flow', FLOW_NODE_FAMILIES, { hasBundledDefinition });
|
|
30
|
+
/**
|
|
31
|
+
* Whether a family's catalog marks `code` as about the node's type, not its
|
|
32
|
+
* content (`aboutNodeType`): an edit to a node the baseline reports it on too
|
|
33
|
+
* does not introduce it. Read by `check --baseline` (`scopeToEdit`) and by
|
|
34
|
+
* `merge --baseline-from`.
|
|
35
|
+
*/
|
|
36
|
+
export function isNodeTypeFinding(code) {
|
|
37
|
+
return FLOW_NODE_TYPES.families.some((f) => Object.hasOwn(f.diagnostics, code) && f.diagnostics[code].aboutNodeType === true);
|
|
38
|
+
}
|
|
30
39
|
// Node-type packages contribute their families through the light `/extend` entry;
|
|
31
40
|
// adopt the ones already contributed and register every later one as it arrives.
|
|
32
41
|
adoptContributedFamilies((family) => FLOW_NODE_TYPES.register(family));
|
package/dist/flow-node-type.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { SolutionProjects } from './core/solution-projects.js';
|
|
13
13
|
import type { ResourceResolutions } from './core/resource-resolution.js';
|
|
14
|
-
import type { ArtifactContexts, FactoryCall, NodeType, OptionKeyLists } from './core/nodes/node-type.js';
|
|
14
|
+
import type { ArtifactContexts, FactoryCall, NodeType, OptionKeyLists, OutputContract } from './core/nodes/node-type.js';
|
|
15
15
|
import type { VersionedNodeType } from './core/nodes/versioned.js';
|
|
16
16
|
import type { DiagnosticCatalog, NodeFamily, Placement } from './core/nodes/family.js';
|
|
17
17
|
import type { DefinitionReference, NodeContribution } from './core/node-classes.js';
|
|
@@ -670,6 +670,13 @@ export interface FlowNodeType<Spec> extends NodeType<Spec, FlowNodeContribution,
|
|
|
670
670
|
* `errorPort`, so the two rungs give one answer; undefined when it cannot.
|
|
671
671
|
*/
|
|
672
672
|
checkDefinition?(spec: Spec, options: CheckOpts): unknown;
|
|
673
|
+
/**
|
|
674
|
+
* What reading this step's output yields, when only check's `options` can say
|
|
675
|
+
* (a connector operation's declared outputs, from the library). Check reads it
|
|
676
|
+
* in place of `output`; undefined falls back to `output`, so a check with no
|
|
677
|
+
* library judges the step as it always did.
|
|
678
|
+
*/
|
|
679
|
+
checkOutput?(spec: Spec, options: CheckOpts): OutputContract | undefined;
|
|
673
680
|
/**
|
|
674
681
|
* The node a spec builds, as far as the spec itself names it, for a per-tenant
|
|
675
682
|
* prefix type: its concrete type name, and the version the spec pins. A refused
|
package/dist/merge-cli.js
CHANGED
|
@@ -109,6 +109,7 @@ import { fetchesDefinitions, openWithFetchedDefinitions, withFetchedDefinitions
|
|
|
109
109
|
import { Bindings } from './bindings.js';
|
|
110
110
|
import { defaultBindingsFile } from './workdir.js';
|
|
111
111
|
import { loadNodePackages } from './node-packages.js';
|
|
112
|
+
import { isNodeTypeFinding } from './flow-node-registry.js';
|
|
112
113
|
import { baselineFromOriginal, checkEdited, compileSourceDraftTolerant, decompileOriginal } from './merge-compile.js';
|
|
113
114
|
import { classifyDrafts, classifyLowering, findingCounts, splitUnplaced } from './edit-scope.js';
|
|
114
115
|
const USAGE = 'usage: flow-merge <original.flow> <edited.flow | Edited.flow.ts> [-o merged.flow, or the original for a stamped .flow.ts] '
|
|
@@ -529,11 +530,24 @@ export async function run(argv) {
|
|
|
529
530
|
// refused when it does not: then the edit introduced it (#1322). With a
|
|
530
531
|
// precompiled --baseline file there is nothing to compare against, so every
|
|
531
532
|
// one is refused, as before.
|
|
533
|
+
const baselineChecks = baselineCompile === undefined ? []
|
|
534
|
+
: checkEdited(baselineCompile.built, baselineCompile.flow, checkOpts).filter((d) => d.level === 'error');
|
|
532
535
|
const baselineFindings = baselineCompile === undefined ? undefined : findingCounts([
|
|
533
536
|
...baselineCompile.drafts,
|
|
534
537
|
...baselineCompile.lowering,
|
|
535
|
-
...
|
|
538
|
+
...baselineChecks,
|
|
536
539
|
]);
|
|
540
|
+
// A finding about the node's type (`aboutNodeType`, a retired node) on a node
|
|
541
|
+
// the edit changed does not stop the write when the original's own round trip
|
|
542
|
+
// reports it on that node too: the node was already of that type, and the edit
|
|
543
|
+
// did not make it so. It is printed; a node the edit added stays
|
|
544
|
+
// refused. Needs --baseline-from: a precompiled --baseline carries no findings.
|
|
545
|
+
const typeFindings = new Set(baselineChecks.filter((d) => isNodeTypeFinding(d.code)).map((d) => `${d.nodeId}\n${d.code}`));
|
|
546
|
+
const keptType = checked.refused.filter((d) => d.reason === 'edited' && typeFindings.has(`${d.nodeId}\n${d.code}`));
|
|
547
|
+
checked.refused = checked.refused.filter((d) => !keptType.includes(d));
|
|
548
|
+
for (const d of keptType) {
|
|
549
|
+
console.error(` ⚠ [${d.code}] "${d.nodeId}" is changed, and the original has this finding on it too, so it does not stop the write: ${d.message}`);
|
|
550
|
+
}
|
|
537
551
|
const unplacedDrafts = splitUnplaced(unplaced, baselineFindings);
|
|
538
552
|
const unplacedChecks = splitUnplaced(checked.unplaced, baselineFindings);
|
|
539
553
|
const unplacedLowering = splitUnplaced(lowered.unplaced, baselineFindings);
|
|
@@ -557,7 +571,11 @@ export async function run(argv) {
|
|
|
557
571
|
: d.reason === 'uncompared'
|
|
558
572
|
? `"${d.nodeId}" is the original's, but the SDK cannot compile it, and ${baseline ? 'a precompiled --baseline has no record of' : 'with no baseline merge cannot tell'} `
|
|
559
573
|
+ 'whether the edit touched it; pass --baseline-from <original.flow> (instead of --baseline) so merge compiles the original itself and can compare the node'
|
|
560
|
-
:
|
|
574
|
+
: baselineCompile === undefined && isNodeTypeFinding(d.code)
|
|
575
|
+
? `"${d.nodeId}" is changed or new in the edited flow, and without a derived baseline merge cannot tell whether `
|
|
576
|
+
+ 'the original already had this finding on it; pass --baseline-from <original.flow> (instead of --baseline) '
|
|
577
|
+
+ 'so a node the original already had is written with a warning'
|
|
578
|
+
: `"${d.nodeId}" is changed or new in the edited flow`;
|
|
561
579
|
console.error(` ✗ [${d.code}] ${where}: ${d.message}`);
|
|
562
580
|
}
|
|
563
581
|
console.error(`flow-merge: ${errors.length} error(s) in nodes merge takes from the edited flow; each line says what to do (finish the node, revert the edit, or pass what merge needs). Nothing written.`);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { eventTriggerType } from './event-trigger.js';
|
|
2
2
|
import { eventWaitNodeType } from './event-wait.js';
|
|
3
3
|
import { connectorNodeType } from './node-type.js';
|
|
4
|
+
import { CONNECTOR_DIAGNOSTICS } from './output-read.js';
|
|
4
5
|
export const connectorFlowFamily = {
|
|
5
6
|
id: 'connector',
|
|
6
7
|
title: 'Integration Service connector',
|
|
7
8
|
types: [connectorNodeType, eventWaitNodeType],
|
|
8
|
-
//
|
|
9
|
-
|
|
9
|
+
// The output-read codes are the family's own; its other rules' codes are the
|
|
10
|
+
// pipeline's, shared with the triggers (ctx.connector, ctx.eventSubscription).
|
|
11
|
+
diagnostics: CONNECTOR_DIAGNOSTICS,
|
|
10
12
|
};
|
|
11
13
|
export const connectorTriggerFamily = {
|
|
12
14
|
id: 'connector',
|
|
@@ -7,6 +7,7 @@ import { libraryExecution } from '../../../core/external-execution.js';
|
|
|
7
7
|
import { CONNECTOR_INPUT_MISSING, FLOW_EXPR_DIALECT, buildConnectorInputs, replayInputsOf, transportHttpMethod } from '../../../core/connector-inputs.js';
|
|
8
8
|
import { ConnectorResolveError } from '../../../core/connector-resolve-error.js';
|
|
9
9
|
import { definitionHasErrorPort } from '../../../core/error-port.js';
|
|
10
|
+
import { connectorCheckOutput } from './output-read.js';
|
|
10
11
|
import { Expr } from '../../../core/expr.js';
|
|
11
12
|
import { jsonClone } from '../../../core/json-clone.js';
|
|
12
13
|
import { subNodeId } from '../../../core/node-id-placeholder.js';
|
|
@@ -454,6 +455,8 @@ const connector10 = {
|
|
|
454
455
|
// Every Expr in the inputs, nested ones included, resolves against the flow's names.
|
|
455
456
|
expressions: (spec) => [{ value: spec.inputs }],
|
|
456
457
|
output: () => ({ kind: 'opaque' }),
|
|
458
|
+
// Given a library, the operation's declared outputs: a read outside them is reported (#1967).
|
|
459
|
+
checkOutput: (spec, options) => connectorCheckOutput(spec, options.connectorOutputFields),
|
|
457
460
|
listShape: (spec, options) => options.listEnvelope?.(spec.key, spec.action, spec.version, spec.object),
|
|
458
461
|
};
|
|
459
462
|
export const connectorNodeType = {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The read rule on a connector operation's output, and the family's catalog.
|
|
3
|
+
*
|
|
4
|
+
* `out('upload', 'WebUrl')` compiles, and reads undefined at run time when the
|
|
5
|
+
* operation returns `webUrl`: field names are case-sensitive and nothing
|
|
6
|
+
* compared the read with the operation's declared outputs (#1967). Given a
|
|
7
|
+
* library, the operation type's `checkOutput` states those outputs as a
|
|
8
|
+
* `partial` `fields` contract, and check's shared read rule reports:
|
|
9
|
+
*
|
|
10
|
+
* - CONNECTOR_READ_NOT_OUTPUT: `$vars.<step>.<x>` where `x` is not `output`
|
|
11
|
+
* (or `error`); a connector publishes its response only under `output`.
|
|
12
|
+
* - CONNECTOR_READ_FIELD_CASE: the field differs from a declared one only in
|
|
13
|
+
* letter case. It reads undefined unless the response's casing differs
|
|
14
|
+
* from the declared one, which no live response has been checked for; a
|
|
15
|
+
* warning until one is (#2017 review).
|
|
16
|
+
* - CONNECTOR_READ_UNKNOWN_FIELD: no declared field has the name. A warning,
|
|
17
|
+
* because the library's list can miss a field the response really carries
|
|
18
|
+
* (`core/connector-output-fields.ts`).
|
|
19
|
+
*
|
|
20
|
+
* Without a library, or for an operation the library cannot describe (a list,
|
|
21
|
+
* an unprepared connection-resolved schema, no declared fields), the type falls
|
|
22
|
+
* back to its `opaque` output and nothing is reported.
|
|
23
|
+
*/
|
|
24
|
+
import type { DiagnosticCatalog } from '../../../core/nodes/family.js';
|
|
25
|
+
import type { OutputContract } from '../../../core/nodes/node-type.js';
|
|
26
|
+
/** Every code the family reports, with the severity it reports it at. */
|
|
27
|
+
export declare const CONNECTOR_DIAGNOSTICS: DiagnosticCatalog;
|
|
28
|
+
/** The top-level output fields of one operation, from check's library (`CheckOpts.connectorOutputFields`). */
|
|
29
|
+
type OutputFields = (connector: string, operation: string, version?: string, object?: string) => readonly string[] | undefined;
|
|
30
|
+
/** The operation's output as check's library states it, or undefined to fall back to `opaque`. */
|
|
31
|
+
export declare function connectorCheckOutput(spec: {
|
|
32
|
+
key: string;
|
|
33
|
+
action: string;
|
|
34
|
+
version?: string;
|
|
35
|
+
object?: string;
|
|
36
|
+
}, outputFields: OutputFields | undefined): OutputContract | undefined;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Every code the family reports, with the severity it reports it at. */
|
|
2
|
+
export const CONNECTOR_DIAGNOSTICS = {
|
|
3
|
+
CONNECTOR_READ_NOT_OUTPUT: { severity: 'error', summary: 'a read outside the step\'s output' },
|
|
4
|
+
CONNECTOR_READ_FIELD_CASE: { severity: 'warning', summary: 'a read of a declared output field in the wrong letter case' },
|
|
5
|
+
CONNECTOR_READ_UNKNOWN_FIELD: { severity: 'warning', summary: 'a read of a field the operation does not declare' },
|
|
6
|
+
};
|
|
7
|
+
/** The operation's output as check's library states it, or undefined to fall back to `opaque`. */
|
|
8
|
+
export function connectorCheckOutput(spec, outputFields) {
|
|
9
|
+
const fields = outputFields?.(spec.key, spec.action, spec.version, spec.object);
|
|
10
|
+
if (fields === undefined)
|
|
11
|
+
return undefined;
|
|
12
|
+
return {
|
|
13
|
+
kind: 'fields',
|
|
14
|
+
fields: Object.fromEntries(fields.map((f) => [f, 'any'])),
|
|
15
|
+
partial: true,
|
|
16
|
+
read: {
|
|
17
|
+
codePrefix: 'CONNECTOR',
|
|
18
|
+
label: 'Connector step',
|
|
19
|
+
// Unreachable: a partial contract always carries its fields.
|
|
20
|
+
whenUndeclared: '',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -3,7 +3,12 @@ import { escapeRegExp } from '../../../core/escape-regexp.js';
|
|
|
3
3
|
import { isJsExpressionValue } from '../../../core/wire-expr.js';
|
|
4
4
|
import { Expr } from '../../../core/expr.js';
|
|
5
5
|
export const HTTP_DIAGNOSTICS = {
|
|
6
|
-
HTTP_V1_RETIRED: {
|
|
6
|
+
HTTP_V1_RETIRED: {
|
|
7
|
+
severity: 'error',
|
|
8
|
+
summary: 'the plain node, which the tenant node registry no longer serves',
|
|
9
|
+
// About what the node is, not what it holds.
|
|
10
|
+
aboutNodeType: true,
|
|
11
|
+
},
|
|
7
12
|
HTTP_BINDING_REQUIRES_MANAGED: { severity: 'error', summary: 'connection settings on the standalone node' },
|
|
8
13
|
HTTP_MANAGED_BINDING_INCOMPLETE: { severity: 'error', summary: 'a managed connection without both connection and folder' },
|
|
9
14
|
HTTP_TARGET_CONNECTOR_EMPTY: { severity: 'error', summary: 'an empty targetConnector' },
|
|
@@ -102,10 +107,8 @@ function checkSecretHeaders(inputs, ctx) {
|
|
|
102
107
|
*/
|
|
103
108
|
export function checkHttp(inputs, ctx) {
|
|
104
109
|
const step = ctx.step;
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
// type 'Intsvc.HttpExecution'". A warning, not an error, so `decompile` keeps
|
|
108
|
-
// round-tripping existing flows.
|
|
110
|
+
// A new plain node is an error; a node the baseline already has is a warning
|
|
111
|
+
// (`aboutNodeType`). `compile` does not run `check`.
|
|
109
112
|
//
|
|
110
113
|
// Moving to the managed node is not a rename: a non-2xx fails the step instead
|
|
111
114
|
// of arriving on the success path with `statusCode`, so a status branch becomes
|
|
@@ -119,9 +122,10 @@ export function checkHttp(inputs, ctx) {
|
|
|
119
122
|
const tail = wantsConnection
|
|
120
123
|
? `It also sets Integration Service connection settings, which only the managed node can use.`
|
|
121
124
|
: `Without a connection it sends the request through Integration Service's shared egress, so public APIs can answer 429.`;
|
|
122
|
-
ctx.report('HTTP_V1_RETIRED', `Step "${step}" emits core.action.http,
|
|
123
|
-
+ `core.action.http.v2,
|
|
124
|
-
+ `
|
|
125
|
+
ctx.report('HTTP_V1_RETIRED', `Step "${step}" emits core.action.http, the plain HTTP node, which the tenant node registry no longer serves `
|
|
126
|
+
+ `(it serves only core.action.http.v2), so the designer does not offer it. Write managed: true for a new step. `
|
|
127
|
+
+ `A plain node the flow already has is a warning under check --baseline, even when the edit changes it. `
|
|
128
|
+
+ `Moving to managed: true changes behaviour rather than just the node type: a non-2xx `
|
|
125
129
|
+ `fails the step instead of arriving with statusCode, so a status branch becomes an .onError() handler `
|
|
126
130
|
+ `reading err('${step}', 'status'). ${tail}`, wantsConnection ? `http({ url: …, managed: true, connection, folder })` : `http({ url: …, managed: true })`);
|
|
127
131
|
}
|
|
@@ -15,7 +15,7 @@ export function http(inputs) {
|
|
|
15
15
|
if (typeof inputs.managed !== 'boolean') {
|
|
16
16
|
throw new CompileRefusal('HTTP_MANAGED_REQUIRED', 'http() requires managed: true or managed: false because they emit different platform nodes. '
|
|
17
17
|
+ 'Use true for Managed HTTP Request/core.action.http.v2 or when non-2xx statuses must reach .onError(); '
|
|
18
|
-
+ 'false emits the
|
|
18
|
+
+ 'false emits the plain core.action.http, which the tenant node registry no longer serves.');
|
|
19
19
|
}
|
|
20
20
|
return builtinActionSpec({ kind: 'http', inputs });
|
|
21
21
|
}
|
|
@@ -35,9 +35,9 @@ interface HttpInputsBase {
|
|
|
35
35
|
body?: string | Expr;
|
|
36
36
|
contentType?: string;
|
|
37
37
|
/**
|
|
38
|
-
* Choose the HTTP node explicitly. `false` emits the
|
|
39
|
-
* `core.action.http`, which
|
|
40
|
-
*
|
|
38
|
+
* Choose the HTTP node explicitly. `false` emits the plain
|
|
39
|
+
* `core.action.http`, which the tenant node registry no longer serves, so
|
|
40
|
+
* `check` refuses a new one (HTTP_V1_RETIRED); `true` emits the managed `core.action.http.v2`, routed
|
|
41
41
|
* through Integration Service's HTTP connector.
|
|
42
42
|
*
|
|
43
43
|
* This has no default because these are different platform nodes, not two
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.117.1",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"@types/node": "^22.7.0",
|
|
125
125
|
"esbuild": "^0.28.1"
|
|
126
126
|
},
|
|
127
|
-
"gitref": "
|
|
127
|
+
"gitref": "eacce228a15703bf2725ea4513eaedb88d6f7663"
|
|
128
128
|
}
|