@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.
Files changed (102) hide show
  1. package/Index.d.ts +25 -0
  2. package/Index.d.ts.map +1 -0
  3. package/Index.js +42 -0
  4. package/Index.js.map +1 -0
  5. package/Interfaces/IOpenApiInfo.d.ts +10 -0
  6. package/Interfaces/IOpenApiInfo.d.ts.map +1 -0
  7. package/Interfaces/IOpenApiInfo.js +4 -0
  8. package/Interfaces/IOpenApiInfo.js.map +1 -0
  9. package/Interfaces/IOptions.d.ts +31 -0
  10. package/Interfaces/IOptions.d.ts.map +1 -0
  11. package/Interfaces/IOptions.js +12 -0
  12. package/Interfaces/IOptions.js.map +1 -0
  13. package/LICENSE +21 -0
  14. package/Models/TypeScript/Import.d.ts +14 -0
  15. package/Models/TypeScript/Import.d.ts.map +1 -0
  16. package/Models/TypeScript/Import.js +53 -0
  17. package/Models/TypeScript/Import.js.map +1 -0
  18. package/Models/TypeScript/Imports.d.ts +15 -0
  19. package/Models/TypeScript/Imports.d.ts.map +1 -0
  20. package/Models/TypeScript/Imports.js +39 -0
  21. package/Models/TypeScript/Imports.js.map +1 -0
  22. package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.d.ts +21 -0
  23. package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.d.ts.map +1 -0
  24. package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.js +3 -0
  25. package/Models/TypeScript/Interfaces/ITypeScriptNamingConvention.js.map +1 -0
  26. package/Models/TypeScript/Interfaces/ITypeScriptOptions.d.ts +63 -0
  27. package/Models/TypeScript/Interfaces/ITypeScriptOptions.d.ts.map +1 -0
  28. package/Models/TypeScript/Interfaces/ITypeScriptOptions.js +39 -0
  29. package/Models/TypeScript/Interfaces/ITypeScriptOptions.js.map +1 -0
  30. package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.d.ts +7 -0
  31. package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.d.ts.map +1 -0
  32. package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.js +3 -0
  33. package/Models/TypeScript/Models/Abstracts/Interfaces/IComment.js.map +1 -0
  34. package/Models/TypeScript/Models/Abstracts/Symantic.d.ts +48 -0
  35. package/Models/TypeScript/Models/Abstracts/Symantic.d.ts.map +1 -0
  36. package/Models/TypeScript/Models/Abstracts/Symantic.js +124 -0
  37. package/Models/TypeScript/Models/Abstracts/Symantic.js.map +1 -0
  38. package/Models/TypeScript/Models/Model.d.ts +31 -0
  39. package/Models/TypeScript/Models/Model.d.ts.map +1 -0
  40. package/Models/TypeScript/Models/Model.js +149 -0
  41. package/Models/TypeScript/Models/Model.js.map +1 -0
  42. package/Models/TypeScript/Models/ModelProperty.d.ts +20 -0
  43. package/Models/TypeScript/Models/ModelProperty.d.ts.map +1 -0
  44. package/Models/TypeScript/Models/ModelProperty.js +34 -0
  45. package/Models/TypeScript/Models/ModelProperty.js.map +1 -0
  46. package/Models/TypeScript/Models/ModelValue.d.ts +19 -0
  47. package/Models/TypeScript/Models/ModelValue.d.ts.map +1 -0
  48. package/Models/TypeScript/Models/ModelValue.js +51 -0
  49. package/Models/TypeScript/Models/ModelValue.js.map +1 -0
  50. package/Models/TypeScript/Models/Service.d.ts +20 -0
  51. package/Models/TypeScript/Models/Service.d.ts.map +1 -0
  52. package/Models/TypeScript/Models/Service.js +81 -0
  53. package/Models/TypeScript/Models/Service.js.map +1 -0
  54. package/Models/TypeScript/Models/ServiceContent.d.ts +15 -0
  55. package/Models/TypeScript/Models/ServiceContent.d.ts.map +1 -0
  56. package/Models/TypeScript/Models/ServiceContent.js +28 -0
  57. package/Models/TypeScript/Models/ServiceContent.js.map +1 -0
  58. package/Models/TypeScript/Models/ServiceOperation.d.ts +60 -0
  59. package/Models/TypeScript/Models/ServiceOperation.d.ts.map +1 -0
  60. package/Models/TypeScript/Models/ServiceOperation.js +222 -0
  61. package/Models/TypeScript/Models/ServiceOperation.js.map +1 -0
  62. package/Models/TypeScript/Models/ServiceOperationVariant.d.ts +26 -0
  63. package/Models/TypeScript/Models/ServiceOperationVariant.d.ts.map +1 -0
  64. package/Models/TypeScript/Models/ServiceOperationVariant.js +82 -0
  65. package/Models/TypeScript/Models/ServiceOperationVariant.js.map +1 -0
  66. package/Models/TypeScript/Models/ServiceParameter.d.ts +19 -0
  67. package/Models/TypeScript/Models/ServiceParameter.d.ts.map +1 -0
  68. package/Models/TypeScript/Models/ServiceParameter.js +34 -0
  69. package/Models/TypeScript/Models/ServiceParameter.js.map +1 -0
  70. package/Models/TypeScript/Models/ServiceRequestBody.d.ts +18 -0
  71. package/Models/TypeScript/Models/ServiceRequestBody.d.ts.map +1 -0
  72. package/Models/TypeScript/Models/ServiceRequestBody.js +28 -0
  73. package/Models/TypeScript/Models/ServiceRequestBody.js.map +1 -0
  74. package/Models/TypeScript/Models/ServiceResponse.d.ts +13 -0
  75. package/Models/TypeScript/Models/ServiceResponse.d.ts.map +1 -0
  76. package/Models/TypeScript/Models/ServiceResponse.js +25 -0
  77. package/Models/TypeScript/Models/ServiceResponse.js.map +1 -0
  78. package/Models/TypeScript/Models/ServiceSecurity.d.ts +18 -0
  79. package/Models/TypeScript/Models/ServiceSecurity.d.ts.map +1 -0
  80. package/Models/TypeScript/Models/ServiceSecurity.js +33 -0
  81. package/Models/TypeScript/Models/ServiceSecurity.js.map +1 -0
  82. package/Models/TypeScript/TemplateType.d.ts +33 -0
  83. package/Models/TypeScript/TemplateType.d.ts.map +1 -0
  84. package/Models/TypeScript/TemplateType.js +39 -0
  85. package/Models/TypeScript/TemplateType.js.map +1 -0
  86. package/Models/TypeScript/Utils.d.ts +65 -0
  87. package/Models/TypeScript/Utils.d.ts.map +1 -0
  88. package/Models/TypeScript/Utils.js +274 -0
  89. package/Models/TypeScript/Utils.js.map +1 -0
  90. package/Services/OpenApiParser.d.ts +47 -0
  91. package/Services/OpenApiParser.d.ts.map +1 -0
  92. package/Services/OpenApiParser.js +192 -0
  93. package/Services/OpenApiParser.js.map +1 -0
  94. package/Services/TemplateBuilder.d.ts +53 -0
  95. package/Services/TemplateBuilder.d.ts.map +1 -0
  96. package/Services/TemplateBuilder.js +105 -0
  97. package/Services/TemplateBuilder.js.map +1 -0
  98. package/Services/TemplateEngine.d.ts +40 -0
  99. package/Services/TemplateEngine.d.ts.map +1 -0
  100. package/Services/TemplateEngine.js +105 -0
  101. package/Services/TemplateEngine.js.map +1 -0
  102. package/package.json +23 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceSecurity.js","sourceRoot":"","sources":["../../../../src/Models/TypeScript/Models/ServiceSecurity.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAIlB,0CAAqD;AAGrD,aAAa;AAEb;;;;GAIG;AACH,MAAa,eAAe;IAExB,eAAe;IAEf,YAAmB,GAAW,EAAE,IAA0B,EAAE,KAAoB,EAAE,OAAqC;QACnH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,IAAA,qBAAU,EAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,QAAQ,CAAC;QAC9B,4CAA4C;IAChD,CAAC;IAED,aAAa;IAEb,oBAAoB;IAEb,IAAI,CAAuB;IAC3B,KAAK,GAAkB,EAAE,CAAC;IAC1B,GAAG,CAAS;IACZ,IAAI,CAAS;IACb,QAAQ,CAAgB;IACxB,EAAE,CAAS;CAKrB;AA5BD,0CA4BC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Template types enum.
