import type { WithExpectOutput } from 'as-procedure'; import { DomainEntity, type Refable, type RefByUnique } from 'domain-objects'; /** * .what = an artifact that can be leveraged throughout a weave * .why = * .cases = * - iterate on a particular file * - write to a particular repo * - etc */ export interface Artifact, TContent = string> { ref: RefByUnique; /** * .what = loads the resource if it exists, else returns null * .why = avoids throwing on missing files; supports optional or lazy creation */ get: WithExpectOutput<() => Promise<(InstanceType & { content: TContent; }) | null>>; /** * .what = writes or replaces the resource with new content * .why = enables mutation and tracking via updated instance */ set: (input: { content: TContent; }) => Promise & { content: TContent; }>; /** * .what = deletes the underlying resource if it exists * .why = allows cleanup or invalidation of artifacts during a weave */ del: () => Promise; } export declare class Artifact, TContent = string> extends DomainEntity> implements Artifact { }