@typeorm/codemod 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/README.md +59 -0
  2. package/dist/cli/colors.d.ts +7 -0
  3. package/dist/cli/colors.js +12 -0
  4. package/dist/cli/colors.js.map +1 -0
  5. package/dist/cli/error.d.ts +1 -0
  6. package/dist/cli/error.js +11 -0
  7. package/dist/cli/error.js.map +1 -0
  8. package/dist/cli/list-transforms.d.ts +1 -0
  9. package/dist/cli/list-transforms.js +27 -0
  10. package/dist/cli/list-transforms.js.map +1 -0
  11. package/dist/cli/parse-args.d.ts +10 -0
  12. package/dist/cli/parse-args.js +52 -0
  13. package/dist/cli/parse-args.js.map +1 -0
  14. package/dist/cli/print-guide.d.ts +1 -0
  15. package/dist/cli/print-guide.js +15 -0
  16. package/dist/cli/print-guide.js.map +1 -0
  17. package/dist/cli/print-summary.d.ts +17 -0
  18. package/dist/cli/print-summary.js +70 -0
  19. package/dist/cli/print-summary.js.map +1 -0
  20. package/dist/cli/print-todos.d.ts +1 -0
  21. package/dist/cli/print-todos.js +13 -0
  22. package/dist/cli/print-todos.js.map +1 -0
  23. package/dist/cli/print-usage.d.ts +1 -0
  24. package/dist/cli/print-usage.js +31 -0
  25. package/dist/cli/print-usage.js.map +1 -0
  26. package/dist/cli/run-dependencies.d.ts +6 -0
  27. package/dist/cli/run-dependencies.js +45 -0
  28. package/dist/cli/run-dependencies.js.map +1 -0
  29. package/dist/cli/run-transforms.d.ts +21 -0
  30. package/dist/cli/run-transforms.js +119 -0
  31. package/dist/cli/run-transforms.js.map +1 -0
  32. package/dist/cli/run.d.ts +9 -0
  33. package/dist/cli/run.js +30 -0
  34. package/dist/cli/run.js.map +1 -0
  35. package/dist/dependencies/config.d.ts +24 -0
  36. package/dist/dependencies/config.js +3 -0
  37. package/dist/dependencies/config.js.map +1 -0
  38. package/dist/dependencies/find-package-json.d.ts +5 -0
  39. package/dist/dependencies/find-package-json.js +34 -0
  40. package/dist/dependencies/find-package-json.js.map +1 -0
  41. package/dist/dependencies/index.d.ts +5 -0
  42. package/dist/dependencies/index.js +14 -0
  43. package/dist/dependencies/index.js.map +1 -0
  44. package/dist/dependencies/upgrade.d.ts +11 -0
  45. package/dist/dependencies/upgrade.js +128 -0
  46. package/dist/dependencies/upgrade.js.map +1 -0
  47. package/dist/dependencies/v1.d.ts +2 -0
  48. package/dist/dependencies/v1.js +32 -0
  49. package/dist/dependencies/v1.js.map +1 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.js +45 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/lib/colors.d.ts +9 -0
  54. package/dist/lib/colors.js +14 -0
  55. package/dist/lib/colors.js.map +1 -0
  56. package/dist/lib/error.d.ts +1 -0
  57. package/dist/lib/error.js +11 -0
  58. package/dist/lib/error.js.map +1 -0
  59. package/dist/lib/format-time.d.ts +1 -0
  60. package/dist/lib/format-time.js +12 -0
  61. package/dist/lib/format-time.js.map +1 -0
  62. package/dist/lib/highlight.d.ts +1 -0
  63. package/dist/lib/highlight.js +7 -0
  64. package/dist/lib/highlight.js.map +1 -0
  65. package/dist/lib/spinner.d.ts +5 -0
  66. package/dist/lib/spinner.js +39 -0
  67. package/dist/lib/spinner.js.map +1 -0
  68. package/dist/transforms/ast-helpers.d.ts +50 -0
  69. package/dist/transforms/ast-helpers.js +153 -0
  70. package/dist/transforms/ast-helpers.js.map +1 -0
  71. package/dist/transforms/index.d.ts +7 -0
  72. package/dist/transforms/index.js +41 -0
  73. package/dist/transforms/index.js.map +1 -0
  74. package/dist/transforms/resolve.d.ts +1 -0
  75. package/dist/transforms/resolve.js +28 -0
  76. package/dist/transforms/resolve.js.map +1 -0
  77. package/dist/transforms/scan.d.ts +4 -0
  78. package/dist/transforms/scan.js +33 -0
  79. package/dist/transforms/scan.js.map +1 -0
  80. package/dist/transforms/stats.d.ts +11 -0
  81. package/dist/transforms/stats.js +42 -0
  82. package/dist/transforms/stats.js.map +1 -0
  83. package/dist/transforms/todo.d.ts +2 -0
  84. package/dist/transforms/todo.js +10 -0
  85. package/dist/transforms/todo.js.map +1 -0
  86. package/dist/transforms/transformer.d.ts +8 -0
  87. package/dist/transforms/transformer.js +19 -0
  88. package/dist/transforms/transformer.js.map +1 -0
  89. package/dist/transforms/v1/column-readonly.d.ts +6 -0
  90. package/dist/transforms/v1/column-readonly.js +37 -0
  91. package/dist/transforms/v1/column-readonly.js.map +1 -0
  92. package/dist/transforms/v1/column-unsigned-numeric.d.ts +6 -0
  93. package/dist/transforms/v1/column-unsigned-numeric.js +65 -0
  94. package/dist/transforms/v1/column-unsigned-numeric.js.map +1 -0
  95. package/dist/transforms/v1/column-width-zerofill.d.ts +6 -0
  96. package/dist/transforms/v1/column-width-zerofill.js +26 -0
  97. package/dist/transforms/v1/column-width-zerofill.js.map +1 -0
  98. package/dist/transforms/v1/connection-to-datasource.d.ts +6 -0
  99. package/dist/transforms/v1/connection-to-datasource.js +205 -0
  100. package/dist/transforms/v1/connection-to-datasource.js.map +1 -0
  101. package/dist/transforms/v1/datasource-mongodb.d.ts +7 -0
  102. package/dist/transforms/v1/datasource-mongodb.js +96 -0
  103. package/dist/transforms/v1/datasource-mongodb.js.map +1 -0
  104. package/dist/transforms/v1/datasource-mssql-domain.d.ts +7 -0
  105. package/dist/transforms/v1/datasource-mssql-domain.js +35 -0
  106. package/dist/transforms/v1/datasource-mssql-domain.js.map +1 -0
  107. package/dist/transforms/v1/datasource-mssql.d.ts +7 -0
  108. package/dist/transforms/v1/datasource-mssql.js +82 -0
  109. package/dist/transforms/v1/datasource-mssql.js.map +1 -0
  110. package/dist/transforms/v1/datasource-mysql-connector.d.ts +6 -0
  111. package/dist/transforms/v1/datasource-mysql-connector.js +25 -0
  112. package/dist/transforms/v1/datasource-mysql-connector.js.map +1 -0
  113. package/dist/transforms/v1/datasource-name.d.ts +6 -0
  114. package/dist/transforms/v1/datasource-name.js +46 -0
  115. package/dist/transforms/v1/datasource-name.js.map +1 -0
  116. package/dist/transforms/v1/datasource-sap.d.ts +6 -0
  117. package/dist/transforms/v1/datasource-sap.js +63 -0
  118. package/dist/transforms/v1/datasource-sap.js.map +1 -0
  119. package/dist/transforms/v1/datasource-sqlite-options.d.ts +6 -0
  120. package/dist/transforms/v1/datasource-sqlite-options.js +35 -0
  121. package/dist/transforms/v1/datasource-sqlite-options.js.map +1 -0
  122. package/dist/transforms/v1/datasource-sqlite-type.d.ts +6 -0
  123. package/dist/transforms/v1/datasource-sqlite-type.js +28 -0
  124. package/dist/transforms/v1/datasource-sqlite-type.js.map +1 -0
  125. package/dist/transforms/v1/find-options-lock-modes.d.ts +6 -0
  126. package/dist/transforms/v1/find-options-lock-modes.js +81 -0
  127. package/dist/transforms/v1/find-options-lock-modes.js.map +1 -0
  128. package/dist/transforms/v1/find-options-string-relations.d.ts +6 -0
  129. package/dist/transforms/v1/find-options-string-relations.js +69 -0
  130. package/dist/transforms/v1/find-options-string-relations.js.map +1 -0
  131. package/dist/transforms/v1/find-options-string-select.d.ts +6 -0
  132. package/dist/transforms/v1/find-options-string-select.js +36 -0
  133. package/dist/transforms/v1/find-options-string-select.js.map +1 -0
  134. package/dist/transforms/v1/global-functions.d.ts +7 -0
  135. package/dist/transforms/v1/global-functions.js +98 -0
  136. package/dist/transforms/v1/global-functions.js.map +1 -0
  137. package/dist/transforms/v1/index.d.ts +40 -0
  138. package/dist/transforms/v1/index.js +109 -0
  139. package/dist/transforms/v1/index.js.map +1 -0
  140. package/dist/transforms/v1/migrations-get-all.d.ts +7 -0
  141. package/dist/transforms/v1/migrations-get-all.js +39 -0
  142. package/dist/transforms/v1/migrations-get-all.js.map +1 -0
  143. package/dist/transforms/v1/mongodb-stats.d.ts +7 -0
  144. package/dist/transforms/v1/mongodb-stats.js +52 -0
  145. package/dist/transforms/v1/mongodb-stats.js.map +1 -0
  146. package/dist/transforms/v1/mongodb-types.d.ts +6 -0
  147. package/dist/transforms/v1/mongodb-types.js +84 -0
  148. package/dist/transforms/v1/mongodb-types.js.map +1 -0
  149. package/dist/transforms/v1/query-builder-native-parameters.d.ts +6 -0
  150. package/dist/transforms/v1/query-builder-native-parameters.js +20 -0
  151. package/dist/transforms/v1/query-builder-native-parameters.js.map +1 -0
  152. package/dist/transforms/v1/query-builder-on-conflict.d.ts +7 -0
  153. package/dist/transforms/v1/query-builder-on-conflict.js +56 -0
  154. package/dist/transforms/v1/query-builder-on-conflict.js.map +1 -0
  155. package/dist/transforms/v1/query-builder-or-update.d.ts +6 -0
  156. package/dist/transforms/v1/query-builder-or-update.js +56 -0
  157. package/dist/transforms/v1/query-builder-or-update.js.map +1 -0
  158. package/dist/transforms/v1/query-builder-print-sql.d.ts +7 -0
  159. package/dist/transforms/v1/query-builder-print-sql.js +49 -0
  160. package/dist/transforms/v1/query-builder-print-sql.js.map +1 -0
  161. package/dist/transforms/v1/query-builder-replace-property-names.d.ts +7 -0
  162. package/dist/transforms/v1/query-builder-replace-property-names.js +42 -0
  163. package/dist/transforms/v1/query-builder-replace-property-names.js.map +1 -0
  164. package/dist/transforms/v1/query-builder-where-expression.d.ts +6 -0
  165. package/dist/transforms/v1/query-builder-where-expression.js +39 -0
  166. package/dist/transforms/v1/query-builder-where-expression.js.map +1 -0
  167. package/dist/transforms/v1/query-runner-loaded-tables-views.d.ts +7 -0
  168. package/dist/transforms/v1/query-runner-loaded-tables-views.js +54 -0
  169. package/dist/transforms/v1/query-runner-loaded-tables-views.js.map +1 -0
  170. package/dist/transforms/v1/relation-count.d.ts +7 -0
  171. package/dist/transforms/v1/relation-count.js +41 -0
  172. package/dist/transforms/v1/relation-count.js.map +1 -0
  173. package/dist/transforms/v1/remove-abstract-repository.d.ts +5 -0
  174. package/dist/transforms/v1/remove-abstract-repository.js +93 -0
  175. package/dist/transforms/v1/remove-abstract-repository.js.map +1 -0
  176. package/dist/transforms/v1/remove-connector-package.d.ts +4 -0
  177. package/dist/transforms/v1/remove-connector-package.js +19 -0
  178. package/dist/transforms/v1/remove-connector-package.js.map +1 -0
  179. package/dist/transforms/v1/remove-datasource-name.d.ts +4 -0
  180. package/dist/transforms/v1/remove-datasource-name.js +56 -0
  181. package/dist/transforms/v1/remove-datasource-name.js.map +1 -0
  182. package/dist/transforms/v1/remove-mongodb-options.d.ts +5 -0
  183. package/dist/transforms/v1/remove-mongodb-options.js +86 -0
  184. package/dist/transforms/v1/remove-mongodb-options.js.map +1 -0
  185. package/dist/transforms/v1/remove-relation-count.d.ts +5 -0
  186. package/dist/transforms/v1/remove-relation-count.js +49 -0
  187. package/dist/transforms/v1/remove-relation-count.js.map +1 -0
  188. package/dist/transforms/v1/remove-replace-property-names.d.ts +5 -0
  189. package/dist/transforms/v1/remove-replace-property-names.js +35 -0
  190. package/dist/transforms/v1/remove-replace-property-names.js.map +1 -0
  191. package/dist/transforms/v1/remove-sap-options.d.ts +4 -0
  192. package/dist/transforms/v1/remove-sap-options.js +54 -0
  193. package/dist/transforms/v1/remove-sap-options.js.map +1 -0
  194. package/dist/transforms/v1/remove-unsigned-numeric.d.ts +4 -0
  195. package/dist/transforms/v1/remove-unsigned-numeric.js +76 -0
  196. package/dist/transforms/v1/remove-unsigned-numeric.js.map +1 -0
  197. package/dist/transforms/v1/remove-use-container.d.ts +5 -0
  198. package/dist/transforms/v1/remove-use-container.js +63 -0
  199. package/dist/transforms/v1/remove-use-container.js.map +1 -0
  200. package/dist/transforms/v1/remove-width-zerofill.d.ts +4 -0
  201. package/dist/transforms/v1/remove-width-zerofill.js +29 -0
  202. package/dist/transforms/v1/remove-width-zerofill.js.map +1 -0
  203. package/dist/transforms/v1/rename-connection-to-datasource.d.ts +4 -0
  204. package/dist/transforms/v1/rename-connection-to-datasource.js +111 -0
  205. package/dist/transforms/v1/rename-connection-to-datasource.js.map +1 -0
  206. package/dist/transforms/v1/rename-exist-to-exists.d.ts +4 -0
  207. package/dist/transforms/v1/rename-exist-to-exists.js +25 -0
  208. package/dist/transforms/v1/rename-exist-to-exists.js.map +1 -0
  209. package/dist/transforms/v1/rename-find-by-ids.d.ts +4 -0
  210. package/dist/transforms/v1/rename-find-by-ids.js +64 -0
  211. package/dist/transforms/v1/rename-find-by-ids.js.map +1 -0
  212. package/dist/transforms/v1/rename-get-all-migrations.d.ts +5 -0
  213. package/dist/transforms/v1/rename-get-all-migrations.js +32 -0
  214. package/dist/transforms/v1/rename-get-all-migrations.js.map +1 -0
  215. package/dist/transforms/v1/rename-loaded-tables-views.d.ts +5 -0
  216. package/dist/transforms/v1/rename-loaded-tables-views.js +48 -0
  217. package/dist/transforms/v1/rename-loaded-tables-views.js.map +1 -0
  218. package/dist/transforms/v1/rename-or-update-overload.d.ts +4 -0
  219. package/dist/transforms/v1/rename-or-update-overload.js +46 -0
  220. package/dist/transforms/v1/rename-or-update-overload.js.map +1 -0
  221. package/dist/transforms/v1/rename-print-sql-to-log-query.d.ts +4 -0
  222. package/dist/transforms/v1/rename-print-sql-to-log-query.js +25 -0
  223. package/dist/transforms/v1/rename-print-sql-to-log-query.js.map +1 -0
  224. package/dist/transforms/v1/replace-global-functions.d.ts +5 -0
  225. package/dist/transforms/v1/replace-global-functions.js +92 -0
  226. package/dist/transforms/v1/replace-global-functions.js.map +1 -0
  227. package/dist/transforms/v1/replace-lock-modes.d.ts +4 -0
  228. package/dist/transforms/v1/replace-lock-modes.js +75 -0
  229. package/dist/transforms/v1/replace-lock-modes.js.map +1 -0
  230. package/dist/transforms/v1/replace-mongodb-stats.d.ts +5 -0
  231. package/dist/transforms/v1/replace-mongodb-stats.js +54 -0
  232. package/dist/transforms/v1/replace-mongodb-stats.js.map +1 -0
  233. package/dist/transforms/v1/replace-mongodb-types.d.ts +4 -0
  234. package/dist/transforms/v1/replace-mongodb-types.js +72 -0
  235. package/dist/transforms/v1/replace-mongodb-types.js.map +1 -0
  236. package/dist/transforms/v1/replace-mssql-domain.d.ts +5 -0
  237. package/dist/transforms/v1/replace-mssql-domain.js +25 -0
  238. package/dist/transforms/v1/replace-mssql-domain.js.map +1 -0
  239. package/dist/transforms/v1/replace-on-conflict.d.ts +5 -0
  240. package/dist/transforms/v1/replace-on-conflict.js +49 -0
  241. package/dist/transforms/v1/replace-on-conflict.js.map +1 -0
  242. package/dist/transforms/v1/replace-readonly-column.d.ts +4 -0
  243. package/dist/transforms/v1/replace-readonly-column.js +28 -0
  244. package/dist/transforms/v1/replace-readonly-column.js.map +1 -0
  245. package/dist/transforms/v1/replace-set-native-parameters.d.ts +4 -0
  246. package/dist/transforms/v1/replace-set-native-parameters.js +25 -0
  247. package/dist/transforms/v1/replace-set-native-parameters.js.map +1 -0
  248. package/dist/transforms/v1/replace-sqlite-options.d.ts +4 -0
  249. package/dist/transforms/v1/replace-sqlite-options.js +29 -0
  250. package/dist/transforms/v1/replace-sqlite-options.js.map +1 -0
  251. package/dist/transforms/v1/replace-sqlite-type.d.ts +4 -0
  252. package/dist/transforms/v1/replace-sqlite-type.js +22 -0
  253. package/dist/transforms/v1/replace-sqlite-type.js.map +1 -0
  254. package/dist/transforms/v1/replace-where-expression-type.d.ts +4 -0
  255. package/dist/transforms/v1/replace-where-expression-type.js +41 -0
  256. package/dist/transforms/v1/replace-where-expression-type.js.map +1 -0
  257. package/dist/transforms/v1/repository-abstract.d.ts +7 -0
  258. package/dist/transforms/v1/repository-abstract.js +83 -0
  259. package/dist/transforms/v1/repository-abstract.js.map +1 -0
  260. package/dist/transforms/v1/repository-exist.d.ts +6 -0
  261. package/dist/transforms/v1/repository-exist.js +20 -0
  262. package/dist/transforms/v1/repository-exist.js.map +1 -0
  263. package/dist/transforms/v1/repository-find-by-ids.d.ts +6 -0
  264. package/dist/transforms/v1/repository-find-by-ids.js +74 -0
  265. package/dist/transforms/v1/repository-find-by-ids.js.map +1 -0
  266. package/dist/transforms/v1/repository-find-one-by-id.d.ts +6 -0
  267. package/dist/transforms/v1/repository-find-one-by-id.js +55 -0
  268. package/dist/transforms/v1/repository-find-one-by-id.js.map +1 -0
  269. package/dist/transforms/v1/upgrade-dependencies.d.ts +15 -0
  270. package/dist/transforms/v1/upgrade-dependencies.js +163 -0
  271. package/dist/transforms/v1/upgrade-dependencies.js.map +1 -0
  272. package/dist/transforms/v1/use-container.d.ts +7 -0
  273. package/dist/transforms/v1/use-container.js +54 -0
  274. package/dist/transforms/v1/use-container.js.map +1 -0
  275. package/package.json +50 -0
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeSapOptions = exports.description = void 0;
4
+ exports.description = "rename and remove deprecated SAP HANA connection options";
5
+ const removeSapOptions = (file, api) => {
6
+ const j = api.jscodeshift;
7
+ const root = j(file.source);
8
+ let hasChanges = false;
9
+ const topLevelRenames = {
10
+ hanaClientDriver: "driver",
11
+ };
12
+ const poolRenames = {
13
+ max: "maxConnectedOrPooled",
14
+ requestTimeout: "maxWaitTimeoutIfPoolExhausted",
15
+ idleTimeout: "maxPooledIdleTime",
16
+ };
17
+ const poolRemoves = new Set(["min", "maxWaitingRequests", "checkInterval"]);
18
+ // Rename top-level options
19
+ root.find(j.ObjectProperty).forEach((path) => {
20
+ if (path.node.key.type !== "Identifier")
21
+ return;
22
+ const name = path.node.key.name;
23
+ // Top-level renames
24
+ if (topLevelRenames[name]) {
25
+ path.node.key.name = topLevelRenames[name];
26
+ hasChanges = true;
27
+ return;
28
+ }
29
+ // Pool property handling — check if inside a pool object
30
+ if (poolRenames[name] || poolRemoves.has(name)) {
31
+ const parent = path.parent;
32
+ if (parent.node.type !== "ObjectExpression")
33
+ return;
34
+ const grandparent = parent.parent;
35
+ if (grandparent.node.type !== "ObjectProperty" ||
36
+ grandparent.node.key.type !== "Identifier" ||
37
+ grandparent.node.key.name !== "pool") {
38
+ return;
39
+ }
40
+ if (poolRemoves.has(name)) {
41
+ j(path).remove();
42
+ hasChanges = true;
43
+ }
44
+ else if (poolRenames[name]) {
45
+ path.node.key.name = poolRenames[name];
46
+ hasChanges = true;
47
+ }
48
+ }
49
+ });
50
+ return hasChanges ? root.toSource() : undefined;
51
+ };
52
+ exports.removeSapOptions = removeSapOptions;
53
+ exports.default = exports.removeSapOptions;
54
+ //# sourceMappingURL=remove-sap-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-sap-options.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-sap-options.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GACpB,0DAA0D,CAAA;AAEvD,MAAM,gBAAgB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACzD,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,MAAM,eAAe,GAA2B;QAC5C,gBAAgB,EAAE,QAAQ;KAC7B,CAAA;IAED,MAAM,WAAW,GAA2B;QACxC,GAAG,EAAE,sBAAsB;QAC3B,cAAc,EAAE,+BAA+B;QAC/C,WAAW,EAAE,mBAAmB;KACnC,CAAA;IAED,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC,CAAA;IAE3E,2BAA2B;IAC3B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACzC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;YAAE,OAAM;QAE/C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAA;QAE/B,oBAAoB;QACpB,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAA;YAC1C,UAAU,GAAG,IAAI,CAAA;YACjB,OAAM;QACV,CAAC;QAED,yDAAyD;QACzD,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;YAC1B,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,kBAAkB;gBAAE,OAAM;YAEnD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAA;YACjC,IACI,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB;gBAC1C,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;gBAC1C,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,EACtC,CAAC;gBACC,OAAM;YACV,CAAC;YAED,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAA;gBAChB,UAAU,GAAG,IAAI,CAAA;YACrB,CAAC;iBAAM,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;gBACtC,UAAU,GAAG,IAAI,CAAA;YACrB,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAvDY,QAAA,gBAAgB,oBAuD5B;AAED,kBAAe,wBAAgB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "remove deprecated `unsigned` from decimal/float column options";
3
+ export declare const removeUnsignedNumeric: (file: FileInfo, api: API) => string | undefined;
4
+ export default removeUnsignedNumeric;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeUnsignedNumeric = exports.description = void 0;
4
+ const ast_helpers_1 = require("../ast-helpers");
5
+ exports.description = "remove deprecated `unsigned` from decimal/float column options";
6
+ const numericTypes = new Set(["decimal", "float", "double", "numeric"]);
7
+ const removeUnsignedNumeric = (file, api) => {
8
+ const j = api.jscodeshift;
9
+ const root = j(file.source);
10
+ let hasChanges = false;
11
+ // Find @Column("decimal", { unsigned: true }) style calls
12
+ root.find(j.CallExpression, {
13
+ callee: { type: "Identifier", name: "Column" },
14
+ }).forEach((path) => {
15
+ const args = path.node.arguments;
16
+ if (args.length < 2)
17
+ return;
18
+ // First arg must be a string literal with a numeric type
19
+ const firstArg = args[0];
20
+ const typeName = (0, ast_helpers_1.getStringValue)(firstArg);
21
+ if (!typeName || !numericTypes.has(typeName))
22
+ return;
23
+ // Second arg should be an object with unsigned property
24
+ const secondArg = args[1];
25
+ if (secondArg.type !== "ObjectExpression")
26
+ return;
27
+ const filtered = secondArg.properties.filter((prop) => {
28
+ if (prop.type === "ObjectProperty" &&
29
+ prop.key.type === "Identifier" &&
30
+ prop.key.name === "unsigned") {
31
+ hasChanges = true;
32
+ return false;
33
+ }
34
+ return true;
35
+ });
36
+ if (filtered.length !== secondArg.properties.length) {
37
+ secondArg.properties = filtered;
38
+ }
39
+ });
40
+ // Also find decorator calls via @Column({ type: "decimal", unsigned: true })
41
+ root.find(j.CallExpression, {
42
+ callee: { type: "Identifier", name: "Column" },
43
+ }).forEach((path) => {
44
+ const args = path.node.arguments;
45
+ if (args.length !== 1)
46
+ return;
47
+ const arg = args[0];
48
+ if (arg.type !== "ObjectExpression")
49
+ return;
50
+ // Check if type is a numeric type
51
+ const typeProp = arg.properties.find((p) => p.type === "ObjectProperty" &&
52
+ p.key.type === "Identifier" &&
53
+ p.key.name === "type");
54
+ if (typeProp?.type !== "ObjectProperty")
55
+ return;
56
+ const typeValue = (0, ast_helpers_1.getStringValue)(typeProp.value);
57
+ if (!typeValue || !numericTypes.has(typeValue))
58
+ return;
59
+ const filtered = arg.properties.filter((prop) => {
60
+ if (prop.type === "ObjectProperty" &&
61
+ prop.key.type === "Identifier" &&
62
+ prop.key.name === "unsigned") {
63
+ hasChanges = true;
64
+ return false;
65
+ }
66
+ return true;
67
+ });
68
+ if (filtered.length !== arg.properties.length) {
69
+ arg.properties = filtered;
70
+ }
71
+ });
72
+ return hasChanges ? root.toSource() : undefined;
73
+ };
74
+ exports.removeUnsignedNumeric = removeUnsignedNumeric;
75
+ exports.default = exports.removeUnsignedNumeric;
76
+ //# sourceMappingURL=remove-unsigned-numeric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-unsigned-numeric.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-unsigned-numeric.ts"],"names":[],"mappings":";;;AACA,gDAA+C;AAElC,QAAA,WAAW,GACpB,gEAAgE,CAAA;AAEpE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;AAEhE,MAAM,qBAAqB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC9D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,0DAA0D;IAC1D,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;KACjD,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAA;QAChC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,OAAM;QAE3B,yDAAyD;QACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACxB,MAAM,Q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AAQ,GAAG,GAAG,CAAC,UAAU,CAAC,IAAI,CAChC,CAAC,CAAC,EAAE,EAAE,CACF,CAAC,CAAC,IAAI,KAAK,gBAAgB;YAC3B,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;YAC3B,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAC5B,CAAA;QAED,IAAI,QAAQ,EAAE,IAAI,KAAK,gBAAgB;YAAE,OAAM;QAE/C,MAAM,SAAS,GAAG,IAAA,4BAAc,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAEhD,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC;YAAE,OAAM;QAEtD,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5C,IACI,IAAI,CAAC,IAAI,KAAK,gBAAgB;gBAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;gBAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,EAC9B,CAAC;gBACC,UAAU,GAAG,IAAI,CAAA;gBACjB,OAAO,KAAK,CAAA;YAChB,CAAC;YACD,OAAO,IAAI,CAAA;QACf,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC5C,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAA;QAC7B,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAjFY,QAAA,qBAAqB,yBAiFjC;AAED,kBAAe,6BAAqB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "remove `useContainer()` and `getFromContainer()` calls";
3
+ export declare const manual = true;
4
+ export declare const removeUseContainer: (file: FileInfo, api: API) => string | undefined;
5
+ export default removeUseContainer;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeUseContainer = exports.manual = exports.description = void 0;
4
+ const todo_1 = require("../todo");
5
+ exports.description = "remove `useContainer()` and `getFromContainer()` calls";
6
+ exports.manual = true;
7
+ const removeUseContainer = (file, api) => {
8
+ const j = api.jscodeshift;
9
+ const root = j(file.source);
10
+ let hasChanges = false;
11
+ let hasTodos = false;
12
+ const removedFunctions = new Set(["useContainer", "getFromContainer"]);
13
+ // Replace calls with a TODO comment
14
+ for (const funcName of removedFunctions) {
15
+ root.find(j.ExpressionStatement, {
16
+ expression: {
17
+ type: "CallExpression",
18
+ callee: { type: "Identifier", name: funcName },
19
+ },
20
+ }).forEach((path) => {
21
+ // Replace with a comment
22
+ const replacement = j.expressionStatement(j.identifier("undefined"));
23
+ (0, todo_1.addTodoComment)(replacement, `${funcName}() was removed in TypeORM v1. See migration guide: https://typeorm.io/docs/guides/migration-v1#container-system`, j);
24
+ j(path).replaceWith(replacement);
25
+ hasChanges = true;
26
+ hasTodos = true;
27
+ });
28
+ }
29
+ // Remove imports
30
+ const removedImports = new Set([
31
+ "useContainer",
32
+ "getFromContainer",
33
+ "ContainerInterface",
34
+ "ContainedType",
35
+ "UseContainerOptions",
36
+ ]);
37
+ root.find(j.ImportDeclaration, {
38
+ source: { value: "typeorm" },
39
+ }).forEach((importPath) => {
40
+ const remaining = importPath.node.specifiers?.filter((spec) => {
41
+ if (spec.type === "ImportSpecifier" &&
42
+ spec.imported.type === "Identifier") {
43
+ if (removedImports.has(spec.imported.name)) {
44
+ hasChanges = true;
45
+ return false;
46
+ }
47
+ }
48
+ return true;
49
+ });
50
+ if (remaining?.length === 0) {
51
+ j(importPath).remove();
52
+ }
53
+ else if (remaining) {
54
+ importPath.node.specifiers = remaining;
55
+ }
56
+ });
57
+ if (hasTodos)
58
+ (0, todo_1.reportTodo)("remove-use-container", file, api);
59
+ return hasChanges ? root.toSource() : undefined;
60
+ };
61
+ exports.removeUseContainer = removeUseContainer;
62
+ exports.default = exports.removeUseContainer;
63
+ //# sourceMappingURL=remove-use-container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-use-container.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-use-container.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,wDAAwD,CAAA;AAC/C,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,kBAAkB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,IAAI,QAAQ,GAAG,KAAK,CAAA;IAEpB,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAA;IAEtE,oCAAoC;IACpC,KAAK,MAAM,QAAQ,IAAI,gBAAgB,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,EAAE;YAC7B,UAAU,EAAE;gBACR,IAAI,EAAE,gBAAgB;gBACtB,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;aACjD;SACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,yBAAyB;YACzB,MAAM,WAAW,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAA;YACpE,IAAA,qBAAc,EACV,WAAW,EACX,GAAG,QAAQ,iHAAiH,EAC5H,CAAC,CACJ,CAAA;YACD,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC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,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAhEY,QAAA,kBAAkB,sBAgE9B;AAED,kBAAe,0BAAkB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "remove `width` and `zerofill` from `@Column` options";
3
+ export declare const removeWidthZerofill: (file: FileInfo, api: API) => string | undefined;
4
+ export default removeWidthZerofill;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeWidthZerofill = exports.description = void 0;
4
+ exports.description = "remove `width` and `zerofill` from `@Column` options";
5
+ const removeWidthZerofill = (file, api) => {
6
+ const j = api.jscodeshift;
7
+ const root = j(file.source);
8
+ let hasChanges = false;
9
+ const propsToRemove = new Set(["width", "zerofill"]);
10
+ root.find(j.ObjectExpression).forEach((path) => {
11
+ const props = path.node.properties;
12
+ const filtered = props.filter((prop) => {
13
+ if ((prop.type === "Property" || prop.type === "ObjectProperty") &&
14
+ prop.key.type === "Identifier" &&
15
+ propsToRemove.has(prop.key.name)) {
16
+ hasChanges = true;
17
+ return false;
18
+ }
19
+ return true;
20
+ });
21
+ if (filtered.length !== props.length) {
22
+ path.node.properties = filtered;
23
+ }
24
+ });
25
+ return hasChanges ? root.toSource() : undefined;
26
+ };
27
+ exports.removeWidthZerofill = removeWidthZerofill;
28
+ exports.default = exports.removeWidthZerofill;
29
+ //# sourceMappingURL=remove-width-zerofill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-width-zerofill.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-width-zerofill.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GACpB,sDAAsD,CAAA;AAEnD,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC5D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAA;IAEpD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAA;QAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,IACI,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC;gBAC5D,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;gBAC9B,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAClC,CAAC;gBACC,UAAU,GAAG,IAAI,CAAA;gBACjB,OAAO,KAAK,CAAA;YAChB,CAAC;YACD,OAAO,IAAI,CAAA;QACf,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAA;QACnC,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA3BY,QAAA,mBAAmB,uBA2B/B;AAED,kBAAe,2BAAmB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "migrate from `Connection` to `DataSource`";
3
+ export declare const renameConnectionToDataSource: (file: FileInfo, api: API) => string | undefined;
4
+ export default renameConnectionToDataSource;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renameConnectionToDataSource = exports.description = void 0;
4
+ exports.description = "migrate from `Connection` to `DataSource`";
5
+ const renameConnectionToDataSource = (file, api) => {
6
+ const j = api.jscodeshift;
7
+ const root = j(file.source);
8
+ let hasChanges = false;
9
+ // Type/class renames
10
+ const typeRenames = {
11
+ Connection: "DataSource",
12
+ ConnectionOptions: "DataSourceOptions",
13
+ BaseConnectionOptions: "BaseDataSourceOptions",
14
+ MysqlConnectionOptions: "MysqlDataSourceOptions",
15
+ MariaDbConnectionOptions: "MariaDbDataSourceOptions",
16
+ PostgresConnectionOptions: "PostgresDataSourceOptions",
17
+ CockroachConnectionOptions: "CockroachDataSourceOptions",
18
+ SqlServerConnectionOptions: "SqlServerDataSourceOptions",
19
+ OracleConnectionOptions: "OracleDataSourceOptions",
20
+ SqliteConnectionOptions: "BetterSqlite3DataSourceOptions",
21
+ BetterSqlite3ConnectionOptions: "BetterSqlite3DataSourceOptions",
22
+ SapConnectionOptions: "SapDataSourceOptions",
23
+ MongoConnectionOptions: "MongoDataSourceOptions",
24
+ CordovaConnectionOptions: "CordovaDataSourceOptions",
25
+ NativescriptConnectionOptions: "NativescriptDataSourceOptions",
26
+ ReactNativeConnectionOptions: "ReactNativeDataSourceOptions",
27
+ ExpoConnectionOptions: "ExpoDataSourceOptions",
28
+ AuroraMysqlConnectionOptions: "AuroraMysqlDataSourceOptions",
29
+ AuroraPostgresConnectionOptions: "AuroraPostgresDataSourceOptions",
30
+ SpannerConnectionOptions: "SpannerDataSourceOptions",
31
+ };
32
+ // Method renames on DataSource/Connection instances
33
+ const methodRenames = {
34
+ connect: "initialize",
35
+ close: "destroy",
36
+ };
37
+ // Property renames
38
+ const propertyRenames = {
39
+ isConnected: "isInitialized",
40
+ };
41
+ // Rename imports from "typeorm"
42
+ root.find(j.ImportDeclaration, {
43
+ source: { value: "typeorm" },
44
+ }).forEach((path) => {
45
+ path.node.specifiers?.forEach((spec) => {
46
+ if (spec.type === "ImportSpecifier" &&
47
+ spec.imported.type === "Identifier") {
48
+ const oldName = spec.imported.name;
49
+ if (typeRenames[oldName]) {
50
+ spec.imported.name = typeRenames[oldName];
51
+ if (spec.local?.type === "Identifier" &&
52
+ spec.local.name === oldName) {
53
+ spec.local.name = typeRenames[oldName];
54
+ }
55
+ hasChanges = true;
56
+ }
57
+ }
58
+ });
59
+ });
60
+ // Rename type references
61
+ for (const [oldName, newName] of Object.entries(typeRenames)) {
62
+ root.find(j.Identifier, { name: oldName }).forEach((path) => {
63
+ // Skip import specifiers (already handled)
64
+ if (path.parent.node.type === "ImportSpecifier" ||
65
+ path.parent.node.type === "ImportDefaultSpecifier") {
66
+ return;
67
+ }
68
+ path.node.name = newName;
69
+ hasChanges = true;
70
+ });
71
+ // Also rename TSTypeReference
72
+ root.find(j.TSTypeReference, {
73
+ typeName: { name: oldName },
74
+ }).forEach((path) => {
75
+ if (path.node.typeName.type === "Identifier") {
76
+ path.node.typeName.name = newName;
77
+ hasChanges = true;
78
+ }
79
+ });
80
+ }
81
+ // Rename method calls: .connect() → .initialize(), .close() → .destroy()
82
+ for (const [oldMethod, newMethod] of Object.entries(methodRenames)) {
83
+ root.find(j.CallExpression, {
84
+ callee: {
85
+ type: "MemberExpression",
86
+ property: { name: oldMethod },
87
+ },
88
+ }).forEach((path) => {
89
+ if (path.node.callee.type === "MemberExpression" &&
90
+ path.node.callee.property.type === "Identifier") {
91
+ path.node.callee.property.name = newMethod;
92
+ hasChanges = true;
93
+ }
94
+ });
95
+ }
96
+ // Rename property access: .isConnected → .isInitialized
97
+ for (const [oldProp, newProp] of Object.entries(propertyRenames)) {
98
+ root.find(j.MemberExpression, {
99
+ property: { name: oldProp },
100
+ }).forEach((path) => {
101
+ if (path.node.property.type === "Identifier") {
102
+ path.node.property.name = newProp;
103
+ hasChanges = true;
104
+ }
105
+ });
106
+ }
107
+ return hasChanges ? root.toSource() : undefined;
108
+ };
109
+ exports.renameConnectionToDataSource = renameConnectionToDataSource;
110
+ exports.default = exports.renameConnectionToDataSource;
111
+ //# sourceMappingURL=rename-connection-to-datasource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-connection-to-datasource.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-connection-to-datasource.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,2CAA2C,CAAA;AAE/D,MAAM,4BAA4B,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACrE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,qBAAqB;IACrB,MAAM,WAAW,GAA2B;QACxC,UAAU,EAAE,YAAY;QACxB,iBAAiB,EAAE,mBAAmB;QACtC,qBAAqB,EAAE,uBAAuB;QAC9C,sBAAsB,EAAE,wBAAwB;QAChD,wBAAwB,EAAE,0BAA0B;QACpD,yBAAyB,EAAE,2BAA2B;QACtD,0BAA0B,EAAE,4BAA4B;QACxD,0BAA0B,EAAE,4BAA4B;QACxD,uBAAuB,EAAE,yBAAyB;QAClD,uBAAuB,EAAE,gCAAgC;QACzD,8BAA8B,EAAE,gCAAgC;QAChE,oBAAoB,EAAE,sBAAsB;QAC5C,sBAAsB,EAAE,wBAAwB;QAChD,wBAAwB,EAAE,0BAA0B;QACpD,6BAA6B,EAAE,+BAA+B;QAC9D,4BAA4B,EAAE,8BAA8B;QAC5D,qBAAqB,EAAE,uBAAuB;QAC9C,4BAA4B,EAAE,8BAA8B;QAC5D,+BAA+B,EAAE,iCAAiC;QAClE,wBAAwB,EAAE,0BAA0B;KACvD,CAAA;IAED,oDAAoD;IACpD,MAAM,aAAa,GAA2B;QAC1C,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,SAAS;KACnB,CAAA;IAED,mBAAmB;IACnB,MAAM,eAAe,GAA2B;QAC5C,WAAW,EAAE,eAAe;KAC/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AM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE;YAC1B,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SAC9B,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAA;gBACjC,UAAU,GAAG,IAAI,CAAA;YACrB,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAxHY,QAAA,4BAA4B,gCAwHxC;AAED,kBAAe,oCAA4B,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "rename `Repository.exist()` to `exists()`";
3
+ export declare const renameExistToExists: (file: FileInfo, api: API) => string | undefined;
4
+ export default renameExistToExists;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renameExistToExists = exports.description = void 0;
4
+ exports.description = "rename `Repository.exist()` to `exists()`";
5
+ const renameExistToExists = (file, api) => {
6
+ const j = api.jscodeshift;
7
+ const root = j(file.source);
8
+ let hasChanges = false;
9
+ root.find(j.CallExpression, {
10
+ callee: {
11
+ type: "MemberExpression",
12
+ property: { name: "exist" },
13
+ },
14
+ }).forEach((path) => {
15
+ if (path.node.callee.type === "MemberExpression" &&
16
+ path.node.callee.property.type === "Identifier") {
17
+ path.node.callee.property.name = "exists";
18
+ hasChanges = true;
19
+ }
20
+ });
21
+ return hasChanges ? root.toSource() : undefined;
22
+ };
23
+ exports.renameExistToExists = renameExistToExists;
24
+ exports.default = exports.renameExistToExists;
25
+ //# sourceMappingURL=rename-exist-to-exists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-exist-to-exists.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-exist-to-exists.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,2CAA2C,CAAA;AAE/D,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC5D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,MAAM,EAAE;YACJ,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SAC9B;KACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IACI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;YAC5C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,EACjD,CAAC;YACC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAA;YACzC,UAAU,GAAG,IAAI,CAAA;QACrB,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AArBY,QAAA,mBAAmB,uBAqB/B;AAED,kBAAe,2BAAmB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "replace `findByIds()` with `findBy()` and `In` operator";
3
+ export declare const renameFindByIds: (file: FileInfo, api: API) => string | undefined;
4
+ export default renameFindByIds;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renameFindByIds = exports.description = void 0;
4
+ exports.description = "replace `findByIds()` with `findBy()` and `In` operator";
5
+ const renameFindByIds = (file, api) => {
6
+ const j = api.jscodeshift;
7
+ const root = j(file.source);
8
+ let hasChanges = false;
9
+ let needsInImport = false;
10
+ root.find(j.CallExpression, {
11
+ callee: {
12
+ type: "MemberExpression",
13
+ property: { name: "findByIds" },
14
+ },
15
+ }).forEach((path) => {
16
+ if (path.node.callee.type !== "MemberExpression" ||
17
+ path.node.arguments.length < 1) {
18
+ return;
19
+ }
20
+ const idsArg = path.node.arguments[0];
21
+ // Replace .findByIds(ids) with .findBy({ id: In(ids) })
22
+ path.node.callee.property = j.identifier("findBy");
23
+ path.node.arguments = [
24
+ j.objectExpression([
25
+ j.property("init", j.identifier("id"), j.callExpression(j.identifier("In"), [idsArg])),
26
+ ]),
27
+ ];
28
+ hasChanges = true;
29
+ needsInImport = true;
30
+ });
31
+ // Add In import if needed
32
+ if (needsInImport) {
33
+ const typeormImports = root.find(j.ImportDeclaration, {
34
+ source: { value: "typeorm" },
35
+ });
36
+ let hasInImport = false;
37
+ typeormImports.forEach((path) => {
38
+ path.node.specifiers?.forEach((spec) => {
39
+ if (spec.type === "ImportSpecifier" &&
40
+ spec.imported.type === "Identifier" &&
41
+ spec.imported.name === "In") {
42
+ hasInImport = true;
43
+ }
44
+ });
45
+ });
46
+ if (!hasInImport) {
47
+ if (typeormImports.length > 0) {
48
+ // Add to existing typeorm import
49
+ typeormImports.at(0).forEach((path) => {
50
+ path.node.specifiers?.push(j.importSpecifier(j.identifier("In")));
51
+ });
52
+ }
53
+ else {
54
+ // Create new import
55
+ const newImport = j.importDeclaration([j.importSpecifier(j.identifier("In"))], j.literal("typeorm"));
56
+ root.find(j.ImportDeclaration).at(-1).insertAfter(newImport);
57
+ }
58
+ }
59
+ }
60
+ return hasChanges ? root.toSource() : undefined;
61
+ };
62
+ exports.renameFindByIds = renameFindByIds;
63
+ exports.default = exports.renameFindByIds;
64
+ //# sourceMappingURL=rename-find-by-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-find-by-ids.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-find-by-ids.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GACpB,yDAAyD,CAAA;AAEtD,MAAM,eAAe,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACxD,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,IAAI,aAAa,GAAG,KAAK,CAAA;IAEzB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,MAAM,EAAE;YACJ,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;SAClC;KACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IACI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;YAC5C,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAChC,CAAC;YACC,OAAM;QACV,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAErC,wDAAwD;QACxD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QAClD,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG;YAClB,CAAC,CAAC,gBAAgB,CAAC;gBACf,CAAC,CAAC,QAAQ,CACN,MAA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BACJ,oBAAoB;gBACpB,MAAM,SAAS,GAAG,CAAC,CAAC,iBAAiB,CACjC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EACvC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CACvB,CAAA;gBACD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;YAChE,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA5EY,QAAA,eAAe,mBA4E3B;AAED,kBAAe,uBAAe,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "replace removed `getAllMigrations()` with TODO comment";
3
+ export declare const manual = true;
4
+ export declare const renameGetAllMigrations: (file: FileInfo, api: API) => string | undefined;
5
+ export default renameGetAllMigrations;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renameGetAllMigrations = exports.manual = exports.description = void 0;
4
+ const todo_1 = require("../todo");
5
+ exports.description = "replace removed `getAllMigrations()` with TODO comment";
6
+ exports.manual = true;
7
+ const renameGetAllMigrations = (file, api) => {
8
+ const j = api.jscodeshift;
9
+ const root = j(file.source);
10
+ let hasChanges = false;
11
+ root.find(j.CallExpression, {
12
+ callee: {
13
+ type: "MemberExpression",
14
+ property: { name: "getAllMigrations" },
15
+ },
16
+ }).forEach((path) => {
17
+ // Add a TODO comment before the statement
18
+ const statement = j(path).closest(j.ExpressionStatement);
19
+ if (statement.length > 0) {
20
+ statement.forEach((stmtPath) => {
21
+ (0, todo_1.addTodoComment)(stmtPath.node, "getAllMigrations() was removed in TypeORM v1. Use getPendingMigrations(), getExecutedMigrations(), or dataSource.migrations instead.", j);
22
+ });
23
+ }
24
+ hasChanges = true;
25
+ });
26
+ if (hasChanges)
27
+ (0, todo_1.reportTodo)("rename-get-all-migrations", file, api);
28
+ return hasChanges ? root.toSource() : undefined;
29
+ };
30
+ exports.renameGetAllMigrations = renameGetAllMigrations;
31
+ exports.default = exports.renameGetAllMigrations;
32
+ //# sourceMappingURL=rename-get-all-migrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-get-all-migrations.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-get-all-migrations.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,wDAAwD,CAAA;AAC/C,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,sBAAsB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,MAAM,EAAE;YACJ,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;SACzC;KACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,0CAA0C;QAC1C,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAA;QACxD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAC3B,IAAA,qBAAc,EACV,QAAQ,CAAC,IAAI,EACb,sIAAsI,EACtI,CAAC,CACJ,CAAA;YACL,CAAC,CAAC,CAAA;QACN,CAAC;QACD,UAAU,GAAG,IAAI,CAAA;IACrB,CAAC,CAAC,CAAA;IAEF,IAAI,UAAU;QAAE,IAAA,iBAAU,EAAC,2BAA2B,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAElE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA5BY,QAAA,sBAAsB,0BA4BlC;AAED,kBAAe,8BAAsB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "replace removed `loadedTables` and `loadedViews` with TODO";
3
+ export declare const manual = true;
4
+ export declare const renameLoadedTablesViews: (file: FileInfo, api: API) => string | undefined;
5
+ export default renameLoadedTablesViews;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renameLoadedTablesViews = exports.manual = exports.description = void 0;
4
+ const todo_1 = require("../todo");
5
+ exports.description = "replace removed `loadedTables` and `loadedViews` with TODO";
6
+ exports.manual = true;
7
+ const renameLoadedTablesViews = (file, api) => {
8
+ const j = api.jscodeshift;
9
+ const root = j(file.source);
10
+ let hasChanges = false;
11
+ let hasTodos = false;
12
+ const removedProps = new Set(["loadedTables", "loadedViews"]);
13
+ root.find(j.MemberExpression).forEach((path) => {
14
+ if (path.node.property.type !== "Identifier")
15
+ return;
16
+ if (!removedProps.has(path.node.property.name))
17
+ return;
18
+ const propName = path.node.property.name;
19
+ // Find the containing statement to add a comment
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ let current = path;
22
+ while (current.parent && current.parent.node.type !== "Program") {
23
+ if (current.parent.node.type === "ExpressionStatement" ||
24
+ current.parent.node.type === "VariableDeclaration" ||
25
+ current.parent.node.type === "ReturnStatement") {
26
+ const stmt = current.parent.node;
27
+ const message = `\`${propName}\` was removed in TypeORM v1. Use async \`loadTables()\` / \`loadViews()\` methods instead. See migration guide: https://typeorm.io/docs/guides/migration-v1`;
28
+ // Avoid duplicate comments
29
+ const commentValue = ` TODO: ${message}`;
30
+ const comments = (stmt.comments = stmt.comments || []);
31
+ const hasSameComment = comments.some((c) => c.value === commentValue);
32
+ if (!hasSameComment) {
33
+ (0, todo_1.addTodoComment)(stmt, message, j);
34
+ hasTodos = true;
35
+ }
36
+ hasChanges = true;
37
+ break;
38
+ }
39
+ current = current.parent;
40
+ }
41
+ });
42
+ if (hasTodos)
43
+ (0, todo_1.reportTodo)("rename-loaded-tables-views", file, api);
44
+ return hasChanges ? root.toSource() : undefined;
45
+ };
46
+ exports.renameLoadedTablesViews = renameLoadedTablesViews;
47
+ exports.default = exports.renameLoadedTablesViews;
48
+ //# sourceMappingURL=rename-loaded-tables-views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-loaded-tables-views.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-loaded-tables-views.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,4DAA4D,CAAA;AACnD,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,uBAAuB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAChE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,IAAI,QAAQ,GAAG,KAAK,CAAA;IAEpB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC,CAAA;IAE7D,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;YAAE,OAAM;QACpD,IAAI,CAAC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AAI,QAAQ;QAAE,IAAA,iBAAU,EAAC,4BAA4B,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAEjE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA9CY,QAAA,uBAAuB,2BA8CnC;AAED,kBAAe,+BAAuB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { API, FileInfo } from "jscodeshift";
2
+ export declare const description = "replace object-style `orUpdate()` with array-style signature";
3
+ export declare const renameOrUpdateOverload: (file: FileInfo, api: API) => string | undefined;
4
+ export default renameOrUpdateOverload;