import type { RefByPrimary } from '../instantiation/RefByPrimary'; import type { RefByUnique } from '../instantiation/RefByUnique'; import type { DomainObjectShape, Refable } from './Refable'; /** * declares a reference to a domain.entity or a domain.event */ export type Ref, TShape extends DomainObjectShape = any, // todo: update DomainObjectShape -> DomainReferenceableInstance to enable extraction of primary and unique keys via types TPrimary extends readonly string[] = any, TUnique extends readonly string[] = any> = { /** * the name of the domain object this is a reference to, if provided * * note * - this will be automatically specified if using `getRef` */ _dobj?: string; } & ((Required> & {}) | (RefByUnique & {}));