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) • 776 B
TypeScript
import type { DomainObject } from '../instantiation/DomainObject';
/**
* omits all metadata values on a domain object
*
* relevance:
* - often in change detection, metadata values are not relevant, this provides an easy way to omit them
*
* features:
* - utilizes the `.metadata` property of the domain object definition to identify metadata keys
* - recall, the default is `id`, `uuid`, `createdAt`, `updatedAt`, `effectiveAt`
* - recursive, applies omission deeply
*
* note:
* - metadata is the most common readonly category, applicable to all domain objects
* - for broader readonly (including non-metadata externally-resolved attributes), use `omitReadonly`
*/
export declare const omitMetadata: <T extends DomainObject<Record<string, any>>>(obj: T) => T;