@usearazzo/runner 0.0.0-stage → 1.0.1-alpha.9

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.
Files changed (152) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +20 -0
  4. package/README.md +777 -2
  5. package/dist/arazzo-runner.browser.js +111247 -0
  6. package/dist/arazzo-runner.browser.min.js +1 -0
  7. package/package.json +90 -4
  8. package/src/action/ActionResolver.cjs +160 -0
  9. package/src/action/ActionResolver.mjs +150 -0
  10. package/src/assembler/OpenAPI2DocumentAssembler.cjs +111 -0
  11. package/src/assembler/OpenAPI2DocumentAssembler.mjs +104 -0
  12. package/src/assembler/OpenAPI30DocumentAssembler.cjs +110 -0
  13. package/src/assembler/OpenAPI30DocumentAssembler.mjs +103 -0
  14. package/src/assembler/OpenAPI31DocumentAssembler.cjs +111 -0
  15. package/src/assembler/OpenAPI31DocumentAssembler.mjs +104 -0
  16. package/src/assembler/OpenAPIDocumentAssembler.cjs +58 -0
  17. package/src/assembler/OpenAPIDocumentAssembler.mjs +50 -0
  18. package/src/client/HTTPClient.cjs +5 -0
  19. package/src/client/HTTPClient.mjs +1 -0
  20. package/src/client/HTTPClientFetch.cjs +16 -0
  21. package/src/client/HTTPClientFetch.mjs +10 -0
  22. package/src/client/OpenAPIOperationRequest.cjs +5 -0
  23. package/src/client/OpenAPIOperationRequest.mjs +1 -0
  24. package/src/client/OpenAPIOperationResponse.cjs +42 -0
  25. package/src/client/OpenAPIOperationResponse.mjs +36 -0
  26. package/src/client/OpenAPIOperationResponseNormalizer.cjs +48 -0
  27. package/src/client/OpenAPIOperationResponseNormalizer.mjs +40 -0
  28. package/src/client/ParameterDelivery.cjs +119 -0
  29. package/src/client/ParameterDelivery.mjs +113 -0
  30. package/src/constants.cjs +9 -0
  31. package/src/constants.mjs +3 -0
  32. package/src/criterion/CriterionEvaluator.cjs +205 -0
  33. package/src/criterion/CriterionEvaluator.mjs +196 -0
  34. package/src/criterion/JSONPathCriterionEvaluator.cjs +47 -0
  35. package/src/criterion/JSONPathCriterionEvaluator.mjs +40 -0
  36. package/src/criterion/RegexCriterionEvaluator.cjs +67 -0
  37. package/src/criterion/RegexCriterionEvaluator.mjs +60 -0
  38. package/src/criterion/SimpleCriterionEvaluator.cjs +50 -0
  39. package/src/criterion/SimpleCriterionEvaluator.mjs +43 -0
  40. package/src/criterion/XPathCriterionEvaluator.cjs +117 -0
  41. package/src/criterion/XPathCriterionEvaluator.mjs +109 -0
  42. package/src/document/APIDocument.cjs +35 -0
  43. package/src/document/APIDocument.mjs +30 -0
  44. package/src/document/ArazzoDocument.cjs +81 -0
  45. package/src/document/ArazzoDocument.mjs +74 -0
  46. package/src/document/ArazzoSourceDescriptionIndex.cjs +26 -0
  47. package/src/document/ArazzoSourceDescriptionIndex.mjs +20 -0
  48. package/src/document/ArazzoStepIndex.cjs +25 -0
  49. package/src/document/ArazzoStepIndex.mjs +19 -0
  50. package/src/document/ArazzoWorkflowIndex.cjs +17 -0
  51. package/src/document/ArazzoWorkflowIndex.mjs +11 -0
  52. package/src/document/OpenAPIDocument.cjs +28 -0
  53. package/src/document/OpenAPIDocument.mjs +21 -0
  54. package/src/document/OpenAPIOperationIndex.cjs +24 -0
  55. package/src/document/OpenAPIOperationIndex.mjs +18 -0
  56. package/src/document/ParameterIdentity.cjs +93 -0
  57. package/src/document/ParameterIdentity.mjs +88 -0
  58. package/src/document/openapi-types.cjs +5 -0
  59. package/src/document/openapi-types.mjs +1 -0
  60. package/src/errors/ArazzoRunnerError.cjs +10 -0
  61. package/src/errors/ArazzoRunnerError.mjs +5 -0
  62. package/src/errors/AssemblerError.cjs +11 -0
  63. package/src/errors/AssemblerError.mjs +4 -0
  64. package/src/errors/ClientError.cjs +11 -0
  65. package/src/errors/ClientError.mjs +4 -0
  66. package/src/errors/CriterionError.cjs +11 -0
  67. package/src/errors/CriterionError.mjs +4 -0
  68. package/src/errors/ExecutionError.cjs +11 -0
  69. package/src/errors/ExecutionError.mjs +4 -0
  70. package/src/errors/ExtractionError.cjs +11 -0
  71. package/src/errors/ExtractionError.mjs +4 -0
  72. package/src/errors/InvalidEntryDocumentError.cjs +11 -0
  73. package/src/errors/InvalidEntryDocumentError.mjs +4 -0
  74. package/src/errors/NormalizationError.cjs +11 -0
  75. package/src/errors/NormalizationError.mjs +4 -0
  76. package/src/errors/ResolverError.cjs +11 -0
  77. package/src/errors/ResolverError.mjs +4 -0
  78. package/src/errors/RuntimeExpressionError.cjs +11 -0
  79. package/src/errors/RuntimeExpressionError.mjs +4 -0
  80. package/src/errors/UnmatchedProviderError.cjs +11 -0
  81. package/src/errors/UnmatchedProviderError.mjs +4 -0
  82. package/src/executor/ArazzoWorkflowLocatorNormalizer.cjs +147 -0
  83. package/src/executor/ArazzoWorkflowLocatorNormalizer.mjs +137 -0
  84. package/src/executor/OpenAPIOperationExecutor.cjs +457 -0
  85. package/src/executor/OpenAPIOperationExecutor.mjs +446 -0
  86. package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +197 -0
  87. package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +189 -0
  88. package/src/executor/SourceDescriptionsLocatorNormalizer.cjs +44 -0
  89. package/src/executor/SourceDescriptionsLocatorNormalizer.mjs +38 -0
  90. package/src/executor/StepExecutor.cjs +333 -0
  91. package/src/executor/StepExecutor.mjs +326 -0
  92. package/src/executor/StepRetryRunner.cjs +226 -0
  93. package/src/executor/StepRetryRunner.mjs +215 -0
  94. package/src/executor/StepTransitionInterpreter.cjs +159 -0
  95. package/src/executor/StepTransitionInterpreter.mjs +151 -0
  96. package/src/executor/WorkflowCallStack.cjs +116 -0
  97. package/src/executor/WorkflowCallStack.mjs +106 -0
  98. package/src/executor/WorkflowExecutor.cjs +1091 -0
  99. package/src/executor/WorkflowExecutor.mjs +1077 -0
  100. package/src/executor/abort.cjs +70 -0
  101. package/src/executor/abort.mjs +60 -0
  102. package/src/expression/RuntimeExpressionContext.cjs +5 -0
  103. package/src/expression/RuntimeExpressionContext.mjs +1 -0
  104. package/src/expression/RuntimeExpressionEvaluator.cjs +337 -0
  105. package/src/expression/RuntimeExpressionEvaluator.mjs +328 -0
  106. package/src/extractor/ArazzoStepExtractor.cjs +48 -0
  107. package/src/extractor/ArazzoStepExtractor.mjs +41 -0
  108. package/src/extractor/ArazzoWorkflowExtractor.cjs +50 -0
  109. package/src/extractor/ArazzoWorkflowExtractor.mjs +43 -0
  110. package/src/extractor/OpenAPIOperationExtractor.cjs +84 -0
  111. package/src/extractor/OpenAPIOperationExtractor.mjs +77 -0
  112. package/src/index.cjs +419 -0
  113. package/src/index.mjs +73 -0
  114. package/src/normalizer/ArazzoStepNormalizer.cjs +23 -0
  115. package/src/normalizer/ArazzoStepNormalizer.mjs +17 -0
  116. package/src/normalizer/ArazzoWorkflowNormalizer.cjs +214 -0
  117. package/src/normalizer/ArazzoWorkflowNormalizer.mjs +206 -0
  118. package/src/normalizer/OpenAPI2OperationNormalizer.cjs +128 -0
  119. package/src/normalizer/OpenAPI2OperationNormalizer.mjs +120 -0
  120. package/src/normalizer/OpenAPI30OperationNormalizer.cjs +129 -0
  121. package/src/normalizer/OpenAPI30OperationNormalizer.mjs +121 -0
  122. package/src/normalizer/OpenAPI31OperationNormalizer.cjs +131 -0
  123. package/src/normalizer/OpenAPI31OperationNormalizer.mjs +123 -0
  124. package/src/normalizer/OpenAPIOperationNormalizer.cjs +58 -0
  125. package/src/normalizer/OpenAPIOperationNormalizer.mjs +50 -0
  126. package/src/registry/DocumentRegistry.cjs +160 -0
  127. package/src/registry/DocumentRegistry.mjs +151 -0
  128. package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +154 -0
  129. package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +146 -0
  130. package/src/registry/providers/DocumentRegistryProvider.cjs +31 -0
  131. package/src/registry/providers/DocumentRegistryProvider.mjs +25 -0
  132. package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +122 -0
  133. package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +114 -0
  134. package/src/resolver/ArazzoValueResolver.cjs +42 -0
  135. package/src/resolver/ArazzoValueResolver.mjs +37 -0
  136. package/src/resolver/OpenAPIOperationParameterResolver.cjs +117 -0
  137. package/src/resolver/OpenAPIOperationParameterResolver.mjs +110 -0
  138. package/src/resolver/OutputResolver.cjs +71 -0
  139. package/src/resolver/OutputResolver.mjs +64 -0
  140. package/src/resolver/RequestBodyResolver.cjs +227 -0
  141. package/src/resolver/RequestBodyResolver.mjs +220 -0
  142. package/src/resolver/ResolverScope.cjs +5 -0
  143. package/src/resolver/ResolverScope.mjs +1 -0
  144. package/src/resolver/StepParameterResolver.cjs +22 -0
  145. package/src/resolver/StepParameterResolver.mjs +15 -0
  146. package/src/resolver/WorkflowParameterResolver.cjs +73 -0
  147. package/src/resolver/WorkflowParameterResolver.mjs +66 -0
  148. package/src/state/WorkflowExecutionState.cjs +99 -0
  149. package/src/state/WorkflowExecutionState.mjs +93 -0
  150. package/src/vendor/swagger-client.cjs +1 -0
  151. package/src/vendor/swagger-client.mjs +1 -0
  152. package/types/runner.d.ts +2341 -0
