@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
@@ -1,25 +0,0 @@
1
- import { ElementValidator } from '../types';
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
- export default class NoteValidator implements ElementValidator {
8
- private declarationNode;
9
- private publicSymbolTable;
10
- private symbolFactory;
11
- constructor(declarationNode: ElementDeclarationNode & {
12
- type: SyntaxToken;
13
- }, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
14
- validate(): {
15
- errors: CompileError[];
16
- warnings: CompileWarning[];
17
- };
18
- private validateContext;
19
- private validateName;
20
- private validateAlias;
21
- private validateSettingList;
22
- validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
23
- validateFields(fields: FunctionApplicationNode[]): CompileError[];
24
- private validateSubElements;
25
- }
@@ -1,24 +0,0 @@
1
- import { ElementValidator } from '../types';
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
- export default class ProjectValidator implements ElementValidator {
8
- private declarationNode;
9
- private publicSymbolTable;
10
- private symbolFactory;
11
- constructor(declarationNode: ElementDeclarationNode & {
12
- type: SyntaxToken;
13
- }, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
14
- validate(): {
15
- errors: CompileError[];
16
- warnings: CompileWarning[];
17
- };
18
- private validateContext;
19
- private validateName;
20
- private validateAlias;
21
- private validateSettingList;
22
- validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
23
- private validateSubElements;
24
- }
@@ -1,29 +0,0 @@
1
- import { ElementValidator } from '../types';
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
- export default class RecordsValidator implements ElementValidator {
8
- private declarationNode;
9
- private publicSymbolTable;
10
- private symbolFactory;
11
- constructor(declarationNode: ElementDeclarationNode & {
12
- type: SyntaxToken;
13
- }, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
14
- validate(): {
15
- errors: CompileError[];
16
- warnings: CompileWarning[];
17
- };
18
- private validateContext;
19
- private validateName;
20
- private validateTopLevelName;
21
- private validateInsideTableName;
22
- private validateAlias;
23
- private validateSettingList;
24
- validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
25
- private validateDataRows;
26
- private validateDataRow;
27
- private isValidRecordValue;
28
- private validateSubElements;
29
- }
@@ -1,26 +0,0 @@
1
- import { ElementValidator } from '../types';
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
- export default class RefValidator implements ElementValidator {
8
- private declarationNode;
9
- private publicSymbolTable;
10
- private symbolFactory;
11
- constructor(declarationNode: ElementDeclarationNode & {
12
- type: SyntaxToken;
13
- }, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
14
- validate(): {
15
- errors: CompileError[];
16
- warnings: CompileWarning[];
17
- };
18
- private validateContext;
19
- private validateName;
20
- private validateAlias;
21
- private validateSettingList;
22
- validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
23
- validateFields(fields: FunctionApplicationNode[]): CompileError[];
24
- validateFieldSettings(settings: ListExpressionNode): CompileError[];
25
- private validateSubElements;
26
- }
@@ -1,28 +0,0 @@
1
- import { ElementValidator } from '../types';
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
- export default class TableValidator implements ElementValidator {
8
- private declarationNode;
9
- private symbolFactory;
10
- private publicSymbolTable;
11
- constructor(declarationNode: ElementDeclarationNode & {
12
- type: SyntaxToken;
13
- }, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
14
- validate(): {
15
- errors: CompileError[];
16
- warnings: CompileWarning[];
17
- };
18
- private validateContext;
19
- private validateName;
20
- private validateAlias;
21
- private validateSettingList;
22
- registerElement(): CompileError[];
23
- validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
24
- validateFields(fields: FunctionApplicationNode[]): CompileError[];
25
- registerField(field: FunctionApplicationNode): CompileError[];
26
- validateFieldSetting(parts: ExpressionNode[]): CompileError[];
27
- private validateSubElements;
28
- }
@@ -1,27 +0,0 @@
1
- import { ElementValidator } from '../types';
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
- export default class TableGroupValidator implements ElementValidator {
8
- private declarationNode;
9
- private publicSymbolTable;
10
- private symbolFactory;
11
- constructor(declarationNode: ElementDeclarationNode & {
12
- type: SyntaxToken;
13
- }, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
14
- validate(): {
15
- errors: CompileError[];
16
- warnings: CompileWarning[];
17
- };
18
- private validateContext;
19
- private validateName;
20
- private validateAlias;
21
- registerElement(): CompileError[];
22
- private validateSettingList;
23
- validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
24
- validateFields(fields: FunctionApplicationNode[]): CompileError[];
25
- private validateSubElements;
26
- registerField(field: FunctionApplicationNode): CompileError[];
27
- }
@@ -1,28 +0,0 @@
1
- import { ElementValidator } from '../types';
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
- export default class TablePartialValidator implements ElementValidator {
8
- private declarationNode;
9
- private symbolFactory;
10
- private publicSymbolTable;
11
- constructor(declarationNode: ElementDeclarationNode & {
12
- type: SyntaxToken;
13
- }, publicSymbolTable: SymbolTable, symbolFactory: SymbolFactory);
14
- validate(): {
15
- errors: CompileError[];
16
- warnings: CompileWarning[];
17
- };
18
- private validateContext;
19
- private validateName;
20
- private validateAlias;
21
- private validateSettingList;
22
- registerElement(): CompileError[];
23
- validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
24
- validateFields(fields: FunctionApplicationNode[]): CompileError[];
25
- registerField(field: FunctionApplicationNode): CompileError[];
26
- validateFieldSetting(parts: ExpressionNode[]): CompileError[];
27
- private validateSubElements;
28
- }
@@ -1,7 +0,0 @@
1
- import { CompileError, CompileWarning } from '../../types/errors';
2
- export interface ElementValidator {
3
- validate(): {
4
- errors: CompileError[];
5
- warnings: CompileWarning[];
6
- };
7
- }
@@ -1,65 +0,0 @@
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';
7
- import { default as CustomValidator } from './elementValidators/custom';
8
- import { default as DiagramViewValidator } from './elementValidators/diagramView';
9
- import { default as EnumValidator } from './elementValidators/enum';
10
- import { default as IndexesValidator } from './elementValidators/indexes';
11
- import { default as NoteValidator } from './elementValidators/note';
12
- import { default as ProjectValidator } from './elementValidators/project';
13
- import { default as RecordsValidator } from './elementValidators/records';
14
- import { default as RefValidator } from './elementValidators/ref';
15
- import { default as TableValidator } from './elementValidators/table';
16
- import { default as TableGroupValidator } from './elementValidators/tableGroup';
17
- import { default as TablePartialValidator } from './elementValidators/tablePartial';
18
- export declare function pickValidator(element: ElementDeclarationNode & {
19
- type: SyntaxToken;
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
- export declare function isValidName(nameNode: SyntaxNode): boolean;
22
- export declare function isValidAlias(aliasNode: SyntaxNode): aliasNode is PrimaryExpressionNode & {
23
- expression: VariableNode;
24
- };
25
- export declare function isSimpleName(nameNode: SyntaxNode): nameNode is PrimaryExpressionNode & {
26
- expression: VariableNode;
27
- };
28
- export declare function isValidSettingList(settingListNode: SyntaxNode): settingListNode is ListExpressionNode;
29
- export declare function hasComplexBody(node: ElementDeclarationNode): node is ElementDeclarationNode & {
30
- body: BlockExpressionNode;
31
- bodyColon: undefined;
32
- };
33
- export declare function hasSimpleBody(node: ElementDeclarationNode): node is ElementDeclarationNode & {
34
- bodyColon: SyntaxToken;
35
- };
36
- export declare function isValidPartialInjection(node?: SyntaxNode): node is PrefixExpressionNode & {
37
- op: {
38
- value: '~';
39
- };
40
- };
41
- export declare function registerSchemaStack(variables: string[], globalSchema: SymbolTable, symbolFactory: SymbolFactory): SymbolTable;
42
- export declare function isRelationshipOp(op?: string): boolean;
43
- export declare function isValidColor(value?: SyntaxNode): boolean;
44
- export declare function isValidDefaultValue(value?: SyntaxNode): boolean;
45
- export type SignedNumberExpression = (PrimaryExpressionNode & {
46
- expression: LiteralNode & {
47
- literal: {
48
- kind: SyntaxTokenKind.NUMERIC_LITERAL;
49
- };
50
- };
51
- }) | (PrefixExpressionNode & {
52
- op: '-' | '+';
53
- expression: SignedNumberExpression;
54
- });
55
- export declare function isExpressionASignedNumberExpression(value?: SyntaxNode): value is SignedNumberExpression;
56
- export declare function isUnaryRelationship(value?: SyntaxNode): value is PrefixExpressionNode;
57
- export declare function isTupleOfVariables(value?: SyntaxNode): value is TupleExpressionNode & {
58
- elementList: (PrimaryExpressionNode & {
59
- expression: VariableNode;
60
- })[];
61
- };
62
- export declare function isValidColumnType(type: SyntaxNode): boolean;
63
- export declare function aggregateSettingList(settingList?: ListExpressionNode): Report<{
64
- [index: string]: AttributeNode[];
65
- }>;
@@ -1,10 +0,0 @@
1
- import { ProgramNode } from '../../types/nodes';
2
- import { default as Report } from '../../types/report';
3
- import { default as SymbolFactory } from '../../types/symbol/factory';
4
- export default class Validator {
5
- private ast;
6
- private publicSchemaSymbol;
7
- private symbolFactory;
8
- constructor(ast: ProgramNode, symbolFactory: SymbolFactory);
9
- validate(): Report<ProgramNode>;
10
- }
@@ -1,13 +0,0 @@
1
- import { ElementInterpreter, InterpreterDatabase } from '../types';
2
- import { CompileError } from '../../types/errors';
3
- import { ElementDeclarationNode } from '../../types/nodes';
4
- export declare class DiagramViewInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private diagramView;
8
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
9
- interpret(): CompileError[];
10
- private interpretName;
11
- private interpretBody;
12
- private interpretSubBlock;
13
- }
@@ -1,12 +0,0 @@
1
- import { CompileError } from '../../types/errors';
2
- import { ElementDeclarationNode } from '../../types/nodes';
3
- import { ElementInterpreter, InterpreterDatabase } from '../types';
4
- export declare class EnumInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private enum;
8
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
9
- interpret(): CompileError[];
10
- private interpretName;
11
- private interpretBody;
12
- }
@@ -1,12 +0,0 @@
1
- import { CompileError } from '../../types/errors';
2
- import { ElementDeclarationNode } from '../../types/nodes';
3
- import { ElementInterpreter, InterpreterDatabase } from '../types';
4
- export declare class ProjectInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private project;
8
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
9
- interpret(): CompileError[];
10
- private interpretName;
11
- private interpretBody;
12
- }
@@ -1,14 +0,0 @@
1
- import { CompileError } from '../../types/errors';
2
- import { ElementDeclarationNode } from '../../types/nodes';
3
- import { ElementInterpreter, InterpreterDatabase } from '../types';
4
- export declare class RefInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private container;
8
- private ref;
9
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
10
- interpret(): CompileError[];
11
- private interpretName;
12
- private interpretBody;
13
- private interpretField;
14
- }
@@ -1,14 +0,0 @@
1
- import { CompileError } from '../../types/errors';
2
- import { ElementDeclarationNode } from '../../types/nodes';
3
- import { ElementInterpreter, InterpreterDatabase } from '../types';
4
- export declare class StickyNoteInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private note;
8
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
9
- interpret(): CompileError[];
10
- private interpretName;
11
- private interpretSettingList;
12
- private interpretBody;
13
- private interpretNote;
14
- }
@@ -1,22 +0,0 @@
1
- import { CompileError } from '../../types/errors';
2
- import { ElementDeclarationNode } from '../../types/nodes';
3
- import { ElementInterpreter, InterpreterDatabase } from '../types';
4
- export declare class TableInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private table;
8
- private pkColumns;
9
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
10
- interpret(): CompileError[];
11
- private interpretName;
12
- private interpretAlias;
13
- private interpretSettingList;
14
- private interpretBody;
15
- private interpretSubElements;
16
- private interpretInjection;
17
- private interpretFields;
18
- private interpretColumn;
19
- private interpretIndexes;
20
- private interpretChecks;
21
- private registerInlineRefToEnv;
22
- }
@@ -1,15 +0,0 @@
1
- import { CompileError } from '../../types/errors';
2
- import { ElementDeclarationNode } from '../../types/nodes';
3
- import { ElementInterpreter, InterpreterDatabase } from '../types';
4
- export declare class TableGroupInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private tableGroup;
8
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
9
- interpret(): CompileError[];
10
- private interpretName;
11
- private interpretBody;
12
- private interpretSubElements;
13
- private interpretFields;
14
- private interpretSettingList;
15
- }
@@ -1,19 +0,0 @@
1
- import { CompileError } from '../../types/errors';
2
- import { ElementDeclarationNode } from '../../types/nodes';
3
- import { ElementInterpreter, InterpreterDatabase } from '../types';
4
- export declare class TablePartialInterpreter implements ElementInterpreter {
5
- private declarationNode;
6
- private env;
7
- private tablePartial;
8
- private pkColumns;
9
- constructor(declarationNode: ElementDeclarationNode, env: InterpreterDatabase);
10
- interpret(): CompileError[];
11
- private interpretName;
12
- private interpretSettingList;
13
- private interpretBody;
14
- private interpretSubElements;
15
- private interpretFields;
16
- private interpretColumn;
17
- private interpretIndexes;
18
- private interpretChecks;
19
- }
@@ -1,10 +0,0 @@
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';
5
- export default class Interpreter {
6
- ast: ProgramNode;
7
- env: InterpreterDatabase;
8
- constructor(ast: ProgramNode);
9
- interpret(): Report<Database>;
10
- }
@@ -1,10 +0,0 @@
1
- import { ElementDeclarationNode } from '../../types/nodes';
2
- import { default as Report } from '../../types/report';
3
- import { InterpreterDatabase } from '../types';
4
- export declare class RecordsInterpreter {
5
- private env;
6
- private tableToRecordMap;
7
- constructor(env: InterpreterDatabase);
8
- interpret(elements: ElementDeclarationNode[]): Report<void>;
9
- private validateConstraints;
10
- }
@@ -1,3 +0,0 @@
1
- import { InterpreterDatabase } from '../../../types';
2
- import { CompileError } from '../../../../types/errors';
3
- export declare function validateForeignKeys(env: InterpreterDatabase): CompileError[];
@@ -1,11 +0,0 @@
1
- import { TableRecordRow } from '../../../types';
2
- import { CompileError } from '../../../../types/errors';
3
- import { Column, RecordValue } from '../../../../types/schemaJson';
4
- export declare function extractKeyValueWithDefault(row: Record<string, RecordValue>, columnNames: string[], columns?: (Column | undefined)[]): string;
5
- export declare function hasNullWithoutDefaultInKey(row: Record<string, RecordValue>, columnNames: string[], columns?: (Column | undefined)[]): boolean;
6
- export declare function isAutoIncrementColumn(column: Column): boolean;
7
- export declare function hasNotNullWithDefault(column: Column): boolean;
8
- export declare function formatFullColumnName(schemaName: string | null, tableName: string, columnName: string): string;
9
- export declare function formatFullColumnNames(schemaName: string | null, tableName: string, columnNames: string[]): string;
10
- export declare function formatValues(row: Record<string, RecordValue>, columnNames: string[]): string;
11
- export declare function createConstraintErrors(row: TableRecordRow, columnNames: string[], message: string): CompileError[];
@@ -1,3 +0,0 @@
1
- import { InterpreterDatabase } from '../../../types';
2
- import { CompileError } from '../../../../types/errors';
3
- export declare function validatePrimaryKey(env: InterpreterDatabase): CompileError[];
@@ -1,3 +0,0 @@
1
- import { InterpreterDatabase } from '../../../types';
2
- import { CompileError } from '../../../../types/errors';
3
- export declare function validateUnique(env: InterpreterDatabase): CompileError[];
@@ -1,47 +0,0 @@
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, };
5
- export interface ElementInterpreter {
6
- interpret(): CompileError[];
7
- }
8
- export interface InterpreterDatabase {
9
- schema: [];
10
- tables: Map<ElementDeclarationNode, Table>;
11
- notes: Map<ElementDeclarationNode, Note>;
12
- refIds: {
13
- [refid: string]: SyntaxNode;
14
- };
15
- ref: Map<SyntaxNode, Ref>;
16
- enums: Map<ElementDeclarationNode, Enum>;
17
- tableOwnerGroup: {
18
- [tableid: string]: ElementDeclarationNode;
19
- };
20
- tableGroups: Map<ElementDeclarationNode, TableGroup>;
21
- tablePartials: Map<ElementDeclarationNode, TablePartial>;
22
- aliases: Alias[];
23
- project: Map<ElementDeclarationNode, Project>;
24
- records: Map<Table, {
25
- element: ElementDeclarationNode;
26
- rows: TableRecordRow[];
27
- }>;
28
- recordsElements: ElementDeclarationNode[];
29
- cachedMergedTables: Map<Table, Table>;
30
- source: string;
31
- diagramViews: Map<ElementDeclarationNode, DiagramView>;
32
- diagramViewWildcards: Map<DiagramView, Set<string>>;
33
- diagramViewExplicitlySet: Map<DiagramView, Set<string>>;
34
- }
35
- export interface TableRecordRow {
36
- values: Record<string, {
37
- value: any;
38
- type: RecordValueType;
39
- node?: SyntaxNode;
40
- }>;
41
- node: FunctionApplicationNode;
42
- columnNodes: Record<string, SyntaxNode>;
43
- }
44
- export interface TableRecordsData {
45
- table: Table;
46
- rows: TableRecordRow[];
47
- }
@@ -1,37 +0,0 @@
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';
7
- export declare function extractNamesFromRefOperand(operand: SyntaxNode, owner?: Table): {
8
- schemaName: string | null;
9
- tableName: string;
10
- fieldNames: string[];
11
- };
12
- export declare function getMultiplicities(op: string): [RelationCardinality, RelationCardinality];
13
- export declare function getTokenPosition(node: SyntaxNode): TokenPosition;
14
- export declare function getColumnSymbolsOfRefOperand(ref: SyntaxNode): ColumnSymbol[];
15
- export declare function extractElementName(nameNode: SyntaxNode): {
16
- schemaName: string[];
17
- name: string;
18
- };
19
- export declare function extractColor(node: PrimaryExpressionNode & {
20
- expression: LiteralNode;
21
- } & {
22
- literal: {
23
- kind: SyntaxTokenKind.COLOR_LITERAL;
24
- };
25
- }): string;
26
- export declare function getRefId(sym1: ColumnSymbol, sym2: ColumnSymbol): string;
27
- export declare function getRefId(sym1: ColumnSymbol[], sym2: ColumnSymbol[]): string;
28
- export declare function isSameEndpoint(sym1: ColumnSymbol, sym2: ColumnSymbol): boolean;
29
- export declare function isSameEndpoint(sym1: ColumnSymbol[], sym2: ColumnSymbol[]): boolean;
30
- export declare function normalizeNoteContent(content: string): string;
31
- export declare function processDefaultValue(valueNode?: SyntaxNode): {
32
- type: 'string' | 'number' | 'boolean' | 'expression';
33
- value: string | number;
34
- } | undefined;
35
- export declare function processColumnType(typeNode: SyntaxNode, env: InterpreterDatabase): Report<ColumnType>;
36
- export declare function mergeTableAndPartials(table: Table, env: InterpreterDatabase): Table;
37
- export declare function extractInlineRefsFromTablePartials(table: Table, env: InterpreterDatabase): Ref[];
@@ -1,33 +0,0 @@
1
- export type NodeSymbolIndex = string;
2
- export declare enum SymbolKind {
3
- Schema = "Schema",
4
- Table = "Table",
5
- Column = "Column",
6
- TableGroup = "TableGroup",
7
- TableGroupField = "TableGroup field",
8
- Enum = "Enum",
9
- EnumField = "Enum field",
10
- StickyNote = "Note",
11
- TablePartial = "TablePartial",
12
- PartialInjection = "PartialInjection",
13
- DiagramView = "DiagramView",
14
- DiagramViewField = "DiagramView field"
15
- }
16
- export declare function createSchemaSymbolIndex(key: string): NodeSymbolIndex;
17
- export declare function createTableSymbolIndex(key: string): NodeSymbolIndex;
18
- export declare function createColumnSymbolIndex(key: string): NodeSymbolIndex;
19
- export declare function createEnumSymbolIndex(key: string): NodeSymbolIndex;
20
- export declare function createEnumFieldSymbolIndex(key: string): NodeSymbolIndex;
21
- export declare function createTableGroupSymbolIndex(key: string): NodeSymbolIndex;
22
- export declare function createTableGroupFieldSymbolIndex(key: string): NodeSymbolIndex;
23
- export declare function createStickyNoteSymbolIndex(key: string): NodeSymbolIndex;
24
- export declare function createTablePartialSymbolIndex(key: string): NodeSymbolIndex;
25
- export declare function createPartialInjectionSymbolIndex(key: string): NodeSymbolIndex;
26
- export declare function createDiagramViewSymbolIndex(key: string): NodeSymbolIndex;
27
- export declare function createDiagramViewFieldSymbolIndex(key: string): NodeSymbolIndex;
28
- export declare function createNodeSymbolIndex(key: string, symbolKind: SymbolKind): NodeSymbolIndex;
29
- export declare function destructureIndex(id: NodeSymbolIndex): {
30
- name: string;
31
- kind: SymbolKind;
32
- } | undefined;
33
- export declare function isPublicSchemaIndex(id: NodeSymbolIndex): boolean;
@@ -1,12 +0,0 @@
1
- import { NodeSymbolIndex } from './symbolIndex';
2
- import { NodeSymbol } from './symbols';
3
- export default class SymbolTable {
4
- private table;
5
- constructor();
6
- has(id: NodeSymbolIndex): boolean;
7
- set(id: NodeSymbolIndex, value: NodeSymbol): void;
8
- get(id: NodeSymbolIndex): NodeSymbol | undefined;
9
- get(id: NodeSymbolIndex, defaultValue: NodeSymbol): NodeSymbol;
10
- entries(): IterableIterator<[NodeSymbolIndex, NodeSymbol]>;
11
- forEach(callback: (value: NodeSymbol, key: NodeSymbolIndex) => void): void;
12
- }
@@ -1,4 +0,0 @@
1
- import { NodeSymbol } from '.';
2
- import { NodeSymbolIndex, SymbolKind } from './symbolIndex';
3
- export declare function generatePossibleIndexes(name: string): NodeSymbolIndex[];
4
- export declare function getSymbolKind(symbol: NodeSymbol): SymbolKind;
@@ -1 +0,0 @@
1
- export declare function alternateLists<T, S>(firstList: T[], secondList: S[]): (T | S)[];
@@ -1 +0,0 @@
1
- export declare function convertStringToEnum<T extends Record<string, string>>(enumObj: T, value: string): T[keyof T] | undefined;