@usearazzo/runner 1.0.1-alpha.25 → 1.0.1-alpha.27
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 +24 -0
- package/README.md +1 -1
- package/dist/arazzo-runner.browser.js +3390 -2932
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +15 -15
- package/src/criterion/CriterionEvaluator.cjs +2 -2
- package/src/criterion/CriterionEvaluator.mjs +3 -3
- package/src/document/ArazzoDocument.cjs +3 -2
- package/src/document/ArazzoDocument.mjs +3 -2
- package/src/errors/ResolverError.cjs +7 -0
- package/src/errors/ResolverError.mjs +7 -0
- package/src/executor/StepExecutor.cjs +24 -1
- package/src/executor/StepExecutor.mjs +24 -1
- package/src/executor/StepRetryRunner.cjs +1 -1
- package/src/executor/StepRetryRunner.mjs +1 -1
- package/src/executor/WorkflowExecutor.cjs +112 -23
- package/src/executor/WorkflowExecutor.mjs +113 -24
- package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +3 -1
- package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +3 -1
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +2 -0
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +2 -0
- package/src/resolver/WorkflowParameterResolver.cjs +2 -1
- package/src/resolver/WorkflowParameterResolver.mjs +2 -1
- package/src/state/WorkflowExecutionState.cjs +3 -1
- package/src/state/WorkflowExecutionState.mjs +3 -1
- package/types/runner.d.ts +42 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toValue } from '@speclynx/apidom-core';
|
|
2
2
|
import { isArrayElement, isObjectElement, isStringElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { isStepElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
3
|
+
import { isFailureActionElement, isParameterElement, isStepElement, isSuccessActionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
4
4
|
import RuntimeExpressionEvaluator from "../expression/RuntimeExpressionEvaluator.mjs";
|
|
5
5
|
import ArazzoWorkflowExtractor from "../extractor/ArazzoWorkflowExtractor.mjs";
|
|
6
6
|
import ArazzoWorkflowNormalizer from "../normalizer/ArazzoWorkflowNormalizer.mjs";
|
|
@@ -287,6 +287,16 @@ class WorkflowExecutor {
|
|
|
287
287
|
// included: an unreadable assertion found at step three must not cost the
|
|
288
288
|
// run the requests of steps one and two.
|
|
289
289
|
for (const step of steps) this.#stepExecutor.assertSuccessCriteria(step, workflowId);
|
|
290
|
+
// and to every action's `parameters`, for the same reason: an `in` the
|
|
291
|
+
// specification forbids must not cost the run the requests before the
|
|
292
|
+
// step whose action carries it.
|
|
293
|
+
// the workflow's own default actions too: one every step overrides by
|
|
294
|
+
// name never reaches a step's list, yet the validator still reports it.
|
|
295
|
+
this.#assertActionParameters([workflow.successActions, workflow.failureActions], workflowId);
|
|
296
|
+
for (const step of steps) {
|
|
297
|
+
const stepId = toValue(step.stepId);
|
|
298
|
+
this.#assertActionParameters([step.onSuccess, step.onFailure], workflowId, stepId);
|
|
299
|
+
}
|
|
290
300
|
const dependencies = await this.#runDependencies(workflow, invocation, scope);
|
|
291
301
|
if (dependencies.some(dependency => this.#settledFailed(dependency))) {
|
|
292
302
|
// a declared prerequisite did not complete, so this workflow cannot be
|
|
@@ -382,7 +392,7 @@ class WorkflowExecutor {
|
|
|
382
392
|
stepId,
|
|
383
393
|
callStack: nested
|
|
384
394
|
});
|
|
385
|
-
const transferredTo = await this.#runReferencedWorkflow(transition.workflowId, stepId, invocation, scope, 'goto');
|
|
395
|
+
const transferredTo = await this.#runReferencedWorkflow(transition.workflowId, stepId, invocation, scope, 'goto', this.#actionInputs(action?.parameters, outcome, invocation, stepId));
|
|
386
396
|
runOutcome = {
|
|
387
397
|
kind: 'transferred',
|
|
388
398
|
transferredTo
|
|
@@ -558,16 +568,16 @@ class WorkflowExecutor {
|
|
|
558
568
|
* for entering the reference itself, matching the "1 for the step itself
|
|
559
569
|
* plus whatever its sub-run spends" convention a sub-workflow step
|
|
560
570
|
* already follows (without it, a reference to a workflow with few or no
|
|
561
|
-
* steps of its own would cost nothing to fire).
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
* `
|
|
567
|
-
*
|
|
568
|
-
* or sub-workflow step sharing
|
|
569
|
-
* inputs value must not erase one
|
|
570
|
-
* already gave.
|
|
571
|
+
* steps of its own would cost nothing to fire). Its inputs are the
|
|
572
|
+
* action's `parameters` (`#115`), resolved again on every firing
|
|
573
|
+
* against the attempt that fired it — `{}` without them. Its outputs are
|
|
574
|
+
* recorded via `state.setWorkflow`, which *is* "context transfers back",
|
|
575
|
+
* together with the inputs it ran with when the action carries
|
|
576
|
+
* `parameters`. Without them, the recorded `inputs` are preserved rather
|
|
577
|
+
* than overwritten with `{}` when this workflowId was already recorded
|
|
578
|
+
* (by an earlier `dependsOn` prerequisite or sub-workflow step sharing
|
|
579
|
+
* the id): this call's own lack of a real inputs value must not erase one
|
|
580
|
+
* a different, better-informed caller already gave.
|
|
571
581
|
* - a `stepId` reference must name a step of the current workflow (checked
|
|
572
582
|
* lazily, at fire time, via the same lookup a `goto` target uses) and
|
|
573
583
|
* runs as one more attempt at that step, through
|
|
@@ -590,7 +600,7 @@ class WorkflowExecutor {
|
|
|
590
600
|
state,
|
|
591
601
|
callStack
|
|
592
602
|
} = invocation;
|
|
593
|
-
return async action => {
|
|
603
|
+
return async (action, outcome) => {
|
|
594
604
|
throwIfAborted(scope.signal, {
|
|
595
605
|
workflowId,
|
|
596
606
|
stepId,
|
|
@@ -609,13 +619,16 @@ class WorkflowExecutor {
|
|
|
609
619
|
}
|
|
610
620
|
if (hasWorkflowId) {
|
|
611
621
|
const reference = toValue(action.workflowId);
|
|
622
|
+
// resolved before the budget is charged, so an authoring error in them
|
|
623
|
+
// costs no budget unit.
|
|
624
|
+
const inputs = this.#actionInputs(action.parameters, outcome, invocation, stepId);
|
|
612
625
|
this.#chargeBudget(scope, invocation, stepId);
|
|
613
|
-
const result = await this.#runReferencedWorkflow(reference, stepId, invocation, scope, 'retry');
|
|
626
|
+
const result = await this.#runReferencedWorkflow(reference, stepId, invocation, scope, 'retry', inputs);
|
|
614
627
|
// the result's workflowId is the bare id the reference resolved to —
|
|
615
628
|
// the key run state is recorded under, whichever document owns it.
|
|
616
629
|
const refId = result.workflowId;
|
|
617
630
|
state.setWorkflow(refId, {
|
|
618
|
-
inputs: state.getWorkflow(refId)?.inputs ?? {},
|
|
631
|
+
inputs: action.hasKey('parameters') ? inputs : state.getWorkflow(refId)?.inputs ?? {},
|
|
619
632
|
outputs: result.outputs
|
|
620
633
|
});
|
|
621
634
|
retryReferences.push({
|
|
@@ -633,12 +646,12 @@ class WorkflowExecutor {
|
|
|
633
646
|
});
|
|
634
647
|
const refStep = steps[refIndex];
|
|
635
648
|
const refSubWorkflows = [];
|
|
636
|
-
const
|
|
637
|
-
state.setStepOutputs(
|
|
649
|
+
const refOutcome = await this.#chargedAttempt(this.#stepAttempt(refStep, refStepId, invocation, scope, refSubWorkflows), invocation, scope, refStepId)();
|
|
650
|
+
state.setStepOutputs(refOutcome.stepId, refOutcome.outputs);
|
|
638
651
|
retryReferences.push({
|
|
639
652
|
kind: 'step',
|
|
640
653
|
id: refStepId,
|
|
641
|
-
successful:
|
|
654
|
+
successful: refOutcome.successful,
|
|
642
655
|
...(refSubWorkflows.length > 0 ? {
|
|
643
656
|
subWorkflow: refSubWorkflows[0]
|
|
644
657
|
} : {})
|
|
@@ -891,7 +904,8 @@ class WorkflowExecutor {
|
|
|
891
904
|
action: matchedActions[0],
|
|
892
905
|
matchedActions,
|
|
893
906
|
successCriteria,
|
|
894
|
-
actionCriteria
|
|
907
|
+
actionCriteria,
|
|
908
|
+
actionContext: stepExecutor.actionContext(context, stepId, outputs)
|
|
895
909
|
};
|
|
896
910
|
};
|
|
897
911
|
}
|
|
@@ -948,20 +962,95 @@ class WorkflowExecutor {
|
|
|
948
962
|
/**
|
|
949
963
|
* Runs a workflow an action references directly — a retry's `workflowId`
|
|
950
964
|
* reference or a goto's transfer, plain id or cross-document expression —
|
|
951
|
-
* with
|
|
952
|
-
*
|
|
965
|
+
* with the inputs its action's `parameters` resolved to (`#115`), `{}`
|
|
966
|
+
* without them.
|
|
953
967
|
*
|
|
954
968
|
* Shared rather than duplicated by its two callers, which otherwise repeat
|
|
955
|
-
* the identical "resolve the reference, then run
|
|
969
|
+
* the identical "resolve the reference, then run it" sequence.
|
|
956
970
|
* A target its document does not define is rejected by the normalizer,
|
|
957
971
|
* attributed to the calling workflow and `stepId`.
|
|
958
972
|
*/
|
|
959
|
-
async #runReferencedWorkflow(reference, stepId, invocation, scope, via) {
|
|
973
|
+
async #runReferencedWorkflow(reference, stepId, invocation, scope, via, inputs) {
|
|
960
974
|
const locator = await this.#workflowLocatorNormalizer.normalize(reference, invocation.document, {
|
|
961
975
|
workflowId: invocation.workflowId,
|
|
962
976
|
stepId
|
|
963
977
|
});
|
|
964
|
-
return this.#run(locator,
|
|
978
|
+
return this.#run(locator, inputs, scope, invocation.callStack, via);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* The inputs a `goto` / `retry` action naming a `workflowId` passes its
|
|
983
|
+
* target: the action's own `parameters`, mapped by name and resolved against
|
|
984
|
+
* the context of the attempt that fired it — `$statusCode`, `$response.*`
|
|
985
|
+
* and the rest of that step outcome, plus the outputs it just produced.
|
|
986
|
+
* Resolved against the calling invocation's document, so its `$components`
|
|
987
|
+
* apply, never the target's. No `parameters` gives `{}`. Their shape was
|
|
988
|
+
* checked before the workflow's first request, by
|
|
989
|
+
* {@link WorkflowExecutor.#assertActionParameters}.
|
|
990
|
+
*/
|
|
991
|
+
#actionInputs(parameters, outcome, invocation, stepId) {
|
|
992
|
+
const {
|
|
993
|
+
workflowId,
|
|
994
|
+
document
|
|
995
|
+
} = invocation;
|
|
996
|
+
return this.#parameterResolver.resolve(parameters, expression => this.#evaluate(outcome.actionContext, expression, document), {
|
|
997
|
+
workflowId,
|
|
998
|
+
stepId
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Throws {@link ResolverError} unless every action in `lists` — a step's
|
|
1004
|
+
* `onSuccess` / `onFailure`, or the workflow's own `successActions` /
|
|
1005
|
+
* `failureActions` — has an absent `parameters` or a list free of inline `in`:
|
|
1006
|
+
* `malformed-parameters` for one that is present but not a list,
|
|
1007
|
+
* `action-parameter-location` for a Parameter Object that declares `in`. The
|
|
1008
|
+
* specification says outright that "The `in` field MUST NOT be used" on
|
|
1009
|
+
* them. An `in` arriving through a `$components.parameters` Reusable Object
|
|
1010
|
+
* is not inline — a shared component carries `in` for the operation steps
|
|
1011
|
+
* that use it — and the dereferencer marks the transcluded copy with
|
|
1012
|
+
* `ref-fields`.
|
|
1013
|
+
*
|
|
1014
|
+
* Checked for every action, `workflowId` or not, before any step of the
|
|
1015
|
+
* workflow runs: both are authoring errors the validator reports, so a run
|
|
1016
|
+
* must not make requests on the way to discovering them. Valid `parameters`
|
|
1017
|
+
* on an action naming no `workflowId` are still ignored, as the validator
|
|
1018
|
+
* only warns about them. A list that is not an array is skipped here and left
|
|
1019
|
+
* for the code that reads it to report. `stepId` is absent for the
|
|
1020
|
+
* workflow's own lists, and the error then names the workflow alone.
|
|
1021
|
+
*/
|
|
1022
|
+
#assertActionParameters(lists, workflowId, stepId) {
|
|
1023
|
+
const owner = stepId === undefined ? `workflow "${workflowId}"` : `step "${stepId}" in workflow "${workflowId}"`;
|
|
1024
|
+
for (const actions of lists) {
|
|
1025
|
+
if (!isArrayElement(actions)) continue;
|
|
1026
|
+
for (const action of actions) {
|
|
1027
|
+
if (!isSuccessActionElement(action) && !isFailureActionElement(action)) continue;
|
|
1028
|
+
if (!action.hasKey('parameters')) continue;
|
|
1029
|
+
const scope = {
|
|
1030
|
+
workflowId,
|
|
1031
|
+
...(stepId === undefined ? {} : {
|
|
1032
|
+
stepId
|
|
1033
|
+
}),
|
|
1034
|
+
target: 'parameters'
|
|
1035
|
+
};
|
|
1036
|
+
const {
|
|
1037
|
+
parameters
|
|
1038
|
+
} = action;
|
|
1039
|
+
if (!isArrayElement(parameters)) {
|
|
1040
|
+
throw new ResolverError('`parameters` is present but is not a list', {
|
|
1041
|
+
...scope,
|
|
1042
|
+
reason: ResolverError.MalformedParameters
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
const inline = [...parameters].some(parameter => isParameterElement(parameter) && parameter.hasKey('in') && !parameter.meta.hasKey('ref-fields'));
|
|
1046
|
+
if (inline) {
|
|
1047
|
+
throw new ResolverError(`An action parameter of ${owner} declares an \`in\`; action parameters map to the target workflow's inputs by name`, {
|
|
1048
|
+
...scope,
|
|
1049
|
+
reason: ResolverError.ActionParameterLocation
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
965
1054
|
}
|
|
966
1055
|
|
|
967
1056
|
/**
|
|
@@ -99,7 +99,8 @@ class ArazzoDocumentRegistryProvider extends _DocumentRegistryProvider.default {
|
|
|
99
99
|
* A source description's canonical URI is resolved here too — against the
|
|
100
100
|
* document's base URI, into the exact form the document registry keys on —
|
|
101
101
|
* so every consumer works with a ready-to-use, non-relative URI. The first
|
|
102
|
-
* element of a duplicated source description name wins
|
|
102
|
+
* element of a duplicated source description name wins, and so does the
|
|
103
|
+
* first workflow of a duplicated workflowId.
|
|
103
104
|
*/
|
|
104
105
|
#buildIndexes(uri, parseResult) {
|
|
105
106
|
const workflowIndex = new _ArazzoWorkflowIndex.default();
|
|
@@ -111,6 +112,7 @@ class ArazzoDocumentRegistryProvider extends _DocumentRegistryProvider.default {
|
|
|
111
112
|
const workflowId = (0, _apidomCore.toValue)(workflow.workflowId);
|
|
112
113
|
if (typeof workflowId !== 'string') return path.skip();
|
|
113
114
|
if (workflowId === '') return path.skip();
|
|
115
|
+
if (workflowIndex.has(workflowId)) return path.skip();
|
|
114
116
|
const workflowPointer = path.formatPath('jsonpointer');
|
|
115
117
|
workflowIndex.set(workflowId, workflowPointer);
|
|
116
118
|
|
|
@@ -91,7 +91,8 @@ class ArazzoDocumentRegistryProvider extends DocumentRegistryProvider {
|
|
|
91
91
|
* A source description's canonical URI is resolved here too — against the
|
|
92
92
|
* document's base URI, into the exact form the document registry keys on —
|
|
93
93
|
* so every consumer works with a ready-to-use, non-relative URI. The first
|
|
94
|
-
* element of a duplicated source description name wins
|
|
94
|
+
* element of a duplicated source description name wins, and so does the
|
|
95
|
+
* first workflow of a duplicated workflowId.
|
|
95
96
|
*/
|
|
96
97
|
#buildIndexes(uri, parseResult) {
|
|
97
98
|
const workflowIndex = new ArazzoWorkflowIndex();
|
|
@@ -103,6 +104,7 @@ class ArazzoDocumentRegistryProvider extends DocumentRegistryProvider {
|
|
|
103
104
|
const workflowId = toValue(workflow.workflowId);
|
|
104
105
|
if (typeof workflowId !== 'string') return path.skip();
|
|
105
106
|
if (workflowId === '') return path.skip();
|
|
107
|
+
if (workflowIndex.has(workflowId)) return path.skip();
|
|
106
108
|
const workflowPointer = path.formatPath('jsonpointer');
|
|
107
109
|
workflowIndex.set(workflowId, workflowPointer);
|
|
108
110
|
|
|
@@ -44,6 +44,7 @@ const providerOptionsOverride = exports.providerOptionsOverride = {
|
|
|
44
44
|
* Provides OpenAPIDocument instances for the DocumentRegistry.
|
|
45
45
|
*
|
|
46
46
|
* Parses, dereferences, and builds an OperationIndex for OpenAPI documents.
|
|
47
|
+
* The first operation of a duplicated operationId wins.
|
|
47
48
|
* @public
|
|
48
49
|
*/
|
|
49
50
|
class OpenAPIDocumentRegistryProvider extends _DocumentRegistryProvider.default {
|
|
@@ -95,6 +96,7 @@ class OpenAPIDocumentRegistryProvider extends _DocumentRegistryProvider.default
|
|
|
95
96
|
const operationId = (0, _apidomCore.toValue)(operation.operationId);
|
|
96
97
|
if (typeof operationId !== 'string') return path.skip();
|
|
97
98
|
if (operationId === '') return path.skip();
|
|
99
|
+
if (index.has(operationId)) return path.skip();
|
|
98
100
|
index.set(operationId, path.formatPath('jsonpointer'));
|
|
99
101
|
path.skip();
|
|
100
102
|
}
|
|
@@ -36,6 +36,7 @@ export const providerOptionsOverride = {
|
|
|
36
36
|
* Provides OpenAPIDocument instances for the DocumentRegistry.
|
|
37
37
|
*
|
|
38
38
|
* Parses, dereferences, and builds an OperationIndex for OpenAPI documents.
|
|
39
|
+
* The first operation of a duplicated operationId wins.
|
|
39
40
|
* @public
|
|
40
41
|
*/
|
|
41
42
|
class OpenAPIDocumentRegistryProvider extends DocumentRegistryProvider {
|
|
@@ -87,6 +88,7 @@ class OpenAPIDocumentRegistryProvider extends DocumentRegistryProvider {
|
|
|
87
88
|
const operationId = toValue(operation.operationId);
|
|
88
89
|
if (typeof operationId !== 'string') return path.skip();
|
|
89
90
|
if (operationId === '') return path.skip();
|
|
91
|
+
if (index.has(operationId)) return path.skip();
|
|
90
92
|
index.set(operationId, path.formatPath('jsonpointer'));
|
|
91
93
|
path.skip();
|
|
92
94
|
}
|
|
@@ -12,7 +12,8 @@ var _ResolverError = _interopRequireDefault(require("../errors/ResolverError.cjs
|
|
|
12
12
|
var _StepParameterResolver = _interopRequireDefault(require("./StepParameterResolver.cjs"));
|
|
13
13
|
/**
|
|
14
14
|
* Resolves the `parameters` of a step targeting a `workflowId` into the
|
|
15
|
-
* sub-workflow's inputs
|
|
15
|
+
* sub-workflow's inputs — or those of a `goto` / `retry` action naming a
|
|
16
|
+
* `workflowId` into its target's.
|
|
16
17
|
*
|
|
17
18
|
* Values follow the family-wide literal-vs-expression rule of
|
|
18
19
|
* {@link ArazzoValueResolver}. Keys are bare parameter names: per the
|
|
@@ -5,7 +5,8 @@ import ResolverError from "../errors/ResolverError.mjs";
|
|
|
5
5
|
import StepParameterResolver from "./StepParameterResolver.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* Resolves the `parameters` of a step targeting a `workflowId` into the
|
|
8
|
-
* sub-workflow's inputs
|
|
8
|
+
* sub-workflow's inputs — or those of a `goto` / `retry` action naming a
|
|
9
|
+
* `workflowId` into its target's.
|
|
9
10
|
*
|
|
10
11
|
* Values follow the family-wide literal-vs-expression rule of
|
|
11
12
|
* {@link ArazzoValueResolver}. Keys are bare parameter names: per the
|
|
@@ -37,7 +37,9 @@ class WorkflowExecutionState {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Records the resolved outputs of a completed step, read via
|
|
40
|
-
* `$steps.{stepId}.outputs.{name}`.
|
|
40
|
+
* `$steps.{stepId}.outputs.{name}`. Every run records, so a step run again
|
|
41
|
+
* (a `goto` back, a retry) or a later step sharing its `stepId` replaces
|
|
42
|
+
* the earlier outputs, even with none.
|
|
41
43
|
*/
|
|
42
44
|
setStepOutputs(stepId, outputs) {
|
|
43
45
|
this.#steps.set(stepId, outputs);
|
|
@@ -31,7 +31,9 @@ class WorkflowExecutionState {
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Records the resolved outputs of a completed step, read via
|
|
34
|
-
* `$steps.{stepId}.outputs.{name}`.
|
|
34
|
+
* `$steps.{stepId}.outputs.{name}`. Every run records, so a step run again
|
|
35
|
+
* (a `goto` back, a retry) or a later step sharing its `stepId` replaces
|
|
36
|
+
* the earlier outputs, even with none.
|
|
35
37
|
*/
|
|
36
38
|
setStepOutputs(stepId, outputs) {
|
|
37
39
|
this.#steps.set(stepId, outputs);
|
package/types/runner.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ApiDOMReferenceOptions } from '@speclynx/apidom-reference/configuration
|
|
|
3
3
|
import { ApiDOMStructuredError } from '@speclynx/apidom-error';
|
|
4
4
|
import { CriterionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
5
5
|
import { FailureActionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
6
|
+
import { FailureActionParametersElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
6
7
|
import { JSONPointer } from '@speclynx/apidom-json-pointer';
|
|
7
8
|
import { OperationElement } from '@speclynx/apidom-ns-openapi-2';
|
|
8
9
|
import { OperationElement as OperationElement_2 } from '@speclynx/apidom-ns-openapi-3-0';
|
|
@@ -20,6 +21,7 @@ import { StepOnSuccessElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
|
20
21
|
import type { StepOutputsElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
21
22
|
import { StepParametersElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
22
23
|
import { SuccessActionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
24
|
+
import { SuccessActionParametersElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
23
25
|
import { toYAML } from '@speclynx/apidom-core';
|
|
24
26
|
import { WorkflowElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
25
27
|
import type { WorkflowOutputsElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
@@ -125,8 +127,9 @@ export declare class ArazzoDocument extends APIDocument {
|
|
|
125
127
|
static is(doc: APIDocument): doc is ArazzoDocument;
|
|
126
128
|
/**
|
|
127
129
|
* The workflows of this document that can be addressed by `workflowId`, in
|
|
128
|
-
* document order.
|
|
129
|
-
*
|
|
130
|
+
* document order. A duplicated `workflowId` is listed once, for its first
|
|
131
|
+
* workflow. Reads this document only: source descriptions are neither loaded
|
|
132
|
+
* nor listed.
|
|
130
133
|
*/
|
|
131
134
|
listWorkflows(): WorkflowDescriptor[];
|
|
132
135
|
/**
|
|
@@ -1085,6 +1088,7 @@ export declare interface OpenAPIDocumentAssemblerOptions {
|
|
|
1085
1088
|
* Provides OpenAPIDocument instances for the DocumentRegistry.
|
|
1086
1089
|
*
|
|
1087
1090
|
* Parses, dereferences, and builds an OperationIndex for OpenAPI documents.
|
|
1091
|
+
* The first operation of a duplicated operationId wins.
|
|
1088
1092
|
* @public
|
|
1089
1093
|
*/
|
|
1090
1094
|
export declare class OpenAPIDocumentRegistryProvider extends DocumentRegistryProvider {
|
|
@@ -1714,6 +1718,13 @@ export declare interface ResolvedRequestBody {
|
|
|
1714
1718
|
* @public
|
|
1715
1719
|
*/
|
|
1716
1720
|
export declare class ResolverError extends ArazzoRunnerError {
|
|
1721
|
+
/**
|
|
1722
|
+
* A parameter of a Success / Failure Action declares an `in` inline, which
|
|
1723
|
+
* the Arazzo Specification forbids; one inherited from a
|
|
1724
|
+
* `$components.parameters` Reusable Object maps by name instead. Thrown
|
|
1725
|
+
* before the workflow's first request.
|
|
1726
|
+
*/
|
|
1727
|
+
static readonly ActionParameterLocation: "action-parameter-location";
|
|
1717
1728
|
/** A parameter cannot be delivered unambiguously at its location. */
|
|
1718
1729
|
static readonly AmbiguousDelivery: "ambiguous-delivery";
|
|
1719
1730
|
/** An output or a request body payload holds a value that is not a valid runtime expression. */
|
|
@@ -2167,6 +2178,18 @@ export declare interface StepExecutionResult {
|
|
|
2167
2178
|
* in list order.
|
|
2168
2179
|
*/
|
|
2169
2180
|
readonly actionCriteria: readonly CriterionEvaluationRecord[];
|
|
2181
|
+
/**
|
|
2182
|
+
* The runtime-expression context the step's actions are taken in: the
|
|
2183
|
+
* context its action `criteria` were evaluated against, with
|
|
2184
|
+
* `$steps.{stepId}.outputs` holding the outputs this attempt just resolved.
|
|
2185
|
+
*
|
|
2186
|
+
* An action's `parameters` resolve against it, so a `goto` or `retry` naming
|
|
2187
|
+
* a `workflowId` passes values read from this step's response, request and
|
|
2188
|
+
* fresh outputs. The overlay matters because run state is written only once
|
|
2189
|
+
* a step's retry chain settles, so mid-chain it may still hold an earlier
|
|
2190
|
+
* run's outputs.
|
|
2191
|
+
*/
|
|
2192
|
+
readonly actionContext: RuntimeExpressionContext;
|
|
2170
2193
|
}
|
|
2171
2194
|
|
|
2172
2195
|
/**
|
|
@@ -2277,6 +2300,17 @@ export declare class StepExecutor {
|
|
|
2277
2300
|
* {@link StepExecutor.execute}.
|
|
2278
2301
|
*/
|
|
2279
2302
|
selectActions(step: StepElement, successful: boolean, context: RuntimeExpressionContext, workflowId?: string): Pick<StepExecutionResult, 'matchedActions' | 'actionCriteria'>;
|
|
2303
|
+
/**
|
|
2304
|
+
* The context a step's actions are taken in — see
|
|
2305
|
+
* {@link StepExecutionResult.actionContext}: `context` with
|
|
2306
|
+
* `$steps.{stepId}.outputs` replaced by the outputs the attempt just
|
|
2307
|
+
* resolved, as a fresh object, so run state is never written.
|
|
2308
|
+
*
|
|
2309
|
+
* Public for the same reason as {@link StepExecutor.selectActions}: the
|
|
2310
|
+
* workflow executor builds this context for a step targeting a
|
|
2311
|
+
* `workflowId`, which never reaches {@link StepExecutor.execute}.
|
|
2312
|
+
*/
|
|
2313
|
+
actionContext(context: RuntimeExpressionContext, stepId: string, outputs: Record<string, unknown>): RuntimeExpressionContext;
|
|
2280
2314
|
}
|
|
2281
2315
|
|
|
2282
2316
|
/**
|
|
@@ -2586,7 +2620,9 @@ export declare class WorkflowExecutionState {
|
|
|
2586
2620
|
constructor(options?: WorkflowExecutionStateOptions);
|
|
2587
2621
|
/**
|
|
2588
2622
|
* Records the resolved outputs of a completed step, read via
|
|
2589
|
-
* `$steps.{stepId}.outputs.{name}`.
|
|
2623
|
+
* `$steps.{stepId}.outputs.{name}`. Every run records, so a step run again
|
|
2624
|
+
* (a `goto` back, a retry) or a later step sharing its `stepId` replaces
|
|
2625
|
+
* the earlier outputs, even with none.
|
|
2590
2626
|
*/
|
|
2591
2627
|
setStepOutputs(stepId: string, outputs: Record<string, unknown>): void;
|
|
2592
2628
|
/**
|
|
@@ -2767,7 +2803,8 @@ export declare type WorkflowId = string;
|
|
|
2767
2803
|
|
|
2768
2804
|
/**
|
|
2769
2805
|
* Resolves the `parameters` of a step targeting a `workflowId` into the
|
|
2770
|
-
* sub-workflow's inputs
|
|
2806
|
+
* sub-workflow's inputs — or those of a `goto` / `retry` action naming a
|
|
2807
|
+
* `workflowId` into its target's.
|
|
2771
2808
|
*
|
|
2772
2809
|
* Values follow the family-wide literal-vs-expression rule of
|
|
2773
2810
|
* {@link ArazzoValueResolver}. Keys are bare parameter names: per the
|
|
@@ -2790,7 +2827,7 @@ export declare class WorkflowParameterResolver extends StepParameterResolver {
|
|
|
2790
2827
|
*
|
|
2791
2828
|
* `scope` names the step in a thrown {@link ResolverError}.
|
|
2792
2829
|
*/
|
|
2793
|
-
resolve(parameters: StepParametersElement | undefined, resolve: RuntimeExpressionResolver, scope: StepScope): Record<string, unknown>;
|
|
2830
|
+
resolve(parameters: StepParametersElement | SuccessActionParametersElement | FailureActionParametersElement | undefined, resolve: RuntimeExpressionResolver, scope: StepScope): Record<string, unknown>;
|
|
2794
2831
|
}
|
|
2795
2832
|
|
|
2796
2833
|
/**
|