@cparra/apexdocs 2.23.0 → 2.25.0-alpha.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/.github/workflows/ci.yaml +22 -0
- package/README.md +40 -16
- package/examples/plain-markdown/.forceignore +12 -0
- package/examples/plain-markdown/README.md +301 -0
- package/examples/plain-markdown/config/project-scratch-def.json +5 -0
- package/examples/plain-markdown/force-app/classes/BaseClass.cls +3 -0
- package/examples/plain-markdown/force-app/classes/ParentInterface.cls +3 -0
- package/examples/plain-markdown/force-app/classes/ReferencedEnum.cls +3 -0
- package/examples/plain-markdown/force-app/classes/SampleClass.cls +35 -0
- package/examples/plain-markdown/force-app/classes/SampleEnum.cls +30 -0
- package/examples/plain-markdown/force-app/classes/SampleException.cls +1 -0
- package/examples/plain-markdown/force-app/classes/SampleInterface.cls +46 -0
- package/examples/plain-markdown/package-lock.json +665 -0
- package/examples/plain-markdown/package.json +24 -0
- package/examples/plain-markdown/sfdx-project.json +12 -0
- package/examples/plain-markdown/template.md +3 -0
- package/lib/adapters/apex-types.d.ts +5 -0
- package/lib/adapters/apex-types.js +34 -0
- package/lib/adapters/apex-types.js.map +1 -0
- package/lib/adapters/documentables.d.ts +6 -0
- package/lib/adapters/documentables.js +41 -0
- package/lib/adapters/documentables.js.map +1 -0
- package/lib/adapters/fields-and-properties.d.ts +3 -0
- package/lib/adapters/fields-and-properties.js +10 -0
- package/lib/adapters/fields-and-properties.js.map +1 -0
- package/lib/adapters/methods-and-constructors.d.ts +4 -0
- package/lib/adapters/methods-and-constructors.js +49 -0
- package/lib/adapters/methods-and-constructors.js.map +1 -0
- package/lib/adapters/references.d.ts +5 -0
- package/lib/adapters/references.js +82 -0
- package/lib/adapters/references.js.map +1 -0
- package/lib/adapters/type-utils.d.ts +2 -0
- package/lib/adapters/type-utils.js +8 -0
- package/lib/adapters/type-utils.js.map +1 -0
- package/lib/application/Apexdocs.js +5 -2
- package/lib/application/Apexdocs.js.map +1 -1
- package/lib/cli/generate.js +28 -2
- package/lib/cli/generate.js.map +1 -1
- package/lib/model/manifest.d.ts +1 -1
- package/lib/model/manifest.js +2 -2
- package/lib/model/manifest.js.map +1 -1
- package/lib/model/markdown-file.js +5 -2
- package/lib/model/markdown-file.js.map +1 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +4 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +1 -1
- package/lib/model/markdown-home-file.js +4 -1
- package/lib/model/markdown-home-file.js.map +1 -1
- package/lib/model/markdown-type-file.js +4 -1
- package/lib/model/markdown-type-file.js.map +1 -1
- package/lib/model/openapi/open-api-types.d.ts +2 -2
- package/lib/service/apex-file-reader.js +4 -1
- package/lib/service/apex-file-reader.js.map +1 -1
- package/lib/service/file-system.js +25 -2
- package/lib/service/file-system.js.map +1 -1
- package/lib/service/file-writer.js +25 -2
- package/lib/service/file-writer.js.map +1 -1
- package/lib/service/manifest-factory.js +4 -1
- package/lib/service/manifest-factory.js.map +1 -1
- package/lib/service/parser.js +4 -1
- package/lib/service/parser.js.map +1 -1
- package/lib/settings.d.ts +6 -0
- package/lib/settings.js +11 -0
- package/lib/settings.js.map +1 -1
- package/lib/templating/compile.d.ts +7 -0
- package/lib/templating/compile.js +98 -0
- package/lib/templating/compile.js.map +1 -0
- package/lib/templating/helpers.d.ts +2 -0
- package/lib/templating/helpers.js +18 -0
- package/lib/templating/helpers.js.map +1 -0
- package/lib/test-helpers/FieldMirrorBuilder.d.ts +1 -1
- package/lib/test-helpers/InterfaceMirrorBuilder.d.ts +16 -0
- package/lib/test-helpers/InterfaceMirrorBuilder.js +43 -0
- package/lib/test-helpers/InterfaceMirrorBuilder.js.map +1 -0
- package/lib/test-helpers/MethodMirrorBuilder.d.ts +20 -1
- package/lib/test-helpers/MethodMirrorBuilder.js +41 -6
- package/lib/test-helpers/MethodMirrorBuilder.js.map +1 -1
- package/lib/transpiler/factory.js +4 -1
- package/lib/transpiler/factory.js.map +1 -1
- package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +3 -0
- package/lib/transpiler/markdown/class-file-generatorHelper.js +21 -2
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -1
- package/lib/transpiler/markdown/markdown-transpiler-base.js +4 -1
- package/lib/transpiler/markdown/markdown-transpiler-base.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/class-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/class-template.js +36 -0
- package/lib/transpiler/markdown/plain-markdown/class-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js +39 -0
- package/lib/transpiler/markdown/plain-markdown/constructors-partial-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js +25 -0
- package/lib/transpiler/markdown/plain-markdown/documentable-partial-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/enum-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/enum-template.js +15 -0
- package/lib/transpiler/markdown/plain-markdown/enum-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js +24 -0
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/interface-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/interface-template.js +20 -0
- package/lib/transpiler/markdown/plain-markdown/interface-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js +49 -0
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.d.ts +7 -0
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js +108 -0
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js.map +1 -1
- package/lib/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.d.ts +1 -0
- package/lib/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.js +31 -0
- package/lib/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.js.map +1 -0
- package/lib/transpiler/openapi/open-api-docs-processor.js +4 -1
- 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 +25 -2
- package/lib/transpiler/openapi/parsers/MethodParser.js.map +1 -1
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +25 -2
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js.map +1 -1
- package/lib/transpiler/transpiler.js +4 -1
- package/lib/transpiler/transpiler.js.map +1 -1
- package/lib/util/error-logger.js +4 -4
- package/lib/util/error-logger.js.map +1 -1
- package/lib/util/logger.js +10 -7
- package/lib/util/logger.js.map +1 -1
- package/package.json +16 -15
- package/src/adapters/__tests__/interface-adapter.spec.ts +76 -0
- package/src/adapters/__tests__/references.spec.ts +115 -0
- package/src/adapters/apex-types.ts +67 -0
- package/src/adapters/documentables.ts +58 -0
- package/src/adapters/fields-and-properties.ts +14 -0
- package/src/adapters/methods-and-constructors.ts +78 -0
- package/src/adapters/references.ts +113 -0
- package/src/adapters/type-utils.ts +5 -0
- package/src/adapters/types.d.ts +8 -0
- package/src/cli/generate.ts +3 -0
- package/src/model/__tests__/manifest.spec.ts +1 -0
- package/src/model/manifest.ts +3 -3
- package/src/model/markdown-file.ts +1 -1
- package/src/model/openapi/open-api-types.ts +2 -2
- package/src/service/__tests__/apex-file-reader.spec.ts +4 -4
- package/src/service/__tests__/manifest-factory.spec.ts +1 -2
- package/src/settings.ts +15 -0
- package/src/templating/__tests__/compile.spec.ts +741 -0
- package/src/templating/compile.ts +187 -0
- package/src/templating/helpers.ts +14 -0
- package/src/templating/types.d.ts +104 -0
- package/src/test-helpers/FieldMirrorBuilder.ts +1 -1
- package/src/test-helpers/InterfaceMirrorBuilder.ts +44 -0
- package/src/test-helpers/MethodMirrorBuilder.ts +46 -6
- package/src/transpiler/markdown/class-file-generatorHelper.ts +22 -2
- package/src/transpiler/markdown/plain-markdown/class-template.ts +32 -0
- package/src/transpiler/markdown/plain-markdown/constructors-partial-template.ts +35 -0
- package/src/transpiler/markdown/plain-markdown/documentable-partial-template.ts +21 -0
- package/src/transpiler/markdown/plain-markdown/enum-template.ts +11 -0
- package/src/transpiler/markdown/plain-markdown/fieldsPartialTemplate.ts +20 -0
- package/src/transpiler/markdown/plain-markdown/interface-template.ts +16 -0
- package/src/transpiler/markdown/plain-markdown/methods-partial-template.ts +45 -0
- package/src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts +122 -0
- package/src/transpiler/markdown/plain-markdown/type-level-apex-doc-partial-template.ts +27 -0
- package/src/transpiler/openapi/parsers/Builder.ts +1 -1
- package/src/transpiler/openapi/parsers/MethodParser.ts +1 -1
- package/src/transpiler/openapi/parsers/ReferenceBuilder.ts +1 -1
- package/src/util/error-logger.ts +4 -4
- package/src/util/logger.ts +3 -3
- package/tsconfig.json +1 -0
- package/lib/model/manifest-diff.d.ts +0 -27
- package/lib/model/manifest-diff.js +0 -69
- package/lib/model/manifest-diff.js.map +0 -1
- package/src/model/__tests__/manifest-diff.spec.ts +0 -139
- package/src/model/manifest-diff.ts +0 -94
- /package/docs/{README.md → __old/README.md} +0 -0
- /package/docs/{index.html → __old/index.html} +0 -0
- /package/docs/{restapi.json → __old/restapi.json} +0 -0
- /package/docs/{types → __old/types}/Classes/nspc.AnotherInterface.md +0 -0
- /package/docs/{types → __old/types}/Classes/nspc.ChildClass.md +0 -0
- /package/docs/{types → __old/types}/Main/nspc.GroupedClass.md +0 -0
- /package/docs/{types → __old/types}/Main/nspc.SampleClass.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.EscapedAnnotations.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.GrandparentClass.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.InterfaceWithInheritance.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.MemberGrouping.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.ParentClass.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.Reference1.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.Reference2.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.Reference3.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.Reference4.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.Reference5.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.Reference6.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.Reference7.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.SampleClassWithoutModifier.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.SampleRestResource.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.SampleRestResourceWithInnerClass.md +0 -0
- /package/docs/{types → __old/types}/Misc-Group/nspc.SampleRestResourceWithoutApexDocs.md +0 -0
- /package/docs/{types → __old/types}/README.md +0 -0
- /package/docs/{types → __old/types}/Sample-Interfaces/nspc.SampleInterface.md +0 -0
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
2
|
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
3
|
+
import { ClassMirror, EnumMirror, InterfaceMirror, Type } from '@cparra/apex-reflection';
|
|
4
|
+
import { OutputFile } from '../../../model/outputFile';
|
|
5
|
+
import { Settings } from '../../../settings';
|
|
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
|
+
import { MarkdownHomeFile } from '../../../model/markdown-home-file';
|
|
19
|
+
import { MarkdownFile } from '../../../model/markdown-file';
|
|
20
|
+
import Handlebars from 'handlebars';
|
|
21
|
+
import fs from 'fs';
|
|
22
|
+
import path from 'path';
|
|
3
23
|
|
|
4
24
|
export class PlainMarkdownDocsProcessor extends MarkdownTranspilerBase {
|
|
25
|
+
_fileContents: string[] = [];
|
|
26
|
+
onBeforeProcess = (types: Type[]) => {
|
|
27
|
+
if (Settings.getInstance().shouldOutputSingleFile()) {
|
|
28
|
+
return;
|
|
29
|
+
} else {
|
|
30
|
+
this._fileContainer.pushFile(new MarkdownHomeFile(this.homeFileName(), types));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
5
34
|
homeFileName(): string {
|
|
6
35
|
return 'index';
|
|
7
36
|
}
|
|
@@ -9,4 +38,97 @@ export class PlainMarkdownDocsProcessor extends MarkdownTranspilerBase {
|
|
|
9
38
|
getLinkingStrategy(): LinkingStrategy {
|
|
10
39
|
return 'path-relative';
|
|
11
40
|
}
|
|
41
|
+
|
|
42
|
+
onProcess(type: Type): void {
|
|
43
|
+
if (Settings.getInstance().shouldOutputSingleFile()) {
|
|
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
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
class GenericFile<T extends Type> extends OutputFile {
|
|
86
|
+
constructor(private type: T, toSource: (type: T) => EnumSource | InterfaceSource | ClassSource, template: string) {
|
|
87
|
+
super(
|
|
88
|
+
`${Settings.getInstance().getNamespacePrefix()}${type.name}`,
|
|
89
|
+
ClassFileGeneratorHelper.getSanitizedGroup(type),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const source = toSource(type);
|
|
93
|
+
this.addText(
|
|
94
|
+
compile(template, source, {
|
|
95
|
+
renderableContentConverter: prepareDescription,
|
|
96
|
+
codeBlockConverter: convertCodeBlock,
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
fileExtension(): string {
|
|
102
|
+
return '.md';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
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();
|
|
12
134
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const typeLevelApexDocPartialTemplate = `
|
|
2
|
+
{{#> documentablePartialTemplate}}
|
|
3
|
+
|
|
4
|
+
{{#if group}}
|
|
5
|
+
**Group** {{group}}
|
|
6
|
+
{{/if}}
|
|
7
|
+
|
|
8
|
+
{{#if author}}
|
|
9
|
+
**Author** {{author}}
|
|
10
|
+
{{/if}}
|
|
11
|
+
|
|
12
|
+
{{#if date}}
|
|
13
|
+
**Date** {{date}}
|
|
14
|
+
{{/if}}
|
|
15
|
+
|
|
16
|
+
{{#each sees}}
|
|
17
|
+
**See** {{this}}
|
|
18
|
+
|
|
19
|
+
{{/each}}
|
|
20
|
+
|
|
21
|
+
{{#if namespace}}
|
|
22
|
+
## Namespace
|
|
23
|
+
{{namespace}}
|
|
24
|
+
{{/if}}
|
|
25
|
+
|
|
26
|
+
{{/documentablePartialTemplate}}
|
|
27
|
+
`.trim();
|
|
@@ -29,7 +29,7 @@ export abstract class Builder<T, K> {
|
|
|
29
29
|
return schemaAware.schema;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
private isReferenceString = (targetObject:
|
|
32
|
+
private isReferenceString = (targetObject: unknown): targetObject is string => {
|
|
33
33
|
return typeof targetObject === 'string' || targetObject instanceof String;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -95,7 +95,7 @@ export class MethodParser {
|
|
|
95
95
|
|
|
96
96
|
for (const annotation of annotations) {
|
|
97
97
|
// We expect the ApexDoc data representing this to be in YAML format.
|
|
98
|
-
const inYaml = annotation?.bodyLines.reduce((prev, current
|
|
98
|
+
const inYaml = annotation?.bodyLines.reduce((prev, current) => prev + '\n' + current);
|
|
99
99
|
|
|
100
100
|
if (!inYaml) {
|
|
101
101
|
return;
|
|
@@ -131,7 +131,7 @@ export class ReferenceBuilder {
|
|
|
131
131
|
referencedComponents: ReferenceComponent[],
|
|
132
132
|
) {
|
|
133
133
|
// This can be of type ApexDocSchemaObject
|
|
134
|
-
const inYaml = manuallyDefinedHttpSchema?.bodyLines.reduce((prev, current
|
|
134
|
+
const inYaml = manuallyDefinedHttpSchema?.bodyLines.reduce((prev, current) => prev + '\n' + current);
|
|
135
135
|
const asJson = yaml.load(inYaml) as ApexDocSchemaObject;
|
|
136
136
|
const isReferenceString = this.isReferenceString(asJson);
|
|
137
137
|
|
package/src/util/error-logger.ts
CHANGED
|
@@ -8,7 +8,7 @@ export default class ErrorLogger {
|
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
private static logErrorsForSingleType(currentType: Type
|
|
11
|
+
private static logErrorsForSingleType(currentType: Type): void {
|
|
12
12
|
this.logTypeErrors(currentType);
|
|
13
13
|
|
|
14
14
|
if (currentType.type_name === 'class') {
|
|
@@ -67,15 +67,15 @@ export default class ErrorLogger {
|
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
classMirror.enums.forEach((currentEnum) => {
|
|
70
|
-
this.logErrorsForSingleType(currentEnum
|
|
70
|
+
this.logErrorsForSingleType(currentEnum);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
classMirror.interfaces.forEach((currentInterface) => {
|
|
74
|
-
this.logErrorsForSingleType(currentInterface
|
|
74
|
+
this.logErrorsForSingleType(currentInterface);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
classMirror.classes.forEach((currentClass) => {
|
|
78
|
-
this.logErrorsForSingleType(currentClass
|
|
78
|
+
this.logErrorsForSingleType(currentClass);
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
|
package/src/util/logger.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import logUpdate from 'log-update';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Logs messages to the console.
|
|
@@ -28,7 +28,7 @@ export class Logger {
|
|
|
28
28
|
*/
|
|
29
29
|
public static error(message: string, ...args: string[]) {
|
|
30
30
|
this.logSingle(message, false, 'red', false);
|
|
31
|
-
args.forEach((
|
|
31
|
+
args.forEach(() => {
|
|
32
32
|
this.logSingle(message, false, 'red', false);
|
|
33
33
|
});
|
|
34
34
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import Manifest from './manifest';
|
|
2
|
-
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
import { Annotation } from '@cparra/apex-reflection/index';
|
|
4
|
-
export declare class ManifestDiff {
|
|
5
|
-
added: Type[];
|
|
6
|
-
deleted: Type[];
|
|
7
|
-
changes: DiffChange[];
|
|
8
|
-
static build(originalManifest: Manifest, newManifest: Manifest): ManifestDiff;
|
|
9
|
-
}
|
|
10
|
-
declare class DiffChange {
|
|
11
|
-
originalType: Type;
|
|
12
|
-
newType: Type;
|
|
13
|
-
accessModifierChange?: AccessModifierChange;
|
|
14
|
-
annotationChanges: AnnotationChange[];
|
|
15
|
-
constructor(originalType: Type, newType: Type);
|
|
16
|
-
hasChanges(): boolean;
|
|
17
|
-
private parse;
|
|
18
|
-
}
|
|
19
|
-
interface AccessModifierChange {
|
|
20
|
-
oldAccessModifier: string;
|
|
21
|
-
newAccessModifier: string;
|
|
22
|
-
}
|
|
23
|
-
interface AnnotationChange {
|
|
24
|
-
annotation: Annotation;
|
|
25
|
-
type: 'added' | 'removed';
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ManifestDiff = void 0;
|
|
4
|
-
class ManifestDiff {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.added = [];
|
|
7
|
-
this.deleted = [];
|
|
8
|
-
this.changes = [];
|
|
9
|
-
}
|
|
10
|
-
static build(originalManifest, newManifest) {
|
|
11
|
-
const addedTypes = newManifest.types.filter((currentType) => !originalManifest.types.find((originalType) => currentType.name === originalType.name));
|
|
12
|
-
const deletedTypes = originalManifest.types.filter((currentType) => !newManifest.types.find((newType) => currentType.name === newType.name));
|
|
13
|
-
const changes = [];
|
|
14
|
-
for (const newType of newManifest.types) {
|
|
15
|
-
const oldType = originalManifest.types.find((oldType) => oldType.name === newType.name);
|
|
16
|
-
if (!oldType) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
const change = new DiffChange(oldType, newType);
|
|
20
|
-
if (change.hasChanges()) {
|
|
21
|
-
changes.push(change);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const diff = new ManifestDiff();
|
|
25
|
-
diff.added = addedTypes;
|
|
26
|
-
diff.deleted = deletedTypes;
|
|
27
|
-
diff.changes = changes;
|
|
28
|
-
return diff;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.ManifestDiff = ManifestDiff;
|
|
32
|
-
class DiffChange {
|
|
33
|
-
constructor(originalType, newType) {
|
|
34
|
-
this.originalType = originalType;
|
|
35
|
-
this.newType = newType;
|
|
36
|
-
this.annotationChanges = [];
|
|
37
|
-
this.parse();
|
|
38
|
-
}
|
|
39
|
-
hasChanges() {
|
|
40
|
-
return !!this.accessModifierChange || this.annotationChanges.length > 0;
|
|
41
|
-
}
|
|
42
|
-
parse() {
|
|
43
|
-
// Access modifier changes
|
|
44
|
-
if (this.originalType.access_modifier !== this.newType.access_modifier) {
|
|
45
|
-
this.accessModifierChange = {
|
|
46
|
-
oldAccessModifier: this.originalType.access_modifier,
|
|
47
|
-
newAccessModifier: this.newType.access_modifier,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
// Annotation changes
|
|
51
|
-
const addedAnnotations = this.newType.annotations.filter((currentAnnotation) => !this.originalType.annotations.find((originalAnnotation) => currentAnnotation.name === originalAnnotation.name));
|
|
52
|
-
const removedAnnotations = this.originalType.annotations.filter((currentAnnotation) => !this.newType.annotations.find((newAnnotation) => currentAnnotation.name === newAnnotation.name));
|
|
53
|
-
const annotationChangeMapper = (annotation, changeType) => {
|
|
54
|
-
return {
|
|
55
|
-
annotation: annotation,
|
|
56
|
-
type: changeType,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
this.annotationChanges = [
|
|
60
|
-
...addedAnnotations.map((annotation) => {
|
|
61
|
-
return annotationChangeMapper(annotation, 'added');
|
|
62
|
-
}),
|
|
63
|
-
...removedAnnotations.map((annotation) => {
|
|
64
|
-
return annotationChangeMapper(annotation, 'removed');
|
|
65
|
-
}),
|
|
66
|
-
];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=manifest-diff.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-diff.js","sourceRoot":"","sources":["../../src/model/manifest-diff.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import Manifest from '../manifest';
|
|
2
|
-
import { EnumMirror } from '@cparra/apex-reflection';
|
|
3
|
-
import { ManifestDiff } from '../manifest-diff';
|
|
4
|
-
import { Annotation } from '@cparra/apex-reflection/index';
|
|
5
|
-
|
|
6
|
-
const deprecatedAnnotation: Annotation = {
|
|
7
|
-
rawDeclaration: '@deprecated',
|
|
8
|
-
name: 'deprecated',
|
|
9
|
-
type: 'deprecated',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const namespaceAccessibleAnnotation: Annotation = {
|
|
13
|
-
rawDeclaration: '@NamespaceAccessible',
|
|
14
|
-
name: 'namespaceaccessible',
|
|
15
|
-
type: 'namespaceaccessible',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
it('detects when new types are added', () => {
|
|
19
|
-
const commonType = {
|
|
20
|
-
annotations: [],
|
|
21
|
-
name: 'CommonEnum',
|
|
22
|
-
type_name: 'enum',
|
|
23
|
-
access_modifier: 'public',
|
|
24
|
-
} as EnumMirror;
|
|
25
|
-
|
|
26
|
-
const originalManifest = new Manifest([commonType]);
|
|
27
|
-
|
|
28
|
-
const addedType = {
|
|
29
|
-
annotations: [],
|
|
30
|
-
name: 'NewEnum',
|
|
31
|
-
type_name: 'enum',
|
|
32
|
-
access_modifier: 'public',
|
|
33
|
-
} as EnumMirror;
|
|
34
|
-
const newManifest = new Manifest([addedType, commonType]);
|
|
35
|
-
|
|
36
|
-
const manifestDiff = ManifestDiff.build(originalManifest, newManifest);
|
|
37
|
-
expect(manifestDiff.added.length).toBe(1);
|
|
38
|
-
expect(manifestDiff.added[0].name).toBe('NewEnum');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('detects when types are deleted', () => {
|
|
42
|
-
const commonType = {
|
|
43
|
-
annotations: [],
|
|
44
|
-
name: 'CommonEnum',
|
|
45
|
-
type_name: 'enum',
|
|
46
|
-
access_modifier: 'public',
|
|
47
|
-
} as EnumMirror;
|
|
48
|
-
|
|
49
|
-
const deletedType = {
|
|
50
|
-
annotations: [],
|
|
51
|
-
name: 'OldEnum',
|
|
52
|
-
type_name: 'enum',
|
|
53
|
-
access_modifier: 'public',
|
|
54
|
-
} as EnumMirror;
|
|
55
|
-
const originalManifest = new Manifest([commonType, deletedType]);
|
|
56
|
-
const newManifest = new Manifest([commonType]);
|
|
57
|
-
|
|
58
|
-
const manifestDiff = ManifestDiff.build(originalManifest, newManifest);
|
|
59
|
-
expect(manifestDiff.deleted.length).toBe(1);
|
|
60
|
-
expect(manifestDiff.deleted[0].name).toBe('OldEnum');
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('does not add enums that have no changes', () => {
|
|
64
|
-
const originalEnum = {
|
|
65
|
-
annotations: [],
|
|
66
|
-
name: 'CommonEnum',
|
|
67
|
-
type_name: 'enum',
|
|
68
|
-
access_modifier: 'public',
|
|
69
|
-
} as EnumMirror;
|
|
70
|
-
|
|
71
|
-
const modifiedEnum = {
|
|
72
|
-
annotations: [],
|
|
73
|
-
name: 'CommonEnum',
|
|
74
|
-
type_name: 'enum',
|
|
75
|
-
access_modifier: 'public',
|
|
76
|
-
} as EnumMirror;
|
|
77
|
-
|
|
78
|
-
const originalManifest = new Manifest([originalEnum]);
|
|
79
|
-
const newManifest = new Manifest([modifiedEnum]);
|
|
80
|
-
|
|
81
|
-
const manifestDiff = ManifestDiff.build(originalManifest, newManifest);
|
|
82
|
-
expect(manifestDiff.changes.length).toBe(0);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('detects changes to access modifiers within an enum', () => {
|
|
86
|
-
const originalEnum = {
|
|
87
|
-
annotations: [],
|
|
88
|
-
name: 'CommonEnum',
|
|
89
|
-
type_name: 'enum',
|
|
90
|
-
access_modifier: 'public',
|
|
91
|
-
} as EnumMirror;
|
|
92
|
-
|
|
93
|
-
const modifiedEnum = {
|
|
94
|
-
annotations: [],
|
|
95
|
-
name: 'CommonEnum',
|
|
96
|
-
type_name: 'enum',
|
|
97
|
-
access_modifier: 'private',
|
|
98
|
-
} as EnumMirror;
|
|
99
|
-
|
|
100
|
-
const originalManifest = new Manifest([originalEnum]);
|
|
101
|
-
const newManifest = new Manifest([modifiedEnum]);
|
|
102
|
-
|
|
103
|
-
const manifestDiff = ManifestDiff.build(originalManifest, newManifest);
|
|
104
|
-
expect(manifestDiff.changes.length).toBe(1);
|
|
105
|
-
expect(manifestDiff.changes[0].originalType).toBe(originalEnum);
|
|
106
|
-
expect(manifestDiff.changes[0].newType).toBe(modifiedEnum);
|
|
107
|
-
expect(manifestDiff.changes[0].accessModifierChange).not.toBeNull();
|
|
108
|
-
expect(manifestDiff.changes[0].accessModifierChange?.oldAccessModifier).toBe('public');
|
|
109
|
-
expect(manifestDiff.changes[0].accessModifierChange?.newAccessModifier).toBe('private');
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('detects changes to annotations within an enum', () => {
|
|
113
|
-
const originalEnum = {
|
|
114
|
-
annotations: [deprecatedAnnotation],
|
|
115
|
-
name: 'CommonEnum',
|
|
116
|
-
type_name: 'enum',
|
|
117
|
-
access_modifier: 'public',
|
|
118
|
-
} as EnumMirror;
|
|
119
|
-
|
|
120
|
-
const modifiedEnum = {
|
|
121
|
-
annotations: [namespaceAccessibleAnnotation],
|
|
122
|
-
name: 'CommonEnum',
|
|
123
|
-
type_name: 'enum',
|
|
124
|
-
access_modifier: 'private',
|
|
125
|
-
} as EnumMirror;
|
|
126
|
-
|
|
127
|
-
const originalManifest = new Manifest([originalEnum]);
|
|
128
|
-
const newManifest = new Manifest([modifiedEnum]);
|
|
129
|
-
|
|
130
|
-
const manifestDiff = ManifestDiff.build(originalManifest, newManifest);
|
|
131
|
-
expect(manifestDiff.changes.length).toBe(1);
|
|
132
|
-
expect(manifestDiff.changes[0].annotationChanges.length).toBe(2);
|
|
133
|
-
expect(manifestDiff.changes[0].annotationChanges.find((change) => change.type === 'added')?.annotation.name).toBe(
|
|
134
|
-
namespaceAccessibleAnnotation.name,
|
|
135
|
-
);
|
|
136
|
-
expect(manifestDiff.changes[0].annotationChanges.find((change) => change.type === 'removed')?.annotation.name).toBe(
|
|
137
|
-
deprecatedAnnotation.name,
|
|
138
|
-
);
|
|
139
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import Manifest from './manifest';
|
|
2
|
-
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
import { Annotation } from '@cparra/apex-reflection/index';
|
|
4
|
-
|
|
5
|
-
export class ManifestDiff {
|
|
6
|
-
added: Type[] = [];
|
|
7
|
-
deleted: Type[] = [];
|
|
8
|
-
changes: DiffChange[] = [];
|
|
9
|
-
|
|
10
|
-
static build(originalManifest: Manifest, newManifest: Manifest) {
|
|
11
|
-
const addedTypes = newManifest.types.filter(
|
|
12
|
-
(currentType) => !originalManifest.types.find((originalType) => currentType.name === originalType.name),
|
|
13
|
-
);
|
|
14
|
-
const deletedTypes = originalManifest.types.filter(
|
|
15
|
-
(currentType) => !newManifest.types.find((newType) => currentType.name === newType.name),
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const changes: DiffChange[] = [];
|
|
19
|
-
for (const newType of newManifest.types) {
|
|
20
|
-
const oldType = originalManifest.types.find((oldType) => oldType.name === newType.name);
|
|
21
|
-
if (!oldType) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const change = new DiffChange(oldType, newType);
|
|
26
|
-
if (change.hasChanges()) {
|
|
27
|
-
changes.push(change);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const diff = new ManifestDiff();
|
|
32
|
-
diff.added = addedTypes;
|
|
33
|
-
diff.deleted = deletedTypes;
|
|
34
|
-
diff.changes = changes;
|
|
35
|
-
return diff;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
class DiffChange {
|
|
40
|
-
accessModifierChange?: AccessModifierChange;
|
|
41
|
-
annotationChanges: AnnotationChange[] = [];
|
|
42
|
-
|
|
43
|
-
constructor(public originalType: Type, public newType: Type) {
|
|
44
|
-
this.parse();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public hasChanges(): boolean {
|
|
48
|
-
return !!this.accessModifierChange || this.annotationChanges.length > 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
private parse() {
|
|
52
|
-
// Access modifier changes
|
|
53
|
-
if (this.originalType.access_modifier !== this.newType.access_modifier) {
|
|
54
|
-
this.accessModifierChange = {
|
|
55
|
-
oldAccessModifier: this.originalType.access_modifier,
|
|
56
|
-
newAccessModifier: this.newType.access_modifier,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Annotation changes
|
|
61
|
-
const addedAnnotations = this.newType.annotations.filter(
|
|
62
|
-
(currentAnnotation) =>
|
|
63
|
-
!this.originalType.annotations.find((originalAnnotation) => currentAnnotation.name === originalAnnotation.name),
|
|
64
|
-
);
|
|
65
|
-
const removedAnnotations = this.originalType.annotations.filter(
|
|
66
|
-
(currentAnnotation) =>
|
|
67
|
-
!this.newType.annotations.find((newAnnotation) => currentAnnotation.name === newAnnotation.name),
|
|
68
|
-
);
|
|
69
|
-
const annotationChangeMapper = (annotation: Annotation, changeType: 'added' | 'removed') => {
|
|
70
|
-
return {
|
|
71
|
-
annotation: annotation,
|
|
72
|
-
type: changeType,
|
|
73
|
-
} as AnnotationChange;
|
|
74
|
-
};
|
|
75
|
-
this.annotationChanges = [
|
|
76
|
-
...addedAnnotations.map((annotation) => {
|
|
77
|
-
return annotationChangeMapper(annotation, 'added');
|
|
78
|
-
}),
|
|
79
|
-
...removedAnnotations.map((annotation) => {
|
|
80
|
-
return annotationChangeMapper(annotation, 'removed');
|
|
81
|
-
}),
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
interface AccessModifierChange {
|
|
87
|
-
oldAccessModifier: string;
|
|
88
|
-
newAccessModifier: string;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
interface AnnotationChange {
|
|
92
|
-
annotation: Annotation;
|
|
93
|
-
type: 'added' | 'removed';
|
|
94
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|