@usearazzo/runner 1.0.1-alpha.33 → 1.0.1-alpha.34
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 +8 -0
- package/README.md +10 -1
- package/dist/arazzo-runner.browser.js +1112 -231
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +16 -15
- package/src/ArazzoRunner.cjs +26 -3
- package/src/ArazzoRunner.mjs +26 -3
- package/src/client/OpenAPIOperationResponse.cjs +9 -0
- package/src/client/OpenAPIOperationResponse.mjs +9 -0
- package/src/document/APIDocument.cjs +53 -0
- package/src/document/APIDocument.mjs +53 -0
- package/src/executor/OpenAPIOperationExecutor.cjs +66 -6
- package/src/executor/OpenAPIOperationExecutor.mjs +66 -6
- package/src/executor/StepExecutor.cjs +16 -2
- package/src/executor/StepExecutor.mjs +16 -2
- package/src/executor/StepRetryRunner.cjs +5 -3
- package/src/executor/StepRetryRunner.mjs +5 -3
- package/src/executor/StepTransitionInterpreter.cjs +1 -1
- package/src/executor/StepTransitionInterpreter.mjs +1 -1
- package/src/executor/WorkflowCallStack.cjs +1 -1
- package/src/executor/WorkflowCallStack.mjs +1 -1
- package/src/executor/WorkflowExecutor.cjs +269 -53
- package/src/executor/WorkflowExecutor.mjs +269 -53
- package/src/index.cjs +7 -0
- package/src/index.mjs +2 -0
- package/src/observability/ArazzoRunnerEvent.cjs +5 -0
- package/src/observability/ArazzoRunnerEvent.mjs +1 -0
- package/src/observability/DocumentRegistryEvent.cjs +5 -0
- package/src/observability/DocumentRegistryEvent.mjs +1 -0
- package/src/observability/EventChannel.cjs +96 -0
- package/src/observability/EventChannel.mjs +91 -0
- package/src/observability/OpenAPIOperationEvent.cjs +5 -0
- package/src/observability/OpenAPIOperationEvent.mjs +1 -0
- package/src/observability/Redactor.cjs +213 -0
- package/src/observability/Redactor.mjs +208 -0
- package/src/observability/WorkflowExecutionEvent.cjs +5 -0
- package/src/observability/WorkflowExecutionEvent.mjs +1 -0
- package/src/registry/DocumentRegistry.cjs +22 -3
- package/src/registry/DocumentRegistry.mjs +22 -3
- package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +20 -0
- package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +21 -1
- package/src/registry/providers/DocumentRegistryProvider.cjs +14 -0
- package/src/registry/providers/DocumentRegistryProvider.mjs +14 -0
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +27 -5
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +27 -5
- package/types/runner.d.ts +705 -5
package/types/runner.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ import type { ApiDOMErrorOptions } from '@speclynx/apidom-error';
|
|
|
2
2
|
import { ApiDOMReferenceOptions } from '@speclynx/apidom-reference/configuration/empty';
|
|
3
3
|
import { ApiDOMStructuredError } from '@speclynx/apidom-error';
|
|
4
4
|
import { CriterionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
5
|
+
import type { Element as Element_2 } from '@speclynx/apidom-datamodel';
|
|
5
6
|
import { FailureActionElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
6
7
|
import { FailureActionParametersElement } from '@speclynx/apidom-ns-arazzo-1';
|
|
7
8
|
import { JSONPointer } from '@speclynx/apidom-json-pointer';
|
|
8
9
|
import { OperationElement } from '@speclynx/apidom-ns-openapi-2';
|
|
9
10
|
import { OperationElement as OperationElement_2 } from '@speclynx/apidom-ns-openapi-3-0';
|
|
10
11
|
import { OperationElement as OperationElement_3 } from '@speclynx/apidom-ns-openapi-3-1';
|
|
11
|
-
import
|
|
12
|
+
import { ParseResultElement } from '@usearazzo/parser';
|
|
12
13
|
import type { PartialDeep } from 'type-fest';
|
|
13
14
|
import { PathItemElement } from '@speclynx/apidom-ns-openapi-2';
|
|
14
15
|
import { PathItemElement as PathItemElement_2 } from '@speclynx/apidom-ns-openapi-3-0';
|
|
@@ -76,6 +77,37 @@ export declare class ActionResolver {
|
|
|
76
77
|
resolveOnFailure(actions: StepOnFailureElement | undefined, isCriterionMet: CriterionPredicate, scope: StepScope): Promise<FailureActionElement[]>;
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
/**
|
|
81
|
+
* The action an attempt resolved to: the `retry` that re-runs the step, or,
|
|
82
|
+
* for its last attempt, the step's terminal action. The attempt a `retry`
|
|
83
|
+
* reference makes at another step selects none.
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export declare interface ActionSelectedEvent extends WorkflowExecutionStepEventBase {
|
|
87
|
+
readonly type: 'action-selected';
|
|
88
|
+
/**
|
|
89
|
+
* Where the selected action is written; absent when no action was
|
|
90
|
+
* selected.
|
|
91
|
+
*/
|
|
92
|
+
readonly location?: DocumentLocation;
|
|
93
|
+
readonly attempt: number;
|
|
94
|
+
/**
|
|
95
|
+
* The selected action. Absent when none matched, so the step takes the
|
|
96
|
+
* default path: the next step on success, a break on failure. It is the
|
|
97
|
+
* document's own element, shared with the trace: read it, never change it.
|
|
98
|
+
*/
|
|
99
|
+
readonly action?: SelectedAction;
|
|
100
|
+
/**
|
|
101
|
+
* What the run does next because of it, as plain data: `retry` re-runs the
|
|
102
|
+
* step, and the rest are the step's terminal transition — `next`, `goto` a
|
|
103
|
+
* step, `transfer` to a workflow, `end`, or `break`. With no `action`, it is
|
|
104
|
+
* the default path: `next` on success, `break` on failure.
|
|
105
|
+
*/
|
|
106
|
+
readonly transition: StepTransition | {
|
|
107
|
+
readonly kind: 'retry';
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
79
111
|
/**
|
|
80
112
|
* Base document held by the document registry.
|
|
81
113
|
* @public
|
|
@@ -85,6 +117,13 @@ export declare abstract class APIDocument {
|
|
|
85
117
|
readonly uri: string;
|
|
86
118
|
readonly parseResult: ParseResultElement;
|
|
87
119
|
protected constructor(uri: string, parseResult: ParseResultElement);
|
|
120
|
+
/**
|
|
121
|
+
* Where an element of this document, or one it references, is written, as
|
|
122
|
+
* the registry provider recorded it when it loaded the document: the
|
|
123
|
+
* document it came from (its `ref-origin`) when it came through a
|
|
124
|
+
* reference, and its JSON Pointer there.
|
|
125
|
+
*/
|
|
126
|
+
locationOf(element: Element_2): DocumentLocation;
|
|
88
127
|
/**
|
|
89
128
|
* Returns a JSON-serializable representation of the document's API element.
|
|
90
129
|
* Compatible with JSON.stringify() — JSON.stringify(doc) produces correct output.
|
|
@@ -219,14 +258,40 @@ export declare class ArazzoRunner {
|
|
|
219
258
|
export declare class ArazzoRunnerError extends ApiDOMStructuredError {
|
|
220
259
|
}
|
|
221
260
|
|
|
261
|
+
/**
|
|
262
|
+
* Every event the runner's building blocks emit, discriminated by `type`.
|
|
263
|
+
*
|
|
264
|
+
* Events carry no level or severity, like Node's `diagnostics_channel`
|
|
265
|
+
* messages: how to log an event is the logging consumer's decision. The
|
|
266
|
+
* `document-*`, `workflow-normalize-*` and `openapi-operation-*` events describe the
|
|
267
|
+
* machinery under a run, the detail a debug log would show.
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
export declare type ArazzoRunnerEvent = WorkflowExecutionEvent | DocumentRegistryEvent | OpenAPIOperationEvent;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The fields every {@link ArazzoRunnerEvent} carries.
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
export declare interface ArazzoRunnerEventBase {
|
|
277
|
+
/**
|
|
278
|
+
* When the event happened, read from the emitting block's injected `now`
|
|
279
|
+
* clock (`performance.now` by default). Timestamps of different blocks
|
|
280
|
+
* compare only when the blocks share a clock, as the ones
|
|
281
|
+
* {@link ArazzoRunner} wires do.
|
|
282
|
+
*/
|
|
283
|
+
readonly timestamp: number;
|
|
284
|
+
}
|
|
285
|
+
|
|
222
286
|
/**
|
|
223
287
|
* Options for {@link ArazzoRunner.load}.
|
|
224
288
|
*
|
|
225
289
|
* Every option is a seam of a building block the runner wires: `registry` is
|
|
226
290
|
* the {@link DocumentRegistry} the documents load into (a fresh one with the
|
|
227
291
|
* default providers when omitted), `reference` goes to everything the runner
|
|
228
|
-
* builds that retrieves documents, `httpClient
|
|
229
|
-
* the {@link OpenAPIOperationExecutor}, and the rest go
|
|
292
|
+
* builds that retrieves documents, `httpClient`, `requestInterceptor` and
|
|
293
|
+
* `captureBodies` go to the {@link OpenAPIOperationExecutor}, and the rest go
|
|
294
|
+
* to the
|
|
230
295
|
* {@link WorkflowExecutor}.
|
|
231
296
|
*
|
|
232
297
|
* Retrieving documents and calling APIs are separate on purpose: `reference`
|
|
@@ -234,7 +299,7 @@ export declare class ArazzoRunnerError extends ApiDOMStructuredError {
|
|
|
234
299
|
* apply to document retrieval, so credentials for one do not reach the other.
|
|
235
300
|
* @public
|
|
236
301
|
*/
|
|
237
|
-
export declare interface ArazzoRunnerLoadOptions extends Pick<OpenAPIOperationExecutorOptions, 'httpClient' | 'requestInterceptor'>, Pick<WorkflowExecutorOptions, 'maxSteps' | 'maxWorkflowDepth' | 'sleep' | 'now'> {
|
|
302
|
+
export declare interface ArazzoRunnerLoadOptions extends Pick<OpenAPIOperationExecutorOptions, 'httpClient' | 'requestInterceptor' | 'captureBodies'>, Pick<WorkflowExecutorOptions, 'maxSteps' | 'maxWorkflowDepth' | 'sleep' | 'now'> {
|
|
238
303
|
/**
|
|
239
304
|
* The registry to load the documents into. A registry backs one entry
|
|
240
305
|
* document: loading a different one into it throws.
|
|
@@ -254,13 +319,56 @@ export declare interface ArazzoRunnerLoadOptions extends Pick<OpenAPIOperationEx
|
|
|
254
319
|
* same options.
|
|
255
320
|
*/
|
|
256
321
|
readonly reference?: ArazzoRunnerReferenceOptions;
|
|
322
|
+
/**
|
|
323
|
+
* Parses the documents with source maps, so every `location` (on events,
|
|
324
|
+
* and on the result's steps and criteria) carries the element's range. Off by
|
|
325
|
+
* default: source-mapped parsing is slower and keeps more in memory. It
|
|
326
|
+
* changes no other behaviour: a document that fails to parse without it
|
|
327
|
+
* fails with it. A `registry` passed alongside parses as its own providers
|
|
328
|
+
* say.
|
|
329
|
+
*/
|
|
330
|
+
readonly sourceMap?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Receives the events of every building block the runner wires, stamped
|
|
333
|
+
* with `now`: the run's workflows, steps and the decisions behind them, and
|
|
334
|
+
* the machinery under them (document loads, workflow and operation
|
|
335
|
+
* normalization, request assembly). See {@link ArazzoRunnerEvent}.
|
|
336
|
+
*
|
|
337
|
+
* Loads into a `registry` passed alongside are reported only if that
|
|
338
|
+
* registry was given an observer of its own.
|
|
339
|
+
*/
|
|
340
|
+
readonly observer?: ArazzoRunnerObserver;
|
|
257
341
|
}
|
|
258
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Receives events as they happen. Each building block takes one as its
|
|
345
|
+
* `observer` option, typed to the events it emits; an observer of every
|
|
346
|
+
* {@link ArazzoRunnerEvent} fits them all.
|
|
347
|
+
*
|
|
348
|
+
* It is called synchronously and never awaited, so it cannot slow down or
|
|
349
|
+
* reorder a run. A handler that throws aborts the run with that error. A
|
|
350
|
+
* returned promise is ignored, rejection included: an async observer handles
|
|
351
|
+
* its own errors.
|
|
352
|
+
*
|
|
353
|
+
* Each event is a frozen copy of its plain data, so changing it cannot reach
|
|
354
|
+
* the run. Anything else is shared and must be treated as read-only: the
|
|
355
|
+
* ApiDOM element in {@link ActionSelectedEvent.action}, or a `Map` or class
|
|
356
|
+
* instance a custom HTTP client put into a response body.
|
|
357
|
+
*
|
|
358
|
+
* Events carry what the run saw, credentials included, like the request a
|
|
359
|
+
* request interceptor receives. Pass them through {@link Redactor.event}
|
|
360
|
+
* before they leave the process.
|
|
361
|
+
*
|
|
362
|
+
* A building block without an observer builds no events.
|
|
363
|
+
* @public
|
|
364
|
+
*/
|
|
365
|
+
export declare type ArazzoRunnerObserver<E extends ArazzoRunnerEvent = ArazzoRunnerEvent> = (event: E) => void;
|
|
366
|
+
|
|
259
367
|
/**
|
|
260
368
|
* Options for the ArazzoRunner constructor.
|
|
261
369
|
* @public
|
|
262
370
|
*/
|
|
263
|
-
export declare interface ArazzoRunnerOptions extends Omit<ArazzoRunnerLoadOptions, 'registry'> {
|
|
371
|
+
export declare interface ArazzoRunnerOptions extends Omit<ArazzoRunnerLoadOptions, 'registry' | 'sourceMap'> {
|
|
264
372
|
/**
|
|
265
373
|
* The entry Arazzo document holding the workflows to run.
|
|
266
374
|
*/
|
|
@@ -573,6 +681,26 @@ export declare class CriterionError extends ArazzoRunnerError {
|
|
|
573
681
|
*/
|
|
574
682
|
export declare type CriterionErrorReason = (typeof CriterionError)[Exclude<keyof typeof CriterionError, keyof typeof ArazzoRunnerError | 'prototype'>];
|
|
575
683
|
|
|
684
|
+
/**
|
|
685
|
+
* One criterion was evaluated during an attempt. Fired after the attempt's
|
|
686
|
+
* request (or sub-workflow run), in list order, success criteria first.
|
|
687
|
+
* @public
|
|
688
|
+
*/
|
|
689
|
+
export declare interface CriterionEvaluatedEvent extends WorkflowExecutionStepEventBase {
|
|
690
|
+
readonly type: 'criterion-evaluated';
|
|
691
|
+
/**
|
|
692
|
+
* Where the criterion is written.
|
|
693
|
+
*/
|
|
694
|
+
readonly location: DocumentLocation;
|
|
695
|
+
readonly attempt: number;
|
|
696
|
+
/**
|
|
697
|
+
* `success` for one of the step's `successCriteria`, `action` for a
|
|
698
|
+
* criterion of an `onSuccess` / `onFailure` action the attempt considered.
|
|
699
|
+
*/
|
|
700
|
+
readonly kind: 'success' | 'action';
|
|
701
|
+
readonly criterion: CriterionEvaluationRecord;
|
|
702
|
+
}
|
|
703
|
+
|
|
576
704
|
/**
|
|
577
705
|
* A criterion condition that cannot be evaluated: a syntax error in the
|
|
578
706
|
* condition, a context the condition cannot apply to, or an error raised while
|
|
@@ -603,6 +731,21 @@ export declare interface CriterionEvaluationRecord {
|
|
|
603
731
|
* action criterion.
|
|
604
732
|
*/
|
|
605
733
|
readonly actionName?: string;
|
|
734
|
+
/**
|
|
735
|
+
* Every runtime expression the evaluation resolved, keyed by the expression
|
|
736
|
+
* as written, with the value it resolved to: the expressions embedded in a
|
|
737
|
+
* `simple` condition, or the `context` of a `regex`, `jsonpath` or `xpath`
|
|
738
|
+
* one. What the criterion actually saw, e.g. `{ "$statusCode": 404 }`.
|
|
739
|
+
*
|
|
740
|
+
* A whole body (`$response.body`, `$request.body`) is recorded as the
|
|
741
|
+
* placeholder `[body]`, so the trace never holds a body; the body and its
|
|
742
|
+
* size are in the attempt's `openapi-operation-request-settled` event.
|
|
743
|
+
*/
|
|
744
|
+
readonly values: Readonly<Record<string, unknown>>;
|
|
745
|
+
/**
|
|
746
|
+
* Where the criterion is written.
|
|
747
|
+
*/
|
|
748
|
+
readonly location: DocumentLocation;
|
|
606
749
|
/**
|
|
607
750
|
* Why the condition could not be evaluated — present only then, with `met`
|
|
608
751
|
* `false`.
|
|
@@ -730,11 +873,113 @@ export declare interface CriterionOutcome {
|
|
|
730
873
|
*/
|
|
731
874
|
export declare type CriterionPredicate = (criterion: CriterionElement, action: SelectedAction) => boolean | Promise<boolean>;
|
|
732
875
|
|
|
876
|
+
/**
|
|
877
|
+
* A `dependsOn` prerequisite was satisfied, or failed.
|
|
878
|
+
* @public
|
|
879
|
+
*/
|
|
880
|
+
export declare interface DependencySettledEvent extends WorkflowExecutionEventBase {
|
|
881
|
+
readonly type: 'dependency-settled';
|
|
882
|
+
readonly dependency: WorkflowExecutionDependency;
|
|
883
|
+
/**
|
|
884
|
+
* Whether the prerequisite had already completed earlier in this run and was
|
|
885
|
+
* not run again. When it is `true`, no workflow events of its own precede
|
|
886
|
+
* this event.
|
|
887
|
+
*/
|
|
888
|
+
readonly memoized: boolean;
|
|
889
|
+
readonly settledStatus: WorkflowExecutionResult['settledStatus'];
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* A `dependsOn` prerequisite is about to be satisfied: either run, or found
|
|
894
|
+
* already completed earlier in the same run.
|
|
895
|
+
* @public
|
|
896
|
+
*/
|
|
897
|
+
export declare interface DependencyStartEvent extends WorkflowExecutionEventBase {
|
|
898
|
+
readonly type: 'dependency-start';
|
|
899
|
+
/**
|
|
900
|
+
* Where the `dependsOn` entry is written.
|
|
901
|
+
*/
|
|
902
|
+
readonly location: DocumentLocation;
|
|
903
|
+
readonly dependency: WorkflowExecutionDependency;
|
|
904
|
+
}
|
|
905
|
+
|
|
733
906
|
/** @public */
|
|
734
907
|
export declare class DocumentLoadError extends ArazzoRunnerError {
|
|
735
908
|
readonly uri?: string;
|
|
736
909
|
}
|
|
737
910
|
|
|
911
|
+
/**
|
|
912
|
+
* The registry loaded a document, which it caches right after. A load that
|
|
913
|
+
* fails throws and emits no settled event; an observer that throws here
|
|
914
|
+
* leaves the document uncached.
|
|
915
|
+
* @public
|
|
916
|
+
*/
|
|
917
|
+
export declare interface DocumentLoadSettledEvent extends ArazzoRunnerEventBase {
|
|
918
|
+
readonly type: 'document-load-settled';
|
|
919
|
+
readonly uri: string;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* The registry started loading a document it had neither cached nor already
|
|
924
|
+
* loading. Cache hits emit nothing.
|
|
925
|
+
*
|
|
926
|
+
* Registry events carry no `runId`: the registry is shared, and one load can
|
|
927
|
+
* serve several runs at once.
|
|
928
|
+
* @public
|
|
929
|
+
*/
|
|
930
|
+
export declare interface DocumentLoadStartEvent extends ArazzoRunnerEventBase {
|
|
931
|
+
readonly type: 'document-load-start';
|
|
932
|
+
/**
|
|
933
|
+
* The canonical URI of the document.
|
|
934
|
+
*/
|
|
935
|
+
readonly uri: string;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Where an element is written.
|
|
940
|
+
* @public
|
|
941
|
+
*/
|
|
942
|
+
export declare interface DocumentLocation {
|
|
943
|
+
/**
|
|
944
|
+
* The document that defines the element: the one it came from when it was
|
|
945
|
+
* reached through a reference (a workflow of another Arazzo document, an
|
|
946
|
+
* operation of a Path Item Object written as a `$ref`), not necessarily the
|
|
947
|
+
* entry document.
|
|
948
|
+
*/
|
|
949
|
+
readonly uri: string;
|
|
950
|
+
/**
|
|
951
|
+
* The element's JSON Pointer in that document. Absent only for an element
|
|
952
|
+
* whose pointer no one recorded: the runner records one for every element
|
|
953
|
+
* an event locates.
|
|
954
|
+
*/
|
|
955
|
+
readonly jsonPointer?: string;
|
|
956
|
+
/**
|
|
957
|
+
* The element's range in that document, present only when the document was
|
|
958
|
+
* parsed with source maps (`sourceMap` on `ArazzoRunner.load`).
|
|
959
|
+
*/
|
|
960
|
+
readonly range?: DocumentRange;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* A position in a document, as in the Language Server Protocol: a 0-based
|
|
965
|
+
* line, and a 0-based character offset within it in UTF-16 code units.
|
|
966
|
+
* @public
|
|
967
|
+
*/
|
|
968
|
+
export declare interface DocumentPosition {
|
|
969
|
+
readonly line: number;
|
|
970
|
+
readonly character: number;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* A range in a document, as in the Language Server Protocol: from `start` to
|
|
975
|
+
* `end`, the shape the validator's diagnostics use.
|
|
976
|
+
* @public
|
|
977
|
+
*/
|
|
978
|
+
export declare interface DocumentRange {
|
|
979
|
+
readonly start: DocumentPosition;
|
|
980
|
+
readonly end: DocumentPosition;
|
|
981
|
+
}
|
|
982
|
+
|
|
738
983
|
/**
|
|
739
984
|
* Registry for API documents keyed by canonical URI.
|
|
740
985
|
*
|
|
@@ -789,12 +1034,28 @@ export declare class DocumentRegistry {
|
|
|
789
1034
|
clear(): void;
|
|
790
1035
|
}
|
|
791
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* An event the {@link DocumentRegistry} emits.
|
|
1039
|
+
* @public
|
|
1040
|
+
*/
|
|
1041
|
+
export declare type DocumentRegistryEvent = DocumentLoadStartEvent | DocumentLoadSettledEvent;
|
|
1042
|
+
|
|
792
1043
|
/**
|
|
793
1044
|
* Options for the DocumentRegistry.
|
|
794
1045
|
* @public
|
|
795
1046
|
*/
|
|
796
1047
|
export declare interface DocumentRegistryOptions {
|
|
797
1048
|
readonly providers?: DocumentRegistryProvider[];
|
|
1049
|
+
/**
|
|
1050
|
+
* Receives the registry's events: the start and end of every document
|
|
1051
|
+
* load. Cache hits emit nothing. See {@link DocumentRegistryEvent}.
|
|
1052
|
+
*/
|
|
1053
|
+
readonly observer?: ArazzoRunnerObserver<DocumentRegistryEvent>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Reads the current time in milliseconds, stamped on each event. Defaults to
|
|
1056
|
+
* `performance.now`.
|
|
1057
|
+
*/
|
|
1058
|
+
readonly now?: () => number;
|
|
798
1059
|
}
|
|
799
1060
|
|
|
800
1061
|
/**
|
|
@@ -821,6 +1082,13 @@ export declare abstract class DocumentRegistryProvider {
|
|
|
821
1082
|
* Loads and produces a document from a URI.
|
|
822
1083
|
*/
|
|
823
1084
|
abstract provide(uri: string): Promise<APIDocument>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Rejects a document the parser could only partly read. The strict parsers
|
|
1087
|
+
* throw on a syntax error; the lenient ones that source maps need record it
|
|
1088
|
+
* and parse what they can instead, so a document must load with source maps
|
|
1089
|
+
* exactly when it loads without.
|
|
1090
|
+
*/
|
|
1091
|
+
protected assertParsed(uri: string, parseResult: ParseResultElement): void;
|
|
824
1092
|
}
|
|
825
1093
|
|
|
826
1094
|
/**
|
|
@@ -1166,12 +1434,48 @@ export declare class OpenAPIDocumentRegistryProvider extends DocumentRegistryPro
|
|
|
1166
1434
|
*/
|
|
1167
1435
|
export declare type OpenAPIDocumentRegistryProviderOptions = DocumentRegistryProviderOptions;
|
|
1168
1436
|
|
|
1437
|
+
/**
|
|
1438
|
+
* The normalized operation was assembled into the OpenAPI document the
|
|
1439
|
+
* request is built from.
|
|
1440
|
+
* @public
|
|
1441
|
+
*/
|
|
1442
|
+
export declare interface OpenAPIOperationAssembledEvent extends OpenAPIOperationEventBase {
|
|
1443
|
+
readonly type: 'openapi-operation-assembled';
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1169
1446
|
/**
|
|
1170
1447
|
* Union of OperationElement across all supported OpenAPI versions.
|
|
1171
1448
|
* @public
|
|
1172
1449
|
*/
|
|
1173
1450
|
export declare type OpenAPIOperationElement = OperationElement | OperationElement_2 | OperationElement_3;
|
|
1174
1451
|
|
|
1452
|
+
/**
|
|
1453
|
+
* An event the {@link OpenAPIOperationExecutor} emits.
|
|
1454
|
+
* @public
|
|
1455
|
+
*/
|
|
1456
|
+
export declare type OpenAPIOperationEvent = OpenAPIOperationNormalizeStartEvent | OpenAPIOperationNormalizeSettledEvent | OpenAPIOperationAssembledEvent | OpenAPIOperationRequestStartEvent | OpenAPIOperationRequestSettledEvent;
|
|
1457
|
+
|
|
1458
|
+
/**
|
|
1459
|
+
* The fields every {@link OpenAPIOperationEvent} carries: the operation, and
|
|
1460
|
+
* the step it runs for, in the same shape a {@link RequestInterceptor}
|
|
1461
|
+
* receives them.
|
|
1462
|
+
* @public
|
|
1463
|
+
*/
|
|
1464
|
+
export declare interface OpenAPIOperationEventBase extends ArazzoRunnerEventBase, RequestContext {
|
|
1465
|
+
/**
|
|
1466
|
+
* Where the operation is written. It differs from `operation` (where the
|
|
1467
|
+
* operation was looked up) for an operation of a Path Item Object written
|
|
1468
|
+
* as a `$ref`, which is written in the document the reference names.
|
|
1469
|
+
*/
|
|
1470
|
+
readonly location: DocumentLocation;
|
|
1471
|
+
/**
|
|
1472
|
+
* The `runId` of the {@link WorkflowExecutor.execute} call the operation
|
|
1473
|
+
* runs for, from the execute options. Absent when the executor is used
|
|
1474
|
+
* without one.
|
|
1475
|
+
*/
|
|
1476
|
+
readonly runId?: string;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1175
1479
|
/**
|
|
1176
1480
|
* Options for executing an OpenAPI operation.
|
|
1177
1481
|
*
|
|
@@ -1241,6 +1545,12 @@ export declare interface OpenAPIOperationExecuteOptions {
|
|
|
1241
1545
|
*/
|
|
1242
1546
|
readonly securities?: OpenAPIOperationSecurities;
|
|
1243
1547
|
readonly signal?: AbortSignal;
|
|
1548
|
+
/**
|
|
1549
|
+
* Identifies the run this call belongs to, stamped on the executor's events
|
|
1550
|
+
* (see {@link OpenAPIOperationEventBase.runId}). Consumed by the executor,
|
|
1551
|
+
* never sent. The workflow executor sets it for every step.
|
|
1552
|
+
*/
|
|
1553
|
+
readonly runId?: string;
|
|
1244
1554
|
/**
|
|
1245
1555
|
* Runs after the executor-level interceptor, for this call only.
|
|
1246
1556
|
*/
|
|
@@ -1349,6 +1659,22 @@ export declare interface OpenAPIOperationExecutorOptions {
|
|
|
1349
1659
|
* fresh {@link OpenAPIDocumentAssembler}.
|
|
1350
1660
|
*/
|
|
1351
1661
|
readonly documentAssembler?: OpenAPIDocumentAssembler;
|
|
1662
|
+
/**
|
|
1663
|
+
* Receives the executor's events: the start and end of each operation's
|
|
1664
|
+
* normalization, its assembly, and the request sent and its response. See
|
|
1665
|
+
* {@link OpenAPIOperationEvent}.
|
|
1666
|
+
*/
|
|
1667
|
+
readonly observer?: ArazzoRunnerObserver<OpenAPIOperationEvent>;
|
|
1668
|
+
/**
|
|
1669
|
+
* Reads the current time in milliseconds, stamped on each event. Defaults to
|
|
1670
|
+
* `performance.now`.
|
|
1671
|
+
*/
|
|
1672
|
+
readonly now?: () => number;
|
|
1673
|
+
/**
|
|
1674
|
+
* Whether the `openapi-operation-request-*` events carry the request and
|
|
1675
|
+
* response bodies. Off by default.
|
|
1676
|
+
*/
|
|
1677
|
+
readonly captureBodies?: boolean;
|
|
1352
1678
|
}
|
|
1353
1679
|
|
|
1354
1680
|
/**
|
|
@@ -1493,6 +1819,23 @@ export declare interface OpenAPIOperationNormalizerOptions {
|
|
|
1493
1819
|
readonly openapi31?: OpenAPI31OperationNormalizer;
|
|
1494
1820
|
}
|
|
1495
1821
|
|
|
1822
|
+
/**
|
|
1823
|
+
* The operation was normalized.
|
|
1824
|
+
* @public
|
|
1825
|
+
*/
|
|
1826
|
+
export declare interface OpenAPIOperationNormalizeSettledEvent extends OpenAPIOperationEventBase {
|
|
1827
|
+
readonly type: 'openapi-operation-normalize-settled';
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
/**
|
|
1831
|
+
* Normalization of the operation began: dereferencing it (which may fetch
|
|
1832
|
+
* externally referenced documents) and inheriting its path-level fields.
|
|
1833
|
+
* @public
|
|
1834
|
+
*/
|
|
1835
|
+
export declare interface OpenAPIOperationNormalizeStartEvent extends OpenAPIOperationEventBase {
|
|
1836
|
+
readonly type: 'openapi-operation-normalize-start';
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1496
1839
|
/**
|
|
1497
1840
|
* Resolves the `parameters` of a step targeting an OpenAPI operation into the
|
|
1498
1841
|
* map the operation is executed with.
|
|
@@ -1587,6 +1930,51 @@ export declare interface OpenAPIOperationRequestInfo {
|
|
|
1587
1930
|
readonly body?: unknown;
|
|
1588
1931
|
}
|
|
1589
1932
|
|
|
1933
|
+
/**
|
|
1934
|
+
* The response was received and its body read, as it came: mask it with
|
|
1935
|
+
* {@link Redactor} before it leaves the process. A request that fails in the
|
|
1936
|
+
* transport throws and emits no settled event.
|
|
1937
|
+
* @public
|
|
1938
|
+
*/
|
|
1939
|
+
export declare interface OpenAPIOperationRequestSettledEvent extends OpenAPIOperationEventBase {
|
|
1940
|
+
readonly type: 'openapi-operation-request-settled';
|
|
1941
|
+
readonly response: {
|
|
1942
|
+
readonly status: number;
|
|
1943
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
1944
|
+
/**
|
|
1945
|
+
* The body's size in bytes: {@link OpenAPIOperationResponse.size}.
|
|
1946
|
+
*/
|
|
1947
|
+
readonly size: number;
|
|
1948
|
+
/**
|
|
1949
|
+
* The body parsed by its content type, as `$response.body` reads it. Only
|
|
1950
|
+
* with {@link OpenAPIOperationExecutorOptions.captureBodies}.
|
|
1951
|
+
*/
|
|
1952
|
+
readonly body?: unknown;
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
/**
|
|
1957
|
+
* The request about to be handed to the {@link HTTPClient}, after every
|
|
1958
|
+
* request interceptor ran, as it is sent: credentials included, like the
|
|
1959
|
+
* request an interceptor receives. Mask it with {@link Redactor} before it
|
|
1960
|
+
* leaves the process.
|
|
1961
|
+
* @public
|
|
1962
|
+
*/
|
|
1963
|
+
export declare interface OpenAPIOperationRequestStartEvent extends OpenAPIOperationEventBase {
|
|
1964
|
+
readonly type: 'openapi-operation-request-start';
|
|
1965
|
+
readonly request: {
|
|
1966
|
+
readonly method: string;
|
|
1967
|
+
readonly url: string;
|
|
1968
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
1969
|
+
/**
|
|
1970
|
+
* The body as handed to the {@link HTTPClient}: JSON or form text, or a
|
|
1971
|
+
* `FormData`, `Blob` or stream. Only with
|
|
1972
|
+
* {@link OpenAPIOperationExecutorOptions.captureBodies}.
|
|
1973
|
+
*/
|
|
1974
|
+
readonly body?: unknown;
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1590
1978
|
/**
|
|
1591
1979
|
* Response from an OpenAPI operation execution.
|
|
1592
1980
|
*
|
|
@@ -1618,6 +2006,11 @@ export declare class OpenAPIOperationResponse {
|
|
|
1618
2006
|
content: string | Uint8Array;
|
|
1619
2007
|
request?: OpenAPIOperationRequestInfo;
|
|
1620
2008
|
});
|
|
2009
|
+
/**
|
|
2010
|
+
* The body's size in bytes, as read: after the transport decoded any
|
|
2011
|
+
* `Content-Encoding`, so a compressed body counts at its decoded size.
|
|
2012
|
+
*/
|
|
2013
|
+
get size(): number;
|
|
1621
2014
|
/**
|
|
1622
2015
|
* The body as text, like `Response.text()`; `''` when there is none.
|
|
1623
2016
|
*/
|
|
@@ -1738,6 +2131,59 @@ export declare class OutputResolver extends ArazzoValueResolver {
|
|
|
1738
2131
|
resolve(outputs: StepOutputsElement | WorkflowOutputsElement | undefined, resolve: RuntimeExpressionResolver, scope: ResolverScope): Promise<Record<string, unknown>>;
|
|
1739
2132
|
}
|
|
1740
2133
|
|
|
2134
|
+
/**
|
|
2135
|
+
* Masks credentials in events before they leave the process.
|
|
2136
|
+
*
|
|
2137
|
+
* Events carry what the run saw, credentials included, like the request a
|
|
2138
|
+
* request interceptor receives. Pass every event through
|
|
2139
|
+
* {@link Redactor.event} before logging, exporting or writing it.
|
|
2140
|
+
*
|
|
2141
|
+
* It masks by name, whatever the event:
|
|
2142
|
+
*
|
|
2143
|
+
* - the value of any field whose name matches a pattern: headers, query
|
|
2144
|
+
* parameters, body and output fields, at any depth;
|
|
2145
|
+
* - a criterion value whose runtime expression reads a matching name, in its
|
|
2146
|
+
* base or in any token of its JSON Pointer (`$inputs.password`,
|
|
2147
|
+
* `$steps.login.outputs.token#/value`);
|
|
2148
|
+
* - in every absolute URL, as `URL` parses it, the userinfo and the matching
|
|
2149
|
+
* query and fragment parameters;
|
|
2150
|
+
* - a request or response body that is JSON or a URL-encoded form, field by
|
|
2151
|
+
* field, and any other body, or any object that is not plain data, whole.
|
|
2152
|
+
*
|
|
2153
|
+
* A credential under a name no pattern matches is carried as it is. The
|
|
2154
|
+
* masked value is `REDACTED`.
|
|
2155
|
+
* @public
|
|
2156
|
+
*/
|
|
2157
|
+
export declare class Redactor {
|
|
2158
|
+
#private;
|
|
2159
|
+
static readonly CENSOR = "REDACTED";
|
|
2160
|
+
/**
|
|
2161
|
+
* Elastic APM's `sanitizeFieldNames` defaults, with `*secret*` for its exact
|
|
2162
|
+
* `secret` (which misses OAuth's `client_secret`), plus the signed-URL query
|
|
2163
|
+
* parameters OpenTelemetry's HTTP conventions mask.
|
|
2164
|
+
*/
|
|
2165
|
+
static readonly defaultFields: readonly string[];
|
|
2166
|
+
constructor(options?: RedactorOptions);
|
|
2167
|
+
/**
|
|
2168
|
+
* A masked copy of the event.
|
|
2169
|
+
*/
|
|
2170
|
+
event<E extends ArazzoRunnerEvent>(event: E): E;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* Options for the Redactor.
|
|
2175
|
+
* @public
|
|
2176
|
+
*/
|
|
2177
|
+
export declare interface RedactorOptions {
|
|
2178
|
+
/**
|
|
2179
|
+
* Wildcard patterns of the names whose values are masked. `*` matches any
|
|
2180
|
+
* run of characters; matching is case-insensitive and against the whole
|
|
2181
|
+
* name, so `*token*` matches `access_token` and `X-Auth-Token`. The list
|
|
2182
|
+
* replaces {@link Redactor.defaultFields}; spread it to extend it.
|
|
2183
|
+
*/
|
|
2184
|
+
readonly fields?: readonly string[];
|
|
2185
|
+
}
|
|
2186
|
+
|
|
1741
2187
|
/**
|
|
1742
2188
|
* Evaluates a `regex` Arazzo criterion condition against a resolved context value.
|
|
1743
2189
|
*
|
|
@@ -1984,6 +2430,44 @@ export declare interface RetryReferenceRecord {
|
|
|
1984
2430
|
readonly subWorkflow?: WorkflowExecutionResult;
|
|
1985
2431
|
}
|
|
1986
2432
|
|
|
2433
|
+
/**
|
|
2434
|
+
* A `retry` action's reference completed.
|
|
2435
|
+
* @public
|
|
2436
|
+
*/
|
|
2437
|
+
export declare interface RetryReferenceSettledEvent extends WorkflowExecutionStepEventBase {
|
|
2438
|
+
readonly type: 'retry-reference-settled';
|
|
2439
|
+
readonly attempt: number;
|
|
2440
|
+
readonly kind: RetryReferenceRecord['kind'];
|
|
2441
|
+
readonly id: RetryReferenceRecord['id'];
|
|
2442
|
+
readonly successful: RetryReferenceRecord['successful'];
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* A `retry` action's `stepId` / `workflowId` reference is about to run.
|
|
2447
|
+
* @public
|
|
2448
|
+
*/
|
|
2449
|
+
export declare interface RetryReferenceStartEvent extends WorkflowExecutionStepEventBase {
|
|
2450
|
+
readonly type: 'retry-reference-start';
|
|
2451
|
+
/**
|
|
2452
|
+
* Where the `retry` action that names the reference is written.
|
|
2453
|
+
*/
|
|
2454
|
+
readonly location: DocumentLocation;
|
|
2455
|
+
readonly attempt: number;
|
|
2456
|
+
readonly kind: RetryReferenceRecord['kind'];
|
|
2457
|
+
readonly id: RetryReferenceRecord['id'];
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
/**
|
|
2461
|
+
* The run is about to wait out a `retry` action's `retryAfter` before the
|
|
2462
|
+
* step's next attempt. Fired only for a positive delay.
|
|
2463
|
+
* @public
|
|
2464
|
+
*/
|
|
2465
|
+
export declare interface RetryWaitEvent extends WorkflowExecutionStepEventBase {
|
|
2466
|
+
readonly type: 'retry-wait';
|
|
2467
|
+
readonly attempt: number;
|
|
2468
|
+
readonly delayMs: number;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
1987
2471
|
/**
|
|
1988
2472
|
* Identifies a step that calls a workflow, for the context its criteria,
|
|
1989
2473
|
* outputs and actions are evaluated against.
|
|
@@ -2327,6 +2811,20 @@ export declare abstract class SourceDescriptionsLocatorNormalizer {
|
|
|
2327
2811
|
} | undefined;
|
|
2328
2812
|
}
|
|
2329
2813
|
|
|
2814
|
+
/**
|
|
2815
|
+
* One attempt at a step began, after it was charged to the step budget.
|
|
2816
|
+
* @public
|
|
2817
|
+
*/
|
|
2818
|
+
export declare interface StepAttemptEvent extends WorkflowExecutionStepEventBase {
|
|
2819
|
+
readonly type: 'step-attempt';
|
|
2820
|
+
/**
|
|
2821
|
+
* The attempt number, starting at 1. Each `retry` increments it. The
|
|
2822
|
+
* attempt a `retry` reference makes at another step is that reference's
|
|
2823
|
+
* own, so it is always 1, under the referenced step's `stepId`.
|
|
2824
|
+
*/
|
|
2825
|
+
readonly attempt: number;
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2330
2828
|
/**
|
|
2331
2829
|
* The execute options of a step: the opaque bag forwarded to the operation
|
|
2332
2830
|
* executor, or a function returning it for the operation the step was located
|
|
@@ -2568,6 +3066,10 @@ export declare abstract class StepParameterResolver extends ArazzoValueResolver
|
|
|
2568
3066
|
*/
|
|
2569
3067
|
export declare interface StepRunRecord {
|
|
2570
3068
|
readonly stepId: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* Where the step is written.
|
|
3071
|
+
*/
|
|
3072
|
+
readonly location: DocumentLocation;
|
|
2571
3073
|
readonly successful: boolean;
|
|
2572
3074
|
readonly action: SelectedAction | undefined;
|
|
2573
3075
|
/**
|
|
@@ -2630,11 +3132,71 @@ export declare interface StepScope {
|
|
|
2630
3132
|
readonly stepId: string;
|
|
2631
3133
|
}
|
|
2632
3134
|
|
|
3135
|
+
/**
|
|
3136
|
+
* A step settled: its retries are done and its terminal action is selected.
|
|
3137
|
+
* @public
|
|
3138
|
+
*/
|
|
3139
|
+
export declare interface StepSettledEvent extends WorkflowExecutionStepEventBase {
|
|
3140
|
+
readonly type: 'step-settled';
|
|
3141
|
+
readonly successful: boolean;
|
|
3142
|
+
readonly attempts: number;
|
|
3143
|
+
}
|
|
3144
|
+
|
|
3145
|
+
/**
|
|
3146
|
+
* A step began. Its attempts follow it.
|
|
3147
|
+
* @public
|
|
3148
|
+
*/
|
|
3149
|
+
export declare interface StepStartEvent extends WorkflowExecutionStepEventBase {
|
|
3150
|
+
readonly type: 'step-start';
|
|
3151
|
+
/**
|
|
3152
|
+
* Where the step is written.
|
|
3153
|
+
*/
|
|
3154
|
+
readonly location: DocumentLocation;
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
/**
|
|
3158
|
+
* What a workflow does after a step, once the step's action has been
|
|
3159
|
+
* interpreted.
|
|
3160
|
+
*
|
|
3161
|
+
* `next` runs the following step (the success default, or a matched `goto` that
|
|
3162
|
+
* targets the next step); `goto` jumps to a step by id within the current
|
|
3163
|
+
* workflow; `transfer` hands control one-way to another workflow, which the
|
|
3164
|
+
* caller's run then ends on; `end` stops the run with `status: ended`; `break`
|
|
3165
|
+
* stops with `status: failed` (the failure default).
|
|
3166
|
+
* @public
|
|
3167
|
+
*/
|
|
3168
|
+
export declare type StepTransition = {
|
|
3169
|
+
readonly kind: 'next';
|
|
3170
|
+
} | {
|
|
3171
|
+
readonly kind: 'goto';
|
|
3172
|
+
readonly stepId: string;
|
|
3173
|
+
} | {
|
|
3174
|
+
readonly kind: 'transfer';
|
|
3175
|
+
readonly workflowId: string;
|
|
3176
|
+
} | {
|
|
3177
|
+
readonly kind: 'end';
|
|
3178
|
+
} | {
|
|
3179
|
+
readonly kind: 'break';
|
|
3180
|
+
};
|
|
3181
|
+
|
|
2633
3182
|
/** @public */
|
|
2634
3183
|
export declare class UnmatchedProviderError extends ArazzoRunnerError {
|
|
2635
3184
|
readonly uri?: string;
|
|
2636
3185
|
}
|
|
2637
3186
|
|
|
3187
|
+
/**
|
|
3188
|
+
* How a workflow invocation was entered.
|
|
3189
|
+
*
|
|
3190
|
+
* Recorded per call so a detected loop can be named for the mechanism that formed
|
|
3191
|
+
* it: a repeat reached purely through `dependsOn` edges is a dependency cycle,
|
|
3192
|
+
* one involving a sub-workflow step call — a `retry` action's `workflowId`
|
|
3193
|
+
* reference — or a `goto`'s one-way transfer to a `workflowId` — is a call
|
|
3194
|
+
* cycle. `retry` and `goto` are grouped with `step` for that classification, not
|
|
3195
|
+
* `dependsOn`: each is a call the current step makes, not a stated precondition.
|
|
3196
|
+
* @public
|
|
3197
|
+
*/
|
|
3198
|
+
export declare type WorkflowCallVia = 'root' | 'step' | 'dependsOn' | 'retry' | 'goto';
|
|
3199
|
+
|
|
2638
3200
|
/**
|
|
2639
3201
|
* A workflow of an Arazzo document, as listed by
|
|
2640
3202
|
* {@link ArazzoDocument.listWorkflows}.
|
|
@@ -2740,6 +3302,69 @@ export declare interface WorkflowExecuteOptions {
|
|
|
2740
3302
|
readonly signal?: AbortSignal;
|
|
2741
3303
|
}
|
|
2742
3304
|
|
|
3305
|
+
/**
|
|
3306
|
+
* The workflow a `dependency-*` event is about.
|
|
3307
|
+
* @public
|
|
3308
|
+
*/
|
|
3309
|
+
export declare interface WorkflowExecutionDependency {
|
|
3310
|
+
/**
|
|
3311
|
+
* The `dependsOn` entry as written: a bare workflowId, or a
|
|
3312
|
+
* `$sourceDescriptions.{name}.{workflowId}` expression.
|
|
3313
|
+
*/
|
|
3314
|
+
readonly reference: string;
|
|
3315
|
+
/**
|
|
3316
|
+
* The bare id of the workflow the entry resolved to.
|
|
3317
|
+
*/
|
|
3318
|
+
readonly workflowId: string;
|
|
3319
|
+
/**
|
|
3320
|
+
* The canonical URI of the Arazzo document that defines it.
|
|
3321
|
+
*/
|
|
3322
|
+
readonly documentURI: string;
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
/**
|
|
3326
|
+
* An event the {@link WorkflowExecutor} emits, discriminated by `type`.
|
|
3327
|
+
*
|
|
3328
|
+
* The events other than `workflow-normalize-*` mark the boundaries the
|
|
3329
|
+
* {@link WorkflowExecutionResult} trace records, plus the criterion and
|
|
3330
|
+
* action decisions behind each step, so folding a run's events rebuilds its
|
|
3331
|
+
* trace. A workflow's or step's start and settled events are stamped with the
|
|
3332
|
+
* readings its `durationMs` comes from, so their timestamps differ by exactly
|
|
3333
|
+
* that.
|
|
3334
|
+
*
|
|
3335
|
+
* A run that throws (an authoring error, a cancellation, a throwing observer)
|
|
3336
|
+
* leaves the workflows and steps it unwinds through unsettled; the rejection
|
|
3337
|
+
* of `execute` is the signal.
|
|
3338
|
+
* @public
|
|
3339
|
+
*/
|
|
3340
|
+
export declare type WorkflowExecutionEvent = WorkflowStartEvent | WorkflowSettledEvent | WorkflowNormalizeStartEvent | WorkflowNormalizeSettledEvent | DependencyStartEvent | DependencySettledEvent | StepStartEvent | StepAttemptEvent | CriterionEvaluatedEvent | ActionSelectedEvent | RetryWaitEvent | RetryReferenceStartEvent | RetryReferenceSettledEvent | StepSettledEvent;
|
|
3341
|
+
|
|
3342
|
+
/**
|
|
3343
|
+
* The fields every {@link WorkflowExecutionEvent} carries.
|
|
3344
|
+
* @public
|
|
3345
|
+
*/
|
|
3346
|
+
export declare interface WorkflowExecutionEventBase extends ArazzoRunnerEventBase {
|
|
3347
|
+
/**
|
|
3348
|
+
* A random id of the {@link WorkflowExecutor.execute} call the event
|
|
3349
|
+
* belongs to. Every workflow, dependency and step of one call shares it, so
|
|
3350
|
+
* the events of concurrent calls, or of runs in different processes, can be
|
|
3351
|
+
* told apart. The operation events of the call carry it too.
|
|
3352
|
+
*/
|
|
3353
|
+
readonly runId: string;
|
|
3354
|
+
/**
|
|
3355
|
+
* The bare id of the workflow in progress when the event fired. For a
|
|
3356
|
+
* `dependency-*` event, this is the dependent workflow, not the dependency.
|
|
3357
|
+
*/
|
|
3358
|
+
readonly workflowId: string;
|
|
3359
|
+
/**
|
|
3360
|
+
* The chain of workflows in progress, outermost first, this one included.
|
|
3361
|
+
* Uses the same form as `ExecutionError.path`: bare ids for workflows of
|
|
3362
|
+
* the entry document, `{documentURI}#{workflowId}` for workflows of other
|
|
3363
|
+
* documents.
|
|
3364
|
+
*/
|
|
3365
|
+
readonly path: readonly string[];
|
|
3366
|
+
}
|
|
3367
|
+
|
|
2743
3368
|
/**
|
|
2744
3369
|
* The outcome of executing a workflow.
|
|
2745
3370
|
*
|
|
@@ -2881,6 +3506,14 @@ export declare interface WorkflowExecutionStateOptions {
|
|
|
2881
3506
|
readonly inputs?: Record<string, unknown>;
|
|
2882
3507
|
}
|
|
2883
3508
|
|
|
3509
|
+
/**
|
|
3510
|
+
* The fields every step-scoped {@link WorkflowExecutionEvent} carries.
|
|
3511
|
+
* @public
|
|
3512
|
+
*/
|
|
3513
|
+
export declare interface WorkflowExecutionStepEventBase extends WorkflowExecutionEventBase {
|
|
3514
|
+
readonly stepId: string;
|
|
3515
|
+
}
|
|
3516
|
+
|
|
2884
3517
|
/**
|
|
2885
3518
|
* Executes an Arazzo workflow: the stateful loop that turns "run one step" into
|
|
2886
3519
|
* "run a workflow".
|
|
@@ -3009,6 +3642,15 @@ export declare interface WorkflowExecutorOptions {
|
|
|
3009
3642
|
* negative duration if the system clock were adjusted mid-run.
|
|
3010
3643
|
*/
|
|
3011
3644
|
readonly now?: () => number;
|
|
3645
|
+
/**
|
|
3646
|
+
* Receives the run's events, stamped with
|
|
3647
|
+
* {@link WorkflowExecutorOptions.now}: workflows, dependencies, steps,
|
|
3648
|
+
* attempts, criterion outcomes, selected actions, retry waits and retry
|
|
3649
|
+
* references, plus each workflow's normalization. See
|
|
3650
|
+
* {@link WorkflowExecutionEvent}, and {@link ArazzoRunnerObserver} for how
|
|
3651
|
+
* events are delivered.
|
|
3652
|
+
*/
|
|
3653
|
+
readonly observer?: ArazzoRunnerObserver<WorkflowExecutionEvent>;
|
|
3012
3654
|
}
|
|
3013
3655
|
|
|
3014
3656
|
/**
|
|
@@ -3017,6 +3659,33 @@ export declare interface WorkflowExecutorOptions {
|
|
|
3017
3659
|
*/
|
|
3018
3660
|
export declare type WorkflowId = string;
|
|
3019
3661
|
|
|
3662
|
+
/**
|
|
3663
|
+
* The workflow was normalized.
|
|
3664
|
+
* @public
|
|
3665
|
+
*/
|
|
3666
|
+
export declare interface WorkflowNormalizeSettledEvent extends WorkflowExecutionEventBase {
|
|
3667
|
+
readonly type: 'workflow-normalize-settled';
|
|
3668
|
+
/**
|
|
3669
|
+
* Where the workflow is written.
|
|
3670
|
+
*/
|
|
3671
|
+
readonly location: DocumentLocation;
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
/**
|
|
3675
|
+
* The workflow is being normalized before its first run in this `execute`
|
|
3676
|
+
* call: dereferenced (which may fetch externally referenced documents), with
|
|
3677
|
+
* its parameters and actions inherited into its steps. A workflow already
|
|
3678
|
+
* normalized earlier in the same call emits nothing.
|
|
3679
|
+
* @public
|
|
3680
|
+
*/
|
|
3681
|
+
export declare interface WorkflowNormalizeStartEvent extends WorkflowExecutionEventBase {
|
|
3682
|
+
readonly type: 'workflow-normalize-start';
|
|
3683
|
+
/**
|
|
3684
|
+
* Where the workflow is written.
|
|
3685
|
+
*/
|
|
3686
|
+
readonly location: DocumentLocation;
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3020
3689
|
/**
|
|
3021
3690
|
* Resolves the `parameters` of a step targeting a `workflowId` into the
|
|
3022
3691
|
* sub-workflow's inputs — or those of a `goto` / `retry` action naming a
|
|
@@ -3064,6 +3733,37 @@ export declare interface WorkflowReferenceContext {
|
|
|
3064
3733
|
readonly stepId?: string;
|
|
3065
3734
|
}
|
|
3066
3735
|
|
|
3736
|
+
/**
|
|
3737
|
+
* A workflow invocation produced its result. The fields repeat the
|
|
3738
|
+
* {@link WorkflowExecutionResult} fields of the same name.
|
|
3739
|
+
* @public
|
|
3740
|
+
*/
|
|
3741
|
+
export declare interface WorkflowSettledEvent extends WorkflowExecutionEventBase {
|
|
3742
|
+
readonly type: 'workflow-settled';
|
|
3743
|
+
readonly status: WorkflowExecutionResult['status'];
|
|
3744
|
+
readonly settledStatus: WorkflowExecutionResult['settledStatus'];
|
|
3745
|
+
readonly outputs: WorkflowExecutionResult['outputs'];
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
/**
|
|
3749
|
+
* A workflow invocation began: it entered the call stack, before it is
|
|
3750
|
+
* normalized and its definition checked. A definition that fails those checks
|
|
3751
|
+
* throws, leaving the event without its `workflow-settled`.
|
|
3752
|
+
* @public
|
|
3753
|
+
*/
|
|
3754
|
+
export declare interface WorkflowStartEvent extends WorkflowExecutionEventBase {
|
|
3755
|
+
readonly type: 'workflow-start';
|
|
3756
|
+
/** Where the workflow is written. */
|
|
3757
|
+
readonly location: DocumentLocation;
|
|
3758
|
+
/**
|
|
3759
|
+
* How the workflow was reached. `root` is the workflow named in `execute`,
|
|
3760
|
+
* `step` is a sub-workflow step, `dependsOn` is a prerequisite, `retry` is
|
|
3761
|
+
* a `retry` action's `workflowId` reference, and `goto` is a one-way
|
|
3762
|
+
* transfer.
|
|
3763
|
+
*/
|
|
3764
|
+
readonly via: WorkflowCallVia;
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3067
3767
|
/**
|
|
3068
3768
|
* Evaluates an `xpath` Arazzo criterion condition against a resolved context value.
|
|
3069
3769
|
*
|