@dbml/parse 9.1.0 → 9.1.2-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.
- package/LICENSE +0 -0
- package/dist/__benchmarks__/compiler.benchmark.d.ts +0 -0
- package/dist/__benchmarks__/compiler.profile.d.ts +0 -0
- package/dist/dbml-parse.js +29 -19
- package/dist/dbml-parse.mjs +4828 -3792
- package/dist/index.d.ts +0 -0
- package/dist/src/compiler/index.d.ts +11 -7
- package/dist/src/compiler/projectLayout/index.d.ts +0 -0
- package/dist/src/compiler/projectLayout/layout.d.ts +0 -0
- package/dist/src/compiler/queries/canonicalName.d.ts +0 -0
- package/dist/src/compiler/queries/container/element.d.ts +0 -0
- package/dist/src/compiler/queries/container/index.d.ts +0 -0
- package/dist/src/compiler/queries/container/scope.d.ts +0 -0
- package/dist/src/compiler/queries/container/scopeKind.d.ts +0 -0
- package/dist/src/compiler/queries/container/stack.d.ts +0 -0
- package/dist/src/compiler/queries/container/token.d.ts +0 -0
- package/dist/src/compiler/queries/files/fileDependencies.d.ts +0 -0
- package/dist/src/compiler/queries/files/reachableFiles.d.ts +0 -0
- package/dist/src/compiler/queries/files/usableMembers.d.ts +0 -0
- package/dist/src/compiler/queries/legacy/parse.d.ts +0 -0
- package/dist/src/compiler/queries/legacy/symbol.d.ts +0 -0
- package/dist/src/compiler/queries/legacy/token.d.ts +0 -0
- package/dist/src/compiler/queries/nodeAtPosition.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/bind.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/index.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/interpret.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/parse.d.ts +0 -0
- package/dist/src/compiler/queries/pipeline/validate.d.ts +0 -0
- package/dist/src/compiler/queries/resolutionIndex.d.ts +0 -0
- package/dist/src/compiler/queries/symbol/lookupMembers.d.ts +0 -0
- package/dist/src/compiler/queries/symbol/symbolAliases.d.ts +0 -0
- package/dist/src/compiler/queries/symbol/symbolUses.d.ts +0 -0
- package/dist/src/compiler/queries/transform/applyTextEdits.d.ts +0 -0
- package/dist/src/compiler/queries/transform/index.d.ts +3 -1
- package/dist/src/compiler/queries/transform/renameTable.d.ts +2 -2
- package/dist/src/compiler/queries/transform/syncDep.d.ts +54 -0
- package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +0 -0
- package/dist/src/compiler/queries/transform/types.d.ts +48 -0
- package/dist/src/compiler/queries/transform/updateElementSetting.d.ts +6 -0
- package/dist/src/compiler/queries/transform/utils/index.d.ts +26 -0
- package/dist/src/compiler/queries/transform/utils/ref.d.ts +15 -0
- package/dist/src/compiler/queries/utils.d.ts +6 -0
- package/dist/src/compiler/types.d.ts +9 -8
- package/dist/src/constants.d.ts +0 -0
- package/dist/src/core/global_modules/checks/bind.d.ts +0 -0
- package/dist/src/core/global_modules/checks/index.d.ts +0 -0
- package/dist/src/core/global_modules/checks/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/dep/bind.d.ts +18 -0
- package/dist/src/core/global_modules/dep/index.d.ts +2 -0
- package/dist/src/core/global_modules/dep/interpret.d.ts +18 -0
- package/dist/src/core/global_modules/diagramView/bind.d.ts +0 -0
- package/dist/src/core/global_modules/diagramView/index.d.ts +0 -0
- package/dist/src/core/global_modules/diagramView/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/enum/bind.d.ts +0 -0
- package/dist/src/core/global_modules/enum/index.d.ts +0 -0
- package/dist/src/core/global_modules/enum/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/index.d.ts +0 -0
- package/dist/src/core/global_modules/indexes/bind.d.ts +0 -0
- package/dist/src/core/global_modules/indexes/index.d.ts +0 -0
- package/dist/src/core/global_modules/indexes/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/metadata/bind.d.ts +0 -0
- package/dist/src/core/global_modules/metadata/index.d.ts +0 -0
- package/dist/src/core/global_modules/metadata/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/metadata/utils.d.ts +0 -0
- package/dist/src/core/global_modules/note/bind.d.ts +0 -0
- package/dist/src/core/global_modules/note/index.d.ts +0 -0
- package/dist/src/core/global_modules/note/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/program/bind.d.ts +0 -0
- package/dist/src/core/global_modules/program/index.d.ts +0 -0
- package/dist/src/core/global_modules/program/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/program/utils/dep.d.ts +4 -0
- package/dist/src/core/global_modules/program/utils/external.d.ts +3 -0
- package/dist/src/core/global_modules/program/utils/index.d.ts +3 -0
- package/dist/src/core/global_modules/program/utils/records.d.ts +6 -0
- package/dist/src/core/global_modules/project/bind.d.ts +0 -0
- package/dist/src/core/global_modules/project/index.d.ts +0 -0
- package/dist/src/core/global_modules/project/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/records/bind.d.ts +0 -0
- package/dist/src/core/global_modules/records/index.d.ts +0 -0
- package/dist/src/core/global_modules/records/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/fk.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/helper.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/index.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/pk.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/constraints/unique.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/data/index.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/data/sqlTypes.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/data/values.d.ts +0 -0
- package/dist/src/core/global_modules/records/utils/index.d.ts +0 -0
- package/dist/src/core/global_modules/ref/bind.d.ts +0 -0
- package/dist/src/core/global_modules/ref/constraint_fixes.d.ts +0 -0
- package/dist/src/core/global_modules/ref/index.d.ts +0 -0
- package/dist/src/core/global_modules/ref/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/schema/index.d.ts +0 -0
- package/dist/src/core/global_modules/table/bind.d.ts +2 -0
- package/dist/src/core/global_modules/table/index.d.ts +0 -0
- package/dist/src/core/global_modules/table/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/table/utils.d.ts +0 -0
- package/dist/src/core/global_modules/tableGroup/bind.d.ts +0 -0
- package/dist/src/core/global_modules/tableGroup/index.d.ts +0 -0
- package/dist/src/core/global_modules/tableGroup/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/tablePartial/bind.d.ts +0 -0
- package/dist/src/core/global_modules/tablePartial/index.d.ts +0 -0
- package/dist/src/core/global_modules/tablePartial/interpret.d.ts +0 -0
- package/dist/src/core/global_modules/types.d.ts +0 -0
- package/dist/src/core/global_modules/use/index.d.ts +0 -0
- package/dist/src/core/global_modules/utils.d.ts +2 -1
- package/dist/src/core/lexer/lexer.d.ts +0 -0
- package/dist/src/core/lexer/utils.d.ts +0 -0
- package/dist/src/core/local_modules/checks/index.d.ts +0 -0
- package/dist/src/core/local_modules/checks/validate.d.ts +0 -0
- package/dist/src/core/local_modules/custom/index.d.ts +0 -0
- package/dist/src/core/local_modules/custom/validate.d.ts +0 -0
- package/dist/src/core/local_modules/dep/index.d.ts +2 -0
- package/dist/src/core/local_modules/dep/validate.d.ts +19 -0
- package/dist/src/core/local_modules/diagramView/index.d.ts +0 -0
- package/dist/src/core/local_modules/diagramView/validate.d.ts +0 -0
- package/dist/src/core/local_modules/enum/index.d.ts +0 -0
- package/dist/src/core/local_modules/enum/validate.d.ts +0 -0
- package/dist/src/core/local_modules/index.d.ts +0 -0
- package/dist/src/core/local_modules/indexes/index.d.ts +0 -0
- package/dist/src/core/local_modules/indexes/validate.d.ts +0 -0
- package/dist/src/core/local_modules/metadata/index.d.ts +0 -0
- package/dist/src/core/local_modules/metadata/utils.d.ts +0 -0
- package/dist/src/core/local_modules/metadata/validate.d.ts +0 -0
- package/dist/src/core/local_modules/note/index.d.ts +0 -0
- package/dist/src/core/local_modules/note/validate.d.ts +0 -0
- package/dist/src/core/local_modules/program/index.d.ts +0 -0
- package/dist/src/core/local_modules/program/validate.d.ts +0 -0
- package/dist/src/core/local_modules/project/index.d.ts +0 -0
- package/dist/src/core/local_modules/project/validate.d.ts +0 -0
- package/dist/src/core/local_modules/records/index.d.ts +0 -0
- package/dist/src/core/local_modules/records/validate.d.ts +0 -0
- package/dist/src/core/local_modules/ref/index.d.ts +0 -0
- package/dist/src/core/local_modules/ref/validate.d.ts +0 -0
- package/dist/src/core/local_modules/table/index.d.ts +0 -0
- package/dist/src/core/local_modules/table/validate.d.ts +0 -0
- package/dist/src/core/local_modules/tableGroup/index.d.ts +0 -0
- package/dist/src/core/local_modules/tableGroup/validate.d.ts +0 -0
- package/dist/src/core/local_modules/tablePartial/index.d.ts +0 -0
- package/dist/src/core/local_modules/tablePartial/validate.d.ts +0 -0
- package/dist/src/core/local_modules/types.d.ts +0 -0
- package/dist/src/core/local_modules/use/index.d.ts +0 -0
- package/dist/src/core/local_modules/use/validate.d.ts +0 -0
- package/dist/src/core/parser/contextStack.d.ts +0 -0
- package/dist/src/core/parser/factory.d.ts +0 -0
- package/dist/src/core/parser/parser.d.ts +0 -0
- package/dist/src/core/parser/utils.d.ts +0 -0
- package/dist/src/core/types/errors.d.ts +62 -56
- package/dist/src/core/types/filepath.d.ts +0 -0
- package/dist/src/core/types/index.d.ts +0 -0
- package/dist/src/core/types/internable.d.ts +0 -0
- package/dist/src/core/types/keywords.d.ts +2 -0
- package/dist/src/core/types/module.d.ts +0 -0
- package/dist/src/core/types/nodes.d.ts +0 -0
- package/dist/src/core/types/position.d.ts +0 -0
- package/dist/src/core/types/relation.d.ts +0 -0
- package/dist/src/core/types/report.d.ts +0 -0
- package/dist/src/core/types/schemaJson/index.d.ts +0 -0
- package/dist/src/core/types/schemaJson/types.d.ts +36 -1
- package/dist/src/core/types/symbol/factory.d.ts +0 -0
- package/dist/src/core/types/symbol/index.d.ts +0 -0
- package/dist/src/core/types/symbol/metadata.d.ts +15 -1
- package/dist/src/core/types/symbol/symbols.d.ts +0 -0
- package/dist/src/core/types/tokens.d.ts +0 -0
- package/dist/src/core/utils/chars.d.ts +0 -0
- package/dist/src/core/utils/expression.d.ts +2 -1
- package/dist/src/core/utils/interpret.d.ts +0 -0
- package/dist/src/core/utils/note.d.ts +18 -0
- package/dist/src/core/utils/numbers.d.ts +0 -0
- package/dist/src/core/utils/setting.d.ts +13 -14
- package/dist/src/core/utils/span.d.ts +0 -0
- package/dist/src/core/utils/tokens.d.ts +0 -0
- package/dist/src/core/utils/validate.d.ts +2 -0
- package/dist/src/index.d.ts +5 -1
- package/dist/src/services/code_actions/provider.d.ts +0 -0
- package/dist/src/services/definition/provider.d.ts +0 -0
- package/dist/src/services/diagnostics/provider.d.ts +0 -0
- package/dist/src/services/index.d.ts +0 -0
- package/dist/src/services/monarch.d.ts +0 -0
- package/dist/src/services/references/provider.d.ts +0 -0
- package/dist/src/services/suggestions/crossFile.d.ts +0 -0
- package/dist/src/services/suggestions/provider.d.ts +3 -3
- package/dist/src/services/suggestions/recordRowSnippet.d.ts +0 -0
- package/dist/src/services/suggestions/use.d.ts +0 -0
- package/dist/src/services/suggestions/utils/index.d.ts +0 -0
- package/dist/src/services/suggestions/utils/useMerger.d.ts +0 -0
- package/dist/src/services/types.d.ts +0 -0
- package/dist/src/services/utils.d.ts +0 -0
- package/package.json +2 -2
- package/dist/src/compiler/queries/transform/utils.d.ts +0 -23
- package/dist/src/core/global_modules/program/utils.d.ts +0 -3
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -57,67 +57,73 @@ export declare enum CompileErrorCode {
|
|
|
57
57
|
INVALID_REF_FIELD = 3039,
|
|
58
58
|
EMPTY_REF = 3040,
|
|
59
59
|
REF_REDEFINED = 3041,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
60
|
+
INVALID_DEP_CONTEXT = 3042,
|
|
61
|
+
INVALID_DEP_FIELD = 3043,
|
|
62
|
+
INVALID_NOTE_CONTEXT = 3044,
|
|
63
|
+
INVALID_NOTE = 3045,
|
|
64
|
+
NOTE_REDEFINED = 3046,
|
|
65
|
+
NOTE_CONTENT_REDEFINED = 3047,
|
|
66
|
+
EMPTY_NOTE = 3048,
|
|
67
|
+
UNKNOWN_NOTE_SETTING = 3049,
|
|
68
|
+
DUPLICATE_NOTE_SETTING = 3050,
|
|
69
|
+
INVALID_NOTE_SETTING_VALUE = 3051,
|
|
70
|
+
INVALID_INDEXES_CONTEXT = 3052,
|
|
71
|
+
INVALID_INDEXES_FIELD = 3053,
|
|
72
|
+
INVALID_INDEX = 3054,
|
|
73
|
+
UNKNOWN_INDEX_SETTING = 3055,
|
|
74
|
+
DUPLICATE_INDEX_SETTING = 3056,
|
|
75
|
+
UNEXPECTED_INDEX_SETTING_VALUE = 3057,
|
|
76
|
+
INVALID_INDEX_SETTING_VALUE = 3058,
|
|
77
|
+
INVALID_PROJECT_CONTEXT = 3059,
|
|
78
|
+
PROJECT_REDEFINED = 3060,
|
|
79
|
+
INVALID_PROJECT_FIELD = 3061,
|
|
80
|
+
INVALID_CUSTOM_CONTEXT = 3062,
|
|
81
|
+
INVALID_CUSTOM_ELEMENT_VALUE = 3063,
|
|
82
|
+
INVALID_ELEMENT_IN_SIMPLE_BODY = 3064,
|
|
83
|
+
INVALID_TABLE_PARTIAL_CONTEXT = 3065,
|
|
84
|
+
INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3066,
|
|
85
|
+
INVALID_TABLE_PARTIAL_SETTING_VALUE = 3067,
|
|
86
|
+
DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3068,
|
|
87
|
+
DUPLICATE_TABLE_PARTIAL_SETTING = 3069,
|
|
88
|
+
INVALID_TABLE_PARTIAL_INJECTION = 3070,
|
|
89
|
+
INVALID_TABLE_PARTIAL_INJECTION_OP = 3071,
|
|
90
|
+
INVALID_TABLE_PARTIAL_INJECTION_NAME = 3072,
|
|
91
|
+
DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3073,
|
|
92
|
+
UNKNOWN_TABLE_PARTIAL_SETTING = 3074,
|
|
93
|
+
INVALID_TABLE_SETTING_VALUE = 3075,
|
|
94
|
+
INVALID_CHECKS_CONTEXT = 3076,
|
|
95
|
+
INVALID_CHECKS_FIELD = 3077,
|
|
96
|
+
INVALID_CHECK = 3078,
|
|
97
|
+
UNKNOWN_CHECK_SETTING = 3079,
|
|
98
|
+
DUPLICATE_CHECK_SETTING = 3080,
|
|
99
|
+
INVALID_CHECK_SETTING_VALUE = 3081,
|
|
100
|
+
INVALID_RECORDS_CONTEXT = 3082,
|
|
101
|
+
INVALID_RECORDS_NAME = 3083,
|
|
102
|
+
INVALID_RECORDS_FIELD = 3084,
|
|
103
|
+
DUPLICATE_COLUMN_REFERENCES_IN_RECORDS = 3085,
|
|
104
|
+
DUPLICATE_RECORDS_FOR_TABLE = 3086,
|
|
105
|
+
INVALID_USE_CONTEXT = 3087,
|
|
106
|
+
INVALID_USE_SPECIFIER_KIND = 3088,
|
|
107
|
+
INVALID_USE_SPECIFIER_NAME = 3089,
|
|
108
|
+
INVALID_DIAGRAMVIEW_CONTEXT = 3090,
|
|
109
|
+
DUPLICATE_DIAGRAMVIEW_NAME = 3091,
|
|
110
|
+
INVALID_DIAGRAMVIEW_FIELD = 3092,
|
|
111
|
+
DUPLICATE_DIAGRAMVIEW_FIELD = 3093,
|
|
110
112
|
BINDING_ERROR = 4000,
|
|
111
113
|
NONEXISTENT_MODULE = 4001,
|
|
112
114
|
UNSUPPORTED = 5000,
|
|
113
115
|
CIRCULAR_REF = 5001,
|
|
114
116
|
SAME_ENDPOINT = 5002,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
DEP_SELF_LOOP = 5003,
|
|
118
|
+
DEP_MIXED_DOWNSTREAM_TABLES = 5004,
|
|
119
|
+
DEP_DUPLICATE_DOWNSTREAM_TABLE = 5005,
|
|
120
|
+
DEP_MIXED_LEVEL = 5006,
|
|
121
|
+
UNEQUAL_FIELDS_BINARY_REF = 5007,
|
|
122
|
+
CONFLICTING_SETTING = 5008,
|
|
123
|
+
TABLE_REAPPEAR_IN_TABLEGROUP = 5009,
|
|
124
|
+
INVALID_METADATA_TARGET_KIND = 5010,
|
|
125
|
+
INVALID_METADATA_FIELD = 5011,
|
|
126
|
+
DUPLICATE_METADATA_FIELD = 5012
|
|
121
127
|
}
|
|
122
128
|
export interface RelatedLocation {
|
|
123
129
|
nodeOrToken: SyntaxNode | SyntaxToken;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,6 +2,7 @@ export declare enum ElementKind {
|
|
|
2
2
|
Table = "table",
|
|
3
3
|
Enum = "enum",
|
|
4
4
|
Ref = "ref",
|
|
5
|
+
Dep = "dep",
|
|
5
6
|
Note = "note",
|
|
6
7
|
Project = "project",
|
|
7
8
|
Indexes = "indexes",
|
|
@@ -24,6 +25,7 @@ export declare enum SettingName {
|
|
|
24
25
|
PrimaryKey = "primary key",
|
|
25
26
|
Unique = "unique",
|
|
26
27
|
Ref = "ref",
|
|
28
|
+
Dep = "dep",
|
|
27
29
|
NotNull = "not null",
|
|
28
30
|
Null = "null",
|
|
29
31
|
Increment = "increment",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -60,6 +60,7 @@ export interface Database {
|
|
|
60
60
|
tables: Table[];
|
|
61
61
|
notes: Note[];
|
|
62
62
|
refs: Ref[];
|
|
63
|
+
deps: Dep[];
|
|
63
64
|
enums: Enum[];
|
|
64
65
|
tableGroups: TableGroup[];
|
|
65
66
|
aliases: Alias[];
|
|
@@ -114,6 +115,7 @@ export interface Column {
|
|
|
114
115
|
type: ColumnType;
|
|
115
116
|
token: TokenPosition;
|
|
116
117
|
inline_refs: InlineRef[];
|
|
118
|
+
inline_deps: InlineDep[];
|
|
117
119
|
checks: Check[];
|
|
118
120
|
pk?: boolean;
|
|
119
121
|
dbdefault?: {
|
|
@@ -175,6 +177,39 @@ export interface RefEndpoint {
|
|
|
175
177
|
relation: RelationCardinality;
|
|
176
178
|
token: TokenPosition;
|
|
177
179
|
}
|
|
180
|
+
export interface Dep {
|
|
181
|
+
schemaName: string | null;
|
|
182
|
+
name: string | null;
|
|
183
|
+
edges: DepEdge[];
|
|
184
|
+
color?: Color;
|
|
185
|
+
note?: {
|
|
186
|
+
value: string;
|
|
187
|
+
token: TokenPosition;
|
|
188
|
+
};
|
|
189
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
190
|
+
token: TokenPosition;
|
|
191
|
+
}
|
|
192
|
+
export interface DepEdge {
|
|
193
|
+
upstream: DepEndpoint;
|
|
194
|
+
downstream: DepEndpoint;
|
|
195
|
+
token: TokenPosition;
|
|
196
|
+
}
|
|
197
|
+
export interface DepEndpoint {
|
|
198
|
+
schemaName: string | null;
|
|
199
|
+
tableName: string;
|
|
200
|
+
fieldNames: string[];
|
|
201
|
+
token: TokenPosition;
|
|
202
|
+
}
|
|
203
|
+
export declare const DEP_DOWNSTREAM: "->";
|
|
204
|
+
export declare const DEP_UPSTREAM: "<-";
|
|
205
|
+
export type DepDirection = typeof DEP_DOWNSTREAM | typeof DEP_UPSTREAM;
|
|
206
|
+
export interface InlineDep {
|
|
207
|
+
schemaName: string | null;
|
|
208
|
+
tableName: string;
|
|
209
|
+
fieldNames: string[];
|
|
210
|
+
direction: DepDirection;
|
|
211
|
+
token: TokenPosition;
|
|
212
|
+
}
|
|
178
213
|
export interface Enum {
|
|
179
214
|
name: string;
|
|
180
215
|
schemaName: string | null;
|
|
@@ -261,4 +296,4 @@ export type Project = Record<string, never> | {
|
|
|
261
296
|
token: TokenPosition;
|
|
262
297
|
[index: string & Omit<any, 'name' | 'tables' | 'refs' | 'enums' | 'tableGroups' | 'note' | 'tablePartials' | 'records'>]: string;
|
|
263
298
|
};
|
|
264
|
-
export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | Ref | RefEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue | MetadataValues;
|
|
299
|
+
export type SchemaElement = Database | Project | Table | Note | Column | ColumnType | Index | Check | InlineRef | InlineDep | Ref | RefEndpoint | Dep | DepEdge | DepEndpoint | Enum | EnumField | TableGroup | TableGroupField | Alias | TablePartial | TablePartialInjection | TableRecord | RecordValue | MetadataValues;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { default as Compiler } from '../../../compiler';
|
|
2
|
-
import { AttributeNode, ElementDeclarationNode, SyntaxNode } from '../nodes';
|
|
2
|
+
import { AttributeNode, ElementDeclarationNode, InfixExpressionNode, SyntaxNode } from '../nodes';
|
|
3
3
|
import { SyntaxToken } from '../tokens';
|
|
4
4
|
import { ColumnSymbol, NodeSymbol, ProgramSymbol, TablePartialSymbol, TableSymbol } from '../symbol';
|
|
5
5
|
import { Internable } from '../internable';
|
|
6
6
|
import { RelationshipOp, RelationCardinality } from '../relation';
|
|
7
7
|
export declare enum MetadataKind {
|
|
8
8
|
Ref = "ref",
|
|
9
|
+
Dep = "dep",
|
|
9
10
|
PartialRef = "partial ref",
|
|
10
11
|
TableChecks = "table checks",
|
|
11
12
|
Indexes = "indexes",
|
|
@@ -60,6 +61,19 @@ export declare class RefMetadata extends NodeMetadata {
|
|
|
60
61
|
rightToken(): SyntaxNode;
|
|
61
62
|
owners(compiler: Compiler): NodeSymbol[];
|
|
62
63
|
}
|
|
64
|
+
export declare class DepMetadata extends NodeMetadata {
|
|
65
|
+
declaration: ElementDeclarationNode | AttributeNode;
|
|
66
|
+
readonly kind = MetadataKind.Dep;
|
|
67
|
+
constructor(declaration: ElementDeclarationNode | AttributeNode);
|
|
68
|
+
container(compiler: Compiler): TableSymbol | undefined;
|
|
69
|
+
edgeExpressions(): InfixExpressionNode[];
|
|
70
|
+
upstreamColumns(compiler: Compiler): ColumnSymbol[][];
|
|
71
|
+
downstreamColumns(compiler: Compiler): ColumnSymbol[][];
|
|
72
|
+
upstreamTables(compiler: Compiler): (TableSymbol | undefined)[];
|
|
73
|
+
downstreamTables(compiler: Compiler): (TableSymbol | undefined)[];
|
|
74
|
+
private hostColumn;
|
|
75
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
76
|
+
}
|
|
63
77
|
export declare class PartialRefMetadata extends NodeMetadata {
|
|
64
78
|
readonly kind = MetadataKind.PartialRef;
|
|
65
79
|
constructor(declaration: SyntaxNode);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementDeclarationNode, FunctionApplicationNode, FunctionExpressionNode, IdentifierStreamNode, PrimaryExpressionNode, SyntaxNode, TupleExpressionNode, VariableNode } from '../types/nodes';
|
|
1
|
+
import { AttributeNode, ElementDeclarationNode, FunctionApplicationNode, FunctionExpressionNode, IdentifierStreamNode, PrimaryExpressionNode, SyntaxNode, TupleExpressionNode, VariableNode } from '../types/nodes';
|
|
2
2
|
import { SyntaxToken } from '../types/tokens';
|
|
3
3
|
export declare function extractVariableNode(value?: unknown): SyntaxToken | undefined;
|
|
4
4
|
export declare function extractStringFromIdentifierStream(stream?: IdentifierStreamNode): string | undefined;
|
|
@@ -35,3 +35,4 @@ export declare function extractVariableFromExpression(node?: SyntaxNode): string
|
|
|
35
35
|
export declare function extractVarNameFromPrimaryVariable(node?: PrimaryExpressionNode & {
|
|
36
36
|
expression: VariableNode;
|
|
37
37
|
}): string | undefined;
|
|
38
|
+
export declare function extractSettingName(attr: AttributeNode): string | undefined;
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SyntaxNode } from '../types/nodes';
|
|
2
|
+
import { TextEdit } from '../../compiler/queries/transform/applyTextEdits';
|
|
3
|
+
/**
|
|
4
|
+
* Produces a TextEdit that updates an existing note's value.
|
|
5
|
+
* Returns undefined if no note exists.
|
|
6
|
+
*/
|
|
7
|
+
export declare function updateNoteEdit(declaration: SyntaxNode, newValue: string): TextEdit | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Produces a TextEdit that removes an existing note.
|
|
10
|
+
* Returns undefined if no note exists.
|
|
11
|
+
*/
|
|
12
|
+
export declare function removeNoteEdit(declaration: SyntaxNode): TextEdit | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Produces a TextEdit that adds a note to an element.
|
|
15
|
+
* Prioritizes body note form for block elements, falls back to setting attribute.
|
|
16
|
+
* Returns undefined if a note already exists.
|
|
17
|
+
*/
|
|
18
|
+
export declare function addNoteEdit(declaration: SyntaxNode, value: string): TextEdit | undefined;
|
|
File without changes
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { SyntaxNode } from '../types/nodes';
|
|
1
|
+
import { ListExpressionNode, AttributeNode, ElementDeclarationNode, SyntaxNode } from '../types/nodes';
|
|
2
2
|
import { TextEdit } from '../../compiler/queries/transform/applyTextEdits';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export type SettingLocation = {
|
|
4
|
+
kind: 'attribute';
|
|
5
|
+
settingsList: ListExpressionNode;
|
|
6
|
+
settingNode: AttributeNode;
|
|
7
|
+
settingIndex: number;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'body';
|
|
10
|
+
declaration: ElementDeclarationNode;
|
|
11
|
+
} | undefined;
|
|
12
|
+
export declare function findSetting(declaration: SyntaxNode, settingName: string): SettingLocation;
|
|
8
13
|
export declare function addSettingEdit(declaration: SyntaxNode, setting: string): TextEdit | undefined;
|
|
9
|
-
|
|
10
|
-
* Produces a TextEdit that updates an existing setting's value in a declaration.
|
|
11
|
-
*/
|
|
12
|
-
export declare function updateSettingEdit(declaration: SyntaxNode, settingName: string, newValue: string, source: string): TextEdit | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* Produces a TextEdit that removes a setting from a declaration.
|
|
15
|
-
* If it's the only setting, removes the entire settings block [...].
|
|
16
|
-
*/
|
|
14
|
+
export declare function updateSettingEdit(declaration: SyntaxNode, settingName: string, value: string | null | undefined, source: string): TextEdit | undefined;
|
|
17
15
|
export declare function removeSettingEdit(declaration: SyntaxNode, settingName: string, source: string): TextEdit | undefined;
|
|
16
|
+
export declare function findBodySetting(declaration: ElementDeclarationNode, settingName: string): ElementDeclarationNode | undefined;
|
|
File without changes
|
|
File without changes
|
|
@@ -24,6 +24,7 @@ export declare function isValidPartialInjection(node?: SyntaxNode): node is Pref
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
export declare function isRelationshipOp(op?: string): boolean;
|
|
27
|
+
export declare function isDependencyOp(op?: string): boolean;
|
|
27
28
|
export declare function isValidHexColor(value?: SyntaxNode): value is PrimaryExpressionNode & {
|
|
28
29
|
expression: LiteralNode & {
|
|
29
30
|
literal: {
|
|
@@ -45,6 +46,7 @@ export type SignedNumberExpression = (PrimaryExpressionNode & {
|
|
|
45
46
|
});
|
|
46
47
|
export declare function isExpressionASignedNumberExpression(value?: SyntaxNode): value is SignedNumberExpression;
|
|
47
48
|
export declare function isUnaryRelationship(value?: SyntaxNode): value is PrefixExpressionNode;
|
|
49
|
+
export declare function isUnaryDependency(value?: SyntaxNode): value is PrefixExpressionNode;
|
|
48
50
|
export declare function isTupleOfVariables(value?: SyntaxNode): value is TupleExpressionNode & {
|
|
49
51
|
elementList: (PrimaryExpressionNode & {
|
|
50
52
|
expression: VariableNode;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,15 +4,19 @@ export { Filepath } from './core/types/filepath';
|
|
|
4
4
|
export { UNHANDLED, type Unhandled, } from './core/types/module';
|
|
5
5
|
export { ElementKind } from './core/types/keywords';
|
|
6
6
|
export { type NodeSymbol, SymbolKind, } from './core/types/symbol';
|
|
7
|
+
export { MetadataKind } from './core/types/symbol/metadata';
|
|
7
8
|
export * from './core/global_modules/records/utils';
|
|
8
9
|
export * from './core/types/nodes';
|
|
9
10
|
export { SyntaxToken, SyntaxTokenKind, isTriviaToken, isOp, isOpToken, } from './core/types/tokens';
|
|
10
11
|
export { CompileError, CompileErrorCode, } from './core/types/errors';
|
|
11
12
|
export type { Position, } from './core/types';
|
|
12
|
-
export { ScopeKind, splitQualifiedIdentifier, unescapeString, escapeString, formatRecordValue, isValidIdentifier, addDoubleQuoteIfNeeded, } from './compiler/index';
|
|
13
|
+
export { ScopeKind, splitQualifiedIdentifier, unescapeString, escapeString, formatRecordValue, isValidIdentifier, addDoubleQuoteIfNeeded, normalizeQualifiedName, } from './compiler/index';
|
|
13
14
|
export { type Database, type MasterDatabase, type Table, type Note, type Column, type ColumnType, type Index, type Check, type InlineRef, type Ref, type RefEndpointPair, type RefEndpoint, type Enum, type EnumField, type TableGroup, type TableGroupField, type Alias, type AliasKind, type TablePartial, type TablePartialInjection, type RecordValue, type RecordValueType, type TableRecord, type Project, type SchemaElement, type TokenPosition, type ElementRef, type FilterConfig, type DiagramView, type CustomMetadata, } from './core/types/schemaJson';
|
|
14
15
|
export { type RelationCardinality, type RelationshipOp, getRelationshipOp, getMultiplicities, parseCardinality, makeCardinalityRequired, makeCardinalityOptional, makeRelationshipRequired, isEndpointOneSide, isEndpointManySide, isEndpointOptional, isEndpointRequired, CARDINALITY_ONE, CARDINALITY_MAYBE, CARDINALITY_SOME, CARDINALITY_MANY, } from './core/types/relation';
|
|
15
16
|
export type { DiagramViewSyncOperation, DiagramViewBlock, TextEdit, } from './compiler/queries/transform';
|
|
17
|
+
export { findDiagramViewBlocks, findDepBlocks } from './compiler/queries/transform';
|
|
18
|
+
export type { DepSyncOperation, DepSyncEdge, DepEndpointRef, DepBlock, } from './compiler/queries/transform';
|
|
19
|
+
export type { ElementIdentifier, SchemaIdentifier, TableIdentifier, ColumnIdentifier, EnumIdentifier, EndpointRef, RefIdentifier, DepIdentifier, NoteIdentifier, TableGroupIdentifier, } from './compiler/queries/transform';
|
|
16
20
|
export { dbmlLanguageConfig, dbmlMonarchTokensProvider, } from './services/monarch';
|
|
17
21
|
export * from './compiler/projectLayout/layout';
|
|
18
22
|
export { Compiler };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,7 +4,7 @@ import { CompletionItemProvider, CompletionList, Position, TextModel } from '../
|
|
|
4
4
|
export declare const COLUMN_TYPE_SUGGESTION_LABELS: readonly ["integer", "int", "tinyint", "smallint", "mediumint", "bigint", "bit", "bool", "binary", "varbinary", "logical", "char", "nchar", "varchar", "varchar2", "nvarchar", "nvarchar2", "binary_float", "binary_double", "float", "double", "decimal", "dec", "real", "money", "smallmoney", "enum", "tinyblob", "tinytext", "blob", "text", "mediumblob", "mediumtext", "longblob", "longtext", "ntext", "set", "inet6", "uuid", "image", "date", "time", "datetime", "datetime2", "timestamp", "year", "smalldatetime", "datetimeoffset", "XML", "sql_variant", "uniqueidentifier", "CURSOR", "BFILE", "CLOB", "NCLOB", "RAW"];
|
|
5
5
|
export declare const TABLE_SETTING_SUGGESTION_LABELS: readonly [SettingName.HeaderColor, SettingName.Note];
|
|
6
6
|
export declare const TABLE_SETTING_SUGGESTION_TEXT_INSERTS: string[];
|
|
7
|
-
export declare const COLUMN_SUGGESTION_LABELS: (SettingName.Note | SettingName.PK | SettingName.PrimaryKey | SettingName.Unique | SettingName.Ref | SettingName.NotNull | SettingName.Null | SettingName.Increment | SettingName.Default | SettingName.Check)[];
|
|
7
|
+
export declare const COLUMN_SUGGESTION_LABELS: (SettingName.Note | SettingName.PK | SettingName.PrimaryKey | SettingName.Unique | SettingName.Ref | SettingName.Dep | SettingName.NotNull | SettingName.Null | SettingName.Increment | SettingName.Default | SettingName.Check)[];
|
|
8
8
|
export declare const COLUMN_SUGGESTION_TEXT_INSERTS: string[];
|
|
9
9
|
export declare const INDEX_SETTING_SUGGESTION_LABELS: (SettingName.Note | SettingName.PK | SettingName.Unique | SettingName.Name | SettingName.Type)[];
|
|
10
10
|
export declare const INDEX_SETTING_SUGGESTION_TEXT_INSERTS: string[];
|
|
@@ -17,7 +17,7 @@ export declare const CHECK_SETTING_SUGGESTION_TEXT_INSERTS: string[];
|
|
|
17
17
|
export declare const REF_ACTION_VALUE_SUGGESTIONS: readonly ["cascade", "set default", "set null", "restrict"];
|
|
18
18
|
export declare const INDEX_TYPE_VALUE_SUGGESTIONS: readonly ["btree", "hash"];
|
|
19
19
|
export declare const TABLE_BODY_SUGGESTION_LABELS: ("indexes" | "checks" | "Note" | "Records")[];
|
|
20
|
-
export declare const PROJECT_FIELD_SUGGESTION_LABELS: ("Table" | "Enum" | "TableGroup" | "TablePartial" | "Note" | "Ref")[];
|
|
20
|
+
export declare const PROJECT_FIELD_SUGGESTION_LABELS: ("Table" | "Enum" | "TableGroup" | "TablePartial" | "Note" | "Ref" | "Dep")[];
|
|
21
21
|
export interface DBMLCompletionItemProviderOptions {
|
|
22
22
|
triggerCharacters?: string[];
|
|
23
23
|
}
|
|
@@ -27,4 +27,4 @@ export default class DBMLCompletionItemProvider implements CompletionItemProvide
|
|
|
27
27
|
constructor(compiler: Compiler, options?: DBMLCompletionItemProviderOptions);
|
|
28
28
|
provideCompletionItems(model: TextModel, position: Position): CompletionList;
|
|
29
29
|
}
|
|
30
|
-
export declare const TOP_LEVEL_SUGGESTION_LABELS: ("Table" | "Enum" | "TableGroup" | "TablePartial" | "Note" | "DiagramView" | "Metadata" | "Ref" | "Project" | "Records")[];
|
|
30
|
+
export declare const TOP_LEVEL_SUGGESTION_LABELS: ("Table" | "Enum" | "TableGroup" | "TablePartial" | "Note" | "DiagramView" | "Metadata" | "Ref" | "Dep" | "Project" | "Records")[];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/parse",
|
|
4
|
-
"version": "9.1.0",
|
|
4
|
+
"version": "9.1.2-alpha.0",
|
|
5
5
|
"description": "DBML parser v2",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=18"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "77328e8b7a7e716a549d06a4b905672ab7767434"
|
|
55
55
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Filepath } from '../../../core/types/filepath';
|
|
2
|
-
import { NodeSymbol } from '../../../core/types/symbol';
|
|
3
|
-
import { default as Compiler } from '../../index';
|
|
4
|
-
export type TableNameInput = string | {
|
|
5
|
-
schema?: string;
|
|
6
|
-
table: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Normalizes a table name input to { schema, table } format.
|
|
10
|
-
* Properly handles quoted identifiers with dots inside.
|
|
11
|
-
*/
|
|
12
|
-
export declare function normalizeTableName(input: TableNameInput): {
|
|
13
|
-
schema: string;
|
|
14
|
-
table: string;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Looks up a table symbol by matching its full qualified name.
|
|
18
|
-
*/
|
|
19
|
-
export declare function lookupTableSymbol(compiler: Compiler, filepath: Filepath, schema: string, table: string): NodeSymbol | null;
|
|
20
|
-
/**
|
|
21
|
-
* Removes surrounding double quotes from a string if present.
|
|
22
|
-
*/
|
|
23
|
-
export declare function stripQuotes(str: string): string;
|