import { F as File, L as LocalMetaStorageOptions, f as BaseStorageOptions, M as MetaStorage, e as FileInit, O as OperationOptions, h as FilePart, i as FileQuery, c as FileReturn, S as StoredObject, B as BaseStorage } from "../../packem_shared/storage.d-Cnjmzau5.js"; import { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-DuAe8gC_.js"; import { ConnectOptions } from 'ssh2-sftp-client'; import 'node:stream'; import "../../packem_shared/types.d-DFh9698o.js"; import 'node:crypto'; import 'node:http'; import 'lru-cache'; declare class SftpFile extends File { path?: string; } declare class SftpMetaStorage extends LocalMetaStorage { constructor(config?: LocalMetaStorageOptions); } interface SftpStorageOptions extends BaseStorageOptions { /** * ssh2-sftp-client connection options (`host`, `port`, `username`, * `password`, `privateKey`, `passphrase`, …). A fresh connection is * opened and closed around every storage operation — the underlying * SSH channel is not safe for concurrent use, so the adapter does not * pool connections. */ connection: ConnectOptions; /** * Configure metafile storage. SFTP has no native arbitrary-metadata * field, so upload metadata is stored as sidecar JSON on the local * disk (defaults to the OS temp directory). */ metaStorageConfig?: LocalMetaStorageOptions; /** * Logical "bucket root" — virtual keys live under this remote directory. * The adapter creates intermediate directories on write. A leading slash * makes it absolute; otherwise it resolves against the connection's home * directory (the default). Trailing slashes are ignored. */ rootFolderPath?: string; } /** * SFTP storage backend (built on `ssh2-sftp-client`). * * Routes virtual keys onto remote paths under `rootFolderPath`. SFTP has no * native metadata store, so upload metadata is kept as sidecar JSON on the * local disk (see `SftpMetaStorage`). * * A fresh SFTP connection is opened and closed around every operation: the * underlying SSH channel is not safe for concurrent use, so the adapter does * not pool connections. * * **Limitations**: * - `write()` buffers the full part in memory before uploading (no remote append), so only a whole-file write at offset 0 is accepted; chunked writes are rejected with `METHOD_NOT_ALLOWED`. * - `getReadUrl` / `getUploadUrl` are not supported — SFTP has no signed-URL concept. */ declare class SftpStorage extends BaseStorage { static override readonly name: string; override readonly storageKind: string; /** Stores each object in a single request, so chunked/resumable uploads are rejected. */ override readonly supportsResumableWrites: boolean; override checksumTypes: string[]; override readonly supportsRange: boolean; protected meta: MetaStorage; private readonly connection; private readonly rootFolderPath; /** An absolute `rootFolderPath` ("/srv/uploads") stays absolute; a relative one resolves against the home directory. */ private readonly absoluteRoot; constructor(config: SftpStorageOptions); create(config: FileInit, _options?: OperationOptions): Promise; write(part: FilePart | FileQuery | SftpFile, options?: OperationOptions): Promise; get({ id }: FileQuery, options?: OperationOptions & { range?: { end?: number; start: number; }; }): Promise; delete({ id }: FileQuery, options?: OperationOptions): Promise; copy(name: string, destination: string, options?: OperationOptions & { storageClass?: string; }): Promise; move(name: string, destination: string, options?: OperationOptions): Promise; override list(_limit?: number, options?: OperationOptions): Promise; protected override statObject(id: string, options?: OperationOptions): Promise; override exists({ id }: FileQuery, options?: OperationOptions): Promise; private walkList; /** * Opens a fresh single-session SFTP connection for one operation. * `ssh2-sftp-client` has no `AbortSignal` hook, so cancellation is * best-effort: an abort ends the SSH channel via `client.end()`, which * rejects any in-flight transfer. The rejection is normalized to an * `AbortError`. */ private run; private keyToPath; private pathToKey; } export { SftpFile, SftpMetaStorage, SftpStorage, type SftpStorageOptions };