@dbml/parse 7.0.0-alpha.1 → 7.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.
Files changed (156) hide show
  1. package/dist/dbml-parse.js +19 -16
  2. package/dist/dbml-parse.mjs +5313 -5092
  3. package/dist/src/compiler/index.d.ts +21 -21
  4. package/dist/src/compiler/queries/container/element.d.ts +1 -1
  5. package/dist/src/compiler/queries/container/index.d.ts +5 -5
  6. package/dist/src/compiler/queries/container/scope.d.ts +1 -1
  7. package/dist/src/compiler/queries/container/stack.d.ts +1 -1
  8. package/dist/src/compiler/queries/container/token.d.ts +1 -1
  9. package/dist/src/compiler/queries/{parse.d.ts → legacy/parse.d.ts} +6 -6
  10. package/dist/src/compiler/queries/{symbol.d.ts → legacy/symbol.d.ts} +4 -4
  11. package/dist/src/compiler/queries/{token.d.ts → legacy/token.d.ts} +2 -2
  12. package/dist/src/compiler/queries/transform/index.d.ts +4 -4
  13. package/dist/src/compiler/queries/transform/utils.d.ts +2 -2
  14. package/dist/src/constants.d.ts +4 -0
  15. package/dist/src/core/analyzer/analyzer.d.ts +3 -3
  16. package/dist/src/core/analyzer/binder/binder.d.ts +3 -3
  17. package/dist/src/core/analyzer/binder/elementBinder/checks.d.ts +2 -2
  18. package/dist/src/core/analyzer/binder/elementBinder/custom.d.ts +4 -4
  19. package/dist/src/core/analyzer/binder/elementBinder/diagramView.d.ts +4 -4
  20. package/dist/src/core/analyzer/binder/elementBinder/enum.d.ts +4 -4
  21. package/dist/src/core/analyzer/binder/elementBinder/indexes.d.ts +4 -4
  22. package/dist/src/core/analyzer/binder/elementBinder/note.d.ts +4 -4
  23. package/dist/src/core/analyzer/binder/elementBinder/project.d.ts +4 -4
  24. package/dist/src/core/analyzer/binder/elementBinder/records.d.ts +4 -4
  25. package/dist/src/core/analyzer/binder/elementBinder/ref.d.ts +4 -4
  26. package/dist/src/core/analyzer/binder/elementBinder/table.d.ts +4 -4
  27. package/dist/src/core/analyzer/binder/elementBinder/tableGroup.d.ts +4 -4
  28. package/dist/src/core/analyzer/binder/elementBinder/tablePartial.d.ts +4 -4
  29. package/dist/src/core/analyzer/binder/types.d.ts +1 -1
  30. package/dist/src/core/analyzer/binder/utils.d.ts +5 -5
  31. package/dist/src/core/analyzer/utils.d.ts +15 -18
  32. package/dist/src/core/analyzer/validator/elementValidators/checks.d.ts +5 -5
  33. package/dist/src/core/analyzer/validator/elementValidators/custom.d.ts +5 -5
  34. package/dist/src/core/analyzer/validator/elementValidators/diagramView.d.ts +5 -5
  35. package/dist/src/core/analyzer/validator/elementValidators/enum.d.ts +5 -5
  36. package/dist/src/core/analyzer/validator/elementValidators/indexes.d.ts +5 -5
  37. package/dist/src/core/analyzer/validator/elementValidators/note.d.ts +5 -5
  38. package/dist/src/core/analyzer/validator/elementValidators/project.d.ts +5 -5
  39. package/dist/src/core/analyzer/validator/elementValidators/records.d.ts +5 -5
  40. package/dist/src/core/analyzer/validator/elementValidators/ref.d.ts +5 -5
  41. package/dist/src/core/analyzer/validator/elementValidators/table.d.ts +5 -5
  42. package/dist/src/core/analyzer/validator/elementValidators/tableGroup.d.ts +5 -5
  43. package/dist/src/core/analyzer/validator/elementValidators/tablePartial.d.ts +5 -5
  44. package/dist/src/core/analyzer/validator/types.d.ts +1 -1
  45. package/dist/src/core/analyzer/validator/utils.d.ts +9 -10
  46. package/dist/src/core/analyzer/validator/validator.d.ts +3 -3
  47. package/dist/src/core/interpreter/elementInterpreter/diagramView.d.ts +2 -2
  48. package/dist/src/core/interpreter/elementInterpreter/enum.d.ts +2 -2
  49. package/dist/src/core/interpreter/elementInterpreter/project.d.ts +2 -2
  50. package/dist/src/core/interpreter/elementInterpreter/ref.d.ts +2 -2
  51. package/dist/src/core/interpreter/elementInterpreter/sticky_note.d.ts +2 -2
  52. package/dist/src/core/interpreter/elementInterpreter/table.d.ts +2 -2
  53. package/dist/src/core/interpreter/elementInterpreter/tableGroup.d.ts +2 -2
  54. package/dist/src/core/interpreter/elementInterpreter/tablePartial.d.ts +2 -2
  55. package/dist/src/core/interpreter/interpreter.d.ts +4 -3
  56. package/dist/src/core/interpreter/records/index.d.ts +2 -2
  57. package/dist/src/core/interpreter/records/utils/constraints/fk.d.ts +1 -1
  58. package/dist/src/core/interpreter/records/utils/constraints/helper.d.ts +3 -2
  59. package/dist/src/core/interpreter/records/utils/constraints/pk.d.ts +1 -1
  60. package/dist/src/core/interpreter/records/utils/constraints/unique.d.ts +1 -1
  61. package/dist/src/core/interpreter/records/utils/data/sqlTypes.d.ts +1 -1
  62. package/dist/src/core/interpreter/records/utils/data/values.d.ts +2 -2
  63. package/dist/src/core/interpreter/types.d.ts +10 -228
  64. package/dist/src/core/interpreter/utils.d.ts +6 -5
  65. package/dist/src/core/lexer/lexer.d.ts +5 -3
  66. package/dist/src/core/lexer/utils.d.ts +1 -1
  67. package/dist/src/core/parser/contextStack.d.ts +1 -1
  68. package/dist/src/core/parser/factory.d.ts +5 -3
  69. package/dist/src/core/parser/parser.d.ts +5 -4
  70. package/dist/src/core/parser/utils.d.ts +6 -7
  71. package/dist/src/core/{errors.d.ts → types/errors.d.ts} +5 -2
  72. package/dist/src/core/types/filepath.d.ts +26 -0
  73. package/dist/src/core/types/index.d.ts +7 -0
  74. package/dist/src/core/types/internable.d.ts +20 -0
  75. package/dist/src/core/types/module.d.ts +9 -0
  76. package/dist/src/core/{parser → types}/nodes.d.ts +49 -38
  77. package/dist/src/core/types/report.d.ts +18 -0
  78. package/dist/src/core/types/schemaJson.d.ts +243 -0
  79. package/dist/src/core/{analyzer → types}/symbol/factory.d.ts +1 -1
  80. package/dist/src/core/types/symbol/index.d.ts +5 -0
  81. package/dist/src/core/{analyzer → types}/symbol/symbolIndex.d.ts +3 -4
  82. package/dist/src/core/types/symbol/symbols.d.ts +122 -0
  83. package/dist/src/core/{analyzer → types}/symbol/utils.d.ts +1 -1
  84. package/dist/src/core/{lexer → types}/tokens.d.ts +5 -3
  85. package/dist/src/core/utils/array.d.ts +1 -0
  86. package/dist/src/core/utils/chars.d.ts +4 -0
  87. package/dist/src/core/utils/enum.d.ts +1 -0
  88. package/dist/src/core/utils/numbers.d.ts +3 -0
  89. package/dist/src/core/utils/span.d.ts +6 -0
  90. package/dist/src/index.d.ts +9 -9
  91. package/dist/src/services/definition/provider.d.ts +1 -1
  92. package/dist/src/services/index.d.ts +3 -3
  93. package/dist/src/services/monarch.d.ts +1 -1
  94. package/dist/src/services/references/provider.d.ts +1 -1
  95. package/dist/src/services/suggestions/provider.d.ts +1 -1
  96. package/dist/src/services/suggestions/recordRowSnippet.d.ts +1 -1
  97. package/dist/src/services/suggestions/utils.d.ts +5 -5
  98. package/dist/src/services/types.d.ts +1 -1
  99. package/dist/src/services/utils.d.ts +1 -1
  100. package/package.json +2 -2
  101. package/dist/__tests__/examples/binder/binder.test.d.ts +0 -1
  102. package/dist/__tests__/examples/binder/records.test.d.ts +0 -1
  103. package/dist/__tests__/examples/compiler/applyTextEdits.test.d.ts +0 -1
  104. package/dist/__tests__/examples/compiler/identifierUtils.test.d.ts +0 -1
  105. package/dist/__tests__/examples/compiler/renameTable.test.d.ts +0 -1
  106. package/dist/__tests__/examples/compiler/splitQualifiedIdentifier.test.d.ts +0 -1
  107. package/dist/__tests__/examples/compiler/stringUtils.test.d.ts +0 -1
  108. package/dist/__tests__/examples/compiler/syncDiagramView.test.d.ts +0 -1
  109. package/dist/__tests__/examples/interpreter/interpreter.test.d.ts +0 -1
  110. package/dist/__tests__/examples/interpreter/record/data.test.d.ts +0 -1
  111. package/dist/__tests__/examples/interpreter/record/fk.test.d.ts +0 -1
  112. package/dist/__tests__/examples/interpreter/record/increment.test.d.ts +0 -1
  113. package/dist/__tests__/examples/interpreter/record/multi_records.test.d.ts +0 -1
  114. package/dist/__tests__/examples/interpreter/record/pk.test.d.ts +0 -1
  115. package/dist/__tests__/examples/interpreter/record/table_partial.test.d.ts +0 -1
  116. package/dist/__tests__/examples/interpreter/record/type_compatibility.test.d.ts +0 -1
  117. package/dist/__tests__/examples/interpreter/record/unique.test.d.ts +0 -1
  118. package/dist/__tests__/examples/lexer/lexer.test.d.ts +0 -1
  119. package/dist/__tests__/examples/lexer/scientific-notation.test.d.ts +0 -1
  120. package/dist/__tests__/examples/parser/parser.test.d.ts +0 -1
  121. package/dist/__tests__/examples/services/definition/general.test.d.ts +0 -1
  122. package/dist/__tests__/examples/services/definition/records.test.d.ts +0 -1
  123. package/dist/__tests__/examples/services/references/general.test.d.ts +0 -1
  124. package/dist/__tests__/examples/services/references/records.test.d.ts +0 -1
  125. package/dist/__tests__/examples/services/service_utils.test.d.ts +0 -1
  126. package/dist/__tests__/examples/services/suggestions/general.test.d.ts +0 -1
  127. package/dist/__tests__/examples/services/suggestions/suggestions_diagramview.test.d.ts +0 -1
  128. package/dist/__tests__/examples/services/suggestions/suggestions_records.test.d.ts +0 -1
  129. package/dist/__tests__/examples/validator/records.test.d.ts +0 -1
  130. package/dist/__tests__/examples/validator/validator.test.d.ts +0 -1
  131. package/dist/__tests__/examples/wildcard/wildcard.test.d.ts +0 -1
  132. package/dist/__tests__/fuzz/interpreter.test.d.ts +0 -1
  133. package/dist/__tests__/fuzz/parser.test.d.ts +0 -1
  134. package/dist/__tests__/fuzz/services.test.d.ts +0 -1
  135. package/dist/__tests__/properties/lexer.test.d.ts +0 -1
  136. package/dist/__tests__/properties/parser.test.d.ts +0 -1
  137. package/dist/__tests__/snapshots/binder/binder.test.d.ts +0 -1
  138. package/dist/__tests__/snapshots/interpreter/interpreter.test.d.ts +0 -1
  139. package/dist/__tests__/snapshots/lexer/lexer.test.d.ts +0 -1
  140. package/dist/__tests__/snapshots/nan/nan.test.d.ts +0 -1
  141. package/dist/__tests__/snapshots/parser/parser.test.d.ts +0 -1
  142. package/dist/__tests__/snapshots/validator/validator.test.d.ts +0 -1
  143. package/dist/__tests__/utils/arbitraries/grammars.d.ts +0 -100
  144. package/dist/__tests__/utils/arbitraries/index.d.ts +0 -3
  145. package/dist/__tests__/utils/arbitraries/tokens.d.ts +0 -20
  146. package/dist/__tests__/utils/arbitraries/utils.d.ts +0 -59
  147. package/dist/__tests__/utils/compiler.d.ts +0 -13
  148. package/dist/__tests__/utils/index.d.ts +0 -3
  149. package/dist/__tests__/utils/mocks.d.ts +0 -17
  150. package/dist/__tests__/utils/testHelpers.d.ts +0 -16
  151. package/dist/src/core/analyzer/symbol/symbols.d.ts +0 -132
  152. package/dist/src/core/option.d.ts +0 -18
  153. package/dist/src/core/report.d.ts +0 -12
  154. package/dist/src/core/utils.d.ts +0 -13
  155. /package/dist/src/core/{types.d.ts → types/position.d.ts} +0 -0
  156. /package/dist/src/core/{analyzer → types}/symbol/symbolTable.d.ts +0 -0
