@dbml/cli 8.0.0-alpha.1 → 8.0.0-alpha.11

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 (31) hide show
  1. package/__tests__/db2dbml/mssql/dbml-error.log +40 -0
  2. package/__tests__/db2dbml/mysql/dbml-error.log +52 -0
  3. package/__tests__/db2dbml/oracle/dbml-error.log +56 -0
  4. package/__tests__/db2dbml/postgres/dbml-error.log +35 -0
  5. package/__tests__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  6. package/__tests__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +1 -1
  7. package/__tests__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  8. package/__tests__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  9. package/__tests__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  10. package/__tests__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +1 -1
  11. package/__tests__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  12. package/__tests__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  13. package/__tests__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  14. package/__tests__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  15. package/__tests__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +1 -1
  16. package/__tests__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  17. package/__tests__/dbml2sql/syntax-error/dbml-error.log +25 -0
  18. package/__tests__/sql2dbml/custom-error-alter-table-column-not-found --oracle/dbml-error.log +20 -0
  19. package/__tests__/sql2dbml/custom-error-alter-table-table-not-found --oracle/dbml-error.log +20 -0
  20. package/__tests__/sql2dbml/custom-error-column-comment-column-not-found --oracle/dbml-error.log +20 -0
  21. package/__tests__/sql2dbml/custom-error-column-comment-table-not-found --oracle/dbml-error.log +20 -0
  22. package/__tests__/sql2dbml/custom-error-create-index-table-not-found --oracle/dbml-error.log +20 -0
  23. package/__tests__/sql2dbml/custom-error-table-comment-table-not-found --oracle/dbml-error.log +20 -0
  24. package/__tests__/sql2dbml/syntax-error/dbml-error.log +20 -0
  25. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +20 -0
  26. package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +16 -0
  27. package/lib/index.js +22 -50
  28. package/package.json +4 -4
  29. package/src/NodeProjectLayout.ts +12 -76
  30. package/src/cli/connector.ts +1 -1
  31. package/src/helpers/logger.ts +3 -3
@@ -358,3 +358,43 @@ ConnectionError: Login failed for user 'SA'.
358
358
  at /home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:2363:18
359
359
  at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
360
360
 
361
+ 2026-05-06T10:17:43.520Z
362
+ ConnectionError: Login failed for user 'SA'.
363
+ at /home/huydna/projects/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
364
+ at Connection.onConnect (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:849:9)
365
+ at Object.onceWrapper (node:events:634:26)
366
+ at Connection.emit (node:events:519:28)
367
+ at Connection.emit (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:970:18)
368
+ at /home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:2363:18
369
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
370
+
371
+ 2026-05-07T08:41:25.410Z
372
+ ConnectionError: Login failed for user 'SA'.
373
+ at /home/huydna/projects/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
374
+ at Connection.onConnect (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:849:9)
375
+ at Object.onceWrapper (node:events:634:26)
376
+ at Connection.emit (node:events:519:28)
377
+ at Connection.emit (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:970:18)
378
+ at /home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:2363:18
379
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
380
+
381
+ 2026-05-07T08:43:23.029Z
382
+ ConnectionError: Login failed for user 'SA'.
383
+ at /home/huydna/projects/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
384
+ at Connection.onConnect (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:849:9)
385
+ at Object.onceWrapper (node:events:634:26)
386
+ at Connection.emit (node:events:519:28)
387
+ at Connection.emit (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:970:18)
388
+ at /home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:2363:18
389
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
390
+
391
+ 2026-05-12T10:00:51.950Z
392
+ ConnectionError: Login failed for user 'SA'.
393
+ at /home/huydna/projects/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
394
+ at Connection.onConnect (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:849:9)
395
+ at Object.onceWrapper (node:events:634:26)
396
+ at Connection.emit (node:events:519:28)
397
+ at Connection.emit (/home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:970:18)
398
+ at /home/huydna/projects/dbml/node_modules/tedious/lib/connection.js:2363:18
399
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
400
+
@@ -466,3 +466,55 @@ Error: Unknown database 'dbml_test'
466
466
  at Object..js (node:internal/modules/cjs/loader:1839:10)
467
467
  at Module.load (node:internal/modules/cjs/loader:1441:32)
468
468
 
