@cparra/apexdocs 1.13.4 → 2.0.0-alpha.14

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 (251) hide show
  1. package/.eslintrc.js +12 -0
  2. package/.prettierrc.js +7 -0
  3. package/README.md +344 -277
  4. package/ROADMAP.md +18 -0
  5. package/docs/Gemfile.lock +1 -1
  6. package/docs/Sample-Classes/SampleClass.md +138 -30
  7. package/docs/Sample-Interfaces/SampleInterface.md +21 -4
  8. package/docs/index.md +1 -9
  9. package/examples/apex/SampleClass.cls +31 -6
  10. package/examples/apex/SampleInterface.cls +3 -2
  11. package/lib/application/Apexdocs.d.ts +11 -0
  12. package/lib/application/Apexdocs.js +41 -0
  13. package/lib/application/Apexdocs.js.map +1 -0
  14. package/lib/cli/generate.js +17 -21
  15. package/lib/cli/generate.js.map +1 -0
  16. package/lib/index.d.ts +1 -1
  17. package/lib/index.js +2 -1
  18. package/lib/index.js.map +1 -0
  19. package/lib/model/file.d.ts +10 -0
  20. package/lib/model/file.js +23 -0
  21. package/lib/model/file.js.map +1 -0
  22. package/lib/model/manifest.d.ts +22 -0
  23. package/lib/model/manifest.js +41 -0
  24. package/lib/model/manifest.js.map +1 -0
  25. package/lib/model/markdown-file.d.ts +10 -0
  26. package/lib/model/markdown-file.js +52 -0
  27. package/lib/model/markdown-file.js.map +1 -0
  28. package/lib/model/markdown-generation-util/field-declaration-util.d.ts +3 -0
  29. package/lib/model/markdown-generation-util/field-declaration-util.js +33 -0
  30. package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -0
  31. package/lib/model/markdown-generation-util/index.d.ts +3 -0
  32. package/lib/model/markdown-generation-util/index.js +9 -0
  33. package/lib/model/markdown-generation-util/index.js.map +1 -0
  34. package/lib/model/markdown-generation-util/method-declaration-util.d.ts +3 -0
  35. package/lib/model/markdown-generation-util/method-declaration-util.js +97 -0
  36. package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -0
  37. package/lib/model/markdown-generation-util/type-declaration-util.d.ts +3 -0
  38. package/lib/model/markdown-generation-util/type-declaration-util.js +25 -0
  39. package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -0
  40. package/lib/model/markdown-home-file.d.ts +11 -0
  41. package/lib/model/markdown-home-file.js +50 -0
  42. package/lib/model/markdown-home-file.js.map +1 -0
  43. package/lib/model/markdown-type-file.d.ts +17 -0
  44. package/lib/model/markdown-type-file.js +62 -0
  45. package/lib/model/markdown-type-file.js.map +1 -0
  46. package/lib/service/apex-file-reader.d.ts +13 -0
  47. package/lib/service/apex-file-reader.js +39 -0
  48. package/lib/service/apex-file-reader.js.map +1 -0
  49. package/lib/service/file-system.d.ts +12 -0
  50. package/lib/service/file-system.js +21 -0
  51. package/lib/service/file-system.js.map +1 -0
  52. package/lib/service/file-writer.d.ts +4 -0
  53. package/lib/service/file-writer.js +25 -0
  54. package/lib/service/file-writer.js.map +1 -0
  55. package/lib/service/manifest-factory.d.ts +9 -0
  56. package/lib/service/manifest-factory.js +13 -0
  57. package/lib/service/manifest-factory.js.map +1 -0
  58. package/lib/service/parser.d.ts +9 -0
  59. package/lib/service/parser.js +17 -0
  60. package/lib/service/parser.js.map +1 -0
  61. package/lib/service/walkers/class-walker.d.ts +4 -0
  62. package/lib/service/walkers/class-walker.js +32 -0
  63. package/lib/service/walkers/class-walker.js.map +1 -0
  64. package/lib/service/walkers/enum-walker.d.ts +4 -0
  65. package/lib/service/walkers/enum-walker.js +10 -0
  66. package/lib/service/walkers/enum-walker.js.map +1 -0
  67. package/lib/service/walkers/interface-walker.d.ts +4 -0
  68. package/lib/service/walkers/interface-walker.js +14 -0
  69. package/lib/service/walkers/interface-walker.js.map +1 -0
  70. package/lib/service/walkers/walker-factory.d.ts +5 -0
  71. package/lib/service/walkers/walker-factory.js +19 -0
  72. package/lib/service/walkers/walker-factory.js.map +1 -0
  73. package/lib/service/walkers/walker.d.ts +16 -0
  74. package/lib/service/walkers/walker.js +9 -0
  75. package/lib/service/walkers/walker.js.map +1 -0
  76. package/lib/settings.d.ts +21 -0
  77. package/lib/settings.js +42 -0
  78. package/lib/settings.js.map +1 -0
  79. package/lib/transpiler/file-container.d.ts +6 -0
  80. package/lib/transpiler/file-container.js +15 -0
  81. package/lib/transpiler/file-container.js.map +1 -0
  82. package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +6 -0
  83. package/lib/transpiler/markdown/class-file-generatorHelper.js +17 -0
  84. package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -0
  85. package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +4 -0
  86. package/lib/transpiler/markdown/docsify/docsify-docs-processor.js +10 -0
  87. package/lib/transpiler/markdown/docsify/docsify-docs-processor.js.map +1 -0
  88. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +8 -0
  89. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js +24 -0
  90. package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +1 -0
  91. package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +11 -0
  92. package/lib/transpiler/markdown/markdown-transpiler-base.js +23 -0
  93. package/lib/transpiler/markdown/markdown-transpiler-base.js.map +1 -0
  94. package/lib/transpiler/processor-type-transpiler.d.ts +8 -0
  95. package/lib/transpiler/processor-type-transpiler.js +6 -0
  96. package/lib/transpiler/processor-type-transpiler.js.map +1 -0
  97. package/lib/transpiler/transpiler.d.ts +5 -0
  98. package/lib/transpiler/transpiler.js +21 -0
  99. package/lib/transpiler/transpiler.js.map +1 -0
  100. package/lib/util/logger.d.ts +18 -0
  101. package/lib/util/logger.js +32 -0
  102. package/lib/util/logger.js.map +1 -0
  103. package/package.json +22 -11
  104. package/src/application/Apexdocs.ts +41 -0
  105. package/src/cli/generate.ts +52 -64
  106. package/src/index.ts +1 -1
  107. package/src/model/__tests__/manifest.spec.ts +15 -0
  108. package/src/model/file.ts +23 -0
  109. package/src/model/manifest.ts +60 -0
  110. package/src/model/markdown-file.ts +56 -0
  111. package/src/model/markdown-generation-util/field-declaration-util.ts +42 -0
  112. package/src/model/markdown-generation-util/index.ts +3 -0
  113. package/src/model/markdown-generation-util/method-declaration-util.ts +128 -0
  114. package/src/model/markdown-generation-util/type-declaration-util.ts +29 -0
  115. package/src/model/markdown-home-file.ts +48 -0
  116. package/src/model/markdown-type-file.ts +75 -0
  117. package/src/service/__tests__/apex-file-reader.spec.ts +79 -0
  118. package/src/service/__tests__/manifest-factory.spec.ts +16 -0
  119. package/src/service/apex-file-reader.ts +45 -0
  120. package/src/service/file-system.ts +28 -0
  121. package/src/service/file-writer.ts +25 -0
  122. package/src/service/manifest-factory.ts +12 -0
  123. package/src/service/parser.ts +18 -0
  124. package/src/service/walkers/class-walker.ts +31 -0
  125. package/src/service/walkers/enum-walker.ts +8 -0
  126. package/src/service/walkers/interface-walker.ts +12 -0
  127. package/src/service/walkers/walker-factory.ts +18 -0
  128. package/src/service/walkers/walker.ts +35 -0
  129. package/src/settings.ts +57 -0
  130. package/src/transpiler/file-container.ts +13 -0
  131. package/src/transpiler/markdown/class-file-generatorHelper.ts +16 -0
  132. package/src/transpiler/markdown/docsify/docsify-docs-processor.ts +7 -0
  133. package/src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts +22 -0
  134. package/src/transpiler/markdown/markdown-transpiler-base.ts +28 -0
  135. package/src/transpiler/processor-type-transpiler.ts +12 -0
  136. package/src/transpiler/transpiler.ts +18 -0
  137. package/src/util/logger.ts +31 -0
  138. package/tsconfig.json +9 -3
  139. package/.prettierrc +0 -5
  140. package/examples/config/config.json +0 -5
  141. package/lib/AsJsDocsProcessor.d.ts +0 -9
  142. package/lib/AsJsDocsProcessor.js +0 -61
  143. package/lib/ClassFileGeneratorHelper.d.ts +0 -5
  144. package/lib/ClassFileGeneratorHelper.js +0 -25
  145. package/lib/ClassFileGeneratorHelper.test.d.ts +0 -1
  146. package/lib/ClassFileGeneratorHelper.test.js +0 -32
  147. package/lib/Configuration.d.ts +0 -34
  148. package/lib/Configuration.js +0 -37
  149. package/lib/DocsProcessor.d.ts +0 -6
  150. package/lib/DocsProcessor.js +0 -9
  151. package/lib/DocsifyDocsProcessor.d.ts +0 -4
  152. package/lib/DocsifyDocsProcessor.js +0 -9
  153. package/lib/DocsifyDocsProcessor.test.d.ts +0 -1
  154. package/lib/DocsifyDocsProcessor.test.js +0 -7
  155. package/lib/FileManager.d.ts +0 -6
  156. package/lib/FileManager.js +0 -28
  157. package/lib/JekyllDocsProcessor.d.ts +0 -8
  158. package/lib/JekyllDocsProcessor.js +0 -20
  159. package/lib/JekyllDocsProcessor.test.d.ts +0 -1
  160. package/lib/JekyllDocsProcessor.test.js +0 -21
  161. package/lib/JsHelper.d.ts +0 -12
  162. package/lib/JsHelper.js +0 -72
  163. package/lib/MarkdownDocsProcessor.d.ts +0 -22
  164. package/lib/MarkdownDocsProcessor.js +0 -358
  165. package/lib/MarkdownHelper.d.ts +0 -13
  166. package/lib/MarkdownHelper.js +0 -78
  167. package/lib/Settings.d.ts +0 -22
  168. package/lib/Settings.js +0 -51
  169. package/lib/Settings.test.d.ts +0 -1
  170. package/lib/Settings.test.js +0 -38
  171. package/lib/command/Generate.d.ts +0 -2
  172. package/lib/command/Generate.js +0 -54
  173. package/lib/command/__test__/Generte.test.d.ts +0 -1
  174. package/lib/command/__test__/Generte.test.js +0 -30
  175. package/lib/model/ApexModel.d.ts +0 -30
  176. package/lib/model/ApexModel.js +0 -85
  177. package/lib/model/ClassModel.d.ts +0 -39
  178. package/lib/model/ClassModel.js +0 -125
  179. package/lib/model/EnumModel.d.ts +0 -6
  180. package/lib/model/EnumModel.js +0 -28
  181. package/lib/model/MethodModel.d.ts +0 -18
  182. package/lib/model/MethodModel.js +0 -74
  183. package/lib/model/PropertyModel.d.ts +0 -6
  184. package/lib/model/PropertyModel.js +0 -40
  185. package/lib/model/__test__/ClassModel.test.d.ts +0 -1
  186. package/lib/model/__test__/ClassModel.test.js +0 -79
  187. package/lib/model/__test__/MethodModel.test.d.ts +0 -1
  188. package/lib/model/__test__/MethodModel.test.js +0 -55
  189. package/lib/model/__test__/PropertyModel.test.d.ts +0 -1
  190. package/lib/model/__test__/PropertyModel.test.js +0 -25
  191. package/lib/parser/ClassParser.d.ts +0 -5
  192. package/lib/parser/ClassParser.js +0 -79
  193. package/lib/parser/EnumParser.d.ts +0 -5
  194. package/lib/parser/EnumParser.js +0 -45
  195. package/lib/parser/FileParser.d.ts +0 -8
  196. package/lib/parser/FileParser.js +0 -210
  197. package/lib/parser/MethodParser.d.ts +0 -5
  198. package/lib/parser/MethodParser.js +0 -109
  199. package/lib/parser/PropertyParser.d.ts +0 -5
  200. package/lib/parser/PropertyParser.js +0 -46
  201. package/lib/parser/__test__/ClassParser.test.d.ts +0 -1
  202. package/lib/parser/__test__/ClassParser.test.js +0 -52
  203. package/lib/parser/__test__/FileParser.test.d.ts +0 -1
  204. package/lib/parser/__test__/FileParser.test.js +0 -12
  205. package/lib/parser/__test__/MethodParser.test.d.ts +0 -1
  206. package/lib/parser/__test__/MethodParser.test.js +0 -69
  207. package/lib/parser/__test__/PropertyParser.test.d.ts +0 -1
  208. package/lib/parser/__test__/PropertyParser.test.js +0 -14
  209. package/lib/parser/__test__/testFileContents.d.ts +0 -1
  210. package/lib/parser/__test__/testFileContents.js +0 -82
  211. package/lib/utils.d.ts +0 -12
  212. package/lib/utils.js +0 -49
  213. package/lib/utils.test.d.ts +0 -1
  214. package/lib/utils.test.js +0 -35
  215. package/src/AsJsDocsProcessor.ts +0 -67
  216. package/src/ClassFileGeneratorHelper.test.ts +0 -44
  217. package/src/ClassFileGeneratorHelper.ts +0 -26
  218. package/src/Configuration.ts +0 -69
  219. package/src/DocsProcessor.ts +0 -9
  220. package/src/DocsifyDocsProcessor.test.ts +0 -6
  221. package/src/DocsifyDocsProcessor.ts +0 -7
  222. package/src/FileManager.ts +0 -32
  223. package/src/JekyllDocsProcessor.test.ts +0 -28
  224. package/src/JekyllDocsProcessor.ts +0 -22
  225. package/src/JsHelper.ts +0 -78
  226. package/src/MarkdownDocsProcessor.ts +0 -420
  227. package/src/MarkdownHelper.ts +0 -91
  228. package/src/Settings.test.ts +0 -54
  229. package/src/Settings.ts +0 -65
  230. package/src/command/Generate.ts +0 -69
  231. package/src/command/__test__/Generte.test.ts +0 -39
  232. package/src/model/ApexModel.ts +0 -102
  233. package/src/model/ClassModel.ts +0 -140
  234. package/src/model/EnumModel.ts +0 -27
  235. package/src/model/MethodModel.ts +0 -80
  236. package/src/model/PropertyModel.ts +0 -37
  237. package/src/model/__test__/ClassModel.test.ts +0 -100
  238. package/src/model/__test__/MethodModel.test.ts +0 -70
  239. package/src/model/__test__/PropertyModel.test.ts +0 -34
  240. package/src/parser/ClassParser.ts +0 -83
  241. package/src/parser/EnumParser.ts +0 -47
  242. package/src/parser/FileParser.ts +0 -250
  243. package/src/parser/MethodParser.ts +0 -119
  244. package/src/parser/PropertyParser.ts +0 -46
  245. package/src/parser/__test__/ClassParser.test.ts +0 -70
  246. package/src/parser/__test__/FileParser.test.ts +0 -14
  247. package/src/parser/__test__/MethodParser.test.ts +0 -90
  248. package/src/parser/__test__/PropertyParser.test.ts +0 -18
  249. package/src/parser/__test__/testFileContents.ts +0 -81
  250. package/src/utils.test.ts +0 -40
  251. package/src/utils.ts +0 -52
