@zero-transfer/sdk 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/dist/index.d.mts CHANGED
@@ -396,7 +396,7 @@ interface TlsProfile {
396
396
  * hex form with or without colons. When present, the TLS handshake additionally requires the
397
397
  * leaf certificate's SHA-256 fingerprint to match one of these values.
398
398
  *
399
- * Not required for normal CA-trusted endpoints public CAs and `ca` bundles already gate
399
+ * Not required for normal CA-trusted endpoints - public CAs and `ca` bundles already gate
400
400
  * trust via `rejectUnauthorized`. Pinning is **recommended for production** when you control
401
401
  * the server and want defence-in-depth against rogue certificates issued by trusted CAs.
402
402
  *
@@ -835,7 +835,41 @@ interface TransferEngineOptions {
835
835
  /** Clock used for receipts and progress events. Defaults to `new Date()`. */
836
836
  now?: () => Date;
837
837
  }
838
- /** Executes transfer jobs and produces audit-friendly receipts. */
838
+ /**
839
+ * Executes transfer jobs and produces audit-friendly receipts.
840
+ *
841
+ * The engine is the lowest-level entry point in the transfer stack: it owns
842
+ * retry policy, attempt history, abort propagation, progress event
843
+ * normalization, and receipt construction. Most callers reach the engine
844
+ * indirectly through {@link runRoute}, {@link uploadFile}, {@link downloadFile},
845
+ * {@link copyBetween}, or {@link TransferQueue}; instantiate it directly when
846
+ * you need full control over execution semantics.
847
+ *
848
+ * @example Execute a single job with a custom executor
849
+ * ```ts
850
+ * import { TransferEngine, type TransferExecutor, type TransferJob } from "@zero-transfer/sdk";
851
+ *
852
+ * const engine = new TransferEngine();
853
+ *
854
+ * const executor: TransferExecutor = async ({ job, signal, onProgress }) => {
855
+ * onProgress?.({ jobId: job.id, bytesTransferred: 0 });
856
+ * // … perform the bytes here, honoring `signal` …
857
+ * return { jobId: job.id, bytesTransferred: 1234, completedAt: new Date() };
858
+ * };
859
+ *
860
+ * const job: TransferJob = {
861
+ * id: "manual-1",
862
+ * operation: "upload",
863
+ * source: { profile: localProfile, path: "./data.bin" },
864
+ * destination: { profile: s3Profile, path: "/data/data.bin" },
865
+ * };
866
+ *
867
+ * const receipt = await engine.execute(job, executor, {
868
+ * retry: { maxAttempts: 3, baseDelayMs: 250 },
869
+ * });
870
+ * console.log(receipt.attempts.length); // 1 on success
871
+ * ```
872
+ */
839
873
  declare class TransferEngine {
840
874
  private readonly now;
841
875
  /**
@@ -1418,9 +1452,41 @@ interface RunRouteOptions {
1418
1452
  /**
1419
1453
  * Executes an MFT route as a single transfer through the supplied client.
1420
1454
  *
1455
+ * Connects the source and destination profiles, runs the route's transfer
1456
+ * through the engine, and returns the resulting receipt. The friendly helpers
1457
+ * {@link uploadFile}, {@link downloadFile}, and {@link copyBetween} synthesize
1458
+ * routes and delegate to this function, so behaviour around retry, abort,
1459
+ * progress, timeout, and bandwidth limits is identical.
1460
+ *
1421
1461
  * @param options - Client, route, and optional engine/abort/retry hooks.
1422
1462
  * @returns Receipt produced by the underlying transfer engine.
1423
1463
  * @throws {@link ConfigurationError} When the route is disabled.
1464
+ *
1465
+ * @example Run a pre-built route with progress + retry
1466
+ * ```ts
1467
+ * import { createTransferClient, runRoute, type MftRoute } from "@zero-transfer/sdk";
1468
+ *
1469
+ * const route: MftRoute = {
1470
+ * id: "nightly-export",
1471
+ * operation: "copy",
1472
+ * source: {
1473
+ * path: "/exports/daily.csv",
1474
+ * profile: { host: "sftp.example.com", provider: "sftp", username: "etl" },
1475
+ * },
1476
+ * destination: {
1477
+ * path: "warehouse/daily.csv",
1478
+ * profile: { host: "warehouse", provider: "s3", s3: { region: "us-east-1" } },
1479
+ * },
1480
+ * };
1481
+ *
1482
+ * const receipt = await runRoute({
1483
+ * client,
1484
+ * route,
1485
+ * onProgress: (e) => console.log(`${e.bytesTransferred}/${e.totalBytes ?? "?"}`),
1486
+ * retry: { maxAttempts: 3, baseDelayMs: 500 },
1487
+ * });
1488
+ * console.log(`Job ${receipt.jobId} moved ${receipt.bytesTransferred} bytes…`);
1489
+ * ```
1424
1490
  */
1425
1491
  declare function runRoute(options: RunRouteOptions): Promise<TransferReceipt>;
1426
1492
 
@@ -1594,8 +1660,20 @@ interface ClientDiagnostics {
1594
1660
  /**
1595
1661
  * Returns a redaction-safe snapshot of the providers registered with a client.
1596
1662
  *
1663
+ * Use this when rendering a setup screen, generating a support bundle, or
1664
+ * asserting in tests that the expected provider factories were registered.
1665
+ *
1597
1666
  * @param client - Transfer client to inspect.
1598
1667
  * @returns Provider id and capability snapshot tuples.
1668
+ *
1669
+ * @example List registered providers
1670
+ * ```ts
1671
+ * import { summarizeClientDiagnostics } from "@zero-transfer/sdk";
1672
+ *
1673
+ * for (const { id, capabilities } of summarizeClientDiagnostics(client).providers) {
1674
+ * console.log(`${id}: streaming=${capabilities.readStream} resume=${capabilities.resumeDownload}`);
1675
+ * }
1676
+ * ```
1599
1677
  */
1600
1678
  declare function summarizeClientDiagnostics(client: TransferClient): ClientDiagnostics;
1601
1679
  /** Per-step duration measurements collected by {@link runConnectionDiagnostics}. */
@@ -1648,8 +1726,36 @@ interface RunConnectionDiagnosticsOptions {
1648
1726
  /**
1649
1727
  * Connects to a profile, captures capability and listing samples, and returns a redaction-safe report.
1650
1728
  *
1729
+ * Useful for connectivity "ping" pages, smoke tests, and bug reports. Secrets
1730
+ * in the profile are redacted via {@link redactConnectionProfile} before being
1731
+ * returned. The session is always disconnected before the function returns,
1732
+ * including when probes throw.
1733
+ *
1651
1734
  * @param options - Diagnostic probe options.
1652
1735
  * @returns Diagnostic report including timings and any captured error.
1736
+ *
1737
+ * @example Probe an SFTP connection
1738
+ * ```ts
1739
+ * import { runConnectionDiagnostics } from "@zero-transfer/sdk";
1740
+ *
1741
+ * const report = await runConnectionDiagnostics({
1742
+ * client,
1743
+ * profile: {
1744
+ * host: "sftp.example.com",
1745
+ * provider: "sftp",
1746
+ * username: "deploy",
1747
+ * ssh: { privateKey: { path: "./keys/id_ed25519" } },
1748
+ * },
1749
+ * listPath: "/uploads",
1750
+ * });
1751
+ *
1752
+ * if (!report.ok) {
1753
+ * console.error("connection failed:", report.error);
1754
+ * } else {
1755
+ * console.log(`connect=${report.timings.connectMs}ms list=${report.timings.listMs}ms`);
1756
+ * console.log(report.sample); // up to 5 entries from /uploads
1757
+ * }
1758
+ * ```
1653
1759
  */
1654
1760
  declare function runConnectionDiagnostics(options: RunConnectionDiagnosticsOptions): Promise<ConnectionDiagnosticsResult>;
1655
1761
 
@@ -1658,7 +1764,7 @@ interface ConnectionPoolOptions {
1658
1764
  /**
1659
1765
  * Maximum number of *idle* sessions retained per pool key.
1660
1766
  *
1661
- * Active leases are not counted against this limit the cap only applies
1767
+ * Active leases are not counted against this limit - the cap only applies
1662
1768
  * to sessions waiting in the pool. When more than `maxIdlePerKey` sessions
1663
1769
  * become idle simultaneously, the oldest ones are disconnected. Defaults
1664
1770
  * to `4`.
@@ -1717,9 +1823,9 @@ declare function createPooledTransferClient(inner: TransferClient, options?: Con
1717
1823
  *
1718
1824
  * Aggregates the {@link CapabilitySet} advertised by every shipped provider
1719
1825
  * factory so applications, docs, and diagnostics can compare features across
1720
- * providers without instantiating each one. The S3 entry is captured twice
1826
+ * providers without instantiating each one. The S3 entry is captured twice -
1721
1827
  * once with the new multipart-by-default configuration and once with
1722
- * `multipart.enabled: false` for the legacy single-shot variant because
1828
+ * `multipart.enabled: false` for the legacy single-shot variant - because
1723
1829
  * that flag flips `resumeUpload`.
1724
1830
  *
1725
1831
  * @module providers/capabilityMatrix
@@ -1802,7 +1908,31 @@ interface DropboxProviderOptions {
1802
1908
  *
1803
1909
  * The bearer token is resolved per-connection from `profile.password`. The
1804
1910
  * `profile.host` field is unused; Dropbox connections are identified solely by
1805
- * their token.
1911
+ * their token. Uploads go to `/2/files/upload` (single-shot); resumable upload
1912
+ * sessions are not yet supported.
1913
+ *
1914
+ * @param options - Optional API base URL overrides and fetch implementation.
1915
+ * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
1916
+ *
1917
+ * @example Upload a backup to Dropbox
1918
+ * ```ts
1919
+ * import { createDropboxProviderFactory, createTransferClient, uploadFile } from "@zero-transfer/sdk";
1920
+ *
1921
+ * const client = createTransferClient({ providers: [createDropboxProviderFactory()] });
1922
+ *
1923
+ * await uploadFile({
1924
+ * client,
1925
+ * localPath: "./backups/db.dump",
1926
+ * destination: {
1927
+ * path: "/Backups/2026-04-28/db.dump",
1928
+ * profile: {
1929
+ * host: "",
1930
+ * provider: "dropbox",
1931
+ * password: { env: "DROPBOX_ACCESS_TOKEN" },
1932
+ * },
1933
+ * },
1934
+ * });
1935
+ * ```
1806
1936
  */
1807
1937
  declare function createDropboxProviderFactory(options?: DropboxProviderOptions): ProviderFactory;
1808
1938
 
@@ -1829,7 +1959,34 @@ interface GoogleDriveProviderOptions {
1829
1959
  * Creates a Google Drive provider factory.
1830
1960
  *
1831
1961
  * The bearer token is resolved per-connection from `profile.password`
1832
- * (typically an OAuth 2 access token). `profile.host` is unused.
1962
+ * (typically an OAuth 2 access token). `profile.host` is unused. Set
1963
+ * `rootFolderId` to scope the provider to a shared-drive subtree instead
1964
+ * of the authenticated user's My Drive root.
1965
+ *
1966
+ * @param options - Optional `rootFolderId`, `fetch`, and default headers.
1967
+ * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
1968
+ *
1969
+ * @example Upload to a shared drive folder
1970
+ * ```ts
1971
+ * import { createGoogleDriveProviderFactory, createTransferClient, uploadFile } from "@zero-transfer/sdk";
1972
+ *
1973
+ * const client = createTransferClient({
1974
+ * providers: [createGoogleDriveProviderFactory({ rootFolderId: "0AB1cDeFG2HiJk" })],
1975
+ * });
1976
+ *
1977
+ * await uploadFile({
1978
+ * client,
1979
+ * localPath: "./contracts/2026-Q2.pdf",
1980
+ * destination: {
1981
+ * path: "/Contracts/2026-Q2.pdf",
1982
+ * profile: {
1983
+ * host: "",
1984
+ * provider: "google-drive",
1985
+ * password: { env: "GOOGLE_OAUTH_ACCESS_TOKEN" },
1986
+ * },
1987
+ * },
1988
+ * });
1989
+ * ```
1833
1990
  */
1834
1991
  declare function createGoogleDriveProviderFactory(options?: GoogleDriveProviderOptions): ProviderFactory;
1835
1992
 
@@ -1847,12 +2004,64 @@ interface OneDriveProviderOptions {
1847
2004
  fetch?: HttpFetch;
1848
2005
  /** Default headers applied before bearer auth on every request. */
1849
2006
  defaultHeaders?: Record<string, string>;
2007
+ /** Resumable upload session tuning. Enabled by default. */
2008
+ multipart?: OneDriveMultipartOptions;
2009
+ }
2010
+ /** Resumable-upload session tuning for the OneDrive provider. */
2011
+ interface OneDriveMultipartOptions {
2012
+ /**
2013
+ * Enable Microsoft Graph upload sessions. **Defaults to `true`** so payloads
2014
+ * above {@link OneDriveMultipartOptions.thresholdBytes} stream in fixed-size
2015
+ * chunks via `createUploadSession` instead of being buffered into a single
2016
+ * `PUT /content`. Set to `false` to force the legacy single-shot behaviour.
2017
+ */
2018
+ enabled?: boolean;
2019
+ /** Object size threshold above which an upload session is used. Defaults to 4 MiB. */
2020
+ thresholdBytes?: number;
2021
+ /**
2022
+ * Target chunk size in bytes. Must be a multiple of 320 KiB per the Graph
2023
+ * protocol (the final chunk is exempt). Defaults to 10 MiB.
2024
+ */
2025
+ partSizeBytes?: number;
1850
2026
  }
1851
2027
  /**
1852
2028
  * Creates a OneDrive/SharePoint provider factory backed by Microsoft Graph.
1853
2029
  *
1854
2030
  * The bearer token is resolved per-connection from `profile.password`.
1855
- * `profile.host` is unused.
2031
+ * `profile.host` is unused. To target a SharePoint site or specific drive,
2032
+ * override `driveBaseUrl` with `https://graph.microsoft.com/v1.0/drives/{driveId}`.
2033
+ *
2034
+ * @param options - Optional `driveBaseUrl`, `fetch`, and default headers.
2035
+ * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
2036
+ *
2037
+ * @example Upload to the authenticated user's OneDrive
2038
+ * ```ts
2039
+ * import { createOneDriveProviderFactory, createTransferClient, uploadFile } from "@zero-transfer/sdk";
2040
+ *
2041
+ * const client = createTransferClient({
2042
+ * providers: [createOneDriveProviderFactory()],
2043
+ * });
2044
+ *
2045
+ * await uploadFile({
2046
+ * client,
2047
+ * localPath: "./report.xlsx",
2048
+ * destination: {
2049
+ * path: "/Reports/Q2/report.xlsx",
2050
+ * profile: {
2051
+ * host: "",
2052
+ * provider: "one-drive",
2053
+ * password: { env: "GRAPH_ACCESS_TOKEN" },
2054
+ * },
2055
+ * },
2056
+ * });
2057
+ * ```
2058
+ *
2059
+ * @example Target a specific SharePoint drive
2060
+ * ```ts
2061
+ * createOneDriveProviderFactory({
2062
+ * driveBaseUrl: "https://graph.microsoft.com/v1.0/drives/b!abc123",
2063
+ * });
2064
+ * ```
1856
2065
  */
1857
2066
  declare function createOneDriveProviderFactory(options?: OneDriveProviderOptions): ProviderFactory;
1858
2067
 
@@ -1878,8 +2087,65 @@ interface AzureBlobProviderOptions {
1878
2087
  fetch?: HttpFetch;
1879
2088
  /** Default headers applied before bearer auth on every request. */
1880
2089
  defaultHeaders?: Record<string, string>;
2090
+ /** Multipart (staged-block) upload tuning. Enabled by default. */
2091
+ multipart?: AzureBlobMultipartOptions;
2092
+ }
2093
+ /** Multipart (staged block) upload tuning for the Azure Blob provider. */
2094
+ interface AzureBlobMultipartOptions {
2095
+ /**
2096
+ * Enable staged-block uploads via `Put Block` + `Put Block List`. **Defaults
2097
+ * to `true`** so payloads above {@link AzureBlobMultipartOptions.thresholdBytes}
2098
+ * stream in fixed-size blocks instead of being buffered into a single PUT.
2099
+ * Set to `false` to force single-shot block-blob PUTs.
2100
+ */
2101
+ enabled?: boolean;
2102
+ /** Object size threshold above which staged-block upload is used. Defaults to 8 MiB. */
2103
+ thresholdBytes?: number;
2104
+ /** Target block size in bytes. Defaults to 8 MiB. Maximum 4000 MiB per Azure. */
2105
+ partSizeBytes?: number;
1881
2106
  }
1882
- /** Creates an Azure Blob Storage provider factory. */
2107
+ /**
2108
+ * Creates an Azure Blob Storage provider factory.
2109
+ *
2110
+ * The container is fixed at factory construction time. Authenticate per-connection
2111
+ * with either a SAS token (configured at factory level via {@link AzureBlobProviderOptions.sasToken})
2112
+ * or an AAD bearer token resolved from `profile.password`. Override `endpoint` for
2113
+ * sovereign clouds or local Azurite testing.
2114
+ *
2115
+ * @param options - Container plus optional endpoint, SAS token, fetch override.
2116
+ * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
2117
+ *
2118
+ * @example AAD-bearer upload
2119
+ * ```ts
2120
+ * import { createAzureBlobProviderFactory, createTransferClient, uploadFile } from "@zero-transfer/sdk";
2121
+ *
2122
+ * const client = createTransferClient({
2123
+ * providers: [createAzureBlobProviderFactory({ container: "snapshots" })],
2124
+ * });
2125
+ *
2126
+ * await uploadFile({
2127
+ * client,
2128
+ * localPath: "./snapshots/2026-04-28.tar.zst",
2129
+ * destination: {
2130
+ * path: "/2026/04/28/snapshot.tar.zst",
2131
+ * profile: {
2132
+ * host: "mystorageacct",
2133
+ * provider: "azure-blob",
2134
+ * password: { env: "AZURE_AAD_TOKEN" },
2135
+ * },
2136
+ * },
2137
+ * });
2138
+ * ```
2139
+ *
2140
+ * @example SAS-token + Azurite emulator
2141
+ * ```ts
2142
+ * createAzureBlobProviderFactory({
2143
+ * container: "devstoreaccount1",
2144
+ * endpoint: "http://127.0.0.1:10000/devstoreaccount1",
2145
+ * sasToken: "sv=2024-11-04&ss=b&srt=co&sp=rwdlac&se=...",
2146
+ * });
2147
+ * ```
2148
+ */
1883
2149
  declare function createAzureBlobProviderFactory(options: AzureBlobProviderOptions): ProviderFactory;
1884
2150
 
1885
2151
  /** Options accepted by {@link createGcsProviderFactory}. */
@@ -1896,8 +2162,60 @@ interface GcsProviderOptions {
1896
2162
  fetch?: HttpFetch;
1897
2163
  /** Default headers applied before bearer auth on every request. */
1898
2164
  defaultHeaders?: Record<string, string>;
2165
+ /** Resumable upload session tuning. Enabled by default. */
2166
+ multipart?: GcsMultipartOptions;
1899
2167
  }
1900
- /** Creates a Google Cloud Storage provider factory. */
2168
+ /** Resumable-upload session tuning for the GCS provider. */
2169
+ interface GcsMultipartOptions {
2170
+ /**
2171
+ * Enable resumable upload sessions. **Defaults to `true`** so payloads above
2172
+ * {@link GcsMultipartOptions.thresholdBytes} stream in fixed-size chunks via
2173
+ * the resumable session endpoint instead of being buffered into a single
2174
+ * `uploadType=media` POST. Set to `false` to force the legacy single-shot
2175
+ * behaviour.
2176
+ */
2177
+ enabled?: boolean;
2178
+ /** Object size threshold above which a resumable session is used. Defaults to 8 MiB. */
2179
+ thresholdBytes?: number;
2180
+ /**
2181
+ * Target chunk size in bytes. Must be a multiple of 256 KiB per the GCS
2182
+ * protocol (the final chunk is exempt). Defaults to 8 MiB.
2183
+ */
2184
+ partSizeBytes?: number;
2185
+ }
2186
+ /**
2187
+ * Creates a Google Cloud Storage provider factory.
2188
+ *
2189
+ * Authentication is per-connection: pass a Google OAuth 2 access token via
2190
+ * `profile.password`. `profile.host` is unused - the bucket is fixed at
2191
+ * factory construction time so a single client can target multiple buckets
2192
+ * by registering separate factories.
2193
+ *
2194
+ * @param options - Bucket plus optional fetch/transport overrides.
2195
+ * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
2196
+ *
2197
+ * @example Bearer-token upload
2198
+ * ```ts
2199
+ * import { createGcsProviderFactory, createTransferClient, uploadFile } from "@zero-transfer/sdk";
2200
+ *
2201
+ * const client = createTransferClient({
2202
+ * providers: [createGcsProviderFactory({ bucket: "my-bucket" })],
2203
+ * });
2204
+ *
2205
+ * await uploadFile({
2206
+ * client,
2207
+ * localPath: "./build/app.tar.gz",
2208
+ * destination: {
2209
+ * path: "releases/2026.04/app.tar.gz",
2210
+ * profile: {
2211
+ * host: "my-bucket",
2212
+ * provider: "gcs",
2213
+ * password: { env: "GCP_OAUTH_ACCESS_TOKEN" },
2214
+ * },
2215
+ * },
2216
+ * });
2217
+ * ```
2218
+ */
1901
2219
  declare function createGcsProviderFactory(options: GcsProviderOptions): ProviderFactory;
1902
2220
 
1903
2221
  /** Fixture entry used to seed a memory provider instance. */
@@ -1915,8 +2233,29 @@ interface MemoryProviderOptions {
1915
2233
  /**
1916
2234
  * Creates a provider factory backed by deterministic in-memory fixture entries.
1917
2235
  *
2236
+ * Useful for tests and examples where you want a real `TransferSession` without
2237
+ * touching disk or the network. Entries are pre-seeded; mutations made through
2238
+ * the session are visible to subsequent operations on the same provider.
2239
+ *
1918
2240
  * @param options - Optional fixture entries to expose through the memory provider.
1919
2241
  * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
2242
+ *
2243
+ * @example Seed entries and read them back
2244
+ * ```ts
2245
+ * import { createMemoryProviderFactory, createTransferClient } from "@zero-transfer/sdk";
2246
+ *
2247
+ * const client = createTransferClient({
2248
+ * providers: [createMemoryProviderFactory({
2249
+ * entries: [
2250
+ * { path: "/fixtures/hello.txt", content: "hello world" },
2251
+ * { path: "/fixtures/data.bin", content: new Uint8Array([1, 2, 3]) },
2252
+ * ],
2253
+ * })],
2254
+ * });
2255
+ *
2256
+ * const session = await client.connect({ host: "fixtures", provider: "memory" });
2257
+ * console.log(await session.fs.list("/fixtures"));
2258
+ * ```
1920
2259
  */
1921
2260
  declare function createMemoryProviderFactory(options?: MemoryProviderOptions): ProviderFactory;
1922
2261
 
@@ -1936,8 +2275,45 @@ interface HttpProviderOptions {
1936
2275
  /**
1937
2276
  * Creates a provider factory backed by HTTP(S) GET/HEAD.
1938
2277
  *
1939
- * @param options - Optional provider configuration.
2278
+ * Read-only by design - use it to fetch artifacts from public URLs, signed
2279
+ * URLs, or HTTP-only artifact servers. Range-based resume is supported when
2280
+ * the server advertises `Accept-Ranges: bytes`. To upload to an HTTP endpoint,
2281
+ * use the WebDAV provider, the S3 provider, or a cloud-specific provider.
2282
+ *
2283
+ * @param options - Optional id, base path, secure flag, fetch override.
1940
2284
  * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
2285
+ *
2286
+ * @example Download a public artifact
2287
+ * ```ts
2288
+ * import { createHttpProviderFactory, createTransferClient, downloadFile } from "@zero-transfer/sdk";
2289
+ *
2290
+ * const client = createTransferClient({ providers: [createHttpProviderFactory()] });
2291
+ *
2292
+ * await downloadFile({
2293
+ * client,
2294
+ * localPath: "./tmp/release.tar.gz",
2295
+ * source: {
2296
+ * path: "/releases/v1.0.0/release.tar.gz",
2297
+ * profile: { host: "downloads.example.com", provider: "http" },
2298
+ * },
2299
+ * });
2300
+ * ```
2301
+ *
2302
+ * @example Bearer-token-protected endpoint
2303
+ * ```ts
2304
+ * await downloadFile({
2305
+ * client,
2306
+ * localPath: "./reports/today.json",
2307
+ * source: {
2308
+ * path: "/reports/today.json",
2309
+ * profile: {
2310
+ * host: "api.example.com",
2311
+ * provider: "http",
2312
+ * password: { env: "REPORTS_TOKEN" },
2313
+ * },
2314
+ * },
2315
+ * });
2316
+ * ```
1941
2317
  */
1942
2318
  declare function createHttpProviderFactory(options?: HttpProviderOptions): ProviderFactory;
1943
2319
 
@@ -1956,18 +2332,18 @@ interface WebDavProviderOptions {
1956
2332
  /**
1957
2333
  * Streaming policy for `PUT` request bodies.
1958
2334
  *
1959
- * - `"when-known-size"` (default) stream when the caller declares
2335
+ * - `"when-known-size"` (default) - stream when the caller declares
1960
2336
  * `request.totalBytes` (an explicit `Content-Length` is sent so all
1961
2337
  * WebDAV servers accept the upload); otherwise buffer the entire body in
1962
2338
  * memory before sending. This is the safe default that does not require
1963
2339
  * the server to accept HTTP/1.1 chunked transfer-encoding.
1964
- * - `"always"` always stream the body, even when the size is unknown
2340
+ * - `"always"` - always stream the body, even when the size is unknown
1965
2341
  * (the runtime will use chunked transfer-encoding). Some legacy WebDAV
1966
2342
  * servers reject `Transfer-Encoding: chunked` and will respond `411
1967
2343
  * Length Required` or `501 Not Implemented`; only enable this for
1968
2344
  * servers known to accept chunked uploads (modern Apache/nginx, IIS
1969
2345
  * with chunked transfer enabled, Nextcloud, ownCloud, sabre/dav).
1970
- * - `"never"` always buffer (legacy behaviour pre-0.4.0). Use for
2346
+ * - `"never"` - always buffer (legacy behaviour pre-0.4.0). Use for
1971
2347
  * maximum compatibility at the cost of memory.
1972
2348
  */
1973
2349
  uploadStreaming?: "when-known-size" | "always" | "never";
@@ -1975,8 +2351,39 @@ interface WebDavProviderOptions {
1975
2351
  /**
1976
2352
  * Creates a WebDAV provider factory.
1977
2353
  *
1978
- * @param options - Optional provider configuration.
2354
+ * Talks to any RFC 4918 server: Nextcloud, ownCloud, sabre/dav, Apache `mod_dav`,
2355
+ * IIS WebDAV, etc. PROPFIND drives directory listings, GET supports byte-range
2356
+ * resume on download, and PUT handles uploads. Server-side `COPY` is exposed via
2357
+ * the capability set. Authentication is per-connection from `profile.password`.
2358
+ *
2359
+ * @param options - Optional id, base path, secure flag, fetch, streaming policy.
1979
2360
  * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
2361
+ *
2362
+ * @example Upload to Nextcloud
2363
+ * ```ts
2364
+ * import { createTransferClient, createWebDavProviderFactory, uploadFile } from "@zero-transfer/sdk";
2365
+ *
2366
+ * const client = createTransferClient({
2367
+ * providers: [createWebDavProviderFactory({
2368
+ * secure: true,
2369
+ * basePath: "/remote.php/dav/files/alice",
2370
+ * })],
2371
+ * });
2372
+ *
2373
+ * await uploadFile({
2374
+ * client,
2375
+ * localPath: "./contracts/2026.pdf",
2376
+ * destination: {
2377
+ * path: "/Documents/Contracts/2026.pdf",
2378
+ * profile: {
2379
+ * host: "cloud.example.com",
2380
+ * provider: "webdav",
2381
+ * username: "alice",
2382
+ * password: { env: "NEXTCLOUD_APP_PASSWORD" },
2383
+ * },
2384
+ * },
2385
+ * });
2386
+ * ```
1980
2387
  */
1981
2388
  declare function createWebDavProviderFactory(options?: WebDavProviderOptions): ProviderFactory;
1982
2389
 
@@ -3010,7 +3417,7 @@ interface SshKeyboardInteractiveCredential {
3010
3417
  type SshCredential = SshPasswordCredential | SshPublickeyCredential | SshKeyboardInteractiveCredential;
3011
3418
  interface SshAuthOptions {
3012
3419
  credential: SshCredential;
3013
- /** SSH session id (exchange hash) from key exchange required for publickey signing. */
3420
+ /** SSH session id (exchange hash) from key exchange - required for publickey signing. */
3014
3421
  sessionId: Uint8Array;
3015
3422
  /** Maximum number of USERAUTH_FAILURE retries before giving up. Defaults to 4. */
3016
3423
  maxAttempts?: number;
@@ -3252,6 +3659,71 @@ declare class SshDataWriter {
3252
3659
  private assertByte;
3253
3660
  }
3254
3661
 
3662
+ /**
3663
+ * Options for {@link runSshCommand}.
3664
+ */
3665
+ interface RunSshCommandOptions {
3666
+ /** Hostname or IP of the SSH server. */
3667
+ host: string;
3668
+ /** TCP port. Defaults to `22`. */
3669
+ port?: number;
3670
+ /** Command to execute on the remote shell. */
3671
+ command: string;
3672
+ /**
3673
+ * Authentication credential. Use one of:
3674
+ *
3675
+ * - `{ type: "password", username, password }`
3676
+ * - `{ type: "publickey", username, algorithmName, publicKeyBlob, sign }`
3677
+ * (build one from a private-key file with `buildPublickeyCredential`)
3678
+ * - `{ type: "keyboard-interactive", username, respond }`
3679
+ */
3680
+ auth: SshCredential;
3681
+ /**
3682
+ * Forwarded to {@link SshTransportConnection}; covers host-key pinning,
3683
+ * algorithm overrides, and handshake timeout. The default
3684
+ * `handshakeTimeoutMs` is 10 seconds.
3685
+ */
3686
+ transport?: SshTransportConnectionOptions;
3687
+ /** TCP connect timeout in milliseconds. Defaults to 10 000. */
3688
+ connectTimeoutMs?: number;
3689
+ /** Maximum total bytes captured from stdout. Defaults to 16 MiB. */
3690
+ maxOutputBytes?: number;
3691
+ }
3692
+ /**
3693
+ * Result of {@link runSshCommand}. The full captured stdout is provided as
3694
+ * both a `Buffer` (for binary output) and as a UTF-8 decoded `string`.
3695
+ *
3696
+ * Note: stderr (CHANNEL_EXTENDED_DATA) and exit-status are not currently
3697
+ * surfaced - drop down to {@link SshConnectionManager}/{@link SshSessionChannel}
3698
+ * directly if you need them.
3699
+ */
3700
+ interface RunSshCommandResult {
3701
+ /** Captured stdout as raw bytes. */
3702
+ stdout: Buffer;
3703
+ /** Captured stdout decoded as UTF-8. */
3704
+ stdoutText: string;
3705
+ /** Bytes received before the channel closed. */
3706
+ bytesReceived: number;
3707
+ }
3708
+ /**
3709
+ * Connects, authenticates, runs `command` on a fresh exec channel, drains
3710
+ * stdout, and disconnects. The TCP socket, transport, auth session, and
3711
+ * channel are all owned by this helper and torn down before it returns.
3712
+ *
3713
+ * @example Run `uname -a` with a password credential
3714
+ * ```ts
3715
+ * import { runSshCommand } from "@zero-transfer/ssh";
3716
+ *
3717
+ * const { stdoutText } = await runSshCommand({
3718
+ * host: "ssh.example.com",
3719
+ * auth: { type: "password", username: "deploy", password: process.env.SSH_PASSWORD! },
3720
+ * command: "uname -a",
3721
+ * });
3722
+ * console.log(stdoutText);
3723
+ * ```
3724
+ */
3725
+ declare function runSshCommand(options: RunSshCommandOptions): Promise<RunSshCommandResult>;
3726
+
3255
3727
  /**
3256
3728
  * FTPS control-channel TLS mode.
3257
3729
  *
@@ -3294,7 +3766,7 @@ interface FtpsProviderOptions extends FtpProviderOptions {
3294
3766
  * @param options - Optional provider defaults.
3295
3767
  * @returns Provider factory suitable for `createTransferClient({ providers: [...] })`.
3296
3768
  *
3297
- * @example Plain FTP (cleartext prefer FTPS or SFTP whenever possible)
3769
+ * @example Plain FTP (cleartext - prefer FTPS or SFTP whenever possible)
3298
3770
  * ```ts
3299
3771
  * import { createFtpProviderFactory, createTransferClient } from "@zero-transfer/sdk";
3300
3772
  *
@@ -3698,7 +4170,7 @@ interface NativeSftpRawSession {
3698
4170
  }
3699
4171
  /**
3700
4172
  * Creates a {@link ProviderFactory} backed by the native SSH/SFTP protocol
3701
- * stack no `ssh2` dependency required.
4173
+ * stack - no `ssh2` dependency required.
3702
4174
  *
3703
4175
  * **Supported algorithms**
3704
4176
  * - Key exchange: `curve25519-sha256`, `curve25519-sha256@libssh.org`
@@ -3967,9 +4439,47 @@ interface TransferPlanSummary {
3967
4439
  /** Counts grouped by action. */
3968
4440
  actions: Record<string, number>;
3969
4441
  }
3970
- /** Creates a transfer plan from dry-run planning input. */
4442
+ /**
4443
+ * Creates a transfer plan from dry-run planning input.
4444
+ *
4445
+ * Plans are immutable, structured descriptions of intended work. Pair with
4446
+ * {@link createSyncPlan} or {@link createAtomicDeployPlan} for end-to-end
4447
+ * planning, or build steps by hand when you need full control. Pass the plan
4448
+ * to {@link createTransferJobsFromPlan} to materialize executable jobs.
4449
+ *
4450
+ * @example Build a plan with two upload steps and inspect it
4451
+ * ```ts
4452
+ * import { createTransferPlan, summarizeTransferPlan } from "@zero-transfer/sdk";
4453
+ *
4454
+ * const plan = createTransferPlan({
4455
+ * id: "manual-batch",
4456
+ * steps: [
4457
+ * { action: "upload", source: "./a.bin", destination: "/lake/a.bin", expectedBytes: 1024 },
4458
+ * { action: "upload", source: "./b.bin", destination: "/lake/b.bin", expectedBytes: 2048 },
4459
+ * ],
4460
+ * });
4461
+ *
4462
+ * console.table(summarizeTransferPlan(plan));
4463
+ * ```
4464
+ */
3971
4465
  declare function createTransferPlan(input: TransferPlanInput): TransferPlan;
3972
- /** Summarizes a transfer plan for diagnostics, previews, and tests. */
4466
+ /**
4467
+ * Summarizes a transfer plan for diagnostics, previews, and tests.
4468
+ *
4469
+ * Returns aggregate counts (total / executable / skipped / destructive),
4470
+ * total expected bytes, and a per-action histogram. Useful for printing a
4471
+ * one-line plan summary before executing or for asserting plan shape in
4472
+ * tests.
4473
+ *
4474
+ * @example Print a plan preview
4475
+ * ```ts
4476
+ * import { summarizeTransferPlan } from "@zero-transfer/sdk";
4477
+ *
4478
+ * const summary = summarizeTransferPlan(plan);
4479
+ * console.log(`${summary.executableSteps} steps, ${summary.totalExpectedBytes} bytes total`);
4480
+ * console.log("Actions:", summary.actions);
4481
+ * ```
4482
+ */
3973
4483
  declare function summarizeTransferPlan(plan: TransferPlan): TransferPlanSummary;
3974
4484
  /** Converts executable plan steps into transfer jobs while preserving order. */
3975
4485
  declare function createTransferJobsFromPlan(plan: TransferPlan): TransferJob[];
@@ -4046,7 +4556,41 @@ interface TransferQueueSummary {
4046
4556
  /** Failed queue items in queue order. */
4047
4557
  failures: TransferQueueItem[];
4048
4558
  }
4049
- /** Minimal transfer queue with concurrency, pause/resume, cancellation, and drain summaries. */
4559
+ /**
4560
+ * Minimal transfer queue with concurrency, pause/resume, cancellation, and drain summaries.
4561
+ *
4562
+ * Wrap a {@link TransferEngine} with a queue when you need to run many transfers
4563
+ * concurrently with bounded parallelism, observe per-job progress, or drive
4564
+ * a UI from a single source of truth. Items are FIFO; failures and successes
4565
+ * are surfaced via observers and in the final {@link TransferQueueSummary}.
4566
+ *
4567
+ * @example Run a batch of uploads with concurrency=4
4568
+ * ```ts
4569
+ * import {
4570
+ * TransferQueue,
4571
+ * createProviderTransferExecutor,
4572
+ * } from "@zero-transfer/sdk";
4573
+ *
4574
+ * const queue = new TransferQueue({
4575
+ * concurrency: 4,
4576
+ * executor: createProviderTransferExecutor({ client }),
4577
+ * onProgress: (e) => console.log(`${e.jobId}: ${e.bytesTransferred}`),
4578
+ * onError: (item, err) => console.error(`${item.job.id} failed`, err),
4579
+ * });
4580
+ *
4581
+ * for (const file of files) {
4582
+ * queue.enqueue({
4583
+ * id: file.name,
4584
+ * operation: "upload",
4585
+ * source: { profile: localProfile, path: file.path },
4586
+ * destination: { profile: s3Profile, path: `/lake/${file.name}` },
4587
+ * });
4588
+ * }
4589
+ *
4590
+ * const summary = await queue.drain();
4591
+ * console.log(`Completed ${summary.completed} / ${summary.total}`);
4592
+ * ```
4593
+ */
4050
4594
  declare class TransferQueue {
4051
4595
  private readonly engine;
4052
4596
  private readonly items;
@@ -4317,7 +4861,7 @@ interface DiffRemoteTreesOptions {
4317
4861
  * Compares two remote subtrees and produces an entry-level diff.
4318
4862
  *
4319
4863
  * Source and destination paths are walked independently; entries are then aligned by
4320
- * the relative path from each tree root. Directory equality is structural directories
4864
+ * the relative path from each tree root. Directory equality is structural - directories
4321
4865
  * are equal when their relative paths match and the entry types agree.
4322
4866
  *
4323
4867
  * @param source - Source-side remote file system.
@@ -4326,6 +4870,26 @@ interface DiffRemoteTreesOptions {
4326
4870
  * @param destinationPath - Destination-side root path being compared.
4327
4871
  * @param options - Optional comparison controls.
4328
4872
  * @returns Diff result containing entries and a summary.
4873
+ *
4874
+ * @example Diff two SFTP subtrees and feed the result into createSyncPlan
4875
+ * ```ts
4876
+ * import { createSyncPlan, diffRemoteTrees } from "@zero-transfer/sdk";
4877
+ *
4878
+ * const diff = await diffRemoteTrees(
4879
+ * srcSession.fs, "/exports",
4880
+ * dstSession.fs, "/exports",
4881
+ * { compareUniqueId: true },
4882
+ * );
4883
+ *
4884
+ * console.log(diff.summary); // { added, removed, changed, unchanged }
4885
+ *
4886
+ * const plan = createSyncPlan({
4887
+ * id: "exports-sync",
4888
+ * diff,
4889
+ * source: { provider: "sftp", rootPath: "/exports" },
4890
+ * destination: { provider: "sftp", rootPath: "/exports" },
4891
+ * });
4892
+ * ```
4329
4893
  */
4330
4894
  declare function diffRemoteTrees(source: RemoteFileSystem, sourcePath: string, destination: RemoteFileSystem, destinationPath: string, options?: DiffRemoteTreesOptions): Promise<RemoteTreeDiff>;
4331
4895
 
@@ -4397,6 +4961,31 @@ interface CreateSyncPlanOptions {
4397
4961
  * @param options - Inputs and policies that shape the plan.
4398
4962
  * @returns Transfer plan ready for `createTransferJobsFromPlan` or queue execution.
4399
4963
  * @throws {@link ConfigurationError} When `conflictPolicy: "error"` encounters a conflict.
4964
+ *
4965
+ * @example Mirror SFTP → S3 with deletes
4966
+ * ```ts
4967
+ * import {
4968
+ * createSyncPlan,
4969
+ * diffRemoteTrees,
4970
+ * summarizeTransferPlan,
4971
+ * } from "@zero-transfer/sdk";
4972
+ *
4973
+ * const diff = await diffRemoteTrees(
4974
+ * srcSession.fs, "/dist",
4975
+ * dstSession.fs, "/releases/current",
4976
+ * );
4977
+ *
4978
+ * const plan = createSyncPlan({
4979
+ * id: "release-mirror",
4980
+ * diff,
4981
+ * source: { provider: "sftp", rootPath: "/dist" },
4982
+ * destination: { provider: "s3", rootPath: "/releases/current" },
4983
+ * deletePolicy: "mirror",
4984
+ * conflictPolicy: "overwrite",
4985
+ * });
4986
+ *
4987
+ * console.table(summarizeTransferPlan(plan));
4988
+ * ```
4400
4989
  */
4401
4990
  declare function createSyncPlan(options: CreateSyncPlanOptions): TransferPlan;
4402
4991
 
@@ -4512,9 +5101,39 @@ interface CreateAtomicDeployPlanOptions {
4512
5101
  /**
4513
5102
  * Builds an {@link AtomicDeployPlan} that stages a release, swaps it live, and prunes old releases.
4514
5103
  *
5104
+ * The plan describes a blue/green-style deploy:
5105
+ * 1. Upload to a timestamped staging directory under `<destination>/.releases/`.
5106
+ * 2. Atomically swap the `current` symlink/rename to point at the new release.
5107
+ * 3. Optionally prune old releases beyond `retain`.
5108
+ *
5109
+ * No I/O is performed - the host executes the plan steps. Pair with
5110
+ * {@link createTransferPlan} or {@link createTransferJobsFromPlan} to execute.
5111
+ *
4515
5112
  * @param options - Inputs and policies that shape the deploy.
4516
5113
  * @returns Structured deploy plan ready for execution by the calling host.
4517
5114
  * @throws {@link ConfigurationError} When `retain` is less than `1` or the destination root is empty.
5115
+ *
5116
+ * @example Plan a release with rollback path
5117
+ * ```ts
5118
+ * import { createAtomicDeployPlan } from "@zero-transfer/sdk";
5119
+ *
5120
+ * const plan = createAtomicDeployPlan({
5121
+ * id: "web-2026-04-28",
5122
+ * source: { rootPath: "./dist" },
5123
+ * destination: {
5124
+ * profile: { host: "web1.example.com", provider: "sftp", username: "deploy" },
5125
+ * rootPath: "/srv/www",
5126
+ * },
5127
+ * retain: 5,
5128
+ * existingReleases: [
5129
+ * "/srv/www/.releases/2026-04-21T00-00-00Z",
5130
+ * "/srv/www/.releases/2026-04-14T00-00-00Z",
5131
+ * ],
5132
+ * });
5133
+ *
5134
+ * console.log(plan.swap); // staging → current rename
5135
+ * console.log(plan.prune); // releases scheduled for removal
5136
+ * ```
4518
5137
  */
4519
5138
  declare function createAtomicDeployPlan(options: CreateAtomicDeployPlanOptions): AtomicDeployPlan;
4520
5139
 
@@ -5014,9 +5633,33 @@ interface CreateWebhookAuditLogOptions {
5014
5633
  *
5015
5634
  * Entries whose `type` is not in `target.types` are silently dropped. `list()`
5016
5635
  * always returns an empty array because webhook deliveries are not buffered.
5636
+ * Payloads are HMAC-signed with `target.secret` (when provided) so receivers
5637
+ * can verify authenticity before acting on them.
5017
5638
  *
5018
5639
  * @param options - Webhook target plus optional retry/observer hooks.
5019
5640
  * @returns An audit log that delivers each `record` call to the webhook.
5641
+ *
5642
+ * @example Compose a webhook log with an in-memory log for local replay
5643
+ * ```ts
5644
+ * import {
5645
+ * InMemoryAuditLog,
5646
+ * composeAuditLogs,
5647
+ * createWebhookAuditLog,
5648
+ * } from "@zero-transfer/sdk";
5649
+ *
5650
+ * const memory = new InMemoryAuditLog();
5651
+ * const webhook = createWebhookAuditLog({
5652
+ * target: {
5653
+ * url: "https://hooks.example.com/zt",
5654
+ * secret: { env: "ZT_WEBHOOK_SECRET" },
5655
+ * types: ["transfer.success", "transfer.failure"],
5656
+ * },
5657
+ * onDelivery: ({ result }) => console.log("delivered", result.statusCode),
5658
+ * });
5659
+ *
5660
+ * const audit = composeAuditLogs(memory, webhook);
5661
+ * await audit.record({ type: "transfer.success", receipt });
5662
+ * ```
5020
5663
  */
5021
5664
  declare function createWebhookAuditLog(options: CreateWebhookAuditLogOptions): MftAuditLog;
5022
5665
 
@@ -5171,7 +5814,48 @@ interface MftSchedulerOptions {
5171
5814
  /** Timer/clock injection used by tests. */
5172
5815
  timer?: ScheduleTimerHooks;
5173
5816
  }
5174
- /** Runs routes on configured schedules. */
5817
+ /**
5818
+ * Runs routes on configured schedules.
5819
+ *
5820
+ * Subscribes to a {@link ScheduleRegistry}, computes the next fire time for
5821
+ * each schedule (cron or interval), and dispatches the matching route through
5822
+ * a runner of your choice (`runRoute` by default, or a wrapped runner for
5823
+ * approvals / rate limiting / circuit breaking). Observers fire on each cycle
5824
+ * for telemetry. Tests can inject a deterministic timer via `timer`.
5825
+ *
5826
+ * @example Wire a cron schedule with audit + approval
5827
+ * ```ts
5828
+ * import {
5829
+ * ApprovalRegistry,
5830
+ * InMemoryAuditLog,
5831
+ * MftScheduler,
5832
+ * RouteRegistry,
5833
+ * ScheduleRegistry,
5834
+ * createApprovalGate,
5835
+ * runRoute,
5836
+ * } from "@zero-transfer/sdk";
5837
+ *
5838
+ * const audit = new InMemoryAuditLog();
5839
+ * const approvals = new ApprovalRegistry();
5840
+ *
5841
+ * const scheduler = new MftScheduler({
5842
+ * client,
5843
+ * routes: new RouteRegistry([route]),
5844
+ * schedules: new ScheduleRegistry([
5845
+ * { id: "nightly", routeId: route.id, cron: "0 2 * * *" },
5846
+ * ]),
5847
+ * runner: createApprovalGate({
5848
+ * registry: approvals,
5849
+ * approvalId: ({ route }) => `release:${route.id}`,
5850
+ * runner: ({ client: c, route: r, signal }) => runRoute({ client: c, route: r, signal }),
5851
+ * }),
5852
+ * onResult: ({ receipt }) => audit.record({ type: "transfer.success", receipt }),
5853
+ * onError: ({ error }) => audit.record({ type: "transfer.failure", error }),
5854
+ * });
5855
+ *
5856
+ * scheduler.start();
5857
+ * ```
5858
+ */
5175
5859
  declare class MftScheduler {
5176
5860
  private readonly options;
5177
5861
  private readonly now;
@@ -5315,10 +5999,33 @@ interface CreateApprovalGateOptions {
5315
5999
  *
5316
6000
  * The returned runner creates an approval request, waits for resolution, and
5317
6001
  * dispatches the underlying runner only when the request is approved. Rejection
5318
- * surfaces an {@link ApprovalRejectedError}.
6002
+ * surfaces an {@link ApprovalRejectedError}. Pair with {@link MftScheduler} to
6003
+ * implement two-person rules and human-in-the-loop release flows.
5319
6004
  *
5320
6005
  * @param options - Registry, downstream runner, approval-id derivation, hooks.
5321
6006
  * @returns A {@link ScheduleRouteRunner} that gates execution behind approval.
6007
+ *
6008
+ * @example Two-person rule on a release route
6009
+ * ```ts
6010
+ * import {
6011
+ * ApprovalRegistry,
6012
+ * createApprovalGate,
6013
+ * runRoute,
6014
+ * } from "@zero-transfer/sdk";
6015
+ *
6016
+ * const approvals = new ApprovalRegistry();
6017
+ *
6018
+ * const gatedRunner = createApprovalGate({
6019
+ * registry: approvals,
6020
+ * approvalId: ({ route }) => `release:${route.id}:${Date.now()}`,
6021
+ * onRequested: (req) => notifyOnCallChannel(req),
6022
+ * runner: ({ client, route, signal }) => runRoute({ client, route, signal }),
6023
+ * });
6024
+ *
6025
+ * // Elsewhere, an authorized operator approves or rejects:
6026
+ * approvals.approve(approvalId, { actor: "alice@example.com" });
6027
+ * // approvals.reject(approvalId, { actor: "bob@example.com", reason: "hold release" });
6028
+ * ```
5322
6029
  */
5323
6030
  declare function createApprovalGate(options: CreateApprovalGateOptions): ScheduleRouteRunner;
5324
6031
 
@@ -5393,4 +6100,10 @@ declare function joinRemotePath(...segments: string[]): string;
5393
6100
  */
5394
6101
  declare function basenameRemotePath(input: string): string;
5395
6102
 
5396
- export { AbortError, type AgeRetentionPolicy, ApprovalRegistry, ApprovalRejectedError, type ApprovalRequest, type ApprovalStatus, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type AzureBlobProviderOptions, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, type BuiltinCapabilityMatrixEntry, type BuiltinProviderMatrixId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionPoolOptions, type ConnectionProfile, type ConventionEndpoint, type CopyBetweenOptions, type CountRetentionPolicy, type CreateApprovalGateOptions, type CreateAtomicDeployPlanOptions, type CreateInboxRouteOptions, type CreateOutboxRouteOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type CreateWebhookAuditLogOptions, type CronExpression, type CronField, type CronScheduleTrigger, DEFAULT_FAILED_SUBDIR, DEFAULT_PROCESSED_SUBDIR, DEFAULT_SSH_ALGORITHM_PREFERENCES, type DiffRemoteTreesOptions, type DispatchWebhookOptions, type DispatchWebhookResult, type DownloadFileOptions, type DropboxProviderOptions, type EnvSecretSource, type EvaluateRetentionOptions, type FileSecretSource, type FileSystemS3MultipartResumeStoreOptions, type FileZillaSite, type FriendlyTransferOptions, type FtpFeatures, type FtpPassiveHostStrategy, type FtpProviderOptions, type FtpReplyErrorInput, type FtpResponse, FtpResponseParser, type FtpResponseStatus, type FtpsDataProtection, type FtpsMode, type FtpsProviderOptions, type GcsProviderOptions, type GoogleDriveProviderOptions, type HttpFetch, type HttpProviderOptions, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, InMemoryAuditLog, type IntervalScheduleTrigger, type JsonlWriter, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MftAuditEntry, type MftAuditEntryType, type MftAuditLog, type MftInboxConvention, type MftOutboxConvention, type MftRoute, type MftRouteEndpoint, type MftRouteFilter, type MftRouteOperation, type MftSchedule, type MftScheduleTrigger, MftScheduler, type MftSchedulerOptions, type MkdirOptions, type NativeSftpProviderOptions, type NativeSftpRawSession, type NegotiatedSshAlgorithms, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OneDriveProviderOptions, 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 RetentionEvaluation, type RetentionPolicy, type RmdirOptions, RouteRegistry, type RunConnectionDiagnosticsOptions, type RunRouteOptions, type S3MultipartCheckpoint, type S3MultipartOptions, type S3MultipartPart, type S3MultipartResumeKey, type S3MultipartResumeStore, type S3ProviderOptions, ScheduleRegistry, type ScheduleRouteRunner, type ScheduleTimerHooks, type SecretProvider, type SecretSource, type SecretValue, type NativeSftpProviderOptions as SftpProviderOptions, type NativeSftpRawSession as SftpRawSession, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithmPreferences, type SshAlgorithms, SshAuthSession, SshConnectionManager, SshDataReader, SshDataWriter, SshDisconnectReason, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveCredential, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshPasswordCredential, type SshProfile, type SshPublickeyCredential, SshSessionChannel, type SshSocketFactory, type SshSocketFactoryContext, SshTransportConnection, type SshTransportConnectionOptions, SshTransportHandshake, type SshTransportHandshakeResult, 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 WebhookRetryPolicy, type WebhookSignature, type WebhookTarget, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildPublickeyCredential, buildRemoteBreadcrumbs, compareRemoteManifests, composeAuditLogs, copyBetween, createApprovalGate, createAtomicDeployPlan, createAzureBlobProviderFactory, createBandwidthThrottle, createDropboxProviderFactory, createFileSystemS3MultipartResumeStore, createFtpProviderFactory, createFtpsProviderFactory, createGcsProviderFactory, createGoogleDriveProviderFactory, createHttpProviderFactory, createInboxRoute, createJsonlAuditLog, createLocalProviderFactory, createMemoryProviderFactory, createMemoryS3MultipartResumeStore, createNativeSftpProviderFactory, createOAuthTokenSecretSource, createOneDriveProviderFactory, createOutboxRoute, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createS3ProviderFactory, createNativeSftpProviderFactory as createSftpProviderFactory, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, createWebDavProviderFactory, createWebhookAuditLog, diffRemoteTrees, dispatchWebhook, downloadFile, emitLog, errorFromFtpReply, evaluateRetention, filterRemoteEntries, formatCapabilityMatrixMarkdown, freezeReceipt, getBuiltinCapabilityMatrix, importFileZillaSites, importOpenSshConfig, importWinScpSessions, inboxFailedPath, inboxProcessedPath, isClassicProviderId, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, negotiateSshAlgorithms, nextCronFireAt, nextScheduleFireAt, noopLogger, normalizeRemotePath, parentRemotePath, parseCronExpression, parseFtpFeatures, parseFtpResponseLines, parseKnownHosts, parseMlsdLine, parseMlsdList, parseMlstTimestamp, parseOpenSshConfig, parseRemoteManifest, parseUnixList, parseUnixListLine, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, runRoute, serializeRemoteManifest, signWebhookPayload, sortRemoteEntries, summarizeClientDiagnostics, summarizeError, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, validateSchedule, walkRemoteTree };
6103
+ /**
6104
+ * Returns `true` when the file containing `import.meta.url` is the entry point
6105
+ * of the current Node.js process. Returns `false` outside Node.
6106
+ */
6107
+ declare function isMainModule(importMetaUrl: string): boolean;
6108
+
6109
+ export { AbortError, type AgeRetentionPolicy, ApprovalRegistry, ApprovalRejectedError, type ApprovalRequest, type ApprovalStatus, type AtomicDeployActivateOperation, type AtomicDeployActivateStep, type AtomicDeployPlan, type AtomicDeployPruneStep, type AtomicDeployStrategy, type AuthenticationCapability, AuthenticationError, AuthorizationError, type AzureBlobMultipartOptions, type AzureBlobProviderOptions, type BandwidthSleep, type BandwidthThrottle, type BandwidthThrottleOptions, type Base64EnvSecretSource, type BuiltInProviderId, type BuiltinCapabilityMatrixEntry, type BuiltinProviderMatrixId, CLASSIC_PROVIDER_IDS, type CapabilitySet, type ChecksumCapability, type ClassicProviderId, type ClientDiagnostics, type CompareRemoteManifestsOptions, ConfigurationError, type ConnectionDiagnosticTimings, type ConnectionDiagnosticsResult, ConnectionError, type ConnectionPoolOptions, type ConnectionProfile, type ConventionEndpoint, type CopyBetweenOptions, type CountRetentionPolicy, type CreateApprovalGateOptions, type CreateAtomicDeployPlanOptions, type CreateInboxRouteOptions, type CreateOutboxRouteOptions, type CreateRemoteBrowserOptions, type CreateRemoteManifestOptions, type CreateSyncPlanOptions, type CreateWebhookAuditLogOptions, type CronExpression, type CronField, type CronScheduleTrigger, DEFAULT_FAILED_SUBDIR, DEFAULT_PROCESSED_SUBDIR, DEFAULT_SSH_ALGORITHM_PREFERENCES, type DiffRemoteTreesOptions, type DispatchWebhookOptions, type DispatchWebhookResult, type DownloadFileOptions, type DropboxProviderOptions, type EnvSecretSource, type EvaluateRetentionOptions, type FileSecretSource, type FileSystemS3MultipartResumeStoreOptions, type FileZillaSite, type FriendlyTransferOptions, type FtpFeatures, type FtpPassiveHostStrategy, type FtpProviderOptions, type FtpReplyErrorInput, type FtpResponse, FtpResponseParser, type FtpResponseStatus, type FtpsDataProtection, type FtpsMode, type FtpsProviderOptions, type GcsMultipartOptions, type GcsProviderOptions, type GoogleDriveProviderOptions, type HttpFetch, type HttpProviderOptions, type ImportFileZillaSitesResult, type ImportOpenSshConfigOptions, type ImportOpenSshConfigResult, type ImportWinScpSessionsResult, InMemoryAuditLog, type IntervalScheduleTrigger, type JsonlWriter, type KnownHostsEntry, type KnownHostsMarker, type ListOptions, type LocalProviderOptions, type LogLevel, type LogRecord, type LogRecordInput, type LoggerMethod, type MemoryProviderEntry, type MemoryProviderOptions, type MetadataCapability, type MftAuditEntry, type MftAuditEntryType, type MftAuditLog, type MftInboxConvention, type MftOutboxConvention, type MftRoute, type MftRouteEndpoint, type MftRouteFilter, type MftRouteOperation, type MftSchedule, type MftScheduleTrigger, MftScheduler, type MftSchedulerOptions, type MkdirOptions, type NativeSftpProviderOptions, type NativeSftpRawSession, type NegotiatedSshAlgorithms, type OAuthAccessToken, type OAuthRefreshCallback, type OAuthTokenSecretSourceOptions, type OneDriveMultipartOptions, type OneDriveProviderOptions, 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 RetentionEvaluation, type RetentionPolicy, type RmdirOptions, RouteRegistry, type RunConnectionDiagnosticsOptions, type RunRouteOptions, type RunSshCommandOptions, type RunSshCommandResult, type S3MultipartCheckpoint, type S3MultipartOptions, type S3MultipartPart, type S3MultipartResumeKey, type S3MultipartResumeStore, type S3ProviderOptions, ScheduleRegistry, type ScheduleRouteRunner, type ScheduleTimerHooks, type SecretProvider, type SecretSource, type SecretValue, type NativeSftpProviderOptions as SftpProviderOptions, type NativeSftpRawSession as SftpRawSession, type SpecializedErrorDetails, type SshAgentSource, type SshAlgorithmPreferences, type SshAlgorithms, SshAuthSession, SshConnectionManager, SshDataReader, SshDataWriter, SshDisconnectReason, type SshKeyboardInteractiveChallenge, type SshKeyboardInteractiveCredential, type SshKeyboardInteractiveHandler, type SshKeyboardInteractivePrompt, type SshKnownHostsSource, type SshPasswordCredential, type SshProfile, type SshPublickeyCredential, SshSessionChannel, type SshSocketFactory, type SshSocketFactoryContext, SshTransportConnection, type SshTransportConnectionOptions, SshTransportHandshake, type SshTransportHandshakeResult, 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 WebhookRetryPolicy, type WebhookSignature, type WebhookTarget, type WinScpSession, ZeroTransfer, type ZeroTransferCapabilities, ZeroTransferError, type ZeroTransferErrorDetails, type ZeroTransferLogger, type ZeroTransferOptions, assertSafeFtpArgument, basenameRemotePath, buildPublickeyCredential, buildRemoteBreadcrumbs, compareRemoteManifests, composeAuditLogs, copyBetween, createApprovalGate, createAtomicDeployPlan, createAzureBlobProviderFactory, createBandwidthThrottle, createDropboxProviderFactory, createFileSystemS3MultipartResumeStore, createFtpProviderFactory, createFtpsProviderFactory, createGcsProviderFactory, createGoogleDriveProviderFactory, createHttpProviderFactory, createInboxRoute, createJsonlAuditLog, createLocalProviderFactory, createMemoryProviderFactory, createMemoryS3MultipartResumeStore, createNativeSftpProviderFactory, createOAuthTokenSecretSource, createOneDriveProviderFactory, createOutboxRoute, createPooledTransferClient, createProgressEvent, createProviderTransferExecutor, createRemoteBrowser, createRemoteManifest, createS3ProviderFactory, createNativeSftpProviderFactory as createSftpProviderFactory, createSyncPlan, createTransferClient, createTransferJobsFromPlan, createTransferPlan, createTransferResult, createWebDavProviderFactory, createWebhookAuditLog, diffRemoteTrees, dispatchWebhook, downloadFile, emitLog, errorFromFtpReply, evaluateRetention, filterRemoteEntries, formatCapabilityMatrixMarkdown, freezeReceipt, getBuiltinCapabilityMatrix, importFileZillaSites, importOpenSshConfig, importWinScpSessions, inboxFailedPath, inboxProcessedPath, isClassicProviderId, isMainModule, isSensitiveKey, joinRemotePath, matchKnownHosts, matchKnownHostsEntry, negotiateSshAlgorithms, nextCronFireAt, nextScheduleFireAt, noopLogger, normalizeRemotePath, parentRemotePath, parseCronExpression, parseFtpFeatures, parseFtpResponseLines, parseKnownHosts, parseMlsdLine, parseMlsdList, parseMlstTimestamp, parseOpenSshConfig, parseRemoteManifest, parseUnixList, parseUnixListLine, redactCommand, redactConnectionProfile, redactObject, redactSecretSource, redactValue, resolveConnectionProfileSecrets, resolveOpenSshHost, resolveProviderId, resolveSecret, runConnectionDiagnostics, runRoute, runSshCommand, serializeRemoteManifest, signWebhookPayload, sortRemoteEntries, summarizeClientDiagnostics, summarizeError, summarizeTransferPlan, throttleByteIterable, uploadFile, validateConnectionProfile, validateSchedule, walkRemoteTree };