@declaw/sdk 1.0.3 → 1.1.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/CHANGELOG.md +38 -0
- package/dist/index.cjs +121 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -2
- package/dist/index.d.ts +58 -2
- package/dist/index.js +117 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -153,7 +153,6 @@ declare enum InjectionSensitivity {
|
|
|
153
153
|
/** Actions to take when injection is detected. */
|
|
154
154
|
declare enum InjectionAction {
|
|
155
155
|
Block = "block",
|
|
156
|
-
Sanitize = "sanitize",
|
|
157
156
|
LogOnly = "log_only"
|
|
158
157
|
}
|
|
159
158
|
/** Configuration for injection defense. */
|
|
@@ -925,6 +924,27 @@ declare class Pty {
|
|
|
925
924
|
resize(pid: number, size: PtySize, requestTimeout?: number): Promise<void>;
|
|
926
925
|
}
|
|
927
926
|
|
|
927
|
+
/** Request-side shape of a volume attachment on Sandbox.create. */
|
|
928
|
+
interface VolumeAttachment {
|
|
929
|
+
volumeId: string;
|
|
930
|
+
mountPath: string;
|
|
931
|
+
}
|
|
932
|
+
/** Server-side metadata for a single volume. */
|
|
933
|
+
interface VolumeInfo {
|
|
934
|
+
volumeId: string;
|
|
935
|
+
ownerId: string;
|
|
936
|
+
name: string;
|
|
937
|
+
blobKey: string;
|
|
938
|
+
sizeBytes: number;
|
|
939
|
+
contentType: string;
|
|
940
|
+
metadata: Record<string, string>;
|
|
941
|
+
createdAt: string;
|
|
942
|
+
}
|
|
943
|
+
/** Convert a wire-format volume row into a VolumeInfo. */
|
|
944
|
+
declare function parseVolumeInfo(data: Record<string, unknown>): VolumeInfo;
|
|
945
|
+
/** Render a VolumeAttachment in wire (snake_case) form. */
|
|
946
|
+
declare function volumeAttachmentToJSON(att: VolumeAttachment): Record<string, string>;
|
|
947
|
+
|
|
928
948
|
/** Options for creating a sandbox. */
|
|
929
949
|
interface SandboxOpts {
|
|
930
950
|
/** Template to use. Defaults to 'base'. */
|
|
@@ -945,6 +965,11 @@ interface SandboxOpts {
|
|
|
945
965
|
security?: SecurityPolicy;
|
|
946
966
|
/** Lifecycle configuration. */
|
|
947
967
|
lifecycle?: SandboxLifecycle;
|
|
968
|
+
/** Volumes to attach at sandbox-boot time. Each {volumeId, mountPath}
|
|
969
|
+
* references a blob uploaded via `Volumes.create`; the orchestrator
|
|
970
|
+
* materializes its contents under `mountPath` before the first command
|
|
971
|
+
* is dispatched. */
|
|
972
|
+
volumes?: VolumeAttachment[];
|
|
948
973
|
/** API key override. */
|
|
949
974
|
apiKey?: string;
|
|
950
975
|
/** Domain override (supports "host:port" format, e.g. "104.198.24.180:8080"). */
|
|
@@ -1408,4 +1433,35 @@ declare class Template {
|
|
|
1408
1433
|
static getBuildStatus(buildId: string, opts?: GetBuildStatusOpts): Promise<TemplateBuildStatus>;
|
|
1409
1434
|
}
|
|
1410
1435
|
|
|
1411
|
-
|
|
1436
|
+
/** Shared per-call options. */
|
|
1437
|
+
interface VolumeRequestOpts {
|
|
1438
|
+
apiKey?: string;
|
|
1439
|
+
domain?: string;
|
|
1440
|
+
apiUrl?: string;
|
|
1441
|
+
requestTimeout?: number;
|
|
1442
|
+
}
|
|
1443
|
+
/** Options for Volumes.create. */
|
|
1444
|
+
interface VolumeCreateOpts extends VolumeRequestOpts {
|
|
1445
|
+
/** Override the Content-Type header. Defaults to application/gzip. */
|
|
1446
|
+
contentType?: string;
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Volumes: upload a tarball once and attach it to one or many sandboxes.
|
|
1450
|
+
*
|
|
1451
|
+
* Phase 1: the body must be a gzip-compressed tar archive; the server
|
|
1452
|
+
* materializes regular-file entries inside the sandbox filesystem under
|
|
1453
|
+
* the attachment's mount_path. Symlinks, hardlinks, and device nodes
|
|
1454
|
+
* are dropped on the server for safety.
|
|
1455
|
+
*/
|
|
1456
|
+
declare class Volumes {
|
|
1457
|
+
/** Create a volume by streaming a tarball to the server. */
|
|
1458
|
+
static create(name: string, data: Uint8Array | ArrayBuffer, opts?: VolumeCreateOpts): Promise<VolumeInfo>;
|
|
1459
|
+
/** Fetch metadata for a single volume. */
|
|
1460
|
+
static get(volumeId: string, opts?: VolumeRequestOpts): Promise<VolumeInfo>;
|
|
1461
|
+
/** List all volumes owned by the caller, newest first. */
|
|
1462
|
+
static list(opts?: VolumeRequestOpts): Promise<VolumeInfo[]>;
|
|
1463
|
+
/** Delete a volume and its blob. Idempotent on the wire. */
|
|
1464
|
+
static delete(volumeId: string, opts?: VolumeRequestOpts): Promise<void>;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, type VolumeAttachment, type VolumeCreateOpts, type VolumeInfo, type VolumeRequestOpts, Volumes, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseVolumeInfo, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry, volumeAttachmentToJSON };
|
package/dist/index.d.ts
CHANGED
|
@@ -153,7 +153,6 @@ declare enum InjectionSensitivity {
|
|
|
153
153
|
/** Actions to take when injection is detected. */
|
|
154
154
|
declare enum InjectionAction {
|
|
155
155
|
Block = "block",
|
|
156
|
-
Sanitize = "sanitize",
|
|
157
156
|
LogOnly = "log_only"
|
|
158
157
|
}
|
|
159
158
|
/** Configuration for injection defense. */
|
|
@@ -925,6 +924,27 @@ declare class Pty {
|
|
|
925
924
|
resize(pid: number, size: PtySize, requestTimeout?: number): Promise<void>;
|
|
926
925
|
}
|
|
927
926
|
|
|
927
|
+
/** Request-side shape of a volume attachment on Sandbox.create. */
|
|
928
|
+
interface VolumeAttachment {
|
|
929
|
+
volumeId: string;
|
|
930
|
+
mountPath: string;
|
|
931
|
+
}
|
|
932
|
+
/** Server-side metadata for a single volume. */
|
|
933
|
+
interface VolumeInfo {
|
|
934
|
+
volumeId: string;
|
|
935
|
+
ownerId: string;
|
|
936
|
+
name: string;
|
|
937
|
+
blobKey: string;
|
|
938
|
+
sizeBytes: number;
|
|
939
|
+
contentType: string;
|
|
940
|
+
metadata: Record<string, string>;
|
|
941
|
+
createdAt: string;
|
|
942
|
+
}
|
|
943
|
+
/** Convert a wire-format volume row into a VolumeInfo. */
|
|
944
|
+
declare function parseVolumeInfo(data: Record<string, unknown>): VolumeInfo;
|
|
945
|
+
/** Render a VolumeAttachment in wire (snake_case) form. */
|
|
946
|
+
declare function volumeAttachmentToJSON(att: VolumeAttachment): Record<string, string>;
|
|
947
|
+
|
|
928
948
|
/** Options for creating a sandbox. */
|
|
929
949
|
interface SandboxOpts {
|
|
930
950
|
/** Template to use. Defaults to 'base'. */
|
|
@@ -945,6 +965,11 @@ interface SandboxOpts {
|
|
|
945
965
|
security?: SecurityPolicy;
|
|
946
966
|
/** Lifecycle configuration. */
|
|
947
967
|
lifecycle?: SandboxLifecycle;
|
|
968
|
+
/** Volumes to attach at sandbox-boot time. Each {volumeId, mountPath}
|
|
969
|
+
* references a blob uploaded via `Volumes.create`; the orchestrator
|
|
970
|
+
* materializes its contents under `mountPath` before the first command
|
|
971
|
+
* is dispatched. */
|
|
972
|
+
volumes?: VolumeAttachment[];
|
|
948
973
|
/** API key override. */
|
|
949
974
|
apiKey?: string;
|
|
950
975
|
/** Domain override (supports "host:port" format, e.g. "104.198.24.180:8080"). */
|
|
@@ -1408,4 +1433,35 @@ declare class Template {
|
|
|
1408
1433
|
static getBuildStatus(buildId: string, opts?: GetBuildStatusOpts): Promise<TemplateBuildStatus>;
|
|
1409
1434
|
}
|
|
1410
1435
|
|
|
1411
|
-
|
|
1436
|
+
/** Shared per-call options. */
|
|
1437
|
+
interface VolumeRequestOpts {
|
|
1438
|
+
apiKey?: string;
|
|
1439
|
+
domain?: string;
|
|
1440
|
+
apiUrl?: string;
|
|
1441
|
+
requestTimeout?: number;
|
|
1442
|
+
}
|
|
1443
|
+
/** Options for Volumes.create. */
|
|
1444
|
+
interface VolumeCreateOpts extends VolumeRequestOpts {
|
|
1445
|
+
/** Override the Content-Type header. Defaults to application/gzip. */
|
|
1446
|
+
contentType?: string;
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Volumes: upload a tarball once and attach it to one or many sandboxes.
|
|
1450
|
+
*
|
|
1451
|
+
* Phase 1: the body must be a gzip-compressed tar archive; the server
|
|
1452
|
+
* materializes regular-file entries inside the sandbox filesystem under
|
|
1453
|
+
* the attachment's mount_path. Symlinks, hardlinks, and device nodes
|
|
1454
|
+
* are dropped on the server for safety.
|
|
1455
|
+
*/
|
|
1456
|
+
declare class Volumes {
|
|
1457
|
+
/** Create a volume by streaming a tarball to the server. */
|
|
1458
|
+
static create(name: string, data: Uint8Array | ArrayBuffer, opts?: VolumeCreateOpts): Promise<VolumeInfo>;
|
|
1459
|
+
/** Fetch metadata for a single volume. */
|
|
1460
|
+
static get(volumeId: string, opts?: VolumeRequestOpts): Promise<VolumeInfo>;
|
|
1461
|
+
/** List all volumes owned by the caller, newest first. */
|
|
1462
|
+
static list(opts?: VolumeRequestOpts): Promise<VolumeInfo[]>;
|
|
1463
|
+
/** Delete a volume and its blob. Idempotent on the wire. */
|
|
1464
|
+
static delete(volumeId: string, opts?: VolumeRequestOpts): Promise<void>;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
export { ALL_TRAFFIC, ApiClient, type AuditConfig, type AuditEntry, AuthenticationError, BuildError, type BuildInfo, type CodeSecurityConfig, CommandExitError, CommandHandle, type CommandResult, type CommandWaitOpts, Commands, ConnectionConfig, type ConnectionConfigOptions, type CopyItem, DEFAULT_MASK_PATTERNS, type EntryInfo, type EnvSecurityConfig, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOpts, GitAuthError, GitUpstreamError, InjectionAction, type InjectionDefenseConfig, InjectionSensitivity, InvalidArgumentError, type InvisibleTextConfig, type NetworkPolicy, NotEnoughSpaceError, NotFoundError, type PIIConfig, PIIType, type ProcessInfo, Pty, type PtyConnectOpts, type PtyCreateOpts, PtyHandle, type PtyOutput, type PtyResult, type PtySize, RedactionAction, type RequestOpts, type RunOpts, type RunStreamOpts, Sandbox, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxMetrics, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxQuery, SandboxState, type SecureEnvVar, type SecurityPolicy, type Snapshot, type SnapshotInfo, SnapshotPaginator, type SnapshotSource, type Stderr, type Stdout, Template, TemplateBase, type TemplateBuildOpts, type TemplateBuildStatus, TemplateError, TimeoutError, type ToxicityConfig, TransformDirection, type TransformationRule, type VolumeAttachment, type VolumeCreateOpts, type VolumeInfo, type VolumeRequestOpts, Volumes, WatchHandle, type WriteEntry, type WriteInfo, applyTransformation, codeSecurityConfigToJSON, createAuditConfig, createCodeSecurityConfig, createEnvSecurityConfig, createInjectionDefenseConfig, createInvisibleTextConfig, createNetworkPolicy, createPIIConfig, createSecurityPolicy, createToxicityConfig, createTransformationRule, domainMatches, invisibleTextConfigToJSON, isSensitive, networkPolicyToOpts, parseAuditConfig, parseAuditEntry, parseBuildInfo, parseCodeSecurityConfig, parseCommandResult, parseEntryInfo, parseEnvSecurityConfig, parseFilesystemEvent, parseInjectionDefenseConfig, parseInvisibleTextConfig, parseNetworkPolicy, parsePIIConfig, parseProcessInfo, parseSandboxInfo, parseSandboxLifecycle, parseSandboxMetrics, parseSecurityPolicy, parseSnapshot, parseSnapshotInfo, parseTemplateBuildStatus, parseToxicityConfig, parseVolumeInfo, parseWriteInfo, requiresTlsInterception, securityPolicyToJSON, toxicityConfigToJSON, validateNetworkEntry, volumeAttachmentToJSON };
|
package/dist/index.js
CHANGED
|
@@ -404,7 +404,6 @@ var InjectionSensitivity = /* @__PURE__ */ ((InjectionSensitivity2) => {
|
|
|
404
404
|
})(InjectionSensitivity || {});
|
|
405
405
|
var InjectionAction = /* @__PURE__ */ ((InjectionAction2) => {
|
|
406
406
|
InjectionAction2["Block"] = "block";
|
|
407
|
-
InjectionAction2["Sanitize"] = "sanitize";
|
|
408
407
|
InjectionAction2["LogOnly"] = "log_only";
|
|
409
408
|
return InjectionAction2;
|
|
410
409
|
})(InjectionAction || {});
|
|
@@ -414,7 +413,7 @@ function createInjectionDefenseConfig(opts) {
|
|
|
414
413
|
const config = {
|
|
415
414
|
enabled: opts?.enabled ?? false,
|
|
416
415
|
sensitivity: opts?.sensitivity ?? "medium" /* Medium */,
|
|
417
|
-
action: opts?.action ?? "
|
|
416
|
+
action: opts?.action ?? "log_only" /* LogOnly */,
|
|
418
417
|
threshold: opts?.threshold ?? 0.8,
|
|
419
418
|
domains: opts?.domains
|
|
420
419
|
};
|
|
@@ -439,7 +438,7 @@ function parseInjectionDefenseConfig(data) {
|
|
|
439
438
|
return {
|
|
440
439
|
enabled: data.enabled ?? false,
|
|
441
440
|
sensitivity: data.sensitivity ?? "medium" /* Medium */,
|
|
442
|
-
action: data.action ?? "
|
|
441
|
+
action: data.action ?? "log_only" /* LogOnly */,
|
|
443
442
|
threshold: data.threshold ?? 0.8,
|
|
444
443
|
domains: data.domains
|
|
445
444
|
};
|
|
@@ -1694,6 +1693,23 @@ var Pty = class {
|
|
|
1694
1693
|
}
|
|
1695
1694
|
};
|
|
1696
1695
|
|
|
1696
|
+
// src/volumes/models.ts
|
|
1697
|
+
function parseVolumeInfo(data) {
|
|
1698
|
+
return {
|
|
1699
|
+
volumeId: String(data.volume_id ?? ""),
|
|
1700
|
+
ownerId: String(data.owner_id ?? ""),
|
|
1701
|
+
name: String(data.name ?? ""),
|
|
1702
|
+
blobKey: String(data.blob_key ?? ""),
|
|
1703
|
+
sizeBytes: Number(data.size_bytes ?? 0),
|
|
1704
|
+
contentType: String(data.content_type ?? ""),
|
|
1705
|
+
metadata: data.metadata ?? {},
|
|
1706
|
+
createdAt: String(data.created_at ?? "")
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
function volumeAttachmentToJSON(att) {
|
|
1710
|
+
return { volume_id: att.volumeId, mount_path: att.mountPath };
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1697
1713
|
// src/sandbox/sandbox.ts
|
|
1698
1714
|
var DEFAULT_TEMPLATE = "base";
|
|
1699
1715
|
var DEFAULT_TIMEOUT = 300;
|
|
@@ -1850,6 +1866,9 @@ var Sandbox = class _Sandbox {
|
|
|
1850
1866
|
if (opts?.lifecycle) {
|
|
1851
1867
|
body.lifecycle = lifecycleToJSON(opts.lifecycle);
|
|
1852
1868
|
}
|
|
1869
|
+
if (opts?.volumes && opts.volumes.length > 0) {
|
|
1870
|
+
body.volumes = opts.volumes.map(volumeAttachmentToJSON);
|
|
1871
|
+
}
|
|
1853
1872
|
const data = await client.post("/sandboxes", {
|
|
1854
1873
|
json: body,
|
|
1855
1874
|
timeout: opts?.requestTimeout
|
|
@@ -2443,6 +2462,97 @@ var Template = class {
|
|
|
2443
2462
|
}
|
|
2444
2463
|
}
|
|
2445
2464
|
};
|
|
2465
|
+
|
|
2466
|
+
// src/volumes/volumes.ts
|
|
2467
|
+
var VALID_VOLUME_ID_RE = /^[a-zA-Z0-9_-]+$/;
|
|
2468
|
+
function assertValidVolumeId(id) {
|
|
2469
|
+
if (!id || !VALID_VOLUME_ID_RE.test(id)) {
|
|
2470
|
+
throw new InvalidArgumentError(
|
|
2471
|
+
`Invalid volume ID: "${id}". Must be alphanumeric with hyphens/underscores only.`
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
var Volumes = class {
|
|
2476
|
+
/** Create a volume by streaming a tarball to the server. */
|
|
2477
|
+
static async create(name, data, opts) {
|
|
2478
|
+
if (!name) {
|
|
2479
|
+
throw new InvalidArgumentError("volume name is required");
|
|
2480
|
+
}
|
|
2481
|
+
const config = new ConnectionConfig({
|
|
2482
|
+
apiKey: opts?.apiKey,
|
|
2483
|
+
domain: opts?.domain,
|
|
2484
|
+
apiUrl: opts?.apiUrl,
|
|
2485
|
+
requestTimeout: opts?.requestTimeout
|
|
2486
|
+
});
|
|
2487
|
+
const client = new ApiClient(config);
|
|
2488
|
+
try {
|
|
2489
|
+
const body = data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
2490
|
+
const resp = await client.post("/volumes", {
|
|
2491
|
+
params: { name },
|
|
2492
|
+
body,
|
|
2493
|
+
headers: { "Content-Type": opts?.contentType ?? "application/gzip" },
|
|
2494
|
+
timeout: opts?.requestTimeout
|
|
2495
|
+
});
|
|
2496
|
+
return parseVolumeInfo(resp);
|
|
2497
|
+
} finally {
|
|
2498
|
+
client.close();
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
/** Fetch metadata for a single volume. */
|
|
2502
|
+
static async get(volumeId, opts) {
|
|
2503
|
+
assertValidVolumeId(volumeId);
|
|
2504
|
+
const config = new ConnectionConfig({
|
|
2505
|
+
apiKey: opts?.apiKey,
|
|
2506
|
+
domain: opts?.domain,
|
|
2507
|
+
apiUrl: opts?.apiUrl,
|
|
2508
|
+
requestTimeout: opts?.requestTimeout
|
|
2509
|
+
});
|
|
2510
|
+
const client = new ApiClient(config);
|
|
2511
|
+
try {
|
|
2512
|
+
const resp = await client.get(`/volumes/${volumeId}`, {
|
|
2513
|
+
timeout: opts?.requestTimeout
|
|
2514
|
+
});
|
|
2515
|
+
return parseVolumeInfo(resp);
|
|
2516
|
+
} finally {
|
|
2517
|
+
client.close();
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
/** List all volumes owned by the caller, newest first. */
|
|
2521
|
+
static async list(opts) {
|
|
2522
|
+
const config = new ConnectionConfig({
|
|
2523
|
+
apiKey: opts?.apiKey,
|
|
2524
|
+
domain: opts?.domain,
|
|
2525
|
+
apiUrl: opts?.apiUrl,
|
|
2526
|
+
requestTimeout: opts?.requestTimeout
|
|
2527
|
+
});
|
|
2528
|
+
const client = new ApiClient(config);
|
|
2529
|
+
try {
|
|
2530
|
+
const resp = await client.get("/volumes", {
|
|
2531
|
+
timeout: opts?.requestTimeout
|
|
2532
|
+
});
|
|
2533
|
+
const rows = resp.volumes ?? [];
|
|
2534
|
+
return rows.map(parseVolumeInfo);
|
|
2535
|
+
} finally {
|
|
2536
|
+
client.close();
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
/** Delete a volume and its blob. Idempotent on the wire. */
|
|
2540
|
+
static async delete(volumeId, opts) {
|
|
2541
|
+
assertValidVolumeId(volumeId);
|
|
2542
|
+
const config = new ConnectionConfig({
|
|
2543
|
+
apiKey: opts?.apiKey,
|
|
2544
|
+
domain: opts?.domain,
|
|
2545
|
+
apiUrl: opts?.apiUrl,
|
|
2546
|
+
requestTimeout: opts?.requestTimeout
|
|
2547
|
+
});
|
|
2548
|
+
const client = new ApiClient(config);
|
|
2549
|
+
try {
|
|
2550
|
+
await client.delete(`/volumes/${volumeId}`, { timeout: opts?.requestTimeout });
|
|
2551
|
+
} finally {
|
|
2552
|
+
client.close();
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
};
|
|
2446
2556
|
export {
|
|
2447
2557
|
ALL_TRAFFIC,
|
|
2448
2558
|
ApiClient,
|
|
@@ -2478,6 +2588,7 @@ export {
|
|
|
2478
2588
|
TemplateError,
|
|
2479
2589
|
TimeoutError,
|
|
2480
2590
|
TransformDirection,
|
|
2591
|
+
Volumes,
|
|
2481
2592
|
WatchHandle,
|
|
2482
2593
|
applyTransformation,
|
|
2483
2594
|
codeSecurityConfigToJSON,
|
|
@@ -2516,10 +2627,12 @@ export {
|
|
|
2516
2627
|
parseSnapshotInfo,
|
|
2517
2628
|
parseTemplateBuildStatus,
|
|
2518
2629
|
parseToxicityConfig,
|
|
2630
|
+
parseVolumeInfo,
|
|
2519
2631
|
parseWriteInfo,
|
|
2520
2632
|
requiresTlsInterception,
|
|
2521
2633
|
securityPolicyToJSON,
|
|
2522
2634
|
toxicityConfigToJSON,
|
|
2523
|
-
validateNetworkEntry
|
|
2635
|
+
validateNetworkEntry,
|
|
2636
|
+
volumeAttachmentToJSON
|
|
2524
2637
|
};
|
|
2525
2638
|
//# sourceMappingURL=index.js.map
|