@dbml/core 6.5.0 → 7.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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/index.cjs +71 -65
- package/lib/index.mjs +708 -28
- package/package.json +3 -3
- package/types/export/DbmlExporter.d.ts +0 -0
- package/types/export/JsonExporter.d.ts +0 -0
- package/types/export/ModelExporter.d.ts +0 -0
- package/types/export/index.d.ts +0 -0
- package/types/import/index.d.ts +0 -0
- package/types/index.d.ts +2 -0
- package/types/model_structure/check.d.ts +1 -1
- package/types/model_structure/database.d.ts +0 -1
- package/types/model_structure/dbState.d.ts +1 -1
- package/types/model_structure/element.d.ts +0 -0
- package/types/model_structure/endpoint.d.ts +0 -0
- package/types/model_structure/enum.d.ts +1 -1
- package/types/model_structure/enumValue.d.ts +1 -1
- package/types/model_structure/field.d.ts +0 -0
- package/types/model_structure/index.d.ts +0 -0
- package/types/model_structure/indexColumn.d.ts +1 -9
- package/types/model_structure/indexes.d.ts +1 -1
- package/types/model_structure/ref.d.ts +1 -1
- package/types/model_structure/schema.d.ts +0 -0
- package/types/model_structure/stickyNote.d.ts +0 -0
- package/types/model_structure/table.d.ts +2 -5
- package/types/model_structure/tableGroup.d.ts +1 -1
- package/types/model_structure/tablePartial.d.ts +1 -1
- package/types/parse/Parser.d.ts +0 -0
- package/types/parse/error.d.ts +0 -0
- package/types/transform/index.d.ts +0 -0
package/lib/index.mjs
CHANGED
|
@@ -2447,6 +2447,18 @@ var NodeSymbolIdGenerator = class {
|
|
|
2447
2447
|
constructor({ declaration: _ }, HY) {
|
|
2448
2448
|
this.references = [], this.id = HY, this.declaration = _;
|
|
2449
2449
|
}
|
|
2450
|
+
}, DiagramViewSymbol = class {
|
|
2451
|
+
constructor({ symbolTable: _, declaration: HY }, P) {
|
|
2452
|
+
this.references = [], this.id = P, this.symbolTable = _, this.declaration = HY;
|
|
2453
|
+
}
|
|
2454
|
+
}, DiagramViewFieldSymbol = class {
|
|
2455
|
+
constructor({ declaration: _ }, HY) {
|
|
2456
|
+
this.references = [], this.id = HY, this.declaration = _;
|
|
2457
|
+
}
|
|
2458
|
+
}, StickyNoteSymbol = class {
|
|
2459
|
+
constructor({ declaration: _ }, HY) {
|
|
2460
|
+
this.references = [], this.id = HY, this.declaration = _;
|
|
2461
|
+
}
|
|
2450
2462
|
}, TablePartialSymbol = class {
|
|
2451
2463
|
constructor({ symbolTable: _, declaration: HY }, P) {
|
|
2452
2464
|
this.references = [], this.id = P, this.symbolTable = _, this.declaration = HY;
|
|
@@ -2460,7 +2472,7 @@ var NodeSymbolIdGenerator = class {
|
|
|
2460
2472
|
this.references = [], this.id = P, this.declaration = _, this.tablePartialSymbol = HY;
|
|
2461
2473
|
}
|
|
2462
2474
|
}, CompileErrorCode = /* @__PURE__ */ function(_) {
|
|
2463
|
-
return _[_.UNKNOWN_SYMBOL = 1e3] = "UNKNOWN_SYMBOL", _[_.UNEXPECTED_SYMBOL = 1001] = "UNEXPECTED_SYMBOL", _[_.UNEXPECTED_EOF = 1002] = "UNEXPECTED_EOF", _[_.UNEXPECTED_NEWLINE = 1003] = "UNEXPECTED_NEWLINE", _[_.UNKNOWN_TOKEN = 1004] = "UNKNOWN_TOKEN", _[_.UNEXPECTED_TOKEN = 1005] = "UNEXPECTED_TOKEN", _[_.UNEXPECTED_ELEMENT_DECLARATION = 1006] = "UNEXPECTED_ELEMENT_DECLARATION", _[_.MISSING_SPACES = 1007] = "MISSING_SPACES", _[_.UNKNOWN_PREFIX_OP = 1008] = "UNKNOWN_PREFIX_OP", _[_.INVALID_OPERAND = 1009] = "INVALID_OPERAND", _[_.EMPTY_ATTRIBUTE_NAME = 1010] = "EMPTY_ATTRIBUTE_NAME", _[_.INVALID_ESCAPE_SEQUENCE = 1011] = "INVALID_ESCAPE_SEQUENCE", _[_.INVALID_NAME = 3e3] = "INVALID_NAME", _[_.UNEXPECTED_NAME = 3001] = "UNEXPECTED_NAME", _[_.NAME_NOT_FOUND = 3002] = "NAME_NOT_FOUND", _[_.DUPLICATE_NAME = 3003] = "DUPLICATE_NAME", _[_.INVALID_ALIAS = 3004] = "INVALID_ALIAS", _[_.UNEXPECTED_ALIAS = 3005] = "UNEXPECTED_ALIAS", _[_.UNEXPECTED_SETTINGS = 3006] = "UNEXPECTED_SETTINGS", _[_.INVALID_SETTINGS = 3007] = "INVALID_SETTINGS", _[_.UNEXPECTED_SIMPLE_BODY = 3008] = "UNEXPECTED_SIMPLE_BODY", _[_.UNEXPECTED_COMPLEX_BODY = 3009] = "UNEXPECTED_COMPLEX_BODY", _[_.INVALID_TABLE_CONTEXT = 3010] = "INVALID_TABLE_CONTEXT", _[_.UNKNOWN_TABLE_SETTING = 3011] = "UNKNOWN_TABLE_SETTING", _[_.DUPLICATE_TABLE_SETTING = 3012] = "DUPLICATE_TABLE_SETTING", _[_.INVALID_TABLEGROUP_CONTEXT = 3013] = "INVALID_TABLEGROUP_CONTEXT", _[_.INVALID_TABLEGROUP_ELEMENT_NAME = 3014] = "INVALID_TABLEGROUP_ELEMENT_NAME", _[_.DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3015] = "DUPLICATE_TABLEGROUP_ELEMENT_NAME", _[_.DUPLICATE_TABLEGROUP_FIELD_NAME = 3016] = "DUPLICATE_TABLEGROUP_FIELD_NAME", _[_.INVALID_TABLEGROUP_FIELD = 3017] = "INVALID_TABLEGROUP_FIELD", _[_.EMPTY_TABLE = 3018] = "EMPTY_TABLE", _[_.INVALID_COLUMN = 3019] = "INVALID_COLUMN", _[_.INVALID_COLUMN_NAME = 3020] = "INVALID_COLUMN_NAME", _[_.UNKNOWN_COLUMN_SETTING = 3021] = "UNKNOWN_COLUMN_SETTING", _[_.INVALID_COLUMN_TYPE = 3022] = "INVALID_COLUMN_TYPE", _[_.DUPLICATE_COLUMN_NAME = 3023] = "DUPLICATE_COLUMN_NAME", _[_.DUPLICATE_COLUMN_SETTING = 3024] = "DUPLICATE_COLUMN_SETTING", _[_.INVALID_COLUMN_SETTING_VALUE = 3025] = "INVALID_COLUMN_SETTING_VALUE", _[_.INVALID_ENUM_CONTEXT = 3026] = "INVALID_ENUM_CONTEXT", _[_.INVALID_ENUM_ELEMENT_NAME = 3027] = "INVALID_ENUM_ELEMENT_NAME", _[_.INVALID_ENUM_ELEMENT = 3028] = "INVALID_ENUM_ELEMENT", _[_.DUPLICATE_ENUM_ELEMENT_NAME = 3029] = "DUPLICATE_ENUM_ELEMENT_NAME", _[_.UNKNOWN_ENUM_ELEMENT_SETTING = 3030] = "UNKNOWN_ENUM_ELEMENT_SETTING", _[_.DUPLICATE_ENUM_ELEMENT_SETTING = 3031] = "DUPLICATE_ENUM_ELEMENT_SETTING", _[_.INVALID_ENUM_ELEMENT_SETTING = 3032] = "INVALID_ENUM_ELEMENT_SETTING", _[_.EMPTY_ENUM = 3033] = "EMPTY_ENUM", _[_.INVALID_REF_CONTEXT = 3034] = "INVALID_REF_CONTEXT", _[_.UNKNOWN_REF_SETTING = 3035] = "UNKNOWN_REF_SETTING", _[_.DUPLICATE_REF_SETTING = 3036] = "DUPLICATE_REF_SETTING", _[_.INVALID_REF_SETTING_VALUE = 3037] = "INVALID_REF_SETTING_VALUE", _[_.INVALID_REF_RELATIONSHIP = 3038] = "INVALID_REF_RELATIONSHIP", _[_.INVALID_REF_FIELD = 3039] = "INVALID_REF_FIELD", _[_.EMPTY_REF = 3040] = "EMPTY_REF", _[_.REF_REDEFINED = 3041] = "REF_REDEFINED", _[_.INVALID_NOTE_CONTEXT = 3042] = "INVALID_NOTE_CONTEXT", _[_.INVALID_NOTE = 3043] = "INVALID_NOTE", _[_.NOTE_REDEFINED = 3044] = "NOTE_REDEFINED", _[_.NOTE_CONTENT_REDEFINED = 3045] = "NOTE_CONTENT_REDEFINED", _[_.EMPTY_NOTE = 3046] = "EMPTY_NOTE", _[_.INVALID_INDEXES_CONTEXT = 3047] = "INVALID_INDEXES_CONTEXT", _[_.INVALID_INDEXES_FIELD = 3048] = "INVALID_INDEXES_FIELD", _[_.INVALID_INDEX = 3049] = "INVALID_INDEX", _[_.UNKNOWN_INDEX_SETTING = 3050] = "UNKNOWN_INDEX_SETTING", _[_.DUPLICATE_INDEX_SETTING = 3051] = "DUPLICATE_INDEX_SETTING", _[_.UNEXPECTED_INDEX_SETTING_VALUE = 3052] = "UNEXPECTED_INDEX_SETTING_VALUE", _[_.INVALID_INDEX_SETTING_VALUE = 3053] = "INVALID_INDEX_SETTING_VALUE", _[_.INVALID_PROJECT_CONTEXT = 3054] = "INVALID_PROJECT_CONTEXT", _[_.PROJECT_REDEFINED = 3055] = "PROJECT_REDEFINED", _[_.INVALID_PROJECT_FIELD = 3056] = "INVALID_PROJECT_FIELD", _[_.INVALID_CUSTOM_CONTEXT = 3057] = "INVALID_CUSTOM_CONTEXT", _[_.INVALID_CUSTOM_ELEMENT_VALUE = 3058] = "INVALID_CUSTOM_ELEMENT_VALUE", _[_.INVALID_ELEMENT_IN_SIMPLE_BODY = 3059] = "INVALID_ELEMENT_IN_SIMPLE_BODY", _[_.INVALID_TABLE_PARTIAL_CONTEXT = 3060] = "INVALID_TABLE_PARTIAL_CONTEXT", _[_.INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3061] = "INVALID_TABLE_PARTIAL_ELEMENT_NAME", _[_.INVALID_TABLE_PARTIAL_SETTING_VALUE = 3062] = "INVALID_TABLE_PARTIAL_SETTING_VALUE", _[_.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3063] = "DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME", _[_.DUPLICATE_TABLE_PARTIAL_SETTING = 3064] = "DUPLICATE_TABLE_PARTIAL_SETTING", _[_.INVALID_TABLE_PARTIAL_INJECTION = 3065] = "INVALID_TABLE_PARTIAL_INJECTION", _[_.INVALID_TABLE_PARTIAL_INJECTION_OP = 3066] = "INVALID_TABLE_PARTIAL_INJECTION_OP", _[_.INVALID_TABLE_PARTIAL_INJECTION_NAME = 3067] = "INVALID_TABLE_PARTIAL_INJECTION_NAME", _[_.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068] = "DUPLICATE_TABLE_PARTIAL_INJECTION_NAME", _[_.UNKNOWN_TABLE_PARTIAL_SETTING = 3069] = "UNKNOWN_TABLE_PARTIAL_SETTING", _[_.INVALID_TABLE_SETTING_VALUE = 3070] = "INVALID_TABLE_SETTING_VALUE", _[_.INVALID_CHECKS_CONTEXT = 3071] = "INVALID_CHECKS_CONTEXT", _[_.INVALID_CHECKS_FIELD = 3072] = "INVALID_CHECKS_FIELD", _[_.INVALID_CHECK = 3073] = "INVALID_CHECK", _[_.UNKNOWN_CHECK_SETTING = 3074] = "UNKNOWN_CHECK_SETTING", _[_.DUPLICATE_CHECK_SETTING = 3075] = "DUPLICATE_CHECK_SETTING", _[_.INVALID_CHECK_SETTING_VALUE = 3076] = "INVALID_CHECK_SETTING_VALUE", _[_.INVALID_RECORDS_CONTEXT = 3077] = "INVALID_RECORDS_CONTEXT", _[_.INVALID_RECORDS_NAME = 3078] = "INVALID_RECORDS_NAME", _[_.INVALID_RECORDS_FIELD = 3079] = "INVALID_RECORDS_FIELD", _[_.DUPLICATE_COLUMN_REFERENCES_IN_RECORDS = 3080] = "DUPLICATE_COLUMN_REFERENCES_IN_RECORDS", _[_.DUPLICATE_RECORDS_FOR_TABLE = 3081] = "DUPLICATE_RECORDS_FOR_TABLE", _[_.BINDING_ERROR = 4e3] = "BINDING_ERROR", _[_.UNSUPPORTED = 5e3] = "UNSUPPORTED", _[_.CIRCULAR_REF = 5001] = "CIRCULAR_REF", _[_.SAME_ENDPOINT = 5002] = "SAME_ENDPOINT", _[_.UNEQUAL_FIELDS_BINARY_REF = 5003] = "UNEQUAL_FIELDS_BINARY_REF", _[_.CONFLICTING_SETTING = 5004] = "CONFLICTING_SETTING", _[_.TABLE_REAPPEAR_IN_TABLEGROUP = 5005] = "TABLE_REAPPEAR_IN_TABLEGROUP", _;
|
|
2475
|
+
return _[_.UNKNOWN_SYMBOL = 1e3] = "UNKNOWN_SYMBOL", _[_.UNEXPECTED_SYMBOL = 1001] = "UNEXPECTED_SYMBOL", _[_.UNEXPECTED_EOF = 1002] = "UNEXPECTED_EOF", _[_.UNEXPECTED_NEWLINE = 1003] = "UNEXPECTED_NEWLINE", _[_.UNKNOWN_TOKEN = 1004] = "UNKNOWN_TOKEN", _[_.UNEXPECTED_TOKEN = 1005] = "UNEXPECTED_TOKEN", _[_.UNEXPECTED_ELEMENT_DECLARATION = 1006] = "UNEXPECTED_ELEMENT_DECLARATION", _[_.MISSING_SPACES = 1007] = "MISSING_SPACES", _[_.UNKNOWN_PREFIX_OP = 1008] = "UNKNOWN_PREFIX_OP", _[_.INVALID_OPERAND = 1009] = "INVALID_OPERAND", _[_.EMPTY_ATTRIBUTE_NAME = 1010] = "EMPTY_ATTRIBUTE_NAME", _[_.INVALID_ESCAPE_SEQUENCE = 1011] = "INVALID_ESCAPE_SEQUENCE", _[_.INVALID_NAME = 3e3] = "INVALID_NAME", _[_.UNEXPECTED_NAME = 3001] = "UNEXPECTED_NAME", _[_.NAME_NOT_FOUND = 3002] = "NAME_NOT_FOUND", _[_.DUPLICATE_NAME = 3003] = "DUPLICATE_NAME", _[_.INVALID_ALIAS = 3004] = "INVALID_ALIAS", _[_.UNEXPECTED_ALIAS = 3005] = "UNEXPECTED_ALIAS", _[_.UNEXPECTED_SETTINGS = 3006] = "UNEXPECTED_SETTINGS", _[_.INVALID_SETTINGS = 3007] = "INVALID_SETTINGS", _[_.UNEXPECTED_SIMPLE_BODY = 3008] = "UNEXPECTED_SIMPLE_BODY", _[_.UNEXPECTED_COMPLEX_BODY = 3009] = "UNEXPECTED_COMPLEX_BODY", _[_.INVALID_TABLE_CONTEXT = 3010] = "INVALID_TABLE_CONTEXT", _[_.UNKNOWN_TABLE_SETTING = 3011] = "UNKNOWN_TABLE_SETTING", _[_.DUPLICATE_TABLE_SETTING = 3012] = "DUPLICATE_TABLE_SETTING", _[_.INVALID_TABLEGROUP_CONTEXT = 3013] = "INVALID_TABLEGROUP_CONTEXT", _[_.INVALID_TABLEGROUP_ELEMENT_NAME = 3014] = "INVALID_TABLEGROUP_ELEMENT_NAME", _[_.DUPLICATE_TABLEGROUP_ELEMENT_NAME = 3015] = "DUPLICATE_TABLEGROUP_ELEMENT_NAME", _[_.DUPLICATE_TABLEGROUP_FIELD_NAME = 3016] = "DUPLICATE_TABLEGROUP_FIELD_NAME", _[_.INVALID_TABLEGROUP_FIELD = 3017] = "INVALID_TABLEGROUP_FIELD", _[_.EMPTY_TABLE = 3018] = "EMPTY_TABLE", _[_.INVALID_COLUMN = 3019] = "INVALID_COLUMN", _[_.INVALID_COLUMN_NAME = 3020] = "INVALID_COLUMN_NAME", _[_.UNKNOWN_COLUMN_SETTING = 3021] = "UNKNOWN_COLUMN_SETTING", _[_.INVALID_COLUMN_TYPE = 3022] = "INVALID_COLUMN_TYPE", _[_.DUPLICATE_COLUMN_NAME = 3023] = "DUPLICATE_COLUMN_NAME", _[_.DUPLICATE_COLUMN_SETTING = 3024] = "DUPLICATE_COLUMN_SETTING", _[_.INVALID_COLUMN_SETTING_VALUE = 3025] = "INVALID_COLUMN_SETTING_VALUE", _[_.INVALID_ENUM_CONTEXT = 3026] = "INVALID_ENUM_CONTEXT", _[_.INVALID_ENUM_ELEMENT_NAME = 3027] = "INVALID_ENUM_ELEMENT_NAME", _[_.INVALID_ENUM_ELEMENT = 3028] = "INVALID_ENUM_ELEMENT", _[_.DUPLICATE_ENUM_ELEMENT_NAME = 3029] = "DUPLICATE_ENUM_ELEMENT_NAME", _[_.UNKNOWN_ENUM_ELEMENT_SETTING = 3030] = "UNKNOWN_ENUM_ELEMENT_SETTING", _[_.DUPLICATE_ENUM_ELEMENT_SETTING = 3031] = "DUPLICATE_ENUM_ELEMENT_SETTING", _[_.INVALID_ENUM_ELEMENT_SETTING = 3032] = "INVALID_ENUM_ELEMENT_SETTING", _[_.EMPTY_ENUM = 3033] = "EMPTY_ENUM", _[_.INVALID_REF_CONTEXT = 3034] = "INVALID_REF_CONTEXT", _[_.UNKNOWN_REF_SETTING = 3035] = "UNKNOWN_REF_SETTING", _[_.DUPLICATE_REF_SETTING = 3036] = "DUPLICATE_REF_SETTING", _[_.INVALID_REF_SETTING_VALUE = 3037] = "INVALID_REF_SETTING_VALUE", _[_.INVALID_REF_RELATIONSHIP = 3038] = "INVALID_REF_RELATIONSHIP", _[_.INVALID_REF_FIELD = 3039] = "INVALID_REF_FIELD", _[_.EMPTY_REF = 3040] = "EMPTY_REF", _[_.REF_REDEFINED = 3041] = "REF_REDEFINED", _[_.INVALID_NOTE_CONTEXT = 3042] = "INVALID_NOTE_CONTEXT", _[_.INVALID_NOTE = 3043] = "INVALID_NOTE", _[_.NOTE_REDEFINED = 3044] = "NOTE_REDEFINED", _[_.NOTE_CONTENT_REDEFINED = 3045] = "NOTE_CONTENT_REDEFINED", _[_.EMPTY_NOTE = 3046] = "EMPTY_NOTE", _[_.INVALID_INDEXES_CONTEXT = 3047] = "INVALID_INDEXES_CONTEXT", _[_.INVALID_INDEXES_FIELD = 3048] = "INVALID_INDEXES_FIELD", _[_.INVALID_INDEX = 3049] = "INVALID_INDEX", _[_.UNKNOWN_INDEX_SETTING = 3050] = "UNKNOWN_INDEX_SETTING", _[_.DUPLICATE_INDEX_SETTING = 3051] = "DUPLICATE_INDEX_SETTING", _[_.UNEXPECTED_INDEX_SETTING_VALUE = 3052] = "UNEXPECTED_INDEX_SETTING_VALUE", _[_.INVALID_INDEX_SETTING_VALUE = 3053] = "INVALID_INDEX_SETTING_VALUE", _[_.INVALID_PROJECT_CONTEXT = 3054] = "INVALID_PROJECT_CONTEXT", _[_.PROJECT_REDEFINED = 3055] = "PROJECT_REDEFINED", _[_.INVALID_PROJECT_FIELD = 3056] = "INVALID_PROJECT_FIELD", _[_.INVALID_CUSTOM_CONTEXT = 3057] = "INVALID_CUSTOM_CONTEXT", _[_.INVALID_CUSTOM_ELEMENT_VALUE = 3058] = "INVALID_CUSTOM_ELEMENT_VALUE", _[_.INVALID_ELEMENT_IN_SIMPLE_BODY = 3059] = "INVALID_ELEMENT_IN_SIMPLE_BODY", _[_.INVALID_TABLE_PARTIAL_CONTEXT = 3060] = "INVALID_TABLE_PARTIAL_CONTEXT", _[_.INVALID_TABLE_PARTIAL_ELEMENT_NAME = 3061] = "INVALID_TABLE_PARTIAL_ELEMENT_NAME", _[_.INVALID_TABLE_PARTIAL_SETTING_VALUE = 3062] = "INVALID_TABLE_PARTIAL_SETTING_VALUE", _[_.DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME = 3063] = "DUPLICATE_TABLE_PARTIAL_ELEMENT_NAME", _[_.DUPLICATE_TABLE_PARTIAL_SETTING = 3064] = "DUPLICATE_TABLE_PARTIAL_SETTING", _[_.INVALID_TABLE_PARTIAL_INJECTION = 3065] = "INVALID_TABLE_PARTIAL_INJECTION", _[_.INVALID_TABLE_PARTIAL_INJECTION_OP = 3066] = "INVALID_TABLE_PARTIAL_INJECTION_OP", _[_.INVALID_TABLE_PARTIAL_INJECTION_NAME = 3067] = "INVALID_TABLE_PARTIAL_INJECTION_NAME", _[_.DUPLICATE_TABLE_PARTIAL_INJECTION_NAME = 3068] = "DUPLICATE_TABLE_PARTIAL_INJECTION_NAME", _[_.UNKNOWN_TABLE_PARTIAL_SETTING = 3069] = "UNKNOWN_TABLE_PARTIAL_SETTING", _[_.INVALID_TABLE_SETTING_VALUE = 3070] = "INVALID_TABLE_SETTING_VALUE", _[_.INVALID_CHECKS_CONTEXT = 3071] = "INVALID_CHECKS_CONTEXT", _[_.INVALID_CHECKS_FIELD = 3072] = "INVALID_CHECKS_FIELD", _[_.INVALID_CHECK = 3073] = "INVALID_CHECK", _[_.UNKNOWN_CHECK_SETTING = 3074] = "UNKNOWN_CHECK_SETTING", _[_.DUPLICATE_CHECK_SETTING = 3075] = "DUPLICATE_CHECK_SETTING", _[_.INVALID_CHECK_SETTING_VALUE = 3076] = "INVALID_CHECK_SETTING_VALUE", _[_.INVALID_RECORDS_CONTEXT = 3077] = "INVALID_RECORDS_CONTEXT", _[_.INVALID_RECORDS_NAME = 3078] = "INVALID_RECORDS_NAME", _[_.INVALID_RECORDS_FIELD = 3079] = "INVALID_RECORDS_FIELD", _[_.DUPLICATE_COLUMN_REFERENCES_IN_RECORDS = 3080] = "DUPLICATE_COLUMN_REFERENCES_IN_RECORDS", _[_.DUPLICATE_RECORDS_FOR_TABLE = 3081] = "DUPLICATE_RECORDS_FOR_TABLE", _[_.INVALID_DIAGRAMVIEW_CONTEXT = 3082] = "INVALID_DIAGRAMVIEW_CONTEXT", _[_.DUPLICATE_DIAGRAMVIEW_NAME = 3083] = "DUPLICATE_DIAGRAMVIEW_NAME", _[_.INVALID_DIAGRAMVIEW_FIELD = 3084] = "INVALID_DIAGRAMVIEW_FIELD", _[_.DUPLICATE_DIAGRAMVIEW_FIELD = 3085] = "DUPLICATE_DIAGRAMVIEW_FIELD", _[_.BINDING_ERROR = 4e3] = "BINDING_ERROR", _[_.UNSUPPORTED = 5e3] = "UNSUPPORTED", _[_.CIRCULAR_REF = 5001] = "CIRCULAR_REF", _[_.SAME_ENDPOINT = 5002] = "SAME_ENDPOINT", _[_.UNEQUAL_FIELDS_BINARY_REF = 5003] = "UNEQUAL_FIELDS_BINARY_REF", _[_.CONFLICTING_SETTING = 5004] = "CONFLICTING_SETTING", _[_.TABLE_REAPPEAR_IN_TABLEGROUP = 5005] = "TABLE_REAPPEAR_IN_TABLEGROUP", _;
|
|
2464
2476
|
}({}), CompileError = class _ extends Error {
|
|
2465
2477
|
constructor(HY, P, UY) {
|
|
2466
2478
|
super(P), this.code = HY, this.diagnostic = P, this.nodeOrToken = UY, this.start = UY.start, this.end = UY.end, this.name = this.constructor.name, Object.setPrototypeOf(this, _.prototype);
|
|
@@ -2565,7 +2577,7 @@ var Some = class _ {
|
|
|
2565
2577
|
"true",
|
|
2566
2578
|
"false"
|
|
2567
2579
|
], NUMERIC_LITERAL_PREFIX = ["-", "+"], DEFAULT_SCHEMA_NAME$1 = "public", ElementKind = /* @__PURE__ */ function(_) {
|
|
2568
|
-
return _.Table = "table", _.Enum = "enum", _.Ref = "ref", _.Note = "note", _.Project = "project", _.Indexes = "indexes", _.TableGroup = "tablegroup", _.TablePartial = "tablepartial", _.Check = "checks", _.Records = "records", _;
|
|
2580
|
+
return _.Table = "table", _.Enum = "enum", _.Ref = "ref", _.Note = "note", _.Project = "project", _.Indexes = "indexes", _.TableGroup = "tablegroup", _.TablePartial = "tablepartial", _.Check = "checks", _.Records = "records", _.DiagramView = "diagramview", _;
|
|
2569
2581
|
}({}), SettingName = /* @__PURE__ */ function(_) {
|
|
2570
2582
|
return _.Color = "color", _.HeaderColor = "headercolor", _.Note = "note", _.PK = "pk", _.PrimaryKey = "primary key", _.Unique = "unique", _.Ref = "ref", _.NotNull = "not null", _.Null = "null", _.Increment = "increment", _.Default = "default", _.Name = "name", _.Type = "type", _.Check = "check", _.Update = "update", _.Delete = "delete", _;
|
|
2571
2583
|
}({}), CustomValidator = class {
|
|
@@ -2600,7 +2612,7 @@ var Some = class _ {
|
|
|
2600
2612
|
return isExpressionAQuotedString(_.callee) || HY.push(new CompileError(CompileErrorCode.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", _)), _.args.length > 0 && HY.push(..._.args.map((_) => new CompileError(CompileErrorCode.INVALID_CUSTOM_ELEMENT_VALUE, "A Custom element value can only be a string", _))), HY;
|
|
2601
2613
|
}
|
|
2602
2614
|
}, SymbolKind = /* @__PURE__ */ function(_) {
|
|
2603
|
-
return _.Schema = "Schema", _.Table = "Table", _.Column = "Column", _.TableGroup = "TableGroup", _.TableGroupField = "TableGroup field", _.Enum = "Enum", _.EnumField = "Enum field", _.Note = "Note", _.TablePartial = "TablePartial", _.PartialInjection = "PartialInjection", _;
|
|
2615
|
+
return _.Schema = "Schema", _.Table = "Table", _.Column = "Column", _.TableGroup = "TableGroup", _.TableGroupField = "TableGroup field", _.Enum = "Enum", _.EnumField = "Enum field", _.Note = "Note", _.TablePartial = "TablePartial", _.PartialInjection = "PartialInjection", _.DiagramView = "DiagramView", _.DiagramViewField = "DiagramView field", _;
|
|
2604
2616
|
}({});
|
|
2605
2617
|
function createSchemaSymbolIndex(_) {
|
|
2606
2618
|
return `${SymbolKind.Schema}:${_}`;
|
|
@@ -2632,6 +2644,12 @@ function createTablePartialSymbolIndex(_) {
|
|
|
2632
2644
|
function createPartialInjectionSymbolIndex(_) {
|
|
2633
2645
|
return `${SymbolKind.PartialInjection}:${_}`;
|
|
2634
2646
|
}
|
|
2647
|
+
function createDiagramViewSymbolIndex(_) {
|
|
2648
|
+
return `${SymbolKind.DiagramView}:${_}`;
|
|
2649
|
+
}
|
|
2650
|
+
function createDiagramViewFieldSymbolIndex(_) {
|
|
2651
|
+
return `${SymbolKind.DiagramViewField}:${_}`;
|
|
2652
|
+
}
|
|
2635
2653
|
function createNodeSymbolIndex(_, HY) {
|
|
2636
2654
|
switch (HY) {
|
|
2637
2655
|
case SymbolKind.Column: return createColumnSymbolIndex(_);
|
|
@@ -2641,8 +2659,11 @@ function createNodeSymbolIndex(_, HY) {
|
|
|
2641
2659
|
case SymbolKind.Table: return createTableSymbolIndex(_);
|
|
2642
2660
|
case SymbolKind.TableGroup: return createTableGroupSymbolIndex(_);
|
|
2643
2661
|
case SymbolKind.TableGroupField: return createTableGroupFieldSymbolIndex(_);
|
|
2662
|
+
case SymbolKind.Note: return createStickyNoteSymbolIndex(_);
|
|
2644
2663
|
case SymbolKind.TablePartial: return createTablePartialSymbolIndex(_);
|
|
2645
2664
|
case SymbolKind.PartialInjection: return createPartialInjectionSymbolIndex(_);
|
|
2665
|
+
case SymbolKind.DiagramView: return createDiagramViewSymbolIndex(_);
|
|
2666
|
+
case SymbolKind.DiagramViewField: return createDiagramViewFieldSymbolIndex(_);
|
|
2646
2667
|
default: throw Error("Unreachable");
|
|
2647
2668
|
}
|
|
2648
2669
|
}
|
|
@@ -2857,7 +2878,7 @@ var SymbolTable = class {
|
|
|
2857
2878
|
let HY = destructureComplexVariable(_);
|
|
2858
2879
|
if (!HY.isOk()) return [new CompileError(CompileErrorCode.INVALID_NAME, "Invalid name for sticky note ", this.declarationNode)];
|
|
2859
2880
|
let P = HY.unwrap().join("."), UY = createStickyNoteSymbolIndex(P);
|
|
2860
|
-
return this.publicSymbolTable.has(UY) ? [new CompileError(CompileErrorCode.DUPLICATE_NAME, `Sticky note "${P}" has already been defined`, _)] : (this.publicSymbolTable.set(UY, this.declarationNode.symbol), []);
|
|
2881
|
+
return this.publicSymbolTable.has(UY) ? [new CompileError(CompileErrorCode.DUPLICATE_NAME, `Sticky note "${P}" has already been defined`, _)] : (this.declarationNode.symbol = this.symbolFactory.create(StickyNoteSymbol, { declaration: this.declarationNode }), this.publicSymbolTable.set(UY, this.declarationNode.symbol), []);
|
|
2861
2882
|
}
|
|
2862
2883
|
validateAlias(_) {
|
|
2863
2884
|
return _ ? [new CompileError(CompileErrorCode.UNEXPECTED_ALIAS, "A Ref shouldn't have an alias", _)] : [];
|
|
@@ -3557,6 +3578,108 @@ var TableGroupValidator = class {
|
|
|
3557
3578
|
return _.flatMap((_) => (_.parent = this.declarationNode, _.type ? new (pickValidator(_))(_, this.publicSymbolTable, this.symbolFactory).validate() : []));
|
|
3558
3579
|
}
|
|
3559
3580
|
};
|
|
3581
|
+
function isWildcardExpression$2(_) {
|
|
3582
|
+
return _ && _ instanceof PrimaryExpressionNode && _.expression instanceof VariableNode ? _.expression.variable?.value === "*" : !1;
|
|
3583
|
+
}
|
|
3584
|
+
var DiagramViewValidator = class {
|
|
3585
|
+
constructor(_, HY, P) {
|
|
3586
|
+
this.declarationNode = _, this.publicSymbolTable = HY, this.symbolFactory = P;
|
|
3587
|
+
}
|
|
3588
|
+
validate() {
|
|
3589
|
+
return [
|
|
3590
|
+
...this.validateContext(),
|
|
3591
|
+
...this.validateName(this.declarationNode.name),
|
|
3592
|
+
...this.validateAlias(this.declarationNode.alias),
|
|
3593
|
+
...this.validateSettingList(this.declarationNode.attributeList),
|
|
3594
|
+
...this.registerElement(),
|
|
3595
|
+
...this.validateBody(this.declarationNode.body)
|
|
3596
|
+
];
|
|
3597
|
+
}
|
|
3598
|
+
validateContext() {
|
|
3599
|
+
return this.declarationNode.parent instanceof ElementDeclarationNode ? [new CompileError(CompileErrorCode.INVALID_DIAGRAMVIEW_CONTEXT, "DiagramView must appear top-level", this.declarationNode)] : [];
|
|
3600
|
+
}
|
|
3601
|
+
validateName(_) {
|
|
3602
|
+
return _ ? isSimpleName(_) ? [] : [new CompileError(CompileErrorCode.INVALID_NAME, "A DiagramView name must be a single identifier", _)] : [new CompileError(CompileErrorCode.NAME_NOT_FOUND, "A DiagramView must have a name", this.declarationNode)];
|
|
3603
|
+
}
|
|
3604
|
+
validateAlias(_) {
|
|
3605
|
+
return _ ? [new CompileError(CompileErrorCode.UNEXPECTED_ALIAS, "A DiagramView shouldn't have an alias", _)] : [];
|
|
3606
|
+
}
|
|
3607
|
+
registerElement() {
|
|
3608
|
+
let { name: _ } = this.declarationNode;
|
|
3609
|
+
this.declarationNode.symbol = this.symbolFactory.create(DiagramViewSymbol, {
|
|
3610
|
+
declaration: this.declarationNode,
|
|
3611
|
+
symbolTable: new SymbolTable()
|
|
3612
|
+
});
|
|
3613
|
+
let HY = destructureComplexVariable(_);
|
|
3614
|
+
if (HY.isOk()) {
|
|
3615
|
+
let P = HY.unwrap(), UY = P.pop(), WY = registerSchemaStack(P, this.publicSymbolTable, this.symbolFactory), GY = createDiagramViewSymbolIndex(UY);
|
|
3616
|
+
if (WY.has(GY)) return [new CompileError(CompileErrorCode.DUPLICATE_DIAGRAMVIEW_NAME, `DiagramView name '${UY}' already exists`, _)];
|
|
3617
|
+
WY.set(GY, this.declarationNode.symbol);
|
|
3618
|
+
}
|
|
3619
|
+
return [];
|
|
3620
|
+
}
|
|
3621
|
+
validateSettingList(_) {
|
|
3622
|
+
let HY = aggregateSettingList(_), P = HY.getErrors(), UY = HY.getValue();
|
|
3623
|
+
for (let _ of Object.keys(UY)) P.push(...UY[_].map((HY) => new CompileError(CompileErrorCode.UNEXPECTED_SETTINGS, `Unknown '${_}' setting for DiagramView`, HY)));
|
|
3624
|
+
return P;
|
|
3625
|
+
}
|
|
3626
|
+
validateBody(_) {
|
|
3627
|
+
if (!_) return [];
|
|
3628
|
+
if (_ instanceof FunctionApplicationNode) return [new CompileError(CompileErrorCode.UNEXPECTED_SIMPLE_BODY, "A DiagramView's body must be a block", _)];
|
|
3629
|
+
let [HY, P] = partition_default(_.body, (_) => _ instanceof FunctionApplicationNode);
|
|
3630
|
+
return [...this.validateFields(HY), ...this.validateSubElements(P)];
|
|
3631
|
+
}
|
|
3632
|
+
validateFields(_) {
|
|
3633
|
+
return _.flatMap((_) => {
|
|
3634
|
+
if (isWildcardExpression$2(_.callee)) return [];
|
|
3635
|
+
let HY = [];
|
|
3636
|
+
return HY.push(new CompileError(CompileErrorCode.INVALID_DIAGRAMVIEW_FIELD, "Fields are not allowed at DiagramView level. Use Tables, Notes, TableGroups, or Schemas blocks instead.", _)), HY;
|
|
3637
|
+
});
|
|
3638
|
+
}
|
|
3639
|
+
validateSubElements(_) {
|
|
3640
|
+
let HY = [], P = [
|
|
3641
|
+
"tables",
|
|
3642
|
+
"notes",
|
|
3643
|
+
"tablegroups",
|
|
3644
|
+
"schemas"
|
|
3645
|
+
];
|
|
3646
|
+
for (let UY of _) {
|
|
3647
|
+
if (UY.parent = this.declarationNode, !UY.type) continue;
|
|
3648
|
+
let _ = UY.type.value.toLowerCase();
|
|
3649
|
+
if (!P.includes(_)) {
|
|
3650
|
+
HY.push(new CompileError(CompileErrorCode.INVALID_DIAGRAMVIEW_FIELD, `Unknown block type "${UY.type.value}" in DiagramView. Allowed: Tables, Notes, TableGroups, Schemas`, UY));
|
|
3651
|
+
continue;
|
|
3652
|
+
}
|
|
3653
|
+
HY.push(...this.validateSubBlock(UY)), HY.push(...this.registerSubBlockFields(UY));
|
|
3654
|
+
}
|
|
3655
|
+
return HY;
|
|
3656
|
+
}
|
|
3657
|
+
validateSubBlock(_) {
|
|
3658
|
+
let HY = [];
|
|
3659
|
+
if (!_.body || !(_.body instanceof BlockExpressionNode)) return HY;
|
|
3660
|
+
let P = _.body, UY = P.body.some((_) => _ instanceof FunctionApplicationNode && isWildcardExpression$2(_.callee)), WY = P.body.some((_) => _ instanceof FunctionApplicationNode && !isWildcardExpression$2(_.callee));
|
|
3661
|
+
return UY && WY && HY.push(new CompileWarning(CompileErrorCode.INVALID_DIAGRAMVIEW_FIELD, `Wildcard (*) combined with specific items in ${_.type?.value} block. Specific items will be ignored.`, _)), HY;
|
|
3662
|
+
}
|
|
3663
|
+
registerSubBlockFields(_) {
|
|
3664
|
+
let HY = [];
|
|
3665
|
+
if (!_.body || !(_.body instanceof BlockExpressionNode)) return HY;
|
|
3666
|
+
let P = _.body.body.filter((_) => _ instanceof FunctionApplicationNode);
|
|
3667
|
+
for (let _ of P) {
|
|
3668
|
+
if (_.callee && isExpressionAVariableNode(_.callee)) {
|
|
3669
|
+
if (isWildcardExpression$2(_.callee)) continue;
|
|
3670
|
+
let P = extractVarNameFromPrimaryVariable(_.callee).unwrap(), UY = createDiagramViewFieldSymbolIndex(P), WY = this.symbolFactory.create(DiagramViewFieldSymbol, { declaration: _ });
|
|
3671
|
+
_.symbol = WY;
|
|
3672
|
+
let GY = this.declarationNode.symbol.symbolTable;
|
|
3673
|
+
if (GY.has(UY)) {
|
|
3674
|
+
let WY = GY.get(UY);
|
|
3675
|
+
HY.push(new CompileError(CompileErrorCode.DUPLICATE_DIAGRAMVIEW_FIELD, `${P} already exists in DiagramView`, _), new CompileError(CompileErrorCode.DUPLICATE_DIAGRAMVIEW_FIELD, `${P} already exists in DiagramView`, WY.declaration));
|
|
3676
|
+
} else GY.set(UY, WY);
|
|
3677
|
+
}
|
|
3678
|
+
_.args.length > 0 && HY.push(..._.args.map((_) => new CompileError(CompileErrorCode.INVALID_DIAGRAMVIEW_FIELD, "DiagramView field should only have a single name", _)));
|
|
3679
|
+
}
|
|
3680
|
+
return HY;
|
|
3681
|
+
}
|
|
3682
|
+
};
|
|
3560
3683
|
function pickValidator(_) {
|
|
3561
3684
|
switch (_.type.value.toLowerCase()) {
|
|
3562
3685
|
case ElementKind.Enum: return EnumValidator;
|
|
@@ -3569,6 +3692,7 @@ function pickValidator(_) {
|
|
|
3569
3692
|
case ElementKind.TablePartial: return TablePartialValidator;
|
|
3570
3693
|
case ElementKind.Check: return ChecksValidator;
|
|
3571
3694
|
case ElementKind.Records: return RecordsValidator;
|
|
3695
|
+
case ElementKind.DiagramView: return DiagramViewValidator;
|
|
3572
3696
|
default: return CustomValidator;
|
|
3573
3697
|
}
|
|
3574
3698
|
}
|
|
@@ -3670,7 +3794,8 @@ function getElementKind(_) {
|
|
|
3670
3794
|
case ElementKind.TableGroup:
|
|
3671
3795
|
case ElementKind.TablePartial:
|
|
3672
3796
|
case ElementKind.Check:
|
|
3673
|
-
case ElementKind.Records:
|
|
3797
|
+
case ElementKind.Records:
|
|
3798
|
+
case ElementKind.DiagramView: return new Some(HY);
|
|
3674
3799
|
default: return new None();
|
|
3675
3800
|
}
|
|
3676
3801
|
}
|
|
@@ -4610,7 +4735,8 @@ var Lexer = class {
|
|
|
4610
4735
|
}
|
|
4611
4736
|
leftExpression_bp() {
|
|
4612
4737
|
let _;
|
|
4613
|
-
if (
|
|
4738
|
+
if (this.check(SyntaxTokenKind.OP) && this.peek().value === "*") this.advance(), _ = this.nodeFactory.create(PrimaryExpressionNode, { expression: this.nodeFactory.create(VariableNode, { variable: this.previous() }) });
|
|
4739
|
+
else if (isOpToken(this.peek())) {
|
|
4614
4740
|
let HY = {};
|
|
4615
4741
|
HY.op = this.peek();
|
|
4616
4742
|
let P = prefixBindingPower(HY.op);
|
|
@@ -4828,6 +4954,95 @@ var Validator = class {
|
|
|
4828
4954
|
bindSubElements(_) {
|
|
4829
4955
|
return _.flatMap((_) => _.type ? new (pickBinder(_))(_, this.ast, this.symbolFactory).bind() : []);
|
|
4830
4956
|
}
|
|
4957
|
+
};
|
|
4958
|
+
function isWildcardExpression$1(_) {
|
|
4959
|
+
return _ && _ instanceof PrimaryExpressionNode && _.expression instanceof VariableNode ? _.expression.variable?.value === "*" : !1;
|
|
4960
|
+
}
|
|
4961
|
+
var DiagramViewBinder = class {
|
|
4962
|
+
constructor(_, HY, P) {
|
|
4963
|
+
this.declarationNode = _, this.ast = HY, this.symbolFactory = P;
|
|
4964
|
+
}
|
|
4965
|
+
bind() {
|
|
4966
|
+
return this.declarationNode.body instanceof BlockExpressionNode ? this.bindBody(this.declarationNode.body) : [];
|
|
4967
|
+
}
|
|
4968
|
+
bindBody(_) {
|
|
4969
|
+
let [, HY] = partition_default(_.body, (_) => _ instanceof FunctionApplicationNode);
|
|
4970
|
+
return this.bindSubElements(HY);
|
|
4971
|
+
}
|
|
4972
|
+
bindSubElements(_) {
|
|
4973
|
+
return _.flatMap((_) => {
|
|
4974
|
+
if (!_.type) return [];
|
|
4975
|
+
let HY = _.type.value.toLowerCase();
|
|
4976
|
+
if (!(_.body instanceof BlockExpressionNode)) return [];
|
|
4977
|
+
let P = [];
|
|
4978
|
+
switch (HY) {
|
|
4979
|
+
case "tables":
|
|
4980
|
+
P.push(...this.bindTableReferences(_.body));
|
|
4981
|
+
break;
|
|
4982
|
+
case "notes":
|
|
4983
|
+
P.push(...this.bindNoteReferences(_.body));
|
|
4984
|
+
break;
|
|
4985
|
+
case "tablegroups":
|
|
4986
|
+
P.push(...this.bindTableGroupReferences(_.body));
|
|
4987
|
+
break;
|
|
4988
|
+
case "schemas":
|
|
4989
|
+
P.push(...this.bindSchemaReferences(_.body));
|
|
4990
|
+
break;
|
|
4991
|
+
default: break;
|
|
4992
|
+
}
|
|
4993
|
+
return P;
|
|
4994
|
+
});
|
|
4995
|
+
}
|
|
4996
|
+
bindTableReferences(_) {
|
|
4997
|
+
let [HY] = partition_default(_.body, (_) => _ instanceof FunctionApplicationNode);
|
|
4998
|
+
return HY.flatMap((_) => !_.callee || isWildcardExpression$1(_.callee) ? [] : [_.callee, ..._.args].flatMap(scanNonListNodeForBinding).flatMap((_) => {
|
|
4999
|
+
let HY = _.variables.pop();
|
|
5000
|
+
if (!HY) return [];
|
|
5001
|
+
let P = _.variables;
|
|
5002
|
+
return lookupAndBindInScope(this.ast, [...P.map((_) => ({
|
|
5003
|
+
node: _,
|
|
5004
|
+
kind: SymbolKind.Schema
|
|
5005
|
+
})), {
|
|
5006
|
+
node: HY,
|
|
5007
|
+
kind: SymbolKind.Table
|
|
5008
|
+
}]);
|
|
5009
|
+
}));
|
|
5010
|
+
}
|
|
5011
|
+
bindNoteReferences(_) {
|
|
5012
|
+
let [HY] = partition_default(_.body, (_) => _ instanceof FunctionApplicationNode);
|
|
5013
|
+
return HY.flatMap((_) => !_.callee || isWildcardExpression$1(_.callee) ? [] : scanNonListNodeForBinding(_.callee).flatMap((_) => {
|
|
5014
|
+
let HY = _.variables.pop();
|
|
5015
|
+
return HY ? lookupAndBindInScope(this.ast, [{
|
|
5016
|
+
node: HY,
|
|
5017
|
+
kind: SymbolKind.Note
|
|
5018
|
+
}]) : [];
|
|
5019
|
+
}));
|
|
5020
|
+
}
|
|
5021
|
+
bindTableGroupReferences(_) {
|
|
5022
|
+
let [HY] = partition_default(_.body, (_) => _ instanceof FunctionApplicationNode);
|
|
5023
|
+
return HY.flatMap((_) => !_.callee || isWildcardExpression$1(_.callee) ? [] : scanNonListNodeForBinding(_.callee).flatMap((_) => {
|
|
5024
|
+
let HY = _.variables.pop();
|
|
5025
|
+
if (!HY) return [];
|
|
5026
|
+
let P = _.variables;
|
|
5027
|
+
return lookupAndBindInScope(this.ast, [...P.map((_) => ({
|
|
5028
|
+
node: _,
|
|
5029
|
+
kind: SymbolKind.Schema
|
|
5030
|
+
})), {
|
|
5031
|
+
node: HY,
|
|
5032
|
+
kind: SymbolKind.TableGroup
|
|
5033
|
+
}]);
|
|
5034
|
+
}));
|
|
5035
|
+
}
|
|
5036
|
+
bindSchemaReferences(_) {
|
|
5037
|
+
let [HY] = partition_default(_.body, (_) => _ instanceof FunctionApplicationNode);
|
|
5038
|
+
return HY.flatMap((_) => !_.callee || isWildcardExpression$1(_.callee) ? [] : scanNonListNodeForBinding(_.callee).flatMap((_) => {
|
|
5039
|
+
let HY = _.variables.pop();
|
|
5040
|
+
return HY ? lookupAndBindInScope(this.ast, [{
|
|
5041
|
+
node: HY,
|
|
5042
|
+
kind: SymbolKind.Schema
|
|
5043
|
+
}]) : [];
|
|
5044
|
+
}));
|
|
5045
|
+
}
|
|
4831
5046
|
}, EnumBinder = class {
|
|
4832
5047
|
constructor(_, HY, P) {
|
|
4833
5048
|
this.declarationNode = _, this.ast = HY, this.symbolFactory = P;
|
|
@@ -5171,6 +5386,7 @@ function getSymbolKind(_) {
|
|
|
5171
5386
|
if (_ instanceof TablePartialSymbol) return SymbolKind.TablePartial;
|
|
5172
5387
|
if (_ instanceof TablePartialInjectedColumnSymbol) return SymbolKind.Column;
|
|
5173
5388
|
if (_ instanceof PartialInjectionSymbol) return SymbolKind.PartialInjection;
|
|
5389
|
+
if (_ instanceof StickyNoteSymbol) return SymbolKind.Note;
|
|
5174
5390
|
throw Error("No other possible symbol kind in getSymbolKind");
|
|
5175
5391
|
}
|
|
5176
5392
|
var RecordsBinder = class {
|
|
@@ -5274,6 +5490,7 @@ function pickBinder(_) {
|
|
|
5274
5490
|
case ElementKind.TablePartial: return TablePartialBinder;
|
|
5275
5491
|
case ElementKind.Check: return ChecksBinder;
|
|
5276
5492
|
case ElementKind.Records: return RecordsBinder;
|
|
5493
|
+
case ElementKind.DiagramView: return DiagramViewBinder;
|
|
5277
5494
|
default: return CustomBinder;
|
|
5278
5495
|
}
|
|
5279
5496
|
}
|
|
@@ -6114,6 +6331,117 @@ var TableInterpreter = class {
|
|
|
6114
6331
|
}
|
|
6115
6332
|
});
|
|
6116
6333
|
}
|
|
6334
|
+
};
|
|
6335
|
+
function isWildcardExpression(_) {
|
|
6336
|
+
return _ && _ instanceof PrimaryExpressionNode && _.expression instanceof VariableNode ? _.expression.variable?.value === "*" : !1;
|
|
6337
|
+
}
|
|
6338
|
+
var DiagramViewInterpreter = class {
|
|
6339
|
+
constructor(_, HY) {
|
|
6340
|
+
this.declarationNode = _, this.env = HY, this.diagramView = {
|
|
6341
|
+
visibleEntities: {
|
|
6342
|
+
tables: null,
|
|
6343
|
+
stickyNotes: null,
|
|
6344
|
+
tableGroups: null,
|
|
6345
|
+
schemas: null
|
|
6346
|
+
},
|
|
6347
|
+
_explicitWildcards: /* @__PURE__ */ new Set(),
|
|
6348
|
+
_explicitlySet: /* @__PURE__ */ new Set()
|
|
6349
|
+
};
|
|
6350
|
+
}
|
|
6351
|
+
interpret() {
|
|
6352
|
+
let _ = [];
|
|
6353
|
+
return this.diagramView.token = getTokenPosition(this.declarationNode), this.env.diagramViews || (this.env.diagramViews = /* @__PURE__ */ new Map()), this.env.diagramViews.set(this.declarationNode, this.diagramView), this.declarationNode.name && _.push(...this.interpretName(this.declarationNode.name)), this.declarationNode.body instanceof BlockExpressionNode && _.push(...this.interpretBody(this.declarationNode.body)), _;
|
|
6354
|
+
}
|
|
6355
|
+
interpretName(_) {
|
|
6356
|
+
let HY = destructureComplexVariable(_).unwrap_or([]);
|
|
6357
|
+
return HY.length > 0 && (this.diagramView.name = HY[HY.length - 1], HY.length > 1 && (this.diagramView.schemaName = HY.slice(0, -1).join("."))), [];
|
|
6358
|
+
}
|
|
6359
|
+
interpretBody(_) {
|
|
6360
|
+
if (_.body.length === 1) {
|
|
6361
|
+
let HY = _.body[0];
|
|
6362
|
+
if (HY instanceof FunctionApplicationNode && isWildcardExpression(HY.callee)) return this.diagramView.visibleEntities = {
|
|
6363
|
+
tables: [],
|
|
6364
|
+
stickyNotes: [],
|
|
6365
|
+
tableGroups: [],
|
|
6366
|
+
schemas: []
|
|
6367
|
+
}, this.diagramView._explicitWildcards = new Set([
|
|
6368
|
+
"tables",
|
|
6369
|
+
"stickyNotes",
|
|
6370
|
+
"tableGroups",
|
|
6371
|
+
"schemas"
|
|
6372
|
+
]), this.diagramView._explicitlySet = new Set([
|
|
6373
|
+
"tables",
|
|
6374
|
+
"stickyNotes",
|
|
6375
|
+
"tableGroups",
|
|
6376
|
+
"schemas"
|
|
6377
|
+
]), [];
|
|
6378
|
+
}
|
|
6379
|
+
let [HY] = partition_default(_.body, (_) => _ instanceof ElementDeclarationNode), P = /* @__PURE__ */ new Set();
|
|
6380
|
+
for (let _ of HY) {
|
|
6381
|
+
let HY = _.type?.value.toLowerCase();
|
|
6382
|
+
HY && P.add(HY), _.body instanceof BlockExpressionNode && this.interpretSubBlock(_.body, HY);
|
|
6383
|
+
}
|
|
6384
|
+
let UY = this.diagramView.visibleEntities;
|
|
6385
|
+
return (P.has("tables") && UY.tables !== null || P.has("tablegroups") && UY.tableGroups !== null || P.has("schemas") && UY.schemas !== null) && (P.has("tables") || (UY.tables = []), P.has("tablegroups") || (UY.tableGroups = []), P.has("schemas") || (UY.schemas = [])), P.has("tables") && this.diagramView._explicitlySet.add("tables"), P.has("tablegroups") && this.diagramView._explicitlySet.add("tableGroups"), P.has("schemas") && this.diagramView._explicitlySet.add("schemas"), P.has("notes") && this.diagramView._explicitlySet.add("stickyNotes"), [];
|
|
6386
|
+
}
|
|
6387
|
+
interpretSubBlock(_, HY) {
|
|
6388
|
+
if (!HY) return;
|
|
6389
|
+
if (_.body.some((_) => _ instanceof FunctionApplicationNode && isWildcardExpression(_.callee))) {
|
|
6390
|
+
switch (HY) {
|
|
6391
|
+
case "tables":
|
|
6392
|
+
this.diagramView.visibleEntities.tables = [], this.diagramView._explicitWildcards.add("tables");
|
|
6393
|
+
break;
|
|
6394
|
+
case "notes":
|
|
6395
|
+
this.diagramView.visibleEntities.stickyNotes = [], this.diagramView._explicitWildcards.add("stickyNotes");
|
|
6396
|
+
break;
|
|
6397
|
+
case "tablegroups":
|
|
6398
|
+
this.diagramView.visibleEntities.tableGroups = [], this.diagramView._explicitWildcards.add("tableGroups");
|
|
6399
|
+
break;
|
|
6400
|
+
case "schemas":
|
|
6401
|
+
this.diagramView.visibleEntities.schemas = [], this.diagramView._explicitWildcards.add("schemas");
|
|
6402
|
+
break;
|
|
6403
|
+
}
|
|
6404
|
+
return;
|
|
6405
|
+
}
|
|
6406
|
+
if (_.body.length === 0) return;
|
|
6407
|
+
let P = [];
|
|
6408
|
+
for (let HY of _.body) {
|
|
6409
|
+
if (!(HY instanceof FunctionApplicationNode)) continue;
|
|
6410
|
+
let _ = extractReferee(HY.callee);
|
|
6411
|
+
if (_?.declaration instanceof ElementDeclarationNode) {
|
|
6412
|
+
let HY = destructureComplexVariable(_.declaration.name).unwrap_or([]);
|
|
6413
|
+
if (HY.length > 0) {
|
|
6414
|
+
let _ = HY[HY.length - 1], UY = HY.length > 1 ? HY.slice(0, -1).join(".") : DEFAULT_SCHEMA_NAME$1;
|
|
6415
|
+
P.push({
|
|
6416
|
+
name: _,
|
|
6417
|
+
schemaName: UY
|
|
6418
|
+
});
|
|
6419
|
+
continue;
|
|
6420
|
+
}
|
|
6421
|
+
}
|
|
6422
|
+
let UY = destructureComplexVariable(HY.callee).unwrap_or([]);
|
|
6423
|
+
if (UY.length === 0) continue;
|
|
6424
|
+
let WY = UY[UY.length - 1], GY = UY.length > 1 ? UY[0] : DEFAULT_SCHEMA_NAME$1;
|
|
6425
|
+
P.push({
|
|
6426
|
+
name: WY,
|
|
6427
|
+
schemaName: GY
|
|
6428
|
+
});
|
|
6429
|
+
}
|
|
6430
|
+
switch (HY) {
|
|
6431
|
+
case "tables":
|
|
6432
|
+
this.diagramView.visibleEntities.tables = P.length > 0 ? P : null;
|
|
6433
|
+
break;
|
|
6434
|
+
case "notes":
|
|
6435
|
+
this.diagramView.visibleEntities.stickyNotes = P.length > 0 ? P.map((_) => ({ name: _.name })) : null;
|
|
6436
|
+
break;
|
|
6437
|
+
case "tablegroups":
|
|
6438
|
+
this.diagramView.visibleEntities.tableGroups = P.length > 0 ? P.map((_) => ({ name: _.name })) : null;
|
|
6439
|
+
break;
|
|
6440
|
+
case "schemas":
|
|
6441
|
+
this.diagramView.visibleEntities.schemas = P.length > 0 ? P.map((_) => ({ name: _.name })) : null;
|
|
6442
|
+
break;
|
|
6443
|
+
}
|
|
6444
|
+
}
|
|
6117
6445
|
}, DIALECT_INTEGER_TYPES = {
|
|
6118
6446
|
mysql: new Set([
|
|
6119
6447
|
"int",
|
|
@@ -10196,6 +10524,16 @@ function processColumnInDb(_) {
|
|
|
10196
10524
|
}))
|
|
10197
10525
|
};
|
|
10198
10526
|
}
|
|
10527
|
+
var WILDCARD_EXPAND_ENTITIES = new Set(["tableGroups"]);
|
|
10528
|
+
function expandDiagramViewWildcards(_) {
|
|
10529
|
+
if (_.diagramViews) for (let HY of _.diagramViews.values()) {
|
|
10530
|
+
let P = HY.visibleEntities, UY = HY._explicitWildcards, WY = HY._explicitlySet;
|
|
10531
|
+
!UY || !WY || (WILDCARD_EXPAND_ENTITIES.has("tables") && UY.has("tables") && P.tables && P.tables.length === 0 && (WY.has("tableGroups") || WY.has("schemas") || (P.tables = Array.from(_.tables.values()).map((_) => ({
|
|
10532
|
+
name: _.name,
|
|
10533
|
+
schemaName: _.schemaName || "public"
|
|
10534
|
+
})))), WILDCARD_EXPAND_ENTITIES.has("tableGroups") && UY.has("tableGroups") && P.tableGroups && P.tableGroups.length === 0 && (WY.has("tables") || WY.has("schemas") || (P.tableGroups = Array.from(_.tableGroups.values()).map((_) => ({ name: _.name })))), WILDCARD_EXPAND_ENTITIES.has("stickyNotes") && UY.has("stickyNotes") && P.stickyNotes && P.stickyNotes.length === 0 && (P.stickyNotes = Array.from(_.notes.values()).map((_) => ({ name: _.name }))), WILDCARD_EXPAND_ENTITIES.has("schemas") && UY.has("schemas") && P.schemas && P.schemas.length === 0 && (WY.has("tables") || WY.has("tableGroups") || (P.schemas = [...new Set(Array.from(_.tables.values()).map((_) => _.schemaName || "public"))].map((_) => ({ name: _ })))), delete HY._explicitWildcards, delete HY._explicitlySet);
|
|
10535
|
+
}
|
|
10536
|
+
}
|
|
10199
10537
|
function convertEnvToDb(_) {
|
|
10200
10538
|
let HY = [];
|
|
10201
10539
|
for (let [P, UY] of _.records) {
|
|
@@ -10227,7 +10565,8 @@ function convertEnvToDb(_) {
|
|
|
10227
10565
|
aliases: _.aliases,
|
|
10228
10566
|
project: Array.from(_.project.values())[0] || {},
|
|
10229
10567
|
tablePartials: Array.from(_.tablePartials.values()).map(processColumnInDb),
|
|
10230
|
-
records: HY
|
|
10568
|
+
records: HY,
|
|
10569
|
+
diagramViews: _.diagramViews ? Array.from(_.diagramViews.values()) : []
|
|
10231
10570
|
};
|
|
10232
10571
|
}
|
|
10233
10572
|
var Interpreter = class {
|
|
@@ -10247,7 +10586,8 @@ var Interpreter = class {
|
|
|
10247
10586
|
records: /* @__PURE__ */ new Map(),
|
|
10248
10587
|
recordsElements: [],
|
|
10249
10588
|
cachedMergedTables: /* @__PURE__ */ new Map(),
|
|
10250
|
-
source: _.source
|
|
10589
|
+
source: _.source,
|
|
10590
|
+
diagramViews: /* @__PURE__ */ new Map()
|
|
10251
10591
|
};
|
|
10252
10592
|
}
|
|
10253
10593
|
interpret() {
|
|
@@ -10260,6 +10600,7 @@ var Interpreter = class {
|
|
|
10260
10600
|
case ElementKind.TablePartial: return new TablePartialInterpreter(_, this.env).interpret();
|
|
10261
10601
|
case ElementKind.Enum: return new EnumInterpreter(_, this.env).interpret();
|
|
10262
10602
|
case ElementKind.Project: return new ProjectInterpreter(_, this.env).interpret();
|
|
10603
|
+
case ElementKind.DiagramView: return new DiagramViewInterpreter(_, this.env).interpret();
|
|
10263
10604
|
case ElementKind.Records: return this.env.recordsElements.push(_), [];
|
|
10264
10605
|
default: return [];
|
|
10265
10606
|
}
|
|
@@ -10268,7 +10609,7 @@ var Interpreter = class {
|
|
|
10268
10609
|
let P = new RecordsInterpreter(this.env).interpret(this.env.recordsElements);
|
|
10269
10610
|
_.push(...P.getErrors()), HY.push(...P.getWarnings());
|
|
10270
10611
|
}
|
|
10271
|
-
return new Report(convertEnvToDb(this.env), _, HY);
|
|
10612
|
+
return expandDiagramViewWildcards(this.env), new Report(convertEnvToDb(this.env), _, HY);
|
|
10272
10613
|
}
|
|
10273
10614
|
}, CompletionItemKind = /* @__PURE__ */ function(_) {
|
|
10274
10615
|
return _[_.Function = 1] = "Function", _[_.Constructor = 2] = "Constructor", _[_.Field = 3] = "Field", _[_.Variable = 4] = "Variable", _[_.Class = 5] = "Class", _[_.Struct = 6] = "Struct", _[_.Interface = 7] = "Interface", _[_.Module = 8] = "Module", _[_.Property = 9] = "Property", _[_.Event = 10] = "Event", _[_.Operator = 11] = "Operator", _[_.Unit = 12] = "Unit", _[_.Value = 13] = "Value", _[_.Constant = 14] = "Constant", _[_.Enum = 15] = "Enum", _[_.EnumMember = 16] = "EnumMember", _[_.Keyword = 17] = "Keyword", _[_.Text = 18] = "Text", _[_.Color = 19] = "Color", _[_.File = 20] = "File", _[_.Reference = 21] = "Reference", _[_.Customcolor = 22] = "Customcolor", _[_.Folder = 23] = "Folder", _[_.TypeParameter = 24] = "TypeParameter", _[_.User = 25] = "User", _[_.Issue = 26] = "Issue", _[_.Snippet = 27] = "Snippet", _;
|
|
@@ -10787,6 +11128,11 @@ function suggestInSubField(_, HY, P) {
|
|
|
10787
11128
|
return _.container.token(HY).token?.kind === SyntaxTokenKind.COLON && shouldPrependSpace(_.container.token(HY).token, HY) ? prependSpace(P) : P;
|
|
10788
11129
|
}
|
|
10789
11130
|
case ScopeKind.TABLEGROUP: return suggestInTableGroupField(_);
|
|
11131
|
+
case ScopeKind.DIAGRAMVIEW: return suggestInDiagramViewField();
|
|
11132
|
+
case ScopeKind.CUSTOM: {
|
|
11133
|
+
let P = _.container.element(HY);
|
|
11134
|
+
return P instanceof ElementDeclarationNode && P.parent instanceof ElementDeclarationNode && P.parent.type?.value.toLowerCase() === "diagramview" ? suggestInDiagramViewSubBlock(_, HY) : noSuggestions();
|
|
11135
|
+
}
|
|
10790
11136
|
default: return noSuggestions();
|
|
10791
11137
|
}
|
|
10792
11138
|
}
|
|
@@ -10798,7 +11144,8 @@ function suggestTopLevelElementType() {
|
|
|
10798
11144
|
"Project",
|
|
10799
11145
|
"Ref",
|
|
10800
11146
|
"TablePartial",
|
|
10801
|
-
"Records"
|
|
11147
|
+
"Records",
|
|
11148
|
+
"DiagramView"
|
|
10802
11149
|
].map((_) => ({
|
|
10803
11150
|
label: _,
|
|
10804
11151
|
insertText: _,
|
|
@@ -10905,6 +11252,82 @@ function suggestInTableGroupField(_) {
|
|
|
10905
11252
|
range: void 0
|
|
10906
11253
|
}))] };
|
|
10907
11254
|
}
|
|
11255
|
+
function suggestInDiagramViewField() {
|
|
11256
|
+
return { suggestions: [...[
|
|
11257
|
+
"Tables",
|
|
11258
|
+
"TableGroups",
|
|
11259
|
+
"Notes",
|
|
11260
|
+
"Schemas"
|
|
11261
|
+
].map((_) => ({
|
|
11262
|
+
label: _,
|
|
11263
|
+
insertText: _,
|
|
11264
|
+
insertTextRules: CompletionItemInsertTextRule.KeepWhitespace,
|
|
11265
|
+
kind: CompletionItemKind.Keyword,
|
|
11266
|
+
range: void 0
|
|
11267
|
+
})), {
|
|
11268
|
+
label: "*",
|
|
11269
|
+
insertText: "*",
|
|
11270
|
+
insertTextRules: CompletionItemInsertTextRule.KeepWhitespace,
|
|
11271
|
+
kind: CompletionItemKind.Keyword,
|
|
11272
|
+
range: void 0
|
|
11273
|
+
}] };
|
|
11274
|
+
}
|
|
11275
|
+
function suggestInDiagramViewSubBlock(_, HY) {
|
|
11276
|
+
let P = _.container.element(HY);
|
|
11277
|
+
if (!(P instanceof ElementDeclarationNode)) return noSuggestions();
|
|
11278
|
+
let UY = P.type?.value.toLowerCase(), WY = {
|
|
11279
|
+
label: "*",
|
|
11280
|
+
insertText: "*",
|
|
11281
|
+
insertTextRules: CompletionItemInsertTextRule.KeepWhitespace,
|
|
11282
|
+
kind: CompletionItemKind.Keyword,
|
|
11283
|
+
range: void 0
|
|
11284
|
+
};
|
|
11285
|
+
switch (UY) {
|
|
11286
|
+
case "tables": return { suggestions: [WY, ...addQuoteToSuggestionIfNeeded({ suggestions: [..._.parse.publicSymbolTable().entries()].flatMap(([_]) => {
|
|
11287
|
+
let HY = destructureIndex(_).unwrap_or(void 0);
|
|
11288
|
+
if (HY === void 0) return [];
|
|
11289
|
+
let { kind: P, name: UY } = HY;
|
|
11290
|
+
return P !== SymbolKind.Table && P !== SymbolKind.Schema ? [] : {
|
|
11291
|
+
label: UY,
|
|
11292
|
+
insertText: UY,
|
|
11293
|
+
insertTextRules: CompletionItemInsertTextRule.KeepWhitespace,
|
|
11294
|
+
kind: pickCompletionItemKind(P),
|
|
11295
|
+
range: void 0
|
|
11296
|
+
};
|
|
11297
|
+
}) }).suggestions] };
|
|
11298
|
+
case "tablegroups": return { suggestions: [WY, ...addQuoteToSuggestionIfNeeded({ suggestions: [..._.parse.publicSymbolTable().entries()].flatMap(([_]) => {
|
|
11299
|
+
let HY = destructureIndex(_).unwrap_or(void 0);
|
|
11300
|
+
if (HY === void 0) return [];
|
|
11301
|
+
let { kind: P, name: UY } = HY;
|
|
11302
|
+
return P === SymbolKind.TableGroup ? {
|
|
11303
|
+
label: UY,
|
|
11304
|
+
insertText: UY,
|
|
11305
|
+
insertTextRules: CompletionItemInsertTextRule.KeepWhitespace,
|
|
11306
|
+
kind: pickCompletionItemKind(P),
|
|
11307
|
+
range: void 0
|
|
11308
|
+
} : [];
|
|
11309
|
+
}) }).suggestions] };
|
|
11310
|
+
case "schemas": {
|
|
11311
|
+
let HY = /* @__PURE__ */ new Set(), P = _.parse.ast();
|
|
11312
|
+
for (let _ of P?.body || []) if (_ instanceof ElementDeclarationNode && _.name instanceof InfixExpressionNode && _.name.op?.value === ".") {
|
|
11313
|
+
let P = destructureMemberAccessExpression(_.name).unwrap_or([]);
|
|
11314
|
+
if (P.length >= 2) {
|
|
11315
|
+
let _ = extractVariableFromExpression(P[0]).unwrap_or("");
|
|
11316
|
+
_ && HY.add(_);
|
|
11317
|
+
}
|
|
11318
|
+
}
|
|
11319
|
+
return { suggestions: [WY, ...[...HY].map((_) => ({
|
|
11320
|
+
label: _,
|
|
11321
|
+
insertText: _,
|
|
11322
|
+
insertTextRules: CompletionItemInsertTextRule.KeepWhitespace,
|
|
11323
|
+
kind: CompletionItemKind.Module,
|
|
11324
|
+
range: void 0
|
|
11325
|
+
}))] };
|
|
11326
|
+
}
|
|
11327
|
+
case "notes": return { suggestions: [WY] };
|
|
11328
|
+
default: return noSuggestions();
|
|
11329
|
+
}
|
|
11330
|
+
}
|
|
10908
11331
|
function suggestInIndex(_, HY) {
|
|
10909
11332
|
return suggestColumnNameInIndexes(_, HY);
|
|
10910
11333
|
}
|
|
@@ -11035,6 +11458,200 @@ var DBMLDefinitionProvider = class {
|
|
|
11035
11458
|
getSeverityValue(_) {
|
|
11036
11459
|
return _ === "error" ? MarkerSeverity.Error : MarkerSeverity.Warning;
|
|
11037
11460
|
}
|
|
11461
|
+
}, dbmlMonarchTokensProvider = {
|
|
11462
|
+
tokenPostfix: ".dbml",
|
|
11463
|
+
brackets: [
|
|
11464
|
+
{
|
|
11465
|
+
open: "[",
|
|
11466
|
+
close: "]",
|
|
11467
|
+
token: "delimiter.square"
|
|
11468
|
+
},
|
|
11469
|
+
{
|
|
11470
|
+
open: "(",
|
|
11471
|
+
close: ")",
|
|
11472
|
+
token: "delimiter.parenthesis"
|
|
11473
|
+
},
|
|
11474
|
+
{
|
|
11475
|
+
open: "{",
|
|
11476
|
+
close: "}",
|
|
11477
|
+
token: "delimiter.curly"
|
|
11478
|
+
}
|
|
11479
|
+
],
|
|
11480
|
+
decls: [
|
|
11481
|
+
"project",
|
|
11482
|
+
"tablegroup",
|
|
11483
|
+
"table",
|
|
11484
|
+
"enum",
|
|
11485
|
+
"ref",
|
|
11486
|
+
"note",
|
|
11487
|
+
"tablepartial",
|
|
11488
|
+
"records",
|
|
11489
|
+
"checks",
|
|
11490
|
+
"diagramview"
|
|
11491
|
+
],
|
|
11492
|
+
dataTypes: /* @__PURE__ */ "TINYINT.SMALLINT.MEDIUMINT.INT.INTEGER.BIGINT.FLOAT.DOUBLE.DECIMAL.DEC.BIT.BOOL.REAL.MONEY.BINARY_FLOAT.BINARY_DOUBLE.smallmoney.ENUM.CHAR.BINARY.VARCHAR.VARBINARY.TINYBLOB.TINYTEXT.BLOB.TEXT.MEDIUMBLOB.MEDIUMTEXT.LONGBLOB.LONGTEXT.SET.INET6.UUID.NVARCHAR.NCHAR.NTEXT.IMAGE.VARCHAR2.NVARCHAR2.DATE.TIME.DATETIME.DATETIME2.TIMESTAMP.YEAR.smalldatetime.datetimeoffset.XML.sql_variant.uniqueidentifier.CURSOR.BFILE.CLOB.NCLOB.RAW".split("."),
|
|
11493
|
+
settings: [
|
|
11494
|
+
"indexes",
|
|
11495
|
+
"ref",
|
|
11496
|
+
"note",
|
|
11497
|
+
"headercolor",
|
|
11498
|
+
"pk",
|
|
11499
|
+
"null",
|
|
11500
|
+
"increment",
|
|
11501
|
+
"unique",
|
|
11502
|
+
"default",
|
|
11503
|
+
"note",
|
|
11504
|
+
"primary",
|
|
11505
|
+
"key",
|
|
11506
|
+
"name",
|
|
11507
|
+
"as",
|
|
11508
|
+
"color",
|
|
11509
|
+
"check",
|
|
11510
|
+
"tables",
|
|
11511
|
+
"tablegroups",
|
|
11512
|
+
"notes",
|
|
11513
|
+
"schemas"
|
|
11514
|
+
],
|
|
11515
|
+
symbols: /[=><!~?:&|+\-\/\^%]+/,
|
|
11516
|
+
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
11517
|
+
newline: /[\r\n]/,
|
|
11518
|
+
digits: /\d+(_+\d+)*/,
|
|
11519
|
+
idtf: /[\p{L}0-9_]+/u,
|
|
11520
|
+
ignoreCase: !0,
|
|
11521
|
+
unicode: !0,
|
|
11522
|
+
tokenizer: {
|
|
11523
|
+
root: [
|
|
11524
|
+
[/[{}\[\]\(\)]/, "@bracket"],
|
|
11525
|
+
[/[,.:]/, "delimiter"],
|
|
11526
|
+
{ include: "@numbers" },
|
|
11527
|
+
{ include: "common" }
|
|
11528
|
+
],
|
|
11529
|
+
common: [
|
|
11530
|
+
{ include: "@whitespace" },
|
|
11531
|
+
[/[<>-]/, "operators"],
|
|
11532
|
+
[/\*/, "keyword.wildcard"],
|
|
11533
|
+
[/("[^"\\]*(?:\\.[^"\\]*)*")(\s+)(@idtf(?:\.@idtf*)*)/, [
|
|
11534
|
+
"string",
|
|
11535
|
+
"",
|
|
11536
|
+
"keyword"
|
|
11537
|
+
]],
|
|
11538
|
+
[/"([^"\\]|\\.)*$/, ""],
|
|
11539
|
+
[/'([^'\\]|\\.)*$/, ""],
|
|
11540
|
+
[
|
|
11541
|
+
/"/,
|
|
11542
|
+
"string",
|
|
11543
|
+
"@string_double"
|
|
11544
|
+
],
|
|
11545
|
+
[
|
|
11546
|
+
/'/,
|
|
11547
|
+
"string",
|
|
11548
|
+
"@string_single"
|
|
11549
|
+
],
|
|
11550
|
+
[
|
|
11551
|
+
/`/,
|
|
11552
|
+
"string",
|
|
11553
|
+
"@string_backtick"
|
|
11554
|
+
],
|
|
11555
|
+
[/(@idtf)(\s+)(@idtf(?:\.@idtf)*)/, { cases: {
|
|
11556
|
+
"$1@decls": [
|
|
11557
|
+
"keyword",
|
|
11558
|
+
"",
|
|
11559
|
+
"identifier"
|
|
11560
|
+
],
|
|
11561
|
+
"$1==not": { cases: {
|
|
11562
|
+
"$3==null": [
|
|
11563
|
+
"keyword",
|
|
11564
|
+
"",
|
|
11565
|
+
"keyword"
|
|
11566
|
+
],
|
|
11567
|
+
"@default": [
|
|
11568
|
+
"identifier",
|
|
11569
|
+
"",
|
|
11570
|
+
"identifier"
|
|
11571
|
+
]
|
|
11572
|
+
} },
|
|
11573
|
+
"@default": [
|
|
11574
|
+
"identifier",
|
|
11575
|
+
"",
|
|
11576
|
+
"keyword"
|
|
11577
|
+
]
|
|
11578
|
+
} }],
|
|
11579
|
+
[/@idtf/, { cases: {
|
|
11580
|
+
"@dataTypes": "keyword",
|
|
11581
|
+
"@decls": "keyword",
|
|
11582
|
+
"@settings": "keyword",
|
|
11583
|
+
"@default": "identifier"
|
|
11584
|
+
} }]
|
|
11585
|
+
],
|
|
11586
|
+
numbers: [
|
|
11587
|
+
[/0[xX][0-9a-fA-F]*/, "number"],
|
|
11588
|
+
[/[$][+-]*\d*(\.\d*)?/, "number"],
|
|
11589
|
+
[/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, "number"],
|
|
11590
|
+
[/#([0-9A-F]{3}){1,2}/, "number.hex"]
|
|
11591
|
+
],
|
|
11592
|
+
string_double: [
|
|
11593
|
+
[/[^\\"]+/, "string"],
|
|
11594
|
+
[/@escapes/, "string.escape"],
|
|
11595
|
+
[/\\./, "string.escape.invalid"],
|
|
11596
|
+
[
|
|
11597
|
+
/"/,
|
|
11598
|
+
"string",
|
|
11599
|
+
"@pop"
|
|
11600
|
+
]
|
|
11601
|
+
],
|
|
11602
|
+
string_single: [
|
|
11603
|
+
[/[^\\']+/, "string"],
|
|
11604
|
+
[/@escapes/, "string.escape"],
|
|
11605
|
+
[/\\./, "string.escape.invalid"],
|
|
11606
|
+
[
|
|
11607
|
+
/'/,
|
|
11608
|
+
"string",
|
|
11609
|
+
"@pop"
|
|
11610
|
+
]
|
|
11611
|
+
],
|
|
11612
|
+
string_backtick: [
|
|
11613
|
+
[/[^\\`$]+/, "string"],
|
|
11614
|
+
[/@escapes/, "string.escape"],
|
|
11615
|
+
[
|
|
11616
|
+
/`/,
|
|
11617
|
+
"string",
|
|
11618
|
+
"@pop"
|
|
11619
|
+
]
|
|
11620
|
+
],
|
|
11621
|
+
endTripleQuotesString: [
|
|
11622
|
+
[/\\'/, "string"],
|
|
11623
|
+
[
|
|
11624
|
+
/(.*[^\\])?(\\\\)*'''/,
|
|
11625
|
+
"string",
|
|
11626
|
+
"@popall"
|
|
11627
|
+
],
|
|
11628
|
+
[/.*$/, "string"]
|
|
11629
|
+
],
|
|
11630
|
+
whitespace: [
|
|
11631
|
+
[/[ \t\r\n]+/, ""],
|
|
11632
|
+
[
|
|
11633
|
+
/\/\*/,
|
|
11634
|
+
"comment",
|
|
11635
|
+
"@comment"
|
|
11636
|
+
],
|
|
11637
|
+
[/\/\/.*$/, "comment"],
|
|
11638
|
+
[/'''(.*[^\\])?(\\\\)*'''/, "string"],
|
|
11639
|
+
[
|
|
11640
|
+
/'''.*$/,
|
|
11641
|
+
"string",
|
|
11642
|
+
"@endTripleQuotesString"
|
|
11643
|
+
]
|
|
11644
|
+
],
|
|
11645
|
+
comment: [
|
|
11646
|
+
[/[^\/*]+/, "comment"],
|
|
11647
|
+
[
|
|
11648
|
+
/\*\//,
|
|
11649
|
+
"comment",
|
|
11650
|
+
"@pop"
|
|
11651
|
+
],
|
|
11652
|
+
[/[\/*]/, "comment"]
|
|
11653
|
+
]
|
|
11654
|
+
}
|
|
11038
11655
|
};
|
|
11039
11656
|
function ast() {
|
|
11040
11657
|
return this.parse._().getValue().ast;
|
|
@@ -11133,7 +11750,7 @@ function containerScope(_) {
|
|
|
11133
11750
|
return this.container.element(_)?.symbol?.symbolTable;
|
|
11134
11751
|
}
|
|
11135
11752
|
var ScopeKind = /* @__PURE__ */ function(_) {
|
|
11136
|
-
return _[_.TABLE = 0] = "TABLE", _[_.ENUM = 1] = "ENUM", _[_.TABLEGROUP = 2] = "TABLEGROUP", _[_.INDEXES = 3] = "INDEXES", _[_.NOTE = 4] = "NOTE", _[_.REF = 5] = "REF", _[_.PROJECT = 6] = "PROJECT", _[_.CUSTOM = 7] = "CUSTOM", _[_.TOPLEVEL = 8] = "TOPLEVEL", _[_.TABLEPARTIAL = 9] = "TABLEPARTIAL", _[_.CHECKS = 10] = "CHECKS", _[_.RECORDS = 11] = "RECORDS", _;
|
|
11753
|
+
return _[_.TABLE = 0] = "TABLE", _[_.ENUM = 1] = "ENUM", _[_.TABLEGROUP = 2] = "TABLEGROUP", _[_.INDEXES = 3] = "INDEXES", _[_.NOTE = 4] = "NOTE", _[_.REF = 5] = "REF", _[_.PROJECT = 6] = "PROJECT", _[_.CUSTOM = 7] = "CUSTOM", _[_.TOPLEVEL = 8] = "TOPLEVEL", _[_.TABLEPARTIAL = 9] = "TABLEPARTIAL", _[_.CHECKS = 10] = "CHECKS", _[_.RECORDS = 11] = "RECORDS", _[_.DIAGRAMVIEW = 12] = "DIAGRAMVIEW", _;
|
|
11137
11754
|
}({});
|
|
11138
11755
|
function containerScopeKind(_) {
|
|
11139
11756
|
let HY = this.container.element(_);
|
|
@@ -11149,6 +11766,7 @@ function containerScopeKind(_) {
|
|
|
11149
11766
|
case "tablepartial": return ScopeKind.TABLEPARTIAL;
|
|
11150
11767
|
case "checks": return ScopeKind.CHECKS;
|
|
11151
11768
|
case "records": return ScopeKind.RECORDS;
|
|
11769
|
+
case "diagramview": return ScopeKind.DIAGRAMVIEW;
|
|
11152
11770
|
default: return ScopeKind.CUSTOM;
|
|
11153
11771
|
}
|
|
11154
11772
|
}
|
|
@@ -11343,6 +11961,80 @@ var Compiler = class {
|
|
|
11343
11961
|
};
|
|
11344
11962
|
}
|
|
11345
11963
|
};
|
|
11964
|
+
function findDiagramViewBlocks(_) {
|
|
11965
|
+
let HY = [], P = new Lexer(_).lex();
|
|
11966
|
+
if (P.getErrors().length > 0) return HY;
|
|
11967
|
+
let UY = new Parser$1(_, P.getValue(), new SyntaxNodeIdGenerator()).parse();
|
|
11968
|
+
if (UY.getErrors().length > 0) return HY;
|
|
11969
|
+
let WY = UY.getValue().ast;
|
|
11970
|
+
for (let _ of WY.body) if (_.type?.value === "DiagramView") {
|
|
11971
|
+
let P = _.name ? destructureComplexVariable(_.name).unwrap_or([]) : [], UY = P.length > 0 ? P[P.length - 1] : "";
|
|
11972
|
+
HY.push({
|
|
11973
|
+
name: UY,
|
|
11974
|
+
startIndex: _.start,
|
|
11975
|
+
endIndex: _.end
|
|
11976
|
+
});
|
|
11977
|
+
}
|
|
11978
|
+
return HY;
|
|
11979
|
+
}
|
|
11980
|
+
function needsQuoting(_) {
|
|
11981
|
+
return !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(_);
|
|
11982
|
+
}
|
|
11983
|
+
function quoteName(_) {
|
|
11984
|
+
return needsQuoting(_) ? `"${_.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"` : _;
|
|
11985
|
+
}
|
|
11986
|
+
function generateDiagramViewBlock(_, HY) {
|
|
11987
|
+
let P = [`DiagramView ${quoteName(_)} {`];
|
|
11988
|
+
if (HY?.tables !== void 0 && HY.tables !== null) if (HY.tables.length === 0) P.push(" Tables { * }");
|
|
11989
|
+
else {
|
|
11990
|
+
let _ = HY.tables.map((_) => _.schemaName === "public" ? _.name : `${_.schemaName}.${_.name}`);
|
|
11991
|
+
P.push(" Tables {"), _.forEach((_) => P.push(` ${_}`)), P.push(" }");
|
|
11992
|
+
}
|
|
11993
|
+
return HY?.stickyNotes !== void 0 && (HY.stickyNotes === null || (HY.stickyNotes.length === 0 ? P.push(" Notes { * }") : (P.push(" Notes {"), HY.stickyNotes.forEach((_) => P.push(` ${_.name}`)), P.push(" }")))), HY?.tableGroups !== void 0 && (HY.tableGroups === null || (HY.tableGroups.length === 0 ? P.push(" TableGroups { * }") : (P.push(" TableGroups {"), HY.tableGroups.forEach((_) => P.push(` ${_.name}`)), P.push(" }")))), HY?.schemas !== void 0 && (HY.schemas === null || (HY.schemas.length === 0 ? P.push(" Schemas { * }") : (P.push(" Schemas {"), HY.schemas.forEach((_) => P.push(` ${_.name}`)), P.push(" }")))), P.push("}"), P.join("\n");
|
|
11994
|
+
}
|
|
11995
|
+
function syncDiagramView(_, HY) {
|
|
11996
|
+
let P = _;
|
|
11997
|
+
for (let _ of HY) P = applyOperation(P, _);
|
|
11998
|
+
return { newDbml: P };
|
|
11999
|
+
}
|
|
12000
|
+
function applyOperation(_, HY) {
|
|
12001
|
+
switch (HY.operation) {
|
|
12002
|
+
case "create": return applyCreate(_, HY);
|
|
12003
|
+
case "update": return applyUpdate(_, HY, findDiagramViewBlocks(_));
|
|
12004
|
+
case "delete": return applyDelete(_, HY, findDiagramViewBlocks(_));
|
|
12005
|
+
default: return _;
|
|
12006
|
+
}
|
|
12007
|
+
}
|
|
12008
|
+
function applyCreate(_, HY) {
|
|
12009
|
+
let P = findDiagramViewBlocks(_);
|
|
12010
|
+
if (P.find((_) => _.name === HY.name)) return applyUpdate(_, HY, P);
|
|
12011
|
+
let UY = generateDiagramViewBlock(HY.name, HY.visibleEntities);
|
|
12012
|
+
return _.trimEnd() + "\n\n" + UY + "\n";
|
|
12013
|
+
}
|
|
12014
|
+
function applyUpdate(_, HY, P) {
|
|
12015
|
+
let UY = P.find((_) => _.name === HY.name);
|
|
12016
|
+
if (!UY) return _;
|
|
12017
|
+
let WY = [];
|
|
12018
|
+
if (HY.newName || HY.visibleEntities) {
|
|
12019
|
+
let _ = generateDiagramViewBlock(HY.newName || HY.name, HY.visibleEntities);
|
|
12020
|
+
WY.push({
|
|
12021
|
+
start: UY.startIndex,
|
|
12022
|
+
end: UY.endIndex,
|
|
12023
|
+
newText: _
|
|
12024
|
+
});
|
|
12025
|
+
}
|
|
12026
|
+
return applyTextEdits(_, WY);
|
|
12027
|
+
}
|
|
12028
|
+
function applyDelete(_, HY, P) {
|
|
12029
|
+
let UY = P.find((_) => _.name === HY.name);
|
|
12030
|
+
if (!UY) return _;
|
|
12031
|
+
let WY = _.split("\n"), GY = 0, KY = WY.length - 1, qY = 0;
|
|
12032
|
+
for (let _ = 0; _ < WY.length; _++) {
|
|
12033
|
+
let HY = qY, P = qY + WY[_].length;
|
|
12034
|
+
HY <= UY.startIndex && UY.startIndex <= P && (GY = _), HY <= UY.endIndex && UY.endIndex <= P && (KY = _), qY = P + 1;
|
|
12035
|
+
}
|
|
12036
|
+
return [...WY.slice(0, GY), ...WY.slice(KY + 1)].join("\n");
|
|
12037
|
+
}
|
|
11346
12038
|
const DEFAULT_SCHEMA_NAME = "public", TABLE = "table", ENUM = "enum", TABLE_GROUP = "table_group";
|
|
11347
12039
|
var LuxonError = class extends Error {}, InvalidDateTimeError = class extends LuxonError {
|
|
11348
12040
|
constructor(_) {
|
|
@@ -15487,7 +16179,7 @@ var field_default = class extends element_default {
|
|
|
15487
16179
|
init_lodash();
|
|
15488
16180
|
var table_default = class extends element_default {
|
|
15489
16181
|
constructor({ name: _, alias: HY, note: P, fields: UY = [], indexes: WY = [], checks: GY = [], schema: KY = {}, token: qY, headerColor: JY, noteToken: YY = null, partials: XY = [] } = {}) {
|
|
15490
|
-
super(qY), this.name = _, this.alias = HY, this.note = P ? get_default(P, "value", P) : null, this.noteToken = P ? get_default(P, "token", YY) : null, this.headerColor = JY, this.fields = [], this.indexes = [], this.checks = [], this.schema = KY, this.partials = XY, this.
|
|
16182
|
+
super(qY), this.name = _, this.alias = HY, this.note = P ? get_default(P, "value", P) : null, this.noteToken = P ? get_default(P, "token", YY) : null, this.headerColor = JY, this.fields = [], this.indexes = [], this.checks = [], this.schema = KY, this.partials = XY, this.dbState = this.schema.dbState, this.generateId(), this.processFields(UY), this.processPartials(), this.checkFieldCount(), this.processIndexes(WY), this.processChecks(GY);
|
|
15491
16183
|
}
|
|
15492
16184
|
generateId() {
|
|
15493
16185
|
this.id = this.dbState.generateId("tableId");
|
|
@@ -15627,8 +16319,7 @@ var table_default = class extends element_default {
|
|
|
15627
16319
|
alias: this.alias,
|
|
15628
16320
|
note: this.note,
|
|
15629
16321
|
headerColor: this.headerColor,
|
|
15630
|
-
partials: this.partials
|
|
15631
|
-
recordIds: this.records.map((_) => _.id)
|
|
16322
|
+
partials: this.partials
|
|
15632
16323
|
};
|
|
15633
16324
|
}
|
|
15634
16325
|
normalize(_) {
|
|
@@ -16065,7 +16756,7 @@ var tablePartial_default = class extends element_default {
|
|
|
16065
16756
|
init_lodash();
|
|
16066
16757
|
var database_default = class extends element_default {
|
|
16067
16758
|
constructor({ schemas: _ = [], tables: HY = [], notes: P = [], enums: UY = [], refs: WY = [], tableGroups: GY = [], project: KY = {}, aliases: qY = [], records: JY = [], tablePartials: YY = [] }) {
|
|
16068
|
-
super(), this.dbState = new DbState(), this.generateId(), this.hasDefaultSchema = !1, this.schemas = [], this.notes = [], this.note = KY.note ? get_default(KY, "note.value", KY.note) : null, this.noteToken = KY.note ? get_default(KY, "note.token", KY.noteToken) : null, this.databaseType = KY.database_type, this.name = KY.name, this.token = KY.token, this.aliases = qY, this.records = [], this.tablePartials = [], this.injectedRawRefs = [], this.processNotes(P), this.processRecords(JY), this.processTablePartials(YY), this.processSchemas(_), this.processSchemaElements(UY, ENUM), this.processSchemaElements(HY, TABLE), this.
|
|
16759
|
+
super(), this.dbState = new DbState(), this.generateId(), this.hasDefaultSchema = !1, this.schemas = [], this.notes = [], this.note = KY.note ? get_default(KY, "note.value", KY.note) : null, this.noteToken = KY.note ? get_default(KY, "note.token", KY.noteToken) : null, this.databaseType = KY.database_type, this.name = KY.name, this.token = KY.token, this.aliases = qY, this.records = [], this.tablePartials = [], this.injectedRawRefs = [], this.processNotes(P), this.processRecords(JY), this.processTablePartials(YY), this.processSchemas(_), this.processSchemaElements(UY, ENUM), this.processSchemaElements(HY, TABLE), this.processSchemaElements(P, "note"), this.processSchemaElements(WY, "ref"), this.processSchemaElements(GY, TABLE_GROUP), this.injectedRawRefs.forEach((_) => {
|
|
16069
16760
|
let HY = this.findOrCreateSchema(DEFAULT_SCHEMA_NAME), P = new ref_default({
|
|
16070
16761
|
..._,
|
|
16071
16762
|
schema: HY
|
|
@@ -16155,17 +16846,6 @@ var database_default = class extends element_default {
|
|
|
16155
16846
|
}
|
|
16156
16847
|
});
|
|
16157
16848
|
}
|
|
16158
|
-
linkRecordsToTables() {
|
|
16159
|
-
let _ = {};
|
|
16160
|
-
this.schemas.forEach((HY) => {
|
|
16161
|
-
_[HY.name] = {}, HY.tables.forEach((P) => {
|
|
16162
|
-
_[HY.name][P.name] = P;
|
|
16163
|
-
});
|
|
16164
|
-
}), this.records.forEach((HY) => {
|
|
16165
|
-
let P = _[HY.schemaName ?? "public"]?.[HY.tableName];
|
|
16166
|
-
P && (HY.tableId = P.id, P.records.push(HY));
|
|
16167
|
-
});
|
|
16168
|
-
}
|
|
16169
16849
|
findOrCreateSchema(_) {
|
|
16170
16850
|
let HY = this.schemas.find((HY) => HY.name === _ || HY.alias === _);
|
|
16171
16851
|
return HY || (HY = new schema_default({
|
|
@@ -1821067,5 +1821747,5 @@ function renameTable(_, HY, P) {
|
|
|
1821067
1821747
|
let UY = new Compiler();
|
|
1821068
1821748
|
return UY.setSource(P), UY.renameTable(_, HY);
|
|
1821069
1821749
|
}
|
|
1821070
|
-
const VERSION = "
|
|
1821071
|
-
export { CompilerError, ModelExporter_default as ModelExporter, Parser_default as Parser, VERSION, addDoubleQuoteIfNeeded, export_default as exporter, formatRecordValue, import_default as importer, isBinaryType, isBooleanType, isDateTimeType, isFloatType, isIntegerType, isNumericType, isSerialType, isStringType, renameTable, tryExtractBoolean, tryExtractDateTime, tryExtractEnum, tryExtractInteger, tryExtractNumeric, tryExtractString };
|
|
1821750
|
+
const VERSION = "7.0.0-alpha.0";
|
|
1821751
|
+
export { CompilerError, ModelExporter_default as ModelExporter, Parser_default as Parser, VERSION, addDoubleQuoteIfNeeded, dbmlMonarchTokensProvider, export_default as exporter, formatRecordValue, import_default as importer, isBinaryType, isBooleanType, isDateTimeType, isFloatType, isIntegerType, isNumericType, isSerialType, isStringType, renameTable, syncDiagramView, tryExtractBoolean, tryExtractDateTime, tryExtractEnum, tryExtractInteger, tryExtractNumeric, tryExtractString };
|