@dbml/parse 8.3.0-alpha.0 → 9.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/LICENSE +0 -0
- package/dist/__benchmarks__/compiler.benchmark.d.ts +1 -0
- package/dist/__benchmarks__/compiler.profile.d.ts +1 -0
- package/dist/dbml-parse.js +19 -19
- package/dist/dbml-parse.mjs +10952 -10162
- package/dist/index.d.ts +0 -0
- package/dist/src/compiler/index.d.ts +2 -0
- package/dist/src/compiler/projectLayout/index.d.ts +0 -0
- package/dist/src/compiler/projectLayout/layout.d.ts +0 -0
- package/dist/src/compiler/queries/canonicalName.d.ts +0 -0
- package/dist/src/compiler/queries/container/element.d.ts +0 -0
- package/dist/src/compiler/queries/container/index.d.ts +0 -0
- package/dist/src/compiler/queries/container/scope.d.ts +0 -0
- package/dist/src/compiler/queries/container/scopeKind.d.ts +0 -0
- package/dist/src/compiler/queries/container/stack.d.ts +0 -0
- package/dist/src/compiler/queries/container/token.d.ts +0 -0
- package/dist/src/compiler/queries/files/fileDependencies.d.ts +0 -0
- package/dist/src/compiler/queries/files/reachableFiles.d.ts +0 -0
- package/dist/src/compiler/queries/files/usableMembers.d.ts +0 -0
- package/dist/src/compiler/queries/legacy/parse.d.ts +0 -0
- package/dist/src/compiler/queries/legacy/symbol.d.ts +0 -0
- package/dist/src/compiler/queries/legacy/token.d.ts +0 -0
- package/dist/src/compiler/queries/nodeAtPosition.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/bind.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/index.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/interpret.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/parse.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/validate.d.ts +0 -0
- package/dist/src/compiler/queries/resolutionIndex.d.ts +0 -0
- package/dist/src/compiler/queries/symbol/lookupMembers.d.ts +1 -0
- package/dist/src/compiler/queries/symbol/symbolAliases.d.ts +0 -0
- package/dist/src/compiler/queries/symbol/symbolUses.d.ts +0 -0
- package/dist/src/compiler/queries/transform/applyTextEdits.d.ts +0 -0
- package/dist/src/compiler/queries/transform/index.d.ts +0 -0
- package/dist/src/compiler/queries/transform/renameTable.d.ts +0 -0
- package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +0 -0
- package/dist/src/compiler/queries/transform/utils.d.ts +0 -0
- package/dist/src/compiler/queries/utils.d.ts +0 -0
- package/dist/src/compiler/types.d.ts +0 -0
- package/dist/src/constants.d.ts +0 -0
- package/dist/src/core/global_modules/checks/bind.d.ts +0 -0
- package/dist/src/core/global_modules/checks/index.d.ts +0 -0
- package/dist/src/core/global_modules/checks/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/dep/bind.d.ts +15 -0
- package/dist/src/core/global_modules/dep/index.d.ts +2 -0
- package/dist/src/core/global_modules/dep/interpret.d.ts +34 -0
- package/dist/src/core/global_modules/diagramView/bind.d.ts +0 -0
- package/dist/src/core/global_modules/diagramView/index.d.ts +0 -0
- package/dist/src/core/global_modules/diagramView/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/enum/bind.d.ts +0 -0
- package/dist/src/core/global_modules/enum/index.d.ts +0 -0
- package/dist/src/core/global_modules/enum/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/index.d.ts +0 -0
- package/dist/src/core/global_modules/indexes/bind.d.ts +0 -0
- package/dist/src/core/global_modules/indexes/index.d.ts +0 -0
- package/dist/src/core/global_modules/indexes/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/note/bind.d.ts +0 -0
- package/dist/src/core/global_modules/note/index.d.ts +0 -0
- package/dist/src/core/global_modules/note/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/program/bind.d.ts +0 -0
- package/dist/src/core/global_modules/program/index.d.ts +0 -0
- package/dist/src/core/global_modules/program/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/program/utils.d.ts +0 -0
- package/dist/src/core/global_modules/project/bind.d.ts +0 -0
- package/dist/src/core/global_modules/project/index.d.ts +0 -0
- package/dist/src/core/global_modules/project/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/records/bind.d.ts +0 -0
- package/dist/src/core/global_modules/records/index.d.ts +0 -0
- package/dist/src/core/global_modules/records/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/fk.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/helper.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/index.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/pk.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/unique.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/data/index.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/data/sqlTypes.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/data/values.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/index.d.ts +0 -0
- package/dist/src/core/global_modules/ref/bind.d.ts +0 -0
- package/dist/src/core/global_modules/ref/index.d.ts +1 -0
- package/dist/src/core/global_modules/ref/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/schema/index.d.ts +0 -0
- package/dist/src/core/global_modules/table/bind.d.ts +2 -0
- package/dist/src/core/global_modules/table/index.d.ts +0 -0
- package/dist/src/core/global_modules/table/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/table/utils.d.ts +0 -0
- package/dist/src/core/global_modules/tableGroup/bind.d.ts +0 -0
- package/dist/src/core/global_modules/tableGroup/index.d.ts +0 -0
- package/dist/src/core/global_modules/tableGroup/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/tablePartial/bind.d.ts +0 -0
- package/dist/src/core/global_modules/tablePartial/index.d.ts +0 -0
- package/dist/src/core/global_modules/tablePartial/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/types.d.ts +0 -0
- package/dist/src/core/global_modules/use/index.d.ts +0 -0
- package/dist/src/core/global_modules/utils.d.ts +0 -0
- package/dist/src/core/lexer/lexer.d.ts +0 -0
- package/dist/src/core/lexer/utils.d.ts +0 -0
- package/dist/src/core/local_modules/checks/index.d.ts +0 -0
- package/dist/src/core/local_modules/checks/validate.d.ts +0 -0
- package/dist/src/core/local_modules/custom/index.d.ts +0 -0
- package/dist/src/core/local_modules/custom/validate.d.ts +0 -0
- package/dist/src/core/local_modules/dep/index.d.ts +2 -0
- package/dist/src/core/local_modules/dep/validate.d.ts +18 -0
- package/dist/src/core/local_modules/diagramView/index.d.ts +0 -0
- package/dist/src/core/local_modules/diagramView/validate.d.ts +0 -0
- package/dist/src/core/local_modules/enum/index.d.ts +0 -0
- package/dist/src/core/local_modules/enum/validate.d.ts +0 -0
- package/dist/src/core/local_modules/index.d.ts +0 -0
- package/dist/src/core/local_modules/indexes/index.d.ts +0 -0
- package/dist/src/core/local_modules/indexes/validate.d.ts +0 -0
- package/dist/src/core/local_modules/note/index.d.ts +0 -0
- package/dist/src/core/local_modules/note/validate.d.ts +0 -0
- package/dist/src/core/local_modules/program/index.d.ts +0 -0
- package/dist/src/core/local_modules/program/validate.d.ts +0 -0
- package/dist/src/core/local_modules/project/index.d.ts +0 -0
- package/dist/src/core/local_modules/project/validate.d.ts +0 -0
- package/dist/src/core/local_modules/records/index.d.ts +0 -0
- package/dist/src/core/local_modules/records/validate.d.ts +0 -0
- package/dist/src/core/local_modules/ref/index.d.ts +0 -0
- package/dist/src/core/local_modules/ref/validate.d.ts +0 -0
- package/dist/src/core/local_modules/table/index.d.ts +0 -0
- package/dist/src/core/local_modules/table/validate.d.ts +0 -0
- package/dist/src/core/local_modules/tableGroup/index.d.ts +0 -0
- package/dist/src/core/local_modules/tableGroup/validate.d.ts +0 -0
- package/dist/src/core/local_modules/tablePartial/index.d.ts +0 -0
- package/dist/src/core/local_modules/tablePartial/validate.d.ts +0 -0
- package/dist/src/core/local_modules/types.d.ts +0 -0
- package/dist/src/core/local_modules/use/index.d.ts +0 -0
- package/dist/src/core/local_modules/use/validate.d.ts +0 -0
- package/dist/src/core/parser/contextStack.d.ts +0 -0
- package/dist/src/core/parser/factory.d.ts +0 -0
- package/dist/src/core/parser/parser.d.ts +0 -0
- package/dist/src/core/parser/utils.d.ts +0 -0
- package/dist/src/core/types/errors.d.ts +52 -50
- package/dist/src/core/types/filepath.d.ts +0 -0
- package/dist/src/core/types/index.d.ts +0 -0
- package/dist/src/core/types/internable.d.ts +0 -0
- package/dist/src/core/types/keywords.d.ts +2 -0
- package/dist/src/core/types/module.d.ts +0 -0
- package/dist/src/core/types/nodes.d.ts +0 -0
- package/dist/src/core/types/position.d.ts +0 -0
- package/dist/src/core/types/report.d.ts +3 -3
- package/dist/src/core/types/schemaJson.d.ts +32 -1
- package/dist/src/core/types/symbol/factory.d.ts +0 -0
- package/dist/src/core/types/symbol/index.d.ts +0 -0
- package/dist/src/core/types/symbol/metadata.d.ts +15 -1
- package/dist/src/core/types/symbol/symbols.d.ts +0 -0
- package/dist/src/core/types/tokens.d.ts +0 -0
- package/dist/src/core/utils/chars.d.ts +0 -0
- package/dist/src/core/utils/expression.d.ts +0 -0
- package/dist/src/core/utils/interpret.d.ts +0 -0
- package/dist/src/core/utils/numbers.d.ts +0 -0
- package/dist/src/core/utils/span.d.ts +0 -0
- package/dist/src/core/utils/tokens.d.ts +0 -0
- package/dist/src/core/utils/validate.d.ts +0 -0
- package/dist/src/index.d.ts +0 -0
- package/dist/src/services/definition/provider.d.ts +0 -0
- package/dist/src/services/diagnostics/provider.d.ts +0 -0
- package/dist/src/services/index.d.ts +0 -0
- package/dist/src/services/monarch.d.ts +0 -0
- package/dist/src/services/references/provider.d.ts +0 -0
- package/dist/src/services/suggestions/crossFile.d.ts +0 -0
- package/dist/src/services/suggestions/provider.d.ts +0 -0
- package/dist/src/services/suggestions/recordRowSnippet.d.ts +0 -0
- package/dist/src/services/suggestions/use.d.ts +0 -0
- package/dist/src/services/suggestions/utils/index.d.ts +0 -0
- package/dist/src/services/suggestions/utils/useMerger.d.ts +0 -0
- package/dist/src/services/types.d.ts +0 -0
- package/dist/src/services/utils.d.ts +0 -0
- package/package.json +8 -4
|
@@ -58,6 +58,7 @@ export interface Database {
|
|
|
58
58
|
tables: Table[];
|
|
59
59
|
notes: Note[];
|
|
60
60
|
refs: Ref[];
|
|
61
|
+
deps: Dep[];
|
|
61
62
|
enums: Enum[];
|
|
62
63
|
tableGroups: TableGroup[];
|
|
63
64
|
aliases: Alias[];
|
|
@@ -110,6 +111,7 @@ export interface Column {
|
|
|
110
111
|
type: ColumnType;
|
|
111
112
|
token: TokenPosition;
|
|
112
113
|
inline_refs: InlineRef[];
|
|
114
|
+
inline_deps: InlineDep[];
|
|
113
115
|
checks: Check[];
|
|
114
116
|
pk?: boolean;
|
|
115
117
|
dbdefault?: {
|
|
@@ -171,6 +173,35 @@ export interface RefEndpoint {
|
|
|
171
173
|
token: TokenPosition;
|
|
172
174
|
}
|
|
173
175
|
export type RelationCardinality = '1' | '*';
|
|
176
|
+
export interface Dep {
|
|
177
|
+
schemaName: string | null;
|
|
178
|
+
name: string | null;
|
|
179
|
+
edges: DepEdge[];
|
|
180
|
+
note?: {
|
|
181
|
+
value: string;
|
|
182
|
+
token: TokenPosition;
|
|
183
|
+
};
|
|
184
|
+
custom?: Record<string, string | number | boolean | null>;
|
|
185
|
+
token: TokenPosition;
|
|
186
|
+
}
|
|
187
|
+
export interface DepEdge {
|
|
188
|
+
upstream: DepEndpoint;
|
|
189
|
+
downstream: DepEndpoint;
|
|
190
|
+
token: TokenPosition;
|
|
191
|
+
}
|
|
192
|
+
export interface DepEndpoint {
|
|
193
|
+
schemaName: string | null;
|
|
194
|
+
tableName: string;
|
|
195
|
+
fieldNames: string[];
|
|
196
|
+
token: TokenPosition;
|
|
197
|
+
}
|
|
198
|
+
export interface InlineDep {
|
|
199
|
+
schemaName: string | null;
|
|
200
|
+
tableName: string;
|
|
201
|
+
fieldNames: string[];
|
|
202
|
+
direction: '->' | '<-';
|
|
203
|
+
token: TokenPosition;
|
|
204
|
+
}
|
|
174
205
|
export interface Enum {
|
|
175
206
|
name: string;
|
|
176
207
|
schemaName: string | null;
|
|
@@ -252,4 +283,4 @@ export type Project = Record<string, never> | {
|
|
|
252
283
|
token: TokenPosition;
|
|
253
284
|
[index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note' | 'tablePartials' | 'records'>]: string;
|
|
254
285
|
};
|
|
255
|
-
export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | Ref | RefEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue;
|
|
286
|
+
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;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler';
|
|
2
|
-
import { AttributeNode, ElementDeclarationNode, SyntaxNode } from '../nodes';
|
|
2
|
+
import { AttributeNode, ElementDeclarationNode, InfixExpressionNode, SyntaxNode } from '../nodes';
|
|
3
3
|
import { ColumnSymbol, NodeSymbol, TablePartialSymbol, TableSymbol } from '../symbol';
|
|
4
4
|
import { Internable } from '../internable';
|
|
5
5
|
export declare enum MetadataKind {
|
|
6
6
|
Ref = "ref",
|
|
7
|
+
Dep = "dep",
|
|
7
8
|
PartialRef = "partial ref",
|
|
8
9
|
TableChecks = "table checks",
|
|
9
10
|
Indexes = "indexes",
|
|
@@ -42,6 +43,19 @@ export declare class RefMetadata extends NodeMetadata {
|
|
|
42
43
|
rightToken(): SyntaxNode;
|
|
43
44
|
owners(compiler: Compiler): NodeSymbol[];
|
|
44
45
|
}
|
|
46
|
+
export declare class DepMetadata extends NodeMetadata {
|
|
47
|
+
declaration: ElementDeclarationNode | AttributeNode;
|
|
48
|
+
readonly kind = MetadataKind.Dep;
|
|
49
|
+
constructor(declaration: ElementDeclarationNode | AttributeNode);
|
|
50
|
+
container(compiler: Compiler): TableSymbol | undefined;
|
|
51
|
+
edgeExpressions(): InfixExpressionNode[];
|
|
52
|
+
upstreamColumns(compiler: Compiler): ColumnSymbol[][];
|
|
53
|
+
downstreamColumns(compiler: Compiler): ColumnSymbol[][];
|
|
54
|
+
upstreamTables(compiler: Compiler): (TableSymbol | undefined)[];
|
|
55
|
+
downstreamTables(compiler: Compiler): (TableSymbol | undefined)[];
|
|
56
|
+
private hostColumn;
|
|
57
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
58
|
+
}
|
|
45
59
|
export declare class PartialRefMetadata extends NodeMetadata {
|
|
46
60
|
readonly kind = MetadataKind.PartialRef;
|
|
47
61
|
constructor(declaration: SyntaxNode);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/src/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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": "
|
|
4
|
+
"version": "9.0.0-alpha.0",
|
|
5
5
|
"description": "DBML parser v2",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -32,11 +32,15 @@
|
|
|
32
32
|
"coverage": "vitest run --coverage",
|
|
33
33
|
"prepare": "npm run build",
|
|
34
34
|
"lint": "eslint .",
|
|
35
|
-
"lint:fix": "eslint --fix ."
|
|
35
|
+
"lint:fix": "eslint --fix .",
|
|
36
|
+
"bench": "npx tsx __benchmarks__/compiler.benchmark.ts",
|
|
37
|
+
"profile:build": "vite build --config vite.profile.config.mts && cp -r __benchmarks__/input dist-profile/input",
|
|
38
|
+
"profile": "yarn profile:build && node --cpu-prof --cpu-prof-dir __benchmarks__/output/ dist-profile/__benchmarks__/compiler.profile.mjs"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
41
|
"@types/luxon": "^3.7.1",
|
|
39
|
-
"monaco-editor-core": "^0.44.0"
|
|
42
|
+
"monaco-editor-core": "^0.44.0",
|
|
43
|
+
"vite-plugin-no-bundle": "^4.0.0"
|
|
40
44
|
},
|
|
41
45
|
"dependencies": {
|
|
42
46
|
"lodash-es": "^4.18.1",
|
|
@@ -46,5 +50,5 @@
|
|
|
46
50
|
"engines": {
|
|
47
51
|
"node": ">=18"
|
|
48
52
|
},
|
|
49
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "42f47720972690ad350f28b3da9cc52420074d64"
|
|
50
54
|
}
|