@zero-transfer/sftp 0.4.6 → 0.4.8
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/README.md +14 -19
- package/dist/index.cjs +428 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +233 -29
- package/dist/index.d.ts +233 -29
- package/dist/index.mjs +425 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -399,6 +399,10 @@ interface TlsProfile {
|
|
|
399
399
|
* trust via `rejectUnauthorized`. Pinning is **recommended for production** when you control
|
|
400
400
|
* the server and want defence-in-depth against rogue certificates issued by trusted CAs.
|
|
401
401
|
*
|
|
402
|
+
* Cannot be combined with `rejectUnauthorized: false`: pin verification runs after the TLS
|
|
403
|
+
* handshake is accepted, so chain validation must stay enabled. Use `ca` for self-signed
|
|
404
|
+
* certificates.
|
|
405
|
+
*
|
|
402
406
|
* @example "AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99"
|
|
403
407
|
*/
|
|
404
408
|
pinnedFingerprint256?: string | readonly string[];
|
|
@@ -676,10 +680,42 @@ interface TransferBandwidthLimit {
|
|
|
676
680
|
/** Optional burst allowance in bytes for token-bucket-style implementations. */
|
|
677
681
|
burstBytes?: number;
|
|
678
682
|
}
|
|
679
|
-
/**
|
|
683
|
+
/**
|
|
684
|
+
* Timeout policy applied by the transfer engine.
|
|
685
|
+
*
|
|
686
|
+
* Two timeout scopes exist with deliberately different failure semantics:
|
|
687
|
+
*
|
|
688
|
+
* - **Job scope** ({@link timeoutMs}): covers the full engine execution
|
|
689
|
+
* including retries. When it fires, the engine rethrows the
|
|
690
|
+
* {@link TimeoutError} immediately - the retry policy is never consulted.
|
|
691
|
+
* - **Attempt scope** ({@link attemptTimeoutMs} and {@link stallTimeoutMs}):
|
|
692
|
+
* covers a single attempt. When either fires, the per-attempt abort
|
|
693
|
+
* controller cancels the attempt and the resulting {@link TimeoutError}
|
|
694
|
+
* flows into the retry policy like any other attempt failure, so retryable
|
|
695
|
+
* timeouts are retried (with backoff) instead of failing the job.
|
|
696
|
+
*
|
|
697
|
+
* @example Retry stalled attempts, but never run longer than 10 minutes total
|
|
698
|
+
* ```ts
|
|
699
|
+
* await engine.execute(job, executor, {
|
|
700
|
+
* retry: createDefaultRetryPolicy(),
|
|
701
|
+
* timeout: { timeoutMs: 600_000, attemptTimeoutMs: 120_000, stallTimeoutMs: 30_000 },
|
|
702
|
+
* });
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
680
705
|
interface TransferTimeoutPolicy {
|
|
681
706
|
/** Maximum duration for the full engine execution, including retries, in milliseconds. */
|
|
682
707
|
timeoutMs?: number;
|
|
708
|
+
/**
|
|
709
|
+
* Maximum duration for a single attempt in milliseconds. Expiry aborts only
|
|
710
|
+
* the active attempt; the failure flows into the retry policy.
|
|
711
|
+
*/
|
|
712
|
+
attemptTimeoutMs?: number;
|
|
713
|
+
/**
|
|
714
|
+
* Maximum time without progress before an attempt is considered stalled, in
|
|
715
|
+
* milliseconds. The watchdog resets on every progress report; expiry aborts
|
|
716
|
+
* only the active attempt and the failure flows into the retry policy.
|
|
717
|
+
*/
|
|
718
|
+
stallTimeoutMs?: number;
|
|
683
719
|
/** Whether timeout failures are retryable. Defaults to `true`. */
|
|
684
720
|
retryable?: boolean;
|
|
685
721
|
}
|
|
@@ -804,15 +840,31 @@ interface TransferRetryDecisionInput {
|
|
|
804
840
|
error: unknown;
|
|
805
841
|
/** One-based attempt number that failed. */
|
|
806
842
|
attempt: number;
|
|
843
|
+
/** Milliseconds elapsed since the engine execution started, including prior attempts and delays. */
|
|
844
|
+
elapsedMs: number;
|
|
807
845
|
/** Job being executed. */
|
|
808
846
|
job: TransferJob;
|
|
809
847
|
}
|
|
810
|
-
/**
|
|
848
|
+
/**
|
|
849
|
+
* Retry policy for transfer execution.
|
|
850
|
+
*
|
|
851
|
+
* Use {@link createDefaultRetryPolicy} for a production-ready policy with
|
|
852
|
+
* exponential backoff, full jitter, and `Retry-After` support, or implement
|
|
853
|
+
* the hooks directly for full control.
|
|
854
|
+
*/
|
|
811
855
|
interface TransferRetryPolicy {
|
|
812
856
|
/** Maximum total attempts, including the first attempt. Defaults to `1`. */
|
|
813
857
|
maxAttempts?: number;
|
|
814
858
|
/** Decides whether a failed attempt should be retried. Defaults to SDK retryability metadata. */
|
|
815
859
|
shouldRetry?(input: TransferRetryDecisionInput): boolean;
|
|
860
|
+
/**
|
|
861
|
+
* Computes the delay before the next attempt in milliseconds.
|
|
862
|
+
*
|
|
863
|
+
* The engine sleeps for the returned duration with an abort-aware timer:
|
|
864
|
+
* cancelling the job during the delay rejects immediately instead of
|
|
865
|
+
* waiting out the backoff. Non-positive or missing values retry at once.
|
|
866
|
+
*/
|
|
867
|
+
getDelayMs?(input: TransferRetryDecisionInput): number;
|
|
816
868
|
/** Observes retry decisions before the next attempt starts. */
|
|
817
869
|
onRetry?(input: TransferRetryDecisionInput): void;
|
|
818
870
|
}
|
|
@@ -846,7 +898,12 @@ interface TransferEngineOptions {
|
|
|
846
898
|
*
|
|
847
899
|
* @example Execute a single job with a custom executor
|
|
848
900
|
* ```ts
|
|
849
|
-
* import {
|
|
901
|
+
* import {
|
|
902
|
+
* TransferEngine,
|
|
903
|
+
* createDefaultRetryPolicy,
|
|
904
|
+
* type TransferExecutor,
|
|
905
|
+
* type TransferJob,
|
|
906
|
+
* } from "@zero-transfer/sdk";
|
|
850
907
|
*
|
|
851
908
|
* const engine = new TransferEngine();
|
|
852
909
|
*
|
|
@@ -864,7 +921,8 @@ interface TransferEngineOptions {
|
|
|
864
921
|
* };
|
|
865
922
|
*
|
|
866
923
|
* const receipt = await engine.execute(job, executor, {
|
|
867
|
-
* retry:
|
|
924
|
+
* retry: createDefaultRetryPolicy(),
|
|
925
|
+
* timeout: { stallTimeoutMs: 30_000 },
|
|
868
926
|
* });
|
|
869
927
|
* console.log(receipt.attempts.length); // 1 on success
|
|
870
928
|
* ```
|
|
@@ -1086,6 +1144,40 @@ declare class ProviderRegistry {
|
|
|
1086
1144
|
listCapabilities(): CapabilitySet[];
|
|
1087
1145
|
}
|
|
1088
1146
|
|
|
1147
|
+
/**
|
|
1148
|
+
* Client-level execution defaults applied when a call site does not supply
|
|
1149
|
+
* its own value.
|
|
1150
|
+
*
|
|
1151
|
+
* Defaults are consumed by {@link runRoute}, the one-shot helpers
|
|
1152
|
+
* ({@link uploadFile}, {@link downloadFile}, {@link copyBetween}),
|
|
1153
|
+
* {@link TransferQueue} (via its `client` option), and scheduled routes fired
|
|
1154
|
+
* through {@link MftScheduler}. The {@link TransferEngine} primitive stays
|
|
1155
|
+
* fully explicit: defaults never reach `engine.execute()` directly.
|
|
1156
|
+
*
|
|
1157
|
+
* Per-call options always win over client defaults.
|
|
1158
|
+
*
|
|
1159
|
+
* Additional default slots (`verify`, `resume`, `compression`, `policy`) land
|
|
1160
|
+
* here as their features ship in later releases; the shape is additive.
|
|
1161
|
+
*
|
|
1162
|
+
* @example Resilient defaults for every transfer in an application
|
|
1163
|
+
* ```ts
|
|
1164
|
+
* import { createDefaultRetryPolicy, createTransferClient } from "@zero-transfer/sdk";
|
|
1165
|
+
*
|
|
1166
|
+
* const client = createTransferClient({
|
|
1167
|
+
* providers: [createSftpProviderFactory(), createS3ProviderFactory()],
|
|
1168
|
+
* defaults: {
|
|
1169
|
+
* retry: createDefaultRetryPolicy(),
|
|
1170
|
+
* timeout: { stallTimeoutMs: 30_000 },
|
|
1171
|
+
* },
|
|
1172
|
+
* });
|
|
1173
|
+
* ```
|
|
1174
|
+
*/
|
|
1175
|
+
interface TransferClientDefaults {
|
|
1176
|
+
/** Default retry policy for transfers executed through this client. */
|
|
1177
|
+
retry?: TransferRetryPolicy;
|
|
1178
|
+
/** Default timeout policy for transfers executed through this client. */
|
|
1179
|
+
timeout?: TransferTimeoutPolicy;
|
|
1180
|
+
}
|
|
1089
1181
|
/** Options used to create a provider-neutral transfer client. */
|
|
1090
1182
|
interface TransferClientOptions {
|
|
1091
1183
|
/** Existing registry to reuse. When omitted, a fresh empty registry is created. */
|
|
@@ -1094,16 +1186,20 @@ interface TransferClientOptions {
|
|
|
1094
1186
|
providers?: ProviderFactory[];
|
|
1095
1187
|
/** Structured logger used for client lifecycle records. */
|
|
1096
1188
|
logger?: ZeroTransferLogger;
|
|
1189
|
+
/** Execution defaults applied when call sites omit their own values. */
|
|
1190
|
+
defaults?: TransferClientDefaults;
|
|
1097
1191
|
}
|
|
1098
1192
|
/** Small provider-neutral client that owns provider lookup and connection setup. */
|
|
1099
1193
|
declare class TransferClient {
|
|
1100
1194
|
/** Provider registry used by this client. */
|
|
1101
1195
|
readonly registry: ProviderRegistry;
|
|
1196
|
+
/** Execution defaults applied when call sites omit their own values. */
|
|
1197
|
+
readonly defaults?: TransferClientDefaults;
|
|
1102
1198
|
private readonly logger;
|
|
1103
1199
|
/**
|
|
1104
1200
|
* Creates a transfer client without opening any provider connections.
|
|
1105
1201
|
*
|
|
1106
|
-
* @param options - Optional registry, provider factories, and
|
|
1202
|
+
* @param options - Optional registry, provider factories, logger, and execution defaults.
|
|
1107
1203
|
*/
|
|
1108
1204
|
constructor(options?: TransferClientOptions);
|
|
1109
1205
|
/**
|
|
@@ -1437,11 +1533,11 @@ interface RunRouteOptions {
|
|
|
1437
1533
|
now?: () => Date;
|
|
1438
1534
|
/** Abort signal used to cancel the route execution. */
|
|
1439
1535
|
signal?: AbortSignal;
|
|
1440
|
-
/** Retry policy forwarded to the engine. */
|
|
1536
|
+
/** Retry policy forwarded to the engine. Falls back to `client.defaults.retry`. */
|
|
1441
1537
|
retry?: TransferRetryPolicy;
|
|
1442
1538
|
/** Progress observer forwarded to the engine. */
|
|
1443
1539
|
onProgress?: (event: TransferProgressEvent) => void;
|
|
1444
|
-
/** Timeout policy forwarded to the engine. */
|
|
1540
|
+
/** Timeout policy forwarded to the engine. Falls back to `client.defaults.timeout`. */
|
|
1445
1541
|
timeout?: TransferTimeoutPolicy;
|
|
1446
1542
|
/** Optional bandwidth limit forwarded to the engine. */
|
|
1447
1543
|
bandwidthLimit?: TransferBandwidthLimit;
|
|
@@ -2084,8 +2180,13 @@ interface FileZillaSite {
|
|
|
2084
2180
|
folder: readonly string[];
|
|
2085
2181
|
/** Generated connection profile. */
|
|
2086
2182
|
profile: ConnectionProfile;
|
|
2087
|
-
/**
|
|
2088
|
-
|
|
2183
|
+
/**
|
|
2184
|
+
* Whether the FileZilla entry stored a password. The importer never decodes
|
|
2185
|
+
* or returns stored passwords; supply the credential via a
|
|
2186
|
+
* {@link ConnectionProfile.password | SecretSource} (for example
|
|
2187
|
+
* `{ env: "SITE_PASSWORD" }` or `{ path: "./secret" }`) before connecting.
|
|
2188
|
+
*/
|
|
2189
|
+
hasStoredPassword: boolean;
|
|
2089
2190
|
/** Logon type code preserved from the file (`0`=anonymous, `1`=normal, etc.). */
|
|
2090
2191
|
logonType?: number;
|
|
2091
2192
|
}
|
|
@@ -2142,16 +2243,6 @@ interface ImportWinScpSessionsResult {
|
|
|
2142
2243
|
*/
|
|
2143
2244
|
declare function importWinScpSessions(ini: string): ImportWinScpSessionsResult;
|
|
2144
2245
|
|
|
2145
|
-
/**
|
|
2146
|
-
* Structured ZeroTransfer error hierarchy.
|
|
2147
|
-
*
|
|
2148
|
-
* The classes in this module preserve protocol details, retryability, command/path
|
|
2149
|
-
* context, and machine-readable codes so application code does not need to parse
|
|
2150
|
-
* human error messages.
|
|
2151
|
-
*
|
|
2152
|
-
* @module errors/ZeroTransferError
|
|
2153
|
-
*/
|
|
2154
|
-
|
|
2155
2246
|
/**
|
|
2156
2247
|
* Complete set of fields required to create a ZeroTransfer error.
|
|
2157
2248
|
*/
|
|
@@ -2217,6 +2308,11 @@ declare class ZeroTransferError extends Error {
|
|
|
2217
2308
|
/**
|
|
2218
2309
|
* Serializes the error into a plain object suitable for logs or API responses.
|
|
2219
2310
|
*
|
|
2311
|
+
* `details` and `command` are passed through secret redaction so serialized
|
|
2312
|
+
* errors never leak credentials, signed URLs, or raw protocol commands. The
|
|
2313
|
+
* live {@link ZeroTransferError.details | details} property stays unredacted
|
|
2314
|
+
* for programmatic consumers.
|
|
2315
|
+
*
|
|
2220
2316
|
* @returns A JSON-safe object containing public structured error fields.
|
|
2221
2317
|
*/
|
|
2222
2318
|
toJSON(): Record<string, unknown>;
|
|
@@ -2420,6 +2516,32 @@ declare function redactValue(value: unknown): unknown;
|
|
|
2420
2516
|
* @returns A shallow object copy with sensitive fields and nested secrets redacted.
|
|
2421
2517
|
*/
|
|
2422
2518
|
declare function redactObject(input: Record<string, unknown>): Record<string, unknown>;
|
|
2519
|
+
/**
|
|
2520
|
+
* Strips credentials and query/fragment content from a URL before logging.
|
|
2521
|
+
*
|
|
2522
|
+
* Query strings routinely carry bearer material - SigV4 `X-Amz-Signature`
|
|
2523
|
+
* values, SAS tokens, signed-URL parameters - so the entire search and hash
|
|
2524
|
+
* segments are replaced rather than filtered key-by-key. Embedded
|
|
2525
|
+
* `user:password@` userinfo is removed. Origin and pathname are preserved
|
|
2526
|
+
* because they are what operators need to correlate a failing request.
|
|
2527
|
+
*
|
|
2528
|
+
* @param url - Absolute URL string or `URL` instance to sanitize.
|
|
2529
|
+
* @returns A loggable URL string, or {@link REDACTED} when the value cannot be
|
|
2530
|
+
* parsed as a URL (an unparsable value may still embed credentials).
|
|
2531
|
+
*/
|
|
2532
|
+
declare function redactUrlForLogging(url: string | URL): string;
|
|
2533
|
+
/**
|
|
2534
|
+
* Converts an arbitrary thrown value into a JSON-safe, secret-free record.
|
|
2535
|
+
*
|
|
2536
|
+
* Structured SDK errors are serialized through their `toJSON()` (which already
|
|
2537
|
+
* redacts details); plain errors contribute name/message/stack-free context;
|
|
2538
|
+
* other values are stringified. Use this at every internal log site that
|
|
2539
|
+
* records a caught error.
|
|
2540
|
+
*
|
|
2541
|
+
* @param error - Caught value of unknown shape.
|
|
2542
|
+
* @returns A redacted, JSON-safe object describing the error.
|
|
2543
|
+
*/
|
|
2544
|
+
declare function redactErrorForLogging(error: unknown): Record<string, unknown>;
|
|
2423
2545
|
|
|
2424
2546
|
/** Sleep helper signature used by {@link createBandwidthThrottle}. */
|
|
2425
2547
|
type BandwidthSleep = (delayMs: number, signal?: AbortSignal) => Promise<void>;
|
|
@@ -2471,6 +2593,73 @@ declare function createBandwidthThrottle(limit: TransferBandwidthLimit | undefin
|
|
|
2471
2593
|
*/
|
|
2472
2594
|
declare function throttleByteIterable(source: AsyncIterable<Uint8Array>, throttle: BandwidthThrottle | undefined, signal?: AbortSignal): AsyncIterable<Uint8Array>;
|
|
2473
2595
|
|
|
2596
|
+
/** Options for {@link createDefaultRetryPolicy}. */
|
|
2597
|
+
interface DefaultRetryPolicyOptions {
|
|
2598
|
+
/** Maximum total attempts, including the first attempt. Defaults to `4`. */
|
|
2599
|
+
maxAttempts?: number;
|
|
2600
|
+
/** Base backoff delay before jitter in milliseconds. Defaults to `250`. */
|
|
2601
|
+
baseDelayMs?: number;
|
|
2602
|
+
/** Upper bound for a single computed backoff delay in milliseconds. Defaults to `30_000`. */
|
|
2603
|
+
maxDelayMs?: number;
|
|
2604
|
+
/**
|
|
2605
|
+
* Total elapsed-time budget across all attempts and delays in milliseconds.
|
|
2606
|
+
* Once exceeded, no further retries are attempted. Defaults to `300_000` (5 minutes).
|
|
2607
|
+
*/
|
|
2608
|
+
maxElapsedMs?: number;
|
|
2609
|
+
/**
|
|
2610
|
+
* Random source in `[0, 1)` used for jitter. Defaults to `Math.random`.
|
|
2611
|
+
* Inject a deterministic source in tests.
|
|
2612
|
+
*/
|
|
2613
|
+
random?: () => number;
|
|
2614
|
+
}
|
|
2615
|
+
/**
|
|
2616
|
+
* Creates the SDK's recommended retry policy for transfer execution.
|
|
2617
|
+
*
|
|
2618
|
+
* The policy retries only failures the SDK has marked as safe to retry
|
|
2619
|
+
* (`error.retryable === true` on a {@link ZeroTransferError}), backing off
|
|
2620
|
+
* exponentially with full jitter: each delay is drawn uniformly from
|
|
2621
|
+
* `[0, min(maxDelayMs, baseDelayMs * 2^(attempt - 1)))`, the schedule that
|
|
2622
|
+
* minimizes contention when many clients retry against the same server.
|
|
2623
|
+
*
|
|
2624
|
+
* Server pacing hints are honored: when the failed attempt carries
|
|
2625
|
+
* `details.retryAfterMs` (parsed from an HTTP `Retry-After` header on 429/503
|
|
2626
|
+
* responses by the web-family providers), the next delay is exactly that
|
|
2627
|
+
* value rather than the jittered backoff. A hint that does not fit in the
|
|
2628
|
+
* remaining `maxElapsedMs` budget stops retrying instead of retrying early.
|
|
2629
|
+
*
|
|
2630
|
+
* Retries also stop once `maxElapsedMs` has elapsed since execution started,
|
|
2631
|
+
* regardless of how many attempts remain.
|
|
2632
|
+
*
|
|
2633
|
+
* @param options - Optional overrides for attempts, delays, and the elapsed budget.
|
|
2634
|
+
* @returns A {@link TransferRetryPolicy} for {@link TransferEngine.execute},
|
|
2635
|
+
* {@link runRoute}, {@link TransferQueue}, or client-level defaults.
|
|
2636
|
+
*
|
|
2637
|
+
* @example Default policy on a one-shot helper
|
|
2638
|
+
* ```ts
|
|
2639
|
+
* import { createDefaultRetryPolicy, uploadFile } from "@zero-transfer/sdk";
|
|
2640
|
+
*
|
|
2641
|
+
* await uploadFile({
|
|
2642
|
+
* client,
|
|
2643
|
+
* destination: { path: "/uploads/report.csv", profile },
|
|
2644
|
+
* localPath: "./out/report.csv",
|
|
2645
|
+
* retry: createDefaultRetryPolicy(),
|
|
2646
|
+
* });
|
|
2647
|
+
* ```
|
|
2648
|
+
*
|
|
2649
|
+
* @example Tighter schedule for latency-sensitive work
|
|
2650
|
+
* ```ts
|
|
2651
|
+
* const retry = createDefaultRetryPolicy({
|
|
2652
|
+
* maxAttempts: 3,
|
|
2653
|
+
* baseDelayMs: 100,
|
|
2654
|
+
* maxDelayMs: 2_000,
|
|
2655
|
+
* maxElapsedMs: 15_000,
|
|
2656
|
+
* });
|
|
2657
|
+
* ```
|
|
2658
|
+
*
|
|
2659
|
+
* @see {@link TransferRetryPolicy} for the underlying hook contract.
|
|
2660
|
+
*/
|
|
2661
|
+
declare function createDefaultRetryPolicy(options?: DefaultRetryPolicyOptions): TransferRetryPolicy;
|
|
2662
|
+
|
|
2474
2663
|
/**
|
|
2475
2664
|
* Transfer executor bridge for provider-backed read/write sessions.
|
|
2476
2665
|
*
|
|
@@ -2626,6 +2815,12 @@ declare function summarizeTransferPlan(plan: TransferPlan): TransferPlanSummary;
|
|
|
2626
2815
|
/** Converts executable plan steps into transfer jobs while preserving order. */
|
|
2627
2816
|
declare function createTransferJobsFromPlan(plan: TransferPlan): TransferJob[];
|
|
2628
2817
|
|
|
2818
|
+
/**
|
|
2819
|
+
* Transfer queue primitives built on top of {@link TransferEngine}.
|
|
2820
|
+
*
|
|
2821
|
+
* @module transfers/TransferQueue
|
|
2822
|
+
*/
|
|
2823
|
+
|
|
2629
2824
|
/** Queue item lifecycle state. */
|
|
2630
2825
|
type TransferQueueItemStatus = "queued" | "running" | "completed" | "failed" | "canceled";
|
|
2631
2826
|
/** Resolver used when jobs do not provide an executor at enqueue time. */
|
|
@@ -2634,15 +2829,20 @@ type TransferQueueExecutorResolver = (job: TransferJob) => TransferExecutor;
|
|
|
2634
2829
|
interface TransferQueueOptions {
|
|
2635
2830
|
/** Transfer engine used to execute queued jobs. Defaults to a new engine. */
|
|
2636
2831
|
engine?: TransferEngine;
|
|
2832
|
+
/**
|
|
2833
|
+
* Transfer client whose {@link TransferClientDefaults | defaults} seed the
|
|
2834
|
+
* queue's retry and timeout policies when not set here or per drain.
|
|
2835
|
+
*/
|
|
2836
|
+
client?: TransferClient;
|
|
2637
2837
|
/** Maximum jobs to execute at the same time. Defaults to `1`. */
|
|
2638
2838
|
concurrency?: number;
|
|
2639
2839
|
/** Default executor used for jobs that do not provide one directly. */
|
|
2640
2840
|
executor?: TransferExecutor;
|
|
2641
2841
|
/** Dynamic executor resolver used when no per-job executor or default executor exists. */
|
|
2642
2842
|
resolveExecutor?: TransferQueueExecutorResolver;
|
|
2643
|
-
/** Retry policy passed to engine executions. */
|
|
2843
|
+
/** Retry policy passed to engine executions. Falls back to `client.defaults.retry`. */
|
|
2644
2844
|
retry?: TransferRetryPolicy;
|
|
2645
|
-
/** Timeout policy passed to engine executions. */
|
|
2845
|
+
/** Timeout policy passed to engine executions. Falls back to `client.defaults.timeout`. */
|
|
2646
2846
|
timeout?: TransferTimeoutPolicy;
|
|
2647
2847
|
/** Optional throughput limit shape passed to transfer executors. */
|
|
2648
2848
|
bandwidthLimit?: TransferBandwidthLimit;
|
|
@@ -3437,10 +3637,14 @@ declare function createProgressEvent(input: ProgressEventInput): TransferProgres
|
|
|
3437
3637
|
/**
|
|
3438
3638
|
* Validates that an FTP command argument cannot inject additional command lines.
|
|
3439
3639
|
*
|
|
3640
|
+
* NUL bytes are rejected alongside CR/LF: C-string-based servers and filesystem
|
|
3641
|
+
* APIs truncate at the first NUL, which lets a crafted path smuggle a different
|
|
3642
|
+
* effective target past validation.
|
|
3643
|
+
*
|
|
3440
3644
|
* @param value - Argument value to validate.
|
|
3441
3645
|
* @param label - Human-readable argument label used in error messages.
|
|
3442
3646
|
* @returns The original value when it is safe.
|
|
3443
|
-
* @throws {@link ConfigurationError} When the value contains CR or
|
|
3647
|
+
* @throws {@link ConfigurationError} When the value contains CR, LF, or NUL characters.
|
|
3444
3648
|
*/
|
|
3445
3649
|
declare function assertSafeFtpArgument(value: string, label?: string): string;
|
|
3446
3650
|
/**
|
|
@@ -3448,7 +3652,7 @@ declare function assertSafeFtpArgument(value: string, label?: string): string;
|
|
|
3448
3652
|
*
|
|
3449
3653
|
* @param input - Remote path that may contain duplicate separators or dot segments.
|
|
3450
3654
|
* @returns A normalized remote path, `/` for absolute root, or `.` for an empty relative path.
|
|
3451
|
-
* @throws {@link ConfigurationError} When the input contains unsafe CR or
|
|
3655
|
+
* @throws {@link ConfigurationError} When the input contains unsafe CR, LF, or NUL characters.
|
|
3452
3656
|
*/
|
|
3453
3657
|
declare function normalizeRemotePath(input: string): string;
|
|
3454
3658
|
/**
|
|
@@ -3924,7 +4128,7 @@ declare class SftpSession {
|
|
|
3924
4128
|
}
|
|
3925
4129
|
|
|
3926
4130
|
/**
|
|
3927
|
-
* Options for {@link
|
|
4131
|
+
* Options for {@link createSftpProviderFactory}.
|
|
3928
4132
|
*
|
|
3929
4133
|
* The native provider is a zero-dependency replacement for the legacy
|
|
3930
4134
|
* `ssh2`-backed provider. It implements RFC 4253 SSH transport, RFC 4252 user
|
|
@@ -3932,7 +4136,7 @@ declare class SftpSession {
|
|
|
3932
4136
|
* Ed25519/RSA), RFC 5656 ECDSA host keys (`nistp256/384/521`), and the
|
|
3933
4137
|
* SFTP v3 client protocol multiplexed over a single channel.
|
|
3934
4138
|
*/
|
|
3935
|
-
interface
|
|
4139
|
+
interface SftpProviderOptions {
|
|
3936
4140
|
/**
|
|
3937
4141
|
* Default connection timeout in milliseconds when the profile omits
|
|
3938
4142
|
* `timeoutMs`. Bounds both the TCP connect *and* the SSH identification +
|
|
@@ -3963,7 +4167,7 @@ interface NativeSftpProviderOptions {
|
|
|
3963
4167
|
* advanced extension. Most applications should use the
|
|
3964
4168
|
* {@link TransferSession} returned from `client.connect()` instead.
|
|
3965
4169
|
*/
|
|
3966
|
-
interface
|
|
4170
|
+
interface SftpRawSession {
|
|
3967
4171
|
/** SFTP v3 client multiplexed over the SSH session channel. */
|
|
3968
4172
|
sftp: SftpSession;
|
|
3969
4173
|
/** Underlying SSH transport (key exchange, packet protection, channel mux). */
|
|
@@ -4002,7 +4206,7 @@ interface NativeSftpRawSession {
|
|
|
4002
4206
|
* @example
|
|
4003
4207
|
* ```ts
|
|
4004
4208
|
* const client = createTransferClient({
|
|
4005
|
-
* providers: [
|
|
4209
|
+
* providers: [createSftpProviderFactory({
|
|
4006
4210
|
* readyTimeoutMs: 10_000,
|
|
4007
4211
|
* keepaliveIntervalMs: 30_000,
|
|
4008
4212
|
* })],
|
|
@@ -4018,6 +4222,6 @@ interface NativeSftpRawSession {
|
|
|
4018
4222
|
* });
|
|
4019
4223
|
* ```
|
|
4020
4224
|
*/
|
|
4021
|
-
declare function
|
|
4225
|
+
declare function createSftpProviderFactory(options?: SftpProviderOptions): ProviderFactory;
|
|
4022
4226
|
|
|
4023
|
-
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
|
|
4227
|
+
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 DefaultRetryPolicyOptions, 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 ProviderFactory, type ProviderId, 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 SftpProviderOptions, type SftpRawSession, 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 TransferClientDefaults, 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 WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildRemoteBreadcrumbs, compareRemoteManifests, copyBetween, createAtomicDeployPlan, createBandwidthThrottle, createDefaultRetryPolicy, createLocalProviderFactory, createMemoryProviderFactory, createOAuthTokenSecretSource, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createSftpProviderFactory, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, diffRemoteTrees, downloadFile, emitLog, errorFromFtpReply, filterRemoteEntries, importFileZillaSites, importOpenSshConfig, importWinScpSessions, isClassicProviderId, isMainModule, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, noopLogger, normalizeRemotePath, parentRemotePath, parseKnownHosts, parseOpenSshConfig, parseRemoteManifest, redactCommand, redactConnectionProfile, redactErrorForLogging, redactObject, redactSecretSource, redactUrlForLogging, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };
|