swagger-typescript-api 13.3.0 → 13.4.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-BaT2BiRR.mjs → src-BPFXd2rf.mjs} +45 -56
- package/dist/src-BPFXd2rf.mjs.map +1 -0
- package/dist/{generate-templates-BlSkwa8l.cjs → src-MPuKfxam.cjs} +114 -134
- package/dist/src-MPuKfxam.cjs.map +1 -0
- package/package.json +6 -6
- package/dist/chunk-DQk6qfdC.mjs +0 -18
- package/dist/generate-templates-BaT2BiRR.mjs.map +0 -1
- package/dist/generate-templates-BlSkwa8l.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -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.4.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",
|
|
@@ -643,13 +627,11 @@ var CodeGenConfig = class {
|
|
|
643
627
|
if (this.enumNamesAsValues) this.extractEnums = true;
|
|
644
628
|
};
|
|
645
629
|
};
|
|
646
|
-
|
|
647
630
|
//#endregion
|
|
648
631
|
//#region src/util/pascal-case.ts
|
|
649
632
|
function pascalCase(value) {
|
|
650
633
|
return (0, es_toolkit_compat.upperFirst)((0, es_toolkit_compat.camelCase)(value));
|
|
651
634
|
}
|
|
652
|
-
|
|
653
635
|
//#endregion
|
|
654
636
|
//#region src/schema-components-map.ts
|
|
655
637
|
var SchemaComponentsMap = class {
|
|
@@ -726,7 +708,6 @@ var SchemaComponentsMap = class {
|
|
|
726
708
|
});
|
|
727
709
|
}
|
|
728
710
|
};
|
|
729
|
-
|
|
730
711
|
//#endregion
|
|
731
712
|
//#region src/schema-parser/schema-formatters.ts
|
|
732
713
|
var SchemaFormatters = class {
|
|
@@ -817,7 +798,6 @@ var SchemaFormatters = class {
|
|
|
817
798
|
return fields.join("");
|
|
818
799
|
};
|
|
819
800
|
};
|
|
820
|
-
|
|
821
801
|
//#endregion
|
|
822
802
|
//#region src/util/sort-by-property.ts
|
|
823
803
|
const sortByProperty = (propertyName) => (o1, o2) => {
|
|
@@ -825,7 +805,6 @@ const sortByProperty = (propertyName) => (o1, o2) => {
|
|
|
825
805
|
if (o1[propertyName] < o2[propertyName]) return -1;
|
|
826
806
|
return 0;
|
|
827
807
|
};
|
|
828
|
-
|
|
829
808
|
//#endregion
|
|
830
809
|
//#region src/schema-parser/mono-schema-parser.ts
|
|
831
810
|
var MonoSchemaParser = class {
|
|
@@ -858,7 +837,6 @@ var MonoSchemaParser = class {
|
|
|
858
837
|
return this.schemaUtils.buildTypeNameFromPath(this.schemaPath);
|
|
859
838
|
};
|
|
860
839
|
};
|
|
861
|
-
|
|
862
840
|
//#endregion
|
|
863
841
|
//#region src/schema-parser/base-schema-parsers/array.ts
|
|
864
842
|
var ArraySchemaParser = class extends MonoSchemaParser {
|
|
@@ -892,7 +870,6 @@ var ArraySchemaParser = class extends MonoSchemaParser {
|
|
|
892
870
|
};
|
|
893
871
|
}
|
|
894
872
|
};
|
|
895
|
-
|
|
896
873
|
//#endregion
|
|
897
874
|
//#region src/schema-parser/base-schema-parsers/complex.ts
|
|
898
875
|
var ComplexSchemaParser = class extends MonoSchemaParser {
|
|
@@ -916,7 +893,6 @@ var ComplexSchemaParser = class extends MonoSchemaParser {
|
|
|
916
893
|
};
|
|
917
894
|
}
|
|
918
895
|
};
|
|
919
|
-
|
|
920
896
|
//#endregion
|
|
921
897
|
//#region src/schema-parser/base-schema-parsers/discriminator.ts
|
|
922
898
|
var DiscriminatorSchemaParser = class extends MonoSchemaParser {
|
|
@@ -995,7 +971,7 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
|
|
|
995
971
|
const mappingUsageKey = mappingPropertySchemaEnumKeysMap[mappingKey] || ts.StringValue(mappingKey);
|
|
996
972
|
if (ableToCreateMappingType) return ts.TypeWithGeneric(mappingTypeName, [mappingUsageKey, content]);
|
|
997
973
|
return ts.ExpressionGroup(ts.IntersectionType([ts.ObjectWrapper(ts.TypeField({
|
|
998
|
-
key: discriminator.propertyName,
|
|
974
|
+
key: ts.StringValue(discriminator.propertyName),
|
|
999
975
|
value: mappingUsageKey
|
|
1000
976
|
})), content]));
|
|
1001
977
|
};
|
|
@@ -1084,7 +1060,6 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
|
|
|
1084
1060
|
return { content: ts.ExpressionGroup(this.schemaParser._complexSchemaParsers[complexType](this.schema)) };
|
|
1085
1061
|
};
|
|
1086
1062
|
};
|
|
1087
|
-
|
|
1088
1063
|
//#endregion
|
|
1089
1064
|
//#region src/schema-parser/util/enum-key-resolver.ts
|
|
1090
1065
|
var EnumKeyResolver = class extends NameResolver {
|
|
@@ -1097,7 +1072,6 @@ var EnumKeyResolver = class extends NameResolver {
|
|
|
1097
1072
|
});
|
|
1098
1073
|
}
|
|
1099
1074
|
};
|
|
1100
|
-
|
|
1101
1075
|
//#endregion
|
|
1102
1076
|
//#region src/schema-parser/base-schema-parsers/enum.ts
|
|
1103
1077
|
var EnumSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1199,7 +1173,6 @@ var EnumSchemaParser = class extends MonoSchemaParser {
|
|
|
1199
1173
|
return this.enumKeyResolver.resolve([formatted]);
|
|
1200
1174
|
};
|
|
1201
1175
|
};
|
|
1202
|
-
|
|
1203
1176
|
//#endregion
|
|
1204
1177
|
//#region src/schema-parser/base-schema-parsers/object.ts
|
|
1205
1178
|
var ObjectSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1268,7 +1241,6 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
|
|
|
1268
1241
|
return propertiesContent;
|
|
1269
1242
|
};
|
|
1270
1243
|
};
|
|
1271
|
-
|
|
1272
1244
|
//#endregion
|
|
1273
1245
|
//#region src/schema-parser/base-schema-parsers/primitive.ts
|
|
1274
1246
|
var PrimitiveSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1289,11 +1261,17 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
|
|
|
1289
1261
|
schemaPath: this.schemaPath
|
|
1290
1262
|
}).getInlineParseContent();
|
|
1291
1263
|
else recordValuesContent = this.config.Ts.Keyword.Any;
|
|
1292
|
-
|
|
1264
|
+
const recordType = this.config.Ts.RecordType(recordKeysContent, recordValuesContent);
|
|
1265
|
+
contentType = propertyNamesSchema ? this.config.Ts.TypeWithGeneric("Partial", [recordType]) : recordType;
|
|
1293
1266
|
}
|
|
1294
1267
|
if (Array.isArray(type) && type.length) contentType = this.schemaParser._complexSchemaParsers.oneOf({
|
|
1295
1268
|
...typeof this.schema === "object" ? this.schema : {},
|
|
1296
|
-
oneOf: type.map((
|
|
1269
|
+
oneOf: type.map((t) => {
|
|
1270
|
+
const branch = { type: t };
|
|
1271
|
+
Object.assign(branch, this.schema);
|
|
1272
|
+
branch.type = t;
|
|
1273
|
+
return branch;
|
|
1274
|
+
})
|
|
1297
1275
|
});
|
|
1298
1276
|
if (Array.isArray(items) && type === SCHEMA_TYPES$1.ARRAY) contentType = this.config.Ts.Tuple(items.map((item) => this.schemaParserFabric.createSchemaParser({
|
|
1299
1277
|
schema: item,
|
|
@@ -1312,7 +1290,6 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
|
|
|
1312
1290
|
};
|
|
1313
1291
|
}
|
|
1314
1292
|
};
|
|
1315
|
-
|
|
1316
1293
|
//#endregion
|
|
1317
1294
|
//#region src/schema-parser/complex-schema-parsers/all-of.ts
|
|
1318
1295
|
var AllOfSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1324,7 +1301,6 @@ var AllOfSchemaParser = class extends MonoSchemaParser {
|
|
|
1324
1301
|
return this.schemaUtils.safeAddNullToType(this.schema, type);
|
|
1325
1302
|
}
|
|
1326
1303
|
};
|
|
1327
|
-
|
|
1328
1304
|
//#endregion
|
|
1329
1305
|
//#region src/schema-parser/complex-schema-parsers/any-of.ts
|
|
1330
1306
|
var AnyOfSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1336,7 +1312,6 @@ var AnyOfSchemaParser = class extends MonoSchemaParser {
|
|
|
1336
1312
|
return this.schemaUtils.safeAddNullToType(this.schema, type);
|
|
1337
1313
|
}
|
|
1338
1314
|
};
|
|
1339
|
-
|
|
1340
1315
|
//#endregion
|
|
1341
1316
|
//#region src/schema-parser/complex-schema-parsers/not.ts
|
|
1342
1317
|
var NotSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1344,7 +1319,6 @@ var NotSchemaParser = class extends MonoSchemaParser {
|
|
|
1344
1319
|
return this.config.Ts.Keyword.Any;
|
|
1345
1320
|
}
|
|
1346
1321
|
};
|
|
1347
|
-
|
|
1348
1322
|
//#endregion
|
|
1349
1323
|
//#region src/schema-parser/complex-schema-parsers/one-of.ts
|
|
1350
1324
|
var OneOfSchemaParser = class extends MonoSchemaParser {
|
|
@@ -1356,7 +1330,6 @@ var OneOfSchemaParser = class extends MonoSchemaParser {
|
|
|
1356
1330
|
return this.schemaUtils.safeAddNullToType(this.schema, type);
|
|
1357
1331
|
}
|
|
1358
1332
|
};
|
|
1359
|
-
|
|
1360
1333
|
//#endregion
|
|
1361
1334
|
//#region src/schema-parser/schema-parser.ts
|
|
1362
1335
|
var SchemaParser = class {
|
|
@@ -1469,7 +1442,6 @@ var SchemaParser = class {
|
|
|
1469
1442
|
};
|
|
1470
1443
|
};
|
|
1471
1444
|
};
|
|
1472
|
-
|
|
1473
1445
|
//#endregion
|
|
1474
1446
|
//#region src/schema-parser/schema-utils.ts
|
|
1475
1447
|
var SchemaUtils = class {
|
|
@@ -1478,6 +1450,22 @@ var SchemaUtils = class {
|
|
|
1478
1450
|
this.schemaComponentsMap = schemaComponentsMap;
|
|
1479
1451
|
this.typeNameFormatter = typeNameFormatter;
|
|
1480
1452
|
}
|
|
1453
|
+
isBinaryLikeContentMediaType = (contentMediaType) => {
|
|
1454
|
+
if (typeof contentMediaType !== "string" || !contentMediaType) return false;
|
|
1455
|
+
const mediaType = contentMediaType.split(";")[0]?.trim().toLowerCase();
|
|
1456
|
+
if (!mediaType) return false;
|
|
1457
|
+
/**
|
|
1458
|
+
* `contentMediaType` comes from JSON Schema. In practice it is often used to
|
|
1459
|
+
* signal "this string is a file/blob", but it may also be used for textual
|
|
1460
|
+
* payloads (json/xml/etc). We treat only binary-ish media types as `File`.
|
|
1461
|
+
*/
|
|
1462
|
+
if (mediaType.startsWith("text/")) return false;
|
|
1463
|
+
if (mediaType.includes("json") || mediaType.includes("+json")) return false;
|
|
1464
|
+
if (mediaType.includes("xml") || mediaType.includes("+xml")) return false;
|
|
1465
|
+
if (mediaType === "application/x-www-form-urlencoded") return false;
|
|
1466
|
+
if (mediaType === "application/javascript" || mediaType === "application/ecmascript" || mediaType === "application/graphql" || mediaType === "application/yaml" || mediaType === "application/x-yaml") return false;
|
|
1467
|
+
return mediaType === "application/octet-stream" || mediaType.startsWith("image/") || mediaType.startsWith("audio/") || mediaType.startsWith("video/") || mediaType.startsWith("font/") || mediaType.startsWith("model/") || mediaType.startsWith("application/");
|
|
1468
|
+
};
|
|
1481
1469
|
getRequiredProperties = (schema) => {
|
|
1482
1470
|
return (0, es_toolkit.uniq)(schema && Array.isArray(schema.required) && schema.required || []);
|
|
1483
1471
|
};
|
|
@@ -1586,9 +1574,12 @@ var SchemaUtils = class {
|
|
|
1586
1574
|
else {
|
|
1587
1575
|
const primitiveType = this.getSchemaPrimitiveType(schema);
|
|
1588
1576
|
if (primitiveType == null) return this.config.Ts.Keyword.Any;
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1577
|
+
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]);
|
|
1578
|
+
else {
|
|
1579
|
+
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];
|
|
1580
|
+
if (typeof typeAlias === "function") resultType = typeAlias(schema, this);
|
|
1581
|
+
else resultType = typeAlias || primitiveType;
|
|
1582
|
+
}
|
|
1592
1583
|
}
|
|
1593
1584
|
if (!resultType) return this.config.Ts.Keyword.Any;
|
|
1594
1585
|
return this.checkAndAddRequiredKeys(schema, this.safeAddNullToType(schema, resultType));
|
|
@@ -1612,7 +1603,6 @@ var SchemaUtils = class {
|
|
|
1612
1603
|
}
|
|
1613
1604
|
};
|
|
1614
1605
|
};
|
|
1615
|
-
|
|
1616
1606
|
//#endregion
|
|
1617
1607
|
//#region src/schema-parser/schema-parser-fabric.ts
|
|
1618
1608
|
var SchemaParserFabric = class {
|
|
@@ -1682,11 +1672,9 @@ var SchemaParserFabric = class {
|
|
|
1682
1672
|
}).getParseContent();
|
|
1683
1673
|
};
|
|
1684
1674
|
};
|
|
1685
|
-
|
|
1686
1675
|
//#endregion
|
|
1687
1676
|
//#region src/util/id.ts
|
|
1688
1677
|
const generateId = () => node_crypto.randomUUID();
|
|
1689
|
-
|
|
1690
1678
|
//#endregion
|
|
1691
1679
|
//#region src/schema-routes/util/specific-arg-name-resolver.ts
|
|
1692
1680
|
var SpecificArgNameResolver = class extends NameResolver {
|
|
@@ -1699,7 +1687,6 @@ var SpecificArgNameResolver = class extends NameResolver {
|
|
|
1699
1687
|
});
|
|
1700
1688
|
}
|
|
1701
1689
|
};
|
|
1702
|
-
|
|
1703
1690
|
//#endregion
|
|
1704
1691
|
//#region src/schema-routes/schema-routes.ts
|
|
1705
1692
|
const CONTENT_KIND = {
|
|
@@ -2022,7 +2009,7 @@ var SchemaRoutes = class {
|
|
|
2022
2009
|
if (schema && schema.typeData && !schema.typeData.description && requestBody?.description) schema.typeData.description = requestBody.description;
|
|
2023
2010
|
return {
|
|
2024
2011
|
...requestBody || {},
|
|
2025
|
-
paramName: requestBodyName || requestBody?.name ||
|
|
2012
|
+
paramName: requestBodyName || requestBody?.name || "data",
|
|
2026
2013
|
contentTypes,
|
|
2027
2014
|
contentKind,
|
|
2028
2015
|
schema,
|
|
@@ -2317,7 +2304,6 @@ var SchemaRoutes = class {
|
|
|
2317
2304
|
return routes.slice().sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
|
|
2318
2305
|
};
|
|
2319
2306
|
};
|
|
2320
|
-
|
|
2321
2307
|
//#endregion
|
|
2322
2308
|
//#region src/resolved-swagger-schema.ts
|
|
2323
2309
|
var ResolvedSwaggerSchema = class ResolvedSwaggerSchema {
|
|
@@ -2667,7 +2653,6 @@ var ResolvedSwaggerSchema = class ResolvedSwaggerSchema {
|
|
|
2667
2653
|
return resolvedSwaggerSchema;
|
|
2668
2654
|
}
|
|
2669
2655
|
};
|
|
2670
|
-
|
|
2671
2656
|
//#endregion
|
|
2672
2657
|
//#region src/util/request.ts
|
|
2673
2658
|
var Request = class {
|
|
@@ -2688,7 +2673,6 @@ var Request = class {
|
|
|
2688
2673
|
}
|
|
2689
2674
|
}
|
|
2690
2675
|
};
|
|
2691
|
-
|
|
2692
2676
|
//#endregion
|
|
2693
2677
|
//#region src/swagger-schema-resolver.ts
|
|
2694
2678
|
var SwaggerSchemaResolver = class {
|
|
@@ -2800,7 +2784,6 @@ var SwaggerSchemaResolver = class {
|
|
|
2800
2784
|
}
|
|
2801
2785
|
}
|
|
2802
2786
|
};
|
|
2803
|
-
|
|
2804
2787
|
//#endregion
|
|
2805
2788
|
//#region src/templates-worker.ts
|
|
2806
2789
|
const require$1 = node_module.createRequire(require("url").pathToFileURL(__filename).href);
|
|
@@ -2888,7 +2871,6 @@ var TemplatesWorker = class {
|
|
|
2888
2871
|
}, { includeFile: (path, configuration) => this.renderTemplate(this.getTemplateContent(path), configuration) });
|
|
2889
2872
|
};
|
|
2890
2873
|
};
|
|
2891
|
-
|
|
2892
2874
|
//#endregion
|
|
2893
2875
|
//#region src/translators/translator.ts
|
|
2894
2876
|
var Translator = class {
|
|
@@ -2902,7 +2884,6 @@ var Translator = class {
|
|
|
2902
2884
|
throw new Error("not implemented");
|
|
2903
2885
|
}
|
|
2904
2886
|
};
|
|
2905
|
-
|
|
2906
2887
|
//#endregion
|
|
2907
2888
|
//#region src/translators/javascript.ts
|
|
2908
2889
|
var JavascriptTranslator = class extends Translator {
|
|
@@ -2943,7 +2924,6 @@ var JavascriptTranslator = class extends Translator {
|
|
|
2943
2924
|
}];
|
|
2944
2925
|
};
|
|
2945
2926
|
};
|
|
2946
|
-
|
|
2947
2927
|
//#endregion
|
|
2948
2928
|
//#region src/type-name-formatter.ts
|
|
2949
2929
|
var TypeNameFormatter = class {
|
|
@@ -2982,7 +2962,6 @@ var TypeNameFormatter = class {
|
|
|
2982
2962
|
return name;
|
|
2983
2963
|
};
|
|
2984
2964
|
};
|
|
2985
|
-
|
|
2986
2965
|
//#endregion
|
|
2987
2966
|
//#region src/util/file-system.ts
|
|
2988
2967
|
var FileSystem = class {
|
|
@@ -3034,7 +3013,6 @@ var FileSystem = class {
|
|
|
3034
3013
|
return node_fs.writeFileSync(absolutePath, fileContent);
|
|
3035
3014
|
};
|
|
3036
3015
|
};
|
|
3037
|
-
|
|
3038
3016
|
//#endregion
|
|
3039
3017
|
//#region src/util/lodash-compat.ts
|
|
3040
3018
|
function createLodashCompat() {
|
|
@@ -3043,7 +3021,6 @@ function createLodashCompat() {
|
|
|
3043
3021
|
...es_toolkit_compat
|
|
3044
3022
|
};
|
|
3045
3023
|
}
|
|
3046
|
-
|
|
3047
3024
|
//#endregion
|
|
3048
3025
|
//#region src/code-gen-process.ts
|
|
3049
3026
|
const PATCHABLE_INSTANCES = [
|
|
@@ -3333,7 +3310,6 @@ var CodeGenProcess = class {
|
|
|
3333
3310
|
for (const instanceKey of PATCHABLE_INSTANCES) if (instanceKey !== key && key in this[instanceKey]) this[instanceKey][key] = value;
|
|
3334
3311
|
};
|
|
3335
3312
|
};
|
|
3336
|
-
|
|
3337
3313
|
//#endregion
|
|
3338
3314
|
//#region types/index.ts
|
|
3339
3315
|
let RequestContentKind = /* @__PURE__ */ function(RequestContentKind) {
|
|
@@ -3359,7 +3335,6 @@ let SCHEMA_TYPES = /* @__PURE__ */ function(SCHEMA_TYPES) {
|
|
|
3359
3335
|
SCHEMA_TYPES["COMPLEX_UNKNOWN"] = "__unknown";
|
|
3360
3336
|
return SCHEMA_TYPES;
|
|
3361
3337
|
}({});
|
|
3362
|
-
|
|
3363
3338
|
//#endregion
|
|
3364
3339
|
//#region src/commands/generate-templates/configuration.ts
|
|
3365
3340
|
var TemplatesGenConfig = class {
|
|
@@ -3378,7 +3353,6 @@ var TemplatesGenConfig = class {
|
|
|
3378
3353
|
objectAssign(this, update);
|
|
3379
3354
|
};
|
|
3380
3355
|
};
|
|
3381
|
-
|
|
3382
3356
|
//#endregion
|
|
3383
3357
|
//#region src/commands/generate-templates/templates-gen-process.ts
|
|
3384
3358
|
const __dirname$1 = node_path.default.dirname(node_url.default.fileURLToPath(require("url").pathToFileURL(__filename).href));
|
|
@@ -3480,7 +3454,6 @@ var TemplatesGenProcess = class {
|
|
|
3480
3454
|
return this.fileSystem.getFileContent(node_path.default.resolve(this.rootDir, pathToFile));
|
|
3481
3455
|
};
|
|
3482
3456
|
};
|
|
3483
|
-
|
|
3484
3457
|
//#endregion
|
|
3485
3458
|
//#region src/commands/generate-templates/index.ts
|
|
3486
3459
|
async function generateTemplates(config) {
|
|
@@ -3488,78 +3461,85 @@ async function generateTemplates(config) {
|
|
|
3488
3461
|
if (config.silent) consola.consola.level = 0;
|
|
3489
3462
|
return await new TemplatesGenProcess(config).start();
|
|
3490
3463
|
}
|
|
3491
|
-
|
|
3492
3464
|
//#endregion
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3465
|
+
//#region src/index.ts
|
|
3466
|
+
async function generateApi(config) {
|
|
3467
|
+
if (config.debug) consola.consola.level = Number.MAX_SAFE_INTEGER;
|
|
3468
|
+
if (config.silent) consola.consola.level = 0;
|
|
3469
|
+
return await new CodeGenProcess(config).start();
|
|
3470
|
+
}
|
|
3471
|
+
//#endregion
|
|
3472
|
+
Object.defineProperty(exports, "CodeGenConfig", {
|
|
3473
|
+
enumerable: true,
|
|
3474
|
+
get: function() {
|
|
3475
|
+
return CodeGenConfig;
|
|
3476
|
+
}
|
|
3498
3477
|
});
|
|
3499
|
-
Object.defineProperty(exports,
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3478
|
+
Object.defineProperty(exports, "HTTP_CLIENT", {
|
|
3479
|
+
enumerable: true,
|
|
3480
|
+
get: function() {
|
|
3481
|
+
return HTTP_CLIENT;
|
|
3482
|
+
}
|
|
3504
3483
|
});
|
|
3505
|
-
Object.defineProperty(exports,
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3484
|
+
Object.defineProperty(exports, "RequestContentKind", {
|
|
3485
|
+
enumerable: true,
|
|
3486
|
+
get: function() {
|
|
3487
|
+
return RequestContentKind;
|
|
3488
|
+
}
|
|
3510
3489
|
});
|
|
3511
|
-
Object.defineProperty(exports,
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3490
|
+
Object.defineProperty(exports, "SCHEMA_TYPES", {
|
|
3491
|
+
enumerable: true,
|
|
3492
|
+
get: function() {
|
|
3493
|
+
return SCHEMA_TYPES;
|
|
3494
|
+
}
|
|
3516
3495
|
});
|
|
3517
|
-
Object.defineProperty(exports,
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3496
|
+
Object.defineProperty(exports, "TemplatesGenConfig", {
|
|
3497
|
+
enumerable: true,
|
|
3498
|
+
get: function() {
|
|
3499
|
+
return TemplatesGenConfig;
|
|
3500
|
+
}
|
|
3522
3501
|
});
|
|
3523
|
-
Object.defineProperty(exports,
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3502
|
+
Object.defineProperty(exports, "__toESM", {
|
|
3503
|
+
enumerable: true,
|
|
3504
|
+
get: function() {
|
|
3505
|
+
return __toESM;
|
|
3506
|
+
}
|
|
3528
3507
|
});
|
|
3529
|
-
Object.defineProperty(exports,
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3508
|
+
Object.defineProperty(exports, "constants_exports", {
|
|
3509
|
+
enumerable: true,
|
|
3510
|
+
get: function() {
|
|
3511
|
+
return constants_exports;
|
|
3512
|
+
}
|
|
3534
3513
|
});
|
|
3535
|
-
Object.defineProperty(exports,
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3514
|
+
Object.defineProperty(exports, "description", {
|
|
3515
|
+
enumerable: true,
|
|
3516
|
+
get: function() {
|
|
3517
|
+
return description;
|
|
3518
|
+
}
|
|
3540
3519
|
});
|
|
3541
|
-
Object.defineProperty(exports,
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3520
|
+
Object.defineProperty(exports, "generateApi", {
|
|
3521
|
+
enumerable: true,
|
|
3522
|
+
get: function() {
|
|
3523
|
+
return generateApi;
|
|
3524
|
+
}
|
|
3546
3525
|
});
|
|
3547
|
-
Object.defineProperty(exports,
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3526
|
+
Object.defineProperty(exports, "generateTemplates", {
|
|
3527
|
+
enumerable: true,
|
|
3528
|
+
get: function() {
|
|
3529
|
+
return generateTemplates;
|
|
3530
|
+
}
|
|
3552
3531
|
});
|
|
3553
|
-
Object.defineProperty(exports,
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3532
|
+
Object.defineProperty(exports, "name", {
|
|
3533
|
+
enumerable: true,
|
|
3534
|
+
get: function() {
|
|
3535
|
+
return name;
|
|
3536
|
+
}
|
|
3558
3537
|
});
|
|
3559
|
-
Object.defineProperty(exports,
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3538
|
+
Object.defineProperty(exports, "version", {
|
|
3539
|
+
enumerable: true,
|
|
3540
|
+
get: function() {
|
|
3541
|
+
return version;
|
|
3542
|
+
}
|
|
3564
3543
|
});
|
|
3565
|
-
|
|
3544
|
+
|
|
3545
|
+
//# sourceMappingURL=src-MPuKfxam.cjs.map
|