@dbml/core 3.10.2 → 3.11.0-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.
@@ -58,6 +58,11 @@ var Parser = /*#__PURE__*/function () {
58
58
  case 'mssql':
59
59
  rawDatabase = Parser.parseMSSQLToJSON(str);
60
60
  break;
61
+
62
+ // When we finish implementing the new parser, it should be mssql and the old one will be mssqlLegacy
63
+ case 'mssqlv2':
64
+ rawDatabase = Parser.parseMSSQLToJSONv2(str);
65
+ break;
61
66
  case 'json':
62
67
  if (_typeof(str) === 'object') {
63
68
  rawDatabase = str;
@@ -139,6 +144,11 @@ var Parser = /*#__PURE__*/function () {
139
144
  value: function parseMSSQLToJSON(str) {
140
145
  return _mssqlParser["default"].parseWithPegError(str);
141
146
  }
147
+ }, {
148
+ key: "parseMSSQLToJSONv2",
149
+ value: function parseMSSQLToJSONv2(str) {
150
+ return (0, _ASTGeneration.parse)(str, 'mssql');
151
+ }
142
152
  }, {
143
153
  key: "parseSnowflakeToJSON",
144
154
  value: function parseSnowflakeToJSON(str) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/core",
3
- "version": "3.10.2",
3
+ "version": "3.11.0-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.10.2",
35
+ "@dbml/parse": "^3.11.0-alpha-0",
36
36
  "antlr4": "^4.13.1",
37
37
  "lodash": "^4.17.15",
38
38
  "parsimmon": "^1.13.0",
@@ -59,7 +59,7 @@
59
59
  "\\.(?!json$)[^.]*$": "@glen/jest-raw-loader"
60
60
  }
61
61
  },
62
- "gitHead": "59a06de19f675bf9af31bdb9801d8e022ef87529",
62
+ "gitHead": "b090782ba29b03837d87d4d6478bd3f2ca403efc",
63
63
  "engines": {
64
64
  "node": ">=16"
65
65
  }
@@ -16,6 +16,19 @@ export interface Project {
16
16
  database_type: string;
17
17
  name: string;
18
18
  }
19
+
20
+ export interface Records {
21
+ [tableSchemaName: string]: {
22
+ schemaName: string | undefined;
23
+ tableName: string;
24
+ columns: string[];
25
+ values: {
26
+ value: any;
27
+ type: string;
28
+ }[];
29
+ }
30
+ }
31
+
19
32
  export interface RawDatabase {
20
33
  schemas: Schema[];
21
34
  tables: Table[];
@@ -24,6 +37,7 @@ export interface RawDatabase {
24
37
  refs: Ref[];
25
38
  tableGroups: TableGroup[];
26
39
  project: Project;
40
+ records: Records;
27
41
  }
28
42
  declare class Database extends Element {
29
43
  dbState: DbState;
@@ -35,7 +49,7 @@ declare class Database extends Element {
35
49
  databaseType: string;
36
50
  name: string;
37
51
  id: number;
38
- constructor({ schemas, tables, enums, refs, tableGroups, project }: RawDatabase);
52
+ constructor({ schemas, tables, enums, refs, tableGroups, project, records }: RawDatabase);
39
53
  generateId(): void;
40
54
  processSchemas(rawSchemas: RawSchema[]): void;
41
55
  pushSchema(schema: Schema): void;
@@ -210,5 +224,6 @@ export interface NormalizedDatabase {
210
224
  indexes: NormalizedIndex;
211
225
  indexColumns: NormalizedIndexColumn;
212
226
  fields: NormalizedField;
227
+ records: Records;
213
228
  }
214
229
  export default Database;
@@ -5,7 +5,7 @@ declare type ParseFormat = 'json'
5
5
  | 'mysql' | 'mysqlLegacy'
6
6
  | 'postgres' | 'postgresLegacy'
7
7
  | 'dbml' | 'dbmlv2'
8
- | 'mssql'
8
+ | 'mssql' | 'mssqlv2'
9
9
  | 'schemarb'
10
10
  | 'snowflake';
11
11
 
@@ -21,6 +21,7 @@ declare class Parser {
21
21
  static parseDBMLToJSONv2(str: string, dbmlCompiler: Compiler): RawDatabase;
22
22
  static parseSchemaRbToJSON(str: string): RawDatabase;
23
23
  static parseMSSQLToJSON(str: string): RawDatabase;
24
+ static parseMSSQLToJSONv2(str: string): RawDatabase;
24
25
  static parseSnowflakeToJSON(str: string): RawDatabase;
25
26
  /**
26
27
  * Should use parse() instance method instead of this static method whenever possible