@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,74 +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 _utils = require("./utils");
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 TableGroup = /*#__PURE__*/function (_Element) {
43
27
  _inherits(TableGroup, _Element);
44
-
45
28
  var _super = _createSuper(TableGroup);
46
-
47
29
  function TableGroup(_ref) {
48
30
  var _this;
49
-
50
31
  var name = _ref.name,
51
- token = _ref.token,
52
- _ref$tables = _ref.tables,
53
- tables = _ref$tables === void 0 ? [] : _ref$tables,
54
- _ref$schema = _ref.schema,
55
- schema = _ref$schema === void 0 ? {} : _ref$schema;
56
-
32
+ token = _ref.token,
33
+ _ref$tables = _ref.tables,
34
+ tables = _ref$tables === void 0 ? [] : _ref$tables,
35
+ _ref$schema = _ref.schema,
36
+ schema = _ref$schema === void 0 ? {} : _ref$schema;
57
37
  _classCallCheck(this, TableGroup);
58
-
59
38
  _this = _super.call(this, token);
60
39
  _this.name = name;
61
40
  _this.tables = [];
62
41
  _this.schema = schema;
63
42
  _this.dbState = _this.schema.dbState;
64
-
65
43
  _this.generateId();
66
-
67
44
  _this.processTables(tables);
68
-
69
45
  return _this;
70
46
  }
71
-
72
47
  _createClass(TableGroup, [{
73
48
  key: "generateId",
74
49
  value: function generateId() {
@@ -78,14 +53,11 @@ var TableGroup = /*#__PURE__*/function (_Element) {
78
53
  key: "processTables",
79
54
  value: function processTables(rawTables) {
80
55
  var _this2 = this;
81
-
82
56
  rawTables.forEach(function (rawTable) {
83
57
  var table = _this2.schema.database.findTable(rawTable.schemaName, rawTable.name);
84
-
85
58
  if (!table) {
86
59
  _this2.error("Table ".concat(rawTable.schemaName ? "\"".concat(rawTable.schemaName, "\".") : '').concat(rawTable.name, " don't exist"));
87
60
  }
88
-
89
61
  _this2.pushTable(table);
90
62
  });
91
63
  }
@@ -104,7 +76,6 @@ var TableGroup = /*#__PURE__*/function (_Element) {
104
76
  })) {
105
77
  this.error("Table ".concat((0, _utils.shouldPrintSchema)(table.schema) ? "\"".concat(table.schema.name, "\".") : '', ".").concat(table.name, " is already in the group"));
106
78
  }
107
-
108
79
  if (table.group) {
109
80
  this.error("Table ".concat((0, _utils.shouldPrintSchema)(table.schema) ? "\"".concat(table.schema.name, "\".") : '', ".").concat(table.name, " is already in group ").concat((0, _utils.shouldPrintSchema)(table.group.schema) ? "\"".concat(table.group.schema.name, "\".") : '').concat(table.group.name));
110
81
  }
@@ -157,9 +128,7 @@ var TableGroup = /*#__PURE__*/function (_Element) {
157
128
  }, this.shallowExport()), this.exportChildIds()), this.exportParentIds())));
158
129
  }
159
130
  }]);
160
-
161
131
  return TableGroup;
162
132
  }(_element["default"]);
163
-
164
133
  var _default = TableGroup;
165
134
  exports["default"] = _default;
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.shouldPrintSchema = shouldPrintSchema;
7
7
  exports.shouldPrintSchemaName = shouldPrintSchemaName;
8
-
9
8
  var _config = require("./config");
10
-
11
9
  function shouldPrintSchema(schema) {
12
10
  return schema.name !== _config.DEFAULT_SCHEMA_NAME || schema.name === _config.DEFAULT_SCHEMA_NAME && schema.database.hasDefaultSchema;
13
11
  }
14
-
15
12
  function shouldPrintSchemaName(schemaName) {
16
13
  return schemaName !== _config.DEFAULT_SCHEMA_NAME;
17
14
  }
@@ -4,34 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _database = _interopRequireDefault(require("../model_structure/database"));
9
-
10
8
  var _mysqlParser = _interopRequireDefault(require("./mysqlParser"));
11
-
12
9
  var _postgresParser = _interopRequireDefault(require("./postgresParser"));
13
-
14
10
  var _dbmlParser = _interopRequireDefault(require("./dbmlParser"));
15
-
16
11
  var _schemarbParser = _interopRequireDefault(require("./schemarbParser"));
17
-
18
12
  var _mssqlParser = _interopRequireDefault(require("./mssqlParser"));
19
-
20
13
  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
