@dbml/cli 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/__test__/dbml2sql/filename --mysql --out-file/dbml-error.log +0 -36
  2. package/__test__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +1 -1
  3. package/__test__/dbml2sql/filename --oracle --out-file/expect-out-files/schema.sql +57 -0
  4. package/__test__/dbml2sql/filename --oracle --out-file/in-files/schema.dbml +71 -0
  5. package/__test__/dbml2sql/filename --oracle --out-file/options.json +8 -0
  6. package/__test__/dbml2sql/filename --oracle --out-file/stdout.txt +1 -0
  7. package/__test__/dbml2sql/filename --oracle stdout/in-files/schema.dbml +71 -0
  8. package/__test__/dbml2sql/filename --oracle stdout/options.json +6 -0
  9. package/__test__/dbml2sql/filename --oracle stdout/stdout.txt +58 -0
  10. package/__test__/dbml2sql/filename --out-file/dbml-error.log +0 -36
  11. package/__test__/dbml2sql/filename --out-file/out-files/schema.sql +1 -1
  12. package/__test__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -24
  13. package/__test__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +1 -1
  14. package/__test__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -24
  15. package/__test__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +1 -1
  16. package/__test__/dbml2sql/filenames --oracle --out-file/expect-out-files/schema.sql +168 -0
  17. package/__test__/dbml2sql/filenames --oracle --out-file/in-files/business.dbml +40 -0
  18. package/__test__/dbml2sql/filenames --oracle --out-file/in-files/customer.dbml +39 -0
  19. package/__test__/dbml2sql/filenames --oracle --out-file/in-files/inventory.dbml +61 -0
  20. package/__test__/dbml2sql/filenames --oracle --out-file/options.json +10 -0
  21. package/__test__/dbml2sql/filenames --oracle --out-file/stdout.txt +1 -0
  22. package/__test__/dbml2sql/filenames --oracle stdout/in-files/business.dbml +40 -0
  23. package/__test__/dbml2sql/filenames --oracle stdout/in-files/customer.dbml +39 -0
  24. package/__test__/dbml2sql/filenames --oracle stdout/in-files/inventory.dbml +61 -0
  25. package/__test__/dbml2sql/filenames --oracle stdout/options.json +8 -0
  26. package/__test__/dbml2sql/filenames --oracle stdout/stdout.txt +171 -0
  27. package/__test__/dbml2sql/filenames --out-file/dbml-error.log +0 -24
  28. package/__test__/dbml2sql/filenames --out-file/out-files/schema.sql +1 -1
  29. package/__test__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -24
  30. package/__test__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +1 -1
  31. package/__test__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -24
  32. package/__test__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +1 -1
  33. package/__test__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -24
  34. package/__test__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +1 -1
  35. package/__test__/dbml2sql/multiple_schema_oracle/expect-out-files/multiple_schema.out.sql +84 -0
  36. package/__test__/dbml2sql/multiple_schema_oracle/in-files/multiple_schema.in.dbml +45 -0
  37. package/__test__/dbml2sql/multiple_schema_oracle/options.json +8 -0
  38. package/__test__/dbml2sql/multiple_schema_oracle/stdout.txt +1 -0
  39. package/__test__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -24
  40. package/__test__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +1 -1
  41. package/__test__/dbml2sql/syntax-error/dbml-error.log +1074 -2143
  42. package/__test__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -51
  43. package/__test__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -24
  44. package/__test__/sql2dbml/filename --out-file/dbml-error.log +0 -24
  45. package/__test__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -24
  46. package/__test__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -239
  47. package/__test__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -218
  48. package/__test__/sql2dbml/filenames --out-file/dbml-error.log +0 -24
  49. package/__test__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -24
  50. package/__test__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -121
  51. package/__test__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -104
  52. package/__test__/sql2dbml/multiple_schema_pg/dbml-error.log +32 -163
  53. package/__test__/sql2dbml/syntax-error/dbml-error.log +1092 -2694
  54. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +1132 -1929
  55. package/__test__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +1127 -1924
  56. package/bin/dbml2sql.js +0 -0
  57. package/bin/sql2dbml.js +0 -0
  58. package/dbml-error.log +258 -322
  59. package/lib/cli/config.js +3 -0
  60. package/lib/cli/export.js +2 -1
  61. package/lib/cli/index.js +1 -1
  62. package/lib/cli/utils.js +1 -1
  63. package/package.json +3 -3
  64. package/src/cli/config.js +3 -0
  65. package/src/cli/export.js +7 -3
  66. package/src/cli/index.js +1 -0
  67. package/src/cli/utils.js +1 -1
  68. package/yarn-error.log +87 -0
  69. package/bin/dbml-error.log +0 -0
package/lib/cli/config.js CHANGED
@@ -19,6 +19,9 @@ var _default = {
19
19
  },
20
20
  mssql: {
21
21
  name: 'SQL Server'
22
+ },
23
+ oracle: {
24
+ name: 'Oracle'
22
25
  }
