@usearazzo/runner 1.0.1-alpha.28 → 1.0.1-alpha.29

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.
@@ -11188,6 +11188,8 @@ __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. */
11192
+ static AmbiguousExecuteOptions = 'ambiguous-execute-options';
11191
11193
  /** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
11192
11194
  static AmbiguousTarget = 'ambiguous-target';
11193
11195
  /** The `dependsOn` edges alone form a cycle between workflows. */
@@ -11222,7 +11224,7 @@ class ExecutionError extends _ArazzoRunnerError_ts__WEBPACK_IMPORTED_MODULE_0__[
11222
11224
  static StepBudget = 'step-budget';
11223
11225
  /** An action declares a `type` other than `end`, `goto` or `retry`. */
11224
11226
  static UnknownActionType = 'unknown-action-type';
11225
- /** `execute` received an option it does not know. */
11227
+ /** `execute` received an option it does not know, or an `executeOptions` entry that is not an object. */
11226
11228
  static UnknownExecuteOption = 'unknown-execute-option';
11227
11229
  /** A step produced a transition the workflow executor does not recognize. */
11228
11230
  static UnknownTransitionKind = 'unknown-transition-kind';
@@ -11686,6 +11688,22 @@ const UNDECLARED_LOCATIONS = new Set(['header', 'query', 'cookie', 'path']);
11686
11688
  // the header parameters OpenAPI 3 says SHALL be ignored, which buildRequest drops
11687
11689
  const IGNORED_HEADERS = new Set(['accept', 'authorization', 'content-type']);
11688
11690
 
11691
+ /**
11692
+ * The credential for one security scheme, in the form the vendored
11693
+ * swagger-client applies it: the key or token itself (or `{ value }`) for an
11694
+ * `apiKey` or an `http` bearer scheme, `{ username, password }` for an `http`
11695
+ * basic scheme, and `{ token: { access_token, token_type } }` for an `oauth2`
11696
+ * or `openIdConnect` scheme.
11697
+ * @public
11698
+ */
11699
+
11700
+ /**
11701
+ * Credentials for the security schemes of an OpenAPI document, keyed by the
11702
+ * scheme name under `components.securitySchemes` (`securityDefinitions` in
11703
+ * OpenAPI 2.0).
11704
+ * @public
11705
+ */
11706
+
11689
11707
  /**
11690
11708
  * Options for executing an OpenAPI operation.
11691
11709
  *
@@ -11695,11 +11713,14 @@ const IGNORED_HEADERS = new Set(['accept', 'authorization', 'content-type']);
11695
11713
  * building the request and sending it.
11696
11714
  *
11697
11715
  * Typed here are the options the runner itself drives and the ones callers
11698
- * routinely reach for. The rest of `buildRequest`'s surface (`securities`,
11699
- * `scheme`, `parameterBuilders`, `attachContentTypeForEmptyPayload`, …) is
11700
- * deliberately left untyped and passes through the bag's open tail unchanged —
11701
- * see {@link OpenAPIOperationExecuteOptionsBag}. Authentication in particular
11702
- * is not modeled: Arazzo is auth-agnostic, so credentials are applied with a
11716
+ * routinely reach for. The rest of `buildRequest`'s surface (`scheme`,
11717
+ * `parameterBuilders`, `attachContentTypeForEmptyPayload`, …) is deliberately
11718
+ * left untyped and passes through the bag's open tail unchanged — see
11719
+ * {@link OpenAPIOperationExecuteOptionsBag}.
11720
+ *
11721
+ * Arazzo is auth-agnostic, so credentials come from outside the workflow:
11722
+ * static ones for the security schemes the OpenAPI document declares go in
11723
+ * `securities`, and anything computed per request is applied with a
11703
11724
  * {@link RequestInterceptor}.
11704
11725
  * @public
11705
11726
  */
@@ -11712,11 +11733,9 @@ const IGNORED_HEADERS = new Set(['accept', 'authorization', 'content-type']);
11712
11733
  * the rest of `buildRequest`'s surface (`scheme`, `parameterBuilders`,
11713
11734
  * `attachContentTypeForEmptyPayload`, …) passes through untouched.
11714
11735
  *
