@depup/nestjs__common 11.1.16-depup.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/PACKAGE.md +1 -0
- package/Readme.md +31 -0
- package/changes.json +10 -0
- package/constants.d.ts +42 -0
- package/constants.js +44 -0
- package/decorators/core/apply-decorators.d.ts +10 -0
- package/decorators/core/apply-decorators.js +23 -0
- package/decorators/core/bind.decorator.d.ts +11 -0
- package/decorators/core/bind.decorator.js +19 -0
- package/decorators/core/catch.decorator.d.ts +19 -0
- package/decorators/core/catch.decorator.js +27 -0
- package/decorators/core/controller.decorator.d.ts +102 -0
- package/decorators/core/controller.decorator.js +61 -0
- package/decorators/core/dependencies.decorator.d.ts +7 -0
- package/decorators/core/dependencies.decorator.js +23 -0
- package/decorators/core/exception-filters.decorator.d.ts +23 -0
- package/decorators/core/exception-filters.decorator.js +43 -0
- package/decorators/core/index.d.ts +14 -0
- package/decorators/core/index.js +17 -0
- package/decorators/core/inject.decorator.d.ts +31 -0
- package/decorators/core/inject.decorator.js +53 -0
- package/decorators/core/injectable.decorator.d.ts +43 -0
- package/decorators/core/injectable.decorator.js +50 -0
- package/decorators/core/optional.decorator.d.ts +14 -0
- package/decorators/core/optional.decorator.js +29 -0
- package/decorators/core/set-metadata.decorator.d.ts +20 -0
- package/decorators/core/set-metadata.decorator.js +32 -0
- package/decorators/core/use-guards.decorator.d.ts +23 -0
- package/decorators/core/use-guards.decorator.js +41 -0
- package/decorators/core/use-interceptors.decorator.d.ts +23 -0
- package/decorators/core/use-interceptors.decorator.js +42 -0
- package/decorators/core/use-pipes.decorator.d.ts +23 -0
- package/decorators/core/use-pipes.decorator.js +40 -0
- package/decorators/core/version.decorator.d.ts +7 -0
- package/decorators/core/version.decorator.js +19 -0
- package/decorators/http/create-route-param-metadata.decorator.d.ts +13 -0
- package/decorators/http/create-route-param-metadata.decorator.js +32 -0
- package/decorators/http/header.decorator.d.ts +15 -0
- package/decorators/http/header.decorator.js +25 -0
- package/decorators/http/http-code.decorator.d.ts +11 -0
- package/decorators/http/http-code.decorator.js +20 -0
- package/decorators/http/index.d.ts +8 -0
- package/decorators/http/index.js +11 -0
- package/decorators/http/redirect.decorator.d.ts +6 -0
- package/decorators/http/redirect.decorator.js +15 -0
- package/decorators/http/render.decorator.d.ts +12 -0
- package/decorators/http/render.decorator.js +21 -0
- package/decorators/http/request-mapping.decorator.d.ts +134 -0
- package/decorators/http/request-mapping.decorator.js +154 -0
- package/decorators/http/route-params.decorator.d.ts +445 -0
- package/decorators/http/route-params.decorator.js +265 -0
- package/decorators/http/sse.decorator.d.ts +10 -0
- package/decorators/http/sse.decorator.js +21 -0
- package/decorators/index.d.ts +3 -0
- package/decorators/index.js +6 -0
- package/decorators/modules/global.decorator.d.ts +12 -0
- package/decorators/modules/global.decorator.js +20 -0
- package/decorators/modules/index.d.ts +2 -0
- package/decorators/modules/index.js +5 -0
- package/decorators/modules/module.decorator.d.ts +16 -0
- package/decorators/modules/module.decorator.js +29 -0
- package/enums/http-status.enum.d.ts +60 -0
- package/enums/http-status.enum.js +64 -0
- package/enums/index.d.ts +4 -0
- package/enums/index.js +7 -0
- package/enums/request-method.enum.d.ts +18 -0
- package/enums/request-method.enum.js +22 -0
- package/enums/route-paramtypes.enum.d.ts +16 -0
- package/enums/route-paramtypes.enum.js +20 -0
- package/enums/shutdown-signal.enum.d.ts +16 -0
- package/enums/shutdown-signal.enum.js +20 -0
- package/enums/version-type.enum.d.ts +9 -0
- package/enums/version-type.enum.js +13 -0
- package/exceptions/bad-gateway.exception.d.ts +35 -0
- package/exceptions/bad-gateway.exception.js +43 -0
- package/exceptions/bad-request.exception.d.ts +35 -0
- package/exceptions/bad-request.exception.js +43 -0
- package/exceptions/conflict.exception.d.ts +35 -0
- package/exceptions/conflict.exception.js +43 -0
- package/exceptions/forbidden.exception.d.ts +35 -0
- package/exceptions/forbidden.exception.js +43 -0
- package/exceptions/gateway-timeout.exception.d.ts +35 -0
- package/exceptions/gateway-timeout.exception.js +43 -0
- package/exceptions/gone.exception.d.ts +35 -0
- package/exceptions/gone.exception.js +43 -0
- package/exceptions/http-version-not-supported.exception.d.ts +35 -0
- package/exceptions/http-version-not-supported.exception.js +43 -0
- package/exceptions/http.exception.d.ts +85 -0
- package/exceptions/http.exception.js +133 -0
- package/exceptions/im-a-teapot.exception.d.ts +38 -0
- package/exceptions/im-a-teapot.exception.js +46 -0
- package/exceptions/index.d.ts +23 -0
- package/exceptions/index.js +26 -0
- package/exceptions/internal-server-error.exception.d.ts +35 -0
- package/exceptions/internal-server-error.exception.js +43 -0
- package/exceptions/intrinsic.exception.d.ts +8 -0
- package/exceptions/intrinsic.exception.js +12 -0
- package/exceptions/method-not-allowed.exception.d.ts +35 -0
- package/exceptions/method-not-allowed.exception.js +43 -0
- package/exceptions/misdirected.exception.d.ts +35 -0
- package/exceptions/misdirected.exception.js +43 -0
- package/exceptions/not-acceptable.exception.d.ts +35 -0
- package/exceptions/not-acceptable.exception.js +43 -0
- package/exceptions/not-found.exception.d.ts +35 -0
- package/exceptions/not-found.exception.js +43 -0
- package/exceptions/not-implemented.exception.d.ts +35 -0
- package/exceptions/not-implemented.exception.js +43 -0
- package/exceptions/payload-too-large.exception.d.ts +35 -0
- package/exceptions/payload-too-large.exception.js +43 -0
- package/exceptions/precondition-failed.exception.d.ts +35 -0
- package/exceptions/precondition-failed.exception.js +43 -0
- package/exceptions/request-timeout.exception.d.ts +35 -0
- package/exceptions/request-timeout.exception.js +43 -0
- package/exceptions/service-unavailable.exception.d.ts +35 -0
- package/exceptions/service-unavailable.exception.js +43 -0
- package/exceptions/unauthorized.exception.d.ts +35 -0
- package/exceptions/unauthorized.exception.js +43 -0
- package/exceptions/unprocessable-entity.exception.d.ts +35 -0
- package/exceptions/unprocessable-entity.exception.js +43 -0
- package/exceptions/unsupported-media-type.exception.d.ts +35 -0
- package/exceptions/unsupported-media-type.exception.js +43 -0
- package/file-stream/index.d.ts +1 -0
- package/file-stream/index.js +4 -0
- package/file-stream/interfaces/index.d.ts +2 -0
- package/file-stream/interfaces/index.js +5 -0
- package/file-stream/interfaces/streamable-handler-response.interface.d.ts +12 -0
- package/file-stream/interfaces/streamable-handler-response.interface.js +2 -0
- package/file-stream/interfaces/streamable-options.interface.d.ts +22 -0
- package/file-stream/interfaces/streamable-options.interface.js +2 -0
- package/file-stream/streamable-file.d.ts +27 -0
- package/file-stream/streamable-file.js +68 -0
- package/index.d.ts +11 -0
- package/index.js +23 -0
- package/interfaces/abstract.interface.d.ts +3 -0
- package/interfaces/abstract.interface.js +2 -0
- package/interfaces/controllers/controller-metadata.interface.d.ts +3 -0
- package/interfaces/controllers/controller-metadata.interface.js +2 -0
- package/interfaces/controllers/controller.interface.d.ts +1 -0
- package/interfaces/controllers/controller.interface.js +2 -0
- package/interfaces/controllers/index.d.ts +2 -0
- package/interfaces/controllers/index.js +5 -0
- package/interfaces/exceptions/exception-filter-metadata.interface.d.ts +6 -0
- package/interfaces/exceptions/exception-filter-metadata.interface.js +2 -0
- package/interfaces/exceptions/exception-filter.interface.d.ts +18 -0
- package/interfaces/exceptions/exception-filter.interface.js +2 -0
- package/interfaces/exceptions/index.d.ts +5 -0
- package/interfaces/exceptions/index.js +8 -0
- package/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts +6 -0
- package/interfaces/exceptions/rpc-exception-filter-metadata.interface.js +2 -0
- package/interfaces/exceptions/rpc-exception-filter.interface.d.ts +19 -0
- package/interfaces/exceptions/rpc-exception-filter.interface.js +2 -0
- package/interfaces/exceptions/ws-exception-filter.interface.d.ts +18 -0
- package/interfaces/exceptions/ws-exception-filter.interface.js +2 -0
- package/interfaces/external/class-transform-options.interface.d.ts +65 -0
- package/interfaces/external/class-transform-options.interface.js +2 -0
- package/interfaces/external/cors-options.interface.d.ts +58 -0
- package/interfaces/external/cors-options.interface.js +2 -0
- package/interfaces/external/https-options.interface.d.ts +105 -0
- package/interfaces/external/https-options.interface.js +2 -0
- package/interfaces/external/transformer-package.interface.d.ts +6 -0
- package/interfaces/external/transformer-package.interface.js +2 -0
- package/interfaces/external/validation-error.interface.d.ts +42 -0
- package/interfaces/external/validation-error.interface.js +2 -0
- package/interfaces/external/validator-options.interface.d.ts +76 -0
- package/interfaces/external/validator-options.interface.js +2 -0
- package/interfaces/external/validator-package.interface.d.ts +5 -0
- package/interfaces/external/validator-package.interface.js +2 -0
- package/interfaces/features/arguments-host.interface.d.ts +88 -0
- package/interfaces/features/arguments-host.interface.js +2 -0
- package/interfaces/features/can-activate.interface.d.ts +22 -0
- package/interfaces/features/can-activate.interface.js +2 -0
- package/interfaces/features/custom-route-param-factory.interface.d.ts +5 -0
- package/interfaces/features/custom-route-param-factory.interface.js +2 -0
- package/interfaces/features/execution-context.interface.d.ts +20 -0
- package/interfaces/features/execution-context.interface.js +2 -0
- package/interfaces/features/nest-interceptor.interface.d.ts +34 -0
- package/interfaces/features/nest-interceptor.interface.js +2 -0
- package/interfaces/features/paramtype.interface.d.ts +4 -0
- package/interfaces/features/paramtype.interface.js +2 -0
- package/interfaces/features/pipe-transform.interface.d.ts +42 -0
- package/interfaces/features/pipe-transform.interface.js +2 -0
- package/interfaces/global-prefix-options.interface.d.ts +7 -0
- package/interfaces/global-prefix-options.interface.js +2 -0
- package/interfaces/hooks/before-application-shutdown.interface.d.ts +3 -0
- package/interfaces/hooks/before-application-shutdown.interface.js +2 -0
- package/interfaces/hooks/index.d.ts +5 -0
- package/interfaces/hooks/index.js +8 -0
- package/interfaces/hooks/on-application-bootstrap.interface.d.ts +11 -0
- package/interfaces/hooks/on-application-bootstrap.interface.js +2 -0
- package/interfaces/hooks/on-application-shutdown.interface.d.ts +11 -0
- package/interfaces/hooks/on-application-shutdown.interface.js +2 -0
- package/interfaces/hooks/on-destroy.interface.d.ts +12 -0
- package/interfaces/hooks/on-destroy.interface.js +2 -0
- package/interfaces/hooks/on-init.interface.d.ts +10 -0
- package/interfaces/hooks/on-init.interface.js +2 -0
- package/interfaces/http/http-exception-body.interface.d.ts +6 -0
- package/interfaces/http/http-exception-body.interface.js +2 -0
- package/interfaces/http/http-redirect-response.interface.d.ts +5 -0
- package/interfaces/http/http-redirect-response.interface.js +2 -0
- package/interfaces/http/http-server.interface.d.ts +70 -0
- package/interfaces/http/http-server.interface.js +2 -0
- package/interfaces/http/index.d.ts +5 -0
- package/interfaces/http/index.js +8 -0
- package/interfaces/http/message-event.interface.d.ts +6 -0
- package/interfaces/http/message-event.interface.js +2 -0
- package/interfaces/http/raw-body-request.interface.d.ts +6 -0
- package/interfaces/http/raw-body-request.interface.js +2 -0
- package/interfaces/index.d.ts +30 -0
- package/interfaces/index.js +33 -0
- package/interfaces/injectable.interface.d.ts +1 -0
- package/interfaces/injectable.interface.js +2 -0
- package/interfaces/microservices/nest-hybrid-application-options.interface.d.ts +7 -0
- package/interfaces/microservices/nest-hybrid-application-options.interface.js +2 -0
- package/interfaces/microservices/nest-microservice-options.interface.d.ts +5 -0
- package/interfaces/microservices/nest-microservice-options.interface.js +2 -0
- package/interfaces/middleware/index.d.ts +4 -0
- package/interfaces/middleware/index.js +7 -0
- package/interfaces/middleware/middleware-config-proxy.interface.d.ts +24 -0
- package/interfaces/middleware/middleware-config-proxy.interface.js +2 -0
- package/interfaces/middleware/middleware-configuration.interface.d.ts +12 -0
- package/interfaces/middleware/middleware-configuration.interface.js +2 -0
- package/interfaces/middleware/middleware-consumer.interface.d.ts +18 -0
- package/interfaces/middleware/middleware-consumer.interface.js +2 -0
- package/interfaces/middleware/nest-middleware.interface.d.ts +8 -0
- package/interfaces/middleware/nest-middleware.interface.js +2 -0
- package/interfaces/modules/dynamic-module.interface.d.ts +25 -0
- package/interfaces/modules/dynamic-module.interface.js +2 -0
- package/interfaces/modules/forward-reference.interface.d.ts +3 -0
- package/interfaces/modules/forward-reference.interface.js +2 -0
- package/interfaces/modules/index.d.ts +8 -0
- package/interfaces/modules/index.js +11 -0
- package/interfaces/modules/injection-token.interface.d.ts +6 -0
- package/interfaces/modules/injection-token.interface.js +2 -0
- package/interfaces/modules/introspection-result.interface.d.ts +10 -0
- package/interfaces/modules/introspection-result.interface.js +2 -0
- package/interfaces/modules/module-metadata.interface.d.ts +34 -0
- package/interfaces/modules/module-metadata.interface.js +2 -0
- package/interfaces/modules/nest-module.interface.d.ts +7 -0
- package/interfaces/modules/nest-module.interface.js +2 -0
- package/interfaces/modules/optional-factory-dependency.interface.d.ts +8 -0
- package/interfaces/modules/optional-factory-dependency.interface.js +2 -0
- package/interfaces/modules/provider.interface.d.ts +156 -0
- package/interfaces/modules/provider.interface.js +2 -0
- package/interfaces/nest-application-context-options.interface.d.ts +68 -0
- package/interfaces/nest-application-context-options.interface.js +9 -0
- package/interfaces/nest-application-context.interface.d.ts +139 -0
- package/interfaces/nest-application-context.interface.js +2 -0
- package/interfaces/nest-application-options.interface.d.ts +29 -0
- package/interfaces/nest-application-options.interface.js +2 -0
- package/interfaces/nest-application.interface.d.ts +135 -0
- package/interfaces/nest-application.interface.js +2 -0
- package/interfaces/nest-microservice.interface.d.ts +75 -0
- package/interfaces/nest-microservice.interface.js +2 -0
- package/interfaces/scope-options.interface.d.ts +37 -0
- package/interfaces/scope-options.interface.js +23 -0
- package/interfaces/shutdown-hooks-options.interface.d.ts +21 -0
- package/interfaces/shutdown-hooks-options.interface.js +2 -0
- package/interfaces/type.interface.d.ts +3 -0
- package/interfaces/type.interface.js +2 -0
- package/interfaces/version-options.interface.d.ts +92 -0
- package/interfaces/version-options.interface.js +9 -0
- package/interfaces/websockets/web-socket-adapter.interface.d.ts +19 -0
- package/interfaces/websockets/web-socket-adapter.interface.js +2 -0
- package/module-utils/configurable-module.builder.d.ts +93 -0
- package/module-utils/configurable-module.builder.js +219 -0
- package/module-utils/constants.d.ts +9 -0
- package/module-utils/constants.js +19 -0
- package/module-utils/index.d.ts +2 -0
- package/module-utils/index.js +5 -0
- package/module-utils/interfaces/configurable-module-async-options.interface.d.ts +42 -0
- package/module-utils/interfaces/configurable-module-async-options.interface.js +2 -0
- package/module-utils/interfaces/configurable-module-cls.interface.d.ts +13 -0
- package/module-utils/interfaces/configurable-module-cls.interface.js +2 -0
- package/module-utils/interfaces/configurable-module-host.interface.d.ts +62 -0
- package/module-utils/interfaces/configurable-module-host.interface.js +2 -0
- package/module-utils/interfaces/index.d.ts +3 -0
- package/module-utils/interfaces/index.js +6 -0
- package/module-utils/utils/generate-options-injection-token.util.d.ts +1 -0
- package/module-utils/utils/generate-options-injection-token.util.js +8 -0
- package/module-utils/utils/get-injection-providers.util.d.ts +8 -0
- package/module-utils/utils/get-injection-providers.util.js +35 -0
- package/module-utils/utils/index.d.ts +2 -0
- package/module-utils/utils/index.js +5 -0
- package/package.json +61 -0
- package/pipes/default-value.pipe.d.ts +13 -0
- package/pipes/default-value.pipe.js +30 -0
- package/pipes/file/file-type.validator.d.ts +62 -0
- package/pipes/file/file-type.validator.js +102 -0
- package/pipes/file/file-validator-context.interface.d.ts +5 -0
- package/pipes/file/file-validator-context.interface.js +2 -0
- package/pipes/file/file-validator.interface.d.ts +21 -0
- package/pipes/file/file-validator.interface.js +15 -0
- package/pipes/file/index.d.ts +6 -0
- package/pipes/file/index.js +9 -0
- package/pipes/file/interfaces/file.interface.d.ts +5 -0
- package/pipes/file/interfaces/file.interface.js +2 -0
- package/pipes/file/interfaces/index.d.ts +1 -0
- package/pipes/file/interfaces/index.js +4 -0
- package/pipes/file/max-file-size.validator.d.ts +44 -0
- package/pipes/file/max-file-size.validator.js +37 -0
- package/pipes/file/parse-file-options.interface.d.ts +15 -0
- package/pipes/file/parse-file-options.interface.js +2 -0
- package/pipes/file/parse-file-pipe.builder.d.ts +15 -0
- package/pipes/file/parse-file-pipe.builder.js +33 -0
- package/pipes/file/parse-file.pipe.d.ts +28 -0
- package/pipes/file/parse-file.pipe.js +76 -0
- package/pipes/index.d.ts +10 -0
- package/pipes/index.js +13 -0
- package/pipes/parse-array.pipe.d.ts +52 -0
- package/pipes/parse-array.pipe.js +148 -0
- package/pipes/parse-bool.pipe.d.ts +55 -0
- package/pipes/parse-bool.pipe.js +67 -0
- package/pipes/parse-date.pipe.d.ts +37 -0
- package/pipes/parse-date.pipe.js +42 -0
- package/pipes/parse-enum.pipe.d.ts +46 -0
- package/pipes/parse-enum.pipe.js +55 -0
- package/pipes/parse-float.pipe.d.ts +49 -0
- package/pipes/parse-float.pipe.js +56 -0
- package/pipes/parse-int.pipe.d.ts +48 -0
- package/pipes/parse-int.pipe.js +57 -0
- package/pipes/parse-uuid.pipe.d.ts +49 -0
- package/pipes/parse-uuid.pipe.js +57 -0
- package/pipes/validation.pipe.d.ts +51 -0
- package/pipes/validation.pipe.js +245 -0
- package/serializer/class-serializer.constants.d.ts +1 -0
- package/serializer/class-serializer.constants.js +4 -0
- package/serializer/class-serializer.interceptor.d.ts +29 -0
- package/serializer/class-serializer.interceptor.js +77 -0
- package/serializer/class-serializer.interfaces.d.ts +8 -0
- package/serializer/class-serializer.interfaces.js +2 -0
- package/serializer/decorators/index.d.ts +1 -0
- package/serializer/decorators/index.js +4 -0
- package/serializer/decorators/serialize-options.decorator.d.ts +5 -0
- package/serializer/decorators/serialize-options.decorator.js +10 -0
- package/serializer/index.d.ts +3 -0
- package/serializer/index.js +6 -0
- package/services/console-logger.service.d.ts +202 -0
- package/services/console-logger.service.js +379 -0
- package/services/index.d.ts +3 -0
- package/services/index.js +6 -0
- package/services/logger.service.d.ts +152 -0
- package/services/logger.service.js +251 -0
- package/services/utils/filter-log-levels.util.d.ts +5 -0
- package/services/utils/filter-log-levels.util.js +23 -0
- package/services/utils/index.d.ts +3 -0
- package/services/utils/index.js +6 -0
- package/services/utils/is-log-level-enabled.util.d.ts +7 -0
- package/services/utils/is-log-level-enabled.util.js +32 -0
- package/services/utils/is-log-level.util.d.ts +5 -0
- package/services/utils/is-log-level.util.js +10 -0
- package/tsconfig.build.json +10 -0
- package/utils/assign-custom-metadata.util.d.ts +4 -0
- package/utils/assign-custom-metadata.util.js +15 -0
- package/utils/cli-colors.util.d.ts +10 -0
- package/utils/cli-colors.util.js +15 -0
- package/utils/extend-metadata.util.d.ts +1 -0
- package/utils/extend-metadata.util.js +8 -0
- package/utils/forward-ref.util.d.ts +5 -0
- package/utils/forward-ref.util.js +10 -0
- package/utils/http-error-by-code.util.d.ts +4 -0
- package/utils/http-error-by-code.util.js +26 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +4 -0
- package/utils/load-package.util.d.ts +1 -0
- package/utils/load-package.util.js +16 -0
- package/utils/merge-with-values.util.d.ts +4 -0
- package/utils/merge-with-values.util.js +18 -0
- package/utils/random-string-generator.util.d.ts +1 -0
- package/utils/random-string-generator.util.js +6 -0
- package/utils/select-exception-filter-metadata.util.d.ts +2 -0
- package/utils/select-exception-filter-metadata.util.js +6 -0
- package/utils/shared.utils.d.ts +13 -0
- package/utils/shared.utils.js +51 -0
- package/utils/validate-each.util.d.ts +8 -0
- package/utils/validate-each.util.js +25 -0
- package/utils/validate-module-keys.util.d.ts +2 -0
- package/utils/validate-module-keys.util.js +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-present Kamil Mysliwiec <https://kamilmysliwiec.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/PACKAGE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The common package comes with decorators such as `@Controller()`, `@Injectable()` and so on.
|
package/Readme.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @depup/nestjs__common
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [@nestjs/common](https://www.npmjs.com/package/@nestjs/common)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/nestjs__common
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [@nestjs/common](https://www.npmjs.com/package/@nestjs/common) @ 11.1.16 |
|
|
17
|
+
| Processed | 2026-03-09 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 1 |
|
|
20
|
+
|
|
21
|
+
## Dependency Changes
|
|
22
|
+
|
|
23
|
+
| Dependency | From | To |
|
|
24
|
+
|------------|------|-----|
|
|
25
|
+
| file-type | 21.3.0 | ^21.3.1 |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@nestjs/common
|
|
30
|
+
|
|
31
|
+
License inherited from the original package.
|
package/changes.json
ADDED
package/constants.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const MODULE_METADATA: {
|
|
2
|
+
IMPORTS: string;
|
|
3
|
+
PROVIDERS: string;
|
|
4
|
+
CONTROLLERS: string;
|
|
5
|
+
EXPORTS: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const GLOBAL_MODULE_METADATA = "__module:global__";
|
|
8
|
+
export declare const HOST_METADATA = "host";
|
|
9
|
+
export declare const PATH_METADATA = "path";
|
|
10
|
+
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
|
11
|
+
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
12
|
+
export declare const OPTIONAL_DEPS_METADATA = "optional:paramtypes";
|
|
13
|
+
export declare const PROPERTY_DEPS_METADATA = "self:properties_metadata";
|
|
14
|
+
export declare const OPTIONAL_PROPERTY_DEPS_METADATA = "optional:properties_metadata";
|
|
15
|
+
export declare const SCOPE_OPTIONS_METADATA = "scope:options";
|
|
16
|
+
export declare const METHOD_METADATA = "method";
|
|
17
|
+
export declare const ROUTE_ARGS_METADATA = "__routeArguments__";
|
|
18
|
+
export declare const CUSTOM_ROUTE_ARGS_METADATA = "__customRouteArgs__";
|
|
19
|
+
export declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
|
|
20
|
+
export declare const PIPES_METADATA = "__pipes__";
|
|
21
|
+
export declare const GUARDS_METADATA = "__guards__";
|
|
22
|
+
export declare const INTERCEPTORS_METADATA = "__interceptors__";
|
|
23
|
+
export declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
|
|
24
|
+
export declare const ENHANCER_KEY_TO_SUBTYPE_MAP: {
|
|
25
|
+
readonly __guards__: "guard";
|
|
26
|
+
readonly __interceptors__: "interceptor";
|
|
27
|
+
readonly __pipes__: "pipe";
|
|
28
|
+
readonly __exceptionFilters__: "filter";
|
|
29
|
+
};
|
|
30
|
+
export type EnhancerSubtype = (typeof ENHANCER_KEY_TO_SUBTYPE_MAP)[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
|
|
31
|
+
export declare const RENDER_METADATA = "__renderTemplate__";
|
|
32
|
+
export declare const HTTP_CODE_METADATA = "__httpCode__";
|
|
33
|
+
export declare const MODULE_PATH = "__module_path__";
|
|
34
|
+
export declare const HEADERS_METADATA = "__headers__";
|
|
35
|
+
export declare const REDIRECT_METADATA = "__redirect__";
|
|
36
|
+
export declare const RESPONSE_PASSTHROUGH_METADATA = "__responsePassthrough__";
|
|
37
|
+
export declare const SSE_METADATA = "__sse__";
|
|
38
|
+
export declare const VERSION_METADATA = "__version__";
|
|
39
|
+
export declare const INJECTABLE_WATERMARK = "__injectable__";
|
|
40
|
+
export declare const CONTROLLER_WATERMARK = "__controller__";
|
|
41
|
+
export declare const CATCH_WATERMARK = "__catch__";
|
|
42
|
+
export declare const ENTRY_PROVIDER_WATERMARK = "__entryProvider__";
|
package/constants.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENTRY_PROVIDER_WATERMARK = exports.CATCH_WATERMARK = exports.CONTROLLER_WATERMARK = exports.INJECTABLE_WATERMARK = exports.VERSION_METADATA = exports.SSE_METADATA = exports.RESPONSE_PASSTHROUGH_METADATA = exports.REDIRECT_METADATA = exports.HEADERS_METADATA = exports.MODULE_PATH = exports.HTTP_CODE_METADATA = exports.RENDER_METADATA = exports.ENHANCER_KEY_TO_SUBTYPE_MAP = exports.EXCEPTION_FILTERS_METADATA = exports.INTERCEPTORS_METADATA = exports.GUARDS_METADATA = exports.PIPES_METADATA = exports.FILTER_CATCH_EXCEPTIONS = exports.CUSTOM_ROUTE_ARGS_METADATA = exports.ROUTE_ARGS_METADATA = exports.METHOD_METADATA = exports.SCOPE_OPTIONS_METADATA = exports.OPTIONAL_PROPERTY_DEPS_METADATA = exports.PROPERTY_DEPS_METADATA = exports.OPTIONAL_DEPS_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.PATH_METADATA = exports.HOST_METADATA = exports.GLOBAL_MODULE_METADATA = exports.MODULE_METADATA = void 0;
|
|
4
|
+
exports.MODULE_METADATA = {
|
|
5
|
+
IMPORTS: 'imports',
|
|
6
|
+
PROVIDERS: 'providers',
|
|
7
|
+
CONTROLLERS: 'controllers',
|
|
8
|
+
EXPORTS: 'exports',
|
|
9
|
+
};
|
|
10
|
+
exports.GLOBAL_MODULE_METADATA = '__module:global__';
|
|
11
|
+
exports.HOST_METADATA = 'host';
|
|
12
|
+
exports.PATH_METADATA = 'path';
|
|
13
|
+
exports.PARAMTYPES_METADATA = 'design:paramtypes';
|
|
14
|
+
exports.SELF_DECLARED_DEPS_METADATA = 'self:paramtypes';
|
|
15
|
+
exports.OPTIONAL_DEPS_METADATA = 'optional:paramtypes';
|
|
16
|
+
exports.PROPERTY_DEPS_METADATA = 'self:properties_metadata';
|
|
17
|
+
exports.OPTIONAL_PROPERTY_DEPS_METADATA = 'optional:properties_metadata';
|
|
18
|
+
exports.SCOPE_OPTIONS_METADATA = 'scope:options';
|
|
19
|
+
exports.METHOD_METADATA = 'method';
|
|
20
|
+
exports.ROUTE_ARGS_METADATA = '__routeArguments__';
|
|
21
|
+
exports.CUSTOM_ROUTE_ARGS_METADATA = '__customRouteArgs__';
|
|
22
|
+
exports.FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__';
|
|
23
|
+
exports.PIPES_METADATA = '__pipes__';
|
|
24
|
+
exports.GUARDS_METADATA = '__guards__';
|
|
25
|
+
exports.INTERCEPTORS_METADATA = '__interceptors__';
|
|
26
|
+
exports.EXCEPTION_FILTERS_METADATA = '__exceptionFilters__';
|
|
27
|
+
exports.ENHANCER_KEY_TO_SUBTYPE_MAP = {
|
|
28
|
+
[exports.GUARDS_METADATA]: 'guard',
|
|
29
|
+
[exports.INTERCEPTORS_METADATA]: 'interceptor',
|
|
30
|
+
[exports.PIPES_METADATA]: 'pipe',
|
|
31
|
+
[exports.EXCEPTION_FILTERS_METADATA]: 'filter',
|
|
32
|
+
};
|
|
33
|
+
exports.RENDER_METADATA = '__renderTemplate__';
|
|
34
|
+
exports.HTTP_CODE_METADATA = '__httpCode__';
|
|
35
|
+
exports.MODULE_PATH = '__module_path__';
|
|
36
|
+
exports.HEADERS_METADATA = '__headers__';
|
|
37
|
+
exports.REDIRECT_METADATA = '__redirect__';
|
|
38
|
+
exports.RESPONSE_PASSTHROUGH_METADATA = '__responsePassthrough__';
|
|
39
|
+
exports.SSE_METADATA = '__sse__';
|
|
40
|
+
exports.VERSION_METADATA = '__version__';
|
|
41
|
+
exports.INJECTABLE_WATERMARK = '__injectable__';
|
|
42
|
+
exports.CONTROLLER_WATERMARK = '__controller__';
|
|
43
|
+
exports.CATCH_WATERMARK = '__catch__';
|
|
44
|
+
exports.ENTRY_PROVIDER_WATERMARK = '__entryProvider__';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function that returns a new decorator that applies all decorators provided by param
|
|
3
|
+
*
|
|
4
|
+
* Useful to build new decorators (or a decorator factory) encapsulating multiple decorators related with the same feature
|
|
5
|
+
*
|
|
6
|
+
* @param decorators one or more decorators (e.g., `ApplyGuard(...)`)
|
|
7
|
+
*
|
|
8
|
+
* @publicApi
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyDecorators(...decorators: Array<ClassDecorator | MethodDecorator | PropertyDecorator>): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyDecorators = applyDecorators;
|
|
4
|
+
/**
|
|
5
|
+
* Function that returns a new decorator that applies all decorators provided by param
|
|
6
|
+
*
|
|
7
|
+
* Useful to build new decorators (or a decorator factory) encapsulating multiple decorators related with the same feature
|
|
8
|
+
*
|
|
9
|
+
* @param decorators one or more decorators (e.g., `ApplyGuard(...)`)
|
|
10
|
+
*
|
|
11
|
+
* @publicApi
|
|
12
|
+
*/
|
|
13
|
+
function applyDecorators(...decorators) {
|
|
14
|
+
return (target, propertyKey, descriptor) => {
|
|
15
|
+
for (const decorator of decorators) {
|
|
16
|
+
if (target instanceof Function && !descriptor) {
|
|
17
|
+
decorator(target);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
decorator(target, propertyKey, descriptor);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorator that binds *parameter decorators* to the method that follows.
|
|
3
|
+
*
|
|
4
|
+
* Useful when the language doesn't provide a 'Parameter Decorator' feature
|
|
5
|
+
* (i.e., vanilla JavaScript).
|
|
6
|
+
*
|
|
7
|
+
* @param decorators one or more parameter decorators (e.g., `Req()`)
|
|
8
|
+
*
|
|
9
|
+
* @publicApi
|
|
10
|
+
*/
|
|
11
|
+
export declare function Bind(...decorators: any[]): MethodDecorator;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bind = Bind;
|
|
4
|
+
/**
|
|
5
|
+
* Decorator that binds *parameter decorators* to the method that follows.
|
|
6
|
+
*
|
|
7
|
+
* Useful when the language doesn't provide a 'Parameter Decorator' feature
|
|
8
|
+
* (i.e., vanilla JavaScript).
|
|
9
|
+
*
|
|
10
|
+
* @param decorators one or more parameter decorators (e.g., `Req()`)
|
|
11
|
+
*
|
|
12
|
+
* @publicApi
|
|
13
|
+
*/
|
|
14
|
+
function Bind(...decorators) {
|
|
15
|
+
return (target, key, descriptor) => {
|
|
16
|
+
decorators.forEach((fn, index) => fn(target, key, index));
|
|
17
|
+
return descriptor;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Type, Abstract } from '../../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Decorator that marks a class as a Nest exception filter. An exception filter
|
|
4
|
+
* handles exceptions thrown by or not handled by your application code.
|
|
5
|
+
*
|
|
6
|
+
* The decorated class must implement the `ExceptionFilter` interface.
|
|
7
|
+
*
|
|
8
|
+
* @param exceptions one or more exception *types* specifying
|
|
9
|
+
* the exceptions to be caught and handled by this filter.
|
|
10
|
+
*
|
|
11
|
+
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
|
|
12
|
+
*
|
|
13
|
+
* @usageNotes
|
|
14
|
+
* Exception filters are applied using the `@UseFilters()` decorator, or (globally)
|
|
15
|
+
* with `app.useGlobalFilters()`.
|
|
16
|
+
*
|
|
17
|
+
* @publicApi
|
|
18
|
+
*/
|
|
19
|
+
export declare function Catch(...exceptions: Array<Type<any> | Abstract<any>>): ClassDecorator;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Catch = Catch;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
/**
|
|
6
|
+
* Decorator that marks a class as a Nest exception filter. An exception filter
|
|
7
|
+
* handles exceptions thrown by or not handled by your application code.
|
|
8
|
+
*
|
|
9
|
+
* The decorated class must implement the `ExceptionFilter` interface.
|
|
10
|
+
*
|
|
11
|
+
* @param exceptions one or more exception *types* specifying
|
|
12
|
+
* the exceptions to be caught and handled by this filter.
|
|
13
|
+
*
|
|
14
|
+
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
|
|
15
|
+
*
|
|
16
|
+
* @usageNotes
|
|
17
|
+
* Exception filters are applied using the `@UseFilters()` decorator, or (globally)
|
|
18
|
+
* with `app.useGlobalFilters()`.
|
|
19
|
+
*
|
|
20
|
+
* @publicApi
|
|
21
|
+
*/
|
|
22
|
+
function Catch(...exceptions) {
|
|
23
|
+
return (target) => {
|
|
24
|
+
Reflect.defineMetadata(constants_1.CATCH_WATERMARK, true, target);
|
|
25
|
+
Reflect.defineMetadata(constants_1.FILTER_CATCH_EXCEPTIONS, exceptions, target);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ScopeOptions, VersionOptions } from '../../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Interface defining options that can be passed to `@Controller()` decorator
|
|
4
|
+
*
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
export interface ControllerOptions extends ScopeOptions, VersionOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Specifies an optional `route path prefix`. The prefix is pre-pended to the
|
|
10
|
+
* path specified in any request decorator in the class.
|
|
11
|
+
*
|
|
12
|
+
* Supported only by HTTP-based applications (does not apply to non-HTTP microservices).
|
|
13
|
+
*
|
|
14
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
15
|
+
*/
|
|
16
|
+
path?: string | string[];
|
|
17
|
+
/**
|
|
18
|
+
* Specifies an optional HTTP Request host filter. When configured, methods
|
|
19
|
+
* within the controller will only be routed if the request host matches the
|
|
20
|
+
* specified value.
|
|
21
|
+
*
|
|
22
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
23
|
+
*/
|
|
24
|
+
host?: string | RegExp | Array<string | RegExp>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Decorator that marks a class as a Nest controller that can receive inbound
|
|
28
|
+
* requests and produce responses.
|
|
29
|
+
*
|
|
30
|
+
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
|
31
|
+
* It defines a class that provides the context for one or more related route
|
|
32
|
+
* handlers that correspond to HTTP request methods and associated routes
|
|
33
|
+
* for example `GET /api/profile`, `POST /users/resume`.
|
|
34
|
+
*
|
|
35
|
+
* A Microservice Controller responds to requests as well as events, running over
|
|
36
|
+
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
|
37
|
+
* It defines a class that provides a context for one or more message or event
|
|
38
|
+
* handlers.
|
|
39
|
+
*
|
|
40
|
+
* @see [Controllers](https://docs.nestjs.com/controllers)
|
|
41
|
+
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
|
42
|
+
*
|
|
43
|
+
* @publicApi
|
|
44
|
+
*/
|
|
45
|
+
export declare function Controller(): ClassDecorator;
|
|
46
|
+
/**
|
|
47
|
+
* Decorator that marks a class as a Nest controller that can receive inbound
|
|
48
|
+
* requests and produce responses.
|
|
49
|
+
*
|
|
50
|
+
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
|
51
|
+
* It defines a class that provides the context for one or more related route
|
|
52
|
+
* handlers that correspond to HTTP request methods and associated routes
|
|
53
|
+
* for example `GET /api/profile`, `POST /users/resume`.
|
|
54
|
+
*
|
|
55
|
+
* A Microservice Controller responds to requests as well as events, running over
|
|
56
|
+
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
|
57
|
+
* It defines a class that provides a context for one or more message or event
|
|
58
|
+
* handlers.
|
|
59
|
+
*
|
|
60
|
+
* @param {string|Array} prefix string that defines a `route path prefix`. The prefix
|
|
61
|
+
* is pre-pended to the path specified in any request decorator in the class.
|
|
62
|
+
*
|
|
63
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
64
|
+
* @see [Controllers](https://docs.nestjs.com/controllers)
|
|
65
|
+
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
|
66
|
+
*
|
|
67
|
+
* @publicApi
|
|
68
|
+
*/
|
|
69
|
+
export declare function Controller(prefix: string | string[]): ClassDecorator;
|
|
70
|
+
/**
|
|
71
|
+
* Decorator that marks a class as a Nest controller that can receive inbound
|
|
72
|
+
* requests and produce responses.
|
|
73
|
+
*
|
|
74
|
+
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
|
75
|
+
* It defines a class that provides the context for one or more related route
|
|
76
|
+
* handlers that correspond to HTTP request methods and associated routes
|
|
77
|
+
* for example `GET /api/profile`, `POST /users/resume`.
|
|
78
|
+
*
|
|
79
|
+
* A Microservice Controller responds to requests as well as events, running over
|
|
80
|
+
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
|
81
|
+
* It defines a class that provides a context for one or more message or event
|
|
82
|
+
* handlers.
|
|
83
|
+
*
|
|
84
|
+
* @param {object} options configuration object specifying:
|
|
85
|
+
*
|
|
86
|
+
* - `scope` - symbol that determines the lifetime of a Controller instance.
|
|
87
|
+
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
|
|
88
|
+
* more details.
|
|
89
|
+
* - `prefix` - string that defines a `route path prefix`. The prefix
|
|
90
|
+
* is pre-pended to the path specified in any request decorator in the class.
|
|
91
|
+
* - `version` - string, array of strings, or Symbol that defines the version
|
|
92
|
+
* of all routes in the class. [See Versioning](https://docs.nestjs.com/techniques/versioning)
|
|
93
|
+
* for more details.
|
|
94
|
+
*
|
|
95
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
96
|
+
* @see [Controllers](https://docs.nestjs.com/controllers)
|
|
97
|
+
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
|
98
|
+
* @see [Versioning](https://docs.nestjs.com/techniques/versioning)
|
|
99
|
+
*
|
|
100
|
+
* @publicApi
|
|
101
|
+
*/
|
|
102
|
+
export declare function Controller(options: ControllerOptions): ClassDecorator;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Controller = Controller;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const shared_utils_1 = require("../../utils/shared.utils");
|
|
6
|
+
/**
|
|
7
|
+
* Decorator that marks a class as a Nest controller that can receive inbound
|
|
8
|
+
* requests and produce responses.
|
|
9
|
+
*
|
|
10
|
+
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
|
|
11
|
+
* It defines a class that provides the context for one or more related route
|
|
12
|
+
* handlers that correspond to HTTP request methods and associated routes
|
|
13
|
+
* for example `GET /api/profile`, `POST /users/resume`
|
|
14
|
+
*
|
|
15
|
+
* A Microservice Controller responds to requests as well as events, running over
|
|
16
|
+
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
|
|
17
|
+
* It defines a class that provides a context for one or more message or event
|
|
18
|
+
* handlers.
|
|
19
|
+
*
|
|
20
|
+
* @param prefixOrOptions a `route path prefix` or a `ControllerOptions` object.
|
|
21
|
+
* A `route path prefix` is pre-pended to the path specified in any request decorator
|
|
22
|
+
* in the class. `ControllerOptions` is an options configuration object specifying:
|
|
23
|
+
* - `scope` - symbol that determines the lifetime of a Controller instance.
|
|
24
|
+
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
|
|
25
|
+
* more details.
|
|
26
|
+
* - `prefix` - string that defines a `route path prefix`. The prefix
|
|
27
|
+
* is pre-pended to the path specified in any request decorator in the class.
|
|
28
|
+
* - `version` - string, array of strings, or Symbol that defines the version
|
|
29
|
+
* of all routes in the class. [See Versioning](https://docs.nestjs.com/techniques/versioning)
|
|
30
|
+
* for more details.
|
|
31
|
+
*
|
|
32
|
+
* @see [Routing](https://docs.nestjs.com/controllers#routing)
|
|
33
|
+
* @see [Controllers](https://docs.nestjs.com/controllers)
|
|
34
|
+
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
|
|
35
|
+
* @see [Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage)
|
|
36
|
+
* @see [Versioning](https://docs.nestjs.com/techniques/versioning)
|
|
37
|
+
*
|
|
38
|
+
* @publicApi
|
|
39
|
+
*/
|
|
40
|
+
function Controller(prefixOrOptions) {
|
|
41
|
+
const defaultPath = '/';
|
|
42
|
+
const [path, host, scopeOptions, versionOptions] = (0, shared_utils_1.isUndefined)(prefixOrOptions)
|
|
43
|
+
? [defaultPath, undefined, undefined, undefined]
|
|
44
|
+
: (0, shared_utils_1.isString)(prefixOrOptions) || Array.isArray(prefixOrOptions)
|
|
45
|
+
? [prefixOrOptions, undefined, undefined, undefined]
|
|
46
|
+
: [
|
|
47
|
+
prefixOrOptions.path || defaultPath,
|
|
48
|
+
prefixOrOptions.host,
|
|
49
|
+
{ scope: prefixOrOptions.scope, durable: prefixOrOptions.durable },
|
|
50
|
+
Array.isArray(prefixOrOptions.version)
|
|
51
|
+
? Array.from(new Set(prefixOrOptions.version))
|
|
52
|
+
: prefixOrOptions.version,
|
|
53
|
+
];
|
|
54
|
+
return (target) => {
|
|
55
|
+
Reflect.defineMetadata(constants_1.CONTROLLER_WATERMARK, true, target);
|
|
56
|
+
Reflect.defineMetadata(constants_1.PATH_METADATA, path, target);
|
|
57
|
+
Reflect.defineMetadata(constants_1.HOST_METADATA, host, target);
|
|
58
|
+
Reflect.defineMetadata(constants_1.SCOPE_OPTIONS_METADATA, scopeOptions, target);
|
|
59
|
+
Reflect.defineMetadata(constants_1.VERSION_METADATA, versionOptions, target);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function flatten<T extends Array<unknown> = any>(arr: T): T extends Array<infer R> ? R : never;
|
|
2
|
+
/**
|
|
3
|
+
* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
|
|
4
|
+
*
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
export declare const Dependencies: (...dependencies: Array<unknown>) => ClassDecorator;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Dependencies = void 0;
|
|
4
|
+
exports.flatten = flatten;
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
function flatten(arr) {
|
|
7
|
+
const flat = [].concat(...arr);
|
|
8
|
+
return flat.some(Array.isArray)
|
|
9
|
+
? flatten(flat)
|
|
10
|
+
: flat;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
|
|
14
|
+
*
|
|
15
|
+
* @publicApi
|
|
16
|
+
*/
|
|
17
|
+
const Dependencies = (...dependencies) => {
|
|
18
|
+
const flattenDeps = flatten(dependencies);
|
|
19
|
+
return (target) => {
|
|
20
|
+
Reflect.defineMetadata(constants_1.PARAMTYPES_METADATA, flattenDeps, target);
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
exports.Dependencies = Dependencies;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ExceptionFilter } from '../../index';
|
|
2
|
+
/**
|
|
3
|
+
* Decorator that binds exception filters to the scope of the controller or
|
|
4
|
+
* method, depending on its context.
|
|
5
|
+
*
|
|
6
|
+
* When `@UseFilters` is used at the controller level, the filter will be
|
|
7
|
+
* applied to every handler (method) in the controller.
|
|
8
|
+
*
|
|
9
|
+
* When `@UseFilters` is used at the individual handler level, the filter
|
|
10
|
+
* will apply only to that specific method.
|
|
11
|
+
*
|
|
12
|
+
* @param filters exception filter instance or class, or a list of exception
|
|
13
|
+
* filter instances or classes.
|
|
14
|
+
*
|
|
15
|
+
* @see [Exception filters](https://docs.nestjs.com/exception-filters)
|
|
16
|
+
*
|
|
17
|
+
* @usageNotes
|
|
18
|
+
* Exception filters can also be set up globally for all controllers and routes
|
|
19
|
+
* using `app.useGlobalFilters()`. [See here for details](https://docs.nestjs.com/exception-filters#binding-filters)
|
|
20
|
+
*
|
|
21
|
+
* @publicApi
|
|
22
|
+
*/
|
|
23
|
+
export declare const UseFilters: (...filters: (ExceptionFilter | Function)[]) => MethodDecorator & ClassDecorator;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UseFilters = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
|
6
|
+
const shared_utils_1 = require("../../utils/shared.utils");
|
|
7
|
+
const validate_each_util_1 = require("../../utils/validate-each.util");
|
|
8
|
+
/**
|
|
9
|
+
* Decorator that binds exception filters to the scope of the controller or
|
|
10
|
+
* method, depending on its context.
|
|
11
|
+
*
|
|
12
|
+
* When `@UseFilters` is used at the controller level, the filter will be
|
|
13
|
+
* applied to every handler (method) in the controller.
|
|
14
|
+
*
|
|
15
|
+
* When `@UseFilters` is used at the individual handler level, the filter
|
|
16
|
+
* will apply only to that specific method.
|
|
17
|
+
*
|
|
18
|
+
* @param filters exception filter instance or class, or a list of exception
|
|
19
|
+
* filter instances or classes.
|
|
20
|
+
*
|
|
21
|
+
* @see [Exception filters](https://docs.nestjs.com/exception-filters)
|
|
22
|
+
*
|
|
23
|
+
* @usageNotes
|
|
24
|
+
* Exception filters can also be set up globally for all controllers and routes
|
|
25
|
+
* using `app.useGlobalFilters()`. [See here for details](https://docs.nestjs.com/exception-filters#binding-filters)
|
|
26
|
+
*
|
|
27
|
+
* @publicApi
|
|
28
|
+
*/
|
|
29
|
+
const UseFilters = (...filters) => addExceptionFiltersMetadata(...filters);
|
|
30
|
+
exports.UseFilters = UseFilters;
|
|
31
|
+
function addExceptionFiltersMetadata(...filters) {
|
|
32
|
+
return (target, key, descriptor) => {
|
|
33
|
+
const isFilterValid = (filter) => filter && ((0, shared_utils_1.isFunction)(filter) || (0, shared_utils_1.isFunction)(filter.catch));
|
|
34
|
+
if (descriptor) {
|
|
35
|
+
(0, validate_each_util_1.validateEach)(target.constructor, filters, isFilterValid, '@UseFilters', 'filter');
|
|
36
|
+
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
|
|
37
|
+
return descriptor;
|
|
38
|
+
}
|
|
39
|
+
(0, validate_each_util_1.validateEach)(target, filters, isFilterValid, '@UseFilters', 'filter');
|
|
40
|
+
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
|
|
41
|
+
return target;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './bind.decorator';
|
|
2
|
+
export * from './catch.decorator';
|
|
3
|
+
export * from './controller.decorator';
|
|
4
|
+
export * from './dependencies.decorator';
|
|
5
|
+
export * from './exception-filters.decorator';
|
|
6
|
+
export * from './inject.decorator';
|
|
7
|
+
export * from './injectable.decorator';
|
|
8
|
+
export * from './optional.decorator';
|
|
9
|
+
export * from './set-metadata.decorator';
|
|
10
|
+
export * from './use-guards.decorator';
|
|
11
|
+
export * from './use-interceptors.decorator';
|
|
12
|
+
export * from './use-pipes.decorator';
|
|
13
|
+
export * from './apply-decorators';
|
|
14
|
+
export * from './version.decorator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./bind.decorator"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./catch.decorator"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./controller.decorator"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./dependencies.decorator"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./exception-filters.decorator"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./inject.decorator"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./injectable.decorator"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./optional.decorator"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./set-metadata.decorator"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./use-guards.decorator"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./use-interceptors.decorator"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./use-pipes.decorator"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./apply-decorators"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./version.decorator"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ForwardReference, InjectionToken } from '../../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Decorator that marks a constructor parameter as a target for
|
|
4
|
+
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
|
|
5
|
+
*
|
|
6
|
+
* Any injected provider must be visible within the module scope (loosely
|
|
7
|
+
* speaking, the containing module) of the class it is being injected into. This
|
|
8
|
+
* can be done by:
|
|
9
|
+
*
|
|
10
|
+
* - defining the provider in the same module scope
|
|
11
|
+
* - exporting the provider from one module scope and importing that module into the
|
|
12
|
+
* module scope of the class being injected into
|
|
13
|
+
* - exporting the provider from a module that is marked as global using the
|
|
14
|
+
* `@Global()` decorator
|
|
15
|
+
*
|
|
16
|
+
* #### Injection tokens
|
|
17
|
+
* Can be *types* (class names), *strings* or *symbols*. This depends on how the
|
|
18
|
+
* provider with which it is associated was defined. Providers defined with the
|
|
19
|
+
* `@Injectable()` decorator use the class name. Custom Providers may use strings
|
|
20
|
+
* or symbols as the injection token.
|
|
21
|
+
*
|
|
22
|
+
* @param token lookup key for the provider to be injected (assigned to the constructor
|
|
23
|
+
* parameter).
|
|
24
|
+
*
|
|
25
|
+
* @see [Providers](https://docs.nestjs.com/providers)
|
|
26
|
+
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
|
|
27
|
+
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
|
|
28
|
+
*
|
|
29
|
+
* @publicApi
|
|
30
|
+
*/
|
|
31
|
+
export declare function Inject(token?: InjectionToken | ForwardReference): PropertyDecorator & ParameterDecorator;
|