1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.UuidFactory = exports.UuidFactoryMode = void 0;
|
4 | const random_string_generator_util_1 = require("@nestjs/common/utils/random-string-generator.util");
|
5 | const deterministic_uuid_registry_1 = require("./deterministic-uuid-registry");
|
6 | var UuidFactoryMode;
|
7 | (function (UuidFactoryMode) {
|
8 | UuidFactoryMode["Random"] = "random";
|
9 | UuidFactoryMode["Deterministic"] = "deterministic";
|
10 | })(UuidFactoryMode || (exports.UuidFactoryMode = UuidFactoryMode = {}));
|
11 | class UuidFactory {
|
12 | static set mode(value) {
|
13 | this._mode = value;
|
14 | }
|
15 | static get(key = '') {
|
16 | return this._mode === UuidFactoryMode.Deterministic
|
17 | ? deterministic_uuid_registry_1.DeterministicUuidRegistry.get(key)
|
18 | : (0, random_string_generator_util_1.randomStringGenerator)();
|
19 | }
|
20 | }
|
21 | exports.UuidFactory = UuidFactory;
|
22 | UuidFactory._mode = UuidFactoryMode.Random;
|