11715
- * Nothing routine belongs in the tail. Credentials go through a
11716
- * {@link RequestInterceptor} and `server` covers every case that once needed a
11717
- * `contextUrl`, so reaching for either of those here means an edge case: tests
11718
- * standing in for a document fetched over HTTP, or credentials applied from the
11719
- * document's own security schemes.
11736
+ * Nothing routine belongs in the tail. `server` covers every case that once
11737
+ * needed a `contextUrl`, so reaching for that here means an edge case: tests
11738
+ * standing in for a document fetched over HTTP.
11720
11739
  *
11721
11740
  * Two kinds of entry are inert rather than honored, since the executor owns
11722
11741
  * what they used to control. The operation target always comes from the
@@ -12620,6 +12639,13 @@ const STEP_TARGET_FIELDS = ['operationId', 'operationPath', 'workflowId'];
12620
12639
  * @internal
12621
12640
  */
12622
12641
 
12642
+ /**
12643
+ * The execute options of a step: the opaque bag forwarded to the operation
12644
+ * executor, or a function returning it for the operation the step was located
12645
+ * to.
12646
+ * @public
12647
+ */
12648
+
12623
12649
  /**
12624
12650
  * Executes a single Arazzo step that invokes an OpenAPI operation.
12625
12651
  *
@@ -12682,7 +12708,9 @@ class StepExecutor {
12682
12708
  * `executeOptions` is an opaque bag passed through to the operation executor
12683
12709
  * (e.g. a `server` to run the step against, or an `AbortSignal`). The
12684
12710
  * Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
12685
- * take precedence over it.
12711
+ * take precedence over it. A function is called with the operation the step
12712
+ * was located to and returns the bag, for options that depend on which API
12713
+ * the step calls.
12686
12714
  *
12687
12715
  * A `signal` in that bag is honored here and not only at the transport: an
12688
12716
  * already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
@@ -12724,6 +12752,7 @@ class StepExecutor {
12724
12752
  // Pointer) locator that the operation executor extracts, normalizes,
12725
12753
  // assembles into a standalone doc, and runs.
12726
12754
  const locator = await this.#locateOperation(step, scope);
12755
+ const operationOptions = typeof executeOptions === 'function' ? executeOptions(locator) : executeOptions;
12727
12756
 
12728
12757
  // resolve parameters and request body against the pre-request context.
12729
12758
  // keyed by '{in}.{name}' rather than bare name, so two parameters that
@@ -12737,7 +12766,7 @@ class StepExecutor {
12737
12766
  // still reach this line — and this is the last moment before the step has a
12738
12767
  // live side effect. The signal stays in the bag, so a request already in
12739
12768
  // flight is aborted by the transport as before.
12740
- const signal = (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.readAbortSignal)(executeOptions);
12769
+ const signal = (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.readAbortSignal)(operationOptions);
12741
12770
  (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, scope);
12742
12771
 
12743
12772
  // the Arazzo-derived parameters and request body are spread after the opaque
@@ -12746,7 +12775,7 @@ class StepExecutor {
12746
12775
  let response;
12747
12776
  try {
12748
12777
  response = await this.#operationExecutor.execute(locator, {
12749
- ...executeOptions,
12778
+ ...operationOptions,
12750
12779
  parameters,
12751
12780
  ...this.#requestBodyOptions(requestBody)
12752
12781
  });
@@ -13559,22 +13588,24 @@ __webpack_require__.r(__webpack_exports__);
13559
13588
  /* harmony export */ settledResult: () => (/* binding */ settledResult)
13560
13589
  /* harmony export */ });
13561
13590
  /* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7456);
13562
- /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62823);
13563
- /* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(75728);
13564
- /* harmony import */ var _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(77370);
13565
- /* harmony import */ var _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77447);
13566
- /* harmony import */ var _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(75055);
13567
- /* harmony import */ var _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(99494);
13568
- /* harmony import */ var _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(95839);
13569
- /* harmony import */ var _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(61596);
13570
- /* harmony import */ var _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(96007);
13571
- /* harmony import */ var _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(98885);
13572
- /* harmony import */ var _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(18760);
13573
- /* harmony import */ var _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(64661);
13574
- /* harmony import */ var _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(2835);
13575
- /* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(17658);
13576
- /* harmony import */ var _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(8696);
13577
- /* harmony import */ var _abort_ts__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(99628);
13591
+ /* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34606);
13592
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62823);
13593
+ /* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(75728);
13594
+ /* harmony import */ var _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77370);
13595
+ /* harmony import */ var _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(77447);
13596
+ /* harmony import */ var _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(75055);
13597
+ /* harmony import */ var _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(99494);
13598
+ /* harmony import */ var _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(95839);
13599
+ /* harmony import */ var _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(61596);
13600
+ /* harmony import */ var _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(96007);
13601
+ /* harmony import */ var _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(98885);
13602
+ /* harmony import */ var _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(18760);
13603
+ /* harmony import */ var _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(64661);
13604
+ /* harmony import */ var _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2835);
13605
+ /* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(17658);
13606
+ /* harmony import */ var _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(8696);
13607
+ /* harmony import */ var _abort_ts__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(99628);
13608
+
13578
13609
 
