@cparra/apex-reflection 1.11.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -39,10 +39,25 @@ export interface Annotation {
39
39
  type: string;
40
40
  elementValues?: AnnotationElementValue[];
41
41
  }
42
+ export declare type ReferencedType = ReferenceObjectType | ListObjectType | SetObjectType | MapObjectType;
43
+ export interface ReferenceObjectType {
44
+ type: string;
45
+ rawDeclaration: string;
46
+ }
47
+ export interface ListObjectType extends ReferenceObjectType {
48
+ ofType: ReferenceObjectType;
49
+ }
50
+ export interface SetObjectType extends ReferenceObjectType {
51
+ ofType: ReferenceObjectType;
52
+ }
53
+ export interface MapObjectType extends ReferenceObjectType {
54
+ keyType: ReferenceObjectType;
55
+ valueType: ReferenceObjectType;
56
+ }
42
57
  export interface ParameterMirror {
43
58
  memberModifiers: string[];
44
59
  name: string;
45
- type: string;
60
+ typeReference: ReferencedType;
46
61
  docComment?: DocComment;
47
62
  }
48
63
  export interface MethodMirror {
@@ -50,7 +65,7 @@ export interface MethodMirror {
50
65
  annotations: Annotation[];
51
66
  name: string;
52
67
  memberModifiers: string[];
53
- type: string;
68
+ typeReference: ReferencedType;
54
69
  parameters: ParameterMirror[];
55
70
  docComment?: DocComment;
56
71
  group?: string;
@@ -60,7 +75,7 @@ export interface PropertyMirror {
60
75
  annotations: Annotation[];
61
76
  name: string;
62
77
  memberModifiers: string[];
63
- type: string;
78
+ typeReference: ReferencedType;
64
79
  docComment?: DocComment;
65
80
  group?: string;
66
81
  }
@@ -69,7 +84,7 @@ export interface FieldMirror {
69
84
  annotations: Annotation[];
70
85
  name: string;
71
86
  memberModifiers: string[];
72
- type: string;
87
+ typeReference: ReferencedType;
73
88
  docComment?: DocComment;
74
89
  group?: string;
75
90
  }
package/index.ts CHANGED
@@ -1,110 +1,130 @@
1
1
  const lib = require('./out');
2
2
 
3
3
  export function reflect(declarationBody: string): ReflectionResult {
4
- return JSON.parse(lib.reflect(declarationBody)) as ReflectionResult;
4
+ return JSON.parse(lib.reflect(declarationBody)) as ReflectionResult;
5
5
  }
6
6
 
7
7
  export interface ParamAnnotation {
8
- bodyLines: string[];
9
- paramName: string;
8
+ bodyLines: string[];
9
+ paramName: string;
10
10
  }
11
11
 
12
12
  export interface ReturnAnnotation {
13
- bodyLines: string[];
13
+ bodyLines: string[];
14
14
  }
15
15
 
16
16
  export interface ExampleAnnotation {
17
- bodyLines: string[];
17
+ bodyLines: string[];
18
18
  }
19
19
 
20
20
  export interface ThrowsAnnotation {
21
- bodyLines: string[];
22
- exceptionName: string;
21
+ bodyLines: string[];
22
+ exceptionName: string;
23
23
  }
24
24
 
25
25
  export interface DocCommentAnnotation {
26
- name: string;
27
- bodyLines: string[];
28
- body: string;
26
+ name: string;
27
+ bodyLines: string[];
28
+ body: string;
29
29
  }
30
30
 
31
31
  export interface DocComment {
32
- rawDeclaration?: string;
33
- paramAnnotations: ParamAnnotation[];
34
- returnAnnotation: ReturnAnnotation;
35
- exampleAnnotation: ExampleAnnotation;
36
- throwsAnnotations: ThrowsAnnotation[];
37
- annotations: DocCommentAnnotation[];
38
- descriptionLines: string[];
39
- description: string;
40
- error?: string;
32
+ rawDeclaration?: string;
33
+ paramAnnotations: ParamAnnotation[];
34
+ returnAnnotation: ReturnAnnotation;
35
+ exampleAnnotation: ExampleAnnotation;
36
+ throwsAnnotations: ThrowsAnnotation[];
37
+ annotations: DocCommentAnnotation[];
38
+ descriptionLines: string[];
39
+ description: string;
40
+ error?: string;
41
41
  }
42
42
 
43
43
  export interface AnnotationElementValue {
44
- key: string;
45
- value: string;
44
+ key: string;
45
+ value: string;
46
46
  }
47
47
 
48
48
  export interface Annotation {
49
- rawDeclaration: string;
50
- name: string;
51
- type: string;
52
- elementValues?: AnnotationElementValue[];
49
+ rawDeclaration: string;
50
+ name: string;
51
+ type: string;
52
+ elementValues?: AnnotationElementValue[];
53
+ }
54
+
55
+ export type ReferencedType = ReferenceObjectType | ListObjectType | SetObjectType | MapObjectType;
56
+
57
+ export interface ReferenceObjectType {
58
+ type: string;
59
+ rawDeclaration: string;
60
+ }
61
+
62
+ export interface ListObjectType extends ReferenceObjectType {
63
+ ofType: ReferenceObjectType;
64
+ }
65
+
66
+ export interface SetObjectType extends ReferenceObjectType {
67
+ ofType: ReferenceObjectType;
68
+ }
69
+
70
+ export interface MapObjectType extends ReferenceObjectType {
71
+ keyType: ReferenceObjectType;
72
+ valueType: ReferenceObjectType;
53
73
  }
54
74
 
55
75
  export interface ParameterMirror {
56
- memberModifiers: string[];
57
- name: string;
58
- type: string;
59
- docComment?: DocComment;
76
+ memberModifiers: string[];
77
+ name: string;
78
+ typeReference: ReferencedType;
79
+ docComment?: DocComment;
60
80
  }
61
81
 
62
82
  export interface MethodMirror {
63
- access_modifier: string;
64
- annotations: Annotation[];
65
- name: string;
66
- memberModifiers: string[];
67
- type: string;
68
- parameters: ParameterMirror[];
69
- docComment?: DocComment;
70
- group?: string;
83
+ access_modifier: string;
84
+ annotations: Annotation[];
85
+ name: string;
86
+ memberModifiers: string[];
87
+ typeReference: ReferencedType;
88
+ parameters: ParameterMirror[];
89
+ docComment?: DocComment;
90
+ group?: string;
71
91
  }
72
92
 
73
93
  export interface PropertyMirror {
74
- access_modifier: string;
75
- annotations: Annotation[];
76
- name: string;
77
- memberModifiers: string[];
78
- type: string;
79
- docComment?: DocComment;
80
- group?: string;
94
+ access_modifier: string;
95
+ annotations: Annotation[];
96
+ name: string;
97
+ memberModifiers: string[];
98
+ typeReference: ReferencedType;
99
+ docComment?: DocComment;
100
+ group?: string;
81
101
  }
82
102
 
83
103
  export interface FieldMirror {
84
- access_modifier: string;
85
- annotations: Annotation[];
86
- name: string;
87
- memberModifiers: string[];
88
- type: string;
89
- docComment?: DocComment;
90
- group?: string;
104
+ access_modifier: string;
105
+ annotations: Annotation[];
106
+ name: string;
107
+ memberModifiers: string[];
108
+ typeReference: ReferencedType;
109
+ docComment?: DocComment;
110
+ group?: string;
91
111
  }
92
112
 
93
113
  export interface ConstructorMirror {
94
- access_modifier: string;
95
- annotations: Annotation[];
96
- parameters: ParameterMirror[];
97
- docComment?: DocComment;
98
- group?: string;
114
+ access_modifier: string;
115
+ annotations: Annotation[];
116
+ parameters: ParameterMirror[];
117
+ docComment?: DocComment;
118
+ group?: string;
99
119
  }
100
120
 
101
121
  export interface ReflectionResult {
102
- typeMirror?: Type;
103
- error?: ParsingError;
122
+ typeMirror?: Type;
123
+ error?: ParsingError;
104
124
  }
105
125
 
106
126
  export interface ParsingError {
107
- message: string;
127
+ message: string;
108
128
  }
109
129
 
110
130
  // Types
@@ -113,42 +133,42 @@ type TypeName = 'class' | 'interface' | 'enum';
113
133
  export type Type = InterfaceMirror | ClassMirror | EnumMirror;
114
134
 
115
135
  export interface EnumMirror {
116
- annotations: Annotation[];
117
- name: string;
118
- type_name: TypeName;
119
- access_modifier: string;
120
- docComment?: DocComment;
121
- group?: string;
136
+ annotations: Annotation[];
137
+ name: string;
138
+ type_name: TypeName;
139
+ access_modifier: string;
140
+ docComment?: DocComment;
141
+ group?: string;
122
142
  }
123
143
 
124
144
  export interface InterfaceMirror {
125
- annotations: Annotation[];
126
- name: string;
127
- type_name: TypeName;
128
- methods: MethodMirror[];
129
- extended_interfaces: string[];
130
- access_modifier: string;
131
- docComment?: DocComment;
132
- sharingModifier?: string;
133
- group?: string;
145
+ annotations: Annotation[];
146
+ name: string;
147
+ type_name: TypeName;
148
+ methods: MethodMirror[];
149
+ extended_interfaces: string[];
150
+ access_modifier: string;
151
+ docComment?: DocComment;
152
+ sharingModifier?: string;
153
+ group?: string;
134
154
  }
135
155
 
136
156
  export interface ClassMirror {
137
- annotations: Annotation[];
138
- name: string;
139
- type_name: TypeName;
140
- methods: MethodMirror[];
141
- sharingModifier?: string;
142
- classModifier?: string;
143
- extended_class?: string;
144
- implemented_interfaces: string[];
145
- properties: PropertyMirror[];
146
- fields: FieldMirror[];
147
- constructors: ConstructorMirror[];
148
- enums: EnumMirror[];
149
- interfaces: InterfaceMirror[];
150
- classes: ClassMirror[];
151
- access_modifier: string;
152
- docComment?: DocComment;
153
- group?: string;
157
+ annotations: Annotation[];
158
+ name: string;
159
+ type_name: TypeName;
160
+ methods: MethodMirror[];
161
+ sharingModifier?: string;
162
+ classModifier?: string;
163
+ extended_class?: string;
164
+ implemented_interfaces: string[];
165
+ properties: PropertyMirror[];
166
+ fields: FieldMirror[];
167
+ constructors: ConstructorMirror[];
168
+ enums: EnumMirror[];
169
+ interfaces: InterfaceMirror[];
170
+ classes: ClassMirror[];
171
+ access_modifier: string;
172
+ docComment?: DocComment;
173
+ group?: string;
154
174
  }