@dbml/parse 11.0.0-alpha.5 → 11.0.0-alpha.6
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 +26 -26
- package/dist/dbml-parse.mjs +2404 -2548
- package/dist/src/compiler/index.d.ts +0 -2
- package/dist/src/compiler/queries/files/fileKind.d.ts +1 -7
- package/dist/src/core/arch/vocabulary.d.ts +7 -8
- package/dist/src/core/global_modules/arch/interpret.d.ts +2 -4
- package/dist/src/core/global_modules/arch/utils.d.ts +0 -2
- package/dist/src/core/types/errors.d.ts +3 -3
- package/dist/src/core/types/schemaJson/types.d.ts +2 -15
- package/dist/src/core/types/symbol/symbols.d.ts +0 -9
- package/dist/src/index.d.ts +2 -2
- package/dist/src/services/suggestions/provider.d.ts +1 -1
- package/package.json +2 -2
|
@@ -34,8 +34,6 @@ export default class Compiler {
|
|
|
34
34
|
fileKind(filepath: Filepath): FileKind;
|
|
35
35
|
fileKindForParse(filepath: Filepath, tokens?: readonly SyntaxToken[]): FileKind;
|
|
36
36
|
parsedFileKind(filepath: Filepath): FileKind;
|
|
37
|
-
private decideKind;
|
|
38
|
-
private refreshFileKind;
|
|
39
37
|
private sourceSnapshot;
|
|
40
38
|
private cleanStaleLocalCache;
|
|
41
39
|
private entrypointsSnapshot;
|
|
@@ -5,14 +5,8 @@ export declare const isArchDiagramType: (type: string | null | undefined) => boo
|
|
|
5
5
|
export interface FileScan {
|
|
6
6
|
frontMatter: Record<string, string>;
|
|
7
7
|
topWords: string[];
|
|
8
|
-
kindNames: string[];
|
|
9
|
-
usePaths: string[];
|
|
10
8
|
}
|
|
11
9
|
export declare function readFrontMatter(block: string): Record<string, string>;
|
|
12
10
|
export declare function frontMatterToken(tokens: readonly SyntaxToken[]): SyntaxToken | undefined;
|
|
13
11
|
export declare function scanTokens(tokens: readonly SyntaxToken[]): FileScan;
|
|
14
|
-
export
|
|
15
|
-
kind: FileKind;
|
|
16
|
-
dependsOnImports: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare function decideFileKind(scan: FileScan, importedScans: () => FileScan[]): FileKindResult;
|
|
12
|
+
export declare function decideFileKind(scan: FileScan): FileKind;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export interface
|
|
1
|
+
export type RoleCategory = 'compute' | 'data' | 'net' | 'edge' | 'people' | 'ops';
|
|
2
|
+
export interface RoleSpec {
|
|
3
3
|
icon: string;
|
|
4
|
-
category:
|
|
4
|
+
category: RoleCategory;
|
|
5
5
|
}
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare
|
|
9
|
-
export declare
|
|
10
|
-
export declare const isReserved: (word: string) => boolean;
|
|
6
|
+
export declare const BUILTIN_ROLES: Record<string, RoleSpec>;
|
|
7
|
+
export declare const roleName: (typed: string) => string | undefined;
|
|
8
|
+
export declare const NO_CUSTOM_ROLE_MESSAGE = "Custom roles are not supported. Use a built-in role; `type` sets the mark (a mark name or an image URL) and `color` the colour.";
|
|
9
|
+
export declare function suggestRole(typed: string): string;
|
|
11
10
|
export declare function suggestIcon(typed: string): string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler';
|
|
2
2
|
import { Filepath } from '../../types/filepath';
|
|
3
3
|
import { default as Report } from '../../types/report';
|
|
4
|
-
import { ArchSettings, Group,
|
|
5
|
-
import { ElementSymbol
|
|
4
|
+
import { ArchSettings, Group, Link, Node } from '../../types/schemaJson';
|
|
5
|
+
import { ElementSymbol } from '../../types/symbol';
|
|
6
6
|
import { ArchMetadataElementMetadata, LinkMetadata } from '../../types/symbol/metadata';
|
|
7
7
|
export declare function interpretElement(compiler: Compiler, symbol: ElementSymbol, filepath: Filepath): Report<Node | Group | undefined>;
|
|
8
|
-
export declare function interpretKind(symbol: KindSymbol): Report<Kind | undefined>;
|
|
9
|
-
export declare function builtinKinds(): Kind[];
|
|
10
8
|
export declare function interpretLink(compiler: Compiler, metadata: LinkMetadata, filepath: Filepath): Report<Link | undefined>;
|
|
11
9
|
export declare function interpretArchMetadata(metadata: ArchMetadataElementMetadata): Report<ArchSettings>;
|
|
@@ -2,6 +2,4 @@ import { default as Compiler } from '../../../compiler';
|
|
|
2
2
|
import { Filepath } from '../../types/filepath';
|
|
3
3
|
import { NodeSymbol, SymbolKind } from '../../types/symbol';
|
|
4
4
|
export declare function lookupVisible(compiler: Compiler, filepath: Filepath, kind: SymbolKind, name: string): NodeSymbol | undefined;
|
|
5
|
-
export declare function visibleKinds(compiler: Compiler, filepath: Filepath): Map<string, NodeSymbol>;
|
|
6
|
-
export declare function resolveRole(compiler: Compiler, filepath: Filepath, word: string): string | undefined;
|
|
7
5
|
export declare function originalHandle(compiler: Compiler, symbol: NodeSymbol, filepath: Filepath): string | undefined;
|
|
@@ -127,9 +127,9 @@ export declare enum CompileErrorCode {
|
|
|
127
127
|
INVALID_METADATA_TARGET_KIND = 5010,
|
|
128
128
|
INVALID_METADATA_FIELD = 5011,
|
|
129
129
|
DUPLICATE_METADATA_FIELD = 5012,
|
|
130
|
-
|
|
130
|
+
UNKNOWN_ROLE = 6000,
|
|
131
131
|
MISSING_NAME = 6001,
|
|
132
|
-
|
|
132
|
+
NO_CUSTOM_ROLE = 6002,
|
|
133
133
|
UNKNOWN_ENDPOINT = 6003,
|
|
134
134
|
EMPTY_LINK = 6004,
|
|
135
135
|
BAD_LINK = 6005,
|
|
@@ -137,7 +137,7 @@ export declare enum CompileErrorCode {
|
|
|
137
137
|
BAD_PROPERTY = 6007,
|
|
138
138
|
DUPLICATE_PROPERTY = 6008,
|
|
139
139
|
DIAGRAM_TYPE_NOT_HERE = 6009,
|
|
140
|
-
|
|
140
|
+
METADATA_ROLE_MISMATCH = 6010,
|
|
141
141
|
UNKNOWN_TYPE = 6011,
|
|
142
142
|
UNKNOWN_ICON = 6012,
|
|
143
143
|
BAD_IMAGE = 6013,
|
|
@@ -29,7 +29,6 @@ export interface DatabaseExternals {
|
|
|
29
29
|
notes: ElementRef[];
|
|
30
30
|
nodes?: ElementRef[];
|
|
31
31
|
groups?: ElementRef[];
|
|
32
|
-
kinds?: ElementRef[];
|
|
33
32
|
}
|
|
34
33
|
/**
|
|
35
34
|
* FilterConfig is a tri-state filter:
|
|
@@ -76,17 +75,15 @@ export interface Database {
|
|
|
76
75
|
nodes?: Node[];
|
|
77
76
|
groups?: Group[];
|
|
78
77
|
links?: Link[];
|
|
79
|
-
kinds?: Kind[];
|
|
80
78
|
frontMatter?: Record<string, string>;
|
|
81
79
|
diagramType?: 'arch';
|
|
82
80
|
}
|
|
83
81
|
export type ArchSettingValue = string | number | boolean;
|
|
84
82
|
export type ArchSettings = Record<string, ArchSettingValue>;
|
|
85
|
-
export type KindCategory = 'compute' | 'data' | 'net' | 'edge' | 'people' | 'ops' | 'custom';
|
|
86
83
|
export interface Node {
|
|
87
84
|
name: string;
|
|
88
85
|
alias: string | null;
|
|
89
|
-
|
|
86
|
+
role: string;
|
|
90
87
|
type: string | null;
|
|
91
88
|
image: string | null;
|
|
92
89
|
settings: ArchSettings;
|
|
@@ -115,16 +112,6 @@ export interface Link {
|
|
|
115
112
|
settings: ArchSettings;
|
|
116
113
|
token: TokenPosition;
|
|
117
114
|
}
|
|
118
|
-
export interface Kind {
|
|
119
|
-
name: string;
|
|
120
|
-
icon: string;
|
|
121
|
-
glyph: string[] | null;
|
|
122
|
-
image: string | null;
|
|
123
|
-
category: KindCategory;
|
|
124
|
-
color: string | null;
|
|
125
|
-
builtin: boolean;
|
|
126
|
-
token: TokenPosition | null;
|
|
127
|
-
}
|
|
128
115
|
export interface MasterDatabase {
|
|
129
116
|
files: Record<string, Database>;
|
|
130
117
|
}
|
|
@@ -351,4 +338,4 @@ export type Project = Record<string, never> | {
|
|
|
351
338
|
token: TokenPosition;
|
|
352
339
|
[index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note' | 'tablePartials' | 'records'>]: string;
|
|
353
340
|
};
|
|
354
|
-
export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | InlineDep | Ref | RefEndpoint | Dep | DepEdge | DepEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue | MetadataValues | Node | Group | Link |
|
|
341
|
+
export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | InlineDep | Ref | RefEndpoint | Dep | DepEdge | DepEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue | MetadataValues | Node | Group | Link | ArchSettings;
|
|
@@ -26,7 +26,6 @@ export declare enum SymbolKind {
|
|
|
26
26
|
DiagramViewSchema = "DiagramView schema",
|
|
27
27
|
Metadata = "Metadata",
|
|
28
28
|
Element = "Element",
|
|
29
|
-
Kind = "Kind",
|
|
30
29
|
Program = "Program"
|
|
31
30
|
}
|
|
32
31
|
export declare const ImportKind: {
|
|
@@ -213,14 +212,6 @@ export declare class ElementSymbol extends NodeSymbol {
|
|
|
213
212
|
get canBeImported(): boolean;
|
|
214
213
|
get originalSymbol(): NodeSymbol;
|
|
215
214
|
}
|
|
216
|
-
export declare class KindSymbol extends NodeSymbol {
|
|
217
|
-
constructor({ declaration, name, }: {
|
|
218
|
-
declaration?: SyntaxNode;
|
|
219
|
-
name?: string;
|
|
220
|
-
}, id: NodeSymbolId, filepath: Filepath);
|
|
221
|
-
get canBeImported(): boolean;
|
|
222
|
-
get originalSymbol(): NodeSymbol;
|
|
223
|
-
}
|
|
224
215
|
export declare class NoteSymbol extends NodeSymbol {
|
|
225
216
|
constructor({ declaration, name, }: {
|
|
226
217
|
declaration?: SyntaxNode;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export { SyntaxToken, SyntaxTokenKind, isTriviaToken, isOp, isOpToken, } from '.
|
|
|
11
11
|
export { CompileError, CompileErrorCode, } from './core/types/errors';
|
|
12
12
|
export type { Position, } from './core/types';
|
|
13
13
|
export { ScopeKind, splitQualifiedIdentifier, unescapeString, escapeString, formatRecordValue, isValidIdentifier, addDoubleQuoteIfNeeded, normalizeQualifiedName, } from './compiler/index';
|
|
14
|
-
export { type Database, type MasterDatabase, type Table, type Note, type Column, type ColumnType, type Index, type Check, type InlineRef, type Ref, type RefEndpointPair, type RefEndpoint, type Enum, type EnumField, type TableGroup, type TableGroupField, type Alias, type AliasKind, type TablePartial, type TablePartialInjection, type RecordValue, type RecordValueType, type TableRecord, type Project, type SchemaElement, type TokenPosition, type ElementRef, type FilterConfig, type DiagramView, type CustomMetadata, type Node, type Group, type Link, type LinkOp, type
|
|
14
|
+
export { type Database, type MasterDatabase, type Table, type Note, type Column, type ColumnType, type Index, type Check, type InlineRef, type Ref, type RefEndpointPair, type RefEndpoint, type Enum, type EnumField, type TableGroup, type TableGroupField, type Alias, type AliasKind, type TablePartial, type TablePartialInjection, type RecordValue, type RecordValueType, type TableRecord, type Project, type SchemaElement, type TokenPosition, type ElementRef, type FilterConfig, type DiagramView, type CustomMetadata, type Node, type Group, type Link, type LinkOp, type ArchSettings, type ArchSettingValue, } from './core/types/schemaJson';
|
|
15
15
|
export { type FileKind, ARCH_DIAGRAM_TYPES, isArchDiagramType } from './compiler/queries/files/fileKind';
|
|
16
|
-
export {
|
|
16
|
+
export { BUILTIN_ROLES, suggestRole, suggestIcon, type RoleSpec, } from './core/arch/vocabulary';
|
|
17
17
|
export { ICON_ALIAS, ICON_NAMES, isIconName, resolveIcon, } from './core/arch/icons';
|
|
18
18
|
export { type RelationCardinality, type RelationshipOp, getRelationshipOp, getMultiplicities, parseCardinality, makeCardinalityRequired, makeCardinalityOptional, makeRelationshipRequired, isEndpointOneSide, isEndpointManySide, isEndpointOptional, isEndpointRequired, CARDINALITY_ONE, CARDINALITY_MAYBE, CARDINALITY_SOME, CARDINALITY_MANY, } from './core/types/relation';
|
|
19
19
|
export type { DiagramViewSyncOperation, DiagramViewBlock, TextEdit, } from './compiler/queries/transform';
|
|
@@ -27,4 +27,4 @@ export default class DBMLCompletionItemProvider implements CompletionItemProvide
|
|
|
27
27
|
constructor(compiler: Compiler, options?: DBMLCompletionItemProviderOptions);
|
|
28
28
|
provideCompletionItems(model: TextModel, position: Position): CompletionList;
|
|
29
29
|
}
|
|
30
|
-
export declare const TOP_LEVEL_SUGGESTION_LABELS: ("Table" | "Enum" | "TableGroup" | "TablePartial" | "Note" | "
|
|
30
|
+
export declare const TOP_LEVEL_SUGGESTION_LABELS: ("Table" | "Enum" | "TableGroup" | "TablePartial" | "Note" | "DiagramView" | "Metadata" | "Ref" | "Dep" | "Project" | "Records")[];
|
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": "11.0.0-alpha.
|
|
4
|
+
"version": "11.0.0-alpha.6",
|
|
5
5
|
"description": "DBML parser v2",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=18"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "8d191d7fc27af2f5daab6d9074f7c3882f3541ab"
|
|
55
55
|
}
|