@usearazzo/runner 1.0.1-alpha.28 → 1.0.1-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +29 -54
- package/dist/arazzo-runner.browser.js +328 -181
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +4 -4
- package/src/errors/ExecutionError.cjs +3 -1
- package/src/errors/ExecutionError.mjs +3 -1
- package/src/executor/OpenAPIOperationExecutor.cjs +92 -22
- package/src/executor/OpenAPIOperationExecutor.mjs +90 -22
- package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +31 -4
- package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +30 -4
- package/src/executor/StepExecutor.cjs +19 -7
- package/src/executor/StepExecutor.mjs +19 -7
- package/src/executor/WorkflowExecutor.cjs +50 -16
- package/src/executor/WorkflowExecutor.mjs +51 -17
- package/types/runner.d.ts +153 -25
|
@@ -11188,6 +11188,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11188
11188
|
class ExecutionError extends _ArazzoRunnerError_ts__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
11189
11189
|
/** The run was cancelled through its `AbortSignal`; the signal's reason is the `cause`. */
|
|
11190
11190
|
static Aborted = 'aborted';
|
|
11191
|
+
/** Two `executeOptions` entries name source descriptions that point at the same document. */
|
|
11192
|
+
static AmbiguousExecuteOptions = 'ambiguous-execute-options';
|
|
11191
11193
|
/** A step or a `goto`/`retry` action declares more than one mutually exclusive target. */
|
|
11192
11194
|
static AmbiguousTarget = 'ambiguous-target';
|
|
11193
11195
|
/** The `dependsOn` edges alone form a cycle between workflows. */
|
|
@@ -11222,7 +11224,7 @@ class ExecutionError extends _ArazzoRunnerError_ts__WEBPACK_IMPORTED_MODULE_0__[
|
|
|
11222
11224
|
static StepBudget = 'step-budget';
|
|
11223
11225
|
/** An action declares a `type` other than `end`, `goto` or `retry`. */
|
|
11224
11226
|
static UnknownActionType = 'unknown-action-type';
|
|
11225
|
-
/** `execute` received an option it does not know. */
|
|
11227
|
+
/** `execute` received an option it does not know, or an `executeOptions` entry that is not an object. */
|
|
11226
11228
|
static UnknownExecuteOption = 'unknown-execute-option';
|
|
11227
11229
|
/** A step produced a transition the workflow executor does not recognize. */
|
|
11228
11230
|
static UnknownTransitionKind = 'unknown-transition-kind';
|
|
@@ -11629,21 +11631,23 @@ class ArazzoWorkflowLocatorNormalizer extends _SourceDescriptionsLocatorNormaliz
|
|
|
11629
11631
|
|
|
11630
11632
|
"use strict";
|
|
11631
11633
|
__webpack_require__.r(__webpack_exports__);
|
|
11632
|
-
/* harmony import */ var
|
|
11633
|
-
/* harmony import */ var
|
|
11634
|
-
/* harmony import */ var
|
|
11635
|
-
/* harmony import */ var
|
|
11636
|
-
/* harmony import */ var
|
|
11637
|
-
/* harmony import */ var
|
|
11638
|
-
/* harmony import */ var
|
|
11639
|
-
/* harmony import */ var
|
|
11640
|
-
/* harmony import */ var
|
|
11641
|
-
/* harmony import */ var
|
|
11642
|
-
/* harmony import */ var
|
|
11643
|
-
/* harmony import */ var
|
|
11644
|
-
/* harmony import */ var
|
|
11645
|
-
/* harmony import */ var
|
|
11646
|
-
/* harmony import */ var
|
|
11634
|
+
/* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38506);
|
|
11635
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7456);
|
|
11636
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62823);
|
|
11637
|
+
/* harmony import */ var _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(30698);
|
|
11638
|
+
/* harmony import */ var _speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(29716);
|
|
11639
|
+
/* harmony import */ var _swaggerexpert_cookie__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(36258);
|
|
11640
|
+
/* harmony import */ var _swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(93504);
|
|
11641
|
+
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(34606);
|
|
11642
|
+
/* harmony import */ var _vendor_swagger_client_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(96777);
|
|
11643
|
+
/* harmony import */ var _client_ParameterDelivery_ts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55995);
|
|
11644
|
+
/* harmony import */ var _client_HTTPClientFetch_ts__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(55549);
|
|
11645
|
+
/* harmony import */ var _client_OpenAPIOperationResponseNormalizer_ts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(63439);
|
|
11646
|
+
/* harmony import */ var _extractor_OpenAPIOperationExtractor_ts__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(57658);
|
|
11647
|
+
/* harmony import */ var _normalizer_OpenAPIOperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(87864);
|
|
11648
|
+
/* harmony import */ var _assembler_OpenAPIDocumentAssembler_ts__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(6898);
|
|
11649
|
+
/* harmony import */ var _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(81763);
|
|
11650
|
+
|
|
11647
11651
|
|
|
11648
11652
|
|
|
11649
11653
|
|
|
@@ -11662,12 +11666,42 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11662
11666
|
|
|
11663
11667
|
|
|
11664
11668
|
|
|
11669
|
+
/**
|
|
11670
|
+
* The Arazzo step a request is issued for: its `stepId`, and the `workflowId`
|
|
11671
|
+
* of the workflow it belongs to when the caller names one (step ids are only
|
|
11672
|
+
* unique within a workflow).
|
|
11673
|
+
* @public
|
|
11674
|
+
*/
|
|
11675
|
+
|
|
11676
|
+
/**
|
|
11677
|
+
* Identifies the request a {@link RequestInterceptor} receives, so an
|
|
11678
|
+
* interceptor can target one operation or one step without matching on the
|
|
11679
|
+
* expanded URL.
|
|
11680
|
+
*
|
|
11681
|
+
* `operation` is always present: it is the operation's locator — its canonical
|
|
11682
|
+
* OpenAPI document URI, the JSON Pointer to it and, when the locator carries
|
|
11683
|
+
* one, the source description it was located through — plus the `operationId`
|
|
11684
|
+
* the document declares, if any. `step` is present only when the request is
|
|
11685
|
+
* issued for an Arazzo step, i.e. through the step executor (and so the runner); an
|
|
11686
|
+
* {@link OpenAPIOperationExecutor} used on its own receives it only when its
|
|
11687
|
+
* caller passes `step` in the execute options. Absent fields are omitted, never
|
|
11688
|
+
* `undefined`.
|
|
11689
|
+
* @public
|
|
11690
|
+
*/
|
|
11691
|
+
|
|
11665
11692
|
/**
|
|
11666
11693
|
* Decorates the built request before it is handed to the {@link HTTPClient}.
|
|
11667
11694
|
*
|
|
11668
11695
|
* Receives the finalized {@link OpenAPIOperationRequest} and may mutate it in
|
|
11669
11696
|
* place or return a replacement; returning nothing keeps the received request.
|
|
11670
|
-
* May be synchronous or asynchronous.
|
|
11697
|
+
* May be synchronous or asynchronous. The second argument identifies what the
|
|
11698
|
+
* request is for (see {@link RequestContext}); an interceptor that has no use
|
|
11699
|
+
* for it may declare only the first.
|
|
11700
|
+
*
|
|
11701
|
+
* Interceptors run after the body is serialized (a plain-object or array body
|
|
11702
|
+
* is already a JSON string, so a signature covers the exact bytes sent) and
|
|
11703
|
+
* after newlines in header values are squashed, and before the request is
|
|
11704
|
+
* captured for `$request.*` and handed to the transport.
|
|
11671
11705
|
* @public
|
|
11672
11706
|
*/
|
|
11673
11707
|
|
|
@@ -11686,6 +11720,22 @@ const UNDECLARED_LOCATIONS = new Set(['header', 'query', 'cookie', 'path']);
|
|
|
11686
11720
|
// the header parameters OpenAPI 3 says SHALL be ignored, which buildRequest drops
|
|
11687
11721
|
const IGNORED_HEADERS = new Set(['accept', 'authorization', 'content-type']);
|
|
11688
11722
|
|
|
11723
|
+
/**
|
|
11724
|
+
* The credential for one security scheme, in the form the vendored
|
|
11725
|
+
* swagger-client applies it: the key or token itself (or `{ value }`) for an
|
|
11726
|
+
* `apiKey` or an `http` bearer scheme, `{ username, password }` for an `http`
|
|
11727
|
+
* basic scheme, and `{ token: { access_token, token_type } }` for an `oauth2`
|
|
11728
|
+
* or `openIdConnect` scheme.
|
|
11729
|
+
* @public
|
|
11730
|
+
*/
|
|
11731
|
+
|
|
11732
|
+
/**
|
|
11733
|
+
* Credentials for the security schemes of an OpenAPI document, keyed by the
|
|
11734
|
+
* scheme name under `components.securitySchemes` (`securityDefinitions` in
|
|
11735
|
+
* OpenAPI 2.0).
|
|
11736
|
+
* @public
|
|
11737
|
+
*/
|
|
11738
|
+
|
|
11689
11739
|
/**
|
|
11690
11740
|
* Options for executing an OpenAPI operation.
|
|
11691
11741
|
*
|
|
@@ -11695,11 +11745,14 @@ const IGNORED_HEADERS = new Set(['accept', 'authorization', 'content-type']);
|
|
|
11695
11745
|
* building the request and sending it.
|
|
11696
11746
|
*
|
|
11697
11747
|
* Typed here are the options the runner itself drives and the ones callers
|
|
11698
|
-
* routinely reach for. The rest of `buildRequest`'s surface (`
|
|
11699
|
-
* `
|
|
11700
|
-
*
|
|
11701
|
-
*
|
|
11702
|
-
*
|
|
11748
|
+
* routinely reach for. The rest of `buildRequest`'s surface (`scheme`,
|
|
11749
|
+
* `parameterBuilders`, `attachContentTypeForEmptyPayload`, …) is deliberately
|
|
11750
|
+
* left untyped and passes through the bag's open tail unchanged — see
|
|
11751
|
+
* {@link OpenAPIOperationExecuteOptionsBag}.
|
|
11752
|
+
*
|
|
11753
|
+
* Arazzo is auth-agnostic, so credentials come from outside the workflow:
|
|
11754
|
+
* static ones for the security schemes the OpenAPI document declares go in
|
|
11755
|
+
* `securities`, and anything computed per request is applied with a
|
|
11703
11756
|
* {@link RequestInterceptor}.
|
|
11704
11757
|
* @public
|
|
11705
11758
|
*/
|
|
@@ -11712,18 +11765,16 @@ const IGNORED_HEADERS = new Set(['accept', 'authorization', 'content-type']);
|
|
|
11712
11765
|
* the rest of `buildRequest`'s surface (`scheme`, `parameterBuilders`,
|
|
11713
11766
|
* `attachContentTypeForEmptyPayload`, …) passes through untouched.
|
|
11714
11767
|
*
|
|
11715
|
-
* Nothing routine belongs in the tail.
|
|
11716
|
-
*
|
|
11717
|
-
*
|
|
11718
|
-
* standing in for a document fetched over HTTP, or credentials applied from the
|
|
11719
|
-
* document's own security schemes.
|
|
11768
|
+
* Nothing routine belongs in the tail. `server` covers every case that once
|
|
11769
|
+
* needed a `contextUrl`, so reaching for that here means an edge case: tests
|
|
11770
|
+
* standing in for a document fetched over HTTP.
|
|
11720
11771
|
*
|
|
11721
|
-
* Two kinds of entry are
|
|
11772
|
+
* Two kinds of entry are dropped rather than honored, since the executor owns
|
|
11722
11773
|
* what they used to control. The operation target always comes from the
|
|
11723
11774
|
* locator, so `operationId`/`operationPath` have no effect; and the options
|
|
11724
11775
|
* only swagger-client's `execute()` ever read — `userFetch` and
|
|
11725
11776
|
* `responseInterceptor`, which the runner replaces with `httpClient` and
|
|
11726
|
-
* `responseNormalizer` — reach `buildRequest
|
|
11777
|
+
* `responseNormalizer` — never reach `buildRequest`.
|
|
11727
11778
|
* @public
|
|
11728
11779
|
*/
|
|
11729
11780
|
|
|
@@ -11762,12 +11813,12 @@ class OpenAPIOperationExecutor {
|
|
|
11762
11813
|
#operationNormalizer;
|
|
11763
11814
|
#documentAssembler;
|
|
11764
11815
|
constructor(options = {}) {
|
|
11765
|
-
this.#httpClient = options.httpClient ??
|
|
11816
|
+
this.#httpClient = options.httpClient ?? _client_HTTPClientFetch_ts__WEBPACK_IMPORTED_MODULE_10__["default"];
|
|
11766
11817
|
this.#requestInterceptor = options.requestInterceptor;
|
|
11767
|
-
this.#responseNormalizer = options.responseNormalizer ?? new
|
|
11768
|
-
this.#operationExtractor = options.operationExtractor ?? new
|
|
11769
|
-
this.#operationNormalizer = options.operationNormalizer ?? new
|
|
11770
|
-
this.#documentAssembler = options.documentAssembler ?? new
|
|
11818
|
+
this.#responseNormalizer = options.responseNormalizer ?? new _client_OpenAPIOperationResponseNormalizer_ts__WEBPACK_IMPORTED_MODULE_11__["default"]();
|
|
11819
|
+
this.#operationExtractor = options.operationExtractor ?? new _extractor_OpenAPIOperationExtractor_ts__WEBPACK_IMPORTED_MODULE_12__["default"]();
|
|
11820
|
+
this.#operationNormalizer = options.operationNormalizer ?? new _normalizer_OpenAPIOperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_13__["default"]();
|
|
11821
|
+
this.#documentAssembler = options.documentAssembler ?? new _assembler_OpenAPIDocumentAssembler_ts__WEBPACK_IMPORTED_MODULE_14__["default"]();
|
|
11771
11822
|
}
|
|
11772
11823
|
|
|
11773
11824
|
/**
|
|
@@ -11787,18 +11838,40 @@ class OpenAPIOperationExecutor {
|
|
|
11787
11838
|
const operation = this.#operationExtractor.extractByPointer(locator.document, locator.jsonPointer);
|
|
11788
11839
|
// the legacy id (`{method}-{path}`) matches regardless of an explicit
|
|
11789
11840
|
// `operationId` in the assembled document
|
|
11790
|
-
const operationId = (0,
|
|
11841
|
+
const operationId = (0,_vendor_swagger_client_mjs__WEBPACK_IMPORTED_MODULE_8__.idFromPathMethodLegacy)((0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(operation.meta.get('path')), (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(operation.meta.get('http-method')));
|
|
11791
11842
|
const normalizedOperation = await this.#operationNormalizer.normalize(operation, locator.document);
|
|
11792
11843
|
const assembled = this.#documentAssembler.assemble(normalizedOperation, locator.document);
|
|
11793
11844
|
|
|
11794
|
-
// the interceptor
|
|
11795
|
-
// locator,
|
|
11845
|
+
// the interceptor and step are consumed here, the target always comes from
|
|
11846
|
+
// the locator, and the transport is the httpClient, so none of these
|
|
11847
|
+
// reach buildRequest
|
|
11796
11848
|
const {
|
|
11797
11849
|
requestInterceptor,
|
|
11798
|
-
|
|
11799
|
-
operationPath: __,
|
|
11800
|
-
...rest
|
|
11850
|
+
step
|
|
11801
11851
|
} = executeOptions;
|
|
11852
|
+
const rest = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['requestInterceptor', 'step', 'operationId', 'operationPath', 'userFetch', 'responseInterceptor'], executeOptions);
|
|
11853
|
+
const declaredOperationId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(operation.operationId);
|
|
11854
|
+
const context = {
|
|
11855
|
+
operation: {
|
|
11856
|
+
documentURI: locator.document.uri,
|
|
11857
|
+
jsonPointer: locator.jsonPointer,
|
|
11858
|
+
...(typeof declaredOperationId === 'string' ? {
|
|
11859
|
+
operationId: declaredOperationId
|
|
11860
|
+
} : {}),
|
|
11861
|
+
...(locator.sourceDescription === undefined ? {} : {
|
|
11862
|
+
sourceDescription: {
|
|
11863
|
+
...locator.sourceDescription
|
|
11864
|
+
}
|
|
11865
|
+
})
|
|
11866
|
+
},
|
|
11867
|
+
// a copy, so an interceptor editing it cannot rewrite the caller's object
|
|
11868
|
+
// (the step executor reuses it to attribute errors)
|
|
11869
|
+
...(step === undefined ? {} : {
|
|
11870
|
+
step: {
|
|
11871
|
+
...step
|
|
11872
|
+
}
|
|
11873
|
+
})
|
|
11874
|
+
};
|
|
11802
11875
|
|
|
11803
11876
|
// each step derives the next options rather than editing in place
|
|
11804
11877
|
const withServer = this.#applyServerOptions(rest, normalizedOperation, locator.document);
|
|
@@ -11806,16 +11879,16 @@ class OpenAPIOperationExecutor {
|
|
|
11806
11879
|
const buildOptions = this.#adaptRequestContentType(withBody, normalizedOperation, locator.document, locator.jsonPointer);
|
|
11807
11880
|
const undeclared = this.#undeclaredParameters(buildOptions.parameters, normalizedOperation);
|
|
11808
11881
|
const spec = assembled.toJSON();
|
|
11809
|
-
this.#declareQueryAndPathParameters(spec, undeclared, (0,
|
|
11882
|
+
this.#declareQueryAndPathParameters(spec, undeclared, (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(operation.meta.get('path')), (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(operation.meta.get('http-method')), locator);
|
|
11810
11883
|
let request;
|
|
11811
11884
|
try {
|
|
11812
|
-
request = (0,
|
|
11885
|
+
request = (0,_vendor_swagger_client_mjs__WEBPACK_IMPORTED_MODULE_8__.buildRequest)({
|
|
11813
11886
|
...buildOptions,
|
|
11814
11887
|
spec,
|
|
11815
11888
|
operationId
|
|
11816
11889
|
});
|
|
11817
11890
|
} catch (error) {
|
|
11818
|
-
throw new
|
|
11891
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"]('Failed to build request for OpenAPI operation', {
|
|
11819
11892
|
operationPath: locator.jsonPointer,
|
|
11820
11893
|
cause: error
|
|
11821
11894
|
});
|
|
@@ -11829,7 +11902,7 @@ class OpenAPIOperationExecutor {
|
|
|
11829
11902
|
request.headers['Content-Type'] = authoredContentType;
|
|
11830
11903
|
}
|
|
11831
11904
|
this.#deliverHeadersAndCookies(request, undeclared);
|
|
11832
|
-
request = await this.#finalizeRequest(request, requestInterceptor);
|
|
11905
|
+
request = await this.#finalizeRequest(request, requestInterceptor, context);
|
|
11833
11906
|
|
|
11834
11907
|
// capture the request as sent, so `$url` / `$method` / `$request.*` can be
|
|
11835
11908
|
// evaluated after execution; headers are copied so a transport-side
|
|
@@ -11846,7 +11919,7 @@ class OpenAPIOperationExecutor {
|
|
|
11846
11919
|
try {
|
|
11847
11920
|
rawResponse = await this.#httpClient(request);
|
|
11848
11921
|
} catch (error) {
|
|
11849
|
-
throw new
|
|
11922
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"]('OpenAPI operation request failed', {
|
|
11850
11923
|
operationPath: locator.jsonPointer,
|
|
11851
11924
|
cause: error
|
|
11852
11925
|
});
|
|
@@ -11867,8 +11940,8 @@ class OpenAPIOperationExecutor {
|
|
|
11867
11940
|
* `buildRequest`: they name no location to deliver to.
|
|
11868
11941
|
*/
|
|
11869
11942
|
#undeclaredParameters(parameters, operation) {
|
|
11870
|
-
if (!(0,
|
|
11871
|
-
const declared = new Set(((0,
|
|
11943
|
+
if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_7__["default"])(parameters)) return [];
|
|
11944
|
+
const declared = new Set(((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(operation.parameters) ? [...operation.parameters] : []).filter(_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement).map(parameter => `${(0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(parameter.get('in'))}.${(0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(parameter.get('name'))}`));
|
|
11872
11945
|
return Object.entries(parameters).flatMap(([key, value]) => {
|
|
11873
11946
|
const separator = key.indexOf('.');
|
|
11874
11947
|
const location = key.slice(0, separator);
|
|
@@ -11897,14 +11970,14 @@ class OpenAPIOperationExecutor {
|
|
|
11897
11970
|
*/
|
|
11898
11971
|
#declareQueryAndPathParameters(spec, undeclared, path, method, locator) {
|
|
11899
11972
|
const operation = spec.paths[path][method];
|
|
11900
|
-
const isSwagger = (0,
|
|
11973
|
+
const isSwagger = (0,_speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_4__.isSwaggerElement)(locator.document.parseResult.api);
|
|
11901
11974
|
for (const {
|
|
11902
11975
|
location,
|
|
11903
11976
|
name
|
|
11904
11977
|
} of undeclared) {
|
|
11905
11978
|
if (location !== 'query' && location !== 'path') continue;
|
|
11906
11979
|
if (location === 'path' && !path.includes(`{${name}}`)) {
|
|
11907
|
-
throw new
|
|
11980
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`Path parameter "${name}" is not declared by the operation and its path "${path}" ` + `has no "{${name}}" to substitute it into`, {
|
|
11908
11981
|
operationPath: locator.jsonPointer
|
|
11909
11982
|
});
|
|
11910
11983
|
}
|
|
@@ -11951,12 +12024,12 @@ class OpenAPIOperationExecutor {
|
|
|
11951
12024
|
if (cookies.length === 0) return;
|
|
11952
12025
|
// serialized as buildRequest serializes a declared cookie, so a `;` in the
|
|
11953
12026
|
// value is percent-encoded rather than splitting it into further cookies
|
|
11954
|
-
const serialized = (0,
|
|
12027
|
+
const serialized = (0,_swaggerexpert_cookie__WEBPACK_IMPORTED_MODULE_5__.serializeCookie)(cookies, {
|
|
11955
12028
|
encoders: {
|
|
11956
|
-
value:
|
|
12029
|
+
value: _swaggerexpert_cookie__WEBPACK_IMPORTED_MODULE_5__.cookieValueStrictPercentEncoder
|
|
11957
12030
|
},
|
|
11958
12031
|
validators: {
|
|
11959
|
-
name:
|
|
12032
|
+
name: _swaggerexpert_cookie__WEBPACK_IMPORTED_MODULE_5__.cookieNameLenientValidator
|
|
11960
12033
|
}
|
|
11961
12034
|
});
|
|
11962
12035
|
const cookieHeader = present('Cookie') ?? 'Cookie';
|
|
@@ -12000,7 +12073,7 @@ class OpenAPIOperationExecutor {
|
|
|
12000
12073
|
* resolving against somewhere the document did not come from.
|
|
12001
12074
|
*/
|
|
12002
12075
|
#applyServerOptions(buildOptions, operation, document) {
|
|
12003
|
-
const resolved = buildOptions.contextUrl === undefined &&
|
|
12076
|
+
const resolved = buildOptions.contextUrl === undefined && _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_3__.isHttpUrl(document.uri) ? {
|
|
12004
12077
|
...buildOptions,
|
|
12005
12078
|
contextUrl: document.uri
|
|
12006
12079
|
} : buildOptions;
|
|
@@ -12018,10 +12091,10 @@ class OpenAPIOperationExecutor {
|
|
|
12018
12091
|
// path valid for every version: isServerElement is per-namespace, and the
|
|
12019
12092
|
// 3.1 one rejects 3.0 servers
|
|
12020
12093
|
const servers = operation.get('servers');
|
|
12021
|
-
const declared = (0,
|
|
12022
|
-
const isDeclared = declared.some(candidate => (0,
|
|
12094
|
+
const declared = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(servers) ? [...servers] : [];
|
|
12095
|
+
const isDeclared = declared.some(candidate => (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(candidate) && (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(candidate.get('url')) === server);
|
|
12023
12096
|
if (isDeclared) return resolved;
|
|
12024
|
-
const baseURL =
|
|
12097
|
+
const baseURL = _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_3__.hasProtocol(server) ? server : _speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_3__.resolve(resolved.contextUrl ?? '', server);
|
|
12025
12098
|
|
|
12026
12099
|
// buildRequest concatenates the base and the path verbatim, so a trailing
|
|
12027
12100
|
// slash would double up. swagger-client trims one in its own resolution too
|
|
@@ -12056,11 +12129,11 @@ class OpenAPIOperationExecutor {
|
|
|
12056
12129
|
if (typeof requested !== 'string' || buildOptions.requestBody === undefined) {
|
|
12057
12130
|
return buildOptions;
|
|
12058
12131
|
}
|
|
12059
|
-
if ((0,
|
|
12132
|
+
if ((0,_speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_4__.isSwaggerElement)(document.parseResult.api)) return buildOptions;
|
|
12060
12133
|
const requestBody = operation.get('requestBody');
|
|
12061
|
-
const content = (0,
|
|
12062
|
-
if (!(0,
|
|
12063
|
-
throw new
|
|
12134
|
+
const content = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(requestBody) ? requestBody.get('content') : undefined;
|
|
12135
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(content)) {
|
|
12136
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`Request body media type "${requested}" cannot be sent: the operation declares ` + 'no request body content. Omit the content type to send the payload as-is', {
|
|
12064
12137
|
operationPath: jsonPointer
|
|
12065
12138
|
});
|
|
12066
12139
|
}
|
|
@@ -12068,8 +12141,8 @@ class OpenAPIOperationExecutor {
|
|
|
12068
12141
|
if (declared.includes(requested)) return buildOptions;
|
|
12069
12142
|
|
|
12070
12143
|
// a range or a malformed value names no concrete media type to send
|
|
12071
|
-
if ((0,
|
|
12072
|
-
throw new
|
|
12144
|
+
if ((0,_swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_6__.identify)(requested) !== 'media-type') {
|
|
12145
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`Request body media type "${requested}" is not a valid media type`, {
|
|
12073
12146
|
operationPath: jsonPointer
|
|
12074
12147
|
});
|
|
12075
12148
|
}
|
|
@@ -12077,18 +12150,18 @@ class OpenAPIOperationExecutor {
|
|
|
12077
12150
|
// a form media type decides how the body is encoded, and buildRequest applies
|
|
12078
12151
|
// that encoding only for an exactly declared type. matching one against a
|
|
12079
12152
|
// range would put a JSON body behind a form Content-Type
|
|
12080
|
-
const isFormEncoded = (0,
|
|
12153
|
+
const isFormEncoded = (0,_swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_6__.matches)('application/x-www-form-urlencoded', requested) || (0,_swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_6__.matches)('multipart/form-data', requested);
|
|
12081
12154
|
|
|
12082
12155
|
// otherwise a declared range covers a concrete type, so `*/*` (what several
|
|
12083
12156
|
// generators emit by default) accepts anything; the most specific wins.
|
|
12084
12157
|
// parameters on one side only (a declared `charset=utf-8`) describe the
|
|
12085
12158
|
// content rather than constrain it, while conflicting ones never match
|
|
12086
|
-
const candidates = isFormEncoded ? declared.filter(mediaType => (0,
|
|
12087
|
-
const match = (0,
|
|
12159
|
+
const candidates = isFormEncoded ? declared.filter(mediaType => (0,_swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_6__.identify)(mediaType) === 'media-type') : declared;
|
|
12160
|
+
const match = (0,_swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_6__.selectBestMatch)(candidates, requested, {
|
|
12088
12161
|
parameterMatching: 'compatible'
|
|
12089
12162
|
});
|
|
12090
12163
|
if (match === null) {
|
|
12091
|
-
throw new
|
|
12164
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](isFormEncoded ? `Request body media type "${requested}" must be declared by the operation exactly, ` + `since it decides how the body is encoded (declared: [${declared.join(', ')}])` : `Request body media type "${requested}" is not declared by the operation ` + `(declared: [${declared.join(', ')}])`, {
|
|
12092
12165
|
operationPath: jsonPointer
|
|
12093
12166
|
});
|
|
12094
12167
|
}
|
|
@@ -12126,7 +12199,7 @@ class OpenAPIOperationExecutor {
|
|
|
12126
12199
|
* `querystring` parameter under its bare name.
|
|
12127
12200
|
*/
|
|
12128
12201
|
#adaptRequestBody(buildOptions, operation, document, jsonPointer) {
|
|
12129
|
-
if (!(0,
|
|
12202
|
+
if (!(0,_speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_4__.isSwaggerElement)(document.parseResult.api) || buildOptions.requestBody === undefined) {
|
|
12130
12203
|
return buildOptions;
|
|
12131
12204
|
}
|
|
12132
12205
|
const {
|
|
@@ -12138,29 +12211,29 @@ class OpenAPIOperationExecutor {
|
|
|
12138
12211
|
// an operation declaring none leaves `parameters` absent rather than empty,
|
|
12139
12212
|
// and that case still has to reach the throw below
|
|
12140
12213
|
const declared = operation.parameters;
|
|
12141
|
-
const parameters = (0,
|
|
12214
|
+
const parameters = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(declared) ? [...declared.filter(_speclynx_apidom_ns_openapi_2__WEBPACK_IMPORTED_MODULE_4__.isParameterElement)] : [];
|
|
12142
12215
|
|
|
12143
12216
|
// the body parameter's name is arbitrary, so the payload wins over a
|
|
12144
12217
|
// same-keyed entry the caller supplied
|
|
12145
|
-
const body = parameters.find(parameter => (0,
|
|
12218
|
+
const body = parameters.find(parameter => (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(parameter.in) === 'body');
|
|
12146
12219
|
if (body !== undefined) {
|
|
12147
|
-
const name = (0,
|
|
12220
|
+
const name = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(body.name);
|
|
12148
12221
|
this.#rejectBarePayloadConflicts(callerParameters, [name], jsonPointer);
|
|
12149
12222
|
return {
|
|
12150
12223
|
...rest,
|
|
12151
12224
|
parameters: {
|
|
12152
12225
|
...callerParameters,
|
|
12153
|
-
[
|
|
12226
|
+
[_client_ParameterDelivery_ts__WEBPACK_IMPORTED_MODULE_9__["default"].keyFor('body', name)]: requestBody
|
|
12154
12227
|
}
|
|
12155
12228
|
};
|
|
12156
12229
|
}
|
|
12157
12230
|
|
|
12158
12231
|
// formData models each field as its own parameter, so the payload's keys
|
|
12159
12232
|
// are the parameter names; buildRequest reports any that do not match
|
|
12160
|
-
const hasForm = parameters.some(parameter => (0,
|
|
12233
|
+
const hasForm = parameters.some(parameter => (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(parameter.in) === 'formData');
|
|
12161
12234
|
if (hasForm) {
|
|
12162
|
-
if (!(0,
|
|
12163
|
-
throw new
|
|
12235
|
+
if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_7__["default"])(requestBody)) {
|
|
12236
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"]('Request body cannot be sent: the OpenAPI 2.0 operation carries it in "formData" ' + 'parameters, so the payload must be an object keyed by their names', {
|
|
12164
12237
|
operationPath: jsonPointer
|
|
12165
12238
|
});
|
|
12166
12239
|
}
|
|
@@ -12170,14 +12243,14 @@ class OpenAPIOperationExecutor {
|
|
|
12170
12243
|
...callerParameters
|
|
12171
12244
|
};
|
|
12172
12245
|
for (const [field, value] of Object.entries(payload)) {
|
|
12173
|
-
merged[
|
|
12246
|
+
merged[_client_ParameterDelivery_ts__WEBPACK_IMPORTED_MODULE_9__["default"].keyFor('formData', field)] = value;
|
|
12174
12247
|
}
|
|
12175
12248
|
return {
|
|
12176
12249
|
...rest,
|
|
12177
12250
|
parameters: merged
|
|
12178
12251
|
};
|
|
12179
12252
|
}
|
|
12180
|
-
throw new
|
|
12253
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"]('Request body cannot be sent: the OpenAPI 2.0 operation declares no "body" or ' + '"formData" parameter to carry it', {
|
|
12181
12254
|
operationPath: jsonPointer
|
|
12182
12255
|
});
|
|
12183
12256
|
}
|
|
@@ -12192,7 +12265,7 @@ class OpenAPIOperationExecutor {
|
|
|
12192
12265
|
if (callerParameters === undefined) return;
|
|
12193
12266
|
const conflicts = payloadNames.filter(name => Object.hasOwn(callerParameters, name));
|
|
12194
12267
|
if (conflicts.length === 0) return;
|
|
12195
|
-
throw new
|
|
12268
|
+
throw new _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`Request body cannot be sent: bare parameter ${conflicts.length === 1 ? 'entry' : 'entries'} ` + `[${conflicts.join(', ')}] would displace the payload at delivery. Supply the ` + `parameter under its "{in}.{name}" key, or drop the duplicate`, {
|
|
12196
12269
|
operationPath: jsonPointer
|
|
12197
12270
|
});
|
|
12198
12271
|
}
|
|
@@ -12206,12 +12279,12 @@ class OpenAPIOperationExecutor {
|
|
|
12206
12279
|
* `http()`, which also fetch and throw on a non-2xx. Diff against those two
|
|
12207
12280
|
* when bumping swagger-client.
|
|
12208
12281
|
*/
|
|
12209
|
-
async #finalizeRequest(request, perCallInterceptor) {
|
|
12282
|
+
async #finalizeRequest(request, perCallInterceptor, context) {
|
|
12210
12283
|
let finalized = request;
|
|
12211
12284
|
|
|
12212
12285
|
// JSON-encode plain-object and array bodies, exactly as swagger-client's
|
|
12213
12286
|
// execute() does before handing the request to its transport
|
|
12214
|
-
if (finalized.body && ((0,
|
|
12287
|
+
if (finalized.body && ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_7__["default"])(finalized.body) || Array.isArray(finalized.body))) {
|
|
12215
12288
|
finalized.body = JSON.stringify(finalized.body);
|
|
12216
12289
|
}
|
|
12217
12290
|
|
|
@@ -12225,8 +12298,8 @@ class OpenAPIOperationExecutor {
|
|
|
12225
12298
|
finalized.headers[headerName] = value.replace(/\n+/g, ' ');
|
|
12226
12299
|
}
|
|
12227
12300
|
});
|
|
12228
|
-
finalized = (await this.#requestInterceptor?.(finalized)) ?? finalized;
|
|
12229
|
-
finalized = (await perCallInterceptor?.(finalized)) ?? finalized;
|
|
12301
|
+
finalized = (await this.#requestInterceptor?.(finalized, context)) ?? finalized;
|
|
12302
|
+
finalized = (await perCallInterceptor?.(finalized, context)) ?? finalized;
|
|
12230
12303
|
|
|
12231
12304
|
// for multipart/form-data, remove the built content-type so the transport
|
|
12232
12305
|
// sets one carrying the correct boundary
|
|
@@ -12280,6 +12353,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12280
12353
|
* @public
|
|
12281
12354
|
*/
|
|
12282
12355
|
|
|
12356
|
+
/**
|
|
12357
|
+
* A source description as an Arazzo document declares it: its `name`, and the
|
|
12358
|
+
* URI of the Arazzo document that declares it. Names are local to their
|
|
12359
|
+
* document, so the pair identifies one source description across a run.
|
|
12360
|
+
* @public
|
|
12361
|
+
*/
|
|
12362
|
+
|
|
12283
12363
|
/**
|
|
12284
12364
|
* Normalizes a step's OpenAPI operation locator to a canonical
|
|
12285
12365
|
* {@link OpenAPIOperationLocator} — the OpenAPI document and a JSON Pointer to
|
|
@@ -12344,8 +12424,11 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
12344
12424
|
* locate an operation in the acquired OpenAPI document.
|
|
12345
12425
|
*/
|
|
12346
12426
|
async normalizeOperationPath(operationPath, document, scope) {
|
|
12427
|
+
let sourceName;
|
|
12347
12428
|
for (const expression of (0,_swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_0__.extract)(operationPath) ?? []) {
|
|
12348
12429
|
const parsed = this.parseSourceDescriptionsExpression(expression);
|
|
12430
|
+
// only the source whose url the path is built from names its document
|
|
12431
|
+
if (parsed?.reference === 'url') sourceName ??= parsed.sourceName;
|
|
12349
12432
|
if (parsed !== undefined && document.resolveSourceDescriptionURI(parsed.sourceName) === undefined) {
|
|
12350
12433
|
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_6__["default"](`operationPath "${operationPath}" names source description "${parsed.sourceName}", which the Arazzo document at "${document.uri}" does not define`, {
|
|
12351
12434
|
...scope,
|
|
@@ -12394,7 +12477,13 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
12394
12477
|
}
|
|
12395
12478
|
return {
|
|
12396
12479
|
document: source,
|
|
12397
|
-
jsonPointer
|
|
12480
|
+
jsonPointer,
|
|
12481
|
+
...(sourceName === undefined ? {} : {
|
|
12482
|
+
sourceDescription: {
|
|
12483
|
+
name: sourceName,
|
|
12484
|
+
documentURI: document.uri
|
|
12485
|
+
}
|
|
12486
|
+
})
|
|
12398
12487
|
};
|
|
12399
12488
|
}
|
|
12400
12489
|
async #resolveSourced(expression, document, scope) {
|
|
@@ -12419,7 +12508,11 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
12419
12508
|
}
|
|
12420
12509
|
return {
|
|
12421
12510
|
document: openapiDocument,
|
|
12422
|
-
jsonPointer
|
|
12511
|
+
jsonPointer,
|
|
12512
|
+
sourceDescription: {
|
|
12513
|
+
name: sourceName,
|
|
12514
|
+
documentURI: document.uri
|
|
12515
|
+
}
|
|
12423
12516
|
};
|
|
12424
12517
|
}
|
|
12425
12518
|
|
|
@@ -12436,7 +12529,10 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
12436
12529
|
* until the first OpenAPI source is reached.
|
|
12437
12530
|
*/
|
|
12438
12531
|
async #resolvePlainOperationId(operationId, document, scope) {
|
|
12439
|
-
for (const
|
|
12532
|
+
for (const [name, {
|
|
12533
|
+
uri
|
|
12534
|
+
}] of document.sourceDescriptionIndex) {
|
|
12535
|
+
if (uri === undefined) continue;
|
|
12440
12536
|
const source = await this.registry.acquire(uri);
|
|
12441
12537
|
if (!_document_OpenAPIDocument_ts__WEBPACK_IMPORTED_MODULE_3__["default"].is(source)) continue;
|
|
12442
12538
|
const jsonPointer = source.operationIndex.get(operationId);
|
|
@@ -12448,7 +12544,11 @@ class OpenAPIOperationLocatorNormalizer extends _SourceDescriptionsLocatorNormal
|
|
|
12448
12544
|
}
|
|
12449
12545
|
return {
|
|
12450
12546
|
document: source,
|
|
12451
|
-
jsonPointer
|
|
12547
|
+
jsonPointer,
|
|
12548
|
+
sourceDescription: {
|
|
12549
|
+
name,
|
|
12550
|
+
documentURI: document.uri
|
|
12551
|
+
}
|
|
12452
12552
|
};
|
|
12453
12553
|
}
|
|
12454
12554
|
|
|
@@ -12620,6 +12720,13 @@ const STEP_TARGET_FIELDS = ['operationId', 'operationPath', 'workflowId'];
|
|
|
12620
12720
|
* @internal
|
|
12621
12721
|
*/
|
|
12622
12722
|
|
|
12723
|
+
/**
|
|
12724
|
+
* The execute options of a step: the opaque bag forwarded to the operation
|
|
12725
|
+
* executor, or a function returning it for the operation the step was located
|
|
12726
|
+
* to.
|
|
12727
|
+
* @public
|
|
12728
|
+
*/
|
|
12729
|
+
|
|
12623
12730
|
/**
|
|
12624
12731
|
* Executes a single Arazzo step that invokes an OpenAPI operation.
|
|
12625
12732
|
*
|
|
@@ -12682,7 +12789,9 @@ class StepExecutor {
|
|
|
12682
12789
|
* `executeOptions` is an opaque bag passed through to the operation executor
|
|
12683
12790
|
* (e.g. a `server` to run the step against, or an `AbortSignal`). The
|
|
12684
12791
|
* Arazzo-derived options (`operationId`, `parameters`, `requestBody`) always
|
|
12685
|
-
* take precedence over it.
|
|
12792
|
+
* take precedence over it. A function is called with the operation the step
|
|
12793
|
+
* was located to and returns the bag, for options that depend on which API
|
|
12794
|
+
* the step calls.
|
|
12686
12795
|
*
|
|
12687
12796
|
* A `signal` in that bag is honored here and not only at the transport: an
|
|
12688
12797
|
* already-aborted signal throws with reason `ExecutionError.Aborted` instead of issuing a
|
|
@@ -12724,6 +12833,7 @@ class StepExecutor {
|
|
|
12724
12833
|
// Pointer) locator that the operation executor extracts, normalizes,
|
|
12725
12834
|
// assembles into a standalone doc, and runs.
|
|
12726
12835
|
const locator = await this.#locateOperation(step, scope);
|
|
12836
|
+
const operationOptions = typeof executeOptions === 'function' ? executeOptions(locator) : executeOptions;
|
|
12727
12837
|
|
|
12728
12838
|
// resolve parameters and request body against the pre-request context.
|
|
12729
12839
|
// keyed by '{in}.{name}' rather than bare name, so two parameters that
|
|
@@ -12737,18 +12847,20 @@ class StepExecutor {
|
|
|
12737
12847
|
// still reach this line — and this is the last moment before the step has a
|
|
12738
12848
|
// live side effect. The signal stays in the bag, so a request already in
|
|
12739
12849
|
// flight is aborted by the transport as before.
|
|
12740
|
-
const signal = (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.readAbortSignal)(
|
|
12850
|
+
const signal = (0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.readAbortSignal)(operationOptions);
|
|
12741
12851
|
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_13__.throwIfAborted)(signal, scope);
|
|
12742
12852
|
|
|
12743
|
-
// the Arazzo-derived parameters
|
|
12744
|
-
// executeOptions bag so they take precedence over it. the
|
|
12745
|
-
// then forces the operation target on top of this
|
|
12853
|
+
// the Arazzo-derived parameters, request body and step identity are spread
|
|
12854
|
+
// after the opaque executeOptions bag so they take precedence over it. the
|
|
12855
|
+
// operation executor then forces the operation target on top of this
|
|
12856
|
+
// before executing.
|
|
12746
12857
|
let response;
|
|
12747
12858
|
try {
|
|
12748
12859
|
response = await this.#operationExecutor.execute(locator, {
|
|
12749
|
-
...
|
|
12860
|
+
...operationOptions,
|
|
12750
12861
|
parameters,
|
|
12751
|
-
...this.#requestBodyOptions(requestBody)
|
|
12862
|
+
...this.#requestBodyOptions(requestBody),
|
|
12863
|
+
step: scope
|
|
12752
12864
|
});
|
|
12753
12865
|
} catch (error) {
|
|
12754
12866
|
// a transport that honors the signal rejects the request it was told to
|
|
@@ -13559,22 +13671,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13559
13671
|
/* harmony export */ settledResult: () => (/* binding */ settledResult)
|
|
13560
13672
|
/* harmony export */ });
|
|
13561
13673
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7456);
|
|
13562
|
-
/* harmony import */ var
|
|
13563
|
-
/* harmony import */ var
|
|
13564
|
-
/* harmony import */ var
|
|
13565
|
-
/* harmony import */ var
|
|
13566
|
-
/* harmony import */ var
|
|
13567
|
-
/* harmony import */ var
|
|
13568
|
-
/* harmony import */ var
|
|
13569
|
-
/* harmony import */ var
|
|
13570
|
-
/* harmony import */ var
|
|
13571
|
-
/* harmony import */ var
|
|
13572
|
-
/* harmony import */ var
|
|
13573
|
-
/* harmony import */ var
|
|
13574
|
-
/* harmony import */ var
|
|
13575
|
-
/* harmony import */ var
|
|
13576
|
-
/* harmony import */ var
|
|
13577
|
-
/* harmony import */ var
|
|
13674
|
+
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34606);
|
|
13675
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(62823);
|
|
13676
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(75728);
|
|
13677
|
+
/* harmony import */ var _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(77370);
|
|
13678
|
+
/* harmony import */ var _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(77447);
|
|
13679
|
+
/* harmony import */ var _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(75055);
|
|
13680
|
+
/* harmony import */ var _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(99494);
|
|
13681
|
+
/* harmony import */ var _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(95839);
|
|
13682
|
+
/* harmony import */ var _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(61596);
|
|
13683
|
+
/* harmony import */ var _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(96007);
|
|
13684
|
+
/* harmony import */ var _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(98885);
|
|
13685
|
+
/* harmony import */ var _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(18760);
|
|
13686
|
+
/* harmony import */ var _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(64661);
|
|
13687
|
+
/* harmony import */ var _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(2835);
|
|
13688
|
+
/* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(17658);
|
|
13689
|
+
/* harmony import */ var _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(8696);
|
|
13690
|
+
/* harmony import */ var _abort_ts__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(99628);
|
|
13691
|
+
|
|
13578
13692
|
|
|
13579
13693
|
|
|
13580
13694
|
|
|
@@ -13731,24 +13845,24 @@ class WorkflowExecutor {
|
|
|
13731
13845
|
#maxSteps;
|
|
13732
13846
|
#maxWorkflowDepth;
|
|
13733
13847
|
#now;
|
|
13734
|
-
#extractor = new
|
|
13848
|
+
#extractor = new _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_5__["default"]();
|
|
13735
13849
|
#normalizer;
|
|
13736
|
-
#outputResolver = new
|
|
13737
|
-
#parameterResolver = new
|
|
13850
|
+
#outputResolver = new _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_7__["default"]();
|
|
13851
|
+
#parameterResolver = new _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_8__["default"]();
|
|
13738
13852
|
#stepExecutor;
|
|
13739
13853
|
#retryRunner;
|
|
13740
|
-
#interpreter = new
|
|
13854
|
+
#interpreter = new _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_14__["default"]();
|
|
13741
13855
|
#workflowLocatorNormalizer;
|
|
13742
13856
|
constructor(options) {
|
|
13743
13857
|
this.#document = options.document;
|
|
13744
13858
|
this.#registry = options.registry;
|
|
13745
|
-
this.#workflowLocatorNormalizer = new
|
|
13746
|
-
this.#normalizer = options.workflowNormalizer ?? new
|
|
13859
|
+
this.#workflowLocatorNormalizer = new _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_11__["default"](options.registry);
|
|
13860
|
+
this.#normalizer = options.workflowNormalizer ?? new _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_6__["default"]();
|
|
13747
13861
|
this.#maxSteps = options.maxSteps ?? WorkflowExecutor.#DEFAULT_MAX_STEPS;
|
|
13748
13862
|
this.#maxWorkflowDepth = options.maxWorkflowDepth ?? WorkflowExecutor.#DEFAULT_MAX_WORKFLOW_DEPTH;
|
|
13749
13863
|
this.#now = options.now ?? WorkflowExecutor.#DEFAULT_NOW;
|
|
13750
13864
|
this.#stepExecutor = options.stepExecutor;
|
|
13751
|
-
this.#retryRunner = new
|
|
13865
|
+
this.#retryRunner = new _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_12__["default"]({
|
|
13752
13866
|
sleep: options.sleep
|
|
13753
13867
|
});
|
|
13754
13868
|
}
|
|
@@ -13766,23 +13880,21 @@ class WorkflowExecutor {
|
|
|
13766
13880
|
*/
|
|
13767
13881
|
async execute(workflowId, options = {}) {
|
|
13768
13882
|
this.#rejectUnknownOptions(options);
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
// abort requests while the loop walked on through the remaining steps.
|
|
13774
|
-
const signal = options.signal ?? (0,_abort_ts__WEBPACK_IMPORTED_MODULE_16__.readAbortSignal)(options.executeOptions ?? {});
|
|
13883
|
+
const {
|
|
13884
|
+
signal
|
|
13885
|
+
} = options;
|
|
13886
|
+
const executeOptions = this.#executeOptionsByDocument(options.executeOptions ?? {});
|
|
13775
13887
|
const scope = {
|
|
13776
|
-
// the
|
|
13777
|
-
//
|
|
13778
|
-
//
|
|
13779
|
-
//
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
},
|
|
13888
|
+
// the signal is put into every step's opaque bag, because that bag is
|
|
13889
|
+
// how anything reaches the transport: the executor's own checks stop the
|
|
13890
|
+
// run at the next boundary, and this is what cancels the request already
|
|
13891
|
+
// in flight. Set even when absent, so a `signal` in an entry never
|
|
13892
|
+
// stands in for it: that one would cancel the steps of a single API and
|
|
13893
|
+
// leave the run walking on.
|
|
13894
|
+
executeOptions: locator => ({
|
|
13895
|
+
...executeOptions.get(locator.document.uri),
|
|
13896
|
+
signal
|
|
13897
|
+
}),
|
|
13786
13898
|
dependencyInputs: options.dependencyInputs ?? {},
|
|
13787
13899
|
runDependencies: options.runDependencies ?? true,
|
|
13788
13900
|
signal,
|
|
@@ -13795,12 +13907,47 @@ class WorkflowExecutor {
|
|
|
13795
13907
|
return this.#run({
|
|
13796
13908
|
document: this.#document,
|
|
13797
13909
|
workflowId
|
|
13798
|
-
}, options.inputs ?? {}, scope, new
|
|
13910
|
+
}, options.inputs ?? {}, scope, new _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_13__["default"]({
|
|
13799
13911
|
maxDepth: this.#maxWorkflowDepth,
|
|
13800
13912
|
entryDocumentURI: this.#document.uri
|
|
13801
13913
|
}), 'root');
|
|
13802
13914
|
}
|
|
13803
13915
|
|
|
13916
|
+
/**
|
|
13917
|
+
* Resolves the `executeOptions` entries to the documents they configure,
|
|
13918
|
+
* keyed by canonical document URI.
|
|
13919
|
+
*
|
|
13920
|
+
* Every way an entry can fail to name exactly one OpenAPI document throws
|
|
13921
|
+
* here, before the run starts: sent to no API or to two, its options would
|
|
13922
|
+
* be missing or misdirected with nothing to show for it until a request
|
|
13923
|
+
* failed.
|
|
13924
|
+
*/
|
|
13925
|
+
#executeOptionsByDocument(executeOptions) {
|
|
13926
|
+
const byDocument = new Map();
|
|
13927
|
+
const fail = (name, problem, reason) => {
|
|
13928
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`executeOptions is keyed by source description name, and "${name}" ${problem}`, {
|
|
13929
|
+
reason
|
|
13930
|
+
});
|
|
13931
|
+
};
|
|
13932
|
+
for (const [name, options] of Object.entries(executeOptions)) {
|
|
13933
|
+
const uri = this.#document.resolveSourceDescriptionURI(name);
|
|
13934
|
+
if (uri === undefined) {
|
|
13935
|
+
return fail(name, `names no source description with a url in the Arazzo document at "${this.#document.uri}"`, _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].SourceDescriptionNotFound);
|
|
13936
|
+
}
|
|
13937
|
+
if (this.#document.resolveSourceDescriptionField(name, 'type') === 'arazzo') {
|
|
13938
|
+
fail(name, 'names an Arazzo document', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].SourceDescriptionNotOpenAPI);
|
|
13939
|
+
}
|
|
13940
|
+
if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(options)) {
|
|
13941
|
+
fail(name, 'is not given an object of options', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownExecuteOption);
|
|
13942
|
+
}
|
|
13943
|
+
if (byDocument.has(uri)) {
|
|
13944
|
+
fail(name, `points at "${uri}", which another entry already configures`, _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousExecuteOptions);
|
|
13945
|
+
}
|
|
13946
|
+
byDocument.set(uri, options);
|
|
13947
|
+
}
|
|
13948
|
+
return byDocument;
|
|
13949
|
+
}
|
|
13950
|
+
|
|
13804
13951
|
/**
|
|
13805
13952
|
* Rejects an options bag carrying keys this method does not recognize.
|
|
13806
13953
|
*
|
|
@@ -13814,8 +13961,8 @@ class WorkflowExecutor {
|
|
|
13814
13961
|
#rejectUnknownOptions(options) {
|
|
13815
13962
|
const unknown = Object.keys(options).filter(key => !WorkflowExecutor.#EXECUTE_OPTION_KEYS.has(key));
|
|
13816
13963
|
if (unknown.length === 0) return;
|
|
13817
|
-
throw new
|
|
13818
|
-
reason:
|
|
13964
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`execute received unknown option(s) ${unknown.join(', ')}; it takes (workflowId, { inputs, executeOptions, dependencyInputs, runDependencies, signal }) — workflow inputs go under "inputs"`, {
|
|
13965
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownExecuteOption
|
|
13819
13966
|
});
|
|
13820
13967
|
}
|
|
13821
13968
|
|
|
@@ -13841,12 +13988,12 @@ class WorkflowExecutor {
|
|
|
13841
13988
|
// run cancelled before any step — or between a prerequisite and the workflow
|
|
13842
13989
|
// that needed it — must not go on to normalize and enter a workflow nobody
|
|
13843
13990
|
// is waiting for.
|
|
13844
|
-
(0,
|
|
13991
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
|
|
13845
13992
|
workflowId,
|
|
13846
13993
|
callStack: nested
|
|
13847
13994
|
});
|
|
13848
13995
|
const workflow = await this.#resolveWorkflow(locator, scope);
|
|
13849
|
-
const state = new
|
|
13996
|
+
const state = new _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
13850
13997
|
inputs
|
|
13851
13998
|
});
|
|
13852
13999
|
const invocation = {
|
|
@@ -13888,7 +14035,7 @@ class WorkflowExecutor {
|
|
|
13888
14035
|
// result carrying the dependency trace, not a throw — and none of its own
|
|
13889
14036
|
// steps run. Unless the run was cancelled, in which case the prerequisite
|
|
13890
14037
|
// did not fail on its own terms either.
|
|
13891
|
-
(0,
|
|
14038
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
|
|
13892
14039
|
workflowId,
|
|
13893
14040
|
callStack: nested
|
|
13894
14041
|
});
|
|
@@ -13958,7 +14105,7 @@ class WorkflowExecutor {
|
|
|
13958
14105
|
break;
|
|
13959
14106
|
case 'goto':
|
|
13960
14107
|
index = this.#interpreter.indexOfStep(steps, transition.stepId, workflowId, {
|
|
13961
|
-
reason:
|
|
14108
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].GotoTargetNotFound,
|
|
13962
14109
|
label: 'goto target'
|
|
13963
14110
|
});
|
|
13964
14111
|
break;
|
|
@@ -13971,7 +14118,7 @@ class WorkflowExecutor {
|
|
|
13971
14118
|
// resolution, so an aborted run reports `aborted` rather than
|
|
13972
14119
|
// whatever resolving the target (a malformed reference, a missing
|
|
13973
14120
|
// source) would have thrown.
|
|
13974
|
-
(0,
|
|
14121
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
|
|
13975
14122
|
workflowId,
|
|
13976
14123
|
stepId,
|
|
13977
14124
|
callStack: nested
|
|
@@ -14002,10 +14149,10 @@ class WorkflowExecutor {
|
|
|
14002
14149
|
// loudly — `transition` is provably `never` once every kind above
|
|
14003
14150
|
// has its own case, which TypeScript checks at compile time.
|
|
14004
14151
|
const unreachable = transition;
|
|
14005
|
-
throw new
|
|
14152
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`step "${stepId}" in workflow "${workflowId}" produced an unrecognized transition ${JSON.stringify(unreachable)}`, {
|
|
14006
14153
|
workflowId,
|
|
14007
14154
|
stepId,
|
|
14008
|
-
reason:
|
|
14155
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].UnknownTransitionKind
|
|
14009
14156
|
});
|
|
14010
14157
|
}
|
|
14011
14158
|
}
|
|
@@ -14017,7 +14164,7 @@ class WorkflowExecutor {
|
|
|
14017
14164
|
// transport, since one honoring the signal fails the request instead.
|
|
14018
14165
|
// Cancellation must not be the one outcome that reads differently for the
|
|
14019
14166
|
// last step than for every step before it.
|
|
14020
|
-
;(0,
|
|
14167
|
+
;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
|
|
14021
14168
|
workflowId,
|
|
14022
14169
|
callStack: nested
|
|
14023
14170
|
});
|
|
@@ -14090,10 +14237,10 @@ class WorkflowExecutor {
|
|
|
14090
14237
|
*/
|
|
14091
14238
|
#chargeBudget(scope, invocation, stepId) {
|
|
14092
14239
|
if (++scope.budget.spent <= this.#maxSteps) return;
|
|
14093
|
-
throw new
|
|
14240
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${invocation.workflowId}" exceeded its budget of ${this.#maxSteps} step attempts (a goto loop, excessive retries, or runaway sub-workflow calls)`, {
|
|
14094
14241
|
workflowId: invocation.workflowId,
|
|
14095
14242
|
stepId,
|
|
14096
|
-
reason:
|
|
14243
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].StepBudget,
|
|
14097
14244
|
path: invocation.callStack.path
|
|
14098
14245
|
});
|
|
14099
14246
|
}
|
|
@@ -14116,7 +14263,7 @@ class WorkflowExecutor {
|
|
|
14116
14263
|
callStack
|
|
14117
14264
|
} = invocation;
|
|
14118
14265
|
return async () => {
|
|
14119
|
-
(0,
|
|
14266
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
|
|
14120
14267
|
workflowId,
|
|
14121
14268
|
stepId,
|
|
14122
14269
|
callStack
|
|
@@ -14125,7 +14272,7 @@ class WorkflowExecutor {
|
|
|
14125
14272
|
try {
|
|
14126
14273
|
return await runAttempt();
|
|
14127
14274
|
} catch (error) {
|
|
14128
|
-
;(0,
|
|
14275
|
+
;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
|
|
14129
14276
|
workflowId,
|
|
14130
14277
|
stepId,
|
|
14131
14278
|
callStack
|
|
@@ -14185,7 +14332,7 @@ class WorkflowExecutor {
|
|
|
14185
14332
|
callStack
|
|
14186
14333
|
} = invocation;
|
|
14187
14334
|
return async (action, outcome) => {
|
|
14188
|
-
(0,
|
|
14335
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_17__.throwIfAborted)(scope.signal, {
|
|
14189
14336
|
workflowId,
|
|
14190
14337
|
stepId,
|
|
14191
14338
|
callStack
|
|
@@ -14193,12 +14340,12 @@ class WorkflowExecutor {
|
|
|
14193
14340
|
const {
|
|
14194
14341
|
hasStepId,
|
|
14195
14342
|
hasWorkflowId
|
|
14196
|
-
} = (0,
|
|
14343
|
+
} = (0,_StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_14__.actionTargets)(action);
|
|
14197
14344
|
if (hasWorkflowId && hasStepId) {
|
|
14198
|
-
throw new
|
|
14345
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`retry action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
|
|
14199
14346
|
stepId,
|
|
14200
14347
|
workflowId,
|
|
14201
|
-
reason:
|
|
14348
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousTarget
|
|
14202
14349
|
});
|
|
14203
14350
|
}
|
|
14204
14351
|
if (hasWorkflowId) {
|
|
@@ -14225,7 +14372,7 @@ class WorkflowExecutor {
|
|
|
14225
14372
|
}
|
|
14226
14373
|
const refStepId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(action.stepId);
|
|
14227
14374
|
const refIndex = this.#interpreter.indexOfStep(steps, refStepId, workflowId, {
|
|
14228
|
-
reason:
|
|
14375
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].RetryTargetNotFound,
|
|
14229
14376
|
label: 'retry reference'
|
|
14230
14377
|
});
|
|
14231
14378
|
const refStep = steps[refIndex];
|
|
@@ -14341,17 +14488,17 @@ class WorkflowExecutor {
|
|
|
14341
14488
|
document
|
|
14342
14489
|
} = invocation;
|
|
14343
14490
|
const dependsOn = workflow.dependsOn;
|
|
14344
|
-
if (!(0,
|
|
14345
|
-
throw new
|
|
14491
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(dependsOn)) {
|
|
14492
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-list "dependsOn"`, {
|
|
14346
14493
|
workflowId,
|
|
14347
|
-
reason:
|
|
14494
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedDependsOn
|
|
14348
14495
|
});
|
|
14349
14496
|
}
|
|
14350
14497
|
const references = [...dependsOn].map((entry, index) => {
|
|
14351
|
-
if (!(0,
|
|
14352
|
-
throw new
|
|
14498
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(entry)) {
|
|
14499
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-string entry at dependsOn[${index}]`, {
|
|
14353
14500
|
workflowId,
|
|
14354
|
-
reason:
|
|
14501
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedDependsOn
|
|
14355
14502
|
});
|
|
14356
14503
|
}
|
|
14357
14504
|
return (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(entry);
|
|
@@ -14392,7 +14539,7 @@ class WorkflowExecutor {
|
|
|
14392
14539
|
state,
|
|
14393
14540
|
callStack
|
|
14394
14541
|
} = invocation;
|
|
14395
|
-
if (!(0,
|
|
14542
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(step.workflowId)) {
|
|
14396
14543
|
return () => this.#stepExecutor.forDocument(document).execute(step, state, scope.executeOptions, workflowId);
|
|
14397
14544
|
}
|
|
14398
14545
|
const reference = this.#subWorkflowReference(step, stepId, workflowId);
|
|
@@ -14532,12 +14679,12 @@ class WorkflowExecutor {
|
|
|
14532
14679
|
// the same check, but a sub-workflow step never reaches it — so both read
|
|
14533
14680
|
// the one list of target fields, and a target added to the specification
|
|
14534
14681
|
// cannot be rejected by one and silently accepted by the other.
|
|
14535
|
-
const conflicting =
|
|
14682
|
+
const conflicting = _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_10__.STEP_TARGET_FIELDS.filter(field => field !== 'workflowId' && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(step[field]));
|
|
14536
14683
|
if (conflicting.length > 0) {
|
|
14537
|
-
throw new
|
|
14684
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`step "${stepId}" in workflow "${workflowId}" declares a workflowId alongside ${conflicting.join(', ')} (mutually exclusive)`, {
|
|
14538
14685
|
stepId,
|
|
14539
14686
|
workflowId,
|
|
14540
|
-
reason:
|
|
14687
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].AmbiguousTarget
|
|
14541
14688
|
});
|
|
14542
14689
|
}
|
|
14543
14690
|
return (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.workflowId);
|
|
@@ -14606,9 +14753,9 @@ class WorkflowExecutor {
|
|
|
14606
14753
|
#assertActionParameters(lists, workflowId, stepId) {
|
|
14607
14754
|
const owner = stepId === undefined ? `workflow "${workflowId}"` : `step "${stepId}" in workflow "${workflowId}"`;
|
|
14608
14755
|
for (const actions of lists) {
|
|
14609
|
-
if (!(0,
|
|
14756
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(actions)) continue;
|
|
14610
14757
|
for (const action of actions) {
|
|
14611
|
-
if (!(0,
|
|
14758
|
+
if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isSuccessActionElement)(action) && !(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isFailureActionElement)(action)) continue;
|
|
14612
14759
|
if (!action.hasKey('parameters')) continue;
|
|
14613
14760
|
const scope = {
|
|
14614
14761
|
workflowId,
|
|
@@ -14620,17 +14767,17 @@ class WorkflowExecutor {
|
|
|
14620
14767
|
const {
|
|
14621
14768
|
parameters
|
|
14622
14769
|
} = action;
|
|
14623
|
-
if (!(0,
|
|
14624
|
-
throw new
|
|
14770
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(parameters)) {
|
|
14771
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"]('`parameters` is present but is not a list', {
|
|
14625
14772
|
...scope,
|
|
14626
|
-
reason:
|
|
14773
|
+
reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"].MalformedParameters
|
|
14627
14774
|
});
|
|
14628
14775
|
}
|
|
14629
|
-
const inline = [...parameters].some(parameter => (0,
|
|
14776
|
+
const inline = [...parameters].some(parameter => (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isParameterElement)(parameter) && parameter.hasKey('in') && !parameter.meta.hasKey('ref-fields'));
|
|
14630
14777
|
if (inline) {
|
|
14631
|
-
throw new
|
|
14778
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"](`An action parameter of ${owner} declares an \`in\`; action parameters map to the target workflow's inputs by name`, {
|
|
14632
14779
|
...scope,
|
|
14633
|
-
reason:
|
|
14780
|
+
reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"].ActionParameterLocation
|
|
14634
14781
|
});
|
|
14635
14782
|
}
|
|
14636
14783
|
}
|
|
@@ -14656,9 +14803,9 @@ class WorkflowExecutor {
|
|
|
14656
14803
|
const cached = scope.workflows.get(qualifiedId);
|
|
14657
14804
|
if (cached !== undefined) return cached;
|
|
14658
14805
|
if (!document.workflowIndex.has(workflowId)) {
|
|
14659
|
-
throw new
|
|
14806
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" not found in Arazzo document at "${document.uri}"`, {
|
|
14660
14807
|
workflowId,
|
|
14661
|
-
reason:
|
|
14808
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].WorkflowNotFound
|
|
14662
14809
|
});
|
|
14663
14810
|
}
|
|
14664
14811
|
const workflow = await this.#normalizer.normalize(this.#extractor.extract(document, workflowId), document);
|
|
@@ -14686,17 +14833,17 @@ class WorkflowExecutor {
|
|
|
14686
14833
|
#orderedSteps(workflow, workflowId) {
|
|
14687
14834
|
if (!workflow.hasKey('steps')) return [];
|
|
14688
14835
|
const steps = workflow.steps;
|
|
14689
|
-
if (!(0,
|
|
14690
|
-
throw new
|
|
14836
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isArrayElement)(steps)) {
|
|
14837
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-list "steps"`, {
|
|
14691
14838
|
workflowId,
|
|
14692
|
-
reason:
|
|
14839
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedSteps
|
|
14693
14840
|
});
|
|
14694
14841
|
}
|
|
14695
14842
|
return [...steps].map((step, index) => {
|
|
14696
|
-
if (!(0,
|
|
14697
|
-
throw new
|
|
14843
|
+
if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_3__.isStepElement)(step)) {
|
|
14844
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"](`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
|
|
14698
14845
|
workflowId,
|
|
14699
|
-
reason:
|
|
14846
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_15__["default"].MalformedSteps
|
|
14700
14847
|
});
|
|
14701
14848
|
}
|
|
14702
14849
|
return step;
|
|
@@ -14715,11 +14862,11 @@ class WorkflowExecutor {
|
|
|
14715
14862
|
#validateWorkflowOutputsShape(workflow, workflowId) {
|
|
14716
14863
|
if (!workflow.hasKey('outputs')) return;
|
|
14717
14864
|
const outputs = workflow.outputs;
|
|
14718
|
-
if ((0,
|
|
14719
|
-
throw new
|
|
14865
|
+
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isObjectElement)(outputs)) return;
|
|
14866
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"]('`outputs` is present but is not a map', {
|
|
14720
14867
|
workflowId,
|
|
14721
14868
|
target: 'outputs',
|
|
14722
|
-
reason:
|
|
14869
|
+
reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_16__["default"].MalformedOutputs
|
|
14723
14870
|
});
|
|
14724
14871
|
}
|
|
14725
14872
|
|
|
@@ -14742,7 +14889,7 @@ class WorkflowExecutor {
|
|
|
14742
14889
|
* counterpart of {@link StepExecutor}'s bridge.
|
|
14743
14890
|
*/
|
|
14744
14891
|
#evaluate(context, expression, document) {
|
|
14745
|
-
return new
|
|
14892
|
+
return new _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_4__["default"](context, {
|
|
14746
14893
|
strict: false,
|
|
14747
14894
|
document,
|
|
14748
14895
|
registry: this.#registry
|