proposit-core
    Preparing search index...

    Function composeChangesets

    • Combines two changesets made one after the other into the one changeset that describes both, entity by entity: added then modified stays added (with the later value), added then removed disappears, modified then removed becomes removed, removed then added becomes modified, and otherwise the later entry wins. roles and argument take the later value when it is present.

      Unlike mergeChangesets, which combines independent changesets and rejects an id in two buckets, this is for a sequence, where the same entity legitimately changes more than once.

      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;
        }

      Returns TCoreChangeset<TExpr, TVar, TPremise, TArg>

      const { changes: createChanges } = engine.createPremiseWithId(premiseId, data)
      const { changes: roleChanges } = engine.setConclusionPremise(premiseId)
      const combined = composeChangesets(createChanges, roleChanges)
      await persistChangeset(db, combined)