sequelize-typescript-generator 12.0.1 → 13.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.
Files changed (83) hide show
  1. package/README.md +832 -204
  2. package/build/bin/cli.js +65 -47
  3. package/build/bin/utils.d.ts +5 -2
  4. package/build/bin/utils.js +87 -104
  5. package/build/builders/Builder.d.ts +2 -2
  6. package/build/builders/Builder.js +3 -5
  7. package/build/builders/ModelBuilder.d.ts +43 -8
  8. package/build/builders/ModelBuilder.js +120 -122
  9. package/build/builders/NativeModelRenderer.d.ts +98 -0
  10. package/build/builders/NativeModelRenderer.js +353 -0
  11. package/build/builders/associationNaming.d.ts +9 -0
  12. package/build/builders/associationNaming.js +15 -0
  13. package/build/builders/decoratorsDependency.d.ts +27 -0
  14. package/build/builders/decoratorsDependency.js +45 -0
  15. package/build/builders/defaultValues.d.ts +40 -0
  16. package/build/builders/defaultValues.js +56 -0
  17. package/build/builders/generatedFile.d.ts +23 -0
  18. package/build/builders/generatedFile.js +31 -0
  19. package/build/builders/index.d.ts +1 -1
  20. package/build/builders/index.js +1 -5
  21. package/build/builders/nativeAssociations.d.ts +109 -0
  22. package/build/builders/nativeAssociations.js +308 -0
  23. package/build/builders/nativeAttributes.d.ts +96 -0
  24. package/build/builders/nativeAttributes.js +174 -0
  25. package/build/builders/nativeWiring.d.ts +51 -0
  26. package/build/builders/nativeWiring.js +108 -0
  27. package/build/builders/utils.d.ts +75 -0
  28. package/build/builders/utils.js +142 -48
  29. package/build/config/IConfig.d.ts +11 -2
  30. package/build/config/IConfig.js +4 -6
  31. package/build/config/format.d.ts +27 -0
  32. package/build/config/format.js +26 -0
  33. package/build/config/index.d.ts +1 -1
  34. package/build/config/index.js +1 -2
  35. package/build/connection/createConnection.d.ts +8 -1
  36. package/build/connection/createConnection.js +30 -7
  37. package/build/connection/index.d.ts +1 -1
  38. package/build/connection/index.js +1 -17
  39. package/build/dialects/AssociationsParser.d.ts +10 -2
  40. package/build/dialects/AssociationsParser.js +16 -19
  41. package/build/dialects/Dialect.d.ts +52 -9
  42. package/build/dialects/Dialect.js +93 -57
  43. package/build/dialects/DialectMSSQL.d.ts +22 -3
  44. package/build/dialects/DialectMSSQL.js +169 -75
  45. package/build/dialects/DialectMariaDB.d.ts +13 -3
  46. package/build/dialects/DialectMariaDB.js +98 -79
  47. package/build/dialects/DialectMySQL.d.ts +13 -3
  48. package/build/dialects/DialectMySQL.js +102 -84
  49. package/build/dialects/DialectPostgres.d.ts +14 -3
  50. package/build/dialects/DialectPostgres.js +129 -75
  51. package/build/dialects/DialectSQLite.d.ts +41 -3
  52. package/build/dialects/DialectSQLite.js +166 -24
  53. package/build/dialects/associationDiscovery.d.ts +64 -0
  54. package/build/dialects/associationDiscovery.js +275 -0
  55. package/build/dialects/associationsFileMerge.d.ts +21 -0
  56. package/build/dialects/associationsFileMerge.js +107 -0
  57. package/build/dialects/createDialect.d.ts +8 -0
  58. package/build/dialects/createDialect.js +24 -0
  59. package/build/dialects/dataTypes.d.ts +58 -0
  60. package/build/dialects/dataTypes.js +108 -0
  61. package/build/dialects/foreignKeys.d.ts +115 -0
  62. package/build/dialects/foreignKeys.js +198 -0
  63. package/build/dialects/index.d.ts +5 -5
  64. package/build/dialects/index.js +5 -13
  65. package/build/dialects/paranoid.d.ts +24 -0
  66. package/build/dialects/paranoid.js +29 -0
  67. package/build/dialects/utils.d.ts +2 -8
  68. package/build/dialects/utils.js +61 -58
  69. package/build/index.d.ts +11 -3
  70. package/build/index.js +5 -19
  71. package/build/lint/Linter.d.ts +14 -3
  72. package/build/lint/Linter.js +114 -14
  73. package/build/lint/eslintDefaultConfig.d.ts +2 -2
  74. package/build/lint/eslintDefaultConfig.js +28 -23
  75. package/build/lint/index.d.ts +1 -1
  76. package/build/lint/index.js +1 -5
  77. package/build/utils/errors.d.ts +6 -0
  78. package/build/utils/errors.js +6 -0
  79. package/package.json +48 -28
  80. package/.github/FUNDING.yml +0 -1
  81. package/.github/workflows/ci.yml +0 -199
  82. package/CHANGELOG.md +0 -30
  83. package/tsconfig.json +0 -21
