@dbml/parse 11.0.0-alpha.5 → 11.0.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.
Files changed (49) hide show
  1. package/LICENSE +0 -0
  2. package/dist/dbml-parse.js +28 -38
  3. package/dist/dbml-parse.mjs +5132 -6232
  4. package/dist/src/compiler/index.d.ts +8 -30
  5. package/dist/src/compiler/projectLayout/layout.d.ts +7 -0
  6. package/dist/src/compiler/queries/transform/index.d.ts +1 -2
  7. package/dist/src/compiler/queries/transform/types.d.ts +1 -10
  8. package/dist/src/core/global_modules/index.d.ts +1 -2
  9. package/dist/src/core/global_modules/metadata/interpret.d.ts +2 -2
  10. package/dist/src/core/global_modules/metadata/registries.d.ts +19 -0
  11. package/dist/src/core/global_modules/metadata/utils.d.ts +19 -14
  12. package/dist/src/core/global_modules/note/interpret.d.ts +1 -3
  13. package/dist/src/core/global_modules/program/bind.d.ts +0 -1
  14. package/dist/src/core/global_modules/program/interpret.d.ts +0 -2
  15. package/dist/src/core/global_modules/records/utils/data/values.d.ts +1 -2
  16. package/dist/src/core/global_modules/table/interpret.d.ts +1 -4
  17. package/dist/src/core/global_modules/tableGroup/interpret.d.ts +1 -3
  18. package/dist/src/core/lexer/lexer.d.ts +1 -6
  19. package/dist/src/core/local_modules/dep/validate.d.ts +1 -4
  20. package/dist/src/core/local_modules/index.d.ts +0 -1
  21. package/dist/src/core/local_modules/note/validate.d.ts +0 -2
  22. package/dist/src/core/local_modules/table/validate.d.ts +1 -7
  23. package/dist/src/core/local_modules/tableGroup/validate.d.ts +1 -5
  24. package/dist/src/core/parser/parser.d.ts +1 -5
  25. package/dist/src/core/types/errors.d.ts +5 -17
  26. package/dist/src/core/types/filepath.d.ts +3 -1
  27. package/dist/src/core/types/nodes.d.ts +0 -1
  28. package/dist/src/core/types/schemaJson/types.d.ts +8 -60
  29. package/dist/src/core/types/symbol/metadata.d.ts +1 -13
  30. package/dist/src/core/types/symbol/symbols.d.ts +0 -18
  31. package/dist/src/core/types/tokens.d.ts +0 -1
  32. package/dist/src/core/utils/expression.d.ts +2 -0
  33. package/dist/src/core/utils/interpret.d.ts +15 -4
  34. package/dist/src/core/utils/validate.d.ts +0 -1
  35. package/dist/src/index.d.ts +4 -11
  36. package/dist/src/services/definition/provider.d.ts +1 -0
  37. package/dist/src/services/suggestions/provider.d.ts +3 -1
  38. package/dist/src/services/suggestions/use.d.ts +4 -1
  39. package/package.json +3 -3
  40. package/dist/src/compiler/queries/files/fileKind.d.ts +0 -18
  41. package/dist/src/compiler/queries/transform/renameElement.d.ts +0 -8
  42. package/dist/src/compiler/queries/transform/utils/arch.d.ts +0 -17
  43. package/dist/src/core/arch/icons.d.ts +0 -6
  44. package/dist/src/core/arch/read.d.ts +0 -59
  45. package/dist/src/core/arch/vocabulary.d.ts +0 -11
  46. package/dist/src/core/global_modules/arch/index.d.ts +0 -2
  47. package/dist/src/core/global_modules/arch/interpret.d.ts +0 -11
  48. package/dist/src/core/global_modules/arch/utils.d.ts +0 -7
  49. package/dist/src/core/local_modules/arch/index.d.ts +0 -2
@@ -1,18 +1,9 @@
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
6
  import { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, normalizeQualifiedName, splitQualifiedIdentifier, unescapeString } from './queries/utils';
12
- export interface DialectOptions {
13
- lexer?: LexerOptions;
14
- parser?: ParserOptions;
15
- }
16
7
  export { ScopeKind } from './types';
17
8
  export type { TextEdit } from './queries/transform';
18
9
  export { addDoubleQuoteIfNeeded, escapeString, formatRecordValue, isValidIdentifier, normalizeQualifiedName, splitQualifiedIdentifier, unescapeString, };
