@zero-transfer/webdav 0.1.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { SecureVersion, PeerCertificate } from 'node:tls';
3
3
  import { Readable } from 'node:stream';
4
- import { BaseAgent, Algorithms } from 'ssh2';
5
4
  import { Buffer } from 'node:buffer';
6
5
 
7
6
  /**
@@ -306,10 +305,25 @@ interface RemoteStat extends RemoteEntry {
306
305
  type TlsSecretSource = SecretSource | SecretSource[];
307
306
  /** Known-hosts material source accepted by SSH connection profiles. */
308
307
  type SshKnownHostsSource = SecretSource | SecretSource[];
308
+ /** Minimal SSH agent contract used by profile validation and SSH adapters. */
309
+ interface SshAgentLike {
310
+ /** Returns public identities exposed by the agent implementation. */
311
+ getIdentities: (...args: any[]) => unknown;
312
+ /** Signs payloads using a selected identity. */
313
+ sign: (...args: any[]) => unknown;
314
+ }
315
+ /** Ordered algorithm list mutation operations used by SSH adapters. */
316
+ interface SshAlgorithmMutations {
317
+ append?: string | readonly string[];
318
+ prepend?: string | readonly string[];
319
+ remove?: string | readonly string[];
320
+ }
321
+ /** Single SSH algorithm override value accepted by connection profiles. */
322
+ type SshAlgorithmOverride = readonly string[] | SshAlgorithmMutations;
309
323
  /** SSH agent source accepted by SFTP providers. */
310
- type SshAgentSource = string | BaseAgent;
324
+ type SshAgentSource = string | SshAgentLike;
311
325
  /** SSH transport algorithm overrides accepted by SFTP providers. */
312
- type SshAlgorithms = Algorithms;
326
+ type SshAlgorithms = Record<string, SshAlgorithmOverride | undefined>;
313
327
  /** Context passed to SSH socket factories before opening an SSH session. */
