@zenstackhq/language 3.3.2 → 3.4.0-beta.1

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.
@@ -0,0 +1,2020 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/factory/ast-factory.ts
5
+ var AstFactory = class _AstFactory {
6
+ static {
7
+ __name(this, "AstFactory");
8
+ }
9
+ node = {};
10
+ constructor({ type, node }) {
11
+ this.node.$type = type;
12
+ if (node) {
13
+ this.update(node);
14
+ }
15
+ }
16
+ setContainer(container) {
17
+ this.node.$container = container;
18
+ return this;
19
+ }
20
+ get(params) {
21
+ if (params) this.update(params);
22
+ return this.node;
23
+ }
24
+ update(nodeArg) {
25
+ const keys = Object.keys(nodeArg);
26
+ keys.forEach((key) => {
27
+ const child = nodeArg[key];
28
+ if (child instanceof _AstFactory) {
29
+ this.node[key] = child.get({
30
+ $container: this.node
31
+ });
32
+ } else if (Array.isArray(child)) {
33
+ this.node[key] = child.map((item) => item instanceof _AstFactory ? item.get({
34
+ $container: this.node
35
+ }) : item);
36
+ } else {
37
+ this.node[key] = child;
38
+ }
39
+ });
40
+ return this.node;
41
+ }
42
+ };
43
+
44
+ // src/generated/ast.ts
45
+ import * as langium from "langium";
46
+ var AbstractDeclaration = "AbstractDeclaration";
47
+ var ConfigExpr = "ConfigExpr";
48
+ var Expression = "Expression";
49
+ var LiteralExpr = "LiteralExpr";
50
+ var MemberAccessTarget = "MemberAccessTarget";
51
+ var ReferenceTarget = "ReferenceTarget";
52
+ var TypeDeclaration = "TypeDeclaration";
53
+ var Argument = "Argument";
54
+ var ArrayExpr = "ArrayExpr";
55
+ var Attribute = "Attribute";
56
+ var AttributeArg = "AttributeArg";
57
+ var AttributeParam = "AttributeParam";
58
+ var AttributeParamType = "AttributeParamType";
59
+ var BinaryExpr = "BinaryExpr";
60
+ var BooleanLiteral = "BooleanLiteral";
61
+ var CollectionPredicateBinding = "CollectionPredicateBinding";
62
+ var ConfigArrayExpr = "ConfigArrayExpr";
63
+ var ConfigField = "ConfigField";
64
+ var ConfigInvocationArg = "ConfigInvocationArg";
65
+ var ConfigInvocationExpr = "ConfigInvocationExpr";
66
+ var DataField = "DataField";
67
+ var DataFieldAttribute = "DataFieldAttribute";
68
+ var DataFieldType = "DataFieldType";
69
+ var DataModel = "DataModel";
70
+ var DataModelAttribute = "DataModelAttribute";
71
+ var DataSource = "DataSource";
72
+ var Enum = "Enum";
73
+ var EnumField = "EnumField";
74
+ var FieldInitializer = "FieldInitializer";
75
+ var FunctionDecl = "FunctionDecl";
76
+ var FunctionParam = "FunctionParam";
77
+ var FunctionParamType = "FunctionParamType";
78
+ var GeneratorDecl = "GeneratorDecl";
79
+ var InternalAttribute = "InternalAttribute";
80
+ var InvocationExpr = "InvocationExpr";
81
+ var MemberAccessExpr = "MemberAccessExpr";
82
+ var Model = "Model";
83
+ var ModelImport = "ModelImport";
84
+ var NullExpr = "NullExpr";
85
+ var NumberLiteral = "NumberLiteral";
86
+ var ObjectExpr = "ObjectExpr";
87
+ var Plugin = "Plugin";
88
+ var PluginField = "PluginField";
89
+ var Procedure = "Procedure";
90
+ var ProcedureParam = "ProcedureParam";
91
+ var ReferenceArg = "ReferenceArg";
92
+ var ReferenceExpr = "ReferenceExpr";
93
+ var StringLiteral = "StringLiteral";
94
+ var ThisExpr = "ThisExpr";
95
+ var TypeDef = "TypeDef";
96
+ var UnaryExpr = "UnaryExpr";
97
+ var UnsupportedFieldType = "UnsupportedFieldType";
98
+ var ZModelAstReflection = class extends langium.AbstractAstReflection {
99
+ static {
100
+ __name(this, "ZModelAstReflection");
101
+ }
102
+ getAllTypes() {
103
+ return [
104
+ AbstractDeclaration,
105
+ Argument,
106
+ ArrayExpr,
107
+ Attribute,
108
+ AttributeArg,
109
+ AttributeParam,
110
+ AttributeParamType,
111
+ BinaryExpr,
112
+ BooleanLiteral,
113
+ CollectionPredicateBinding,
114
+ ConfigArrayExpr,
115
+ ConfigExpr,
116
+ ConfigField,
117
+ ConfigInvocationArg,
118
+ ConfigInvocationExpr,
119
+ DataField,
120
+ DataFieldAttribute,
121
+ DataFieldType,
122
+ DataModel,
123
+ DataModelAttribute,
124
+ DataSource,
125
+ Enum,
126
+ EnumField,
127
+ Expression,
128
+ FieldInitializer,
129
+ FunctionDecl,
130
+ FunctionParam,
131
+ FunctionParamType,
132
+ GeneratorDecl,
133
+ InternalAttribute,
134
+ InvocationExpr,
135
+ LiteralExpr,
136
+ MemberAccessExpr,
137
+ MemberAccessTarget,
138
+ Model,
139
+ ModelImport,
140
+ NullExpr,
141
+ NumberLiteral,
142
+ ObjectExpr,
143
+ Plugin,
144
+ PluginField,
145
+ Procedure,
146
+ ProcedureParam,
147
+ ReferenceArg,
148
+ ReferenceExpr,
149
+ ReferenceTarget,
150
+ StringLiteral,
151
+ ThisExpr,
152
+ TypeDeclaration,
153
+ TypeDef,
154
+ UnaryExpr,
155
+ UnsupportedFieldType
156
+ ];
157
+ }
158
+ computeIsSubtype(subtype, supertype) {
159
+ switch (subtype) {
160
+ case ArrayExpr:
161
+ case BinaryExpr:
162
+ case MemberAccessExpr:
163
+ case NullExpr:
164
+ case ObjectExpr:
165
+ case ReferenceExpr:
166
+ case ThisExpr:
167
+ case UnaryExpr: {
168
+ return this.isSubtype(Expression, supertype);
169
+ }
170
+ case Attribute:
171
+ case DataSource:
172
+ case FunctionDecl:
173
+ case GeneratorDecl:
174
+ case Plugin:
175
+ case Procedure: {
176
+ return this.isSubtype(AbstractDeclaration, supertype);
177
+ }
178
+ case BooleanLiteral:
179
+ case NumberLiteral:
180
+ case StringLiteral: {
181
+ return this.isSubtype(LiteralExpr, supertype);
182
+ }
183
+ case CollectionPredicateBinding:
184
+ case EnumField:
185
+ case FunctionParam: {
186
+ return this.isSubtype(ReferenceTarget, supertype);
187
+ }
188
+ case ConfigArrayExpr: {
189
+ return this.isSubtype(ConfigExpr, supertype);
190
+ }
191
+ case DataField: {
192
+ return this.isSubtype(MemberAccessTarget, supertype) || this.isSubtype(ReferenceTarget, supertype);
193
+ }
194
+ case DataModel:
195
+ case Enum:
196
+ case TypeDef: {
197
+ return this.isSubtype(AbstractDeclaration, supertype) || this.isSubtype(TypeDeclaration, supertype);
198
+ }
199
+ case InvocationExpr:
200
+ case LiteralExpr: {
201
+ return this.isSubtype(ConfigExpr, supertype) || this.isSubtype(Expression, supertype);
202
+ }
203
+ default: {
204
+ return false;
205
+ }
206
+ }
207
+ }
208
+ getReferenceType(refInfo) {
209
+ const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
210
+ switch (referenceId) {
211
+ case "AttributeParamType:reference":
212
+ case "DataFieldType:reference":
213
+ case "FunctionParamType:reference": {
214
+ return TypeDeclaration;
215
+ }
216
+ case "DataFieldAttribute:decl":
217
+ case "DataModelAttribute:decl":
218
+ case "InternalAttribute:decl": {
219
+ return Attribute;
220
+ }
221
+ case "DataModel:baseModel": {
222
+ return DataModel;
223
+ }
224
+ case "DataModel:mixins":
225
+ case "TypeDef:mixins": {
226
+ return TypeDef;
227
+ }
228
+ case "InvocationExpr:function": {
229
+ return FunctionDecl;
230
+ }
231
+ case "MemberAccessExpr:member": {
232
+ return MemberAccessTarget;
233
+ }
234
+ case "ReferenceExpr:target": {
235
+ return ReferenceTarget;
236
+ }
237
+ default: {
238
+ throw new Error(`${referenceId} is not a valid reference id.`);
239
+ }
240
+ }
241
+ }
242
+ getTypeMetaData(type) {
243
+ switch (type) {
244
+ case Argument: {
245
+ return {
246
+ name: Argument,
247
+ properties: [
248
+ {
249
+ name: "value"
250
+ }
251
+ ]
252
+ };
253
+ }
254
+ case ArrayExpr: {
255
+ return {
256
+ name: ArrayExpr,
257
+ properties: [
258
+ {
259
+ name: "items",
260
+ defaultValue: []
261
+ }
262
+ ]
263
+ };
264
+ }
265
+ case Attribute: {
266
+ return {
267
+ name: Attribute,
268
+ properties: [
269
+ {
270
+ name: "attributes",
271
+ defaultValue: []
272
+ },
273
+ {
274
+ name: "comments",
275
+ defaultValue: []
276
+ },
277
+ {
278
+ name: "name"
279
+ },
280
+ {
281
+ name: "params",
282
+ defaultValue: []
283
+ }
284
+ ]
285
+ };
286
+ }
287
+ case AttributeArg: {
288
+ return {
289
+ name: AttributeArg,
290
+ properties: [
291
+ {
292
+ name: "name"
293
+ },
294
+ {
295
+ name: "value"
296
+ }
297
+ ]
298
+ };
299
+ }
300
+ case AttributeParam: {
301
+ return {
302
+ name: AttributeParam,
303
+ properties: [
304
+ {
305
+ name: "attributes",
306
+ defaultValue: []
307
+ },
308
+ {
309
+ name: "comments",
310
+ defaultValue: []
311
+ },
312
+ {
313
+ name: "default",
314
+ defaultValue: false
315
+ },
316
+ {
317
+ name: "name"
318
+ },
319
+ {
320
+ name: "type"
321
+ }
322
+ ]
323
+ };
324
+ }
325
+ case AttributeParamType: {
326
+ return {
327
+ name: AttributeParamType,
328
+ properties: [
329
+ {
330
+ name: "array",
331
+ defaultValue: false
332
+ },
333
+ {
334
+ name: "optional",
335
+ defaultValue: false
336
+ },
337
+ {
338
+ name: "reference"
339
+ },
340
+ {
341
+ name: "type"
342
+ }
343
+ ]
344
+ };
345
+ }
346
+ case BinaryExpr: {
347
+ return {
348
+ name: BinaryExpr,
349
+ properties: [
350
+ {
351
+ name: "binding"
352
+ },
353
+ {
354
+ name: "left"
355
+ },
356
+ {
357
+ name: "operator"
358
+ },
359
+ {
360
+ name: "right"
361
+ }
362
+ ]
363
+ };
364
+ }
365
+ case BooleanLiteral: {
366
+ return {
367
+ name: BooleanLiteral,
368
+ properties: [
369
+ {
370
+ name: "value"
371
+ }
372
+ ]
373
+ };
374
+ }
375
+ case CollectionPredicateBinding: {
376
+ return {
377
+ name: CollectionPredicateBinding,
378
+ properties: [
379
+ {
380
+ name: "name"
381
+ }
382
+ ]
383
+ };
384
+ }
385
+ case ConfigArrayExpr: {
386
+ return {
387
+ name: ConfigArrayExpr,
388
+ properties: [
389
+ {
390
+ name: "items",
391
+ defaultValue: []
392
+ }
393
+ ]
394
+ };
395
+ }
396
+ case ConfigField: {
397
+ return {
398
+ name: ConfigField,
399
+ properties: [
400
+ {
401
+ name: "name"
402
+ },
403
+ {
404
+ name: "value"
405
+ }
406
+ ]
407
+ };
408
+ }
409
+ case ConfigInvocationArg: {
410
+ return {
411
+ name: ConfigInvocationArg,
412
+ properties: [
413
+ {
414
+ name: "name"
415
+ },
416
+ {
417
+ name: "value"
418
+ }
419
+ ]
420
+ };
421
+ }
422
+ case ConfigInvocationExpr: {
423
+ return {
424
+ name: ConfigInvocationExpr,
425
+ properties: [
426
+ {
427
+ name: "args",
428
+ defaultValue: []
429
+ },
430
+ {
431
+ name: "name"
432
+ }
433
+ ]
434
+ };
435
+ }
436
+ case DataField: {
437
+ return {
438
+ name: DataField,
439
+ properties: [
440
+ {
441
+ name: "attributes",
442
+ defaultValue: []
443
+ },
444
+ {
445
+ name: "comments",
446
+ defaultValue: []
447
+ },
448
+ {
449
+ name: "name"
450
+ },
451
+ {
452
+ name: "type"
453
+ }
454
+ ]
455
+ };
456
+ }
457
+ case DataFieldAttribute: {
458
+ return {
459
+ name: DataFieldAttribute,
460
+ properties: [
461
+ {
462
+ name: "args",
463
+ defaultValue: []
464
+ },
465
+ {
466
+ name: "decl"
467
+ }
468
+ ]
469
+ };
470
+ }
471
+ case DataFieldType: {
472
+ return {
473
+ name: DataFieldType,
474
+ properties: [
475
+ {
476
+ name: "array",
477
+ defaultValue: false
478
+ },
479
+ {
480
+ name: "optional",
481
+ defaultValue: false
482
+ },
483
+ {
484
+ name: "reference"
485
+ },
486
+ {
487
+ name: "type"
488
+ },
489
+ {
490
+ name: "unsupported"
491
+ }
492
+ ]
493
+ };
494
+ }
495
+ case DataModel: {
496
+ return {
497
+ name: DataModel,
498
+ properties: [
499
+ {
500
+ name: "attributes",
501
+ defaultValue: []
502
+ },
503
+ {
504
+ name: "baseModel"
505
+ },
506
+ {
507
+ name: "comments",
508
+ defaultValue: []
509
+ },
510
+ {
511
+ name: "fields",
512
+ defaultValue: []
513
+ },
514
+ {
515
+ name: "isView",
516
+ defaultValue: false
517
+ },
518
+ {
519
+ name: "mixins",
520
+ defaultValue: []
521
+ },
522
+ {
523
+ name: "name"
524
+ }
525
+ ]
526
+ };
527
+ }
528
+ case DataModelAttribute: {
529
+ return {
530
+ name: DataModelAttribute,
531
+ properties: [
532
+ {
533
+ name: "args",
534
+ defaultValue: []
535
+ },
536
+ {
537
+ name: "decl"
538
+ }
539
+ ]
540
+ };
541
+ }
542
+ case DataSource: {
543
+ return {
544
+ name: DataSource,
545
+ properties: [
546
+ {
547
+ name: "fields",
548
+ defaultValue: []
549
+ },
550
+ {
551
+ name: "name"
552
+ }
553
+ ]
554
+ };
555
+ }
556
+ case Enum: {
557
+ return {
558
+ name: Enum,
559
+ properties: [
560
+ {
561
+ name: "attributes",
562
+ defaultValue: []
563
+ },
564
+ {
565
+ name: "comments",
566
+ defaultValue: []
567
+ },
568
+ {
569
+ name: "fields",
570
+ defaultValue: []
571
+ },
572
+ {
573
+ name: "name"
574
+ }
575
+ ]
576
+ };
577
+ }
578
+ case EnumField: {
579
+ return {
580
+ name: EnumField,
581
+ properties: [
582
+ {
583
+ name: "attributes",
584
+ defaultValue: []
585
+ },
586
+ {
587
+ name: "comments",
588
+ defaultValue: []
589
+ },
590
+ {
591
+ name: "name"
592
+ }
593
+ ]
594
+ };
595
+ }
596
+ case FieldInitializer: {
597
+ return {
598
+ name: FieldInitializer,
599
+ properties: [
600
+ {
601
+ name: "name"
602
+ },
603
+ {
604
+ name: "value"
605
+ }
606
+ ]
607
+ };
608
+ }
609
+ case FunctionDecl: {
610
+ return {
611
+ name: FunctionDecl,
612
+ properties: [
613
+ {
614
+ name: "attributes",
615
+ defaultValue: []
616
+ },
617
+ {
618
+ name: "expression"
619
+ },
620
+ {
621
+ name: "name"
622
+ },
623
+ {
624
+ name: "params",
625
+ defaultValue: []
626
+ },
627
+ {
628
+ name: "returnType"
629
+ }
630
+ ]
631
+ };
632
+ }
633
+ case FunctionParam: {
634
+ return {
635
+ name: FunctionParam,
636
+ properties: [
637
+ {
638
+ name: "name"
639
+ },
640
+ {
641
+ name: "optional",
642
+ defaultValue: false
643
+ },
644
+ {
645
+ name: "type"
646
+ }
647
+ ]
648
+ };
649
+ }
650
+ case FunctionParamType: {
651
+ return {
652
+ name: FunctionParamType,
653
+ properties: [
654
+ {
655
+ name: "array",
656
+ defaultValue: false
657
+ },
658
+ {
659
+ name: "reference"
660
+ },
661
+ {
662
+ name: "type"
663
+ }
664
+ ]
665
+ };
666
+ }
667
+ case GeneratorDecl: {
668
+ return {
669
+ name: GeneratorDecl,
670
+ properties: [
671
+ {
672
+ name: "fields",
673
+ defaultValue: []
674
+ },
675
+ {
676
+ name: "name"
677
+ }
678
+ ]
679
+ };
680
+ }
681
+ case InternalAttribute: {
682
+ return {
683
+ name: InternalAttribute,
684
+ properties: [
685
+ {
686
+ name: "args",
687
+ defaultValue: []
688
+ },
689
+ {
690
+ name: "decl"
691
+ }
692
+ ]
693
+ };
694
+ }
695
+ case InvocationExpr: {
696
+ return {
697
+ name: InvocationExpr,
698
+ properties: [
699
+ {
700
+ name: "args",
701
+ defaultValue: []
702
+ },
703
+ {
704
+ name: "function"
705
+ }
706
+ ]
707
+ };
708
+ }
709
+ case MemberAccessExpr: {
710
+ return {
711
+ name: MemberAccessExpr,
712
+ properties: [
713
+ {
714
+ name: "member"
715
+ },
716
+ {
717
+ name: "operand"
718
+ }
719
+ ]
720
+ };
721
+ }
722
+ case Model: {
723
+ return {
724
+ name: Model,
725
+ properties: [
726
+ {
727
+ name: "declarations",
728
+ defaultValue: []
729
+ },
730
+ {
731
+ name: "imports",
732
+ defaultValue: []
733
+ }
734
+ ]
735
+ };
736
+ }
737
+ case ModelImport: {
738
+ return {
739
+ name: ModelImport,
740
+ properties: [
741
+ {
742
+ name: "path"
743
+ }
744
+ ]
745
+ };
746
+ }
747
+ case NullExpr: {
748
+ return {
749
+ name: NullExpr,
750
+ properties: [
751
+ {
752
+ name: "value"
753
+ }
754
+ ]
755
+ };
756
+ }
757
+ case NumberLiteral: {
758
+ return {
759
+ name: NumberLiteral,
760
+ properties: [
761
+ {
762
+ name: "value"
763
+ }
764
+ ]
765
+ };
766
+ }
767
+ case ObjectExpr: {
768
+ return {
769
+ name: ObjectExpr,
770
+ properties: [
771
+ {
772
+ name: "fields",
773
+ defaultValue: []
774
+ }
775
+ ]
776
+ };
777
+ }
778
+ case Plugin: {
779
+ return {
780
+ name: Plugin,
781
+ properties: [
782
+ {
783
+ name: "fields",
784
+ defaultValue: []
785
+ },
786
+ {
787
+ name: "name"
788
+ }
789
+ ]
790
+ };
791
+ }
792
+ case PluginField: {
793
+ return {
794
+ name: PluginField,
795
+ properties: [
796
+ {
797
+ name: "name"
798
+ },
799
+ {
800
+ name: "value"
801
+ }
802
+ ]
803
+ };
804
+ }
805
+ case Procedure: {
806
+ return {
807
+ name: Procedure,
808
+ properties: [
809
+ {
810
+ name: "attributes",
811
+ defaultValue: []
812
+ },
813
+ {
814
+ name: "mutation",
815
+ defaultValue: false
816
+ },
817
+ {
818
+ name: "name"
819
+ },
820
+ {
821
+ name: "params",
822
+ defaultValue: []
823
+ },
824
+ {
825
+ name: "returnType"
826
+ }
827
+ ]
828
+ };
829
+ }
830
+ case ProcedureParam: {
831
+ return {
832
+ name: ProcedureParam,
833
+ properties: [
834
+ {
835
+ name: "name"
836
+ },
837
+ {
838
+ name: "optional",
839
+ defaultValue: false
840
+ },
841
+ {
842
+ name: "type"
843
+ }
844
+ ]
845
+ };
846
+ }
847
+ case ReferenceArg: {
848
+ return {
849
+ name: ReferenceArg,
850
+ properties: [
851
+ {
852
+ name: "name"
853
+ },
854
+ {
855
+ name: "value"
856
+ }
857
+ ]
858
+ };
859
+ }
860
+ case ReferenceExpr: {
861
+ return {
862
+ name: ReferenceExpr,
863
+ properties: [
864
+ {
865
+ name: "args",
866
+ defaultValue: []
867
+ },
868
+ {
869
+ name: "target"
870
+ }
871
+ ]
872
+ };
873
+ }
874
+ case StringLiteral: {
875
+ return {
876
+ name: StringLiteral,
877
+ properties: [
878
+ {
879
+ name: "value"
880
+ }
881
+ ]
882
+ };
883
+ }
884
+ case ThisExpr: {
885
+ return {
886
+ name: ThisExpr,
887
+ properties: [
888
+ {
889
+ name: "value"
890
+ }
891
+ ]
892
+ };
893
+ }
894
+ case TypeDef: {
895
+ return {
896
+ name: TypeDef,
897
+ properties: [
898
+ {
899
+ name: "attributes",
900
+ defaultValue: []
901
+ },
902
+ {
903
+ name: "comments",
904
+ defaultValue: []
905
+ },
906
+ {
907
+ name: "fields",
908
+ defaultValue: []
909
+ },
910
+ {
911
+ name: "mixins",
912
+ defaultValue: []
913
+ },
914
+ {
915
+ name: "name"
916
+ }
917
+ ]
918
+ };
919
+ }
920
+ case UnaryExpr: {
921
+ return {
922
+ name: UnaryExpr,
923
+ properties: [
924
+ {
925
+ name: "operand"
926
+ },
927
+ {
928
+ name: "operator"
929
+ }
930
+ ]
931
+ };
932
+ }
933
+ case UnsupportedFieldType: {
934
+ return {
935
+ name: UnsupportedFieldType,
936
+ properties: [
937
+ {
938
+ name: "value"
939
+ }
940
+ ]
941
+ };
942
+ }
943
+ default: {
944
+ return {
945
+ name: type,
946
+ properties: []
947
+ };
948
+ }
949
+ }
950
+ }
951
+ };
952
+ var reflection = new ZModelAstReflection();
953
+
954
+ // src/factory/primitives.ts
955
+ var ThisExprFactory = class extends AstFactory {
956
+ static {
957
+ __name(this, "ThisExprFactory");
958
+ }
959
+ constructor() {
960
+ super({
961
+ type: ThisExpr,
962
+ node: {
963
+ value: "this"
964
+ }
965
+ });
966
+ }
967
+ };
968
+ var NullExprFactory = class extends AstFactory {
969
+ static {
970
+ __name(this, "NullExprFactory");
971
+ }
972
+ constructor() {
973
+ super({
974
+ type: NullExpr,
975
+ node: {
976
+ value: "null"
977
+ }
978
+ });
979
+ }
980
+ };
981
+ var NumberLiteralFactory = class extends AstFactory {
982
+ static {
983
+ __name(this, "NumberLiteralFactory");
984
+ }
985
+ value;
986
+ constructor() {
987
+ super({
988
+ type: NumberLiteral
989
+ });
990
+ }
991
+ setValue(value) {
992
+ this.value = value;
993
+ this.update({
994
+ value: this.value.toString()
995
+ });
996
+ return this;
997
+ }
998
+ };
999
+ var StringLiteralFactory = class extends AstFactory {
1000
+ static {
1001
+ __name(this, "StringLiteralFactory");
1002
+ }
1003
+ value;
1004
+ constructor() {
1005
+ super({
1006
+ type: StringLiteral
1007
+ });
1008
+ }
1009
+ setValue(value) {
1010
+ this.value = value;
1011
+ this.update({
1012
+ value: this.value
1013
+ });
1014
+ return this;
1015
+ }
1016
+ };
1017
+ var BooleanLiteralFactory = class extends AstFactory {
1018
+ static {
1019
+ __name(this, "BooleanLiteralFactory");
1020
+ }
1021
+ value;
1022
+ constructor() {
1023
+ super({
1024
+ type: BooleanLiteral
1025
+ });
1026
+ }
1027
+ setValue(value) {
1028
+ this.value = value;
1029
+ this.update({
1030
+ value: this.value
1031
+ });
1032
+ return this;
1033
+ }
1034
+ };
1035
+
1036
+ // src/factory/expression.ts
1037
+ var ExpressionBuilder = /* @__PURE__ */ __name(() => ({
1038
+ get ArrayExpr() {
1039
+ return new ArrayExprFactory();
1040
+ },
1041
+ get BinaryExpr() {
1042
+ return new BinaryExprFactory();
1043
+ },
1044
+ get BooleanLiteral() {
1045
+ return new BooleanLiteralFactory();
1046
+ },
1047
+ get InvocationExpr() {
1048
+ return new InvocationExprFactory();
1049
+ },
1050
+ get MemberAccessExpr() {
1051
+ return new MemberAccessExprFactory();
1052
+ },
1053
+ get NullExpr() {
1054
+ return new NullExprFactory();
1055
+ },
1056
+ get NumberLiteral() {
1057
+ return new NumberLiteralFactory();
1058
+ },
1059
+ get ObjectExpr() {
1060
+ return new ObjectExprFactory();
1061
+ },
1062
+ get ReferenceExpr() {
1063
+ return new ReferenceExprFactory();
1064
+ },
1065
+ get StringLiteral() {
1066
+ return new StringLiteralFactory();
1067
+ },
1068
+ get ThisExpr() {
1069
+ return new ThisExprFactory();
1070
+ },
1071
+ get UnaryExpr() {
1072
+ return new UnaryExprFactory();
1073
+ }
1074
+ }), "ExpressionBuilder");
1075
+ var UnaryExprFactory = class extends AstFactory {
1076
+ static {
1077
+ __name(this, "UnaryExprFactory");
1078
+ }
1079
+ operand;
1080
+ constructor() {
1081
+ super({
1082
+ type: UnaryExpr,
1083
+ node: {
1084
+ operator: "!"
1085
+ }
1086
+ });
1087
+ }
1088
+ setOperand(builder) {
1089
+ this.operand = builder(ExpressionBuilder());
1090
+ this.update({
1091
+ operand: this.operand
1092
+ });
1093
+ return this;
1094
+ }
1095
+ };
1096
+ var ReferenceExprFactory = class extends AstFactory {
1097
+ static {
1098
+ __name(this, "ReferenceExprFactory");
1099
+ }
1100
+ target;
1101
+ args = [];
1102
+ constructor() {
1103
+ super({
1104
+ type: ReferenceExpr,
1105
+ node: {
1106
+ args: []
1107
+ }
1108
+ });
1109
+ }
1110
+ setTarget(target) {
1111
+ this.target = {
1112
+ $refText: target.name,
1113
+ ref: target
1114
+ };
1115
+ this.update({
1116
+ target: this.target
1117
+ });
1118
+ return this;
1119
+ }
1120
+ addArg(builder, name) {
1121
+ const arg = new ReferenceArgFactory().setValue(builder);
1122
+ if (name) {
1123
+ arg.setName(name);
1124
+ }
1125
+ this.args.push(arg);
1126
+ this.update({
1127
+ args: this.args
1128
+ });
1129
+ return this;
1130
+ }
1131
+ };
1132
+ var ReferenceArgFactory = class extends AstFactory {
1133
+ static {
1134
+ __name(this, "ReferenceArgFactory");
1135
+ }
1136
+ name;
1137
+ value;
1138
+ constructor() {
1139
+ super({
1140
+ type: ReferenceArg
1141
+ });
1142
+ }
1143
+ setName(name) {
1144
+ this.name = name;
1145
+ this.update({
1146
+ name: this.name
1147
+ });
1148
+ return this;
1149
+ }
1150
+ setValue(builder) {
1151
+ this.value = builder(ExpressionBuilder());
1152
+ this.update({
1153
+ value: this.value
1154
+ });
1155
+ return this;
1156
+ }
1157
+ };
1158
+ var MemberAccessExprFactory = class extends AstFactory {
1159
+ static {
1160
+ __name(this, "MemberAccessExprFactory");
1161
+ }
1162
+ member;
1163
+ operand;
1164
+ constructor() {
1165
+ super({
1166
+ type: MemberAccessExpr
1167
+ });
1168
+ }
1169
+ setMember(target) {
1170
+ this.member = target;
1171
+ this.update({
1172
+ member: this.member
1173
+ });
1174
+ return this;
1175
+ }
1176
+ setOperand(builder) {
1177
+ this.operand = builder(ExpressionBuilder());
1178
+ this.update({
1179
+ operand: this.operand
1180
+ });
1181
+ return this;
1182
+ }
1183
+ };
1184
+ var ObjectExprFactory = class extends AstFactory {
1185
+ static {
1186
+ __name(this, "ObjectExprFactory");
1187
+ }
1188
+ fields = [];
1189
+ constructor() {
1190
+ super({
1191
+ type: ObjectExpr,
1192
+ node: {
1193
+ fields: []
1194
+ }
1195
+ });
1196
+ }
1197
+ addField(builder) {
1198
+ this.fields.push(builder(new FieldInitializerFactory()));
1199
+ this.update({
1200
+ fields: this.fields
1201
+ });
1202
+ return this;
1203
+ }
1204
+ };
1205
+ var FieldInitializerFactory = class extends AstFactory {
1206
+ static {
1207
+ __name(this, "FieldInitializerFactory");
1208
+ }
1209
+ name;
1210
+ value;
1211
+ constructor() {
1212
+ super({
1213
+ type: FieldInitializer
1214
+ });
1215
+ }
1216
+ setName(name) {
1217
+ this.name = name;
1218
+ this.update({
1219
+ name: this.name
1220
+ });
1221
+ return this;
1222
+ }
1223
+ setValue(builder) {
1224
+ this.value = builder(ExpressionBuilder());
1225
+ this.update({
1226
+ value: this.value
1227
+ });
1228
+ return this;
1229
+ }
1230
+ };
1231
+ var InvocationExprFactory = class extends AstFactory {
1232
+ static {
1233
+ __name(this, "InvocationExprFactory");
1234
+ }
1235
+ args = [];
1236
+ function;
1237
+ constructor() {
1238
+ super({
1239
+ type: InvocationExpr,
1240
+ node: {
1241
+ args: []
1242
+ }
1243
+ });
1244
+ }
1245
+ addArg(builder) {
1246
+ this.args.push(builder(new ArgumentFactory()));
1247
+ this.update({
1248
+ args: this.args
1249
+ });
1250
+ return this;
1251
+ }
1252
+ setFunction(value) {
1253
+ this.function = {
1254
+ $refText: value.name,
1255
+ ref: value
1256
+ };
1257
+ this.update({
1258
+ function: this.function
1259
+ });
1260
+ return this;
1261
+ }
1262
+ };
1263
+ var ArgumentFactory = class extends AstFactory {
1264
+ static {
1265
+ __name(this, "ArgumentFactory");
1266
+ }
1267
+ value;
1268
+ constructor() {
1269
+ super({
1270
+ type: Argument
1271
+ });
1272
+ }
1273
+ setValue(builder) {
1274
+ this.value = builder(ExpressionBuilder());
1275
+ this.update({
1276
+ value: this.value
1277
+ });
1278
+ return this;
1279
+ }
1280
+ };
1281
+ var ArrayExprFactory = class extends AstFactory {
1282
+ static {
1283
+ __name(this, "ArrayExprFactory");
1284
+ }
1285
+ items = [];
1286
+ constructor() {
1287
+ super({
1288
+ type: ArrayExpr,
1289
+ node: {
1290
+ items: []
1291
+ }
1292
+ });
1293
+ }
1294
+ addItem(builder) {
1295
+ this.items.push(builder(ExpressionBuilder()));
1296
+ this.update({
1297
+ items: this.items
1298
+ });
1299
+ return this;
1300
+ }
1301
+ };
1302
+ var BinaryExprFactory = class extends AstFactory {
1303
+ static {
1304
+ __name(this, "BinaryExprFactory");
1305
+ }
1306
+ operator;
1307
+ right;
1308
+ left;
1309
+ // TODO: add support for CollectionPredicateBinding
1310
+ constructor() {
1311
+ super({
1312
+ type: BinaryExpr
1313
+ });
1314
+ }
1315
+ setOperator(operator) {
1316
+ this.operator = operator;
1317
+ this.update({
1318
+ operator: this.operator
1319
+ });
1320
+ return this;
1321
+ }
1322
+ setRight(builder) {
1323
+ this.right = builder(ExpressionBuilder());
1324
+ this.update({
1325
+ right: this.right
1326
+ });
1327
+ return this;
1328
+ }
1329
+ setLeft(builder) {
1330
+ this.left = builder(ExpressionBuilder());
1331
+ this.update({
1332
+ left: this.left
1333
+ });
1334
+ return this;
1335
+ }
1336
+ };
1337
+
1338
+ // src/factory/attribute.ts
1339
+ var DataFieldAttributeFactory = class extends AstFactory {
1340
+ static {
1341
+ __name(this, "DataFieldAttributeFactory");
1342
+ }
1343
+ args = [];
1344
+ decl;
1345
+ constructor() {
1346
+ super({
1347
+ type: DataFieldAttribute,
1348
+ node: {
1349
+ args: []
1350
+ }
1351
+ });
1352
+ }
1353
+ setDecl(decl) {
1354
+ if (!decl) {
1355
+ throw new Error("Attribute declaration is required");
1356
+ }
1357
+ this.decl = {
1358
+ $refText: decl.name,
1359
+ ref: decl
1360
+ };
1361
+ this.update({
1362
+ decl: this.decl
1363
+ });
1364
+ return this;
1365
+ }
1366
+ addArg(builder, name) {
1367
+ const factory = new AttributeArgFactory().setValue(builder);
1368
+ if (name) {
1369
+ factory.setName(name);
1370
+ }
1371
+ this.args.push(factory);
1372
+ this.update({
1373
+ args: this.args
1374
+ });
1375
+ return this;
1376
+ }
1377
+ };
1378
+ var DataModelAttributeFactory = class extends AstFactory {
1379
+ static {
1380
+ __name(this, "DataModelAttributeFactory");
1381
+ }
1382
+ args = [];
1383
+ decl;
1384
+ constructor() {
1385
+ super({
1386
+ type: DataModelAttribute,
1387
+ node: {
1388
+ args: []
1389
+ }
1390
+ });
1391
+ }
1392
+ setDecl(decl) {
1393
+ if (!decl) {
1394
+ throw new Error("Attribute declaration is required");
1395
+ }
1396
+ this.decl = {
1397
+ $refText: decl.name,
1398
+ ref: decl
1399
+ };
1400
+ this.update({
1401
+ decl: this.decl
1402
+ });
1403
+ return this;
1404
+ }
1405
+ addArg(builder, name) {
1406
+ const factory = new AttributeArgFactory().setValue(builder);
1407
+ if (name) {
1408
+ factory.setName(name);
1409
+ }
1410
+ this.args.push(factory);
1411
+ this.update({
1412
+ args: this.args
1413
+ });
1414
+ return this;
1415
+ }
1416
+ };
1417
+ var AttributeArgFactory = class extends AstFactory {
1418
+ static {
1419
+ __name(this, "AttributeArgFactory");
1420
+ }
1421
+ name = "";
1422
+ value;
1423
+ constructor() {
1424
+ super({
1425
+ type: AttributeArg
1426
+ });
1427
+ }
1428
+ setName(name) {
1429
+ this.name = name;
1430
+ this.update({
1431
+ name: this.name
1432
+ });
1433
+ return this;
1434
+ }
1435
+ setValue(builder) {
1436
+ this.value = builder(ExpressionBuilder());
1437
+ this.update({
1438
+ value: this.value
1439
+ });
1440
+ return this;
1441
+ }
1442
+ };
1443
+ var InternalAttributeFactory = class extends AstFactory {
1444
+ static {
1445
+ __name(this, "InternalAttributeFactory");
1446
+ }
1447
+ decl;
1448
+ args = [];
1449
+ constructor() {
1450
+ super({
1451
+ type: InternalAttribute,
1452
+ node: {
1453
+ args: []
1454
+ }
1455
+ });
1456
+ }
1457
+ setDecl(decl) {
1458
+ this.decl = {
1459
+ $refText: decl.name,
1460
+ ref: decl
1461
+ };
1462
+ this.update({
1463
+ decl: this.decl
1464
+ });
1465
+ return this;
1466
+ }
1467
+ addArg(builder, name) {
1468
+ const factory = new AttributeArgFactory().setValue(builder);
1469
+ if (name) {
1470
+ factory.setName(name);
1471
+ }
1472
+ this.args.push(factory);
1473
+ this.update({
1474
+ args: this.args
1475
+ });
1476
+ return this;
1477
+ }
1478
+ };
1479
+ var AttributeParamFactory = class extends AstFactory {
1480
+ static {
1481
+ __name(this, "AttributeParamFactory");
1482
+ }
1483
+ attributes = [];
1484
+ comments = [];
1485
+ default;
1486
+ name;
1487
+ type;
1488
+ constructor() {
1489
+ super({
1490
+ type: AttributeParam,
1491
+ node: {
1492
+ comments: [],
1493
+ attributes: []
1494
+ }
1495
+ });
1496
+ }
1497
+ addAttribute(builder) {
1498
+ this.attributes.push(builder(new InternalAttributeFactory()));
1499
+ this.update({
1500
+ attributes: this.attributes
1501
+ });
1502
+ return this;
1503
+ }
1504
+ setComments(comments) {
1505
+ this.comments = comments;
1506
+ this.update({
1507
+ comments: this.comments
1508
+ });
1509
+ return this;
1510
+ }
1511
+ setDefault(defaultValue) {
1512
+ this.default = defaultValue;
1513
+ this.update({
1514
+ default: this.default
1515
+ });
1516
+ return this;
1517
+ }
1518
+ setName(name) {
1519
+ this.name = name;
1520
+ this.update({
1521
+ name: this.name
1522
+ });
1523
+ return this;
1524
+ }
1525
+ setType(builder) {
1526
+ this.type = builder(new AttributeParamTypeFactory());
1527
+ this.update({
1528
+ type: this.type
1529
+ });
1530
+ return this;
1531
+ }
1532
+ };
1533
+ var AttributeParamTypeFactory = class extends AstFactory {
1534
+ static {
1535
+ __name(this, "AttributeParamTypeFactory");
1536
+ }
1537
+ array;
1538
+ optional;
1539
+ reference;
1540
+ type;
1541
+ constructor() {
1542
+ super({
1543
+ type: AttributeParamType
1544
+ });
1545
+ }
1546
+ setArray(array) {
1547
+ this.array = array;
1548
+ this.update({
1549
+ array: this.array
1550
+ });
1551
+ return this;
1552
+ }
1553
+ setOptional(optional) {
1554
+ this.optional = optional;
1555
+ this.update({
1556
+ optional: this.optional
1557
+ });
1558
+ return this;
1559
+ }
1560
+ setReference(reference) {
1561
+ this.reference = {
1562
+ $refText: reference.name,
1563
+ ref: reference
1564
+ };
1565
+ this.update({
1566
+ reference: this.reference
1567
+ });
1568
+ return this;
1569
+ }
1570
+ setType(type) {
1571
+ this.type = type;
1572
+ this.update({
1573
+ type: this.type
1574
+ });
1575
+ return this;
1576
+ }
1577
+ };
1578
+ var AttributeFactory = class extends AstFactory {
1579
+ static {
1580
+ __name(this, "AttributeFactory");
1581
+ }
1582
+ name;
1583
+ comments = [];
1584
+ attributes = [];
1585
+ params = [];
1586
+ constructor() {
1587
+ super({
1588
+ type: Attribute,
1589
+ node: {
1590
+ comments: [],
1591
+ attributes: [],
1592
+ params: []
1593
+ }
1594
+ });
1595
+ }
1596
+ setName(name) {
1597
+ this.name = name;
1598
+ this.update({
1599
+ name: this.name
1600
+ });
1601
+ return this;
1602
+ }
1603
+ setComments(comments) {
1604
+ this.comments = comments;
1605
+ this.update({
1606
+ comments: this.comments
1607
+ });
1608
+ return this;
1609
+ }
1610
+ addAttribute(builder) {
1611
+ this.attributes.push(builder(new InternalAttributeFactory()));
1612
+ this.update({
1613
+ attributes: this.attributes
1614
+ });
1615
+ return this;
1616
+ }
1617
+ addParam(builder) {
1618
+ this.params.push(builder(new AttributeParamFactory()));
1619
+ this.update({
1620
+ params: this.params
1621
+ });
1622
+ return this;
1623
+ }
1624
+ };
1625
+
1626
+ // src/factory/declaration.ts
1627
+ var DeclarationBuilder = /* @__PURE__ */ __name(() => ({
1628
+ get Attribute() {
1629
+ return new AttributeFactory();
1630
+ },
1631
+ get DataModel() {
1632
+ return new DataModelFactory();
1633
+ },
1634
+ get DataSource() {
1635
+ throw new Error("DataSource is not implemented");
1636
+ },
1637
+ get Enum() {
1638
+ return new EnumFactory();
1639
+ },
1640
+ get FunctionDecl() {
1641
+ throw new Error("FunctionDecl is not implemented");
1642
+ },
1643
+ get GeneratorDecl() {
1644
+ throw new Error("GeneratorDecl is not implemented");
1645
+ },
1646
+ get Plugin() {
1647
+ throw new Error("Plugin is not implemented");
1648
+ },
1649
+ get Procedure() {
1650
+ throw new Error("Procedure is not implemented");
1651
+ },
1652
+ get TypeDef() {
1653
+ throw new Error("TypeDef is not implemented");
1654
+ }
1655
+ }), "DeclarationBuilder");
1656
+ var DataModelFactory = class extends AstFactory {
1657
+ static {
1658
+ __name(this, "DataModelFactory");
1659
+ }
1660
+ attributes = [];
1661
+ baseModel;
1662
+ comments = [];
1663
+ fields = [];
1664
+ isView;
1665
+ mixins = [];
1666
+ name;
1667
+ constructor() {
1668
+ super({
1669
+ type: DataModel,
1670
+ node: {
1671
+ attributes: [],
1672
+ comments: [],
1673
+ fields: [],
1674
+ mixins: []
1675
+ }
1676
+ });
1677
+ }
1678
+ addAttribute(builder) {
1679
+ this.attributes.push(builder(new DataModelAttributeFactory()).setContainer(this.node));
1680
+ this.update({
1681
+ attributes: this.attributes
1682
+ });
1683
+ return this;
1684
+ }
1685
+ setBaseModel(model) {
1686
+ this.baseModel = model;
1687
+ this.update({
1688
+ baseModel: this.baseModel
1689
+ });
1690
+ return this;
1691
+ }
1692
+ setComments(comments) {
1693
+ this.comments = comments;
1694
+ this.update({
1695
+ comments: this.comments
1696
+ });
1697
+ return this;
1698
+ }
1699
+ addComment(comment) {
1700
+ this.comments.push(comment);
1701
+ this.update({
1702
+ comments: this.comments
1703
+ });
1704
+ return this;
1705
+ }
1706
+ addField(builder) {
1707
+ this.fields.push(builder(new DataFieldFactory()).setContainer(this.node));
1708
+ this.update({
1709
+ fields: this.fields
1710
+ });
1711
+ return this;
1712
+ }
1713
+ setIsView(isView) {
1714
+ this.isView = isView;
1715
+ this.update({
1716
+ isView: this.isView
1717
+ });
1718
+ return this;
1719
+ }
1720
+ addMixin(mixin) {
1721
+ this.mixins.push(mixin);
1722
+ this.update({
1723
+ mixins: this.mixins
1724
+ });
1725
+ return this;
1726
+ }
1727
+ setName(name) {
1728
+ this.name = name;
1729
+ this.update({
1730
+ name: this.name
1731
+ });
1732
+ return this;
1733
+ }
1734
+ };
1735
+ var DataFieldFactory = class extends AstFactory {
1736
+ static {
1737
+ __name(this, "DataFieldFactory");
1738
+ }
1739
+ attributes = [];
1740
+ comments = [];
1741
+ name;
1742
+ type;
1743
+ constructor() {
1744
+ super({
1745
+ type: DataField,
1746
+ node: {
1747
+ attributes: [],
1748
+ comments: []
1749
+ }
1750
+ });
1751
+ }
1752
+ addAttribute(builder) {
1753
+ if (builder instanceof DataFieldAttributeFactory) {
1754
+ builder.setContainer(this.node);
1755
+ this.attributes.push(builder);
1756
+ } else {
1757
+ const attr = builder(new DataFieldAttributeFactory());
1758
+ attr.setContainer(this.node);
1759
+ this.attributes.push(attr);
1760
+ }
1761
+ this.update({
1762
+ attributes: this.attributes
1763
+ });
1764
+ return this;
1765
+ }
1766
+ setComments(comments) {
1767
+ this.comments = comments;
1768
+ this.update({
1769
+ comments: this.comments
1770
+ });
1771
+ return this;
1772
+ }
1773
+ setName(name) {
1774
+ this.name = name;
1775
+ this.update({
1776
+ name: this.name
1777
+ });
1778
+ return this;
1779
+ }
1780
+ setType(builder) {
1781
+ this.type = builder(new DataFieldTypeFactory()).setContainer(this.node);
1782
+ this.update({
1783
+ type: this.type
1784
+ });
1785
+ return this;
1786
+ }
1787
+ };
1788
+ var DataFieldTypeFactory = class extends AstFactory {
1789
+ static {
1790
+ __name(this, "DataFieldTypeFactory");
1791
+ }
1792
+ array;
1793
+ optional;
1794
+ reference;
1795
+ type;
1796
+ unsupported;
1797
+ constructor() {
1798
+ super({
1799
+ type: DataFieldType
1800
+ });
1801
+ }
1802
+ setArray(array) {
1803
+ this.array = array;
1804
+ this.update({
1805
+ array: this.array
1806
+ });
1807
+ return this;
1808
+ }
1809
+ setOptional(optional) {
1810
+ this.optional = optional;
1811
+ this.update({
1812
+ optional: this.optional
1813
+ });
1814
+ return this;
1815
+ }
1816
+ setReference(reference) {
1817
+ this.reference = {
1818
+ $refText: reference.name,
1819
+ ref: reference
1820
+ };
1821
+ this.update({
1822
+ reference: this.reference
1823
+ });
1824
+ return this;
1825
+ }
1826
+ setType(type) {
1827
+ this.type = type;
1828
+ this.update({
1829
+ type: this.type
1830
+ });
1831
+ return this;
1832
+ }
1833
+ setUnsupported(builder) {
1834
+ this.unsupported = builder(new UnsupportedFieldTypeFactory()).setContainer(this.node);
1835
+ this.update({
1836
+ unsupported: this.unsupported
1837
+ });
1838
+ return this;
1839
+ }
1840
+ };
1841
+ var UnsupportedFieldTypeFactory = class extends AstFactory {
1842
+ static {
1843
+ __name(this, "UnsupportedFieldTypeFactory");
1844
+ }
1845
+ value;
1846
+ constructor() {
1847
+ super({
1848
+ type: UnsupportedFieldType
1849
+ });
1850
+ }
1851
+ setValue(builder) {
1852
+ this.value = builder(ExpressionBuilder());
1853
+ this.update({
1854
+ value: this.value
1855
+ });
1856
+ return this;
1857
+ }
1858
+ };
1859
+ var ModelFactory = class extends AstFactory {
1860
+ static {
1861
+ __name(this, "ModelFactory");
1862
+ }
1863
+ declarations = [];
1864
+ imports = [];
1865
+ constructor() {
1866
+ super({
1867
+ type: Model,
1868
+ node: {
1869
+ declarations: [],
1870
+ imports: []
1871
+ }
1872
+ });
1873
+ }
1874
+ addImport(builder) {
1875
+ this.imports.push(builder(new ModelImportFactory()).setContainer(this.node));
1876
+ this.update({
1877
+ imports: this.imports
1878
+ });
1879
+ return this;
1880
+ }
1881
+ addDeclaration(builder) {
1882
+ this.declarations.push(builder(DeclarationBuilder()).setContainer(this.node));
1883
+ this.update({
1884
+ declarations: this.declarations
1885
+ });
1886
+ return this;
1887
+ }
1888
+ };
1889
+ var ModelImportFactory = class extends AstFactory {
1890
+ static {
1891
+ __name(this, "ModelImportFactory");
1892
+ }
1893
+ path;
1894
+ constructor() {
1895
+ super({
1896
+ type: ModelImport
1897
+ });
1898
+ }
1899
+ setPath(path) {
1900
+ this.path = path;
1901
+ this.update({
1902
+ path: this.path
1903
+ });
1904
+ return this;
1905
+ }
1906
+ };
1907
+ var EnumFactory = class extends AstFactory {
1908
+ static {
1909
+ __name(this, "EnumFactory");
1910
+ }
1911
+ name;
1912
+ comments = [];
1913
+ fields = [];
1914
+ attributes = [];
1915
+ constructor() {
1916
+ super({
1917
+ type: Enum,
1918
+ node: {
1919
+ comments: [],
1920
+ fields: [],
1921
+ attributes: []
1922
+ }
1923
+ });
1924
+ }
1925
+ addField(builder) {
1926
+ this.fields.push(builder(new EnumFieldFactory()).setContainer(this.node));
1927
+ this.update({
1928
+ fields: this.fields
1929
+ });
1930
+ return this;
1931
+ }
1932
+ addAttribute(builder) {
1933
+ this.attributes.push(builder(new DataModelAttributeFactory()).setContainer(this.node));
1934
+ this.update({
1935
+ attributes: this.attributes
1936
+ });
1937
+ return this;
1938
+ }
1939
+ setName(name) {
1940
+ this.name = name;
1941
+ this.update({
1942
+ name: this.name
1943
+ });
1944
+ return this;
1945
+ }
1946
+ };
1947
+ var EnumFieldFactory = class extends AstFactory {
1948
+ static {
1949
+ __name(this, "EnumFieldFactory");
1950
+ }
1951
+ name;
1952
+ comments = [];
1953
+ attributes = [];
1954
+ constructor() {
1955
+ super({
1956
+ type: EnumField,
1957
+ node: {
1958
+ comments: [],
1959
+ attributes: []
1960
+ }
1961
+ });
1962
+ }
1963
+ setName(name) {
1964
+ this.name = name;
1965
+ this.update({
1966
+ name: this.name
1967
+ });
1968
+ return this;
1969
+ }
1970
+ addAttribute(builder) {
1971
+ this.attributes.push(builder(new DataFieldAttributeFactory()).setContainer(this.node));
1972
+ this.update({
1973
+ attributes: this.attributes
1974
+ });
1975
+ return this;
1976
+ }
1977
+ addComment(comment) {
1978
+ this.comments.push(comment);
1979
+ this.update({
1980
+ comments: this.comments
1981
+ });
1982
+ return this;
1983
+ }
1984
+ };
1985
+ export {
1986
+ ArgumentFactory,
1987
+ ArrayExprFactory,
1988
+ AstFactory,
1989
+ AttributeArgFactory,
1990
+ AttributeFactory,
1991
+ AttributeParamFactory,
1992
+ AttributeParamTypeFactory,
1993
+ BinaryExprFactory,
1994
+ BooleanLiteralFactory,
1995
+ DataFieldAttributeFactory,
1996
+ DataFieldFactory,
1997
+ DataFieldTypeFactory,
1998
+ DataModelAttributeFactory,
1999
+ DataModelFactory,
2000
+ DeclarationBuilder,
2001
+ EnumFactory,
2002
+ EnumFieldFactory,
2003
+ ExpressionBuilder,
2004
+ FieldInitializerFactory,
2005
+ InternalAttributeFactory,
2006
+ InvocationExprFactory,
2007
+ MemberAccessExprFactory,
2008
+ ModelFactory,
2009
+ ModelImportFactory,
2010
+ NullExprFactory,
2011
+ NumberLiteralFactory,
2012
+ ObjectExprFactory,
2013
+ ReferenceArgFactory,
2014
+ ReferenceExprFactory,
2015
+ StringLiteralFactory,
2016
+ ThisExprFactory,
2017
+ UnaryExprFactory,
2018
+ UnsupportedFieldTypeFactory
2019
+ };
2020
+ //# sourceMappingURL=factory.js.map