@cparra/apex-reflection 2.17.1 → 2.17.2
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/package.json +6 -3
- package/__tests__/end-to-end.test.ts +0 -426
- package/index.ts +0 -192
- package/jest.config.js +0 -11
- package/out.js +0 -17448
- package/tsconfig.json +0 -13
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apex-reflection",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.2",
|
|
4
4
|
"description": "Provides tools for reflecting Apex code, the language used in Salesforce development.",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc",
|
|
8
8
|
"test": "jest"
|
|
@@ -24,5 +24,8 @@
|
|
|
24
24
|
"ts-jest": "^27.0.5",
|
|
25
25
|
"typescript": "^4.7.4"
|
|
26
26
|
},
|
|
27
|
-
"types": "dist/index.d.ts"
|
|
27
|
+
"types": "dist/index.d.ts",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
]
|
|
28
31
|
}
|
|
@@ -1,426 +0,0 @@
|
|
|
1
|
-
import {ClassMirror, EnumMirror, InterfaceMirror, reflect} from '../index';
|
|
2
|
-
|
|
3
|
-
describe('Enum Reflection', () => {
|
|
4
|
-
test('Simple, single line declaration', () => {
|
|
5
|
-
const enumBody = 'enum MyEnumName {}';
|
|
6
|
-
const result = reflect(enumBody).typeMirror;
|
|
7
|
-
expect(result.type_name).toBe('enum');
|
|
8
|
-
expect(result.name).toBe('MyEnumName');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('Multi-line declaration with values', () => {
|
|
12
|
-
const enumBody = `
|
|
13
|
-
enum MyEnumName {
|
|
14
|
-
VALUE_1,
|
|
15
|
-
VALUE2
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
const result = reflect(enumBody).typeMirror;
|
|
19
|
-
expect(result.type_name).toBe('enum');
|
|
20
|
-
expect(result.name).toBe('MyEnumName');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test('With doc comments', () => {
|
|
24
|
-
const enumBody = `
|
|
25
|
-
/**
|
|
26
|
-
* My enum description
|
|
27
|
-
*/
|
|
28
|
-
enum MyEnumName {
|
|
29
|
-
VALUE_1,
|
|
30
|
-
VALUE2
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
const result = reflect(enumBody).typeMirror;
|
|
34
|
-
expect(result.docComment.description).toBe('My enum description');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('Enums can have values', () => {
|
|
38
|
-
const enumBody = `
|
|
39
|
-
enum MyEnumName {
|
|
40
|
-
VALUE_1,
|
|
41
|
-
VALUE2
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
const result = reflect(enumBody).typeMirror as EnumMirror;
|
|
45
|
-
expect(result.values.length).toBe(2);
|
|
46
|
-
expect(result.values[0].name).toBe('VALUE_1');
|
|
47
|
-
expect(result.values[1].name).toBe('VALUE2');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('Enum values can have descriptions', () => {
|
|
51
|
-
const enumBody = `
|
|
52
|
-
enum MyEnumName {
|
|
53
|
-
/**
|
|
54
|
-
* Value 1 description
|
|
55
|
-
*/
|
|
56
|
-
VALUE_1,
|
|
57
|
-
VALUE2
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
const result = reflect(enumBody).typeMirror as EnumMirror;
|
|
61
|
-
expect(result.values.length).toBe(2);
|
|
62
|
-
expect(result.values[0].docComment.description).toBe('Value 1 description');
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('Interface Reflection', () => {
|
|
67
|
-
test('Single line interface definition', () => {
|
|
68
|
-
const interfaceBody = 'interface MyInterface{}';
|
|
69
|
-
const result = reflect(interfaceBody).typeMirror;
|
|
70
|
-
expect(result.type_name).toBe('interface');
|
|
71
|
-
expect(result.name).toBe('MyInterface');
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('When no access modifier is defined it is private', () => {
|
|
75
|
-
const interfaceBody = 'interface MyInterface{}';
|
|
76
|
-
const result = reflect(interfaceBody).typeMirror;
|
|
77
|
-
expect(result.access_modifier).toBe('private');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('Can have access modifier', () => {
|
|
81
|
-
const interfaceBody = 'public interface MyInterface{}';
|
|
82
|
-
const result = reflect(interfaceBody).typeMirror;
|
|
83
|
-
expect(result.access_modifier).toBe('public');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('Can have a sharing modifier', () => {
|
|
87
|
-
const interfaceBody = 'public with sharing interface MyInterface{}';
|
|
88
|
-
const result = (reflect(interfaceBody).typeMirror) as InterfaceMirror;
|
|
89
|
-
expect(result.sharingModifier).toBe('withSharing');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test('Can have methods', () => {
|
|
93
|
-
const interfaceBody = `
|
|
94
|
-
public with sharing interface MyInterface{
|
|
95
|
-
void method1();
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
98
|
-
const result = (reflect(interfaceBody).typeMirror) as InterfaceMirror;
|
|
99
|
-
expect(result.methods.length).toBe(1);
|
|
100
|
-
expect(result.methods[0].name).toBe('method1');
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
test('Can have extend other interfaces', () => {
|
|
104
|
-
const interfaceBody = `
|
|
105
|
-
public with sharing interface MyInterface extends Interface2 {
|
|
106
|
-
void method1();
|
|
107
|
-
}
|
|
108
|
-
`;
|
|
109
|
-
const result = (reflect(interfaceBody).typeMirror) as InterfaceMirror;
|
|
110
|
-
expect(result.extended_interfaces.length).toBe(1);
|
|
111
|
-
expect(result.extended_interfaces[0]).toBe('Interface2');
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test('Can have annotations', () => {
|
|
115
|
-
const interfaceBody = `
|
|
116
|
-
@NamespaceAccessible
|
|
117
|
-
public with sharing interface MyInterface{
|
|
118
|
-
void method1();
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
121
|
-
const result = (reflect(interfaceBody).typeMirror) as InterfaceMirror;
|
|
122
|
-
expect(result.annotations.length).toBe(1);
|
|
123
|
-
expect(result.annotations[0].name).toBe('namespaceaccessible');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test('Methods can have their own annotations', () => {
|
|
127
|
-
const interfaceBody = `
|
|
128
|
-
@NamespaceAccessible
|
|
129
|
-
public with sharing interface MyInterface{
|
|
130
|
-
@Deprecated
|
|
131
|
-
void method1();
|
|
132
|
-
}
|
|
133
|
-
`;
|
|
134
|
-
const result = (reflect(interfaceBody).typeMirror) as InterfaceMirror;
|
|
135
|
-
expect(result.methods[0].annotations.length).toBe(2);
|
|
136
|
-
|
|
137
|
-
const annotationNames = result.methods[0].annotations.map(a => a.name);
|
|
138
|
-
expect(annotationNames).toContain('namespaceaccessible');
|
|
139
|
-
expect(annotationNames).toContain('deprecated');
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
describe('Class reflection', () => {
|
|
144
|
-
test('Single line class definition', () => {
|
|
145
|
-
const classBody = 'class MyClass{}';
|
|
146
|
-
const result = reflect(classBody).typeMirror;
|
|
147
|
-
expect(result.type_name).toBe('class');
|
|
148
|
-
expect(result.name).toBe('MyClass');
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test('When no access modifier is defined it is private', () => {
|
|
152
|
-
const classBody = 'class MyClass{}';
|
|
153
|
-
const result = reflect(classBody).typeMirror;
|
|
154
|
-
expect(result.access_modifier).toBe('private');
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
test('Can have access modifier', () => {
|
|
158
|
-
const interfaceBody = 'public class MyClass{}';
|
|
159
|
-
const result = reflect(interfaceBody).typeMirror;
|
|
160
|
-
expect(result.access_modifier).toBe('public');
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
test('Can have a sharing modifier', () => {
|
|
164
|
-
const classBody = 'public with sharing class MyClass{}';
|
|
165
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
166
|
-
expect(result.sharingModifier).toBe('withSharing');
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
test('Can have a class modifier', () => {
|
|
170
|
-
const classBody = 'public with sharing abstract class MyClass{}';
|
|
171
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
172
|
-
expect(result.classModifier).toBe('abstract');
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test('Can extend a class', () => {
|
|
176
|
-
const classBody = 'public with sharing class MyClass extends Class2 {}';
|
|
177
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
178
|
-
expect(result.extended_class).toBe('Class2');
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
test('Can implement interfaces', () => {
|
|
182
|
-
const classBody = 'public with sharing class MyClass implements Interface1, Interface2 {}';
|
|
183
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
184
|
-
expect(result.implemented_interfaces.length).toBe(2);
|
|
185
|
-
expect(result.implemented_interfaces[0]).toBe('Interface1');
|
|
186
|
-
expect(result.implemented_interfaces[1]).toBe('Interface2');
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
test('Can have properties', () => {
|
|
190
|
-
const classBody = `
|
|
191
|
-
public with sharing class MyClass {
|
|
192
|
-
public String Prop1 { get; set; }
|
|
193
|
-
public Integer Prop2 { get; set; }
|
|
194
|
-
}
|
|
195
|
-
`;
|
|
196
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
197
|
-
expect(result.properties.length).toBe(2);
|
|
198
|
-
expect(result.properties[0].typeReference.type).toBe('String');
|
|
199
|
-
expect(result.properties[0].name).toBe('Prop1');
|
|
200
|
-
expect(result.properties[1].typeReference.type).toBe('Integer');
|
|
201
|
-
expect(result.properties[1].name).toBe('Prop2');
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test('Can have fields', () => {
|
|
205
|
-
const classBody = `
|
|
206
|
-
public with sharing class MyClass {
|
|
207
|
-
private String var1, var2;
|
|
208
|
-
}
|
|
209
|
-
`;
|
|
210
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
211
|
-
expect(result.fields.length).toBe(2);
|
|
212
|
-
expect(result.fields[0].typeReference.type).toBe('String');
|
|
213
|
-
expect(result.fields[1].typeReference.type).toBe('String');
|
|
214
|
-
expect(result.fields[0].name).toBe('var1');
|
|
215
|
-
expect(result.fields[1].name).toBe('var2');
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
test('Can have transient fields', () => {
|
|
219
|
-
const classBody = `
|
|
220
|
-
public with sharing class MyClass {
|
|
221
|
-
transient String var1;
|
|
222
|
-
}
|
|
223
|
-
`;
|
|
224
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
225
|
-
expect(result.fields.length).toBe(1);
|
|
226
|
-
expect(result.fields[0].typeReference.type).toBe('String');
|
|
227
|
-
expect(result.fields[0].name).toBe('var1');
|
|
228
|
-
expect(result.fields[0].memberModifiers).toContain('transient');
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
test('Can have annotations with parameters', () => {
|
|
232
|
-
const classBody = `
|
|
233
|
-
@IsTest(SeeAllData=true)
|
|
234
|
-
/** Some docs */
|
|
235
|
-
public with sharing class MyClass {}
|
|
236
|
-
`;
|
|
237
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
238
|
-
expect(result.annotations.length).toBe(1);
|
|
239
|
-
expect(result.annotations[0].elementValues.length).toBe(1);
|
|
240
|
-
expect(result.annotations[0].elementValues[0].key).toBe('SeeAllData');
|
|
241
|
-
expect(result.annotations[0].elementValues[0].value).toBe('true');
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('Can have annotations with parameters after the docs', () => {
|
|
245
|
-
const classBody = `
|
|
246
|
-
/**
|
|
247
|
-
* @description Account related operations.
|
|
248
|
-
*/
|
|
249
|
-
@RestResource(urlMapping='/Account/*')
|
|
250
|
-
global with sharing class SampleRestResource {}
|
|
251
|
-
`;
|
|
252
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
253
|
-
expect(result.annotations.length).toBe(1);
|
|
254
|
-
expect(result.annotations[0].elementValues.length).toBe(1);
|
|
255
|
-
expect(result.annotations[0].elementValues[0].key).toBe('urlMapping');
|
|
256
|
-
expect(result.annotations[0].elementValues[0].value).toBe('\'/Account/*\'');
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
test('Can have constructors', () => {
|
|
260
|
-
const classBody = `
|
|
261
|
-
public with sharing class MyClass {
|
|
262
|
-
public MyClass() {}
|
|
263
|
-
public MyClass(String var1) {}
|
|
264
|
-
}
|
|
265
|
-
`;
|
|
266
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
267
|
-
expect(result.constructors.length).toBe(2);
|
|
268
|
-
expect(result.constructors[0].parameters.length).toBe(0);
|
|
269
|
-
expect(result.constructors[0].access_modifier).toBe('public');
|
|
270
|
-
expect(result.constructors[1].parameters.length).toBe(1);
|
|
271
|
-
expect(result.constructors[1].parameters[0].name).toBe('var1');
|
|
272
|
-
expect(result.constructors[1].parameters[0].typeReference.type).toBe('String');
|
|
273
|
-
expect(result.constructors[1].access_modifier).toBe('public');
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
test('Can have methods', () => {
|
|
277
|
-
const classBody = `
|
|
278
|
-
public with sharing class MyClass {
|
|
279
|
-
public static String method1() {
|
|
280
|
-
return '';
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
private void method2(){}
|
|
284
|
-
}
|
|
285
|
-
`;
|
|
286
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
287
|
-
expect(result.methods.length).toBe(2);
|
|
288
|
-
expect(result.methods[0].memberModifiers.length).toBe(1);
|
|
289
|
-
expect(result.methods[0].memberModifiers[0]).toBe('static');
|
|
290
|
-
expect(result.methods[0].access_modifier).toBe('public');
|
|
291
|
-
expect(result.methods[0].typeReference.type).toBe('String');
|
|
292
|
-
expect(result.methods[0].name).toBe('method1');
|
|
293
|
-
|
|
294
|
-
expect(result.methods[1].memberModifiers.length).toBe(0);
|
|
295
|
-
expect(result.methods[1].access_modifier).toBe('private');
|
|
296
|
-
expect(result.methods[1].typeReference.type).toBe('void');
|
|
297
|
-
expect(result.methods[1].name).toBe('method2');
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
test('Can have virtual methods', () => {
|
|
301
|
-
const classBody = `
|
|
302
|
-
public with sharing class MyClass {
|
|
303
|
-
public virtual String method1() {
|
|
304
|
-
return null ?? '';
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
`;
|
|
308
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
309
|
-
expect(result.methods[0].memberModifiers[0]).toBe('virtual');
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
test('Can have abstract methods', () => {
|
|
313
|
-
const classBody = `
|
|
314
|
-
public with sharing abstract class MyClass {
|
|
315
|
-
public abstract String method1() {
|
|
316
|
-
return null ?? '';
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
`;
|
|
320
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
321
|
-
expect(result.methods[0].memberModifiers[0]).toBe('abstract');
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
test('Can have inner enums', () => {
|
|
325
|
-
const classBody = `
|
|
326
|
-
public with sharing class MyClass {
|
|
327
|
-
public enum MyEnum {}
|
|
328
|
-
}
|
|
329
|
-
`;
|
|
330
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
331
|
-
expect(result.enums.length).toBe(1);
|
|
332
|
-
expect(result.enums[0].access_modifier).toBe('public');
|
|
333
|
-
expect(result.enums[0].name).toBe('MyEnum');
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
test('Can have inner interfaces', () => {
|
|
337
|
-
const classBody = `
|
|
338
|
-
public with sharing class MyClass {
|
|
339
|
-
public interface MyInterface {
|
|
340
|
-
void method1();
|
|
341
|
-
void method2();
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
`;
|
|
345
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
346
|
-
expect(result.interfaces.length).toBe(1);
|
|
347
|
-
expect(result.interfaces[0].name).toBe('MyInterface');
|
|
348
|
-
expect(result.interfaces[0].methods.length).toBe(2);
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
test('Can have inner classes', () => {
|
|
352
|
-
const classBody = `
|
|
353
|
-
public with sharing class MyClass {
|
|
354
|
-
public class MyClass {
|
|
355
|
-
public void method1();
|
|
356
|
-
public void method2();
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
`;
|
|
360
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
361
|
-
expect(result.classes.length).toBe(1);
|
|
362
|
-
expect(result.classes[0].name).toBe('MyClass');
|
|
363
|
-
expect(result.classes[0].methods.length).toBe(2);
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
test('Can have members in groups', () => {
|
|
367
|
-
const classBody = `
|
|
368
|
-
public with sharing class MyClass {
|
|
369
|
-
/**
|
|
370
|
-
* @start-group Group Name
|
|
371
|
-
* @description Group Description
|
|
372
|
-
*/
|
|
373
|
-
public String Prop1 { get; set; }
|
|
374
|
-
public Integer Prop2 { get; set; }
|
|
375
|
-
/** @end-group */
|
|
376
|
-
}
|
|
377
|
-
`;
|
|
378
|
-
|
|
379
|
-
const result = (reflect(classBody)).typeMirror as ClassMirror;
|
|
380
|
-
expect(result.properties.length).toBe(2);
|
|
381
|
-
expect(result.properties[0].typeReference.type).toBe('String');
|
|
382
|
-
expect(result.properties[0].name).toBe('Prop1');
|
|
383
|
-
expect(result.properties[0].group).toBe('Group Name');
|
|
384
|
-
expect(result.properties[0].groupDescription).toBe('Group Description');
|
|
385
|
-
expect(result.properties[1].typeReference.type).toBe('Integer');
|
|
386
|
-
expect(result.properties[1].name).toBe('Prop2');
|
|
387
|
-
expect(result.properties[1].group).toBe('Group Name');
|
|
388
|
-
expect(result.properties[1].groupDescription).toBe('Group Description');
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
test('Supports block style apex docs', () => {
|
|
392
|
-
const classBody = `/**********************************************************
|
|
393
|
-
@description Uses a block style apex doc
|
|
394
|
-
@group Main
|
|
395
|
-
@test-class {@link SampleClass}
|
|
396
|
-
***********************************************************/
|
|
397
|
-
public class GroupedClass {
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
`;
|
|
401
|
-
|
|
402
|
-
const result = reflect(classBody);
|
|
403
|
-
expect(result.error).toBeNull()
|
|
404
|
-
|
|
405
|
-
const typeResult = result.typeMirror as ClassMirror;
|
|
406
|
-
expect(typeResult.name).toBe('GroupedClass');
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
test('supports grouping', () => {
|
|
410
|
-
const classBody = `
|
|
411
|
-
public class MyClass {
|
|
412
|
-
public void myMethod() {
|
|
413
|
-
List<Object> groupedResults =
|
|
414
|
-
[SELECT LeadSource, Rating,
|
|
415
|
-
GROUPING(LeadSource) grpLS, GROUPING(Rating) grpRating,
|
|
416
|
-
COUNT(Name) cnt
|
|
417
|
-
FROM Lead
|
|
418
|
-
GROUP BY ROLLUP(LeadSource, Rating)];
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
`;
|
|
422
|
-
|
|
423
|
-
const result = reflect(classBody);
|
|
424
|
-
expect(result.error).toBeNull()
|
|
425
|
-
});
|
|
426
|
-
});
|
package/index.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
require('./out.js');
|
|
2
|
-
|
|
3
|
-
export function reflect(declarationBody: string): ReflectionResult {
|
|
4
|
-
// @ts-expect-error "reflect" is added to self by the "out" module
|
|
5
|
-
return JSON.parse(self.reflect(declarationBody)) as ReflectionResult;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface ParamAnnotation {
|
|
9
|
-
bodyLines: string[];
|
|
10
|
-
paramName: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ReturnAnnotation {
|
|
14
|
-
bodyLines: string[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ExampleAnnotation {
|
|
18
|
-
bodyLines: string[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface ThrowsAnnotation {
|
|
22
|
-
bodyLines: string[];
|
|
23
|
-
exceptionName: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface DocCommentAnnotation {
|
|
27
|
-
name: string;
|
|
28
|
-
bodyLines: string[];
|
|
29
|
-
body: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface DocComment {
|
|
33
|
-
rawDeclaration?: string;
|
|
34
|
-
paramAnnotations: ParamAnnotation[];
|
|
35
|
-
returnAnnotation: ReturnAnnotation | null;
|
|
36
|
-
exampleAnnotation: ExampleAnnotation | null;
|
|
37
|
-
throwsAnnotations: ThrowsAnnotation[];
|
|
38
|
-
annotations: DocCommentAnnotation[];
|
|
39
|
-
descriptionLines: string[];
|
|
40
|
-
description: string;
|
|
41
|
-
error?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface AnnotationElementValue {
|
|
45
|
-
key: string;
|
|
46
|
-
value: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface Annotation {
|
|
50
|
-
rawDeclaration: string;
|
|
51
|
-
name: string;
|
|
52
|
-
type: string;
|
|
53
|
-
elementValues?: AnnotationElementValue[];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type ReferencedType = ReferenceObjectType | ListObjectType | SetObjectType | MapObjectType | GenericObjectType;
|
|
57
|
-
|
|
58
|
-
export interface ReferenceObjectType {
|
|
59
|
-
type: string;
|
|
60
|
-
rawDeclaration: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface ListObjectType extends ReferenceObjectType {
|
|
64
|
-
ofType: ReferenceObjectType;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface SetObjectType extends ReferenceObjectType {
|
|
68
|
-
ofType: ReferenceObjectType;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface MapObjectType extends ReferenceObjectType {
|
|
72
|
-
keyType: ReferenceObjectType;
|
|
73
|
-
valueType: ReferenceObjectType;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface GenericObjectType extends ReferenceObjectType {
|
|
77
|
-
ofType: ReferenceObjectType;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface EnumValue {
|
|
81
|
-
name: string;
|
|
82
|
-
docComment?: DocComment;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface ParameterMirror {
|
|
86
|
-
memberModifiers: string[];
|
|
87
|
-
name: string;
|
|
88
|
-
typeReference: ReferencedType;
|
|
89
|
-
docComment?: DocComment;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface MethodMirror {
|
|
93
|
-
access_modifier: string;
|
|
94
|
-
annotations: Annotation[];
|
|
95
|
-
name: string;
|
|
96
|
-
memberModifiers: string[];
|
|
97
|
-
typeReference: ReferencedType;
|
|
98
|
-
parameters: ParameterMirror[];
|
|
99
|
-
docComment?: DocComment;
|
|
100
|
-
group?: string;
|
|
101
|
-
groupDescription?: string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface PropertyMirror {
|
|
105
|
-
access_modifier: string;
|
|
106
|
-
annotations: Annotation[];
|
|
107
|
-
name: string;
|
|
108
|
-
memberModifiers: string[];
|
|
109
|
-
typeReference: ReferencedType;
|
|
110
|
-
docComment?: DocComment;
|
|
111
|
-
group?: string;
|
|
112
|
-
groupDescription?: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface FieldMirror {
|
|
116
|
-
access_modifier: string;
|
|
117
|
-
annotations: Annotation[];
|
|
118
|
-
name: string;
|
|
119
|
-
memberModifiers: string[];
|
|
120
|
-
typeReference: ReferencedType;
|
|
121
|
-
docComment?: DocComment;
|
|
122
|
-
group?: string;
|
|
123
|
-
groupDescription?: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface ConstructorMirror {
|
|
127
|
-
access_modifier: string;
|
|
128
|
-
annotations: Annotation[];
|
|
129
|
-
parameters: ParameterMirror[];
|
|
130
|
-
docComment?: DocComment;
|
|
131
|
-
group?: string;
|
|
132
|
-
groupDescription?: string;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface ReflectionResult {
|
|
136
|
-
typeMirror?: Type;
|
|
137
|
-
error?: ParsingError;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface ParsingError {
|
|
141
|
-
message: string;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Types
|
|
145
|
-
|
|
146
|
-
type TypeName = 'class' | 'interface' | 'enum';
|
|
147
|
-
export type Type = InterfaceMirror | ClassMirror | EnumMirror;
|
|
148
|
-
|
|
149
|
-
export interface EnumMirror {
|
|
150
|
-
annotations: Annotation[];
|
|
151
|
-
name: string;
|
|
152
|
-
type_name: TypeName;
|
|
153
|
-
access_modifier: string;
|
|
154
|
-
docComment?: DocComment;
|
|
155
|
-
group?: string;
|
|
156
|
-
groupDescription?: string;
|
|
157
|
-
values: EnumValue[];
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export interface InterfaceMirror {
|
|
161
|
-
annotations: Annotation[];
|
|
162
|
-
name: string;
|
|
163
|
-
type_name: TypeName;
|
|
164
|
-
methods: MethodMirror[];
|
|
165
|
-
extended_interfaces: string[];
|
|
166
|
-
access_modifier: string;
|
|
167
|
-
docComment?: DocComment;
|
|
168
|
-
sharingModifier?: string;
|
|
169
|
-
group?: string;
|
|
170
|
-
groupDescription?: string;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export interface ClassMirror {
|
|
174
|
-
annotations: Annotation[];
|
|
175
|
-
name: string;
|
|
176
|
-
type_name: TypeName;
|
|
177
|
-
methods: MethodMirror[];
|
|
178
|
-
sharingModifier?: string;
|
|
179
|
-
classModifier?: string;
|
|
180
|
-
extended_class?: string;
|
|
181
|
-
implemented_interfaces: string[];
|
|
182
|
-
properties: PropertyMirror[];
|
|
183
|
-
fields: FieldMirror[];
|
|
184
|
-
constructors: ConstructorMirror[];
|
|
185
|
-
enums: EnumMirror[];
|
|
186
|
-
interfaces: InterfaceMirror[];
|
|
187
|
-
classes: ClassMirror[];
|
|
188
|
-
access_modifier: string;
|
|
189
|
-
docComment?: DocComment;
|
|
190
|
-
group?: string;
|
|
191
|
-
groupDescription?: string;
|
|
192
|
-
}
|
package/jest.config.js
DELETED