23
26
  };
24
27
  exports.default = _default;
package/lib/cli/export.js CHANGED
@@ -24,11 +24,12 @@ async function exportHandler(program) {
24
24
  if (!opts.outFile && !opts.outDir) {
25
25
  (0, _utils.generate)(inputPaths, dbml => _core.exporter.export(dbml, format), _outputConsolePlugin.default);
26
26
  } else if (opts.outFile) {
27
- const header = ['-- SQL dump generated using DBML (dbml-lang.org)\n', `-- Database: ${_config.default[format].name}\n`, `-- Generated at: ${new Date().toISOString()}\n\n`].join('');
27
+ const header = ['-- SQL dump generated using DBML (dbml.dbdiagram.io)\n', `-- Database: ${_config.default[format].name}\n`, `-- Generated at: ${new Date().toISOString()}\n\n`].join('');
28
28
  (0, _utils.generate)(inputPaths, dbml => _core.exporter.export(dbml, format), new _outputFilePlugin.default((0, _utils.resolvePaths)(opts.outFile), header));
29
29
  console.log(` ${_chalk.default.green(_figures.default.main.tick)} Generated SQL dump file (${_config.default[format].name}): ${_path.default.basename(opts.outFile)}`);
30
30
  }
31
31
  } catch (errors) {
32
+ // TODO: handle error in case errors object is not mappable
32
33
  _logger.default.error(`\n ${errors.map(({
33
34
  message
34
35
  }) => message).join('\n ')}`);
package/lib/cli/index.js CHANGED
@@ -12,7 +12,7 @@ var _package = _interopRequireDefault(require("../../package.json"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  function dbml2sql(args) {
14
14
  _commander.default.version(_package.default.version);
15
- _commander.default.usage('[options] <files...>').option('--mysql').option('--postgres').option('--mssql').option('-o, --out-file <pathspec>', 'compile all input files into a single files');
15
+ _commander.default.usage('[options] <files...>').option('--mysql').option('--postgres').option('--mssql').option('--oracle').option('-o, --out-file <pathspec>', 'compile all input files into a single files');
16
16
  // .option('-d, --out-dir <pathspec>', 'compile an input directory of dbml files into an output directory');
17
17
 
18
18
  _commander.default.parse(args);
package/lib/cli/utils.js CHANGED
@@ -22,7 +22,7 @@ function validateInputFilePaths(paths, validatePlugin) {
22
22
  }
23
23
  function getFormatOpt(opts) {
24
24
  const formatOpts = Object.keys(opts).filter(opt => {
25
- return ['postgres', 'mysql', 'mssql', 'postgresLegacy', 'mysqlLegacy'].includes(opt);
25
+ return ['postgres', 'mysql', 'mssql', 'postgresLegacy', 'mysqlLegacy', 'oracle'].includes(opt);
26
26
  });
27
27
  let format = 'postgres';
28
28
  let cnt = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/cli",
3
- "version": "3.2.0",
3
+ "version": "3.4.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "license": "Apache-2.0",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@babel/cli": "^7.21.0",
28
- "@dbml/core": "^3.2.0",
28
+ "@dbml/core": "^3.4.0",
29
29
  "bluebird": "^3.5.5",
30
30
  "chalk": "^2.4.2",
31
31
  "commander": "^2.20.0",
@@ -53,5 +53,5 @@
53
53
  "^.+\\.js$": "babel-jest"
54
54
  }
55
55
  },
56
- "gitHead": "772cb1cd617af9b024f964517231f61f0dcfd902"
56
+ "gitHead": "d46067f19bf80a245c77576106dac68bec5cbe5a"
57
57
  }
package/src/cli/config.js CHANGED
@@ -14,4 +14,7 @@ export default {
14
14
  mssql: {
15
15
  name: 'SQL Server',
16
16
  },
17
+ oracle: {
18
+ name: 'Oracle',
19
+ },
17
20
  };
package/src/cli/export.js CHANGED
@@ -26,17 +26,21 @@ export default async function exportHandler (program) {
26
26
  generate(inputPaths, (dbml) => exporter.export(dbml, format), OutputConsolePlugin);
27
27
  } else if (opts.outFile) {
28
28
  const header = [
29
- '-- SQL dump generated using DBML (dbml-lang.org)\n',
29
+ '-- SQL dump generated using DBML (dbml.dbdiagram.io)\n',
30
30
  `-- Database: ${config[format].name}\n`,
31
31
  `-- Generated at: ${new Date().toISOString()}\n\n`,
32
32
  ].join('');
33
33
 
34
- generate(inputPaths, (dbml) => exporter.export(dbml, format),
35
- new OutputFilePlugin(resolvePaths(opts.outFile), header));
34
+ generate(
35
+ inputPaths,
36
+ (dbml) => exporter.export(dbml, format),
37
+ new OutputFilePlugin(resolvePaths(opts.outFile), header)
38
+ );
36
39
 
37
40
  console.log(` ${chalk.green(figures.main.tick)} Generated SQL dump file (${config[format].name}): ${path.basename(opts.outFile)}`);
38
41
  }
39
42
  } catch (errors) {
43
+ // TODO: handle error in case errors object is not mappable
40
44
  logger.error(`\n ${errors.map(({ message }) => message).join('\n ')}`);
41
45
  }
42
46
  }