@@ -1,9 +1,9 @@
1
- import { SyntaxToken } from '../../../lexer/tokens';
2
- import { default as SymbolFactory } from '../../symbol/factory';
3
- import { CompileError, CompileWarning } from '../../../errors';
4
- import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../../parser/nodes';
5
1
  import { ElementValidator } from '../types';
6
- import { default as SymbolTable } from '../../symbol/symbolTable';
2
+ import { CompileError, CompileWarning } from '../../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../../types/nodes';
4
+ import { default as SymbolFactory } from '../../../types/symbol/factory';
5
+ import { default as SymbolTable } from '../../../types/symbol/symbolTable';
6
+ import { SyntaxToken } from '../../../types/tokens';
7
7
  export default class RefValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
@@ -1,9 +1,9 @@
1
- import { default as SymbolFactory } from '../../symbol/factory';
2
- import { CompileError, CompileWarning } from '../../../errors';
3
- import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode } from '../../../parser/nodes';
4
1
  import { ElementValidator } from '../types';
5
- import { SyntaxToken } from '../../../lexer/tokens';
6
- import { default as SymbolTable } from '../../symbol/symbolTable';
2
+ import { CompileError, CompileWarning } from '../../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode } from '../../../types/nodes';
4
+ import { default as SymbolFactory } from '../../../types/symbol/factory';
5
+ import { default as SymbolTable } from '../../../types/symbol/symbolTable';
6
+ import { SyntaxToken } from '../../../types/tokens';
7
7
  export default class TableValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private symbolFactory;
