proposit-core
    Preparing search index...

    Interface TClaimLibraryManagement<TClaim>

    Full management interface for a versioned claim library. Extends TClaimLookup with mutation, query, and snapshot methods.

    interface TClaimLibraryManagement<TClaim extends TCoreClaim = TCoreClaim> {
        create(
            claim:
                | Omit<TClaim, "version" | "checksum" | "frozen">
                | Omit<TClaim, "version" | "checksum" | "id" | "frozen"> & {
                    id?: string;
                },
        ): TClaim;
        freeze(id: string): { current: TClaim; frozen: TClaim };
        get(id: string, version: number): TClaim | undefined;
        getAll(): TClaim[];
        getCurrent(id: string): TClaim | undefined;
        getVersions(id: string): TClaim[];
        snapshot(): TClaimLibrarySnapshot<TClaim>;
        update(
            id: string,
            updates: Partial<Omit<TClaim, "id" | "version" | "frozen" | "checksum">>,
        ): TClaim;
        validate(): TInvariantValidationResult;
    }

    Type Parameters

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Creates a new claim at version 0. The version, frozen, and checksum fields are assigned automatically. The id field is auto-generated when omitted. The type field is required and is immutable across the claim's lifetime.

      Parameters

      • claim:
            | Omit<TClaim, "version" | "checksum" | "frozen">
            | Omit<TClaim, "version" | "checksum" | "id" | "frozen"> & { id?: string }

        The claim data without system-managed fields. id is optional (auto-generated when omitted) and type is required.

      Returns TClaim

      The created claim entity with all fields populated.

      If a claim with the same ID already exists.

    • Freezes the current version of a claim (marking it immutable) and creates a new mutable version at version + 1.

      Parameters

      • id: string

        The claim ID.

      Returns { current: TClaim; frozen: TClaim }

      An object containing the frozen version and the new current (mutable) version.

      If the claim does not exist.

      If the current version is already frozen.

    • Updates mutable fields on the current (latest, unfrozen) version of a claim. System-managed fields (id, version, frozen, checksum) cannot be updated.

      Parameters

      • id: string

        The claim ID.

      • updates: Partial<Omit<TClaim, "id" | "version" | "frozen" | "checksum">>

        The fields to update.

      Returns TClaim

      The updated claim entity.

      If the claim does not exist.

      If the current version is frozen.