@cparra/apexdocs 2.24.0 → 2.25.0-alpha.1
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/.github/workflows/close_stale.yml +22 -22
- package/.prettierrc.js +7 -7
- package/LICENSE +21 -21
- package/README.md +742 -718
- package/__mocks__/chalk.js +12 -0
- package/__mocks__/log-update.js +6 -0
- package/apexdocs.config.ts +13 -13
- package/docs/{README.md → __old/README.md} +1 -1
- package/docs/{restapi.json → __old/restapi.json} +589 -589
- package/docs/{types → __old/types}/Classes/nspc.ChildClass.md +97 -97
- package/docs/{types → __old/types}/Main/nspc.SampleClass.md +189 -189
- package/eslint.config.mjs +10 -0
- package/examples/force-app/main/default/classes/AnotherInterface.cls +16 -16
- package/examples/force-app/main/default/classes/ChildClass.cls +42 -42
- package/examples/force-app/main/default/classes/EscapedAnnotations.cls +5 -5
- package/examples/force-app/main/default/classes/GrandparentClass.cls +4 -4
- package/examples/force-app/main/default/classes/GroupedClass.cls +8 -8
- package/examples/force-app/main/default/classes/MemberGrouping.cls +17 -17
- package/examples/force-app/main/default/classes/ParentClass.cls +16 -16
- package/examples/force-app/main/default/classes/SampleClass.cls +166 -166
- package/examples/force-app/main/default/classes/SampleClass.cls-meta.xml +5 -5
- package/examples/force-app/main/default/classes/SampleClassWithoutModifier.cls +9 -9
- package/examples/force-app/main/default/classes/SampleInterface.cls +16 -16
- package/examples/force-app/main/default/restapi/SampleRestResource.cls +195 -195
- package/examples/force-app/main/default/restapi/SampleRestResourceToSkip.cls +35 -35
- package/examples/force-app/main/default/restapi/SampleRestResourceWithInnerClass.cls +24 -24
- package/examples/force-app/main/default/restapi/SampleRestResourceWithoutApexDocs.cls +15 -15
- package/examples/force-app/main/default/restapi/references/Reference1.cls +9 -9
- package/examples/force-app/main/default/restapi/references/Reference2.cls +9 -9
- package/examples/force-app/main/default/restapi/references/Reference3.cls +3 -3
- package/examples/force-app/main/default/restapi/references/Reference4.cls +3 -3
- package/examples/force-app/main/default/restapi/references/Reference5.cls +3 -3
- package/examples/force-app/main/default/restapi/references/Reference6.cls +6 -6
- package/examples/force-app/main/default/restapi/references/Reference7.cls +3 -3
- package/examples/includes/header.md +3 -3
- package/examples/plain-markdown/.forceignore +12 -0
- package/examples/plain-markdown/config/project-scratch-def.json +5 -0
- package/examples/plain-markdown/docs/Miscellaneous/ns.BaseClass.md +16 -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 +36 -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 +72 -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 +20 -0
- package/examples/plain-markdown/sfdx-project.json +12 -0
- package/examples/plain-markdown/template.md +3 -0
- package/jest.config.js +9 -5
- 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 +7 -0
- package/lib/adapters/apex-types.js +112 -0
- package/lib/adapters/apex-types.js.map +1 -0
- package/lib/adapters/documentables.d.ts +7 -0
- package/lib/adapters/documentables.js +56 -0
- package/lib/adapters/documentables.js.map +1 -0
- package/lib/adapters/fields-and-properties.d.ts +4 -0
- package/lib/adapters/fields-and-properties.js +32 -0
- package/lib/adapters/fields-and-properties.js.map +1 -0
- package/lib/adapters/methods-and-constructors.d.ts +5 -0
- package/lib/adapters/methods-and-constructors.js +92 -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 +7 -0
- package/lib/adapters/type-utils.js.map +1 -0
- package/lib/application/Apexdocs.d.ts +13 -13
- package/lib/application/Apexdocs.js +79 -76
- package/lib/application/Apexdocs.js.map +1 -1
- package/lib/cli/generate.d.ts +2 -2
- package/lib/cli/generate.js +156 -130
- package/lib/cli/generate.js.map +1 -1
- package/lib/core/generate-docs.d.ts +23 -0
- package/lib/core/generate-docs.js +241 -0
- package/lib/core/generate-docs.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 +28 -17
- package/lib/index.js.map +1 -1
- package/lib/model/apex-bundle.d.ts +6 -6
- package/lib/model/apex-bundle.js +10 -10
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.d.ts +7 -7
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js +13 -13
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.d.ts +7 -7
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.js +11 -11
- package/lib/model/inheritance.d.ts +8 -8
- package/lib/model/inheritance.js +2 -2
- package/lib/model/manifest.d.ts +22 -22
- package/lib/model/manifest.js +52 -46
- package/lib/model/manifest.js.map +1 -1
- package/lib/model/markdown-file.d.ts +16 -16
- package/lib/model/markdown-file.js +110 -106
- package/lib/model/markdown-file.js.map +1 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.d.ts +8 -8
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +45 -43
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +1 -1
- package/lib/model/markdown-generation-util/field-declaration-util.d.ts +3 -3
- package/lib/model/markdown-generation-util/field-declaration-util.js +53 -54
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/index.d.ts +3 -3
- package/lib/model/markdown-generation-util/index.js +19 -19
- package/lib/model/markdown-generation-util/method-declaration-util.d.ts +4 -4
- package/lib/model/markdown-generation-util/method-declaration-util.js +113 -114
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +1 -1
- package/lib/model/markdown-generation-util/type-declaration-util.d.ts +3 -3
- package/lib/model/markdown-generation-util/type-declaration-util.js +80 -81
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +1 -1
- package/lib/model/markdown-home-file.d.ts +11 -11
- package/lib/model/markdown-home-file.js +56 -53
- package/lib/model/markdown-home-file.js.map +1 -1
- package/lib/model/markdown-type-file.d.ts +26 -26
- package/lib/model/markdown-type-file.js +136 -133
- package/lib/model/markdown-type-file.js.map +1 -1
- package/lib/model/openapi/apex-doc-types.d.ts +19 -19
- package/lib/model/openapi/apex-doc-types.js +4 -4
- package/lib/model/openapi/open-api-types.d.ts +93 -93
- package/lib/model/openapi/open-api-types.js +2 -2
- package/lib/model/openapi/open-api.d.ts +16 -16
- package/lib/model/openapi/open-api.js +33 -33
- package/lib/model/openapi/open-api.js.map +1 -1
- package/lib/model/openapi/openapi-type-file.d.ts +7 -7
- package/lib/model/openapi/openapi-type-file.js +16 -16
- package/lib/model/outputFile.d.ts +10 -10
- package/lib/model/outputFile.js +21 -28
- package/lib/model/outputFile.js.map +1 -1
- package/lib/model/types-repository.d.ts +16 -16
- package/lib/model/types-repository.js +53 -53
- package/lib/model/types-repository.js.map +1 -1
- package/lib/service/apex-file-reader.d.ts +14 -14
- package/lib/service/apex-file-reader.js +48 -45
- package/lib/service/apex-file-reader.js.map +1 -1
- package/lib/service/file-system.d.ts +14 -14
- package/lib/service/file-system.js +47 -24
- package/lib/service/file-system.js.map +1 -1
- package/lib/service/file-writer.d.ts +6 -6
- package/lib/service/file-writer.js +56 -33
- package/lib/service/file-writer.js.map +1 -1
- package/lib/service/manifest-factory.d.ts +10 -10
- package/lib/service/manifest-factory.js +15 -13
- package/lib/service/manifest-factory.js.map +1 -1
- package/lib/service/metadata-processor.d.ts +3 -3
- package/lib/service/metadata-processor.js +16 -16
- package/lib/service/metadata-processor.js.map +1 -1
- package/lib/service/parser.d.ts +21 -21
- package/lib/service/parser.js +137 -134
- package/lib/service/parser.js.map +1 -1
- package/lib/service/state.d.ts +9 -9
- package/lib/service/state.js +19 -19
- package/lib/service/state.js.map +1 -1
- package/lib/service/walkers/class-walker.d.ts +4 -4
- package/lib/service/walkers/class-walker.js +32 -32
- package/lib/service/walkers/class-walker.js.map +1 -1
- package/lib/service/walkers/enum-walker.d.ts +4 -4
- package/lib/service/walkers/enum-walker.js +10 -10
- package/lib/service/walkers/interface-walker.d.ts +4 -4
- package/lib/service/walkers/interface-walker.js +14 -14
- package/lib/service/walkers/interface-walker.js.map +1 -1
- package/lib/service/walkers/walker-factory.d.ts +5 -5
- package/lib/service/walkers/walker-factory.js +20 -20
- package/lib/service/walkers/walker-factory.js.map +1 -1
- package/lib/service/walkers/walker.d.ts +19 -19
- package/lib/service/walkers/walker.js +16 -16
- package/lib/service/walkers/walker.js.map +1 -1
- package/lib/settings.d.ts +64 -64
- package/lib/settings.js +88 -88
- package/lib/settings.js.map +1 -1
- package/lib/test-helpers/AnnotationBuilder.d.ts +12 -12
- package/lib/test-helpers/AnnotationBuilder.js +30 -30
- package/lib/test-helpers/ClassMirrorBuilder.d.ts +18 -18
- package/lib/test-helpers/ClassMirrorBuilder.js +53 -53
- package/lib/test-helpers/DocCommentAnnotationBuilder.d.ts +8 -8
- package/lib/test-helpers/DocCommentAnnotationBuilder.js +25 -25
- package/lib/test-helpers/DocCommentBuilder.d.ts +12 -12
- package/lib/test-helpers/DocCommentBuilder.js +37 -37
- package/lib/test-helpers/FieldMirrorBuilder.d.ts +18 -18
- package/lib/test-helpers/FieldMirrorBuilder.js +53 -53
- 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 +29 -10
- package/lib/test-helpers/MethodMirrorBuilder.js +71 -36
- package/lib/test-helpers/MethodMirrorBuilder.js.map +1 -1
- package/lib/test-helpers/SettingsBuilder.d.ts +8 -8
- package/lib/test-helpers/SettingsBuilder.js +26 -26
- package/lib/transpiler/factory.d.ts +6 -6
- package/lib/transpiler/factory.js +34 -31
- package/lib/transpiler/factory.js.map +1 -1
- package/lib/transpiler/file-container.d.ts +6 -6
- package/lib/transpiler/file-container.js +15 -15
- package/lib/transpiler/generator-choices.d.ts +1 -1
- package/lib/transpiler/generator-choices.js +2 -2
- package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +11 -8
- package/lib/transpiler/markdown/class-file-generatorHelper.js +74 -55
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +1 -1
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +6 -6
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js +12 -12
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +11 -11
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js +50 -50
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +1 -1
- package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +11 -11
- package/lib/transpiler/markdown/markdown-transpiler-base.js +26 -23
- 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 +77 -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 +36 -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 +28 -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 +16 -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 +27 -0
- package/lib/transpiler/markdown/plain-markdown/fieldsPartialTemplate.js.map +1 -0
- 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.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 +47 -0
- package/lib/transpiler/markdown/plain-markdown/methods-partial-template.js.map +1 -0
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.d.ts +9 -6
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js +41 -13
- 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.d.ts +13 -13
- package/lib/transpiler/openapi/open-api-docs-processor.js +77 -74
- package/lib/transpiler/openapi/open-api-docs-processor.js.map +1 -1
- package/lib/transpiler/openapi/parsers/Builder.d.ts +16 -16
- package/lib/transpiler/openapi/parsers/Builder.js +29 -29
- package/lib/transpiler/openapi/parsers/Builder.js.map +1 -1
- package/lib/transpiler/openapi/parsers/MethodParser.d.ts +20 -20
- package/lib/transpiler/openapi/parsers/MethodParser.js +189 -166
- package/lib/transpiler/openapi/parsers/MethodParser.js.map +1 -1
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.d.ts +7 -7
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js +10 -10
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.d.ts +39 -39
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +249 -225
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js.map +1 -1
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.d.ts +10 -10
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js +19 -19
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.d.ts +7 -7
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js +21 -21
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js.map +1 -1
- package/lib/transpiler/processor-type-transpiler.d.ts +10 -10
- package/lib/transpiler/processor-type-transpiler.js +8 -8
- package/lib/transpiler/transpiler.d.ts +5 -5
- package/lib/transpiler/transpiler.js +29 -26
- package/lib/transpiler/transpiler.js.map +1 -1
- package/lib/util/error-logger.d.ts +8 -8
- package/lib/util/error-logger.js +89 -89
- package/lib/util/error-logger.js.map +1 -1
- package/lib/util/logger.d.ts +21 -21
- package/lib/util/logger.js +60 -57
- package/lib/util/logger.js.map +1 -1
- package/lib/util/string-utils.d.ts +2 -2
- package/lib/util/string-utils.js +14 -14
- package/lib/util/string-utils.js.map +1 -1
- package/package.json +79 -78
- 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 +80 -0
- package/src/adapters/__tests__/references.spec.ts +115 -0
- package/src/adapters/apex-types.ts +224 -0
- package/src/adapters/documentables.ts +93 -0
- package/src/adapters/fields-and-properties.ts +38 -0
- package/src/adapters/methods-and-constructors.ts +117 -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 +96 -93
- package/src/core/generate-docs.ts +357 -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/__tests__/manifest.spec.ts +1 -0
- package/src/model/manifest.ts +15 -5
- package/src/model/markdown-file.ts +6 -5
- 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/openapi/open-api-types.ts +2 -2
- package/src/model/outputFile.ts +2 -11
- package/src/service/__tests__/apex-file-reader.spec.ts +4 -4
- package/src/service/__tests__/manifest-factory.spec.ts +1 -2
- package/src/service/parser.ts +1 -1
- 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 +73 -0
- package/src/transpiler/markdown/plain-markdown/constructors-partial-template.ts +32 -0
- package/src/transpiler/markdown/plain-markdown/documentable-partial-template.ts +24 -0
- package/src/transpiler/markdown/plain-markdown/enum-template.ts +12 -0
- package/src/transpiler/markdown/plain-markdown/fieldsPartialTemplate.ts +23 -0
- package/src/transpiler/markdown/plain-markdown/grouped-members-partial-template.ts +6 -0
- package/src/transpiler/markdown/plain-markdown/interface-template.ts +16 -0
- package/src/transpiler/markdown/plain-markdown/methods-partial-template.ts +43 -0
- package/src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts +30 -0
- package/src/transpiler/markdown/plain-markdown/type-doc-partial.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 +4 -3
- package/src/util/error-logger.ts +4 -4
- package/src/util/logger.ts +3 -3
- package/tsconfig.json +21 -20
- package/tslint.json +5 -5
- package/.eslintrc.js +0 -12
- 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/{index.html → __old/index.html} +0 -0
- /package/docs/{types → __old/types}/Classes/nspc.AnotherInterface.md +0 -0
- /package/docs/{types → __old/types}/Main/nspc.GroupedClass.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
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export type Link = {
|
|
2
|
+
title: string;
|
|
3
|
+
url: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export type EmptyLine = {
|
|
7
|
+
type: 'empty-line';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type StringOrLink = string | Link;
|
|
11
|
+
|
|
12
|
+
export type RenderableContent = StringOrLink | EmptyLine;
|
|
13
|
+
|
|
14
|
+
type EnumValue = {
|
|
15
|
+
value: string;
|
|
16
|
+
description?: RenderableContent[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type CustomTag = {
|
|
20
|
+
name: string;
|
|
21
|
+
description?: RenderableContent[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Represents an annotation to a top-level type. For example @NamespaceAccessible.
|
|
26
|
+
*/
|
|
27
|
+
type Annotation = string;
|
|
28
|
+
|
|
29
|
+
type CodeBlock = string[];
|
|
30
|
+
|
|
31
|
+
type RenderableDocumentation = {
|
|
32
|
+
annotations?: Annotation[];
|
|
33
|
+
description?: RenderableContent[];
|
|
34
|
+
customTags?: CustomTag[];
|
|
35
|
+
mermaid: RenderableSection<CodeBlock | undefined>;
|
|
36
|
+
example: RenderableSection<CodeBlock | undefined>;
|
|
37
|
+
group?: string;
|
|
38
|
+
author?: string;
|
|
39
|
+
date?: string;
|
|
40
|
+
sees?: StringOrLink[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type RenderableType = {
|
|
44
|
+
namespace?: string;
|
|
45
|
+
headingLevel: number;
|
|
46
|
+
heading: string;
|
|
47
|
+
name: string;
|
|
48
|
+
meta: {
|
|
49
|
+
accessModifier: string;
|
|
50
|
+
};
|
|
51
|
+
doc: RenderableDocumentation;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type RenderableMethodParameter = {
|
|
55
|
+
name: string;
|
|
56
|
+
type: StringOrLink;
|
|
57
|
+
description?: RenderableContent[];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type TypeSource = {
|
|
61
|
+
type: StringOrLink;
|
|
62
|
+
description?: RenderableContent[];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type RenderableConstructor = {
|
|
66
|
+
headingLevel: number;
|
|
67
|
+
heading: string;
|
|
68
|
+
signature: RenderableSection<CodeBlock>;
|
|
69
|
+
parameters?: RenderableSection<RenderableMethodParameter[] | undefined>;
|
|
70
|
+
throws?: RenderableSection<TypeSource[] | undefined>;
|
|
71
|
+
doc: RenderableDocumentation;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
type RenderableMethod = {
|
|
75
|
+
doc: RenderableDocumentation;
|
|
76
|
+
headingLevel: number;
|
|
77
|
+
heading: string;
|
|
78
|
+
signature: RenderableSection<CodeBlock>;
|
|
79
|
+
parameters: RenderableSection<RenderableMethodParameter[] | undefined>;
|
|
80
|
+
returnType: RenderableSection<TypeSource>;
|
|
81
|
+
throws: RenderableSection<TypeSource[] | undefined>;
|
|
82
|
+
inherited?: boolean;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
type RenderableField = {
|
|
86
|
+
headingLevel: number;
|
|
87
|
+
heading: string;
|
|
88
|
+
type: RenderableSection<StringOrLink>;
|
|
89
|
+
accessModifier: string;
|
|
90
|
+
inherited?: boolean;
|
|
91
|
+
signature: RenderableSection<CodeBlock>;
|
|
92
|
+
doc: RenderableDocumentation;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type RenderableSection<T> = {
|
|
96
|
+
headingLevel: number;
|
|
97
|
+
heading: string;
|
|
98
|
+
value: T;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type GroupedMember<T> = RenderableSection<T[]> & { groupDescription: string | undefined };
|
|
102
|
+
|
|
103
|
+
export type RenderableClass = RenderableType & {
|
|
104
|
+
type: 'class';
|
|
105
|
+
extends?: StringOrLink;
|
|
106
|
+
implements?: StringOrLink[];
|
|
107
|
+
classModifier?: string;
|
|
108
|
+
sharingModifier?: string;
|
|
109
|
+
constructors: RenderableSection<RenderableConstructor[] | GroupedMember<RenderableConstructor>[]> & {
|
|
110
|
+
isGrouped: boolean;
|
|
111
|
+
};
|
|
112
|
+
methods: RenderableSection<RenderableMethod[] | GroupedMember<RenderableMethod>[]> & { isGrouped: boolean };
|
|
113
|
+
fields: RenderableSection<RenderableField[] | GroupedMember<RenderableField>[]> & { isGrouped: boolean };
|
|
114
|
+
properties: RenderableSection<RenderableField[] | GroupedMember<RenderableField>[]> & { isGrouped: boolean };
|
|
115
|
+
innerClasses: RenderableSection<RenderableClass[]>;
|
|
116
|
+
innerEnums: RenderableSection<RenderableEnum[]>;
|
|
117
|
+
innerInterfaces: RenderableSection<RenderableInterface[]>;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type RenderableInterface = RenderableType & {
|
|
121
|
+
type: 'interface';
|
|
122
|
+
extends?: StringOrLink[];
|
|
123
|
+
methods: RenderableSection<RenderableMethod[]>;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type RenderableEnum = RenderableType & {
|
|
127
|
+
type: 'enum';
|
|
128
|
+
values: RenderableSection<EnumValue[]>;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type Renderable = RenderableClass | RenderableInterface | RenderableEnum;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import Handlebars from 'handlebars';
|
|
2
|
+
import { typeDocPartial } from '../transpiler/markdown/plain-markdown/type-doc-partial';
|
|
3
|
+
import { documentablePartialTemplate } from '../transpiler/markdown/plain-markdown/documentable-partial-template';
|
|
4
|
+
import { methodsPartialTemplate } from '../transpiler/markdown/plain-markdown/methods-partial-template';
|
|
5
|
+
import { constructorsPartialTemplate } from '../transpiler/markdown/plain-markdown/constructors-partial-template';
|
|
6
|
+
import { fieldsPartialTemplate } from '../transpiler/markdown/plain-markdown/fieldsPartialTemplate';
|
|
7
|
+
import { classMarkdownTemplate } from '../transpiler/markdown/plain-markdown/class-template';
|
|
8
|
+
import { enumMarkdownTemplate } from '../transpiler/markdown/plain-markdown/enum-template';
|
|
9
|
+
import { interfaceMarkdownTemplate } from '../transpiler/markdown/plain-markdown/interface-template';
|
|
10
|
+
import { RenderableContent, StringOrLink } from './renderable/types';
|
|
11
|
+
import { isEmptyLine } from '../adapters/type-utils';
|
|
12
|
+
import { groupedMembersPartialTemplate } from '../transpiler/markdown/plain-markdown/grouped-members-partial-template';
|
|
13
|
+
|
|
14
|
+
export type CompilationRequest = {
|
|
15
|
+
template: string;
|
|
16
|
+
source: unknown;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export class Template {
|
|
20
|
+
private static instance: Template;
|
|
21
|
+
|
|
22
|
+
private constructor() {
|
|
23
|
+
Handlebars.registerPartial('typeDocumentation', typeDocPartial);
|
|
24
|
+
Handlebars.registerPartial('documentablePartialTemplate', documentablePartialTemplate);
|
|
25
|
+
Handlebars.registerPartial('methodsPartialTemplate', methodsPartialTemplate);
|
|
26
|
+
Handlebars.registerPartial('constructorsPartialTemplate', constructorsPartialTemplate);
|
|
27
|
+
Handlebars.registerPartial('groupedMembersPartialTemplate', groupedMembersPartialTemplate);
|
|
28
|
+
Handlebars.registerPartial('fieldsPartialTemplate', fieldsPartialTemplate);
|
|
29
|
+
Handlebars.registerPartial('classTemplate', classMarkdownTemplate);
|
|
30
|
+
Handlebars.registerPartial('enumTemplate', enumMarkdownTemplate);
|
|
31
|
+
Handlebars.registerPartial('interfaceTemplate', interfaceMarkdownTemplate);
|
|
32
|
+
|
|
33
|
+
Handlebars.registerHelper('link', link);
|
|
34
|
+
Handlebars.registerHelper('code', convertCodeBlock);
|
|
35
|
+
Handlebars.registerHelper('withLinks', resolveLinksInContent);
|
|
36
|
+
Handlebars.registerHelper('heading', heading);
|
|
37
|
+
Handlebars.registerHelper('inlineCode', inlineCode);
|
|
38
|
+
Handlebars.registerHelper('splitAndCapitalize', splitAndCapitalize);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public static getInstance(): Template {
|
|
42
|
+
if (!Template.instance) {
|
|
43
|
+
Template.instance = new Template();
|
|
44
|
+
}
|
|
45
|
+
return Template.instance;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
compile(request: CompilationRequest): string {
|
|
49
|
+
const compiled = Handlebars.compile(request.template);
|
|
50
|
+
return (
|
|
51
|
+
compiled(request.source)
|
|
52
|
+
.trim()
|
|
53
|
+
// clean up extra newlines
|
|
54
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const splitAndCapitalize = (text: string) => {
|
|
60
|
+
const words = text.split(/[-_]+/);
|
|
61
|
+
const capitalizedWords = [];
|
|
62
|
+
for (const word of words) {
|
|
63
|
+
capitalizedWords.push(word.charAt(0).toUpperCase() + word.slice(1));
|
|
64
|
+
}
|
|
65
|
+
return capitalizedWords.join(' ');
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const heading = (level: number, text: string) => {
|
|
69
|
+
return `${'#'.repeat(level)} ${text}`;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const inlineCode = (text: string) => {
|
|
73
|
+
return new Handlebars.SafeString(`\`${text}\``);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const convertCodeBlock = (language: string, lines: string[]): Handlebars.SafeString => {
|
|
77
|
+
return new Handlebars.SafeString(
|
|
78
|
+
`
|
|
79
|
+
\`\`\`${language}
|
|
80
|
+
${lines.join('\n')}
|
|
81
|
+
\`\`\`
|
|
82
|
+
`.trim(),
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const resolveLinksInContent = (description?: RenderableContent[]): string => {
|
|
87
|
+
if (!description) {
|
|
88
|
+
return '';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function reduceDescription(acc: string, curr: RenderableContent) {
|
|
92
|
+
if (isEmptyLine(curr)) {
|
|
93
|
+
return acc + '\n\n';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return acc + link(curr).trim() + ' ';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return description.reduce(reduceDescription, '').trim();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const link = (source: StringOrLink): string => {
|
|
103
|
+
if (typeof source === 'string') {
|
|
104
|
+
return source;
|
|
105
|
+
} else {
|
|
106
|
+
return `[${source.title}](${source.url})`;
|
|
107
|
+
}
|
|
108
|
+
};
|
package/src/index.ts
CHANGED
package/src/model/manifest.ts
CHANGED
|
@@ -26,11 +26,21 @@ export default class Manifest {
|
|
|
26
26
|
const typesToReturn: Type[] = [];
|
|
27
27
|
for (const filteredType of filteredTypes) {
|
|
28
28
|
const currentType = filteredType as Type;
|
|
29
|
-
if (currentType.type_name
|
|
29
|
+
if (currentType.type_name === 'enum') {
|
|
30
|
+
// Ignoring enum values is not supported.
|
|
30
31
|
typesToReturn.push(currentType);
|
|
31
32
|
continue;
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
if (currentType.type_name === 'interface') {
|
|
36
|
+
const currentInterface = currentType as InterfaceMirror;
|
|
37
|
+
typesToReturn.push({
|
|
38
|
+
...currentType,
|
|
39
|
+
methods: this.filterAccessibleModifier(currentInterface.methods, modifiers),
|
|
40
|
+
} as InterfaceMirror);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
const currentClass = currentType as ClassMirror;
|
|
35
45
|
let filteredClass = {
|
|
36
46
|
...currentType,
|
|
@@ -38,7 +48,7 @@ export default class Manifest {
|
|
|
38
48
|
properties: this.filterAccessibleModifier(currentClass.properties, modifiers),
|
|
39
49
|
fields: this.filterAccessibleModifier(currentClass.fields, modifiers),
|
|
40
50
|
constructors: this.filterAccessibleModifier(currentClass.constructors, modifiers),
|
|
41
|
-
};
|
|
51
|
+
} as ClassMirror;
|
|
42
52
|
|
|
43
53
|
if (!this.isForInnerTypes) {
|
|
44
54
|
filteredClass = {
|
|
@@ -57,10 +67,10 @@ export default class Manifest {
|
|
|
57
67
|
return typesToReturn;
|
|
58
68
|
}
|
|
59
69
|
|
|
60
|
-
filterAccessibleModifier(
|
|
61
|
-
return
|
|
70
|
+
filterAccessibleModifier(accessAndDocAware: AccessAndDocAware[], modifiers: string[]) {
|
|
71
|
+
return accessAndDocAware.filter((currentType) => {
|
|
62
72
|
const hasIgnoreDocAnnotation = currentType.docComment?.annotations.some(
|
|
63
|
-
(annotation: DocCommentAnnotation) => annotation.name === 'ignore',
|
|
73
|
+
(annotation: DocCommentAnnotation) => annotation.name.toLowerCase() === 'ignore',
|
|
64
74
|
);
|
|
65
75
|
if (hasIgnoreDocAnnotation) {
|
|
66
76
|
return false;
|
|
@@ -18,12 +18,13 @@ export class MarkdownFile extends OutputFile {
|
|
|
18
18
|
this.addBlankLine();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
public addText(text: string
|
|
22
|
-
super.addText(this._replaceInlineReferences(text), encodeHtml);
|
|
21
|
+
public addText(text: string) {
|
|
22
|
+
//super.addText(this._replaceInlineReferences(text), encodeHtml);
|
|
23
|
+
super.addText(text);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
public addLink(text: string
|
|
26
|
-
this.addText(
|
|
26
|
+
public addLink(text: string) {
|
|
27
|
+
this.addText(`{@link ${text}}`);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
startCodeBlock(language = 'apex') {
|
|
@@ -48,7 +49,7 @@ export class MarkdownFile extends OutputFile {
|
|
|
48
49
|
});
|
|
49
50
|
this.addBlankLine();
|
|
50
51
|
this._contents += '|';
|
|
51
|
-
headers.forEach((
|
|
52
|
+
headers.forEach(() => {
|
|
52
53
|
this._contents += '---' + '|';
|
|
53
54
|
});
|
|
54
55
|
this.addBlankLine();
|
|
@@ -15,7 +15,7 @@ export function addMermaid(markdownFile: MarkdownFile, docCommentAware: DocComme
|
|
|
15
15
|
markdownFile.addBlankLine();
|
|
16
16
|
markdownFile.startCodeBlock('mermaid');
|
|
17
17
|
mermaid.bodyLines.forEach((line) => {
|
|
18
|
-
markdownFile.addText(line
|
|
18
|
+
markdownFile.addText(line);
|
|
19
19
|
});
|
|
20
20
|
markdownFile.endCodeBlock();
|
|
21
21
|
markdownFile.addBlankLine();
|
|
@@ -153,7 +153,7 @@ function addExample(markdownFile: MarkdownFile, docCommentAware: DocCommentAware
|
|
|
153
153
|
markdownFile.addTitle('Example', startingHeadingLevel + 3);
|
|
154
154
|
markdownFile.startCodeBlock();
|
|
155
155
|
docCommentAware.docComment?.exampleAnnotation.bodyLines.forEach((line) => {
|
|
156
|
-
markdownFile.addText(line
|
|
156
|
+
markdownFile.addText(line);
|
|
157
157
|
});
|
|
158
158
|
markdownFile.endCodeBlock();
|
|
159
159
|
markdownFile.addBlankLine();
|
|
@@ -56,14 +56,14 @@ export type RequestBodyContent = {
|
|
|
56
56
|
|
|
57
57
|
export type MediaTypeObject = {
|
|
58
58
|
schema?: SchemaObject;
|
|
59
|
-
example?:
|
|
59
|
+
example?: unknown;
|
|
60
60
|
examples?: { [index: string]: ExampleObject };
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
export type ExampleObject = {
|
|
64
64
|
summary?: string;
|
|
65
65
|
description?: string;
|
|
66
|
-
value?:
|
|
66
|
+
value?: unknown;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
// Responses
|
package/src/model/outputFile.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import xss = require('xss');
|
|
2
|
-
import { Settings } from '../settings';
|
|
3
|
-
|
|
4
|
-
const xssFilter = new xss.FilterXSS({
|
|
5
|
-
whiteList: { br: [], p: [], ul: [], li: [], code: [], pre: [] },
|
|
6
|
-
});
|
|
7
|
-
|
|
8
1
|
export abstract class OutputFile {
|
|
9
2
|
_contents = '';
|
|
10
3
|
|
|
@@ -16,10 +9,8 @@ export abstract class OutputFile {
|
|
|
16
9
|
return this._contents;
|
|
17
10
|
}
|
|
18
11
|
|
|
19
|
-
addText(text: string
|
|
20
|
-
|
|
21
|
-
const textToAdd = shouldEncode ? xssFilter.process(text) : text;
|
|
22
|
-
this._contents += textToAdd;
|
|
12
|
+
addText(text: string) {
|
|
13
|
+
this._contents += text;
|
|
23
14
|
this.addBlankLine();
|
|
24
15
|
}
|
|
25
16
|
|
|
@@ -45,16 +45,16 @@ describe('File Reader', () => {
|
|
|
45
45
|
|
|
46
46
|
it('returns an empty list when there are no Apex files in the directory', () => {
|
|
47
47
|
const result = ApexFileReader.processFiles({
|
|
48
|
-
isDirectory(
|
|
48
|
+
isDirectory(): boolean {
|
|
49
49
|
return false;
|
|
50
50
|
},
|
|
51
|
-
joinPath(
|
|
51
|
+
joinPath(): string {
|
|
52
52
|
return '';
|
|
53
53
|
},
|
|
54
|
-
readDirectory(
|
|
54
|
+
readDirectory(): string[] {
|
|
55
55
|
return ['SomeFile.md'];
|
|
56
56
|
},
|
|
57
|
-
readFile(
|
|
57
|
+
readFile(): string {
|
|
58
58
|
return '';
|
|
59
59
|
},
|
|
60
60
|
exists(): boolean {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createManifest } from '../manifest-factory';
|
|
2
2
|
import { Type } from '@cparra/apex-reflection';
|
|
3
3
|
import { TypeParser } from '../parser';
|
|
4
|
-
import ApexBundle from '../../model/apex-bundle';
|
|
5
4
|
|
|
6
5
|
class TestParser implements TypeParser {
|
|
7
6
|
parse(): Type[] {
|
|
@@ -10,7 +9,7 @@ class TestParser implements TypeParser {
|
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
it('creates a manifest from the result of a type parser', () => {
|
|
13
|
-
const manifest = createManifest(new TestParser(), (
|
|
12
|
+
const manifest = createManifest(new TestParser(), () => {
|
|
14
13
|
return {};
|
|
15
14
|
});
|
|
16
15
|
expect(manifest.types.length).toBe(0);
|
package/src/service/parser.ts
CHANGED
|
@@ -60,7 +60,7 @@ export class RawBodyParser implements TypeParser {
|
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
//
|
|
63
|
+
// At this stage, we can be sure we are dealing with an interface
|
|
64
64
|
let typeAsInterface = currentType as InterfaceMirror;
|
|
65
65
|
if (!typeAsInterface.extended_interfaces.length) {
|
|
66
66
|
typesWithFields.push(currentType);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DocComment, FieldMirror } from '@cparra/apex-reflection';
|
|
2
|
-
import { ReferencedType } from '@cparra/apex-reflection
|
|
2
|
+
import { ReferencedType } from '@cparra/apex-reflection';
|
|
3
3
|
|
|
4
4
|
type MemberModifier = 'static' | 'webservice' | 'final' | 'override' | 'testmethod' | 'transient';
|
|
5
5
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Annotation, DocComment, InterfaceMirror, MethodMirror } from '@cparra/apex-reflection';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Builder class to create Interface objects.
|
|
5
|
+
* For testing purposes only.
|
|
6
|
+
*/
|
|
7
|
+
export class InterfaceMirrorBuilder {
|
|
8
|
+
private name = 'SampleClass';
|
|
9
|
+
private annotations: Annotation[] = [];
|
|
10
|
+
private docComment?: DocComment;
|
|
11
|
+
private methods: MethodMirror[] = [];
|
|
12
|
+
|
|
13
|
+
withName(name: string): InterfaceMirrorBuilder {
|
|
14
|
+
this.name = name;
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
addAnnotation(annotation: Annotation): InterfaceMirrorBuilder {
|
|
19
|
+
this.annotations.push(annotation);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
withDocComment(docComment: DocComment): InterfaceMirrorBuilder {
|
|
24
|
+
this.docComment = docComment;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
addMethod(method: MethodMirror): InterfaceMirrorBuilder {
|
|
29
|
+
this.methods.push(method);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
build(): InterfaceMirror {
|
|
34
|
+
return {
|
|
35
|
+
annotations: this.annotations,
|
|
36
|
+
name: this.name,
|
|
37
|
+
type_name: 'interface',
|
|
38
|
+
methods: this.methods,
|
|
39
|
+
access_modifier: 'public',
|
|
40
|
+
docComment: this.docComment,
|
|
41
|
+
extended_interfaces: [],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { Annotation, DocComment, MethodMirror } from '@cparra/apex-reflection';
|
|
1
|
+
import { Annotation, DocComment, MethodMirror, ParameterMirror } from '@cparra/apex-reflection';
|
|
2
|
+
|
|
3
|
+
type Parameter = ParameterMirror;
|
|
2
4
|
|
|
3
5
|
export class MethodMirrorBuilder {
|
|
4
6
|
private name = 'sampleMethod';
|
|
5
7
|
private annotations: Annotation[] = [];
|
|
6
8
|
private docComment?: DocComment;
|
|
9
|
+
private typeReference: { type: string; rawDeclaration: string } = {
|
|
10
|
+
type: 'void',
|
|
11
|
+
rawDeclaration: 'void',
|
|
12
|
+
};
|
|
13
|
+
private parameters: Parameter[] = [];
|
|
7
14
|
|
|
8
15
|
withName(name: string): MethodMirrorBuilder {
|
|
9
16
|
this.name = name;
|
|
@@ -20,18 +27,51 @@ export class MethodMirrorBuilder {
|
|
|
20
27
|
return this;
|
|
21
28
|
}
|
|
22
29
|
|
|
30
|
+
withTypeReference(param: { type: string; rawDeclaration: string }) {
|
|
31
|
+
this.typeReference = param;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
addParameter(parameter: Parameter): MethodMirrorBuilder {
|
|
36
|
+
this.parameters.push(parameter);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
build(): MethodMirror {
|
|
24
41
|
return {
|
|
25
42
|
access_modifier: 'public',
|
|
26
43
|
annotations: this.annotations,
|
|
27
44
|
name: this.name,
|
|
28
45
|
memberModifiers: [],
|
|
29
|
-
typeReference:
|
|
30
|
-
|
|
31
|
-
rawDeclaration: 'void',
|
|
32
|
-
},
|
|
33
|
-
parameters: [],
|
|
46
|
+
typeReference: this.typeReference,
|
|
47
|
+
parameters: this.parameters,
|
|
34
48
|
docComment: this.docComment,
|
|
35
49
|
};
|
|
36
50
|
}
|
|
37
51
|
}
|
|
52
|
+
|
|
53
|
+
export class ParameterBuilder {
|
|
54
|
+
private name = 'param';
|
|
55
|
+
private typeReference: { type: string; rawDeclaration: string } = {
|
|
56
|
+
type: 'String',
|
|
57
|
+
rawDeclaration: 'String',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
withName(name: string): ParameterBuilder {
|
|
61
|
+
this.name = name;
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
withTypeReference(param: { type: string; rawDeclaration: string }) {
|
|
66
|
+
this.typeReference = param;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
build(): Parameter {
|
|
71
|
+
return {
|
|
72
|
+
memberModifiers: [],
|
|
73
|
+
name: this.name,
|
|
74
|
+
typeReference: this.typeReference,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -3,6 +3,7 @@ import { TypesRepository } from '../../model/types-repository';
|
|
|
3
3
|
import { Settings } from '../../settings';
|
|
4
4
|
import State from '../../service/state';
|
|
5
5
|
import { TypeTranspilerFactory } from '../factory';
|
|
6
|
+
import { StringOrLink } from '../../core/renderable/types';
|
|
6
7
|
|
|
7
8
|
export default class ClassFileGeneratorHelper {
|
|
8
9
|
public static getSanitizedGroup(classModel: Type) {
|
|
@@ -10,13 +11,18 @@ export default class ClassFileGeneratorHelper {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
public static getFileLink(classModel: Type) {
|
|
14
|
+
const [fullClassName, fileLink] = ClassFileGeneratorHelper.getFileLinkTuple(classModel);
|
|
15
|
+
return `[${fullClassName}](${fileLink})`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private static getFileLinkTuple(classModel: Type): [string, string] {
|
|
13
19
|
const documentationRoot = Settings.getInstance().getRootDir() ?? '';
|
|
14
20
|
const directoryRoot = `${documentationRoot}${this.getDirectoryRoot(classModel)}`;
|
|
15
21
|
const fullClassName = `${Settings.getInstance().getNamespacePrefix()}${classModel.name}`;
|
|
16
|
-
return
|
|
22
|
+
return [fullClassName, `${directoryRoot}${fullClassName}.md`];
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
public static getFileLinkByTypeName(typeName: string) {
|
|
25
|
+
public static getFileLinkByTypeName(typeName: string): string {
|
|
20
26
|
const type = TypesRepository.getInstance().getFromScopedByName(typeName);
|
|
21
27
|
if (!type) {
|
|
22
28
|
// If the type is not found, we return a Markdown hyperlink with whatever we received.
|
|
@@ -26,6 +32,20 @@ export default class ClassFileGeneratorHelper {
|
|
|
26
32
|
return this.getFileLink(type);
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
public static getRenderableLinkByTypeName(typeName: string): StringOrLink {
|
|
36
|
+
const type = TypesRepository.getInstance().getFromScopedByName(typeName);
|
|
37
|
+
if (!type) {
|
|
38
|
+
// If the type is not found, we return the type name as a string.
|
|
39
|
+
return typeName;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const [fullClassName, fileLink] = ClassFileGeneratorHelper.getFileLinkTuple(type);
|
|
43
|
+
return {
|
|
44
|
+
title: fullClassName,
|
|
45
|
+
url: fileLink,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
29
49
|
private static getDirectoryRoot(classModel: Type) {
|
|
30
50
|
// root-relative links start from the root by using a leading '/'
|
|
31
51
|
const generator = Settings.getInstance().targetGenerator;
|