@dbml/parse 4.0.0 → 5.0.0-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.
@@ -18,7 +18,7 @@ export declare const enum ScopeKind {
18
18
  CUSTOM = 7,
19
19
  TOPLEVEL = 8,
20
20
  TABLEPARTIAL = 9,
21
- CONSTRAINTS = 10
21
+ CHECKS = 10
22
22
  }
23
23
  export default class Compiler {
24
24
  private source;
@@ -1,5 +1,5 @@
1
1
  import { default as ElementBinder } from './elementBinder';
2
- export default class ConstraintsBinder extends ElementBinder {
2
+ export default class ChecksBinder extends ElementBinder {
3
3
  protected subfield: {
4
4
  arg: {
5
5
  argBinderRules: {
@@ -25,7 +25,7 @@ export default class TableBinder extends ElementBinder {
25
25
  default: {
26
26
  shouldBind: false;
27
27
  };
28
- constraint: {
28
+ check: {
29
29
  shouldBind: false;
30
30
  };
31
31
  };
@@ -25,6 +25,9 @@ export default class TablePartialBinder extends ElementBinder {
25
25
  default: {
26
26
  shouldBind: false;
27
27
  };
28
+ check: {
29
+ shouldBind: false;
30
+ };
28
31
  };
29
32
  };
30
33
  protected settingList: {};
@@ -1,5 +1,6 @@
1
1
  import { SyntaxToken } from '../../lexer/tokens';
2
2
  import { ElementDeclarationNode } from '../../parser/nodes';
3
+ import { default as ChecksBinder } from './elementBinder/checks';
3
4
  import { default as CustomBinder } from './elementBinder/custom';
4
5
  import { default as EnumBinder } from './elementBinder/enum';
5
6
  import { default as IndexesBinder } from './elementBinder/indexes';
@@ -11,4 +12,4 @@ import { default as TableGroupBinder } from './elementBinder/tableGroup';
11
12
  import { default as TablePartialBinder } from './elementBinder/tablePartial';
12
13
  export declare function pickBinder(element: ElementDeclarationNode & {
13
14
  type: SyntaxToken;
14
- }): typeof EnumBinder | typeof TableBinder | typeof TableGroupBinder | typeof ProjectBinder | typeof RefBinder | typeof NoteBinder | typeof IndexesBinder | typeof TablePartialBinder | typeof CustomBinder;
15
+ }): typeof EnumBinder | typeof TableBinder | typeof TableGroupBinder | typeof ProjectBinder | typeof RefBinder | typeof NoteBinder | typeof IndexesBinder | typeof TablePartialBinder | typeof ChecksBinder | typeof CustomBinder;
@@ -7,7 +7,7 @@ export declare enum ElementKind {
7
7
  Indexes = "indexes",
8
8
  TableGroup = "tablegroup",
9
9
  TablePartial = "tablepartial",
10
- Constraints = "constraints"
10
+ Check = "checks"
11
11
  }
12
12
  export declare enum SettingName {
13
13
  Color = "color",
@@ -23,7 +23,7 @@ export declare enum SettingName {
23
23
  Default = "default",
24
24
  Name = "name",
25
25
  Type = "type",
26
- Constraint = "constraint",
26
+ Check = "check",
27
27
  Update = "update",
28
28
  Delete = "delete"
29
29
  }
@@ -3,8 +3,8 @@ import { CompileError } from '../../../errors';
3
3
  import { ElementDeclarationNode } from '../../../parser/nodes';
4
4
  import { SyntaxToken } from '../../../lexer/tokens';
5
5
  import { ElementValidator } from '../types';
6
- import { default as SymbolTable } from '../../../analyzer/symbol/symbolTable';
7
- export default class ConstraintsValidator implements ElementValidator {
6
+ import { default as SymbolTable } from '../../symbol/symbolTable';
7
+ export default class ChecksValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
10
10
  private symbolFactory;
@@ -3,7 +3,7 @@ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode }
3
3
  import { default as SymbolFactory } from '../../symbol/factory';
4
4
  import { SyntaxToken } from '../../../lexer/tokens';
5
5
  import { ElementValidator } from '../types';
6
- import { default as SymbolTable } from '../../../analyzer/symbol/symbolTable';
6
+ import { default as SymbolTable } from '../../symbol/symbolTable';
7
7
  export default class CustomValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
@@ -3,7 +3,7 @@ import { CompileError } from '../../../errors';
3
3
  import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../../parser/nodes';
4
4
  import { SyntaxToken } from '../../../lexer/tokens';
5
5
  import { ElementValidator } from '../types';
6
- import { default as SymbolTable } from '../../../analyzer/symbol/symbolTable';
6
+ import { default as SymbolTable } from '../../symbol/symbolTable';
7
7
  export default class EnumValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
@@ -3,7 +3,7 @@ import { CompileError } from '../../../errors';
3
3
  import { ElementDeclarationNode, SyntaxNode } from '../../../parser/nodes';
4
4
  import { SyntaxToken } from '../../../lexer/tokens';
5
5
  import { ElementValidator } from '../types';
6
- import { default as SymbolTable } from '../../../analyzer/symbol/symbolTable';
6
+ import { default as SymbolTable } from '../../symbol/symbolTable';
7
7
  export default class IndexesValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
@@ -3,7 +3,7 @@ import { CompileError } from '../../../errors';
3
3
  import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../../parser/nodes';
4
4
  import { SyntaxToken } from '../../../lexer/tokens';
5
5
  import { ElementValidator } from '../types';
6
- import { default as SymbolTable } from '../../../analyzer/symbol/symbolTable';
6
+ import { default as SymbolTable } from '../../symbol/symbolTable';
7
7
  export default class ProjectValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
@@ -3,7 +3,7 @@ import { default as SymbolFactory } from '../../symbol/factory';
3
3
  import { CompileError } from '../../../errors';
4
4
  import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../../parser/nodes';
5
5
  import { ElementValidator } from '../types';
6
- import { default as SymbolTable } from '../../../analyzer/symbol/symbolTable';
6
+ import { default as SymbolTable } from '../../symbol/symbolTable';
7
7
  export default class RefValidator implements ElementValidator {
8
8
  private declarationNode;
9
9
  private publicSymbolTable;
@@ -13,10 +13,10 @@ import { default as SymbolFactory } from '../symbol/factory';
13
13
  import { default as Report } from '../../report';
14
14
  import { CompileError } from '../../errors';
15
15
  import { default as TablePartialValidator } from './elementValidators/tablePartial';
16
- import { default as ConstraintsValidator } from './elementValidators/constraints';
16
+ import { default as ChecksValidator } from './elementValidators/checks';
17
17
  export declare function pickValidator(element: ElementDeclarationNode & {
18
18
  type: SyntaxToken;
19
- }): typeof CustomValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator | typeof TablePartialValidator | typeof ConstraintsValidator;
19
+ }): typeof CustomValidator | typeof EnumValidator | typeof TableValidator | typeof TableGroupValidator | typeof ProjectValidator | typeof RefValidator | typeof NoteValidator | typeof IndexesValidator | typeof TablePartialValidator | typeof ChecksValidator;
20
20
  export declare function isValidName(nameNode: SyntaxNode): boolean;
21
21
  export declare function isValidAlias(aliasNode: SyntaxNode): aliasNode is PrimaryExpressionNode & {
22
22
  expression: VariableNode;
@@ -84,12 +84,12 @@ export declare enum CompileErrorCode {
84
84
  DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068,
85
85
  UNKNOWN_TABLE_PARTIAL_SETTING = 3069,
86
86
  INVALID_TABLE_SETTING_VALUE = 3070,
87
- INVALID_CONSTRAINTS_CONTEXT = 3071,
88
- INVALID_CONSTRAINTS_FIELD = 3072,
89
- INVALID_CONSTRAINT = 3073,
90
- UNKNOWN_CONSTRAINT_SETTING = 3074,
91
- DUPLICATE_CONSTRAINT_SETTING = 3075,
92
- INVALID_CONSTRAINT_SETTING_VALUE = 3076,
87
+ INVALID_CHECKS_CONTEXT = 3071,
88
+ INVALID_CHECKS_FIELD = 3072,
89
+ INVALID_CHECK = 3073,
90
+ UNKNOWN_CHECK_SETTING = 3074,
91
+ DUPLICATE_CHECK_SETTING = 3075,
92
+ INVALID_CHECK_SETTING_VALUE = 3076,
93
93
  BINDING_ERROR = 4000,
94
94
  UNSUPPORTED = 5000,
95
95
  CIRCULAR_REF = 5001,
@@ -17,6 +17,6 @@ export declare class TableInterpreter implements ElementInterpreter {
17
17
  private interpretFields;
18
18
  private interpretColumn;
19
19
  private interpretIndexes;
20
- private interpretConstraints;
20
+ private interpretChecks;
21
21
  private registerInlineRefToEnv;
22
22
  }
@@ -15,5 +15,5 @@ export declare class TablePartialInterpreter implements ElementInterpreter {
15
15
  private interpretFields;
16
16
  private interpretColumn;
17
17
  private interpretIndexes;
18
- private interpretConstraints;
18
+ private interpretChecks;
19
19
  }
@@ -41,7 +41,7 @@ export interface Table {
41
41
  schemaName: null | string;
42
42
  alias: string | null;
43
43
  fields: Column[];
44
- constraints: Constraint[];
44
+ checks: Check[];
45
45
  partials: TablePartialInjection[];
46
46
  token: TokenPosition;
47
47
  indexes: Index[];
@@ -67,7 +67,7 @@ export interface Column {
67
67
  type: ColumnType;
68
68
  token: TokenPosition;
69
69
  inline_refs: InlineRef[];
70
- constraints: Constraint[];
70
+ checks: Check[];
71
71
  pk?: boolean;
72
72
  dbdefault?: {
73
73
  type: 'number' | 'string' | 'boolean' | 'expression';
@@ -97,7 +97,7 @@ export interface Index {
97
97
  };
98
98
  type?: string;
99
99
  }
100
- export interface Constraint {
100
+ export interface Check {
101
101
  token: TokenPosition;
102
102
  expression: string;
103
103
  name?: string;
@@ -170,7 +170,7 @@ export interface TablePartial {
170
170
  token: TokenPosition;
171
171
  indexes: Index[];
172
172
  headerColor?: string;
173
- constraints: Constraint[];
173
+ checks: Check[];
174
174
  note?: {
175
175
  value: string;
176
176
  token: TokenPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbml/parse",
3
- "version": "4.0.0",
3
+ "version": "5.0.0-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "Holistics <dev@holistics.io>",
6
6
  "license": "Apache-2.0",
@@ -49,5 +49,5 @@
49
49
  "engines": {
50
50
  "node": ">=18"
51
51
  },
52
- "gitHead": "defacb4ec78893de46225948499feea5bf2932e2"
52
+ "gitHead": "630548187910efa893579e80ab07f447df1ef61e"
53
53
  }