469
+ 2026-05-06T10:17:44.739Z
470
+ Error: Unknown database 'dbml_test'
471
+ at c (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:47740)
472
+ at Fr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:52036)
473
+ at Xr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3360:500)
474
+ at Module.Hi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3739:1082)
475
+ at connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:55)
476
+ at Module.db2dbml (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1394:2)
477
+ at Object.<anonymous> (/home/huydna/projects/dbml/packages/dbml-cli/bin/db2dbml.js:3:19)
478
+ at Module._compile (node:internal/modules/cjs/loader:1706:14)
479
+ at Object..js (node:internal/modules/cjs/loader:1839:10)
480
+ at Module.load (node:internal/modules/cjs/loader:1441:32)
481
+
482
+ 2026-05-07T08:41:26.659Z
483
+ Error: Unknown database 'dbml_test'
484
+ at c (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:47740)
485
+ at Fr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:52036)
486
+ at Xr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3360:500)
487
+ at Module.Hi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3739:1082)
488
+ at connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:55)
489
+ at Module.db2dbml (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1394:2)
490
+ at Object.<anonymous> (/home/huydna/projects/dbml/packages/dbml-cli/bin/db2dbml.js:3:19)
491
+ at Module._compile (node:internal/modules/cjs/loader:1706:14)
492
+ at Object..js (node:internal/modules/cjs/loader:1839:10)
493
+ at Module.load (node:internal/modules/cjs/loader:1441:32)
494
+
495
+ 2026-05-07T08:43:24.354Z
496
+ Error: Unknown database 'dbml_test'
497
+ at c (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:47740)
498
+ at Fr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:52036)
499
+ at Xr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3360:500)
500
+ at Module.Hi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3739:1082)
501
+ at connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:55)
502
+ at Module.db2dbml (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1394:2)
503
+ at Object.<anonymous> (/home/huydna/projects/dbml/packages/dbml-cli/bin/db2dbml.js:3:19)
504
+ at Module._compile (node:internal/modules/cjs/loader:1706:14)
505
+ at Object..js (node:internal/modules/cjs/loader:1839:10)
506
+ at Module.load (node:internal/modules/cjs/loader:1441:32)
507
+
508
+ 2026-05-12T10:00:53.243Z
509
+ Error: Unknown database 'dbml_test'
510
+ at c (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:47740)
511
+ at Fr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3241:52036)
512
+ at Xr (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3360:500)
513
+ at Module.Hi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3739:1082)
514
+ at connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:55)
515
+ at Module.db2dbml (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1364:2)
516
+ at Object.<anonymous> (/home/huydna/projects/dbml/packages/dbml-cli/bin/db2dbml.js:3:19)
517
+ at Module._compile (node:internal/modules/cjs/loader:1706:14)
518
+ at Object..js (node:internal/modules/cjs/loader:1839:10)
519
+ at Module.load (node:internal/modules/cjs/loader:1441:32)
520
+
@@ -502,3 +502,59 @@ connect ECONNREFUSED 127.0.0.1:1521
502
502
  at async ThinConnectionImpl.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/connection.js:859:5)
503
503
  at async getConnection (/home/huydna/projects/dbml/node_modules/oracledb/lib/oracledb.js:791:3)
504
504
 
505
+ 2026-05-06T10:17:45.991Z
506
+ Error: NJS-503: connection to host 127.0.0.1 port 1521 could not be established. (CONNECTION_ID=KhaaLMFAF4Xr6LtuRWS10w==)
507
+ connect ECONNREFUSED 127.0.0.1:1521
508
+ at Object.throwErr (/home/huydna/projects/dbml/node_modules/oracledb/lib/errors.js:776:10)
509
+ at NTTCP.ntConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:206:16)
510
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
511
+ at async NTTCP.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:222:7)
512
+ at async NetworkSession.transportConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:182:5)
513
+ at async NetworkSession.connect2 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:222:7)
514
+ at async NetworkSession.connect1 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:336:23)
515
+ at async NetworkSession.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:623:5)
516
+ at async ThinConnectionImpl.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/connection.js:859:5)
517
+ at async getConnection (/home/huydna/projects/dbml/node_modules/oracledb/lib/oracledb.js:791:3)
518
+
519
+ 2026-05-07T08:41:27.934Z
520
+ Error: NJS-503: connection to host 127.0.0.1 port 1521 could not be established. (CONNECTION_ID=q5/BbdXeIY8V1h5b6gCn2A==)
521
+ connect ECONNREFUSED 127.0.0.1:1521
522
+ at Object.throwErr (/home/huydna/projects/dbml/node_modules/oracledb/lib/errors.js:776:10)
523
+ at NTTCP.ntConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:206:16)
524
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
525
+ at async NTTCP.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:222:7)
526
+ at async NetworkSession.transportConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:182:5)
527
+ at async NetworkSession.connect2 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:222:7)
528
+ at async NetworkSession.connect1 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:336:23)
529
+ at async NetworkSession.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:623:5)
530
+ at async ThinConnectionImpl.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/connection.js:859:5)
531
+ at async getConnection (/home/huydna/projects/dbml/node_modules/oracledb/lib/oracledb.js:791:3)
532
+
533
+ 2026-05-07T08:43:25.617Z
534
+ Error: NJS-503: connection to host 127.0.0.1 port 1521 could not be established. (CONNECTION_ID=dP1yZS9iyoYM54o7GGjNog==)
535
+ connect ECONNREFUSED 127.0.0.1:1521
536
+ at Object.throwErr (/home/huydna/projects/dbml/node_modules/oracledb/lib/errors.js:776:10)
537
+ at NTTCP.ntConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:206:16)
538
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
539
+ at async NTTCP.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:222:7)
540
+ at async NetworkSession.transportConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:182:5)
541
+ at async NetworkSession.connect2 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:222:7)
542
+ at async NetworkSession.connect1 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:336:23)
543
+ at async NetworkSession.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:623:5)
544
+ at async ThinConnectionImpl.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/connection.js:859:5)
545
+ at async getConnection (/home/huydna/projects/dbml/node_modules/oracledb/lib/oracledb.js:791:3)
546
+
547
+ 2026-05-12T10:00:54.495Z
548
+ Error: NJS-503: connection to host 127.0.0.1 port 1521 could not be established. (CONNECTION_ID=Zb0hZR33/XKqh9553rBYiw==)
549
+ connect ECONNREFUSED 127.0.0.1:1521
550
+ at Object.throwErr (/home/huydna/projects/dbml/node_modules/oracledb/lib/errors.js:776:10)
551
+ at NTTCP.ntConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:206:16)
552
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
553
+ at async NTTCP.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:222:7)
554
+ at async NetworkSession.transportConnect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:182:5)
555
+ at async NetworkSession.connect2 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:222:7)
556
+ at async NetworkSession.connect1 (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:336:23)
557
+ at async NetworkSession.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:623:5)
558
+ at async ThinConnectionImpl.connect (/home/huydna/projects/dbml/node_modules/oracledb/lib/thin/connection.js:859:5)
559
+ at async getConnection (/home/huydna/projects/dbml/node_modules/oracledb/lib/oracledb.js:791:3)
560
+
@@ -250,3 +250,38 @@ Error: PostgreSQL connection error: error: role "dbml" does not exist
250
250
  at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
