@usearazzo/runner 1.0.1-alpha.33 → 1.0.1-alpha.35
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 +22 -0
- package/README.md +15 -1
- package/dist/arazzo-runner.browser.js +1516 -265
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +64 -18
- package/src/ArazzoRunner.cjs +26 -3
- package/src/ArazzoRunner.mjs +26 -3
- package/src/client/OpenAPIOperationResponse.cjs +9 -0
- package/src/client/OpenAPIOperationResponse.mjs +9 -0
- package/src/document/APIDocument.cjs +53 -0
- package/src/document/APIDocument.mjs +53 -0
- package/src/errors/ExecutionError.cjs +2 -0
- package/src/errors/ExecutionError.mjs +2 -0
- package/src/executor/OpenAPIOperationExecutor.cjs +77 -6
- package/src/executor/OpenAPIOperationExecutor.mjs +77 -6
- package/src/executor/StepExecutor.cjs +16 -2
- package/src/executor/StepExecutor.mjs +16 -2
- package/src/executor/StepRetryRunner.cjs +5 -3
- package/src/executor/StepRetryRunner.mjs +5 -3
- package/src/executor/StepTransitionInterpreter.cjs +1 -1
- package/src/executor/StepTransitionInterpreter.mjs +1 -1
- package/src/executor/WorkflowCallStack.cjs +1 -1
- package/src/executor/WorkflowCallStack.mjs +1 -1
- package/src/executor/WorkflowExecutor.cjs +447 -89
- package/src/executor/WorkflowExecutor.mjs +447 -89
- package/src/index.cjs +21 -0
- package/src/index.mjs +4 -0
- package/src/observability/ArazzoRunnerEvent.cjs +5 -0
- package/src/observability/ArazzoRunnerEvent.mjs +1 -0
- package/src/observability/DocumentRegistryEvent.cjs +5 -0
- package/src/observability/DocumentRegistryEvent.mjs +1 -0
- package/src/observability/EventChannel.cjs +106 -0
- package/src/observability/EventChannel.mjs +98 -0
- package/src/observability/OpenAPIOperationEvent.cjs +5 -0
- package/src/observability/OpenAPIOperationEvent.mjs +1 -0
- package/src/observability/Redactor.cjs +215 -0
- package/src/observability/Redactor.mjs +210 -0
- package/src/observability/WorkflowExecutionEvent.cjs +5 -0
- package/src/observability/WorkflowExecutionEvent.mjs +1 -0
- package/src/observability/combineObservers.cjs +18 -0
- package/src/observability/combineObservers.mjs +12 -0
- package/src/observability/instrument.cjs +159 -0
- package/src/observability/instrument.mjs +144 -0
- package/src/observability/logging/LoggingObserver.cjs +177 -0
- package/src/observability/logging/LoggingObserver.mjs +172 -0
- package/src/observability/logging/index.cjs +13 -0
- package/src/observability/logging/index.mjs +1 -0
- package/src/observability/opentelemetry/ArazzoRunnerInstrumentation.cjs +321 -0
- package/src/observability/opentelemetry/ArazzoRunnerInstrumentation.mjs +313 -0
- package/src/observability/opentelemetry/index.cjs +13 -0
- package/src/observability/opentelemetry/index.mjs +1 -0
- package/src/observability/stream/EventStream.cjs +112 -0
- package/src/observability/stream/EventStream.mjs +107 -0
- package/src/observability/stream/index.cjs +13 -0
- package/src/observability/stream/index.mjs +1 -0
- package/src/registry/DocumentRegistry.cjs +27 -3
- package/src/registry/DocumentRegistry.mjs +27 -3
- package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +20 -0
- package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +21 -1
- package/src/registry/providers/DocumentRegistryProvider.cjs +14 -0
- package/src/registry/providers/DocumentRegistryProvider.mjs +14 -0
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +27 -5
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +27 -5
- package/src/version.cjs +9 -0
- package/src/version.mjs +3 -0
- package/types/observability/logging/LoggingObserver.d.ts +82 -0
- package/types/observability/logging/index.d.ts +2 -0
- package/types/observability/opentelemetry/ArazzoRunnerInstrumentation.d.ts +84 -0
- package/types/observability/opentelemetry/index.d.ts +2 -0
- package/types/observability/stream/EventStream.d.ts +68 -0
- package/types/observability/stream/index.d.ts +2 -0
- package/types/runner.d.ts +802 -5
|
@@ -8859,8 +8859,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8859
8859
|
* Every option is a seam of a building block the runner wires: `registry` is
|
|
8860
8860
|
* the {@link DocumentRegistry} the documents load into (a fresh one with the
|
|
8861
8861
|
* default providers when omitted), `reference` goes to everything the runner
|
|
8862
|
-
* builds that retrieves documents, `httpClient
|
|
8863
|
-
* the {@link OpenAPIOperationExecutor}, and the rest go
|
|
8862
|
+
* builds that retrieves documents, `httpClient`, `requestInterceptor` and
|
|
8863
|
+
* `captureBodies` go to the {@link OpenAPIOperationExecutor}, and the rest go
|
|
8864
|
+
* to the
|
|
8864
8865
|
* {@link WorkflowExecutor}.
|
|
8865
8866
|
*
|
|
8866
8867
|
* Retrieving documents and calling APIs are separate on purpose: `reference`
|
|
@@ -8901,10 +8902,24 @@ class ArazzoRunner {
|
|
|
8901
8902
|
static async load(uri, options = {}) {
|
|
8902
8903
|
// `resolve` only, whatever else the given object carries
|
|
8903
8904
|
const referenceOptions = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['resolve'], options.reference ?? {});
|
|
8905
|
+
// source maps need the non-strict parsers, which are the ones that keep
|
|
8906
|
+
// positions
|
|
8907
|
+
const providerOptions = options.sourceMap ? {
|
|
8908
|
+
...referenceOptions,
|
|
8909
|
+
parse: {
|
|
8910
|
+
parserOpts: {
|
|
8911
|
+
sourceMap: true,
|
|
8912
|
+
strict: false
|
|
8913
|
+
}
|
|
8914
|
+
}
|
|
8915
|
+
} : referenceOptions;
|
|
8904
8916
|
const {
|
|
8905
8917
|
registry = new _registry_DocumentRegistry_ts__WEBPACK_IMPORTED_MODULE_1__["default"]({
|
|
8906
|
-
providers: [new _registry_providers_ArazzoDocumentRegistryProvider_ts__WEBPACK_IMPORTED_MODULE_2__["default"](
|
|
8918
|
+
providers: [new _registry_providers_ArazzoDocumentRegistryProvider_ts__WEBPACK_IMPORTED_MODULE_2__["default"](providerOptions), new _registry_providers_OpenAPIDocumentRegistryProvider_ts__WEBPACK_IMPORTED_MODULE_3__["default"](providerOptions)],
|
|
8919
|
+
observer: options.observer,
|
|
8920
|
+
now: options.now
|
|
8907
8921
|
}),
|
|
8922
|
+
sourceMap: _sourceMap,
|
|
8908
8923
|
...rest
|
|
8909
8924
|
} = options;
|
|
8910
8925
|
// acquiring a second entry would pin it for good and, through the LRU
|
|
@@ -8936,6 +8951,7 @@ class ArazzoRunner {
|
|
|
8936
8951
|
reference,
|
|
8937
8952
|
httpClient,
|
|
8938
8953
|
requestInterceptor,
|
|
8954
|
+
captureBodies,
|
|
8939
8955
|
...workflowExecutorOptions
|
|
8940
8956
|
} = options;
|
|
8941
8957
|
|
|
@@ -8949,9 +8965,16 @@ class ArazzoRunner {
|
|
|
8949
8965
|
|
|
8950
8966
|
// `resolve` only, whatever else the given object carries
|
|
8951
8967
|
const referenceOptions = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['resolve'], reference ?? {});
|
|
8968
|
+
const {
|
|
8969
|
+
observer,
|
|
8970
|
+
now
|
|
8971
|
+
} = workflowExecutorOptions;
|
|
8952
8972
|
const operationExecutor = new _executor_OpenAPIOperationExecutor_ts__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
8953
8973
|
httpClient,
|
|
8954
8974
|
requestInterceptor,
|
|
8975
|
+
captureBodies,
|
|
8976
|
+
observer,
|
|
8977
|
+
now,
|
|
8955
8978
|
operationNormalizer: new _normalizer_OpenAPIOperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_5__["default"]({
|
|
8956
8979
|
openapi2: new _normalizer_OpenAPI2OperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_6__["default"](referenceOptions),
|
|
8957
8980
|
openapi30: new _normalizer_OpenAPI30OperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_7__["default"](referenceOptions),
|
|
@@ -9684,6 +9707,15 @@ class OpenAPIOperationResponse {
|
|
|
9684
9707
|
this.request = raw.request;
|
|
9685
9708
|
}
|
|
9686
9709
|
|
|
9710
|
+
/**
|
|
9711
|
+
* The body's size in bytes, as read: after the transport decoded any
|
|
9712
|
+
* `Content-Encoding`, so a compressed body counts at its decoded size.
|
|
9713
|
+
*/
|
|
9714
|
+
get size() {
|
|
9715
|
+
// a string content encodes back to exactly the bytes received
|
|
9716
|
+
return typeof this.#content === 'string' ? new TextEncoder().encode(this.#content).length : this.#content.length;
|
|
9717
|
+
}
|
|
9718
|
+
|
|
9687
9719
|
/**
|
|
9688
9720
|
* The body as text, like `Response.text()`; `''` when there is none.
|
|
9689
9721
|
*/
|
|
@@ -10583,6 +10615,23 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10583
10615
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(87659);
|
|
10584
10616
|
|
|
10585
10617
|
|
|
10618
|
+
/**
|
|
10619
|
+
* A position in a document, as in the Language Server Protocol: a 0-based
|
|
10620
|
+
* line, and a 0-based character offset within it in UTF-16 code units.
|
|
10621
|
+
* @public
|
|
10622
|
+
*/
|
|
10623
|
+
|
|
10624
|
+
/**
|
|
10625
|
+
* A range in a document, as in the Language Server Protocol: from `start` to
|
|
10626
|
+
* `end`, the shape the validator's diagnostics use.
|
|
10627
|
+
* @public
|
|
10628
|
+
*/
|
|
10629
|
+
|
|
10630
|
+
/**
|
|
10631
|
+
* Where an element is written.
|
|
10632
|
+
* @public
|
|
10633
|
+
*/
|
|
10634
|
+
|
|
10586
10635
|
/**
|
|
10587
10636
|
* Base document held by the document registry.
|
|
10588
10637
|
* @public
|
|
@@ -10595,6 +10644,42 @@ class APIDocument {
|
|
|
10595
10644
|
this.parseResult = parseResult;
|
|
10596
10645
|
}
|
|
10597
10646
|
|
|
10647
|
+
/**
|
|
10648
|
+
* Where an element of this document, or one it references, is written, as
|
|
10649
|
+
* the registry provider recorded it when it loaded the document: the
|
|
10650
|
+
* document it came from (its `ref-origin`) when it came through a
|
|
10651
|
+
* reference, and its JSON Pointer there.
|
|
10652
|
+
*/
|
|
10653
|
+
locationOf(element) {
|
|
10654
|
+
const origin = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(element.meta.get('ref-origin'));
|
|
10655
|
+
const jsonPointer = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(element.meta.get('json-pointer'));
|
|
10656
|
+
const {
|
|
10657
|
+
startLine,
|
|
10658
|
+
startCharacter,
|
|
10659
|
+
endLine,
|
|
10660
|
+
endCharacter
|
|
10661
|
+
} = element;
|
|
10662
|
+
return {
|
|
10663
|
+
uri: typeof origin === 'string' ? origin : this.uri,
|
|
10664
|
+
...(typeof jsonPointer === 'string' && {
|
|
10665
|
+
jsonPointer
|
|
10666
|
+
}),
|
|
10667
|
+
// a source-mapped parse positions every element fully, any other none
|
|
10668
|
+
...(startLine !== undefined && {
|
|
10669
|
+
range: {
|
|
10670
|
+
start: {
|
|
10671
|
+
line: startLine,
|
|
10672
|
+
character: startCharacter
|
|
10673
|
+
},
|
|
10674
|
+
end: {
|
|
10675
|
+
line: endLine,
|
|
10676
|
+
character: endCharacter
|
|
10677
|
+
}
|
|
10678
|
+
}
|
|
10679
|
+
})
|
|
10680
|
+
};
|
|
10681
|
+
}
|
|
10682
|
+
|
|
10598
10683
|
/**
|
|
10599
10684
|
* Returns a JSON-serializable representation of the document's API element.
|
|
10600
10685
|
* Compatible with JSON.stringify() — JSON.stringify(doc) produces correct output.
|
|
@@ -11206,6 +11291,8 @@ class ExecutionError extends _ArazzoRunnerError_ts__WEBPACK_IMPORTED_MODULE_0__[
|
|
|
11206
11291
|
static GotoTargetMissing = 'goto-target-missing';
|
|
11207
11292
|
/** A `goto` action's `stepId` names no step in the workflow. */
|
|
11208
11293
|
static GotoTargetNotFound = 'goto-target-not-found';
|
|
11294
|
+
/** A process-wide instrumentation wrap (see `instrument`) settled without running its workflow or step. */
|
|
11295
|
+
static InstrumentationWrap = 'instrumentation-wrap';
|
|
11209
11296
|
/** An `operationId` or `operationPath` is not a valid operation reference. */
|
|
11210
11297
|
static InvalidOperationReference = 'invalid-operation-reference';
|
|
11211
11298
|
/** A `workflowId` is not a valid `$sourceDescriptions.{name}.{workflowId}` expression. */
|
|
@@ -11655,6 +11742,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11655
11742
|
/* harmony import */ var _normalizer_OpenAPIOperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(87864);
|
|
11656
11743
|
/* harmony import */ var _assembler_OpenAPIDocumentAssembler_ts__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(6898);
|
|
11657
11744
|
/* harmony import */ var _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(81763);
|
|
11745
|
+
/* harmony import */ var _observability_EventChannel_ts__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(12993);
|
|
11658
11746
|
|
|
11659
11747
|
|
|
11660
11748
|
|
|
@@ -11674,6 +11762,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11674
11762
|
|
|
11675
11763
|
|
|
11676
11764
|
|
|
11765
|
+
|
|
11677
11766
|
/**
|
|
11678
11767
|
* The Arazzo step a request is issued for: its `stepId`, and the `workflowId`
|
|
11679
11768
|
* of the workflow it belongs to when the caller names one (step ids are only
|
|
@@ -11820,6 +11909,9 @@ class OpenAPIOperationExecutor {
|
|
|
11820
11909
|
#operationExtractor;
|
|
11821
11910
|
#operationNormalizer;
|
|
11822
11911
|
#documentAssembler;
|
|
11912
|
+
#captureBodies;
|
|
11913
|
+
// emits only while `hasObservers`, so an unobserved block builds no events
|
|
11914
|
+
#events;
|
|
11823
11915
|
constructor(options = {}) {
|
|
11824
11916
|
this.#httpClient = options.httpClient ?? _client_HTTPClientFetch_ts__WEBPACK_IMPORTED_MODULE_10__["default"];
|
|
11825
11917
|
this.#requestInterceptor = options.requestInterceptor;
|
|
@@ -11827,6 +11919,11 @@ class OpenAPIOperationExecutor {
|
|
|
11827
11919
|
this.#operationExtractor = options.operationExtractor ?? new _extractor_OpenAPIOperationExtractor_ts__WEBPACK_IMPORTED_MODULE_12__["default"]();
|
|
11828
11920
|
this.#operationNormalizer = options.operationNormalizer ?? new _normalizer_OpenAPIOperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_13__["default"]();
|
|
11829
11921
|
this.#documentAssembler = options.documentAssembler ?? new _assembler_OpenAPIDocumentAssembler_ts__WEBPACK_IMPORTED_MODULE_14__["default"]();
|
|
11922
|
+
this.#events = new _observability_EventChannel_ts__WEBPACK_IMPORTED_MODULE_16__["default"]({
|
|
11923
|
+
observer: options.observer,
|
|
11924
|
+
now: options.now
|
|
11925
|
+
});
|
|
11926
|
+
this.#captureBodies = options.captureBodies ?? false;
|
|
11830
11927
|
}
|
|
11831
11928
|
|
|
11832
11929
|
/**
|
|
@@ -11847,17 +11944,19 @@ class OpenAPIOperationExecutor {
|
|
|
11847
11944
|
// the legacy id (`{method}-{path}`) matches regardless of an explicit
|
|
11848
11945
|
// `operationId` in the assembled document
|
|
11849
11946
|
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')));
|
|
11850
|
-
const normalizedOperation = await this.#operationNormalizer.normalize(operation, locator.document);
|
|
11851
|
-
const assembled = this.#documentAssembler.assemble(normalizedOperation, locator.document);
|
|
11852
|
-
|
|
11853
11947
|
// the interceptor and step are consumed here, the target always comes from
|
|
11854
11948
|
// the locator, and the transport is the httpClient, so none of these
|
|
11855
11949
|
// reach buildRequest
|
|
11856
11950
|
const {
|
|
11857
11951
|
requestInterceptor,
|
|
11858
|
-
step
|
|
11952
|
+
step,
|
|
11953
|
+
runId
|
|
11859
11954
|
} = executeOptions;
|
|
11860
|
-
|
|
11955
|
+
// the operation as extracted from its own document, before normalizing
|
|
11956
|
+
// copies it, carries where it is written; located once, and only for an
|
|
11957
|
+
// observer.
|
|
11958
|
+
let located;
|
|
11959
|
+
const location = () => located ??= locator.document.locationOf(operation);
|
|
11861
11960
|
const declaredOperationId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(operation.operationId);
|
|
11862
11961
|
const context = {
|
|
11863
11962
|
operation: {
|
|
@@ -11880,6 +11979,33 @@ class OpenAPIOperationExecutor {
|
|
|
11880
11979
|
}
|
|
11881
11980
|
})
|
|
11882
11981
|
};
|
|
11982
|
+
if (this.#events.hasObservers) {
|
|
11983
|
+
this.#events.emit({
|
|
11984
|
+
type: 'openapi:operation:normalize:start',
|
|
11985
|
+
...context,
|
|
11986
|
+
runId,
|
|
11987
|
+
location: location()
|
|
11988
|
+
});
|
|
11989
|
+
}
|
|
11990
|
+
const normalizedOperation = await this.#operationNormalizer.normalize(operation, locator.document);
|
|
11991
|
+
if (this.#events.hasObservers) {
|
|
11992
|
+
this.#events.emit({
|
|
11993
|
+
type: 'openapi:operation:normalize:settled',
|
|
11994
|
+
...context,
|
|
11995
|
+
runId,
|
|
11996
|
+
location: location()
|
|
11997
|
+
});
|
|
11998
|
+
}
|
|
11999
|
+
const assembled = this.#documentAssembler.assemble(normalizedOperation, locator.document);
|
|
12000
|
+
if (this.#events.hasObservers) {
|
|
12001
|
+
this.#events.emit({
|
|
12002
|
+
type: 'openapi:operation:assembled',
|
|
12003
|
+
...context,
|
|
12004
|
+
runId,
|
|
12005
|
+
location: location()
|
|
12006
|
+
});
|
|
12007
|
+
}
|
|
12008
|
+
const rest = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(['requestInterceptor', 'step', 'runId', 'operationId', 'operationPath', 'userFetch', 'responseInterceptor'], executeOptions);
|
|
11883
12009
|
|
|
11884
12010
|
// each step derives the next options rather than editing in place
|
|
11885
12011
|
const withServer = this.#applyServerOptions(rest, normalizedOperation, locator.document);
|
|
@@ -11923,6 +12049,22 @@ class OpenAPIOperationExecutor {
|
|
|
11923
12049
|
},
|
|
11924
12050
|
body: request.body
|
|
11925
12051
|
};
|
|
12052
|
+
if (this.#events.hasObservers) {
|
|
12053
|
+
this.#events.emit({
|
|
12054
|
+
type: 'openapi:operation:request:start',
|
|
12055
|
+
...context,
|
|
12056
|
+
runId,
|
|
12057
|
+
location: location(),
|
|
12058
|
+
request: {
|
|
12059
|
+
method: request.method,
|
|
12060
|
+
url: request.url,
|
|
12061
|
+
headers: request.headers,
|
|
12062
|
+
...(this.#captureBodies ? {
|
|
12063
|
+
body: request.body
|
|
12064
|
+
} : {})
|
|
12065
|
+
}
|
|
12066
|
+
});
|
|
12067
|
+
}
|
|
11926
12068
|
let rawResponse;
|
|
11927
12069
|
try {
|
|
11928
12070
|
rawResponse = await this.#httpClient(request);
|
|
@@ -11932,7 +12074,24 @@ class OpenAPIOperationExecutor {
|
|
|
11932
12074
|
cause: error
|
|
11933
12075
|
});
|
|
11934
12076
|
}
|
|
11935
|
-
|
|
12077
|
+
const response = await this.#responseNormalizer.normalize(rawResponse, requestInfo);
|
|
12078
|
+
if (this.#events.hasObservers) {
|
|
12079
|
+
this.#events.emit({
|
|
12080
|
+
type: 'openapi:operation:request:settled',
|
|
12081
|
+
...context,
|
|
12082
|
+
runId,
|
|
12083
|
+
location: location(),
|
|
12084
|
+
response: {
|
|
12085
|
+
status: response.status,
|
|
12086
|
+
headers: response.headers,
|
|
12087
|
+
size: response.size,
|
|
12088
|
+
...(this.#captureBodies ? {
|
|
12089
|
+
body: response.body
|
|
12090
|
+
} : {})
|
|
12091
|
+
}
|
|
12092
|
+
});
|
|
12093
|
+
}
|
|
12094
|
+
return response;
|
|
11936
12095
|
}
|
|
11937
12096
|
|
|
11938
12097
|
/**
|
|
@@ -13087,18 +13246,30 @@ class StepExecutor {
|
|
|
13087
13246
|
*/
|
|
13088
13247
|
async #evaluateCriterion(criterion, context) {
|
|
13089
13248
|
const condition = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(criterion.condition);
|
|
13249
|
+
const location = this.#document.locationOf(criterion);
|
|
13250
|
+
const values = {};
|
|
13251
|
+
const resolve = async expression => {
|
|
13252
|
+
const value = await this.#evaluate(context, expression);
|
|
13253
|
+
const wholeBody = expression === '$response.body' || expression === '$request.body';
|
|
13254
|
+
values[expression] = wholeBody ? '[body]' : value;
|
|
13255
|
+
return value;
|
|
13256
|
+
};
|
|
13090
13257
|
try {
|
|
13091
13258
|
const {
|
|
13092
13259
|
met,
|
|
13093
13260
|
error
|
|
13094
|
-
} = await this.#criterionEvaluator.evaluate(criterion,
|
|
13261
|
+
} = await this.#criterionEvaluator.evaluate(criterion, resolve);
|
|
13095
13262
|
if (error === undefined) return {
|
|
13096
13263
|
condition,
|
|
13097
|
-
met
|
|
13264
|
+
met,
|
|
13265
|
+
values,
|
|
13266
|
+
location
|
|
13098
13267
|
};
|
|
13099
13268
|
return {
|
|
13100
13269
|
condition,
|
|
13101
13270
|
met,
|
|
13271
|
+
values,
|
|
13272
|
+
location,
|
|
13102
13273
|
diagnostic: {
|
|
13103
13274
|
code: error.reason,
|
|
13104
13275
|
message: error.message
|
|
@@ -13112,6 +13283,8 @@ class StepExecutor {
|
|
|
13112
13283
|
return {
|
|
13113
13284
|
condition,
|
|
13114
13285
|
met: false,
|
|
13286
|
+
values,
|
|
13287
|
+
location,
|
|
13115
13288
|
diagnostic: {
|
|
13116
13289
|
code: error.reason,
|
|
13117
13290
|
message: error.message
|
|
@@ -13272,7 +13445,8 @@ class StepRetryRunner {
|
|
|
13272
13445
|
|
|
13273
13446
|
/**
|
|
13274
13447
|
* Runs `attempt` until the step succeeds, a terminal failure action is reached,
|
|
13275
|
-
* or its retries are exhausted.
|
|
13448
|
+
* or its retries are exhausted. Each call is given its attempt number,
|
|
13449
|
+
* starting at 1.
|
|
13276
13450
|
*/
|
|
13277
13451
|
async run(attempt, context) {
|
|
13278
13452
|
// attempts already spent on each retry action, keyed by the action element.
|
|
@@ -13286,7 +13460,7 @@ class StepRetryRunner {
|
|
|
13286
13460
|
const retriesSpent = new Map();
|
|
13287
13461
|
let attempts = 0;
|
|
13288
13462
|
for (;;) {
|
|
13289
|
-
const outcome = await attempt();
|
|
13463
|
+
const outcome = await attempt(attempts + 1);
|
|
13290
13464
|
attempts += 1;
|
|
13291
13465
|
if (outcome.successful) {
|
|
13292
13466
|
return {
|
|
@@ -13320,8 +13494,9 @@ class StepRetryRunner {
|
|
|
13320
13494
|
// sleep(0) for immediate retries, and never hand a custom sleep a
|
|
13321
13495
|
// zero/negative/NaN value.
|
|
13322
13496
|
const delayMs = this.#retryAfterMs(action);
|
|
13497
|
+
context.onRetry?.(action, delayMs, attempts);
|
|
13323
13498
|
if (delayMs > 0) await this.#sleep(delayMs, context.signal);
|
|
13324
|
-
if (runReference !== undefined) await runReference(action, outcome);
|
|
13499
|
+
if (runReference !== undefined) await runReference(action, outcome, attempts);
|
|
13325
13500
|
fired = true;
|
|
13326
13501
|
break;
|
|
13327
13502
|
}
|
|
@@ -13435,7 +13610,7 @@ function actionTargets(action) {
|
|
|
13435
13610
|
* workflow; `transfer` hands control one-way to another workflow, which the
|
|
13436
13611
|
* caller's run then ends on; `end` stops the run with `status: ended`; `break`
|
|
13437
13612
|
* stops with `status: failed` (the failure default).
|
|
13438
|
-
* @
|
|
13613
|
+
* @public
|
|
13439
13614
|
*/
|
|
13440
13615
|
|
|
13441
13616
|
/**
|
|
@@ -13580,7 +13755,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13580
13755
|
* reference — or a `goto`'s one-way transfer to a `workflowId` — is a call
|
|
13581
13756
|
* cycle. `retry` and `goto` are grouped with `step` for that classification, not
|
|
13582
13757
|
* `dependsOn`: each is a call the current step makes, not a stated precondition.
|
|
13583
|
-
* @
|
|
13758
|
+
* @public
|
|
13584
13759
|
*/
|
|
13585
13760
|
|
|
13586
13761
|
/**
|
|
@@ -13696,22 +13871,29 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13696
13871
|
/* harmony export */ });
|
|
13697
13872
|
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7456);
|
|
13698
13873
|
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34606);
|
|
13699
|
-
/* harmony import */ var
|
|
13700
|
-
/* harmony import */ var
|
|
13701
|
-
/* harmony import */ var
|
|
13702
|
-
/* harmony import */ var
|
|
13703
|
-
/* harmony import */ var
|
|
13704
|
-
/* harmony import */ var
|
|
13705
|
-
/* harmony import */ var
|
|
13706
|
-
/* harmony import */ var
|
|
13707
|
-
/* harmony import */ var
|
|
13708
|
-
/* harmony import */ var
|
|
13709
|
-
/* harmony import */ var
|
|
13710
|
-
/* harmony import */ var
|
|
13711
|
-
/* harmony import */ var
|
|
13712
|
-
/* harmony import */ var
|
|
13713
|
-
/* harmony import */ var
|
|
13714
|
-
/* harmony import */ var
|
|
13874
|
+
/* harmony import */ var short_unique_id__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(24279);
|
|
13875
|
+
/* harmony import */ var short_unique_id__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(short_unique_id__WEBPACK_IMPORTED_MODULE_2__);
|
|
13876
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(62823);
|
|
13877
|
+
/* harmony import */ var _speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(75728);
|
|
13878
|
+
/* harmony import */ var _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(77370);
|
|
13879
|
+
/* harmony import */ var _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(77447);
|
|
13880
|
+
/* harmony import */ var _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(75055);
|
|
13881
|
+
/* harmony import */ var _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(99494);
|
|
13882
|
+
/* harmony import */ var _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(95839);
|
|
13883
|
+
/* harmony import */ var _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(61596);
|
|
13884
|
+
/* harmony import */ var _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(96007);
|
|
13885
|
+
/* harmony import */ var _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(98885);
|
|
13886
|
+
/* harmony import */ var _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(18760);
|
|
13887
|
+
/* harmony import */ var _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(64661);
|
|
13888
|
+
/* harmony import */ var _observability_instrument_ts__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(21327);
|
|
13889
|
+
/* harmony import */ var _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(2835);
|
|
13890
|
+
/* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(17658);
|
|
13891
|
+
/* harmony import */ var _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(8696);
|
|
13892
|
+
/* harmony import */ var _abort_ts__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(99628);
|
|
13893
|
+
/* harmony import */ var _observability_EventChannel_ts__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(12993);
|
|
13894
|
+
|
|
13895
|
+
|
|
13896
|
+
|
|
13715
13897
|
|
|
13716
13898
|
|
|
13717
13899
|
|
|
@@ -13802,6 +13984,12 @@ function settledResult(result) {
|
|
|
13802
13984
|
* @internal
|
|
13803
13985
|
*/
|
|
13804
13986
|
|
|
13987
|
+
/**
|
|
13988
|
+
* How a step ran: its last attempt's outcome, the terminal action its retries
|
|
13989
|
+
* resolved to, how many attempts it took, and where the run goes next.
|
|
13990
|
+
* @internal
|
|
13991
|
+
*/
|
|
13992
|
+
|
|
13805
13993
|
/**
|
|
13806
13994
|
* One completed `dependsOn` run, remembered with the inputs it was actually
|
|
13807
13995
|
* given — see {@link RunScope.dependencyRuns}.
|
|
@@ -13823,6 +14011,14 @@ function settledResult(result) {
|
|
|
13823
14011
|
* travel together into everything it delegates to.
|
|
13824
14012
|
*/
|
|
13825
14013
|
|
|
14014
|
+
/**
|
|
14015
|
+
* What every event of one workflow invocation shares.
|
|
14016
|
+
*/
|
|
14017
|
+
|
|
14018
|
+
/**
|
|
14019
|
+
* What every step-scoped event of one step shares.
|
|
14020
|
+
*/
|
|
14021
|
+
|
|
13826
14022
|
/**
|
|
13827
14023
|
* Executes an Arazzo workflow: the stateful loop that turns "run one step" into
|
|
13828
14024
|
* "run a workflow".
|
|
@@ -13868,30 +14064,44 @@ class WorkflowExecutor {
|
|
|
13868
14064
|
static #DEFAULT_MAX_STEPS = 1000;
|
|
13869
14065
|
static #DEFAULT_MAX_WORKFLOW_DEPTH = 32;
|
|
13870
14066
|
static #DEFAULT_NOW = () => performance.now();
|
|
14067
|
+
/**
|
|
14068
|
+
* Generates each run's `runId`: random rather than counted, so the events
|
|
14069
|
+
* of runs in different processes stay apart once collected in one place.
|
|
14070
|
+
* It needs no Web Crypto, which browsers offer only on secure pages.
|
|
14071
|
+
*/
|
|
14072
|
+
static #RUN_IDS = new (short_unique_id__WEBPACK_IMPORTED_MODULE_2___default())({
|
|
14073
|
+
length: 12
|
|
14074
|
+
});
|
|
13871
14075
|
static #EXECUTE_OPTION_KEYS = new Set(['inputs', 'executeOptions', 'dependencyInputs', 'runDependencies', 'signal']);
|
|
13872
14076
|
#document;
|
|
13873
14077
|
#registry;
|
|
13874
14078
|
#maxSteps;
|
|
13875
14079
|
#maxWorkflowDepth;
|
|
13876
14080
|
#now;
|
|
13877
|
-
#extractor = new
|
|
14081
|
+
#extractor = new _extractor_ArazzoWorkflowExtractor_ts__WEBPACK_IMPORTED_MODULE_6__["default"]();
|
|
13878
14082
|
#normalizer;
|
|
13879
|
-
#outputResolver = new
|
|
13880
|
-
#parameterResolver = new
|
|
14083
|
+
#outputResolver = new _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_8__["default"]();
|
|
14084
|
+
#parameterResolver = new _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_9__["default"]();
|
|
13881
14085
|
#stepExecutor;
|
|
13882
14086
|
#retryRunner;
|
|
13883
|
-
#interpreter = new
|
|
14087
|
+
#interpreter = new _StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_16__["default"]();
|
|
13884
14088
|
#workflowLocatorNormalizer;
|
|
14089
|
+
// emits only while `hasObservers`, so an unobserved block builds no events
|
|
14090
|
+
#events;
|
|
13885
14091
|
constructor(options) {
|
|
13886
14092
|
this.#document = options.document;
|
|
13887
14093
|
this.#registry = options.registry;
|
|
13888
|
-
this.#workflowLocatorNormalizer = new
|
|
13889
|
-
this.#normalizer = options.workflowNormalizer ?? new
|
|
14094
|
+
this.#workflowLocatorNormalizer = new _ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_12__["default"](options.registry);
|
|
14095
|
+
this.#normalizer = options.workflowNormalizer ?? new _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_7__["default"]();
|
|
13890
14096
|
this.#maxSteps = options.maxSteps ?? WorkflowExecutor.#DEFAULT_MAX_STEPS;
|
|
13891
14097
|
this.#maxWorkflowDepth = options.maxWorkflowDepth ?? WorkflowExecutor.#DEFAULT_MAX_WORKFLOW_DEPTH;
|
|
13892
14098
|
this.#now = options.now ?? WorkflowExecutor.#DEFAULT_NOW;
|
|
14099
|
+
this.#events = new _observability_EventChannel_ts__WEBPACK_IMPORTED_MODULE_20__["default"]({
|
|
14100
|
+
observer: options.observer,
|
|
14101
|
+
now: this.#now
|
|
14102
|
+
});
|
|
13893
14103
|
this.#stepExecutor = options.stepExecutor;
|
|
13894
|
-
this.#retryRunner = new
|
|
14104
|
+
this.#retryRunner = new _StepRetryRunner_ts__WEBPACK_IMPORTED_MODULE_13__["default"]({
|
|
13895
14105
|
sleep: options.sleep
|
|
13896
14106
|
});
|
|
13897
14107
|
}
|
|
@@ -13913,7 +14123,9 @@ class WorkflowExecutor {
|
|
|
13913
14123
|
signal
|
|
13914
14124
|
} = options;
|
|
13915
14125
|
const executeOptions = this.#executeOptionsByName(options.executeOptions ?? {});
|
|
14126
|
+
const runId = `run-${WorkflowExecutor.#RUN_IDS.randomUUID()}`;
|
|
13916
14127
|
const scope = {
|
|
14128
|
+
runId,
|
|
13917
14129
|
// the signal is put into every step's opaque bag, because that bag is
|
|
13918
14130
|
// how anything reaches the transport: the executor's own checks stop the
|
|
13919
14131
|
// run at the next boundary, and this is what cancels the request already
|
|
@@ -13922,7 +14134,9 @@ class WorkflowExecutor {
|
|
|
13922
14134
|
// leave the run walking on.
|
|
13923
14135
|
executeOptions: (locator, step) => ({
|
|
13924
14136
|
...this.#executeOptionsFor(executeOptions, locator, step),
|
|
13925
|
-
signal
|
|
14137
|
+
signal,
|
|
14138
|
+
// set over any entry's own, like the signal: it names this run.
|
|
14139
|
+
runId
|
|
13926
14140
|
}),
|
|
13927
14141
|
dependencyInputs: options.dependencyInputs ?? {},
|
|
13928
14142
|
runDependencies: options.runDependencies ?? true,
|
|
@@ -13936,7 +14150,7 @@ class WorkflowExecutor {
|
|
|
13936
14150
|
return this.#run({
|
|
13937
14151
|
document: this.#document,
|
|
13938
14152
|
workflowId
|
|
13939
|
-
}, options.inputs ?? {}, scope, new
|
|
14153
|
+
}, options.inputs ?? {}, scope, new _WorkflowCallStack_ts__WEBPACK_IMPORTED_MODULE_14__["default"]({
|
|
13940
14154
|
maxDepth: this.#maxWorkflowDepth,
|
|
13941
14155
|
entryDocumentURI: this.#document.uri
|
|
13942
14156
|
}), 'root');
|
|
@@ -13953,20 +14167,20 @@ class WorkflowExecutor {
|
|
|
13953
14167
|
#executeOptionsByName(executeOptions) {
|
|
13954
14168
|
const byName = new Map();
|
|
13955
14169
|
const fail = (name, problem, reason) => {
|
|
13956
|
-
throw new
|
|
14170
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`executeOptions is keyed by source description name, and "${name}" ${problem}`, {
|
|
13957
14171
|
reason
|
|
13958
14172
|
});
|
|
13959
14173
|
};
|
|
13960
14174
|
for (const [name, options] of Object.entries(executeOptions)) {
|
|
13961
14175
|
const uri = this.#document.resolveSourceDescriptionURI(name);
|
|
13962
14176
|
if (uri === undefined) {
|
|
13963
|
-
return fail(name, `names no source description with a url in the Arazzo document at "${this.#document.uri}"`,
|
|
14177
|
+
return fail(name, `names no source description with a url in the Arazzo document at "${this.#document.uri}"`, _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].SourceDescriptionNotFound);
|
|
13964
14178
|
}
|
|
13965
14179
|
if (this.#document.resolveSourceDescriptionField(name, 'type') === 'arazzo') {
|
|
13966
|
-
fail(name, 'names an Arazzo document',
|
|
14180
|
+
fail(name, 'names an Arazzo document', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].SourceDescriptionNotOpenAPI);
|
|
13967
14181
|
}
|
|
13968
14182
|
if (!(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(options)) {
|
|
13969
|
-
fail(name, 'is not given an object of options',
|
|
14183
|
+
fail(name, 'is not given an object of options', _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].UnknownExecuteOption);
|
|
13970
14184
|
}
|
|
13971
14185
|
byName.set(name, {
|
|
13972
14186
|
uri,
|
|
@@ -13988,9 +14202,9 @@ class WorkflowExecutor {
|
|
|
13988
14202
|
const configuring = [...entries].filter(([, entry]) => entry.uri === locator.document.uri);
|
|
13989
14203
|
if (configuring.length > 1) {
|
|
13990
14204
|
const names = configuring.map(([name]) => `"${name}"`).join(', ');
|
|
13991
|
-
throw new
|
|
14205
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`Step "${step.stepId}" has no executeOptions entry of its own, and ${names} all configure "${locator.document.uri}", the document it calls`, {
|
|
13992
14206
|
...step,
|
|
13993
|
-
reason:
|
|
14207
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].AmbiguousExecuteOptions
|
|
13994
14208
|
});
|
|
13995
14209
|
}
|
|
13996
14210
|
return configuring[0]?.[1].options;
|
|
@@ -14009,8 +14223,8 @@ class WorkflowExecutor {
|
|
|
14009
14223
|
#rejectUnknownOptions(options) {
|
|
14010
14224
|
const unknown = Object.keys(options).filter(key => !WorkflowExecutor.#EXECUTE_OPTION_KEYS.has(key));
|
|
14011
14225
|
if (unknown.length === 0) return;
|
|
14012
|
-
throw new
|
|
14013
|
-
reason:
|
|
14226
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`execute received unknown option(s) ${unknown.join(', ')}; it takes (workflowId, { inputs, executeOptions, dependencyInputs, runDependencies, signal }) — workflow inputs go under "inputs"`, {
|
|
14227
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].UnknownExecuteOption
|
|
14014
14228
|
});
|
|
14015
14229
|
}
|
|
14016
14230
|
|
|
@@ -14036,22 +14250,90 @@ class WorkflowExecutor {
|
|
|
14036
14250
|
// run cancelled before any step — or between a prerequisite and the workflow
|
|
14037
14251
|
// that needed it — must not go on to normalize and enter a workflow nobody
|
|
14038
14252
|
// is waiting for.
|
|
14039
|
-
(0,
|
|
14253
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_19__.throwIfAborted)(scope.signal, {
|
|
14040
14254
|
workflowId,
|
|
14041
14255
|
callStack: nested
|
|
14042
14256
|
});
|
|
14043
|
-
const
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14257
|
+
const frame = {
|
|
14258
|
+
runId: scope.runId,
|
|
14259
|
+
workflowId,
|
|
14260
|
+
path: nested.path
|
|
14261
|
+
};
|
|
14262
|
+
// extracted before `workflow:start`: a workflow its document does not
|
|
14263
|
+
// define never starts, and the event can say where the one it runs is.
|
|
14264
|
+
const extracted = this.#extractWorkflow(locator);
|
|
14265
|
+
const location = locator.document.locationOf(extracted);
|
|
14047
14266
|
const invocation = {
|
|
14048
14267
|
workflowId,
|
|
14049
14268
|
document: locator.document,
|
|
14050
|
-
state
|
|
14269
|
+
state: new _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_10__["default"]({
|
|
14270
|
+
inputs
|
|
14271
|
+
}),
|
|
14051
14272
|
callStack: nested,
|
|
14052
|
-
via
|
|
14273
|
+
via,
|
|
14274
|
+
frame
|
|
14053
14275
|
};
|
|
14054
14276
|
|
|
14277
|
+
// traced from its `workflow:start` to its `workflow:settled`, so a span an
|
|
14278
|
+
// instrumentation opens around it is active for all of its events.
|
|
14279
|
+
return (0,_observability_instrument_ts__WEBPACK_IMPORTED_MODULE_15__.traced)(() => ({
|
|
14280
|
+
kind: 'workflow',
|
|
14281
|
+
...frame,
|
|
14282
|
+
via,
|
|
14283
|
+
location
|
|
14284
|
+
}), async () => {
|
|
14285
|
+
// a started workflow always settles, a throwing one included (an
|
|
14286
|
+
// observer throwing on its start too), so an observer holding it open
|
|
14287
|
+
// (a span, a stream consumer) can close it.
|
|
14288
|
+
let result;
|
|
14289
|
+
try {
|
|
14290
|
+
// emitted before normalization, so its events nest inside this workflow's.
|
|
14291
|
+
if (this.#events.hasObservers) {
|
|
14292
|
+
this.#events.emit({
|
|
14293
|
+
type: 'workflow:start',
|
|
14294
|
+
...frame,
|
|
14295
|
+
via,
|
|
14296
|
+
location
|
|
14297
|
+
}, startedAt);
|
|
14298
|
+
}
|
|
14299
|
+
result = await this.#runInvocation(locator, extracted, invocation, scope, startedAt);
|
|
14300
|
+
} catch (error) {
|
|
14301
|
+
this.#settleThrown({
|
|
14302
|
+
type: 'workflow:settled',
|
|
14303
|
+
...frame,
|
|
14304
|
+
status: 'failed',
|
|
14305
|
+
settledStatus: 'failed',
|
|
14306
|
+
outputs: {},
|
|
14307
|
+
error
|
|
14308
|
+
});
|
|
14309
|
+
throw error;
|
|
14310
|
+
}
|
|
14311
|
+
if (this.#events.hasObservers) {
|
|
14312
|
+
this.#events.emit({
|
|
14313
|
+
type: 'workflow:settled',
|
|
14314
|
+
...frame,
|
|
14315
|
+
status: result.status,
|
|
14316
|
+
settledStatus: result.settledStatus,
|
|
14317
|
+
outputs: result.outputs
|
|
14318
|
+
}, startedAt + result.durationMs);
|
|
14319
|
+
}
|
|
14320
|
+
return result;
|
|
14321
|
+
});
|
|
14322
|
+
}
|
|
14323
|
+
|
|
14324
|
+
/**
|
|
14325
|
+
* The part of {@link WorkflowExecutor.#run} after `workflow:start`:
|
|
14326
|
+
* normalizes the workflow, checks its definition, runs its dependencies
|
|
14327
|
+
* and its steps, and builds its result.
|
|
14328
|
+
*/
|
|
14329
|
+
async #runInvocation(locator, extracted, invocation, scope, startedAt) {
|
|
14330
|
+
const {
|
|
14331
|
+
workflowId,
|
|
14332
|
+
callStack: nested,
|
|
14333
|
+
frame
|
|
14334
|
+
} = invocation;
|
|
14335
|
+
const workflow = await this.#resolveWorkflow(locator, extracted, scope, frame);
|
|
14336
|
+
|
|
14055
14337
|
// validated before any prerequisite runs: a malformed `steps` is an
|
|
14056
14338
|
// authoring error, and discovering it only after the dependencies have
|
|
14057
14339
|
// fired would mean live side effects on the way to a throw.
|
|
@@ -14083,7 +14365,7 @@ class WorkflowExecutor {
|
|
|
14083
14365
|
// result carrying the dependency trace, not a throw — and none of its own
|
|
14084
14366
|
// steps run. Unless the run was cancelled, in which case the prerequisite
|
|
14085
14367
|
// did not fail on its own terms either.
|
|
14086
|
-
(0,
|
|
14368
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_19__.throwIfAborted)(scope.signal, {
|
|
14087
14369
|
workflowId,
|
|
14088
14370
|
callStack: nested
|
|
14089
14371
|
});
|
|
@@ -14104,56 +14386,23 @@ class WorkflowExecutor {
|
|
|
14104
14386
|
stepLoop: while (index < steps.length) {
|
|
14105
14387
|
const step = steps[index];
|
|
14106
14388
|
const stepId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.stepId);
|
|
14107
|
-
const stepStartedAt = this.#now();
|
|
14108
|
-
// the sub-workflow runs this step produces — one per attempt, so a retried
|
|
14109
|
-
// sub-workflow step keeps every attempt's trace rather than only the last.
|
|
14110
|
-
const subWorkflows = [];
|
|
14111
|
-
// the retry reference runs this step's attempts produced, one per firing —
|
|
14112
|
-
// separate from `subWorkflows` because a reference belongs to the retry
|
|
14113
|
-
// that invoked it, not to the step's own target.
|
|
14114
|
-
const retryReferences = [];
|
|
14115
|
-
const attempt = this.#chargedAttempt(this.#stepAttempt(step, stepId, invocation, scope, subWorkflows), invocation, scope, stepId);
|
|
14116
|
-
|
|
14117
|
-
// the retry runner settles any `retry` actions, so `action` is the terminal
|
|
14118
|
-
// action a retry chain resolved to and `attempts` is how many times the step
|
|
14119
|
-
// ran.
|
|
14120
14389
|
const {
|
|
14121
14390
|
outcome,
|
|
14122
14391
|
action,
|
|
14123
|
-
|
|
14124
|
-
} = await
|
|
14392
|
+
transition
|
|
14393
|
+
} = await (0,_observability_instrument_ts__WEBPACK_IMPORTED_MODULE_15__.traced)(() => ({
|
|
14394
|
+
kind: 'step',
|
|
14395
|
+
...frame,
|
|
14125
14396
|
stepId,
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
runReference: this.#retryReference(steps, stepId, invocation, scope, retryReferences)
|
|
14129
|
-
});
|
|
14130
|
-
state.setStepOutputs(outcome.stepId, outcome.outputs);
|
|
14131
|
-
trace.push({
|
|
14132
|
-
stepId: outcome.stepId,
|
|
14133
|
-
successful: outcome.successful,
|
|
14134
|
-
action,
|
|
14135
|
-
attempts,
|
|
14136
|
-
durationMs: this.#now() - stepStartedAt,
|
|
14137
|
-
successCriteria: outcome.successCriteria,
|
|
14138
|
-
actionCriteria: outcome.actionCriteria,
|
|
14139
|
-
...(subWorkflows.length > 0 ? {
|
|
14140
|
-
subWorkflows
|
|
14141
|
-
} : {}),
|
|
14142
|
-
...(retryReferences.length > 0 ? {
|
|
14143
|
-
retryReferences
|
|
14144
|
-
} : {})
|
|
14145
|
-
});
|
|
14146
|
-
const transition = this.#interpreter.interpret(action, outcome.successful, {
|
|
14147
|
-
workflowId,
|
|
14148
|
-
stepId
|
|
14149
|
-
});
|
|
14397
|
+
location: invocation.document.locationOf(step)
|
|
14398
|
+
}), () => this.#runStep(step, stepId, steps, invocation, scope, trace));
|
|
14150
14399
|
switch (transition.kind) {
|
|
14151
14400
|
case 'next':
|
|
14152
14401
|
index += 1;
|
|
14153
14402
|
break;
|
|
14154
14403
|
case 'goto':
|
|
14155
14404
|
index = this.#interpreter.indexOfStep(steps, transition.stepId, workflowId, {
|
|
14156
|
-
reason:
|
|
14405
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].GotoTargetNotFound,
|
|
14157
14406
|
label: 'goto target'
|
|
14158
14407
|
});
|
|
14159
14408
|
break;
|
|
@@ -14166,7 +14415,7 @@ class WorkflowExecutor {
|
|
|
14166
14415
|
// resolution, so an aborted run reports `aborted` rather than
|
|
14167
14416
|
// whatever resolving the target (a malformed reference, a missing
|
|
14168
14417
|
// source) would have thrown.
|
|
14169
|
-
(0,
|
|
14418
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_19__.throwIfAborted)(scope.signal, {
|
|
14170
14419
|
workflowId,
|
|
14171
14420
|
stepId,
|
|
14172
14421
|
callStack: nested
|
|
@@ -14192,15 +14441,15 @@ class WorkflowExecutor {
|
|
|
14192
14441
|
break stepLoop;
|
|
14193
14442
|
default:
|
|
14194
14443
|
{
|
|
14195
|
-
// exhaustiveness guard: a
|
|
14444
|
+
// exhaustiveness guard: a StepTransition kind added above without a case
|
|
14196
14445
|
// here would otherwise fall through silently instead of failing
|
|
14197
14446
|
// loudly — `transition` is provably `never` once every kind above
|
|
14198
14447
|
// has its own case, which TypeScript checks at compile time.
|
|
14199
14448
|
const unreachable = transition;
|
|
14200
|
-
throw new
|
|
14449
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`step "${stepId}" in workflow "${workflowId}" produced an unrecognized transition ${JSON.stringify(unreachable)}`, {
|
|
14201
14450
|
workflowId,
|
|
14202
14451
|
stepId,
|
|
14203
|
-
reason:
|
|
14452
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].UnknownTransitionKind
|
|
14204
14453
|
});
|
|
14205
14454
|
}
|
|
14206
14455
|
}
|
|
@@ -14212,13 +14461,166 @@ class WorkflowExecutor {
|
|
|
14212
14461
|
// transport, since one honoring the signal fails the request instead.
|
|
14213
14462
|
// Cancellation must not be the one outcome that reads differently for the
|
|
14214
14463
|
// last step than for every step before it.
|
|
14215
|
-
;(0,
|
|
14464
|
+
;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_19__.throwIfAborted)(scope.signal, {
|
|
14216
14465
|
workflowId,
|
|
14217
14466
|
callStack: nested
|
|
14218
14467
|
});
|
|
14219
14468
|
return this.#result(invocation, workflow, trace, runOutcome, dependencies, startedAt);
|
|
14220
14469
|
}
|
|
14221
14470
|
|
|
14471
|
+
/**
|
|
14472
|
+
* Emits the settled event of a workflow or step that threw. An observer
|
|
14473
|
+
* throwing on it is ignored: the error that failed the operation is the one
|
|
14474
|
+
* to report.
|
|
14475
|
+
*/
|
|
14476
|
+
#settleThrown(event) {
|
|
14477
|
+
if (!this.#events.hasObservers) return;
|
|
14478
|
+
try {
|
|
14479
|
+
this.#events.emit(event);
|
|
14480
|
+
} catch {
|
|
14481
|
+
// the operation's own error is rethrown by the caller
|
|
14482
|
+
}
|
|
14483
|
+
}
|
|
14484
|
+
|
|
14485
|
+
/**
|
|
14486
|
+
* Runs one step of a workflow invocation, from its `step:start` to its
|
|
14487
|
+
* `step:settled`, recording it in `trace` and its outputs in the state. A
|
|
14488
|
+
* step that throws still settles, so an observer holding it open can close
|
|
14489
|
+
* it.
|
|
14490
|
+
*/
|
|
14491
|
+
async #runStep(step, stepId, steps, invocation, scope, trace) {
|
|
14492
|
+
const {
|
|
14493
|
+
workflowId,
|
|
14494
|
+
frame,
|
|
14495
|
+
state
|
|
14496
|
+
} = invocation;
|
|
14497
|
+
const stepStartedAt = this.#now();
|
|
14498
|
+
// the sub-workflow runs this step produces — one per attempt, so a retried
|
|
14499
|
+
// sub-workflow step keeps every attempt's trace rather than only the last.
|
|
14500
|
+
const subWorkflows = [];
|
|
14501
|
+
// the retry reference runs this step's attempts produced, one per firing —
|
|
14502
|
+
// separate from `subWorkflows` because a reference belongs to the retry
|
|
14503
|
+
// that invoked it, not to the step's own target.
|
|
14504
|
+
const retryReferences = [];
|
|
14505
|
+
const stepFrame = {
|
|
14506
|
+
...frame,
|
|
14507
|
+
stepId
|
|
14508
|
+
};
|
|
14509
|
+
// the attempt reached, once past its boundary checks and before its
|
|
14510
|
+
// step:attempt: an attempt announced is an attempt counted
|
|
14511
|
+
let attempted = 0;
|
|
14512
|
+
const countAttempt = runAttempt => attempt => {
|
|
14513
|
+
attempted = attempt;
|
|
14514
|
+
return runAttempt(attempt);
|
|
14515
|
+
};
|
|
14516
|
+
let settled;
|
|
14517
|
+
try {
|
|
14518
|
+
if (this.#events.hasObservers) {
|
|
14519
|
+
this.#events.emit({
|
|
14520
|
+
type: 'step:start',
|
|
14521
|
+
...stepFrame,
|
|
14522
|
+
location: invocation.document.locationOf(step)
|
|
14523
|
+
}, stepStartedAt);
|
|
14524
|
+
}
|
|
14525
|
+
const attempt = this.#chargedAttempt(countAttempt(this.#observedAttempt(this.#stepAttempt(step, stepId, invocation, scope, subWorkflows), stepFrame)), invocation, scope, stepId);
|
|
14526
|
+
|
|
14527
|
+
// the retry runner settles any `retry` actions, so `action` is the terminal
|
|
14528
|
+
// action a retry chain resolved to and `attempts` is how many times the step
|
|
14529
|
+
// ran.
|
|
14530
|
+
const {
|
|
14531
|
+
outcome,
|
|
14532
|
+
action,
|
|
14533
|
+
attempts
|
|
14534
|
+
} = await this.#retryRunner.run(attempt, {
|
|
14535
|
+
stepId,
|
|
14536
|
+
workflowId,
|
|
14537
|
+
signal: scope.signal,
|
|
14538
|
+
runReference: this.#retryReference(steps, stepFrame, invocation, scope, retryReferences),
|
|
14539
|
+
onRetry: (retry, delayMs, attempt) => {
|
|
14540
|
+
const decided = {
|
|
14541
|
+
...stepFrame,
|
|
14542
|
+
attempt
|
|
14543
|
+
};
|
|
14544
|
+
if (this.#events.hasObservers) {
|
|
14545
|
+
this.#events.emit({
|
|
14546
|
+
type: 'action:selected',
|
|
14547
|
+
...decided,
|
|
14548
|
+
action: retry,
|
|
14549
|
+
transition: {
|
|
14550
|
+
kind: 'retry'
|
|
14551
|
+
},
|
|
14552
|
+
location: invocation.document.locationOf(retry)
|
|
14553
|
+
});
|
|
14554
|
+
}
|
|
14555
|
+
if (delayMs > 0 && this.#events.hasObservers) {
|
|
14556
|
+
this.#events.emit({
|
|
14557
|
+
type: 'retry:wait',
|
|
14558
|
+
...decided,
|
|
14559
|
+
delayMs
|
|
14560
|
+
});
|
|
14561
|
+
}
|
|
14562
|
+
}
|
|
14563
|
+
});
|
|
14564
|
+
const transition = this.#interpreter.interpret(action, outcome.successful, {
|
|
14565
|
+
workflowId,
|
|
14566
|
+
stepId
|
|
14567
|
+
});
|
|
14568
|
+
if (this.#events.hasObservers) {
|
|
14569
|
+
this.#events.emit({
|
|
14570
|
+
type: 'action:selected',
|
|
14571
|
+
...stepFrame,
|
|
14572
|
+
attempt: attempts,
|
|
14573
|
+
action,
|
|
14574
|
+
transition,
|
|
14575
|
+
location: action === undefined ? undefined : invocation.document.locationOf(action)
|
|
14576
|
+
});
|
|
14577
|
+
}
|
|
14578
|
+
state.setStepOutputs(outcome.stepId, outcome.outputs);
|
|
14579
|
+
const stepSettledAt = this.#now();
|
|
14580
|
+
trace.push({
|
|
14581
|
+
stepId: outcome.stepId,
|
|
14582
|
+
location: invocation.document.locationOf(step),
|
|
14583
|
+
successful: outcome.successful,
|
|
14584
|
+
action,
|
|
14585
|
+
attempts,
|
|
14586
|
+
durationMs: stepSettledAt - stepStartedAt,
|
|
14587
|
+
successCriteria: outcome.successCriteria,
|
|
14588
|
+
actionCriteria: outcome.actionCriteria,
|
|
14589
|
+
...(subWorkflows.length > 0 ? {
|
|
14590
|
+
subWorkflows
|
|
14591
|
+
} : {}),
|
|
14592
|
+
...(retryReferences.length > 0 ? {
|
|
14593
|
+
retryReferences
|
|
14594
|
+
} : {})
|
|
14595
|
+
});
|
|
14596
|
+
settled = {
|
|
14597
|
+
outcome,
|
|
14598
|
+
action,
|
|
14599
|
+
transition,
|
|
14600
|
+
attempts,
|
|
14601
|
+
settledAt: stepSettledAt
|
|
14602
|
+
};
|
|
14603
|
+
} catch (error) {
|
|
14604
|
+
this.#settleThrown({
|
|
14605
|
+
type: 'step:settled',
|
|
14606
|
+
...stepFrame,
|
|
14607
|
+
successful: false,
|
|
14608
|
+
attempts: attempted,
|
|
14609
|
+
error
|
|
14610
|
+
});
|
|
14611
|
+
throw error;
|
|
14612
|
+
}
|
|
14613
|
+
if (this.#events.hasObservers) {
|
|
14614
|
+
this.#events.emit({
|
|
14615
|
+
type: 'step:settled',
|
|
14616
|
+
...stepFrame,
|
|
14617
|
+
successful: settled.outcome.successful,
|
|
14618
|
+
attempts: settled.attempts
|
|
14619
|
+
}, settled.settledAt);
|
|
14620
|
+
}
|
|
14621
|
+
return settled;
|
|
14622
|
+
}
|
|
14623
|
+
|
|
14222
14624
|
/**
|
|
14223
14625
|
* Assembles the run's result from how it ended, resolving the workflow's
|
|
14224
14626
|
* `outputs` against the final state (unless it transferred) and stamping
|
|
@@ -14236,33 +14638,32 @@ class WorkflowExecutor {
|
|
|
14236
14638
|
* the shape up front, independent of resolving it.
|
|
14237
14639
|
*/
|
|
14238
14640
|
async #result(invocation, workflow, steps, outcome, dependencies, startedAt) {
|
|
14641
|
+
const settledAt = this.#now();
|
|
14239
14642
|
const shared = {
|
|
14240
14643
|
workflowId: invocation.workflowId,
|
|
14241
14644
|
steps,
|
|
14242
|
-
durationMs:
|
|
14645
|
+
durationMs: settledAt - startedAt,
|
|
14243
14646
|
...(dependencies.length > 0 ? {
|
|
14244
14647
|
dependencies
|
|
14245
14648
|
} : {})
|
|
14246
14649
|
};
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
};
|
|
14259
|
-
}
|
|
14260
|
-
return {
|
|
14650
|
+
const result = outcome.kind === 'transferred' ? {
|
|
14651
|
+
...shared,
|
|
14652
|
+
outputs: {},
|
|
14653
|
+
status: 'transferred',
|
|
14654
|
+
// computed once, here, rather than left for a caller to chase via
|
|
14655
|
+
// `settledResult` — `transferredTo` already carries its own
|
|
14656
|
+
// `settledStatus`, itself computed the same way when it was built,
|
|
14657
|
+
// so this is O(1) per hop rather than a walk of the whole chain.
|
|
14658
|
+
settledStatus: outcome.transferredTo.settledStatus,
|
|
14659
|
+
transferredTo: outcome.transferredTo
|
|
14660
|
+
} : {
|
|
14261
14661
|
...shared,
|
|
14262
14662
|
outputs: await this.#resolveWorkflowOutputs(workflow, invocation),
|
|
14263
14663
|
status: outcome.status,
|
|
14264
14664
|
settledStatus: outcome.status
|
|
14265
14665
|
};
|
|
14666
|
+
return result;
|
|
14266
14667
|
}
|
|
14267
14668
|
|
|
14268
14669
|
/**
|
|
@@ -14285,10 +14686,10 @@ class WorkflowExecutor {
|
|
|
14285
14686
|
*/
|
|
14286
14687
|
#chargeBudget(scope, invocation, stepId) {
|
|
14287
14688
|
if (++scope.budget.spent <= this.#maxSteps) return;
|
|
14288
|
-
throw new
|
|
14689
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`workflow "${invocation.workflowId}" exceeded its budget of ${this.#maxSteps} step attempts (a goto loop, excessive retries, or runaway sub-workflow calls)`, {
|
|
14289
14690
|
workflowId: invocation.workflowId,
|
|
14290
14691
|
stepId,
|
|
14291
|
-
reason:
|
|
14692
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].StepBudget,
|
|
14292
14693
|
path: invocation.callStack.path
|
|
14293
14694
|
});
|
|
14294
14695
|
}
|
|
@@ -14310,17 +14711,17 @@ class WorkflowExecutor {
|
|
|
14310
14711
|
workflowId,
|
|
14311
14712
|
callStack
|
|
14312
14713
|
} = invocation;
|
|
14313
|
-
return async
|
|
14314
|
-
(0,
|
|
14714
|
+
return async attempt => {
|
|
14715
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_19__.throwIfAborted)(scope.signal, {
|
|
14315
14716
|
workflowId,
|
|
14316
14717
|
stepId,
|
|
14317
14718
|
callStack
|
|
14318
14719
|
});
|
|
14319
14720
|
this.#chargeBudget(scope, invocation, stepId);
|
|
14320
14721
|
try {
|
|
14321
|
-
return await runAttempt();
|
|
14722
|
+
return await runAttempt(attempt);
|
|
14322
14723
|
} catch (error) {
|
|
14323
|
-
;(0,
|
|
14724
|
+
;(0,_abort_ts__WEBPACK_IMPORTED_MODULE_19__.throwIfAborted)(scope.signal, {
|
|
14324
14725
|
workflowId,
|
|
14325
14726
|
stepId,
|
|
14326
14727
|
callStack
|
|
@@ -14330,6 +14731,46 @@ class WorkflowExecutor {
|
|
|
14330
14731
|
};
|
|
14331
14732
|
}
|
|
14332
14733
|
|
|
14734
|
+
/**
|
|
14735
|
+
* Wraps a step-attempt thunk with the events of an attempt: `step:attempt`
|
|
14736
|
+
* as it begins, then a `criterion:evaluated` for each criterion it
|
|
14737
|
+
* evaluated, success criteria first.
|
|
14738
|
+
*/
|
|
14739
|
+
#observedAttempt(runAttempt, stepFrame) {
|
|
14740
|
+
// observers read per attempt, so hooks added mid-step apply from its next one
|
|
14741
|
+
return async attempt => {
|
|
14742
|
+
const attemptFrame = {
|
|
14743
|
+
...stepFrame,
|
|
14744
|
+
attempt
|
|
14745
|
+
};
|
|
14746
|
+
if (this.#events.hasObservers) this.#events.emit({
|
|
14747
|
+
type: 'step:attempt',
|
|
14748
|
+
...attemptFrame
|
|
14749
|
+
});
|
|
14750
|
+
const outcome = await runAttempt();
|
|
14751
|
+
if (!this.#events.hasObservers) return outcome;
|
|
14752
|
+
for (const criterion of outcome.successCriteria) {
|
|
14753
|
+
this.#events.emit({
|
|
14754
|
+
type: 'criterion:evaluated',
|
|
14755
|
+
...attemptFrame,
|
|
14756
|
+
kind: 'success',
|
|
14757
|
+
criterion,
|
|
14758
|
+
location: criterion.location
|
|
14759
|
+
});
|
|
14760
|
+
}
|
|
14761
|
+
for (const criterion of outcome.actionCriteria) {
|
|
14762
|
+
this.#events.emit({
|
|
14763
|
+
type: 'criterion:evaluated',
|
|
14764
|
+
...attemptFrame,
|
|
14765
|
+
kind: 'action',
|
|
14766
|
+
criterion,
|
|
14767
|
+
location: criterion.location
|
|
14768
|
+
});
|
|
14769
|
+
}
|
|
14770
|
+
return outcome;
|
|
14771
|
+
};
|
|
14772
|
+
}
|
|
14773
|
+
|
|
14333
14774
|
/**
|
|
14334
14775
|
* Builds the {@link StepRetryRunContext.runReference} callback a `retry`
|
|
14335
14776
|
* action's `stepId` / `workflowId` reference is run through.
|
|
@@ -14373,14 +14814,17 @@ class WorkflowExecutor {
|
|
|
14373
14814
|
* reference's *completion*, not its success, and a retry that turns out
|
|
14374
14815
|
* futile is bounded by `retryLimit` regardless.
|
|
14375
14816
|
*/
|
|
14376
|
-
#retryReference(steps,
|
|
14817
|
+
#retryReference(steps, stepFrame, invocation, scope, retryReferences) {
|
|
14377
14818
|
const {
|
|
14378
14819
|
workflowId,
|
|
14379
14820
|
state,
|
|
14380
14821
|
callStack
|
|
14381
14822
|
} = invocation;
|
|
14382
|
-
|
|
14383
|
-
|
|
14823
|
+
const {
|
|
14824
|
+
stepId
|
|
14825
|
+
} = stepFrame;
|
|
14826
|
+
return async (action, outcome, attempt) => {
|
|
14827
|
+
(0,_abort_ts__WEBPACK_IMPORTED_MODULE_19__.throwIfAborted)(scope.signal, {
|
|
14384
14828
|
workflowId,
|
|
14385
14829
|
stepId,
|
|
14386
14830
|
callStack
|
|
@@ -14388,12 +14832,12 @@ class WorkflowExecutor {
|
|
|
14388
14832
|
const {
|
|
14389
14833
|
hasStepId,
|
|
14390
14834
|
hasWorkflowId
|
|
14391
|
-
} = (0,
|
|
14835
|
+
} = (0,_StepTransitionInterpreter_ts__WEBPACK_IMPORTED_MODULE_16__.actionTargets)(action);
|
|
14392
14836
|
if (hasWorkflowId && hasStepId) {
|
|
14393
|
-
throw new
|
|
14837
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`retry action on step "${stepId}" in workflow "${workflowId}" declares both a stepId and a workflowId (mutually exclusive)`, {
|
|
14394
14838
|
stepId,
|
|
14395
14839
|
workflowId,
|
|
14396
|
-
reason:
|
|
14840
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].AmbiguousTarget
|
|
14397
14841
|
});
|
|
14398
14842
|
}
|
|
14399
14843
|
if (hasWorkflowId) {
|
|
@@ -14402,6 +14846,19 @@ class WorkflowExecutor {
|
|
|
14402
14846
|
// costs no budget unit.
|
|
14403
14847
|
const inputs = await this.#actionInputs(action.parameters, outcome, invocation, stepId);
|
|
14404
14848
|
this.#chargeBudget(scope, invocation, stepId);
|
|
14849
|
+
const referenceFrame = {
|
|
14850
|
+
...stepFrame,
|
|
14851
|
+
attempt,
|
|
14852
|
+
kind: 'workflow',
|
|
14853
|
+
id: reference
|
|
14854
|
+
};
|
|
14855
|
+
if (this.#events.hasObservers) {
|
|
14856
|
+
this.#events.emit({
|
|
14857
|
+
type: 'retry:reference:start',
|
|
14858
|
+
...referenceFrame,
|
|
14859
|
+
location: invocation.document.locationOf(action)
|
|
14860
|
+
});
|
|
14861
|
+
}
|
|
14405
14862
|
const result = await this.#runReferencedWorkflow(reference, stepId, invocation, scope, 'retry', inputs);
|
|
14406
14863
|
// the result's workflowId is the bare id the reference resolved to —
|
|
14407
14864
|
// the key run state is recorded under, whichever document owns it.
|
|
@@ -14410,22 +14867,48 @@ class WorkflowExecutor {
|
|
|
14410
14867
|
inputs: action.hasKey('parameters') ? inputs : state.getWorkflow(refId)?.inputs ?? {},
|
|
14411
14868
|
outputs: result.outputs
|
|
14412
14869
|
});
|
|
14870
|
+
const successful = !this.#settledFailed(result);
|
|
14413
14871
|
retryReferences.push({
|
|
14414
14872
|
kind: 'workflow',
|
|
14415
14873
|
id: reference,
|
|
14416
|
-
successful
|
|
14874
|
+
successful,
|
|
14417
14875
|
subWorkflow: result
|
|
14418
14876
|
});
|
|
14877
|
+
if (this.#events.hasObservers) {
|
|
14878
|
+
this.#events.emit({
|
|
14879
|
+
type: 'retry:reference:settled',
|
|
14880
|
+
...referenceFrame,
|
|
14881
|
+
successful
|
|
14882
|
+
});
|
|
14883
|
+
}
|
|
14419
14884
|
return;
|
|
14420
14885
|
}
|
|
14421
14886
|
const refStepId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(action.stepId);
|
|
14422
14887
|
const refIndex = this.#interpreter.indexOfStep(steps, refStepId, workflowId, {
|
|
14423
|
-
reason:
|
|
14888
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].RetryTargetNotFound,
|
|
14424
14889
|
label: 'retry reference'
|
|
14425
14890
|
});
|
|
14426
14891
|
const refStep = steps[refIndex];
|
|
14427
14892
|
const refSubWorkflows = [];
|
|
14428
|
-
const
|
|
14893
|
+
const referenceFrame = {
|
|
14894
|
+
...stepFrame,
|
|
14895
|
+
attempt,
|
|
14896
|
+
kind: 'step',
|
|
14897
|
+
id: refStepId
|
|
14898
|
+
};
|
|
14899
|
+
if (this.#events.hasObservers) {
|
|
14900
|
+
this.#events.emit({
|
|
14901
|
+
type: 'retry:reference:start',
|
|
14902
|
+
...referenceFrame,
|
|
14903
|
+
location: invocation.document.locationOf(action)
|
|
14904
|
+
});
|
|
14905
|
+
}
|
|
14906
|
+
// the referenced step's attempt is observed like any other, under its
|
|
14907
|
+
// own stepId and with a count of its own.
|
|
14908
|
+
const refOutcome = await this.#chargedAttempt(this.#observedAttempt(this.#stepAttempt(refStep, refStepId, invocation, scope, refSubWorkflows), {
|
|
14909
|
+
...stepFrame,
|
|
14910
|
+
stepId: refStepId
|
|
14911
|
+
}), invocation, scope, refStepId)(1);
|
|
14429
14912
|
state.setStepOutputs(refOutcome.stepId, refOutcome.outputs);
|
|
14430
14913
|
retryReferences.push({
|
|
14431
14914
|
kind: 'step',
|
|
@@ -14435,6 +14918,13 @@ class WorkflowExecutor {
|
|
|
14435
14918
|
subWorkflow: refSubWorkflows[0]
|
|
14436
14919
|
} : {})
|
|
14437
14920
|
});
|
|
14921
|
+
if (this.#events.hasObservers) {
|
|
14922
|
+
this.#events.emit({
|
|
14923
|
+
type: 'retry:reference:settled',
|
|
14924
|
+
...referenceFrame,
|
|
14925
|
+
successful: refOutcome.successful
|
|
14926
|
+
});
|
|
14927
|
+
}
|
|
14438
14928
|
};
|
|
14439
14929
|
}
|
|
14440
14930
|
|
|
@@ -14476,9 +14966,25 @@ class WorkflowExecutor {
|
|
|
14476
14966
|
// found halfway down the list would otherwise be raised only after earlier
|
|
14477
14967
|
// prerequisites had already fired live requests.
|
|
14478
14968
|
const dependencyRefs = await this.#dependencyRefs(workflow, invocation);
|
|
14969
|
+
const {
|
|
14970
|
+
frame
|
|
14971
|
+
} = invocation;
|
|
14479
14972
|
const results = [];
|
|
14480
14973
|
for (const dependency of dependencyRefs) {
|
|
14481
14974
|
const qualifiedId = this.#qualifiedId(dependency.locator);
|
|
14975
|
+
const target = {
|
|
14976
|
+
reference: dependency.inputsKey,
|
|
14977
|
+
workflowId: dependency.locator.workflowId,
|
|
14978
|
+
documentURI: dependency.locator.document.uri
|
|
14979
|
+
};
|
|
14980
|
+
if (this.#events.hasObservers) {
|
|
14981
|
+
this.#events.emit({
|
|
14982
|
+
type: 'dependency:start',
|
|
14983
|
+
...frame,
|
|
14984
|
+
dependency: target,
|
|
14985
|
+
location: invocation.document.locationOf(dependency.entry)
|
|
14986
|
+
});
|
|
14987
|
+
}
|
|
14482
14988
|
// a dependency already completed in this run is satisfied, not repeated: a
|
|
14483
14989
|
// precondition holds once met, and a diamond (two dependents sharing one
|
|
14484
14990
|
// dependency) must not duplicate its live side effects. Every dependent
|
|
@@ -14501,6 +15007,15 @@ class WorkflowExecutor {
|
|
|
14501
15007
|
inputs,
|
|
14502
15008
|
outputs: result.outputs
|
|
14503
15009
|
});
|
|
15010
|
+
if (this.#events.hasObservers) {
|
|
15011
|
+
this.#events.emit({
|
|
15012
|
+
type: 'dependency:settled',
|
|
15013
|
+
...frame,
|
|
15014
|
+
dependency: target,
|
|
15015
|
+
memoized: memoized !== undefined,
|
|
15016
|
+
settledStatus: result.settledStatus
|
|
15017
|
+
});
|
|
15018
|
+
}
|
|
14504
15019
|
if (this.#settledFailed(result)) return results;
|
|
14505
15020
|
|
|
14506
15021
|
// only a dependency whose chain settled non-`failed` is remembered as
|
|
@@ -14536,29 +15051,31 @@ class WorkflowExecutor {
|
|
|
14536
15051
|
document
|
|
14537
15052
|
} = invocation;
|
|
14538
15053
|
const dependsOn = workflow.dependsOn;
|
|
14539
|
-
if (!(0,
|
|
14540
|
-
throw new
|
|
15054
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isArrayElement)(dependsOn)) {
|
|
15055
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`workflow "${workflowId}" has a non-list "dependsOn"`, {
|
|
14541
15056
|
workflowId,
|
|
14542
|
-
reason:
|
|
15057
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].MalformedDependsOn
|
|
14543
15058
|
});
|
|
14544
15059
|
}
|
|
14545
|
-
const
|
|
14546
|
-
if (!(0,
|
|
14547
|
-
throw new
|
|
15060
|
+
const entries = [...dependsOn].map((entry, index) => {
|
|
15061
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(entry)) {
|
|
15062
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`workflow "${workflowId}" has a non-string entry at dependsOn[${index}]`, {
|
|
14548
15063
|
workflowId,
|
|
14549
|
-
reason:
|
|
15064
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].MalformedDependsOn
|
|
14550
15065
|
});
|
|
14551
15066
|
}
|
|
14552
|
-
return
|
|
15067
|
+
return entry;
|
|
14553
15068
|
});
|
|
14554
15069
|
const refs = [];
|
|
14555
|
-
for (const
|
|
15070
|
+
for (const entry of entries) {
|
|
15071
|
+
const reference = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(entry);
|
|
14556
15072
|
const locator = await this.#workflowLocatorNormalizer.normalize(reference, document, {
|
|
14557
15073
|
workflowId
|
|
14558
15074
|
});
|
|
14559
15075
|
refs.push({
|
|
14560
15076
|
locator,
|
|
14561
|
-
inputsKey: reference
|
|
15077
|
+
inputsKey: reference,
|
|
15078
|
+
entry
|
|
14562
15079
|
});
|
|
14563
15080
|
}
|
|
14564
15081
|
return refs;
|
|
@@ -14587,7 +15104,7 @@ class WorkflowExecutor {
|
|
|
14587
15104
|
state,
|
|
14588
15105
|
callStack
|
|
14589
15106
|
} = invocation;
|
|
14590
|
-
if (!(0,
|
|
15107
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(step.workflowId)) {
|
|
14591
15108
|
return () => this.#stepExecutor.forDocument(document).execute(step, state, scope.executeOptions, workflowId);
|
|
14592
15109
|
}
|
|
14593
15110
|
const reference = this.#subWorkflowReference(step, stepId, workflowId);
|
|
@@ -14727,12 +15244,12 @@ class WorkflowExecutor {
|
|
|
14727
15244
|
// the same check, but a sub-workflow step never reaches it — so both read
|
|
14728
15245
|
// the one list of target fields, and a target added to the specification
|
|
14729
15246
|
// cannot be rejected by one and silently accepted by the other.
|
|
14730
|
-
const conflicting =
|
|
15247
|
+
const conflicting = _StepExecutor_ts__WEBPACK_IMPORTED_MODULE_11__.STEP_TARGET_FIELDS.filter(field => field !== 'workflowId' && (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isStringElement)(step[field]));
|
|
14731
15248
|
if (conflicting.length > 0) {
|
|
14732
|
-
throw new
|
|
15249
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`step "${stepId}" in workflow "${workflowId}" declares a workflowId alongside ${conflicting.join(', ')} (mutually exclusive)`, {
|
|
14733
15250
|
stepId,
|
|
14734
15251
|
workflowId,
|
|
14735
|
-
reason:
|
|
15252
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].AmbiguousTarget
|
|
14736
15253
|
});
|
|
14737
15254
|
}
|
|
14738
15255
|
return (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_0__["default"])(step.workflowId);
|
|
@@ -14801,9 +15318,9 @@ class WorkflowExecutor {
|
|
|
14801
15318
|
#assertActionParameters(lists, workflowId, stepId) {
|
|
14802
15319
|
const owner = stepId === undefined ? `workflow "${workflowId}"` : `step "${stepId}" in workflow "${workflowId}"`;
|
|
14803
15320
|
for (const actions of lists) {
|
|
14804
|
-
if (!(0,
|
|
15321
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isArrayElement)(actions)) continue;
|
|
14805
15322
|
for (const action of actions) {
|
|
14806
|
-
if (!(0,
|
|
15323
|
+
if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__.isSuccessActionElement)(action) && !(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__.isFailureActionElement)(action)) continue;
|
|
14807
15324
|
if (!action.hasKey('parameters')) continue;
|
|
14808
15325
|
const scope = {
|
|
14809
15326
|
workflowId,
|
|
@@ -14815,17 +15332,17 @@ class WorkflowExecutor {
|
|
|
14815
15332
|
const {
|
|
14816
15333
|
parameters
|
|
14817
15334
|
} = action;
|
|
14818
|
-
if (!(0,
|
|
14819
|
-
throw new
|
|
15335
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isArrayElement)(parameters)) {
|
|
15336
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_18__["default"]('`parameters` is present but is not a list', {
|
|
14820
15337
|
...scope,
|
|
14821
|
-
reason:
|
|
15338
|
+
reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_18__["default"].MalformedParameters
|
|
14822
15339
|
});
|
|
14823
15340
|
}
|
|
14824
|
-
const inline = [...parameters].some(parameter => (0,
|
|
15341
|
+
const inline = [...parameters].some(parameter => (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__.isParameterElement)(parameter) && parameter.hasKey('in') && !parameter.meta.hasKey('ref-fields'));
|
|
14825
15342
|
if (inline) {
|
|
14826
|
-
throw new
|
|
15343
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_18__["default"](`An action parameter of ${owner} declares an \`in\`; action parameters map to the target workflow's inputs by name`, {
|
|
14827
15344
|
...scope,
|
|
14828
|
-
reason:
|
|
15345
|
+
reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_18__["default"].ActionParameterLocation
|
|
14829
15346
|
});
|
|
14830
15347
|
}
|
|
14831
15348
|
}
|
|
@@ -14833,30 +15350,50 @@ class WorkflowExecutor {
|
|
|
14833
15350
|
}
|
|
14834
15351
|
|
|
14835
15352
|
/**
|
|
14836
|
-
* Extracts
|
|
14837
|
-
*
|
|
14838
|
-
*
|
|
14839
|
-
*
|
|
14840
|
-
*
|
|
14841
|
-
*
|
|
14842
|
-
*
|
|
14843
|
-
* missing id itself.
|
|
15353
|
+
* Extracts the workflow a locator names. A workflow its document does not
|
|
15354
|
+
* define is the executor-level `workflow-not-found` authoring error, raised
|
|
15355
|
+
* here rather than leaking the extractor's `ExtractionError`. Only the root
|
|
15356
|
+
* {@link WorkflowExecutor.execute} id reaches this check unvalidated — every
|
|
15357
|
+
* reference position goes through the locator normalizer, which already
|
|
15358
|
+
* rejects a missing workflow with the referencing context attached — so the
|
|
15359
|
+
* error's `workflowId` is the missing id itself.
|
|
14844
15360
|
*/
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
15361
|
+
#extractWorkflow({
|
|
15362
|
+
document,
|
|
15363
|
+
workflowId
|
|
15364
|
+
}) {
|
|
15365
|
+
if (!document.workflowIndex.has(workflowId)) {
|
|
15366
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`workflow "${workflowId}" not found in Arazzo document at "${document.uri}"`, {
|
|
15367
|
+
workflowId,
|
|
15368
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].WorkflowNotFound
|
|
15369
|
+
});
|
|
15370
|
+
}
|
|
15371
|
+
return this.#extractor.extract(document, workflowId);
|
|
15372
|
+
}
|
|
15373
|
+
|
|
15374
|
+
/**
|
|
15375
|
+
* Normalizes an extracted workflow, once per run for each workflow.
|
|
15376
|
+
*/
|
|
15377
|
+
async #resolveWorkflow(locator, extracted, scope, frame) {
|
|
14850
15378
|
const qualifiedId = this.#qualifiedId(locator);
|
|
14851
15379
|
const cached = scope.workflows.get(qualifiedId);
|
|
14852
15380
|
if (cached !== undefined) return cached;
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
15381
|
+
const location = locator.document.locationOf(extracted);
|
|
15382
|
+
if (this.#events.hasObservers) {
|
|
15383
|
+
this.#events.emit({
|
|
15384
|
+
type: 'workflow:normalize:start',
|
|
15385
|
+
...frame,
|
|
15386
|
+
location
|
|
15387
|
+
});
|
|
15388
|
+
}
|
|
15389
|
+
const workflow = await this.#normalizer.normalize(extracted, locator.document);
|
|
15390
|
+
if (this.#events.hasObservers) {
|
|
15391
|
+
this.#events.emit({
|
|
15392
|
+
type: 'workflow:normalize:settled',
|
|
15393
|
+
...frame,
|
|
15394
|
+
location
|
|
14857
15395
|
});
|
|
14858
15396
|
}
|
|
14859
|
-
const workflow = await this.#normalizer.normalize(this.#extractor.extract(document, workflowId), document);
|
|
14860
15397
|
scope.workflows.set(qualifiedId, workflow);
|
|
14861
15398
|
return workflow;
|
|
14862
15399
|
}
|
|
@@ -14881,17 +15418,17 @@ class WorkflowExecutor {
|
|
|
14881
15418
|
#orderedSteps(workflow, workflowId) {
|
|
14882
15419
|
if (!workflow.hasKey('steps')) return [];
|
|
14883
15420
|
const steps = workflow.steps;
|
|
14884
|
-
if (!(0,
|
|
14885
|
-
throw new
|
|
15421
|
+
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isArrayElement)(steps)) {
|
|
15422
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`workflow "${workflowId}" has a non-list "steps"`, {
|
|
14886
15423
|
workflowId,
|
|
14887
|
-
reason:
|
|
15424
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].MalformedSteps
|
|
14888
15425
|
});
|
|
14889
15426
|
}
|
|
14890
15427
|
return [...steps].map((step, index) => {
|
|
14891
|
-
if (!(0,
|
|
14892
|
-
throw new
|
|
15428
|
+
if (!(0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_4__.isStepElement)(step)) {
|
|
15429
|
+
throw new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"](`workflow "${workflowId}" has a non-step entry at steps[${index}]`, {
|
|
14893
15430
|
workflowId,
|
|
14894
|
-
reason:
|
|
15431
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_17__["default"].MalformedSteps
|
|
14895
15432
|
});
|
|
14896
15433
|
}
|
|
14897
15434
|
return step;
|
|
@@ -14910,11 +15447,11 @@ class WorkflowExecutor {
|
|
|
14910
15447
|
#validateWorkflowOutputsShape(workflow, workflowId) {
|
|
14911
15448
|
if (!workflow.hasKey('outputs')) return;
|
|
14912
15449
|
const outputs = workflow.outputs;
|
|
14913
|
-
if ((0,
|
|
14914
|
-
throw new
|
|
15450
|
+
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_3__.isObjectElement)(outputs)) return;
|
|
15451
|
+
throw new _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_18__["default"]('`outputs` is present but is not a map', {
|
|
14915
15452
|
workflowId,
|
|
14916
15453
|
target: 'outputs',
|
|
14917
|
-
reason:
|
|
15454
|
+
reason: _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_18__["default"].MalformedOutputs
|
|
14918
15455
|
});
|
|
14919
15456
|
}
|
|
14920
15457
|
|
|
@@ -14937,7 +15474,7 @@ class WorkflowExecutor {
|
|
|
14937
15474
|
* counterpart of {@link StepExecutor}'s bridge.
|
|
14938
15475
|
*/
|
|
14939
15476
|
#evaluate(context, expression, document) {
|
|
14940
|
-
return new
|
|
15477
|
+
return new _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_5__["default"](context, {
|
|
14941
15478
|
strict: false,
|
|
14942
15479
|
document,
|
|
14943
15480
|
registry: this.#registry
|
|
@@ -16438,6 +16975,538 @@ class OpenAPIOperationNormalizer {
|
|
|
16438
16975
|
/* harmony export */ ]);
|
|
16439
16976
|
|
|
16440
16977
|
|
|
16978
|
+
/***/ },
|
|
16979
|
+
|
|
16980
|
+
/***/ 12993
|
|
16981
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
16982
|
+
|
|
16983
|
+
"use strict";
|
|
16984
|
+
__webpack_require__.r(__webpack_exports__);
|
|
16985
|
+
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34606);
|
|
16986
|
+
/* harmony import */ var _instrument_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21327);
|
|
16987
|
+
|
|
16988
|
+
|
|
16989
|
+
|
|
16990
|
+
/**
|
|
16991
|
+
* An event without its `timestamp`, which the channel stamps. Distributes over
|
|
16992
|
+
* a union, so each member keeps its own discriminated shape.
|
|
16993
|
+
* @internal
|
|
16994
|
+
*/
|
|
16995
|
+
|
|
16996
|
+
/**
|
|
16997
|
+
* Options for the EventChannel.
|
|
16998
|
+
* @internal
|
|
16999
|
+
*/
|
|
17000
|
+
|
|
17001
|
+
/**
|
|
17002
|
+
* Delivers a building block's events to its observer, then to the
|
|
17003
|
+
* process-wide observers {@link instrument} registered: stamps each with the
|
|
17004
|
+
* block's clock, snapshots it, and hands it over synchronously, without
|
|
17005
|
+
* awaiting anything.
|
|
17006
|
+
*
|
|
17007
|
+
* A block emits only while {@link EventChannel.hasObservers}:
|
|
17008
|
+
* `if (this.#events.hasObservers) this.#events.emit({...})`, so an unobserved
|
|
17009
|
+
* run builds no events at all, like `diagnostics_channel`'s `hasSubscribers`.
|
|
17010
|
+
* @internal
|
|
17011
|
+
*/
|
|
17012
|
+
class EventChannel {
|
|
17013
|
+
static #DEFAULT_NOW = () => performance.now();
|
|
17014
|
+
|
|
17015
|
+
/**
|
|
17016
|
+
* A frozen deep copy of the plain objects and arrays in `value`; anything
|
|
17017
|
+
* else, an ApiDOM element above all, is shared as it is. The run keeps
|
|
17018
|
+
* using the objects an event describes (the trace's records, the outputs,
|
|
17019
|
+
* the context a request interceptor receives, the transition it acts on),
|
|
17020
|
+
* so handing out the originals would let an observer change the run.
|
|
17021
|
+
*/
|
|
17022
|
+
static #snapshot(value, copies) {
|
|
17023
|
+
if (!Array.isArray(value) && !(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) return value;
|
|
17024
|
+
const seen = copies.get(value);
|
|
17025
|
+
if (seen !== undefined) return seen;
|
|
17026
|
+
const copy = Array.isArray(value) ? [] : {};
|
|
17027
|
+
copies.set(value, copy);
|
|
17028
|
+
for (const [key, item] of Object.entries(value)) {
|
|
17029
|
+
// defined, not assigned: assigning an own `__proto__` key (JSON.parse
|
|
17030
|
+
// makes one) would set the copy's prototype instead of copying it.
|
|
17031
|
+
Object.defineProperty(copy, key, {
|
|
17032
|
+
value: EventChannel.#snapshot(item, copies),
|
|
17033
|
+
enumerable: true,
|
|
17034
|
+
writable: true,
|
|
17035
|
+
configurable: true
|
|
17036
|
+
});
|
|
17037
|
+
}
|
|
17038
|
+
return Object.freeze(copy);
|
|
17039
|
+
}
|
|
17040
|
+
#observer;
|
|
17041
|
+
#now;
|
|
17042
|
+
constructor(options) {
|
|
17043
|
+
this.#observer = options.observer;
|
|
17044
|
+
this.#now = options.now ?? EventChannel.#DEFAULT_NOW;
|
|
17045
|
+
}
|
|
17046
|
+
|
|
17047
|
+
/**
|
|
17048
|
+
* Whether anyone observes the channel: its own observer or a process-wide
|
|
17049
|
+
* one. Read per event, so hooks registered mid-run apply from the next
|
|
17050
|
+
* event on.
|
|
17051
|
+
*/
|
|
17052
|
+
get hasObservers() {
|
|
17053
|
+
return this.#observer !== undefined || (0,_instrument_ts__WEBPACK_IMPORTED_MODULE_1__.isInstrumented)();
|
|
17054
|
+
}
|
|
17055
|
+
|
|
17056
|
+
/**
|
|
17057
|
+
* Emits the event. `timestamp` is the clock reading the event describes,
|
|
17058
|
+
* when the caller already took one (so a start/settled pair matches a
|
|
17059
|
+
* recorded duration exactly); otherwise the clock is read now.
|
|
17060
|
+
*/
|
|
17061
|
+
emit(event, timestamp) {
|
|
17062
|
+
// an absent optional field of the event itself is omitted, never present as
|
|
17063
|
+
// undefined; undefined values inside its data (an output that resolved to
|
|
17064
|
+
// undefined) are kept.
|
|
17065
|
+
const fields = Object.entries(event).filter(([, value]) => value !== undefined);
|
|
17066
|
+
const stamped = {
|
|
17067
|
+
...Object.fromEntries(fields),
|
|
17068
|
+
timestamp: timestamp ?? this.#now()
|
|
17069
|
+
};
|
|
17070
|
+
const snapshot = EventChannel.#snapshot(stamped, new WeakMap());
|
|
17071
|
+
// process-wide observers see the event even when the block's own throws,
|
|
17072
|
+
// so a buggy observer cannot leave a trace incomplete; the block's own
|
|
17073
|
+
// error is the one that aborts what emitted the event
|
|
17074
|
+
try {
|
|
17075
|
+
this.#observer?.(snapshot);
|
|
17076
|
+
} catch (error) {
|
|
17077
|
+
try {
|
|
17078
|
+
;(0,_instrument_ts__WEBPACK_IMPORTED_MODULE_1__.notify)(snapshot);
|
|
17079
|
+
} catch {
|
|
17080
|
+
// the block's own observer failed first
|
|
17081
|
+
}
|
|
17082
|
+
throw error;
|
|
17083
|
+
}
|
|
17084
|
+
;(0,_instrument_ts__WEBPACK_IMPORTED_MODULE_1__.notify)(snapshot);
|
|
17085
|
+
}
|
|
17086
|
+
}
|
|
17087
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (EventChannel);
|
|
17088
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
17089
|
+
/* harmony export */ "default", 0, __WEBPACK_DEFAULT_EXPORT__
|
|
17090
|
+
/* harmony export */ ]);
|
|
17091
|
+
|
|
17092
|
+
|
|
17093
|
+
/***/ },
|
|
17094
|
+
|
|
17095
|
+
/***/ 4050
|
|
17096
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
17097
|
+
|
|
17098
|
+
"use strict";
|
|
17099
|
+
__webpack_require__.r(__webpack_exports__);
|
|
17100
|
+
/* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34606);
|
|
17101
|
+
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62823);
|
|
17102
|
+
/* harmony import */ var _swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26847);
|
|
17103
|
+
/* harmony import */ var _swaggerexpert_json_pointer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(61198);
|
|
17104
|
+
/* harmony import */ var _swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(93504);
|
|
17105
|
+
|
|
17106
|
+
|
|
17107
|
+
|
|
17108
|
+
|
|
17109
|
+
|
|
17110
|
+
|
|
17111
|
+
/**
|
|
17112
|
+
* The parts of a parsed runtime expression that name what it reads.
|
|
17113
|
+
*/
|
|
17114
|
+
|
|
17115
|
+
/**
|
|
17116
|
+
* A parsed media type, lowercased by the parser.
|
|
17117
|
+
*/
|
|
17118
|
+
|
|
17119
|
+
/**
|
|
17120
|
+
* Options for the Redactor.
|
|
17121
|
+
* @public
|
|
17122
|
+
*/
|
|
17123
|
+
|
|
17124
|
+
/**
|
|
17125
|
+
* Masks credentials in events before they leave the process.
|
|
17126
|
+
*
|
|
17127
|
+
* Events carry what the run saw, credentials included, like the request a
|
|
17128
|
+
* request interceptor receives. Pass every event through
|
|
17129
|
+
* {@link Redactor.event} before logging, exporting or writing it.
|
|
17130
|
+
*
|
|
17131
|
+
* It masks by name, whatever the event:
|
|
17132
|
+
*
|
|
17133
|
+
* - the value of any field whose name matches a pattern: headers, query
|
|
17134
|
+
* parameters, body and output fields, at any depth;
|
|
17135
|
+
* - a criterion value whose runtime expression reads a matching name, in its
|
|
17136
|
+
* base or in any token of its JSON Pointer (`$inputs.password`,
|
|
17137
|
+
* `$steps.login.outputs.token#/value`);
|
|
17138
|
+
* - in every absolute URL, as `URL` parses it, the userinfo and the matching
|
|
17139
|
+
* query and fragment parameters;
|
|
17140
|
+
* - a request or response body that is JSON or a URL-encoded form, field by
|
|
17141
|
+
* field, and any other body, or any object that is not plain data, whole.
|
|
17142
|
+
*
|
|
17143
|
+
* A settled event's `error` is carried as it is, the error `execute` rejects
|
|
17144
|
+
* with. A credential under a name no pattern matches is carried as it is. The
|
|
17145
|
+
* masked value is `REDACTED`.
|
|
17146
|
+
* @public
|
|
17147
|
+
*/
|
|
17148
|
+
class Redactor {
|
|
17149
|
+
static CENSOR = 'REDACTED';
|
|
17150
|
+
|
|
17151
|
+
/**
|
|
17152
|
+
* Elastic APM's `sanitizeFieldNames` defaults, with `*secret*` for its exact
|
|
17153
|
+
* `secret` (which misses OAuth's `client_secret`), plus the signed-URL query
|
|
17154
|
+
* parameters OpenTelemetry's HTTP conventions mask.
|
|
17155
|
+
*/
|
|
17156
|
+
static defaultFields = Object.freeze(['password', 'passwd', 'pwd', '*secret*', '*key', '*token*', '*session*', '*credit*', '*card*', '*auth*', 'set-cookie', '*principal*', 'pw', 'pass', 'connect.sid', 'cookie', 'AWSAccessKeyId', 'Signature', 'sig', 'X-Goog-Signature']);
|
|
17157
|
+
#patterns;
|
|
17158
|
+
#matches = new Map();
|
|
17159
|
+
constructor(options = {}) {
|
|
17160
|
+
this.#patterns = (options.fields ?? Redactor.defaultFields).map(Redactor.#compile);
|
|
17161
|
+
}
|
|
17162
|
+
|
|
17163
|
+
/**
|
|
17164
|
+
* A masked copy of the event.
|
|
17165
|
+
*/
|
|
17166
|
+
event(event) {
|
|
17167
|
+
return this.#walk(event, new WeakSet());
|
|
17168
|
+
}
|
|
17169
|
+
#walk(value, seen) {
|
|
17170
|
+
if (typeof value === 'string') return URL.canParse(value) ? this.#url(value) : value;
|
|
17171
|
+
if (typeof value !== 'object' || value === null) return value;
|
|
17172
|
+
// an ApiDOM element (a selected action) is the document's own, a date
|
|
17173
|
+
// holds no credential, and an error is the one `execute` rejects with,
|
|
17174
|
+
// unmasked; any other object that is not plain data cannot be walked
|
|
17175
|
+
// field by field.
|
|
17176
|
+
if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isElement)(value) || value instanceof Date || value instanceof Error) return value;
|
|
17177
|
+
if (!Array.isArray(value) && !(0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) return Redactor.CENSOR;
|
|
17178
|
+
// only the objects on the current path: a shared, acyclic one is walked
|
|
17179
|
+
// again where it reappears, a cycle is cut.
|
|
17180
|
+
if (seen.has(value)) return Redactor.CENSOR;
|
|
17181
|
+
seen.add(value);
|
|
17182
|
+
try {
|
|
17183
|
+
return Array.isArray(value) ? value.map(item => this.#walk(item, seen)) : this.#fields(value, seen);
|
|
17184
|
+
} finally {
|
|
17185
|
+
seen.delete(value);
|
|
17186
|
+
}
|
|
17187
|
+
}
|
|
17188
|
+
#fields(object, seen) {
|
|
17189
|
+
const redacted = {};
|
|
17190
|
+
for (const [name, item] of Object.entries(object)) {
|
|
17191
|
+
let masked;
|
|
17192
|
+
if (this.#masks(name)) masked = Redactor.CENSOR;else if (name === 'body' && (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_0__["default"])(object.headers)) {
|
|
17193
|
+
masked = this.#body(item, object.headers, seen);
|
|
17194
|
+
} else masked = this.#walk(item, seen);
|
|
17195
|
+
// defined, not assigned, so an own `__proto__` key stays data
|
|
17196
|
+
Object.defineProperty(redacted, name, {
|
|
17197
|
+
value: masked,
|
|
17198
|
+
enumerable: true,
|
|
17199
|
+
writable: true,
|
|
17200
|
+
configurable: true
|
|
17201
|
+
});
|
|
17202
|
+
}
|
|
17203
|
+
return redacted;
|
|
17204
|
+
}
|
|
17205
|
+
|
|
17206
|
+
/**
|
|
17207
|
+
* Whether a name matches a pattern. A runtime expression matches when any
|
|
17208
|
+
* name it reads does.
|
|
17209
|
+
*/
|
|
17210
|
+
#masks(name) {
|
|
17211
|
+
let matches = this.#matches.get(name);
|
|
17212
|
+
if (matches === undefined) {
|
|
17213
|
+
const names = name.startsWith('$') ? Redactor.#namesRead(name) : [name];
|
|
17214
|
+
matches = names.some(candidate => this.#patterns.some(pattern => pattern.test(candidate)));
|
|
17215
|
+
this.#matches.set(name, matches);
|
|
17216
|
+
}
|
|
17217
|
+
return matches;
|
|
17218
|
+
}
|
|
17219
|
+
|
|
17220
|
+
/**
|
|
17221
|
+
* The absolute URL with its userinfo and matching query and fragment
|
|
17222
|
+
* parameters masked. A URL with nothing to mask comes back exactly as it
|
|
17223
|
+
* was, not normalized.
|
|
17224
|
+
*/
|
|
17225
|
+
#url(value) {
|
|
17226
|
+
const url = new URL(value);
|
|
17227
|
+
let masked = false;
|
|
17228
|
+
if (url.username !== '' || url.password !== '') {
|
|
17229
|
+
url.username = Redactor.CENSOR;
|
|
17230
|
+
url.password = Redactor.CENSOR;
|
|
17231
|
+
masked = true;
|
|
17232
|
+
}
|
|
17233
|
+
const query = this.#params(url.search.slice(1));
|
|
17234
|
+
if (query !== undefined) {
|
|
17235
|
+
url.search = query;
|
|
17236
|
+
masked = true;
|
|
17237
|
+
}
|
|
17238
|
+
const fragment = this.#params(url.hash.slice(1));
|
|
17239
|
+
if (fragment !== undefined) {
|
|
17240
|
+
url.hash = fragment;
|
|
17241
|
+
masked = true;
|
|
17242
|
+
}
|
|
17243
|
+
return masked ? url.href : value;
|
|
17244
|
+
}
|
|
17245
|
+
|
|
17246
|
+
/**
|
|
17247
|
+
* A body masked by what its `Content-Type` says it is.
|
|
17248
|
+
*/
|
|
17249
|
+
#body(body, headers, seen) {
|
|
17250
|
+
if (typeof body !== 'string' || body === '') return this.#walk(body, seen);
|
|
17251
|
+
const mediaType = Redactor.#contentType(headers);
|
|
17252
|
+
if (mediaType?.subtype === 'json' || mediaType?.suffix === 'json') {
|
|
17253
|
+
try {
|
|
17254
|
+
return JSON.stringify(this.#walk(JSON.parse(body), seen));
|
|
17255
|
+
} catch {
|
|
17256
|
+
return Redactor.CENSOR;
|
|
17257
|
+
}
|
|
17258
|
+
}
|
|
17259
|
+
if (mediaType?.type === 'application' && mediaType.subtype === 'x-www-form-urlencoded') {
|
|
17260
|
+
return this.#params(body) ?? body;
|
|
17261
|
+
}
|
|
17262
|
+
return Redactor.CENSOR;
|
|
17263
|
+
}
|
|
17264
|
+
|
|
17265
|
+
/**
|
|
17266
|
+
* URL-encoded `name=value` pairs with matching values masked, or
|
|
17267
|
+
* `undefined` when none matches, so the caller keeps the text as it was.
|
|
17268
|
+
*/
|
|
17269
|
+
#params(text) {
|
|
17270
|
+
let masked = false;
|
|
17271
|
+
const params = [...new URLSearchParams(text)].map(([name, value]) => {
|
|
17272
|
+
if (!this.#masks(name)) return [name, value];
|
|
17273
|
+
masked = true;
|
|
17274
|
+
return [name, Redactor.CENSOR];
|
|
17275
|
+
});
|
|
17276
|
+
return masked ? new URLSearchParams(params).toString() : undefined;
|
|
17277
|
+
}
|
|
17278
|
+
static #contentType(headers) {
|
|
17279
|
+
const name = Object.keys(headers).find(key => key.toLowerCase() === 'content-type');
|
|
17280
|
+
if (name === undefined) return undefined;
|
|
17281
|
+
try {
|
|
17282
|
+
return (0,_swaggerexpert_media_types__WEBPACK_IMPORTED_MODULE_4__.parse)(headers[name], {
|
|
17283
|
+
type: 'media-type'
|
|
17284
|
+
}).tree;
|
|
17285
|
+
} catch {
|
|
17286
|
+
return undefined;
|
|
17287
|
+
}
|
|
17288
|
+
}
|
|
17289
|
+
|
|
17290
|
+
/**
|
|
17291
|
+
* Every name a runtime expression reads: the header, query, path, input,
|
|
17292
|
+
* output or component name, and each token of its JSON Pointer, e.g.
|
|
17293
|
+
* `token` and `value` for `$steps.login.outputs.token#/value`. A string
|
|
17294
|
+
* that does not parse as an expression is its own name.
|
|
17295
|
+
*/
|
|
17296
|
+
static #namesRead(expression) {
|
|
17297
|
+
let tree;
|
|
17298
|
+
try {
|
|
17299
|
+
tree = (0,_swaggerexpert_arazzo_runtime_expression__WEBPACK_IMPORTED_MODULE_2__.parse)(expression).tree;
|
|
17300
|
+
} catch {
|
|
17301
|
+
return [expression];
|
|
17302
|
+
}
|
|
17303
|
+
if (tree === undefined) return [expression];
|
|
17304
|
+
const reference = tree.source?.reference;
|
|
17305
|
+
const tokens = (tree.jsonPointer ?? reference?.jsonPointer)?.referenceTokens ?? [];
|
|
17306
|
+
const names = [reference?.token, reference?.name, tree.name, tree.outputName, tree.fieldName, tree.componentName, ...tokens.map(token => (0,_swaggerexpert_json_pointer__WEBPACK_IMPORTED_MODULE_3__.unescape)(token.value))];
|
|
17307
|
+
return names.filter(name => name !== undefined);
|
|
17308
|
+
}
|
|
17309
|
+
static #compile(pattern) {
|
|
17310
|
+
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
|
17311
|
+
return new RegExp(`^${escaped}$`, 'i');
|
|
17312
|
+
}
|
|
17313
|
+
}
|
|
17314
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Redactor);
|
|
17315
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
17316
|
+
/* harmony export */ "default", 0, __WEBPACK_DEFAULT_EXPORT__
|
|
17317
|
+
/* harmony export */ ]);
|
|
17318
|
+
|
|
17319
|
+
|
|
17320
|
+
/***/ },
|
|
17321
|
+
|
|
17322
|
+
/***/ 35622
|
|
17323
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
17324
|
+
|
|
17325
|
+
"use strict";
|
|
17326
|
+
__webpack_require__.r(__webpack_exports__);
|
|
17327
|
+
/**
|
|
17328
|
+
* One observer that hands each event to every observer given, in order, so
|
|
17329
|
+
* several consumers (a log, a trace, a stream) can watch the same run.
|
|
17330
|
+
*
|
|
17331
|
+
* Delivery stays synchronous. An observer that throws aborts the run with its
|
|
17332
|
+
* error, as any observer does, and the observers after it miss that event.
|
|
17333
|
+
* @public
|
|
17334
|
+
*/
|
|
17335
|
+
const combineObservers = (...observers) => event => {
|
|
17336
|
+
for (const observer of observers) observer(event);
|
|
17337
|
+
};
|
|
17338
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (combineObservers);
|
|
17339
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
17340
|
+
/* harmony export */ "default", 0, __WEBPACK_DEFAULT_EXPORT__
|
|
17341
|
+
/* harmony export */ ]);
|
|
17342
|
+
|
|
17343
|
+
|
|
17344
|
+
/***/ },
|
|
17345
|
+
|
|
17346
|
+
/***/ 21327
|
|
17347
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
17348
|
+
|
|
17349
|
+
"use strict";
|
|
17350
|
+
__webpack_require__.r(__webpack_exports__);
|
|
17351
|
+
/* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17658);
|
|
17352
|
+
|
|
17353
|
+
|
|
17354
|
+
/**
|
|
17355
|
+
* A workflow invocation an {@link InstrumentationWrap} runs around: its
|
|
17356
|
+
* `workflow:start`, its steps and its `workflow:settled`.
|
|
17357
|
+
* @public
|
|
17358
|
+
*/
|
|
17359
|
+
|
|
17360
|
+
/**
|
|
17361
|
+
* A step an {@link InstrumentationWrap} runs around: its `step:start`, its
|
|
17362
|
+
* attempts and requests, and its `step:settled`.
|
|
17363
|
+
* @public
|
|
17364
|
+
*/
|
|
17365
|
+
|
|
17366
|
+
/**
|
|
17367
|
+
* What an {@link InstrumentationWrap} runs around.
|
|
17368
|
+
* @public
|
|
17369
|
+
*/
|
|
17370
|
+
|
|
17371
|
+
/**
|
|
17372
|
+
* Runs around each workflow invocation and each step, so what `run` does
|
|
17373
|
+
* happens inside it: in the active context of a span it opened, for one. It
|
|
17374
|
+
* must call `run`, and should settle once `run` settles; a second call runs
|
|
17375
|
+
* nothing again. What it resolves or rejects with does not change the run:
|
|
17376
|
+
* the run's own outcome stands, once the run settled, and the operation's
|
|
17377
|
+
* settled event says what it was.
|
|
17378
|
+
* @public
|
|
17379
|
+
*/
|
|
17380
|
+
|
|
17381
|
+
/**
|
|
17382
|
+
* Hooks that apply to every runner in the process, on top of the observer
|
|
17383
|
+
* each was given.
|
|
17384
|
+
* @public
|
|
17385
|
+
*/
|
|
17386
|
+
|
|
17387
|
+
// on globalThis, so the ESM and CommonJS builds of the runner, or two copies
|
|
17388
|
+
// of it, share one registry
|
|
17389
|
+
const KEY = Symbol.for('@usearazzo/runner/observability/instrument');
|
|
17390
|
+
const registry = () => {
|
|
17391
|
+
const scope = globalThis;
|
|
17392
|
+
scope[KEY] ??= {
|
|
17393
|
+
hooks: []
|
|
17394
|
+
};
|
|
17395
|
+
return scope[KEY];
|
|
17396
|
+
};
|
|
17397
|
+
|
|
17398
|
+
/**
|
|
17399
|
+
* Applies `hooks` to every runner in the process, until the returned
|
|
17400
|
+
* function removes them: the seam process-wide tooling, such as the
|
|
17401
|
+
* OpenTelemetry instrumentation, is built on. A run already in progress
|
|
17402
|
+
* picks hooks up at its next event or operation, and drops removed ones the
|
|
17403
|
+
* same way: a removed hook misses the settled events of what it saw start.
|
|
17404
|
+
* Hooks apply in the order they were added, the first wrap outermost.
|
|
17405
|
+
* @public
|
|
17406
|
+
*/
|
|
17407
|
+
const instrument = hooks => {
|
|
17408
|
+
const {
|
|
17409
|
+
hooks: registered
|
|
17410
|
+
} = registry();
|
|
17411
|
+
registered.push(hooks);
|
|
17412
|
+
return () => {
|
|
17413
|
+
const index = registered.indexOf(hooks);
|
|
17414
|
+
if (index !== -1) registered.splice(index, 1);
|
|
17415
|
+
};
|
|
17416
|
+
};
|
|
17417
|
+
|
|
17418
|
+
/**
|
|
17419
|
+
* Whether any process-wide observer is registered.
|
|
17420
|
+
* @internal
|
|
17421
|
+
*/
|
|
17422
|
+
const isInstrumented = () => registry().hooks.some(hooks => hooks.observer);
|
|
17423
|
+
|
|
17424
|
+
/**
|
|
17425
|
+
* Hands the event to every process-wide observer.
|
|
17426
|
+
* @internal
|
|
17427
|
+
*/
|
|
17428
|
+
const notify = event => {
|
|
17429
|
+
// a copy: an observer that removes hooks must not skip the next one
|
|
17430
|
+
for (const {
|
|
17431
|
+
observer
|
|
17432
|
+
} of [...registry().hooks]) observer?.(event);
|
|
17433
|
+
};
|
|
17434
|
+
|
|
17435
|
+
/**
|
|
17436
|
+
* Runs `work` inside every registered wrap, returning what `work` resolves
|
|
17437
|
+
* to or rejecting with what it rejects with, whatever a wrap settles with,
|
|
17438
|
+
* and only once `work` settled. A wrap that throws before running `work`
|
|
17439
|
+
* aborts it; one that throws after is ignored.
|
|
17440
|
+
* @internal
|
|
17441
|
+
*/
|
|
17442
|
+
const traced = async (describe, work) => {
|
|
17443
|
+
const wraps = registry().hooks.flatMap(({
|
|
17444
|
+
wrap
|
|
17445
|
+
}) => wrap === undefined ? [] : [wrap]);
|
|
17446
|
+
// described only when a wrap is registered: an uninstrumented run builds nothing
|
|
17447
|
+
if (wraps.length === 0) return work();
|
|
17448
|
+
const operation = describe();
|
|
17449
|
+
let outcome;
|
|
17450
|
+
let running;
|
|
17451
|
+
let abandoned = false;
|
|
17452
|
+
const unrun = () => new _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_0__["default"](`an instrumentation wrap settled without running the ${operation.kind}`, {
|
|
17453
|
+
workflowId: operation.workflowId,
|
|
17454
|
+
...(operation.kind === 'step' ? {
|
|
17455
|
+
stepId: operation.stepId
|
|
17456
|
+
} : {}),
|
|
17457
|
+
reason: _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_0__["default"].InstrumentationWrap
|
|
17458
|
+
});
|
|
17459
|
+
// once, however many times a wrap calls it
|
|
17460
|
+
const innermost = () => {
|
|
17461
|
+
// a wrap calling it after the run gave up on it: running the work then
|
|
17462
|
+
// would act for a run that already rejected
|
|
17463
|
+
if (abandoned) return Promise.reject(unrun());
|
|
17464
|
+
if (running === undefined) {
|
|
17465
|
+
running = (async () => {
|
|
17466
|
+
try {
|
|
17467
|
+
outcome = {
|
|
17468
|
+
value: await work()
|
|
17469
|
+
};
|
|
17470
|
+
} catch (error) {
|
|
17471
|
+
outcome = {
|
|
17472
|
+
error
|
|
17473
|
+
};
|
|
17474
|
+
throw error;
|
|
17475
|
+
}
|
|
17476
|
+
})();
|
|
17477
|
+
// handled here too: a wrap that settles later than the work must not
|
|
17478
|
+
// leave its rejection unhandled, which would end the process
|
|
17479
|
+
running.catch(() => undefined);
|
|
17480
|
+
}
|
|
17481
|
+
return running;
|
|
17482
|
+
};
|
|
17483
|
+
const run = wraps.reduceRight((next, wrap) => () => wrap(operation, next), innermost);
|
|
17484
|
+
try {
|
|
17485
|
+
await run();
|
|
17486
|
+
} catch (error) {
|
|
17487
|
+
if (running === undefined) {
|
|
17488
|
+
abandoned = true;
|
|
17489
|
+
throw error;
|
|
17490
|
+
}
|
|
17491
|
+
}
|
|
17492
|
+
// a wrap that settled without waiting for the work: the work still decides
|
|
17493
|
+
if (running !== undefined) await running.catch(() => undefined);
|
|
17494
|
+
if (outcome === undefined) {
|
|
17495
|
+
abandoned = true;
|
|
17496
|
+
throw unrun();
|
|
17497
|
+
}
|
|
17498
|
+
if ('error' in outcome) throw outcome.error;
|
|
17499
|
+
return outcome.value;
|
|
17500
|
+
};
|
|
17501
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (instrument);
|
|
17502
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
17503
|
+
/* harmony export */ "default", 0, __WEBPACK_DEFAULT_EXPORT__,
|
|
17504
|
+
/* harmony export */ "isInstrumented", 0, /* binding */ isInstrumented,
|
|
17505
|
+
/* harmony export */ "notify", 0, /* binding */ notify,
|
|
17506
|
+
/* harmony export */ "traced", 0, /* binding */ traced
|
|
17507
|
+
/* harmony export */ ]);
|
|
17508
|
+
|
|
17509
|
+
|
|
16441
17510
|
/***/ },
|
|
16442
17511
|
|
|
16443
17512
|
/***/ 4044
|
|
@@ -16454,6 +17523,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16454
17523
|
/* harmony import */ var _errors_InvalidEntryDocumentError_ts__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(40198);
|
|
16455
17524
|
/* harmony import */ var _errors_UnmatchedProviderError_ts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(46132);
|
|
16456
17525
|
/* harmony import */ var _constants_ts__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(89307);
|
|
17526
|
+
/* harmony import */ var _observability_EventChannel_ts__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(12993);
|
|
17527
|
+
|
|
16457
17528
|
|
|
16458
17529
|
|
|
16459
17530
|
|
|
@@ -16481,8 +17552,14 @@ class DocumentRegistry {
|
|
|
16481
17552
|
#documents = new Map();
|
|
16482
17553
|
#loading = new Map();
|
|
16483
17554
|
#providers;
|
|
17555
|
+
// emits only while `hasObservers`, so an unobserved block builds no events
|
|
17556
|
+
#events;
|
|
16484
17557
|
constructor(options = {}) {
|
|
16485
17558
|
this.#providers = options.providers ?? [new _providers_ArazzoDocumentRegistryProvider_ts__WEBPACK_IMPORTED_MODULE_2__["default"](), new _providers_OpenAPIDocumentRegistryProvider_ts__WEBPACK_IMPORTED_MODULE_3__["default"]()];
|
|
17559
|
+
this.#events = new _observability_EventChannel_ts__WEBPACK_IMPORTED_MODULE_9__["default"]({
|
|
17560
|
+
observer: options.observer,
|
|
17561
|
+
now: options.now
|
|
17562
|
+
});
|
|
16486
17563
|
}
|
|
16487
17564
|
|
|
16488
17565
|
/**
|
|
@@ -16528,12 +17605,17 @@ class DocumentRegistry {
|
|
|
16528
17605
|
* caches it.
|
|
16529
17606
|
*/
|
|
16530
17607
|
async #load(canonicalURI) {
|
|
17608
|
+
if (this.#events.hasObservers) {
|
|
17609
|
+
this.#events.emit({
|
|
17610
|
+
type: 'document:load:start',
|
|
17611
|
+
uri: canonicalURI
|
|
17612
|
+
});
|
|
17613
|
+
}
|
|
16531
17614
|
for (const provider of this.#providers) {
|
|
17615
|
+
let document;
|
|
16532
17616
|
try {
|
|
16533
17617
|
if (await provider.canProvide(canonicalURI)) {
|
|
16534
|
-
|
|
16535
|
-
this.#set(canonicalURI, document);
|
|
16536
|
-
return document;
|
|
17618
|
+
document = await provider.provide(canonicalURI);
|
|
16537
17619
|
}
|
|
16538
17620
|
} catch (error) {
|
|
16539
17621
|
// a document that cannot be read or loaded fails in ApiDOM or the parser;
|
|
@@ -16544,6 +17626,18 @@ class DocumentRegistry {
|
|
|
16544
17626
|
cause: error
|
|
16545
17627
|
});
|
|
16546
17628
|
}
|
|
17629
|
+
if (document !== undefined) {
|
|
17630
|
+
// outside the try, so an observer's own error is not a failed load, and
|
|
17631
|
+
// before caching, so a run it aborts leaves no half-registered document.
|
|
17632
|
+
if (this.#events.hasObservers) {
|
|
17633
|
+
this.#events.emit({
|
|
17634
|
+
type: 'document:load:settled',
|
|
17635
|
+
uri: canonicalURI
|
|
17636
|
+
});
|
|
17637
|
+
}
|
|
17638
|
+
this.#set(canonicalURI, document);
|
|
17639
|
+
return document;
|
|
17640
|
+
}
|
|
16547
17641
|
}
|
|
16548
17642
|
throw new _errors_UnmatchedProviderError_ts__WEBPACK_IMPORTED_MODULE_7__["default"](`No provider can handle the document at "${canonicalURI}"`, {
|
|
16549
17643
|
uri: canonicalURI
|
|
@@ -16763,11 +17857,13 @@ class ArazzoDocumentRegistryProvider extends _DocumentRegistryProvider_ts__WEBPA
|
|
|
16763
17857
|
*/
|
|
16764
17858
|
async provide(uri) {
|
|
16765
17859
|
const parseResult = await (0,_usearazzo_parser__WEBPACK_IMPORTED_MODULE_0__.parse)(uri, this.#buildParseOptions());
|
|
17860
|
+
this.assertParsed(uri, parseResult);
|
|
16766
17861
|
const {
|
|
16767
17862
|
workflowIndex,
|
|
16768
17863
|
stepIndex,
|
|
16769
17864
|
sourceDescriptionIndex
|
|
16770
17865
|
} = this.#buildIndexes(uri, parseResult);
|
|
17866
|
+
ArazzoDocumentRegistryProvider.#recordPointers(parseResult);
|
|
16771
17867
|
return new _document_ArazzoDocument_ts__WEBPACK_IMPORTED_MODULE_11__["default"](uri, parseResult, workflowIndex, stepIndex, sourceDescriptionIndex);
|
|
16772
17868
|
}
|
|
16773
17869
|
|
|
@@ -16827,6 +17923,24 @@ class ArazzoDocumentRegistryProvider extends _DocumentRegistryProvider_ts__WEBPA
|
|
|
16827
17923
|
sourceDescriptionIndex
|
|
16828
17924
|
};
|
|
16829
17925
|
}
|
|
17926
|
+
|
|
17927
|
+
/**
|
|
17928
|
+
* Records, in each element's `json-pointer` meta, where it is written: every
|
|
17929
|
+
* workflow, step, criterion and action, its `components` included, and
|
|
17930
|
+
* every `dependsOn` entry. The record travels with the element through
|
|
17931
|
+
* normalization, so an inherited or referenced element keeps the pointer of
|
|
17932
|
+
* where it is defined, for the events to locate it by.
|
|
17933
|
+
*/
|
|
17934
|
+
static #recordPointers(parseResult) {
|
|
17935
|
+
;(0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_8__.traverse)(parseResult.api, {
|
|
17936
|
+
enter(path) {
|
|
17937
|
+
const element = path.node;
|
|
17938
|
+
const located = (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_9__.isWorkflowElement)(element) || (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_9__.isStepElement)(element) || (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_9__.isCriterionElement)(element) || (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_9__.isSuccessActionElement)(element) || (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_9__.isFailureActionElement)(element) || (0,_speclynx_apidom_ns_arazzo_1__WEBPACK_IMPORTED_MODULE_9__.isWorkflowDependsOnElement)(path.parentPath?.node);
|
|
17939
|
+
if (!located) return;
|
|
17940
|
+
element.meta.set('json-pointer', path.formatPath('jsonpointer'));
|
|
17941
|
+
}
|
|
17942
|
+
});
|
|
17943
|
+
}
|
|
16830
17944
|
#buildParseOptions() {
|
|
16831
17945
|
return (0,_speclynx_apidom_reference_configuration_empty__WEBPACK_IMPORTED_MODULE_4__.merge)(_usearazzo_parser__WEBPACK_IMPORTED_MODULE_0__.defaultOptions, this.#options);
|
|
16832
17946
|
}
|
|
@@ -16846,6 +17960,10 @@ class ArazzoDocumentRegistryProvider extends _DocumentRegistryProvider_ts__WEBPA
|
|
|
16846
17960
|
"use strict";
|
|
16847
17961
|
__webpack_require__.r(__webpack_exports__);
|
|
16848
17962
|
/* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32420);
|
|
17963
|
+
/* harmony import */ var _speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7456);
|
|
17964
|
+
/* harmony import */ var _usearazzo_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(94433);
|
|
17965
|
+
|
|
17966
|
+
|
|
16849
17967
|
|
|
16850
17968
|
/**
|
|
16851
17969
|
* Replaces circular $ref references with an empty ObjectElement
|
|
@@ -16887,6 +18005,18 @@ class DocumentRegistryProvider {
|
|
|
16887
18005
|
/**
|
|
16888
18006
|
* Loads and produces a document from a URI.
|
|
16889
18007
|
*/
|
|
18008
|
+
|
|
18009
|
+
/**
|
|
18010
|
+
* Rejects a document the parser could only partly read. The strict parsers
|
|
18011
|
+
* throw on a syntax error; the lenient ones that source maps need record it
|
|
18012
|
+
* and parse what they can instead, so a document must load with source maps
|
|
18013
|
+
* exactly when it loads without.
|
|
18014
|
+
*/
|
|
18015
|
+
assertParsed(uri, parseResult) {
|
|
18016
|
+
const [error] = parseResult.errors;
|
|
18017
|
+
if (error === undefined) return;
|
|
18018
|
+
throw new _usearazzo_parser__WEBPACK_IMPORTED_MODULE_2__["default"](`Failed to parse the document at "${uri}": ${(0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_1__["default"])(error)}`);
|
|
18019
|
+
}
|
|
16890
18020
|
}
|
|
16891
18021
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DocumentRegistryProvider);
|
|
16892
18022
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
@@ -16989,10 +18119,11 @@ class OpenAPIDocumentRegistryProvider extends _DocumentRegistryProvider_ts__WEBP
|
|
|
16989
18119
|
*/
|
|
16990
18120
|
async provide(uri) {
|
|
16991
18121
|
const parseResult = await (0,_usearazzo_parser__WEBPACK_IMPORTED_MODULE_0__.parse)(uri, this.#buildParseOptions());
|
|
16992
|
-
|
|
18122
|
+
this.assertParsed(uri, parseResult);
|
|
18123
|
+
const operationIndex = await this.#buildOperationIndex(uri, parseResult);
|
|
16993
18124
|
return new _document_OpenAPIDocument_ts__WEBPACK_IMPORTED_MODULE_10__["default"](uri, parseResult, operationIndex);
|
|
16994
18125
|
}
|
|
16995
|
-
async #buildOperationIndex(parseResult) {
|
|
18126
|
+
async #buildOperationIndex(uri, parseResult) {
|
|
16996
18127
|
const index = new _document_OpenAPIOperationIndex_ts__WEBPACK_IMPORTED_MODULE_12__["default"]();
|
|
16997
18128
|
const dereferenceOptions = this.#buildDereferenceOptions(parseResult);
|
|
16998
18129
|
const apiDereferenced = await (0,_speclynx_apidom_traverse__WEBPACK_IMPORTED_MODULE_7__.traverseAsync)(parseResult.api, {
|
|
@@ -17000,16 +18131,37 @@ class OpenAPIDocumentRegistryProvider extends _DocumentRegistryProvider_ts__WEBP
|
|
|
17000
18131
|
const pathItem = path.node;
|
|
17001
18132
|
if (!pathItem.hasMetaProperty('path')) return path.skip();
|
|
17002
18133
|
if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isStringElement)(pathItem.$ref)) return;
|
|
17003
|
-
|
|
17004
|
-
|
|
18134
|
+
|
|
18135
|
+
// an operation written next to the `$ref` stays where it is written
|
|
18136
|
+
const pointer = path.formatPath('jsonpointer');
|
|
18137
|
+
pathItem.forEach((value, key) => {
|
|
18138
|
+
if (value.element !== 'operation') return;
|
|
18139
|
+
value.meta.set('json-pointer', `${pointer}/${(0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(key)}`);
|
|
18140
|
+
});
|
|
18141
|
+
path.replaceWith(await (0,_usearazzo_resolver__WEBPACK_IMPORTED_MODULE_1__.dereferenceElement)(pathItem, dereferenceOptions));
|
|
17005
18142
|
},
|
|
17006
18143
|
OperationElement(path) {
|
|
17007
18144
|
const operation = path.node;
|
|
17008
18145
|
const operationId = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(operation.operationId);
|
|
18146
|
+
const pointer = path.formatPath('jsonpointer');
|
|
18147
|
+
// where the operation is written, for the events to locate it by: an
|
|
18148
|
+
// operation of a `$ref` path item is written where that path item is,
|
|
18149
|
+
// unless it was written next to the `$ref` and so already located
|
|
18150
|
+
if (!operation.hasMetaProperty('json-pointer')) {
|
|
18151
|
+
const member = path.parentPath?.node;
|
|
18152
|
+
const pathItem = path.parentPath?.parentPath?.node;
|
|
18153
|
+
const definition = (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(pathItem.meta.get('ref-origin-pointer'));
|
|
18154
|
+
if (typeof definition === 'string') {
|
|
18155
|
+
operation.meta.set('ref-origin', (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(pathItem.meta.get('ref-origin')));
|
|
18156
|
+
operation.meta.set('json-pointer', `${definition}/${(0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_8__["default"])(member.key)}`);
|
|
18157
|
+
} else {
|
|
18158
|
+
operation.meta.set('json-pointer', pointer);
|
|
18159
|
+
}
|
|
18160
|
+
}
|
|
17009
18161
|
if (typeof operationId !== 'string') return path.skip();
|
|
17010
18162
|
if (operationId === '') return path.skip();
|
|
17011
18163
|
if (index.has(operationId)) return path.skip();
|
|
17012
|
-
index.set(operationId,
|
|
18164
|
+
index.set(operationId, pointer);
|
|
17013
18165
|
path.skip();
|
|
17014
18166
|
}
|
|
17015
18167
|
});
|
|
@@ -60715,18 +61867,16 @@ class DereferenceVisitor {
|
|
|
60715
61867
|
toTranscludedElement(referencingElement, transclusion) {
|
|
60716
61868
|
// the referencing element waits for an enclosing element to transclude it
|
|
60717
61869
|
if (transclusion.keep) return referencingElement;
|
|
61870
|
+
let target = transclusion.target.element;
|
|
60718
61871
|
// an alias whose reference never reaches a value
|
|
60719
61872
|
if (transclusion.target.unresolved) {
|
|
60720
61873
|
const {
|
|
60721
61874
|
aliasField
|
|
60722
61875
|
} = transclusion;
|
|
60723
|
-
|
|
60724
|
-
|
|
60725
|
-
|
|
60726
|
-
|
|
60727
|
-
return transclusion.toTranscludedElement(referencingElement, fields);
|
|
60728
|
-
}
|
|
60729
|
-
if (transclusion.back && this.options.dereference.circular === 'replace') {
|
|
61876
|
+
if (aliasField === undefined || !(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isObjectElement)(target)) return referencingElement;
|
|
61877
|
+
target = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(target);
|
|
61878
|
+
target.remove(aliasField);
|
|
61879
|
+
} else if (transclusion.back && this.options.dereference.circular === 'replace') {
|
|
60730
61880
|
const refElement = new _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_10__["default"](transclusion.circular.uri, {
|
|
60731
61881
|
type: referencingElement.element,
|
|
60732
61882
|
...transclusion.circular.meta
|
|
@@ -60734,7 +61884,21 @@ class DereferenceVisitor {
|
|
|
60734
61884
|
const replacer = this.options.dereference.strategyOpts[this.strategyName]?.circularReplacer ?? this.options.dereference.circularReplacer;
|
|
60735
61885
|
return replacer(refElement);
|
|
60736
61886
|
}
|
|
60737
|
-
|
|
61887
|
+
const transcludedElement = transclusion.toTranscludedElement(referencingElement, target);
|
|
61888
|
+
const {
|
|
61889
|
+
origin
|
|
61890
|
+
} = transclusion;
|
|
61891
|
+
// an element used as it is isn't annotated, and a transcluded target (a chain of references)
|
|
61892
|
+
// is defined where its own annotation says, which the element cloned from it carries
|
|
61893
|
+
if (origin === undefined || transcludedElement === target || transcludedElement === referencingElement || !target.isMetaEmpty && target.meta.hasKey('ref-type')) {
|
|
61894
|
+
return transcludedElement;
|
|
61895
|
+
}
|
|
61896
|
+
transcludedElement.meta.set('ref-origin', origin.uri);
|
|
61897
|
+
// an alias whose reference never reaches a value has no content to point at
|
|
61898
|
+
if (origin.jsonPointer !== undefined && !transclusion.target.unresolved) {
|
|
61899
|
+
transcludedElement.meta.set('ref-origin-pointer', origin.jsonPointer);
|
|
61900
|
+
}
|
|
61901
|
+
return transcludedElement;
|
|
60738
61902
|
}
|
|
60739
61903
|
|
|
60740
61904
|
/**
|
|
@@ -61543,8 +62707,7 @@ class Arazzo1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORTE
|
|
|
61543
62707
|
reference: runtimeExpression,
|
|
61544
62708
|
value: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_5__["default"])(reusableElement.value)
|
|
61545
62709
|
});
|
|
61546
|
-
// annotate with info about
|
|
61547
|
-
mergedElement.meta.set('ref-origin', this.reference.uri);
|
|
62710
|
+
// annotate with info about type
|
|
61548
62711
|
mergedElement.meta.set('ref-type', element.element);
|
|
61549
62712
|
|
|
61550
62713
|
// override value field if present for Parameter Objects
|
|
@@ -61554,6 +62717,10 @@ class Arazzo1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORTE
|
|
|
61554
62717
|
}
|
|
61555
62718
|
return mergedElement;
|
|
61556
62719
|
},
|
|
62720
|
+
origin: {
|
|
62721
|
+
uri: _util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.stripHash(this.reference.uri),
|
|
62722
|
+
jsonPointer
|
|
62723
|
+
},
|
|
61557
62724
|
circular: {
|
|
61558
62725
|
uri: runtimeExpression,
|
|
61559
62726
|
meta: {
|
|
@@ -61604,6 +62771,8 @@ class Arazzo1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORTE
|
|
|
61604
62771
|
let referencedElement;
|
|
61605
62772
|
// $ids of the schemas enclosing the referenced element within its document
|
|
61606
62773
|
let ancestorSchema$ids;
|
|
62774
|
+
// known when the reference is resolved by JSON Pointer against its document
|
|
62775
|
+
let jsonPointer;
|
|
61607
62776
|
try {
|
|
61608
62777
|
if (isUnknownURI || isURL) {
|
|
61609
62778
|
// we're dealing with canonical URI or URL with possible fragment
|
|
@@ -61709,12 +62878,12 @@ class Arazzo1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORTE
|
|
|
61709
62878
|
return;
|
|
61710
62879
|
}
|
|
61711
62880
|
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_21__.unsanitize($refBaseURI));
|
|
61712
|
-
|
|
62881
|
+
jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_9__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
61713
62882
|
const referenceAsSchema = this.toJSONSchemaDocument(reference.value.result);
|
|
61714
62883
|
({
|
|
61715
62884
|
element: referencedElement,
|
|
61716
62885
|
ancestorSchema$ids
|
|
61717
|
-
} = (0,_openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_17__.locate)(referenceAsSchema,
|
|
62886
|
+
} = (0,_openapi_3_1_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_17__.locate)(referenceAsSchema, jsonPointer));
|
|
61718
62887
|
}
|
|
61719
62888
|
} else {
|
|
61720
62889
|
throw error;
|
|
@@ -61747,8 +62916,7 @@ class Arazzo1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORTE
|
|
|
61747
62916
|
booleanJsonSchemaElement.meta.set('ref-fields', {
|
|
61748
62917
|
$ref
|
|
61749
62918
|
});
|
|
61750
|
-
// annotate referenced element with info about
|
|
61751
|
-
booleanJsonSchemaElement.meta.set('ref-origin', origin);
|
|
62919
|
+
// annotate referenced element with info about type
|
|
61752
62920
|
booleanJsonSchemaElement.meta.set('ref-type', element.element);
|
|
61753
62921
|
return booleanJsonSchemaElement;
|
|
61754
62922
|
}
|
|
@@ -61768,12 +62936,15 @@ class Arazzo1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORTE
|
|
|
61768
62936
|
mergedElement.meta.set('ref-fields', {
|
|
61769
62937
|
$ref
|
|
61770
62938
|
});
|
|
61771
|
-
// annotate fragment with info about
|
|
61772
|
-
mergedElement.meta.set('ref-origin', origin);
|
|
62939
|
+
// annotate fragment with info about type
|
|
61773
62940
|
mergedElement.meta.set('ref-type', element.element);
|
|
61774
62941
|
return mergedElement;
|
|
61775
62942
|
},
|
|
61776
62943
|
aliasField: '$ref',
|
|
62944
|
+
origin: {
|
|
62945
|
+
uri: origin,
|
|
62946
|
+
jsonPointer
|
|
62947
|
+
},
|
|
61777
62948
|
circular: {
|
|
61778
62949
|
uri: $refBaseURI,
|
|
61779
62950
|
meta: {
|
|
@@ -62012,11 +63183,14 @@ class OpenAPI2DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORT
|
|
|
62012
63183
|
mergedElement.meta.set('ref-fields', {
|
|
62013
63184
|
$ref
|
|
62014
63185
|
});
|
|
62015
|
-
// annotate fragment with info about
|
|
62016
|
-
mergedElement.meta.set('ref-origin', reference.uri);
|
|
63186
|
+
// annotate fragment with info about type
|
|
62017
63187
|
mergedElement.meta.set('ref-type', element.element);
|
|
62018
63188
|
return mergedElement;
|
|
62019
63189
|
},
|
|
63190
|
+
origin: {
|
|
63191
|
+
uri: reference.uri,
|
|
63192
|
+
jsonPointer
|
|
63193
|
+
},
|
|
62020
63194
|
circular: {
|
|
62021
63195
|
uri: $refBaseURI,
|
|
62022
63196
|
meta: {
|
|
@@ -62095,12 +63269,15 @@ class OpenAPI2DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORT
|
|
|
62095
63269
|
mergedElement.meta.set('ref-fields', {
|
|
62096
63270
|
$ref
|
|
62097
63271
|
});
|
|
62098
|
-
// annotate referenced element with info about
|
|
62099
|
-
mergedElement.meta.set('ref-origin', reference.uri);
|
|
63272
|
+
// annotate referenced element with info about type
|
|
62100
63273
|
mergedElement.meta.set('ref-type', element.element);
|
|
62101
63274
|
return mergedElement;
|
|
62102
63275
|
},
|
|
62103
63276
|
aliasField: '$ref',
|
|
63277
|
+
origin: {
|
|
63278
|
+
uri: reference.uri,
|
|
63279
|
+
jsonPointer
|
|
63280
|
+
},
|
|
62104
63281
|
circular: {
|
|
62105
63282
|
uri: $refBaseURI,
|
|
62106
63283
|
meta: {
|
|
@@ -62173,11 +63350,14 @@ class OpenAPI2DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPORT
|
|
|
62173
63350
|
mergedElement.meta.set('ref-fields', {
|
|
62174
63351
|
$ref
|
|
62175
63352
|
});
|
|
62176
|
-
// annotate fragment with info about
|
|
62177
|
-
mergedElement.meta.set('ref-origin', reference.uri);
|
|
63353
|
+
// annotate fragment with info about type
|
|
62178
63354
|
mergedElement.meta.set('ref-type', element.element);
|
|
62179
63355
|
return mergedElement;
|
|
62180
63356
|
},
|
|
63357
|
+
origin: {
|
|
63358
|
+
uri: reference.uri,
|
|
63359
|
+
jsonPointer
|
|
63360
|
+
},
|
|
62181
63361
|
circular: {
|
|
62182
63362
|
uri: $refBaseURI,
|
|
62183
63363
|
meta: {
|
|
@@ -62411,11 +63591,14 @@ class OpenAPI3_0DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
62411
63591
|
mergedElement.meta.set('ref-fields', {
|
|
62412
63592
|
$ref
|
|
62413
63593
|
});
|
|
62414
|
-
// annotate fragment with info about
|
|
62415
|
-
mergedElement.meta.set('ref-origin', reference.uri);
|
|
63594
|
+
// annotate fragment with info about type
|
|
62416
63595
|
mergedElement.meta.set('ref-type', element.element);
|
|
62417
63596
|
return mergedElement;
|
|
62418
63597
|
},
|
|
63598
|
+
origin: {
|
|
63599
|
+
uri: reference.uri,
|
|
63600
|
+
jsonPointer
|
|
63601
|
+
},
|
|
62419
63602
|
circular: {
|
|
62420
63603
|
uri: $refBaseURI,
|
|
62421
63604
|
meta: {
|
|
@@ -62494,12 +63677,15 @@ class OpenAPI3_0DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
62494
63677
|
mergedElement.meta.set('ref-fields', {
|
|
62495
63678
|
$ref
|
|
62496
63679
|
});
|
|
62497
|
-
// annotate referenced element with info about
|
|
62498
|
-
mergedElement.meta.set('ref-origin', reference.uri);
|
|
63680
|
+
// annotate referenced element with info about type
|
|
62499
63681
|
mergedElement.meta.set('ref-type', element.element);
|
|
62500
63682
|
return mergedElement;
|
|
62501
63683
|
},
|
|
62502
63684
|
aliasField: '$ref',
|
|
63685
|
+
origin: {
|
|
63686
|
+
uri: reference.uri,
|
|
63687
|
+
jsonPointer
|
|
63688
|
+
},
|
|
62503
63689
|
circular: {
|
|
62504
63690
|
uri: $refBaseURI,
|
|
62505
63691
|
meta: {
|
|
@@ -62565,6 +63751,7 @@ class OpenAPI3_0DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
62565
63751
|
const operationCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(target);
|
|
62566
63752
|
// annotate operation element with info about origin and type
|
|
62567
63753
|
operationCopy.meta.set('ref-origin', reference.uri);
|
|
63754
|
+
operationCopy.meta.set('ref-origin-pointer', jsonPointer);
|
|
62568
63755
|
operationCopy.meta.set('ref-type', element.element);
|
|
62569
63756
|
|
|
62570
63757
|
/**
|
|
@@ -62595,8 +63782,14 @@ class OpenAPI3_0DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
62595
63782
|
/**
|
|
62596
63783
|
* Transclude Link Object containing Operation Object in its meta.
|
|
62597
63784
|
*/
|
|
63785
|
+
// create shallow clone to be able to annotate with metadata
|
|
63786
|
+
const operationCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(target);
|
|
63787
|
+
// annotate operation element with info about origin and type
|
|
63788
|
+
operationCopy.meta.set('ref-origin', reference.uri);
|
|
63789
|
+
operationCopy.meta.set('ref-origin-pointer', operationPath.formatPath());
|
|
63790
|
+
operationCopy.meta.set('ref-type', element.element);
|
|
62598
63791
|
const linkElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(element);
|
|
62599
|
-
linkElementCopy.operationId?.meta.set('operation',
|
|
63792
|
+
linkElementCopy.operationId?.meta.set('operation', operationCopy);
|
|
62600
63793
|
return linkElementCopy;
|
|
62601
63794
|
});
|
|
62602
63795
|
} catch (error) {
|
|
@@ -62652,6 +63845,7 @@ class OpenAPI3_0DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
62652
63845
|
const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.cloneShallow)(target);
|
|
62653
63846
|
// annotate element with info about origin and type
|
|
62654
63847
|
valueElement.meta.set('ref-origin', reference.uri);
|
|
63848
|
+
valueElement.meta.set('ref-origin-pointer', '');
|
|
62655
63849
|
valueElement.meta.set('ref-type', element.element);
|
|
62656
63850
|
|
|
62657
63851
|
/**
|
|
@@ -63362,8 +64556,7 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63362
64556
|
description: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(reusingElement.get('description')),
|
|
63363
64557
|
summary: (0,_speclynx_apidom_core__WEBPACK_IMPORTED_MODULE_6__["default"])(reusingElement.get('summary'))
|
|
63364
64558
|
});
|
|
63365
|
-
// annotate fragment with info about
|
|
63366
|
-
mergedElement.meta.set('ref-origin', reference.uri);
|
|
64559
|
+
// annotate fragment with info about type
|
|
63367
64560
|
mergedElement.meta.set('ref-type', element.element);
|
|
63368
64561
|
|
|
63369
64562
|
// override description and summary (outer has higher priority then inner)
|
|
@@ -63382,6 +64575,10 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63382
64575
|
}
|
|
63383
64576
|
return mergedElement;
|
|
63384
64577
|
},
|
|
64578
|
+
origin: {
|
|
64579
|
+
uri: reference.uri,
|
|
64580
|
+
jsonPointer
|
|
64581
|
+
},
|
|
63385
64582
|
circular: {
|
|
63386
64583
|
uri: $refBaseURI,
|
|
63387
64584
|
meta: {
|
|
@@ -63462,12 +64659,15 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63462
64659
|
mergedElement.meta.set('ref-fields', {
|
|
63463
64660
|
$ref
|
|
63464
64661
|
});
|
|
63465
|
-
// annotate referenced element with info about
|
|
63466
|
-
mergedElement.meta.set('ref-origin', reference.uri);
|
|
64662
|
+
// annotate referenced element with info about type
|
|
63467
64663
|
mergedElement.meta.set('ref-type', element.element);
|
|
63468
64664
|
return mergedElement;
|
|
63469
64665
|
},
|
|
63470
64666
|
aliasField: '$ref',
|
|
64667
|
+
origin: {
|
|
64668
|
+
uri: reference.uri,
|
|
64669
|
+
jsonPointer
|
|
64670
|
+
},
|
|
63471
64671
|
circular: {
|
|
63472
64672
|
uri: $refBaseURI,
|
|
63473
64673
|
meta: {
|
|
@@ -63535,6 +64735,7 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63535
64735
|
const operationCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(target);
|
|
63536
64736
|
// annotate operation element with info about origin and type
|
|
63537
64737
|
operationCopy.meta.set('ref-origin', reference.uri);
|
|
64738
|
+
operationCopy.meta.set('ref-origin-pointer', jsonPointer);
|
|
63538
64739
|
operationCopy.meta.set('ref-type', element.element);
|
|
63539
64740
|
|
|
63540
64741
|
/**
|
|
@@ -63567,8 +64768,14 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63567
64768
|
/**
|
|
63568
64769
|
* Transclude Link Object containing Operation Object in its meta.
|
|
63569
64770
|
*/
|
|
64771
|
+
// create shallow clone to be able to annotate with metadata
|
|
64772
|
+
const operationCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(target);
|
|
64773
|
+
// annotate operation element with info about origin and type
|
|
64774
|
+
operationCopy.meta.set('ref-origin', reference.uri);
|
|
64775
|
+
operationCopy.meta.set('ref-origin-pointer', operationPath.formatPath());
|
|
64776
|
+
operationCopy.meta.set('ref-type', element.element);
|
|
63570
64777
|
const linkElementCopy = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(element);
|
|
63571
|
-
linkElementCopy.operationId?.meta.set('operation',
|
|
64778
|
+
linkElementCopy.operationId?.meta.set('operation', operationCopy);
|
|
63572
64779
|
return linkElementCopy;
|
|
63573
64780
|
});
|
|
63574
64781
|
} catch (error) {
|
|
@@ -63626,6 +64833,7 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63626
64833
|
const valueElement = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_4__.cloneShallow)(target);
|
|
63627
64834
|
// annotate element with info about origin and type
|
|
63628
64835
|
valueElement.meta.set('ref-origin', reference.uri);
|
|
64836
|
+
valueElement.meta.set('ref-origin-pointer', '');
|
|
63629
64837
|
valueElement.meta.set('ref-type', element.element);
|
|
63630
64838
|
|
|
63631
64839
|
/**
|
|
@@ -63674,6 +64882,8 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63674
64882
|
let referencedElement;
|
|
63675
64883
|
// $ids of the schemas enclosing the referenced element within its document
|
|
63676
64884
|
let ancestorSchema$ids;
|
|
64885
|
+
// known when the reference is resolved by JSON Pointer against its document
|
|
64886
|
+
let jsonPointer;
|
|
63677
64887
|
try {
|
|
63678
64888
|
if (isUnknownURI || isURL) {
|
|
63679
64889
|
// we're dealing with canonical URI or URL with possible fragment
|
|
@@ -63796,11 +65006,11 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63796
65006
|
return;
|
|
63797
65007
|
}
|
|
63798
65008
|
reference = await this.toReference(_util_url_mjs__WEBPACK_IMPORTED_MODULE_20__.unsanitize($refBaseURI));
|
|
63799
|
-
|
|
65009
|
+
jsonPointer = _speclynx_apidom_json_pointer__WEBPACK_IMPORTED_MODULE_10__.URIFragmentIdentifier.fromURIReference($refBaseURI);
|
|
63800
65010
|
({
|
|
63801
65011
|
element: referencedElement,
|
|
63802
65012
|
ancestorSchema$ids
|
|
63803
|
-
} = (0,_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_17__.locate)(this.toSchemaDocument(reference.value.result),
|
|
65013
|
+
} = (0,_selectors_json_pointer_mjs__WEBPACK_IMPORTED_MODULE_17__.locate)(this.toSchemaDocument(reference.value.result), jsonPointer));
|
|
63804
65014
|
}
|
|
63805
65015
|
} else {
|
|
63806
65016
|
throw error;
|
|
@@ -63832,8 +65042,7 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63832
65042
|
booleanJsonSchemaElement.meta.set('ref-fields', {
|
|
63833
65043
|
$ref
|
|
63834
65044
|
});
|
|
63835
|
-
// annotate referenced element with info about
|
|
63836
|
-
booleanJsonSchemaElement.meta.set('ref-origin', origin);
|
|
65045
|
+
// annotate referenced element with info about type
|
|
63837
65046
|
booleanJsonSchemaElement.meta.set('ref-type', element.element);
|
|
63838
65047
|
return booleanJsonSchemaElement;
|
|
63839
65048
|
}
|
|
@@ -63853,12 +65062,15 @@ class OpenAPI3_1DereferenceVisitor extends _DereferenceVisitor_mjs__WEBPACK_IMPO
|
|
|
63853
65062
|
mergedElement.meta.set('ref-fields', {
|
|
63854
65063
|
$ref
|
|
63855
65064
|
});
|
|
63856
|
-
// annotate fragment with info about
|
|
63857
|
-
mergedElement.meta.set('ref-origin', origin);
|
|
65065
|
+
// annotate fragment with info about type
|
|
63858
65066
|
mergedElement.meta.set('ref-type', element.element);
|
|
63859
65067
|
return mergedElement;
|
|
63860
65068
|
},
|
|
63861
65069
|
aliasField: '$ref',
|
|
65070
|
+
origin: {
|
|
65071
|
+
uri: origin,
|
|
65072
|
+
jsonPointer
|
|
65073
|
+
},
|
|
63862
65074
|
circular: {
|
|
63863
65075
|
uri: $refBaseURI,
|
|
63864
65076
|
meta: {
|
|
@@ -91616,18 +92828,34 @@ function throwIfCancellationRequested(config) {
|
|
|
91616
92828
|
}
|
|
91617
92829
|
|
|
91618
92830
|
/**
|
|
91619
|
-
*
|
|
92831
|
+
* Resolve the clock used to time adapter execution.
|
|
92832
|
+
*
|
|
92833
|
+
* Prefers the monotonic `performance.now()` so wall-clock adjustments do not
|
|
92834
|
+
* skew the measurement, and so frameworks that forbid reading the current
|
|
92835
|
+
* time during prerendering (e.g. Next.js Cache Components) accept it. Falls
|
|
92836
|
+
* back to `Date.now()` in runtimes without the High Resolution Time API.
|
|
92837
|
+
*
|
|
92838
|
+
* @returns {() => number} Millisecond clock
|
|
92839
|
+
*/
|
|
92840
|
+
function resolveClock() {
|
|
92841
|
+
return typeof performance !== 'undefined' && _utils_js__WEBPACK_IMPORTED_MODULE_6__["default"].isFunction(performance.now)
|
|
92842
|
+
? () => performance.now()
|
|
92843
|
+
: Date.now;
|
|
92844
|
+
}
|
|
92845
|
+
|
|
92846
|
+
/**
|
|
92847
|
+
* Whole milliseconds elapsed since `start`, floored at zero.
|
|
91620
92848
|
*
|
|
91621
|
-
*
|
|
91622
|
-
*
|
|
91623
|
-
* otherwise produce a negative duration, so the result is clamped.
|
|
92849
|
+
* Rounded so the value stays an integer as with `Date.now()`. The fallback
|
|
92850
|
+
* wall clock can move backwards mid-request, so the result is clamped.
|
|
91624
92851
|
*
|
|
91625
|
-
* @param {number}
|
|
92852
|
+
* @param {() => number} now Clock returned by `resolveClock()`
|
|
92853
|
+
* @param {number} start Timestamp read from `now`
|
|
91626
92854
|
*
|
|
91627
92855
|
* @returns {number} Non-negative elapsed milliseconds
|
|
91628
92856
|
*/
|
|
91629
|
-
function elapsedSince(start) {
|
|
91630
|
-
return Math.max(0,
|
|
92857
|
+
function elapsedSince(now, start) {
|
|
92858
|
+
return Math.max(0, Math.round(now() - start));
|
|
91631
92859
|
}
|
|
91632
92860
|
|
|
91633
92861
|
/**
|
|
@@ -91656,13 +92884,14 @@ function dispatchRequest(_config) {
|
|
|
91656
92884
|
|
|
91657
92885
|
const adapter = _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_5__["default"].getAdapter(config.adapter || _defaults_index_js__WEBPACK_IMPORTED_MODULE_2__["default"].adapter, config);
|
|
91658
92886
|
|
|
91659
|
-
const
|
|
92887
|
+
const now = resolveClock();
|
|
92888
|
+
const start = now();
|
|
91660
92889
|
|
|
91661
92890
|
return adapter(config).then(
|
|
91662
92891
|
function onAdapterResolution(response) {
|
|
91663
92892
|
throwIfCancellationRequested(config);
|
|
91664
92893
|
|
|
91665
|
-
response.duration = elapsedSince(start);
|
|
92894
|
+
response.duration = elapsedSince(now, start);
|
|
91666
92895
|
|
|
91667
92896
|
// Expose the current response on config so that transformResponse can
|
|
91668
92897
|
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
@@ -91684,7 +92913,7 @@ function dispatchRequest(_config) {
|
|
|
91684
92913
|
|
|
91685
92914
|
// Transform response data
|
|
91686
92915
|
if (reason && reason.response) {
|
|
91687
|
-
reason.response.duration = elapsedSince(start);
|
|
92916
|
+
reason.response.duration = elapsedSince(now, start);
|
|
91688
92917
|
config.response = reason.response;
|
|
91689
92918
|
try {
|
|
91690
92919
|
reason.response.data = _transformData_js__WEBPACK_IMPORTED_MODULE_0__["default"].call(
|
|
@@ -92339,7 +93568,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
92339
93568
|
|
|
92340
93569
|
"use strict";
|
|
92341
93570
|
__webpack_require__.r(__webpack_exports__);
|
|
92342
|
-
const VERSION = "1.21.
|
|
93571
|
+
const VERSION = "1.21.1";
|
|
92343
93572
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
92344
93573
|
/* harmony export */ "VERSION", 0, /* binding */ VERSION
|
|
92345
93574
|
/* harmony export */ ]);
|
|
@@ -118972,6 +120201,16 @@ var r={8341(e,t,n){n(7603);var r=n(2856);e.exports=r("Array","includes")},5161(e
|
|
|
118972
120201
|
/******/ }
|
|
118973
120202
|
/******/
|
|
118974
120203
|
/************************************************************************/
|
|
120204
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
120205
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
120206
|
+
/******/ __webpack_require__.n = (module) => {
|
|
120207
|
+
/******/ const getter = module && module.__esModule ?
|
|
120208
|
+
/******/ () => (module['default']) :
|
|
120209
|
+
/******/ () => (module);
|
|
120210
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
120211
|
+
/******/ return getter;
|
|
120212
|
+
/******/ };
|
|
120213
|
+
/******/
|
|
118975
120214
|
/******/ /* webpack/runtime/create fake namespace object */
|
|
118976
120215
|
/******/ (() => {
|
|
118977
120216
|
/******/ const getProto = Object.getPrototypeOf;
|
|
@@ -119075,7 +120314,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
119075
120314
|
/* harmony export */ ArazzoDocument: () => (/* reexport safe */ _document_ArazzoDocument_ts__WEBPACK_IMPORTED_MODULE_6__["default"]),
|
|
119076
120315
|
/* harmony export */ ArazzoDocumentRegistryProvider: () => (/* reexport safe */ _registry_providers_ArazzoDocumentRegistryProvider_ts__WEBPACK_IMPORTED_MODULE_3__["default"]),
|
|
119077
120316
|
/* harmony export */ ArazzoRunner: () => (/* reexport safe */ _ArazzoRunner_ts__WEBPACK_IMPORTED_MODULE_0__["default"]),
|
|
119078
|
-
/* harmony export */ ArazzoRunnerError: () => (/* reexport safe */
|
|
120317
|
+
/* harmony export */ ArazzoRunnerError: () => (/* reexport safe */ _errors_ArazzoRunnerError_ts__WEBPACK_IMPORTED_MODULE_51__["default"]),
|
|
119079
120318
|
/* harmony export */ ArazzoSourceDescriptionIndex: () => (/* reexport safe */ _document_ArazzoSourceDescriptionIndex_ts__WEBPACK_IMPORTED_MODULE_10__["default"]),
|
|
119080
120319
|
/* harmony export */ ArazzoStepExtractor: () => (/* reexport safe */ _extractor_ArazzoStepExtractor_ts__WEBPACK_IMPORTED_MODULE_13__["default"]),
|
|
119081
120320
|
/* harmony export */ ArazzoStepIndex: () => (/* reexport safe */ _document_ArazzoStepIndex_ts__WEBPACK_IMPORTED_MODULE_9__["default"]),
|
|
@@ -119085,19 +120324,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
119085
120324
|
/* harmony export */ ArazzoWorkflowIndex: () => (/* reexport safe */ _document_ArazzoWorkflowIndex_ts__WEBPACK_IMPORTED_MODULE_8__["default"]),
|
|
119086
120325
|
/* harmony export */ ArazzoWorkflowLocatorNormalizer: () => (/* reexport safe */ _executor_ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_47__["default"]),
|
|
119087
120326
|
/* harmony export */ ArazzoWorkflowNormalizer: () => (/* reexport safe */ _normalizer_ArazzoWorkflowNormalizer_ts__WEBPACK_IMPORTED_MODULE_15__["default"]),
|
|
119088
|
-
/* harmony export */ AssemblerError: () => (/* reexport safe */
|
|
119089
|
-
/* harmony export */ ClientError: () => (/* reexport safe */
|
|
119090
|
-
/* harmony export */ CriterionError: () => (/* reexport safe */
|
|
119091
|
-
/* harmony export */ CriterionEvaluationError: () => (/* reexport safe */
|
|
120327
|
+
/* harmony export */ AssemblerError: () => (/* reexport safe */ _errors_AssemblerError_ts__WEBPACK_IMPORTED_MODULE_52__["default"]),
|
|
120328
|
+
/* harmony export */ ClientError: () => (/* reexport safe */ _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_53__["default"]),
|
|
120329
|
+
/* harmony export */ CriterionError: () => (/* reexport safe */ _errors_CriterionError_ts__WEBPACK_IMPORTED_MODULE_60__["default"]),
|
|
120330
|
+
/* harmony export */ CriterionEvaluationError: () => (/* reexport safe */ _errors_CriterionEvaluationError_ts__WEBPACK_IMPORTED_MODULE_61__["default"]),
|
|
119092
120331
|
/* harmony export */ CriterionEvaluator: () => (/* reexport safe */ _criterion_CriterionEvaluator_ts__WEBPACK_IMPORTED_MODULE_29__["default"]),
|
|
119093
|
-
/* harmony export */ DocumentLoadError: () => (/* reexport safe */
|
|
120332
|
+
/* harmony export */ DocumentLoadError: () => (/* reexport safe */ _errors_DocumentLoadError_ts__WEBPACK_IMPORTED_MODULE_58__["default"]),
|
|
119094
120333
|
/* harmony export */ DocumentRegistry: () => (/* reexport safe */ _registry_DocumentRegistry_ts__WEBPACK_IMPORTED_MODULE_1__["default"]),
|
|
119095
120334
|
/* harmony export */ DocumentRegistryProvider: () => (/* reexport safe */ _registry_providers_DocumentRegistryProvider_ts__WEBPACK_IMPORTED_MODULE_2__["default"]),
|
|
119096
|
-
/* harmony export */ ExecutionError: () => (/* reexport safe */
|
|
119097
|
-
/* harmony export */ ExtractionError: () => (/* reexport safe */
|
|
119098
|
-
/* harmony export */ InvalidEntryDocumentError: () => (/* reexport safe */
|
|
120335
|
+
/* harmony export */ ExecutionError: () => (/* reexport safe */ _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_63__["default"]),
|
|
120336
|
+
/* harmony export */ ExtractionError: () => (/* reexport safe */ _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_55__["default"]),
|
|
120337
|
+
/* harmony export */ InvalidEntryDocumentError: () => (/* reexport safe */ _errors_InvalidEntryDocumentError_ts__WEBPACK_IMPORTED_MODULE_56__["default"]),
|
|
119099
120338
|
/* harmony export */ JSONPathCriterionEvaluator: () => (/* reexport safe */ _criterion_JSONPathCriterionEvaluator_ts__WEBPACK_IMPORTED_MODULE_32__["default"]),
|
|
119100
|
-
/* harmony export */ NormalizationError: () => (/* reexport safe */
|
|
120339
|
+
/* harmony export */ NormalizationError: () => (/* reexport safe */ _errors_NormalizationError_ts__WEBPACK_IMPORTED_MODULE_54__["default"]),
|
|
119101
120340
|
/* harmony export */ OpenAPI2DocumentAssembler: () => (/* reexport safe */ _assembler_OpenAPI2DocumentAssembler_ts__WEBPACK_IMPORTED_MODULE_22__["default"]),
|
|
119102
120341
|
/* harmony export */ OpenAPI2OperationNormalizer: () => (/* reexport safe */ _normalizer_OpenAPI2OperationNormalizer_ts__WEBPACK_IMPORTED_MODULE_18__["default"]),
|
|
119103
120342
|
/* harmony export */ OpenAPI30DocumentAssembler: () => (/* reexport safe */ _assembler_OpenAPI30DocumentAssembler_ts__WEBPACK_IMPORTED_MODULE_23__["default"]),
|
|
@@ -119116,21 +120355,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
119116
120355
|
/* harmony export */ OpenAPIOperationResponse: () => (/* reexport safe */ _client_OpenAPIOperationResponse_ts__WEBPACK_IMPORTED_MODULE_26__["default"]),
|
|
119117
120356
|
/* harmony export */ OpenAPIOperationResponseNormalizer: () => (/* reexport safe */ _client_OpenAPIOperationResponseNormalizer_ts__WEBPACK_IMPORTED_MODULE_27__["default"]),
|
|
119118
120357
|
/* harmony export */ OutputResolver: () => (/* reexport safe */ _resolver_OutputResolver_ts__WEBPACK_IMPORTED_MODULE_39__["default"]),
|
|
120358
|
+
/* harmony export */ Redactor: () => (/* reexport safe */ _observability_Redactor_ts__WEBPACK_IMPORTED_MODULE_50__["default"]),
|
|
119119
120359
|
/* harmony export */ RegexCriterionEvaluator: () => (/* reexport safe */ _criterion_RegexCriterionEvaluator_ts__WEBPACK_IMPORTED_MODULE_31__["default"]),
|
|
119120
120360
|
/* harmony export */ RequestBodyResolver: () => (/* reexport safe */ _resolver_RequestBodyResolver_ts__WEBPACK_IMPORTED_MODULE_40__["default"]),
|
|
119121
|
-
/* harmony export */ ResolverError: () => (/* reexport safe */
|
|
119122
|
-
/* harmony export */ RuntimeExpressionError: () => (/* reexport safe */
|
|
120361
|
+
/* harmony export */ ResolverError: () => (/* reexport safe */ _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_62__["default"]),
|
|
120362
|
+
/* harmony export */ RuntimeExpressionError: () => (/* reexport safe */ _errors_RuntimeExpressionError_ts__WEBPACK_IMPORTED_MODULE_59__["default"]),
|
|
119123
120363
|
/* harmony export */ RuntimeExpressionEvaluator: () => (/* reexport safe */ _expression_RuntimeExpressionEvaluator_ts__WEBPACK_IMPORTED_MODULE_28__["default"]),
|
|
119124
120364
|
/* harmony export */ SimpleCriterionEvaluator: () => (/* reexport safe */ _criterion_SimpleCriterionEvaluator_ts__WEBPACK_IMPORTED_MODULE_30__["default"]),
|
|
119125
120365
|
/* harmony export */ SourceDescriptionsLocatorNormalizer: () => (/* reexport safe */ _executor_SourceDescriptionsLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_45__["default"]),
|
|
119126
120366
|
/* harmony export */ StepExecutor: () => (/* reexport safe */ _executor_StepExecutor_ts__WEBPACK_IMPORTED_MODULE_43__["default"]),
|
|
119127
120367
|
/* harmony export */ StepParameterResolver: () => (/* reexport safe */ _resolver_StepParameterResolver_ts__WEBPACK_IMPORTED_MODULE_36__["default"]),
|
|
119128
|
-
/* harmony export */ UnmatchedProviderError: () => (/* reexport safe */
|
|
120368
|
+
/* harmony export */ UnmatchedProviderError: () => (/* reexport safe */ _errors_UnmatchedProviderError_ts__WEBPACK_IMPORTED_MODULE_57__["default"]),
|
|
119129
120369
|
/* harmony export */ WorkflowExecutionState: () => (/* reexport safe */ _state_WorkflowExecutionState_ts__WEBPACK_IMPORTED_MODULE_34__["default"]),
|
|
119130
120370
|
/* harmony export */ WorkflowExecutor: () => (/* reexport safe */ _executor_WorkflowExecutor_ts__WEBPACK_IMPORTED_MODULE_42__["default"]),
|
|
119131
120371
|
/* harmony export */ WorkflowParameterResolver: () => (/* reexport safe */ _resolver_WorkflowParameterResolver_ts__WEBPACK_IMPORTED_MODULE_38__["default"]),
|
|
119132
120372
|
/* harmony export */ XPathCriterionEvaluator: () => (/* reexport safe */ _criterion_XPathCriterionEvaluator_ts__WEBPACK_IMPORTED_MODULE_33__["default"]),
|
|
120373
|
+
/* harmony export */ combineObservers: () => (/* reexport safe */ _observability_combineObservers_ts__WEBPACK_IMPORTED_MODULE_48__["default"]),
|
|
119133
120374
|
/* harmony export */ httpClientFetch: () => (/* reexport safe */ _client_HTTPClientFetch_ts__WEBPACK_IMPORTED_MODULE_25__["default"]),
|
|
120375
|
+
/* harmony export */ instrument: () => (/* reexport safe */ _observability_instrument_ts__WEBPACK_IMPORTED_MODULE_49__["default"]),
|
|
119134
120376
|
/* harmony export */ settledResult: () => (/* reexport safe */ _executor_WorkflowExecutor_ts__WEBPACK_IMPORTED_MODULE_42__.settledResult)
|
|
119135
120377
|
/* harmony export */ });
|
|
119136
120378
|
/* harmony import */ var _ArazzoRunner_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57253);
|
|
@@ -119181,19 +120423,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
119181
120423
|
/* harmony import */ var _executor_SourceDescriptionsLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(83461);
|
|
119182
120424
|
/* harmony import */ var _executor_OpenAPIOperationLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(7308);
|
|
119183
120425
|
/* harmony import */ var _executor_ArazzoWorkflowLocatorNormalizer_ts__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(98885);
|
|
119184
|
-
/* harmony import */ var
|
|
119185
|
-
/* harmony import */ var
|
|
119186
|
-
/* harmony import */ var
|
|
119187
|
-
/* harmony import */ var
|
|
119188
|
-
/* harmony import */ var
|
|
119189
|
-
/* harmony import */ var
|
|
119190
|
-
/* harmony import */ var
|
|
119191
|
-
/* harmony import */ var
|
|
119192
|
-
/* harmony import */ var
|
|
119193
|
-
/* harmony import */ var
|
|
119194
|
-
/* harmony import */ var
|
|
119195
|
-
/* harmony import */ var
|
|
119196
|
-
/* harmony import */ var
|
|
120426
|
+
/* harmony import */ var _observability_combineObservers_ts__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(35622);
|
|
120427
|
+
/* harmony import */ var _observability_instrument_ts__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(21327);
|
|
120428
|
+
/* harmony import */ var _observability_Redactor_ts__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(4050);
|
|
120429
|
+
/* harmony import */ var _errors_ArazzoRunnerError_ts__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(23949);
|
|
120430
|
+
/* harmony import */ var _errors_AssemblerError_ts__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(90706);
|
|
120431
|
+
/* harmony import */ var _errors_ClientError_ts__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(81763);
|
|
120432
|
+
/* harmony import */ var _errors_NormalizationError_ts__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(35523);
|
|
120433
|
+
/* harmony import */ var _errors_ExtractionError_ts__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(90713);
|
|
120434
|
+
/* harmony import */ var _errors_InvalidEntryDocumentError_ts__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(40198);
|
|
120435
|
+
/* harmony import */ var _errors_UnmatchedProviderError_ts__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(46132);
|
|
120436
|
+
/* harmony import */ var _errors_DocumentLoadError_ts__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(24089);
|
|
120437
|
+
/* harmony import */ var _errors_RuntimeExpressionError_ts__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(48770);
|
|
120438
|
+
/* harmony import */ var _errors_CriterionError_ts__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(41233);
|
|
120439
|
+
/* harmony import */ var _errors_CriterionEvaluationError_ts__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(71731);
|
|
120440
|
+
/* harmony import */ var _errors_ResolverError_ts__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(8696);
|
|
120441
|
+
/* harmony import */ var _errors_ExecutionError_ts__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(17658);
|
|
119197
120442
|
/* Runner */
|
|
119198
120443
|
|
|
119199
120444
|
|
|
@@ -119265,6 +120510,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
119265
120510
|
|
|
119266
120511
|
|
|
119267
120512
|
|
|
120513
|
+
|
|
120514
|
+
/* Observability */
|
|
120515
|
+
|
|
120516
|
+
|
|
120517
|
+
|
|
120518
|
+
|
|
119268
120519
|
/* Errors */
|
|
119269
120520
|
|
|
119270
120521
|
|