@dbml/parse 7.1.2 → 8.0.0-alpha.10

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 (202) hide show
  1. package/dist/dbml-parse.js +25 -19
  2. package/dist/dbml-parse.mjs +11321 -7514
  3. package/dist/src/compiler/index.d.ts +93 -53
  4. package/dist/src/compiler/projectLayout/index.d.ts +1 -0
  5. package/dist/src/compiler/projectLayout/layout.d.ts +23 -0
  6. package/dist/src/compiler/queries/canonicalName.d.ts +9 -0
  7. package/dist/src/compiler/queries/container/element.d.ts +2 -1
  8. package/dist/src/compiler/queries/container/index.d.ts +5 -5
  9. package/dist/src/compiler/queries/container/scope.d.ts +3 -2
  10. package/dist/src/compiler/queries/container/scopeKind.d.ts +2 -1
  11. package/dist/src/compiler/queries/container/stack.d.ts +2 -1
  12. package/dist/src/compiler/queries/container/token.d.ts +2 -1
  13. package/dist/src/compiler/queries/files/fileDependencies.d.ts +3 -0
  14. package/dist/src/compiler/queries/files/reachableFiles.d.ts +4 -0
  15. package/dist/src/compiler/queries/files/usableMembers.d.ts +34 -0
  16. package/dist/src/compiler/queries/legacy/parse.d.ts +10 -9
  17. package/dist/src/compiler/queries/legacy/symbol.d.ts +1 -10
  18. package/dist/src/compiler/queries/legacy/token.d.ts +3 -2
  19. package/dist/src/compiler/queries/nodeAtPosition.d.ts +5 -0
  20. package/dist/src/compiler/queries/pipeline/bind.d.ts +5 -0
  21. package/dist/src/compiler/queries/pipeline/index.d.ts +2 -0
  22. package/dist/src/compiler/queries/pipeline/interpret.d.ts +6 -0
  23. package/dist/src/compiler/queries/pipeline/parse.d.ts +12 -0
  24. package/dist/src/compiler/queries/pipeline/validate.d.ts +4 -0
  25. package/dist/src/compiler/queries/resolutionIndex.d.ts +13 -0
  26. package/dist/src/compiler/queries/symbol/lookupMembers.d.ts +4 -0
  27. package/dist/src/compiler/queries/symbol/symbolAliases.d.ts +4 -0
  28. package/dist/src/compiler/queries/symbol/symbolUses.d.ts +4 -0
  29. package/dist/src/compiler/queries/transform/index.d.ts +3 -3
  30. package/dist/src/compiler/queries/transform/renameTable.d.ts +19 -16
  31. package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +19 -6
  32. package/dist/src/compiler/queries/transform/utils.d.ts +5 -4
  33. package/dist/src/compiler/queries/utils.d.ts +6 -0
  34. package/dist/src/constants.d.ts +1 -2
  35. package/dist/src/core/global_modules/checks/bind.d.ts +9 -0
  36. package/dist/src/core/global_modules/checks/index.d.ts +2 -0
  37. package/dist/src/core/global_modules/checks/interpret.d.ts +10 -0
  38. package/dist/src/core/global_modules/diagramView/bind.d.ts +18 -0
  39. package/dist/src/core/global_modules/diagramView/index.d.ts +8 -0
  40. package/dist/src/core/global_modules/diagramView/interpret.d.ts +37 -0
  41. package/dist/src/core/global_modules/enum/bind.d.ts +11 -0
  42. package/dist/src/core/global_modules/enum/index.d.ts +8 -0
  43. package/dist/src/core/global_modules/enum/interpret.d.ts +15 -0
  44. package/dist/src/core/global_modules/index.d.ts +17 -0
  45. package/dist/src/core/global_modules/indexes/bind.d.ts +12 -0
  46. package/dist/src/core/global_modules/indexes/index.d.ts +2 -0
  47. package/dist/src/core/global_modules/indexes/interpret.d.ts +10 -0
  48. package/dist/src/core/global_modules/note/bind.d.ts +11 -0
  49. package/dist/src/core/global_modules/note/index.d.ts +2 -0
  50. package/dist/src/core/global_modules/note/interpret.d.ts +17 -0
  51. package/dist/src/core/global_modules/program/bind.d.ts +17 -0
  52. package/dist/src/core/global_modules/program/index.d.ts +2 -0
  53. package/dist/src/core/global_modules/program/interpret.d.ts +23 -0
  54. package/dist/src/core/global_modules/program/utils.d.ts +3 -0
  55. package/dist/src/core/global_modules/project/bind.d.ts +11 -0
  56. package/dist/src/core/global_modules/project/index.d.ts +2 -0
  57. package/dist/src/core/global_modules/project/interpret.d.ts +16 -0
  58. package/dist/src/core/global_modules/records/bind.d.ts +17 -0
  59. package/dist/src/core/global_modules/records/index.d.ts +2 -0
  60. package/dist/src/core/global_modules/records/interpret.d.ts +13 -0
  61. package/dist/src/core/global_modules/records/utils/constraints/fk.d.ts +13 -0
  62. package/dist/src/core/global_modules/records/utils/constraints/helper.d.ts +26 -0
  63. package/dist/src/core/global_modules/records/utils/constraints/pk.d.ts +6 -0
  64. package/dist/src/core/global_modules/records/utils/constraints/unique.d.ts +5 -0
  65. package/dist/src/core/{interpreter → global_modules}/records/utils/data/sqlTypes.d.ts +0 -8
  66. package/dist/src/core/{interpreter → global_modules}/records/utils/data/values.d.ts +1 -1
  67. package/dist/src/core/global_modules/ref/bind.d.ts +15 -0
  68. package/dist/src/core/global_modules/ref/index.d.ts +7 -0
  69. package/dist/src/core/global_modules/ref/interpret.d.ts +15 -0
  70. package/dist/src/core/global_modules/schema/index.d.ts +2 -0
  71. package/dist/src/core/global_modules/table/bind.d.ts +18 -0
  72. package/dist/src/core/global_modules/table/index.d.ts +9 -0
  73. package/dist/src/core/global_modules/table/interpret.d.ts +26 -0
  74. package/dist/src/core/global_modules/table/utils.d.ts +4 -0
  75. package/dist/src/core/global_modules/tableGroup/bind.d.ts +15 -0
  76. package/dist/src/core/global_modules/tableGroup/index.d.ts +8 -0
  77. package/dist/src/core/global_modules/tableGroup/interpret.d.ts +18 -0
  78. package/dist/src/core/global_modules/tablePartial/bind.d.ts +17 -0
  79. package/dist/src/core/global_modules/tablePartial/index.d.ts +7 -0
  80. package/dist/src/core/global_modules/tablePartial/interpret.d.ts +23 -0
  81. package/dist/src/core/global_modules/types.d.ts +17 -0
  82. package/dist/src/core/global_modules/use/index.d.ts +8 -0
  83. package/dist/src/core/global_modules/utils.d.ts +17 -0
  84. package/dist/src/core/local_modules/checks/index.d.ts +2 -0
  85. package/dist/src/core/local_modules/checks/validate.d.ts +17 -0
  86. package/dist/src/core/local_modules/custom/index.d.ts +2 -0
  87. package/dist/src/core/local_modules/custom/validate.d.ts +14 -0
  88. package/dist/src/core/local_modules/diagramView/index.d.ts +2 -0
  89. package/dist/src/core/local_modules/diagramView/validate.d.ts +24 -0
  90. package/dist/src/core/local_modules/enum/index.d.ts +2 -0
  91. package/dist/src/core/local_modules/enum/validate.d.ts +17 -0
  92. package/dist/src/core/local_modules/index.d.ts +10 -0
  93. package/dist/src/core/local_modules/indexes/index.d.ts +2 -0
  94. package/dist/src/core/local_modules/indexes/validate.d.ts +18 -0
  95. package/dist/src/core/local_modules/note/index.d.ts +2 -0
  96. package/dist/src/core/local_modules/note/validate.d.ts +16 -0
  97. package/dist/src/core/local_modules/program/index.d.ts +2 -0
  98. package/dist/src/core/local_modules/program/validate.d.ts +9 -0
  99. package/dist/src/core/local_modules/project/index.d.ts +2 -0
  100. package/dist/src/core/local_modules/project/validate.d.ts +15 -0
  101. package/dist/src/core/local_modules/records/index.d.ts +2 -0
  102. package/dist/src/core/local_modules/records/validate.d.ts +20 -0
  103. package/dist/src/core/local_modules/ref/index.d.ts +2 -0
  104. package/dist/src/core/local_modules/ref/validate.d.ts +20 -0
  105. package/dist/src/core/local_modules/table/index.d.ts +2 -0
  106. package/dist/src/core/local_modules/table/validate.d.ts +21 -0
  107. package/dist/src/core/local_modules/tableGroup/index.d.ts +2 -0
  108. package/dist/src/core/local_modules/tableGroup/validate.d.ts +19 -0
  109. package/dist/src/core/local_modules/tablePartial/index.d.ts +2 -0
  110. package/dist/src/core/local_modules/tablePartial/validate.d.ts +21 -0
  111. package/dist/src/core/local_modules/types.d.ts +12 -0
  112. package/dist/src/core/local_modules/use/index.d.ts +2 -0
  113. package/dist/src/core/local_modules/use/validate.d.ts +12 -0
  114. package/dist/src/core/parser/parser.d.ts +8 -0
  115. package/dist/src/core/parser/utils.d.ts +2 -49
  116. package/dist/src/core/types/errors.d.ts +9 -5
  117. package/dist/src/core/types/filepath.d.ts +8 -2
  118. package/dist/src/core/types/index.d.ts +2 -0
  119. package/dist/src/core/types/internable.d.ts +0 -12
  120. package/dist/src/core/{analyzer/types.d.ts → types/keywords.d.ts} +6 -2
  121. package/dist/src/core/types/nodes.d.ts +61 -16
  122. package/dist/src/core/types/report.d.ts +3 -3
  123. package/dist/src/core/types/schemaJson.d.ts +14 -5
  124. package/dist/src/core/types/symbol/factory.d.ts +3 -2
  125. package/dist/src/core/types/symbol/index.d.ts +3 -4
  126. package/dist/src/core/types/symbol/metadata.d.ts +80 -0
  127. package/dist/src/core/types/symbol/symbols.d.ts +277 -86
  128. package/dist/src/core/{analyzer/utils.d.ts → utils/expression.d.ts} +10 -21
  129. package/dist/src/core/utils/interpret.d.ts +16 -0
  130. package/dist/src/core/utils/numbers.d.ts +1 -1
  131. package/dist/src/core/utils/span.d.ts +2 -4
  132. package/dist/src/core/utils/tokens.d.ts +15 -0
  133. package/dist/src/core/utils/validate.d.ts +103 -0
  134. package/dist/src/index.d.ts +13 -9
  135. package/dist/src/services/diagnostics/provider.d.ts +7 -6
  136. package/dist/src/services/index.d.ts +2 -1
  137. package/dist/src/services/monarch.d.ts +4 -3
  138. package/dist/src/services/suggestions/crossFile.d.ts +6 -0
  139. package/dist/src/services/suggestions/provider.d.ts +4 -1
  140. package/dist/src/services/suggestions/recordRowSnippet.d.ts +2 -1
  141. package/dist/src/services/suggestions/use.d.ts +5 -0
  142. package/dist/src/services/suggestions/utils/index.d.ts +10 -0
  143. package/dist/src/services/suggestions/utils/useMerger.d.ts +29 -0
  144. package/dist/src/services/types.d.ts +4 -0
  145. package/dist/src/services/utils.d.ts +4 -1
  146. package/package.json +4 -3
  147. package/dist/src/core/analyzer/analyzer.d.ts +0 -10
  148. package/dist/src/core/analyzer/binder/binder.d.ts +0 -10
  149. package/dist/src/core/analyzer/binder/elementBinder/checks.d.ts +0 -13
  150. package/dist/src/core/analyzer/binder/elementBinder/custom.d.ts +0 -16
  151. package/dist/src/core/analyzer/binder/elementBinder/diagramView.d.ts +0 -20
  152. package/dist/src/core/analyzer/binder/elementBinder/enum.d.ts +0 -16
  153. package/dist/src/core/analyzer/binder/elementBinder/indexes.d.ts +0 -17
  154. package/dist/src/core/analyzer/binder/elementBinder/note.d.ts +0 -16
  155. package/dist/src/core/analyzer/binder/elementBinder/project.d.ts +0 -16
  156. package/dist/src/core/analyzer/binder/elementBinder/records.d.ts +0 -22
  157. package/dist/src/core/analyzer/binder/elementBinder/ref.d.ts +0 -17
  158. package/dist/src/core/analyzer/binder/elementBinder/table.d.ts +0 -21
  159. package/dist/src/core/analyzer/binder/elementBinder/tableGroup.d.ts +0 -17
  160. package/dist/src/core/analyzer/binder/elementBinder/tablePartial.d.ts +0 -19
  161. package/dist/src/core/analyzer/binder/types.d.ts +0 -4
  162. package/dist/src/core/analyzer/binder/utils.d.ts +0 -33
  163. package/dist/src/core/analyzer/validator/elementValidators/checks.d.ts +0 -26
  164. package/dist/src/core/analyzer/validator/elementValidators/custom.d.ts +0 -23
  165. package/dist/src/core/analyzer/validator/elementValidators/diagramView.d.ts +0 -31
  166. package/dist/src/core/analyzer/validator/elementValidators/enum.d.ts +0 -28
  167. package/dist/src/core/analyzer/validator/elementValidators/indexes.d.ts +0 -27
  168. package/dist/src/core/analyzer/validator/elementValidators/note.d.ts +0 -25
  169. package/dist/src/core/analyzer/validator/elementValidators/project.d.ts +0 -24
  170. package/dist/src/core/analyzer/validator/elementValidators/records.d.ts +0 -29
  171. package/dist/src/core/analyzer/validator/elementValidators/ref.d.ts +0 -26
  172. package/dist/src/core/analyzer/validator/elementValidators/table.d.ts +0 -28
  173. package/dist/src/core/analyzer/validator/elementValidators/tableGroup.d.ts +0 -27
  174. package/dist/src/core/analyzer/validator/elementValidators/tablePartial.d.ts +0 -28
  175. package/dist/src/core/analyzer/validator/types.d.ts +0 -7
  176. package/dist/src/core/analyzer/validator/utils.d.ts +0 -65
  177. package/dist/src/core/analyzer/validator/validator.d.ts +0 -10
  178. package/dist/src/core/interpreter/elementInterpreter/diagramView.d.ts +0 -13
  179. package/dist/src/core/interpreter/elementInterpreter/enum.d.ts +0 -12
  180. package/dist/src/core/interpreter/elementInterpreter/project.d.ts +0 -12
  181. package/dist/src/core/interpreter/elementInterpreter/ref.d.ts +0 -14
  182. package/dist/src/core/interpreter/elementInterpreter/sticky_note.d.ts +0 -14
  183. package/dist/src/core/interpreter/elementInterpreter/table.d.ts +0 -22
  184. package/dist/src/core/interpreter/elementInterpreter/tableGroup.d.ts +0 -15
  185. package/dist/src/core/interpreter/elementInterpreter/tablePartial.d.ts +0 -19
  186. package/dist/src/core/interpreter/interpreter.d.ts +0 -10
  187. package/dist/src/core/interpreter/records/index.d.ts +0 -10
  188. package/dist/src/core/interpreter/records/utils/constraints/fk.d.ts +0 -3
  189. package/dist/src/core/interpreter/records/utils/constraints/helper.d.ts +0 -11
  190. package/dist/src/core/interpreter/records/utils/constraints/pk.d.ts +0 -3
  191. package/dist/src/core/interpreter/records/utils/constraints/unique.d.ts +0 -3
  192. package/dist/src/core/interpreter/types.d.ts +0 -47
  193. package/dist/src/core/interpreter/utils.d.ts +0 -37
  194. package/dist/src/core/types/symbol/symbolIndex.d.ts +0 -33
  195. package/dist/src/core/types/symbol/symbolTable.d.ts +0 -12
  196. package/dist/src/core/types/symbol/utils.d.ts +0 -4
  197. package/dist/src/core/utils/array.d.ts +0 -1
  198. package/dist/src/core/utils/enum.d.ts +0 -1
  199. package/dist/src/services/suggestions/utils.d.ts +0 -34
  200. /package/dist/src/core/{interpreter → global_modules}/records/utils/constraints/index.d.ts +0 -0
  201. /package/dist/src/core/{interpreter → global_modules}/records/utils/data/index.d.ts +0 -0
  202. /package/dist/src/core/{interpreter → global_modules}/records/utils/index.d.ts +0 -0
