@usearazzo/runner 1.0.1-alpha.34 → 1.0.1-alpha.36
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 +20 -0
- package/README.md +6 -1
- package/dist/arazzo-runner.browser.js +2212 -1116
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +78 -25
- package/src/errors/ExecutionError.cjs +2 -0
- package/src/errors/ExecutionError.mjs +2 -0
- package/src/executor/OpenAPIOperationExecutor.cjs +58 -47
- package/src/executor/OpenAPIOperationExecutor.mjs +58 -47
- package/src/executor/WorkflowExecutor.cjs +302 -160
- package/src/executor/WorkflowExecutor.mjs +302 -160
- package/src/index.cjs +14 -0
- package/src/index.mjs +2 -0
- package/src/observability/EventChannel.cjs +30 -20
- package/src/observability/EventChannel.mjs +30 -23
- package/src/observability/Redactor.cjs +7 -5
- package/src/observability/Redactor.mjs +7 -5
- 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 +14 -9
- package/src/registry/DocumentRegistry.mjs +14 -9
- package/src/vendor/swagger-client.cjs +1 -1
- package/src/vendor/swagger-client.mjs +1 -1
- package/src/version.cjs +9 -0
- package/src/version.mjs +3 -0
- package/types/observability/logging/LoggingObserver.d.cts +82 -0
- package/types/observability/logging/LoggingObserver.d.ts +82 -0
- package/types/observability/logging/index.d.cts +2 -0
- package/types/observability/logging/index.d.ts +2 -0
- package/types/observability/opentelemetry/ArazzoRunnerInstrumentation.d.cts +84 -0
- package/types/observability/opentelemetry/ArazzoRunnerInstrumentation.d.ts +84 -0
- package/types/observability/opentelemetry/index.d.cts +2 -0
- package/types/observability/opentelemetry/index.d.ts +2 -0
- package/types/observability/stream/EventStream.d.cts +68 -0
- package/types/observability/stream/EventStream.d.ts +68 -0
- package/types/observability/stream/index.d.cts +2 -0
- package/types/observability/stream/index.d.ts +2 -0
- package/types/runner.d.cts +3891 -0
- package/types/runner.d.ts +137 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usearazzo/runner",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.36",
|
|
4
4
|
"description": "Runner for Arazzo Workflows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arazzo",
|
|
@@ -28,9 +28,46 @@
|
|
|
28
28
|
"unpkg": "./dist/arazzo-runner.browser.min.js",
|
|
29
29
|
"main": "./src/index.cjs",
|
|
30
30
|
"exports": {
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
".": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./types/runner.d.ts",
|
|
34
|
+
"default": "./src/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./types/runner.d.cts",
|
|
38
|
+
"default": "./src/index.cjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./observability/logging": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./types/observability/logging/index.d.ts",
|
|
44
|
+
"default": "./src/observability/logging/index.mjs"
|
|
45
|
+
},
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./types/observability/logging/index.d.cts",
|
|
48
|
+
"default": "./src/observability/logging/index.cjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"./observability/stream": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./types/observability/stream/index.d.ts",
|
|
54
|
+
"default": "./src/observability/stream/index.mjs"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./types/observability/stream/index.d.cts",
|
|
58
|
+
"default": "./src/observability/stream/index.cjs"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"./observability/opentelemetry": {
|
|
62
|
+
"import": {
|
|
63
|
+
"types": "./types/observability/opentelemetry/index.d.ts",
|
|
64
|
+
"default": "./src/observability/opentelemetry/index.mjs"
|
|
65
|
+
},
|
|
66
|
+
"require": {
|
|
67
|
+
"types": "./types/observability/opentelemetry/index.d.cts",
|
|
68
|
+
"default": "./src/observability/opentelemetry/index.cjs"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
34
71
|
},
|
|
35
72
|
"types": "./types/runner.d.ts",
|
|
36
73
|
"scripts": {
|
|
@@ -43,7 +80,9 @@
|
|
|
43
80
|
"lint:fix": "eslint ./ --fix",
|
|
44
81
|
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
|
|
45
82
|
"typescript:check-types": "tsc --noEmit",
|
|
46
|
-
"
|
|
83
|
+
"version": "node ../../scripts/version-update.mjs",
|
|
84
|
+
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json && node ../../scripts/declarations-cts.mjs",
|
|
85
|
+
"typescript:check-published-types": "attw --pack . --profile node16 && tsc -p test/types/tsconfig.json",
|
|
47
86
|
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
|
|
48
87
|
"test:e2e": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha --config .mocharc.e2e.json",
|
|
49
88
|
"prepack": "copyfiles -u 2 ../../LICENSE . && copyfiles -u 2 ../../NOTICE .",
|
|
@@ -56,44 +95,58 @@
|
|
|
56
95
|
"author": "Vladimir Gorej <vladimir.gorej@gmail.com>",
|
|
57
96
|
"license": "Apache-2.0",
|
|
58
97
|
"dependencies": {
|
|
59
|
-
"@babel/runtime-corejs3": "^8.1.
|
|
60
|
-
"@speclynx/apidom-core": "^7.1.
|
|
61
|
-
"@speclynx/apidom-datamodel": "^7.1.
|
|
62
|
-
"@speclynx/apidom-error": "^7.1.
|
|
63
|
-
"@speclynx/apidom-json-pointer": "^7.1.
|
|
64
|
-
"@speclynx/apidom-ns-arazzo-1": "^7.1.
|
|
65
|
-
"@speclynx/apidom-ns-openapi-2": "^7.1.
|
|
66
|
-
"@speclynx/apidom-ns-openapi-3-0": "^7.1.
|
|
67
|
-
"@speclynx/apidom-ns-openapi-3-1": "^7.1.
|
|
68
|
-
"@speclynx/apidom-reference": "^7.1.
|
|
69
|
-
"@speclynx/apidom-traverse": "^7.1.
|
|
98
|
+
"@babel/runtime-corejs3": "^8.1.3",
|
|
99
|
+
"@speclynx/apidom-core": "^7.1.1",
|
|
100
|
+
"@speclynx/apidom-datamodel": "^7.1.1",
|
|
101
|
+
"@speclynx/apidom-error": "^7.1.1",
|
|
102
|
+
"@speclynx/apidom-json-pointer": "^7.1.1",
|
|
103
|
+
"@speclynx/apidom-ns-arazzo-1": "^7.1.1",
|
|
104
|
+
"@speclynx/apidom-ns-openapi-2": "^7.1.1",
|
|
105
|
+
"@speclynx/apidom-ns-openapi-3-0": "^7.1.1",
|
|
106
|
+
"@speclynx/apidom-ns-openapi-3-1": "^7.1.1",
|
|
107
|
+
"@speclynx/apidom-reference": "^7.1.1",
|
|
108
|
+
"@speclynx/apidom-traverse": "^7.1.1",
|
|
70
109
|
"@swaggerexpert/arazzo-criterion": "^1.2.0",
|
|
71
110
|
"@swaggerexpert/arazzo-runtime-expression": "^3.4.0",
|
|
72
|
-
"@swaggerexpert/cookie": "^2.
|
|
73
|
-
"@swaggerexpert/json-pointer": "^3.0.
|
|
74
|
-
"@swaggerexpert/jsonpath": "^4.0
|
|
75
|
-
"@swaggerexpert/media-types": "^1.0.
|
|
76
|
-
"@usearazzo/parser": "1.0.1-alpha.
|
|
77
|
-
"@usearazzo/resolver": "1.0.1-alpha.
|
|
111
|
+
"@swaggerexpert/cookie": "^2.2.0",
|
|
112
|
+
"@swaggerexpert/json-pointer": "^3.0.3",
|
|
113
|
+
"@swaggerexpert/jsonpath": "^4.1.0",
|
|
114
|
+
"@swaggerexpert/media-types": "^1.0.3",
|
|
115
|
+
"@usearazzo/parser": "1.0.1-alpha.36",
|
|
116
|
+
"@usearazzo/resolver": "1.0.1-alpha.36",
|
|
78
117
|
"@xmldom/xmldom": "^0.9.12",
|
|
79
118
|
"fontoxpath": "^3.34.0",
|
|
80
119
|
"ramda": "^0.32.0",
|
|
81
120
|
"ramda-adjunct": "^6.1.0",
|
|
82
|
-
"short-unique-id": "^5.3.2"
|
|
83
|
-
"type-fest": "^5.10.0"
|
|
121
|
+
"short-unique-id": "^5.3.2"
|
|
84
122
|
},
|
|
85
123
|
"files": [
|
|
86
124
|
"src/**/*.mjs",
|
|
87
125
|
"src/**/*.cjs",
|
|
88
126
|
"dist/",
|
|
89
127
|
"types/runner.d.ts",
|
|
128
|
+
"types/runner.d.cts",
|
|
129
|
+
"types/observability/logging/",
|
|
130
|
+
"types/observability/stream/",
|
|
131
|
+
"types/observability/opentelemetry/",
|
|
90
132
|
"LICENSE",
|
|
91
133
|
"NOTICE",
|
|
92
134
|
"README.md",
|
|
93
135
|
"CHANGELOG.md"
|
|
94
136
|
],
|
|
137
|
+
"peerDependencies": {
|
|
138
|
+
"@opentelemetry/api": "^1.9.0"
|
|
139
|
+
},
|
|
140
|
+
"peerDependenciesMeta": {
|
|
141
|
+
"@opentelemetry/api": {
|
|
142
|
+
"optional": true
|
|
143
|
+
}
|
|
144
|
+
},
|
|
95
145
|
"devDependencies": {
|
|
146
|
+
"@opentelemetry/api": "~1.9.0",
|
|
147
|
+
"@opentelemetry/context-async-hooks": "^3.1.1",
|
|
148
|
+
"@opentelemetry/sdk-trace-base": "^2.12.0",
|
|
96
149
|
"swagger-client": "^3.39.0"
|
|
97
150
|
},
|
|
98
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "039f55923d0f86676181764b02744affcf5f6da2"
|
|
99
152
|
}
|
|
@@ -27,6 +27,8 @@ class ExecutionError extends _ArazzoRunnerError.default {
|
|
|
27
27
|
static GotoTargetMissing = 'goto-target-missing';
|
|
28
28
|
/** A `goto` action's `stepId` names no step in the workflow. */
|
|
29
29
|
static GotoTargetNotFound = 'goto-target-not-found';
|
|
30
|
+
/** A process-wide instrumentation wrap (see `instrument`) settled without running its workflow or step. */
|
|
31
|
+
static InstrumentationWrap = 'instrumentation-wrap';
|
|
30
32
|
/** An `operationId` or `operationPath` is not a valid operation reference. */
|
|
31
33
|
static InvalidOperationReference = 'invalid-operation-reference';
|
|
32
34
|
/** A `workflowId` is not a valid `$sourceDescriptions.{name}.{workflowId}` expression. */
|
|
@@ -20,6 +20,8 @@ class ExecutionError extends ArazzoRunnerError {
|
|
|
20
20
|
static GotoTargetMissing = 'goto-target-missing';
|
|
21
21
|
/** A `goto` action's `stepId` names no step in the workflow. */
|
|
22
22
|
static GotoTargetNotFound = 'goto-target-not-found';
|
|
23
|
+
/** A process-wide instrumentation wrap (see `instrument`) settled without running its workflow or step. */
|
|
24
|
+
static InstrumentationWrap = 'instrumentation-wrap';
|
|
23
25
|
/** An `operationId` or `operationPath` is not a valid operation reference. */
|
|
24
26
|
static InvalidOperationReference = 'invalid-operation-reference';
|
|
25
27
|
/** A `workflowId` is not a valid `$sourceDescriptions.{name}.{workflowId}` expression. */
|
|
@@ -171,6 +171,7 @@ class OpenAPIOperationExecutor {
|
|
|
171
171
|
#operationNormalizer;
|
|
172
172
|
#documentAssembler;
|
|
173
173
|
#captureBodies;
|
|
174
|
+
// emits only while `hasObservers`, so an unobserved block builds no events
|
|
174
175
|
#events;
|
|
175
176
|
constructor(options = {}) {
|
|
176
177
|
this.#httpClient = options.httpClient ?? _HTTPClientFetch.default;
|
|
@@ -179,7 +180,7 @@ class OpenAPIOperationExecutor {
|
|
|
179
180
|
this.#operationExtractor = options.operationExtractor ?? new _OpenAPIOperationExtractor.default();
|
|
180
181
|
this.#operationNormalizer = options.operationNormalizer ?? new _OpenAPIOperationNormalizer.default();
|
|
181
182
|
this.#documentAssembler = options.documentAssembler ?? new _OpenAPIDocumentAssembler.default();
|
|
182
|
-
this.#events = _EventChannel.default
|
|
183
|
+
this.#events = new _EventChannel.default({
|
|
183
184
|
observer: options.observer,
|
|
184
185
|
now: options.now
|
|
185
186
|
});
|
|
@@ -239,26 +240,32 @@ class OpenAPIOperationExecutor {
|
|
|
239
240
|
}
|
|
240
241
|
})
|
|
241
242
|
};
|
|
242
|
-
this.#events
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
if (this.#events.hasObservers) {
|
|
244
|
+
this.#events.emit({
|
|
245
|
+
type: 'openapi:operation:normalize:start',
|
|
246
|
+
...context,
|
|
247
|
+
runId,
|
|
248
|
+
location: location()
|
|
249
|
+
});
|
|
250
|
+
}
|
|
248
251
|
const normalizedOperation = await this.#operationNormalizer.normalize(operation, locator.document);
|
|
249
|
-
this.#events
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
if (this.#events.hasObservers) {
|
|
253
|
+
this.#events.emit({
|
|
254
|
+
type: 'openapi:operation:normalize:settled',
|
|
255
|
+
...context,
|
|
256
|
+
runId,
|
|
257
|
+
location: location()
|
|
258
|
+
});
|
|
259
|
+
}
|
|
255
260
|
const assembled = this.#documentAssembler.assemble(normalizedOperation, locator.document);
|
|
256
|
-
this.#events
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
if (this.#events.hasObservers) {
|
|
262
|
+
this.#events.emit({
|
|
263
|
+
type: 'openapi:operation:assembled',
|
|
264
|
+
...context,
|
|
265
|
+
runId,
|
|
266
|
+
location: location()
|
|
267
|
+
});
|
|
268
|
+
}
|
|
262
269
|
const rest = (0, _ramda.omit)(['requestInterceptor', 'step', 'runId', 'operationId', 'operationPath', 'userFetch', 'responseInterceptor'], executeOptions);
|
|
263
270
|
|
|
264
271
|
// each step derives the next options rather than editing in place
|
|
@@ -303,20 +310,22 @@ class OpenAPIOperationExecutor {
|
|
|
303
310
|
},
|
|
304
311
|
body: request.body
|
|
305
312
|
};
|
|
306
|
-
this.#events
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
if (this.#events.hasObservers) {
|
|
314
|
+
this.#events.emit({
|
|
315
|
+
type: 'openapi:operation:request:start',
|
|
316
|
+
...context,
|
|
317
|
+
runId,
|
|
318
|
+
location: location(),
|
|
319
|
+
request: {
|
|
320
|
+
method: request.method,
|
|
321
|
+
url: request.url,
|
|
322
|
+
headers: request.headers,
|
|
323
|
+
...(this.#captureBodies ? {
|
|
324
|
+
body: request.body
|
|
325
|
+
} : {})
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
320
329
|
let rawResponse;
|
|
321
330
|
try {
|
|
322
331
|
rawResponse = await this.#httpClient(request);
|
|
@@ -327,20 +336,22 @@ class OpenAPIOperationExecutor {
|
|
|
327
336
|
});
|
|
328
337
|
}
|
|
329
338
|
const response = await this.#responseNormalizer.normalize(rawResponse, requestInfo);
|
|
330
|
-
this.#events
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
339
|
+
if (this.#events.hasObservers) {
|
|
340
|
+
this.#events.emit({
|
|
341
|
+
type: 'openapi:operation:request:settled',
|
|
342
|
+
...context,
|
|
343
|
+
runId,
|
|
344
|
+
location: location(),
|
|
345
|
+
response: {
|
|
346
|
+
status: response.status,
|
|
347
|
+
headers: response.headers,
|
|
348
|
+
size: response.size,
|
|
349
|
+
...(this.#captureBodies ? {
|
|
350
|
+
body: response.body
|
|
351
|
+
} : {})
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
344
355
|
return response;
|
|
345
356
|
}
|
|
346
357
|
|
|
@@ -159,6 +159,7 @@ class OpenAPIOperationExecutor {
|
|
|
159
159
|
#operationNormalizer;
|
|
160
160
|
#documentAssembler;
|
|
161
161
|
#captureBodies;
|
|
162
|
+
// emits only while `hasObservers`, so an unobserved block builds no events
|
|
162
163
|
#events;
|
|
163
164
|
constructor(options = {}) {
|
|
164
165
|
this.#httpClient = options.httpClient ?? httpClientFetch;
|
|
@@ -167,7 +168,7 @@ class OpenAPIOperationExecutor {
|
|
|
167
168
|
this.#operationExtractor = options.operationExtractor ?? new OpenAPIOperationExtractor();
|
|
168
169
|
this.#operationNormalizer = options.operationNormalizer ?? new OpenAPIOperationNormalizer();
|
|
169
170
|
this.#documentAssembler = options.documentAssembler ?? new OpenAPIDocumentAssembler();
|
|
170
|
-
this.#events = EventChannel
|
|
171
|
+
this.#events = new EventChannel({
|
|
171
172
|
observer: options.observer,
|
|
172
173
|
now: options.now
|
|
173
174
|
});
|
|
@@ -227,26 +228,32 @@ class OpenAPIOperationExecutor {
|
|
|
227
228
|
}
|
|
228
229
|
})
|
|
229
230
|
};
|
|
230
|
-
this.#events
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
231
|
+
if (this.#events.hasObservers) {
|
|
232
|
+
this.#events.emit({
|
|
233
|
+
type: 'openapi:operation:normalize:start',
|
|
234
|
+
...context,
|
|
235
|
+
runId,
|
|
236
|
+
location: location()
|
|
237
|
+
});
|
|
238
|
+
}
|
|
236
239
|
const normalizedOperation = await this.#operationNormalizer.normalize(operation, locator.document);
|
|
237
|
-
this.#events
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
if (this.#events.hasObservers) {
|
|
241
|
+
this.#events.emit({
|
|
242
|
+
type: 'openapi:operation:normalize:settled',
|
|
243
|
+
...context,
|
|
244
|
+
runId,
|
|
245
|
+
location: location()
|
|
246
|
+
});
|
|
247
|
+
}
|
|
243
248
|
const assembled = this.#documentAssembler.assemble(normalizedOperation, locator.document);
|
|
244
|
-
this.#events
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
if (this.#events.hasObservers) {
|
|
250
|
+
this.#events.emit({
|
|
251
|
+
type: 'openapi:operation:assembled',
|
|
252
|
+
...context,
|
|
253
|
+
runId,
|
|
254
|
+
location: location()
|
|
255
|
+
});
|
|
256
|
+
}
|
|
250
257
|
const rest = omit(['requestInterceptor', 'step', 'runId', 'operationId', 'operationPath', 'userFetch', 'responseInterceptor'], executeOptions);
|
|
251
258
|
|
|
252
259
|
// each step derives the next options rather than editing in place
|
|
@@ -291,20 +298,22 @@ class OpenAPIOperationExecutor {
|
|
|
291
298
|
},
|
|
292
299
|
body: request.body
|
|
293
300
|
};
|
|
294
|
-
this.#events
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
301
|
+
if (this.#events.hasObservers) {
|
|
302
|
+
this.#events.emit({
|
|
303
|
+
type: 'openapi:operation:request:start',
|
|
304
|
+
...context,
|
|
305
|
+
runId,
|
|
306
|
+
location: location(),
|
|
307
|
+
request: {
|
|
308
|
+
method: request.method,
|
|
309
|
+
url: request.url,
|
|
310
|
+
headers: request.headers,
|
|
311
|
+
...(this.#captureBodies ? {
|
|
312
|
+
body: request.body
|
|
313
|
+
} : {})
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
308
317
|
let rawResponse;
|
|
309
318
|
try {
|
|
310
319
|
rawResponse = await this.#httpClient(request);
|
|
@@ -315,20 +324,22 @@ class OpenAPIOperationExecutor {
|
|
|
315
324
|
});
|
|
316
325
|
}
|
|
317
326
|
const response = await this.#responseNormalizer.normalize(rawResponse, requestInfo);
|
|
318
|
-
this.#events
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
327
|
+
if (this.#events.hasObservers) {
|
|
328
|
+
this.#events.emit({
|
|
329
|
+
type: 'openapi:operation:request:settled',
|
|
330
|
+
...context,
|
|
331
|
+
runId,
|
|
332
|
+
location: location(),
|
|
333
|
+
response: {
|
|
334
|
+
status: response.status,
|
|
335
|
+
headers: response.headers,
|
|
336
|
+
size: response.size,
|
|
337
|
+
...(this.#captureBodies ? {
|
|
338
|
+
body: response.body
|
|
339
|
+
} : {})
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
332
343
|
return response;
|
|
333
344
|
}
|
|
334
345
|
|