@uipath/maestro-builder-sdk 6.79.0 → 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.
@@ -201,8 +201,16 @@ export declare function escalation(opts: EscalationOpts): BuiltEscalation;
201
201
  /**
202
202
  * An escalation recipient that is a single user.
203
203
  *
204
- * @param target - How the user is addressed, e.g. `'email'`.
205
- * @param value - The address itself, when `target` names a lookup rather than a value.
204
+ * The Designer saves a user as the tenant's id for them, with their email as
205
+ * `value`: `toUser('<user id>', 'manager@corp.com')`. `uip maestro case validate`
206
+ * also accepts the email itself as `target`: `toUser('manager@corp.com')`. A
207
+ * label such as `'email'` in `target` is neither, and `validate` does not
208
+ * report it. Until the id is known, write `toUser('<UNRESOLVED: … user id>', '<email>')`;
209
+ * `check` reports the marker (`ESCALATION_RECIPIENT_UNRESOLVED`).
210
+ *
211
+ * @param target - The user's tenant id (a GUID) or email, or an `<UNRESOLVED: …>` marker.
212
+ * @param value - The user's email, as the Designer shows it. Omitted, `value` is
213
+ * written as `target`.
206
214
  * @returns A recipient for an escalation's `notify` list.
207
215
  */
208
216
  export declare function toUser(target: string, value?: string): EscalationRecipient;
@@ -214,7 +222,8 @@ export declare function toUser(target: string, value?: string): EscalationRecipi
214
222
  * group's name in `target` notifies nobody: `check` reports it, as
215
223
  * `uip maestro case validate` does (`CASE_MGMT_ESCALATION_RECIPIENT_LITERAL`),
216
224
  * and compile writes it as authored. Until the id is known, write the
217
- * marker `validate` accepts: `toGroup('<UNRESOLVED: Claims Leads group id>', 'Claims Leads')`.
225
+ * marker `validate` accepts: `toGroup('<UNRESOLVED: Claims Leads group id>', 'Claims Leads')`;
226
+ * `check` reports it (`ESCALATION_RECIPIENT_UNRESOLVED`) until the id is filled in.
218
227
  *
219
228
  * @param target - The group's tenant id (a GUID), or an `<UNRESOLVED: …>` marker.
220
229
  * @param value - The group's display name. Omitted, `value` is written as
@@ -432,7 +441,7 @@ export interface BuiltCaseExitCondition {
432
441
  marksCaseComplete?: boolean;
433
442
  rules: CaseRule[][];
434
443
  }
435
- export type TaskKind = 'process' | 'agent' | 'rpa' | 'api-workflow' | 'case-management' | 'flow-process' | 'function' | 'business-rule' | 'external-agent' | 'external-workflow' | 'action' | 'connector' | 'wait-for-timer' | 'wait-for-connector';
444
+ export type TaskKind = 'process' | 'agent' | 'rpa' | 'api-workflow' | 'case-management' | 'flow-process' | 'function' | 'business-rule' | 'external-agent' | 'external-workflow' | 'action' | 'connector' | 'wait-for-timer' | 'wait-for-connector' | 'http-request';
436
445
  /**
437
446
  * Task kinds that the Case schema permits as unresolved skeletons: the
438
447
  * published-resource kinds, `action` (a human task whose Action App or form is
@@ -520,6 +529,60 @@ export interface CaseConnectorOpts extends ConnectorOpts {
520
529
  */
521
530
  carriedFields?: readonly CarriedConnectorField[];
522
531
  }
