disk 0.8.18 → 0.8.20

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.
@@ -0,0 +1,641 @@
1
+ import { Client } from "openapi-fetch";
2
+ import { components, paths } from "@archildata/api-types";
3
+
4
+ //#region src/client.d.ts
5
+ type ApiClient = Client<paths>;
6
+ //#endregion
7
+ //#region src/filesystem.d.ts
8
+ /**
9
+ * A key-addressable filesystem over one or more Archil disks — the existing
10
+ * object API a {@link Disk} already exposes ({@link Disk.getObject},
11
+ * `putObject`, `deleteObject`, `listObjects`, `grep`, `exec`), captured as a
12
+ * contract so a multi-disk {@link Workspace} can be used anywhere a single disk
13
+ * is.
14
+ *
15
+ * A single {@link Disk} is the one-disk case: keys are relative to the disk
16
+ * root. A {@link Workspace} spans several disks, each mounted under a name, so
17
+ * its keys carry that name as the first segment (e.g. `data/reports/q1.csv`)
18
+ * and `listObjects`/`grep` fan out across every disk when the key/prefix
19
+ * doesn't name one.
20
+ *
21
+ * Both `Disk` and `Workspace` implement this interface, which is what keeps the
22
+ * two from drifting — adding a method here is a compile error until both do.
23
+ */
24
+ interface FileSystem {
25
+ /** Read an object's full contents. Throws `ArchilS3Error` (404) if absent. */
26
+ getObject(key: string): Promise<Uint8Array>;
27
+ /** Create or overwrite an object. */
28
+ putObject(key: string, body: string | Uint8Array | ArrayBuffer, contentType?: string): Promise<PutObjectResult>;
29
+ /** Delete an object (idempotent). */
30
+ deleteObject(key: string): Promise<void>;
31
+ /** List objects and common (directory) prefixes under a key prefix. */
32
+ listObjects(prefix?: string, opts?: ListObjectsOptions): Promise<ListObjectsResult>;
33
+ /** Constant-time parallel grep. */
34
+ grep(opts: GrepOptions): Promise<GrepResult>;
35
+ /** Run a command in a sandbox with the filesystem mounted. */
36
+ exec(command: string): Promise<ExecResult>;
37
+ }
38
+ //#endregion
39
+ //#region src/types.d.ts
40
+ type DiskResponse = components["schemas"]["DiskResponse"];
41
+ type MountResponse = components["schemas"]["MountResponse"];
42
+ type MountConfigResponse = components["schemas"]["MountConfigResponse"];
43
+ type DiskMetrics = components["schemas"]["DiskMetrics"];
44
+ type ConnectedClient = components["schemas"]["ConnectedClient"];
45
+ type AuthorizedUser = components["schemas"]["AuthorizedUser"];
46
+ type CreateDiskRequest = components["schemas"]["CreateDiskRequest"];
47
+ type MountConfig = components["schemas"]["MountConfig"];
48
+ type S3Mount = components["schemas"]["S3Mount"];
49
+ type GCSMount = components["schemas"]["GCSMount"];
50
+ type R2Mount = components["schemas"]["R2Mount"];
51
+ type S3CompatibleMount = components["schemas"]["S3CompatibleMount"];
52
+ type AzureBlobMount = components["schemas"]["AzureBlobMount"];
53
+ type DiskUser = components["schemas"]["DiskUser"];
54
+ type TokenUser = components["schemas"]["TokenUser"];
55
+ type AwsStsUser = components["schemas"]["AwsStsUser"];
56
+ type CreateApiTokenRequest = components["schemas"]["CreateApiTokenRequest"];
57
+ type ApiTokenResponse = components["schemas"]["ApiTokenResponse"];
58
+ type ExecDiskResult = components["schemas"]["ExecDiskResult"];
59
+ type ExecRequest = components["schemas"]["ExecRequest"];
60
+ type GrepDiskResult = components["schemas"]["GrepDiskResult"];
61
+ type GrepMatch = components["schemas"]["GrepMatch"];
62
+ type GrepStoppedReason = components["schemas"]["GrepStoppedReason"];
63
+ type DiskStatus = DiskResponse["status"];
64
+ //#endregion
65
+ //#region src/disk.d.ts
66
+ interface MountOptions {
67
+ authToken?: string;
68
+ logLevel?: string;
69
+ serverAddress?: string;
70
+ insecure?: boolean;
71
+ }
72
+ type ExecResult = ExecDiskResult;
73
+ type GrepResult = GrepDiskResult;
74
+ interface GrepOptions {
75
+ /**
76
+ * Directory on the disk to search, relative to the disk root. An empty
77
+ * string or "/" means the disk root.
78
+ */
79
+ directory: string;
80
+ /** Extended regular expression (passed to `grep -E`). */
81
+ pattern: string;
82
+ /** Walk subdirectories breadth-first. Defaults to false. */
83
+ recursive?: boolean;
84
+ /** Wall-clock deadline for the entire request. Defaults to 30s. */
85
+ maxDurationSeconds?: number;
86
+ /**
87
+ * Maximum number of parallel grep workers. Higher values finish larger
88
+ * datasets within the deadline but consume more runtime capacity. The
89
+ * controlplane clamps this to the fleet's currently-available capacity.
90
+ * Defaults to 50.
91
+ */
92
+ concurrency?: number;
93
+ /**
94
+ * Stop scanning once the aggregator has this many matches. Returned
95
+ * matches are a sample of whichever workers reported first, not the
96
+ * lexicographically first N. Defaults to 1000.
97
+ */
98
+ maxResults?: number;
99
+ }
100
+ interface ShareUrlOptions {
101
+ /**
102
+ * Lifetime of the URL in seconds — any positive integer, up to 604800
103
+ * (7 days). Defaults to 86400 (24 hours).
104
+ */
105
+ expiresIn?: number;
106
+ }
107
+ interface ShareUrlResult {
108
+ /** Public, signed, time-limited URL that downloads the file. */
109
+ url: string;
110
+ /** Lifetime of the URL in seconds. */
111
+ expiresIn: number;
112
+ }
113
+ interface ListObjectsOptions {
114
+ /**
115
+ * List the entire subtree under the prefix. When false (the default), only
116
+ * the immediate level is returned — direct objects in `objects` and
117
+ * subdirectory prefixes in `commonPrefixes`, like listing a single directory.
118
+ * When true, every key under the prefix is returned flat (and
119
+ * `commonPrefixes` is empty).
120
+ */
121
+ recursive?: boolean;
122
+ /**
123
+ * Return only the first page instead of auto-paginating. By default
124
+ * listObjects follows continuation tokens until the listing is exhausted and
125
+ * returns every matching key. With `singlePage: true` it makes one request
126
+ * and the result carries `isTruncated` / `nextContinuationToken` so you can
127
+ * page manually (pass the token back via `continuationToken`).
128
+ */
129
+ singlePage?: boolean;
130
+ /**
131
+ * Stop after this many objects total (only meaningful when auto-paginating).
132
+ * The result's `isTruncated` is true if the cap cut the listing short.
133
+ */
134
+ limit?: number;
135
+ /** Start listing from this continuation token (from a prior `nextContinuationToken`). */
136
+ continuationToken?: string;
137
+ /** Return keys lexicographically after this one. */
138
+ startAfter?: string;
139
+ }
140
+ interface S3Object {
141
+ /** Object key (path on the disk). */
142
+ key: string;
143
+ /** Size in bytes. */
144
+ size: number;
145
+ /** Entity tag (quoted MD5 for single-part objects). */
146
+ etag?: string;
147
+ /** Last-modified time, if reported by the server. */
148
+ lastModified?: Date;
149
+ }
150
+ interface PutObjectResult {
151
+ /** Entity tag the server assigned (quoted, per S3 — e.g. `"\"abc123\""`). */
152
+ etag?: string;
153
+ }
154
+ interface ObjectMetadata {
155
+ /** Size in bytes. */
156
+ size: number;
157
+ /** Entity tag (quoted MD5 for single-part objects). */
158
+ etag?: string;
159
+ /** MIME type the object was stored with, if any. */
160
+ contentType?: string;
161
+ /** Last-modified time, if reported by the server. */
162
+ lastModified?: Date;
163
+ }
164
+ interface ListObjectsResult {
165
+ /** Objects in this page. */
166
+ objects: S3Object[];
167
+ /** Directory-like prefixes rolled up by `delimiter` (empty if no delimiter). */
168
+ commonPrefixes: string[];
169
+ /** True if more keys exist beyond this page. */
170
+ isTruncated: boolean;
171
+ /** Token to pass as `continuationToken` to fetch the next page. */
172
+ nextContinuationToken?: string;
173
+ /** Number of keys returned in this page. */
174
+ keyCount: number;
175
+ /** The prefix the listing was filtered by, echoed back by the server. */
176
+ prefix?: string;
177
+ }
178
+ /** A part to list in {@link Disk.completeMultipartUpload}. */
179
+ interface UploadPart {
180
+ /** 1-based part number (1..=10000), strictly increasing across the list. */
181
+ partNumber: number;
182
+ /** Entity tag returned by {@link Disk.uploadPart} for this part. */
183
+ etag: string;
184
+ }
185
+ /** Handle to an in-progress multipart upload, returned by {@link Disk.createMultipartUpload}. */
186
+ interface MultipartUpload {
187
+ /** Server-assigned upload id; pass to uploadPart/complete/abort/listParts. */
188
+ uploadId: string;
189
+ /** The object key this upload targets. */
190
+ key: string;
191
+ /** The bucket (disk id) the upload lives in. */
192
+ bucket: string;
193
+ }
194
+ /** The assembled object, returned by {@link Disk.completeMultipartUpload}. */
195
+ interface CompletedMultipartUpload {
196
+ /** Multipart entity tag — S3's `md5(concat(partMd5s))-N` form. */
197
+ etag?: string;
198
+ /** Resource path of the completed object. */
199
+ location?: string;
200
+ /** The bucket (disk id). */
201
+ bucket?: string;
202
+ /** The object key. */
203
+ key?: string;
204
+ }
205
+ /** One part in a {@link Disk.listParts} listing. */
206
+ interface PartInfo {
207
+ /** 1-based part number. */
208
+ partNumber: number;
209
+ /** Entity tag the server assigned to this part. */
210
+ etag?: string;
211
+ /** Size in bytes. */
212
+ size: number;
213
+ /** Time the part was uploaded, if reported. */
214
+ lastModified?: Date;
215
+ }
216
+ interface ListPartsOptions {
217
+ /** Cap parts returned in one page (server clamps to 1000). */
218
+ maxParts?: number;
219
+ /** Return parts after this part number (for pagination). */
220
+ partNumberMarker?: number;
221
+ }
222
+ interface PartListing {
223
+ /** The bucket (disk id), echoed by the server. */
224
+ bucket?: string;
225
+ /** The object key, echoed by the server. */
226
+ key?: string;
227
+ /** The upload id, echoed by the server. */
228
+ uploadId?: string;
229
+ /** Parts in this page, ascending by part number. */
230
+ parts: PartInfo[];
231
+ /** True if more parts exist beyond this page. */
232
+ isTruncated: boolean;
233
+ /** The part-number marker this page started after. */
234
+ partNumberMarker: number;
235
+ /** Pass back as `partNumberMarker` to fetch the next page. */
236
+ nextPartNumberMarker?: number;
237
+ /** Max parts the server was asked to return. */
238
+ maxParts: number;
239
+ }
240
+ /** One in-progress upload in a {@link Disk.listMultipartUploads} listing. */
241
+ interface MultipartUploadSummary {
242
+ /** The object key the upload targets. */
243
+ key: string;
244
+ /** The upload id. */
245
+ uploadId: string;
246
+ /** When the upload was initiated, if reported. */
247
+ initiated?: Date;
248
+ }
249
+ interface ListMultipartUploadsOptions {
250
+ /** Only list uploads whose key begins with this prefix. */
251
+ prefix?: string;
252
+ /** Roll keys up to this delimiter into `commonPrefixes` (S3 supports "/"). */
253
+ delimiter?: string;
254
+ /** Resume listing keys after this one (with `uploadIdMarker`). */
255
+ keyMarker?: string;
256
+ /** Resume listing uploads after this upload id (requires `keyMarker`). */
257
+ uploadIdMarker?: string;
258
+ /** Cap uploads returned in one page (server clamps to 1000). */
259
+ maxUploads?: number;
260
+ }
261
+ interface MultipartUploadListing {
262
+ /** The bucket (disk id), echoed by the server. */
263
+ bucket?: string;
264
+ /** In-progress uploads in this page. */
265
+ uploads: MultipartUploadSummary[];
266
+ /** Key prefixes rolled up by `delimiter` (empty if no delimiter). */
267
+ commonPrefixes: string[];
268
+ /** True if more uploads exist beyond this page. */
269
+ isTruncated: boolean;
270
+ /** The key marker this page started after, echoed back. */
271
+ keyMarker?: string;
272
+ /** The upload-id marker this page started after, echoed back. */
273
+ uploadIdMarker?: string;
274
+ /** Pass back as `keyMarker` (with `nextUploadIdMarker`) for the next page. */
275
+ nextKeyMarker?: string;
276
+ /** Pass back as `uploadIdMarker` (with `nextKeyMarker`) for the next page. */
277
+ nextUploadIdMarker?: string;
278
+ /** The prefix the listing was filtered by, echoed back. */
279
+ prefix?: string;
280
+ /** The delimiter used, echoed back. */
281
+ delimiter?: string;
282
+ /** Max uploads the server was asked to return. */
283
+ maxUploads?: number;
284
+ }
285
+ interface DeleteObjectsOptions {
286
+ /**
287
+ * Quiet mode: the server omits the per-key success list and returns only
288
+ * failures, so the result's `deleted` array is empty. Cuts response size on
289
+ * large batches. Defaults to false.
290
+ */
291
+ quiet?: boolean;
292
+ }
293
+ /** A single per-key failure within a {@link Disk.deleteObjects} batch. */
294
+ interface DeleteObjectsError {
295
+ /** The key that failed to delete. */
296
+ key: string;
297
+ /** S3 error code (e.g. "AccessDenied", "OperationAborted"), if provided. */
298
+ code?: string;
299
+ /** Human-readable failure detail, if provided. */
300
+ message?: string;
301
+ }
302
+ interface DeleteObjectsResult {
303
+ /** Keys the server confirmed deleted (empty in quiet mode). */
304
+ deleted: string[];
305
+ /** Per-key failures; empty when every key was deleted. */
306
+ errors: DeleteObjectsError[];
307
+ }
308
+ interface PutObjectOptions {
309
+ /** MIME type to store the object with. Default "application/octet-stream". */
310
+ contentType?: string;
311
+ /**
312
+ * Bodies larger than this take the multipart path; bodies at or below it take
313
+ * a single PutObject. Defaults to `partSize` (16 MiB), so by default the
314
+ * switch happens at the part size. Set it lower (e.g. 5 MiB) to start using
315
+ * multipart sooner, or to `Infinity` to force a single PutObject.
316
+ */
317
+ multipartThreshold?: number;
318
+ /**
319
+ * Bytes per part on the multipart path. Clamped to a minimum of 5 MiB (the S3
320
+ * floor for every part but the last). Default 16 MiB.
321
+ */
322
+ partSize?: number;
323
+ /** Max parts uploaded in parallel on the multipart path. Default 4. */
324
+ concurrency?: number;
325
+ }
326
+ /**
327
+ * The S3 transport function {@link DiskMultipart} uses, supplied by the owning
328
+ * {@link Disk} so the namespace shares the disk's credential and endpoint.
329
+ * @internal
330
+ */
331
+ type S3RequestFn = (method: "GET" | "PUT" | "DELETE" | "HEAD" | "POST", key: string, opts?: {
332
+ body?: string | Uint8Array | ArrayBuffer;
333
+ contentType?: string;
334
+ query?: Record<string, string | number>;
335
+ retry?: boolean;
336
+ }) => Promise<{
337
+ ok: boolean;
338
+ status: number;
339
+ statusText: string;
340
+ headers: Headers;
341
+ body: Uint8Array;
342
+ }>;
343
+ declare class Disk implements FileSystem {
344
+ readonly id: string;
345
+ readonly name: string;
346
+ readonly organization: string;
347
+ readonly status: DiskStatus;
348
+ readonly provider: string;
349
+ readonly region: string;
350
+ readonly createdAt: string;
351
+ readonly fsHandlerStatus?: string;
352
+ readonly lastAccessed?: string;
353
+ readonly dataSize?: number;
354
+ readonly monthlyUsage?: string;
355
+ readonly mounts?: MountResponse[];
356
+ readonly metrics?: DiskMetrics;
357
+ readonly connectedClients?: ConnectedClient[];
358
+ readonly authorizedUsers?: AuthorizedUser[];
359
+ readonly allowedIps?: string[];
360
+ /** @internal */
361
+ private readonly _client;
362
+ /** @internal */
363
+ private readonly _archilRegion;
364
+ /** Base URL for the S3-compatible API (port 9000 ingress). Empty if unset. */
365
+ private readonly _s3BaseUrl;
366
+ /** Lazily-constructed multipart namespace (see {@link multipart}). @internal */
367
+ private _multipart?;
368
+ /** @internal */
369
+ constructor(data: DiskResponse, client: ApiClient, archilRegion: string, s3BaseUrl?: string);
370
+ toJSON(): DiskResponse;
371
+ addUser(user: DiskUser): Promise<AuthorizedUser>;
372
+ removeUser(userType: "token" | "awssts", identifier: string): Promise<void>;
373
+ createToken(nickname: string): Promise<AuthorizedUser & {
374
+ token: string;
375
+ identifier: string;
376
+ }>;
377
+ removeTokenUser(identifier: string): Promise<void>;
378
+ getAllowedIPs(): Promise<string[]>;
379
+ setAllowedIPs(allowedIps: string[]): Promise<string[]>;
380
+ addAllowedIP(ip: string): Promise<string[]>;
381
+ removeAllowedIP(ip: string): Promise<string[]>;
382
+ delete(): Promise<void>;
383
+ /**
384
+ * Execute a command in a container with this disk mounted.
385
+ * Blocks until the command completes and returns stdout, stderr, and exit code.
386
+ */
387
+ exec(command: string): Promise<ExecResult>;
388
+ /**
389
+ * Constant-time parallel grep across files on this disk. Listing and
390
+ * matching are fanned out across ephemeral exec containers; the request
391
+ * finishes within the supplied time budget regardless of dataset size.
392
+ *
393
+ * The returned `stoppedReason` says whether the search ran to completion
394
+ * or short-circuited on `maxResults` / `maxDurationSeconds`. When
395
+ * stopping early, the matches returned are a sample (whichever workers
396
+ * reported first), not the lexicographically first N.
397
+ */
398
+ grep(opts: GrepOptions): Promise<GrepResult>;
399
+ /**
400
+ * Create a signed, time-limited URL that lets anyone download a single file
401
+ * from this disk without authentication. The returned URL embeds a
402
+ * cryptographically signed token carrying the disk, the file's key, and an
403
+ * expiry — share it directly; no API key is needed to redeem it.
404
+ *
405
+ * @param key Path to the file on the disk (e.g. "reports/2026-01/data.pdf").
406
+ * @param opts `expiresIn` sets the URL lifetime in seconds (any positive
407
+ * integer, max 604800 = 7 days). Defaults to 24h.
408
+ */
409
+ share(key: string, opts?: ShareUrlOptions): Promise<ShareUrlResult>;
410
+ /**
411
+ * Read an object from the disk via the S3-compatible GetObject API and return
412
+ * its full contents as bytes. Throws `ArchilS3Error` if the object does not
413
+ * exist (status 404, code "NoSuchKey") or the request is rejected; use
414
+ * `headObject`/`objectExists` to check existence without throwing.
415
+ *
416
+ * @param key Path on the disk (e.g. "reports/2026-01/data.json")
417
+ */
418
+ getObject(key: string): Promise<Uint8Array>;
419
+ /**
420
+ * Fetch an object's metadata (size, etag, content type, last-modified) without
421
+ * downloading its contents, via the S3-compatible HeadObject API. Returns
422
+ * `null` if the object does not exist.
423
+ *
424
+ * @param key Path on the disk (e.g. "reports/2026-01/data.json")
425
+ */
426
+ headObject(key: string): Promise<ObjectMetadata | null>;
427
+ /** Whether an object exists on the disk (a HeadObject that maps 404 → false). */
428
+ objectExists(key: string): Promise<boolean>;
429
+ /**
430
+ * Write an object to the disk via the S3-compatible API. Handles any size:
431
+ * bodies at or below `multipartThreshold` (defaults to `partSize`, i.e.
432
+ * 16 MiB) go through a single PutObject request; larger bodies are uploaded as
433
+ * a multipart upload — split into `partSize` parts, uploaded with bounded
434
+ * `concurrency` (default 4), and assembled. A failed part aborts the upload so
435
+ * nothing is left half-staged. For manual control over the multipart
436
+ * lifecycle, use the {@link multipart} namespace.
437
+ *
438
+ * Faster than exec for large files — no container overhead, no command-length
439
+ * limits. Returns the entity tag the server assigned (a multipart upload's tag
440
+ * is S3's `md5(concat(partMd5s))-N` form rather than a plain MD5).
441
+ *
442
+ * @param key Path on the disk (e.g. "reports/2026-01/data.json")
443
+ * @param body Contents as a string, Uint8Array/Buffer, or ArrayBuffer
444
+ * @param options Either a content-type string, or {@link PutObjectOptions}
445
+ * (`contentType`, `multipartThreshold`, `partSize`,
446
+ * `concurrency`). Content type defaults to
447
+ * "application/octet-stream".
448
+ */
449
+ putObject(key: string, body: string | Uint8Array | ArrayBuffer, options?: string | PutObjectOptions): Promise<PutObjectResult>;
450
+ /**
451
+ * Upload a large body through the multipart lifecycle: split into `partSize`
452
+ * parts, upload them with bounded concurrency, then complete — aborting the
453
+ * upload if any part fails so nothing is left half-staged. @internal
454
+ */
455
+ private _putMultipart;
456
+ /**
457
+ * Append bytes to an object via the S3-compatible PutObject append extension
458
+ * (`?append=true`). If the object already exists the bytes are appended to it;
459
+ * if it doesn't, it is created. Returns the entity tag of the full object
460
+ * after the append.
461
+ *
462
+ * Each call may append at most 1 MiB — the server rejects a larger body with
463
+ * `EntityTooLarge`. To grow an object past that, append in chunks (or use
464
+ * {@link putObject} for a one-shot large write).
465
+ *
466
+ * Unlike most operations this is NOT auto-retried on a transient error:
467
+ * append isn't idempotent, so retrying a succeeded-but-unacknowledged append
468
+ * would duplicate the bytes. On a transient failure, re-append yourself only
469
+ * after confirming the object's size.
470
+ *
471
+ * @param key Path on the disk (e.g. "logs/app.log")
472
+ * @param body Bytes to append (string, Uint8Array/Buffer, or ArrayBuffer)
473
+ * @param contentType MIME type, applied only when the object is newly created.
474
+ */
475
+ appendObject(key: string, body: string | Uint8Array | ArrayBuffer, contentType?: string): Promise<PutObjectResult>;
476
+ /**
477
+ * Delete an object from the disk via the S3-compatible DeleteObject API.
478
+ * Idempotent: deleting a key that doesn't exist resolves successfully, per
479
+ * S3 semantics.
480
+ *
481
+ * @param key Path on the disk (e.g. "project/dist/server.cjs")
482
+ */
483
+ deleteObject(key: string): Promise<void>;
484
+ /**
485
+ * List objects on the disk via the S3-compatible ListObjectsV2 API. By
486
+ * default this follows continuation tokens until the listing is exhausted and
487
+ * returns every matching key. Use `limit` to cap the total, `singlePage` for a
488
+ * single request, or {@link listObjectsPages} to stream pages without loading
489
+ * everything into memory.
490
+ *
491
+ * @param prefix Only return keys beginning with this prefix (omit for all).
492
+ * @param opts Listing and pagination options.
493
+ */
494
+ listObjects(prefix?: string, opts?: ListObjectsOptions): Promise<ListObjectsResult>;
495
+ /**
496
+ * Yield ListObjectsV2 pages lazily, following continuation tokens. A
497
+ * memory-friendly way to process a large listing without materializing it:
498
+ *
499
+ * ```ts
500
+ * for await (const page of disk.listObjectsPages("logs/")) {
501
+ * for (const obj of page.objects) process(obj);
502
+ * }
503
+ * ```
504
+ *
505
+ * @param prefix Only return keys beginning with this prefix (omit for all).
506
+ * @param opts Listing options (`limit` / `singlePage` are ignored here —
507
+ * control your own loop).
508
+ */
509
+ listObjectsPages(prefix?: string, opts?: ListObjectsOptions): AsyncGenerator<ListObjectsResult>;
510
+ /** Fetch a single ListObjectsV2 page. @internal */
511
+ private _listObjectsPage;
512
+ /**
513
+ * Delete up to many objects in a single S3-compatible DeleteObjects request.
514
+ * Unlike {@link deleteObject}, failures are reported per key rather than
515
+ * thrown: the result's `deleted` lists the keys that were removed and
516
+ * `errors` lists the ones that weren't (with the server's code/message). A
517
+ * key that didn't exist still counts as deleted, per S3 semantics.
518
+ *
519
+ * The server caps a single request at 1000 keys; this method transparently
520
+ * splits larger inputs into 1000-key batches and merges the results.
521
+ *
522
+ * @param keys Object keys to delete.
523
+ * @param opts `quiet` suppresses the per-key success list server-side.
524
+ */
525
+ deleteObjects(keys: string[], opts?: DeleteObjectsOptions): Promise<DeleteObjectsResult>;
526
+ /**
527
+ * The advanced, opt-in multipart-upload API. Drive the raw lifecycle
528
+ * yourself — `create` → `uploadPart` → `complete` (or `abort`), plus
529
+ * `listParts` / `listUploads`. Most callers don't need this: {@link putObject}
530
+ * runs the whole lifecycle automatically for large bodies. Reach for it only
531
+ * when you need manual control (e.g. uploading parts from separate processes),
532
+ * and note you then own part-size, memory, and concurrency management.
533
+ */
534
+ get multipart(): DiskMultipart;
535
+ /**
536
+ * Send a single request to the disk's S3-compatible endpoint. This reuses the
537
+ * control-plane client purely for its credential and transport — the same
538
+ * `Authorization` header is sent and verified by the same code server-side —
539
+ * pointed at the S3 host. Returns the response status and fully-buffered body
540
+ * so callers can inspect both regardless of the verb used.
541
+ *
542
+ * The S3 routes (`/{diskId}/{key}` for objects, `/{diskId}` for the bucket)
543
+ * are not part of the typed control-plane API, so the path and per-request
544
+ * options are passed untyped. An empty `key` targets the bucket itself (used
545
+ * by listObjects).
546
+ *
547
+ * @internal
548
+ */
549
+ private _s3Request;
550
+ /**
551
+ * Connect to this disk's data plane via the native ArchilClient.
552
+ *
553
+ * Requires the native module to be available (platform-specific .node binary).
554
+ */
555
+ mount(opts?: MountOptions): Promise<unknown>;
556
+ }
557
+ /**
558
+ * The advanced, opt-in multipart-upload namespace, reached via {@link Disk.multipart}.
559
+ * Drives the raw S3 multipart lifecycle — `create` → `uploadPart` → `complete`
560
+ * (or `abort`), plus `listParts` / `listUploads`. Prefer {@link Disk.putObject},
561
+ * which runs this lifecycle automatically for large bodies; use this only when
562
+ * you need manual control, in which case you own part-size, memory, and
563
+ * concurrency management.
564
+ */
565
+ declare class DiskMultipart {
566
+ private readonly diskId;
567
+ private readonly s3Request;
568
+ /** @internal */
569
+ constructor(diskId: string, s3Request: S3RequestFn);
570
+ /**
571
+ * Start a multipart upload (CreateMultipartUpload) and return its `uploadId`.
572
+ *
573
+ * @param key Path on the disk the finished object will live at.
574
+ * @param contentType MIME type to store the object with.
575
+ */
576
+ create(key: string, contentType?: string): Promise<MultipartUpload>;
577
+ /**
578
+ * Upload one part (UploadPart) and return its entity tag, which you must
579
+ * collect (with its part number) and pass to {@link complete}. Every part
580
+ * except the last must be at least 5 MiB.
581
+ *
582
+ * @param key The upload's object key.
583
+ * @param uploadId The id from {@link create}.
584
+ * @param partNumber 1-based part number (1..=10000).
585
+ * @param body Part contents as a string, Uint8Array/Buffer, or ArrayBuffer.
586
+ */
587
+ uploadPart(key: string, uploadId: string, partNumber: number, body: string | Uint8Array | ArrayBuffer): Promise<UploadPart>;
588
+ /**
589
+ * Finish a multipart upload (CompleteMultipartUpload), assembling the listed
590
+ * parts into one object. Parts are sorted by part number before submission
591
+ * (the server requires strictly-increasing order).
592
+ *
593
+ * Unlike the other operations this is NOT auto-retried on a transient error:
594
+ * the gateway isn't idempotent for completion, so a retry after a
595
+ * successful-but-unacknowledged complete would return a spurious NoSuchUpload.
596
+ * On a transient failure, re-drive completion yourself only after confirming
597
+ * the object isn't already present.
598
+ *
599
+ * @param key The upload's object key.
600
+ * @param uploadId The id from {@link create}.
601
+ * @param parts The `{ partNumber, etag }` pairs from {@link uploadPart}.
602
+ */
603
+ complete(key: string, uploadId: string, parts: UploadPart[]): Promise<CompletedMultipartUpload>;
604
+ /**
605
+ * Abort a multipart upload (AbortMultipartUpload), discarding every staged
606
+ * part. Idempotent against an upload that's already gone (404 / NoSuchUpload
607
+ * resolves successfully).
608
+ *
609
+ * @param key The upload's object key.
610
+ * @param uploadId The id from {@link create}.
611
+ */
612
+ abort(key: string, uploadId: string): Promise<void>;
613
+ /**
614
+ * List the parts already uploaded for an in-progress upload (ListParts).
615
+ * Returns a single page; follow `nextPartNumberMarker` (when `isTruncated`)
616
+ * to page through the rest.
617
+ *
618
+ * @param key The upload's object key.
619
+ * @param uploadId The id from {@link create}.
620
+ * @param opts `maxParts` / `partNumberMarker` pagination controls.
621
+ */
622
+ listParts(key: string, uploadId: string, opts?: ListPartsOptions): Promise<PartListing>;
623
+ /**
624
+ * List in-progress multipart uploads on the disk (ListMultipartUploads).
625
+ * Returns a single page; follow `nextKeyMarker` / `nextUploadIdMarker` (when
626
+ * `isTruncated`) for the rest.
627
+ *
628
+ * @param opts Prefix/delimiter filter and pagination markers.
629
+ */
630
+ listUploads(opts?: ListMultipartUploadsOptions): Promise<MultipartUploadListing>;
631
+ }
632
+ /**
633
+ * Choose the part size for a `totalBytes` multipart upload. Returns
634
+ * `requestedPartSize` unless splitting at that size would exceed the server's
635
+ * 10,000-part cap, in which case it grows the part size (rounded up to a whole
636
+ * MiB) so the body fits in ≤ 10,000 parts — mirroring boto3's chunk-size
637
+ * adjustment. Parts only ever get larger, so they stay above the 5 MiB floor.
638
+ */
639
+ declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
640
+ //#endregion
641
+ export { AwsStsUser as A, ExecRequest as B, S3Object as C, effectiveUploadPartSize as D, UploadPart as E, DiskMetrics as F, MountConfigResponse as G, GrepMatch as H, DiskResponse as I, S3CompatibleMount as J, MountResponse as K, DiskStatus as L, ConnectedClient as M, CreateApiTokenRequest as N, ApiTokenResponse as O, CreateDiskRequest as P, ApiClient as Q, DiskUser as R, PutObjectResult as S, ShareUrlResult as T, GrepStoppedReason as U, GCSMount as V, MountConfig as W, TokenUser as X, S3Mount as Y, FileSystem as Z, MultipartUploadSummary as _, Disk as a, PartListing as b, GrepOptions as c, ListObjectsOptions as d, ListObjectsResult as f, MultipartUploadListing as g, MultipartUpload as h, DeleteObjectsResult as i, AzureBlobMount as j, AuthorizedUser as k, GrepResult as l, MountOptions as m, DeleteObjectsError as n, DiskMultipart as o, ListPartsOptions as p, R2Mount as q, DeleteObjectsOptions as r, ExecResult as s, CompletedMultipartUpload as t, ListMultipartUploadsOptions as u, ObjectMetadata as v, ShareUrlOptions as w, PutObjectOptions as x, PartInfo as y, ExecDiskResult as z };