13579
13610
 
13580
13611
 
@@ -13731,24 +13762,24 @@ class WorkflowExecutor {
13731
13762
  #maxSteps;
13732
13763
  #maxWorkflowDepth;
13733
13764
  #now;
13734
- #extractor = new _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_4__["default"]();
13765
+ #extractor = new _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_5__["default"]();
13735
13766
  #normalizer;
13736
- #outputResolver = new _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_6__["default"]();
13737
- #parameterResolver = new _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_7__["default"]();
13767
+ #outputResolver = new _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_7__["default"]();
13768
+ #parameterResolver = new _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_8__["default"]();
13738
13769
  #stepExecutor;
13739
13770
  #retryRunner;
13740
- #interpreter = new _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_13__["default"]();
13771
+ #interpreter = new _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_14__["default"]();
13741
13772
  #workflowLocatorNormalizer;
13742
13773
  constructor(options) {
13743
13774
  this.#document = options.document;
13744
13775
  this.#registry = options.registry;
13745
- this.#workflowLocatorNormalizer = new _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_10__["default"](options.registry);
13746
- this.#normalizer = options.workflowNormalizer ?? new _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_5__["default"]();
13776
+ this.#workflowLocatorNormalizer = new _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_11__["default"](options.registry);
13777
+ this.#normalizer = options.workflowNormalizer ?? new _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_6__["default"]();
13747
13778
  this.#maxSteps = options.maxSteps ?? WorkflowExecutor.#DEFAULT_MAX_STEPS;
13748
13779
  this.#maxWorkflowDepth = options.maxWorkflowDepth ?? WorkflowExecutor.#DEFAULT_MAX_WORKFLOW_DEPTH;
13749
13780
  this.#now = options.now ?? WorkflowExecutor.#DEFAULT_NOW;
13750
13781
  this.#stepExecutor = options.stepExecutor;
13751
- this.#retryRunner = new _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_11__["default"]({
13782
+ this.#retryRunner = new _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_12__["default"]({
13752
13783
  sleep: options.sleep
13753
13784
  });
13754
13785
  }
