@dbml/core 3.13.0-alpha.2 → 3.13.0-alpha.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.
- package/package.json +3 -3
- package/types/model_structure/database.d.ts +59 -0
- package/types/model_structure/dbState.d.ts +1 -0
- package/types/model_structure/field.d.ts +6 -0
- package/types/model_structure/ref.d.ts +5 -0
- package/types/model_structure/table.d.ts +12 -0
- package/types/model_structure/tablePartial.d.ts +97 -0
- package/types/tablePartial.d.ts +38 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/core",
|
|
3
|
-
"version": "3.13.0-alpha.
|
|
3
|
+
"version": "3.13.0-alpha.3",
|
|
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.13.0-alpha.
|
|
35
|
+
"@dbml/parse": "^3.13.0-alpha.3",
|
|
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": "
|
|
62
|
+
"gitHead": "65d1cf56fcad06c42f625c9214c17c1b4c54b249",
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=16"
|
|
65
65
|
}
|
|
@@ -11,6 +11,7 @@ import { NormalizedEnumValue } from './enumValue';
|
|
|
11
11
|
import { NormalizedField } from './field';
|
|
12
12
|
import { NormalizedIndexColumn } from './indexColumn';
|
|
13
13
|
import { NormalizedIndex } from './indexes';
|
|
14
|
+
import TablePartial, { NormalizedTablePartial } from './tablePartial';
|
|
14
15
|
export interface Project {
|
|
15
16
|
note: RawNote;
|
|
16
17
|
database_type: string;
|
|
@@ -44,6 +45,7 @@ export interface RawDatabase {
|
|
|
44
45
|
tableGroups: TableGroup[];
|
|
45
46
|
project: Project;
|
|
46
47
|
records: RawTableRecord[];
|
|
48
|
+
tablePartials: TablePartial[];
|
|
47
49
|
}
|
|
48
50
|
declare class Database extends Element {
|
|
49
51
|
dbState: DbState;
|
|
@@ -65,6 +67,8 @@ declare class Database extends Element {
|
|
|
65
67
|
processSchemaElements(elements: Schema[] | Table[] | Enum[] | TableGroup[] | Ref[], elementType: any): void;
|
|
66
68
|
findOrCreateSchema(schemaName: string): Schema;
|
|
67
69
|
findTable(rawTable: any): Table;
|
|
70
|
+
processTablePartials(rawTablePartials: any[]): TablePartial[];
|
|
71
|
+
findTablePartial(partialName: string): TablePartial;
|
|
68
72
|
export(): {
|
|
69
73
|
schemas: {
|
|
70
74
|
tables: {
|
|
@@ -140,6 +144,33 @@ declare class Database extends Element {
|
|
|
140
144
|
type: string;
|
|
141
145
|
}[][];
|
|
142
146
|
}[];
|
|
147
|
+
tablePartials: {
|
|
148
|
+
name: string;
|
|
149
|
+
note: string;
|
|
150
|
+
headerColor: string;
|
|
151
|
+
fields: {
|
|
152
|
+
name: string;
|
|
153
|
+
type: any;
|
|
154
|
+
unique: boolean;
|
|
155
|
+
pk: boolean;
|
|
156
|
+
not_null: boolean;
|
|
157
|
+
note: string;
|
|
158
|
+
dbdefault: any;
|
|
159
|
+
increment: boolean;
|
|
160
|
+
injectedPartialId: number | undefined,
|
|
161
|
+
}[];
|
|
162
|
+
indexes: {
|
|
163
|
+
columns: {
|
|
164
|
+
type: any;
|
|
165
|
+
value: any;
|
|
166
|
+
}[];
|
|
167
|
+
name: string;
|
|
168
|
+
type: any;
|
|
169
|
+
unique: boolean;
|
|
170
|
+
pk: string;
|
|
171
|
+
note: string;
|
|
172
|
+
}[];
|
|
173
|
+
}[];
|
|
143
174
|
};
|
|
144
175
|
shallowExport(): {
|
|
145
176
|
hasDefaultSchema: boolean;
|
|
@@ -212,6 +243,33 @@ declare class Database extends Element {
|
|
|
212
243
|
content: string;
|
|
213
244
|
headerColor: string;
|
|
214
245
|
}[];
|
|
246
|
+
tablePartials: {
|
|
247
|
+
name: string;
|
|
248
|
+
note: string;
|
|
249
|
+
headerColor: string;
|
|
250
|
+
fields: {
|
|
251
|
+
name: string;
|
|
252
|
+
type: any;
|
|
253
|
+
unique: boolean;
|
|
254
|
+
pk: boolean;
|
|
255
|
+
not_null: boolean;
|
|
256
|
+
note: string;
|
|
257
|
+
dbdefault: any;
|
|
258
|
+
increment: boolean;
|
|
259
|
+
injectedPartialId: number | undefined,
|
|
260
|
+
}[];
|
|
261
|
+
indexes: {
|
|
262
|
+
columns: {
|
|
263
|
+
type: any;
|
|
264
|
+
value: any;
|
|
265
|
+
}[];
|
|
266
|
+
name: string;
|
|
267
|
+
type: any;
|
|
268
|
+
unique: boolean;
|
|
269
|
+
pk: string;
|
|
270
|
+
note: string;
|
|
271
|
+
}[];
|
|
272
|
+
}[];
|
|
215
273
|
};
|
|
216
274
|
exportChildIds(): {
|
|
217
275
|
schemaIds: number[];
|
|
@@ -243,5 +301,6 @@ export interface NormalizedDatabase {
|
|
|
243
301
|
indexColumns: NormalizedIndexColumn;
|
|
244
302
|
fields: NormalizedField;
|
|
245
303
|
records: NormalizedRecords;
|
|
304
|
+
tablePartials: NormalizedTablePartial;
|
|
246
305
|
}
|
|
247
306
|
export default Database;
|
|
@@ -4,6 +4,7 @@ import Element, { Token, RawNote } from './element';
|
|
|
4
4
|
import Endpoint from './endpoint';
|
|
5
5
|
import Enum from './enum';
|
|
6
6
|
import Table from './table';
|
|
7
|
+
import TablePartial from './tablePartial';
|
|
7
8
|
interface RawField {
|
|
8
9
|
name: string;
|
|
9
10
|
type: any;
|
|
@@ -30,6 +31,8 @@ declare class Field extends Element {
|
|
|
30
31
|
table: Table;
|
|
31
32
|
endpoints: Endpoint[];
|
|
32
33
|
_enum: Enum;
|
|
34
|
+
injectedPartial?: TablePartial;
|
|
35
|
+
injectedToken: Token;
|
|
33
36
|
constructor({ name, type, unique, pk, token, not_null, note, dbdefault, increment, table }: RawField);
|
|
34
37
|
generateId(): void;
|
|
35
38
|
pushEndpoint(endpoint: any): void;
|
|
@@ -42,6 +45,7 @@ declare class Field extends Element {
|
|
|
42
45
|
note: string;
|
|
43
46
|
dbdefault: any;
|
|
44
47
|
increment: boolean;
|
|
48
|
+
injectedPartialId?: number;
|
|
45
49
|
};
|
|
46
50
|
exportParentIds(): {
|
|
47
51
|
tableId: number;
|
|
@@ -59,6 +63,7 @@ declare class Field extends Element {
|
|
|
59
63
|
note: string;
|
|
60
64
|
dbdefault: any;
|
|
61
65
|
increment: boolean;
|
|
66
|
+
injectedPartialId?: number;
|
|
62
67
|
};
|
|
63
68
|
normalize(model: NormalizedDatabase): void;
|
|
64
69
|
}
|
|
@@ -76,6 +81,7 @@ export interface NormalizedField {
|
|
|
76
81
|
tableId: number;
|
|
77
82
|
endpointIds: number[];
|
|
78
83
|
enumId: number;
|
|
84
|
+
injectedPartialId?: number;
|
|
79
85
|
};
|
|
80
86
|
}
|
|
81
87
|
export default Field;
|
|
@@ -3,6 +3,7 @@ import Endpoint from './endpoint';
|
|
|
3
3
|
import Schema from './schema';
|
|
4
4
|
import DbState from './dbState';
|
|
5
5
|
import Database, { NormalizedDatabase } from './database';
|
|
6
|
+
import TablePartial from './tablePartial';
|
|
6
7
|
interface RawRef {
|
|
7
8
|
name: string;
|
|
8
9
|
color?: string;
|
|
@@ -22,6 +23,7 @@ declare class Ref extends Element {
|
|
|
22
23
|
dbState: DbState;
|
|
23
24
|
id: number;
|
|
24
25
|
database: Database;
|
|
26
|
+
injectedPartial?: TablePartial;
|
|
25
27
|
constructor({ name, endpoints, onDelete, onUpdate, token, schema }: RawRef);
|
|
26
28
|
generateId(): void;
|
|
27
29
|
processEndpoints(rawEndpoints: any): void;
|
|
@@ -36,11 +38,13 @@ declare class Ref extends Element {
|
|
|
36
38
|
name: string;
|
|
37
39
|
onDelete: any;
|
|
38
40
|
onUpdate: any;
|
|
41
|
+
injectedPartialId?: number;
|
|
39
42
|
};
|
|
40
43
|
shallowExport(): {
|
|
41
44
|
name: string;
|
|
42
45
|
onDelete: any;
|
|
43
46
|
onUpdate: any;
|
|
47
|
+
injectedPartialId?: number;
|
|
44
48
|
};
|
|
45
49
|
exportChild(): {
|
|
46
50
|
endpoints: {
|
|
@@ -67,6 +71,7 @@ export interface NormalizedRef {
|
|
|
67
71
|
onDelete?: string;
|
|
68
72
|
endpointIds: number[];
|
|
69
73
|
schemaId: number;
|
|
74
|
+
injectedPartialId?: number;
|
|
70
75
|
};
|
|
71
76
|
}
|
|
72
77
|
export default Ref;
|
|
@@ -4,7 +4,9 @@ import Index from './indexes';
|
|
|
4
4
|
import Schema from './schema';
|
|
5
5
|
import DbState from './dbState';
|
|
6
6
|
import TableGroup from './tableGroup';
|
|
7
|
+
import TablePartial from './tablePartial';
|
|
7
8
|
import { NormalizedDatabase } from './database';
|
|
9
|
+
|
|
8
10
|
interface RawTable {
|
|
9
11
|
name: string;
|
|
10
12
|
alias: string;
|
|
@@ -14,7 +16,9 @@ interface RawTable {
|
|
|
14
16
|
schema: Schema;
|
|
15
17
|
token: Token;
|
|
16
18
|
headerColor: string;
|
|
19
|
+
partials: TablePartial[];
|
|
17
20
|
}
|
|
21
|
+
|
|
18
22
|
declare class Table extends Element {
|
|
19
23
|
name: string;
|
|
20
24
|
alias: string;
|
|
@@ -27,6 +31,8 @@ declare class Table extends Element {
|
|
|
27
31
|
dbState: DbState;
|
|
28
32
|
id: number;
|
|
29
33
|
group: TableGroup;
|
|
34
|
+
partials: TablePartial[];
|
|
35
|
+
|
|
30
36
|
constructor({ name, alias, note, fields, indexes, schema, token, headerColor }: RawTable);
|
|
31
37
|
generateId(): void;
|
|
32
38
|
processFields(rawFields: any): void;
|
|
@@ -37,6 +43,7 @@ declare class Table extends Element {
|
|
|
37
43
|
checkIndex(index: any): void;
|
|
38
44
|
findField(fieldName: any): Field;
|
|
39
45
|
checkSameId(table: any): boolean;
|
|
46
|
+
processPartials(): void;
|
|
40
47
|
export(): {
|
|
41
48
|
fields: {
|
|
42
49
|
name: string;
|
|
@@ -63,6 +70,7 @@ declare class Table extends Element {
|
|
|
63
70
|
alias: string;
|
|
64
71
|
note: string;
|
|
65
72
|
headerColor: string;
|
|
73
|
+
partials: TablePartial[];
|
|
66
74
|
};
|
|
67
75
|
exportChild(): {
|
|
68
76
|
fields: {
|
|
@@ -100,9 +108,11 @@ declare class Table extends Element {
|
|
|
100
108
|
alias: string;
|
|
101
109
|
note: string;
|
|
102
110
|
headerColor: string;
|
|
111
|
+
partials: TablePartial[];
|
|
103
112
|
};
|
|
104
113
|
normalize(model: NormalizedDatabase): void;
|
|
105
114
|
}
|
|
115
|
+
|
|
106
116
|
export interface NormalizedTable {
|
|
107
117
|
[id: number]: {
|
|
108
118
|
id: number;
|
|
@@ -114,6 +124,8 @@ export interface NormalizedTable {
|
|
|
114
124
|
indexIds: number[];
|
|
115
125
|
schemaId: number;
|
|
116
126
|
groupId: number;
|
|
127
|
+
partials: TablePartial[];
|
|
117
128
|
};
|
|
118
129
|
}
|
|
130
|
+
|
|
119
131
|
export default Table;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import Element, { RawNote, Token } from './element';
|
|
2
|
+
import Field from './field';
|
|
3
|
+
import Index from './indexes';
|
|
4
|
+
import DbState from './dbState';
|
|
5
|
+
import { NormalizedDatabase } from './database';
|
|
6
|
+
|
|
7
|
+
interface RawTablePartial {
|
|
8
|
+
name: string;
|
|
9
|
+
note: RawNote;
|
|
10
|
+
fields: Field[];
|
|
11
|
+
indexes: Index[];
|
|
12
|
+
token: Token;
|
|
13
|
+
headerColor: string;
|
|
14
|
+
dbState: DbState;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare class TablePartial extends Element {
|
|
18
|
+
name: string;
|
|
19
|
+
note: string;
|
|
20
|
+
noteToken: Token;
|
|
21
|
+
fields: Field[];
|
|
22
|
+
indexes: Index[];
|
|
23
|
+
headerColor: string;
|
|
24
|
+
dbState: DbState;
|
|
25
|
+
id: number;
|
|
26
|
+
|
|
27
|
+
constructor({ name, note, fields, indexes, token, headerColor, dbState }: RawTablePartial);
|
|
28
|
+
generateId(): void;
|
|
29
|
+
export(): {
|
|
30
|
+
name: string;
|
|
31
|
+
note: string;
|
|
32
|
+
headerColor: string;
|
|
33
|
+
fields: {
|
|
34
|
+
name: string;
|
|
35
|
+
type: any;
|
|
36
|
+
unique: boolean;
|
|
37
|
+
pk: boolean;
|
|
38
|
+
not_null: boolean;
|
|
39
|
+
note: string;
|
|
40
|
+
dbdefault: any;
|
|
41
|
+
increment: boolean;
|
|
42
|
+
injectedPartialId: number | undefined,
|
|
43
|
+
}[];
|
|
44
|
+
indexes: {
|
|
45
|
+
columns: {
|
|
46
|
+
type: any;
|
|
47
|
+
value: any;
|
|
48
|
+
}[];
|
|
49
|
+
name: string;
|
|
50
|
+
type: any;
|
|
51
|
+
unique: boolean;
|
|
52
|
+
pk: string;
|
|
53
|
+
note: string;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
shallowExport(): {
|
|
57
|
+
name: string;
|
|
58
|
+
note: string;
|
|
59
|
+
headerColor: string;
|
|
60
|
+
fields: {
|
|
61
|
+
name: string;
|
|
62
|
+
type: any;
|
|
63
|
+
unique: boolean;
|
|
64
|
+
pk: boolean;
|
|
65
|
+
not_null: boolean;
|
|
66
|
+
note: string;
|
|
67
|
+
dbdefault: any;
|
|
68
|
+
increment: boolean;
|
|
69
|
+
injectedPartialId: number | undefined,
|
|
70
|
+
}[];
|
|
71
|
+
indexes: {
|
|
72
|
+
columns: {
|
|
73
|
+
type: any;
|
|
74
|
+
value: any;
|
|
75
|
+
}[];
|
|
76
|
+
name: string;
|
|
77
|
+
type: any;
|
|
78
|
+
unique: boolean;
|
|
79
|
+
pk: string;
|
|
80
|
+
note: string;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
normalize(model: NormalizedDatabase): void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface NormalizedTablePartial {
|
|
87
|
+
[id: number]: {
|
|
88
|
+
id: number;
|
|
89
|
+
name: string;
|
|
90
|
+
note: string;
|
|
91
|
+
headerColor: string;
|
|
92
|
+
fieldIds: number[];
|
|
93
|
+
indexIds: number[];
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default TablePartial;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default TablePartial;
|
|
2
|
+
declare class TablePartial extends Element {
|
|
3
|
+
constructor({ name, note, fields, indexes, token, headerColor, noteToken, dbState, }?: {
|
|
4
|
+
name: any;
|
|
5
|
+
note: any;
|
|
6
|
+
fields?: any[];
|
|
7
|
+
indexes?: any[];
|
|
8
|
+
token: any;
|
|
9
|
+
headerColor: any;
|
|
10
|
+
noteToken?: any;
|
|
11
|
+
dbState: any;
|
|
12
|
+
});
|
|
13
|
+
name: any;
|
|
14
|
+
note: any;
|
|
15
|
+
noteToken: any;
|
|
16
|
+
headerColor: any;
|
|
17
|
+
fields: any[];
|
|
18
|
+
indexes: any[];
|
|
19
|
+
dbState: any;
|
|
20
|
+
generateId(): void;
|
|
21
|
+
id: any;
|
|
22
|
+
export(): {
|
|
23
|
+
name: any;
|
|
24
|
+
note: any;
|
|
25
|
+
headerColor: any;
|
|
26
|
+
fields: any[];
|
|
27
|
+
indexes: any[];
|
|
28
|
+
};
|
|
29
|
+
shallowExport(): {
|
|
30
|
+
name: any;
|
|
31
|
+
note: any;
|
|
32
|
+
headerColor: any;
|
|
33
|
+
fields: any[];
|
|
34
|
+
indexes: any[];
|
|
35
|
+
};
|
|
36
|
+
normalize(model: any): void;
|
|
37
|
+
}
|
|
38
|
+
import Element from './element';
|