@cparra/apexdocs 2.25.0 → 3.0.0-alpha.10
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 +73 -12
- package/__mocks__/chalk.js +12 -0
- package/__mocks__/log-update.js +6 -0
- package/dist/cli/generate.js +3181 -0
- package/dist/defaults-DGKfeZq-.js +13 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +36 -0
- package/eslint.config.mjs +10 -0
- package/examples/markdown/.forceignore +12 -0
- package/examples/markdown/config/project-scratch-def.json +5 -0
- package/examples/markdown/docs/index.md +109 -0
- package/examples/markdown/docs/miscellaneous/BaseClass.md +16 -0
- package/examples/markdown/docs/miscellaneous/MultiInheritanceClass.md +72 -0
- package/examples/markdown/docs/miscellaneous/ParentInterface.md +15 -0
- package/examples/markdown/docs/miscellaneous/ReferencedEnum.md +8 -0
- package/examples/markdown/docs/miscellaneous/SampleException.md +24 -0
- package/examples/markdown/docs/miscellaneous/SampleInterface.md +116 -0
- package/examples/markdown/docs/miscellaneous/Url.md +309 -0
- package/examples/markdown/docs/sample-enums/SampleEnum.md +36 -0
- package/examples/markdown/docs/samplegroup/SampleClass.md +170 -0
- package/examples/markdown/force-app/classes/BaseClass.cls +3 -0
- package/examples/markdown/force-app/classes/MultiInheritanceClass.cls +1 -0
- package/examples/markdown/force-app/classes/ParentInterface.cls +3 -0
- package/examples/markdown/force-app/classes/ReferencedEnum.cls +3 -0
- package/examples/markdown/force-app/classes/SampleClass.cls +72 -0
- package/examples/markdown/force-app/classes/SampleEnum.cls +30 -0
- package/examples/markdown/force-app/classes/SampleException.cls +17 -0
- package/examples/markdown/force-app/classes/SampleInterface.cls +50 -0
- package/examples/markdown/force-app/classes/Url.cls +194 -0
- package/examples/markdown/package-lock.json +665 -0
- package/examples/markdown/package.json +20 -0
- package/examples/markdown/sfdx-project.json +12 -0
- package/examples/vitepress/.forceignore +12 -0
- package/examples/vitepress/apexdocs.config.ts +106 -0
- package/examples/vitepress/config/project-scratch-def.json +13 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/@theme_index.js +259 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/@theme_index.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/_metadata.json +40 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-574YRH25.js +11474 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-574YRH25.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-E5DZZB2I.js +9172 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/chunk-E5DZZB2I.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/package.json +3 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4339 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +567 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vue.js +323 -0
- package/examples/vitepress/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/examples/vitepress/docs/.vitepress/config.mts +21 -0
- package/examples/vitepress/docs/.vitepress/sidebar.json +119 -0
- package/examples/vitepress/docs/api-examples.md +49 -0
- package/examples/vitepress/docs/index-frontmatter.md +16 -0
- package/examples/vitepress/docs/index.md +56 -0
- package/examples/vitepress/docs/markdown-examples.md +85 -0
- package/examples/vitepress/docs/miscellaneous/BaseClass.md +20 -0
- package/examples/vitepress/docs/miscellaneous/MultiInheritanceClass.md +76 -0
- package/examples/vitepress/docs/miscellaneous/ParentInterface.md +19 -0
- package/examples/vitepress/docs/miscellaneous/ReferencedEnum.md +15 -0
- package/examples/vitepress/docs/miscellaneous/SampleException.md +28 -0
- package/examples/vitepress/docs/miscellaneous/SampleInterface.md +116 -0
- package/examples/vitepress/docs/miscellaneous/Url.md +317 -0
- package/examples/vitepress/docs/sample-enums/SampleEnum.md +40 -0
- package/examples/vitepress/docs/samplegroup/SampleClass.md +174 -0
- package/examples/vitepress/force-app/main/default/classes/BaseClass.cls +3 -0
- package/examples/vitepress/force-app/main/default/classes/MultiInheritanceClass.cls +1 -0
- package/examples/vitepress/force-app/main/default/classes/ParentInterface.cls +3 -0
- package/examples/vitepress/force-app/main/default/classes/ReferencedEnum.cls +5 -0
- package/examples/vitepress/force-app/main/default/classes/SampleClass.cls +72 -0
- package/examples/vitepress/force-app/main/default/classes/SampleEnum.cls +30 -0
- package/examples/vitepress/force-app/main/default/classes/SampleException.cls +17 -0
- package/examples/vitepress/force-app/main/default/classes/SampleInterface.cls +46 -0
- package/examples/vitepress/force-app/main/default/classes/Url.cls +198 -0
- package/examples/vitepress/package-lock.json +2574 -0
- package/examples/vitepress/package.json +18 -0
- package/examples/vitepress/sfdx-project.json +12 -0
- package/jest.config.js +6 -1
- package/jest.d.ts +7 -0
- package/package.json +34 -36
- package/src/application/Apexdocs.ts +58 -68
- package/src/application/__tests__/apex-file-reader.spec.ts +104 -0
- package/src/application/apex-file-reader.ts +55 -0
- package/src/application/file-system.ts +69 -0
- package/src/application/file-writer.ts +43 -0
- package/src/application/generators/markdown.ts +45 -0
- package/src/application/generators/openapi.ts +60 -0
- package/src/cli/args.ts +43 -0
- package/src/cli/commands/markdown.ts +53 -0
- package/src/cli/generate.ts +10 -131
- package/src/core/manifest.ts +90 -0
- package/src/core/markdown/__test__/expect-extensions.ts +32 -0
- package/src/core/markdown/__test__/generating-class-docs.spec.ts +733 -0
- package/src/core/markdown/__test__/generating-enum-docs.spec.ts +385 -0
- package/src/core/markdown/__test__/generating-interface-docs.spec.ts +461 -0
- package/src/core/markdown/__test__/generating-reference-guide.spec.ts +180 -0
- package/src/core/markdown/__test__/inheritance-chain.test.ts +54 -0
- package/src/core/markdown/__test__/test-helpers.ts +23 -0
- package/src/core/markdown/adapters/__tests__/documentables.spec.ts +109 -0
- package/src/core/markdown/adapters/__tests__/interface-adapter.spec.ts +148 -0
- package/src/core/markdown/adapters/__tests__/link-generator.spec.ts +130 -0
- package/src/core/markdown/adapters/__tests__/references.spec.ts +136 -0
- package/src/core/markdown/adapters/apex-types.ts +238 -0
- package/src/core/markdown/adapters/documentables.ts +115 -0
- package/src/core/markdown/adapters/fields-and-properties.ts +45 -0
- package/src/core/markdown/adapters/generate-link.ts +82 -0
- package/src/core/markdown/adapters/inline.ts +143 -0
- package/src/core/markdown/adapters/methods-and-constructors.ts +133 -0
- package/src/core/markdown/adapters/reference-guide.ts +37 -0
- package/src/core/markdown/adapters/renderable-bundle.ts +61 -0
- package/src/core/markdown/adapters/renderable-to-page-data.ts +89 -0
- package/src/core/markdown/adapters/type-utils.ts +13 -0
- package/src/core/markdown/adapters/types.d.ts +180 -0
- package/src/core/markdown/generate-docs.ts +212 -0
- package/src/core/markdown/reflection/filter-scope.ts +13 -0
- package/src/core/markdown/reflection/inheritance-chain-expanion.ts +22 -0
- package/src/core/markdown/reflection/inheritance-chain.ts +23 -0
- package/src/core/markdown/reflection/inherited-member-expansion.ts +105 -0
- package/src/core/markdown/reflection/reflect-source.ts +123 -0
- package/src/core/markdown/reflection/sort-members.ts +59 -0
- package/src/core/markdown/templates/class-template.ts +75 -0
- package/src/core/markdown/templates/constructors-partial-template.ts +32 -0
- package/src/core/markdown/templates/documentable-partial-template.ts +26 -0
- package/src/core/markdown/templates/enum-template.ts +12 -0
- package/src/core/markdown/templates/fieldsPartialTemplate.ts +23 -0
- package/src/core/markdown/templates/grouped-members-partial-template.ts +6 -0
- package/src/core/markdown/templates/hookable.ts +7 -0
- package/src/core/markdown/templates/interface-template.ts +16 -0
- package/src/core/markdown/templates/methods-partial-template.ts +43 -0
- package/src/core/markdown/templates/reference-guide.ts +14 -0
- package/src/core/markdown/templates/template.ts +114 -0
- package/src/core/markdown/templates/type-doc-partial.ts +27 -0
- package/src/core/markdown/utils.ts +3 -0
- package/src/{service → core/openapi}/__tests__/manifest-factory.spec.ts +1 -2
- package/src/{transpiler → core}/openapi/__tests__/open-api-docs-processor.spec.ts +1 -1
- package/src/{model → core/openapi}/apex-type-wrappers/__tests__/ClassMirrorWrapper.spec.ts +3 -3
- package/src/core/openapi/file-container.ts +13 -0
- package/src/{service → core/openapi}/manifest-factory.ts +3 -3
- package/src/{transpiler → core}/openapi/open-api-docs-processor.ts +10 -11
- package/src/{model → core}/openapi/open-api-types.ts +2 -2
- package/src/core/openapi/openapi-type-file.ts +12 -0
- package/src/{service → core/openapi}/parser.ts +7 -21
- package/src/{transpiler → core}/openapi/parsers/Builder.ts +3 -3
- package/src/{transpiler → core}/openapi/parsers/MethodParser.ts +6 -6
- package/src/{transpiler → core}/openapi/parsers/ParameterObjectBuilder.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/ReferenceBuilder.ts +7 -6
- package/src/{transpiler → core}/openapi/parsers/RequestBodyBuilder.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/ResponsesBuilder.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/MethodParser.spec.ts +1 -1
- package/src/{transpiler → core}/openapi/parsers/__tests__/ParameterObjectBuilder.spec.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/ReferenceBuilder.spec.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/RequestBodyBuilder.spec.ts +2 -2
- package/src/{transpiler → core}/openapi/parsers/__tests__/ResponsesBuilder.spec.ts +1 -1
- package/src/{transpiler → core/openapi}/transpiler.ts +2 -6
- package/src/{model → core/openapi}/types-repository.ts +0 -9
- package/src/core/parse-apex-metadata.ts +30 -0
- package/src/core/settings.ts +56 -0
- package/src/core/shared/types.d.ts +147 -0
- package/src/core/shared/utils.ts +5 -0
- package/src/defaults.ts +9 -0
- package/src/index.ts +36 -1
- package/src/test-helpers/ClassMirrorBuilder.ts +14 -1
- package/src/test-helpers/FieldMirrorBuilder.ts +1 -1
- package/src/test-helpers/InterfaceMirrorBuilder.ts +39 -0
- package/src/test-helpers/MethodMirrorBuilder.ts +46 -6
- package/src/test-helpers/SettingsBuilder.ts +1 -4
- package/src/util/error-logger.ts +4 -4
- package/src/util/fp.ts +3 -0
- package/src/util/logger.ts +12 -25
- package/src/util/string-utils.ts +0 -4
- package/tsconfig.json +8 -3
- package/.eslintrc.js +0 -12
- package/apexdocs.config.ts +0 -13
- package/docs/.nojekyll +0 -0
- package/docs/README.md +0 -1
- package/docs/index.html +0 -22
- package/docs/restapi.json +0 -589
- package/docs/types/Classes/nspc.AnotherInterface.md +0 -22
- package/docs/types/Classes/nspc.ChildClass.md +0 -97
- package/docs/types/Main/nspc.GroupedClass.md +0 -10
- package/docs/types/Main/nspc.SampleClass.md +0 -190
- package/docs/types/Misc-Group/nspc.EscapedAnnotations.md +0 -4
- package/docs/types/Misc-Group/nspc.GrandparentClass.md +0 -13
- package/docs/types/Misc-Group/nspc.InterfaceWithInheritance.md +0 -29
- package/docs/types/Misc-Group/nspc.MemberGrouping.md +0 -13
- package/docs/types/Misc-Group/nspc.ParentClass.md +0 -37
- package/docs/types/Misc-Group/nspc.Reference1.md +0 -18
- package/docs/types/Misc-Group/nspc.Reference2.md +0 -12
- package/docs/types/Misc-Group/nspc.Reference3.md +0 -7
- package/docs/types/Misc-Group/nspc.Reference4.md +0 -7
- package/docs/types/Misc-Group/nspc.Reference5.md +0 -7
- package/docs/types/Misc-Group/nspc.Reference6.md +0 -9
- package/docs/types/Misc-Group/nspc.Reference7.md +0 -7
- package/docs/types/Misc-Group/nspc.SampleClassWithoutModifier.md +0 -11
- package/docs/types/Misc-Group/nspc.SampleRestResource.md +0 -211
- package/docs/types/Misc-Group/nspc.SampleRestResourceWithInnerClass.md +0 -34
- package/docs/types/Misc-Group/nspc.SampleRestResourceWithoutApexDocs.md +0 -14
- package/docs/types/README.md +0 -97
- package/docs/types/Sample-Interfaces/nspc.SampleInterface.md +0 -23
- package/examples/includes/header.md +0 -3
- package/lib/application/Apexdocs.d.ts +0 -13
- package/lib/application/Apexdocs.js +0 -77
- package/lib/application/Apexdocs.js.map +0 -1
- package/lib/cli/generate.d.ts +0 -2
- package/lib/cli/generate.js +0 -131
- package/lib/cli/generate.js.map +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -18
- package/lib/index.js.map +0 -1
- package/lib/model/apex-bundle.d.ts +0 -6
- package/lib/model/apex-bundle.js +0 -11
- package/lib/model/apex-bundle.js.map +0 -1
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.d.ts +0 -7
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js +0 -14
- package/lib/model/apex-type-wrappers/ClassMirrorWrapper.js.map +0 -1
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.d.ts +0 -7
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.js +0 -12
- package/lib/model/apex-type-wrappers/MethodMirrorWrapper.js.map +0 -1
- package/lib/model/inheritance.d.ts +0 -8
- package/lib/model/inheritance.js +0 -3
- package/lib/model/inheritance.js.map +0 -1
- 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/lib/model/manifest.d.ts +0 -22
- package/lib/model/manifest.js +0 -47
- package/lib/model/manifest.js.map +0 -1
- package/lib/model/markdown-file.d.ts +0 -16
- package/lib/model/markdown-file.js +0 -107
- package/lib/model/markdown-file.js.map +0 -1
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.d.ts +0 -8
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js +0 -44
- package/lib/model/markdown-generation-util/doc-comment-annotation-util.js.map +0 -1
- package/lib/model/markdown-generation-util/field-declaration-util.d.ts +0 -3
- package/lib/model/markdown-generation-util/field-declaration-util.js +0 -55
- package/lib/model/markdown-generation-util/field-declaration-util.js.map +0 -1
- package/lib/model/markdown-generation-util/index.d.ts +0 -3
- package/lib/model/markdown-generation-util/index.js +0 -20
- package/lib/model/markdown-generation-util/index.js.map +0 -1
- package/lib/model/markdown-generation-util/method-declaration-util.d.ts +0 -4
- package/lib/model/markdown-generation-util/method-declaration-util.js +0 -115
- package/lib/model/markdown-generation-util/method-declaration-util.js.map +0 -1
- package/lib/model/markdown-generation-util/type-declaration-util.d.ts +0 -3
- package/lib/model/markdown-generation-util/type-declaration-util.js +0 -82
- package/lib/model/markdown-generation-util/type-declaration-util.js.map +0 -1
- package/lib/model/markdown-home-file.d.ts +0 -11
- package/lib/model/markdown-home-file.js +0 -54
- package/lib/model/markdown-home-file.js.map +0 -1
- package/lib/model/markdown-type-file.d.ts +0 -26
- package/lib/model/markdown-type-file.js +0 -134
- package/lib/model/markdown-type-file.js.map +0 -1
- package/lib/model/openapi/apex-doc-types.d.ts +0 -19
- package/lib/model/openapi/apex-doc-types.js +0 -5
- package/lib/model/openapi/apex-doc-types.js.map +0 -1
- package/lib/model/openapi/open-api-types.d.ts +0 -93
- package/lib/model/openapi/open-api-types.js +0 -3
- package/lib/model/openapi/open-api-types.js.map +0 -1
- package/lib/model/openapi/open-api.d.ts +0 -16
- package/lib/model/openapi/open-api.js +0 -34
- package/lib/model/openapi/open-api.js.map +0 -1
- package/lib/model/openapi/openapi-type-file.d.ts +0 -7
- package/lib/model/openapi/openapi-type-file.js +0 -17
- package/lib/model/openapi/openapi-type-file.js.map +0 -1
- package/lib/model/outputFile.d.ts +0 -10
- package/lib/model/outputFile.js +0 -29
- package/lib/model/outputFile.js.map +0 -1
- package/lib/model/types-repository.d.ts +0 -16
- package/lib/model/types-repository.js +0 -54
- package/lib/model/types-repository.js.map +0 -1
- package/lib/service/apex-file-reader.d.ts +0 -14
- package/lib/service/apex-file-reader.js +0 -46
- package/lib/service/apex-file-reader.js.map +0 -1
- package/lib/service/file-system.d.ts +0 -14
- package/lib/service/file-system.js +0 -25
- package/lib/service/file-system.js.map +0 -1
- package/lib/service/file-writer.d.ts +0 -6
- package/lib/service/file-writer.js +0 -34
- package/lib/service/file-writer.js.map +0 -1
- package/lib/service/manifest-factory.d.ts +0 -10
- package/lib/service/manifest-factory.js +0 -14
- package/lib/service/manifest-factory.js.map +0 -1
- package/lib/service/metadata-processor.d.ts +0 -3
- package/lib/service/metadata-processor.js +0 -17
- package/lib/service/metadata-processor.js.map +0 -1
- package/lib/service/parser.d.ts +0 -21
- package/lib/service/parser.js +0 -135
- package/lib/service/parser.js.map +0 -1
- package/lib/service/state.d.ts +0 -9
- package/lib/service/state.js +0 -20
- package/lib/service/state.js.map +0 -1
- package/lib/service/walkers/class-walker.d.ts +0 -4
- package/lib/service/walkers/class-walker.js +0 -33
- package/lib/service/walkers/class-walker.js.map +0 -1
- package/lib/service/walkers/enum-walker.d.ts +0 -4
- package/lib/service/walkers/enum-walker.js +0 -11
- package/lib/service/walkers/enum-walker.js.map +0 -1
- package/lib/service/walkers/interface-walker.d.ts +0 -4
- package/lib/service/walkers/interface-walker.js +0 -15
- package/lib/service/walkers/interface-walker.js.map +0 -1
- package/lib/service/walkers/walker-factory.d.ts +0 -5
- package/lib/service/walkers/walker-factory.js +0 -21
- package/lib/service/walkers/walker-factory.js.map +0 -1
- package/lib/service/walkers/walker.d.ts +0 -19
- package/lib/service/walkers/walker.js +0 -17
- package/lib/service/walkers/walker.js.map +0 -1
- package/lib/settings.d.ts +0 -64
- package/lib/settings.js +0 -89
- package/lib/settings.js.map +0 -1
- package/lib/test-helpers/AnnotationBuilder.d.ts +0 -12
- package/lib/test-helpers/AnnotationBuilder.js +0 -31
- package/lib/test-helpers/AnnotationBuilder.js.map +0 -1
- package/lib/test-helpers/ClassMirrorBuilder.d.ts +0 -18
- package/lib/test-helpers/ClassMirrorBuilder.js +0 -54
- package/lib/test-helpers/ClassMirrorBuilder.js.map +0 -1
- package/lib/test-helpers/DocCommentAnnotationBuilder.d.ts +0 -8
- package/lib/test-helpers/DocCommentAnnotationBuilder.js +0 -26
- package/lib/test-helpers/DocCommentAnnotationBuilder.js.map +0 -1
- package/lib/test-helpers/DocCommentBuilder.d.ts +0 -12
- package/lib/test-helpers/DocCommentBuilder.js +0 -38
- package/lib/test-helpers/DocCommentBuilder.js.map +0 -1
- package/lib/test-helpers/FieldMirrorBuilder.d.ts +0 -18
- package/lib/test-helpers/FieldMirrorBuilder.js +0 -54
- package/lib/test-helpers/FieldMirrorBuilder.js.map +0 -1
- package/lib/test-helpers/MethodMirrorBuilder.d.ts +0 -10
- package/lib/test-helpers/MethodMirrorBuilder.js +0 -37
- package/lib/test-helpers/MethodMirrorBuilder.js.map +0 -1
- package/lib/test-helpers/SettingsBuilder.d.ts +0 -8
- package/lib/test-helpers/SettingsBuilder.js +0 -27
- package/lib/test-helpers/SettingsBuilder.js.map +0 -1
- package/lib/transpiler/factory.d.ts +0 -6
- package/lib/transpiler/factory.js +0 -32
- package/lib/transpiler/factory.js.map +0 -1
- package/lib/transpiler/file-container.d.ts +0 -6
- package/lib/transpiler/file-container.js +0 -16
- package/lib/transpiler/file-container.js.map +0 -1
- package/lib/transpiler/generator-choices.d.ts +0 -1
- package/lib/transpiler/generator-choices.js +0 -3
- package/lib/transpiler/generator-choices.js.map +0 -1
- package/lib/transpiler/markdown/class-file-generatorHelper.d.ts +0 -8
- package/lib/transpiler/markdown/class-file-generatorHelper.js +0 -56
- package/lib/transpiler/markdown/class-file-generatorHelper.js.map +0 -1
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.d.ts +0 -6
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js +0 -13
- package/lib/transpiler/markdown/docsify/docsify-docs-processor.js.map +0 -1
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.d.ts +0 -11
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js +0 -51
- package/lib/transpiler/markdown/jekyll/jekyll-docsProcessor.js.map +0 -1
- package/lib/transpiler/markdown/markdown-transpiler-base.d.ts +0 -11
- package/lib/transpiler/markdown/markdown-transpiler-base.js +0 -24
- package/lib/transpiler/markdown/markdown-transpiler-base.js.map +0 -1
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.d.ts +0 -6
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js +0 -14
- package/lib/transpiler/markdown/plain-markdown/plain-docsProcessor.js.map +0 -1
- package/lib/transpiler/openapi/open-api-docs-processor.d.ts +0 -13
- package/lib/transpiler/openapi/open-api-docs-processor.js +0 -75
- package/lib/transpiler/openapi/open-api-docs-processor.js.map +0 -1
- package/lib/transpiler/openapi/parsers/Builder.d.ts +0 -16
- package/lib/transpiler/openapi/parsers/Builder.js +0 -30
- package/lib/transpiler/openapi/parsers/Builder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/MethodParser.d.ts +0 -20
- package/lib/transpiler/openapi/parsers/MethodParser.js +0 -167
- package/lib/transpiler/openapi/parsers/MethodParser.js.map +0 -1
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.d.ts +0 -7
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js +0 -11
- package/lib/transpiler/openapi/parsers/ParameterObjectBuilder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.d.ts +0 -39
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js +0 -226
- package/lib/transpiler/openapi/parsers/ReferenceBuilder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.d.ts +0 -10
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js +0 -20
- package/lib/transpiler/openapi/parsers/RequestBodyBuilder.js.map +0 -1
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.d.ts +0 -7
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js +0 -22
- package/lib/transpiler/openapi/parsers/ResponsesBuilder.js.map +0 -1
- package/lib/transpiler/processor-type-transpiler.d.ts +0 -10
- package/lib/transpiler/processor-type-transpiler.js +0 -9
- package/lib/transpiler/processor-type-transpiler.js.map +0 -1
- package/lib/transpiler/transpiler.d.ts +0 -5
- package/lib/transpiler/transpiler.js +0 -27
- package/lib/transpiler/transpiler.js.map +0 -1
- package/lib/util/error-logger.d.ts +0 -8
- package/lib/util/error-logger.js +0 -90
- package/lib/util/error-logger.js.map +0 -1
- package/lib/util/logger.d.ts +0 -21
- package/lib/util/logger.js +0 -58
- package/lib/util/logger.js.map +0 -1
- package/lib/util/string-utils.d.ts +0 -2
- package/lib/util/string-utils.js +0 -15
- package/lib/util/string-utils.js.map +0 -1
- package/src/model/__tests__/manifest-diff.spec.ts +0 -147
- package/src/model/apex-bundle.ts +0 -3
- package/src/model/inheritance.ts +0 -7
- package/src/model/manifest-diff.ts +0 -94
- package/src/model/manifest.ts +0 -74
- package/src/model/markdown-file.ts +0 -121
- package/src/model/markdown-generation-util/doc-comment-annotation-util.ts +0 -50
- package/src/model/markdown-generation-util/field-declaration-util.ts +0 -71
- package/src/model/markdown-generation-util/index.ts +0 -3
- package/src/model/markdown-generation-util/method-declaration-util.ts +0 -166
- package/src/model/markdown-generation-util/type-declaration-util.ts +0 -91
- package/src/model/markdown-home-file.ts +0 -58
- package/src/model/markdown-type-file.ts +0 -165
- package/src/model/openapi/openapi-type-file.ts +0 -14
- package/src/model/outputFile.ts +0 -29
- package/src/service/__tests__/apex-file-reader.spec.ts +0 -92
- package/src/service/apex-file-reader.ts +0 -51
- package/src/service/file-system.ts +0 -33
- package/src/service/file-writer.ts +0 -34
- package/src/service/metadata-processor.ts +0 -16
- package/src/service/state.ts +0 -24
- package/src/service/walkers/class-walker.ts +0 -30
- package/src/service/walkers/enum-walker.ts +0 -7
- package/src/service/walkers/interface-walker.ts +0 -12
- package/src/service/walkers/walker-factory.ts +0 -19
- package/src/service/walkers/walker.ts +0 -42
- package/src/settings.ts +0 -147
- package/src/transpiler/factory.ts +0 -33
- package/src/transpiler/file-container.ts +0 -13
- package/src/transpiler/generator-choices.ts +0 -1
- package/src/transpiler/markdown/class-file-generatorHelper.ts +0 -58
- package/src/transpiler/markdown/docsify/docsify-docs-processor.ts +0 -12
- package/src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts +0 -50
- package/src/transpiler/markdown/markdown-transpiler-base.ts +0 -28
- package/src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts +0 -12
- package/src/transpiler/processor-type-transpiler.ts +0 -18
- /package/src/{model/__tests__ → core/__test__}/manifest.spec.ts +0 -0
- /package/src/{model → core}/openapi/__tests__/open-api.spec.ts +0 -0
- /package/src/{model → core}/openapi/apex-doc-types.ts +0 -0
- /package/src/{model → core/openapi}/apex-type-wrappers/ClassMirrorWrapper.ts +0 -0
- /package/src/{model → core/openapi}/apex-type-wrappers/MethodMirrorWrapper.ts +0 -0
- /package/src/{model → core}/openapi/open-api.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"class-file-generatorHelper.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/class-file-generatorHelper.ts"],"names":[],"mappings":";;AACA,mEAA+D;AAC/D,6CAA0C;AAC1C,+CAAwC;AACxC,wCAAmD;AAEnD,MAAqB,wBAAwB;IACpC,MAAM,CAAC,iBAAiB,CAAC,UAAgB;QAC9C,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,UAAgB;;QACxC,MAAM,iBAAiB,GAAG,MAAA,mBAAQ,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,mCAAI,EAAE,CAAC;QACpE,MAAM,aAAa,GAAG,GAAG,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;QACjF,MAAM,aAAa,GAAG,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC,kBAAkB,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;QACzF,OAAO,IAAI,aAAa,KAAK,aAAa,GAAG,aAAa,MAAM,CAAC;IACnE,CAAC;IAEM,MAAM,CAAC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CAC1D,CAAC;QACF,OAAO,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,IAAI,mCAAI,mBAAQ,CAAC,WAAW,EAAE,CAAC,mBAAmB,EAAE,CAAC;IAC/E,CAAC;CACF;AAnDD,2CAmDC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
3
|
-
export default class DocsifyDocsProcessor extends MarkdownTranspilerBase {
|
|
4
|
-
homeFileName(): string;
|
|
5
|
-
getLinkingStrategy(): LinkingStrategy;
|
|
6
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const markdown_transpiler_base_1 = require("../markdown-transpiler-base");
|
|
4
|
-
class DocsifyDocsProcessor extends markdown_transpiler_base_1.MarkdownTranspilerBase {
|
|
5
|
-
homeFileName() {
|
|
6
|
-
return 'README';
|
|
7
|
-
}
|
|
8
|
-
getLinkingStrategy() {
|
|
9
|
-
return 'root-relative';
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = DocsifyDocsProcessor;
|
|
13
|
-
//# sourceMappingURL=docsify-docs-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docsify-docs-processor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/docsify/docsify-docs-processor.ts"],"names":[],"mappings":";;AAAA,0EAAqE;AAGrE,MAAqB,oBAAqB,SAAQ,iDAAsB;IACtE,YAAY;QACV,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,kBAAkB;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AARD,uCAQC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
4
|
-
export declare class JekyllDocsProcessor extends MarkdownTranspilerBase {
|
|
5
|
-
homeFileName(): string;
|
|
6
|
-
onBeforeProcess: (types: Type[]) => void;
|
|
7
|
-
onProcess(type: Type): void;
|
|
8
|
-
get frontMatterForHomeFile(): string;
|
|
9
|
-
getFrontMatterHeader(type: Type): string;
|
|
10
|
-
getLinkingStrategy(): LinkingStrategy;
|
|
11
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JekyllDocsProcessor = void 0;
|
|
4
|
-
const markdown_transpiler_base_1 = require("../markdown-transpiler-base");
|
|
5
|
-
const markdown_home_file_1 = require("../../../model/markdown-home-file");
|
|
6
|
-
const markdown_type_file_1 = require("../../../model/markdown-type-file");
|
|
7
|
-
const settings_1 = require("../../../settings");
|
|
8
|
-
class JekyllDocsProcessor extends markdown_transpiler_base_1.MarkdownTranspilerBase {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.onBeforeProcess = (types) => {
|
|
12
|
-
this._fileContainer.pushFile(new markdown_home_file_1.MarkdownHomeFile(this.homeFileName(), types, this.frontMatterForHomeFile));
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
homeFileName() {
|
|
16
|
-
return 'index';
|
|
17
|
-
}
|
|
18
|
-
onProcess(type) {
|
|
19
|
-
this._fileContainer.pushFile(new markdown_type_file_1.MarkdownTypeFile(type, 1, this.getFrontMatterHeader(type)));
|
|
20
|
-
}
|
|
21
|
-
get frontMatterForHomeFile() {
|
|
22
|
-
return '---\nlayout: default\n---';
|
|
23
|
-
}
|
|
24
|
-
getFrontMatterHeader(type) {
|
|
25
|
-
var _a;
|
|
26
|
-
const headerLines = ['---'];
|
|
27
|
-
// "layout: default" is a required front matter header for Jekyll
|
|
28
|
-
headerLines.push('layout: default');
|
|
29
|
-
// Add any additional front matter headers that might have been configured in the settings
|
|
30
|
-
const targetType = {
|
|
31
|
-
name: type.name,
|
|
32
|
-
typeName: type.type_name,
|
|
33
|
-
accessModifier: type.access_modifier,
|
|
34
|
-
group: type.group,
|
|
35
|
-
description: (_a = type.docComment) === null || _a === void 0 ? void 0 : _a.description,
|
|
36
|
-
};
|
|
37
|
-
const configuredHeaders = settings_1.Settings.getInstance().frontMatterHeader(targetType);
|
|
38
|
-
if (configuredHeaders) {
|
|
39
|
-
configuredHeaders.forEach((header) => {
|
|
40
|
-
headerLines.push(header);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
headerLines.push('---');
|
|
44
|
-
return headerLines.join('\n');
|
|
45
|
-
}
|
|
46
|
-
getLinkingStrategy() {
|
|
47
|
-
return 'path-relative';
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.JekyllDocsProcessor = JekyllDocsProcessor;
|
|
51
|
-
//# sourceMappingURL=jekyll-docsProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jekyll-docsProcessor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/jekyll/jekyll-docsProcessor.ts"],"names":[],"mappings":";;;AAAA,0EAAqE;AAErE,0EAAqE;AACrE,0EAAqE;AAErE,gDAA6C;AAE7C,MAAa,mBAAoB,SAAQ,iDAAsB;IAA/D;;QAKE,oBAAe,GAAG,CAAC,KAAa,EAAE,EAAE;YAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAC9G,CAAC,CAAC;IAmCJ,CAAC;IAzCC,YAAY;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IAMD,SAAS,CAAC,IAAU;QAClB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC;IAED,IAAI,sBAAsB;QACxB,OAAO,2BAA2B,CAAC;IACrC,CAAC;IAED,oBAAoB,CAAC,IAAU;;QAC7B,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,iEAAiE;QACjE,WAAW,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACpC,0FAA0F;QAC1F,MAAM,UAAU,GAAG;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,cAAc,EAAE,IAAI,CAAC,eAAe;YACpC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW;SAC1C,CAAC;QACF,MAAM,iBAAiB,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC/E,IAAI,iBAAiB,EAAE;YACrB,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACnC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;SACJ;QACD,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,kBAAkB;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AA1CD,kDA0CC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import ProcessorTypeTranspiler from '../processor-type-transpiler';
|
|
2
|
-
import { Type } from '@cparra/apex-reflection';
|
|
3
|
-
import { FileContainer } from '../file-container';
|
|
4
|
-
export declare abstract class MarkdownTranspilerBase extends ProcessorTypeTranspiler {
|
|
5
|
-
protected readonly _fileContainer: FileContainer;
|
|
6
|
-
constructor();
|
|
7
|
-
abstract homeFileName(): string;
|
|
8
|
-
fileBuilder(): FileContainer;
|
|
9
|
-
onBeforeProcess: (types: Type[]) => void;
|
|
10
|
-
onProcess(type: Type): void;
|
|
11
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MarkdownTranspilerBase = void 0;
|
|
4
|
-
const processor_type_transpiler_1 = require("../processor-type-transpiler");
|
|
5
|
-
const file_container_1 = require("../file-container");
|
|
6
|
-
const markdown_home_file_1 = require("../../model/markdown-home-file");
|
|
7
|
-
const markdown_type_file_1 = require("../../model/markdown-type-file");
|
|
8
|
-
class MarkdownTranspilerBase extends processor_type_transpiler_1.default {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.onBeforeProcess = (types) => {
|
|
12
|
-
this._fileContainer.pushFile(new markdown_home_file_1.MarkdownHomeFile(this.homeFileName(), types));
|
|
13
|
-
};
|
|
14
|
-
this._fileContainer = new file_container_1.FileContainer();
|
|
15
|
-
}
|
|
16
|
-
fileBuilder() {
|
|
17
|
-
return this._fileContainer;
|
|
18
|
-
}
|
|
19
|
-
onProcess(type) {
|
|
20
|
-
this._fileContainer.pushFile(new markdown_type_file_1.MarkdownTypeFile(type));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.MarkdownTranspilerBase = MarkdownTranspilerBase;
|
|
24
|
-
//# sourceMappingURL=markdown-transpiler-base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-transpiler-base.js","sourceRoot":"","sources":["../../../src/transpiler/markdown/markdown-transpiler-base.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AAEnE,sDAAkD;AAClD,uEAAkE;AAClE,uEAAkE;AAElE,MAAsB,sBAAuB,SAAQ,mCAAuB;IAG1E;QACE,KAAK,EAAE,CAAC;QAUV,oBAAe,GAAG,CAAC,KAAa,EAAE,EAAE;YAClC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QACjF,CAAC,CAAC;QAXA,IAAI,CAAC,cAAc,GAAG,IAAI,8BAAa,EAAE,CAAC;IAC5C,CAAC;IAID,WAAW;QACT,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAMD,SAAS,CAAC,IAAU;QAClB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,qCAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF;AArBD,wDAqBC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { MarkdownTranspilerBase } from '../markdown-transpiler-base';
|
|
2
|
-
import { LinkingStrategy } from '../../processor-type-transpiler';
|
|
3
|
-
export declare class PlainMarkdownDocsProcessor extends MarkdownTranspilerBase {
|
|
4
|
-
homeFileName(): string;
|
|
5
|
-
getLinkingStrategy(): LinkingStrategy;
|
|
6
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlainMarkdownDocsProcessor = void 0;
|
|
4
|
-
const markdown_transpiler_base_1 = require("../markdown-transpiler-base");
|
|
5
|
-
class PlainMarkdownDocsProcessor extends markdown_transpiler_base_1.MarkdownTranspilerBase {
|
|
6
|
-
homeFileName() {
|
|
7
|
-
return 'index';
|
|
8
|
-
}
|
|
9
|
-
getLinkingStrategy() {
|
|
10
|
-
return 'path-relative';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.PlainMarkdownDocsProcessor = PlainMarkdownDocsProcessor;
|
|
14
|
-
//# sourceMappingURL=plain-docsProcessor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plain-docsProcessor.js","sourceRoot":"","sources":["../../../../src/transpiler/markdown/plain-markdown/plain-docsProcessor.ts"],"names":[],"mappings":";;;AAAA,0EAAqE;AAGrE,MAAa,0BAA2B,SAAQ,iDAAsB;IACpE,YAAY;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,kBAAkB;QAChB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AARD,gEAQC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import ProcessorTypeTranspiler from '../processor-type-transpiler';
|
|
2
|
-
import { FileContainer } from '../file-container';
|
|
3
|
-
import { Type } from '@cparra/apex-reflection';
|
|
4
|
-
import { OpenApi } from '../../model/openapi/open-api';
|
|
5
|
-
export declare class OpenApiDocsProcessor extends ProcessorTypeTranspiler {
|
|
6
|
-
protected readonly _fileContainer: FileContainer;
|
|
7
|
-
openApiModel: OpenApi;
|
|
8
|
-
constructor();
|
|
9
|
-
fileBuilder(): FileContainer;
|
|
10
|
-
onProcess(type: Type): void;
|
|
11
|
-
onAfterProcess: ((types: Type[]) => void) | undefined;
|
|
12
|
-
private getEndpointPath;
|
|
13
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OpenApiDocsProcessor = void 0;
|
|
4
|
-
const processor_type_transpiler_1 = require("../processor-type-transpiler");
|
|
5
|
-
const file_container_1 = require("../file-container");
|
|
6
|
-
const openapi_type_file_1 = require("../../model/openapi/openapi-type-file");
|
|
7
|
-
const logger_1 = require("../../util/logger");
|
|
8
|
-
const open_api_1 = require("../../model/openapi/open-api");
|
|
9
|
-
const settings_1 = require("../../settings");
|
|
10
|
-
const MethodParser_1 = require("./parsers/MethodParser");
|
|
11
|
-
const string_utils_1 = require("../../util/string-utils");
|
|
12
|
-
class OpenApiDocsProcessor extends processor_type_transpiler_1.default {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
this.onAfterProcess = () => {
|
|
16
|
-
this._fileContainer.pushFile(new openapi_type_file_1.OpenapiTypeFile(this.openApiModel));
|
|
17
|
-
};
|
|
18
|
-
this._fileContainer = new file_container_1.FileContainer();
|
|
19
|
-
const title = settings_1.Settings.getInstance().getOpenApiTitle();
|
|
20
|
-
if (!title) {
|
|
21
|
-
throw Error('No OpenApi title was provided.');
|
|
22
|
-
}
|
|
23
|
-
this.openApiModel = new open_api_1.OpenApi(title, '1.0.0', settings_1.Settings.getInstance().getNamespace());
|
|
24
|
-
}
|
|
25
|
-
fileBuilder() {
|
|
26
|
-
return this._fileContainer;
|
|
27
|
-
}
|
|
28
|
-
onProcess(type) {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
logger_1.Logger.logSingle(`Processing ${type.name}`, false, 'green', false);
|
|
31
|
-
const endpointPath = this.getEndpointPath(type);
|
|
32
|
-
if (!endpointPath) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this.openApiModel.paths[endpointPath] = {};
|
|
36
|
-
if ((_a = type.docComment) === null || _a === void 0 ? void 0 : _a.description) {
|
|
37
|
-
this.openApiModel.paths[endpointPath].description = type.docComment.description;
|
|
38
|
-
}
|
|
39
|
-
// We can safely cast to a ClassMirror, since only these support the @RestResource annotation
|
|
40
|
-
const typeAsClass = type;
|
|
41
|
-
// Add tags for this Apex class to the OpenApi model
|
|
42
|
-
const tagName = (0, string_utils_1.camel2title)(endpointPath);
|
|
43
|
-
this.openApiModel.tags.push({
|
|
44
|
-
name: tagName,
|
|
45
|
-
description: (_b = type.docComment) === null || _b === void 0 ? void 0 : _b.description,
|
|
46
|
-
});
|
|
47
|
-
const parser = new MethodParser_1.MethodParser(this.openApiModel);
|
|
48
|
-
// GET
|
|
49
|
-
parser.parseMethod(typeAsClass, endpointPath, 'get', tagName);
|
|
50
|
-
// PATCH
|
|
51
|
-
parser.parseMethod(typeAsClass, endpointPath, 'patch', tagName);
|
|
52
|
-
// POST
|
|
53
|
-
parser.parseMethod(typeAsClass, endpointPath, 'post', tagName);
|
|
54
|
-
// PUT
|
|
55
|
-
parser.parseMethod(typeAsClass, endpointPath, 'put', tagName);
|
|
56
|
-
// DELETE
|
|
57
|
-
parser.parseMethod(typeAsClass, endpointPath, 'delete', tagName);
|
|
58
|
-
}
|
|
59
|
-
getEndpointPath(type) {
|
|
60
|
-
var _a;
|
|
61
|
-
const restResourceAnnotation = type.annotations.find((element) => element.name.toLowerCase() === 'restresource');
|
|
62
|
-
const urlMapping = (_a = restResourceAnnotation === null || restResourceAnnotation === void 0 ? void 0 : restResourceAnnotation.elementValues) === null || _a === void 0 ? void 0 : _a.find((element) => element.key.toLowerCase() === 'urlmapping');
|
|
63
|
-
if (!urlMapping) {
|
|
64
|
-
logger_1.Logger.error(`Type does not contain urlMapping annotation ${type.name}`);
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
let endpointPath = urlMapping.value.replaceAll('"', '').replaceAll("'", '').replaceAll('/*', '/');
|
|
68
|
-
if (endpointPath.startsWith('/')) {
|
|
69
|
-
endpointPath = endpointPath.substring(1);
|
|
70
|
-
}
|
|
71
|
-
return endpointPath;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.OpenApiDocsProcessor = OpenApiDocsProcessor;
|
|
75
|
-
//# sourceMappingURL=open-api-docs-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"open-api-docs-processor.js","sourceRoot":"","sources":["../../../src/transpiler/openapi/open-api-docs-processor.ts"],"names":[],"mappings":";;;AAAA,4EAAmE;AACnE,sDAAkD;AAElD,6EAAwE;AACxE,8CAA2C;AAC3C,2DAAuD;AACvD,6CAA0C;AAC1C,yDAAsD;AACtD,0DAAsD;AAEtD,MAAa,oBAAqB,SAAQ,mCAAuB;IAI/D;QACE,KAAK,EAAE,CAAC;QAsDV,mBAAc,GAA0C,GAAG,EAAE;YAC3D,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,mCAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACv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C,UAAU,CAAC,GAAG,CAAC,EAAE;YAChC,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AA/ED,oDA+EC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Reference } from './ReferenceBuilder';
|
|
2
|
-
import { ApexDocSchemaObject } from '../../../model/openapi/apex-doc-types';
|
|
3
|
-
import { SchemaObject } from '../../../model/openapi/open-api-types';
|
|
4
|
-
export type ApexDocSchemaAware = {
|
|
5
|
-
schema: ApexDocSchemaObject;
|
|
6
|
-
};
|
|
7
|
-
export declare abstract class Builder<T, K> {
|
|
8
|
-
build(schemaAware: ApexDocSchemaAware): Response<T>;
|
|
9
|
-
abstract buildBody(apexDocObject: K, reference?: Reference): T;
|
|
10
|
-
protected getOpenApiSchemaFromApexDocSchema(schemaAware: ApexDocSchemaAware, reference?: Reference): SchemaObject;
|
|
11
|
-
private isReferenceString;
|
|
12
|
-
}
|
|
13
|
-
export interface Response<T> {
|
|
14
|
-
reference?: Reference;
|
|
15
|
-
body: T;
|
|
16
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Builder = void 0;
|
|
4
|
-
const ReferenceBuilder_1 = require("./ReferenceBuilder");
|
|
5
|
-
class Builder {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.isReferenceString = (targetObject) => {
|
|
8
|
-
return typeof targetObject === 'string' || targetObject instanceof String;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
build(schemaAware) {
|
|
12
|
-
let reference;
|
|
13
|
-
if (this.isReferenceString(schemaAware.schema)) {
|
|
14
|
-
reference = new ReferenceBuilder_1.ReferenceBuilder().build(schemaAware.schema);
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
reference: reference,
|
|
18
|
-
body: this.buildBody(schemaAware, reference),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
getOpenApiSchemaFromApexDocSchema(schemaAware, reference) {
|
|
22
|
-
if (this.isReferenceString(schemaAware.schema)) {
|
|
23
|
-
// We are dealing with a reference
|
|
24
|
-
return reference.entrypointReferenceObject;
|
|
25
|
-
}
|
|
26
|
-
return schemaAware.schema;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.Builder = Builder;
|
|
30
|
-
//# sourceMappingURL=Builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Builder.js","sourceRoot":"","sources":["../../../../src/transpiler/openapi/parsers/Builder.ts"],"names":[],"mappings":";;;AAAA,yDAAiE;AAQjE,MAAsB,OAAO;IAA7B;QAuBU,sBAAiB,GAAG,CAAC,YAAiB,EAA0B,EAAE;YACxE,OAAO,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,YAAY,MAAM,CAAC;QAC5E,CAAC,CAAC;IACJ,CAAC;IAzBC,KAAK,CAAC,WAA+B;QACnC,IAAI,SAAgC,CAAC;QACrC,IAAI,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;YAC9C,SAAS,GAAG,IAAI,mCAAgB,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SAC9D;QAED,OAAO;YACL,SAAS,EAAE,SAAS;YACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAgB,EAAE,SAAS,CAAC;SAClD,CAAC;IACJ,CAAC;IAIS,iCAAiC,CAAC,WAA+B,EAAE,SAAqB;QAChG,IAAI,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;YAC9C,kCAAkC;YAClC,OAAO,SAAU,CAAC,yBAAyB,CAAC;SAC7C;QACD,OAAO,WAAW,CAAC,MAAM,CAAC;IAC5B,CAAC;CAKF;AA1BD,0BA0BC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ClassMirror } from '@cparra/apex-reflection';
|
|
2
|
-
import { OpenApi } from '../../../model/openapi/open-api';
|
|
3
|
-
type HttpOperations = 'get' | 'put' | 'post' | 'delete' | 'patch';
|
|
4
|
-
/**
|
|
5
|
-
* Parses ApexDocs with HTTP REST annotations and turns them into an OpenApi specification.
|
|
6
|
-
*/
|
|
7
|
-
export declare class MethodParser {
|
|
8
|
-
openApiModel: OpenApi;
|
|
9
|
-
constructor(openApiModel: OpenApi);
|
|
10
|
-
parseMethod(classMirror: ClassMirror, httpUrlEndpoint: string, httpMethodKey: HttpOperations, tag: string): void;
|
|
11
|
-
private parseHttpAnnotation;
|
|
12
|
-
private addToOpenApiStrategy;
|
|
13
|
-
private addRequestBodyToOpenApi;
|
|
14
|
-
private addParametersToOpenApi;
|
|
15
|
-
private addHttpResponsesToOpenApi;
|
|
16
|
-
private fallbackHttpRequestBodyParser;
|
|
17
|
-
private getFallbackHttpResponseParser;
|
|
18
|
-
private addReference;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MethodParser = void 0;
|
|
4
|
-
const yaml = require("js-yaml");
|
|
5
|
-
const ClassMirrorWrapper_1 = require("../../../model/apex-type-wrappers/ClassMirrorWrapper");
|
|
6
|
-
const ReferenceBuilder_1 = require("./ReferenceBuilder");
|
|
7
|
-
const ParameterObjectBuilder_1 = require("./ParameterObjectBuilder");
|
|
8
|
-
const ResponsesBuilder_1 = require("./ResponsesBuilder");
|
|
9
|
-
const RequestBodyBuilder_1 = require("./RequestBodyBuilder");
|
|
10
|
-
const MethodMirrorWrapper_1 = require("../../../model/apex-type-wrappers/MethodMirrorWrapper");
|
|
11
|
-
/**
|
|
12
|
-
* Parses ApexDocs with HTTP REST annotations and turns them into an OpenApi specification.
|
|
13
|
-
*/
|
|
14
|
-
class MethodParser {
|
|
15
|
-
constructor(openApiModel) {
|
|
16
|
-
this.openApiModel = openApiModel;
|
|
17
|
-
}
|
|
18
|
-
parseMethod(classMirror, httpUrlEndpoint, httpMethodKey, tag) {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
const classMirrorWrapper = new ClassMirrorWrapper_1.ClassMirrorWrapper(classMirror);
|
|
21
|
-
// Apex supports HttpGet, HttpPut, HttpPost, HttpDelete, and HttpPatch, so we search for a method
|
|
22
|
-
// that has one of those annotations.
|
|
23
|
-
const httpMethods = classMirrorWrapper.getMethodsByAnnotation(`http${httpMethodKey}`);
|
|
24
|
-
if (!httpMethods.length) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
// We can assume there is at most one method per annotation, as this is an Apex rule.
|
|
28
|
-
const httpMethod = httpMethods[0];
|
|
29
|
-
this.openApiModel.paths[httpUrlEndpoint][httpMethodKey] = {};
|
|
30
|
-
this.openApiModel.paths[httpUrlEndpoint][httpMethodKey].tags = [tag];
|
|
31
|
-
if ((_a = httpMethod.docComment) === null || _a === void 0 ? void 0 : _a.description) {
|
|
32
|
-
this.openApiModel.paths[httpUrlEndpoint][httpMethodKey].description = httpMethod.docComment.description;
|
|
33
|
-
}
|
|
34
|
-
const methodMirrorWrapper = new MethodMirrorWrapper_1.MethodMirrorWrapper(httpMethod);
|
|
35
|
-
if (methodMirrorWrapper.hasDocCommentAnnotation('summary')) {
|
|
36
|
-
this.openApiModel.paths[httpUrlEndpoint][httpMethodKey].summary =
|
|
37
|
-
(_b = methodMirrorWrapper.getDocCommentAnnotation('summary')) === null || _b === void 0 ? void 0 : _b.body;
|
|
38
|
-
}
|
|
39
|
-
this.parseHttpAnnotation(httpMethod, httpUrlEndpoint, httpMethodKey, 'http-request-body', this.addRequestBodyToOpenApi.bind(this), this.fallbackHttpRequestBodyParser(httpUrlEndpoint, httpMethodKey));
|
|
40
|
-
this.parseHttpAnnotation(httpMethod, httpUrlEndpoint, httpMethodKey, 'http-parameter', this.addParametersToOpenApi.bind(this));
|
|
41
|
-
this.parseHttpAnnotation(httpMethod, httpUrlEndpoint, httpMethodKey, 'http-response', this.addHttpResponsesToOpenApi.bind(this), this.getFallbackHttpResponseParser(httpUrlEndpoint, httpMethodKey));
|
|
42
|
-
}
|
|
43
|
-
parseHttpAnnotation(httpMethod, urlValue, httpMethodKey, annotationName, addToOpenApi, fallbackParser) {
|
|
44
|
-
var _a;
|
|
45
|
-
const annotations = (_a = httpMethod.docComment) === null || _a === void 0 ? void 0 : _a.annotations.filter((annotation) => annotation.name === annotationName);
|
|
46
|
-
if (!(annotations === null || annotations === void 0 ? void 0 : annotations.length)) {
|
|
47
|
-
if (fallbackParser) {
|
|
48
|
-
fallbackParser(httpMethod);
|
|
49
|
-
}
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
for (const annotation of annotations) {
|
|
53
|
-
// We expect the ApexDoc data representing this to be in YAML format.
|
|
54
|
-
const inYaml = annotation === null || annotation === void 0 ? void 0 : annotation.bodyLines.reduce((prev, current, _) => prev + '\n' + current);
|
|
55
|
-
if (!inYaml) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
this.addToOpenApiStrategy(inYaml, urlValue, httpMethodKey, addToOpenApi);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
addToOpenApiStrategy(inYaml, urlValue, httpMethodKey, addToOpenApi) {
|
|
62
|
-
// Convert the YAML into a JSON object.
|
|
63
|
-
const inJson = yaml.load(inYaml);
|
|
64
|
-
const requestBodyResponse = new RequestBodyBuilder_1.RequestBodyBuilder().build(inJson);
|
|
65
|
-
addToOpenApi(inJson, urlValue, httpMethodKey);
|
|
66
|
-
this.addReference(requestBodyResponse);
|
|
67
|
-
}
|
|
68
|
-
addRequestBodyToOpenApi(input, urlValue, httpMethodKey) {
|
|
69
|
-
const requestBodyResponse = new RequestBodyBuilder_1.RequestBodyBuilder().build(input);
|
|
70
|
-
this.openApiModel.paths[urlValue][httpMethodKey].requestBody = requestBodyResponse.body;
|
|
71
|
-
}
|
|
72
|
-
addParametersToOpenApi(input, urlValue, httpMethodKey) {
|
|
73
|
-
const parameterObjectResponse = new ParameterObjectBuilder_1.ParameterObjectBuilder().build(input);
|
|
74
|
-
if (this.openApiModel.paths[urlValue][httpMethodKey].parameters === undefined) {
|
|
75
|
-
// If no parameters have been defined yet, initialize the list.
|
|
76
|
-
this.openApiModel.paths[urlValue][httpMethodKey].parameters = [];
|
|
77
|
-
}
|
|
78
|
-
this.openApiModel.paths[urlValue][httpMethodKey].parameters.push(parameterObjectResponse.body);
|
|
79
|
-
}
|
|
80
|
-
addHttpResponsesToOpenApi(input, urlValue, httpMethodKey) {
|
|
81
|
-
const responseObjectResponse = new ResponsesBuilder_1.ResponsesBuilder().build(input);
|
|
82
|
-
if (this.openApiModel.paths[urlValue][httpMethodKey].responses === undefined) {
|
|
83
|
-
this.openApiModel.paths[urlValue][httpMethodKey].responses = {};
|
|
84
|
-
}
|
|
85
|
-
this.openApiModel.paths[urlValue][httpMethodKey].responses[input.statusCode] = responseObjectResponse.body;
|
|
86
|
-
}
|
|
87
|
-
fallbackHttpRequestBodyParser(httpUrlEndpoint, httpMethodKey) {
|
|
88
|
-
return (methodMirror) => {
|
|
89
|
-
// If the Apex method receives parameters, they will be interpreted by Salesforce as a JSON
|
|
90
|
-
// object, with each key of the object being the parameter name.
|
|
91
|
-
const parameters = methodMirror.parameters;
|
|
92
|
-
if (!parameters.length) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const propertiesObject = {};
|
|
96
|
-
parameters.forEach((currentParameter) => {
|
|
97
|
-
const propertyKey = currentParameter.name;
|
|
98
|
-
const propertyReference = new ReferenceBuilder_1.ReferenceBuilder().getReferenceType(currentParameter.typeReference);
|
|
99
|
-
propertiesObject[propertyKey] = propertyReference.schema;
|
|
100
|
-
this.addReference({
|
|
101
|
-
reference: {
|
|
102
|
-
entrypointReferenceObject: propertyReference.schema,
|
|
103
|
-
referenceComponents: propertyReference.referenceComponents,
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
this.openApiModel.paths[httpUrlEndpoint][httpMethodKey].requestBody = {
|
|
108
|
-
content: {
|
|
109
|
-
'application/json': {
|
|
110
|
-
schema: {
|
|
111
|
-
type: 'object',
|
|
112
|
-
properties: propertiesObject,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
getFallbackHttpResponseParser(httpUrlEndpoint, httpMethodKey) {
|
|
120
|
-
return (methodMirror) => {
|
|
121
|
-
var _a, _b;
|
|
122
|
-
// Parses methods that return an object (as opposed to void).
|
|
123
|
-
const returnType = methodMirror.typeReference;
|
|
124
|
-
if (returnType.type.toLowerCase() === 'void') {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const reference = new ReferenceBuilder_1.ReferenceBuilder().getReferenceType(returnType);
|
|
128
|
-
this.addReference({
|
|
129
|
-
reference: {
|
|
130
|
-
entrypointReferenceObject: reference.schema,
|
|
131
|
-
referenceComponents: reference.referenceComponents,
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
if (this.openApiModel.paths[httpUrlEndpoint][httpMethodKey].responses === undefined) {
|
|
135
|
-
this.openApiModel.paths[httpUrlEndpoint][httpMethodKey].responses = {};
|
|
136
|
-
}
|
|
137
|
-
// Successful responses with a non-void return type always return a status code of 2000
|
|
138
|
-
this.openApiModel.paths[httpUrlEndpoint][httpMethodKey].responses['200'] = {
|
|
139
|
-
description: (_b = (_a = methodMirror.docComment) === null || _a === void 0 ? void 0 : _a.description) !== null && _b !== void 0 ? _b : 'Status code 200',
|
|
140
|
-
content: {
|
|
141
|
-
'application/json': { schema: reference.schema },
|
|
142
|
-
},
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
addReference(referenceHolder) {
|
|
147
|
-
if (referenceHolder.reference) {
|
|
148
|
-
// If a reference is returned, we want to make sure to add it to the OpenApi object as well
|
|
149
|
-
// Add to "component" section if it hasn't been already
|
|
150
|
-
if (this.openApiModel.components === undefined) {
|
|
151
|
-
this.openApiModel.components = {
|
|
152
|
-
schemas: {},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
if (!referenceHolder.reference.referenceComponents.length) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
// Add all received references to the OpenApi components section.
|
|
159
|
-
referenceHolder.reference.referenceComponents.forEach((current) => {
|
|
160
|
-
// Check if the referenced object is already part of the OpenApi object
|
|
161
|
-
this.openApiModel.components.schemas[current.referencedClass] = current.schema;
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
exports.MethodParser = MethodParser;
|
|
167
|
-
//# sourceMappingURL=MethodParser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MethodParser.js","sourceRoot":"","sources":["../../../../src/transpiler/openapi/parsers/MethodParser.ts"],"names":[],"mappings":";;;AAEA,gCAAgC;AAChC,6FAA0F;AAC1F,yDAAiE;AACjE,qEAAkE;AAClE,yDAAsD;AAMtD,6DAA0D;AAG1D,+FAA4F;AAO5F;;GAEG;AACH,MAAa,YAAY;IACvB,YAAmB,YAAqB;QAArB,iBAAY,GAAZ,YAAY,CAAS;IAAG,CAAC;IAErC,WAAW,CAAC,WAAwB,EAAE,eAAuB,EAAE,aAA6B,EAAE,GAAW;;QAC9G,MAAM,kBAAkB,GAAG,IAAI,uCAAkB,CAAC,WAAW,CAAC,CAAC;QAC/D,iGAAiG;QACjG,qCAAqC;QACrC,MAAM,WAAW,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,OAAO,aAAa,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YACvB,OAAO;SACR;QAED,qFAAqF;QACrF,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAElC,IAAI,CAAC,YAAY,C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AAC,OAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;YACnF,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AA/ND,oCA+NC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ParameterObject } from '../../../model/openapi/open-api-types';
|
|
2
|
-
import { Reference } from './ReferenceBuilder';
|
|
3
|
-
import { ApexDocParameterObject } from '../../../model/openapi/apex-doc-types';
|
|
4
|
-
import { Builder } from './Builder';
|
|
5
|
-
export declare class ParameterObjectBuilder extends Builder<ParameterObject, ApexDocParameterObject> {
|
|
6
|
-
buildBody(apexDocObject: ApexDocParameterObject, reference?: Reference): ParameterObject;
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParameterObjectBuilder = void 0;
|
|
4
|
-
const Builder_1 = require("./Builder");
|
|
5
|
-
class ParameterObjectBuilder extends Builder_1.Builder {
|
|
6
|
-
buildBody(apexDocObject, reference) {
|
|
7
|
-
return Object.assign(Object.assign({}, apexDocObject), { schema: this.getOpenApiSchemaFromApexDocSchema(apexDocObject, reference) });
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.ParameterObjectBuilder = ParameterObjectBuilder;
|
|
11
|
-
//# sourceMappingURL=ParameterObjectBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterObjectBuilder.js","sourceRoot":"","sources":["../../../../src/transpiler/openapi/parsers/ParameterObjectBuilder.ts"],"names":[],"mappings":";;;AAGA,uCAAoC;AAEpC,MAAa,sBAAuB,SAAQ,iBAAgD;IAC1F,SAAS,CAAC,aAAqC,EAAE,SAAqB;QACpE,uCACK,aAAa,KAChB,MAAM,EAAE,IAAI,CAAC,iCAAiC,CAAC,aAAa,EAAE,SAAS,CAAC,IACxE;IACJ,CAAC;CACF;AAPD,wDAOC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ReferenceObject, SchemaObject, SchemaObjectArray, SchemaObjectObject } from '../../../model/openapi/open-api-types';
|
|
2
|
-
import { ReferencedType } from '@cparra/apex-reflection';
|
|
3
|
-
export declare class ReferenceBuilder {
|
|
4
|
-
build(referencedTypeName: string): Reference;
|
|
5
|
-
/**
|
|
6
|
-
* Returns a tuple where the first value is the name of the reference without any collection related values
|
|
7
|
-
* and the second is a boolean representing if we are dealing with a collection or not.
|
|
8
|
-
* @param referencedTypeName The received raw type name.
|
|
9
|
-
* @private
|
|
10
|
-
*/
|
|
11
|
-
private handlePossibleCollectionReference;
|
|
12
|
-
private buildReferenceFromType;
|
|
13
|
-
private handleOverriddenSchema;
|
|
14
|
-
private getReferenceName;
|
|
15
|
-
private buildMainReferenceComponent;
|
|
16
|
-
getReferenceType(typeInMirror: ReferencedType): SchemaObjectReferencePair;
|
|
17
|
-
private buildCollectionPair;
|
|
18
|
-
private isReferenceString;
|
|
19
|
-
}
|
|
20
|
-
type SchemaObjectReferencePair = {
|
|
21
|
-
schema: SchemaObject;
|
|
22
|
-
referenceComponents: ReferenceComponent[];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* In case where the Request Body contains a reference, this contains information about the handled reference
|
|
26
|
-
*/
|
|
27
|
-
export type Reference = {
|
|
28
|
-
/** OpenApi style reference object for the parent caller */
|
|
29
|
-
entrypointReferenceObject: ReferenceObject;
|
|
30
|
-
/** List of objects that contain all component references identified by a call to this builder **/
|
|
31
|
-
referenceComponents: ReferenceComponent[];
|
|
32
|
-
};
|
|
33
|
-
export type ReferenceComponent = {
|
|
34
|
-
/** Name of the class being referenced */
|
|
35
|
-
referencedClass: string;
|
|
36
|
-
/** Parsed representation of the referenced object as an OpenApi Schema object */
|
|
37
|
-
schema: SchemaObjectObject | SchemaObjectArray;
|
|
38
|
-
};
|
|
39
|
-
export {};
|