@usearazzo/runner 1.0.1-alpha.21 → 1.0.1-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/arazzo-runner.browser.js +2733 -446
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +5 -5
- package/src/executor/ArazzoWorkflowLocatorNormalizer.cjs +18 -7
- package/src/executor/ArazzoWorkflowLocatorNormalizer.mjs +18 -7
- package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +79 -47
- package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +80 -48
- package/src/executor/StepExecutor.cjs +45 -25
- package/src/executor/StepExecutor.mjs +45 -25
- package/src/executor/StepRetryRunner.cjs +0 -10
- package/src/executor/StepRetryRunner.mjs +0 -9
- package/src/executor/WorkflowExecutor.cjs +11 -22
- package/src/executor/WorkflowExecutor.mjs +11 -22
- package/src/vendor/swagger-client.cjs +1 -1
- package/src/vendor/swagger-client.mjs +1 -1
- package/types/runner.d.ts +49 -21
package/types/runner.d.ts
CHANGED
|
@@ -369,11 +369,12 @@ export declare interface ArazzoWorkflowLocator {
|
|
|
369
369
|
* The `type` declared on a source description is not trusted (it may be
|
|
370
370
|
* absent or wrong); a source is classified by what it actually parses to,
|
|
371
371
|
* the same convention the OpenAPI operation locator follows. Source
|
|
372
|
-
* documents are acquired from the registry on demand.
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
372
|
+
* documents are acquired from the registry on demand. A reference to a
|
|
373
|
+
* workflow the resolved document does not define is rejected here, so every
|
|
374
|
+
* returned locator names an existing workflow; a caller controls when that
|
|
375
|
+
* check happens by when it normalizes (eagerly for a `dependsOn` list
|
|
376
|
+
* validated before any prerequisite runs, lazily for a sub-workflow step
|
|
377
|
+
* resolved on its first attempt).
|
|
377
378
|
* @public
|
|
378
379
|
*/
|
|
379
380
|
export declare class ArazzoWorkflowLocatorNormalizer extends SourceDescriptionsLocatorNormalizer {
|
|
@@ -382,7 +383,9 @@ export declare class ArazzoWorkflowLocatorNormalizer extends SourceDescriptionsL
|
|
|
382
383
|
* Resolves a reference — a plain workflowId or a
|
|
383
384
|
* `$sourceDescriptions.{name}.{workflowId}` expression, as written — to the
|
|
384
385
|
* canonical locator: the Arazzo document that owns the target workflow,
|
|
385
|
-
* and the bare id within it.
|
|
386
|
+
* and the bare id within it. Rejects a workflow that document does not
|
|
387
|
+
* define as `workflow-not-found`, attributed to the referencing context
|
|
388
|
+
* like every other error raised here.
|
|
386
389
|
*/
|
|
387
390
|
normalize(reference: string, document: ArazzoDocument, context: WorkflowReferenceContext): Promise<ArazzoWorkflowLocator>;
|
|
388
391
|
}
|
|
@@ -1251,7 +1254,7 @@ export declare interface OpenAPIOperationLocator {
|
|
|
1251
1254
|
* `$sourceDescriptions.{name}.{operationId}`. Per the Arazzo Specification, a
|
|
1252
1255
|
* plain name is only valid when a single (non-arazzo) source description is
|
|
1253
1256
|
* defined; multiple sources require the expression form. A plain name is
|
|
1254
|
-
* therefore
|
|
1257
|
+
* therefore looked up in the first OpenAPI source description only.
|
|
1255
1258
|
* - `operationPath` embeds a `{$sourceDescriptions.{name}.url}` runtime
|
|
1256
1259
|
* expression followed by a JSON Pointer to the operation.
|
|
1257
1260
|
*
|
|
@@ -1259,6 +1262,14 @@ export declare interface OpenAPIOperationLocator {
|
|
|
1259
1262
|
* or wrong); a source is classified by what it actually parses to. The
|
|
1260
1263
|
* normalizer acquires the referenced source documents from the registry on
|
|
1261
1264
|
* demand.
|
|
1265
|
+
*
|
|
1266
|
+
* A reference that cannot be resolved throws {@link ExecutionError}, attributed
|
|
1267
|
+
* to the referencing step when a {@link StepScope} is given:
|
|
1268
|
+
* `operation-not-found` when no operation answers it,
|
|
1269
|
+
* `source-description-not-found` for a source name the document does not
|
|
1270
|
+
* define, `source-description-not-openapi` for a source that is not an OpenAPI
|
|
1271
|
+
* document, and `invalid-operation-reference` for a reference malformed as
|
|
1272
|
+
* written. Every returned locator names an existing operation.
|
|
1262
1273
|
* @public
|
|
1263
1274
|
*/
|
|
1264
1275
|
export declare class OpenAPIOperationLocatorNormalizer extends SourceDescriptionsLocatorNormalizer {
|
|
@@ -1267,10 +1278,10 @@ export declare class OpenAPIOperationLocatorNormalizer extends SourceDescription
|
|
|
1267
1278
|
* Normalizes a plain or expression `operationId` to a canonical locator.
|
|
1268
1279
|
*
|
|
1269
1280
|
* A whole runtime expression (`$sourceDescriptions.{name}.{operationId}`) is
|
|
1270
|
-
* resolved against its named source; a plain name is
|
|
1271
|
-
*
|
|
1281
|
+
* resolved against its named source; a plain name is looked up in the first
|
|
1282
|
+
* OpenAPI source description only.
|
|
1272
1283
|
*/
|
|
1273
|
-
normalizeOperationId(operationId: string, document: ArazzoDocument): Promise<OpenAPIOperationLocator>;
|
|
1284
|
+
normalizeOperationId(operationId: string, document: ArazzoDocument, scope?: StepScope): Promise<OpenAPIOperationLocator>;
|
|
1274
1285
|
/**
|
|
1275
1286
|
* Normalizes an `operationPath` —
|
|
1276
1287
|
* `{$sourceDescriptions.{name}.url}#/json/pointer` — to a canonical locator.
|
|
@@ -1284,10 +1295,12 @@ export declare class OpenAPIOperationLocatorNormalizer extends SourceDescription
|
|
|
1284
1295
|
* The runner only needs a URL and a JSON Pointer, so it does not enforce that
|
|
1285
1296
|
* the source description is identified by a runtime expression rather than a
|
|
1286
1297
|
* literal URL (a literal URL interpolates to itself and still resolves) — that
|
|
1287
|
-
* is a conformance concern for the validator.
|
|
1288
|
-
* not
|
|
1298
|
+
* is a conformance concern for the validator. A source name the document does
|
|
1299
|
+
* not define is detected before interpolation, so it is reported as such
|
|
1300
|
+
* rather than as the empty URL it would interpolate to; the JSON Pointer must
|
|
1301
|
+
* locate an operation in the acquired OpenAPI document.
|
|
1289
1302
|
*/
|
|
1290
|
-
normalizeOperationPath(operationPath: string, document: ArazzoDocument): Promise<OpenAPIOperationLocator>;
|
|
1303
|
+
normalizeOperationPath(operationPath: string, document: ArazzoDocument, scope?: StepScope): Promise<OpenAPIOperationLocator>;
|
|
1291
1304
|
}
|
|
1292
1305
|
|
|
1293
1306
|
/**
|
|
@@ -2046,8 +2059,12 @@ export declare class StepExecutor {
|
|
|
2046
2059
|
* request nobody is waiting for, whose wire-level cancellation would surface
|
|
2047
2060
|
* as a transport {@link ClientError} — a request that failed on its own terms
|
|
2048
2061
|
* — rather than as the withdrawal it is.
|
|
2062
|
+
*
|
|
2063
|
+
* `workflowId` names the workflow the step belongs to; every error raised
|
|
2064
|
+
* here then carries it alongside the `stepId`, since step ids are only
|
|
2065
|
+
* unique within a workflow. The workflow executor always passes it.
|
|
2049
2066
|
*/
|
|
2050
|
-
execute(step: StepElement, state: ContextSource, executeOptions?: Record<string, unknown
|
|
2067
|
+
execute(step: StepElement, state: ContextSource, executeOptions?: Record<string, unknown>, workflowId?: string): Promise<StepExecutionResult>;
|
|
2051
2068
|
/**
|
|
2052
2069
|
* Throws {@link ResolverError} unless the step's `successCriteria` is absent
|
|
2053
2070
|
* or a list of Criterion Objects: `malformed-criteria` for one that is
|
|
@@ -2074,9 +2091,11 @@ export declare class StepExecutor {
|
|
|
2074
2091
|
* Public for the same reason as {@link StepExecutor.selectActions}: a step
|
|
2075
2092
|
* targeting a `workflowId` is run by the workflow executor and never reaches
|
|
2076
2093
|
* {@link StepExecutor.execute}, but its criteria are still the author's
|
|
2077
|
-
* assertion about the step and must be evaluated somewhere.
|
|
2094
|
+
* assertion about the step and must be evaluated somewhere. `workflowId`
|
|
2095
|
+
* names the step's workflow on a thrown error, as for
|
|
2096
|
+
* {@link StepExecutor.execute}.
|
|
2078
2097
|
*/
|
|
2079
|
-
evaluateCriteria(step: StepElement, context: RuntimeExpressionContext): CriterionEvaluationRecord[];
|
|
2098
|
+
evaluateCriteria(step: StepElement, context: RuntimeExpressionContext, workflowId?: string): CriterionEvaluationRecord[];
|
|
2080
2099
|
/**
|
|
2081
2100
|
* Selects every matching `onSuccess` / `onFailure` action for the outcome, in
|
|
2082
2101
|
* list order, gating each action's criteria against the context, and records
|
|
@@ -2097,8 +2116,10 @@ export declare class StepExecutor {
|
|
|
2097
2116
|
* it runs itself and which therefore never reaches
|
|
2098
2117
|
* {@link StepExecutor.execute}. Both callers reach the criteria evaluator and
|
|
2099
2118
|
* the expression context through this one method rather than wiring their own.
|
|
2119
|
+
* `workflowId` names the step's workflow on a thrown error, as for
|
|
2120
|
+
* {@link StepExecutor.execute}.
|
|
2100
2121
|
*/
|
|
2101
|
-
selectActions(step: StepElement, successful: boolean, context: RuntimeExpressionContext): Pick<StepExecutionResult, 'matchedActions' | 'actionCriteria'>;
|
|
2122
|
+
selectActions(step: StepElement, successful: boolean, context: RuntimeExpressionContext, workflowId?: string): Pick<StepExecutionResult, 'matchedActions' | 'actionCriteria'>;
|
|
2102
2123
|
}
|
|
2103
2124
|
|
|
2104
2125
|
/**
|
|
@@ -2207,14 +2228,21 @@ export declare interface StepRunRecord {
|
|
|
2207
2228
|
}
|
|
2208
2229
|
|
|
2209
2230
|
/**
|
|
2210
|
-
* Identifies the step
|
|
2211
|
-
*
|
|
2212
|
-
*
|
|
2231
|
+
* Identifies the step something is being resolved or located for, so a thrown
|
|
2232
|
+
* error can say which one it came from. Every resolver that only ever runs
|
|
2233
|
+
* within a step's scope — {@link OpenAPIOperationParameterResolver},
|
|
2213
2234
|
* {@link WorkflowParameterResolver}, {@link RequestBodyResolver},
|
|
2214
|
-
* {@link ActionResolver} — takes this
|
|
2235
|
+
* {@link ActionResolver} — takes this, as does
|
|
2236
|
+
* {@link OpenAPIOperationLocatorNormalizer} for the step whose operation it
|
|
2237
|
+
* locates.
|
|
2215
2238
|
* @public
|
|
2216
2239
|
*/
|
|
2217
2240
|
export declare interface StepScope {
|
|
2241
|
+
/**
|
|
2242
|
+
* The workflow the step belongs to, when the caller knows it: step ids are
|
|
2243
|
+
* only unique within a workflow.
|
|
2244
|
+
*/
|
|
2245
|
+
readonly workflowId?: string;
|
|
2218
2246
|
readonly stepId: string;
|
|
2219
2247
|
}
|
|
2220
2248
|
|