UNPKG

domain-objects

Version:

A simple, convenient way to represent domain objects, leverage domain knowledge, and add runtime validation in your code base.

18 lines (17 loc) 796 B
import { DomainEntity } from '../instantiation/DomainEntity'; import { DomainLiteral } from '../instantiation/DomainLiteral'; /** * get a uri safe slug which uniquely identifies this domain object * * features * - human scannable, for easy debugging * - file path and uri safe, for broad usage * * usecases * - persisting domain objects to a cache * * strategy * - define the human readable portion of the slug by concatenating the unique identifier values and omitting non-safe characters (safe = `\w`, `.`, `-`, `_`) * - define the identity uniqueness guarantee by using sha256 to guarantee that the total string will no have collisions due to excluding non-safe characters */ export declare const getUniqueIdentifierSlug: (dobj: DomainEntity<any> | DomainLiteral<any>) => string;