@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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { CanActivate } from './features/can-activate.interface';
|
|
2
|
+
import { NestInterceptor } from './features/nest-interceptor.interface';
|
|
3
|
+
import { GlobalPrefixOptions } from './global-prefix-options.interface';
|
|
4
|
+
import { HttpServer } from './http/http-server.interface';
|
|
5
|
+
import { ExceptionFilter, INestMicroservice, NestHybridApplicationOptions, PipeTransform } from './index';
|
|
6
|
+
import { INestApplicationContext } from './nest-application-context.interface';
|
|
7
|
+
import { VersioningOptions } from './version-options.interface';
|
|
8
|
+
import { WebSocketAdapter } from './websockets/web-socket-adapter.interface';
|
|
9
|
+
/**
|
|
10
|
+
* Interface defining the core NestApplication object.
|
|
11
|
+
*
|
|
12
|
+
* @publicApi
|
|
13
|
+
*/
|
|
14
|
+
export interface INestApplication<TServer = any> extends INestApplicationContext {
|
|
15
|
+
/**
|
|
16
|
+
* A wrapper function around HTTP adapter method: `adapter.use()`.
|
|
17
|
+
* Example `app.use(cors())`
|
|
18
|
+
*
|
|
19
|
+
* @returns {this}
|
|
20
|
+
*/
|
|
21
|
+
use(...args: any[]): this;
|
|
22
|
+
/**
|
|
23
|
+
* Enables CORS (Cross-Origin Resource Sharing)
|
|
24
|
+
*
|
|
25
|
+
* @returns {void}
|
|
26
|
+
*/
|
|
27
|
+
enableCors(options?: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* Enables Versioning for the application.
|
|
30
|
+
* By default, URI-based versioning is used.
|
|
31
|
+
*
|
|
32
|
+
* @param {VersioningOptions} options
|
|
33
|
+
* @returns {this}
|
|
34
|
+
*/
|
|
35
|
+
enableVersioning(options?: VersioningOptions): this;
|
|
36
|
+
/**
|
|
37
|
+
* Starts the application.
|
|
38
|
+
*
|
|
39
|
+
* @param {number|string} port
|
|
40
|
+
* @param {string} [hostname]
|
|
41
|
+
* @param {Function} [callback] Optional callback
|
|
42
|
+
* @returns {Promise} A Promise that, when resolved, is a reference to the underlying HttpServer.
|
|
43
|
+
*/
|
|
44
|
+
listen(port: number | string, callback?: () => void): Promise<any>;
|
|
45
|
+
listen(port: number | string, hostname: string, callback?: () => void): Promise<any>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the url the application is listening at, based on OS and IP version. Returns as an IP value either in IPv6 or IPv4
|
|
48
|
+
*
|
|
49
|
+
* @returns {Promise<string>} The IP where the server is listening
|
|
50
|
+
*/
|
|
51
|
+
getUrl(): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Registers a prefix for every HTTP route path.
|
|
54
|
+
*
|
|
55
|
+
* @param {string} prefix The prefix for every HTTP route path (for example `/v1/api`)
|
|
56
|
+
* @param {GlobalPrefixOptions} options Global prefix options object
|
|
57
|
+
* @returns {this}
|
|
58
|
+
*/
|
|
59
|
+
setGlobalPrefix(prefix: string, options?: GlobalPrefixOptions): this;
|
|
60
|
+
/**
|
|
61
|
+
* Register Ws Adapter which will be used inside Gateways.
|
|
62
|
+
* Use when you want to override default `socket.io` library.
|
|
63
|
+
*
|
|
64
|
+
* @param {WebSocketAdapter} adapter
|
|
65
|
+
* @returns {this}
|
|
66
|
+
*/
|
|
67
|
+
useWebSocketAdapter(adapter: WebSocketAdapter): this;
|
|
68
|
+
/**
|
|
69
|
+
* Connects microservice to the NestApplication instance. Transforms application
|
|
70
|
+
* to a hybrid instance.
|
|
71
|
+
*
|
|
72
|
+
* @template {object} T
|
|
73
|
+
* @param {T} options Microservice options object
|
|
74
|
+
* @param {NestHybridApplicationOptions} hybridOptions Hybrid options object
|
|
75
|
+
* @returns {INestMicroservice}
|
|
76
|
+
*/
|
|
77
|
+
connectMicroservice<T extends object = any>(options: T, hybridOptions?: NestHybridApplicationOptions): INestMicroservice;
|
|
78
|
+
/**
|
|
79
|
+
* Returns array of the microservices connected to the NestApplication.
|
|
80
|
+
*
|
|
81
|
+
* @returns {INestMicroservice[]}
|
|
82
|
+
*/
|
|
83
|
+
getMicroservices(): INestMicroservice[];
|
|
84
|
+
/**
|
|
85
|
+
* Returns the underlying native HTTP server.
|
|
86
|
+
*
|
|
87
|
+
* @returns {TServer}
|
|
88
|
+
*/
|
|
89
|
+
getHttpServer(): TServer;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the underlying HTTP adapter.
|
|
92
|
+
*
|
|
93
|
+
* @returns {HttpServer}
|
|
94
|
+
*/
|
|
95
|
+
getHttpAdapter(): HttpServer;
|
|
96
|
+
/**
|
|
97
|
+
* Starts all connected microservices asynchronously.
|
|
98
|
+
*
|
|
99
|
+
* @returns {Promise}
|
|
100
|
+
*/
|
|
101
|
+
startAllMicroservices(): Promise<this>;
|
|
102
|
+
/**
|
|
103
|
+
* Registers exception filters as global filters (will be used within
|
|
104
|
+
* every HTTP route handler)
|
|
105
|
+
*
|
|
106
|
+
* @param {...ExceptionFilter} filters
|
|
107
|
+
*/
|
|
108
|
+
useGlobalFilters(...filters: ExceptionFilter[]): this;
|
|
109
|
+
/**
|
|
110
|
+
* Registers pipes as global pipes (will be used within every HTTP route handler)
|
|
111
|
+
*
|
|
112
|
+
* @param {...PipeTransform} pipes
|
|
113
|
+
*/
|
|
114
|
+
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
|
|
115
|
+
/**
|
|
116
|
+
* Registers interceptors as global interceptors (will be used within
|
|
117
|
+
* every HTTP route handler)
|
|
118
|
+
*
|
|
119
|
+
* @param {...NestInterceptor} interceptors
|
|
120
|
+
*/
|
|
121
|
+
useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
|
|
122
|
+
/**
|
|
123
|
+
* Registers guards as global guards (will be used within every HTTP route handler)
|
|
124
|
+
*
|
|
125
|
+
* @param {...CanActivate} guards
|
|
126
|
+
*/
|
|
127
|
+
useGlobalGuards(...guards: CanActivate[]): this;
|
|
128
|
+
/**
|
|
129
|
+
* Terminates the application (including NestApplication, Gateways, and each connected
|
|
130
|
+
* microservice)
|
|
131
|
+
*
|
|
132
|
+
* @returns {Promise<void>}
|
|
133
|
+
*/
|
|
134
|
+
close(): Promise<void>;
|
|
135
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ExceptionFilter } from './exceptions/exception-filter.interface';
|
|
3
|
+
import { CanActivate } from './features/can-activate.interface';
|
|
4
|
+
import { NestInterceptor } from './features/nest-interceptor.interface';
|
|
5
|
+
import { PipeTransform } from './features/pipe-transform.interface';
|
|
6
|
+
import { INestApplicationContext } from './nest-application-context.interface';
|
|
7
|
+
import { WebSocketAdapter } from './websockets/web-socket-adapter.interface';
|
|
8
|
+
/**
|
|
9
|
+
* Interface describing Microservice Context.
|
|
10
|
+
*
|
|
11
|
+
* @publicApi
|
|
12
|
+
*/
|
|
13
|
+
export interface INestMicroservice extends INestApplicationContext {
|
|
14
|
+
/**
|
|
15
|
+
* Starts the microservice.
|
|
16
|
+
*
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
19
|
+
listen(): Promise<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Registers a web socket adapter that will be used for Gateways.
|
|
22
|
+
* Use to override the default `socket.io` library.
|
|
23
|
+
*
|
|
24
|
+
* @param {WebSocketAdapter} adapter
|
|
25
|
+
* @returns {this}
|
|
26
|
+
*/
|
|
27
|
+
useWebSocketAdapter(adapter: WebSocketAdapter): this;
|
|
28
|
+
/**
|
|
29
|
+
* Registers global exception filters (will be used for every pattern handler).
|
|
30
|
+
*
|
|
31
|
+
* @param {...ExceptionFilter} filters
|
|
32
|
+
*/
|
|
33
|
+
useGlobalFilters(...filters: ExceptionFilter[]): this;
|
|
34
|
+
/**
|
|
35
|
+
* Registers global pipes (will be used for every pattern handler).
|
|
36
|
+
*
|
|
37
|
+
* @param {...PipeTransform} pipes
|
|
38
|
+
*/
|
|
39
|
+
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
|
|
40
|
+
/**
|
|
41
|
+
* Registers global interceptors (will be used for every pattern handler).
|
|
42
|
+
*
|
|
43
|
+
* @param {...NestInterceptor} interceptors
|
|
44
|
+
*/
|
|
45
|
+
useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
|
|
46
|
+
/**
|
|
47
|
+
* Registers global guards (will be used for every pattern handler).
|
|
48
|
+
*
|
|
49
|
+
* @param {...CanActivate} guards
|
|
50
|
+
*/
|
|
51
|
+
useGlobalGuards(...guards: CanActivate[]): this;
|
|
52
|
+
/**
|
|
53
|
+
* Terminates the application.
|
|
54
|
+
*
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
close(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns an observable that emits status changes.
|
|
60
|
+
*
|
|
61
|
+
* @returns {Observable<string>}
|
|
62
|
+
*/
|
|
63
|
+
status: Observable<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Registers an event listener for the given event.
|
|
66
|
+
* @param event Event name
|
|
67
|
+
* @param callback Callback to be executed when the event is emitted
|
|
68
|
+
*/
|
|
69
|
+
on<EventsMap extends Record<string, Function> = Record<string, Function>, EventKey extends keyof EventsMap = keyof EventsMap, EventCallback extends EventsMap[EventKey] = EventsMap[EventKey]>(event: EventKey, callback: EventCallback): void;
|
|
70
|
+
/**
|
|
71
|
+
* Returns an instance of the underlying server/broker instance,
|
|
72
|
+
* or a group of servers if there are more than one.
|
|
73
|
+
*/
|
|
74
|
+
unwrap<T>(): T;
|
|
75
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @publicApi
|
|
3
|
+
*/
|
|
4
|
+
export declare enum Scope {
|
|
5
|
+
/**
|
|
6
|
+
* The provider can be shared across multiple classes. The provider lifetime
|
|
7
|
+
* is strictly tied to the application lifecycle. Once the application has
|
|
8
|
+
* bootstrapped, all providers have been instantiated.
|
|
9
|
+
*/
|
|
10
|
+
DEFAULT = 0,
|
|
11
|
+
/**
|
|
12
|
+
* A new private instance of the provider is instantiated for every use
|
|
13
|
+
*/
|
|
14
|
+
TRANSIENT = 1,
|
|
15
|
+
/**
|
|
16
|
+
* A new instance is instantiated for each request processing pipeline
|
|
17
|
+
*/
|
|
18
|
+
REQUEST = 2
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @publicApi
|
|
22
|
+
*
|
|
23
|
+
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
|
|
24
|
+
*/
|
|
25
|
+
export interface ScopeOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Specifies the lifetime of an injected Provider or Controller.
|
|
28
|
+
*/
|
|
29
|
+
scope?: Scope;
|
|
30
|
+
/**
|
|
31
|
+
* Flags provider as durable. This flag can be used in combination with custom context id
|
|
32
|
+
* factory strategy to construct lazy DI subtrees.
|
|
33
|
+
*
|
|
34
|
+
* This flag can be used only in conjunction with scope = Scope.REQUEST.
|
|
35
|
+
*/
|
|
36
|
+
durable?: boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Scope = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
var Scope;
|
|
8
|
+
(function (Scope) {
|
|
9
|
+
/**
|
|
10
|
+
* The provider can be shared across multiple classes. The provider lifetime
|
|
11
|
+
* is strictly tied to the application lifecycle. Once the application has
|
|
12
|
+
* bootstrapped, all providers have been instantiated.
|
|
13
|
+
*/
|
|
14
|
+
Scope[Scope["DEFAULT"] = 0] = "DEFAULT";
|
|
15
|
+
/**
|
|
16
|
+
* A new private instance of the provider is instantiated for every use
|
|
17
|
+
*/
|
|
18
|
+
Scope[Scope["TRANSIENT"] = 1] = "TRANSIENT";
|
|
19
|
+
/**
|
|
20
|
+
* A new instance is instantiated for each request processing pipeline
|
|
21
|
+
*/
|
|
22
|
+
Scope[Scope["REQUEST"] = 2] = "REQUEST";
|
|
23
|
+
})(Scope || (exports.Scope = Scope = {}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring shutdown hooks behavior.
|
|
3
|
+
*
|
|
4
|
+
* @publicApi
|
|
5
|
+
*/
|
|
6
|
+
export interface ShutdownHooksOptions {
|
|
7
|
+
/**
|
|
8
|
+
* If true, uses `process.exit()` instead of `process.kill(process.pid, signal)`
|
|
9
|
+
* after shutdown hooks complete. This ensures the 'exit' event is properly
|
|
10
|
+
* triggered, which is required for async loggers (like Pino with transports)
|
|
11
|
+
* to flush their buffers before the process terminates.
|
|
12
|
+
*
|
|
13
|
+
* Note: Using `process.exit()` will:
|
|
14
|
+
* - Change the exit code (e.g., SIGTERM: 143 → 0)
|
|
15
|
+
* - May not trigger other signal handlers from third-party libraries
|
|
16
|
+
* - May affect orchestrator (Kubernetes, Docker) behavior
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
useProcessExit?: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { VersioningType } from '../enums/version-type.enum';
|
|
2
|
+
/**
|
|
3
|
+
* Indicates that this will work for any version passed in the request, or no version.
|
|
4
|
+
*
|
|
5
|
+
* @publicApi
|
|
6
|
+
*/
|
|
7
|
+
export declare const VERSION_NEUTRAL: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* @publicApi
|
|
10
|
+
*/
|
|
11
|
+
export type VersionValue = string | typeof VERSION_NEUTRAL | Array<string | typeof VERSION_NEUTRAL>;
|
|
12
|
+
/**
|
|
13
|
+
* @publicApi
|
|
14
|
+
*/
|
|
15
|
+
export interface VersionOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Specifies an optional API Version. When configured, methods
|
|
18
|
+
* within the controller will only be routed if the request version
|
|
19
|
+
* matches the specified value.
|
|
20
|
+
*
|
|
21
|
+
* Supported only by HTTP-based applications (does not apply to non-HTTP microservices).
|
|
22
|
+
*
|
|
23
|
+
* @see [Versioning](https://docs.nestjs.com/techniques/versioning)
|
|
24
|
+
*/
|
|
25
|
+
version?: VersionValue;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @publicApi
|
|
29
|
+
*/
|
|
30
|
+
export interface HeaderVersioningOptions {
|
|
31
|
+
type: VersioningType.HEADER;
|
|
32
|
+
/**
|
|
33
|
+
* The name of the Request Header that contains the version.
|
|
34
|
+
*/
|
|
35
|
+
header: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @publicApi
|
|
39
|
+
*/
|
|
40
|
+
export interface UriVersioningOptions {
|
|
41
|
+
type: VersioningType.URI;
|
|
42
|
+
/**
|
|
43
|
+
* Optional prefix that will prepend the version within the URI.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `v`.
|
|
46
|
+
*
|
|
47
|
+
* Ex. Assuming a version of `1`, for `/api/v1/route`, `v` is the prefix.
|
|
48
|
+
*/
|
|
49
|
+
prefix?: string | false;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @publicApi
|
|
53
|
+
*/
|
|
54
|
+
export interface MediaTypeVersioningOptions {
|
|
55
|
+
type: VersioningType.MEDIA_TYPE;
|
|
56
|
+
/**
|
|
57
|
+
* The key within the Media Type Header to determine the version from.
|
|
58
|
+
*
|
|
59
|
+
* Ex. For `application/json;v=1`, the key is `v=`.
|
|
60
|
+
*/
|
|
61
|
+
key: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @publicApi
|
|
65
|
+
*/
|
|
66
|
+
export interface CustomVersioningOptions {
|
|
67
|
+
type: VersioningType.CUSTOM;
|
|
68
|
+
/**
|
|
69
|
+
* A function that accepts a request object (specific to the underlying platform, ie Express or Fastify)
|
|
70
|
+
* and returns a single version value or an ordered array of versions, in order from HIGHEST to LOWEST.
|
|
71
|
+
*
|
|
72
|
+
* Ex. Returned version array = ['3.1', '3.0', '2.5', '2', '1.9']
|
|
73
|
+
*
|
|
74
|
+
* Use type assertion or narrowing to identify the specific request type.
|
|
75
|
+
*/
|
|
76
|
+
extractor: (request: unknown) => string | string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @publicApi
|
|
80
|
+
*/
|
|
81
|
+
interface VersioningCommonOptions {
|
|
82
|
+
/**
|
|
83
|
+
* The default version to be used as a fallback when you did not provide some
|
|
84
|
+
* version to `@Controller()` nor `@Version()`.
|
|
85
|
+
*/
|
|
86
|
+
defaultVersion?: VersionOptions['version'];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @publicApi
|
|
90
|
+
*/
|
|
91
|
+
export type VersioningOptions = VersioningCommonOptions & (HeaderVersioningOptions | UriVersioningOptions | MediaTypeVersioningOptions | CustomVersioningOptions);
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERSION_NEUTRAL = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Indicates that this will work for any version passed in the request, or no version.
|
|
6
|
+
*
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
exports.VERSION_NEUTRAL = Symbol('VERSION_NEUTRAL');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
export interface WsMessageHandler<T = string> {
|
|
6
|
+
message: T;
|
|
7
|
+
callback: (...args: any[]) => Observable<any> | Promise<any>;
|
|
8
|
+
isAckHandledManually: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @publicApi
|
|
12
|
+
*/
|
|
13
|
+
export interface WebSocketAdapter<TServer = any, TClient = any, TOptions = any> {
|
|
14
|
+
create(port: number, options?: TOptions): TServer;
|
|
15
|
+
bindClientConnect(server: TServer, callback: Function): any;
|
|
16
|
+
bindClientDisconnect?(client: TClient, callback: Function): any;
|
|
17
|
+
bindMessageHandlers(client: TClient, handlers: WsMessageHandler[], transform: (data: any) => Observable<any>): any;
|
|
18
|
+
close(server: TServer): any;
|
|
19
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { DynamicModule } from '../interfaces';
|
|
2
|
+
import { Logger } from '../services/logger.service';
|
|
3
|
+
import { DEFAULT_FACTORY_CLASS_METHOD_KEY, DEFAULT_METHOD_KEY } from './constants';
|
|
4
|
+
import { ConfigurableModuleHost } from './interfaces';
|
|
5
|
+
/**
|
|
6
|
+
* @publicApi
|
|
7
|
+
*/
|
|
8
|
+
export interface ConfigurableModuleBuilderOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Specifies what injection token should be used for the module options provider.
|
|
11
|
+
* By default, an auto-generated UUID will be used.
|
|
12
|
+
*/
|
|
13
|
+
optionsInjectionToken?: string | symbol;
|
|
14
|
+
/**
|
|
15
|
+
* By default, an UUID will be used as a module options provider token.
|
|
16
|
+
* Explicitly specifying the "moduleName" will instruct the "ConfigurableModuleBuilder"
|
|
17
|
+
* to use a more descriptive provider token.
|
|
18
|
+
*
|
|
19
|
+
* For example, `moduleName: "Cache"` will auto-generate the provider token: "CACHE_MODULE_OPTIONS".
|
|
20
|
+
*/
|
|
21
|
+
moduleName?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates whether module should always be "transient" - meaning,
|
|
24
|
+
* every time you call the static method to construct a dynamic module,
|
|
25
|
+
* regardless of what arguments you pass in, a new "unique" module will be created.
|
|
26
|
+
*
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
alwaysTransient?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Factory that lets you create configurable modules and
|
|
33
|
+
* provides a way to reduce the majority of dynamic module boilerplate.
|
|
34
|
+
*
|
|
35
|
+
* @publicApi
|
|
36
|
+
*/
|
|
37
|
+
export declare class ConfigurableModuleBuilder<ModuleOptions, StaticMethodKey extends string = typeof DEFAULT_METHOD_KEY, FactoryClassMethodKey extends string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY, ExtraModuleDefinitionOptions = {}> {
|
|
38
|
+
protected readonly options: ConfigurableModuleBuilderOptions;
|
|
39
|
+
protected staticMethodKey: StaticMethodKey;
|
|
40
|
+
protected factoryClassMethodKey: FactoryClassMethodKey;
|
|
41
|
+
protected extras: ExtraModuleDefinitionOptions;
|
|
42
|
+
protected transformModuleDefinition: (definition: DynamicModule, extraOptions: ExtraModuleDefinitionOptions) => DynamicModule;
|
|
43
|
+
protected readonly logger: Logger;
|
|
44
|
+
constructor(options?: ConfigurableModuleBuilderOptions, parentBuilder?: ConfigurableModuleBuilder<ModuleOptions>);
|
|
45
|
+
/**
|
|
46
|
+
* Registers the "extras" object (a set of extra options that can be used to modify the dynamic module definition).
|
|
47
|
+
* Values you specify within the "extras" object will be used as default values (that can be overridden by module consumers).
|
|
48
|
+
*
|
|
49
|
+
* This method also applies the so-called "module definition transform function" that takes the auto-generated
|
|
50
|
+
* dynamic module object ("DynamicModule") and the actual consumer "extras" object as input parameters.
|
|
51
|
+
* The "extras" object consists of values explicitly specified by module consumers and default values.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* .setExtras<{ isGlobal?: boolean }>({ isGlobal: false }, (definition, extras) =>
|
|
56
|
+
* ({ ...definition, global: extras.isGlobal })
|
|
57
|
+
* )
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
setExtras<ExtraModuleDefinitionOptions>(extras: ExtraModuleDefinitionOptions, transformDefinition?: (definition: DynamicModule, extras: ExtraModuleDefinitionOptions) => DynamicModule): ConfigurableModuleBuilder<ModuleOptions, StaticMethodKey, FactoryClassMethodKey, ExtraModuleDefinitionOptions>;
|
|
61
|
+
/**
|
|
62
|
+
* Dynamic modules must expose public static methods that let you pass in
|
|
63
|
+
* configuration parameters (control the module's behavior from the outside).
|
|
64
|
+
* Some frequently used names that you may have seen in other modules are:
|
|
65
|
+
* "forRoot", "forFeature", "register", "configure".
|
|
66
|
+
*
|
|
67
|
+
* This method "setClassMethodName" lets you specify the name of the
|
|
68
|
+
* method that will be auto-generated.
|
|
69
|
+
*
|
|
70
|
+
* @param key name of the method
|
|
71
|
+
*/
|
|
72
|
+
setClassMethodName<StaticMethodKey extends string>(key: StaticMethodKey): ConfigurableModuleBuilder<ModuleOptions, StaticMethodKey, FactoryClassMethodKey, ExtraModuleDefinitionOptions>;
|
|
73
|
+
/**
|
|
74
|
+
* Asynchronously configured modules (that rely on other modules, i.e. "ConfigModule")
|
|
75
|
+
* let you pass the configuration factory class that will be registered and instantiated as a provider.
|
|
76
|
+
* This provider then will be used to retrieve the module's configuration. To provide the configuration,
|
|
77
|
+
* the corresponding factory method must be implemented.
|
|
78
|
+
*
|
|
79
|
+
* This method ("setFactoryMethodName") lets you control what method name will have to be
|
|
80
|
+
* implemented by the config factory (default is "create").
|
|
81
|
+
*
|
|
82
|
+
* @param key name of the method
|
|
83
|
+
*/
|
|
84
|
+
setFactoryMethodName<FactoryClassMethodKey extends string>(key: FactoryClassMethodKey): ConfigurableModuleBuilder<ModuleOptions, StaticMethodKey, FactoryClassMethodKey, ExtraModuleDefinitionOptions>;
|
|
85
|
+
/**
|
|
86
|
+
* Returns an object consisting of multiple properties that lets you
|
|
87
|
+
* easily construct dynamic configurable modules. See "ConfigurableModuleHost" interface for more details.
|
|
88
|
+
*/
|
|
89
|
+
build(): ConfigurableModuleHost<ModuleOptions, StaticMethodKey, FactoryClassMethodKey, ExtraModuleDefinitionOptions>;
|
|
90
|
+
private constructInjectionTokenString;
|
|
91
|
+
private createConfigurableModuleCls;
|
|
92
|
+
private createTypeProxy;
|
|
93
|
+
}
|