@uipath/maestro-builder-sdk 6.90.0 → 6.90.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/decompile.js CHANGED
@@ -2942,7 +2942,7 @@ function canonicalJson(v) {
2942
2942
  /**
2943
2943
  * The wire fields whose plain-string value is JavaScript (no `=js:` prefix):
2944
2944
  * a script body, a decision or switch `expression`, a loop's `condition` and
2945
- * `completionCondition`, an HTTP branch's `conditionExpression`, a transform's
2945
+ * `completionCondition`, a `conditionExpression` an older compile wrote bare, a transform's
2946
2946
  * `collection`. `serialize` renames `$vars` reads in exactly these and in
2947
2947
  * `=js:` values. A loop's `completionCondition` is listed for files written
2948
2948
  * before #1763: the SDK now writes it as a jsExpression envelope, because the
package/dist/merge.js CHANGED
@@ -193,6 +193,26 @@ function inOriginalSpelling(o, b, e) {
193
193
  }
194
194
  return isRecord(o) && o.type === 'jsExpression' && o.expression === b ? { ...jsonClone(o), expression: e } : undefined;
195
195
  }
196
+ const JS_WIRE_PREFIX = '=js:';
197
+ /**
198
+ * An HTTP branch row an older SDK wrote without `=js:` never fires. The baseline is the
199
+ * current compile of the same source, so where it spells the row `=js:<bare>` the merged
200
+ * row takes the baseline's spelling.
201
+ */
202
+ function repairBareBranches(node, base) {
203
+ const rows = node.inputs?.branches;
204
+ const baseRows = base?.inputs?.branches;
205
+ if (!Array.isArray(rows) || !Array.isArray(baseRows))
206
+ return;
207
+ for (const row of rows) {
208
+ if (!isRecord(row) || typeof row.conditionExpression !== 'string')
209
+ continue;
210
+ const same = baseRows.find((b) => isRecord(b) && b.id === row.id);
211
+ if (!isRecord(same) || same.conditionExpression !== JS_WIRE_PREFIX + row.conditionExpression)
212
+ continue;
213
+ row.conditionExpression = same.conditionExpression;
214
+ }
215
+ }
196
216
  /** What `after` changed from `before`, key by key; `undefined` when nothing. */
197
217
  function changedFrom(before, after) {
198
218
  if (stableJson(after) === stableJson(before))
@@ -362,6 +382,8 @@ function mergeFlowFindings(original, edited, options) {
362
382
  }
363
383
  }
364
384
  result.nodes = finalNodes;
385
+ for (const node of finalNodes)
386
+ repairBareBranches(node, baseNodes.get(node.id));
365
387
  // Nodes present in the original but absent from `edited` were deleted by the
366
388
  // user; they are simply not carried over.
367
389
  // ── Subflows: the edited flow is authoritative (the user's graph) — except a
@@ -372,8 +394,12 @@ function mergeFlowFindings(original, edited, options) {
372
394
  result.subflows = jsonClone(edited.subflows ?? {});
373
395
  const takenSubflows = new Set(subflowsTakenFromEdited(original, edited, options.baseline));
374
396
  for (const key of Object.keys(result.subflows)) {
375
- if (!takenSubflows.has(key))
376
- result.subflows[key] = jsonClone(original.subflows[key]);
397
+ if (takenSubflows.has(key))
398
+ continue;
399
+ result.subflows[key] = jsonClone(original.subflows[key]);
400
+ const baseNodes = byId(options.baseline?.subflows?.[key]?.nodes);
401
+ for (const node of result.subflows[key].nodes ?? [])
402
+ repairBareBranches(node, baseNodes.get(node.id));
377
403
  }
378
404
  // A kept subflow carries the original's edge ids and a taken one the
379
405
  // recompile's, from two different counters, so a taken subflow's edges are
@@ -25,7 +25,8 @@ export declare function checkHttpStep(inputs: HttpInputs, ctx: FlowCheckContext)
25
25
  /**
26
26
  * A read of an `http()` step's result.
27
27
  *
28
- * The response is an envelope — `{ body, statusCode, headers }` — and `returns`
28
+ * The response is an envelope — `{ body, statusCode, headers }`, or `{ body, code, headers }`
29
+ * on the managed node — and `returns`
29
30
  * declares the parsed JSON body's top-level fields, so a declared field is read
30
31
  * at `output.body.<field>` (`out('<step>', 'body.<field>')`). That nesting is the
31
32
  * one thing this family does not share with the process families, and it is
@@ -132,7 +132,7 @@ export function checkHttpStep(inputs, ctx) {
132
132
  }
133
133
  seen.add(b.name);
134
134
  if (b.condition.literal) {
135
- ctx.report('HTTP_BRANCH_CONST', `HTTP branch ${JSON.stringify(b.name)} on "${step}" tests a constant — it would fire always or never. Reference the response, e.g. $vars.${step}.output.statusCode.`);
135
+ ctx.report('HTTP_BRANCH_CONST', `HTTP branch ${JSON.stringify(b.name)} on "${step}" tests a constant — it would fire always or never. Reference the response, e.g. $vars.${step}.output.${inputs?.managed ? 'code' : 'statusCode'}.`);
136
136
  }
137
137
  }
138
138
  }
@@ -142,10 +142,13 @@ export function checkHttpStep(inputs, ctx) {
142
142
  * `returns` describes what is INSIDE `body`, never beside it.
143
143
  */
144
144
  const HTTP_ENVELOPE_FIELDS = ['body', 'statusCode', 'headers'];
145
+ /** The managed node's response is Integration Service's `{ code, headers, body }`. */
146
+ const MANAGED_HTTP_ENVELOPE_FIELDS = ['body', 'code', 'headers'];
145
147
  /**
146
148
  * A read of an `http()` step's result.
147
149
  *
148
- * The response is an envelope — `{ body, statusCode, headers }` — and `returns`
150
+ * The response is an envelope — `{ body, statusCode, headers }`, or `{ body, code, headers }`
151
+ * on the managed node — and `returns`
149
152
  * declares the parsed JSON body's top-level fields, so a declared field is read
150
153
  * at `output.body.<field>` (`out('<step>', 'body.<field>')`). That nesting is the
151
154
  * one thing this family does not share with the process families, and it is
@@ -168,19 +171,25 @@ export function checkHttpRead({ node: name, field, rest, reader: step }, spec, r
168
171
  if (!top)
169
172
  return; // `$vars.<name>.output` — the whole envelope.
170
173
  const declared = Object.keys(spec?.returns ?? {});
171
- if (!HTTP_ENVELOPE_FIELDS.includes(top)) {
174
+ const envelope = spec?.managed ? MANAGED_HTTP_ENVELOPE_FIELDS : HTTP_ENVELOPE_FIELDS;
175
+ if (!envelope.includes(top)) {
172
176
  // The commonest form: a declared body field read one level too high.
173
177
  const hoisted = declared.includes(top) ? top : undefined;
178
+ if (spec?.managed && top === 'statusCode') {
179
+ report('HTTP_READ_UNKNOWN_FIELD', `"$vars.${name}.output.statusCode" (read in "${step}") is not a field of managed HTTP step "${name}"'s `
180
+ + `response, which publishes "code", "headers", "body". It resolves to undefined at run time, so a branch on it never fires.`, `$vars.${name}.output.code`);
181
+ return;
182
+ }
174
183
  const nearest = hoisted ?? nearestName(top, declared);
175
184
  report('HTTP_READ_UNKNOWN_FIELD', `"$vars.${name}.output.${top}" (read in "${step}") is not a field of HTTP step "${name}"'s `
176
- + `response. An HTTP response publishes ${HTTP_ENVELOPE_FIELDS.map((f) => `"${f}"`).join(', ')}; `
185
+ + `response. An HTTP response publishes ${envelope.map((f) => `"${f}"`).join(', ')}; `
177
186
  + `the fields \`returns\` declares live under "body"`
178
187
  + (hoisted ? `, so "${top}" is read as "$vars.${name}.output.body.${top}".` : '.')
179
188
  + ` A read outside that shape resolves to undefined and faults a gateway at run time.`, nearest !== undefined ? `out('${name}', 'body.${nearest}')` : undefined);
180
189
  return;
181
190
  }
182
191
  if (top !== 'body' || !inner)
183
- return; // `statusCode`, `headers`, or the whole body.
192
+ return; // the status, `headers`, or the whole body.
184
193
  if (declared.length === 0) {
185
194
  report('HTTP_READ_WITHOUT_RETURNS', `"$vars.${name}.output.body.${inner}" (read in "${step}") reads a field of HTTP step "${name}"'s `
186
195
  + `response body, but the step declares no \`returns\` — so the node carries no body schema and nothing `
@@ -51,7 +51,7 @@ function httpRequestSettings(i) {
51
51
  ...(i.retryCount !== undefined ? { retryCount: i.retryCount } : {}),
52
52
  };
53
53
  }
54
- /** The `branches` rows both HTTP definitions declare: id/name from the author's name, conditions rendered like a decision's. */
54
+ /** The `branches` rows both HTTP definitions declare: id/name from the author's name, conditions written as `=js:` values: the gateway's flow reads no other spelling. */
55
55
  function httpBranchRows(i, ctx) {
56
56
  if (!i.branches?.length)
57
57
  return {};
@@ -59,7 +59,7 @@ function httpBranchRows(i, ctx) {
59
59
  branches: i.branches.map((b) => ({
60
60
  id: b.name,
61
61
  name: b.name,
62
- conditionExpression: ctx.renameRefs(b.condition.js),
62
+ conditionExpression: `=js:${ctx.renameRefs(b.condition.js)}`,
63
63
  })),
64
64
  };
65
65
  }
@@ -189,7 +189,7 @@ function httpOutputs(base, returns, managed) {
189
189
  // The whole `output` shape lives on the INSTANCE, not in the bundled
190
190
  // definition — deliberately. An instance schema may refine a GENERIC definition
191
191
  // object but never override one that already declares a
192
- // shape, so declaring `body`/`statusCode` in the def would lock the author's
192
+ // shape, so declaring `body` and the status in the def would lock the author's
193
193
  // `returns` out of the very read it exists to license. The definition stays
194
194
  // byte-faithful to the platform's (a bare object, because only the API being
195
195
  // called knows its body) and the author's declaration is the only source of
@@ -202,7 +202,9 @@ function httpOutputs(base, returns, managed) {
202
202
  : 'JSON response body, deserialized by the standalone HTTP runtime',
203
203
  properties: Object.fromEntries(Object.entries(returns).map(([name, type]) => [name, { type }])),
204
204
  },
205
- statusCode: { type: 'number', description: 'HTTP status code of the response' },
205
+ ...(managed
206
+ ? { code: { type: 'integer', description: 'HTTP status code' } }
207
+ : { statusCode: { type: 'number', description: 'HTTP status code of the response' } }),
206
208
  };
207
209
  return out;
208
210
  }
@@ -16,7 +16,7 @@ export interface HttpBranch {
16
16
  name: string;
17
17
  /**
18
18
  * When to take this exit, evaluated against the response — e.g.
19
- * js-tagged: `$vars.fetch.output.statusCode === 429`. Branches are checked in
19
+ * js-tagged: `$vars.fetch.output.statusCode === 429` (`output.code` on the managed node). Branches are checked in
20
20
  * order; the first truthy one wins, else the default port fires.
21
21
  */
22
22
  condition: Expr;
@@ -84,7 +84,7 @@ interface HttpInputsBase {
84
84
  * `$vars.fetch.output.items` is undefined at run time.
85
85
  *
86
86
  * @enforcedBy HTTP_READ_UNKNOWN_FIELD A read must be `output.body.<declared field>`,
87
- * `output.statusCode` or `output.headers`.
87
+ * `output.statusCode` (`output.code` on the managed node) or `output.headers`.
88
88
  * @enforcedBy HTTP_READ_WITHOUT_RETURNS Reading a body field requires declaring it here.
89
89
  */
90
90
  returns?: Record<string, ReturnFieldType>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.90.0",
3
+ "version": "6.90.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",
@@ -110,5 +110,5 @@
110
110
  "@types/node": "^22.7.0",
111
111
  "esbuild": "^0.28.1"
112
112
  },
113
- "gitref": "2d54d6aa56285f53167cff2277bcf3e4bd73751b"
113
+ "gitref": "e5c5dd2ef362641d4c6540e8d01ccf347e1aa3ef"
114
114
  }