@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,48 +0,0 @@
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
@@ -1 +0,0 @@
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,EAA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AI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;oBAChC,QAAQ,GAAG,IAAI,CAAA;gBACnB,CAAC;gBACD,UAAU,GAAG,IAAI,CAAA;gBACjB,MAAK;YACT,CAAC;YACD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,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"}
@@ -1,4 +0,0 @@
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;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renameOrUpdateOverload = exports.description = void 0;
4
- exports.description = "replace object-style `orUpdate()` with array-style signature";
5
- const renameOrUpdateOverload = (file, api) => {
6
- const j = api.jscodeshift;
7
- const root = j(file.source);
8
- let hasChanges = false;
9
- // Find .orUpdate({ conflict_target: [...], overwrite: [...] })
10
- root.find(j.CallExpression, {
11
- callee: {
12
- type: "MemberExpression",
13
- property: { type: "Identifier", name: "orUpdate" },
14
- },
15
- }).forEach((path) => {
16
- const args = path.node.arguments;
17
- if (args.length !== 1)
18
- return;
19
- const arg = args[0];
20
- if (arg.type !== "ObjectExpression")
21
- return;
22
- let conflictTarget = null;
23
- let overwrite = null;
24
- for (const prop of arg.properties) {
25
- if (prop.type !== "ObjectProperty")
26
- continue;
27
- if (prop.key.type !== "Identifier")
28
- continue;
29
- if (prop.key.name === "conflict_target") {
30
- conflictTarget = prop.value;
31
- }
32
- else if (prop.key.name === "overwrite") {
33
- overwrite = prop.value;
34
- }
35
- }
36
- if (!conflictTarget || !overwrite)
37
- return;
38
- // Transform to .orUpdate([overwrite], [conflict_target])
39
- path.node.arguments = [overwrite, conflictTarget];
40
- hasChanges = true;
41
- });
42
- return hasChanges ? root.toSource() : undefined;
43
- };
44
- exports.renameOrUpdateOverload = renameOrUpdateOverload;
45
- exports.default = exports.renameOrUpdateOverload;
46
- //# sourceMappingURL=rename-or-update-overload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rename-or-update-overload.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-or-update-overload.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GACpB,8DAA8D,CAAA;AAE3D,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,+DAA+D;IAC/D,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,MAAM,EAAE;YACJ,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE;SACrD;KACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAA;QAChC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QAE7B,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB;YAAE,OAAM;QAE3C,IAAI,cAAc,GAAQ,IAAI,CAAA;QAC9B,IAAI,SAAS,GAAQ,IAAI,CAAA;QAEzB,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;YAChC,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB;gBAAE,SAAQ;YAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;gBAAE,SAAQ;YAE5C,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;gBACtC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAA;YAC/B,CAAC;iBAAM,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBACvC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAA;YAC1B,CAAC;QACL,CAAC;QAED,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS;YAAE,OAAM;QAEzC,yDAAyD;QACzD,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;QACjD,UAAU,GAAG,IAAI,CAAA;IACrB,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAxCY,QAAA,sBAAsB,0BAwClC;AAED,kBAAe,8BAAsB,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "rename `printSql()` to `logQuery()`";
3
- export declare const renamePrintSqlToLogQuery: (file: FileInfo, api: API) => string | undefined;
4
- export default renamePrintSqlToLogQuery;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renamePrintSqlToLogQuery = exports.description = void 0;
4
- exports.description = "rename `printSql()` to `logQuery()`";
5
- const renamePrintSqlToLogQuery = (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: "printSql" },
13
- },
14
- }).forEach((path) => {
15
- if (path.node.callee.type === "MemberExpression" &&
16
- path.node.callee.property.type === "Identifier") {
17
- path.node.callee.property.name = "logQuery";
18
- hasChanges = true;
19
- }
20
- });
21
- return hasChanges ? root.toSource() : undefined;
22
- };
23
- exports.renamePrintSqlToLogQuery = renamePrintSqlToLogQuery;
24
- exports.default = exports.renamePrintSqlToLogQuery;
25
- //# sourceMappingURL=rename-print-sql-to-log-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rename-print-sql-to-log-query.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-print-sql-to-log-query.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,qCAAqC,CAAA;AAEzD,MAAM,wBAAwB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACjE,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,UAAU,EAAE;SACjC;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,UAAU,CAAA;YAC3C,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,wBAAwB,4BAqBpC;AAED,kBAAe,gCAAwB,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "replace deprecated global functions with `DataSource` methods";
3
- export declare const manual = true;
4
- export declare const replaceGlobalFunctions: (file: FileInfo, api: API) => string | undefined;
5
- export default replaceGlobalFunctions;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceGlobalFunctions = exports.manual = exports.description = void 0;
4
- const todo_1 = require("../todo");
5
- exports.description = "replace deprecated global functions with `DataSource` methods";
6
- exports.manual = true;
7
- const replaceGlobalFunctions = (file, api) => {
8
- const j = api.jscodeshift;
9
- const root = j(file.source);
10
- let hasChanges = false;
11
- const removedGlobals = new Set([
12
- "createConnection",
13
- "createConnections",
14
- "getConnection",
15
- "getConnectionManager",
16
- "getConnectionOptions",
17
- "getManager",
18
- "getSqljsManager",
19
- "getRepository",
20
- "getTreeRepository",
21
- "createQueryBuilder",
22
- "getMongoManager",
23
- "getMongoRepository",
24
- ]);
25
- // Simple replacements: getX(args) → dataSource.x(args)
26
- const simpleReplacements = {
27
- getManager: "dataSource.manager",
28
- getRepository: "dataSource.getRepository",
29
- getTreeRepository: "dataSource.getTreeRepository",
30
- createQueryBuilder: "dataSource.createQueryBuilder",
31
- getMongoManager: "dataSource.mongoManager",
32
- getMongoRepository: "dataSource.getMongoRepository",
33
- };
34
- // Replace function calls
35
- for (const [funcName, replacement] of Object.entries(simpleReplacements)) {
36
- root.find(j.CallExpression, {
37
- callee: { type: "Identifier", name: funcName },
38
- }).forEach((path) => {
39
- const parts = replacement.split(".");
40
- if (parts.length === 2 && !replacement.includes("(")) {
41
- // Property access like dataSource.manager — check if it's called with no args
42
- if (path.node.arguments.length === 0 &&
43
- !replacement.includes("get")) {
44
- // Replace with property access
45
- j(path).replaceWith(j.memberExpression(j.identifier(parts[0]), j.identifier(parts[1])));
46
- }
47
- else {
48
- // Replace with method call
49
- j(path).replaceWith(j.callExpression(j.memberExpression(j.identifier(parts[0]), j.identifier(parts[1])), path.node.arguments));
50
- }
51
- hasChanges = true;
52
- }
53
- });
54
- }
55
- // getConnection() → dataSource (just a reference)
56
- root.find(j.CallExpression, {
57
- callee: { type: "Identifier", name: "getConnection" },
58
- }).forEach((path) => {
59
- if (path.node.arguments.length === 0) {
60
- j(path).replaceWith(j.identifier("dataSource"));
61
- hasChanges = true;
62
- }
63
- });
64
- // Remove imports of deprecated globals from "typeorm"
65
- root.find(j.ImportDeclaration, {
66
- source: { value: "typeorm" },
67
- }).forEach((importPath) => {
68
- const remaining = importPath.node.specifiers?.filter((spec) => {
69
- if (spec.type === "ImportSpecifier" &&
70
- spec.imported.type === "Identifier") {
71
- return !removedGlobals.has(spec.imported.name);
72
- }
73
- return true;
74
- });
75
- if (remaining &&
76
- remaining.length !== importPath.node.specifiers?.length) {
77
- hasChanges = true;
78
- if (remaining.length === 0) {
79
- j(importPath).remove();
80
- }
81
- else {
82
- importPath.node.specifiers = remaining;
83
- }
84
- }
85
- });
86
- if (hasChanges)
87
- (0, todo_1.reportTodo)("replace-global-functions", file, api);
88
- return hasChanges ? root.toSource() : undefined;
89
- };
90
- exports.replaceGlobalFunctions = replaceGlobalFunctions;
91
- exports.default = exports.replaceGlobalFunctions;
92
- //# sourceMappingURL=replace-global-functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-global-functions.js","sourceRoot":"","sources":["../../../src/transforms/v1/replace-global-functions.ts"],"names":[],"mappings":";;;AACA,kCAAoC;AAEvB,QAAA,WAAW,GACpB,+DAA+D,CAAA;AACtD,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,MA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,CAAC,IAAI,EAAE,EAAE;YAC1D,IACI,IAAI,CAAC,IAAI,KAAK,iBAAiB;gBAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,EACrC,CAAC;gBACC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YAClD,CAAC;YACD,OAAO,IAAI,CAAA;QACf,CAAC,CAAC,CAAA;QAEF,IACI,SAAS;YACT,SAAS,CAAC,MAAM,KAAK,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EACzD,CAAC;YACC,UAAU,GAAG,IAAI,CAAA;YACjB,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAA;YAC1B,CAAC;iBAAM,CAAC;gBACJ,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;YAC1C,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,UAAU;QAAE,IAAA,iBAAU,EAAC,0BAA0B,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAEjE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA1GY,QAAA,sBAAsB,0BA0GlC;AAED,kBAAe,8BAAsB,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "replace deprecated pessimistic lock modes";
3
- export declare const replaceLockModes: (file: FileInfo, api: API) => string | undefined;
4
- export default replaceLockModes;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceLockModes = exports.description = void 0;
4
- const ast_helpers_1 = require("../ast-helpers");
5
- exports.description = "replace deprecated pessimistic lock modes";
6
- const replaceLockModes = (file, api) => {
7
- const j = api.jscodeshift;
8
- const root = j(file.source);
9
- let hasChanges = false;
10
- const lockModeMap = {
11
- pessimistic_partial_write: {
12
- mode: "pessimistic_write",
13
- onLocked: "skip_locked",
14
- },
15
- pessimistic_write_or_fail: {
16
- mode: "pessimistic_write",
17
- onLocked: "nowait",
18
- },
19
- };
20
- // Handle .setLock("pessimistic_partial_write") → .setLock("pessimistic_write").setOnLocked("skip_locked")
21
- root.find(j.CallExpression, {
22
- callee: {
23
- type: "MemberExpression",
24
- property: { name: "setLock" },
25
- },
26
- }).forEach((path) => {
27
- const arg = path.node.arguments[0];
28
- if (!arg)
29
- return;
30
- const value = (0, ast_helpers_1.getStringValue)(arg);
31
- if (!value || !lockModeMap[value])
32
- return;
33
- const replacement = lockModeMap[value];
34
- // Change the lock mode argument
35
- (0, ast_helpers_1.setStringValue)(arg, replacement.mode);
36
- // Wrap in .setOnLocked() call
37
- const setOnLocked = j.callExpression(j.memberExpression(path.node, j.identifier("setOnLocked")), [j.stringLiteral(replacement.onLocked)]);
38
- j(path).replaceWith(setOnLocked);
39
- hasChanges = true;
40
- });
41
- // Handle find options: { lock: { mode: "pessimistic_partial_write" } }
42
- // → { lock: { mode: "pessimistic_write", onLocked: "skip_locked" } }
43
- root.find(j.ObjectProperty, {
44
- key: { name: "mode" },
45
- }).forEach((path) => {
46
- const value = (0, ast_helpers_1.getStringValue)(path.node.value);
47
- if (!value || !lockModeMap[value])
48
- return;
49
- // Check parent is a lock options object
50
- const parent = path.parent;
51
- if (parent.node.type !== "ObjectExpression")
52
- return;
53
- const grandparent = parent.parent;
54
- if (grandparent.node.type !== "Property" ||
55
- grandparent.node.key.type !== "Identifier" ||
56
- grandparent.node.key.name !== "lock") {
57
- return;
58
- }
59
- const replacement = lockModeMap[value];
60
- // Update mode value
61
- (0, ast_helpers_1.setStringValue)(path.node.value, replacement.mode);
62
- // Add onLocked property to the lock object
63
- const hasOnLocked = parent.node.properties.some((p) => p.type === "Property" &&
64
- p.key.type === "Identifier" &&
65
- p.key.name === "onLocked");
66
- if (!hasOnLocked) {
67
- parent.node.properties.push(j.property("init", j.identifier("onLocked"), j.stringLiteral(replacement.onLocked)));
68
- }
69
- hasChanges = true;
70
- });
71
- return hasChanges ? root.toSource() : undefined;
72
- };
73
- exports.replaceLockModes = replaceLockModes;
74
- exports.default = exports.replaceLockModes;
75
- //# sourceMappingURL=replace-lock-modes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-lock-modes.js","sourceRoot":"","sources":["../../../src/transforms/v1/replace-lock-modes.ts"],"names":[],"mappings":";;;AACA,gDAA+D;AAElD,QAAA,WAAW,GAAG,2CAA2C,CAAA;AAE/D,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,WAAW,GAAuD;QACpE,yBAAyB,EAAE;YACvB,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,aAAa;SAC1B;QACD,yBAAyB,EAAE;YACvB,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,QAAQ;SACrB;KACJ,CAAA;IAED,0GAA0G;IAC1G,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,MAAM,EAAE;YACJ,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAChC;KACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAClC,IAAI,CAAC,GAAG;YAAE,OAAM;QAEhB,MAAM,KAAK,GAAG,IAAA,4BAAc,EAAC,GAAG,CAAC,CAAA;QACjC,IAAI,CAAC,KAAK,IA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AAK,MAAM,EACtC,CAAC;YACC,OAAM;QACV,CAAC;QAED,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;QAEtC,oBAAoB;QACpB,IAAA,4BAAc,EAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,CAAA;QAEjD,2CAA2C;QAC3C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAC3C,CAAC,CAAM,EAAE,EAAE,CACP,CAAC,CAAC,IAAI,KAAK,UAAU;YACrB,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;YAC3B,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAChC,CAAA;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CACvB,CAAC,CAAC,QAAQ,CACN,MAAM,EACN,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,EACxB,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,CACxC,CACJ,CAAA;QACL,CAAC;QAED,UAAU,GAAG,IAAI,CAAA;IACrB,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA5FY,QAAA,gBAAgB,oBA4F5B;AAED,kBAAe,wBAAgB,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "replace removed `stats()` with TODO comment";
3
- export declare const manual = true;
4
- export declare const replaceMongodbStats: (file: FileInfo, api: API) => string | undefined;
5
- export default replaceMongodbStats;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceMongodbStats = exports.manual = exports.description = void 0;
4
- const todo_1 = require("../todo");
5
- exports.description = "replace removed `stats()` with TODO comment";
6
- exports.manual = true;
7
- const replaceMongodbStats = (file, api) => {
8
- const j = api.jscodeshift;
9
- const root = j(file.source);
10
- let hasChanges = false;
11
- let hasTodos = false;
12
- const message = "`stats()` was removed in TypeORM v1. Use the MongoDB driver directly. See migration guide: https://typeorm.io/docs/guides/migration-v1";
13
- // Find .stats() calls
14
- root.find(j.CallExpression, {
15
- callee: {
16
- type: "MemberExpression",
17
- property: { type: "Identifier", name: "stats" },
18
- },
19
- }).forEach((path) => {
20
- // Check if this is a statement expression we can add a comment before
21
- const parent = path.parent;
22
- if (parent.node.type === "ExpressionStatement") {
23
- (0, todo_1.addTodoComment)(parent.node, message, j);
24
- hasChanges = true;
25
- hasTodos = true;
26
- }
27
- else if (parent.node.type === "AwaitExpression") {
28
- const grandparent = path.parent.parent;
29
- if (grandparent.node.type === "ExpressionStatement") {
30
- (0, todo_1.addTodoComment)(grandparent.node, message, j);
31
- hasChanges = true;
32
- hasTodos = true;
33
- }
34
- else {
35
- // Nested in an expression — add comment to the call itself
36
- (0, todo_1.addTodoComment)(path.node, message, j);
37
- hasChanges = true;
38
- hasTodos = true;
39
- }
40
- }
41
- else {
42
- // Nested in an expression — add comment to the call itself
43
- (0, todo_1.addTodoComment)(path.node, message, j);
44
- hasChanges = true;
45
- hasTodos = true;
46
- }
47
- });
48
- if (hasTodos)
49
- (0, todo_1.reportTodo)("replace-mongodb-stats", file, api);
50
- return hasChanges ? root.toSource() : undefined;
51
- };
52
- exports.replaceMongodbStats = replaceMongodbStats;
53
- exports.default = exports.replaceMongodbStats;
54
- //# sourceMappingURL=replace-mongodb-stats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-mongodb-stats.js","sourceRoot":"","sources":["../../../src/transforms/v1/replace-mongodb-stats.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GAAG,6CAA6C,CAAA;AAC3D,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,mBAAmB,GAAG,CA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,OAAO,EAAE,CAAC,CAAC,CAAA;gBACrC,UAAU,GAAG,IAAI,CAAA;gBACjB,QAAQ,GAAG,IAAI,CAAA;YACnB,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,2DAA2D;YAC3D,IAAA,qBAAc,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;YACrC,UAAU,GAAG,IAAI,CAAA;YACjB,QAAQ,GAAG,IAAI,CAAA;QACnB,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,QAAQ;QAAE,IAAA,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;AA7CY,QAAA,mBAAmB,uBA6C/B;AAED,kBAAe,2BAAmB,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "move `ObjectId` import from `typeorm` to `mongodb`";
3
- export declare const replaceMongodbTypes: (file: FileInfo, api: API) => string | undefined;
4
- export default replaceMongodbTypes;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceMongodbTypes = exports.description = void 0;
4
- exports.description = "move `ObjectId` import from `typeorm` to `mongodb`";
5
- const addToExistingImport = (existing, movedSpecifiers) => {
6
- const existingNames = new Set(existing.node.specifiers
7
- ?.filter((s) => s.type === "ImportSpecifier" &&
8
- s.imported.type === "Identifier")
9
- .map((s) => s.imported.name) ?? []);
10
- for (const spec of movedSpecifiers) {
11
- if (!existingNames.has(spec.imported.name)) {
12
- existing.node.specifiers?.push(spec);
13
- }
14
- }
15
- };
16
- const createNewImport = (j, root, importPath, movedSpecifiers) => {
17
- const newImport = j.importDeclaration(movedSpecifiers, j.stringLiteral("mongodb"));
18
- if (importPath.node.importKind === "type") {
19
- newImport.importKind = "type";
20
- }
21
- const allImports = root.find(j.ImportDeclaration);
22
- if (allImports.length > 0) {
23
- j(allImports.at(-1).get()).insertAfter(newImport);
24
- }
25
- else {
26
- root.get().node.program.body.unshift(newImport);
27
- }
28
- };
29
- const replaceMongodbTypes = (file, api) => {
30
- const j = api.jscodeshift;
31
- const root = j(file.source);
32
- let hasChanges = false;
33
- const movedTypes = new Set(["ObjectId"]);
34
- root.find(j.ImportDeclaration, {
35
- source: { value: "typeorm" },
36
- }).forEach((importPath) => {
37
- const movedSpecifiers = [];
38
- const remaining = importPath.node.specifiers?.filter((spec) => {
39
- if (spec.type === "ImportSpecifier" &&
40
- spec.imported.type === "Identifier" &&
41
- movedTypes.has(spec.imported.name)) {
42
- movedSpecifiers.push(spec);
43
- return false;
44
- }
45
- return true;
46
- });
47
- if (movedSpecifiers.length === 0)
48
- return;
49
- hasChanges = true;
50
- // Update or remove the typeorm import
51
- if (remaining?.length === 0) {
52
- j(importPath).remove();
53
- }
54
- else if (remaining) {
55
- importPath.node.specifiers = remaining;
56
- }
57
- // Check if there's already a mongodb import
58
- const existingMongoImport = root.find(j.ImportDeclaration, {
59
- source: { value: "mongodb" },
60
- });
61
- if (existingMongoImport.length > 0) {
62
- addToExistingImport(existingMongoImport.at(0).get(), movedSpecifiers);
63
- }
64
- else {
65
- createNewImport(j, root, importPath, movedSpecifiers);
66
- }
67
- });
68
- return hasChanges ? root.toSource() : undefined;
69
- };
70
- exports.replaceMongodbTypes = replaceMongodbTypes;
71
- exports.default = exports.replaceMongodbTypes;
72
- //# sourceMappingURL=replace-mongodb-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-mongodb-types.js","sourceRoot":"","sources":["../../../src/transforms/v1/replace-mongodb-types.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,oDAAoD,CAAA;AAE/E,MAAM,mBAAmB,GAAG,CAAC,QAAa,EAAE,eAAsB,EAAE,EAAE;IAClE,MAAM,aAAa,GAAG,IAAI,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QAC1C,CAAC;QAED,4CAA4C;QAC5C,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE;YACvD,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;SAC/B,CAAC,CAAA;QAEF,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,mBAAmB,CACf,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAC/B,eAAe,CAClB,CAAA;QACL,CAAC;aAAM,CAAC;YACJ,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,CAAC,CAAA;QACzD,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAlDY,QAAA,mBAAmB,uBAkD/B;AAED,kBAAe,2BAAmB,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "replace removed `domain` option in MSSQL config with TODO";
3
- export declare const manual = true;
4
- export declare const replaceMssqlDomain: (file: FileInfo, api: API) => string | undefined;
5
- export default replaceMssqlDomain;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceMssqlDomain = exports.manual = exports.description = void 0;
4
- const todo_1 = require("../todo");
5
- exports.description = "replace removed `domain` option in MSSQL config with TODO";
6
- exports.manual = true;
7
- const replaceMssqlDomain = (file, api) => {
8
- const j = api.jscodeshift;
9
- const root = j(file.source);
10
- let hasChanges = false;
11
- let hasTodos = false;
12
- root.find(j.ObjectProperty, {
13
- key: { type: "Identifier", name: "domain" },
14
- }).forEach((path) => {
15
- (0, todo_1.addTodoComment)(path.node, '`domain` was removed in TypeORM v1. Restructure to `authentication: { type: "ntlm", options: { domain: "..." } }`. See migration guide: https://typeorm.io/docs/guides/migration-v1', j);
16
- hasChanges = true;
17
- hasTodos = true;
18
- });
19
- if (hasTodos)
20
- (0, todo_1.reportTodo)("replace-mssql-domain", file, api);
21
- return hasChanges ? root.toSource() : undefined;
22
- };
23
- exports.replaceMssqlDomain = replaceMssqlDomain;
24
- exports.default = exports.replaceMssqlDomain;
25
- //# sourceMappingURL=replace-mssql-domain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-mssql-domain.js","sourceRoot":"","sources":["../../../src/transforms/v1/replace-mssql-domain.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,2DAA2D,CAAA;AAClD,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,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE;KAC9C,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,qBAAc,EACV,IAAI,CAAC,IAAI,EACT,qLAAqL,EACrL,CAAC,CACJ,CAAA;QACD,UAAU,GAAG,IAAI,CAAA;QACjB,QAAQ,GAAG,IAAI,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,IAAI,QAAQ;QAAE,IAAA,iBAAU,EAAC,sBAAsB,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAE3D,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AArBY,QAAA,kBAAkB,sBAqB9B;AAED,kBAAe,0BAAkB,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "replace removed `onConflict()` with `orIgnore()` or TODO";
3
- export declare const manual = true;
4
- export declare const replaceOnConflict: (file: FileInfo, api: API) => string | undefined;
5
- export default replaceOnConflict;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceOnConflict = exports.manual = exports.description = void 0;
4
- const ast_helpers_1 = require("../ast-helpers");
5
- const todo_1 = require("../todo");
6
- exports.description = "replace removed `onConflict()` with `orIgnore()` or TODO";
7
- exports.manual = true;
8
- const replaceOnConflict = (file, api) => {
9
- const j = api.jscodeshift;
10
- const root = j(file.source);
11
- let hasChanges = false;
12
- let hasTodos = false;
13
- root.find(j.CallExpression, {
14
- callee: {
15
- type: "MemberExpression",
16
- property: { type: "Identifier", name: "onConflict" },
17
- },
18
- }).forEach((path) => {
19
- const arg = path.node.arguments[0];
20
- const argValue = arg ? (0, ast_helpers_1.getStringValue)(arg) : null;
21
- if (argValue && /DO\s+NOTHING/i.test(argValue)) {
22
- // Replace .onConflict("DO NOTHING") with .orIgnore()
23
- if (path.node.callee.type === "MemberExpression") {
24
- path.node.callee.property = j.identifier("orIgnore");
25
- path.node.arguments = [];
26
- hasChanges = true;
27
- }
28
- }
29
- else {
30
- // Add a TODO comment
31
- const message = "`onConflict()` was removed in TypeORM v1. Use `orIgnore()` or `orUpdate()` instead. See migration guide: https://typeorm.io/docs/guides/migration-v1";
32
- const parent = path.parent;
33
- if (parent.node.type === "ExpressionStatement") {
34
- (0, todo_1.addTodoComment)(parent.node, message, j);
35
- }
36
- else {
37
- (0, todo_1.addTodoComment)(path.node, message, j);
38
- }
39
- hasChanges = true;
40
- hasTodos = true;
41
- }
42
- });
43
- if (hasTodos)
44
- (0, todo_1.reportTodo)("replace-on-conflict", file, api);
45
- return hasChanges ? root.toSource() : undefined;
46
- };
47
- exports.replaceOnConflict = replaceOnConflict;
48
- exports.default = exports.replaceOnConflict;
49
- //# sourceMappingURL=replace-on-conflict.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-on-conflict.js","sourceRoot":"","sources":["../../../src/transforms/v1/replace-on-conflict.ts"],"names":[],"mappings":";;;AACA,gDAA+C;AAC/C,kCAAoD;AAEvC,QAAA,WAAW,GACpB,0DAA0D,CAAA;AACjD,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,iBAAiB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC1D,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,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,MAAM,EAAE;YACJ,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE;SACvD;KACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAClC,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,4BAAc,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAEjD,IAAI,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7C,qDAAqD;YACrD,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;gBAC/C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;gBACpD,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA;gBACxB,UAAU,GAAG,IAAI,CAAA;YACrB,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,qBAAqB;YACrB,MAAM,OAAO,GACT,sJAAsJ,CAAA;YAC1J,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;YAC1B,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,qBAAqB,EAAE,CAAC;gBAC7C,IAAA,qBAAc,EAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;YAC3C,CAAC;iBAAM,CAAC;gBACJ,IAAA,qBAAc,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;YACzC,CAAC;YACD,UAAU,GAAG,IAAI,CAAA;YACjB,QAAQ,GAAG,IAAI,CAAA;QACnB,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,QAAQ;QAAE,IAAA,iBAAU,EAAC,qBAAqB,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAE1D,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAxCY,QAAA,iBAAiB,qBAwC7B;AAED,kBAAe,yBAAiB,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { API, FileInfo } from "jscodeshift";
2
- export declare const description = "replace `readonly` column option with `update`";
3
- export declare const replaceReadonlyColumn: (file: FileInfo, api: API) => string | undefined;
4
- export default replaceReadonlyColumn;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceReadonlyColumn = exports.description = void 0;
4
- exports.description = "replace `readonly` column option with `update`";
5
- const replaceReadonlyColumn = (file, api) => {
6
- const j = api.jscodeshift;
7
- const root = j(file.source);
8
- let hasChanges = false;
9
- root.find(j.ObjectProperty, {
10
- key: { name: "readonly" },
11
- }).forEach((path) => {
12
- if (path.node.key.type === "Identifier") {
13
- // readonly: true → update: false
14
- // readonly: false → update: true
15
- path.node.key.name = "update";
16
- if (path.node.value.type === "BooleanLiteral" ||
17
- (path.node.value.type === "Literal" &&
18
- typeof path.node.value.value === "boolean")) {
19
- path.node.value.value = !path.node.value.value;
20
- }
21
- hasChanges = true;
22
- }
23
- });
24
- return hasChanges ? root.toSource() : undefined;
25
- };
26
- exports.replaceReadonlyColumn = replaceReadonlyColumn;
27
- exports.default = exports.replaceReadonlyColumn;
28
- //# sourceMappingURL=replace-readonly-column.js.map