@dbml/core 3.13.5 → 3.13.6
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 +8 -10
- package/lib/export/JsonExporter.js +8 -10
- package/lib/export/ModelExporter.js +9 -11
- package/lib/export/MysqlExporter.js +14 -16
- package/lib/export/OracleExporter.js +17 -19
- package/lib/export/PostgresExporter.js +16 -18
- package/lib/export/README.md +0 -0
- package/lib/export/SqlServerExporter.js +14 -16
- package/lib/export/index.js +3 -4
- package/lib/export/utils.js +4 -0
- package/lib/import/index.js +3 -4
- package/lib/index.js +1 -1
- package/lib/model_structure/config.js +6 -12
- package/lib/model_structure/database.js +22 -26
- package/lib/model_structure/dbState.js +9 -11
- package/lib/model_structure/element.js +22 -25
- package/lib/model_structure/endpoint.js +26 -29
- package/lib/model_structure/enum.js +21 -24
- package/lib/model_structure/enumValue.js +21 -24
- package/lib/model_structure/field.js +21 -24
- package/lib/model_structure/indexColumn.js +21 -24
- package/lib/model_structure/indexes.js +21 -24
- package/lib/model_structure/ref.js +21 -24
- package/lib/model_structure/schema.js +21 -24
- package/lib/model_structure/stickyNote.js +21 -24
- package/lib/model_structure/table.js +26 -29
- package/lib/model_structure/tableGroup.js +21 -24
- package/lib/model_structure/tablePartial.js +21 -24
- package/lib/model_structure/utils.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/AST.js +21 -35
- package/lib/parse/ANTLR/ASTGeneration/ParserErrorListener.js +19 -22
- package/lib/parse/ANTLR/ASTGeneration/SyntaxError.js +21 -23
- package/lib/parse/ANTLR/ASTGeneration/constants.js +5 -9
- package/lib/parse/ANTLR/ASTGeneration/helpers.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/index.js +1 -1
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +55 -58
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +54 -58
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLLexerBase.js +17 -19
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLParserBase.js +17 -19
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.js +38 -42
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +28 -31
- 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 +19 -21
- 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 +2 -2
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.js +19 -22
- 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 +19 -21
- 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 +2 -2
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.js +19 -22
- 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 +20 -23
- 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 +2 -2
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserVisitor.js +19 -22
- 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 +19 -21
- 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 +2 -2
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParserVisitor.js +19 -22
- package/lib/parse/Parser.js +9 -11
- package/lib/parse/buildParser.js +6 -6
- package/lib/parse/databaseGenerator.js +3 -4
- package/lib/parse/dbml/parser.pegjs +0 -0
- package/lib/parse/dbmlParser.js +11 -11
- package/lib/parse/error.js +8 -10
- 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 +6 -7
- 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 +5 -5
- 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 +6 -6
- 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 +1 -1
- package/lib/parse/mssql/whitespaces.js +0 -0
- package/lib/parse/mssqlParser.js +2 -3
- package/lib/parse/mysql/parser.pegjs +0 -0
- package/lib/parse/mysqlParser.js +11 -11
- package/lib/parse/postgresParser.js +1 -1
- 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 +1 -1
- package/lib/parse/postgresql/parser.pegjs +0 -0
- package/lib/parse/schemarb/parser.pegjs +0 -0
- package/lib/parse/schemarbParser.js +8 -10
- package/lib/utils/version.js +1 -2
- 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 +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/model_structure/tablePartial.d.ts +0 -0
- package/types/parse/Parser.d.ts +0 -0
- package/types/parse/error.d.ts +0 -0
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
-
function _defineProperties(
|
|
9
|
-
function _createClass(
|
|
10
|
-
function _toPropertyKey(
|
|
11
|
-
function _toPrimitive(
|
|
12
|
-
function _classCallCheck(
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function _wrapNativeSuper(
|
|
18
|
-
function _construct(
|
|
19
|
-
function _isNativeReflectConstruct() {
|
|
20
|
-
function _isNativeFunction(
|
|
21
|
-
function _setPrototypeOf(
|
|
22
|
-
function _getPrototypeOf(
|
|
23
|
-
var SyntaxError = /*#__PURE__*/function (_Error) {
|
|
24
|
-
_inherits(SyntaxError, _Error);
|
|
25
|
-
var _super = _createSuper(SyntaxError);
|
|
8
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
9
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
10
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
11
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
13
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
14
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
15
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
16
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
17
|
+
function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
|
|
18
|
+
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
|
|
21
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
22
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
23
|
+
var SyntaxError = exports["default"] = /*#__PURE__*/function (_Error) {
|
|
26
24
|
function SyntaxError(line, column, msg) {
|
|
27
25
|
var _this;
|
|
28
26
|
_classCallCheck(this, SyntaxError);
|
|
29
|
-
_this =
|
|
27
|
+
_this = _callSuper(this, SyntaxError, [msg]);
|
|
30
28
|
// maintain proper stack trace
|
|
31
29
|
if (Error.captureStackTrace) {
|
|
32
|
-
Error.captureStackTrace(
|
|
30
|
+
Error.captureStackTrace(_this, SyntaxError);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
// These properies names and structures are needed by other app (for example dbdiagram) to display error.
|
|
@@ -42,6 +40,6 @@ var SyntaxError = /*#__PURE__*/function (_Error) {
|
|
|
42
40
|
};
|
|
43
41
|
return _this;
|
|
44
42
|
}
|
|
43
|
+
_inherits(SyntaxError, _Error);
|
|
45
44
|
return _createClass(SyntaxError);
|
|
46
|
-
}(
|
|
47
|
-
exports["default"] = SyntaxError;
|
|
45
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TABLE_CONSTRAINT_KIND = exports.DATA_TYPE = exports.CONSTRAINT_TYPE = exports.COLUMN_CONSTRAINT_KIND = void 0;
|
|
7
|
-
var TABLE_CONSTRAINT_KIND = {
|
|
7
|
+
var TABLE_CONSTRAINT_KIND = exports.TABLE_CONSTRAINT_KIND = {
|
|
8
8
|
FIELD: 'field',
|
|
9
9
|
INDEX: 'index',
|
|
10
10
|
FK: 'fk',
|
|
@@ -12,8 +12,7 @@ var TABLE_CONSTRAINT_KIND = {
|
|
|
12
12
|
PK: 'pk',
|
|
13
13
|
DEFAULT: 'default'
|
|
14
14
|
};
|
|
15
|
-
exports.
|
|
16
|
-
var COLUMN_CONSTRAINT_KIND = {
|
|
15
|
+
var COLUMN_CONSTRAINT_KIND = exports.COLUMN_CONSTRAINT_KIND = {
|
|
17
16
|
NOT_NULL: 'not_null',
|
|
18
17
|
UNIQUE: 'unique',
|
|
19
18
|
PK: 'pk',
|
|
@@ -23,8 +22,7 @@ var COLUMN_CONSTRAINT_KIND = {
|
|
|
23
22
|
NOTE: 'note',
|
|
24
23
|
CHECK: 'check'
|
|
25
24
|
};
|
|
26
|
-
exports.
|
|
27
|
-
var DATA_TYPE = {
|
|
25
|
+
var DATA_TYPE = exports.DATA_TYPE = {
|
|
28
26
|
STRING: 'string',
|
|
29
27
|
NUMBER: 'number',
|
|
30
28
|
BOOLEAN: 'boolean',
|
|
@@ -32,10 +30,8 @@ var DATA_TYPE = {
|
|
|
32
30
|
};
|
|
33
31
|
|
|
34
32
|
// legacy - for compatibility with model_structure
|
|
35
|
-
exports.
|
|
36
|
-
var CONSTRAINT_TYPE = {
|
|
33
|
+
var CONSTRAINT_TYPE = exports.CONSTRAINT_TYPE = {
|
|
37
34
|
COLUMN: 'column',
|
|
38
35
|
STRING: 'string',
|
|
39
36
|
EXPRESSION: 'expression'
|
|
40
|
-
};
|
|
41
|
-
exports.CONSTRAINT_TYPE = CONSTRAINT_TYPE;
|
|
37
|
+
};
|
|
File without changes
|
|
@@ -18,7 +18,7 @@ var _ParserErrorListener = _interopRequireDefault(require("./ParserErrorListener
|
|
|
18
18
|
var _TSqlLexer = _interopRequireDefault(require("../parsers/mssql/TSqlLexer"));
|
|
19
19
|
var _TSqlParser = _interopRequireDefault(require("../parsers/mssql/TSqlParser"));
|
|
20
20
|
var _MssqlASTGen = _interopRequireDefault(require("./mssql/MssqlASTGen"));
|
|
21
|
-
function _interopRequireDefault(
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
22
22
|
/* eslint-disable import/no-named-as-default-member */
|
|
23
23
|
/* eslint-disable import/no-named-as-default */
|
|
24
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -10,29 +10,29 @@ var _TSqlParserVisitor2 = _interopRequireDefault(require("../../parsers/mssql/TS
|
|
|
10
10
|
var _constants = require("../constants");
|
|
11
11
|
var _helpers = require("../helpers");
|
|
12
12
|
var _AST = require("../AST");
|
|
13
|
-
function _interopRequireDefault(
|
|
14
|
-
function _classCallCheck(
|
|
15
|
-
function _defineProperties(
|
|
16
|
-
function _createClass(
|
|
17
|
-
function _toPropertyKey(
|
|
18
|
-
function _toPrimitive(
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function _toConsumableArray(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
21
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
22
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
24
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
25
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
26
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
27
27
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
-
function _iterableToArray(
|
|
29
|
-
function _arrayWithoutHoles(
|
|
30
|
-
function _slicedToArray(
|
|
28
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
29
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
30
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
31
31
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
32
|
-
function _unsupportedIterableToArray(
|
|
33
|
-
function _arrayLikeToArray(
|
|
34
|
-
function _iterableToArrayLimit(
|
|
35
|
-
function _arrayWithHoles(
|
|
32
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
33
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
34
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
35
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /* eslint-disable class-methods-use-this */
|
|
36
36
|
var ADD_DESCRIPTION_FUNCTION_NAME = 'sp_addextendedproperty';
|
|
37
37
|
var CHECK_CONSTRAINT_CONDITION_TYPE = {
|
|
38
38
|
RAW: 'raw',
|
|
@@ -126,13 +126,11 @@ var parseFieldsAndInlineRefsFromFieldsData = function parseFieldsAndInlineRefsFr
|
|
|
126
126
|
checkConstraints: checkConstraints
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
|
-
var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
130
|
-
_inherits(MssqlASTGen, _TSqlParserVisitor);
|
|
131
|
-
var _super = _createSuper(MssqlASTGen);
|
|
129
|
+
var MssqlASTGen = exports["default"] = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
132
130
|
function MssqlASTGen() {
|
|
133
131
|
var _this;
|
|
134
132
|
_classCallCheck(this, MssqlASTGen);
|
|
135
|
-
_this =
|
|
133
|
+
_this = _callSuper(this, MssqlASTGen);
|
|
136
134
|
_this.data = {
|
|
137
135
|
schemas: [],
|
|
138
136
|
tables: [],
|
|
@@ -150,7 +148,8 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
150
148
|
// : batch* EOF
|
|
151
149
|
// | execute_body_batch go_statement* EOF
|
|
152
150
|
// ;
|
|
153
|
-
|
|
151
|
+
_inherits(MssqlASTGen, _TSqlParserVisitor);
|
|
152
|
+
return _createClass(MssqlASTGen, [{
|
|
154
153
|
key: "visitTsql_file",
|
|
155
154
|
value: function visitTsql_file(ctx) {
|
|
156
155
|
var _this2 = this;
|
|
@@ -663,9 +662,9 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
663
662
|
}, {
|
|
664
663
|
key: "visitColumn_def_table_constraints",
|
|
665
664
|
value: function visitColumn_def_table_constraints(ctx) {
|
|
666
|
-
var
|
|
665
|
+
var _this0 = this;
|
|
667
666
|
return ctx.column_def_table_constraint().map(function (columnDef) {
|
|
668
|
-
return columnDef.accept(
|
|
667
|
+
return columnDef.accept(_this0);
|
|
669
668
|
}).filter(function (columnDef) {
|
|
670
669
|
return columnDef;
|
|
671
670
|
});
|
|
@@ -694,7 +693,7 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
694
693
|
}, {
|
|
695
694
|
key: "visitColumn_definition",
|
|
696
695
|
value: function visitColumn_definition(ctx) {
|
|
697
|
-
var
|
|
696
|
+
var _this1 = this;
|
|
698
697
|
var columnName = ctx.id_().accept(this);
|
|
699
698
|
var type = '';
|
|
700
699
|
if (ctx.data_type()) {
|
|
@@ -722,7 +721,7 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
722
721
|
}
|
|
723
722
|
};
|
|
724
723
|
var columnDefinitions = ctx.column_definition_element().map(function (columnDef) {
|
|
725
|
-
return columnDef.accept(
|
|
724
|
+
return columnDef.accept(_this1);
|
|
726
725
|
});
|
|
727
726
|
|
|
728
727
|
// e.g.
|
|
@@ -932,11 +931,11 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
932
931
|
}, {
|
|
933
932
|
key: "visitPredicate",
|
|
934
933
|
value: function visitPredicate(ctx) {
|
|
935
|
-
var
|
|
934
|
+
var _this10 = this;
|
|
936
935
|
if (ctx.IN() && ctx.expression_list_() && ctx.NOT().length === 0) {
|
|
937
936
|
var _expression$value;
|
|
938
937
|
var _ctx$expression$map = ctx.expression().map(function (e) {
|
|
939
|
-
return e.accept(
|
|
938
|
+
return e.accept(_this10);
|
|
940
939
|
}),
|
|
941
940
|
_ctx$expression$map2 = _slicedToArray(_ctx$expression$map, 1),
|
|
942
941
|
_ctx$expression$map2$ = _ctx$expression$map2[0],
|
|
@@ -971,17 +970,17 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
971
970
|
}, {
|
|
972
971
|
key: "visitForeign_key_options",
|
|
973
972
|
value: function visitForeign_key_options(ctx) {
|
|
974
|
-
var
|
|
973
|
+
var _this11 = this;
|
|
975
974
|
var names = ctx.table_name().accept(this);
|
|
976
975
|
var _getSchemaAndTableNam2 = getSchemaAndTableName(names),
|
|
977
976
|
refSchemaName = _getSchemaAndTableNam2.schemaName,
|
|
978
977
|
refTableName = _getSchemaAndTableNam2.tableName;
|
|
979
978
|
var fieldNames = ctx.column_name_list().accept(this);
|
|
980
979
|
var onDelete = ctx.on_delete() ? ctx.on_delete().map(function (action) {
|
|
981
|
-
return action.accept(
|
|
980
|
+
return action.accept(_this11);
|
|
982
981
|
})[0] : null;
|
|
983
982
|
var onUpdate = ctx.on_update() ? ctx.on_update().map(function (action) {
|
|
984
|
-
return action.accept(
|
|
983
|
+
return action.accept(_this11);
|
|
985
984
|
})[0] : null;
|
|
986
985
|
return {
|
|
987
986
|
refTableName: refTableName,
|
|
@@ -998,9 +997,9 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
998
997
|
}, {
|
|
999
998
|
key: "visitColumn_name_list",
|
|
1000
999
|
value: function visitColumn_name_list(ctx) {
|
|
1001
|
-
var
|
|
1000
|
+
var _this12 = this;
|
|
1002
1001
|
return ctx.id_().map(function (id) {
|
|
1003
|
-
return id.accept(
|
|
1002
|
+
return id.accept(_this12);
|
|
1004
1003
|
});
|
|
1005
1004
|
}
|
|
1006
1005
|
|
|
@@ -1052,9 +1051,9 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1052
1051
|
}, {
|
|
1053
1052
|
key: "visitTable_constraint",
|
|
1054
1053
|
value: function visitTable_constraint(ctx) {
|
|
1055
|
-
var
|
|
1054
|
+
var _this13 = this;
|
|
1056
1055
|
var name = ctx.id_() ? ctx.id_().map(function (id) {
|
|
1057
|
-
return id.accept(
|
|
1056
|
+
return id.accept(_this13);
|
|
1058
1057
|
})[0] : '';
|
|
1059
1058
|
if (ctx.PRIMARY() || ctx.UNIQUE()) {
|
|
1060
1059
|
var columns = ctx.column_name_list_with_order().accept(this);
|
|
@@ -1129,10 +1128,10 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1129
1128
|
}, {
|
|
1130
1129
|
key: "visitColumn_name_list_with_order",
|
|
1131
1130
|
value: function visitColumn_name_list_with_order(ctx) {
|
|
1132
|
-
var
|
|
1131
|
+
var _this14 = this;
|
|
1133
1132
|
return ctx.id_().map(function (id) {
|
|
1134
1133
|
return {
|
|
1135
|
-
value: id.accept(
|
|
1134
|
+
value: id.accept(_this14),
|
|
1136
1135
|
type: 'column'
|
|
1137
1136
|
};
|
|
1138
1137
|
});
|
|
@@ -1148,10 +1147,10 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1148
1147
|
}, {
|
|
1149
1148
|
key: "visitTable_indices",
|
|
1150
1149
|
value: function visitTable_indices(ctx) {
|
|
1151
|
-
var
|
|
1150
|
+
var _this15 = this;
|
|
1152
1151
|
var index = new _AST.Index({
|
|
1153
1152
|
name: ctx.id_().map(function (id) {
|
|
1154
|
-
return id.accept(
|
|
1153
|
+
return id.accept(_this15);
|
|
1155
1154
|
})[0],
|
|
1156
1155
|
unique: !!ctx.UNIQUE(),
|
|
1157
1156
|
columns: ctx.column_name_list_with_order().accept(this)
|
|
@@ -1185,7 +1184,7 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1185
1184
|
_this$data$refs4,
|
|
1186
1185
|
_table$fields,
|
|
1187
1186
|
_table$indexes,
|
|
1188
|
-
|
|
1187
|
+
_this16 = this;
|
|
1189
1188
|
// table_name() returns an array because there are multiple table_name in the clause (REFERENCES table_name ...)
|
|
1190
1189
|
var names = ctx.table_name()[0].accept(this);
|
|
1191
1190
|
var _getSchemaAndTableNam3 = getSchemaAndTableName(names),
|
|
@@ -1235,7 +1234,7 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1235
1234
|
}),
|
|
1236
1235
|
schemaName: schemaName
|
|
1237
1236
|
});
|
|
1238
|
-
|
|
1237
|
+
_this16.data.enums.push(enumObject);
|
|
1239
1238
|
// TODO: handle multiple enums for the same field
|
|
1240
1239
|
field.type.type_name = enumObject.name;
|
|
1241
1240
|
field.type.schemaName = enumObject.schemaName;
|
|
@@ -1382,12 +1381,12 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1382
1381
|
}, {
|
|
1383
1382
|
key: "visitFunc_proc_name_server_database_schema",
|
|
1384
1383
|
value: function visitFunc_proc_name_server_database_schema(ctx) {
|
|
1385
|
-
var
|
|
1384
|
+
var _this17 = this;
|
|
1386
1385
|
if (ctx.func_proc_name_database_schema()) {
|
|
1387
1386
|
return ctx.func_proc_name_database_schema().accept(this);
|
|
1388
1387
|
}
|
|
1389
1388
|
return ctx.id_().map(function (id) {
|
|
1390
|
-
return id.accept(
|
|
1389
|
+
return id.accept(_this17);
|
|
1391
1390
|
});
|
|
1392
1391
|
}
|
|
1393
1392
|
|
|
@@ -1398,12 +1397,12 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1398
1397
|
}, {
|
|
1399
1398
|
key: "visitFunc_proc_name_database_schema",
|
|
1400
1399
|
value: function visitFunc_proc_name_database_schema(ctx) {
|
|
1401
|
-
var
|
|
1400
|
+
var _this18 = this;
|
|
1402
1401
|
if (ctx.func_proc_name_schema()) {
|
|
1403
1402
|
return ctx.func_proc_name_schema().accept(this);
|
|
1404
1403
|
}
|
|
1405
1404
|
return ctx.id_().map(function (id) {
|
|
1406
|
-
return id.accept(
|
|
1405
|
+
return id.accept(_this18);
|
|
1407
1406
|
});
|
|
1408
1407
|
}
|
|
1409
1408
|
|
|
@@ -1413,9 +1412,9 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1413
1412
|
}, {
|
|
1414
1413
|
key: "visitFunc_proc_name_schema",
|
|
1415
1414
|
value: function visitFunc_proc_name_schema(ctx) {
|
|
1416
|
-
var
|
|
1415
|
+
var _this19 = this;
|
|
1417
1416
|
return ctx.id_().map(function (id) {
|
|
1418
|
-
return id.accept(
|
|
1417
|
+
return id.accept(_this19);
|
|
1419
1418
|
});
|
|
1420
1419
|
}
|
|
1421
1420
|
|
|
@@ -1426,14 +1425,14 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1426
1425
|
}, {
|
|
1427
1426
|
key: "visitExecute_statement_arg",
|
|
1428
1427
|
value: function visitExecute_statement_arg(ctx) {
|
|
1429
|
-
var
|
|
1428
|
+
var _this20 = this;
|
|
1430
1429
|
if (ctx.execute_statement_arg_unnamed()) {
|
|
1431
1430
|
return ctx.execute_statement_arg_unnamed().map(function (item) {
|
|
1432
|
-
return item.accept(
|
|
1431
|
+
return item.accept(_this20);
|
|
1433
1432
|
});
|
|
1434
1433
|
}
|
|
1435
1434
|
return ctx.execute_statement_arg_named().map(function (item) {
|
|
1436
|
-
return item.accept(
|
|
1435
|
+
return item.accept(_this20);
|
|
1437
1436
|
});
|
|
1438
1437
|
}
|
|
1439
1438
|
|
|
@@ -1501,6 +1500,4 @@ var MssqlASTGen = /*#__PURE__*/function (_TSqlParserVisitor) {
|
|
|
1501
1500
|
};
|
|
1502
1501
|
}
|
|
1503
1502
|
}]);
|
|
1504
|
-
|
|
1505
|
-
}(_TSqlParserVisitor2["default"]);
|
|
1506
|
-
exports["default"] = MssqlASTGen;
|
|
1503
|
+
}(_TSqlParserVisitor2["default"]);
|