@@ -13766,23 +13797,21 @@ class WorkflowExecutor {
13766
13797
  */
13767
13798
  async execute(workflowId, options = {}) {
13768
13799
  this.#rejectUnknownOptions(options);
13769
-
13770
- // a signal in the opaque bag was the only channel before this option existed,
13771
- // and it still reaches the transport. Absorbing it here is what makes it a
13772
- // whole cancellation rather than half of one: read only at dispatch, it would
13773
- // abort requests while the loop walked on through the remaining steps.
13774
- const signal = options.signal ?? (0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.readAbortSignal)(options.executeOptions ?? {});
13800
+ const {
13801
+ signal
13802
+ } = options;
13803
+ const executeOptions = this.#executeOptionsByDocument(options.executeOptions ?? {});
13775
13804
  const scope = {
13776
- // the first-class signal is also spread into the opaque bag, because that
13777
- // bag is how anything reaches the transport: the executor's own checks
13778
- // stop the run at the next boundary, and this is what cancels the request
13779
- // already in flight. Spread last, so it wins over one passed in the bag.
13780
- executeOptions: {
13781
- ...options.executeOptions,
13782
- ...(signal === undefined ? {} : {
13783
- signal
13784
- })
13785
- },
13805
+ // the signal is put into every step's opaque bag, because that bag is
13806
+ // how anything reaches the transport: the executor's own checks stop the
13807
+ // run at the next boundary, and this is what cancels the request already
13808
+ // in flight. Set even when absent, so a `signal` in an entry never
13809
+ // stands in for it: that one would cancel the steps of a single API and
13810
+ // leave the run walking on.
13811
+ executeOptions: locator => ({
13812
+ ...executeOptions.get(locator.document.uri),
13813
+ signal
13814
+ }),
13786
13815
  dependencyInputs: options.dependencyInputs ?? {},
13787
13816
  runDependencies: options.runDependencies ?? true,
13788
13817
  signal,
@@ -13795,12 +13824,47 @@ class WorkflowExecutor {
13795
13824
  return this.#run({
13796
13825
  document: this.#document,
13797
13826
  workflowId
13798
- }, options.inputs ?? {}, scope, new _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_12__["default"]({
13827
+ }, options.inputs ?? {}, scope, new _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_13__["default"]({
13799
13828
  maxDepth: this.#maxWorkflowDepth,
13800
13829
  entryDocumentURI: this.#document.uri
13801
13830
  }), 'root');
13802
13831
  }
13803
13832
 
13833
+ /**
13834
+ * Resolves the `executeOptions` entries to the documents they configure,
13835
+ * keyed by canonical document URI.
13836
+ *
13837
+ * Every way an entry can fail to name exactly one OpenAPI document throws
13838
+ * here, before the run starts: sent to no API or to two, its options would
13839
+ * be missing or misdirected with nothing to show for it until a request
13840
+ * failed.
13841
+ */
13842
+ #executeOptionsByDocument(executeOptions) {
13843
+ const byDocument = new Map();
13844
+ const fail = (name, problem, reason) => {
13845
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`executeOptions is keyed by source description name, and "${name}" ${problem}`, {
13846
+ reason
13847
+ });
13848
+ };
13849
+ for (const [name, options] of Object.entries(executeOptions)) {
13850
+ const uri = this.#document.resolveSourceDescriptionURI(name);
13851
+ if (uri === undefined) {
13852
+ return fail(name, `names no source description with a url in the Arazzo document at "${this.#document.uri}"`, _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].SourceDescriptionNotFound);
13853
+ }
13854
+ if (this.#document.resolveSourceDescriptionField(name, 'type') === 'arazzo') {
13855
+ fail(name, 'names an Arazzo document', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].SourceDescriptionNotOpenAPI);
13856
+ }
13857
+ if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(options)) {
13858
+ fail(name, 'is not given an object of options', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownExecuteOption);
13859
+ }
13860
+ if (byDocument.has(uri)) {
13861
+ fail(name, `points at "${uri}", which another entry already configures`, _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousExecuteOptions);
13862
+ }
13863
+ byDocument.set(uri, options);
13864
+ }
13865
+ return byDocument;
13866
+ }
13867
+
13804
13868
  /**
13805
13869
  * Rejects an options bag carrying keys this method does not recognize.
13806
13870
  *
@@ -13814,8 +13878,8 @@ class WorkflowExecutor {
13814
13878
  #rejectUnknownOptions(options) {
13815
13879
  const unknown = Object.keys(options).filter(key => !WorkflowExecutor.#EXECUTE_OPTION_KEYS.has(key));
13816
13880
  if (unknown.length === 0) return;
13817
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`execute received unknown option(s) ${unknown.join(', ')}; it takes (workflowId, { inputs, executeOptions, dependencyInputs, runDependencies, signal }) — workflow inputs go under "inputs"`, {
13818
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].UnknownExecuteOption
13881
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`execute received unknown option(s) ${unknown.join(', ')}; it takes (workflowId, { inputs, executeOptions, dependencyInputs, runDependencies, signal }) — workflow inputs go under "inputs"`, {
13882
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownExecuteOption
13819
13883
  });
13820
13884
  }
13821
13885
 
@@ -13841,12 +13905,12 @@ class WorkflowExecutor {
13841
13905
  // run cancelled before any step — or between a prerequisite and the workflow
13842
13906
  // that needed it — must not go on to normalize and enter a workflow nobody
13843
13907
  // is waiting for.
13844
- (0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.throwIfAborted)(scope.signal, {
13908
+ (0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
13845
13909
  workflowId,
13846
13910
  callStack: nested
13847
13911
  });
13848
13912
  const workflow = await this.#resolveWorkflow(locator, scope);
13849
- const state = new _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_8__["default"]({
13913
+ const state = new _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_9__["default"]({
13850
13914
  inputs
13851
13915
  });
13852
13916
  const invocation = {
@@ -13888,7 +13952,7 @@ class WorkflowExecutor {
13888
13952
  // result carrying the dependency trace, not a throw — and none of its own
13889
13953
  // steps run. Unless the run was cancelled, in which case the prerequisite
13890
13954
  // did not fail on its own terms either.
13891
- (0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.throwIfAborted)(scope.signal, {
13955
+ (0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
13892
13956
  workflowId,
13893
13957
  callStack: nested
13894
13958
  });
@@ -13958,7 +14022,7 @@ class WorkflowExecutor {
13958
14022
  break;
13959
14023
  case 'goto':
13960
14024
  index = this.#interpreter.indexOfStep(steps, transition.stepId, workflowId, {
13961
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].GotoTargetNotFound,
14025
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].GotoTargetNotFound,
13962
14026
  label: 'goto target'
13963
14027
  });
13964
14028
  break;
@@ -13971,7 +14035,7 @@ class WorkflowExecutor {
13971
14035
  // resolution, so an aborted run reports `aborted` rather than
13972
14036
  // whatever resolving the target (a malformed reference, a missing
13973
14037
  // source) would have thrown.
13974
- (0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.throwIfAborted)(scope.signal, {
14038
+ (0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
13975
14039
  workflowId,
13976
14040
  stepId,
13977
14041
  callStack: nested
@@ -14002,10 +14066,10 @@ class WorkflowExecutor {
14002
14066
  // loudly — `transition` is provably `never` once every kind above
14003
14067
  // has its own case, which TypeScript checks at compile time.
14004
14068
  const unreachable = transition;
14005
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`step "${stepId}" in workflow "${workflowId}" produced an unrecognized transition ${JSON.stringify(unreachable)}`, {
14069
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`step "${stepId}" in workflow "${workflowId}" produced an unrecognized transition ${JSON.stringify(unreachable)}`, {
14006
14070
  workflowId,
14007
14071
  stepId,
14008
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].UnknownTransitionKind
14072
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownTransitionKind
14009
14073
  });
14010
14074
  }
14011
14075
  }
@@ -14017,7 +14081,7 @@ class WorkflowExecutor {
14017
14081
  // transport, since one honoring the signal fails the request instead.
14018
14082
  // Cancellation must not be the one outcome that reads differently for the
14019
14083
  // last step than for every step before it.
14020
- ;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.throwIfAborted)(scope.signal, {
14084
+ ;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
14021
14085
  workflowId,
14022
14086
  callStack: nested
14023
14087
  });
@@ -14090,10 +14154,10 @@ class WorkflowExecutor {
14090
14154
  */
