@usearazzo/runner 1.0.1-alpha.23 → 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 +14 -0
- package/README.md +1 -1
- package/dist/arazzo-runner.browser.js +362 -226
- 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 +11 -11
- package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +11 -11
- package/src/executor/StepExecutor.cjs +7 -7
- package/src/executor/StepExecutor.mjs +7 -7
- 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 +13 -13
- package/src/executor/WorkflowExecutor.mjs +13 -13
- 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 +196 -45
- package/src/criterion/CriterionErrorReason.cjs +0 -51
- package/src/criterion/CriterionErrorReason.mjs +0 -46
|
@@ -1,4 +1,76 @@
|
|
|
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 ExecutionErrorReason} is
|
|
6
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
7
|
+
* union.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class ExecutionError extends ArazzoRunnerError {
|
|
11
|
+
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
12
|
+
static Aborted = 'aborted';
|
|
13
|
+
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
14
|
+
static AmbiguousTarget = 'ambiguous-target';
|
|
15
|
+
/** The `dependsOn` edges alone form a cycle between workflows. */
|
|
16
|
+
static DependsOnCycle = 'dependsOn-cycle';
|
|
17
|
+
/** A `goto` action declares neither a `stepId` nor a `workflowId`. */
|
|
18
|
+
static GotoTargetMissing = 'goto-target-missing';
|
|
19
|
+
/** A `goto` action's `stepId` names no step in the workflow. */
|
|
20
|
+
static GotoTargetNotFound = 'goto-target-not-found';
|
|
21
|
+
/** An `operationId` or `operationPath` is not a valid operation reference. */
|
|
22
|
+
static InvalidOperationReference = 'invalid-operation-reference';
|
|
23
|
+
/** A `workflowId` is not a valid `$sourceDescriptions.{name}.{workflowId}` expression. */
|
|
24
|
+
static InvalidWorkflowReference = 'invalid-workflow-reference';
|
|
25
|
+
/** A workflow's `dependsOn` is not a list or holds a non-string entry. */
|
|
26
|
+
static MalformedDependsOn = 'malformed-dependsOn';
|
|
27
|
+
/** A workflow's `steps` is not a list or holds an entry that is not a Step Object. */
|
|
28
|
+
static MalformedSteps = 'malformed-steps';
|
|
29
|
+
/** A step run as an operation declares neither an `operationId` nor an `operationPath`. */
|
|
30
|
+
static MissingOperation = 'missing-operation';
|
|
31
|
+
/** An operation reference locates no operation in its OpenAPI source description. */
|
|
32
|
+
static OperationNotFound = 'operation-not-found';
|
|
33
|
+
/** A `retry` action references a step or workflow, but no run reference was given to run it. */
|
|
34
|
+
static RetryReferenceUnsupported = 'retry-reference-unsupported';
|
|
35
|
+
/** A `retry` action's `stepId` names no step in the workflow. */
|
|
36
|
+
static RetryTargetNotFound = 'retry-target-not-found';
|
|
37
|
+
/** A workflow reference names a source description that is not an Arazzo document. */
|
|
38
|
+
static SourceDescriptionNotArazzo = 'source-description-not-arazzo';
|
|
39
|
+
/** A reference names a source description the Arazzo document does not define. */
|
|
40
|
+
static SourceDescriptionNotFound = 'source-description-not-found';
|
|
41
|
+
/** An operation reference names a source description that is not an OpenAPI document. */
|
|
42
|
+
static SourceDescriptionNotOpenAPI = 'source-description-not-openapi';
|
|
43
|
+
/** A workflow exceeded its budget of step attempts. */
|
|
44
|
+
static StepBudget = 'step-budget';
|
|
45
|
+
/** An action declares a `type` other than `end`, `goto` or `retry`. */
|
|
46
|
+
static UnknownActionType = 'unknown-action-type';
|
|
47
|
+
/** `execute` received an option it does not know. */
|
|
48
|
+
static UnknownExecuteOption = 'unknown-execute-option';
|
|
49
|
+
/** A step produced a transition the workflow executor does not recognize. */
|
|
50
|
+
static UnknownTransitionKind = 'unknown-transition-kind';
|
|
51
|
+
/** A sub-workflow call (alone or together with `dependsOn`) forms a cycle between workflows. */
|
|
52
|
+
static WorkflowCycle = 'workflow-cycle';
|
|
53
|
+
/** Workflows nest deeper than the configured limit. */
|
|
54
|
+
static WorkflowDepth = 'workflow-depth';
|
|
55
|
+
/** A workflow reference names a workflow the Arazzo document does not define. */
|
|
56
|
+
static WorkflowNotFound = 'workflow-not-found';
|
|
57
|
+
/** A step that targets a workflow was handed to the step executor, which runs operations only. */
|
|
58
|
+
static WorkflowStep = 'workflow-step';
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The chain of workflowIds the error concerns — the loop A → B → A for a
|
|
62
|
+
* cycle, or the call chain in progress when a budget ran out.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
constructor(message, options) {
|
|
66
|
+
super(message, options);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* One of the reasons an {@link ExecutionError} carries: an `ExecutionError`
|
|
72
|
+
* static such as `ExecutionError.OperationNotFound`.
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
|
|
4
76
|
export default ExecutionError;
|
|
@@ -6,6 +6,57 @@ 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 ResolverErrorReason} is
|
|
13
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
14
|
+
* union.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class ResolverError extends _ArazzoRunnerError.default {
|
|
18
|
+
/** A parameter cannot be delivered unambiguously at its location. */
|
|
19
|
+
static AmbiguousDelivery = 'ambiguous-delivery';
|
|
20
|
+
/** An output or a request body payload holds a value that is not a valid runtime expression. */
|
|
21
|
+
static InvalidExpression = 'invalid-expression';
|
|
22
|
+
/** A parameter's location (`in`) is not one of the known locations. */
|
|
23
|
+
static InvalidLocation = 'invalid-location';
|
|
24
|
+
/** An `onSuccess`/`onFailure` list holds an entry that is not a Success/Failure Action Object. */
|
|
25
|
+
static MalformedActionEntry = 'malformed-action-entry';
|
|
26
|
+
/** A step's `onSuccess` or `onFailure` is present but is not a list. */
|
|
27
|
+
static MalformedActions = 'malformed-actions';
|
|
28
|
+
/** A step's `successCriteria` or an action's `criteria` is present but is not a list. */
|
|
29
|
+
static MalformedCriteria = 'malformed-criteria';
|
|
30
|
+
/** A criteria list holds an entry that is not a Criterion Object. */
|
|
31
|
+
static MalformedCriterion = 'malformed-criterion';
|
|
32
|
+
/** A parameter's location (`in`) is not a string. */
|
|
33
|
+
static MalformedLocation = 'malformed-location';
|
|
34
|
+
/** A step's or workflow's `outputs` is present but is not a map. */
|
|
35
|
+
static MalformedOutputs = 'malformed-outputs';
|
|
36
|
+
/** `parameters` is present but is not a list. */
|
|
37
|
+
static MalformedParameters = 'malformed-parameters';
|
|
38
|
+
/** `requestBody.replacements` is present but is not a list. */
|
|
39
|
+
static MalformedReplacements = 'malformed-replacements';
|
|
40
|
+
/** `requestBody` is present but is not a map. */
|
|
41
|
+
static MalformedRequestBody = 'malformed-request-body';
|
|
42
|
+
/** A parameter of a step that targets an operation declares no location (`in`). */
|
|
43
|
+
static MissingLocation = 'missing-location';
|
|
44
|
+
/** A parameter has a missing or non-string `name`. */
|
|
45
|
+
static MissingName = 'missing-name';
|
|
46
|
+
/** A runtime expression in the request body did not resolve. */
|
|
47
|
+
static UnresolvedExpression = 'unresolved-expression';
|
|
48
|
+
/** A `requestBody` replacement target does not resolve in the payload. */
|
|
49
|
+
static UnresolvedTarget = 'unresolved-target';
|
|
50
|
+
/** A `requestBody` replacement target is not a JSON Pointer. */
|
|
51
|
+
static UnsupportedTarget = 'unsupported-target';
|
|
52
|
+
constructor(message, options) {
|
|
53
|
+
super(message, options);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* One of the reasons a {@link ResolverError} carries: a `ResolverError`
|
|
59
|
+
* static such as `ResolverError.MalformedParameters`.
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
11
62
|
var _default = exports.default = ResolverError;
|
|
@@ -1,4 +1,56 @@
|
|
|
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 ResolverErrorReason} is
|
|
6
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
7
|
+
* union.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class ResolverError extends ArazzoRunnerError {
|
|
11
|
+
/** A parameter cannot be delivered unambiguously at its location. */
|
|
12
|
+
static AmbiguousDelivery = 'ambiguous-delivery';
|
|
13
|
+
/** An output or a request body payload holds a value that is not a valid runtime expression. */
|
|
14
|
+
static InvalidExpression = 'invalid-expression';
|
|
15
|
+
/** A parameter's location (`in`) is not one of the known locations. */
|
|
16
|
+
static InvalidLocation = 'invalid-location';
|
|
17
|
+
/** An `onSuccess`/`onFailure` list holds an entry that is not a Success/Failure Action Object. */
|
|
18
|
+
static MalformedActionEntry = 'malformed-action-entry';
|
|
19
|
+
/** A step's `onSuccess` or `onFailure` is present but is not a list. */
|
|
20
|
+
static MalformedActions = 'malformed-actions';
|
|
21
|
+
/** A step's `successCriteria` or an action's `criteria` is present but is not a list. */
|
|
22
|
+
static MalformedCriteria = 'malformed-criteria';
|
|
23
|
+
/** A criteria list holds an entry that is not a Criterion Object. */
|
|
24
|
+
static MalformedCriterion = 'malformed-criterion';
|
|
25
|
+
/** A parameter's location (`in`) is not a string. */
|
|
26
|
+
static MalformedLocation = 'malformed-location';
|
|
27
|
+
/** A step's or workflow's `outputs` is present but is not a map. */
|
|
28
|
+
static MalformedOutputs = 'malformed-outputs';
|
|
29
|
+
/** `parameters` is present but is not a list. */
|
|
30
|
+
static MalformedParameters = 'malformed-parameters';
|
|
31
|
+
/** `requestBody.replacements` is present but is not a list. */
|
|
32
|
+
static MalformedReplacements = 'malformed-replacements';
|
|
33
|
+
/** `requestBody` is present but is not a map. */
|
|
34
|
+
static MalformedRequestBody = 'malformed-request-body';
|
|
35
|
+
/** A parameter of a step that targets an operation declares no location (`in`). */
|
|
36
|
+
static MissingLocation = 'missing-location';
|
|
37
|
+
/** A parameter has a missing or non-string `name`. */
|
|
38
|
+
static MissingName = 'missing-name';
|
|
39
|
+
/** A runtime expression in the request body did not resolve. */
|
|
40
|
+
static UnresolvedExpression = 'unresolved-expression';
|
|
41
|
+
/** A `requestBody` replacement target does not resolve in the payload. */
|
|
42
|
+
static UnresolvedTarget = 'unresolved-target';
|
|
43
|
+
/** A `requestBody` replacement target is not a JSON Pointer. */
|
|
44
|
+
static UnsupportedTarget = 'unsupported-target';
|
|
45
|
+
constructor(message, options) {
|
|
46
|
+
super(message, options);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* One of the reasons a {@link ResolverError} carries: a `ResolverError`
|
|
52
|
+
* static such as `ResolverError.MalformedParameters`.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
|
|
4
56
|
export default ResolverError;
|
|
@@ -6,6 +6,36 @@ 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 RuntimeExpressionErrorReason}
|
|
13
|
+
* is derived from the class's own statics, so a non-reason static would join
|
|
14
|
+
* the union.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class RuntimeExpressionError extends _ArazzoRunnerError.default {
|
|
18
|
+
/** The expression is not a valid runtime expression. */
|
|
19
|
+
static InvalidExpression = 'invalid-expression';
|
|
20
|
+
/** The runtime expression parser failed on the expression. */
|
|
21
|
+
static ParseError = 'parse-error';
|
|
22
|
+
/**
|
|
23
|
+
* The expression reads HTTP data (`$statusCode`, `$url`, `$method`, `$request`,
|
|
24
|
+
* `$response`) in a step that calls a workflow and so made no HTTP call.
|
|
25
|
+
*/
|
|
26
|
+
static UnavailableExpression = 'unavailable-expression';
|
|
27
|
+
/** The expression could not be resolved against the evaluation context. */
|
|
28
|
+
static UnresolvedReference = 'unresolved-reference';
|
|
29
|
+
/** The parsed expression contains a node the evaluator does not support. */
|
|
30
|
+
static UnsupportedNode = 'unsupported-node';
|
|
31
|
+
constructor(message, options) {
|
|
32
|
+
super(message, options);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* One of the reasons a {@link RuntimeExpressionError} carries: a
|
|
38
|
+
* `RuntimeExpressionError` static such as `RuntimeExpressionError.ParseError`.
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
11
41
|
var _default = exports.default = RuntimeExpressionError;
|
|
@@ -1,4 +1,35 @@
|
|
|
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 RuntimeExpressionErrorReason}
|
|
6
|
+
* is derived from the class's own statics, so a non-reason static would join
|
|
7
|
+
* the union.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class RuntimeExpressionError extends ArazzoRunnerError {
|
|
11
|
+
/** The expression is not a valid runtime expression. */
|
|
12
|
+
static InvalidExpression = 'invalid-expression';
|
|
13
|
+
/** The runtime expression parser failed on the expression. */
|
|
14
|
+
static ParseError = 'parse-error';
|
|
15
|
+
/**
|
|
16
|
+
* The expression reads HTTP data (`$statusCode`, `$url`, `$method`, `$request`,
|
|
17
|
+
* `$response`) in a step that calls a workflow and so made no HTTP call.
|
|
18
|
+
*/
|
|
19
|
+
static UnavailableExpression = 'unavailable-expression';
|
|
20
|
+
/** The expression could not be resolved against the evaluation context. */
|
|
21
|
+
static UnresolvedReference = 'unresolved-reference';
|
|
22
|
+
/** The parsed expression contains a node the evaluator does not support. */
|
|
23
|
+
static UnsupportedNode = 'unsupported-node';
|
|
24
|
+
constructor(message, options) {
|
|
25
|
+
super(message, options);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* One of the reasons a {@link RuntimeExpressionError} carries: a
|
|
31
|
+
* `RuntimeExpressionError` static such as `RuntimeExpressionError.ParseError`.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
|
|
4
35
|
export default RuntimeExpressionError;
|
|
@@ -75,7 +75,7 @@ class ArazzoWorkflowLocatorNormalizer extends _SourceDescriptionsLocatorNormaliz
|
|
|
75
75
|
throw new _ExecutionError.default(`workflow reference "${reference}" in workflow "${context.workflowId}" names workflow "${locator.workflowId}", which the Arazzo document at "${locator.document.uri}" does not define`, {
|
|
76
76
|
workflowId: context.workflowId,
|
|
77
77
|
stepId: context.stepId,
|
|
78
|
-
reason:
|
|
78
|
+
reason: _ExecutionError.default.WorkflowNotFound
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
return locator;
|
|
@@ -104,7 +104,7 @@ class ArazzoWorkflowLocatorNormalizer extends _SourceDescriptionsLocatorNormaliz
|
|
|
104
104
|
throw new _ExecutionError.default(`workflow reference "${reference}" in workflow "${workflowId}" is not a $sourceDescriptions.{name}.{workflowId} expression`, {
|
|
105
105
|
workflowId,
|
|
106
106
|
stepId,
|
|
107
|
-
reason:
|
|
107
|
+
reason: _ExecutionError.default.InvalidWorkflowReference
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
return {
|
|
@@ -138,7 +138,7 @@ class ArazzoWorkflowLocatorNormalizer extends _SourceDescriptionsLocatorNormaliz
|
|
|
138
138
|
throw new _ExecutionError.default(`workflow reference "${parsed.reference}" in workflow "${workflowId}" names source description "${parsed.sourceName}", which the Arazzo document at "${document.uri}" does not define`, {
|
|
139
139
|
workflowId,
|
|
140
140
|
stepId,
|
|
141
|
-
reason:
|
|
141
|
+
reason: _ExecutionError.default.SourceDescriptionNotFound
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
const source = await this.registry.acquire(uri);
|
|
@@ -146,7 +146,7 @@ class ArazzoWorkflowLocatorNormalizer extends _SourceDescriptionsLocatorNormaliz
|
|
|
146
146
|
throw new _ExecutionError.default(`workflow reference "${parsed.reference}" in workflow "${workflowId}" names source description "${parsed.sourceName}" at "${uri}", which is not an Arazzo document`, {
|
|
147
147
|
workflowId,
|
|
148
148
|
stepId,
|
|
149
|
-
reason:
|
|
149
|
+
reason: _ExecutionError.default.SourceDescriptionNotArazzo
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
return {
|
|
@@ -65,7 +65,7 @@ class ArazzoWorkflowLocatorNormalizer extends SourceDescriptionsLocatorNormalize
|
|
|
65
65
|
throw new ExecutionError(`workflow reference "${reference}" in workflow "${context.workflowId}" names workflow "${locator.workflowId}", which the Arazzo document at "${locator.document.uri}" does not define`, {
|
|
66
66
|
workflowId: context.workflowId,
|
|
67
67
|
stepId: context.stepId,
|
|
68
|
-
reason:
|
|
68
|
+
reason: ExecutionError.WorkflowNotFound
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
return locator;
|
|
@@ -94,7 +94,7 @@ class ArazzoWorkflowLocatorNormalizer extends SourceDescriptionsLocatorNormalize
|
|
|
94
94
|
throw new ExecutionError(`workflow reference "${reference}" in workflow "${workflowId}" is not a $sourceDescriptions.{name}.{workflowId} expression`, {
|
|
95
95
|
workflowId,
|
|
96
96
|
stepId,
|
|
97
|
-
reason:
|
|
97
|
+
reason: ExecutionError.InvalidWorkflowReference
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
return {
|
|
@@ -128,7 +128,7 @@ class ArazzoWorkflowLocatorNormalizer extends SourceDescriptionsLocatorNormalize
|
|
|
128
128
|
throw new ExecutionError(`workflow reference "${parsed.reference}" in workflow "${workflowId}" names source description "${parsed.sourceName}", which the Arazzo document at "${document.uri}" does not define`, {
|
|
129
129
|
workflowId,
|
|
130
130
|
stepId,
|
|
131
|
-
reason:
|
|
131
|
+
reason: ExecutionError.SourceDescriptionNotFound
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
const source = await this.registry.acquire(uri);
|
|
@@ -136,7 +136,7 @@ class ArazzoWorkflowLocatorNormalizer extends SourceDescriptionsLocatorNormalize
|
|
|
136
136
|
throw new ExecutionError(`workflow reference "${parsed.reference}" in workflow "${workflowId}" names source description "${parsed.sourceName}" at "${uri}", which is not an Arazzo document`, {
|
|
137
137
|
workflowId,
|
|
138
138
|
stepId,
|
|
139
|
-
reason:
|
|
139
|
+
reason: ExecutionError.SourceDescriptionNotArazzo
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
return {
|
|
@@ -94,7 +94,7 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
94
94
|
if (parsed !== undefined && document.resolveSourceDescriptionURI(parsed.sourceName) === undefined) {
|
|
95
95
|
throw new _ExecutionError.default(`operationPath "${operationPath}" names source description "${parsed.sourceName}", which the Arazzo document at "${document.uri}" does not define`, {
|
|
96
96
|
...scope,
|
|
97
|
-
reason:
|
|
97
|
+
reason: _ExecutionError.default.SourceDescriptionNotFound
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -108,21 +108,21 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
108
108
|
if (documentURI === '') {
|
|
109
109
|
throw new _ExecutionError.default(`operationPath "${operationPath}" does not resolve to a source description URL`, {
|
|
110
110
|
...scope,
|
|
111
|
-
reason:
|
|
111
|
+
reason: _ExecutionError.default.InvalidOperationReference
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
const jsonPointer = _jsonPointer.URIFragmentIdentifier.fromURIReference(uriReference);
|
|
115
115
|
if (!(0, _jsonPointer.testJSONPointer)(jsonPointer)) {
|
|
116
116
|
throw new _ExecutionError.default(`operationPath "${operationPath}" has an invalid JSON Pointer`, {
|
|
117
117
|
...scope,
|
|
118
|
-
reason:
|
|
118
|
+
reason: _ExecutionError.default.InvalidOperationReference
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
const source = await this.registry.acquire(documentURI);
|
|
122
122
|
if (!_OpenAPIDocument.default.is(source)) {
|
|
123
123
|
throw new _ExecutionError.default(`operationPath "${operationPath}" references "${documentURI}", which is not an OpenAPI document`, {
|
|
124
124
|
...scope,
|
|
125
|
-
reason:
|
|
125
|
+
reason: _ExecutionError.default.SourceDescriptionNotOpenAPI
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -134,7 +134,7 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
134
134
|
throw new _ExecutionError.default(`operationPath "${operationPath}" does not locate an operation in the OpenAPI document at "${source.uri}"`, {
|
|
135
135
|
cause: error,
|
|
136
136
|
...scope,
|
|
137
|
-
reason:
|
|
137
|
+
reason: _ExecutionError.default.OperationNotFound
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
return {
|
|
@@ -147,7 +147,7 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
147
147
|
if (parsed === undefined) {
|
|
148
148
|
throw new _ExecutionError.default(`operationId "${expression}" is not a $sourceDescriptions.{name}.{operationId} expression`, {
|
|
149
149
|
...scope,
|
|
150
|
-
reason:
|
|
150
|
+
reason: _ExecutionError.default.InvalidOperationReference
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
const {
|
|
@@ -159,7 +159,7 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
159
159
|
if (jsonPointer === undefined) {
|
|
160
160
|
throw new _ExecutionError.default(`Operation "${operationId}" not found in source description "${sourceName}" at "${openapiDocument.uri}"`, {
|
|
161
161
|
...scope,
|
|
162
|
-
reason:
|
|
162
|
+
reason: _ExecutionError.default.OperationNotFound
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
return {
|
|
@@ -188,7 +188,7 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
188
188
|
if (jsonPointer === undefined) {
|
|
189
189
|
throw new _ExecutionError.default(`Operation "${operationId}" not found in source description at "${source.uri}"`, {
|
|
190
190
|
...scope,
|
|
191
|
-
reason:
|
|
191
|
+
reason: _ExecutionError.default.OperationNotFound
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
return {
|
|
@@ -201,7 +201,7 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
201
201
|
// is simply no OpenAPI document for the operation to be in.
|
|
202
202
|
throw new _ExecutionError.default(`Operation "${operationId}" not found: the Arazzo document at "${document.uri}" has no OpenAPI source description`, {
|
|
203
203
|
...scope,
|
|
204
|
-
reason:
|
|
204
|
+
reason: _ExecutionError.default.OperationNotFound
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -213,14 +213,14 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
213
213
|
if (uri === undefined) {
|
|
214
214
|
throw new _ExecutionError.default(`Source description "${sourceName}" not found in the Arazzo document at "${document.uri}"`, {
|
|
215
215
|
...scope,
|
|
216
|
-
reason:
|
|
216
|
+
reason: _ExecutionError.default.SourceDescriptionNotFound
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
219
|
const source = await this.registry.acquire(uri);
|
|
220
220
|
if (!_OpenAPIDocument.default.is(source)) {
|
|
221
221
|
throw new _ExecutionError.default(`Source description "${sourceName}" at "${uri}" is not an OpenAPI document`, {
|
|
222
222
|
...scope,
|
|
223
|
-
reason:
|
|
223
|
+
reason: _ExecutionError.default.SourceDescriptionNotOpenAPI
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
return source;
|
|
@@ -86,7 +86,7 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
86
86
|
if (parsed !== undefined && document.resolveSourceDescriptionURI(parsed.sourceName) === undefined) {
|
|
87
87
|
throw new ExecutionError(`operationPath "${operationPath}" names source description "${parsed.sourceName}", which the Arazzo document at "${document.uri}" does not define`, {
|
|
88
88
|
...scope,
|
|
89
|
-
reason:
|
|
89
|
+
reason: ExecutionError.SourceDescriptionNotFound
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -100,21 +100,21 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
100
100
|
if (documentURI === '') {
|
|
101
101
|
throw new ExecutionError(`operationPath "${operationPath}" does not resolve to a source description URL`, {
|
|
102
102
|
...scope,
|
|
103
|
-
reason:
|
|
103
|
+
reason: ExecutionError.InvalidOperationReference
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
const jsonPointer = URIFragmentIdentifier.fromURIReference(uriReference);
|
|
107
107
|
if (!testJSONPointer(jsonPointer)) {
|
|
108
108
|
throw new ExecutionError(`operationPath "${operationPath}" has an invalid JSON Pointer`, {
|
|
109
109
|
...scope,
|
|
110
|
-
reason:
|
|
110
|
+
reason: ExecutionError.InvalidOperationReference
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
const source = await this.registry.acquire(documentURI);
|
|
114
114
|
if (!OpenAPIDocument.is(source)) {
|
|
115
115
|
throw new ExecutionError(`operationPath "${operationPath}" references "${documentURI}", which is not an OpenAPI document`, {
|
|
116
116
|
...scope,
|
|
117
|
-
reason:
|
|
117
|
+
reason: ExecutionError.SourceDescriptionNotOpenAPI
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -126,7 +126,7 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
126
126
|
throw new ExecutionError(`operationPath "${operationPath}" does not locate an operation in the OpenAPI document at "${source.uri}"`, {
|
|
127
127
|
cause: error,
|
|
128
128
|
...scope,
|
|
129
|
-
reason:
|
|
129
|
+
reason: ExecutionError.OperationNotFound
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
return {
|
|
@@ -139,7 +139,7 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
139
139
|
if (parsed === undefined) {
|
|
140
140
|
throw new ExecutionError(`operationId "${expression}" is not a $sourceDescriptions.{name}.{operationId} expression`, {
|
|
141
141
|
...scope,
|
|
142
|
-
reason:
|
|
142
|
+
reason: ExecutionError.InvalidOperationReference
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
const {
|
|
@@ -151,7 +151,7 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
151
151
|
if (jsonPointer === undefined) {
|
|
152
152
|
throw new ExecutionError(`Operation "${operationId}" not found in source description "${sourceName}" at "${openapiDocument.uri}"`, {
|
|
153
153
|
...scope,
|
|
154
|
-
reason:
|
|
154
|
+
reason: ExecutionError.OperationNotFound
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
return {
|
|
@@ -180,7 +180,7 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
180
180
|
if (jsonPointer === undefined) {
|
|
181
181
|
throw new ExecutionError(`Operation "${operationId}" not found in source description at "${source.uri}"`, {
|
|
182
182
|
...scope,
|
|
183
|
-
reason:
|
|
183
|
+
reason: ExecutionError.OperationNotFound
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
return {
|
|
@@ -193,7 +193,7 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
193
193
|
// is simply no OpenAPI document for the operation to be in.
|
|
194
194
|
throw new ExecutionError(`Operation "${operationId}" not found: the Arazzo document at "${document.uri}" has no OpenAPI source description`, {
|
|
195
195
|
...scope,
|
|
196
|
-
reason:
|
|
196
|
+
reason: ExecutionError.OperationNotFound
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -205,14 +205,14 @@ class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormali
|
|
|
205
205
|
if (uri === undefined) {
|
|
206
206
|
throw new ExecutionError(`Source description "${sourceName}" not found in the Arazzo document at "${document.uri}"`, {
|
|
207
207
|
...scope,
|
|
208
|
-
reason:
|
|
208
|
+
reason: ExecutionError.SourceDescriptionNotFound
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
const source = await this.registry.acquire(uri);
|
|
212
212
|
if (!OpenAPIDocument.is(source)) {
|
|
213
213
|
throw new ExecutionError(`Source description "${sourceName}" at "${uri}" is not an OpenAPI document`, {
|
|
214
214
|
...scope,
|
|
215
|
-
reason:
|
|
215
|
+
reason: ExecutionError.SourceDescriptionNotOpenAPI
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
return source;
|
|
@@ -130,7 +130,7 @@ class StepExecutor {
|
|
|
130
130
|
* take precedence over it.
|
|
131
131
|
*
|
|
132
132
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
133
|
-
* already-aborted signal throws
|
|
133
|
+
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
134
134
|
* request nobody is waiting for, whose wire-level cancellation would surface
|
|
135
135
|
* as a transport {@link ClientError} — a request that failed on its own terms
|
|
136
136
|
* — rather than as the withdrawal it is.
|
|
@@ -154,13 +154,13 @@ class StepExecutor {
|
|
|
154
154
|
if (declaredTargets.length > 1) {
|
|
155
155
|
throw new _ExecutionError.default(`Step "${stepId}" declares more than one of ${STEP_TARGET_FIELDS.join(', ')} (mutually exclusive)`, {
|
|
156
156
|
...scope,
|
|
157
|
-
reason:
|
|
157
|
+
reason: _ExecutionError.default.AmbiguousTarget
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
if ((0, _apidomDatamodel.isStringElement)(step.workflowId)) {
|
|
161
161
|
throw new _ExecutionError.default(`Step "${stepId}" targets a workflowId; use the workflow executor`, {
|
|
162
162
|
...scope,
|
|
163
|
-
reason:
|
|
163
|
+
reason: _ExecutionError.default.WorkflowStep
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
166
|
this.assertSuccessCriteria(step, workflowId);
|
|
@@ -254,7 +254,7 @@ class StepExecutor {
|
|
|
254
254
|
}
|
|
255
255
|
throw new _ExecutionError.default(`Step "${scope.stepId}" has no operationId or operationPath`, {
|
|
256
256
|
...scope,
|
|
257
|
-
reason:
|
|
257
|
+
reason: _ExecutionError.default.MissingOperation
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
|
|
@@ -285,13 +285,13 @@ class StepExecutor {
|
|
|
285
285
|
if (!(0, _apidomDatamodel.isArrayElement)(criteria)) {
|
|
286
286
|
throw new _ResolverError.default("A step's `successCriteria` is present but is not a list", {
|
|
287
287
|
...scope,
|
|
288
|
-
reason:
|
|
288
|
+
reason: _ResolverError.default.MalformedCriteria
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
if (![...criteria].every(_apidomNsArazzo.isCriterionElement)) {
|
|
292
292
|
throw new _ResolverError.default("A step's `successCriteria` contains an entry that is not a Criterion Object", {
|
|
293
293
|
...scope,
|
|
294
|
-
reason:
|
|
294
|
+
reason: _ResolverError.default.MalformedCriterion
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
}
|
|
@@ -394,7 +394,7 @@ class StepExecutor {
|
|
|
394
394
|
// a step that calls a workflow made no HTTP call, so a condition on one
|
|
395
395
|
// fails like any unevaluable condition; the diagnostic keeps the
|
|
396
396
|
// authoring mistake visible.
|
|
397
|
-
if (error instanceof _RuntimeExpressionError.default && error.reason ===
|
|
397
|
+
if (error instanceof _RuntimeExpressionError.default && error.reason === _RuntimeExpressionError.default.UnavailableExpression) {
|
|
398
398
|
return {
|
|
399
399
|
condition,
|
|
400
400
|
met: false,
|
|
@@ -123,7 +123,7 @@ class StepExecutor {
|
|
|
123
123
|
* take precedence over it.
|
|
124
124
|
*
|
|
125
125
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
126
|
-
* already-aborted signal throws
|
|
126
|
+
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
127
127
|
* request nobody is waiting for, whose wire-level cancellation would surface
|
|
128
128
|
* as a transport {@link ClientError} — a request that failed on its own terms
|
|
129
129
|
* — rather than as the withdrawal it is.
|
|
@@ -147,13 +147,13 @@ class StepExecutor {
|
|
|
147
147
|
if (declaredTargets.length > 1) {
|
|
148
148
|
throw new ExecutionError(`Step "${stepId}" declares more than one of ${STEP_TARGET_FIELDS.join(', ')} (mutually exclusive)`, {
|
|
149
149
|
...scope,
|
|
150
|
-
reason:
|
|
150
|
+
reason: ExecutionError.AmbiguousTarget
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
if (isStringElement(step.workflowId)) {
|
|
154
154
|
throw new ExecutionError(`Step "${stepId}" targets a workflowId; use the workflow executor`, {
|
|
155
155
|
...scope,
|
|
156
|
-
reason:
|
|
156
|
+
reason: ExecutionError.WorkflowStep
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
this.assertSuccessCriteria(step, workflowId);
|
|
@@ -247,7 +247,7 @@ class StepExecutor {
|
|
|
247
247
|
}
|
|
248
248
|
throw new ExecutionError(`Step "${scope.stepId}" has no operationId or operationPath`, {
|
|
249
249
|
...scope,
|
|
250
|
-
reason:
|
|
250
|
+
reason: ExecutionError.MissingOperation
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -278,13 +278,13 @@ class StepExecutor {
|
|
|
278
278
|
if (!isArrayElement(criteria)) {
|
|
279
279
|
throw new ResolverError("A step's `successCriteria` is present but is not a list", {
|
|
280
280
|
...scope,
|
|
281
|
-
reason:
|
|
281
|
+
reason: ResolverError.MalformedCriteria
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
284
|
if (![...criteria].every(isCriterionElement)) {
|
|
285
285
|
throw new ResolverError("A step's `successCriteria` contains an entry that is not a Criterion Object", {
|
|
286
286
|
...scope,
|
|
287
|
-
reason:
|
|
287
|
+
reason: ResolverError.MalformedCriterion
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
290
|
}
|
|
@@ -387,7 +387,7 @@ class StepExecutor {
|
|
|
387
387
|
// a step that calls a workflow made no HTTP call, so a condition on one
|
|
388
388
|
// fails like any unevaluable condition; the diagnostic keeps the
|
|
389
389
|
// authoring mistake visible.
|
|
390
|
-
if (error instanceof RuntimeExpressionError && error.reason ===
|
|
390
|
+
if (error instanceof RuntimeExpressionError && error.reason === RuntimeExpressionError.UnavailableExpression) {
|
|
391
391
|
return {
|
|
392
392
|
condition,
|
|
393
393
|
met: false,
|