251
251
  at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1168:22)
252
252
 
253
+ 2026-05-06T08:32:33.059Z
254
+ Error: PostgreSQL connection error: error: role "dbml" does not exist
255
+ at vi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3484:2977)
256
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
257
+ at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
258
+ at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:22)
259
+
260
+ 2026-05-06T10:17:47.199Z
261
+ Error: PostgreSQL connection error: error: role "dbml" does not exist
262
+ at vi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3484:2977)
263
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
264
+ at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
265
+ at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:22)
266
+
267
+ 2026-05-07T08:41:29.160Z
268
+ Error: PostgreSQL connection error: error: role "dbml" does not exist
269
+ at vi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3484:2977)
270
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
271
+ at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
272
+ at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:22)
273
+
274
+ 2026-05-07T08:43:26.795Z
275
+ Error: PostgreSQL connection error: error: role "dbml" does not exist
276
+ at vi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3484:2977)
277
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
278
+ at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
279
+ at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:22)
280
+
281
+ 2026-05-12T10:00:55.815Z
282
+ Error: PostgreSQL connection error: AggregateError
283
+ at vi (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3484:2977)
284
+ at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
285
+ at async Di (/home/huydna/projects/dbml/packages/dbml-connector/dist/index.js:3701:279)
286
+ at async connectionHandler (/home/huydna/projects/dbml/packages/dbml-cli/lib/index.js:1170:22)
287
+
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2026-05-06T08:18:15.131Z
3
+ -- Generated at: 2026-05-12T09:59:32.525Z
4
4
 
