@dbml/parse 3.12.0 → 3.13.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/LICENSE +0 -0
- package/dist/compiler.d.ts +0 -0
- package/dist/constants.d.ts +0 -0
- package/dist/dbml-parse.js +10 -10
- package/dist/dbml-parse.mjs +2199 -1553
- package/dist/index.d.ts +0 -0
- package/dist/lib/analyzer/analyzer.d.ts +0 -0
- package/dist/lib/analyzer/binder/binder.d.ts +2 -1
- package/dist/lib/analyzer/binder/elementBinder/custom.d.ts +0 -0
- package/dist/lib/analyzer/binder/elementBinder/elementBinder.d.ts +5 -1
- package/dist/lib/analyzer/binder/elementBinder/enum.d.ts +0 -0
- package/dist/lib/analyzer/binder/elementBinder/indexes.d.ts +0 -0
- package/dist/lib/analyzer/binder/elementBinder/note.d.ts +0 -0
- package/dist/lib/analyzer/binder/elementBinder/project.d.ts +0 -0
- package/dist/lib/analyzer/binder/elementBinder/ref.d.ts +0 -0
- package/dist/lib/analyzer/binder/elementBinder/table.d.ts +8 -0
- package/dist/lib/analyzer/binder/elementBinder/tableGroup.d.ts +0 -0
- package/dist/lib/analyzer/binder/elementBinder/tablePartial.d.ts +31 -0
- package/dist/lib/analyzer/binder/types.d.ts +3 -0
- package/dist/lib/analyzer/binder/utils.d.ts +2 -1
- package/dist/lib/analyzer/symbol/factory.d.ts +0 -0
- package/dist/lib/analyzer/symbol/symbolIndex.d.ts +7 -1
- package/dist/lib/analyzer/symbol/symbolTable.d.ts +1 -0
- package/dist/lib/analyzer/symbol/symbols.d.ts +27 -0
- package/dist/lib/analyzer/symbol/utils.d.ts +0 -0
- package/dist/lib/analyzer/types.d.ts +2 -1
- package/dist/lib/analyzer/utils.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/custom.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/enum.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/indexes.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/note.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/project.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/ref.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/table.d.ts +6 -3
- package/dist/lib/analyzer/validator/elementValidators/tableGroup.d.ts +0 -0
- package/dist/lib/analyzer/validator/elementValidators/tablePartial.d.ts +25 -0
- package/dist/lib/analyzer/validator/types.d.ts +0 -0
- package/dist/lib/analyzer/validator/utils.d.ts +2 -1
- package/dist/lib/analyzer/validator/validator.d.ts +0 -0
- package/dist/lib/errors.d.ts +57 -47
- package/dist/lib/interpreter/elementInterpreter/enum.d.ts +0 -0
- package/dist/lib/interpreter/elementInterpreter/project.d.ts +0 -0
- package/dist/lib/interpreter/elementInterpreter/ref.d.ts +0 -0
- package/dist/lib/interpreter/elementInterpreter/sticky_note.d.ts +0 -0
- package/dist/lib/interpreter/elementInterpreter/table.d.ts +1 -0
- package/dist/lib/interpreter/elementInterpreter/tableGroup.d.ts +0 -0
- package/dist/lib/interpreter/elementInterpreter/tablePartial.d.ts +18 -0
- package/dist/lib/interpreter/interpreter.d.ts +0 -0
- package/dist/lib/interpreter/types.d.ts +21 -1
- package/dist/lib/interpreter/utils.d.ts +0 -0
- package/dist/lib/lexer/lexer.d.ts +0 -0
- package/dist/lib/lexer/tokens.d.ts +1 -0
- package/dist/lib/lexer/utils.d.ts +0 -0
- package/dist/lib/option.d.ts +0 -0
- package/dist/lib/parser/contextStack.d.ts +0 -0
- package/dist/lib/parser/factory.d.ts +0 -0
- package/dist/lib/parser/nodes.d.ts +10 -3
- package/dist/lib/parser/parser.d.ts +1 -0
- package/dist/lib/parser/utils.d.ts +0 -0
- package/dist/lib/report.d.ts +0 -0
- package/dist/lib/serialization/serialize.d.ts +0 -0
- package/dist/lib/types.d.ts +0 -0
- package/dist/lib/utils.d.ts +0 -0
- package/dist/services/definition/provider.d.ts +0 -0
- package/dist/services/index.d.ts +0 -0
- package/dist/services/references/provider.d.ts +0 -0
- package/dist/services/suggestions/provider.d.ts +0 -0
- package/dist/services/suggestions/utils.d.ts +0 -0
- package/dist/services/types.d.ts +0 -0
- package/dist/services/utils.d.ts +0 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CompileError } from '../../errors';
|
|
2
2
|
import { ProgramNode } from '../../parser/nodes';
|
|
3
3
|
import { default as Report } from '../../report';
|
|
4
|
+
import { default as SymbolFactory } from '../symbol/factory';
|
|
4
5
|
export default class Binder {
|
|
5
6
|
private ast;
|
|
6
7
|
private errors;
|
|
7
8
|
constructor(ast: ProgramNode);
|
|
8
|
-
resolve(): Report<ProgramNode, CompileError>;
|
|
9
|
+
resolve(symbolFactory: SymbolFactory): Report<ProgramNode, CompileError>;
|
|
9
10
|
}
|
|
File without changes
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ElementDeclarationNode, SyntaxNode } from '../../../parser/nodes';
|
|
2
|
-
import { ArgumentBinderRule, SettingListBinderRule } from '../types';
|
|
2
|
+
import { ArgumentBinderRule, InjectionBinderRule, SettingListBinderRule } from '../types';
|
|
3
3
|
import { CompileError } from '../../../errors';
|
|
4
|
+
import { default as SymbolFactory } from '../../symbol/factory';
|
|
4
5
|
export default abstract class ElementBinder {
|
|
5
6
|
protected abstract subfield: {
|
|
6
7
|
arg: ArgumentBinderRule;
|
|
8
|
+
injection?: InjectionBinderRule;
|
|
7
9
|
settingList: SettingListBinderRule;
|
|
8
10
|
};
|
|
9
11
|
protected abstract settingList: SettingListBinderRule;
|
|
@@ -14,8 +16,10 @@ export default abstract class ElementBinder {
|
|
|
14
16
|
private bindSettingList;
|
|
15
17
|
private bindBody;
|
|
16
18
|
private bindSubfield;
|
|
19
|
+
private bindPartialInjection;
|
|
17
20
|
private scanAndBind;
|
|
18
21
|
private bindFragments;
|
|
19
22
|
private resolveIndexStack;
|
|
20
23
|
protected logError(node: SyntaxNode, message: string, ignoreError: boolean): void;
|
|
24
|
+
resolveInjections(symbolFactory: SymbolFactory): void;
|
|
21
25
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -15,6 +15,14 @@ export default class TableBinder extends ElementBinder {
|
|
|
15
15
|
ignoreNameNotFound: boolean;
|
|
16
16
|
})[];
|
|
17
17
|
};
|
|
18
|
+
injection: {
|
|
19
|
+
injectionBinderRule: {
|
|
20
|
+
shouldBind: true;
|
|
21
|
+
topSubnamesSymbolKind: never[];
|
|
22
|
+
remainingSubnamesSymbolKind: SymbolKind;
|
|
23
|
+
ignoreNameNotFound: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
18
26
|
settingList: {
|
|
19
27
|
ref: {
|
|
20
28
|
shouldBind: true;
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SymbolKind } from '../../symbol/symbolIndex';
|
|
2
|
+
import { default as ElementBinder } from './elementBinder';
|
|
3
|
+
export default class TablePartialBinder extends ElementBinder {
|
|
4
|
+
protected subfield: {
|
|
5
|
+
arg: {
|
|
6
|
+
argBinderRules: ({
|
|
7
|
+
shouldBind: false;
|
|
8
|
+
topSubnamesSymbolKind?: undefined;
|
|
9
|
+
remainingSubnamesSymbolKind?: undefined;
|
|
10
|
+
ignoreNameNotFound?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
shouldBind: true;
|
|
13
|
+
topSubnamesSymbolKind: SymbolKind[];
|
|
14
|
+
remainingSubnamesSymbolKind: SymbolKind;
|
|
15
|
+
ignoreNameNotFound: boolean;
|
|
16
|
+
})[];
|
|
17
|
+
};
|
|
18
|
+
settingList: {
|
|
19
|
+
ref: {
|
|
20
|
+
shouldBind: true;
|
|
21
|
+
topSubnamesSymbolKind: SymbolKind[];
|
|
22
|
+
remainingSubnamesSymbolKind: SymbolKind;
|
|
23
|
+
ignoreNameNotFound: boolean;
|
|
24
|
+
};
|
|
25
|
+
default: {
|
|
26
|
+
shouldBind: false;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
protected settingList: {};
|
|
31
|
+
}
|
|
@@ -8,6 +8,7 @@ import { default as ProjectBinder } from './elementBinder/project';
|
|
|
8
8
|
import { default as RefBinder } from './elementBinder/ref';
|
|
9
9
|
import { default as TableBinder } from './elementBinder/table';
|
|
10
10
|
import { default as TableGroupBinder } from './elementBinder/tableGroup';
|
|
11
|
+
import { default as TablePartialBinder } from './elementBinder/tablePartial';
|
|
11
12
|
export declare function pickBinder(element: ElementDeclarationNode & {
|
|
12
13
|
type: SyntaxToken;
|
|
13
|
-
}): typeof EnumBinder | typeof TableBinder | typeof TableGroupBinder | typeof ProjectBinder | typeof RefBinder | typeof NoteBinder | typeof IndexesBinder | typeof CustomBinder;
|
|
14
|
+
}): typeof EnumBinder | typeof TableBinder | typeof TableGroupBinder | typeof ProjectBinder | typeof RefBinder | typeof NoteBinder | typeof IndexesBinder | typeof TablePartialBinder | typeof CustomBinder;
|
|
File without changes
|
|
@@ -8,7 +8,9 @@ export declare enum SymbolKind {
|
|
|
8
8
|
TableGroupField = "TableGroup field",
|
|
9
9
|
Enum = "Enum",
|
|
10
10
|
EnumField = "Enum field",
|
|
11
|
-
Note = "Note"
|
|
11
|
+
Note = "Note",
|
|
12
|
+
TablePartial = "TablePartial",
|
|
13
|
+
TablePartialInjection = "TablePartialInjection"
|
|
12
14
|
}
|
|
13
15
|
export declare function createSchemaSymbolIndex(key: string): NodeSymbolIndex;
|
|
14
16
|
export declare function createTableSymbolIndex(key: string): NodeSymbolIndex;
|
|
@@ -18,9 +20,13 @@ export declare function createEnumFieldSymbolIndex(key: string): NodeSymbolIndex
|
|
|
18
20
|
export declare function createTableGroupSymbolIndex(key: string): NodeSymbolIndex;
|
|
19
21
|
export declare function createTableGroupFieldSymbolIndex(key: string): NodeSymbolIndex;
|
|
20
22
|
export declare function createStickyNoteSymbolIndex(key: string): NodeSymbolIndex;
|
|
23
|
+
export declare function createTablePartialSymbolIndex(key: string): NodeSymbolIndex;
|
|
24
|
+
export declare function createTablePartialInjectionSymbolIndex(key: string): NodeSymbolIndex;
|
|
21
25
|
export declare function createNodeSymbolIndex(key: string, symbolKind: SymbolKind): NodeSymbolIndex;
|
|
22
26
|
export declare function destructureIndex(id: NodeSymbolIndex): Option<{
|
|
23
27
|
name: string;
|
|
24
28
|
kind: SymbolKind;
|
|
25
29
|
}>;
|
|
26
30
|
export declare function isPublicSchemaIndex(id: NodeSymbolIndex): boolean;
|
|
31
|
+
export declare function isInjectionIndex(id: NodeSymbolIndex): boolean;
|
|
32
|
+
export declare function getInjectorIndex(injectionNodeIndex: NodeSymbolIndex): NodeSymbolIndex | null;
|
|
@@ -8,4 +8,5 @@ export default class SymbolTable {
|
|
|
8
8
|
get(id: NodeSymbolIndex): NodeSymbol | undefined;
|
|
9
9
|
get(id: NodeSymbolIndex, defaultValue: NodeSymbol): NodeSymbol;
|
|
10
10
|
entries(): IterableIterator<[NodeSymbolIndex, NodeSymbol]>;
|
|
11
|
+
forEach(callback: (value: NodeSymbol, key: NodeSymbolIndex) => void): void;
|
|
11
12
|
}
|
|
@@ -11,6 +11,7 @@ export interface NodeSymbol {
|
|
|
11
11
|
symbolTable?: SymbolTable;
|
|
12
12
|
declaration?: SyntaxNode;
|
|
13
13
|
references: SyntaxNode[];
|
|
14
|
+
injectorId?: NodeSymbolId;
|
|
14
15
|
}
|
|
15
16
|
export declare class SchemaSymbol implements NodeSymbol {
|
|
16
17
|
id: NodeSymbolId;
|
|
@@ -74,3 +75,29 @@ export declare class TableGroupFieldSymbol implements NodeSymbol {
|
|
|
74
75
|
declaration: SyntaxNode;
|
|
75
76
|
}, id: NodeSymbolId);
|
|
76
77
|
}
|
|
78
|
+
export declare class TablePartialSymbol implements NodeSymbol {
|
|
79
|
+
id: NodeSymbolId;
|
|
80
|
+
symbolTable: SymbolTable;
|
|
81
|
+
declaration: SyntaxNode;
|
|
82
|
+
references: SyntaxNode[];
|
|
83
|
+
constructor({ symbolTable, declaration }: {
|
|
84
|
+
symbolTable: SymbolTable;
|
|
85
|
+
declaration: SyntaxNode;
|
|
86
|
+
}, id: NodeSymbolId);
|
|
87
|
+
}
|
|
88
|
+
export declare class TablePartialInjectionSymbol implements NodeSymbol {
|
|
89
|
+
id: NodeSymbolId;
|
|
90
|
+
declaration: SyntaxNode;
|
|
91
|
+
references: SyntaxNode[];
|
|
92
|
+
constructor({ declaration }: {
|
|
93
|
+
declaration: SyntaxNode;
|
|
94
|
+
}, id: NodeSymbolId);
|
|
95
|
+
}
|
|
96
|
+
export declare class TablePartialInjectedColumnSymbol implements NodeSymbol {
|
|
97
|
+
id: NodeSymbolId;
|
|
98
|
+
injectorId: NodeSymbolId;
|
|
99
|
+
references: SyntaxNode[];
|
|
100
|
+
constructor({ injectorId }: {
|
|
101
|
+
injectorId: NodeSymbolId;
|
|
102
|
+
}, id: NodeSymbolId);
|
|
103
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as SymbolFactory } from '../../symbol/factory';
|
|
2
2
|
import { CompileError } from '../../../errors';
|
|
3
|
-
import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode } from '../../../parser/nodes';
|
|
3
|
+
import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode, PartialInjectionNode } from '../../../parser/nodes';
|
|
4
4
|
import { ElementValidator } from '../types';
|
|
5
5
|
import { SyntaxToken } from '../../../lexer/tokens';
|
|
6
6
|
import { default as SymbolTable } from '../../../analyzer/symbol/symbolTable';
|
|
@@ -19,7 +19,10 @@ export default class TableValidator implements ElementValidator {
|
|
|
19
19
|
registerElement(): CompileError[];
|
|
20
20
|
validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
|
|
21
21
|
validateFields(fields: FunctionApplicationNode[]): CompileError[];
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
validateInjections(injections: PartialInjectionNode[]): CompileError[];
|
|
23
|
+
registerInjection(injection: PartialInjectionNode): CompileError[];
|
|
24
|
+
validateColumns(columns: FunctionApplicationNode[]): CompileError[];
|
|
25
|
+
registerColumn(field: FunctionApplicationNode): CompileError[];
|
|
26
|
+
validateColumnSetting(parts: ExpressionNode[]): CompileError[];
|
|
24
27
|
private validateSubElements;
|
|
25
28
|
}
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as SymbolFactory } from '../../symbol/factory';
|
|
2
|
+
import { CompileError } from '../../../errors';
|
|
3
|
+
import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode } from '../../../parser/nodes';
|
|
4
|
+
import { ElementValidator } from '../types';
|
|
5
|
+
import { SyntaxToken } from '../../../lexer/tokens';
|
|
6
|
+
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
7
|
+
export default class TablePartialValidator implements ElementValidator {
|
|
8
|
+
private declarationNode;
|
|
9
|
+
private symbolFactory;
|
|
10
|
+
private publicSymbolTable;
|
|
11
|
+
constructor(declarationNode: ElementDeclarationNode & {
|
|
12
|
+
type: SyntaxToken;
|
|
13
|
+
}, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
|
|
14
|
+
validate(): CompileError[];
|
|
15
|
+
private validateContext;
|
|
16
|
+
private validateName;
|
|
17
|
+
private validateAlias;
|
|
18
|
+
private validateSettingList;
|
|
19
|
+
registerElement(): CompileError[];
|
|
20
|
+
validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
|
|
21
|
+
validateFields(fields: FunctionApplicationNode[]): CompileError[];
|
|
22
|
+
registerField(field: FunctionApplicationNode): CompileError[];
|
|
23
|
+
validateFieldSetting(parts: ExpressionNode[]): CompileError[];
|
|
24
|
+
private validateSubElements;
|
|
25
|
+
}
|
|
File without changes
|
|
@@ -12,9 +12,10 @@ import { default as SymbolTable } from '../symbol/symbolTable';
|
|
|
12
12
|
import { default as SymbolFactory } from '../symbol/factory';
|
|
13
13
|
import { default as Report } from '../../report';
|
|
14
14
|
import { CompileError } from '../../errors';
|
|
15
|
+
import { default as TablePartialValidator } from './elementValidators/tablePartial';
|
|
15
16
|
export declare function pickValidator(element: ElementDeclarationNode & {
|
|
16
17
|
type: SyntaxToken;
|
|
17
|
-
}): typeof CustomValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator;
|
|
18
|
+
}): typeof CustomValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator | typeof TablePartialValidator;
|
|
18
19
|
export declare function isValidName(nameNode: SyntaxNode): boolean;
|
|
19
20
|
export declare function isValidAlias(aliasNode: SyntaxNode): aliasNode is PrimaryExpressionNode & {
|
|
20
21
|
expression: VariableNode;
|
|
File without changes
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -26,53 +26,63 @@ export declare enum CompileErrorCode {
|
|
|
26
26
|
INVALID_TABLE_CONTEXT = 3010,
|
|
27
27
|
INVALID_TABLE_SETTING = 3011,
|
|
28
28
|
DUPLICATE_TABLE_SETTING = 3012,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
29
|
+
INVALID_TABLE_FIELD = 3013,
|
|
30
|
+
INVALID_TABLEGROUP_CONTEXT = 3014,
|
|
31
|
+
INVALID_TABLEGROUP_ELEMENT_NAME = 3015,
|
|
32
|
+
DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3016,
|
|
33
|
+
DUPLICATE_TABLEGROUP_FIELD_NAME = 3017,
|
|
34
|
+
INVALID_TABLEGROUP_FIELD = 3018,
|
|
35
|
+
INVALID_TABLE_PARTIAL_CONTEXT = 3019,
|
|
36
|
+
INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3020,
|
|
37
|
+
INVALID_TABLE_PARTIAL_SETTING = 3021,
|
|
38
|
+
DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3022,
|
|
39
|
+
DUPLICATE_TABLE_PARTIAL_SETTING = 3023,
|
|
40
|
+
INVALID_TABLE_PARTIAL_INJECTION = 3024,
|
|
41
|
+
INVALID_TABLE_PARTIAL_INJECTION_OP = 3025,
|
|
42
|
+
INVALID_TABLE_PARTIAL_INJECTION_NAME = 3026,
|
|
43
|
+
DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3027,
|
|
44
|
+
EMPTY_TABLE = 3028,
|
|
45
|
+
INVALID_COLUMN = 3029,
|
|
46
|
+
INVALID_COLUMN_NAME = 3030,
|
|
47
|
+
UNKNOWN_COLUMN_SETTING = 3031,
|
|
48
|
+
INVALID_COLUMN_TYPE = 3032,
|
|
49
|
+
DUPLICATE_COLUMN_NAME = 3033,
|
|
50
|
+
DUPLICATE_COLUMN_SETTING = 3034,
|
|
51
|
+
INVALID_COLUMN_SETTING_VALUE = 3035,
|
|
52
|
+
INVALID_ENUM_CONTEXT = 3036,
|
|
53
|
+
INVALID_ENUM_ELEMENT_NAME = 3037,
|
|
54
|
+
INVALID_ENUM_ELEMENT = 3038,
|
|
55
|
+
DUPLICATE_ENUM_ELEMENT_NAME = 3039,
|
|
56
|
+
UNKNOWN_ENUM_ELEMENT_SETTING = 3040,
|
|
57
|
+
DUPLICATE_ENUM_ELEMENT_SETTING = 3041,
|
|
58
|
+
INVALID_ENUM_ELEMENT_SETTING = 3042,
|
|
59
|
+
EMPTY_ENUM = 3043,
|
|
60
|
+
INVALID_REF_CONTEXT = 3044,
|
|
61
|
+
UNKNOWN_REF_SETTING = 3045,
|
|
62
|
+
DUPLICATE_REF_SETTING = 3046,
|
|
63
|
+
INVALID_REF_SETTING_VALUE = 3047,
|
|
64
|
+
INVALID_REF_RELATIONSHIP = 3048,
|
|
65
|
+
INVALID_REF_FIELD = 3049,
|
|
66
|
+
EMPTY_REF = 3050,
|
|
67
|
+
REF_REDEFINED = 3051,
|
|
68
|
+
INVALID_NOTE_CONTEXT = 3052,
|
|
69
|
+
INVALID_NOTE = 3053,
|
|
70
|
+
NOTE_REDEFINED = 3054,
|
|
71
|
+
NOTE_CONTENT_REDEFINED = 3055,
|
|
72
|
+
EMPTY_NOTE = 3056,
|
|
73
|
+
INVALID_INDEXES_CONTEXT = 3057,
|
|
74
|
+
INVALID_INDEXES_FIELD = 3058,
|
|
75
|
+
INVALID_INDEX = 3059,
|
|
76
|
+
UNKNOWN_INDEX_SETTING = 3060,
|
|
77
|
+
DUPLICATE_INDEX_SETTING = 3061,
|
|
78
|
+
UNEXPECTED_INDEX_SETTING_VALUE = 3062,
|
|
79
|
+
INVALID_INDEX_SETTING_VALUE = 3063,
|
|
80
|
+
INVALID_PROJECT_CONTEXT = 3064,
|
|
81
|
+
PROJECT_REDEFINED = 3065,
|
|
82
|
+
INVALID_PROJECT_FIELD = 3066,
|
|
83
|
+
INVALID_CUSTOM_CONTEXT = 3067,
|
|
84
|
+
INVALID_CUSTOM_ELEMENT_VALUE = 3068,
|
|
85
|
+
INVALID_ELEMENT_IN_SIMPLE_BODY = 3069,
|
|
76
86
|
BINDING_ERROR = 4000,
|
|
77
87
|
UNSUPPORTED = 5000,
|
|
78
88
|
CIRCULAR_REF = 5001,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -13,6 +13,7 @@ export declare class TableInterpreter implements ElementInterpreter {
|
|
|
13
13
|
private interpretSettingList;
|
|
14
14
|
private interpretBody;
|
|
15
15
|
private interpretSubElements;
|
|
16
|
+
private interpretInjection;
|
|
16
17
|
private interpretFields;
|
|
17
18
|
private interpretColumn;
|
|
18
19
|
private interpretIndexes;
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ElementInterpreter, InterpreterDatabase } from '../types';
|
|
2
|
+
import { ElementDeclarationNode } from '../../parser/nodes';
|
|
3
|
+
import { CompileError } from '../../errors';
|
|
4
|
+
export declare class TablePartialInterpreter implements ElementInterpreter {
|
|
5
|
+
private declarationNode;
|
|
6
|
+
private env;
|
|
7
|
+
private tablePartial;
|
|
8
|
+
private pkColumns;
|
|
9
|
+
constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
|
|
10
|
+
interpret(): CompileError[];
|
|
11
|
+
private interpretName;
|
|
12
|
+
private interpretSettingList;
|
|
13
|
+
private interpretBody;
|
|
14
|
+
private interpretSubElements;
|
|
15
|
+
private interpretFields;
|
|
16
|
+
private interpretColumn;
|
|
17
|
+
private interpretIndexes;
|
|
18
|
+
}
|
|
File without changes
|
|
@@ -21,6 +21,7 @@ export interface InterpreterDatabase {
|
|
|
21
21
|
[tableid: string]: ElementDeclarationNode;
|
|
22
22
|
};
|
|
23
23
|
tableGroups: Map<ElementDeclarationNode, TableGroup>;
|
|
24
|
+
tablePartials: Map<ElementDeclarationNode, TablePartial>;
|
|
24
25
|
aliases: Alias[];
|
|
25
26
|
project: Map<ElementDeclarationNode, Project>;
|
|
26
27
|
}
|
|
@@ -33,12 +34,14 @@ export interface Database {
|
|
|
33
34
|
tableGroups: TableGroup[];
|
|
34
35
|
aliases: Alias[];
|
|
35
36
|
project: Project;
|
|
37
|
+
tablePartials: TablePartial[];
|
|
36
38
|
}
|
|
37
39
|
export interface Table {
|
|
38
40
|
name: string;
|
|
39
41
|
schemaName: null | string;
|
|
40
42
|
alias: string | null;
|
|
41
43
|
fields: Column[];
|
|
44
|
+
partials: TablePartialInjection[];
|
|
42
45
|
token: TokenPosition;
|
|
43
46
|
indexes: Index[];
|
|
44
47
|
headerColor?: string;
|
|
@@ -154,16 +157,33 @@ export interface Alias {
|
|
|
154
157
|
schemaName: string | null;
|
|
155
158
|
};
|
|
156
159
|
}
|
|
160
|
+
export interface TablePartial {
|
|
161
|
+
name: string;
|
|
162
|
+
fields: Column[];
|
|
163
|
+
token: TokenPosition;
|
|
164
|
+
indexes: Index[];
|
|
165
|
+
headerColor?: string;
|
|
166
|
+
note?: {
|
|
167
|
+
value: string;
|
|
168
|
+
token: TokenPosition;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export interface TablePartialInjection {
|
|
172
|
+
name: string;
|
|
173
|
+
order: number;
|
|
174
|
+
token: TokenPosition;
|
|
175
|
+
}
|
|
157
176
|
export type Project = Record<string, never> | {
|
|
158
177
|
name: string | null;
|
|
159
178
|
tables: Table[];
|
|
160
179
|
refs: Ref[];
|
|
161
180
|
enums: Enum[];
|
|
162
181
|
tableGroups: TableGroup[];
|
|
182
|
+
tablePartials: TablePartial[];
|
|
163
183
|
note?: {
|
|
164
184
|
value: string;
|
|
165
185
|
token: TokenPosition;
|
|
166
186
|
};
|
|
167
187
|
token: TokenPosition;
|
|
168
|
-
[index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note'>]: string;
|
|
188
|
+
[index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note' | 'tablePartials'>]: string;
|
|
169
189
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/lib/option.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -39,7 +39,8 @@ export declare enum SyntaxNodeKind {
|
|
|
39
39
|
PRIMARY_EXPRESSION = "<primary-expression>",
|
|
40
40
|
GROUP_EXPRESSION = "<group-expression>",
|
|
41
41
|
DUMMY = "<dummy>",
|
|
42
|
-
ARRAY = "<array>"
|
|
42
|
+
ARRAY = "<array>",
|
|
43
|
+
PARTIAL_INJECTION = "<partial-injection>"
|
|
43
44
|
}
|
|
44
45
|
export declare class ProgramNode extends SyntaxNode {
|
|
45
46
|
body: ElementDeclarationNode[];
|
|
@@ -128,14 +129,20 @@ export declare class FunctionApplicationNode extends SyntaxNode {
|
|
|
128
129
|
}
|
|
129
130
|
export declare class BlockExpressionNode extends SyntaxNode {
|
|
130
131
|
blockOpenBrace?: SyntaxToken;
|
|
131
|
-
body: (ElementDeclarationNode | FunctionApplicationNode)[];
|
|
132
|
+
body: (PartialInjectionNode | ElementDeclarationNode | FunctionApplicationNode)[];
|
|
132
133
|
blockCloseBrace?: SyntaxToken;
|
|
133
134
|
constructor({ blockOpenBrace, body, blockCloseBrace, }: {
|
|
134
135
|
blockOpenBrace?: SyntaxToken;
|
|
135
|
-
body?: (ElementDeclarationNode | FunctionApplicationNode)[];
|
|
136
|
+
body?: (PartialInjectionNode | ElementDeclarationNode | FunctionApplicationNode)[];
|
|
136
137
|
blockCloseBrace?: SyntaxToken;
|
|
137
138
|
}, id: SyntaxNodeId);
|
|
138
139
|
}
|
|
140
|
+
export declare class PartialInjectionNode extends SyntaxNode {
|
|
141
|
+
partial?: VariableNode;
|
|
142
|
+
constructor({ partial }: {
|
|
143
|
+
partial?: VariableNode;
|
|
144
|
+
}, id: SyntaxNodeId);
|
|
145
|
+
}
|
|
139
146
|
export declare class ListExpressionNode extends SyntaxNode {
|
|
140
147
|
listOpenBracket?: SyntaxToken;
|
|
141
148
|
elementList: AttributeNode[];
|
|
File without changes
|
package/dist/lib/report.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/lib/types.d.ts
CHANGED
|
File without changes
|
package/dist/lib/utils.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/services/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/services/types.d.ts
CHANGED
|
File without changes
|
package/dist/services/utils.d.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbml/parse",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0-alpha.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Holistics <dev@holistics.io>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"lodash": "^4.17.21"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "6b6edb8bc9804cd65849451820f1d43072d8c01c"
|
|
50
50
|
}
|