vona-module-a-swagger 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/common/index.d.ts +2 -0
- package/dist/lib/common/index.d.ts.map +1 -0
- package/dist/lib/common/index.js +2 -0
- package/dist/lib/common/index.js.map +1 -0
- package/dist/lib/common/type.interface.d.ts +4 -0
- package/dist/lib/common/type.interface.d.ts.map +1 -0
- package/dist/lib/common/type.interface.js +2 -0
- package/dist/lib/common/type.interface.js.map +1 -0
- package/dist/lib/constants.d.ts +22 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +22 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/decorators/api-basic.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-basic.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-basic.decorator.js +5 -0
- package/dist/lib/decorators/api-basic.decorator.js.map +1 -0
- package/dist/lib/decorators/api-bearer.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-bearer.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-bearer.decorator.js +5 -0
- package/dist/lib/decorators/api-bearer.decorator.js.map +1 -0
- package/dist/lib/decorators/api-body.decorator.d.ts +17 -0
- package/dist/lib/decorators/api-body.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-body.decorator.js +24 -0
- package/dist/lib/decorators/api-body.decorator.js.map +1 -0
- package/dist/lib/decorators/api-callbacks.decorator.d.ts +3 -0
- package/dist/lib/decorators/api-callbacks.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-callbacks.decorator.js +6 -0
- package/dist/lib/decorators/api-callbacks.decorator.js.map +1 -0
- package/dist/lib/decorators/api-consumes.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-consumes.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-consumes.decorator.js +6 -0
- package/dist/lib/decorators/api-consumes.decorator.js.map +1 -0
- package/dist/lib/decorators/api-cookie.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-cookie.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-cookie.decorator.js +5 -0
- package/dist/lib/decorators/api-cookie.decorator.js.map +1 -0
- package/dist/lib/decorators/api-default-getter.decorator.d.ts +25 -0
- package/dist/lib/decorators/api-default-getter.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-default-getter.decorator.js +32 -0
- package/dist/lib/decorators/api-default-getter.decorator.js.map +1 -0
- package/dist/lib/decorators/api-exclude-controller.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-exclude-controller.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-exclude-controller.decorator.js +6 -0
- package/dist/lib/decorators/api-exclude-controller.decorator.js.map +1 -0
- package/dist/lib/decorators/api-exclude-endpoint.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-exclude-endpoint.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-exclude-endpoint.decorator.js +8 -0
- package/dist/lib/decorators/api-exclude-endpoint.decorator.js.map +1 -0
- package/dist/lib/decorators/api-extension.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-extension.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-extension.decorator.js +13 -0
- package/dist/lib/decorators/api-extension.decorator.js.map +1 -0
- package/dist/lib/decorators/api-extra-models.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-extra-models.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-extra-models.decorator.js +14 -0
- package/dist/lib/decorators/api-extra-models.decorator.js.map +1 -0
- package/dist/lib/decorators/api-header.decorator.d.ts +8 -0
- package/dist/lib/decorators/api-header.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-header.decorator.js +40 -0
- package/dist/lib/decorators/api-header.decorator.js.map +1 -0
- package/dist/lib/decorators/api-hide-property.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-hide-property.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-hide-property.decorator.js +5 -0
- package/dist/lib/decorators/api-hide-property.decorator.js.map +1 -0
- package/dist/lib/decorators/api-link.decorator.d.ts +48 -0
- package/dist/lib/decorators/api-link.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-link.decorator.js +50 -0
- package/dist/lib/decorators/api-link.decorator.js.map +1 -0
- package/dist/lib/decorators/api-oauth2.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-oauth2.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-oauth2.decorator.js +5 -0
- package/dist/lib/decorators/api-oauth2.decorator.js.map +1 -0
- package/dist/lib/decorators/api-operation.decorator.d.ts +6 -0
- package/dist/lib/decorators/api-operation.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-operation.decorator.js +13 -0
- package/dist/lib/decorators/api-operation.decorator.js.map +1 -0
- package/dist/lib/decorators/api-param.decorator.d.ts +23 -0
- package/dist/lib/decorators/api-param.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-param.decorator.js +19 -0
- package/dist/lib/decorators/api-param.decorator.js.map +1 -0
- package/dist/lib/decorators/api-produces.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-produces.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-produces.decorator.js +6 -0
- package/dist/lib/decorators/api-produces.decorator.js.map +1 -0
- package/dist/lib/decorators/api-property.decorator.d.ts +25 -0
- package/dist/lib/decorators/api-property.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-property.decorator.js +53 -0
- package/dist/lib/decorators/api-property.decorator.js.map +1 -0
- package/dist/lib/decorators/api-query.decorator.d.ts +25 -0
- package/dist/lib/decorators/api-query.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-query.decorator.js +28 -0
- package/dist/lib/decorators/api-query.decorator.js.map +1 -0
- package/dist/lib/decorators/api-response.decorator.d.ts +40 -0
- package/dist/lib/decorators/api-response.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-response.decorator.js +63 -0
- package/dist/lib/decorators/api-response.decorator.js.map +1 -0
- package/dist/lib/decorators/api-schema.decorator.d.ts +9 -0
- package/dist/lib/decorators/api-schema.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-schema.decorator.js +6 -0
- package/dist/lib/decorators/api-schema.decorator.js.map +1 -0
- package/dist/lib/decorators/api-security.decorator.d.ts +3 -0
- package/dist/lib/decorators/api-security.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-security.decorator.js +23 -0
- package/dist/lib/decorators/api-security.decorator.js.map +1 -0
- package/dist/lib/decorators/api-use-tags.decorator.d.ts +2 -0
- package/dist/lib/decorators/api-use-tags.decorator.d.ts.map +1 -0
- package/dist/lib/decorators/api-use-tags.decorator.js +6 -0
- package/dist/lib/decorators/api-use-tags.decorator.js.map +1 -0
- package/dist/lib/decorators/helpers.d.ts +9 -0
- package/dist/lib/decorators/helpers.d.ts.map +1 -0
- package/dist/lib/decorators/helpers.js +120 -0
- package/dist/lib/decorators/helpers.js.map +1 -0
- package/dist/lib/decorators/index.d.ts +25 -0
- package/dist/lib/decorators/index.d.ts.map +1 -0
- package/dist/lib/decorators/index.js +25 -0
- package/dist/lib/decorators/index.js.map +1 -0
- package/dist/lib/document-builder.d.ts +28 -0
- package/dist/lib/document-builder.d.ts.map +1 -0
- package/dist/lib/document-builder.js +167 -0
- package/dist/lib/document-builder.js.map +1 -0
- package/dist/lib/explorers/api-callbacks.explorer.d.ts +3 -0
- package/dist/lib/explorers/api-callbacks.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-callbacks.explorer.js +35 -0
- package/dist/lib/explorers/api-callbacks.explorer.js.map +1 -0
- package/dist/lib/explorers/api-consumes.explorer.d.ts +6 -0
- package/dist/lib/explorers/api-consumes.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-consumes.explorer.js +7 -0
- package/dist/lib/explorers/api-consumes.explorer.js.map +1 -0
- package/dist/lib/explorers/api-exclude-controller.explorer.d.ts +3 -0
- package/dist/lib/explorers/api-exclude-controller.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-exclude-controller.explorer.js +3 -0
- package/dist/lib/explorers/api-exclude-controller.explorer.js.map +1 -0
- package/dist/lib/explorers/api-exclude-endpoint.explorer.d.ts +3 -0
- package/dist/lib/explorers/api-exclude-endpoint.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-exclude-endpoint.explorer.js +3 -0
- package/dist/lib/explorers/api-exclude-endpoint.explorer.js.map +1 -0
- package/dist/lib/explorers/api-extra-models.explorer.d.ts +4 -0
- package/dist/lib/explorers/api-extra-models.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-extra-models.explorer.js +7 -0
- package/dist/lib/explorers/api-extra-models.explorer.js.map +1 -0
- package/dist/lib/explorers/api-headers.explorer.d.ts +8 -0
- package/dist/lib/explorers/api-headers.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-headers.explorer.js +6 -0
- package/dist/lib/explorers/api-headers.explorer.js.map +1 -0
- package/dist/lib/explorers/api-operation.explorer.d.ts +3 -0
- package/dist/lib/explorers/api-operation.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-operation.explorer.js +38 -0
- package/dist/lib/explorers/api-operation.explorer.js.map +1 -0
- package/dist/lib/explorers/api-parameters.explorer.d.ts +6 -0
- package/dist/lib/explorers/api-parameters.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-parameters.explorer.js +44 -0
- package/dist/lib/explorers/api-parameters.explorer.js.map +1 -0
- package/dist/lib/explorers/api-produces.explorer.d.ts +6 -0
- package/dist/lib/explorers/api-produces.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-produces.explorer.js +7 -0
- package/dist/lib/explorers/api-produces.explorer.js.map +1 -0
- package/dist/lib/explorers/api-response.explorer.d.ts +8 -0
- package/dist/lib/explorers/api-response.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-response.explorer.js +77 -0
- package/dist/lib/explorers/api-response.explorer.js.map +1 -0
- package/dist/lib/explorers/api-security.explorer.d.ts +6 -0
- package/dist/lib/explorers/api-security.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-security.explorer.js +9 -0
- package/dist/lib/explorers/api-security.explorer.js.map +1 -0
- package/dist/lib/explorers/api-use-tags.explorer.d.ts +6 -0
- package/dist/lib/explorers/api-use-tags.explorer.d.ts.map +1 -0
- package/dist/lib/explorers/api-use-tags.explorer.js +17 -0
- package/dist/lib/explorers/api-use-tags.explorer.js.map +1 -0
- package/dist/lib/extra/swagger-shim.d.ts +97 -0
- package/dist/lib/extra/swagger-shim.d.ts.map +1 -0
- package/dist/lib/extra/swagger-shim.js +265 -0
- package/dist/lib/extra/swagger-shim.js.map +1 -0
- package/dist/lib/fixtures/document.base.d.ts +3 -0
- package/dist/lib/fixtures/document.base.d.ts.map +1 -0
- package/dist/lib/fixtures/document.base.js +13 -0
- package/dist/lib/fixtures/document.base.js.map +1 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +8 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/interfaces/callback-object.interface.d.ts +13 -0
- package/dist/lib/interfaces/callback-object.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/callback-object.interface.js +2 -0
- package/dist/lib/interfaces/callback-object.interface.js.map +1 -0
- package/dist/lib/interfaces/denormalized-doc-resolvers.interface.d.ts +8 -0
- package/dist/lib/interfaces/denormalized-doc-resolvers.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/denormalized-doc-resolvers.interface.js +2 -0
- package/dist/lib/interfaces/denormalized-doc-resolvers.interface.js.map +1 -0
- package/dist/lib/interfaces/denormalized-doc.interface.d.ts +9 -0
- package/dist/lib/interfaces/denormalized-doc.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/denormalized-doc.interface.js +2 -0
- package/dist/lib/interfaces/denormalized-doc.interface.js.map +1 -0
- package/dist/lib/interfaces/enum-schema-attributes.interface.d.ts +3 -0
- package/dist/lib/interfaces/enum-schema-attributes.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/enum-schema-attributes.interface.js +2 -0
- package/dist/lib/interfaces/enum-schema-attributes.interface.js.map +1 -0
- package/dist/lib/interfaces/index.d.ts +4 -0
- package/dist/lib/interfaces/index.d.ts.map +1 -0
- package/dist/lib/interfaces/index.js +3 -0
- package/dist/lib/interfaces/index.js.map +1 -0
- package/dist/lib/interfaces/module-route.interface.d.ts +3 -0
- package/dist/lib/interfaces/module-route.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/module-route.interface.js +2 -0
- package/dist/lib/interfaces/module-route.interface.js.map +1 -0
- package/dist/lib/interfaces/open-api-spec.interface.d.ts +241 -0
- package/dist/lib/interfaces/open-api-spec.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/open-api-spec.interface.js +6 -0
- package/dist/lib/interfaces/open-api-spec.interface.js.map +1 -0
- package/dist/lib/interfaces/schema-object-metadata.interface.d.ts +24 -0
- package/dist/lib/interfaces/schema-object-metadata.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/schema-object-metadata.interface.js +2 -0
- package/dist/lib/interfaces/schema-object-metadata.interface.js.map +1 -0
- package/dist/lib/interfaces/swagger-custom-options.interface.d.ts +85 -0
- package/dist/lib/interfaces/swagger-custom-options.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/swagger-custom-options.interface.js +2 -0
- package/dist/lib/interfaces/swagger-custom-options.interface.js.map +1 -0
- package/dist/lib/interfaces/swagger-document-options.interface.d.ts +36 -0
- package/dist/lib/interfaces/swagger-document-options.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/swagger-document-options.interface.js +2 -0
- package/dist/lib/interfaces/swagger-document-options.interface.js.map +1 -0
- package/dist/lib/interfaces/swagger-ui-init-options.interface.d.ts +8 -0
- package/dist/lib/interfaces/swagger-ui-init-options.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/swagger-ui-init-options.interface.js +2 -0
- package/dist/lib/interfaces/swagger-ui-init-options.interface.js.map +1 -0
- package/dist/lib/interfaces/swagger-ui-options.interface.d.ts +21 -0
- package/dist/lib/interfaces/swagger-ui-options.interface.d.ts.map +1 -0
- package/dist/lib/interfaces/swagger-ui-options.interface.js +2 -0
- package/dist/lib/interfaces/swagger-ui-options.interface.js.map +1 -0
- package/dist/lib/plugin/compiler-plugin.d.ts +3 -0
- package/dist/lib/plugin/compiler-plugin.d.ts.map +1 -0
- package/dist/lib/plugin/compiler-plugin.js +27 -0
- package/dist/lib/plugin/compiler-plugin.js.map +1 -0
- package/dist/lib/plugin/index.d.ts +3 -0
- package/dist/lib/plugin/index.d.ts.map +1 -0
- package/dist/lib/plugin/index.js +3 -0
- package/dist/lib/plugin/index.js.map +1 -0
- package/dist/lib/plugin/merge-options.d.ts +15 -0
- package/dist/lib/plugin/merge-options.d.ts.map +1 -0
- package/dist/lib/plugin/merge-options.js +35 -0
- package/dist/lib/plugin/merge-options.js.map +1 -0
- package/dist/lib/plugin/metadata-loader.d.ts +8 -0
- package/dist/lib/plugin/metadata-loader.d.ts.map +1 -0
- package/dist/lib/plugin/metadata-loader.js +41 -0
- package/dist/lib/plugin/metadata-loader.js.map +1 -0
- package/dist/lib/plugin/plugin-constants.d.ts +4 -0
- package/dist/lib/plugin/plugin-constants.d.ts.map +1 -0
- package/dist/lib/plugin/plugin-constants.js +4 -0
- package/dist/lib/plugin/plugin-constants.js.map +1 -0
- package/dist/lib/plugin/plugin-debug-logger.d.ts +6 -0
- package/dist/lib/plugin/plugin-debug-logger.d.ts.map +1 -0
- package/dist/lib/plugin/plugin-debug-logger.js +5 -0
- package/dist/lib/plugin/plugin-debug-logger.js.map +1 -0
- package/dist/lib/plugin/utils/ast-utils.d.ts +31 -0
- package/dist/lib/plugin/utils/ast-utils.d.ts.map +1 -0
- package/dist/lib/plugin/utils/ast-utils.js +242 -0
- package/dist/lib/plugin/utils/ast-utils.js.map +1 -0
- package/dist/lib/plugin/utils/external-imports.util.d.ts +4 -0
- package/dist/lib/plugin/utils/external-imports.util.d.ts.map +1 -0
- package/dist/lib/plugin/utils/external-imports.util.js +31 -0
- package/dist/lib/plugin/utils/external-imports.util.js.map +1 -0
- package/dist/lib/plugin/utils/is-filename-matched.util.d.ts +2 -0
- package/dist/lib/plugin/utils/is-filename-matched.util.d.ts.map +1 -0
- package/dist/lib/plugin/utils/is-filename-matched.util.js +2 -0
- package/dist/lib/plugin/utils/is-filename-matched.util.js.map +1 -0
- package/dist/lib/plugin/utils/plugin-utils.d.ts +58 -0
- package/dist/lib/plugin/utils/plugin-utils.d.ts.map +1 -0
- package/dist/lib/plugin/utils/plugin-utils.js +282 -0
- package/dist/lib/plugin/utils/plugin-utils.js.map +1 -0
- package/dist/lib/plugin/utils/type-reference-to-identifier.util.d.ts +8 -0
- package/dist/lib/plugin/utils/type-reference-to-identifier.util.d.ts.map +1 -0
- package/dist/lib/plugin/utils/type-reference-to-identifier.util.js +50 -0
- package/dist/lib/plugin/utils/type-reference-to-identifier.util.js.map +1 -0
- package/dist/lib/plugin/visitors/abstract.visitor.d.ts +5 -0
- package/dist/lib/plugin/visitors/abstract.visitor.d.ts.map +1 -0
- package/dist/lib/plugin/visitors/abstract.visitor.js +20 -0
- package/dist/lib/plugin/visitors/abstract.visitor.js.map +1 -0
- package/dist/lib/plugin/visitors/controller-class.visitor.d.ts +21 -0
- package/dist/lib/plugin/visitors/controller-class.visitor.d.ts.map +1 -0
- package/dist/lib/plugin/visitors/controller-class.visitor.js +266 -0
- package/dist/lib/plugin/visitors/controller-class.visitor.js.map +1 -0
- package/dist/lib/plugin/visitors/model-class.visitor.d.ts +40 -0
- package/dist/lib/plugin/visitors/model-class.visitor.d.ts.map +1 -0
- package/dist/lib/plugin/visitors/model-class.visitor.js +445 -0
- package/dist/lib/plugin/visitors/model-class.visitor.js.map +1 -0
- package/dist/lib/plugin/visitors/readonly.visitor.d.ts +22 -0
- package/dist/lib/plugin/visitors/readonly.visitor.d.ts.map +1 -0
- package/dist/lib/plugin/visitors/readonly.visitor.js +60 -0
- package/dist/lib/plugin/visitors/readonly.visitor.js.map +1 -0
- package/dist/lib/services/constants.d.ts +2 -0
- package/dist/lib/services/constants.d.ts.map +1 -0
- package/dist/lib/services/constants.js +2 -0
- package/dist/lib/services/constants.js.map +1 -0
- package/dist/lib/services/decorators-properties.d.ts +27 -0
- package/dist/lib/services/decorators-properties.d.ts.map +1 -0
- package/dist/lib/services/decorators-properties.js +147 -0
- package/dist/lib/services/decorators-properties.js.map +1 -0
- package/dist/lib/services/mimetype-content-wrapper.d.ts +5 -0
- package/dist/lib/services/mimetype-content-wrapper.d.ts.map +1 -0
- package/dist/lib/services/mimetype-content-wrapper.js +8 -0
- package/dist/lib/services/mimetype-content-wrapper.js.map +1 -0
- package/dist/lib/services/model-properties-accessor.d.ts +7 -0
- package/dist/lib/services/model-properties-accessor.d.ts.map +1 -0
- package/dist/lib/services/model-properties-accessor.js +33 -0
- package/dist/lib/services/model-properties-accessor.js.map +1 -0
- package/dist/lib/services/parameter-metadata-accessor.d.ts +22 -0
- package/dist/lib/services/parameter-metadata-accessor.d.ts.map +1 -0
- package/dist/lib/services/parameter-metadata-accessor.js +38 -0
- package/dist/lib/services/parameter-metadata-accessor.js.map +1 -0
- package/dist/lib/services/parameters-metadata-mapper.d.ts +10 -0
- package/dist/lib/services/parameters-metadata-mapper.d.ts.map +1 -0
- package/dist/lib/services/parameters-metadata-mapper.js +45 -0
- package/dist/lib/services/parameters-metadata-mapper.js.map +1 -0
- package/dist/lib/services/response-object-factory.d.ts +15 -0
- package/dist/lib/services/response-object-factory.d.ts.map +1 -0
- package/dist/lib/services/response-object-factory.js +123 -0
- package/dist/lib/services/response-object-factory.js.map +1 -0
- package/dist/lib/services/response-object-mapper.d.ts +8 -0
- package/dist/lib/services/response-object-mapper.d.ts.map +1 -0
- package/dist/lib/services/response-object-mapper.js +55 -0
- package/dist/lib/services/response-object-mapper.js.map +1 -0
- package/dist/lib/services/schema-object-factory.d.ts +160 -0
- package/dist/lib/services/schema-object-factory.d.ts.map +1 -0
- package/dist/lib/services/schema-object-factory.js +484 -0
- package/dist/lib/services/schema-object-factory.js.map +1 -0
- package/dist/lib/services/swagger-types-mapper.d.ts +19 -0
- package/dist/lib/services/swagger-types-mapper.d.ts.map +1 -0
- package/dist/lib/services/swagger-types-mapper.js +132 -0
- package/dist/lib/services/swagger-types-mapper.js.map +1 -0
- package/dist/lib/storages/global-parameters.storage.d.ts +9 -0
- package/dist/lib/storages/global-parameters.storage.d.ts.map +1 -0
- package/dist/lib/storages/global-parameters.storage.js +23 -0
- package/dist/lib/storages/global-parameters.storage.js.map +1 -0
- package/dist/lib/swagger-transformer.d.ts +8 -0
- package/dist/lib/swagger-transformer.d.ts.map +1 -0
- package/dist/lib/swagger-transformer.js +36 -0
- package/dist/lib/swagger-transformer.js.map +1 -0
- package/dist/lib/swagger-ui/constants.d.ts +4 -0
- package/dist/lib/swagger-ui/constants.d.ts.map +1 -0
- package/dist/lib/swagger-ui/constants.js +130 -0
- package/dist/lib/swagger-ui/constants.js.map +1 -0
- package/dist/lib/swagger-ui/helpers.d.ts +6 -0
- package/dist/lib/swagger-ui/helpers.d.ts.map +1 -0
- package/dist/lib/swagger-ui/helpers.js +17 -0
- package/dist/lib/swagger-ui/helpers.js.map +1 -0
- package/dist/lib/swagger-ui/index.d.ts +2 -0
- package/dist/lib/swagger-ui/index.d.ts.map +1 -0
- package/dist/lib/swagger-ui/index.js +2 -0
- package/dist/lib/swagger-ui/index.js.map +1 -0
- package/dist/lib/swagger-ui/swagger-ui.d.ts +14 -0
- package/dist/lib/swagger-ui/swagger-ui.d.ts.map +1 -0
- package/dist/lib/swagger-ui/swagger-ui.js +64 -0
- package/dist/lib/swagger-ui/swagger-ui.js.map +1 -0
- package/dist/lib/type-helpers/index.d.ts +5 -0
- package/dist/lib/type-helpers/index.d.ts.map +1 -0
- package/dist/lib/type-helpers/index.js +5 -0
- package/dist/lib/type-helpers/index.js.map +1 -0
- package/dist/lib/type-helpers/intersection-type.helper.d.ts +9 -0
- package/dist/lib/type-helpers/intersection-type.helper.d.ts.map +1 -0
- package/dist/lib/type-helpers/intersection-type.helper.js +40 -0
- package/dist/lib/type-helpers/intersection-type.helper.js.map +1 -0
- package/dist/lib/type-helpers/mapped-types.utils.d.ts +3 -0
- package/dist/lib/type-helpers/mapped-types.utils.d.ts.map +1 -0
- package/dist/lib/type-helpers/mapped-types.utils.js +33 -0
- package/dist/lib/type-helpers/mapped-types.utils.js.map +1 -0
- package/dist/lib/type-helpers/omit-type.helper.d.ts +3 -0
- package/dist/lib/type-helpers/omit-type.helper.d.ts.map +1 -0
- package/dist/lib/type-helpers/omit-type.helper.js +38 -0
- package/dist/lib/type-helpers/omit-type.helper.js.map +1 -0
- package/dist/lib/type-helpers/partial-type.helper.d.ts +14 -0
- package/dist/lib/type-helpers/partial-type.helper.d.ts.map +1 -0
- package/dist/lib/type-helpers/partial-type.helper.js +52 -0
- package/dist/lib/type-helpers/partial-type.helper.js.map +1 -0
- package/dist/lib/type-helpers/pick-type.helper.d.ts +3 -0
- package/dist/lib/type-helpers/pick-type.helper.d.ts.map +1 -0
- package/dist/lib/type-helpers/pick-type.helper.js +38 -0
- package/dist/lib/type-helpers/pick-type.helper.js.map +1 -0
- package/dist/lib/types/swagger-enum.type.d.ts +2 -0
- package/dist/lib/types/swagger-enum.type.d.ts.map +1 -0
- package/dist/lib/types/swagger-enum.type.js +2 -0
- package/dist/lib/types/swagger-enum.type.js.map +1 -0
- package/dist/lib/utils/assign-two-levels-deep.d.ts +16 -0
- package/dist/lib/utils/assign-two-levels-deep.d.ts.map +1 -0
- package/dist/lib/utils/assign-two-levels-deep.js +24 -0
- package/dist/lib/utils/assign-two-levels-deep.js.map +1 -0
- package/dist/lib/utils/enum.utils.d.ts +10 -0
- package/dist/lib/utils/enum.utils.d.ts.map +1 -0
- package/dist/lib/utils/enum.utils.js +68 -0
- package/dist/lib/utils/enum.utils.js.map +1 -0
- package/dist/lib/utils/extend-metadata.util.d.ts +3 -0
- package/dist/lib/utils/extend-metadata.util.d.ts.map +1 -0
- package/dist/lib/utils/extend-metadata.util.js +9 -0
- package/dist/lib/utils/extend-metadata.util.js.map +1 -0
- package/dist/lib/utils/get-global-prefix.d.ts +3 -0
- package/dist/lib/utils/get-global-prefix.d.ts.map +1 -0
- package/dist/lib/utils/get-global-prefix.js +5 -0
- package/dist/lib/utils/get-global-prefix.js.map +1 -0
- package/dist/lib/utils/get-schema-path.util.d.ts +5 -0
- package/dist/lib/utils/get-schema-path.util.d.ts.map +1 -0
- package/dist/lib/utils/get-schema-path.util.js +22 -0
- package/dist/lib/utils/get-schema-path.util.js.map +1 -0
- package/dist/lib/utils/index.d.ts +2 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +2 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/is-body-parameter.util.d.ts +3 -0
- package/dist/lib/utils/is-body-parameter.util.d.ts.map +1 -0
- package/dist/lib/utils/is-body-parameter.util.js +4 -0
- package/dist/lib/utils/is-body-parameter.util.js.map +1 -0
- package/dist/lib/utils/is-built-in-type.util.d.ts +3 -0
- package/dist/lib/utils/is-built-in-type.util.d.ts.map +1 -0
- package/dist/lib/utils/is-built-in-type.util.js +6 -0
- package/dist/lib/utils/is-built-in-type.util.js.map +1 -0
- package/dist/lib/utils/is-date-ctor.util.d.ts +3 -0
- package/dist/lib/utils/is-date-ctor.util.d.ts.map +1 -0
- package/dist/lib/utils/is-date-ctor.util.js +4 -0
- package/dist/lib/utils/is-date-ctor.util.js.map +1 -0
- package/dist/lib/utils/merge-and-uniq.util.d.ts +2 -0
- package/dist/lib/utils/merge-and-uniq.util.d.ts.map +1 -0
- package/dist/lib/utils/merge-and-uniq.util.js +5 -0
- package/dist/lib/utils/merge-and-uniq.util.js.map +1 -0
- package/dist/lib/utils/normalize-rel-path.d.ts +2 -0
- package/dist/lib/utils/normalize-rel-path.d.ts.map +1 -0
- package/dist/lib/utils/normalize-rel-path.js +6 -0
- package/dist/lib/utils/normalize-rel-path.js.map +1 -0
- package/dist/lib/utils/remove-undefined-keys.d.ts +6 -0
- package/dist/lib/utils/remove-undefined-keys.d.ts.map +1 -0
- package/dist/lib/utils/remove-undefined-keys.js +9 -0
- package/dist/lib/utils/remove-undefined-keys.js.map +1 -0
- package/dist/lib/utils/resolve-path.util.d.ts +2 -0
- package/dist/lib/utils/resolve-path.util.d.ts.map +1 -0
- package/dist/lib/utils/resolve-path.util.js +5 -0
- package/dist/lib/utils/resolve-path.util.js.map +1 -0
- package/dist/lib/utils/reverse-object-keys.util.d.ts +2 -0
- package/dist/lib/utils/reverse-object-keys.util.d.ts.map +1 -0
- package/dist/lib/utils/reverse-object-keys.util.js +9 -0
- package/dist/lib/utils/reverse-object-keys.util.js.map +1 -0
- package/dist/lib/utils/sort-object-lexicographically.d.ts +6 -0
- package/dist/lib/utils/sort-object-lexicographically.d.ts.map +1 -0
- package/dist/lib/utils/sort-object-lexicographically.js +9 -0
- package/dist/lib/utils/sort-object-lexicographically.js.map +1 -0
- package/dist/lib/utils/strip-last-slash.util.d.ts +2 -0
- package/dist/lib/utils/strip-last-slash.util.d.ts.map +1 -0
- package/dist/lib/utils/strip-last-slash.util.js +4 -0
- package/dist/lib/utils/strip-last-slash.util.js.map +1 -0
- package/dist/lib/utils/validate-global-prefix.util.d.ts +2 -0
- package/dist/lib/utils/validate-global-prefix.util.d.ts.map +1 -0
- package/dist/lib/utils/validate-global-prefix.util.js +4 -0
- package/dist/lib/utils/validate-global-prefix.util.js.map +1 -0
- package/dist/lib/utils/validate-path.util.d.ts +2 -0
- package/dist/lib/utils/validate-path.util.d.ts.map +1 -0
- package/dist/lib/utils/validate-path.util.js +4 -0
- package/dist/lib/utils/validate-path.util.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { compact, head } from 'lodash';
|
|
2
|
+
import { posix } from 'path';
|
|
3
|
+
import * as ts from 'typescript';
|
|
4
|
+
import { ApiOperation, ApiResponse } from '../../decorators/index.js';
|
|
5
|
+
import { OPENAPI_NAMESPACE } from '../plugin-constants.js';
|
|
6
|
+
import { createLiteralFromAnyValue, getDecoratorArguments, getDecoratorName, getMainCommentOfNode, getTsDocErrorsOfNode, getTsDocTagsOfNode, } from '../utils/ast-utils.js';
|
|
7
|
+
import { convertPath, getDecoratorOrUndefinedByNames, getTypeReferenceAsString, hasPropertyKey, } from '../utils/plugin-utils.js';
|
|
8
|
+
import { typeReferenceToIdentifier } from '../utils/type-reference-to-identifier.util.js';
|
|
9
|
+
import { AbstractFileVisitor } from './abstract.visitor.js';
|
|
10
|
+
import { Cast } from 'vona';
|
|
11
|
+
export class ControllerClassVisitor extends AbstractFileVisitor {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
Object.defineProperty(this, "_collectedMetadata", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: {}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "_typeImports", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: {}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
get typeImports() {
|
|
28
|
+
return this._typeImports;
|
|
29
|
+
}
|
|
30
|
+
get collectedMetadata() {
|
|
31
|
+
const metadataWithImports = [];
|
|
32
|
+
Object.keys(this._collectedMetadata).forEach(filePath => {
|
|
33
|
+
const metadata = this._collectedMetadata[filePath];
|
|
34
|
+
const path = filePath.replace(/\.[jt]s$/, '');
|
|
35
|
+
const importExpr = ts.factory.createCallExpression(ts.factory.createToken(ts.SyntaxKind.ImportKeyword), undefined, [ts.factory.createStringLiteral(path)]);
|
|
36
|
+
metadataWithImports.push([importExpr, metadata]);
|
|
37
|
+
});
|
|
38
|
+
return metadataWithImports;
|
|
39
|
+
}
|
|
40
|
+
visit(sourceFile, ctx, program, options) {
|
|
41
|
+
const typeChecker = program.getTypeChecker();
|
|
42
|
+
if (!options.readonly) {
|
|
43
|
+
sourceFile = Cast(this).updateImports(sourceFile, ctx.factory, program);
|
|
44
|
+
}
|
|
45
|
+
const visitNode = (node) => {
|
|
46
|
+
if (ts.isMethodDeclaration(node)) {
|
|
47
|
+
try {
|
|
48
|
+
const metadata = {};
|
|
49
|
+
const updatedNode = this.addDecoratorToNode(ctx.factory, node, typeChecker, options, sourceFile, metadata);
|
|
50
|
+
if (!options.readonly) {
|
|
51
|
+
return updatedNode;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const filePath = this.normalizeImportPath(options.pathToSource, sourceFile.fileName);
|
|
55
|
+
if (!this._collectedMetadata[filePath]) {
|
|
56
|
+
this._collectedMetadata[filePath] = {};
|
|
57
|
+
}
|
|
58
|
+
const parent = node.parent;
|
|
59
|
+
const clsName = parent.name?.getText();
|
|
60
|
+
if (clsName) {
|
|
61
|
+
if (!this._collectedMetadata[filePath][clsName]) {
|
|
62
|
+
this._collectedMetadata[filePath][clsName] = {};
|
|
63
|
+
}
|
|
64
|
+
Object.assign(this._collectedMetadata[filePath][clsName], metadata);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
if (!options.readonly) {
|
|
70
|
+
return node;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (options.readonly) {
|
|
75
|
+
ts.forEachChild(node, visitNode);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
return ts.visitEachChild(node, visitNode, ctx);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return ts.visitNode(sourceFile, visitNode);
|
|
82
|
+
}
|
|
83
|
+
addDecoratorToNode(factory, compilerNode, typeChecker, options, sourceFile, metadata) {
|
|
84
|
+
const hostFilename = sourceFile.fileName;
|
|
85
|
+
const decorators = ts.canHaveDecorators(compilerNode) && ts.getDecorators(compilerNode);
|
|
86
|
+
if (!decorators) {
|
|
87
|
+
return compilerNode;
|
|
88
|
+
}
|
|
89
|
+
const apiOperationDecoratorsArray = this.createApiOperationDecorator(factory, compilerNode, decorators, options, sourceFile, typeChecker, metadata);
|
|
90
|
+
const apiResponseDecoratorsArray = this.createApiResponseDecorator(factory, compilerNode, options, metadata);
|
|
91
|
+
const removeExistingApiOperationDecorator = apiOperationDecoratorsArray.length > 0;
|
|
92
|
+
const existingDecorators = removeExistingApiOperationDecorator
|
|
93
|
+
? decorators.filter(item => getDecoratorName(item) !== ApiOperation.name)
|
|
94
|
+
: decorators;
|
|
95
|
+
const modifiers = ts.getModifiers(compilerNode) ?? [];
|
|
96
|
+
const objectLiteralExpr = this.createDecoratorObjectLiteralExpr(factory, compilerNode, typeChecker, factory.createNodeArray(), hostFilename, metadata, options);
|
|
97
|
+
const updatedDecorators = [
|
|
98
|
+
...apiOperationDecoratorsArray,
|
|
99
|
+
...apiResponseDecoratorsArray,
|
|
100
|
+
...existingDecorators,
|
|
101
|
+
factory.createDecorator(factory.createCallExpression(factory.createIdentifier(`${OPENAPI_NAMESPACE}.${ApiResponse.name}`), undefined, [
|
|
102
|
+
factory.createObjectLiteralExpression(objectLiteralExpr.properties),
|
|
103
|
+
])),
|
|
104
|
+
];
|
|
105
|
+
if (!options.readonly) {
|
|
106
|
+
return factory.updateMethodDeclaration(compilerNode, [...updatedDecorators, ...modifiers], compilerNode.asteriskToken, compilerNode.name, compilerNode.questionToken, compilerNode.typeParameters, compilerNode.parameters, compilerNode.type, compilerNode.body);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
return compilerNode;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
createApiOperationDecorator(factory, node, decorators, options, sourceFile, typeChecker, metadata) {
|
|
113
|
+
if (!options.introspectComments) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
const apiOperationDecorator = getDecoratorOrUndefinedByNames([ApiOperation.name], decorators, factory);
|
|
117
|
+
let apiOperationExistingProps = undefined;
|
|
118
|
+
if (apiOperationDecorator && !options.readonly) {
|
|
119
|
+
const apiOperationExpr = head(getDecoratorArguments(apiOperationDecorator));
|
|
120
|
+
if (apiOperationExpr) {
|
|
121
|
+
apiOperationExistingProps = apiOperationExpr.properties;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const extractedComments = getMainCommentOfNode(node, sourceFile);
|
|
125
|
+
if (!extractedComments) {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
const properties = [...(apiOperationExistingProps ?? factory.createNodeArray())];
|
|
129
|
+
const tags = getTsDocTagsOfNode(node, typeChecker);
|
|
130
|
+
const hasRemarksKey = hasPropertyKey('description', factory.createNodeArray(apiOperationExistingProps));
|
|
131
|
+
if (!hasRemarksKey && tags.remarks) {
|
|
132
|
+
// When the @remarks tag is used in the comment, it will be added to the description property of the @ApiOperation decorator.
|
|
133
|
+
// In this case, even when the "controllerKeyOfComment" option is set to "description", the "summary" property will be used.
|
|
134
|
+
const remarksPropertyAssignment = factory.createPropertyAssignment('description', createLiteralFromAnyValue(factory, tags.remarks));
|
|
135
|
+
properties.push(remarksPropertyAssignment);
|
|
136
|
+
if (options.controllerKeyOfComment === 'description') {
|
|
137
|
+
properties.unshift(factory.createPropertyAssignment('summary', factory.createStringLiteral(extractedComments)));
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const keyToGenerate = options.controllerKeyOfComment;
|
|
141
|
+
properties.unshift(factory.createPropertyAssignment(keyToGenerate, factory.createStringLiteral(extractedComments)));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
// No @remarks tag was found in the comment so use the attribute set by the user
|
|
146
|
+
const keyToGenerate = options.controllerKeyOfComment;
|
|
147
|
+
properties.unshift(factory.createPropertyAssignment(keyToGenerate, factory.createStringLiteral(extractedComments)));
|
|
148
|
+
}
|
|
149
|
+
const hasDeprecatedKey = hasPropertyKey('deprecated', factory.createNodeArray(apiOperationExistingProps));
|
|
150
|
+
if (!hasDeprecatedKey && tags.deprecated) {
|
|
151
|
+
const deprecatedPropertyAssignment = factory.createPropertyAssignment('deprecated', createLiteralFromAnyValue(factory, tags.deprecated));
|
|
152
|
+
properties.push(deprecatedPropertyAssignment);
|
|
153
|
+
}
|
|
154
|
+
const objectLiteralExpr = factory.createObjectLiteralExpression(compact(properties));
|
|
155
|
+
const apiOperationDecoratorArguments = factory.createNodeArray([objectLiteralExpr]);
|
|
156
|
+
const methodKey = node.name.getText();
|
|
157
|
+
if (metadata[methodKey]) {
|
|
158
|
+
const existingObjectLiteralExpr = metadata[methodKey];
|
|
159
|
+
const existingProperties = existingObjectLiteralExpr.properties;
|
|
160
|
+
const updatedProperties = factory.createNodeArray([...existingProperties, ...compact(properties)]);
|
|
161
|
+
const updatedObjectLiteralExpr = factory.createObjectLiteralExpression(updatedProperties);
|
|
162
|
+
metadata[methodKey] = updatedObjectLiteralExpr;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
metadata[methodKey] = objectLiteralExpr;
|
|
166
|
+
}
|
|
167
|
+
if (apiOperationDecorator) {
|
|
168
|
+
const expr = apiOperationDecorator.expression;
|
|
169
|
+
const updatedCallExpr = factory.updateCallExpression(expr, expr.expression, undefined, apiOperationDecoratorArguments);
|
|
170
|
+
return [factory.updateDecorator(apiOperationDecorator, updatedCallExpr)];
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return [
|
|
174
|
+
factory.createDecorator(factory.createCallExpression(factory.createIdentifier(`${OPENAPI_NAMESPACE}.${ApiOperation.name}`), undefined, apiOperationDecoratorArguments)),
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
createApiResponseDecorator(factory, node, options, metadata) {
|
|
179
|
+
if (!options.introspectComments) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
const tags = getTsDocErrorsOfNode(node);
|
|
183
|
+
if (!tags.length) {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
return tags.map(tag => {
|
|
187
|
+
const properties = [];
|
|
188
|
+
properties.push(factory.createPropertyAssignment('status', factory.createNumericLiteral(Cast(tag).status)));
|
|
189
|
+
properties.push(factory.createPropertyAssignment('description', factory.createNumericLiteral(Cast(tag).description)));
|
|
190
|
+
const objectLiteralExpr = factory.createObjectLiteralExpression(compact(properties));
|
|
191
|
+
const methodKey = node.name.getText();
|
|
192
|
+
metadata[methodKey] = objectLiteralExpr;
|
|
193
|
+
const apiResponseDecoratorArguments = factory.createNodeArray([objectLiteralExpr]);
|
|
194
|
+
return factory.createDecorator(factory.createCallExpression(factory.createIdentifier(`${OPENAPI_NAMESPACE}.${ApiResponse.name}`), undefined, apiResponseDecoratorArguments));
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
createDecoratorObjectLiteralExpr(factory, node, typeChecker, existingProperties = factory.createNodeArray(), hostFilename, metadata, options) {
|
|
198
|
+
let properties = [];
|
|
199
|
+
if (!options.readonly) {
|
|
200
|
+
properties = properties.concat(existingProperties, this.createStatusPropertyAssignment(factory, node, existingProperties));
|
|
201
|
+
}
|
|
202
|
+
properties = properties.concat([
|
|
203
|
+
this.createTypePropertyAssignment(factory, node, typeChecker, existingProperties, hostFilename, options),
|
|
204
|
+
]);
|
|
205
|
+
const objectLiteralExpr = factory.createObjectLiteralExpression(compact(properties));
|
|
206
|
+
const methodKey = node.name.getText();
|
|
207
|
+
const existingExprOrUndefined = metadata[methodKey];
|
|
208
|
+
if (existingExprOrUndefined) {
|
|
209
|
+
const existingProperties = existingExprOrUndefined.properties;
|
|
210
|
+
const updatedProperties = factory.createNodeArray([...existingProperties, ...compact(properties)]);
|
|
211
|
+
const updatedObjectLiteralExpr = factory.createObjectLiteralExpression(updatedProperties);
|
|
212
|
+
metadata[methodKey] = updatedObjectLiteralExpr;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
metadata[methodKey] = objectLiteralExpr;
|
|
216
|
+
}
|
|
217
|
+
return objectLiteralExpr;
|
|
218
|
+
}
|
|
219
|
+
createTypePropertyAssignment(factory, node, typeChecker, existingProperties, hostFilename, options) {
|
|
220
|
+
if (hasPropertyKey('type', existingProperties)) {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
const signature = typeChecker.getSignatureFromDeclaration(node);
|
|
224
|
+
const type = typeChecker.getReturnTypeOfSignature(signature);
|
|
225
|
+
if (!type) {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
const typeReferenceDescriptor = getTypeReferenceAsString(type, typeChecker);
|
|
229
|
+
if (!typeReferenceDescriptor.typeName) {
|
|
230
|
+
return undefined;
|
|
231
|
+
}
|
|
232
|
+
if (typeReferenceDescriptor.typeName.includes('node_modules')) {
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
const identifier = typeReferenceToIdentifier(typeReferenceDescriptor, hostFilename, options, factory, type, this._typeImports);
|
|
236
|
+
return factory.createPropertyAssignment('type', identifier);
|
|
237
|
+
}
|
|
238
|
+
createStatusPropertyAssignment(factory, node, existingProperties) {
|
|
239
|
+
if (hasPropertyKey('status', existingProperties)) {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
const statusNode = this.getStatusCodeIdentifier(factory, node);
|
|
243
|
+
return factory.createPropertyAssignment('status', statusNode);
|
|
244
|
+
}
|
|
245
|
+
getStatusCodeIdentifier(factory, node) {
|
|
246
|
+
const decorators = ts.canHaveDecorators(node) && ts.getDecorators(node);
|
|
247
|
+
const httpCodeDecorator = getDecoratorOrUndefinedByNames(['HttpCode'], decorators, factory);
|
|
248
|
+
if (httpCodeDecorator) {
|
|
249
|
+
const argument = head(getDecoratorArguments(httpCodeDecorator));
|
|
250
|
+
if (argument) {
|
|
251
|
+
return argument;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const postDecorator = getDecoratorOrUndefinedByNames(['Post'], decorators, factory);
|
|
255
|
+
if (postDecorator) {
|
|
256
|
+
return factory.createIdentifier('201');
|
|
257
|
+
}
|
|
258
|
+
return factory.createIdentifier('200');
|
|
259
|
+
}
|
|
260
|
+
normalizeImportPath(pathToSource, path) {
|
|
261
|
+
let relativePath = posix.relative(convertPath(pathToSource), convertPath(path));
|
|
262
|
+
relativePath = relativePath[0] !== '.' ? './' + relativePath : relativePath;
|
|
263
|
+
return relativePath;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=controller-class.visitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-class.visitor.js","sourceRoot":"","sources":["../../../../src/lib/plugin/visitors/controller-class.visitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,8BAA8B,EAC9B,wBAAwB,EACxB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAA/D;;QACmB;;;;mBAAoE,EAAE;WAAC;QACvE;;;;mBAAuC,EAAE;WAAC;IAwX7D,CAAC;IAtX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AAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QAChF,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;QAC5E,OAAO,YAAY,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { PropertyAssignment } from 'typescript';
|
|
3
|
+
import { PluginOptions } from '../merge-options.js';
|
|
4
|
+
import { AbstractFileVisitor } from './abstract.visitor.js';
|
|
5
|
+
type ClassMetadata = Record<string, ts.ObjectLiteralExpression>;
|
|
6
|
+
export declare class ModelClassVisitor extends AbstractFileVisitor {
|
|
7
|
+
private readonly _typeImports;
|
|
8
|
+
private readonly _collectedMetadata;
|
|
9
|
+
get typeImports(): Record<string, string>;
|
|
10
|
+
get collectedMetadata(): Array<[ts.CallExpression, Record<string, ClassMetadata>]>;
|
|
11
|
+
visit(sourceFile: ts.SourceFile, ctx: ts.TransformationContext, program: ts.Program, options: PluginOptions): ts.Node | undefined;
|
|
12
|
+
visitPropertyNodeDeclaration(node: ts.PropertyDeclaration, ctx: ts.TransformationContext, typeChecker: ts.TypeChecker, options: PluginOptions, sourceFile: ts.SourceFile, metadata: ClassMetadata, externalImports: Record<string, string>): ts.PropertyDeclaration | undefined;
|
|
13
|
+
visitConstructorDeclarationNode(constructorNode: ts.ConstructorDeclaration, typeChecker: ts.TypeChecker, options: PluginOptions, sourceFile: ts.SourceFile, metadata: ClassMetadata, externalImports: Record<string, string>): void;
|
|
14
|
+
addMetadataFactory(factory: ts.NodeFactory, node: ts.ClassDeclaration, classMetadata: ClassMetadata, sourceFile: ts.SourceFile, options: PluginOptions): ts.ClassDeclaration | undefined;
|
|
15
|
+
inspectPropertyDeclaration(factory: ts.NodeFactory, compilerNode: ts.PropertyDeclaration, typeChecker: ts.TypeChecker, options: PluginOptions, hostFilename: string, sourceFile: ts.SourceFile, metadata: ClassMetadata, externalImports: Record<string, string>): void;
|
|
16
|
+
createDecoratorObjectLiteralExpr(factory: ts.NodeFactory, node: ts.PropertyDeclaration | ts.PropertySignature | ts.ParameterDeclaration, typeChecker: ts.TypeChecker, existingProperties?: ts.NodeArray<ts.PropertyAssignment>, options?: PluginOptions, hostFilename?: string, sourceFile?: ts.SourceFile, externalImports?: Record<string, string>): ts.ObjectLiteralExpression;
|
|
17
|
+
/**
|
|
18
|
+
* Returns an array with 0..2 "ts.PropertyAssignment"s.
|
|
19
|
+
* The first one is the "type" property assignment, the second one is the "nullable" property assignment.
|
|
20
|
+
* When type cannot be determined, an empty array is returned.
|
|
21
|
+
*/
|
|
22
|
+
private createTypePropertyAssignments;
|
|
23
|
+
createInitializerForTypeLiteralNode(node: ts.TypeLiteralNode, factory: ts.NodeFactory, typeChecker: ts.TypeChecker, existingProperties: ts.NodeArray<ts.PropertyAssignment>, hostFilename: string, options: PluginOptions): ts.ArrowFunction;
|
|
24
|
+
isNullableUnion(node: ts.UnionTypeNode): {
|
|
25
|
+
nullableType: ts.TypeNode | undefined;
|
|
26
|
+
isNullable: boolean;
|
|
27
|
+
};
|
|
28
|
+
createEnumPropertyAssignment(factory: ts.NodeFactory, node: ts.PropertyDeclaration | ts.PropertySignature | ts.ParameterDeclaration, typeChecker: ts.TypeChecker, existingProperties: ts.NodeArray<ts.PropertyAssignment>, hostFilename: string, options: PluginOptions, externalImports: Record<string, string>): ts.PropertyAssignment | ts.PropertyAssignment[] | undefined;
|
|
29
|
+
createDefaultPropertyAssignment(factory: ts.NodeFactory, node: ts.PropertyDeclaration | ts.PropertySignature | ts.ParameterDeclaration, existingProperties: ts.NodeArray<ts.PropertyAssignment>, options: PluginOptions): ts.PropertyAssignment | undefined;
|
|
30
|
+
createValidationPropertyAssignments(factory: ts.NodeFactory, node: ts.PropertyDeclaration | ts.PropertySignature, options: PluginOptions): ts.PropertyAssignment[];
|
|
31
|
+
addPropertyByValidationDecorator(factory: ts.NodeFactory, decoratorName: string, propertyKey: string, decorators: readonly ts.Decorator[], assignments: ts.PropertyAssignment[], options: PluginOptions): void;
|
|
32
|
+
addPropertiesByValidationDecorator(factory: ts.NodeFactory, decoratorName: string, decorators: readonly ts.Decorator[], assignments: ts.PropertyAssignment[], addPropertyAssignments: (decoratorRef: ts.Decorator) => PropertyAssignment[]): void;
|
|
33
|
+
addClassMetadata(node: ts.PropertyDeclaration, objectLiteral: ts.ObjectLiteralExpression, sourceFile: ts.SourceFile, metadata: ClassMetadata): void;
|
|
34
|
+
createDescriptionAndTsDocTagPropertyAssignments(factory: ts.NodeFactory, node: ts.PropertyDeclaration | ts.PropertySignature | ts.ParameterDeclaration, typeChecker: ts.TypeChecker, existingProperties?: ts.NodeArray<ts.PropertyAssignment>, options?: PluginOptions, sourceFile?: ts.SourceFile): ts.PropertyAssignment[];
|
|
35
|
+
private normalizeImportPath;
|
|
36
|
+
private clonePrimitiveLiteral;
|
|
37
|
+
private getInitializerPrimitiveTypeName;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=model-class.visitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-class.visitor.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugin/visitors/model-class.visitor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAW,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAwBpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAK5D,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,uBAAuB,CAAC,CAAC;AAEhE,qBAAa,iBAAkB,SAAQ,mBAAmB;IACxD,OAAO,CAAC,QAAQ,CAAC,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