3
+ *
4
+ * @public
5
+ */
6
+ export declare enum TemplateType {
7
+ None = "",
8
+ /**
9
+ * Class template.
10
+ */
11
+ Class = "class",
12
+ /**
13
+ * Interface template.
14
+ */
15
+ Interface = "interface",
16
+ /**
17
+ * Enum template.
18
+ */
19
+ Enum = "enum",
20
+ /**
21
+ * Type template.
22
+ */
23
+ Type = "type",
24
+ /**
25
+ * Service template.
26
+ */
27
+ Service = "service",
28
+ /**
29
+ * Index template.
30
+ */
31
+ Index = "index"
32
+ }
33
+ //# sourceMappingURL=TemplateType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateType.d.ts","sourceRoot":"","sources":["../../../src/Models/TypeScript/TemplateType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,YAAY;IACpB,IAAI,KAAK;IAET;;OAEG;IACH,KAAK,UAAU;IAEf;;OAEG;IACH,SAAS,cAAc;IAEvB;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,IAAI,SAAS;IAEb;;OAEG;IACH,OAAO,YAAY;IAEnB;;OAEG;IACH,KAAK,UAAU;CAIlB"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateType = void 0;
4
+ /**
5
+ * Template types enum.
6
+ *
7
+ * @public
8
+ */
9
+ var TemplateType;
10
+ (function (TemplateType) {
11
+ TemplateType["None"] = "";
12
+ /**
13
+ * Class template.
14
+ */
15
+ TemplateType["Class"] = "class";
16
+ /**
17
+ * Interface template.
18
+ */
19
+ TemplateType["Interface"] = "interface";
20
+ /**
21
+ * Enum template.
22
+ */
23
+ TemplateType["Enum"] = "enum";
24
+ /**
25
+ * Type template.
26
+ */
27
+ TemplateType["Type"] = "type";
28
+ /**
29
+ * Service template.
30
+ */
31
+ TemplateType["Service"] = "service";
32
+ /**
33
+ * Index template.
34
+ */
35
+ TemplateType["Index"] = "index";
36
+ // todo: add new ngrx templtes here...
37
+ // store, actions, reducers, whatever
38
+ })(TemplateType || (exports.TemplateType = TemplateType = {}));
39
+ //# sourceMappingURL=TemplateType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TemplateType.js","sourceRoot":"","sources":["../../../src/Models/TypeScript/TemplateType.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,YAmCX;AAnCD,WAAY,YAAY;IACpB,yBAAS,CAAA;IAET;;OAEG;IACH,+BAAe,CAAA;IAEf;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,6BAAa,CAAA;IAEb;;OAEG;IACH,6BAAa,CAAA;IAEb;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,+BAAe,CAAA;IAEf,sCAAsC;IACtC,qCAAqC;AACzC,CAAC,EAnCW,YAAY,4BAAZ,YAAY,QAmCvB"}
@@ -0,0 +1,65 @@
1
+ import type { OpenAPIObject, ReferenceObject, SchemaObject } from 'openapi3-ts/oas30';
2
+ import type { ITypeScriptOptions } from './Interfaces/ITypeScriptOptions.js';
3
+ /**
4
+ * Returns the simple name, that is, the last part after '/'
5
+ */
6
+ export declare function simpleName(name: string): string;
7
+ /**
8
+ * Returns the unqualified model class name, that is, the last part after '.'
9
+ */
10
+ export declare function unqualifiedName(name: string, options: ITypeScriptOptions): string;
11
+ /**
12
+ * Returns the qualified model class name, that is, the camelized namespace (if any) plus the unqualified name
13
+ */
14
+ export declare function qualifiedName(name: string, options: ITypeScriptOptions): string;
15
+ /**
16
+ * Returns the namespace path, that is, the part before the last '.' splitted by '/' instead of '.'.
17
+ * If there's no namespace, returns undefined.
18
+ */
19
+ export declare function namespace(name: string): string | undefined;
20
+ /**
21
+ * Returns the type (class) name for a given regular name
22
+ */
23
+ export declare function typeName(name: string): string;
24
+ /**
25
+ * Returns a suitable method name for the given name
26
+ * @param name The raw name
27
+ */
28
+ export declare function methodName(name: string): string;
29
+ /**
30
+ * Returns a suitable property name for the given name
31
+ * @param name The raw name
32
+ */
33
+ export declare function propertyName(name: string): string;
34
+ /**
35
+ * Returns the file name for a given type name
36
+ */
37
+ export declare function fileName(text: string): string;
38
+ /**
39
+ * Converts a text to a basic, letters / numbers / underscore representation.
40
+ * When firstNonDigit is true, prepends the result with an uderscore if the first char is a digit.
41
+ */
42
+ export declare function toBasicChars(text: string, firstNonDigit?: boolean): string;
43
+ /**
44
+ * Returns the TypeScript comments for the given schema description, in a given indentation level
45
+ */
46
+ export declare function tsComments(description: string, deprecated?: boolean): Array<string>;
47
+ /**
48
+ * Returns the TypeScript type for the given type and options
49
+ */
50
+ export declare function tsType(schemaOrRef: SchemaObject | ReferenceObject | undefined, options: ITypeScriptOptions): string;
51
+ /**
52
+ * Resolves a reference
53
+ * @param ref The reference name, such as #/components/schemas/Name, or just Name
54
+ */
55
+ export declare function resolveRef(openApi: OpenAPIObject, ref: string): any;
56
+ /**
57
+ * Synchronizes the files from the source to the target directory. Optionally remove stale files.
58
+ */
59
+ export declare function syncDirs(srcDir: string, destDir: string, removeStale: boolean): any;
60
+ /**
61
+ * Escapes the name of a property / parameter if not valid JS identifier
62
+ */
63
+ export declare function escapeId(name: string): string;
64
+ export declare function tryGetEnumNames(schema: SchemaObject): Array<string> | null;
65
+ //# sourceMappingURL=Utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/Models/TypeScript/Utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAYjF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBA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+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.simpleName = simpleName;
7
+ exports.unqualifiedName = unqualifiedName;
8
+ exports.qualifiedName = qualifiedName;
9
+ exports.namespace = namespace;
10
+ exports.typeName = typeName;
11
+ exports.methodName = methodName;
12
+ exports.propertyName = propertyName;
13
+ exports.fileName = fileName;
14
+ exports.toBasicChars = toBasicChars;
15
+ exports.tsComments = tsComments;
16
+ exports.tsType = tsType;
17
+ exports.resolveRef = resolveRef;
18
+ exports.syncDirs = syncDirs;
19
+ exports.escapeId = escapeId;
20
+ exports.tryGetEnumNames = tryGetEnumNames;
21
+ /* eslint-disable complexity */
22
+ const utilities_1 = require("@breadstone-infrastructure/utilities");
23
+ const fs_extra_1 = __importDefault(require("fs-extra"));
24
+ const jsesc_1 = __importDefault(require("jsesc"));
25
+ const es_toolkit_1 = require("es-toolkit");
26
+ /**
27
+ * Returns the simple name, that is, the last part after '/'
28
+ */
29
+ function simpleName(name) {
30
+ const pos = name.lastIndexOf('/');
31
+ return name.substring(pos + 1);
32
+ }
33
+ /**
34
+ * Returns the unqualified model class name, that is, the last part after '.'
35
+ */
36
+ function unqualifiedName(name, options) {
37
+ const pos = name.lastIndexOf('.');
38
+ name = name.substring(pos + 1);
39
+ // TODO
40
+ // This musst be dynmaic by symantic type.
41
+ // only the symantic type can be decide with 'NamingConvention' should be used.
42
+ if (options.modelNamingConvention.replace) {
43
+ name = name.replace(options.modelNamingConvention.replace.regex, options.modelNamingConvention.replace.value);
44
+ }
45
+ return `${options.modelNamingConvention.prefix ?? ''}${typeName(name)}${options.modelNamingConvention.suffix ?? ''}`;
46
+ }
47
+ /**
48
+ * Returns the qualified model class name, that is, the camelized namespace (if any) plus the unqualified name
49
+ */
50
+ function qualifiedName(name, options) {
51
+ const ns = namespace(name);
52
+ const unq = unqualifiedName(name, options);
53
+ return ns ? typeName(ns) + unq : unq;
54
+ }
55
+ /**
56
+ * Returns the namespace path, that is, the part before the last '.' splitted by '/' instead of '.'.
57
+ * If there's no namespace, returns undefined.
58
+ */
59
+ function namespace(name) {
60
+ name = name.replace(/^\.+/g, '');
61
+ name = name.replace(/\.+$/g, '');
62
+ const pos = name.lastIndexOf('.');
63
+ return pos < 0 ? undefined : name.substring(0, pos).replace('.', '/');
64
+ }
65
+ /**
66
+ * Returns the type (class) name for a given regular name
67
+ */
68
+ function typeName(name) {
69
+ return utilities_1.StringExtensions.firstCharToUpperCase(methodName(name));
70
+ }
71
+ /**
72
+ * Returns a suitable method name for the given name
73
+ * @param name The raw name
74
+ */
75
+ function methodName(name) {
76
+ return utilities_1.StringExtensions.toCamelCase(toBasicChars(name, true));
77
+ }
78
+ /**
79
+ * Returns a suitable property name for the given name
80
+ * @param name The raw name
81
+ */
82
+ function propertyName(name) {
83
+ return utilities_1.StringExtensions.toCamelCase(toBasicChars(name, true));
84
+ }
85
+ /**
86
+ * Returns the file name for a given type name
87
+ */
88
+ function fileName(text) {
89
+ return toBasicChars(text);
90
+ }
91
+ /**
92
+ * Converts a text to a basic, letters / numbers / underscore representation.
93
+ * When firstNonDigit is true, prepends the result with an uderscore if the first char is a digit.
94
+ */
95
+ function toBasicChars(text, firstNonDigit = false) {
96
+ text = (0, es_toolkit_1.deburr)((text || '').trim());
97
+ text = text.replace(/[^\w]+/g, '_');
98
+ if (firstNonDigit && (/[0-9]/).test(text.charAt(0))) {
99
+ text = `_${text}`;
100
+ }
101
+ return text;
102
+ }
103
+ /**
104
+ * Returns the TypeScript comments for the given schema description, in a given indentation level
105
+ */
106
+ function tsComments(description, deprecated) {
107
+ const lines = description.trim().split('\n');
108
+ if (deprecated) {
109
+ lines.push('@deprecated');
110
+ }
111
+ return lines;
112
+ }
113
+ /**
114
+ * Returns the TypeScript type for the given type and options
115
+ */
116
+ function tsType(schemaOrRef, options) {
117
+ if (schemaOrRef && schemaOrRef.nullable) {
118
+ return `null | ${toType(schemaOrRef, options)}`;
119
+ }
120
+ return toType(schemaOrRef, options);
121
+ }
122
+ function toType(schemaOrRef, options) {
123
+ if (!schemaOrRef) {
124
+ // No schema
125
+ return 'any';
126
+ }
127
+ if ('$ref' in schemaOrRef) {
128
+ // A reference
129
+ return qualifiedName(simpleName(schemaOrRef.$ref), options);
130
+ }
131
+ const schema = schemaOrRef;
132
+ // An union of types
133
+ const union = schema.oneOf ?? schema.anyOf ?? [];
134
+ if (union.length > 0) {
135
+ return union.map((u) => toType(u, options)).join(' | ');
136
+ }
137
+ // All the types
138
+ const allOf = schema.allOf ?? [];
139
+ if (allOf.length > 0) {
140
+ return allOf.map((u) => toType(u, options)).join(' & ');
141
+ }
142
+ const type = schema.type ?? 'any';
143
+ // A array of types
144
+ if (Array.isArray(type)) {
145
+ return type.map((t) => toType({ type: t }, options)).join(' | ');
146
+ }
147
+ // An array
148
+ if (type === 'array' || schema.items) {
149
+ return `Array<${toType(schema.items ?? {}, options)}>`;
150
+ }
151
+ // An object
152
+ if (type === 'object' || schema.properties) {
153
+ let result = '{ ';
154
+ let isFirst = true;
155
+ const properties = schema.properties ?? {};
156
+ const required = schema.required;
157
+ for (const propName of Object.keys(properties)) {
158
+ const property = properties[propName];
159
+ const isPropRequired = required?.includes(propName);
160
+ if (isFirst) {
161
+ isFirst = false;
162
+ }
163
+ else {
164
+ result += ', ';
165
+ }
166
+ result += `'${propName}'`;
167
+ if (!isPropRequired) {
168
+ result += '?';
169
+ }
170
+ result += `: ${toType(property, options)}`;
171
+ }
172
+ if (schema.additionalProperties) {
173
+ const additionalProperties = schema.additionalProperties === true ? {} : schema.additionalProperties;
174
+ if (!isFirst) {
175
+ result += ', ';
176
+ }
177
+ result += `[key: string]: ${toType(additionalProperties, options)}`;
178
+ }
179
+ result += ' }';
180
+ // handle empty object
181
+ if (result === '{ }') {
182
+ return 'object';
183
+ }
184
+ return result;
185
+ }
186
+ // Inline enum
187
+ const enumValues = schema.enum ?? [];
188
+ if (enumValues.length > 0) {
189
+ if (type === 'number' || type === 'integer') {
190
+ return enumValues.join(' | ');
191
+ }
192
+ return enumValues.map((v) => `'${(0, jsesc_1.default)(v)}'`).join(' | ');
193
+ }
194
+ // A Blob
195
+ if (type === 'string' && schema.format === 'binary') {
196
+ return 'Blob';
197
+ }
198
+ // A simple type
199
+ return type === 'integer' ? 'number' : type;
200
+ }
201
+ /**
202
+ * Resolves a reference
203
+ * @param ref The reference name, such as #/components/schemas/Name, or just Name
204
+ */
205
+ function resolveRef(openApi, ref) {
206
+ if (!ref.includes('/')) {
207
+ ref = `#/components/schemas/${ref}`;
208
+ }
209
+ let current = null;
210
+ for (let part of ref.split('/')) {
211
+ part = part.trim();
212
+ if (part === '#' || part === '') {
213
+ current = openApi;
214
+ }
215
+ else if (current === null) {
216
+ break;
217
+ }
218
+ else {
219
+ current = current[part];
220
+ }
221
+ }
222
+ if (current === null || typeof current !== 'object') {
223
+ throw new Error(`Couldn't resolve reference ${ref}`);
224
+ }
225
+ return current;
226
+ }
227
+ /**
228
+ * Synchronizes the files from the source to the target directory. Optionally remove stale files.
229
+ */
230
+ function syncDirs(srcDir, destDir, removeStale) {
231
+ fs_extra_1.default.ensureDirSync(destDir);
232
+ const srcFiles = fs_extra_1.default.readdirSync(srcDir);
233
+ const destFiles = fs_extra_1.default.readdirSync(destDir);
234
+ for (const file of srcFiles) {
235
+ const srcFile = utilities_1.Path.combine(srcDir, file);
236
+ const destFile = utilities_1.Path.combine(destDir, file);
237
+ if (fs_extra_1.default.lstatSync(srcFile).isDirectory()) {
238
+ // A directory: recursively sync
239
+ syncDirs(srcFile, destFile, removeStale);
240
+ }
241
+ else {
242
+ // Read the content of both files and update if they differ
243
+ const srcContent = utilities_1.File.readAllText(srcFile);
244
+ const destContent = utilities_1.File.exists(destFile) ? utilities_1.File.readAllText(destFile) : null;
245
+ if (srcContent !== destContent) {
246
+ utilities_1.File.writeAllText(destFile, srcContent);
247
+ console.debug(`Wrote ${destFile}`);
248
+ }
249
+ }
250
+ }
251
+ if (removeStale) {
252
+ for (const file of destFiles) {
253
+ const srcFile = utilities_1.Path.combine(srcDir, file);
254
+ const destFile = utilities_1.Path.combine(destDir, file);
255
+ if (!utilities_1.File.exists(srcFile)) {
256
+ fs_extra_1.default.unlinkSync(destFile);
257
+ console.debug(`Removed stale file ${destFile}`);
258
+ }
259
+ }
260
+ }
261
+ }
262
+ /**
263
+ * Escapes the name of a property / parameter if not valid JS identifier
264
+ */
265
+ function escapeId(name) {
266
+ if ((/^[a-zA-Z]\w+$/).test(name)) {
267
+ return name;
268
+ }
269
+ return `'${name.replace(/\'/g, '\\\'')}'`;
270
+ }
271
+ function tryGetEnumNames(schema) {
272
+ return (schema['x-enum-varnames'] ?? schema['x-enum-names'] ?? schema['x-extensible-enum']) ?? null;
273
+ }
274
+ //# sourceMappingURL=Utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/Models/TypeScript/Utils.ts"],"names":[],"mappings":";;;;;AAWA,gCAGC;AAKD,0CAYC;AAKD,sCAIC;AAMD,8BAKC;AAKD,4BAEC;AAMD,gCAEC;AAMD,oCAEC;AAKD,4BAEC;AAMD,oCAOC;AAKD,gCAOC;AAKD,wBAKC;AAiGD,gCAmBC;AAKD,4BA8BC;AAKD,4BAKC;AAED,0CAEC;AAzRD,+BAA+B;AAC/B,oEAAoF;AACpF,wDAA0B;AAC1B,kDAA0B;AAC1B,2CAAoC;AAIpC;;GAEG;AACH,SAAgB,UAAU,CAAC,IAAY;IACnC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,OAA2B;IACrE,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC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;IAChD,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC,IAAI,IAAI,CAAC;AACxG,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { type ILogger } from '@breadstone-infrastructure/utilities';
2
+ import { type ITypeScriptOptions } from '../Models/TypeScript/Interfaces/ITypeScriptOptions.js';
3
+ import type { Symantic } from '../Models/TypeScript/Models/Abstracts/Symantic.js';
4
+ export declare const HTTP_METHODS: string[];
5
+ /**
6
+ * @public
7
+ */
8
+ export interface IOpenApiParserConfig {
9
+ emoji: boolean;
10
+ debug: boolean;
11
+ fetchTimeout?: number;
12
+ }
13
+ /**
14
+ * A OpenApi parser.
15
+ * @public
16
+ */
17
+ export declare class OpenApiParser {
18
+ private readonly _logger;
19
+ private readonly _config;
20
+ /**
21
+ * Constructs a new instance of the `OpenApiParser` class.
22
+ *
23
+ * @public
24
+ */
25
+ constructor(logger: ILogger, config: IOpenApiParserConfig);
26
+ /**
27
+ * @public
28
+ * @param path - The path or url of the schema json file.
29
+ */
30
+ parse(path: string, options?: Required<ITypeScriptOptions>): Promise<Array<Symantic>>;
31
+ /**
32
+ * @private
33
+ * @param openApi
34
+ */
35
+ private parseModels;
36
+ /**
37
+ * @private
38
+ * @param openApi - The open api object.
39
+ */
40
+ private parseServices;
41
+ /**
42
+ * @private
43
+ * @param openApi - The open api object.
44
+ */
45
+ private parseOpenApiInfo;
46
+ }
47
+ //# sourceMappingURL=OpenApiParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpenApiParser.d.ts","sourceRoot":"","sources":["../../src/Services/OpenApiParser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAA6B,MAAM,sCAAsC,CAAC;AAI/F,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC1H,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mDAAmD,CAAC;AAQlF,eAAO,MAAM,YAAY,UAAwE,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;IAM/C;;;;OAIG;gBACgB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB;IAShE;;;OAGG;IACU,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,QAAQ,CAAC,kBAAkB,CAA4B,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAqC5H;;;OAGG;IACH,OAAO,CAAC,WAAW;IAmBnB;;;OAGG;IACH,OAAO,CAAC,aAAa;IA4ErB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;CA2B3B"}