@usearazzo/runner 1.0.1-alpha.22 → 1.0.1-alpha.23

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.23](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.22...v1.0.1-alpha.23) (2026-11-04)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **runner:** align operation reference errors and name the workflow ([#318](https://github.com/usearazzo/arazzo-toolkit/issues/318)) ([308e386](https://github.com/usearazzo/arazzo-toolkit/commit/308e3860074d145983410c4d891471147bb2c3a7)), closes [#317](https://github.com/usearazzo/arazzo-toolkit/issues/317)
11
+
6
12
  ## [1.0.1-alpha.22](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.21...v1.0.1-alpha.22) (2026-11-04)
7
13
 
8
14
  ### Bug Fixes
@@ -12031,8 +12031,10 @@ __webpack_require__.r(__webpack_exports__);
12031
12031
  /* harmony import */ var _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30698);
12032
12032
  /* harmony import */ var _document_OpenAPIDocument_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35043);
12033
12033
  /* harmony import */ var _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77370);
12034
- /* harmony import */ var _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(90713);
12035
- /* harmony import */ var _SourceDescriptionsLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(83461);
12034
+ /* harmony import */ var _extractor_OpenAPIOperationExtractor_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(57658);
12035
+ /* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(17658);
12036
+ /* harmony import */ var _SourceDescriptionsLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(83461);
12037
+
12036
12038
 
12037
12039
 
12038
12040
 
@@ -12063,7 +12065,7 @@ __webpack_require__.r(__webpack_exports__);
12063
12065
  * `$sourceDescriptions.{name}.{operationId}`. Per the Arazzo Specification, a
12064
12066
  * plain name is only valid when a single (non-arazzo) source description is
12065
12067
  * defined; multiple sources require the expression form. A plain name is
12066
- * therefore resolved against the first source description that has it.
12068
+ * therefore looked up in the first OpenAPI source description only.
12067
12069
  * - `operationPath` embeds a `{$sourceDescriptions.{name}.url}` runtime
12068
12070
  * expression followed by a JSON Pointer to the operation.
12069
12071
  *
@@ -12071,21 +12073,31 @@ __webpack_require__.r(__webpack_exports__);
12071
12073
  * or wrong); a source is classified by what it actually parses to. The
12072
12074
  * normalizer acquires the referenced source documents from the registry on
12073
12075
  * demand.
12076
+ *
12077
+ * A reference that cannot be resolved throws {@link ExecutionError}, attributed
12078
+ * to the referencing step when a {@link StepScope} is given:
12079
+ * `operation-not-found` when no operation answers it,
12080
+ * `source-description-not-found` for a source name the document does not
12081
+ * define, `source-description-not-openapi` for a source that is not an OpenAPI
12082
+ * document, and `invalid-operation-reference` for a reference malformed as
12083
+ * written. Every returned locator names an existing operation.
12074
12084
  * @public
12075
12085
  */