14091
14155
  #chargeBudget(scope, invocation, stepId) {
14092
14156
  if (++scope.budget.spent <= this.#maxSteps) return;
14093
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`workflow "${invocation.workflowId}" exceeded its budget of ${this.#maxSteps} step attempts (a goto loop, excessive retries, or runaway sub-workflow calls)`, {
14157
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${invocation.workflowId}" exceeded its budget of ${this.#maxSteps} step attempts (a goto loop, excessive retries, or runaway sub-workflow calls)`, {
14094
14158
  workflowId: invocation.workflowId,
14095
14159
  stepId,
14096
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].StepBudget,
14160
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].StepBudget,
14097
14161
  path: invocation.callStack.path
14098
14162
  });
14099
14163
  }
@@ -14116,7 +14180,7 @@ class WorkflowExecutor {
14116
14180
  callStack
14117
14181
  } = invocation;
14118
14182
  return async () => {
14119
- (0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.throwIfAborted)(scope.signal, {
14183
+ (0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
14120
14184
  workflowId,
14121
14185
  stepId,
14122
14186
  callStack
@@ -14125,7 +14189,7 @@ class WorkflowExecutor {
14125
14189
  try {
14126
14190
  return await runAttempt();
14127
14191
  } catch (error) {
14128
- ;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.throwIfAborted)(scope.signal, {
14192
+ ;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
14129
14193
  workflowId,
14130
14194
  stepId,
14131
14195
  callStack
@@ -14185,7 +14249,7 @@ class WorkflowExecutor {
14185
14249
  callStack
14186
14250
  } = invocation;
14187
14251
  return async (action, outcome) => {
14188
- (0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.throwIfAborted)(scope.signal, {
14252
+ (0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
14189
14253
  workflowId,
14190
14254
  stepId,
14191
14255
  callStack
@@ -14193,12 +14257,12 @@ class WorkflowExecutor {
14193
14257
  const {
14194
14258
  hasStepId,
14195
14259
  hasWorkflowId
14196
- } = (0,_StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_13__.actionTargets)(action);
14260
+ } = (0,_StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_14__.actionTargets)(action);
14197
14261
  if (hasWorkflowId && hasStepId) {
14198
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`retry action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
14262
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`retry action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
14199
14263
  stepId,
14200
14264
  workflowId,
14201
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].AmbiguousTarget
14265
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousTarget
14202
14266
  });
14203
14267
  }
14204
14268
  if (hasWorkflowId) {
@@ -14225,7 +14289,7 @@ class WorkflowExecutor {
14225
14289
  }
14226
14290
  const refStepId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(action.stepId);
14227
14291
  const refIndex = this.#interpreter.indexOfStep(steps, refStepId, workflowId, {
14228
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].RetryTargetNotFound,
14292
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].RetryTargetNotFound,
14229
14293
  label: 'retry reference'
14230
14294
  });
14231
14295
  const refStep = steps[refIndex];
@@ -14341,17 +14405,17 @@ class WorkflowExecutor {
14341
14405
  document
14342
14406
  } = invocation;
14343
14407
  const dependsOn = workflow.dependsOn;
14344
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isArrayElement)(dependsOn)) {
14345
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`workflow "${workflowId}" has a non-list "dependsOn"`, {
14408
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(dependsOn)) {
14409
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-list "dependsOn"`, {
14346
14410
  workflowId,
14347
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].MalformedDependsOn
14411
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedDependsOn
14348
14412
  });
14349
14413
  }
14350
14414
  const references = [...dependsOn].map((entry, index) => {
14351
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(entry)) {
14352
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`workflow "${workflowId}" has a non-string entry at dependsOn[${index}]`, {
14415
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(entry)) {
14416
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-string entry at dependsOn[${index}]`, {
14353
14417
  workflowId,
14354
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].MalformedDependsOn
14418
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedDependsOn
14355
14419
  });
14356
14420
  }
14357
14421
  return (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(entry);
@@ -14392,7 +14456,7 @@ class WorkflowExecutor {
14392
14456
  state,
14393
14457
  callStack
14394
14458
  } = invocation;
14395
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(step.workflowId)) {
14459
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(step.workflowId)) {
14396
14460
  return () => this.#stepExecutor.forDocument(document).execute(step, state, scope.executeOptions, workflowId);
14397
14461
  }
14398
14462
  const reference = this.#subWorkflowReference(step, stepId, workflowId);
@@ -14532,12 +14596,12 @@ class WorkflowExecutor {
14532
14596
  // the same check, but a sub-workflow step never reaches it — so both read
14533
14597
  // the one list of target fields, and a target added to the specification
14534
14598
  // cannot be rejected by one and silently accepted by the other.
14535
- const conflicting = _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_9__.STEP_TARGET_FIELDS.filter(field => field !== 'workflowId' && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(step[field]));
14599
+ const conflicting = _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_10__.STEP_TARGET_FIELDS.filter(field => field !== 'workflowId' && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(step[field]));
14536
14600
  if (conflicting.length > 0) {
14537
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`step "${stepId}" in workflow "${workflowId}" declares a workflowId alongside ${conflicting.join(', ')} (mutually exclusive)`, {
14601
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`step "${stepId}" in workflow "${workflowId}" declares a workflowId alongside ${conflicting.join(', ')} (mutually exclusive)`, {
14538
14602
  stepId,
14539
14603
  workflowId,
14540
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].AmbiguousTarget
14604
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousTarget
14541
14605
  });
14542
14606
  }
14543
14607
  return (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.workflowId);
@@ -14606,9 +14670,9 @@ class WorkflowExecutor {
14606
14670
  #assertActionParameters(lists, workflowId, stepId) {
14607
14671
  const owner = stepId === undefined ? `workflow "${workflowId}"` : `step "${stepId}" in workflow "${workflowId}"`;
14608
14672
  for (const actions of lists) {
14609
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isArrayElement)(actions)) continue;
14673
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(actions)) continue;
14610
14674
  for (const action of actions) {
14611
- if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_2__.isSuccessActionElement)(action) && !(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_2__.isFailureActionElement)(action)) continue;
14675
+ if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isSuccessActionElement)(action) && !(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isFailureActionElement)(action)) continue;
14612
14676
  if (!action.hasKey('parameters')) continue;
