@cparra/apexdocs 2.25.0-alpha.0 → 2.25.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/chalk.js +12 -0
- package/__mocks__/log-update.js +6 -0
- package/eslint.config.mjs +10 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.BaseClass.md +16 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.MultiInheritanceClass.md +73 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.ParentInterface.md +15 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.ReferencedEnum.md +8 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.SampleException.md +7 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.SampleInterface.md +115 -0
- package/examples/plain-markdown/docs/Sample-Enums/ns.SampleEnum.md +36 -0
- package/examples/plain-markdown/docs/SampleGroup/ns.SampleClass.md +173 -0
- package/examples/plain-markdown/docs/index.md +33 -0
- package/examples/plain-markdown/force-app/classes/MultiInheritanceClass.cls +1 -0
- package/examples/plain-markdown/force-app/classes/SampleClass.cls +37 -0
- package/examples/plain-markdown/package.json +2 -6
- package/jest.config.js +4 -0
- package/jest.d.ts +7 -0
- package/lib/__spec__/core/expect-extensions.d.ts +3 -0
- package/lib/__spec__/core/expect-extensions.js +54 -0
- package/lib/__spec__/core/expect-extensions.js.map +1 -0
- package/lib/__spec__/core/generating-class-docs.spec.d.ts +1 -0
- package/lib/__spec__/core/generating-class-docs.spec.js +427 -0
- package/lib/__spec__/core/generating-class-docs.spec.js.map +1 -0
- package/lib/__spec__/core/generating-enum-docs.spec.d.ts +1 -0
- package/lib/__spec__/core/generating-enum-docs.spec.js +303 -0
- package/lib/__spec__/core/generating-enum-docs.spec.js.map +1 -0
- package/lib/__spec__/core/generating-interface-docs.spec.d.ts +1 -0
- package/lib/__spec__/core/generating-interface-docs.spec.js +361 -0
- package/lib/__spec__/core/generating-interface-docs.spec.js.map +1 -0
- package/lib/__spec__/core/generating-reference-guide.spec.d.ts +1 -0
- package/lib/__spec__/core/generating-reference-guide.spec.js +161 -0
- package/lib/__spec__/core/generating-reference-guide.spec.js.map +1 -0
- package/lib/adapters/apex-types.d.ts +5 -5
- package/lib/adapters/apex-types.js +97 -22
- package/lib/adapters/apex-types.js.map +1 -1
- package/lib/adapters/documentables.d.ts +4 -3
- package/lib/adapters/documentables.js +23 -8
- package/lib/adapters/documentables.js.map +1 -1
- package/lib/adapters/fields-and-properties.d.ts +4 -3
- package/lib/adapters/fields-and-properties.js +26 -5
- package/lib/adapters/fields-and-properties.js.map +1 -1
- package/lib/adapters/methods-and-constructors.d.ts +4 -3
- package/lib/adapters/methods-and-constructors.js +54 -12
- package/lib/adapters/methods-and-constructors.js.map +1 -1
- package/lib/adapters/references.d.ts +1 -1
- package/lib/adapters/references.js +3 -3
- package/lib/adapters/references.js.map +1 -1
- package/lib/adapters/type-utils.d.ts +1 -1
- package/lib/adapters/type-utils.js +1 -2
- package/lib/adapters/type-utils.js.map +1 -1
- package/lib/application/Apexdocs.js +21 -15
- package/lib/application/Apexdocs.js.map +1 -1
- package/lib/application/flows/generate-markdown-files.d.ts +3 -0
- package/lib/application/flows/generate-markdown-files.js +57 -0
- package/lib/application/flows/generate-markdown-files.js.map +1 -0
- package/lib/cli/generate.js +7 -7
- package/lib/cli/generate.js.map +1 -1
- package/lib/core/__test__/inheritance-chain.test.d.ts +1 -0
- package/lib/core/__test__/inheritance-chain.test.js +42 -0
- package/lib/core/__test__/inheritance-chain.test.js.map +1 -0
- package/lib/core/generate-docs.d.ts +24 -0
- package/lib/core/generate-docs.js +267 -0
- package/lib/core/generate-docs.js.map +1 -0
- package/lib/core/inheritance-chain.d.ts +2 -0
- package/lib/core/inheritance-chain.js +35 -0
- package/lib/core/inheritance-chain.js.map +1 -0
- package/lib/core/template.d.ts +10 -0
- package/lib/core/template.js +92 -0
- package/lib/core/template.js.map +1 -0
- package/lib/core/templates/reference-guide.d.ts +1 -0
- package/lib/core/templates/reference-guide.js +18 -0
- package/lib/core/templates/reference-guide.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +14 -3
- package/lib/index.js.map +1 -1
- package/lib/model/inheritance.d.ts +4 -1
- package/lib/model/manifest.js +8 -2
- package/lib/model/manifest.js.map +1 -1
- package/lib/model/markdown-file.d.ts +2 -2
- package/lib/model/markdown-file.js +5 -4
- package/lib/model/markdown-file.js.map +1 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +3 -4
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +1 -1
- package/lib/model/markdown-generation-util/field-declaration-util.js +1 -2
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/method-declaration-util.js +2 -3
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/type-declaration-util.js +1 -2
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -1
- package/lib/model/markdown-home-file.js.map +1 -1
- package/lib/model/markdown-type-file.js.map +1 -1
- package/lib/model/openapi/open-api.js.map +1 -1
- package/lib/model/outputFile.d.ts +1 -1
- package/lib/model/outputFile.js +2 -9
- package/lib/model/outputFile.js.map +1 -1
- package/lib/model/types-repository.js.map +1 -1
- package/lib/service/apex-file-reader.js.map +1 -1
- package/lib/service/file-writer.js.map +1 -1
- package/lib/service/manifest-factory.js +1 -2
- package/lib/service/manifest-factory.js.map +1 -1
- package/lib/service/metadata-processor.js.map +1 -1
- package/lib/service/parser.js +1 -1
- package/lib/service/parser.js.map +1 -1
- package/lib/service/state.js.map +1 -1
- package/lib/service/walkers/class-walker.js.map +1 -1
- package/lib/service/walkers/interface-walker.js.map +1 -1
- package/lib/service/walkers/walker-factory.js.map +1 -1
- package/lib/service/walkers/walker.js.map +1 -1
- package/lib/settings.d.ts +0 -6
- package/lib/settings.js +0 -11
- package/lib/settings.js.map +1 -1
- package/lib/test-helpers/ClassMirrorBuilder.d.ts +4 -0
- package/lib/test-helpers/ClassMirrorBuilder.js +11 -1
- package/lib/test-helpers/ClassMirrorBuilder.js.map +1 -1
- package/lib/transpiler/factory.js.map +1 -1
- package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +1 -1
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -1
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/class-template.js +53 -12
- package/lib/transpiler/markdown/plain-markdown/class-template.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js +13 -16
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js +11 -8
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/enum-template.js +7 -6
- package/lib/transpiler/markdown/plain-markdown/enum-template.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js +9 -6
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.js +10 -0
- package/lib/transpiler/markdown/plain-markdown/grouped-members-partial-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/interface-template.js +4 -4
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js +18 -20
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.d.ts +0 -4
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js +6 -86
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/type-doc-partial.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/type-doc-partial.js +31 -0
- package/lib/transpiler/markdown/plain-markdown/type-doc-partial.js.map +1 -0
- package/lib/transpiler/openapi/open-api-docs-processor.js.map +1 -1
- package/lib/transpiler/openapi/parsers/Builder.js.map +1 -1
- package/lib/transpiler/openapi/parsers/MethodParser.js.map +1 -1
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +3 -2
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js.map +1 -1
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js.map +1 -1
- package/lib/transpiler/transpiler.js.map +1 -1
- package/lib/util/error-logger.js.map +1 -1
- package/lib/util/logger.js +1 -1
- package/lib/util/logger.js.map +1 -1
- package/lib/util/string-utils.js +2 -2
- package/lib/util/string-utils.js.map +1 -1
- package/package.json +17 -17
- package/src/__spec__/core/expect-extensions.ts +32 -0
- package/src/__spec__/core/generating-class-docs.spec.ts +511 -0
- package/src/__spec__/core/generating-enum-docs.spec.ts +355 -0
- package/src/__spec__/core/generating-interface-docs.spec.ts +431 -0
- package/src/__spec__/core/generating-reference-guide.spec.ts +163 -0
- package/src/adapters/__tests__/interface-adapter.spec.ts +15 -11
- package/src/adapters/__tests__/references.spec.ts +1 -1
- package/src/adapters/apex-types.ts +205 -41
- package/src/adapters/documentables.ts +44 -9
- package/src/adapters/fields-and-properties.ts +31 -7
- package/src/adapters/methods-and-constructors.ts +65 -22
- package/src/adapters/references.ts +1 -1
- package/src/adapters/type-utils.ts +1 -1
- package/src/application/Apexdocs.ts +21 -15
- package/src/application/flows/generate-markdown-files.ts +47 -0
- package/src/cli/generate.ts +96 -96
- package/src/core/__test__/inheritance-chain.test.ts +54 -0
- package/src/core/generate-docs.ts +396 -0
- package/src/core/inheritance-chain.ts +23 -0
- package/src/core/renderable/types.d.ts +131 -0
- package/src/core/template.ts +108 -0
- package/src/core/templates/reference-guide.ts +14 -0
- package/src/index.ts +3 -1
- package/src/model/inheritance.ts +2 -1
- package/src/model/manifest.ts +12 -2
- package/src/model/markdown-file.ts +5 -4
- package/src/model/markdown-generation-util/doc-comment-annotation-util.ts +1 -1
- package/src/model/markdown-generation-util/method-declaration-util.ts +1 -1
- package/src/model/outputFile.ts +2 -11
- package/src/service/parser.ts +1 -1
- package/src/settings.ts +0 -15
- package/src/test-helpers/ClassMirrorBuilder.ts +14 -1
- package/src/transpiler/markdown/class-file-generatorHelper.ts +1 -1
- package/src/transpiler/markdown/plain-markdown/class-template.ts +53 -12
- package/src/transpiler/markdown/plain-markdown/constructors-partial-template.ts +13 -16
- package/src/transpiler/markdown/plain-markdown/documentable-partial-template.ts +11 -8
- package/src/transpiler/markdown/plain-markdown/enum-template.ts +7 -6
- package/src/transpiler/markdown/plain-markdown/fieldsPartialTemplate.ts +9 -6
- package/src/transpiler/markdown/plain-markdown/grouped-members-partial-template.ts +6 -0
- package/src/transpiler/markdown/plain-markdown/interface-template.ts +4 -4
- package/src/transpiler/markdown/plain-markdown/methods-partial-template.ts +18 -20
- package/src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts +8 -100
- package/src/transpiler/markdown/plain-markdown/type-doc-partial.ts +27 -0
- package/src/transpiler/openapi/parsers/ReferenceBuilder.ts +3 -2
- package/src/util/logger.ts +1 -1
- package/tsconfig.json +1 -1
- package/.eslintrc.js +0 -12
- package/examples/plain-markdown/README.md +0 -301
- package/lib/templating/compile.d.ts +0 -7
- package/lib/templating/compile.js +0 -98
- package/lib/templating/compile.js.map +0 -1
- package/lib/templating/helpers.d.ts +0 -2
- package/lib/templating/helpers.js +0 -18
- package/lib/templating/helpers.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.d.ts +0 -1
- package/lib/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.js +0 -31
- package/lib/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.js.map +0 -1
- package/src/templating/__tests__/compile.spec.ts +0 -741
- package/src/templating/compile.ts +0 -187
- package/src/templating/helpers.ts +0 -14
- package/src/templating/types.d.ts +0 -104
- package/src/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.ts +0 -27
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export const interfaceMarkdownTemplate = `
|
|
2
|
-
|
|
2
|
+
{{ heading headingLevel heading }}
|
|
3
3
|
|
|
4
|
-
{{>
|
|
4
|
+
{{> typeDocumentation }}
|
|
5
5
|
|
|
6
6
|
{{#if extends}}
|
|
7
7
|
**Extends**
|
|
8
8
|
{{#each extends}}
|
|
9
|
-
{{this}}{{#unless @last}}, {{/unless}}
|
|
9
|
+
{{link this}}{{#unless @last}}, {{/unless}}
|
|
10
10
|
{{/each}}
|
|
11
11
|
{{/if}}
|
|
12
12
|
|
|
13
13
|
{{#if methods}}
|
|
14
|
-
{{> methodsPartialTemplate}}
|
|
14
|
+
{{> methodsPartialTemplate methods}}
|
|
15
15
|
{{/if}}
|
|
16
16
|
`.trim();
|
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
export const methodsPartialTemplate = `
|
|
2
|
-
|
|
3
|
-
{{#each
|
|
4
|
-
|
|
2
|
+
{{ heading headingLevel heading }}
|
|
3
|
+
{{#each value}}
|
|
4
|
+
{{{ heading headingLevel (inlineCode heading) }}}
|
|
5
5
|
|
|
6
6
|
{{#if inherited}}
|
|
7
7
|
*Inherited*
|
|
8
8
|
{{/if}}
|
|
9
9
|
|
|
10
|
-
{{#> documentablePartialTemplate
|
|
10
|
+
{{#> documentablePartialTemplate}}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{{signature}}
|
|
15
|
-
\`\`\`
|
|
12
|
+
{{ heading signature.headingLevel signature.heading }}
|
|
13
|
+
{{ code "apex" signature.value }}
|
|
16
14
|
|
|
17
|
-
{{#if parameters}}
|
|
18
|
-
|
|
15
|
+
{{#if parameters.value}}
|
|
16
|
+
{{ heading parameters.headingLevel parameters.heading }}
|
|
19
17
|
| Name | Type | Description |
|
|
20
18
|
|------|------|-------------|
|
|
21
|
-
{{#each parameters}}
|
|
22
|
-
| {{name}} | {{type}} | {{description}} |
|
|
19
|
+
{{#each parameters.value}}
|
|
20
|
+
| {{name}} | {{link type}} | {{withLinks description}} |
|
|
23
21
|
{{/each}}
|
|
24
22
|
{{/if}}
|
|
25
23
|
|
|
26
|
-
{{
|
|
27
|
-
|
|
28
|
-
**{{returnType.type}}**
|
|
24
|
+
{{ heading returnType.headingLevel returnType.heading }}
|
|
25
|
+
**{{link returnType.value.type}}**
|
|
29
26
|
|
|
30
|
-
{{returnType.description}}
|
|
27
|
+
{{#if returnType.value.description}}
|
|
28
|
+
{{returnType.value.description}}
|
|
31
29
|
{{/if}}
|
|
32
30
|
|
|
33
|
-
{{#if throws}}
|
|
34
|
-
|
|
35
|
-
{{#each throws}}
|
|
36
|
-
{{this.type}}: {{this.description}}
|
|
31
|
+
{{#if throws.value}}
|
|
32
|
+
{{ heading throws.headingLevel throws.heading }}
|
|
33
|
+
{{#each throws.value}}
|
|
34
|
+
{{link this.type}}: {{this.description}}
|
|
37
35
|
|
|
38
36
|
{{/each}}
|
|
39
37
|
{{/if}}
|
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
2
|
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
3
|
-
import {
|
|
3
|
+
import { Type } from '@cparra/apex-reflection';
|
|
4
4
|
import { OutputFile } from '../../../model/outputFile';
|
|
5
5
|
import { Settings } from '../../../settings';
|
|
6
6
|
import ClassFileGeneratorHelper from '../class-file-generatorHelper';
|
|
7
|
-
import { enumMarkdownTemplate } from './enum-template';
|
|
8
|
-
import { compile } from '../../../templating/compile';
|
|
9
|
-
import { ClassSource, EnumSource, InterfaceSource, Link, RenderableContent } from '../../../templating/types';
|
|
10
|
-
import { interfaceMarkdownTemplate } from './interface-template';
|
|
11
|
-
import { classMarkdownTemplate } from './class-template';
|
|
12
|
-
import { isEmptyLine } from '../../../adapters/type-utils';
|
|
13
|
-
import {
|
|
14
|
-
classTypeToClassSource,
|
|
15
|
-
enumTypeToEnumSource,
|
|
16
|
-
interfaceTypeToInterfaceSource,
|
|
17
|
-
} from '../../../adapters/apex-types';
|
|
18
7
|
import { MarkdownHomeFile } from '../../../model/markdown-home-file';
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import fs from 'fs';
|
|
22
|
-
import path from 'path';
|
|
8
|
+
import { documentType } from '../../../core/generate-docs';
|
|
9
|
+
import { linkFromTypeNameGenerator } from '../../../adapters/references';
|
|
23
10
|
|
|
24
11
|
export class PlainMarkdownDocsProcessor extends MarkdownTranspilerBase {
|
|
25
|
-
_fileContents: string[] = [];
|
|
26
12
|
onBeforeProcess = (types: Type[]) => {
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
-
} else {
|
|
30
|
-
this._fileContainer.pushFile(new MarkdownHomeFile(this.homeFileName(), types));
|
|
31
|
-
}
|
|
13
|
+
this._fileContainer.pushFile(new MarkdownHomeFile(this.homeFileName(), types));
|
|
32
14
|
};
|
|
33
15
|
|
|
34
16
|
homeFileName(): string {
|
|
@@ -40,95 +22,21 @@ export class PlainMarkdownDocsProcessor extends MarkdownTranspilerBase {
|
|
|
40
22
|
}
|
|
41
23
|
|
|
42
24
|
onProcess(type: Type): void {
|
|
43
|
-
|
|
44
|
-
this._fileContents.push(this._generateOutputFile(type).body);
|
|
45
|
-
} else {
|
|
46
|
-
this._fileContainer.pushFile(this._generateOutputFile(type));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
onAfterProcess: (types: Type[]) => void = () => {
|
|
51
|
-
if (Settings.getInstance().shouldOutputSingleFile()) {
|
|
52
|
-
const file = new MarkdownFile(Settings.getInstance().getSingleFileName(), '');
|
|
53
|
-
|
|
54
|
-
let contents;
|
|
55
|
-
if (Settings.getInstance().getTemplateFilePath()) {
|
|
56
|
-
const filePath = path.resolve(Settings.getInstance().getTemplateFilePath()!);
|
|
57
|
-
const templateFileContents = fs.readFileSync(filePath, {
|
|
58
|
-
encoding: 'utf-8',
|
|
59
|
-
});
|
|
60
|
-
const handlebars = Handlebars.compile(templateFileContents);
|
|
61
|
-
contents = handlebars({ api_docs: this._fileContents.join('\n\n---\n\n') });
|
|
62
|
-
} else {
|
|
63
|
-
contents = this._fileContents.join('\n\n---\n\n');
|
|
64
|
-
}
|
|
65
|
-
file.addText(contents);
|
|
66
|
-
this._fileContainer.pushFile(file);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
_generateOutputFile(type: Type): OutputFile {
|
|
71
|
-
if (type.type_name === 'enum') {
|
|
72
|
-
return new GenericFile<EnumMirror>(type as EnumMirror, enumTypeToEnumSource, enumMarkdownTemplate);
|
|
73
|
-
} else if (type.type_name === 'interface') {
|
|
74
|
-
return new GenericFile<InterfaceMirror>(
|
|
75
|
-
type as InterfaceMirror,
|
|
76
|
-
interfaceTypeToInterfaceSource,
|
|
77
|
-
interfaceMarkdownTemplate,
|
|
78
|
-
);
|
|
79
|
-
} else {
|
|
80
|
-
return new GenericFile<ClassMirror>(type as ClassMirror, classTypeToClassSource, classMarkdownTemplate);
|
|
81
|
-
}
|
|
25
|
+
this._fileContainer.pushFile(new GenericFile(type));
|
|
82
26
|
}
|
|
83
27
|
}
|
|
84
28
|
|
|
85
|
-
class GenericFile
|
|
86
|
-
constructor(private type:
|
|
29
|
+
class GenericFile extends OutputFile {
|
|
30
|
+
constructor(private type: Type) {
|
|
87
31
|
super(
|
|
88
32
|
`${Settings.getInstance().getNamespacePrefix()}${type.name}`,
|
|
89
33
|
ClassFileGeneratorHelper.getSanitizedGroup(type),
|
|
90
34
|
);
|
|
91
35
|
|
|
92
|
-
|
|
93
|
-
this.addText(
|
|
94
|
-
compile(template, source, {
|
|
95
|
-
renderableContentConverter: prepareDescription,
|
|
96
|
-
codeBlockConverter: convertCodeBlock,
|
|
97
|
-
}),
|
|
98
|
-
);
|
|
36
|
+
this.addText(documentType(type, linkFromTypeNameGenerator, Settings.getInstance().getNamespace()));
|
|
99
37
|
}
|
|
100
38
|
|
|
101
39
|
fileExtension(): string {
|
|
102
40
|
return '.md';
|
|
103
41
|
}
|
|
104
42
|
}
|
|
105
|
-
|
|
106
|
-
function prepareDescription(description?: RenderableContent[]) {
|
|
107
|
-
if (!description) {
|
|
108
|
-
return '';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function reduceDescription(acc: string, curr: RenderableContent) {
|
|
112
|
-
if (typeof curr === 'string') {
|
|
113
|
-
return acc + curr.trim() + ' ';
|
|
114
|
-
} else if (isEmptyLine(curr)) {
|
|
115
|
-
return acc + '\n\n';
|
|
116
|
-
} else {
|
|
117
|
-
return acc + linkToMarkdown(curr) + ' ';
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function linkToMarkdown(link: Link) {
|
|
122
|
-
return `[${link.title}](${link.url})`;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return description.reduce(reduceDescription, '').trim();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function convertCodeBlock(language: string, lines: string[]): string {
|
|
129
|
-
return `
|
|
130
|
-
\`\`\`${language}
|
|
131
|
-
${lines.join('\n')}
|
|
132
|
-
\`\`\`
|
|
133
|
-
`.trim();
|
|
134
|
-
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const typeDocPartial = `
|
|
2
|
+
{{#> documentablePartialTemplate}}
|
|
3
|
+
|
|
4
|
+
{{#if doc.group}}
|
|
5
|
+
**Group** {{doc.group}}
|
|
6
|
+
{{/if}}
|
|
7
|
+
|
|
8
|
+
{{#if doc.author}}
|
|
9
|
+
**Author** {{doc.author}}
|
|
10
|
+
{{/if}}
|
|
11
|
+
|
|
12
|
+
{{#if doc.date}}
|
|
13
|
+
**Date** {{doc.date}}
|
|
14
|
+
{{/if}}
|
|
15
|
+
|
|
16
|
+
{{#each doc.sees}}
|
|
17
|
+
**See** {{link this}}
|
|
18
|
+
|
|
19
|
+
{{/each}}
|
|
20
|
+
|
|
21
|
+
{{#if namespace}}
|
|
22
|
+
## Namespace
|
|
23
|
+
{{namespace}}
|
|
24
|
+
{{/if}}
|
|
25
|
+
|
|
26
|
+
{{/documentablePartialTemplate}}
|
|
27
|
+
`.trim();
|
|
@@ -227,7 +227,7 @@ export class ReferenceBuilder {
|
|
|
227
227
|
return { schema: { type: 'object' }, referenceComponents: [] };
|
|
228
228
|
case 'object':
|
|
229
229
|
return { schema: { type: 'object' }, referenceComponents: [] };
|
|
230
|
-
default:
|
|
230
|
+
default: {
|
|
231
231
|
// If we got here we are dealing with a non-primitive (most likely a custom class or an SObject).
|
|
232
232
|
const referencedType = TypesRepository.getInstance().getFromAllByName(typeName);
|
|
233
233
|
if (!referencedType) {
|
|
@@ -243,6 +243,7 @@ export class ReferenceBuilder {
|
|
|
243
243
|
schema: reference.entrypointReferenceObject,
|
|
244
244
|
referenceComponents: [...reference.referenceComponents],
|
|
245
245
|
};
|
|
246
|
+
}
|
|
246
247
|
}
|
|
247
248
|
}
|
|
248
249
|
|
|
@@ -266,7 +267,7 @@ type SchemaObjectReferencePair = {
|
|
|
266
267
|
|
|
267
268
|
class ReferenceOverrides {
|
|
268
269
|
static build(referenceAsString: string): ReferenceOverride[] {
|
|
269
|
-
const cleanedUpReference = referenceAsString.replace(/[
|
|
270
|
+
const cleanedUpReference = referenceAsString.replace(/[[\]]/g, '');
|
|
270
271
|
const referenceStrings = cleanedUpReference.split(',').map((item) => item.replace(/\s/g, ''));
|
|
271
272
|
return referenceStrings.map((item) => {
|
|
272
273
|
const [propertyName, referenceName] = item.split(':');
|
package/src/util/logger.ts
CHANGED
package/tsconfig.json
CHANGED
package/.eslintrc.js
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
# Template file
|
|
2
|
-
|
|
3
|
-
# BaseClass Class
|
|
4
|
-
`abstract`
|
|
5
|
-
|
|
6
|
-
## Namespace
|
|
7
|
-
ns
|
|
8
|
-
|
|
9
|
-
## Fields
|
|
10
|
-
### `sampleEnumFromBase`
|
|
11
|
-
|
|
12
|
-
#### Type
|
|
13
|
-
[ns.SampleEnum](../Sample-Enums/ns.SampleEnum.md)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
# ParentInterface Interface
|
|
19
|
-
|
|
20
|
-
## Namespace
|
|
21
|
-
ns
|
|
22
|
-
|
|
23
|
-
## Methods
|
|
24
|
-
### `sampleParentMethod()`
|
|
25
|
-
|
|
26
|
-
### Signature
|
|
27
|
-
```apex
|
|
28
|
-
public void sampleParentMethod()
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Returns
|
|
32
|
-
**void**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
# ReferencedEnum Enum
|
|
38
|
-
|
|
39
|
-
## Namespace
|
|
40
|
-
ns
|
|
41
|
-
|
|
42
|
-
## Enum Values
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
# SampleClass Class
|
|
48
|
-
`virtual`
|
|
49
|
-
|
|
50
|
-
aliquip ex sunt officia ullamco anim deserunt magna aliquip nisi eiusmod in sit officia veniam ex
|
|
51
|
-
|
|
52
|
-
deserunt ea officia exercitation laboris enim in duis quis enim eiusmod eu amet cupidatat.
|
|
53
|
-
|
|
54
|
-
**Group** SampleGroup
|
|
55
|
-
|
|
56
|
-
## Namespace
|
|
57
|
-
ns
|
|
58
|
-
|
|
59
|
-
## Example
|
|
60
|
-
```apex
|
|
61
|
-
SampleClass sample = new SampleClass();
|
|
62
|
-
sample.doSomething();
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Extends**
|
|
66
|
-
[ns.BaseClass](../Miscellaneous/ns.BaseClass.md)
|
|
67
|
-
|
|
68
|
-
**Implements**
|
|
69
|
-
[ns.SampleInterface](../Miscellaneous/ns.SampleInterface.md),
|
|
70
|
-
[ns.ParentInterface](../Miscellaneous/ns.ParentInterface.md)
|
|
71
|
-
|
|
72
|
-
## Fields
|
|
73
|
-
### `name`
|
|
74
|
-
|
|
75
|
-
This is a sample field.
|
|
76
|
-
|
|
77
|
-
#### Type
|
|
78
|
-
String
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
### `sampleEnumFromBase`
|
|
83
|
-
|
|
84
|
-
*Inherited*
|
|
85
|
-
|
|
86
|
-
#### Type
|
|
87
|
-
[ns.SampleEnum](../Sample-Enums/ns.SampleEnum.md)
|
|
88
|
-
|
|
89
|
-
## Constructors
|
|
90
|
-
### `SampleClass()`
|
|
91
|
-
|
|
92
|
-
This is a sample constructor.
|
|
93
|
-
|
|
94
|
-
### Signature
|
|
95
|
-
```apex
|
|
96
|
-
public SampleClass()
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
### `SampleClass(name)`
|
|
101
|
-
|
|
102
|
-
### Signature
|
|
103
|
-
```apex
|
|
104
|
-
public SampleClass(String name)
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Parameters
|
|
108
|
-
| Name | Type | Description |
|
|
109
|
-
|------|------|-------------|
|
|
110
|
-
| name | String | |
|
|
111
|
-
|
|
112
|
-
## Methods
|
|
113
|
-
### `sayHello()`
|
|
114
|
-
|
|
115
|
-
`DEPRECATED`
|
|
116
|
-
|
|
117
|
-
This is a sample method.
|
|
118
|
-
|
|
119
|
-
### Signature
|
|
120
|
-
```apex
|
|
121
|
-
public virtual String sayHello()
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Returns
|
|
125
|
-
**String**
|
|
126
|
-
|
|
127
|
-
A string value.
|
|
128
|
-
|
|
129
|
-
### Example
|
|
130
|
-
```apex
|
|
131
|
-
SampleClass sample = new SampleClass();
|
|
132
|
-
sample.doSomething();
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
# SampleEnum Enum
|
|
139
|
-
|
|
140
|
-
`NAMESPACEACCESSIBLE`
|
|
141
|
-
|
|
142
|
-
This is a sample enum. This references [ns.ReferencedEnum](../Miscellaneous/ns.ReferencedEnum.md) .
|
|
143
|
-
|
|
144
|
-
This description has several lines
|
|
145
|
-
|
|
146
|
-
**Some Custom**
|
|
147
|
-
|
|
148
|
-
**Group** Sample Enums
|
|
149
|
-
|
|
150
|
-
**Author** John Doe
|
|
151
|
-
|
|
152
|
-
**Date** 2022-01-01
|
|
153
|
-
|
|
154
|
-
**See** [ns.ReferencedEnum](../Miscellaneous/ns.ReferencedEnum.md)
|
|
155
|
-
|
|
156
|
-
## Namespace
|
|
157
|
-
ns
|
|
158
|
-
|
|
159
|
-
```mermaid
|
|
160
|
-
graph TD
|
|
161
|
-
A[SampleEnum] -->|references| B[ReferencedEnum]
|
|
162
|
-
B -->|referenced by| A
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## Enum Values
|
|
166
|
-
### VALUE1
|
|
167
|
-
This is value 1
|
|
168
|
-
### VALUE2
|
|
169
|
-
This is value 2
|
|
170
|
-
### VALUE3
|
|
171
|
-
This is value 3
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
# SampleException Class
|
|
177
|
-
|
|
178
|
-
## Namespace
|
|
179
|
-
ns
|
|
180
|
-
|
|
181
|
-
**Extends**
|
|
182
|
-
Exception
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
# SampleInterface Interface
|
|
188
|
-
|
|
189
|
-
`NAMESPACEACCESSIBLE`
|
|
190
|
-
|
|
191
|
-
This is a sample interface
|
|
192
|
-
|
|
193
|
-
**Author** John Doe
|
|
194
|
-
|
|
195
|
-
**Date** 2020-01-01
|
|
196
|
-
|
|
197
|
-
**See** [ns.SampleEnum](../Sample-Enums/ns.SampleEnum.md)
|
|
198
|
-
|
|
199
|
-
**See** [ns.ReferencedEnum](./ns.ReferencedEnum.md)
|
|
200
|
-
|
|
201
|
-
## Namespace
|
|
202
|
-
ns
|
|
203
|
-
|
|
204
|
-
```mermaid
|
|
205
|
-
graph TD
|
|
206
|
-
A[SampleInterface] -->|extends| B[ParentInterface]
|
|
207
|
-
B -->|extends| C[GrandParentInterface]
|
|
208
|
-
C -->|extends| D[GreatGrandParentInterface]
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## Example
|
|
212
|
-
```apex
|
|
213
|
-
SampleInterface sampleInterface = new SampleInterface();
|
|
214
|
-
sampleInterface.sampleMethod();
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
**Extends**
|
|
218
|
-
[ns.ParentInterface](./ns.ParentInterface.md)
|
|
219
|
-
|
|
220
|
-
## Methods
|
|
221
|
-
### `sampleMethod()`
|
|
222
|
-
|
|
223
|
-
`NAMESPACEACCESSIBLE`
|
|
224
|
-
|
|
225
|
-
This is a sample method
|
|
226
|
-
|
|
227
|
-
**Custom Tag**
|
|
228
|
-
|
|
229
|
-
**Another Custom Tag**
|
|
230
|
-
|
|
231
|
-
### Signature
|
|
232
|
-
```apex
|
|
233
|
-
public String sampleMethod()
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Returns
|
|
237
|
-
**String**
|
|
238
|
-
|
|
239
|
-
Some return value
|
|
240
|
-
|
|
241
|
-
### Throws
|
|
242
|
-
[ns.SampleException](./ns.SampleException.md): This is a sample exception
|
|
243
|
-
|
|
244
|
-
AnotherSampleException: This is another sample exception
|
|
245
|
-
|
|
246
|
-
```mermaid
|
|
247
|
-
graph TD
|
|
248
|
-
A[SampleInterface] -->|extends| B[ParentInterface]
|
|
249
|
-
B -->|extends| C[GrandParentInterface]
|
|
250
|
-
C -->|extends| D[GreatGrandParentInterface]
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Example
|
|
254
|
-
```apex
|
|
255
|
-
SampleInterface sampleInterface = new SampleInterface();
|
|
256
|
-
sampleInterface.sampleMethod();
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
### `sampleMethodWithParams(param1, param2, theEnum)`
|
|
262
|
-
|
|
263
|
-
`NAMESPACEACCESSIBLE`
|
|
264
|
-
`DEPRECATED`
|
|
265
|
-
|
|
266
|
-
This is a sample method with parameters
|
|
267
|
-
|
|
268
|
-
Sometimes it won't be possible to find a NonExistent link.
|
|
269
|
-
|
|
270
|
-
### Signature
|
|
271
|
-
```apex
|
|
272
|
-
public SampleEnum sampleMethodWithParams(String param1, Integer param2, SampleEnum theEnum)
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### Parameters
|
|
276
|
-
| Name | Type | Description |
|
|
277
|
-
|------|------|-------------|
|
|
278
|
-
| param1 | String | This is the first parameter |
|
|
279
|
-
| param2 | Integer | This is the second parameter |
|
|
280
|
-
| theEnum | [ns.SampleEnum](../Sample-Enums/ns.SampleEnum.md) | This is an enum parameter |
|
|
281
|
-
|
|
282
|
-
### Returns
|
|
283
|
-
**[ns.SampleEnum](../Sample-Enums/ns.SampleEnum.md)**
|
|
284
|
-
|
|
285
|
-
Some return value
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
### `sampleParentMethod()`
|
|
290
|
-
|
|
291
|
-
*Inherited*
|
|
292
|
-
|
|
293
|
-
### Signature
|
|
294
|
-
```apex
|
|
295
|
-
public void sampleParentMethod()
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Returns
|
|
299
|
-
**void**
|
|
300
|
-
|
|
301
|
-
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { EnumSource, ConvertRenderableContentsToString, InterfaceSource, ClassSource } from './types';
|
|
2
|
-
type CompileOptions = {
|
|
3
|
-
renderableContentConverter: ConvertRenderableContentsToString;
|
|
4
|
-
codeBlockConverter: (language: string, lines: string[]) => string;
|
|
5
|
-
};
|
|
6
|
-
export declare function compile(template: string, source: EnumSource | InterfaceSource | ClassSource, options: CompileOptions): string;
|
|
7
|
-
export {};
|