@uipath/maestro-builder-sdk 6.79.1 → 6.80.0

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.
@@ -38,6 +38,7 @@ import { CompileRefusal } from '../core/compile-refusal.js';
38
38
  import { implicitInArgBuiltTrigger, unboundInArgMessage } from './in-arg-binding.js';
39
39
  import { jsonClone } from '../core/json-clone.js';
40
40
  import { taskShapeProblems } from './task-shape.js';
41
+ 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';
41
42
  import { connectorPlaceholderData, isConnectorPlaceholder } from './connector-placeholder.js';
42
43
  import { lowerTaskOutputRefs, planTaskOutputs, resolveInPlan, unresolvedTaskOutputRef } from './task-output-ref.js';
43
44
  /** The ids a serialize pass hashed from element ids, by the document it returned. */
@@ -215,6 +216,7 @@ function serializeCase(built, opts) {
215
216
  ownNameRows: new Map(),
216
217
  outputIds: new Set(),
217
218
  ownOutputVars: ownOutputVars(built),
219
+ caseVarNames: new Set([...built.vars.map((v) => v.name), ...mappedFixedOutputVars(built)]),
218
220
  slaId: new Map(),
219
221
  slaIdByName: new Map(),
220
222
  escalationId: new Map(),
@@ -709,6 +711,16 @@ export function applyPreservation(result, preservation, options = {}) {
709
711
  if (written === 'different' && !options.overwrite)
710
712
  throw new CompileRefusal('PRESERVATION_FIELD_COLLISION', `preserved connector configuration of task "${entry.stage}/${entry.task}" collides with serializer-owned output.`);
711
713
  }
714
+ for (const entry of preservation.httpRequestMetadata ?? []) {
715
+ const stage = stageNodes.find((candidate) => candidate.data?.label === entry.stage);
716
+ const task = stageTask(stage, entry.task);
717
+ // A deleted task, or one the edit made another kind, gets nothing: the
718
+ // saved metadata describes the HTTP request activity only. The vendored
719
+ // copy compile wrote is not authored, so replacing it is no collision.
720
+ if (!task || task.type !== 'http-request')
721
+ continue;
722
+ writeHttpRequestMetadata(task.data, entry.metadata);
723
+ }
712
724
  for (const entry of preservation.actionDataFields ?? []) {
713
725
  const stage = stageNodes.find((candidate) => candidate.data?.label === entry.stage);
714
726
  const task = stageTask(stage, entry.task);
@@ -1098,6 +1110,7 @@ export function followRenames(result, preservation) {
1098
1110
  },
1099
1111
  ...(preservation.taskFields ? { taskFields: preservation.taskFields.map(ref) } : {}),
1100
1112
  ...(preservation.connectorConfigurations ? { connectorConfigurations: preservation.connectorConfigurations.map(ref) } : {}),
1113
+ ...(preservation.httpRequestMetadata ? { httpRequestMetadata: preservation.httpRequestMetadata.map(ref) } : {}),
1101
1114
  ...(preservation.actionDataFields ? { actionDataFields: preservation.actionDataFields.map(ref) } : {}),
1102
1115
  ...(preservation.omitTaskElementIds ? { omitTaskElementIds: preservation.omitTaskElementIds.map(ref) } : {}),
1103
1116
  ...(preservation.omitStagePositions ? { omitStagePositions: preservation.omitStagePositions.map(stageName) } : {}),
@@ -2051,6 +2064,9 @@ function taskData(task, resolver, taskId, stageId, ids) {
2051
2064
  : {};
2052
2065
  return withCustomOutputs(data, task, resolver);
2053
2066
  }
2067
+ case 'http-request':
2068
+ // Only `{ assign }` rows are written beside the four: a mapped row is one of them.
2069
+ return withCustomOutputs(httpRequestTaskData(task, resolver, `${stageId}-${taskId}`), { ...task, outputs: task.outputs?.filter((o) => o.custom) }, resolver);
2054
2070
  case 'wait-for-connector':
2055
2071
  // A placeholder returned `{}` above; naming the connector/operation emits
2056
2072
  // the `context` subscription, and a resolved one the full bag.
@@ -2717,6 +2733,77 @@ function externalTaskData(kind, spec, resolver, elementId, where) {
2717
2733
  context.push(io('activityConfigurationVersion', 'string', { value: 'v2' }));
2718
2734
  return { ...data, serviceType: externalServiceType(kind, mode) };
2719
2735
  }
2736
+ /**
2737
+ * An HTTP request task (`case/http-request.ts`): the generic HTTP connector's
2738
+ * activity, with the request in the `body` input. A manual request names the
2739
+ * plan's one `ImplicitConnection` binding; a connector request binds the
2740
+ * connection and its folder the way a connector task does (`bindingRef`,
2741
+ * `folderBindingRef`), and carries those two rows on the task too, as the
2742
+ * Designer saves it.
2743
+ */
2744
+ function httpRequestTaskData(task, resolver, elementId) {
2745
+ const where = `HTTP request task "${task.name}"`;
2746
+ const spec = task.http;
2747
+ if (!spec)
2748
+ throw new Error(`internal SDK error: ${where} has no request.`);
2749
+ const refused = httpRequestRefusal(where, spec);
2750
+ if (refused)
2751
+ throw new CompileRefusal(refused.code, refused.message, refused.suggestion);
2752
+ const mappings = httpRequestOutputMappings(where, task.outputs);
2753
+ if (!(mappings instanceof Map))
2754
+ throw new CompileRefusal(mappings.code, mappings.message, mappings.suggestion);
2755
+ // A mapped output writes a case variable the source may not declare. Its row
2756
+ // is reassigned (`var` is not its id), so like a connector extract's it needs
2757
+ // a root entry for `=vars.<name>` to read; a declared `.var()` wins the name.
2758
+ for (const variable of mappings.values())
2759
+ if (!resolver.varCompanions.has(variable))
2760
+ resolver.varCompanions.set(variable, { id: variable, name: variable, type: 'object', elementId: 'root', custom: true });
2761
+ let connection;
2762
+ let resourceKey = null;
2763
+ let folderKey = null;
2764
+ const bindings = [];
2765
+ if (spec.connector) {
2766
+ const target = { key: spec.connector.key };
2767
+ refuseBindingLabels(resolver, spec.connector, { where, target });
2768
+ const connRef = bindingRef(resolver, spec.connector.connection, 'Connection', 'ConnectionId', HTTP_REQUEST_CONNECTION_NAME, { attribute: 'connection', where, target });
2769
+ const folderRef = folderBindingRef(resolver, spec.connector.folder, connRef, { attribute: 'folder', where, target });
2770
+ if (!connRef || !folderRef)
2771
+ throw new Error(`internal SDK error: ${where} bound no connection or folder.`);
2772
+ connection = `=bindings.${connRef.id}`;
2773
+ resourceKey = connRef.resourceKey;
2774
+ folderKey = `=bindings.${folderRef.id}`;
2775
+ for (const id of [connRef.id, folderRef.id])
2776
+ bindings.push(jsonClone(resolver.bindingSink.get(id)));
2777
+ }
2778
+ else {
2779
+ if (!resolver.bindingSink.has(HTTP_REQUEST_IMPLICIT_BINDING_ID))
2780
+ resolver.bindingSink.set(HTTP_REQUEST_IMPLICIT_BINDING_ID, {
2781
+ id: HTTP_REQUEST_IMPLICIT_BINDING_ID,
2782
+ name: HTTP_REQUEST_CONNECTION_NAME,
2783
+ type: 'string',
2784
+ resource: 'Connection',
2785
+ resourceKey: HTTP_REQUEST_IMPLICIT_CONNECTION,
2786
+ default: HTTP_REQUEST_IMPLICIT_CONNECTION,
2787
+ propertyAttribute: 'ConnectionId',
2788
+ });
2789
+ connection = `=bindings.${HTTP_REQUEST_IMPLICIT_BINDING_ID}`;
2790
+ }
2791
+ return {
2792
+ serviceType: HTTP_REQUEST_SERVICE_TYPE,
2793
+ // The container ids follow `ioSlot`, every connector task's.
2794
+ inputs: httpRequestInputs(elementId, (name) => `v${name}`, httpRequestBody(spec)),
2795
+ // An output's `var` is its id, so an id a case variable has would point the
2796
+ // response at that variable: `code`, `code2`, … skip them, as convert does.
2797
+ outputs: httpRequestOutputs(elementId, (base) => {
2798
+ let id = claimOutputId(resolver, base);
2799
+ while (resolver.caseVarNames.has(id))
2800
+ id = claimOutputId(resolver, base);
2801
+ return id;
2802
+ }, mappings),
2803
+ context: httpRequestContext(connection, resourceKey, folderKey),
2804
+ bindings,
2805
+ };
2806
+ }
2720
2807
  /** A context/output name/value entry (the caseplan `InputOutput` shape). */
2721
2808
  function io(name, type, extra) {
2722
2809
  return { name, type, ...extra };
@@ -3028,6 +3115,24 @@ function isOwnNameOutput(o) {
3028
3115
  * outputs and action form outputs (whose row id is the variable). Collected
3029
3116
  * before any row is emitted, so `claimOutputId` can keep suffixes off them.
3030
3117
  */
3118
+ /**
3119
+ * The case variables a fixed-output task's `.outputs()` maps (an HTTP
3120
+ * request's), declared or not. Collected before any task is emitted, so no
3121
+ * task's own output row takes one of them as its id, whatever the task order:
3122
+ * an undeclared one gets a root companion, and a row id equal to it would make
3123
+ * two writers of one variable, or read back as unmapped.
3124
+ */
3125
+ function mappedFixedOutputVars(built) {
3126
+ const vars = new Set();
3127
+ for (const stage of built.stages)
3128
+ for (const lane of stage.lanes)
3129
+ for (const task of lane)
3130
+ if (task.kind === 'http-request')
3131
+ for (const o of task.outputs ?? [])
3132
+ if (!o.custom)
3133
+ vars.add(o.var);
3134
+ return vars;
3135
+ }
3031
3136
  function ownOutputVars(built) {
3032
3137
  const vars = new Set();
3033
3138
  for (const stage of built.stages)
@@ -160,6 +160,16 @@ export declare const REFUSALS: {
160
160
  readonly CASE_IN_ARG_UNBOUND: "lowering";
161
161
  readonly CASE_LAYOUT_NODE_MATCH: "lowering";
162
162
  readonly CASE_LAYOUT_UNKNOWN_FIELD: "lowering";
163
+ readonly HTTP_REQUEST_CONNECTOR: "lowering";
164
+ readonly HTTP_REQUEST_TARGET: "lowering";
165
+ readonly HTTP_REQUEST_FIELD: "lowering";
166
+ readonly HTTP_REQUEST_OUTPUT: "lowering";
167
+ readonly HTTP_REQUEST_BODY_FORM: "lowering";
168
+ readonly HTTP_REQUEST_BODY_EXPRESSION: "lowering";
169
+ readonly HTTP_REQUEST_METHOD: "lint";
170
+ readonly HTTP_REQUEST_NO_URL: "lint";
171
+ readonly HTTP_REQUEST_CREDENTIAL_HEADER: "lint";
172
+ readonly HTTP_REQUEST_BODY_METHOD: "lint";
163
173
  readonly RULE_SELECTS_ADHOC_TASK: "lint";
164
174
  readonly SELECTED_STAGE_EXITED_NO_EXIT: "lint";
165
175
  readonly SLA_RESPONSE_REENTERS_STAGE: "lint";
@@ -209,6 +209,19 @@ export const REFUSALS = {
209
209
  CASE_IN_ARG_UNBOUND: 'lowering',
210
210
  CASE_LAYOUT_NODE_MATCH: 'lowering',
211
211
  CASE_LAYOUT_UNKNOWN_FIELD: 'lowering',
212
+ // Case http-request task (case/http-request.ts). `lowering`: compile would
213
+ // drop or rewrite what the source says. `lint`: compile writes it as
214
+ // authored, and only `check` reports it.
215
+ HTTP_REQUEST_CONNECTOR: 'lowering',
216
+ HTTP_REQUEST_TARGET: 'lowering',
217
+ HTTP_REQUEST_FIELD: 'lowering',
218
+ HTTP_REQUEST_OUTPUT: 'lowering',
219
+ HTTP_REQUEST_BODY_FORM: 'lowering',
220
+ HTTP_REQUEST_BODY_EXPRESSION: 'lowering',
221
+ HTTP_REQUEST_METHOD: 'lint',
222
+ HTTP_REQUEST_NO_URL: 'lint',
223
+ HTTP_REQUEST_CREDENTIAL_HEADER: 'lint',
224
+ HTTP_REQUEST_BODY_METHOD: 'lint',
212
225
  // Case check: what a condition's references mean (case/check-rule-semantics.ts).
213
226
  RULE_SELECTS_ADHOC_TASK: 'lint',
214
227
  SELECTED_STAGE_EXITED_NO_EXIT: 'lint',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/maestro-builder-sdk",
3
- "version": "6.79.1",
3
+ "version": "6.80.0",
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",
@@ -103,5 +103,5 @@
103
103
  "@types/node": "^22.7.0",
104
104
  "esbuild": "^0.28.1"
105
105
  },
106
- "gitref": "5336a78ca0e7e6bdb6502ce791d71ccb49bbbf01"
106
+ "gitref": "42acd5e20650a9c9102e87297a3754b766b0c4ca"
107
107
  }