314
328
  interface SshSocketFactoryContext {
315
329
  /** Target SSH host from the resolved connection profile. */
@@ -327,7 +341,7 @@ interface SshSocketFactoryContext {
327
341
  * Use this hook for HTTP CONNECT, SOCKS, bastion, or custom tunnel integrations.
328
342
  *
329
343
  * @param context - Resolved SSH target information for the socket being opened.
330
- * @returns Preconnected readable stream, or a promise for one, passed to ssh2's `sock` option.
344
+ * @returns Preconnected readable stream, or a promise for one, passed to the SSH adapter socket option.
331
345
  */
332
346
  type SshSocketFactory = (context: SshSocketFactoryContext) => Readable | Promise<Readable>;
333
347
  /** Prompt metadata supplied by an SSH keyboard-interactive server challenge. */
@@ -1629,6 +1643,65 @@ interface RunConnectionDiagnosticsOptions {
1629
1643
  */
1630
1644
  declare function runConnectionDiagnostics(options: RunConnectionDiagnosticsOptions): Promise<ConnectionDiagnosticsResult>;
1631
1645
 
1646
+ /** Options for {@link createPooledTransferClient}. */
1647
+ interface ConnectionPoolOptions {
1648
+ /**
1649
+ * Maximum number of *idle* sessions retained per pool key.
1650
+ *
1651
+ * Active leases are not counted against this limit — the cap only applies
1652
+ * to sessions waiting in the pool. When more than `maxIdlePerKey` sessions
1653
+ * become idle simultaneously, the oldest ones are disconnected. Defaults
1654
+ * to `4`.
1655
+ */
1656
+ maxIdlePerKey?: number;
1657
+ /**
1658
+ * How long an idle session may sit unused before it is automatically
1659
+ * disconnected. Defaults to `60_000` ms. Set to `0` to disable the timer
1660
+ * (idle sessions persist until `drainPool()` is called).
1661
+ */
1662
+ idleTimeoutMs?: number;
1663
+ /**
1664
+ * Custom pool key derivation. Receives the resolved
1665
+ * {@link ConnectionProfile} (after TransferClient validation) and must
1666
+ * return a string. Sessions with matching keys are pooled together; never
1667
+ * include secrets in the key.
1668
+ *
1669
+ * The default derives the key from `provider`, `host`, `port`, and
1670
+ * `username`.
1671
+ */
1672
+ keyOf?: (profile: ConnectionProfile) => string;
1673
+ }
1674
+ /**
1675
+ * Pool-aware {@link TransferClient} returned by
1676
+ * {@link createPooledTransferClient}.
1677
+ */
1678
+ interface PooledTransferClient {
1679
+ /** Opens (or leases) a pooled provider session. */
1680
+ connect(profile: ConnectionProfile): Promise<TransferSession>;
1681
+ /** Inspects the registered providers (delegated to the underlying client). */
1682
+ hasProvider(providerId: ProviderId): boolean;
1683
+ /** Returns the registered capability snapshots (delegated). */
1684
+ getCapabilities(): CapabilitySet[];
1685
+ /** Returns a specific capability snapshot (delegated). */
1686
+ getCapabilities(providerId: ProviderId): CapabilitySet;
1687
+ /**
1688
+ * Disconnects every idle session and prevents further pooling. After
1689
+ * `drainPool()` resolves, subsequent `connect()` calls still work but
1690
+ * always create fresh sessions (and never return them to the pool).
1691
+ */
1692
+ drainPool(): Promise<void>;
1693
+ /** Returns the number of idle sessions currently held in the pool. */
1694
+ poolSize(): number;
1695
+ }
1696
+ /**
1697
+ * Wraps a {@link TransferClient} with connection pooling.
1698
+ *
1699
+ * @param inner - Underlying client used to create real provider sessions.
1700
+ * @param options - Pool sizing, eviction, and key-derivation overrides.
1701
+ * @returns A {@link PooledTransferClient} that reuses idle sessions.
1702
+ */
1703
+ declare function createPooledTransferClient(inner: TransferClient, options?: ConnectionPoolOptions): PooledTransferClient;
1704
+
1632
1705
  /** Options used to create a local file-system provider factory. */
1633
1706
  interface LocalProviderOptions {
1634
1707
  /** Root directory exposed as `/`. When omitted, `profile.host` is treated as the root path. */
@@ -3167,6 +3240,24 @@ interface WebDavProviderOptions {
3167
3240
  fetch?: HttpFetch;
3168
3241
  /** Default headers applied to every request. */
3169
3242
  defaultHeaders?: Record<string, string>;
3243
+ /**
3244
+ * Streaming policy for `PUT` request bodies.
3245
+ *
3246
+ * - `"when-known-size"` (default) — stream when the caller declares
3247
+ * `request.totalBytes` (an explicit `Content-Length` is sent so all
3248
+ * WebDAV servers accept the upload); otherwise buffer the entire body in
3249
+ * memory before sending. This is the safe default that does not require
3250
+ * the server to accept HTTP/1.1 chunked transfer-encoding.
3251
+ * - `"always"` — always stream the body, even when the size is unknown
3252
+ * (the runtime will use chunked transfer-encoding). Some legacy WebDAV
3253
+ * servers reject `Transfer-Encoding: chunked` and will respond `411
3254
+ * Length Required` or `501 Not Implemented`; only enable this for
3255
+ * servers known to accept chunked uploads (modern Apache/nginx, IIS
3256
+ * with chunked transfer enabled, Nextcloud, ownCloud, sabre/dav).
3257
+ * - `"never"` — always buffer (legacy behaviour pre-0.4.0). Use for
3258
+ * maximum compatibility at the cost of memory.
3259
+ */
3260
+ uploadStreaming?: "when-known-size" | "always" | "never";
3170
3261
  }
3171
3262
  /**
3172
3263
  * Creates a WebDAV provider factory.
@@ -3176,4 +3267,4 @@ interface WebDavProviderOptions {
3176
3267
  */
3177
3268
  declare function createWebDavProviderFactory(options?: WebDavProviderOptions): ProviderFactory;
3178
3269
 
3179
- export { AbortError, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionProfile, type CopyBetweenOptions, type CreateAtomicDeployPlanOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type DiffRemoteTreesOptions, type DownloadFileOptions, type EnvSecretSource, type FileSecretSource, type FileZillaSite, type FriendlyTransferOptions, type FtpReplyErrorInput, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MkdirOptions, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OpenSshConfigEntry, ParseError, PathAlreadyExistsError, PathNotFoundError, PermissionDeniedError, type ProgressEventInput, ProtocolError, type AuthenticationCapability as ProviderAuthenticationCapability, type CapabilitySet as ProviderCapabilities, type ChecksumCapability as ProviderChecksumCapability, type ProviderFactory, type ProviderId, type MetadataCapability as ProviderMetadataCapability, ProviderRegistry, type ProviderSelection, type ProviderTransferEndpointRole, type ProviderTransferExecutorOptions, type ProviderTransferOperations, type ProviderTransferReadRequest, type ProviderTransferReadResult, type ProviderTransferRequest, type ProviderTransferSessionResolver, type ProviderTransferSessionResolverInput, type ProviderTransferWriteRequest, type ProviderTransferWriteResult, REDACTED, REMOTE_MANIFEST_FORMAT_VERSION, type RemoteBreadcrumb, type RemoteBrowser, type RemoteBrowserFilter, type RemoteBrowserSnapshot, type RemoteEntry, type RemoteEntrySortKey, type RemoteEntrySortOrder, type RemoteEntryType, type RemoteFileAdapter, type RemoteFileEndpoint, type RemoteFileSystem, type RemoteManifest, type RemoteManifestEntry, type RemotePermissions, type RemoteProtocol, type RemoteStat, type RemoteTreeDiff, type RemoteTreeDiffEntry, type RemoteTreeDiffReason, type RemoteTreeDiffStatus, type RemoteTreeDiffSummary, type RemoteTreeEntry, type RemoteTreeFilter, type RemoveOptions, type RenameOptions, type ResolveSecretOptions, type ResolvedConnectionProfile, type ResolvedOpenSshHost, type ResolvedSshProfile, type ResolvedTlsProfile, type RmdirOptions, type RunConnectionDiagnosticsOptions, type SecretProvider, type SecretSource, type SecretValue, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithms, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshProfile, type SshSocketFactory, type SshSocketFactoryContext, type StatOptions, type SyncConflictPolicy, type SyncDeletePolicy, type SyncDirection, type SyncEndpointInput, TimeoutError, type TlsProfile, type TlsSecretSource, type TransferAttempt, type TransferAttemptError, type TransferBandwidthLimit, type TransferByteRange, TransferClient, type TransferClientOptions, type TransferDataChunk, type TransferDataSource, type TransferEndpoint, TransferEngine, type TransferEngineExecuteOptions, type TransferEngineOptions, TransferError, type TransferExecutionContext, type TransferExecutionResult, type TransferExecutor, type TransferJob, type TransferOperation, type TransferPlan, type TransferPlanAction, type TransferPlanInput, type TransferPlanStep, type TransferPlanSummary, type TransferProgressEvent, type TransferProvider, TransferQueue, type TransferQueueExecutorResolver, type TransferQueueItem, type TransferQueueItemStatus, type TransferQueueOptions, type TransferQueueRunOptions, type TransferQueueSummary, type TransferReceipt, type TransferResult, type TransferResultInput, type TransferRetryDecisionInput, type TransferRetryPolicy, type TransferSession, type TransferTimeoutPolicy, type TransferVerificationResult, UnsupportedFeatureError, type UploadFileOptions, type ValueSecretSource, VerificationError, type WalkRemoteTreeOptions, type WebDavProviderOptions, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildRemoteBreadcrumbs, compareRemoteManifests, copyBetween, createAtomicDeployPlan, createBandwidthThrottle, createLocalProviderFactory, createMemoryProviderFactory, createOAuthTokenSecretSource, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, createWebDavProviderFactory, diffRemoteTrees, downloadFile, emitLog, errorFromFtpReply, filterRemoteEntries, importFileZillaSites, importOpenSshConfig, importWinScpSessions, isClassicProviderId, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, noopLogger, normalizeRemotePath, parentRemotePath, parseKnownHosts, parseOpenSshConfig, parseRemoteManifest, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };
3270
+ export { AbortError, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionPoolOptions, type ConnectionProfile, type CopyBetweenOptions, type CreateAtomicDeployPlanOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type DiffRemoteTreesOptions, type DownloadFileOptions, type EnvSecretSource, type FileSecretSource, type FileZillaSite, type FriendlyTransferOptions, type FtpReplyErrorInput, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MkdirOptions, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OpenSshConfigEntry, ParseError, PathAlreadyExistsError, PathNotFoundError, PermissionDeniedError, type PooledTransferClient, type ProgressEventInput, ProtocolError, type AuthenticationCapability as ProviderAuthenticationCapability, type CapabilitySet as ProviderCapabilities, type ChecksumCapability as ProviderChecksumCapability, type ProviderFactory, type ProviderId, type MetadataCapability as ProviderMetadataCapability, ProviderRegistry, type ProviderSelection, type ProviderTransferEndpointRole, type ProviderTransferExecutorOptions, type ProviderTransferOperations, type ProviderTransferReadRequest, type ProviderTransferReadResult, type ProviderTransferRequest, type ProviderTransferSessionResolver, type ProviderTransferSessionResolverInput, type ProviderTransferWriteRequest, type ProviderTransferWriteResult, REDACTED, REMOTE_MANIFEST_FORMAT_VERSION, type RemoteBreadcrumb, type RemoteBrowser, type RemoteBrowserFilter, type RemoteBrowserSnapshot, type RemoteEntry, type RemoteEntrySortKey, type RemoteEntrySortOrder, type RemoteEntryType, type RemoteFileAdapter, type RemoteFileEndpoint, type RemoteFileSystem, type RemoteManifest, type RemoteManifestEntry, type RemotePermissions, type RemoteProtocol, type RemoteStat, type RemoteTreeDiff, type RemoteTreeDiffEntry, type RemoteTreeDiffReason, type RemoteTreeDiffStatus, type RemoteTreeDiffSummary, type RemoteTreeEntry, type RemoteTreeFilter, type RemoveOptions, type RenameOptions, type ResolveSecretOptions, type ResolvedConnectionProfile, type ResolvedOpenSshHost, type ResolvedSshProfile, type ResolvedTlsProfile, type RmdirOptions, type RunConnectionDiagnosticsOptions, type SecretProvider, type SecretSource, type SecretValue, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithms, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshProfile, type SshSocketFactory, type SshSocketFactoryContext, type StatOptions, type SyncConflictPolicy, type SyncDeletePolicy, type SyncDirection, type SyncEndpointInput, TimeoutError, type TlsProfile, type TlsSecretSource, type TransferAttempt, type TransferAttemptError, type TransferBandwidthLimit, type TransferByteRange, TransferClient, type TransferClientOptions, type TransferDataChunk, type TransferDataSource, type TransferEndpoint, TransferEngine, type TransferEngineExecuteOptions, type TransferEngineOptions, TransferError, type TransferExecutionContext, type TransferExecutionResult, type TransferExecutor, type TransferJob, type TransferOperation, type TransferPlan, type TransferPlanAction, type TransferPlanInput, type TransferPlanStep, type TransferPlanSummary, type TransferProgressEvent, type TransferProvider, TransferQueue, type TransferQueueExecutorResolver, type TransferQueueItem, type TransferQueueItemStatus, type TransferQueueOptions, type TransferQueueRunOptions, type TransferQueueSummary, type TransferReceipt, type TransferResult, type TransferResultInput, type TransferRetryDecisionInput, type TransferRetryPolicy, type TransferSession, type TransferTimeoutPolicy, type TransferVerificationResult, UnsupportedFeatureError, type UploadFileOptions, type ValueSecretSource, VerificationError, type WalkRemoteTreeOptions, type WebDavProviderOptions, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildRemoteBreadcrumbs, compareRemoteManifests, copyBetween, createAtomicDeployPlan, createBandwidthThrottle, createLocalProviderFactory, createMemoryProviderFactory, createOAuthTokenSecretSource, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, createWebDavProviderFactory, diffRemoteTrees, downloadFile, emitLog, errorFromFtpReply, filterRemoteEntries, importFileZillaSites, importOpenSshConfig, importWinScpSessions, isClassicProviderId, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, noopLogger, normalizeRemotePath, parentRemotePath, parseKnownHosts, parseOpenSshConfig, parseRemoteManifest, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { SecureVersion, PeerCertificate } from 'node:tls';
3
3
  import { Readable } from 'node:stream';
4
- import { BaseAgent, Algorithms } from 'ssh2';
5
4
  import { Buffer } from 'node:buffer';
6
5
 
7
6
  /**
@@ -306,10 +305,25 @@ interface RemoteStat extends RemoteEntry {
306
305
  type TlsSecretSource = SecretSource | SecretSource[];
307
306
  /** Known-hosts material source accepted by SSH connection profiles. */
308
307
  type SshKnownHostsSource = SecretSource | SecretSource[];
308
+ /** Minimal SSH agent contract used by profile validation and SSH adapters. */
309
+ interface SshAgentLike {
310
+ /** Returns public identities exposed by the agent implementation. */
311
+ getIdentities: (...args: any[]) => unknown;
312
+ /** Signs payloads using a selected identity. */
313
+ sign: (...args: any[]) => unknown;
314
+ }
315
+ /** Ordered algorithm list mutation operations used by SSH adapters. */
316
+ interface SshAlgorithmMutations {
317
+ append?: string | readonly string[];
318
+ prepend?: string | readonly string[];
319
+ remove?: string | readonly string[];
320
+ }
321
+ /** Single SSH algorithm override value accepted by connection profiles. */
322
+ type SshAlgorithmOverride = readonly string[] | SshAlgorithmMutations;
309
323
  /** SSH agent source accepted by SFTP providers. */
310
- type SshAgentSource = string | BaseAgent;
324
+ type SshAgentSource = string | SshAgentLike;
311
325
  /** SSH transport algorithm overrides accepted by SFTP providers. */
312
- type SshAlgorithms = Algorithms;
326
+ type SshAlgorithms = Record<string, SshAlgorithmOverride | undefined>;
313
327
  /** Context passed to SSH socket factories before opening an SSH session. */
314
328
  interface SshSocketFactoryContext {
315
329
  /** Target SSH host from the resolved connection profile. */
@@ -327,7 +341,7 @@ interface SshSocketFactoryContext {
327
341
  * Use this hook for HTTP CONNECT, SOCKS, bastion, or custom tunnel integrations.
328
342
  *
329
343
  * @param context - Resolved SSH target information for the socket being opened.
330
- * @returns Preconnected readable stream, or a promise for one, passed to ssh2's `sock` option.
344
+ * @returns Preconnected readable stream, or a promise for one, passed to the SSH adapter socket option.
331
345
  */
332
346
  type SshSocketFactory = (context: SshSocketFactoryContext) => Readable | Promise<Readable>;
333
347
  /** Prompt metadata supplied by an SSH keyboard-interactive server challenge. */
@@ -1629,6 +1643,65 @@ interface RunConnectionDiagnosticsOptions {
1629
1643
  */
1630
1644
  declare function runConnectionDiagnostics(options: RunConnectionDiagnosticsOptions): Promise<ConnectionDiagnosticsResult>;
1631
1645
 
1646
+ /** Options for {@link createPooledTransferClient}. */
1647
+ interface ConnectionPoolOptions {
1648
+ /**
1649
+ * Maximum number of *idle* sessions retained per pool key.
1650
+ *
1651
+ * Active leases are not counted against this limit — the cap only applies
1652
+ * to sessions waiting in the pool. When more than `maxIdlePerKey` sessions
1653
+ * become idle simultaneously, the oldest ones are disconnected. Defaults
1654
+ * to `4`.
1655
+ */
1656
+ maxIdlePerKey?: number;
1657
+ /**
1658
+ * How long an idle session may sit unused before it is automatically
1659
+ * disconnected. Defaults to `60_000` ms. Set to `0` to disable the timer
1660
+ * (idle sessions persist until `drainPool()` is called).
1661
+ */
1662
+ idleTimeoutMs?: number;
1663
+ /**
1664
+ * Custom pool key derivation. Receives the resolved
1665
+ * {@link ConnectionProfile} (after TransferClient validation) and must
1666
+ * return a string. Sessions with matching keys are pooled together; never
1667
+ * include secrets in the key.
1668
+ *
1669
+ * The default derives the key from `provider`, `host`, `port`, and
1670
+ * `username`.
1671
+ */
1672
+ keyOf?: (profile: ConnectionProfile) => string;
1673
+ }
1674
+ /**
1675
+ * Pool-aware {@link TransferClient} returned by
1676
+ * {@link createPooledTransferClient}.
1677
+ */
1678
+ interface PooledTransferClient {
1679
+ /** Opens (or leases) a pooled provider session. */
1680
+ connect(profile: ConnectionProfile): Promise<TransferSession>;
1681
+ /** Inspects the registered providers (delegated to the underlying client). */
1682
+ hasProvider(providerId: ProviderId): boolean;
1683
+ /** Returns the registered capability snapshots (delegated). */
1684
+ getCapabilities(): CapabilitySet[];
1685
+ /** Returns a specific capability snapshot (delegated). */
1686
+ getCapabilities(providerId: ProviderId): CapabilitySet;
1687
+ /**
1688
+ * Disconnects every idle session and prevents further pooling. After
1689
+ * `drainPool()` resolves, subsequent `connect()` calls still work but
1690
+ * always create fresh sessions (and never return them to the pool).
1691
+ */
1692
+ drainPool(): Promise<void>;
1693
+ /** Returns the number of idle sessions currently held in the pool. */
1694
+ poolSize(): number;
1695
+ }
1696
+ /**
1697
+ * Wraps a {@link TransferClient} with connection pooling.
1698
+ *
1699
+ * @param inner - Underlying client used to create real provider sessions.
1700
+ * @param options - Pool sizing, eviction, and key-derivation overrides.
1701
+ * @returns A {@link PooledTransferClient} that reuses idle sessions.
1702
+ */
1703
+ declare function createPooledTransferClient(inner: TransferClient, options?: ConnectionPoolOptions): PooledTransferClient;
1704
+
1632
1705
  /** Options used to create a local file-system provider factory. */
1633
1706
  interface LocalProviderOptions {
1634
1707
  /** Root directory exposed as `/`. When omitted, `profile.host` is treated as the root path. */
@@ -3167,6 +3240,24 @@ interface WebDavProviderOptions {
3167
3240
  fetch?: HttpFetch;
3168
3241
  /** Default headers applied to every request. */
3169
3242
  defaultHeaders?: Record<string, string>;
3243
+ /**
3244
+ * Streaming policy for `PUT` request bodies.
3245
+ *
3246
+ * - `"when-known-size"` (default) — stream when the caller declares
3247
+ * `request.totalBytes` (an explicit `Content-Length` is sent so all
3248
+ * WebDAV servers accept the upload); otherwise buffer the entire body in
3249
+ * memory before sending. This is the safe default that does not require
3250
+ * the server to accept HTTP/1.1 chunked transfer-encoding.
3251
+ * - `"always"` — always stream the body, even when the size is unknown
3252
+ * (the runtime will use chunked transfer-encoding). Some legacy WebDAV
3253
+ * servers reject `Transfer-Encoding: chunked` and will respond `411
3254
+ * Length Required` or `501 Not Implemented`; only enable this for
3255
+ * servers known to accept chunked uploads (modern Apache/nginx, IIS
3256
+ * with chunked transfer enabled, Nextcloud, ownCloud, sabre/dav).
3257
+ * - `"never"` — always buffer (legacy behaviour pre-0.4.0). Use for
3258
+ * maximum compatibility at the cost of memory.
3259
+ */
3260
+ uploadStreaming?: "when-known-size" | "always" | "never";
3170
3261
  }
3171
3262
  /**
3172
3263
  * Creates a WebDAV provider factory.
@@ -3176,4 +3267,4 @@ interface WebDavProviderOptions {
3176
3267
  */
3177
3268
  declare function createWebDavProviderFactory(options?: WebDavProviderOptions): ProviderFactory;
3178
3269
 
3179
- export { AbortError, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionProfile, type CopyBetweenOptions, type CreateAtomicDeployPlanOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type DiffRemoteTreesOptions, type DownloadFileOptions, type EnvSecretSource, type FileSecretSource, type FileZillaSite, type FriendlyTransferOptions, type FtpReplyErrorInput, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MkdirOptions, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OpenSshConfigEntry, ParseError, PathAlreadyExistsError, PathNotFoundError, PermissionDeniedError, type ProgressEventInput, ProtocolError, type AuthenticationCapability as ProviderAuthenticationCapability, type CapabilitySet as ProviderCapabilities, type ChecksumCapability as ProviderChecksumCapability, type ProviderFactory, type ProviderId, type MetadataCapability as ProviderMetadataCapability, ProviderRegistry, type ProviderSelection, type ProviderTransferEndpointRole, type ProviderTransferExecutorOptions, type ProviderTransferOperations, type ProviderTransferReadRequest, type ProviderTransferReadResult, type ProviderTransferRequest, type ProviderTransferSessionResolver, type ProviderTransferSessionResolverInput, type ProviderTransferWriteRequest, type ProviderTransferWriteResult, REDACTED, REMOTE_MANIFEST_FORMAT_VERSION, type RemoteBreadcrumb, type RemoteBrowser, type RemoteBrowserFilter, type RemoteBrowserSnapshot, type RemoteEntry, type RemoteEntrySortKey, type RemoteEntrySortOrder, type RemoteEntryType, type RemoteFileAdapter, type RemoteFileEndpoint, type RemoteFileSystem, type RemoteManifest, type RemoteManifestEntry, type RemotePermissions, type RemoteProtocol, type RemoteStat, type RemoteTreeDiff, type RemoteTreeDiffEntry, type RemoteTreeDiffReason, type RemoteTreeDiffStatus, type RemoteTreeDiffSummary, type RemoteTreeEntry, type RemoteTreeFilter, type RemoveOptions, type RenameOptions, type ResolveSecretOptions, type ResolvedConnectionProfile, type ResolvedOpenSshHost, type ResolvedSshProfile, type ResolvedTlsProfile, type RmdirOptions, type RunConnectionDiagnosticsOptions, type SecretProvider, type SecretSource, type SecretValue, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithms, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshProfile, type SshSocketFactory, type SshSocketFactoryContext, type StatOptions, type SyncConflictPolicy, type SyncDeletePolicy, type SyncDirection, type SyncEndpointInput, TimeoutError, type TlsProfile, type TlsSecretSource, type TransferAttempt, type TransferAttemptError, type TransferBandwidthLimit, type TransferByteRange, TransferClient, type TransferClientOptions, type TransferDataChunk, type TransferDataSource, type TransferEndpoint, TransferEngine, type TransferEngineExecuteOptions, type TransferEngineOptions, TransferError, type TransferExecutionContext, type TransferExecutionResult, type TransferExecutor, type TransferJob, type TransferOperation, type TransferPlan, type TransferPlanAction, type TransferPlanInput, type TransferPlanStep, type TransferPlanSummary, type TransferProgressEvent, type TransferProvider, TransferQueue, type TransferQueueExecutorResolver, type TransferQueueItem, type TransferQueueItemStatus, type TransferQueueOptions, type TransferQueueRunOptions, type TransferQueueSummary, type TransferReceipt, type TransferResult, type TransferResultInput, type TransferRetryDecisionInput, type TransferRetryPolicy, type TransferSession, type TransferTimeoutPolicy, type TransferVerificationResult, UnsupportedFeatureError, type UploadFileOptions, type ValueSecretSource, VerificationError, type WalkRemoteTreeOptions, type WebDavProviderOptions, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildRemoteBreadcrumbs, compareRemoteManifests, copyBetween, createAtomicDeployPlan, createBandwidthThrottle, createLocalProviderFactory, createMemoryProviderFactory, createOAuthTokenSecretSource, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, createWebDavProviderFactory, diffRemoteTrees, downloadFile, emitLog, errorFromFtpReply, filterRemoteEntries, importFileZillaSites, importOpenSshConfig, importWinScpSessions, isClassicProviderId, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, noopLogger, normalizeRemotePath, parentRemotePath, parseKnownHosts, parseOpenSshConfig, parseRemoteManifest, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };
3270
+ export { AbortError, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionPoolOptions, type ConnectionProfile, type CopyBetweenOptions, type CreateAtomicDeployPlanOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type DiffRemoteTreesOptions, type DownloadFileOptions, type EnvSecretSource, type FileSecretSource, type FileZillaSite, type FriendlyTransferOptions, type FtpReplyErrorInput, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MkdirOptions, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OpenSshConfigEntry, ParseError, PathAlreadyExistsError, PathNotFoundError, PermissionDeniedError, type PooledTransferClient, type ProgressEventInput, ProtocolError, type AuthenticationCapability as ProviderAuthenticationCapability, type CapabilitySet as ProviderCapabilities, type ChecksumCapability as ProviderChecksumCapability, type ProviderFactory, type ProviderId, type MetadataCapability as ProviderMetadataCapability, ProviderRegistry, type ProviderSelection, type ProviderTransferEndpointRole, type ProviderTransferExecutorOptions, type ProviderTransferOperations, type ProviderTransferReadRequest, type ProviderTransferReadResult, type ProviderTransferRequest, type ProviderTransferSessionResolver, type ProviderTransferSessionResolverInput, type ProviderTransferWriteRequest, type ProviderTransferWriteResult, REDACTED, REMOTE_MANIFEST_FORMAT_VERSION, type RemoteBreadcrumb, type RemoteBrowser, type RemoteBrowserFilter, type RemoteBrowserSnapshot, type RemoteEntry, type RemoteEntrySortKey, type RemoteEntrySortOrder, type RemoteEntryType, type RemoteFileAdapter, type RemoteFileEndpoint, type RemoteFileSystem, type RemoteManifest, type RemoteManifestEntry, type RemotePermissions, type RemoteProtocol, type RemoteStat, type RemoteTreeDiff, type RemoteTreeDiffEntry, type RemoteTreeDiffReason, type RemoteTreeDiffStatus, type RemoteTreeDiffSummary, type RemoteTreeEntry, type RemoteTreeFilter, type RemoveOptions, type RenameOptions, type ResolveSecretOptions, type ResolvedConnectionProfile, type ResolvedOpenSshHost, type ResolvedSshProfile, type ResolvedTlsProfile, type RmdirOptions, type RunConnectionDiagnosticsOptions, type SecretProvider, type SecretSource, type SecretValue, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithms, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshProfile, type SshSocketFactory, type SshSocketFactoryContext, type StatOptions, type SyncConflictPolicy, type SyncDeletePolicy, type SyncDirection, type SyncEndpointInput, TimeoutError, type TlsProfile, type TlsSecretSource, type TransferAttempt, type TransferAttemptError, type TransferBandwidthLimit, type TransferByteRange, TransferClient, type TransferClientOptions, type TransferDataChunk, type TransferDataSource, type TransferEndpoint, TransferEngine, type TransferEngineExecuteOptions, type TransferEngineOptions, TransferError, type TransferExecutionContext, type TransferExecutionResult, type TransferExecutor, type TransferJob, type TransferOperation, type TransferPlan, type TransferPlanAction, type TransferPlanInput, type TransferPlanStep, type TransferPlanSummary, type TransferProgressEvent, type TransferProvider, TransferQueue, type TransferQueueExecutorResolver, type TransferQueueItem, type TransferQueueItemStatus, type TransferQueueOptions, type TransferQueueRunOptions, type TransferQueueSummary, type TransferReceipt, type TransferResult, type TransferResultInput, type TransferRetryDecisionInput, type TransferRetryPolicy, type TransferSession, type TransferTimeoutPolicy, type TransferVerificationResult, UnsupportedFeatureError, type UploadFileOptions, type ValueSecretSource, VerificationError, type WalkRemoteTreeOptions, type WebDavProviderOptions, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildRemoteBreadcrumbs, compareRemoteManifests, copyBetween, createAtomicDeployPlan, createBandwidthThrottle, createLocalProviderFactory, createMemoryProviderFactory, createOAuthTokenSecretSource, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, createWebDavProviderFactory, diffRemoteTrees, downloadFile, emitLog, errorFromFtpReply, filterRemoteEntries, importFileZillaSites, importOpenSshConfig, importWinScpSessions, isClassicProviderId, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, noopLogger, normalizeRemotePath, parentRemotePath, parseKnownHosts, parseOpenSshConfig, parseRemoteManifest, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };