@typeorm/codemod 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/cli/colors.d.ts +7 -0
- package/dist/cli/colors.js +12 -0
- package/dist/cli/colors.js.map +1 -0
- package/dist/cli/error.d.ts +1 -0
- package/dist/cli/error.js +11 -0
- package/dist/cli/error.js.map +1 -0
- package/dist/cli/list-transforms.d.ts +1 -0
- package/dist/cli/list-transforms.js +27 -0
- package/dist/cli/list-transforms.js.map +1 -0
- package/dist/cli/parse-args.d.ts +10 -0
- package/dist/cli/parse-args.js +52 -0
- package/dist/cli/parse-args.js.map +1 -0
- package/dist/cli/print-guide.d.ts +1 -0
- package/dist/cli/print-guide.js +15 -0
- package/dist/cli/print-guide.js.map +1 -0
- package/dist/cli/print-summary.d.ts +17 -0
- package/dist/cli/print-summary.js +70 -0
- package/dist/cli/print-summary.js.map +1 -0
- package/dist/cli/print-todos.d.ts +1 -0
- package/dist/cli/print-todos.js +13 -0
- package/dist/cli/print-todos.js.map +1 -0
- package/dist/cli/print-usage.d.ts +1 -0
- package/dist/cli/print-usage.js +31 -0
- package/dist/cli/print-usage.js.map +1 -0
- package/dist/cli/run-dependencies.d.ts +6 -0
- package/dist/cli/run-dependencies.js +45 -0
- package/dist/cli/run-dependencies.js.map +1 -0
- package/dist/cli/run-transforms.d.ts +21 -0
- package/dist/cli/run-transforms.js +119 -0
- package/dist/cli/run-transforms.js.map +1 -0
- package/dist/cli/run.d.ts +9 -0
- package/dist/cli/run.js +30 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/dependencies/config.d.ts +24 -0
- package/dist/dependencies/config.js +3 -0
- package/dist/dependencies/config.js.map +1 -0
- package/dist/dependencies/find-package-json.d.ts +5 -0
- package/dist/dependencies/find-package-json.js +34 -0
- package/dist/dependencies/find-package-json.js.map +1 -0
- package/dist/dependencies/index.d.ts +5 -0
- package/dist/dependencies/index.js +14 -0
- package/dist/dependencies/index.js.map +1 -0
- package/dist/dependencies/upgrade.d.ts +11 -0
- package/dist/dependencies/upgrade.js +128 -0
- package/dist/dependencies/upgrade.js.map +1 -0
- package/dist/dependencies/v1.d.ts +2 -0
- package/dist/dependencies/v1.js +32 -0
- package/dist/dependencies/v1.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/colors.d.ts +9 -0
- package/dist/lib/colors.js +14 -0
- package/dist/lib/colors.js.map +1 -0
- package/dist/lib/error.d.ts +1 -0
- package/dist/lib/error.js +11 -0
- package/dist/lib/error.js.map +1 -0
- package/dist/lib/format-time.d.ts +1 -0
- package/dist/lib/format-time.js +12 -0
- package/dist/lib/format-time.js.map +1 -0
- package/dist/lib/highlight.d.ts +1 -0
- package/dist/lib/highlight.js +7 -0
- package/dist/lib/highlight.js.map +1 -0
- package/dist/lib/spinner.d.ts +5 -0
- package/dist/lib/spinner.js +39 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/transforms/ast-helpers.d.ts +50 -0
- package/dist/transforms/ast-helpers.js +153 -0
- package/dist/transforms/ast-helpers.js.map +1 -0
- package/dist/transforms/index.d.ts +7 -0
- package/dist/transforms/index.js +41 -0
- package/dist/transforms/index.js.map +1 -0
- package/dist/transforms/resolve.d.ts +1 -0
- package/dist/transforms/resolve.js +28 -0
- package/dist/transforms/resolve.js.map +1 -0
- package/dist/transforms/scan.d.ts +4 -0
- package/dist/transforms/scan.js +33 -0
- package/dist/transforms/scan.js.map +1 -0
- package/dist/transforms/stats.d.ts +11 -0
- package/dist/transforms/stats.js +42 -0
- package/dist/transforms/stats.js.map +1 -0
- package/dist/transforms/todo.d.ts +2 -0
- package/dist/transforms/todo.js +10 -0
- package/dist/transforms/todo.js.map +1 -0
- package/dist/transforms/transformer.d.ts +8 -0
- package/dist/transforms/transformer.js +19 -0
- package/dist/transforms/transformer.js.map +1 -0
- package/dist/transforms/v1/column-readonly.d.ts +6 -0
- package/dist/transforms/v1/column-readonly.js +37 -0
- package/dist/transforms/v1/column-readonly.js.map +1 -0
- package/dist/transforms/v1/column-unsigned-numeric.d.ts +6 -0
- package/dist/transforms/v1/column-unsigned-numeric.js +65 -0
- package/dist/transforms/v1/column-unsigned-numeric.js.map +1 -0
- package/dist/transforms/v1/column-width-zerofill.d.ts +6 -0
- package/dist/transforms/v1/column-width-zerofill.js +26 -0
- package/dist/transforms/v1/column-width-zerofill.js.map +1 -0
- package/dist/transforms/v1/connection-to-datasource.d.ts +6 -0
- package/dist/transforms/v1/connection-to-datasource.js +205 -0
- package/dist/transforms/v1/connection-to-datasource.js.map +1 -0
- package/dist/transforms/v1/datasource-mongodb.d.ts +7 -0
- package/dist/transforms/v1/datasource-mongodb.js +96 -0
- package/dist/transforms/v1/datasource-mongodb.js.map +1 -0
- package/dist/transforms/v1/datasource-mssql-domain.d.ts +7 -0
- package/dist/transforms/v1/datasource-mssql-domain.js +35 -0
- package/dist/transforms/v1/datasource-mssql-domain.js.map +1 -0
- package/dist/transforms/v1/datasource-mssql.d.ts +7 -0
- package/dist/transforms/v1/datasource-mssql.js +82 -0
- package/dist/transforms/v1/datasource-mssql.js.map +1 -0
- package/dist/transforms/v1/datasource-mysql-connector.d.ts +6 -0
- package/dist/transforms/v1/datasource-mysql-connector.js +25 -0
- package/dist/transforms/v1/datasource-mysql-connector.js.map +1 -0
- package/dist/transforms/v1/datasource-name.d.ts +6 -0
- package/dist/transforms/v1/datasource-name.js +46 -0
- package/dist/transforms/v1/datasource-name.js.map +1 -0
- package/dist/transforms/v1/datasource-sap.d.ts +6 -0
- package/dist/transforms/v1/datasource-sap.js +63 -0
- package/dist/transforms/v1/datasource-sap.js.map +1 -0
- package/dist/transforms/v1/datasource-sqlite-options.d.ts +6 -0
- package/dist/transforms/v1/datasource-sqlite-options.js +35 -0
- package/dist/transforms/v1/datasource-sqlite-options.js.map +1 -0
- package/dist/transforms/v1/datasource-sqlite-type.d.ts +6 -0
- package/dist/transforms/v1/datasource-sqlite-type.js +28 -0
- package/dist/transforms/v1/datasource-sqlite-type.js.map +1 -0
- package/dist/transforms/v1/find-options-lock-modes.d.ts +6 -0
- package/dist/transforms/v1/find-options-lock-modes.js +81 -0
- package/dist/transforms/v1/find-options-lock-modes.js.map +1 -0
- package/dist/transforms/v1/find-options-string-relations.d.ts +6 -0
- package/dist/transforms/v1/find-options-string-relations.js +69 -0
- package/dist/transforms/v1/find-options-string-relations.js.map +1 -0
- package/dist/transforms/v1/find-options-string-select.d.ts +6 -0
- package/dist/transforms/v1/find-options-string-select.js +36 -0
- package/dist/transforms/v1/find-options-string-select.js.map +1 -0
- package/dist/transforms/v1/global-functions.d.ts +7 -0
- package/dist/transforms/v1/global-functions.js +98 -0
- package/dist/transforms/v1/global-functions.js.map +1 -0
- package/dist/transforms/v1/index.d.ts +40 -0
- package/dist/transforms/v1/index.js +109 -0
- package/dist/transforms/v1/index.js.map +1 -0
- package/dist/transforms/v1/migrations-get-all.d.ts +7 -0
- package/dist/transforms/v1/migrations-get-all.js +39 -0
- package/dist/transforms/v1/migrations-get-all.js.map +1 -0
- package/dist/transforms/v1/mongodb-stats.d.ts +7 -0
- package/dist/transforms/v1/mongodb-stats.js +52 -0
- package/dist/transforms/v1/mongodb-stats.js.map +1 -0
- package/dist/transforms/v1/mongodb-types.d.ts +6 -0
- package/dist/transforms/v1/mongodb-types.js +84 -0
- package/dist/transforms/v1/mongodb-types.js.map +1 -0
- package/dist/transforms/v1/query-builder-native-parameters.d.ts +6 -0
- package/dist/transforms/v1/query-builder-native-parameters.js +20 -0
- package/dist/transforms/v1/query-builder-native-parameters.js.map +1 -0
- package/dist/transforms/v1/query-builder-on-conflict.d.ts +7 -0
- package/dist/transforms/v1/query-builder-on-conflict.js +56 -0
- package/dist/transforms/v1/query-builder-on-conflict.js.map +1 -0
- package/dist/transforms/v1/query-builder-or-update.d.ts +6 -0
- package/dist/transforms/v1/query-builder-or-update.js +56 -0
- package/dist/transforms/v1/query-builder-or-update.js.map +1 -0
- package/dist/transforms/v1/query-builder-print-sql.d.ts +7 -0
- package/dist/transforms/v1/query-builder-print-sql.js +49 -0
- package/dist/transforms/v1/query-builder-print-sql.js.map +1 -0
- package/dist/transforms/v1/query-builder-replace-property-names.d.ts +7 -0
- package/dist/transforms/v1/query-builder-replace-property-names.js +42 -0
- package/dist/transforms/v1/query-builder-replace-property-names.js.map +1 -0
- package/dist/transforms/v1/query-builder-where-expression.d.ts +6 -0
- package/dist/transforms/v1/query-builder-where-expression.js +39 -0
- package/dist/transforms/v1/query-builder-where-expression.js.map +1 -0
- package/dist/transforms/v1/query-runner-loaded-tables-views.d.ts +7 -0
- package/dist/transforms/v1/query-runner-loaded-tables-views.js +54 -0
- package/dist/transforms/v1/query-runner-loaded-tables-views.js.map +1 -0
- package/dist/transforms/v1/relation-count.d.ts +7 -0
- package/dist/transforms/v1/relation-count.js +41 -0
- package/dist/transforms/v1/relation-count.js.map +1 -0
- package/dist/transforms/v1/remove-abstract-repository.d.ts +5 -0
- package/dist/transforms/v1/remove-abstract-repository.js +93 -0
- package/dist/transforms/v1/remove-abstract-repository.js.map +1 -0
- package/dist/transforms/v1/remove-connector-package.d.ts +4 -0
- package/dist/transforms/v1/remove-connector-package.js +19 -0
- package/dist/transforms/v1/remove-connector-package.js.map +1 -0
- package/dist/transforms/v1/remove-datasource-name.d.ts +4 -0
- package/dist/transforms/v1/remove-datasource-name.js +56 -0
- package/dist/transforms/v1/remove-datasource-name.js.map +1 -0
- package/dist/transforms/v1/remove-mongodb-options.d.ts +5 -0
- package/dist/transforms/v1/remove-mongodb-options.js +86 -0
- package/dist/transforms/v1/remove-mongodb-options.js.map +1 -0
- package/dist/transforms/v1/remove-relation-count.d.ts +5 -0
- package/dist/transforms/v1/remove-relation-count.js +49 -0
- package/dist/transforms/v1/remove-relation-count.js.map +1 -0
- package/dist/transforms/v1/remove-replace-property-names.d.ts +5 -0
- package/dist/transforms/v1/remove-replace-property-names.js +35 -0
- package/dist/transforms/v1/remove-replace-property-names.js.map +1 -0
- package/dist/transforms/v1/remove-sap-options.d.ts +4 -0
- package/dist/transforms/v1/remove-sap-options.js +54 -0
- package/dist/transforms/v1/remove-sap-options.js.map +1 -0
- package/dist/transforms/v1/remove-unsigned-numeric.d.ts +4 -0
- package/dist/transforms/v1/remove-unsigned-numeric.js +76 -0
- package/dist/transforms/v1/remove-unsigned-numeric.js.map +1 -0
- package/dist/transforms/v1/remove-use-container.d.ts +5 -0
- package/dist/transforms/v1/remove-use-container.js +63 -0
- package/dist/transforms/v1/remove-use-container.js.map +1 -0
- package/dist/transforms/v1/remove-width-zerofill.d.ts +4 -0
- package/dist/transforms/v1/remove-width-zerofill.js +29 -0
- package/dist/transforms/v1/remove-width-zerofill.js.map +1 -0
- package/dist/transforms/v1/rename-connection-to-datasource.d.ts +4 -0
- package/dist/transforms/v1/rename-connection-to-datasource.js +111 -0
- package/dist/transforms/v1/rename-connection-to-datasource.js.map +1 -0
- package/dist/transforms/v1/rename-exist-to-exists.d.ts +4 -0
- package/dist/transforms/v1/rename-exist-to-exists.js +25 -0
- package/dist/transforms/v1/rename-exist-to-exists.js.map +1 -0
- package/dist/transforms/v1/rename-find-by-ids.d.ts +4 -0
- package/dist/transforms/v1/rename-find-by-ids.js +64 -0
- package/dist/transforms/v1/rename-find-by-ids.js.map +1 -0
- package/dist/transforms/v1/rename-get-all-migrations.d.ts +5 -0
- package/dist/transforms/v1/rename-get-all-migrations.js +32 -0
- package/dist/transforms/v1/rename-get-all-migrations.js.map +1 -0
- package/dist/transforms/v1/rename-loaded-tables-views.d.ts +5 -0
- package/dist/transforms/v1/rename-loaded-tables-views.js +48 -0
- package/dist/transforms/v1/rename-loaded-tables-views.js.map +1 -0
- package/dist/transforms/v1/rename-or-update-overload.d.ts +4 -0
- package/dist/transforms/v1/rename-or-update-overload.js +46 -0
- package/dist/transforms/v1/rename-or-update-overload.js.map +1 -0
- package/dist/transforms/v1/rename-print-sql-to-log-query.d.ts +4 -0
- package/dist/transforms/v1/rename-print-sql-to-log-query.js +25 -0
- package/dist/transforms/v1/rename-print-sql-to-log-query.js.map +1 -0
- package/dist/transforms/v1/replace-global-functions.d.ts +5 -0
- package/dist/transforms/v1/replace-global-functions.js +92 -0
- package/dist/transforms/v1/replace-global-functions.js.map +1 -0
- package/dist/transforms/v1/replace-lock-modes.d.ts +4 -0
- package/dist/transforms/v1/replace-lock-modes.js +75 -0
- package/dist/transforms/v1/replace-lock-modes.js.map +1 -0
- package/dist/transforms/v1/replace-mongodb-stats.d.ts +5 -0
- package/dist/transforms/v1/replace-mongodb-stats.js +54 -0
- package/dist/transforms/v1/replace-mongodb-stats.js.map +1 -0
- package/dist/transforms/v1/replace-mongodb-types.d.ts +4 -0
- package/dist/transforms/v1/replace-mongodb-types.js +72 -0
- package/dist/transforms/v1/replace-mongodb-types.js.map +1 -0
- package/dist/transforms/v1/replace-mssql-domain.d.ts +5 -0
- package/dist/transforms/v1/replace-mssql-domain.js +25 -0
- package/dist/transforms/v1/replace-mssql-domain.js.map +1 -0
- package/dist/transforms/v1/replace-on-conflict.d.ts +5 -0
- package/dist/transforms/v1/replace-on-conflict.js +49 -0
- package/dist/transforms/v1/replace-on-conflict.js.map +1 -0
- package/dist/transforms/v1/replace-readonly-column.d.ts +4 -0
- package/dist/transforms/v1/replace-readonly-column.js +28 -0
- package/dist/transforms/v1/replace-readonly-column.js.map +1 -0
- package/dist/transforms/v1/replace-set-native-parameters.d.ts +4 -0
- package/dist/transforms/v1/replace-set-native-parameters.js +25 -0
- package/dist/transforms/v1/replace-set-native-parameters.js.map +1 -0
- package/dist/transforms/v1/replace-sqlite-options.d.ts +4 -0
- package/dist/transforms/v1/replace-sqlite-options.js +29 -0
- package/dist/transforms/v1/replace-sqlite-options.js.map +1 -0
- package/dist/transforms/v1/replace-sqlite-type.d.ts +4 -0
- package/dist/transforms/v1/replace-sqlite-type.js +22 -0
- package/dist/transforms/v1/replace-sqlite-type.js.map +1 -0
- package/dist/transforms/v1/replace-where-expression-type.d.ts +4 -0
- package/dist/transforms/v1/replace-where-expression-type.js +41 -0
- package/dist/transforms/v1/replace-where-expression-type.js.map +1 -0
- package/dist/transforms/v1/repository-abstract.d.ts +7 -0
- package/dist/transforms/v1/repository-abstract.js +83 -0
- package/dist/transforms/v1/repository-abstract.js.map +1 -0
- package/dist/transforms/v1/repository-exist.d.ts +6 -0
- package/dist/transforms/v1/repository-exist.js +20 -0
- package/dist/transforms/v1/repository-exist.js.map +1 -0
- package/dist/transforms/v1/repository-find-by-ids.d.ts +6 -0
- package/dist/transforms/v1/repository-find-by-ids.js +74 -0
- package/dist/transforms/v1/repository-find-by-ids.js.map +1 -0
- package/dist/transforms/v1/repository-find-one-by-id.d.ts +6 -0
- package/dist/transforms/v1/repository-find-one-by-id.js +55 -0
- package/dist/transforms/v1/repository-find-one-by-id.js.map +1 -0
- package/dist/transforms/v1/upgrade-dependencies.d.ts +15 -0
- package/dist/transforms/v1/upgrade-dependencies.js +163 -0
- package/dist/transforms/v1/upgrade-dependencies.js.map +1 -0
- package/dist/transforms/v1/use-container.d.ts +7 -0
- package/dist/transforms/v1/use-container.js +54 -0
- package/dist/transforms/v1/use-container.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const name: string;
|
|
3
|
+
export declare const description = "rename `WhereExpression` to `WhereExpressionBuilder`";
|
|
4
|
+
export declare const queryBuilderWhereExpression: (file: FileInfo, api: API) => string | undefined;
|
|
5
|
+
export declare const fn: (file: FileInfo, api: API) => string | undefined;
|
|
6
|
+
export default fn;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fn = exports.queryBuilderWhereExpression = exports.description = exports.name = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
exports.name = node_path_1.default.basename(__filename, node_path_1.default.extname(__filename));
|
|
9
|
+
exports.description = "rename `WhereExpression` to `WhereExpressionBuilder`";
|
|
10
|
+
const queryBuilderWhereExpression = (file, api) => {
|
|
11
|
+
const j = api.jscodeshift;
|
|
12
|
+
const root = j(file.source);
|
|
13
|
+
let hasChanges = false;
|
|
14
|
+
// Rename in imports
|
|
15
|
+
root.find(j.ImportSpecifier, {
|
|
16
|
+
imported: { name: "WhereExpression" },
|
|
17
|
+
}).forEach((path) => {
|
|
18
|
+
path.node.imported.name = "WhereExpressionBuilder";
|
|
19
|
+
if (path.node.local?.type === "Identifier" &&
|
|
20
|
+
path.node.local?.name === "WhereExpression") {
|
|
21
|
+
path.node.local.name = "WhereExpressionBuilder";
|
|
22
|
+
}
|
|
23
|
+
hasChanges = true;
|
|
24
|
+
});
|
|
25
|
+
// Rename in type references
|
|
26
|
+
root.find(j.TSTypeReference, {
|
|
27
|
+
typeName: { name: "WhereExpression" },
|
|
28
|
+
}).forEach((path) => {
|
|
29
|
+
if (path.node.typeName.type === "Identifier") {
|
|
30
|
+
path.node.typeName.name = "WhereExpressionBuilder";
|
|
31
|
+
hasChanges = true;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return hasChanges ? root.toSource() : undefined;
|
|
35
|
+
};
|
|
36
|
+
exports.queryBuilderWhereExpression = queryBuilderWhereExpression;
|
|
37
|
+
exports.fn = exports.queryBuilderWhereExpression;
|
|
38
|
+
exports.default = exports.fn;
|
|
39
|
+
//# sourceMappingURL=query-builder-where-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-builder-where-expression.js","sourceRoot":"","sources":["../../../src/transforms/v1/query-builder-where-expression.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAGf,QAAA,IAAI,GAAG,mBAAI,CAAC,QAAQ,CAAC,UAAU,EA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AAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA9BY,QAAA,2BAA2B,+BA8BvC;AAEY,QAAA,EAAE,GAAG,mCAA2B,CAAA;AAC7C,kBAAe,UAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const name: string;
|
|
3
|
+
export declare const description = "flag removed `loadedTables` and `loadedViews` for manual migration to `getTables()` / `getViews()`";
|
|
4
|
+
export declare const manual = true;
|
|
5
|
+
export declare const queryRunnerLoadedTablesViews: (file: FileInfo, api: API) => string | undefined;
|
|
6
|
+
export declare const fn: (file: FileInfo, api: API) => string | undefined;
|
|
7
|
+
export default fn;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fn = exports.queryRunnerLoadedTablesViews = exports.manual = exports.description = exports.name = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const todo_1 = require("../todo");
|
|
9
|
+
const stats_1 = require("../stats");
|
|
10
|
+
exports.name = node_path_1.default.basename(__filename, node_path_1.default.extname(__filename));
|
|
11
|
+
exports.description = "flag removed `loadedTables` and `loadedViews` for manual migration to `getTables()` / `getViews()`";
|
|
12
|
+
exports.manual = true;
|
|
13
|
+
const queryRunnerLoadedTablesViews = (file, api) => {
|
|
14
|
+
const j = api.jscodeshift;
|
|
15
|
+
const root = j(file.source);
|
|
16
|
+
let hasChanges = false;
|
|
17
|
+
let hasTodos = false;
|
|
18
|
+
const removedProps = new Set(["loadedTables", "loadedViews"]);
|
|
19
|
+
root.find(j.MemberExpression).forEach((path) => {
|
|
20
|
+
if (path.node.property.type !== "Identifier")
|
|
21
|
+
return;
|
|
22
|
+
if (!removedProps.has(path.node.property.name))
|
|
23
|
+
return;
|
|
24
|
+
const propName = path.node.property.name;
|
|
25
|
+
// Find the containing statement to add a comment
|
|
26
|
+
let current = path;
|
|
27
|
+
while (current.parent && current.parent.node.type !== "Program") {
|
|
28
|
+
if (current.parent.node.type === "ExpressionStatement" ||
|
|
29
|
+
current.parent.node.type === "VariableDeclaration" ||
|
|
30
|
+
current.parent.node.type === "ReturnStatement") {
|
|
31
|
+
const stmt = current.parent.node;
|
|
32
|
+
const message = `\`${propName}\` was removed — use \`getTables()\` / \`getViews()\` instead`;
|
|
33
|
+
// Avoid duplicate comments
|
|
34
|
+
const commentValue = ` TODO(typeorm-v1): ${message}`;
|
|
35
|
+
const comments = (stmt.comments = stmt.comments || []);
|
|
36
|
+
const hasSameComment = comments.some((c) => c.value === commentValue);
|
|
37
|
+
if (!hasSameComment) {
|
|
38
|
+
(0, todo_1.addTodoComment)(stmt, message, j);
|
|
39
|
+
hasTodos = true;
|
|
40
|
+
}
|
|
41
|
+
hasChanges = true;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
current = current.parent;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
if (hasTodos)
|
|
48
|
+
stats_1.stats.count.todo(api, exports.name, file);
|
|
49
|
+
return hasChanges ? root.toSource() : undefined;
|
|
50
|
+
};
|
|
51
|
+
exports.queryRunnerLoadedTablesViews = queryRunnerLoadedTablesViews;
|
|
52
|
+
exports.fn = exports.queryRunnerLoadedTablesViews;
|
|
53
|
+
exports.default = exports.fn;
|
|
54
|
+
//# sourceMappingURL=query-runner-loaded-tables-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-runner-loaded-tables-views.js","sourceRoot":"","sources":["../../../src/transforms/v1/query-runner-loaded-tables-views.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,kCAAwC;AACxC,oC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AAK,iBAAiB,EAChD,CAAC;gBACC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA;gBAChC,MAAM,OAAO,GAAG,KAAK,QAAQ,+DAA+D,CAAA;gBAE5F,2BAA2B;gBAC3B,MAAM,YAAY,GAAG,sBAAsB,OAAO,EAAE,CAAA;gBACpD,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;gBACtD,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAChC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,YAAY,CAClC,CAAA;gBACD,IAAI,CAAC,cAAc,EAAE,CAAC;oBAClB,IAAA,qBAAc,EAAC,IAAI,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,aAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,YAAI,EAAE,IAAI,CAAC,CAAA;IAE/C,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA7CY,QAAA,4BAA4B,gCA6CxC;AAEY,QAAA,EAAE,GAAG,oCAA4B,CAAA;AAC9C,kBAAe,UAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const name: string;
|
|
3
|
+
export declare const description = "flag removed `@RelationCount` decorator for manual migration";
|
|
4
|
+
export declare const manual = true;
|
|
5
|
+
export declare const relationCount: (file: FileInfo, api: API) => string | undefined;
|
|
6
|
+
export declare const fn: (file: FileInfo, api: API) => string | undefined;
|
|
7
|
+
export default fn;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fn = exports.relationCount = exports.manual = exports.description = exports.name = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const ast_helpers_1 = require("../ast-helpers");
|
|
9
|
+
const todo_1 = require("../todo");
|
|
10
|
+
const stats_1 = require("../stats");
|
|
11
|
+
exports.name = node_path_1.default.basename(__filename, node_path_1.default.extname(__filename));
|
|
12
|
+
exports.description = "flag removed `@RelationCount` decorator for manual migration";
|
|
13
|
+
exports.manual = true;
|
|
14
|
+
const relationCount = (file, api) => {
|
|
15
|
+
const j = api.jscodeshift;
|
|
16
|
+
const root = j(file.source);
|
|
17
|
+
let hasChanges = false;
|
|
18
|
+
let hasTodos = false;
|
|
19
|
+
// Find @RelationCount decorators and add TODO
|
|
20
|
+
root.find(j.Decorator, {
|
|
21
|
+
expression: {
|
|
22
|
+
type: "CallExpression",
|
|
23
|
+
callee: { type: "Identifier", name: "RelationCount" },
|
|
24
|
+
},
|
|
25
|
+
}).forEach((path) => {
|
|
26
|
+
(0, todo_1.addTodoComment)(path.node, "`@RelationCount` was removed — use `QueryBuilder` with `loadRelationCountAndMap()` instead", j);
|
|
27
|
+
hasChanges = true;
|
|
28
|
+
hasTodos = true;
|
|
29
|
+
});
|
|
30
|
+
// Remove RelationCount import from typeorm
|
|
31
|
+
if ((0, ast_helpers_1.removeImportSpecifiers)(root, j, "typeorm", new Set(["RelationCount"]))) {
|
|
32
|
+
hasChanges = true;
|
|
33
|
+
}
|
|
34
|
+
if (hasTodos)
|
|
35
|
+
stats_1.stats.count.todo(api, exports.name, file);
|
|
36
|
+
return hasChanges ? root.toSource() : undefined;
|
|
37
|
+
};
|
|
38
|
+
exports.relationCount = relationCount;
|
|
39
|
+
exports.fn = exports.relationCount;
|
|
40
|
+
exports.default = exports.fn;
|
|
41
|
+
//# sourceMappingURL=relation-count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-count.js","sourceRoot":"","sources":["../../../src/transforms/v1/relation-count.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,gDAAuD;AACvD,kCAAwC;AACxC,oCAAgC;AAEnB,QAAA,IAAI,GAAG,mBAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,mBAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;AAC1D,QAAA,WAAW,GACpB,8DAA8D,CAAA;AACrD,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,aAAa,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACtD,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,8CAA8C;IAC9C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE;QACnB,UAAU,EAAE;YACR,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE;SACxD;KACJ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,qBAAc,EACV,IAAI,CAAC,IAAI,EACT,4FAA4F,EAC5F,CAAC,CACJ,CAAA;QACD,UAAU,GAAG,IAAI,CAAA;QACjB,QAAQ,GAAG,IAAI,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,2CAA2C;IAC3C,IACI,IAAA,oCAAsB,EAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EACxE,CAAC;QACC,UAAU,GAAG,IAAI,CAAA;IACrB,CAAC;IAED,IAAI,QAAQ;QAAE,aAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,YAAI,EAAE,IAAI,CAAC,CAAA;IAE/C,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAhCY,QAAA,aAAa,iBAgCzB;AAEY,QAAA,EAAE,GAAG,qBAAa,CAAA;AAC/B,kBAAe,UAAE,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const description = "replace removed `@EntityRepository` and `AbstractRepository` with TODO";
|
|
3
|
+
export declare const manual = true;
|
|
4
|
+
export declare const removeAbstractRepository: (file: FileInfo, api: API) => string | undefined;
|
|
5
|
+
export default removeAbstractRepository;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeAbstractRepository = exports.manual = exports.description = void 0;
|
|
4
|
+
const todo_1 = require("../todo");
|
|
5
|
+
exports.description = "replace removed `@EntityRepository` and `AbstractRepository` with TODO";
|
|
6
|
+
exports.manual = true;
|
|
7
|
+
const removeAbstractRepository = (file, api) => {
|
|
8
|
+
const j = api.jscodeshift;
|
|
9
|
+
const root = j(file.source);
|
|
10
|
+
let hasChanges = false;
|
|
11
|
+
let hasTodos = false;
|
|
12
|
+
// Find @EntityRepository decorators and add TODO
|
|
13
|
+
root.find(j.Decorator, {
|
|
14
|
+
expression: {
|
|
15
|
+
type: "CallExpression",
|
|
16
|
+
callee: { type: "Identifier", name: "EntityRepository" },
|
|
17
|
+
},
|
|
18
|
+
}).forEach((path) => {
|
|
19
|
+
(0, todo_1.addTodoComment)(path.node, "`@EntityRepository` was removed in TypeORM v1. Use a custom service class with `dataSource.getRepository()`. See migration guide: https://typeorm.io/docs/guides/migration-v1", j);
|
|
20
|
+
hasChanges = true;
|
|
21
|
+
hasTodos = true;
|
|
22
|
+
});
|
|
23
|
+
// Find classes extending AbstractRepository and add TODO
|
|
24
|
+
root.find(j.ClassDeclaration).forEach((path) => {
|
|
25
|
+
const superClass = path.node.superClass;
|
|
26
|
+
if (!superClass)
|
|
27
|
+
return;
|
|
28
|
+
let name = null;
|
|
29
|
+
if (superClass.type === "Identifier") {
|
|
30
|
+
name = superClass.name;
|
|
31
|
+
}
|
|
32
|
+
else if (superClass.type === "MemberExpression" &&
|
|
33
|
+
superClass.property.type === "Identifier") {
|
|
34
|
+
name = superClass.property.name;
|
|
35
|
+
}
|
|
36
|
+
if (name !== "AbstractRepository")
|
|
37
|
+
return;
|
|
38
|
+
(0, todo_1.addTodoComment)(path.node, "`AbstractRepository` was removed in TypeORM v1. Use a custom service class with `dataSource.getRepository()`. See migration guide: https://typeorm.io/docs/guides/migration-v1", j);
|
|
39
|
+
hasChanges = true;
|
|
40
|
+
hasTodos = true;
|
|
41
|
+
});
|
|
42
|
+
// Find getCustomRepository() calls and add TODO
|
|
43
|
+
const addGetCustomRepoTodo = (path) => {
|
|
44
|
+
const message = "`getCustomRepository()` was removed in TypeORM v1. Use a custom service class with `dataSource.getRepository()`. See migration guide: https://typeorm.io/docs/guides/migration-v1";
|
|
45
|
+
const parent = path.parent;
|
|
46
|
+
if (parent.node.type === "ExpressionStatement") {
|
|
47
|
+
(0, todo_1.addTodoComment)(parent.node, message, j);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
(0, todo_1.addTodoComment)(path.node, message, j);
|
|
51
|
+
}
|
|
52
|
+
hasChanges = true;
|
|
53
|
+
hasTodos = true;
|
|
54
|
+
};
|
|
55
|
+
root.find(j.CallExpression, {
|
|
56
|
+
callee: {
|
|
57
|
+
type: "MemberExpression",
|
|
58
|
+
property: { type: "Identifier", name: "getCustomRepository" },
|
|
59
|
+
},
|
|
60
|
+
}).forEach(addGetCustomRepoTodo);
|
|
61
|
+
// Also find standalone getCustomRepository() calls
|
|
62
|
+
root.find(j.CallExpression, {
|
|
63
|
+
callee: { type: "Identifier", name: "getCustomRepository" },
|
|
64
|
+
}).forEach(addGetCustomRepoTodo);
|
|
65
|
+
// Remove imports
|
|
66
|
+
const removedImports = new Set(["EntityRepository", "AbstractRepository"]);
|
|
67
|
+
root.find(j.ImportDeclaration, {
|
|
68
|
+
source: { value: "typeorm" },
|
|
69
|
+
}).forEach((importPath) => {
|
|
70
|
+
const remaining = importPath.node.specifiers?.filter((spec) => {
|
|
71
|
+
if (spec.type === "ImportSpecifier" &&
|
|
72
|
+
spec.imported.type === "Identifier") {
|
|
73
|
+
if (removedImports.has(spec.imported.name)) {
|
|
74
|
+
hasChanges = true;
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
});
|
|
80
|
+
if (remaining?.length === 0) {
|
|
81
|
+
j(importPath).remove();
|
|
82
|
+
}
|
|
83
|
+
else if (remaining) {
|
|
84
|
+
importPath.node.specifiers = remaining;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
if (hasTodos)
|
|
88
|
+
(0, todo_1.reportTodo)("remove-abstract-repository", file, api);
|
|
89
|
+
return hasChanges ? root.toSource() : undefined;
|
|
90
|
+
};
|
|
91
|
+
exports.removeAbstractRepository = removeAbstractRepository;
|
|
92
|
+
exports.default = exports.removeAbstractRepository;
|
|
93
|
+
//# sourceMappingURL=remove-abstract-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-abstract-repository.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-abstract-repository.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,wEAAwE,CAAA;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,CAAA;IAE1E,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE;QAC3B,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;KAC/B,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YAC1D,IACI,IAAI,CAAC,IAAI,KAAK,iBAAiB;gBAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,EACrC,CAAC;gBACC,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBACzC,UAAU,GAAG,IAAI,CAAA;oBACjB,OAAO,KAAK,CAAA;gBAChB,CAAC;YACL,CAAC;YACD,OAAO,IAAI,CAAA;QACf,CAAC,CAAC,CAAA;QAEF,IAAI,SAAS,EAAE,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAA;QAC1B,CAAC;aAAM,IAAI,SAAS,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC1C,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;AAvGY,QAAA,wBAAwB,4BAuGpC;AAED,kBAAe,gCAAwB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const description = "remove deprecated `connectorPackage` option from MySQL config";
|
|
3
|
+
export declare const removeConnectorPackage: (file: FileInfo, api: API) => string | undefined;
|
|
4
|
+
export default removeConnectorPackage;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeConnectorPackage = exports.description = void 0;
|
|
4
|
+
exports.description = "remove deprecated `connectorPackage` option from MySQL config";
|
|
5
|
+
const removeConnectorPackage = (file, api) => {
|
|
6
|
+
const j = api.jscodeshift;
|
|
7
|
+
const root = j(file.source);
|
|
8
|
+
let hasChanges = false;
|
|
9
|
+
root.find(j.ObjectProperty, {
|
|
10
|
+
key: { type: "Identifier", name: "connectorPackage" },
|
|
11
|
+
}).forEach((path) => {
|
|
12
|
+
j(path).remove();
|
|
13
|
+
hasChanges = true;
|
|
14
|
+
});
|
|
15
|
+
return hasChanges ? root.toSource() : undefined;
|
|
16
|
+
};
|
|
17
|
+
exports.removeConnectorPackage = removeConnectorPackage;
|
|
18
|
+
exports.default = exports.removeConnectorPackage;
|
|
19
|
+
//# sourceMappingURL=remove-connector-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-connector-package.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-connector-package.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GACpB,+DAA+D,CAAA;AAE5D,MAAM,sBAAsB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE;QACxB,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB,EAAE;KACxD,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAA;QAChB,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;AAbY,QAAA,sBAAsB,0BAalC;AAED,kBAAe,8BAAsB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const description = "remove deprecated `name` property from DataSource options";
|
|
3
|
+
export declare const removeDatasourceName: (file: FileInfo, api: API) => string | undefined;
|
|
4
|
+
export default removeDatasourceName;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeDatasourceName = exports.description = void 0;
|
|
4
|
+
exports.description = "remove deprecated `name` property from DataSource options";
|
|
5
|
+
const removeDatasourceName = (file, api) => {
|
|
6
|
+
const j = api.jscodeshift;
|
|
7
|
+
const root = j(file.source);
|
|
8
|
+
let hasChanges = false;
|
|
9
|
+
// Look for `name` property inside object literals passed to new DataSource()
|
|
10
|
+
// or DataSource options objects
|
|
11
|
+
root.find(j.NewExpression, {
|
|
12
|
+
callee: { type: "Identifier", name: "DataSource" },
|
|
13
|
+
}).forEach((path) => {
|
|
14
|
+
const arg = path.node.arguments[0];
|
|
15
|
+
if (arg?.type !== "ObjectExpression")
|
|
16
|
+
return;
|
|
17
|
+
const filtered = arg.properties.filter((prop) => {
|
|
18
|
+
if (prop.type === "ObjectProperty" &&
|
|
19
|
+
prop.key.type === "Identifier" &&
|
|
20
|
+
prop.key.name === "name") {
|
|
21
|
+
hasChanges = true;
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
});
|
|
26
|
+
if (filtered.length !== arg.properties.length) {
|
|
27
|
+
arg.properties = filtered;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
// Also handle standalone objects with `type` and `name` properties
|
|
31
|
+
// (likely DataSource options assigned to variables)
|
|
32
|
+
root.find(j.ObjectExpression).forEach((path) => {
|
|
33
|
+
const props = path.node.properties;
|
|
34
|
+
const hasType = props.some((p) => p.type === "ObjectProperty" &&
|
|
35
|
+
p.key.type === "Identifier" &&
|
|
36
|
+
p.key.name === "type");
|
|
37
|
+
if (!hasType)
|
|
38
|
+
return;
|
|
39
|
+
const filtered = props.filter((prop) => {
|
|
40
|
+
if (prop.type === "ObjectProperty" &&
|
|
41
|
+
prop.key.type === "Identifier" &&
|
|
42
|
+
prop.key.name === "name") {
|
|
43
|
+
hasChanges = true;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
if (filtered.length !== props.length) {
|
|
49
|
+
path.node.properties = filtered;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return hasChanges ? root.toSource() : undefined;
|
|
53
|
+
};
|
|
54
|
+
exports.removeDatasourceName = removeDatasourceName;
|
|
55
|
+
exports.default = exports.removeDatasourceName;
|
|
56
|
+
//# sourceMappingURL=remove-datasource-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-datasource-name.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-datasource-name.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GACpB,2DAA2D,CAAA;AAExD,MAAM,oBAAoB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC7D,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,6EAA6E;IAC7E,gCAAgC;IAChC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE;QACvB,MAAM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,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,IACI,IAAI,CAAC,IAAI,KAAK,gBAAgB;gBAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;gBAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,EAC1B,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;AA7DY,QAAA,oBAAoB,wBA6DhC;AAED,kBAAe,4BAAoB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const description = "remove and rename deprecated MongoDB connection options";
|
|
3
|
+
export declare const manual = true;
|
|
4
|
+
export declare const removeMongodbOptions: (file: FileInfo, api: API) => string | undefined;
|
|
5
|
+
export default removeMongodbOptions;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeMongodbOptions = exports.manual = exports.description = void 0;
|
|
4
|
+
const todo_1 = require("../todo");
|
|
5
|
+
exports.description = "remove and rename deprecated MongoDB connection options";
|
|
6
|
+
exports.manual = true;
|
|
7
|
+
const removeMongodbOptions = (file, api) => {
|
|
8
|
+
const j = api.jscodeshift;
|
|
9
|
+
const root = j(file.source);
|
|
10
|
+
let hasChanges = false;
|
|
11
|
+
let hasTodos = false;
|
|
12
|
+
const removeProps = new Set([
|
|
13
|
+
"useNewUrlParser",
|
|
14
|
+
"useUnifiedTopology",
|
|
15
|
+
"keepAlive",
|
|
16
|
+
"keepAliveInitialDelay",
|
|
17
|
+
"sslCRL",
|
|
18
|
+
]);
|
|
19
|
+
const simpleRenames = {
|
|
20
|
+
appname: "appName",
|
|
21
|
+
ssl: "tls",
|
|
22
|
+
sslCA: "tlsCAFile",
|
|
23
|
+
sslCert: "tlsCertificateKeyFile",
|
|
24
|
+
sslKey: "tlsCertificateKeyFile",
|
|
25
|
+
sslPass: "tlsCertificateKeyFilePassword",
|
|
26
|
+
};
|
|
27
|
+
const writeConcernProps = new Set([
|
|
28
|
+
"fsync",
|
|
29
|
+
"j",
|
|
30
|
+
"w",
|
|
31
|
+
"wtimeout",
|
|
32
|
+
"wtimeoutMS",
|
|
33
|
+
]);
|
|
34
|
+
// Remove deprecated options
|
|
35
|
+
root.find(j.ObjectProperty).forEach((path) => {
|
|
36
|
+
if (path.node.key.type !== "Identifier" &&
|
|
37
|
+
path.node.key.type !== "StringLiteral") {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const name = path.node.key.type === "Identifier"
|
|
41
|
+
? path.node.key.name
|
|
42
|
+
: path.node.key.value;
|
|
43
|
+
if (removeProps.has(name)) {
|
|
44
|
+
j(path).remove();
|
|
45
|
+
hasChanges = true;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Simple renames
|
|
49
|
+
if (simpleRenames[name]) {
|
|
50
|
+
if (path.node.key.type === "Identifier") {
|
|
51
|
+
path.node.key.name = simpleRenames[name];
|
|
52
|
+
}
|
|
53
|
+
else if (path.node.key.type === "StringLiteral") {
|
|
54
|
+
path.node.key.value = simpleRenames[name];
|
|
55
|
+
}
|
|
56
|
+
hasChanges = true;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// sslValidate → tlsAllowInvalidCertificates (inverted boolean — add TODO)
|
|
60
|
+
if (name === "sslValidate") {
|
|
61
|
+
if (path.node.key.type === "Identifier") {
|
|
62
|
+
path.node.key.name = "tlsAllowInvalidCertificates";
|
|
63
|
+
}
|
|
64
|
+
else if (path.node.key.type === "StringLiteral") {
|
|
65
|
+
path.node.key.value = "tlsAllowInvalidCertificates";
|
|
66
|
+
}
|
|
67
|
+
// Add TODO comment about inverted boolean
|
|
68
|
+
(0, todo_1.addTodoComment)(path.node, "`sslValidate` was renamed to `tlsAllowInvalidCertificates` with inverted boolean logic. Review and invert the value.", j);
|
|
69
|
+
hasChanges = true;
|
|
70
|
+
hasTodos = true;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// writeConcern-related props → add TODO
|
|
74
|
+
if (writeConcernProps.has(name)) {
|
|
75
|
+
(0, todo_1.addTodoComment)(path.node, `\`${name}\` was removed in TypeORM v1. Migrate to \`writeConcern: { ... }\`. See migration guide: https://typeorm.io/docs/guides/migration-v1`, j);
|
|
76
|
+
hasChanges = true;
|
|
77
|
+
hasTodos = true;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
if (hasTodos)
|
|
81
|
+
(0, todo_1.reportTodo)("remove-mongodb-options", file, api);
|
|
82
|
+
return hasChanges ? root.toSource() : undefined;
|
|
83
|
+
};
|
|
84
|
+
exports.removeMongodbOptions = removeMongodbOptions;
|
|
85
|
+
exports.default = exports.removeMongodbOptions;
|
|
86
|
+
//# sourceMappingURL=remove-mongodb-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-mongodb-options.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-mongodb-options.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,yDAAyD,CAAA;AAChD,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,oBAAoB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC7D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI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;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,QAAQ;QAAE,IAAA,iBAAU,EAAC,wBAAwB,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAE7D,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA/FY,QAAA,oBAAoB,wBA+FhC;AAED,kBAAe,4BAAoB,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
+
export declare const description = "replace removed `@RelationCount` decorator with TODO";
|
|
3
|
+
export declare const manual = true;
|
|
4
|
+
export declare const removeRelationCount: (file: FileInfo, api: API) => string | undefined;
|
|
5
|
+
export default removeRelationCount;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeRelationCount = exports.manual = exports.description = void 0;
|
|
4
|
+
const todo_1 = require("../todo");
|
|
5
|
+
exports.description = "replace removed `@RelationCount` decorator with TODO";
|
|
6
|
+
exports.manual = true;
|
|
7
|
+
const removeRelationCount = (file, api) => {
|
|
8
|
+
const j = api.jscodeshift;
|
|
9
|
+
const root = j(file.source);
|
|
10
|
+
let hasChanges = false;
|
|
11
|
+
let hasTodos = false;
|
|
12
|
+
// Find @RelationCount decorators and add TODO
|
|
13
|
+
root.find(j.Decorator, {
|
|
14
|
+
expression: {
|
|
15
|
+
type: "CallExpression",
|
|
16
|
+
callee: { type: "Identifier", name: "RelationCount" },
|
|
17
|
+
},
|
|
18
|
+
}).forEach((path) => {
|
|
19
|
+
(0, todo_1.addTodoComment)(path.node, "`@RelationCount` was removed in TypeORM v1. Use `QueryBuilder` with `loadRelationCountAndMap()` instead. See migration guide: https://typeorm.io/docs/guides/migration-v1", j);
|
|
20
|
+
hasChanges = true;
|
|
21
|
+
hasTodos = true;
|
|
22
|
+
});
|
|
23
|
+
// Remove RelationCount import from typeorm
|
|
24
|
+
root.find(j.ImportDeclaration, {
|
|
25
|
+
source: { value: "typeorm" },
|
|
26
|
+
}).forEach((importPath) => {
|
|
27
|
+
const remaining = importPath.node.specifiers?.filter((spec) => {
|
|
28
|
+
if (spec.type === "ImportSpecifier" &&
|
|
29
|
+
spec.imported.type === "Identifier" &&
|
|
30
|
+
spec.imported.name === "RelationCount") {
|
|
31
|
+
hasChanges = true;
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
});
|
|
36
|
+
if (remaining?.length === 0) {
|
|
37
|
+
j(importPath).remove();
|
|
38
|
+
}
|
|
39
|
+
else if (remaining) {
|
|
40
|
+
importPath.node.specifiers = remaining;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (hasTodos)
|
|
44
|
+
(0, todo_1.reportTodo)("remove-relation-count", file, api);
|
|
45
|
+
return hasChanges ? root.toSource() : undefined;
|
|
46
|
+
};
|
|
47
|
+
exports.removeRelationCount = removeRelationCount;
|
|
48
|
+
exports.default = exports.removeRelationCount;
|
|
49
|
+
//# sourceMappingURL=remove-relation-count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAA;IAEpB,8CAA8C;IAC9C,IAAI,CAAC,IAAI,C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G,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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,mE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