@dbml/core 2.5.2 → 2.5.4
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/README.md +1 -1
- package/lib/export/DbmlExporter.js +9 -64
- package/lib/export/JsonExporter.js +5 -11
- package/lib/export/ModelExporter.js +5 -22
- package/lib/export/MysqlExporter.js +8 -70
- package/lib/export/PostgresExporter.js +11 -80
- package/lib/export/SqlServerExporter.js +10 -71
- package/lib/export/index.js +0 -6
- package/lib/export/utils.js +2 -12
- package/lib/import/index.js +0 -7
- package/lib/index.js +4 -9
- package/lib/model_structure/config.js +1 -1
- package/lib/model_structure/database.js +32 -83
- package/lib/model_structure/dbState.js +5 -10
- package/lib/model_structure/element.js +13 -38
- package/lib/model_structure/endpoint.js +22 -68
- package/lib/model_structure/enum.js +18 -49
- package/lib/model_structure/enumValue.js +17 -44
- package/lib/model_structure/field.js +26 -62
- package/lib/model_structure/indexColumn.js +15 -40
- package/lib/model_structure/indexes.js +22 -50
- package/lib/model_structure/ref.js +24 -56
- package/lib/model_structure/schema.js +27 -65
- package/lib/model_structure/table.js +24 -59
- package/lib/model_structure/tableGroup.js +18 -49
- package/lib/model_structure/utils.js +0 -3
- package/lib/parse/Parser.js +5 -27
- package/lib/parse/buildParser.js +11 -23
- package/lib/parse/dbmlParser.js +863 -2131
- package/lib/parse/mssql/base_parsers.js +2 -11
- package/lib/parse/mssql/column_definition/actions.js +0 -3
- package/lib/parse/mssql/column_definition/index.js +9 -17
- package/lib/parse/mssql/constraint_definition/actions.js +6 -12
- package/lib/parse/mssql/constraint_definition/index.js +13 -21
- package/lib/parse/mssql/expression.js +6 -16
- package/lib/parse/mssql/fk_definition/actions.js +1 -12
- package/lib/parse/mssql/fk_definition/index.js +5 -10
- package/lib/parse/mssql/index.js +2 -4
- package/lib/parse/mssql/index_definition/actions.js +0 -6
- package/lib/parse/mssql/index_definition/index.js +8 -13
- package/lib/parse/mssql/keyword_parsers.js +2 -3
- package/lib/parse/mssql/keyword_utils.js +0 -4
- package/lib/parse/mssql/statements/actions.js +0 -24
- package/lib/parse/mssql/statements/index.js +1 -7
- package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +3 -10
- package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +2 -6
- package/lib/parse/mssql/statements/statement_types/alter_table/add/index.js +9 -18
- package/lib/parse/mssql/statements/statement_types/alter_table/index.js +2 -7
- package/lib/parse/mssql/statements/statement_types/comments/actions.js +3 -11
- package/lib/parse/mssql/statements/statement_types/comments/index.js +3 -13
- package/lib/parse/mssql/statements/statement_types/create_index/actions.js +1 -3
- package/lib/parse/mssql/statements/statement_types/create_index/index.js +9 -15
- package/lib/parse/mssql/statements/statement_types/create_table/actions.js +7 -18
- package/lib/parse/mssql/statements/statement_types/create_table/index.js +8 -16
- package/lib/parse/mssql/statements/statement_types/index.js +0 -4
- package/lib/parse/mssql/utils.js +4 -14
- package/lib/parse/mssql/whitespaces.js +0 -1
- package/lib/parse/mssqlParser.js +0 -3
- package/lib/parse/mysqlParser.js +822 -2395
- package/lib/parse/postgresParser.js +3 -3
- package/lib/parse/postgresql/get_parser.js +6 -9
- package/lib/parse/schemarbParser.js +219 -714
- package/package.json +11 -12
- package/types/.DS_Store +0 -0
|
@@ -1,69 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _element = _interopRequireDefault(require("./element"));
|
|
9
|
-
|
|
10
9
|
var _enumValue = _interopRequireDefault(require("./enumValue"));
|
|
11
|
-
|
|
12
10
|
var _utils = require("./utils");
|
|
13
|
-
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
-
|
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
-
|
|
16
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
34
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
|
-
|
|
36
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
|
-
|
|
23
|
+
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); }
|
|
38
24
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
25
|
+
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; } }
|
|
26
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
44
27
|
var Enum = /*#__PURE__*/function (_Element) {
|
|
45
28
|
_inherits(Enum, _Element);
|
|
46
|
-
|
|
47
29
|
var _super = _createSuper(Enum);
|
|
48
|
-
|
|
49
30
|
function Enum() {
|
|
50
31
|
var _this;
|
|
51
|
-
|
|
52
32
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
33
|
+
name = _ref.name,
|
|
34
|
+
token = _ref.token,
|
|
35
|
+
values = _ref.values,
|
|
36
|
+
note = _ref.note,
|
|
37
|
+
schema = _ref.schema;
|
|
59
38
|
_classCallCheck(this, Enum);
|
|
60
|
-
|
|
61
39
|
_this = _super.call(this, token);
|
|
62
|
-
|
|
63
40
|
if (!name) {
|
|
64
41
|
_this.error('Enum must have a name');
|
|
65
42
|
}
|
|
66
|
-
|
|
67
43
|
_this.name = name;
|
|
68
44
|
_this.note = note ? note.value : null;
|
|
69
45
|
_this.noteToken = note ? note.token : null;
|
|
@@ -71,14 +47,10 @@ var Enum = /*#__PURE__*/function (_Element) {
|
|
|
71
47
|
_this.fields = [];
|
|
72
48
|
_this.schema = schema;
|
|
73
49
|
_this.dbState = _this.schema.dbState;
|
|
74
|
-
|
|
75
50
|
_this.generateId();
|
|
76
|
-
|
|
77
51
|
_this.processValues(values);
|
|
78
|
-
|
|
79
52
|
return _this;
|
|
80
53
|
}
|
|
81
|
-
|
|
82
54
|
_createClass(Enum, [{
|
|
83
55
|
key: "generateId",
|
|
84
56
|
value: function generateId() {
|
|
@@ -88,7 +60,6 @@ var Enum = /*#__PURE__*/function (_Element) {
|
|
|
88
60
|
key: "processValues",
|
|
89
61
|
value: function processValues(rawValues) {
|
|
90
62
|
var _this2 = this;
|
|
91
|
-
|
|
92
63
|
rawValues.forEach(function (value) {
|
|
93
64
|
_this2.pushValue(new _enumValue["default"](_objectSpread(_objectSpread({}, value), {}, {
|
|
94
65
|
_enum: _this2
|
|
@@ -177,9 +148,7 @@ var Enum = /*#__PURE__*/function (_Element) {
|
|
|
177
148
|
});
|
|
178
149
|
}
|
|
179
150
|
}]);
|
|
180
|
-
|
|
181
151
|
return Enum;
|
|
182
152
|
}(_element["default"]);
|
|
183
|
-
|
|
184
153
|
var _default = Enum;
|
|
185
154
|
exports["default"] = _default;
|
|
@@ -1,75 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _element = _interopRequireDefault(require("./element"));
|
|
9
|
-
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
18
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
-
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
-
|
|
14
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
|
-
|
|
32
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
33
|
-
|
|
21
|
+
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); }
|
|
34
22
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
-
|
|
23
|
+
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; } }
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
40
25
|
var EnumValue = /*#__PURE__*/function (_Element) {
|
|
41
26
|
_inherits(EnumValue, _Element);
|
|
42
|
-
|
|
43
27
|
var _super = _createSuper(EnumValue);
|
|
44
|
-
|
|
45
28
|
function EnumValue() {
|
|
46
29
|
var _this;
|
|
47
|
-
|
|
48
30
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
31
|
+
name = _ref.name,
|
|
32
|
+
token = _ref.token,
|
|
33
|
+
note = _ref.note,
|
|
34
|
+
_enum = _ref._enum;
|
|
54
35
|
_classCallCheck(this, EnumValue);
|
|
55
|
-
|
|
56
36
|
_this = _super.call(this, token);
|
|
57
|
-
|
|
58
37
|
if (!name) {
|
|
59
38
|
_this.error('Enum value must have a name');
|
|
60
39
|
}
|
|
61
|
-
|
|
62
40
|
_this.name = name;
|
|
63
41
|
_this.note = note ? note.value : null;
|
|
64
42
|
_this.noteToken = note ? note.token : null;
|
|
65
43
|
_this._enum = _enum;
|
|
66
44
|
_this.dbState = _this._enum.dbState;
|
|
67
|
-
|
|
68
45
|
_this.generateId();
|
|
69
|
-
|
|
70
46
|
return _this;
|
|
71
47
|
}
|
|
72
|
-
|
|
73
48
|
_createClass(EnumValue, [{
|
|
74
49
|
key: "generateId",
|
|
75
50
|
value: function generateId() {
|
|
@@ -103,9 +78,7 @@ var EnumValue = /*#__PURE__*/function (_Element) {
|
|
|
103
78
|
}, this.shallowExport()), this.exportParentIds())));
|
|
104
79
|
}
|
|
105
80
|
}]);
|
|
106
|
-
|
|
107
81
|
return EnumValue;
|
|
108
82
|
}(_element["default"]);
|
|
109
|
-
|
|
110
83
|
var _default = EnumValue;
|
|
111
84
|
exports["default"] = _default;
|
|
@@ -1,79 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _element = _interopRequireDefault(require("./element"));
|
|
9
|
-
|
|
10
9
|
var _config = require("./config");
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
-
|
|
20
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
-
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
15
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
32
21
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
-
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
22
|
+
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); }
|
|
36
23
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
24
|
+
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; } }
|
|
25
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
26
|
var Field = /*#__PURE__*/function (_Element) {
|
|
43
27
|
_inherits(Field, _Element);
|
|
44
|
-
|
|
45
28
|
var _super = _createSuper(Field);
|
|
46
|
-
|
|
47
29
|
function Field() {
|
|
48
30
|
var _this;
|
|
49
|
-
|
|
50
31
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
32
|
+
name = _ref.name,
|
|
33
|
+
type = _ref.type,
|
|
34
|
+
unique = _ref.unique,
|
|
35
|
+
pk = _ref.pk,
|
|
36
|
+
token = _ref.token,
|
|
37
|
+
notNull = _ref.not_null,
|
|
38
|
+
note = _ref.note,
|
|
39
|
+
dbdefault = _ref.dbdefault,
|
|
40
|
+
increment = _ref.increment,
|
|
41
|
+
_ref$table = _ref.table,
|
|
42
|
+
table = _ref$table === void 0 ? {} : _ref$table;
|
|
63
43
|
_classCallCheck(this, Field);
|
|
64
|
-
|
|
65
44
|
_this = _super.call(this, token);
|
|
66
|
-
|
|
67
45
|
if (!name) {
|
|
68
46
|
_this.error('Field must have a name');
|
|
69
47
|
}
|
|
70
|
-
|
|
71
48
|
if (!type) {
|
|
72
49
|
_this.error('Field must have a type');
|
|
73
50
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
51
|
+
_this.name = name;
|
|
52
|
+
// type : { type_name, value, schemaName }
|
|
77
53
|
_this.type = type;
|
|
78
54
|
_this.unique = unique;
|
|
79
55
|
_this.pk = pk;
|
|
@@ -85,14 +61,10 @@ var Field = /*#__PURE__*/function (_Element) {
|
|
|
85
61
|
_this.endpoints = [];
|
|
86
62
|
_this.table = table;
|
|
87
63
|
_this.dbState = _this.table.dbState;
|
|
88
|
-
|
|
89
64
|
_this.generateId();
|
|
90
|
-
|
|
91
65
|
_this.bindType();
|
|
92
|
-
|
|
93
66
|
return _this;
|
|
94
67
|
}
|
|
95
|
-
|
|
96
68
|
_createClass(Field, [{
|
|
97
69
|
key: "generateId",
|
|
98
70
|
value: function generateId() {
|
|
@@ -103,24 +75,18 @@ var Field = /*#__PURE__*/function (_Element) {
|
|
|
103
75
|
value: function bindType() {
|
|
104
76
|
var typeName = this.type.type_name;
|
|
105
77
|
var typeSchemaName = this.type.schemaName || _config.DEFAULT_SCHEMA_NAME;
|
|
106
|
-
|
|
107
78
|
if (this.type.schemaName) {
|
|
108
79
|
var _enum = this.table.schema.database.findEnum(typeSchemaName, typeName);
|
|
109
|
-
|
|
110
80
|
if (!_enum) {
|
|
111
81
|
this.error("Cannot find type ".concat(typeSchemaName, " in schema ").concat(typeSchemaName));
|
|
112
82
|
return;
|
|
113
83
|
}
|
|
114
|
-
|
|
115
84
|
this._enum = _enum;
|
|
116
|
-
|
|
117
85
|
_enum.pushField(this);
|
|
118
86
|
} else {
|
|
119
87
|
var _enum2 = this.table.schema.database.findEnum(typeSchemaName, typeName);
|
|
120
|
-
|
|
121
88
|
if (!_enum2) return;
|
|
122
89
|
this._enum = _enum2;
|
|
123
|
-
|
|
124
90
|
_enum2.pushField(this);
|
|
125
91
|
}
|
|
126
92
|
}
|
|
@@ -173,9 +139,7 @@ var Field = /*#__PURE__*/function (_Element) {
|
|
|
173
139
|
}, this.shallowExport()), this.exportChildIds()), this.exportParentIds())));
|
|
174
140
|
}
|
|
175
141
|
}]);
|
|
176
|
-
|
|
177
142
|
return Field;
|
|
178
143
|
}(_element["default"]);
|
|
179
|
-
|
|
180
144
|
var _default = Field;
|
|
181
145
|
exports["default"] = _default;
|
|
@@ -1,67 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
8
|
var _element = _interopRequireDefault(require("./element"));
|
|
9
|
-
|
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
-
|
|
18
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
-
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
13
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
-
|
|
14
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
|
-
|
|
32
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
33
|
-
|
|
21
|
+
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); }
|
|
34
22
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
39
|
-
|
|
23
|
+
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; } }
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
40
25
|
var IndexColumn = /*#__PURE__*/function (_Element) {
|
|
41
26
|
_inherits(IndexColumn, _Element);
|
|
42
|
-
|
|
43
27
|
var _super = _createSuper(IndexColumn);
|
|
44
|
-
|
|
45
28
|
function IndexColumn(_ref) {
|
|
46
29
|
var _this;
|
|
47
|
-
|
|
48
30
|
var type = _ref.type,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
value = _ref.value,
|
|
32
|
+
index = _ref.index;
|
|
52
33
|
_classCallCheck(this, IndexColumn);
|
|
53
|
-
|
|
54
34
|
_this = _super.call(this);
|
|
55
35
|
_this.type = type;
|
|
56
36
|
_this.value = value;
|
|
57
37
|
_this.index = index;
|
|
58
38
|
_this.dbState = _this.index.dbState;
|
|
59
|
-
|
|
60
39
|
_this.generateId();
|
|
61
|
-
|
|
62
40
|
return _this;
|
|
63
41
|
}
|
|
64
|
-
|
|
65
42
|
_createClass(IndexColumn, [{
|
|
66
43
|
key: "generateId",
|
|
67
44
|
value: function generateId() {
|
|
@@ -95,9 +72,7 @@ var IndexColumn = /*#__PURE__*/function (_Element) {
|
|
|
95
72
|
}, this.shallowExport()), this.exportParentIds())));
|
|
96
73
|
}
|
|
97
74
|
}]);
|
|
98
|
-
|
|
99
75
|
return IndexColumn;
|
|
100
76
|
}(_element["default"]);
|
|
101
|
-
|
|
102
77
|
var _default = IndexColumn;
|
|
103
78
|
exports["default"] = _default;
|