UNPKG

@nestjs/core

Version:

The core of NestJS, a TypeScript framework for Node.js backends: modules, dependency injection and the request pipeline, on Express, Fastify or node:http.

19 lines (18 loc) • 662 B
import { DeterministicUuidRegistry } from './deterministic-uuid-registry.js'; import { randomStringGenerator } from '@nestjs/common/internal'; export var UuidFactoryMode; (function (UuidFactoryMode) { UuidFactoryMode["Random"] = "random"; UuidFactoryMode["Deterministic"] = "deterministic"; })(UuidFactoryMode || (UuidFactoryMode = {})); export class UuidFactory { static _mode = UuidFactoryMode.Random; static set mode(value) { this._mode = value; } static get(key = '') { return this._mode === UuidFactoryMode.Deterministic ? DeterministicUuidRegistry.get(key) : randomStringGenerator(); } }