@nestia/migrate 0.1.5 → 0.1.7

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/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Nestia
2
+ ![Nestia Logo](https://nestia.io/logo.png)
3
+
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
5
+ [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
6
+ [![Downloads](https://img.shields.io/npm/dm/nestia.svg)](https://www.npmjs.com/package/nestia)
7
+ [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
8
+ [![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)
9
+
10
+ Nestia is a set of helper libraries for NestJS, supporting below features:
11
+
12
+ - `@nestia/core`: super-fast decorators
13
+ - `@nestia/sdk`:
14
+ - Swagger generator evolved than ever
15
+ - SDK library generator for clients
16
+ - Mockup Simulator for client applications
17
+ - Automatic E2E test functions generator
18
+ - `@nestia/migrate`: migration from Swagger to NestJS
19
+ - `nestia`: just CLI (command line interface) tool
20
+
21
+ > **Note**
22
+ >
23
+ > - **Only one line** required, with pure TypeScript type
24
+ > - Enhance performance **30x** up
25
+ > - Runtime validator is **20,000x faster** than `class-validator`
26
+ > - JSON serialization is **200x faster** than `class-transformer`
27
+ > - Software Development Kit
28
+ > - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://trpc.io/)
29
+ > - Mockup simulator means embedded backend simulator in SDK
30
+ > - similar with [msw](https://mswjs.io/), but fully automated
31
+
32
+ ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
33
+
34
+ > Left is NestJS server code, and right is client (frontend) code utilizing SDK
35
+
36
+
37
+
38
+
39
+ ## Sponsors and Backers
40
+ Thanks for your support.
41
+
42
+ Your donation would encourage `nestia` development.
43
+
44
+ [![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)
45
+
46
+
47
+
48
+
49
+ ## Guide Documents
50
+ Check out the document in the [website](https://nestia.io/docs/):
51
+
52
+ ### 🏠 Home
53
+ - [Introduction](https://nestia.io/docs/)
54
+ - [Setup](https://nestia.io/docs/setup/)
55
+ - [Pure TypeScript](https://nestia.io/docs/pure)
56
+
57
+ ### 📖 Features
58
+ - Core Library
59
+ - [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
60
+ - [TypedBody](https://nestia.io/docs/core/TypedBody/)
61
+ - [TypedParam](https://nestia.io/docs/core/TypedParam/)
62
+ - [TypedQuery](https://nestia.io/docs/core/TypedRoute/)
63
+ - Generators
64
+ - [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
65
+ - [SDK Library](https://nestia.io/docs/sdk/sdk/)
66
+ - [E2E Functions](https://nestia.io/docs/sdk/e2e/)
67
+ - [Mockup Simulator](https://nestia.io/docs/sdk/simulator/)
68
+ - [Swagger to NestJS](https://nestia.io/docs/migrate/)
69
+
70
+ ### 🔗 Appendix
71
+ - [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
72
+ - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
@@ -38,7 +38,7 @@ class NestiaMigrateApplication {
38
38
  const $io10 = input => (undefined === input["default"] || "number" === typeof input["default"]) && (undefined === input["enum"] || Array.isArray(input["enum"]) && input["enum"].every(elem => "number" === typeof elem)) && (undefined === input.minimum || "number" === typeof input.minimum) && (undefined === input.maximum || "number" === typeof input.maximum) && (undefined === input.exclusiveMinimum || "boolean" === typeof input.exclusiveMinimum) && (undefined === input.exclusiveMaximum || "boolean" === typeof input.exclusiveMaximum) && (undefined === input.multipleOf || "number" === typeof input.multipleOf) && "number" === input.type && (undefined === input.nullable || "boolean" === typeof input.nullable) && (undefined === input.title || "string" === typeof input.title) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input["x-typia-optional"] || "boolean" === typeof input["x-typia-optional"]) && (undefined === input["x-typia-rest"] || "boolean" === typeof input["x-typia-rest"]);
39
39
  const $io11 = input => (undefined === input["default"] || "string" === typeof input["default"]) && (undefined === input["enum"] || Array.isArray(input["enum"]) && input["enum"].every(elem => "string" === typeof elem)) && (undefined === input.format || "string" === typeof input.format) && (undefined === input.pattern || "string" === typeof input.pattern) && (undefined === input.minLength || "number" === typeof input.minLength && parseInt(input.minLength) === input.minLength && 0 <= input.minLength) && (undefined === input.maxLength || "number" === typeof input.maxLength && parseInt(input.maxLength) === input.maxLength && 0 <= input.maxLength) && "string" === input.type && (undefined === input.nullable || "boolean" === typeof input.nullable) && (undefined === input.title || "string" === typeof input.title) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input["x-typia-optional"] || "boolean" === typeof input["x-typia-optional"]) && (undefined === input["x-typia-rest"] || "boolean" === typeof input["x-typia-rest"]);
40
40
  const $io12 = input => "object" === typeof input.items && null !== input.items && false === Array.isArray(input.items) && $iu0(input.items) && (undefined === input.minItems || "number" === typeof input.minItems && parseInt(input.minItems) === input.minItems && 0 <= input.minItems) && (undefined === input.maxItems || "number" === typeof input.maxItems && parseInt(input.maxItems) === input.maxItems && 0 <= input.maxItems) && (undefined === input["x-typia-tuple"] || "object" === typeof input["x-typia-tuple"] && null !== input["x-typia-tuple"] && $io15(input["x-typia-tuple"])) && "array" === input.type && (undefined === input.nullable || "boolean" === typeof input.nullable) && (undefined === input.title || "string" === typeof input.title) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input["x-typia-optional"] || "boolean" === typeof input["x-typia-optional"]) && (undefined === input["x-typia-rest"] || "boolean" === typeof input["x-typia-rest"]);
41
- const $io13 = input => "object" === typeof input.properties && null !== input.properties && false === Array.isArray(input.properties) && $io4(input.properties) && (undefined === input.required || Array.isArray(input.required) && input.required.every(elem => "string" === typeof elem)) && (null !== input.additionalProperties && (undefined === input.additionalProperties || "boolean" === typeof input.additionalProperties || "object" === typeof input.additionalProperties && null !== input.additionalProperties && false === Array.isArray(input.additionalProperties) && $iu0(input.additionalProperties))) && (undefined === input["x-typia-patternProperties"] || "object" === typeof input["x-typia-patternProperties"] && null !== input["x-typia-patternProperties"] && false === Array.isArray(input["x-typia-patternProperties"]) && $io4(input["x-typia-patternProperties"])) && "object" === input.type && (undefined === input.nullable || "boolean" === typeof input.nullable) && (undefined === input.title || "string" === typeof input.title) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input["x-typia-optional"] || "boolean" === typeof input["x-typia-optional"]) && (undefined === input["x-typia-rest"] || "boolean" === typeof input["x-typia-rest"]);
41
+ const $io13 = input => (undefined === input.properties || "object" === typeof input.properties && null !== input.properties && false === Array.isArray(input.properties) && $io4(input.properties)) && (undefined === input.required || Array.isArray(input.required) && input.required.every(elem => "string" === typeof elem)) && (null !== input.additionalProperties && (undefined === input.additionalProperties || "boolean" === typeof input.additionalProperties || "object" === typeof input.additionalProperties && null !== input.additionalProperties && false === Array.isArray(input.additionalProperties) && $iu0(input.additionalProperties))) && (undefined === input["x-typia-patternProperties"] || "object" === typeof input["x-typia-patternProperties"] && null !== input["x-typia-patternProperties"] && false === Array.isArray(input["x-typia-patternProperties"]) && $io4(input["x-typia-patternProperties"])) && "object" === input.type && (undefined === input.nullable || "boolean" === typeof input.nullable) && (undefined === input.title || "string" === typeof input.title) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input["x-typia-optional"] || "boolean" === typeof input["x-typia-optional"]) && (undefined === input["x-typia-rest"] || "boolean" === typeof input["x-typia-rest"]);
42
42
  const $io14 = input => "string" === typeof input.$ref && (undefined === input.title || "string" === typeof input.title) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input["x-typia-optional"] || "boolean" === typeof input["x-typia-optional"]) && (undefined === input["x-typia-rest"] || "boolean" === typeof input["x-typia-rest"]);
43
43
  const $io15 = input => Array.isArray(input.items) && input.items.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $iu0(elem)) && "array" === input.type && (undefined === input.nullable || "boolean" === typeof input.nullable) && (undefined === input.title || "string" === typeof input.title) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input["x-typia-optional"] || "boolean" === typeof input["x-typia-optional"]) && (undefined === input["x-typia-rest"] || "boolean" === typeof input["x-typia-rest"]);
44
44
  const $io16 = input => Object.keys(input).every(key => {
@@ -79,12 +79,12 @@ class NestiaMigrateApplication {
79
79
  if (undefined === value)
80
80
  return true;
81
81
  if (RegExp(/(.*)/).test(key))
82
- return "object" === typeof value && null !== value && $io29(value);
82
+ return "object" === typeof value && null !== value && false === Array.isArray(value) && $io29(value);
83
83
  return true;
84
84
  });
85
- const $io29 = input => Array.isArray(input.parameters) && input.parameters.every(elem => "object" === typeof elem && null !== elem && $io30(elem)) && (undefined === input.requestBody || "object" === typeof input.requestBody && null !== input.requestBody && $io31(input.requestBody)) && ("object" === typeof input.responses && null !== input.responses && false === Array.isArray(input.responses) && $io35(input.responses)) && (undefined === input.summary || "string" === typeof input.summary) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem));
86
- const $io30 = input => "string" === typeof input.name && ("header" === input["in"] || "query" === input["in"] || "cookie" === input["in"] || "path" === input["in"]) && ("object" === typeof input.schema && null !== input.schema && false === Array.isArray(input.schema) && $iu0(input.schema)) && "boolean" === typeof input.required && "string" === typeof input.description;
87
- const $io31 = input => "string" === typeof input.description && ("object" === typeof input.content && null !== input.content && false === Array.isArray(input.content) && $io32(input.content)) && true === input.required && "boolean" === typeof input["x-nestia-encrypted"];
85
+ const $io29 = input => (undefined === input.parameters || Array.isArray(input.parameters) && input.parameters.every(elem => "object" === typeof elem && null !== elem && $io30(elem))) && (undefined === input.requestBody || "object" === typeof input.requestBody && null !== input.requestBody && $io31(input.requestBody)) && (undefined === input.responses || "object" === typeof input.responses && null !== input.responses && false === Array.isArray(input.responses) && $io35(input.responses)) && (undefined === input.summary || "string" === typeof input.summary) && (undefined === input.description || "string" === typeof input.description) && (undefined === input.deprecated || "boolean" === typeof input.deprecated) && (undefined === input.tags || Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem));
86
+ const $io30 = input => "string" === typeof input.name && ("header" === input["in"] || "query" === input["in"] || "cookie" === input["in"] || "path" === input["in"]) && ("object" === typeof input.schema && null !== input.schema && false === Array.isArray(input.schema) && $iu0(input.schema)) && (undefined === input.required || "boolean" === typeof input.required) && (undefined === input.description || "string" === typeof input.description);
87
+ const $io31 = input => (undefined === input.description || "string" === typeof input.description) && ("object" === typeof input.content && null !== input.content && false === Array.isArray(input.content) && $io32(input.content)) && (undefined === input.required || true === input.required) && (undefined === input["x-nestia-encrypted"] || "boolean" === typeof input["x-nestia-encrypted"]);
88
88
  const $io32 = input => (undefined === input["text/plain"] || "object" === typeof input["text/plain"] && null !== input["text/plain"] && $io33(input["text/plain"])) && (undefined === input["application/json"] || "object" === typeof input["application/json"] && null !== input["application/json"] && $io34(input["application/json"]));
89
89
  const $io33 = input => "object" === typeof input.schema && null !== input.schema && $io11(input.schema);
90
90
  const $io34 = input => "object" === typeof input.schema && null !== input.schema && false === Array.isArray(input.schema) && $iu0(input.schema);
@@ -93,10 +93,10 @@ class NestiaMigrateApplication {
93
93
  if (undefined === value)
94
94
  return true;
95
95
  if (RegExp(/(.*)/).test(key))
96
- return "object" === typeof value && null !== value && $io36(value);
96
+ return "object" === typeof value && null !== value && false === Array.isArray(value) && $io36(value);
97
97
  return true;
98
98
  });
99
- const $io36 = input => "string" === typeof input.description && (undefined === input.content || "object" === typeof input.content && null !== input.content && false === Array.isArray(input.content) && $io32(input.content)) && (undefined === input["x-nestia-encrypted"] || "boolean" === typeof input["x-nestia-encrypted"]);
99
+ const $io36 = input => (undefined === input.description || "string" === typeof input.description) && (undefined === input.content || "object" === typeof input.content && null !== input.content && false === Array.isArray(input.content) && $io32(input.content)) && (undefined === input["x-nestia-encrypted"] || "boolean" === typeof input["x-nestia-encrypted"]);
100
100
  const $io37 = input => Object.keys(input).every(key => {
101
101
  const value = input[key];
102
102
  if (undefined === value)
@@ -709,13 +709,13 @@ class NestiaMigrateApplication {
709
709
  expected: "(boolean | undefined)",
710
710
  value: input["x-typia-rest"]
711
711
  }));
712
- const $ao13 = (input, _path, _exceptionable = true) => (("object" === typeof input.properties && null !== input.properties && false === Array.isArray(input.properties) || $guard(_exceptionable, {
712
+ const $ao13 = (input, _path, _exceptionable = true) => (undefined === input.properties || ("object" === typeof input.properties && null !== input.properties && false === Array.isArray(input.properties) || $guard(_exceptionable, {
713
713
  path: _path + ".properties",
714
- expected: "Record<string, ISwaggerSchema>",
714
+ expected: "(Record<string, ISwaggerSchema> | undefined)",
715
715
  value: input.properties
716
716
  })) && $ao4(input.properties, _path + ".properties", true && _exceptionable) || $guard(_exceptionable, {
717
717
  path: _path + ".properties",
718
- expected: "Record<string, ISwaggerSchema>",
718
+ expected: "(Record<string, ISwaggerSchema> | undefined)",
719
719
  value: input.properties
720
720
  })) && (undefined === input.required || (Array.isArray(input.required) || $guard(_exceptionable, {
721
721
  path: _path + ".required",
@@ -1046,7 +1046,7 @@ class NestiaMigrateApplication {
1046
1046
  if (undefined === value)
1047
1047
  return true;
1048
1048
  if (RegExp(/(.*)/).test(key))
1049
- return ("object" === typeof value && null !== value || $guard(_exceptionable, {
1049
+ return ("object" === typeof value && null !== value && false === Array.isArray(value) || $guard(_exceptionable, {
1050
1050
  path: _path + $join(key),
1051
1051
  expected: "ISwaggerRoute",
1052
1052
  value: value
@@ -1057,9 +1057,9 @@ class NestiaMigrateApplication {
1057
1057
  });
1058
1058
  return true;
1059
1059
  });
1060
- const $ao29 = (input, _path, _exceptionable = true) => ((Array.isArray(input.parameters) || $guard(_exceptionable, {
1060
+ const $ao29 = (input, _path, _exceptionable = true) => (undefined === input.parameters || (Array.isArray(input.parameters) || $guard(_exceptionable, {
1061
1061
  path: _path + ".parameters",
1062
- expected: "Array<ISwaggerRoute.IParameter>",
1062
+ expected: "(Array<ISwaggerRoute.IParameter> | undefined)",
1063
1063
  value: input.parameters
1064
1064
  })) && input.parameters.every((elem, _index11) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
1065
1065
  path: _path + ".parameters[" + _index11 + "]",
@@ -1071,7 +1071,7 @@ class NestiaMigrateApplication {
1071
1071
  value: elem
1072
1072
  })) || $guard(_exceptionable, {
1073
1073
  path: _path + ".parameters",
1074
- expected: "Array<ISwaggerRoute.IParameter>",
1074
+ expected: "(Array<ISwaggerRoute.IParameter> | undefined)",
1075
1075
  value: input.parameters
1076
1076
  })) && (undefined === input.requestBody || ("object" === typeof input.requestBody && null !== input.requestBody || $guard(_exceptionable, {
1077
1077
  path: _path + ".requestBody",
@@ -1081,13 +1081,13 @@ class NestiaMigrateApplication {
1081
1081
  path: _path + ".requestBody",
1082
1082
  expected: "(ISwaggerRoute.IRequestBody | undefined)",
1083
1083
  value: input.requestBody
1084
- })) && (("object" === typeof input.responses && null !== input.responses && false === Array.isArray(input.responses) || $guard(_exceptionable, {
1084
+ })) && (undefined === input.responses || ("object" === typeof input.responses && null !== input.responses && false === Array.isArray(input.responses) || $guard(_exceptionable, {
1085
1085
  path: _path + ".responses",
1086
- expected: "ISwaggerRoute.IResponseBody",
1086
+ expected: "(ISwaggerRoute.IResponseBody | undefined)",
1087
1087
  value: input.responses
1088
1088
  })) && $ao35(input.responses, _path + ".responses", true && _exceptionable) || $guard(_exceptionable, {
1089
1089
  path: _path + ".responses",
1090
- expected: "ISwaggerRoute.IResponseBody",
1090
+ expected: "(ISwaggerRoute.IResponseBody | undefined)",
1091
1091
  value: input.responses
1092
1092
  })) && (undefined === input.summary || "string" === typeof input.summary || $guard(_exceptionable, {
1093
1093
  path: _path + ".summary",
@@ -1101,9 +1101,9 @@ class NestiaMigrateApplication {
1101
1101
  path: _path + ".deprecated",
1102
1102
  expected: "(boolean | undefined)",
1103
1103
  value: input.deprecated
1104
- })) && ((Array.isArray(input.tags) || $guard(_exceptionable, {
1104
+ })) && (undefined === input.tags || (Array.isArray(input.tags) || $guard(_exceptionable, {
1105
1105
  path: _path + ".tags",
1106
- expected: "Array<string>",
1106
+ expected: "(Array<string> | undefined)",
1107
1107
  value: input.tags
1108
1108
  })) && input.tags.every((elem, _index12) => "string" === typeof elem || $guard(_exceptionable, {
1109
1109
  path: _path + ".tags[" + _index12 + "]",
@@ -1111,7 +1111,7 @@ class NestiaMigrateApplication {
1111
1111
  value: elem
1112
1112
  })) || $guard(_exceptionable, {
1113
1113
  path: _path + ".tags",
1114
- expected: "Array<string>",
1114
+ expected: "(Array<string> | undefined)",
1115
1115
  value: input.tags
1116
1116
  }));
1117
1117
  const $ao30 = (input, _path, _exceptionable = true) => ("string" === typeof input.name || $guard(_exceptionable, {
@@ -1130,18 +1130,18 @@ class NestiaMigrateApplication {
1130
1130
  path: _path + ".schema",
1131
1131
  expected: "(ISwaggerSchema.IAnyOf | ISwaggerSchema.IArray | ISwaggerSchema.IBoolean | ISwaggerSchema.IInteger | ISwaggerSchema.INumber | ISwaggerSchema.IObject | ISwaggerSchema.IOneOf | ISwaggerSchema.IReference | ISwaggerSchema.IString | ISwaggerSchema.IUnknown)",
1132
1132
  value: input.schema
1133
- })) && ("boolean" === typeof input.required || $guard(_exceptionable, {
1133
+ })) && (undefined === input.required || "boolean" === typeof input.required || $guard(_exceptionable, {
1134
1134
  path: _path + ".required",
1135
- expected: "boolean",
1135
+ expected: "(boolean | undefined)",
1136
1136
  value: input.required
1137
- })) && ("string" === typeof input.description || $guard(_exceptionable, {
1137
+ })) && (undefined === input.description || "string" === typeof input.description || $guard(_exceptionable, {
1138
1138
  path: _path + ".description",
1139
- expected: "string",
1139
+ expected: "(string | undefined)",
1140
1140
  value: input.description
1141
1141
  }));
1142
- const $ao31 = (input, _path, _exceptionable = true) => ("string" === typeof input.description || $guard(_exceptionable, {
1142
+ const $ao31 = (input, _path, _exceptionable = true) => (undefined === input.description || "string" === typeof input.description || $guard(_exceptionable, {
1143
1143
  path: _path + ".description",
1144
- expected: "string",
1144
+ expected: "(string | undefined)",
1145
1145
  value: input.description
1146
1146
  })) && (("object" === typeof input.content && null !== input.content && false === Array.isArray(input.content) || $guard(_exceptionable, {
1147
1147
  path: _path + ".content",
@@ -1151,13 +1151,13 @@ class NestiaMigrateApplication {
1151
1151
  path: _path + ".content",
1152
1152
  expected: "ISwaggerRoute.IContent",
1153
1153
  value: input.content
1154
- })) && (true === input.required || $guard(_exceptionable, {
1154
+ })) && (undefined === input.required || true === input.required || $guard(_exceptionable, {
1155
1155
  path: _path + ".required",
1156
- expected: "true",
1156
+ expected: "(true | undefined)",
1157
1157
  value: input.required
1158
- })) && ("boolean" === typeof input["x-nestia-encrypted"] || $guard(_exceptionable, {
1158
+ })) && (undefined === input["x-nestia-encrypted"] || "boolean" === typeof input["x-nestia-encrypted"] || $guard(_exceptionable, {
1159
1159
  path: _path + "[\"x-nestia-encrypted\"]",
1160
- expected: "boolean",
1160
+ expected: "(boolean | undefined)",
1161
1161
  value: input["x-nestia-encrypted"]
1162
1162
  }));
1163
1163
  const $ao32 = (input, _path, _exceptionable = true) => (undefined === input["text/plain"] || ("object" === typeof input["text/plain"] && null !== input["text/plain"] || $guard(_exceptionable, {
@@ -1200,7 +1200,7 @@ class NestiaMigrateApplication {
1200
1200
  if (undefined === value)
1201
1201
  return true;
1202
1202
  if (RegExp(/(.*)/).test(key))
1203
- return ("object" === typeof value && null !== value || $guard(_exceptionable, {
1203
+ return ("object" === typeof value && null !== value && false === Array.isArray(value) || $guard(_exceptionable, {
1204
1204
  path: _path + $join(key),
1205
1205
  expected: "__type.o2",
1206
1206
  value: value
@@ -1211,9 +1211,9 @@ class NestiaMigrateApplication {
1211
1211
  });
1212
1212
  return true;
1213
1213
  });
1214
- const $ao36 = (input, _path, _exceptionable = true) => ("string" === typeof input.description || $guard(_exceptionable, {
1214
+ const $ao36 = (input, _path, _exceptionable = true) => (undefined === input.description || "string" === typeof input.description || $guard(_exceptionable, {
1215
1215
  path: _path + ".description",
1216
- expected: "string",
1216
+ expected: "(string | undefined)",
1217
1217
  value: input.description
1218
1218
  })) && (undefined === input.content || ("object" === typeof input.content && null !== input.content && false === Array.isArray(input.content) || $guard(_exceptionable, {
1219
1219
  path: _path + ".content",
@@ -50,7 +50,7 @@ exports.TEMPLATE = [
50
50
  {
51
51
  "location": "",
52
52
  "file": "package.json",
53
- "content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"----------------------------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"-----------------------------------------------\": \"\",\r\n \"start\": \"node lib/executable/server\",\r\n \"test\": \"node bin/test\",\r\n \"------------------------------------------------\": \"\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.3.6\",\r\n \"@nestia/sdk\": \"^1.4.5\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^3.3.1\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^5.40.0\",\r\n \"@typescript-eslint/parser\": \"^5.40.0\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"eslint-plugin-deprecation\": \"^1.4.1\",\r\n \"nestia\": \"^4.3.2\",\r\n \"prettier\": \"^2.7.1\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.0\",\r\n \"typescript\": \"^5.1.3\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^1.4.3\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tstl\": \"^2.5.13\",\r\n \"typia\": \"^4.1.4\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}"
53
+ "content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"----------------------------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"-----------------------------------------------\": \"\",\r\n \"start\": \"node lib/executable/server\",\r\n \"test\": \"node bin/test\",\r\n \"------------------------------------------------\": \"\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.3.6\",\r\n \"@nestia/sdk\": \"^1.4.9\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^3.3.1\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^5.40.0\",\r\n \"@typescript-eslint/parser\": \"^5.40.0\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"eslint-plugin-deprecation\": \"^1.4.1\",\r\n \"nestia\": \"^4.3.2\",\r\n \"prettier\": \"^2.7.1\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.0\",\r\n \"typescript\": \"^5.1.3\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^1.4.3\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tstl\": \"^2.5.13\",\r\n \"typia\": \"^4.1.4\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}"
54
54
  },
55
55
  {
56
56
  "location": "/packages/api",
@@ -60,7 +60,7 @@ exports.TEMPLATE = [
60
60
  {
61
61
  "location": "/packages/api",
62
62
  "file": "package.json",
63
- "content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.0.0\",\r\n \"description\": \"API for PROJECT\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^1.4.0\",\r\n \"typia\": \"^4.1.3\"\r\n }\r\n}\r\n"
63
+ "content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.0.0\",\r\n \"description\": \"API for PROJECT\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^1.4.0\",\r\n \"typia\": \"^4.1.4\"\r\n }\r\n}\r\n"
64
64
  },
65
65
  {
66
66
  "location": "/packages/api",
@@ -85,12 +85,12 @@ exports.TEMPLATE = [
85
85
  {
86
86
  "location": "/src",
87
87
  "file": "Backend.ts",
88
- "content": "import core from \"@nestia/core\";\r\nimport { NestFactory } from \"@nestjs/core\";\r\nimport {\r\n FastifyAdapter,\r\n NestFastifyApplication,\r\n} from \"@nestjs/platform-fastify\";\r\n\r\nimport { Configuration } from \"./Configuration\";\r\n\r\nexport class Backend {\r\n private application_?: NestFastifyApplication;\r\n\r\n public async open(): Promise<void> {\r\n //----\r\n // OPEN THE BACKEND SERVER\r\n //----\r\n // MOUNT CONTROLLERS\r\n this.application_ = await NestFactory.create(\r\n await core.DynamicModule.mount(__dirname + \"/controllers\"),\r\n new FastifyAdapter(),\r\n { logger: false },\r\n );\r\n\r\n // DO OPEN\r\n this.application_.enableCors();\r\n await this.application_.listen(await Configuration.API_PORT());\r\n\r\n //----\r\n // POST-PROCESSES\r\n //----\r\n // INFORM TO THE PM2\r\n if (process.send) process.send(\"ready\");\r\n\r\n // WHEN KILL COMMAND COMES\r\n process.on(\"SIGINT\", async () => {\r\n await this.close();\r\n process.exit(0);\r\n });\r\n }\r\n\r\n public async close(): Promise<void> {\r\n if (this.application_ === undefined) return;\r\n\r\n // DO CLOSE\r\n await this.application_.close();\r\n delete this.application_;\r\n }\r\n}\r\n"
88
+ "content": "import core from \"@nestia/core\";\r\nimport { NestFactory } from \"@nestjs/core\";\r\nimport {\r\n FastifyAdapter,\r\n NestFastifyApplication,\r\n} from \"@nestjs/platform-fastify\";\r\n\r\nimport { Configuration } from \"./Configuration\";\r\n\r\nexport class Backend {\r\n private application_?: NestFastifyApplication;\r\n\r\n public async open(): Promise<void> {\r\n //----\r\n // OPEN THE BACKEND SERVER\r\n //----\r\n // MOUNT CONTROLLERS\r\n this.application_ = await NestFactory.create(\r\n await core.DynamicModule.mount(__dirname + \"/controllers\"),\r\n new FastifyAdapter(),\r\n { logger: false },\r\n );\r\n\r\n // DO OPEN\r\n this.application_.enableCors();\r\n await this.application_.listen(Configuration.API_PORT());\r\n\r\n //----\r\n // POST-PROCESSES\r\n //----\r\n // INFORM TO THE PM2\r\n if (process.send) process.send(\"ready\");\r\n\r\n // WHEN KILL COMMAND COMES\r\n process.on(\"SIGINT\", async () => {\r\n await this.close();\r\n process.exit(0);\r\n });\r\n }\r\n\r\n public async close(): Promise<void> {\r\n if (this.application_ === undefined) return;\r\n\r\n // DO CLOSE\r\n await this.application_.close();\r\n delete this.application_;\r\n }\r\n}\r\n"
89
89
  },
90
90
  {
91
91
  "location": "/src",
92
92
  "file": "Configuration.ts",
93
- "content": "import path from \"path\";\r\n\r\nexport namespace Configuration {\r\n export const API_PORT = async () => 37001;\r\n\r\n export const ROOT = __filename.includes(\r\n path.join(\"bin\", \"src\", \"ShoppingConfiguration\"),\r\n )\r\n ? path.resolve(__dirname + \"/../..\")\r\n : path.resolve(__dirname + \"/..\");\r\n}\r\n"
93
+ "content": "import path from \"path\";\r\n\r\nexport namespace Configuration {\r\n export const API_PORT = () => 37001;\r\n\r\n export const ROOT = __filename.includes(\r\n path.join(\"bin\", \"src\", \"ShoppingConfiguration\"),\r\n )\r\n ? path.resolve(__dirname + \"/../..\")\r\n : path.resolve(__dirname + \"/..\");\r\n}\r\n"
94
94
  },
95
95
  {
96
96
  "location": "/src/executable",
@@ -1 +1 @@
1
- {"version":3,"file":"TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACpB;QACI,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,6lCAA6lC;KAC3mC;IACD;QACI,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,gBAAgB;QACxB,SAA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AE,k8MAAk8M;KACh9M;IACD;QACI,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,y4CAAy4C;KACv5C;IACD;QACI,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,kBAAkB;QAC1B,SAAS,EAAE,iWAAiW;KAC/W;IACD;QACI,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,wgEAAwgE;KACthE;IACD;QACI,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,yGAAyG;KACvH;IACD;QACI,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,s5DAAs5D;KACp6D;IACD;QACI,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,wXAAwX;KACtY;IACD;QACI,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,i1CAAi1C;KAC/1C;IACD;QACI,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,yJAAyJ;KACvK;IACD;QACI,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,y8XAAy8X;KACv9X;CACJ,CAAA"}
1
+ {"version":3,"file":"TEMPLATE.js","sourceRoot":"","sources":["../../src/bundles/TEMPLATE.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACpB;QACI,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,6lCAA6lC;KAC3mC;IACD;QACI,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,qtBAAqtB;KACnuB;IACD;QACI,UAAU,EAAE,oBAAoB;QAChC,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,+lBAA+lB;KAC7mB;IACD;QACI,UAAU,EAAE,EAAE;QACd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EAAE,kBAAkB;QAC1B,SAAS,EAAE,2VAA2V;KACzW;IACD;QACI,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,wgEAAwgE;KACthE;IACD;QACI,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,yGAAyG;KACvH;IACD;QACI,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,s5DAAs5D;KACp6D;IACD;QACI,UAAU,EAAE,YAAY;QACxB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,wXAAwX;KACtY;IACD;QACI,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,i1CAAi1C;KAC/1C;IACD;QACI,UAAU,EAAE,OAAO;QACnB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,yJAAyJ;KACvK;IACD;QACI,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,y8XAAy8X;KACv9X;CACJ,CAAA"}
@@ -47,10 +47,10 @@ var ControllerProgrammer;
47
47
  .map(([location, routes]) => {
48
48
  const prefix = StringUtil_1.StringUtil.commonPrefix(routes.map((r) => r.path));
49
49
  for (const r of routes)
50
- r.path = StringUtil_1.StringUtil.reJoinWithoutParameters(r.path.replace(prefix, ""));
50
+ r.path = StringUtil_1.StringUtil.reJoinWithDecimalParameters(r.path.replace(prefix, ""));
51
51
  const controller = {
52
52
  name: StringUtil_1.StringUtil.pascal(location) + "Controller",
53
- path: StringUtil_1.StringUtil.reJoinWithoutParameters(prefix),
53
+ path: StringUtil_1.StringUtil.reJoinWithDecimalParameters(prefix),
54
54
  location: "src/controllers/" + location,
55
55
  routes,
56
56
  };
@@ -88,6 +88,7 @@ var ControllerProgrammer;
88
88
  }
89
89
  };
90
90
  ControllerProgrammer.write = (controller) => {
91
+ var _a;
91
92
  const references = [];
92
93
  const body = [
93
94
  `@Controller(${JSON.stringify(controller.path)})`,
@@ -100,18 +101,27 @@ var ControllerProgrammer;
100
101
  .join("\n\n"),
101
102
  `}`,
102
103
  ].join("\n");
104
+ const core = controller.routes.some((r) => r.body !== null ||
105
+ r.response === null ||
106
+ r.response.type === "application/json");
103
107
  const typia = controller.routes.some((m) => m.response !== null);
104
- const imports = [
108
+ const common = new Set(["Controller"]);
109
+ for (const r of controller.routes)
110
+ if (((_a = r.response) === null || _a === void 0 ? void 0 : _a.type) === "text/plain") {
111
+ common.add("Header");
112
+ common.add(StringUtil_1.StringUtil.capitalize(r.method));
113
+ }
114
+ const dtoImports = [
105
115
  ...new Set(references.map((r) => r.$ref
106
116
  .replace("#/components/schemas/", "")
107
117
  .split(".")[0])),
108
118
  ].map((ref) => `import { ${ref} } from "${"../".repeat(StringUtil_1.StringUtil.split(controller.location).length - 1)}api/structures/${ref}"`);
109
119
  return [
110
- `import core from "@nestia/core";`,
111
- `import { Controller } from "@nestjs/common";`,
120
+ ...(core ? [`import core from "@nestia/core";`] : []),
121
+ `import { ${[...common].join(", ")} } from "@nestjs/common";`,
112
122
  ...(typia ? [`import typia from "typia";`] : []),
113
123
  "",
114
- ...(imports.length ? [...imports, ""] : []),
124
+ ...(dtoImports.length ? [...dtoImports, ""] : []),
115
125
  body,
116
126
  ].join("\n");
117
127
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ControllerProgrammer.js","sourceRoot":"","sources":["../../src/programmers/ControllerProgrammer.ts"],"names":[],"mappings":";;;AAIA,8CAA2C;AAC3C,oDAAiD;AACjD,uDAAoD;AAEpD,IAAiB,oBAAoB,CAsJpC;AAtJD,WAAiB,oBAAoB;IACpB,4BAAO,GAAG,CAAC,OAAiB,EAAwB,EAAE;QAC/D,MAAM,IAAI,GAAiC,IAAI,GAAG,EAAE,CAAC;QAErD,gBAAgB;QAChB,KAAK,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,E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AAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC,CAAC;AACN,CAAC,EAnKgB,oBAAoB,oCAApB,oBAAoB,QAmKpC"}
@@ -7,13 +7,16 @@ const SchemaProgrammer_1 = require("./SchemaProgrammer");
7
7
  var RouteProgrammer;
8
8
  (function (RouteProgrammer) {
9
9
  RouteProgrammer.analyze = (swagger) => (props) => (route) => {
10
- var _a, _b, _c;
10
+ var _a, _b, _c, _d, _e, _f;
11
11
  const body = emplaceBodySchema(emplaceReference(swagger)("body"))((_a = route.requestBody) === null || _a === void 0 ? void 0 : _a.content);
12
- const response = emplaceBodySchema(emplaceReference(swagger)("response"))((_c = ((_b = route.responses["200"]) !== null && _b !== void 0 ? _b : route.responses["201"])) === null || _c === void 0 ? void 0 : _c.content);
13
- if (body === false || response === false)
12
+ const response = emplaceBodySchema(emplaceReference(swagger)("response"))((_e = ((_c = (_b = route.responses) === null || _b === void 0 ? void 0 : _b["200"]) !== null && _c !== void 0 ? _c : (_d = route.responses) === null || _d === void 0 ? void 0 : _d["201"])) === null || _e === void 0 ? void 0 : _e.content);
13
+ if (body === false || response === false) {
14
+ console.log(`Failed to migrate ${props.method.toUpperCase()} ${props.path}: @nestia/migrate supports only application/json or text/plain format yet.`);
14
15
  return null;
16
+ }
15
17
  const [headers, query] = ["header", "query"].map((type) => {
16
- const parameters = route.parameters.filter((p) => p.in === type);
18
+ var _a;
19
+ const parameters = ((_a = route.parameters) !== null && _a !== void 0 ? _a : []).filter((p) => p.in === type);
17
20
  if (parameters.length === 0)
18
21
  return null;
19
22
  const objects = parameters
@@ -29,12 +32,13 @@ var RouteProgrammer;
29
32
  .filter((s) => !!s);
30
33
  const primitives = parameters.filter((p) => JsonTypeChecker_1.JsonTypeChecker.isBoolean(p.schema) ||
31
34
  JsonTypeChecker_1.JsonTypeChecker.isNumber(p.schema) ||
35
+ JsonTypeChecker_1.JsonTypeChecker.isInteger(p.schema) ||
32
36
  JsonTypeChecker_1.JsonTypeChecker.isString(p.schema));
33
37
  if (objects.length === 1)
34
38
  return objects[0];
35
39
  else if (objects.length + primitives.length !==
36
40
  parameters.length)
37
- throw new Error(`Error on nestia.migrate.RouteProgrammer.analze(): ${type} typed parameters must be only one object type.`);
41
+ throw new Error(`Error on nestia.migrate.RouteProgrammer.analze(): ${type} typed parameters must be only one object type - ${StringUtil_1.StringUtil.capitalize(props.method)} "${props.path}".`);
38
42
  const entire = [
39
43
  ...objects.map((o) => {
40
44
  var _a;
@@ -58,19 +62,22 @@ var RouteProgrammer;
58
62
  ];
59
63
  return parameters.length === 0
60
64
  ? null
61
- : emplaceReference(swagger)(StringUtil_1.StringUtil.pascal(`I/Api/${StringUtil_1.StringUtil.reJoinWithoutParameters(props.path)}`) +
65
+ : emplaceReference(swagger)(StringUtil_1.StringUtil.pascal(`I/Api/${props.path}`) +
62
66
  "." +
63
67
  StringUtil_1.StringUtil.pascal(`${props.method}/${type}`))({
64
68
  type: "object",
65
69
  properties: Object.fromEntries([
66
70
  ...new Map(entire
67
- .map((o) => Object.entries(o.properties).map(([name, schema]) => {
71
+ .map((o) => {
68
72
  var _a;
69
- return [
70
- name,
71
- Object.assign(Object.assign({}, schema), { description: (_a = schema.description) !== null && _a !== void 0 ? _a : schema.description }),
72
- ];
73
- }))
73
+ return Object.entries((_a = o.properties) !== null && _a !== void 0 ? _a : {}).map(([name, schema]) => {
74
+ var _a;
75
+ return [
76
+ name,
77
+ Object.assign(Object.assign({}, schema), { description: (_a = schema.description) !== null && _a !== void 0 ? _a : schema.description }),
78
+ ];
79
+ });
80
+ })
74
81
  .flat()),
75
82
  ]),
76
83
  required: [
@@ -83,7 +90,7 @@ var RouteProgrammer;
83
90
  path: props.path,
84
91
  method: props.method,
85
92
  headers,
86
- parameters: route.parameters
93
+ parameters: ((_f = route.parameters) !== null && _f !== void 0 ? _f : [])
87
94
  .filter((p) => p.in === "path")
88
95
  .map((p) => {
89
96
  var _a;
@@ -133,12 +140,20 @@ var RouteProgrammer;
133
140
  const emplaceBodySchema = (emplacer) => (content) => {
134
141
  if (!content)
135
142
  return null;
136
- else if (content["application/json"]) {
137
- const schema = content["application/json"].schema;
138
- return isNotObjectLiteral(schema) ? schema : emplacer(schema);
143
+ const entries = Object.entries(content);
144
+ const json = entries.find((e) => e[0].includes("application/json"));
145
+ if (json) {
146
+ const { schema } = json[1];
147
+ return {
148
+ type: "application/json",
149
+ schema: isNotObjectLiteral(schema)
150
+ ? schema
151
+ : emplacer(schema),
152
+ };
139
153
  }
140
- else if (content["text/plain"])
141
- return { type: "string" };
154
+ const text = entries.find((e) => e[0].includes("text/plain"));
155
+ if (text)
156
+ return { type: "text/plain", schema: { type: "string" } };
142
157
  return false;
143
158
  };
144
159
  const emplaceReference = (swagger) => (name) => (schema) => {
@@ -149,9 +164,13 @@ var RouteProgrammer;
149
164
  return { $ref: `#/components/schemas/${name}` };
150
165
  };
151
166
  RouteProgrammer.write = (references) => (route) => {
167
+ var _a;
152
168
  const output = route.response
153
- ? SchemaProgrammer_1.SchemaProgrammer.write(references)(route.response)
169
+ ? SchemaProgrammer_1.SchemaProgrammer.write(references)(route.response.schema)
154
170
  : "void";
171
+ const decorator = ((_a = route.body) === null || _a === void 0 ? void 0 : _a.type) === "text/plain"
172
+ ? [`@Header("Content-Type", "text/plain")`, `@`].join("\n")
173
+ : "@core.TypedRoute.";
155
174
  const content = [
156
175
  ...(route.description
157
176
  ? [
@@ -162,7 +181,7 @@ var RouteProgrammer;
162
181
  " */",
163
182
  ]
164
183
  : []),
165
- `@core.TypedRoute.${StringUtil_1.StringUtil.capitalize(route.method)}${route.path.length ? `(${JSON.stringify(route.path)})` : "()"}`,
184
+ `${decorator}${StringUtil_1.StringUtil.capitalize(route.method)}${route.path.length ? `(${JSON.stringify(route.path)})` : "()"}`,
166
185
  `public async ${route.name}(`,
167
186
  ...route.parameters.map((p) => ` ${writeParameter(p)},`),
168
187
  ...(route.query
@@ -171,9 +190,11 @@ var RouteProgrammer;
171
190
  ]
172
191
  : []),
173
192
  ...(route.body
174
- ? [
175
- ` @core.TypedBody() body: ${SchemaProgrammer_1.SchemaProgrammer.write(references)(route.body)},`,
176
- ]
193
+ ? route.body.type === "application/json"
194
+ ? [
195
+ ` @core.TypedBody() body: ${SchemaProgrammer_1.SchemaProgrammer.write(references)(route.body.schema)},`,
196
+ ]
197
+ : [` @core.PlainBody() body: string,`]
177
198
  : []),
178
199
  `): Promise<${output}> {`,
179
200
  ...route.parameters.map((p) => ` ${StringUtil_1.StringUtil.normalize(p.key)};`),