@@ -21,21 +12,8 @@ export default class Compiler {
21
12
  readonly nodeIdGenerator: SyntaxNodeIdGenerator;
22
13
  readonly symbolIdGenerator: NodeSymbolIdGenerator;
23
14
  readonly symbolFactory: SymbolFactory;
24
- readonly explicitModules: GlobalModule[] | undefined;
25
- private readonly explicitDialect;
26
- readonly dialect: DialectOptions;
27
- constructor(layout: DbmlProjectLayout, modules?: GlobalModule[], dialect?: DialectOptions);
15
+ constructor(layout: DbmlProjectLayout);
28
16
  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
- private decideKind;
38
- private refreshFileKind;
39
17
  private sourceSnapshot;
40
18
  private cleanStaleLocalCache;
41
19
  private entrypointsSnapshot;
@@ -92,9 +70,8 @@ export default class Compiler {
92
70
  }[];
93
71
  };
94
72
  }>;
95
- nodeAtPosition: (filepath: Filepath, offset: number) => SyntaxNode | SyntaxToken | undefined;
73
+ nodeAtPosition: (filepath: Filepath, offset: number) => SyntaxNode | import('..').SyntaxToken | undefined;
96
74
  renameTable: (filepath: Filepath, oldName: string | import('..').TableIdentifier, newName: string | import('..').TableIdentifier) => Map<string, string>;
97
- renameElement: (filepath: Filepath, oldHandle: string, newName: string) => Map<string, string>;
98
75
  updateElementSetting: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => string;
99
76
  updateElementSettingEdit: (filepath: Filepath, target: import('..').ElementIdentifier, settingName: string, value: string | null | undefined) => import('.').TextEdit[];