14613
14677
  const scope = {
14614
14678
  workflowId,
@@ -14620,17 +14684,17 @@ class WorkflowExecutor {
14620
14684
  const {
14621
14685
  parameters
14622
14686
  } = action;
14623
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isArrayElement)(parameters)) {
14624
- throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_15__["default"]('`parameters` is present but is not a list', {
14687
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(parameters)) {
14688
+ throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"]('`parameters` is present but is not a list', {
14625
14689
  ...scope,
14626
- reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedParameters
14690
+ reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"].MalformedParameters
14627
14691
  });
14628
14692
  }
14629
- const inline = [...parameters].some(parameter => (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_2__.isParameterElement)(parameter) && parameter.hasKey('in') && !parameter.meta.hasKey('ref-fields'));
14693
+ const inline = [...parameters].some(parameter => (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isParameterElement)(parameter) && parameter.hasKey('in') && !parameter.meta.hasKey('ref-fields'));
14630
14694
  if (inline) {
14631
- throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`An action parameter of ${owner} declares an \`in\`; action parameters map to the target workflow's inputs by name`, {
14695
+ throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"](`An action parameter of ${owner} declares an \`in\`; action parameters map to the target workflow's inputs by name`, {
14632
14696
  ...scope,
14633
- reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].ActionParameterLocation
14697
+ reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"].ActionParameterLocation
14634
14698
  });
