@usearazzo/runner 1.0.1-alpha.30 → 1.0.1-alpha.31

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 CHANGED
@@ -3,6 +3,12 @@
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.31](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.30...v1.0.1-alpha.31) (2026-11-13)
7
+
8
+ ### Features
9
+
10
+ - **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)
11
+
6
12
  ## [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
13
 
8
14
  ### 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
- /** Two `executeOptions` entries name source descriptions that point at the same document. */
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';
@@ -12723,7 +12723,7 @@ const STEP_TARGET_FIELDS = ['operationId', 'operationPath', 'workflowId'];
12723
12723
  /**
12724
12724
  * The execute options of a step: the opaque bag forwarded to the operation
12725
12725
  * executor, or a function returning it for the operation the step was located
12726
- * to.
12726
+ * to, called with the step it is located for.
12727
12727
  * @public
12728
12728
  */
12729
12729
 
@@ -12790,8 +12790,8 @@ class StepExecutor {
12790
12790
  * (e.g. a `server` to run the step against, or an `AbortSignal`). The
12791
12791
  * Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
12792
12792
  * take precedence over it. A function is called with the operation the step
12793
- * was located to and returns the bag, for options that depend on which API
12794
- * the step calls.
12793
+ * was located to and the step's `stepId` / `workflowId`, and returns the bag,
12794
+ * for options that depend on which API the step calls.
12795
12795
  *
12796
12796
  * A `signal` in that bag is honored here and not only at the transport: an
12797
12797
  * already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
@@ -12833,7 +12833,11 @@ class StepExecutor {
12833
12833
  // Pointer) locator that the operation executor extracts, normalizes,
12834
12834
  // assembles into a standalone doc, and runs.
12835
12835
  const locator = await this.#locateOperation(step, scope);
12836
- const operationOptions = typeof executeOptions === 'function' ? executeOptions(locator) : executeOptions;
12836
+ const operationOptions =
12837
+ // a copy, so the function cannot rewrite the scope this step attributes its errors to
12838
+ typeof executeOptions === 'function' ? executeOptions(locator, {
12839
+ ...scope
12840
+ }) : executeOptions;
12837
12841
 
12838
12842
  // resolve parameters and request body against the pre-request context.
12839
12843
  // keyed by '{in}.{name}' rather than bare name, so two parameters that
@@ -13783,6 +13787,11 @@ function settledResult(result) {
13783
13787
  * given — see {@link RunScope.dependencyRuns}.
13784
13788
  */
13785
13789
 
13790
+ /**
13791
+ * One `executeOptions` entry and the canonical URI of the document its name
13792
+ * points at.
13793
+ */
13794
+
13786
13795
  /**
13787
13796
  * The state shared by every workflow invocation of a single
13788
13797
  * {@link WorkflowExecutor.execute} call — the caller's per-run options plus the
@@ -13883,7 +13892,7 @@ class WorkflowExecutor {
13883
13892
  const {
13884
13893
  signal
13885
13894
  } = options;
13886
- const executeOptions = this.#executeOptionsByDocument(options.executeOptions ?? {});
13895
+ const executeOptions = this.#executeOptionsByName(options.executeOptions ?? {});
13887
13896
  const scope = {
13888
13897
  // the signal is put into every step's opaque bag, because that bag is
13889
13898
  // how anything reaches the transport: the executor's own checks stop the
@@ -13891,8 +13900,8 @@ class WorkflowExecutor {
13891
13900
  // in flight. Set even when absent, so a `signal` in an entry never
13892
13901
  // stands in for it: that one would cancel the steps of a single API and
13893
13902
  // leave the run walking on.
13894
- executeOptions: locator => ({
13895
- ...executeOptions.get(locator.document.uri),
13903
+ executeOptions: (locator, step) => ({
13904
+ ...this.#executeOptionsFor(executeOptions, locator, step),
13896
13905
  signal
13897
13906
  }),
13898
13907
  dependencyInputs: options.dependencyInputs ?? {},
@@ -13914,16 +13923,15 @@ class WorkflowExecutor {
13914
13923
  }
13915
13924
 
13916
13925
  /**
13917
- * Resolves the `executeOptions` entries to the documents they configure,
13918
- * keyed by canonical document URI.
13926
+ * Resolves each `executeOptions` entry to the canonical URI of the document
13927
+ * its name points at, keyed by name.
13919
13928
  *
13920
- * Every way an entry can fail to name exactly one OpenAPI document throws
13921
- * here, before the run starts: sent to no API or to two, its options would
13922
- * be missing or misdirected with nothing to show for it until a request
13923
- * failed.
13929
+ * Every way an entry can fail to name an OpenAPI document throws here,
13930
+ * before the run starts: sent to no API, its options would be missing with
13931
+ * nothing to show for it until a request failed.
13924
13932
  */
13925
- #executeOptionsByDocument(executeOptions) {
13926
- const byDocument = new Map();
13933
+ #executeOptionsByName(executeOptions) {
13934
+ const byName = new Map();
13927
13935
  const fail = (name, problem, reason) => {
13928
13936
  throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`executeOptions is keyed by source description name, and "${name}" ${problem}`, {
13929
13937
  reason
@@ -13940,12 +13948,32 @@ class WorkflowExecutor {
13940
13948
  if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(options)) {
13941
13949
  fail(name, 'is not given an object of options', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownExecuteOption);
13942
13950
  }
13943
- if (byDocument.has(uri)) {
13944
- fail(name, `points at "${uri}", which another entry already configures`, _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousExecuteOptions);
13945
- }
13946
- byDocument.set(uri, options);
13951
+ byName.set(name, {
13952
+ uri,
13953
+ options
13954
+ });
13955
+ }
13956
+ return byName;
13957
+ }
13958
+
13959
+ /**
13960
+ * The entry for the step's operation: the entry of the name the step reached
13961
+ * it through, when that is a name of the entry document with an entry;
13962
+ * otherwise the one entry configuring the operation's document, if any.
13963
+ */
13964
+ #executeOptionsFor(entries, locator, step) {
13965
+ const source = locator.sourceDescription;
13966
+ const named = source?.documentURI === this.#document.uri ? entries.get(source.name) : undefined;
13967
+ if (named !== undefined) return named.options;
13968
+ const configuring = [...entries].filter(([, entry]) => entry.uri === locator.document.uri);
13969
+ if (configuring.length > 1) {
13970
+ const names = configuring.map(([name]) => `"${name}"`).join(', ');
13971
+ 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`, {
13972
+ ...step,
13973
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousExecuteOptions
13974
+ });
13947
13975
  }
13948
- return byDocument;
13976
+ return configuring[0]?.[1].options;
13949
13977
  }
13950
13978
 
13951
13979
  /**