disk 0.8.11 → 0.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -0
- package/dist/cli.js +415 -22
- package/dist/index.cjs +382 -20
- package/dist/index.d.cts +435 -4
- package/dist/index.d.ts +435 -4
- package/dist/index.js +378 -19
- package/package.json +7 -4
package/dist/index.d.cts
CHANGED
|
@@ -148,6 +148,48 @@ interface paths {
|
|
|
148
148
|
patch?: never;
|
|
149
149
|
trace?: never;
|
|
150
150
|
};
|
|
151
|
+
"/api/disks/{id}/grep": {
|
|
152
|
+
parameters: {
|
|
153
|
+
query?: never;
|
|
154
|
+
header?: never;
|
|
155
|
+
path?: never;
|
|
156
|
+
cookie?: never;
|
|
157
|
+
};
|
|
158
|
+
get?: never;
|
|
159
|
+
put?: never;
|
|
160
|
+
/**
|
|
161
|
+
* Constant-time parallel grep over a directory on a disk
|
|
162
|
+
* @description Searches files under a directory on the disk for lines matching a
|
|
163
|
+
* regular expression. Listing and matching are fanned out across
|
|
164
|
+
* ephemeral exec containers, so the request finishes within the user's
|
|
165
|
+
* time budget regardless of the size of the directory.
|
|
166
|
+
*
|
|
167
|
+
* The user controls cost and latency with three knobs:
|
|
168
|
+
*
|
|
169
|
+
* - `maxDurationSeconds` is the wall-clock deadline.
|
|
170
|
+
* - `concurrency` is the maximum number of parallel grep workers.
|
|
171
|
+
* Higher concurrency finishes larger datasets within the deadline;
|
|
172
|
+
* the controlplane clamps to the runtime fleet's current capacity.
|
|
173
|
+
* - `maxResults` causes the search to short-circuit after the
|
|
174
|
+
* aggregator has collected this many matches.
|
|
175
|
+
*
|
|
176
|
+
* With `recursive: false` only files directly under `directory` are
|
|
177
|
+
* searched. With `recursive: true` subdirectories are walked
|
|
178
|
+
* breadth-first and grep workers are dispatched as soon as each level
|
|
179
|
+
* finishes listing — listing and matching overlap.
|
|
180
|
+
*
|
|
181
|
+
* The matches returned when stopping early on `maxResults` are a sample
|
|
182
|
+
* of whichever workers reported first, not the lexicographically first
|
|
183
|
+
* N. The response surfaces `stoppedReason` so callers can distinguish
|
|
184
|
+
* completion from early termination.
|
|
185
|
+
*/
|
|
186
|
+
post: operations["grepDisk"];
|
|
187
|
+
delete?: never;
|
|
188
|
+
options?: never;
|
|
189
|
+
head?: never;
|
|
190
|
+
patch?: never;
|
|
191
|
+
trace?: never;
|
|
192
|
+
};
|
|
151
193
|
"/api/exec": {
|
|
152
194
|
parameters: {
|
|
153
195
|
query?: never;
|
|
@@ -758,6 +800,108 @@ interface components {
|
|
|
758
800
|
success: boolean;
|
|
759
801
|
data: components["schemas"]["ExecDiskResult"];
|
|
760
802
|
};
|
|
803
|
+
GrepDiskRequest: {
|
|
804
|
+
/**
|
|
805
|
+
* @description Directory on the disk to search, relative to the disk root.
|
|
806
|
+
* An empty string or "/" means the disk root.
|
|
807
|
+
* @example data/logs
|
|
808
|
+
*/
|
|
809
|
+
directory: string;
|
|
810
|
+
/**
|
|
811
|
+
* @description Extended regular expression (passed to `grep -E`)
|
|
812
|
+
* @example ERROR|FATAL
|
|
813
|
+
*/
|
|
814
|
+
pattern: string;
|
|
815
|
+
/**
|
|
816
|
+
* @description When true, walks subdirectories breadth-first.
|
|
817
|
+
* @default false
|
|
818
|
+
*/
|
|
819
|
+
recursive: boolean;
|
|
820
|
+
/**
|
|
821
|
+
* @description Wall-clock deadline for the entire request. Capped at 30
|
|
822
|
+
* seconds because the runtime exec container itself is bounded
|
|
823
|
+
* at ~30s; longer requests would have their workers killed
|
|
824
|
+
* mid-scan.
|
|
825
|
+
* @default 30
|
|
826
|
+
*/
|
|
827
|
+
maxDurationSeconds: number;
|
|
828
|
+
/**
|
|
829
|
+
* @description Maximum number of parallel grep workers. Higher values finish
|
|
830
|
+
* larger datasets within the deadline but consume more runtime
|
|
831
|
+
* capacity. The controlplane clamps this to the fleet's
|
|
832
|
+
* currently-available capacity.
|
|
833
|
+
* @default 50
|
|
834
|
+
*/
|
|
835
|
+
concurrency: number;
|
|
836
|
+
/**
|
|
837
|
+
* @description Stop scanning once the aggregator has this many matches.
|
|
838
|
+
* Returned matches are a sample of whichever workers reported
|
|
839
|
+
* first, not the lexicographically first N.
|
|
840
|
+
* @default 1000
|
|
841
|
+
*/
|
|
842
|
+
maxResults: number;
|
|
843
|
+
};
|
|
844
|
+
GrepMatch: {
|
|
845
|
+
/**
|
|
846
|
+
* @description Path to the file (relative to the disk root).
|
|
847
|
+
* @example data/logs/2026-05-03.log
|
|
848
|
+
*/
|
|
849
|
+
file: string;
|
|
850
|
+
/**
|
|
851
|
+
* @description 1-based line number where the match occurred.
|
|
852
|
+
* @example 142
|
|
853
|
+
*/
|
|
854
|
+
line: number;
|
|
855
|
+
/** @description The matching line. */
|
|
856
|
+
text: string;
|
|
857
|
+
};
|
|
858
|
+
/**
|
|
859
|
+
* @description Why the search stopped.
|
|
860
|
+
* - `completed`: every file under the directory was scanned successfully.
|
|
861
|
+
* - `incomplete`: pipeline ran to its natural end but one or more
|
|
862
|
+
* batches errored (invalid regex, unreadable file, runtime issue).
|
|
863
|
+
* Results may be partial or wrong; do not rely on completeness.
|
|
864
|
+
* - `max_results`: hit `maxResults` before scanning everything.
|
|
865
|
+
* - `deadline`: hit `maxDurationSeconds`.
|
|
866
|
+
* - `list_failed`: directory listing failed; partial results
|
|
867
|
+
* may be present.
|
|
868
|
+
* @enum {string}
|
|
869
|
+
*/
|
|
870
|
+
GrepStoppedReason: "completed" | "incomplete" | "max_results" | "deadline" | "list_failed";
|
|
871
|
+
GrepDiskResult: {
|
|
872
|
+
matches: components["schemas"]["GrepMatch"][];
|
|
873
|
+
stoppedReason: components["schemas"]["GrepStoppedReason"];
|
|
874
|
+
/** @description Files actually fed to a grep container. */
|
|
875
|
+
filesScanned: number;
|
|
876
|
+
/** @description Number of grep containers started for this request. */
|
|
877
|
+
containersDispatched: number;
|
|
878
|
+
/**
|
|
879
|
+
* Format: double
|
|
880
|
+
* @description Sum of per-container execution time in seconds, measured by the
|
|
881
|
+
* runtime. Approximates billable container-seconds.
|
|
882
|
+
*/
|
|
883
|
+
computeSecondsUsed: number;
|
|
884
|
+
/** @description End-to-end wall clock measured by the server. */
|
|
885
|
+
durationMs: number;
|
|
886
|
+
/**
|
|
887
|
+
* @description Wall-clock time spent enumerating files via listObjects, from
|
|
888
|
+
* the request's start to the moment listing fully drained (or
|
|
889
|
+
* was canceled). Listing and matching overlap, so listingMs +
|
|
890
|
+
* grepMs typically exceeds durationMs.
|
|
891
|
+
*/
|
|
892
|
+
listingMs: number;
|
|
893
|
+
/**
|
|
894
|
+
* @description Wall-clock time spent matching, from the first grep container
|
|
895
|
+
* being dispatched to the last container reporting results. 0 if
|
|
896
|
+
* no batches ran.
|
|
897
|
+
*/
|
|
898
|
+
grepMs: number;
|
|
899
|
+
};
|
|
900
|
+
ApiResponse_GrepDisk: {
|
|
901
|
+
/** @example true */
|
|
902
|
+
success: boolean;
|
|
903
|
+
data: components["schemas"]["GrepDiskResult"];
|
|
904
|
+
};
|
|
761
905
|
};
|
|
762
906
|
responses: {
|
|
763
907
|
/** @description Invalid or missing authentication credentials */
|
|
@@ -1119,6 +1263,37 @@ interface operations {
|
|
|
1119
1263
|
};
|
|
1120
1264
|
};
|
|
1121
1265
|
};
|
|
1266
|
+
grepDisk: {
|
|
1267
|
+
parameters: {
|
|
1268
|
+
query?: never;
|
|
1269
|
+
header?: never;
|
|
1270
|
+
path: {
|
|
1271
|
+
/** @description Disk ID (format `dsk-{16 hex chars}`) */
|
|
1272
|
+
id: components["parameters"]["DiskId"];
|
|
1273
|
+
};
|
|
1274
|
+
cookie?: never;
|
|
1275
|
+
};
|
|
1276
|
+
requestBody: {
|
|
1277
|
+
content: {
|
|
1278
|
+
"application/json": components["schemas"]["GrepDiskRequest"];
|
|
1279
|
+
};
|
|
1280
|
+
};
|
|
1281
|
+
responses: {
|
|
1282
|
+
/** @description Grep completed (possibly stopped early) */
|
|
1283
|
+
200: {
|
|
1284
|
+
headers: {
|
|
1285
|
+
[name: string]: unknown;
|
|
1286
|
+
};
|
|
1287
|
+
content: {
|
|
1288
|
+
"application/json": components["schemas"]["ApiResponse_GrepDisk"];
|
|
1289
|
+
};
|
|
1290
|
+
};
|
|
1291
|
+
400: components["responses"]["ValidationError"];
|
|
1292
|
+
401: components["responses"]["Unauthorized"];
|
|
1293
|
+
404: components["responses"]["NotFound"];
|
|
1294
|
+
500: components["responses"]["InternalError"];
|
|
1295
|
+
};
|
|
1296
|
+
};
|
|
1122
1297
|
exec: {
|
|
1123
1298
|
parameters: {
|
|
1124
1299
|
query?: never;
|
|
@@ -1260,6 +1435,9 @@ type CreateApiTokenRequest = components["schemas"]["CreateApiTokenRequest"];
|
|
|
1260
1435
|
type ApiTokenResponse = components["schemas"]["ApiTokenResponse"];
|
|
1261
1436
|
type ExecDiskResult = components["schemas"]["ExecDiskResult"];
|
|
1262
1437
|
type ExecRequest = components["schemas"]["ExecRequest"];
|
|
1438
|
+
type GrepDiskResult = components["schemas"]["GrepDiskResult"];
|
|
1439
|
+
type GrepMatch = components["schemas"]["GrepMatch"];
|
|
1440
|
+
type GrepStoppedReason = components["schemas"]["GrepStoppedReason"];
|
|
1263
1441
|
type DiskStatus = DiskResponse["status"];
|
|
1264
1442
|
|
|
1265
1443
|
interface MountOptions {
|
|
@@ -1269,6 +1447,112 @@ interface MountOptions {
|
|
|
1269
1447
|
insecure?: boolean;
|
|
1270
1448
|
}
|
|
1271
1449
|
type ExecResult = ExecDiskResult;
|
|
1450
|
+
type GrepResult = GrepDiskResult;
|
|
1451
|
+
|
|
1452
|
+
interface GrepOptions {
|
|
1453
|
+
/**
|
|
1454
|
+
* Directory on the disk to search, relative to the disk root. An empty
|
|
1455
|
+
* string or "/" means the disk root.
|
|
1456
|
+
*/
|
|
1457
|
+
directory: string;
|
|
1458
|
+
/** Extended regular expression (passed to `grep -E`). */
|
|
1459
|
+
pattern: string;
|
|
1460
|
+
/** Walk subdirectories breadth-first. Defaults to false. */
|
|
1461
|
+
recursive?: boolean;
|
|
1462
|
+
/** Wall-clock deadline for the entire request. Defaults to 30s. */
|
|
1463
|
+
maxDurationSeconds?: number;
|
|
1464
|
+
/**
|
|
1465
|
+
* Maximum number of parallel grep workers. Higher values finish larger
|
|
1466
|
+
* datasets within the deadline but consume more runtime capacity. The
|
|
1467
|
+
* controlplane clamps this to the fleet's currently-available capacity.
|
|
1468
|
+
* Defaults to 50.
|
|
1469
|
+
*/
|
|
1470
|
+
concurrency?: number;
|
|
1471
|
+
/**
|
|
1472
|
+
* Stop scanning once the aggregator has this many matches. Returned
|
|
1473
|
+
* matches are a sample of whichever workers reported first, not the
|
|
1474
|
+
* lexicographically first N. Defaults to 1000.
|
|
1475
|
+
*/
|
|
1476
|
+
maxResults?: number;
|
|
1477
|
+
}
|
|
1478
|
+
interface ShareUrlOptions {
|
|
1479
|
+
/**
|
|
1480
|
+
* Lifetime of the URL in seconds — any positive integer, up to 604800
|
|
1481
|
+
* (7 days). Defaults to 86400 (24 hours).
|
|
1482
|
+
*/
|
|
1483
|
+
expiresIn?: number;
|
|
1484
|
+
}
|
|
1485
|
+
interface ShareUrlResult {
|
|
1486
|
+
/** Public, signed, time-limited URL that downloads the file. */
|
|
1487
|
+
url: string;
|
|
1488
|
+
/** Lifetime of the URL in seconds. */
|
|
1489
|
+
expiresIn: number;
|
|
1490
|
+
}
|
|
1491
|
+
interface ListObjectsOptions {
|
|
1492
|
+
/**
|
|
1493
|
+
* List the entire subtree under the prefix. When false (the default), only
|
|
1494
|
+
* the immediate level is returned — direct objects in `objects` and
|
|
1495
|
+
* subdirectory prefixes in `commonPrefixes`, like listing a single directory.
|
|
1496
|
+
* When true, every key under the prefix is returned flat (and
|
|
1497
|
+
* `commonPrefixes` is empty).
|
|
1498
|
+
*/
|
|
1499
|
+
recursive?: boolean;
|
|
1500
|
+
/**
|
|
1501
|
+
* Return only the first page instead of auto-paginating. By default
|
|
1502
|
+
* listObjects follows continuation tokens until the listing is exhausted and
|
|
1503
|
+
* returns every matching key. With `singlePage: true` it makes one request
|
|
1504
|
+
* and the result carries `isTruncated` / `nextContinuationToken` so you can
|
|
1505
|
+
* page manually (pass the token back via `continuationToken`).
|
|
1506
|
+
*/
|
|
1507
|
+
singlePage?: boolean;
|
|
1508
|
+
/**
|
|
1509
|
+
* Stop after this many objects total (only meaningful when auto-paginating).
|
|
1510
|
+
* The result's `isTruncated` is true if the cap cut the listing short.
|
|
1511
|
+
*/
|
|
1512
|
+
limit?: number;
|
|
1513
|
+
/** Start listing from this continuation token (from a prior `nextContinuationToken`). */
|
|
1514
|
+
continuationToken?: string;
|
|
1515
|
+
/** Return keys lexicographically after this one. */
|
|
1516
|
+
startAfter?: string;
|
|
1517
|
+
}
|
|
1518
|
+
interface S3Object {
|
|
1519
|
+
/** Object key (path on the disk). */
|
|
1520
|
+
key: string;
|
|
1521
|
+
/** Size in bytes. */
|
|
1522
|
+
size: number;
|
|
1523
|
+
/** Entity tag (quoted MD5 for single-part objects). */
|
|
1524
|
+
etag?: string;
|
|
1525
|
+
/** Last-modified time, if reported by the server. */
|
|
1526
|
+
lastModified?: Date;
|
|
1527
|
+
}
|
|
1528
|
+
interface PutObjectResult {
|
|
1529
|
+
/** Entity tag the server assigned (quoted, per S3 — e.g. `"\"abc123\""`). */
|
|
1530
|
+
etag?: string;
|
|
1531
|
+
}
|
|
1532
|
+
interface ObjectMetadata {
|
|
1533
|
+
/** Size in bytes. */
|
|
1534
|
+
size: number;
|
|
1535
|
+
/** Entity tag (quoted MD5 for single-part objects). */
|
|
1536
|
+
etag?: string;
|
|
1537
|
+
/** MIME type the object was stored with, if any. */
|
|
1538
|
+
contentType?: string;
|
|
1539
|
+
/** Last-modified time, if reported by the server. */
|
|
1540
|
+
lastModified?: Date;
|
|
1541
|
+
}
|
|
1542
|
+
interface ListObjectsResult {
|
|
1543
|
+
/** Objects in this page. */
|
|
1544
|
+
objects: S3Object[];
|
|
1545
|
+
/** Directory-like prefixes rolled up by `delimiter` (empty if no delimiter). */
|
|
1546
|
+
commonPrefixes: string[];
|
|
1547
|
+
/** True if more keys exist beyond this page. */
|
|
1548
|
+
isTruncated: boolean;
|
|
1549
|
+
/** Token to pass as `continuationToken` to fetch the next page. */
|
|
1550
|
+
nextContinuationToken?: string;
|
|
1551
|
+
/** Number of keys returned in this page. */
|
|
1552
|
+
keyCount: number;
|
|
1553
|
+
/** The prefix the listing was filtered by, echoed back by the server. */
|
|
1554
|
+
prefix?: string;
|
|
1555
|
+
}
|
|
1272
1556
|
declare class Disk {
|
|
1273
1557
|
readonly id: string;
|
|
1274
1558
|
readonly name: string;
|
|
@@ -1290,8 +1574,10 @@ declare class Disk {
|
|
|
1290
1574
|
private readonly _client;
|
|
1291
1575
|
/** @internal */
|
|
1292
1576
|
private readonly _archilRegion;
|
|
1577
|
+
/** Base URL for the S3-compatible API (port 9000 ingress). Empty if unset. */
|
|
1578
|
+
private readonly _s3BaseUrl;
|
|
1293
1579
|
/** @internal */
|
|
1294
|
-
constructor(data: DiskResponse, client: ApiClient, archilRegion: string);
|
|
1580
|
+
constructor(data: DiskResponse, client: ApiClient, archilRegion: string, s3BaseUrl?: string);
|
|
1295
1581
|
toJSON(): DiskResponse;
|
|
1296
1582
|
addUser(user: DiskUser): Promise<AuthorizedUser>;
|
|
1297
1583
|
removeUser(userType: "token" | "awssts", identifier: string): Promise<void>;
|
|
@@ -1310,6 +1596,108 @@ declare class Disk {
|
|
|
1310
1596
|
* Blocks until the command completes and returns stdout, stderr, and exit code.
|
|
1311
1597
|
*/
|
|
1312
1598
|
exec(command: string): Promise<ExecResult>;
|
|
1599
|
+
/**
|
|
1600
|
+
* Constant-time parallel grep across files on this disk. Listing and
|
|
1601
|
+
* matching are fanned out across ephemeral exec containers; the request
|
|
1602
|
+
* finishes within the supplied time budget regardless of dataset size.
|
|
1603
|
+
*
|
|
1604
|
+
* The returned `stoppedReason` says whether the search ran to completion
|
|
1605
|
+
* or short-circuited on `maxResults` / `maxDurationSeconds`. When
|
|
1606
|
+
* stopping early, the matches returned are a sample (whichever workers
|
|
1607
|
+
* reported first), not the lexicographically first N.
|
|
1608
|
+
*/
|
|
1609
|
+
grep(opts: GrepOptions): Promise<GrepResult>;
|
|
1610
|
+
/**
|
|
1611
|
+
* Create a signed, time-limited URL that lets anyone download a single file
|
|
1612
|
+
* from this disk without authentication. The returned URL embeds a
|
|
1613
|
+
* cryptographically signed token carrying the disk, the file's key, and an
|
|
1614
|
+
* expiry — share it directly; no API key is needed to redeem it.
|
|
1615
|
+
*
|
|
1616
|
+
* @param key Path to the file on the disk (e.g. "reports/2026-01/data.pdf").
|
|
1617
|
+
* @param opts `expiresIn` sets the URL lifetime in seconds (any positive
|
|
1618
|
+
* integer, max 604800 = 7 days). Defaults to 24h.
|
|
1619
|
+
*/
|
|
1620
|
+
share(key: string, opts?: ShareUrlOptions): Promise<ShareUrlResult>;
|
|
1621
|
+
/**
|
|
1622
|
+
* Read an object from the disk via the S3-compatible GetObject API and return
|
|
1623
|
+
* its full contents as bytes. Throws `ArchilS3Error` if the object does not
|
|
1624
|
+
* exist (status 404, code "NoSuchKey") or the request is rejected; use
|
|
1625
|
+
* `headObject`/`objectExists` to check existence without throwing.
|
|
1626
|
+
*
|
|
1627
|
+
* @param key Path on the disk (e.g. "reports/2026-01/data.json")
|
|
1628
|
+
*/
|
|
1629
|
+
getObject(key: string): Promise<Uint8Array>;
|
|
1630
|
+
/**
|
|
1631
|
+
* Fetch an object's metadata (size, etag, content type, last-modified) without
|
|
1632
|
+
* downloading its contents, via the S3-compatible HeadObject API. Returns
|
|
1633
|
+
* `null` if the object does not exist.
|
|
1634
|
+
*
|
|
1635
|
+
* @param key Path on the disk (e.g. "reports/2026-01/data.json")
|
|
1636
|
+
*/
|
|
1637
|
+
headObject(key: string): Promise<ObjectMetadata | null>;
|
|
1638
|
+
/** Whether an object exists on the disk (a HeadObject that maps 404 → false). */
|
|
1639
|
+
objectExists(key: string): Promise<boolean>;
|
|
1640
|
+
/**
|
|
1641
|
+
* Write an object to the disk using the S3-compatible PutObject API. Faster
|
|
1642
|
+
* than exec for large files — no container overhead, no command-length limits.
|
|
1643
|
+
* Returns the entity tag the server assigned.
|
|
1644
|
+
*
|
|
1645
|
+
* @param key Path on the disk (e.g. "reports/2026-01/data.json")
|
|
1646
|
+
* @param body Contents as a string, Uint8Array/Buffer, or ArrayBuffer
|
|
1647
|
+
* @param contentType MIME type (default: "application/octet-stream")
|
|
1648
|
+
*/
|
|
1649
|
+
putObject(key: string, body: string | Uint8Array | ArrayBuffer, contentType?: string): Promise<PutObjectResult>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Delete an object from the disk via the S3-compatible DeleteObject API.
|
|
1652
|
+
* Idempotent: deleting a key that doesn't exist resolves successfully, per
|
|
1653
|
+
* S3 semantics.
|
|
1654
|
+
*
|
|
1655
|
+
* @param key Path on the disk (e.g. "project/dist/server.cjs")
|
|
1656
|
+
*/
|
|
1657
|
+
deleteObject(key: string): Promise<void>;
|
|
1658
|
+
/**
|
|
1659
|
+
* List objects on the disk via the S3-compatible ListObjectsV2 API. By
|
|
1660
|
+
* default this follows continuation tokens until the listing is exhausted and
|
|
1661
|
+
* returns every matching key. Use `limit` to cap the total, `singlePage` for a
|
|
1662
|
+
* single request, or {@link listObjectsPages} to stream pages without loading
|
|
1663
|
+
* everything into memory.
|
|
1664
|
+
*
|
|
1665
|
+
* @param prefix Only return keys beginning with this prefix (omit for all).
|
|
1666
|
+
* @param opts Listing and pagination options.
|
|
1667
|
+
*/
|
|
1668
|
+
listObjects(prefix?: string, opts?: ListObjectsOptions): Promise<ListObjectsResult>;
|
|
1669
|
+
/**
|
|
1670
|
+
* Yield ListObjectsV2 pages lazily, following continuation tokens. A
|
|
1671
|
+
* memory-friendly way to process a large listing without materializing it:
|
|
1672
|
+
*
|
|
1673
|
+
* ```ts
|
|
1674
|
+
* for await (const page of disk.listObjectsPages("logs/")) {
|
|
1675
|
+
* for (const obj of page.objects) process(obj);
|
|
1676
|
+
* }
|
|
1677
|
+
* ```
|
|
1678
|
+
*
|
|
1679
|
+
* @param prefix Only return keys beginning with this prefix (omit for all).
|
|
1680
|
+
* @param opts Listing options (`limit` / `singlePage` are ignored here —
|
|
1681
|
+
* control your own loop).
|
|
1682
|
+
*/
|
|
1683
|
+
listObjectsPages(prefix?: string, opts?: ListObjectsOptions): AsyncGenerator<ListObjectsResult>;
|
|
1684
|
+
/** Fetch a single ListObjectsV2 page. @internal */
|
|
1685
|
+
private _listObjectsPage;
|
|
1686
|
+
/**
|
|
1687
|
+
* Send a single request to the disk's S3-compatible endpoint. This reuses the
|
|
1688
|
+
* control-plane client purely for its credential and transport — the same
|
|
1689
|
+
* `Authorization` header is sent and verified by the same code server-side —
|
|
1690
|
+
* pointed at the S3 host. Returns the response status and fully-buffered body
|
|
1691
|
+
* so callers can inspect both regardless of the verb used.
|
|
1692
|
+
*
|
|
1693
|
+
* The S3 routes (`/{diskId}/{key}` for objects, `/{diskId}` for the bucket)
|
|
1694
|
+
* are not part of the typed control-plane API, so the path and per-request
|
|
1695
|
+
* options are passed untyped. An empty `key` targets the bucket itself (used
|
|
1696
|
+
* by listObjects).
|
|
1697
|
+
*
|
|
1698
|
+
* @internal
|
|
1699
|
+
*/
|
|
1700
|
+
private _s3Request;
|
|
1313
1701
|
/**
|
|
1314
1702
|
* Connect to this disk's data plane via the native ArchilClient.
|
|
1315
1703
|
*
|
|
@@ -1335,7 +1723,9 @@ declare class Disks {
|
|
|
1335
1723
|
/** @internal */
|
|
1336
1724
|
private readonly _region;
|
|
1337
1725
|
/** @internal */
|
|
1338
|
-
|
|
1726
|
+
private readonly _s3BaseUrl?;
|
|
1727
|
+
/** @internal */
|
|
1728
|
+
constructor(client: ApiClient, region: string, s3BaseUrl?: string);
|
|
1339
1729
|
list(opts?: ListDisksOptions): Promise<Disk[]>;
|
|
1340
1730
|
get(id: string): Promise<Disk>;
|
|
1341
1731
|
/**
|
|
@@ -1370,6 +1760,12 @@ interface ArchilOptions {
|
|
|
1370
1760
|
region?: string;
|
|
1371
1761
|
/** Override the control plane base URL (useful for testing). */
|
|
1372
1762
|
baseUrl?: string;
|
|
1763
|
+
/**
|
|
1764
|
+
* Override the S3-compatible API base URL used by Disk#getObject /
|
|
1765
|
+
* putObject / deleteObject. Falls back to ARCHIL_S3_BASE_URL, then to the
|
|
1766
|
+
* control plane URL with its `control.` hostname prefix swapped for `s3.`.
|
|
1767
|
+
*/
|
|
1768
|
+
s3BaseUrl?: string;
|
|
1373
1769
|
}
|
|
1374
1770
|
/**
|
|
1375
1771
|
* Options that apply to a single mounted disk in an exec request.
|
|
@@ -1424,11 +1820,46 @@ declare class Archil {
|
|
|
1424
1820
|
exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
1425
1821
|
}
|
|
1426
1822
|
|
|
1427
|
-
|
|
1823
|
+
/**
|
|
1824
|
+
* Base class for every error the SDK throws. Catch with `instanceof ArchilError`
|
|
1825
|
+
* to handle control-plane and S3 failures uniformly; `status` is the HTTP status
|
|
1826
|
+
* code and `code` a machine-readable error code when the server provided one.
|
|
1827
|
+
*/
|
|
1828
|
+
declare class ArchilError extends Error {
|
|
1829
|
+
/** HTTP status code associated with the failure. */
|
|
1428
1830
|
readonly status: number;
|
|
1831
|
+
/** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
|
|
1429
1832
|
readonly code?: string;
|
|
1430
1833
|
constructor(message: string, status: number, code?: string);
|
|
1431
1834
|
}
|
|
1835
|
+
/** Error from the control-plane REST API. */
|
|
1836
|
+
declare class ArchilApiError extends ArchilError {
|
|
1837
|
+
constructor(message: string, status: number, code?: string);
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
1841
|
+
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
1842
|
+
* this surfaces its parts as structured fields (`status`, `code`, `requestId`)
|
|
1843
|
+
* rather than a raw blob, while keeping the full body on `raw` for debugging.
|
|
1844
|
+
*/
|
|
1845
|
+
declare class ArchilS3Error extends ArchilError {
|
|
1846
|
+
/** S3 request id, if the gateway returned one. */
|
|
1847
|
+
readonly requestId?: string;
|
|
1848
|
+
/** Raw response body (the XML document), for debugging. */
|
|
1849
|
+
readonly raw: string;
|
|
1850
|
+
constructor(opts: {
|
|
1851
|
+
operation: string;
|
|
1852
|
+
statusCode: number;
|
|
1853
|
+
statusText?: string;
|
|
1854
|
+
code?: string;
|
|
1855
|
+
message?: string;
|
|
1856
|
+
requestId?: string;
|
|
1857
|
+
raw: string;
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
declare const VERSION: string;
|
|
1862
|
+
declare const USER_AGENT: string;
|
|
1432
1863
|
|
|
1433
1864
|
declare function configure(options: ArchilOptions): void;
|
|
1434
1865
|
declare function createDisk(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
@@ -1446,4 +1877,4 @@ declare function deleteApiKey(id: string): Promise<void>;
|
|
|
1446
1877
|
*/
|
|
1447
1878
|
declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
1448
1879
|
|
|
1449
|
-
export { type ApiTokenResponse, Archil, ArchilApiError, type ArchilOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, Disk, type DiskMetrics, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type GCSMount, type ListDisksOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type R2Mount, type S3CompatibleMount, type S3Mount, type TokenUser, Tokens, configure, createApiKey, createDisk, deleteApiKey, exec, getDisk, listApiKeys, listDisks };
|
|
1880
|
+
export { type ApiTokenResponse, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, Disk, type DiskMetrics, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListObjectsOptions, type ListObjectsResult, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type ObjectMetadata, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, VERSION, configure, createApiKey, createDisk, deleteApiKey, exec, getDisk, listApiKeys, listDisks };
|