@dbml/parse 9.1.1 → 9.1.2-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 +0 -0
- package/dist/__benchmarks__/compiler.profile.d.ts +0 -0
- package/dist/dbml-parse.js +29 -19
- package/dist/dbml-parse.mjs +4828 -3792
- package/dist/index.d.ts +0 -0
- package/dist/src/compiler/index.d.ts +11 -7
- 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 +0 -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 +3 -1
- package/dist/src/compiler/queries/transform/renameTable.d.ts +2 -2
- package/dist/src/compiler/queries/transform/syncDep.d.ts +54 -0
- package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +0 -0
- package/dist/src/compiler/queries/transform/types.d.ts +48 -0
- package/dist/src/compiler/queries/transform/updateElementSetting.d.ts +6 -0
- package/dist/src/compiler/queries/transform/utils/index.d.ts +26 -0
- package/dist/src/compiler/queries/transform/utils/ref.d.ts +15 -0
- package/dist/src/compiler/queries/utils.d.ts +6 -0
- package/dist/src/compiler/types.d.ts +9 -8
- 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 +18 -0
- package/dist/src/core/global_modules/dep/index.d.ts +2 -0
- package/dist/src/core/global_modules/dep/interpret.d.ts +18 -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/metadata/bind.d.ts +0 -0
- package/dist/src/core/global_modules/metadata/index.d.ts +0 -0
- package/dist/src/core/global_modules/metadata/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/metadata/utils.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/dep.d.ts +4 -0
- package/dist/src/core/global_modules/program/utils/external.d.ts +3 -0
- package/dist/src/core/global_modules/program/utils/index.d.ts +3 -0
- package/dist/src/core/global_modules/program/utils/records.d.ts +6 -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/constraint_fixes.d.ts +0 -0
- package/dist/src/core/global_modules/ref/index.d.ts +0 -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 +2 -1
- 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 +19 -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/metadata/index.d.ts +0 -0
- package/dist/src/core/local_modules/metadata/utils.d.ts +0 -0
- package/dist/src/core/local_modules/metadata/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 +62 -56
- 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/relation.d.ts +0 -0
- package/dist/src/core/types/report.d.ts +0 -0
- package/dist/src/core/types/schemaJson/index.d.ts +0 -0
- package/dist/src/core/types/schemaJson/types.d.ts +36 -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 +2 -1
- package/dist/src/core/utils/interpret.d.ts +0 -0
- package/dist/src/core/utils/note.d.ts +18 -0
- package/dist/src/core/utils/numbers.d.ts +0 -0
- package/dist/src/core/utils/setting.d.ts +13 -14
- 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 +2 -0
- package/dist/src/index.d.ts +5 -1
- package/dist/src/services/code_actions/provider.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 +3 -3
- 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 +2 -2
- package/dist/src/compiler/queries/transform/utils.d.ts +0 -23
- package/dist/src/core/global_modules/program/utils.d.ts +0 -3
package/dist/index.d.ts
CHANGED
|
File without changes
|
|
@@ -3,11 +3,10 @@ import { SyntaxNode, SyntaxNodeIdGenerator } from '../core/types/nodes';
|
|
|
3
3
|
import { NodeSymbolIdGenerator, SymbolFactory } from '../core/types/symbol';
|
|
4
4
|
import { DBMLCodeActionProvider, DBMLCompletionItemProvider, DBMLDefinitionProvider, DBMLDiagnosticsProvider, DBMLReferencesProvider } from '../services/index';
|
|
5
5
|
import { DbmlProjectLayout } from './projectLayout';
|
|
6
|
-
import {
|
|
7
|
-
import { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, splitQualifiedIdentifier, unescapeString } from './queries/utils';
|
|
6
|
+
import { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, normalizeQualifiedName, splitQualifiedIdentifier, unescapeString } from './queries/utils';
|
|
8
7
|
export { ScopeKind } from './types';
|
|
9
|
-
export type {
|
|
10
|
-
export { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, splitQualifiedIdentifier, unescapeString,
|
|
8
|
+
export type { TextEdit } from './queries/transform';
|
|
9
|
+
export { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, normalizeQualifiedName, splitQualifiedIdentifier, unescapeString, };
|
|
11
10
|
export default class Compiler {
|
|
12
11
|
layout: DbmlProjectLayout;
|
|
13
12
|
readonly nodeIdGenerator: SyntaxNodeIdGenerator;
|
|
@@ -72,12 +71,17 @@ export default class Compiler {
|
|
|
72
71
|
};
|
|
73
72
|
}>;
|
|
74
73
|
nodeAtPosition: (filepath: Filepath, offset: number) => SyntaxNode | import('..').SyntaxToken | undefined;
|
|
75
|
-
renameTable: (filepath: Filepath, oldName: import('
|
|
76
|
-
|
|
74
|
+
renameTable: (filepath: Filepath, oldName: string | import('..').TableIdentifier, newName: string | import('..').TableIdentifier) => Map<string, string>;
|
|
75
|
+
updateElementSetting: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => string;
|
|
76
|
+
updateElementSettingEdit: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => import('.').TextEdit[];
|
|
77
|
+
syncDiagramView: (filepath: Filepath, operations: import('..').DiagramViewSyncOperation[], blocks?: import('..').DiagramViewBlock[] | undefined) => {
|
|
78
|
+
newDbml: string;
|
|
79
|
+
edits: import('.').TextEdit[];
|
|
80
|
+
};
|
|
81
|
+
syncDep: (filepath: Filepath, operations: import('..').DepSyncOperation[], blocks?: import('..').DepBlock[] | undefined) => {
|
|
77
82
|
newDbml: string;
|
|
78
83
|
edits: import('.').TextEdit[];
|
|
79
84
|
};
|
|
80
|
-
findDiagramViewBlocks(filepath: Filepath): DiagramViewBlock[];
|
|
81
85
|
readonly token: {
|
|
82
86
|
invalidStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
|
|
83
87
|
flatStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
|
|
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
|
|
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
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { renameTable } from './renameTable';
|
|
2
|
+
export { updateElementSetting, updateElementSettingEdit } from './updateElementSetting';
|
|
2
3
|
export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
|
|
4
|
+
export { syncDep, findDepBlocks, generateDepBlock, type DepSyncOperation, type DepSyncEdge, type DepEndpointRef, type DepBlock, } from './syncDep';
|
|
3
5
|
export { applyTextEdits, type TextEdit } from './applyTextEdits';
|
|
4
|
-
export {
|
|
6
|
+
export type { ElementIdentifier, SchemaIdentifier, TableIdentifier, ColumnIdentifier, EnumIdentifier, EndpointRef, RefIdentifier, DepIdentifier, NoteIdentifier, TableGroupIdentifier, } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Filepath } from '../../../core/types/filepath';
|
|
2
2
|
import { default as Compiler } from '../../index';
|
|
3
|
-
import {
|
|
3
|
+
import { TableIdentifier } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Renames a table across every file in the project layout.
|
|
6
6
|
*
|
|
@@ -23,4 +23,4 @@ import { TableNameInput } from './utils';
|
|
|
23
23
|
* only the files that were actually changed by the rename. An empty map
|
|
24
24
|
* indicates a no-op (lookup miss, name collision, or alias rename attempt).
|
|
25
25
|
*/
|
|
26
|
-
export declare function renameTable(this: Compiler, filepath: Filepath, oldName:
|
|
26
|
+
export declare function renameTable(this: Compiler, filepath: Filepath, oldName: string | TableIdentifier, newName: string | TableIdentifier): Map<string, string>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { ElementDeclarationNode, ProgramNode } from '../../../core/types/nodes';
|
|
3
|
+
import { default as Compiler } from '../../index';
|
|
4
|
+
import { TextEdit } from './applyTextEdits';
|
|
5
|
+
export interface DepEndpointRef {
|
|
6
|
+
schemaName?: string | null;
|
|
7
|
+
tableName: string;
|
|
8
|
+
fieldNames?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface DepSyncEdge {
|
|
11
|
+
upstream: DepEndpointRef;
|
|
12
|
+
downstream: DepEndpointRef;
|
|
13
|
+
}
|
|
14
|
+
export interface DepSyncOperation {
|
|
15
|
+
operation: 'create' | 'update' | 'remove';
|
|
16
|
+
/** The edge that identifies the target block (table-level: empty fields). */
|
|
17
|
+
edge: DepSyncEdge;
|
|
18
|
+
/** Set to a value to create/update, null to remove, undefined to leave unchanged. */
|
|
19
|
+
color?: string | null;
|
|
20
|
+
/** Set to a value to create/update, null to remove, undefined to leave unchanged. */
|
|
21
|
+
note?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface DepBlock {
|
|
24
|
+
startIndex: number;
|
|
25
|
+
endIndex: number;
|
|
26
|
+
declaration: ElementDeclarationNode;
|
|
27
|
+
edges: DepSyncEdge[];
|
|
28
|
+
}
|
|
29
|
+
export interface InlineDep {
|
|
30
|
+
edge: DepSyncEdge;
|
|
31
|
+
fullStart: number;
|
|
32
|
+
fullEnd: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Synchronizes `Dep` blocks in the DBML source at `filepath`.
|
|
36
|
+
* Applies create/update/remove operations and returns the rewritten source.
|
|
37
|
+
*/
|
|
38
|
+
export declare function syncDep(this: Compiler, filepath: Filepath, operations: DepSyncOperation[], blocks?: DepBlock[]): {
|
|
39
|
+
newDbml: string;
|
|
40
|
+
edits: TextEdit[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Returns every standalone `Dep` block in `source`.
|
|
44
|
+
* On lex/parse error returns [] (mirrors findDiagramViewBlocks).
|
|
45
|
+
*/
|
|
46
|
+
export declare function findDepBlocks(source: string): DepBlock[];
|
|
47
|
+
/** Returns every inline `[dep: -> target]` setting on columns in `source`. */
|
|
48
|
+
export declare function findInlineDeps(source: string): InlineDep[];
|
|
49
|
+
/** Emit a `Dep` block string for one edge with a `[color]` setting. */
|
|
50
|
+
export declare function generateDepBlock(edge: DepSyncEdge, color: string): string;
|
|
51
|
+
/** Extract `DepBlock[]` from an already-parsed program AST. */
|
|
52
|
+
export declare function depBlocksFromProgram(program: ProgramNode): DepBlock[];
|
|
53
|
+
/** Extract `InlineDep[]` from an already-parsed program AST. */
|
|
54
|
+
export declare function inlineDepsFromProgram(source: string, program: ProgramNode): InlineDep[];
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SymbolKind } from '../../../core/types/symbol';
|
|
2
|
+
import { MetadataKind } from '../../../core/types/symbol/metadata';
|
|
3
|
+
export type ElementIdentifier = (SchemaIdentifier | TableIdentifier | ColumnIdentifier | EnumIdentifier | RefIdentifier | DepIdentifier | NoteIdentifier | TableGroupIdentifier) & {
|
|
4
|
+
kind: string;
|
|
5
|
+
};
|
|
6
|
+
export interface SchemaIdentifier {
|
|
7
|
+
kind?: typeof SymbolKind.Schema;
|
|
8
|
+
schema: string;
|
|
9
|
+
}
|
|
10
|
+
export interface TableIdentifier {
|
|
11
|
+
kind?: typeof SymbolKind.Table;
|
|
12
|
+
schema?: string;
|
|
13
|
+
table: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ColumnIdentifier {
|
|
16
|
+
kind?: typeof SymbolKind.Column;
|
|
17
|
+
schema?: string;
|
|
18
|
+
table: string;
|
|
19
|
+
column: string;
|
|
20
|
+
}
|
|
21
|
+
export interface EnumIdentifier {
|
|
22
|
+
kind?: typeof SymbolKind.Enum;
|
|
23
|
+
schema?: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
export interface EndpointRef {
|
|
27
|
+
schemaName?: string | null;
|
|
28
|
+
tableName: string;
|
|
29
|
+
fieldNames?: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface RefIdentifier {
|
|
32
|
+
kind?: typeof MetadataKind.Ref;
|
|
33
|
+
endpoints: [EndpointRef, EndpointRef];
|
|
34
|
+
}
|
|
35
|
+
export interface DepIdentifier {
|
|
36
|
+
kind?: typeof MetadataKind.Dep;
|
|
37
|
+
upstream: EndpointRef;
|
|
38
|
+
downstream: EndpointRef;
|
|
39
|
+
}
|
|
40
|
+
export interface NoteIdentifier {
|
|
41
|
+
kind?: typeof SymbolKind.StickyNote;
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
export interface TableGroupIdentifier {
|
|
45
|
+
kind?: typeof SymbolKind.TableGroup;
|
|
46
|
+
schema?: string;
|
|
47
|
+
name: string;
|
|
48
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { default as Compiler } from '../../index';
|
|
3
|
+
import { TextEdit } from './applyTextEdits';
|
|
4
|
+
import { ElementIdentifier } from './types';
|
|
5
|
+
export declare function updateElementSettingEdit(this: Compiler, filepath: Filepath, target: ElementIdentifier, settingName: string, value: string | null | undefined): TextEdit[];
|
|
6
|
+
export declare function updateElementSetting(this: Compiler, filepath: Filepath, target: ElementIdentifier, settingName: string, value: string | null | undefined): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Filepath } from '../../../../core/types/filepath';
|
|
2
|
+
import { NodeSymbol, SymbolKind } from '../../../../core/types/symbol';
|
|
3
|
+
import { default as Compiler } from '../../../index';
|
|
4
|
+
import { EndpointRef } from '../types';
|
|
5
|
+
export type { ElementIdentifier } from '../types';
|
|
6
|
+
export { findRefDefinition, type InlineRef, type StandaloneRef } from './ref';
|
|
7
|
+
export declare function normalizeSchema(schema?: string | null): string;
|
|
8
|
+
export declare function endpointsEqual(left: EndpointRef, right: EndpointRef): boolean;
|
|
9
|
+
export declare function endpointMatches(candidate: EndpointRef, target: EndpointRef): boolean;
|
|
10
|
+
export declare function normalizeTableName(input: string | {
|
|
11
|
+
schema?: string;
|
|
12
|
+
table: string;
|
|
13
|
+
}): {
|
|
14
|
+
schema: string;
|
|
15
|
+
table: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Looks up an element symbol by its qualified name and kind.
|
|
19
|
+
*/
|
|
20
|
+
export declare function lookupElementSymbol(compiler: Compiler, filepath: Filepath, schema: string, name: string, kind?: SymbolKind): NodeSymbol | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Removes surrounding double quotes from a string if present.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stripQuotes(str: string): string;
|
|
25
|
+
export declare function formatEndpoint(ep: EndpointRef): string;
|
|
26
|
+
export declare function formatSetting(name: string, value: string | null | undefined): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionApplicationNode } from '../../../../core/types/nodes';
|
|
2
|
+
import { Filepath } from '../../../../core/types/filepath';
|
|
3
|
+
import { default as Compiler } from '../../../index';
|
|
4
|
+
import { RefIdentifier } from '../types';
|
|
5
|
+
export interface InlineRef {
|
|
6
|
+
kind: 'inline';
|
|
7
|
+
op: string;
|
|
8
|
+
fullStart: number;
|
|
9
|
+
fullEnd: number;
|
|
10
|
+
}
|
|
11
|
+
export interface StandaloneRef {
|
|
12
|
+
kind: 'standalone';
|
|
13
|
+
node: FunctionApplicationNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function findRefDefinition(compiler: Compiler, filepath: Filepath, target: RefIdentifier): InlineRef | StandaloneRef | undefined;
|
|
@@ -35,6 +35,7 @@ export declare function isValidIdentifier(name: string): boolean;
|
|
|
35
35
|
* addDoubleQuoteIfNeeded('user-name') => '"user-name"'
|
|
36
36
|
*/
|
|
37
37
|
export declare function addDoubleQuoteIfNeeded(identifier: string): string;
|
|
38
|
+
export declare function normalizeQualifiedName(...parts: string[]): string;
|
|
38
39
|
/**
|
|
39
40
|
* Unescapes a string by processing escape sequences.
|
|
40
41
|
* Handles escaped quotes (\"), common escape sequences, unicode (\uHHHH), and arbitrary escapes.
|
|
@@ -99,3 +100,8 @@ export declare function formatRecordValue(recordValue: {
|
|
|
99
100
|
export declare function splitQualifiedIdentifier(identifier: string): string[];
|
|
100
101
|
export declare function collectTransitiveDependencies(compiler: Compiler, entrypoints: Filepath[]): Filepath[];
|
|
101
102
|
export declare function allVisibleMembers(compiler: Compiler): Report<NodeSymbol[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Wraps a note value in the appropriate DBML quote style.
|
|
105
|
+
* Uses triple quotes for multiline content, single quotes otherwise.
|
|
106
|
+
*/
|
|
107
|
+
export declare function quoteNoteValue(value: string): string;
|
|
@@ -5,12 +5,13 @@ export declare const enum ScopeKind {
|
|
|
5
5
|
INDEXES = 3,
|
|
6
6
|
NOTE = 4,
|
|
7
7
|
REF = 5,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
DEP = 6,
|
|
9
|
+
PROJECT = 7,
|
|
10
|
+
CUSTOM = 8,
|
|
11
|
+
TOPLEVEL = 9,
|
|
12
|
+
TABLEPARTIAL = 10,
|
|
13
|
+
CHECKS = 11,
|
|
14
|
+
RECORDS = 12,
|
|
15
|
+
DIAGRAMVIEW = 13,
|
|
16
|
+
METADATA = 14
|
|
16
17
|
}
|
package/dist/src/constants.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as Compiler } from '../../../compiler';
|
|
2
|
+
import { CompileError } from '../../types/errors';
|
|
3
|
+
import { ElementDeclarationNode } from '../../types/nodes';
|
|
4
|
+
import { SyntaxToken } from '../../types/tokens';
|
|
5
|
+
export default class DepBinder {
|
|
6
|
+
private compiler;
|
|
7
|
+
private declarationNode;
|
|
8
|
+
constructor(compiler: Compiler, declarationNode: ElementDeclarationNode & {
|
|
9
|
+
type: SyntaxToken;
|
|
10
|
+
});
|
|
11
|
+
bind(): CompileError[];
|
|
12
|
+
private bindBody;
|
|
13
|
+
private bindFields;
|
|
14
|
+
private checkColumnSelfLoop;
|
|
15
|
+
private endpointSymbol;
|
|
16
|
+
private endpointLevel;
|
|
17
|
+
private bindSubElements;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dep } from '../../types/schemaJson';
|
|
2
|
+
import { DepMetadata, Filepath } from '../../types';
|
|
3
|
+
import { default as Compiler } from '../../../compiler';
|
|
4
|
+
import { default as Report } from '../../types/report';
|
|
5
|
+
export declare class DepInterpreter {
|
|
6
|
+
private compiler;
|
|
7
|
+
private metadata;
|
|
8
|
+
private declarationNode;
|
|
9
|
+
private filepath;
|
|
10
|
+
private dep;
|
|
11
|
+
constructor(compiler: Compiler, metadata: DepMetadata, filepath: Filepath);
|
|
12
|
+
interpret(): Report<Dep>;
|
|
13
|
+
private interpretName;
|
|
14
|
+
private interpretEdges;
|
|
15
|
+
private interpretSettings;
|
|
16
|
+
private consumeSettings;
|
|
17
|
+
private extractAttrValue;
|
|
18
|
+
}
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as Compiler } from '../../../../compiler/index';
|
|
2
|
+
import { CompileWarning } from '../../../types/errors';
|
|
3
|
+
import { Filepath } from '../../../types/filepath';
|
|
4
|
+
import { Ref } from '../../../types/schemaJson';
|
|
5
|
+
import { ProgramSymbol } from '../../../types/symbol';
|
|
6
|
+
export declare function validateRecords(compiler: Compiler, programSymbol: ProgramSymbol, refs: Ref[], filepath: Filepath): CompileWarning[];
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ import { default as Compiler } from '../../compiler';
|
|
|
2
2
|
import { Filepath, ProgramSymbol } from '../types';
|
|
3
3
|
import { PrimaryExpressionNode, SyntaxNode, VariableNode } from '../types/nodes';
|
|
4
4
|
import { default as Report } from '../types/report';
|
|
5
|
-
import { NodeSymbol } from '../types/symbol';
|
|
5
|
+
import { SymbolKind, NodeSymbol } from '../types/symbol';
|
|
6
6
|
export declare function shouldInterpretNode(compiler: Compiler, node: SyntaxNode): boolean;
|
|
7
7
|
export declare function getNodeMemberSymbols(compiler: Compiler, node: SyntaxNode): Report<NodeSymbol[]>;
|
|
8
8
|
export declare function scanNonListNodeForBinding(node?: SyntaxNode): {
|
|
@@ -14,5 +14,6 @@ export declare function scanNonListNodeForBinding(node?: SyntaxNode): {
|
|
|
14
14
|
})[];
|
|
15
15
|
}[];
|
|
16
16
|
export declare function nodeRefereeOfLeftExpression(compiler: Compiler, node: SyntaxNode): NodeSymbol | undefined;
|
|
17
|
+
export declare function nodeRefereeOfEndpoint(compiler: Compiler, globalSymbol: NodeSymbol, node: SyntaxNode, terminalKind: SymbolKind.Column | SymbolKind.Table): Report<NodeSymbol | undefined>;
|
|
17
18
|
export declare function getDefaultSchemaSymbol(compiler: Compiler, globalSymbol: NodeSymbol): NodeSymbol | undefined;
|
|
18
19
|
export declare function getProgramSymbol(compiler: Compiler, filepath: Filepath): ProgramSymbol | undefined;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as Compiler } from '../../../compiler';
|
|
2
|
+
import { CompileError } from '../../types/errors';
|
|
3
|
+
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../types/nodes';
|
|
4
|
+
import { default as Report } from '../../types/report';
|
|
5
|
+
import { Settings } from '../../utils/validate';
|
|
6
|
+
export default class DepValidator {
|
|
7
|
+
private declarationNode;
|
|
8
|
+
private compiler;
|
|
9
|
+
constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
|
|
10
|
+
validate(): CompileError[];
|
|
11
|
+
private validateSettings;
|
|
12
|
+
private validateContext;
|
|
13
|
+
private validateName;
|
|
14
|
+
private validateAlias;
|
|
15
|
+
validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
|
|
16
|
+
validateFields(fields: FunctionApplicationNode[]): CompileError[];
|
|
17
|
+
private validateSubElements;
|
|
18
|
+
}
|
|
19
|
+
export declare function validateDepSettings(settings: ListExpressionNode): Report<Settings>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|