Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

nestjs-uuid

NestJS-Libs2.8kMIT0.1.4TypeScript support: included

A NestJS module for generating UUIDs

nest, nestjs, uuid, uuidv1, uuidv4

readme

nestjs-uuid

Installation

yarn add nestjs-uuid
npm i nestjs-uuid


How to use


Import module:

@Module({
  imports: [
    UuidModule
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}


Inject uuid service into a provider:

v0.0.5

@Injectable()
export class AppService {
  constructor(@InjectUuidService() private readonly uuidService: UuidService) {}

  getHello() {
    return this.uuidService.generate();
  }
}

After v.0.0.5

@Injectable()
export class AppService {
  constructor(private readonly uuidService: UuidService) {}

  getHello() {
    return this.uuidService.generate();
  }
}
  getHello() {
    return this.uuidService.generate({ version: 1 });
  }
  getHello() {
    return this.uuidService.generate({ version: 4 });
  }


changelog

Changelog

0.0.6

  • Removed inject decorator
  • Replaced UuidService type from contract to declaration