proposit-core
    Preparing search index...

    Class OriginLibrary<TDocument, TLink, TAnchor>

    Holds the source texts arguments were built from, their per-version associations, and the spans of those texts individual argument parts derive from.

    Documents are immutable: there is no update path, because every anchor is an offset into a document's exact text. Correcting a source means replacing the document, which invalidates its anchors by design.

    The text is opaque content. This class digests it, measures it, and slices it by index; it never parses, renders, or interprets it.

    An anchor is only meaningful alongside a link: the link carries the stance. validate() therefore requires every anchor's (argumentId, argumentVersion, documentId) to have a matching link, which fixes the persistence order for consumers — document, then link, then anchors — and makes removing a link that still has anchors a violation.

    Like the claim-connection libraries, this one mints no identifiers — callers supply them — and takes no argument lookup: an argument library is constructed after this one, so cross-checking argument existence here would invert the dependency order. What it does enforce is everything decidable from its own contents, most importantly that an anchor's span slices out the anchor's own quote.

    Type Parameters

    Implements

    Index

    Constructors

    • Type Parameters

      • TDocument extends {
            checksum: string;
            digest: string;
            id: string;
            segments?: {
                endCodePoint: number;
                segmentId: string;
                startCodePoint: number;
            }[];
            text: string;
        } = {
            checksum: string;
            digest: string;
            id: string;
            segments?: {
                endCodePoint: number;
                segmentId: string;
                startCodePoint: number;
            }[];
            text: string;
        }
      • TLink extends {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            id: string;
            stance: "representation" | "seed";
        } = {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            id: string;
            stance: "representation" | "seed";
        }
      • TAnchor extends {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            endCodePoint: number;
            exact: string;
            id: string;
            prefix?: string;
            startCodePoint: number;
            suffix?: string;
            targetId: string;
            targetType: "expression" | "premise" | "argument";
        } = {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            endCodePoint: number;
            exact: string;
            id: string;
            prefix?: string;
            startCodePoint: number;
            suffix?: string;
            targetId: string;
            targetType: "expression" | "premise" | "argument";
        }

      Parameters

      Returns OriginLibrary<TDocument, TLink, TAnchor>

    Methods

    • Restores an origin library from a snapshot, rebuilding its indexes.

      Type Parameters

      • TDocument extends {
            checksum: string;
            digest: string;
            id: string;
            segments?: {
                endCodePoint: number;
                segmentId: string;
                startCodePoint: number;
            }[];
            text: string;
        } = {
            checksum: string;
            digest: string;
            id: string;
            segments?: {
                endCodePoint: number;
                segmentId: string;
                startCodePoint: number;
            }[];
            text: string;
        }
      • TLink extends {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            id: string;
            stance: "representation" | "seed";
        } = {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            id: string;
            stance: "representation" | "seed";
        }
      • TAnchor extends {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            endCodePoint: number;
            exact: string;
            id: string;
            prefix?: string;
            startCodePoint: number;
            suffix?: string;
            targetId: string;
            targetType: "expression" | "premise" | "argument";
        } = {
            argumentId: string;
            argumentVersion: number;
            checksum: string;
            documentId: string;
            endCodePoint: number;
            exact: string;
            id: string;
            prefix?: string;
            startCodePoint: number;
            suffix?: string;
            targetId: string;
            targetType: "expression" | "premise" | "argument";
        }

      Parameters

      Returns OriginLibrary<TDocument, TLink, TAnchor>