@nestia/migrate 14.0.1 → 14.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/lib/NestiaMigrateApplication.d.ts +111 -0
  2. package/lib/NestiaMigrateApplication.js +148 -9
  3. package/lib/NestiaMigrateApplication.js.map +1 -1
  4. package/lib/NestiaMigrateApplication.mjs +147 -5
  5. package/lib/_virtual/_rolldown/runtime.mjs +6 -1
  6. package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +45 -0
  7. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +59 -3
  8. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
  9. package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +9 -3
  10. package/lib/archivers/NestiaMigrateFileArchiver.d.ts +34 -0
  11. package/lib/archivers/NestiaMigrateFileArchiver.js +34 -0
  12. package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
  13. package/lib/bundles/NEST_TEMPLATE.js +1 -1
  14. package/lib/bundles/NEST_TEMPLATE.mjs +1 -1
  15. package/lib/bundles/SDK_TEMPLATE.js +1 -1
  16. package/lib/bundles/SDK_TEMPLATE.mjs +1 -1
  17. package/lib/executable/NestiaMigrateCommander.d.ts +39 -1
  18. package/lib/executable/NestiaMigrateCommander.js +42 -2
  19. package/lib/executable/NestiaMigrateCommander.js.map +1 -1
  20. package/lib/executable/NestiaMigrateCommander.mjs +5 -3
  21. package/lib/executable/NestiaMigrateInquirer.d.ts +32 -1
  22. package/lib/executable/NestiaMigrateInquirer.js +33 -10
  23. package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
  24. package/lib/executable/NestiaMigrateInquirer.mjs +4 -3
  25. package/lib/executable/TemplateBundleCache.d.ts +23 -0
  26. package/lib/executable/TemplateBundleCache.js +60 -0
  27. package/lib/executable/TemplateBundleCache.js.map +1 -0
  28. package/lib/executable/TemplateBundleCache.mjs +39 -0
  29. package/lib/executable/TemplateBundleCache.mjs.map +1 -0
  30. package/lib/executable/bundle.d.ts +1 -0
  31. package/lib/executable/bundle.js +404 -0
  32. package/lib/executable/bundle.js.map +1 -0
  33. package/lib/executable/bundle.mjs +324 -0
  34. package/lib/executable/bundle.mjs.map +1 -0
  35. package/lib/factories/ExpressionFactory.d.ts +14 -0
  36. package/lib/factories/ExpressionFactory.js +14 -0
  37. package/lib/factories/ExpressionFactory.js.map +1 -1
  38. package/lib/factories/IdentifierFactory.d.ts +20 -0
  39. package/lib/factories/IdentifierFactory.js +20 -0
  40. package/lib/factories/IdentifierFactory.js.map +1 -1
  41. package/lib/factories/LiteralFactory.d.ts +18 -2
  42. package/lib/factories/LiteralFactory.js +18 -2
  43. package/lib/factories/LiteralFactory.js.map +1 -1
  44. package/lib/factories/StatementFactory.d.ts +26 -1
  45. package/lib/factories/StatementFactory.js +26 -1
  46. package/lib/factories/StatementFactory.js.map +1 -1
  47. package/lib/factories/SupportedStringFormats.d.ts +6 -0
  48. package/lib/factories/SupportedStringFormats.js +33 -0
  49. package/lib/factories/SupportedStringFormats.js.map +1 -0
  50. package/lib/factories/SupportedStringFormats.mjs +34 -0
  51. package/lib/factories/SupportedStringFormats.mjs.map +1 -0
  52. package/lib/factories/TypeFactory.d.ts +21 -0
  53. package/lib/factories/TypeFactory.js +13 -0
  54. package/lib/factories/TypeFactory.js.map +1 -1
  55. package/lib/factories/TypeLiteralFactory.d.ts +18 -0
  56. package/lib/factories/TypeLiteralFactory.js +18 -0
  57. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  58. package/lib/internal/ts.d.ts +153 -0
  59. package/lib/internal/ts.js.map +1 -1
  60. package/lib/package.mjs +55 -0
  61. package/lib/package.mjs.map +1 -0
  62. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +31 -0
  63. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +17 -0
  64. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
  65. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +40 -0
  66. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +27 -0
  67. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  68. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +39 -0
  69. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +26 -0
  70. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
  71. package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +18 -0
  72. package/lib/programmers/NestiaMigrateApiProgrammer.js +18 -0
  73. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  74. package/lib/programmers/NestiaMigrateApiProgrammer.mjs +1 -1
  75. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +40 -0
  76. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +27 -0
  77. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
  78. package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +17 -0
  79. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +19 -8
  80. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
  81. package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +1 -6
  82. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +30 -0
  83. package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -0
  84. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
  85. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +39 -0
  86. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -0
  87. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
  88. package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +16 -0
  89. package/lib/programmers/NestiaMigrateE2eProgrammer.js +16 -0
  90. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  91. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +75 -0
  92. package/lib/programmers/NestiaMigrateImportProgrammer.js +58 -3
  93. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  94. package/lib/programmers/NestiaMigrateImportProgrammer.mjs +58 -3
  95. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +28 -0
  96. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -0
  97. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  98. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +30 -0
  99. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +16 -0
  100. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
  101. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +16 -0
  102. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +16 -0
  103. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
  104. package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +17 -0
  105. package/lib/programmers/NestiaMigrateNestProgrammer.js +17 -0
  106. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  107. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +16 -0
  108. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +20 -5
  109. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  110. package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +4 -4
  111. package/lib/structures/INestiaMigrateConfig.d.ts +21 -0
  112. package/lib/structures/INestiaMigrateContext.d.ts +15 -0
  113. package/lib/structures/INestiaMigrateController.d.ts +13 -0
  114. package/lib/structures/INestiaMigrateFile.d.ts +11 -0
  115. package/lib/utils/FilePrinter.d.ts +33 -0
  116. package/lib/utils/FilePrinter.js +33 -0
  117. package/lib/utils/FilePrinter.js.map +1 -1
  118. package/lib/utils/MapUtil.d.ts +17 -0
  119. package/lib/utils/MapUtil.js +19 -3
  120. package/lib/utils/MapUtil.js.map +1 -1
  121. package/lib/utils/MapUtil.mjs +1 -2
  122. package/lib/utils/PathTemplate.d.ts +23 -1
  123. package/lib/utils/PathTemplate.js +15 -1
  124. package/lib/utils/PathTemplate.js.map +1 -1
  125. package/lib/utils/RequestBody.d.ts +13 -0
  126. package/lib/utils/RequestBody.js +13 -0
  127. package/lib/utils/RequestBody.js.map +1 -1
  128. package/lib/utils/StringUtil.d.ts +55 -0
  129. package/lib/utils/StringUtil.js +93 -8
  130. package/lib/utils/StringUtil.js.map +1 -1
  131. package/lib/utils/StringUtil.mjs +30 -8
  132. package/lib/utils/SuccessStatus.d.ts +21 -1
  133. package/lib/utils/SuccessStatus.js +21 -1
  134. package/lib/utils/SuccessStatus.js.map +1 -1
  135. package/package.json +5 -4
  136. package/src/NestiaMigrateApplication.ts +151 -13
  137. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +59 -4
  138. package/src/archivers/NestiaMigrateFileArchiver.ts +34 -0
  139. package/src/bundles/NEST_TEMPLATE.ts +1 -1
  140. package/src/bundles/SDK_TEMPLATE.ts +1 -1
  141. package/src/executable/NestiaMigrateCommander.ts +44 -2
  142. package/src/executable/NestiaMigrateInquirer.ts +35 -3
  143. package/src/executable/TemplateBundleCache.ts +65 -0
  144. package/src/executable/{bundle.js → bundle.ts} +110 -43
  145. package/src/factories/ExpressionFactory.ts +14 -0
  146. package/src/factories/IdentifierFactory.ts +20 -0
  147. package/src/factories/LiteralFactory.ts +18 -2
  148. package/src/factories/StatementFactory.ts +26 -1
  149. package/src/factories/SupportedStringFormats.ts +29 -0
  150. package/src/factories/TypeFactory.ts +21 -0
  151. package/src/factories/TypeLiteralFactory.ts +18 -0
  152. package/src/internal/ts.ts +153 -0
  153. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +35 -0
  154. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +43 -0
  155. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +42 -0
  156. package/src/programmers/NestiaMigrateApiProgrammer.ts +18 -0
  157. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +43 -0
  158. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +19 -10
  159. package/src/programmers/NestiaMigrateDtoProgrammer.ts +33 -0
  160. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +42 -0
  161. package/src/programmers/NestiaMigrateE2eProgrammer.ts +16 -0
  162. package/src/programmers/NestiaMigrateImportProgrammer.ts +86 -5
  163. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +30 -0
  164. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +34 -0
  165. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +16 -0
  166. package/src/programmers/NestiaMigrateNestProgrammer.ts +17 -0
  167. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +25 -8
  168. package/src/structures/INestiaMigrateConfig.ts +26 -0
  169. package/src/structures/INestiaMigrateContext.ts +17 -0
  170. package/src/structures/INestiaMigrateController.ts +16 -0
  171. package/src/structures/INestiaMigrateFile.ts +13 -0
  172. package/src/utils/FilePrinter.ts +33 -0
  173. package/src/utils/MapUtil.ts +18 -2
  174. package/src/utils/PathTemplate.ts +23 -1
  175. package/src/utils/RequestBody.ts +13 -0
  176. package/src/utils/StringUtil.ts +101 -9
  177. package/src/utils/SuccessStatus.ts +21 -1
  178. package/lib/factories/FormatCheatSheet.d.ts +0 -25
  179. package/lib/factories/FormatCheatSheet.js +0 -34
  180. package/lib/factories/FormatCheatSheet.js.map +0 -1
  181. package/lib/factories/FormatCheatSheet.mjs +0 -31
  182. package/lib/factories/FormatCheatSheet.mjs.map +0 -1
  183. package/src/factories/FormatCheatSheet.ts +0 -71
