@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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.1-alpha.32](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.31...v1.0.1-alpha.32) (2026-11-13)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **runner:** keep a multipart content type that names a boundary ([#353](https://github.com/usearazzo/arazzo-toolkit/issues/353)) ([22b0a56](https://github.com/usearazzo/arazzo-toolkit/commit/22b0a5615d9670acbe19f3614523fe2feec3a29b))
|
|
11
|
+
|
|
12
|
+
## [1.0.1-alpha.31](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.30...v1.0.1-alpha.31) (2026-11-13)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **runner:** key executeOptions by source description name ([#352](https://github.com/usearazzo/arazzo-toolkit/issues/352)) ([77c088b](https://github.com/usearazzo/arazzo-toolkit/commit/77c088b2fab85aaf035687aa56131c55cbe96e8f)), closes [#36](https://github.com/usearazzo/arazzo-toolkit/issues/36)
|
|
17
|
+
|
|
6
18
|
## [1.0.1-alpha.30](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.29...v1.0.1-alpha.30) (2026-11-13)
|
|
7
19
|
|
|
8
20
|
### Features
|
|
@@ -11188,7 +11188,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11188
11188
|
class ExecutionError extends _ArazzoRunnerError_ts__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
11189
11189
|
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
11190
11190
|
static Aborted = 'aborted';
|
|
11191
|
-
/**
|
|
11191
|
+
/** A step without an `executeOptions` entry of its own reaches a document that several entries configure. */
|
|
11192
11192
|
static AmbiguousExecuteOptions = 'ambiguous-execute-options';
|
|
11193
11193
|
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
11194
11194
|
static AmbiguousTarget = 'ambiguous-target';
|
|
@@ -12301,12 +12301,19 @@ class OpenAPIOperationExecutor {
|
|
|
12301
12301
|
finalized = (await this.#requestInterceptor?.(finalized, context)) ?? finalized;
|
|
12302
12302
|
finalized = (await perCallInterceptor?.(finalized, context)) ?? finalized;
|
|
12303
12303
|
|
|
12304
|
-
// for multipart/form-data, remove the
|
|
12305
|
-
//
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12304
|
+
// for multipart/form-data, remove the content-type so the transport sets
|
|
12305
|
+
// one carrying the boundary of the FormData it encodes. one that names a
|
|
12306
|
+
// boundary is kept when the body is not a FormData: whoever built that
|
|
12307
|
+
// body chose the boundary
|
|
12308
|
+
const encodedByTransport = finalized.body instanceof FormData;
|
|
12309
|
+
for (const name of Object.keys(finalized.headers)) {
|
|
12310
|
+
const contentType = finalized.headers[name];
|
|
12311
|
+
if (name.toLowerCase() !== 'content-type' || typeof contentType !== 'string') continue;
|
|
12312
|
+
if (!/multipart\/form-data/i.test(contentType)) continue;
|
|
12313
|
+
const boundary = (0,_swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_6__.parse)(contentType, {
|
|
12314
|
+
type: 'media-type'
|
|
12315
|
+
}).tree?.parameters.boundary;
|
|
12316
|
+
if (encodedByTransport || !boundary?.trim()) delete finalized.headers[name];
|
|
12310
12317
|
}
|
|
12311
12318
|
return finalized;
|
|
12312
12319
|
}
|
|
@@ -12723,7 +12730,7 @@ const STEP_TARGET_FIELDS = ['operationId', 'operationPath', 'workflowId'];
|
|
|
12723
12730
|
/**
|
|
12724
12731
|
* The execute options of a step: the opaque bag forwarded to the operation
|
|
12725
12732
|
* executor, or a function returning it for the operation the step was located
|
|
12726
|
-
* to.
|
|
12733
|
+
* to, called with the step it is located for.
|
|
12727
12734
|
* @public
|
|
12728
12735
|
*/
|
|
12729
12736
|
|
|
@@ -12790,8 +12797,8 @@ class StepExecutor {
|
|
|
12790
12797
|
* (e.g. a `server` to run the step against, or an `AbortSignal`). The
|
|
12791
12798
|
* Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
|
|
12792
12799
|
* take precedence over it. A function is called with the operation the step
|
|
12793
|
-
* was located to and
|
|
12794
|
-
* the step calls.
|
|
12800
|
+
* was located to and the step's `stepId` / `workflowId`, and returns the bag,
|
|
12801
|
+
* for options that depend on which API the step calls.
|
|
12795
12802
|
*
|
|
12796
12803
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
12797
12804
|
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
@@ -12833,7 +12840,11 @@ class StepExecutor {
|
|
|
12833
12840
|
// Pointer) locator that the operation executor extracts, normalizes,
|
|
12834
12841
|
// assembles into a standalone doc, and runs.
|
|
12835
12842
|
const locator = await this.#locateOperation(step, scope);
|
|
12836
|
-
const operationOptions =
|
|
12843
|
+
const operationOptions =
|
|
12844
|
+
// a copy, so the function cannot rewrite the scope this step attributes its errors to
|
|
12845
|
+
typeof executeOptions === 'function' ? executeOptions(locator, {
|
|
12846
|
+
...scope
|
|
12847
|
+
}) : executeOptions;
|
|
12837
12848
|
|
|
12838
12849
|
// resolve parameters and request body against the pre-request context.
|
|
12839
12850
|
// keyed by '{in}.{name}' rather than bare name, so two parameters that
|
|
@@ -13783,6 +13794,11 @@ function settledResult(result) {
|
|
|
13783
13794
|
* given — see {@link RunScope.dependencyRuns}.
|
|
13784
13795
|
*/
|
|
13785
13796
|
|
|
13797
|
+
/**
|
|
13798
|
+
* One `executeOptions` entry and the canonical URI of the document its name
|
|
13799
|
+
* points at.
|
|
13800
|
+
*/
|
|
13801
|
+
|
|
13786
13802
|
/**
|
|
13787
13803
|
* The state shared by every workflow invocation of a single
|
|
13788
13804
|
* {@link WorkflowExecutor.execute} call — the caller's per-run options plus the
|
|
@@ -13883,7 +13899,7 @@ class WorkflowExecutor {
|
|
|
13883
13899
|
const {
|
|
13884
13900
|
signal
|
|
13885
13901
|
} = options;
|
|
13886
|
-
const executeOptions = this.#
|
|
13902
|
+
const executeOptions = this.#executeOptionsByName(options.executeOptions ?? {});
|
|
13887
13903
|
const scope = {
|
|
13888
13904
|
// the signal is put into every step's opaque bag, because that bag is
|
|
13889
13905
|
// how anything reaches the transport: the executor's own checks stop the
|
|
@@ -13891,8 +13907,8 @@ class WorkflowExecutor {
|
|
|
13891
13907
|
// in flight. Set even when absent, so a `signal` in an entry never
|
|
13892
13908
|
// stands in for it: that one would cancel the steps of a single API and
|
|
13893
13909
|
// leave the run walking on.
|
|
13894
|
-
executeOptions: locator => ({
|
|
13895
|
-
...executeOptions
|
|
13910
|
+
executeOptions: (locator, step) => ({
|
|
13911
|
+
...this.#executeOptionsFor(executeOptions, locator, step),
|
|
13896
13912
|
signal
|
|
13897
13913
|
}),
|
|
13898
13914
|
dependencyInputs: options.dependencyInputs ?? {},
|
|
@@ -13914,16 +13930,15 @@ class WorkflowExecutor {
|
|
|
13914
13930
|
}
|
|
13915
13931
|
|
|
13916
13932
|
/**
|
|
13917
|
-
* Resolves
|
|
13918
|
-
* keyed by
|
|
13933
|
+
* Resolves each `executeOptions` entry to the canonical URI of the document
|
|
13934
|
+
* its name points at, keyed by name.
|
|
13919
13935
|
*
|
|
13920
|
-
* Every way an entry can fail to name
|
|
13921
|
-
*
|
|
13922
|
-
*
|
|
13923
|
-
* failed.
|
|
13936
|
+
* Every way an entry can fail to name an OpenAPI document throws here,
|
|
13937
|
+
* before the run starts: sent to no API, its options would be missing with
|
|
13938
|
+
* nothing to show for it until a request failed.
|
|
13924
13939
|
*/
|
|
13925
|
-
#
|
|
13926
|
-
const
|
|
13940
|
+
#executeOptionsByName(executeOptions) {
|
|
13941
|
+
const byName = new Map();
|
|
13927
13942
|
const fail = (name, problem, reason) => {
|
|
13928
13943
|
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`executeOptions is keyed by source description name, and "${name}" ${problem}`, {
|
|
13929
13944
|
reason
|
|
@@ -13940,12 +13955,32 @@ class WorkflowExecutor {
|
|
|
13940
13955
|
if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(options)) {
|
|
13941
13956
|
fail(name, 'is not given an object of options', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownExecuteOption);
|
|
13942
13957
|
}
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13958
|
+
byName.set(name, {
|
|
13959
|
+
uri,
|
|
13960
|
+
options
|
|
13961
|
+
});
|
|
13962
|
+
}
|
|
13963
|
+
return byName;
|
|
13964
|
+
}
|
|
13965
|
+
|
|
13966
|
+
/**
|
|
13967
|
+
* The entry for the step's operation: the entry of the name the step reached
|
|
13968
|
+
* it through, when that is a name of the entry document with an entry;
|
|
13969
|
+
* otherwise the one entry configuring the operation's document, if any.
|
|
13970
|
+
*/
|
|
13971
|
+
#executeOptionsFor(entries, locator, step) {
|
|
13972
|
+
const source = locator.sourceDescription;
|
|
13973
|
+
const named = source?.documentURI === this.#document.uri ? entries.get(source.name) : undefined;
|
|
13974
|
+
if (named !== undefined) return named.options;
|
|
13975
|
+
const configuring = [...entries].filter(([, entry]) => entry.uri === locator.document.uri);
|
|
13976
|
+
if (configuring.length > 1) {
|
|
13977
|
+
const names = configuring.map(([name]) => `"${name}"`).join(', ');
|
|
13978
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`Step "${step.stepId}" has no executeOptions entry of its own, and ${names} all configure "${locator.document.uri}", the document it calls`, {
|
|
13979
|
+
...step,
|
|
13980
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousExecuteOptions
|
|
13981
|
+
});
|
|
13947
13982
|
}
|
|
13948
|
-
return
|
|
13983
|
+
return configuring[0]?.[1].options;
|
|
13949
13984
|
}
|
|
13950
13985
|
|
|
13951
13986
|
/**
|