@@ -1,30 +0,0 @@
1
- export default class ApexModel {
2
- protected nameLine: string;
3
- private nameLineIndex;
4
- private description;
5
- private author;
6
- private date;
7
- private returns;
8
- private example;
9
- private scope;
10
- private isNamespaceAccessible;
11
- getNameLine(): string;
12
- getInameLine(): number | undefined;
13
- setNameLine(nameLine: string, iLine: number): void;
14
- getDescription(): string;
15
- setDescription(description: string): void;
16
- getAuthor(): string;
17
- setAuthor(author: string): void;
18
- getDate(): string;
19
- setDate(date: string): void;
20
- getReturns(): string;
21
- setReturns(returns: string): void;
22
- getExample(): string;
23
- setExample(example: string): void;
24
- getScope(): string;
25
- setScope(scope: string): void;
26
- setIsNamespaceAccessible(isNamespaceAccessible: boolean): void;
27
- getIsNamespaceAccessible(): boolean;
28
- private parseScope;
29
- private getScopeFromSettings;
30
- }
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const Settings_1 = require("../Settings");
4
- class ApexModel {
5
- constructor() {
6
- this.nameLine = '';
7
- this.description = '';
8
- this.author = '';
9
- this.date = '';
10
- this.returns = '';
11
- this.example = '';
12
- this.scope = '';
13
- this.isNamespaceAccessible = false;
14
- }
15
- getNameLine() {
16
- return this.nameLine;
17
- }
18
- getInameLine() {
19
- return this.nameLineIndex;
20
- }
21
- setNameLine(nameLine, iLine) {
22
- this.nameLine = nameLine.trim();
23
- this.nameLineIndex = iLine;
24
- this.parseScope();
25
- }
26
- getDescription() {
27
- return this.description == null ? '' : this.description;
28
- }
29
- setDescription(description) {
30
- this.description = description;
31
- }
32
- getAuthor() {
33
- return this.author == null ? '' : this.author;
34
- }
35
- setAuthor(author) {
36
- this.author = author;
37
- }
38
- getDate() {
39
- return this.date == null ? '' : this.date;
40
- }
41
- setDate(date) {
42
- this.date = date;
43
- }
44
- getReturns() {
45
- return this.returns == null ? '' : this.returns;
46
- }
47
- setReturns(returns) {
48
- this.returns = returns;
49
- }
50
- getExample() {
51
- return this.example == null ? '' : this.example;
52
- }
53
- setExample(example) {
54
- this.example = example;
55
- }
56
- getScope() {
57
- return this.scope == null ? '' : this.scope;
58
- }
59
- setScope(scope) {
60
- this.scope = scope;
61
- }
62
- setIsNamespaceAccessible(isNamespaceAccessible) {
63
- this.isNamespaceAccessible = isNamespaceAccessible;
64
- }
65
- getIsNamespaceAccessible() {
66
- return this.isNamespaceAccessible;
67
- }
68
- parseScope() {
69
- this.scope = '';
70
- const str = this.getScopeFromSettings(this.nameLine);
71
- if (str != null) {
72
- this.scope = str;
73
- }
74
- }
75
- getScopeFromSettings(str) {
76
- str = str.toLowerCase();
77
- for (const currentScope of Settings_1.default.getInstance().getScope()) {
78
- if (str.toLowerCase().includes(currentScope.toLowerCase() + ' ')) {
79
- return currentScope;
80
- }
81
- }
82
- return null;
83
- }
84
- }
85
- exports.default = ApexModel;
@@ -1,39 +0,0 @@
1
- import ApexModel from './ApexModel';
2
- import MethodModel from './MethodModel';
3
- import PropertyModel from './PropertyModel';
4
- import EnumModel from './EnumModel';
5
- export default class ClassModel extends ApexModel {
6
- methods: MethodModel[];
7
- properties: PropertyModel[];
8
- cmodelParent?: ClassModel;
9
- childClasses: ClassModel[];
10
- childEnums: EnumModel[];
11
- strClassGroup: string;
12
- strClassGroupContent: string;
13
- isInterface: boolean;
14
- isEnum: boolean;
15
- seeList: string[];
16
- className: string;
17
- constructor(parent?: any);
18
- getProperties(): PropertyModel[];
19
- setProperties(properties: PropertyModel[]): void;
20
- getMethods(): MethodModel[];
21
- setMethods(methods: MethodModel[]): void;
22
- getChildClasses(): ClassModel[];
23
- addChildClass(child: ClassModel): void;
24
- addChildEnum(childEnum: EnumModel): void;
25
- getChildEnums(): EnumModel[];
26
- getClassName(includeParent?: boolean): string;
27
- setClassName(className: string): void;
28
- getTopmostClassName(): string;
29
- getClassGroup(): string;
30
- setClassGroup(strGroup: string): void;
31
- getClassGroupContent(): string;
32
- setClassGroupContent(strGroupContent: string): void;
33
- getIsInterface(): boolean;
34
- setIsInterface(isInterface: boolean): void;
35
- getIsEnum(): boolean;
36
- setIsEnum(isEnum: boolean): void;
37
- addSee(seeClassName: string): void;
38
- getSeeList(): string[];
39
- }
@@ -1,125 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ApexModel_1 = require("./ApexModel");
4
- const Configuration_1 = require("../Configuration");
5
- class ClassModel extends ApexModel_1.default {
6
- constructor(parent) {
7
- var _a;
8
- super();
9
- this.methods = [];
10
- this.properties = [];
11
- this.childClasses = [];
12
- this.childEnums = [];
13
- this.strClassGroup = ((_a = Configuration_1.default.getConfig()) === null || _a === void 0 ? void 0 : _a.defaultGroupName) || 'Miscellaneous';
14
- this.strClassGroupContent = '';
15
- this.isInterface = false;
16
- this.isEnum = false;
17
- this.seeList = [];
18
- this.className = '';
19
- if (parent) {
20
- this.cmodelParent = parent;
21
- }
22
- }
23
- getProperties() {
24
- return this.properties;
25
- }
26
- setProperties(properties) {
27
- this.properties = properties;
28
- }
29
- getMethods() {
30
- return this.methods;
31
- }
32
- setMethods(methods) {
33
- this.methods = methods;
34
- }
35
- getChildClasses() {
36
- return this.childClasses;
37
- }
38
- addChildClass(child) {
39
- this.childClasses.push(child);
40
- }
41
- addChildEnum(childEnum) {
42
- this.childEnums.push(childEnum);
43
- }
44
- getChildEnums() {
45
- return this.childEnums;
46
- }
47
- getClassName(includeParent = true) {
48
- if (this.className !== '') {
49
- return this.className;
50
- }
51
- let nameLine = this.getNameLine();
52
- let strParent = '';
53
- if (includeParent) {
54
- strParent = this.cmodelParent == null ? '' : this.cmodelParent.getClassName() + '.';
55
- }
56
- if (nameLine != null)
57
- nameLine = nameLine.trim();
58
- if (nameLine != null && nameLine.trim().length > 0) {
59
- let fFound = nameLine.toLowerCase().indexOf('class ');
60
- let cch = 6;
61
- if (fFound === -1) {
62
- fFound = nameLine.toLowerCase().indexOf('interface ');
63
- cch = 10;
64
- }
65
- if (fFound > -1)
66
- nameLine = nameLine.substring(fFound + cch).trim();
67
- const lFound = nameLine.indexOf(' ');
68
- if (lFound === -1)
69
- return strParent + nameLine;
70
- try {
71
- const name = nameLine.substring(0, lFound);
72
- return strParent + name;
73
- }
74
- catch (ex) {
75
- return strParent + nameLine.substring(nameLine.lastIndexOf(' ') + 1);
76
- }
77
- }
78
- else {
79
- return '';
80
- }
81
- }
82
- setClassName(className) {
83
- this.className = className;
84
- }
85
- getTopmostClassName() {
86
- if (this.cmodelParent != null)
87
- return this.cmodelParent.getClassName();
88
- else
89
- return this.getClassName();
90
- }
91
- getClassGroup() {
92
- if (this.cmodelParent != null)
93
- return this.cmodelParent.getClassGroup();
94
- else
95
- return this.strClassGroup;
96
- }
97
- setClassGroup(strGroup) {
98
- this.strClassGroup = strGroup;
99
- }
100
- getClassGroupContent() {
101
- return this.strClassGroupContent;
102
- }
103
- setClassGroupContent(strGroupContent) {
104
- this.strClassGroupContent = strGroupContent;
105
- }
106
- getIsInterface() {
107
- return this.isInterface;
108
- }
109
- setIsInterface(isInterface) {
110
- this.isInterface = isInterface;
111
- }
112
- getIsEnum() {
113
- return this.isEnum;
114
- }
115
- setIsEnum(isEnum) {
116
- this.isEnum = isEnum;
117
- }
118
- addSee(seeClassName) {
119
- this.seeList.push(seeClassName);
120
- }
121
- getSeeList() {
122
- return this.seeList;
123
- }
124
- }
125
- exports.default = ClassModel;
@@ -1,6 +0,0 @@
1
- import ClassModel from './ClassModel';
2
- export default class EnumModel extends ClassModel {
3
- constructor();
4
- setNameLine(nameLine: string, iLine: number): void;
5
- getClassName(): string;
6
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ClassModel_1 = require("./ClassModel");
4
- class EnumModel extends ClassModel_1.default {
5
- constructor() {
6
- super();
7
- this.setIsEnum(true);
8
- }
9
- setNameLine(nameLine, iLine) {
10
- // remove any trailing stuff after enum name.
11
- const i = nameLine.indexOf('{');
12
- if (i >= 0)
13
- nameLine = nameLine.substring(0, i);
14
- super.setNameLine(nameLine, iLine);
15
- }
16
- getClassName() {
17
- const nameLine = this.getNameLine().trim();
18
- if (nameLine != null && nameLine.length > 0) {
19
- const lastindex = nameLine.lastIndexOf(' ');
20
- if (lastindex >= 0) {
21
- const propertyName = nameLine.substring(lastindex + 1);
22
- return propertyName;
23
- }
24
- }
25
- return '';
26
- }
27
- }
28
- exports.default = EnumModel;
@@ -1,18 +0,0 @@
1
- import ApexModel from './ApexModel';
2
- export default class MethodModel extends ApexModel {
3
- params: string[];
4
- thrownExceptions: string[];
5
- iLine: number | undefined;
6
- returnType: string;
7
- private isConstructor;
8
- setNameLine(nameLine: string, iLine: number): void;
9
- getParams(): string[];
10
- setParams(params: string[]): void;
11
- getThrownExceptions(): string[];
12
- setThrownExceptions(thrownExceptions: string[]): void;
13
- getReturnType(): string;
14
- getMethodName(): string;
15
- getSignature(): string | undefined;
16
- setIsConstructor(isConstructor: boolean): void;
17
- getIsConstructor(): boolean;
18
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ApexModel_1 = require("./ApexModel");
4
- const utils_1 = require("../utils");
5
- class MethodModel extends ApexModel_1.default {
6
- constructor() {
7
- super(...arguments);
8
- this.params = [];
9
- this.thrownExceptions = [];
10
- this.returnType = '';
11
- this.isConstructor = false;
12
- }
13
- setNameLine(nameLine, iLine) {
14
- // remove anything after the parameter list
15
- if (nameLine != null) {
16
- const i = nameLine.lastIndexOf(')');
17
- if (i >= 0)
18
- nameLine = nameLine.substring(0, i + 1);
19
- }
20
- super.setNameLine(nameLine, iLine);
21
- }
22
- getParams() {
23
- return this.params;
24
- }
25
- setParams(params) {
26
- this.params = params;
27
- }
28
- getThrownExceptions() {
29
- return this.thrownExceptions;
30
- }
31
- setThrownExceptions(thrownExceptions) {
32
- this.thrownExceptions = thrownExceptions;
33
- }
34
- getReturnType() {
35
- if (this.isConstructor) {
36
- // If the method is a constructor, then it return the same type as its name.
37
- return this.getMethodName();
38
- }
39
- const nameLine = this.getNameLine().trim();
40
- if (nameLine != null && nameLine.length > 0) {
41
- const lastindex = nameLine.indexOf(this.getMethodName());
42
- if (lastindex >= 0) {
43
- const returnType = utils_1.findPreviousWord(nameLine, lastindex);
44
- return returnType ? returnType : '';
45
- }
46
- }
47
- return '';
48
- }
49
- getMethodName() {
50
- const nameLine = this.getNameLine().trim();
51
- if (nameLine != null && nameLine.length > 0) {
52
- const lastindex = nameLine.indexOf('(');
53
- if (lastindex >= 0) {
54
- const methodName = utils_1.findPreviousWord(nameLine, lastindex);
55
- return methodName ? methodName : '';
56
- }
57
- }
58
- return '';
59
- }
60
- getSignature() {
61
- const nameLine = this.getNameLine().trim();
62
- if (nameLine != null && nameLine.length > 0) {
63
- const beginParen = nameLine.indexOf('(');
64
- return this.getMethodName() + nameLine.substring(beginParen);
65
- }
66
- }
67
- setIsConstructor(isConstructor) {
68
- this.isConstructor = isConstructor;
69
- }
70
- getIsConstructor() {
71
- return this.isConstructor;
72
- }
73
- }
74
- exports.default = MethodModel;
@@ -1,6 +0,0 @@
1
- import ApexModel from './ApexModel';
2
- export default class PropertyModel extends ApexModel {
3
- setNameLine(nameLine: string, iLine: number): void;
4
- getPropertyName(): string;
5
- getReturnType(): string;
6
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ApexModel_1 = require("./ApexModel");
4
- const utils_1 = require("../utils");
5
- class PropertyModel extends ApexModel_1.default {
6
- setNameLine(nameLine, iLine) {
7
- // remove any trailing stuff after property name. { =
8
- let i = nameLine.indexOf('{');
9
- if (i === -1)
10
- i = nameLine.indexOf('=');
11
- if (i === -1)
12
- i = nameLine.indexOf(';');
13
- if (i >= 0)
14
- nameLine = nameLine.substring(0, i);
15
- super.setNameLine(nameLine, iLine);
16
- }
17
- getPropertyName() {
18
- const nameLine = this.getNameLine().trim();
19
- if (nameLine != null && nameLine.length > 0) {
20
- const lastindex = nameLine.lastIndexOf(' ');
21
- if (lastindex >= 0) {
22
- const propertyName = nameLine.substring(lastindex + 1);
23
- return propertyName;
24
- }
25
- }
26
- return '';
27
- }
28
- getReturnType() {
29
- const nameLine = this.getNameLine().trim();
30
- if (nameLine != null && nameLine.length > 0) {
31
- const lastindex = nameLine.indexOf(this.getPropertyName());
32
- if (lastindex >= 0) {
33
- const returnType = utils_1.findPreviousWord(nameLine, lastindex);
34
- return returnType ? returnType : '';
35
- }
36
- }
37
- return '';
38
- }
39
- }
40
- exports.default = PropertyModel;
@@ -1 +0,0 @@
1
- export {};
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const ClassModel_1 = require("../ClassModel");
4
- const PropertyModel_1 = require("../PropertyModel");
5
- const MethodModel_1 = require("../MethodModel");
6
- test('new class model initializes correctly', () => {
7
- const classModel = new ClassModel_1.default();
8
- expect(classModel.getProperties()).toHaveLength(0);
9
- expect(classModel.getMethods()).toHaveLength(0);
10
- expect(classModel.getChildClasses()).toHaveLength(0);
11
- expect(classModel.getClassName()).toBe('');
12
- expect(classModel.getTopmostClassName()).toBe('');
13
- expect(classModel.getClassGroup()).toBe('Miscellaneous');
14
- expect(classModel.getClassGroupContent()).toBe('');
15
- expect(classModel.getIsInterface()).toBe(false);
16
- });
17
- test('can set properties', () => {
18
- const classModel = new ClassModel_1.default();
19
- const properties = [new PropertyModel_1.default()];
20
- classModel.setProperties(properties);
21
- expect(classModel.getProperties()).toBe(properties);
22
- });
23
- test('can set methods', () => {
24
- const classModel = new ClassModel_1.default();
25
- const methods = [new MethodModel_1.default()];
26
- classModel.setMethods(methods);
27
- expect(classModel.getMethods()).toBe(methods);
28
- });
29
- test('can add children', () => {
30
- const classModel = new ClassModel_1.default();
31
- const childClass = new ClassModel_1.default();
32
- classModel.addChildClass(childClass);
33
- expect(classModel.getChildClasses().length).toBe(1);
34
- expect(classModel.getChildClasses()[0]).toBe(childClass);
35
- });
36
- test('class name can be set and retrieved correctly', () => {
37
- const classModel = new ClassModel_1.default();
38
- const nameLine = 'public with sharing class TestClassName {';
39
- classModel.setNameLine(nameLine, 1);
40
- expect(classModel.getClassName()).toBe('TestClassName');
41
- });
42
- test('interface name can be retrieved correctly', () => {
43
- const classModel = new ClassModel_1.default();
44
- const nameLine = 'public interface TestInterfaceName {';
45
- classModel.setNameLine(nameLine, 1);
46
- expect(classModel.getClassName()).toBe('TestInterfaceName');
47
- });
48
- test('topmost class name is the class name when it has no parent', () => {
49
- const classModel = new ClassModel_1.default();
50
- const nameLine = 'public abstract class TestClassName {';
51
- classModel.setNameLine(nameLine, 1);
52
- expect(classModel.getClassName()).toBe('TestClassName');
53
- });
54
- test('topmost class name is parent name', () => {
55
- const parentClass = new ClassModel_1.default();
56
- const nameLine = 'public abstract class TestClassName {';
57
- parentClass.setNameLine(nameLine, 1);
58
- const childClass = new ClassModel_1.default(parentClass);
59
- const nameLineChild = 'private class ChildClassName {';
60
- childClass.setNameLine(nameLineChild, 10);
61
- expect(childClass.getTopmostClassName()).toBe('TestClassName');
62
- });
63
- test('can add group', () => {
64
- const classModel = new ClassModel_1.default();
65
- const groupName = 'GroupName';
66
- classModel.setClassGroup(groupName);
67
- expect(classModel.getClassGroup()).toBe(groupName);
68
- });
69
- test('can add group content', () => {
70
- const classModel = new ClassModel_1.default();
71
- const groupContentName = 'GroupContentName';
72
- classModel.setClassGroupContent(groupContentName);
73
- expect(classModel.getClassGroupContent()).toBe(groupContentName);
74
- });
75
- test('can set as interface', () => {
76
- const classModel = new ClassModel_1.default();
77
- classModel.setIsInterface(true);
78
- expect(classModel.getIsInterface()).toBe(true);
79
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const MethodModel_1 = require("../MethodModel");
4
- test('name line can be set', () => {
5
- const method = new MethodModel_1.default();
6
- const nameLine = 'public static void testMethod() {';
7
- method.setNameLine(nameLine, 1);
8
- // Expected everyhing after the parameter list to be removed
9
- const expected = 'public static void testMethod()';
10
- expect(method.getNameLine()).toBe(expected);
11
- });
12
- test('new method is empty', () => {
13
- const method = new MethodModel_1.default();
14
- expect(method.getParams()).toHaveLength(0);
15
- expect(method.getReturnType()).toBe('');
16
- expect(method.getMethodName()).toBe('');
17
- });
18
- test('params can be set', () => {
19
- const method = new MethodModel_1.default();
20
- const params = ['a', 'b', 'c'];
21
- method.setParams(params);
22
- expect(method.getParams()).toBe(params);
23
- });
24
- test('return type is method name when method is constructor', () => {
25
- const method = new MethodModel_1.default();
26
- const nameLine = 'public TestClass() {';
27
- method.setNameLine(nameLine, 10);
28
- method.setIsConstructor(true);
29
- expect(method.getReturnType()).toBe('TestClass');
30
- });
31
- test('return type returns previous word when method is not constructor', () => {
32
- const method = new MethodModel_1.default();
33
- const nameLine = 'public static void testMethod() {';
34
- method.setNameLine(nameLine, 10);
35
- method.setIsConstructor(false);
36
- expect(method.getReturnType()).toBe('void');
37
- });
38
- test('signature can be retrieved', () => {
39
- const method = new MethodModel_1.default();
40
- const nameLine = 'public static void testMethod() {';
41
- method.setNameLine(nameLine, 10);
42
- method.setIsConstructor(false);
43
- expect(method.getSignature()).toBe('testMethod()');
44
- });
45
- test('method name is retrieved correctly', () => {
46
- const method = new MethodModel_1.default();
47
- const nameLine = 'public static void testMethod() {';
48
- method.setNameLine(nameLine, 1);
49
- expect(method.getMethodName()).toBe('testMethod');
50
- });
51
- test('can get and set if the method is a constructor', () => {
52
- const method = new MethodModel_1.default();
53
- method.setIsConstructor(true);
54
- expect(method.getIsConstructor()).toBe(true);
55
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const PropertyModel_1 = require("../PropertyModel");
4
- test('has no name by defaullt', () => {
5
- const property = new PropertyModel_1.default();
6
- expect(property.getPropertyName()).toBe('');
7
- });
8
- test('can set name line for property', () => {
9
- const nameLine = 'public PropertyName { get; set; }';
10
- const property = new PropertyModel_1.default();
11
- property.setNameLine(nameLine, 1);
12
- expect(property.getPropertyName()).toBe('PropertyName');
13
- });
14
- test('can set name line for null variable', () => {
15
- const nameLine = 'public PropertyName;';
16
- const property = new PropertyModel_1.default();
17
- property.setNameLine(nameLine, 1);
18
- expect(property.getPropertyName()).toBe('PropertyName');
19
- });
20
- test('can set name line for initialized variable', () => {
21
- const nameLine = 'public PropertyName;';
22
- const property = new PropertyModel_1.default();
23
- property.setNameLine(nameLine, 1);
24
- expect(property.getPropertyName()).toBe('PropertyName');
25
- });
@@ -1,5 +0,0 @@
1
- import ClassModel from '../model/ClassModel';
2
- export default class ClassParser {
3
- getClass(strLine: string, lstComments: string[], iLine: number, parent?: ClassModel): ClassModel;
4
- private fillClassModel;
5
- }