@uipath/maestro-builder-sdk 6.122.0 → 6.122.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.
@@ -593,12 +593,13 @@ export interface CaseHttpRequestSpec {
593
593
  */
594
594
  query?: Record<string, string>;
595
595
  /**
596
- * The request body, for POST, PUT or PATCH: an object, JSON text, or an `=`
597
- * expression (`=js:vars.payload`). In an object, a value `=js:<expression>`
598
- * or `=<reference>` (`=vars.id`) is sent as the value it reads.
596
+ * The request body, for POST, PUT or PATCH: an object, JSON text, a
597
+ * `taskOutput()` (read at run time), or an `=` expression (`=js:vars.payload`).
598
+ * In an object, a value `=js:<expression>`, `=<reference>` (`=vars.id`) or
599
+ * `taskOutput()` is sent as the value it reads.
599
600
  *
600
601
  * @enforcedBy HTTP_REQUEST_BODY_METHOD `check` reports a body on another method.
601
- * @enforcedBy HTTP_REQUEST_BODY_FORM compile refuses text that is neither JSON nor an expression.
602
+ * @enforcedBy HTTP_REQUEST_BODY_FORM compile refuses text that is neither JSON, a `taskOutput()`, nor an expression.
602
603
  * @enforcedBy HTTP_REQUEST_BODY_EXPRESSION compile refuses an object value that is another kind of `=` expression.
603
604
  */
604
605
  body?: string | Record<string, unknown> | unknown[];
@@ -1743,9 +1744,10 @@ declare class TaskBuilder {
1743
1744
  * Designer's suffixed key: `Result2: '=Result'` is its own bare output. This
1744
1745
  * is the output an SDD lists with no `->` arrow. Read it elsewhere with
1745
1746
  * {@link taskOutput | taskOutput('<stage>', '<task>', '<output>')} (or the
1746
- * SDD's `$xref` marker copied as written), which compiles to `vars.<id>`
1747
- * of that output, so a plan built from an SDD needs no case variable the SDD
1748
- * does not declare.
1747
+ * SDD's `$xref` marker copied as written), which compiles to `=vars.<id>`
1748
+ * of that output as a whole value (`=js:vars.<id>?.field` with property
1749
+ * reads; `vars.<id>` inside an expression), so a plan built from an SDD needs
1750
+ * no case variable the SDD does not declare.
1749
1751
  *
1750
1752
  * Pass `{ assign, type }` for a **custom** output: the SDD's `x = expr` row.
1751
1753
  * When the task completes, the case variable is set to `assign` — a literal,
@@ -786,9 +786,10 @@ class TaskBuilder {
786
786
  * Designer's suffixed key: `Result2: '=Result'` is its own bare output. This
787
787
  * is the output an SDD lists with no `->` arrow. Read it elsewhere with
788
788
  * {@link taskOutput | taskOutput('<stage>', '<task>', '<output>')} (or the
789
- * SDD's `$xref` marker copied as written), which compiles to `vars.<id>`
790
- * of that output, so a plan built from an SDD needs no case variable the SDD
791
- * does not declare.
789
+ * SDD's `$xref` marker copied as written), which compiles to `=vars.<id>`
790
+ * of that output as a whole value (`=js:vars.<id>?.field` with property
791
+ * reads; `vars.<id>` inside an expression), so a plan built from an SDD needs
792
+ * no case variable the SDD does not declare.
792
793
  *
793
794
  * Pass `{ assign, type }` for a **custom** output: the SDD's `x = expr` row.
794
795
  * When the task completes, the case variable is set to `assign` — a literal,
@@ -713,17 +713,18 @@ function checkStage(stage, diags, refStage, refPlacement) {
713
713
  if (o.custom)
714
714
  continue; // an assigned value, not a result field
715
715
  // `=response.X` and `=response[...]`. `check` does not see the
716
- // artifact's argument list, so an artifact whose own output argument is
717
- // named `response` is flagged too (the trade-off BUSINESS_RULE_OUTPUT_SOURCE
718
- // makes for `=result.`). A bare `=response` is left alone: it names
716
+ // artifact's argument list, and an output argument named `response`
717
+ // (an object) is read `=response.<field>`, the source the SDD and
718
+ // `validate --strict --sdd` expect. So this is a warning that names
719
+ // that case, not an error. A bare `=response` is left alone: it names
719
720
  // such an argument whole, and has no field to suggest.
720
721
  if (!/^=\s*response\s*[.[]/.test(o.source))
721
722
  continue;
722
723
  const fix = /^=\s*response\s*\.\s*(.+)$/.exec(o.source)?.[1];
723
724
  diags.push({
724
- level: 'error',
725
+ level: 'warning',
725
726
  code: 'REFERENCE_OUTPUT_SOURCE',
726
- message: `Task "${t.name}" (${t.kind}) output "${o.var}" reads "${o.source}". This ${t.kind} task's result fields are read directly; \`=response.<field>\` is the connector form and reads nothing here. Write ${fix !== undefined ? `"=${fix}"` : 'the field without the `response` prefix'} (the source the Designer and \`uip maestro case sdd convert\` write).`,
727
+ message: `Task "${t.name}" (${t.kind}) output "${o.var}" reads "${o.source}", the connector form. Keep it only if the ${t.kind}'s own output argument is an object named \`response\` (the SDD lists \`response.<field>\`; \`uip maestro case tasks describe --type ${t.kind} --id <entityKey>\` lists the outputs). Otherwise write ${fix !== undefined ? `"=${fix}"` : 'the field without the `response` prefix'}, the source the Designer writes.`,
727
728
  where: t.name,
728
729
  });
729
730
  }
@@ -26,7 +26,7 @@
26
26
  */
27
27
  import { parse } from 'acorn';
28
28
  import { MANAGED_HTTP_CONNECTOR_KEY, MANAGED_HTTP_ENDPOINT, MANAGED_HTTP_ENDPOINT_METHOD, MANAGED_HTTP_OBJECT_NAME, } from '../core/managed-http.js';
29
- import { taskOutputRefs } from './task-output-ref.js';
29
+ import { isWholeTaskOutputMarker } from './task-output-ref.js';
30
30
  import metadata from './http-request-metadata.json' with { type: 'json' };
31
31
  /**
32
32
  * The Designer's `metadata` context entry body, copied byte for byte from
@@ -123,11 +123,11 @@ export function httpRequestRefusal(owner, spec) {
123
123
  return { code: 'HTTP_REQUEST_FIELD', message: `${owner} ${field} must be an object of text values.` };
124
124
  // Text that is neither JSON nor an expression would be wrapped as `=js:( … )`,
125
125
  // which the activity evaluates: compile would turn the author's text into code.
126
- if (typeof spec.body === 'string' && !spec.body.startsWith('=') && !parsesAsJson(spec.body))
126
+ if (typeof spec.body === 'string' && !spec.body.startsWith('=') && !isWholeTaskOutputMarker(spec.body) && !parsesAsJson(spec.body))
127
127
  return {
128
128
  code: 'HTTP_REQUEST_BODY_FORM',
129
129
  message: `${owner} body is neither JSON nor an \`=\` expression. The activity evaluates its body as JavaScript, so the text would be written as code.`,
130
- suggestion: 'Pass the body as an object, JSON text, or an expression such as `=js:vars.payload`.',
130
+ suggestion: 'Pass the body as an object, JSON text, a `taskOutput()`, or an expression such as `=js:vars.payload`.',
131
131
  };
132
132
  if (spec.body !== undefined && typeof spec.body !== 'string') {
133
133
  const leaf = unlowerableLeaf(spec.body);
@@ -154,19 +154,6 @@ const parsesAsJson = (text) => {
154
154
  };
155
155
  /** A dotted reference such as `vars.customer.id`: JavaScript as written. */
156
156
  const REFERENCE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/;
157
- /** Property reads after a reference: `.field.sub`. */
158
- const DOTTED_TAIL = /^(?:\.[A-Za-z_$][\w$]*)*$/;
159
- /**
160
- * Whether `text` is exactly one `taskOutput()` marker (`vars.$xref('S','T','body')`),
161
- * optionally followed by property reads. It is a reference once lowered: the
162
- * whole plan's markers are lowered to `vars.<output id>` after the body is
163
- * written (`lowerPlanTaskOutputRefs` in `serialize.ts`), so the activity never
164
- * sees `$xref`.
165
- */
166
- function isTaskOutputReference(text) {
167
- const refs = taskOutputRefs(text);
168
- return refs.length === 1 && refs[0].index === 0 && DOTTED_TAIL.test(text.slice(refs[0].whole.length));
169
- }
170
157
  /**
171
158
  * `code` parenthesized as one JavaScript expression, `(<code>\n)`, or
172
159
  * `undefined` when it is not exactly one. The parentheses close on a new line,
@@ -215,14 +202,17 @@ function oneExpression(code) {
215
202
  * (`HTTP_REQUEST_BODY_EXPRESSION`).
216
203
  */
217
204
  function leafCode(value) {
205
+ // A bare marker is lowered to `vars.<id>` over the finished plan (`lowerPlanTaskOutputRefs`).
206
+ if (isWholeTaskOutputMarker(value))
207
+ return value;
218
208
  if (value.startsWith('=js:')) {
219
209
  const code = value.slice('=js:'.length).trim();
220
210
  return code === '' ? undefined : oneExpression(code);
221
211
  }
222
212
  const reference = value.slice(1).trim();
223
- return REFERENCE.test(reference) || isTaskOutputReference(reference) ? reference : undefined;
213
+ return REFERENCE.test(reference) || isWholeTaskOutputMarker(reference) ? reference : undefined;
224
214
  }
225
- const isExpressionLeaf = (value) => typeof value === 'string' && value.startsWith('=');
215
+ const isExpressionLeaf = (value) => typeof value === 'string' && (value.startsWith('=') || isWholeTaskOutputMarker(value));
226
216
  const childrenOf = (value) => Array.isArray(value) ? value : typeof value === 'object' && value !== null ? Object.values(value) : [];
227
217
  function hasExpressionLeaf(value) {
228
218
  return isExpressionLeaf(value) || childrenOf(value).some(hasExpressionLeaf);
@@ -276,8 +266,8 @@ export function httpRequestLint(owner, spec) {
276
266
  message: `${owner} names no connector, so it calls url directly, and has none.`,
277
267
  suggestion: "Pass url (for example url: 'https://api.example.com/items'), or connector: { key, connection, folder } with a path.",
278
268
  });
279
- // A literal value is the secret itself, written into the plan; an `=` value is read at run time.
280
- const literalCredential = (fields, names) => Object.entries(isObjectOfText(fields) ? fields : {}).find(([k, v]) => names.has(k.toLowerCase()) && !v.startsWith('='))?.[0];
269
+ // A literal value is the secret itself, written into the plan; an `=` value or a `taskOutput()` is read at run time.
270
+ const literalCredential = (fields, names) => Object.entries(isObjectOfText(fields) ? fields : {}).find(([k, v]) => names.has(k.toLowerCase()) && !v.startsWith('=') && !isWholeTaskOutputMarker(v))?.[0];
281
271
  const credentials = [
282
272
  ['header', literalCredential(spec.headers, CREDENTIAL_HEADERS)],
283
273
  ['query parameter', literalCredential(spec.query, CREDENTIAL_QUERY_KEYS)],
@@ -2,8 +2,9 @@
2
2
  * Reference-mode task kinds: a task that runs a separately published artifact
3
3
  * (a process, agent, RPA or API workflow, ...) and binds its arguments with
4
4
  * `.inputs()` / `.outputs()`. The artifact's result fields are at the top of
5
- * its result, so an extract reads `=<Field>`, not the connector form
6
- * `=response.<field>` (builder-sdk#1565). Shared by the builder (which kinds
5
+ * its result, so an extract reads `=<Field>` (`=<Argument>.<field>` for an
6
+ * object argument), not the connector form `=response.<field>` unless the
7
+ * argument itself is named `response` (builder-sdk#1565). Shared by the builder (which kinds
7
8
  * take `.inputs()`) and `check` (REFERENCE_OUTPUT_SOURCE).
8
9
  */
9
10
  import type { TaskKind } from './case-sdk.js';
@@ -47,7 +47,7 @@ import { SCRIPT_INPUTS, scriptOutputMappings, scriptOutputs, storedScript } from
47
47
  import { DOCUMENT_EXTRACTION_NAME, DOCUMENT_EXTRACTION_RESOURCE, DOCUMENT_EXTRACTION_SERVICE_TYPE, DOCUMENT_EXTRACTION_VERSION, documentExtractionContext, documentExtractionInputs, documentExtractionOutputMappings, documentExtractionOutputs, documentExtractionRefusal, } from './document-extraction.js';
48
48
  import { HTTP_REQUEST_CONNECTION_NAME, HTTP_REQUEST_IMPLICIT_BINDING_ID, HTTP_REQUEST_IMPLICIT_CONNECTION, HTTP_REQUEST_SERVICE_TYPE, httpRequestBody, httpRequestContext, httpRequestInputs, httpRequestOutputMappings, httpRequestOutputs, httpRequestRefusal, writeHttpRequestMetadata, } from './http-request.js';
49
49
  import { connectorPlaceholderData, connectorPlaceholderKindOf, isConnectorPlaceholder } from './connector-placeholder.js';
50
- import { lowerTaskOutputRefs, planTaskOutputs, resolveInPlan, unresolvedTaskOutputRef } from './task-output-ref.js';
50
+ import { isWholeTaskOutputMarker, lowerTaskOutputRefs, taskOutputRefs, planTaskOutputs, resolveInPlan, unresolvedTaskOutputRef } from './task-output-ref.js';
51
51
  import { applyCustomRowShape } from './custom-output-shape.js';
52
52
  /** The ids a serialize pass hashed from element ids, by the document it returned. */
53
53
  const ELEMENT_SEEDED_IDS = new WeakMap();
@@ -456,7 +456,7 @@ function serializeCase(built, opts) {
456
456
  */
457
457
  function lowerPlanTaskOutputRefs(plan) {
458
458
  let tasks;
459
- const lower = (text) => lowerTaskOutputRefs(text, (ref) => {
459
+ const lowerText = (text) => lowerTaskOutputRefs(text, (ref) => {
460
460
  tasks ??= planTaskOutputs(plan);
461
461
  const resolved = resolveInPlan(tasks, ref);
462
462
  if ('why' in resolved)
@@ -465,6 +465,17 @@ function lowerPlanTaskOutputRefs(plan) {
465
465
  // left, and the stood-in task's own refusal is what `check` reports.
466
466
  return 'standIn' in resolved ? undefined : resolved.variable;
467
467
  });
468
+ // A bare marker as a whole value (`<- "S"."T".out`) is a reference, so it gets
469
+ // the `=` a literal `vars.<id>` would lack, as `sdd convert` writes it:
470
+ // `=vars.<id>`, or with property reads `=js:vars.<id>?.field` (strict validate
471
+ // accepts no other bare `=` form, and `?.` reads empty while the producer has
472
+ // not run). An author's own `=` value is left as written.
473
+ const lower = (text) => {
474
+ const lowered = lowerText(text);
475
+ if (lowered === text || !isWholeTaskOutputMarker(text))
476
+ return lowered;
477
+ return taskOutputRefs(text)[0].whole.length === text.length ? `=${lowered}` : lowerText(`=js:${text}`);
478
+ };
468
479
  const walk = (value) => {
469
480
  if (typeof value === 'string')
470
481
  return value.includes('$xref') ? lower(value) : value;
@@ -38,6 +38,11 @@ export declare function taskOutputRefs(text: string): Array<TaskOutputRef & {
38
38
  whole: string;
39
39
  index: number;
40
40
  }>;
41
+ /**
42
+ * Whether `text` is exactly one marker, optionally followed by property reads
43
+ * (`.field.sub`), with no `=` prefix: a reference once lowered.
44
+ */
45
+ export declare function isWholeTaskOutputMarker(text: string): boolean;
41
46
  /**
42
47
  * Replace every marker in `text` with what `lower` returns for it. In a `=js:`
43
48
  * expression, a marker followed by a property read gets the optional chain
@@ -49,6 +49,14 @@ export function taskOutputRefs(text) {
49
49
  return { stage: arg(1), task: arg(5), output: arg(9), whole: m[0], index: m.index ?? 0 };
50
50
  });
51
51
  }
52
+ /**
53
+ * Whether `text` is exactly one marker, optionally followed by property reads
54
+ * (`.field.sub`), with no `=` prefix: a reference once lowered.
55
+ */
56
+ export function isWholeTaskOutputMarker(text) {
57
+ const refs = taskOutputRefs(text);
58
+ return refs.length === 1 && refs[0].index === 0 && /^(?:\.[A-Za-z_$][\w$]*)*$/.test(text.slice(refs[0].whole.length));
59
+ }
52
60
  /**
53
61
  * Replace every marker in `text` with what `lower` returns for it. In a `=js:`
54
62
  * expression, a marker followed by a property read gets the optional chain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.122.0",
3
+ "version": "6.122.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",
@@ -126,5 +126,5 @@
126
126
  "@types/node": "^22.7.0",
127
127
  "esbuild": "^0.28.1"
128
128
  },
129
- "gitref": "e76d86fad9a1820eb4e282807215e14b55258dfe"
129
+ "gitref": "f1a04d082c7c66dcbeb02f765d70d4ce08336845"
130
130
  }