proposit-core
    Preparing search index...

    Function mergeChangesets

    • Merges two changesets into one, deduplicating entities by id within each bucket (added/modified/removed) with last-write-wins semantics.

      Use this for changesets that never change one entity in different ways. For the changesets of successive calls on one engine, where a later call can modify or remove what an earlier one added or modified, use composeChangesets: this function throws in that case.

      Type Parameters

      • TExpr extends TCorePropositionalExpression = TCorePropositionalExpression
      • TVar extends
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                claimId: string;
                claimVersion: number;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundPremiseId: string;
                checksum: string;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundAspect: "statement"
                | "inference";
                boundExpressionId: string;
                checksum: string;
                id: string;
                symbol: string;
            } =
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                claimId: string;
                claimVersion: number;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundPremiseId: string;
                checksum: string;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundAspect: "statement"
                | "inference";
                boundExpressionId: string;
                checksum: string;
                id: string;
                symbol: string;
            }
      • TPremise extends
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                combinedChecksum: string;
                descendantChecksum: string
                | null;
                id: string;
                type: "freeform";
            }
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                combinedChecksum: string;
                derivedClaimId: string;
                descendantChecksum: string
                | null;
                id: string;
                type: "derivation";
            } =
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                combinedChecksum: string;
                descendantChecksum: string
                | null;
                id: string;
                type: "freeform";
            }
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                combinedChecksum: string;
                derivedClaimId: string;
                descendantChecksum: string
                | null;
                id: string;
                type: "derivation";
            }
      • TArg extends {
            checksum: string;
            combinedChecksum: string;
            descendantChecksum: string | null;
            id: string;
            respondsTo?: { argumentId: string; argumentVersion: number };
            version: number;
        } = {
            checksum: string;
            combinedChecksum: string;
            descendantChecksum: string | null;
            id: string;
            respondsTo?: { argumentId: string; argumentVersion: number };
            version: number;
        }

      Parameters

      Returns TCoreChangeset<TExpr, TVar, TPremise, TArg>

      A merged changeset. Entity categories that are empty after merge are omitted from the result.

      If any entity ID appears in more than one bucket (added/modified/removed) within the same category after merge. This indicates a logic error in the caller.