@uipath/maestro-builder-sdk 6.93.8 → 6.94.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.
@@ -1207,12 +1207,13 @@ export interface DataServiceOpts extends ActivityOpts {
1207
1207
  skipCondition?: string;
1208
1208
  }
1209
1209
  /**
1210
- * Options for `.http()` — an `Intsvc.UnifiedHttpRequest` node.
1210
+ * Options for `.http()` — a V2 `Intsvc.UnifiedHttpRequest` node.
1211
1211
  *
1212
- * The field names are the registry's own context fields, so what you write is
1213
- * what the platform reads. `mode` is required-and-hidden in the registry and
1214
- * always emitted as `manual`; it is not an option because there is nothing to
1215
- * choose.
1212
+ * The request is written as the `body` row's JSON, in the shape `uip maestro bpmn registry
1213
+ * get Intsvc.UnifiedHttpRequest --input-details <request>` builds: `authentication`
1214
+ * (`manual`, or `connector` with {@link HttpOpts.connection}), `method`, `url`, and the
1215
+ * `headers`, `query` and `body` you give. A value that reads a variable is written `=js:`,
1216
+ * as the CLI writes it (`=vars.x` becomes `=js:vars.x`).
1216
1217
  */
1217
1218
  export interface HttpOpts extends ActivityOpts {
1218
1219
  /** Display name the designer shows on the task. */
@@ -1225,21 +1226,16 @@ export interface HttpOpts extends ActivityOpts {
1225
1226
  url: string;
1226
1227
  /** HTTP method. Defaults to `'GET'`, matching the registry's own default. */
1227
1228
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
1228
- /** Request headers — serialized to the node's json context field. */
1229
+ /** Request headers — the request's `headers`. */
1229
1230
  headers?: Record<string, unknown>;
1230
- /**
1231
- * Query parameters — serialized to the node's json context field, or to the request's
1232
- * `query` in connector mode (see {@link HttpOpts.connection}).
1233
- */
1231
+ /** Query parameters — the request's `query`. */
1234
1232
  parameters?: Record<string, unknown>;
1235
1233
  /**
1236
- * Request body — serialized to the node's json context field.
1234
+ * Request body — the request's `body`.
1237
1235
  *
1238
1236
  * @remarks
1239
- * Leave it off for a request that has none: the row is written as `{}`, which the
1240
- * runtime accepts. The registry declares the default as the text `null`, and the
1241
- * runtime refuses that (`IntSvcUnifiedHttpRequestArgs`: `Body cannot be null`,
1242
- * incident 102018) — every GET this SDK emitted before flow-v2-run-12 faulted on it.
1237
+ * Leave it off for a request that has none, a GET say: the request then carries no
1238
+ * `body` key, as the CLI writes it.
1243
1239
  */
1244
1240
  body?: unknown;
1245
1241
  /**
@@ -1247,15 +1243,19 @@ export interface HttpOpts extends ActivityOpts {
1247
1243
  * request through — which switches the node to CONNECTOR mode.
1248
1244
  *
1249
1245
  * @remarks
1250
- * Without it the node is `Intsvc.UnifiedHttpRequest` in `mode="manual"`: the
1251
- * process owns the URL, headers and auth, and nothing on the tenant is involved.
1252
- * With it the node is the V2 `Intsvc.UnifiedHttpRequest` in connector mode, as
1253
- * `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest --connection-id` builds it:
1254
- * context `connectorKey` `uipath-uipath-http`, the connection bound, and a `body` row
1255
- * carrying the request
1256
- * (`{"authentication":"connector","method":"GET","targetConnector":…,"connection":…,"path":…,"url":…,"headers":…,"query":…,"body":…}`),
1257
- * whose auth is the connection's. A value that reads a variable is written `=js:`, as the
1258
- * CLI writes it (`=vars.x` becomes `=js:vars.x`). That is the shape for "call an endpoint the
1246
+ * Without it the request is MANUAL: the process owns the URL, headers and auth, and the
1247
+ * `body` row is `{"authentication":"manual","method":…,"url":…,"headers":…,"query":…,"body":…}`.
1248
+ * The node still calls the generic HTTP connector (`uipath-uipath-http`), through Studio
1249
+ * Web's implicit connection: a binding whose default and resource key are
1250
+ * `ImplicitConnection` (id `bodyYna9C`, the CLI's, shared by every manual request in the
1251
+ * process), which no tenant resource backs and `bpmn refresh` leaves out of
1252
+ * `bindings_v2.json`. Nothing on the tenant needs to exist.
1253
+ *
1254
+ * With it the node is in connector mode, as `uip maestro bpmn registry get
1255
+ * Intsvc.UnifiedHttpRequest --connection-id` builds it: the connection bound, and the
1256
+ * request
1257
+ * (`{"authentication":"connector","method":"GET","targetConnector":…,"connection":…,"path":…,"url":…,"headers":…,"query":…,"body":…}`)
1258
+ * authenticated by the connection. That is the shape for "call an endpoint the
1259
1259
  * connector catalog has no activity for, through an existing connection" — the
1260
1260
  * non-catalog HTTP fallback.
1261
1261
  *
@@ -1289,9 +1289,13 @@ export interface HttpOpts extends ActivityOpts {
1289
1289
  */
1290
1290
  outputs?: Record<string, string>;
1291
1291
  /**
1292
- * Variable the response lands in. Defaults to `<id>_response`. In connector mode it is
1293
- * the response body; the status code and headers land in `<id>_code` and `<id>_headers`,
1294
- * so it cannot be either.
1292
+ * Variable the response body lands in. Defaults to `<id>_response`. The status code,
1293
+ * headers and error land in `<id>_code`, `<id>_headers` and `<id>_Error`, so it cannot be
1294
+ * any of them, and no {@link HttpOpts.outputs} row may name any of the four.
1295
+ *
1296
+ * @remarks
1297
+ * Before #1873 it held the whole response, so a read written for that shape
1298
+ * (`vars.<id>_response.body.x`) now gets `undefined`: read `vars.<id>_response.x`.
1295
1299
  */
1296
1300
  outputVar?: string;
1297
1301
  /** `=`-expression that skips the request when truthy. */
@@ -2553,15 +2557,17 @@ declare abstract class ScopeBuilder {
2553
2557
  * `uipath:activity` / `Intsvc.UnifiedHttpRequest`).
2554
2558
  *
2555
2559
  * @remarks
2556
- * The first registry-backed typed node (`docs/BPMN_COVERAGE_DESIGN.md` Phase 3).
2557
- * Its wire shape — element, tag, context fields, output row — comes from the
2558
- * committed registry snapshot rather than hand-written emission, so it cannot
2559
- * drift from what the platform validates. Chosen as the pilot because it needs
2560
- * no tenant discovery (`RequiresDiscovery: No`) and the local engine dispatches
2561
- * it for real in `--mode live`.
2562
- *
2563
- * The response lands in `<id>_response` unless `outputVar` says otherwise, and
2564
- * that variable is readable downstream as `=vars.<name>` with no `.var()`.
2560
+ * The V2 element `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest
2561
+ * --input-details <request>` builds (`managed-http.ts`): the node calls Integration
2562
+ * Service's generic HTTP connector, and the request rides in its `body` row. Without
2563
+ * {@link HttpOpts.connection} the request is manual (`"authentication":"manual"`) and
2564
+ * names Studio Web's implicit connection; with it, the request goes through that
2565
+ * connection. It needs no tenant discovery, and the local engine dispatches it for real
2566
+ * in `--mode live`.
2567
+ *
2568
+ * The response body lands in `<id>_response` unless `outputVar` says otherwise, the
2569
+ * status code in `<id>_code`, the headers in `<id>_headers` and the error payload in
2570
+ * `<id>_Error`; each is readable downstream as `=vars.<name>` with no `.var()`.
2565
2571
  *
2566
2572
  * @example
2567
2573
  * ```ts
@@ -2584,12 +2590,26 @@ declare abstract class ScopeBuilder {
2584
2590
  */
2585
2591
  http(id: string, opts: HttpOpts, body?: ActivityBodyFn): this;
2586
2592
  /**
2587
- * @internal Connector-mode `.http()`: the request through an Integration Service
2588
- * connection, as the V2 `Intsvc.UnifiedHttpRequest` element `uip maestro bpmn registry
2589
- * get Intsvc.UnifiedHttpRequest --connection-id` builds (see `managed-http.ts`). The
2590
- * connection and folder resolve exactly as `.dataService()`'s do.
2593
+ * @internal A manual `.http()` request: it authenticates itself, and names the process's
2594
+ * one implicit-connection binding (Studio Web's `ImplicitConnection`), declared here on
2595
+ * first use under the id the CLI gives it. An author's own binding of that connection is
2596
+ * reused whatever its id; one that holds the CLI's id for something else keeps it, and
2597
+ * this node's binding takes `<id>_connection`, or the first `<id>_connection_<n>` no
2598
+ * binding holds when that is taken too.
2599
+ */
2600
+ private manualHttpRequest;
2601
+ /**
2602
+ * @internal The id a manual request's implicit-connection binding takes when none is
2603
+ * declared yet: the CLI's, else `<id>_connection`, else `<id>_connection_<n>` — the first
2604
+ * no binding holds, since `declare` would hand back the holder's unrelated value.
2605
+ */
2606
+ private unusedImplicitBindingId;
2607
+ /**
2608
+ * @internal A connector-mode `.http()` request, through an Integration Service
2609
+ * connection, as `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest --connection-id`
2610
+ * builds it. The connection and folder resolve exactly as `.dataService()`'s do.
2591
2611
  */
2592
- private connectorHttp;
2612
+ private connectorHttpRequest;
2593
2613
  /**
2594
2614
  * A UiPath **Data Fabric** (Data Service) record or file operation — create,
2595
2615
  * update, get, query, delete a record, or download / upload / delete a record's
@@ -6,7 +6,7 @@ import { resolveResourceKeyPattern } from './resource-key-pattern.js';
6
6
  import { quickHumanTaskRows } from './human-task-form.js';
7
7
  import { CompileRefusal } from '../core/compile-refusal.js';
8
8
  import { DATA_SERVICE_ACTIVITY_TYPE, dataServiceContext, dataServiceWire, isPendingEntity, refuseEntityShape, } from './data-service.js';
9
- import { MANAGED_HTTP_CONNECTION_NAME, MANAGED_HTTP_CONNECTOR_KEY, MANAGED_HTTP_FOLDER_NAME, MANAGED_HTTP_TYPE, managedHttpContext, managedHttpInputs, managedHttpOutputs, } from './managed-http.js';
9
+ import { IMPLICIT_CONNECTION, IMPLICIT_CONNECTION_BINDING_ID, MANAGED_HTTP_CONNECTION_NAME, MANAGED_HTTP_CONNECTOR_KEY, MANAGED_HTTP_FOLDER_NAME, MANAGED_HTTP_TYPE, managedHttpContext, managedHttpInputs, managedHttpOutputs, } from './managed-http.js';
10
10
  import { ownEntry } from '../core/own-entry.js';
11
11
  export { BpmnBuildError } from './bpmn-expr-check.js';
12
12
  // @internal helpers kept on the published /bpmn subpath; SDK code imports declared-vars.js.
@@ -1010,15 +1010,17 @@ class ScopeBuilder {
1010
1010
  * `uipath:activity` / `Intsvc.UnifiedHttpRequest`).
1011
1011
  *
1012
1012
  * @remarks
1013
- * The first registry-backed typed node (`docs/BPMN_COVERAGE_DESIGN.md` Phase 3).
1014
- * Its wire shape — element, tag, context fields, output row — comes from the
1015
- * committed registry snapshot rather than hand-written emission, so it cannot
1016
- * drift from what the platform validates. Chosen as the pilot because it needs
1017
- * no tenant discovery (`RequiresDiscovery: No`) and the local engine dispatches
1018
- * it for real in `--mode live`.
1019
- *
1020
- * The response lands in `<id>_response` unless `outputVar` says otherwise, and
1021
- * that variable is readable downstream as `=vars.<name>` with no `.var()`.
1013
+ * The V2 element `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest
1014
+ * --input-details <request>` builds (`managed-http.ts`): the node calls Integration
1015
+ * Service's generic HTTP connector, and the request rides in its `body` row. Without
1016
+ * {@link HttpOpts.connection} the request is manual (`"authentication":"manual"`) and
1017
+ * names Studio Web's implicit connection; with it, the request goes through that
1018
+ * connection. It needs no tenant discovery, and the local engine dispatches it for real
1019
+ * in `--mode live`.
1020
+ *
1021
+ * The response body lands in `<id>_response` unless `outputVar` says otherwise, the
1022
+ * status code in `<id>_code`, the headers in `<id>_headers` and the error payload in
1023
+ * `<id>_Error`; each is readable downstream as `=vars.<name>` with no `.var()`.
1022
1024
  *
1023
1025
  * @example
1024
1026
  * ```ts
@@ -1040,57 +1042,103 @@ class ScopeBuilder {
1040
1042
  * @returns This builder, so calls chain.
1041
1043
  */
1042
1044
  http(id, opts, body) {
1043
- const { name, url, method, headers, parameters, body: requestBody, outputs, outputVar, skipCondition, retry, loop, errorMapping } = opts;
1044
- if (opts.connection !== undefined)
1045
- return this.connectorHttp(id, opts, body);
1046
- if (opts.folder !== undefined || opts.connectorKey !== undefined) {
1045
+ if (opts.connection === undefined && (opts.folder !== undefined || opts.connectorKey !== undefined)) {
1047
1046
  throw new CompileRefusal('BPMN_HTTP_CONNECTOR_FIELDS_NO_CONNECTION', `http "${id}": \`folder\` and \`connectorKey\` belong to connector mode, which \`connection\` selects — ` +
1048
1047
  `pass the connection's binding name too, or drop them for a connectionless request.`);
1049
1048
  }
1049
+ const vars = { code: `${id}_code`, headers: `${id}_headers`, body: opts.outputVar ?? `${id}_response`, error: `${id}_Error` };
1050
+ // Each of the four rows writes its own variable; a second writer of one would
1051
+ // overwrite it, so neither `outputVar` nor an `outputs` row may name another's.
1052
+ const fixed = [[vars.code, 'status code'], [vars.headers, 'headers'], [vars.error, 'error']];
1053
+ const clash = fixed.find(([name]) => name === opts.outputVar);
1054
+ if (clash !== undefined) {
1055
+ throw new CompileRefusal('BPMN_HTTP_OUTPUT_VAR_RESERVED', `http "${id}": outputVar "${opts.outputVar}" is the variable .http() writes the ${clash[1]} to. ` +
1056
+ `Pick another name, or drop outputVar for the default "${id}_response".`);
1057
+ }
1058
+ const written = new Map([...fixed, [vars.body, 'response body']]);
1059
+ const taken = Object.keys(opts.outputs ?? {}).find((name) => written.has(name));
1060
+ if (taken !== undefined) {
1061
+ throw new CompileRefusal('BPMN_HTTP_OUTPUT_VAR_RESERVED', `http "${id}": outputs row "${taken}" is the variable .http() writes the ${written.get(taken)} to. ` +
1062
+ `Name the row's variable something else, or read the value from "${taken}" downstream.`);
1063
+ }
1064
+ const request = opts.connection !== undefined ? this.connectorHttpRequest(id, opts) : this.manualHttpRequest(id, opts);
1050
1065
  return this.pushActivity({
1051
1066
  kind: 'typed',
1052
1067
  id,
1053
- name,
1054
- type: 'Intsvc.UnifiedHttpRequest',
1055
- // These three are `json` context fields, so they go through as VALUES — the
1056
- // emitter encodes a json field's body. This wrapper used to `JSON.stringify`
1057
- // them itself, working around an emitter that wrote `[object Object]` for
1058
- // anything but a string; now the generic `.activity()` path accepts the same
1059
- // values this one does.
1060
- context: {
1061
- method: method ?? 'GET',
1062
- url,
1063
- ...(headers !== undefined ? { headers } : {}),
1064
- ...(parameters !== undefined ? { parameters } : {}),
1065
- ...(requestBody !== undefined ? { body: requestBody } : {}),
1066
- },
1068
+ name: opts.name,
1069
+ type: MANAGED_HTTP_TYPE,
1070
+ context: {},
1071
+ contextRows: managedHttpContext(request),
1067
1072
  inputs: {},
1068
- outputs,
1069
- outputVar,
1070
- skipCondition,
1071
- retry,
1072
- loop,
1073
- errorMapping,
1073
+ inputRows: managedHttpInputs(request),
1074
+ outputRows: managedHttpOutputs(vars),
1075
+ // `outputs` does not survive `outputRows`; the author's rows go after the four as
1076
+ // mapped rows, each typed from the variable it writes.
1077
+ mappedOutputRows: Object.entries(opts.outputs ?? {}).map(([varId, source]) => ({ name: varId, type: 'string', source, var: varId })),
1078
+ skipCondition: opts.skipCondition,
1079
+ tags: opts.tags,
1080
+ retry: opts.retry,
1081
+ errorMapping: opts.errorMapping,
1082
+ loop: opts.loop,
1074
1083
  }, body);
1075
1084
  }
1076
1085
  /**
1077
- * @internal Connector-mode `.http()`: the request through an Integration Service
1078
- * connection, as the V2 `Intsvc.UnifiedHttpRequest` element `uip maestro bpmn registry
1079
- * get Intsvc.UnifiedHttpRequest --connection-id` builds (see `managed-http.ts`). The
1080
- * connection and folder resolve exactly as `.dataService()`'s do.
1086
+ * @internal A manual `.http()` request: it authenticates itself, and names the process's
1087
+ * one implicit-connection binding (Studio Web's `ImplicitConnection`), declared here on
1088
+ * first use under the id the CLI gives it. An author's own binding of that connection is
1089
+ * reused whatever its id; one that holds the CLI's id for something else keeps it, and
1090
+ * this node's binding takes `<id>_connection`, or the first `<id>_connection_<n>` no
1091
+ * binding holds when that is taken too.
1081
1092
  */
1082
- connectorHttp(id, opts, body) {
1083
- const codeVar = `${id}_code`;
1084
- const headersVar = `${id}_headers`;
1085
- if (opts.outputVar === codeVar || opts.outputVar === headersVar) {
1086
- throw new CompileRefusal('BPMN_HTTP_OUTPUT_VAR_RESERVED', `http "${id}": outputVar "${opts.outputVar}" is the variable connector mode writes the status code or headers to. ` +
1087
- `Pick another name, or drop outputVar for the default "${id}_response".`);
1088
- }
1093
+ manualHttpRequest(id, opts) {
1094
+ const implicit = {
1095
+ id: IMPLICIT_CONNECTION_BINDING_ID,
1096
+ name: MANAGED_HTTP_CONNECTION_NAME,
1097
+ resource: 'Connection',
1098
+ propertyAttribute: 'ConnectionId',
1099
+ default: IMPLICIT_CONNECTION,
1100
+ resourceKey: IMPLICIT_CONNECTION,
1101
+ };
1102
+ const isImplicit = (b) => b.resource === 'Connection' && b.propertyAttribute.toLowerCase() === 'connectionid' && (b.resourceKey ?? b.default) === IMPLICIT_CONNECTION;
1103
+ const decl = this._bindingRegistry.bindings.find(isImplicit) ?? this._bindingRegistry.declare({ ...implicit, id: this.unusedImplicitBindingId(id) });
1104
+ return {
1105
+ authentication: 'manual',
1106
+ connection: { ref: `=bindings.${decl.id}` },
1107
+ method: opts.method ?? 'GET',
1108
+ url: opts.url,
1109
+ headers: opts.headers,
1110
+ query: opts.parameters,
1111
+ body: opts.body,
1112
+ };
1113
+ }
1114
+ /**
1115
+ * @internal The id a manual request's implicit-connection binding takes when none is
1116
+ * declared yet: the CLI's, else `<id>_connection`, else `<id>_connection_<n>` — the first
1117
+ * no binding holds, since `declare` would hand back the holder's unrelated value.
1118
+ */
1119
+ unusedImplicitBindingId(id) {
1120
+ const registry = this._bindingRegistry;
1121
+ if (!registry.has(IMPLICIT_CONNECTION_BINDING_ID))
1122
+ return IMPLICIT_CONNECTION_BINDING_ID;
1123
+ if (!registry.has(`${id}_connection`))
1124
+ return `${id}_connection`;
1125
+ let n = 2;
1126
+ while (registry.has(`${id}_connection_${n}`))
1127
+ n++;
1128
+ return `${id}_connection_${n}`;
1129
+ }
1130
+ /**
1131
+ * @internal A connector-mode `.http()` request, through an Integration Service
1132
+ * connection, as `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest --connection-id`
1133
+ * builds it. The connection and folder resolve exactly as `.dataService()`'s do.
1134
+ */
1135
+ connectorHttpRequest(id, opts) {
1089
1136
  const connection = this.dataServiceBinding(id, 'connection', opts.connection, 'ConnectionId', MANAGED_HTTP_CONNECTION_NAME);
1090
1137
  const folder = opts.folder !== undefined
1091
1138
  ? this.dataServiceBinding(id, 'folder', opts.folder, 'folderKey', MANAGED_HTTP_FOLDER_NAME, connection.key)
1092
1139
  : undefined;
1093
- const request = {
1140
+ return {
1141
+ authentication: 'connector',
1094
1142
  connection,
1095
1143
  folder,
1096
1144
  targetConnector: opts.connectorKey ?? MANAGED_HTTP_CONNECTOR_KEY,
@@ -1100,28 +1148,6 @@ class ScopeBuilder {
1100
1148
  query: opts.parameters,
1101
1149
  body: opts.body,
1102
1150
  };
1103
- return this.pushActivity({
1104
- kind: 'typed',
1105
- id,
1106
- name: opts.name,
1107
- type: MANAGED_HTTP_TYPE,
1108
- context: {},
1109
- contextRows: managedHttpContext(request),
1110
- inputs: {},
1111
- inputRows: managedHttpInputs(request),
1112
- outputRows: managedHttpOutputs({
1113
- code: codeVar,
1114
- headers: headersVar,
1115
- body: opts.outputVar ?? `${id}_response`,
1116
- error: `${id}_Error`,
1117
- }),
1118
- outputs: opts.outputs,
1119
- skipCondition: opts.skipCondition,
1120
- tags: opts.tags,
1121
- retry: opts.retry,
1122
- errorMapping: opts.errorMapping,
1123
- loop: opts.loop,
1124
- }, body);
1125
1151
  }
1126
1152
  /**
1127
1153
  * A UiPath **Data Fabric** (Data Service) record or file operation — create,
@@ -24,7 +24,7 @@ import { EQUALS_EXPR_DIALECT, checkConnectorLookups, checkConnectorResources, ch
24
24
  import { checkEventResolution, checkEventSubscription, eventParamsFor, } from '../core/event-checks.js';
25
25
  import { bindingRequiredFields, CASE_RUNTIME_INTERNAL_TYPES, CONNECTOR_ACTIVITY_TYPES, missingRequiredContext, missingRequiredInputs, platformEnforcesRequired, REGISTRY_GAPS, registryType, } from './typed-node.js';
26
26
  import { ownEntry } from '../core/own-entry.js';
27
- import { isManagedHttpV2, managedHttpAbsoluteUrl, managedHttpMissing } from './managed-http.js';
27
+ import { MANAGED_HTTP_TYPE, isManagedHttpV2, managedHttpAbsoluteUrl, managedHttpMissing } from './managed-http.js';
28
28
  import { connectorV2Missing, isConnectorV2 } from './connector.js';
29
29
  /**
30
30
  * The node row a diagnostic is about, where two rules can report one row: the
@@ -1871,6 +1871,23 @@ inEventSubProcess = false) {
1871
1871
  where: n.id,
1872
1872
  }, field));
1873
1873
  }
1874
+ // The V1 manual request (`mode="manual"`, the request as context rows), which `.http()`
1875
+ // wrote before #1873 and an import still carries. The runtime faults it on the `body`
1876
+ // row (incident 102018 "Body cannot be null") with the registry default `null`
1877
+ // (flow-v2-run-12) and with `{}` (flow-v2-run-14); `validate` accepts it, so only a
1878
+ // warning, but nothing shows a V1 manual request running.
1879
+ if (n.type === MANAGED_HTTP_TYPE && !managedHttp) {
1880
+ diags.push({
1881
+ level: 'warning',
1882
+ code: 'HTTP_MANUAL_V1',
1883
+ message: `"${n.id}" (${n.type}) is the V1 manual HTTP request (mode="manual", the request as context rows), which the ` +
1884
+ `runtime faults with incident 102018 "Invalid value in Unified HttpRequest input": "Body cannot be null", ` +
1885
+ `whatever its body row holds. Write it with .http(id, { url, method, headers, parameters, body }) and no ` +
1886
+ `connection, which writes the V2 manual request (activityConfigurationVersion v2, the request in the body ` +
1887
+ `row as {"authentication":"manual",…}, through the implicit connection).`,
1888
+ where: n.id,
1889
+ });
1890
+ }
1874
1891
  const absoluteUrl = managedHttp ? managedHttpAbsoluteUrl(httpRequest) : undefined;
1875
1892
  if (absoluteUrl !== undefined) {
1876
1893
  diags.push({
@@ -1,8 +1,18 @@
1
1
  /**
2
- * bpmn/managed-http — the wire shape behind connector-mode `.http()`: a V2
3
- * `Intsvc.UnifiedHttpRequest` through an Integration Service connection, as
4
- * `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest --connection-id <id>` builds it
5
- * (UiPath/cli `buildManagedHttpSpec` rendered by `renderBpmnV2Element`).
2
+ * bpmn/managed-http — the wire shape behind `.http()`: a V2 `Intsvc.UnifiedHttpRequest`,
3
+ * as `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest --input-details <request>`
4
+ * builds it (UiPath/cli `buildManagedHttpSpec` rendered by `renderBpmnV2Element`). Two modes,
5
+ * one element:
6
+ * - connector (`--connection-id <id>`): the request goes through an Integration Service
7
+ * connection, which the node binds with its folder;
8
+ * - manual: the request authenticates itself, and the node names Studio Web's implicit
9
+ * connection (`ImplicitConnection`), which no tenant resource backs.
10
+ *
11
+ * The V1 manual node (`mode="manual"` and the request as context rows), which `.http()`
12
+ * wrote without a connection until #1873, faults at runtime: incident 102018 "Invalid value
13
+ * in Unified HttpRequest input", "Body cannot be null", with `body` as `null` and as `{}`
14
+ * alike (flow-v2-run-12, flow-v2-run-14). The V2 manual node ran live end to end
15
+ * (flow-v2-run-14 v1 `skill-bpmn-slack-weather-pipeline`, an Open-Meteo GET).
6
16
  */
7
17
  import { MANAGED_HTTP_CONNECTOR_KEY } from '../core/managed-http.js';
8
18
  import type { TypedContextRow, TypedInputRow, TypedOutputRow } from './typed-node.js';
@@ -11,6 +21,19 @@ export declare const MANAGED_HTTP_TYPE = "Intsvc.UnifiedHttpRequest";
11
21
  /** The connection binding's name, after the node's `connectorKey`, as the CLI names it. */
12
22
  export declare const MANAGED_HTTP_CONNECTION_NAME = "uipath-uipath-http connection";
13
23
  export declare const MANAGED_HTTP_FOLDER_NAME = "FolderKey";
24
+ /**
25
+ * The connection a manual request names: Studio Web's implicit one, which no tenant
26
+ * resource backs, so `bpmn refresh` and packaging leave it out of `bindings_v2.json`.
27
+ */
28
+ export declare const IMPLICIT_CONNECTION = "ImplicitConnection";
29
+ /**
30
+ * The id the CLI gives the implicit connection's binding: it derives a root binding's id
31
+ * from what it binds (UiPath/cli `bindingId` in `connector-spec/bpmn-element.ts`,
32
+ * `b` + the first 8 base64url characters, less `-` and `_`, of
33
+ * sha256(`Connection|ImplicitConnection|ConnectionId`)), so every manual request in a
34
+ * process shares this one binding, and a node the CLI adds finds it already there.
35
+ */
36
+ export declare const IMPLICIT_CONNECTION_BINDING_ID = "bodyYna9C";
14
37
  /**
15
38
  * True for a V2 HTTP request. `registry-types.json` holds the V1 manual node, whose
16
39
  * required `url` and `mode` a V2 one does not carry.
@@ -26,7 +49,9 @@ export declare function managedHttpAbsoluteUrl(body: unknown): {
26
49
  url: string;
27
50
  targetConnector: string;
28
51
  } | undefined;
29
- export interface ManagedHttpRequest {
52
+ /** A request through a connection; its auth is the connection's. */
53
+ export interface ManagedHttpConnectorRequest {
54
+ authentication: 'connector';
30
55
  /** `ref` is the `=bindings.<id>` reference; `key` the connection id it resolves to. */
31
56
  connection: {
32
57
  ref: string;
@@ -44,6 +69,21 @@ export interface ManagedHttpRequest {
44
69
  query?: Record<string, unknown>;
45
70
  body?: unknown;
46
71
  }
72
+ /** A request that authenticates itself, through the implicit connection. */
73
+ export interface ManagedHttpManualRequest {
74
+ authentication: 'manual';
75
+ /** `ref` is the `=bindings.<id>` reference to the implicit connection's binding. */
76
+ connection: {
77
+ ref: string;
78
+ };
79
+ method: string;
80
+ /** The URL the request goes to, as written. */
81
+ url: string;
82
+ headers?: Record<string, unknown>;
83
+ query?: Record<string, unknown>;
84
+ body?: unknown;
85
+ }
86
+ export type ManagedHttpRequest = ManagedHttpConnectorRequest | ManagedHttpManualRequest;
47
87
  export interface ManagedHttpVars {
48
88
  code: string;
49
89
  headers: string;
@@ -51,6 +91,7 @@ export interface ManagedHttpVars {
51
91
  error: string;
52
92
  }
53
93
  export declare function managedHttpContext(req: ManagedHttpRequest): TypedContextRow[];
94
+ /** The request, in the `body` row: UiPath/cli `buildManagedHttpBodyParameters`, in its key order. */
54
95
  export declare function managedHttpInputs(req: ManagedHttpRequest): TypedInputRow[];
55
96
  /** Studio Web's curated HTTP outputs, then `Error`. */
56
97
  export declare function managedHttpOutputs(vars: ManagedHttpVars): TypedOutputRow[];
@@ -1,8 +1,18 @@
1
1
  /**
2
- * bpmn/managed-http — the wire shape behind connector-mode `.http()`: a V2
3
- * `Intsvc.UnifiedHttpRequest` through an Integration Service connection, as
4
- * `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest --connection-id <id>` builds it
5
- * (UiPath/cli `buildManagedHttpSpec` rendered by `renderBpmnV2Element`).
2
+ * bpmn/managed-http — the wire shape behind `.http()`: a V2 `Intsvc.UnifiedHttpRequest`,
3
+ * as `uip maestro bpmn registry get Intsvc.UnifiedHttpRequest --input-details <request>`
4
+ * builds it (UiPath/cli `buildManagedHttpSpec` rendered by `renderBpmnV2Element`). Two modes,
5
+ * one element:
6
+ * - connector (`--connection-id <id>`): the request goes through an Integration Service
7
+ * connection, which the node binds with its folder;
8
+ * - manual: the request authenticates itself, and the node names Studio Web's implicit
9
+ * connection (`ImplicitConnection`), which no tenant resource backs.
10
+ *
11
+ * The V1 manual node (`mode="manual"` and the request as context rows), which `.http()`
12
+ * wrote without a connection until #1873, faults at runtime: incident 102018 "Invalid value
13
+ * in Unified HttpRequest input", "Body cannot be null", with `body` as `null` and as `{}`
14
+ * alike (flow-v2-run-12, flow-v2-run-14). The V2 manual node ran live end to end
15
+ * (flow-v2-run-14 v1 `skill-bpmn-slack-weather-pipeline`, an Open-Meteo GET).
6
16
  */
7
17
  import { MANAGED_HTTP_ACTIVITY_TYPE_ID, MANAGED_HTTP_CONNECTOR_KEY, MANAGED_HTTP_ENDPOINT, MANAGED_HTTP_ENDPOINT_METHOD, MANAGED_HTTP_ESSENTIAL_CONFIGURATION, MANAGED_HTTP_INSTANCE_PARAMETERS, MANAGED_HTTP_OBJECT_NAME, MANAGED_HTTP_TELEMETRY, } from '../core/managed-http.js';
8
18
  import { isRecord } from '../core/node-envelope.js';
@@ -14,6 +24,20 @@ export const MANAGED_HTTP_FOLDER_NAME = 'FolderKey';
14
24
  const CONNECTOR_VERSION = '1.4.50';
15
25
  const CONFIGURATION_VERSION = 'v2';
16
26
  const CONNECTOR_AUTHENTICATION = 'connector';
27
+ const MANUAL_AUTHENTICATION = 'manual';
28
+ /**
29
+ * The connection a manual request names: Studio Web's implicit one, which no tenant
30
+ * resource backs, so `bpmn refresh` and packaging leave it out of `bindings_v2.json`.
31
+ */
32
+ export const IMPLICIT_CONNECTION = 'ImplicitConnection';
33
+ /**
34
+ * The id the CLI gives the implicit connection's binding: it derives a root binding's id
35
+ * from what it binds (UiPath/cli `bindingId` in `connector-spec/bpmn-element.ts`,
36
+ * `b` + the first 8 base64url characters, less `-` and `_`, of
37
+ * sha256(`Connection|ImplicitConnection|ConnectionId`)), so every manual request in a
38
+ * process shares this one binding, and a node the CLI adds finds it already there.
39
+ */
40
+ export const IMPLICIT_CONNECTION_BINDING_ID = 'bodyYna9C';
17
41
  /** Studio Web's guard on a JSON string it stores in node metadata. */
18
42
  const JSON_STRING_PREFIX = '=jsonString:';
19
43
  /** The CLI's `EXPRESSION_SHAPED`: a value Studio Web's V2 component reads as an expression only as `=js:`. */
@@ -25,6 +49,8 @@ const EXPRESSION_SHAPED = /^=(vars|metadata|response|Error)\b/;
25
49
  const REQUIRED_CONTEXT = ['connectorKey'];
26
50
  const CONNECTOR_REQUIRED_CONTEXT = ['folderKey'];
27
51
  const CONNECTOR_REQUIRED_BODY = ['targetConnector', 'connection'];
52
+ /** UiPath/cli `managedHttpDetailErrors`: "url is required for manual mode". */
53
+ const MANUAL_REQUIRED_BODY = ['url'];
28
54
  const ABSOLUTE_URL = /^[a-z][a-z\d+.-]*:\/\//i;
29
55
  const ESSENTIAL_CONFIGURATION = {
30
56
  essentialConfiguration: {
@@ -54,6 +80,9 @@ export function isManagedHttpV2(type, context) {
54
80
  export function managedHttpMissing(context, body) {
55
81
  const unset = (v) => v === undefined || v === null || (typeof v === 'string' && v.trim() === '');
56
82
  const missingContext = REQUIRED_CONTEXT.filter((name) => unset(context[name]));
83
+ const manual = manualRequest(body);
84
+ if (manual !== undefined)
85
+ return [...missingContext, ...MANUAL_REQUIRED_BODY.filter((name) => typeof manual[name] !== 'string' || unset(manual[name])).map((name) => `body.${name}`)];
57
86
  const request = connectorRequest(body);
58
87
  if (request === undefined)
59
88
  return missingContext;
@@ -79,8 +108,14 @@ export function managedHttpAbsoluteUrl(body) {
79
108
  return { url, targetConnector };
80
109
  }
81
110
  function connectorRequest(body) {
111
+ return requestOf(body, CONNECTOR_AUTHENTICATION);
112
+ }
113
+ function manualRequest(body) {
114
+ return requestOf(body, MANUAL_AUTHENTICATION);
115
+ }
116
+ function requestOf(body, authentication) {
82
117
  const request = typeof body === 'string' ? parseObject(body) : body;
83
- return isRecord(request) && request.authentication === CONNECTOR_AUTHENTICATION ? request : undefined;
118
+ return isRecord(request) && request.authentication === authentication ? request : undefined;
84
119
  }
85
120
  function parseObject(text) {
86
121
  try {
@@ -101,11 +136,13 @@ function designTimeExpressions(value) {
101
136
  return value;
102
137
  }
103
138
  export function managedHttpContext(req) {
139
+ const connector = req.authentication === CONNECTOR_AUTHENTICATION;
104
140
  return [
105
141
  { name: 'connectorKey', value: MANAGED_HTTP_CONNECTOR_KEY },
106
142
  { name: 'connection', value: req.connection.ref },
107
- { name: 'resourceKey', value: req.connection.key },
108
- ...(req.folder ? [{ name: 'folderKey', value: req.folder.ref }] : []),
143
+ // A manual request has no connection id: the CLI writes the row with no value.
144
+ connector ? { name: 'resourceKey', value: req.connection.key } : { name: 'resourceKey' },
145
+ ...(connector && req.folder ? [{ name: 'folderKey', value: req.folder.ref }] : []),
109
146
  { name: 'method', value: MANAGED_HTTP_ENDPOINT_METHOD },
110
147
  { name: 'path', value: MANAGED_HTTP_ENDPOINT },
111
148
  { name: 'objectName', value: MANAGED_HTTP_OBJECT_NAME },
@@ -126,16 +163,19 @@ export function managedHttpContext(req) {
126
163
  { name: 'activityConfigurationVersion', value: CONFIGURATION_VERSION },
127
164
  ];
128
165
  }
166
+ /** The request, in the `body` row: UiPath/cli `buildManagedHttpBodyParameters`, in its key order. */
129
167
  export function managedHttpInputs(req) {
130
168
  const url = designTimeExpressions(req.url);
131
- const body = {
132
- authentication: CONNECTOR_AUTHENTICATION,
133
- method: req.method,
134
- targetConnector: req.targetConnector,
135
- connection: req.connection.key,
136
- path: url,
137
- url,
138
- };
169
+ const body = req.authentication === CONNECTOR_AUTHENTICATION
170
+ ? {
171
+ authentication: CONNECTOR_AUTHENTICATION,
172
+ method: req.method,
173
+ targetConnector: req.targetConnector,
174
+ connection: req.connection.key,
175
+ path: url,
176
+ url,
177
+ }
178
+ : { authentication: MANUAL_AUTHENTICATION, method: req.method, url };
139
179
  if (req.headers !== undefined)
140
180
  body.headers = designTimeExpressions(req.headers);
141
181
  if (req.query !== undefined)
@@ -19,6 +19,7 @@ import { createRequire } from 'node:module';
19
19
  import { createConnectorTask } from './connector.js';
20
20
  import { createConnectorEvent, createExternalTask } from './intsvc.js';
21
21
  import { connectorEventErrorVar, intsvcOutputVar } from './intsvc-vars.js';
22
+ import { IMPLICIT_CONNECTION } from './managed-http.js';
22
23
  import { createExtensionPayload, createTypedNode, rowDeclaration, typedNodeOutputVar, verbatimOutputRows } from './typed-node.js';
23
24
  import { connectorOutputVars, nodeDeclaredVars, typedNodeDeclaredVars } from './declared-vars.js';
24
25
  import { defaultEntryPointId } from './entry-point-id.js';
@@ -1271,7 +1272,8 @@ export function folderCompanionKeys(built, sink) {
1271
1272
  const key = b.resourceKey ?? b.default;
1272
1273
  if (key !== undefined)
1273
1274
  keyOf.set(b.id, key);
1274
- if (isConnectionId(b.propertyAttribute))
1275
+ // The implicit connection a manual HTTP request names is no connection a folder belongs to.
1276
+ if (isConnectionId(b.propertyAttribute) && key !== IMPLICIT_CONNECTION)
1275
1277
  connectionIds.push(b.id);
1276
1278
  }
1277
1279
  for (const b of sink.values()) {
@@ -401,8 +401,8 @@ export interface TypedNodeInput {
401
401
  * the registry's defaults.
402
402
  *
403
403
  * For importers, not authors. Default injection is an authoring convenience:
404
- * `.http()` relies on it for `mode`, which is required, hidden, and so never
405
- * passed by hand. An importer has the opposite need — the artifact already
404
+ * `.activity('…', 'Intsvc.UnifiedHttpRequest')` relies on it for the V1 manual
405
+ * node's `mode`, which is required, hidden, and so never passed by hand. An importer has the opposite need — the artifact already
406
406
  * carries the fields it should, and adding a default it lacked, or reordering
407
407
  * what it had, breaks a byte-exact round-trip. `bpmn-decompile` sets this.
408
408
  */