proposit-core
    Preparing search index...

    Class ForkNamespace<T>

    A keyed collection of fork records for a single entity type. Each record maps a forked entity back to its origin via entityId → forkId. Records are schema-validated on mutation; invalid state throws InvariantViolationError.

    Type Parameters

    Index

    Constructors

    • Type Parameters

      • T extends {
            entityId: string;
            forkedFromArgumentId: string;
            forkedFromArgumentVersion: number;
            forkedFromEntityId: string;
            forkId: string;
        } = {
            entityId: string;
            forkedFromArgumentId: string;
            forkedFromArgumentVersion: number;
            forkedFromEntityId: string;
            forkId: string;
        }

      Parameters

      • schema: TSchema = CoreEntityForkRecordSchema

      Returns ForkNamespace<T>

    Methods

    • Returns the fork record for the given entity ID, or undefined.

      Parameters

      • entityId: string

      Returns T | undefined

    • Removes and returns the fork record for the given entity ID. Throws if not found.

      Parameters

      • entityId: string

      Returns T

    • Restores a namespace from a previously captured snapshot.

      Type Parameters

      • T extends {
            entityId: string;
            forkedFromArgumentId: string;
            forkedFromArgumentVersion: number;
            forkedFromEntityId: string;
            forkId: string;
        } = {
            entityId: string;
            forkedFromArgumentId: string;
            forkedFromArgumentVersion: number;
            forkedFromEntityId: string;
            forkId: string;
        }

      Parameters

      • records: T[]
      • Optionalschema: TSchema

      Returns ForkNamespace<T>