import type { BlobStore } from '../blob-store.js'; export type GitObjectType = 'commit' | 'tree' | 'blob' | 'tag'; export declare function sha1Hex(bytes: Uint8Array): Promise; export declare function hexToBytes(hex: string): Uint8Array; export declare function bytesToHex(b: Uint8Array): string; export declare function concat(...parts: Uint8Array[]): Uint8Array; /** The loose-object form: header + payload (what the sha is computed over). */ export declare function encodeLoose(type: GitObjectType, payload: Uint8Array): Uint8Array; export declare function decodeLoose(bytes: Uint8Array): { type: GitObjectType; payload: Uint8Array; }; export declare function hashObject(type: GitObjectType, payload: Uint8Array): Promise; export declare function deflateZlib(bytes: Uint8Array): Promise; /** zlib with stored (uncompressed) deflate blocks: what git writes at `core.compression 0`, and what every * inflater reads. A loose object is written on every commit a World makes; compressing each one through the * asynchronous CompressionStream made a write's cost the stream's round trips, not the object's size. */ export declare function storeZlib(bytes: Uint8Array): Uint8Array; /** The object store: one bare repo's objects under a key prefix in the blob seam. */ export declare class GitObjectStore { private readonly blobs; private readonly prefix; constructor(blobs: BlobStore, prefix: string); key(sha: string): string; has(sha: string): Promise; write(type: GitObjectType, payload: Uint8Array): Promise; read(sha: string): Promise<{ type: GitObjectType; payload: Uint8Array; } | null>; } export type TreeEntry = { mode: string; name: string; sha: string; }; /** git sorts tree entries by name, with a directory's name compared as if it ended in '/'. */ export declare function sortTreeEntries(entries: TreeEntry[]): TreeEntry[]; export declare function encodeTree(entries: TreeEntry[]): Uint8Array; export declare function decodeTree(payload: Uint8Array): TreeEntry[]; export type Ident = { name: string; email: string; time: number; tz: string; }; export type Commit = { tree: string; parents: string[]; author: Ident; committer: Ident; message: string; }; export declare function encodeCommit(c: Commit): Uint8Array; export declare function decodeCommit(payload: Uint8Array): Commit; export type Tag = { object: string; type: GitObjectType; tag: string; tagger?: Ident; message: string; }; export declare function encodeTag(t: Tag): Uint8Array; export declare function decodeTag(payload: Uint8Array): Tag;