@@ -4,8 +4,45 @@ exports.NestiaMigrateControllerAnalyzer = void 0;
4
4
  const MapUtil_1 = require("../utils/MapUtil");
5
5
  const PathTemplate_1 = require("../utils/PathTemplate");
6
6
  const StringUtil_1 = require("../utils/StringUtil");
7
+ /**
8
+ * Groups the routes of an application into NestJS controllers.
9
+ *
10
+ * Generated controller locations use portable slash spelling and directoryName
11
+ * applies Windows filename constraints on every host: invalid/control
12
+ * characters and trailing dots/spaces become underscores, and device names,
13
+ * including extension and superscript-digit forms, receive a prefix. Router
14
+ * paths retain their original URL meaning. Directory normalization is
15
+ * intentionally many-to-one; distinct controllers retain their own filenames.
16
+ * Host filesystem case policy is not inferred.
17
+ *
18
+ * @evidence contracts/common.md#principled-implementation Routes are grouped by the controller name from the operation, or by the capitalized accessor prefix, and each controller path is the longest path prefix shared by all of its routes, so one controller covers one resource path.
19
+ * @evidence contracts/common.md#clear-and-simple-design One namespace with the grouping and the path formatting, and small private helpers for the shared-prefix computation.
20
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Names and paths derive from the document, with no route or controller name special-cased.
21
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
22
+ */
7
23
  var NestiaMigrateControllerAnalyzer;
