disk 0.8.10 → 0.8.11

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/cli.js CHANGED
@@ -338,6 +338,12 @@ var Tokens = class {
338
338
  };
339
339
 
340
340
  // src/archil.ts
341
+ function isExecMountSpec(m) {
342
+ return typeof m === "object" && m !== null && "disk" in m;
343
+ }
344
+ function diskIdFromMount(m) {
345
+ return typeof m === "string" ? m : m.id;
346
+ }
341
347
  var Archil = class {
342
348
  disks;
343
349
  tokens;
@@ -369,7 +375,16 @@ var Archil = class {
369
375
  async exec(opts) {
370
376
  const disks = {};
371
377
  for (const [relPath, mount] of Object.entries(opts.disks)) {
372
- disks[relPath] = typeof mount === "string" ? mount : mount.id;
378
+ if (isExecMountSpec(mount)) {
379
+ const entry = {
380
+ disk: diskIdFromMount(mount.disk),
381
+ readOnly: mount.readOnly ?? false
382
+ };
383
+ if (mount.subdirectory !== void 0) entry.subdirectory = mount.subdirectory;
384
+ disks[relPath] = entry;
385
+ } else {
386
+ disks[relPath] = diskIdFromMount(mount);
387
+ }
373
388
  }
374
389
  return unwrap(
375
390
  this._client.POST("/api/exec", {
package/dist/index.cjs CHANGED
@@ -381,6 +381,12 @@ var Tokens = class {
381
381
  };
382
382
 
383
383
  // src/archil.ts
384
+ function isExecMountSpec(m) {
385
+ return typeof m === "object" && m !== null && "disk" in m;
386
+ }
387
+ function diskIdFromMount(m) {
388
+ return typeof m === "string" ? m : m.id;
389
+ }
384
390
  var Archil = class {
385
391
  disks;
386
392
  tokens;
@@ -412,7 +418,16 @@ var Archil = class {
412
418
  async exec(opts) {
413
419
  const disks = {};
414
420
  for (const [relPath, mount] of Object.entries(opts.disks)) {
415
- disks[relPath] = typeof mount === "string" ? mount : mount.id;
421
+ if (isExecMountSpec(mount)) {
422
+ const entry = {
423
+ disk: diskIdFromMount(mount.disk),
424
+ readOnly: mount.readOnly ?? false
425
+ };
426
+ if (mount.subdirectory !== void 0) entry.subdirectory = mount.subdirectory;
427
+ disks[relPath] = entry;
428
+ } else {
429
+ disks[relPath] = diskIdFromMount(mount);
430
+ }
416
431
  }
417
432
  return unwrap(
418
433
  this._client.POST("/api/exec", {
package/dist/index.d.cts CHANGED
@@ -711,13 +711,21 @@ interface components {
711
711
  * @description Map of relative path under `/mnt/archil` to the disk to mount
712
712
  * there. At least one entry is required. Relative paths must be
713
713
  * non-empty, non-absolute, and contain no `.` or `..` segments.
714
+ *
715
+ * Each value is either a plain disk ID string (mounts the disk's
716
+ * root, read-write) or an object that additionally selects a
717
+ * subdirectory of the disk and/or marks the mount as read-only.
714
718
  * @example {
715
719
  * "data": "dsk-abc123",
716
- * "logs": "dsk-def456"
720
+ * "logs": {
721
+ * "disk": "dsk-def456",
722
+ * "subdirectory": "app/logs",
723
+ * "readOnly": true
724
+ * }
717
725
  * }
718
726
  */
719
727
  disks: {
720
- [key: string]: string;
728
+ [key: string]: string | components["schemas"]["ExecMount"];
721
729
  };
722
730
  /**
723
731
  * @description Shell command to execute inside the container
@@ -725,6 +733,26 @@ interface components {
725
733
  */
726
734
  command: string;
727
735
  };
736
+ ExecMount: {
737
+ /**
738
+ * @description Disk ID to mount at this relative path
739
+ * @example dsk-abc123
740
+ */
741
+ disk: string;
742
+ /**
743
+ * @description Subdirectory of the disk to expose at the mountpoint. Must be a
744
+ * relative path with no `.` or `..` segments. When omitted, the
745
+ * disk's root is exposed.
746
+ * @example app/logs
747
+ */
748
+ subdirectory?: string;
749
+ /**
750
+ * @description When true, the disk is mounted read-only inside the container.
751
+ * Writes against the mount fail with EROFS.
752
+ * @default false
753
+ */
754
+ readOnly: boolean;
755
+ };
728
756
  ApiResponse_Exec: {
729
757
  /** @example true */
730
758
  success: boolean;
@@ -1344,11 +1372,34 @@ interface ArchilOptions {
1344
1372
  baseUrl?: string;
1345
1373
  }
1346
1374
  /**
1347
- * One disk to mount, identified by a Disk instance or a raw disk id string.
1348
- * Used by Archil#exec the map key is the relative path under /mnt/archil
1349
- * at which to mount the disk.
1375
+ * Options that apply to a single mounted disk in an exec request.
1376
+ * Use this object form when you need to pin the mount to a subdirectoryectory
1377
+ * of the disk and/or mount it read-only; for the default case (mount
1378
+ * the disk's root, read-write), pass a `Disk` or disk-id string instead.
1379
+ */
1380
+ interface ExecMountSpec {
1381
+ /** Disk to mount, by `Disk` instance or raw disk id string. */
1382
+ disk: Disk | string;
1383
+ /**
1384
+ * Subdirectory of the disk to expose at the mountpoint. Must be a
1385
+ * relative path with no `.` or `..` segments. When omitted, the disk's
1386
+ * root is exposed.
1387
+ */
1388
+ subdirectory?: string;
1389
+ /**
1390
+ * When true, mount the disk read-only inside the container. Writes
1391
+ * against the mount fail with EROFS. Defaults to false.
1392
+ */
1393
+ readOnly?: boolean;
1394
+ }
1395
+ /**
1396
+ * One disk to mount in an exec request. Either a `Disk`/disk-id string
1397
+ * (mounts the disk's root, read-write) or an `ExecMountSpec` object that
1398
+ * additionally selects a subdirectoryectory of the disk and/or marks the mount
1399
+ * as read-only. Used by Archil#exec — the map key is the relative path
1400
+ * under /mnt/archil at which to mount the disk.
1350
1401
  */
1351
- type ExecMount = Disk | string;
1402
+ type ExecMount = Disk | string | ExecMountSpec;
1352
1403
  interface ExecOptions {
1353
1404
  /**
1354
1405
  * Disks to mount, keyed by the relative path under `/mnt/archil` at which
@@ -1395,4 +1446,4 @@ declare function deleteApiKey(id: string): Promise<void>;
1395
1446
  */
1396
1447
  declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
1397
1448
 
1398
- 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 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -711,13 +711,21 @@ interface components {
711
711
  * @description Map of relative path under `/mnt/archil` to the disk to mount
712
712
  * there. At least one entry is required. Relative paths must be
713
713
  * non-empty, non-absolute, and contain no `.` or `..` segments.
714
+ *
715
+ * Each value is either a plain disk ID string (mounts the disk's
716
+ * root, read-write) or an object that additionally selects a
717
+ * subdirectory of the disk and/or marks the mount as read-only.
714
718
  * @example {
715
719
  * "data": "dsk-abc123",
716
- * "logs": "dsk-def456"
720
+ * "logs": {
721
+ * "disk": "dsk-def456",
722
+ * "subdirectory": "app/logs",
723
+ * "readOnly": true
724
+ * }
717
725
  * }
718
726
  */
719
727
  disks: {
720
- [key: string]: string;
728
+ [key: string]: string | components["schemas"]["ExecMount"];
721
729
  };
722
730
  /**
723
731
  * @description Shell command to execute inside the container
@@ -725,6 +733,26 @@ interface components {
725
733
  */
726
734
  command: string;
727
735
  };
736
+ ExecMount: {
737
+ /**
738
+ * @description Disk ID to mount at this relative path
739
+ * @example dsk-abc123
740
+ */
741
+ disk: string;
742
+ /**
743
+ * @description Subdirectory of the disk to expose at the mountpoint. Must be a
744
+ * relative path with no `.` or `..` segments. When omitted, the
745
+ * disk's root is exposed.
746
+ * @example app/logs
747
+ */
748
+ subdirectory?: string;
749
+ /**
750
+ * @description When true, the disk is mounted read-only inside the container.
751
+ * Writes against the mount fail with EROFS.
752
+ * @default false
753
+ */
754
+ readOnly: boolean;
755
+ };
728
756
  ApiResponse_Exec: {
729
757
  /** @example true */
730
758
  success: boolean;
@@ -1344,11 +1372,34 @@ interface ArchilOptions {
1344
1372
  baseUrl?: string;
1345
1373
  }
1346
1374
  /**
1347
- * One disk to mount, identified by a Disk instance or a raw disk id string.
1348
- * Used by Archil#exec the map key is the relative path under /mnt/archil
1349
- * at which to mount the disk.
1375
+ * Options that apply to a single mounted disk in an exec request.
1376
+ * Use this object form when you need to pin the mount to a subdirectoryectory
1377
+ * of the disk and/or mount it read-only; for the default case (mount
1378
+ * the disk's root, read-write), pass a `Disk` or disk-id string instead.
1379
+ */
1380
+ interface ExecMountSpec {
1381
+ /** Disk to mount, by `Disk` instance or raw disk id string. */
1382
+ disk: Disk | string;
1383
+ /**
1384
+ * Subdirectory of the disk to expose at the mountpoint. Must be a
1385
+ * relative path with no `.` or `..` segments. When omitted, the disk's
1386
+ * root is exposed.
1387
+ */
1388
+ subdirectory?: string;
1389
+ /**
1390
+ * When true, mount the disk read-only inside the container. Writes
1391
+ * against the mount fail with EROFS. Defaults to false.
1392
+ */
1393
+ readOnly?: boolean;
1394
+ }
1395
+ /**
1396
+ * One disk to mount in an exec request. Either a `Disk`/disk-id string
1397
+ * (mounts the disk's root, read-write) or an `ExecMountSpec` object that
1398
+ * additionally selects a subdirectoryectory of the disk and/or marks the mount
1399
+ * as read-only. Used by Archil#exec — the map key is the relative path
1400
+ * under /mnt/archil at which to mount the disk.
1350
1401
  */
1351
- type ExecMount = Disk | string;
1402
+ type ExecMount = Disk | string | ExecMountSpec;
1352
1403
  interface ExecOptions {
1353
1404
  /**
1354
1405
  * Disks to mount, keyed by the relative path under `/mnt/archil` at which
@@ -1395,4 +1446,4 @@ declare function deleteApiKey(id: string): Promise<void>;
1395
1446
  */
1396
1447
  declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
1397
1448
 
1398
- 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 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 };
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 };
package/dist/index.js CHANGED
@@ -332,6 +332,12 @@ var Tokens = class {
332
332
  };
333
333
 
334
334
  // src/archil.ts
335
+ function isExecMountSpec(m) {
336
+ return typeof m === "object" && m !== null && "disk" in m;
337
+ }
338
+ function diskIdFromMount(m) {
339
+ return typeof m === "string" ? m : m.id;
340
+ }
335
341
  var Archil = class {
336
342
  disks;
337
343
  tokens;
@@ -363,7 +369,16 @@ var Archil = class {
363
369
  async exec(opts) {
364
370
  const disks = {};
365
371
  for (const [relPath, mount] of Object.entries(opts.disks)) {
366
- disks[relPath] = typeof mount === "string" ? mount : mount.id;
372
+ if (isExecMountSpec(mount)) {
373
+ const entry = {
374
+ disk: diskIdFromMount(mount.disk),
375
+ readOnly: mount.readOnly ?? false
376
+ };
377
+ if (mount.subdirectory !== void 0) entry.subdirectory = mount.subdirectory;
378
+ disks[relPath] = entry;
379
+ } else {
380
+ disks[relPath] = diskIdFromMount(mount);
381
+ }
367
382
  }
368
383
  return unwrap(
369
384
  this._client.POST("/api/exec", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disk",
3
- "version": "0.8.10",
3
+ "version": "0.8.11",
4
4
  "description": "Pure-JS client and CLI for Archil disks",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",