/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { IGitBlob, IGitCommitDetails, IGitCreateBlobParams, IGitCreateBlobResponse, IGitCreateTreeParams, IGitTree, } from "@fluidframework/driver-definitions/internal"; import type { IWholeSummaryPayload, IWriteSummaryResponse, } from "@fluidframework/server-services-client"; import type { IWholeFlatSnapshot } from "./contracts.js"; import type { IR11sResponse } from "./restWrapper.js"; import type { IGitManager, IHistorian } from "./storageContracts.js"; export class GitManager implements IGitManager { constructor(private readonly historian: IHistorian) {} /** * Reads the object with the given ID. We defer to the client implementation to do the actual read. */ public async getCommits( sha: string, count: number, ): Promise> { return this.historian.getCommits(sha, count); } /** * Reads the object with the given ID. We defer to the client implementation to do the actual read. */ public async getTree(root: string, recursive = true): Promise> { return this.historian.getTree(root, recursive); } public async getBlob(sha: string): Promise> { return this.historian.getBlob(sha); } public async createBlob( content: string, encoding: "utf-8" | "base64", ): Promise> { const blob: IGitCreateBlobParams = { content, encoding, }; return this.historian.createBlob(blob); } public async createGitTree(params: IGitCreateTreeParams): Promise> { const treeP = this.historian.createTree(params); return treeP; } public async createSummary( summary: IWholeSummaryPayload, initial: boolean = false, ): Promise> { return this.historian.createSummary(summary, initial); } public async getSnapshot(sha: string): Promise> { return this.historian.getSnapshot(sha); } }