@usearazzo/runner 0.0.0-stage → 1.0.1-alpha.7
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/LICENSE +202 -0
- package/NOTICE +20 -0
- package/README.md +784 -2
- package/dist/arazzo-runner.browser.js +111247 -0
- package/dist/arazzo-runner.browser.min.js +1 -0
- package/package.json +88 -4
- package/src/action/ActionResolver.cjs +160 -0
- package/src/action/ActionResolver.mjs +150 -0
- package/src/assembler/OpenAPI2DocumentAssembler.cjs +111 -0
- package/src/assembler/OpenAPI2DocumentAssembler.mjs +104 -0
- package/src/assembler/OpenAPI30DocumentAssembler.cjs +110 -0
- package/src/assembler/OpenAPI30DocumentAssembler.mjs +103 -0
- package/src/assembler/OpenAPI31DocumentAssembler.cjs +111 -0
- package/src/assembler/OpenAPI31DocumentAssembler.mjs +104 -0
- package/src/assembler/OpenAPIDocumentAssembler.cjs +58 -0
- package/src/assembler/OpenAPIDocumentAssembler.mjs +50 -0
- package/src/client/HTTPClient.cjs +5 -0
- package/src/client/HTTPClient.mjs +1 -0
- package/src/client/HTTPClientFetch.cjs +16 -0
- package/src/client/HTTPClientFetch.mjs +10 -0
- package/src/client/OpenAPIOperationRequest.cjs +5 -0
- package/src/client/OpenAPIOperationRequest.mjs +1 -0
- package/src/client/OpenAPIOperationResponse.cjs +42 -0
- package/src/client/OpenAPIOperationResponse.mjs +36 -0
- package/src/client/OpenAPIOperationResponseNormalizer.cjs +48 -0
- package/src/client/OpenAPIOperationResponseNormalizer.mjs +40 -0
- package/src/client/ParameterDelivery.cjs +119 -0
- package/src/client/ParameterDelivery.mjs +113 -0
- package/src/constants.cjs +9 -0
- package/src/constants.mjs +3 -0
- package/src/criterion/CriterionEvaluator.cjs +205 -0
- package/src/criterion/CriterionEvaluator.mjs +196 -0
- package/src/criterion/JSONPathCriterionEvaluator.cjs +47 -0
- package/src/criterion/JSONPathCriterionEvaluator.mjs +40 -0
- package/src/criterion/RegexCriterionEvaluator.cjs +67 -0
- package/src/criterion/RegexCriterionEvaluator.mjs +60 -0
- package/src/criterion/SimpleCriterionEvaluator.cjs +50 -0
- package/src/criterion/SimpleCriterionEvaluator.mjs +43 -0
- package/src/criterion/XPathCriterionEvaluator.cjs +117 -0
- package/src/criterion/XPathCriterionEvaluator.mjs +109 -0
- package/src/document/APIDocument.cjs +35 -0
- package/src/document/APIDocument.mjs +30 -0
- package/src/document/ArazzoDocument.cjs +81 -0
- package/src/document/ArazzoDocument.mjs +74 -0
- package/src/document/ArazzoSourceDescriptionIndex.cjs +26 -0
- package/src/document/ArazzoSourceDescriptionIndex.mjs +20 -0
- package/src/document/ArazzoStepIndex.cjs +25 -0
- package/src/document/ArazzoStepIndex.mjs +19 -0
- package/src/document/ArazzoWorkflowIndex.cjs +17 -0
- package/src/document/ArazzoWorkflowIndex.mjs +11 -0
- package/src/document/OpenAPIDocument.cjs +28 -0
- package/src/document/OpenAPIDocument.mjs +21 -0
- package/src/document/OpenAPIOperationIndex.cjs +24 -0
- package/src/document/OpenAPIOperationIndex.mjs +18 -0
- package/src/document/ParameterIdentity.cjs +93 -0
- package/src/document/ParameterIdentity.mjs +88 -0
- package/src/document/openapi-types.cjs +5 -0
- package/src/document/openapi-types.mjs +1 -0
- package/src/errors/ArazzoRunnerError.cjs +10 -0
- package/src/errors/ArazzoRunnerError.mjs +5 -0
- package/src/errors/AssemblerError.cjs +11 -0
- package/src/errors/AssemblerError.mjs +4 -0
- package/src/errors/ClientError.cjs +11 -0
- package/src/errors/ClientError.mjs +4 -0
- package/src/errors/CriterionError.cjs +11 -0
- package/src/errors/CriterionError.mjs +4 -0
- package/src/errors/ExecutionError.cjs +11 -0
- package/src/errors/ExecutionError.mjs +4 -0
- package/src/errors/ExtractionError.cjs +11 -0
- package/src/errors/ExtractionError.mjs +4 -0
- package/src/errors/InvalidEntryDocumentError.cjs +11 -0
- package/src/errors/InvalidEntryDocumentError.mjs +4 -0
- package/src/errors/NormalizationError.cjs +11 -0
- package/src/errors/NormalizationError.mjs +4 -0
- package/src/errors/ResolverError.cjs +11 -0
- package/src/errors/ResolverError.mjs +4 -0
- package/src/errors/RuntimeExpressionError.cjs +11 -0
- package/src/errors/RuntimeExpressionError.mjs +4 -0
- package/src/errors/UnmatchedProviderError.cjs +11 -0
- package/src/errors/UnmatchedProviderError.mjs +4 -0
- package/src/executor/ArazzoWorkflowLocatorNormalizer.cjs +147 -0
- package/src/executor/ArazzoWorkflowLocatorNormalizer.mjs +137 -0
- package/src/executor/OpenAPIOperationExecutor.cjs +457 -0
- package/src/executor/OpenAPIOperationExecutor.mjs +446 -0
- package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +197 -0
- package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +189 -0
- package/src/executor/SourceDescriptionsLocatorNormalizer.cjs +44 -0
- package/src/executor/SourceDescriptionsLocatorNormalizer.mjs +38 -0
- package/src/executor/StepExecutor.cjs +333 -0
- package/src/executor/StepExecutor.mjs +326 -0
- package/src/executor/StepRetryRunner.cjs +226 -0
- package/src/executor/StepRetryRunner.mjs +215 -0
- package/src/executor/StepTransitionInterpreter.cjs +159 -0
- package/src/executor/StepTransitionInterpreter.mjs +151 -0
- package/src/executor/WorkflowCallStack.cjs +116 -0
- package/src/executor/WorkflowCallStack.mjs +106 -0
- package/src/executor/WorkflowExecutor.cjs +1091 -0
- package/src/executor/WorkflowExecutor.mjs +1077 -0
- package/src/executor/abort.cjs +70 -0
- package/src/executor/abort.mjs +60 -0
- package/src/expression/RuntimeExpressionContext.cjs +5 -0
- package/src/expression/RuntimeExpressionContext.mjs +1 -0
- package/src/expression/RuntimeExpressionEvaluator.cjs +337 -0
- package/src/expression/RuntimeExpressionEvaluator.mjs +328 -0
- package/src/extractor/ArazzoStepExtractor.cjs +48 -0
- package/src/extractor/ArazzoStepExtractor.mjs +41 -0
- package/src/extractor/ArazzoWorkflowExtractor.cjs +50 -0
- package/src/extractor/ArazzoWorkflowExtractor.mjs +43 -0
- package/src/extractor/OpenAPIOperationExtractor.cjs +84 -0
- package/src/extractor/OpenAPIOperationExtractor.mjs +77 -0
- package/src/index.cjs +419 -0
- package/src/index.mjs +73 -0
- package/src/normalizer/ArazzoStepNormalizer.cjs +23 -0
- package/src/normalizer/ArazzoStepNormalizer.mjs +17 -0
- package/src/normalizer/ArazzoWorkflowNormalizer.cjs +214 -0
- package/src/normalizer/ArazzoWorkflowNormalizer.mjs +206 -0
- package/src/normalizer/OpenAPI2OperationNormalizer.cjs +128 -0
- package/src/normalizer/OpenAPI2OperationNormalizer.mjs +120 -0
- package/src/normalizer/OpenAPI30OperationNormalizer.cjs +129 -0
- package/src/normalizer/OpenAPI30OperationNormalizer.mjs +121 -0
- package/src/normalizer/OpenAPI31OperationNormalizer.cjs +131 -0
- package/src/normalizer/OpenAPI31OperationNormalizer.mjs +123 -0
- package/src/normalizer/OpenAPIOperationNormalizer.cjs +58 -0
- package/src/normalizer/OpenAPIOperationNormalizer.mjs +50 -0
- package/src/registry/DocumentRegistry.cjs +160 -0
- package/src/registry/DocumentRegistry.mjs +151 -0
- package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +154 -0
- package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +146 -0
- package/src/registry/providers/DocumentRegistryProvider.cjs +31 -0
- package/src/registry/providers/DocumentRegistryProvider.mjs +25 -0
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +122 -0
- package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +114 -0
- package/src/resolver/ArazzoValueResolver.cjs +42 -0
- package/src/resolver/ArazzoValueResolver.mjs +37 -0
- package/src/resolver/OpenAPIOperationParameterResolver.cjs +117 -0
- package/src/resolver/OpenAPIOperationParameterResolver.mjs +110 -0
- package/src/resolver/OutputResolver.cjs +71 -0
- package/src/resolver/OutputResolver.mjs +64 -0
- package/src/resolver/RequestBodyResolver.cjs +227 -0
- package/src/resolver/RequestBodyResolver.mjs +220 -0
- package/src/resolver/ResolverScope.cjs +5 -0
- package/src/resolver/ResolverScope.mjs +1 -0
- package/src/resolver/StepParameterResolver.cjs +22 -0
- package/src/resolver/StepParameterResolver.mjs +15 -0
- package/src/resolver/WorkflowParameterResolver.cjs +73 -0
- package/src/resolver/WorkflowParameterResolver.mjs +66 -0
- package/src/state/WorkflowExecutionState.cjs +99 -0
- package/src/state/WorkflowExecutionState.mjs +93 -0
- package/src/vendor/swagger-client.cjs +1 -0
- package/src/vendor/swagger-client.mjs +1 -0
- package/types/runner.d.ts +2341 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _apidomCore = require("@speclynx/apidom-core");
|
|
9
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
10
|
+
var _apidomJsonPointer = require("@speclynx/apidom-json-pointer");
|
|
11
|
+
var _apidomNsOpenapi = require("@speclynx/apidom-ns-openapi-3-0");
|
|
12
|
+
var _OpenAPIDocument = _interopRequireDefault(require("../document/OpenAPIDocument.cjs"));
|
|
13
|
+
var _OpenAPIOperationIndex = _interopRequireDefault(require("../document/OpenAPIOperationIndex.cjs"));
|
|
14
|
+
var _AssemblerError = _interopRequireDefault(require("../errors/AssemblerError.cjs"));
|
|
15
|
+
/**
|
|
16
|
+
* Assembles a standalone OpenAPI 3.0 document from a
|
|
17
|
+
* normalized operation element.
|
|
18
|
+
*
|
|
19
|
+
* The assembled document is a valid OpenAPI 3.0 specification containing
|
|
20
|
+
* only the single operation with its servers, and referenced security
|
|
21
|
+
* schemes from the source document's components.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
class OpenAPI30DocumentAssembler {
|
|
25
|
+
/**
|
|
26
|
+
* Assembles a standalone OpenAPI 3.0 document from a normalized operation.
|
|
27
|
+
*/
|
|
28
|
+
assemble(operation, document) {
|
|
29
|
+
const entry = document.parseResult.api;
|
|
30
|
+
const method = (0, _apidomCore.toValue)(operation.meta.get('http-method'));
|
|
31
|
+
const path = (0, _apidomCore.toValue)(operation.meta.get('path'));
|
|
32
|
+
if (typeof method !== 'string' || typeof path !== 'string') {
|
|
33
|
+
throw new _AssemblerError.default(`Operation is missing valid "http-method" or "path" metadata. Was it produced by OpenAPIOperationExtractor?`, {
|
|
34
|
+
uri: document.uri,
|
|
35
|
+
operationId: (0, _apidomCore.toValue)(operation.operationId)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!(0, _apidomNsOpenapi.isOpenApi3_0Element)(entry)) {
|
|
39
|
+
throw new _AssemblerError.default(`Expected OpenAPI 3.0 document at "${document.uri}"`, {
|
|
40
|
+
uri: document.uri,
|
|
41
|
+
operationId: (0, _apidomCore.toValue)(operation.operationId)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// build OpenAPI 3.0 document
|
|
46
|
+
const openapi = new _apidomNsOpenapi.OpenApi3_0Element({
|
|
47
|
+
openapi: entry.openapi
|
|
48
|
+
}, {
|
|
49
|
+
classes: ['api']
|
|
50
|
+
});
|
|
51
|
+
// prettier-ignore
|
|
52
|
+
{
|
|
53
|
+
if ((0, _apidomDatamodel.isElement)(entry.info)) openapi.info = entry.info;
|
|
54
|
+
if ((0, _apidomDatamodel.isElement)(entry.tags)) openapi.tags = entry.tags;
|
|
55
|
+
if ((0, _apidomDatamodel.isElement)(entry.externalDocs)) openapi.externalDocs = entry.externalDocs;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// build paths with single operation
|
|
59
|
+
const pathItem = new _apidomNsOpenapi.PathItemElement();
|
|
60
|
+
const paths = new _apidomNsOpenapi.PathsElement();
|
|
61
|
+
pathItem.set(method, operation);
|
|
62
|
+
paths.set(path, pathItem);
|
|
63
|
+
openapi.paths = paths;
|
|
64
|
+
|
|
65
|
+
// include only referenced security schemes in components
|
|
66
|
+
const securitySchemes = this.#extractReferencedSecuritySchemes(operation, entry);
|
|
67
|
+
if (securitySchemes.length > 0) {
|
|
68
|
+
const components = new _apidomNsOpenapi.ComponentsElement();
|
|
69
|
+
components.securitySchemes = securitySchemes;
|
|
70
|
+
openapi.components = components;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// wrap in ParseResultElement and return as OpenAPIDocument
|
|
74
|
+
const parseResult = new _apidomDatamodel.ParseResultElement([openapi]);
|
|
75
|
+
const operationIndex = new _OpenAPIOperationIndex.default();
|
|
76
|
+
const operationId = (0, _apidomCore.toValue)(operation.operationId);
|
|
77
|
+
if (typeof operationId === 'string' && operationId.length > 0) {
|
|
78
|
+
operationIndex.set(operationId, (0, _apidomJsonPointer.compile)(['paths', path, method]));
|
|
79
|
+
}
|
|
80
|
+
return new _OpenAPIDocument.default(document.uri, parseResult, operationIndex);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Extracts only the security schemes referenced by the operation's
|
|
85
|
+
* security requirements.
|
|
86
|
+
*/
|
|
87
|
+
#extractReferencedSecuritySchemes(operation, entry) {
|
|
88
|
+
const securitySchemes = new _apidomDatamodel.ObjectElement();
|
|
89
|
+
if (!(0, _apidomDatamodel.isArrayElement)(operation.security)) return securitySchemes;
|
|
90
|
+
if (entry.components === undefined) return securitySchemes;
|
|
91
|
+
if (entry.components.securitySchemes === undefined) return securitySchemes;
|
|
92
|
+
|
|
93
|
+
// collect referenced names of security schemes
|
|
94
|
+
const referencedNames = new Set();
|
|
95
|
+
for (const securityRequirement of operation.security) {
|
|
96
|
+
if (!(0, _apidomNsOpenapi.isSecurityRequirementElement)(securityRequirement)) continue;
|
|
97
|
+
securityRequirement.forEach((_value, keyElement) => {
|
|
98
|
+
referencedNames.add((0, _apidomCore.toValue)(keyElement));
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (referencedNames.size === 0) return securitySchemes;
|
|
102
|
+
for (const name of referencedNames) {
|
|
103
|
+
const securityScheme = entry.components.securitySchemes.get(name);
|
|
104
|
+
if (!(0, _apidomNsOpenapi.isSecuritySchemeElement)(securityScheme)) continue;
|
|
105
|
+
securitySchemes.set(name, securityScheme);
|
|
106
|
+
}
|
|
107
|
+
return securitySchemes;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
var _default = exports.default = OpenAPI30DocumentAssembler;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
2
|
+
import { isArrayElement, isElement, ObjectElement, ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
3
|
+
import { compile } from '@speclynx/apidom-json-pointer';
|
|
4
|
+
import { OpenApi3_0Element, ComponentsElement, PathsElement, PathItemElement, isOpenApi3_0Element, isSecurityRequirementElement, isSecuritySchemeElement } from '@speclynx/apidom-ns-openapi-3-0';
|
|
5
|
+
import OpenAPIDocument from "../document/OpenAPIDocument.mjs";
|
|
6
|
+
import OpenAPIOperationIndex from "../document/OpenAPIOperationIndex.mjs";
|
|
7
|
+
import AssemblerError from "../errors/AssemblerError.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Assembles a standalone OpenAPI 3.0 document from a
|
|
10
|
+
* normalized operation element.
|
|
11
|
+
*
|
|
12
|
+
* The assembled document is a valid OpenAPI 3.0 specification containing
|
|
13
|
+
* only the single operation with its servers, and referenced security
|
|
14
|
+
* schemes from the source document's components.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class OpenAPI30DocumentAssembler {
|
|
18
|
+
/**
|
|
19
|
+
* Assembles a standalone OpenAPI 3.0 document from a normalized operation.
|
|
20
|
+
*/
|
|
21
|
+
assemble(operation, document) {
|
|
22
|
+
const entry = document.parseResult.api;
|
|
23
|
+
const method = toValue(operation.meta.get('http-method'));
|
|
24
|
+
const path = toValue(operation.meta.get('path'));
|
|
25
|
+
if (typeof method !== 'string' || typeof path !== 'string') {
|
|
26
|
+
throw new AssemblerError(`Operation is missing valid "http-method" or "path" metadata. Was it produced by OpenAPIOperationExtractor?`, {
|
|
27
|
+
uri: document.uri,
|
|
28
|
+
operationId: toValue(operation.operationId)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!isOpenApi3_0Element(entry)) {
|
|
32
|
+
throw new AssemblerError(`Expected OpenAPI 3.0 document at "${document.uri}"`, {
|
|
33
|
+
uri: document.uri,
|
|
34
|
+
operationId: toValue(operation.operationId)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// build OpenAPI 3.0 document
|
|
39
|
+
const openapi = new OpenApi3_0Element({
|
|
40
|
+
openapi: entry.openapi
|
|
41
|
+
}, {
|
|
42
|
+
classes: ['api']
|
|
43
|
+
});
|
|
44
|
+
// prettier-ignore
|
|
45
|
+
{
|
|
46
|
+
if (isElement(entry.info)) openapi.info = entry.info;
|
|
47
|
+
if (isElement(entry.tags)) openapi.tags = entry.tags;
|
|
48
|
+
if (isElement(entry.externalDocs)) openapi.externalDocs = entry.externalDocs;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// build paths with single operation
|
|
52
|
+
const pathItem = new PathItemElement();
|
|
53
|
+
const paths = new PathsElement();
|
|
54
|
+
pathItem.set(method, operation);
|
|
55
|
+
paths.set(path, pathItem);
|
|
56
|
+
openapi.paths = paths;
|
|
57
|
+
|
|
58
|
+
// include only referenced security schemes in components
|
|
59
|
+
const securitySchemes = this.#extractReferencedSecuritySchemes(operation, entry);
|
|
60
|
+
if (securitySchemes.length > 0) {
|
|
61
|
+
const components = new ComponentsElement();
|
|
62
|
+
components.securitySchemes = securitySchemes;
|
|
63
|
+
openapi.components = components;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// wrap in ParseResultElement and return as OpenAPIDocument
|
|
67
|
+
const parseResult = new ParseResultElement([openapi]);
|
|
68
|
+
const operationIndex = new OpenAPIOperationIndex();
|
|
69
|
+
const operationId = toValue(operation.operationId);
|
|
70
|
+
if (typeof operationId === 'string' && operationId.length > 0) {
|
|
71
|
+
operationIndex.set(operationId, compile(['paths', path, method]));
|
|
72
|
+
}
|
|
73
|
+
return new OpenAPIDocument(document.uri, parseResult, operationIndex);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Extracts only the security schemes referenced by the operation's
|
|
78
|
+
* security requirements.
|
|
79
|
+
*/
|
|
80
|
+
#extractReferencedSecuritySchemes(operation, entry) {
|
|
81
|
+
const securitySchemes = new ObjectElement();
|
|
82
|
+
if (!isArrayElement(operation.security)) return securitySchemes;
|
|
83
|
+
if (entry.components === undefined) return securitySchemes;
|
|
84
|
+
if (entry.components.securitySchemes === undefined) return securitySchemes;
|
|
85
|
+
|
|
86
|
+
// collect referenced names of security schemes
|
|
87
|
+
const referencedNames = new Set();
|
|
88
|
+
for (const securityRequirement of operation.security) {
|
|
89
|
+
if (!isSecurityRequirementElement(securityRequirement)) continue;
|
|
90
|
+
securityRequirement.forEach((_value, keyElement) => {
|
|
91
|
+
referencedNames.add(toValue(keyElement));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (referencedNames.size === 0) return securitySchemes;
|
|
95
|
+
for (const name of referencedNames) {
|
|
96
|
+
const securityScheme = entry.components.securitySchemes.get(name);
|
|
97
|
+
if (!isSecuritySchemeElement(securityScheme)) continue;
|
|
98
|
+
securitySchemes.set(name, securityScheme);
|
|
99
|
+
}
|
|
100
|
+
return securitySchemes;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export default OpenAPI30DocumentAssembler;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _apidomCore = require("@speclynx/apidom-core");
|
|
9
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
10
|
+
var _apidomJsonPointer = require("@speclynx/apidom-json-pointer");
|
|
11
|
+
var _apidomNsOpenapi = require("@speclynx/apidom-ns-openapi-3-1");
|
|
12
|
+
var _OpenAPIDocument = _interopRequireDefault(require("../document/OpenAPIDocument.cjs"));
|
|
13
|
+
var _OpenAPIOperationIndex = _interopRequireDefault(require("../document/OpenAPIOperationIndex.cjs"));
|
|
14
|
+
var _AssemblerError = _interopRequireDefault(require("../errors/AssemblerError.cjs"));
|
|
15
|
+
/**
|
|
16
|
+
* Assembles a standalone OpenAPI 3.1 document from a
|
|
17
|
+
* normalized operation element.
|
|
18
|
+
*
|
|
19
|
+
* The assembled document is a valid OpenAPI 3.1 specification containing
|
|
20
|
+
* only the single operation with its servers, and referenced security
|
|
21
|
+
* schemes from the source document's components.
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
class OpenAPI31DocumentAssembler {
|
|
25
|
+
/**
|
|
26
|
+
* Assembles a standalone OpenAPI 3.1 document from a normalized operation.
|
|
27
|
+
*/
|
|
28
|
+
assemble(operation, document) {
|
|
29
|
+
const entry = document.parseResult.api;
|
|
30
|
+
const method = (0, _apidomCore.toValue)(operation.meta.get('http-method'));
|
|
31
|
+
const path = (0, _apidomCore.toValue)(operation.meta.get('path'));
|
|
32
|
+
if (typeof method !== 'string' || typeof path !== 'string') {
|
|
33
|
+
throw new _AssemblerError.default(`Operation is missing valid "http-method" or "path" metadata. Was it produced by OpenAPIOperationExtractor?`, {
|
|
34
|
+
uri: document.uri,
|
|
35
|
+
operationId: (0, _apidomCore.toValue)(operation.operationId)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!(0, _apidomNsOpenapi.isOpenApi3_1Element)(entry)) {
|
|
39
|
+
throw new _AssemblerError.default(`Expected OpenAPI 3.1 document at "${document.uri}"`, {
|
|
40
|
+
uri: document.uri,
|
|
41
|
+
operationId: (0, _apidomCore.toValue)(operation.operationId)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// build OpenAPI 3.1 document
|
|
46
|
+
const openapi = new _apidomNsOpenapi.OpenApi3_1Element({
|
|
47
|
+
openapi: entry.openapi
|
|
48
|
+
}, {
|
|
49
|
+
classes: ['api']
|
|
50
|
+
});
|
|
51
|
+
// prettier-ignore
|
|
52
|
+
{
|
|
53
|
+
if ((0, _apidomDatamodel.isElement)(entry.info)) openapi.info = entry.info;
|
|
54
|
+
if ((0, _apidomDatamodel.isElement)(entry.tags)) openapi.tags = entry.tags;
|
|
55
|
+
if ((0, _apidomDatamodel.isElement)(entry.externalDocs)) openapi.externalDocs = entry.externalDocs;
|
|
56
|
+
if ((0, _apidomDatamodel.isElement)(entry.jsonSchemaDialect)) openapi.jsonSchemaDialect = entry.jsonSchemaDialect;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// build paths with single operation
|
|
60
|
+
const pathItem = new _apidomNsOpenapi.PathItemElement();
|
|
61
|
+
const paths = new _apidomNsOpenapi.PathsElement();
|
|
62
|
+
pathItem.set(method, operation);
|
|
63
|
+
paths.set(path, pathItem);
|
|
64
|
+
openapi.paths = paths;
|
|
65
|
+
|
|
66
|
+
// include only referenced security schemes in components
|
|
67
|
+
const securitySchemes = this.#extractReferencedSecuritySchemes(operation, entry);
|
|
68
|
+
if (securitySchemes.length > 0) {
|
|
69
|
+
const components = new _apidomNsOpenapi.ComponentsElement();
|
|
70
|
+
components.securitySchemes = securitySchemes;
|
|
71
|
+
openapi.components = components;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// wrap in ParseResultElement and return as OpenAPIDocument
|
|
75
|
+
const parseResult = new _apidomDatamodel.ParseResultElement([openapi]);
|
|
76
|
+
const operationIndex = new _OpenAPIOperationIndex.default();
|
|
77
|
+
const operationId = (0, _apidomCore.toValue)(operation.operationId);
|
|
78
|
+
if (typeof operationId === 'string' && operationId.length > 0) {
|
|
79
|
+
operationIndex.set(operationId, (0, _apidomJsonPointer.compile)(['paths', path, method]));
|
|
80
|
+
}
|
|
81
|
+
return new _OpenAPIDocument.default(document.uri, parseResult, operationIndex);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Extracts only the security schemes referenced by the operation's
|
|
86
|
+
* security requirements.
|
|
87
|
+
*/
|
|
88
|
+
#extractReferencedSecuritySchemes(operation, entry) {
|
|
89
|
+
const securitySchemes = new _apidomDatamodel.ObjectElement();
|
|
90
|
+
if (!(0, _apidomDatamodel.isArrayElement)(operation.security)) return securitySchemes;
|
|
91
|
+
if (entry.components === undefined) return securitySchemes;
|
|
92
|
+
if (entry.components.securitySchemes === undefined) return securitySchemes;
|
|
93
|
+
|
|
94
|
+
// collect referenced names of security schemes
|
|
95
|
+
const referencedNames = new Set();
|
|
96
|
+
for (const securityRequirement of operation.security) {
|
|
97
|
+
if (!(0, _apidomNsOpenapi.isSecurityRequirementElement)(securityRequirement)) continue;
|
|
98
|
+
securityRequirement.forEach((_value, keyElement) => {
|
|
99
|
+
referencedNames.add((0, _apidomCore.toValue)(keyElement));
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (referencedNames.size === 0) return securitySchemes;
|
|
103
|
+
for (const name of referencedNames) {
|
|
104
|
+
const securityScheme = entry.components.securitySchemes.get(name);
|
|
105
|
+
if (!(0, _apidomNsOpenapi.isSecuritySchemeElement)(securityScheme)) continue;
|
|
106
|
+
securitySchemes.set(name, securityScheme);
|
|
107
|
+
}
|
|
108
|
+
return securitySchemes;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
var _default = exports.default = OpenAPI31DocumentAssembler;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
2
|
+
import { isArrayElement, isElement, ObjectElement, ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
3
|
+
import { compile } from '@speclynx/apidom-json-pointer';
|
|
4
|
+
import { OpenApi3_1Element, ComponentsElement, PathsElement, PathItemElement, isOpenApi3_1Element, isSecurityRequirementElement, isSecuritySchemeElement } from '@speclynx/apidom-ns-openapi-3-1';
|
|
5
|
+
import OpenAPIDocument from "../document/OpenAPIDocument.mjs";
|
|
6
|
+
import OpenAPIOperationIndex from "../document/OpenAPIOperationIndex.mjs";
|
|
7
|
+
import AssemblerError from "../errors/AssemblerError.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Assembles a standalone OpenAPI 3.1 document from a
|
|
10
|
+
* normalized operation element.
|
|
11
|
+
*
|
|
12
|
+
* The assembled document is a valid OpenAPI 3.1 specification containing
|
|
13
|
+
* only the single operation with its servers, and referenced security
|
|
14
|
+
* schemes from the source document's components.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class OpenAPI31DocumentAssembler {
|
|
18
|
+
/**
|
|
19
|
+
* Assembles a standalone OpenAPI 3.1 document from a normalized operation.
|
|
20
|
+
*/
|
|
21
|
+
assemble(operation, document) {
|
|
22
|
+
const entry = document.parseResult.api;
|
|
23
|
+
const method = toValue(operation.meta.get('http-method'));
|
|
24
|
+
const path = toValue(operation.meta.get('path'));
|
|
25
|
+
if (typeof method !== 'string' || typeof path !== 'string') {
|
|
26
|
+
throw new AssemblerError(`Operation is missing valid "http-method" or "path" metadata. Was it produced by OpenAPIOperationExtractor?`, {
|
|
27
|
+
uri: document.uri,
|
|
28
|
+
operationId: toValue(operation.operationId)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!isOpenApi3_1Element(entry)) {
|
|
32
|
+
throw new AssemblerError(`Expected OpenAPI 3.1 document at "${document.uri}"`, {
|
|
33
|
+
uri: document.uri,
|
|
34
|
+
operationId: toValue(operation.operationId)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// build OpenAPI 3.1 document
|
|
39
|
+
const openapi = new OpenApi3_1Element({
|
|
40
|
+
openapi: entry.openapi
|
|
41
|
+
}, {
|
|
42
|
+
classes: ['api']
|
|
43
|
+
});
|
|
44
|
+
// prettier-ignore
|
|
45
|
+
{
|
|
46
|
+
if (isElement(entry.info)) openapi.info = entry.info;
|
|
47
|
+
if (isElement(entry.tags)) openapi.tags = entry.tags;
|
|
48
|
+
if (isElement(entry.externalDocs)) openapi.externalDocs = entry.externalDocs;
|
|
49
|
+
if (isElement(entry.jsonSchemaDialect)) openapi.jsonSchemaDialect = entry.jsonSchemaDialect;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// build paths with single operation
|
|
53
|
+
const pathItem = new PathItemElement();
|
|
54
|
+
const paths = new PathsElement();
|
|
55
|
+
pathItem.set(method, operation);
|
|
56
|
+
paths.set(path, pathItem);
|
|
57
|
+
openapi.paths = paths;
|
|
58
|
+
|
|
59
|
+
// include only referenced security schemes in components
|
|
60
|
+
const securitySchemes = this.#extractReferencedSecuritySchemes(operation, entry);
|
|
61
|
+
if (securitySchemes.length > 0) {
|
|
62
|
+
const components = new ComponentsElement();
|
|
63
|
+
components.securitySchemes = securitySchemes;
|
|
64
|
+
openapi.components = components;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// wrap in ParseResultElement and return as OpenAPIDocument
|
|
68
|
+
const parseResult = new ParseResultElement([openapi]);
|
|
69
|
+
const operationIndex = new OpenAPIOperationIndex();
|
|
70
|
+
const operationId = toValue(operation.operationId);
|
|
71
|
+
if (typeof operationId === 'string' && operationId.length > 0) {
|
|
72
|
+
operationIndex.set(operationId, compile(['paths', path, method]));
|
|
73
|
+
}
|
|
74
|
+
return new OpenAPIDocument(document.uri, parseResult, operationIndex);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Extracts only the security schemes referenced by the operation's
|
|
79
|
+
* security requirements.
|
|
80
|
+
*/
|
|
81
|
+
#extractReferencedSecuritySchemes(operation, entry) {
|
|
82
|
+
const securitySchemes = new ObjectElement();
|
|
83
|
+
if (!isArrayElement(operation.security)) return securitySchemes;
|
|
84
|
+
if (entry.components === undefined) return securitySchemes;
|
|
85
|
+
if (entry.components.securitySchemes === undefined) return securitySchemes;
|
|
86
|
+
|
|
87
|
+
// collect referenced names of security schemes
|
|
88
|
+
const referencedNames = new Set();
|
|
89
|
+
for (const securityRequirement of operation.security) {
|
|
90
|
+
if (!isSecurityRequirementElement(securityRequirement)) continue;
|
|
91
|
+
securityRequirement.forEach((_value, keyElement) => {
|
|
92
|
+
referencedNames.add(toValue(keyElement));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (referencedNames.size === 0) return securitySchemes;
|
|
96
|
+
for (const name of referencedNames) {
|
|
97
|
+
const securityScheme = entry.components.securitySchemes.get(name);
|
|
98
|
+
if (!isSecuritySchemeElement(securityScheme)) continue;
|
|
99
|
+
securitySchemes.set(name, securityScheme);
|
|
100
|
+
}
|
|
101
|
+
return securitySchemes;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export default OpenAPI31DocumentAssembler;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _apidomNsOpenapi = require("@speclynx/apidom-ns-openapi-2");
|
|
9
|
+
var _apidomNsOpenapi2 = require("@speclynx/apidom-ns-openapi-3-0");
|
|
10
|
+
var _apidomNsOpenapi3 = require("@speclynx/apidom-ns-openapi-3-1");
|
|
11
|
+
var _AssemblerError = _interopRequireDefault(require("../errors/AssemblerError.cjs"));
|
|
12
|
+
var _OpenAPI2DocumentAssembler = _interopRequireDefault(require("./OpenAPI2DocumentAssembler.cjs"));
|
|
13
|
+
var _OpenAPI30DocumentAssembler = _interopRequireDefault(require("./OpenAPI30DocumentAssembler.cjs"));
|
|
14
|
+
var _OpenAPI31DocumentAssembler = _interopRequireDefault(require("./OpenAPI31DocumentAssembler.cjs"));
|
|
15
|
+
/**
|
|
16
|
+
* Options for the OpenAPI document assembler facade.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Facade for assembling standalone OpenAPI documents across all supported versions.
|
|
22
|
+
*
|
|
23
|
+
* Detects the OpenAPI version from the source document and delegates to the
|
|
24
|
+
* appropriate version-specific assembler (2.0, 3.0, or 3.1).
|
|
25
|
+
*
|
|
26
|
+
* Custom assembler instances can be provided via constructor options.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
class OpenAPIDocumentAssembler {
|
|
30
|
+
#openapi2;
|
|
31
|
+
#openapi30;
|
|
32
|
+
#openapi31;
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
this.#openapi2 = options.openapi2 ?? new _OpenAPI2DocumentAssembler.default();
|
|
35
|
+
this.#openapi30 = options.openapi30 ?? new _OpenAPI30DocumentAssembler.default();
|
|
36
|
+
this.#openapi31 = options.openapi31 ?? new _OpenAPI31DocumentAssembler.default();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Assembles a standalone OpenAPI document by delegating to the version-specific assembler.
|
|
41
|
+
*/
|
|
42
|
+
assemble(operation, document) {
|
|
43
|
+
const root = document.parseResult.api;
|
|
44
|
+
if ((0, _apidomNsOpenapi.isSwaggerElement)(root)) {
|
|
45
|
+
return this.#openapi2.assemble(operation, document);
|
|
46
|
+
}
|
|
47
|
+
if ((0, _apidomNsOpenapi2.isOpenApi3_0Element)(root)) {
|
|
48
|
+
return this.#openapi30.assemble(operation, document);
|
|
49
|
+
}
|
|
50
|
+
if ((0, _apidomNsOpenapi3.isOpenApi3_1Element)(root)) {
|
|
51
|
+
return this.#openapi31.assemble(operation, document);
|
|
52
|
+
}
|
|
53
|
+
throw new _AssemblerError.default(`Unsupported OpenAPI version in document at "${document.uri}"`, {
|
|
54
|
+
uri: document.uri
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
var _default = exports.default = OpenAPIDocumentAssembler;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isSwaggerElement } from '@speclynx/apidom-ns-openapi-2';
|
|
2
|
+
import { isOpenApi3_0Element } from '@speclynx/apidom-ns-openapi-3-0';
|
|
3
|
+
import { isOpenApi3_1Element } from '@speclynx/apidom-ns-openapi-3-1';
|
|
4
|
+
import AssemblerError from "../errors/AssemblerError.mjs";
|
|
5
|
+
import OpenAPI2DocumentAssembler from "./OpenAPI2DocumentAssembler.mjs";
|
|
6
|
+
import OpenAPI30DocumentAssembler from "./OpenAPI30DocumentAssembler.mjs";
|
|
7
|
+
import OpenAPI31DocumentAssembler from "./OpenAPI31DocumentAssembler.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Options for the OpenAPI document assembler facade.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Facade for assembling standalone OpenAPI documents across all supported versions.
|
|
14
|
+
*
|
|
15
|
+
* Detects the OpenAPI version from the source document and delegates to the
|
|
16
|
+
* appropriate version-specific assembler (2.0, 3.0, or 3.1).
|
|
17
|
+
*
|
|
18
|
+
* Custom assembler instances can be provided via constructor options.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
class OpenAPIDocumentAssembler {
|
|
22
|
+
#openapi2;
|
|
23
|
+
#openapi30;
|
|
24
|
+
#openapi31;
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
this.#openapi2 = options.openapi2 ?? new OpenAPI2DocumentAssembler();
|
|
27
|
+
this.#openapi30 = options.openapi30 ?? new OpenAPI30DocumentAssembler();
|
|
28
|
+
this.#openapi31 = options.openapi31 ?? new OpenAPI31DocumentAssembler();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Assembles a standalone OpenAPI document by delegating to the version-specific assembler.
|
|
33
|
+
*/
|
|
34
|
+
assemble(operation, document) {
|
|
35
|
+
const root = document.parseResult.api;
|
|
36
|
+
if (isSwaggerElement(root)) {
|
|
37
|
+
return this.#openapi2.assemble(operation, document);
|
|
38
|
+
}
|
|
39
|
+
if (isOpenApi3_0Element(root)) {
|
|
40
|
+
return this.#openapi30.assemble(operation, document);
|
|
41
|
+
}
|
|
42
|
+
if (isOpenApi3_1Element(root)) {
|
|
43
|
+
return this.#openapi31.assemble(operation, document);
|
|
44
|
+
}
|
|
45
|
+
throw new AssemblerError(`Unsupported OpenAPI version in document at "${document.uri}"`, {
|
|
46
|
+
uri: document.uri
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export default OpenAPIDocumentAssembler;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* The default {@link HTTPClient}: global fetch.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors swagger-client's own transport line — the request object doubles as
|
|
11
|
+
* fetch init, so `method`, `headers`, `body`, `credentials`, and `signal` are
|
|
12
|
+
* picked up from it directly.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
const httpClientFetch = request => fetch(request.url, request);
|
|
16
|
+
var _default = exports.default = httpClientFetch;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default {@link HTTPClient}: global fetch.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors swagger-client's own transport line — the request object doubles as
|
|
5
|
+
* fetch init, so `method`, `headers`, `body`, `credentials`, and `signal` are
|
|
6
|
+
* picked up from it directly.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
const httpClientFetch = request => fetch(request.url, request);
|
|
10
|
+
export default httpClientFetch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* The HTTP request an OpenAPI operation was executed with.
|
|
9
|
+
*
|
|
10
|
+
* An immutable snapshot of the request as actually sent, recorded by the
|
|
11
|
+
* executor after the interceptors ran and before the transport was called, so
|
|
12
|
+
* runtime expressions (`$url`, `$method`, `$request.header.*`, `$request.body`)
|
|
13
|
+
* can be evaluated against it after execution. `headers` is a copy taken at
|
|
14
|
+
* capture time; `body` shares its reference with the sent request.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Response from an OpenAPI operation execution.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
class OpenAPIOperationResponse {
|
|
23
|
+
ok;
|
|
24
|
+
url;
|
|
25
|
+
status;
|
|
26
|
+
statusText;
|
|
27
|
+
headers;
|
|
28
|
+
text;
|
|
29
|
+
body;
|
|
30
|
+
request;
|
|
31
|
+
constructor(raw) {
|
|
32
|
+
this.ok = raw.ok;
|
|
33
|
+
this.url = raw.url;
|
|
34
|
+
this.status = raw.status;
|
|
35
|
+
this.statusText = raw.statusText;
|
|
36
|
+
this.headers = raw.headers;
|
|
37
|
+
this.text = raw.text;
|
|
38
|
+
this.body = raw.body;
|
|
39
|
+
this.request = raw.request;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var _default = exports.default = OpenAPIOperationResponse;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP request an OpenAPI operation was executed with.
|
|
3
|
+
*
|
|
4
|
+
* An immutable snapshot of the request as actually sent, recorded by the
|
|
5
|
+
* executor after the interceptors ran and before the transport was called, so
|
|
6
|
+
* runtime expressions (`$url`, `$method`, `$request.header.*`, `$request.body`)
|
|
7
|
+
* can be evaluated against it after execution. `headers` is a copy taken at
|
|
8
|
+
* capture time; `body` shares its reference with the sent request.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Response from an OpenAPI operation execution.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
class OpenAPIOperationResponse {
|
|
17
|
+
ok;
|
|
18
|
+
url;
|
|
19
|
+
status;
|
|
20
|
+
statusText;
|
|
21
|
+
headers;
|
|
22
|
+
text;
|
|
23
|
+
body;
|
|
24
|
+
request;
|
|
25
|
+
constructor(raw) {
|
|
26
|
+
this.ok = raw.ok;
|
|
27
|
+
this.url = raw.url;
|
|
28
|
+
this.status = raw.status;
|
|
29
|
+
this.statusText = raw.statusText;
|
|
30
|
+
this.headers = raw.headers;
|
|
31
|
+
this.text = raw.text;
|
|
32
|
+
this.body = raw.body;
|
|
33
|
+
this.request = raw.request;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export default OpenAPIOperationResponse;
|