@breadstone-tools/openapi-core 0.0.12-beta.0
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/Index.d.ts +25 -0
- package/Index.d.ts.map +1 -0
- package/Index.js +42 -0
- package/Index.js.map +1 -0
- package/Interfaces/IOpenApiInfo.d.ts +10 -0
- package/Interfaces/IOpenApiInfo.d.ts.map +1 -0
- package/Interfaces/IOpenApiInfo.js +4 -0
- package/Interfaces/IOpenApiInfo.js.map +1 -0
- package/Interfaces/IOptions.d.ts +31 -0
- package/Interfaces/IOptions.d.ts.map +1 -0
- package/Interfaces/IOptions.js +12 -0
- package/Interfaces/IOptions.js.map +1 -0
- package/LICENSE +21 -0
- package/Models/TypeScript/Import.d.ts +14 -0
- package/Models/TypeScript/Import.d.ts.map +1 -0
- package/Models/TypeScript/Import.js +53 -0
- package/Models/TypeScript/Import.js.map +1 -0
- package/Models/TypeScript/Imports.d.ts +15 -0
- package/Models/TypeScript/Imports.d.ts.map +1 -0
- package/Models/TypeScript/Imports.js +39 -0
- package/Models/TypeScript/Imports.js.map +1 -0
- package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.d.ts +21 -0
- package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.d.ts.map +1 -0
- package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.js +3 -0
- package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.js.map +1 -0
- package/Models/TypeScript/Interfaces/ITypeScriptOptions.d.ts +63 -0
- package/Models/TypeScript/Interfaces/ITypeScriptOptions.d.ts.map +1 -0
- package/Models/TypeScript/Interfaces/ITypeScriptOptions.js +39 -0
- package/Models/TypeScript/Interfaces/ITypeScriptOptions.js.map +1 -0
- package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.d.ts +7 -0
- package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.d.ts.map +1 -0
- package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.js +3 -0
- package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.js.map +1 -0
- package/Models/TypeScript/Models/Abstracts/Symantic.d.ts +48 -0
- package/Models/TypeScript/Models/Abstracts/Symantic.d.ts.map +1 -0
- package/Models/TypeScript/Models/Abstracts/Symantic.js +124 -0
- package/Models/TypeScript/Models/Abstracts/Symantic.js.map +1 -0
- package/Models/TypeScript/Models/Model.d.ts +31 -0
- package/Models/TypeScript/Models/Model.d.ts.map +1 -0
- package/Models/TypeScript/Models/Model.js +149 -0
- package/Models/TypeScript/Models/Model.js.map +1 -0
- package/Models/TypeScript/Models/ModelProperty.d.ts +20 -0
- package/Models/TypeScript/Models/ModelProperty.d.ts.map +1 -0
- package/Models/TypeScript/Models/ModelProperty.js +34 -0
- package/Models/TypeScript/Models/ModelProperty.js.map +1 -0
- package/Models/TypeScript/Models/ModelValue.d.ts +19 -0
- package/Models/TypeScript/Models/ModelValue.d.ts.map +1 -0
- package/Models/TypeScript/Models/ModelValue.js +51 -0
- package/Models/TypeScript/Models/ModelValue.js.map +1 -0
- package/Models/TypeScript/Models/Service.d.ts +20 -0
- package/Models/TypeScript/Models/Service.d.ts.map +1 -0
- package/Models/TypeScript/Models/Service.js +81 -0
- package/Models/TypeScript/Models/Service.js.map +1 -0
- package/Models/TypeScript/Models/ServiceContent.d.ts +15 -0
- package/Models/TypeScript/Models/ServiceContent.d.ts.map +1 -0
- package/Models/TypeScript/Models/ServiceContent.js +28 -0
- package/Models/TypeScript/Models/ServiceContent.js.map +1 -0
- package/Models/TypeScript/Models/ServiceOperation.d.ts +60 -0
- package/Models/TypeScript/Models/ServiceOperation.d.ts.map +1 -0
- package/Models/TypeScript/Models/ServiceOperation.js +222 -0
- package/Models/TypeScript/Models/ServiceOperation.js.map +1 -0
- package/Models/TypeScript/Models/ServiceOperationVariant.d.ts +26 -0
- package/Models/TypeScript/Models/ServiceOperationVariant.d.ts.map +1 -0
- package/Models/TypeScript/Models/ServiceOperationVariant.js +82 -0
- package/Models/TypeScript/Models/ServiceOperationVariant.js.map +1 -0
- package/Models/TypeScript/Models/ServiceParameter.d.ts +19 -0
- package/Models/TypeScript/Models/ServiceParameter.d.ts.map +1 -0
- package/Models/TypeScript/Models/ServiceParameter.js +34 -0
- package/Models/TypeScript/Models/ServiceParameter.js.map +1 -0
- package/Models/TypeScript/Models/ServiceRequestBody.d.ts +18 -0
- package/Models/TypeScript/Models/ServiceRequestBody.d.ts.map +1 -0
- package/Models/TypeScript/Models/ServiceRequestBody.js +28 -0
- package/Models/TypeScript/Models/ServiceRequestBody.js.map +1 -0
- package/Models/TypeScript/Models/ServiceResponse.d.ts +13 -0
- package/Models/TypeScript/Models/ServiceResponse.d.ts.map +1 -0
- package/Models/TypeScript/Models/ServiceResponse.js +25 -0
- package/Models/TypeScript/Models/ServiceResponse.js.map +1 -0
- package/Models/TypeScript/Models/ServiceSecurity.d.ts +18 -0
- package/Models/TypeScript/Models/ServiceSecurity.d.ts.map +1 -0
- package/Models/TypeScript/Models/ServiceSecurity.js +33 -0
- package/Models/TypeScript/Models/ServiceSecurity.js.map +1 -0
- package/Models/TypeScript/TemplateType.d.ts +33 -0
- package/Models/TypeScript/TemplateType.d.ts.map +1 -0
- package/Models/TypeScript/TemplateType.js +39 -0
- package/Models/TypeScript/TemplateType.js.map +1 -0
- package/Models/TypeScript/Utils.d.ts +65 -0
- package/Models/TypeScript/Utils.d.ts.map +1 -0
- package/Models/TypeScript/Utils.js +274 -0
- package/Models/TypeScript/Utils.js.map +1 -0
- package/Services/OpenApiParser.d.ts +47 -0
- package/Services/OpenApiParser.d.ts.map +1 -0
- package/Services/OpenApiParser.js +192 -0
- package/Services/OpenApiParser.js.map +1 -0
- package/Services/TemplateBuilder.d.ts +53 -0
- package/Services/TemplateBuilder.d.ts.map +1 -0
- package/Services/TemplateBuilder.js +105 -0
- package/Services/TemplateBuilder.js.map +1 -0
- package/Services/TemplateEngine.d.ts +40 -0
- package/Services/TemplateEngine.d.ts.map +1 -0
- package/Services/TemplateEngine.js +105 -0
- package/Services/TemplateEngine.js.map +1 -0
- package/package.json +23 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { OpenAPIObject, OperationObject, PathItemObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
3
|
+
import type { IComment } from './Abstracts/Interfaces/IComment.js';
|
|
4
|
+
import { ServiceOperationVariant } from './ServiceOperationVariant.js';
|
|
5
|
+
import { ServiceParameter } from './ServiceParameter.js';
|
|
6
|
+
import { ServiceRequestBody } from './ServiceRequestBody.js';
|
|
7
|
+
import { ServiceResponse } from './ServiceResponse.js';
|
|
8
|
+
import { ServiceSecurity } from './ServiceSecurity.js';
|
|
9
|
+
/**
|
|
10
|
+
* An operation descriptor
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare class ServiceOperation implements IComment {
|
|
15
|
+
private readonly _openApi;
|
|
16
|
+
constructor(openApi: OpenAPIObject, path: string, pathSpec: PathItemObject, method: string, id: string, spec: OperationObject, options: Required<ITypeScriptOptions>);
|
|
17
|
+
path: string;
|
|
18
|
+
pathSpec: PathItemObject;
|
|
19
|
+
method: string;
|
|
20
|
+
id: string;
|
|
21
|
+
spec: OperationObject;
|
|
22
|
+
options: Required<ITypeScriptOptions>;
|
|
23
|
+
tags: Array<string>;
|
|
24
|
+
methodName: string;
|
|
25
|
+
parameters: Array<ServiceParameter>;
|
|
26
|
+
pathParameters: Array<ServiceParameter>;
|
|
27
|
+
headerParameters: Array<ServiceParameter>;
|
|
28
|
+
queryParameters: Array<ServiceParameter>;
|
|
29
|
+
cookieParameters: Array<ServiceParameter>;
|
|
30
|
+
hasParameters: boolean;
|
|
31
|
+
hasPathParameters: boolean;
|
|
32
|
+
hasHeaderParameters: boolean;
|
|
33
|
+
hasQueryParameters: boolean;
|
|
34
|
+
hasCookieParameters: boolean;
|
|
35
|
+
parametersRequired: boolean;
|
|
36
|
+
security: Array<Array<ServiceSecurity>>;
|
|
37
|
+
deprecated: boolean;
|
|
38
|
+
comments: Array<string>;
|
|
39
|
+
requestBody?: ServiceRequestBody;
|
|
40
|
+
successResponse?: ServiceResponse;
|
|
41
|
+
allResponses: Array<ServiceResponse>;
|
|
42
|
+
pathExpression: string;
|
|
43
|
+
variants: Array<ServiceOperationVariant>;
|
|
44
|
+
private collectParameters;
|
|
45
|
+
private collectSecurity;
|
|
46
|
+
private paramIsNotExcluded;
|
|
47
|
+
private collectContent;
|
|
48
|
+
private collectResponses;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a path expression to be evaluated, for example:
|
|
51
|
+
* "/a/{var1}/b/{var2}/" returns "/a/${params.var1}/b/${params.var2}"
|
|
52
|
+
*/
|
|
53
|
+
private toPathExpression;
|
|
54
|
+
private calculateVariants;
|
|
55
|
+
/**
|
|
56
|
+
* Returns how the given content is represented on the method name
|
|
57
|
+
*/
|
|
58
|
+
private variantMethodPart;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ServiceOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceOperation.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceOperation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,aAAa,EAAE,eAAe,EAAmB,cAAc,EAAuG,MAAM,mBAAmB,CAAC;AAC7N,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sB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ACjC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,YAAY,EAAE,KAAK,CAAC,eAAe,CAAC,CAAM;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAM;IAIrD,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,gBAAgB;IA0BxB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAiB5B"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ServiceOperation = void 0;
|
|
5
|
+
const es_toolkit_1 = require("es-toolkit");
|
|
6
|
+
const Utils_js_1 = require("../Utils.js");
|
|
7
|
+
const ServiceContent_js_1 = require("./ServiceContent.js");
|
|
8
|
+
const ServiceOperationVariant_js_1 = require("./ServiceOperationVariant.js");
|
|
9
|
+
const ServiceParameter_js_1 = require("./ServiceParameter.js");
|
|
10
|
+
const ServiceRequestBody_js_1 = require("./ServiceRequestBody.js");
|
|
11
|
+
const ServiceResponse_js_1 = require("./ServiceResponse.js");
|
|
12
|
+
const ServiceSecurity_js_1 = require("./ServiceSecurity.js");
|
|
13
|
+
// #endregion
|
|
14
|
+
/**
|
|
15
|
+
* An operation descriptor
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
class ServiceOperation {
|
|
20
|
+
// #region Fields
|
|
21
|
+
// this is a fix for to json.
|
|
22
|
+
// this files should be excluded
|
|
23
|
+
_openApi;
|
|
24
|
+
// #endregion
|
|
25
|
+
// #region Ctor
|
|
26
|
+
constructor(openApi, path, pathSpec, method, id, spec, options) {
|
|
27
|
+
this._openApi = () => openApi;
|
|
28
|
+
this.path = path;
|
|
29
|
+
this.pathSpec = pathSpec;
|
|
30
|
+
this.method = method;
|
|
31
|
+
this.id = id;
|
|
32
|
+
this.spec = spec;
|
|
33
|
+
this.options = options;
|
|
34
|
+
this.parametersRequired = false;
|
|
35
|
+
this.path = this.path.replace(/\'/g, '\\\'');
|
|
36
|
+
this.tags = spec.tags ?? [];
|
|
37
|
+
this.comments = (0, Utils_js_1.tsComments)(spec.description ?? '', spec.deprecated);
|
|
38
|
+
this.methodName = spec['x-operation-name'] ?? this.id;
|
|
39
|
+
// Add both the common and specific parameters
|
|
40
|
+
this.parameters = [
|
|
41
|
+
...this.collectParameters(pathSpec.parameters),
|
|
42
|
+
...this.collectParameters(spec.parameters)
|
|
43
|
+
];
|
|
44
|
+
this.pathParameters = this.parameters.filter((x) => x.in === 'path');
|
|
45
|
+
this.headerParameters = this.parameters.filter((x) => x.in === 'header');
|
|
46
|
+
this.queryParameters = this.parameters.filter((x) => x.in === 'query');
|
|
47
|
+
this.cookieParameters = this.parameters.filter((x) => x.in === 'cookie');
|
|
48
|
+
if (this.parameters.find((p) => p.required)) {
|
|
49
|
+
this.parametersRequired = true;
|
|
50
|
+
}
|
|
51
|
+
this.hasParameters = this.parameters.length > 0;
|
|
52
|
+
this.hasPathParameters = this.pathParameters.length > 0;
|
|
53
|
+
this.hasHeaderParameters = this.headerParameters.length > 0;
|
|
54
|
+
this.hasQueryParameters = this.queryParameters.length > 0;
|
|
55
|
+
this.hasCookieParameters = this.cookieParameters.length > 0;
|
|
56
|
+
this.security = spec.security ? this.collectSecurity(spec.security) : this.collectSecurity(openApi.security);
|
|
57
|
+
let body = spec.requestBody;
|
|
58
|
+
if (body) {
|
|
59
|
+
if ('$ref' in body) {
|
|
60
|
+
body = (0, Utils_js_1.resolveRef)(this._openApi(), body.$ref);
|
|
61
|
+
}
|
|
62
|
+
body = body;
|
|
63
|
+
this.requestBody = new ServiceRequestBody_js_1.ServiceRequestBody(body, this.collectContent(body.content), this.options);
|
|
64
|
+
if (body.required) {
|
|
65
|
+
this.parametersRequired = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const responses = this.collectResponses();
|
|
69
|
+
this.successResponse = responses.success;
|
|
70
|
+
this.allResponses = responses.all;
|
|
71
|
+
this.pathExpression = this.toPathExpression();
|
|
72
|
+
this.deprecated = !!spec.deprecated;
|
|
73
|
+
// Now calculate the variants: request body content x success response content
|
|
74
|
+
this.calculateVariants();
|
|
75
|
+
}
|
|
76
|
+
// #endregion
|
|
77
|
+
// #region Properties
|
|
78
|
+
path;
|
|
79
|
+
pathSpec;
|
|
80
|
+
method;
|
|
81
|
+
id;
|
|
82
|
+
spec;
|
|
83
|
+
options;
|
|
84
|
+
tags;
|
|
85
|
+
methodName;
|
|
86
|
+
parameters = [];
|
|
87
|
+
pathParameters = [];
|
|
88
|
+
headerParameters = [];
|
|
89
|
+
queryParameters = [];
|
|
90
|
+
cookieParameters = [];
|
|
91
|
+
hasParameters;
|
|
92
|
+
hasPathParameters;
|
|
93
|
+
hasHeaderParameters;
|
|
94
|
+
hasQueryParameters;
|
|
95
|
+
hasCookieParameters;
|
|
96
|
+
parametersRequired;
|
|
97
|
+
security = [];
|
|
98
|
+
deprecated;
|
|
99
|
+
comments;
|
|
100
|
+
requestBody;
|
|
101
|
+
successResponse;
|
|
102
|
+
allResponses = [];
|
|
103
|
+
pathExpression;
|
|
104
|
+
variants = [];
|
|
105
|
+
// #endregion
|
|
106
|
+
collectParameters(params) {
|
|
107
|
+
const result = [];
|
|
108
|
+
if (params) {
|
|
109
|
+
for (let param of params) {
|
|
110
|
+
if ('$ref' in param) {
|
|
111
|
+
param = (0, Utils_js_1.resolveRef)(this._openApi(), param.$ref);
|
|
112
|
+
}
|
|
113
|
+
param = param;
|
|
114
|
+
if (param.in === 'cookie') {
|
|
115
|
+
console.warn(`Ignoring cookie parameter ${this.id}.${param.name} as cookie parameters cannot be sent in XmlHttpRequests.`);
|
|
116
|
+
}
|
|
117
|
+
else if (this.paramIsNotExcluded(param)) {
|
|
118
|
+
result.push(new ServiceParameter_js_1.ServiceParameter(param, this.options));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
collectSecurity(params) {
|
|
125
|
+
if (!params) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
return params.map((param) => Object.keys(param).map((key) => {
|
|
129
|
+
const scope = param[key];
|
|
130
|
+
const security = (0, Utils_js_1.resolveRef)(this._openApi(), `#/components/securitySchemes/${key}`);
|
|
131
|
+
return new ServiceSecurity_js_1.ServiceSecurity(key, security, scope, this.options);
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
paramIsNotExcluded(param) {
|
|
135
|
+
const excludedParameters = this.options.excludeParameters;
|
|
136
|
+
return !excludedParameters.includes(param.name);
|
|
137
|
+
}
|
|
138
|
+
collectContent(desc) {
|
|
139
|
+
const result = [];
|
|
140
|
+
if (desc) {
|
|
141
|
+
for (const type of Object.keys(desc)) {
|
|
142
|
+
result.push(new ServiceContent_js_1.ServiceContent(type, desc[type], this.options));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
collectResponses() {
|
|
148
|
+
let successResponse = undefined;
|
|
149
|
+
const allResponses = [];
|
|
150
|
+
const responses = this.spec.responses;
|
|
151
|
+
for (const statusCode of Object.keys(responses)) {
|
|
152
|
+
const responseDesc = responses[statusCode];
|
|
153
|
+
const response = new ServiceResponse_js_1.ServiceResponse(statusCode, responseDesc.description || '', this.collectContent(responseDesc.content));
|
|
154
|
+
allResponses.push(response);
|
|
155
|
+
const statusInt = Number.parseInt(statusCode.trim(), 10);
|
|
156
|
+
if (!successResponse && statusInt >= 200 && statusInt < 300) {
|
|
157
|
+
successResponse = response;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
success: successResponse,
|
|
162
|
+
all: allResponses
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns a path expression to be evaluated, for example:
|
|
167
|
+
* "/a/{var1}/b/{var2}/" returns "/a/${params.var1}/b/${params.var2}"
|
|
168
|
+
*/
|
|
169
|
+
toPathExpression() {
|
|
170
|
+
return (this.path || '').replace(/\{([^}]+)}/g, (_, pName) => {
|
|
171
|
+
const param = this.parameters.find((p) => p.name === pName);
|
|
172
|
+
const paramName = param ? param.var : pName;
|
|
173
|
+
return `\${params.${paramName}}`;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
calculateVariants() {
|
|
177
|
+
const hasRequestBodyVariants = this.requestBody && this.requestBody.content.length > 1;
|
|
178
|
+
const hasResponseVariants = this.successResponse && this.successResponse.content.length > 1;
|
|
179
|
+
const contentOrNull = (hasContent) => {
|
|
180
|
+
if (hasContent) {
|
|
181
|
+
const content = hasContent.content;
|
|
182
|
+
if (content && content.length > 0) {
|
|
183
|
+
return content;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return [null];
|
|
187
|
+
};
|
|
188
|
+
const requestBodyVariants = contentOrNull(this.requestBody);
|
|
189
|
+
const successResponseVariants = contentOrNull(this.successResponse);
|
|
190
|
+
for (const requestBodyVariant of requestBodyVariants) {
|
|
191
|
+
const methodPart = this.methodName + (hasRequestBodyVariants ? this.variantMethodPart(requestBodyVariant) : '');
|
|
192
|
+
for (const successResponseVariant of successResponseVariants) {
|
|
193
|
+
const methodName = methodPart + (hasResponseVariants ? this.variantMethodPart(successResponseVariant) : '');
|
|
194
|
+
if (!this.variants.find((v) => v.methodName === methodName)) {
|
|
195
|
+
// It is possible to have multiple content types which end up in the same method.
|
|
196
|
+
// For example: application/json, application/foo-bar+json, text/json ...
|
|
197
|
+
this.variants.push(new ServiceOperationVariant_js_1.ServiceOperationVariant(this, methodName, requestBodyVariant, successResponseVariant));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Returns how the given content is represented on the method name
|
|
204
|
+
*/
|
|
205
|
+
variantMethodPart(content) {
|
|
206
|
+
if (content) {
|
|
207
|
+
let type = content.mediaType.replace(/\/\*/, '');
|
|
208
|
+
if (type === '*' || type === 'application/octet-stream') {
|
|
209
|
+
return '$Any';
|
|
210
|
+
}
|
|
211
|
+
type = (0, es_toolkit_1.last)(type.split('/')) ?? '';
|
|
212
|
+
const plus = type.lastIndexOf('+');
|
|
213
|
+
if (plus >= 0) {
|
|
214
|
+
type = type.substring(plus + 1);
|
|
215
|
+
}
|
|
216
|
+
return `$${(0, Utils_js_1.typeName)(type)}`;
|
|
217
|
+
}
|
|
218
|
+
return '';
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.ServiceOperation = ServiceOperation;
|
|
222
|
+
//# sourceMappingURL=ServiceOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceOperation.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceOperation.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,2CAAkC;AAGlC,0CAA+D;AAE/D,2DAAqD;AACrD,6EAAuE;AACvE,+DAAyD;AACzD,mEAA6D;AAC7D,6DAAuD;AACvD,6DAAuD;AAEvD,aAAa;AAEb;;;;GAIG;AACH,MAAa,gBAAgB;IAEzB,iBAAiB;IAEjB,6BAA6B;IAC7B,gCAAgC;IACf,QAAQ,CAAsB;IAE/C,aAAa;IAEb,eAAe;IAEf,YAAmB,OAAsB,EAAE,IAAY,EAAE,QAAwB,EAAE,MAAc,EAAE,EAAU,EAAE,IAAqB,EAAE,OAAqC;QACvK,IAAI,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MA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,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;YACpC,CAAC;YACD,OAAO,IAAI,IAAA,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;QAChC,CAAC;QAED,OAAO,EAAE,CAAC;IACd,CAAC;CAEJ;AA5OD,4CA4OC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ServiceContent } from './ServiceContent.js';
|
|
2
|
+
import type { ServiceOperation } from './ServiceOperation.js';
|
|
3
|
+
/**
|
|
4
|
+
* An operation has a variant per distinct possible body content
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class ServiceOperationVariant {
|
|
9
|
+
constructor(operation: ServiceOperation, methodName: string, requestBody: ServiceContent | null, successResponse: ServiceContent | null);
|
|
10
|
+
accept: string;
|
|
11
|
+
isBoolean: boolean;
|
|
12
|
+
isNever: boolean;
|
|
13
|
+
isNumber: boolean;
|
|
14
|
+
isOther: boolean;
|
|
15
|
+
methodComment: Array<string>;
|
|
16
|
+
methodName: string;
|
|
17
|
+
operation: ServiceOperation;
|
|
18
|
+
requestBody: ServiceContent | null;
|
|
19
|
+
responseMethodName: string;
|
|
20
|
+
responseType: string;
|
|
21
|
+
resultType: string;
|
|
22
|
+
successResponse: ServiceContent | null;
|
|
23
|
+
private inferResponseType;
|
|
24
|
+
private methodDescription;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ServiceOperationVariant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceOperationVariant.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceOperationVariant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAM9D;;;;GAIG;AACH,qBAAa,uBAAuB;gBAIb,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,IAAI,EAAE,eAAe,EAAE,cAAc,GAAG,IAAI;IAgCvI,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,cAAc,GAAG,IAAI,CAAC;IAM9C,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,iBAAiB;CAkB5B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceOperationVariant = void 0;
|
|
4
|
+
const Utils_js_1 = require("../Utils.js");
|
|
5
|
+
// #region Imports
|
|
6
|
+
// #endregion
|
|
7
|
+
/**
|
|
8
|
+
* An operation has a variant per distinct possible body content
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class ServiceOperationVariant {
|
|
13
|
+
// #region Ctor
|
|
14
|
+
constructor(operation, methodName, requestBody, successResponse) {
|
|
15
|
+
this.operation = operation;
|
|
16
|
+
this.methodName = methodName;
|
|
17
|
+
this.requestBody = requestBody;
|
|
18
|
+
this.successResponse = successResponse;
|
|
19
|
+
this.responseMethodName = `${methodName}$Response`;
|
|
20
|
+
if (successResponse) {
|
|
21
|
+
this.resultType = successResponse.type;
|
|
22
|
+
this.responseType = this.inferResponseType(successResponse.mediaType);
|
|
23
|
+
this.accept = successResponse.mediaType;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.resultType = 'never';
|
|
27
|
+
this.responseType = 'text';
|
|
28
|
+
this.accept = '*/*';
|
|
29
|
+
}
|
|
30
|
+
this.isNever = this.resultType === 'never';
|
|
31
|
+
this.isNumber = this.resultType === 'number';
|
|
32
|
+
this.isBoolean = this.resultType === 'boolean';
|
|
33
|
+
this.isOther = !this.isNever && !this.isNumber && !this.isBoolean;
|
|
34
|
+
let description = (operation.spec.description ?? '').trim();
|
|
35
|
+
if (description !== '') {
|
|
36
|
+
description += '\n\n';
|
|
37
|
+
}
|
|
38
|
+
this.methodComment = (0, Utils_js_1.tsComments)(this.methodDescription(), operation.deprecated);
|
|
39
|
+
}
|
|
40
|
+
// #endregion
|
|
41
|
+
// #region Properties
|
|
42
|
+
accept;
|
|
43
|
+
isBoolean;
|
|
44
|
+
isNever;
|
|
45
|
+
isNumber;
|
|
46
|
+
isOther;
|
|
47
|
+
methodComment;
|
|
48
|
+
methodName;
|
|
49
|
+
operation;
|
|
50
|
+
requestBody;
|
|
51
|
+
responseMethodName;
|
|
52
|
+
responseType;
|
|
53
|
+
resultType;
|
|
54
|
+
successResponse;
|
|
55
|
+
// #endregion
|
|
56
|
+
// #region Methods
|
|
57
|
+
inferResponseType(mediaType) {
|
|
58
|
+
mediaType = mediaType.toLowerCase();
|
|
59
|
+
if (mediaType === '*/*' || mediaType === 'application/json' || (mediaType.startsWith('application/') && mediaType.endsWith('+json'))) {
|
|
60
|
+
return 'json';
|
|
61
|
+
}
|
|
62
|
+
else if (mediaType.startsWith('text/')) {
|
|
63
|
+
return 'text';
|
|
64
|
+
}
|
|
65
|
+
return 'blob';
|
|
66
|
+
}
|
|
67
|
+
methodDescription() {
|
|
68
|
+
let description = (this.operation.spec.description ?? '').trim();
|
|
69
|
+
if (description !== '') {
|
|
70
|
+
description += '\n\n';
|
|
71
|
+
}
|
|
72
|
+
description += 'This method provides access to the response body.';
|
|
73
|
+
const sends = this.requestBody ? `sends \`${this.requestBody.mediaType}\` and ` : '';
|
|
74
|
+
const handles = this.requestBody
|
|
75
|
+
? `handles request body of type \`${this.requestBody.mediaType}\``
|
|
76
|
+
: 'doesn\'t expect any request body';
|
|
77
|
+
description += `\nThis method ${sends}${handles}.`;
|
|
78
|
+
return description;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ServiceOperationVariant = ServiceOperationVariant;
|
|
82
|
+
//# sourceMappingURL=ServiceOperationVariant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceOperationVariant.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceOperationVariant.ts"],"names":[],"mappings":";;;AAAA,0CAAyC;AAIzC,kBAAkB;AAElB,aAAa;AAEb;;;;GAIG;AACH,MAAa,uBAAuB;IAEhC,eAAe;IAEf,YAAmB,SAA2B,EAAE,UAAkB,EAAE,WAAkC,EAAE,eAAsC;QAC1I,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,kBAAkB,GAAG,GAAG,UAAU,WAAW,CAAC;QAEnD,IAAI,eAAe,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC;YACvC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YACtE,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC;QAC5C,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC;YAC1B,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;YAC3B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACx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,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEO,iBAAiB;QACrB,IAAI,WAAW,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACjE,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACrB,WAAW,IAAI,MAAM,CAAC;QAC1B,CAAC;QACD,WAAW,IAAI,mDAAmD,CAAC;QAEnE,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QACrF,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW;YAC5B,CAAC,CAAC,kCAAkC,IAAI,CAAC,WAAW,CAAC,SAAS,IAAI;YAClE,CAAC,CAAC,kCAAkC,CAAC;QACzC,WAAW,IAAI,iBAAiB,KAAK,GAAG,OAAO,GAAG,CAAC;QAEnD,OAAO,WAAW,CAAC;IACvB,CAAC;CAIJ;AAlFD,0DAkFC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ParameterLocation, ParameterObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
3
|
+
import type { IComment } from './Abstracts/Interfaces/IComment.js';
|
|
4
|
+
/**
|
|
5
|
+
* An operation parameter
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class ServiceParameter implements IComment {
|
|
10
|
+
constructor(spec: ParameterObject, options: Required<ITypeScriptOptions>);
|
|
11
|
+
spec: ParameterObject;
|
|
12
|
+
var: string;
|
|
13
|
+
name: string;
|
|
14
|
+
comments: Array<string>;
|
|
15
|
+
required: boolean;
|
|
16
|
+
in: ParameterLocation;
|
|
17
|
+
type: string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ServiceParameter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceParameter.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceParameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAInE;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,QAAQ;gBAI1B,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAcxE,IAAI,EAAE,eAAe,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,EAAE,EAAE,iBAAiB,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CAIvB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ServiceParameter = void 0;
|
|
5
|
+
const Utils_js_1 = require("../Utils.js");
|
|
6
|
+
// #endregion
|
|
7
|
+
/**
|
|
8
|
+
* An operation parameter
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class ServiceParameter {
|
|
13
|
+
// #region Ctor
|
|
14
|
+
constructor(spec, options) {
|
|
15
|
+
this.spec = spec;
|
|
16
|
+
this.name = spec.name;
|
|
17
|
+
this.var = (0, Utils_js_1.methodName)(this.name);
|
|
18
|
+
this.comments = (0, Utils_js_1.tsComments)(spec.description ?? '', spec.deprecated);
|
|
19
|
+
this.in = spec.in;
|
|
20
|
+
this.required = this.in === 'path' ? true : spec.required ?? false;
|
|
21
|
+
this.type = (0, Utils_js_1.tsType)(spec.schema, options);
|
|
22
|
+
}
|
|
23
|
+
// #endregion
|
|
24
|
+
// #region Properties
|
|
25
|
+
spec;
|
|
26
|
+
var;
|
|
27
|
+
name;
|
|
28
|
+
comments;
|
|
29
|
+
required;
|
|
30
|
+
in;
|
|
31
|
+
type;
|
|
32
|
+
}
|
|
33
|
+
exports.ServiceParameter = ServiceParameter;
|
|
34
|
+
//# sourceMappingURL=ServiceParameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceParameter.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceParameter.ts"],"names":[],"mappings":";AACA,kBAAkB;;;AAIlB,0CAA6D;AAG7D,aAAa;AAEb;;;;GAIG;AACH,MAAa,gBAAgB;IAEzB,eAAe;IAEf,YAAmB,IAAqB,EAAE,OAAqC;QAC3E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,IAAA,qBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAA,qBAAU,EAAC,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,IAAA,iBAAM,EAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,aAAa;IAEb,qBAAqB;IAEd,IAAI,CAAkB;IACtB,GAAG,CAAS;IACZ,IAAI,CAAS;IACb,QAAQ,CAAgB;IACxB,QAAQ,CAAU;IAClB,EAAE,CAAoB;IACtB,IAAI,CAAS;CAIvB;AA5BD,4CA4BC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RequestBodyObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
3
|
+
import type { IComment } from './Abstracts/Interfaces/IComment.js';
|
|
4
|
+
import type { ServiceContent } from './ServiceContent.js';
|
|
5
|
+
/**
|
|
6
|
+
* Describes a request body
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class ServiceRequestBody implements IComment {
|
|
11
|
+
constructor(spec: RequestBodyObject, content: Array<ServiceContent>, options: Required<ITypeScriptOptions>);
|
|
12
|
+
spec: RequestBodyObject;
|
|
13
|
+
content: Array<ServiceContent>;
|
|
14
|
+
options: ITypeScriptOptions;
|
|
15
|
+
comments: Array<string>;
|
|
16
|
+
required: boolean;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ServiceRequestBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceRequestBody.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceRequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,QAAQ;gBAI5B,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAY1G,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CAI5B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceRequestBody = void 0;
|
|
4
|
+
const Utils_js_1 = require("../Utils.js");
|
|
5
|
+
/**
|
|
6
|
+
* Describes a request body
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class ServiceRequestBody {
|
|
11
|
+
// #region Ctor
|
|
12
|
+
constructor(spec, content, options) {
|
|
13
|
+
this.spec = spec;
|
|
14
|
+
this.content = content;
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.comments = (0, Utils_js_1.tsComments)(spec.description ?? '');
|
|
17
|
+
this.required = spec.required === true;
|
|
18
|
+
}
|
|
19
|
+
// #endregion
|
|
20
|
+
// #region Properties
|
|
21
|
+
spec;
|
|
22
|
+
content;
|
|
23
|
+
options;
|
|
24
|
+
comments;
|
|
25
|
+
required;
|
|
26
|
+
}
|
|
27
|
+
exports.ServiceRequestBody = ServiceRequestBody;
|
|
28
|
+
//# sourceMappingURL=ServiceRequestBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceRequestBody.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceRequestBody.ts"],"names":[],"mappings":";;;AAEA,0CAAyC;AAIzC;;;;GAIG;AACH,MAAa,kBAAkB;IAE3B,eAAe;IAEf,YAAmB,IAAuB,EAAE,OAA8B,EAAE,OAAqC;QAC7G,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAA,qBAAU,EAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC;IAC3C,CAAC;IAED,aAAa;IAEb,qBAAqB;IAEd,IAAI,CAAoB;IACxB,OAAO,CAAwB;IAC/B,OAAO,CAAqB;IAC5B,QAAQ,CAAgB;IACxB,QAAQ,CAAU;CAI5B;AAxBD,gDAwBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ServiceContent } from './ServiceContent.js';
|
|
2
|
+
/**
|
|
3
|
+
* An operation response
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class ServiceResponse {
|
|
8
|
+
constructor(statusCode: string, description: string, content: Array<ServiceContent>);
|
|
9
|
+
statusCode: string;
|
|
10
|
+
description: string;
|
|
11
|
+
content: Array<ServiceContent>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ServiceResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceResponse.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceResponse.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;;;GAIG;AACH,qBAAa,eAAe;gBAIL,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC;IAUnF,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CAIzC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ServiceResponse = void 0;
|
|
5
|
+
// #endregion
|
|
6
|
+
/**
|
|
7
|
+
* An operation response
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class ServiceResponse {
|
|
12
|
+
// #region Ctor
|
|
13
|
+
constructor(statusCode, description, content) {
|
|
14
|
+
this.statusCode = statusCode;
|
|
15
|
+
this.description = description;
|
|
16
|
+
this.content = content;
|
|
17
|
+
}
|
|
18
|
+
// #endregion
|
|
19
|
+
// #region Properties
|
|
20
|
+
statusCode;
|
|
21
|
+
description;
|
|
22
|
+
content;
|
|
23
|
+
}
|
|
24
|
+
exports.ServiceResponse = ServiceResponse;
|
|
25
|
+
//# sourceMappingURL=ServiceResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceResponse.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceResponse.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,aAAa;AAEb;;;;GAIG;AACH,MAAa,eAAe;IAExB,eAAe;IAEf,YAAmB,UAAkB,EAAE,WAAmB,EAAE,OAA8B;QACtF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,aAAa;IAEb,qBAAqB;IAEd,UAAU,CAAS;IACnB,WAAW,CAAS;IACpB,OAAO,CAAwB;CAIzC;AApBD,0CAoBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SecuritySchemeObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
3
|
+
import type { IComment } from './Abstracts/Interfaces/IComment.js';
|
|
4
|
+
/**
|
|
5
|
+
* An operation security
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class ServiceSecurity implements IComment {
|
|
10
|
+
constructor(key: string, spec: SecuritySchemeObject, scope: Array<string>, options: Required<ITypeScriptOptions>);
|
|
11
|
+
spec: SecuritySchemeObject;
|
|
12
|
+
scope: Array<string>;
|
|
13
|
+
var: string;
|
|
14
|
+
name: string;
|
|
15
|
+
comments: Array<string>;
|
|
16
|
+
in: string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=ServiceSecurity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceSecurity.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceSecurity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAInE;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,QAAQ;gBAIzB,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAchH,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;CAKrB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ServiceSecurity = void 0;
|
|
5
|
+
const Utils_js_1 = require("../Utils.js");
|
|
6
|
+
// #endregion
|
|
7
|
+
/**
|
|
8
|
+
* An operation security
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class ServiceSecurity {
|
|
13
|
+
// #region Ctor
|
|
14
|
+
constructor(key, spec, scope, options) {
|
|
15
|
+
this.spec = spec;
|
|
16
|
+
this.scope = scope;
|
|
17
|
+
this.name = spec.name ?? '';
|
|
18
|
+
this.var = (0, Utils_js_1.methodName)(key);
|
|
19
|
+
this.comments = (0, Utils_js_1.tsComments)(spec.description ?? '');
|
|
20
|
+
this.in = spec.in ?? 'header';
|
|
21
|
+
// this.type = tsType(spec.schema, options);
|
|
22
|
+
}
|
|
23
|
+
// #endregion
|
|
24
|
+
// #region Propeties
|
|
25
|
+
spec;
|
|
26
|
+
scope = [];
|
|
27
|
+
var;
|
|
28
|
+
name;
|
|
29
|
+
comments;
|
|
30
|
+
in;
|
|
31
|
+
}
|
|
32
|
+
exports.ServiceSecurity = ServiceSecurity;
|
|
33
|
+
//# sourceMappingURL=ServiceSecurity.js.map
|