14635
14699
  }
14636
14700
  }
@@ -14656,9 +14720,9 @@ class WorkflowExecutor {
14656
14720
  const cached = scope.workflows.get(qualifiedId);
14657
14721
  if (cached !== undefined) return cached;
14658
14722
  if (!document.workflowIndex.has(workflowId)) {
14659
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`workflow "${workflowId}" not found in Arazzo document at "${document.uri}"`, {
14723
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" not found in Arazzo document at "${document.uri}"`, {
14660
14724
  workflowId,
14661
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].WorkflowNotFound
14725
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].WorkflowNotFound
14662
14726
  });
14663
14727
  }
14664
14728
  const workflow = await this.#normalizer.normalize(this.#extractor.extract(document, workflowId), document);
@@ -14686,17 +14750,17 @@ class WorkflowExecutor {
14686
14750
  #orderedSteps(workflow, workflowId) {
14687
14751
  if (!workflow.hasKey('steps')) return [];
14688
14752
  const steps = workflow.steps;
14689
- if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isArrayElement)(steps)) {
14690
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`workflow "${workflowId}" has a non-list "steps"`, {
14753
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(steps)) {
14754
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-list "steps"`, {
14691
14755
  workflowId,
14692
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].MalformedSteps
14756
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedSteps
14693
14757
  });
14694
14758
  }
14695
14759
  return [...steps].map((step, index) => {
14696
- if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_2__.isStepElement)(step)) {
14697
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"](`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
14760
+ if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isStepElement)(step)) {
14761
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
14698
14762
  workflowId,
14699
- reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_14__["default"].MalformedSteps
14763
+ reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedSteps
14700
14764
  });
14701
14765
  }
14702
14766
  return step;
@@ -14715,11 +14779,11 @@ class WorkflowExecutor {
14715
14779
  #validateWorkflowOutputsShape(workflow, workflowId) {
14716
14780
  if (!workflow.hasKey('outputs')) return;
14717
14781
  const outputs = workflow.outputs;
14718
- if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isObjectElement)(outputs)) return;
14719
- throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_15__["default"]('`outputs` is present but is not a map', {
14782
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(outputs)) return;
14783
+ throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"]('`outputs` is present but is not a map', {
14720
14784
  workflowId,
14721
14785
  target: 'outputs',
14722
- reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedOutputs
14786
+ reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"].MalformedOutputs
14723
14787
  });
14724
14788
  }
14725
14789
 
@@ -14742,7 +14806,7 @@ class WorkflowExecutor {
14742
14806
  * counterpart of {@link StepExecutor}'s bridge.
14743
14807
  */
14744
14808
  #evaluate(context, expression, document) {
14745
- return new _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_3__["default"](context, {
14809
+ return new _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_4__["default"](context, {
14746
14810
  strict: false,
14747
14811
  document,
14748
14812
  registry: this.#registry