UNPKG

@hexadrop/value-object

Version:

Hexagonal architecture utils library

33 lines (30 loc) 1.04 kB
import StringValueObject from './string.value-object.js'; /** * UuiiValueObject is an abstract class that represents a UUID value object. * It extends the StringValueObject class and provides additional methods for validating the UUID value. */ declare abstract class UuiiValueObject extends StringValueObject { /** * Constructs a new UuiiValueObject instance. * * @param value - The UUID value. * @param property - Optional. The property name. * @throws {InvalidUuiiValueError} If the value is not a valid UUID. */ constructor(value: string, property?: string); /** * Generates a random UUID. * * @returns {string} A random UUID. */ static random(): string; /** * Checks if the value is a valid UUID. * * @param id - The value to check. * @param property - Optional. The property name. * @throws {InvalidUuiiValueError} If the value is not a valid UUID. */ private static ensureIsValidUuid; } export { UuiiValueObject as default };