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