@@ -1,9 +1,9 @@
1
- import { CompileError, CompileWarning } from '../../../errors';
2
1
  import { ElementValidator } from '../types';
3
- import { default as SymbolTable } from '../../symbol/symbolTable';
4
- import { SyntaxToken } from '../../../lexer/tokens';
5
- import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../../parser/nodes';
6
- import { default as SymbolFactory } from '../../symbol/factory';
2
+ import { CompileError, CompileWarning } from '../../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../../types/nodes';
4
+ import { default as SymbolFactory } from '../../../types/symbol/factory';
5
+ import { default as SymbolTable } from '../../../types/symbol/symbolTable';
6
+ import { SyntaxToken } from '../../../types/tokens';
7
7
  export default class TableGroupValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
@@ -1,9 +1,9 @@
1
- import { default as SymbolFactory } from '../../symbol/factory';
2
- import { CompileError, CompileWarning } from '../../../errors';
3
- import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode } from '../../../parser/nodes';
4
1
  import { ElementValidator } from '../types';
5
- import { SyntaxToken } from '../../../lexer/tokens';
6
- import { default as SymbolTable } from '../../symbol/symbolTable';
2
+ import { CompileError, CompileWarning } from '../../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode } from '../../../types/nodes';
4
+ import { default as SymbolFactory } from '../../../types/symbol/factory';
5
+ import { default as SymbolTable } from '../../../types/symbol/symbolTable';
6
+ import { SyntaxToken } from '../../../types/tokens';
7
7
  export default class TablePartialValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private symbolFactory;
@@ -1,4 +1,4 @@
1
- import { CompileError, CompileWarning } from '../../errors';
1
+ import { CompileError, CompileWarning } from '../../types/errors';
2
2
  export interface ElementValidator {
3
3
  validate(): {
4
4
  errors: CompileError[];
@@ -1,23 +1,23 @@
1
- import { SyntaxToken, SyntaxTokenKind } from '../../lexer/tokens';
2
- import { AttributeNode, BlockExpressionNode, ElementDeclarationNode, ListExpressionNode, LiteralNode, PrefixExpressionNode, PrimaryExpressionNode, SyntaxNode, TupleExpressionNode, VariableNode } from '../../parser/nodes';
1
+ import { AttributeNode, BlockExpressionNode, ElementDeclarationNode, ListExpressionNode, LiteralNode, PrefixExpressionNode, PrimaryExpressionNode, SyntaxNode, TupleExpressionNode, VariableNode } from '../../types/nodes';
2
+ import { default as Report } from '../../types/report';
3
+ import { default as SymbolFactory } from '../../types/symbol/factory';
4
+ import { default as SymbolTable } from '../../types/symbol/symbolTable';
5
+ import { SyntaxToken, SyntaxTokenKind } from '../../types/tokens';
6
+ import { default as ChecksValidator } from './elementValidators/checks';
3
7
  import { default as CustomValidator } from './elementValidators/custom';
8
+ import { default as DiagramViewValidator } from './elementValidators/diagramView';
4
9
  import { default as EnumValidator } from './elementValidators/enum';
5
10
  import { default as IndexesValidator } from './elementValidators/indexes';
6
11
  import { default as NoteValidator } from './elementValidators/note';
7
12
  import { default as ProjectValidator } from './elementValidators/project';
13
+ import { default as RecordsValidator } from './elementValidators/records';
8
14
  import { default as RefValidator } from './elementValidators/ref';
9
15
  import { default as TableValidator } from './elementValidators/table';
10
16
  import { default as TableGroupValidator } from './elementValidators/tableGroup';
11
- import { default as SymbolTable } from '../symbol/symbolTable';
12
- import { default as SymbolFactory } from '../symbol/factory';
13
- import { default as Report } from '../../report';
14
17
  import { default as TablePartialValidator } from './elementValidators/tablePartial';
15
- import { default as ChecksValidator } from './elementValidators/checks';
16
- import { default as RecordsValidator } from './elementValidators/records';
17
- import { default as DiagramViewValidator } from './elementValidators/diagramView';
18
18
  export declare function pickValidator(element: ElementDeclarationNode & {
19
19
  type: SyntaxToken;
20
- }): typeof CustomValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator | typeof TablePartialValidator | typeof ChecksValidator | typeof RecordsValidator | typeof DiagramViewValidator;
20
+ }): typeof ChecksValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator | typeof TablePartialValidator | typeof RecordsValidator | typeof DiagramViewValidator | typeof CustomValidator;
21
21
  export declare function isValidName(nameNode: SyntaxNode): boolean;
