@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
|
@@ -75,7 +75,7 @@ class RequestBodyResolver extends _ArazzoValueResolver.default {
|
|
|
75
75
|
throw new _ResolverError.default('`requestBody` is present but is not a map', {
|
|
76
76
|
...scope,
|
|
77
77
|
target: 'requestBody',
|
|
78
|
-
reason:
|
|
78
|
+
reason: _ResolverError.default.MalformedRequestBody
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
const authoredPayload = (0, _apidomCore.toValue)(requestBody.payload);
|
|
@@ -87,7 +87,7 @@ class RequestBodyResolver extends _ArazzoValueResolver.default {
|
|
|
87
87
|
throw new _ResolverError.default('`requestBody.replacements` is present but is not a list', {
|
|
88
88
|
...scope,
|
|
89
89
|
target: 'requestBody.replacements',
|
|
90
|
-
reason:
|
|
90
|
+
reason: _ResolverError.default.MalformedReplacements
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
for (const replacement of requestBody.replacements) {
|
|
@@ -152,7 +152,7 @@ class RequestBodyResolver extends _ArazzoValueResolver.default {
|
|
|
152
152
|
throw new _ResolverError.default(`Invalid runtime expression "${text}" in ${this.#payloadTarget(tokens)}`, {
|
|
153
153
|
...scope,
|
|
154
154
|
target: this.#payloadTarget(tokens),
|
|
155
|
-
reason:
|
|
155
|
+
reason: _ResolverError.default.InvalidExpression
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
});
|
|
@@ -171,7 +171,7 @@ class RequestBodyResolver extends _ArazzoValueResolver.default {
|
|
|
171
171
|
return new _ResolverError.default(`Runtime expression "${expression}" in ${target} did not resolve`, {
|
|
172
172
|
...scope,
|
|
173
173
|
target,
|
|
174
|
-
reason:
|
|
174
|
+
reason: _ResolverError.default.UnresolvedExpression
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -195,7 +195,7 @@ class RequestBodyResolver extends _ArazzoValueResolver.default {
|
|
|
195
195
|
throw new _ResolverError.default(`Unsupported requestBody replacement target "${target}" (expected JSON Pointer)`, {
|
|
196
196
|
...scope,
|
|
197
197
|
target,
|
|
198
|
-
reason:
|
|
198
|
+
reason: _ResolverError.default.UnsupportedTarget
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
|
|
@@ -209,7 +209,7 @@ class RequestBodyResolver extends _ArazzoValueResolver.default {
|
|
|
209
209
|
throw new _ResolverError.default(`requestBody replacement target "${target}" does not resolve in the payload`, {
|
|
210
210
|
...scope,
|
|
211
211
|
target,
|
|
212
|
-
reason:
|
|
212
|
+
reason: _ResolverError.default.UnresolvedTarget
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
return (0, _ramda.assocPath)(tokens, value, payload);
|
|
@@ -68,7 +68,7 @@ class RequestBodyResolver extends ArazzoValueResolver {
|
|
|
68
68
|
throw new ResolverError('`requestBody` is present but is not a map', {
|
|
69
69
|
...scope,
|
|
70
70
|
target: 'requestBody',
|
|
71
|
-
reason:
|
|
71
|
+
reason: ResolverError.MalformedRequestBody
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
const authoredPayload = toValue(requestBody.payload);
|
|
@@ -80,7 +80,7 @@ class RequestBodyResolver extends ArazzoValueResolver {
|
|
|
80
80
|
throw new ResolverError('`requestBody.replacements` is present but is not a list', {
|
|
81
81
|
...scope,
|
|
82
82
|
target: 'requestBody.replacements',
|
|
83
|
-
reason:
|
|
83
|
+
reason: ResolverError.MalformedReplacements
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
for (const replacement of requestBody.replacements) {
|
|
@@ -145,7 +145,7 @@ class RequestBodyResolver extends ArazzoValueResolver {
|
|
|
145
145
|
throw new ResolverError(`Invalid runtime expression "${text}" in ${this.#payloadTarget(tokens)}`, {
|
|
146
146
|
...scope,
|
|
147
147
|
target: this.#payloadTarget(tokens),
|
|
148
|
-
reason:
|
|
148
|
+
reason: ResolverError.InvalidExpression
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
});
|
|
@@ -164,7 +164,7 @@ class RequestBodyResolver extends ArazzoValueResolver {
|
|
|
164
164
|
return new ResolverError(`Runtime expression "${expression}" in ${target} did not resolve`, {
|
|
165
165
|
...scope,
|
|
166
166
|
target,
|
|
167
|
-
reason:
|
|
167
|
+
reason: ResolverError.UnresolvedExpression
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -188,7 +188,7 @@ class RequestBodyResolver extends ArazzoValueResolver {
|
|
|
188
188
|
throw new ResolverError(`Unsupported requestBody replacement target "${target}" (expected JSON Pointer)`, {
|
|
189
189
|
...scope,
|
|
190
190
|
target,
|
|
191
|
-
reason:
|
|
191
|
+
reason: ResolverError.UnsupportedTarget
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -202,7 +202,7 @@ class RequestBodyResolver extends ArazzoValueResolver {
|
|
|
202
202
|
throw new ResolverError(`requestBody replacement target "${target}" does not resolve in the payload`, {
|
|
203
203
|
...scope,
|
|
204
204
|
target,
|
|
205
|
-
reason:
|
|
205
|
+
reason: ResolverError.UnresolvedTarget
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
return assocPath(tokens, value, payload);
|
|
@@ -44,7 +44,7 @@ class WorkflowParameterResolver extends _StepParameterResolver.default {
|
|
|
44
44
|
throw new _ResolverError.default('`parameters` is present but is not a list', {
|
|
45
45
|
...scope,
|
|
46
46
|
target: 'parameters',
|
|
47
|
-
reason:
|
|
47
|
+
reason: _ResolverError.default.MalformedParameters
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
for (const parameter of parameters) {
|
|
@@ -37,7 +37,7 @@ class WorkflowParameterResolver extends StepParameterResolver {
|
|
|
37
37
|
throw new ResolverError('`parameters` is present but is not a list', {
|
|
38
38
|
...scope,
|
|
39
39
|
target: 'parameters',
|
|
40
|
-
reason:
|
|
40
|
+
reason: ResolverError.MalformedParameters
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
for (const parameter of parameters) {
|
package/types/runner.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApiDOMErrorOptions } from '@speclynx/apidom-error';
|
|
1
2
|
import { ApiDOMReferenceOptions } from '@speclynx/apidom-reference/configuration/empty';
|
|
2
3
|
import { ApiDOMStructuredError } from '@speclynx/apidom-error';
|
|
3
4
|
import { CriterionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
@@ -472,58 +473,62 @@ export declare interface ContextSource {
|
|
|
472
473
|
*/
|
|
473
474
|
export declare type CriterionContextResolver = (expression: string) => unknown;
|
|
474
475
|
|
|
475
|
-
/** @public */
|
|
476
|
-
export declare class CriterionError extends ArazzoRunnerError {
|
|
477
|
-
readonly condition?: string;
|
|
478
|
-
readonly type?: string;
|
|
479
|
-
readonly reason?: CriterionErrorReason;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
476
|
/**
|
|
483
|
-
*
|
|
477
|
+
* Carries a `reason`, one of the class's static reason fields.
|
|
484
478
|
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
* a condition that cannot be evaluated; they are thrown as a
|
|
489
|
-
* {@link CriterionEvaluationError}, which `CriterionEvaluator` turns into an
|
|
490
|
-
* unmet criterion.
|
|
479
|
+
* Every static on this class is a reason: {@link CriterionErrorReason} is
|
|
480
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
481
|
+
* union.
|
|
491
482
|
* @public
|
|
492
483
|
*/
|
|
493
|
-
export declare
|
|
484
|
+
export declare class CriterionError extends ArazzoRunnerError {
|
|
494
485
|
/** The element is not a Criterion Object. */
|
|
495
|
-
readonly InvalidCriterion: "invalid-criterion";
|
|
486
|
+
static readonly InvalidCriterion: "invalid-criterion";
|
|
496
487
|
/** The `condition` is missing or empty. */
|
|
497
|
-
readonly MissingCondition: "missing-condition";
|
|
488
|
+
static readonly MissingCondition: "missing-condition";
|
|
498
489
|
/** The `type` is present but unreadable. */
|
|
499
|
-
readonly InvalidType: "invalid-type";
|
|
490
|
+
static readonly InvalidType: "invalid-type";
|
|
500
491
|
/** The `type` names no known criterion type. */
|
|
501
|
-
readonly UnknownType: "unknown-type";
|
|
492
|
+
static readonly UnknownType: "unknown-type";
|
|
502
493
|
/** The expression type `version` is present but not a string. */
|
|
503
|
-
readonly InvalidVersion: "invalid-version";
|
|
494
|
+
static readonly InvalidVersion: "invalid-version";
|
|
504
495
|
/** The expression type `version` is not the one this runner supports. */
|
|
505
|
-
readonly UnsupportedVersion: "unsupported-version";
|
|
496
|
+
static readonly UnsupportedVersion: "unsupported-version";
|
|
506
497
|
/** The `context` is not a runtime expression. */
|
|
507
|
-
readonly InvalidContext: "invalid-context";
|
|
498
|
+
static readonly InvalidContext: "invalid-context";
|
|
508
499
|
/** A `regex`, `jsonpath` or `xpath` criterion has no `context`. */
|
|
509
|
-
readonly MissingContext: "missing-context";
|
|
500
|
+
static readonly MissingContext: "missing-context";
|
|
510
501
|
/** The `simple` condition cannot be parsed. */
|
|
511
|
-
readonly InvalidSimple: "invalid-simple";
|
|
502
|
+
static readonly InvalidSimple: "invalid-simple";
|
|
512
503
|
/** The `regex` condition is not a valid regular expression. */
|
|
513
|
-
readonly InvalidRegex: "invalid-regex";
|
|
504
|
+
static readonly InvalidRegex: "invalid-regex";
|
|
514
505
|
/** The `jsonpath` condition is not a valid JSONPath query. */
|
|
515
|
-
readonly InvalidJSONPath: "invalid-jsonpath";
|
|
506
|
+
static readonly InvalidJSONPath: "invalid-jsonpath";
|
|
516
507
|
/** The `xpath` condition is invalid or fails to evaluate. */
|
|
517
|
-
readonly InvalidXPath: "invalid-xpath";
|
|
508
|
+
static readonly InvalidXPath: "invalid-xpath";
|
|
518
509
|
/** The resolved `xpath` context is not XML. */
|
|
519
|
-
readonly InvalidXPathContext: "invalid-xpath-context";
|
|
520
|
-
|
|
510
|
+
static readonly InvalidXPathContext: "invalid-xpath-context";
|
|
511
|
+
readonly condition?: string;
|
|
512
|
+
readonly type?: string;
|
|
513
|
+
readonly reason?: CriterionErrorReason;
|
|
514
|
+
constructor(message?: string, options?: ApiDOMErrorOptions & {
|
|
515
|
+
readonly reason?: CriterionErrorReason;
|
|
516
|
+
});
|
|
517
|
+
}
|
|
521
518
|
|
|
522
519
|
/**
|
|
523
|
-
* One of the `
|
|
520
|
+
* One of the reasons a {@link CriterionError} carries: a `CriterionError`
|
|
521
|
+
* static such as `CriterionError.InvalidRegex`.
|
|
522
|
+
*
|
|
523
|
+
* Structural reasons mark a criterion that is malformed as written; they are
|
|
524
|
+
* thrown as a plain `CriterionError`. Evaluation reasons (`InvalidSimple`,
|
|
525
|
+
* `InvalidRegex`, `InvalidJSONPath`, `InvalidXPath`, `InvalidXPathContext`) mark
|
|
526
|
+
* a condition that cannot be evaluated; they are thrown as a
|
|
527
|
+
* {@link CriterionEvaluationError}, which `CriterionEvaluator` turns into an
|
|
528
|
+
* unmet criterion.
|
|
524
529
|
* @public
|
|
525
530
|
*/
|
|
526
|
-
export declare type CriterionErrorReason = (typeof
|
|
531
|
+
export declare type CriterionErrorReason = (typeof CriterionError)[Exclude<keyof typeof CriterionError, keyof typeof ArazzoRunnerError | 'prototype'>];
|
|
527
532
|
|
|
528
533
|
/**
|
|
529
534
|
* A criterion condition that cannot be evaluated: a syntax error in the
|
|
@@ -562,10 +567,10 @@ export declare interface CriterionEvaluationRecord {
|
|
|
562
567
|
readonly diagnostic?: {
|
|
563
568
|
/**
|
|
564
569
|
* Machine-readable: the `reason` of the error that failed the criterion, a
|
|
565
|
-
* `CriterionErrorReason`
|
|
566
|
-
* HTTP-exchange expression in a step that calls a workflow.
|
|
570
|
+
* `CriterionErrorReason` or `RuntimeExpressionError.UnavailableExpression`
|
|
571
|
+
* for an HTTP-exchange expression in a step that calls a workflow.
|
|
567
572
|
*/
|
|
568
|
-
readonly code?: CriterionErrorReason |
|
|
573
|
+
readonly code?: CriterionErrorReason | typeof RuntimeExpressionError.UnavailableExpression;
|
|
569
574
|
/**
|
|
570
575
|
* Human-readable: names the condition or expression and, for a syntax
|
|
571
576
|
* error, what is wrong with it; never request or response data.
|
|
@@ -763,18 +768,83 @@ export declare abstract class DocumentRegistryProvider {
|
|
|
763
768
|
*/
|
|
764
769
|
export declare type DocumentRegistryProviderOptions = PartialDeep<ApiDOMReferenceOptions>;
|
|
765
770
|
|
|
766
|
-
/**
|
|
771
|
+
/**
|
|
772
|
+
* Carries a `reason`, one of the class's static reason fields.
|
|
773
|
+
*
|
|
774
|
+
* Every static on this class is a reason: {@link ExecutionErrorReason} is
|
|
775
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
776
|
+
* union.
|
|
777
|
+
* @public
|
|
778
|
+
*/
|
|
767
779
|
export declare class ExecutionError extends ArazzoRunnerError {
|
|
780
|
+
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
781
|
+
static readonly Aborted: "aborted";
|
|
782
|
+
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
783
|
+
static readonly AmbiguousTarget: "ambiguous-target";
|
|
784
|
+
/** The `dependsOn` edges alone form a cycle between workflows. */
|
|
785
|
+
static readonly DependsOnCycle: "dependsOn-cycle";
|
|
786
|
+
/** A `goto` action declares neither a `stepId` nor a `workflowId`. */
|
|
787
|
+
static readonly GotoTargetMissing: "goto-target-missing";
|
|
788
|
+
/** A `goto` action's `stepId` names no step in the workflow. */
|
|
789
|
+
static readonly GotoTargetNotFound: "goto-target-not-found";
|
|
790
|
+
/** An `operationId` or `operationPath` is not a valid operation reference. */
|
|
791
|
+
static readonly InvalidOperationReference: "invalid-operation-reference";
|
|
792
|
+
/** A `workflowId` is not a valid `$sourceDescriptions.{name}.{workflowId}` expression. */
|
|
793
|
+
static readonly InvalidWorkflowReference: "invalid-workflow-reference";
|
|
794
|
+
/** A workflow's `dependsOn` is not a list or holds a non-string entry. */
|
|
795
|
+
static readonly MalformedDependsOn: "malformed-dependsOn";
|
|
796
|
+
/** A workflow's `steps` is not a list or holds an entry that is not a Step Object. */
|
|
797
|
+
static readonly MalformedSteps: "malformed-steps";
|
|
798
|
+
/** A step run as an operation declares neither an `operationId` nor an `operationPath`. */
|
|
799
|
+
static readonly MissingOperation: "missing-operation";
|
|
800
|
+
/** An operation reference locates no operation in its OpenAPI source description. */
|
|
801
|
+
static readonly OperationNotFound: "operation-not-found";
|
|
802
|
+
/** A `retry` action references a step or workflow, but no run reference was given to run it. */
|
|
803
|
+
static readonly RetryReferenceUnsupported: "retry-reference-unsupported";
|
|
804
|
+
/** A `retry` action's `stepId` names no step in the workflow. */
|
|
805
|
+
static readonly RetryTargetNotFound: "retry-target-not-found";
|
|
806
|
+
/** A workflow reference names a source description that is not an Arazzo document. */
|
|
807
|
+
static readonly SourceDescriptionNotArazzo: "source-description-not-arazzo";
|
|
808
|
+
/** A reference names a source description the Arazzo document does not define. */
|
|
809
|
+
static readonly SourceDescriptionNotFound: "source-description-not-found";
|
|
810
|
+
/** An operation reference names a source description that is not an OpenAPI document. */
|
|
811
|
+
static readonly SourceDescriptionNotOpenAPI: "source-description-not-openapi";
|
|
812
|
+
/** A workflow exceeded its budget of step attempts. */
|
|
813
|
+
static readonly StepBudget: "step-budget";
|
|
814
|
+
/** An action declares a `type` other than `end`, `goto` or `retry`. */
|
|
815
|
+
static readonly UnknownActionType: "unknown-action-type";
|
|
816
|
+
/** `execute` received an option it does not know. */
|
|
817
|
+
static readonly UnknownExecuteOption: "unknown-execute-option";
|
|
818
|
+
/** A step produced a transition the workflow executor does not recognize. */
|
|
819
|
+
static readonly UnknownTransitionKind: "unknown-transition-kind";
|
|
820
|
+
/** A sub-workflow call (alone or together with `dependsOn`) forms a cycle between workflows. */
|
|
821
|
+
static readonly WorkflowCycle: "workflow-cycle";
|
|
822
|
+
/** Workflows nest deeper than the configured limit. */
|
|
823
|
+
static readonly WorkflowDepth: "workflow-depth";
|
|
824
|
+
/** A workflow reference names a workflow the Arazzo document does not define. */
|
|
825
|
+
static readonly WorkflowNotFound: "workflow-not-found";
|
|
826
|
+
/** A step that targets a workflow was handed to the step executor, which runs operations only. */
|
|
827
|
+
static readonly WorkflowStep: "workflow-step";
|
|
768
828
|
readonly stepId?: string;
|
|
769
829
|
readonly workflowId?: string;
|
|
770
|
-
readonly reason?:
|
|
830
|
+
readonly reason?: ExecutionErrorReason;
|
|
771
831
|
/**
|
|
772
832
|
* The chain of workflowIds the error concerns — the loop A → B → A for a
|
|
773
833
|
* cycle, or the call chain in progress when a budget ran out.
|
|
774
834
|
*/
|
|
775
835
|
readonly path?: readonly string[];
|
|
836
|
+
constructor(message?: string, options?: ApiDOMErrorOptions & {
|
|
837
|
+
readonly reason?: ExecutionErrorReason;
|
|
838
|
+
});
|
|
776
839
|
}
|
|
777
840
|
|
|
841
|
+
/**
|
|
842
|
+
* One of the reasons an {@link ExecutionError} carries: an `ExecutionError`
|
|
843
|
+
* static such as `ExecutionError.OperationNotFound`.
|
|
844
|
+
* @public
|
|
845
|
+
*/
|
|
846
|
+
export declare type ExecutionErrorReason = (typeof ExecutionError)[Exclude<keyof typeof ExecutionError, keyof typeof ArazzoRunnerError | 'prototype'>];
|
|
847
|
+
|
|
778
848
|
/** @public */
|
|
779
849
|
export declare class ExtractionError extends ArazzoRunnerError {
|
|
780
850
|
readonly workflowId?: string;
|
|
@@ -1254,7 +1324,7 @@ export declare interface OpenAPIOperationLocator {
|
|
|
1254
1324
|
* `$sourceDescriptions.{name}.{operationId}`. Per the Arazzo Specification, a
|
|
1255
1325
|
* plain name is only valid when a single (non-arazzo) source description is
|
|
1256
1326
|
* defined; multiple sources require the expression form. A plain name is
|
|
1257
|
-
* therefore
|
|
1327
|
+
* therefore looked up in the first OpenAPI source description only.
|
|
1258
1328
|
* - `operationPath` embeds a `{$sourceDescriptions.{name}.url}` runtime
|
|
1259
1329
|
* expression followed by a JSON Pointer to the operation.
|
|
1260
1330
|
*
|
|
@@ -1262,6 +1332,14 @@ export declare interface OpenAPIOperationLocator {
|
|
|
1262
1332
|
* or wrong); a source is classified by what it actually parses to. The
|
|
1263
1333
|
* normalizer acquires the referenced source documents from the registry on
|
|
1264
1334
|
* demand.
|
|
1335
|
+
*
|
|
1336
|
+
* A reference that cannot be resolved throws {@link ExecutionError}, attributed
|
|
1337
|
+
* to the referencing step when a {@link StepScope} is given:
|
|
1338
|
+
* `operation-not-found` when no operation answers it,
|
|
1339
|
+
* `source-description-not-found` for a source name the document does not
|
|
1340
|
+
* define, `source-description-not-openapi` for a source that is not an OpenAPI
|
|
1341
|
+
* document, and `invalid-operation-reference` for a reference malformed as
|
|
1342
|
+
* written. Every returned locator names an existing operation.
|
|
1265
1343
|
* @public
|
|
1266
1344
|
*/
|
|
1267
1345
|
export declare class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormalizer {
|
|
@@ -1270,10 +1348,10 @@ export declare class OpenAPIOperationLocatorNormalizer extends SourceDescription
|
|
|
1270
1348
|
* Normalizes a plain or expression `operationId` to a canonical locator.
|
|
1271
1349
|
*
|
|
1272
1350
|
* A whole runtime expression (`$sourceDescriptions.{name}.{operationId}`) is
|
|
1273
|
-
* resolved against its named source; a plain name is
|
|
1274
|
-
*
|
|
1351
|
+
* resolved against its named source; a plain name is looked up in the first
|
|
1352
|
+
* OpenAPI source description only.
|
|
1275
1353
|
*/
|
|
1276
|
-
normalizeOperationId(operationId: string, document: ArazzoDocument): Promise<OpenAPIOperationLocator>;
|
|
1354
|
+
normalizeOperationId(operationId: string, document: ArazzoDocument, scope?: StepScope): Promise<OpenAPIOperationLocator>;
|
|
1277
1355
|
/**
|
|
1278
1356
|
* Normalizes an `operationPath` —
|
|
1279
1357
|
* `{$sourceDescriptions.{name}.url}#/json/pointer` — to a canonical locator.
|
|
@@ -1287,10 +1365,12 @@ export declare class OpenAPIOperationLocatorNormalizer extends SourceDescription
|
|
|
1287
1365
|
* The runner only needs a URL and a JSON Pointer, so it does not enforce that
|
|
1288
1366
|
* the source description is identified by a runtime expression rather than a
|
|
1289
1367
|
* literal URL (a literal URL interpolates to itself and still resolves) — that
|
|
1290
|
-
* is a conformance concern for the validator.
|
|
1291
|
-
* not
|
|
1368
|
+
* is a conformance concern for the validator. A source name the document does
|
|
1369
|
+
* not define is detected before interpolation, so it is reported as such
|
|
1370
|
+
* rather than as the empty URL it would interpolate to; the JSON Pointer must
|
|
1371
|
+
* locate an operation in the acquired OpenAPI document.
|
|
1292
1372
|
*/
|
|
1293
|
-
normalizeOperationPath(operationPath: string, document: ArazzoDocument): Promise<OpenAPIOperationLocator>;
|
|
1373
|
+
normalizeOperationPath(operationPath: string, document: ArazzoDocument, scope?: StepScope): Promise<OpenAPIOperationLocator>;
|
|
1294
1374
|
}
|
|
1295
1375
|
|
|
1296
1376
|
/**
|
|
@@ -1523,7 +1603,7 @@ export declare class OutputResolver extends ArazzoValueResolver {
|
|
|
1523
1603
|
*
|
|
1524
1604
|
* `scope` names the step or workflow the outputs belong to, for a thrown
|
|
1525
1605
|
* {@link ResolverError}. An output value that is not a valid runtime
|
|
1526
|
-
* expression throws with
|
|
1606
|
+
* expression throws with reason `ResolverError.InvalidExpression`.
|
|
1527
1607
|
*/
|
|
1528
1608
|
resolve(outputs: StepOutputsElement | WorkflowOutputsElement | undefined, resolve: RuntimeExpressionResolver, scope: ResolverScope): Record<string, unknown>;
|
|
1529
1609
|
}
|
|
@@ -1619,14 +1699,65 @@ export declare interface ResolvedRequestBody {
|
|
|
1619
1699
|
readonly contentType?: string;
|
|
1620
1700
|
}
|
|
1621
1701
|
|
|
1622
|
-
/**
|
|
1702
|
+
/**
|
|
1703
|
+
* Carries a `reason`, one of the class's static reason fields.
|
|
1704
|
+
*
|
|
1705
|
+
* Every static on this class is a reason: {@link ResolverErrorReason} is
|
|
1706
|
+
* derived from the class's own statics, so a non-reason static would join the
|
|
1707
|
+
* union.
|
|
1708
|
+
* @public
|
|
1709
|
+
*/
|
|
1623
1710
|
export declare class ResolverError extends ArazzoRunnerError {
|
|
1711
|
+
/** A parameter cannot be delivered unambiguously at its location. */
|
|
1712
|
+
static readonly AmbiguousDelivery: "ambiguous-delivery";
|
|
1713
|
+
/** An output or a request body payload holds a value that is not a valid runtime expression. */
|
|
1714
|
+
static readonly InvalidExpression: "invalid-expression";
|
|
1715
|
+
/** A parameter's location (`in`) is not one of the known locations. */
|
|
1716
|
+
static readonly InvalidLocation: "invalid-location";
|
|
1717
|
+
/** An `onSuccess`/`onFailure` list holds an entry that is not a Success/Failure Action Object. */
|
|
1718
|
+
static readonly MalformedActionEntry: "malformed-action-entry";
|
|
1719
|
+
/** A step's `onSuccess` or `onFailure` is present but is not a list. */
|
|
1720
|
+
static readonly MalformedActions: "malformed-actions";
|
|
1721
|
+
/** A step's `successCriteria` or an action's `criteria` is present but is not a list. */
|
|
1722
|
+
static readonly MalformedCriteria: "malformed-criteria";
|
|
1723
|
+
/** A criteria list holds an entry that is not a Criterion Object. */
|
|
1724
|
+
static readonly MalformedCriterion: "malformed-criterion";
|
|
1725
|
+
/** A parameter's location (`in`) is not a string. */
|
|
1726
|
+
static readonly MalformedLocation: "malformed-location";
|
|
1727
|
+
/** A step's or workflow's `outputs` is present but is not a map. */
|
|
1728
|
+
static readonly MalformedOutputs: "malformed-outputs";
|
|
1729
|
+
/** `parameters` is present but is not a list. */
|
|
1730
|
+
static readonly MalformedParameters: "malformed-parameters";
|
|
1731
|
+
/** `requestBody.replacements` is present but is not a list. */
|
|
1732
|
+
static readonly MalformedReplacements: "malformed-replacements";
|
|
1733
|
+
/** `requestBody` is present but is not a map. */
|
|
1734
|
+
static readonly MalformedRequestBody: "malformed-request-body";
|
|
1735
|
+
/** A parameter of a step that targets an operation declares no location (`in`). */
|
|
1736
|
+
static readonly MissingLocation: "missing-location";
|
|
1737
|
+
/** A parameter has a missing or non-string `name`. */
|
|
1738
|
+
static readonly MissingName: "missing-name";
|
|
1739
|
+
/** A runtime expression in the request body did not resolve. */
|
|
1740
|
+
static readonly UnresolvedExpression: "unresolved-expression";
|
|
1741
|
+
/** A `requestBody` replacement target does not resolve in the payload. */
|
|
1742
|
+
static readonly UnresolvedTarget: "unresolved-target";
|
|
1743
|
+
/** A `requestBody` replacement target is not a JSON Pointer. */
|
|
1744
|
+
static readonly UnsupportedTarget: "unsupported-target";
|
|
1624
1745
|
readonly stepId?: string;
|
|
1625
1746
|
readonly workflowId?: string;
|
|
1626
1747
|
readonly target?: string;
|
|
1627
|
-
readonly reason?:
|
|
1748
|
+
readonly reason?: ResolverErrorReason;
|
|
1749
|
+
constructor(message?: string, options?: ApiDOMErrorOptions & {
|
|
1750
|
+
readonly reason?: ResolverErrorReason;
|
|
1751
|
+
});
|
|
1628
1752
|
}
|
|
1629
1753
|
|
|
1754
|
+
/**
|
|
1755
|
+
* One of the reasons a {@link ResolverError} carries: a `ResolverError`
|
|
1756
|
+
* static such as `ResolverError.MalformedParameters`.
|
|
1757
|
+
* @public
|
|
1758
|
+
*/
|
|
1759
|
+
export declare type ResolverErrorReason = (typeof ResolverError)[Exclude<keyof typeof ResolverError, keyof typeof ArazzoRunnerError | 'prototype'>];
|
|
1760
|
+
|
|
1630
1761
|
/**
|
|
1631
1762
|
* Identifies the step or workflow a resolver is resolving for. The wider
|
|
1632
1763
|
* union {@link OutputResolver} takes, since it resolves both a step's
|
|
@@ -1726,12 +1857,42 @@ export declare interface RuntimeExpressionContext {
|
|
|
1726
1857
|
readonly calledWorkflow?: RuntimeExpressionCalledWorkflowContext;
|
|
1727
1858
|
}
|
|
1728
1859
|
|
|
1729
|
-
/**
|
|
1860
|
+
/**
|
|
1861
|
+
* Carries a `reason`, one of the class's static reason fields.
|
|
1862
|
+
*
|
|
1863
|
+
* Every static on this class is a reason: {@link RuntimeExpressionErrorReason}
|
|
1864
|
+
* is derived from the class's own statics, so a non-reason static would join
|
|
1865
|
+
* the union.
|
|
1866
|
+
* @public
|
|
1867
|
+
*/
|
|
1730
1868
|
export declare class RuntimeExpressionError extends ArazzoRunnerError {
|
|
1869
|
+
/** The expression is not a valid runtime expression. */
|
|
1870
|
+
static readonly InvalidExpression: "invalid-expression";
|
|
1871
|
+
/** The runtime expression parser failed on the expression. */
|
|
1872
|
+
static readonly ParseError: "parse-error";
|
|
1873
|
+
/**
|
|
1874
|
+
* The expression reads HTTP data (`$statusCode`, `$url`, `$method`, `$request`,
|
|
1875
|
+
* `$response`) in a step that calls a workflow and so made no HTTP call.
|
|
1876
|
+
*/
|
|
1877
|
+
static readonly UnavailableExpression: "unavailable-expression";
|
|
1878
|
+
/** The expression could not be resolved against the evaluation context. */
|
|
1879
|
+
static readonly UnresolvedReference: "unresolved-reference";
|
|
1880
|
+
/** The parsed expression contains a node the evaluator does not support. */
|
|
1881
|
+
static readonly UnsupportedNode: "unsupported-node";
|
|
1731
1882
|
readonly expression?: string;
|
|
1732
|
-
readonly reason?:
|
|
1883
|
+
readonly reason?: RuntimeExpressionErrorReason;
|
|
1884
|
+
constructor(message?: string, options?: ApiDOMErrorOptions & {
|
|
1885
|
+
readonly reason?: RuntimeExpressionErrorReason;
|
|
1886
|
+
});
|
|
1733
1887
|
}
|
|
1734
1888
|
|
|
1889
|
+
/**
|
|
1890
|
+
* One of the reasons a {@link RuntimeExpressionError} carries: a
|
|
1891
|
+
* `RuntimeExpressionError` static such as `RuntimeExpressionError.ParseError`.
|
|
1892
|
+
* @public
|
|
1893
|
+
*/
|
|
1894
|
+
export declare type RuntimeExpressionErrorReason = (typeof RuntimeExpressionError)[Exclude<keyof typeof RuntimeExpressionError, keyof typeof ArazzoRunnerError | 'prototype'>];
|
|
1895
|
+
|
|
1735
1896
|
/**
|
|
1736
1897
|
* Evaluates Arazzo runtime expressions against a context.
|
|
1737
1898
|
*
|
|
@@ -2045,12 +2206,16 @@ export declare class StepExecutor {
|
|
|
2045
2206
|
* take precedence over it.
|
|
2046
2207
|
*
|
|
2047
2208
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
2048
|
-
* already-aborted signal throws
|
|
2209
|
+
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
2049
2210
|
* request nobody is waiting for, whose wire-level cancellation would surface
|
|
2050
2211
|
* as a transport {@link ClientError} — a request that failed on its own terms
|
|
2051
2212
|
* — rather than as the withdrawal it is.
|
|
2213
|
+
*
|
|
2214
|
+
* `workflowId` names the workflow the step belongs to; every error raised
|
|
2215
|
+
* here then carries it alongside the `stepId`, since step ids are only
|
|
2216
|
+
* unique within a workflow. The workflow executor always passes it.
|
|
2052
2217
|
*/
|
|
2053
|
-
execute(step: StepElement, state: ContextSource, executeOptions?: Record<string, unknown
|
|
2218
|
+
execute(step: StepElement, state: ContextSource, executeOptions?: Record<string, unknown>, workflowId?: string): Promise<StepExecutionResult>;
|
|
2054
2219
|
/**
|
|
2055
2220
|
* Throws {@link ResolverError} unless the step's `successCriteria` is absent
|
|
2056
2221
|
* or a list of Criterion Objects: `malformed-criteria` for one that is
|
|
@@ -2077,9 +2242,11 @@ export declare class StepExecutor {
|
|
|
2077
2242
|
* Public for the same reason as {@link StepExecutor.selectActions}: a step
|
|
2078
2243
|
* targeting a `workflowId` is run by the workflow executor and never reaches
|
|
2079
2244
|
* {@link StepExecutor.execute}, but its criteria are still the author's
|
|
2080
|
-
* assertion about the step and must be evaluated somewhere.
|
|
2245
|
+
* assertion about the step and must be evaluated somewhere. `workflowId`
|
|
2246
|
+
* names the step's workflow on a thrown error, as for
|
|
2247
|
+
* {@link StepExecutor.execute}.
|
|
2081
2248
|
*/
|
|
2082
|
-
evaluateCriteria(step: StepElement, context: RuntimeExpressionContext): CriterionEvaluationRecord[];
|
|
2249
|
+
evaluateCriteria(step: StepElement, context: RuntimeExpressionContext, workflowId?: string): CriterionEvaluationRecord[];
|
|
2083
2250
|
/**
|
|
2084
2251
|
* Selects every matching `onSuccess` / `onFailure` action for the outcome, in
|
|
2085
2252
|
* list order, gating each action's criteria against the context, and records
|
|
@@ -2100,8 +2267,10 @@ export declare class StepExecutor {
|
|
|
2100
2267
|
* it runs itself and which therefore never reaches
|
|
2101
2268
|
* {@link StepExecutor.execute}. Both callers reach the criteria evaluator and
|
|
2102
2269
|
* the expression context through this one method rather than wiring their own.
|
|
2270
|
+
* `workflowId` names the step's workflow on a thrown error, as for
|
|
2271
|
+
* {@link StepExecutor.execute}.
|
|
2103
2272
|
*/
|
|
2104
|
-
selectActions(step: StepElement, successful: boolean, context: RuntimeExpressionContext): Pick<StepExecutionResult, 'matchedActions' | 'actionCriteria'>;
|
|
2273
|
+
selectActions(step: StepElement, successful: boolean, context: RuntimeExpressionContext, workflowId?: string): Pick<StepExecutionResult, 'matchedActions' | 'actionCriteria'>;
|
|
2105
2274
|
}
|
|
2106
2275
|
|
|
2107
2276
|
/**
|
|
@@ -2210,14 +2379,21 @@ export declare interface StepRunRecord {
|
|
|
2210
2379
|
}
|
|
2211
2380
|
|
|
2212
2381
|
/**
|
|
2213
|
-
* Identifies the step
|
|
2214
|
-
*
|
|
2215
|
-
*
|
|
2382
|
+
* Identifies the step something is being resolved or located for, so a thrown
|
|
2383
|
+
* error can say which one it came from. Every resolver that only ever runs
|
|
2384
|
+
* within a step's scope — {@link OpenAPIOperationParameterResolver},
|
|
2216
2385
|
* {@link WorkflowParameterResolver}, {@link RequestBodyResolver},
|
|
2217
|
-
* {@link ActionResolver} — takes this
|
|
2386
|
+
* {@link ActionResolver} — takes this, as does
|
|
2387
|
+
* {@link OpenAPIOperationLocatorNormalizer} for the step whose operation it
|
|
2388
|
+
* locates.
|
|
2218
2389
|
* @public
|
|
2219
2390
|
*/
|
|
2220
2391
|
export declare interface StepScope {
|
|
2392
|
+
/**
|
|
2393
|
+
* The workflow the step belongs to, when the caller knows it: step ids are
|
|
2394
|
+
* only unique within a workflow.
|
|
2395
|
+
*/
|
|
2396
|
+
readonly workflowId?: string;
|
|
2221
2397
|
readonly stepId: string;
|
|
2222
2398
|
}
|
|
2223
2399
|
|
|
@@ -2276,7 +2452,7 @@ export declare interface WorkflowExecuteOptions {
|
|
|
2276
2452
|
* `retryAfter` waits between attempts, so an aborted run stops at the next
|
|
2277
2453
|
* boundary rather than working its way to the end of the workflow.
|
|
2278
2454
|
*
|
|
2279
|
-
* An aborted run throws {@link ExecutionError} with
|
|
2455
|
+
* An aborted run throws {@link ExecutionError} with reason `ExecutionError.Aborted`,
|
|
2280
2456
|
* naming the boundary it stopped at and carrying the signal's own `reason` as
|
|
2281
2457
|
* the error's `cause`. It does not resolve as a `failed` result: cancellation
|
|
2282
2458
|
* is not something the steps did, and the steps that never ran were not
|
|
@@ -2524,9 +2700,9 @@ export declare interface WorkflowExecutorOptions {
|
|
|
2524
2700
|
readonly maxSteps?: number;
|
|
2525
2701
|
/**
|
|
2526
2702
|
* Upper bound on how deeply workflows may nest — a workflow entered while
|
|
2527
|
-
* this many are already in progress throws
|
|
2703
|
+
* this many are already in progress throws with reason `ExecutionError.WorkflowDepth`.
|
|
2528
2704
|
* Bounds *legitimate* (acyclic) nesting; a genuine cycle is caught earlier and
|
|
2529
|
-
* separately by
|
|
2705
|
+
* separately by reason `ExecutionError.WorkflowCycle`. Defaults to 32.
|
|
2530
2706
|
*
|
|
2531
2707
|
* The count includes the workflow `execute` was called with, so `1` permits
|
|
2532
2708
|
* that workflow and forbids all nesting; a value below 1 leaves no room for
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* The `reason` a {@link CriterionError} carries.
|
|
9
|
-
*
|
|
10
|
-
* Structural reasons mark a criterion that is malformed as written; they are
|
|
11
|
-
* thrown as a plain `CriterionError`. Evaluation reasons (`InvalidSimple`,
|
|
12
|
-
* `InvalidRegex`, `InvalidJSONPath`, `InvalidXPath`, `InvalidXPathContext`) mark
|
|
13
|
-
* a condition that cannot be evaluated; they are thrown as a
|
|
14
|
-
* {@link CriterionEvaluationError}, which `CriterionEvaluator` turns into an
|
|
15
|
-
* unmet criterion.
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
const CriterionErrorReason = {
|
|
19
|
-
/** The element is not a Criterion Object. */
|
|
20
|
-
InvalidCriterion: 'invalid-criterion',
|
|
21
|
-
/** The `condition` is missing or empty. */
|
|
22
|
-
MissingCondition: 'missing-condition',
|
|
23
|
-
/** The `type` is present but unreadable. */
|
|
24
|
-
InvalidType: 'invalid-type',
|
|
25
|
-
/** The `type` names no known criterion type. */
|
|
26
|
-
UnknownType: 'unknown-type',
|
|
27
|
-
/** The expression type `version` is present but not a string. */
|
|
28
|
-
InvalidVersion: 'invalid-version',
|
|
29
|
-
/** The expression type `version` is not the one this runner supports. */
|
|
30
|
-
UnsupportedVersion: 'unsupported-version',
|
|
31
|
-
/** The `context` is not a runtime expression. */
|
|
32
|
-
InvalidContext: 'invalid-context',
|
|
33
|
-
/** A `regex`, `jsonpath` or `xpath` criterion has no `context`. */
|
|
34
|
-
MissingContext: 'missing-context',
|
|
35
|
-
/** The `simple` condition cannot be parsed. */
|
|
36
|
-
InvalidSimple: 'invalid-simple',
|
|
37
|
-
/** The `regex` condition is not a valid regular expression. */
|
|
38
|
-
InvalidRegex: 'invalid-regex',
|
|
39
|
-
/** The `jsonpath` condition is not a valid JSONPath query. */
|
|
40
|
-
InvalidJSONPath: 'invalid-jsonpath',
|
|
41
|
-
/** The `xpath` condition is invalid or fails to evaluate. */
|
|
42
|
-
InvalidXPath: 'invalid-xpath',
|
|
43
|
-
/** The resolved `xpath` context is not XML. */
|
|
44
|
-
InvalidXPathContext: 'invalid-xpath-context'
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* One of the `CriterionErrorReason` values.
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
var _default = exports.default = CriterionErrorReason;
|