@usearazzo/runner 1.0.1-alpha.37 → 1.0.1-alpha.38
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 +25 -8
- 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/WorkflowExecutor.cjs +24 -7
- package/src/executor/WorkflowExecutor.mjs +24 -7
- package/src/version.cjs +1 -1
- package/src/version.mjs +1 -1
- package/types/runner.d.cts +1 -1
- package/types/runner.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usearazzo/runner",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.38",
|
|
4
4
|
"description": "Runner for Arazzo Workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arazzo",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
"@swaggerexpert/json-pointer": "^3.0.3",
|
|
113
113
|
"@swaggerexpert/jsonpath": "^4.1.0",
|
|
114
114
|
"@swaggerexpert/media-types": "^1.0.3",
|
|
115
|
-
"@usearazzo/parser": "1.0.1-alpha.
|
|
116
|
-
"@usearazzo/resolver": "1.0.1-alpha.
|
|
115
|
+
"@usearazzo/parser": "1.0.1-alpha.38",
|
|
116
|
+
"@usearazzo/resolver": "1.0.1-alpha.38",
|
|
117
117
|
"@xmldom/xmldom": "^0.9.12",
|
|
118
118
|
"fontoxpath": "^3.34.0",
|
|
119
119
|
"ramda": "^0.32.0",
|
|
@@ -148,5 +148,5 @@
|
|
|
148
148
|
"@opentelemetry/sdk-trace-base": "^2.12.0",
|
|
149
149
|
"swagger-client": "^3.39.0"
|
|
150
150
|
},
|
|
151
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "e6f5880ca7ab04dd04bc1d559fa7574d15fc8203"
|
|
152
152
|
}
|
|
@@ -35,7 +35,7 @@ class ExecutionError extends _ArazzoRunnerError.default {
|
|
|
35
35
|
static InvalidWorkflowReference = 'invalid-workflow-reference';
|
|
36
36
|
/** A workflow's `dependsOn` is not a list or holds a non-string entry. */
|
|
37
37
|
static MalformedDependsOn = 'malformed-dependsOn';
|
|
38
|
-
/** A workflow's `steps` is not a list or holds an entry that is not a Step Object. */
|
|
38
|
+
/** A workflow's `steps` is absent, empty, not a list, or holds an entry that is not a Step Object. */
|
|
39
39
|
static MalformedSteps = 'malformed-steps';
|
|
40
40
|
/** A step run as an operation declares neither an `operationId` nor an `operationPath`. */
|
|
41
41
|
static MissingOperation = 'missing-operation';
|
|
@@ -28,7 +28,7 @@ class ExecutionError extends ArazzoRunnerError {
|
|
|
28
28
|
static InvalidWorkflowReference = 'invalid-workflow-reference';
|
|
29
29
|
/** A workflow's `dependsOn` is not a list or holds a non-string entry. */
|
|
30
30
|
static MalformedDependsOn = 'malformed-dependsOn';
|
|
31
|
-
/** A workflow's `steps` is not a list or holds an entry that is not a Step Object. */
|
|
31
|
+
/** A workflow's `steps` is absent, empty, not a list, or holds an entry that is not a Step Object. */
|
|
32
32
|
static MalformedSteps = 'malformed-steps';
|
|
33
33
|
/** A step run as an operation declares neither an `operationId` nor an `operationPath`. */
|
|
34
34
|
static MissingOperation = 'missing-operation';
|
|
@@ -902,8 +902,8 @@ class WorkflowExecutor {
|
|
|
902
902
|
* it is named a call cycle, not a dependency one, and charged one unit
|
|
903
903
|
* for entering the reference itself, matching the "1 for the step itself
|
|
904
904
|
* plus whatever its sub-run spends" convention a sub-workflow step
|
|
905
|
-
* already follows (without it, a reference to a workflow
|
|
906
|
-
*
|
|
905
|
+
* already follows (without it, a reference to a one-step workflow would
|
|
906
|
+
* cost no more than that step to fire). Its inputs are the
|
|
907
907
|
* action's `parameters` (`#115`), resolved again on every firing
|
|
908
908
|
* against the attempt that fired it — `{}` without them. Its outputs are
|
|
909
909
|
* recorded via `state.setWorkflow`, which *is* "context transfers back",
|
|
@@ -1525,13 +1525,24 @@ class WorkflowExecutor {
|
|
|
1525
1525
|
}
|
|
1526
1526
|
|
|
1527
1527
|
/**
|
|
1528
|
-
* The workflow's steps as an array in list order.
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1528
|
+
* The workflow's steps as an array in list order. `steps` is a REQUIRED field
|
|
1529
|
+
* holding at least one step, and the validator reports an absent or empty one
|
|
1530
|
+
* as an Error, so neither runs as a completed no-op. Those, like a `steps`
|
|
1531
|
+
* that is not a list or holds a non-step entry, are authoring errors and
|
|
1532
|
+
* throw rather than being silently treated as empty or partial.
|
|
1533
|
+
*
|
|
1534
|
+
* Checked when the workflow is entered, before any of its own prerequisites
|
|
1535
|
+
* or steps. A workflow another one only references (a `goto` target, a retry
|
|
1536
|
+
* reference) is therefore rejected when the run reaches it, after the
|
|
1537
|
+
* requests sent on the way there.
|
|
1532
1538
|
*/
|
|
1533
1539
|
#orderedSteps(workflow, workflowId) {
|
|
1534
|
-
if (!workflow.hasKey('steps'))
|
|
1540
|
+
if (!workflow.hasKey('steps')) {
|
|
1541
|
+
throw new _ExecutionError.default(`workflow "${workflowId}" has no "steps"`, {
|
|
1542
|
+
workflowId,
|
|
1543
|
+
reason: _ExecutionError.default.MalformedSteps
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1535
1546
|
const steps = workflow.steps;
|
|
1536
1547
|
if (!(0, _apidomDatamodel.isArrayElement)(steps)) {
|
|
1537
1548
|
throw new _ExecutionError.default(`workflow "${workflowId}" has a non-list "steps"`, {
|
|
@@ -1539,6 +1550,12 @@ class WorkflowExecutor {
|
|
|
1539
1550
|
reason: _ExecutionError.default.MalformedSteps
|
|
1540
1551
|
});
|
|
1541
1552
|
}
|
|
1553
|
+
if (steps.isEmpty) {
|
|
1554
|
+
throw new _ExecutionError.default(`workflow "${workflowId}" has an empty "steps"`, {
|
|
1555
|
+
workflowId,
|
|
1556
|
+
reason: _ExecutionError.default.MalformedSteps
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1542
1559
|
return [...steps].map((step, index) => {
|
|
1543
1560
|
if (!(0, _apidomNsArazzo.isStepElement)(step)) {
|
|
1544
1561
|
throw new _ExecutionError.default(`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
|
|
@@ -888,8 +888,8 @@ class WorkflowExecutor {
|
|
|
888
888
|
* it is named a call cycle, not a dependency one, and charged one unit
|
|
889
889
|
* for entering the reference itself, matching the "1 for the step itself
|
|
890
890
|
* plus whatever its sub-run spends" convention a sub-workflow step
|
|
891
|
-
* already follows (without it, a reference to a workflow
|
|
892
|
-
*
|
|
891
|
+
* already follows (without it, a reference to a one-step workflow would
|
|
892
|
+
* cost no more than that step to fire). Its inputs are the
|
|
893
893
|
* action's `parameters` (`#115`), resolved again on every firing
|
|
894
894
|
* against the attempt that fired it — `{}` without them. Its outputs are
|
|
895
895
|
* recorded via `state.setWorkflow`, which *is* "context transfers back",
|
|
@@ -1511,13 +1511,24 @@ class WorkflowExecutor {
|
|
|
1511
1511
|
}
|
|
1512
1512
|
|
|
1513
1513
|
/**
|
|
1514
|
-
* The workflow's steps as an array in list order.
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1514
|
+
* The workflow's steps as an array in list order. `steps` is a REQUIRED field
|
|
1515
|
+
* holding at least one step, and the validator reports an absent or empty one
|
|
1516
|
+
* as an Error, so neither runs as a completed no-op. Those, like a `steps`
|
|
1517
|
+
* that is not a list or holds a non-step entry, are authoring errors and
|
|
1518
|
+
* throw rather than being silently treated as empty or partial.
|
|
1519
|
+
*
|
|
1520
|
+
* Checked when the workflow is entered, before any of its own prerequisites
|
|
1521
|
+
* or steps. A workflow another one only references (a `goto` target, a retry
|
|
1522
|
+
* reference) is therefore rejected when the run reaches it, after the
|
|
1523
|
+
* requests sent on the way there.
|
|
1518
1524
|
*/
|
|
1519
1525
|
#orderedSteps(workflow, workflowId) {
|
|
1520
|
-
if (!workflow.hasKey('steps'))
|
|
1526
|
+
if (!workflow.hasKey('steps')) {
|
|
1527
|
+
throw new ExecutionError(`workflow "${workflowId}" has no "steps"`, {
|
|
1528
|
+
workflowId,
|
|
1529
|
+
reason: ExecutionError.MalformedSteps
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1521
1532
|
const steps = workflow.steps;
|
|
1522
1533
|
if (!isArrayElement(steps)) {
|
|
1523
1534
|
throw new ExecutionError(`workflow "${workflowId}" has a non-list "steps"`, {
|
|
@@ -1525,6 +1536,12 @@ class WorkflowExecutor {
|
|
|
1525
1536
|
reason: ExecutionError.MalformedSteps
|
|
1526
1537
|
});
|
|
1527
1538
|
}
|
|
1539
|
+
if (steps.isEmpty) {
|
|
1540
|
+
throw new ExecutionError(`workflow "${workflowId}" has an empty "steps"`, {
|
|
1541
|
+
workflowId,
|
|
1542
|
+
reason: ExecutionError.MalformedSteps
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1528
1545
|
return [...steps].map((step, index) => {
|
|
1529
1546
|
if (!isStepElement(step)) {
|
|
1530
1547
|
throw new ExecutionError(`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
|
package/src/version.cjs
CHANGED
|
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
// generated by scripts/version-update.mjs from package.json; do not edit
|
|
8
|
-
const version = '1.0.1-alpha.
|
|
8
|
+
const version = '1.0.1-alpha.37';
|
|
9
9
|
var _default = exports.default = version;
|
package/src/version.mjs
CHANGED
package/types/runner.d.cts
CHANGED
|
@@ -1136,7 +1136,7 @@ export declare class ExecutionError extends ArazzoRunnerError {
|
|
|
1136
1136
|
static readonly InvalidWorkflowReference: "invalid-workflow-reference";
|
|
1137
1137
|
/** A workflow's `dependsOn` is not a list or holds a non-string entry. */
|
|
1138
1138
|
static readonly MalformedDependsOn: "malformed-dependsOn";
|
|
1139
|
-
/** A workflow's `steps` is not a list or holds an entry that is not a Step Object. */
|
|
1139
|
+
/** A workflow's `steps` is absent, empty, not a list, or holds an entry that is not a Step Object. */
|
|
1140
1140
|
static readonly MalformedSteps: "malformed-steps";
|
|
1141
1141
|
/** A step run as an operation declares neither an `operationId` nor an `operationPath`. */
|
|
1142
1142
|
static readonly MissingOperation: "missing-operation";
|
package/types/runner.d.ts
CHANGED
|
@@ -1136,7 +1136,7 @@ export declare class ExecutionError extends ArazzoRunnerError {
|
|
|
1136
1136
|
static readonly InvalidWorkflowReference: "invalid-workflow-reference";
|
|
1137
1137
|
/** A workflow's `dependsOn` is not a list or holds a non-string entry. */
|
|
1138
1138
|
static readonly MalformedDependsOn: "malformed-dependsOn";
|
|
1139
|
-
/** A workflow's `steps` is not a list or holds an entry that is not a Step Object. */
|
|
1139
|
+
/** A workflow's `steps` is absent, empty, not a list, or holds an entry that is not a Step Object. */
|
|
1140
1140
|
static readonly MalformedSteps: "malformed-steps";
|
|
1141
1141
|
/** A step run as an operation declares neither an `operationId` nor an `operationPath`. */
|
|
1142
1142
|
static readonly MissingOperation: "missing-operation";
|