@dbml/core 3.11.0-alpha-0 → 3.11.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 +2 -6
- package/lib/model_structure/dbState.js +0 -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 +0 -6
- 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 +5 -21
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +4 -165
- 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 +5 -236
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +0 -0
- package/lib/parse/ANTLR/README.md +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 +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 +0 -10
- 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 +1 -16
- 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 +1 -2
- package/types/parse/error.d.ts +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +0 -393
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.g4 +0 -1294
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.interp +0 -3643
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.js +0 -1255
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.tokens +0 -2385
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.g4 +0 -6307
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.interp +0 -3034
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.js +0 -3
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.tokens +0 -2385
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.js +0 -5732
|
@@ -9,7 +9,6 @@ var _lodash = require("lodash");
|
|
|
9
9
|
var _PostgreSQLParserVisitor = _interopRequireDefault(require("../../parsers/postgresql/PostgreSQLParserVisitor"));
|
|
10
10
|
var _AST = require("../AST");
|
|
11
11
|
var _constants = require("../constants");
|
|
12
|
-
var _utils = require("../../../../model_structure/utils");
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -70,8 +69,7 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
70
69
|
enums: [],
|
|
71
70
|
tableGroups: [],
|
|
72
71
|
aliases: [],
|
|
73
|
-
project: {}
|
|
74
|
-
records: {}
|
|
72
|
+
project: {}
|
|
75
73
|
};
|
|
76
74
|
return _this;
|
|
77
75
|
}
|
|
@@ -131,10 +129,6 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
131
129
|
ctx.definestmt().accept(this);
|
|
132
130
|
return;
|
|
133
131
|
}
|
|
134
|
-
if (ctx.insertstmt()) {
|
|
135
|
-
ctx.insertstmt().accept(this);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
132
|
}
|
|
139
133
|
|
|
140
134
|
/*
|
|
@@ -244,7 +238,7 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
244
238
|
})
|
|
245
239
|
// value: {
|
|
246
240
|
// type: 'PrimaryKey',
|
|
247
|
-
// columns:
|
|
241
|
+
// columns:
|
|
248
242
|
// },
|
|
249
243
|
};
|
|
250
244
|
}
|
|
@@ -641,7 +635,7 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
641
635
|
});
|
|
642
636
|
}
|
|
643
637
|
|
|
644
|
-
// DOT (attr_name | STAR)
|
|
638
|
+
// DOT (attr_name | STAR)
|
|
645
639
|
// | OPEN_BRACKET (a_expr | opt_slice_bound COLON opt_slice_bound) CLOSE_BRACKET
|
|
646
640
|
}, {
|
|
647
641
|
key: "visitIndirection_el",
|
|
@@ -836,7 +830,7 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
836
830
|
}
|
|
837
831
|
}
|
|
838
832
|
|
|
839
|
-
// name |
|
|
833
|
+
// name |
|
|
840
834
|
}, {
|
|
841
835
|
key: "visitOpt_index_name",
|
|
842
836
|
value: function visitOpt_index_name(ctx) {
|
|
@@ -851,7 +845,7 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
851
845
|
return ctx.colid().accept(this);
|
|
852
846
|
}
|
|
853
847
|
|
|
854
|
-
// USING name |
|
|
848
|
+
// USING name |
|
|
855
849
|
}, {
|
|
856
850
|
key: "visitAccess_method_clause",
|
|
857
851
|
value: function visitAccess_method_clause(ctx) {
|
|
@@ -1167,231 +1161,6 @@ var PostgresASTGen = /*#__PURE__*/function (_PostgreSQLParserVisi) {
|
|
|
1167
1161
|
return s.accept(_this11);
|
|
1168
1162
|
});
|
|
1169
1163
|
}
|
|
1170
|
-
|
|
1171
|
-
// insertstmt
|
|
1172
|
-
// : opt_with_clause INSERT INTO insert_target insert_rest opt_on_conflict returning_clause
|
|
1173
|
-
// ;
|
|
1174
|
-
}, {
|
|
1175
|
-
key: "visitInsertstmt",
|
|
1176
|
-
value: function visitInsertstmt(ctx) {
|
|
1177
|
-
var _this$data$records$fu;
|
|
1178
|
-
var names = ctx.insert_target().accept(this);
|
|
1179
|
-
var tableName = (0, _lodash.last)(names);
|
|
1180
|
-
var schemaName = names.length > 1 ? names[names.length - 2] : undefined;
|
|
1181
|
-
var fullTableName = (0, _utils.getFullTableName)(schemaName, tableName);
|
|
1182
|
-
var _ctx$insert_rest$acce = ctx.insert_rest().accept(this),
|
|
1183
|
-
columns = _ctx$insert_rest$acce.columns,
|
|
1184
|
-
values = _ctx$insert_rest$acce.values;
|
|
1185
|
-
|
|
1186
|
-
// handle insert into all columns
|
|
1187
|
-
if (columns.length === 0 || values.length === 0) {
|
|
1188
|
-
// temporarily ignore
|
|
1189
|
-
return;
|
|
1190
|
-
}
|
|
1191
|
-
if (!this.data.records[fullTableName]) {
|
|
1192
|
-
this.data.records[fullTableName] = {
|
|
1193
|
-
schemaName: schemaName,
|
|
1194
|
-
tableName: tableName,
|
|
1195
|
-
columns: columns,
|
|
1196
|
-
values: []
|
|
1197
|
-
};
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
// TODO: should handle case the number of columns is not equal
|
|
1201
|
-
(_this$data$records$fu = this.data.records[fullTableName].values).push.apply(_this$data$records$fu, _toConsumableArray(values));
|
|
1202
|
-
}
|
|
1203
|
-
}, {
|
|
1204
|
-
key: "visitInsert_target",
|
|
1205
|
-
value: function visitInsert_target(ctx) {
|
|
1206
|
-
return ctx.qualified_name().accept(this);
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
// insert_rest
|
|
1210
|
-
// : selectstmt
|
|
1211
|
-
// | OVERRIDING override_kind VALUE_P selectstmt
|
|
1212
|
-
// | OPEN_PAREN insert_column_list CLOSE_PAREN (OVERRIDING override_kind VALUE_P)? selectstmt
|
|
1213
|
-
// | DEFAULT VALUES
|
|
1214
|
-
// ;
|
|
1215
|
-
}, {
|
|
1216
|
-
key: "visitInsert_rest",
|
|
1217
|
-
value: function visitInsert_rest(ctx) {
|
|
1218
|
-
var columns = ctx.insert_column_list() ? ctx.insert_column_list().accept(this) : [];
|
|
1219
|
-
var rowsValue = ctx.selectstmt().accept(this) || [];
|
|
1220
|
-
// each sub array represents a set of value of a row
|
|
1221
|
-
// [
|
|
1222
|
-
// [
|
|
1223
|
-
// { value: '1', type: 'number' },
|
|
1224
|
-
// undefined,
|
|
1225
|
-
// {
|
|
1226
|
-
// value: '{"theme": "dark", "notifications": true}',
|
|
1227
|
-
// type: 'string',
|
|
1228
|
-
// type_name: 'JSONB',
|
|
1229
|
-
// schemaName: null
|
|
1230
|
-
// },
|
|
1231
|
-
// undefined,
|
|
1232
|
-
// ]
|
|
1233
|
-
// ]
|
|
1234
|
-
|
|
1235
|
-
var sanitizeRowValue = function sanitizeRowValue(rowValue) {
|
|
1236
|
-
return rowValue.filter(function (row) {
|
|
1237
|
-
return row;
|
|
1238
|
-
}).map(function (_ref) {
|
|
1239
|
-
var value = _ref.value,
|
|
1240
|
-
type = _ref.type;
|
|
1241
|
-
return {
|
|
1242
|
-
value: value,
|
|
1243
|
-
type: type
|
|
1244
|
-
};
|
|
1245
|
-
});
|
|
1246
|
-
};
|
|
1247
|
-
var sanitizedRowsValue = rowsValue.filter(function (rowValue) {
|
|
1248
|
-
return Array.isArray(rowValue);
|
|
1249
|
-
}).map(sanitizeRowValue);
|
|
1250
|
-
return {
|
|
1251
|
-
columns: columns,
|
|
1252
|
-
values: sanitizedRowsValue
|
|
1253
|
-
};
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
// insert_column_list
|
|
1257
|
-
// : insert_column_item (COMMA insert_column_item)*
|
|
1258
|
-
// ;
|
|
1259
|
-
}, {
|
|
1260
|
-
key: "visitInsert_column_list",
|
|
1261
|
-
value: function visitInsert_column_list(ctx) {
|
|
1262
|
-
var _this12 = this;
|
|
1263
|
-
return ctx.insert_column_item().map(function (colItem) {
|
|
1264
|
-
return colItem.accept(_this12);
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
// insert_column_item
|
|
1269
|
-
// : colid opt_indirection
|
|
1270
|
-
// ;
|
|
1271
|
-
}, {
|
|
1272
|
-
key: "visitInsert_column_item",
|
|
1273
|
-
value: function visitInsert_column_item(ctx) {
|
|
1274
|
-
return ctx.colid().accept(this);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
// selectstmt
|
|
1278
|
-
// : select_no_parens
|
|
1279
|
-
// | select_with_parens
|
|
1280
|
-
// ;
|
|
1281
|
-
}, {
|
|
1282
|
-
key: "visitSelectstmt",
|
|
1283
|
-
value: function visitSelectstmt(ctx) {
|
|
1284
|
-
if (!ctx.select_no_parens()) {
|
|
1285
|
-
return null;
|
|
1286
|
-
}
|
|
1287
|
-
return ctx.select_no_parens().accept(this);
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
// select_no_parens
|
|
1291
|
-
// : select_clause opt_sort_clause (for_locking_clause opt_select_limit | select_limit opt_for_locking_clause)?
|
|
1292
|
-
// | with_clause select_clause opt_sort_clause (for_locking_clause opt_select_limit | select_limit opt_for_locking_clause)?
|
|
1293
|
-
// ;
|
|
1294
|
-
}, {
|
|
1295
|
-
key: "visitSelect_no_parens",
|
|
1296
|
-
value: function visitSelect_no_parens(ctx) {
|
|
1297
|
-
return ctx.select_clause().accept(this);
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
// select_clause
|
|
1301
|
-
// : simple_select
|
|
1302
|
-
// | select_with_parens
|
|
1303
|
-
// ;
|
|
1304
|
-
}, {
|
|
1305
|
-
key: "visitSelect_clause",
|
|
1306
|
-
value: function visitSelect_clause(ctx) {
|
|
1307
|
-
return ctx.simple_select().accept(this);
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
// simple_select
|
|
1311
|
-
// : ( SELECT (opt_all_clause into_clause opt_target_list | distinct_clause target_list)
|
|
1312
|
-
// into_clause
|
|
1313
|
-
// from_clause
|
|
1314
|
-
// where_clause
|
|
1315
|
-
// group_clause
|
|
1316
|
-
// having_clause
|
|
1317
|
-
// window_clause
|
|
1318
|
-
// | values_clause
|
|
1319
|
-
// | TABLE relation_expr
|
|
1320
|
-
// | select_with_parens set_operator_with_all_or_distinct (simple_select | select_with_parens)
|
|
1321
|
-
// )
|
|
1322
|
-
// (set_operator_with_all_or_distinct (simple_select | select_with_parens))*
|
|
1323
|
-
// ;
|
|
1324
|
-
}, {
|
|
1325
|
-
key: "visitSimple_select",
|
|
1326
|
-
value: function visitSimple_select(ctx) {
|
|
1327
|
-
if (!ctx.values_clause()) {
|
|
1328
|
-
return null;
|
|
1329
|
-
}
|
|
1330
|
-
return ctx.values_clause().accept(this);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
// values_clause
|
|
1334
|
-
// : VALUES OPEN_PAREN expr_list CLOSE_PAREN (COMMA OPEN_PAREN expr_list CLOSE_PAREN)*
|
|
1335
|
-
// ;
|
|
1336
|
-
}, {
|
|
1337
|
-
key: "visitValues_clause",
|
|
1338
|
-
value: function visitValues_clause(ctx) {
|
|
1339
|
-
var _this13 = this;
|
|
1340
|
-
return ctx.expr_list().map(function (expr) {
|
|
1341
|
-
var rawValues = expr.accept(_this13);
|
|
1342
|
-
|
|
1343
|
-
// We get the value of the c_expr through:
|
|
1344
|
-
// a_expr->a_expr_qual->a_expr_lessless->a_expr_or->a_expr_and->
|
|
1345
|
-
// a_expr_between->a_expr_in->a_expr_unary_not->a_expr_isnull->a_expr_is_not->
|
|
1346
|
-
// a_expr_compare->a_expr_like->a_expr_qual_op->a_expr_unary_qualop->a_expr_add->
|
|
1347
|
-
// a_expr_mul->a_expr_caret->a_expr_unary_sign->a_expr_at_time_zone->a_expr_collate->
|
|
1348
|
-
// a_expr_typecast
|
|
1349
|
-
var FLATTEN_DEPTH = 21;
|
|
1350
|
-
var rawRowValues = (0, _lodash.flattenDepth)(rawValues, FLATTEN_DEPTH);
|
|
1351
|
-
|
|
1352
|
-
// [
|
|
1353
|
-
// { value: '1', type: 'number' },
|
|
1354
|
-
// undefined,
|
|
1355
|
-
// {
|
|
1356
|
-
// value: '{"theme": "dark", "notifications": true}',
|
|
1357
|
-
// type: 'string',
|
|
1358
|
-
// type_name: 'JSONB',
|
|
1359
|
-
// schemaName: null
|
|
1360
|
-
// },
|
|
1361
|
-
// undefined,
|
|
1362
|
-
// ]
|
|
1363
|
-
return rawRowValues;
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
// a_expr_collate
|
|
1368
|
-
// : a_expr_typecast (COLLATE any_name)?
|
|
1369
|
-
// ;
|
|
1370
|
-
}, {
|
|
1371
|
-
key: "visitA_expr_collate",
|
|
1372
|
-
value: function visitA_expr_collate(ctx) {
|
|
1373
|
-
var expressionValueSet = ctx.a_expr_typecast().accept(this);
|
|
1374
|
-
|
|
1375
|
-
// Possible values
|
|
1376
|
-
// 1: [ { value: 'inactive', type: 'string' } ]
|
|
1377
|
-
// 2: [
|
|
1378
|
-
// { value: '2021-01-05 18:45:00+00', type: 'string' },
|
|
1379
|
-
// undefined,
|
|
1380
|
-
// { type_name: 'TIMESTAMPTZ', schemaName: null }
|
|
1381
|
-
// ]
|
|
1382
|
-
// eslint-disable-next-line no-unused-vars
|
|
1383
|
-
var _expressionValueSet = _slicedToArray(expressionValueSet, 3),
|
|
1384
|
-
rawValue = _expressionValueSet[0],
|
|
1385
|
-
_ = _expressionValueSet[1],
|
|
1386
|
-
_expressionValueSet$ = _expressionValueSet[2],
|
|
1387
|
-
rawType = _expressionValueSet$ === void 0 ? {} : _expressionValueSet$;
|
|
1388
|
-
var value = rawValue.value,
|
|
1389
|
-
type = rawValue.type;
|
|
1390
|
-
return _objectSpread({
|
|
1391
|
-
value: value,
|
|
1392
|
-
type: type
|
|
1393
|
-
}, rawType);
|
|
1394
|
-
}
|
|
1395
1164
|
}]);
|
|
1396
1165
|
return PostgresASTGen;
|
|
1397
1166
|
}(_PostgreSQLParserVisitor["default"]);
|
|
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
|
|
File without changes
|
|
File without changes
|
package/lib/parse/Parser.js
CHANGED
|
@@ -58,11 +58,6 @@ 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;
|
|
66
61
|
case 'json':
|
|
67
62
|
if (_typeof(str) === 'object') {
|
|
68
63
|
rawDatabase = str;
|
|
@@ -144,11 +139,6 @@ var Parser = /*#__PURE__*/function () {
|
|
|
144
139
|
value: function parseMSSQLToJSON(str) {
|
|
145
140
|
return _mssqlParser["default"].parseWithPegError(str);
|
|
146
141
|
}
|
|
147
|
-
}, {
|
|
148
|
-
key: "parseMSSQLToJSONv2",
|
|
149
|
-
value: function parseMSSQLToJSONv2(str) {
|
|
150
|
-
return (0, _ASTGeneration.parse)(str, 'mssql');
|
|
151
|
-
}
|
|
152
142
|
}, {
|
|
153
143
|
key: "parseSnowflakeToJSON",
|
|
154
144
|
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.11.0
|
|
3
|
+
"version": "3.11.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.11.0
|
|
35
|
+
"@dbml/parse": "^3.11.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": "eb05b8cd85092e62152c6a994d9c0568a1d898de",
|
|
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,19 +16,6 @@ export interface Project {
|
|
|
16
16
|
database_type: string;
|
|
17
17
|
name: string;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
export interface Records {
|
|
21
|
-
[tableSchemaName: string]: {
|
|
22
|
-
schemaName: string | undefined;
|
|
23
|
-
tableName: string;
|
|
24
|
-
columns: string[];
|
|
25
|
-
values: {
|
|
26
|
-
value: any;
|
|
27
|
-
type: string;
|
|
28
|
-
}[];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
19
|
export interface RawDatabase {
|
|
33
20
|
schemas: Schema[];
|
|
34
21
|
tables: Table[];
|
|
@@ -37,7 +24,6 @@ export interface RawDatabase {
|
|
|
37
24
|
refs: Ref[];
|
|
38
25
|
tableGroups: TableGroup[];
|
|
39
26
|
project: Project;
|
|
40
|
-
records: Records;
|
|
41
27
|
}
|
|
42
28
|
declare class Database extends Element {
|
|
43
29
|
dbState: DbState;
|
|
@@ -49,7 +35,7 @@ declare class Database extends Element {
|
|
|
49
35
|
databaseType: string;
|
|
50
36
|
name: string;
|
|
51
37
|
id: number;
|
|
52
|
-
constructor({ schemas, tables, enums, refs, tableGroups, project
|
|
38
|
+
constructor({ schemas, tables, enums, refs, tableGroups, project }: RawDatabase);
|
|
53
39
|
generateId(): void;
|
|
54
40
|
processSchemas(rawSchemas: RawSchema[]): void;
|
|
55
41
|
pushSchema(schema: Schema): void;
|
|
@@ -224,6 +210,5 @@ export interface NormalizedDatabase {
|
|
|
224
210
|
indexes: NormalizedIndex;
|
|
225
211
|
indexColumns: NormalizedIndexColumn;
|
|
226
212
|
fields: NormalizedField;
|
|
227
|
-
records: Records;
|
|
228
213
|
}
|
|
229
214
|
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
|