@dbml/parse 7.1.2 → 8.0.0-alpha.4
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 +29 -19
- package/dist/dbml-parse.mjs +11098 -7342
- package/dist/src/compiler/index.d.ts +88 -52
- package/dist/src/compiler/projectLayout/index.d.ts +1 -0
- package/dist/src/compiler/projectLayout/layout.d.ts +27 -0
- package/dist/src/compiler/queries/canonicalName.d.ts +9 -0
- package/dist/src/compiler/queries/container/element.d.ts +2 -1
- package/dist/src/compiler/queries/container/scope.d.ts +3 -2
- package/dist/src/compiler/queries/container/scopeKind.d.ts +2 -1
- package/dist/src/compiler/queries/container/stack.d.ts +2 -1
- package/dist/src/compiler/queries/container/token.d.ts +2 -1
- package/dist/src/compiler/queries/files/fileDependencies.d.ts +3 -0
- package/dist/src/compiler/queries/files/reachableFiles.d.ts +3 -0
- package/dist/src/compiler/queries/files/usableMembers.d.ts +34 -0
- package/dist/src/compiler/queries/legacy/parse.d.ts +10 -9
- package/dist/src/compiler/queries/legacy/symbol.d.ts +1 -10
- package/dist/src/compiler/queries/legacy/token.d.ts +3 -2
- package/dist/src/compiler/queries/nodeAtPosition.d.ts +5 -0
- package/dist/src/compiler/queries/pipeline/bind.d.ts +5 -0
- package/dist/src/compiler/queries/pipeline/index.d.ts +2 -0
- package/dist/src/compiler/queries/pipeline/interpret.d.ts +6 -0
- package/dist/src/compiler/queries/pipeline/parse.d.ts +12 -0
- package/dist/src/compiler/queries/pipeline/validate.d.ts +4 -0
- package/dist/src/compiler/queries/resolutionIndex.d.ts +11 -0
- package/dist/src/compiler/queries/symbol/lookupMembers.d.ts +4 -0
- package/dist/src/compiler/queries/symbol/symbolAliases.d.ts +4 -0
- package/dist/src/compiler/queries/symbol/symbolUses.d.ts +4 -0
- package/dist/src/compiler/queries/transform/index.d.ts +1 -1
- package/dist/src/compiler/queries/transform/renameTable.d.ts +21 -16
- package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +19 -6
- package/dist/src/compiler/queries/transform/utils.d.ts +5 -4
- package/dist/src/compiler/queries/utils.d.ts +6 -0
- package/dist/src/constants.d.ts +1 -2
- package/dist/src/core/global_modules/checks/bind.d.ts +9 -0
- package/dist/src/core/global_modules/checks/index.d.ts +2 -0
- package/dist/src/core/global_modules/checks/interpret.d.ts +10 -0
- package/dist/src/core/global_modules/diagramView/bind.d.ts +18 -0
- package/dist/src/core/global_modules/diagramView/index.d.ts +8 -0
- package/dist/src/core/global_modules/diagramView/interpret.d.ts +37 -0
- package/dist/src/core/global_modules/enum/bind.d.ts +11 -0
- package/dist/src/core/global_modules/enum/index.d.ts +8 -0
- package/dist/src/core/global_modules/enum/interpret.d.ts +15 -0
- package/dist/src/core/global_modules/index.d.ts +17 -0
- package/dist/src/core/global_modules/indexes/bind.d.ts +12 -0
- package/dist/src/core/global_modules/indexes/index.d.ts +2 -0
- package/dist/src/core/global_modules/indexes/interpret.d.ts +10 -0
- package/dist/src/core/global_modules/note/bind.d.ts +11 -0
- package/dist/src/core/global_modules/note/index.d.ts +2 -0
- package/dist/src/core/global_modules/note/interpret.d.ts +17 -0
- package/dist/src/core/global_modules/program/bind.d.ts +17 -0
- package/dist/src/core/global_modules/program/index.d.ts +2 -0
- package/dist/src/core/global_modules/program/interpret.d.ts +23 -0
- package/dist/src/core/global_modules/program/utils.d.ts +3 -0
- package/dist/src/core/global_modules/project/bind.d.ts +11 -0
- package/dist/src/core/global_modules/project/index.d.ts +2 -0
- package/dist/src/core/global_modules/project/interpret.d.ts +16 -0
- package/dist/src/core/global_modules/records/bind.d.ts +17 -0
- package/dist/src/core/global_modules/records/index.d.ts +2 -0
- package/dist/src/core/global_modules/records/interpret.d.ts +13 -0
- package/dist/src/core/global_modules/records/utils/constraints/fk.d.ts +13 -0
- package/dist/src/core/global_modules/records/utils/constraints/helper.d.ts +26 -0
- package/dist/src/core/global_modules/records/utils/constraints/pk.d.ts +6 -0
- package/dist/src/core/global_modules/records/utils/constraints/unique.d.ts +5 -0
- package/dist/src/core/{interpreter → global_modules}/records/utils/data/sqlTypes.d.ts +0 -8
- package/dist/src/core/{interpreter → global_modules}/records/utils/data/values.d.ts +1 -1
- package/dist/src/core/global_modules/ref/bind.d.ts +15 -0
- package/dist/src/core/global_modules/ref/index.d.ts +7 -0
- package/dist/src/core/global_modules/ref/interpret.d.ts +15 -0
- package/dist/src/core/global_modules/schema/index.d.ts +2 -0
- package/dist/src/core/global_modules/table/bind.d.ts +18 -0
- package/dist/src/core/global_modules/table/index.d.ts +9 -0
- package/dist/src/core/global_modules/table/interpret.d.ts +26 -0
- package/dist/src/core/global_modules/table/utils.d.ts +4 -0
- package/dist/src/core/global_modules/tableGroup/bind.d.ts +15 -0
- package/dist/src/core/global_modules/tableGroup/index.d.ts +8 -0
- package/dist/src/core/global_modules/tableGroup/interpret.d.ts +18 -0
- package/dist/src/core/global_modules/tablePartial/bind.d.ts +17 -0
- package/dist/src/core/global_modules/tablePartial/index.d.ts +7 -0
- package/dist/src/core/global_modules/tablePartial/interpret.d.ts +23 -0
- package/dist/src/core/global_modules/types.d.ts +17 -0
- package/dist/src/core/global_modules/use/index.d.ts +8 -0
- package/dist/src/core/global_modules/utils.d.ts +17 -0
- package/dist/src/core/local_modules/checks/index.d.ts +2 -0
- package/dist/src/core/local_modules/checks/validate.d.ts +17 -0
- package/dist/src/core/local_modules/custom/index.d.ts +2 -0
- package/dist/src/core/local_modules/custom/validate.d.ts +14 -0
- package/dist/src/core/local_modules/diagramView/index.d.ts +2 -0
- package/dist/src/core/local_modules/diagramView/validate.d.ts +24 -0
- package/dist/src/core/local_modules/enum/index.d.ts +2 -0
- package/dist/src/core/local_modules/enum/validate.d.ts +17 -0
- package/dist/src/core/local_modules/index.d.ts +10 -0
- package/dist/src/core/local_modules/indexes/index.d.ts +2 -0
- package/dist/src/core/local_modules/indexes/validate.d.ts +18 -0
- package/dist/src/core/local_modules/note/index.d.ts +2 -0
- package/dist/src/core/local_modules/note/validate.d.ts +16 -0
- package/dist/src/core/local_modules/program/index.d.ts +2 -0
- package/dist/src/core/local_modules/program/validate.d.ts +9 -0
- package/dist/src/core/local_modules/project/index.d.ts +2 -0
- package/dist/src/core/local_modules/project/validate.d.ts +15 -0
- package/dist/src/core/local_modules/records/index.d.ts +2 -0
- package/dist/src/core/local_modules/records/validate.d.ts +20 -0
- package/dist/src/core/local_modules/ref/index.d.ts +2 -0
- package/dist/src/core/local_modules/ref/validate.d.ts +20 -0
- package/dist/src/core/local_modules/table/index.d.ts +2 -0
- package/dist/src/core/local_modules/table/validate.d.ts +21 -0
- package/dist/src/core/local_modules/tableGroup/index.d.ts +2 -0
- package/dist/src/core/local_modules/tableGroup/validate.d.ts +19 -0
- package/dist/src/core/local_modules/tablePartial/index.d.ts +2 -0
- package/dist/src/core/local_modules/tablePartial/validate.d.ts +21 -0
- package/dist/src/core/local_modules/types.d.ts +12 -0
- package/dist/src/core/local_modules/use/index.d.ts +2 -0
- package/dist/src/core/local_modules/use/validate.d.ts +12 -0
- package/dist/src/core/parser/parser.d.ts +6 -0
- package/dist/src/core/parser/utils.d.ts +2 -49
- package/dist/src/core/types/errors.d.ts +9 -5
- package/dist/src/core/types/filepath.d.ts +8 -2
- package/dist/src/core/types/index.d.ts +2 -0
- package/dist/src/core/{analyzer/types.d.ts → types/keywords.d.ts} +6 -2
- package/dist/src/core/types/module.d.ts +1 -2
- package/dist/src/core/types/nodes.d.ts +61 -16
- package/dist/src/core/types/report.d.ts +3 -3
- package/dist/src/core/types/schemaJson.d.ts +14 -5
- package/dist/src/core/types/symbol/factory.d.ts +3 -2
- package/dist/src/core/types/symbol/index.d.ts +2 -3
- package/dist/src/core/types/symbol/metadata.d.ts +80 -0
- package/dist/src/core/types/symbol/symbols.d.ts +277 -86
- package/dist/src/core/{analyzer/utils.d.ts → utils/expression.d.ts} +10 -21
- package/dist/src/core/utils/interpret.d.ts +16 -0
- package/dist/src/core/utils/numbers.d.ts +1 -1
- package/dist/src/core/utils/span.d.ts +2 -4
- package/dist/src/core/utils/tokens.d.ts +15 -0
- package/dist/src/core/utils/validate.d.ts +103 -0
- package/dist/src/index.d.ts +13 -9
- package/dist/src/services/diagnostics/provider.d.ts +7 -6
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/services/monarch.d.ts +3 -2
- package/dist/src/services/suggestions/crossFile.d.ts +6 -0
- package/dist/src/services/suggestions/provider.d.ts +4 -1
- package/dist/src/services/suggestions/recordRowSnippet.d.ts +2 -1
- package/dist/src/services/suggestions/use.d.ts +5 -0
- package/dist/src/services/suggestions/utils/index.d.ts +10 -0
- package/dist/src/services/suggestions/utils/useMerger.d.ts +28 -0
- package/dist/src/services/types.d.ts +4 -0
- package/dist/src/services/utils.d.ts +4 -1
- package/package.json +2 -2
- package/dist/src/core/analyzer/analyzer.d.ts +0 -10
- package/dist/src/core/analyzer/binder/binder.d.ts +0 -10
- package/dist/src/core/analyzer/binder/elementBinder/checks.d.ts +0 -13
- package/dist/src/core/analyzer/binder/elementBinder/custom.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/diagramView.d.ts +0 -20
- package/dist/src/core/analyzer/binder/elementBinder/enum.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/indexes.d.ts +0 -17
- package/dist/src/core/analyzer/binder/elementBinder/note.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/project.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/records.d.ts +0 -22
- package/dist/src/core/analyzer/binder/elementBinder/ref.d.ts +0 -17
- package/dist/src/core/analyzer/binder/elementBinder/table.d.ts +0 -21
- package/dist/src/core/analyzer/binder/elementBinder/tableGroup.d.ts +0 -17
- package/dist/src/core/analyzer/binder/elementBinder/tablePartial.d.ts +0 -19
- package/dist/src/core/analyzer/binder/types.d.ts +0 -4
- package/dist/src/core/analyzer/binder/utils.d.ts +0 -33
- package/dist/src/core/analyzer/validator/elementValidators/checks.d.ts +0 -26
- package/dist/src/core/analyzer/validator/elementValidators/custom.d.ts +0 -23
- package/dist/src/core/analyzer/validator/elementValidators/diagramView.d.ts +0 -31
- package/dist/src/core/analyzer/validator/elementValidators/enum.d.ts +0 -28
- package/dist/src/core/analyzer/validator/elementValidators/indexes.d.ts +0 -27
- package/dist/src/core/analyzer/validator/elementValidators/note.d.ts +0 -25
- package/dist/src/core/analyzer/validator/elementValidators/project.d.ts +0 -24
- package/dist/src/core/analyzer/validator/elementValidators/records.d.ts +0 -29
- package/dist/src/core/analyzer/validator/elementValidators/ref.d.ts +0 -26
- package/dist/src/core/analyzer/validator/elementValidators/table.d.ts +0 -28
- package/dist/src/core/analyzer/validator/elementValidators/tableGroup.d.ts +0 -27
- package/dist/src/core/analyzer/validator/elementValidators/tablePartial.d.ts +0 -28
- package/dist/src/core/analyzer/validator/types.d.ts +0 -7
- package/dist/src/core/analyzer/validator/utils.d.ts +0 -65
- package/dist/src/core/analyzer/validator/validator.d.ts +0 -10
- package/dist/src/core/interpreter/elementInterpreter/diagramView.d.ts +0 -13
- package/dist/src/core/interpreter/elementInterpreter/enum.d.ts +0 -12
- package/dist/src/core/interpreter/elementInterpreter/project.d.ts +0 -12
- package/dist/src/core/interpreter/elementInterpreter/ref.d.ts +0 -14
- package/dist/src/core/interpreter/elementInterpreter/sticky_note.d.ts +0 -14
- package/dist/src/core/interpreter/elementInterpreter/table.d.ts +0 -22
- package/dist/src/core/interpreter/elementInterpreter/tableGroup.d.ts +0 -15
- package/dist/src/core/interpreter/elementInterpreter/tablePartial.d.ts +0 -19
- package/dist/src/core/interpreter/interpreter.d.ts +0 -10
- package/dist/src/core/interpreter/records/index.d.ts +0 -10
- package/dist/src/core/interpreter/records/utils/constraints/fk.d.ts +0 -3
- package/dist/src/core/interpreter/records/utils/constraints/helper.d.ts +0 -11
- package/dist/src/core/interpreter/records/utils/constraints/pk.d.ts +0 -3
- package/dist/src/core/interpreter/records/utils/constraints/unique.d.ts +0 -3
- package/dist/src/core/interpreter/types.d.ts +0 -47
- package/dist/src/core/interpreter/utils.d.ts +0 -37
- package/dist/src/core/types/symbol/symbolIndex.d.ts +0 -33
- package/dist/src/core/types/symbol/symbolTable.d.ts +0 -12
- package/dist/src/core/types/symbol/utils.d.ts +0 -4
- package/dist/src/core/utils/array.d.ts +0 -1
- package/dist/src/core/utils/enum.d.ts +0 -1
- package/dist/src/services/suggestions/utils.d.ts +0 -34
- /package/dist/src/core/{interpreter → global_modules}/records/utils/constraints/index.d.ts +0 -0
- /package/dist/src/core/{interpreter → global_modules}/records/utils/data/index.d.ts +0 -0
- /package/dist/src/core/{interpreter → global_modules}/records/utils/index.d.ts +0 -0
|
@@ -1,72 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { SyntaxToken } from '../core/types/tokens';
|
|
1
|
+
import { Filepath } from '../core/types/filepath';
|
|
2
|
+
import { SyntaxNode, SyntaxNodeIdGenerator } from '../core/types/nodes';
|
|
3
|
+
import { NodeSymbolIdGenerator, SymbolFactory } from '../core/types/symbol';
|
|
5
4
|
import { DBMLCompletionItemProvider, DBMLDefinitionProvider, DBMLDiagnosticsProvider, DBMLReferencesProvider } from '../services/index';
|
|
6
|
-
import {
|
|
5
|
+
import { DbmlProjectLayout } from './projectLayout';
|
|
6
|
+
import { DiagramViewBlock, findDiagramViewBlocks } from './queries/transform';
|
|
7
7
|
import { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, splitQualifiedIdentifier, unescapeString } from './queries/utils';
|
|
8
8
|
export { ScopeKind, } from './types';
|
|
9
|
-
export type {
|
|
10
|
-
export {
|
|
9
|
+
export type { DiagramViewBlock, TableNameInput, TextEdit, } from './queries/transform';
|
|
10
|
+
export { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, splitQualifiedIdentifier, unescapeString, findDiagramViewBlocks, };
|
|
11
11
|
export default class Compiler {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
setSource(source: string): void;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
readonly nodeIdGenerator: SyntaxNodeIdGenerator;
|
|
13
|
+
readonly symbolIdGenerator: NodeSymbolIdGenerator;
|
|
14
|
+
readonly symbolFactory: SymbolFactory;
|
|
15
|
+
layout: DbmlProjectLayout;
|
|
16
|
+
setSource(filepath: Filepath, source: string): void;
|
|
17
|
+
clearSource(): void;
|
|
18
|
+
deleteSource(filepath: Filepath): void;
|
|
19
|
+
private globalCache;
|
|
20
|
+
private globalQuery;
|
|
21
|
+
private localCache;
|
|
22
|
+
private localQuery;
|
|
23
|
+
parseFile: (filepath: Filepath) => import('../core/types/report').default<import('./queries/pipeline/parse').FileParseIndex>;
|
|
24
|
+
parseProject: () => Map<string, import('../core/types/report').default<import('./queries/pipeline/parse').FileParseIndex>>;
|
|
25
|
+
validateNode: (node: SyntaxNode) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<void>;
|
|
26
|
+
validateFile: (filepath: Filepath) => import('../core/types/report').default<void>;
|
|
27
|
+
nodeFullname: (node: SyntaxNode) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<string[] | undefined>;
|
|
28
|
+
nodeAlias: (node: SyntaxNode) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<string | undefined>;
|
|
29
|
+
nodeSettings: (node: SyntaxNode) => import('../core/types/report').default<import('../core/utils/validate').Settings> | import('../core/types/report').default<typeof import('..').UNHANDLED>;
|
|
30
|
+
canonicalName: (filepath: Filepath, symbol: import('../core/types/symbol').NodeSymbol) => import('../core/types/report').default<import('./queries/canonicalName').CanonicalName | undefined>;
|
|
31
|
+
bindNode: (node: SyntaxNode) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<void>;
|
|
32
|
+
bindFile: (filepath: Filepath) => import('../core/types/report').default<void>;
|
|
33
|
+
bindProject: () => Map<string, import('../core/types/report').default<void>>;
|
|
34
|
+
interpretSymbol: (symbol: import('../core/types/symbol').NodeSymbol, filepath: Filepath) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<import('..').SchemaElement | import('..').SchemaElement[] | undefined>;
|
|
35
|
+
interpretMetadata: (metadata: import('../core/types/symbol').NodeMetadata, filepath: Filepath) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<import('..').SchemaElement | import('..').SchemaElement[] | undefined>;
|
|
36
|
+
interpretFile: (filepath: Filepath) => import('../core/types/report').default<Readonly<import('..').Database> | undefined>;
|
|
37
|
+
interpretProject: () => import('../core/types/report').default<import('..').MasterDatabase>;
|
|
38
|
+
nodeSymbol: (node: SyntaxNode) => import('../core/types/report').default<import('../core/types/symbol').NodeSymbol> | import('../core/types/report').default<typeof import('..').UNHANDLED>;
|
|
39
|
+
nodeMetadata: (node: SyntaxNode) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<import('../core/types/symbol').NodeMetadata>;
|
|
40
|
+
symbolMembers: (symbol: import('../core/types/symbol').NodeSymbol) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<import('../core/types/symbol').NodeSymbol[]>;
|
|
41
|
+
lookupMembers: (symbolOrNode: SyntaxNode | import('../core/types/symbol').NodeSymbol, targetKinds: import('../core/types/symbol').SymbolKind | import('../core/types/symbol').SymbolKind[], targetName: string) => import('../core/types/symbol').NodeSymbol | undefined;
|
|
42
|
+
nodeReferee: (node: SyntaxNode) => import('../core/types/report').default<typeof import('..').UNHANDLED> | import('../core/types/report').default<import('../core/types/symbol').NodeSymbol | undefined>;
|
|
43
|
+
resolutionIndex: () => import('./queries/resolutionIndex').ResolutionIndex;
|
|
44
|
+
symbolReferences: (symbol: import('../core/types/symbol').NodeSymbol) => SyntaxNode[];
|
|
45
|
+
symbolMetadata: (symbol: import('../core/types/symbol').NodeSymbol) => import('../core/types/symbol').NodeMetadata[];
|
|
46
|
+
symbolAliases: (symbol: import('../core/types/symbol').NodeSymbol) => import('../core/types/report').default<import('../core/types/symbol').AliasSymbol[]>;
|
|
47
|
+
symbolUses: (symbol: import('../core/types/symbol').NodeSymbol) => import('../core/types/report').default<import('../core/types/symbol').UseSymbol[]>;
|
|
48
|
+
fileDependencies: (filepath: Filepath) => Filepath[];
|
|
49
|
+
reachableFiles: (entry?: Filepath | undefined) => Filepath[];
|
|
50
|
+
usableMembers: (symbolOrFilepath: Filepath | import('../core/types/symbol').ProgramSymbol | import('../core/types/symbol').SchemaSymbol) => import('../core/types/report').default<{
|
|
51
|
+
nonSchemaMembers: import('../core/types/symbol').NodeSymbol[];
|
|
52
|
+
schemaMembers: import('../core/types/symbol').SchemaSymbol[];
|
|
53
|
+
reuses: {
|
|
54
|
+
selective: import('../core/types/nodes').UseSpecifierNode[];
|
|
55
|
+
wildcard: {
|
|
56
|
+
importPath: Filepath;
|
|
57
|
+
node: import('../core/types/nodes').WildcardNode;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
uses: {
|
|
61
|
+
selective: import('../core/types/nodes').UseSpecifierNode[];
|
|
62
|
+
wildcard: {
|
|
63
|
+
importPath: Filepath;
|
|
64
|
+
node: import('../core/types/nodes').WildcardNode;
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
68
|
+
nodeAtPosition: (filepath: Filepath, offset: number) => SyntaxNode | import('..').SyntaxToken | undefined;
|
|
69
|
+
renameTable: (filepath: Filepath, oldName: import('.').TableNameInput, newName: import('.').TableNameInput) => DbmlProjectLayout;
|
|
70
|
+
syncDiagramView: (filepath: Filepath, operations: import('..').DiagramViewSyncOperation[], blocks?: DiagramViewBlock[] | undefined) => {
|
|
21
71
|
newDbml: string;
|
|
22
|
-
edits: TextEdit[];
|
|
72
|
+
edits: import('.').TextEdit[];
|
|
23
73
|
};
|
|
24
|
-
findDiagramViewBlocks(): DiagramViewBlock[];
|
|
25
|
-
applyTextEdits(edits: TextEdit[]): string;
|
|
74
|
+
findDiagramViewBlocks(filepath: Filepath): DiagramViewBlock[];
|
|
26
75
|
readonly token: {
|
|
27
|
-
invalidStream: () => readonly SyntaxToken[];
|
|
28
|
-
flatStream: () => readonly SyntaxToken[];
|
|
76
|
+
invalidStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
|
|
77
|
+
flatStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
|
|
29
78
|
};
|
|
30
79
|
readonly parse: {
|
|
31
|
-
source: () =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
errors: () => readonly Readonly<import('..').CompileError>[];
|
|
39
|
-
warnings: () => readonly Readonly<import('../core/types').CompileWarning>[];
|
|
40
|
-
tokens: () => Readonly<SyntaxToken>[];
|
|
41
|
-
rawDb: () => Readonly<Database> | undefined;
|
|
42
|
-
publicSymbolTable: () => Readonly<import('../core/types/symbol/symbolTable').default>;
|
|
80
|
+
source: (filepath: Filepath) => string;
|
|
81
|
+
ast: (filepath?: Filepath) => Readonly<import('../core/types/nodes').ProgramNode>;
|
|
82
|
+
errors: (filepath?: Filepath) => readonly Readonly<import('..').CompileError>[];
|
|
83
|
+
warnings: (filepath?: Filepath) => readonly Readonly<import('../core/types').CompileWarning>[];
|
|
84
|
+
tokens: (filepath?: Filepath) => readonly Readonly<import('..').SyntaxToken>[];
|
|
85
|
+
rawDb: (filepath?: Filepath) => Readonly<import('..').Database> | undefined;
|
|
86
|
+
publicSymbolTable: (filepath?: Filepath) => readonly Readonly<import('../core/types/symbol').NodeSymbol>[] | undefined;
|
|
43
87
|
};
|
|
44
88
|
readonly container: {
|
|
45
|
-
stack: (offset: number) => readonly Readonly<
|
|
46
|
-
token: (offset: number) => {
|
|
47
|
-
token: SyntaxToken;
|
|
89
|
+
stack: (filepath: Filepath, offset: number) => readonly Readonly<SyntaxNode>[];
|
|
90
|
+
token: (filepath: Filepath, offset: number) => {
|
|
91
|
+
token: import('..').SyntaxToken;
|
|
48
92
|
index: number;
|
|
49
93
|
} | {
|
|
50
94
|
token: undefined;
|
|
51
95
|
index: undefined;
|
|
52
96
|
};
|
|
53
|
-
element: (offset: number) => Readonly<
|
|
54
|
-
scope: (offset: number) =>
|
|
55
|
-
scopeKind: (offset: number) => import('./types').ScopeKind;
|
|
97
|
+
element: (filepath: Filepath, offset: number) => Readonly<import('../core/types/nodes').ElementDeclarationNode | import('../core/types/nodes').ProgramNode>;
|
|
98
|
+
scope: (filepath: Filepath, offset: number) => import('../core/types/symbol').NodeSymbol[] | undefined;
|
|
99
|
+
scopeKind: (filepath: Filepath, offset: number) => import('./types').ScopeKind;
|
|
56
100
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}[];
|
|
63
|
-
members: (ownerSymbol: import('../core/types/symbol/symbols').NodeSymbol) => {
|
|
64
|
-
symbol: import('../core/types/symbol/symbols').NodeSymbol;
|
|
65
|
-
name: string;
|
|
66
|
-
kind: import('../core/types').SymbolKind;
|
|
67
|
-
}[];
|
|
68
|
-
};
|
|
69
|
-
initMonacoServices(): {
|
|
101
|
+
initMonacoServices(options?: {
|
|
102
|
+
autocompletion?: {
|
|
103
|
+
triggerCharacters?: string[];
|
|
104
|
+
};
|
|
105
|
+
}): {
|
|
70
106
|
definitionProvider: DBMLDefinitionProvider;
|
|
71
107
|
referenceProvider: DBMLReferencesProvider;
|
|
72
108
|
autocompletionProvider: DBMLCompletionItemProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './layout';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Filepath } from '../../core/types/filepath';
|
|
2
|
+
export interface DbmlProjectLayout {
|
|
3
|
+
setSource(filePath: Filepath, content: string): void;
|
|
4
|
+
getSource(filePath: Filepath): string | undefined;
|
|
5
|
+
deleteSource(filePath: Filepath): void;
|
|
6
|
+
clearSource(): void;
|
|
7
|
+
exists(filePath: Filepath): boolean;
|
|
8
|
+
isFile(filePath: Filepath): boolean;
|
|
9
|
+
isDirectory(filePath: Filepath): boolean;
|
|
10
|
+
listDirectory(dirPath?: Filepath): Filepath[];
|
|
11
|
+
getEntryPoints(): Filepath[];
|
|
12
|
+
clone(): DbmlProjectLayout;
|
|
13
|
+
}
|
|
14
|
+
export declare class MemoryProjectLayout implements DbmlProjectLayout {
|
|
15
|
+
private files;
|
|
16
|
+
constructor(files?: Map<string, string> | Record<string, string>);
|
|
17
|
+
setSource(filePath: Filepath, content: string): void;
|
|
18
|
+
getSource(filePath: Filepath): string | undefined;
|
|
19
|
+
deleteSource(filePath: Filepath): void;
|
|
20
|
+
clearSource(): void;
|
|
21
|
+
exists(filePath: Filepath): boolean;
|
|
22
|
+
isFile(filePath: Filepath): boolean;
|
|
23
|
+
isDirectory(filePath: Filepath): boolean;
|
|
24
|
+
listDirectory(dirPath?: Filepath): Filepath[];
|
|
25
|
+
getEntryPoints(): Filepath[];
|
|
26
|
+
clone(): MemoryProjectLayout;
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as Report } from '../../core/types/report';
|
|
2
|
+
import { Filepath } from '../../core/types/filepath';
|
|
3
|
+
import { NodeSymbol } from '../../core/types/symbol';
|
|
4
|
+
import { default as Compiler } from '../index';
|
|
5
|
+
export interface CanonicalName {
|
|
6
|
+
schema: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function canonicalName(this: Compiler, filepath: Filepath, symbol: NodeSymbol): Report<CanonicalName | undefined>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
1
2
|
import { ElementDeclarationNode, ProgramNode } from '../../../core/types/nodes';
|
|
2
3
|
import { default as Compiler } from '../../index';
|
|
3
|
-
export declare function containerElement(this: Compiler, offset: number): Readonly<ElementDeclarationNode | ProgramNode>;
|
|
4
|
+
export declare function containerElement(this: Compiler, filepath: Filepath, offset: number): Readonly<ElementDeclarationNode | ProgramNode>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { NodeSymbol } from '../../../core/types/symbol';
|
|
2
3
|
import { default as Compiler } from '../../index';
|
|
3
|
-
export declare function containerScope(this: Compiler, offset: number):
|
|
4
|
+
export declare function containerScope(this: Compiler, filepath: Filepath, offset: number): NodeSymbol[] | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
1
2
|
import { default as Compiler } from '../../index';
|
|
2
3
|
import { ScopeKind } from '../../types';
|
|
3
|
-
export declare function containerScopeKind(this: Compiler, offset: number): ScopeKind;
|
|
4
|
+
export declare function containerScopeKind(this: Compiler, filepath: Filepath, offset: number): ScopeKind;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
1
2
|
import { SyntaxNode } from '../../../core/types/nodes';
|
|
2
3
|
import { default as Compiler } from '../../index';
|
|
3
|
-
export declare function containerStack(this: Compiler, offset: number): readonly Readonly<SyntaxNode>[];
|
|
4
|
+
export declare function containerStack(this: Compiler, filepath: Filepath, offset: number): readonly Readonly<SyntaxNode>[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types';
|
|
1
2
|
import { SyntaxToken } from '../../../core/types/tokens';
|
|
2
3
|
import { default as Compiler } from '../../index';
|
|
3
|
-
export declare function containerToken(this: Compiler, offset: number): {
|
|
4
|
+
export declare function containerToken(this: Compiler, filepath: Filepath, offset: number): {
|
|
4
5
|
token: SyntaxToken;
|
|
5
6
|
index: number;
|
|
6
7
|
} | {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as Compiler } from '../..';
|
|
2
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
3
|
+
import { ElementDeclarationNode, UseSpecifierNode, WildcardNode } from '../../../core/types/nodes';
|
|
4
|
+
import { default as Report } from '../../../core/types/report';
|
|
5
|
+
import { NodeSymbol, SchemaSymbol, ProgramSymbol } from '../../../core/types/symbol';
|
|
6
|
+
type UsableResult = {
|
|
7
|
+
nonSchemaMembers: NodeSymbol[];
|
|
8
|
+
schemaMembers: SchemaSymbol[];
|
|
9
|
+
reuses: {
|
|
10
|
+
selective: UseSpecifierNode[];
|
|
11
|
+
wildcard: {
|
|
12
|
+
importPath: Filepath;
|
|
13
|
+
node: WildcardNode;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
uses: {
|
|
17
|
+
selective: UseSpecifierNode[];
|
|
18
|
+
wildcard: {
|
|
19
|
+
importPath: Filepath;
|
|
20
|
+
node: WildcardNode;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare function usableMembers(this: Compiler, symbolOrFilepath: SchemaSymbol | ProgramSymbol | Filepath): Report<UsableResult>;
|
|
25
|
+
export type SchemaMembership = {
|
|
26
|
+
kind: 'direct';
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'child';
|
|
29
|
+
schemaName: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'none';
|
|
32
|
+
};
|
|
33
|
+
export declare function schemaMembership(compiler: Compiler, schema: SchemaSymbol, element: ElementDeclarationNode | UseSpecifierNode): SchemaMembership;
|
|
34
|
+
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { default as Compiler } from '../..';
|
|
2
|
+
import { Database } from '../../../core/types';
|
|
1
3
|
import { CompileError, CompileWarning } from '../../../core/types/errors';
|
|
4
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
5
|
import { ProgramNode } from '../../../core/types/nodes';
|
|
3
|
-
import {
|
|
4
|
-
import { default as SymbolTable } from '../../../core/types/symbol/symbolTable';
|
|
6
|
+
import { NodeSymbol } from '../../../core/types/symbol';
|
|
5
7
|
import { SyntaxToken } from '../../../core/types/tokens';
|
|
6
|
-
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function publicSymbolTable(this: Compiler): Readonly<SymbolTable>;
|
|
8
|
+
export declare function ast(this: Compiler, filepath: Filepath): Readonly<ProgramNode>;
|
|
9
|
+
export declare function errors(this: Compiler, filepath: Filepath): readonly Readonly<CompileError>[];
|
|
10
|
+
export declare function warnings(this: Compiler, filepath: Filepath): readonly Readonly<CompileWarning>[];
|
|
11
|
+
export declare function tokens(this: Compiler, filepath: Filepath): readonly Readonly<SyntaxToken>[];
|
|
12
|
+
export declare function rawDb(this: Compiler, filepath: Filepath): Readonly<Database> | undefined;
|
|
13
|
+
export declare function publicSymbolTable(this: Compiler, filepath: Filepath): readonly Readonly<NodeSymbol>[] | undefined;
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { ElementDeclarationNode, ProgramNode } from '../../../core/types/nodes';
|
|
2
|
-
import { SymbolKind } from '../../../core/types/symbol';
|
|
3
|
-
import { NodeSymbol } from '../../../core/types/symbol/symbols';
|
|
2
|
+
import { NodeSymbol, SymbolKind } from '../../../core/types/symbol';
|
|
4
3
|
import { default as Compiler } from '../../index';
|
|
5
|
-
export declare function symbolMembers(this: Compiler, ownerSymbol: NodeSymbol): {
|
|
6
|
-
symbol: NodeSymbol;
|
|
7
|
-
name: string;
|
|
8
|
-
kind: SymbolKind;
|
|
9
|
-
}[];
|
|
10
4
|
export declare function symbolOfName(this: Compiler, nameStack: string[], owner: ElementDeclarationNode | ProgramNode): {
|
|
11
5
|
symbol: NodeSymbol;
|
|
12
6
|
kind: SymbolKind;
|
|
13
7
|
name: string;
|
|
14
8
|
}[];
|
|
15
|
-
export declare function symbolOfNameToKey(nameStack: string[], owner: {
|
|
16
|
-
id: number;
|
|
17
|
-
}): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types';
|
|
1
2
|
import { SyntaxToken } from '../../../core/types/tokens';
|
|
2
3
|
import { default as Compiler } from '../../index';
|
|
3
|
-
export declare function flatStream(this: Compiler): readonly SyntaxToken[];
|
|
4
|
-
export declare function invalidStream(this: Compiler): readonly SyntaxToken[];
|
|
4
|
+
export declare function flatStream(this: Compiler, filepath: Filepath): readonly SyntaxToken[];
|
|
5
|
+
export declare function invalidStream(this: Compiler, filepath: Filepath): readonly SyntaxToken[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Filepath } from '../../core/types/filepath';
|
|
2
|
+
import { SyntaxNode } from '../../core/types/nodes';
|
|
3
|
+
import { SyntaxToken } from '../../core/types/tokens';
|
|
4
|
+
import { default as Compiler } from '../index';
|
|
5
|
+
export declare function nodeAtPosition(this: Compiler, filepath: Filepath, offset: number): SyntaxNode | SyntaxToken | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { default as Report } from '../../../core/types/report';
|
|
3
|
+
import { default as Compiler } from '../../index';
|
|
4
|
+
export declare function bindFile(this: Compiler, filepath: Filepath): Report<void>;
|
|
5
|
+
export declare function bindProject(this: Compiler): Map<string, Report<void>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as Compiler } from '../..';
|
|
2
|
+
import { Database, MasterDatabase } from '../../../core/types/schemaJson';
|
|
3
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
4
|
+
import { default as Report } from '../../../core/types/report';
|
|
5
|
+
export declare function interpretFile(this: Compiler, filepath: Filepath): Report<Readonly<Database> | undefined>;
|
|
6
|
+
export declare function interpretProject(this: Compiler): Report<MasterDatabase>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { ProgramNode } from '../../../core/types/nodes';
|
|
3
|
+
import { default as Report } from '../../../core/types/report';
|
|
4
|
+
import { SyntaxToken } from '../../../core/types/tokens';
|
|
5
|
+
import { default as Compiler } from '../../index';
|
|
6
|
+
export type FileParseIndex = {
|
|
7
|
+
readonly path: Readonly<Filepath>;
|
|
8
|
+
readonly ast: Readonly<ProgramNode>;
|
|
9
|
+
readonly tokens: readonly Readonly<SyntaxToken>[];
|
|
10
|
+
};
|
|
11
|
+
export declare function parseFile(this: Compiler, filepath: Filepath): Report<FileParseIndex>;
|
|
12
|
+
export declare function parseProject(this: Compiler): Map<string, Report<FileParseIndex>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeMetadata } from '../../core/types/symbol/metadata';
|
|
2
|
+
import { SyntaxNode } from '../../core/types/nodes';
|
|
3
|
+
import { InternedNodeSymbol, NodeSymbol } from '../../core/types/symbol';
|
|
4
|
+
import { default as Compiler } from '../index';
|
|
5
|
+
export interface ResolutionIndex {
|
|
6
|
+
references: Map<InternedNodeSymbol, SyntaxNode[]>;
|
|
7
|
+
metadata: Map<InternedNodeSymbol, NodeMetadata[]>;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolutionIndex(this: Compiler): ResolutionIndex;
|
|
10
|
+
export declare function symbolReferences(this: Compiler, symbol: NodeSymbol): SyntaxNode[];
|
|
11
|
+
export declare function symbolMetadata(this: Compiler, symbol: NodeSymbol): NodeMetadata[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SyntaxNode } from '../../../core/types/nodes';
|
|
2
|
+
import { NodeSymbol, SymbolKind } from '../../../core/types/symbol';
|
|
3
|
+
import { default as Compiler } from '../../index';
|
|
4
|
+
export declare function lookupMembers(this: Compiler, symbolOrNode: NodeSymbol | SyntaxNode, targetKinds: SymbolKind | SymbolKind[], targetName: string): NodeSymbol | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as Report } from '../../../core/types/report';
|
|
2
|
+
import { AliasSymbol, NodeSymbol } from '../../../core/types/symbol';
|
|
3
|
+
import { default as Compiler } from '../../index';
|
|
4
|
+
export declare function symbolAliases(this: Compiler, symbol: NodeSymbol): Report<AliasSymbol[]>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as Report } from '../../../core/types/report';
|
|
2
|
+
import { NodeSymbol, UseSymbol } from '../../../core/types/symbol';
|
|
3
|
+
import { default as Compiler } from '../../index';
|
|
4
|
+
export declare function symbolUses(this: Compiler, symbol: NodeSymbol): Report<UseSymbol[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { renameTable, } from './renameTable';
|
|
2
|
+
export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
|
|
2
3
|
export { applyTextEdits, type TextEdit, } from './applyTextEdits';
|
|
3
4
|
export { type TableNameInput, } from './utils';
|
|
4
|
-
export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
+
import { DbmlProjectLayout } from '../../projectLayout/layout';
|
|
2
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
1
3
|
import { default as Compiler } from '../../index';
|
|
2
4
|
import { TableNameInput } from './utils';
|
|
3
5
|
/**
|
|
4
|
-
* Renames a table in the
|
|
6
|
+
* Renames a table across every file in the project layout.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
* @param newName - The new table name as string or object (schema defaults to 'public')
|
|
8
|
-
* @returns The updated DBML source code with the table renamed
|
|
8
|
+
* Resolution starts in `filepath`'s scope. Two paths:
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* 1. **Alias rename.** `filepath` introduces a use specifier with an alias
|
|
11
|
+
* whose name matches `oldName` (e.g. `use { table users as u }` and
|
|
12
|
+
* `oldName === 'u'`). Only `filepath` is rewritten - the alias token is
|
|
13
|
+
* replaced and every reference to the alias inside `filepath` is updated.
|
|
14
|
+
* The original declaration in another file is left alone.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
16
|
+
* 2. **Real-declaration rename.** Otherwise the resolved symbol is the real
|
|
17
|
+
* table (or a `UseSymbol` that imports the source name without an alias).
|
|
18
|
+
* Both the declaring file and every file that imports the table by its
|
|
19
|
+
* direct name are rewritten - declaration name, in-scope refs, use
|
|
20
|
+
* specifier source-name tokens, and refs that flow through unaliased
|
|
21
|
+
* imports.
|
|
22
|
+
*
|
|
23
|
+
* Returns a fresh `DbmlProjectLayout` containing every file from the input
|
|
24
|
+
* layout with the rename applied where appropriate. Files the rename did not
|
|
25
|
+
* touch are returned with byte-identical source. A lookup miss or name
|
|
26
|
+
* collision still produces a fresh-copy layout (caller can always swap).
|
|
22
27
|
*/
|
|
23
|
-
export declare function renameTable(this: Compiler, oldName: TableNameInput, newName: TableNameInput):
|
|
28
|
+
export declare function renameTable(this: Compiler, filepath: Filepath, oldName: TableNameInput, newName: TableNameInput): DbmlProjectLayout;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { default as Compiler } from '../../index';
|
|
1
3
|
import { TextEdit } from './applyTextEdits';
|
|
2
4
|
export interface DiagramViewSyncOperation {
|
|
3
5
|
operation: 'create' | 'update' | 'delete';
|
|
@@ -24,16 +26,27 @@ export interface DiagramViewBlock {
|
|
|
24
26
|
startIndex: number;
|
|
25
27
|
endIndex: number;
|
|
26
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns the start/end byte positions of every DiagramView block in `source`.
|
|
31
|
+
*
|
|
32
|
+
* Returns an empty array on any lex or parse error -- callers cannot
|
|
33
|
+
* distinguish "no DiagramView blocks present" from "malformed DBML" based on
|
|
34
|
+
* the return value alone. If you need to detect malformed input, lex/parse
|
|
35
|
+
* the source separately and check for errors before calling this function.
|
|
36
|
+
*/
|
|
27
37
|
export declare function findDiagramViewBlocks(source: string): DiagramViewBlock[];
|
|
28
38
|
/**
|
|
29
|
-
* Synchronizes DiagramView blocks in DBML source
|
|
39
|
+
* Synchronizes DiagramView blocks in the DBML source at `filepath`.
|
|
30
40
|
*
|
|
31
|
-
* @param
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
41
|
+
* @param filepath The file whose source should be rewritten. Source is
|
|
42
|
+
* read from the compiler's project layout, which makes the
|
|
43
|
+
* query multifile-aware.
|
|
44
|
+
* @param operations Array of operations to apply (create, update, delete).
|
|
45
|
+
* @param blocks Optional pre-parsed blocks from findDiagramViewBlocks. If
|
|
46
|
+
* not provided, parses internally.
|
|
47
|
+
* @returns Object containing the new DBML source code and the text edits applied.
|
|
35
48
|
*/
|
|
36
|
-
export declare function syncDiagramView(
|
|
49
|
+
export declare function syncDiagramView(this: Compiler, filepath: Filepath, operations: DiagramViewSyncOperation[], blocks?: DiagramViewBlock[]): {
|
|
37
50
|
newDbml: string;
|
|
38
51
|
edits: TextEdit[];
|
|
39
52
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { NodeSymbol } from '../../../core/types/symbol';
|
|
3
|
+
import { default as Compiler } from '../../index';
|
|
3
4
|
export type TableNameInput = string | {
|
|
4
5
|
schema?: string;
|
|
5
6
|
table: string;
|
|
@@ -13,9 +14,9 @@ export declare function normalizeTableName(input: TableNameInput): {
|
|
|
13
14
|
table: string;
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
|
-
* Looks up a table symbol
|
|
17
|
+
* Looks up a table symbol by matching its full qualified name.
|
|
17
18
|
*/
|
|
18
|
-
export declare function lookupTableSymbol(
|
|
19
|
+
export declare function lookupTableSymbol(compiler: Compiler, filepath: Filepath, schema: string, table: string): NodeSymbol | null;
|
|
19
20
|
/**
|
|
20
21
|
* Removes surrounding double quotes from a string if present.
|
|
21
22
|
*/
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { Filepath } from '../../core/types/filepath';
|
|
2
|
+
import { default as Report } from '../../core/types/report';
|
|
3
|
+
import { NodeSymbol } from '../../core/types/symbol';
|
|
4
|
+
import { default as Compiler } from '..';
|
|
1
5
|
/**
|
|
2
6
|
* Checks if an identifier is valid (can be used without quotes in DBML).
|
|
3
7
|
* Valid identifiers must:
|
|
@@ -93,3 +97,5 @@ export declare function formatRecordValue(recordValue: {
|
|
|
93
97
|
* @returns Array of unquoted identifier components
|
|
94
98
|
*/
|
|
95
99
|
export declare function splitQualifiedIdentifier(identifier: string): string[];
|
|
100
|
+
export declare function collectTransitiveDependencies(compiler: Compiler, entrypoints: Filepath[]): Filepath[];
|
|
101
|
+
export declare function allVisibleMembers(compiler: Compiler): Report<NodeSymbol[]>;
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -2,6 +2,5 @@ import { Filepath } from './core/types/filepath';
|
|
|
2
2
|
export declare const KEYWORDS_OF_DEFAULT_SETTING: readonly string[];
|
|
3
3
|
export declare const DBML_EXT = ".dbml";
|
|
4
4
|
export declare const NUMERIC_LITERAL_PREFIX: readonly string[];
|
|
5
|
-
export declare const DEFAULT_SCHEMA_NAME
|
|
5
|
+
export declare const DEFAULT_SCHEMA_NAME: "public";
|
|
6
6
|
export declare const DEFAULT_ENTRY: Filepath;
|
|
7
|
-
export declare const ROOT: Filepath;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as Compiler } from '../../../compiler';
|
|
2
|
+
import { CompileError } from '../../types/errors';
|
|
3
|
+
import { ElementDeclarationNode } from '../../types/nodes';
|
|
4
|
+
export default class ChecksBinder {
|
|
5
|
+
private compiler;
|
|
6
|
+
private declarationNode;
|
|
7
|
+
constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
|
|
8
|
+
bind(): CompileError[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as Compiler } from '../../../compiler/index';
|
|
2
|
+
import { ElementDeclarationNode } from '../../types/nodes';
|
|
3
|
+
import { default as Report } from '../../types/report';
|
|
4
|
+
import { SchemaElement } from '../../types/schemaJson';
|
|
5
|
+
export default class ChecksInterpreter {
|
|
6
|
+
private compiler;
|
|
7
|
+
private declarationNode;
|
|
8
|
+
constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
|
|
9
|
+
interpret(): Report<SchemaElement | SchemaElement[] | undefined>;
|
|
10
|
+
}
|