@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,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Symantic = void 0;
|
|
5
|
+
const Imports_js_1 = require("../../Imports.js");
|
|
6
|
+
const Utils_js_1 = require("../../Utils.js");
|
|
7
|
+
// #endregion
|
|
8
|
+
/**
|
|
9
|
+
* Base definitions of a generated type
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
class Symantic {
|
|
14
|
+
// #region Fields
|
|
15
|
+
_imports;
|
|
16
|
+
_additionalDependencies;
|
|
17
|
+
// #endregion
|
|
18
|
+
// #region Ctor
|
|
19
|
+
constructor(name, typeNameTransform, options) {
|
|
20
|
+
this.name = name;
|
|
21
|
+
this.options = options;
|
|
22
|
+
this.typeName = typeNameTransform(name, options);
|
|
23
|
+
this.namespace = (0, Utils_js_1.namespace)(name);
|
|
24
|
+
this.fileName = (0, Utils_js_1.fileName)(this.typeName);
|
|
25
|
+
this.qualifiedName = this.typeName;
|
|
26
|
+
if (this.namespace) {
|
|
27
|
+
this.fileName = `${this.namespace}/${this.fileName}`;
|
|
28
|
+
this.qualifiedName = (0, Utils_js_1.typeName)(this.namespace) + this.typeName;
|
|
29
|
+
}
|
|
30
|
+
this._imports = new Imports_js_1.Imports(options);
|
|
31
|
+
this.comments = [];
|
|
32
|
+
this.imports = [];
|
|
33
|
+
this.additionalDependencies = [];
|
|
34
|
+
this._additionalDependencies = new Set();
|
|
35
|
+
}
|
|
36
|
+
// #endregion
|
|
37
|
+
// #region Properties
|
|
38
|
+
name;
|
|
39
|
+
options;
|
|
40
|
+
/**
|
|
41
|
+
* Name of the generated type / class
|
|
42
|
+
*/
|
|
43
|
+
typeName;
|
|
44
|
+
/**
|
|
45
|
+
* Namespace, separated by '/'
|
|
46
|
+
*/
|
|
47
|
+
namespace;
|
|
48
|
+
/**
|
|
49
|
+
* Camel-case qualified name of the type, including namespace
|
|
50
|
+
*/
|
|
51
|
+
qualifiedName;
|
|
52
|
+
/**
|
|
53
|
+
* Name of the generated file
|
|
54
|
+
*/
|
|
55
|
+
fileName;
|
|
56
|
+
/**
|
|
57
|
+
* TypeScript comments for this type
|
|
58
|
+
*/
|
|
59
|
+
comments;
|
|
60
|
+
imports;
|
|
61
|
+
additionalDependencies;
|
|
62
|
+
// #endregion
|
|
63
|
+
// #region Methods
|
|
64
|
+
toJSON() {
|
|
65
|
+
return {
|
|
66
|
+
name: this.name,
|
|
67
|
+
options: this.options,
|
|
68
|
+
typeName: this.typeName,
|
|
69
|
+
namespace: this.namespace,
|
|
70
|
+
qualifiedName: this.qualifiedName,
|
|
71
|
+
fileName: this.fileName,
|
|
72
|
+
comments: this.comments,
|
|
73
|
+
imports: this.imports,
|
|
74
|
+
additionalDependencies: this.additionalDependencies
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
addImport(name) {
|
|
78
|
+
if (!this.skipImport(name)) {
|
|
79
|
+
// Don't have to import to this own file
|
|
80
|
+
this._imports.add(name, this.pathToModels());
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
updateImports() {
|
|
84
|
+
this.imports = this._imports.toArray();
|
|
85
|
+
this.additionalDependencies = [...this._additionalDependencies];
|
|
86
|
+
}
|
|
87
|
+
collectImports(schema, additional = false, processOneOf = false) {
|
|
88
|
+
if (!schema) {
|
|
89
|
+
// No schema, nothing to do
|
|
90
|
+
}
|
|
91
|
+
else if ('$ref' in schema) {
|
|
92
|
+
const dep = (0, Utils_js_1.simpleName)(schema.$ref);
|
|
93
|
+
if (additional) {
|
|
94
|
+
this._additionalDependencies.add(dep);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.addImport(dep);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
(schema.oneOf ?? []).forEach((i) => this.collectImports(i, additional));
|
|
102
|
+
(schema.allOf ?? []).forEach((i) => this.collectImports(i, additional));
|
|
103
|
+
(schema.anyOf ?? []).forEach((i) => this.collectImports(i, additional));
|
|
104
|
+
if (processOneOf) {
|
|
105
|
+
(schema.oneOf ?? []).forEach((i) => this.collectImports(i, additional));
|
|
106
|
+
}
|
|
107
|
+
if (schema.items) {
|
|
108
|
+
this.collectImports(schema.items, additional);
|
|
109
|
+
}
|
|
110
|
+
if (schema.properties) {
|
|
111
|
+
const properties = schema.properties;
|
|
112
|
+
Object.keys(properties).forEach((p) => {
|
|
113
|
+
const prop = properties[p];
|
|
114
|
+
this.collectImports(prop, additional, true);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (typeof schema.additionalProperties === 'object') {
|
|
118
|
+
this.collectImports(schema.additionalProperties, additional);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.Symantic = Symantic;
|
|
124
|
+
//# sourceMappingURL=Symantic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Symantic.js","sourceRoot":"","sources":["../../../../../src/Models/TypeScript/Models/Abstracts/Symantic.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,iDAA2C;AAE3C,6CAA2E;AAG3E,aAAa;AAEb;;;;GAIG;AACH,MAAsB,QAAQ;IAE1B,iBAAiB;IAEA,QAAQ,CAAU;IAClB,uBAAuB,CAAc;IAEtD,aAAa;IAEb,eAAe;IAEf,YAAmB,IAAY,EAAE,iBAAsF,EAAE,OAAqC;QAC1J,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,SAAS,GAAG,IAAA,oBAAS,EAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ,GAA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AM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;YACxE,IAAI,YAAY,EAAE,CAAC;gBACf,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;YAC5E,CAAC;YACD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YAClD,CAAC;YACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;gBACpB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;oBAClC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;oBAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;gBAChD,CAAC,CAAC,CAAC;YACP,CAAC;YACD,IAAI,OAAO,MAAM,CAAC,oBAAoB,KAAK,QAAQ,EAAE,CAAC;gBAClD,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;YACjE,CAAC;QACL,CAAC;IACL,CAAC;CAIJ;AAvID,4BAuIC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SchemaObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { IOpenApiInfo } from '../../../Interfaces/IOpenApiInfo.js';
|
|
3
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
4
|
+
import { Symantic } from './Abstracts/Symantic.js';
|
|
5
|
+
import { ModelProperty } from './ModelProperty.js';
|
|
6
|
+
import { ModelValue } from './ModelValue.js';
|
|
7
|
+
/**
|
|
8
|
+
* The context to generate `classes`, `interfaces`, `types` or `enums`.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class Model extends Symantic {
|
|
13
|
+
constructor(name: string, schema: SchemaObject, info: IOpenApiInfo, options: Required<ITypeScriptOptions>);
|
|
14
|
+
schema: SchemaObject;
|
|
15
|
+
info: IOpenApiInfo;
|
|
16
|
+
isSimple: boolean;
|
|
17
|
+
isEnum: boolean;
|
|
18
|
+
isObject: boolean;
|
|
19
|
+
simpleType: string;
|
|
20
|
+
enumValues: Array<ModelValue>;
|
|
21
|
+
elementType: string;
|
|
22
|
+
hasSuperClasses: boolean;
|
|
23
|
+
superClasses: Array<string>;
|
|
24
|
+
properties: Array<ModelProperty>;
|
|
25
|
+
additionalPropertiesType: string;
|
|
26
|
+
toJSON(): unknown;
|
|
27
|
+
protected pathToModels(): string;
|
|
28
|
+
protected skipImport(name: string): boolean;
|
|
29
|
+
private collectObject;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Model.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/Model.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;;GAIG;AACH,qBAAa,KAAM,SAAQ,QAAQ;gBAIZ,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAmDzG,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,wBAAwB,EAAE,MAAM,CAAC;IAMxB,MAAM,IAAI,OAAO;IAkBjC,SAAS,CAAC,YAAY,IAAI,MAAM;IAYhC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK3C,OAAO,CAAC,aAAa;CA8BxB"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Model = void 0;
|
|
5
|
+
const Utils_js_1 = require("../Utils.js");
|
|
6
|
+
const Symantic_js_1 = require("./Abstracts/Symantic.js");
|
|
7
|
+
const ModelProperty_js_1 = require("./ModelProperty.js");
|
|
8
|
+
const ModelValue_js_1 = require("./ModelValue.js");
|
|
9
|
+
// #endregion
|
|
10
|
+
/**
|
|
11
|
+
* The context to generate `classes`, `interfaces`, `types` or `enums`.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
class Model extends Symantic_js_1.Symantic {
|
|
16
|
+
// #region Ctor
|
|
17
|
+
constructor(name, schema, info, options) {
|
|
18
|
+
super(name, modelClass, options);
|
|
19
|
+
this.info = info;
|
|
20
|
+
this.simpleType = '';
|
|
21
|
+
this.enumValues = [];
|
|
22
|
+
this.elementType = '';
|
|
23
|
+
this.hasSuperClasses = false;
|
|
24
|
+
this.superClasses = [];
|
|
25
|
+
this.properties = [];
|
|
26
|
+
this.additionalPropertiesType = '';
|
|
27
|
+
this.schema = schema;
|
|
28
|
+
this.comments = (0, Utils_js_1.tsComments)(schema.description ?? '', schema.deprecated);
|
|
29
|
+
const type = (Array.isArray(schema.type) ? schema.type.join(' | ') : schema.type) ?? 'any';
|
|
30
|
+
// When enumStyle is 'alias' it is handled as a simple type.
|
|
31
|
+
if (options.enumStyle !== 'alias' && (schema.enum ?? []).length > 0 && ['string', 'number', 'integer'].includes(type)) {
|
|
32
|
+
const names = (0, Utils_js_1.tryGetEnumNames)(schema) ?? [];
|
|
33
|
+
const values = schema.enum ?? [];
|
|
34
|
+
this.enumValues = [];
|
|
35
|
+
for (let i = 0; i < values.length; i++) {
|
|
36
|
+
const enumValue = new ModelValue_js_1.ModelValue(type, names[i], values[i], options);
|
|
37
|
+
this.enumValues.push(enumValue);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
this.isObject = type === 'object' || !!schema.properties || (schema.allOf ?? []).length > 0;
|
|
41
|
+
this.isEnum = this.enumValues.length > 0;
|
|
42
|
+
this.isSimple = !this.isObject && !this.isEnum;
|
|
43
|
+
if (this.isObject) {
|
|
44
|
+
// Object
|
|
45
|
+
this.superClasses = [];
|
|
46
|
+
const propertiesByName = new Map();
|
|
47
|
+
this.collectObject(schema, propertiesByName);
|
|
48
|
+
this.hasSuperClasses = this.superClasses.length > 0;
|
|
49
|
+
const sortedNames = [...propertiesByName.keys()];
|
|
50
|
+
sortedNames.sort();
|
|
51
|
+
this.properties = sortedNames.map((propName) => propertiesByName.get(propName));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Simple / array / enum / union
|
|
55
|
+
this.simpleType = (0, Utils_js_1.tsType)(schema, options);
|
|
56
|
+
}
|
|
57
|
+
this.collectImports(schema);
|
|
58
|
+
this.updateImports();
|
|
59
|
+
}
|
|
60
|
+
// #endregion
|
|
61
|
+
// #region Properies
|
|
62
|
+
schema;
|
|
63
|
+
info;
|
|
64
|
+
isSimple;
|
|
65
|
+
isEnum;
|
|
66
|
+
isObject;
|
|
67
|
+
simpleType;
|
|
68
|
+
enumValues;
|
|
69
|
+
elementType;
|
|
70
|
+
hasSuperClasses;
|
|
71
|
+
superClasses;
|
|
72
|
+
properties;
|
|
73
|
+
additionalPropertiesType;
|
|
74
|
+
// #endregion
|
|
75
|
+
// #region Methods
|
|
76
|
+
toJSON() {
|
|
77
|
+
return {
|
|
78
|
+
...super.toJSON(),
|
|
79
|
+
schema: this.schema,
|
|
80
|
+
info: this.info,
|
|
81
|
+
isSimple: this.isSimple,
|
|
82
|
+
isEnum: this.isEnum,
|
|
83
|
+
isObject: this.isObject,
|
|
84
|
+
simpleType: this.simpleType,
|
|
85
|
+
enumValues: this.enumValues,
|
|
86
|
+
elementType: this.elementType,
|
|
87
|
+
hasSuperClasses: this.hasSuperClasses,
|
|
88
|
+
superClasses: this.superClasses,
|
|
89
|
+
properties: this.properties,
|
|
90
|
+
additionalPropertiesType: this.additionalPropertiesType
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
pathToModels() {
|
|
94
|
+
if (this.namespace) {
|
|
95
|
+
const depth = this.namespace.split('/').length;
|
|
96
|
+
let path = '';
|
|
97
|
+
for (let i = 0; i < depth; i++) {
|
|
98
|
+
path += '../';
|
|
99
|
+
}
|
|
100
|
+
return path;
|
|
101
|
+
}
|
|
102
|
+
return './';
|
|
103
|
+
}
|
|
104
|
+
skipImport(name) {
|
|
105
|
+
// Don't import own type
|
|
106
|
+
return this.name === name;
|
|
107
|
+
}
|
|
108
|
+
collectObject(schema, propertiesByName) {
|
|
109
|
+
const allOf = schema.allOf ?? [];
|
|
110
|
+
if (allOf.length > 0) {
|
|
111
|
+
for (const part of allOf) {
|
|
112
|
+
if ('$ref' in part) {
|
|
113
|
+
// A superclass
|
|
114
|
+
const ref = (0, Utils_js_1.simpleName)(part.$ref);
|
|
115
|
+
this.superClasses.push((0, Utils_js_1.qualifiedName)(ref, this.options));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.collectObject(part, propertiesByName);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if (schema.type === 'object' || !!schema.properties) {
|
|
123
|
+
// An object definition
|
|
124
|
+
const properties = schema.properties ?? {};
|
|
125
|
+
const required = schema.required ?? [];
|
|
126
|
+
const propNames = Object.keys(properties);
|
|
127
|
+
for (const propName of propNames) {
|
|
128
|
+
propertiesByName.set(propName, new ModelProperty_js_1.ModelProperty(this, propName, properties[propName], required.includes(propName), this.options));
|
|
129
|
+
}
|
|
130
|
+
if (schema.additionalProperties === true) {
|
|
131
|
+
this.additionalPropertiesType = 'any';
|
|
132
|
+
}
|
|
133
|
+
else if (schema.additionalProperties) {
|
|
134
|
+
this.additionalPropertiesType = (0, Utils_js_1.tsType)(schema.additionalProperties, this.options);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.Model = Model;
|
|
140
|
+
/**
|
|
141
|
+
* Applies the prefix and suffix to a model class name
|
|
142
|
+
*/
|
|
143
|
+
function modelClass(baseName, options) {
|
|
144
|
+
if (options.modelNamingConvention.replace) {
|
|
145
|
+
baseName = baseName.replace(options.modelNamingConvention.replace.regex, options.modelNamingConvention.replace.value);
|
|
146
|
+
}
|
|
147
|
+
return `${options.modelNamingConvention.prefix ?? ''}${(0, Utils_js_1.typeName)(baseName)}${options.modelNamingConvention.suffix ?? ''}`;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=Model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Model.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/Model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ptOptions.js';
|
|
3
|
+
import type { IComment } from './Abstracts/Interfaces/IComment.js';
|
|
4
|
+
import type { Model } from './Model.js';
|
|
5
|
+
/**
|
|
6
|
+
* The context to generate a model property.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class ModelProperty implements IComment {
|
|
11
|
+
constructor(model: Model, name: string, schema: SchemaObject | ReferenceObject, required: boolean, options: Required<ITypeScriptOptions>);
|
|
12
|
+
model: Model;
|
|
13
|
+
comments: Array<string>;
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
identifier: string;
|
|
17
|
+
schema: SchemaObject | ReferenceObject;
|
|
18
|
+
required: boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ModelProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelProperty.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ModelProperty.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC;;;;GAIG;AACH,qBAAa,aAAc,YAAW,QAAQ;gBAIvB,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAexI,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,YAAY,GAAG,eAAe,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;CAI5B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModelProperty = void 0;
|
|
4
|
+
const Utils_js_1 = require("../Utils.js");
|
|
5
|
+
// #endregion
|
|
6
|
+
/**
|
|
7
|
+
* The context to generate a model property.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class ModelProperty {
|
|
12
|
+
// #region Ctor
|
|
13
|
+
constructor(model, name, schema, required, options) {
|
|
14
|
+
this.model = model;
|
|
15
|
+
this.name = name;
|
|
16
|
+
this.schema = schema;
|
|
17
|
+
this.required = required;
|
|
18
|
+
this.type = (0, Utils_js_1.tsType)(this.schema, options);
|
|
19
|
+
this.identifier = (0, Utils_js_1.escapeId)(this.name);
|
|
20
|
+
const description = schema.description ?? '';
|
|
21
|
+
this.comments = (0, Utils_js_1.tsComments)(description, schema.deprecated);
|
|
22
|
+
}
|
|
23
|
+
// #endregion
|
|
24
|
+
// #region Propertis
|
|
25
|
+
model;
|
|
26
|
+
comments;
|
|
27
|
+
type;
|
|
28
|
+
name;
|
|
29
|
+
identifier;
|
|
30
|
+
schema;
|
|
31
|
+
required;
|
|
32
|
+
}
|
|
33
|
+
exports.ModelProperty = ModelProperty;
|
|
34
|
+
//# sourceMappingURL=ModelProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelProperty.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ModelProperty.ts"],"names":[],"mappings":";;;AAGA,0CAA2D;AAI3D,aAAa;AAEb;;;;GAIG;AACH,MAAa,aAAa;IAEtB,eAAe;IAEf,YAAmB,KAAY,EAAE,IAAY,EAAE,MAAsC,EAAE,QAAiB,EAAE,OAAqC;QAC3I,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAA,iBAAM,EAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,WAAW,GAAI,MAAuB,CAAC,WAAW,IAAI,EAAE,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAA,qBAAU,EAAC,WAAW,EAAG,MAAuB,CAAC,UAAU,CAAC,CAAC;IACjF,CAAC;IAED,aAAa;IAEb,oBAAoB;IAEb,KAAK,CAAQ;IACb,QAAQ,CAAgB;IACxB,IAAI,CAAS;IACb,IAAI,CAAS;IACb,UAAU,CAAS;IACnB,MAAM,CAAiC;IACvC,QAAQ,CAAU;CAI5B;AA7BD,sCA6BC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
2
|
+
/**
|
|
3
|
+
* The context to generate a model value.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class ModelValue {
|
|
8
|
+
constructor(type: string, name: string | undefined, val: string | number, options: Required<ITypeScriptOptions>);
|
|
9
|
+
type: string;
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the name of the enum constant for a given value
|
|
14
|
+
*
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
private enumName;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ModelValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelValue.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ModelValue.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAK9E;;;;GAIG;AACH,qBAAa,UAAU;gBAIA,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAU/G,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAMrB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;CAenB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ModelValue = void 0;
|
|
8
|
+
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
9
|
+
const jsesc_1 = __importDefault(require("jsesc"));
|
|
10
|
+
const Utils_js_1 = require("../Utils.js");
|
|
11
|
+
// #endregion
|
|
12
|
+
/**
|
|
13
|
+
* The context to generate a model value.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class ModelValue {
|
|
18
|
+
// #region Ctor
|
|
19
|
+
constructor(type, name, val, options) {
|
|
20
|
+
this.type = type;
|
|
21
|
+
this.name = name ?? this.enumName(utilities_1.StringExtensions.toCamelCase(val.toString()), options);
|
|
22
|
+
this.value = type === 'string' ? `'${(0, jsesc_1.default)(val.toString())}'` : val.toString();
|
|
23
|
+
}
|
|
24
|
+
// #endregion
|
|
25
|
+
// #region Properties
|
|
26
|
+
type;
|
|
27
|
+
name;
|
|
28
|
+
value;
|
|
29
|
+
// #endregion
|
|
30
|
+
// #region Methds
|
|
31
|
+
/**
|
|
32
|
+
* Returns the name of the enum constant for a given value
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
enumName(value, options) {
|
|
37
|
+
let name = (0, Utils_js_1.toBasicChars)(value, true);
|
|
38
|
+
if (options.enumStyle === 'upper') {
|
|
39
|
+
name = name.toUpperCase().replace(/\s+/g, '_');
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
name = utilities_1.StringExtensions.firstCharToUpperCase(name);
|
|
43
|
+
}
|
|
44
|
+
if ((/^\d/).test(name)) {
|
|
45
|
+
name = `$${name}`;
|
|
46
|
+
}
|
|
47
|
+
return name;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ModelValue = ModelValue;
|
|
51
|
+
//# sourceMappingURL=ModelValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelValue.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ModelValue.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;;AAElB,oEAAwE;AACxE,kDAA0B;AAE1B,0CAA2C;AAE3C,aAAa;AAEb;;;;GAIG;AACH,MAAa,UAAU;IAEnB,eAAe;IAEf,YAAmB,IAAY,EAAE,IAAwB,EAAE,GAAoB,EAAE,OAAqC;QAClH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,4BAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;QACzF,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAA,eAAK,EAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACnF,CAAC;IAED,aAAa;IAEb,qBAAqB;IAEd,IAAI,CAAS;IACb,IAAI,CAAS;IACb,KAAK,CAAS;IAErB,aAAa;IAEb,iBAAiB;IAEjB;;;;OAIG;IACK,QAAQ,CAAC,KAAa,EAAE,OAA2B;QACvD,IAAI,IAAI,GAAG,IAAA,uBAAY,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;YAChC,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACJ,IAAI,GAAG,4BAAgB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACtB,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CAIJ;AA1CD,gCA0CC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TagObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { IOpenApiInfo } from '../../../Interfaces/IOpenApiInfo.js';
|
|
3
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
4
|
+
import { Symantic } from './Abstracts/Symantic.js';
|
|
5
|
+
import type { ServiceOperation } from './ServiceOperation.js';
|
|
6
|
+
/**
|
|
7
|
+
* The context to generate a service.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare class Service extends Symantic {
|
|
12
|
+
constructor(tag: TagObject, info: IOpenApiInfo, operations: Array<ServiceOperation>, options: Required<ITypeScriptOptions>);
|
|
13
|
+
tag: TagObject;
|
|
14
|
+
info: IOpenApiInfo;
|
|
15
|
+
operations: Array<ServiceOperation>;
|
|
16
|
+
toJSON(): unknown;
|
|
17
|
+
protected pathToModels(): string;
|
|
18
|
+
protected skipImport(): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/Service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D;;;;GAIG;AACH,qBAAa,OAAQ,SAAQ,QAAQ;gBAId,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAyC1H,GAAG,EAAE,SAAS,CAAC;IACf,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAM3B,MAAM,IAAI,OAAO;IASjC,SAAS,CAAC,YAAY,IAAI,MAAM;IAIhC,SAAS,CAAC,UAAU,IAAI,OAAO;CAOlC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Service = void 0;
|
|
5
|
+
const Utils_js_1 = require("../Utils.js");
|
|
6
|
+
const Symantic_js_1 = require("./Abstracts/Symantic.js");
|
|
7
|
+
// #endregion
|
|
8
|
+
/**
|
|
9
|
+
* The context to generate a service.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
class Service extends Symantic_js_1.Symantic {
|
|
14
|
+
// #region Ctor
|
|
15
|
+
constructor(tag, info, operations, options) {
|
|
16
|
+
super(tag.name, serviceClass, options);
|
|
17
|
+
this.info = info;
|
|
18
|
+
this.tag = tag;
|
|
19
|
+
this.operations = operations;
|
|
20
|
+
// Angular standards demand that services have a period separating them
|
|
21
|
+
if (this.fileName.endsWith('-service')) {
|
|
22
|
+
this.fileName = `${this.fileName.substring(0, this.fileName.length - '-service'.length)}.service`;
|
|
23
|
+
}
|
|
24
|
+
this.comments = (0, Utils_js_1.tsComments)(tag.description ?? '');
|
|
25
|
+
// Collect the imports
|
|
26
|
+
for (const operation of operations) {
|
|
27
|
+
for (const parameter of operation.parameters) {
|
|
28
|
+
this.collectImports(parameter.spec.schema, false, true);
|
|
29
|
+
}
|
|
30
|
+
// we don't know the schema of the security object ???
|
|
31
|
+
// for (const securityGroup of operation.security) {
|
|
32
|
+
// securityGroup.forEach((security) => this.collectImports(security.spec.schema));
|
|
33
|
+
// }
|
|
34
|
+
if (operation.requestBody) {
|
|
35
|
+
for (const content of operation.requestBody.content) {
|
|
36
|
+
this.collectImports(content.spec.schema);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const response of operation.allResponses) {
|
|
40
|
+
const isAdditional = response !== operation.successResponse;
|
|
41
|
+
for (const content of response.content) {
|
|
42
|
+
this.collectImports(content.spec.schema, isAdditional, true);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
this.updateImports();
|
|
47
|
+
}
|
|
48
|
+
// #endregion
|
|
49
|
+
// #region Properties
|
|
50
|
+
tag;
|
|
51
|
+
info;
|
|
52
|
+
operations;
|
|
53
|
+
// #endregion
|
|
54
|
+
// #region Methods
|
|
55
|
+
toJSON() {
|
|
56
|
+
return {
|
|
57
|
+
...super.toJSON(),
|
|
58
|
+
tag: this.tag,
|
|
59
|
+
info: this.info,
|
|
60
|
+
operations: this.operations
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
pathToModels() {
|
|
64
|
+
return `../${this.options.modelRoot}`;
|
|
65
|
+
}
|
|
66
|
+
skipImport() {
|
|
67
|
+
// All models are imported
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.Service = Service;
|
|
72
|
+
/**
|
|
73
|
+
* Applies the prefix and suffix to a service class name
|
|
74
|
+
*/
|
|
75
|
+
function serviceClass(baseName, options) {
|
|
76
|
+
if (options.serviceNamingConvention.replace) {
|
|
77
|
+
baseName = baseName.replace(options.serviceNamingConvention.replace.regex, options.serviceNamingConvention.replace.value);
|
|
78
|
+
}
|
|
79
|
+
return `${options.serviceNamingConvention.prefix ?? ''}${(0, Utils_js_1.typeName)(baseName)}${options.serviceNamingConvention.suffix ?? 'Service'}`;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=Service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/Service.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAKlB,0CAAmD;AACnD,yDAAmD;AAGnD,aAAa;AAEb;;;;GAIG;AACH,MAAa,OAAQ,SAAQ,sBAAQ;IAEjC,eAAe;IAEf,YAAmB,GAAc,EAAE,IAAkB,EAAE,UAAmC,EAAE,OAAqC;QAC7H,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QAEvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,uEAAuE;QACvE,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,QAAQ,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG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AI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;SAC9B,CAAC;IACN,CAAC;IAES,YAAY;QAClB,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAC1C,CAAC;IAES,UAAU;QAChB,0BAA0B;QAC1B,OAAO,KAAK,CAAC;IACjB,CAAC;CAIJ;AAzED,0BAyEC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,QAAgB,EAAE,OAA2B;IAC/D,IAAI,OAAO,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;QAC1C,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9H,CAAC;IAED,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,MAAM,IAAI,EAAE,GAAG,IAAA,mBAAQ,EAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,uBAAuB,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;AACxI,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MediaTypeObject } from 'openapi3-ts/oas30';
|
|
2
|
+
import type { ITypeScriptOptions } from '../Interfaces/ITypeScriptOptions.js';
|
|
3
|
+
/**
|
|
4
|
+
* Either a request body or response content
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class ServiceContent {
|
|
9
|
+
constructor(mediaType: string, spec: MediaTypeObject, options: Required<ITypeScriptOptions>);
|
|
10
|
+
mediaType: string;
|
|
11
|
+
spec: MediaTypeObject;
|
|
12
|
+
options: ITypeScriptOptions;
|
|
13
|
+
type: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ServiceContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceContent.d.ts","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceContent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAK9E;;;;GAIG;AACH,qBAAa,cAAc;gBAIJ,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAW3F,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;CAIvB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ServiceContent = void 0;
|
|
5
|
+
const Utils_js_1 = require("../Utils.js");
|
|
6
|
+
// #endregion
|
|
7
|
+
/**
|
|
8
|
+
* Either a request body or response content
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class ServiceContent {
|
|
13
|
+
// #region Ctor
|
|
14
|
+
constructor(mediaType, spec, options) {
|
|
15
|
+
this.mediaType = mediaType;
|
|
16
|
+
this.spec = spec;
|
|
17
|
+
this.options = options;
|
|
18
|
+
this.type = (0, Utils_js_1.tsType)(spec.schema, options);
|
|
19
|
+
}
|
|
20
|
+
// #endregion
|
|
21
|
+
// #region Properties
|
|
22
|
+
mediaType;
|
|
23
|
+
spec;
|
|
24
|
+
options;
|
|
25
|
+
type;
|
|
26
|
+
}
|
|
27
|
+
exports.ServiceContent = ServiceContent;
|
|
28
|
+
//# sourceMappingURL=ServiceContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceContent.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceContent.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,0CAAqC;AAErC,aAAa;AAEb;;;;GAIG;AACH,MAAa,cAAc;IAEvB,eAAe;IAEf,YAAmB,SAAiB,EAAE,IAAqB,EAAE,OAAqC;QAC9F,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAA,iBAAM,EAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,aAAa;IAEb,qBAAqB;IAEd,SAAS,CAAS;IAClB,IAAI,CAAkB;IACtB,OAAO,CAAqB;IAC5B,IAAI,CAAS;CAIvB;AAtBD,wCAsBC"}
|