package/src/cli/index.js CHANGED
@@ -11,6 +11,7 @@ function dbml2sql (args) {
11
11
  .option('--mysql')
12
12
  .option('--postgres')
13
13
  .option('--mssql')
14
+ .option('--oracle')
14
15
  .option('-o, --out-file <pathspec>', 'compile all input files into a single files');
15
16
  // .option('-d, --out-dir <pathspec>', 'compile an input directory of dbml files into an output directory');
16
17
 
package/src/cli/utils.js CHANGED
@@ -15,7 +15,7 @@ function validateInputFilePaths (paths, validatePlugin) {
15
15
 
16
16
  function getFormatOpt (opts) {
17
17
  const formatOpts = Object.keys(opts).filter((opt) => {
18
- return ['postgres', 'mysql', 'mssql', 'postgresLegacy', 'mysqlLegacy'].includes(opt);
18
+ return ['postgres', 'mysql', 'mssql', 'postgresLegacy', 'mysqlLegacy', 'oracle'].includes(opt);
19
19
  });
20
20
 
21
21
  let format = 'postgres';
package/yarn-error.log ADDED
@@ -0,0 +1,87 @@
1
+ Arguments:
2
+ /usr/local/bin/node /usr/local/bin/yarn install
3
+
4
+ PATH:
5
+ /opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/postgresql@13/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/postgresql@13/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/nguyenhoang/.cargo/bin
6
+
7
+ Yarn version:
8
+ 1.22.18
9
+
10
+ Node version:
11
+ 16.18.0
12
+
13
+ Platform:
14
+ darwin arm64
15
+
16
+ Trace:
17
+ SyntaxError: /Users/nguyenhoang/Documents/workspace/dbx/dbml/package.json: Unexpected token } in JSON at position 130
18
+ at JSON.parse (<anonymous>)
19
+ at /usr/local/lib/node_modules/yarn/lib/cli.js:1625:59
20
+ at Generator.next (<anonymous>)
21
+ at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)
22
+ at /usr/local/lib/node_modules/yarn/lib/cli.js:321:13
23
+
24
+ npm manifest:
25
+ {
26
+ "name": "@dbml/cli",
27
+ "version": "2.5.3",
28
+ "description": "",
29
+ "main": "lib/index.js",
30
+ "license": "Apache-2.0",
31
+ "scripts": {
32
+ "test": "jest",
33
+ "build": "babel src --out-dir lib --copy-files",
34
+ "prepublish": "npm run build"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "bin": {
40
+ "dbml2sql": "bin/dbml2sql.js",
41
+ "sql2dbml": "bin/sql2dbml.js"
42
+ },
43
+ "author": "Holistics <dev@holistics.io>",
44
+ "homepage": "https://dbml.dbdiagram.io",
45
+ "repository": "https://github.com/holistics/dbml/tree/master/packages/dbml-cli",
46
+ "keywords": [
47
+ "dbml",
48
+ "dbml-cli"
49
+ ],
50
+ "dependencies": {
51
+ "@babel/cli": "^7.21.0",
52
+ "@dbml/core": "^2.5.3",
53
+ "bluebird": "^3.5.5",
54
+ "chalk": "^2.4.2",
55
+ "commander": "^2.20.0",
56
+ "esm": "^3.2.25",
57
+ "figures": "^3.2.0",
58
+ "lodash": "^4.17.15",
59
+ "pegjs-require-import": "^0.0.2",
60
+ "strip-ansi": "^5.2.0",
61
+ "winston": "^3.2.1"
62
+ },
63
+ "devDependencies": {
64
+ "@babel/core": "^7.21.4",
65
+ "@babel/node": "^7.20.7",
66
+ "@babel/plugin-transform-runtime": "^7.21.4",
67
+ "@babel/preset-env": "^7.21.4",
68
+ "@babel/runtime": "^7.21.0",
69
+ "babel-jest": "^29.5.0",
70
+ "jest": "^29.5.0"
71
+ },
72
+ "jest": {
73
+ "setupFiles": [
74
+ "./jestHelpers.js"
75
+ ],
76
+ "transform": {
77
+ "^.+\\.js$": "babel-jest"
78
+ }
79
+ },
80
+ "gitHead": "5cb80e1aa38fb9a4dbe3079e39c9ef93cd4dc556"
81
+ }
82
+
83
+ yarn manifest:
84
+ No manifest
85
+
86
+ Lockfile:
87
+ No lockfile
File without changes