@zero-transfer/sftp 0.4.0 → 0.4.6
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 +15 -7
- package/dist/index.cjs +23 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +257 -9
- package/dist/index.d.ts +257 -9
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -395,7 +395,7 @@ interface TlsProfile {
|
|
|
395
395
|
* hex form with or without colons. When present, the TLS handshake additionally requires the
|
|
396
396
|
* leaf certificate's SHA-256 fingerprint to match one of these values.
|
|
397
397
|
*
|
|
398
|
-
* Not required for normal CA-trusted endpoints
|
|
398
|
+
* Not required for normal CA-trusted endpoints - public CAs and `ca` bundles already gate
|
|
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
|
*
|
|
@@ -834,7 +834,41 @@ interface TransferEngineOptions {
|
|
|
834
834
|
/** Clock used for receipts and progress events. Defaults to `new Date()`. */
|
|
835
835
|
now?: () => Date;
|
|
836
836
|
}
|
|
837
|
-
/**
|
|
837
|
+
/**
|
|
838
|
+
* Executes transfer jobs and produces audit-friendly receipts.
|
|
839
|
+
*
|
|
840
|
+
* The engine is the lowest-level entry point in the transfer stack: it owns
|
|
841
|
+
* retry policy, attempt history, abort propagation, progress event
|
|
842
|
+
* normalization, and receipt construction. Most callers reach the engine
|
|
843
|
+
* indirectly through {@link runRoute}, {@link uploadFile}, {@link downloadFile},
|
|
844
|
+
* {@link copyBetween}, or {@link TransferQueue}; instantiate it directly when
|
|
845
|
+
* you need full control over execution semantics.
|
|
846
|
+
*
|
|
847
|
+
* @example Execute a single job with a custom executor
|
|
848
|
+
* ```ts
|
|
849
|
+
* import { TransferEngine, type TransferExecutor, type TransferJob } from "@zero-transfer/sdk";
|
|
850
|
+
*
|
|
851
|
+
* const engine = new TransferEngine();
|
|
852
|
+
*
|
|
853
|
+
* const executor: TransferExecutor = async ({ job, signal, onProgress }) => {
|
|
854
|
+
* onProgress?.({ jobId: job.id, bytesTransferred: 0 });
|
|
855
|
+
* // … perform the bytes here, honoring `signal` …
|
|
856
|
+
* return { jobId: job.id, bytesTransferred: 1234, completedAt: new Date() };
|
|
857
|
+
* };
|
|
858
|
+
*
|
|
859
|
+
* const job: TransferJob = {
|
|
860
|
+
* id: "manual-1",
|
|
861
|
+
* operation: "upload",
|
|
862
|
+
* source: { profile: localProfile, path: "./data.bin" },
|
|
863
|
+
* destination: { profile: s3Profile, path: "/data/data.bin" },
|
|
864
|
+
* };
|
|
865
|
+
*
|
|
866
|
+
* const receipt = await engine.execute(job, executor, {
|
|
867
|
+
* retry: { maxAttempts: 3, baseDelayMs: 250 },
|
|
868
|
+
* });
|
|
869
|
+
* console.log(receipt.attempts.length); // 1 on success
|
|
870
|
+
* ```
|
|
871
|
+
*/
|
|
838
872
|
declare class TransferEngine {
|
|
839
873
|
private readonly now;
|
|
840
874
|
/**
|
|
@@ -1585,8 +1619,20 @@ interface ClientDiagnostics {
|
|
|
1585
1619
|
/**
|
|
1586
1620
|
* Returns a redaction-safe snapshot of the providers registered with a client.
|
|
1587
1621
|
*
|
|
1622
|
+
* Use this when rendering a setup screen, generating a support bundle, or
|
|
1623
|
+
* asserting in tests that the expected provider factories were registered.
|
|
1624
|
+
*
|
|
1588
1625
|
* @param client - Transfer client to inspect.
|
|
1589
1626
|
* @returns Provider id and capability snapshot tuples.
|
|
1627
|
+
*
|
|
1628
|
+
* @example List registered providers
|
|
1629
|
+
* ```ts
|
|
1630
|
+
* import { summarizeClientDiagnostics } from "@zero-transfer/sdk";
|
|
1631
|
+
*
|
|
1632
|
+
* for (const { id, capabilities } of summarizeClientDiagnostics(client).providers) {
|
|
1633
|
+
* console.log(`${id}: streaming=${capabilities.readStream} resume=${capabilities.resumeDownload}`);
|
|
1634
|
+
* }
|
|
1635
|
+
* ```
|
|
1590
1636
|
*/
|
|
1591
1637
|
declare function summarizeClientDiagnostics(client: TransferClient): ClientDiagnostics;
|
|
1592
1638
|
/** Per-step duration measurements collected by {@link runConnectionDiagnostics}. */
|
|
@@ -1639,8 +1685,36 @@ interface RunConnectionDiagnosticsOptions {
|
|
|
1639
1685
|
/**
|
|
1640
1686
|
* Connects to a profile, captures capability and listing samples, and returns a redaction-safe report.
|
|
1641
1687
|
*
|
|
1688
|
+
* Useful for connectivity "ping" pages, smoke tests, and bug reports. Secrets
|
|
1689
|
+
* in the profile are redacted via {@link redactConnectionProfile} before being
|
|
1690
|
+
* returned. The session is always disconnected before the function returns,
|
|
1691
|
+
* including when probes throw.
|
|
1692
|
+
*
|
|
1642
1693
|
* @param options - Diagnostic probe options.
|
|
1643
1694
|
* @returns Diagnostic report including timings and any captured error.
|
|
1695
|
+
*
|
|
1696
|
+
* @example Probe an SFTP connection
|
|
1697
|
+
* ```ts
|
|
1698
|
+
* import { runConnectionDiagnostics } from "@zero-transfer/sdk";
|
|
1699
|
+
*
|
|
1700
|
+
* const report = await runConnectionDiagnostics({
|
|
1701
|
+
* client,
|
|
1702
|
+
* profile: {
|
|
1703
|
+
* host: "sftp.example.com",
|
|
1704
|
+
* provider: "sftp",
|
|
1705
|
+
* username: "deploy",
|
|
1706
|
+
* ssh: { privateKey: { path: "./keys/id_ed25519" } },
|
|
1707
|
+
* },
|
|
1708
|
+
* listPath: "/uploads",
|
|
1709
|
+
* });
|
|
1710
|
+
*
|
|
1711
|
+
* if (!report.ok) {
|
|
1712
|
+
* console.error("connection failed:", report.error);
|
|
1713
|
+
* } else {
|
|
1714
|
+
* console.log(`connect=${report.timings.connectMs}ms list=${report.timings.listMs}ms`);
|
|
1715
|
+
* console.log(report.sample); // up to 5 entries from /uploads
|
|
1716
|
+
* }
|
|
1717
|
+
* ```
|
|
1644
1718
|
*/
|
|
1645
1719
|
declare function runConnectionDiagnostics(options: RunConnectionDiagnosticsOptions): Promise<ConnectionDiagnosticsResult>;
|
|
1646
1720
|
|
|
@@ -1649,7 +1723,7 @@ interface ConnectionPoolOptions {
|
|
|
1649
1723
|
/**
|
|
1650
1724
|
* Maximum number of *idle* sessions retained per pool key.
|
|
1651
1725
|
*
|
|
1652
|
-
* Active leases are not counted against this limit
|
|
1726
|
+
* Active leases are not counted against this limit - the cap only applies
|
|
1653
1727
|
* to sessions waiting in the pool. When more than `maxIdlePerKey` sessions
|
|
1654
1728
|
* become idle simultaneously, the oldest ones are disconnected. Defaults
|
|
1655
1729
|
* to `4`.
|
|
@@ -1747,8 +1821,29 @@ interface MemoryProviderOptions {
|
|
|
1747
1821
|
/**
|
|
1748
1822
|
* Creates a provider factory backed by deterministic in-memory fixture entries.
|
|
1749
1823
|
*
|
|
1824
|
+
* Useful for tests and examples where you want a real `TransferSession` without
|
|
1825
|
+
* touching disk or the network. Entries are pre-seeded; mutations made through
|
|
1826
|
+
* the session are visible to subsequent operations on the same provider.
|
|
1827
|
+
*
|
|
1750
1828
|
* @param options - Optional fixture entries to expose through the memory provider.
|
|
1751
1829
|
* @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
|
|
1830
|
+
*
|
|
1831
|
+
* @example Seed entries and read them back
|
|
1832
|
+
* ```ts
|
|
1833
|
+
* import { createMemoryProviderFactory, createTransferClient } from "@zero-transfer/sdk";
|
|
1834
|
+
*
|
|
1835
|
+
* const client = createTransferClient({
|
|
1836
|
+
* providers: [createMemoryProviderFactory({
|
|
1837
|
+
* entries: [
|
|
1838
|
+
* { path: "/fixtures/hello.txt", content: "hello world" },
|
|
1839
|
+
* { path: "/fixtures/data.bin", content: new Uint8Array([1, 2, 3]) },
|
|
1840
|
+
* ],
|
|
1841
|
+
* })],
|
|
1842
|
+
* });
|
|
1843
|
+
*
|
|
1844
|
+
* const session = await client.connect({ host: "fixtures", provider: "memory" });
|
|
1845
|
+
* console.log(await session.fs.list("/fixtures"));
|
|
1846
|
+
* ```
|
|
1752
1847
|
*/
|
|
1753
1848
|
declare function createMemoryProviderFactory(options?: MemoryProviderOptions): ProviderFactory;
|
|
1754
1849
|
|
|
@@ -2486,9 +2581,47 @@ interface TransferPlanSummary {
|
|
|
2486
2581
|
/** Counts grouped by action. */
|
|
2487
2582
|
actions: Record<string, number>;
|
|
2488
2583
|
}
|
|
2489
|
-
/**
|
|
2584
|
+
/**
|
|
2585
|
+
* Creates a transfer plan from dry-run planning input.
|
|
2586
|
+
*
|
|
2587
|
+
* Plans are immutable, structured descriptions of intended work. Pair with
|
|
2588
|
+
* {@link createSyncPlan} or {@link createAtomicDeployPlan} for end-to-end
|
|
2589
|
+
* planning, or build steps by hand when you need full control. Pass the plan
|
|
2590
|
+
* to {@link createTransferJobsFromPlan} to materialize executable jobs.
|
|
2591
|
+
*
|
|
2592
|
+
* @example Build a plan with two upload steps and inspect it
|
|
2593
|
+
* ```ts
|
|
2594
|
+
* import { createTransferPlan, summarizeTransferPlan } from "@zero-transfer/sdk";
|
|
2595
|
+
*
|
|
2596
|
+
* const plan = createTransferPlan({
|
|
2597
|
+
* id: "manual-batch",
|
|
2598
|
+
* steps: [
|
|
2599
|
+
* { action: "upload", source: "./a.bin", destination: "/lake/a.bin", expectedBytes: 1024 },
|
|
2600
|
+
* { action: "upload", source: "./b.bin", destination: "/lake/b.bin", expectedBytes: 2048 },
|
|
2601
|
+
* ],
|
|
2602
|
+
* });
|
|
2603
|
+
*
|
|
2604
|
+
* console.table(summarizeTransferPlan(plan));
|
|
2605
|
+
* ```
|
|
2606
|
+
*/
|
|
2490
2607
|
declare function createTransferPlan(input: TransferPlanInput): TransferPlan;
|
|
2491
|
-
/**
|
|
2608
|
+
/**
|
|
2609
|
+
* Summarizes a transfer plan for diagnostics, previews, and tests.
|
|
2610
|
+
*
|
|
2611
|
+
* Returns aggregate counts (total / executable / skipped / destructive),
|
|
2612
|
+
* total expected bytes, and a per-action histogram. Useful for printing a
|
|
2613
|
+
* one-line plan summary before executing or for asserting plan shape in
|
|
2614
|
+
* tests.
|
|
2615
|
+
*
|
|
2616
|
+
* @example Print a plan preview
|
|
2617
|
+
* ```ts
|
|
2618
|
+
* import { summarizeTransferPlan } from "@zero-transfer/sdk";
|
|
2619
|
+
*
|
|
2620
|
+
* const summary = summarizeTransferPlan(plan);
|
|
2621
|
+
* console.log(`${summary.executableSteps} steps, ${summary.totalExpectedBytes} bytes total`);
|
|
2622
|
+
* console.log("Actions:", summary.actions);
|
|
2623
|
+
* ```
|
|
2624
|
+
*/
|
|
2492
2625
|
declare function summarizeTransferPlan(plan: TransferPlan): TransferPlanSummary;
|
|
2493
2626
|
/** Converts executable plan steps into transfer jobs while preserving order. */
|
|
2494
2627
|
declare function createTransferJobsFromPlan(plan: TransferPlan): TransferJob[];
|
|
@@ -2565,7 +2698,41 @@ interface TransferQueueSummary {
|
|
|
2565
2698
|
/** Failed queue items in queue order. */
|
|
2566
2699
|
failures: TransferQueueItem[];
|
|
2567
2700
|
}
|
|
2568
|
-
/**
|
|
2701
|
+
/**
|
|
2702
|
+
* Minimal transfer queue with concurrency, pause/resume, cancellation, and drain summaries.
|
|
2703
|
+
*
|
|
2704
|
+
* Wrap a {@link TransferEngine} with a queue when you need to run many transfers
|
|
2705
|
+
* concurrently with bounded parallelism, observe per-job progress, or drive
|
|
2706
|
+
* a UI from a single source of truth. Items are FIFO; failures and successes
|
|
2707
|
+
* are surfaced via observers and in the final {@link TransferQueueSummary}.
|
|
2708
|
+
*
|
|
2709
|
+
* @example Run a batch of uploads with concurrency=4
|
|
2710
|
+
* ```ts
|
|
2711
|
+
* import {
|
|
2712
|
+
* TransferQueue,
|
|
2713
|
+
* createProviderTransferExecutor,
|
|
2714
|
+
* } from "@zero-transfer/sdk";
|
|
2715
|
+
*
|
|
2716
|
+
* const queue = new TransferQueue({
|
|
2717
|
+
* concurrency: 4,
|
|
2718
|
+
* executor: createProviderTransferExecutor({ client }),
|
|
2719
|
+
* onProgress: (e) => console.log(`${e.jobId}: ${e.bytesTransferred}`),
|
|
2720
|
+
* onError: (item, err) => console.error(`${item.job.id} failed`, err),
|
|
2721
|
+
* });
|
|
2722
|
+
*
|
|
2723
|
+
* for (const file of files) {
|
|
2724
|
+
* queue.enqueue({
|
|
2725
|
+
* id: file.name,
|
|
2726
|
+
* operation: "upload",
|
|
2727
|
+
* source: { profile: localProfile, path: file.path },
|
|
2728
|
+
* destination: { profile: s3Profile, path: `/lake/${file.name}` },
|
|
2729
|
+
* });
|
|
2730
|
+
* }
|
|
2731
|
+
*
|
|
2732
|
+
* const summary = await queue.drain();
|
|
2733
|
+
* console.log(`Completed ${summary.completed} / ${summary.total}`);
|
|
2734
|
+
* ```
|
|
2735
|
+
*/
|
|
2569
2736
|
declare class TransferQueue {
|
|
2570
2737
|
private readonly engine;
|
|
2571
2738
|
private readonly items;
|
|
@@ -2836,7 +3003,7 @@ interface DiffRemoteTreesOptions {
|
|
|
2836
3003
|
* Compares two remote subtrees and produces an entry-level diff.
|
|
2837
3004
|
*
|
|
2838
3005
|
* Source and destination paths are walked independently; entries are then aligned by
|
|
2839
|
-
* the relative path from each tree root. Directory equality is structural
|
|
3006
|
+
* the relative path from each tree root. Directory equality is structural - directories
|
|
2840
3007
|
* are equal when their relative paths match and the entry types agree.
|
|
2841
3008
|
*
|
|
2842
3009
|
* @param source - Source-side remote file system.
|
|
@@ -2845,6 +3012,26 @@ interface DiffRemoteTreesOptions {
|
|
|
2845
3012
|
* @param destinationPath - Destination-side root path being compared.
|
|
2846
3013
|
* @param options - Optional comparison controls.
|
|
2847
3014
|
* @returns Diff result containing entries and a summary.
|
|
3015
|
+
*
|
|
3016
|
+
* @example Diff two SFTP subtrees and feed the result into createSyncPlan
|
|
3017
|
+
* ```ts
|
|
3018
|
+
* import { createSyncPlan, diffRemoteTrees } from "@zero-transfer/sdk";
|
|
3019
|
+
*
|
|
3020
|
+
* const diff = await diffRemoteTrees(
|
|
3021
|
+
* srcSession.fs, "/exports",
|
|
3022
|
+
* dstSession.fs, "/exports",
|
|
3023
|
+
* { compareUniqueId: true },
|
|
3024
|
+
* );
|
|
3025
|
+
*
|
|
3026
|
+
* console.log(diff.summary); // { added, removed, changed, unchanged }
|
|
3027
|
+
*
|
|
3028
|
+
* const plan = createSyncPlan({
|
|
3029
|
+
* id: "exports-sync",
|
|
3030
|
+
* diff,
|
|
3031
|
+
* source: { provider: "sftp", rootPath: "/exports" },
|
|
3032
|
+
* destination: { provider: "sftp", rootPath: "/exports" },
|
|
3033
|
+
* });
|
|
3034
|
+
* ```
|
|
2848
3035
|
*/
|
|
2849
3036
|
declare function diffRemoteTrees(source: RemoteFileSystem, sourcePath: string, destination: RemoteFileSystem, destinationPath: string, options?: DiffRemoteTreesOptions): Promise<RemoteTreeDiff>;
|
|
2850
3037
|
|
|
@@ -2916,6 +3103,31 @@ interface CreateSyncPlanOptions {
|
|
|
2916
3103
|
* @param options - Inputs and policies that shape the plan.
|
|
2917
3104
|
* @returns Transfer plan ready for `createTransferJobsFromPlan` or queue execution.
|
|
2918
3105
|
* @throws {@link ConfigurationError} When `conflictPolicy: "error"` encounters a conflict.
|
|
3106
|
+
*
|
|
3107
|
+
* @example Mirror SFTP → S3 with deletes
|
|
3108
|
+
* ```ts
|
|
3109
|
+
* import {
|
|
3110
|
+
* createSyncPlan,
|
|
3111
|
+
* diffRemoteTrees,
|
|
3112
|
+
* summarizeTransferPlan,
|
|
3113
|
+
* } from "@zero-transfer/sdk";
|
|
3114
|
+
*
|
|
3115
|
+
* const diff = await diffRemoteTrees(
|
|
3116
|
+
* srcSession.fs, "/dist",
|
|
3117
|
+
* dstSession.fs, "/releases/current",
|
|
3118
|
+
* );
|
|
3119
|
+
*
|
|
3120
|
+
* const plan = createSyncPlan({
|
|
3121
|
+
* id: "release-mirror",
|
|
3122
|
+
* diff,
|
|
3123
|
+
* source: { provider: "sftp", rootPath: "/dist" },
|
|
3124
|
+
* destination: { provider: "s3", rootPath: "/releases/current" },
|
|
3125
|
+
* deletePolicy: "mirror",
|
|
3126
|
+
* conflictPolicy: "overwrite",
|
|
3127
|
+
* });
|
|
3128
|
+
*
|
|
3129
|
+
* console.table(summarizeTransferPlan(plan));
|
|
3130
|
+
* ```
|
|
2919
3131
|
*/
|
|
2920
3132
|
declare function createSyncPlan(options: CreateSyncPlanOptions): TransferPlan;
|
|
2921
3133
|
|
|
@@ -3031,9 +3243,39 @@ interface CreateAtomicDeployPlanOptions {
|
|
|
3031
3243
|
/**
|
|
3032
3244
|
* Builds an {@link AtomicDeployPlan} that stages a release, swaps it live, and prunes old releases.
|
|
3033
3245
|
*
|
|
3246
|
+
* The plan describes a blue/green-style deploy:
|
|
3247
|
+
* 1. Upload to a timestamped staging directory under `<destination>/.releases/`.
|
|
3248
|
+
* 2. Atomically swap the `current` symlink/rename to point at the new release.
|
|
3249
|
+
* 3. Optionally prune old releases beyond `retain`.
|
|
3250
|
+
*
|
|
3251
|
+
* No I/O is performed - the host executes the plan steps. Pair with
|
|
3252
|
+
* {@link createTransferPlan} or {@link createTransferJobsFromPlan} to execute.
|
|
3253
|
+
*
|
|
3034
3254
|
* @param options - Inputs and policies that shape the deploy.
|
|
3035
3255
|
* @returns Structured deploy plan ready for execution by the calling host.
|
|
3036
3256
|
* @throws {@link ConfigurationError} When `retain` is less than `1` or the destination root is empty.
|
|
3257
|
+
*
|
|
3258
|
+
* @example Plan a release with rollback path
|
|
3259
|
+
* ```ts
|
|
3260
|
+
* import { createAtomicDeployPlan } from "@zero-transfer/sdk";
|
|
3261
|
+
*
|
|
3262
|
+
* const plan = createAtomicDeployPlan({
|
|
3263
|
+
* id: "web-2026-04-28",
|
|
3264
|
+
* source: { rootPath: "./dist" },
|
|
3265
|
+
* destination: {
|
|
3266
|
+
* profile: { host: "web1.example.com", provider: "sftp", username: "deploy" },
|
|
3267
|
+
* rootPath: "/srv/www",
|
|
3268
|
+
* },
|
|
3269
|
+
* retain: 5,
|
|
3270
|
+
* existingReleases: [
|
|
3271
|
+
* "/srv/www/.releases/2026-04-21T00-00-00Z",
|
|
3272
|
+
* "/srv/www/.releases/2026-04-14T00-00-00Z",
|
|
3273
|
+
* ],
|
|
3274
|
+
* });
|
|
3275
|
+
*
|
|
3276
|
+
* console.log(plan.swap); // staging → current rename
|
|
3277
|
+
* console.log(plan.prune); // releases scheduled for removal
|
|
3278
|
+
* ```
|
|
3037
3279
|
*/
|
|
3038
3280
|
declare function createAtomicDeployPlan(options: CreateAtomicDeployPlanOptions): AtomicDeployPlan;
|
|
3039
3281
|
|
|
@@ -3226,6 +3468,12 @@ declare function joinRemotePath(...segments: string[]): string;
|
|
|
3226
3468
|
*/
|
|
3227
3469
|
declare function basenameRemotePath(input: string): string;
|
|
3228
3470
|
|
|
3471
|
+
/**
|
|
3472
|
+
* Returns `true` when the file containing `import.meta.url` is the entry point
|
|
3473
|
+
* of the current Node.js process. Returns `false` outside Node.
|
|
3474
|
+
*/
|
|
3475
|
+
declare function isMainModule(importMetaUrl: string): boolean;
|
|
3476
|
+
|
|
3229
3477
|
/** Algorithm lists exchanged during SSH KEXINIT negotiation. */
|
|
3230
3478
|
interface SshAlgorithmPreferences {
|
|
3231
3479
|
compressionClientToServer: readonly string[];
|
|
@@ -3723,7 +3971,7 @@ interface NativeSftpRawSession {
|
|
|
3723
3971
|
}
|
|
3724
3972
|
/**
|
|
3725
3973
|
* Creates a {@link ProviderFactory} backed by the native SSH/SFTP protocol
|
|
3726
|
-
* stack
|
|
3974
|
+
* stack - no `ssh2` dependency required.
|
|
3727
3975
|
*
|
|
3728
3976
|
* **Supported algorithms**
|
|
3729
3977
|
* - Key exchange: `curve25519-sha256`, `curve25519-sha256@libssh.org`
|
|
@@ -3772,4 +4020,4 @@ interface NativeSftpRawSession {
|
|
|
3772
4020
|
*/
|
|
3773
4021
|
declare function createNativeSftpProviderFactory(options?: NativeSftpProviderOptions): ProviderFactory;
|
|
3774
4022
|
|
|
3775
|
-
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 NativeSftpProviderOptions, type NativeSftpRawSession, 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 NativeSftpProviderOptions as SftpProviderOptions, type NativeSftpRawSession as 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 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, createLocalProviderFactory, createMemoryProviderFactory, createNativeSftpProviderFactory, createOAuthTokenSecretSource, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createNativeSftpProviderFactory as createSftpProviderFactory, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, 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 };
|
|
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 NativeSftpProviderOptions, type NativeSftpRawSession, 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 NativeSftpProviderOptions as SftpProviderOptions, type NativeSftpRawSession as 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 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, createLocalProviderFactory, createMemoryProviderFactory, createNativeSftpProviderFactory, createOAuthTokenSecretSource, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createNativeSftpProviderFactory as 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, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, serializeRemoteManifest, sortRemoteEntries, summarizeClientDiagnostics, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, walkRemoteTree };
|
package/dist/index.mjs
CHANGED
|
@@ -4785,6 +4785,19 @@ function isModifiedAtDifferent2(source, destination, toleranceMs) {
|
|
|
4785
4785
|
return Math.abs(sourceTime - destinationTime) > toleranceMs;
|
|
4786
4786
|
}
|
|
4787
4787
|
|
|
4788
|
+
// src/utils/mainModule.ts
|
|
4789
|
+
import { fileURLToPath } from "url";
|
|
4790
|
+
function isMainModule(importMetaUrl) {
|
|
4791
|
+
if (typeof process === "undefined" || !process.argv || process.argv.length < 2) {
|
|
4792
|
+
return false;
|
|
4793
|
+
}
|
|
4794
|
+
try {
|
|
4795
|
+
return process.argv[1] === fileURLToPath(importMetaUrl);
|
|
4796
|
+
} catch {
|
|
4797
|
+
return false;
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
|
|
4788
4801
|
// src/providers/native/sftp/NativeSftpProvider.ts
|
|
4789
4802
|
import { Buffer as Buffer21 } from "buffer";
|
|
4790
4803
|
import { createHash as createHash3, createPrivateKey } from "crypto";
|
|
@@ -7070,7 +7083,7 @@ var SshTransportPacketUnprotector = class {
|
|
|
7070
7083
|
}
|
|
7071
7084
|
/**
|
|
7072
7085
|
* Feeds raw encrypted bytes from the socket and returns any fully decoded payloads.
|
|
7073
|
-
* Maintains internal framing state across calls
|
|
7086
|
+
* Maintains internal framing state across calls - pass each `data` event chunk directly.
|
|
7074
7087
|
*/
|
|
7075
7088
|
pushBytes(chunk) {
|
|
7076
7089
|
this.framePendingRaw = Buffer17.concat([this.framePendingRaw, chunk]);
|
|
@@ -7578,7 +7591,7 @@ var SshTransportConnection = class {
|
|
|
7578
7591
|
assertConnected() {
|
|
7579
7592
|
if (!this.connected) {
|
|
7580
7593
|
throw new ProtocolError({
|
|
7581
|
-
message: "SshTransportConnection is not yet connected
|
|
7594
|
+
message: "SshTransportConnection is not yet connected - call connect() first",
|
|
7582
7595
|
protocol: "sftp",
|
|
7583
7596
|
retryable: false
|
|
7584
7597
|
});
|
|
@@ -7918,14 +7931,14 @@ function sftpStatusToError(status, path2) {
|
|
|
7918
7931
|
case SFTP_STATUS.NO_SUCH_FILE:
|
|
7919
7932
|
return new PathNotFoundError({
|
|
7920
7933
|
details: { path: path2, sftpMessage: status.errorMessage },
|
|
7921
|
-
message: `SFTP: no such file or directory${path2 !== void 0 ? `
|
|
7934
|
+
message: `SFTP: no such file or directory${path2 !== void 0 ? ` - ${path2}` : ""}`,
|
|
7922
7935
|
protocol: "sftp",
|
|
7923
7936
|
retryable: false
|
|
7924
7937
|
});
|
|
7925
7938
|
case SFTP_STATUS.PERMISSION_DENIED:
|
|
7926
7939
|
return new PermissionDeniedError({
|
|
7927
7940
|
details: { path: path2, sftpMessage: status.errorMessage },
|
|
7928
|
-
message: `SFTP: permission denied${path2 !== void 0 ? `
|
|
7941
|
+
message: `SFTP: permission denied${path2 !== void 0 ? ` - ${path2}` : ""}`,
|
|
7929
7942
|
protocol: "sftp",
|
|
7930
7943
|
retryable: false
|
|
7931
7944
|
});
|
|
@@ -7933,21 +7946,21 @@ function sftpStatusToError(status, path2) {
|
|
|
7933
7946
|
case SFTP_STATUS.CONNECTION_LOST:
|
|
7934
7947
|
return new ConnectionError({
|
|
7935
7948
|
details: { sftpMessage: status.errorMessage, statusCode: status.statusCode },
|
|
7936
|
-
message: `SFTP: connection error
|
|
7949
|
+
message: `SFTP: connection error - ${status.errorMessage}`,
|
|
7937
7950
|
protocol: "sftp",
|
|
7938
7951
|
retryable: true
|
|
7939
7952
|
});
|
|
7940
7953
|
case SFTP_STATUS.OP_UNSUPPORTED:
|
|
7941
7954
|
return new UnsupportedFeatureError({
|
|
7942
7955
|
details: { sftpMessage: status.errorMessage },
|
|
7943
|
-
message: `SFTP: operation unsupported
|
|
7956
|
+
message: `SFTP: operation unsupported - ${status.errorMessage}`,
|
|
7944
7957
|
protocol: "sftp",
|
|
7945
7958
|
retryable: false
|
|
7946
7959
|
});
|
|
7947
7960
|
case SFTP_STATUS.BAD_MESSAGE:
|
|
7948
7961
|
return new ProtocolError({
|
|
7949
7962
|
details: { sftpMessage: status.errorMessage },
|
|
7950
|
-
message: `SFTP: bad message
|
|
7963
|
+
message: `SFTP: bad message - ${status.errorMessage}`,
|
|
7951
7964
|
protocol: "sftp",
|
|
7952
7965
|
retryable: false
|
|
7953
7966
|
});
|
|
@@ -7955,7 +7968,7 @@ function sftpStatusToError(status, path2) {
|
|
|
7955
7968
|
return new ZeroTransferError({
|
|
7956
7969
|
code: "SFTP_FAILURE",
|
|
7957
7970
|
details: { sftpMessage: status.errorMessage, statusCode: status.statusCode },
|
|
7958
|
-
message: `SFTP: operation failed (status ${status.statusCode})
|
|
7971
|
+
message: `SFTP: operation failed (status ${status.statusCode}) - ${status.errorMessage}`,
|
|
7959
7972
|
protocol: "sftp",
|
|
7960
7973
|
retryable: false
|
|
7961
7974
|
});
|
|
@@ -9076,6 +9089,7 @@ export {
|
|
|
9076
9089
|
importOpenSshConfig,
|
|
9077
9090
|
importWinScpSessions,
|
|
9078
9091
|
isClassicProviderId,
|
|
9092
|
+
isMainModule,
|
|
9079
9093
|
isSensitiveKey,
|
|
9080
9094
|
joinRemotePath,
|
|
9081
9095
|
matchKnownHosts,
|