@dbml/cli 10.4.0-alpha.1 → 10.4.0-alpha.10
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/__tests__/dbml2sql/multifile --postgres stdout/in-files/main.dbml +2 -0
- package/__tests__/dbml2sql/multifile --postgres stdout/in-files/sub/orders.dbml +6 -0
- package/__tests__/dbml2sql/multifile --postgres stdout/in-files/types.dbml +4 -0
- package/__tests__/dbml2sql/multifile --postgres stdout/options.json +6 -0
- package/__tests__/dbml2sql/multifile --postgres stdout/stdout.txt +12 -0
- package/__tests__/dbml2sql/multifile error entry-syntax-error/dbml-error.log +1 -21
- package/__tests__/dbml2sql/multifile error import-not-found/dbml-error.log +441 -5137
- package/__tests__/dbml2sql/multifile error imported-syntax-error/dbml-error.log +1 -21
- package/__tests__/dbml2sql/multifile error transitive-use-not-visible/dbml-error.log +1 -17
- package/__tests__/windows/multifile-backslash/in-files/main.dbml +2 -0
- package/__tests__/windows/multifile-backslash/in-files/sub/orders.dbml +6 -0
- package/__tests__/windows/multifile-backslash/in-files/types.dbml +4 -0
- package/__tests__/windows/multifile-backslash/options.json +6 -0
- package/__tests__/windows/multifile-backslash/stdout.txt +12 -0
- package/__tests__/windows/multifile-relative/in-files/main.dbml +2 -0
- package/__tests__/windows/multifile-relative/in-files/sub/orders.dbml +6 -0
- package/__tests__/windows/multifile-relative/in-files/types.dbml +4 -0
- package/__tests__/windows/multifile-relative/options.json +6 -0
- package/__tests__/windows/multifile-relative/stdout.txt +12 -0
- package/__tests__/windows.test.ts +34 -0
- package/lib/index.js +93 -32
- package/package.json +6 -6
- package/src/NodeProjectLayout.ts +9 -1
- package/src/cli/import.ts +4 -5
- package/src/cli/utils.ts +4 -3
- package/__tests__/db2dbml/mssql/dbml-error.log +0 -55
- package/__tests__/db2dbml/mysql/dbml-error.log +0 -15
- package/__tests__/db2dbml/oracle/dbml-error.log +0 -70
- package/__tests__/db2dbml/postgres/dbml-error.log +0 -35
- package/__tests__/dbml2sql/filename --mysql --out-file/out-files/schema.sql +0 -65
- package/__tests__/dbml2sql/filename --oracle --out-file/out-files/schema.sql +0 -61
- package/__tests__/dbml2sql/filename --oracle stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --out-file/out-files/schema.sql +0 -77
- package/__tests__/dbml2sql/filename --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename --postgres --out-file/out-files/schema.sql +0 -77
- package/__tests__/dbml2sql/filename --postgres stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filename stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --mysql --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --mysql --out-file/out-files/schema.sql +0 -172
- package/__tests__/dbml2sql/filenames --mysql stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --oracle --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --oracle --out-file/out-files/schema.sql +0 -172
- package/__tests__/dbml2sql/filenames --oracle stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --out-file/out-files/schema.sql +0 -172
- package/__tests__/dbml2sql/filenames --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames --postgres --out-file/out-files/schema.sql +0 -172
- package/__tests__/dbml2sql/filenames --postgres stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/filenames stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_mssql/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_mssql/out-files/multiple_schema.out.sql +0 -62
- package/__tests__/dbml2sql/multiple_schema_mysql/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_mysql/out-files/multiple_schema.out.sql +0 -50
- package/__tests__/dbml2sql/multiple_schema_oracle/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_oracle/out-files/multiple_schema.out.sql +0 -88
- package/__tests__/dbml2sql/multiple_schema_pg/dbml-error.log +0 -0
- package/__tests__/dbml2sql/multiple_schema_pg/out-files/multiple_schema.out.sql +0 -67
- package/__tests__/dbml2sql/single file stdout/dbml-error.log +0 -0
- package/__tests__/dbml2sql/syntax-error/dbml-error.log +0 -25
- package/__tests__/sql2dbml/custom-error-alter-table-column-not-found --oracle/dbml-error.log +0 -20
- package/__tests__/sql2dbml/custom-error-alter-table-table-not-found --oracle/dbml-error.log +0 -20
- package/__tests__/sql2dbml/custom-error-column-comment-column-not-found --oracle/dbml-error.log +0 -20
- package/__tests__/sql2dbml/custom-error-column-comment-table-not-found --oracle/dbml-error.log +0 -20
- package/__tests__/sql2dbml/custom-error-create-index-table-not-found --oracle/dbml-error.log +0 -20
- package/__tests__/sql2dbml/custom-error-table-comment-table-not-found --oracle/dbml-error.log +0 -20
- package/__tests__/sql2dbml/filename --mssql --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --mssql --out-file/out-files/schema.dbml +0 -25
- package/__tests__/sql2dbml/filename --mysql --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --mysql --out-file/out-files/schema.dbml +0 -74
- package/__tests__/sql2dbml/filename --mysql stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --oracle --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --oracle --out-file/out-files/schema.dbml +0 -83
- package/__tests__/sql2dbml/filename --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --out-file/out-files/schema.dbml +0 -74
- package/__tests__/sql2dbml/filename --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --postgres --out-file/out-files/schema.dbml +0 -74
- package/__tests__/sql2dbml/filename --postgres stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename --snowflake stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filename stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --mysql --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --mysql --out-file/out-files/schema.dbml +0 -170
- package/__tests__/sql2dbml/filenames --mysql stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --out-file/out-files/schema.dbml +0 -170
- package/__tests__/sql2dbml/filenames --postgres --out-file/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames --postgres --out-file/out-files/schema.dbml +0 -170
- package/__tests__/sql2dbml/filenames --postgres stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/filenames stdout/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_mssql/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_mssql/out-files/multiple_schema.out.dbml +0 -58
- package/__tests__/sql2dbml/multiple_schema_mysql/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_mysql/out-files/multiple_schema.out.dbml +0 -136
- package/__tests__/sql2dbml/multiple_schema_pg/dbml-error.log +0 -0
- package/__tests__/sql2dbml/multiple_schema_pg/out-files/multiple_schema.out.dbml +0 -101
- package/__tests__/sql2dbml/syntax-error/dbml-error.log +0 -20
- package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mssql/dbml-error.log +0 -20
- package/__tests__/sql2dbml/syntax-error-duplicate-endpoints --mysql/dbml-error.log +0 -20
- /package/__tests__/dbml2sql/{filename --mysql --out-file → multifile --postgres stdout}/dbml-error.log +0 -0
- /package/__tests__/{dbml2sql/filename --mysql stdout → windows/multifile-relative}/dbml-error.log +0 -0
- /package/{__tests__/dbml2sql/filename --oracle --out-file/dbml-error.log → dbml-error.log} +0 -0
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
2026-
|
|
2
|
-
|
|
3
|
-
./in-files/broken.dbml(4,1): Expect an identifier
|
|
4
|
-
./in-files/broken.dbml(2,11): Unknown column setting 'pk name varchar'
|
|
5
|
-
|
|
6
|
-
2026-06-15T10:58:51.926Z
|
|
7
|
-
|
|
8
|
-
./in-files/broken.dbml(4,1): Expect an identifier
|
|
9
|
-
./in-files/broken.dbml(2,11): Unknown column setting 'pk name varchar'
|
|
10
|
-
|
|
11
|
-
2026-07-22T11:03:37.719Z
|
|
12
|
-
|
|
13
|
-
./in-files/broken.dbml(4,1): Expect an identifier
|
|
14
|
-
./in-files/broken.dbml(2,11): Custom setting 'pk name varchar' must be a string or a color literal
|
|
15
|
-
|
|
16
|
-
2026-07-22T11:07:10.314Z
|
|
17
|
-
|
|
18
|
-
./in-files/broken.dbml(4,1): Expect an identifier
|
|
19
|
-
./in-files/broken.dbml(2,11): Custom setting 'pk name varchar' must be a string or a color literal
|
|
20
|
-
|
|
21
|
-
2026-07-22T11:09:52.085Z
|
|
1
|
+
2026-10-14T03:11:09.431Z
|
|
22
2
|
|
|
23
3
|
./in-files/broken.dbml(4,1): Expect an identifier
|
|
24
4
|
./in-files/broken.dbml(2,11): Custom setting 'pk name varchar' must be a string or a color literal
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
2026-
|
|
2
|
-
|
|
3
|
-
./in-files/main.dbml(3,17): Table 'products' does not exist in Schema 'public'
|
|
4
|
-
|
|
5
|
-
2026-06-15T10:58:52.521Z
|
|
6
|
-
|
|
7
|
-
./in-files/main.dbml(3,17): Table 'products' does not exist in Schema 'public'
|
|
8
|
-
|
|
9
|
-
2026-07-22T11:03:38.305Z
|
|
10
|
-
|
|
11
|
-
./in-files/main.dbml(3,17): Table 'products' does not exist in Schema 'public'
|
|
12
|
-
|
|
13
|
-
2026-07-22T11:07:10.911Z
|
|
14
|
-
|
|
15
|
-
./in-files/main.dbml(3,17): Table 'products' does not exist in Schema 'public'
|
|
16
|
-
|
|
17
|
-
2026-07-22T11:09:52.678Z
|
|
1
|
+
2026-10-14T03:11:10.655Z
|
|
18
2
|
|
|
19
3
|
./in-files/main.dbml(3,17): Table 'products' does not exist in Schema 'public'
|
|
20
4
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CREATE TABLE "users" (
|
|
2
|
+
"id" int PRIMARY KEY,
|
|
3
|
+
"name" varchar
|
|
4
|
+
);
|
|
5
|
+
|
|
6
|
+
CREATE TABLE "orders" (
|
|
7
|
+
"id" int PRIMARY KEY,
|
|
8
|
+
"user_id" int
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
ALTER TABLE "orders" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id") DEFERRABLE INITIALLY IMMEDIATE;
|
|
12
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CREATE TABLE "users" (
|
|
2
|
+
"id" int PRIMARY KEY,
|
|
3
|
+
"name" varchar
|
|
4
|
+
);
|
|
5
|
+
|
|
6
|
+
CREATE TABLE "orders" (
|
|
7
|
+
"id" int PRIMARY KEY,
|
|
8
|
+
"user_id" int
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
ALTER TABLE "orders" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id") DEFERRABLE INITIALLY IMMEDIATE;
|
|
12
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import childProcess from 'child_process';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import util from 'util';
|
|
5
|
+
import stripAnsi from 'strip-ansi';
|
|
6
|
+
import {
|
|
7
|
+
scanDirNames,
|
|
8
|
+
} from './testHelpers';
|
|
9
|
+
|
|
10
|
+
const exec = util.promisify(childProcess.exec);
|
|
11
|
+
|
|
12
|
+
// Only run on Windows - skipped on other platforms
|
|
13
|
+
const describeOnWindows = process.platform === 'win32' ? describe : describe.skip;
|
|
14
|
+
|
|
15
|
+
describeOnWindows('@dbml/cli - Windows paths', () => {
|
|
16
|
+
const runTest = async (dirName: string) => {
|
|
17
|
+
process.chdir(dirName);
|
|
18
|
+
const binFile = path.join(__dirname, '../bin/dbml2sql.js');
|
|
19
|
+
const optsRaw = fs.readFileSync(path.join(dirName, './options.json'), 'utf-8');
|
|
20
|
+
const opts = JSON.parse(optsRaw);
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
stdout,
|
|
24
|
+
} = await exec(`node "${binFile}" ${opts.args.join(' ')}`);
|
|
25
|
+
const expectStdout = fs.readFileSync(path.join(dirName, './stdout.txt'), 'utf-8').replaceAll('\r\n', '\n');
|
|
26
|
+
const actualStdout = stripAnsi(stdout).replaceAll('\r\n', '\n');
|
|
27
|
+
|
|
28
|
+
expect(actualStdout).toBe(expectStdout);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
test.each(scanDirNames(__dirname, 'windows'))('windows/%s', async (dirName) => {
|
|
32
|
+
await runTest(path.join(__dirname, 'windows', dirName));
|
|
33
|
+
}, 100000);
|
|
34
|
+
});
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
@@ -39,7 +39,7 @@ let node_fs = require("node:fs");
|
|
|
39
39
|
var package_default = {
|
|
40
40
|
$schema: "https://json.schemastore.org/package",
|
|
41
41
|
name: "@dbml/cli",
|
|
42
|
-
version: "10.4.0-alpha.
|
|
42
|
+
version: "10.4.0-alpha.10",
|
|
43
43
|
description: "",
|
|
44
44
|
main: "lib/index.js",
|
|
45
45
|
license: "Apache-2.0",
|
|
@@ -47,7 +47,7 @@ var package_default = {
|
|
|
47
47
|
"test": "vitest run",
|
|
48
48
|
"test:watch": "vitest watch",
|
|
49
49
|
"coverage": "vitest --coverage",
|
|
50
|
-
"build": "
|
|
50
|
+
"build": "rimraf ./lib && tsc --noEmit && vite build",
|
|
51
51
|
"dev": "vite build --watch",
|
|
52
52
|
"prepublish": "npm run build",
|
|
53
53
|
"lint": "eslint $(git diff --relative --name-only --diff-filter=ACMRTUXB master -- . | grep -E '\\.(js|ts)$')",
|
|
@@ -66,9 +66,9 @@ var package_default = {
|
|
|
66
66
|
keywords: ["dbml", "dbml-cli"],
|
|
67
67
|
dependencies: {
|
|
68
68
|
"@babel/cli": "^7.21.0",
|
|
69
|
-
"@dbml/connector": "^10.4.0-alpha.
|
|
70
|
-
"@dbml/core": "^10.4.0-alpha.
|
|
71
|
-
"@dbml/parse": "^10.4.0-alpha.
|
|
69
|
+
"@dbml/connector": "^10.4.0-alpha.10",
|
|
70
|
+
"@dbml/core": "^10.4.0-alpha.10",
|
|
71
|
+
"@dbml/parse": "^10.4.0-alpha.10",
|
|
72
72
|
"bluebird": "^3.5.5",
|
|
73
73
|
"chalk": "^2.4.2",
|
|
74
74
|
"commander": "^2.20.0",
|
|
@@ -79,7 +79,7 @@ var package_default = {
|
|
|
79
79
|
"strip-ansi": "^5.2.0",
|
|
80
80
|
"winston": "^3.2.1"
|
|
81
81
|
},
|
|
82
|
-
gitHead: "
|
|
82
|
+
gitHead: "803873f5165a628d3f9050b9dff0173adab072b2",
|
|
83
83
|
engines: { "node": ">=18" }
|
|
84
84
|
};
|
|
85
85
|
//#endregion
|
|
@@ -181,8 +181,10 @@ function getRawTag(value) {
|
|
|
181
181
|
var unmasked = true;
|
|
182
182
|
} catch (e) {}
|
|
183
183
|
var result = nativeObjectToString$1.call(value);
|
|
184
|
-
if (unmasked)
|
|
185
|
-
|
|
184
|
+
if (unmasked) {
|
|
185
|
+
if (isOwn) value[symToStringTag$1] = tag;
|
|
186
|
+
else delete value[symToStringTag$1];
|
|
187
|
+
}
|
|
186
188
|
return result;
|
|
187
189
|
}
|
|
188
190
|
//#endregion
|
|
@@ -206,7 +208,8 @@ function objectToString(value) {
|
|
|
206
208
|
//#endregion
|
|
207
209
|
//#region ../../node_modules/lodash-es/_baseGetTag.js
|
|
208
210
|
/** `Object#toString` result references. */
|
|
209
|
-
var nullTag = "[object Null]"
|
|
211
|
+
var nullTag = "[object Null]";
|
|
212
|
+
var undefinedTag = "[object Undefined]";
|
|
210
213
|
/** Built-in value references. */
|
|
211
214
|
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
212
215
|
/**
|
|
@@ -318,9 +321,10 @@ var isArray = Array.isArray;
|
|
|
318
321
|
//#endregion
|
|
319
322
|
//#region ../../node_modules/lodash-es/_baseToString.js
|
|
320
323
|
/** Used as references for various `Number` constants. */
|
|
321
|
-
var INFINITY$1 =
|
|
324
|
+
var INFINITY$1 = 1 / 0;
|
|
322
325
|
/** Used to convert symbols to primitives and strings. */
|
|
323
|
-
var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0
|
|
326
|
+
var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
|
|
327
|
+
var symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
|
|
324
328
|
/**
|
|
325
329
|
* The base implementation of `_.toString` which doesn't convert nullish
|
|
326
330
|
* values to empty strings.
|
|
@@ -391,7 +395,10 @@ function identity(value) {
|
|
|
391
395
|
//#endregion
|
|
392
396
|
//#region ../../node_modules/lodash-es/isFunction.js
|
|
393
397
|
/** `Object#toString` result references. */
|
|
394
|
-
var asyncTag = "[object AsyncFunction]"
|
|
398
|
+
var asyncTag = "[object AsyncFunction]";
|
|
399
|
+
var funcTag$1 = "[object Function]";
|
|
400
|
+
var genTag = "[object GeneratorFunction]";
|
|
401
|
+
var proxyTag = "[object Proxy]";
|
|
395
402
|
/**
|
|
396
403
|
* Checks if `value` is classified as a `Function` object.
|
|
397
404
|
*
|
|
@@ -467,7 +474,8 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
|
467
474
|
/** Used to detect host constructors (Safari). */
|
|
468
475
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
469
476
|
/** Used for built-in method references. */
|
|
470
|
-
var funcProto = Function.prototype
|
|
477
|
+
var funcProto = Function.prototype;
|
|
478
|
+
var objectProto$2 = Object.prototype;
|
|
471
479
|
/** Used to resolve the decompiled source of functions. */
|
|
472
480
|
var funcToString = funcProto.toString;
|
|
473
481
|
/** Used to check objects for own properties. */
|
|
@@ -758,8 +766,30 @@ var isBuffer = (Buffer$1 ? Buffer$1.isBuffer : void 0) || stubFalse;
|
|
|
758
766
|
//#endregion
|
|
759
767
|
//#region ../../node_modules/lodash-es/_baseIsTypedArray.js
|
|
760
768
|
/** `Object#toString` result references. */
|
|
761
|
-
var argsTag$1 = "[object Arguments]"
|
|
762
|
-
var
|
|
769
|
+
var argsTag$1 = "[object Arguments]";
|
|
770
|
+
var arrayTag$1 = "[object Array]";
|
|
771
|
+
var boolTag$1 = "[object Boolean]";
|
|
772
|
+
var dateTag$1 = "[object Date]";
|
|
773
|
+
var errorTag$1 = "[object Error]";
|
|
774
|
+
var funcTag = "[object Function]";
|
|
775
|
+
var mapTag$3 = "[object Map]";
|
|
776
|
+
var numberTag$1 = "[object Number]";
|
|
777
|
+
var objectTag$2 = "[object Object]";
|
|
778
|
+
var regexpTag$1 = "[object RegExp]";
|
|
779
|
+
var setTag$3 = "[object Set]";
|
|
780
|
+
var stringTag$1 = "[object String]";
|
|
781
|
+
var weakMapTag$1 = "[object WeakMap]";
|
|
782
|
+
var arrayBufferTag$1 = "[object ArrayBuffer]";
|
|
783
|
+
var dataViewTag$2 = "[object DataView]";
|
|
784
|
+
var float32Tag = "[object Float32Array]";
|
|
785
|
+
var float64Tag = "[object Float64Array]";
|
|
786
|
+
var int8Tag = "[object Int8Array]";
|
|
787
|
+
var int16Tag = "[object Int16Array]";
|
|
788
|
+
var int32Tag = "[object Int32Array]";
|
|
789
|
+
var uint8Tag = "[object Uint8Array]";
|
|
790
|
+
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
|
791
|
+
var uint16Tag = "[object Uint16Array]";
|
|
792
|
+
var uint32Tag = "[object Uint32Array]";
|
|
763
793
|
/** Used to identify `toStringTag` values of typed arrays. */
|
|
764
794
|
var typedArrayTags = {};
|
|
765
795
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
@@ -913,7 +943,8 @@ function keys(object) {
|
|
|
913
943
|
//#endregion
|
|
914
944
|
//#region ../../node_modules/lodash-es/_isKey.js
|
|
915
945
|
/** Used to match property names within property paths. */
|
|
916
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]
|
|
946
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
947
|
+
var reIsPlainProp = /^\w*$/;
|
|
917
948
|
/**
|
|
918
949
|
* Checks if `value` is a property name and not a property path.
|
|
919
950
|
*
|
|
@@ -1439,7 +1470,7 @@ function castPath(value, object) {
|
|
|
1439
1470
|
//#endregion
|
|
1440
1471
|
//#region ../../node_modules/lodash-es/_toKey.js
|
|
1441
1472
|
/** Used as references for various `Number` constants. */
|
|
1442
|
-
var INFINITY =
|
|
1473
|
+
var INFINITY = 1 / 0;
|
|
1443
1474
|
/**
|
|
1444
1475
|
* Converts `value` to a string key if it's not a string or symbol.
|
|
1445
1476
|
*
|
|
@@ -1740,10 +1771,18 @@ var Set = getNative(root, "Set");
|
|
|
1740
1771
|
//#endregion
|
|
1741
1772
|
//#region ../../node_modules/lodash-es/_getTag.js
|
|
1742
1773
|
/** `Object#toString` result references. */
|
|
1743
|
-
var mapTag$2 = "[object Map]"
|
|
1774
|
+
var mapTag$2 = "[object Map]";
|
|
1775
|
+
var objectTag$1 = "[object Object]";
|
|
1776
|
+
var promiseTag = "[object Promise]";
|
|
1777
|
+
var setTag$2 = "[object Set]";
|
|
1778
|
+
var weakMapTag = "[object WeakMap]";
|
|
1744
1779
|
var dataViewTag$1 = "[object DataView]";
|
|
1745
1780
|
/** Used to detect maps, sets, and weakmaps. */
|
|
1746
|
-
var dataViewCtorString = toSource(DataView)
|
|
1781
|
+
var dataViewCtorString = toSource(DataView);
|
|
1782
|
+
var mapCtorString = toSource(Map);
|
|
1783
|
+
var promiseCtorString = toSource(Promise$1);
|
|
1784
|
+
var setCtorString = toSource(Set);
|
|
1785
|
+
var weakMapCtorString = toSource(WeakMap);
|
|
1747
1786
|
/**
|
|
1748
1787
|
* Gets the `toStringTag` of `value`.
|
|
1749
1788
|
*
|
|
@@ -1850,7 +1889,8 @@ function cacheHas(cache, key) {
|
|
|
1850
1889
|
//#endregion
|
|
1851
1890
|
//#region ../../node_modules/lodash-es/_equalArrays.js
|
|
1852
1891
|
/** Used to compose bitmasks for value comparisons. */
|
|
1853
|
-
var COMPARE_PARTIAL_FLAG$5 = 1
|
|
1892
|
+
var COMPARE_PARTIAL_FLAG$5 = 1;
|
|
1893
|
+
var COMPARE_UNORDERED_FLAG$3 = 2;
|
|
1854
1894
|
/**
|
|
1855
1895
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
1856
1896
|
* partial deep comparisons.
|
|
@@ -1932,12 +1972,23 @@ function setToArray(set) {
|
|
|
1932
1972
|
//#endregion
|
|
1933
1973
|
//#region ../../node_modules/lodash-es/_equalByTag.js
|
|
1934
1974
|
/** Used to compose bitmasks for value comparisons. */
|
|
1935
|
-
var COMPARE_PARTIAL_FLAG$4 = 1
|
|
1975
|
+
var COMPARE_PARTIAL_FLAG$4 = 1;
|
|
1976
|
+
var COMPARE_UNORDERED_FLAG$2 = 2;
|
|
1936
1977
|
/** `Object#toString` result references. */
|
|
1937
|
-
var boolTag = "[object Boolean]"
|
|
1938
|
-
var
|
|
1978
|
+
var boolTag = "[object Boolean]";
|
|
1979
|
+
var dateTag = "[object Date]";
|
|
1980
|
+
var errorTag = "[object Error]";
|
|
1981
|
+
var mapTag$1 = "[object Map]";
|
|
1982
|
+
var numberTag = "[object Number]";
|
|
1983
|
+
var regexpTag = "[object RegExp]";
|
|
1984
|
+
var setTag$1 = "[object Set]";
|
|
1985
|
+
var stringTag = "[object String]";
|
|
1986
|
+
var symbolTag = "[object Symbol]";
|
|
1987
|
+
var arrayBufferTag = "[object ArrayBuffer]";
|
|
1988
|
+
var dataViewTag = "[object DataView]";
|
|
1939
1989
|
/** Used to convert symbols to primitives and strings. */
|
|
1940
|
-
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0
|
|
1990
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
|
|
1991
|
+
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
1941
1992
|
/**
|
|
1942
1993
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
1943
1994
|
* the same `toStringTag`.
|
|
@@ -2043,7 +2094,9 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
2043
2094
|
/** Used to compose bitmasks for value comparisons. */
|
|
2044
2095
|
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
2045
2096
|
/** `Object#toString` result references. */
|
|
2046
|
-
var argsTag = "[object Arguments]"
|
|
2097
|
+
var argsTag = "[object Arguments]";
|
|
2098
|
+
var arrayTag = "[object Array]";
|
|
2099
|
+
var objectTag = "[object Object]";
|
|
2047
2100
|
/** Used to check objects for own properties. */
|
|
2048
2101
|
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
2049
2102
|
/**
|
|
@@ -2110,7 +2163,8 @@ function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
|
2110
2163
|
//#endregion
|
|
2111
2164
|
//#region ../../node_modules/lodash-es/_baseIsMatch.js
|
|
2112
2165
|
/** Used to compose bitmasks for value comparisons. */
|
|
2113
|
-
var COMPARE_PARTIAL_FLAG$1 = 1
|
|
2166
|
+
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
2167
|
+
var COMPARE_UNORDERED_FLAG$1 = 2;
|
|
2114
2168
|
/**
|
|
2115
2169
|
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
2116
2170
|
*
|
|
@@ -2279,7 +2333,8 @@ function hasIn(object, path) {
|
|
|
2279
2333
|
//#endregion
|
|
2280
2334
|
//#region ../../node_modules/lodash-es/_baseMatchesProperty.js
|
|
2281
2335
|
/** Used to compose bitmasks for value comparisons. */
|
|
2282
|
-
var COMPARE_PARTIAL_FLAG = 1
|
|
2336
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
2337
|
+
var COMPARE_UNORDERED_FLAG = 2;
|
|
2283
2338
|
/**
|
|
2284
2339
|
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
2285
2340
|
*
|
|
@@ -2444,7 +2499,8 @@ var baseEach = createBaseEach(baseForOwn);
|
|
|
2444
2499
|
//#endregion
|
|
2445
2500
|
//#region ../../node_modules/lodash-es/isEmpty.js
|
|
2446
2501
|
/** `Object#toString` result references. */
|
|
2447
|
-
var mapTag = "[object Map]"
|
|
2502
|
+
var mapTag = "[object Map]";
|
|
2503
|
+
var setTag = "[object Set]";
|
|
2448
2504
|
/** Used to check objects for own properties. */
|
|
2449
2505
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2450
2506
|
/**
|
|
@@ -2612,7 +2668,7 @@ function generate(inputPaths, transform, outputPlugin) {
|
|
|
2612
2668
|
const content = transform(source);
|
|
2613
2669
|
outputPlugin.write(content);
|
|
2614
2670
|
} catch (e) {
|
|
2615
|
-
if (e instanceof _dbml_core.
|
|
2671
|
+
if (e instanceof _dbml_core.CompilerDiagnostics) throw e.map((diag) => ({
|
|
2616
2672
|
...diag,
|
|
2617
2673
|
message: diag.message,
|
|
2618
2674
|
filepath: path.default.basename(_path),
|
|
@@ -2656,6 +2712,11 @@ var NodeProjectLayout = class {
|
|
|
2656
2712
|
const resolved = _dbml_parse.Filepath.resolve(currentFilepath.dirname, relativePath);
|
|
2657
2713
|
return resolved.absolute.endsWith(".dbml") ? resolved : _dbml_parse.Filepath.from(resolved.absolute + ".dbml");
|
|
2658
2714
|
}
|
|
2715
|
+
getFileSpecifierInfo(currentFilepath, targetFilepath) {
|
|
2716
|
+
let specifier = targetFilepath.relativeTo(currentFilepath.dirname);
|
|
2717
|
+
if (specifier.endsWith(".dbml")) specifier = specifier.slice(0, -5);
|
|
2718
|
+
return { specifier };
|
|
2719
|
+
}
|
|
2659
2720
|
getSource(filePath) {
|
|
2660
2721
|
return safeReadFileSync(filePath.fsPath, "utf-8");
|
|
2661
2722
|
}
|
|
@@ -2778,8 +2839,8 @@ async function importHandler(program) {
|
|
|
2778
2839
|
console.log(` ${chalk.default.green(figures.default.main.tick)} Generated DBML file from SQL file (${config[format].name}): ${path.default.basename(opts.outFile)}`);
|
|
2779
2840
|
}
|
|
2780
2841
|
} catch (error) {
|
|
2781
|
-
if (error instanceof _dbml_core.
|
|
2782
|
-
const msg = `\n ${error.diags.map((diag) => new SyntaxError(diag.filepath ?? "", diag)).map((
|
|
2842
|
+
if (error instanceof _dbml_core.CompilerDiagnostics) {
|
|
2843
|
+
const msg = `\n ${error.diags.map((diag) => new SyntaxError(diag.filepath ?? "", diag)).map((e) => e.message).join("\n ")}`;
|
|
2783
2844
|
consoleLogger.error(msg);
|
|
2784
2845
|
fileLogger.error(msg);
|
|
2785
2846
|
return;
|
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": "10.4.0-alpha.
|
|
4
|
+
"version": "10.4.0-alpha.10",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "vitest run",
|
|
10
10
|
"test:watch": "vitest watch",
|
|
11
11
|
"coverage": "vitest --coverage",
|
|
12
|
-
"build": "
|
|
12
|
+
"build": "rimraf ./lib && tsc --noEmit && vite build",
|
|
13
13
|
"dev": "vite build --watch",
|
|
14
14
|
"prepublish": "npm run build",
|
|
15
15
|
"lint": "eslint $(git diff --relative --name-only --diff-filter=ACMRTUXB master -- . | grep -E '\\.(js|ts)$')",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/cli": "^7.21.0",
|
|
36
|
-
"@dbml/connector": "^10.4.0-alpha.
|
|
37
|
-
"@dbml/core": "^10.4.0-alpha.
|
|
38
|
-
"@dbml/parse": "^10.4.0-alpha.
|
|
36
|
+
"@dbml/connector": "^10.4.0-alpha.10",
|
|
37
|
+
"@dbml/core": "^10.4.0-alpha.10",
|
|
38
|
+
"@dbml/parse": "^10.4.0-alpha.10",
|
|
39
39
|
"bluebird": "^3.5.5",
|
|
40
40
|
"chalk": "^2.4.2",
|
|
41
41
|
"commander": "^2.20.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"strip-ansi": "^5.2.0",
|
|
47
47
|
"winston": "^3.2.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "803873f5165a628d3f9050b9dff0173adab072b2",
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=18"
|
|
52
52
|
}
|
package/src/NodeProjectLayout.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
readFileSync, readdirSync, statSync,
|
|
3
3
|
} from 'node:fs';
|
|
4
4
|
import {
|
|
5
|
-
type DbmlProjectLayout, Filepath,
|
|
5
|
+
type DbmlProjectLayout, type FileSpecifierInfo, Filepath,
|
|
6
6
|
} from '@dbml/parse';
|
|
7
7
|
import {
|
|
8
8
|
fileLogger,
|
|
@@ -26,6 +26,14 @@ export class NodeProjectLayout implements DbmlProjectLayout {
|
|
|
26
26
|
return resolved.absolute.endsWith('.dbml') ? resolved : Filepath.from(resolved.absolute + '.dbml');
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
getFileSpecifierInfo (currentFilepath: Filepath, targetFilepath: Filepath): FileSpecifierInfo | undefined {
|
|
30
|
+
let specifier = targetFilepath.relativeTo(currentFilepath.dirname);
|
|
31
|
+
if (specifier.endsWith('.dbml')) specifier = specifier.slice(0, -'.dbml'.length);
|
|
32
|
+
return {
|
|
33
|
+
specifier,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
getSource (filePath: Filepath): string | undefined {
|
|
30
38
|
return safeReadFileSync(filePath.fsPath, 'utf-8');
|
|
31
39
|
}
|
package/src/cli/import.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
CompilerDiagnostics, importer,
|
|
4
4
|
} from '@dbml/core';
|
|
5
5
|
import type {
|
|
6
|
+
CompilerDiagnostic,
|
|
6
7
|
ImportFormat,
|
|
7
8
|
} from '@dbml/core';
|
|
8
9
|
import chalk from 'chalk';
|
|
@@ -45,10 +46,8 @@ export default async function importHandler (program: Command) {
|
|
|
45
46
|
console.log(` ${chalk.green(figures.main.tick)} Generated DBML file from SQL file (${config[format].name}): ${path.basename(opts.outFile)}`);
|
|
46
47
|
}
|
|
47
48
|
} catch (error) {
|
|
48
|
-
if (error instanceof
|
|
49
|
-
const msg = `\n ${error.diags.map((diag) => new SyntaxError(diag.filepath ?? '', diag)).map((
|
|
50
|
-
message,
|
|
51
|
-
}) => message).join('\n ')}`;
|
|
49
|
+
if (error instanceof CompilerDiagnostics) {
|
|
50
|
+
const msg = `\n ${error.diags.map((diag: CompilerDiagnostic) => new SyntaxError(diag.filepath ?? '', diag)).map((e: SyntaxError) => e.message).join('\n ')}`;
|
|
52
51
|
consoleLogger.error(msg);
|
|
53
52
|
fileLogger.error(msg);
|
|
54
53
|
return;
|
package/src/cli/utils.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
CompilerDiagnostics,
|
|
5
|
+
type CompilerDiagnostic,
|
|
5
6
|
type ExportFormat,
|
|
6
7
|
} from '@dbml/core';
|
|
7
8
|
import {
|
|
@@ -88,8 +89,8 @@ function generate (
|
|
|
88
89
|
const content = transform(source);
|
|
89
90
|
outputPlugin.write(content);
|
|
90
91
|
} catch (e) {
|
|
91
|
-
if (e instanceof
|
|
92
|
-
throw e.map((diag) => ({
|
|
92
|
+
if (e instanceof CompilerDiagnostics) {
|
|
93
|
+
throw e.map((diag: CompilerDiagnostic) => ({
|
|
93
94
|
...diag,
|
|
94
95
|
message: diag.message,
|
|
95
96
|
filepath: path.basename(_path),
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
2026-06-15T10:58:17.719Z
|
|
2
|
-
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
|
|
3
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
|
|
4
|
-
at Connection.onConnect (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:849:9)
|
|
5
|
-
at Object.onceWrapper (node:events:633:26)
|
|
6
|
-
at Connection.emit (node:events:518:28)
|
|
7
|
-
at Connection.emit (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:970:18)
|
|
8
|
-
at Connection.socketError (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1351:12)
|
|
9
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1144:14
|
|
10
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
|
|
11
|
-
|
|
12
|
-
2026-06-15T10:59:20.290Z
|
|
13
|
-
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
|
|
14
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
|
|
15
|
-
at Connection.onConnect (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:849:9)
|
|
16
|
-
at Object.onceWrapper (node:events:633:26)
|
|
17
|
-
at Connection.emit (node:events:518:28)
|
|
18
|
-
at Connection.emit (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:970:18)
|
|
19
|
-
at Connection.socketError (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1351:12)
|
|
20
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1144:14
|
|
21
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
|
|
22
|
-
|
|
23
|
-
2026-07-22T11:04:07.232Z
|
|
24
|
-
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
|
|
25
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
|
|
26
|
-
at Connection.onConnect (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:849:9)
|
|
27
|
-
at Object.onceWrapper (node:events:633:26)
|
|
28
|
-
at Connection.emit (node:events:518:28)
|
|
29
|
-
at Connection.emit (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:970:18)
|
|
30
|
-
at Connection.socketError (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1351:12)
|
|
31
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1144:14
|
|
32
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
|
|
33
|
-
|
|
34
|
-
2026-07-22T11:07:40.073Z
|
|
35
|
-
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
|
|
36
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
|
|
37
|
-
at Connection.onConnect (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:849:9)
|
|
38
|
-
at Object.onceWrapper (node:events:633:26)
|
|
39
|
-
at Connection.emit (node:events:518:28)
|
|
40
|
-
at Connection.emit (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:970:18)
|
|
41
|
-
at Connection.socketError (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1351:12)
|
|
42
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1144:14
|
|
43
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
|
|
44
|
-
|
|
45
|
-
2026-07-22T11:10:22.078Z
|
|
46
|
-
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
|
|
47
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/mssql/lib/tedious/connection-pool.js:85:17
|
|
48
|
-
at Connection.onConnect (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:849:9)
|
|
49
|
-
at Object.onceWrapper (node:events:633:26)
|
|
50
|
-
at Connection.emit (node:events:518:28)
|
|
51
|
-
at Connection.emit (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:970:18)
|
|
52
|
-
at Connection.socketError (/Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1351:12)
|
|
53
|
-
at /Users/xuantho573/projects/holistics/dbml/node_modules/tedious/lib/connection.js:1144:14
|
|
54
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
|
|
55
|
-
|