@dbml/parse 3.15.0-alpha.0 → 5.0.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.
- package/dist/dbml-parse.js +8 -8
- package/dist/dbml-parse.mjs +632 -601
- package/dist/src/compiler.d.ts +1 -1
- package/dist/src/lib/analyzer/binder/elementBinder/{constraints.d.ts → checks.d.ts} +1 -1
- package/dist/src/lib/analyzer/binder/elementBinder/table.d.ts +1 -1
- package/dist/src/lib/analyzer/binder/elementBinder/tablePartial.d.ts +3 -0
- package/dist/src/lib/analyzer/binder/utils.d.ts +2 -1
- package/dist/src/lib/analyzer/types.d.ts +2 -2
- package/dist/src/lib/analyzer/validator/elementValidators/{constraints.d.ts → checks.d.ts} +2 -2
- package/dist/src/lib/analyzer/validator/elementValidators/custom.d.ts +1 -1
- package/dist/src/lib/analyzer/validator/elementValidators/enum.d.ts +1 -1
- package/dist/src/lib/analyzer/validator/elementValidators/indexes.d.ts +1 -1
- package/dist/src/lib/analyzer/validator/elementValidators/project.d.ts +1 -1
- package/dist/src/lib/analyzer/validator/elementValidators/ref.d.ts +1 -1
- package/dist/src/lib/analyzer/validator/utils.d.ts +2 -2
- package/dist/src/lib/errors.d.ts +6 -6
- package/dist/src/lib/interpreter/elementInterpreter/table.d.ts +1 -1
- package/dist/src/lib/interpreter/elementInterpreter/tablePartial.d.ts +1 -1
- package/dist/src/lib/interpreter/types.d.ts +4 -4
- package/package.json +2 -2
package/dist/src/compiler.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SyntaxToken } from '../../lexer/tokens';
|
|
2
2
|
import { ElementDeclarationNode } from '../../parser/nodes';
|
|
3
|
+
import { default as ChecksBinder } from './elementBinder/checks';
|
|
3
4
|
import { default as CustomBinder } from './elementBinder/custom';
|
|
4
5
|
import { default as EnumBinder } from './elementBinder/enum';
|
|
5
6
|
import { default as IndexesBinder } from './elementBinder/indexes';
|
|
@@ -11,4 +12,4 @@ import { default as TableGroupBinder } from './elementBinder/tableGroup';
|
|
|
11
12
|
import { default as TablePartialBinder } from './elementBinder/tablePartial';
|
|
12
13
|
export declare function pickBinder(element: ElementDeclarationNode & {
|
|
13
14
|
type: SyntaxToken;
|
|
14
|
-
}): typeof EnumBinder | typeof TableBinder | typeof TableGroupBinder | typeof ProjectBinder | typeof RefBinder | typeof NoteBinder | typeof IndexesBinder | typeof TablePartialBinder | typeof CustomBinder;
|
|
15
|
+
}): typeof EnumBinder | typeof TableBinder | typeof TableGroupBinder | typeof ProjectBinder | typeof RefBinder | typeof NoteBinder | typeof IndexesBinder | typeof TablePartialBinder | typeof ChecksBinder | typeof CustomBinder;
|
|
@@ -7,7 +7,7 @@ export declare enum ElementKind {
|
|
|
7
7
|
Indexes = "indexes",
|
|
8
8
|
TableGroup = "tablegroup",
|
|
9
9
|
TablePartial = "tablepartial",
|
|
10
|
-
|
|
10
|
+
Check = "checks"
|
|
11
11
|
}
|
|
12
12
|
export declare enum SettingName {
|
|
13
13
|
Color = "color",
|
|
@@ -23,7 +23,7 @@ export declare enum SettingName {
|
|
|
23
23
|
Default = "default",
|
|
24
24
|
Name = "name",
|
|
25
25
|
Type = "type",
|
|
26
|
-
|
|
26
|
+
Check = "check",
|
|
27
27
|
Update = "update",
|
|
28
28
|
Delete = "delete"
|
|
29
29
|
}
|
|
@@ -3,8 +3,8 @@ import { CompileError } from '../../../errors';
|
|
|
3
3
|
import { ElementDeclarationNode } from '../../../parser/nodes';
|
|
4
4
|
import { SyntaxToken } from '../../../lexer/tokens';
|
|
5
5
|
import { ElementValidator } from '../types';
|
|
6
|
-
import { default as SymbolTable } from '
|
|
7
|
-
export default class
|
|
6
|
+
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
7
|
+
export default class ChecksValidator implements ElementValidator {
|
|
8
8
|
private declarationNode;
|
|
9
9
|
private publicSymbolTable;
|
|
10
10
|
private symbolFactory;
|
|
@@ -3,7 +3,7 @@ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode }
|
|
|
3
3
|
import { default as SymbolFactory } from '../../symbol/factory';
|
|
4
4
|
import { SyntaxToken } from '../../../lexer/tokens';
|
|
5
5
|
import { ElementValidator } from '../types';
|
|
6
|
-
import { default as SymbolTable } from '
|
|
6
|
+
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
7
7
|
export default class CustomValidator implements ElementValidator {
|
|
8
8
|
private declarationNode;
|
|
9
9
|
private publicSymbolTable;
|
|
@@ -3,7 +3,7 @@ import { CompileError } from '../../../errors';
|
|
|
3
3
|
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../../parser/nodes';
|
|
4
4
|
import { SyntaxToken } from '../../../lexer/tokens';
|
|
5
5
|
import { ElementValidator } from '../types';
|
|
6
|
-
import { default as SymbolTable } from '
|
|
6
|
+
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
7
7
|
export default class EnumValidator implements ElementValidator {
|
|
8
8
|
private declarationNode;
|
|
9
9
|
private publicSymbolTable;
|
|
@@ -3,7 +3,7 @@ import { CompileError } from '../../../errors';
|
|
|
3
3
|
import { ElementDeclarationNode, SyntaxNode } from '../../../parser/nodes';
|
|
4
4
|
import { SyntaxToken } from '../../../lexer/tokens';
|
|
5
5
|
import { ElementValidator } from '../types';
|
|
6
|
-
import { default as SymbolTable } from '
|
|
6
|
+
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
7
7
|
export default class IndexesValidator implements ElementValidator {
|
|
8
8
|
private declarationNode;
|
|
9
9
|
private publicSymbolTable;
|
|
@@ -3,7 +3,7 @@ import { CompileError } from '../../../errors';
|
|
|
3
3
|
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../../parser/nodes';
|
|
4
4
|
import { SyntaxToken } from '../../../lexer/tokens';
|
|
5
5
|
import { ElementValidator } from '../types';
|
|
6
|
-
import { default as SymbolTable } from '
|
|
6
|
+
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
7
7
|
export default class ProjectValidator implements ElementValidator {
|
|
8
8
|
private declarationNode;
|
|
9
9
|
private publicSymbolTable;
|
|
@@ -3,7 +3,7 @@ import { default as SymbolFactory } from '../../symbol/factory';
|
|
|
3
3
|
import { CompileError } from '../../../errors';
|
|
4
4
|
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../../parser/nodes';
|
|
5
5
|
import { ElementValidator } from '../types';
|
|
6
|
-
import { default as SymbolTable } from '
|
|
6
|
+
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
7
7
|
export default class RefValidator implements ElementValidator {
|
|
8
8
|
private declarationNode;
|
|
9
9
|
private publicSymbolTable;
|
|
@@ -13,10 +13,10 @@ import { default as SymbolFactory } from '../symbol/factory';
|
|
|
13
13
|
import { default as Report } from '../../report';
|
|
14
14
|
import { CompileError } from '../../errors';
|
|
15
15
|
import { default as TablePartialValidator } from './elementValidators/tablePartial';
|
|
16
|
-
import { default as
|
|
16
|
+
import { default as ChecksValidator } from './elementValidators/checks';
|
|
17
17
|
export declare function pickValidator(element: ElementDeclarationNode & {
|
|
18
18
|
type: SyntaxToken;
|
|
19
|
-
}): typeof CustomValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator | typeof TablePartialValidator | typeof
|
|
19
|
+
}): typeof CustomValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator | typeof TablePartialValidator | typeof ChecksValidator;
|
|
20
20
|
export declare function isValidName(nameNode: SyntaxNode): boolean;
|
|
21
21
|
export declare function isValidAlias(aliasNode: SyntaxNode): aliasNode is PrimaryExpressionNode & {
|
|
22
22
|
expression: VariableNode;
|
package/dist/src/lib/errors.d.ts
CHANGED
|
@@ -84,12 +84,12 @@ export declare enum CompileErrorCode {
|
|
|
84
84
|
DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068,
|
|
85
85
|
UNKNOWN_TABLE_PARTIAL_SETTING = 3069,
|
|
86
86
|
INVALID_TABLE_SETTING_VALUE = 3070,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
INVALID_CHECKS_CONTEXT = 3071,
|
|
88
|
+
INVALID_CHECKS_FIELD = 3072,
|
|
89
|
+
INVALID_CHECK = 3073,
|
|
90
|
+
UNKNOWN_CHECK_SETTING = 3074,
|
|
91
|
+
DUPLICATE_CHECK_SETTING = 3075,
|
|
92
|
+
INVALID_CHECK_SETTING_VALUE = 3076,
|
|
93
93
|
BINDING_ERROR = 4000,
|
|
94
94
|
UNSUPPORTED = 5000,
|
|
95
95
|
CIRCULAR_REF = 5001,
|
|
@@ -41,7 +41,7 @@ export interface Table {
|
|
|
41
41
|
schemaName: null | string;
|
|
42
42
|
alias: string | null;
|
|
43
43
|
fields: Column[];
|
|
44
|
-
|
|
44
|
+
checks: Check[];
|
|
45
45
|
partials: TablePartialInjection[];
|
|
46
46
|
token: TokenPosition;
|
|
47
47
|
indexes: Index[];
|
|
@@ -67,7 +67,7 @@ export interface Column {
|
|
|
67
67
|
type: ColumnType;
|
|
68
68
|
token: TokenPosition;
|
|
69
69
|
inline_refs: InlineRef[];
|
|
70
|
-
|
|
70
|
+
checks: Check[];
|
|
71
71
|
pk?: boolean;
|
|
72
72
|
dbdefault?: {
|
|
73
73
|
type: 'number' | 'string' | 'boolean' | 'expression';
|
|
@@ -97,7 +97,7 @@ export interface Index {
|
|
|
97
97
|
};
|
|
98
98
|
type?: string;
|
|
99
99
|
}
|
|
100
|
-
export interface
|
|
100
|
+
export interface Check {
|
|
101
101
|
token: TokenPosition;
|
|
102
102
|
expression: string;
|
|
103
103
|
name?: string;
|
|
@@ -170,7 +170,7 @@ export interface TablePartial {
|
|
|
170
170
|
token: TokenPosition;
|
|
171
171
|
indexes: Index[];
|
|
172
172
|
headerColor?: string;
|
|
173
|
-
|
|
173
|
+
checks: Check[];
|
|
174
174
|
note?: {
|
|
175
175
|
value: string;
|
|
176
176
|
token: TokenPosition;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/parse",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Holistics <dev@holistics.io>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=18"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "630548187910efa893579e80ab07f447df1ef61e"
|
|
53
53
|
}
|