disk 1.3.0 → 1.4.0
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 +32 -0
- package/dist/cli.mjs +2 -2
- package/dist/{common-BFAzXgkJ.mjs → common-D2ic5Rit.mjs} +1 -1
- package/dist/{disk-CiLNoFCd.d.cts → disk-iq-QAbnz.d.cts} +11 -1
- package/dist/{disk-CiLNoFCd.d.mts → disk-iq-QAbnz.d.mts} +11 -1
- package/dist/index.cjs +22 -12
- package/dist/index.d.cts +4 -2
- package/dist/index.d.mts +4 -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/sandbox-cli.mjs +2 -2
- package/dist/{src-CvTkHglv.mjs → src-BaAv98od.mjs} +22 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,6 +105,38 @@ await d.removeUser("token", user.identifier!);
|
|
|
105
105
|
await d.delete();
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
+
### Private certificate authorities (Node.js)
|
|
109
|
+
|
|
110
|
+
For BYOC endpoints signed by a private CA, configure trust on the client:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { readFileSync } from "node:fs";
|
|
114
|
+
import { getCACertificates } from "node:tls";
|
|
115
|
+
import { Archil } from "disk";
|
|
116
|
+
|
|
117
|
+
const client = new Archil({
|
|
118
|
+
apiKey: process.env.ARCHIL_API_KEY,
|
|
119
|
+
region: "aws-us-east-2",
|
|
120
|
+
baseUrl: "https://control.archil.example.internal",
|
|
121
|
+
s3BaseUrl: "https://s3.archil.example.internal",
|
|
122
|
+
tls: {
|
|
123
|
+
ca: [...getCACertificates(), readFileSync("archil-ca.pem")],
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`tls.ca` accepts a PEM string, a `Buffer`, or an array of either. As with Node's
|
|
129
|
+
TLS `ca` option, it **replaces** the default trust list. The example includes Node's
|
|
130
|
+
defaults as well as the private CA; `getCACertificates()` requires Node 22.15+.
|
|
131
|
+
Omitting `tls.ca` preserves Node's default trust behavior.
|
|
132
|
+
|
|
133
|
+
The configuration applies to this client's control-plane and S3-compatible requests,
|
|
134
|
+
with certificate and hostname verification enabled. It does not change Node's global
|
|
135
|
+
dispatcher or default trust. HTTP/2 pooling is preserved, and clients only share pools
|
|
136
|
+
when their endpoint, API key, and CA configuration match. CA arrays and buffers are
|
|
137
|
+
copied at construction; create a new client to change trust settings. Custom CAs are
|
|
138
|
+
not supported in browsers.
|
|
139
|
+
|
|
108
140
|
### Sandboxes
|
|
109
141
|
|
|
110
142
|
Use `Archil.sandboxes` to manage persistent VMs:
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { O as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-
|
|
3
|
-
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-
|
|
2
|
+
import { O as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-BaAv98od.mjs";
|
|
3
|
+
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-D2ic5Rit.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
//#region bin/cli.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as REGION_URLS, p as Archil } from "./src-
|
|
1
|
+
import { D as REGION_URLS, p as Archil } from "./src-BaAv98od.mjs";
|
|
2
2
|
import { Option } from "commander";
|
|
3
3
|
import { isCancel, password, spinner } from "@clack/prompts";
|
|
4
4
|
import { chmod, mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { Client } from "openapi-fetch";
|
|
2
2
|
import { components, paths } from "@archildata/api-types";
|
|
3
|
+
import { ConnectionOptions } from "node:tls";
|
|
4
|
+
|
|
3
5
|
//#region src/client.d.ts
|
|
4
6
|
type ApiClient = Client<paths>;
|
|
7
|
+
interface ArchilTlsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Trusted PEM CA certificates for this client's control-plane and S3 requests
|
|
10
|
+
* (Node.js only). Replaces Node's default CA list; include those certificates
|
|
11
|
+
* explicitly to retain them. Certificate and hostname verification stay enabled.
|
|
12
|
+
*/
|
|
13
|
+
ca?: ConnectionOptions["ca"];
|
|
14
|
+
}
|
|
5
15
|
//#endregion
|
|
6
16
|
//#region src/filesystem.d.ts
|
|
7
17
|
/**
|
|
@@ -708,4 +718,4 @@ declare class DiskMultipart {
|
|
|
708
718
|
*/
|
|
709
719
|
declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
|
|
710
720
|
//#endregion
|
|
711
|
-
export { S3Mount 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, S3CompatibleMount 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, RootAttrs as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, TokenUser 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, ApiClient as nt, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, DiskMultipart as s, AppendObjectOptions as t, FileSystem as tt, GrepResult as u, MultipartUploadSummary as v, PutObjectResult as w, PartListing as x, ObjectMetadata as y, DiskResponse as z };
|
|
721
|
+
export { S3Mount 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, S3CompatibleMount 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, RootAttrs as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, TokenUser 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, ApiClient as nt, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, ArchilTlsOptions as rt, DiskMultipart as s, AppendObjectOptions as t, FileSystem as tt, GrepResult as u, MultipartUploadSummary as v, PutObjectResult as w, PartListing as x, ObjectMetadata as y, DiskResponse as z };
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { Client } from "openapi-fetch";
|
|
2
2
|
import { components, paths } from "@archildata/api-types";
|
|
3
|
+
import { ConnectionOptions } from "node:tls";
|
|
4
|
+
|
|
3
5
|
//#region src/client.d.ts
|
|
4
6
|
type ApiClient = Client<paths>;
|
|
7
|
+
interface ArchilTlsOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Trusted PEM CA certificates for this client's control-plane and S3 requests
|
|
10
|
+
* (Node.js only). Replaces Node's default CA list; include those certificates
|
|
11
|
+
* explicitly to retain them. Certificate and hostname verification stay enabled.
|
|
12
|
+
*/
|
|
13
|
+
ca?: ConnectionOptions["ca"];
|
|
14
|
+
}
|
|
5
15
|
//#endregion
|
|
6
16
|
//#region src/filesystem.d.ts
|
|
7
17
|
/**
|
|
@@ -708,4 +718,4 @@ declare class DiskMultipart {
|
|
|
708
718
|
*/
|
|
709
719
|
declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
|
|
710
720
|
//#endregion
|
|
711
|
-
export { S3Mount 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, S3CompatibleMount 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, RootAttrs as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, TokenUser 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, ApiClient as nt, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, DiskMultipart as s, AppendObjectOptions as t, FileSystem as tt, GrepResult as u, MultipartUploadSummary as v, PutObjectResult as w, PartListing as x, ObjectMetadata as y, DiskResponse as z };
|
|
721
|
+
export { S3Mount 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, S3CompatibleMount 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, RootAttrs as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, TokenUser 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, ApiClient as nt, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, ArchilTlsOptions as rt, DiskMultipart as s, AppendObjectOptions as t, FileSystem 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
|
@@ -145,7 +145,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
|
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/version.ts
|
|
148
|
-
const VERSION = "1.
|
|
148
|
+
const VERSION = "1.4.0";
|
|
149
149
|
const USER_AGENT = `archil-js/${VERSION}`;
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/client.ts
|
|
@@ -198,11 +198,14 @@ const multiplexHttp2Requests = (dispatch) => (options, handler) => {
|
|
|
198
198
|
return true;
|
|
199
199
|
};
|
|
200
200
|
const sharedDispatchers = /* @__PURE__ */ new Map();
|
|
201
|
-
function dispatcherKey(baseUrl, apiKey) {
|
|
202
|
-
return
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
201
|
+
function dispatcherKey(baseUrl, apiKey, ca) {
|
|
202
|
+
return JSON.stringify([
|
|
203
|
+
new URL(baseUrl).origin,
|
|
204
|
+
apiKey,
|
|
205
|
+
ca?.map((cert) => cert.toString("base64"))
|
|
206
|
+
]);
|
|
207
|
+
}
|
|
208
|
+
function getSharedDispatcher(key, ca) {
|
|
206
209
|
const existing = sharedDispatchers.get(key);
|
|
207
210
|
if (existing) return existing;
|
|
208
211
|
const dispatcher = (async () => {
|
|
@@ -213,7 +216,8 @@ function getSharedDispatcher(baseUrl, apiKey) {
|
|
|
213
216
|
connections: CONTROL_PLANE_CONNECTIONS,
|
|
214
217
|
pipelining: CONTROL_PLANE_CONCURRENT_STREAMS,
|
|
215
218
|
keepAliveTimeout: 6e4,
|
|
216
|
-
keepAliveMaxTimeout: 6e5
|
|
219
|
+
keepAliveMaxTimeout: 6e5,
|
|
220
|
+
...ca === void 0 ? {} : { connect: { ca } }
|
|
217
221
|
}).compose(multiplexHttp2Requests);
|
|
218
222
|
})();
|
|
219
223
|
sharedDispatchers.set(key, dispatcher);
|
|
@@ -222,10 +226,15 @@ function getSharedDispatcher(baseUrl, apiKey) {
|
|
|
222
226
|
});
|
|
223
227
|
return dispatcher;
|
|
224
228
|
}
|
|
225
|
-
function createPooledFetch(baseUrl, apiKey) {
|
|
226
|
-
if (!isNodeRuntime())
|
|
229
|
+
function createPooledFetch(baseUrl, apiKey, tls) {
|
|
230
|
+
if (!isNodeRuntime()) {
|
|
231
|
+
if (tls?.ca !== void 0) throw new Error("Custom TLS CAs require Node.js");
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const ca = tls?.ca === void 0 ? void 0 : (Array.isArray(tls.ca) ? tls.ca : [tls.ca]).map((cert) => Buffer.from(cert));
|
|
235
|
+
const key = dispatcherKey(baseUrl, apiKey, ca);
|
|
227
236
|
return async (request) => {
|
|
228
|
-
const dispatcher = await getSharedDispatcher(
|
|
237
|
+
const dispatcher = await getSharedDispatcher(key, ca);
|
|
229
238
|
return globalThis.fetch(request, { dispatcher });
|
|
230
239
|
};
|
|
231
240
|
}
|
|
@@ -234,7 +243,7 @@ function createApiClient(opts) {
|
|
|
234
243
|
const apiKey = `key-${opts.apiKey.replace(/^key-/, "")}`;
|
|
235
244
|
return createClient({
|
|
236
245
|
baseUrl,
|
|
237
|
-
fetch: createPooledFetch(baseUrl, apiKey),
|
|
246
|
+
fetch: createPooledFetch(baseUrl, apiKey, opts.tls),
|
|
238
247
|
headers: {
|
|
239
248
|
Authorization: apiKey,
|
|
240
249
|
"User-Agent": USER_AGENT
|
|
@@ -2461,7 +2470,8 @@ var Archil = class {
|
|
|
2461
2470
|
const client = createApiClient({
|
|
2462
2471
|
apiKey,
|
|
2463
2472
|
region,
|
|
2464
|
-
baseUrl: controlBaseUrl
|
|
2473
|
+
baseUrl: controlBaseUrl,
|
|
2474
|
+
tls: opts.tls
|
|
2465
2475
|
});
|
|
2466
2476
|
const s3BaseUrl = opts.s3BaseUrl ?? envVar("ARCHIL_S3_BASE_URL") ?? deriveS3BaseUrl(controlBaseUrl);
|
|
2467
2477
|
this._client = client;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as S3Mount, 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 S3CompatibleMount, 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 RootAttrs, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as TokenUser, 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, nt as ApiClient, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, s as DiskMultipart, t as AppendObjectOptions, tt as FileSystem, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-
|
|
1
|
+
import { $ as S3Mount, 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 S3CompatibleMount, 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 RootAttrs, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as TokenUser, 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, nt as ApiClient, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, rt as ArchilTlsOptions, s as DiskMultipart, t as AppendObjectOptions, tt as FileSystem, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-iq-QAbnz.cjs";
|
|
2
2
|
import { components } from "@archildata/api-types";
|
|
3
3
|
|
|
4
4
|
//#region src/disks.d.ts
|
|
@@ -472,6 +472,8 @@ interface ArchilOptions {
|
|
|
472
472
|
* control plane URL with its `control.` hostname prefix swapped for `s3.`.
|
|
473
473
|
*/
|
|
474
474
|
s3BaseUrl?: string;
|
|
475
|
+
/** Per-client TLS trust for control-plane and S3 requests (Node.js only). */
|
|
476
|
+
tls?: ArchilTlsOptions;
|
|
475
477
|
}
|
|
476
478
|
/**
|
|
477
479
|
* Options that apply to a single mounted disk in an exec request.
|
|
@@ -630,4 +632,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
630
632
|
*/
|
|
631
633
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
632
634
|
//#endregion
|
|
633
|
-
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 CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|
|
635
|
+
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as S3Mount, 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 S3CompatibleMount, 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 RootAttrs, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as TokenUser, 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, nt as ApiClient, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, s as DiskMultipart, t as AppendObjectOptions, tt as FileSystem, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-
|
|
1
|
+
import { $ as S3Mount, 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 S3CompatibleMount, 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 RootAttrs, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as TokenUser, 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, nt as ApiClient, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, rt as ArchilTlsOptions, s as DiskMultipart, t as AppendObjectOptions, tt as FileSystem, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-iq-QAbnz.mjs";
|
|
2
2
|
import { components } from "@archildata/api-types";
|
|
3
3
|
|
|
4
4
|
//#region src/disks.d.ts
|
|
@@ -472,6 +472,8 @@ interface ArchilOptions {
|
|
|
472
472
|
* control plane URL with its `control.` hostname prefix swapped for `s3.`.
|
|
473
473
|
*/
|
|
474
474
|
s3BaseUrl?: string;
|
|
475
|
+
/** Per-client TLS trust for control-plane and S3 requests (Node.js only). */
|
|
476
|
+
tls?: ArchilTlsOptions;
|
|
475
477
|
}
|
|
476
478
|
/**
|
|
477
479
|
* Options that apply to a single mounted disk in an exec request.
|
|
@@ -630,4 +632,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
630
632
|
*/
|
|
631
633
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
632
634
|
//#endregion
|
|
633
|
-
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 CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|
|
635
|
+
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as ArchilS3Error, C as DiskMultipart, E as VERSION, O as ArchilApiError, S as Disk, T as USER_AGENT, _ as Sandbox, a as deleteApiKey, b as SandboxProcesses, c as getSandbox, d as listSandboxes, f as workspace, g as Sandboxes, h as Tokens, i as createSandbox, j as SandboxFileTransferError, k as ArchilError, l as listApiKeys, m as Workspace, n as createApiKey, o as exec, p as Archil, r as createDisk, s as getDisk, t as configure, u as listDisks, v as SandboxFiles, w as effectiveUploadPartSize, x as Disks, y as SandboxProcess } from "./src-
|
|
1
|
+
import { A as ArchilS3Error, C as DiskMultipart, E as VERSION, O as ArchilApiError, S as Disk, T as USER_AGENT, _ as Sandbox, a as deleteApiKey, b as SandboxProcesses, c as getSandbox, d as listSandboxes, f as workspace, g as Sandboxes, h as Tokens, i as createSandbox, j as SandboxFileTransferError, k as ArchilError, l as listApiKeys, m as Workspace, n as createApiKey, o as exec, p as Archil, r as createDisk, s as getDisk, t as configure, u as listDisks, v as SandboxFiles, w as effectiveUploadPartSize, x as Disks, y as SandboxProcess } from "./src-BaAv98od.mjs";
|
|
2
2
|
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxFileTransferError, SandboxFiles, SandboxProcess, SandboxProcesses, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|
package/dist/sandbox-cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { O as ArchilApiError, p as Archil } from "./src-
|
|
3
|
-
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-
|
|
2
|
+
import { O as ArchilApiError, p as Archil } from "./src-BaAv98od.mjs";
|
|
3
|
+
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-D2ic5Rit.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { spinner } from "@clack/prompts";
|
|
@@ -122,7 +122,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
|
|
|
122
122
|
}
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/version.ts
|
|
125
|
-
const VERSION = "1.
|
|
125
|
+
const VERSION = "1.4.0";
|
|
126
126
|
const USER_AGENT = `archil-js/${VERSION}`;
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region src/client.ts
|
|
@@ -175,11 +175,14 @@ const multiplexHttp2Requests = (dispatch) => (options, handler) => {
|
|
|
175
175
|
return true;
|
|
176
176
|
};
|
|
177
177
|
const sharedDispatchers = /* @__PURE__ */ new Map();
|
|
178
|
-
function dispatcherKey(baseUrl, apiKey) {
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
function dispatcherKey(baseUrl, apiKey, ca) {
|
|
179
|
+
return JSON.stringify([
|
|
180
|
+
new URL(baseUrl).origin,
|
|
181
|
+
apiKey,
|
|
182
|
+
ca?.map((cert) => cert.toString("base64"))
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
function getSharedDispatcher(key, ca) {
|
|
183
186
|
const existing = sharedDispatchers.get(key);
|
|
184
187
|
if (existing) return existing;
|
|
185
188
|
const dispatcher = (async () => {
|
|
@@ -190,7 +193,8 @@ function getSharedDispatcher(baseUrl, apiKey) {
|
|
|
190
193
|
connections: CONTROL_PLANE_CONNECTIONS,
|
|
191
194
|
pipelining: CONTROL_PLANE_CONCURRENT_STREAMS,
|
|
192
195
|
keepAliveTimeout: 6e4,
|
|
193
|
-
keepAliveMaxTimeout: 6e5
|
|
196
|
+
keepAliveMaxTimeout: 6e5,
|
|
197
|
+
...ca === void 0 ? {} : { connect: { ca } }
|
|
194
198
|
}).compose(multiplexHttp2Requests);
|
|
195
199
|
})();
|
|
196
200
|
sharedDispatchers.set(key, dispatcher);
|
|
@@ -199,10 +203,15 @@ function getSharedDispatcher(baseUrl, apiKey) {
|
|
|
199
203
|
});
|
|
200
204
|
return dispatcher;
|
|
201
205
|
}
|
|
202
|
-
function createPooledFetch(baseUrl, apiKey) {
|
|
203
|
-
if (!isNodeRuntime())
|
|
206
|
+
function createPooledFetch(baseUrl, apiKey, tls) {
|
|
207
|
+
if (!isNodeRuntime()) {
|
|
208
|
+
if (tls?.ca !== void 0) throw new Error("Custom TLS CAs require Node.js");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const ca = tls?.ca === void 0 ? void 0 : (Array.isArray(tls.ca) ? tls.ca : [tls.ca]).map((cert) => Buffer.from(cert));
|
|
212
|
+
const key = dispatcherKey(baseUrl, apiKey, ca);
|
|
204
213
|
return async (request) => {
|
|
205
|
-
const dispatcher = await getSharedDispatcher(
|
|
214
|
+
const dispatcher = await getSharedDispatcher(key, ca);
|
|
206
215
|
return globalThis.fetch(request, { dispatcher });
|
|
207
216
|
};
|
|
208
217
|
}
|
|
@@ -211,7 +220,7 @@ function createApiClient(opts) {
|
|
|
211
220
|
const apiKey = `key-${opts.apiKey.replace(/^key-/, "")}`;
|
|
212
221
|
return createClient({
|
|
213
222
|
baseUrl,
|
|
214
|
-
fetch: createPooledFetch(baseUrl, apiKey),
|
|
223
|
+
fetch: createPooledFetch(baseUrl, apiKey, opts.tls),
|
|
215
224
|
headers: {
|
|
216
225
|
Authorization: apiKey,
|
|
217
226
|
"User-Agent": USER_AGENT
|
|
@@ -2438,7 +2447,8 @@ var Archil = class {
|
|
|
2438
2447
|
const client = createApiClient({
|
|
2439
2448
|
apiKey,
|
|
2440
2449
|
region,
|
|
2441
|
-
baseUrl: controlBaseUrl
|
|
2450
|
+
baseUrl: controlBaseUrl,
|
|
2451
|
+
tls: opts.tls
|
|
2442
2452
|
});
|
|
2443
2453
|
const s3BaseUrl = opts.s3BaseUrl ?? envVar("ARCHIL_S3_BASE_URL") ?? deriveS3BaseUrl(controlBaseUrl);
|
|
2444
2454
|
this._client = client;
|