5
5
  CREATE TABLE `orders` (
6
6
  `id` int PRIMARY KEY AUTO_INCREMENT,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2026-05-06T08:18:17.472Z
3
+ -- Generated at: 2026-05-12T09:59:35.816Z
4
4
 
5
5
  CREATE TABLE "orders" (
6
6
  "id" int GENERATED AS IDENTITY PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:19.831Z
3
+ -- Generated at: 2026-05-12T09:59:38.993Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:21.053Z
3
+ -- Generated at: 2026-05-12T09:59:40.585Z
4
4
 
5
5
  CREATE TYPE "orders_status" AS ENUM (
6
6
  'created',
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2026-05-06T08:18:24.506Z
3
+ -- Generated at: 2026-05-12T09:59:45.020Z
4
4
 
5
5
  CREATE TABLE `staff` (
6
6
  `id` int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2026-05-06T08:18:26.875Z
3
+ -- Generated at: 2026-05-12T09:59:47.972Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:29.254Z
3
+ -- Generated at: 2026-05-12T09:59:50.961Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:30.451Z
3
+ -- Generated at: 2026-05-12T09:59:52.483Z
4
4
 
5
5
  CREATE TABLE "staff" (
6
6
  "id" int PRIMARY KEY,
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: SQL Server
3
- -- Generated at: 2026-05-06T08:18:35.192Z
3
+ -- Generated at: 2026-05-12T09:59:58.479Z
4
4
 
5
5
  CREATE SCHEMA [schemaB]
6
6
  GO
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: MySQL
3
- -- Generated at: 2026-05-06T08:18:36.389Z
3
+ -- Generated at: 2026-05-12T09:59:59.896Z
4
4
 
5
5
  CREATE SCHEMA `schemaB`;
6
6
 
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: Oracle
3
- -- Generated at: 2026-05-06T08:18:37.575Z
3
+ -- Generated at: 2026-05-12T10:00:01.301Z
4
4
 
5
5
  CREATE USER "C##test01"
6
6
  NO AUTHENTICATION
@@ -1,6 +1,6 @@
1
1
  -- SQL dump generated using DBML (dbml.dbdiagram.io)
2
2
  -- Database: PostgreSQL
3
- -- Generated at: 2026-05-06T08:18:38.740Z
3
+ -- Generated at: 2026-05-12T10:00:02.633Z
4
4
 
5
5
  CREATE SCHEMA "schemaB";
6
6
 
@@ -121,3 +121,28 @@ undefined
121
121
  2026-05-06T08:18:39.956Z
122
122
  undefined
123
123
 
124
+ 2026-05-06T08:31:51.201Z
125
+
126
+ ecommerce.dbml(17,24): Expect an identifier
127
+ ecommerce.dbml(16,11): Unknown column setting 'pk manager_staff_id int'
128
+
129
+ 2026-05-06T10:17:00.549Z
130
+
131
+ ecommerce.dbml(17,24): Expect an identifier
132
+ ecommerce.dbml(16,11): Unknown column setting 'pk manager_staff_id int'
133
+
134
+ 2026-05-07T08:40:38.665Z
135
+
136
+ ecommerce.dbml(17,24): Expect an identifier
137
+ ecommerce.dbml(16,11): Unknown column setting 'pk manager_staff_id int'
138
+
139
+ 2026-05-07T08:42:33.135Z
140
+
141
+ ecommerce.dbml(17,24): Expect an identifier
142
+ ecommerce.dbml(16,11): Unknown column setting 'pk manager_staff_id int'
143
+
144
+ 2026-05-12T10:00:04.107Z
145
+
146
+ ecommerce.dbml(17,24): Expect an identifier
147
+ ecommerce.dbml(16,11): Unknown column setting 'pk manager_staff_id int'
148
+
@@ -124,3 +124,23 @@ undefined
124
124
  2026-05-06T08:18:41.350Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:52.703Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 1. Column "name" do not exist in table "Users"
130
+
131
+ 2026-05-06T10:17:02.003Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 1. Column "name" do not exist in table "Users"
134
+
135
+ 2026-05-07T08:40:40.063Z
136
+
137
+ You have a syntax error at "schema.sql" line 1 column 1. Column "name" do not exist in table "Users"
138
+
139
+ 2026-05-07T08:42:34.694Z
140
+
141
+ You have a syntax error at "schema.sql" line 1 column 1. Column "name" do not exist in table "Users"
142
+
143
+ 2026-05-12T10:00:05.690Z
144
+
145
+ You have a syntax error at "schema.sql" line 1 column 1. Column "name" do not exist in table "Users"
146
+
@@ -124,3 +124,23 @@ undefined
124
124
  2026-05-06T08:18:42.669Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:54.324Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 13. Table "Users" not found
130
+
131
+ 2026-05-06T10:17:03.429Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 13. Table "Users" not found
134
+
135
+ 2026-05-07T08:40:41.446Z
136
+
137
+ You have a syntax error at "schema.sql" line 1 column 13. Table "Users" not found
138
+
139
+ 2026-05-07T08:42:36.191Z
140
+
141
+ You have a syntax error at "schema.sql" line 1 column 13. Table "Users" not found
142
+
143
+ 2026-05-12T10:00:07.181Z
144
+
145
+ You have a syntax error at "schema.sql" line 1 column 13. Table "Users" not found
146
+
@@ -124,3 +124,23 @@ undefined
124
124
  2026-05-06T08:18:44.046Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:55.691Z
128
+
129
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
130
+
131
+ 2026-05-06T10:17:04.922Z
132
+
133
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
134
+
135
+ 2026-05-07T08:40:42.906Z
136
+
137
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
138
+
139
+ 2026-05-07T08:42:37.754Z
140
+
141
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
142
+
143
+ 2026-05-12T10:00:08.813Z
144
+
145
+ You have a syntax error at "schema.sql" line 5 column 19. Column "name" not found in table "Users"
146
+
@@ -124,3 +124,23 @@ undefined
124
124
  2026-05-06T08:18:45.383Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:57.068Z
128
+
129
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
130
+
131
+ 2026-05-06T10:17:06.468Z
132
+
133
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
134
+
135
+ 2026-05-07T08:40:44.510Z
136
+
137
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
138
+
139
+ 2026-05-07T08:42:39.340Z
140
+
141
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
142
+
143
+ 2026-05-12T10:00:10.389Z
144
+
145
+ You have a syntax error at "schema.sql" line 5 column 19. Table "Posts" not found
146
+
@@ -124,3 +124,23 @@ undefined
124
124
  2026-05-06T08:18:46.726Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:58.490Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
130
+
131
+ 2026-05-06T10:17:07.902Z
132
+
133
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
134
+
135
+ 2026-05-07T08:40:46.177Z
136
+
137
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
138
+
139
+ 2026-05-07T08:42:40.824Z
140
+
141
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
142
+
143
+ 2026-05-12T10:00:12.045Z
144
+
145
+ You have a syntax error at "schema.sql" line 1 column 28. Table Users not found
146
+
@@ -124,3 +124,23 @@ undefined
124
124
  2026-05-06T08:18:48.105Z
125
125
  undefined
126
126
 
127
+ 2026-05-06T08:31:59.877Z
128
+
129
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
130
+
131
+ 2026-05-06T10:17:09.292Z
132
+
133
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
134
+
135
+ 2026-05-07T08:40:47.729Z
136
+
137
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
138
+
139
+ 2026-05-07T08:42:42.345Z
140
+
141
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
142
+
143
+ 2026-05-12T10:00:13.619Z
144
+
145
+ You have a syntax error at "schema.sql" line 5 column 18. Table "Posts" not found
146
+
@@ -111,3 +111,23 @@ undefined
111
111
  2026-05-06T08:18:03.492Z
112
112
  undefined
113
113
 
114
+ 2026-05-06T08:32:30.153Z
115
+
116
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
117
+
118
+ 2026-05-06T10:17:39.447Z
119
+
120
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
121
+
122
+ 2026-05-07T08:41:20.977Z
123
+
124
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
125
+
126
+ 2026-05-07T08:43:18.594Z
127
+
128
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
129
+
130
+ 2026-05-12T10:00:47.485Z
131
+
132
+ You have a syntax error at "business.sql" line 6 column 2. no viable alternative at input 'CREATE TABLE `staff` (\n `id` int PRIMARY KEY,\n `first_name` varchar(255),\n `last_name` varchar(255),\n `address_id` int\n `picture`'
133
+
@@ -108,3 +108,23 @@ undefined
108
108
  2026-05-06T08:18:04.905Z
109
109
  undefined
110
110
 
111
+ 2026-05-06T08:32:31.718Z
112
+
113
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
114
+
115
+ 2026-05-06T10:17:40.917Z
116
+
117
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
118
+
119
+ 2026-05-07T08:41:22.546Z
120
+
121
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
122
+
123
+ 2026-05-07T08:43:20.245Z
124
+
125
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
126
+
127
+ 2026-05-12T10:00:49.171Z
128
+
129
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
130
+
@@ -108,3 +108,19 @@ undefined
108
108
  2026-05-06T08:18:06.210Z
109
109
  undefined
110
110
 
111
+ 2026-05-06T10:17:42.282Z
112
+
113
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
114
+
115
+ 2026-05-07T08:41:24.076Z
116
+
117
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
118
+
119
+ 2026-05-07T08:43:21.697Z
120
+
121
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
122
+
123
+ 2026-05-12T10:00:50.634Z
124
+
125
+ You have a syntax error at "schema.sql" line 1 column 1. Reference with the same endpoints already exists: "student"("subject_id", "score_id") references "score_subject"("subject_id", "score_id")
126
+
package/lib/index.js CHANGED
@@ -29,6 +29,8 @@ let chalk = require("chalk");
29
29
  chalk = __toESM(chalk);
30
30
  let figures = require("figures");
31
31
  figures = __toESM(figures);
32
+ let strip_ansi = require("strip-ansi");
33
+ strip_ansi = __toESM(strip_ansi);
32
34
  let winston = require("winston");
33
35
  let fs = require("fs");
34
36
  fs = __toESM(fs);
@@ -36,7 +38,7 @@ let __dbml_parse = require("@dbml/parse");
36
38
  let node_fs = require("node:fs");
37
39
  const $schema = "https://json.schemastore.org/package";
38
40
  const name = "@dbml/cli";
39
- const version = "8.0.0-alpha.1";
41
+ const version = "8.0.0-alpha.11";
40
42
  const description = "";
41
43
  const main = "lib/index.js";
42
44
  const license = "Apache-2.0";
@@ -63,8 +65,8 @@ const keywords = ["dbml", "dbml-cli"];
63
65
  const dependencies = {
64
66
  "@babel/cli": "^7.21.0",
65
67
  "@dbml/connector": "^8.0.0-alpha.0",
66
- "@dbml/core": "^8.0.0-alpha.0",
67
- "@dbml/parse": "^8.0.0-alpha.0",
68
+ "@dbml/core": "^8.0.0-alpha.11",
69
+ "@dbml/parse": "^8.0.0-alpha.11",
68
70
  "bluebird": "^3.5.5",
69
71
  "chalk": "^2.4.2",
70
72
  "commander": "^2.20.0",
@@ -75,7 +77,7 @@ const dependencies = {
75
77
  "strip-ansi": "^5.2.0",
76
78
  "winston": "^3.2.1"
77
79
  };
78
- const gitHead = "9c741ec1eb685be6f319c263a9a86628b241b2c4";
80
+ const gitHead = "976e0f27c85468fa8a0fbb2ded04862e86b05b89";
79
81
  const engines = { "node": ">=18" };
80
82
  var package_default = {
81
83
  $schema,
@@ -103,8 +105,8 @@ var consoleFormat = printf((info) => {
103
105
  ${path.default.resolve(process.cwd(), "dbml-error.log")}`;
104
106
  });
105
107
  var fileFormat = printf((info) => {
106
- const { timestamp: ts, stack, rootError } = info;
107
- let logContent = `${ts}\n${stack}\n`;
108
+ const { timestamp: ts, message, stack, rootError } = info;
109
+ let logContent = `${ts}\n${(0, strip_ansi.default)(stack ?? message ?? "")}\n`;
108
110
  if (rootError) {
109
111
  logContent += "\nROOT_ERROR:";
110
112
  logContent += `\n${rootError.stack}`;
@@ -512,8 +514,8 @@ ListCache.prototype.get = _listCacheGet_default;
512
514
  ListCache.prototype.has = _listCacheHas_default;
513
515
  ListCache.prototype.set = _listCacheSet_default;
514
516
  var _ListCache_default = ListCache;
515
- var Map$1 = _getNative_default(_root_default, "Map");
516
- var _Map_default = Map$1;
517
+ var Map = _getNative_default(_root_default, "Map");
518
+ var _Map_default = Map;
517
519
  function mapCacheClear() {
518
520
  this.size = 0;
519
521
  this.__data__ = {
@@ -726,8 +728,8 @@ var DataView = _getNative_default(_root_default, "DataView");
726
728
  var _DataView_default = DataView;
727
729
  var Promise$1 = _getNative_default(_root_default, "Promise");
728
730
  var _Promise_default = Promise$1;
729
- var Set$1 = _getNative_default(_root_default, "Set");
730
- var _Set_default = Set$1;
731
+ var Set = _getNative_default(_root_default, "Set");
732
+ var _Set_default = Set;
731
733
  var mapTag$2 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$2 = "[object Set]", weakMapTag = "[object WeakMap]";
732
734
  var dataViewTag$1 = "[object DataView]";
733
735
  var dataViewCtorString = _toSource_default(_DataView_default), mapCtorString = _toSource_default(_Map_default), promiseCtorString = _toSource_default(_Promise_default), setCtorString = _toSource_default(_Set_default), weakMapCtorString = _toSource_default(_WeakMap_default);
@@ -1178,75 +1180,45 @@ async function connectionHandler(program$1) {
1178
1180
  logger_default.error(error);
1179
1181
  }
1180
1182
  }
1181
- var NodeProjectLayout = class NodeProjectLayout {
1183
+ var NodeProjectLayout = class {
1182
1184
  constructor(entryPoints) {
1183
- this.overlay = /* @__PURE__ */ new Map();
1184
1185
  this.entryPoints = [...entryPoints];
1185
1186
  }
1186
- setSource(filePath, content) {
1187
- this.overlay.set(filePath.absolute, content);
1188
- }
1189
1187
  getSource(filePath) {
1190
- const absolutePath = filePath.absolute;
1191
- if (this.overlay.has(absolutePath)) return this.overlay.get(absolutePath) ?? void 0;
1192
1188
  try {
1193
- return (0, node_fs.readFileSync)(absolutePath, "utf-8");
1189
+ return (0, node_fs.readFileSync)(filePath.absolute, "utf-8");
1194
1190
  } catch {
1195
1191
  return;
1196
1192
  }
1197
1193
  }
1198
- deleteSource(filePath) {
1199
- this.overlay.set(filePath.absolute, null);
1200
- }
1201
- clearSource() {
1202
- this.overlay.clear();
1203
- this.entryPoints = [];
1204
- }
1205
1194
  exists(filePath) {
1206
1195
  return this.isFile(filePath) || this.isDirectory(filePath);
1207
1196
  }
1208
1197
  isFile(filePath) {
1209
- const absolutePath = filePath.absolute;
1210
- if (this.overlay.has(absolutePath)) return this.overlay.get(absolutePath) !== null;
1211
1198
  try {
1212
- return (0, node_fs.statSync)(absolutePath).isFile();
1199
+ return (0, node_fs.statSync)(filePath.absolute).isFile();
1213
1200
  } catch {
1214
1201
  return false;
1215
1202
  }
1216
1203
  }
1217
1204
  isDirectory(filePath) {
1218
- const absolutePath = filePath.absolute;
1219
1205
  try {
1220
- if ((0, node_fs.statSync)(absolutePath).isDirectory()) return true;
1221
- } catch {}
1222
- for (const [overlayPath, content] of this.overlay) {
1223
- if (content === null) continue;
1224
- if (overlayPath.startsWith(absolutePath)) return true;
1206
+ return (0, node_fs.statSync)(filePath.absolute).isDirectory();
1207
+ } catch {
1208
+ return false;
1225
1209
  }
1226
- return false;
1227
1210
  }
1228
1211
  listDirectory(dirPath) {
1229
1212
  const basePath = dirPath?.absolute ?? "/";
1230
- const results = /* @__PURE__ */ new Set();
1231
1213
  try {
1232
- for (const entry of (0, node_fs.readdirSync)(basePath)) results.add(basePath + entry);
1233
- } catch {}
1234
- for (const [abs, content] of this.overlay) {
1235
- if (content === null) continue;
1236
- if (!abs.startsWith(basePath)) continue;
1237
- if (!abs.slice(basePath.length).includes("/")) results.add(abs);
1214
+ return (0, node_fs.readdirSync)(basePath).map((entry) => basePath + entry).sort().map(__dbml_parse.Filepath.from);
1215
+ } catch {
1216
+ return [];
1238
1217
  }
1239
- for (const [overlayPath, content] of this.overlay) if (content === null) results.delete(overlayPath);
1240
- return [...results].sort().map(__dbml_parse.Filepath.from);
1241
1218
  }
1242
- getEntryPoints() {
1219
+ getEntrypoints() {
1243
1220
  return this.entryPoints.filter((fp) => this.exists(fp));
1244
1221
  }
1245
- clone() {
1246
- const copy = new NodeProjectLayout([...this.entryPoints]);
1247
- for (const [overlayPath, content] of this.overlay) copy.overlay.set(overlayPath, content);
1248
- return copy;
1249
- }
1250
1222
  };
1251
1223
  var config = {
1252
1224
  mysql: { name: "MySQL" },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@dbml/cli",
4
- "version": "8.0.0-alpha.1",
4
+ "version": "8.0.0-alpha.11",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "license": "Apache-2.0",
@@ -33,8 +33,8 @@
33
33
  "dependencies": {
34
34
  "@babel/cli": "^7.21.0",
35
35
  "@dbml/connector": "^8.0.0-alpha.0",
36
- "@dbml/core": "^8.0.0-alpha.0",
37
- "@dbml/parse": "^8.0.0-alpha.0",
36
+ "@dbml/core": "^8.0.0-alpha.11",
37
+ "@dbml/parse": "^8.0.0-alpha.11",
38
38
  "bluebird": "^3.5.5",
39
39
  "chalk": "^2.4.2",
40
40
  "commander": "^2.20.0",
@@ -45,7 +45,7 @@
45
45
  "strip-ansi": "^5.2.0",
46
46
  "winston": "^3.2.1"
47
47
  },
48
- "gitHead": "9c741ec1eb685be6f319c263a9a86628b241b2c4",
48
+ "gitHead": "976e0f27c85468fa8a0fbb2ded04862e86b05b89",
49
49
  "engines": {
50
50
  "node": ">=18"
51
51
  }
@@ -1,125 +1,61 @@
1
1
  import {
2
- existsSync, readFileSync, readdirSync, statSync,
2
+ readFileSync, readdirSync, statSync,
3
3
  } from 'node:fs';
4
4
  import {
5
5
  type DbmlProjectLayout, Filepath,
6
6
  } from '@dbml/parse';
7
7
 
8
8
  /**
9
- * A DbmlProjectLayout backed by the Node.js filesystem.
10
- * Reads source files on demand from disk; setSource/deleteSource maintain an
11
- * in-memory overlay (e.g. for unsaved edits) without touching the real FS.
9
+ * A read-only DbmlProjectLayout backed by the Node.js filesystem.
12
10
  */
13
11
  export class NodeProjectLayout implements DbmlProjectLayout {
14
- // Overlay is an overriding map of file absolute paths to file content
15
- // `null`: The file is deleted
16
- private overlay = new Map<string, string | null>();
17
12
  private entryPoints: Filepath[];
18
13
 
19
14
  constructor (entryPoints: Filepath[]) {
20
15
  this.entryPoints = [...entryPoints];
21
16
  }
22
17
 
23
- setSource (filePath: Filepath, content: string): void {
24
- this.overlay.set(filePath.absolute, content);
25
- }
26
-
27
18
  getSource (filePath: Filepath): string | undefined {
28
- const absolutePath = filePath.absolute;
29
-
30
- // If overlay already has the file,
31
- // return its content
32
- if (this.overlay.has(absolutePath)) {
33
- const value = this.overlay.get(absolutePath);
34
- return value ?? undefined; // null (deleted) -> undefined
35
- }
36
19
  try {
37
- return readFileSync(absolutePath, 'utf-8');
20
+ return readFileSync(filePath.absolute, 'utf-8');
38
21
  } catch {
39
22
  return undefined;
40
23
  }
41
24
  }
42
25
 
43
- deleteSource (filePath: Filepath): void {
44
- this.overlay.set(filePath.absolute, null);
45
- }
46
-
47
- clearSource (): void {
48
- this.overlay.clear();
49
- this.entryPoints = [];
50
- }
51
-
52
26
  exists (filePath: Filepath): boolean {
53
27
  return this.isFile(filePath) || this.isDirectory(filePath);
54
28
  }
55
29
 
56
30
  isFile (filePath: Filepath): boolean {
57
- const absolutePath = filePath.absolute;
58
-
59
- if (this.overlay.has(absolutePath)) return this.overlay.get(absolutePath) !== null;
60
-
61
31
  try {
62
- // `statSync` (not lstatSync) so symlinks resolve to their target, matching
63
- // how node reads the file on disk.
64
- return statSync(absolutePath).isFile();
32
+ return statSync(filePath.absolute).isFile();
65
33
  } catch {
66
34
  return false;
67
35
  }
68
36
  }
69
37
 
70
38
  isDirectory (filePath: Filepath): boolean {
71
- const absolutePath = filePath.absolute;
72
-
73
39
  try {
74
- // Exist in filesystem
75
- if (statSync(absolutePath).isDirectory()) return true;
40
+ return statSync(filePath.absolute).isDirectory();
76
41
  } catch {
77
- // fall through: the path may exist only in the overlay
78
- }
79
- for (const [overlayPath, content] of this.overlay) {
80
- if (content === null) continue;
81
- if (overlayPath.startsWith(absolutePath)) return true;
42
+ return false;
82
43
  }
83
- return false;
84
44
  }
85
45
 
86
46
  listDirectory (dirPath?: Filepath): Filepath[] {
87
47
  const basePath = dirPath?.absolute ?? '/';
88
- const results = new Set<string>();
89
-
90
48
  try {
91
- // Filesystem entries
92
- for (const entry of readdirSync(basePath)) {
93
- results.add(basePath + entry);
94
- }
49
+ return readdirSync(basePath)
50
+ .map((entry) => basePath + entry)
51
+ .sort()
52
+ .map(Filepath.from);
95
53
  } catch {
96
- // Not a readable directory - ignore
54
+ return [];
97
55
  }
98
-
99
- // Overlay additions: non-deleted files directly under base
100
- for (const [abs, content] of this.overlay) {
101
- if (content === null) continue;
102
- if (!abs.startsWith(basePath)) continue;
103
- if (!abs.slice(basePath.length).includes('/')) results.add(abs);
104
- }
105
-
106
- // Remove overlay-deleted paths
107
- for (const [overlayPath, content] of this.overlay) {
108
- if (content === null) results.delete(overlayPath);
109
- }
110
-
111
- return [...results].sort().map(Filepath.from);
112
56
  }
113
57
 
114
- getEntryPoints (): Filepath[] {
58
+ getEntrypoints (): Filepath[] {
115
59
  return this.entryPoints.filter((fp) => this.exists(fp));
116
60
  }
117
-
118
- clone (): NodeProjectLayout {
119
- const copy = new NodeProjectLayout([...this.entryPoints]);
120
- for (const [overlayPath, content] of this.overlay) {
121
- copy.overlay.set(overlayPath, content);
122
- }
123
- return copy;
124
- }
125
61
  }
@@ -37,6 +37,6 @@ export default async function connectionHandler (program: Command) {
37
37
  console.log(` ${chalk.green(figures.main.tick)} Generated DBML file from database's connection: ${path.basename(opts.outFile)}`);
38
38
  }
39
39
  } catch (error) {
40
- logger.error(error);
40
+ logger.error(error as Error | string);
41
41
  }
42
42
  }
@@ -20,9 +20,9 @@ const consoleFormat = printf((info) => {
20
20
 
21
21
  const fileFormat = printf((info) => {
22
22
  const {
23
- timestamp: ts, stack, rootError,
23
+ timestamp: ts, message, stack, rootError,
24
24
  } = info as any;
25
- let logContent = `${ts}\n${stack}\n`;
25
+ let logContent = `${ts}\n${stripAnsi(stack ?? message ?? '')}\n`;
26
26
  if (rootError) {
27
27
  logContent += '\nROOT_ERROR:';
28
28
  logContent += `\n${rootError.stack}`;
@@ -69,7 +69,7 @@ const logger = {
69
69
  consoleLogger.warn(msg);
70
70
  },
71
71
 
72
- error (msg: any) {
72
+ error (msg: Error | string) {
73
73
  consoleLogger.error(msg);
74
74
  fileLogger.error(msg);
75
75
  },