@@ -0,0 +1,18 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ import { SyntaxToken } from '../../types/tokens';
5
+ export default class DiagramViewBinder {
6
+ private compiler;
7
+ private declarationNode;
8
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode & {
9
+ type: SyntaxToken;
10
+ });
11
+ bind(): CompileError[];
12
+ private bindBody;
13
+ private bindSubElements;
14
+ private bindTableReferences;
15
+ private bindNoteReferences;
16
+ private bindTableGroupReferences;
17
+ private bindSchemaReferences;
18
+ }
@@ -0,0 +1,8 @@
1
+ import { SyntaxNode } from '../../types/nodes';
2
+ import { GlobalModule } from '../types';
3
+ import { CompileError } from '../../types';
4
+ export declare const diagramViewUtils: {
5
+ getDuplicateError(name: string, schemaLabel: string, errorNode: SyntaxNode): CompileError;
6
+ getFieldDuplicateError(name: string, elementKind: string, errorNode: SyntaxNode): CompileError;
7
+ };
8
+ export declare const diagramViewModule: GlobalModule;
@@ -0,0 +1,37 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { Filepath } from '../../types/filepath';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ import { DiagramView } from '../../types';
5
+ import { default as Report } from '../../types/report';
6
+ import { DiagramViewSymbol } from '../../types/symbol';
7
+ export declare class DiagramViewInterpreter {
8
+ private compiler;
9
+ private declarationNode;
10
+ private symbol;
11
+ private filepath;
12
+ private diagramView;
13
+ private diagramViewWildcards;
14
+ private diagramViewExplicitlySet;
15
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode, symbol: DiagramViewSymbol, filepath: Filepath);
16
+ interpret(): Report<DiagramView>;
17
+ private interpretBody;
18
+ private interpretSubBlock;
19
+ /**
20
+ * Expand explicit wildcard ([]) for tableGroups in DiagramView visibleEntities
21
+ * to the concrete list of table group names.
22
+ *
23
+ * Expands when:
24
+ * 1. The user wrote `TableGroups { * }` (tracked via diagramViewWildcards)
25
+ * 2. NOT a body-level `{ * }` - body-level wildcard sets ALL dims to [] simultaneously,
26
+ * which is a different semantic (show everything) that doesn't need expansion.
27
+ * We detect body-level by checking if all four dims are in the wildcards set.
28
+ *
29
+ * Why only TableGroups needs expansion:
30
+ * - Tables: * -> [] means "show all tables" (every table is a table, no indirection)
31
+ * - Schemas: * -> [] means "show all schemas" (every table belongs to a schema)
32
+ * - TableGroups: * needs concrete names because some tables DON'T belong to any group.
33
+ * The frontend does name-based lookup; [] would produce an empty name map -> no groups matched.
34
+ */
35
+ expandDiagramViewWildcards(): void;
36
+ private getAllTableGroupNames;
37
+ }
@@ -0,0 +1,11 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class EnumBinder {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ bind(): CompileError[];
9
+ private bindBody;
10
+ private bindSubElements;
11
+ }
@@ -0,0 +1,8 @@
1
+ import { CompileError } from '../../types/errors';
2
+ import { SyntaxNode } from '../../types/nodes';
3
+ import { GlobalModule } from '../types';
4
+ export declare const enumUtils: {
5
+ getDuplicateError(name: string, schemaLabel: string, errorNode: SyntaxNode): CompileError;
6
+ getFieldDuplicateError(name: string, errorNode: SyntaxNode): CompileError;
7
+ };
8
+ export declare const enumModule: GlobalModule;
@@ -0,0 +1,15 @@
1
+ import { Enum } from '../../types/schemaJson';
2
+ import { EnumSymbol, Filepath } from '../../types';
3
+ import { default as Compiler } from '../../../compiler';
4
+ import { default as Report } from '../../types/report';
5
+ export declare class EnumInterpreter {
6
+ private compiler;
7
+ private symbol;
8
+ private declarationNode;
9
+ private enum;
10
+ private filepath;
11
+ constructor(compiler: Compiler, symbol: EnumSymbol, filepath: Filepath);
12
+ interpret(): Report<Enum>;
13
+ private interpretName;
14
+ private interpretBody;
15
+ }
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../compiler/index';
2
+ import { Filepath } from '../types/filepath';
3
+ import { Unhandled } from '../types/module';
4
+ import { SyntaxNode } from '../types/nodes';
5
+ import { default as Report } from '../types/report';
6
+ import { NodeMetadata } from '../types/symbol/metadata';
7
+ import { SchemaElement } from '../types/schemaJson';
8
+ import { NodeSymbol } from '../types/symbol';
9
+ import { GlobalModule } from './types';
10
+ export declare const modules: GlobalModule[];
11
+ export declare function nodeSymbol(this: Compiler, node: SyntaxNode): Report<NodeSymbol> | Report<Unhandled>;
12
+ export declare function symbolMembers(this: Compiler, symbol: NodeSymbol): Report<NodeSymbol[]> | Report<Unhandled>;
13
+ export declare function nodeReferee(this: Compiler, node: SyntaxNode): Report<NodeSymbol | undefined> | Report<Unhandled>;
14
+ export declare function bindNode(this: Compiler, node: SyntaxNode): Report<void> | Report<Unhandled>;
15
+ export declare function nodeMetadata(this: Compiler, node: SyntaxNode): Report<NodeMetadata> | Report<Unhandled>;
16
+ export declare function interpretSymbol(this: Compiler, symbol: NodeSymbol, filepath: Filepath): Report<SchemaElement | SchemaElement[] | undefined> | Report<Unhandled>;
17
+ export declare function interpretMetadata(this: Compiler, metadata: NodeMetadata, filepath: Filepath): Report<SchemaElement | SchemaElement[] | undefined> | Report<Unhandled>;
@@ -0,0 +1,12 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class IndexesBinder {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ bind(): CompileError[];
9
+ private bindBody;
10
+ private bindFields;
11
+ private bindSubElements;
12
+ }
@@ -0,0 +1,2 @@
1
+ import { GlobalModule } from '../types';
2
+ export declare const indexesModule: GlobalModule;
@@ -0,0 +1,10 @@
1
+ import { default as Compiler } from '../../../compiler/index';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
3
+ import { default as Report } from '../../types/report';
4
+ import { SchemaElement } from '../../types/schemaJson';
5
+ export default class IndexesInterpreter {
6
+ private compiler;
7
+ private node;
8
+ constructor(compiler: Compiler, node: ElementDeclarationNode);
9
+ interpret(): Report<SchemaElement | SchemaElement[] | undefined>;
10
+ }
@@ -0,0 +1,11 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class NoteBinder {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ bind(): CompileError[];
9
+ private bindBody;
10
+ private bindSubElements;
11
+ }
@@ -0,0 +1,2 @@
1
+ import { GlobalModule } from '../types';
2
+ export declare const noteModule: GlobalModule;
@@ -0,0 +1,17 @@
1
+ import { Note } from '../../types/schemaJson';
2
+ import { default as Compiler } from '../../../compiler';
3
+ import { Filepath, NoteSymbol } from '../../types';
4
+ import { default as Report } from '../../types/report';
5
+ export declare class StickyNoteInterpreter {
6
+ private declarationNode;
7
+ private symbol;
8
+ private compiler;
9
+ private filepath;
10
+ private note;
11
+ constructor(compiler: Compiler, symbol: NoteSymbol, filepath: Filepath);
12
+ interpret(): Report<Note>;
13
+ private interpretName;
14
+ private interpretSettingList;
15
+ private interpretBody;
16
+ private interpretNote;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { ProgramNode } from '../../types/nodes';
3
+ import { default as Report } from '../../types/report';
4
+ export default class Binder {
5
+ private ast;
6
+ private compiler;
7
+ constructor(ast: ProgramNode, compiler: Compiler);
8
+ resolve(): Report<void>;
9
+ private checkDuplicateRefs;
10
+ private checkStandaloneRefs;
11
+ private checkInlineRefs;
12
+ private checkTablePartialSelfRefs;
13
+ /**
14
+ * Check that no table appears in more than one TableGroup.
15
+ */
16
+ private checkTableGroups;
17
+ }
@@ -0,0 +1,2 @@
1
+ import { GlobalModule } from '../types';
2
+ export declare const programModule: GlobalModule;
@@ -0,0 +1,23 @@
1
+ import { default as Compiler } from '../../../compiler/index';
2
+ import { Filepath } from '../../types/filepath';
3
+ import { default as Report } from '../../types/report';
4
+ import { SchemaElement } from '../../types/schemaJson';
5
+ import { ProgramSymbol } from '../../types/symbol';
6
+ export default class ProgramInterpreter {
7
+ private compiler;
8
+ private programSymbol;
9
+ private programNode;
10
+ private filepath;
11
+ private errors;
12
+ private warnings;
13
+ private db;
14
+ constructor(compiler: Compiler, symbol: ProgramSymbol, filepath: Filepath);
15
+ interpret(): Report<SchemaElement | SchemaElement[] | undefined>;
16
+ private interpretAllSymbols;
17
+ private interpretUseSymbol;
18
+ private interpretAllMetadata;
19
+ private interpretAllAliases;
20
+ private validateRecords;
21
+ private collectPartialRefs;
22
+ private pushElement;
23
+ }
@@ -0,0 +1,3 @@
1
+ import { Database, ElementRef } from '../../types/schemaJson';
2
+ import { NodeSymbol } from '../../types/symbol';
3
+ export declare function pushExternal(db: Database, member: NodeSymbol, ref: ElementRef): void;
@@ -0,0 +1,11 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class ProjectBinder {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ bind(): CompileError[];
9
+ private bindBody;
10
+ private bindSubElements;
11
+ }
@@ -0,0 +1,2 @@
1
+ import { GlobalModule } from '../types';
2
+ export declare const projectModule: GlobalModule;
@@ -0,0 +1,16 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
3
+ import { default as Report } from '../../types/report';
4
+ import { Project } from '../../types/schemaJson';
5
+ import { Filepath } from '../../types/filepath';
6
+ export declare class ProjectInterpreter {
7
+ private compiler;
8
+ private declarationNode;
9
+ private filepath;
10
+ private project;
11
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode, filepath: Filepath);
12
+ interpret(): Report<Project>;
13
+ private interpretName;
14
+ private interpretSubElement;
15
+ private interpretBody;
16
+ }
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class RecordsBinder {
5
+ private compiler;
6
+ private declarationNode;
7
+ private boundColumns;
8
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
9
+ bind(): CompileError[];
10
+ private bindRecordsName;
11
+ private bindTopLevelName;
12
+ private bindInsideTableName;
13
+ private bindBody;
14
+ private bindDataRows;
15
+ private bindDataRow;
16
+ private bindSubElements;
17
+ }
@@ -0,0 +1,2 @@
1
+ import { GlobalModule } from '../types';
2
+ export declare const recordsModule: GlobalModule;
@@ -0,0 +1,13 @@
1
+ import { default as Compiler } from '../../../compiler/index';
2
+ import { default as Report } from '../../types/report';
3
+ import { TableRecord } from '../../types/schemaJson';
4
+ import { Filepath } from '../../types/filepath';
5
+ import { RecordsMetadata } from '../../types/symbol';
6
+ export default class RecordsInterpreter {
7
+ private compiler;
8
+ private element;
9
+ private metadata;
10
+ private filepath;
11
+ constructor(compiler: Compiler, metadata: RecordsMetadata, filepath: Filepath);
12
+ interpret(): Report<TableRecord | undefined>;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { default as Compiler } from '../../../../../compiler/index';
2
+ import { CompileWarning } from '../../../../types/errors';
3
+ import { Filepath } from '../../../../types/filepath';
4
+ import { SyntaxNode } from '../../../../types/nodes';
5
+ import { Ref, TableRecord } from '../../../../types/schemaJson';
6
+ import { TableSymbol } from '../../../../types/symbol';
7
+ import { InternedNodeSymbol } from '../../../../types/symbol/symbols';
8
+ export type TableInfo = {
9
+ tableSymbol: TableSymbol;
10
+ record: TableRecord | undefined;
11
+ recordBlock: SyntaxNode | undefined;
12
+ };
13
+ export declare function validateForeignKeys(compiler: Compiler, allRefs: Ref[], allRecords: Map<InternedNodeSymbol, TableInfo>, filepath: Filepath): CompileWarning[];
@@ -0,0 +1,26 @@
1
+ import { default as Compiler } from '../../../../../compiler/index';
2
+ import { CompileWarning } from '../../../../types/errors';
3
+ import { RecordValue, TableRecord } from '../../../../types/schemaJson';
4
+ import { ColumnSymbol } from '../../../../types/symbol';
5
+ export interface ColumnInfo {
6
+ name: string;
7
+ pk: boolean;
8
+ unique: boolean;
9
+ increment: boolean;
10
+ notNull: boolean;
11
+ dbdefault?: {
12
+ value: string | number;
13
+ type: string;
14
+ };
15
+ typeName: string;
16
+ }
17
+ export declare function columnInfoFromSymbol(col: ColumnSymbol, compiler: Compiler): ColumnInfo;
18
+ export declare function toKeyedRows(record: TableRecord): Record<string, RecordValue>[];
19
+ export declare function makeTableKey(schema: string | null, table: string): string;
20
+ export declare function extractKeyValueWithDefault(row: Record<string, RecordValue>, columnNames: string[], columns?: (ColumnInfo | undefined)[]): string;
21
+ export declare function hasNullWithoutDefaultInKey(row: Record<string, RecordValue>, columnNames: string[], columns?: (ColumnInfo | undefined)[]): boolean;
22
+ export declare function isAutoIncrementColumn(column: ColumnInfo): boolean;
23
+ export declare function formatFullColumnName(schemaName: string | null, tableName: string, columnName: string): string;
24
+ export declare function formatFullColumnNames(schemaName: string | null, tableName: string, columnNames: string[]): string;
25
+ export declare function formatValues(row: Record<string, RecordValue>, columnNames: string[]): string;
26
+ export declare function createConstraintWarning(compiler: Compiler, recordValue: RecordValue, message: string): CompileWarning;
@@ -0,0 +1,6 @@
1
+ import { default as Compiler } from '../../../../../compiler/index';
2
+ import { CompileWarning } from '../../../../types/errors';
3
+ import { SyntaxNode } from '../../../../types/nodes';
4
+ import { TableRecord } from '../../../../types/schemaJson';
5
+ import { TableSymbol } from '../../../../types/symbol';
6
+ export declare function validatePrimaryKey(compiler: Compiler, tableSymbol: TableSymbol, recordBlock: SyntaxNode, record: TableRecord): CompileWarning[];
@@ -0,0 +1,5 @@
1
+ import { default as Compiler } from '../../../../../compiler/index';
2
+ import { CompileWarning } from '../../../../types/errors';
3
+ import { TableRecord } from '../../../../types/schemaJson';
4
+ import { TableSymbol } from '../../../../types/symbol';
5
+ export declare function validateUnique(compiler: Compiler, tableSymbol: TableSymbol, record: TableRecord): CompileWarning[];
@@ -1,4 +1,3 @@
1
- import { ColumnSymbol } from '../../../../types/symbol/symbols';
2
1
  export type SqlDialect = 'mysql' | 'postgres' | 'mssql' | 'oracle' | 'snowflake';
3
2
  export declare function normalizeTypeName(type: string): string;
4
3
  export declare function isIntegerType(type: string, dialect?: SqlDialect): boolean;
@@ -9,11 +8,4 @@ export declare function isStringType(type: string, dialect?: SqlDialect): boolea
9
8
  export declare function isBinaryType(type: string, dialect?: SqlDialect): boolean;
10
9
  export declare function isDateTimeType(type: string, dialect?: SqlDialect): boolean;
11
10
  export declare function isSerialType(type: string, dialect?: SqlDialect): boolean;
12
- export declare function getNumericTypeParams(columnSymbol: ColumnSymbol): {
13
- precision?: number;
14
- scale?: number;
15
- };
16
- export declare function getLengthTypeParam(columnSymbol: ColumnSymbol): {
17
- length?: number;
18
- };
19
11
  export declare function getRecordValueType(sqlType: string, isEnum: boolean): string;
@@ -1,5 +1,5 @@
1
1
  import { FunctionExpressionNode, SyntaxNode } from '../../../../types/nodes';
2
- export { extractNumericLiteral, } from '../../../../analyzer/utils';
2
+ export { extractNumericLiteral } 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;
@@ -0,0 +1,15 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ import { SyntaxToken } from '../../types/tokens';
5
+ export default class RefBinder {
6
+ private compiler;
7
+ private declarationNode;
8
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode & {
9
+ type: SyntaxToken;
10
+ });
11
+ bind(): CompileError[];
12
+ private bindBody;
13
+ private bindFields;
14
+ private bindSubElements;
15
+ }
@@ -0,0 +1,7 @@
1
+ import { default as Compiler } from '../../../compiler/index';
2
+ import { SyntaxNode } from '../../types/nodes';
3
+ import { default as Report } from '../../types/report';
4
+ import { NodeSymbol } from '../../types/symbol';
5
+ import { GlobalModule } from '../types';
6
+ export declare const refModule: GlobalModule;
7
+ export declare function nodeRefereeOfRefEndpoint(compiler: Compiler, globalSymbol: NodeSymbol, node: SyntaxNode): Report<NodeSymbol | undefined>;
@@ -0,0 +1,15 @@
1
+ import { Ref } from '../../types/schemaJson';
2
+ import { RefMetadata, Filepath } from '../../types';
3
+ import { default as Compiler } from '../../../compiler';
4
+ import { default as Report } from '../../types/report';
5
+ export declare class RefInterpreter {
6
+ private compiler;
7
+ private metadata;
8
+ private declarationNode;
9
+ private filepath;
10
+ private ref;
11
+ constructor(compiler: Compiler, metadata: RefMetadata, filepath: Filepath);
12
+ interpret(): Report<Ref>;
13
+ private interpretName;
14
+ private interpretBody;
15
+ }
@@ -0,0 +1,2 @@
1
+ import { GlobalModule } from '../types';
2
+ export declare const schemaModule: GlobalModule;
@@ -0,0 +1,18 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ import { SyntaxToken } from '../../types/tokens';
5
+ export default class TableBinder {
6
+ private compiler;
7
+ private declarationNode;
8
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode & {
9
+ type: SyntaxToken;
10
+ });
11
+ bind(): CompileError[];
12
+ private bindBody;
13
+ private bindFields;
14
+ private tryToBindColumnType;
15
+ private tryToBindEnumFieldRef;
16
+ private bindInlineRef;
17
+ private bindSubElements;
18
+ }
@@ -0,0 +1,9 @@
1
+ import { CompileError } from '../../types/errors';
2
+ import { SyntaxNode } from '../../types/nodes';
3
+ import { GlobalModule } from '../types';
4
+ export declare const tableUtils: {
5
+ getDuplicateError(name: string, schemaLabel: string, errorNode: SyntaxNode): CompileError;
6
+ getColumnDuplicateError(name: string, errorNode: SyntaxNode): CompileError;
7
+ getPartialInjectionDuplicateError(name: string, errorNode: SyntaxNode): CompileError;
8
+ };
9
+ export declare const tableModule: GlobalModule;
@@ -0,0 +1,26 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { ElementDeclarationNode } from '../../types/nodes';
3
+ import { default as Report } from '../../types/report';
4
+ import { Table } from '../../types/schemaJson';
5
+ import { Filepath } from '../../types/filepath';
6
+ import { TableSymbol } from '../../types/symbol/symbols';
7
+ export declare class TableInterpreter {
8
+ private declarationNode;
9
+ private compiler;
10
+ private symbol?;
11
+ private filepath;
12
+ private table;
13
+ private pkColumns;
14
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode, symbol: TableSymbol, filepath: Filepath);
15
+ interpret(): Report<Table>;
16
+ private interpretName;
17
+ private interpretAlias;
18
+ private interpretSettingList;
19
+ private interpretBody;
20
+ private interpretSubElements;
21
+ private interpretInjection;
22
+ private interpretFields;
23
+ private interpretColumn;
24
+ private interpretIndexes;
25
+ private interpretChecks;
26
+ }
@@ -0,0 +1,4 @@
1
+ import { SyntaxNode } from '../../types/nodes';
2
+ import { ColumnType, InlineRef } from '../../types/schemaJson';
3
+ export declare function interpretColumnType(typeNode?: SyntaxNode): ColumnType;
4
+ export declare function interpretInlineRefs(refs: any[]): InlineRef[];
@@ -0,0 +1,15 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ import { SyntaxToken } from '../../types/tokens';
5
+ export default class TableGroupBinder {
6
+ private compiler;
7
+ private declarationNode;
8
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode & {
9
+ type: SyntaxToken;
10
+ });
11
+ bind(): CompileError[];
12
+ private bindBody;
13
+ private bindFields;
14
+ private bindSubElements;
15
+ }
@@ -0,0 +1,8 @@
1
+ import { CompileError } from '../../types/errors';
2
+ import { SyntaxNode } from '../../types/nodes';
3
+ import { GlobalModule } from '../types';
4
+ export declare const tableGroupUtils: {
5
+ getDuplicateError(name: string, schemaLabel: string, errorNode: SyntaxNode): CompileError;
6
+ getFieldDuplicateError(name: string, errorNode: SyntaxNode): CompileError;
7
+ };
8
+ export declare const tableGroupModule: GlobalModule;
@@ -0,0 +1,18 @@
1
+ import { TableGroup } from '../../types/schemaJson';
2
+ import { default as Compiler } from '../../../compiler';
3
+ import { Filepath, TableGroupSymbol } from '../../types';
4
+ import { default as Report } from '../../types/report';
5
+ export declare class TableGroupInterpreter {
6
+ private compiler;
7
+ private symbol;
8
+ private declarationNode;
9
+ private filepath;
10
+ private tableGroup;
11
+ constructor(compiler: Compiler, symbol: TableGroupSymbol, filepath: Filepath);
12
+ interpret(): Report<TableGroup>;
13
+ private interpretName;
14
+ private interpretBody;
15
+ private interpretSubElements;
16
+ private interpretFields;
17
+ private interpretSettingList;
18
+ }
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ import { SyntaxToken } from '../../types/tokens';
5
+ export default class TablePartialBinder {
6
+ private compiler;
7
+ private declarationNode;
8
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode & {
9
+ type: SyntaxToken;
10
+ });
11
+ bind(): CompileError[];
12
+ private bindBody;
13
+ private bindFields;
14
+ private tryToBindColumnType;
15
+ private bindInlineRef;
16
+ private bindSubElements;
17
+ }
@@ -0,0 +1,7 @@
1
+ import { CompileError } from '../../types/errors';
2
+ import { SyntaxNode } from '../../types/nodes';
3
+ import { GlobalModule } from '../types';
4
+ export declare const tablePartialUtils: {
5
+ getDuplicateError(name: string, schemaLabel: string, errorNode: SyntaxNode): CompileError;
6
+ };
7
+ export declare const tablePartialModule: GlobalModule;
@@ -0,0 +1,23 @@
1
+ import { default as Compiler } from '../../../compiler/index';
2
+ import { default as Report } from '../../types/report';
3
+ import { SchemaElement } from '../../types/schemaJson';
4
+ import { Filepath } from '../../types/filepath';
5
+ import { TablePartialSymbol } from '../../types/symbol/symbols';
6
+ export declare class TablePartialInterpreter {
7
+ private declarationNode;
8
+ private compiler;
9
+ private symbol?;
10
+ private filepath;
11
+ private tablePartial;
12
+ private pkColumns;
13
+ constructor(compiler: Compiler, symbol: TablePartialSymbol, filepath: Filepath);
14
+ interpret(): Report<SchemaElement | SchemaElement[] | undefined>;
15
+ private interpretName;
16
+ private interpretSettingList;
17
+ private interpretBody;
18
+ private interpretSubElements;
19
+ private interpretFields;
20
+ private interpretColumn;
21
+ private interpretIndexes;
22
+ private interpretChecks;
23
+ }
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../compiler/index';
2
+ import { Filepath } from '../types/filepath';
3
+ import { NodeMetadata } from '../types/symbol/metadata';
4
+ import { SyntaxNode } from '../types/nodes';
5
+ import { default as Report } from '../types/report';
6
+ import { Module, PassThrough } from '../types/module';
7
+ import { SchemaElement } from '../types/schemaJson';
8
+ import { NodeSymbol } from '../types/symbol';
9
+ export interface GlobalModule extends Module {
10
+ nodeSymbol?(compiler: Compiler, node: SyntaxNode): Report<NodeSymbol> | Report<PassThrough>;
11
+ symbolMembers?(compiler: Compiler, symbol: NodeSymbol): Report<NodeSymbol[]> | Report<PassThrough>;
12
+ nodeReferee?(compiler: Compiler, node: SyntaxNode): Report<NodeSymbol | undefined> | Report<PassThrough>;
13
+ nodeMetadata?(compiler: Compiler, node: SyntaxNode): Report<NodeMetadata> | Report<PassThrough>;
14
+ bindNode?(compiler: Compiler, node: SyntaxNode): Report<void> | Report<PassThrough>;
15
+ interpretSymbol?(compiler: Compiler, symbol: NodeSymbol, filepath: Filepath): Report<SchemaElement | SchemaElement[] | undefined> | Report<PassThrough>;
16
+ interpretMetadata?(compiler: Compiler, metadata: NodeMetadata, filepath: Filepath): Report<SchemaElement | SchemaElement[] | undefined> | Report<PassThrough>;
17
+ }