feat(typescript): export Branches from the public API

This commit is contained in:
Brendan Clement
2026-06-02 17:46:04 -07:00
parent c3c2887c02
commit a7a7350eb3
6 changed files with 164 additions and 6 deletions

View File

@@ -38,6 +38,7 @@ export {
FragmentSummaryStats,
Tags,
TagContents,
BranchContents,
MergeResult,
AddResult,
AddColumnsResult,
@@ -111,6 +112,7 @@ export {
export {
Table,
Branches,
AddDataOptions,
UpdateOptions,
OptimizeOptions,

View File

@@ -1260,15 +1260,19 @@ export interface FieldMetadataUpdate {
* to the branch; writes on it do not affect `main`.
*/
export class Branches {
private readonly inner: NativeBranches;
#inner: NativeBranches;
/**
* Construct a Branches manager. Internal use only.
* @hidden
*/
constructor(inner: NativeBranches) {
this.inner = inner;
this.#inner = inner;
}
/** List all branches, mapping name to branch metadata. */
async list(): Promise<Record<string, BranchContents>> {
return await this.inner.list();
return await this.#inner.list();
}
/**
@@ -1283,16 +1287,16 @@ export class Branches {
fromRef?: string,
fromVersion?: number,
): Promise<Table> {
return new LocalTable(await this.inner.create(name, fromRef, fromVersion));
return new LocalTable(await this.#inner.create(name, fromRef, fromVersion));
}
/** Check out an existing branch and return a handle scoped to it. */
async checkout(name: string): Promise<Table> {
return new LocalTable(await this.inner.checkout(name));
return new LocalTable(await this.#inner.checkout(name));
}
/** Delete a branch. */
async delete(name: string): Promise<void> {
return await this.inner.delete(name);
return await this.#inner.delete(name);
}
}