package/package.json CHANGED
@@ -1,30 +1,44 @@
1
1
  {
2
2
  "name": "sequelize-typescript-generator",
3
- "version": "12.0.1",
4
- "description": "Automatically generates typescript models compatible with sequelize-typescript library (https://www.npmjs.com/package/sequelize-typescript) directly from your source database.",
3
+ "version": "13.0.1",
4
+ "description": "Automatically generate type-safe Sequelize models from your source database via the TypeScript compiler API — native or sequelize-typescript (decorators) format.",
5
+ "type": "module",
5
6
  "main": "build/index.js",
6
7
  "types": "build/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./build/index.d.ts",
11
+ "default": "./build/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
7
15
  "bin": {
8
16
  "stg": "build/bin/cli.js"
9
17
  },
18
+ "engines": {
19
+ "node": ">=22.13.0"
20
+ },
21
+ "files": [
22
+ "build"
23
+ ],
10
24
  "scripts": {
11
25
  "clean": "rm -fr build",
12
26
  "lint": "eslint --fix --ext .ts output/*.ts",
13
- "build": "npm run clean && tsc",
27
+ "build": "npm run clean && tsc && npm run check-deps",
28
+ "check-deps": "node scripts/check-no-sequelize-typescript.cjs",
14
29
  "audit": "npm audit",
15
- "docker-remove-containers": "./src/tests/integration/docker-remove-containers.sh",
16
- "docker-start-mysql": "./src/tests/integration/mysql/docker-start-mysql.sh",
17
- "docker-start-mariadb": "./src/tests/integration/mariadb/docker-start-mariadb.sh",
18
- "docker-start-postgres": "./src/tests/integration/postgres/docker-start-postgres.sh",
19
- "docker-start-mssql": "./src/tests/integration/mssql/docker-start-mssql.sh",
20
- "test-mysql": "npm run docker-remove-containers && npm run docker-start-mysql && jest src/tests/integration/mysql",
21
- "test-mariadb": "npm run docker-remove-containers && npm run docker-start-mariadb && jest src/tests/integration/mariadb",
22
- "test-postgres": "npm run docker-remove-containers && npm run docker-start-postgres && jest src/tests/integration/postgres",
23
- "test-mssql": "npm run docker-remove-containers && npm run docker-start-mssql && jest src/tests/integration/mssql",
24
- "test-sqlite": "npm run docker-remove-containers && jest src/tests/integration/sqlite",
25
- "test": "npm run test-sqlite && npm run test-mysql && npm run test-mariadb && npm run test-postgres && npm run test-mssql",
26
- "dev": "npx ts-node-dev src/bin/cli.ts -D mysql -u root -x mysql -d dbtest --dialect-options '{\"timezone\": \"local\"}' --case const:camel --clean --logs",
27
- "usage": "npx ts-node-dev src/bin/cli.ts --help"
30
+ "test:unit": "NODE_OPTIONS=--experimental-vm-modules jest src/tests/unit",
31
+ "test:sqlite": "NODE_OPTIONS=--experimental-vm-modules jest src/tests/integration/sqlite",
32
+ "test:golden:update": "NODE_OPTIONS=--experimental-vm-modules GOLDEN_UPDATE=1 jest src/tests/integration/sqlite -t 'golden'",
33
+ "test:integration": "NODE_OPTIONS=--experimental-vm-modules jest src/tests/integration/$TEST_DB_DIALECT",
34
+ "test:postgres": "docker compose --profile postgres up -d && TEST_DB_DIALECT=postgres tsx src/tests/integration/wait-for-db.ts && TEST_DB_DIALECT=postgres npm run test:integration; status=$?; docker compose --profile postgres down -v; exit $status",
35
+ "test:mysql": "docker compose --profile mysql up -d && TEST_DB_DIALECT=mysql tsx src/tests/integration/wait-for-db.ts && TEST_DB_DIALECT=mysql npm run test:integration; status=$?; docker compose --profile mysql down -v; exit $status",
36
+ "test:mariadb": "docker compose --profile mariadb up -d && TEST_DB_DIALECT=mariadb tsx src/tests/integration/wait-for-db.ts && TEST_DB_DIALECT=mariadb npm run test:integration; status=$?; docker compose --profile mariadb down -v; exit $status",
37
+ "test:mssql": "docker compose --profile mssql up -d && TEST_DB_DIALECT=mssql tsx src/tests/integration/wait-for-db.ts && TEST_DB_DIALECT=mssql npm run test:integration; status=$?; docker compose --profile mssql down -v; exit $status",
38
+ "pretest": "npm run build",
39
+ "test": "npm run test:unit && npm run test:sqlite",
40
+ "dev": "tsx src/bin/cli.ts -D mysql -u root -x mysql -d dbtest --dialect-options '{\"timezone\": \"local\"}' --case const:camel --clean --logs",
41
+ "usage": "tsx src/bin/cli.ts --help"
28
42
  },
29
43
  "author": "Ludovico Fabbri",
30
44
  "license": "ISC",
@@ -36,36 +50,42 @@
36
50
  "devDependencies": {
37
51
  "@types/bluebird": "^3.5.42",
38
52
  "@types/estree": "^1.0.6",
39
- "@types/jest": "^29.5.14",
40
- "@types/node": "^20.11.28",
53
+ "@types/jest": "^30.0.0",
54
+ "@types/node": "^22.13.0",
41
55
  "@types/pluralize": "0.0.33",
42
56
  "@types/validator": "^13.12.2",
43
57
  "@types/yargs": "^17.0.33",
44
- "jest": "^29.7.0",
58
+ "jest": "^30.5.1",
45
59
  "mariadb": "^3.4.0",
46
60
  "mysql2": "^3.12.0",
47
61
  "pg": "^8.13.1",
48
62
  "pg-hstore": "^2.3.4",
49
63
  "reflect-metadata": "^0.2.1",
50
- "sqlite3": "^5.1.7",
64
+ "sequelize-typescript": "^2.1.6",
65
+ "@vscode/sqlite3": "^5.1.14-vscode",
51
66
  "tedious": "^18.6.1",
52
- "ts-jest": "^29.2.5",
53
- "ts-node-dev": "^2.0.0",
67
+ "ts-jest": "^29.4.12",
68
+ "tsx": "^4.23.13",
54
69
  "wkx": "^0.5.0"
55
70
  },
56
71
  "dependencies": {
57
- "@types/eslint": "^8.56.5",
58
- "@typescript-eslint/parser": "^7.2.0",
72
+ "@stylistic/eslint-plugin": "^5.10.0",
73
+ "@typescript-eslint/parser": "^8.70.0",
59
74
  "change-case": "^4.1.2",
60
- "eslint": "^8.57.0",
75
+ "eslint": "^10.10.0",
61
76
  "pluralize": "^8.0.0",
62
77
  "sequelize": "^6.37.5",
63
- "sequelize-typescript": "^2.1.6",
64
- "typescript": "^5.7.2",
78
+ "typescript": ">=5.7 <6.1",
65
79
  "yargs": "^17.7.2"
66
80
  },
67
81
  "peerDependencies": {
68
- "typescript": "^5.0.4"
82
+ "typescript": ">=5.7 <6.1",
83
+ "sequelize-typescript": "^2.1.6"
84
+ },
85
+ "peerDependenciesMeta": {
86
+ "sequelize-typescript": {
87
+ "optional": true
88
+ }
69
89
  },
70
90
  "keywords": [
71
91
  "sequelize",
@@ -1 +0,0 @@
1
- github: [spinlud]
@@ -1,199 +0,0 @@
1
- name: ci
2
- on: [push, workflow_dispatch]
3
-
4
- jobs:
5
- install_build:
6
- runs-on: ubuntu-latest
7
- steps:
8
- - name: Check out repository code
9
- uses: actions/checkout@v2
10
-
11
- - name: Setup node
12
- uses: actions/setup-node@v2
13
- with:
14
- node-version: '16'
15
-
16
- - name: Cache node_modules
17
- id: cache-node-modules
18
- uses: actions/cache@v2
19
- with:
20
- path: node_modules
21
- key: node-modules-${{ hashFiles('package-lock.json') }}
22
-
23
- - name: Install
24
- run: npm install
25
-
26
- - name: Build
27
- run: npm run build
28
-
29
- test_mysql:
30
- runs-on: ubuntu-latest
31
- needs: install_build
32
- steps:
33
- - name: Check out repository code
34
- uses: actions/checkout@v2
35
-
36
- - name: Setup node
37
- uses: actions/setup-node@v2
38
- with:
39
- node-version: '16'
40
-
41
- - name: Restore node_modules
42
- id: cache-node-modules
43
- uses: actions/cache@v2
44
- with:
45
- path: node_modules
46
- key: node-modules-${{ hashFiles('package-lock.json') }}
47
-
48
- - name: Test MySQL 5
49
- run: npm run test-mysql
50
- env:
51
- DOCKER_MYSQL_TAG: 5
52
-
53
- - name: Test MySQL 8
54
- run: npm run test-mysql
55
- env:
56
- DOCKER_MYSQL_TAG: 8
57
-
58
- test_postgres:
59
- runs-on: ubuntu-latest
60
- needs: install_build
61
- steps:
62
- - name: Check out repository code
63
- uses: actions/checkout@v2
64
-
65
- - name: Setup node
66
- uses: actions/setup-node@v2
67
- with:
68
- node-version: '16'
69
-
70
- - name: Restore node_modules
71
- id: cache-node-modules
72
- uses: actions/cache@v2
73
- with:
74
- path: node_modules
75
- key: node-modules-${{ hashFiles('package-lock.json') }}
76
-
77
- - name: Test Postgres 11
78
- run: npm run test-postgres
79
- env:
80
- DOCKER_POSTGRES_TAG: 11
81
-
82
- - name: Test Postgres 14
83
- run: npm run test-postgres
84
- env:
85
- DOCKER_POSTGRES_TAG: 14
86
-
87
- - name: Test Postgres 16
88
- run: npm run test-postgres
89
- env:
90
- DOCKER_POSTGRES_TAG: 16
91
-
92
- test_mariadb:
93
- runs-on: ubuntu-latest
94
- needs: install_build
95
- steps:
96
- - name: Check out repository code
97
- uses: actions/checkout@v2
98
-
99
- - name: Setup node
100
- uses: actions/setup-node@v2
101
- with:
102
- node-version: '16'
103
-
104
- - name: Restore node_modules
105
- id: cache-node-modules
106
- uses: actions/cache@v2
107
- with:
108
- path: node_modules
109
- key: node-modules-${{ hashFiles('package-lock.json') }}
110
-
111
- - name: Test MariaDB 10
112
- run: npm run test-mariadb
113
- env:
114
- DOCKER_MARIADB_TAG: 10
115
-
116
- - name: Test MariaDB 11
117
- run: npm run test-mariadb
118
- env:
119
- DOCKER_MARIADB_TAG: 11
120
-
121
- test_mssql:
122
- runs-on: ubuntu-latest
123
- needs: install_build
124
- steps:
125
- - name: Check out repository code
126
- uses: actions/checkout@v2
127
-
128
- - name: Setup node
129
- uses: actions/setup-node@v2
130
- with:
131
- node-version: '16'
132
-
133
- - name: Restore node_modules
134
- id: cache-node-modules
135
- uses: actions/cache@v2
136
- with:
137
- path: node_modules
138
- key: node-modules-${{ hashFiles('package-lock.json') }}
139
-
140
- - name: Test MSSQL 2019
141
- run: npm run test-mssql
142
- env:
143
- DOCKER_MSSQL_TAG: 2019-latest
144
-
145
- - name: Test MSSQL 2022
146
- run: npm run test-mssql
147
- env:
148
- DOCKER_MSSQL_TAG: 2022-latest
149
-
150
- test_sqlite:
151
- runs-on: ubuntu-latest
152
- needs: install_build
153
- steps:
154
- - name: Check out repository code
155
- uses: actions/checkout@v2
156
-
157
- - name: Setup node
158
- uses: actions/setup-node@v2
159
- with:
160
- node-version: '16'
161
-
162
- - name: Restore node_modules
163
- id: cache-node-modules
164
- uses: actions/cache@v2
165
- with:
166
- path: node_modules
167
- key: node-modules-${{ hashFiles('package-lock.json') }}
168
-
169
- - name: Test SQLite
170
- run: npm run test-sqlite
171
-
172
- publish:
173
- runs-on: ubuntu-latest
174
- needs: [test_mysql, test_postgres, test_mariadb, test_mssql, test_sqlite]
175
- steps:
176
- - name: Check out repository code
177
- uses: actions/checkout@v2
178
-
179
- - name: Setup node
180
- uses: actions/setup-node@v2
181
- with:
182
- node-version: '16'
183
-
184
- - name: Restore node_modules
185
- id: cache-node-modules
186
- uses: actions/cache@v2
187
- with:
188
- path: node_modules
189
- key: node-modules-${{ hashFiles('package-lock.json') }}
190
-
191
- - name: Build
192
- run: npm run build
193
-
194
- - name: Publish
195
- # if: contains(github.ref, 'release') # Tag commit with 'release' string to publish
196
- run: |
197
- npm set registry "https://registry.npmjs.org"
198
- npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_PUBLISH_TOKEN }}
199
- npm publish
package/CHANGELOG.md DELETED
@@ -1,30 +0,0 @@
1
- # Change Log
2
-
3
- ---
4
-
5
- ### 10.1.0
6
- #### Breaking changes:
7
-
8
- #### Minor changes and bug fixes:
9
- * Libraries update
10
- * Changed node.js version to v14.21.3 to test latest versions of `typescript` using `jest`
11
-
12
- ---
13
-
14
- ### 10.0.0
15
- #### Breaking changes:
16
- * Typescript: `4.9.4` -> `5.0.2`
17
- * MySQL driver: `mysql2@2.3.3` -> `mysql2@3.2.0`
18
-
19
- #### Minor changes and bug fixes:
20
- * Added change log file
21
-
22
- ---
23
-
24
- ### 9.0.3
25
- #### Breaking changes:
26
- * NA
27
- #### Minor changes and bug fixes:
28
- * NA
29
-
30
- ---
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2019",
4
- "module": "CommonJS",
5
- "declaration": true,
6
- "outDir": "./build",
7
- "rootDir": "./src",
8
- "downlevelIteration": true,
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "experimentalDecorators": true,
12
- "emitDecoratorMetadata": true,
13
- "forceConsistentCasingInFileNames": false
14
- },
15
- "exclude": [
16
- "src/tests",
17
- "**/output-models",
18
- "**/prova.ts",
19
- "**/tmp"
20
- ]
21
- }