@dbml/core 2.5.1 → 2.5.3

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.
Files changed (63) hide show
  1. package/lib/export/DbmlExporter.js +9 -64
  2. package/lib/export/JsonExporter.js +5 -11
  3. package/lib/export/ModelExporter.js +5 -22
  4. package/lib/export/MysqlExporter.js +10 -71
  5. package/lib/export/PostgresExporter.js +11 -80
  6. package/lib/export/SqlServerExporter.js +10 -71
  7. package/lib/export/index.js +0 -6
  8. package/lib/export/utils.js +2 -12
  9. package/lib/import/index.js +0 -7
  10. package/lib/index.js +4 -9
  11. package/lib/model_structure/config.js +1 -1
  12. package/lib/model_structure/database.js +32 -83
  13. package/lib/model_structure/dbState.js +5 -10
  14. package/lib/model_structure/element.js +13 -38
  15. package/lib/model_structure/endpoint.js +22 -68
  16. package/lib/model_structure/enum.js +18 -49
  17. package/lib/model_structure/enumValue.js +17 -44
  18. package/lib/model_structure/field.js +26 -62
  19. package/lib/model_structure/indexColumn.js +15 -40
  20. package/lib/model_structure/indexes.js +22 -50
  21. package/lib/model_structure/ref.js +24 -56
  22. package/lib/model_structure/schema.js +27 -65
  23. package/lib/model_structure/table.js +24 -59
  24. package/lib/model_structure/tableGroup.js +18 -49
  25. package/lib/model_structure/utils.js +0 -3
  26. package/lib/parse/Parser.js +5 -27
  27. package/lib/parse/buildParser.js +11 -23
  28. package/lib/parse/dbmlParser.js +863 -2131
  29. package/lib/parse/mssql/base_parsers.js +2 -11
  30. package/lib/parse/mssql/column_definition/actions.js +0 -3
  31. package/lib/parse/mssql/column_definition/index.js +9 -17
  32. package/lib/parse/mssql/constraint_definition/actions.js +6 -12
  33. package/lib/parse/mssql/constraint_definition/index.js +10 -18
  34. package/lib/parse/mssql/expression.js +6 -16
  35. package/lib/parse/mssql/fk_definition/actions.js +1 -12
  36. package/lib/parse/mssql/fk_definition/index.js +5 -10
  37. package/lib/parse/mssql/index.js +2 -4
  38. package/lib/parse/mssql/index_definition/actions.js +0 -6
  39. package/lib/parse/mssql/index_definition/index.js +8 -13
  40. package/lib/parse/mssql/keyword_parsers.js +2 -3
  41. package/lib/parse/mssql/keyword_utils.js +0 -4
  42. package/lib/parse/mssql/statements/actions.js +0 -24
  43. package/lib/parse/mssql/statements/index.js +1 -7
  44. package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +3 -10
  45. package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +2 -6
  46. package/lib/parse/mssql/statements/statement_types/alter_table/add/index.js +9 -18
  47. package/lib/parse/mssql/statements/statement_types/alter_table/index.js +2 -7
  48. package/lib/parse/mssql/statements/statement_types/comments/actions.js +3 -11
  49. package/lib/parse/mssql/statements/statement_types/comments/index.js +3 -13
  50. package/lib/parse/mssql/statements/statement_types/create_index/actions.js +1 -3
  51. package/lib/parse/mssql/statements/statement_types/create_index/index.js +9 -15
  52. package/lib/parse/mssql/statements/statement_types/create_table/actions.js +7 -18
  53. package/lib/parse/mssql/statements/statement_types/create_table/index.js +8 -16
  54. package/lib/parse/mssql/statements/statement_types/index.js +0 -4
  55. package/lib/parse/mssql/utils.js +4 -14
  56. package/lib/parse/mssql/whitespaces.js +0 -1
  57. package/lib/parse/mssqlParser.js +0 -3
  58. package/lib/parse/mysqlParser.js +822 -2395
  59. package/lib/parse/postgresParser.js +3 -3
  60. package/lib/parse/postgresql/get_parser.js +6 -9
  61. package/lib/parse/schemarbParser.js +219 -714
  62. package/package.json +10 -11
  63. package/types/.DS_Store +0 -0
@@ -1,65 +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
  var _indexColumn = _interopRequireDefault(require("./indexColumn"));
