@usearazzo/runner 1.0.1-alpha.14 → 1.0.1-alpha.15
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 +6 -0
- package/dist/arazzo-runner.browser.js +58 -15
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +4 -4
- package/src/executor/StepExecutor.cjs +47 -9
- package/src/executor/StepExecutor.mjs +47 -9
- package/src/executor/WorkflowExecutor.cjs +4 -0
- package/src/executor/WorkflowExecutor.mjs +4 -0
- package/types/runner.d.ts +17 -1
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.15](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.14...v1.0.1-alpha.15) (2026-10-28)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **runner:** reject an unreadable successCriteria before any request ([#284](https://github.com/usearazzo/arazzo-toolkit/issues/284)) ([11662f5](https://github.com/usearazzo/arazzo-toolkit/commit/11662f5e603909e356e95f0daa85a7e245667920)), closes [#127](https://github.com/usearazzo/arazzo-toolkit/issues/127)
|
|
11
|
+
|
|
6
12
|
## [1.0.1-alpha.14](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.13...v1.0.1-alpha.14) (2026-10-27)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -12097,8 +12097,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12097
12097
|
/* harmony import */ var _action_ActionResolver_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(51097);
|
|
12098
12098
|
/* harmony import */ var _OpenAPIOperationLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7308);
|
|
12099
12099
|
/* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(17658);
|
|
12100
|
-
/* harmony import */ var
|
|
12101
|
-
/* harmony import */ var
|
|
12100
|
+
/* harmony import */ var _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8696);
|
|
12101
|
+
/* harmony import */ var _errors_RuntimeExpressionError_ts__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(48770);
|
|
12102
|
+
/* harmony import */ var _abort_ts__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(99628);
|
|
12103
|
+
|
|
12102
12104
|
|
|
12103
12105
|
|
|
12104
12106
|
|
|
@@ -12231,6 +12233,7 @@ class StepExecutor {
|
|
|
12231
12233
|
reason: 'workflow-step'
|
|
12232
12234
|
});
|
|
12233
12235
|
}
|
|
12236
|
+
this.assertSuccessCriteria(step);
|
|
12234
12237
|
|
|
12235
12238
|
// locate which operation the step invokes — reduced to a (document, JSON
|
|
12236
12239
|
// Pointer) locator that the operation executor extracts, normalizes,
|
|
@@ -12252,8 +12255,8 @@ class StepExecutor {
|
|
|
12252
12255
|
// still reach this line — and this is the last moment before the step has a
|
|
12253
12256
|
// live side effect. The signal stays in the bag, so a request already in
|
|
12254
12257
|
// flight is aborted by the transport as before.
|
|
12255
|
-
const signal = (0,
|
|
12256
|
-
(0,
|
|
12258
|
+
const signal = (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.readAbortSignal)(executeOptions);
|
|
12259
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, {
|
|
12257
12260
|
stepId
|
|
12258
12261
|
});
|
|
12259
12262
|
|
|
@@ -12274,7 +12277,7 @@ class StepExecutor {
|
|
|
12274
12277
|
// cancelled, it did not: reporting it as the abort keeps one error shape
|
|
12275
12278
|
// whether the run was withdrawn between two steps or mid-flight, and keeps
|
|
12276
12279
|
// the whole feature from reading differently per transport.
|
|
12277
|
-
;(0,
|
|
12280
|
+
;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, {
|
|
12278
12281
|
stepId
|
|
12279
12282
|
});
|
|
12280
12283
|
throw error;
|
|
@@ -12326,9 +12329,48 @@ class StepExecutor {
|
|
|
12326
12329
|
});
|
|
12327
12330
|
}
|
|
12328
12331
|
|
|
12332
|
+
/**
|
|
12333
|
+
* Throws {@link ResolverError} unless the step's `successCriteria` is absent
|
|
12334
|
+
* or a list of Criterion Objects: `malformed-criteria` for one that is
|
|
12335
|
+
* present but not a list, `malformed-criterion` for an entry that is not a
|
|
12336
|
+
* Criterion Object. Skipping an unreadable entry would turn the author's
|
|
12337
|
+
* assertion into a vacuous pass, so it is an authoring error, as an action's
|
|
12338
|
+
* unreadable `criteria` is in {@link ActionResolver}.
|
|
12339
|
+
*
|
|
12340
|
+
* Called before the step's request is sent, so no live side effect precedes
|
|
12341
|
+
* the error. Public because the workflow executor checks every step of a
|
|
12342
|
+
* workflow with it before any of them runs, a step targeting a `workflowId`
|
|
12343
|
+
* included. It passes `workflowId`, which the error then carries: step ids
|
|
12344
|
+
* are only unique within a workflow.
|
|
12345
|
+
*/
|
|
12346
|
+
assertSuccessCriteria(step, workflowId) {
|
|
12347
|
+
const criteria = step.successCriteria;
|
|
12348
|
+
if (criteria === undefined) return;
|
|
12349
|
+
const scope = {
|
|
12350
|
+
...(workflowId === undefined ? {} : {
|
|
12351
|
+
workflowId
|
|
12352
|
+
}),
|
|
12353
|
+
stepId: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.stepId),
|
|
12354
|
+
target: 'successCriteria'
|
|
12355
|
+
};
|
|
12356
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isArrayElement)(criteria)) {
|
|
12357
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_11__["default"]("A step's `successCriteria` is present but is not a list", {
|
|
12358
|
+
...scope,
|
|
12359
|
+
reason: 'malformed-criteria'
|
|
12360
|
+
});
|
|
12361
|
+
}
|
|
12362
|
+
if (![...criteria].every(_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_2__.isCriterionElement)) {
|
|
12363
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_11__["default"]("A step's `successCriteria` contains an entry that is not a Criterion Object", {
|
|
12364
|
+
...scope,
|
|
12365
|
+
reason: 'malformed-criterion'
|
|
12366
|
+
});
|
|
12367
|
+
}
|
|
12368
|
+
}
|
|
12369
|
+
|
|
12329
12370
|
/**
|
|
12330
12371
|
* Evaluates the step's `successCriteria`; all criteria must pass. A step with
|
|
12331
|
-
* no criteria succeeds on a received response.
|
|
12372
|
+
* no criteria succeeds on a received response. An unreadable
|
|
12373
|
+
* `successCriteria` throws, see {@link StepExecutor.assertSuccessCriteria}.
|
|
12332
12374
|
*
|
|
12333
12375
|
* Public for the same reason as {@link StepExecutor.selectActions}: a step
|
|
12334
12376
|
* targeting a `workflowId` is run by the workflow executor and never reaches
|
|
@@ -12336,15 +12378,12 @@ class StepExecutor {
|
|
|
12336
12378
|
* assertion about the step and must be evaluated somewhere.
|
|
12337
12379
|
*/
|
|
12338
12380
|
evaluateCriteria(step, context) {
|
|
12381
|
+
this.assertSuccessCriteria(step);
|
|
12339
12382
|
const criteria = step.successCriteria;
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
const met = this.#criterionEvaluator.evaluate(criterion, expression => this.#evaluate(context, expression));
|
|
12345
|
-
if (!met) return false;
|
|
12346
|
-
}
|
|
12347
|
-
return true;
|
|
12383
|
+
if (criteria === undefined) return true;
|
|
12384
|
+
|
|
12385
|
+
// assertSuccessCriteria above guarantees every entry is a Criterion Object
|
|
12386
|
+
return [...criteria].every(criterion => this.#criterionEvaluator.evaluate(criterion, expression => this.#evaluate(context, expression)));
|
|
12348
12387
|
}
|
|
12349
12388
|
|
|
12350
12389
|
/**
|
|
@@ -12377,7 +12416,7 @@ class StepExecutor {
|
|
|
12377
12416
|
// components. A condition on an HTTP exchange cannot apply to a step
|
|
12378
12417
|
// that calls a workflow, so the action does not match; the run does not
|
|
12379
12418
|
// abort over a default written for the operation steps.
|
|
12380
|
-
if (error instanceof
|
|
12419
|
+
if (error instanceof _errors_RuntimeExpressionError_ts__WEBPACK_IMPORTED_MODULE_12__["default"] && error.reason === 'unavailable-expression') {
|
|
12381
12420
|
return false;
|
|
12382
12421
|
}
|
|
12383
12422
|
throw error;
|
|
@@ -13279,6 +13318,10 @@ class WorkflowExecutor {
|
|
|
13279
13318
|
// at `#result` where it used to be resolved, means the throw lands before
|
|
13280
13319
|
// the first request rather than after the last.
|
|
13281
13320
|
this.#validateWorkflowOutputsShape(workflow, workflowId);
|
|
13321
|
+
// and to every step's `successCriteria`, a step calling a workflow
|
|
13322
|
+
// included: an unreadable assertion found at step three must not cost the
|
|
13323
|
+
// run the requests of steps one and two.
|
|
13324
|
+
for (const step of steps) this.#stepExecutor.assertSuccessCriteria(step, workflowId);
|
|
13282
13325
|
const dependencies = await this.#runDependencies(workflow, invocation, scope);
|
|
13283
13326
|
if (dependencies.some(dependency => this.#settledFailed(dependency))) {
|
|
13284
13327
|
// a declared prerequisite did not complete, so this workflow cannot be
|