@dbml/core 3.1.6 → 3.1.8-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/model_structure/config.js +3 -1
- package/lib/model_structure/database.js +47 -7
- package/lib/model_structure/dbState.js +1 -0
- package/lib/model_structure/stickyNote.js +72 -0
- package/lib/parse/Parser.js +5 -0
- package/package.json +3 -3
- package/types/model_structure/database.d.ts +18 -0
- package/types/model_structure/dbState.d.ts +1 -0
- package/types/model_structure/schema.d.ts +2 -0
- package/types/model_structure/stickyNote.d.ts +37 -0
- package/types/parse/Parser.d.ts +5 -1
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TABLE_GROUP = exports.TABLE = exports.REF = exports.ENUM = exports.DEFAULT_SCHEMA_NAME = void 0;
|
|
6
|
+
exports.TABLE_GROUP = exports.TABLE = exports.REF = exports.NOTE = exports.ENUM = exports.DEFAULT_SCHEMA_NAME = void 0;
|
|
7
7
|
var DEFAULT_SCHEMA_NAME = 'public';
|
|
8
8
|
exports.DEFAULT_SCHEMA_NAME = DEFAULT_SCHEMA_NAME;
|
|
9
9
|
var TABLE = 'table';
|
|
10
10
|
exports.TABLE = TABLE;
|
|
11
|
+
var NOTE = 'note';
|
|
12
|
+
exports.NOTE = NOTE;
|
|
11
13
|
var ENUM = 'enum';
|
|
12
14
|
exports.ENUM = ENUM;
|
|
13
15
|
var REF = 'ref';
|
|
@@ -11,6 +11,7 @@ var _ref2 = _interopRequireDefault(require("./ref"));
|
|
|
11
11
|
var _enum2 = _interopRequireDefault(require("./enum"));
|
|
12
12
|
var _tableGroup = _interopRequireDefault(require("./tableGroup"));
|
|
13
13
|
var _table = _interopRequireDefault(require("./table"));
|
|
14
|
+
var _stickyNote = _interopRequireDefault(require("./stickyNote"));
|
|
14
15
|
var _element = _interopRequireDefault(require("./element"));
|
|
15
16
|
var _config = require("./config");
|
|
16
17
|
var _dbState = _interopRequireDefault(require("./dbState"));
|
|
@@ -41,6 +42,8 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
41
42
|
schemas = _ref$schemas === void 0 ? [] : _ref$schemas,
|
|
42
43
|
_ref$tables = _ref.tables,
|
|
43
44
|
tables = _ref$tables === void 0 ? [] : _ref$tables,
|
|
45
|
+
_ref$notes = _ref.notes,
|
|
46
|
+
notes = _ref$notes === void 0 ? [] : _ref$notes,
|
|
44
47
|
_ref$enums = _ref.enums,
|
|
45
48
|
enums = _ref$enums === void 0 ? [] : _ref$enums,
|
|
46
49
|
_ref$refs = _ref.refs,
|
|
@@ -57,16 +60,18 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
57
60
|
_this.generateId();
|
|
58
61
|
_this.hasDefaultSchema = false;
|
|
59
62
|
_this.schemas = [];
|
|
63
|
+
_this.notes = [];
|
|
60
64
|
_this.note = project.note ? (0, _lodash.get)(project, 'note.value', project.note) : null;
|
|
61
65
|
_this.noteToken = project.note ? (0, _lodash.get)(project, 'note.token', project.noteToken) : null;
|
|
62
66
|
_this.databaseType = project.database_type;
|
|
63
67
|
_this.name = project.name;
|
|
64
68
|
_this.aliases = aliases;
|
|
65
|
-
|
|
69
|
+
_this.processNotes(notes);
|
|
66
70
|
// The process order is important. Do not change !
|
|
67
71
|
_this.processSchemas(schemas);
|
|
68
72
|
_this.processSchemaElements(enums, _config.ENUM);
|
|
69
73
|
_this.processSchemaElements(tables, _config.TABLE);
|
|
74
|
+
_this.processSchemaElements(notes, _config.NOTE);
|
|
70
75
|
_this.processSchemaElements(refs, _config.REF);
|
|
71
76
|
_this.processSchemaElements(tableGroups, _config.TABLE_GROUP);
|
|
72
77
|
return _this;
|
|
@@ -76,13 +81,38 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
76
81
|
value: function generateId() {
|
|
77
82
|
this.id = this.dbState.generateId('dbId');
|
|
78
83
|
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "processNotes",
|
|
86
|
+
value: function processNotes(rawNotes) {
|
|
87
|
+
var _this2 = this;
|
|
88
|
+
rawNotes.forEach(function (note) {
|
|
89
|
+
_this2.pushNote(new _stickyNote["default"](_objectSpread(_objectSpread({}, note), {}, {
|
|
90
|
+
database: _this2
|
|
91
|
+
})));
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "pushNote",
|
|
96
|
+
value: function pushNote(note) {
|
|
97
|
+
this.checkNote(note);
|
|
98
|
+
this.notes.push(note);
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "checkNote",
|
|
102
|
+
value: function checkNote(note) {
|
|
103
|
+
if (this.notes.some(function (n) {
|
|
104
|
+
return n.name === note.name;
|
|
105
|
+
})) {
|
|
106
|
+
note.error("Notes ".concat(note.name, " existed"));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
79
109
|
}, {
|
|
80
110
|
key: "processSchemas",
|
|
81
111
|
value: function processSchemas(rawSchemas) {
|
|
82
|
-
var
|
|
112
|
+
var _this3 = this;
|
|
83
113
|
rawSchemas.forEach(function (schema) {
|
|
84
|
-
|
|
85
|
-
database:
|
|
114
|
+
_this3.pushSchema(new _schema["default"](_objectSpread(_objectSpread({}, schema), {}, {
|
|
115
|
+
database: _this3
|
|
86
116
|
})));
|
|
87
117
|
});
|
|
88
118
|
}
|
|
@@ -104,16 +134,16 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
104
134
|
}, {
|
|
105
135
|
key: "processSchemaElements",
|
|
106
136
|
value: function processSchemaElements(elements, elementType) {
|
|
107
|
-
var
|
|
137
|
+
var _this4 = this;
|
|
108
138
|
var schema;
|
|
109
139
|
elements.forEach(function (element) {
|
|
110
140
|
if (element.schemaName) {
|
|
111
|
-
schema =
|
|
141
|
+
schema = _this4.findOrCreateSchema(element.schemaName);
|
|
112
142
|
if (element.schemaName === _config.DEFAULT_SCHEMA_NAME) {
|
|
113
143
|
// this.hasDefaultSchema = true;
|
|
114
144
|
}
|
|
115
145
|
} else {
|
|
116
|
-
schema =
|
|
146
|
+
schema = _this4.findOrCreateSchema(_config.DEFAULT_SCHEMA_NAME);
|
|
117
147
|
}
|
|
118
148
|
switch (elementType) {
|
|
119
149
|
case _config.TABLE:
|
|
@@ -225,6 +255,9 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
225
255
|
return {
|
|
226
256
|
schemas: this.schemas.map(function (s) {
|
|
227
257
|
return s["export"]();
|
|
258
|
+
}),
|
|
259
|
+
notes: this.notes.map(function (n) {
|
|
260
|
+
return n["export"]();
|
|
228
261
|
})
|
|
229
262
|
};
|
|
230
263
|
}
|
|
@@ -234,6 +267,9 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
234
267
|
return {
|
|
235
268
|
schemaIds: this.schemas.map(function (s) {
|
|
236
269
|
return s.id;
|
|
270
|
+
}),
|
|
271
|
+
noteIds: this.notes.map(function (n) {
|
|
272
|
+
return n.id;
|
|
237
273
|
})
|
|
238
274
|
};
|
|
239
275
|
}
|
|
@@ -245,6 +281,7 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
245
281
|
id: this.id
|
|
246
282
|
}, this.shallowExport()), this.exportChildIds())),
|
|
247
283
|
schemas: {},
|
|
284
|
+
notes: {},
|
|
248
285
|
refs: {},
|
|
249
286
|
enums: {},
|
|
250
287
|
tableGroups: {},
|
|
@@ -258,6 +295,9 @@ var Database = /*#__PURE__*/function (_Element) {
|
|
|
258
295
|
this.schemas.forEach(function (schema) {
|
|
259
296
|
return schema.normalize(normalizedModel);
|
|
260
297
|
});
|
|
298
|
+
this.notes.forEach(function (note) {
|
|
299
|
+
return note.normalize(normalizedModel);
|
|
300
|
+
});
|
|
261
301
|
return normalizedModel;
|
|
262
302
|
}
|
|
263
303
|
}]);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _element = _interopRequireDefault(require("./element"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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; }
|
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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); }
|
|
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); }; }
|
|
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); }
|
|
22
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
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); }
|
|
25
|
+
var StickyNote = /*#__PURE__*/function (_Element) {
|
|
26
|
+
_inherits(StickyNote, _Element);
|
|
27
|
+
var _super = _createSuper(StickyNote);
|
|
28
|
+
function StickyNote() {
|
|
29
|
+
var _this;
|
|
30
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
31
|
+
name = _ref.name,
|
|
32
|
+
content = _ref.content,
|
|
33
|
+
headerColor = _ref.headerColor,
|
|
34
|
+
token = _ref.token,
|
|
35
|
+
_ref$database = _ref.database,
|
|
36
|
+
database = _ref$database === void 0 ? {} : _ref$database;
|
|
37
|
+
_classCallCheck(this, StickyNote);
|
|
38
|
+
_this = _super.call(this, token);
|
|
39
|
+
_this.name = name;
|
|
40
|
+
_this.content = content;
|
|
41
|
+
_this.headerColor = headerColor;
|
|
42
|
+
_this.database = database;
|
|
43
|
+
_this.dbState = _this.database.dbState;
|
|
44
|
+
_this.generateId();
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
_createClass(StickyNote, [{
|
|
48
|
+
key: "generateId",
|
|
49
|
+
value: function generateId() {
|
|
50
|
+
this.id = this.dbState.generateId('noteId');
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "export",
|
|
54
|
+
value: function _export() {
|
|
55
|
+
return {
|
|
56
|
+
name: this.name,
|
|
57
|
+
content: this.content,
|
|
58
|
+
headerColor: this.headerColor
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "normalize",
|
|
63
|
+
value: function normalize(model) {
|
|
64
|
+
model.notes = _objectSpread(_objectSpread({}, model.notes), {}, _defineProperty({}, this.id, _objectSpread({
|
|
65
|
+
id: this.id
|
|
66
|
+
}, this["export"]())));
|
|
67
|
+
}
|
|
68
|
+
}]);
|
|
69
|
+
return StickyNote;
|
|
70
|
+
}(_element["default"]);
|
|
71
|
+
var _default = StickyNote;
|
|
72
|
+
exports["default"] = _default;
|
package/lib/parse/Parser.js
CHANGED
|
@@ -129,6 +129,11 @@ var Parser = /*#__PURE__*/function () {
|
|
|
129
129
|
value: function parseMSSQLToJSON(str) {
|
|
130
130
|
return _mssqlParser["default"].parseWithPegError(str);
|
|
131
131
|
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "parse",
|
|
134
|
+
value: function parse(str, format) {
|
|
135
|
+
return new Parser().parse(str, format);
|
|
136
|
+
}
|
|
132
137
|
}]);
|
|
133
138
|
return Parser;
|
|
134
139
|
}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8-alpha.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Holistics <dev@holistics.io>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"prepublish": "npm run build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@dbml/parse": "^3.1.
|
|
35
|
+
"@dbml/parse": "^3.1.8-alpha.0",
|
|
36
36
|
"antlr4": "^4.13.1",
|
|
37
37
|
"lodash": "^4.17.15",
|
|
38
38
|
"parsimmon": "^1.13.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"\\.(?!json$)[^.]*$": "@glen/jest-raw-loader"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6e0430bbe735bad5c9619fe13eb4baf161163503"
|
|
63
63
|
}
|
|
@@ -3,6 +3,7 @@ import Ref, { NormalizedRef } from './ref';
|
|
|
3
3
|
import Enum, { NormalizedEnum } from './enum';
|
|
4
4
|
import TableGroup, { NormalizedTableGroup } from './tableGroup';
|
|
5
5
|
import Table, { NormalizedTable } from './table';
|
|
6
|
+
import StickyNote, { NormalizedStickyNote } from './stickyNote';
|
|
6
7
|
import Element, { RawNote, Token } from './element';
|
|
7
8
|
import DbState from './dbState';
|
|
8
9
|
import { NormalizedEndpoint } from './endpoint';
|
|
@@ -18,6 +19,7 @@ export interface Project {
|
|
|
18
19
|
export interface RawDatabase {
|
|
19
20
|
schemas: Schema[];
|
|
20
21
|
tables: Table[];
|
|
22
|
+
notes: StickyNote[];
|
|
21
23
|
enums: Enum[];
|
|
22
24
|
refs: Ref[];
|
|
23
25
|
tableGroups: TableGroup[];
|
|
@@ -27,6 +29,7 @@ declare class Database extends Element {
|
|
|
27
29
|
dbState: DbState;
|
|
28
30
|
hasDefaultSchema: boolean;
|
|
29
31
|
schemas: Schema[];
|
|
32
|
+
notes: StickyNote[];
|
|
30
33
|
note: string;
|
|
31
34
|
noteToken: Token;
|
|
32
35
|
databaseType: string;
|
|
@@ -99,6 +102,12 @@ declare class Database extends Element {
|
|
|
99
102
|
note: string;
|
|
100
103
|
alias: string;
|
|
101
104
|
}[];
|
|
105
|
+
notes: {
|
|
106
|
+
id: number;
|
|
107
|
+
name: string;
|
|
108
|
+
content: string;
|
|
109
|
+
headerColor: string;
|
|
110
|
+
}[];
|
|
102
111
|
};
|
|
103
112
|
shallowExport(): {
|
|
104
113
|
hasDefaultSchema: boolean;
|
|
@@ -165,9 +174,16 @@ declare class Database extends Element {
|
|
|
165
174
|
note: string;
|
|
166
175
|
alias: string;
|
|
167
176
|
}[];
|
|
177
|
+
notes: {
|
|
178
|
+
id: number;
|
|
179
|
+
name: string;
|
|
180
|
+
content: string;
|
|
181
|
+
headerColor: string;
|
|
182
|
+
}[];
|
|
168
183
|
};
|
|
169
184
|
exportChildIds(): {
|
|
170
185
|
schemaIds: number[];
|
|
186
|
+
noteIds: number[];
|
|
171
187
|
};
|
|
172
188
|
normalize(): NormalizedDatabase;
|
|
173
189
|
}
|
|
@@ -180,9 +196,11 @@ export interface NormalizedDatabase {
|
|
|
180
196
|
databaseType: string;
|
|
181
197
|
name: string;
|
|
182
198
|
schemaIds: number[];
|
|
199
|
+
noteIds: number[];
|
|
183
200
|
};
|
|
184
201
|
};
|
|
185
202
|
schemas: NormalizedSchema;
|
|
203
|
+
notes: NormalizedStickyNote;
|
|
186
204
|
refs: NormalizedRef;
|
|
187
205
|
enums: NormalizedEnum;
|
|
188
206
|
tableGroups: NormalizedTableGroup;
|
|
@@ -159,6 +159,7 @@ declare class Schema extends Element {
|
|
|
159
159
|
};
|
|
160
160
|
exportChildIds(): {
|
|
161
161
|
tableIds: number[];
|
|
162
|
+
noteIds: number[];
|
|
162
163
|
enumIds: number[];
|
|
163
164
|
tableGroupIds: number[];
|
|
164
165
|
refIds: number[];
|
|
@@ -180,6 +181,7 @@ export interface NormalizedSchema {
|
|
|
180
181
|
note: string;
|
|
181
182
|
alias: string;
|
|
182
183
|
tableIds: number[];
|
|
184
|
+
noteIds: number[];
|
|
183
185
|
enumIds: number[];
|
|
184
186
|
tableGroupIds: number[];
|
|
185
187
|
refIds: number[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Element, { Token } from './element';
|
|
2
|
+
import Database from './database';
|
|
3
|
+
import DbState from './dbState';
|
|
4
|
+
import { NormalizedDatabase } from './database';
|
|
5
|
+
interface RawStickyNote {
|
|
6
|
+
name: string;
|
|
7
|
+
content: string;
|
|
8
|
+
database: Database;
|
|
9
|
+
token: Token;
|
|
10
|
+
headerColor: string;
|
|
11
|
+
}
|
|
12
|
+
declare class StickyNote extends Element {
|
|
13
|
+
name: string;
|
|
14
|
+
content: string;
|
|
15
|
+
noteToken: Token;
|
|
16
|
+
headerColor: string;
|
|
17
|
+
database: Database;
|
|
18
|
+
dbState: DbState;
|
|
19
|
+
id: number;
|
|
20
|
+
constructor({ name, content, token, headerColor, database }: RawStickyNote);
|
|
21
|
+
generateId(): void;
|
|
22
|
+
export(): {
|
|
23
|
+
name: string;
|
|
24
|
+
content: string;
|
|
25
|
+
headerColor: string;
|
|
26
|
+
};
|
|
27
|
+
normalize(model: NormalizedDatabase): void;
|
|
28
|
+
}
|
|
29
|
+
export interface NormalizedStickyNote {
|
|
30
|
+
[id: number]: {
|
|
31
|
+
id: number;
|
|
32
|
+
name: string;
|
|
33
|
+
content: string;
|
|
34
|
+
headerColor: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export default StickyNote;
|
package/types/parse/Parser.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Compiler } from '@dbml/parse';
|
|
2
2
|
import Database, { RawDatabase } from '../model_structure/database';
|
|
3
3
|
declare class Parser {
|
|
4
|
-
constructor(DBMLCompiler
|
|
4
|
+
constructor(DBMLCompiler?: Compiler);
|
|
5
5
|
static parseJSONToDatabase(rawDatabase: RawDatabase): Database;
|
|
6
6
|
static parseMySQLToJSON(str: string): RawDatabase;
|
|
7
7
|
static parsePostgresToJSON(str: string): RawDatabase;
|
|
@@ -9,6 +9,10 @@ declare class Parser {
|
|
|
9
9
|
static parseDBMLToJSON(str: string): RawDatabase;
|
|
10
10
|
static parseSchemaRbToJSON(str: string): RawDatabase;
|
|
11
11
|
static parseMSSQLToJSON(str: string): RawDatabase;
|
|
12
|
+
/**
|
|
13
|
+
* Should use parse() instance method instead of this static method whenever possible
|
|
14
|
+
*/
|
|
15
|
+
static parse(str: string, format: 'mysql' | 'postgres' | 'dbml' | 'dbmlv2' | 'schemarb' | 'mssql' | 'json'): Database;
|
|
12
16
|
parse(str: string, format: 'mysql' | 'postgres' | 'dbml' | 'dbmlv2' | 'schemarb' | 'mssql' | 'json'): Database;
|
|
13
17
|
}
|
|
14
18
|
export default Parser;
|