@usearazzo/runner 1.0.1-alpha.30 → 1.0.1-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/arazzo-runner.browser.js +62 -27
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +4 -4
- package/src/errors/ExecutionError.cjs +1 -1
- package/src/errors/ExecutionError.mjs +1 -1
- package/src/executor/OpenAPIOperationExecutor.cjs +13 -6
- package/src/executor/OpenAPIOperationExecutor.mjs +14 -7
- package/src/executor/StepExecutor.cjs +8 -4
- package/src/executor/StepExecutor.mjs +8 -4
- package/src/executor/WorkflowExecutor.cjs +40 -16
- package/src/executor/WorkflowExecutor.mjs +40 -16
- package/types/runner.d.ts +22 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usearazzo/runner",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.32",
|
|
4
4
|
"description": "Runner for Arazzo Workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arazzo",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"@swaggerexpert/json-pointer": "^3.0.2",
|
|
74
74
|
"@swaggerexpert/jsonpath": "^4.0.5",
|
|
75
75
|
"@swaggerexpert/media-types": "^1.0.2",
|
|
76
|
-
"@usearazzo/parser": "1.0.1-alpha.
|
|
77
|
-
"@usearazzo/resolver": "1.0.1-alpha.
|
|
76
|
+
"@usearazzo/parser": "1.0.1-alpha.32",
|
|
77
|
+
"@usearazzo/resolver": "1.0.1-alpha.32",
|
|
78
78
|
"@xmldom/xmldom": "^0.9.12",
|
|
79
79
|
"fontoxpath": "^3.34.0",
|
|
80
80
|
"ramda": "^0.32.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"swagger-client": "^3.39.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "e19832b62ed4a938f9fdbd4c9072a94a247254d0"
|
|
98
98
|
}
|
|
@@ -17,7 +17,7 @@ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs
|
|
|
17
17
|
class ExecutionError extends _ArazzoRunnerError.default {
|
|
18
18
|
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
19
19
|
static Aborted = 'aborted';
|
|
20
|
-
/**
|
|
20
|
+
/** A step without an `executeOptions` entry of its own reaches a document that several entries configure. */
|
|
21
21
|
static AmbiguousExecuteOptions = 'ambiguous-execute-options';
|
|
22
22
|
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
23
23
|
static AmbiguousTarget = 'ambiguous-target';
|
|
@@ -10,7 +10,7 @@ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
|
|
|
10
10
|
class ExecutionError extends ArazzoRunnerError {
|
|
11
11
|
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
12
12
|
static Aborted = 'aborted';
|
|
13
|
-
/**
|
|
13
|
+
/** A step without an `executeOptions` entry of its own reaches a document that several entries configure. */
|
|
14
14
|
static AmbiguousExecuteOptions = 'ambiguous-execute-options';
|
|
15
15
|
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
16
16
|
static AmbiguousTarget = 'ambiguous-target';
|
|
@@ -658,12 +658,19 @@ class OpenAPIOperationExecutor {
|
|
|
658
658
|
finalized = (await this.#requestInterceptor?.(finalized, context)) ?? finalized;
|
|
659
659
|
finalized = (await perCallInterceptor?.(finalized, context)) ?? finalized;
|
|
660
660
|
|
|
661
|
-
// for multipart/form-data, remove the
|
|
662
|
-
//
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
661
|
+
// for multipart/form-data, remove the content-type so the transport sets
|
|
662
|
+
// one carrying the boundary of the FormData it encodes. one that names a
|
|
663
|
+
// boundary is kept when the body is not a FormData: whoever built that
|
|
664
|
+
// body chose the boundary
|
|
665
|
+
const encodedByTransport = finalized.body instanceof FormData;
|
|
666
|
+
for (const name of Object.keys(finalized.headers)) {
|
|
667
|
+
const contentType = finalized.headers[name];
|
|
668
|
+
if (name.toLowerCase() !== 'content-type' || typeof contentType !== 'string') continue;
|
|
669
|
+
if (!/multipart\/form-data/i.test(contentType)) continue;
|
|
670
|
+
const boundary = (0, _mediaTypes.parse)(contentType, {
|
|
671
|
+
type: 'media-type'
|
|
672
|
+
}).tree?.parameters.boundary;
|
|
673
|
+
if (encodedByTransport || !boundary?.trim()) delete finalized.headers[name];
|
|
667
674
|
}
|
|
668
675
|
return finalized;
|
|
669
676
|
}
|
|
@@ -4,7 +4,7 @@ import { isArrayElement, isObjectElement } from '@speclynx/apidom-datamodel';
|
|
|
4
4
|
import { url as urlUtils } from '@speclynx/apidom-reference/configuration/empty';
|
|
5
5
|
import { isSwaggerElement, isParameterElement } from '@speclynx/apidom-ns-openapi-2';
|
|
6
6
|
import { serializeCookie, cookieNameLenientValidator, cookieValueStrictPercentEncoder } from '@swaggerexpert/cookie';
|
|
7
|
-
import { identify, matches, selectBestMatch } from '@swaggerexpert/media-types';
|
|
7
|
+
import { identify, matches, parse, selectBestMatch } from '@swaggerexpert/media-types';
|
|
8
8
|
import { isPlainObject } from 'ramda-adjunct';
|
|
9
9
|
|
|
10
10
|
// @ts-expect-error vendored swagger-client bundle has no type declarations
|
|
@@ -646,12 +646,19 @@ class OpenAPIOperationExecutor {
|
|
|
646
646
|
finalized = (await this.#requestInterceptor?.(finalized, context)) ?? finalized;
|
|
647
647
|
finalized = (await perCallInterceptor?.(finalized, context)) ?? finalized;
|
|
648
648
|
|
|
649
|
-
// for multipart/form-data, remove the
|
|
650
|
-
//
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
649
|
+
// for multipart/form-data, remove the content-type so the transport sets
|
|
650
|
+
// one carrying the boundary of the FormData it encodes. one that names a
|
|
651
|
+
// boundary is kept when the body is not a FormData: whoever built that
|
|
652
|
+
// body chose the boundary
|
|
653
|
+
const encodedByTransport = finalized.body instanceof FormData;
|
|
654
|
+
for (const name of Object.keys(finalized.headers)) {
|
|
655
|
+
const contentType = finalized.headers[name];
|
|
656
|
+
if (name.toLowerCase() !== 'content-type' || typeof contentType !== 'string') continue;
|
|
657
|
+
if (!/multipart\/form-data/i.test(contentType)) continue;
|
|
658
|
+
const boundary = parse(contentType, {
|
|
659
|
+
type: 'media-type'
|
|
660
|
+
}).tree?.parameters.boundary;
|
|
661
|
+
if (encodedByTransport || !boundary?.trim()) delete finalized.headers[name];
|
|
655
662
|
}
|
|
656
663
|
return finalized;
|
|
657
664
|
}
|
|
@@ -68,7 +68,7 @@ const STEP_TARGET_FIELDS = exports.STEP_TARGET_FIELDS = ['operationId', 'operati
|
|
|
68
68
|
/**
|
|
69
69
|
* The execute options of a step: the opaque bag forwarded to the operation
|
|
70
70
|
* executor, or a function returning it for the operation the step was located
|
|
71
|
-
* to.
|
|
71
|
+
* to, called with the step it is located for.
|
|
72
72
|
* @public
|
|
73
73
|
*/
|
|
74
74
|
|
|
@@ -135,8 +135,8 @@ class StepExecutor {
|
|
|
135
135
|
* (e.g. a `server` to run the step against, or an `AbortSignal`). The
|
|
136
136
|
* Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
|
|
137
137
|
* take precedence over it. A function is called with the operation the step
|
|
138
|
-
* was located to and
|
|
139
|
-
* the step calls.
|
|
138
|
+
* was located to and the step's `stepId` / `workflowId`, and returns the bag,
|
|
139
|
+
* for options that depend on which API the step calls.
|
|
140
140
|
*
|
|
141
141
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
142
142
|
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
@@ -178,7 +178,11 @@ class StepExecutor {
|
|
|
178
178
|
// Pointer) locator that the operation executor extracts, normalizes,
|
|
179
179
|
// assembles into a standalone doc, and runs.
|
|
180
180
|
const locator = await this.#locateOperation(step, scope);
|
|
181
|
-
const operationOptions =
|
|
181
|
+
const operationOptions =
|
|
182
|
+
// a copy, so the function cannot rewrite the scope this step attributes its errors to
|
|
183
|
+
typeof executeOptions === 'function' ? executeOptions(locator, {
|
|
184
|
+
...scope
|
|
185
|
+
}) : executeOptions;
|
|
182
186
|
|
|
183
187
|
// resolve parameters and request body against the pre-request context.
|
|
184
188
|
// keyed by '{in}.{name}' rather than bare name, so two parameters that
|
|
@@ -61,7 +61,7 @@ export const STEP_TARGET_FIELDS = ['operationId', 'operationPath', 'workflowId']
|
|
|
61
61
|
/**
|
|
62
62
|
* The execute options of a step: the opaque bag forwarded to the operation
|
|
63
63
|
* executor, or a function returning it for the operation the step was located
|
|
64
|
-
* to.
|
|
64
|
+
* to, called with the step it is located for.
|
|
65
65
|
* @public
|
|
66
66
|
*/
|
|
67
67
|
|
|
@@ -128,8 +128,8 @@ class StepExecutor {
|
|
|
128
128
|
* (e.g. a `server` to run the step against, or an `AbortSignal`). The
|
|
129
129
|
* Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
|
|
130
130
|
* take precedence over it. A function is called with the operation the step
|
|
131
|
-
* was located to and
|
|
132
|
-
* the step calls.
|
|
131
|
+
* was located to and the step's `stepId` / `workflowId`, and returns the bag,
|
|
132
|
+
* for options that depend on which API the step calls.
|
|
133
133
|
*
|
|
134
134
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
135
135
|
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
@@ -171,7 +171,11 @@ class StepExecutor {
|
|
|
171
171
|
// Pointer) locator that the operation executor extracts, normalizes,
|
|
172
172
|
// assembles into a standalone doc, and runs.
|
|
173
173
|
const locator = await this.#locateOperation(step, scope);
|
|
174
|
-
const operationOptions =
|
|
174
|
+
const operationOptions =
|
|
175
|
+
// a copy, so the function cannot rewrite the scope this step attributes its errors to
|
|
176
|
+
typeof executeOptions === 'function' ? executeOptions(locator, {
|
|
177
|
+
...scope
|
|
178
|
+
}) : executeOptions;
|
|
175
179
|
|
|
176
180
|
// resolve parameters and request body against the pre-request context.
|
|
177
181
|
// keyed by '{in}.{name}' rather than bare name, so two parameters that
|
|
@@ -101,6 +101,11 @@ function settledResult(result) {
|
|
|
101
101
|
* given — see {@link RunScope.dependencyRuns}.
|
|
102
102
|
*/
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* One `executeOptions` entry and the canonical URI of the document its name
|
|
106
|
+
* points at.
|
|
107
|
+
*/
|
|
108
|
+
|
|
104
109
|
/**
|
|
105
110
|
* The state shared by every workflow invocation of a single
|
|
106
111
|
* {@link WorkflowExecutor.execute} call — the caller's per-run options plus the
|
|
@@ -201,7 +206,7 @@ class WorkflowExecutor {
|
|
|
201
206
|
const {
|
|
202
207
|
signal
|
|
203
208
|
} = options;
|
|
204
|
-
const executeOptions = this.#
|
|
209
|
+
const executeOptions = this.#executeOptionsByName(options.executeOptions ?? {});
|
|
205
210
|
const scope = {
|
|
206
211
|
// the signal is put into every step's opaque bag, because that bag is
|
|
207
212
|
// how anything reaches the transport: the executor's own checks stop the
|
|
@@ -209,8 +214,8 @@ class WorkflowExecutor {
|
|
|
209
214
|
// in flight. Set even when absent, so a `signal` in an entry never
|
|
210
215
|
// stands in for it: that one would cancel the steps of a single API and
|
|
211
216
|
// leave the run walking on.
|
|
212
|
-
executeOptions: locator => ({
|
|
213
|
-
...executeOptions
|
|
217
|
+
executeOptions: (locator, step) => ({
|
|
218
|
+
...this.#executeOptionsFor(executeOptions, locator, step),
|
|
214
219
|
signal
|
|
215
220
|
}),
|
|
216
221
|
dependencyInputs: options.dependencyInputs ?? {},
|
|
@@ -232,16 +237,15 @@ class WorkflowExecutor {
|
|
|
232
237
|
}
|
|
233
238
|
|
|
234
239
|
/**
|
|
235
|
-
* Resolves
|
|
236
|
-
* keyed by
|
|
240
|
+
* Resolves each `executeOptions` entry to the canonical URI of the document
|
|
241
|
+
* its name points at, keyed by name.
|
|
237
242
|
*
|
|
238
|
-
* Every way an entry can fail to name
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* failed.
|
|
243
|
+
* Every way an entry can fail to name an OpenAPI document throws here,
|
|
244
|
+
* before the run starts: sent to no API, its options would be missing with
|
|
245
|
+
* nothing to show for it until a request failed.
|
|
242
246
|
*/
|
|
243
|
-
#
|
|
244
|
-
const
|
|
247
|
+
#executeOptionsByName(executeOptions) {
|
|
248
|
+
const byName = new Map();
|
|
245
249
|
const fail = (name, problem, reason) => {
|
|
246
250
|
throw new _ExecutionError.default(`executeOptions is keyed by source description name, and "${name}" ${problem}`, {
|
|
247
251
|
reason
|
|
@@ -258,12 +262,32 @@ class WorkflowExecutor {
|
|
|
258
262
|
if (!(0, _ramdaAdjunct.isPlainObject)(options)) {
|
|
259
263
|
fail(name, 'is not given an object of options', _ExecutionError.default.UnknownExecuteOption);
|
|
260
264
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
+
byName.set(name, {
|
|
266
|
+
uri,
|
|
267
|
+
options
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return byName;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* The entry for the step's operation: the entry of the name the step reached
|
|
275
|
+
* it through, when that is a name of the entry document with an entry;
|
|
276
|
+
* otherwise the one entry configuring the operation's document, if any.
|
|
277
|
+
*/
|
|
278
|
+
#executeOptionsFor(entries, locator, step) {
|
|
279
|
+
const source = locator.sourceDescription;
|
|
280
|
+
const named = source?.documentURI === this.#document.uri ? entries.get(source.name) : undefined;
|
|
281
|
+
if (named !== undefined) return named.options;
|
|
282
|
+
const configuring = [...entries].filter(([, entry]) => entry.uri === locator.document.uri);
|
|
283
|
+
if (configuring.length > 1) {
|
|
284
|
+
const names = configuring.map(([name]) => `"${name}"`).join(', ');
|
|
285
|
+
throw new _ExecutionError.default(`Step "${step.stepId}" has no executeOptions entry of its own, and ${names} all configure "${locator.document.uri}", the document it calls`, {
|
|
286
|
+
...step,
|
|
287
|
+
reason: _ExecutionError.default.AmbiguousExecuteOptions
|
|
288
|
+
});
|
|
265
289
|
}
|
|
266
|
-
return
|
|
290
|
+
return configuring[0]?.[1].options;
|
|
267
291
|
}
|
|
268
292
|
|
|
269
293
|
/**
|
|
@@ -87,6 +87,11 @@ export function settledResult(result) {
|
|
|
87
87
|
* given — see {@link RunScope.dependencyRuns}.
|
|
88
88
|
*/
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* One `executeOptions` entry and the canonical URI of the document its name
|
|
92
|
+
* points at.
|
|
93
|
+
*/
|
|
94
|
+
|
|
90
95
|
/**
|
|
91
96
|
* The state shared by every workflow invocation of a single
|
|
92
97
|
* {@link WorkflowExecutor.execute} call — the caller's per-run options plus the
|
|
@@ -187,7 +192,7 @@ class WorkflowExecutor {
|
|
|
187
192
|
const {
|
|
188
193
|
signal
|
|
189
194
|
} = options;
|
|
190
|
-
const executeOptions = this.#
|
|
195
|
+
const executeOptions = this.#executeOptionsByName(options.executeOptions ?? {});
|
|
191
196
|
const scope = {
|
|
192
197
|
// the signal is put into every step's opaque bag, because that bag is
|
|
193
198
|
// how anything reaches the transport: the executor's own checks stop the
|
|
@@ -195,8 +200,8 @@ class WorkflowExecutor {
|
|
|
195
200
|
// in flight. Set even when absent, so a `signal` in an entry never
|
|
196
201
|
// stands in for it: that one would cancel the steps of a single API and
|
|
197
202
|
// leave the run walking on.
|
|
198
|
-
executeOptions: locator => ({
|
|
199
|
-
...executeOptions
|
|
203
|
+
executeOptions: (locator, step) => ({
|
|
204
|
+
...this.#executeOptionsFor(executeOptions, locator, step),
|
|
200
205
|
signal
|
|
201
206
|
}),
|
|
202
207
|
dependencyInputs: options.dependencyInputs ?? {},
|
|
@@ -218,16 +223,15 @@ class WorkflowExecutor {
|
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
/**
|
|
221
|
-
* Resolves
|
|
222
|
-
* keyed by
|
|
226
|
+
* Resolves each `executeOptions` entry to the canonical URI of the document
|
|
227
|
+
* its name points at, keyed by name.
|
|
223
228
|
*
|
|
224
|
-
* Every way an entry can fail to name
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* failed.
|
|
229
|
+
* Every way an entry can fail to name an OpenAPI document throws here,
|
|
230
|
+
* before the run starts: sent to no API, its options would be missing with
|
|
231
|
+
* nothing to show for it until a request failed.
|
|
228
232
|
*/
|
|
229
|
-
#
|
|
230
|
-
const
|
|
233
|
+
#executeOptionsByName(executeOptions) {
|
|
234
|
+
const byName = new Map();
|
|
231
235
|
const fail = (name, problem, reason) => {
|
|
232
236
|
throw new ExecutionError(`executeOptions is keyed by source description name, and "${name}" ${problem}`, {
|
|
233
237
|
reason
|
|
@@ -244,12 +248,32 @@ class WorkflowExecutor {
|
|
|
244
248
|
if (!isPlainObject(options)) {
|
|
245
249
|
fail(name, 'is not given an object of options', ExecutionError.UnknownExecuteOption);
|
|
246
250
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
byName.set(name, {
|
|
252
|
+
uri,
|
|
253
|
+
options
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return byName;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* The entry for the step's operation: the entry of the name the step reached
|
|
261
|
+
* it through, when that is a name of the entry document with an entry;
|
|
262
|
+
* otherwise the one entry configuring the operation's document, if any.
|
|
263
|
+
*/
|
|
264
|
+
#executeOptionsFor(entries, locator, step) {
|
|
265
|
+
const source = locator.sourceDescription;
|
|
266
|
+
const named = source?.documentURI === this.#document.uri ? entries.get(source.name) : undefined;
|
|
267
|
+
if (named !== undefined) return named.options;
|
|
268
|
+
const configuring = [...entries].filter(([, entry]) => entry.uri === locator.document.uri);
|
|
269
|
+
if (configuring.length > 1) {
|
|
270
|
+
const names = configuring.map(([name]) => `"${name}"`).join(', ');
|
|
271
|
+
throw new ExecutionError(`Step "${step.stepId}" has no executeOptions entry of its own, and ${names} all configure "${locator.document.uri}", the document it calls`, {
|
|
272
|
+
...step,
|
|
273
|
+
reason: ExecutionError.AmbiguousExecuteOptions
|
|
274
|
+
});
|
|
251
275
|
}
|
|
252
|
-
return
|
|
276
|
+
return configuring[0]?.[1].options;
|
|
253
277
|
}
|
|
254
278
|
|
|
255
279
|
/**
|
package/types/runner.d.ts
CHANGED
|
@@ -816,7 +816,7 @@ export declare type DocumentRegistryProviderOptions = PartialDeep<ApiDOMReferenc
|
|
|
816
816
|
export declare class ExecutionError extends ArazzoRunnerError {
|
|
817
817
|
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
818
818
|
static readonly Aborted: "aborted";
|
|
819
|
-
/**
|
|
819
|
+
/** A step without an `executeOptions` entry of its own reaches a document that several entries configure. */
|
|
820
820
|
static readonly AmbiguousExecuteOptions: "ambiguous-execute-options";
|
|
821
821
|
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
822
822
|
static readonly AmbiguousTarget: "ambiguous-target";
|
|
@@ -904,7 +904,11 @@ export declare class ExtractionError extends ArazzoRunnerError {
|
|
|
904
904
|
* Arazzo outcome judged by a step's `successCriteria`, never an error;
|
|
905
905
|
* - throw (or reject) only on transport failure — the executor wraps the
|
|
906
906
|
* error as a `ClientError`;
|
|
907
|
-
* - honor `request.signal` when present
|
|
907
|
+
* - honor `request.signal` when present;
|
|
908
|
+
* - encode a `FormData` body as `multipart/form-data` and set the
|
|
909
|
+
* `Content-Type` with its boundary, as `fetch` does — the executor removes
|
|
910
|
+
* the request's own multipart `Content-Type` for such a body, since only the
|
|
911
|
+
* encoder knows the boundary.
|
|
908
912
|
*
|
|
909
913
|
* Response normalization (content-type dispatch, header mapping) happens on
|
|
910
914
|
* the executor side for every client, so `$response.body` semantics stay
|
|
@@ -2283,10 +2287,10 @@ export declare abstract class SourceDescriptionsLocatorNormalizer {
|
|
|
2283
2287
|
/**
|
|
2284
2288
|
* The execute options of a step: the opaque bag forwarded to the operation
|
|
2285
2289
|
* executor, or a function returning it for the operation the step was located
|
|
2286
|
-
* to.
|
|
2290
|
+
* to, called with the step it is located for.
|
|
2287
2291
|
* @public
|
|
2288
2292
|
*/
|
|
2289
|
-
export declare type StepExecuteOptions = Record<string, unknown> | ((locator: OpenAPIOperationLocator) => Record<string, unknown>);
|
|
2293
|
+
export declare type StepExecuteOptions = Record<string, unknown> | ((locator: OpenAPIOperationLocator, step: RequestContextStep) => Record<string, unknown>);
|
|
2290
2294
|
|
|
2291
2295
|
/**
|
|
2292
2296
|
* The outcome of executing a single step.
|
|
@@ -2375,8 +2379,8 @@ export declare class StepExecutor {
|
|
|
2375
2379
|
* (e.g. a `server` to run the step against, or an `AbortSignal`). The
|
|
2376
2380
|
* Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
|
|
2377
2381
|
* take precedence over it. A function is called with the operation the step
|
|
2378
|
-
* was located to and
|
|
2379
|
-
* the step calls.
|
|
2382
|
+
* was located to and the step's `stepId` / `workflowId`, and returns the bag,
|
|
2383
|
+
* for options that depend on which API the step calls.
|
|
2380
2384
|
*
|
|
2381
2385
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
2382
2386
|
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
@@ -2624,18 +2628,21 @@ export declare interface WorkflowExecuteOptions {
|
|
|
2624
2628
|
* Execute options addressed to an API: keyed by the `name` of a source
|
|
2625
2629
|
* description of the entry document, each entry the opaque client-specific
|
|
2626
2630
|
* bag forwarded verbatim to {@link StepExecutor.execute} for the steps that
|
|
2627
|
-
* call an operation
|
|
2628
|
-
*
|
|
2631
|
+
* call an operation through that source description (e.g. a `server` to run
|
|
2632
|
+
* against, or the credentials of its security schemes).
|
|
2629
2633
|
*
|
|
2630
|
-
* An entry configures a
|
|
2631
|
-
*
|
|
2632
|
-
*
|
|
2633
|
-
*
|
|
2634
|
+
* An entry configures a name, so two source descriptions pointing at the
|
|
2635
|
+
* same OpenAPI document can be configured apart. A step reaching its document
|
|
2636
|
+
* any other way — through a name without an entry, through a name of
|
|
2637
|
+
* another Arazzo document, or through a literal URL — gets the one entry
|
|
2638
|
+
* configuring that document; it gets nothing when no entry does, and throws
|
|
2639
|
+
* when several do, since nothing says which applies. That throw comes at the
|
|
2640
|
+
* step, so the steps before it have already run. Steps of an API without
|
|
2641
|
+
* an entry get no options.
|
|
2634
2642
|
*
|
|
2635
2643
|
* A key naming no source description, one naming a source description that
|
|
2636
|
-
* has no `url` or is not an OpenAPI document,
|
|
2637
|
-
*
|
|
2638
|
-
* request.
|
|
2644
|
+
* has no `url` or is not an OpenAPI document, and an entry that is not an
|
|
2645
|
+
* object all throw before the first request.
|
|
2639
2646
|
*/
|
|
2640
2647
|
readonly executeOptions?: Record<string, Record<string, unknown>>;
|
|
2641
2648
|
/**
|