import { Readable } from "node:stream"; import { type Firestore } from "firebase-admin/firestore"; import type { CatalogId } from "@x12i/catalox-contracts/ids.js"; import type { BackupDataInput, BackupDataResult } from "@x12i/catalox-contracts/backup.js"; import type { PruneGcsBackupRunsInput, PruneGcsBackupRunsResult } from "@x12i/catalox-contracts/restore.js"; import type { CatalogRecord } from "@x12i/catalox-contracts/catalogs.js"; import { CatalogStore } from "../firebase/catalog-store.js"; import { BindingStore } from "../firebase/binding-store.js"; import { FirestoreStore } from "../firebase/firestore-store.js"; export declare const BACKUP_METADATA_SOURCE_NAMES: readonly ["apps", "catalogs", "catalogBindings", "storeAppBindings", "catalogDefinitions", "catalogDescriptors", "catalogMappings", "catalogAdapters", "catalogReferences", "catalogData"]; export type BackupDataDeps = { firestoreStore: FirestoreStore; catalogs: CatalogStore; bindings: BindingStore; }; export declare function formatBackupTimestamp(versionOverride?: string, d?: Date): string; /** Latest Firebase backup mirror collection id for a logical source (e.g. `apps`, `catalogData--{id}`). */ export declare function firebaseLatestName(logical: string): string; /** Versioned Firebase backup collection id. */ export declare function firebaseVersionedName(ts: string, logical: string): string; export declare function firebaseNativeLogical(catalogId: string): string; export declare function firebaseSnapshotLogical(catalogId: string): string; export declare function firebaseSnapshotRunLogical(catalogId: string, runId: string): string; export declare function paginatedCopyFirestoreToFirestore(fs: Firestore, sourceCollectionPath: string, destCollectionPath: string, counts: Record, countKey: string): Promise; export declare function deleteAllDocsInFirestoreCollection(fs: Firestore, collectionPath: string): Promise; export declare function discoverNativeCatalogIds(fs: Firestore, catalogs: CatalogRecord[], opts: { bindings: BindingStore; catalogIds?: CatalogId[]; appId?: string; }): Promise; /** Exported for tests: `{gcsPrefix|default}/{formatBackupTimestamp}/` without trailing slash (helpers client prefix). */ export declare function gcsBackupRunFolder(ts: string, gcsPrefix?: string): string; /** * Object-store client used by Catalox backup / restore / prune / record history. * Backed by Cloudflare R2 (`@x12i/catalox-storage`). Name kept for API compatibility. */ export type CataloxHelpersGcsClient = { uploadObject: (objectName: string, body: string | Buffer | Uint8Array | Readable, opts?: { contentType?: string; resumable?: boolean; }) => Promise; openReadStream: (objectName: string, opts?: Record) => Readable; readObjectBuffer: (objectName: string, opts?: Record) => Promise; listObjects: (query?: { prefix?: string; pageToken?: string; maxResults?: number; delimiter?: string; }) => Promise<{ items?: { name?: string; }[]; prefixes?: string[]; nextPageToken?: string; }>; objectExists: (objectName: string) => Promise; deleteObject: (objectName: string) => Promise; }; export declare const CATALOX_GCS_BACKUP_MANIFEST_FILENAME = "catalox-backup-manifest.json"; export declare function defaultCataloxBucketName(): string; /** Object-store client: `prefix` is the logical root prepended to relative object names. */ export declare function createCataloxHelpersGcsClient(bucket: string, prefixWithoutTrailingSlash: string): CataloxHelpersGcsClient; /** Alias for {@link createCataloxHelpersGcsClient} (R2 / S3-compatible). */ export declare function createCataloxObjectStoreClient(bucket: string, prefixWithoutTrailingSlash: string): CataloxHelpersGcsClient; /** Delete every object under one backup run folder (`…/{timestamp}/…`). */ export declare function deleteCataloxGcsBackupRunObjects(bucket: string, runFolder: string): Promise<{ deleted: number; }>; /** * Delete oldest GCS backup **run folders** (immediate children of `gcsBasePrefix`) until at most `keepLast` remain. * Folder names are sorted lexicographically (compatible with `formatBackupTimestamp` ISO-style tokens). */ export declare function pruneGcsBackupRuns(input: PruneGcsBackupRunsInput): Promise; export declare function runBackupData(deps: BackupDataDeps, input: BackupDataInput): Promise; //# sourceMappingURL=backup-data.d.ts.map