@dbml/parse 11.0.0-alpha.6 → 11.0.1-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/dbml-parse.js +32 -38
- package/dist/dbml-parse.mjs +5089 -6134
- package/dist/src/compiler/index.d.ts +14 -30
- package/dist/src/compiler/projectLayout/layout.d.ts +7 -0
- package/dist/src/compiler/queries/transform/index.d.ts +2 -2
- package/dist/src/compiler/queries/transform/types.d.ts +1 -10
- package/dist/src/compiler/queries/transform/updateElementMetadata.d.ts +13 -0
- package/dist/src/compiler/queries/utils.d.ts +13 -11
- package/dist/src/core/global_modules/index.d.ts +1 -2
- package/dist/src/core/global_modules/metadata/interpret.d.ts +2 -2
- package/dist/src/core/global_modules/metadata/registries.d.ts +19 -0
- package/dist/src/core/global_modules/metadata/utils.d.ts +19 -14
- package/dist/src/core/global_modules/note/interpret.d.ts +1 -3
- package/dist/src/core/global_modules/program/bind.d.ts +0 -1
- package/dist/src/core/global_modules/program/interpret.d.ts +0 -2
- package/dist/src/core/global_modules/records/utils/data/values.d.ts +1 -2
- package/dist/src/core/global_modules/table/interpret.d.ts +1 -4
- package/dist/src/core/global_modules/tableGroup/interpret.d.ts +1 -3
- package/dist/src/core/lexer/lexer.d.ts +1 -6
- package/dist/src/core/local_modules/dep/validate.d.ts +1 -4
- package/dist/src/core/local_modules/index.d.ts +0 -1
- package/dist/src/core/local_modules/note/validate.d.ts +0 -2
- package/dist/src/core/local_modules/table/validate.d.ts +1 -7
- package/dist/src/core/local_modules/tableGroup/validate.d.ts +1 -5
- package/dist/src/core/parser/parser.d.ts +1 -5
- package/dist/src/core/types/errors.d.ts +5 -16
- package/dist/src/core/types/filepath.d.ts +3 -1
- package/dist/src/core/types/nodes.d.ts +0 -1
- package/dist/src/core/types/schemaJson/types.d.ts +8 -47
- package/dist/src/core/types/symbol/metadata.d.ts +1 -13
- package/dist/src/core/types/symbol/symbols.d.ts +0 -9
- package/dist/src/core/types/tokens.d.ts +0 -1
- package/dist/src/core/utils/expression.d.ts +2 -0
- package/dist/src/core/utils/interpret.d.ts +15 -4
- package/dist/src/core/utils/validate.d.ts +0 -1
- package/dist/src/index.d.ts +6 -13
- package/dist/src/services/definition/provider.d.ts +1 -0
- package/dist/src/services/suggestions/provider.d.ts +2 -0
- package/dist/src/services/suggestions/use.d.ts +4 -1
- package/package.json +3 -3
- package/dist/src/compiler/queries/files/fileKind.d.ts +0 -12
- package/dist/src/compiler/queries/transform/renameElement.d.ts +0 -8
- package/dist/src/compiler/queries/transform/utils/arch.d.ts +0 -17
- package/dist/src/core/arch/icons.d.ts +0 -6
- package/dist/src/core/arch/read.d.ts +0 -59
- package/dist/src/core/arch/vocabulary.d.ts +0 -10
- package/dist/src/core/global_modules/arch/index.d.ts +0 -2
- package/dist/src/core/global_modules/arch/interpret.d.ts +0 -9
- package/dist/src/core/global_modules/arch/utils.d.ts +0 -5
- package/dist/src/core/local_modules/arch/index.d.ts +0 -2
|
@@ -1,39 +1,20 @@
|
|
|
1
|
-
import { GlobalModule } from '../core/global_modules/types';
|
|
2
|
-
import { ParserOptions } from '../core/parser/parser';
|
|
3
|
-
import { LexerOptions } from '../core/lexer/lexer';
|
|
4
|
-
import { SyntaxToken } from '../core/types/tokens';
|
|
5
|
-
import { FileKind, FileScan } from './queries/files/fileKind';
|
|
6
1
|
import { Filepath } from '../core/types/filepath';
|
|
7
2
|
import { SyntaxNode, SyntaxNodeIdGenerator } from '../core/types/nodes';
|
|
8
3
|
import { NodeSymbolIdGenerator, SymbolFactory } from '../core/types/symbol';
|
|
9
4
|
import { DBMLCodeActionProvider, DBMLCompletionItemProvider, DBMLDefinitionProvider, DBMLDiagnosticsProvider, DBMLReferencesProvider } from '../services/index';
|
|
10
5
|
import { DbmlProjectLayout } from './projectLayout';
|
|
11
|
-
import { addDoubleQuoteIfNeeded, escapeString,
|
|
12
|
-
export interface DialectOptions {
|
|
13
|
-
lexer?: LexerOptions;
|
|
14
|
-
parser?: ParserOptions;
|
|
15
|
-
}
|
|
6
|
+
import { addDoubleQuoteIfNeeded, escapeString, formatTypedValue, isValidIdentifier, normalizeQualifiedName, splitQualifiedIdentifier, unescapeString, TypedValue } from './queries/utils';
|
|
16
7
|
export { ScopeKind } from './types';
|
|
17
8
|
export type { TextEdit } from './queries/transform';
|
|
18
|
-
export { addDoubleQuoteIfNeeded, escapeString,
|
|
9
|
+
export { addDoubleQuoteIfNeeded, escapeString, formatTypedValue, isValidIdentifier, normalizeQualifiedName, splitQualifiedIdentifier, unescapeString, };
|
|
10
|
+
export type { TypedValue };
|
|
19
11
|
export default class Compiler {
|
|
20
12
|
layout: DbmlProjectLayout;
|
|
21
13
|
readonly nodeIdGenerator: SyntaxNodeIdGenerator;
|
|
22
14
|
readonly symbolIdGenerator: NodeSymbolIdGenerator;
|
|
23
15
|
readonly symbolFactory: SymbolFactory;
|
|
24
|
-
|
|
25
|
-
private readonly explicitDialect;
|
|
26
|
-
readonly dialect: DialectOptions;
|
|
27
|
-
constructor(layout: DbmlProjectLayout, modules?: GlobalModule[], dialect?: DialectOptions);
|
|
16
|
+
constructor(layout: DbmlProjectLayout);
|
|
28
17
|
getSource(filepath: Filepath): string | undefined;
|
|
29
|
-
lexerOptions(): LexerOptions;
|
|
30
|
-
parserOptions(kind: FileKind): ParserOptions;
|
|
31
|
-
private fileScans;
|
|
32
|
-
private fileKinds;
|
|
33
|
-
scanFile(filepath: Filepath, tokens?: readonly SyntaxToken[]): FileScan;
|
|
34
|
-
fileKind(filepath: Filepath): FileKind;
|
|
35
|
-
fileKindForParse(filepath: Filepath, tokens?: readonly SyntaxToken[]): FileKind;
|
|
36
|
-
parsedFileKind(filepath: Filepath): FileKind;
|
|
37
18
|
private sourceSnapshot;
|
|
38
19
|
private cleanStaleLocalCache;
|
|
39
20
|
private entrypointsSnapshot;
|
|
@@ -90,11 +71,13 @@ export default class Compiler {
|
|
|
90
71
|
}[];
|
|
91
72
|
};
|
|
92
73
|
}>;
|
|
93
|
-
nodeAtPosition: (filepath: Filepath, offset: number) => SyntaxNode | SyntaxToken | undefined;
|
|
74
|
+
nodeAtPosition: (filepath: Filepath, offset: number) => SyntaxNode | import('..').SyntaxToken | undefined;
|
|
94
75
|
renameTable: (filepath: Filepath, oldName: string | import('..').TableIdentifier, newName: string | import('..').TableIdentifier) => Map<string, string>;
|
|
95
|
-
renameElement: (filepath: Filepath, oldHandle: string, newName: string) => Map<string, string>;
|
|
96
76
|
updateElementSetting: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => string;
|
|
97
77
|
updateElementSettingEdit: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => import('.').TextEdit[];
|
|
78
|
+
findMetadataBlock: (filepath: Filepath, target: import('..').ElementIdentifier) => import('../core/types/nodes').ElementDeclarationNode | undefined;
|
|
79
|
+
updateElementMetadata: (filepath: Filepath, target: import('..').ElementIdentifier, key: string, value: TypedValue) => string;
|
|
80
|
+
updateElementMetadataEdit: (filepath: Filepath, target: import('..').ElementIdentifier, key: string, value: TypedValue) => import('.').TextEdit[];
|
|
98
81
|
syncDiagramView: (filepath: Filepath, operations: import('..').DiagramViewSyncOperation[], blocks?: import('..').DiagramViewBlock[] | undefined) => {
|
|
99
82
|
newDbml: string;
|
|
100
83
|
edits: import('.').TextEdit[];
|
|
@@ -104,22 +87,22 @@ export default class Compiler {
|
|
|
104
87
|
edits: import('.').TextEdit[];
|
|
105
88
|
};
|
|
106
89
|
readonly token: {
|
|
107
|
-
invalidStream: (filepath: Filepath) => readonly SyntaxToken[];
|
|
108
|
-
flatStream: (filepath: Filepath) => readonly SyntaxToken[];
|
|
90
|
+
invalidStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
|
|
91
|
+
flatStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
|
|
109
92
|
};
|
|
110
93
|
readonly parse: {
|
|
111
94
|
source: (filepath: Filepath) => string;
|
|
112
95
|
ast: (filepath?: Filepath) => Readonly<import('../core/types/nodes').ProgramNode>;
|
|
113
96
|
errors: (filepath?: Filepath) => readonly Readonly<import('..').CompileError>[];
|
|
114
|
-
warnings: (filepath?: Filepath) => readonly Readonly<import('
|
|
115
|
-
tokens: (filepath?: Filepath) => readonly Readonly<SyntaxToken>[];
|
|
97
|
+
warnings: (filepath?: Filepath) => readonly Readonly<import('..').CompileWarning>[];
|
|
98
|
+
tokens: (filepath?: Filepath) => readonly Readonly<import('..').SyntaxToken>[];
|
|
116
99
|
rawDb: (filepath?: Filepath) => Readonly<import('..').Database> | undefined;
|
|
117
100
|
publicSymbolTable: (filepath?: Filepath) => readonly Readonly<import('../core/types/symbol').NodeSymbol>[] | undefined;
|
|
118
101
|
};
|
|
119
102
|
readonly container: {
|
|
120
103
|
stack: (filepath: Filepath, offset: number) => readonly Readonly<SyntaxNode>[];
|
|
121
104
|
token: (filepath: Filepath, offset: number) => {
|
|
122
|
-
token: SyntaxToken;
|
|
105
|
+
token: import('..').SyntaxToken;
|
|
123
106
|
index: number;
|
|
124
107
|
} | {
|
|
125
108
|
token: undefined;
|
|
@@ -132,6 +115,7 @@ export default class Compiler {
|
|
|
132
115
|
initMonacoServices(options?: {
|
|
133
116
|
autocompletion?: {
|
|
134
117
|
triggerCharacters?: string[];
|
|
118
|
+
fileListDepth?: number;
|
|
135
119
|
};
|
|
136
120
|
}): {
|
|
137
121
|
definitionProvider: DBMLDefinitionProvider;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Filepath } from '../../core/types/filepath';
|
|
2
|
+
export interface FileSpecifierInfo {
|
|
3
|
+
specifier: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
detail?: string;
|
|
6
|
+
}
|
|
2
7
|
export interface DbmlProjectLayout {
|
|
3
8
|
resolveFileSpecifier(currentFilepath: Filepath, specifier: string): Filepath | undefined;
|
|
9
|
+
getFileSpecifierInfo(currentFilepath: Filepath, targetFilepath: Filepath): FileSpecifierInfo | undefined;
|
|
4
10
|
getSource(filePath: Filepath): string | undefined;
|
|
5
11
|
exists(filePath: Filepath): boolean;
|
|
6
12
|
isFile(filePath: Filepath): boolean;
|
|
@@ -12,6 +18,7 @@ export declare class MemoryProjectLayout implements DbmlProjectLayout {
|
|
|
12
18
|
private readonly files;
|
|
13
19
|
constructor(files?: Map<string, string> | Record<string, string>);
|
|
14
20
|
resolveFileSpecifier(currentFilepath: Filepath, relativePath: string): Filepath | undefined;
|
|
21
|
+
getFileSpecifierInfo(currentFilepath: Filepath, targetFilepath: Filepath): FileSpecifierInfo | undefined;
|
|
15
22
|
setSource(filePath: Filepath, content: string): void;
|
|
16
23
|
getSource(filePath: Filepath): string | undefined;
|
|
17
24
|
deleteSource(filePath: Filepath): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { renameTable } from './renameTable';
|
|
2
|
-
export { renameElement } from './renameElement';
|
|
3
2
|
export { updateElementSetting, updateElementSettingEdit } from './updateElementSetting';
|
|
3
|
+
export { findMetadataBlock, updateElementMetadata, updateElementMetadataEdit, syncElementMetadata, } from './updateElementMetadata';
|
|
4
4
|
export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
|
|
5
5
|
export { syncDep, generateDepBlock, type DepSyncOperation, type DepSyncEdge, type DepEndpointRef, } from './syncDep';
|
|
6
6
|
export { applyTextEdits, type TextEdit } from './applyTextEdits';
|
|
7
|
-
export type { ElementIdentifier, SchemaIdentifier, TableIdentifier, ColumnIdentifier, EnumIdentifier, EndpointRef, RefIdentifier, DepIdentifier, NoteIdentifier, TableGroupIdentifier,
|
|
7
|
+
export type { ElementIdentifier, SchemaIdentifier, TableIdentifier, ColumnIdentifier, EnumIdentifier, EndpointRef, RefIdentifier, DepIdentifier, NoteIdentifier, TableGroupIdentifier, } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SymbolKind } from '../../../core/types/symbol';
|
|
2
2
|
import { MetadataKind } from '../../../core/types/symbol/metadata';
|
|
3
|
-
export type ElementIdentifier = (SchemaIdentifier | TableIdentifier | ColumnIdentifier | EnumIdentifier | RefIdentifier | DepIdentifier | NoteIdentifier | TableGroupIdentifier
|
|
3
|
+
export type ElementIdentifier = (SchemaIdentifier | TableIdentifier | ColumnIdentifier | EnumIdentifier | RefIdentifier | DepIdentifier | NoteIdentifier | TableGroupIdentifier) & {
|
|
4
4
|
kind: string;
|
|
5
5
|
};
|
|
6
6
|
export interface SchemaIdentifier {
|
|
@@ -46,12 +46,3 @@ export interface TableGroupIdentifier {
|
|
|
46
46
|
schema?: string;
|
|
47
47
|
name: string;
|
|
48
48
|
}
|
|
49
|
-
export interface ArchElementIdentifier {
|
|
50
|
-
kind?: typeof SymbolKind.Element;
|
|
51
|
-
name: string;
|
|
52
|
-
}
|
|
53
|
-
export interface ArchLinkIdentifier {
|
|
54
|
-
kind?: 'Link';
|
|
55
|
-
from: string;
|
|
56
|
-
to: string;
|
|
57
|
-
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
import { ElementIdentifier } from './types';
|
|
6
|
+
import { TypedValue } from '../utils';
|
|
7
|
+
export declare function findMetadataBlock(this: Compiler, filepath: Filepath, target: ElementIdentifier): ElementDeclarationNode | undefined;
|
|
8
|
+
export declare function updateElementMetadataEdit(this: Compiler, filepath: Filepath, target: ElementIdentifier, key: string, value: TypedValue | null): TextEdit[];
|
|
9
|
+
export declare function updateElementMetadata(this: Compiler, filepath: Filepath, target: ElementIdentifier, key: string, value: TypedValue | null): string;
|
|
10
|
+
export declare function syncElementMetadata(source: string, compiler: Compiler, filepath: Filepath, target: ElementIdentifier, key: string, value: TypedValue | null): {
|
|
11
|
+
newDbml: string;
|
|
12
|
+
edits: TextEdit[];
|
|
13
|
+
};
|
|
@@ -70,20 +70,22 @@ export declare function escapeString(str: string): string;
|
|
|
70
70
|
* @returns The formatted string representation for DBML
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
73
|
+
* formatTypedValue({ value: 1, type: 'integer' }) => '1'
|
|
74
|
+
* formatTypedValue({ value: 'Alice', type: 'string' }) => "'Alice'"
|
|
75
|
+
* formatTypedValue({ value: true, type: 'bool' }) => 'true'
|
|
76
|
+
* formatTypedValue({ value: null, type: 'string' }) => 'null'
|
|
77
|
+
* formatTypedValue({ value: '#ff0000', type: 'color' }) => '#ff0000'
|
|
78
|
+
* formatTypedValue(undefined) => 'null'
|
|
79
|
+
* formatTypedValue(null) => 'null'
|
|
80
|
+
* formatTypedValue('Alice') => "'Alice'"
|
|
81
|
+
* formatTypedValue(42) => '42'
|
|
82
|
+
* formatTypedValue(true) => 'true'
|
|
82
83
|
*/
|
|
83
|
-
export
|
|
84
|
+
export type TypedValue = {
|
|
84
85
|
value: any;
|
|
85
86
|
type: string;
|
|
86
|
-
} | string | number | boolean | null | undefined
|
|
87
|
+
} | string | number | boolean | null | undefined;
|
|
88
|
+
export declare function formatTypedValue(recordValue: TypedValue): string;
|
|
87
89
|
/**
|
|
88
90
|
* Splits a qualified identifier string into its components, handling quoted segments.
|
|
89
91
|
*
|
|
@@ -7,8 +7,7 @@ import { NodeMetadata } from '../types/symbol/metadata';
|
|
|
7
7
|
import { SchemaElement } from '../types/schemaJson';
|
|
8
8
|
import { NodeSymbol } from '../types/symbol';
|
|
9
9
|
import { GlobalModule } from './types';
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const archModules: GlobalModule[];
|
|
10
|
+
export declare const modules: GlobalModule[];
|
|
12
11
|
export declare function nodeSymbol(this: Compiler, node: SyntaxNode): Report<NodeSymbol> | Report<Unhandled>;
|
|
13
12
|
export declare function symbolMembers(this: Compiler, symbol: NodeSymbol): Report<NodeSymbol[]> | Report<Unhandled>;
|
|
14
13
|
export declare function nodeReferee(this: Compiler, node: SyntaxNode): Report<NodeSymbol | undefined> | Report<Unhandled>;
|
|
@@ -2,13 +2,13 @@ import { default as Compiler } from '../../../compiler';
|
|
|
2
2
|
import { Filepath } from '../../types';
|
|
3
3
|
import { MetadataElementMetadata } from '../../types/symbol/metadata';
|
|
4
4
|
import { default as Report } from '../../types/report';
|
|
5
|
-
import {
|
|
5
|
+
import { CustomMetadata } from '../../types/schemaJson';
|
|
6
6
|
export default class MetadataInterpreter {
|
|
7
7
|
private declarationNode;
|
|
8
8
|
private compiler;
|
|
9
9
|
private filepath;
|
|
10
10
|
private values;
|
|
11
11
|
constructor(compiler: Compiler, metadata: MetadataElementMetadata, filepath: Filepath);
|
|
12
|
-
interpret(): Report<
|
|
12
|
+
interpret(): Report<CustomMetadata>;
|
|
13
13
|
private interpretValues;
|
|
14
14
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SettingName } from '../../types/keywords';
|
|
2
|
+
import { Color, Column, Note, Table, TableGroup } from '../../types/schemaJson';
|
|
3
|
+
import { MetadataTargetKind } from '../../types/symbol';
|
|
4
|
+
import { MetadataFieldRegistry } from './utils';
|
|
5
|
+
export declare const TABLE_METADATA_FIELDS: MetadataFieldRegistry<Table, {
|
|
6
|
+
[SettingName.Note]: string;
|
|
7
|
+
[SettingName.HeaderColor]: Color;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const COLUMN_METADATA_FIELDS: MetadataFieldRegistry<Column, {
|
|
10
|
+
[SettingName.Note]: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const TABLEGROUP_METADATA_FIELDS: MetadataFieldRegistry<TableGroup, {
|
|
13
|
+
[SettingName.Note]: string;
|
|
14
|
+
[SettingName.Color]: Color;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const NOTE_METADATA_FIELDS: MetadataFieldRegistry<Note, {
|
|
17
|
+
[SettingName.Color]: Color;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const METADATA_FIELDS_BY_KIND: Record<MetadataTargetKind, MetadataFieldRegistry<any, any>>;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler/index';
|
|
2
|
-
import { Filepath,
|
|
3
|
-
import { Column, Note, Table, TableGroup, TokenPosition } from '../../types/schemaJson';
|
|
2
|
+
import { Filepath, SettingName } from '../../types';
|
|
3
|
+
import { Column, CustomMetadataValue, CustomMetadataValueType, Note, Table, TableGroup, TokenPosition } from '../../types/schemaJson';
|
|
4
4
|
import { ElementDeclarationNode, SyntaxNode } from '../../types/nodes';
|
|
5
5
|
import { NodeSymbol, SymbolKind, MetadataTargetKind } from '../../types/symbol';
|
|
6
6
|
export type MetadataTarget = Table | TableGroup | Note | Column;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* - `
|
|
8
|
+
* Spec for one builtin metadata field (table's note, tablegroup's color, .etc) of an element kind.
|
|
9
|
+
* Used for both the inline settings list and Metadata blocks:
|
|
10
|
+
* - `parse`: Read the field's own value from a source node, `undefined` means the value is invalid
|
|
11
|
+
* - `assign`: Write the parsed value to the element builtin props (e.g. write `table.note` instead of `table.metadata`)
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
type MetadataField<T, V> = {
|
|
14
|
+
/** Type of the parsed value, reported when the field is read as a metadata entry */
|
|
15
|
+
type: CustomMetadataValueType;
|
|
16
|
+
/** Parse the source node into the field's value, `undefined` if the node is not a valid value for this field */
|
|
17
|
+
parse(node?: SyntaxNode): V | undefined;
|
|
15
18
|
message: string;
|
|
16
|
-
/** Write the
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
export type MetadataFieldRegistry<T extends MetadataTarget,
|
|
19
|
+
/** Write the parsed value to the element builtin props (e.g. write to `table.note`) */
|
|
20
|
+
assign(element: Partial<T>, value: V, token: TokenPosition): void;
|
|
21
|
+
};
|
|
22
|
+
export type MetadataFieldRegistry<T extends MetadataTarget, R extends {
|
|
23
|
+
[K in SettingName]?: CustomMetadataValue['value'];
|
|
24
|
+
}> = {
|
|
25
|
+
[K in keyof R]: MetadataField<T, R[K]>;
|
|
26
|
+
};
|
|
20
27
|
type NameWithSymbolKind = {
|
|
21
28
|
name: string;
|
|
22
29
|
symbolKind: SymbolKind;
|
|
@@ -24,8 +31,6 @@ type NameWithSymbolKind = {
|
|
|
24
31
|
/** @internal Exported for testing only. */
|
|
25
32
|
export declare function mapNamePartToSymbolKind(nameParts: string[], targetKind: MetadataTargetKind): NameWithSymbolKind[];
|
|
26
33
|
export declare function resolveMetadataTarget(compiler: Compiler, metadataNode: ElementDeclarationNode): NodeSymbol | undefined;
|
|
27
|
-
/** Get precedence score of files in import tree, lower score means lower precedence */
|
|
28
|
-
export declare function metadataFilePrecedence(compiler: Compiler, root: Filepath): Map<FilepathId, number>;
|
|
29
34
|
/** Merge every custom-metadata block, reachable from the current program, targeting element to it's `metadata` and other builtin (note/headercolor/...) fields */
|
|
30
35
|
export declare function attachCustomMetadata<T extends MetadataTarget>(compiler: Compiler, targetElement: Partial<T>, targetSymbol: NodeSymbol, fieldsRegistry: MetadataFieldRegistry<T, any>, filepath: Filepath): void;
|
|
31
36
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Note } from '../../types/schemaJson';
|
|
2
2
|
import { default as Compiler } from '../../../compiler';
|
|
3
|
-
import {
|
|
3
|
+
import { Filepath, NoteSymbol } from '../../types';
|
|
4
4
|
import { default as Report } from '../../types/report';
|
|
5
|
-
import { MetadataFieldRegistry } from '../metadata/utils';
|
|
6
|
-
export declare const NOTE_METADATA_FIELDS: MetadataFieldRegistry<Note, SettingName.Color>;
|
|
7
5
|
export declare class StickyNoteInterpreter {
|
|
8
6
|
private declarationNode;
|
|
9
7
|
private symbol;
|
|
@@ -14,8 +14,6 @@ export default class ProgramInterpreter {
|
|
|
14
14
|
private db;
|
|
15
15
|
constructor(compiler: Compiler, symbol: ProgramSymbol, filepath: Filepath);
|
|
16
16
|
interpret(): Report<SchemaElement | SchemaElement[] | undefined>;
|
|
17
|
-
private arch;
|
|
18
|
-
private finishArch;
|
|
19
17
|
private interpretAllSymbols;
|
|
20
18
|
private interpretUseSymbol;
|
|
21
19
|
private interpretAllMetadata;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FunctionExpressionNode, SyntaxNode } from '../../../../types/nodes';
|
|
2
|
-
export { extractNumericLiteral } from '../../../../utils/expression';
|
|
2
|
+
export { extractNumericLiteral, extractSignedNumber } from '../../../../utils/expression';
|
|
3
3
|
export declare function isNullish(value: SyntaxNode): boolean;
|
|
4
4
|
export declare function isEmptyStringLiteral(value: SyntaxNode): boolean;
|
|
5
5
|
export declare function isFunctionExpression(value: SyntaxNode): value is FunctionExpressionNode;
|
|
6
|
-
export declare function extractSignedNumber(node: SyntaxNode): number | null;
|
|
7
6
|
export declare function tryExtractNumeric(value: SyntaxNode | number | string | boolean | undefined | null): number | null;
|
|
8
7
|
export declare function tryExtractInteger(value: SyntaxNode | number | string | boolean | undefined | null): number | null;
|
|
9
8
|
export declare const TRUTHY_VALUES: string[];
|
|
@@ -2,10 +2,9 @@ import { default as Compiler } from '../../../compiler';
|
|
|
2
2
|
import { SettingName } from '../../types/keywords';
|
|
3
3
|
import { ElementDeclarationNode } from '../../types/nodes';
|
|
4
4
|
import { default as Report } from '../../types/report';
|
|
5
|
-
import {
|
|
5
|
+
import { Table } from '../../types/schemaJson';
|
|
6
6
|
import { Filepath } from '../../types/filepath';
|
|
7
7
|
import { TableSymbol } from '../../types/symbol/symbols';
|
|
8
|
-
import { MetadataFieldRegistry } from '../metadata/utils';
|
|
9
8
|
export declare class TableInterpreter {
|
|
10
9
|
private declarationNode;
|
|
11
10
|
private compiler;
|
|
@@ -33,5 +32,3 @@ export declare class TableInterpreter {
|
|
|
33
32
|
* TODO: Catch these settings when we support more data types for custom metadata
|
|
34
33
|
*/
|
|
35
34
|
export declare const RECOGNIZED_COLUMN_SETTINGS: readonly SettingName[];
|
|
36
|
-
export declare const TABLE_METADATA_FIELDS: MetadataFieldRegistry<Table, SettingName.Note | SettingName.HeaderColor>;
|
|
37
|
-
export declare const COLUMN_METADATA_FIELDS: MetadataFieldRegistry<Column, SettingName.Note>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { TableGroup } from '../../types/schemaJson';
|
|
2
2
|
import { default as Compiler } from '../../../compiler';
|
|
3
|
-
import {
|
|
3
|
+
import { Filepath, TableGroupSymbol } from '../../types';
|
|
4
4
|
import { default as Report } from '../../types/report';
|
|
5
|
-
import { MetadataFieldRegistry } from '../metadata/utils';
|
|
6
|
-
export declare const TABLEGROUP_METADATA_FIELDS: MetadataFieldRegistry<TableGroup, SettingName.Note | SettingName.Color>;
|
|
7
5
|
export declare class TableGroupInterpreter {
|
|
8
6
|
private compiler;
|
|
9
7
|
private symbol;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { Filepath } from '../types/filepath';
|
|
2
2
|
import { default as Report } from '../types/report';
|
|
3
3
|
import { SyntaxToken, SyntaxTokenKind } from '../types/tokens';
|
|
4
|
-
export interface LexerOptions {
|
|
5
|
-
allowFrontMatter?: boolean;
|
|
6
|
-
}
|
|
7
4
|
export default class Lexer {
|
|
8
5
|
private start;
|
|
9
6
|
private current;
|
|
@@ -11,9 +8,7 @@ export default class Lexer {
|
|
|
11
8
|
private filepath;
|
|
12
9
|
private tokens;
|
|
13
10
|
private errors;
|
|
14
|
-
|
|
15
|
-
constructor(text: string, filepath: Filepath, options?: LexerOptions);
|
|
16
|
-
private scanFrontMatter;
|
|
11
|
+
constructor(text: string, filepath: Filepath);
|
|
17
12
|
private isAtEnd;
|
|
18
13
|
private advance;
|
|
19
14
|
private peek;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler';
|
|
2
2
|
import { CompileError } from '../../types/errors';
|
|
3
|
-
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode
|
|
4
|
-
import { default as Report } from '../../types/report';
|
|
5
|
-
import { Settings } from '../../utils/validate';
|
|
3
|
+
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../types/nodes';
|
|
6
4
|
export default class DepValidator {
|
|
7
5
|
private declarationNode;
|
|
8
6
|
private compiler;
|
|
@@ -16,4 +14,3 @@ export default class DepValidator {
|
|
|
16
14
|
validateFields(fields: FunctionApplicationNode[]): CompileError[];
|
|
17
15
|
private validateSubElements;
|
|
18
16
|
}
|
|
19
|
-
export declare function validateDepSettings(settings: ListExpressionNode): Report<Settings>;
|
|
@@ -4,7 +4,6 @@ import { SyntaxNode } from '../types/nodes';
|
|
|
4
4
|
import { default as Report } from '../types/report';
|
|
5
5
|
import { LocalModule, Settings } from './types';
|
|
6
6
|
export declare const modules: LocalModule[];
|
|
7
|
-
export declare const archModules: LocalModule[];
|
|
8
7
|
export declare function validateNode(this: Compiler, node: SyntaxNode): Report<void> | Report<Unhandled>;
|
|
9
8
|
export declare function nodeSettings(this: Compiler, node: SyntaxNode): Report<Settings> | Report<Unhandled>;
|
|
10
9
|
export declare function nodeFullname(this: Compiler, node: SyntaxNode): Report<string[] | undefined> | Report<Unhandled>;
|
|
@@ -9,8 +9,6 @@ export default class NoteValidator {
|
|
|
9
9
|
private validateContext;
|
|
10
10
|
private validateName;
|
|
11
11
|
private validateAlias;
|
|
12
|
-
private isStickyNote;
|
|
13
|
-
private validateSettingList;
|
|
14
12
|
validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
|
|
15
13
|
validateFields(fields: FunctionApplicationNode[]): CompileError[];
|
|
16
14
|
private validateSubElements;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler';
|
|
2
2
|
import { CompileError } from '../../types/errors';
|
|
3
|
-
import { ElementDeclarationNode
|
|
4
|
-
import { default as Report } from '../../types/report';
|
|
5
|
-
import { Settings } from '../../utils/validate';
|
|
3
|
+
import { ElementDeclarationNode } from '../../types/nodes';
|
|
6
4
|
export default class TableValidator {
|
|
7
5
|
private declarationNode;
|
|
8
6
|
private compiler;
|
|
@@ -11,11 +9,7 @@ export default class TableValidator {
|
|
|
11
9
|
private validateContext;
|
|
12
10
|
private validateName;
|
|
13
11
|
private validateAlias;
|
|
14
|
-
private validateSettingList;
|
|
15
12
|
private validateBody;
|
|
16
13
|
private validateFields;
|
|
17
|
-
private validateFieldSetting;
|
|
18
14
|
private validateSubElements;
|
|
19
15
|
}
|
|
20
|
-
export declare function validateTableSettings(settingList?: ListExpressionNode): Report<Settings>;
|
|
21
|
-
export declare function validateFieldSetting(parts: ExpressionNode[]): Report<Settings>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler';
|
|
2
2
|
import { CompileError } from '../../types/errors';
|
|
3
|
-
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode
|
|
4
|
-
import { default as Report } from '../../types/report';
|
|
5
|
-
import { Settings } from '../../utils/validate';
|
|
3
|
+
import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../types/nodes';
|
|
6
4
|
export default class TableGroupValidator {
|
|
7
5
|
private declarationNode;
|
|
8
6
|
private compiler;
|
|
@@ -11,9 +9,7 @@ export default class TableGroupValidator {
|
|
|
11
9
|
private validateContext;
|
|
12
10
|
private validateName;
|
|
13
11
|
private validateAlias;
|
|
14
|
-
private validateSettingList;
|
|
15
12
|
validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
|
|
16
13
|
validateFields(fields: FunctionApplicationNode[]): CompileError[];
|
|
17
14
|
private validateSubElements;
|
|
18
15
|
}
|
|
19
|
-
export declare function validateSettingList(settingList?: ListExpressionNode): Report<Settings>;
|
|
@@ -2,9 +2,6 @@ import { Filepath } from '../types/filepath';
|
|
|
2
2
|
import { ProgramNode, SyntaxNodeIdGenerator } from '../types/nodes';
|
|
3
3
|
import { default as Report } from '../types/report';
|
|
4
4
|
import { SyntaxToken } from '../types/tokens';
|
|
5
|
-
export interface ParserOptions {
|
|
6
|
-
allowBodylessElement?: boolean;
|
|
7
|
-
}
|
|
8
5
|
export default class Parser {
|
|
9
6
|
private tokens;
|
|
10
7
|
private current;
|
|
@@ -13,8 +10,7 @@ export default class Parser {
|
|
|
13
10
|
private nodeFactory;
|
|
14
11
|
private source;
|
|
15
12
|
private filepath;
|
|
16
|
-
|
|
17
|
-
constructor(source: string, tokens: SyntaxToken[], nodeIdGenerator: SyntaxNodeIdGenerator, filepath: Filepath, options?: ParserOptions);
|
|
13
|
+
constructor(source: string, tokens: SyntaxToken[], nodeIdGenerator: SyntaxNodeIdGenerator, filepath: Filepath);
|
|
18
14
|
private isAtEnd;
|
|
19
15
|
private advance;
|
|
20
16
|
private peek;
|
|
@@ -112,6 +112,10 @@ export declare enum CompileErrorCode {
|
|
|
112
112
|
DUPLICATE_DIAGRAMVIEW_NAME = 3094,
|
|
113
113
|
INVALID_DIAGRAMVIEW_FIELD = 3095,
|
|
114
114
|
DUPLICATE_DIAGRAMVIEW_FIELD = 3096,
|
|
115
|
+
DUPLICATE_TABLEGROUP_SETTING = 3097,
|
|
116
|
+
INVALID_TABLEGROUP_SETTING_VALUE = 3098,
|
|
117
|
+
DUPLICATE_DEP_SETTING = 3099,
|
|
118
|
+
INVALID_DEP_SETTING_VALUE = 3100,
|
|
115
119
|
BINDING_ERROR = 4000,
|
|
116
120
|
NONEXISTENT_MODULE = 4001,
|
|
117
121
|
UNSUPPORTED = 5000,
|
|
@@ -127,22 +131,7 @@ export declare enum CompileErrorCode {
|
|
|
127
131
|
INVALID_METADATA_TARGET_KIND = 5010,
|
|
128
132
|
INVALID_METADATA_FIELD = 5011,
|
|
129
133
|
DUPLICATE_METADATA_FIELD = 5012,
|
|
130
|
-
|
|
131
|
-
MISSING_NAME = 6001,
|
|
132
|
-
NO_CUSTOM_ROLE = 6002,
|
|
133
|
-
UNKNOWN_ENDPOINT = 6003,
|
|
134
|
-
EMPTY_LINK = 6004,
|
|
135
|
-
BAD_LINK = 6005,
|
|
136
|
-
UNKNOWN_METADATA_TARGET = 6006,
|
|
137
|
-
BAD_PROPERTY = 6007,
|
|
138
|
-
DUPLICATE_PROPERTY = 6008,
|
|
139
|
-
DIAGRAM_TYPE_NOT_HERE = 6009,
|
|
140
|
-
METADATA_ROLE_MISMATCH = 6010,
|
|
141
|
-
UNKNOWN_TYPE = 6011,
|
|
142
|
-
UNKNOWN_ICON = 6012,
|
|
143
|
-
BAD_IMAGE = 6013,
|
|
144
|
-
DUPLICATE_LINK = 6014,
|
|
145
|
-
NESTED_ENDPOINTS = 6015
|
|
134
|
+
IMPORTED_FILE_HAS_ERRORS = 5013
|
|
146
135
|
}
|
|
147
136
|
export interface RelatedLocation {
|
|
148
137
|
nodeOrToken: SyntaxNode | SyntaxToken;
|
|
@@ -5,10 +5,12 @@ export type FilepathId = string & {
|
|
|
5
5
|
};
|
|
6
6
|
export declare class Filepath implements Internable<FilepathId> {
|
|
7
7
|
private readonly protocol?;
|
|
8
|
-
private readonly
|
|
8
|
+
private readonly root;
|
|
9
|
+
private readonly segments;
|
|
9
10
|
constructor(absolutePath: string, options?: {
|
|
10
11
|
protocol?: string;
|
|
11
12
|
});
|
|
13
|
+
private get path();
|
|
12
14
|
intern(): FilepathId;
|
|
13
15
|
static from(absolutePath: string): Filepath;
|
|
14
16
|
static resolve(fromDir: string, relativePath: string): Filepath;
|
|
@@ -95,7 +95,6 @@ export declare class UseSpecifierNode extends SyntaxNode {
|
|
|
95
95
|
asKeyword?: SyntaxToken;
|
|
96
96
|
alias?: NormalExpressionNode;
|
|
97
97
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
98
|
-
archImport?: boolean;
|
|
99
98
|
isKind(...importKinds: ImportKind[]): boolean;
|
|
100
99
|
getSymbolKind(): SymbolKind | undefined;
|
|
101
100
|
}
|