-
14
+ 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); }
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
-
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); }
30
20
  var Parser = /*#__PURE__*/function () {
31
21
  function Parser() {
32
22
  _classCallCheck(this, Parser);
33
23
  }
34
-
35
24
  _createClass(Parser, null, [{
36
25
  key: "parseJSONToDatabase",
37
26
  value: function parseJSONToDatabase(rawDatabase) {
@@ -67,48 +56,37 @@ var Parser = /*#__PURE__*/function () {
67
56
  key: "parse",
68
57
  value: function parse(str, format) {
69
58
  var rawDatabase = {};
70
-
71
59
  switch (format) {
72
60
  case 'mysql':
73
61
  rawDatabase = Parser.parseMySQLToJSON(str);
74
62
  break;
75
-
76
63
  case 'postgres':
77
64
  rawDatabase = Parser.parsePostgresToJSON(str);
78
65
  break;
79
-
80
66
  case 'dbml':
81
67
  rawDatabase = Parser.parseDBMLToJSON(str);
82
68
  break;
83
-
84
69
  case 'schemarb':
85
70
  rawDatabase = Parser.parseSchemaRbToJSON(str);
86
71
  break;
87
-
88
72
  case 'mssql':
89
73
  rawDatabase = Parser.parseMSSQLToJSON(str);
90
74
  break;
91
-
92
75
  case 'json':
93
76
  if (_typeof(str) === 'object') {
94
77
  rawDatabase = str;
95
78
  } else {
96
79
  rawDatabase = JSON.parse(str);
97
80
  }
98
-
99
81
  break;
100
-
101
82
  default:
102
83
  break;
103
84
  }
104
-
105
85
  var schema = Parser.parseJSONToDatabase(rawDatabase);
106
86
  return schema;
107
87
  }
108
88
  }]);
109
-
110
89
  return Parser;
111
90
  }();
112
-
113
91
  var _default = Parser;
114
92
  exports["default"] = _default;
@@ -1,43 +1,32 @@
1
1
  "use strict";
2
2
 
3
3
  var _pegjsRequireImport = _interopRequireDefault(require("pegjs-require-import"));
4
-
5
4
  var _bluebird = _interopRequireDefault(require("bluebird"));
6
-
7
5
  var _fs = _interopRequireDefault(require("fs"));
8
-
9
6
  var _path = _interopRequireDefault(require("path"));
10
-
11
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
-
8
+ 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); }
9
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
13
10
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
-
15
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
16
-
11
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } /* eslint-disable */ /* eslint-enable */
17
12
  _bluebird["default"].promisifyAll(_fs["default"]);
18
-
19
13
  function buildParserFile(_x, _x2) {
20
14
  return _buildParserFile.apply(this, arguments);
21
15
  }
22
-
23
16
  function _buildParserFile() {
24
- _buildParserFile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(source, fileName) {
25
- return regeneratorRuntime.wrap(function _callee$(_context) {
26
- while (1) {
27
- switch (_context.prev = _context.next) {
28
- case 0:
29
- return _context.abrupt("return", _fs["default"].writeFileAsync(_path["default"].resolve(__dirname, fileName), source));
30
-
31
- case 1:
32
- case "end":
33
- return _context.stop();
34
- }
17
+ _buildParserFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(source, fileName) {
18
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19
+ while (1) switch (_context.prev = _context.next) {
20
+ case 0:
21
+ return _context.abrupt("return", _fs["default"].writeFileAsync(_path["default"].resolve(__dirname, fileName), source));
22
+ case 1:
23
+ case "end":
24
+ return _context.stop();
35
25
  }
36
26
  }, _callee);
37
27
  }));
38
28
  return _buildParserFile.apply(this, arguments);
39
29
  }
40
-
41
30
  var options = {
42
31
  format: 'commonjs',
43
32
  dependencies: {
@@ -50,7 +39,6 @@ var mysqlParserSource = (0, _pegjsRequireImport["default"])('./mysql/parser.pegj
50
39
  var postgresParserSource = (0, _pegjsRequireImport["default"])('./postgresql/parser.pegjs', options);
51
40
  var dbmlParserSource = (0, _pegjsRequireImport["default"])('./dbml/parser.pegjs', options);
52
41
  var schemarbParserSource = (0, _pegjsRequireImport["default"])('./schemarb/parser.pegjs', options);
53
-
54
42
  _bluebird["default"].all([buildParserFile(mysqlParserSource, 'mysqlParser.js'), buildParserFile(postgresParserSource, 'postgresParser.js'), buildParserFile(dbmlParserSource, 'dbmlParser.js'), buildParserFile(schemarbParserSource, 'schemarbParser.js')]).then(function () {
55
43
  console.log('Build parsers completed!');
56
44
  })["catch"](function (err) {