disk 0.8.21 → 0.8.22
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 +23 -0
- package/dist/cli.mjs +1 -1
- package/dist/{disk-BhRejJas.d.cts → disk-DEqV3mtA.d.cts} +26 -1
- package/dist/{disk-BhRejJas.d.mts → disk-DEqV3mtA.d.mts} +26 -1
- package/dist/index.cjs +36 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/internal/tools.d.cts +1 -1
- package/dist/internal/tools.d.mts +1 -1
- package/dist/{src-CrK7pSLW.mjs → src-BepELcl6.mjs} +36 -1
- package/package.json +13 -9
package/README.md
CHANGED
|
@@ -271,6 +271,29 @@ const workspace = archil.workspace({
|
|
|
271
271
|
When `queueMs` is set without `checkoutPaths`, the mount root is acquired
|
|
272
272
|
during mount setup instead.
|
|
273
273
|
|
|
274
|
+
## Delegations
|
|
275
|
+
|
|
276
|
+
A delegation grants a client exclusive write access to an inode on a shared
|
|
277
|
+
disk. List the delegations currently held on a disk and forcibly revoke one —
|
|
278
|
+
useful for reclaiming write access from a client that crashed or lost
|
|
279
|
+
connectivity without checking its delegations in:
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
const disk = await archil.disks.get("dsk-0123456789abcdef");
|
|
283
|
+
|
|
284
|
+
for (const d of await disk.listDelegations()) {
|
|
285
|
+
// { clientId, inodeId, path?, isPending, isOrphaned }
|
|
286
|
+
if (d.isOrphaned) {
|
|
287
|
+
await disk.revokeDelegation(d);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
A delegation has no ID of its own — it is identified by the
|
|
293
|
+
`(clientId, inodeId)` pair. `isOrphaned` entries are held by clients no longer
|
|
294
|
+
connected to the disk. `path` is resolved best-effort by the server and may be
|
|
295
|
+
absent.
|
|
296
|
+
|
|
274
297
|
A `Workspace` is a full filesystem in its own right — it has the same object API
|
|
275
298
|
a `Disk` does (`getObject` / `putObject` / `deleteObject` / `listObjects` /
|
|
276
299
|
`grep` / `exec`; both implement the `FileSystem` interface), so you can use it
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as listDisks, i as deleteApiKey, n as createApiKey, o as getDisk, r as createDisk, s as listApiKeys, t as configure, y as ArchilApiError } from "./src-
|
|
2
|
+
import { c as listDisks, i as deleteApiKey, n as createApiKey, o as getDisk, r as createDisk, s as listApiKeys, t as configure, y as ArchilApiError } from "./src-BepELcl6.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { Command, Option } from "commander";
|
|
5
5
|
//#region bin/cli.ts
|
|
@@ -50,6 +50,7 @@ type GCSMount = components["schemas"]["GCSMount"];
|
|
|
50
50
|
type R2Mount = components["schemas"]["R2Mount"];
|
|
51
51
|
type S3CompatibleMount = components["schemas"]["S3CompatibleMount"];
|
|
52
52
|
type AzureBlobMount = components["schemas"]["AzureBlobMount"];
|
|
53
|
+
type Delegation = components["schemas"]["DelegationEntry"];
|
|
53
54
|
type DiskUser = components["schemas"]["DiskUser"];
|
|
54
55
|
type TokenUser = components["schemas"]["TokenUser"];
|
|
55
56
|
type AwsStsUser = components["schemas"]["AwsStsUser"];
|
|
@@ -396,6 +397,30 @@ declare class Disk implements FileSystem {
|
|
|
396
397
|
identifier: string;
|
|
397
398
|
}>;
|
|
398
399
|
removeTokenUser(identifier: string): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* List all delegations currently held on this disk. A delegation grants a
|
|
402
|
+
* client exclusive write access to an inode; it has no ID of its own and is
|
|
403
|
+
* identified by the (clientId, inodeId) pair — pass those to
|
|
404
|
+
* `revokeDelegation` to release one. Entries with `isOrphaned: true` are
|
|
405
|
+
* held by clients no longer connected to the disk (disconnected without
|
|
406
|
+
* checking in). `path` is resolved best-effort by the server and may be
|
|
407
|
+
* absent.
|
|
408
|
+
*/
|
|
409
|
+
listDelegations(): Promise<Delegation[]>;
|
|
410
|
+
/**
|
|
411
|
+
* Forcibly revoke a delegation, reclaiming write access from a client that
|
|
412
|
+
* is unreachable or crashed without checking its delegations in.
|
|
413
|
+
*
|
|
414
|
+
* Takes the `(clientId, inodeId)` pair identifying the delegation — pass an
|
|
415
|
+
* entry from `listDelegations` directly:
|
|
416
|
+
*
|
|
417
|
+
* ```ts
|
|
418
|
+
* for (const d of await disk.listDelegations()) {
|
|
419
|
+
* if (d.isOrphaned) await disk.revokeDelegation(d);
|
|
420
|
+
* }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
revokeDelegation(delegation: Pick<Delegation, "clientId" | "inodeId">): Promise<void>;
|
|
399
424
|
getAllowedIPs(): Promise<string[]>;
|
|
400
425
|
setAllowedIPs(allowedIps: string[]): Promise<string[]>;
|
|
401
426
|
addAllowedIP(ip: string): Promise<string[]>;
|
|
@@ -672,4 +697,4 @@ declare class DiskMultipart {
|
|
|
672
697
|
*/
|
|
673
698
|
declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
|
|
674
699
|
//#endregion
|
|
675
|
-
export {
|
|
700
|
+
export { TokenUser as $, ApiTokenResponse as A, DiskStatus as B, PutObjectOptions as C, ShareUrlResult as D, ShareUrlOptions as E, CreateApiTokenRequest as F, GrepMatch as G, ExecDiskResult as H, CreateDiskRequest as I, MountConfigResponse as J, GrepStoppedReason as K, Delegation as L, AwsStsUser as M, AzureBlobMount as N, UploadPart as O, ConnectedClient as P, S3Mount as Q, DiskMetrics as R, PosixCreateAttrs as S, S3Object as T, ExecRequest as U, DiskUser as V, GCSMount as W, R2Mount as X, MountResponse as Y, S3CompatibleMount as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, FileSystem as et, ListObjectsOptions as f, MultipartUpload as g, MountOptions as h, DeleteObjectsOptions as i, AuthorizedUser as j, effectiveUploadPartSize as k, GrepOptions as l, ListPartsOptions as m, CompletedMultipartUpload as n, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, DiskMultipart as s, AppendObjectOptions as t, ApiClient as tt, GrepResult as u, MultipartUploadSummary as v, PutObjectResult as w, PartListing as x, ObjectMetadata as y, DiskResponse as z };
|
|
@@ -50,6 +50,7 @@ type GCSMount = components["schemas"]["GCSMount"];
|
|
|
50
50
|
type R2Mount = components["schemas"]["R2Mount"];
|
|
51
51
|
type S3CompatibleMount = components["schemas"]["S3CompatibleMount"];
|
|
52
52
|
type AzureBlobMount = components["schemas"]["AzureBlobMount"];
|
|
53
|
+
type Delegation = components["schemas"]["DelegationEntry"];
|
|
53
54
|
type DiskUser = components["schemas"]["DiskUser"];
|
|
54
55
|
type TokenUser = components["schemas"]["TokenUser"];
|
|
55
56
|
type AwsStsUser = components["schemas"]["AwsStsUser"];
|
|
@@ -396,6 +397,30 @@ declare class Disk implements FileSystem {
|
|
|
396
397
|
identifier: string;
|
|
397
398
|
}>;
|
|
398
399
|
removeTokenUser(identifier: string): Promise<void>;
|
|
400
|
+
/**
|
|
401
|
+
* List all delegations currently held on this disk. A delegation grants a
|
|
402
|
+
* client exclusive write access to an inode; it has no ID of its own and is
|
|
403
|
+
* identified by the (clientId, inodeId) pair — pass those to
|
|
404
|
+
* `revokeDelegation` to release one. Entries with `isOrphaned: true` are
|
|
405
|
+
* held by clients no longer connected to the disk (disconnected without
|
|
406
|
+
* checking in). `path` is resolved best-effort by the server and may be
|
|
407
|
+
* absent.
|
|
408
|
+
*/
|
|
409
|
+
listDelegations(): Promise<Delegation[]>;
|
|
410
|
+
/**
|
|
411
|
+
* Forcibly revoke a delegation, reclaiming write access from a client that
|
|
412
|
+
* is unreachable or crashed without checking its delegations in.
|
|
413
|
+
*
|
|
414
|
+
* Takes the `(clientId, inodeId)` pair identifying the delegation — pass an
|
|
415
|
+
* entry from `listDelegations` directly:
|
|
416
|
+
*
|
|
417
|
+
* ```ts
|
|
418
|
+
* for (const d of await disk.listDelegations()) {
|
|
419
|
+
* if (d.isOrphaned) await disk.revokeDelegation(d);
|
|
420
|
+
* }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
revokeDelegation(delegation: Pick<Delegation, "clientId" | "inodeId">): Promise<void>;
|
|
399
424
|
getAllowedIPs(): Promise<string[]>;
|
|
400
425
|
setAllowedIPs(allowedIps: string[]): Promise<string[]>;
|
|
401
426
|
addAllowedIP(ip: string): Promise<string[]>;
|
|
@@ -672,4 +697,4 @@ declare class DiskMultipart {
|
|
|
672
697
|
*/
|
|
673
698
|
declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
|
|
674
699
|
//#endregion
|
|
675
|
-
export {
|
|
700
|
+
export { TokenUser as $, ApiTokenResponse as A, DiskStatus as B, PutObjectOptions as C, ShareUrlResult as D, ShareUrlOptions as E, CreateApiTokenRequest as F, GrepMatch as G, ExecDiskResult as H, CreateDiskRequest as I, MountConfigResponse as J, GrepStoppedReason as K, Delegation as L, AwsStsUser as M, AzureBlobMount as N, UploadPart as O, ConnectedClient as P, S3Mount as Q, DiskMetrics as R, PosixCreateAttrs as S, S3Object as T, ExecRequest as U, DiskUser as V, GCSMount as W, R2Mount as X, MountResponse as Y, S3CompatibleMount as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, FileSystem as et, ListObjectsOptions as f, MultipartUpload as g, MountOptions as h, DeleteObjectsOptions as i, AuthorizedUser as j, effectiveUploadPartSize as k, GrepOptions as l, ListPartsOptions as m, CompletedMultipartUpload as n, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, DiskMultipart as s, AppendObjectOptions as t, ApiClient as tt, GrepResult as u, MultipartUploadSummary as v, PutObjectResult as w, PartListing as x, ObjectMetadata as y, DiskResponse as z };
|
package/dist/index.cjs
CHANGED
|
@@ -134,7 +134,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
|
|
|
134
134
|
}
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region src/version.ts
|
|
137
|
-
const VERSION = "0.8.
|
|
137
|
+
const VERSION = "0.8.22";
|
|
138
138
|
const USER_AGENT = `archil-js/${VERSION}`;
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/client.ts
|
|
@@ -275,6 +275,41 @@ var Disk = class {
|
|
|
275
275
|
async removeTokenUser(identifier) {
|
|
276
276
|
await this.removeUser("token", identifier);
|
|
277
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* List all delegations currently held on this disk. A delegation grants a
|
|
280
|
+
* client exclusive write access to an inode; it has no ID of its own and is
|
|
281
|
+
* identified by the (clientId, inodeId) pair — pass those to
|
|
282
|
+
* `revokeDelegation` to release one. Entries with `isOrphaned: true` are
|
|
283
|
+
* held by clients no longer connected to the disk (disconnected without
|
|
284
|
+
* checking in). `path` is resolved best-effort by the server and may be
|
|
285
|
+
* absent.
|
|
286
|
+
*/
|
|
287
|
+
async listDelegations() {
|
|
288
|
+
return (await unwrap(this._client.GET("/api/disks/{id}/delegations", { params: { path: { id: this.id } } }))).delegations;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Forcibly revoke a delegation, reclaiming write access from a client that
|
|
292
|
+
* is unreachable or crashed without checking its delegations in.
|
|
293
|
+
*
|
|
294
|
+
* Takes the `(clientId, inodeId)` pair identifying the delegation — pass an
|
|
295
|
+
* entry from `listDelegations` directly:
|
|
296
|
+
*
|
|
297
|
+
* ```ts
|
|
298
|
+
* for (const d of await disk.listDelegations()) {
|
|
299
|
+
* if (d.isOrphaned) await disk.revokeDelegation(d);
|
|
300
|
+
* }
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
async revokeDelegation(delegation) {
|
|
304
|
+
const { clientId, inodeId } = delegation;
|
|
305
|
+
await unwrap(this._client.POST("/api/disks/{id}/revoke-delegation", {
|
|
306
|
+
params: { path: { id: this.id } },
|
|
307
|
+
body: {
|
|
308
|
+
clientId,
|
|
309
|
+
inodeId
|
|
310
|
+
}
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
278
313
|
async getAllowedIPs() {
|
|
279
314
|
return (await unwrap(this._client.GET("/api/disks/{id}/allowed-ips", { params: { path: { id: this.id } } }))).allowedIps;
|
|
280
315
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as TokenUser, A as ApiTokenResponse, B as DiskStatus, C as PutObjectOptions, D as ShareUrlResult, E as ShareUrlOptions, F as CreateApiTokenRequest, G as GrepMatch, H as ExecDiskResult, I as CreateDiskRequest, J as MountConfigResponse, K as GrepStoppedReason, L as Delegation, M as AwsStsUser, N as AzureBlobMount, O as UploadPart, P as ConnectedClient, Q as S3Mount, R as DiskMetrics, S as PosixCreateAttrs, T as S3Object, U as ExecRequest, V as DiskUser, W as GCSMount, X as R2Mount, Y as MountResponse, Z as S3CompatibleMount, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as FileSystem, f as ListObjectsOptions, g as MultipartUpload, h as MountOptions, i as DeleteObjectsOptions, j as AuthorizedUser, k as effectiveUploadPartSize, l as GrepOptions, m as ListPartsOptions, n as CompletedMultipartUpload, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, s as DiskMultipart, t as AppendObjectOptions, tt as ApiClient, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-DEqV3mtA.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/disks.d.ts
|
|
4
4
|
interface ListDisksOptions {
|
|
@@ -284,4 +284,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
284
284
|
*/
|
|
285
285
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
286
286
|
//#endregion
|
|
287
|
-
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskListPage, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type FileSystem, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PosixCreateAttrs, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
|
287
|
+
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type Delegation, type DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskListPage, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type FileSystem, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PosixCreateAttrs, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as TokenUser, A as ApiTokenResponse, B as DiskStatus, C as PutObjectOptions, D as ShareUrlResult, E as ShareUrlOptions, F as CreateApiTokenRequest, G as GrepMatch, H as ExecDiskResult, I as CreateDiskRequest, J as MountConfigResponse, K as GrepStoppedReason, L as Delegation, M as AwsStsUser, N as AzureBlobMount, O as UploadPart, P as ConnectedClient, Q as S3Mount, R as DiskMetrics, S as PosixCreateAttrs, T as S3Object, U as ExecRequest, V as DiskUser, W as GCSMount, X as R2Mount, Y as MountResponse, Z as S3CompatibleMount, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as FileSystem, f as ListObjectsOptions, g as MultipartUpload, h as MountOptions, i as DeleteObjectsOptions, j as AuthorizedUser, k as effectiveUploadPartSize, l as GrepOptions, m as ListPartsOptions, n as CompletedMultipartUpload, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, s as DiskMultipart, t as AppendObjectOptions, tt as ApiClient, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-DEqV3mtA.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/disks.d.ts
|
|
4
4
|
interface ListDisksOptions {
|
|
@@ -284,4 +284,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
284
284
|
*/
|
|
285
285
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
286
286
|
//#endregion
|
|
287
|
-
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskListPage, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type FileSystem, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PosixCreateAttrs, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
|
287
|
+
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type Delegation, type DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskListPage, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type FileSystem, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PosixCreateAttrs, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as USER_AGENT, a as exec, b as ArchilError, c as listDisks, d as Workspace, f as Tokens, g as effectiveUploadPartSize, h as DiskMultipart, i as deleteApiKey, l as workspace, m as Disk, n as createApiKey, o as getDisk, p as Disks, r as createDisk, s as listApiKeys, t as configure, u as Archil, v as VERSION, x as ArchilS3Error, y as ArchilApiError } from "./src-
|
|
1
|
+
import { _ as USER_AGENT, a as exec, b as ArchilError, c as listDisks, d as Workspace, f as Tokens, g as effectiveUploadPartSize, h as DiskMultipart, i as deleteApiKey, l as workspace, m as Disk, n as createApiKey, o as getDisk, p as Disks, r as createDisk, s as listApiKeys, t as configure, u as Archil, v as VERSION, x as ArchilS3Error, y as ArchilApiError } from "./src-BepELcl6.mjs";
|
|
2
2
|
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
|
@@ -111,7 +111,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
|
|
|
111
111
|
}
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/version.ts
|
|
114
|
-
const VERSION = "0.8.
|
|
114
|
+
const VERSION = "0.8.22";
|
|
115
115
|
const USER_AGENT = `archil-js/${VERSION}`;
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/client.ts
|
|
@@ -252,6 +252,41 @@ var Disk = class {
|
|
|
252
252
|
async removeTokenUser(identifier) {
|
|
253
253
|
await this.removeUser("token", identifier);
|
|
254
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* List all delegations currently held on this disk. A delegation grants a
|
|
257
|
+
* client exclusive write access to an inode; it has no ID of its own and is
|
|
258
|
+
* identified by the (clientId, inodeId) pair — pass those to
|
|
259
|
+
* `revokeDelegation` to release one. Entries with `isOrphaned: true` are
|
|
260
|
+
* held by clients no longer connected to the disk (disconnected without
|
|
261
|
+
* checking in). `path` is resolved best-effort by the server and may be
|
|
262
|
+
* absent.
|
|
263
|
+
*/
|
|
264
|
+
async listDelegations() {
|
|
265
|
+
return (await unwrap(this._client.GET("/api/disks/{id}/delegations", { params: { path: { id: this.id } } }))).delegations;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Forcibly revoke a delegation, reclaiming write access from a client that
|
|
269
|
+
* is unreachable or crashed without checking its delegations in.
|
|
270
|
+
*
|
|
271
|
+
* Takes the `(clientId, inodeId)` pair identifying the delegation — pass an
|
|
272
|
+
* entry from `listDelegations` directly:
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
* for (const d of await disk.listDelegations()) {
|
|
276
|
+
* if (d.isOrphaned) await disk.revokeDelegation(d);
|
|
277
|
+
* }
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
async revokeDelegation(delegation) {
|
|
281
|
+
const { clientId, inodeId } = delegation;
|
|
282
|
+
await unwrap(this._client.POST("/api/disks/{id}/revoke-delegation", {
|
|
283
|
+
params: { path: { id: this.id } },
|
|
284
|
+
body: {
|
|
285
|
+
clientId,
|
|
286
|
+
inodeId
|
|
287
|
+
}
|
|
288
|
+
}));
|
|
289
|
+
}
|
|
255
290
|
async getAllowedIPs() {
|
|
256
291
|
return (await unwrap(this._client.GET("/api/disks/{id}/allowed-ips", { params: { path: { id: this.id } } }))).allowedIps;
|
|
257
292
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.22",
|
|
4
4
|
"description": "Pure-JS client and CLI for Archil disks",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"archil",
|
|
7
|
+
"disk",
|
|
8
|
+
"filesystem",
|
|
9
|
+
"cli"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://archil.com",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"url": "https://github.com/archil-data/archil-sdk"
|
|
15
|
+
},
|
|
5
16
|
"type": "module",
|
|
6
17
|
"main": "dist/index.cjs",
|
|
7
18
|
"module": "dist/index.mjs",
|
|
@@ -27,7 +38,7 @@
|
|
|
27
38
|
"LICENSE"
|
|
28
39
|
],
|
|
29
40
|
"dependencies": {
|
|
30
|
-
"@archildata/api-types": "^0.0.
|
|
41
|
+
"@archildata/api-types": "^0.0.4",
|
|
31
42
|
"commander": "^14.0.3",
|
|
32
43
|
"fast-xml-parser": "^5.7.0",
|
|
33
44
|
"openapi-fetch": "^0.13.5",
|
|
@@ -42,13 +53,6 @@
|
|
|
42
53
|
"engines": {
|
|
43
54
|
"node": ">= 22"
|
|
44
55
|
},
|
|
45
|
-
"keywords": [
|
|
46
|
-
"archil",
|
|
47
|
-
"disk",
|
|
48
|
-
"filesystem",
|
|
49
|
-
"cli"
|
|
50
|
-
],
|
|
51
|
-
"license": "MIT",
|
|
52
56
|
"scripts": {
|
|
53
57
|
"build": "tsdown",
|
|
54
58
|
"dev": "tsdown --watch",
|