Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@fuse-autotech/nest-timeout
Advanced tools
This package enables to use a custom timeout alongside with the global timeout interceptor.
NestJS Timeout Interceptor repository. It enables setting up a global timeout for a NestJS application, which can be overridden by a Timeout Decorator for controller classes and methods specific timeouts. This gives the user more flexibility with a small amount of additional code. Method timeouts are preferred over class timeouts, which are preferred over global timeouts. Enjoy!
$ npm install @fuse-autotech/nest-timeout
Options:
defaultTimeout
- Number of milliseconds after which the interceptor throws a RequestTimeoutException
if no other timeout is defined for the endpointisEnabled
- Determine if the interceptor is enabled. Defaults to true
. Useful for debugging to avoid timeouts
import { Module } from "@nestjs/common";
import { APP_INTERCEPTOR } from "@nestjs/core";
import { TimeoutInterceptor } from "@fuse-autotech/nest-timeout";
@Module({
imports: [],
controllers: [],
providers: [{
provide: APP_INTERCEPTOR,
useValue: new TimeoutInterceptor({ defaultTimeout: 10000 })
}]
})
export class AppModule {}
@Timeout()
DecoratorCan be used both on Controllers and Controller Methods:
import { Controller, Get, Param, Post } from '@nestjs/common';
import { Timeout } from '@fuse-autotech/nest-timeout';
@Controller('cats')
@Timeout(10000) // Applied for all methods unless decorated
export class CatsController {
@Get()
findAll(): string {
return 'This action returns all cats';
}
@Get(':id')
@Timeout(30000) // Overrides controller timeout
findOne(@Param('id') id: string ): string {
return `This action returns a #${id} cat`;
}
@Post()
@Timeout(0) // Disables timeout for the method
create(): string {
return 'This action adds a new cat';
}
}
Nest timeout is MIT licensed.
FAQs
This package enables to use a custom timeout alongside with the global timeout interceptor.
The npm package @fuse-autotech/nest-timeout receives a total of 1,065 weekly downloads. As such, @fuse-autotech/nest-timeout popularity was classified as popular.
We found that @fuse-autotech/nest-timeout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.