zenstack 0.4.2 → 0.6.0-pre.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.
Files changed (63) hide show
  1. package/{LICENSE.md → LICENSE} +0 -0
  2. package/bin/cli +1 -1
  3. package/package.json +18 -13
  4. package/bin/post-install.js +0 -24
  5. package/bundle/asset/logo-256-bg.png +0 -0
  6. package/bundle/asset/logo-dark-256.png +0 -0
  7. package/bundle/asset/logo-light-256.png +0 -0
  8. package/bundle/cli/index.js +0 -6952
  9. package/bundle/extension.js +0 -39
  10. package/bundle/language-server/main.js +0 -6208
  11. package/bundle/res/package.template.json +0 -9
  12. package/bundle/res/prism-zmodel.js +0 -22
  13. package/bundle/res/stdlib.zmodel +0 -218
  14. package/bundle/res/tsconfig.template.json +0 -17
  15. package/src/cli/cli-error.ts +0 -4
  16. package/src/cli/cli-util.ts +0 -214
  17. package/src/cli/index.ts +0 -246
  18. package/src/extension.ts +0 -76
  19. package/src/generator/ast-utils.ts +0 -18
  20. package/src/generator/constants.ts +0 -6
  21. package/src/generator/field-constraint/index.ts +0 -304
  22. package/src/generator/index.ts +0 -86
  23. package/src/generator/prisma/expression-writer.ts +0 -360
  24. package/src/generator/prisma/index.ts +0 -44
  25. package/src/generator/prisma/prisma-builder.ts +0 -370
  26. package/src/generator/prisma/query-guard-generator.ts +0 -249
  27. package/src/generator/prisma/schema-generator.ts +0 -313
  28. package/src/generator/prisma/typescript-expression-transformer.ts +0 -108
  29. package/src/generator/react-hooks/index.ts +0 -273
  30. package/src/generator/service/index.ts +0 -113
  31. package/src/generator/tsc/index.ts +0 -59
  32. package/src/generator/types.ts +0 -20
  33. package/src/global.d.ts +0 -3
  34. package/src/language-server/constants.ts +0 -29
  35. package/src/language-server/generated/ast.ts +0 -643
  36. package/src/language-server/generated/grammar.ts +0 -2492
  37. package/src/language-server/generated/module.ts +0 -24
  38. package/src/language-server/langium-ext.d.ts +0 -22
  39. package/src/language-server/lsp/zmodel-definition-provider.ts +0 -87
  40. package/src/language-server/main.ts +0 -13
  41. package/src/language-server/types.ts +0 -25
  42. package/src/language-server/utils.ts +0 -21
  43. package/src/language-server/validator/attribute-validator.ts +0 -11
  44. package/src/language-server/validator/datamodel-validator.ts +0 -426
  45. package/src/language-server/validator/datasource-validator.ts +0 -102
  46. package/src/language-server/validator/enum-validator.ts +0 -14
  47. package/src/language-server/validator/expression-validator.ts +0 -48
  48. package/src/language-server/validator/schema-validator.ts +0 -31
  49. package/src/language-server/validator/utils.ts +0 -158
  50. package/src/language-server/validator/zmodel-validator.ts +0 -91
  51. package/src/language-server/zmodel-linker.ts +0 -457
  52. package/src/language-server/zmodel-module.ts +0 -136
  53. package/src/language-server/zmodel-scope.ts +0 -45
  54. package/src/language-server/zmodel-workspace-manager.ts +0 -23
  55. package/src/language-server/zmodel.langium +0 -207
  56. package/src/res/package.template.json +0 -9
  57. package/src/res/prism-zmodel.js +0 -22
  58. package/src/res/stdlib.zmodel +0 -218
  59. package/src/res/tsconfig.template.json +0 -17
  60. package/src/telemetry.ts +0 -119
  61. package/src/utils/exec-utils.ts +0 -8
  62. package/src/utils/indent-string.ts +0 -9
  63. package/src/utils/pkg-utils.ts +0 -63
