@usearazzo/runner 1.0.1-alpha.18 → 1.0.1-alpha.20
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 +18 -0
- package/README.md +1 -1
- package/dist/arazzo-runner.browser.js +336 -179
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +14 -14
- package/src/criterion/CriterionErrorReason.cjs +51 -0
- package/src/criterion/CriterionErrorReason.mjs +46 -0
- package/src/criterion/CriterionEvaluator.cjs +63 -36
- package/src/criterion/CriterionEvaluator.mjs +63 -36
- package/src/criterion/JSONPathCriterionEvaluator.cjs +5 -4
- package/src/criterion/JSONPathCriterionEvaluator.mjs +5 -4
- package/src/criterion/RegexCriterionEvaluator.cjs +5 -4
- package/src/criterion/RegexCriterionEvaluator.mjs +5 -4
- package/src/criterion/SimpleCriterionEvaluator.cjs +5 -4
- package/src/criterion/SimpleCriterionEvaluator.mjs +5 -4
- package/src/criterion/XPathCriterionEvaluator.cjs +13 -12
- package/src/criterion/XPathCriterionEvaluator.mjs +13 -12
- package/src/errors/CriterionEvaluationError.cjs +18 -0
- package/src/errors/CriterionEvaluationError.mjs +11 -0
- package/src/index.cjs +14 -0
- package/src/index.mjs +2 -0
- package/src/vendor/swagger-client.cjs +1 -1
- package/src/vendor/swagger-client.mjs +1 -1
- package/types/runner.d.ts +85 -10
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _arazzoCriterion = require("@swaggerexpert/arazzo-criterion");
|
|
9
|
-
var
|
|
9
|
+
var _CriterionEvaluationError = _interopRequireDefault(require("../errors/CriterionEvaluationError.cjs"));
|
|
10
|
+
var _CriterionErrorReason = _interopRequireDefault(require("./CriterionErrorReason.cjs"));
|
|
10
11
|
/**
|
|
11
12
|
* Evaluates a `simple` Arazzo criterion condition.
|
|
12
13
|
*
|
|
@@ -21,7 +22,7 @@ var _CriterionError = _interopRequireDefault(require("../errors/CriterionError.c
|
|
|
21
22
|
* compared per the library's rules (e.g. `undefined == x` and relational
|
|
22
23
|
* comparisons are false, matching the spec's "null equals only null"), so a
|
|
23
24
|
* negated or disjunctive condition may still pass. A malformed condition throws
|
|
24
|
-
* {@link
|
|
25
|
+
* {@link CriterionEvaluationError}.
|
|
25
26
|
* @public
|
|
26
27
|
*/
|
|
27
28
|
class SimpleCriterionEvaluator {
|
|
@@ -36,11 +37,11 @@ class SimpleCriterionEvaluator {
|
|
|
36
37
|
});
|
|
37
38
|
} catch (error) {
|
|
38
39
|
if (error instanceof _arazzoCriterion.ArazzoCriterionError) {
|
|
39
|
-
throw new
|
|
40
|
+
throw new _CriterionEvaluationError.default(`Invalid simple criterion condition "${condition}"`, {
|
|
40
41
|
cause: error,
|
|
41
42
|
condition,
|
|
42
43
|
type: 'simple',
|
|
43
|
-
reason:
|
|
44
|
+
reason: _CriterionErrorReason.default.InvalidSimple
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
throw error;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { evaluate as evaluateSimpleCriterion, ArazzoCriterionError } from '@swaggerexpert/arazzo-criterion';
|
|
2
|
-
import
|
|
2
|
+
import CriterionEvaluationError from "../errors/CriterionEvaluationError.mjs";
|
|
3
|
+
import CriterionErrorReason from "./CriterionErrorReason.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* Evaluates a `simple` Arazzo criterion condition.
|
|
5
6
|
*
|
|
@@ -14,7 +15,7 @@ import CriterionError from "../errors/CriterionError.mjs";
|
|
|
14
15
|
* compared per the library's rules (e.g. `undefined == x` and relational
|
|
15
16
|
* comparisons are false, matching the spec's "null equals only null"), so a
|
|
16
17
|
* negated or disjunctive condition may still pass. A malformed condition throws
|
|
17
|
-
* {@link
|
|
18
|
+
* {@link CriterionEvaluationError}.
|
|
18
19
|
* @public
|
|
19
20
|
*/
|
|
20
21
|
class SimpleCriterionEvaluator {
|
|
@@ -29,11 +30,11 @@ class SimpleCriterionEvaluator {
|
|
|
29
30
|
});
|
|
30
31
|
} catch (error) {
|
|
31
32
|
if (error instanceof ArazzoCriterionError) {
|
|
32
|
-
throw new
|
|
33
|
+
throw new CriterionEvaluationError(`Invalid simple criterion condition "${condition}"`, {
|
|
33
34
|
cause: error,
|
|
34
35
|
condition,
|
|
35
36
|
type: 'simple',
|
|
36
|
-
reason:
|
|
37
|
+
reason: CriterionErrorReason.InvalidSimple
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
throw error;
|
|
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _fontoxpath = _interopRequireDefault(require("fontoxpath"));
|
|
9
9
|
var _xmldom = require("@xmldom/xmldom");
|
|
10
|
-
var
|
|
10
|
+
var _CriterionEvaluationError = _interopRequireDefault(require("../errors/CriterionEvaluationError.cjs"));
|
|
11
|
+
var _CriterionErrorReason = _interopRequireDefault(require("./CriterionErrorReason.cjs"));
|
|
11
12
|
// fontoxpath is CommonJS and its named exports are not statically resolvable
|
|
12
13
|
// under ESM, so import the default and destructure.
|
|
13
14
|
|
|
@@ -28,7 +29,7 @@ const {
|
|
|
28
29
|
*
|
|
29
30
|
* Only XPath 3.1 is supported (`fontoxpath`'s engine); version gating happens in
|
|
30
31
|
* the facade. Per Arazzo 1.1.0, a `null` or `undefined` context fails the
|
|
31
|
-
* condition. An invalid query throws {@link
|
|
32
|
+
* condition. An invalid query throws {@link CriterionEvaluationError}.
|
|
32
33
|
* @public
|
|
33
34
|
*/
|
|
34
35
|
class XPathCriterionEvaluator {
|
|
@@ -37,7 +38,7 @@ class XPathCriterionEvaluator {
|
|
|
37
38
|
* its Effective Boolean Value.
|
|
38
39
|
*
|
|
39
40
|
* Returns `false` when the context is `null` or `undefined`. Throws
|
|
40
|
-
* {@link
|
|
41
|
+
* {@link CriterionEvaluationError} when the context is not XML or the query is invalid.
|
|
41
42
|
*/
|
|
42
43
|
evaluate(condition, context) {
|
|
43
44
|
if (context === null || context === undefined) return false;
|
|
@@ -47,11 +48,11 @@ class XPathCriterionEvaluator {
|
|
|
47
48
|
language: evaluateXPath.XPATH_3_1_LANGUAGE
|
|
48
49
|
});
|
|
49
50
|
} catch (error) {
|
|
50
|
-
throw new
|
|
51
|
+
throw new _CriterionEvaluationError.default(`Invalid xpath criterion condition "${condition}"`, {
|
|
51
52
|
cause: error,
|
|
52
53
|
condition,
|
|
53
54
|
type: 'xpath',
|
|
54
|
-
reason:
|
|
55
|
+
reason: _CriterionErrorReason.default.InvalidXPath
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -64,10 +65,10 @@ class XPathCriterionEvaluator {
|
|
|
64
65
|
#toNode(condition, context) {
|
|
65
66
|
if (this.#isNode(context)) return context;
|
|
66
67
|
if (typeof context !== 'string') {
|
|
67
|
-
throw new
|
|
68
|
+
throw new _CriterionEvaluationError.default('xpath criterion context is not XML', {
|
|
68
69
|
condition,
|
|
69
70
|
type: 'xpath',
|
|
70
|
-
reason:
|
|
71
|
+
reason: _CriterionErrorReason.default.InvalidXPathContext
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -83,21 +84,21 @@ class XPathCriterionEvaluator {
|
|
|
83
84
|
}
|
|
84
85
|
}).parseFromString(context, 'text/xml');
|
|
85
86
|
if (parseError !== undefined) {
|
|
86
|
-
throw new
|
|
87
|
+
throw new _CriterionEvaluationError.default('xpath criterion context is not valid XML', {
|
|
87
88
|
cause: parseError,
|
|
88
89
|
condition,
|
|
89
90
|
type: 'xpath',
|
|
90
|
-
reason:
|
|
91
|
+
reason: _CriterionErrorReason.default.InvalidXPathContext
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
94
|
return document;
|
|
94
95
|
} catch (error) {
|
|
95
|
-
if (error instanceof
|
|
96
|
-
throw new
|
|
96
|
+
if (error instanceof _CriterionEvaluationError.default) throw error;
|
|
97
|
+
throw new _CriterionEvaluationError.default('xpath criterion context is not valid XML', {
|
|
97
98
|
cause: error,
|
|
98
99
|
condition,
|
|
99
100
|
type: 'xpath',
|
|
100
|
-
reason:
|
|
101
|
+
reason: _CriterionErrorReason.default.InvalidXPathContext
|
|
101
102
|
});
|
|
102
103
|
}
|
|
103
104
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// under ESM, so import the default and destructure.
|
|
3
3
|
import fontoxpath from 'fontoxpath';
|
|
4
4
|
import { DOMParser } from '@xmldom/xmldom';
|
|
5
|
-
import
|
|
5
|
+
import CriterionEvaluationError from "../errors/CriterionEvaluationError.mjs";
|
|
6
|
+
import CriterionErrorReason from "./CriterionErrorReason.mjs";
|
|
6
7
|
const {
|
|
7
8
|
evaluateXPathToBoolean,
|
|
8
9
|
evaluateXPath
|
|
@@ -20,7 +21,7 @@ const {
|
|
|
20
21
|
*
|
|
21
22
|
* Only XPath 3.1 is supported (`fontoxpath`'s engine); version gating happens in
|
|
22
23
|
* the facade. Per Arazzo 1.1.0, a `null` or `undefined` context fails the
|
|
23
|
-
* condition. An invalid query throws {@link
|
|
24
|
+
* condition. An invalid query throws {@link CriterionEvaluationError}.
|
|
24
25
|
* @public
|
|
25
26
|
*/
|
|
26
27
|
class XPathCriterionEvaluator {
|
|
@@ -29,7 +30,7 @@ class XPathCriterionEvaluator {
|
|
|
29
30
|
* its Effective Boolean Value.
|
|
30
31
|
*
|
|
31
32
|
* Returns `false` when the context is `null` or `undefined`. Throws
|
|
32
|
-
* {@link
|
|
33
|
+
* {@link CriterionEvaluationError} when the context is not XML or the query is invalid.
|
|
33
34
|
*/
|
|
34
35
|
evaluate(condition, context) {
|
|
35
36
|
if (context === null || context === undefined) return false;
|
|
@@ -39,11 +40,11 @@ class XPathCriterionEvaluator {
|
|
|
39
40
|
language: evaluateXPath.XPATH_3_1_LANGUAGE
|
|
40
41
|
});
|
|
41
42
|
} catch (error) {
|
|
42
|
-
throw new
|
|
43
|
+
throw new CriterionEvaluationError(`Invalid xpath criterion condition "${condition}"`, {
|
|
43
44
|
cause: error,
|
|
44
45
|
condition,
|
|
45
46
|
type: 'xpath',
|
|
46
|
-
reason:
|
|
47
|
+
reason: CriterionErrorReason.InvalidXPath
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -56,10 +57,10 @@ class XPathCriterionEvaluator {
|
|
|
56
57
|
#toNode(condition, context) {
|
|
57
58
|
if (this.#isNode(context)) return context;
|
|
58
59
|
if (typeof context !== 'string') {
|
|
59
|
-
throw new
|
|
60
|
+
throw new CriterionEvaluationError('xpath criterion context is not XML', {
|
|
60
61
|
condition,
|
|
61
62
|
type: 'xpath',
|
|
62
|
-
reason:
|
|
63
|
+
reason: CriterionErrorReason.InvalidXPathContext
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -75,21 +76,21 @@ class XPathCriterionEvaluator {
|
|
|
75
76
|
}
|
|
76
77
|
}).parseFromString(context, 'text/xml');
|
|
77
78
|
if (parseError !== undefined) {
|
|
78
|
-
throw new
|
|
79
|
+
throw new CriterionEvaluationError('xpath criterion context is not valid XML', {
|
|
79
80
|
cause: parseError,
|
|
80
81
|
condition,
|
|
81
82
|
type: 'xpath',
|
|
82
|
-
reason:
|
|
83
|
+
reason: CriterionErrorReason.InvalidXPathContext
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
return document;
|
|
86
87
|
} catch (error) {
|
|
87
|
-
if (error instanceof
|
|
88
|
-
throw new
|
|
88
|
+
if (error instanceof CriterionEvaluationError) throw error;
|
|
89
|
+
throw new CriterionEvaluationError('xpath criterion context is not valid XML', {
|
|
89
90
|
cause: error,
|
|
90
91
|
condition,
|
|
91
92
|
type: 'xpath',
|
|
92
|
-
reason:
|
|
93
|
+
reason: CriterionErrorReason.InvalidXPathContext
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _CriterionError = _interopRequireDefault(require("./CriterionError.cjs"));
|
|
9
|
+
/**
|
|
10
|
+
* A criterion condition that cannot be evaluated: a syntax error in the
|
|
11
|
+
* condition, a context the condition cannot apply to, or an error raised while
|
|
12
|
+
* evaluating it. The type-specific criterion evaluators throw it;
|
|
13
|
+
* `CriterionEvaluator` turns it into an unmet criterion, as Arazzo 1.1.0
|
|
14
|
+
* requires.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class CriterionEvaluationError extends _CriterionError.default {}
|
|
18
|
+
var _default = exports.default = CriterionEvaluationError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CriterionError from "./CriterionError.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* A criterion condition that cannot be evaluated: a syntax error in the
|
|
4
|
+
* condition, a context the condition cannot apply to, or an error raised while
|
|
5
|
+
* evaluating it. The type-specific criterion evaluators throw it;
|
|
6
|
+
* `CriterionEvaluator` turns it into an unmet criterion, as Arazzo 1.1.0
|
|
7
|
+
* requires.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class CriterionEvaluationError extends CriterionError {}
|
|
11
|
+
export default CriterionEvaluationError;
|
package/src/index.cjs
CHANGED
|
@@ -113,6 +113,18 @@ Object.defineProperty(exports, "CriterionError", {
|
|
|
113
113
|
return _CriterionError.default;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
+
Object.defineProperty(exports, "CriterionErrorReason", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _CriterionErrorReason.default;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "CriterionEvaluationError", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function () {
|
|
125
|
+
return _CriterionEvaluationError.default;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
116
128
|
Object.defineProperty(exports, "CriterionEvaluator", {
|
|
117
129
|
enumerable: true,
|
|
118
130
|
get: function () {
|
|
@@ -405,6 +417,7 @@ var _SimpleCriterionEvaluator = _interopRequireDefault(require("./criterion/Simp
|
|
|
405
417
|
var _RegexCriterionEvaluator = _interopRequireDefault(require("./criterion/RegexCriterionEvaluator.cjs"));
|
|
406
418
|
var _JSONPathCriterionEvaluator = _interopRequireDefault(require("./criterion/JSONPathCriterionEvaluator.cjs"));
|
|
407
419
|
var _XPathCriterionEvaluator = _interopRequireDefault(require("./criterion/XPathCriterionEvaluator.cjs"));
|
|
420
|
+
var _CriterionErrorReason = _interopRequireDefault(require("./criterion/CriterionErrorReason.cjs"));
|
|
408
421
|
var _WorkflowExecutionState = _interopRequireDefault(require("./state/WorkflowExecutionState.cjs"));
|
|
409
422
|
var _ArazzoValueResolver = _interopRequireDefault(require("./resolver/ArazzoValueResolver.cjs"));
|
|
410
423
|
var _StepParameterResolver = _interopRequireDefault(require("./resolver/StepParameterResolver.cjs"));
|
|
@@ -429,5 +442,6 @@ var _UnmatchedProviderError = _interopRequireDefault(require("./errors/Unmatched
|
|
|
429
442
|
var _DocumentLoadError = _interopRequireDefault(require("./errors/DocumentLoadError.cjs"));
|
|
430
443
|
var _RuntimeExpressionError = _interopRequireDefault(require("./errors/RuntimeExpressionError.cjs"));
|
|
431
444
|
var _CriterionError = _interopRequireDefault(require("./errors/CriterionError.cjs"));
|
|
445
|
+
var _CriterionEvaluationError = _interopRequireDefault(require("./errors/CriterionEvaluationError.cjs"));
|
|
432
446
|
var _ResolverError = _interopRequireDefault(require("./errors/ResolverError.cjs"));
|
|
433
447
|
var _ExecutionError = _interopRequireDefault(require("./errors/ExecutionError.cjs"));
|
package/src/index.mjs
CHANGED
|
@@ -43,6 +43,7 @@ export { default as SimpleCriterionEvaluator } from "./criterion/SimpleCriterion
|
|
|
43
43
|
export { default as RegexCriterionEvaluator } from "./criterion/RegexCriterionEvaluator.mjs";
|
|
44
44
|
export { default as JSONPathCriterionEvaluator } from "./criterion/JSONPathCriterionEvaluator.mjs";
|
|
45
45
|
export { default as XPathCriterionEvaluator } from "./criterion/XPathCriterionEvaluator.mjs";
|
|
46
|
+
export { default as CriterionErrorReason } from "./criterion/CriterionErrorReason.mjs";
|
|
46
47
|
/* Execution State */
|
|
47
48
|
export { default as WorkflowExecutionState } from "./state/WorkflowExecutionState.mjs";
|
|
48
49
|
/* Resolvers */
|
|
@@ -72,5 +73,6 @@ export { default as UnmatchedProviderError } from "./errors/UnmatchedProviderErr
|
|
|
72
73
|
export { default as DocumentLoadError } from "./errors/DocumentLoadError.mjs";
|
|
73
74
|
export { default as RuntimeExpressionError } from "./errors/RuntimeExpressionError.mjs";
|
|
74
75
|
export { default as CriterionError } from "./errors/CriterionError.mjs";
|
|
76
|
+
export { default as CriterionEvaluationError } from "./errors/CriterionEvaluationError.mjs";
|
|
75
77
|
export { default as ResolverError } from "./errors/ResolverError.mjs";
|
|
76
78
|
export { default as ExecutionError } from "./errors/ExecutionError.mjs";
|