@cparra/apexdocs 2.7.0 → 2.8.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/docs/Main/SampleClass.md +5 -5
- package/docs/Misc-Group/AnotherInterface.md +1 -0
- package/docs/Misc-Group/ChildClass.md +78 -0
- package/docs/Misc-Group/GrandparentClass.md +13 -0
- package/docs/Misc-Group/InterfaceWithInheritance.md +33 -0
- package/docs/Misc-Group/ParentClass.md +37 -0
- package/docs/README.md +19 -4
- package/examples/force-app/main/default/classes/AnotherInterface.cls +1 -0
- package/examples/force-app/main/default/classes/ChildClass.cls +24 -0
- package/examples/force-app/main/default/classes/GrandparentClass.cls +5 -0
- package/examples/force-app/main/default/classes/InterfaceWithInheritance.cls +1 -0
- package/examples/force-app/main/default/classes/ParentClass.cls +16 -0
- package/lib/model/inheritance.d.ts +8 -0
- package/lib/model/inheritance.js +3 -0
- package/lib/model/inheritance.js.map +1 -0
- package/lib/model/markdown-file.d.ts +1 -0
- package/lib/model/markdown-file.js +3 -0
- package/lib/model/markdown-file.js.map +1 -1
- package/lib/model/markdown-generation-util/field-declaration-util.d.ts +2 -2
- package/lib/model/markdown-generation-util/field-declaration-util.js +4 -1
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/method-declaration-util.d.ts +3 -2
- package/lib/model/markdown-generation-util/method-declaration-util.js +9 -0
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/type-declaration-util.js +60 -0
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -1
- package/lib/model/markdown-type-file.d.ts +4 -3
- package/lib/model/markdown-type-file.js.map +1 -1
- package/lib/service/parser.d.ts +12 -1
- package/lib/service/parser.js +102 -1
- package/lib/service/parser.js.map +1 -1
- package/package.json +2 -2
- package/src/model/inheritance.ts +7 -0
- package/src/model/markdown-file.ts +4 -0
- package/src/model/markdown-generation-util/field-declaration-util.ts +9 -4
- package/src/model/markdown-generation-util/method-declaration-util.ts +28 -10
- package/src/model/markdown-generation-util/type-declaration-util.ts +70 -1
- package/src/model/markdown-type-file.ts +11 -7
- package/src/service/parser.ts +144 -2
package/docs/Main/SampleClass.md
CHANGED
|
@@ -66,17 +66,17 @@ Constructs a SampleClass with an argument.
|
|
|
66
66
|
## Fields
|
|
67
67
|
### Common Constants
|
|
68
68
|
|
|
69
|
-
* `ANOTHER_CONSTANT` → `String`
|
|
70
|
-
* `A_CONSTANT` → `String` [`NAMESPACEACCESSIBLE` ] - This is a constant.
|
|
69
|
+
* `ANOTHER_CONSTANT` → `String` (*Inherited*)
|
|
70
|
+
* `A_CONSTANT` → `String` (*Inherited*) [`NAMESPACEACCESSIBLE` ] - This is a constant.
|
|
71
71
|
---
|
|
72
72
|
### 'General' Constants
|
|
73
73
|
|
|
74
|
-
* `GENERAL_ANOTHER_CONSTANT` → `String`
|
|
75
|
-
* `GENERAL_A_CONSTANT` → `String` [`NAMESPACEACCESSIBLE` ] - This is a constant.
|
|
74
|
+
* `GENERAL_ANOTHER_CONSTANT` → `String` (*Inherited*)
|
|
75
|
+
* `GENERAL_A_CONSTANT` → `String` (*Inherited*) [`NAMESPACEACCESSIBLE` ] - This is a constant.
|
|
76
76
|
---
|
|
77
77
|
### Other variables
|
|
78
78
|
|
|
79
|
-
* `someVariable` → `String`
|
|
79
|
+
* `someVariable` → `String` (*Inherited*)
|
|
80
80
|
---
|
|
81
81
|
## Properties
|
|
82
82
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# AnotherInterface
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# ChildClass
|
|
2
|
+
|
|
3
|
+
**Inheritance**
|
|
4
|
+
|
|
5
|
+
[GrandparentClass](/Misc-Group/GrandparentClass.md)
|
|
6
|
+
>
|
|
7
|
+
[ParentClass](/Misc-Group/ParentClass.md)
|
|
8
|
+
>
|
|
9
|
+
ChildClass
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
**Implemented types**
|
|
13
|
+
|
|
14
|
+
[SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
15
|
+
|
|
16
|
+
## Fields
|
|
17
|
+
|
|
18
|
+
### `protectedGrandParentField` → `String`
|
|
19
|
+
|
|
20
|
+
*Inherited*
|
|
21
|
+
|
|
22
|
+
### `protectedString` → `String`
|
|
23
|
+
|
|
24
|
+
*Inherited*
|
|
25
|
+
|
|
26
|
+
This is a protected string, use carefully.
|
|
27
|
+
|
|
28
|
+
### `publicString` → `String`
|
|
29
|
+
|
|
30
|
+
*Inherited*
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
## Properties
|
|
34
|
+
|
|
35
|
+
### `AProp` → `String`
|
|
36
|
+
|
|
37
|
+
*Inherited*
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
## Methods
|
|
41
|
+
### `doSomething()`
|
|
42
|
+
### `override overridableMethodOverridden()`
|
|
43
|
+
|
|
44
|
+
This method was overridden.
|
|
45
|
+
|
|
46
|
+
#### Return
|
|
47
|
+
|
|
48
|
+
**Type**
|
|
49
|
+
|
|
50
|
+
String
|
|
51
|
+
|
|
52
|
+
**Description**
|
|
53
|
+
|
|
54
|
+
A String.
|
|
55
|
+
|
|
56
|
+
### `execute()`
|
|
57
|
+
|
|
58
|
+
Executes the command.
|
|
59
|
+
|
|
60
|
+
### `getValue()`
|
|
61
|
+
|
|
62
|
+
Returns a value based on the executed command.
|
|
63
|
+
|
|
64
|
+
#### Return
|
|
65
|
+
|
|
66
|
+
**Type**
|
|
67
|
+
|
|
68
|
+
String
|
|
69
|
+
|
|
70
|
+
**Description**
|
|
71
|
+
|
|
72
|
+
The value
|
|
73
|
+
|
|
74
|
+
### `overridableMethod()`
|
|
75
|
+
|
|
76
|
+
*Inherited*
|
|
77
|
+
|
|
78
|
+
---
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# InterfaceWithInheritance
|
|
2
|
+
|
|
3
|
+
**Extended types**
|
|
4
|
+
|
|
5
|
+
[SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
6
|
+
,
|
|
7
|
+
[AnotherInterface](/Misc-Group/AnotherInterface.md)
|
|
8
|
+
## Methods
|
|
9
|
+
### `execute()`
|
|
10
|
+
|
|
11
|
+
*Inherited*
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Executes the command.
|
|
15
|
+
|
|
16
|
+
### `getValue()`
|
|
17
|
+
|
|
18
|
+
*Inherited*
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Returns a value based on the executed command.
|
|
22
|
+
|
|
23
|
+
#### Return
|
|
24
|
+
|
|
25
|
+
**Type**
|
|
26
|
+
|
|
27
|
+
String
|
|
28
|
+
|
|
29
|
+
**Description**
|
|
30
|
+
|
|
31
|
+
The value
|
|
32
|
+
|
|
33
|
+
---
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ParentClass
|
|
2
|
+
|
|
3
|
+
**Inheritance**
|
|
4
|
+
|
|
5
|
+
[GrandparentClass](/Misc-Group/GrandparentClass.md)
|
|
6
|
+
>
|
|
7
|
+
ParentClass
|
|
8
|
+
|
|
9
|
+
## Fields
|
|
10
|
+
|
|
11
|
+
### `privateString` → `String`
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### `protectedGrandParentField` → `String`
|
|
15
|
+
|
|
16
|
+
*Inherited*
|
|
17
|
+
|
|
18
|
+
### `protectedString` → `String`
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
This is a protected string, use carefully.
|
|
22
|
+
|
|
23
|
+
### `publicString` → `String`
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
### `AProp` → `String`
|
|
30
|
+
|
|
31
|
+
*Inherited*
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
## Methods
|
|
35
|
+
### `overridableMethod()`
|
|
36
|
+
### `overridableMethodOverridden()`
|
|
37
|
+
---
|
package/docs/README.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
# Classes
|
|
2
|
+
## Misc Group
|
|
3
|
+
|
|
4
|
+
### [AnotherInterface](/Misc-Group/AnotherInterface.md)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### [ChildClass](/Misc-Group/ChildClass.md)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### [GrandparentClass](/Misc-Group/GrandparentClass.md)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### [InterfaceWithInheritance](/Misc-Group/InterfaceWithInheritance.md)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### [ParentClass](/Misc-Group/ParentClass.md)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### [SampleClassWithoutModifier](/Misc-Group/SampleClassWithoutModifier.md)
|
|
20
|
+
|
|
2
21
|
## Main
|
|
3
22
|
|
|
4
23
|
### [GroupedClass](/Main/GroupedClass.md)
|
|
@@ -14,10 +33,6 @@ This is a class description. This class relates to [SampleInterface](/Sample-Int
|
|
|
14
33
|
You can also link using this syntax [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
15
34
|
|
|
16
35
|
|
|
17
|
-
## Misc Group
|
|
18
|
-
|
|
19
|
-
### [SampleClassWithoutModifier](/Misc-Group/SampleClassWithoutModifier.md)
|
|
20
|
-
|
|
21
36
|
## Sample Interfaces
|
|
22
37
|
|
|
23
38
|
### [SampleInterface](/Sample-Interfaces/SampleInterface.md)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
public interface AnotherInterface{}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
public class ChildClass extends ParentClass implements SampleInterface {
|
|
2
|
+
public void doSomething() {
|
|
3
|
+
System.debug('Do something');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description This method was overridden.
|
|
8
|
+
* @return A String.
|
|
9
|
+
*/
|
|
10
|
+
public override String overridableMethodOverridden() {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description Executes the command.
|
|
16
|
+
*/
|
|
17
|
+
public void execute();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description Returns a value based on the executed command.
|
|
21
|
+
* @return The value
|
|
22
|
+
*/
|
|
23
|
+
public String getValue();
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
public interface InterfaceWithInheritance extends SampleInterface, AnotherInterface {}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
public virtual class ParentClass extends GrandparentClass{
|
|
2
|
+
private String privateString;
|
|
3
|
+
/**
|
|
4
|
+
* @description This is a protected string, use carefully.
|
|
5
|
+
*/
|
|
6
|
+
protected String protectedString;
|
|
7
|
+
public String publicString;
|
|
8
|
+
|
|
9
|
+
public virtual String overridableMethod() {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public virtual String overridableMethodOverridden() {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FieldMirror, MethodMirror, PropertyMirror } from '@cparra/apex-reflection';
|
|
2
|
+
export declare type InheritanceSupport = {
|
|
3
|
+
inherited: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare type FieldMirrorWithInheritance = FieldMirror & InheritanceSupport;
|
|
6
|
+
export declare type PropertyMirrorWithInheritance = PropertyMirror & InheritanceSupport;
|
|
7
|
+
export declare type MethodMirrorWithInheritance = MethodMirror & InheritanceSupport;
|
|
8
|
+
export declare type FieldOrProperty = FieldMirrorWithInheritance | PropertyMirrorWithInheritance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance.js","sourceRoot":"","sources":["../../src/model/inheritance.ts"],"names":[],"mappings":""}
|
|
@@ -3,6 +3,7 @@ export declare class MarkdownFile extends File {
|
|
|
3
3
|
fileExtension(): string;
|
|
4
4
|
addTitle(text: string, level?: number): void;
|
|
5
5
|
addText(text: string, encodeHtml?: boolean): void;
|
|
6
|
+
addLink(text: string, encodeHtml?: boolean): void;
|
|
6
7
|
startCodeBlock(): void;
|
|
7
8
|
endCodeBlock(): void;
|
|
8
9
|
addHorizontalRule(): void;
|
|
@@ -20,6 +20,9 @@ class MarkdownFile extends file_1.File {
|
|
|
20
20
|
addText(text, encodeHtml = true) {
|
|
21
21
|
super.addText(this._replaceInlineReferences(text), encodeHtml);
|
|
22
22
|
}
|
|
23
|
+
addLink(text, encodeHtml = true) {
|
|
24
|
+
this.addText(`\{@link ${text}\}`, encodeHtml);
|
|
25
|
+
}
|
|
23
26
|
startCodeBlock() {
|
|
24
27
|
this.addText('```apex');
|
|
25
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-file.js","sourceRoot":"","sources":["../../src/model/markdown-file.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,kGAAyF;AAEzF,MAAa,YAAa,SAAQ,WAAI;IACpC,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,KAAK,GAAG,CAAC;QAC9B,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC9B,KAAK,IAAI,GAAG,CAAC;SACd;QAED,KAAK,IAAI,GAAG,CAAC;QACb,KAAK,IAAI,IAAI,CAAC;QACd,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAEM,OAAO,CAAC,IAAY,EAAE,UAAU,GAAG,IAAI;QAC5C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1B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ACV,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,GAAG;YACD,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9B,IAAI,KAAK,EAAE;gBACT,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACrB;SACF,QAAQ,KAAK,EAAE;QAEhB,KAAK,MAAM,YAAY,IAAI,OAAO,EAAE;YAClC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC,YAAY,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;SACzF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,wBAAwB,CAAC,IAAY;QAC3C,IAAI,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,GAAG,YAAY,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArHD,oCAqHC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { MarkdownFile } from '../markdown-file';
|
|
2
|
-
import {
|
|
3
|
-
export declare function declareField(markdownFile: MarkdownFile, fields:
|
|
2
|
+
import { FieldMirrorWithInheritance, PropertyMirrorWithInheritance } from '../inheritance';
|
|
3
|
+
export declare function declareField(markdownFile: MarkdownFile, fields: FieldMirrorWithInheritance[] | PropertyMirrorWithInheritance[], startingHeadingLevel: number, grouped?: boolean): void;
|
|
@@ -22,6 +22,9 @@ function addFieldSection(markdownFile, mirrorModel, startingHeadingLevel, groupe
|
|
|
22
22
|
if (!grouped) {
|
|
23
23
|
markdownFile.addTitle(`\`${mirrorModel.name}\` → \`${mirrorModel.type}\``, startingHeadingLevel + 2);
|
|
24
24
|
markdownFile.addBlankLine();
|
|
25
|
+
if (mirrorModel.inherited) {
|
|
26
|
+
markdownFile.addText('*Inherited*');
|
|
27
|
+
}
|
|
25
28
|
mirrorModel.annotations.forEach((annotation) => {
|
|
26
29
|
markdownFile.addText(`\`${annotation.type.toUpperCase()}\` `);
|
|
27
30
|
});
|
|
@@ -48,7 +51,7 @@ function addFieldSection(markdownFile, mirrorModel, startingHeadingLevel, groupe
|
|
|
48
51
|
if ((_b = mirrorModel.docComment) === null || _b === void 0 ? void 0 : _b.description) {
|
|
49
52
|
description = ` - ${(_c = mirrorModel.docComment) === null || _c === void 0 ? void 0 : _c.description}`;
|
|
50
53
|
}
|
|
51
|
-
markdownFile.addListItem(`\`${mirrorModel.name}\` → \`${mirrorModel.type}
|
|
54
|
+
markdownFile.addListItem(`\`${mirrorModel.name}\` → \`${mirrorModel.type}\` (*Inherited*) ${annotations} ${description}`);
|
|
52
55
|
markdownFile.addBlankLine();
|
|
53
56
|
}
|
|
54
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/field-declaration-util.ts"],"names":[],"mappings":";;;AAGA,SAAgB,YAAY,CAC1B,YAA0B,EAC1B,
|
|
1
|
+
{"version":3,"file":"field-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/field-declaration-util.ts"],"names":[],"mappings":";;;AAGA,SAAgB,YAAY,CAC1B,YAA0B,EAC1B,MAAsE,EACtE,oBAA4B,EAC5B,OAAO,GAAG,KAAK;IAEf,YAAY,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM;SACH,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACrB,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAAE,OAAO,CAAC,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI;YAAE,OAAO,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;SACD,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;QACzB,eAAe,CAAC,YA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,IAAI,cAAc,EAAE;YAClB,WAAW,IAAI,GAAG,CAAC;SACpB;QAED,gDAAgD;QAChD,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,UAAI,WAAW,CAAC,UAAU,0CAAE,WAAW,EAAE;YACvC,WAAW,GAAG,MAAM,MAAA,WAAW,CAAC,UAAU,0CAAE,WAAW,EAAE,CAAC;SAC3D;QACD,YAAY,CAAC,WAAW,CACtB,KAAK,WAAW,CAAC,IAAI,UAAU,WAAW,CAAC,IAAI,oBAAoB,WAAW,IAAI,WAAW,EAAE,CAChG,CAAC;QACF,YAAY,CAAC,YAAY,EAAE,CAAC;KAC7B;AACH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { ConstructorMirror
|
|
1
|
+
import { ConstructorMirror } from '@cparra/apex-reflection';
|
|
2
2
|
import { MarkdownFile } from '../markdown-file';
|
|
3
|
-
|
|
3
|
+
import { MethodMirrorWithInheritance } from '../inheritance';
|
|
4
|
+
export declare function declareMethod(markdownFile: MarkdownFile, methods: ConstructorMirror[] | MethodMirrorWithInheritance[], startingHeadingLevel: number, className?: string): void;
|
|
@@ -7,6 +7,15 @@ function declareMethod(markdownFile, methods, startingHeadingLevel, className =
|
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const signatureName = isMethod(currentMethod) ? currentMethod.name : className;
|
|
9
9
|
markdownFile.addTitle(`\`${buildSignature(signatureName, currentMethod)}\``, startingHeadingLevel + 2);
|
|
10
|
+
// Inheritance tag
|
|
11
|
+
if (isMethod(currentMethod)) {
|
|
12
|
+
const asMethodMirror = currentMethod;
|
|
13
|
+
if (asMethodMirror.inherited) {
|
|
14
|
+
markdownFile.addBlankLine();
|
|
15
|
+
markdownFile.addText('*Inherited*');
|
|
16
|
+
markdownFile.addBlankLine();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
10
19
|
currentMethod.annotations.forEach((annotation) => {
|
|
11
20
|
markdownFile.addBlankLine();
|
|
12
21
|
markdownFile.addText(`\`${annotation.type.toUpperCase()}\``);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/method-declaration-util.ts"],"names":[],"mappings":";;;AAGA,+EAA+E;
|
|
1
|
+
{"version":3,"file":"method-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/method-declaration-util.ts"],"names":[],"mappings":";;;AAGA,+EAA+E;AAG/E,SAAgB,aAAa,CAC3B,YAA0B,EAC1B,OAA4D,EAC5D,oBAA4B,EAC5B,SAAS,GAAG,EAAE;IAEd,OAAO,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;;QAChC,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAE,aAA6C,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAChH,YAAY,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,CAAC,CAAC,CAAC;QAEvG,kBAAkB;QAClB,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE;YAC3B,MAAM,cAAc,GAAG,aAA4C,CAAC;YACpE,IAAI,cAAc,CAAC,SAAS,EAAE;gBAC5B,YAAY,CAAC,YAAY,EAAE,CAAC;gBAC5B,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;gBACpC,YAAY,CAAC,YAAY,EAAE,CAAC;aAC7B;SACF;QAED,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YAC/C,YAAY,CAAC,YAAY,EAAE,CAAC;YAC5B,YAAY,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,UAAI,aAAa,CAAC,UAAU,0CAAE,WAAW,EAAE;YACzC,YAAY,CAAC,YAAY,EAAE,CAAC;YA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E,OAAQ,MAAsC,CAAC,IAAI,KAAK,SAAS,CAAC;AACpE,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.declareType = void 0;
|
|
4
4
|
const doc_comment_annotation_util_1 = require("./doc-comment-annotation-util");
|
|
5
|
+
const types_repository_1 = require("../types-repository");
|
|
5
6
|
function declareType(markdownFile, typeMirror) {
|
|
6
7
|
var _a;
|
|
7
8
|
typeMirror.annotations.forEach((currentAnnotation) => {
|
|
@@ -15,7 +16,66 @@ function declareType(markdownFile, typeMirror) {
|
|
|
15
16
|
}
|
|
16
17
|
markdownFile.addBlankLine();
|
|
17
18
|
}
|
|
19
|
+
if (typeMirror.type_name === 'class') {
|
|
20
|
+
addInheritanceSectionForClass(typeMirror, markdownFile);
|
|
21
|
+
}
|
|
22
|
+
if (typeMirror.type_name === 'interface') {
|
|
23
|
+
addInheritanceSectionForInterface(typeMirror, markdownFile);
|
|
24
|
+
}
|
|
18
25
|
doc_comment_annotation_util_1.addCustomDocCommentAnnotations(markdownFile, typeMirror);
|
|
19
26
|
}
|
|
20
27
|
exports.declareType = declareType;
|
|
28
|
+
function addInheritanceSectionForClass(typeMirror, markdownFile) {
|
|
29
|
+
const typeAsClass = typeMirror;
|
|
30
|
+
if (typeAsClass.extended_class) {
|
|
31
|
+
markdownFile.addBlankLine();
|
|
32
|
+
markdownFile.addText('**Inheritance**');
|
|
33
|
+
markdownFile.addBlankLine();
|
|
34
|
+
addParent(markdownFile, typeAsClass);
|
|
35
|
+
markdownFile.addText(typeMirror.name);
|
|
36
|
+
markdownFile.addBlankLine();
|
|
37
|
+
}
|
|
38
|
+
if (typeAsClass.implemented_interfaces.length) {
|
|
39
|
+
markdownFile.addBlankLine();
|
|
40
|
+
markdownFile.addText('**Implemented types**');
|
|
41
|
+
markdownFile.addBlankLine();
|
|
42
|
+
for (let i = 0; i < typeAsClass.implemented_interfaces.length; i++) {
|
|
43
|
+
const currentName = typeAsClass.implemented_interfaces[i];
|
|
44
|
+
markdownFile.addLink(currentName);
|
|
45
|
+
if (i < typeAsClass.implemented_interfaces.length - 1) {
|
|
46
|
+
markdownFile.addText(', ');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
markdownFile.addBlankLine();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function addInheritanceSectionForInterface(typeMirror, markdownFile) {
|
|
53
|
+
const typeAsInterface = typeMirror;
|
|
54
|
+
if (typeAsInterface.extended_interfaces.length) {
|
|
55
|
+
markdownFile.addBlankLine();
|
|
56
|
+
markdownFile.addText('**Extended types**');
|
|
57
|
+
markdownFile.addBlankLine();
|
|
58
|
+
for (let i = 0; i < typeAsInterface.extended_interfaces.length; i++) {
|
|
59
|
+
const currentName = typeAsInterface.extended_interfaces[i];
|
|
60
|
+
markdownFile.addLink(currentName);
|
|
61
|
+
if (i < typeAsInterface.extended_interfaces.length - 1) {
|
|
62
|
+
markdownFile.addText(', ');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function addParent(markdownFile, classMirror) {
|
|
68
|
+
if (!classMirror.extended_class) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const parentType = types_repository_1.TypesRepository.getInstance().getByName(classMirror.extended_class);
|
|
72
|
+
if (!parentType) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (parentType.type_name === 'class') {
|
|
76
|
+
addParent(markdownFile, parentType);
|
|
77
|
+
}
|
|
78
|
+
markdownFile.addLink(parentType.name);
|
|
79
|
+
markdownFile.addText(' > ');
|
|
80
|
+
}
|
|
21
81
|
//# sourceMappingURL=type-declaration-util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/type-declaration-util.ts"],"names":[],"mappings":";;;AACA,+EAA+E;
|
|
1
|
+
{"version":3,"file":"type-declaration-util.js","sourceRoot":"","sources":["../../../src/model/markdown-generation-util/type-declaration-util.ts"],"names":[],"mappings":";;;AACA,+EAA+E;AAE/E,0DAAsD;AAEtD,SAAgB,WAAW,CAAC,YAA0B,EAAE,UAAgB;;IACtE,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,iBAA6B,EAAE,EAAE;QAC/D,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,KAAK,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,UAAI,UAAU,CAAC,UAAU,0CAAE,gBAAgB,EAAE;QAC3C,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,KAAK,MAAM,WAAW,IAAI,UAAU,CAAC,UAAU,CAAC,gBAAgB,EAAE;YAChE,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;SACnC;QACD,YAAY,CAAC,YAAY,EAAE,CAAC;KAC7B;IAED,IAAI,UAAU,CAAC,SAAS,KAAK,OAAO,EAAE;QACpC,6BAA6B,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;KACzD;IAED,IAAI,UAAU,CAAC,SAAS,KAAK,WAAW,EAAE;QACxC,iCAAiC,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;KAC7D;IAED,4DAA8B,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC;AAvBD,kCAuBC;AAED,SAAS,6BAA6B,CAAC,UAAgB,EAAE,YAA0B;IACjF,MAAM,WAAW,GAAG,UAAyB,CAAC;IAC9C,IAAI,WAAW,CAAC,cAAc,EAAE;QAC9B,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,YAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACxC,YAAY,CAAC,YAAY,EAAE,CAAC;QAC5B,SAAS,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACrC,YAAY,C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AAG,CAAC,EAAE;gBACtD,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAC5B;SACF;KACF;AACH,CAAC;AAED,SAAS,SAAS,CAAC,YAA0B,EAAE,WAAwB;IACrE,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE;QAC/B,OAAO;KACR;IAED,MAAM,UAAU,GAAG,kCAAe,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACvF,IAAI,CAAC,UAAU,EAAE;QACf,OAAO;KACR;IAED,IAAI,UAAU,CAAC,SAAS,KAAK,OAAO,EAAE;QACpC,SAAS,CAAC,YAAY,EAAE,UAAyB,CAAC,CAAC;KACpD;IAED,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ClassMirror, ConstructorMirror, EnumMirror,
|
|
1
|
+
import { ClassMirror, ConstructorMirror, EnumMirror, InterfaceMirror, MethodMirror, Type } from '@cparra/apex-reflection';
|
|
2
2
|
import { WalkerListener } from '../service/walkers/walker';
|
|
3
3
|
import { MarkdownFile } from './markdown-file';
|
|
4
|
+
import { FieldMirrorWithInheritance, PropertyMirrorWithInheritance } from './inheritance';
|
|
4
5
|
export declare class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
5
6
|
type: Type;
|
|
6
7
|
headingLevel: number;
|
|
7
8
|
constructor(type: Type, headingLevel?: number, headerContent?: string);
|
|
8
9
|
onTypeDeclaration(typeMirror: Type): void;
|
|
9
10
|
onConstructorDeclaration(className: string, constructors: ConstructorMirror[]): void;
|
|
10
|
-
onFieldsDeclaration(fields:
|
|
11
|
-
onPropertiesDeclaration(properties:
|
|
11
|
+
onFieldsDeclaration(fields: FieldMirrorWithInheritance[]): void;
|
|
12
|
+
onPropertiesDeclaration(properties: PropertyMirrorWithInheritance[]): void;
|
|
12
13
|
onMethodsDeclaration(methods: MethodMirror[]): void;
|
|
13
14
|
onInnerEnumsDeclaration(enums: EnumMirror[]): void;
|
|
14
15
|
onInnerClassesDeclaration(classes: ClassMirror[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-type-file.js","sourceRoot":"","sources":["../../src/model/markdown-type-file.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"markdown-type-file.js","sourceRoot":"","sources":["../../src/model/markdown-type-file.ts"],"names":[],"mappings":";;;AAQA,sEAAkE;AAElE,mDAA+C;AAC/C,yEAAsF;AACtF,kGAAyF;AAWzF,MAAa,gBAAiB,SAAQ,4BAAY;IAChD,YAAmB,IAAU,EAAS,eAAuB,CAAC,EAAE,aAAsB;QACpF,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,oCAAwB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;QADvD,SAAI,GAAJ,IAAI,CAAM;QAAS,iBAAY,GAAZ,YAAY,CAAY;QAE5D,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;SAC7B;QACD,MAAM,MAAM,GAAG,8BAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAEM,iBAAiB,CAAC,UAAgB;QACvC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAClD,sCAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAChC,CAAC;IAEM,wBAAwB,CAAC,SAAiB,EAAE,YAAiC;QAClF,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,0BAA0B,CAAC,YAAY,EAAE,SAAS,CAAC,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1,21 @@
|
|
|
1
|
-
import { Type, ReflectionResult } from '@cparra/apex-reflection';
|
|
1
|
+
import { Type, ReflectionResult, ClassMirror, InterfaceMirror } from '@cparra/apex-reflection';
|
|
2
2
|
import ApexBundle from '../model/apex-bundle';
|
|
3
3
|
export interface TypeParser {
|
|
4
4
|
parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[];
|
|
5
5
|
}
|
|
6
|
+
declare type NameAware = {
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
6
9
|
export declare class RawBodyParser implements TypeParser {
|
|
7
10
|
typeBundles: ApexBundle[];
|
|
8
11
|
constructor(typeBundles: ApexBundle[]);
|
|
9
12
|
parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[];
|
|
13
|
+
addFieldsFromParent(types: Type[]): Type[];
|
|
14
|
+
addMembersFromParent(currentClass: ClassMirror, allTypes: Type[]): ClassMirror;
|
|
15
|
+
addMethodsFromParent(currentInterface: InterfaceMirror, allTypes: Type[]): InterfaceMirror;
|
|
16
|
+
private getInheritedFields;
|
|
17
|
+
private getInheritedProperties;
|
|
18
|
+
private getInheritedMethods;
|
|
19
|
+
memberExists(members: NameAware[], fieldName: string): boolean;
|
|
10
20
|
}
|
|
21
|
+
export {};
|
package/lib/service/parser.js
CHANGED
|
@@ -8,7 +8,7 @@ class RawBodyParser {
|
|
|
8
8
|
this.typeBundles = typeBundles;
|
|
9
9
|
}
|
|
10
10
|
parse(reflect) {
|
|
11
|
-
|
|
11
|
+
const types = this.typeBundles
|
|
12
12
|
.map((currentBundle) => {
|
|
13
13
|
logger_1.Logger.log(`Parsing file: ${currentBundle.filePath}`);
|
|
14
14
|
const result = reflect(currentBundle);
|
|
@@ -30,6 +30,107 @@ class RawBodyParser {
|
|
|
30
30
|
return reflectionResult.typeMirror;
|
|
31
31
|
})
|
|
32
32
|
.map((reflectionResult) => reflectionResult.typeMirror);
|
|
33
|
+
return this.addFieldsFromParent(types);
|
|
34
|
+
}
|
|
35
|
+
addFieldsFromParent(types) {
|
|
36
|
+
const typesWithFields = [];
|
|
37
|
+
for (const currentType of types) {
|
|
38
|
+
if (currentType.type_name !== 'class' && currentType.type_name !== 'interface') {
|
|
39
|
+
typesWithFields.push(currentType);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (currentType.type_name === 'class') {
|
|
43
|
+
let typeAsClass = currentType;
|
|
44
|
+
if (!typeAsClass.extended_class) {
|
|
45
|
+
typesWithFields.push(currentType);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
typeAsClass = this.addMembersFromParent(typeAsClass, types);
|
|
49
|
+
typesWithFields.push(typeAsClass);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
// If reaching here then we are dealing with an interface
|
|
53
|
+
let typeAsInterface = currentType;
|
|
54
|
+
if (!typeAsInterface.extended_interfaces.length) {
|
|
55
|
+
typesWithFields.push(currentType);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
typeAsInterface = this.addMethodsFromParent(typeAsInterface, types);
|
|
59
|
+
typesWithFields.push(typeAsInterface);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
return typesWithFields;
|
|
63
|
+
}
|
|
64
|
+
addMembersFromParent(currentClass, allTypes) {
|
|
65
|
+
if (!currentClass.extended_class) {
|
|
66
|
+
return currentClass;
|
|
67
|
+
}
|
|
68
|
+
const parent = allTypes.find((currentType) => currentType.name === currentClass.extended_class);
|
|
69
|
+
if (!parent || parent.type_name !== 'class') {
|
|
70
|
+
return currentClass;
|
|
71
|
+
}
|
|
72
|
+
let parentAsClass = parent;
|
|
73
|
+
if (parentAsClass.extended_class) {
|
|
74
|
+
parentAsClass = this.addMembersFromParent(parentAsClass, allTypes);
|
|
75
|
+
}
|
|
76
|
+
currentClass.fields = [...currentClass.fields, ...this.getInheritedFields(parentAsClass, currentClass)];
|
|
77
|
+
currentClass.properties = [...currentClass.properties, ...this.getInheritedProperties(parentAsClass, currentClass)];
|
|
78
|
+
currentClass.methods = [...currentClass.methods, ...this.getInheritedMethods(parentAsClass, currentClass)];
|
|
79
|
+
return currentClass;
|
|
80
|
+
}
|
|
81
|
+
addMethodsFromParent(currentInterface, allTypes) {
|
|
82
|
+
if (!currentInterface.extended_interfaces.length) {
|
|
83
|
+
return currentInterface;
|
|
84
|
+
}
|
|
85
|
+
const parents = [];
|
|
86
|
+
for (const currentInterfaceName of currentInterface.extended_interfaces) {
|
|
87
|
+
const parent = allTypes.find((currentType) => currentType.name === currentInterfaceName);
|
|
88
|
+
if (parent) {
|
|
89
|
+
parents.push(parent);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (const parent of parents) {
|
|
93
|
+
let parentAsInterface = parent;
|
|
94
|
+
if (parentAsInterface.extended_interfaces.length) {
|
|
95
|
+
parentAsInterface = this.addMethodsFromParent(parentAsInterface, allTypes);
|
|
96
|
+
}
|
|
97
|
+
currentInterface.methods = [
|
|
98
|
+
...currentInterface.methods,
|
|
99
|
+
...this.getInheritedMethods(parentAsInterface, currentInterface),
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
return currentInterface;
|
|
103
|
+
}
|
|
104
|
+
getInheritedFields(parentAsClass, currentClass) {
|
|
105
|
+
const parentFields = parentAsClass.fields
|
|
106
|
+
// Filter out private fields
|
|
107
|
+
.filter((currentField) => currentField.access_modifier.toLowerCase() !== 'private')
|
|
108
|
+
// Filter out fields that also exist on the child
|
|
109
|
+
.filter((currentField) => !this.memberExists(currentClass.fields, currentField.name))
|
|
110
|
+
.map((currentField) => (Object.assign(Object.assign({}, currentField), { inherited: true })));
|
|
111
|
+
return parentFields;
|
|
112
|
+
}
|
|
113
|
+
getInheritedProperties(parentAsClass, currentClass) {
|
|
114
|
+
const parentProperties = parentAsClass.properties
|
|
115
|
+
// Filter out private properties
|
|
116
|
+
.filter((currentProperty) => currentProperty.access_modifier.toLowerCase() !== 'private')
|
|
117
|
+
// Filter out properties that also exist on the child
|
|
118
|
+
.filter((currentProperty) => !this.memberExists(currentClass.properties, currentProperty.name))
|
|
119
|
+
.map((currentProperty) => (Object.assign(Object.assign({}, currentProperty), { inherited: true })));
|
|
120
|
+
return parentProperties;
|
|
121
|
+
}
|
|
122
|
+
getInheritedMethods(parentAsClass, currentClass) {
|
|
123
|
+
const parentMethods = parentAsClass.methods
|
|
124
|
+
// Filter out private methods
|
|
125
|
+
.filter((currentMethod) => currentMethod.access_modifier.toLowerCase() !== 'private')
|
|
126
|
+
// Filter out methods that also exist on the child
|
|
127
|
+
.filter((currentMethod) => !this.memberExists(currentClass.methods, currentMethod.name))
|
|
128
|
+
.map((currentMethod) => (Object.assign(Object.assign({}, currentMethod), { inherited: true })));
|
|
129
|
+
return parentMethods;
|
|
130
|
+
}
|
|
131
|
+
memberExists(members, fieldName) {
|
|
132
|
+
const fieldNames = members.map((currentMember) => currentMember.name);
|
|
133
|
+
return fieldNames.includes(fieldName);
|
|
33
134
|
}
|
|
34
135
|
}
|
|
35
136
|
exports.RawBodyParser = RawBodyParser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/service/parser.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/service/parser.ts"],"names":[],"mappings":";;;AAUA,6DAAqD;AACrD,2CAAwC;AAQxC,MAAa,aAAa;IACxB,YAAmB,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAAG,CAAC;IAEhD,KAAK,CAAC,OAAqD;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW;aAC3B,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE;YACrB,eAAM,CAAC,GAAG,CAAC,iBAAiB,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtD,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;YACtC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,aAAa,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CAAC;IAED,YAAY,CAAC,OAAoB,EAAE,SAAiB;QAClD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;CACF;AA/JD,sCA+JC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cparra/apexdocs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Library with CLI capabilities to generate documentation for Salesforce Apex classes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apex",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"postversion": "git push && git push --tags",
|
|
25
25
|
"docs:init": "docsify init docs",
|
|
26
26
|
"docs:serve": "docsify serve docs",
|
|
27
|
-
"execute:example": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private -g docsify --defaultGroupName \"Misc Group\"",
|
|
27
|
+
"execute:example": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private protected -g docsify --defaultGroupName \"Misc Group\"",
|
|
28
28
|
"execute:example:index:only": "node lib/cli/generate.js -s examples/force-app -t docs --scope global public private -g docsify --indexOnly"
|
|
29
29
|
},
|
|
30
30
|
"author": "Cesar Parra",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FieldMirror, MethodMirror, PropertyMirror } from '@cparra/apex-reflection';
|
|
2
|
+
|
|
3
|
+
export type InheritanceSupport = { inherited: boolean };
|
|
4
|
+
export type FieldMirrorWithInheritance = FieldMirror & InheritanceSupport;
|
|
5
|
+
export type PropertyMirrorWithInheritance = PropertyMirror & InheritanceSupport;
|
|
6
|
+
export type MethodMirrorWithInheritance = MethodMirror & InheritanceSupport;
|
|
7
|
+
export type FieldOrProperty = FieldMirrorWithInheritance | PropertyMirrorWithInheritance;
|
|
@@ -22,6 +22,10 @@ export class MarkdownFile extends File {
|
|
|
22
22
|
super.addText(this._replaceInlineReferences(text), encodeHtml);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
public addLink(text: string, encodeHtml = true) {
|
|
26
|
+
this.addText(`\{@link ${text}\}`, encodeHtml);
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
startCodeBlock() {
|
|
26
30
|
this.addText('```apex');
|
|
27
31
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MarkdownFile } from '../markdown-file';
|
|
2
|
-
import {
|
|
2
|
+
import { FieldMirrorWithInheritance, FieldOrProperty, PropertyMirrorWithInheritance } from '../inheritance';
|
|
3
3
|
|
|
4
4
|
export function declareField(
|
|
5
5
|
markdownFile: MarkdownFile,
|
|
6
|
-
fields:
|
|
6
|
+
fields: FieldMirrorWithInheritance[] | PropertyMirrorWithInheritance[],
|
|
7
7
|
startingHeadingLevel: number,
|
|
8
8
|
grouped = false,
|
|
9
9
|
) {
|
|
@@ -23,13 +23,16 @@ export function declareField(
|
|
|
23
23
|
|
|
24
24
|
function addFieldSection(
|
|
25
25
|
markdownFile: MarkdownFile,
|
|
26
|
-
mirrorModel:
|
|
26
|
+
mirrorModel: FieldOrProperty,
|
|
27
27
|
startingHeadingLevel: number,
|
|
28
28
|
grouped: boolean,
|
|
29
29
|
) {
|
|
30
30
|
if (!grouped) {
|
|
31
31
|
markdownFile.addTitle(`\`${mirrorModel.name}\` → \`${mirrorModel.type}\``, startingHeadingLevel + 2);
|
|
32
32
|
markdownFile.addBlankLine();
|
|
33
|
+
if (mirrorModel.inherited) {
|
|
34
|
+
markdownFile.addText('*Inherited*');
|
|
35
|
+
}
|
|
33
36
|
|
|
34
37
|
mirrorModel.annotations.forEach((annotation) => {
|
|
35
38
|
markdownFile.addText(`\`${annotation.type.toUpperCase()}\` `);
|
|
@@ -58,7 +61,9 @@ function addFieldSection(
|
|
|
58
61
|
if (mirrorModel.docComment?.description) {
|
|
59
62
|
description = ` - ${mirrorModel.docComment?.description}`;
|
|
60
63
|
}
|
|
61
|
-
markdownFile.addListItem(
|
|
64
|
+
markdownFile.addListItem(
|
|
65
|
+
`\`${mirrorModel.name}\` → \`${mirrorModel.type}\` (*Inherited*) ${annotations} ${description}`,
|
|
66
|
+
);
|
|
62
67
|
markdownFile.addBlankLine();
|
|
63
68
|
}
|
|
64
69
|
}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import { ConstructorMirror, DocComment
|
|
1
|
+
import { ConstructorMirror, DocComment } from '@cparra/apex-reflection';
|
|
2
2
|
import { MarkdownFile } from '../markdown-file';
|
|
3
3
|
import { ParameterMirror } from '@cparra/apex-reflection/index';
|
|
4
4
|
import { addCustomDocCommentAnnotations } from './doc-comment-annotation-util';
|
|
5
|
+
import { MethodMirrorWithInheritance } from '../inheritance';
|
|
5
6
|
|
|
6
7
|
export function declareMethod(
|
|
7
8
|
markdownFile: MarkdownFile,
|
|
8
|
-
methods: ConstructorMirror[] |
|
|
9
|
+
methods: ConstructorMirror[] | MethodMirrorWithInheritance[],
|
|
9
10
|
startingHeadingLevel: number,
|
|
10
11
|
className = '',
|
|
11
12
|
): void {
|
|
12
13
|
methods.forEach((currentMethod) => {
|
|
13
|
-
const signatureName = isMethod(currentMethod) ? (currentMethod as
|
|
14
|
+
const signatureName = isMethod(currentMethod) ? (currentMethod as MethodMirrorWithInheritance).name : className;
|
|
14
15
|
markdownFile.addTitle(`\`${buildSignature(signatureName, currentMethod)}\``, startingHeadingLevel + 2);
|
|
16
|
+
|
|
17
|
+
// Inheritance tag
|
|
18
|
+
if (isMethod(currentMethod)) {
|
|
19
|
+
const asMethodMirror = currentMethod as MethodMirrorWithInheritance;
|
|
20
|
+
if (asMethodMirror.inherited) {
|
|
21
|
+
markdownFile.addBlankLine();
|
|
22
|
+
markdownFile.addText('*Inherited*');
|
|
23
|
+
markdownFile.addBlankLine();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
currentMethod.annotations.forEach((annotation) => {
|
|
16
28
|
markdownFile.addBlankLine();
|
|
17
29
|
markdownFile.addText(`\`${annotation.type.toUpperCase()}\``);
|
|
@@ -28,7 +40,7 @@ export function declareMethod(
|
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
if (isMethod(currentMethod)) {
|
|
31
|
-
addReturns(markdownFile, currentMethod as
|
|
43
|
+
addReturns(markdownFile, currentMethod as MethodMirrorWithInheritance, startingHeadingLevel);
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
addThrowsBlock(markdownFile, currentMethod, startingHeadingLevel);
|
|
@@ -53,8 +65,8 @@ type DocCommentAware = {
|
|
|
53
65
|
|
|
54
66
|
function buildSignature(name: string, parameterAware: ParameterAware): string {
|
|
55
67
|
let signature = `${name}(`;
|
|
56
|
-
if (isMethod(parameterAware) && (parameterAware as
|
|
57
|
-
signature = (parameterAware as
|
|
68
|
+
if (isMethod(parameterAware) && (parameterAware as MethodMirrorWithInheritance).memberModifiers.length) {
|
|
69
|
+
signature = (parameterAware as MethodMirrorWithInheritance).memberModifiers.join(' ') + ' ' + signature;
|
|
58
70
|
}
|
|
59
71
|
const signatureParameters = parameterAware.parameters.map((param) => `${param.type} ${param.name}`);
|
|
60
72
|
signature += signatureParameters.join(', ');
|
|
@@ -63,7 +75,7 @@ function buildSignature(name: string, parameterAware: ParameterAware): string {
|
|
|
63
75
|
|
|
64
76
|
function addParameters(
|
|
65
77
|
markdownFile: MarkdownFile,
|
|
66
|
-
methodModel:
|
|
78
|
+
methodModel: MethodMirrorWithInheritance | ConstructorMirror,
|
|
67
79
|
startingHeadingLevel: number,
|
|
68
80
|
) {
|
|
69
81
|
if (!methodModel.docComment?.paramAnnotations.length) {
|
|
@@ -83,7 +95,11 @@ function addParameters(
|
|
|
83
95
|
markdownFile.addBlankLine();
|
|
84
96
|
}
|
|
85
97
|
|
|
86
|
-
function addReturns(
|
|
98
|
+
function addReturns(
|
|
99
|
+
markdownFile: MarkdownFile,
|
|
100
|
+
methodModel: MethodMirrorWithInheritance,
|
|
101
|
+
startingHeadingLevel: number,
|
|
102
|
+
) {
|
|
87
103
|
if (!methodModel.docComment?.returnAnnotation) {
|
|
88
104
|
return;
|
|
89
105
|
}
|
|
@@ -127,6 +143,8 @@ function addExample(markdownFile: MarkdownFile, docCommentAware: DocCommentAware
|
|
|
127
143
|
markdownFile.addBlankLine();
|
|
128
144
|
}
|
|
129
145
|
|
|
130
|
-
function isMethod(
|
|
131
|
-
|
|
146
|
+
function isMethod(
|
|
147
|
+
method: MethodMirrorWithInheritance | ConstructorMirror | ParameterAware,
|
|
148
|
+
): method is ConstructorMirror {
|
|
149
|
+
return (method as MethodMirrorWithInheritance).type !== undefined;
|
|
132
150
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MarkdownFile } from '../markdown-file';
|
|
2
2
|
import { addCustomDocCommentAnnotations } from './doc-comment-annotation-util';
|
|
3
|
-
import { Annotation, Type } from '@cparra/apex-reflection';
|
|
3
|
+
import { Annotation, ClassMirror, InterfaceMirror, Type } from '@cparra/apex-reflection';
|
|
4
|
+
import { TypesRepository } from '../types-repository';
|
|
4
5
|
|
|
5
6
|
export function declareType(markdownFile: MarkdownFile, typeMirror: Type): void {
|
|
6
7
|
typeMirror.annotations.forEach((currentAnnotation: Annotation) => {
|
|
@@ -16,5 +17,73 @@ export function declareType(markdownFile: MarkdownFile, typeMirror: Type): void
|
|
|
16
17
|
markdownFile.addBlankLine();
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
if (typeMirror.type_name === 'class') {
|
|
21
|
+
addInheritanceSectionForClass(typeMirror, markdownFile);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (typeMirror.type_name === 'interface') {
|
|
25
|
+
addInheritanceSectionForInterface(typeMirror, markdownFile);
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
addCustomDocCommentAnnotations(markdownFile, typeMirror);
|
|
20
29
|
}
|
|
30
|
+
|
|
31
|
+
function addInheritanceSectionForClass(typeMirror: Type, markdownFile: MarkdownFile) {
|
|
32
|
+
const typeAsClass = typeMirror as ClassMirror;
|
|
33
|
+
if (typeAsClass.extended_class) {
|
|
34
|
+
markdownFile.addBlankLine();
|
|
35
|
+
markdownFile.addText('**Inheritance**');
|
|
36
|
+
markdownFile.addBlankLine();
|
|
37
|
+
addParent(markdownFile, typeAsClass);
|
|
38
|
+
markdownFile.addText(typeMirror.name);
|
|
39
|
+
markdownFile.addBlankLine();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (typeAsClass.implemented_interfaces.length) {
|
|
43
|
+
markdownFile.addBlankLine();
|
|
44
|
+
markdownFile.addText('**Implemented types**');
|
|
45
|
+
markdownFile.addBlankLine();
|
|
46
|
+
for (let i = 0; i < typeAsClass.implemented_interfaces.length; i++) {
|
|
47
|
+
const currentName = typeAsClass.implemented_interfaces[i];
|
|
48
|
+
markdownFile.addLink(currentName);
|
|
49
|
+
if (i < typeAsClass.implemented_interfaces.length - 1) {
|
|
50
|
+
markdownFile.addText(', ');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
markdownFile.addBlankLine();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function addInheritanceSectionForInterface(typeMirror: Type, markdownFile: MarkdownFile) {
|
|
58
|
+
const typeAsInterface = typeMirror as InterfaceMirror;
|
|
59
|
+
if (typeAsInterface.extended_interfaces.length) {
|
|
60
|
+
markdownFile.addBlankLine();
|
|
61
|
+
markdownFile.addText('**Extended types**');
|
|
62
|
+
markdownFile.addBlankLine();
|
|
63
|
+
for (let i = 0; i < typeAsInterface.extended_interfaces.length; i++) {
|
|
64
|
+
const currentName = typeAsInterface.extended_interfaces[i];
|
|
65
|
+
markdownFile.addLink(currentName);
|
|
66
|
+
if (i < typeAsInterface.extended_interfaces.length - 1) {
|
|
67
|
+
markdownFile.addText(', ');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function addParent(markdownFile: MarkdownFile, classMirror: ClassMirror) {
|
|
74
|
+
if (!classMirror.extended_class) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const parentType = TypesRepository.getInstance().getByName(classMirror.extended_class);
|
|
79
|
+
if (!parentType) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (parentType.type_name === 'class') {
|
|
84
|
+
addParent(markdownFile, parentType as ClassMirror);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
markdownFile.addLink(parentType.name);
|
|
88
|
+
markdownFile.addText(' > ');
|
|
89
|
+
}
|
|
@@ -2,10 +2,8 @@ import {
|
|
|
2
2
|
ClassMirror,
|
|
3
3
|
ConstructorMirror,
|
|
4
4
|
EnumMirror,
|
|
5
|
-
FieldMirror,
|
|
6
5
|
InterfaceMirror,
|
|
7
6
|
MethodMirror,
|
|
8
|
-
PropertyMirror,
|
|
9
7
|
Type,
|
|
10
8
|
} from '@cparra/apex-reflection';
|
|
11
9
|
import { WalkerFactory } from '../service/walkers/walker-factory';
|
|
@@ -13,6 +11,7 @@ import { WalkerListener } from '../service/walkers/walker';
|
|
|
13
11
|
import { MarkdownFile } from './markdown-file';
|
|
14
12
|
import { declareType, declareMethod, declareField } from './markdown-generation-util';
|
|
15
13
|
import ClassFileGeneratorHelper from '../transpiler/markdown/class-file-generatorHelper';
|
|
14
|
+
import { FieldMirrorWithInheritance, MethodMirrorWithInheritance, PropertyMirrorWithInheritance } from './inheritance';
|
|
16
15
|
|
|
17
16
|
interface GroupAware {
|
|
18
17
|
group?: string;
|
|
@@ -42,12 +41,12 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
42
41
|
this.declareMethodWithGroupings(constructors, className);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
public onFieldsDeclaration(fields:
|
|
44
|
+
public onFieldsDeclaration(fields: FieldMirrorWithInheritance[]): void {
|
|
46
45
|
this.addTitle('Fields', this.headingLevel + 1);
|
|
47
46
|
this.declareFieldOrProperty(fields);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
public onPropertiesDeclaration(properties:
|
|
49
|
+
public onPropertiesDeclaration(properties: PropertyMirrorWithInheritance[]): void {
|
|
51
50
|
this.addTitle('Properties', this.headingLevel + 1);
|
|
52
51
|
this.declareFieldOrProperty(properties);
|
|
53
52
|
}
|
|
@@ -90,7 +89,10 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
90
89
|
return !!groupAware.find((current) => !!current.group);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
private declareMethodWithGroupings(
|
|
92
|
+
private declareMethodWithGroupings(
|
|
93
|
+
methods: ConstructorMirror[] | MethodMirrorWithInheritance[],
|
|
94
|
+
className = '',
|
|
95
|
+
): void {
|
|
94
96
|
const hasGroupings = this.hasGroupings(methods);
|
|
95
97
|
if (!hasGroupings) {
|
|
96
98
|
declareMethod(this, methods, this.headingLevel, className);
|
|
@@ -105,7 +107,9 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
private declareFieldOrProperty(
|
|
110
|
+
private declareFieldOrProperty(
|
|
111
|
+
fieldsOrProperties: FieldMirrorWithInheritance[] | PropertyMirrorWithInheritance[],
|
|
112
|
+
): void {
|
|
109
113
|
const hasGroupings = this.hasGroupings(fieldsOrProperties);
|
|
110
114
|
if (!hasGroupings) {
|
|
111
115
|
declareField(this, fieldsOrProperties, this.headingLevel, false);
|
|
@@ -113,7 +117,7 @@ export class MarkdownTypeFile extends MarkdownFile implements WalkerListener {
|
|
|
113
117
|
const groupedFields = this.group(fieldsOrProperties);
|
|
114
118
|
for (const key in groupedFields) {
|
|
115
119
|
this.startGroup(key);
|
|
116
|
-
const fieldsForGroup = groupedFields[key] as
|
|
120
|
+
const fieldsForGroup = groupedFields[key] as FieldMirrorWithInheritance[];
|
|
117
121
|
declareField(this, fieldsForGroup, this.headingLevel, true);
|
|
118
122
|
this.endGroup();
|
|
119
123
|
}
|
package/src/service/parser.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Type,
|
|
3
|
+
ReflectionResult,
|
|
4
|
+
ClassMirror,
|
|
5
|
+
FieldMirror,
|
|
6
|
+
PropertyMirror,
|
|
7
|
+
MethodMirror,
|
|
8
|
+
InterfaceMirror,
|
|
9
|
+
} from '@cparra/apex-reflection';
|
|
2
10
|
import ApexBundle from '../model/apex-bundle';
|
|
3
11
|
import MetadataProcessor from './metadata-processor';
|
|
4
12
|
import { Logger } from '../util/logger';
|
|
@@ -7,11 +15,13 @@ export interface TypeParser {
|
|
|
7
15
|
parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[];
|
|
8
16
|
}
|
|
9
17
|
|
|
18
|
+
type NameAware = { name: string };
|
|
19
|
+
|
|
10
20
|
export class RawBodyParser implements TypeParser {
|
|
11
21
|
constructor(public typeBundles: ApexBundle[]) {}
|
|
12
22
|
|
|
13
23
|
parse(reflect: (apexBundle: ApexBundle) => ReflectionResult): Type[] {
|
|
14
|
-
|
|
24
|
+
const types = this.typeBundles
|
|
15
25
|
.map((currentBundle) => {
|
|
16
26
|
Logger.log(`Parsing file: ${currentBundle.filePath}`);
|
|
17
27
|
const result = reflect(currentBundle);
|
|
@@ -33,5 +43,137 @@ export class RawBodyParser implements TypeParser {
|
|
|
33
43
|
return reflectionResult.typeMirror;
|
|
34
44
|
})
|
|
35
45
|
.map((reflectionResult) => reflectionResult.typeMirror!);
|
|
46
|
+
|
|
47
|
+
return this.addFieldsFromParent(types);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
addFieldsFromParent(types: Type[]): Type[] {
|
|
51
|
+
const typesWithFields: Type[] = [];
|
|
52
|
+
for (const currentType of types) {
|
|
53
|
+
if (currentType.type_name !== 'class' && currentType.type_name !== 'interface') {
|
|
54
|
+
typesWithFields.push(currentType);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (currentType.type_name === 'class') {
|
|
59
|
+
let typeAsClass = currentType as ClassMirror;
|
|
60
|
+
if (!typeAsClass.extended_class) {
|
|
61
|
+
typesWithFields.push(currentType);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
typeAsClass = this.addMembersFromParent(typeAsClass, types);
|
|
66
|
+
typesWithFields.push(typeAsClass);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// If reaching here then we are dealing with an interface
|
|
71
|
+
let typeAsInterface = currentType as InterfaceMirror;
|
|
72
|
+
if (!typeAsInterface.extended_interfaces.length) {
|
|
73
|
+
typesWithFields.push(currentType);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
typeAsInterface = this.addMethodsFromParent(typeAsInterface, types);
|
|
78
|
+
typesWithFields.push(typeAsInterface);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return typesWithFields;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
addMembersFromParent(currentClass: ClassMirror, allTypes: Type[]): ClassMirror {
|
|
86
|
+
if (!currentClass.extended_class) {
|
|
87
|
+
return currentClass;
|
|
88
|
+
}
|
|
89
|
+
const parent = allTypes.find((currentType: Type) => currentType.name === currentClass.extended_class);
|
|
90
|
+
if (!parent || parent.type_name !== 'class') {
|
|
91
|
+
return currentClass;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let parentAsClass = parent as ClassMirror;
|
|
95
|
+
if (parentAsClass.extended_class) {
|
|
96
|
+
parentAsClass = this.addMembersFromParent(parentAsClass, allTypes);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
currentClass.fields = [...currentClass.fields, ...this.getInheritedFields(parentAsClass, currentClass)];
|
|
100
|
+
currentClass.properties = [...currentClass.properties, ...this.getInheritedProperties(parentAsClass, currentClass)];
|
|
101
|
+
currentClass.methods = [...currentClass.methods, ...this.getInheritedMethods(parentAsClass, currentClass)];
|
|
102
|
+
return currentClass;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
addMethodsFromParent(currentInterface: InterfaceMirror, allTypes: Type[]): InterfaceMirror {
|
|
106
|
+
if (!currentInterface.extended_interfaces.length) {
|
|
107
|
+
return currentInterface;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const parents = [];
|
|
111
|
+
for (const currentInterfaceName of currentInterface.extended_interfaces) {
|
|
112
|
+
const parent = allTypes.find((currentType: Type) => currentType.name === currentInterfaceName);
|
|
113
|
+
if (parent) {
|
|
114
|
+
parents.push(parent);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
for (const parent of parents) {
|
|
119
|
+
let parentAsInterface = parent as InterfaceMirror;
|
|
120
|
+
if (parentAsInterface.extended_interfaces.length) {
|
|
121
|
+
parentAsInterface = this.addMethodsFromParent(parentAsInterface, allTypes);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
currentInterface.methods = [
|
|
125
|
+
...currentInterface.methods,
|
|
126
|
+
...this.getInheritedMethods(parentAsInterface, currentInterface),
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return currentInterface;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private getInheritedFields(parentAsClass: ClassMirror, currentClass: ClassMirror) {
|
|
134
|
+
const parentFields = parentAsClass.fields
|
|
135
|
+
// Filter out private fields
|
|
136
|
+
.filter((currentField) => currentField.access_modifier.toLowerCase() !== 'private')
|
|
137
|
+
// Filter out fields that also exist on the child
|
|
138
|
+
.filter((currentField) => !this.memberExists(currentClass.fields, currentField.name))
|
|
139
|
+
.map((currentField) => ({
|
|
140
|
+
...currentField,
|
|
141
|
+
inherited: true,
|
|
142
|
+
}));
|
|
143
|
+
return parentFields;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private getInheritedProperties(parentAsClass: ClassMirror, currentClass: ClassMirror) {
|
|
147
|
+
const parentProperties = parentAsClass.properties
|
|
148
|
+
// Filter out private properties
|
|
149
|
+
.filter((currentProperty) => currentProperty.access_modifier.toLowerCase() !== 'private')
|
|
150
|
+
// Filter out properties that also exist on the child
|
|
151
|
+
.filter((currentProperty) => !this.memberExists(currentClass.properties, currentProperty.name))
|
|
152
|
+
.map((currentProperty) => ({
|
|
153
|
+
...currentProperty,
|
|
154
|
+
inherited: true,
|
|
155
|
+
}));
|
|
156
|
+
return parentProperties;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private getInheritedMethods(
|
|
160
|
+
parentAsClass: ClassMirror | InterfaceMirror,
|
|
161
|
+
currentClass: ClassMirror | InterfaceMirror,
|
|
162
|
+
) {
|
|
163
|
+
const parentMethods = parentAsClass.methods
|
|
164
|
+
// Filter out private methods
|
|
165
|
+
.filter((currentMethod) => currentMethod.access_modifier.toLowerCase() !== 'private')
|
|
166
|
+
// Filter out methods that also exist on the child
|
|
167
|
+
.filter((currentMethod) => !this.memberExists(currentClass.methods, currentMethod.name))
|
|
168
|
+
.map((currentMethod) => ({
|
|
169
|
+
...currentMethod,
|
|
170
|
+
inherited: true,
|
|
171
|
+
}));
|
|
172
|
+
return parentMethods;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
memberExists(members: NameAware[], fieldName: string): boolean {
|
|
176
|
+
const fieldNames = members.map((currentMember) => currentMember.name);
|
|
177
|
+
return fieldNames.includes(fieldName);
|
|
36
178
|
}
|
|
37
179
|
}
|