532
+ /** A method the HTTP request activity offers. */
533
+ export type HttpRequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
534
+ /**
535
+ * An HTTP request task's request (`.httpRequest()`). Without `connector` the
536
+ * request goes to `url` as written, unauthenticated; with one it reuses that
537
+ * connector's connection, and `path` is relative to the connector's base URL.
538
+ */
539
+ export interface CaseHttpRequestSpec {
540
+ /** The HTTP method; a body goes only with POST, PUT or PATCH. */
541
+ method: HttpRequestMethod;
542
+ /** The full address, for a request without a connector. May be an `=` expression. */
543
+ url?: string;
544
+ /** The address relative to the connector's base URL, for a connector request. */
545
+ path?: string;
546
+ /**
547
+ * Request headers. Never a literal credential (`Authorization`, `Cookie`, an
548
+ * API key): the value is written into the case plan as authored. Authenticate
549
+ * through `connector` instead.
550
+ *
551
+ * @enforcedBy HTTP_REQUEST_CREDENTIAL_HEADER `check` reports a credential header with a literal value.
552
+ */
553
+ headers?: Record<string, string>;
554
+ /**
555
+ * Query parameters. Never a literal credential (`api_key`, `access_token`, …),
556
+ * for the same reason as headers.
557
+ *
558
+ * @enforcedBy HTTP_REQUEST_CREDENTIAL_HEADER `check` reports a credential query parameter with a literal value.
559
+ */
560
+ query?: Record<string, string>;
561
+ /**
562
+ * The request body, for POST, PUT or PATCH: an object, JSON text, or an `=`
563
+ * expression (`=js:vars.payload`). In an object, a value `=js:<expression>`
564
+ * or `=<reference>` (`=vars.id`) is sent as the value it reads.
565
+ *
566
+ * @enforcedBy HTTP_REQUEST_BODY_METHOD `check` reports a body on another method.
567
+ * @enforcedBy HTTP_REQUEST_BODY_FORM compile refuses text that is neither JSON nor an expression.
568
+ * @enforcedBy HTTP_REQUEST_BODY_EXPRESSION compile refuses an object value that is another kind of `=` expression.
569
+ */
570
+ body?: string | Record<string, unknown> | unknown[];
571
+ /**
572
+ * Reuse a connector's authentication: its key (`uipath-atlassian-jira`) and
573
+ * the symbolic connection and folder bindings, as on `.connector()`.
574
+ */
575
+ connector?: HttpRequestConnector;
576
+ }
577
+ /** The connection an HTTP request reuses the authentication of (`CaseHttpRequestSpec.connector`). */
578
+ export interface HttpRequestConnector {
579
+ /** The connector whose authentication the request reuses, e.g. `uipath-atlassian-jira`. */
580
+ key: string;
581
+ /** The symbolic connection binding, resolved through bindings.json like a connector task's. */
582
+ connection: string;
583
+ /** The symbolic folder binding of that connection. */
584
+ folder: string;
585
+ }
523
586
  /**
524
587
  * The external agent's or automation's `executionType`, as Integration Service
525
588
  * reports it for the connector object.
@@ -804,6 +867,8 @@ export interface BuiltTask {
804
867
  connector?: ConnectorSpecData;
805
868
  /** Descriptor-resolved external agent/workflow configuration. */
806
869
  external?: ExternalTaskSpecData;
870
+ /** http-request task: the request. */
871
+ http?: CaseHttpRequestSpec;
807
872
  timer?: TimerSpecData;
808
873
  /** wait-for-connector task: the event subscription (placeholder when key/operation omitted). */
809
874
  waitConnector?: WaitConnectorSpec;
