@dbml/parse 9.0.0-alpha.1 → 9.0.0-alpha.11
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 +18 -14
- package/dist/dbml-parse.mjs +2568 -2021
- package/dist/index.d.ts +0 -0
- package/dist/src/compiler/index.d.ts +9 -6
- 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 +60 -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 +4 -0
- package/dist/src/compiler/queries/transform/utils.d.ts +8 -10
- package/dist/src/compiler/queries/utils.d.ts +5 -0
- package/dist/src/compiler/types.d.ts +8 -7
- 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 +0 -0
- package/dist/src/core/global_modules/dep/index.d.ts +0 -0
- package/dist/src/core/global_modules/dep/interpret.d.ts +2 -2
- 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 +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 +0 -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 +0 -0
- package/dist/src/core/local_modules/dep/validate.d.ts +1 -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 +4 -3
- 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 +0 -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 +0 -0
- package/dist/src/core/types/schemaJson.d.ts +6 -2
- 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 +0 -0
- 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 +16 -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 +4 -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 +2 -2
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 { DBMLCompletionItemProvider, DBMLDefinitionProvider, DBMLDiagnosticsProvider, DBMLReferencesProvider } from '../services/index';
|
|
5
5
|
import { DbmlProjectLayout } from './projectLayout';
|
|
6
|
-
import { DiagramViewBlock, findDiagramViewBlocks } from './queries/transform';
|
|
7
6
|
import { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, 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, splitQualifiedIdentifier, unescapeString, };
|
|
11
10
|
export default class Compiler {
|
|
12
11
|
layout: DbmlProjectLayout;
|
|
13
12
|
readonly nodeIdGenerator: SyntaxNodeIdGenerator;
|
|
@@ -72,12 +71,16 @@ 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
|
+
syncDiagramView: (filepath: Filepath, operations: import('..').DiagramViewSyncOperation[], blocks?: import('..').DiagramViewBlock[] | undefined) => {
|
|
77
|
+
newDbml: string;
|
|
78
|
+
edits: import('.').TextEdit[];
|
|
79
|
+
};
|
|
80
|
+
syncDep: (filepath: Filepath, operations: import('..').DepSyncOperation[], blocks?: import('..').DepBlock[] | undefined) => {
|
|
77
81
|
newDbml: string;
|
|
78
82
|
edits: import('.').TextEdit[];
|
|
79
83
|
};
|
|
80
|
-
findDiagramViewBlocks(filepath: Filepath): DiagramViewBlock[];
|
|
81
84
|
readonly token: {
|
|
82
85
|
invalidStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
|
|
83
86
|
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 } 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,60 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { ElementDeclarationNode } 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
|
+
stripStart: number;
|
|
32
|
+
stripEnd: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns every `Dep` block in `source`.
|
|
36
|
+
* On any lex or parse error, returns [] - there is no reliable way to read
|
|
37
|
+
* dep blocks from malformed DBML (mirrors findDiagramViewBlocks).
|
|
38
|
+
*/
|
|
39
|
+
export declare function findDepBlocks(source: string): DepBlock[];
|
|
40
|
+
export declare function findInlineDeps(source: string): InlineDep[];
|
|
41
|
+
/**
|
|
42
|
+
* Emit a `Dep` block for one edge with a `[color]` setting:
|
|
43
|
+
*
|
|
44
|
+
* Dep [color: <hex>] {
|
|
45
|
+
* <upstream> -> <downstream>
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateDepBlock(edge: DepSyncEdge, color: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Synchronizes `Dep` blocks in the DBML source at `filepath`.
|
|
51
|
+
*
|
|
52
|
+
* @param filepath The file whose source should be rewritten.
|
|
53
|
+
* @param operations Array of create/update operations to apply.
|
|
54
|
+
* @param blocks Optional pre-parsed blocks from findDepBlocks.
|
|
55
|
+
* @returns The new DBML source and the text edits applied.
|
|
56
|
+
*/
|
|
57
|
+
export declare function syncDep(this: Compiler, filepath: Filepath, operations: DepSyncOperation[], blocks?: DepBlock[]): {
|
|
58
|
+
newDbml: string;
|
|
59
|
+
edits: TextEdit[];
|
|
60
|
+
};
|
|
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,4 @@
|
|
|
1
|
+
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
+
import { default as Compiler } from '../../index';
|
|
3
|
+
import { ElementIdentifier } from './types';
|
|
4
|
+
export declare function updateElementSetting(this: Compiler, filepath: Filepath, target: ElementIdentifier, settingName: string, value: string | null | undefined): string;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
-
import { NodeSymbol } from '../../../core/types/symbol';
|
|
2
|
+
import { NodeSymbol, SymbolKind } from '../../../core/types/symbol';
|
|
3
3
|
import { default as Compiler } from '../../index';
|
|
4
|
-
|
|
4
|
+
import { EndpointRef } from './types';
|
|
5
|
+
export type { ElementIdentifier } from './types';
|
|
6
|
+
export declare function endpointsEqual(a: EndpointRef, b: EndpointRef): boolean;
|
|
7
|
+
export declare function normalizeTableName(input: string | {
|
|
5
8
|
schema?: string;
|
|
6
9
|
table: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Normalizes a table name input to { schema, table } format.
|
|
10
|
-
* Properly handles quoted identifiers with dots inside.
|
|
11
|
-
*/
|
|
12
|
-
export declare function normalizeTableName(input: TableNameInput): {
|
|
10
|
+
}): {
|
|
13
11
|
schema: string;
|
|
14
12
|
table: string;
|
|
15
13
|
};
|
|
16
14
|
/**
|
|
17
|
-
* Looks up
|
|
15
|
+
* Looks up an element symbol by its qualified name and kind.
|
|
18
16
|
*/
|
|
19
|
-
export declare function
|
|
17
|
+
export declare function lookupElementSymbol(compiler: Compiler, filepath: Filepath, schema: string, name: string, kind?: SymbolKind): NodeSymbol | undefined;
|
|
20
18
|
/**
|
|
21
19
|
* Removes surrounding double quotes from a string if present.
|
|
22
20
|
*/
|
|
@@ -99,3 +99,8 @@ export declare function formatRecordValue(recordValue: {
|
|
|
99
99
|
export declare function splitQualifiedIdentifier(identifier: string): string[];
|
|
100
100
|
export declare function collectTransitiveDependencies(compiler: Compiler, entrypoints: Filepath[]): Filepath[];
|
|
101
101
|
export declare function allVisibleMembers(compiler: Compiler): Report<NodeSymbol[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Wraps a note value in the appropriate DBML quote style.
|
|
104
|
+
* Uses triple quotes for multiline content, single quotes otherwise.
|
|
105
|
+
*/
|
|
106
|
+
export declare function quoteNoteValue(value: string): string;
|
|
@@ -5,11 +5,12 @@ export declare const enum ScopeKind {
|
|
|
5
5
|
INDEXES = 3,
|
|
6
6
|
NOTE = 4,
|
|
7
7
|
REF = 5,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
DEP = 6,
|
|
9
|
+
PROJECT = 7,
|
|
10
|
+
CUSTOM = 8,
|
|
11
|
+
TOPLEVEL = 9,
|
|
12
|
+
TABLEPARTIAL = 10,
|
|
13
|
+
CHECKS = 11,
|
|
14
|
+
RECORDS = 12,
|
|
15
|
+
DIAGRAMVIEW = 13
|
|
15
16
|
}
|
package/dist/src/constants.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -13,7 +13,7 @@ export declare class DepInterpreter {
|
|
|
13
13
|
private interpretName;
|
|
14
14
|
private interpretEdges;
|
|
15
15
|
/**
|
|
16
|
-
* Read settings into `dep.note` and `dep.
|
|
16
|
+
* Read settings into `dep.note` and `dep.metadata`.
|
|
17
17
|
*
|
|
18
18
|
* Settings come from THREE sources, in this order:
|
|
19
19
|
* 1. The top-level attribute list on the Dep header
|
|
@@ -23,7 +23,7 @@ export declare class DepInterpreter {
|
|
|
23
23
|
* 3. Sub-element declarations inside the body
|
|
24
24
|
* (e.g. `Dep { a -> b; note: 'x'; materialized: 'view' }`).
|
|
25
25
|
*
|
|
26
|
-
* All three sources write into the same `
|
|
26
|
+
* All three sources write into the same `metadata` object (with `note`
|
|
27
27
|
* routed to the typed slot instead). Precedence is last-write-wins by
|
|
28
28
|
* virtue of plain object assignment — settings later in the source
|
|
29
29
|
* file overwrite earlier ones with the same key.
|
|
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
|
|
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
|
|
@@ -8,6 +8,7 @@ export default class DepValidator {
|
|
|
8
8
|
private compiler;
|
|
9
9
|
constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
|
|
10
10
|
validate(): CompileError[];
|
|
11
|
+
private validateSettings;
|
|
11
12
|
private validateContext;
|
|
12
13
|
private validateName;
|
|
13
14
|
private validateAlias;
|
|
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
|
|
@@ -113,9 +113,10 @@ export declare enum CompileErrorCode {
|
|
|
113
113
|
UNSUPPORTED = 5000,
|
|
114
114
|
CIRCULAR_REF = 5001,
|
|
115
115
|
SAME_ENDPOINT = 5002,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
DEP_SELF_LOOP = 5003,
|
|
117
|
+
UNEQUAL_FIELDS_BINARY_REF = 5004,
|
|
118
|
+
CONFLICTING_SETTING = 5005,
|
|
119
|
+
TABLE_REAPPEAR_IN_TABLEGROUP = 5006
|
|
119
120
|
}
|
|
120
121
|
export declare class CompileError extends Error {
|
|
121
122
|
code: Readonly<CompileErrorCode>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|