11
-
12
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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 _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, descriptor.key, descriptor); } }
25
-
26
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27
-
28
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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 Index = /*#__PURE__*/function (_Element) {
43
27
  _inherits(Index, _Element);
44
-
45
28
  var _super = _createSuper(Index);
46
-
47
29
  function Index() {
48
30
  var _this;
49
-
50
31
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
51
- columns = _ref.columns,
52
- type = _ref.type,
53
- unique = _ref.unique,
54
- pk = _ref.pk,
55
- token = _ref.token,
56
- name = _ref.name,
57
- note = _ref.note,
58
- _ref$table = _ref.table,
59
- table = _ref$table === void 0 ? {} : _ref$table;
60
-
32
+ columns = _ref.columns,
33
+ type = _ref.type,
34
+ unique = _ref.unique,
35
+ pk = _ref.pk,
36
+ token = _ref.token,
37
+ name = _ref.name,
38
+ note = _ref.note,
39
+ _ref$table = _ref.table,
40
+ table = _ref$table === void 0 ? {} : _ref$table;
61
41
  _classCallCheck(this, Index);
62
-
63
42
  _this = _super.call(this, token);
64
43
  _this.name = name;
65
44
  _this.type = type;
@@ -70,14 +49,10 @@ var Index = /*#__PURE__*/function (_Element) {
70
49
  _this.columns = [];
71
50
  _this.table = table;
72
51
  _this.dbState = _this.table.dbState;
73
-
74
52
  _this.generateId();
75
-
76
53
  _this.processIndexColumns(columns);
77
-
78
54
  return _this;
79
55
  }
80
-
81
56
  _createClass(Index, [{
82
57
  key: "generateId",
83
58
  value: function generateId() {
@@ -87,7 +62,6 @@ var Index = /*#__PURE__*/function (_Element) {
87
62
  key: "processIndexColumns",
88
63
  value: function processIndexColumns(rawColumns) {
89
64
  var _this2 = this;
90
-
91
65
  rawColumns.forEach(function (column) {
92
66
  _this2.pushIndexColumn(new _indexColumn["default"](_objectSpread(_objectSpread({}, column), {}, {
93
67
  index: _this2
@@ -161,9 +135,7 @@ var Index = /*#__PURE__*/function (_Element) {
161
135
  });
162
136
  }
163
137
  }]);
164
-
165
138
  return Index;
166
139
  }(_element["default"]);
167
-
168
140
  var _default = Index;
169
141
  exports["default"] = _default;
@@ -1,46 +1,29 @@
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 _endpoint = _interopRequireDefault(require("./endpoint"));
11
-
12
10
  var _config = require("./config");
13
-
14
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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 _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, descriptor.key, descriptor); } }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
29
-
30
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
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 _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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
  /**
45
28
  * Compare two pairs of objects
46
29
  * @param {Array} pair1
@@ -50,26 +33,20 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
50
33
  function isEqualPair(pair1, pair2) {
51
34
  return pair1[0].equals(pair2[0]) && pair1[1].equals(pair2[1]);
52
35
  }
53
-
54
36
  var Ref = /*#__PURE__*/function (_Element) {
55
37
  _inherits(Ref, _Element);
56
-
57
38
  var _super = _createSuper(Ref);
58
-
59
39
  function Ref() {
60
40
  var _this;
61
-
62
41
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
63
- name = _ref.name,
64
- endpoints = _ref.endpoints,
65
- onDelete = _ref.onDelete,
66
- onUpdate = _ref.onUpdate,
67
- token = _ref.token,
68
- _ref$schema = _ref.schema,
69
- schema = _ref$schema === void 0 ? {} : _ref$schema;
70
-
42
+ name = _ref.name,
43
+ endpoints = _ref.endpoints,
44
+ onDelete = _ref.onDelete,
45
+ onUpdate = _ref.onUpdate,
46
+ token = _ref.token,
47
+ _ref$schema = _ref.schema,
48
+ schema = _ref$schema === void 0 ? {} : _ref$schema;
71
49
  _classCallCheck(this, Ref);
72
-
73
50
  _this = _super.call(this, token);
74
51
  _this.name = name;
75
52
  _this.onDelete = onDelete;
@@ -77,14 +54,10 @@ var Ref = /*#__PURE__*/function (_Element) {
77
54
  _this.endpoints = [];
78
55
  _this.schema = schema;
79
56
  _this.dbState = _this.schema.dbState;
80
-
81
57
  _this.generateId();
82
-
83
58
  _this.processEndpoints(endpoints);
84
-
85
59
  return _this;
86
60
  }
87
-
88
61
  _createClass(Ref, [{
89
62
  key: "generateId",
90
63
  value: function generateId() {
@@ -94,24 +67,21 @@ var Ref = /*#__PURE__*/function (_Element) {
94
67
  key: "processEndpoints",
95
68
  value: function processEndpoints(rawEndpoints) {
96
69
  var _this2 = this;
97
-
98
70
  rawEndpoints.forEach(function (endpoint) {
99
71
  _this2.endpoints.push(new _endpoint["default"](_objectSpread(_objectSpread({}, endpoint), {}, {
100
72
  ref: _this2
101
73
  })));
102
-
103
- if (endpoint.schemaName === _config.DEFAULT_SCHEMA_NAME) {// this.schema.database.hasDefaultSchema = true;
74
+ if (endpoint.schemaName === _config.DEFAULT_SCHEMA_NAME) {
75
+ // this.schema.database.hasDefaultSchema = true;
104
76
  }
105
77
  });
106
-
107
78
  if (this.endpoints[0].equals(this.endpoints[1])) {
108
79
  this.error('Two endpoints are the same');
109
80
  }
110
-
111
81
  if (this.endpoints[0].fields.length !== this.endpoints[1].fields.length) {
112
82
  this.error('Two endpoints have unequal number of fields');
113
- } // TODO: Handle Error with different number of fields
114
-
83
+ }
84
+ // TODO: Handle Error with different number of fields
115
85
  }
116
86
  }, {
117
87
  key: "equals",
@@ -168,9 +138,7 @@ var Ref = /*#__PURE__*/function (_Element) {
168
138
  });
169
139
  }
170
140
  }]);
171
-
172
141
  return Ref;
173
142
  }(_element["default"]);
174
-
175
143
  var _default = Ref;
176
144
  exports["default"] = _default;
@@ -1,78 +1,53 @@
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 _table = _interopRequireDefault(require("./table"));
9
-
10
9
  var _element = _interopRequireDefault(require("./element"));
11
-
12
10
  var _enum2 = _interopRequireDefault(require("./enum"));
13
-
14
11
  var _utils = require("./utils");
15
-
16
12
  var _tableGroup = _interopRequireDefault(require("./tableGroup"));
17
-
18
13
  var _ref2 = _interopRequireDefault(require("./ref"));
19
-
20
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
-
22
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23
-
24
- 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; }
25
-
26
- 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; }
27
-
28
- 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; }
29
-
15
+ 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; }
16
+ 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; }
17
+ 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; }
30
18
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
-
32
- 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, descriptor.key, descriptor); } }
33
-
34
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
35
-
36
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
37
-
38
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
-
19
+ 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); } }
20
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
22
+ 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); }
23
+ 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); }
24
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
40
25
  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); }; }