@@ -1061,6 +1126,7 @@ declare class TaskBuilder {
1061
1126
  private _action?;
1062
1127
  private _connector?;
1063
1128
  private _external?;
1129
+ private _http?;
1064
1130
  private _timer?;
1065
1131
  private _waitConnector?;
1066
1132
  private _required?;
@@ -1306,6 +1372,26 @@ declare class TaskBuilder {
1306
1372
  * @returns This builder, so calls chain.
1307
1373
  */
1308
1374
  waitForTimer(spec: TimerSpecData): this;
1375
+ /**
1376
+ * An HTTP request through Integration Service's generic HTTP connector, the
1377
+ * Case Designer's HTTP request task. The task writes four outputs, `code`,
1378
+ * `headers`, `body` and `Error`; map one to a case variable with
1379
+ * `.outputs({ reply: '=response.body' })`, or read it with
1380
+ * `taskOutput(stage, task, 'body')`.
1381
+ *
1382
+ * An `=` value inside an object body sends the value it reads, not its text:
1383
+ * `body: { probe: '=vars.id' }` is written `=js:( {"probe":vars.id})`, and
1384
+ * `'=js:vars.n * 2'` becomes `(vars.n * 2)`.
1385
+ *
1386
+ * ```ts
1387
+ * t.httpRequest({ method: 'POST', url: 'https://postman-echo.com/post', body: { probe: '=vars.id' } })
1388
+ * .outputs({ echoResponse: '=response.body' })
1389
+ * ```
1390
+ *
1391
+ * @param spec - The method, the address (`url`, or `path` with a `connector`), and optional headers, query and body.
1392
+ * @returns This builder, so calls chain.
1393
+ */
1394
+ httpRequest(spec: CaseHttpRequestSpec): this;
1309
1395
  /**
1310
1396
  * Mark this task required, so its stage cannot complete without it.
1311
1397
  *
@@ -93,8 +93,16 @@ export function escalation(opts) {
93
93
  /**
94
94
  * An escalation recipient that is a single user.
95
95
  *
96
- * @param target - How the user is addressed, e.g. `'email'`.
97
- * @param value - The address itself, when `target` names a lookup rather than a value.
96
+ * The Designer saves a user as the tenant's id for them, with their email as
97
+ * `value`: `toUser('<user id>', 'manager@corp.com')`. `uip maestro case validate`
98
+ * also accepts the email itself as `target`: `toUser('manager@corp.com')`. A
99
+ * label such as `'email'` in `target` is neither, and `validate` does not
100
+ * report it. Until the id is known, write `toUser('<UNRESOLVED: … user id>', '<email>')`;
101
+ * `check` reports the marker (`ESCALATION_RECIPIENT_UNRESOLVED`).
102
+ *
103
+ * @param target - The user's tenant id (a GUID) or email, or an `<UNRESOLVED: …>` marker.
104
+ * @param value - The user's email, as the Designer shows it. Omitted, `value` is
105
+ * written as `target`.
98
106
  * @returns A recipient for an escalation's `notify` list.
99
107
  */
100
108
  export function toUser(target, value) {
@@ -108,7 +116,8 @@ export function toUser(target, value) {
108
116
  * group's name in `target` notifies nobody: `check` reports it, as
109
117
  * `uip maestro case validate` does (`CASE_MGMT_ESCALATION_RECIPIENT_LITERAL`),
110
118
  * and compile writes it as authored. Until the id is known, write the
111
- * marker `validate` accepts: `toGroup('<UNRESOLVED: Claims Leads group id>', 'Claims Leads')`.
119
+ * marker `validate` accepts: `toGroup('<UNRESOLVED: Claims Leads group id>', 'Claims Leads')`;
120
+ * `check` reports it (`ESCALATION_RECIPIENT_UNRESOLVED`) until the id is filled in.
112
121
  *
113
122
  * @param target - The group's tenant id (a GUID), or an `<UNRESOLVED: …>` marker.
114
123
  * @param value - The group's display name. Omitted, `value` is written as
@@ -213,6 +222,7 @@ class TaskBuilder {
213
222
  _action;
214
223
  _connector;
215
224
  _external;
225
+ _http;
216
226
  _timer;
217
227
  _waitConnector;
218
228
  _required;
@@ -476,6 +486,30 @@ class TaskBuilder {
476
486
  this._timer = spec;
477
487
  return this;
478
488
  }
489
+ /**
490
+ * An HTTP request through Integration Service's generic HTTP connector, the
491
+ * Case Designer's HTTP request task. The task writes four outputs, `code`,
492
+ * `headers`, `body` and `Error`; map one to a case variable with
493
+ * `.outputs({ reply: '=response.body' })`, or read it with
494
+ * `taskOutput(stage, task, 'body')`.
495
+ *
496
+ * An `=` value inside an object body sends the value it reads, not its text:
497
+ * `body: { probe: '=vars.id' }` is written `=js:( {"probe":vars.id})`, and
498
+ * `'=js:vars.n * 2'` becomes `(vars.n * 2)`.
499
+ *
500
+ * ```ts
501
+ * t.httpRequest({ method: 'POST', url: 'https://postman-echo.com/post', body: { probe: '=vars.id' } })
502
+ * .outputs({ echoResponse: '=response.body' })
503
+ * ```
504
+ *
505
+ * @param spec - The method, the address (`url`, or `path` with a `connector`), and optional headers, query and body.
506
+ * @returns This builder, so calls chain.
507
+ */
508
+ httpRequest(spec) {
509
+ this.setKind('http-request');
510
+ this._http = spec;
511
+ return this;
512
+ }
479
513
  /**
480
514
  * Mark this task required, so its stage cannot complete without it.
481
515
  *
@@ -664,7 +698,8 @@ class TaskBuilder {
664
698
  // more row after them, as `uip maestro case sdd convert` and `case splice`
665
699
  // write an SDD row `app_id -> postAppId`.
666
700
  const REF_IO = new Set(['process', 'agent', 'rpa', 'api-workflow', 'case-management', 'flow-process', 'function', 'business-rule']);
667
- const CONNECTOR_OUTPUTS = new Set(['connector', 'wait-for-connector']);
701
+ // An http-request task writes the activity's four outputs; an extract maps one to a variable.
702
+ const CONNECTOR_OUTPUTS = new Set(['connector', 'wait-for-connector', 'http-request']);
668
703
  if (this._inputs && !REF_IO.has(this._kind))
669
704
  throw new CompileRefusal('TASK_INPUTS_UNSUPPORTED', `task "${this._name}": .inputs() is only supported on reference-mode tasks (process/agent/rpa/api-workflow/case-management/flow-process/function/business-rule), not "${this._kind}". A connector task takes its inputs in .connector() / .waitForConnector().`);
670
705
  // Which rows a kind accepts depends on the row: an extract reads the task's
@@ -696,6 +731,7 @@ class TaskBuilder {
696
731
  action: this._action,
697
732
  connector: this._connector,
698
733
  external: this._external,
734
+ http: this._http,
699
735
  timer: this._timer,
700
736
  waitConnector: this._waitConnector,
701
737
  required: this._required,
@@ -3,6 +3,7 @@ import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS, authoredCaseVersion } from '
3
3
  import { schemaVersionRefusal } from '../schema-version.js';
4
4
  import { EQUALS_EXPR_DIALECT, checkConnectorLookups, checkConnectorResources, checkConnectorSchema, } from '../core/connector-checks.js';
5
5
  import { isConnectorPlaceholder } from './connector-placeholder.js';
6
+ import { httpRequestLint } from './http-request.js';
6
7
  import { checkRuleSemantics } from './check-rule-semantics.js';
7
8
  import { serialize } from './serialize.js';
8
9
  import { lintPlanFindings, planReport } from './plan-check/index.js';
@@ -207,6 +208,14 @@ export function check(built, opts = {}) {
207
208
  refStage(r, 'case-exit');
208
209
  refPlacement(r, 'case-exit', 'case-exit');
209
210
  }
211
+ // An HTTP request compile writes as authored but a person should fix (lint;
212
+ // what it cannot write is the serializer's, through collect mode).
213
+ for (const stage of built.stages)
214
+ for (const lane of stage.lanes)
215
+ for (const t of lane)
216
+ if (t.kind === 'http-request' && t.http)
217
+ for (const f of httpRequestLint(`HTTP request task "${t.name}"`, t.http))
218
+ diags.push({ level: 'error', code: f.code, message: f.message, ...(f.suggestion ? { suggestion: f.suggestion } : {}), where: t.name });
210
219
  checkRuleSemantics(built, diags);
211
220
  checkLibraryConnectors(built, opts, diags);
212
221
  diags.push(...serializerRefusals(built, opts, diags));
@@ -348,6 +357,19 @@ function checkSla(sla, where, diags) {
348
357
  });
349
358
  if (e.notify.length === 0)
350
359
  diags.push({ level: 'warning', code: 'ESCALATION_NO_RECIPIENTS', message: `${where}: an escalation notifies no one (empty notify).`, where });
360
+ // An `<UNRESOLVED: …>` target passes `validate` but names no one, so the
361
+ // escalation notifies nobody until the id is filled in.
362
+ for (const r of e.notify)
363
+ if (/^<UNRESOLVED:/.test(r.target.trim()))
364
+ diags.push({
365
+ level: 'warning',
366
+ code: 'ESCALATION_RECIPIENT_UNRESOLVED',
367
+ message: `${where}: an escalation recipient is still the marker ${JSON.stringify(r.target)}, so it notifies no one until the tenant id is filled in.`,
368
+ suggestion: r.scope === 'UserGroup'
369
+ ? "Put the group's tenant id in target: toGroup('<group id>', '<name>'). 'uip admin groups list --output json' lists them."
370
+ : "Put the user's tenant id or email in target: toUser('<user id or email>', '<email>').",
371
+ where,
372
+ });
351
373
  }
352
374
  }
353
375
  function isNilOrEmpty(value) {
@@ -0,0 +1,29 @@
1
+ /**
2
+ * case/decompile-http-request — the decompile half of the Case `http-request`
3
+ * task (`./http-request.ts` holds the shape compile writes). It lifts a saved
4
+ * task's `data` to the `.httpRequest()` spec that compiles back to it, and
5
+ * throws, naming the field, on anything a recompile would not write back.
6
+ * Decompile-side, so its refusals are plain Errors (FB017 scopes it out by name).
7
+ */
8
+ import type { CaseHttpRequestSpec } from './case-sdk.js';
9
+ /** What decompile needs from the plan around one task. */
10
+ export interface HttpRequestLiftRefs {
11
+ /** The root binding with this id, or undefined. */
12
+ binding(id: string): Record<string, unknown> | undefined;
13
+ /** The symbolic label a recompile names the root binding `id` by. */
14
+ label(id: string): string;
15
+ }
16
+ /**
17
+ * The `.httpRequest()` spec a saved `http-request` task's `data` lifts to, or a
18
+ * thrown Error naming what a recompile would not write back. The `metadata`
19
+ * entry is not lifted: compile writes `HTTP_REQUEST_METADATA` (`./http-request.ts`),
20
+ * and a saved body that differs from it (another connector version) is carried
21
+ * through preservation (`httpRequestMetadata`), so a round trip keeps it.
22
+ */
23
+ export declare function liftHttpRequest(owner: string, data: Record<string, unknown>, refs: HttpRequestLiftRefs): CaseHttpRequestSpec;
24
+ /** One of the activity's own output rows, which compile writes itself; a custom row is never one. */
25
+ export declare function isHttpRequestOwnOutput(row: {
26
+ custom?: unknown;
27
+ name?: unknown;
28
+ source?: unknown;
29
+ }): boolean;
@@ -0,0 +1,120 @@
1
+ import { MANAGED_HTTP_CONNECTOR_KEY, MANAGED_HTTP_ENDPOINT, MANAGED_HTTP_ENDPOINT_METHOD, MANAGED_HTTP_OBJECT_NAME, } from '../core/managed-http.js';
2
+ import { HTTP_REQUEST_CONTEXT, HTTP_REQUEST_IMPLICIT_CONNECTION, HTTP_REQUEST_OUTPUTS, HTTP_REQUEST_SERVICE_TYPE, httpRequestBodySource, } from './http-request.js';
3
+ /** The `body` request keys compile writes; decompile lifts exactly these. */
4
+ const REQUEST_KEYS = new Set(['authentication', 'targetConnector', 'method', 'url', 'path', 'headers', 'query', 'requestBodyType', 'body']);
5
+ /**
6
+ * The `.httpRequest()` spec a saved `http-request` task's `data` lifts to, or a
7
+ * thrown Error naming what a recompile would not write back. The `metadata`
8
+ * entry is not lifted: compile writes `HTTP_REQUEST_METADATA` (`./http-request.ts`),
9
+ * and a saved body that differs from it (another connector version) is carried
10
+ * through preservation (`httpRequestMetadata`), so a round trip keeps it.
11
+ */
12
+ export function liftHttpRequest(owner, data, refs) {
13
+ const fail = (why) => {
14
+ throw new Error(`${owner} ${why}`);
15
+ };
16
+ const unknownData = Object.keys(data).find((k) => !['serviceType', 'context', 'inputs', 'outputs', 'bindings'].includes(k));
17
+ if (unknownData)
18
+ fail(`has unsupported data field "${unknownData}".`);
19
+ if (data.serviceType !== HTTP_REQUEST_SERVICE_TYPE)
20
+ fail(`has serviceType ${JSON.stringify(data.serviceType ?? null)}; an HTTP request task is "${HTTP_REQUEST_SERVICE_TYPE}".`);
21
+ const context = Array.isArray(data.context) ? data.context : fail('has no context array.');
22
+ const names = context.map((row) => String(row?.name ?? ''));
23
+ const odd = names.find((n, at) => !HTTP_REQUEST_CONTEXT.includes(n) || names.indexOf(n) !== at);
24
+ if (odd !== undefined)
25
+ fail(`has unsupported or repeated context row "${odd}".`);
26
+ const absent = HTTP_REQUEST_CONTEXT.find((n) => !names.includes(n));
27
+ if (absent)
28
+ fail(`is missing context row "${absent}".`);
29
+ const value = (name) => context.find((row) => row.name === name)?.value;
30
+ const fixed = {
31
+ connectorKey: MANAGED_HTTP_CONNECTOR_KEY, method: MANAGED_HTTP_ENDPOINT_METHOD, path: MANAGED_HTTP_ENDPOINT,
32
+ objectName: MANAGED_HTTP_OBJECT_NAME, activityConfigurationVersion: 'v2',
33
+ };
34
+ for (const [name, expected] of Object.entries(fixed))
35
+ if (value(name) !== expected)
36
+ fail(`has context ${name} ${JSON.stringify(value(name) ?? null)}; the HTTP request activity's is "${expected}".`);
37
+ const bindingId = (name) => {
38
+ const v = value(name);
39
+ if (typeof v !== 'string' || !v.startsWith('=bindings.'))
40
+ fail(`context ${name} must reference a root binding.`);
41
+ const id = String(v).slice('=bindings.'.length);
42
+ if (!refs.binding(id))
43
+ fail(`context ${name} references missing root binding "${id}".`);
44
+ return id;
45
+ };
46
+ const inputs = Array.isArray(data.inputs) ? data.inputs : fail('has no inputs array.');
47
+ const inputNames = inputs.map((row) => String(row?.name ?? ''));
48
+ if (inputNames.join(',') !== 'pathParameters,queryParameters,body')
49
+ fail(`has inputs ${JSON.stringify(inputNames)}; an HTTP request task has pathParameters, queryParameters and body.`);
50
+ for (const container of inputs.slice(0, 2)) {
51
+ const b = container.body;
52
+ if (b !== undefined && !(typeof b === 'object' && b !== null && Object.keys(b).length === 0))
53
+ fail(`carries a value in its ${String(container.name)} input, which the activity does not read; the request is in body.`);
54
+ }
55
+ const request = inputs[2].body;
56
+ if (typeof request !== 'object' || request === null || Array.isArray(request))
57
+ fail('has no request in its body input.');
58
+ const r = request;
59
+ const unknownKey = Object.keys(r).find((k) => !REQUEST_KEYS.has(k));
60
+ if (unknownKey)
61
+ fail(`request has unsupported field "${unknownKey}".`);
62
+ const taskBindings = Array.isArray(data.bindings) ? data.bindings : [];
63
+ const spec = { method: r.method };
64
+ if (r.authentication === 'connector') {
65
+ if (typeof r.targetConnector !== 'string' || !r.targetConnector)
66
+ fail('reuses a connector but names no targetConnector.');
67
+ if (r.url !== undefined)
68
+ fail('reuses a connector but carries url; a connector request reads path.');
69
+ if (r.requestBodyType !== undefined)
70
+ fail('reuses a connector but carries requestBodyType, which only a manual request writes.');
71
+ const connection = bindingId('connection');
72
+ const folder = bindingId('folderKey');
73
+ // The Designer carries the pair on the task too; a recompile writes exactly those two.
74
+ const mirrored = taskBindings.length === 2
75
+ && [connection, folder].every((id) => taskBindings.some((row) => row.id === id && JSON.stringify(row) === JSON.stringify(refs.binding(id))));
76
+ if (!mirrored)
77
+ fail('task bindings are not the connection and folder rows its context names.');
78
+ if (value('resourceKey') !== refs.binding(connection)?.resourceKey)
79
+ fail(`context resourceKey ${JSON.stringify(value('resourceKey') ?? null)} is not its connection binding's.`);
80
+ spec.connector = { key: String(r.targetConnector), connection: refs.label(connection), folder: refs.label(folder) };
81
+ if (r.path !== undefined)
82
+ spec.path = String(r.path);
83
+ }
84
+ else if (r.authentication === 'manual') {
85
+ if (r.targetConnector !== undefined || r.path !== undefined)
86
+ fail('is a manual request but carries targetConnector or path.');
87
+ if (refs.binding(bindingId('connection'))?.resourceKey !== HTTP_REQUEST_IMPLICIT_CONNECTION)
88
+ fail(`is a manual request whose connection binding is not "${HTTP_REQUEST_IMPLICIT_CONNECTION}".`);
89
+ if (value('resourceKey') !== null || value('folderKey') !== null)
90
+ fail('is a manual request but its context carries a resourceKey or folderKey.');
91
+ if (taskBindings.length)
92
+ fail('is a manual request but carries task bindings.');
93
+ if (r.url !== undefined)
94
+ spec.url = String(r.url);
95
+ }
96
+ else
97
+ fail(`has authentication ${JSON.stringify(r.authentication ?? null)}; it is "manual" or "connector".`);
98
+ if (r.headers !== undefined)
99
+ spec.headers = r.headers;
100
+ if (r.query !== undefined)
101
+ spec.query = r.query;
102
+ if (r.body !== undefined) {
103
+ if (typeof r.body !== 'string')
104
+ fail('request body must be text.');
105
+ if ((r.requestBodyType === 'raw') !== (spec.connector === undefined))
106
+ fail('request body\'s requestBodyType does not match its mode: a manual request writes "raw", a connector request none.');
107
+ spec.body = httpRequestBodySource(String(r.body));
108
+ }
109
+ else if (r.requestBodyType !== undefined)
110
+ fail('carries requestBodyType with no body.');
111
+ const outputs = Array.isArray(data.outputs) ? data.outputs : [];
112
+ const own = outputs.filter((o) => o.custom !== true).map((o) => String(o.name));
113
+ if (own.join(',') !== HTTP_REQUEST_OUTPUTS.map((o) => o.name).join(','))
114
+ fail(`has outputs ${JSON.stringify(own)}; an HTTP request task writes ${HTTP_REQUEST_OUTPUTS.map((o) => o.name).join(', ')}, in that order.`);
115
+ return spec;
116
+ }
117
+ /** One of the activity's own output rows, which compile writes itself; a custom row is never one. */
118
+ export function isHttpRequestOwnOutput(row) {
119
+ return row.custom !== true && HTTP_REQUEST_OUTPUTS.some((o) => o.name === row.name && o.source === row.source);
120
+ }
@@ -262,6 +262,12 @@ type Preservation = {
262
262
  optionalConfiguration: Record<string, unknown>;
263
263
  cachedFieldValues: Record<string, unknown>;
264
264
  }>;
265
+ httpRequestMetadata?: Array<{
266
+ stage: string;
267
+ lane: number;
268
+ task: string;
269
+ metadata: Record<string, unknown>;
270
+ }>;
265
271
  subscriptionFilters?: Array<{
266
272
  owner: string;
267
273
  expression?: 'inline';
@@ -3,6 +3,8 @@ import { cachedFieldValues, connectorTaskIdentity, savedOptionalConfiguration }
3
3
  import { commentText } from '../core/comment-text.js';
4
4
  import { implicitInArgTrigger } from './in-arg-binding.js';
5
5
  import { tsLiteral, tsNumber } from '../core/ts-literal.js';
6
+ import { isHttpRequestOwnOutput, liftHttpRequest } from './decompile-http-request.js';
7
+ import { savedHttpRequestMetadata } from './http-request.js';
6
8
  import { CASE_FORMAT_PROFILE, CASE_SCHEMA_VERSIONS } from './format-profile.js';
7
9
  import { EXTERNAL_TASK_CONTEXT, EXTERNAL_TASK_EVENT_CONTEXT, externalDescriptorRefusal, externalEventRefusal, externalServiceType, isExternalExecutionMode, libraryExecution } from './external.js';
8
10
  import { preserveSchemaVersion } from '../schema-version.js';
@@ -1092,6 +1094,13 @@ function emitTaskKind(task, refs, library) {
1092
1094
  }
1093
1095
  if (kind === 'execute-connector-activity')
1094
1096
  return connectorCall(task, refs, library);
1097
+ if (kind === 'http-request') {
1098
+ const spec = liftHttpRequest(`http-request task "${task.displayName ?? task.id ?? '?'}"`, (data ?? {}), {
1099
+ binding: (id) => refs.bindingById.get(id),
1100
+ label: (id) => bindingLabel(refs, id),
1101
+ });
1102
+ return `.httpRequest(${tsLiteral(spec)})`;
1103
+ }
1095
1104
  if (kind === 'external-agent' || kind === 'external-workflow')
1096
1105
  return externalCall(task, refs, library);
1097
1106
  if (kind === 'wait-for-timer') {
@@ -1319,6 +1328,12 @@ function taskOutputRows(task) {
1319
1328
  plan = customOnly(actionFormOutputs(task));
1320
1329
  else if (kind === 'wait-for-timer')
1321
1330
  plan = customOnly([]);
1331
+ // An HTTP request writes its four rows itself; a row it maps to a case variable is lifted too.
1332
+ else if (kind === 'http-request')
1333
+ plan = {
1334
+ lifted: rows.filter((row) => row.custom === true || (isHttpRequestOwnOutput(row) && row.var !== row.id)),
1335
+ rebuilt: rows.filter(isHttpRequestOwnOutput),
1336
+ };
1322
1337
  else if (kind === 'external-agent' || kind === 'external-workflow')
1323
1338
  plan = customOnly(rows.filter(isConnectorOwnOutput));
1324
1339
  else
@@ -2280,6 +2295,7 @@ export function collectPreservation(plan) {
2280
2295
  ]);
2281
2296
  const taskFields = [];
2282
2297
  const connectorConfigurations = [];
2298
+ const httpRequestMetadata = [];
2283
2299
  const omitTaskElementIds = [];
2284
2300
  const actionDataFields = [];
2285
2301
  const omitStagePositions = [];
@@ -2338,12 +2354,19 @@ export function collectPreservation(plan) {
2338
2354
  stage: label, lane: laneIndex, task: task.displayName ?? '', connector, optionalConfiguration,
2339
2355
  cachedFieldValues: cachedFieldValues(task, optionalConfiguration),
2340
2356
  });
2357
+ // An http-request task's metadata from another connector version than the
2358
+ // vendored copy compile writes: carried, so the round trip keeps it.
2359
+ const metadata = task.type === 'http-request' ? savedHttpRequestMetadata(task.data) : undefined;
2360
+ if (metadata)
2361
+ httpRequestMetadata.push({ stage: label, lane: laneIndex, task: task.displayName ?? '', metadata });
2341
2362
  }));
2342
2363
  }
2343
2364
  if (taskFields.length)
2344
2365
  preservation.taskFields = taskFields;
2345
2366
  if (connectorConfigurations.length)
2346
2367
  preservation.connectorConfigurations = connectorConfigurations;
2368
+ if (httpRequestMetadata.length)
2369
+ preservation.httpRequestMetadata = httpRequestMetadata;
2347
2370
  const subscriptionFilterEntries = preservedSubscriptionFilters(plan);
2348
2371
  if (subscriptionFilterEntries.length)
2349
2372
  preservation.subscriptionFilters = subscriptionFilterEntries;