22
22
  export declare function isValidAlias(aliasNode: SyntaxNode): aliasNode is PrimaryExpressionNode & {
23
23
  expression: VariableNode;
@@ -41,7 +41,6 @@ export declare function isValidPartialInjection(node?: SyntaxNode): node is Pref
41
41
  export declare function registerSchemaStack(variables: string[], globalSchema: SymbolTable, symbolFactory: SymbolFactory): SymbolTable;
42
42
  export declare function isRelationshipOp(op?: string): boolean;
43
43
  export declare function isValidColor(value?: SyntaxNode): boolean;
44
- export declare function isVoid(value?: SyntaxNode): boolean;
45
44
  export declare function isValidDefaultValue(value?: SyntaxNode): boolean;
46
45
  export type SignedNumberExpression = (PrimaryExpressionNode & {
47
46
  expression: LiteralNode & {
@@ -1,6 +1,6 @@
1
- import { default as Report } from '../../report';
2
- import { ProgramNode } from '../../parser/nodes';
3
- import { default as SymbolFactory } from '../symbol/factory';
1
+ import { ProgramNode } from '../../types/nodes';
2
+ import { default as Report } from '../../types/report';
3
+ import { default as SymbolFactory } from '../../types/symbol/factory';
4
4
  export default class Validator {
5
5
  private ast;
6
6
  private publicSchemaSymbol;
@@ -1,6 +1,6 @@
1
- import { CompileError } from '../../errors';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
3
1
  import { ElementInterpreter, InterpreterDatabase } from '../types';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
4
  export declare class DiagramViewInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
6
6
  private env;
@@ -1,5 +1,5 @@
1
- import { CompileError } from '../../errors';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
1
+ import { CompileError } from '../../types/errors';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
3
3
  import { ElementInterpreter, InterpreterDatabase } from '../types';
4
4
  export declare class EnumInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
@@ -1,5 +1,5 @@
1
- import { CompileError } from '../../errors';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
1
+ import { CompileError } from '../../types/errors';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
3
3
  import { ElementInterpreter, InterpreterDatabase } from '../types';
4
4
  export declare class ProjectInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
@@ -1,5 +1,5 @@
1
- import { CompileError } from '../../errors';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
1
+ import { CompileError } from '../../types/errors';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
3
3
  import { ElementInterpreter, InterpreterDatabase } from '../types';
4
4
  export declare class RefInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
@@ -1,6 +1,6 @@
1
+ import { CompileError } from '../../types/errors';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
1
3
  import { ElementInterpreter, InterpreterDatabase } from '../types';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
3
- import { CompileError } from '../../errors';
4
4
  export declare class StickyNoteInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
6
6
  private env;
@@ -1,6 +1,6 @@
1
+ import { CompileError } from '../../types/errors';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
1
3
  import { ElementInterpreter, InterpreterDatabase } from '../types';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
3
- import { CompileError } from '../../errors';
4
4
  export declare class TableInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
6
6
  private env;
@@ -1,5 +1,5 @@
1
- import { CompileError } from '../../errors';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
1
+ import { CompileError } from '../../types/errors';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
3
3
  import { ElementInterpreter, InterpreterDatabase } from '../types';
4
4
  export declare class TableGroupInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
@@ -1,6 +1,6 @@
1
+ import { CompileError } from '../../types/errors';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
1
3
  import { ElementInterpreter, InterpreterDatabase } from '../types';
2
- import { ElementDeclarationNode } from '../../parser/nodes';
3
- import { CompileError } from '../../errors';
4
4
  export declare class TablePartialInterpreter implements ElementInterpreter {
5
5
  private declarationNode;
6
6
  private env;
@@ -1,6 +1,7 @@
1
- import { ProgramNode } from '../parser/nodes';
2
- import { Database, InterpreterDatabase } from './types';
3
- import { default as Report } from '../report';
1
+ import { ProgramNode } from '../types/nodes';
2
+ import { default as Report } from '../types/report';
3
+ import { Database } from '../types/schemaJson';
4
+ import { InterpreterDatabase } from './types';
4
5
  export default class Interpreter {
5
6
  ast: ProgramNode;
6
7
  env: InterpreterDatabase;
@@ -1,5 +1,5 @@
1
- import { ElementDeclarationNode } from '../../parser/nodes';
2
- import { default as Report } from '../../report';
1
+ import { ElementDeclarationNode } from '../../types/nodes';
2
+ import { default as Report } from '../../types/report';
3
3
  import { InterpreterDatabase } from '../types';
4
4
  export declare class RecordsInterpreter {
5
5
  private env;
@@ -1,3 +1,3 @@
1
- import { CompileError } from '../../../../errors';
2
1
  import { InterpreterDatabase } from '../../../types';
2
+ import { CompileError } from '../../../../types/errors';
3
3
  export declare function validateForeignKeys(env: InterpreterDatabase): CompileError[];
@@ -1,5 +1,6 @@
1
- import { RecordValue, Column, TableRecordRow } from '../../../types';
2
- import { CompileError } from '../../../../errors';
1
+ import { TableRecordRow } from '../../../types';
2
+ import { CompileError } from '../../../../types/errors';
3
+ import { Column, RecordValue } from '../../../../types/schemaJson';
3
4
  export declare function extractKeyValueWithDefault(row: Record<string, RecordValue>, columnNames: string[], columns?: (Column | undefined)[]): string;
4
5
  export declare function hasNullWithoutDefaultInKey(row: Record<string, RecordValue>, columnNames: string[], columns?: (Column | undefined)[]): boolean;
5
6
  export declare function isAutoIncrementColumn(column: Column): boolean;
@@ -1,3 +1,3 @@
1
- import { CompileError } from '../../../../errors';
2
1
  import { InterpreterDatabase } from '../../../types';
2
+ import { CompileError } from '../../../../types/errors';
3
3
  export declare function validatePrimaryKey(env: InterpreterDatabase): CompileError[];
@@ -1,3 +1,3 @@
1
- import { CompileError } from '../../../../errors';
2
1
  import { InterpreterDatabase } from '../../../types';
2
+ import { CompileError } from '../../../../types/errors';
3
3
  export declare function validateUnique(env: InterpreterDatabase): CompileError[];
@@ -1,4 +1,4 @@
1
- import { ColumnSymbol } from '../../../../analyzer/symbol/symbols';
1
+ import { ColumnSymbol } from '../../../../types/symbol/symbols';
2
2
  export type SqlDialect = 'mysql' | 'postgres' | 'mssql' | 'oracle' | 'snowflake';
3
3
  export declare function normalizeTypeName(type: string): string;
4
4
  export declare function isIntegerType(type: string, dialect?: SqlDialect): boolean;
@@ -1,5 +1,5 @@
1
- import { FunctionExpressionNode, SyntaxNode } from '../../../../parser/nodes';
2
- export { extractNumericLiteral } from '../../../../analyzer/utils';
1
+ import { FunctionExpressionNode, SyntaxNode } from '../../../../types/nodes';
2
+ export { extractNumericLiteral, } from '../../../../analyzer/utils';
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;
@@ -1,48 +1,18 @@
1
- import { ElementDeclarationNode, FunctionApplicationNode, SyntaxNode } from '../parser/nodes';
2
- import { Position } from '../types';
3
- import { CompileError } from '../errors';
4
- export interface TokenPosition {
5
- start: Position;
6
- end: Position;
7
- }
1
+ import { CompileError } from '../types/errors';
2
+ import { ElementDeclarationNode, FunctionApplicationNode, SyntaxNode } from '../types/nodes';
3
+ import { Alias, DiagramView, Enum, FilterConfig, Note, Project, RecordValueType, Ref, Table, TableGroup, TablePartial } from '../types/schemaJson';
4
+ export type { DiagramView, FilterConfig, };
8
5
  export interface ElementInterpreter {
9
6
  interpret(): CompileError[];
10
7
  }
11
- /**
12
- * FilterConfig is a tri-state filter:
13
- * - [] (empty array) = show all
14
- * - [...] (array with items) = show only these specific items
15
- * - null = hide all
16
- */
17
- export interface FilterConfig {
18
- tables: Array<{
19
- name: string;
20
- schemaName: string;
21
- }> | null;
22
- stickyNotes: Array<{
23
- name: string;
24
- }> | null;
25
- tableGroups: Array<{
26
- name: string;
27
- }> | null;
28
- schemas: Array<{
29
- name: string;
30
- }> | null;
31
- }
32
- export interface DiagramView {
33
- name: string;
34
- schemaName: string | null;
35
- visibleEntities: FilterConfig;
36
- token: TokenPosition;
37
- }
38
8
  export interface InterpreterDatabase {
39
9
  schema: [];
40
10
  tables: Map<ElementDeclarationNode, Table>;
41
11
  notes: Map<ElementDeclarationNode, Note>;
42
12
  refIds: {
43
- [refid: string]: ElementDeclarationNode;
13
+ [refid: string]: SyntaxNode;
44
14
  };
45
- ref: Map<ElementDeclarationNode, Ref>;
15
+ ref: Map<SyntaxNode, Ref>;
46
16
  enums: Map<ElementDeclarationNode, Enum>;
47
17
  tableOwnerGroup: {
48
18
  [tableid: string]: ElementDeclarationNode;
@@ -51,7 +21,10 @@ export interface InterpreterDatabase {
51
21
  tablePartials: Map<ElementDeclarationNode, TablePartial>;
52
22
  aliases: Alias[];
53
23
  project: Map<ElementDeclarationNode, Project>;
54
- records: Map<Table, TableRecordRow[]>;
24
+ records: Map<Table, {
25
+ element: ElementDeclarationNode;
26
+ rows: TableRecordRow[];
27
+ }>;
55
28
  recordsElements: ElementDeclarationNode[];
56
29
  cachedMergedTables: Map<Table, Table>;
57
30
  source: string;
@@ -59,11 +32,6 @@ export interface InterpreterDatabase {
59
32
  diagramViewWildcards: Map<DiagramView, Set<string>>;
60
33
  diagramViewExplicitlySet: Map<DiagramView, Set<string>>;
61
34
  }
62
- export type RecordValueType = 'string' | 'bool' | 'integer' | 'real' | 'date' | 'time' | 'datetime' | string;
63
- export interface RecordValue {
64
- value: any;
65
- type: RecordValueType;
66
- }
67
35
  export interface TableRecordRow {
68
36
  values: Record<string, {
69
37
  value: any;
@@ -77,189 +45,3 @@ export interface TableRecordsData {
77
45
  table: Table;
78
46
  rows: TableRecordRow[];
79
47
  }
80
- export interface TableRecord {
81
- schemaName: string | undefined;
82
- tableName: string;
83
- columns: string[];
84
- values: RecordValue[][];
85
- }
86
- export interface Database {
87
- schemas: [];
88
- tables: Table[];
89
- notes: Note[];
90
- refs: Ref[];
91
- enums: Enum[];
92
- tableGroups: TableGroup[];
93
- aliases: Alias[];
94
- project: Project;
95
- tablePartials: TablePartial[];
96
- records: TableRecord[];
97
- diagramViews: DiagramView[];
98
- }
99
- export interface Table {
100
- name: string;
101
- schemaName: null | string;
102
- alias: string | null;
103
- fields: Column[];
104
- checks: Check[];
105
- partials: TablePartialInjection[];
106
- token: TokenPosition;
107
- indexes: Index[];
108
- headerColor?: string;
109
- note?: {
110
- value: string;
111
- token: TokenPosition;
112
- };
113
- }
114
- export interface Note {
115
- name: string;
116
- content: string;
117
- token: TokenPosition;
118
- headerColor?: string;
119
- }
120
- export interface ColumnType {
121
- schemaName: string | null;
122
- type_name: string;
123
- args: string | null;
124
- numericParams?: {
125
- precision: number;
126
- scale: number;
127
- };
128
- lengthParam?: {
129
- length: number;
130
- };
131
- isEnum?: boolean;
132
- }
133
- export interface Column {
134
- name: string;
135
- type: ColumnType;
136
- token: TokenPosition;
137
- inline_refs: InlineRef[];
138
- checks: Check[];
139
- pk?: boolean;
140
- dbdefault?: {
141
- type: 'number' | 'string' | 'boolean' | 'expression';
142
- value: number | string;
143
- };
144
- increment?: boolean;
145
- unique?: boolean;
146
- not_null?: boolean;
147
- note?: {
148
- value: string;
149
- token: TokenPosition;
150
- };
151
- }
152
- export interface Index {
153
- columns: {
154
- value: string;
155
- type: string;
156
- token: TokenPosition;
157
- }[];
158
- token: TokenPosition;
159
- unique?: boolean;
160
- pk?: boolean;
161
- name?: string;
162
- note?: {
163
- value: string;
164
- token: TokenPosition;
165
- };
166
- type?: string;
167
- }
168
- export interface Check {
169
- token: TokenPosition;
170
- expression: string;
171
- name?: string;
172
- }
173
- export interface InlineRef {
174
- schemaName: string | null;
175
- tableName: string;
176
- fieldNames: string[];
177
- relation: '>' | '<' | '-' | '<>';
178
- token: TokenPosition;
179
- }
180
- export interface Ref {
181
- schemaName: string | null;
182
- name: string | null;
183
- endpoints: RefEndpointPair;
184
- color?: string;
185
- onDelete?: string;
186
- onUpdate?: string;
187
- token: TokenPosition;
188
- }
189
- export type RefEndpointPair = [RefEndpoint, RefEndpoint];
190
- export interface RefEndpoint {
191
- schemaName: string | null;
192
- tableName: string;
193
- fieldNames: string[];
194
- relation: RelationCardinality;
195
- token: TokenPosition;
196
- }
197
- export type RelationCardinality = '1' | '*';
198
- export interface Enum {
199
- name: string;
200
- schemaName: string | null;
201
- token: TokenPosition;
202
- values: EnumField[];
203
- }
204
- export interface EnumField {
205
- name: string;
206
- token: TokenPosition;
207
- note?: {
208
- value: string;
209
- token: TokenPosition;
210
- };
211
- }
212
- export interface TableGroup {
213
- name: string | null;
214
- schemaName: string | null;
215
- tables: TableGroupField[];
216
- token: TokenPosition;
217
- color?: string;
218
- note?: {
219
- value: string;
220
- token: TokenPosition;
221
- };
222
- }
223
- export interface TableGroupField {
224
- name: string;
225
- schemaName: string | null;
226
- }
227
- export interface Alias {
228
- name: string;
229
- kind: 'table';
230
- value: {
231
- tableName: string;
232
- schemaName: string | null;
233
- };
234
- }
235
- export interface TablePartial {
236
- name: string;
237
- fields: Column[];
238
- token: TokenPosition;
239
- indexes: Index[];
240
- headerColor?: string;
241
- checks: Check[];
242
- note?: {
243
- value: string;
244
- token: TokenPosition;
245
- };
246
- }
247
- export interface TablePartialInjection {
248
- name: string;
249
- order: number;
250
- token: TokenPosition;
251
- }
252
- export type Project = Record<string, never> | {
253
- name: string | null;
254
- tables: Table[];
255
- refs: Ref[];
256
- enums: Enum[];
257
- tableGroups: TableGroup[];
258
- tablePartials: TablePartial[];
259
- note?: {
260
- value: string;
261
- token: TokenPosition;
262
- };
263
- token: TokenPosition;
264
- [index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note' | 'tablePartials' | 'records'>]: string;
265
- };
@@ -1,8 +1,9 @@
1
- import { ColumnSymbol } from '../analyzer/symbol/symbols';
2
- import { LiteralNode, PrimaryExpressionNode, SyntaxNode } from '../parser/nodes';
3
- import { ColumnType, RelationCardinality, Table, TokenPosition, InterpreterDatabase, Ref } from './types';
4
- import { SyntaxTokenKind } from '../lexer/tokens';
5
- import { default as Report } from '../report';
1
+ import { LiteralNode, PrimaryExpressionNode, SyntaxNode } from '../types/nodes';
2
+ import { default as Report } from '../types/report';
3
+ import { ColumnType, Ref, RelationCardinality, Table, TokenPosition } from '../types/schemaJson';
4
+ import { ColumnSymbol } from '../types/symbol/symbols';
5
+ import { SyntaxTokenKind } from '../types/tokens';
6
+ import { InterpreterDatabase } from './types';
6
7
  export declare function extractNamesFromRefOperand(operand: SyntaxNode, owner?: Table): {
7
8
  schemaName: string | null;
8
9
  tableName: string;
@@ -1,12 +1,14 @@
1
- import { default as Report } from '../report';
2
- import { SyntaxToken, SyntaxTokenKind } from './tokens';
1
+ import { Filepath } from '../types/filepath';
2
+ import { default as Report } from '../types/report';
3
+ import { SyntaxToken, SyntaxTokenKind } from '../types/tokens';
3
4
  export default class Lexer {
4
5
  private start;
5
6
  private current;
6
7
  private text;
8
+ private filepath;
7
9
  private tokens;
8
10
  private errors;
9
- constructor(text: string);
11
+ constructor(text: string, filepath: Filepath);
10
12
  private isAtEnd;
11
13
  private advance;
12
14
  private peek;
@@ -1,4 +1,4 @@
1
- import { SyntaxToken } from './tokens';
1
+ import { SyntaxToken } from '../types/tokens';
2
2
  export declare function hasTrailingNewLines(token: SyntaxToken): boolean;
3
3
  export declare function isAtStartOfLine(previous: SyntaxToken, token: SyntaxToken): boolean;
4
4
  export declare function hasTrailingSpaces(token: SyntaxToken): boolean;
@@ -1,4 +1,4 @@
1
- import { SyntaxToken } from '../lexer/tokens';
1
+ import { SyntaxToken } from '../types/tokens';
2
2
  export declare const enum ParsingContext {
3
3
  ListExpression = 0,
4
4
  GroupExpression = 1,
@@ -1,8 +1,10 @@
1
- import { SyntaxNode, SyntaxNodeId, SyntaxNodeIdGenerator } from './nodes';
1
+ import { Filepath } from '../types/filepath';
2
+ import { SyntaxNode, SyntaxNodeId, SyntaxNodeIdGenerator } from '../types/nodes';
2
3
  export default class NodeFactory {
3
4
  private generator;
4
- constructor(generator: SyntaxNodeIdGenerator);
5
+ private filepath;
6
+ constructor(generator: SyntaxNodeIdGenerator, filepath: Filepath);
5
7
  create<T extends SyntaxNode, A>(Type: {
6
- new (args: A, id: SyntaxNodeId): T;
8
+ new (args: A, id: SyntaxNodeId, filepath: Filepath): T;
7
9
  }, args: A): T;
8
10
  }
@@ -1,6 +1,7 @@
1
- import { SyntaxToken } from '../lexer/tokens';
2
- import { default as Report } from '../report';
3
- import { ProgramNode, SyntaxNodeIdGenerator } from './nodes';
1
+ import { Filepath } from '../types/filepath';
2
+ import { ProgramNode, SyntaxNodeIdGenerator } from '../types/nodes';
3
+ import { default as Report } from '../types/report';
4
+ import { SyntaxToken } from '../types/tokens';
4
5
  export default class Parser {
5
6
  private tokens;
6
7
  private current;
@@ -8,7 +9,7 @@ export default class Parser {
8
9
  private contextStack;
9
10
  private nodeFactory;
10
11
  private source;
11
- constructor(source: string, tokens: SyntaxToken[], nodeIdGenerator: SyntaxNodeIdGenerator);
12
+ constructor(source: string, tokens: SyntaxToken[], nodeIdGenerator: SyntaxNodeIdGenerator, filepath: Filepath);
12
13
  private isAtEnd;
13
14
  private advance;
14
15
  private peek;