8
24
  (function (NestiaMigrateControllerAnalyzer) {
25
+ /**
26
+ * Returns the controllers of the routes, each with its name, its path, its
27
+ * source location, and its routes.
28
+ *
29
+ * The name is the `x-samchon-controller` extension of the operation when
30
+ * present, and otherwise the capitalized accessor prefix followed by
31
+ * `Controller`.
32
+ *
33
+ * Generated controller locations use portable slash spelling and
34
+ * directoryName applies Windows filename constraints on every host:
35
+ * invalid/control characters and trailing dots/spaces become underscores, and
36
+ * device names, including extension and superscript-digit forms, receive a
37
+ * prefix. Router paths retain their original URL meaning. Directory
38
+ * normalization is intentionally many-to-one; distinct controllers retain
39
+ * their own filenames. Host filesystem case policy is not inferred.
40
+ *
41
+ * @evidence contracts/common.md#principled-implementation Grouping uses a map keyed by controller name, and the common path prefix and the directory prefix are found by removing every segment after the first difference across the routes, so a controller path is a prefix of every route it owns.
42
+ * @evidence contracts/common.md#clear-and-simple-design One function with two phases: grouping, then prefix computation.
43
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The extension name is part of the generated document contract; no other name is assumed.
44
+ * @evidence contracts/common.md#meaningful-documentation The comment states how the name and the path are chosen.
45
+ */
9
46
  NestiaMigrateControllerAnalyzer.analyze = (routes) => {
10
47
  var _a;
11
48
  const collection = new Map();
@@ -49,6 +86,14 @@ var NestiaMigrateControllerAnalyzer;
49
86
  * A literal character the router reserves is escaped, so an AIP custom
50
87
  * method's `/items:batchGet` stays a literal rather than a parameter
51
88
  * `batchGet`, and `(` or `*` no syntax error.
89
+ *
90
+ * This operation emits router protocol spelling and does not select native
91
+ * filenames or filesystem identities.
92
+ *
93
+ * @evidence contracts/common.md#principled-implementation The path template is split into literal and parameter segments, and every character that path-to-regexp treats specially in a literal is escaped with a backslash, so a literal never changes the route's meaning.
94
+ * @evidence contracts/common.md#clear-and-simple-design One expression over the shared path segmenter.
95
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The reserved set is the router's syntax and is applied to every literal.
96
+ * @evidence contracts/common.md#meaningful-documentation The comment states the escaping and the parameter form.
52
97
  */
53
98
  NestiaMigrateControllerAnalyzer.routePath = (route) => PathTemplate_1.PathTemplate.segments(route)
54
99
  .map((segment) => segment.type === "literal"
@@ -62,10 +107,21 @@ var NestiaMigrateControllerAnalyzer;
62
107
  */
63
108
  const ROUTER_RESERVED = /[\\:*?+!(){}[\]]/g;
64
109
  /**
65
- * A route segment as a directory name: unescaped, and each character a file
66
- * name cannot hold on Windows (`:` of an AIP custom method, `*`, `?`) as `_`.
110
+ * Maps a route segment to a portable directory component. Router escapes are
111
+ * removed, Windows-invalid characters and trailing dots/spaces become
112
+ * underscores, and reserved device names receive an underscore prefix. Distinct
113
+ * route segments may share a directory; controller files retain their
114
+ * independently assigned controller names.
67
115
  */
68
- const directoryName = (segment) => segment.replace(/\\(.)/g, "$1").replace(/[<>:"|?*\\]/g, "_");
116
+ const directoryName = (segment) => {
117
+ const name = segment
118
+ .replace(/\\(.)/g, "$1")
119
+ .replace(/[<>:"|?*\\\u0000-\u001f]/g, "_")
120
+ .replace(/[. ]+$/, (suffix) => "_".repeat(suffix.length));
121
+ return /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³])(?:\.|$)/i.test(name)
122
+ ? `_${name}`
123
+ : name || "_";
124
+ };
69
125
  const getSplitIndex = (x, y) => {
70
126
  const n = Math.min(x.length, y.length);
71
127
  for (let i = 0; i < n; ++i)
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateControllerAnalyzer.js","sourceRoot":"","sources":["../../src/analyzers/NestiaMigrateControllerAnalyzer.ts"],"names":[],"mappings":";;;AAGA,8CAA2C;AAC3C,wDAAqD;AACrD,oDAAiD;AAEjD,IAAiB,+BAA+B,CA6D/C;AA7DD,WAAiB,+BAA+B;IACjC,uCAAO,GAAG,CACrB,MAA2B,EACC,EAAE;;QAC9B,MAAM,UAAU,GAA0C,IAAI,GAAG,EAAE,CAAC;QACpE,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,IAAI,SACR,CAAC,CAAC,SAAS,EAAE,CAAC,sBAAsB,CAAC,mCACrC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC;gBACrB,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,uBAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC9D,YAAY,CAAC;YACjB,iBAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;gBACpC,IAAI;gBACJ,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,OAAO;gBACjB,MAAM,EAAE,EAAE;aACX,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;QAED,MAAM,WAAW,GAA+B,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QACzE,KAAK,MAAM,GAAG,IAAI,WAAW,EAA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,EAAE,IAAI,CAAC;SACvB,OAAO,CAAC,2BAA2B,EAAE,GAAG,CAAC;SACzC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,OAAO,uDAAuD,CAAC,IAAI,CAAC,IAAI,CAAC;QACvE,CAAC,CAAC,IAAI,IAAI,EAAE;QACZ,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,CAAW,EAAE,CAAW,EAAE,EAAE;IACjD,MAAM,CAAC,GAAW,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;IAChE,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
@@ -42,10 +42,16 @@ let NestiaMigrateControllerAnalyzer;
42
42
  */
43
43
  const ROUTER_RESERVED = /[\\:*?+!(){}[\]]/g;
44
44
  /**
45
- * A route segment as a directory name: unescaped, and each character a file
46
- * name cannot hold on Windows (`:` of an AIP custom method, `*`, `?`) as `_`.
45
+ * Maps a route segment to a portable directory component. Router escapes are
46
+ * removed, Windows-invalid characters and trailing dots/spaces become
47
+ * underscores, and reserved device names receive an underscore prefix. Distinct
48
+ * route segments may share a directory; controller files retain their
49
+ * independently assigned controller names.
47
50
  */
48
- const directoryName = (segment) => segment.replace(/\\(.)/g, "$1").replace(/[<>:"|?*\\]/g, "_");
51
+ const directoryName = (segment) => {
52
+ const name = segment.replace(/\\(.)/g, "$1").replace(/[<>:"|?*\\\u0000-\u001f]/g, "_").replace(/[. ]+$/, (suffix) => "_".repeat(suffix.length));
53
+ return /^(?:CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³])(?:\.|$)/i.test(name) ? `_${name}` : name || "_";
54
+ };
49
55
  const getSplitIndex = (x, y) => {
50
56
  const n = Math.min(x.length, y.length);
51
57
  for (let i = 0; i < n; ++i) if (x[i] !== y[i]) return i;
@@ -1,4 +1,38 @@
1
+ /**
2
+ * Writes a file map into a directory through injected file-system functions.
3
+ *
4
+ * Each path is the root, a `/` and the key's `/`-separated segments, a spelling
5
+ * the filesystem calls of every supported platform accept, and creation and
6
+ * writing are delegated to injected functions, so the caller's filesystem
7
+ * decides existence, case policy and permissions. Directories are created one
8
+ * segment at a time because the injected creator is not recursive. Remaining
9
+ * assumptions: keys are trusted generated names, since a `..` or absolute
10
+ * segment would leave the root, and on a case-insensitive volume two keys that
11
+ * differ only in case write to the same file.
12
+ *
13
+ * @evidence contracts/common.md#principled-implementation Directories are created one path prefix at a time, each once, through a memoized creator, and the files are then written in the order of the map; injecting the functions keeps the archiver independent of Node and of the browser.
14
+ * @evidence contracts/common.md#clear-and-simple-design One function with one memoized directory creator.
15
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It writes exactly the given files, and injection is the supported boundary for the platform.
16
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
17
+ */
1
18
  export declare namespace NestiaMigrateFileArchiver {
19
+ /**
20
+ * Writes every file of `files` below `root`, creating the directories on the
21
+ * way.
22
+ *
23
+ * A directory that cannot be created is not reported, because the creator is
24
+ * also called for a directory that already exists; the failure surfaces when
25
+ * the file is written.
26
+ *
27
+ * The memo of created directories is keyed by the spelled path, so on a
28
+ * case-insensitive volume a second spelling attempts the creation again and
29
+ * receives the already-exists error, which is the swallowed outcome.
30
+ *
31
+ * @evidence contracts/common.md#principled-implementation The root and each prefix of each file's directory are created once, in order, before the file is written, and a creation failure is deferred to the write that needs the directory, since the injected creator is not recursive and reports an existing directory as an error.
32
+ * @evidence contracts/common.md#clear-and-simple-design One function; the memoized creator makes a repeated directory a no-op.
33
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The dropped creation error is a stated consequence of the non-recursive creator, and the write still fails loudly when the directory is missing.
34
+ * @evidence contracts/common.md#meaningful-documentation The comment states the order of creation and the deferred error.
35
+ */
2
36
  const archive: (props: {
3
37
  mkdir: (path: string) => Promise<void>;
4
38
  writeFile: (path: string, content: string) => Promise<void>;
@@ -11,8 +11,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.NestiaMigrateFileArchiver = void 0;
13
13
  const tstl_1 = require("tstl");
14
+ /**
15
+ * Writes a file map into a directory through injected file-system functions.
16
+ *
17
+ * Each path is the root, a `/` and the key's `/`-separated segments, a spelling
18
+ * the filesystem calls of every supported platform accept, and creation and
19
+ * writing are delegated to injected functions, so the caller's filesystem
20
+ * decides existence, case policy and permissions. Directories are created one
21
+ * segment at a time because the injected creator is not recursive. Remaining
22
+ * assumptions: keys are trusted generated names, since a `..` or absolute
23
+ * segment would leave the root, and on a case-insensitive volume two keys that
24
+ * differ only in case write to the same file.
25
+ *
26
+ * @evidence contracts/common.md#principled-implementation Directories are created one path prefix at a time, each once, through a memoized creator, and the files are then written in the order of the map; injecting the functions keeps the archiver independent of Node and of the browser.
27
+ * @evidence contracts/common.md#clear-and-simple-design One function with one memoized directory creator.
28
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It writes exactly the given files, and injection is the supported boundary for the platform.
29
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
30
+ */
14
31
  var NestiaMigrateFileArchiver;
15
32
  (function (NestiaMigrateFileArchiver) {
33
+ /**
34
+ * Writes every file of `files` below `root`, creating the directories on the
35
+ * way.
36
+ *
37
+ * A directory that cannot be created is not reported, because the creator is
38
+ * also called for a directory that already exists; the failure surfaces when
39
+ * the file is written.
40
+ *
41
+ * The memo of created directories is keyed by the spelled path, so on a
42
+ * case-insensitive volume a second spelling attempts the creation again and
43
+ * receives the already-exists error, which is the swallowed outcome.
44
+ *
45
+ * @evidence contracts/common.md#principled-implementation The root and each prefix of each file's directory are created once, in order, before the file is written, and a creation failure is deferred to the write that needs the directory, since the injected creator is not recursive and reports an existing directory as an error.
46
+ * @evidence contracts/common.md#clear-and-simple-design One function; the memoized creator makes a repeated directory a no-op.
47
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The dropped creation error is a stated consequence of the non-recursive creator, and the write still fails loudly when the directory is missing.
48
+ * @evidence contracts/common.md#meaningful-documentation The comment states the order of creation and the deferred error.
49
+ */
16
50
  NestiaMigrateFileArchiver.archive = (props) => __awaiter(this, void 0, void 0, function* () {
17
51
  const mkdir = new tstl_1.VariadicSingleton((location) => __awaiter(this, void 0, void 0, function* () {
18
52
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateFileArchiver.js","sourceRoot":"","sources":["../../src/archivers/NestiaMigrateFileArchiver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAyC;AAEzC,IAAiB,yBAAyB,CA6BzC;AA7BD,WAAiB,yBAAyB;IAC3B,iCAAO,GAAG,CAAO,KAK7B,EAAiB,EAAE;QAClB,MAAM,KAAK,GAAG,IAAI,wBAAiB,CACjC,CAAO,QAAgB,EAAiB,EAAE;YACxC,IAAI,CAAC;gBACH,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC,CAAC;YACjD,CAAC;uBAAO,CAAC,CAAA,CAAC;QACZ,CAAC,CAAA,CACF,CAAC;QACF,MAAM,OAAO,GAAG,CAAO,QAAgB,EAAiB,EAAE;YACxD,MAAM,QAAQ,GAAa,QAAQ;iBAChC,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAA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ACZ,CAAC,CAAA,CACF,CAAC;QACF,MAAM,OAAO,GAAG,CAAO,QAAgB,EAAiB,EAAE;YACxD,MAAM,QAAQ,GAAa,QAAQ;iBAChC,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC9D,KAAK,MAAM,CAAC,IAAI,QAAQ;gBAAE,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAA,CAAC;QACF,oEAAoE;QACpE,wEAAwE;QACxE,sDAAsD;QACtD,MAAM,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACvD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACrD,MAAM,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC;IACH,CAAC,CAAA,CAAC;AACJ,CAAC,EA9CgB,yBAAyB,aAAzB,yBAAyB,GAAzB,yBAAyB,QA8CzC"}
@@ -52,7 +52,7 @@ exports.NEST_TEMPLATE = {
52
52
  "packages/backend/test/webpack.ts": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport cp from \"node:child_process\";\nimport { sleep_for } from \"tstl\";\n\nimport { MyConfiguration } from \"../src/MyConfiguration\";\nimport { MyGlobal } from \"../src/MyGlobal\";\nimport { TestAutomation } from \"./helpers/TestAutomation\";\nimport { TestAutomationStdio } from \"./helpers/TestAutomationStdio\";\n\nconst wait = async (): Promise<void> => {\n while (true)\n try {\n await fetch(`http://localhost:${MyConfiguration.API_PORT()}/dsafdsafsd`);\n return;\n } catch (exp) {\n await sleep_for(100);\n }\n};\n\nconst main = async (): Promise<void> => {\n MyGlobal.testing = true;\n\n const report: DynamicExecutor.IReport = await TestAutomation.execute({\n open: async () => {\n const backend: cp.ChildProcess = cp.fork(\n `${MyConfiguration.ROOT}/dist/server.js`,\n {\n cwd: `${MyConfiguration.ROOT}/dist`,\n },\n );\n await wait();\n return backend;\n },\n close: async (backend) => {\n backend.kill();\n },\n options: await TestAutomationStdio.getOptions(),\n onComplete: TestAutomationStdio.onComplete,\n });\n TestAutomationStdio.report(report);\n};\nmain().catch((exp: unknown) => {\n console.log(exp);\n process.exit(-1);\n});\n",
53
53
  "packages/backend/tsconfig.json": "{\n \"extends\": \"../../config/tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"lib\",\n \"rootDir\": \"src\",\n \"experimentalDecorators\": true,\n \"emitDecoratorMetadata\": true\n },\n \"include\": [\"src\"]\n}\n",
54
54
  "packages/backend/webpack.config.js": "const path = require(\"path\");\n\nconst CopyWebpackPlugin = require(\"copy-webpack-plugin\");\nconst WriteFilePlugin = require(\"write-file-webpack-plugin\");\nconst { IgnorePlugin } = require(\"webpack\");\n\nconst lazyImports = [\n \"@modelcontextprotocol/sdk\",\n \"@fastify/static\",\n \"@fastify/view\",\n \"@nestjs/microservices\",\n \"@nestjs/websockets\",\n \"class-transformer\",\n \"class-validator\",\n];\n\n// @reference https://tech-blog.s-yoshiki.com/entry/297\nmodule.exports = {\n // CUSTOMIZE HERE\n entry: {\n server: \"./lib/executable/server.js\",\n },\n output: {\n path: path.join(__dirname, \"dist\"),\n filename: \"[name].js\",\n },\n optimization: {\n minimize: true,\n },\n\n // JUST KEEP THEM\n mode: \"production\",\n target: \"node\",\n plugins: [\n new CopyWebpackPlugin({\n patterns: [\n {\n from: \".env\",\n to: \"[name][ext]\",\n },\n ],\n }),\n new WriteFilePlugin(),\n new IgnorePlugin({\n checkResource: (resource) => {\n if (lazyImports.some((modulo) => resource.startsWith(modulo))) {\n try {\n require.resolve(resource);\n } catch (err) {\n return true;\n }\n }\n return false;\n },\n }),\n ],\n};\n",
55
- "pnpm-workspace.yaml": "packages:\n - \"config\"\n - \"packages/*\"\ncatalogs:\n samchon:\n \"@nestia/benchmark\": ^14.0.1\n \"@nestia/core\": ^14.0.1\n \"@nestia/e2e\": ^14.0.1\n \"@nestia/fetcher\": ^14.0.1\n \"@nestia/sdk\": ^14.0.1\n nestia: ^14.0.1\n tgrid: ^1.2.1\n tstl: ^3.0.0\n typia: 15.0.0\n rolldown:\n rolldown: ^1.1.5\n utils:\n rimraf: ^6.1.3\n uuid: ^13.0.0\n typescript:\n \"@ttsc/lint\": ^0.18.2\n \"@ttsc/paths\": ^0.18.2\n \"@ttsc/unplugin\": ^0.28.1\n ttsc: ^0.28.1\n typescript: ^7.0.2\n",
55
+ "pnpm-workspace.yaml": "packages:\n - \"config\"\n - \"packages/*\"\ncatalogs:\n samchon:\n \"@nestia/benchmark\": ^14.0.3\n \"@nestia/core\": ^14.0.3\n \"@nestia/e2e\": ^14.0.3\n \"@nestia/fetcher\": ^14.0.3\n \"@nestia/sdk\": ^14.0.3\n nestia: ^14.0.3\n tgrid: ^1.2.1\n tstl: ^3.0.0\n typia: 15.0.0\n rolldown:\n rolldown: ^1.1.5\n utils:\n rimraf: ^6.1.3\n uuid: ^13.0.0\n typescript:\n \"@ttsc/lint\": ^0.18.2\n \"@ttsc/paths\": ^0.18.2\n \"@ttsc/unplugin\": ^0.28.1\n ttsc: ^0.28.1\n typescript: ^7.0.2\n",
56
56
  "typos.toml": "[default]\nlocale = 'en-us'\nextend-ignore-re = [\n \"(?Rm)^.*(<!--|#|//)\\\\s*spellchecker:disable-line(-->|\\n)?$\",\n \"(?s)(<!--|#|//)\\\\s*spellchecker:off\\\\s*(-->|\\n).*?(<!--|#|//)\\\\s*spellchecker:on\",\n]\n\n[default.extend-words]\nJeongho = \"Jeongho\"\nNam = \"Nam\"\ntypia = \"typia\"\n\n[files]\nextend-exclude = [\"*.json\"]"
57
57
  };
58
58
  //# sourceMappingURL=NEST_TEMPLATE.js.map
@@ -50,7 +50,7 @@ const NEST_TEMPLATE = {
50
50
  "packages/backend/test/webpack.ts": "import { DynamicExecutor } from \"@nestia/e2e\";\nimport cp from \"node:child_process\";\nimport { sleep_for } from \"tstl\";\n\nimport { MyConfiguration } from \"../src/MyConfiguration\";\nimport { MyGlobal } from \"../src/MyGlobal\";\nimport { TestAutomation } from \"./helpers/TestAutomation\";\nimport { TestAutomationStdio } from \"./helpers/TestAutomationStdio\";\n\nconst wait = async (): Promise<void> => {\n while (true)\n try {\n await fetch(`http://localhost:${MyConfiguration.API_PORT()}/dsafdsafsd`);\n return;\n } catch (exp) {\n await sleep_for(100);\n }\n};\n\nconst main = async (): Promise<void> => {\n MyGlobal.testing = true;\n\n const report: DynamicExecutor.IReport = await TestAutomation.execute({\n open: async () => {\n const backend: cp.ChildProcess = cp.fork(\n `${MyConfiguration.ROOT}/dist/server.js`,\n {\n cwd: `${MyConfiguration.ROOT}/dist`,\n },\n );\n await wait();\n return backend;\n },\n close: async (backend) => {\n backend.kill();\n },\n options: await TestAutomationStdio.getOptions(),\n onComplete: TestAutomationStdio.onComplete,\n });\n TestAutomationStdio.report(report);\n};\nmain().catch((exp: unknown) => {\n console.log(exp);\n process.exit(-1);\n});\n",
51
51
  "packages/backend/tsconfig.json": "{\n \"extends\": \"../../config/tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"lib\",\n \"rootDir\": \"src\",\n \"experimentalDecorators\": true,\n \"emitDecoratorMetadata\": true\n },\n \"include\": [\"src\"]\n}\n",
52
52
  "packages/backend/webpack.config.js": "const path = require(\"path\");\n\nconst CopyWebpackPlugin = require(\"copy-webpack-plugin\");\nconst WriteFilePlugin = require(\"write-file-webpack-plugin\");\nconst { IgnorePlugin } = require(\"webpack\");\n\nconst lazyImports = [\n \"@modelcontextprotocol/sdk\",\n \"@fastify/static\",\n \"@fastify/view\",\n \"@nestjs/microservices\",\n \"@nestjs/websockets\",\n \"class-transformer\",\n \"class-validator\",\n];\n\n// @reference https://tech-blog.s-yoshiki.com/entry/297\nmodule.exports = {\n // CUSTOMIZE HERE\n entry: {\n server: \"./lib/executable/server.js\",\n },\n output: {\n path: path.join(__dirname, \"dist\"),\n filename: \"[name].js\",\n },\n optimization: {\n minimize: true,\n },\n\n // JUST KEEP THEM\n mode: \"production\",\n target: \"node\",\n plugins: [\n new CopyWebpackPlugin({\n patterns: [\n {\n from: \".env\",\n to: \"[name][ext]\",\n },\n ],\n }),\n new WriteFilePlugin(),\n new IgnorePlugin({\n checkResource: (resource) => {\n if (lazyImports.some((modulo) => resource.startsWith(modulo))) {\n try {\n require.resolve(resource);\n } catch (err) {\n return true;\n }\n }\n return false;\n },\n }),\n ],\n};\n",
53
- "pnpm-workspace.yaml": "packages:\n - \"config\"\n - \"packages/*\"\ncatalogs:\n samchon:\n \"@nestia/benchmark\": ^14.0.1\n \"@nestia/core\": ^14.0.1\n \"@nestia/e2e\": ^14.0.1\n \"@nestia/fetcher\": ^14.0.1\n \"@nestia/sdk\": ^14.0.1\n nestia: ^14.0.1\n tgrid: ^1.2.1\n tstl: ^3.0.0\n typia: 15.0.0\n rolldown:\n rolldown: ^1.1.5\n utils:\n rimraf: ^6.1.3\n uuid: ^13.0.0\n typescript:\n \"@ttsc/lint\": ^0.18.2\n \"@ttsc/paths\": ^0.18.2\n \"@ttsc/unplugin\": ^0.28.1\n ttsc: ^0.28.1\n typescript: ^7.0.2\n",
53
+ "pnpm-workspace.yaml": "packages:\n - \"config\"\n - \"packages/*\"\ncatalogs:\n samchon:\n \"@nestia/benchmark\": ^14.0.3\n \"@nestia/core\": ^14.0.3\n \"@nestia/e2e\": ^14.0.3\n \"@nestia/fetcher\": ^14.0.3\n \"@nestia/sdk\": ^14.0.3\n nestia: ^14.0.3\n tgrid: ^1.2.1\n tstl: ^3.0.0\n typia: 15.0.0\n rolldown:\n rolldown: ^1.1.5\n utils:\n rimraf: ^6.1.3\n uuid: ^13.0.0\n typescript:\n \"@ttsc/lint\": ^0.18.2\n \"@ttsc/paths\": ^0.18.2\n \"@ttsc/unplugin\": ^0.28.1\n ttsc: ^0.28.1\n typescript: ^7.0.2\n",
54
54
  "typos.toml": "[default]\nlocale = 'en-us'\nextend-ignore-re = [\n \"(?Rm)^.*(<!--|#|//)\\\\s*spellchecker:disable-line(-->|\\n)?$\",\n \"(?s)(<!--|#|//)\\\\s*spellchecker:off\\\\s*(-->|\\n).*?(<!--|#|//)\\\\s*spellchecker:on\",\n]\n\n[default.extend-words]\nJeongho = \"Jeongho\"\nNam = \"Nam\"\ntypia = \"typia\"\n\n[files]\nextend-exclude = [\"*.json\"]"
55
55
  };
56
56
  //#endregion
@@ -8,7 +8,7 @@ exports.SDK_TEMPLATE = {
8
8
  "LICENSE": "MIT License\n\nCopyright (c) 2024 Jeongho Nam\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
9
9
  "README.md": "# Software Development Kit\nThis is a SDK library generated by [`@nestia/migrate`](https://nestia.io/docs/migrate) or [`@nestia/editor`](https://nestia.io/docs/editor).\n\nWith this SDK library, you can easily and safely interact with backend server.\n\nJust import and call some API functions like gif image below:\n\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\n\n> Left is server code, and right is client code utilizing the SDK\n\n\n\n\n## How to Test\n```bash\npnpm install\npnpm run start # run only \"test/start.ts\" file\npnpm run test # everything under the \"test/features\" directory\npnpm run test:simulate # \"test/features\" with mockup simulation mode\n```\n\nIf you run `pnpm run start` command, only [test/start.ts](test/start.ts) file would be executed.\n\nOtherwise you run `pnpm run test` command instead, run everything in the [test/features](test/features) directory.\n\nFor reference, the [test/features](test/features) directory and E2E test functions (for each API endpoints) would be automatically composed only when you've configured the \"E2E test function generation mode\" of the `@nestia/migrate` (or `@nestia/editor`).\n\n```bash\npnpm dlx @nestia/migrate\n? Migration mode (Use arrow keys):\n NestJS\n > SDK\n? Swagger file location: assets/input/clickhouse.json\n? Output directory path: assets/output/clickhouse-sdk-manual\n? Mokup Simulator: true\n? E2E Test Functions: true\n```\n\n\n\n\n## Deploy\n```bash\npnpm install\npnpm run deploy\n```\n\nJust run `pnpm run deploy` command, then your SDK library would be published.\n\nBy the way, the initial package name of this template repository is `@ORGANIZATION/PROJECT-api`. I think it would better to change the word to your own organization and project name. If you're utilizing `VsCode`, you can do it through `Edit > Replace in Files` (*Ctrl + Shift + H*) feature.\n\n-----------\n\n> ## What [`Nestia`](https://nestia.io) is:\n> ![Nestia Logo](https://nestia.io/logo.png)\n> \n> [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\n> [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n> [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n> [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\n> [![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\n> \n> Nestia is a set of helper libraries for NestJS, supporting below features:\n> \n> - `@nestia/core`: Super-fast decorators\n> - `@nestia/sdk`:\n> - Swagger generator evolved than ever\n> - SDK library generator for clients\n> - Mockup Simulator for client applications\n> - Automatic E2E test functions generator\n> - `@nestia/migrate`: Migration from Swagger to NestJS\n> - `@nestia/editor`: Online TypeScript Swagger Editor\n> - `nestia`: Just CLI (command line interface) tool\n> \n>> **Note**\n>> \n>> - **Only one line** required, with pure TypeScript type\n>> - Enhance performance **30x** up\n>> - Runtime validator is **20,000x faster** than `class-validator`\n>> - JSON serialization is **200x faster** than `class-transformer`\n>> - Software Development Kit\n>> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://> trpc.io/)\n>> - Mockup simulator means embedded backend simulator in SDK\n>> - similar with [msw](https://mswjs.io/), but fully automated\n",
10
10
  "hello.js": "function print(command, description) {\n return console.log(`\\x1b[1m${command}\\x1b[2m: ${description}\\x1b[0m`);\n}\n\nconsole.log(\"-----------------------------------------\");\nconsole.log(\"\\x1b[7mGenerated by \\x1b[2m@nestia/editor\\x1b[0m\");\nconsole.log(\"\");\nconsole.log(\" - \\x1b[36mhttps://nestia.io/docs/editor\\x1b[0m\");\nconsole.log(\" - \\x1b[36mhttps://github.com/samchon/nestia\\x1b[0m\");\nconsole.log(\"-----------------------------------------\");\n\nprint(\"pnpm run start\", \"Run only test/start.ts\");\nprint(\"pnpm run test\", \"Run every test/features/**/*.ts files\");\nprint(\"pnpm run test:simulate\", \"Test with mockup simulator\");\n",
11
- "package.json": "{\n \"name\": \"@ORGANIZATION/PROJECT-api\",\n \"version\": \"0.1.0\",\n \"description\": \"SDK library generated by Nestia\",\n \"main\": \"src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./lib/*\": \"./src/*.ts\",\n \"./package.json\": \"./package.json\"\n },\n \"publishConfig\": {\n \"main\": \"lib/index.mjs\",\n \"module\": \"lib/index.mjs\",\n \"types\": \"lib/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/index.d.ts\",\n \"import\": \"./lib/index.mjs\",\n \"default\": \"./lib/index.js\"\n },\n \"./lib/*\": {\n \"types\": \"./lib/*.d.ts\",\n \"import\": \"./lib/*.mjs\",\n \"default\": \"./lib/*.js\"\n },\n \"./package.json\": \"./package.json\"\n }\n },\n \"scripts\": {\n \"build\": \"rimraf lib && ttsc && rolldown -c\",\n \"build:test\": \"rimraf bin && ttsc --project test/tsconfig.json\",\n \"deploy\": \"pnpm run build && pnpm publish\",\n \"dev\": \"pnpm run build:test --watch\",\n \"hello\": \"node hello\",\n \"start\": \"ttsx test/start.ts\",\n \"swagger\": \"ttsx test/swagger.ts\",\n \"test\": \"ttsx test/index.ts\",\n \"test:simulate\": \"ttsx test/index.ts --simulate true\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia\"\n },\n \"author\": \"Jeongho Nam\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia/issues\"\n },\n \"homepage\": \"https://nestia.io\",\n \"files\": [\n \"lib\",\n \"swagger.json\",\n \"package.json\",\n \"README.md\"\n ],\n \"dependencies\": {\n \"@nestia/fetcher\": \"^14.0.1\",\n \"tgrid\": \"^1.2.1\",\n \"typia\": \"15.0.0\"\n },\n \"devDependencies\": {\n \"@nestia/e2e\": \"^14.0.1\",\n \"@ttsc/unplugin\": \"^0.28.1\",\n \"@types/express\": \"^4.17.21\",\n \"@types/swagger-ui-express\": \"^4.1.6\",\n \"chalk\": \"4.1.2\",\n \"express\": \"^4.19.2\",\n \"rimraf\": \"^5.0.5\",\n \"rolldown\": \"^1.1.5\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"tinyglobby\": \"^0.2.17\",\n \"ttsc\": \"^0.28.1\",\n \"typescript\": \"^7.0.2\",\n \"@nestia/core\": \"^14.0.1\"\n },\n \"packageManager\": \"pnpm@10.19.0\"\n}",
11
+ "package.json": "{\n \"name\": \"@ORGANIZATION/PROJECT-api\",\n \"version\": \"0.1.0\",\n \"description\": \"SDK library generated by Nestia\",\n \"main\": \"src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./lib/*\": \"./src/*.ts\",\n \"./package.json\": \"./package.json\"\n },\n \"publishConfig\": {\n \"main\": \"lib/index.mjs\",\n \"module\": \"lib/index.mjs\",\n \"types\": \"lib/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/index.d.ts\",\n \"import\": \"./lib/index.mjs\",\n \"default\": \"./lib/index.js\"\n },\n \"./lib/*\": {\n \"types\": \"./lib/*.d.ts\",\n \"import\": \"./lib/*.mjs\",\n \"default\": \"./lib/*.js\"\n },\n \"./package.json\": \"./package.json\"\n }\n },\n \"scripts\": {\n \"build\": \"rimraf lib && ttsc && rolldown -c\",\n \"build:test\": \"rimraf bin && ttsc --project test/tsconfig.json\",\n \"deploy\": \"pnpm run build && pnpm publish\",\n \"dev\": \"pnpm run build:test --watch\",\n \"hello\": \"node hello\",\n \"start\": \"ttsx test/start.ts\",\n \"swagger\": \"ttsx test/swagger.ts\",\n \"test\": \"ttsx test/index.ts\",\n \"test:simulate\": \"ttsx test/index.ts --simulate true\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia\"\n },\n \"author\": \"Jeongho Nam\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia/issues\"\n },\n \"homepage\": \"https://nestia.io\",\n \"files\": [\n \"lib\",\n \"swagger.json\",\n \"package.json\",\n \"README.md\"\n ],\n \"dependencies\": {\n \"@nestia/fetcher\": \"^14.0.3\",\n \"tgrid\": \"^1.2.1\",\n \"typia\": \"15.0.0\"\n },\n \"devDependencies\": {\n \"@nestia/e2e\": \"^14.0.3\",\n \"@ttsc/unplugin\": \"^0.28.1\",\n \"@types/express\": \"^4.17.21\",\n \"@types/swagger-ui-express\": \"^4.1.6\",\n \"chalk\": \"4.1.2\",\n \"express\": \"^4.19.2\",\n \"rimraf\": \"^5.0.5\",\n \"rolldown\": \"^1.1.5\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"tinyglobby\": \"^0.2.17\",\n \"ttsc\": \"^0.28.1\",\n \"typescript\": \"^7.0.2\",\n \"@nestia/core\": \"^14.0.3\"\n },\n \"packageManager\": \"pnpm@10.19.0\"\n}",
12
12
  "rolldown.config.mjs": "import ttsc from \"@ttsc/unplugin/rolldown\";\nimport path from \"node:path\";\nimport { globSync } from \"tinyglobby\";\n\nexport default {\n input: globSync(\"./src/**/*.ts\"),\n external: (id) => !id.startsWith(\".\") && !path.isAbsolute(id),\n output: {\n dir: \"./lib\",\n format: \"esm\",\n sourcemap: true,\n entryFileNames: \"[name].mjs\",\n preserveModules: true,\n preserveModulesRoot: \"src\",\n },\n plugins: [ttsc()],\n};\n",
13
13
  "src/HttpError.ts": "export { HttpError } from \"@nestia/fetcher\";\n",
14
14
  "src/IConnection.ts": "export type { IConnection } from \"@nestia/fetcher\";\n",
@@ -6,7 +6,7 @@ const SDK_TEMPLATE = {
6
6
  "LICENSE": "MIT License\n\nCopyright (c) 2024 Jeongho Nam\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
7
7
  "README.md": "# Software Development Kit\nThis is a SDK library generated by [`@nestia/migrate`](https://nestia.io/docs/migrate) or [`@nestia/editor`](https://nestia.io/docs/editor).\n\nWith this SDK library, you can easily and safely interact with backend server.\n\nJust import and call some API functions like gif image below:\n\n![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)\n\n> Left is server code, and right is client code utilizing the SDK\n\n\n\n\n## How to Test\n```bash\npnpm install\npnpm run start # run only \"test/start.ts\" file\npnpm run test # everything under the \"test/features\" directory\npnpm run test:simulate # \"test/features\" with mockup simulation mode\n```\n\nIf you run `pnpm run start` command, only [test/start.ts](test/start.ts) file would be executed.\n\nOtherwise you run `pnpm run test` command instead, run everything in the [test/features](test/features) directory.\n\nFor reference, the [test/features](test/features) directory and E2E test functions (for each API endpoints) would be automatically composed only when you've configured the \"E2E test function generation mode\" of the `@nestia/migrate` (or `@nestia/editor`).\n\n```bash\npnpm dlx @nestia/migrate\n? Migration mode (Use arrow keys):\n NestJS\n > SDK\n? Swagger file location: assets/input/clickhouse.json\n? Output directory path: assets/output/clickhouse-sdk-manual\n? Mokup Simulator: true\n? E2E Test Functions: true\n```\n\n\n\n\n## Deploy\n```bash\npnpm install\npnpm run deploy\n```\n\nJust run `pnpm run deploy` command, then your SDK library would be published.\n\nBy the way, the initial package name of this template repository is `@ORGANIZATION/PROJECT-api`. I think it would better to change the word to your own organization and project name. If you're utilizing `VsCode`, you can do it through `Edit > Replace in Files` (*Ctrl + Shift + H*) feature.\n\n-----------\n\n> ## What [`Nestia`](https://nestia.io) is:\n> ![Nestia Logo](https://nestia.io/logo.png)\n> \n> [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)\n> [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n> [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)\n> [![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)\n> [![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)\n> \n> Nestia is a set of helper libraries for NestJS, supporting below features:\n> \n> - `@nestia/core`: Super-fast decorators\n> - `@nestia/sdk`:\n> - Swagger generator evolved than ever\n> - SDK library generator for clients\n> - Mockup Simulator for client applications\n> - Automatic E2E test functions generator\n> - `@nestia/migrate`: Migration from Swagger to NestJS\n> - `@nestia/editor`: Online TypeScript Swagger Editor\n> - `nestia`: Just CLI (command line interface) tool\n> \n>> **Note**\n>> \n>> - **Only one line** required, with pure TypeScript type\n>> - Enhance performance **30x** up\n>> - Runtime validator is **20,000x faster** than `class-validator`\n>> - JSON serialization is **200x faster** than `class-transformer`\n>> - Software Development Kit\n>> - SDK is a collection of `fetch` functions with type definitions like [tRPC](https://> trpc.io/)\n>> - Mockup simulator means embedded backend simulator in SDK\n>> - similar with [msw](https://mswjs.io/), but fully automated\n",
8
8
  "hello.js": "function print(command, description) {\n return console.log(`\\x1b[1m${command}\\x1b[2m: ${description}\\x1b[0m`);\n}\n\nconsole.log(\"-----------------------------------------\");\nconsole.log(\"\\x1b[7mGenerated by \\x1b[2m@nestia/editor\\x1b[0m\");\nconsole.log(\"\");\nconsole.log(\" - \\x1b[36mhttps://nestia.io/docs/editor\\x1b[0m\");\nconsole.log(\" - \\x1b[36mhttps://github.com/samchon/nestia\\x1b[0m\");\nconsole.log(\"-----------------------------------------\");\n\nprint(\"pnpm run start\", \"Run only test/start.ts\");\nprint(\"pnpm run test\", \"Run every test/features/**/*.ts files\");\nprint(\"pnpm run test:simulate\", \"Test with mockup simulator\");\n",
9
- "package.json": "{\n \"name\": \"@ORGANIZATION/PROJECT-api\",\n \"version\": \"0.1.0\",\n \"description\": \"SDK library generated by Nestia\",\n \"main\": \"src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./lib/*\": \"./src/*.ts\",\n \"./package.json\": \"./package.json\"\n },\n \"publishConfig\": {\n \"main\": \"lib/index.mjs\",\n \"module\": \"lib/index.mjs\",\n \"types\": \"lib/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/index.d.ts\",\n \"import\": \"./lib/index.mjs\",\n \"default\": \"./lib/index.js\"\n },\n \"./lib/*\": {\n \"types\": \"./lib/*.d.ts\",\n \"import\": \"./lib/*.mjs\",\n \"default\": \"./lib/*.js\"\n },\n \"./package.json\": \"./package.json\"\n }\n },\n \"scripts\": {\n \"build\": \"rimraf lib && ttsc && rolldown -c\",\n \"build:test\": \"rimraf bin && ttsc --project test/tsconfig.json\",\n \"deploy\": \"pnpm run build && pnpm publish\",\n \"dev\": \"pnpm run build:test --watch\",\n \"hello\": \"node hello\",\n \"start\": \"ttsx test/start.ts\",\n \"swagger\": \"ttsx test/swagger.ts\",\n \"test\": \"ttsx test/index.ts\",\n \"test:simulate\": \"ttsx test/index.ts --simulate true\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia\"\n },\n \"author\": \"Jeongho Nam\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia/issues\"\n },\n \"homepage\": \"https://nestia.io\",\n \"files\": [\n \"lib\",\n \"swagger.json\",\n \"package.json\",\n \"README.md\"\n ],\n \"dependencies\": {\n \"@nestia/fetcher\": \"^14.0.1\",\n \"tgrid\": \"^1.2.1\",\n \"typia\": \"15.0.0\"\n },\n \"devDependencies\": {\n \"@nestia/e2e\": \"^14.0.1\",\n \"@ttsc/unplugin\": \"^0.28.1\",\n \"@types/express\": \"^4.17.21\",\n \"@types/swagger-ui-express\": \"^4.1.6\",\n \"chalk\": \"4.1.2\",\n \"express\": \"^4.19.2\",\n \"rimraf\": \"^5.0.5\",\n \"rolldown\": \"^1.1.5\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"tinyglobby\": \"^0.2.17\",\n \"ttsc\": \"^0.28.1\",\n \"typescript\": \"^7.0.2\",\n \"@nestia/core\": \"^14.0.1\"\n },\n \"packageManager\": \"pnpm@10.19.0\"\n}",
9
+ "package.json": "{\n \"name\": \"@ORGANIZATION/PROJECT-api\",\n \"version\": \"0.1.0\",\n \"description\": \"SDK library generated by Nestia\",\n \"main\": \"src/index.ts\",\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./lib/*\": \"./src/*.ts\",\n \"./package.json\": \"./package.json\"\n },\n \"publishConfig\": {\n \"main\": \"lib/index.mjs\",\n \"module\": \"lib/index.mjs\",\n \"types\": \"lib/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/index.d.ts\",\n \"import\": \"./lib/index.mjs\",\n \"default\": \"./lib/index.js\"\n },\n \"./lib/*\": {\n \"types\": \"./lib/*.d.ts\",\n \"import\": \"./lib/*.mjs\",\n \"default\": \"./lib/*.js\"\n },\n \"./package.json\": \"./package.json\"\n }\n },\n \"scripts\": {\n \"build\": \"rimraf lib && ttsc && rolldown -c\",\n \"build:test\": \"rimraf bin && ttsc --project test/tsconfig.json\",\n \"deploy\": \"pnpm run build && pnpm publish\",\n \"dev\": \"pnpm run build:test --watch\",\n \"hello\": \"node hello\",\n \"start\": \"ttsx test/start.ts\",\n \"swagger\": \"ttsx test/swagger.ts\",\n \"test\": \"ttsx test/index.ts\",\n \"test:simulate\": \"ttsx test/index.ts --simulate true\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/samchon/nestia\"\n },\n \"author\": \"Jeongho Nam\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/samchon/nestia/issues\"\n },\n \"homepage\": \"https://nestia.io\",\n \"files\": [\n \"lib\",\n \"swagger.json\",\n \"package.json\",\n \"README.md\"\n ],\n \"dependencies\": {\n \"@nestia/fetcher\": \"^14.0.3\",\n \"tgrid\": \"^1.2.1\",\n \"typia\": \"15.0.0\"\n },\n \"devDependencies\": {\n \"@nestia/e2e\": \"^14.0.3\",\n \"@ttsc/unplugin\": \"^0.28.1\",\n \"@types/express\": \"^4.17.21\",\n \"@types/swagger-ui-express\": \"^4.1.6\",\n \"chalk\": \"4.1.2\",\n \"express\": \"^4.19.2\",\n \"rimraf\": \"^5.0.5\",\n \"rolldown\": \"^1.1.5\",\n \"swagger-ui-express\": \"^5.0.0\",\n \"tinyglobby\": \"^0.2.17\",\n \"ttsc\": \"^0.28.1\",\n \"typescript\": \"^7.0.2\",\n \"@nestia/core\": \"^14.0.3\"\n },\n \"packageManager\": \"pnpm@10.19.0\"\n}",
10
10
  "rolldown.config.mjs": "import ttsc from \"@ttsc/unplugin/rolldown\";\nimport path from \"node:path\";\nimport { globSync } from \"tinyglobby\";\n\nexport default {\n input: globSync(\"./src/**/*.ts\"),\n external: (id) => !id.startsWith(\".\") && !path.isAbsolute(id),\n output: {\n dir: \"./lib\",\n format: \"esm\",\n sourcemap: true,\n entryFileNames: \"[name].mjs\",\n preserveModules: true,\n preserveModulesRoot: \"src\",\n },\n plugins: [ttsc()],\n};\n",
11
11
  "src/HttpError.ts": "export { HttpError } from \"@nestia/fetcher\";\n",
12
12
  "src/IConnection.ts": "export type { IConnection } from \"@nestia/fetcher\";\n",
@@ -1,3 +1,41 @@
1
+ /**
2
+ * The command-line entry of `@nestia/migrate`.
3
+ *
4
+ * The output path is resolved with `path.resolve` and its parent tested with
5
+ * `existsSync` and `statSync`, with backslashes converted to `/`, which Windows
6
+ * accepts. The input is fetched when it parses as an http or https URL, so a
7
+ * Windows path whose drive letter parses as a scheme is read from disk, and it
8
+ * is read as UTF-8 otherwise. Only files with a `.ts`, `.cts`, `.mts` or `.tsx`
9
+ * extension, tested case-sensitively, are formatted, and text is written
10
+ * without a byte order mark and with the line endings the generator and
11
+ * Prettier produce, which are not the platform's. A failure ends the process
12
+ * through `process.exit(-1)`, whose status the platform truncates to a non-zero
13
+ * value.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation The command reads the options, validates the output directory, reads the document from a file or an http(s) URL, converts it, reports the operations that could not be migrated, and writes the files, formatting only TypeScript files.
16
+ * @evidence contracts/common.md#clear-and-simple-design One entry function, with formatting, halting, and URL detection as private helpers.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Every failure ends with a message and a non-zero exit, and unformattable content is written unformatted.
18
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
19
+ */
1
20
  export declare namespace NestiaMigrateCommander {
2
- const main: () => Promise<void>;
21
+ /**
22
+ * Runs the command: reads the options and the document, generates the
23
+ * project, and writes it to the output directory.
24
+ *
25
+ * It stops with an error when the output directory exists, when its parent
26
+ * does not exist or is not a directory, when the input cannot be read or
27
+ * fetched, or when the document is invalid. Explicit arguments follow Node's
28
+ * executable/script/flags layout; omitting them reads the current process
29
+ * arguments.
30
+ *
31
+ * Creation and writing use `fs.promises` through the injected archiver, so
32
+ * the volume decides case policy and permissions, and the checks that precede
33
+ * any write are the filesystem's own answers.
34
+ *
35
+ * @evidence contracts/common.md#principled-implementation The checks run before any file is written, the document is fetched only for an http or https URL, a failed HTTP status stops the command, and only files with a TypeScript extension are formatted, because Prettier's TypeScript parser would rewrite a dotfile line into code.
36
+ * @evidence contracts/common.md#clear-and-simple-design One asynchronous function whose phases are marked in comments, with the option parsing in `NestiaMigrateInquirer`.
37
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The checks apply to every input, and a formatting failure keeps the original text.
38
+ * @evidence contracts/common.md#meaningful-documentation The comment states the conditions under which it stops.
39
+ */
40
+ const main: (argv?: string[]) => Promise<void>;
3
41
  }
@@ -54,11 +54,49 @@ const prettierPluginJsDoc = __importStar(require("prettier-plugin-jsdoc"));
54
54
  const NestiaMigrateApplication_1 = require("../NestiaMigrateApplication");
55
55
  const NestiaMigrateFileArchiver_1 = require("../archivers/NestiaMigrateFileArchiver");
56
56
  const NestiaMigrateInquirer_1 = require("./NestiaMigrateInquirer");
57
+ /**
58
+ * The command-line entry of `@nestia/migrate`.
59
+ *
60
+ * The output path is resolved with `path.resolve` and its parent tested with
61
+ * `existsSync` and `statSync`, with backslashes converted to `/`, which Windows
62
+ * accepts. The input is fetched when it parses as an http or https URL, so a
63
+ * Windows path whose drive letter parses as a scheme is read from disk, and it
64
+ * is read as UTF-8 otherwise. Only files with a `.ts`, `.cts`, `.mts` or `.tsx`
65
+ * extension, tested case-sensitively, are formatted, and text is written
66
+ * without a byte order mark and with the line endings the generator and
67
+ * Prettier produce, which are not the platform's. A failure ends the process
68
+ * through `process.exit(-1)`, whose status the platform truncates to a non-zero
69
+ * value.
70
+ *
71
+ * @evidence contracts/common.md#principled-implementation The command reads the options, validates the output directory, reads the document from a file or an http(s) URL, converts it, reports the operations that could not be migrated, and writes the files, formatting only TypeScript files.
72
+ * @evidence contracts/common.md#clear-and-simple-design One entry function, with formatting, halting, and URL detection as private helpers.
73
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Every failure ends with a message and a non-zero exit, and unformattable content is written unformatted.
74
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
75
+ */
57
76
  var NestiaMigrateCommander;
58
77
  (function (NestiaMigrateCommander) {
59
- NestiaMigrateCommander.main = () => __awaiter(this, void 0, void 0, function* () {
78
+ /**
79
+ * Runs the command: reads the options and the document, generates the
80
+ * project, and writes it to the output directory.
81
+ *
82
+ * It stops with an error when the output directory exists, when its parent
83
+ * does not exist or is not a directory, when the input cannot be read or
84
+ * fetched, or when the document is invalid. Explicit arguments follow Node's
85
+ * executable/script/flags layout; omitting them reads the current process
86
+ * arguments.
87
+ *
88
+ * Creation and writing use `fs.promises` through the injected archiver, so
89
+ * the volume decides case policy and permissions, and the checks that precede
90
+ * any write are the filesystem's own answers.
91
+ *
92
+ * @evidence contracts/common.md#principled-implementation The checks run before any file is written, the document is fetched only for an http or https URL, a failed HTTP status stops the command, and only files with a TypeScript extension are formatted, because Prettier's TypeScript parser would rewrite a dotfile line into code.
93
+ * @evidence contracts/common.md#clear-and-simple-design One asynchronous function whose phases are marked in comments, with the option parsing in `NestiaMigrateInquirer`.
94
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The checks apply to every input, and a formatting failure keeps the original text.
95
+ * @evidence contracts/common.md#meaningful-documentation The comment states the conditions under which it stops.
96
+ */
97
+ NestiaMigrateCommander.main = (argv) => __awaiter(this, void 0, void 0, function* () {
60
98
  const resolve = (str) => str ? path_1.default.resolve(str).split("\\").join("/") : undefined;
61
- const options = yield NestiaMigrateInquirer_1.NestiaMigrateInquirer.parse();
99
+ const options = yield NestiaMigrateInquirer_1.NestiaMigrateInquirer.parse(argv);
62
100
  // VALIDATE OUTPUT DIRECTORY
63
101
  const parent = resolve(options.output + "/..");
64
102
  if (fs_1.default.existsSync(options.output))
@@ -71,6 +109,8 @@ var NestiaMigrateCommander;
71
109
  const document = yield (() => __awaiter(this, void 0, void 0, function* () {
72
110
  if (isUri(options.input)) {
73
111
  const response = yield fetch(options.input);
112
+ if (response.ok === false)
113
+ halt(`Unable to fetch the input swagger.json: ${response.status} ${response.statusText}`);
74
114
  const content = yield response.text();
75
115
  return JSON.parse(content);
76
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateCommander.js","sourceRoot":"","sources":["../../src/executable/NestiaMigrateCommander.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,wBAAwB,kEAA8C;AAOlF,4CAAoB;AACpB,gDAAwB;AACxB,uCAAkC;AAClC,MAAY,mBAAmB,kDAA8B;AAG7D,0EAAuE;AACvE,sFAAmF;AACnF,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
9
  //#region src/executable/NestiaMigrateCommander.ts
10
10
  let NestiaMigrateCommander;
11
11
  (function(_NestiaMigrateCommander) {
12
- _NestiaMigrateCommander.main = async () => {
12
+ _NestiaMigrateCommander.main = async (argv) => {
13
13
  const resolve = (str) => str ? path.resolve(str).split("\\").join("/") : void 0;
14
- const options = await NestiaMigrateInquirer.parse();
14
+ const options = await NestiaMigrateInquirer.parse(argv);
15
15
  const parent = resolve(options.output + "/..");
16
16
  if (fs.existsSync(options.output)) halt("Response directory already exists.");
17
17
  else if (fs.existsSync(parent) === false) halt("Response directory's parent directory does not exist.");
18
18
  else if (fs.statSync(parent).isDirectory() === false) halt("Response directory's parent is not a directory.");
19
19
  const document = await (async () => {
20
20
  if (isUri(options.input)) {
21
- const content = await (await fetch(options.input)).text();
21
+ const response = await fetch(options.input);
22
+ if (response.ok === false) halt(`Unable to fetch the input swagger.json: ${response.status} ${response.statusText}`);
23
+ const content = await response.text();
22
24
  return JSON.parse(content);
23
25
  }
24
26
  if (fs.existsSync(options.input) === false) halt("Unable to find the input swagger.json file.");
@@ -1,4 +1,22 @@
1
+ /**
2
+ * Reads the options of the command from flags, asking interactively for what is
3
+ * missing.
4
+ *
5
+ * @evidence contracts/common.md#principled-implementation Each option is taken from its flag when given, and asked with a prompt otherwise, so the same command runs non-interactively when every flag is present.
6
+ * @evidence contracts/common.md#clear-and-simple-design One function and the output type; the prompt helpers are local.
7
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The prompts are the standard `inquirer` ones, and a flag always wins over a prompt.
8
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
9
+ */
1
10
  export declare namespace NestiaMigrateInquirer {
11
+ /**
12
+ * The options of the command: the mode, the input and output locations, the
13
+ * flags, and the package name.
14
+ *
15
+ * @evidence contracts/common.md#principled-implementation The record holds the answers needed to run the migration, each as a value and not as an optional.
16
+ * @evidence contracts/common.md#clear-and-simple-design A flat record.
17
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
18
+ * @evidence contracts/common.md#meaningful-documentation The comment lists the options.
19
+ */
2
20
  interface IOutput {
3
21
  mode: "nest" | "sdk";
4
22
  input: string;
@@ -8,5 +26,18 @@ export declare namespace NestiaMigrateInquirer {
8
26
  e2e: boolean;
9
27
  package: string;
10
28
  }
11
- const parse: () => Promise<IOutput>;
29
+ /**
30
+ * Parses the flags and asks for the missing options.
31
+ *
32
+ * A boolean flag given without a value is `true`, and one given a value is
33
+ * true only for the text `true`. Each invocation owns its parser; explicit
34
+ * arguments use Node's executable/script/flags layout and default to the
35
+ * current process arguments.
36
+ *
37
+ * @evidence contracts/common.md#principled-implementation A fresh Commander parser interprets the supplied Node-style arguments, the action asks a prompt for each undefined option, and boolean flags are normalized by one rule, so the result has every field set without retaining another invocation's options.
38
+ * @evidence contracts/common.md#clear-and-simple-design One invocation owns the parser and prompt action; the optional argument vector defaults to the ordinary process input.
39
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It asks only for what is missing.
40
+ * @evidence contracts/common.md#meaningful-documentation The comment states the boolean flag rule.
41
+ */
42
+ const parse: (argv?: string[]) => Promise<IOutput>;
12
43
  }
@@ -12,21 +12,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.NestiaMigrateInquirer = void 0;
13
13
  const commander_1 = require("commander");
14
14
  const inquirer_1 = require("inquirer");
15
+ /**
16
+ * Reads the options of the command from flags, asking interactively for what is
17
+ * missing.
18
+ *
19
+ * @evidence contracts/common.md#principled-implementation Each option is taken from its flag when given, and asked with a prompt otherwise, so the same command runs non-interactively when every flag is present.
20
+ * @evidence contracts/common.md#clear-and-simple-design One function and the output type; the prompt helpers are local.
21
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The prompts are the standard `inquirer` ones, and a flag always wins over a prompt.
22
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
23
+ */
15
24
  var NestiaMigrateInquirer;
16
25
  (function (NestiaMigrateInquirer) {
17
- NestiaMigrateInquirer.parse = () => __awaiter(this, void 0, void 0, function* () {
26
+ /**
27
+ * Parses the flags and asks for the missing options.
28
+ *
29
+ * A boolean flag given without a value is `true`, and one given a value is
30
+ * true only for the text `true`. Each invocation owns its parser; explicit
31
+ * arguments use Node's executable/script/flags layout and default to the
32
+ * current process arguments.
33
+ *
34
+ * @evidence contracts/common.md#principled-implementation A fresh Commander parser interprets the supplied Node-style arguments, the action asks a prompt for each undefined option, and boolean flags are normalized by one rule, so the result has every field set without retaining another invocation's options.
35
+ * @evidence contracts/common.md#clear-and-simple-design One invocation owns the parser and prompt action; the optional argument vector defaults to the ordinary process input.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It asks only for what is missing.
37
+ * @evidence contracts/common.md#meaningful-documentation The comment states the boolean flag rule.
38
+ */
39
+ NestiaMigrateInquirer.parse = (argv) => __awaiter(this, void 0, void 0, function* () {
40
+ const program = new commander_1.Command();
18
41
  // PREPARE ASSETS
19
- commander_1.program.option("--mode [nest/sdk]", "migration mode");
20
- commander_1.program.option("--input [swagger.json]", "location of target swagger.json file");
21
- commander_1.program.option("--output [directory]", "output directory path");
22
- commander_1.program.option("--keyword [boolean]", "Keyword parameter mode");
23
- commander_1.program.option("--simulate [boolean]", "Mockup simulator");
24
- commander_1.program.option("--e2e [boolean]", "Generate E2E tests");
25
- commander_1.program.option("--package [name]", "Package name");
42
+ program.option("--mode [nest/sdk]", "migration mode");
43
+ program.option("--input [swagger.json]", "location of target swagger.json file");
44
+ program.option("--output [directory]", "output directory path");
45
+ program.option("--keyword [boolean]", "Keyword parameter mode");
46
+ program.option("--simulate [boolean]", "Mockup simulator");
47
+ program.option("--e2e [boolean]", "Generate E2E tests");
48
+ program.option("--package [name]", "Package name");
26
49
  // INTERNAL PROCEDURES
27
50
  const questioned = { value: false };
28
51
  const action = (closure) => new Promise((resolve, reject) => {
29
- commander_1.program.action((options) => __awaiter(this, void 0, void 0, function* () {
52
+ program.action((options) => __awaiter(this, void 0, void 0, function* () {
30
53
  try {
31
54
  resolve(yield closure(options));
32
55
  }
@@ -34,7 +57,7 @@ var NestiaMigrateInquirer;
34
57
  reject(exp);
35
58
  }
36
59
  }));
37
- commander_1.program.parseAsync().catch(reject);
60
+ program.parseAsync(argv).catch(reject);
38
61
  });
39
62
  const select = (name) => (message) => (choices, filter) => __awaiter(this, void 0, void 0, function* () {
40
63
  questioned.value = true;