@usearazzo/runner 1.0.1-alpha.26 → 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 +18 -0
- package/README.md +1 -1
- package/dist/arazzo-runner.browser.js +3382 -2929
- 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/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/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 +38 -3
|
@@ -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';
|
|
@@ -1716,6 +1718,13 @@ export declare interface ResolvedRequestBody {
|
|
|
1716
1718
|
* @public
|
|
1717
1719
|
*/
|
|
1718
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";
|
|
1719
1728
|
/** A parameter cannot be delivered unambiguously at its location. */
|
|
1720
1729
|
static readonly AmbiguousDelivery: "ambiguous-delivery";
|
|
1721
1730
|
/** An output or a request body payload holds a value that is not a valid runtime expression. */
|
|
@@ -2169,6 +2178,18 @@ export declare interface StepExecutionResult {
|
|
|
2169
2178
|
* in list order.
|
|
2170
2179
|
*/
|
|
2171
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;
|
|
2172
2193
|
}
|
|
2173
2194
|
|
|
2174
2195
|
/**
|
|
@@ -2279,6 +2300,17 @@ export declare class StepExecutor {
|
|
|
2279
2300
|
* {@link StepExecutor.execute}.
|
|
2280
2301
|
*/
|
|
2281
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;
|
|
2282
2314
|
}
|
|
2283
2315
|
|
|
2284
2316
|
/**
|
|
@@ -2588,7 +2620,9 @@ export declare class WorkflowExecutionState {
|
|
|
2588
2620
|
constructor(options?: WorkflowExecutionStateOptions);
|
|
2589
2621
|
/**
|
|
2590
2622
|
* Records the resolved outputs of a completed step, read via
|
|
2591
|
-
* `$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.
|
|
2592
2626
|
*/
|
|
2593
2627
|
setStepOutputs(stepId: string, outputs: Record<string, unknown>): void;
|
|
2594
2628
|
/**
|
|
@@ -2769,7 +2803,8 @@ export declare type WorkflowId = string;
|
|
|
2769
2803
|
|
|
2770
2804
|
/**
|
|
2771
2805
|
* Resolves the `parameters` of a step targeting a `workflowId` into the
|
|
2772
|
-
* sub-workflow's inputs
|
|
2806
|
+
* sub-workflow's inputs — or those of a `goto` / `retry` action naming a
|
|
2807
|
+
* `workflowId` into its target's.
|
|
2773
2808
|
*
|
|
2774
2809
|
* Values follow the family-wide literal-vs-expression rule of
|
|
2775
2810
|
* {@link ArazzoValueResolver}. Keys are bare parameter names: per the
|
|
@@ -2792,7 +2827,7 @@ export declare class WorkflowParameterResolver extends StepParameterResolver {
|
|
|
2792
2827
|
*
|
|
2793
2828
|
* `scope` names the step in a thrown {@link ResolverError}.
|
|
2794
2829
|
*/
|
|
2795
|
-
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>;
|
|
2796
2831
|
}
|
|
2797
2832
|
|
|
2798
2833
|
/**
|