@usearazzo/runner 1.0.1-alpha.23 → 1.0.1-alpha.25
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 +3 -1
- package/dist/arazzo-runner.browser.js +400 -229
- 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/document/ArazzoDocument.cjs +33 -1
- package/src/document/ArazzoDocument.mjs +32 -1
- 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 +228 -46
- package/src/criterion/CriterionErrorReason.cjs +0 -51
- package/src/criterion/CriterionErrorReason.mjs +0 -46
|
@@ -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,
|
|
@@ -209,7 +209,7 @@ class StepRetryRunner {
|
|
|
209
209
|
throw new _ExecutionError.default(`retry action on step "${context.stepId}" in workflow "${context.workflowId}" carries a stepId/workflowId reference, but no runReference was given to run it`, {
|
|
210
210
|
stepId: context.stepId,
|
|
211
211
|
workflowId: context.workflowId,
|
|
212
|
-
reason:
|
|
212
|
+
reason: _ExecutionError.default.RetryReferenceUnsupported
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -199,7 +199,7 @@ class StepRetryRunner {
|
|
|
199
199
|
throw new ExecutionError(`retry action on step "${context.stepId}" in workflow "${context.workflowId}" carries a stepId/workflowId reference, but no runReference was given to run it`, {
|
|
200
200
|
stepId: context.stepId,
|
|
201
201
|
workflowId: context.workflowId,
|
|
202
|
-
reason:
|
|
202
|
+
reason: ExecutionError.RetryReferenceUnsupported
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -104,7 +104,7 @@ class StepTransitionInterpreter {
|
|
|
104
104
|
throw new _ExecutionError.default(`goto action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
|
|
105
105
|
stepId,
|
|
106
106
|
workflowId,
|
|
107
|
-
reason:
|
|
107
|
+
reason: _ExecutionError.default.AmbiguousTarget
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
if (hasStepId) {
|
|
@@ -122,13 +122,13 @@ class StepTransitionInterpreter {
|
|
|
122
122
|
throw new _ExecutionError.default(`goto action on step "${stepId}" in workflow "${workflowId}" has neither stepId nor workflowId`, {
|
|
123
123
|
stepId,
|
|
124
124
|
workflowId,
|
|
125
|
-
reason:
|
|
125
|
+
reason: _ExecutionError.default.GotoTargetMissing
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
throw new _ExecutionError.default(`action on step "${stepId}" in workflow "${workflowId}" has unsupported type "${type}"`, {
|
|
129
129
|
stepId,
|
|
130
130
|
workflowId,
|
|
131
|
-
reason:
|
|
131
|
+
reason: _ExecutionError.default.UnknownActionType
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -96,7 +96,7 @@ class StepTransitionInterpreter {
|
|
|
96
96
|
throw new ExecutionError(`goto action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
|
|
97
97
|
stepId,
|
|
98
98
|
workflowId,
|
|
99
|
-
reason:
|
|
99
|
+
reason: ExecutionError.AmbiguousTarget
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
if (hasStepId) {
|
|
@@ -114,13 +114,13 @@ class StepTransitionInterpreter {
|
|
|
114
114
|
throw new ExecutionError(`goto action on step "${stepId}" in workflow "${workflowId}" has neither stepId nor workflowId`, {
|
|
115
115
|
stepId,
|
|
116
116
|
workflowId,
|
|
117
|
-
reason:
|
|
117
|
+
reason: ExecutionError.GotoTargetMissing
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
throw new ExecutionError(`action on step "${stepId}" in workflow "${workflowId}" has unsupported type "${type}"`, {
|
|
121
121
|
stepId,
|
|
122
122
|
workflowId,
|
|
123
|
-
reason:
|
|
123
|
+
reason: ExecutionError.UnknownActionType
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -89,7 +89,7 @@ class WorkflowCallStack {
|
|
|
89
89
|
// detects both, so a loop crossing the two mechanisms cannot slip between
|
|
90
90
|
// them.
|
|
91
91
|
const closingEdges = [...this.#calls.slice(repeated + 1).map(call => call.via), via];
|
|
92
|
-
const reason = closingEdges.every(edge => edge === 'dependsOn') ?
|
|
92
|
+
const reason = closingEdges.every(edge => edge === 'dependsOn') ? _ExecutionError.default.DependsOnCycle : _ExecutionError.default.WorkflowCycle;
|
|
93
93
|
throw new _ExecutionError.default(`workflow "${workflowId}" is already in progress; its call chain forms a cycle (${path.join(' -> ')})`, {
|
|
94
94
|
workflowId,
|
|
95
95
|
reason,
|
|
@@ -99,7 +99,7 @@ class WorkflowCallStack {
|
|
|
99
99
|
if (this.#calls.length >= this.#maxDepth) {
|
|
100
100
|
throw new _ExecutionError.default(`workflow "${workflowId}" nests deeper than the limit of ${this.#maxDepth} workflows`, {
|
|
101
101
|
workflowId,
|
|
102
|
-
reason:
|
|
102
|
+
reason: _ExecutionError.default.WorkflowDepth,
|
|
103
103
|
path: [...this.path, this.#display(workflowId, documentURI)]
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -79,7 +79,7 @@ class WorkflowCallStack {
|
|
|
79
79
|
// detects both, so a loop crossing the two mechanisms cannot slip between
|
|
80
80
|
// them.
|
|
81
81
|
const closingEdges = [...this.#calls.slice(repeated + 1).map(call => call.via), via];
|
|
82
|
-
const reason = closingEdges.every(edge => edge === 'dependsOn') ?
|
|
82
|
+
const reason = closingEdges.every(edge => edge === 'dependsOn') ? ExecutionError.DependsOnCycle : ExecutionError.WorkflowCycle;
|
|
83
83
|
throw new ExecutionError(`workflow "${workflowId}" is already in progress; its call chain forms a cycle (${path.join(' -> ')})`, {
|
|
84
84
|
workflowId,
|
|
85
85
|
reason,
|
|
@@ -89,7 +89,7 @@ class WorkflowCallStack {
|
|
|
89
89
|
if (this.#calls.length >= this.#maxDepth) {
|
|
90
90
|
throw new ExecutionError(`workflow "${workflowId}" nests deeper than the limit of ${this.#maxDepth} workflows`, {
|
|
91
91
|
workflowId,
|
|
92
|
-
reason:
|
|
92
|
+
reason: ExecutionError.WorkflowDepth,
|
|
93
93
|
path: [...this.path, this.#display(workflowId, documentURI)]
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -245,7 +245,7 @@ class WorkflowExecutor {
|
|
|
245
245
|
const unknown = Object.keys(options).filter(key => !WorkflowExecutor.#EXECUTE_OPTION_KEYS.has(key));
|
|
246
246
|
if (unknown.length === 0) return;
|
|
247
247
|
throw new _ExecutionError.default(`execute received unknown option(s) ${unknown.join(', ')}; it takes (workflowId, { inputs, executeOptions, dependencyInputs, runDependencies, signal }) — workflow inputs go under "inputs"`, {
|
|
248
|
-
reason:
|
|
248
|
+
reason: _ExecutionError.default.UnknownExecuteOption
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -378,7 +378,7 @@ class WorkflowExecutor {
|
|
|
378
378
|
break;
|
|
379
379
|
case 'goto':
|
|
380
380
|
index = this.#interpreter.indexOfStep(steps, transition.stepId, workflowId, {
|
|
381
|
-
reason:
|
|
381
|
+
reason: _ExecutionError.default.GotoTargetNotFound,
|
|
382
382
|
label: 'goto target'
|
|
383
383
|
});
|
|
384
384
|
break;
|
|
@@ -425,7 +425,7 @@ class WorkflowExecutor {
|
|
|
425
425
|
throw new _ExecutionError.default(`step "${stepId}" in workflow "${workflowId}" produced an unrecognized transition ${JSON.stringify(unreachable)}`, {
|
|
426
426
|
workflowId,
|
|
427
427
|
stepId,
|
|
428
|
-
reason:
|
|
428
|
+
reason: _ExecutionError.default.UnknownTransitionKind
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
431
|
}
|
|
@@ -513,7 +513,7 @@ class WorkflowExecutor {
|
|
|
513
513
|
throw new _ExecutionError.default(`workflow "${invocation.workflowId}" exceeded its budget of ${this.#maxSteps} step attempts (a goto loop, excessive retries, or runaway sub-workflow calls)`, {
|
|
514
514
|
workflowId: invocation.workflowId,
|
|
515
515
|
stepId,
|
|
516
|
-
reason:
|
|
516
|
+
reason: _ExecutionError.default.StepBudget,
|
|
517
517
|
path: invocation.callStack.path
|
|
518
518
|
});
|
|
519
519
|
}
|
|
@@ -618,7 +618,7 @@ class WorkflowExecutor {
|
|
|
618
618
|
throw new _ExecutionError.default(`retry action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
|
|
619
619
|
stepId,
|
|
620
620
|
workflowId,
|
|
621
|
-
reason:
|
|
621
|
+
reason: _ExecutionError.default.AmbiguousTarget
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
if (hasWorkflowId) {
|
|
@@ -642,7 +642,7 @@ class WorkflowExecutor {
|
|
|
642
642
|
}
|
|
643
643
|
const refStepId = (0, _apidomCore.toValue)(action.stepId);
|
|
644
644
|
const refIndex = this.#interpreter.indexOfStep(steps, refStepId, workflowId, {
|
|
645
|
-
reason:
|
|
645
|
+
reason: _ExecutionError.default.RetryTargetNotFound,
|
|
646
646
|
label: 'retry reference'
|
|
647
647
|
});
|
|
648
648
|
const refStep = steps[refIndex];
|
|
@@ -761,14 +761,14 @@ class WorkflowExecutor {
|
|
|
761
761
|
if (!(0, _apidomDatamodel.isArrayElement)(dependsOn)) {
|
|
762
762
|
throw new _ExecutionError.default(`workflow "${workflowId}" has a non-list "dependsOn"`, {
|
|
763
763
|
workflowId,
|
|
764
|
-
reason:
|
|
764
|
+
reason: _ExecutionError.default.MalformedDependsOn
|
|
765
765
|
});
|
|
766
766
|
}
|
|
767
767
|
const references = [...dependsOn].map((entry, index) => {
|
|
768
768
|
if (!(0, _apidomDatamodel.isStringElement)(entry)) {
|
|
769
769
|
throw new _ExecutionError.default(`workflow "${workflowId}" has a non-string entry at dependsOn[${index}]`, {
|
|
770
770
|
workflowId,
|
|
771
|
-
reason:
|
|
771
|
+
reason: _ExecutionError.default.MalformedDependsOn
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
774
|
return (0, _apidomCore.toValue)(entry);
|
|
@@ -953,7 +953,7 @@ class WorkflowExecutor {
|
|
|
953
953
|
throw new _ExecutionError.default(`step "${stepId}" in workflow "${workflowId}" declares a workflowId alongside ${conflicting.join(', ')} (mutually exclusive)`, {
|
|
954
954
|
stepId,
|
|
955
955
|
workflowId,
|
|
956
|
-
reason:
|
|
956
|
+
reason: _ExecutionError.default.AmbiguousTarget
|
|
957
957
|
});
|
|
958
958
|
}
|
|
959
959
|
return (0, _apidomCore.toValue)(step.workflowId);
|
|
@@ -999,7 +999,7 @@ class WorkflowExecutor {
|
|
|
999
999
|
if (!document.workflowIndex.has(workflowId)) {
|
|
1000
1000
|
throw new _ExecutionError.default(`workflow "${workflowId}" not found in Arazzo document at "${document.uri}"`, {
|
|
1001
1001
|
workflowId,
|
|
1002
|
-
reason:
|
|
1002
|
+
reason: _ExecutionError.default.WorkflowNotFound
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
1005
|
const workflow = await this.#normalizer.normalize(this.#extractor.extract(document, workflowId), document);
|
|
@@ -1030,14 +1030,14 @@ class WorkflowExecutor {
|
|
|
1030
1030
|
if (!(0, _apidomDatamodel.isArrayElement)(steps)) {
|
|
1031
1031
|
throw new _ExecutionError.default(`workflow "${workflowId}" has a non-list "steps"`, {
|
|
1032
1032
|
workflowId,
|
|
1033
|
-
reason:
|
|
1033
|
+
reason: _ExecutionError.default.MalformedSteps
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
1036
|
return [...steps].map((step, index) => {
|
|
1037
1037
|
if (!(0, _apidomNsArazzo.isStepElement)(step)) {
|
|
1038
1038
|
throw new _ExecutionError.default(`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
|
|
1039
1039
|
workflowId,
|
|
1040
|
-
reason:
|
|
1040
|
+
reason: _ExecutionError.default.MalformedSteps
|
|
1041
1041
|
});
|
|
1042
1042
|
}
|
|
1043
1043
|
return step;
|
|
@@ -1060,7 +1060,7 @@ class WorkflowExecutor {
|
|
|
1060
1060
|
throw new _ResolverError.default('`outputs` is present but is not a map', {
|
|
1061
1061
|
workflowId,
|
|
1062
1062
|
target: 'outputs',
|
|
1063
|
-
reason:
|
|
1063
|
+
reason: _ResolverError.default.MalformedOutputs
|
|
1064
1064
|
});
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
@@ -231,7 +231,7 @@ class WorkflowExecutor {
|
|
|
231
231
|
const unknown = Object.keys(options).filter(key => !WorkflowExecutor.#EXECUTE_OPTION_KEYS.has(key));
|
|
232
232
|
if (unknown.length === 0) return;
|
|
233
233
|
throw new ExecutionError(`execute received unknown option(s) ${unknown.join(', ')}; it takes (workflowId, { inputs, executeOptions, dependencyInputs, runDependencies, signal }) — workflow inputs go under "inputs"`, {
|
|
234
|
-
reason:
|
|
234
|
+
reason: ExecutionError.UnknownExecuteOption
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -364,7 +364,7 @@ class WorkflowExecutor {
|
|
|
364
364
|
break;
|
|
365
365
|
case 'goto':
|
|
366
366
|
index = this.#interpreter.indexOfStep(steps, transition.stepId, workflowId, {
|
|
367
|
-
reason:
|
|
367
|
+
reason: ExecutionError.GotoTargetNotFound,
|
|
368
368
|
label: 'goto target'
|
|
369
369
|
});
|
|
370
370
|
break;
|
|
@@ -411,7 +411,7 @@ class WorkflowExecutor {
|
|
|
411
411
|
throw new ExecutionError(`step "${stepId}" in workflow "${workflowId}" produced an unrecognized transition ${JSON.stringify(unreachable)}`, {
|
|
412
412
|
workflowId,
|
|
413
413
|
stepId,
|
|
414
|
-
reason:
|
|
414
|
+
reason: ExecutionError.UnknownTransitionKind
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
417
|
}
|
|
@@ -499,7 +499,7 @@ class WorkflowExecutor {
|
|
|
499
499
|
throw new ExecutionError(`workflow "${invocation.workflowId}" exceeded its budget of ${this.#maxSteps} step attempts (a goto loop, excessive retries, or runaway sub-workflow calls)`, {
|
|
500
500
|
workflowId: invocation.workflowId,
|
|
501
501
|
stepId,
|
|
502
|
-
reason:
|
|
502
|
+
reason: ExecutionError.StepBudget,
|
|
503
503
|
path: invocation.callStack.path
|
|
504
504
|
});
|
|
505
505
|
}
|
|
@@ -604,7 +604,7 @@ class WorkflowExecutor {
|
|
|
604
604
|
throw new ExecutionError(`retry action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
|
|
605
605
|
stepId,
|
|
606
606
|
workflowId,
|
|
607
|
-
reason:
|
|
607
|
+
reason: ExecutionError.AmbiguousTarget
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
if (hasWorkflowId) {
|
|
@@ -628,7 +628,7 @@ class WorkflowExecutor {
|
|
|
628
628
|
}
|
|
629
629
|
const refStepId = toValue(action.stepId);
|
|
630
630
|
const refIndex = this.#interpreter.indexOfStep(steps, refStepId, workflowId, {
|
|
631
|
-
reason:
|
|
631
|
+
reason: ExecutionError.RetryTargetNotFound,
|
|
632
632
|
label: 'retry reference'
|
|
633
633
|
});
|
|
634
634
|
const refStep = steps[refIndex];
|
|
@@ -747,14 +747,14 @@ class WorkflowExecutor {
|
|
|
747
747
|
if (!isArrayElement(dependsOn)) {
|
|
748
748
|
throw new ExecutionError(`workflow "${workflowId}" has a non-list "dependsOn"`, {
|
|
749
749
|
workflowId,
|
|
750
|
-
reason:
|
|
750
|
+
reason: ExecutionError.MalformedDependsOn
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
753
|
const references = [...dependsOn].map((entry, index) => {
|
|
754
754
|
if (!isStringElement(entry)) {
|
|
755
755
|
throw new ExecutionError(`workflow "${workflowId}" has a non-string entry at dependsOn[${index}]`, {
|
|
756
756
|
workflowId,
|
|
757
|
-
reason:
|
|
757
|
+
reason: ExecutionError.MalformedDependsOn
|
|
758
758
|
});
|
|
759
759
|
}
|
|
760
760
|
return toValue(entry);
|
|
@@ -939,7 +939,7 @@ class WorkflowExecutor {
|
|
|
939
939
|
throw new ExecutionError(`step "${stepId}" in workflow "${workflowId}" declares a workflowId alongside ${conflicting.join(', ')} (mutually exclusive)`, {
|
|
940
940
|
stepId,
|
|
941
941
|
workflowId,
|
|
942
|
-
reason:
|
|
942
|
+
reason: ExecutionError.AmbiguousTarget
|
|
943
943
|
});
|
|
944
944
|
}
|
|
945
945
|
return toValue(step.workflowId);
|
|
@@ -985,7 +985,7 @@ class WorkflowExecutor {
|
|
|
985
985
|
if (!document.workflowIndex.has(workflowId)) {
|
|
986
986
|
throw new ExecutionError(`workflow "${workflowId}" not found in Arazzo document at "${document.uri}"`, {
|
|
987
987
|
workflowId,
|
|
988
|
-
reason:
|
|
988
|
+
reason: ExecutionError.WorkflowNotFound
|
|
989
989
|
});
|
|
990
990
|
}
|
|
991
991
|
const workflow = await this.#normalizer.normalize(this.#extractor.extract(document, workflowId), document);
|
|
@@ -1016,14 +1016,14 @@ class WorkflowExecutor {
|
|
|
1016
1016
|
if (!isArrayElement(steps)) {
|
|
1017
1017
|
throw new ExecutionError(`workflow "${workflowId}" has a non-list "steps"`, {
|
|
1018
1018
|
workflowId,
|
|
1019
|
-
reason:
|
|
1019
|
+
reason: ExecutionError.MalformedSteps
|
|
1020
1020
|
});
|
|
1021
1021
|
}
|
|
1022
1022
|
return [...steps].map((step, index) => {
|
|
1023
1023
|
if (!isStepElement(step)) {
|
|
1024
1024
|
throw new ExecutionError(`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
|
|
1025
1025
|
workflowId,
|
|
1026
|
-
reason:
|
|
1026
|
+
reason: ExecutionError.MalformedSteps
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
1029
|
return step;
|
|
@@ -1046,7 +1046,7 @@ class WorkflowExecutor {
|
|
|
1046
1046
|
throw new ResolverError('`outputs` is present but is not a map', {
|
|
1047
1047
|
workflowId,
|
|
1048
1048
|
target: 'outputs',
|
|
1049
|
-
reason:
|
|
1049
|
+
reason: ResolverError.MalformedOutputs
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
1052
|
|
package/src/executor/abort.cjs
CHANGED
|
@@ -39,8 +39,8 @@ const readAbortSignal = options => {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Throws
|
|
43
|
-
* nothing otherwise.
|
|
42
|
+
* Throws with reason `ExecutionError.Aborted` when the caller has cancelled
|
|
43
|
+
* the run, and does nothing otherwise.
|
|
44
44
|
*
|
|
45
45
|
* Cancellation throws rather than resolving as a `failed` result because it is
|
|
46
46
|
* not a workflow outcome: nothing was judged by `successCriteria`, no failure
|
|
@@ -62,7 +62,7 @@ const throwIfAborted = (signal, context) => {
|
|
|
62
62
|
throw new _ExecutionError.default(`run aborted before ${where}`, {
|
|
63
63
|
workflowId,
|
|
64
64
|
stepId,
|
|
65
|
-
reason:
|
|
65
|
+
reason: _ExecutionError.default.Aborted,
|
|
66
66
|
path: callStack?.path,
|
|
67
67
|
cause: signal.reason
|
|
68
68
|
});
|
package/src/executor/abort.mjs
CHANGED
|
@@ -31,8 +31,8 @@ export const readAbortSignal = options => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Throws
|
|
35
|
-
* nothing otherwise.
|
|
34
|
+
* Throws with reason `ExecutionError.Aborted` when the caller has cancelled
|
|
35
|
+
* the run, and does nothing otherwise.
|
|
36
36
|
*
|
|
37
37
|
* Cancellation throws rather than resolving as a `failed` result because it is
|
|
38
38
|
* not a workflow outcome: nothing was judged by `successCriteria`, no failure
|
|
@@ -53,7 +53,7 @@ export const throwIfAborted = (signal, context) => {
|
|
|
53
53
|
throw new ExecutionError(`run aborted before ${where}`, {
|
|
54
54
|
workflowId,
|
|
55
55
|
stepId,
|
|
56
|
-
reason:
|
|
56
|
+
reason: ExecutionError.Aborted,
|
|
57
57
|
path: callStack?.path,
|
|
58
58
|
cause: signal.reason
|
|
59
59
|
});
|
|
@@ -96,7 +96,7 @@ class RuntimeExpressionEvaluator {
|
|
|
96
96
|
if (value === undefined && this.#strict) {
|
|
97
97
|
throw new _RuntimeExpressionError.default(`Runtime expression "${expression}" could not be resolved against the context`, {
|
|
98
98
|
expression,
|
|
99
|
-
reason:
|
|
99
|
+
reason: _RuntimeExpressionError.default.UnresolvedReference
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
return value;
|
|
@@ -142,13 +142,13 @@ class RuntimeExpressionEvaluator {
|
|
|
142
142
|
throw new _RuntimeExpressionError.default(`Failed to parse runtime expression "${expression}"`, {
|
|
143
143
|
cause: error,
|
|
144
144
|
expression,
|
|
145
|
-
reason:
|
|
145
|
+
reason: _RuntimeExpressionError.default.ParseError
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
if (!result.result.success || result.tree === undefined) {
|
|
149
149
|
throw new _RuntimeExpressionError.default(`Invalid runtime expression "${expression}"`, {
|
|
150
150
|
expression,
|
|
151
|
-
reason:
|
|
151
|
+
reason: _RuntimeExpressionError.default.InvalidExpression
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
return result.tree;
|
|
@@ -166,7 +166,7 @@ class RuntimeExpressionEvaluator {
|
|
|
166
166
|
if (calledWorkflow === undefined || !HTTP_EXCHANGE_NODES.has(node.type)) return;
|
|
167
167
|
throw new _RuntimeExpressionError.default(`Runtime expression "${expression}" is not available: step "${calledWorkflow.stepId}" calls workflow "${calledWorkflow.workflowId}", not an operation, so it has no HTTP request or response`, {
|
|
168
168
|
expression,
|
|
169
|
-
reason:
|
|
169
|
+
reason: _RuntimeExpressionError.default.UnavailableExpression
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -203,7 +203,7 @@ class RuntimeExpressionEvaluator {
|
|
|
203
203
|
default:
|
|
204
204
|
throw new _RuntimeExpressionError.default(`Unsupported runtime expression node "${node.type}"`, {
|
|
205
205
|
expression,
|
|
206
|
-
reason:
|
|
206
|
+
reason: _RuntimeExpressionError.default.UnsupportedNode
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -87,7 +87,7 @@ class RuntimeExpressionEvaluator {
|
|
|
87
87
|
if (value === undefined && this.#strict) {
|
|
88
88
|
throw new RuntimeExpressionError(`Runtime expression "${expression}" could not be resolved against the context`, {
|
|
89
89
|
expression,
|
|
90
|
-
reason:
|
|
90
|
+
reason: RuntimeExpressionError.UnresolvedReference
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
return value;
|
|
@@ -133,13 +133,13 @@ class RuntimeExpressionEvaluator {
|
|
|
133
133
|
throw new RuntimeExpressionError(`Failed to parse runtime expression "${expression}"`, {
|
|
134
134
|
cause: error,
|
|
135
135
|
expression,
|
|
136
|
-
reason:
|
|
136
|
+
reason: RuntimeExpressionError.ParseError
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
if (!result.result.success || result.tree === undefined) {
|
|
140
140
|
throw new RuntimeExpressionError(`Invalid runtime expression "${expression}"`, {
|
|
141
141
|
expression,
|
|
142
|
-
reason:
|
|
142
|
+
reason: RuntimeExpressionError.InvalidExpression
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
return result.tree;
|
|
@@ -157,7 +157,7 @@ class RuntimeExpressionEvaluator {
|
|
|
157
157
|
if (calledWorkflow === undefined || !HTTP_EXCHANGE_NODES.has(node.type)) return;
|
|
158
158
|
throw new RuntimeExpressionError(`Runtime expression "${expression}" is not available: step "${calledWorkflow.stepId}" calls workflow "${calledWorkflow.workflowId}", not an operation, so it has no HTTP request or response`, {
|
|
159
159
|
expression,
|
|
160
|
-
reason:
|
|
160
|
+
reason: RuntimeExpressionError.UnavailableExpression
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -194,7 +194,7 @@ class RuntimeExpressionEvaluator {
|
|
|
194
194
|
default:
|
|
195
195
|
throw new RuntimeExpressionError(`Unsupported runtime expression node "${node.type}"`, {
|
|
196
196
|
expression,
|
|
197
|
-
reason:
|
|
197
|
+
reason: RuntimeExpressionError.UnsupportedNode
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
}
|
package/src/index.cjs
CHANGED
|
@@ -113,12 +113,6 @@ 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
116
|
Object.defineProperty(exports, "CriterionEvaluationError", {
|
|
123
117
|
enumerable: true,
|
|
124
118
|
get: function () {
|
|
@@ -417,7 +411,6 @@ var _SimpleCriterionEvaluator = _interopRequireDefault(require("./criterion/Simp
|
|
|
417
411
|
var _RegexCriterionEvaluator = _interopRequireDefault(require("./criterion/RegexCriterionEvaluator.cjs"));
|
|
418
412
|
var _JSONPathCriterionEvaluator = _interopRequireDefault(require("./criterion/JSONPathCriterionEvaluator.cjs"));
|
|
419
413
|
var _XPathCriterionEvaluator = _interopRequireDefault(require("./criterion/XPathCriterionEvaluator.cjs"));
|
|
420
|
-
var _CriterionErrorReason = _interopRequireDefault(require("./criterion/CriterionErrorReason.cjs"));
|
|
421
414
|
var _WorkflowExecutionState = _interopRequireDefault(require("./state/WorkflowExecutionState.cjs"));
|
|
422
415
|
var _ArazzoValueResolver = _interopRequireDefault(require("./resolver/ArazzoValueResolver.cjs"));
|
|
423
416
|
var _StepParameterResolver = _interopRequireDefault(require("./resolver/StepParameterResolver.cjs"));
|
package/src/index.mjs
CHANGED
|
@@ -43,7 +43,6 @@ 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";
|
|
47
46
|
/* Execution State */
|
|
48
47
|
export { default as WorkflowExecutionState } from "./state/WorkflowExecutionState.mjs";
|
|
49
48
|
/* Resolvers */
|