@dbml/core 3.11.0 → 3.12.0-alpha-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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/export/DbmlExporter.js +0 -0
- package/lib/export/JsonExporter.js +0 -0
- package/lib/export/ModelExporter.js +0 -0
- package/lib/export/MysqlExporter.js +0 -0
- package/lib/export/OracleExporter.js +0 -0
- package/lib/export/PostgresExporter.js +0 -0
- package/lib/export/README.md +0 -0
- package/lib/export/SqlServerExporter.js +0 -0
- package/lib/export/index.js +0 -0
- package/lib/export/utils.js +0 -0
- package/lib/import/index.js +0 -0
- package/lib/index.js +0 -0
- package/lib/model_structure/config.js +0 -0
- package/lib/model_structure/database.js +39 -10
- package/lib/model_structure/dbState.js +1 -0
- package/lib/model_structure/element.js +0 -0
- package/lib/model_structure/endpoint.js +0 -0
- package/lib/model_structure/enum.js +0 -0
- package/lib/model_structure/enumValue.js +0 -0
- package/lib/model_structure/field.js +0 -0
- package/lib/model_structure/indexColumn.js +0 -0
- package/lib/model_structure/indexes.js +0 -0
- package/lib/model_structure/ref.js +0 -0
- package/lib/model_structure/schema.js +0 -0
- package/lib/model_structure/stickyNote.js +0 -0
- package/lib/model_structure/table.js +0 -0
- package/lib/model_structure/tableGroup.js +0 -0
- package/lib/model_structure/utils.js +6 -0
- package/lib/parse/ANTLR/ASTGeneration/AST.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/ParserErrorListener.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/SyntaxError.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/constants.js +4 -2
- package/lib/parse/ANTLR/ASTGeneration/helpers.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/index.js +21 -5
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +1334 -0
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +159 -4
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLLexerBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLParserBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.js +225 -5
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +0 -0
- package/lib/parse/ANTLR/README.md +6 -1
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.g4 +1300 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.interp +3643 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.js +1255 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.tokens +2385 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.g4 +6313 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.interp +3034 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.js +3 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.tokens +2385 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.js +5732 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/README.md +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParserVisitor.js +0 -0
- package/lib/parse/Parser.js +10 -0
- package/lib/parse/buildParser.js +0 -0
- package/lib/parse/databaseGenerator.js +0 -0
- package/lib/parse/dbml/parser.pegjs +0 -0
- package/lib/parse/dbmlParser.js +0 -0
- package/lib/parse/error.js +0 -0
- package/lib/parse/mssql/base_parsers.js +0 -0
- package/lib/parse/mssql/column_definition/actions.js +0 -0
- package/lib/parse/mssql/column_definition/index.js +0 -0
- package/lib/parse/mssql/constraint_definition/actions.js +0 -0
- package/lib/parse/mssql/constraint_definition/index.js +0 -0
- package/lib/parse/mssql/expression.js +0 -0
- package/lib/parse/mssql/fk_definition/actions.js +0 -0
- package/lib/parse/mssql/fk_definition/index.js +0 -0
- package/lib/parse/mssql/index.js +0 -0
- package/lib/parse/mssql/index_definition/actions.js +0 -0
- package/lib/parse/mssql/index_definition/index.js +0 -0
- package/lib/parse/mssql/keyword_parsers.js +0 -0
- package/lib/parse/mssql/keyword_utils.js +0 -0
- package/lib/parse/mssql/statements/actions.js +0 -0
- package/lib/parse/mssql/statements/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/index.js +0 -0
- package/lib/parse/mssql/utils.js +0 -0
- package/lib/parse/mssql/whitespaces.js +0 -0
- package/lib/parse/mssqlParser.js +0 -0
- package/lib/parse/mysql/parser.pegjs +0 -0
- package/lib/parse/mysqlParser.js +0 -0
- package/lib/parse/postgresParser.js +0 -0
- package/lib/parse/postgresql/Base_rules.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Alter_table/Alter_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Commands.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Comment.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_index.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_normal.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_partition_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_enum.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_range.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Ignore_syntax.pegjs +0 -0
- package/lib/parse/postgresql/Expression.pegjs +0 -0
- package/lib/parse/postgresql/InitializerUtils.pegjs +0 -0
- package/lib/parse/postgresql/Keywords.pegjs +0 -0
- package/lib/parse/postgresql/get_parser.js +0 -0
- package/lib/parse/postgresql/parser.pegjs +0 -0
- package/lib/parse/schemarb/parser.pegjs +0 -0
- package/lib/parse/schemarbParser.js +0 -0
- package/lib/utils/version.js +0 -0
- package/package.json +3 -3
- package/types/export/ModelExporter.d.ts +0 -0
- package/types/export/index.d.ts +0 -0
- package/types/import/index.d.ts +0 -0
- package/types/index.d.ts +0 -0
- package/types/model_structure/database.d.ts +34 -1
- package/types/model_structure/dbState.d.ts +0 -0
- package/types/model_structure/element.d.ts +0 -0
- package/types/model_structure/endpoint.d.ts +0 -0
- package/types/model_structure/enum.d.ts +0 -0
- package/types/model_structure/enumValue.d.ts +0 -0
- package/types/model_structure/field.d.ts +0 -0
- package/types/model_structure/indexColumn.d.ts +0 -0
- package/types/model_structure/indexes.d.ts +0 -0
- package/types/model_structure/ref.d.ts +0 -0
- package/types/model_structure/schema.d.ts +0 -0
- package/types/model_structure/stickyNote.d.ts +0 -0
- package/types/model_structure/table.d.ts +0 -0
- package/types/model_structure/tableGroup.d.ts +0 -0
- package/types/parse/Parser.d.ts +3 -2
- package/types/parse/error.d.ts +0 -0
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parse/Parser.js
CHANGED
|
@@ -58,6 +58,11 @@ var Parser = /*#__PURE__*/function () {
|
|
|
58
58
|
case 'mssql':
|
|
59
59
|
rawDatabase = Parser.parseMSSQLToJSON(str);
|
|
60
60
|
break;
|
|
61
|
+
|
|
62
|
+
// When we finish implementing the new parser, it should be mssql and the old one will be mssqlLegacy
|
|
63
|
+
case 'mssqlv2':
|
|
64
|
+
rawDatabase = Parser.parseMSSQLToJSONv2(str);
|
|
65
|
+
break;
|
|
61
66
|
case 'json':
|
|
62
67
|
if (_typeof(str) === 'object') {
|
|
63
68
|
rawDatabase = str;
|
|
@@ -139,6 +144,11 @@ var Parser = /*#__PURE__*/function () {
|
|
|
139
144
|
value: function parseMSSQLToJSON(str) {
|
|
140
145
|
return _mssqlParser["default"].parseWithPegError(str);
|
|
141
146
|
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "parseMSSQLToJSONv2",
|
|
149
|
+
value: function parseMSSQLToJSONv2(str) {
|
|
150
|
+
return (0, _ASTGeneration.parse)(str, 'mssql');
|
|
151
|
+
}
|
|
142
152
|
}, {
|
|
143
153
|
key: "parseSnowflakeToJSON",
|
|
144
154
|
value: function parseSnowflakeToJSON(str) {
|
package/lib/parse/buildParser.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parse/dbmlParser.js
CHANGED
|
File without changes
|
package/lib/parse/error.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parse/mssql/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parse/mssql/utils.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/parse/mssqlParser.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/parse/mysqlParser.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/utils/version.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0-alpha-0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Holistics <dev@holistics.io>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"prepublish": "npm run build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@dbml/parse": "^3.
|
|
35
|
+
"@dbml/parse": "^3.12.0-alpha-0",
|
|
36
36
|
"antlr4": "^4.13.1",
|
|
37
37
|
"lodash": "^4.17.15",
|
|
38
38
|
"parsimmon": "^1.13.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"\\.(?!json$)[^.]*$": "@glen/jest-raw-loader"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "da2bec56f10f32db65a06856105f08b522556661",
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=16"
|
|
65
65
|
}
|
|
File without changes
|
package/types/export/index.d.ts
CHANGED
|
File without changes
|
package/types/import/index.d.ts
CHANGED
|
File without changes
|
package/types/index.d.ts
CHANGED
|
File without changes
|
|
@@ -16,6 +16,25 @@ export interface Project {
|
|
|
16
16
|
database_type: string;
|
|
17
17
|
name: string;
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
interface RawRecord {
|
|
21
|
+
schemaName: string | undefined;
|
|
22
|
+
tableName: string;
|
|
23
|
+
columns: string[];
|
|
24
|
+
values: {
|
|
25
|
+
value: any;
|
|
26
|
+
type: string;
|
|
27
|
+
}[][];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface Record extends RawRecord {
|
|
31
|
+
id: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface NormalizedRecord {
|
|
35
|
+
[_id: number]: Record;
|
|
36
|
+
}
|
|
37
|
+
|
|
19
38
|
export interface RawDatabase {
|
|
20
39
|
schemas: Schema[];
|
|
21
40
|
tables: Table[];
|
|
@@ -24,6 +43,7 @@ export interface RawDatabase {
|
|
|
24
43
|
refs: Ref[];
|
|
25
44
|
tableGroups: TableGroup[];
|
|
26
45
|
project: Project;
|
|
46
|
+
records: RawRecord[];
|
|
27
47
|
}
|
|
28
48
|
declare class Database extends Element {
|
|
29
49
|
dbState: DbState;
|
|
@@ -34,9 +54,11 @@ declare class Database extends Element {
|
|
|
34
54
|
noteToken: Token;
|
|
35
55
|
databaseType: string;
|
|
36
56
|
name: string;
|
|
57
|
+
records: Record[];
|
|
37
58
|
id: number;
|
|
38
|
-
constructor({ schemas, tables, enums, refs, tableGroups, project }: RawDatabase);
|
|
59
|
+
constructor({ schemas, tables, enums, refs, tableGroups, project, records }: RawDatabase);
|
|
39
60
|
generateId(): void;
|
|
61
|
+
processRecords(rawRecords: RawRecord[]): void;
|
|
40
62
|
processSchemas(rawSchemas: RawSchema[]): void;
|
|
41
63
|
pushSchema(schema: Schema): void;
|
|
42
64
|
checkSchema(schema: Schema): void;
|
|
@@ -108,6 +130,16 @@ declare class Database extends Element {
|
|
|
108
130
|
content: string;
|
|
109
131
|
headerColor: string;
|
|
110
132
|
}[];
|
|
133
|
+
records: {
|
|
134
|
+
id: number;
|
|
135
|
+
schemaName: string;
|
|
136
|
+
tableName: string;
|
|
137
|
+
columns: string[];
|
|
138
|
+
values: {
|
|
139
|
+
value: any;
|
|
140
|
+
type: string;
|
|
141
|
+
}[][];
|
|
142
|
+
}[];
|
|
111
143
|
};
|
|
112
144
|
shallowExport(): {
|
|
113
145
|
hasDefaultSchema: boolean;
|
|
@@ -210,5 +242,6 @@ export interface NormalizedDatabase {
|
|
|
210
242
|
indexes: NormalizedIndex;
|
|
211
243
|
indexColumns: NormalizedIndexColumn;
|
|
212
244
|
fields: NormalizedField;
|
|
245
|
+
records: NormalizedRecord;
|
|
213
246
|
}
|
|
214
247
|
export default Database;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/types/parse/Parser.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare type ParseFormat = 'json'
|
|
|
5
5
|
| 'mysql' | 'mysqlLegacy'
|
|
6
6
|
| 'postgres' | 'postgresLegacy'
|
|
7
7
|
| 'dbml' | 'dbmlv2'
|
|
8
|
-
| 'mssql'
|
|
8
|
+
| 'mssql' | 'mssqlv2'
|
|
9
9
|
| 'schemarb'
|
|
10
10
|
| 'snowflake';
|
|
11
11
|
|
|
@@ -18,9 +18,10 @@ declare class Parser {
|
|
|
18
18
|
static parsePostgresToJSON(str: string): RawDatabase;
|
|
19
19
|
static parsePostgresToJSONv2(str: string): RawDatabase;
|
|
20
20
|
static parseDBMLToJSON(str: string): RawDatabase;
|
|
21
|
-
static parseDBMLToJSONv2(str: string, dbmlCompiler
|
|
21
|
+
static parseDBMLToJSONv2(str: string, dbmlCompiler?: Compiler): RawDatabase;
|
|
22
22
|
static parseSchemaRbToJSON(str: string): RawDatabase;
|
|
23
23
|
static parseMSSQLToJSON(str: string): RawDatabase;
|
|
24
|
+
static parseMSSQLToJSONv2(str: string): RawDatabase;
|
|
24
25
|
static parseSnowflakeToJSON(str: string): RawDatabase;
|
|
25
26
|
/**
|
|
26
27
|
* Should use parse() instance method instead of this static method whenever possible
|
package/types/parse/error.d.ts
CHANGED
|
File without changes
|