UNPKG

@builder.io/dev-tools

Version:

Builder.io Visual CMS Devtools

82 lines (81 loc) 2.93 kB
import type { DevToolsSys } from "../types"; import type { Credentials } from "./credentials"; import { type GitBackupUploadUrlResult, type GitBackupUploadUrlOptions, type GitBackupRecordOptions, type GitBackupRecordResult, type BackupMetadata, type WorkspaceConfiguration, type CodegenSetLastCommit } from "$/ai-utils"; interface BackupGitRepoOptions { sys: DevToolsSys; credentials: Credentials; projectId: string; branchName: string; repoPath: string; aiBranch: string; featureBranch: string; workspace: WorkspaceConfiguration | undefined; debug: boolean; } export declare function backupGitRepo({ sys, credentials, projectId, branchName, repoPath, aiBranch, featureBranch, workspace, debug, }: BackupGitRepoOptions): Promise<{ success: boolean; empty: boolean; lastCommitHash: string; skipped?: undefined; reason?: undefined; filePath?: undefined; expiresAt?: undefined; bundleSize?: undefined; contentMd5?: undefined; } | { success: boolean; skipped: boolean; reason: string; empty?: undefined; lastCommitHash?: undefined; filePath?: undefined; expiresAt?: undefined; bundleSize?: undefined; contentMd5?: undefined; } | { success: boolean; filePath: string; expiresAt: string; bundleSize: number; contentMd5: string; lastCommitHash: string; empty?: undefined; skipped?: undefined; reason?: undefined; }>; /** * Requests a signed upload URL for git backup */ export declare function requestSignedUploadUrl(credentials: Credentials, body: GitBackupUploadUrlOptions): Promise<GitBackupUploadUrlResult | null>; /** * Records a successful git backup in Firebase */ export declare function recordBackup(credentials: Credentials, body: GitBackupRecordOptions): Promise<GitBackupRecordResult>; export interface GitBackupDownloadResultValid { success: true; partial: boolean; bundlePath: string | undefined; bundleSize: number; gitBranchName: string; lastCommitHash: string; } export interface GitBackupDownloadResultInvalid { success: false; error: Error; } export type GitBackupDownloadResult = GitBackupDownloadResultValid | GitBackupDownloadResultInvalid; /** * Downloads a git backup bundle * @returns The path to the downloaded bundle file, or null if no backup exists */ export declare function downloadGitBackup(sys: DevToolsSys, response: BackupMetadata): Promise<GitBackupDownloadResult>; /** * Uploads a file stream to a signed URL */ export declare function uploadFileStream(filePath: string, signedUrl: string, size: number, contentMd5: string): Promise<Response>; export declare function computeMD5Hash(bundlePath: string): Promise<{ contentMd5: string; size: number; }>; export declare function setLastCommit(sys: DevToolsSys, credentials: Credentials, data: CodegenSetLastCommit, verbose: boolean): Promise<any>; export {};