@@ -0,0 +1,2341 @@
1
+ import { ApiDOMReferenceOptions } from '@speclynx/apidom-reference/configuration/empty';
2
+ import { ApiDOMStructuredError } from '@speclynx/apidom-error';
3
+ import { CriterionElement } from '@speclynx/apidom-ns-arazzo-1';
4
+ import { FailureActionElement } from '@speclynx/apidom-ns-arazzo-1';
5
+ import { JSONPointer } from '@speclynx/apidom-json-pointer';
6
+ import { OperationElement } from '@speclynx/apidom-ns-openapi-2';
7
+ import { OperationElement as OperationElement_2 } from '@speclynx/apidom-ns-openapi-3-0';
8
+ import { OperationElement as OperationElement_3 } from '@speclynx/apidom-ns-openapi-3-1';
9
+ import type { ParseResultElement } from '@usearazzo/parser';
10
+ import type { PartialDeep } from 'type-fest';
11
+ import { PathItemElement } from '@speclynx/apidom-ns-openapi-2';
12
+ import { PathItemElement as PathItemElement_2 } from '@speclynx/apidom-ns-openapi-3-0';
13
+ import { PathItemElement as PathItemElement_3 } from '@speclynx/apidom-ns-openapi-3-1';
14
+ import { RequestBodyElement } from '@speclynx/apidom-ns-arazzo-1';
15
+ import type { SourceDescriptionElement } from '@speclynx/apidom-ns-arazzo-1';
16
+ import { StepElement } from '@speclynx/apidom-ns-arazzo-1';
17
+ import { StepOnFailureElement } from '@speclynx/apidom-ns-arazzo-1';
18
+ import { StepOnSuccessElement } from '@speclynx/apidom-ns-arazzo-1';
19
+ import type { StepOutputsElement } from '@speclynx/apidom-ns-arazzo-1';
20
+ import { StepParametersElement } from '@speclynx/apidom-ns-arazzo-1';
21
+ import { SuccessActionElement } from '@speclynx/apidom-ns-arazzo-1';
22
+ import { toYAML } from '@speclynx/apidom-core';
23
+ import { WorkflowElement } from '@speclynx/apidom-ns-arazzo-1';
24
+ import type { WorkflowOutputsElement } from '@speclynx/apidom-ns-arazzo-1';
25
+
26
+ /**
27
+ * Selects the actions to take for a step outcome from its `onSuccess` /
28
+ * `onFailure` list.
29
+ *
30
+ * Actions are tried in order and every one whose `criteria` all pass is
31
+ * returned (an action with no criteria always matches). Action elements are
32
+ * returned as-is — interpreting them (branching on `type`, reading
33
+ * `stepId`/`workflowId`/`retryAfter`/`retryLimit`) is the caller's concern, and
34
+ * keeping them elements preserves the document provenance. The usual caller
35
+ * acts on the first and takes an empty result as "no action matched", applying
36
+ * the path default — the next sequential step on success, break-and-return on
37
+ * failure.
38
+ *
39
+ * A step's list is the only list there is: Reusable Object entries are already
40
+ * inlined by workflow normalization, and the workflow-level
41
+ * `successActions` / `failureActions` a step falls back to are inherited into
42
+ * `onSuccess` / `onFailure` by the same pass, so a well-formed document reaches
43
+ * this point as the step's own list of concrete action elements.
44
+ * @public
45
+ */
46
+ export declare class ActionResolver {
47
+ #private;
48
+ /**
49
+ * Returns every `onSuccess` action whose criteria are all met, in list order.
50
+ *
51
+ * The whole matching chain rather than only the first, because the caller
52
+ * needs both: it acts on `[0]`, and the one honoring "retryLimit exhausted
53
+ * prior to subsequent failure actions" walks the rest, falling from an
54
+ * exhausted `retry` to the next matching action without re-evaluating
55
+ * criteria. Empty when the list is absent or nothing matches.
56
+ *
57
+ * `scope` names the step this list belongs to, for a thrown
58
+ * {@link ResolverError}.
59
+ *
60
+ * A well-formed list whose entry is not a Success/Failure Action Object
61
+ * throws rather than being skipped: an unrecognized entry is indistinguishable
62
+ * from a step that deliberately declared no action for it, and the `goto` /
63
+ * `end` its author was reaching for would otherwise never happen without a
64
+ * word said about why.
65
+ */
66
+ resolveOnSuccess(actions: StepOnSuccessElement | undefined, isCriterionMet: CriterionPredicate, scope: StepScope): SuccessActionElement[];
67
+ /**
68
+ * Returns every `onFailure` action whose criteria are all met, in list order.
69
+ *
70
+ * Same matching and error behavior as {@link ActionResolver.resolveOnSuccess} —
71
+ * see there for the full rationale — mirrored for the step's other list.
72
+ */
73
+ resolveOnFailure(actions: StepOnFailureElement | undefined, isCriterionMet: CriterionPredicate, scope: StepScope): FailureActionElement[];
74
+ }
75
+
76
+ /**
77
+ * Base document held by the document registry.
78
+ * @public
79
+ */
80
+ export declare abstract class APIDocument {
81
+ abstract readonly type: string;
82
+ readonly uri: string;
83
+ readonly parseResult: ParseResultElement;
84
+ protected constructor(uri: string, parseResult: ParseResultElement);
85
+ /**
86
+ * Returns a JSON-serializable representation of the document's API element.
87
+ * Compatible with JSON.stringify() — JSON.stringify(doc) produces correct output.
88
+ */
89
+ toJSON(): unknown;
90
+ /**
91
+ * Serializes the document's API element to a YAML string.
92
+ */
93
+ toYAML(...args: Parameters<typeof toYAML> extends [unknown, ...infer R] ? R : []): string;
94
+ }
95
+
96
+ /**
97
+ * An Arazzo document held by the document registry: the parse result together
98
+ * with the indexes the provider built over it — a container, not a logic
99
+ * bearer. The methods below are thin reads of the source description index.
100
+ * @public
101
+ */
102
+ export declare class ArazzoDocument extends APIDocument {
103
+ readonly type: "arazzo";
104
+ isEntry: boolean;
105
+ /**
106
+ * WorkflowId → JSON Pointer to the workflow within the parse result.
107
+ */
108
+ readonly workflowIndex: ArazzoWorkflowIndex;
109
+ /**
110
+ * WorkflowId → stepId → JSON Pointer to the step within the parse result.
111
+ * Built by the provider, like {@link ArazzoDocument.workflowIndex}.
112
+ */
113
+ readonly stepIndex: ArazzoStepIndex;
114
+ /**
115
+ * Name → source description element and canonical URI (already resolved
116
+ * against this document's base URI). Built by the provider, like
117
+ * {@link ArazzoDocument.workflowIndex}.
118
+ */
119
+ readonly sourceDescriptionIndex: ArazzoSourceDescriptionIndex;
120
+ constructor(uri: string, parseResult: ParseResultElement, workflowIndex: ArazzoWorkflowIndex, stepIndex: ArazzoStepIndex, sourceDescriptionIndex: ArazzoSourceDescriptionIndex, isEntry?: boolean);
121
+ /**
122
+ * Type guard for ArazzoDocument.
123
+ */
124
+ static is(doc: APIDocument): doc is ArazzoDocument;
125
+ /**
126
+ * Resolves a source description name to its canonical URI — precomputed by
127
+ * the provider, resolved against this document's base URI.
128
+ */
129
+ resolveSourceDescriptionURI(sourceDescriptionName: string): string | undefined;
130
+ /**
131
+ * Resolves a field of a source description object (e.g. `url`, `type`).
132
+ *
133
+ * The `url` field resolves to the canonical URI (resolved against this
134
+ * document's base URI, as `resolveSourceDescriptionURI` does); every other
135
+ * field resolves to its literal value. Returns `undefined` when the source
136
+ * description or the field is absent.
137
+ */
138
+ resolveSourceDescriptionField(sourceDescriptionName: string, field: string): unknown;
139
+ /**
140
+ * The canonical URIs of this document's source descriptions, resolved against
141
+ * this document's base URI, in declaration order. Sources without a resolvable
142
+ * url are omitted.
143
+ */
144
+ sourceDescriptionURIs(): string[];
145
+ }
146
+
147
+ /**
148
+ * Provides ArazzoDocument instances for the DocumentRegistry.
149
+ *
150
+ * Parses the Arazzo document and builds its workflow and source description
151
+ * indexes — the document itself is a container.
152
+ * @public
153
+ */
154
+ export declare class ArazzoDocumentRegistryProvider extends DocumentRegistryProvider {
155
+ #private;
156
+ constructor(options?: ArazzoDocumentRegistryProviderOptions);
157
+ canProvide(uri: string): Promise<boolean>;
158
+ /**
159
+ * Loads an Arazzo document from a URI and produces an ArazzoDocument.
160
+ */
161
+ provide(uri: string): Promise<ArazzoDocument>;
162
+ }
163
+
164
+ /**
165
+ * Options for loading an Arazzo document.
166
+ * @public
167
+ */
168
+ export declare type ArazzoDocumentRegistryProviderOptions = DocumentRegistryProviderOptions;
169
+
170
+ /** @public */
171
+ export declare class ArazzoRunnerError extends ApiDOMStructuredError {
172
+ }
173
+
174
+ /**
175
+ * Index mapping a source description name to its element and canonical URI in
176
+ * an Arazzo document.
177
+ * @public
178
+ */
179
+ export declare class ArazzoSourceDescriptionIndex extends Map<SourceDescriptionName, SourceDescriptionEntry> {
180
+ }
181
+
182
+ /**
183
+ * Extracts a step from an Arazzo workflow by stepId.
184
+ *
185
+ * Searches the workflow's steps array for the matching stepId.
186
+ * The workflow should be already extracted via ArazzoWorkflowExtractor.
187
+ * @public
188
+ */
189
+ export declare class ArazzoStepExtractor {
190
+ /**
191
+ * Extracts a step element by stepId from a workflow.
192
+ */
193
+ extract(workflow: WorkflowElement, stepId: string): StepElement;
194
+ }
195
+
196
+ /**
197
+ * Index mapping workflowId → stepId → JSON Pointer to the step in an Arazzo
198
+ * document. Steps are unique only within their workflow, hence the nesting.
199
+ * @public
200
+ */
201
+ export declare class ArazzoStepIndex extends Map<WorkflowId, Map<StepId, JSONPointer>> {
202
+ /**
203
+ * The JSON Pointer of a step, or `undefined` when the workflow or step is absent.
204
+ */
205
+ getStep(workflowId: WorkflowId, stepId: StepId): JSONPointer | undefined;
206
+ }
207
+
208
+ /**
209
+ * Normalizes an extracted Arazzo step.
210
+ *
211
+ * Currently acts as an identity function. Steps are already dereferenced as part
212
+ * of workflow normalization, which also inherits the workflow's `parameters`
213
+ * into them — a step reaching here has no inherited properties left to merge.
214
+ * @public
215
+ */
216
+ export declare class ArazzoStepNormalizer {
217
+ /**
218
+ * Normalizes a step element against its parent document.
219
+ */
220
+ normalize(step: StepElement, _document: ArazzoDocument): Promise<StepElement>;
221
+ }
222
+
223
+ /**
224
+ * Base of every resolver of authored Arazzo values — the single home of the
225
+ * literal-vs-expression rule they all share.
226
+ *
227
+ * Per Arazzo 1.0.1, an authored value (a parameter's `value`, an `outputs`
228
+ * entry, a `requestBody` replacement value) is either a literal or a whole
229
+ * runtime expression — there is no embedded/interpolated expression. So a
230
+ * value that is a string is resolved as an expression only when the entire
231
+ * string is a valid runtime expression; every other value (a non-expression
232
+ * string such as `"{$inputs.x}"`, a number, boolean, object, array, or null)
233
+ * is a literal and is used as-is. This is deliberately not template
234
+ * interpolation. The one exception is a `requestBody` payload, which "can
235
+ * contain" runtime expressions — {@link RequestBodyResolver} walks it instead.
236
+ * @public
237
+ */
238
+ export declare abstract class ArazzoValueResolver {
239
+ /**
240
+ * Resolves one authored value element by the rule above.
241
+ */
242
+ protected resolveValue(element: unknown, resolve: RuntimeExpressionResolver): unknown;
243
+ }
244
+
245
+ /**
246
+ * Extracts a workflow from an Arazzo document by workflowId.
247
+ *
248
+ * The workflow is already fully dereferenced in the document,
249
+ * so no additional processing is needed.
250
+ * @public
251
+ */
252
+ export declare class ArazzoWorkflowExtractor {
253
+ /**
254
+ * Extracts a workflow element by workflowId.
255
+ */
256
+ extract(document: ArazzoDocument, workflowId: WorkflowId): WorkflowElement;
257
+ }
258
+
259
+ /**
260
+ * Index mapping workflowId to its JSON Pointer in an Arazzo document.
261
+ * @public
262
+ */
263
+ export declare class ArazzoWorkflowIndex extends Map<WorkflowId, JSONPointer> {
264
+ }
265
+
266
+ /**
267
+ * A canonical Arazzo workflow locator: the Arazzo document that owns the
268
+ * workflow and the workflow's id within it.
269
+ *
270
+ * A workflow reference names its target in one of two ways — a plain
271
+ * `workflowId` of the current document, or a
272
+ * `$sourceDescriptions.{name}.{workflowId}` runtime expression naming a
273
+ * workflow of another Arazzo document. Both are locators for the same thing;
274
+ * the normalizer reduces either to this single canonical form. `workflowId`
275
+ * is the bare id either way — the key run state (`$workflows.{id}`) is
276
+ * recorded under, which the runtime-expression grammar can only express
277
+ * unqualified.
278
+ * @public
279
+ */
280
+ export declare interface ArazzoWorkflowLocator {
281
+ readonly document: ArazzoDocument;
282
+ readonly workflowId: string;
283
+ }
284
+
285
+ /**
286
+ * Normalizes a workflow reference to a canonical {@link ArazzoWorkflowLocator}
287
+ * — the Arazzo document and the workflow's id within it.
288
+ *
289
+ * A reference appears in four author-facing positions — a sub-workflow step's
290
+ * `workflowId`, a `dependsOn` entry, a `retry` action's `workflowId`
291
+ * reference, and a `goto` action's transfer target — and is either a plain id
292
+ * of the referencing document or a whole
293
+ * `$sourceDescriptions.{name}.{workflowId}` runtime expression naming a
294
+ * workflow of another Arazzo document. Only that dotted expression form is a
295
+ * workflow reference; the resolver package's
296
+ * `$sourceDescriptions.{name}#/json/pointer` form is a `$ref`-time construct,
297
+ * not a runtime expression, and does not parse here.
298
+ *
299
+ * The `type` declared on a source description is not trusted (it may be
300
+ * absent or wrong); a source is classified by what it actually parses to,
301
+ * the same convention the OpenAPI operation locator follows. Source
302
+ * documents are acquired from the registry on demand. Whether the resolved
303
+ * document *defines* the workflow is deliberately left to the caller, which
304
+ * owns the timing of that check (eager for a `dependsOn` list validated
305
+ * before any prerequisite runs, lazy for a sub-workflow step resolved per
306
+ * attempt).
307
+ * @public
308
+ */
309
+ export declare class ArazzoWorkflowLocatorNormalizer extends SourceDescriptionsLocatorNormalizer {
310
+ #private;
311
+ /**
312
+ * Resolves a reference — a plain workflowId or a
313
+ * `$sourceDescriptions.{name}.{workflowId}` expression, as written — to the
314
+ * canonical locator: the Arazzo document that owns the target workflow,
315
+ * and the bare id within it.
316
+ */
317
+ normalize(reference: string, document: ArazzoDocument, context: WorkflowReferenceContext): Promise<ArazzoWorkflowLocator>;
318
+ }
319
+
320
+ /**
321
+ * Normalizes an extracted Arazzo workflow.
322
+ *
323
+ * Dereferences the workflow subtree ($components.* references),
324
+ * producing a self-contained workflow element, then inherits the workflow's
325
+ * "applicable for all steps" defaults — its `parameters`, and its
326
+ * `successActions` / `failureActions` — into each of its steps.
327
+ *
328
+ * All passes mutate, and what they mutate is the document itself: the extractor
329
+ * hands over the live workflow node out of `document.parseResult`, and
330
+ * dereferencing runs `immutable: false`, returning that same instance. Writing
331
+ * through to the document is what lets the registry act as a natural cache —
332
+ * a workflow reached a second time is already dereferenced and already
333
+ * inherited into, so no pass repeats. The inheritance is idempotent for
334
+ * exactly that reason.
335
+ *
336
+ * The writes differ in kind, which is worth knowing before sharing a
337
+ * registry. Dereferencing only *resolves* what the document already says — a
338
+ * `$ref` replaced by its target means the same thing. Inheritance *synthesizes*:
339
+ * afterwards a step carries `parameters` or an `onSuccess` its source never
340
+ * declared, so a consumer that reads the document back (`APIDocument.toJSON()`)
341
+ * sees one that no longer matches the file it was parsed from. The OpenAPI
342
+ * normalizers write inherited servers, parameters and security requirements into
343
+ * their documents the same way, so this is the layer's established contract
344
+ * rather than a property of Arazzo.
345
+ * @public
346
+ */
347
+ export declare class ArazzoWorkflowNormalizer {
348
+ #private;
349
+ constructor(options?: ArazzoWorkflowNormalizerOptions);
350
+ /**
351
+ * Dereferences the workflow subtree against its parent document, then inherits
352
+ * the workflow's `parameters` and default actions into its steps.
353
+ */
354
+ normalize(workflow: WorkflowElement, document: ArazzoDocument): Promise<WorkflowElement>;
355
+ }
356
+
357
+ /**
358
+ * Options for normalizing an Arazzo workflow.
359
+ * @public
360
+ */
361
+ export declare type ArazzoWorkflowNormalizerOptions = PartialDeep<ApiDOMReferenceOptions>;
362
+
363
+ /** @public */
364
+ export declare class AssemblerError extends ArazzoRunnerError {
365
+ readonly operationId?: string;
366
+ readonly uri?: string;
367
+ }
368
+
369
+ /** @public */
370
+ export declare class ClientError extends ArazzoRunnerError {
371
+ readonly operationId?: string;
372
+ readonly operationPath?: string;
373
+ readonly uri?: string;
374
+ }
375
+
376
+ /**
377
+ * A read-only source of the runtime expression context for a step.
378
+ *
379
+ * The step executor only reads accumulated run state — it produces the
380
+ * pre-request context (`toContext()`) and the post-request context
381
+ * (`toContext(request, response)`) — and never mutates it, so it depends on
382
+ * this narrow interface rather than the full execution state.
383
+ * @public
384
+ */
385
+ export declare interface ContextSource {
386
+ toContext(request?: RuntimeExpressionContext['request'], response?: RuntimeExpressionResponseContext): RuntimeExpressionContext;
387
+ }
388
+
389
+ /**
390
+ * Resolves a runtime expression to a value during criterion evaluation.
391
+ *
392
+ * Used both for a criterion's `context` (regex/jsonpath/xpath) and for the
393
+ * expressions embedded in a `simple` condition. It should resolve leniently —
394
+ * an unresolvable reference returning `undefined` fails the criterion rather
395
+ * than throwing (a common way to drive it is
396
+ * `(expression) => runtimeExpressionEvaluator.evaluate(expression)` with a
397
+ * lenient evaluator).
398
+ * @public
399
+ */
400
+ export declare type CriterionContextResolver = (expression: string) => unknown;
401
+
402
+ /** @public */
403
+ export declare class CriterionError extends ArazzoRunnerError {
404
+ readonly condition?: string;
405
+ readonly type?: string;
406
+ readonly reason?: string;
407
+ }
408
+
409
+ /**
410
+ * Evaluates an Arazzo Criterion Object to a boolean.
411
+ *
412
+ * Dispatches on the criterion's `type` (defaulting to `simple` when omitted):
413
+ * - `simple` — evaluates the condition directly, resolving the runtime
414
+ * expressions embedded in it.
415
+ * - `regex` — resolves the `context` runtime expression, then applies the
416
+ * pattern to the resolved value.
417
+ * - `jsonpath` — resolves the `context` runtime expression, then applies the
418
+ * JSONPath query to the resolved value (met when the query matches). Only the
419
+ * `rfc9535` version is supported (the spec default); an explicit other version
420
+ * throws.
421
+ * - `xpath` — resolves the `context` runtime expression, then applies the XPath
422
+ * 3.1 query to the resolved XML value (met by the Effective Boolean Value).
423
+ * Only the `xpath-31` version is supported (the spec default); an explicit
424
+ * other version throws.
425
+ *
426
+ * The evaluator is agnostic about how runtime expressions are resolved: the
427
+ * caller supplies a {@link CriterionContextResolver} per evaluation, keeping
428
+ * runtime-state, document, and registry concerns in the runtime expression
429
+ * evaluator rather than duplicated here.
430
+ * @public
431
+ */
432
+ export declare class CriterionEvaluator {
433
+ #private;
434
+ constructor(options?: CriterionEvaluatorOptions);
435
+ /**
436
+ * Evaluates a criterion element, returning whether the condition is met.
437
+ *
438
+ * `resolve` turns a runtime expression into a value: for `simple` it resolves
439
+ * the expressions embedded in the condition; for the other types it resolves
440
+ * the criterion's `context` expression that the condition is applied to.
441
+ */
442
+ evaluate(criterion: CriterionElement, resolve: CriterionContextResolver): boolean;
443
+ }
444
+
445
+ /**
446
+ * Options for the CriterionEvaluator.
447
+ * @public
448
+ */
449
+ export declare interface CriterionEvaluatorOptions {
450
+ /**
451
+ * Simple condition evaluator. Injectable for testing.
452
+ */
453
+ readonly simple?: SimpleCriterionEvaluator;
454
+ /**
455
+ * Regex condition evaluator. Injectable for testing.
456
+ */
457
+ readonly regex?: RegexCriterionEvaluator;
458
+ /**
459
+ * JSONPath condition evaluator. Injectable for testing.
460
+ */
461
+ readonly jsonpath?: JSONPathCriterionEvaluator;
462
+ /**
463
+ * XPath condition evaluator. Injectable for testing.
464
+ */
465
+ readonly xpath?: XPathCriterionEvaluator;
466
+ }
467
+
468
+ /**
469
+ * Determines whether a single criterion is met.
470
+ *
471
+ * Bridged to a criterion evaluator
472
+ * (`(criterion) => criterionEvaluator.evaluate(criterion, resolve)`); an
473
+ * unresolvable/failing criterion is `false`, not an error.
474
+ * @public
475
+ */
476
+ export declare type CriterionPredicate = (criterion: CriterionElement) => boolean;
477
+
478
+ /**
479
+ * Registry for API documents keyed by canonical URI.
480
+ *
481
+ * Acts as an LRU cache for parsed documents. The entry Arazzo document
482
+ * is pinned and never evicted. Providers are tried in order to detect
483
+ * and load documents.
484
+ * @public
485
+ */
486
+ export declare class DocumentRegistry {
487
+ #private;
488
+ constructor(options?: DocumentRegistryOptions);
489
+ /**
490
+ * Returns the entry Arazzo document, or undefined if not yet registered.
491
+ */
492
+ get entryDocument(): ArazzoDocument | undefined;
493
+ /**
494
+ * Acquires a document by URI. Returns cached document if available,
495
+ * otherwise detects the format, loads via the matching provider,
496
+ * caches, and returns it.
497
+ */
498
+ acquire(uri: string): Promise<APIDocument>;
499
+ /**
500
+ * Returns an already-loaded document by URI, or undefined if not cached.
501
+ *
502
+ * Synchronous counterpart to `acquire`: it never loads a document, only
503
+ * returns one the registry already holds, marking it most recently used like
504
+ * any other access. Consumers that must resolve a reference without awaiting
505
+ * (e.g. runtime expression evaluation) use this; the executor is responsible
506
+ * for having acquired the document beforehand.
507
+ */
508
+ get(uri: string): APIDocument | undefined;
509
+ /**
510
+ * Acquires the entry Arazzo document and marks it with `isEntry: true`.
511
+ * Validates that the document is an Arazzo specification.
512
+ */
513
+ acquireEntryDocument(uri: string): Promise<ArazzoDocument>;
514
+ clear(): void;
515
+ }
516
+
517
+ /**
518
+ * Options for the DocumentRegistry.
519
+ * @public
520
+ */
521
+ export declare interface DocumentRegistryOptions {
522
+ readonly providers?: DocumentRegistryProvider[];
523
+ }
524
+
525
+ /**
526
+ * Base class for document registry providers.
527
+ *
528
+ * Subclasses implement `canProvide()` for format detection and `provide()` for loading.
529
+ * @public
530
+ */
531
+ export declare abstract class DocumentRegistryProvider {
532
+ /**
533
+ * Checks if the content at the URI can be handled by this provider.
534
+ */
535
+ abstract canProvide(uri: string): Promise<boolean>;
536
+ /**
537
+ * Loads and produces a document from a URI.
538
+ */
539
+ abstract provide(uri: string): Promise<APIDocument>;
540
+ }
541
+
542
+ /**
543
+ * Options for a document registry provider.
544
+ * @public
545
+ */
546
+ export declare type DocumentRegistryProviderOptions = PartialDeep<ApiDOMReferenceOptions>;
547
+
548
+ /** @public */
549
+ export declare class ExecutionError extends ArazzoRunnerError {
550
+ readonly stepId?: string;
551
+ readonly workflowId?: string;
552
+ readonly reason?: string;
553
+ /**
554
+ * The chain of workflowIds the error concerns — the loop A → B → A for a
555
+ * cycle, or the call chain in progress when a budget ran out.
556
+ */
557
+ readonly path?: readonly string[];
558
+ }
559
+
560
+ /** @public */
561
+ export declare class ExtractionError extends ArazzoRunnerError {
562
+ readonly workflowId?: string;
563
+ readonly stepId?: string;
564
+ readonly operationId?: string;
565
+ readonly pointer?: string;
566
+ readonly uri?: string;
567
+ }
568
+
569
+ /**
570
+ * The pluggable HTTP transport seam.
571
+ *
572
+ * Receives the finalized {@link OpenAPIOperationRequest} and resolves with the
573
+ * raw WHATWG `Response`. The contract is deliberately minimal so any HTTP
574
+ * stack (undici, got, a recording stub, …) drops in with a few lines:
575
+ *
576
+ * - resolve with a `Response` for every HTTP status — a non-2xx is a valid
577
+ * Arazzo outcome judged by a step's `successCriteria`, never an error;
578
+ * - throw (or reject) only on transport failure — the executor wraps the
579
+ * error as a `ClientError`;
580
+ * - honor `request.signal` when present.
581
+ *
582
+ * Response normalization (content-type dispatch, header mapping) happens on
583
+ * the executor side for every client, so `$response.body` semantics stay
584
+ * identical no matter which transport is plugged in.
585
+ * @public
586
+ */
587
+ export declare type HTTPClient = (request: OpenAPIOperationRequest) => Promise<Response>;
588
+
589
+ /**
590
+ * The default {@link HTTPClient}: global fetch.
591
+ *
592
+ * Mirrors swagger-client's own transport line — the request object doubles as
593
+ * fetch init, so `method`, `headers`, `body`, `credentials`, and `signal` are
594
+ * picked up from it directly.
595
+ * @public
596
+ */
597
+ export declare const httpClientFetch: HTTPClient;
598
+
599
+ /** @public */
600
+ export declare class InvalidEntryDocumentError extends ArazzoRunnerError {
601
+ readonly uri?: string;
602
+ }
603
+
604
+ /**
605
+ * Evaluates a `jsonpath` Arazzo criterion condition against a resolved context value.
606
+ *
607
+ * The condition is a JSONPath query (RFC 9535, per the Criterion Expression
608
+ * Type Object's pinned version) applied to the resolved `context`. The criterion
609
+ * is met when the query yields a non-empty node list.
610
+ *
611
+ * Per Arazzo 1.1.0, a `null` or `undefined` context fails the condition. The
612
+ * context is a plain runtime value (the runtime expression evaluator has already
613
+ * converted any ApiDOM element), so the default JSON evaluation realm applies.
614
+ * @public
615
+ */
616
+ export declare class JSONPathCriterionEvaluator {
617
+ /**
618
+ * Runs the JSONPath `condition` against the resolved context value, returning
619
+ * whether it matched anything.
620
+ *
621
+ * Returns `false` when the context is `null` or `undefined`. Throws
622
+ * {@link CriterionError} when the condition is not a valid JSONPath query.
623
+ */
624
+ evaluate(condition: string, context: unknown): boolean;
625
+ }
626
+
627
+ /** @public */
628
+ export declare class NormalizationError extends ArazzoRunnerError {
629
+ readonly workflowId?: string;
630
+ readonly operationId?: string;
631
+ readonly operationPointer?: string;
632
+ readonly pathItemPointer?: string;
633
+ readonly uri?: string;
634
+ }
635
+
636
+ /**
637
+ * Assembles a standalone OpenAPI 2.0 (Swagger) document from a
638
+ * normalized operation element.
639
+ *
640
+ * The assembled document is a valid Swagger 2.0 specification containing
641
+ * only the single operation with its host, basePath, schemes, and
642
+ * referenced security definitions from the source document.
643
+ * @public
644
+ */
645
+ export declare class OpenAPI2DocumentAssembler {
646
+ #private;
647
+ /**
648
+ * Assembles a standalone Swagger 2.0 document from a normalized operation.
649
+ */
650
+ assemble(operation: OperationElement, document: OpenAPIDocument): OpenAPIDocument;
651
+ }
652
+
653
+ /**
654
+ * Version-specific normalization for OpenAPI 2.0 (Swagger) operations.
655
+ *
656
+ * Dereferences the operation subtree and handles merging of
657
+ * parameters and security from path item and root levels.
658
+ * OpenAPI 2.0 does not support servers at path item or operation level;
659
+ * host/basePath/schemes are root-level only and handled at execution time.
660
+ * @public
661
+ */
662
+ export declare class OpenAPI2OperationNormalizer {
663
+ #private;
664
+ constructor(options?: OpenAPI2OperationNormalizerOptions);
665
+ normalize(operation: OperationElement, document: OpenAPIDocument): Promise<OperationElement>;
666
+ }
667
+
668
+ /**
669
+ * Options for normalizing an OpenAPI 2.0 operation.
670
+ * @public
671
+ */
672
+ export declare type OpenAPI2OperationNormalizerOptions = PartialDeep<ApiDOMReferenceOptions>;
673
+
674
+ /**
675
+ * Assembles a standalone OpenAPI 3.0 document from a
676
+ * normalized operation element.
677
+ *
678
+ * The assembled document is a valid OpenAPI 3.0 specification containing
679
+ * only the single operation with its servers, and referenced security
680
+ * schemes from the source document's components.
681
+ * @public
682
+ */
683
+ export declare class OpenAPI30DocumentAssembler {
684
+ #private;
685
+ /**
686
+ * Assembles a standalone OpenAPI 3.0 document from a normalized operation.
687
+ */
688
+ assemble(operation: OperationElement_2, document: OpenAPIDocument): OpenAPIDocument;
689
+ }
690
+
691
+ /**
692
+ * Version-specific normalization for OpenAPI 3.0 operations.
693
+ *
694
+ * Dereferences the operation subtree and handles merging of servers,
695
+ * parameters, and security from path item and root levels.
696
+ * @public
697
+ */
698
+ export declare class OpenAPI30OperationNormalizer {
699
+ #private;
700
+ constructor(options?: OpenAPI30OperationNormalizerOptions);
701
+ normalize(operation: OperationElement_2, document: OpenAPIDocument): Promise<OperationElement_2>;
702
+ }
703
+
704
+ /**
705
+ * Options for normalizing an OpenAPI 3.0 operation.
706
+ * @public
707
+ */
708
+ export declare type OpenAPI30OperationNormalizerOptions = PartialDeep<ApiDOMReferenceOptions>;
709
+
710
+ /**
711
+ * Assembles a standalone OpenAPI 3.1 document from a
712
+ * normalized operation element.
713
+ *
714
+ * The assembled document is a valid OpenAPI 3.1 specification containing
715
+ * only the single operation with its servers, and referenced security
716
+ * schemes from the source document's components.
717
+ * @public
718
+ */
719
+ export declare class OpenAPI31DocumentAssembler {
720
+ #private;
721
+ /**
722
+ * Assembles a standalone OpenAPI 3.1 document from a normalized operation.
723
+ */
724
+ assemble(operation: OperationElement_3, document: OpenAPIDocument): OpenAPIDocument;
725
+ }
726
+
727
+ /**
728
+ * Version-specific normalization for OpenAPI 3.1 operations.
729
+ *
730
+ * Dereferences the operation subtree and handles merging of servers,
731
+ * parameters, and security from path item and root levels.
732
+ * Same inheritance rules as 3.0 but with JSON Schema $id semantics
733
+ * for schema resolution.
734
+ * @public
735
+ */
736
+ export declare class OpenAPI31OperationNormalizer {
737
+ #private;
738
+ constructor(options?: OpenAPI31OperationNormalizerOptions);
739
+ normalize(operation: OperationElement_3, document: OpenAPIDocument): Promise<OperationElement_3>;
740
+ }
741
+
742
+ /**
743
+ * Options for normalizing an OpenAPI 3.1 operation.
744
+ * @public
745
+ */
746
+ export declare type OpenAPI31OperationNormalizerOptions = PartialDeep<ApiDOMReferenceOptions>;
747
+
748
+ /**
749
+ * An OpenAPI document held by the document registry.
750
+ * @public
751
+ */
752
+ export declare class OpenAPIDocument extends APIDocument {
753
+ readonly type: "openapi";
754
+ readonly operationIndex: OpenAPIOperationIndex;
755
+ constructor(uri: string, parseResult: ParseResultElement, operationIndex: OpenAPIOperationIndex);
756
+ /**
757
+ * Type guard for OpenAPIDocument.
758
+ */
759
+ static is(doc: APIDocument): doc is OpenAPIDocument;
760
+ }
761
+
762
+ /**
763
+ * Facade for assembling standalone OpenAPI documents across all supported versions.
764
+ *
765
+ * Detects the OpenAPI version from the source document and delegates to the
766
+ * appropriate version-specific assembler (2.0, 3.0, or 3.1).
767
+ *
768
+ * Custom assembler instances can be provided via constructor options.
769
+ * @public
770
+ */
771
+ export declare class OpenAPIDocumentAssembler {
772
+ #private;
773
+ constructor(options?: OpenAPIDocumentAssemblerOptions);
774
+ /**
775
+ * Assembles a standalone OpenAPI document by delegating to the version-specific assembler.
776
+ */
777
+ assemble(operation: OpenAPIOperationElement, document: OpenAPIDocument): OpenAPIDocument;
778
+ }
779
+
780
+ /**
781
+ * Options for the OpenAPI document assembler facade.
782
+ * @public
783
+ */
784
+ export declare interface OpenAPIDocumentAssemblerOptions {
785
+ readonly openapi2?: OpenAPI2DocumentAssembler;
786
+ readonly openapi30?: OpenAPI30DocumentAssembler;
787
+ readonly openapi31?: OpenAPI31DocumentAssembler;
788
+ }
789
+
790
+ /**
791
+ * Provides OpenAPIDocument instances for the DocumentRegistry.
792
+ *
793
+ * Parses, dereferences, and builds an OperationIndex for OpenAPI documents.
794
+ * @public
795
+ */
796
+ export declare class OpenAPIDocumentRegistryProvider extends DocumentRegistryProvider {
797
+ #private;
798
+ constructor(options?: OpenAPIDocumentRegistryProviderOptions);
799
+ canProvide(uri: string): Promise<boolean>;
800
+ /**
801
+ * Loads an OpenAPI document from a URI and produces an OpenAPIDocument.
802
+ */
803
+ provide(uri: string): Promise<OpenAPIDocument>;
804
+ }
805
+
806
+ /**
807
+ * Options for loading an OpenAPI document.
808
+ * @public
809
+ */
810
+ export declare type OpenAPIDocumentRegistryProviderOptions = DocumentRegistryProviderOptions;
811
+
812
+ /**
813
+ * Union of OperationElement across all supported OpenAPI versions.
814
+ * @public
815
+ */
816
+ export declare type OpenAPIOperationElement = OperationElement | OperationElement_2 | OperationElement_3;
817
+
818
+ /**
819
+ * Options for executing an OpenAPI operation.
820
+ *
821
+ * All fields are forwarded to the vendored swagger-client `buildRequest`
822
+ * (which owns parameter serialization, security application, and server URL
823
+ * resolution), except `requestInterceptor`, which the executor runs between
824
+ * building the request and sending it.
825
+ *
826
+ * Typed here are the options the runner itself drives and the ones callers
827
+ * routinely reach for. The rest of `buildRequest`'s surface (`securities`,
828
+ * `scheme`, `parameterBuilders`, `attachContentTypeForEmptyPayload`, …) is
829
+ * deliberately left untyped and passes through the bag's open tail unchanged —
830
+ * see {@link OpenAPIOperationExecuteOptionsBag}. Authentication in particular
831
+ * is not modeled: Arazzo is auth-agnostic, so credentials are applied with a
832
+ * {@link RequestInterceptor}.
833
+ * @public
834
+ */
835
+ export declare interface OpenAPIOperationExecuteOptions {
836
+ readonly parameters?: Record<string, unknown>;
837
+ readonly requestBody?: unknown;
838
+ /**
839
+ * The media type of the request body, sent as the `Content-Type` header (the
840
+ * Arazzo `requestBody.contentType`). Matched against the media types the
841
+ * operation declares under `requestBody.content`, ignoring case and any
842
+ * parameters it carries, and accepting a declared range (`type/*`, or the
843
+ * all-media-types range) as covering a concrete type. The authored value is
844
+ * sent in full whichever declaration it matched.
845
+ *
846
+ * The form media types are the exception: `application/x-www-form-urlencoded`
847
+ * and `multipart/form-data` decide how the body is encoded, so they must be
848
+ * declared exactly rather than by a range. A media type matching nothing
849
+ * throws rather than sending an empty or wrongly encoded body.
850
+ */
851
+ readonly requestContentType?: string;
852
+ /**
853
+ * The media type to ask for in the response, sent as the `Accept` header.
854
+ * When omitted, `Accept` is derived from the media types the operation
855
+ * declares for its 2xx responses.
856
+ */
857
+ readonly responseContentType?: string;
858
+ /**
859
+ * The server to send the request to. A value matching a declared server's
860
+ * `url` selects it and brings that server's variable defaults along; any
861
+ * other value is used as the base URL directly, so pointing a workflow at
862
+ * another environment needs no special option. Relative values resolve
863
+ * against the document's own URL. Works the same for OpenAPI 2.0 and 3.x.
864
+ *
865
+ * Defaults to the first server the operation declares (for 2.0, the
866
+ * document's `schemes`/`host`/`basePath`), resolved against the URL the
867
+ * document was loaded from.
868
+ */
869
+ readonly server?: string;
870
+ /**
871
+ * Substitutions for a selected server's URL template, layered over the
872
+ * variable defaults declared in the document. OpenAPI 3.x only, and only for
873
+ * a declared server — an override carries no declared variables.
874
+ */
875
+ readonly serverVariables?: Record<string, string>;
876
+ readonly signal?: AbortSignal;
877
+ readonly requestInterceptor?: RequestInterceptor;
878
+ }
879
+
880
+ /**
881
+ * The execute options forwarded to {@link OpenAPIOperationExecutor.execute}.
882
+ *
883
+ * The {@link OpenAPIOperationExecuteOptions} fields are surfaced for
884
+ * type-checked callers, while the open `Record` tail keeps the bag opaque so
885
+ * the rest of `buildRequest`'s surface (`scheme`, `parameterBuilders`,
886
+ * `attachContentTypeForEmptyPayload`, …) passes through untouched.
887
+ *
888
+ * Nothing routine belongs in the tail. Credentials go through a
889
+ * {@link RequestInterceptor} and `server` covers every case that once needed a
890
+ * `contextUrl`, so reaching for either of those here means an edge case: tests
891
+ * standing in for a document fetched over HTTP, or credentials applied from the
892
+ * document's own security schemes.
893
+ *
894
+ * Two kinds of entry are inert rather than honored, since the executor owns
895
+ * what they used to control. The operation target always comes from the
896
+ * locator, so `operationId`/`operationPath` have no effect; and the options
897
+ * only swagger-client's `execute()` ever read — `userFetch` and
898
+ * `responseInterceptor`, which the runner replaces with `httpClient` and
899
+ * `responseNormalizer` — reach `buildRequest` but nothing acts on them.
900
+ * @public
901
+ */
902
+ export declare type OpenAPIOperationExecuteOptionsBag = OpenAPIOperationExecuteOptions & Record<string, unknown>;
903
+
904
+ /**
905
+ * Executes a single OpenAPI operation named by a canonical
906
+ * {@link OpenAPIOperationLocator}.
907
+ *
908
+ * The pipeline extracts the operation from its owning document, normalizes it,
909
+ * assembles a minimal standalone OpenAPI document containing just that
910
+ * operation, builds the HTTP request with the vendored swagger-client
911
+ * `buildRequest` (parameter serialization, securities, server resolution),
912
+ * sends it through the pluggable {@link HTTPClient}, and normalizes the raw
913
+ * `Response` into the runner's response model. A non-2xx status is a valid
914
+ * outcome (judged by a step's `successCriteria`) and is returned, never
915
+ * thrown; a transport failure is wrapped as a {@link ClientError}.
916
+ *
917
+ * The executor is Arazzo-agnostic: it neither locates the operation (that is
918
+ * the operation locator normalizer's concern) nor resolves parameters or
919
+ * request bodies from runtime expressions (the step executor's concern). It
920
+ * receives an already-resolved locator and an opaque bag of execute options,
921
+ * and returns the normalized operation response carrying the request that was
922
+ * actually sent, so `$url` / `$method` / `$request.*` can be evaluated after
923
+ * execution.
924
+ * @public
925
+ */
926
+ export declare class OpenAPIOperationExecutor {
927
+ #private;
928
+ constructor(options?: OpenAPIOperationExecutorOptions);
929
+ /**
930
+ * Executes the located operation, returning the normalized operation
931
+ * response.
932
+ *
933
+ * `executeOptions` is an opaque bag of `buildRequest` options (e.g. resolved
934
+ * `parameters`, a `requestBody` and its `requestContentType`, or a `server`).
935
+ * The operation target always takes precedence over it: the
936
+ * locator's JSON Pointer selects the operation in the assembled document, so
937
+ * `operationId`/`operationPath` entries in the bag cannot hijack the
938
+ * operation.
939
+ */
940
+ execute(locator: OpenAPIOperationLocator, executeOptions?: OpenAPIOperationExecuteOptionsBag): Promise<OpenAPIOperationResponse>;
941
+ }
942
+
943
+ /**
944
+ * Options for the OpenAPIOperationExecutor.
945
+ * @public
946
+ */
947
+ export declare interface OpenAPIOperationExecutorOptions {
948
+ /**
949
+ * The transport that sends the built request and resolves with the raw
950
+ * WHATWG `Response`. Defaults to {@link httpClientFetch} (global fetch).
951
+ */
952
+ readonly httpClient?: HTTPClient;
953
+ /**
954
+ * Decorates every built request (e.g. an `Authorization` header) before the
955
+ * per-call interceptor from the execute options bag runs.
956
+ */
957
+ readonly requestInterceptor?: RequestInterceptor;
958
+ /**
959
+ * Normalizes the raw `Response` into the runner's response model. Defaults
960
+ * to a fresh {@link OpenAPIOperationResponseNormalizer}.
961
+ */
962
+ readonly responseNormalizer?: OpenAPIOperationResponseNormalizer;
963
+ /**
964
+ * Extracts the operation element from its owning document. Defaults to a
965
+ * fresh {@link OpenAPIOperationExtractor}.
966
+ */
967
+ readonly operationExtractor?: OpenAPIOperationExtractor;
968
+ /**
969
+ * Normalizes the extracted operation (servers, parameters, securities).
970
+ * Defaults to a fresh {@link OpenAPIOperationNormalizer}.
971
+ */
972
+ readonly operationNormalizer?: OpenAPIOperationNormalizer;
973
+ /**
974
+ * Assembles the standalone OpenAPI document for the operation. Defaults to a
975
+ * fresh {@link OpenAPIDocumentAssembler}.
976
+ */
977
+ readonly documentAssembler?: OpenAPIDocumentAssembler;
978
+ }
979
+
980
+ /**
981
+ * Extracts an operation from an OpenAPI document.
982
+ *
983
+ * Locates the operation by operationId or operationPath (JSON Pointer)
984
+ * and attaches metadata (pointer, method, path) to the element.
985
+ * The extracted operation is not dereferenced or normalized.
986
+ * @public
987
+ */
988
+ export declare class OpenAPIOperationExtractor {
989
+ /**
990
+ * Extracts an operation by operationId.
991
+ */
992
+ extract(document: OpenAPIDocument, operationId: OperationId): OpenAPIOperationElement;
993
+ /**
994
+ * Extracts an operation by JSON Pointer (operationPath).
995
+ */
996
+ extractByPointer(document: OpenAPIDocument, pointer: JSONPointer): OpenAPIOperationElement;
997
+ }
998
+
999
+ /**
1000
+ * Index mapping operationId to its JSON Pointer in an OpenAPI document.
1001
+ *
1002
+ * Only used when an Arazzo step references an operation by `operationId`.
1003
+ * When a step uses `operationPath` (a JSON Pointer), the index is bypassed
1004
+ * and the pointer is used directly to locate the operation.
1005
+ *
1006
+ * Only operations with an operationId are indexed; operations without one
1007
+ * are only reachable via `operationPath`.
1008
+ * @public
1009
+ */
1010
+ export declare class OpenAPIOperationIndex extends Map<OperationId, JSONPointer> {
1011
+ }
1012
+
1013
+ /**
1014
+ * A canonical OpenAPI operation locator: the OpenAPI document that owns the
1015
+ * operation and a JSON Pointer locating the operation within it
1016
+ * (`/paths/{path}/{method}`).
1017
+ *
1018
+ * A step names its operation in one of several ways — a plain `operationId`, a
1019
+ * `$sourceDescriptions` runtime expression, or an `operationPath` — which are
1020
+ * all locators for the same thing. The normalizer reduces any of them to this
1021
+ * single canonical form.
1022
+ * @public
1023
+ */
1024
+ export declare interface OpenAPIOperationLocator {
1025
+ readonly document: OpenAPIDocument;
1026
+ readonly jsonPointer: string;
1027
+ }
1028
+
1029
+ /**
1030
+ * Normalizes a step's OpenAPI operation locator to a canonical
1031
+ * {@link OpenAPIOperationLocator} — the OpenAPI document and a JSON Pointer to
1032
+ * the operation within it.
1033
+ *
1034
+ * A step names its operation with either `operationId` or `operationPath`:
1035
+ * - `operationId` is a plain operation name, or a whole runtime expression
1036
+ * `$sourceDescriptions.{name}.{operationId}`. Per the Arazzo Specification, a
1037
+ * plain name is only valid when a single (non-arazzo) source description is
1038
+ * defined; multiple sources require the expression form. A plain name is
1039
+ * therefore resolved against the first source description that has it.
1040
+ * - `operationPath` embeds a `{$sourceDescriptions.{name}.url}` runtime
1041
+ * expression followed by a JSON Pointer to the operation.
1042
+ *
1043
+ * The `type` declared on a source description is not trusted (it may be absent
1044
+ * or wrong); a source is classified by what it actually parses to. The
1045
+ * normalizer acquires the referenced source documents from the registry on
1046
+ * demand.
1047
+ * @public
1048
+ */
1049
+ export declare class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormalizer {
1050
+ #private;
1051
+ /**
1052
+ * Normalizes a plain or expression `operationId` to a canonical locator.
1053
+ *
1054
+ * A whole runtime expression (`$sourceDescriptions.{name}.{operationId}`) is
1055
+ * resolved against its named source; a plain name is resolved against the
1056
+ * first source description that has it.
1057
+ */
1058
+ normalizeOperationId(operationId: string, document: ArazzoDocument): Promise<OpenAPIOperationLocator>;
1059
+ /**
1060
+ * Normalizes an `operationPath` —
1061
+ * `{$sourceDescriptions.{name}.url}#/json/pointer` — to a canonical locator.
1062
+ *
1063
+ * The reference is interpolated (resolving
1064
+ * `{$sourceDescriptions.{name}.url}` to the source's URL) into a URI
1065
+ * reference; its fragment is the JSON Pointer to the operation (decoded from
1066
+ * the URI fragment representation) and the part before the fragment is the
1067
+ * source document to acquire.
1068
+ *
1069
+ * The runner only needs a URL and a JSON Pointer, so it does not enforce that
1070
+ * the source description is identified by a runtime expression rather than a
1071
+ * literal URL (a literal URL interpolates to itself and still resolves) — that
1072
+ * is a conformance concern for the validator. It fails only when the URL does
1073
+ * not resolve to an OpenAPI source or the JSON Pointer is invalid.
1074
+ */
1075
+ normalizeOperationPath(operationPath: string, document: ArazzoDocument): Promise<OpenAPIOperationLocator>;
1076
+ }
1077
+
1078
+ /**
1079
+ * Facade for normalizing OpenAPI operations across all supported versions.
1080
+ *
1081
+ * Detects the OpenAPI version from the document and delegates to the
1082
+ * appropriate version-specific normalizer (2.0, 3.0, or 3.1).
1083
+ *
1084
+ * Custom normalizer instances can be provided via constructor options.
1085
+ * @public
1086
+ */
1087
+ export declare class OpenAPIOperationNormalizer {
1088
+ #private;
1089
+ constructor(options?: OpenAPIOperationNormalizerOptions);
1090
+ /**
1091
+ * Normalizes the operation by delegating to the version-specific normalizer.
1092
+ */
1093
+ normalize(operation: OpenAPIOperationElement, document: OpenAPIDocument): Promise<OpenAPIOperationElement>;
1094
+ }
1095
+
1096
+ /**
1097
+ * Options for the OpenAPI operation normalizer facade.
1098
+ * @public
1099
+ */
1100
+ export declare interface OpenAPIOperationNormalizerOptions {
1101
+ readonly openapi2?: OpenAPI2OperationNormalizer;
1102
+ readonly openapi30?: OpenAPI30OperationNormalizer;
1103
+ readonly openapi31?: OpenAPI31OperationNormalizer;
1104
+ }
1105
+
1106
+ /**
1107
+ * Resolves the `parameters` of a step targeting an OpenAPI operation into the
1108
+ * map the operation is executed with.
1109
+ *
1110
+ * Values follow the family-wide literal-vs-expression rule of
1111
+ * {@link ArazzoValueResolver}. Keys and their first-wins claiming are
1112
+ * `ParameterDelivery`'s: `'{in}.{name}'` for a location the client
1113
+ * can address — a parameter is unique by `(name, in)`, so keying by name
1114
+ * alone would collapse two parameters that differ only in their location into
1115
+ * one entry and silently drop the other, where an operation legally declaring
1116
+ * `token` both as a header and as a query parameter must receive both — and
1117
+ * the bare name for Arazzo's `querystring`, which names no OpenAPI location.
1118
+ * First-wins is the override order the specification requires: the list is
1119
+ * ordered by precedence, most specific first, as `ArazzoWorkflowNormalizer`
1120
+ * leaves it once a step's own parameters have been merged with the ones it
1121
+ * inherits.
1122
+ *
1123
+ * What the map reports, this resolver judges. A parameter without a location
1124
+ * throws {@link ResolverError}: a step targeting an operation requires one
1125
+ * (the normalizer does not inherit input-shaped workflow parameters into such
1126
+ * steps, so this is the step's own authoring error), and delivering it bare
1127
+ * instead would let it capture *every* declared location of that name — see
1128
+ * `ParameterDelivery` for the lookup order that makes it so. A
1129
+ * non-string location throws for the same reason it deduplicates with nothing
1130
+ * in the normalizer: it names no location. And two *different* parameters the
1131
+ * map reports as colliding cannot both be delivered, so a collision throws
1132
+ * rather than silently dropping one — whether they collide on one key (the
1133
+ * scheme is not injective: a `querystring` parameter named `header.token` and
1134
+ * a header parameter named `token` both produce `header.token`) or across a
1135
+ * bare/qualified pair sharing a name (a `querystring` `token` next to a
1136
+ * header `token`), where the client would consult the bare name first and
1137
+ * silently capture the qualified value.
1138
+ * @public
1139
+ */
1140
+ export declare class OpenAPIOperationParameterResolver extends StepParameterResolver {
1141
+ /**
1142
+ * Resolves each parameter's `value`, returning a
1143
+ * `ParameterDelivery`-keyed record. Returns an empty object when
1144
+ * there are no parameters.
1145
+ *
1146
+ * `scope` names the step in a thrown {@link ResolverError}.
1147
+ */
1148
+ resolve(parameters: StepParametersElement | undefined, resolve: RuntimeExpressionResolver, scope: StepScope): Record<string, unknown>;
1149
+ }
1150
+
1151
+ /**
1152
+ * The HTTP request built for an OpenAPI operation.
1153
+ *
1154
+ * Produced by the vendored swagger-client `buildRequest` from the assembled
1155
+ * single-operation document — the URL is fully resolved (server + path +
1156
+ * serialized query string), parameters are serialized per their style/explode
1157
+ * rules, and securities are already applied to headers/query. The object is
1158
+ * intentionally mutable: request interceptors may edit it (or return a
1159
+ * replacement) before it is handed to the {@link HTTPClient}.
1160
+ *
1161
+ * The open tail carries whatever extra fields a builder attaches; the default
1162
+ * transport passes the whole object as fetch init, so standard `RequestInit`
1163
+ * fields (`credentials`, `signal`, …) take effect on the wire.
1164
+ * @public
1165
+ */
1166
+ export declare interface OpenAPIOperationRequest {
1167
+ url: string;
1168
+ method: string;
1169
+ headers: Record<string, string>;
1170
+ body?: unknown;
1171
+ credentials?: RequestCredentials;
1172
+ signal?: AbortSignal;
1173
+ [key: string]: unknown;
1174
+ }
1175
+
1176
+ /**
1177
+ * The HTTP request an OpenAPI operation was executed with.
1178
+ *
1179
+ * An immutable snapshot of the request as actually sent, recorded by the
1180
+ * executor after the interceptors ran and before the transport was called, so
1181
+ * runtime expressions (`$url`, `$method`, `$request.header.*`, `$request.body`)
1182
+ * can be evaluated against it after execution. `headers` is a copy taken at
1183
+ * capture time; `body` shares its reference with the sent request.
1184
+ * @public
1185
+ */
1186
+ export declare interface OpenAPIOperationRequestInfo {
1187
+ readonly url: string;
1188
+ readonly method: string;
1189
+ readonly headers: Record<string, string>;
1190
+ readonly body?: unknown;
1191
+ }
1192
+
1193
+ /**
1194
+ * Response from an OpenAPI operation execution.
1195
+ * @public
1196
+ */
1197
+ export declare class OpenAPIOperationResponse {
1198
+ readonly ok: boolean;
1199
+ readonly url: string;
1200
+ readonly status: number;
1201
+ readonly statusText: string;
1202
+ readonly headers: Record<string, string>;
1203
+ readonly text: string;
1204
+ readonly body: unknown;
1205
+ readonly request: OpenAPIOperationRequestInfo | undefined;
1206
+ constructor(raw: {
1207
+ ok: boolean;
1208
+ url: string;
1209
+ status: number;
1210
+ statusText: string;
1211
+ headers: Record<string, string>;
1212
+ text: string;
1213
+ body: unknown;
1214
+ request?: OpenAPIOperationRequestInfo;
1215
+ });
1216
+ }
1217
+
1218
+ /**
1219
+ * Normalizes a raw WHATWG `Response` into an {@link OpenAPIOperationResponse}.
1220
+ *
1221
+ * Wraps the vendored swagger-client response deserializer (upstream
1222
+ * `serializeRes`, aliased at the vendor boundary), whose battle-tested
1223
+ * content-type dispatch (JSON/XML/YAML/text vs binary) means the response
1224
+ * model runtime expressions and criteria see is defined here, on the runner's
1225
+ * side of the {@link HTTPClient} seam, and stays identical across transports.
1226
+ * Headers are taken from the `Response` directly rather than from the
1227
+ * deserializer, which splits every value containing `", "` into an array:
1228
+ * values stay strings as sent, with repeated fields (`Set-Cookie` included)
1229
+ * combined by `Headers.get`.
1230
+ * @public
1231
+ */
1232
+ export declare class OpenAPIOperationResponseNormalizer {
1233
+ /**
1234
+ * Deserializes the response body by content type and maps the result into the
1235
+ * runner's response model. `request` is the request the operation was
1236
+ * executed with; its `url` doubles as the fallback when the `Response`
1237
+ * carries none (e.g. a stubbed transport).
1238
+ */
1239
+ normalize(response: Response, request?: OpenAPIOperationRequestInfo): Promise<OpenAPIOperationResponse>;
1240
+ }
1241
+
1242
+ /**
1243
+ * Union of PathItemElement across all supported OpenAPI versions.
1244
+ * @public
1245
+ */
1246
+ export declare type OpenAPIPathItemElement = PathItemElement | PathItemElement_2 | PathItemElement_3;
1247
+
1248
+ /**
1249
+ * Unique identifier of an OpenAPI operation.
1250
+ * @public
1251
+ */
1252
+ export declare type OperationId = string;
1253
+
1254
+ /**
1255
+ * Resolves a step's or workflow's `outputs` to a plain map of name → value.
1256
+ *
1257
+ * The spec types `outputs` as `Map[string, {expression}]`, so a whole runtime
1258
+ * expression is the *only* authored form — unlike a parameter's `value` or a
1259
+ * `requestBody` payload (typed `Any`), where {@link ArazzoValueResolver} lets a
1260
+ * literal through. An output that is not a valid runtime expression is an
1261
+ * authoring error and throws a {@link ResolverError}.
1262
+ *
1263
+ * The result is the map an executor stores into the workflow execution state so
1264
+ * later steps can read `$steps.{id}.outputs.{name}` / `$outputs.{name}`.
1265
+ * @public
1266
+ */
1267
+ export declare class OutputResolver extends ArazzoValueResolver {
1268
+ /**
1269
+ * Resolves each output value, returning a `name` → value map. Returns an empty
1270
+ * object when there are no outputs.
1271
+ *
1272
+ * `scope` names the step or workflow the outputs belong to, for a thrown
1273
+ * {@link ResolverError}. An output value that is not a valid runtime
1274
+ * expression throws with `reason: 'invalid-expression'`.
1275
+ */
1276
+ resolve(outputs: StepOutputsElement | WorkflowOutputsElement | undefined, resolve: RuntimeExpressionResolver, scope: ResolverScope): Record<string, unknown>;
1277
+ }
1278
+
1279
+ /**
1280
+ * Evaluates a `regex` Arazzo criterion condition against a resolved context value.
1281
+ *
1282
+ * The Arazzo specification does not pin a regular expression dialect for the
1283
+ * `regex` criterion type. This evaluator uses ECMA-262 (the native `RegExp`
1284
+ * dialect), matching OpenAPI, which pins ECMA-262 for `pattern` via JSON Schema.
1285
+ * The pattern is applied with search (not full-match) semantics — anchoring is
1286
+ * the author's responsibility via `^`/`$`, consistent with the spec's `^200$`
1287
+ * example.
1288
+ *
1289
+ * Per Arazzo 1.1.0, a `null` or `undefined` context fails the condition. A
1290
+ * non-scalar context is serialized with `JSON.stringify` (matching how the
1291
+ * runtime expression evaluator stringifies values for interpolation), so a
1292
+ * pattern can match against an object/array body; scalars are coerced with
1293
+ * `String()`.
1294
+ *
1295
+ * The pattern is a native `RegExp`, which has no execution timeout; a
1296
+ * pathological author pattern (catastrophic backtracking) against a long
1297
+ * context can stall. Patterns originate from the Arazzo document, so this is
1298
+ * treated as trusted input rather than guarded here.
1299
+ * @public
1300
+ */
1301
+ export declare class RegexCriterionEvaluator {
1302
+ #private;
1303
+ /**
1304
+ * Tests the resolved context value against the regular expression `condition`.
1305
+ *
1306
+ * The context is coerced to a string before matching. Returns `false` when the
1307
+ * context is `null` or `undefined`. Throws {@link CriterionError} when the
1308
+ * condition is not a valid regular expression.
1309
+ */
1310
+ evaluate(condition: string, context: unknown): boolean;
1311
+ }
1312
+
1313
+ /**
1314
+ * Resolves a step's `requestBody` to a concrete payload.
1315
+ *
1316
+ * The `payload` is resolved first. Per the specification it "can contain"
1317
+ * runtime expressions, so it is walked: every string in it — the payload
1318
+ * itself, or any value nested in its objects and arrays — that is a whole
1319
+ * runtime expression resolves to its typed value, and every other string has
1320
+ * its embedded `{expression}` occurrences interpolated (tolerantly, so literal
1321
+ * braces such as a JSON template's own are kept). Object keys and resolved
1322
+ * values are never evaluated.
1323
+ *
1324
+ * An unresolved expression reads as "not provided": an object member is
1325
+ * omitted, while a whole-expression payload, an array element or an embedded
1326
+ * expression — none of which can be omitted — throws {@link ResolverError}
1327
+ * (`unresolved-expression`), as does an invalid embedded expression
1328
+ * (`invalid-expression`).
1329
+ *
1330
+ * Then each `replacements` entry is applied — its `value` is resolved by the
1331
+ * family-wide literal-vs-expression rule of {@link ArazzoValueResolver} and set
1332
+ * into the payload at the replacement's `target` JSON Pointer. A replacement
1333
+ * whose value does not resolve is skipped, leaving the payload as authored.
1334
+ *
1335
+ * `target` may be a JSON Pointer or an XPath per the specification; only JSON
1336
+ * Pointer targets are supported — an XPath target throws {@link ResolverError}.
1337
+ * @public
1338
+ */
1339
+ export declare class RequestBodyResolver extends ArazzoValueResolver {
1340
+ #private;
1341
+ /**
1342
+ * Resolves the request body, returning its payload and content type. Returns
1343
+ * `undefined` when there is no request body.
1344
+ *
1345
+ * `scope` names the step in a thrown {@link ResolverError}.
1346
+ */
1347
+ resolve(requestBody: RequestBodyElement | undefined, resolve: RuntimeExpressionResolver, scope: StepScope): ResolvedRequestBody | undefined;
1348
+ }
1349
+
1350
+ /**
1351
+ * Decorates the built request before it is handed to the {@link HTTPClient}.
1352
+ *
1353
+ * Receives the finalized {@link OpenAPIOperationRequest} and may mutate it in
1354
+ * place or return a replacement; returning nothing keeps the received request.
1355
+ * May be synchronous or asynchronous.
1356
+ * @public
1357
+ */
1358
+ export declare type RequestInterceptor = (request: OpenAPIOperationRequest) => OpenAPIOperationRequest | void | Promise<OpenAPIOperationRequest | void>;
1359
+
1360
+ /**
1361
+ * A resolved request body: the payload with all replacements applied, plus the
1362
+ * declared content type when present.
1363
+ * @public
1364
+ */
1365
+ export declare interface ResolvedRequestBody {
1366
+ readonly payload: unknown;
1367
+ readonly contentType?: string;
1368
+ }
1369
+
1370
+ /** @public */
1371
+ export declare class ResolverError extends ArazzoRunnerError {
1372
+ readonly stepId?: string;
1373
+ readonly workflowId?: string;
1374
+ readonly target?: string;
1375
+ readonly reason?: string;
1376
+ }
1377
+
1378
+ /**
1379
+ * Identifies the step or workflow a resolver is resolving for. The wider
1380
+ * union {@link OutputResolver} takes, since it resolves both a step's
1381
+ * `outputs` and a workflow's — the one case with no step to name.
1382
+ * @public
1383
+ */
1384
+ export declare type ResolverScope = StepScope | {
1385
+ readonly workflowId: string;
1386
+ };
1387
+
1388
+ /**
1389
+ * One run of a `retry` action's `stepId` / `workflowId` reference — "the
1390
+ * reference is executed and the context is returned, after which the current
1391
+ * step is retried". Fires once per firing of its action (i.e. once before every
1392
+ * attempt the action grants, not once for the whole retry chain).
1393
+ * @public
1394
+ */
1395
+ export declare interface RetryReferenceRecord {
1396
+ /**
1397
+ * Which field the action carried: `stepId` runs one step of the current
1398
+ * workflow; `workflowId` runs another workflow to completion.
1399
+ */
1400
+ readonly kind: 'step' | 'workflow';
1401
+ /**
1402
+ * The referenced `stepId` or `workflowId`, as written — a cross-document
1403
+ * workflow reference stays in its
1404
+ * `$sourceDescriptions.{name}.{workflowId}` form.
1405
+ */
1406
+ readonly id: string;
1407
+ /**
1408
+ * Whether the reference completed successfully. For `kind: 'workflow'`, this
1409
+ * is whether the referenced run's transfer chain settled `status !== 'failed'`
1410
+ * — a reference to a workflow that transferred is judged by where control
1411
+ * ended up, not by the intermediate `'transferred'` status. Does not gate the
1412
+ * retry: the retry proceeds either way, since the spec speaks of the
1413
+ * reference's *completion*, not its success.
1414
+ */
1415
+ readonly successful: boolean;
1416
+ /**
1417
+ * The nested run, when the reference invoked a workflow — either directly
1418
+ * (`kind: 'workflow'`) or because the referenced step itself targets a
1419
+ * `workflowId` (`kind: 'step'`).
1420
+ */
1421
+ readonly subWorkflow?: WorkflowExecutionResult;
1422
+ }
1423
+
1424
+ /**
1425
+ * Identifies a step that calls a workflow, for the context its criteria,
1426
+ * outputs and actions are evaluated against.
1427
+ * @public
1428
+ */
1429
+ export declare interface RuntimeExpressionCalledWorkflowContext {
1430
+ /**
1431
+ * The id of the calling step, the one whose expressions are evaluated.
1432
+ */
1433
+ readonly stepId: string;
1434
+ /**
1435
+ * The id of the workflow that step called.
1436
+ */
1437
+ readonly workflowId: string;
1438
+ }
1439
+
1440
+ /**
1441
+ * The runtime state an Arazzo runtime expression is evaluated against.
1442
+ *
1443
+ * Each field maps to an AST node produced by the runtime expression parser:
1444
+ * - `request.url` / `request.method` back `$url` / `$method`
1445
+ * - `request.header` / `.query` / `.path` / `.body` back `$request.{source}`
1446
+ * - `response.statusCode` backs `$statusCode`
1447
+ * - `response.header` / `.body` back `$response.{source}`
1448
+ * - `inputs` backs `$inputs.{name}`
1449
+ * - `outputs` backs `$outputs.{name}`
1450
+ * - `steps` backs `$steps.{stepId}.outputs.{name}`
1451
+ * - `workflows` backs `$workflows.{workflowId}.{inputs|outputs}.{name}`
1452
+ * - `calledWorkflow` marks a step that calls a workflow: such a step made no
1453
+ * HTTP call, so `$url`, `$method`, `$statusCode`, `$request.{source}` and
1454
+ * `$response.{source}` are authoring errors there rather than unresolved
1455
+ * references, and `outputs` holds the called workflow's outputs
1456
+ *
1457
+ * The context holds only genuinely runtime state. Static, document-sourced
1458
+ * expressions — `$components.{field}.{name}` and
1459
+ * `$sourceDescriptions.{name}.{reference}` — are resolved on demand by the
1460
+ * evaluator against the document registry, not carried here.
1461
+ *
1462
+ * Payload-bearing values (`request.body`, `response.body`, step/workflow output
1463
+ * values) are drilled through a composed JSON Pointer realm, so they may be
1464
+ * either plain JS values or ApiDOM elements.
1465
+ * @public
1466
+ */
1467
+ export declare interface RuntimeExpressionContext {
1468
+ readonly request?: RuntimeExpressionRequestContext;
1469
+ readonly response?: RuntimeExpressionResponseContext;
1470
+ readonly inputs?: unknown;
1471
+ readonly outputs?: unknown;
1472
+ readonly steps?: Record<string, RuntimeExpressionStepContext>;
1473
+ readonly workflows?: Record<string, RuntimeExpressionWorkflowContext>;
1474
+ readonly calledWorkflow?: RuntimeExpressionCalledWorkflowContext;
1475
+ }
1476
+
1477
+ /** @public */
1478
+ export declare class RuntimeExpressionError extends ArazzoRunnerError {
1479
+ readonly expression?: string;
1480
+ readonly reason?: string;
1481
+ }
1482
+
1483
+ /**
1484
+ * Evaluates Arazzo runtime expressions against a context.
1485
+ *
1486
+ * A single evaluator is bound to one context and can evaluate many expressions
1487
+ * against it — matching how a step executor resolves a step's parameters,
1488
+ * success criteria, and outputs from the same state.
1489
+ *
1490
+ * The context holds only runtime state (`$inputs`, `$steps`, `$request`,
1491
+ * `$response`, …). Static, document-sourced expressions are resolved on demand:
1492
+ * `$components` and `$workflows.{workflowId}.steps.{stepId}` from the
1493
+ * evaluator's document, and `$sourceDescriptions` from the external document
1494
+ * (via the registry) the source name points at. A step reference resolves to
1495
+ * the Step Object as authored — a locator, not the step's execution result.
1496
+ *
1497
+ * A reference resolves to `undefined` when it is absent. Runtime values
1498
+ * originate from JSON (or ApiDOM), which cannot represent `undefined` — an
1499
+ * absent value is a missing property and an explicit null is `null` — so
1500
+ * `undefined` unambiguously marks "unresolved".
1501
+ *
1502
+ * Three modes are supported:
1503
+ * - {@link RuntimeExpressionEvaluator.evaluate} resolves a pure expression
1504
+ * (e.g. `$response.body#/id`) to its typed value.
1505
+ * - {@link RuntimeExpressionEvaluator.interpolate} renders a template with
1506
+ * embedded `{expression}` occurrences to a string.
1507
+ * - {@link RuntimeExpressionEvaluator.resolve} applies Arazzo "value" semantics:
1508
+ * a value that is itself a complete expression resolves to a typed value,
1509
+ * otherwise the value is interpolated to a string.
1510
+ * @public
1511
+ */
1512
+ export declare class RuntimeExpressionEvaluator {
1513
+ #private;
1514
+ constructor(context: RuntimeExpressionContext, options?: RuntimeExpressionEvaluatorOptions);
1515
+ /**
1516
+ * Evaluates a pure runtime expression to its typed value.
1517
+ *
1518
+ * The expression must be the bare form without surrounding braces
1519
+ * (e.g. `$inputs.username`, `$response.body#/pets/0/id`). In strict mode an
1520
+ * unresolvable reference throws; otherwise it returns `undefined`.
1521
+ */
1522
+ evaluate(expression: string): unknown;
1523
+ /**
1524
+ * Renders a template string, replacing each embedded `{expression}` with the
1525
+ * string form of its evaluated value. Returns a string.
1526
+ *
1527
+ * Object and array values are serialized with `JSON.stringify`. In non-strict
1528
+ * mode, unresolvable references render as an empty string. A `{…}` that is not
1529
+ * a valid embedded expression (e.g. a literal JSON payload) is left unchanged.
1530
+ */
1531
+ interpolate(template: string): string;
1532
+ /**
1533
+ * Resolves an Arazzo "value" string.
1534
+ *
1535
+ * A value that is itself a complete runtime expression (the unbraced form,
1536
+ * e.g. `$inputs.userId`) resolves to its typed value — "runtime expressions
1537
+ * preserve the type of the referenced value". Any other string is an
1538
+ * expression-string template: embedded `{expression}` occurrences are
1539
+ * interpolated and a string is returned, so a whole-string `{expression}`
1540
+ * yields the string representation of its value, not the typed value. A
1541
+ * string containing no expressions is returned unchanged.
1542
+ */
1543
+ resolve(value: string): unknown;
1544
+ }
1545
+
1546
+ /**
1547
+ * Options for the RuntimeExpressionEvaluator.
1548
+ * @public
1549
+ */
1550
+ export declare interface RuntimeExpressionEvaluatorOptions {
1551
+ /**
1552
+ * When `true` (default), an unresolvable reference throws a
1553
+ * RuntimeExpressionError. When `false`, unresolvable references evaluate to
1554
+ * `undefined`. Parse failures always throw regardless of this setting.
1555
+ */
1556
+ readonly strict?: boolean;
1557
+ /**
1558
+ * The Arazzo document the expression is evaluated within. Required to resolve
1559
+ * `$components.{field}.{name}` and `$workflows.{workflowId}.steps.{stepId}`
1560
+ * (both read from this document) and `$sourceDescriptions.{name}.{reference}`
1561
+ * (whose source name is resolved against this document). Absent references
1562
+ * resolve to `undefined`.
1563
+ */
1564
+ readonly document?: ArazzoDocument;
1565
+ /**
1566
+ * The document registry, used to reach the external document a
1567
+ * `$sourceDescriptions` reference points at. The referenced document must
1568
+ * already be loaded — resolution is synchronous and never triggers a fetch.
1569
+ */
1570
+ readonly registry?: DocumentRegistry;
1571
+ }
1572
+
1573
+ /**
1574
+ * Request-side data available to runtime expressions.
1575
+ *
1576
+ * Populated by the step executor from the HTTP request that was (or will be) sent.
1577
+ * Header lookup is case-insensitive because the runtime expression parser
1578
+ * lowercases header tokens.
1579
+ * @public
1580
+ */
1581
+ export declare interface RuntimeExpressionRequestContext {
1582
+ readonly url?: string;
1583
+ readonly method?: string;
1584
+ readonly header?: Record<string, unknown>;
1585
+ readonly query?: Record<string, unknown>;
1586
+ readonly path?: Record<string, unknown>;
1587
+ readonly body?: unknown;
1588
+ }
1589
+
1590
+ /**
1591
+ * Resolves a runtime expression to its value.
1592
+ *
1593
+ * Bridged to a lenient runtime expression evaluator
1594
+ * (`(expression) => runtimeExpressionEvaluator.evaluate(expression)`), so an
1595
+ * unresolvable reference yields `undefined` rather than throwing.
1596
+ * @public
1597
+ */
1598
+ export declare type RuntimeExpressionResolver = (expression: string) => unknown;
1599
+
1600
+ /**
1601
+ * Response-side data available to runtime expressions.
1602
+ *
1603
+ * Populated by the step executor from the HTTP response that was received.
1604
+ * Header lookup is case-insensitive because the runtime expression parser
1605
+ * lowercases header tokens.
1606
+ * @public
1607
+ */
1608
+ export declare interface RuntimeExpressionResponseContext {
1609
+ readonly statusCode?: number;
1610
+ readonly header?: Record<string, unknown>;
1611
+ readonly body?: unknown;
1612
+ }
1613
+
1614
+ /**
1615
+ * Per-step state available to `$steps.{stepId}.outputs.{name}` expressions.
1616
+ * @public
1617
+ */
1618
+ export declare interface RuntimeExpressionStepContext {
1619
+ readonly outputs?: Record<string, unknown>;
1620
+ }
1621
+
1622
+ /**
1623
+ * Per-workflow state available to `$workflows.{workflowId}.{inputs|outputs}.{name}` expressions.
1624
+ * @public
1625
+ */
1626
+ export declare interface RuntimeExpressionWorkflowContext {
1627
+ readonly inputs?: Record<string, unknown>;
1628
+ readonly outputs?: Record<string, unknown>;
1629
+ }
1630
+
1631
+ /**
1632
+ * The action selected for a step outcome — a Success or Failure Action element.
1633
+ * @public
1634
+ */
1635
+ export declare type SelectedAction = SuccessActionElement | FailureActionElement;
1636
+
1637
+ /**
1638
+ * The result a transfer chain settled on: `result` itself when its `status`
1639
+ * isn't `'transferred'`, otherwise the terminal, non-`'transferred'` result at
1640
+ * the end of its `transferredTo` chain.
1641
+ *
1642
+ * For the success/failure verdict alone, prefer
1643
+ * {@link WorkflowExecutionResult.settledStatus} — every result already
1644
+ * carries it, computed eagerly, so no call is needed. Reach for this function
1645
+ * when the terminal result *itself* is wanted (its `outputs`, `steps`,
1646
+ * `workflowId`), not just where it landed. Iterative, not recursive: a
1647
+ * chain's length is bounded only by `maxWorkflowDepth`, and this must not add
1648
+ * a matching bound on call-stack depth.
1649
+ * @public
1650
+ */
1651
+ export declare function settledResult(result: WorkflowExecutionResult): WorkflowExecutionResult;
1652
+
1653
+ /**
1654
+ * Evaluates a `simple` Arazzo criterion condition.
1655
+ *
1656
+ * A simple condition embeds runtime expressions directly in the condition
1657
+ * (e.g. `$statusCode == 200 && $response.body.status == 'available'`), so —
1658
+ * unlike `regex`/`jsonpath`/`xpath` — it has no separate `context`. Parsing,
1659
+ * loose/case-insensitive comparison, and member/index navigation are delegated
1660
+ * to `@swaggerexpert/arazzo-criterion`; each embedded runtime expression is
1661
+ * resolved through the supplied resolver.
1662
+ *
1663
+ * An operand that resolves to `undefined` (a lenient miss) does not throw; it is
1664
+ * compared per the library's rules (e.g. `undefined == x` and relational
1665
+ * comparisons are false, matching the spec's "null equals only null"), so a
1666
+ * negated or disjunctive condition may still pass. A malformed condition throws
1667
+ * {@link CriterionError}.
1668
+ * @public
1669
+ */
1670
+ export declare class SimpleCriterionEvaluator {
1671
+ /**
1672
+ * Evaluates the simple `condition`, resolving each embedded runtime
1673
+ * expression via `resolve`.
1674
+ */
1675
+ evaluate(condition: string, resolve: CriterionContextResolver): boolean;
1676
+ }
1677
+
1678
+ /**
1679
+ * One indexed source description: the parsed element and its canonical URI —
1680
+ * already resolved against the owning document's base URI, in the exact form
1681
+ * the document registry keys on — or `undefined` for a source with no
1682
+ * resolvable `url`.
1683
+ * @public
1684
+ */
1685
+ export declare interface SourceDescriptionEntry {
1686
+ readonly element: SourceDescriptionElement;
1687
+ readonly uri: string | undefined;
1688
+ }
1689
+
1690
+ /**
1691
+ * Unique name of a source description within an Arazzo document.
1692
+ * @public
1693
+ */
1694
+ export declare type SourceDescriptionName = string;
1695
+
1696
+ /**
1697
+ * Base of the locator normalizers that resolve
1698
+ * `$sourceDescriptions.{name}.{reference}` runtime expressions — the OpenAPI
1699
+ * operation locator and the Arazzo workflow locator. Owns the registry handle
1700
+ * and the one grammar-facing parse, so the expression node's name and field
1701
+ * shape are encoded once rather than per subclass.
1702
+ * @public
1703
+ */
1704
+ export declare abstract class SourceDescriptionsLocatorNormalizer {
1705
+ protected readonly registry: DocumentRegistry;
1706
+ constructor(registry: DocumentRegistry);
1707
+ /**
1708
+ * Parses a `$sourceDescriptions.{name}.{reference}` expression, or returns
1709
+ * `undefined` when the string is not one (whether it fails to parse or
1710
+ * parses to another expression kind) — each subclass raises its own error
1711
+ * type, message, and context for its own position.
1712
+ */
1713
+ protected parseSourceDescriptionsExpression(expression: string): {
1714
+ sourceName: string;
1715
+ reference: string;
1716
+ } | undefined;
1717
+ }
1718
+
1719
+ /**
1720
+ * The outcome of executing a single step.
1721
+ * @public
1722
+ */
1723
+ export declare interface StepExecutionResult {
1724
+ readonly stepId: string;
1725
+ readonly response: OpenAPIOperationResponse;
1726
+ readonly successful: boolean;
1727
+ readonly outputs: Record<string, unknown>;
1728
+ /**
1729
+ * The action to take for this outcome — the first of {@link StepExecutionResult.matchedActions},
1730
+ * or `undefined` when none matched (the caller then applies the path default).
1731
+ */
1732
+ readonly action: SelectedAction | undefined;
1733
+ /**
1734
+ * Every `onSuccess` / `onFailure` action whose criteria matched this outcome,
1735
+ * in list order. Usually the caller acts on `action` (the first); the workflow
1736
+ * executor walks the full list to honor "retryLimit exhausted prior to
1737
+ * subsequent failure actions" — falling from an exhausted `retry` to the next
1738
+ * matching action. Empty when none matched.
1739
+ */
1740
+ readonly matchedActions: readonly SelectedAction[];
1741
+ }
1742
+
1743
+ /**
1744
+ * Executes a single Arazzo step that invokes an OpenAPI operation.
1745
+ *
1746
+ * The pipeline locates the step's operation (`operationId` / `operationPath`),
1747
+ * resolves the step's parameters and request body against the pre-request
1748
+ * context, delegates to {@link OpenAPIOperationExecutor} to run the located
1749
+ * operation, then evaluates `successCriteria`, resolves `outputs`, and selects
1750
+ * the `onSuccess`/`onFailure` action against the post-request context.
1751
+ *
1752
+ * It reads run state through a {@link ContextSource} and mutates nothing — the
1753
+ * caller records the returned outputs and interprets the returned action. A step
1754
+ * targeting a `workflowId` (a sub-workflow) is not an operation step and throws
1755
+ * {@link ExecutionError}; running sub-workflows is the workflow executor's
1756
+ * concern. A received response with unmet criteria is a normal
1757
+ * `successful: false` outcome; malformed input (e.g. an invalid criterion or
1758
+ * expression) throws, as does a run the caller has cancelled through an
1759
+ * `AbortSignal` in the execute options.
1760
+ * @public
1761
+ */
1762
+ export declare class StepExecutor {
1763
+ #private;
1764
+ constructor(options: StepExecutorOptions);
1765
+ /**
1766
+ * A step executor bound to the given document, sharing this one's registry
1767
+ * and operation executor — this instance itself when the document is
1768
+ * already the one it is bound to.
1769
+ *
1770
+ * A step executor's identity includes the document its steps belong to: a
1771
+ * plain `operationId` resolves against *that* document's source
1772
+ * descriptions, and `$components` / `$sourceDescriptions` expressions
1773
+ * resolve against it too. A cross-document workflow run therefore derives
1774
+ * a sibling per foreign document rather than re-pointing this one.
1775
+ */
1776
+ forDocument(document: ArazzoDocument): StepExecutor;
1777
+ /**
1778
+ * Executes the step against the given run state, returning its outcome.
1779
+ *
1780
+ * `executeOptions` is an opaque bag passed through to the operation executor
1781
+ * (e.g. a `server` to run the step against, or an `AbortSignal`). The
1782
+ * Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
1783
+ * take precedence over it.
1784
+ *
1785
+ * A `signal` in that bag is honored here and not only at the transport: an
1786
+ * already-aborted signal throws `reason: 'aborted'` instead of issuing a
1787
+ * request nobody is waiting for, whose wire-level cancellation would surface
1788
+ * as a transport {@link ClientError} — a request that failed on its own terms
1789
+ * — rather than as the withdrawal it is.
1790
+ */
1791
+ execute(step: StepElement, state: ContextSource, executeOptions?: Record<string, unknown>): Promise<StepExecutionResult>;
1792
+ /**
1793
+ * Evaluates the step's `successCriteria`; all criteria must pass. A step with
1794
+ * no criteria succeeds on a received response.
1795
+ *
1796
+ * Public for the same reason as {@link StepExecutor.selectActions}: a step
1797
+ * targeting a `workflowId` is run by the workflow executor and never reaches
1798
+ * {@link StepExecutor.execute}, but its criteria are still the author's
1799
+ * assertion about the step and must be evaluated somewhere.
1800
+ */
1801
+ evaluateCriteria(step: StepElement, context: RuntimeExpressionContext): boolean;
1802
+ /**
1803
+ * Selects every matching `onSuccess` / `onFailure` action for the outcome, in
1804
+ * list order, gating each action's criteria against the context.
1805
+ *
1806
+ * The step's own list is the whole story here: a step that declares none of
1807
+ * its own already carries the workflow-level defaults, inherited by
1808
+ * {@link ArazzoWorkflowNormalizer} — the same place a step's inherited
1809
+ * `parameters` come from — so there is no fallback left to apply at selection
1810
+ * time.
1811
+ *
1812
+ * The full matching list (not just the first) is returned so the caller can
1813
+ * honor "retryLimit exhausted prior to subsequent failure actions"; the common
1814
+ * caller simply takes the first.
1815
+ *
1816
+ * Public because selecting a step's actions is meaningful beyond running one:
1817
+ * the workflow executor selects them for a step targeting a `workflowId`, which
1818
+ * it runs itself and which therefore never reaches
1819
+ * {@link StepExecutor.execute}. Both callers reach the criteria evaluator and
1820
+ * the expression context through this one method rather than wiring their own.
1821
+ */
1822
+ selectActions(step: StepElement, successful: boolean, context: RuntimeExpressionContext): SelectedAction[];
1823
+ }
1824
+
1825
+ /**
1826
+ * Options for the StepExecutor.
1827
+ * @public
1828
+ */
1829
+ export declare interface StepExecutorOptions {
1830
+ /**
1831
+ * The Arazzo document the steps belong to — typically the entry document;
1832
+ * used to resolve each step's operation locator against its source
1833
+ * descriptions, and to resolve `$components` / `$sourceDescriptions` in
1834
+ * expressions. For a step of a workflow in another document, derive a
1835
+ * sibling executor with {@link StepExecutor.forDocument}.
1836
+ */
1837
+ readonly document: ArazzoDocument;
1838
+ /**
1839
+ * The document registry holding the already-loaded source documents.
1840
+ */
1841
+ readonly registry: DocumentRegistry;
1842
+ /**
1843
+ * The operation engine each step's located operation is delegated to. Build it
1844
+ * with the client factory (or a deterministic stub in tests) and pass it in —
1845
+ * the step executor is agnostic to how the operation reaches the live API.
1846
+ */
1847
+ readonly operationExecutor: OpenAPIOperationExecutor;
1848
+ }
1849
+
1850
+ /**
1851
+ * Unique identifier of a step within an Arazzo workflow.
1852
+ * @public
1853
+ */
1854
+ export declare type StepId = string;
1855
+
1856
+ /**
1857
+ * Resolves a step's `parameters` to a plain map of resolved values.
1858
+ *
1859
+ * What a parameter's `value` means is the family-wide rule of
1860
+ * {@link ArazzoValueResolver}; how the resolved values are *keyed* is the subclass's
1861
+ * policy, one per step target — {@link OpenAPIOperationParameterResolver} keys
1862
+ * request delivery for a step targeting an operation,
1863
+ * {@link WorkflowParameterResolver} keys a sub-workflow's inputs for a step
1864
+ * targeting a `workflowId`. Each executor constructs the one resolver its kind
1865
+ * of step calls for.
1866
+ * @public
1867
+ */
1868
+ export declare abstract class StepParameterResolver extends ArazzoValueResolver {
1869
+ /**
1870
+ * Resolves each parameter's `value`, returning the map keyed by the
1871
+ * subclass's policy. Returns an empty object when there are no parameters.
1872
+ *
1873
+ * `scope` names the step these parameters belong to, so a thrown
1874
+ * {@link ResolverError} can say which step it came from — the caller always
1875
+ * has it, the same way {@link ActionResolver.resolveOnSuccess} is handed
1876
+ * `scope`.
1877
+ */
1878
+ abstract resolve(parameters: StepParametersElement | undefined, resolve: RuntimeExpressionResolver, scope: StepScope): Record<string, unknown>;
1879
+ }
1880
+
1881
+ /**
1882
+ * The trace of a single step execution within a workflow run.
1883
+ * @public
1884
+ */
1885
+ export declare interface StepRunRecord {
1886
+ readonly stepId: string;
1887
+ readonly successful: boolean;
1888
+ readonly action: SelectedAction | undefined;
1889
+ /**
1890
+ * How many times the step ran — 1 with no retries, more when a `retry` action
1891
+ * fired. The final `successful` / `action` reflect the last attempt.
1892
+ */
1893
+ readonly attempts: number;
1894
+ /**
1895
+ * Elapsed time the step took, covering every attempt and the `retryAfter`
1896
+ * waits between them. Measured on a monotonic clock by default, so it may be
1897
+ * fractional and is unaffected by system clock changes.
1898
+ */
1899
+ readonly durationMs: number;
1900
+ /**
1901
+ * The sub-workflow runs this step produced, in attempt order — present only on
1902
+ * a step targeting a `workflowId`.
1903
+ *
1904
+ * A list rather than a single result because a retried sub-workflow step runs
1905
+ * its sub-workflow once per attempt, and each run is a trace of its own; the
1906
+ * last entry is the run this record's `successful` / `action` describe.
1907
+ */
1908
+ readonly subWorkflows?: readonly WorkflowExecutionResult[];
1909
+ /**
1910
+ * The `retry` reference runs this step's attempts produced, in firing order —
1911
+ * present only when a `retry` failure action that fired carried a `stepId` /
1912
+ * `workflowId` reference. Kept separate from {@link StepRunRecord.subWorkflows}
1913
+ * because a reference is a repair the *retry* invokes, not the step's own
1914
+ * target.
1915
+ */
1916
+ readonly retryReferences?: readonly RetryReferenceRecord[];
1917
+ }
1918
+
1919
+ /**
1920
+ * Identifies the step a resolver is resolving for, so a thrown
1921
+ * {@link ResolverError} can say which one it came from. Every resolver that
1922
+ * only ever runs within a step's scope — {@link OpenAPIOperationParameterResolver},
1923
+ * {@link WorkflowParameterResolver}, {@link RequestBodyResolver},
1924
+ * {@link ActionResolver} — takes this.
1925
+ * @public
1926
+ */
1927
+ export declare interface StepScope {
1928
+ readonly stepId: string;
1929
+ }
1930
+
1931
+ /** @public */
1932
+ export declare class UnmatchedProviderError extends ArazzoRunnerError {
1933
+ readonly uri?: string;
1934
+ }
1935
+
1936
+ /**
1937
+ * Per-call options for {@link WorkflowExecutor.execute}.
1938
+ * @public
1939
+ */
1940
+ export declare interface WorkflowExecuteOptions {
1941
+ /**
1942
+ * The workflow's inputs, read via `$inputs`.
1943
+ */
1944
+ readonly inputs?: Record<string, unknown>;
1945
+ /**
1946
+ * The opaque client-specific bag forwarded verbatim to every
1947
+ * {@link StepExecutor.execute} (e.g. a `server` to run against).
1948
+ */
1949
+ readonly executeOptions?: Record<string, unknown>;
1950
+ /**
1951
+ * Inputs for the workflows run implicitly to satisfy `dependsOn`, keyed by
1952
+ * the `dependsOn` entry as written — the bare workflowId for a
1953
+ * same-document dependency, the whole
1954
+ * `$sourceDescriptions.{name}.{workflowId}` expression for a
1955
+ * cross-document one; consulted for transitive dependencies too. A
1956
+ * dependency with no entry runs with no inputs.
1957
+ *
1958
+ * The Arazzo Specification gives `dependsOn` no input-mapping mechanism of its
1959
+ * own (unlike a sub-workflow *step*, which maps inputs through its
1960
+ * `parameters`), so this is the only channel by which a dependency that
1961
+ * requires inputs can receive them.
1962
+ */
1963
+ readonly dependencyInputs?: Record<string, Record<string, unknown>>;
1964
+ /**
1965
+ * Whether to run the workflows named by `dependsOn` before the workflow's own
1966
+ * steps. Defaults to `true`.
1967
+ *
1968
+ * Pass `false` to assert the dependencies were already satisfied out-of-band —
1969
+ * "MUST be completed before" does not mean *completed by this engine in this
1970
+ * run*, and re-running them may duplicate side effects. Opting out records no
1971
+ * `$workflows.{dependencyId}.outputs`, so expressions reading a dependency's
1972
+ * outputs then resolve to `undefined`.
1973
+ *
1974
+ * It applies to **the workflow named in this call only**. A sub-workflow it
1975
+ * calls still runs its own prerequisites: those are an implementation detail
1976
+ * the caller may not know exists, so skipping them on their behalf would run
1977
+ * that workflow against state nobody claimed to have prepared.
1978
+ */
1979
+ readonly runDependencies?: boolean;
1980
+ /**
1981
+ * Cancels the run. Observed before every step attempt — including each retry,
1982
+ * each sub-workflow step, and each `dependsOn` prerequisite — and during the
1983
+ * `retryAfter` waits between attempts, so an aborted run stops at the next
1984
+ * boundary rather than working its way to the end of the workflow.
1985
+ *
1986
+ * An aborted run throws {@link ExecutionError} with `reason: 'aborted'`,
1987
+ * naming the boundary it stopped at and carrying the signal's own `reason` as
1988
+ * the error's `cause`. It does not resolve as a `failed` result: cancellation
1989
+ * is not something the steps did, and the steps that never ran were not
1990
+ * decided against.
1991
+ *
1992
+ * The signal is also forwarded to the transport (through the same
1993
+ * `executeOptions` bag it may be passed in), so the request in flight when the
1994
+ * abort lands is cancelled rather than merely awaited. A `signal` passed in
1995
+ * that bag instead is observed here too — it cancels the run just as this
1996
+ * option does — and this option wins when both are given.
1997
+ */
1998
+ readonly signal?: AbortSignal;
1999
+ }
2000
+
2001
+ /**
2002
+ * The outcome of executing a workflow.
2003
+ *
2004
+ * `status` is `completed` when the steps ran to the end of the list, `ended`
2005
+ * when an `end` action stopped the run early, `failed` when a step failed and no
2006
+ * matching `onFailure` action redirected it (the break-and-return default) — or
2007
+ * when a `dependsOn` workflow did not complete — and `transferred` when a `goto`
2008
+ * action handed control one-way to another workflow: this run's own steps stop
2009
+ * at that point, and its `outputs` declaration is never evaluated, since the run
2010
+ * never reaches its own end. See {@link WorkflowExecutionResult.settledStatus}
2011
+ * for the success/failure verdict a `'transferred'` result defers to.
2012
+ * @public
2013
+ */
2014
+ export declare interface WorkflowExecutionResult {
2015
+ readonly workflowId: string;
2016
+ readonly outputs: Record<string, unknown>;
2017
+ readonly steps: readonly StepRunRecord[];
2018
+ readonly status: 'completed' | 'ended' | 'failed' | 'transferred';
2019
+ /**
2020
+ * Where this run's outcome actually settled: `status` itself when it isn't
2021
+ * `'transferred'`, otherwise the terminal, non-`'transferred'` status at the
2022
+ * end of the {@link WorkflowExecutionResult.transferredTo} chain — computed
2023
+ * once, eagerly, when this result is built, so it costs nothing to read and
2024
+ * nothing to forget.
2025
+ *
2026
+ * `status` alone is not a success/failure verdict: `'transferred'` records
2027
+ * *where* control went, not whether the run succeeded, so comparing it
2028
+ * directly against `'failed'` — the natural thing to write — silently
2029
+ * misses a failure buried in the chain. `settledStatus` is that comparison,
2030
+ * already made, always present (even when `status` isn't `'transferred'`,
2031
+ * where it simply repeats `status`): prefer
2032
+ * `result.settledStatus === 'failed'` over `result.status === 'failed'`
2033
+ * for "did this run succeed", including on the top-level result
2034
+ * {@link WorkflowExecutor.execute} itself returns.
2035
+ */
2036
+ readonly settledStatus: 'completed' | 'ended' | 'failed';
2037
+ /**
2038
+ * Elapsed time the run took, including its dependencies, sub-workflows, and
2039
+ * retry waits — and, for a `'transferred'` run, the whole chain nested
2040
+ * under {@link WorkflowExecutionResult.transferredTo}, since running the
2041
+ * target is what this run's own time was spent on. Measured on a monotonic
2042
+ * clock by default, so it may be fractional and is unaffected by system
2043
+ * clock changes.
2044
+ */
2045
+ readonly durationMs: number;
2046
+ /**
2047
+ * The runs of the workflows named by `dependsOn`, in declaration order —
2048
+ * present only when the workflow declares dependencies and they were run.
2049
+ *
2050
+ * A dependency already completed earlier in the same run is not run again; its
2051
+ * one result is reported here for each dependent that declares it.
2052
+ */
2053
+ readonly dependencies?: readonly WorkflowExecutionResult[];
2054
+ /**
2055
+ * The target workflow's own run, present only when `status` is `transferred`.
2056
+ *
2057
+ * Nested rather than spliced in, like {@link WorkflowExecutionResult.dependencies}
2058
+ * — this run's `workflowId` stays the workflow that was called, not the one
2059
+ * control ended up in. If the target itself transfers onward, the chain is
2060
+ * reachable by following `transferredTo.transferredTo`, recursively; its own
2061
+ * `outputs` are the only place the transfer's actual output values live, since
2062
+ * this run's top-level `outputs` is always `{}`.
2063
+ */
2064
+ readonly transferredTo?: WorkflowExecutionResult;
2065
+ }
2066
+
2067
+ /**
2068
+ * Accumulates the runtime state of a workflow run and produces the context a
2069
+ * runtime expression is evaluated against.
2070
+ *
2071
+ * It holds only workflow-scoped state that grows as the run proceeds and is read
2072
+ * back through `$`-expressions: `$inputs`, `$steps.{id}.outputs`,
2073
+ * `$workflows.{id}.{inputs,outputs}`, and the workflow's own `$outputs`. Static,
2074
+ * document-sourced expressions (`$components`, `$sourceDescriptions`) are
2075
+ * resolved on demand by the evaluator and are not stored here; control-flow
2076
+ * position, retries, and traces belong to the executor, not to this state.
2077
+ *
2078
+ * Resolving a step's `outputs` declaration to values is the executor's job; the
2079
+ * resolved values are handed here as plain objects, keeping this state free of
2080
+ * ApiDOM and evaluation concerns. The step-scoped request/response of the
2081
+ * current step are layered on at read time via {@link WorkflowExecutionState.toContext}.
2082
+ * @public
2083
+ */
2084
+ export declare class WorkflowExecutionState {
2085
+ #private;
2086
+ constructor(options?: WorkflowExecutionStateOptions);
2087
+ /**
2088
+ * Records the resolved outputs of a completed step, read via
2089
+ * `$steps.{stepId}.outputs.{name}`.
2090
+ */
2091
+ setStepOutputs(stepId: string, outputs: Record<string, unknown>): void;
2092
+ /**
2093
+ * Sets a single workflow output, read via `$outputs.{name}`.
2094
+ */
2095
+ setOutput(name: string, value: unknown): void;
2096
+ /**
2097
+ * Records the resolved inputs and outputs of a workflow (typically a called
2098
+ * sub-workflow), read via `$workflows.{workflowId}.{inputs,outputs}.{name}`.
2099
+ */
2100
+ setWorkflow(workflowId: string, workflow: {
2101
+ inputs?: Record<string, unknown>;
2102
+ outputs?: Record<string, unknown>;
2103
+ }): void;
2104
+ /**
2105
+ * The workflow's own accumulated outputs. Read-only by contract, like the
2106
+ * context produced by `toContext`; treat the returned object as immutable.
2107
+ */
2108
+ get outputs(): Readonly<Record<string, unknown>>;
2109
+ /**
2110
+ * The inputs/outputs already recorded for `workflowId`, or `undefined` if
2111
+ * none has been recorded yet. A narrow read of a single entry, for a caller
2112
+ * that needs one without reconstructing the whole context via `toContext`.
2113
+ */
2114
+ getWorkflow(workflowId: string): Readonly<{
2115
+ inputs?: Record<string, unknown>;
2116
+ outputs?: Record<string, unknown>;
2117
+ }> | undefined;
2118
+ /**
2119
+ * Produces the runtime expression context for the current evaluation site.
2120
+ *
2121
+ * The accumulated workflow-scoped state is combined with the optional
2122
+ * step-scoped `request`/`response` of the step being evaluated. Omit both when
2123
+ * evaluating before a request is made (e.g. resolving parameters), so that
2124
+ * `$request`/`$response`/`$statusCode` correctly resolve to `undefined`.
2125
+ */
2126
+ toContext(request?: RuntimeExpressionRequestContext, response?: RuntimeExpressionResponseContext): RuntimeExpressionContext;
2127
+ }
2128
+
2129
+ /**
2130
+ * Options for the WorkflowExecutionState.
2131
+ * @public
2132
+ */
2133
+ export declare interface WorkflowExecutionStateOptions {
2134
+ /**
2135
+ * The workflow inputs, fixed for the run and read via `$inputs`.
2136
+ */
2137
+ readonly inputs?: Record<string, unknown>;
2138
+ }
2139
+
2140
+ /**
2141
+ * Executes an Arazzo workflow: the stateful loop that turns "run one step" into
2142
+ * "run a workflow".
2143
+ *
2144
+ * It iterates a workflow's steps in list order, delegating each to
2145
+ * {@link StepExecutor}, records the resolved step outputs into a
2146
+ * {@link WorkflowExecutionState} so later steps read `$steps.{id}.outputs.{name}`,
2147
+ * and interprets the {@link SelectedAction} the step executor selects but does
2148
+ * not act on — advancing to the next step, jumping via `goto`, transferring
2149
+ * one-way to another workflow via a `goto` naming a `workflowId`, or stopping on
2150
+ * `end` / the failure break-default. After the loop it resolves the workflow's
2151
+ * `outputs` against the final state — unless the run transferred, in which case
2152
+ * it never reaches its own end and `outputs` stays `{}`.
2153
+ *
2154
+ * A step targeting a `workflowId` is a sub-workflow call the executor runs
2155
+ * itself, recursively; the workflows named by `dependsOn` are run to completion
2156
+ * before the workflow's own steps. Both recurse through one call tree, guarded
2157
+ * by a shared step budget, a nesting-depth ceiling, and cycle detection. A
2158
+ * `goto`'s transfer joins the same call tree, entered via `'goto'`, but is not
2159
+ * charged against the step budget: it fires once per step evaluation, unlike a
2160
+ * retry reference, which can fire repeatedly from the same frame.
2161
+ *
2162
+ * State is created fresh per {@link WorkflowExecutor.execute} call — and per
2163
+ * workflow invocation within it — and owned here; the returned result is
2164
+ * read-only. Authoring errors (missing workflow, unknown `goto` target, a cycle,
2165
+ * budget overflow) throw {@link ExecutionError}, as does a run the caller
2166
+ * cancels through {@link WorkflowExecuteOptions.signal}; a step that
2167
+ * legitimately fails and breaks, or a dependency that fails, is a normal
2168
+ * `status: 'failed'` result, not a throw — the same split {@link StepExecutor}
2169
+ * draws.
2170
+ *
2171
+ * A workflow reference — a sub-workflow step's `workflowId`, a `dependsOn`
2172
+ * entry, a `retry` action's reference, a `goto`'s transfer — may also name a
2173
+ * workflow of another Arazzo document, as
2174
+ * `$sourceDescriptions.{name}.{workflowId}`. The run then follows that
2175
+ * document for the foreign workflow: its id lookups, its steps' operations,
2176
+ * and its expressions all resolve against the document that owns it, while
2177
+ * the `$workflows.{workflowId}` run state stays keyed by the bare id — the
2178
+ * only form the runtime-expression grammar can express.
2179
+ * @public
2180
+ */
2181
+ export declare class WorkflowExecutor {
2182
+ #private;
2183
+ constructor(options: WorkflowExecutorOptions);
2184
+ /**
2185
+ * Runs the named workflow to completion, returning its outcome.
2186
+ *
2187
+ * The workflows the target names in `dependsOn` are run first (see
2188
+ * {@link WorkflowExecuteOptions.runDependencies}), then its own steps.
2189
+ *
2190
+ * All run-scoped state — the execution state, the step trace, the control-flow
2191
+ * position, the call stack, the step budget, and the completed-dependency
2192
+ * ledger — is local to this call, so concurrent `execute` calls on one executor
2193
+ * do not interfere.
2194
+ */
2195
+ execute(workflowId: WorkflowId, options?: WorkflowExecuteOptions): Promise<WorkflowExecutionResult>;
2196
+ }
2197
+
2198
+ /**
2199
+ * Options for the WorkflowExecutor.
2200
+ * @public
2201
+ */
2202
+ export declare interface WorkflowExecutorOptions {
2203
+ /**
2204
+ * The entry Arazzo document holding the workflows to run; also the
2205
+ * `$components` / `$sourceDescriptions` base for every entry-document
2206
+ * workflow's expressions. A workflow reached through a cross-document
2207
+ * reference resolves against its own document instead — the document
2208
+ * follows the invocation, not this option.
2209
+ */
2210
+ readonly document: ArazzoDocument;
2211
+ /**
2212
+ * The document registry holding the already-loaded source documents.
2213
+ */
2214
+ readonly registry: DocumentRegistry;
2215
+ /**
2216
+ * The per-step engine every step is delegated to. Build it with the client
2217
+ * factory (or a deterministic stub in tests) and pass it in — the workflow
2218
+ * executor is agnostic to how a step reaches the live API.
2219
+ */
2220
+ readonly stepExecutor: StepExecutor;
2221
+ /**
2222
+ * Upper bound on the number of step attempts in a single run — every attempt
2223
+ * of every step counts, including each `retry` and each entry into a
2224
+ * sub-workflow step. Guards against a runaway `goto` loop, a runaway `retry`,
2225
+ * and a runaway tree of sub-workflow calls alike. Defaults to 1000.
2226
+ *
2227
+ * The budget is shared by the whole call tree, not granted afresh per
2228
+ * workflow: a sub-workflow spinning on its own `goto` must not escape the
2229
+ * ceiling the caller set.
2230
+ */
2231
+ readonly maxSteps?: number;
2232
+ /**
2233
+ * Upper bound on how deeply workflows may nest — a workflow entered while
2234
+ * this many are already in progress throws `reason: 'workflow-depth'`.
2235
+ * Bounds *legitimate* (acyclic) nesting; a genuine cycle is caught earlier and
2236
+ * separately by `reason: 'workflow-cycle'`. Defaults to 32.
2237
+ *
2238
+ * The count includes the workflow `execute` was called with, so `1` permits
2239
+ * that workflow and forbids all nesting; a value below 1 leaves no room for
2240
+ * even the top-level run.
2241
+ */
2242
+ readonly maxWorkflowDepth?: number;
2243
+ /**
2244
+ * Delays for the given number of milliseconds — awaited between a step's retry
2245
+ * attempts (`retryAfter`). Injected so tests pass a no-op and real runs delay;
2246
+ * defaults to a real timer.
2247
+ *
2248
+ * The run's {@link WorkflowExecuteOptions.signal} is forwarded to it, so the
2249
+ * default timer stops waiting when the run is cancelled; an injected sleep
2250
+ * that ignores it merely postpones the cancellation until its wait ends.
2251
+ */
2252
+ readonly sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
2253
+ /**
2254
+ * Reads the current time in milliseconds, used for the `durationMs` of each
2255
+ * run and step. Injected so tests assert exact durations; defaults to
2256
+ * `performance.now`, which is monotonic — `Date.now` would yield a wrong or
2257
+ * negative duration if the system clock were adjusted mid-run.
2258
+ */
2259
+ readonly now?: () => number;
2260
+ }
2261
+
2262
+ /**
2263
+ * Unique identifier of an Arazzo workflow.
2264
+ * @public
2265
+ */
2266
+ export declare type WorkflowId = string;
2267
+
2268
+ /**
2269
+ * Resolves the `parameters` of a step targeting a `workflowId` into the
2270
+ * sub-workflow's inputs.
2271
+ *
2272
+ * Values follow the family-wide literal-vs-expression rule of
2273
+ * {@link ArazzoValueResolver}. Keys are bare parameter names: per the
2274
+ * specification, "when the step in context specifies a `workflowId`, then all
2275
+ * parameters map to workflow inputs" — which are keyed by name alone, even
2276
+ * for an inherited parameter that carries an `in`. Locations are not
2277
+ * consulted, so two parameters differing only in `in` collapse by name here,
2278
+ * which for inputs is the override mechanism, not a loss.
2279
+ *
2280
+ * The first parameter to claim a name wins: the list is ordered by
2281
+ * precedence, most specific first, as `ArazzoWorkflowNormalizer` leaves it
2282
+ * once a step's own parameters have been merged with the ones it inherits —
2283
+ * the override order the specification requires.
2284
+ * @public
2285
+ */
2286
+ export declare class WorkflowParameterResolver extends StepParameterResolver {
2287
+ /**
2288
+ * Resolves each parameter's `value`, returning a `name` → value map.
2289
+ * Returns an empty object when there are no parameters.
2290
+ *
2291
+ * `scope` names the step in a thrown {@link ResolverError}.
2292
+ */
2293
+ resolve(parameters: StepParametersElement | undefined, resolve: RuntimeExpressionResolver, scope: StepScope): Record<string, unknown>;
2294
+ }
2295
+
2296
+ /**
2297
+ * The referencing context a reference is resolved in: the workflow (and step,
2298
+ * when the reference sits on one) making the reference, stamped onto every
2299
+ * error.
2300
+ * @public
2301
+ */
2302
+ export declare interface WorkflowReferenceContext {
2303
+ /**
2304
+ * The workflow the reference appears in.
2305
+ */
2306
+ readonly workflowId: string;
2307
+ /**
2308
+ * The step the reference appears on, when it sits on one (a sub-workflow
2309
+ * step's `workflowId`, or a `retry` / `goto` action's reference).
2310
+ */
2311
+ readonly stepId?: string;
2312
+ }
2313
+
2314
+ /**
2315
+ * Evaluates an `xpath` Arazzo criterion condition against a resolved context value.
2316
+ *
2317
+ * The condition is an XPath 3.1 query applied to the resolved `context`, which
2318
+ * must be XML. A string context is parsed as XML; an already-parsed DOM node is
2319
+ * used as-is. The criterion is met by the query's Effective Boolean Value
2320
+ * (XPath 3.1 §19.1.2), as the Arazzo specification mandates — so a boolean
2321
+ * predicate (`//status = 'ok'`), a non-empty node set, a non-zero number, and a
2322
+ * non-empty string all evaluate to `true`.
2323
+ *
2324
+ * Only XPath 3.1 is supported (`fontoxpath`'s engine); version gating happens in
2325
+ * the facade. Per Arazzo 1.1.0, a `null` or `undefined` context fails the
2326
+ * condition. An invalid query throws {@link CriterionError}.
2327
+ * @public
2328
+ */
2329
+ export declare class XPathCriterionEvaluator {
2330
+ #private;
2331
+ /**
2332
+ * Evaluates the XPath `condition` against the resolved context value, returning
2333
+ * its Effective Boolean Value.
2334
+ *
2335
+ * Returns `false` when the context is `null` or `undefined`. Throws
2336
+ * {@link CriterionError} when the context is not XML or the query is invalid.
2337
+ */
2338
+ evaluate(condition: string, context: unknown): boolean;
2339
+ }
2340
+
2341
+ export { }