import { z } from 'zod'; declare const listFilesResponseSchema: z.ZodObject<{ paths: z.ZodArray; ref: z.ZodString; }, "strip", z.ZodTypeAny, { ref: string; paths: string[]; }, { ref: string; paths: string[]; }>; declare const fileWithMetadataRawSchema: z.ZodObject<{ path: z.ZodString; mode: z.ZodString; size: z.ZodNumber; last_commit_sha: z.ZodString; }, "strip", z.ZodTypeAny, { path: string; mode: string; size: number; last_commit_sha: string; }, { path: string; mode: string; size: number; last_commit_sha: string; }>; declare const commitMetadataRawSchema: z.ZodObject<{ author: z.ZodString; date: z.ZodString; message: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; date: string; author: string; }, { message: string; date: string; author: string; }>; declare const listFilesWithMetadataResponseSchema: z.ZodObject<{ files: z.ZodArray, "many">; commits: z.ZodRecord>; ref: z.ZodString; }, "strip", z.ZodTypeAny, { commits: Record; files: { path: string; mode: string; size: number; last_commit_sha: string; }[]; ref: string; }, { commits: Record; files: { path: string; mode: string; size: number; last_commit_sha: string; }[]; ref: string; }>; declare const branchInfoSchema: z.ZodObject<{ cursor: z.ZodString; name: z.ZodString; head_sha: z.ZodString; created_at: z.ZodString; }, "strip", z.ZodTypeAny, { cursor: string; name: string; head_sha: string; created_at: string; }, { cursor: string; name: string; head_sha: string; created_at: string; }>; declare const listBranchesResponseSchema: z.ZodObject<{ branches: z.ZodArray, "many">; next_cursor: z.ZodOptional>; has_more: z.ZodBoolean; }, "strip", z.ZodTypeAny, { branches: { cursor: string; name: string; head_sha: string; created_at: string; }[]; has_more: boolean; next_cursor?: string | null | undefined; }, { branches: { cursor: string; name: string; head_sha: string; created_at: string; }[]; has_more: boolean; next_cursor?: string | null | undefined; }>; declare const commitInfoRawSchema: z.ZodObject<{ sha: z.ZodString; message: z.ZodString; author_name: z.ZodString; author_email: z.ZodString; committer_name: z.ZodString; committer_email: z.ZodString; date: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; date: string; sha: string; author_name: string; author_email: string; committer_name: string; committer_email: string; }, { message: string; date: string; sha: string; author_name: string; author_email: string; committer_name: string; committer_email: string; }>; declare const listCommitsResponseSchema: z.ZodObject<{ commits: z.ZodArray, "many">; next_cursor: z.ZodOptional>; has_more: z.ZodBoolean; }, "strip", z.ZodTypeAny, { has_more: boolean; commits: { message: string; date: string; sha: string; author_name: string; author_email: string; committer_name: string; committer_email: string; }[]; next_cursor?: string | null | undefined; }, { has_more: boolean; commits: { message: string; date: string; sha: string; author_name: string; author_email: string; committer_name: string; committer_email: string; }[]; next_cursor?: string | null | undefined; }>; declare const repoBaseInfoSchema: z.ZodObject<{ provider: z.ZodString; owner: z.ZodString; name: z.ZodString; }, "strip", z.ZodTypeAny, { name: string; provider: string; owner: string; }, { name: string; provider: string; owner: string; }>; declare const repoInfoSchema: z.ZodObject<{ repo_id: z.ZodString; url: z.ZodString; default_branch: z.ZodString; created_at: z.ZodString; base_repo: z.ZodNullable>>; }, "strip", z.ZodTypeAny, { created_at: string; repo_id: string; url: string; default_branch: string; base_repo?: { name: string; provider: string; owner: string; } | null | undefined; }, { created_at: string; repo_id: string; url: string; default_branch: string; base_repo?: { name: string; provider: string; owner: string; } | null | undefined; }>; declare const listReposResponseSchema: z.ZodObject<{ repos: z.ZodArray>>; }, "strip", z.ZodTypeAny, { created_at: string; repo_id: string; url: string; default_branch: string; base_repo?: { name: string; provider: string; owner: string; } | null | undefined; }, { created_at: string; repo_id: string; url: string; default_branch: string; base_repo?: { name: string; provider: string; owner: string; } | null | undefined; }>, "many">; next_cursor: z.ZodOptional>; has_more: z.ZodBoolean; }, "strip", z.ZodTypeAny, { has_more: boolean; repos: { created_at: string; repo_id: string; url: string; default_branch: string; base_repo?: { name: string; provider: string; owner: string; } | null | undefined; }[]; next_cursor?: string | null | undefined; }, { has_more: boolean; repos: { created_at: string; repo_id: string; url: string; default_branch: string; base_repo?: { name: string; provider: string; owner: string; } | null | undefined; }[]; next_cursor?: string | null | undefined; }>; declare const noteReadResponseSchema: z.ZodObject<{ sha: z.ZodString; note: z.ZodString; ref_sha: z.ZodString; }, "strip", z.ZodTypeAny, { sha: string; note: string; ref_sha: string; }, { sha: string; note: string; ref_sha: string; }>; declare const noteWriteResponseSchema: z.ZodObject<{ sha: z.ZodString; target_ref: z.ZodString; base_commit: z.ZodOptional; new_ref_sha: z.ZodString; result: z.ZodObject<{ success: z.ZodBoolean; status: z.ZodString; message: z.ZodOptional; }, "strip", z.ZodTypeAny, { status: string; success: boolean; message?: string | undefined; }, { status: string; success: boolean; message?: string | undefined; }>; }, "strip", z.ZodTypeAny, { result: { status: string; success: boolean; message?: string | undefined; }; sha: string; target_ref: string; new_ref_sha: string; base_commit?: string | undefined; }, { result: { status: string; success: boolean; message?: string | undefined; }; sha: string; target_ref: string; new_ref_sha: string; base_commit?: string | undefined; }>; declare const diffFileRawSchema: z.ZodObject<{ path: z.ZodString; state: z.ZodString; old_path: z.ZodOptional>; raw: z.ZodString; bytes: z.ZodNumber; is_eof: z.ZodBoolean; additions: z.ZodOptional; deletions: z.ZodOptional; }, "strip", z.ZodTypeAny, { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }, { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }>; declare const filteredFileRawSchema: z.ZodObject<{ path: z.ZodString; state: z.ZodString; old_path: z.ZodOptional>; bytes: z.ZodNumber; is_eof: z.ZodBoolean; }, "strip", z.ZodTypeAny, { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }, { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }>; declare const branchDiffResponseSchema: z.ZodObject<{ branch: z.ZodString; base: z.ZodString; stats: z.ZodObject<{ files: z.ZodNumber; additions: z.ZodNumber; deletions: z.ZodNumber; changes: z.ZodNumber; }, "strip", z.ZodTypeAny, { files: number; additions: number; deletions: number; changes: number; }, { files: number; additions: number; deletions: number; changes: number; }>; files: z.ZodArray>; raw: z.ZodString; bytes: z.ZodNumber; is_eof: z.ZodBoolean; additions: z.ZodOptional; deletions: z.ZodOptional; }, "strip", z.ZodTypeAny, { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }, { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }>, "many">; filtered_files: z.ZodArray>; bytes: z.ZodNumber; is_eof: z.ZodBoolean; }, "strip", z.ZodTypeAny, { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }, { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { branch: string; files: { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }[]; base: string; stats: { files: number; additions: number; deletions: number; changes: number; }; filtered_files: { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }[]; }, { branch: string; files: { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }[]; base: string; stats: { files: number; additions: number; deletions: number; changes: number; }; filtered_files: { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }[]; }>; declare const commitDiffResponseSchema: z.ZodObject<{ sha: z.ZodString; stats: z.ZodObject<{ files: z.ZodNumber; additions: z.ZodNumber; deletions: z.ZodNumber; changes: z.ZodNumber; }, "strip", z.ZodTypeAny, { files: number; additions: number; deletions: number; changes: number; }, { files: number; additions: number; deletions: number; changes: number; }>; files: z.ZodArray>; raw: z.ZodString; bytes: z.ZodNumber; is_eof: z.ZodBoolean; additions: z.ZodOptional; deletions: z.ZodOptional; }, "strip", z.ZodTypeAny, { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }, { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }>, "many">; filtered_files: z.ZodArray>; bytes: z.ZodNumber; is_eof: z.ZodBoolean; }, "strip", z.ZodTypeAny, { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }, { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { sha: string; files: { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }[]; stats: { files: number; additions: number; deletions: number; changes: number; }; filtered_files: { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }[]; }, { sha: string; files: { path: string; state: string; raw: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; additions?: number | undefined; deletions?: number | undefined; }[]; stats: { files: number; additions: number; deletions: number; changes: number; }; filtered_files: { path: string; state: string; bytes: number; is_eof: boolean; old_path?: string | null | undefined; }[]; }>; declare const createBranchResponseSchema: z.ZodObject<{ message: z.ZodString; target_branch: z.ZodString; target_is_ephemeral: z.ZodBoolean; commit_sha: z.ZodOptional>; }, "strip", z.ZodTypeAny, { target_branch: string; message: string; target_is_ephemeral: boolean; commit_sha?: string | null | undefined; }, { target_branch: string; message: string; target_is_ephemeral: boolean; commit_sha?: string | null | undefined; }>; type ListFilesResponseRaw = z.infer; type RawFileWithMetadata$1 = z.infer; type RawCommitMetadata$1 = z.infer; type ListFilesWithMetadataResponseRaw = z.infer; type RawBranchInfo$1 = z.infer; type ListBranchesResponseRaw = z.infer; type RawCommitInfo$1 = z.infer; type ListCommitsResponseRaw = z.infer; type RawRepoBaseInfo$1 = z.infer; type RawRepoInfo$1 = z.infer; type ListReposResponseRaw = z.infer; type NoteReadResponseRaw = z.infer; type NoteWriteResponseRaw = z.infer; type RawFileDiff$1 = z.infer; type RawFilteredFile$1 = z.infer; type GetBranchDiffResponseRaw = z.infer; type GetCommitDiffResponseRaw = z.infer; type CreateBranchResponseRaw = z.infer; /** * Type definitions for Pierre Git Storage SDK */ interface OverrideableGitStorageOptions { apiBaseUrl?: string; storageBaseUrl?: string; apiVersion?: ValidAPIVersion; defaultTTL?: number; } interface GitStorageOptions extends OverrideableGitStorageOptions { key: string; name: string; defaultTTL?: number; } type ValidAPIVersion = 1; interface GetRemoteURLOptions { permissions?: ('git:write' | 'git:read' | 'repo:write' | 'org:read')[]; ttl?: number; } interface Repo { id: string; defaultBranch: string; createdAt: string; getRemoteURL(options?: GetRemoteURLOptions): Promise; getEphemeralRemoteURL(options?: GetRemoteURLOptions): Promise; getImportRemoteURL(options?: GetRemoteURLOptions): Promise; getFileStream(options: GetFileOptions): Promise; getArchiveStream(options?: ArchiveOptions): Promise; listFiles(options?: ListFilesOptions): Promise; listFilesWithMetadata(options?: ListFilesWithMetadataOptions): Promise; listBranches(options?: ListBranchesOptions): Promise; listCommits(options?: ListCommitsOptions): Promise; getNote(options: GetNoteOptions): Promise; createNote(options: CreateNoteOptions): Promise; appendNote(options: AppendNoteOptions): Promise; deleteNote(options: DeleteNoteOptions): Promise; getBranchDiff(options: GetBranchDiffOptions): Promise; getCommitDiff(options: GetCommitDiffOptions): Promise; grep(options: GrepOptions): Promise; pullUpstream(options?: PullUpstreamOptions): Promise; restoreCommit(options: RestoreCommitOptions): Promise; createBranch(options: CreateBranchOptions): Promise; createCommit(options: CreateCommitOptions): CommitBuilder; createCommitFromDiff(options: CreateCommitFromDiffOptions): Promise; } type ValidMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'; type SimplePath = string; type ComplexPath = { path: string; params?: Record; body?: Record; }; type ValidPath = SimplePath | ComplexPath; interface GitStorageInvocationOptions { ttl?: number; } interface FindOneOptions { id: string; } interface RepoOptions { id: string; defaultBranch?: string; createdAt?: string; } type SupportedRepoProvider = 'github' | 'gitlab' | 'bitbucket' | 'gitea' | 'forgejo' | 'codeberg' | 'sr.ht'; interface PublicGitHubBaseRepoAuth { /** * Force public GitHub mode (no GitHub App installation required). */ authType: 'public'; } interface GitHubBaseRepo { /** * @default github */ provider?: 'github'; owner: string; name: string; defaultBranch?: string; auth?: PublicGitHubBaseRepoAuth; } interface GenericGitBaseRepo { /** * The git host provider. Must be one of the supported generic git providers. */ provider: Exclude; owner: string; name: string; defaultBranch?: string; /** * Bare hostname for self-hosted instances (e.g. "gitlab.example.com"). * Falls back to the provider's default host when omitted. */ upstreamHost?: string; } interface ForkBaseRepo { id: string; ref?: string; sha?: string; } type BaseRepo = GitHubBaseRepo | ForkBaseRepo | GenericGitBaseRepo; interface CreateGitCredentialOptions { repoId: string; username?: string; password: string; ttl?: number; } interface UpdateGitCredentialOptions { id: string; username?: string; password: string; ttl?: number; } interface DeleteGitCredentialOptions { id: string; ttl?: number; } interface GitCredential { id: string; createdAt?: string; } interface ListReposOptions extends GitStorageInvocationOptions { cursor?: string; limit?: number; } type RawRepoBaseInfo = RawRepoBaseInfo$1; interface RepoBaseInfo { provider: string; owner: string; name: string; } type RawRepoInfo = RawRepoInfo$1; interface RepoInfo { repoId: string; url: string; defaultBranch: string; createdAt: string; baseRepo?: RepoBaseInfo; } type ListReposResponse = ListReposResponseRaw; interface ListReposResult { repos: RepoInfo[]; nextCursor?: string; hasMore: boolean; } interface CreateRepoOptions extends GitStorageInvocationOptions { id?: string; baseRepo?: BaseRepo; defaultBranch?: string; } interface DeleteRepoOptions extends GitStorageInvocationOptions { id: string; } interface DeleteRepoResult { repoId: string; message: string; } interface GetFileOptions extends GitStorageInvocationOptions { path: string; ref?: string; ephemeral?: boolean; ephemeralBase?: boolean; } interface ArchiveOptions extends GitStorageInvocationOptions { ref?: string; includeGlobs?: string[]; excludeGlobs?: string[]; maxBlobSize?: number; archivePrefix?: string; } interface PullUpstreamOptions extends GitStorageInvocationOptions { ref?: string; } interface ListFilesOptions extends GitStorageInvocationOptions { ref?: string; ephemeral?: boolean; } type ListFilesResponse = ListFilesResponseRaw; interface ListFilesResult { paths: string[]; ref: string; } interface ListFilesWithMetadataOptions extends GitStorageInvocationOptions { ref?: string; ephemeral?: boolean; } type RawFileWithMetadata = RawFileWithMetadata$1; interface FileWithMetadata { path: string; mode: string; size: number; lastCommitSha: string; } type RawCommitMetadata = RawCommitMetadata$1; interface CommitMetadata { author: string; date: Date; rawDate: string; message: string; } type ListFilesWithMetadataResponse = ListFilesWithMetadataResponseRaw; interface ListFilesWithMetadataResult { files: FileWithMetadata[]; commits: Record; ref: string; } interface ListBranchesOptions extends GitStorageInvocationOptions { cursor?: string; limit?: number; } type RawBranchInfo = RawBranchInfo$1; interface BranchInfo { cursor: string; name: string; headSha: string; createdAt: string; } type ListBranchesResponse = ListBranchesResponseRaw; interface ListBranchesResult { branches: BranchInfo[]; nextCursor?: string; hasMore: boolean; } interface CreateBranchOptions extends GitStorageInvocationOptions { baseBranch: string; targetBranch: string; baseIsEphemeral?: boolean; targetIsEphemeral?: boolean; } type CreateBranchResponse = CreateBranchResponseRaw; interface CreateBranchResult { message: string; targetBranch: string; targetIsEphemeral: boolean; commitSha?: string; } interface ListCommitsOptions extends GitStorageInvocationOptions { branch?: string; cursor?: string; limit?: number; } type RawCommitInfo = RawCommitInfo$1; interface CommitInfo { sha: string; message: string; authorName: string; authorEmail: string; committerName: string; committerEmail: string; date: Date; rawDate: string; } type ListCommitsResponse = ListCommitsResponseRaw; interface ListCommitsResult { commits: CommitInfo[]; nextCursor?: string; hasMore: boolean; } interface GetNoteOptions extends GitStorageInvocationOptions { sha: string; } type GetNoteResponse = NoteReadResponseRaw; interface GetNoteResult { sha: string; note: string; refSha: string; } interface NoteWriteBaseOptions extends GitStorageInvocationOptions { sha: string; note: string; expectedRefSha?: string; author?: CommitSignature; } type CreateNoteOptions = NoteWriteBaseOptions; type AppendNoteOptions = NoteWriteBaseOptions; interface DeleteNoteOptions extends GitStorageInvocationOptions { sha: string; expectedRefSha?: string; author?: CommitSignature; } interface NoteWriteResultPayload { success: boolean; status: string; message?: string; } type NoteWriteResponse = NoteWriteResponseRaw; interface NoteWriteResult { sha: string; targetRef: string; baseCommit?: string; newRefSha: string; result: NoteWriteResultPayload; } interface GetBranchDiffOptions extends GitStorageInvocationOptions { branch: string; base?: string; ephemeral?: boolean; ephemeralBase?: boolean; /** Optional paths to filter the diff to specific files */ paths?: string[]; } type GetBranchDiffResponse = GetBranchDiffResponseRaw; interface GetBranchDiffResult { branch: string; base: string; stats: DiffStats; files: FileDiff[]; filteredFiles: FilteredFile[]; } interface GetCommitDiffOptions extends GitStorageInvocationOptions { sha: string; baseSha?: string; /** Optional paths to filter the diff to specific files */ paths?: string[]; } type GetCommitDiffResponse = GetCommitDiffResponseRaw; interface GetCommitDiffResult { sha: string; stats: DiffStats; files: FileDiff[]; filteredFiles: FilteredFile[]; } interface GrepOptions extends GitStorageInvocationOptions { ref?: string; /** * @deprecated Use ref instead. */ rev?: string; paths?: string[]; query: { pattern: string; /** * Default is case-sensitive. * When omitted, the server default is used. */ caseSensitive?: boolean; }; fileFilters?: { includeGlobs?: string[]; excludeGlobs?: string[]; extensionFilters?: string[]; }; context?: { before?: number; after?: number; }; limits?: { maxLines?: number; maxMatchesPerFile?: number; }; pagination?: { cursor?: string; limit?: number; }; } interface GrepLine { lineNumber: number; text: string; type: string; } interface GrepFileMatch { path: string; lines: GrepLine[]; } interface GrepResult { query: { pattern: string; caseSensitive: boolean; }; repo: { ref: string; commit: string; }; matches: GrepFileMatch[]; nextCursor?: string; hasMore: boolean; } interface DiffStats { files: number; additions: number; deletions: number; changes: number; } type RawFileDiff = RawFileDiff$1; type RawFilteredFile = RawFilteredFile$1; type DiffFileState = 'added' | 'modified' | 'deleted' | 'renamed' | 'copied' | 'type_changed' | 'unmerged' | 'unknown'; interface DiffFileBase { path: string; state: DiffFileState; rawState: string; oldPath?: string; bytes: number; isEof: boolean; } interface FileDiff extends DiffFileBase { raw: string; additions: number; deletions: number; } interface FilteredFile extends DiffFileBase { } interface CreateCommitBaseOptions extends GitStorageInvocationOptions { commitMessage: string; expectedHeadSha?: string; baseBranch?: string; ephemeral?: boolean; ephemeralBase?: boolean; author: CommitSignature; committer?: CommitSignature; signal?: AbortSignal; } interface CreateCommitBranchOptions extends CreateCommitBaseOptions { targetBranch: string; targetRef?: never; } /** * @deprecated Use {@link CreateCommitBranchOptions} instead. */ interface LegacyCreateCommitOptions extends CreateCommitBaseOptions { targetBranch?: never; targetRef: string; } type CreateCommitOptions = CreateCommitBranchOptions | LegacyCreateCommitOptions; interface CommitSignature { name: string; email: string; } interface ReadableStreamReaderLike { read(): Promise<{ value?: T; done: boolean; }>; releaseLock?(): void; } interface ReadableStreamLike { getReader(): ReadableStreamReaderLike; } interface BlobLike { stream(): unknown; } interface FileLike extends BlobLike { name: string; lastModified?: number; } type GitFileMode = '100644' | '100755' | '120000' | '160000'; type TextEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'utf-16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex'; type CommitFileSource = string | Uint8Array | ArrayBuffer | BlobLike | FileLike | ReadableStreamLike | AsyncIterable | Iterable; interface CommitFileOptions { mode?: GitFileMode; } interface CommitTextFileOptions extends CommitFileOptions { encoding?: TextEncoding; } interface CommitBuilder { addFile(path: string, source: CommitFileSource, options?: CommitFileOptions): CommitBuilder; addFileFromString(path: string, contents: string, options?: CommitTextFileOptions): CommitBuilder; deletePath(path: string): CommitBuilder; send(): Promise; } type DiffSource = CommitFileSource; interface CreateCommitFromDiffOptions extends GitStorageInvocationOptions { targetBranch: string; commitMessage: string; diff: DiffSource; expectedHeadSha?: string; baseBranch?: string; ephemeral?: boolean; ephemeralBase?: boolean; author: CommitSignature; committer?: CommitSignature; signal?: AbortSignal; } interface RefUpdate { branch: string; oldSha: string; newSha: string; } type RefUpdateReason = 'precondition_failed' | 'conflict' | 'not_found' | 'invalid' | 'timeout' | 'unauthorized' | 'forbidden' | 'unavailable' | 'internal' | 'failed' | 'unknown'; interface CommitResult { commitSha: string; treeSha: string; targetBranch: string; packBytes: number; blobCount: number; refUpdate: RefUpdate; } interface RestoreCommitOptions extends GitStorageInvocationOptions { targetBranch: string; targetCommitSha: string; commitMessage?: string; expectedHeadSha?: string; author: CommitSignature; committer?: CommitSignature; } interface RestoreCommitResult { commitSha: string; treeSha: string; targetBranch: string; packBytes: number; refUpdate: RefUpdate; } interface WebhookValidationOptions { /** * Maximum age of webhook in seconds (default: 300 seconds / 5 minutes) * Set to 0 to disable timestamp validation */ maxAgeSeconds?: number; } interface WebhookValidationResult { /** * Whether the webhook signature and timestamp are valid */ valid: boolean; /** * Error message if validation failed */ error?: string; /** * The parsed webhook event type (e.g., "push") */ eventType?: string; /** * The timestamp from the signature (Unix seconds) */ timestamp?: number; } interface RawWebhookPushEvent { repository: { id: string; url: string; }; ref: string; before: string; after: string; customer_id: string; pushed_at: string; } interface WebhookPushEvent { type: 'push'; repository: { id: string; url: string; }; ref: string; before: string; after: string; customerId: string; pushedAt: Date; rawPushedAt: string; } interface WebhookUnknownEvent { type: string; raw: unknown; } type WebhookEventPayload = WebhookPushEvent | WebhookUnknownEvent; interface ParsedWebhookSignature { timestamp: string; signature: string; } interface RefUpdateErrorOptions { status: string; message?: string; refUpdate?: Partial; reason?: RefUpdateReason; } declare class RefUpdateError extends Error { readonly status: string; readonly reason: RefUpdateReason; readonly refUpdate?: Partial; constructor(message: string, options: RefUpdateErrorOptions); } declare class ApiError extends Error { readonly status: number; readonly statusText: string; readonly method: ValidMethod; readonly url: string; readonly body?: unknown; constructor(params: { message: string; status: number; statusText: string; method: ValidMethod; url: string; body?: unknown; }); } /** * Webhook validation utilities for Pierre Git Storage */ /** * Parse the X-Pierre-Signature header * Format: t=,sha256= */ declare function parseSignatureHeader(header: string): ParsedWebhookSignature | null; /** * Validate a webhook signature and timestamp * * @param payload - The raw webhook payload (request body) * @param signatureHeader - The X-Pierre-Signature header value * @param secret - The webhook secret for HMAC verification * @param options - Validation options * @returns Validation result with details * * @example * ```typescript * const result = await validateWebhookSignature( * requestBody, * request.headers['x-pierre-signature'], * webhookSecret * ); * * if (!result.valid) { * console.error('Invalid webhook:', result.error); * return; * } * ``` */ declare function validateWebhookSignature(payload: string | Buffer, signatureHeader: string, secret: string, options?: WebhookValidationOptions): Promise; /** * Validate a webhook request * * This is a convenience function that validates the signature and parses the payload. * * @param payload - The raw webhook payload (request body) * @param headers - The request headers (must include x-pierre-signature and x-pierre-event) * @param secret - The webhook secret for HMAC verification * @param options - Validation options * @returns The parsed webhook payload if valid, or validation error * * @example * ```typescript * const result = await validateWebhook( * request.body, * request.headers, * process.env.WEBHOOK_SECRET * ); * * if (!result.valid) { * return new Response('Invalid webhook', { status: 401 }); * } * * // Type-safe access to the webhook payload * console.log('Push event:', result.payload); * ``` */ declare function validateWebhook(payload: string | Buffer, headers: Record, secret: string, options?: WebhookValidationOptions): Promise; declare class GitStorage { private options; private api; constructor(options: GitStorageOptions); static getDefaultAPIBaseUrl(name: string): string; static getDefaultStorageBaseUrl(name: string): string; /** * Create a new repository * @returns The created repository */ createRepo(options?: CreateRepoOptions): Promise; /** * List repositories for the authenticated organization * @returns Paginated repositories list */ listRepos(options?: ListReposOptions): Promise; /** * Find a repository by ID * @param options The search options * @returns The found repository */ findOne(options: FindOneOptions): Promise; /** * Create a Repo handle from known metadata without making an HTTP request. */ repo(options: RepoOptions): Repo; /** * Delete a repository by ID * @param options The delete options containing the repo ID * @returns The deletion result */ deleteRepo(options: DeleteRepoOptions): Promise; /** * Create a generic git credential for a repository. * Used to authenticate sync operations for non-GitHub providers (GitLab, Bitbucket, etc.) */ createGitCredential(options: CreateGitCredentialOptions): Promise; /** * Update an existing generic git credential. */ updateGitCredential(options: UpdateGitCredentialOptions): Promise; /** * Delete a generic git credential. */ deleteGitCredential(options: DeleteGitCredentialOptions): Promise; /** * Get the current configuration * @returns The client configuration */ getConfig(): GitStorageOptions; /** * Generate a JWT token for git storage URL authentication * @private */ private generateJWT; } declare function createClient(options: GitStorageOptions): GitStorage; type StorageOptions = GitStorageOptions; export { ApiError, type AppendNoteOptions, type ArchiveOptions, type BaseRepo, type BlobLike, type BranchInfo, GitStorage as CodeStorage, type CommitBuilder, type CommitFileOptions, type CommitFileSource, type CommitInfo, type CommitMetadata, type CommitResult, type CommitSignature, type CommitTextFileOptions, type CreateBranchOptions, type CreateBranchResponse, type CreateBranchResult, type CreateCommitBranchOptions, type CreateCommitFromDiffOptions, type CreateCommitOptions, type CreateGitCredentialOptions, type CreateNoteOptions, type CreateRepoOptions, type DeleteGitCredentialOptions, type DeleteNoteOptions, type DeleteRepoOptions, type DeleteRepoResult, type DiffFileBase, type DiffFileState, type DiffSource, type DiffStats, type FileDiff, type FileLike, type FileWithMetadata, type FilteredFile, type FindOneOptions, type ForkBaseRepo, type GenericGitBaseRepo, type GetBranchDiffOptions, type GetBranchDiffResponse, type GetBranchDiffResult, type GetCommitDiffOptions, type GetCommitDiffResponse, type GetCommitDiffResult, type GetFileOptions, type GetNoteOptions, type GetNoteResponse, type GetNoteResult, type GetRemoteURLOptions, type GitCredential, type GitFileMode, type GitHubBaseRepo, GitStorage, type GitStorageOptions, type GrepFileMatch, type GrepLine, type GrepOptions, type GrepResult, type LegacyCreateCommitOptions, type ListBranchesOptions, type ListBranchesResponse, type ListBranchesResult, type ListCommitsOptions, type ListCommitsResponse, type ListCommitsResult, type ListFilesOptions, type ListFilesResponse, type ListFilesResult, type ListFilesWithMetadataOptions, type ListFilesWithMetadataResponse, type ListFilesWithMetadataResult, type ListReposOptions, type ListReposResponse, type ListReposResult, type NoteWriteResponse, type NoteWriteResult, type NoteWriteResultPayload, type OverrideableGitStorageOptions, type ParsedWebhookSignature, type PublicGitHubBaseRepoAuth, type PullUpstreamOptions, type RawBranchInfo, type RawCommitInfo, type RawCommitMetadata, type RawFileDiff, type RawFileWithMetadata, type RawFilteredFile, type RawRepoBaseInfo, type RawRepoInfo, type RawWebhookPushEvent, type ReadableStreamLike, type ReadableStreamReaderLike, type RefUpdate, RefUpdateError, type RefUpdateReason, type Repo, type RepoBaseInfo, type RepoInfo, type RepoOptions, type RestoreCommitOptions, type RestoreCommitResult, type StorageOptions, type SupportedRepoProvider, type TextEncoding, type UpdateGitCredentialOptions, type ValidAPIVersion, type ValidMethod, type ValidPath, type WebhookEventPayload, type WebhookPushEvent, type WebhookUnknownEvent, type WebhookValidationOptions, type WebhookValidationResult, createClient, parseSignatureHeader, validateWebhook, validateWebhookSignature };