@usearazzo/runner 1.0.1-alpha.22 → 1.0.1-alpha.24
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 +20 -0
- package/README.md +1 -1
- package/dist/arazzo-runner.browser.js +473 -293
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +4 -4
- package/src/action/ActionResolver.cjs +4 -4
- package/src/action/ActionResolver.mjs +4 -4
- package/src/criterion/CriterionEvaluator.cjs +8 -9
- package/src/criterion/CriterionEvaluator.mjs +8 -9
- package/src/criterion/JSONPathCriterionEvaluator.cjs +1 -2
- package/src/criterion/JSONPathCriterionEvaluator.mjs +1 -2
- package/src/criterion/RegexCriterionEvaluator.cjs +1 -2
- package/src/criterion/RegexCriterionEvaluator.mjs +1 -2
- package/src/criterion/SimpleCriterionEvaluator.cjs +1 -2
- package/src/criterion/SimpleCriterionEvaluator.mjs +1 -2
- package/src/criterion/XPathCriterionEvaluator.cjs +4 -5
- package/src/criterion/XPathCriterionEvaluator.mjs +4 -5
- package/src/errors/CriterionError.cjs +52 -2
- package/src/errors/CriterionError.mjs +53 -2
- package/src/errors/ExecutionError.cjs +73 -2
- package/src/errors/ExecutionError.mjs +74 -2
- package/src/errors/ResolverError.cjs +53 -2
- package/src/errors/ResolverError.mjs +54 -2
- package/src/errors/RuntimeExpressionError.cjs +32 -2
- package/src/errors/RuntimeExpressionError.mjs +33 -2
- package/src/executor/ArazzoWorkflowLocatorNormalizer.cjs +4 -4
- package/src/executor/ArazzoWorkflowLocatorNormalizer.mjs +4 -4
- package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +79 -47
- package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +80 -48
- package/src/executor/StepExecutor.cjs +42 -32
- package/src/executor/StepExecutor.mjs +42 -32
- package/src/executor/StepRetryRunner.cjs +1 -1
- package/src/executor/StepRetryRunner.mjs +1 -1
- package/src/executor/StepTransitionInterpreter.cjs +3 -3
- package/src/executor/StepTransitionInterpreter.mjs +3 -3
- package/src/executor/WorkflowCallStack.cjs +2 -2
- package/src/executor/WorkflowCallStack.mjs +2 -2
- package/src/executor/WorkflowExecutor.cjs +17 -16
- package/src/executor/WorkflowExecutor.mjs +17 -16
- package/src/executor/abort.cjs +3 -3
- package/src/executor/abort.mjs +3 -3
- package/src/expression/RuntimeExpressionEvaluator.cjs +5 -5
- package/src/expression/RuntimeExpressionEvaluator.mjs +5 -5
- package/src/index.cjs +0 -7
- package/src/index.mjs +0 -1
- package/src/resolver/OpenAPIOperationParameterResolver.cjs +6 -6
- package/src/resolver/OpenAPIOperationParameterResolver.mjs +6 -6
- package/src/resolver/OutputResolver.cjs +3 -3
- package/src/resolver/OutputResolver.mjs +3 -3
- package/src/resolver/RequestBodyResolver.cjs +6 -6
- package/src/resolver/RequestBodyResolver.mjs +6 -6
- package/src/resolver/WorkflowParameterResolver.cjs +1 -1
- package/src/resolver/WorkflowParameterResolver.mjs +1 -1
- package/types/runner.d.ts +236 -60
- package/src/criterion/CriterionErrorReason.cjs +0 -51
- package/src/criterion/CriterionErrorReason.mjs +0 -46
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.24",
|
|
4
4
|
"description": "Runner for Arazzo Workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arazzo",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"@swaggerexpert/json-pointer": "^3.0.2",
|
|
74
74
|
"@swaggerexpert/jsonpath": "^4.0.5",
|
|
75
75
|
"@swaggerexpert/media-types": "^1.0.2",
|
|
76
|
-
"@usearazzo/parser": "1.0.1-alpha.
|
|
77
|
-
"@usearazzo/resolver": "1.0.1-alpha.
|
|
76
|
+
"@usearazzo/parser": "1.0.1-alpha.24",
|
|
77
|
+
"@usearazzo/resolver": "1.0.1-alpha.24",
|
|
78
78
|
"@xmldom/xmldom": "^0.9.12",
|
|
79
79
|
"fontoxpath": "^3.34.0",
|
|
80
80
|
"ramda": "^0.32.0",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"swagger-client": "^3.38.4"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "ba457d4dfc1a0a0ccd91e38ad9b33b08d07dc3f0"
|
|
98
98
|
}
|
|
@@ -106,7 +106,7 @@ class ActionResolver {
|
|
|
106
106
|
throw new _ResolverError.default(`\`${field}\` is present but is not a list`, {
|
|
107
107
|
...scope,
|
|
108
108
|
target: field,
|
|
109
|
-
reason:
|
|
109
|
+
reason: _ResolverError.default.MalformedActions
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
const matched = [];
|
|
@@ -115,7 +115,7 @@ class ActionResolver {
|
|
|
115
115
|
throw new _ResolverError.default(`\`${field}\` contains an entry that is not a Success/Failure Action Object`, {
|
|
116
116
|
...scope,
|
|
117
117
|
target: field,
|
|
118
|
-
reason:
|
|
118
|
+
reason: _ResolverError.default.MalformedActionEntry
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
if (this.#criteriaMet(action, isCriterionMet, scope)) {
|
|
@@ -142,7 +142,7 @@ class ActionResolver {
|
|
|
142
142
|
throw new _ResolverError.default("An action's `criteria` is present but is not a list", {
|
|
143
143
|
...scope,
|
|
144
144
|
target: 'criteria',
|
|
145
|
-
reason:
|
|
145
|
+
reason: _ResolverError.default.MalformedCriteria
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
let met = true;
|
|
@@ -151,7 +151,7 @@ class ActionResolver {
|
|
|
151
151
|
throw new _ResolverError.default("An action's `criteria` contains an entry that is not a Criterion Object", {
|
|
152
152
|
...scope,
|
|
153
153
|
target: 'criteria',
|
|
154
|
-
reason:
|
|
154
|
+
reason: _ResolverError.default.MalformedCriterion
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
// every criterion is evaluated, not only up to the first unmet one, so
|
|
@@ -96,7 +96,7 @@ class ActionResolver {
|
|
|
96
96
|
throw new ResolverError(`\`${field}\` is present but is not a list`, {
|
|
97
97
|
...scope,
|
|
98
98
|
target: field,
|
|
99
|
-
reason:
|
|
99
|
+
reason: ResolverError.MalformedActions
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
const matched = [];
|
|
@@ -105,7 +105,7 @@ class ActionResolver {
|
|
|
105
105
|
throw new ResolverError(`\`${field}\` contains an entry that is not a Success/Failure Action Object`, {
|
|
106
106
|
...scope,
|
|
107
107
|
target: field,
|
|
108
|
-
reason:
|
|
108
|
+
reason: ResolverError.MalformedActionEntry
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
if (this.#criteriaMet(action, isCriterionMet, scope)) {
|
|
@@ -132,7 +132,7 @@ class ActionResolver {
|
|
|
132
132
|
throw new ResolverError("An action's `criteria` is present but is not a list", {
|
|
133
133
|
...scope,
|
|
134
134
|
target: 'criteria',
|
|
135
|
-
reason:
|
|
135
|
+
reason: ResolverError.MalformedCriteria
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
let met = true;
|
|
@@ -141,7 +141,7 @@ class ActionResolver {
|
|
|
141
141
|
throw new ResolverError("An action's `criteria` contains an entry that is not a Criterion Object", {
|
|
142
142
|
...scope,
|
|
143
143
|
target: 'criteria',
|
|
144
|
-
reason:
|
|
144
|
+
reason: ResolverError.MalformedCriterion
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
// every criterion is evaluated, not only up to the first unmet one, so
|
|
@@ -11,7 +11,6 @@ var _apidomNsArazzo = require("@speclynx/apidom-ns-arazzo-1");
|
|
|
11
11
|
var _arazzoRuntimeExpression = require("@swaggerexpert/arazzo-runtime-expression");
|
|
12
12
|
var _CriterionError = _interopRequireDefault(require("../errors/CriterionError.cjs"));
|
|
13
13
|
var _CriterionEvaluationError = _interopRequireDefault(require("../errors/CriterionEvaluationError.cjs"));
|
|
14
|
-
var _CriterionErrorReason = _interopRequireDefault(require("./CriterionErrorReason.cjs"));
|
|
15
14
|
var _RegexCriterionEvaluator = _interopRequireDefault(require("./RegexCriterionEvaluator.cjs"));
|
|
16
15
|
var _SimpleCriterionEvaluator = _interopRequireDefault(require("./SimpleCriterionEvaluator.cjs"));
|
|
17
16
|
var _JSONPathCriterionEvaluator = _interopRequireDefault(require("./JSONPathCriterionEvaluator.cjs"));
|
|
@@ -103,7 +102,7 @@ class CriterionEvaluator {
|
|
|
103
102
|
evaluate(criterion, resolve) {
|
|
104
103
|
if (!(0, _apidomNsArazzo.isCriterionElement)(criterion)) {
|
|
105
104
|
throw new _CriterionError.default('Element is not a Criterion Object', {
|
|
106
|
-
reason:
|
|
105
|
+
reason: _CriterionError.default.InvalidCriterion
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
108
|
const condition = (0, _apidomDatamodel.isStringElement)(criterion.condition) ? (0, _apidomCore.toValue)(criterion.condition) : undefined;
|
|
@@ -111,7 +110,7 @@ class CriterionEvaluator {
|
|
|
111
110
|
// (e.g. an empty regex would match unconditionally), so reject it too.
|
|
112
111
|
if (condition === undefined || condition === '') {
|
|
113
112
|
throw new _CriterionError.default('Criterion is missing a "condition"', {
|
|
114
|
-
reason:
|
|
113
|
+
reason: _CriterionError.default.MissingCondition
|
|
115
114
|
});
|
|
116
115
|
}
|
|
117
116
|
const type = this.#resolveType(criterion);
|
|
@@ -142,7 +141,7 @@ class CriterionEvaluator {
|
|
|
142
141
|
throw new _CriterionError.default(`Unknown criterion type "${type}"`, {
|
|
143
142
|
condition,
|
|
144
143
|
type,
|
|
145
|
-
reason:
|
|
144
|
+
reason: _CriterionError.default.UnknownType
|
|
146
145
|
});
|
|
147
146
|
}
|
|
148
147
|
} catch (error) {
|
|
@@ -173,7 +172,7 @@ class CriterionEvaluator {
|
|
|
173
172
|
}
|
|
174
173
|
if ((0, _apidomDatamodel.isStringElement)(type)) return (0, _apidomCore.toValue)(type);
|
|
175
174
|
throw new _CriterionError.default('Criterion has an invalid "type"', {
|
|
176
|
-
reason:
|
|
175
|
+
reason: _CriterionError.default.InvalidType
|
|
177
176
|
});
|
|
178
177
|
}
|
|
179
178
|
|
|
@@ -193,7 +192,7 @@ class CriterionEvaluator {
|
|
|
193
192
|
return (0, _apidomCore.toValue)(type.version);
|
|
194
193
|
}
|
|
195
194
|
throw new _CriterionError.default('Criterion has an invalid expression type "version"', {
|
|
196
|
-
reason:
|
|
195
|
+
reason: _CriterionError.default.InvalidVersion
|
|
197
196
|
});
|
|
198
197
|
}
|
|
199
198
|
|
|
@@ -208,7 +207,7 @@ class CriterionEvaluator {
|
|
|
208
207
|
throw new _CriterionError.default(`Unsupported ${type} version "${version}" (only ${supported})`, {
|
|
209
208
|
condition,
|
|
210
209
|
type,
|
|
211
|
-
reason:
|
|
210
|
+
reason: _CriterionError.default.UnsupportedVersion
|
|
212
211
|
});
|
|
213
212
|
}
|
|
214
213
|
}
|
|
@@ -226,7 +225,7 @@ class CriterionEvaluator {
|
|
|
226
225
|
if (!(0, _apidomDatamodel.isStringElement)(context) || !(0, _arazzoRuntimeExpression.test)((0, _apidomCore.toValue)(context))) {
|
|
227
226
|
throw new _CriterionError.default('Criterion has a "context" that is not a valid runtime expression', {
|
|
228
227
|
type,
|
|
229
|
-
reason:
|
|
228
|
+
reason: _CriterionError.default.InvalidContext
|
|
230
229
|
});
|
|
231
230
|
}
|
|
232
231
|
}
|
|
@@ -241,7 +240,7 @@ class CriterionEvaluator {
|
|
|
241
240
|
if (!(0, _apidomDatamodel.isStringElement)(criterion.context)) {
|
|
242
241
|
throw new _CriterionError.default(`Criterion type "${type}" requires a "context"`, {
|
|
243
242
|
type,
|
|
244
|
-
reason:
|
|
243
|
+
reason: _CriterionError.default.MissingContext
|
|
245
244
|
});
|
|
246
245
|
}
|
|
247
246
|
return resolve((0, _apidomCore.toValue)(criterion.context));
|
|
@@ -4,7 +4,6 @@ import { isCriterionElement, isCriterionExpressionTypeElement } from '@speclynx/
|
|
|
4
4
|
import { test as isRuntimeExpression } from '@swaggerexpert/arazzo-runtime-expression';
|
|
5
5
|
import CriterionError from "../errors/CriterionError.mjs";
|
|
6
6
|
import CriterionEvaluationError from "../errors/CriterionEvaluationError.mjs";
|
|
7
|
-
import CriterionErrorReason from "./CriterionErrorReason.mjs";
|
|
8
7
|
import RegexCriterionEvaluator from "./RegexCriterionEvaluator.mjs";
|
|
9
8
|
import SimpleCriterionEvaluator from "./SimpleCriterionEvaluator.mjs";
|
|
10
9
|
import JSONPathCriterionEvaluator from "./JSONPathCriterionEvaluator.mjs";
|
|
@@ -93,7 +92,7 @@ class CriterionEvaluator {
|
|
|
93
92
|
evaluate(criterion, resolve) {
|
|
94
93
|
if (!isCriterionElement(criterion)) {
|
|
95
94
|
throw new CriterionError('Element is not a Criterion Object', {
|
|
96
|
-
reason:
|
|
95
|
+
reason: CriterionError.InvalidCriterion
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
const condition = isStringElement(criterion.condition) ? toValue(criterion.condition) : undefined;
|
|
@@ -101,7 +100,7 @@ class CriterionEvaluator {
|
|
|
101
100
|
// (e.g. an empty regex would match unconditionally), so reject it too.
|
|
102
101
|
if (condition === undefined || condition === '') {
|
|
103
102
|
throw new CriterionError('Criterion is missing a "condition"', {
|
|
104
|
-
reason:
|
|
103
|
+
reason: CriterionError.MissingCondition
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
106
|
const type = this.#resolveType(criterion);
|
|
@@ -132,7 +131,7 @@ class CriterionEvaluator {
|
|
|
132
131
|
throw new CriterionError(`Unknown criterion type "${type}"`, {
|
|
133
132
|
condition,
|
|
134
133
|
type,
|
|
135
|
-
reason:
|
|
134
|
+
reason: CriterionError.UnknownType
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
137
|
} catch (error) {
|
|
@@ -163,7 +162,7 @@ class CriterionEvaluator {
|
|
|
163
162
|
}
|
|
164
163
|
if (isStringElement(type)) return toValue(type);
|
|
165
164
|
throw new CriterionError('Criterion has an invalid "type"', {
|
|
166
|
-
reason:
|
|
165
|
+
reason: CriterionError.InvalidType
|
|
167
166
|
});
|
|
168
167
|
}
|
|
169
168
|
|
|
@@ -183,7 +182,7 @@ class CriterionEvaluator {
|
|
|
183
182
|
return toValue(type.version);
|
|
184
183
|
}
|
|
185
184
|
throw new CriterionError('Criterion has an invalid expression type "version"', {
|
|
186
|
-
reason:
|
|
185
|
+
reason: CriterionError.InvalidVersion
|
|
187
186
|
});
|
|
188
187
|
}
|
|
189
188
|
|
|
@@ -198,7 +197,7 @@ class CriterionEvaluator {
|
|
|
198
197
|
throw new CriterionError(`Unsupported ${type} version "${version}" (only ${supported})`, {
|
|
199
198
|
condition,
|
|
200
199
|
type,
|
|
201
|
-
reason:
|
|
200
|
+
reason: CriterionError.UnsupportedVersion
|
|
202
201
|
});
|
|
203
202
|
}
|
|
204
203
|
}
|
|
@@ -216,7 +215,7 @@ class CriterionEvaluator {
|
|
|
216
215
|
if (!isStringElement(context) || !isRuntimeExpression(toValue(context))) {
|
|
217
216
|
throw new CriterionError('Criterion has a "context" that is not a valid runtime expression', {
|
|
218
217
|
type,
|
|
219
|
-
reason:
|
|
218
|
+
reason: CriterionError.InvalidContext
|
|
220
219
|
});
|
|
221
220
|
}
|
|
222
221
|
}
|
|
@@ -231,7 +230,7 @@ class CriterionEvaluator {
|
|
|
231
230
|
if (!isStringElement(criterion.context)) {
|
|
232
231
|
throw new CriterionError(`Criterion type "${type}" requires a "context"`, {
|
|
233
232
|
type,
|
|
234
|
-
reason:
|
|
233
|
+
reason: CriterionError.MissingContext
|
|
235
234
|
});
|
|
236
235
|
}
|
|
237
236
|
return resolve(toValue(criterion.context));
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _jsonpath = require("@swaggerexpert/jsonpath");
|
|
9
9
|
var _CriterionEvaluationError = _interopRequireDefault(require("../errors/CriterionEvaluationError.cjs"));
|
|
10
|
-
var _CriterionErrorReason = _interopRequireDefault(require("./CriterionErrorReason.cjs"));
|
|
11
10
|
/**
|
|
12
11
|
* Evaluates a `jsonpath` Arazzo criterion condition against a resolved context value.
|
|
13
12
|
*
|
|
@@ -41,7 +40,7 @@ class JSONPathCriterionEvaluator {
|
|
|
41
40
|
cause: error,
|
|
42
41
|
condition,
|
|
43
42
|
type: 'jsonpath',
|
|
44
|
-
reason:
|
|
43
|
+
reason: _CriterionEvaluationError.default.InvalidJSONPath
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
throw error;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { evaluate as evaluateJSONPath, JSONPathError, JSONPathParseError } from '@swaggerexpert/jsonpath';
|
|
2
2
|
import CriterionEvaluationError from "../errors/CriterionEvaluationError.mjs";
|
|
3
|
-
import CriterionErrorReason from "./CriterionErrorReason.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* Evaluates a `jsonpath` Arazzo criterion condition against a resolved context value.
|
|
6
5
|
*
|
|
@@ -34,7 +33,7 @@ class JSONPathCriterionEvaluator {
|
|
|
34
33
|
cause: error,
|
|
35
34
|
condition,
|
|
36
35
|
type: 'jsonpath',
|
|
37
|
-
reason:
|
|
36
|
+
reason: CriterionEvaluationError.InvalidJSONPath
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
throw error;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _CriterionEvaluationError = _interopRequireDefault(require("../errors/CriterionEvaluationError.cjs"));
|
|
9
|
-
var _CriterionErrorReason = _interopRequireDefault(require("./CriterionErrorReason.cjs"));
|
|
10
9
|
/**
|
|
11
10
|
* Evaluates a `regex` Arazzo criterion condition against a resolved context value.
|
|
12
11
|
*
|
|
@@ -49,7 +48,7 @@ class RegexCriterionEvaluator {
|
|
|
49
48
|
cause: error,
|
|
50
49
|
condition,
|
|
51
50
|
type: 'regex',
|
|
52
|
-
reason:
|
|
51
|
+
reason: _CriterionEvaluationError.default.InvalidRegex
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
54
|
return regExp.test(this.#stringify(context));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import CriterionEvaluationError from "../errors/CriterionEvaluationError.mjs";
|
|
2
|
-
import CriterionErrorReason from "./CriterionErrorReason.mjs";
|
|
3
2
|
/**
|
|
4
3
|
* Evaluates a `regex` Arazzo criterion condition against a resolved context value.
|
|
5
4
|
*
|
|
@@ -42,7 +41,7 @@ class RegexCriterionEvaluator {
|
|
|
42
41
|
cause: error,
|
|
43
42
|
condition,
|
|
44
43
|
type: 'regex',
|
|
45
|
-
reason:
|
|
44
|
+
reason: CriterionEvaluationError.InvalidRegex
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
return regExp.test(this.#stringify(context));
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _arazzoCriterion = require("@swaggerexpert/arazzo-criterion");
|
|
9
9
|
var _CriterionEvaluationError = _interopRequireDefault(require("../errors/CriterionEvaluationError.cjs"));
|
|
10
|
-
var _CriterionErrorReason = _interopRequireDefault(require("./CriterionErrorReason.cjs"));
|
|
11
10
|
/**
|
|
12
11
|
* Evaluates a `simple` Arazzo criterion condition.
|
|
13
12
|
*
|
|
@@ -41,7 +40,7 @@ class SimpleCriterionEvaluator {
|
|
|
41
40
|
cause: error,
|
|
42
41
|
condition,
|
|
43
42
|
type: 'simple',
|
|
44
|
-
reason:
|
|
43
|
+
reason: _CriterionEvaluationError.default.InvalidSimple
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
throw error;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { evaluate as evaluateSimpleCriterion, ArazzoCriterionError } from '@swaggerexpert/arazzo-criterion';
|
|
2
2
|
import CriterionEvaluationError from "../errors/CriterionEvaluationError.mjs";
|
|
3
|
-
import CriterionErrorReason from "./CriterionErrorReason.mjs";
|
|
4
3
|
/**
|
|
5
4
|
* Evaluates a `simple` Arazzo criterion condition.
|
|
6
5
|
*
|
|
@@ -34,7 +33,7 @@ class SimpleCriterionEvaluator {
|
|
|
34
33
|
cause: error,
|
|
35
34
|
condition,
|
|
36
35
|
type: 'simple',
|
|
37
|
-
reason:
|
|
36
|
+
reason: CriterionEvaluationError.InvalidSimple
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
throw error;
|
|
@@ -8,7 +8,6 @@ exports.default = void 0;
|
|
|
8
8
|
var _fontoxpath = _interopRequireDefault(require("fontoxpath"));
|
|
9
9
|
var _xmldom = require("@xmldom/xmldom");
|
|
10
10
|
var _CriterionEvaluationError = _interopRequireDefault(require("../errors/CriterionEvaluationError.cjs"));
|
|
11
|
-
var _CriterionErrorReason = _interopRequireDefault(require("./CriterionErrorReason.cjs"));
|
|
12
11
|
// fontoxpath is CommonJS and its named exports are not statically resolvable
|
|
13
12
|
// under ESM, so import the default and destructure.
|
|
14
13
|
|
|
@@ -55,7 +54,7 @@ class XPathCriterionEvaluator {
|
|
|
55
54
|
cause: error,
|
|
56
55
|
condition,
|
|
57
56
|
type: 'xpath',
|
|
58
|
-
reason:
|
|
57
|
+
reason: _CriterionEvaluationError.default.InvalidXPath
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -71,7 +70,7 @@ class XPathCriterionEvaluator {
|
|
|
71
70
|
throw new _CriterionEvaluationError.default('xpath criterion context is not XML', {
|
|
72
71
|
condition,
|
|
73
72
|
type: 'xpath',
|
|
74
|
-
reason:
|
|
73
|
+
reason: _CriterionEvaluationError.default.InvalidXPathContext
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -91,7 +90,7 @@ class XPathCriterionEvaluator {
|
|
|
91
90
|
cause: parseError,
|
|
92
91
|
condition,
|
|
93
92
|
type: 'xpath',
|
|
94
|
-
reason:
|
|
93
|
+
reason: _CriterionEvaluationError.default.InvalidXPathContext
|
|
95
94
|
});
|
|
96
95
|
}
|
|
97
96
|
return document;
|
|
@@ -101,7 +100,7 @@ class XPathCriterionEvaluator {
|
|
|
101
100
|
cause: error,
|
|
102
101
|
condition,
|
|
103
102
|
type: 'xpath',
|
|
104
|
-
reason:
|
|
103
|
+
reason: _CriterionEvaluationError.default.InvalidXPathContext
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
106
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import fontoxpath from 'fontoxpath';
|
|
4
4
|
import { DOMParser } from '@xmldom/xmldom';
|
|
5
5
|
import CriterionEvaluationError from "../errors/CriterionEvaluationError.mjs";
|
|
6
|
-
import CriterionErrorReason from "./CriterionErrorReason.mjs";
|
|
7
6
|
const {
|
|
8
7
|
evaluateXPathToBoolean,
|
|
9
8
|
evaluateXPath
|
|
@@ -47,7 +46,7 @@ class XPathCriterionEvaluator {
|
|
|
47
46
|
cause: error,
|
|
48
47
|
condition,
|
|
49
48
|
type: 'xpath',
|
|
50
|
-
reason:
|
|
49
|
+
reason: CriterionEvaluationError.InvalidXPath
|
|
51
50
|
});
|
|
52
51
|
}
|
|
53
52
|
}
|
|
@@ -63,7 +62,7 @@ class XPathCriterionEvaluator {
|
|
|
63
62
|
throw new CriterionEvaluationError('xpath criterion context is not XML', {
|
|
64
63
|
condition,
|
|
65
64
|
type: 'xpath',
|
|
66
|
-
reason:
|
|
65
|
+
reason: CriterionEvaluationError.InvalidXPathContext
|
|
67
66
|
});
|
|
68
67
|
}
|
|
69
68
|
|
|
@@ -83,7 +82,7 @@ class XPathCriterionEvaluator {
|
|
|
83
82
|
cause: parseError,
|
|
84
83
|
condition,
|
|
85
84
|
type: 'xpath',
|
|
86
|
-
reason:
|
|
85
|
+
reason: CriterionEvaluationError.InvalidXPathContext
|
|
87
86
|
});
|
|
88
87
|
}
|
|
89
88
|
return document;
|
|
@@ -93,7 +92,7 @@ class XPathCriterionEvaluator {
|
|
|
93
92
|
cause: error,
|
|
94
93
|
condition,
|
|
95
94
|
type: 'xpath',
|
|
96
|
-
reason:
|
|
95
|
+
reason: CriterionEvaluationError.InvalidXPathContext
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -6,6 +6,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
|
|
9
|
-
/**
|
|
10
|
-
class
|
|
9
|
+
/**
|
|
10
|
+
* Carries a `reason`, one of the class's static reason fields.
|
|
11
|
+
*
|
|
12
|
+
* Every static on this class is a reason: {@link CriterionErrorReason} is
|
|
13
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
14
|
+
* union.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class CriterionError extends _ArazzoRunnerError.default {
|
|
18
|
+
/** The element is not a Criterion Object. */
|
|
19
|
+
static InvalidCriterion = 'invalid-criterion';
|
|
20
|
+
/** The `condition` is missing or empty. */
|
|
21
|
+
static MissingCondition = 'missing-condition';
|
|
22
|
+
/** The `type` is present but unreadable. */
|
|
23
|
+
static InvalidType = 'invalid-type';
|
|
24
|
+
/** The `type` names no known criterion type. */
|
|
25
|
+
static UnknownType = 'unknown-type';
|
|
26
|
+
/** The expression type `version` is present but not a string. */
|
|
27
|
+
static InvalidVersion = 'invalid-version';
|
|
28
|
+
/** The expression type `version` is not the one this runner supports. */
|
|
29
|
+
static UnsupportedVersion = 'unsupported-version';
|
|
30
|
+
/** The `context` is not a runtime expression. */
|
|
31
|
+
static InvalidContext = 'invalid-context';
|
|
32
|
+
/** A `regex`, `jsonpath` or `xpath` criterion has no `context`. */
|
|
33
|
+
static MissingContext = 'missing-context';
|
|
34
|
+
/** The `simple` condition cannot be parsed. */
|
|
35
|
+
static InvalidSimple = 'invalid-simple';
|
|
36
|
+
/** The `regex` condition is not a valid regular expression. */
|
|
37
|
+
static InvalidRegex = 'invalid-regex';
|
|
38
|
+
/** The `jsonpath` condition is not a valid JSONPath query. */
|
|
39
|
+
static InvalidJSONPath = 'invalid-jsonpath';
|
|
40
|
+
/** The `xpath` condition is invalid or fails to evaluate. */
|
|
41
|
+
static InvalidXPath = 'invalid-xpath';
|
|
42
|
+
/** The resolved `xpath` context is not XML. */
|
|
43
|
+
static InvalidXPathContext = 'invalid-xpath-context';
|
|
44
|
+
constructor(message, options) {
|
|
45
|
+
super(message, options);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* One of the reasons a {@link CriterionError} carries: a `CriterionError`
|
|
51
|
+
* static such as `CriterionError.InvalidRegex`.
|
|
52
|
+
*
|
|
53
|
+
* Structural reasons mark a criterion that is malformed as written; they are
|
|
54
|
+
* thrown as a plain `CriterionError`. Evaluation reasons (`InvalidSimple`,
|
|
55
|
+
* `InvalidRegex`, `InvalidJSONPath`, `InvalidXPath`, `InvalidXPathContext`) mark
|
|
56
|
+
* a condition that cannot be evaluated; they are thrown as a
|
|
57
|
+
* {@link CriterionEvaluationError}, which `CriterionEvaluator` turns into an
|
|
58
|
+
* unmet criterion.
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
11
61
|
var _default = exports.default = CriterionError;
|
|
@@ -1,4 +1,55 @@
|
|
|
1
1
|
import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
|
|
2
|
-
/**
|
|
3
|
-
class
|
|
2
|
+
/**
|
|
3
|
+
* Carries a `reason`, one of the class's static reason fields.
|
|
4
|
+
*
|
|
5
|
+
* Every static on this class is a reason: {@link CriterionErrorReason} is
|
|
6
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
7
|
+
* union.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class CriterionError extends ArazzoRunnerError {
|
|
11
|
+
/** The element is not a Criterion Object. */
|
|
12
|
+
static InvalidCriterion = 'invalid-criterion';
|
|
13
|
+
/** The `condition` is missing or empty. */
|
|
14
|
+
static MissingCondition = 'missing-condition';
|
|
15
|
+
/** The `type` is present but unreadable. */
|
|
16
|
+
static InvalidType = 'invalid-type';
|
|
17
|
+
/** The `type` names no known criterion type. */
|
|
18
|
+
static UnknownType = 'unknown-type';
|
|
19
|
+
/** The expression type `version` is present but not a string. */
|
|
20
|
+
static InvalidVersion = 'invalid-version';
|
|
21
|
+
/** The expression type `version` is not the one this runner supports. */
|
|
22
|
+
static UnsupportedVersion = 'unsupported-version';
|
|
23
|
+
/** The `context` is not a runtime expression. */
|
|
24
|
+
static InvalidContext = 'invalid-context';
|
|
25
|
+
/** A `regex`, `jsonpath` or `xpath` criterion has no `context`. */
|
|
26
|
+
static MissingContext = 'missing-context';
|
|
27
|
+
/** The `simple` condition cannot be parsed. */
|
|
28
|
+
static InvalidSimple = 'invalid-simple';
|
|
29
|
+
/** The `regex` condition is not a valid regular expression. */
|
|
30
|
+
static InvalidRegex = 'invalid-regex';
|
|
31
|
+
/** The `jsonpath` condition is not a valid JSONPath query. */
|
|
32
|
+
static InvalidJSONPath = 'invalid-jsonpath';
|
|
33
|
+
/** The `xpath` condition is invalid or fails to evaluate. */
|
|
34
|
+
static InvalidXPath = 'invalid-xpath';
|
|
35
|
+
/** The resolved `xpath` context is not XML. */
|
|
36
|
+
static InvalidXPathContext = 'invalid-xpath-context';
|
|
37
|
+
constructor(message, options) {
|
|
38
|
+
super(message, options);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* One of the reasons a {@link CriterionError} carries: a `CriterionError`
|
|
44
|
+
* static such as `CriterionError.InvalidRegex`.
|
|
45
|
+
*
|
|
46
|
+
* Structural reasons mark a criterion that is malformed as written; they are
|
|
47
|
+
* thrown as a plain `CriterionError`. Evaluation reasons (`InvalidSimple`,
|
|
48
|
+
* `InvalidRegex`, `InvalidJSONPath`, `InvalidXPath`, `InvalidXPathContext`) mark
|
|
49
|
+
* a condition that cannot be evaluated; they are thrown as a
|
|
50
|
+
* {@link CriterionEvaluationError}, which `CriterionEvaluator` turns into an
|
|
51
|
+
* unmet criterion.
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
|
|
4
55
|
export default CriterionError;
|
|
@@ -6,6 +6,77 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
|
|
9
|
-
/**
|
|
10
|
-
class
|
|
9
|
+
/**
|
|
10
|
+
* Carries a `reason`, one of the class's static reason fields.
|
|
11
|
+
*
|
|
12
|
+
* Every static on this class is a reason: {@link ExecutionErrorReason} is
|
|
13
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
14
|
+
* union.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class ExecutionError extends _ArazzoRunnerError.default {
|
|
18
|
+
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
19
|
+
static Aborted = 'aborted';
|
|
20
|
+
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
21
|
+
static AmbiguousTarget = 'ambiguous-target';
|
|
22
|
+
/** The `dependsOn` edges alone form a cycle between workflows. */
|
|
23
|
+
static DependsOnCycle = 'dependsOn-cycle';
|
|
24
|
+
/** A `goto` action declares neither a `stepId` nor a `workflowId`. */
|
|
25
|
+
static GotoTargetMissing = 'goto-target-missing';
|
|
26
|
+
/** A `goto` action's `stepId` names no step in the workflow. */
|
|
27
|
+
static GotoTargetNotFound = 'goto-target-not-found';
|
|
28
|
+
/** An `operationId` or `operationPath` is not a valid operation reference. */
|
|
29
|
+
static InvalidOperationReference = 'invalid-operation-reference';
|
|
30
|
+
/** A `workflowId` is not a valid `$sourceDescriptions.{name}.{workflowId}` expression. */
|
|
31
|
+
static InvalidWorkflowReference = 'invalid-workflow-reference';
|
|
32
|
+
/** A workflow's `dependsOn` is not a list or holds a non-string entry. */
|
|
33
|
+
static MalformedDependsOn = 'malformed-dependsOn';
|
|
34
|
+
/** A workflow's `steps` is not a list or holds an entry that is not a Step Object. */
|
|
35
|
+
static MalformedSteps = 'malformed-steps';
|
|
36
|
+
/** A step run as an operation declares neither an `operationId` nor an `operationPath`. */
|
|
37
|
+
static MissingOperation = 'missing-operation';
|
|
38
|
+
/** An operation reference locates no operation in its OpenAPI source description. */
|
|
39
|
+
static OperationNotFound = 'operation-not-found';
|
|
40
|
+
/** A `retry` action references a step or workflow, but no run reference was given to run it. */
|
|
41
|
+
static RetryReferenceUnsupported = 'retry-reference-unsupported';
|
|
42
|
+
/** A `retry` action's `stepId` names no step in the workflow. */
|
|
43
|
+
static RetryTargetNotFound = 'retry-target-not-found';
|
|
44
|
+
/** A workflow reference names a source description that is not an Arazzo document. */
|
|
45
|
+
static SourceDescriptionNotArazzo = 'source-description-not-arazzo';
|
|
46
|
+
/** A reference names a source description the Arazzo document does not define. */
|
|
47
|
+
static SourceDescriptionNotFound = 'source-description-not-found';
|
|
48
|
+
/** An operation reference names a source description that is not an OpenAPI document. */
|
|
49
|
+
static SourceDescriptionNotOpenAPI = 'source-description-not-openapi';
|
|
50
|
+
/** A workflow exceeded its budget of step attempts. */
|
|
51
|
+
static StepBudget = 'step-budget';
|
|
52
|
+
/** An action declares a `type` other than `end`, `goto` or `retry`. */
|
|
53
|
+
static UnknownActionType = 'unknown-action-type';
|
|
54
|
+
/** `execute` received an option it does not know. */
|
|
55
|
+
static UnknownExecuteOption = 'unknown-execute-option';
|
|
56
|
+
/** A step produced a transition the workflow executor does not recognize. */
|
|
57
|
+
static UnknownTransitionKind = 'unknown-transition-kind';
|
|
58
|
+
/** A sub-workflow call (alone or together with `dependsOn`) forms a cycle between workflows. */
|
|
59
|
+
static WorkflowCycle = 'workflow-cycle';
|
|
60
|
+
/** Workflows nest deeper than the configured limit. */
|
|
61
|
+
static WorkflowDepth = 'workflow-depth';
|
|
62
|
+
/** A workflow reference names a workflow the Arazzo document does not define. */
|
|
63
|
+
static WorkflowNotFound = 'workflow-not-found';
|
|
64
|
+
/** A step that targets a workflow was handed to the step executor, which runs operations only. */
|
|
65
|
+
static WorkflowStep = 'workflow-step';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The chain of workflowIds the error concerns — the loop A → B → A for a
|
|
69
|
+
* cycle, or the call chain in progress when a budget ran out.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
constructor(message, options) {
|
|
73
|
+
super(message, options);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* One of the reasons an {@link ExecutionError} carries: an `ExecutionError`
|
|
79
|
+
* static such as `ExecutionError.OperationNotFound`.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
11
82
|
var _default = exports.default = ExecutionError;
|