100
77
  syncDiagramView: (filepath: Filepath, operations: import('..').DiagramViewSyncOperation[], blocks?: import('..').DiagramViewBlock[] | undefined) => {
@@ -106,22 +83,22 @@ export default class Compiler {
106
83
  edits: import('.').TextEdit[];
107
84
  };
108
85
  readonly token: {
109
- invalidStream: (filepath: Filepath) => readonly SyntaxToken[];
110
- flatStream: (filepath: Filepath) => readonly SyntaxToken[];
86
+ invalidStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
87
+ flatStream: (filepath: Filepath) => readonly import('..').SyntaxToken[];
111
88
  };
112
89
  readonly parse: {
113
90
  source: (filepath: Filepath) => string;
114
91
  ast: (filepath?: Filepath) => Readonly<import('../core/types/nodes').ProgramNode>;
115
92
  errors: (filepath?: Filepath) => readonly Readonly<import('..').CompileError>[];
116
- warnings: (filepath?: Filepath) => readonly Readonly<import('../core/types').CompileWarning>[];
117
- tokens: (filepath?: Filepath) => readonly Readonly<SyntaxToken>[];
93
+ warnings: (filepath?: Filepath) => readonly Readonly<import('..').CompileWarning>[];
94
+ tokens: (filepath?: Filepath) => readonly Readonly<import('..').SyntaxToken>[];
118
95
  rawDb: (filepath?: Filepath) => Readonly<import('..').Database> | undefined;
119
96
  publicSymbolTable: (filepath?: Filepath) => readonly Readonly<import('../core/types/symbol').NodeSymbol>[] | undefined;
120
97
  };
121
98
  readonly container: {
122
99
  stack: (filepath: Filepath, offset: number) => readonly Readonly<SyntaxNode>[];
123
100
  token: (filepath: Filepath, offset: number) => {
124
- token: SyntaxToken;
101
+ token: import('..').SyntaxToken;
125
102
  index: number;
126
103
  } | {
127
104
  token: undefined;
@@ -134,6 +111,7 @@ export default class Compiler {
134
111
  initMonacoServices(options?: {
135
112
  autocompletion?: {
136
113
  triggerCharacters?: string[];
114
+ fileListDepth?: number;
137
115
  };
138
116
  }): {
139
117
  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,6 @@
1
1
  export { renameTable } from './renameTable';
2
- export { renameElement } from './renameElement';
3
2
  export { updateElementSetting, updateElementSettingEdit } from './updateElementSetting';
4
3
  export { syncDiagramView, findDiagramViewBlocks, type DiagramViewSyncOperation, type DiagramViewBlock, } from './syncDiagramView';
5
4
  export { syncDep, generateDepBlock, type DepSyncOperation, type DepSyncEdge, type DepEndpointRef, } from './syncDep';
6
5
  export { applyTextEdits, type TextEdit } from './applyTextEdits';
7
- export type { ElementIdentifier, SchemaIdentifier, TableIdentifier, ColumnIdentifier, EnumIdentifier, EndpointRef, RefIdentifier, DepIdentifier, NoteIdentifier, TableGroupIdentifier, ArchElementIdentifier, ArchLinkIdentifier, } from './types';
6
+ 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 | ArchElementIdentifier | ArchLinkIdentifier) & {
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
- }
@@ -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 dbmlModules: GlobalModule[];
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 { MetadataValues } from '../../types/schemaJson';
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<MetadataValues>;
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, FilepathId, SettingName } from '../../types';
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
- * Specs for builtin metadata (table's note, tablegroup's color, .etc) for different element types. Does 2 things:
9
- * - `validate`: Validating if the metadata value is syntactically correct
10
- * - `assign`: Write the metadata value to the element builtin props (e.g. write `table.note` instead of `table.metadata`)
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
- interface MetadataField<T extends MetadataTarget> {
13
- /** Check if the metadata value is syntactically correct */
14
- isValidBuiltinFieldValue(node?: SyntaxNode): boolean;
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 metadata value to the element builtin props (e.g. write to `table.note`) */
17
- assignBuiltinField(element: Partial<T>, value: string, token: TokenPosition): void;
18
- }
19
- export type MetadataFieldRegistry<T extends MetadataTarget, K extends SettingName = SettingName> = Record<K, MetadataField<T>>;
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 { SettingName, Filepath, NoteSymbol } from '../../types';
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;
@@ -6,7 +6,6 @@ export default class Binder {
6
6
  private compiler;
7
7
  constructor(ast: ProgramNode, compiler: Compiler);
8
8
  resolve(): Report<void>;
9
- private isArchFile;
10
9
  private checkDuplicateRefs;
11
10
  private checkStandaloneRefs;
12
11
  private checkInlineRefs;
@@ -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 { Column, Table } from '../../types/schemaJson';
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 { SettingName, Filepath, TableGroupSymbol } from '../../types';
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
- private readonly options;
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, ListExpressionNode } from '../../types/nodes';
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, ExpressionNode, ListExpressionNode } from '../../types/nodes';
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, ListExpressionNode } from '../../types/nodes';
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
- private readonly options;
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,
@@ -126,23 +130,7 @@ export declare enum CompileErrorCode {
126
130
  TABLE_REAPPEAR_IN_TABLEGROUP = 5009,
127
131
  INVALID_METADATA_TARGET_KIND = 5010,
128
132
  INVALID_METADATA_FIELD = 5011,
129
- DUPLICATE_METADATA_FIELD = 5012,
130
- UNKNOWN_KIND = 6000,
131
- MISSING_NAME = 6001,
132
- RESERVED_KIND = 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_KIND_MISMATCH = 6010,
141
- UNKNOWN_TYPE = 6011,
142
- UNKNOWN_ICON = 6012,
143
- BAD_IMAGE = 6013,
144
- DUPLICATE_LINK = 6014,
145
- NESTED_ENDPOINTS = 6015
133
+ DUPLICATE_METADATA_FIELD = 5012
146
134
  }
147
135
  export interface RelatedLocation {
148
136
  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 path;
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
  }
@@ -2,7 +2,13 @@ import { NONE_COLOR } from '../../../constants';
2
2
  import { Filepath } from '../filepath';
3
3
  import { Position } from '../position';
4
4
  import { RelationshipOp, RelationCardinality } from '../relation';
5
- export type CustomMetadata = Record<string, string>;
5
+ export type CustomMetadataValueType = 'string' | 'number' | 'bool' | 'color';
6
+ export interface CustomMetadataValue {
7
+ value: string | number | boolean;
8
+ type: CustomMetadataValueType;
9
+ token: TokenPosition;
10
+ }
11
+ export type CustomMetadata = Record<string, CustomMetadataValue>;
6
12
  export type Color = `#${string}` | typeof NONE_COLOR;
7
13
  export declare enum AliasKind {
8
14
  Table = "table"
@@ -27,9 +33,6 @@ export interface DatabaseExternals {
27
33
  tableGroups: ElementRef[];
28
34
  tablePartials: ElementRef[];
29
35
  notes: ElementRef[];
30
- nodes?: ElementRef[];
31
- groups?: ElementRef[];
32
- kinds?: ElementRef[];
33
36
  }
34
37
  /**
35
38
  * FilterConfig is a tri-state filter:
@@ -73,57 +76,6 @@ export interface Database {
73
76
  externals: DatabaseExternals;
74
77
  diagramViews: DiagramView[];
75
78
  token?: TokenPosition;
76
- nodes?: Node[];
77
- groups?: Group[];
78
- links?: Link[];
79
- kinds?: Kind[];
80
- frontMatter?: Record<string, string>;
81
- diagramType?: 'arch';
82
- }
83
- export type ArchSettingValue = string | number | boolean;
84
- export type ArchSettings = Record<string, ArchSettingValue>;
85
- export type KindCategory = 'compute' | 'data' | 'net' | 'edge' | 'people' | 'ops' | 'custom';
86
- export interface Node {
87
- name: string;
88
- alias: string | null;
89
- kind: string;
90
- type: string | null;
91
- image: string | null;
92
- settings: ArchSettings;
93
- note: {
94
- value: string;
95
- token: TokenPosition;
96
- } | null;
97
- token: TokenPosition;
98
- }
99
- export interface Group {
100
- name: string;
101
- alias: string | null;
102
- children: string[];
103
- settings: ArchSettings;
104
- note: {
105
- value: string;
106
- token: TokenPosition;
107
- } | null;
108
- token: TokenPosition;
109
- }
110
- export type LinkOp = '>' | '<' | '<>' | '-';
111
- export interface Link {
112
- from: string;
113
- to: string;
114
- op: LinkOp;
115
- settings: ArchSettings;
116
- token: TokenPosition;
117
- }
118
- export interface Kind {
119
- name: string;
120
- icon: string;
121
- glyph: string[] | null;
122
- image: string | null;
123
- category: KindCategory;
124
- color: string | null;
125
- builtin: boolean;
126
- token: TokenPosition | null;
127
79
  }
128
80
  export interface MasterDatabase {
129
81
  files: Record<string, Database>;
@@ -333,10 +285,6 @@ export interface TableRecord {
333
285
  example?: boolean;
334
286
  token: TokenPosition;
335
287
  }
336
- export type MetadataValues = Record<string, {
337
- value: string;
338
- token: TokenPosition;
339
- }>;
340
288
  export type Project = Record<string, never> | {
341
289
  name: string | null;
342
290
  tables: Table[];
@@ -351,4 +299,4 @@ export type Project = Record<string, never> | {
351
299
  token: TokenPosition;
352
300
  [index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note' | 'tablePartials' | 'records'>]: string;
353
301
  };
354
- export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | InlineDep | Ref | RefEndpoint | Dep | DepEdge | DepEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue | MetadataValues | Node | Group | Link | Kind | ArchSettings;
302
+ export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | InlineDep | Ref | RefEndpoint | Dep | DepEdge | DepEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue | CustomMetadata;
@@ -12,8 +12,7 @@ export declare enum MetadataKind {
12
12
  Indexes = "indexes",
13
13
  Records = "records",
14
14
  Project = "project",
15
- MetadataElement = "metadata element",
16
- Link = "link"
15
+ MetadataElement = "metadata element"
17
16
  }
18
17
  declare const __nodeMetadataBrand: unique symbol;
19
18
  export type NodeMetadataId = number & {
@@ -116,17 +115,6 @@ export declare class MetadataElementMetadata extends NodeMetadata {
116
115
  target(compiler: Compiler): NodeSymbol | undefined;
117
116
  owners(compiler: Compiler): NodeSymbol[];
118
117
  }
119
- export declare class LinkMetadata extends NodeMetadata {
120
- declaration: ElementDeclarationNode | AttributeNode;
121
- readonly kind = MetadataKind.Link;
122
- constructor(declaration: ElementDeclarationNode | AttributeNode);
123
- op(): string | undefined;
124
- endpoints(compiler: Compiler): [NodeSymbol | undefined, NodeSymbol | undefined];
125
- owners(compiler: Compiler): NodeSymbol[];
126
- }
127
- export declare class ArchMetadataElementMetadata extends MetadataElementMetadata {
128
- target(compiler: Compiler): NodeSymbol | undefined;
129
- }
130
118
  export declare class ProjectMetadata extends NodeMetadata {
131
119
  readonly kind = MetadataKind.Project;
132
120
  constructor(declaration: SyntaxNode);