@@ -1,643 +0,0 @@
1
- /******************************************************************************
2
- * This file was generated by langium-cli 0.5.0.
3
- * DO NOT EDIT MANUALLY!
4
- ******************************************************************************/
5
-
6
- /* eslint-disable @typescript-eslint/array-type */
7
- /* eslint-disable @typescript-eslint/no-empty-interface */
8
- import { AstNode, AstReflection, Reference, ReferenceInfo, isAstNode, TypeMetaData } from 'langium';
9
-
10
- export type AbstractDeclaration = Attribute | DataModel | DataSource | Enum | Function;
11
-
12
- export const AbstractDeclaration = 'AbstractDeclaration';
13
-
14
- export function isAbstractDeclaration(item: unknown): item is AbstractDeclaration {
15
- return reflection.isInstance(item, AbstractDeclaration);
16
- }
17
-
18
- export type AttributeAttributeName = string;
19
-
20
- export type AttributeName = string;
21
-
22
- export type BuiltinType = 'BigInt' | 'Boolean' | 'Bytes' | 'DateTime' | 'Decimal' | 'Float' | 'Int' | 'Json' | 'String';
23
-
24
- export type DataModelAttributeName = string;
25
-
26
- export type DataModelFieldAttributeName = string;
27
-
28
- export type Expression = ArrayExpr | BinaryExpr | InvocationExpr | LiteralExpr | MemberAccessExpr | NullExpr | ReferenceExpr | ThisExpr | UnaryExpr;
29
-
30
- export const Expression = 'Expression';
31
-
32
- export function isExpression(item: unknown): item is Expression {
33
- return reflection.isInstance(item, Expression);
34
- }
35
-
36
- export type ExpressionType = 'Any' | 'Boolean' | 'DateTime' | 'Float' | 'Int' | 'Null' | 'String';
37
-
38
- export type ReferenceTarget = DataModelField | EnumField | FunctionParam;
39
-
40
- export const ReferenceTarget = 'ReferenceTarget';
41
-
42
- export function isReferenceTarget(item: unknown): item is ReferenceTarget {
43
- return reflection.isInstance(item, ReferenceTarget);
44
- }
45
-
46
- export type TypeDeclaration = DataModel | Enum;
47
-
48
- export const TypeDeclaration = 'TypeDeclaration';
49
-
50
- export function isTypeDeclaration(item: unknown): item is TypeDeclaration {
51
- return reflection.isInstance(item, TypeDeclaration);
52
- }
53
-
54
- export interface Argument extends AstNode {
55
- readonly $container: InvocationExpr;
56
- name?: string
57
- value: Expression
58
- }
59
-
60
- export const Argument = 'Argument';
61
-
62
- export function isArgument(item: unknown): item is Argument {
63
- return reflection.isInstance(item, Argument);
64
- }
65
-
66
- export interface ArrayExpr extends AstNode {
67
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
68
- items: Array<Expression>
69
- }
70
-
71
- export const ArrayExpr = 'ArrayExpr';
72
-
73
- export function isArrayExpr(item: unknown): item is ArrayExpr {
74
- return reflection.isInstance(item, ArrayExpr);
75
- }
76
-
77
- export interface Attribute extends AstNode {
78
- readonly $container: Model;
79
- attributes: Array<AttributeAttribute>
80
- name: AttributeName
81
- params: Array<AttributeParam>
82
- }
83
-
84
- export const Attribute = 'Attribute';
85
-
86
- export function isAttribute(item: unknown): item is Attribute {
87
- return reflection.isInstance(item, Attribute);
88
- }
89
-
90
- export interface AttributeArg extends AstNode {
91
- readonly $container: AttributeAttribute | DataModelAttribute | DataModelFieldAttribute;
92
- name?: string
93
- value: Expression
94
- }
95
-
96
- export const AttributeArg = 'AttributeArg';
97
-
98
- export function isAttributeArg(item: unknown): item is AttributeArg {
99
- return reflection.isInstance(item, AttributeArg);
100
- }
101
-
102
- export interface AttributeAttribute extends AstNode {
103
- readonly $container: Attribute;
104
- args: Array<AttributeArg>
105
- decl: Reference<Attribute>
106
- }
107
-
108
- export const AttributeAttribute = 'AttributeAttribute';
109
-
110
- export function isAttributeAttribute(item: unknown): item is AttributeAttribute {
111
- return reflection.isInstance(item, AttributeAttribute);
112
- }
113
-
114
- export interface AttributeParam extends AstNode {
115
- readonly $container: Attribute;
116
- default: boolean
117
- name: string
118
- type: AttributeParamType
119
- }
120
-
121
- export const AttributeParam = 'AttributeParam';
122
-
123
- export function isAttributeParam(item: unknown): item is AttributeParam {
124
- return reflection.isInstance(item, AttributeParam);
125
- }
126
-
127
- export interface AttributeParamType extends AstNode {
128
- readonly $container: AttributeParam;
129
- array: boolean
130
- optional: boolean
131
- reference?: Reference<TypeDeclaration>
132
- type?: 'ContextType' | 'FieldReference' | ExpressionType
133
- }
134
-
135
- export const AttributeParamType = 'AttributeParamType';
136
-
137
- export function isAttributeParamType(item: unknown): item is AttributeParamType {
138
- return reflection.isInstance(item, AttributeParamType);
139
- }
140
-
141
- export interface BinaryExpr extends AstNode {
142
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
143
- left: Expression
144
- operator: '!' | '!=' | '&&' | '<' | '<=' | '==' | '>' | '>=' | '?' | '^' | '||'
145
- right: Expression
146
- }
147
-
148
- export const BinaryExpr = 'BinaryExpr';
149
-
150
- export function isBinaryExpr(item: unknown): item is BinaryExpr {
151
- return reflection.isInstance(item, BinaryExpr);
152
- }
153
-
154
- export interface DataModel extends AstNode {
155
- readonly $container: Model;
156
- attributes: Array<DataModelAttribute>
157
- fields: Array<DataModelField>
158
- name: string
159
- }
160
-
161
- export const DataModel = 'DataModel';
162
-
163
- export function isDataModel(item: unknown): item is DataModel {
164
- return reflection.isInstance(item, DataModel);
165
- }
166
-
167
- export interface DataModelAttribute extends AstNode {
168
- readonly $container: DataModel;
169
- args: Array<AttributeArg>
170
- decl: Reference<Attribute>
171
- }
172
-
173
- export const DataModelAttribute = 'DataModelAttribute';
174
-
175
- export function isDataModelAttribute(item: unknown): item is DataModelAttribute {
176
- return reflection.isInstance(item, DataModelAttribute);
177
- }
178
-
179
- export interface DataModelField extends AstNode {
180
- readonly $container: DataModel;
181
- attributes: Array<DataModelFieldAttribute>
182
- name: string
183
- type: DataModelFieldType
184
- }
185
-
186
- export const DataModelField = 'DataModelField';
187
-
188
- export function isDataModelField(item: unknown): item is DataModelField {
189
- return reflection.isInstance(item, DataModelField);
190
- }
191
-
192
- export interface DataModelFieldAttribute extends AstNode {
193
- readonly $container: DataModelField;
194
- args: Array<AttributeArg>
195
- decl: Reference<Attribute>
196
- }
197
-
198
- export const DataModelFieldAttribute = 'DataModelFieldAttribute';
199
-
200
- export function isDataModelFieldAttribute(item: unknown): item is DataModelFieldAttribute {
201
- return reflection.isInstance(item, DataModelFieldAttribute);
202
- }
203
-
204
- export interface DataModelFieldType extends AstNode {
205
- readonly $container: DataModelField;
206
- array: boolean
207
- optional: boolean
208
- reference?: Reference<TypeDeclaration>
209
- type?: BuiltinType
210
- }
211
-
212
- export const DataModelFieldType = 'DataModelFieldType';
213
-
214
- export function isDataModelFieldType(item: unknown): item is DataModelFieldType {
215
- return reflection.isInstance(item, DataModelFieldType);
216
- }
217
-
218
- export interface DataSource extends AstNode {
219
- readonly $container: Model;
220
- fields: Array<DataSourceField>
221
- name: string
222
- }
223
-
224
- export const DataSource = 'DataSource';
225
-
226
- export function isDataSource(item: unknown): item is DataSource {
227
- return reflection.isInstance(item, DataSource);
228
- }
229
-
230
- export interface DataSourceField extends AstNode {
231
- readonly $container: DataSource;
232
- name: string
233
- value: InvocationExpr | LiteralExpr
234
- }
235
-
236
- export const DataSourceField = 'DataSourceField';
237
-
238
- export function isDataSourceField(item: unknown): item is DataSourceField {
239
- return reflection.isInstance(item, DataSourceField);
240
- }
241
-
242
- export interface Enum extends AstNode {
243
- readonly $container: Model;
244
- fields: Array<EnumField>
245
- name: string
246
- }
247
-
248
- export const Enum = 'Enum';
249
-
250
- export function isEnum(item: unknown): item is Enum {
251
- return reflection.isInstance(item, Enum);
252
- }
253
-
254
- export interface EnumField extends AstNode {
255
- readonly $container: Enum;
256
- name: string
257
- }
258
-
259
- export const EnumField = 'EnumField';
260
-
261
- export function isEnumField(item: unknown): item is EnumField {
262
- return reflection.isInstance(item, EnumField);
263
- }
264
-
265
- export interface Function extends AstNode {
266
- readonly $container: Model;
267
- expression?: Expression
268
- name: string
269
- params: Array<FunctionParam>
270
- returnType: FunctionParamType
271
- }
272
-
273
- export const Function = 'Function';
274
-
275
- export function isFunction(item: unknown): item is Function {
276
- return reflection.isInstance(item, Function);
277
- }
278
-
279
- export interface FunctionParam extends AstNode {
280
- readonly $container: Function;
281
- name: string
282
- type: FunctionParamType
283
- }
284
-
285
- export const FunctionParam = 'FunctionParam';
286
-
287
- export function isFunctionParam(item: unknown): item is FunctionParam {
288
- return reflection.isInstance(item, FunctionParam);
289
- }
290
-
291
- export interface FunctionParamType extends AstNode {
292
- readonly $container: Function | FunctionParam;
293
- array: boolean
294
- reference?: Reference<TypeDeclaration>
295
- type?: ExpressionType
296
- }
297
-
298
- export const FunctionParamType = 'FunctionParamType';
299
-
300
- export function isFunctionParamType(item: unknown): item is FunctionParamType {
301
- return reflection.isInstance(item, FunctionParamType);
302
- }
303
-
304
- export interface InvocationExpr extends AstNode {
305
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
306
- args: Array<Argument>
307
- function: Reference<Function>
308
- }
309
-
310
- export const InvocationExpr = 'InvocationExpr';
311
-
312
- export function isInvocationExpr(item: unknown): item is InvocationExpr {
313
- return reflection.isInstance(item, InvocationExpr);
314
- }
315
-
316
- export interface LiteralExpr extends AstNode {
317
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
318
- value: boolean | number | string
319
- }
320
-
321
- export const LiteralExpr = 'LiteralExpr';
322
-
323
- export function isLiteralExpr(item: unknown): item is LiteralExpr {
324
- return reflection.isInstance(item, LiteralExpr);
325
- }
326
-
327
- export interface MemberAccessExpr extends AstNode {
328
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
329
- member: Reference<DataModelField>
330
- operand: Expression
331
- }
332
-
333
- export const MemberAccessExpr = 'MemberAccessExpr';
334
-
335
- export function isMemberAccessExpr(item: unknown): item is MemberAccessExpr {
336
- return reflection.isInstance(item, MemberAccessExpr);
337
- }
338
-
339
- export interface Model extends AstNode {
340
- declarations: Array<AbstractDeclaration>
341
- }
342
-
343
- export const Model = 'Model';
344
-
345
- export function isModel(item: unknown): item is Model {
346
- return reflection.isInstance(item, Model);
347
- }
348
-
349
- export interface NullExpr extends AstNode {
350
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
351
- value: string
352
- }
353
-
354
- export const NullExpr = 'NullExpr';
355
-
356
- export function isNullExpr(item: unknown): item is NullExpr {
357
- return reflection.isInstance(item, NullExpr);
358
- }
359
-
360
- export interface ReferenceArg extends AstNode {
361
- readonly $container: ReferenceExpr;
362
- name: 'sort'
363
- value: 'Asc' | 'Desc'
364
- }
365
-
366
- export const ReferenceArg = 'ReferenceArg';
367
-
368
- export function isReferenceArg(item: unknown): item is ReferenceArg {
369
- return reflection.isInstance(item, ReferenceArg);
370
- }
371
-
372
- export interface ReferenceExpr extends AstNode {
373
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
374
- args: Array<ReferenceArg>
375
- target: Reference<ReferenceTarget>
376
- }
377
-
378
- export const ReferenceExpr = 'ReferenceExpr';
379
-
380
- export function isReferenceExpr(item: unknown): item is ReferenceExpr {
381
- return reflection.isInstance(item, ReferenceExpr);
382
- }
383
-
384
- export interface ThisExpr extends AstNode {
385
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
386
- value: string
387
- }
388
-
389
- export const ThisExpr = 'ThisExpr';
390
-
391
- export function isThisExpr(item: unknown): item is ThisExpr {
392
- return reflection.isInstance(item, ThisExpr);
393
- }
394
-
395
- export interface UnaryExpr extends AstNode {
396
- readonly $container: Argument | ArrayExpr | AttributeArg | BinaryExpr | DataSourceField | Function | MemberAccessExpr | UnaryExpr;
397
- operand: Expression
398
- operator: '!'
399
- }
400
-
401
- export const UnaryExpr = 'UnaryExpr';
402
-
403
- export function isUnaryExpr(item: unknown): item is UnaryExpr {
404
- return reflection.isInstance(item, UnaryExpr);
405
- }
406
-
407
- export type ZModelAstType = 'AbstractDeclaration' | 'Argument' | 'ArrayExpr' | 'Attribute' | 'AttributeArg' | 'AttributeAttribute' | 'AttributeParam' | 'AttributeParamType' | 'BinaryExpr' | 'DataModel' | 'DataModelAttribute' | 'DataModelField' | 'DataModelFieldAttribute' | 'DataModelFieldType' | 'DataSource' | 'DataSourceField' | 'Enum' | 'EnumField' | 'Expression' | 'Function' | 'FunctionParam' | 'FunctionParamType' | 'InvocationExpr' | 'LiteralExpr' | 'MemberAccessExpr' | 'Model' | 'NullExpr' | 'ReferenceArg' | 'ReferenceExpr' | 'ReferenceTarget' | 'ThisExpr' | 'TypeDeclaration' | 'UnaryExpr';
408
-
409
- export class ZModelAstReflection implements AstReflection {
410
-
411
- getAllTypes(): string[] {
412
- return ['AbstractDeclaration', 'Argument', 'ArrayExpr', 'Attribute', 'AttributeArg', 'AttributeAttribute', 'AttributeParam', 'AttributeParamType', 'BinaryExpr', 'DataModel', 'DataModelAttribute', 'DataModelField', 'DataModelFieldAttribute', 'DataModelFieldType', 'DataSource', 'DataSourceField', 'Enum', 'EnumField', 'Expression', 'Function', 'FunctionParam', 'FunctionParamType', 'InvocationExpr', 'LiteralExpr', 'MemberAccessExpr', 'Model', 'NullExpr', 'ReferenceArg', 'ReferenceExpr', 'ReferenceTarget', 'ThisExpr', 'TypeDeclaration', 'UnaryExpr'];
413
- }
414
-
415
- isInstance(node: unknown, type: string): boolean {
416
- return isAstNode(node) && this.isSubtype(node.$type, type);
417
- }
418
-
419
- isSubtype(subtype: string, supertype: string): boolean {
420
- if (subtype === supertype) {
421
- return true;
422
- }
423
- switch (subtype) {
424
- case ArrayExpr:
425
- case BinaryExpr:
426
- case InvocationExpr:
427
- case LiteralExpr:
428
- case MemberAccessExpr:
429
- case NullExpr:
430
- case ReferenceExpr:
431
- case ThisExpr:
432
- case UnaryExpr: {
433
- return this.isSubtype(Expression, supertype);
434
- }
435
- case Attribute:
436
- case DataSource:
437
- case Function: {
438
- return this.isSubtype(AbstractDeclaration, supertype);
439
- }
440
- case DataModel:
441
- case Enum: {
442
- return this.isSubtype(AbstractDeclaration, supertype) || this.isSubtype(TypeDeclaration, supertype);
443
- }
444
- case DataModelField:
445
- case EnumField:
446
- case FunctionParam: {
447
- return this.isSubtype(ReferenceTarget, supertype);
448
- }
449
- default: {
450
- return false;
451
- }
452
- }
453
- }
454
-
455
- getReferenceType(refInfo: ReferenceInfo): string {
456
- const referenceId = `${refInfo.container.$type}:${refInfo.property}`;
457
- switch (referenceId) {
458
- case 'AttributeAttribute:decl': {
459
- return Attribute;
460
- }
461
- case 'AttributeParamType:reference': {
462
- return TypeDeclaration;
463
- }
464
- case 'DataModelAttribute:decl': {
465
- return Attribute;
466
- }
467
- case 'DataModelFieldAttribute:decl': {
468
- return Attribute;
469
- }
470
- case 'DataModelFieldType:reference': {
471
- return TypeDeclaration;
472
- }
473
- case 'FunctionParamType:reference': {
474
- return TypeDeclaration;
475
- }
476
- case 'InvocationExpr:function': {
477
- return Function;
478
- }
479
- case 'MemberAccessExpr:member': {
480
- return DataModelField;
481
- }
482
- case 'ReferenceExpr:target': {
483
- return ReferenceTarget;
484
- }
485
- default: {
486
- throw new Error(`${referenceId} is not a valid reference id.`);
487
- }
488
- }
489
- }
490
-
491
- getTypeMetaData(type: string): TypeMetaData {
492
- switch (type) {
493
- case 'ArrayExpr': {
494
- return {
495
- name: 'ArrayExpr',
496
- mandatory: [
497
- { name: 'items', type: 'array' }
498
- ]
499
- };
500
- }
501
- case 'Attribute': {
502
- return {
503
- name: 'Attribute',
504
- mandatory: [
505
- { name: 'attributes', type: 'array' },
506
- { name: 'params', type: 'array' }
507
- ]
508
- };
509
- }
510
- case 'AttributeAttribute': {
511
- return {
512
- name: 'AttributeAttribute',
513
- mandatory: [
514
- { name: 'args', type: 'array' }
515
- ]
516
- };
517
- }
518
- case 'AttributeParam': {
519
- return {
520
- name: 'AttributeParam',
521
- mandatory: [
522
- { name: 'default', type: 'boolean' }
523
- ]
524
- };
525
- }
526
- case 'AttributeParamType': {
527
- return {
528
- name: 'AttributeParamType',
529
- mandatory: [
530
- { name: 'array', type: 'boolean' },
531
- { name: 'optional', type: 'boolean' }
532
- ]
533
- };
534
- }
535
- case 'DataModel': {
536
- return {
537
- name: 'DataModel',
538
- mandatory: [
539
- { name: 'attributes', type: 'array' },
540
- { name: 'fields', type: 'array' }
541
- ]
542
- };
543
- }
544
- case 'DataModelAttribute': {
545
- return {
546
- name: 'DataModelAttribute',
547
- mandatory: [
548
- { name: 'args', type: 'array' }
549
- ]
550
- };
551
- }
552
- case 'DataModelField': {
553
- return {
554
- name: 'DataModelField',
555
- mandatory: [
556
- { name: 'attributes', type: 'array' }
557
- ]
558
- };
559
- }
560
- case 'DataModelFieldAttribute': {
561
- return {
562
- name: 'DataModelFieldAttribute',
563
- mandatory: [
564
- { name: 'args', type: 'array' }
565
- ]
566
- };
567
- }
568
- case 'DataModelFieldType': {
569
- return {
570
- name: 'DataModelFieldType',
571
- mandatory: [
572
- { name: 'array', type: 'boolean' },
573
- { name: 'optional', type: 'boolean' }
574
- ]
575
- };
576
- }
577
- case 'DataSource': {
578
- return {
579
- name: 'DataSource',
580
- mandatory: [
581
- { name: 'fields', type: 'array' }
582
- ]
583
- };
584
- }
585
- case 'Enum': {
586
- return {
587
- name: 'Enum',
588
- mandatory: [
589
- { name: 'fields', type: 'array' }
590
- ]
591
- };
592
- }
593
- case 'Function': {
594
- return {
595
- name: 'Function',
596
- mandatory: [
597
- { name: 'params', type: 'array' }
598
- ]
599
- };
600
- }
601
- case 'FunctionParamType': {
602
- return {
603
- name: 'FunctionParamType',
604
- mandatory: [
605
- { name: 'array', type: 'boolean' }
606
- ]
607
- };
608
- }
609
- case 'InvocationExpr': {
610
- return {
611
- name: 'InvocationExpr',
612
- mandatory: [
613
- { name: 'args', type: 'array' }
614
- ]
615
- };
616
- }
617
- case 'Model': {
618
- return {
619
- name: 'Model',
620
- mandatory: [
621
- { name: 'declarations', type: 'array' }
622
- ]
623
- };
624
- }
625
- case 'ReferenceExpr': {
626
- return {
627
- name: 'ReferenceExpr',
628
- mandatory: [
629
- { name: 'args', type: 'array' }
630
- ]
631
- };
632
- }
633
- default: {
634
- return {
635
- name: type,
636
- mandatory: []
637
- };
638
- }
639
- }
640
- }
641
- }
642
-
643
- export const reflection = new ZModelAstReflection();