@dbml/parse 8.3.1-custom-metadata.1 → 8.3.1
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 +16 -16
- package/dist/dbml-parse.mjs +2529 -3042
- package/dist/src/compiler/index.d.ts +1 -1
- package/dist/src/compiler/queries/container/element.d.ts +2 -2
- package/dist/src/compiler/types.d.ts +1 -2
- package/dist/src/core/global_modules/program/interpret.d.ts +0 -4
- package/dist/src/core/global_modules/utils.d.ts +1 -3
- package/dist/src/core/parser/parser.d.ts +0 -1
- package/dist/src/core/types/errors.d.ts +1 -6
- package/dist/src/core/types/keywords.d.ts +1 -2
- package/dist/src/core/types/nodes.d.ts +6 -34
- package/dist/src/core/types/schemaJson.d.ts +1 -15
- package/dist/src/core/types/symbol/metadata.d.ts +2 -11
- package/dist/src/core/types/symbol/symbols.d.ts +0 -10
- package/dist/src/core/utils/interpret.d.ts +1 -1
- package/dist/src/core/utils/span.d.ts +2 -2
- package/dist/src/core/utils/tokens.d.ts +0 -3
- package/dist/src/core/utils/validate.d.ts +2 -19
- package/package.json +2 -2
- package/dist/src/core/global_modules/metadata/bind.d.ts +0 -11
- package/dist/src/core/global_modules/metadata/index.d.ts +0 -2
- package/dist/src/core/global_modules/metadata/interpret.d.ts +0 -23
- package/dist/src/core/global_modules/metadata/overlap.d.ts +0 -14
- package/dist/src/core/global_modules/metadata/resolve.d.ts +0 -4
- package/dist/src/core/local_modules/metadata/index.d.ts +0 -2
- package/dist/src/core/local_modules/metadata/validate.d.ts +0 -14
|
@@ -100,7 +100,7 @@ export default class Compiler {
|
|
|
100
100
|
token: undefined;
|
|
101
101
|
index: undefined;
|
|
102
102
|
};
|
|
103
|
-
element: (filepath: Filepath, offset: number) => Readonly<import('../core/types/nodes').ElementDeclarationNode | import('../core/types/nodes').ProgramNode
|
|
103
|
+
element: (filepath: Filepath, offset: number) => Readonly<import('../core/types/nodes').ElementDeclarationNode | import('../core/types/nodes').ProgramNode>;
|
|
104
104
|
scope: (filepath: Filepath, offset: number) => import('../core/types/symbol').NodeSymbol[] | undefined;
|
|
105
105
|
scopeKind: (filepath: Filepath, offset: number) => import('./types').ScopeKind;
|
|
106
106
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
-
import { ElementDeclarationNode,
|
|
2
|
+
import { ElementDeclarationNode, ProgramNode } from '../../../core/types/nodes';
|
|
3
3
|
import { default as Compiler } from '../../index';
|
|
4
|
-
export declare function containerElement(this: Compiler, filepath: Filepath, offset: number): Readonly<ElementDeclarationNode |
|
|
4
|
+
export declare function containerElement(this: Compiler, filepath: Filepath, offset: number): Readonly<ElementDeclarationNode | ProgramNode>;
|
|
@@ -11,17 +11,13 @@ export default class ProgramInterpreter {
|
|
|
11
11
|
private errors;
|
|
12
12
|
private warnings;
|
|
13
13
|
private db;
|
|
14
|
-
private emittedBySymbol;
|
|
15
14
|
constructor(compiler: Compiler, symbol: ProgramSymbol, filepath: Filepath);
|
|
16
15
|
interpret(): Report<SchemaElement | SchemaElement[] | undefined>;
|
|
17
16
|
private interpretAllSymbols;
|
|
18
17
|
private interpretUseSymbol;
|
|
19
18
|
private interpretAllMetadata;
|
|
20
|
-
private promoteOverlapKeys;
|
|
21
|
-
private attachMetadata;
|
|
22
19
|
private interpretAllAliases;
|
|
23
20
|
private validateRecords;
|
|
24
21
|
private collectPartialRefs;
|
|
25
22
|
private pushElement;
|
|
26
|
-
private recordEmitted;
|
|
27
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as Compiler } from '../../compiler';
|
|
2
|
-
import {
|
|
2
|
+
import { RelationCardinality } from '../types';
|
|
3
3
|
import { PrimaryExpressionNode, SyntaxNode, VariableNode } from '../types/nodes';
|
|
4
4
|
import { default as Report } from '../types/report';
|
|
5
5
|
import { NodeSymbol } from '../types/symbol';
|
|
@@ -15,5 +15,3 @@ export declare function scanNonListNodeForBinding(node?: SyntaxNode): {
|
|
|
15
15
|
}[];
|
|
16
16
|
export declare function nodeRefereeOfLeftExpression(compiler: Compiler, node: SyntaxNode): NodeSymbol | undefined;
|
|
17
17
|
export declare function getMultiplicities(op: string): [RelationCardinality, RelationCardinality] | undefined;
|
|
18
|
-
export declare function getDefaultSchemaSymbol(compiler: Compiler, globalSymbol: NodeSymbol): NodeSymbol | undefined;
|
|
19
|
-
export declare function getGlobalSymbol(compiler: Compiler, filepath: Filepath): NodeSymbol | undefined;
|
|
@@ -32,7 +32,6 @@ export default class Parser {
|
|
|
32
32
|
private synchronizeUseSpecifierList;
|
|
33
33
|
private useSpecifier;
|
|
34
34
|
private synchronizeProgram;
|
|
35
|
-
private metadataDeclaration;
|
|
36
35
|
private elementDeclaration;
|
|
37
36
|
private synchronizeElementDeclarationName;
|
|
38
37
|
private synchronizeElementDeclarationAlias;
|
|
@@ -113,12 +113,7 @@ export declare enum CompileErrorCode {
|
|
|
113
113
|
SAME_ENDPOINT = 5002,
|
|
114
114
|
UNEQUAL_FIELDS_BINARY_REF = 5003,
|
|
115
115
|
CONFLICTING_SETTING = 5004,
|
|
116
|
-
TABLE_REAPPEAR_IN_TABLEGROUP = 5005
|
|
117
|
-
INVALID_METADATA_CONTEXT = 5006,
|
|
118
|
-
INVALID_METADATA_TARGET_KIND = 5007,
|
|
119
|
-
INVALID_METADATA_FIELD = 5008,
|
|
120
|
-
DUPLICATE_METADATA_FIELD = 5009,
|
|
121
|
-
METADATA_TARGET_NOT_FOUND = 5010
|
|
116
|
+
TABLE_REAPPEAR_IN_TABLEGROUP = 5005
|
|
122
117
|
}
|
|
123
118
|
export declare class CompileError extends Error {
|
|
124
119
|
code: Readonly<CompileErrorCode>;
|
|
@@ -13,8 +13,7 @@ export declare enum ElementKind {
|
|
|
13
13
|
DiagramViewTables = "tables",
|
|
14
14
|
DiagramViewNotes = "notes",
|
|
15
15
|
DiagramViewTableGroups = "tablegroups",
|
|
16
|
-
DiagramViewSchemas = "schemas"
|
|
17
|
-
Metadata = "metadata"
|
|
16
|
+
DiagramViewSchemas = "schemas"
|
|
18
17
|
}
|
|
19
18
|
export declare enum SettingName {
|
|
20
19
|
Color = "color",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Filepath } from './filepath';
|
|
2
2
|
import { Internable } from './internable';
|
|
3
3
|
import { ElementKind } from './keywords';
|
|
4
|
-
import { ImportKind,
|
|
4
|
+
import { ImportKind, SymbolKind } from './symbol';
|
|
5
5
|
import { Position } from './position';
|
|
6
6
|
import { SyntaxToken } from './tokens';
|
|
7
7
|
export type SyntaxNodeId = number;
|
|
@@ -36,7 +36,6 @@ export declare class SyntaxNode implements Internable<InternedSyntaxNode> {
|
|
|
36
36
|
export declare enum SyntaxNodeKind {
|
|
37
37
|
PROGRAM = "<program>",
|
|
38
38
|
ELEMENT_DECLARATION = "<element-declaration>",
|
|
39
|
-
METADATA_DECLARATION = "<metadata-declaration>",
|
|
40
39
|
USE_DECLARATION = "<use-declaration>",
|
|
41
40
|
USE_SPECIFIER = "<use-specifier>",
|
|
42
41
|
USE_SPECIFIER_LIST = "<use-specifier-list>",
|
|
@@ -61,17 +60,16 @@ export declare enum SyntaxNodeKind {
|
|
|
61
60
|
WILDCARD = "<wildcard>"
|
|
62
61
|
}
|
|
63
62
|
export declare class ProgramNode extends SyntaxNode {
|
|
64
|
-
body: (UseDeclarationNode | ElementDeclarationNode
|
|
63
|
+
body: (UseDeclarationNode | ElementDeclarationNode)[];
|
|
65
64
|
eof?: SyntaxToken;
|
|
66
65
|
source: string;
|
|
67
66
|
constructor({ body, eof, source, }: {
|
|
68
|
-
body?: (UseDeclarationNode | ElementDeclarationNode
|
|
67
|
+
body?: (UseDeclarationNode | ElementDeclarationNode)[];
|
|
69
68
|
eof?: SyntaxToken;
|
|
70
69
|
source: string;
|
|
71
70
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
72
71
|
get declarations(): ElementDeclarationNode[];
|
|
73
72
|
get uses(): UseDeclarationNode[];
|
|
74
|
-
get metadata(): MetadataDeclarationNode[];
|
|
75
73
|
}
|
|
76
74
|
export declare class UseDeclarationNode extends SyntaxNode {
|
|
77
75
|
useKeyword?: SyntaxToken;
|
|
@@ -88,13 +86,11 @@ export declare class UseDeclarationNode extends SyntaxNode {
|
|
|
88
86
|
}
|
|
89
87
|
export declare class UseSpecifierNode extends SyntaxNode {
|
|
90
88
|
importKind?: SyntaxToken;
|
|
91
|
-
subKind?: SyntaxToken;
|
|
92
89
|
name?: NormalExpressionNode;
|
|
93
90
|
asKeyword?: SyntaxToken;
|
|
94
91
|
alias?: NormalExpressionNode;
|
|
95
|
-
constructor({ importKind,
|
|
92
|
+
constructor({ importKind, name, asKeyword, alias, }: {
|
|
96
93
|
importKind?: SyntaxToken;
|
|
97
|
-
subKind?: SyntaxToken;
|
|
98
94
|
name?: NormalExpressionNode;
|
|
99
95
|
asKeyword?: SyntaxToken;
|
|
100
96
|
alias?: NormalExpressionNode;
|
|
@@ -112,21 +108,6 @@ export declare class UseSpecifierListNode extends SyntaxNode {
|
|
|
112
108
|
closeBrace?: SyntaxToken;
|
|
113
109
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
114
110
|
}
|
|
115
|
-
export declare class MetadataDeclarationNode extends SyntaxNode {
|
|
116
|
-
metadataKeyword?: SyntaxToken;
|
|
117
|
-
targetKind?: SyntaxToken;
|
|
118
|
-
targetName?: NormalExpressionNode;
|
|
119
|
-
bodyColon?: SyntaxToken;
|
|
120
|
-
body?: FunctionApplicationNode | BlockExpressionNode;
|
|
121
|
-
constructor({ metadataKeyword, targetKind, targetName, bodyColon, body, }: {
|
|
122
|
-
metadataKeyword?: SyntaxToken;
|
|
123
|
-
targetKind?: SyntaxToken;
|
|
124
|
-
targetName?: NormalExpressionNode;
|
|
125
|
-
bodyColon?: SyntaxToken;
|
|
126
|
-
body?: BlockExpressionNode | FunctionApplicationNode;
|
|
127
|
-
}, id: SyntaxNodeId, filepath: Filepath);
|
|
128
|
-
getTargetKind(): MetadataTargetKind | undefined;
|
|
129
|
-
}
|
|
130
111
|
export declare class ElementDeclarationNode extends SyntaxNode {
|
|
131
112
|
type?: SyntaxToken;
|
|
132
113
|
name?: NormalExpressionNode;
|
|
@@ -144,17 +125,8 @@ export declare class ElementDeclarationNode extends SyntaxNode {
|
|
|
144
125
|
bodyColon?: SyntaxToken;
|
|
145
126
|
body?: BlockExpressionNode | FunctionApplicationNode;
|
|
146
127
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
147
|
-
isKind
|
|
148
|
-
|
|
149
|
-
value: T;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
getElementKind<T extends ElementKind>(this: ElementDeclarationNode & {
|
|
153
|
-
type: {
|
|
154
|
-
value: T;
|
|
155
|
-
};
|
|
156
|
-
}): T;
|
|
157
|
-
getElementKind(this: ElementDeclarationNode): ElementKind | undefined;
|
|
128
|
+
isKind(...kinds: ElementKind[]): boolean;
|
|
129
|
+
getElementKind(): ElementKind | undefined;
|
|
158
130
|
}
|
|
159
131
|
export declare class IdentifierStreamNode extends SyntaxNode {
|
|
160
132
|
identifiers: SyntaxToken[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NONE_COLOR } from '../../constants';
|
|
2
2
|
import { Filepath } from './filepath';
|
|
3
3
|
import { Position } from './position';
|
|
4
|
-
export type CustomMetadata = Record<string, unknown>;
|
|
5
4
|
export type Color = `#${string}` | typeof NONE_COLOR;
|
|
6
5
|
export declare enum AliasKind {
|
|
7
6
|
Table = "table"
|
|
@@ -86,14 +85,12 @@ export interface Table {
|
|
|
86
85
|
value: string;
|
|
87
86
|
token: TokenPosition;
|
|
88
87
|
};
|
|
89
|
-
metadata?: CustomMetadata;
|
|
90
88
|
}
|
|
91
89
|
export interface Note {
|
|
92
90
|
name: string;
|
|
93
91
|
content: string;
|
|
94
92
|
token: TokenPosition;
|
|
95
93
|
color?: Color;
|
|
96
|
-
metadata?: CustomMetadata;
|
|
97
94
|
}
|
|
98
95
|
export interface ColumnType {
|
|
99
96
|
schemaName: string | null;
|
|
@@ -126,7 +123,6 @@ export interface Column {
|
|
|
126
123
|
value: string;
|
|
127
124
|
token: TokenPosition;
|
|
128
125
|
};
|
|
129
|
-
metadata?: CustomMetadata;
|
|
130
126
|
}
|
|
131
127
|
export interface Index {
|
|
132
128
|
columns: {
|
|
@@ -199,7 +195,6 @@ export interface TableGroup {
|
|
|
199
195
|
value: string;
|
|
200
196
|
token: TokenPosition;
|
|
201
197
|
};
|
|
202
|
-
metadata?: CustomMetadata;
|
|
203
198
|
}
|
|
204
199
|
export interface TableGroupField {
|
|
205
200
|
name: string;
|
|
@@ -243,15 +238,6 @@ export interface TableRecord {
|
|
|
243
238
|
values: RecordValue[][];
|
|
244
239
|
token: TokenPosition;
|
|
245
240
|
}
|
|
246
|
-
export interface MetadataElement {
|
|
247
|
-
target: {
|
|
248
|
-
kind: string;
|
|
249
|
-
name: string[];
|
|
250
|
-
};
|
|
251
|
-
values: CustomMetadata;
|
|
252
|
-
valueTokens: Record<string, TokenPosition>;
|
|
253
|
-
token: TokenPosition;
|
|
254
|
-
}
|
|
255
241
|
export type Project = Record<string, never> | {
|
|
256
242
|
name: string | null;
|
|
257
243
|
tables: Table[];
|
|
@@ -266,4 +252,4 @@ export type Project = Record<string, never> | {
|
|
|
266
252
|
token: TokenPosition;
|
|
267
253
|
[index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note' | 'tablePartials' | 'records'>]: string;
|
|
268
254
|
};
|
|
269
|
-
export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | Ref | RefEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue
|
|
255
|
+
export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | Ref | RefEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler';
|
|
2
|
-
import { AttributeNode, ElementDeclarationNode,
|
|
2
|
+
import { AttributeNode, ElementDeclarationNode, SyntaxNode } from '../nodes';
|
|
3
3
|
import { ColumnSymbol, NodeSymbol, TablePartialSymbol, TableSymbol } from '../symbol';
|
|
4
4
|
import { Internable } from '../internable';
|
|
5
5
|
export declare enum MetadataKind {
|
|
@@ -8,8 +8,7 @@ export declare enum MetadataKind {
|
|
|
8
8
|
TableChecks = "table checks",
|
|
9
9
|
Indexes = "indexes",
|
|
10
10
|
Records = "records",
|
|
11
|
-
Project = "project"
|
|
12
|
-
MetadataElement = "metadata element"
|
|
11
|
+
Project = "project"
|
|
13
12
|
}
|
|
14
13
|
declare const __nodeMetadataBrand: unique symbol;
|
|
15
14
|
export type NodeMetadataId = number & {
|
|
@@ -27,7 +26,6 @@ export declare abstract class NodeMetadata implements Internable<InternedNodeMet
|
|
|
27
26
|
constructor(declaration: SyntaxNode);
|
|
28
27
|
intern(): InternedNodeMetadata;
|
|
29
28
|
abstract owners(compiler: Compiler): NodeSymbol[];
|
|
30
|
-
reachableOwners(compiler: Compiler, targets: NodeSymbol[]): NodeSymbol[];
|
|
31
29
|
}
|
|
32
30
|
export declare class RefMetadata extends NodeMetadata {
|
|
33
31
|
declaration: ElementDeclarationNode | AttributeNode;
|
|
@@ -75,13 +73,6 @@ export declare class RecordsMetadata extends NodeMetadata {
|
|
|
75
73
|
table(compiler: Compiler): TableSymbol | undefined;
|
|
76
74
|
owners(compiler: Compiler): NodeSymbol[];
|
|
77
75
|
}
|
|
78
|
-
export declare class MetadataElementMetadata extends NodeMetadata {
|
|
79
|
-
declaration: MetadataDeclarationNode;
|
|
80
|
-
readonly kind = MetadataKind.MetadataElement;
|
|
81
|
-
constructor(declaration: MetadataDeclarationNode);
|
|
82
|
-
target(compiler: Compiler): NodeSymbol | undefined;
|
|
83
|
-
owners(compiler: Compiler): NodeSymbol[];
|
|
84
|
-
}
|
|
85
76
|
export declare class ProjectMetadata extends NodeMetadata {
|
|
86
77
|
readonly kind = MetadataKind.Project;
|
|
87
78
|
constructor(declaration: SyntaxNode);
|
|
@@ -24,7 +24,6 @@ export declare enum SymbolKind {
|
|
|
24
24
|
DiagramViewTableGroup = "DiagramView tablegroup",
|
|
25
25
|
DiagramViewNote = "DiagramView note",
|
|
26
26
|
DiagramViewSchema = "DiagramView schema",
|
|
27
|
-
Metadata = "Metadata",
|
|
28
27
|
Program = "Program"
|
|
29
28
|
}
|
|
30
29
|
export declare const ImportKind: {
|
|
@@ -34,17 +33,8 @@ export declare const ImportKind: {
|
|
|
34
33
|
TablePartial: SymbolKind;
|
|
35
34
|
Note: SymbolKind;
|
|
36
35
|
Schema: SymbolKind;
|
|
37
|
-
Metadata: SymbolKind;
|
|
38
36
|
};
|
|
39
37
|
export type ImportKind = (typeof ImportKind)[keyof typeof ImportKind];
|
|
40
|
-
export declare enum MetadataTargetKind {
|
|
41
|
-
Table = "table",
|
|
42
|
-
Schema = "schema",
|
|
43
|
-
Column = "column",
|
|
44
|
-
TableGroup = "tablegroup",
|
|
45
|
-
Note = "note"
|
|
46
|
-
}
|
|
47
|
-
export declare const ALLOWED_METADATA_TARGET_KINDS: readonly MetadataTargetKind[];
|
|
48
38
|
declare const __nodeSymbolBrand: unique symbol;
|
|
49
39
|
export type NodeSymbolId = number & {
|
|
50
40
|
readonly [__nodeSymbolBrand]: true;
|
|
@@ -8,7 +8,7 @@ export declare function extractElementName(nameNode: SyntaxNode): {
|
|
|
8
8
|
schemaName: string[];
|
|
9
9
|
name: string;
|
|
10
10
|
};
|
|
11
|
-
export declare function extractColor(node
|
|
11
|
+
export declare function extractColor(node: unknown): Color | undefined;
|
|
12
12
|
export declare function processDefaultValue(valueNode?: SyntaxNode): {
|
|
13
13
|
type: 'number' | 'string' | 'boolean' | 'expression';
|
|
14
14
|
value: string | number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementDeclarationNode,
|
|
1
|
+
import { ElementDeclarationNode, SyntaxNode } from '../types/nodes';
|
|
2
2
|
import { SyntaxToken } from '../types/tokens';
|
|
3
3
|
export declare function isOffsetWithinSpan(offset: number, nodeOrToken: SyntaxNode | SyntaxToken): boolean;
|
|
4
|
-
export declare function isOffsetWithinElementHeader(offset: number, element: ElementDeclarationNode
|
|
4
|
+
export declare function isOffsetWithinElementHeader(offset: number, element: ElementDeclarationNode): boolean;
|
|
@@ -6,9 +6,6 @@ export declare function isAsKeyword(token?: SyntaxToken): token is SyntaxToken &
|
|
|
6
6
|
export declare function isUseKeyword(token?: SyntaxToken): token is SyntaxToken & {
|
|
7
7
|
kind: SyntaxTokenKind.IDENTIFIER;
|
|
8
8
|
};
|
|
9
|
-
export declare function isMetadataKeyword(token?: SyntaxToken): token is SyntaxToken & {
|
|
10
|
-
kind: SyntaxTokenKind.IDENTIFIER;
|
|
11
|
-
};
|
|
12
9
|
export declare function isFromKeyword(token?: SyntaxToken): token is SyntaxToken & {
|
|
13
10
|
kind: SyntaxTokenKind.IDENTIFIER;
|
|
14
11
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CompileError, CompileErrorCode } from '../types/errors';
|
|
2
1
|
import { AttributeNode, BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, FunctionExpressionNode, InfixExpressionNode, ListExpressionNode, LiteralNode, PrefixExpressionNode, PrimaryExpressionNode, ProgramNode, SyntaxNode, TupleExpressionNode, UseDeclarationNode, UseSpecifierNode, VariableNode, WildcardNode } from '../types/nodes';
|
|
3
2
|
import { default as Report } from '../types/report';
|
|
4
3
|
import { SyntaxToken, SyntaxTokenKind } from '../types/tokens';
|
|
@@ -25,14 +24,7 @@ export declare function isValidPartialInjection(node?: SyntaxNode): node is Pref
|
|
|
25
24
|
};
|
|
26
25
|
};
|
|
27
26
|
export declare function isRelationshipOp(op?: string): boolean;
|
|
28
|
-
export declare function
|
|
29
|
-
expression: LiteralNode & {
|
|
30
|
-
literal: {
|
|
31
|
-
kind: SyntaxTokenKind.COLOR_LITERAL;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export declare function isValidColorOrNone(value?: SyntaxNode): boolean;
|
|
27
|
+
export declare function isValidColor(value?: SyntaxNode): boolean;
|
|
36
28
|
export declare function isValidDefaultValue(value?: SyntaxNode): boolean;
|
|
37
29
|
export type SignedNumberExpression = (PrimaryExpressionNode & {
|
|
38
30
|
expression: LiteralNode & {
|
|
@@ -53,11 +45,6 @@ export declare function isTupleOfVariables(value?: SyntaxNode): value is TupleEx
|
|
|
53
45
|
};
|
|
54
46
|
export declare function isValidColumnType(type: SyntaxNode): boolean;
|
|
55
47
|
export type Settings = Record<SettingName | string, AttributeNode[]>;
|
|
56
|
-
export declare function isValidMetadataValue(value?: SyntaxNode): boolean;
|
|
57
|
-
export declare function validateInlineMetadataSetting(name: string, attrs: AttributeNode[], codes: {
|
|
58
|
-
duplicate: CompileErrorCode;
|
|
59
|
-
invalidValue: CompileErrorCode;
|
|
60
|
-
}): CompileError[];
|
|
61
48
|
export declare function aggregateSettingList(settingList?: ListExpressionNode): Report<Settings>;
|
|
62
49
|
export declare function isExpressionAQuotedString(value?: unknown): value is PrimaryExpressionNode & ({
|
|
63
50
|
expression: VariableNode & {
|
|
@@ -97,11 +84,7 @@ type DotDelimitedIdentifier = PrimaryExpressionNode | (AccessExpression & {
|
|
|
97
84
|
});
|
|
98
85
|
export declare function isAccessExpression(node?: SyntaxNode): node is AccessExpression;
|
|
99
86
|
export declare function isDotDelimitedIdentifier(node?: SyntaxNode): node is DotDelimitedIdentifier;
|
|
100
|
-
export declare function isElementNode
|
|
101
|
-
type: {
|
|
102
|
-
value: T;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
87
|
+
export declare function isElementNode(node: SyntaxNode | undefined, kind: ElementKind): node is ElementDeclarationNode;
|
|
105
88
|
export declare function isUseDeclaration(node: SyntaxNode): node is UseDeclarationNode;
|
|
106
89
|
export declare function isUseSpecifier(node: SyntaxNode, kind?: ImportKind): node is UseSpecifierNode;
|
|
107
90
|
export declare function isWildcardSpecifier(node: SyntaxNode): node is WildcardNode;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/parse",
|
|
4
|
-
"version": "8.3.1
|
|
4
|
+
"version": "8.3.1",
|
|
5
5
|
"description": "DBML parser v2",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=18"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "b062d22d3608d8bb2969051721237cf5de28e069"
|
|
54
54
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { default as Compiler } from '../../../compiler';
|
|
2
|
-
import { CompileError } from '../../types';
|
|
3
|
-
import { MetadataDeclarationNode } from '../../types/nodes';
|
|
4
|
-
export default class MetadataBinder {
|
|
5
|
-
private compiler;
|
|
6
|
-
private declarationNode;
|
|
7
|
-
constructor(compiler: Compiler, declarationNode: MetadataDeclarationNode);
|
|
8
|
-
bind(): CompileError[];
|
|
9
|
-
private bindTargetElement;
|
|
10
|
-
private bindBody;
|
|
11
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { default as Compiler } from '../../../compiler';
|
|
2
|
-
import { Filepath } from '../../types';
|
|
3
|
-
import { MetadataElementMetadata } from '../../types/symbol/metadata';
|
|
4
|
-
import { SyntaxNode } from '../../types/nodes';
|
|
5
|
-
import { default as Report } from '../../types/report';
|
|
6
|
-
import { Color, CustomMetadata, MetadataElement } from '../../types/schemaJson';
|
|
7
|
-
import { Settings } from '../../utils/validate';
|
|
8
|
-
export declare function extractValue(node?: SyntaxNode): string | number | boolean | Color | undefined;
|
|
9
|
-
export declare const TABLE_BUILTIN_SETTINGS: readonly ["headercolor", "note"];
|
|
10
|
-
export declare const TABLEGROUP_BUILTIN_SETTINGS: readonly ["color", "note"];
|
|
11
|
-
export declare const NOTE_BUILTIN_SETTINGS: readonly ["color"];
|
|
12
|
-
export declare const COLUMN_BUILTIN_SETTINGS: readonly ["pk", "primary key", "unique", "note", "ref", "default", "check", "increment", "not null", "null"];
|
|
13
|
-
export declare function extractInlineMetadata(settingMap: Settings, builtinSettingNames: readonly string[]): CustomMetadata;
|
|
14
|
-
export default class MetadataInterpreter {
|
|
15
|
-
private declarationNode;
|
|
16
|
-
private compiler;
|
|
17
|
-
private filepath;
|
|
18
|
-
private metadata;
|
|
19
|
-
constructor(compiler: Compiler, metadata: MetadataElementMetadata, filepath: Filepath);
|
|
20
|
-
interpret(): Report<MetadataElement>;
|
|
21
|
-
private interpretTarget;
|
|
22
|
-
private interpretValues;
|
|
23
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MetadataTargetKind } from '../../types/symbol';
|
|
2
|
-
export declare enum OverlapValueKind {
|
|
3
|
-
Note = "note",
|
|
4
|
-
Color = "color",
|
|
5
|
-
HeaderColor = "headercolor"
|
|
6
|
-
}
|
|
7
|
-
export type OverlapInlineField = 'note' | 'color' | 'headerColor';
|
|
8
|
-
export interface OverlapKey {
|
|
9
|
-
metaKey: string;
|
|
10
|
-
field: OverlapInlineField;
|
|
11
|
-
reshape: OverlapValueKind;
|
|
12
|
-
}
|
|
13
|
-
export declare const OVERLAP_KEYS: Partial<Record<MetadataTargetKind, OverlapKey[]>>;
|
|
14
|
-
export declare function findOverlapKey(kind: MetadataTargetKind | undefined, key: string): OverlapKey | undefined;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { default as Compiler } from '../../../compiler/index';
|
|
2
|
-
import { MetadataDeclarationNode } from '../../types/nodes';
|
|
3
|
-
import { NodeSymbol } from '../../types/symbol';
|
|
4
|
-
export declare function resolveMetadataTarget(compiler: Compiler, metadataNode: MetadataDeclarationNode): NodeSymbol | undefined;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { default as Compiler } from '../../../compiler';
|
|
2
|
-
import { CompileError } from '../../types/errors';
|
|
3
|
-
import { MetadataDeclarationNode } from '../../types/nodes';
|
|
4
|
-
export default class MetadataValidator {
|
|
5
|
-
private compiler;
|
|
6
|
-
private declarationNode;
|
|
7
|
-
constructor(compiler: Compiler, declarationNode: MetadataDeclarationNode);
|
|
8
|
-
validate(): CompileError[];
|
|
9
|
-
private validateTargetKind;
|
|
10
|
-
private validateTargetName;
|
|
11
|
-
private validateBody;
|
|
12
|
-
private validateFields;
|
|
13
|
-
private validateSubElements;
|
|
14
|
-
}
|