@typeorm/codemod 1.0.0 → 1.0.2

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 (250) hide show
  1. package/README.md +13 -10
  2. package/dist/cli/print-guide.js +2 -2
  3. package/dist/cli/print-summary.js +3 -2
  4. package/dist/cli/print-summary.js.map +1 -1
  5. package/dist/cli/print-usage.js +2 -1
  6. package/dist/cli/print-usage.js.map +1 -1
  7. package/dist/cli/run-transforms.js +181 -79
  8. package/dist/cli/run-transforms.js.map +1 -1
  9. package/dist/dependencies/v1.js +23 -9
  10. package/dist/dependencies/v1.js.map +1 -1
  11. package/dist/index.js +8 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/transforms/ast-helpers.js +779 -19
  14. package/dist/transforms/ast-helpers.js.map +1 -1
  15. package/dist/transforms/stats.js +11 -0
  16. package/dist/transforms/stats.js.map +1 -1
  17. package/dist/transforms/todo.js +42 -2
  18. package/dist/transforms/todo.js.map +1 -1
  19. package/dist/transforms/v1/column-readonly.js +28 -13
  20. package/dist/transforms/v1/column-readonly.js.map +1 -1
  21. package/dist/transforms/v1/column-unsigned-numeric.js +27 -26
  22. package/dist/transforms/v1/column-unsigned-numeric.js.map +1 -1
  23. package/dist/transforms/v1/column-width-zerofill.js +2 -1
  24. package/dist/transforms/v1/column-width-zerofill.js.map +1 -1
  25. package/dist/transforms/v1/connection-manager.js +82 -0
  26. package/dist/transforms/v1/connection-manager.js.map +1 -0
  27. package/dist/transforms/v1/connection-options-reader.js +214 -0
  28. package/dist/transforms/v1/connection-options-reader.js.map +1 -0
  29. package/dist/transforms/v1/connection-to-datasource.js +858 -93
  30. package/dist/transforms/v1/connection-to-datasource.js.map +1 -1
  31. package/dist/transforms/v1/datasource-expo.js +79 -0
  32. package/dist/transforms/v1/datasource-expo.js.map +1 -0
  33. package/dist/transforms/v1/datasource-mongodb.js +103 -64
  34. package/dist/transforms/v1/datasource-mongodb.js.map +1 -1
  35. package/dist/transforms/v1/datasource-mssql.js +88 -46
  36. package/dist/transforms/v1/datasource-mssql.js.map +1 -1
  37. package/dist/transforms/v1/datasource-mysql-connector.js +25 -6
  38. package/dist/transforms/v1/datasource-mysql-connector.js.map +1 -1
  39. package/dist/transforms/v1/datasource-name.js +19 -14
  40. package/dist/transforms/v1/datasource-name.js.map +1 -1
  41. package/dist/transforms/v1/datasource-sap.js +51 -26
  42. package/dist/transforms/v1/datasource-sap.js.map +1 -1
  43. package/dist/transforms/v1/datasource-sqlite-options.js +48 -13
  44. package/dist/transforms/v1/datasource-sqlite-options.js.map +1 -1
  45. package/dist/transforms/v1/datasource-sqlite-type.js +28 -7
  46. package/dist/transforms/v1/datasource-sqlite-type.js.map +1 -1
  47. package/dist/transforms/v1/file-logger.js +163 -0
  48. package/dist/transforms/v1/file-logger.js.map +1 -0
  49. package/dist/transforms/v1/find-options-join.js +84 -0
  50. package/dist/transforms/v1/find-options-join.js.map +1 -0
  51. package/dist/transforms/v1/find-options-lock-modes.js +26 -21
  52. package/dist/transforms/v1/find-options-lock-modes.js.map +1 -1
  53. package/dist/transforms/v1/find-options-string-relations.js +75 -9
  54. package/dist/transforms/v1/find-options-string-relations.js.map +1 -1
  55. package/dist/transforms/v1/find-options-string-select.js +75 -11
  56. package/dist/transforms/v1/find-options-string-select.js.map +1 -1
  57. package/dist/transforms/v1/global-functions.js +150 -64
  58. package/dist/transforms/v1/global-functions.js.map +1 -1
  59. package/dist/transforms/v1/index.js +16 -3
  60. package/dist/transforms/v1/index.js.map +1 -1
  61. package/dist/transforms/v1/migrations-get-all.js +25 -9
  62. package/dist/transforms/v1/migrations-get-all.js.map +1 -1
  63. package/dist/transforms/v1/mongodb-stats.js +21 -11
  64. package/dist/transforms/v1/mongodb-stats.js.map +1 -1
  65. package/dist/transforms/v1/mongodb-types.js +59 -2
  66. package/dist/transforms/v1/mongodb-types.js.map +1 -1
  67. package/dist/transforms/v1/query-builder-native-parameters.js +2 -0
  68. package/dist/transforms/v1/query-builder-native-parameters.js.map +1 -1
  69. package/dist/transforms/v1/query-builder-on-conflict.js +32 -18
  70. package/dist/transforms/v1/query-builder-on-conflict.js.map +1 -1
  71. package/dist/transforms/v1/query-builder-or-update.js +8 -4
  72. package/dist/transforms/v1/query-builder-or-update.js.map +1 -1
  73. package/dist/transforms/v1/query-builder-print-sql.js +18 -12
  74. package/dist/transforms/v1/query-builder-print-sql.js.map +1 -1
  75. package/dist/transforms/v1/query-builder-replace-property-names.js +16 -12
  76. package/dist/transforms/v1/query-builder-replace-property-names.js.map +1 -1
  77. package/dist/transforms/v1/query-builder-where-expression.js +29 -12
  78. package/dist/transforms/v1/query-builder-where-expression.js.map +1 -1
  79. package/dist/transforms/v1/query-runner-loaded-tables-views.js +1 -6
  80. package/dist/transforms/v1/query-runner-loaded-tables-views.js.map +1 -1
  81. package/dist/transforms/v1/relation-count.js +78 -12
  82. package/dist/transforms/v1/relation-count.js.map +1 -1
  83. package/dist/transforms/v1/repository-abstract.js +148 -34
  84. package/dist/transforms/v1/repository-abstract.js.map +1 -1
  85. package/dist/transforms/v1/repository-exist.js +20 -1
  86. package/dist/transforms/v1/repository-exist.js.map +1 -1
  87. package/dist/transforms/v1/repository-find-by-ids.js +67 -27
  88. package/dist/transforms/v1/repository-find-by-ids.js.map +1 -1
  89. package/dist/transforms/v1/repository-find-one-by-id.js +6 -0
  90. package/dist/transforms/v1/repository-find-one-by-id.js.map +1 -1
  91. package/dist/transforms/v1/use-container.js +65 -15
  92. package/dist/transforms/v1/use-container.js.map +1 -1
  93. package/package.json +3 -1
  94. package/dist/cli/colors.d.ts +0 -7
  95. package/dist/cli/colors.js +0 -12
  96. package/dist/cli/colors.js.map +0 -1
  97. package/dist/cli/error.d.ts +0 -1
  98. package/dist/cli/error.js +0 -11
  99. package/dist/cli/error.js.map +0 -1
  100. package/dist/cli/list-transforms.d.ts +0 -1
  101. package/dist/cli/parse-args.d.ts +0 -10
  102. package/dist/cli/print-guide.d.ts +0 -1
  103. package/dist/cli/print-summary.d.ts +0 -17
  104. package/dist/cli/print-todos.d.ts +0 -1
  105. package/dist/cli/print-usage.d.ts +0 -1
  106. package/dist/cli/run-dependencies.d.ts +0 -6
  107. package/dist/cli/run-transforms.d.ts +0 -21
  108. package/dist/cli/run.d.ts +0 -9
  109. package/dist/dependencies/config.d.ts +0 -24
  110. package/dist/dependencies/find-package-json.d.ts +0 -5
  111. package/dist/dependencies/index.d.ts +0 -5
  112. package/dist/dependencies/upgrade.d.ts +0 -11
  113. package/dist/dependencies/v1.d.ts +0 -2
  114. package/dist/index.d.ts +0 -2
  115. package/dist/lib/colors.d.ts +0 -9
  116. package/dist/lib/error.d.ts +0 -1
  117. package/dist/lib/format-time.d.ts +0 -1
  118. package/dist/lib/highlight.d.ts +0 -1
  119. package/dist/lib/spinner.d.ts +0 -5
  120. package/dist/transforms/ast-helpers.d.ts +0 -50
  121. package/dist/transforms/index.d.ts +0 -7
  122. package/dist/transforms/resolve.d.ts +0 -1
  123. package/dist/transforms/scan.d.ts +0 -4
  124. package/dist/transforms/scan.js +0 -33
  125. package/dist/transforms/scan.js.map +0 -1
  126. package/dist/transforms/stats.d.ts +0 -11
  127. package/dist/transforms/todo.d.ts +0 -2
  128. package/dist/transforms/transformer.d.ts +0 -8
  129. package/dist/transforms/v1/column-readonly.d.ts +0 -6
  130. package/dist/transforms/v1/column-unsigned-numeric.d.ts +0 -6
  131. package/dist/transforms/v1/column-width-zerofill.d.ts +0 -6
  132. package/dist/transforms/v1/connection-to-datasource.d.ts +0 -6
  133. package/dist/transforms/v1/datasource-mongodb.d.ts +0 -7
  134. package/dist/transforms/v1/datasource-mssql-domain.d.ts +0 -7
  135. package/dist/transforms/v1/datasource-mssql-domain.js +0 -35
  136. package/dist/transforms/v1/datasource-mssql-domain.js.map +0 -1
  137. package/dist/transforms/v1/datasource-mssql.d.ts +0 -7
  138. package/dist/transforms/v1/datasource-mysql-connector.d.ts +0 -6
  139. package/dist/transforms/v1/datasource-name.d.ts +0 -6
  140. package/dist/transforms/v1/datasource-sap.d.ts +0 -6
  141. package/dist/transforms/v1/datasource-sqlite-options.d.ts +0 -6
  142. package/dist/transforms/v1/datasource-sqlite-type.d.ts +0 -6
  143. package/dist/transforms/v1/find-options-lock-modes.d.ts +0 -6
  144. package/dist/transforms/v1/find-options-string-relations.d.ts +0 -6
  145. package/dist/transforms/v1/find-options-string-select.d.ts +0 -6
  146. package/dist/transforms/v1/global-functions.d.ts +0 -7
  147. package/dist/transforms/v1/index.d.ts +0 -40
  148. package/dist/transforms/v1/migrations-get-all.d.ts +0 -7
  149. package/dist/transforms/v1/mongodb-stats.d.ts +0 -7
  150. package/dist/transforms/v1/mongodb-types.d.ts +0 -6
  151. package/dist/transforms/v1/query-builder-native-parameters.d.ts +0 -6
  152. package/dist/transforms/v1/query-builder-on-conflict.d.ts +0 -7
  153. package/dist/transforms/v1/query-builder-or-update.d.ts +0 -6
  154. package/dist/transforms/v1/query-builder-print-sql.d.ts +0 -7
  155. package/dist/transforms/v1/query-builder-replace-property-names.d.ts +0 -7
  156. package/dist/transforms/v1/query-builder-where-expression.d.ts +0 -6
  157. package/dist/transforms/v1/query-runner-loaded-tables-views.d.ts +0 -7
  158. package/dist/transforms/v1/relation-count.d.ts +0 -7
  159. package/dist/transforms/v1/remove-abstract-repository.d.ts +0 -5
  160. package/dist/transforms/v1/remove-abstract-repository.js +0 -93
  161. package/dist/transforms/v1/remove-abstract-repository.js.map +0 -1
  162. package/dist/transforms/v1/remove-connector-package.d.ts +0 -4
  163. package/dist/transforms/v1/remove-connector-package.js +0 -19
  164. package/dist/transforms/v1/remove-connector-package.js.map +0 -1
  165. package/dist/transforms/v1/remove-datasource-name.d.ts +0 -4
  166. package/dist/transforms/v1/remove-datasource-name.js +0 -56
  167. package/dist/transforms/v1/remove-datasource-name.js.map +0 -1
  168. package/dist/transforms/v1/remove-mongodb-options.d.ts +0 -5
  169. package/dist/transforms/v1/remove-mongodb-options.js +0 -86
  170. package/dist/transforms/v1/remove-mongodb-options.js.map +0 -1
  171. package/dist/transforms/v1/remove-relation-count.d.ts +0 -5
  172. package/dist/transforms/v1/remove-relation-count.js +0 -49
  173. package/dist/transforms/v1/remove-relation-count.js.map +0 -1
  174. package/dist/transforms/v1/remove-replace-property-names.d.ts +0 -5
  175. package/dist/transforms/v1/remove-replace-property-names.js +0 -35
  176. package/dist/transforms/v1/remove-replace-property-names.js.map +0 -1
  177. package/dist/transforms/v1/remove-sap-options.d.ts +0 -4
  178. package/dist/transforms/v1/remove-sap-options.js +0 -54
  179. package/dist/transforms/v1/remove-sap-options.js.map +0 -1
  180. package/dist/transforms/v1/remove-unsigned-numeric.d.ts +0 -4
  181. package/dist/transforms/v1/remove-unsigned-numeric.js +0 -76
  182. package/dist/transforms/v1/remove-unsigned-numeric.js.map +0 -1
  183. package/dist/transforms/v1/remove-use-container.d.ts +0 -5
  184. package/dist/transforms/v1/remove-use-container.js +0 -63
  185. package/dist/transforms/v1/remove-use-container.js.map +0 -1
  186. package/dist/transforms/v1/remove-width-zerofill.d.ts +0 -4
  187. package/dist/transforms/v1/remove-width-zerofill.js +0 -29
  188. package/dist/transforms/v1/remove-width-zerofill.js.map +0 -1
  189. package/dist/transforms/v1/rename-connection-to-datasource.d.ts +0 -4
  190. package/dist/transforms/v1/rename-connection-to-datasource.js +0 -111
  191. package/dist/transforms/v1/rename-connection-to-datasource.js.map +0 -1
  192. package/dist/transforms/v1/rename-exist-to-exists.d.ts +0 -4
  193. package/dist/transforms/v1/rename-exist-to-exists.js +0 -25
  194. package/dist/transforms/v1/rename-exist-to-exists.js.map +0 -1
  195. package/dist/transforms/v1/rename-find-by-ids.d.ts +0 -4
  196. package/dist/transforms/v1/rename-find-by-ids.js +0 -64
  197. package/dist/transforms/v1/rename-find-by-ids.js.map +0 -1
  198. package/dist/transforms/v1/rename-get-all-migrations.d.ts +0 -5
  199. package/dist/transforms/v1/rename-get-all-migrations.js +0 -32
  200. package/dist/transforms/v1/rename-get-all-migrations.js.map +0 -1
  201. package/dist/transforms/v1/rename-loaded-tables-views.d.ts +0 -5
  202. package/dist/transforms/v1/rename-loaded-tables-views.js +0 -48
  203. package/dist/transforms/v1/rename-loaded-tables-views.js.map +0 -1
  204. package/dist/transforms/v1/rename-or-update-overload.d.ts +0 -4
  205. package/dist/transforms/v1/rename-or-update-overload.js +0 -46
  206. package/dist/transforms/v1/rename-or-update-overload.js.map +0 -1
  207. package/dist/transforms/v1/rename-print-sql-to-log-query.d.ts +0 -4
  208. package/dist/transforms/v1/rename-print-sql-to-log-query.js +0 -25
  209. package/dist/transforms/v1/rename-print-sql-to-log-query.js.map +0 -1
  210. package/dist/transforms/v1/replace-global-functions.d.ts +0 -5
  211. package/dist/transforms/v1/replace-global-functions.js +0 -92
  212. package/dist/transforms/v1/replace-global-functions.js.map +0 -1
  213. package/dist/transforms/v1/replace-lock-modes.d.ts +0 -4
  214. package/dist/transforms/v1/replace-lock-modes.js +0 -75
  215. package/dist/transforms/v1/replace-lock-modes.js.map +0 -1
  216. package/dist/transforms/v1/replace-mongodb-stats.d.ts +0 -5
  217. package/dist/transforms/v1/replace-mongodb-stats.js +0 -54
  218. package/dist/transforms/v1/replace-mongodb-stats.js.map +0 -1
  219. package/dist/transforms/v1/replace-mongodb-types.d.ts +0 -4
  220. package/dist/transforms/v1/replace-mongodb-types.js +0 -72
  221. package/dist/transforms/v1/replace-mongodb-types.js.map +0 -1
  222. package/dist/transforms/v1/replace-mssql-domain.d.ts +0 -5
  223. package/dist/transforms/v1/replace-mssql-domain.js +0 -25
  224. package/dist/transforms/v1/replace-mssql-domain.js.map +0 -1
  225. package/dist/transforms/v1/replace-on-conflict.d.ts +0 -5
  226. package/dist/transforms/v1/replace-on-conflict.js +0 -49
  227. package/dist/transforms/v1/replace-on-conflict.js.map +0 -1
  228. package/dist/transforms/v1/replace-readonly-column.d.ts +0 -4
  229. package/dist/transforms/v1/replace-readonly-column.js +0 -28
  230. package/dist/transforms/v1/replace-readonly-column.js.map +0 -1
  231. package/dist/transforms/v1/replace-set-native-parameters.d.ts +0 -4
  232. package/dist/transforms/v1/replace-set-native-parameters.js +0 -25
  233. package/dist/transforms/v1/replace-set-native-parameters.js.map +0 -1
  234. package/dist/transforms/v1/replace-sqlite-options.d.ts +0 -4
  235. package/dist/transforms/v1/replace-sqlite-options.js +0 -29
  236. package/dist/transforms/v1/replace-sqlite-options.js.map +0 -1
  237. package/dist/transforms/v1/replace-sqlite-type.d.ts +0 -4
  238. package/dist/transforms/v1/replace-sqlite-type.js +0 -22
  239. package/dist/transforms/v1/replace-sqlite-type.js.map +0 -1
  240. package/dist/transforms/v1/replace-where-expression-type.d.ts +0 -4
  241. package/dist/transforms/v1/replace-where-expression-type.js +0 -41
  242. package/dist/transforms/v1/replace-where-expression-type.js.map +0 -1
  243. package/dist/transforms/v1/repository-abstract.d.ts +0 -7
  244. package/dist/transforms/v1/repository-exist.d.ts +0 -6
  245. package/dist/transforms/v1/repository-find-by-ids.d.ts +0 -6
  246. package/dist/transforms/v1/repository-find-one-by-id.d.ts +0 -6
  247. package/dist/transforms/v1/upgrade-dependencies.d.ts +0 -15
  248. package/dist/transforms/v1/upgrade-dependencies.js +0 -163
  249. package/dist/transforms/v1/upgrade-dependencies.js.map +0 -1
  250. package/dist/transforms/v1/use-container.d.ts +0 -7
