@typeorm/codemod 1.0.0 → 1.0.1
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 +12 -10
- package/dist/cli/print-guide.js +2 -2
- package/dist/cli/print-summary.js +3 -2
- package/dist/cli/print-summary.js.map +1 -1
- package/dist/cli/print-usage.js +1 -1
- package/dist/cli/print-usage.js.map +1 -1
- package/dist/cli/run-transforms.js +16 -2
- package/dist/cli/run-transforms.js.map +1 -1
- package/dist/dependencies/v1.js +22 -9
- package/dist/dependencies/v1.js.map +1 -1
- package/dist/transforms/ast-helpers.js +150 -14
- package/dist/transforms/ast-helpers.js.map +1 -1
- package/dist/transforms/todo.js +25 -2
- package/dist/transforms/todo.js.map +1 -1
- package/dist/transforms/v1/column-readonly.js +28 -13
- package/dist/transforms/v1/column-readonly.js.map +1 -1
- package/dist/transforms/v1/column-unsigned-numeric.js +6 -8
- package/dist/transforms/v1/column-unsigned-numeric.js.map +1 -1
- package/dist/transforms/v1/column-width-zerofill.js +2 -1
- package/dist/transforms/v1/column-width-zerofill.js.map +1 -1
- package/dist/transforms/v1/connection-manager.js +82 -0
- package/dist/transforms/v1/connection-manager.js.map +1 -0
- package/dist/transforms/v1/connection-options-reader.js +198 -0
- package/dist/transforms/v1/connection-options-reader.js.map +1 -0
- package/dist/transforms/v1/connection-to-datasource.js +285 -56
- package/dist/transforms/v1/connection-to-datasource.js.map +1 -1
- package/dist/transforms/v1/datasource-mongodb.js +40 -28
- package/dist/transforms/v1/datasource-mongodb.js.map +1 -1
- package/dist/transforms/v1/datasource-mssql.js +1 -3
- package/dist/transforms/v1/datasource-mssql.js.map +1 -1
- package/dist/transforms/v1/datasource-mysql-connector.js +3 -0
- package/dist/transforms/v1/datasource-mysql-connector.js.map +1 -1
- package/dist/transforms/v1/datasource-name.js +2 -0
- package/dist/transforms/v1/datasource-name.js.map +1 -1
- package/dist/transforms/v1/datasource-sap.js +21 -8
- package/dist/transforms/v1/datasource-sap.js.map +1 -1
- package/dist/transforms/v1/datasource-sqlite-options.js +48 -13
- package/dist/transforms/v1/datasource-sqlite-options.js.map +1 -1
- package/dist/transforms/v1/datasource-sqlite-type.js +28 -7
- package/dist/transforms/v1/datasource-sqlite-type.js.map +1 -1
- package/dist/transforms/v1/file-logger.js +182 -0
- package/dist/transforms/v1/file-logger.js.map +1 -0
- package/dist/transforms/v1/find-options-join.js +84 -0
- package/dist/transforms/v1/find-options-join.js.map +1 -0
- package/dist/transforms/v1/find-options-lock-modes.js +26 -21
- package/dist/transforms/v1/find-options-lock-modes.js.map +1 -1
- package/dist/transforms/v1/find-options-string-relations.js +2 -0
- package/dist/transforms/v1/find-options-string-relations.js.map +1 -1
- package/dist/transforms/v1/find-options-string-select.js +2 -0
- package/dist/transforms/v1/find-options-string-select.js.map +1 -1
- package/dist/transforms/v1/global-functions.js +92 -64
- package/dist/transforms/v1/global-functions.js.map +1 -1
- package/dist/transforms/v1/index.js +10 -2
- package/dist/transforms/v1/index.js.map +1 -1
- package/dist/transforms/v1/migrations-get-all.js +25 -9
- package/dist/transforms/v1/migrations-get-all.js.map +1 -1
- package/dist/transforms/v1/mongodb-stats.js +3 -0
- package/dist/transforms/v1/mongodb-stats.js.map +1 -1
- package/dist/transforms/v1/query-builder-native-parameters.js +2 -0
- package/dist/transforms/v1/query-builder-native-parameters.js.map +1 -1
- package/dist/transforms/v1/query-builder-on-conflict.js +2 -1
- package/dist/transforms/v1/query-builder-on-conflict.js.map +1 -1
- package/dist/transforms/v1/query-builder-or-update.js +8 -4
- package/dist/transforms/v1/query-builder-or-update.js.map +1 -1
- package/dist/transforms/v1/query-builder-print-sql.js +3 -0
- package/dist/transforms/v1/query-builder-print-sql.js.map +1 -1
- package/dist/transforms/v1/query-builder-replace-property-names.js +3 -0
- package/dist/transforms/v1/query-builder-replace-property-names.js.map +1 -1
- package/dist/transforms/v1/query-runner-loaded-tables-views.js +1 -5
- package/dist/transforms/v1/query-runner-loaded-tables-views.js.map +1 -1
- package/dist/transforms/v1/relation-count.js +75 -12
- package/dist/transforms/v1/relation-count.js.map +1 -1
- package/dist/transforms/v1/repository-abstract.js +2 -5
- package/dist/transforms/v1/repository-abstract.js.map +1 -1
- package/dist/transforms/v1/repository-exist.js +2 -0
- package/dist/transforms/v1/repository-exist.js.map +1 -1
- package/dist/transforms/v1/repository-find-by-ids.js +0 -3
- package/dist/transforms/v1/repository-find-by-ids.js.map +1 -1
- package/dist/transforms/v1/repository-find-one-by-id.js +3 -0
- package/dist/transforms/v1/repository-find-one-by-id.js.map +1 -1
- package/dist/transforms/v1/use-container.js +5 -3
- package/dist/transforms/v1/use-container.js.map +1 -1
- package/package.json +3 -1
- package/dist/cli/colors.d.ts +0 -7
- package/dist/cli/colors.js +0 -12
- package/dist/cli/colors.js.map +0 -1
- package/dist/cli/error.d.ts +0 -1
- package/dist/cli/error.js +0 -11
- package/dist/cli/error.js.map +0 -1
- package/dist/cli/list-transforms.d.ts +0 -1
- package/dist/cli/parse-args.d.ts +0 -10
- package/dist/cli/print-guide.d.ts +0 -1
- package/dist/cli/print-summary.d.ts +0 -17
- package/dist/cli/print-todos.d.ts +0 -1
- package/dist/cli/print-usage.d.ts +0 -1
- package/dist/cli/run-dependencies.d.ts +0 -6
- package/dist/cli/run-transforms.d.ts +0 -21
- package/dist/cli/run.d.ts +0 -9
- package/dist/dependencies/config.d.ts +0 -24
- package/dist/dependencies/find-package-json.d.ts +0 -5
- package/dist/dependencies/index.d.ts +0 -5
- package/dist/dependencies/upgrade.d.ts +0 -11
- package/dist/dependencies/v1.d.ts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/lib/colors.d.ts +0 -9
- package/dist/lib/error.d.ts +0 -1
- package/dist/lib/format-time.d.ts +0 -1
- package/dist/lib/highlight.d.ts +0 -1
- package/dist/lib/spinner.d.ts +0 -5
- package/dist/transforms/ast-helpers.d.ts +0 -50
- package/dist/transforms/index.d.ts +0 -7
- package/dist/transforms/resolve.d.ts +0 -1
- package/dist/transforms/scan.d.ts +0 -4
- package/dist/transforms/scan.js +0 -33
- package/dist/transforms/scan.js.map +0 -1
- package/dist/transforms/stats.d.ts +0 -11
- package/dist/transforms/todo.d.ts +0 -2
- package/dist/transforms/transformer.d.ts +0 -8
- package/dist/transforms/v1/column-readonly.d.ts +0 -6
- package/dist/transforms/v1/column-unsigned-numeric.d.ts +0 -6
- package/dist/transforms/v1/column-width-zerofill.d.ts +0 -6
- package/dist/transforms/v1/connection-to-datasource.d.ts +0 -6
- package/dist/transforms/v1/datasource-mongodb.d.ts +0 -7
- package/dist/transforms/v1/datasource-mssql-domain.d.ts +0 -7
- package/dist/transforms/v1/datasource-mssql-domain.js +0 -35
- package/dist/transforms/v1/datasource-mssql-domain.js.map +0 -1
- package/dist/transforms/v1/datasource-mssql.d.ts +0 -7
- package/dist/transforms/v1/datasource-mysql-connector.d.ts +0 -6
- package/dist/transforms/v1/datasource-name.d.ts +0 -6
- package/dist/transforms/v1/datasource-sap.d.ts +0 -6
- package/dist/transforms/v1/datasource-sqlite-options.d.ts +0 -6
- package/dist/transforms/v1/datasource-sqlite-type.d.ts +0 -6
- package/dist/transforms/v1/find-options-lock-modes.d.ts +0 -6
- package/dist/transforms/v1/find-options-string-relations.d.ts +0 -6
- package/dist/transforms/v1/find-options-string-select.d.ts +0 -6
- package/dist/transforms/v1/global-functions.d.ts +0 -7
- package/dist/transforms/v1/index.d.ts +0 -40
- package/dist/transforms/v1/migrations-get-all.d.ts +0 -7
- package/dist/transforms/v1/mongodb-stats.d.ts +0 -7
- package/dist/transforms/v1/mongodb-types.d.ts +0 -6
- package/dist/transforms/v1/query-builder-native-parameters.d.ts +0 -6
- package/dist/transforms/v1/query-builder-on-conflict.d.ts +0 -7
- package/dist/transforms/v1/query-builder-or-update.d.ts +0 -6
- package/dist/transforms/v1/query-builder-print-sql.d.ts +0 -7
- package/dist/transforms/v1/query-builder-replace-property-names.d.ts +0 -7
- package/dist/transforms/v1/query-builder-where-expression.d.ts +0 -6
- package/dist/transforms/v1/query-runner-loaded-tables-views.d.ts +0 -7
- package/dist/transforms/v1/relation-count.d.ts +0 -7
- package/dist/transforms/v1/remove-abstract-repository.d.ts +0 -5
- package/dist/transforms/v1/remove-abstract-repository.js +0 -93
- package/dist/transforms/v1/remove-abstract-repository.js.map +0 -1
- package/dist/transforms/v1/remove-connector-package.d.ts +0 -4
- package/dist/transforms/v1/remove-connector-package.js +0 -19
- package/dist/transforms/v1/remove-connector-package.js.map +0 -1
- package/dist/transforms/v1/remove-datasource-name.d.ts +0 -4
- package/dist/transforms/v1/remove-datasource-name.js +0 -56
- package/dist/transforms/v1/remove-datasource-name.js.map +0 -1
- package/dist/transforms/v1/remove-mongodb-options.d.ts +0 -5
- package/dist/transforms/v1/remove-mongodb-options.js +0 -86
- package/dist/transforms/v1/remove-mongodb-options.js.map +0 -1
- package/dist/transforms/v1/remove-relation-count.d.ts +0 -5
- package/dist/transforms/v1/remove-relation-count.js +0 -49
- package/dist/transforms/v1/remove-relation-count.js.map +0 -1
- package/dist/transforms/v1/remove-replace-property-names.d.ts +0 -5
- package/dist/transforms/v1/remove-replace-property-names.js +0 -35
- package/dist/transforms/v1/remove-replace-property-names.js.map +0 -1
- package/dist/transforms/v1/remove-sap-options.d.ts +0 -4
- package/dist/transforms/v1/remove-sap-options.js +0 -54
- package/dist/transforms/v1/remove-sap-options.js.map +0 -1
- package/dist/transforms/v1/remove-unsigned-numeric.d.ts +0 -4
- package/dist/transforms/v1/remove-unsigned-numeric.js +0 -76
- package/dist/transforms/v1/remove-unsigned-numeric.js.map +0 -1
- package/dist/transforms/v1/remove-use-container.d.ts +0 -5
- package/dist/transforms/v1/remove-use-container.js +0 -63
- package/dist/transforms/v1/remove-use-container.js.map +0 -1
- package/dist/transforms/v1/remove-width-zerofill.d.ts +0 -4
- package/dist/transforms/v1/remove-width-zerofill.js +0 -29
- package/dist/transforms/v1/remove-width-zerofill.js.map +0 -1
- package/dist/transforms/v1/rename-connection-to-datasource.d.ts +0 -4
- package/dist/transforms/v1/rename-connection-to-datasource.js +0 -111
- package/dist/transforms/v1/rename-connection-to-datasource.js.map +0 -1
- package/dist/transforms/v1/rename-exist-to-exists.d.ts +0 -4
- package/dist/transforms/v1/rename-exist-to-exists.js +0 -25
- package/dist/transforms/v1/rename-exist-to-exists.js.map +0 -1
- package/dist/transforms/v1/rename-find-by-ids.d.ts +0 -4
- package/dist/transforms/v1/rename-find-by-ids.js +0 -64
- package/dist/transforms/v1/rename-find-by-ids.js.map +0 -1
- package/dist/transforms/v1/rename-get-all-migrations.d.ts +0 -5
- package/dist/transforms/v1/rename-get-all-migrations.js +0 -32
- package/dist/transforms/v1/rename-get-all-migrations.js.map +0 -1
- package/dist/transforms/v1/rename-loaded-tables-views.d.ts +0 -5
- package/dist/transforms/v1/rename-loaded-tables-views.js +0 -48
- package/dist/transforms/v1/rename-loaded-tables-views.js.map +0 -1
- package/dist/transforms/v1/rename-or-update-overload.d.ts +0 -4
- package/dist/transforms/v1/rename-or-update-overload.js +0 -46
- package/dist/transforms/v1/rename-or-update-overload.js.map +0 -1
- package/dist/transforms/v1/rename-print-sql-to-log-query.d.ts +0 -4
- package/dist/transforms/v1/rename-print-sql-to-log-query.js +0 -25
- package/dist/transforms/v1/rename-print-sql-to-log-query.js.map +0 -1
- package/dist/transforms/v1/replace-global-functions.d.ts +0 -5
- package/dist/transforms/v1/replace-global-functions.js +0 -92
- package/dist/transforms/v1/replace-global-functions.js.map +0 -1
- package/dist/transforms/v1/replace-lock-modes.d.ts +0 -4
- package/dist/transforms/v1/replace-lock-modes.js +0 -75
- package/dist/transforms/v1/replace-lock-modes.js.map +0 -1
- package/dist/transforms/v1/replace-mongodb-stats.d.ts +0 -5
- package/dist/transforms/v1/replace-mongodb-stats.js +0 -54
- package/dist/transforms/v1/replace-mongodb-stats.js.map +0 -1
- package/dist/transforms/v1/replace-mongodb-types.d.ts +0 -4
- package/dist/transforms/v1/replace-mongodb-types.js +0 -72
- package/dist/transforms/v1/replace-mongodb-types.js.map +0 -1
- package/dist/transforms/v1/replace-mssql-domain.d.ts +0 -5
- package/dist/transforms/v1/replace-mssql-domain.js +0 -25
- package/dist/transforms/v1/replace-mssql-domain.js.map +0 -1
- package/dist/transforms/v1/replace-on-conflict.d.ts +0 -5
- package/dist/transforms/v1/replace-on-conflict.js +0 -49
- package/dist/transforms/v1/replace-on-conflict.js.map +0 -1
- package/dist/transforms/v1/replace-readonly-column.d.ts +0 -4
- package/dist/transforms/v1/replace-readonly-column.js +0 -28
- package/dist/transforms/v1/replace-readonly-column.js.map +0 -1
- package/dist/transforms/v1/replace-set-native-parameters.d.ts +0 -4
- package/dist/transforms/v1/replace-set-native-parameters.js +0 -25
- package/dist/transforms/v1/replace-set-native-parameters.js.map +0 -1
- package/dist/transforms/v1/replace-sqlite-options.d.ts +0 -4
- package/dist/transforms/v1/replace-sqlite-options.js +0 -29
- package/dist/transforms/v1/replace-sqlite-options.js.map +0 -1
- package/dist/transforms/v1/replace-sqlite-type.d.ts +0 -4
- package/dist/transforms/v1/replace-sqlite-type.js +0 -22
- package/dist/transforms/v1/replace-sqlite-type.js.map +0 -1
- package/dist/transforms/v1/replace-where-expression-type.d.ts +0 -4
- package/dist/transforms/v1/replace-where-expression-type.js +0 -41
- package/dist/transforms/v1/replace-where-expression-type.js.map +0 -1
- package/dist/transforms/v1/repository-abstract.d.ts +0 -7
- package/dist/transforms/v1/repository-exist.d.ts +0 -6
- package/dist/transforms/v1/repository-find-by-ids.d.ts +0 -6
- package/dist/transforms/v1/repository-find-one-by-id.d.ts +0 -6
- package/dist/transforms/v1/upgrade-dependencies.d.ts +0 -15
- package/dist/transforms/v1/upgrade-dependencies.js +0 -163
- package/dist/transforms/v1/upgrade-dependencies.js.map +0 -1
- package/dist/transforms/v1/use-container.d.ts +0 -7
|
@@ -1,86 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-mongodb-options.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-mongodb-options.ts"],"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CAAwC;QACxC,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,IAAA,qBAAc,EACV,IAAI,CAAC,IAAI,EACT,KAAK,IAAI,sIAAsI,EAC/I,CAAC,CACJ,CAAA;YACD,UAAU,GAAG,IAAI,CAAA;YACjB,QAAQ,GAAG,IAAI,CAAA;QACnB,CAAC;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"}
|
|
@@ -1,5 +0,0 @@
|
|
|
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;
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-relation-count.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-relation-count.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,sDAAsD,CAAA;AAC7C,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAA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C,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,uBAAuB,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAE5D,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAhDY,QAAA,mBAAmB,uBAgD/B;AAED,kBAAe,2BAAmB,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
-
export declare const description = "flag removed `replacePropertyNames` override with TODO";
|
|
3
|
-
export declare const manual = true;
|
|
4
|
-
export declare const removeReplacePropertyNames: (file: FileInfo, api: API) => string | undefined;
|
|
5
|
-
export default removeReplacePropertyNames;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeReplacePropertyNames = exports.manual = exports.description = void 0;
|
|
4
|
-
const todo_1 = require("../todo");
|
|
5
|
-
exports.description = "flag removed `replacePropertyNames` override with TODO";
|
|
6
|
-
exports.manual = true;
|
|
7
|
-
const removeReplacePropertyNames = (file, api) => {
|
|
8
|
-
const j = api.jscodeshift;
|
|
9
|
-
const root = j(file.source);
|
|
10
|
-
let hasChanges = false;
|
|
11
|
-
let hasTodos = false;
|
|
12
|
-
// Find method declarations named replacePropertyNames in classes
|
|
13
|
-
const message = "`replacePropertyNames` was removed in TypeORM v1. This method override is no longer called. See migration guide: https://typeorm.io/docs/guides/migration-v1";
|
|
14
|
-
root.find(j.ClassMethod, {
|
|
15
|
-
key: { type: "Identifier", name: "replacePropertyNames" },
|
|
16
|
-
}).forEach((path) => {
|
|
17
|
-
(0, todo_1.addTodoComment)(path.node, message, j);
|
|
18
|
-
hasChanges = true;
|
|
19
|
-
hasTodos = true;
|
|
20
|
-
});
|
|
21
|
-
// Also check for MethodDefinition (alternative AST representation)
|
|
22
|
-
root.find(j.MethodDefinition, {
|
|
23
|
-
key: { type: "Identifier", name: "replacePropertyNames" },
|
|
24
|
-
}).forEach((path) => {
|
|
25
|
-
(0, todo_1.addTodoComment)(path.node, message, j);
|
|
26
|
-
hasChanges = true;
|
|
27
|
-
hasTodos = true;
|
|
28
|
-
});
|
|
29
|
-
if (hasTodos)
|
|
30
|
-
(0, todo_1.reportTodo)("remove-replace-property-names", file, api);
|
|
31
|
-
return hasChanges ? root.toSource() : undefined;
|
|
32
|
-
};
|
|
33
|
-
exports.removeReplacePropertyNames = removeReplacePropertyNames;
|
|
34
|
-
exports.default = exports.removeReplacePropertyNames;
|
|
35
|
-
//# sourceMappingURL=remove-replace-property-names.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-replace-property-names.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-replace-property-names.ts"],"names":[],"mappings":";;;AACA,kCAAoD;AAEvC,QAAA,WAAW,GACpB,wDAAwD,CAAA;AAC/C,QAAA,MAAM,GAAG,IAAI,CAAA;AAEnB,MAAM,0BAA0B,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACnE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IACtB,IAAI,QAAQ,GAAG,KAAK,CAAA;IAEpB,iEAAiE;IACjE,MAAM,OAAO,GACT,8JAA8J,CAAA;IAElK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE;QACrB,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,sBAAsB,EAAE;KAC5D,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,qBAAc,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;QACrC,UAAU,GAAG,IAAI,CAAA;QACjB,QAAQ,GAAG,IAAI,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,mEAAmE;IACnE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE;QAC1B,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,sBAAsB,EAAE;KAC5D,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,qBAAc,EAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;QACrC,UAAU,GAAG,IAAI,CAAA;QACjB,QAAQ,GAAG,IAAI,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,IAAI,QAAQ;QAAE,IAAA,iBAAU,EAAC,+BAA+B,EAAE,IAAI,EAAE,GAAG,CAAC,CAAA;IAEpE,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA9BY,QAAA,0BAA0B,8BA8BtC;AAED,kBAAe,kCAA0B,CAAA"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeSapOptions = exports.description = void 0;
|
|
4
|
-
exports.description = "rename and remove deprecated SAP HANA connection options";
|
|
5
|
-
const removeSapOptions = (file, api) => {
|
|
6
|
-
const j = api.jscodeshift;
|
|
7
|
-
const root = j(file.source);
|
|
8
|
-
let hasChanges = false;
|
|
9
|
-
const topLevelRenames = {
|
|
10
|
-
hanaClientDriver: "driver",
|
|
11
|
-
};
|
|
12
|
-
const poolRenames = {
|
|
13
|
-
max: "maxConnectedOrPooled",
|
|
14
|
-
requestTimeout: "maxWaitTimeoutIfPoolExhausted",
|
|
15
|
-
idleTimeout: "maxPooledIdleTime",
|
|
16
|
-
};
|
|
17
|
-
const poolRemoves = new Set(["min", "maxWaitingRequests", "checkInterval"]);
|
|
18
|
-
// Rename top-level options
|
|
19
|
-
root.find(j.ObjectProperty).forEach((path) => {
|
|
20
|
-
if (path.node.key.type !== "Identifier")
|
|
21
|
-
return;
|
|
22
|
-
const name = path.node.key.name;
|
|
23
|
-
// Top-level renames
|
|
24
|
-
if (topLevelRenames[name]) {
|
|
25
|
-
path.node.key.name = topLevelRenames[name];
|
|
26
|
-
hasChanges = true;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Pool property handling — check if inside a pool object
|
|
30
|
-
if (poolRenames[name] || poolRemoves.has(name)) {
|
|
31
|
-
const parent = path.parent;
|
|
32
|
-
if (parent.node.type !== "ObjectExpression")
|
|
33
|
-
return;
|
|
34
|
-
const grandparent = parent.parent;
|
|
35
|
-
if (grandparent.node.type !== "ObjectProperty" ||
|
|
36
|
-
grandparent.node.key.type !== "Identifier" ||
|
|
37
|
-
grandparent.node.key.name !== "pool") {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (poolRemoves.has(name)) {
|
|
41
|
-
j(path).remove();
|
|
42
|
-
hasChanges = true;
|
|
43
|
-
}
|
|
44
|
-
else if (poolRenames[name]) {
|
|
45
|
-
path.node.key.name = poolRenames[name];
|
|
46
|
-
hasChanges = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return hasChanges ? root.toSource() : undefined;
|
|
51
|
-
};
|
|
52
|
-
exports.removeSapOptions = removeSapOptions;
|
|
53
|
-
exports.default = exports.removeSapOptions;
|
|
54
|
-
//# sourceMappingURL=remove-sap-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-sap-options.js","sourceRoot":"","sources":["../../../src/transforms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AAI,KAAK,kBAAkB;gBAAE,OAAM;YAEnD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAA;YACjC,IACI,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB;gBAC1C,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;gBAC1C,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,EACtC,CAAC;gBACC,OAAM;YACV,CAAC;YAED,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAA;gBAChB,UAAU,GAAG,IAAI,CAAA;YACrB,CAAC;iBAAM,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAA;gBACtC,UAAU,GAAG,IAAI,CAAA;YACrB,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAvDY,QAAA,gBAAgB,oBAuD5B;AAED,kBAAe,wBAAgB,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
-
export declare const description = "remove deprecated `unsigned` from decimal/float column options";
|
|
3
|
-
export declare const removeUnsignedNumeric: (file: FileInfo, api: API) => string | undefined;
|
|
4
|
-
export default removeUnsignedNumeric;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeUnsignedNumeric = exports.description = void 0;
|
|
4
|
-
const ast_helpers_1 = require("../ast-helpers");
|
|
5
|
-
exports.description = "remove deprecated `unsigned` from decimal/float column options";
|
|
6
|
-
const numericTypes = new Set(["decimal", "float", "double", "numeric"]);
|
|
7
|
-
const removeUnsignedNumeric = (file, api) => {
|
|
8
|
-
const j = api.jscodeshift;
|
|
9
|
-
const root = j(file.source);
|
|
10
|
-
let hasChanges = false;
|
|
11
|
-
// Find @Column("decimal", { unsigned: true }) style calls
|
|
12
|
-
root.find(j.CallExpression, {
|
|
13
|
-
callee: { type: "Identifier", name: "Column" },
|
|
14
|
-
}).forEach((path) => {
|
|
15
|
-
const args = path.node.arguments;
|
|
16
|
-
if (args.length < 2)
|
|
17
|
-
return;
|
|
18
|
-
// First arg must be a string literal with a numeric type
|
|
19
|
-
const firstArg = args[0];
|
|
20
|
-
const typeName = (0, ast_helpers_1.getStringValue)(firstArg);
|
|
21
|
-
if (!typeName || !numericTypes.has(typeName))
|
|
22
|
-
return;
|
|
23
|
-
// Second arg should be an object with unsigned property
|
|
24
|
-
const secondArg = args[1];
|
|
25
|
-
if (secondArg.type !== "ObjectExpression")
|
|
26
|
-
return;
|
|
27
|
-
const filtered = secondArg.properties.filter((prop) => {
|
|
28
|
-
if (prop.type === "ObjectProperty" &&
|
|
29
|
-
prop.key.type === "Identifier" &&
|
|
30
|
-
prop.key.name === "unsigned") {
|
|
31
|
-
hasChanges = true;
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return true;
|
|
35
|
-
});
|
|
36
|
-
if (filtered.length !== secondArg.properties.length) {
|
|
37
|
-
secondArg.properties = filtered;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
// Also find decorator calls via @Column({ type: "decimal", unsigned: true })
|
|
41
|
-
root.find(j.CallExpression, {
|
|
42
|
-
callee: { type: "Identifier", name: "Column" },
|
|
43
|
-
}).forEach((path) => {
|
|
44
|
-
const args = path.node.arguments;
|
|
45
|
-
if (args.length !== 1)
|
|
46
|
-
return;
|
|
47
|
-
const arg = args[0];
|
|
48
|
-
if (arg.type !== "ObjectExpression")
|
|
49
|
-
return;
|
|
50
|
-
// Check if type is a numeric type
|
|
51
|
-
const typeProp = arg.properties.find((p) => p.type === "ObjectProperty" &&
|
|
52
|
-
p.key.type === "Identifier" &&
|
|
53
|
-
p.key.name === "type");
|
|
54
|
-
if (typeProp?.type !== "ObjectProperty")
|
|
55
|
-
return;
|
|
56
|
-
const typeValue = (0, ast_helpers_1.getStringValue)(typeProp.value);
|
|
57
|
-
if (!typeValue || !numericTypes.has(typeValue))
|
|
58
|
-
return;
|
|
59
|
-
const filtered = arg.properties.filter((prop) => {
|
|
60
|
-
if (prop.type === "ObjectProperty" &&
|
|
61
|
-
prop.key.type === "Identifier" &&
|
|
62
|
-
prop.key.name === "unsigned") {
|
|
63
|
-
hasChanges = true;
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
});
|
|
68
|
-
if (filtered.length !== arg.properties.length) {
|
|
69
|
-
arg.properties = filtered;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
return hasChanges ? root.toSource() : undefined;
|
|
73
|
-
};
|
|
74
|
-
exports.removeUnsignedNumeric = removeUnsignedNumeric;
|
|
75
|
-
exports.default = exports.removeUnsignedNumeric;
|
|
76
|
-
//# sourceMappingURL=remove-unsigned-numeric.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-unsigned-numeric.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-unsigned-numeric.ts"],"names":[],"mappings":";;;AACA,gDAA+C;AAElC,QAAA,WAAW,GACpB,gEAAgE,CAAA;AAEpE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;AAEhE,MAAM,qBAAqB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC9D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC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,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC5C,GAAG,CAAC,UAAU,GAAG,QAAQ,CAAA;QAC7B,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAjFY,QAAA,qBAAqB,yBAiFjC;AAED,kBAAe,6BAAqB,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
-
export declare const description = "remove `useContainer()` and `getFromContainer()` calls";
|
|
3
|
-
export declare const manual = true;
|
|
4
|
-
export declare const removeUseContainer: (file: FileInfo, api: API) => string | undefined;
|
|
5
|
-
export default removeUseContainer;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeUseContainer = exports.manual = exports.description = void 0;
|
|
4
|
-
const todo_1 = require("../todo");
|
|
5
|
-
exports.description = "remove `useContainer()` and `getFromContainer()` calls";
|
|
6
|
-
exports.manual = true;
|
|
7
|
-
const removeUseContainer = (file, api) => {
|
|
8
|
-
const j = api.jscodeshift;
|
|
9
|
-
const root = j(file.source);
|
|
10
|
-
let hasChanges = false;
|
|
11
|
-
let hasTodos = false;
|
|
12
|
-
const removedFunctions = new Set(["useContainer", "getFromContainer"]);
|
|
13
|
-
// Replace calls with a TODO comment
|
|
14
|
-
for (const funcName of removedFunctions) {
|
|
15
|
-
root.find(j.ExpressionStatement, {
|
|
16
|
-
expression: {
|
|
17
|
-
type: "CallExpression",
|
|
18
|
-
callee: { type: "Identifier", name: funcName },
|
|
19
|
-
},
|
|
20
|
-
}).forEach((path) => {
|
|
21
|
-
// Replace with a comment
|
|
22
|
-
const replacement = j.expressionStatement(j.identifier("undefined"));
|
|
23
|
-
(0, todo_1.addTodoComment)(replacement, `${funcName}() was removed in TypeORM v1. See migration guide: https://typeorm.io/docs/guides/migration-v1#container-system`, j);
|
|
24
|
-
j(path).replaceWith(replacement);
|
|
25
|
-
hasChanges = true;
|
|
26
|
-
hasTodos = true;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
// Remove imports
|
|
30
|
-
const removedImports = new Set([
|
|
31
|
-
"useContainer",
|
|
32
|
-
"getFromContainer",
|
|
33
|
-
"ContainerInterface",
|
|
34
|
-
"ContainedType",
|
|
35
|
-
"UseContainerOptions",
|
|
36
|
-
]);
|
|
37
|
-
root.find(j.ImportDeclaration, {
|
|
38
|
-
source: { value: "typeorm" },
|
|
39
|
-
}).forEach((importPath) => {
|
|
40
|
-
const remaining = importPath.node.specifiers?.filter((spec) => {
|
|
41
|
-
if (spec.type === "ImportSpecifier" &&
|
|
42
|
-
spec.imported.type === "Identifier") {
|
|
43
|
-
if (removedImports.has(spec.imported.name)) {
|
|
44
|
-
hasChanges = true;
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return true;
|
|
49
|
-
});
|
|
50
|
-
if (remaining?.length === 0) {
|
|
51
|
-
j(importPath).remove();
|
|
52
|
-
}
|
|
53
|
-
else if (remaining) {
|
|
54
|
-
importPath.node.specifiers = remaining;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
if (hasTodos)
|
|
58
|
-
(0, todo_1.reportTodo)("remove-use-container", file, api);
|
|
59
|
-
return hasChanges ? root.toSource() : undefined;
|
|
60
|
-
};
|
|
61
|
-
exports.removeUseContainer = removeUseContainer;
|
|
62
|
-
exports.default = exports.removeUseContainer;
|
|
63
|
-
//# sourceMappingURL=remove-use-container.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-use-container.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-use-container.ts"],"names":[],"mappings":";;;AACA,kCA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,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,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;AAhEY,QAAA,kBAAkB,sBAgE9B;AAED,kBAAe,0BAAkB,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
-
export declare const description = "remove `width` and `zerofill` from `@Column` options";
|
|
3
|
-
export declare const removeWidthZerofill: (file: FileInfo, api: API) => string | undefined;
|
|
4
|
-
export default removeWidthZerofill;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeWidthZerofill = exports.description = void 0;
|
|
4
|
-
exports.description = "remove `width` and `zerofill` from `@Column` options";
|
|
5
|
-
const removeWidthZerofill = (file, api) => {
|
|
6
|
-
const j = api.jscodeshift;
|
|
7
|
-
const root = j(file.source);
|
|
8
|
-
let hasChanges = false;
|
|
9
|
-
const propsToRemove = new Set(["width", "zerofill"]);
|
|
10
|
-
root.find(j.ObjectExpression).forEach((path) => {
|
|
11
|
-
const props = path.node.properties;
|
|
12
|
-
const filtered = props.filter((prop) => {
|
|
13
|
-
if ((prop.type === "Property" || prop.type === "ObjectProperty") &&
|
|
14
|
-
prop.key.type === "Identifier" &&
|
|
15
|
-
propsToRemove.has(prop.key.name)) {
|
|
16
|
-
hasChanges = true;
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
return true;
|
|
20
|
-
});
|
|
21
|
-
if (filtered.length !== props.length) {
|
|
22
|
-
path.node.properties = filtered;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return hasChanges ? root.toSource() : undefined;
|
|
26
|
-
};
|
|
27
|
-
exports.removeWidthZerofill = removeWidthZerofill;
|
|
28
|
-
exports.default = exports.removeWidthZerofill;
|
|
29
|
-
//# sourceMappingURL=remove-width-zerofill.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-width-zerofill.js","sourceRoot":"","sources":["../../../src/transforms/v1/remove-width-zerofill.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GACpB,sDAAsD,CAAA;AAEnD,MAAM,mBAAmB,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IAC5D,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,IAAI,UAAU,GAAG,KAAK,CAAA;IAEtB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAA;IAEpD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAA;QAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,IACI,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC;gBAC5D,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,YAAY;gBAC9B,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAClC,CAAC;gBACC,UAAU,GAAG,IAAI,CAAA;gBACjB,OAAO,KAAK,CAAA;YAChB,CAAC;YACD,OAAO,IAAI,CAAA;QACf,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAA;QACnC,CAAC;IACL,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AA3BY,QAAA,mBAAmB,uBA2B/B;AAED,kBAAe,2BAAmB,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { API, FileInfo } from "jscodeshift";
|
|
2
|
-
export declare const description = "migrate from `Connection` to `DataSource`";
|
|
3
|
-
export declare const renameConnectionToDataSource: (file: FileInfo, api: API) => string | undefined;
|
|
4
|
-
export default renameConnectionToDataSource;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renameConnectionToDataSource = exports.description = void 0;
|
|
4
|
-
exports.description = "migrate from `Connection` to `DataSource`";
|
|
5
|
-
const renameConnectionToDataSource = (file, api) => {
|
|
6
|
-
const j = api.jscodeshift;
|
|
7
|
-
const root = j(file.source);
|
|
8
|
-
let hasChanges = false;
|
|
9
|
-
// Type/class renames
|
|
10
|
-
const typeRenames = {
|
|
11
|
-
Connection: "DataSource",
|
|
12
|
-
ConnectionOptions: "DataSourceOptions",
|
|
13
|
-
BaseConnectionOptions: "BaseDataSourceOptions",
|
|
14
|
-
MysqlConnectionOptions: "MysqlDataSourceOptions",
|
|
15
|
-
MariaDbConnectionOptions: "MariaDbDataSourceOptions",
|
|
16
|
-
PostgresConnectionOptions: "PostgresDataSourceOptions",
|
|
17
|
-
CockroachConnectionOptions: "CockroachDataSourceOptions",
|
|
18
|
-
SqlServerConnectionOptions: "SqlServerDataSourceOptions",
|
|
19
|
-
OracleConnectionOptions: "OracleDataSourceOptions",
|
|
20
|
-
SqliteConnectionOptions: "BetterSqlite3DataSourceOptions",
|
|
21
|
-
BetterSqlite3ConnectionOptions: "BetterSqlite3DataSourceOptions",
|
|
22
|
-
SapConnectionOptions: "SapDataSourceOptions",
|
|
23
|
-
MongoConnectionOptions: "MongoDataSourceOptions",
|
|
24
|
-
CordovaConnectionOptions: "CordovaDataSourceOptions",
|
|
25
|
-
NativescriptConnectionOptions: "NativescriptDataSourceOptions",
|
|
26
|
-
ReactNativeConnectionOptions: "ReactNativeDataSourceOptions",
|
|
27
|
-
ExpoConnectionOptions: "ExpoDataSourceOptions",
|
|
28
|
-
AuroraMysqlConnectionOptions: "AuroraMysqlDataSourceOptions",
|
|
29
|
-
AuroraPostgresConnectionOptions: "AuroraPostgresDataSourceOptions",
|
|
30
|
-
SpannerConnectionOptions: "SpannerDataSourceOptions",
|
|
31
|
-
};
|
|
32
|
-
// Method renames on DataSource/Connection instances
|
|
33
|
-
const methodRenames = {
|
|
34
|
-
connect: "initialize",
|
|
35
|
-
close: "destroy",
|
|
36
|
-
};
|
|
37
|
-
// Property renames
|
|
38
|
-
const propertyRenames = {
|
|
39
|
-
isConnected: "isInitialized",
|
|
40
|
-
};
|
|
41
|
-
// Rename imports from "typeorm"
|
|
42
|
-
root.find(j.ImportDeclaration, {
|
|
43
|
-
source: { value: "typeorm" },
|
|
44
|
-
}).forEach((path) => {
|
|
45
|
-
path.node.specifiers?.forEach((spec) => {
|
|
46
|
-
if (spec.type === "ImportSpecifier" &&
|
|
47
|
-
spec.imported.type === "Identifier") {
|
|
48
|
-
const oldName = spec.imported.name;
|
|
49
|
-
if (typeRenames[oldName]) {
|
|
50
|
-
spec.imported.name = typeRenames[oldName];
|
|
51
|
-
if (spec.local?.type === "Identifier" &&
|
|
52
|
-
spec.local.name === oldName) {
|
|
53
|
-
spec.local.name = typeRenames[oldName];
|
|
54
|
-
}
|
|
55
|
-
hasChanges = true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
// Rename type references
|
|
61
|
-
for (const [oldName, newName] of Object.entries(typeRenames)) {
|
|
62
|
-
root.find(j.Identifier, { name: oldName }).forEach((path) => {
|
|
63
|
-
// Skip import specifiers (already handled)
|
|
64
|
-
if (path.parent.node.type === "ImportSpecifier" ||
|
|
65
|
-
path.parent.node.type === "ImportDefaultSpecifier") {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
path.node.name = newName;
|
|
69
|
-
hasChanges = true;
|
|
70
|
-
});
|
|
71
|
-
// Also rename TSTypeReference
|
|
72
|
-
root.find(j.TSTypeReference, {
|
|
73
|
-
typeName: { name: oldName },
|
|
74
|
-
}).forEach((path) => {
|
|
75
|
-
if (path.node.typeName.type === "Identifier") {
|
|
76
|
-
path.node.typeName.name = newName;
|
|
77
|
-
hasChanges = true;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
// Rename method calls: .connect() → .initialize(), .close() → .destroy()
|
|
82
|
-
for (const [oldMethod, newMethod] of Object.entries(methodRenames)) {
|
|
83
|
-
root.find(j.CallExpression, {
|
|
84
|
-
callee: {
|
|
85
|
-
type: "MemberExpression",
|
|
86
|
-
property: { name: oldMethod },
|
|
87
|
-
},
|
|
88
|
-
}).forEach((path) => {
|
|
89
|
-
if (path.node.callee.type === "MemberExpression" &&
|
|
90
|
-
path.node.callee.property.type === "Identifier") {
|
|
91
|
-
path.node.callee.property.name = newMethod;
|
|
92
|
-
hasChanges = true;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
// Rename property access: .isConnected → .isInitialized
|
|
97
|
-
for (const [oldProp, newProp] of Object.entries(propertyRenames)) {
|
|
98
|
-
root.find(j.MemberExpression, {
|
|
99
|
-
property: { name: oldProp },
|
|
100
|
-
}).forEach((path) => {
|
|
101
|
-
if (path.node.property.type === "Identifier") {
|
|
102
|
-
path.node.property.name = newProp;
|
|
103
|
-
hasChanges = true;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return hasChanges ? root.toSource() : undefined;
|
|
108
|
-
};
|
|
109
|
-
exports.renameConnectionToDataSource = renameConnectionToDataSource;
|
|
110
|
-
exports.default = exports.renameConnectionToDataSource;
|
|
111
|
-
//# sourceMappingURL=rename-connection-to-datasource.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename-connection-to-datasource.js","sourceRoot":"","sources":["../../../src/transforms/v1/rename-connection-to-datasource.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG,2CAA2C,CAAA;AAE/D,MAAM,4BAA4B,GAAG,CAAC,IAAc,EAAE,GAAQ,EAAE,EAAE;IACrE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAA;IACzB,MAAM,IAAI,GAAG,CAAC,CAAC,IA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AQ,CAAC,IAAI,GAAG,OAAO,CAAA;gBACjC,UAAU,GAAG,IAAI,CAAA;YACrB,CAAC;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACnD,CAAC,CAAA;AAxHY,QAAA,4BAA4B,gCAwHxC;AAED,kBAAe,oCAA4B,CAAA"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renameExistToExists = exports.description = void 0;
|
|
4
|
-
exports.description = "rename `Repository.exist()` to `exists()`";
|
|
5
|
-
const renameExistToExists = (file, api) => {
|
|
6
|
-
const j = api.jscodeshift;
|
|
7
|
-
const root = j(file.source);
|
|
8
|
-
let hasChanges = false;
|
|
9
|
-
root.find(j.CallExpression, {
|
|
10
|
-
callee: {
|
|
11
|
-
type: "MemberExpression",
|
|
12
|
-
property: { name: "exist" },
|
|
13
|
-
},
|
|
14
|
-
}).forEach((path) => {
|
|
15
|
-
if (path.node.callee.type === "MemberExpression" &&
|
|
16
|
-
path.node.callee.property.type === "Identifier") {
|
|
17
|
-
path.node.callee.property.name = "exists";
|
|
18
|
-
hasChanges = true;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return hasChanges ? root.toSource() : undefined;
|
|
22
|
-
};
|
|
23
|
-
exports.renameExistToExists = renameExistToExists;
|
|
24
|
-
exports.default = exports.renameExistToExists;
|
|
25
|
-
//# sourceMappingURL=rename-exist-to-exists.js.map
|