41
-
42
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
43
-
26
+ 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); }
44
27
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
-
46
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
47
-
48
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
49
-
28
+ 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; } }
29
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
50
30
  var Schema = /*#__PURE__*/function (_Element) {
51
31
  _inherits(Schema, _Element);
52
-
53
32
  var _super = _createSuper(Schema);
54
-
55
33
  function Schema() {
56
34
  var _this;
57
-
58
35
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
59
- name = _ref.name,
60
- alias = _ref.alias,
61
- note = _ref.note,
62
- _ref$tables = _ref.tables,
63
- tables = _ref$tables === void 0 ? [] : _ref$tables,
64
- _ref$refs = _ref.refs,
65
- refs = _ref$refs === void 0 ? [] : _ref$refs,
66
- _ref$enums = _ref.enums,
67
- enums = _ref$enums === void 0 ? [] : _ref$enums,
68
- _ref$tableGroups = _ref.tableGroups,
69
- tableGroups = _ref$tableGroups === void 0 ? [] : _ref$tableGroups,
70
- token = _ref.token,
71
- _ref$database = _ref.database,
72
- database = _ref$database === void 0 ? {} : _ref$database;
73
-
36
+ name = _ref.name,
37
+ alias = _ref.alias,
38
+ note = _ref.note,
39
+ _ref$tables = _ref.tables,
40
+ tables = _ref$tables === void 0 ? [] : _ref$tables,
41
+ _ref$refs = _ref.refs,
42
+ refs = _ref$refs === void 0 ? [] : _ref$refs,
43
+ _ref$enums = _ref.enums,
44
+ enums = _ref$enums === void 0 ? [] : _ref$enums,
45
+ _ref$tableGroups = _ref.tableGroups,
46
+ tableGroups = _ref$tableGroups === void 0 ? [] : _ref$tableGroups,
47
+ token = _ref.token,
48
+ _ref$database = _ref.database,
49
+ database = _ref$database === void 0 ? {} : _ref$database;
74
50
  _classCallCheck(this, Schema);
75
-
76
51
  _this = _super.call(this, token);
77
52
  _this.tables = [];
78
53
  _this.enums = [];
@@ -84,20 +59,13 @@ var Schema = /*#__PURE__*/function (_Element) {
84
59
  _this.alias = alias;
85
60
  _this.database = database;
86
61
  _this.dbState = _this.database.dbState;
87
-
88
62
  _this.generateId();
89
-
90
63
  _this.processEnums(enums);
91
-
92
64
  _this.processTables(tables);
93
-
94
65
  _this.processRefs(refs);
95
-
96
66
  _this.processTableGroups(tableGroups);
97
-
98
67
  return _this;
99
68
  }
100
-
101
69
  _createClass(Schema, [{
102
70
  key: "generateId",
103
71
  value: function generateId() {
@@ -107,7 +75,6 @@ var Schema = /*#__PURE__*/function (_Element) {
107
75
  key: "processTables",
108
76
  value: function processTables(rawTables) {
109
77
  var _this2 = this;
110
-
111
78
  rawTables.forEach(function (table) {
112
79
  _this2.pushTable(new _table["default"](_objectSpread(_objectSpread({}, table), {}, {
113
80
  schema: _this2
@@ -140,7 +107,6 @@ var Schema = /*#__PURE__*/function (_Element) {
140
107
  key: "processEnums",
141
108
  value: function processEnums(rawEnums) {
142
109
  var _this3 = this;
143
-
144
110
  rawEnums.forEach(function (_enum) {
145
111
  _this3.pushEnum(new _enum2["default"](_objectSpread(_objectSpread({}, _enum), {}, {
146
112
  schema: _this3
@@ -166,7 +132,6 @@ var Schema = /*#__PURE__*/function (_Element) {
166
132
  key: "processRefs",
167
133
  value: function processRefs(rawRefs) {
168
134
  var _this4 = this;
169
-
170
135
  rawRefs.forEach(function (ref) {
171
136
  _this4.pushRef(new _ref2["default"](_objectSpread(_objectSpread({}, ref), {}, {
172
137
  schema: _this4
@@ -198,7 +163,6 @@ var Schema = /*#__PURE__*/function (_Element) {
198
163
  key: "processTableGroups",
199
164
  value: function processTableGroups(rawTableGroups) {
200
165
  var _this5 = this;
201
-
202
166
  rawTableGroups.forEach(function (tableGroup) {
203
167
  _this5.pushTableGroup(new _tableGroup["default"](_objectSpread(_objectSpread({}, tableGroup), {}, {
204
168
  schema: _this5
@@ -302,9 +266,7 @@ var Schema = /*#__PURE__*/function (_Element) {
302
266
  });
303
267
  }
304
268
  }]);
305
-
306
269
  return Schema;
307
270
  }(_element["default"]);
308
-
309
271
  var _default = Schema;
310
272
  exports["default"] = _default;
@@ -1,73 +1,49 @@
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 _field = _interopRequireDefault(require("./field"));
11
-
12
10
  var _indexes = _interopRequireDefault(require("./indexes"));
13
-
14
11
  var _config = require("./config");
15
-
16
12
  var _utils = require("./utils");
17
-
18
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21
-
22
- 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; }
23
-
24
- 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; }
25
-
26
- 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; }
27
-
14
+ 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
+ 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; }
16
+ 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; }
28
17
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
-
30
- 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, descriptor.key, descriptor); } }
31
-
32
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
33
-
34
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
35
-
36
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
37
-
18
+ 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); } }
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
+ 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); }
22
+ 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); }
23
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
24
  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); }; }
39
-
40
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
41
-
25
+ 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); }
42
26
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
-
44
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
45
-
46
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47
-
27
+ 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; } }
28
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
48
29
  var Table = /*#__PURE__*/function (_Element) {
49
30
  _inherits(Table, _Element);
50
-
51
31
  var _super = _createSuper(Table);
52
-
53
32
  function Table() {
54
33
  var _this;
55
-
56
34
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
57
- name = _ref.name,
58
- alias = _ref.alias,
59
- note = _ref.note,
60
- _ref$fields = _ref.fields,
61
- fields = _ref$fields === void 0 ? [] : _ref$fields,
62
- _ref$indexes = _ref.indexes,
63
- indexes = _ref$indexes === void 0 ? [] : _ref$indexes,
64
- _ref$schema = _ref.schema,
65
- schema = _ref$schema === void 0 ? {} : _ref$schema,
66
- token = _ref.token,
67
- headerColor = _ref.headerColor;
68
-
35
+ name = _ref.name,
36
+ alias = _ref.alias,
37
+ note = _ref.note,
38
+ _ref$fields = _ref.fields,
39
+ fields = _ref$fields === void 0 ? [] : _ref$fields,
40
+ _ref$indexes = _ref.indexes,
41
+ indexes = _ref$indexes === void 0 ? [] : _ref$indexes,
42
+ _ref$schema = _ref.schema,
43
+ schema = _ref$schema === void 0 ? {} : _ref$schema,
44
+ token = _ref.token,
45
+ headerColor = _ref.headerColor;
69
46
  _classCallCheck(this, Table);
70
-
71
47
  _this = _super.call(this, token);
72
48
  _this.name = name;
73
49
  _this.alias = alias;
@@ -78,16 +54,11 @@ var Table = /*#__PURE__*/function (_Element) {
78
54
  _this.indexes = [];
79
55
  _this.schema = schema;
80
56
  _this.dbState = _this.schema.dbState;
81
-
82
57
  _this.generateId();
83
-
84
58
  _this.processFields(fields);
85
-
86
59
  _this.processIndexes(indexes);
87
-
88
60
  return _this;
89
61
  }
90
-
91
62
  _createClass(Table, [{
92
63
  key: "generateId",
93
64
  value: function generateId() {
@@ -97,11 +68,9 @@ var Table = /*#__PURE__*/function (_Element) {
97
68
  key: "processFields",
98
69
  value: function processFields(rawFields) {
99
70
  var _this2 = this;
100
-
101
71
  if (rawFields.length === 0) {
102
72
  this.error('Table must have at least one field');
103
73
  }
104
-
105
74
  rawFields.forEach(function (field) {
106
75
  _this2.pushField(new _field["default"](_objectSpread(_objectSpread({}, field), {}, {
107
76
  table: _this2
@@ -127,7 +96,6 @@ var Table = /*#__PURE__*/function (_Element) {
127
96
  key: "processIndexes",
128
97
  value: function processIndexes(rawIndexes) {
129
98
  var _this3 = this;
130
-
131
99
  rawIndexes.forEach(function (index) {
132
100
  _this3.pushIndex(new _indexes["default"](_objectSpread(_objectSpread({}, index), {}, {
133
101
  table: _this3
@@ -144,7 +112,6 @@ var Table = /*#__PURE__*/function (_Element) {
144
112
  key: "checkIndex",
145
113
  value: function checkIndex(index) {
146
114
  var _this4 = this;
147
-
148
115
  index.columns.forEach(function (column) {
149
116
  if (column.type === 'column' && !_this4.findField(column.value)) {
150
117
  index.error("Column \"".concat(column.value, "\" do not exist in table ").concat((0, _utils.shouldPrintSchema)(_this4.schema) ? "\"".concat(_this4.schema.name, "\".") : '', "\"").concat(_this4.name, "\""));
@@ -224,9 +191,7 @@ var Table = /*#__PURE__*/function (_Element) {
224
191
  });
225
192
  }
226
193
  }]);
227
-
228
194
  return Table;
229
195
  }(_element["default"]);
230
-
231
196
  var _default = Table;
232
197
  exports["default"] = _default;