swagger-typescript-api 13.3.1 → 13.5.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/dist/chunk-CfYAbeIz.mjs +13 -0
- package/dist/cli.cjs +14 -16
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +3 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +11 -22
- package/dist/index.d.cts +5 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -12
- package/dist/{generate-templates-CAvEodGO.cjs → src-CIiQTFUj.cjs} +108 -132
- package/dist/src-CIiQTFUj.cjs.map +1 -0
- package/dist/{generate-templates-P84KxC-K.mjs → src-eXqnNGnl.mjs} +39 -54
- package/dist/src-eXqnNGnl.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/chunk-DQk6qfdC.mjs +0 -18
- package/dist/generate-templates-CAvEodGO.cjs.map +0 -1
- package/dist/generate-templates-P84KxC-K.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { consola as consola$1 } from "consola";
|
|
3
|
-
|
|
4
|
-
//#region src/index.ts
|
|
5
|
-
async function generateApi(config) {
|
|
6
|
-
if (config.debug) consola$1.level = Number.MAX_SAFE_INTEGER;
|
|
7
|
-
if (config.silent) consola$1.level = 0;
|
|
8
|
-
return await new CodeGenProcess(config).start();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
1
|
+
import { a as SCHEMA_TYPES, c as constants_exports, i as RequestContentKind, n as generateTemplates, t as generateApi } from "./src-eXqnNGnl.mjs";
|
|
12
2
|
export { RequestContentKind, SCHEMA_TYPES, constants_exports as constants, generateApi, generateTemplates };
|
|
13
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -7,28 +7,20 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __exportAll = (all, no_symbols) => {
|
|
9
9
|
let target = {};
|
|
10
|
-
for (var name in all) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
if (!no_symbols) {
|
|
17
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
}
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
15
|
return target;
|
|
20
16
|
};
|
|
21
17
|
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
+
key = keys[i];
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: ((k) => from[k]).bind(null, key),
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
32
24
|
}
|
|
33
25
|
return to;
|
|
34
26
|
};
|
|
@@ -36,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
36
28
|
value: mod,
|
|
37
29
|
enumerable: true
|
|
38
30
|
}) : target, mod));
|
|
39
|
-
|
|
40
31
|
//#endregion
|
|
41
32
|
let consola = require("consola");
|
|
42
33
|
consola = __toESM(consola);
|
|
@@ -67,7 +58,6 @@ node_module = __toESM(node_module);
|
|
|
67
58
|
let node_url = require("node:url");
|
|
68
59
|
node_url = __toESM(node_url);
|
|
69
60
|
let eta = require("eta");
|
|
70
|
-
|
|
71
61
|
//#region src/code-formatter.ts
|
|
72
62
|
var CodeFormatter = class {
|
|
73
63
|
config;
|
|
@@ -141,7 +131,6 @@ var TsLanguageServiceHost = class {
|
|
|
141
131
|
return typescript.sys.fileExists(path);
|
|
142
132
|
}
|
|
143
133
|
};
|
|
144
|
-
|
|
145
134
|
//#endregion
|
|
146
135
|
//#region src/util/name-resolver.ts
|
|
147
136
|
var NameResolver = class {
|
|
@@ -192,14 +181,12 @@ var NameResolver = class {
|
|
|
192
181
|
return null;
|
|
193
182
|
}
|
|
194
183
|
};
|
|
195
|
-
|
|
196
184
|
//#endregion
|
|
197
185
|
//#region src/util/random.ts
|
|
198
186
|
const getRandomInt = (min = 0, max = 1) => {
|
|
199
187
|
if (min === max) return min;
|
|
200
188
|
return Math.round(Math.random() * (max - min) + min);
|
|
201
189
|
};
|
|
202
|
-
|
|
203
190
|
//#endregion
|
|
204
191
|
//#region src/component-type-name-resolver.ts
|
|
205
192
|
var ComponentTypeNameResolver = class extends NameResolver {
|
|
@@ -223,13 +210,11 @@ var ComponentTypeNameResolver = class extends NameResolver {
|
|
|
223
210
|
});
|
|
224
211
|
}
|
|
225
212
|
};
|
|
226
|
-
|
|
227
213
|
//#endregion
|
|
228
214
|
//#region package.json
|
|
229
215
|
var name = "swagger-typescript-api";
|
|
230
|
-
var version = "13.
|
|
216
|
+
var version = "13.5.0";
|
|
231
217
|
var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
|
|
232
|
-
|
|
233
218
|
//#endregion
|
|
234
219
|
//#region src/constants.ts
|
|
235
220
|
var constants_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -295,7 +280,6 @@ const SCHEMA_TYPES$1 = {
|
|
|
295
280
|
COMPLEX_NOT: "not",
|
|
296
281
|
COMPLEX_UNKNOWN: "__unknown"
|
|
297
282
|
};
|
|
298
|
-
|
|
299
283
|
//#endregion
|
|
300
284
|
//#region src/util/object-assign.ts
|
|
301
285
|
const objectAssign = (target, updater) => {
|
|
@@ -306,7 +290,6 @@ const objectAssign = (target, updater) => {
|
|
|
306
290
|
(0, es_toolkit.merge)(target, update);
|
|
307
291
|
for (const key of undefinedKeys) target[key] = void 0;
|
|
308
292
|
};
|
|
309
|
-
|
|
310
293
|
//#endregion
|
|
311
294
|
//#region src/configuration.ts
|
|
312
295
|
const TsKeyword = {
|
|
@@ -320,6 +303,7 @@ const TsKeyword = {
|
|
|
320
303
|
Undefined: "undefined",
|
|
321
304
|
Object: "object",
|
|
322
305
|
File: "File",
|
|
306
|
+
Blob: "Blob",
|
|
323
307
|
Date: "Date",
|
|
324
308
|
Type: "type",
|
|
325
309
|
Enum: "enum",
|
|
@@ -555,6 +539,7 @@ var CodeGenConfig = class {
|
|
|
555
539
|
string: {
|
|
556
540
|
$default: this.Ts.Keyword.String,
|
|
557
541
|
binary: () => this.Ts.Keyword.File,
|
|
542
|
+
byte: () => this.Ts.Keyword.Blob,
|
|
558
543
|
file: () => this.Ts.Keyword.File,
|
|
559
544
|
"date-time": () => this.Ts.Keyword.String,
|
|
560
545
|
time: () => this.Ts.Keyword.String,
|
|
@@ -643,13 +628,11 @@ var CodeGenConfig = class {
|
|
|
643
628
|
if (this.enumNamesAsValues) this.extractEnums = true;
|
|
644
629
|
};
|
|
645
630
|
};
|
|
646
|
-
|
|
647
631
|
//#endregion
|
|
648
632
|
//#region src/util/pascal-case.ts
|
|
649
633
|
function pascalCase(value) {
|
|
650
634
|
return (0, es_toolkit_compat.upperFirst)((0, es_toolkit_compat.camelCase)(value));
|
|
651
635
|
}
|
|
652
|
-
|
|
653
636
|
//#endregion
|
|
654
637
|
//#region src/schema-components-map.ts
|
|
655
638
|
var SchemaComponentsMap = class {
|
|
@@ -726,7 +709,6 @@ var SchemaComponentsMap = class {
|
|
|
726
709
|
});
|
|
727
710
|
}
|
|
728
711
|
};
|
|
729
|
-
|
|
730
712
|
//#endregion
|
|
731
713
|
//#region src/schema-parser/schema-formatters.ts
|
|
732
714
|
var SchemaFormatters = class {
|
|
@@ -817,7 +799,6 @@ var SchemaFormatters = class {
|
|
|
817
799
|
return fields.join("");
|
|
818
800
|
};
|
|
819
801
|
};
|
|
820
|
-
|
|
821
802
|
//#endregion
|
|
822
803
|
//#region src/util/sort-by-property.ts
|
|
823
804
|
const sortByProperty = (propertyName) => (o1, o2) => {
|
|
@@ -825,7 +806,6 @@ const sortByProperty = (propertyName) => (o1, o2) => {
|
|
|
825
806
|
if (o1[propertyName] < o2[propertyName]) return -1;
|
|
826
807
|
return 0;
|
|
827
808
|
};
|
|
828
|
-
|
|
829
809
|
//#endregion
|
|
830
810
|
//#region src/schema-parser/mono-schema-parser.ts
|
|
831
811
|
var MonoSchemaParser = class {
|
|
@@ -858,7 +838,6 @@ var MonoSchemaParser = class {
|
|
|
858
838
|
return this.schemaUtils.buildTypeNameFromPath(this.schemaPath);
|
|
859
839
|
};
|
|
860
840
|
};
|
|
861
|
-
|
|
862
841
|
//#endregion
|
|
863
842
|
//#region src/schema-parser/base-schema-parsers/array.ts
|
|
864
843
|
var ArraySchemaParser = class extends MonoSchemaParser {
|
|
@@ -892,7 +871,6 @@ var ArraySchemaParser = class extends MonoSchemaParser {
|
|
|
892
871
|
};
|
|
893
872
|
}
|
|
894
873
|
};
|
|
895
|
-
|
|
896
874
|
//#endregion
|
|
897
875
|
//#region src/schema-parser/base-schema-parsers/complex.ts
|
|
898
876
|
var ComplexSchemaParser = class extends MonoSchemaParser {
|
|
@@ -916,7 +894,6 @@ var ComplexSchemaParser = class extends MonoSchemaParser {
|
|
|
916
894
|
};
|
|
917
895
|
}
|
|
918
896
|
};
|
|
919
|
-
|
|
920
897
|
//#endregion
|
|
921
898
|
//#region src/schema-parser/base-schema-parsers/discriminator.ts
|
|
922
899
|
var DiscriminatorSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1084,7 +1061,6 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
|
|
|
1084
1061
|
return { content: ts.ExpressionGroup(this.schemaParser._complexSchemaParsers[complexType](this.schema)) };
|
|
1085
1062
|
};
|
|
1086
1063
|
};
|
|
1087
|
-
|
|
1088
1064
|
//#endregion
|
|
1089
1065
|
//#region src/schema-parser/util/enum-key-resolver.ts
|
|
1090
1066
|
var EnumKeyResolver = class extends NameResolver {
|
|
@@ -1097,7 +1073,6 @@ var EnumKeyResolver = class extends NameResolver {
|
|
|
1097
1073
|
});
|
|
1098
1074
|
}
|
|
1099
1075
|
};
|
|
1100
|
-
|
|
1101
1076
|
//#endregion
|
|
1102
1077
|
//#region src/schema-parser/base-schema-parsers/enum.ts
|
|
1103
1078
|
var EnumSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1199,7 +1174,6 @@ var EnumSchemaParser = class extends MonoSchemaParser {
|
|
|
1199
1174
|
return this.enumKeyResolver.resolve([formatted]);
|
|
1200
1175
|
};
|
|
1201
1176
|
};
|
|
1202
|
-
|
|
1203
1177
|
//#endregion
|
|
1204
1178
|
//#region src/schema-parser/base-schema-parsers/object.ts
|
|
1205
1179
|
var ObjectSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1268,7 +1242,6 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
|
|
|
1268
1242
|
return propertiesContent;
|
|
1269
1243
|
};
|
|
1270
1244
|
};
|
|
1271
|
-
|
|
1272
1245
|
//#endregion
|
|
1273
1246
|
//#region src/schema-parser/base-schema-parsers/primitive.ts
|
|
1274
1247
|
var PrimitiveSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1289,7 +1262,8 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
|
|
|
1289
1262
|
schemaPath: this.schemaPath
|
|
1290
1263
|
}).getInlineParseContent();
|
|
1291
1264
|
else recordValuesContent = this.config.Ts.Keyword.Any;
|
|
1292
|
-
|
|
1265
|
+
const recordType = this.config.Ts.RecordType(recordKeysContent, recordValuesContent);
|
|
1266
|
+
contentType = propertyNamesSchema ? this.config.Ts.TypeWithGeneric("Partial", [recordType]) : recordType;
|
|
1293
1267
|
}
|
|
1294
1268
|
if (Array.isArray(type) && type.length) contentType = this.schemaParser._complexSchemaParsers.oneOf({
|
|
1295
1269
|
...typeof this.schema === "object" ? this.schema : {},
|
|
@@ -1317,7 +1291,6 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
|
|
|
1317
1291
|
};
|
|
1318
1292
|
}
|
|
1319
1293
|
};
|
|
1320
|
-
|
|
1321
1294
|
//#endregion
|
|
1322
1295
|
//#region src/schema-parser/complex-schema-parsers/all-of.ts
|
|
1323
1296
|
var AllOfSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1329,7 +1302,6 @@ var AllOfSchemaParser = class extends MonoSchemaParser {
|
|
|
1329
1302
|
return this.schemaUtils.safeAddNullToType(this.schema, type);
|
|
1330
1303
|
}
|
|
1331
1304
|
};
|
|
1332
|
-
|
|
1333
1305
|
//#endregion
|
|
1334
1306
|
//#region src/schema-parser/complex-schema-parsers/any-of.ts
|
|
1335
1307
|
var AnyOfSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1341,7 +1313,6 @@ var AnyOfSchemaParser = class extends MonoSchemaParser {
|
|
|
1341
1313
|
return this.schemaUtils.safeAddNullToType(this.schema, type);
|
|
1342
1314
|
}
|
|
1343
1315
|
};
|
|
1344
|
-
|
|
1345
1316
|
//#endregion
|
|
1346
1317
|
//#region src/schema-parser/complex-schema-parsers/not.ts
|
|
1347
1318
|
var NotSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1349,7 +1320,6 @@ var NotSchemaParser = class extends MonoSchemaParser {
|
|
|
1349
1320
|
return this.config.Ts.Keyword.Any;
|
|
1350
1321
|
}
|
|
1351
1322
|
};
|
|
1352
|
-
|
|
1353
1323
|
//#endregion
|
|
1354
1324
|
//#region src/schema-parser/complex-schema-parsers/one-of.ts
|
|
1355
1325
|
var OneOfSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1361,7 +1331,6 @@ var OneOfSchemaParser = class extends MonoSchemaParser {
|
|
|
1361
1331
|
return this.schemaUtils.safeAddNullToType(this.schema, type);
|
|
1362
1332
|
}
|
|
1363
1333
|
};
|
|
1364
|
-
|
|
1365
1334
|
//#endregion
|
|
1366
1335
|
//#region src/schema-parser/schema-parser.ts
|
|
1367
1336
|
var SchemaParser = class {
|
|
@@ -1474,7 +1443,6 @@ var SchemaParser = class {
|
|
|
1474
1443
|
};
|
|
1475
1444
|
};
|
|
1476
1445
|
};
|
|
1477
|
-
|
|
1478
1446
|
//#endregion
|
|
1479
1447
|
//#region src/schema-parser/schema-utils.ts
|
|
1480
1448
|
var SchemaUtils = class {
|
|
@@ -1483,6 +1451,22 @@ var SchemaUtils = class {
|
|
|
1483
1451
|
this.schemaComponentsMap = schemaComponentsMap;
|
|
1484
1452
|
this.typeNameFormatter = typeNameFormatter;
|
|
1485
1453
|
}
|
|
1454
|
+
isBinaryLikeContentMediaType = (contentMediaType) => {
|
|
1455
|
+
if (typeof contentMediaType !== "string" || !contentMediaType) return false;
|
|
1456
|
+
const mediaType = contentMediaType.split(";")[0]?.trim().toLowerCase();
|
|
1457
|
+
if (!mediaType) return false;
|
|
1458
|
+
/**
|
|
1459
|
+
* `contentMediaType` comes from JSON Schema. In practice it is often used to
|
|
1460
|
+
* signal "this string is a file/blob", but it may also be used for textual
|
|
1461
|
+
* payloads (json/xml/etc). We treat only binary-ish media types as `File`.
|
|
1462
|
+
*/
|
|
1463
|
+
if (mediaType.startsWith("text/")) return false;
|
|
1464
|
+
if (mediaType.includes("json") || mediaType.includes("+json")) return false;
|
|
1465
|
+
if (mediaType.includes("xml") || mediaType.includes("+xml")) return false;
|
|
1466
|
+
if (mediaType === "application/x-www-form-urlencoded") return false;
|
|
1467
|
+
if (mediaType === "application/javascript" || mediaType === "application/ecmascript" || mediaType === "application/graphql" || mediaType === "application/yaml" || mediaType === "application/x-yaml") return false;
|
|
1468
|
+
return mediaType === "application/octet-stream" || mediaType.startsWith("image/") || mediaType.startsWith("audio/") || mediaType.startsWith("video/") || mediaType.startsWith("font/") || mediaType.startsWith("model/") || mediaType.startsWith("application/");
|
|
1469
|
+
};
|
|
1486
1470
|
getRequiredProperties = (schema) => {
|
|
1487
1471
|
return (0, es_toolkit.uniq)(schema && Array.isArray(schema.required) && schema.required || []);
|
|
1488
1472
|
};
|
|
@@ -1591,9 +1575,12 @@ var SchemaUtils = class {
|
|
|
1591
1575
|
else {
|
|
1592
1576
|
const primitiveType = this.getSchemaPrimitiveType(schema);
|
|
1593
1577
|
if (primitiveType == null) return this.config.Ts.Keyword.Any;
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1578
|
+
if (primitiveType === this.config.Ts.Keyword.String && !schema.format && this.isBinaryLikeContentMediaType(schema.contentMediaType)) resultType = this.config.Ts.UnionType([this.config.Ts.Keyword.File, this.config.Ts.Keyword.Blob]);
|
|
1579
|
+
else {
|
|
1580
|
+
const typeAlias = (0, es_toolkit_compat.get)(this.config.primitiveTypes, [primitiveType, schema.format]) || (0, es_toolkit_compat.get)(this.config.primitiveTypes, [primitiveType, "$default"]) || this.config.primitiveTypes[primitiveType];
|
|
1581
|
+
if (typeof typeAlias === "function") resultType = typeAlias(schema, this);
|
|
1582
|
+
else resultType = typeAlias || primitiveType;
|
|
1583
|
+
}
|
|
1597
1584
|
}
|
|
1598
1585
|
if (!resultType) return this.config.Ts.Keyword.Any;
|
|
1599
1586
|
return this.checkAndAddRequiredKeys(schema, this.safeAddNullToType(schema, resultType));
|
|
@@ -1617,7 +1604,6 @@ var SchemaUtils = class {
|
|
|
1617
1604
|
}
|
|
1618
1605
|
};
|
|
1619
1606
|
};
|
|
1620
|
-
|
|
1621
1607
|
//#endregion
|
|
1622
1608
|
//#region src/schema-parser/schema-parser-fabric.ts
|
|
1623
1609
|
var SchemaParserFabric = class {
|
|
@@ -1687,11 +1673,9 @@ var SchemaParserFabric = class {
|
|
|
1687
1673
|
}).getParseContent();
|
|
1688
1674
|
};
|
|
1689
1675
|
};
|
|
1690
|
-
|
|
1691
1676
|
//#endregion
|
|
1692
1677
|
//#region src/util/id.ts
|
|
1693
1678
|
const generateId = () => node_crypto.randomUUID();
|
|
1694
|
-
|
|
1695
1679
|
//#endregion
|
|
1696
1680
|
//#region src/schema-routes/util/specific-arg-name-resolver.ts
|
|
1697
1681
|
var SpecificArgNameResolver = class extends NameResolver {
|
|
@@ -1704,7 +1688,6 @@ var SpecificArgNameResolver = class extends NameResolver {
|
|
|
1704
1688
|
});
|
|
1705
1689
|
}
|
|
1706
1690
|
};
|
|
1707
|
-
|
|
1708
1691
|
//#endregion
|
|
1709
1692
|
//#region src/schema-routes/schema-routes.ts
|
|
1710
1693
|
const CONTENT_KIND = {
|
|
@@ -2027,7 +2010,7 @@ var SchemaRoutes = class {
|
|
|
2027
2010
|
if (schema && schema.typeData && !schema.typeData.description && requestBody?.description) schema.typeData.description = requestBody.description;
|
|
2028
2011
|
return {
|
|
2029
2012
|
...requestBody || {},
|
|
2030
|
-
paramName: requestBodyName || requestBody?.name ||
|
|
2013
|
+
paramName: requestBodyName || requestBody?.name || "data",
|
|
2031
2014
|
contentTypes,
|
|
2032
2015
|
contentKind,
|
|
2033
2016
|
schema,
|
|
@@ -2322,7 +2305,6 @@ var SchemaRoutes = class {
|
|
|
2322
2305
|
return routes.slice().sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
|
|
2323
2306
|
};
|
|
2324
2307
|
};
|
|
2325
|
-
|
|
2326
2308
|
//#endregion
|
|
2327
2309
|
//#region src/resolved-swagger-schema.ts
|
|
2328
2310
|
var ResolvedSwaggerSchema = class ResolvedSwaggerSchema {
|
|
@@ -2672,7 +2654,6 @@ var ResolvedSwaggerSchema = class ResolvedSwaggerSchema {
|
|
|
2672
2654
|
return resolvedSwaggerSchema;
|
|
2673
2655
|
}
|
|
2674
2656
|
};
|
|
2675
|
-
|
|
2676
2657
|
//#endregion
|
|
2677
2658
|
//#region src/util/request.ts
|
|
2678
2659
|
var Request = class {
|
|
@@ -2693,7 +2674,6 @@ var Request = class {
|
|
|
2693
2674
|
}
|
|
2694
2675
|
}
|
|
2695
2676
|
};
|
|
2696
|
-
|
|
2697
2677
|
//#endregion
|
|
2698
2678
|
//#region src/swagger-schema-resolver.ts
|
|
2699
2679
|
var SwaggerSchemaResolver = class {
|
|
@@ -2805,7 +2785,6 @@ var SwaggerSchemaResolver = class {
|
|
|
2805
2785
|
}
|
|
2806
2786
|
}
|
|
2807
2787
|
};
|
|
2808
|
-
|
|
2809
2788
|
//#endregion
|
|
2810
2789
|
//#region src/templates-worker.ts
|
|
2811
2790
|
const require$1 = node_module.createRequire(require("url").pathToFileURL(__filename).href);
|
|
@@ -2893,7 +2872,6 @@ var TemplatesWorker = class {
|
|
|
2893
2872
|
}, { includeFile: (path, configuration) => this.renderTemplate(this.getTemplateContent(path), configuration) });
|
|
2894
2873
|
};
|
|
2895
2874
|
};
|
|
2896
|
-
|
|
2897
2875
|
//#endregion
|
|
2898
2876
|
//#region src/translators/translator.ts
|
|
2899
2877
|
var Translator = class {
|
|
@@ -2907,7 +2885,6 @@ var Translator = class {
|
|
|
2907
2885
|
throw new Error("not implemented");
|
|
2908
2886
|
}
|
|
2909
2887
|
};
|
|
2910
|
-
|
|
2911
2888
|
//#endregion
|
|
2912
2889
|
//#region src/translators/javascript.ts
|
|
2913
2890
|
var JavascriptTranslator = class extends Translator {
|
|
@@ -2948,7 +2925,6 @@ var JavascriptTranslator = class extends Translator {
|
|
|
2948
2925
|
}];
|
|
2949
2926
|
};
|
|
2950
2927
|
};
|
|
2951
|
-
|
|
2952
2928
|
//#endregion
|
|
2953
2929
|
//#region src/type-name-formatter.ts
|
|
2954
2930
|
var TypeNameFormatter = class {
|
|
@@ -2987,7 +2963,6 @@ var TypeNameFormatter = class {
|
|
|
2987
2963
|
return name;
|
|
2988
2964
|
};
|
|
2989
2965
|
};
|
|
2990
|
-
|
|
2991
2966
|
//#endregion
|
|
2992
2967
|
//#region src/util/file-system.ts
|
|
2993
2968
|
var FileSystem = class {
|
|
@@ -3039,7 +3014,6 @@ var FileSystem = class {
|
|
|
3039
3014
|
return node_fs.writeFileSync(absolutePath, fileContent);
|
|
3040
3015
|
};
|
|
3041
3016
|
};
|
|
3042
|
-
|
|
3043
3017
|
//#endregion
|
|
3044
3018
|
//#region src/util/lodash-compat.ts
|
|
3045
3019
|
function createLodashCompat() {
|
|
@@ -3048,7 +3022,6 @@ function createLodashCompat() {
|
|
|
3048
3022
|
...es_toolkit_compat
|
|
3049
3023
|
};
|
|
3050
3024
|
}
|
|
3051
|
-
|
|
3052
3025
|
//#endregion
|
|
3053
3026
|
//#region src/code-gen-process.ts
|
|
3054
3027
|
const PATCHABLE_INSTANCES = [
|
|
@@ -3338,7 +3311,6 @@ var CodeGenProcess = class {
|
|
|
3338
3311
|
for (const instanceKey of PATCHABLE_INSTANCES) if (instanceKey !== key && key in this[instanceKey]) this[instanceKey][key] = value;
|
|
3339
3312
|
};
|
|
3340
3313
|
};
|
|
3341
|
-
|
|
3342
3314
|
//#endregion
|
|
3343
3315
|
//#region types/index.ts
|
|
3344
3316
|
let RequestContentKind = /* @__PURE__ */ function(RequestContentKind) {
|
|
@@ -3364,7 +3336,6 @@ let SCHEMA_TYPES = /* @__PURE__ */ function(SCHEMA_TYPES) {
|
|
|
3364
3336
|
SCHEMA_TYPES["COMPLEX_UNKNOWN"] = "__unknown";
|
|
3365
3337
|
return SCHEMA_TYPES;
|
|
3366
3338
|
}({});
|
|
3367
|
-
|
|
3368
3339
|
//#endregion
|
|
3369
3340
|
//#region src/commands/generate-templates/configuration.ts
|
|
3370
3341
|
var TemplatesGenConfig = class {
|
|
@@ -3383,7 +3354,6 @@ var TemplatesGenConfig = class {
|
|
|
3383
3354
|
objectAssign(this, update);
|
|
3384
3355
|
};
|
|
3385
3356
|
};
|
|
3386
|
-
|
|
3387
3357
|
//#endregion
|
|
3388
3358
|
//#region src/commands/generate-templates/templates-gen-process.ts
|
|
3389
3359
|
const __dirname$1 = node_path.default.dirname(node_url.default.fileURLToPath(require("url").pathToFileURL(__filename).href));
|
|
@@ -3485,7 +3455,6 @@ var TemplatesGenProcess = class {
|
|
|
3485
3455
|
return this.fileSystem.getFileContent(node_path.default.resolve(this.rootDir, pathToFile));
|
|
3486
3456
|
};
|
|
3487
3457
|
};
|
|
3488
|
-
|
|
3489
3458
|
//#endregion
|
|
3490
3459
|
//#region src/commands/generate-templates/index.ts
|
|
3491
3460
|
async function generateTemplates(config) {
|
|
@@ -3493,78 +3462,85 @@ async function generateTemplates(config) {
|
|
|
3493
3462
|
if (config.silent) consola.consola.level = 0;
|
|
3494
3463
|
return await new TemplatesGenProcess(config).start();
|
|
3495
3464
|
}
|
|
3496
|
-
|
|
3497
3465
|
//#endregion
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3466
|
+
//#region src/index.ts
|
|
3467
|
+
async function generateApi(config) {
|
|
3468
|
+
if (config.debug) consola.consola.level = Number.MAX_SAFE_INTEGER;
|
|
3469
|
+
if (config.silent) consola.consola.level = 0;
|
|
3470
|
+
return await new CodeGenProcess(config).start();
|
|
3471
|
+
}
|
|
3472
|
+
//#endregion
|
|
3473
|
+
Object.defineProperty(exports, "CodeGenConfig", {
|
|
3474
|
+
enumerable: true,
|
|
3475
|
+
get: function() {
|
|
3476
|
+
return CodeGenConfig;
|
|
3477
|
+
}
|
|
3503
3478
|
});
|
|
3504
|
-
Object.defineProperty(exports,
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3479
|
+
Object.defineProperty(exports, "HTTP_CLIENT", {
|
|
3480
|
+
enumerable: true,
|
|
3481
|
+
get: function() {
|
|
3482
|
+
return HTTP_CLIENT;
|
|
3483
|
+
}
|
|
3509
3484
|
});
|
|
3510
|
-
Object.defineProperty(exports,
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3485
|
+
Object.defineProperty(exports, "RequestContentKind", {
|
|
3486
|
+
enumerable: true,
|
|
3487
|
+
get: function() {
|
|
3488
|
+
return RequestContentKind;
|
|
3489
|
+
}
|
|
3515
3490
|
});
|
|
3516
|
-
Object.defineProperty(exports,
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3491
|
+
Object.defineProperty(exports, "SCHEMA_TYPES", {
|
|
3492
|
+
enumerable: true,
|
|
3493
|
+
get: function() {
|
|
3494
|
+
return SCHEMA_TYPES;
|
|
3495
|
+
}
|
|
3521
3496
|
});
|
|
3522
|
-
Object.defineProperty(exports,
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3497
|
+
Object.defineProperty(exports, "TemplatesGenConfig", {
|
|
3498
|
+
enumerable: true,
|
|
3499
|
+
get: function() {
|
|
3500
|
+
return TemplatesGenConfig;
|
|
3501
|
+
}
|
|
3527
3502
|
});
|
|
3528
|
-
Object.defineProperty(exports,
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3503
|
+
Object.defineProperty(exports, "__toESM", {
|
|
3504
|
+
enumerable: true,
|
|
3505
|
+
get: function() {
|
|
3506
|
+
return __toESM;
|
|
3507
|
+
}
|
|
3533
3508
|
});
|
|
3534
|
-
Object.defineProperty(exports,
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3509
|
+
Object.defineProperty(exports, "constants_exports", {
|
|
3510
|
+
enumerable: true,
|
|
3511
|
+
get: function() {
|
|
3512
|
+
return constants_exports;
|
|
3513
|
+
}
|
|
3539
3514
|
});
|
|
3540
|
-
Object.defineProperty(exports,
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3515
|
+
Object.defineProperty(exports, "description", {
|
|
3516
|
+
enumerable: true,
|
|
3517
|
+
get: function() {
|
|
3518
|
+
return description;
|
|
3519
|
+
}
|
|
3545
3520
|
});
|
|
3546
|
-
Object.defineProperty(exports,
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3521
|
+
Object.defineProperty(exports, "generateApi", {
|
|
3522
|
+
enumerable: true,
|
|
3523
|
+
get: function() {
|
|
3524
|
+
return generateApi;
|
|
3525
|
+
}
|
|
3551
3526
|
});
|
|
3552
|
-
Object.defineProperty(exports,
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3527
|
+
Object.defineProperty(exports, "generateTemplates", {
|
|
3528
|
+
enumerable: true,
|
|
3529
|
+
get: function() {
|
|
3530
|
+
return generateTemplates;
|
|
3531
|
+
}
|
|
3557
3532
|
});
|
|
3558
|
-
Object.defineProperty(exports,
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3533
|
+
Object.defineProperty(exports, "name", {
|
|
3534
|
+
enumerable: true,
|
|
3535
|
+
get: function() {
|
|
3536
|
+
return name;
|
|
3537
|
+
}
|
|
3563
3538
|
});
|
|
3564
|
-
Object.defineProperty(exports,
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3539
|
+
Object.defineProperty(exports, "version", {
|
|
3540
|
+
enumerable: true,
|
|
3541
|
+
get: function() {
|
|
3542
|
+
return version;
|
|
3543
|
+
}
|
|
3569
3544
|
});
|
|
3570
|
-
|
|
3545
|
+
|
|
3546
|
+
//# sourceMappingURL=src-CIiQTFUj.cjs.map
|