@@ -1 +0,0 @@
1
- {"version":3,"file":"remove-relation-count.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-relation-count.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,sDAAsD,CAAA;AAC7C,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,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;IACtB,IAAI,QAAQ,GAAG,KAAK,CA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A,iBAAU,EAAC,uBAAuB,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAE5D,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAhDY,QAAA,mBAAmB,uBAgD/B;AAED,kBAAe,2BAAmB,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "flag removed `replacePropertyNames` override with TODO";
3
- export declare const manual = true;
4
- export declare const removeReplacePropertyNames: (file: FileInfo, api: API) => string | undefined;
5
- export default removeReplacePropertyNames;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeReplacePropertyNames = exports.manual = exports.description = void 0;
4
- const todo_1 = require("../todo");
5
- exports.description = "flag removed `replacePropertyNames` override with TODO";
6
- exports.manual = true;
7
- const removeReplacePropertyNames = (file, api) => {
8
- const j = api.jscodeshift;
9
- const root = j(file.source);
10
- let hasChanges = false;
11
- let hasTodos = false;
12
- // Find method declarations named replacePropertyNames in classes
13
- const message = "`replacePropertyNames` was removed in TypeORM v1. This method override is no longer called. See migration guide: https://typeorm.io/docs/guides/migration-v1";
14
- root.find(j.ClassMethod, {
15
- key: { type: "Identifier", name: "replacePropertyNames" },
16
- }).forEach((path) => {
17
- (0, todo_1.addTodoComment)(path.node, message, j);
18
- hasChanges = true;
19
- hasTodos = true;
20
- });
21
- // Also check for MethodDefinition (alternative AST representation)
22
- root.find(j.MethodDefinition, {
23
- key: { type: "Identifier", name: "replacePropertyNames" },
24
- }).forEach((path) => {
25
- (0, todo_1.addTodoComment)(path.node, message, j);
26
- hasChanges = true;
27
- hasTodos = true;
28
- });
29
- if (hasTodos)
30
- (0, todo_1.reportTodo)("remove-replace-property-names", file, api);
31
- return hasChanges ? root.toSource() : undefined;
32
- };
33
- exports.removeReplacePropertyNames = removeReplacePropertyNames;
34
- exports.default = exports.removeReplacePropertyNames;
35
- //# sourceMappingURL=remove-replace-property-names.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remove-replace-property-names.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-replace-property-names.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,wDAAwD,CAAA;AAC/C,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,0BAA0B,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACnE,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,iEAAiE;IACjE,MAAM,OAAO,GACT,8JAA8J,CAAA;IAElK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE;QACrB,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,sBAAsB,EAAE;KAC5D,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,qBAAc,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;QACrC,UAAU,GAAG,IAAI,CAAA;QACjB,QAAQ,GAAG,IAAI,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,mEAAmE;IACnE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE;QAC1B,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,sBAAsB,EAAE;KAC5D,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,qBAAc,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;QACrC,UAAU,GAAG,IAAI,CAAA;QACjB,QAAQ,GAAG,IAAI,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,IAAI,QAAQ;QAAE,IAAA,iBAAU,EAAC,+BAA+B,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAEpE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA9BY,QAAA,0BAA0B,8BA8BtC;AAED,kBAAe,kCAA0B,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "rename and remove deprecated SAP HANA connection options";
3
- export declare const removeSapOptions: (file: FileInfo, api: API) => string | undefined;
4
- export default removeSapOptions;
@@ -1,54 +0,0 @@
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
@@ -1 +0,0 @@
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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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;
@@ -1,76 +0,0 @@
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
@@ -1 +0,0 @@
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;YAA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,0 @@
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;
@@ -1,63 +0,0 @@
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
@@ -1 +0,0 @@
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,W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AAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAhEY,QAAA,kBAAkB,sBAgE9B;AAED,kBAAe,0BAAkB,CAAA"}
@@ -1,4 +0,0 @@
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;
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
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;
@@ -1,111 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"rename-connection-to-datasource.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-connection-to-datasource.ts"],"names":[],"mappings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,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"}
@@ -1,4 +0,0 @@
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;
@@ -1,25 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
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;
@@ -1,64 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"rename-find-by-ids.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-find-by-ids.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW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,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"}
@@ -1,5 +0,0 @@
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;
@@ -1,32 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"rename-get-all-migrations.js","sourceRoot":"","sources":["../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 @@
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;