import { type CoValueCore } from "../exports.js"; import type { RawCoID, SessionID } from "../ids.js"; import { type AvailableCoValueCore } from "./coValueCore.js"; import type { CoValueHeader } from "./verifiedState.js"; import { KnownStateSessions } from "../knownState.js"; /** * Commit to identify the starting point of the branch * * In case of clonflicts, the first commit of this kind is considered the source of truth */ export type BranchStartCommit = { from: KnownStateSessions; }; /** * Commit that tracks a branch creation */ export type BranchPointerCommit = { branch: string; ownerId?: RawCoID; }; /** * Meta information attached to each merged transaction to retrieve the original transaction ID */ export type MergedTransactionMetadata = { mi: number; t?: number; s?: SessionID; b?: RawCoID; }; /** * Merge commit located in a branch to track how many transactions have already been merged */ export type MergeCommit = { merged: KnownStateSessions; branch: RawCoID; }; export declare function getBranchHeader({ type, branchName, ownerId, sourceId, }: { type: CoValueHeader["type"]; branchName: string; ownerId: RawCoID; sourceId: RawCoID; }): CoValueHeader; /** * Checks if the coValue can be branched */ export declare function canBeBranched(coValue: CoValueCore): boolean; /** * Given a coValue, a branch name and an owner id, returns the id for the branch */ export declare function getBranchId(coValue: CoValueCore, name: string, ownerId?: RawCoID): RawCoID; export declare function getBranchOwnerId(coValue: CoValueCore): `co_z${string}` | undefined; /** * Given a coValue, a branch name and an owner id, creates a new branch CoValue */ export declare function createBranch(coValue: CoValueCore, name: string, ownerId?: RawCoID): CoValueCore; /** * Given a branch coValue, returns the source coValue if available */ export declare function getBranchSource(coValue: CoValueCore): AvailableCoValueCore | undefined; /** * Given a branch coValue, merges the branch into the source coValue */ export declare function mergeBranch(branch: CoValueCore): CoValueCore; //# sourceMappingURL=branching.d.ts.map