@dbml/core 3.13.0-alpha.3 → 3.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +3 -0
- package/lib/model_structure/dbState.js +0 -0
- package/lib/model_structure/element.js +0 -0
- package/lib/model_structure/endpoint.js +1 -3
- 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 +3 -1
- 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 +1 -0
- package/lib/model_structure/tableGroup.js +0 -0
- package/lib/model_structure/tablePartial.js +0 -0
- package/lib/model_structure/utils.js +0 -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 +0 -0
- package/lib/parse/ANTLR/ASTGeneration/helpers.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/index.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +34 -31
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLLexerBase.js +3 -1
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLParserBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.js +40 -31
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +0 -0
- package/lib/parse/ANTLR/README.md +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.js +0 -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 +1 -1
- 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 +0 -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 +0 -0
- 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 +4 -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/model_structure/tablePartial.d.ts +0 -0
- package/types/parse/Parser.d.ts +0 -0
- package/types/parse/error.d.ts +0 -0
- package/types/tablePartial.d.ts +0 -38
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/export/README.md
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/export/index.js
CHANGED
|
File without changes
|
package/lib/export/utils.js
CHANGED
|
File without changes
|
package/lib/import/index.js
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -74,6 +74,9 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
74
74
|
_this.aliases = aliases;
|
|
75
75
|
_this.records = [];
|
|
76
76
|
_this.tablePartials = [];
|
|
77
|
+
|
|
78
|
+
// The global array containing references with 1 endpoint being a field injected from a partial to a table
|
|
79
|
+
// These refs are add to this array when resolving partials in tables (`Table.processPartials()`)
|
|
77
80
|
_this.injectedRawRefs = [];
|
|
78
81
|
|
|
79
82
|
// The process order is important. Do not change !
|
|
File without changes
|
|
File without changes
|
|
@@ -104,13 +104,11 @@ var Endpoint = /*#__PURE__*/function (_Element) {
|
|
|
104
104
|
}, {
|
|
105
105
|
key: "shallowExport",
|
|
106
106
|
value: function shallowExport() {
|
|
107
|
-
var _this$injectedPartial;
|
|
108
107
|
return {
|
|
109
108
|
schemaName: this.schemaName,
|
|
110
109
|
tableName: this.tableName,
|
|
111
110
|
fieldNames: this.fieldNames,
|
|
112
|
-
relation: this.relation
|
|
113
|
-
injectedPartialId: (_this$injectedPartial = this.injectedPartial) === null || _this$injectedPartial === void 0 ? void 0 : _this$injectedPartial.id
|
|
111
|
+
relation: this.relation
|
|
114
112
|
};
|
|
115
113
|
}
|
|
116
114
|
}, {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -119,12 +119,14 @@ var Index = /*#__PURE__*/function (_Element) {
|
|
|
119
119
|
}, {
|
|
120
120
|
key: "shallowExport",
|
|
121
121
|
value: function shallowExport() {
|
|
122
|
+
var _this$injectedPartial;
|
|
122
123
|
return {
|
|
123
124
|
name: this.name,
|
|
124
125
|
type: this.type,
|
|
125
126
|
unique: this.unique,
|
|
126
127
|
pk: this.pk,
|
|
127
|
-
note: this.note
|
|
128
|
+
note: this.note,
|
|
129
|
+
injectedPartialId: (_this$injectedPartial = this.injectedPartial) === null || _this$injectedPartial === void 0 ? void 0 : _this$injectedPartial.id
|
|
128
130
|
};
|
|
129
131
|
}
|
|
130
132
|
}, {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -214,6 +214,7 @@ var Table = /*#__PURE__*/function (_Element) {
|
|
|
214
214
|
}],
|
|
215
215
|
injectedPartial: tablePartial
|
|
216
216
|
};
|
|
217
|
+
// The global array containing references with 1 endpoint being a field injected from a partial to a table
|
|
217
218
|
_this5.schema.database.injectedRawRefs.push(ref);
|
|
218
219
|
});
|
|
219
220
|
}
|
|
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
|
|
@@ -505,10 +505,22 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
505
505
|
}, {
|
|
506
506
|
key: "visitData_type",
|
|
507
507
|
value: function visitData_type(ctx) {
|
|
508
|
-
var id = ctx.id_().accept(this);
|
|
509
508
|
if (ctx.MAX()) {
|
|
510
|
-
|
|
509
|
+
var type = '';
|
|
510
|
+
if (ctx.SQUARE_BRACKET_ID()) {
|
|
511
|
+
type = ctx.SQUARE_BRACKET_ID().getText().slice(1, -1);
|
|
512
|
+
} else {
|
|
513
|
+
var typeNode = ctx.VARCHAR() || ctx.NVARCHAR() || ctx.BINARY_KEYWORD() || ctx.VARBINARY_KEYWORD() || ctx.SQUARE_BRACKET_ID();
|
|
514
|
+
type = typeNode.getText();
|
|
515
|
+
}
|
|
516
|
+
return "".concat(type, "(MAX)");
|
|
517
|
+
}
|
|
518
|
+
if (ctx.DOUBLE()) {
|
|
519
|
+
var _double = ctx.DOUBLE().getText();
|
|
520
|
+
var precision = ctx.PRECISION() ? " ".concat(ctx.PRECISION().getText()) : '';
|
|
521
|
+
return "".concat(_double).concat(precision);
|
|
511
522
|
}
|
|
523
|
+
var id = ctx.id_().accept(this);
|
|
512
524
|
if (ctx.IDENTITY()) {
|
|
513
525
|
if (ctx.DECIMAL().length) {
|
|
514
526
|
var seedAndInc = ctx.DECIMAL().map(function (decimal) {
|
|
@@ -518,12 +530,6 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
518
530
|
}
|
|
519
531
|
return "".concat(id, " IDENTITY");
|
|
520
532
|
}
|
|
521
|
-
if (ctx.DOUBLE()) {
|
|
522
|
-
if (ctx.PRECISION()) {
|
|
523
|
-
return "".concat(id, "(").concat(ctx.PRECISION().getText(), ")");
|
|
524
|
-
}
|
|
525
|
-
return id;
|
|
526
|
-
}
|
|
527
533
|
if (ctx.DECIMAL().length) {
|
|
528
534
|
var scaleAndPrec = ctx.DECIMAL().map(function (decimal) {
|
|
529
535
|
return decimal.getText();
|
|
@@ -607,11 +613,10 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
607
613
|
})));
|
|
608
614
|
|
|
609
615
|
// these check constraints represent enums
|
|
610
|
-
var enums = [];
|
|
611
616
|
var checkConstraints = columnCheckConstraints.concat(tableCheckConstraints);
|
|
612
617
|
checkConstraints.forEach(function (checkConstraint) {
|
|
613
|
-
var field = fields.find(function (
|
|
614
|
-
return
|
|
618
|
+
var field = fields.find(function (fieldItem) {
|
|
619
|
+
return fieldItem.name === checkConstraint.column;
|
|
615
620
|
});
|
|
616
621
|
if (!field) return;
|
|
617
622
|
var enumObject = new _AST.Enum({
|
|
@@ -750,11 +755,11 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
750
755
|
case _constants.COLUMN_CONSTRAINT_KIND.CHECK:
|
|
751
756
|
{
|
|
752
757
|
var _columnDef$value = columnDef.value,
|
|
753
|
-
|
|
758
|
+
columnDefType = _columnDef$value.type,
|
|
754
759
|
value = _columnDef$value.value;
|
|
755
760
|
|
|
756
761
|
// we keep the current behavior: when a field has a check constraints cannot be converted to enum, we will ignore it
|
|
757
|
-
if (
|
|
762
|
+
if (columnDefType !== CHECK_CONSTRAINT_CONDITION_TYPE.ENUM) return;
|
|
758
763
|
definition.value.checkConstraints.push(value);
|
|
759
764
|
break;
|
|
760
765
|
}
|
|
@@ -1217,8 +1222,8 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1217
1222
|
field.dbdefault = columnDefault.defaultValue;
|
|
1218
1223
|
});
|
|
1219
1224
|
checkConstraints.forEach(function (checkConstraint) {
|
|
1220
|
-
var field = table.fields.find(function (
|
|
1221
|
-
return
|
|
1225
|
+
var field = table.fields.find(function (fieldItem) {
|
|
1226
|
+
return fieldItem.name === checkConstraint.column;
|
|
1222
1227
|
});
|
|
1223
1228
|
if (!field) return;
|
|
1224
1229
|
var enumObject = new _AST.Enum({
|
|
@@ -1338,28 +1343,28 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1338
1343
|
acc[name] = arg.value;
|
|
1339
1344
|
return acc;
|
|
1340
1345
|
}, {});
|
|
1341
|
-
if (!argsObj
|
|
1346
|
+
if (!argsObj.name.includes('Description')) {
|
|
1342
1347
|
return;
|
|
1343
1348
|
}
|
|
1344
1349
|
|
|
1345
1350
|
// https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-addextendedproperty-transact-sql?view=sql-server-ver16#----level0type
|
|
1346
|
-
var level0Type = argsObj
|
|
1351
|
+
var level0Type = argsObj.level0type.toLowerCase();
|
|
1347
1352
|
if (!level0Type.includes('schema')) return;
|
|
1348
|
-
var schemaName = argsObj
|
|
1349
|
-
var level1Type = argsObj
|
|
1350
|
-
var tableName = level1Type.includes('table') ? argsObj
|
|
1353
|
+
var schemaName = argsObj.level0name !== 'dbo' ? argsObj.level0name : undefined;
|
|
1354
|
+
var level1Type = argsObj.level1type.toLowerCase();
|
|
1355
|
+
var tableName = level1Type.includes('table') ? argsObj.level1name : null;
|
|
1351
1356
|
var table = this.data.tables.find(function (t) {
|
|
1352
1357
|
return t.name === tableName && t.schemaName === schemaName;
|
|
1353
1358
|
});
|
|
1354
1359
|
if (!table) return;
|
|
1355
|
-
if (!argsObj
|
|
1360
|
+
if (!argsObj.level2type) {
|
|
1356
1361
|
table.note = {
|
|
1357
1362
|
value: argsObj.value
|
|
1358
1363
|
};
|
|
1359
1364
|
return;
|
|
1360
1365
|
}
|
|
1361
|
-
var level2Type = argsObj
|
|
1362
|
-
var columnName = level2Type.includes('column') ? argsObj
|
|
1366
|
+
var level2Type = argsObj.level2type.toLowerCase();
|
|
1367
|
+
var columnName = level2Type.includes('column') ? argsObj.level2name : null;
|
|
1363
1368
|
var field = table.fields.find(function (f) {
|
|
1364
1369
|
return f.name === columnName;
|
|
1365
1370
|
});
|
|
@@ -1380,11 +1385,10 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1380
1385
|
var _this19 = this;
|
|
1381
1386
|
if (ctx.func_proc_name_database_schema()) {
|
|
1382
1387
|
return ctx.func_proc_name_database_schema().accept(this);
|
|
1383
|
-
} else {
|
|
1384
|
-
return ctx.id_().map(function (id) {
|
|
1385
|
-
return id.accept(_this19);
|
|
1386
|
-
});
|
|
1387
1388
|
}
|
|
1389
|
+
return ctx.id_().map(function (id) {
|
|
1390
|
+
return id.accept(_this19);
|
|
1391
|
+
});
|
|
1388
1392
|
}
|
|
1389
1393
|
|
|
1390
1394
|
// func_proc_name_database_schema
|
|
@@ -1397,11 +1401,10 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1397
1401
|
var _this20 = this;
|
|
1398
1402
|
if (ctx.func_proc_name_schema()) {
|
|
1399
1403
|
return ctx.func_proc_name_schema().accept(this);
|
|
1400
|
-
} else {
|
|
1401
|
-
return ctx.id_().map(function (id) {
|
|
1402
|
-
return id.accept(_this20);
|
|
1403
|
-
});
|
|
1404
1404
|
}
|
|
1405
|
+
return ctx.id_().map(function (id) {
|
|
1406
|
+
return id.accept(_this20);
|
|
1407
|
+
});
|
|
1405
1408
|
}
|
|
1406
1409
|
|
|
1407
1410
|
// func_proc_name_schema
|
|
File without changes
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.HandleLessLessGreaterGreater = HandleLessLessGreaterGreater;
|
|
8
|
+
exports.charIsLetter = charIsLetter;
|
|
8
9
|
exports.checkLA = checkLA;
|
|
9
10
|
exports["default"] = void 0;
|
|
10
11
|
exports.isTag = isTag;
|
|
@@ -40,4 +41,5 @@ exports["default"] = PostgreSQLLexerBase;
|
|
|
40
41
|
function checkLA() {}
|
|
41
42
|
function HandleLessLessGreaterGreater() {}
|
|
42
43
|
function pushTag() {}
|
|
43
|
-
function isTag() {}
|
|
44
|
+
function isTag() {}
|
|
45
|
+
function charIsLetter() {}
|
|
File without changes
|
|
@@ -34,7 +34,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
34
34
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
35
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
36
36
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /* eslint-disable class-methods-use-this */
|
|
37
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /* eslint-disable no-param-reassign */ /* eslint-disable consistent-return */ /* eslint-disable class-methods-use-this */
|
|
38
38
|
var COMMAND_KIND = {
|
|
39
39
|
REF: 'ref'
|
|
40
40
|
};
|
|
@@ -106,7 +106,10 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
106
106
|
value: function visitStmt(ctx) {
|
|
107
107
|
if (ctx.createstmt()) {
|
|
108
108
|
var table = ctx.createstmt().accept(this);
|
|
109
|
-
|
|
109
|
+
|
|
110
|
+
// filter out null table that can cause error in model_structure stage
|
|
111
|
+
if (table) this.data.tables.push(table);
|
|
112
|
+
return;
|
|
110
113
|
}
|
|
111
114
|
if (ctx.indexstmt()) {
|
|
112
115
|
/** @type {Index} */
|
|
@@ -115,8 +118,8 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
115
118
|
tableName = _indexStmt$pathName.tableName,
|
|
116
119
|
schemaName = _indexStmt$pathName.schemaName;
|
|
117
120
|
var _table = findTable(this.data.tables, schemaName, tableName);
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
121
|
+
if (_table) _table.indexes.push(indexStmt.index);
|
|
122
|
+
return;
|
|
120
123
|
}
|
|
121
124
|
if (ctx.altertablestmt()) {
|
|
122
125
|
ctx.altertablestmt().accept(this);
|
|
@@ -132,7 +135,6 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
132
135
|
}
|
|
133
136
|
if (ctx.insertstmt()) {
|
|
134
137
|
ctx.insertstmt().accept(this);
|
|
135
|
-
return;
|
|
136
138
|
}
|
|
137
139
|
}
|
|
138
140
|
|
|
@@ -465,10 +467,12 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
465
467
|
key: "visitC_expr_expr",
|
|
466
468
|
value: function visitC_expr_expr(ctx) {
|
|
467
469
|
if (ctx.aexprconst()) return ctx.aexprconst().accept(this);
|
|
468
|
-
if (ctx.a_expr())
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
470
|
+
if (ctx.a_expr()) {
|
|
471
|
+
return {
|
|
472
|
+
value: ctx.a_expr().getText(),
|
|
473
|
+
type: _constants.DATA_TYPE.EXPRESSION
|
|
474
|
+
};
|
|
475
|
+
}
|
|
472
476
|
return {
|
|
473
477
|
value: ctx.getText(),
|
|
474
478
|
type: _constants.DATA_TYPE.EXPRESSION
|
|
@@ -589,11 +593,9 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
589
593
|
}, {
|
|
590
594
|
key: "visitUnreserved_keyword",
|
|
591
595
|
value: function visitUnreserved_keyword(ctx) {
|
|
592
|
-
return ctx.
|
|
596
|
+
return ctx.getText();
|
|
593
597
|
}
|
|
594
|
-
|
|
595
|
-
key: "visitIdentifier",
|
|
596
|
-
value:
|
|
598
|
+
|
|
597
599
|
/*
|
|
598
600
|
Identifier opt_uescape
|
|
599
601
|
| QuotedIdentifier
|
|
@@ -602,7 +604,9 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
602
604
|
| plsqlidentifier
|
|
603
605
|
| plsql_unreserved_keyword
|
|
604
606
|
*/
|
|
605
|
-
|
|
607
|
+
}, {
|
|
608
|
+
key: "visitIdentifier",
|
|
609
|
+
value: function visitIdentifier(ctx) {
|
|
606
610
|
if (ctx.Identifier()) {
|
|
607
611
|
return ctx.Identifier().getText();
|
|
608
612
|
}
|
|
@@ -705,18 +709,24 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
705
709
|
key: "visitSimpletypename",
|
|
706
710
|
value: function visitSimpletypename(ctx) {
|
|
707
711
|
if (ctx.generictype()) return ctx.generictype().accept(this);
|
|
708
|
-
if (ctx.character())
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
712
|
+
if (ctx.character()) {
|
|
713
|
+
return {
|
|
714
|
+
type: ctx.character().accept(this),
|
|
715
|
+
schemaName: null
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
if (ctx.numeric()) {
|
|
719
|
+
return {
|
|
720
|
+
type: ctx.numeric().accept(this),
|
|
721
|
+
schemaName: null
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
if (ctx.constdatetime()) {
|
|
725
|
+
return {
|
|
726
|
+
type: ctx.constdatetime().accept(this),
|
|
727
|
+
schemaName: null
|
|
728
|
+
};
|
|
729
|
+
}
|
|
720
730
|
return {
|
|
721
731
|
type: ctx.getText(),
|
|
722
732
|
schemaName: null
|
|
@@ -1023,7 +1033,6 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
1023
1033
|
}, {
|
|
1024
1034
|
key: "visitCommentstmt",
|
|
1025
1035
|
value: function visitCommentstmt(ctx) {
|
|
1026
|
-
var note = ctx.comment_text().accept(this);
|
|
1027
1036
|
if (ctx.object_type_any_name()) {
|
|
1028
1037
|
var objectType = ctx.object_type_any_name().accept(this);
|
|
1029
1038
|
if (!objectType) return;
|
|
@@ -1033,9 +1042,9 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
1033
1042
|
var schemaName = names.length > 1 ? names[names.length - 2] : undefined;
|
|
1034
1043
|
var table = findTable(this.data.tables, schemaName, tableName);
|
|
1035
1044
|
if (!table) return;
|
|
1036
|
-
var
|
|
1045
|
+
var note = ctx.comment_text().accept(this);
|
|
1037
1046
|
table.note = {
|
|
1038
|
-
value: escapeStr(
|
|
1047
|
+
value: escapeStr(note)
|
|
1039
1048
|
};
|
|
1040
1049
|
}
|
|
1041
1050
|
}
|
|
@@ -1049,9 +1058,9 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
1049
1058
|
return field.name === fieldName;
|
|
1050
1059
|
});
|
|
1051
1060
|
if (!field) return;
|
|
1052
|
-
var
|
|
1061
|
+
var _note = ctx.comment_text().accept(this);
|
|
1053
1062
|
field.note = {
|
|
1054
|
-
value: escapeStr(
|
|
1063
|
+
value: escapeStr(_note)
|
|
1055
1064
|
};
|
|
1056
1065
|
}
|
|
1057
1066
|
}
|
|
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
|
|
@@ -864,7 +864,7 @@ PostgreSQLLexer.prototype.OperatorEndingWithPlusMinus_sempred = function (localc
|
|
|
864
864
|
PostgreSQLLexer.prototype.IdentifierStartChar_sempred = function (localctx, predIndex) {
|
|
865
865
|
switch (predIndex) {
|
|
866
866
|
case 6:
|
|
867
|
-
return charIsLetter();
|
|
867
|
+
return (0, _PostgreSQLLexerBase2.charIsLetter)();
|
|
868
868
|
case 7:
|
|
869
869
|
return;
|
|
870
870
|
CheckIfUtf32Letter();
|
|
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
|
File without changes
|
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.13.
|
|
3
|
+
"version": "3.13.1",
|
|
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.13.
|
|
35
|
+
"@dbml/parse": "^3.13.1",
|
|
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": "8baea3c6a612f433f188efd6df5d24d1d5e16f2c",
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -3,6 +3,7 @@ import DbState from './dbState';
|
|
|
3
3
|
import Element, { RawNote, Token } from './element';
|
|
4
4
|
import IndexColumn from './indexColumn';
|
|
5
5
|
import Table from './table';
|
|
6
|
+
import TablePartial from './tablePartial';
|
|
6
7
|
interface RawIndex {
|
|
7
8
|
columns: IndexColumn;
|
|
8
9
|
type: any;
|
|
@@ -23,6 +24,7 @@ declare class Index extends Element {
|
|
|
23
24
|
noteToken: Token;
|
|
24
25
|
table: Table;
|
|
25
26
|
dbState: DbState;
|
|
27
|
+
injectedPartial: TablePartial;
|
|
26
28
|
constructor({ columns, type, unique, pk, token, name, note, table }: RawIndex);
|
|
27
29
|
generateId(): void;
|
|
28
30
|
processIndexColumns(rawColumns: any): void;
|
|
@@ -38,6 +40,7 @@ declare class Index extends Element {
|
|
|
38
40
|
unique: boolean;
|
|
39
41
|
pk: string;
|
|
40
42
|
note: string;
|
|
43
|
+
injectedPartialId?: number;
|
|
41
44
|
};
|
|
42
45
|
exportChild(): {
|
|
43
46
|
columns: {
|
|
@@ -57,6 +60,7 @@ declare class Index extends Element {
|
|
|
57
60
|
unique: boolean;
|
|
58
61
|
pk: string;
|
|
59
62
|
note: string;
|
|
63
|
+
injectedPartialId?: number;
|
|
60
64
|
};
|
|
61
65
|
normalize(model: NormalizedDatabase): void;
|
|
62
66
|
}
|
|
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
|
File without changes
|
package/types/parse/error.d.ts
CHANGED
|
File without changes
|
package/types/tablePartial.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export default TablePartial;
|
|
2
|
-
declare class TablePartial extends Element {
|
|
3
|
-
constructor({ name, note, fields, indexes, token, headerColor, noteToken, dbState, }?: {
|
|
4
|
-
name: any;
|
|
5
|
-
note: any;
|
|
6
|
-
fields?: any[];
|
|
7
|
-
indexes?: any[];
|
|
8
|
-
token: any;
|
|
9
|
-
headerColor: any;
|
|
10
|
-
noteToken?: any;
|
|
11
|
-
dbState: any;
|
|
12
|
-
});
|
|
13
|
-
name: any;
|
|
14
|
-
note: any;
|
|
15
|
-
noteToken: any;
|
|
16
|
-
headerColor: any;
|
|
17
|
-
fields: any[];
|
|
18
|
-
indexes: any[];
|
|
19
|
-
dbState: any;
|
|
20
|
-
generateId(): void;
|
|
21
|
-
id: any;
|
|
22
|
-
export(): {
|
|
23
|
-
name: any;
|
|
24
|
-
note: any;
|
|
25
|
-
headerColor: any;
|
|
26
|
-
fields: any[];
|
|
27
|
-
indexes: any[];
|
|
28
|
-
};
|
|
29
|
-
shallowExport(): {
|
|
30
|
-
name: any;
|
|
31
|
-
note: any;
|
|
32
|
-
headerColor: any;
|
|
33
|
-
fields: any[];
|
|
34
|
-
indexes: any[];
|
|
35
|
-
};
|
|
36
|
-
normalize(model: any): void;
|
|
37
|
-
}
|
|
38
|
-
import Element from './element';
|