12076
- class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_6__["default"] {
12086
+ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_7__["default"] {
12087
+ #extractor = new _extractor_OpenAPIOperationExtractor_ts__WEBPACK_IMPORTED_MODULE_5__["default"]();
12088
+
12077
12089
  /**
12078
12090
  * Normalizes a plain or expression `operationId` to a canonical locator.
12079
12091
  *
12080
12092
  * A whole runtime expression (`$sourceDescriptions.{name}.{operationId}`) is
12081
- * resolved against its named source; a plain name is resolved against the
12082
- * first source description that has it.
12093
+ * resolved against its named source; a plain name is looked up in the first
12094
+ * OpenAPI source description only.
12083
12095
  */
12084
- async normalizeOperationId(operationId, document) {
12096
+ async normalizeOperationId(operationId, document, scope) {
12085
12097
  if ((0,_swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_0__.test)(operationId)) {
12086
- return this.#resolveSourced(operationId, document);
12098
+ return this.#resolveSourced(operationId, document, scope);
12087
12099
  }
12088
- return this.#resolvePlainOperationId(operationId, document);
12100
+ return this.#resolvePlainOperationId(operationId, document, scope);
12089
12101
  }
12090
12102
 
12091
12103
  /**
@@ -12101,10 +12113,21 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
12101
12113
  * The runner only needs a URL and a JSON Pointer, so it does not enforce that
12102
12114
  * the source description is identified by a runtime expression rather than a
12103
12115
  * literal URL (a literal URL interpolates to itself and still resolves) — that
12104
- * is a conformance concern for the validator. It fails only when the URL does
12105
- * not resolve to an OpenAPI source or the JSON Pointer is invalid.
12106
- */
12107
- async normalizeOperationPath(operationPath, document) {
12116
+ * is a conformance concern for the validator. A source name the document does
12117
+ * not define is detected before interpolation, so it is reported as such
12118
+ * rather than as the empty URL it would interpolate to; the JSON Pointer must
12119
+ * locate an operation in the acquired OpenAPI document.
12120
+ */
12121
+ async normalizeOperationPath(operationPath, document, scope) {
12122
+ for (const expression of (0,_swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_0__.extract)(operationPath) ?? []) {
12123
+ const parsed = this.parseSourceDescriptionsExpression(expression);
12124
+ if (parsed !== undefined && document.resolveSourceDescriptionURI(parsed.sourceName) === undefined) {
12125
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`operationPath "${operationPath}" names source description "${parsed.sourceName}", which the Arazzo document at "${document.uri}" does not define`, {
12126
+ ...scope,
12127
+ reason: 'source-description-not-found'
12128
+ });
12129
+ }
12130
+ }
12108
12131
  const evaluator = new _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_4__["default"]({}, {
12109
12132
  strict: false,
12110
12133
  document,
@@ -12113,23 +12136,35 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
12113
12136
  const uriReference = evaluator.interpolate(operationPath);
12114
12137
  const documentURI = _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_2__.sanitize(_speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_2__.stripHash(uriReference));
12115
12138
  if (documentURI === '') {
12116
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`operationPath "${operationPath}" does not resolve to a source description URL`, {
12117
- pointer: operationPath,
12118
- uri: document.uri
12139
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`operationPath "${operationPath}" does not resolve to a source description URL`, {
12140
+ ...scope,
12141
+ reason: 'invalid-operation-reference'
12119
12142
  });
12120
12143
  }
12121
12144
  const jsonPointer = _swaggerexpert_json_pointer__WEBPACK_IMPORTED_MODULE_1__.URIFragmentIdentifier.fromURIReference(uriReference);
12122
12145
  if (!(0,_swaggerexpert_json_pointer__WEBPACK_IMPORTED_MODULE_1__.testJSONPointer)(jsonPointer)) {
12123
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`operationPath "${operationPath}" has an invalid JSON Pointer`, {
12124
- pointer: operationPath,
12125
- uri: document.uri
12146
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`operationPath "${operationPath}" has an invalid JSON Pointer`, {
12147
+ ...scope,
12148
+ reason: 'invalid-operation-reference'
12126
12149
  });
12127
12150
  }
12128
12151
  const source = await this.registry.acquire(documentURI);
12129
12152
  if (!_document_OpenAPIDocument_ts__WEBPACK_IMPORTED_MODULE_3__["default"].is(source)) {
12130
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`operationPath "${operationPath}" does not reference an OpenAPI document`, {
12131
- pointer: operationPath,
12132
- uri: documentURI
12153
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`operationPath "${operationPath}" references "${documentURI}", which is not an OpenAPI document`, {
12154
+ ...scope,
12155
+ reason: 'source-description-not-openapi'
12156
+ });
12157
+ }
12158
+
12159
+ // the extractor owns locating an operation by pointer; its failure here
12160
+ // means the pointer names no operation in this document.
12161
+ try {
12162
+ this.#extractor.extractByPointer(source, jsonPointer);
12163
+ } catch (error) {
12164
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`operationPath "${operationPath}" does not locate an operation in the OpenAPI document at "${source.uri}"`, {
12165
+ cause: error,
12166
+ ...scope,
12167
+ reason: 'operation-not-found'
12133
12168
  });
12134
12169
  }
12135
12170
  return {
@@ -12137,31 +12172,24 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
12137
12172
  jsonPointer
12138
12173
  };
12139
12174
  }
12140
-
12141
- /**
12142
- * Parses a `$sourceDescriptions.{name}.{reference}` expression, asserting
12143
- * it is a source-descriptions expression.
12144
- */
12145
- #parseSourceDescriptionsExpression(expression) {
12175
+ async #resolveSourced(expression, document, scope) {
12146
12176
  const parsed = this.parseSourceDescriptionsExpression(expression);
12147
12177
  if (parsed === undefined) {
12148
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`Unsupported operationId expression "${expression}"`, {
12149
- operationId: expression
12178
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`operationId "${expression}" is not a $sourceDescriptions.{name}.{operationId} expression`, {
12179
+ ...scope,
12180
+ reason: 'invalid-operation-reference'
12150
12181
  });
12151
12182
  }
12152
- return parsed;
12153
- }
12154
- async #resolveSourced(expression, document) {
12155
12183
  const {
12156
12184
  sourceName,
12157
12185
  reference: operationId
12158
- } = this.#parseSourceDescriptionsExpression(expression);
12159
- const openapiDocument = await this.#sourceDocument(sourceName, document);
12186
+ } = parsed;
12187
+ const openapiDocument = await this.#sourceDocument(sourceName, document, scope);
12160
12188
  const jsonPointer = openapiDocument.operationIndex.get(operationId);
12161
12189
  if (jsonPointer === undefined) {
12162
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`Operation "${operationId}" not found in source description "${sourceName}"`, {
12163
- operationId,
12164
- uri: openapiDocument.uri
12190
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`Operation "${operationId}" not found in source description "${sourceName}" at "${openapiDocument.uri}"`, {
12191
+ ...scope,
12192
+ reason: 'operation-not-found'
12165
12193
  });
12166
12194
  }
12167
12195
  return {
@@ -12182,15 +12210,15 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
12182
12210
  * Non-OpenAPI (arazzo) sources are skipped. Sources are acquired one at a time
12183
12211
  * until the first OpenAPI source is reached.
12184
12212
  */
12185
- async #resolvePlainOperationId(operationId, document) {
12213
+ async #resolvePlainOperationId(operationId, document, scope) {
12186
12214
  for (const uri of document.sourceDescriptionURIs()) {
12187
12215
  const source = await this.registry.acquire(uri);
12188
12216
  if (!_document_OpenAPIDocument_ts__WEBPACK_IMPORTED_MODULE_3__["default"].is(source)) continue;
12189
12217
  const jsonPointer = source.operationIndex.get(operationId);
12190
12218
  if (jsonPointer === undefined) {
12191
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`Operation "${operationId}" not found in source description at "${source.uri}"`, {
12192
- operationId,
12193
- uri: source.uri
12219
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`Operation "${operationId}" not found in source description at "${source.uri}"`, {
12220
+ ...scope,
12221
+ reason: 'operation-not-found'
12194
12222
  });
12195
12223
  }
12196
12224
  return {
@@ -12198,26 +12226,31 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
12198
12226
  jsonPointer
12199
12227
  };
12200
12228
  }
12201
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`Operation "${operationId}" has no OpenAPI source description`, {
12202
- operationId,
12203
- uri: document.uri
12229
+
12230
+ // no source was named, so this is not a missing source description: there
12231
+ // is simply no OpenAPI document for the operation to be in.
12232
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`Operation "${operationId}" not found: the Arazzo document at "${document.uri}" has no OpenAPI source description`, {
12233
+ ...scope,
12234
+ reason: 'operation-not-found'
12204
12235
  });
12205
12236
  }
12206
12237
 
12207
12238
  /**
12208
12239
  * Acquires a source description by name and asserts it is an OpenAPI document.
12209
12240
  */
12210
- async #sourceDocument(sourceName, document) {
12241
+ async #sourceDocument(sourceName, document, scope) {
12211
12242
  const uri = document.resolveSourceDescriptionURI(sourceName);
12212
12243
  if (uri === undefined) {
12213
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`Source description "${sourceName}" not found`, {
12214
- uri: document.uri
12244
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`Source description "${sourceName}" not found in the Arazzo document at "${document.uri}"`, {
12245
+ ...scope,
12246
+ reason: 'source-description-not-found'
12215
12247
  });
12216
12248
  }
12217
12249
  const source = await this.registry.acquire(uri);
12218
12250
  if (!_document_OpenAPIDocument_ts__WEBPACK_IMPORTED_MODULE_3__["default"].is(source)) {
12219
- throw new _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_5__["default"](`Source description "${sourceName}" is not an OpenAPI document`, {
12220
- uri
12251
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`Source description "${sourceName}" at "${uri}" is not an OpenAPI document`, {
12252
+ ...scope,
12253
+ reason: 'source-description-not-openapi'
12221
12254
  });
12222
12255
  }
12223
12256
  return source;
@@ -12431,38 +12464,45 @@ class StepExecutor {
12431
12464
  * request nobody is waiting for, whose wire-level cancellation would surface
12432
12465
  * as a transport {@link ClientError} — a request that failed on its own terms
12433
12466
  * — rather than as the withdrawal it is.
12467
+ *
12468
+ * `workflowId` names the workflow the step belongs to; every error raised
12469
+ * here then carries it alongside the `stepId`, since step ids are only
12470
+ * unique within a workflow. The workflow executor always passes it.
12434
12471
  */
12435
- async execute(step, state, executeOptions = {}) {
12472
+ async execute(step, state, executeOptions = {}, workflowId) {
12436
12473
  const stepId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.stepId);
12474
+ const scope = {
12475
+ ...(workflowId === undefined ? {} : {
12476
+ workflowId
12477
+ }),
12478
+ stepId
12479
+ };
12437
12480
 
12438
12481
  // a step's target fields are mutually exclusive; declaring more than one is
12439
12482
  // malformed and has no defined resolution.
12440
12483
  const declaredTargets = STEP_TARGET_FIELDS.filter(field => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(step[field]));
12441
12484
  if (declaredTargets.length > 1) {
12442
12485
  throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_10__["default"](`Step "${stepId}" declares more than one of ${STEP_TARGET_FIELDS.join(', ')} (mutually exclusive)`, {
12443
- stepId,
12486
+ ...scope,
12444
12487
  reason: 'ambiguous-target'
12445
12488
  });
12446
12489
  }
12447
12490
  if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(step.workflowId)) {
12448
12491
  throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_10__["default"](`Step "${stepId}" targets a workflowId; use the workflow executor`, {
12449
- stepId,
12492
+ ...scope,
12450
12493
  reason: 'workflow-step'
12451
12494
  });
12452
12495
  }
12453
- this.assertSuccessCriteria(step);
12496
+ this.assertSuccessCriteria(step, workflowId);
12454
12497
 
12455
12498
  // locate which operation the step invokes — reduced to a (document, JSON
12456
12499
  // Pointer) locator that the operation executor extracts, normalizes,
12457
12500
  // assembles into a standalone doc, and runs.
12458
- const locator = await this.#locateOperation(step, stepId);
12501
+ const locator = await this.#locateOperation(step, scope);
12459
12502
 
12460
12503
  // resolve parameters and request body against the pre-request context.
12461
12504
  // keyed by '{in}.{name}' rather than bare name, so two parameters that
12462
12505
  // legally differ only in their location each reach their own place.
12463
- const scope = {
12464
- stepId
12465
- };
12466
12506
  const preContext = state.toContext();
12467
12507
  const parameters = this.#parameterResolver.resolve(step.parameters, expression => this.#evaluate(preContext, expression), scope);
12468
12508
  const requestBody = this.#requestBodyResolver.resolve(step.requestBody, expression => this.#evaluate(preContext, expression), scope);
@@ -12473,9 +12513,7 @@ class StepExecutor {
12473
12513
  // live side effect. The signal stays in the bag, so a request already in
12474
12514
  // flight is aborted by the transport as before.
12475
12515
  const signal = (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.readAbortSignal)(executeOptions);
12476
- (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, {
12477
- stepId
12478
- });
12516
+ (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, scope);
12479
12517
 
12480
12518
  // the Arazzo-derived parameters and request body are spread after the opaque
12481
12519
  // executeOptions bag so they take precedence over it. the operation executor
@@ -12494,22 +12532,20 @@ class StepExecutor {
12494
12532
  // cancelled, it did not: reporting it as the abort keeps one error shape
12495
12533
  // whether the run was withdrawn between two steps or mid-flight, and keeps
12496
12534
  // the whole feature from reading differently per transport.
12497
- ;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, {
12498
- stepId
12499
- });
12535
+ ;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, scope);
12500
12536
  throw error;
12501
12537
  }
12502
12538
 
12503
12539
  // evaluate criteria, outputs, and the next action against the post-request
12504
12540
  // context (with $request / $url / $method and $response / $statusCode).
12505
12541
  const postContext = state.toContext(this.#requestContext(response), this.#responseContext(response));
12506
- const successCriteria = this.evaluateCriteria(step, postContext);
12542
+ const successCriteria = this.evaluateCriteria(step, postContext, workflowId);
12507
12543
  const successful = successCriteria.every(criterion => criterion.met);
12508
12544
  const outputs = this.#outputResolver.resolve(step.outputs, expression => this.#evaluate(postContext, expression), scope);
12509
12545
  const {
12510
12546
  matchedActions,
12511
12547
  actionCriteria
12512
- } = this.selectActions(step, successful, postContext);
12548
+ } = this.selectActions(step, successful, postContext, workflowId);
12513
12549
  return {
12514
12550
  stepId,
12515
12551
  response,
@@ -12539,15 +12575,15 @@ class StepExecutor {
12539
12575
  requestContentType: requestBody.contentType
12540
12576
  };
12541
12577
  }
12542
- async #locateOperation(step, stepId) {
12578
+ async #locateOperation(step, scope) {
12543
12579
  if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(step.operationId)) {
12544
- return this.#locatorNormalizer.normalizeOperationId((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.operationId), this.#document);
12580
+ return this.#locatorNormalizer.normalizeOperationId((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.operationId), this.#document, scope);
12545
12581
  }
12546
12582
  if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(step.operationPath)) {
12547
- return this.#locatorNormalizer.normalizeOperationPath((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.operationPath), this.#document);
12583
+ return this.#locatorNormalizer.normalizeOperationPath((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.operationPath), this.#document, scope);
12548
12584
  }
12549
- throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_10__["default"](`Step "${stepId}" has no operationId or operationPath`, {
12550
- stepId,
12585
+ throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_10__["default"](`Step "${scope.stepId}" has no operationId or operationPath`, {
12586
+ ...scope,
12551
12587
  reason: 'missing-operation'
12552
12588
  });
12553
12589
  }
@@ -12601,10 +12637,12 @@ class StepExecutor {
12601
12637
  * Public for the same reason as {@link StepExecutor.selectActions}: a step
12602
12638
  * targeting a `workflowId` is run by the workflow executor and never reaches
12603
12639
  * {@link StepExecutor.execute}, but its criteria are still the author's
12604
- * assertion about the step and must be evaluated somewhere.
12640
+ * assertion about the step and must be evaluated somewhere. `workflowId`
12641
+ * names the step's workflow on a thrown error, as for
12642
+ * {@link StepExecutor.execute}.
12605
12643
  */
12606
- evaluateCriteria(step, context) {
12607
- this.assertSuccessCriteria(step);
12644
+ evaluateCriteria(step, context, workflowId) {
12645
+ this.assertSuccessCriteria(step, workflowId);
12608
12646
  const criteria = step.successCriteria;
12609
12647
  if (criteria === undefined) return [];
12610
12648
 
@@ -12632,8 +12670,10 @@ class StepExecutor {
12632
12670
  * it runs itself and which therefore never reaches
12633
12671
  * {@link StepExecutor.execute}. Both callers reach the criteria evaluator and
12634
12672
  * the expression context through this one method rather than wiring their own.
12673
+ * `workflowId` names the step's workflow on a thrown error, as for
12674
+ * {@link StepExecutor.execute}.
12635
12675
  */
12636
- selectActions(step, successful, context) {
12676
+ selectActions(step, successful, context, workflowId) {
12637
12677
  const actionCriteria = [];
12638
12678
  const isCriterionMet = (criterion, action) => {
12639
12679
  const record = {
@@ -12644,6 +12684,9 @@ class StepExecutor {
12644
12684
  return record.met;
12645
12685
  };
12646
12686
  const scope = {
12687
+ ...(workflowId === undefined ? {} : {
12688
+ workflowId
12689
+ }),
12647
12690
  stepId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.stepId)
12648
12691
  };
12649
12692
  const matchedActions = successful ? this.#actionResolver.resolveOnSuccess(step.onSuccess, isCriterionMet, scope) : this.#actionResolver.resolveOnFailure(step.onFailure, isCriterionMet, scope);
@@ -14088,10 +14131,11 @@ class WorkflowExecutor {
14088
14131
  callStack
14089
14132
  } = invocation;
14090
14133
  if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(step.workflowId)) {
14091
- return () => this.#stepExecutor.forDocument(document).execute(step, state, scope.executeOptions);
14134
+ return () => this.#stepExecutor.forDocument(document).execute(step, state, scope.executeOptions, workflowId);
14092
14135
  }
14093
14136
  const reference = this.#subWorkflowReference(step, stepId, workflowId);
14094
14137
  const stepScope = {
14138
+ workflowId,
14095
14139
  stepId
14096
14140
  };
14097
14141
  // the reference resolves to the same locator on every attempt, so it is
@@ -14169,12 +14213,12 @@ class WorkflowExecutor {
14169
14213
  // evaluated by the parent document's step executor — only the sub-run
14170
14214
  // itself switched documents.
14171
14215
  const stepExecutor = this.#stepExecutor.forDocument(document);
14172
- const successCriteria = stepExecutor.evaluateCriteria(step, context);
14216
+ const successCriteria = stepExecutor.evaluateCriteria(step, context, workflowId);
14173
14217
  const successful = !this.#settledFailed(result) && successCriteria.every(criterion => criterion.met);
14174
14218
  const {
14175
14219
  matchedActions,
14176
14220
  actionCriteria
14177
- } = stepExecutor.selectActions(step, successful, context);
14221
+ } = stepExecutor.selectActions(step, successful, context, workflowId);
14178
14222
  return {
14179
14223
  stepId,
14180
14224
  successful,