sandbox0 0.9.7 → 0.10.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.
Files changed (109) hide show
  1. package/README.md +0 -15
  2. package/dist/apispec/src/apis/FilesApi.d.ts +1 -112
  3. package/dist/apispec/src/apis/FilesApi.d.ts.map +1 -1
  4. package/dist/apispec/src/apis/FilesApi.js +1 -330
  5. package/dist/apispec/src/apis/index.d.ts +0 -2
  6. package/dist/apispec/src/apis/index.d.ts.map +1 -1
  7. package/dist/apispec/src/apis/index.js +0 -2
  8. package/dist/apispec/src/models/ClaimRequest.d.ts +0 -7
  9. package/dist/apispec/src/models/ClaimRequest.d.ts.map +1 -1
  10. package/dist/apispec/src/models/ClaimRequest.js +0 -3
  11. package/dist/apispec/src/models/ClaimResponse.d.ts +0 -7
  12. package/dist/apispec/src/models/ClaimResponse.d.ts.map +1 -1
  13. package/dist/apispec/src/models/ClaimResponse.js +0 -3
  14. package/dist/apispec/src/models/QuotaDimension.d.ts +0 -2
  15. package/dist/apispec/src/models/QuotaDimension.d.ts.map +1 -1
  16. package/dist/apispec/src/models/QuotaDimension.js +0 -2
  17. package/dist/apispec/src/models/RegistryCredentials.d.ts +12 -0
  18. package/dist/apispec/src/models/RegistryCredentials.d.ts.map +1 -1
  19. package/dist/apispec/src/models/RegistryCredentials.js +4 -0
  20. package/dist/apispec/src/models/ResourceQuota.d.ts +1 -1
  21. package/dist/apispec/src/models/Sandbox.d.ts +0 -7
  22. package/dist/apispec/src/models/Sandbox.d.ts.map +1 -1
  23. package/dist/apispec/src/models/Sandbox.js +0 -3
  24. package/dist/apispec/src/models/SandboxResourceConfig.d.ts +1 -1
  25. package/dist/apispec/src/models/SandboxTemplateSpec.d.ts +0 -7
  26. package/dist/apispec/src/models/SandboxTemplateSpec.d.ts.map +1 -1
  27. package/dist/apispec/src/models/SandboxTemplateSpec.js +0 -3
  28. package/dist/apispec/src/models/WebhookConfig.d.ts +1 -1
  29. package/dist/apispec/src/models/index.d.ts +0 -20
  30. package/dist/apispec/src/models/index.d.ts.map +1 -1
  31. package/dist/apispec/src/models/index.js +0 -20
  32. package/dist/client.d.ts +0 -4
  33. package/dist/client.d.ts.map +1 -1
  34. package/dist/client.js +0 -5
  35. package/dist/index.d.ts +0 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/resources/sandboxes.d.ts +1 -2
  38. package/dist/resources/sandboxes.d.ts.map +1 -1
  39. package/dist/resources/sandboxes.js +0 -3
  40. package/dist/sandbox.d.ts +0 -3
  41. package/dist/sandbox.d.ts.map +1 -1
  42. package/dist/sandbox.js +0 -2
  43. package/dist/sessions.d.ts +0 -20
  44. package/dist/sessions.d.ts.map +1 -1
  45. package/dist/sessions.js +0 -36
  46. package/package.json +1 -1
  47. package/dist/apispec/src/apis/SandboxVolumesApi.d.ts +0 -73
  48. package/dist/apispec/src/apis/SandboxVolumesApi.d.ts.map +0 -1
  49. package/dist/apispec/src/apis/SandboxVolumesApi.js +0 -187
  50. package/dist/apispec/src/apis/SnapshotsApi.d.ts +0 -78
  51. package/dist/apispec/src/apis/SnapshotsApi.d.ts.map +0 -1
  52. package/dist/apispec/src/apis/SnapshotsApi.js +0 -202
  53. package/dist/apispec/src/models/ClaimMountRequest.d.ts +0 -39
  54. package/dist/apispec/src/models/ClaimMountRequest.d.ts.map +0 -1
  55. package/dist/apispec/src/models/ClaimMountRequest.js +0 -47
  56. package/dist/apispec/src/models/CreateSandboxVolumeRequest.d.ts +0 -66
  57. package/dist/apispec/src/models/CreateSandboxVolumeRequest.d.ts.map +0 -1
  58. package/dist/apispec/src/models/CreateSandboxVolumeRequest.js +0 -54
  59. package/dist/apispec/src/models/CreateSandboxVolumeS3Config.d.ts +0 -84
  60. package/dist/apispec/src/models/CreateSandboxVolumeS3Config.d.ts.map +0 -1
  61. package/dist/apispec/src/models/CreateSandboxVolumeS3Config.js +0 -69
  62. package/dist/apispec/src/models/CreateSnapshotRequest.d.ts +0 -39
  63. package/dist/apispec/src/models/CreateSnapshotRequest.d.ts.map +0 -1
  64. package/dist/apispec/src/models/CreateSnapshotRequest.js +0 -45
  65. package/dist/apispec/src/models/ForkVolumeRequest.d.ts +0 -46
  66. package/dist/apispec/src/models/ForkVolumeRequest.d.ts.map +0 -1
  67. package/dist/apispec/src/models/ForkVolumeRequest.js +0 -46
  68. package/dist/apispec/src/models/MountStatus.d.ts +0 -79
  69. package/dist/apispec/src/models/MountStatus.d.ts.map +0 -1
  70. package/dist/apispec/src/models/MountStatus.js +0 -68
  71. package/dist/apispec/src/models/SandboxVolume.d.ts +0 -108
  72. package/dist/apispec/src/models/SandboxVolume.d.ts.map +0 -1
  73. package/dist/apispec/src/models/SandboxVolume.js +0 -80
  74. package/dist/apispec/src/models/SandboxVolumeS3Config.d.ts +0 -66
  75. package/dist/apispec/src/models/SandboxVolumeS3Config.d.ts.map +0 -1
  76. package/dist/apispec/src/models/SandboxVolumeS3Config.js +0 -61
  77. package/dist/apispec/src/models/Snapshot.d.ts +0 -69
  78. package/dist/apispec/src/models/Snapshot.d.ts.map +0 -1
  79. package/dist/apispec/src/models/Snapshot.js +0 -63
  80. package/dist/apispec/src/models/SuccessSandboxVolumeListResponse.d.ts +0 -40
  81. package/dist/apispec/src/models/SuccessSandboxVolumeListResponse.d.ts.map +0 -1
  82. package/dist/apispec/src/models/SuccessSandboxVolumeListResponse.js +0 -46
  83. package/dist/apispec/src/models/SuccessSandboxVolumeResponse.d.ts +0 -40
  84. package/dist/apispec/src/models/SuccessSandboxVolumeResponse.d.ts.map +0 -1
  85. package/dist/apispec/src/models/SuccessSandboxVolumeResponse.js +0 -46
  86. package/dist/apispec/src/models/SuccessSnapshotListResponse.d.ts +0 -40
  87. package/dist/apispec/src/models/SuccessSnapshotListResponse.d.ts.map +0 -1
  88. package/dist/apispec/src/models/SuccessSnapshotListResponse.js +0 -46
  89. package/dist/apispec/src/models/SuccessSnapshotResponse.d.ts +0 -40
  90. package/dist/apispec/src/models/SuccessSnapshotResponse.d.ts.map +0 -1
  91. package/dist/apispec/src/models/SuccessSnapshotResponse.js +0 -46
  92. package/dist/apispec/src/models/SuccessVolumeFileArchiveImportResponse.d.ts +0 -40
  93. package/dist/apispec/src/models/SuccessVolumeFileArchiveImportResponse.d.ts.map +0 -1
  94. package/dist/apispec/src/models/SuccessVolumeFileArchiveImportResponse.js +0 -46
  95. package/dist/apispec/src/models/VolumeAccessMode.d.ts +0 -27
  96. package/dist/apispec/src/models/VolumeAccessMode.d.ts.map +0 -1
  97. package/dist/apispec/src/models/VolumeAccessMode.js +0 -44
  98. package/dist/apispec/src/models/VolumeBackend.d.ts +0 -26
  99. package/dist/apispec/src/models/VolumeBackend.d.ts.map +0 -1
  100. package/dist/apispec/src/models/VolumeBackend.js +0 -43
  101. package/dist/apispec/src/models/VolumeFileArchiveImportResponse.d.ts +0 -51
  102. package/dist/apispec/src/models/VolumeFileArchiveImportResponse.d.ts.map +0 -1
  103. package/dist/apispec/src/models/VolumeFileArchiveImportResponse.js +0 -55
  104. package/dist/apispec/src/models/VolumeMountSpec.d.ts +0 -45
  105. package/dist/apispec/src/models/VolumeMountSpec.d.ts.map +0 -1
  106. package/dist/apispec/src/models/VolumeMountSpec.js +0 -49
  107. package/dist/resources/volumes.d.ts +0 -31
  108. package/dist/resources/volumes.d.ts.map +0 -1
  109. package/dist/resources/volumes.js +0 -222
@@ -1,43 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Sandbox0 API
5
- * Public HTTP APIs exposed by Sandbox0 regional gateways and the global gateway.
6
- *
7
- * The version of the OpenAPI document: 0.1.0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- /**
15
- * Storage backend for a SandboxVolume. s0fs is the default durable Sandbox0 volume backend. s3 mounts an existing S3-compatible prefix through the volume portal and supports mount-s3-like object projection.
16
- * @export
17
- */
18
- export const VolumeBackend = {
19
- S0fs: 's0fs',
20
- S3: 's3'
21
- };
22
- export function instanceOfVolumeBackend(value) {
23
- for (const key in VolumeBackend) {
24
- if (Object.prototype.hasOwnProperty.call(VolumeBackend, key)) {
25
- if (VolumeBackend[key] === value) {
26
- return true;
27
- }
28
- }
29
- }
30
- return false;
31
- }
32
- export function VolumeBackendFromJSON(json) {
33
- return VolumeBackendFromJSONTyped(json, false);
34
- }
35
- export function VolumeBackendFromJSONTyped(json, ignoreDiscriminator) {
36
- return json;
37
- }
38
- export function VolumeBackendToJSON(value) {
39
- return value;
40
- }
41
- export function VolumeBackendToJSONTyped(value, ignoreDiscriminator) {
42
- return value;
43
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * Sandbox0 API
3
- * Public HTTP APIs exposed by Sandbox0 regional gateways and the global gateway.
4
- *
5
- * The version of the OpenAPI document: 0.1.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- /**
13
- *
14
- * @export
15
- * @interface VolumeFileArchiveImportResponse
16
- */
17
- export interface VolumeFileArchiveImportResponse {
18
- /**
19
- *
20
- * @type {number}
21
- * @memberof VolumeFileArchiveImportResponse
22
- */
23
- files: number;
24
- /**
25
- *
26
- * @type {number}
27
- * @memberof VolumeFileArchiveImportResponse
28
- */
29
- directories: number;
30
- /**
31
- *
32
- * @type {number}
33
- * @memberof VolumeFileArchiveImportResponse
34
- */
35
- symlinks: number;
36
- /**
37
- *
38
- * @type {number}
39
- * @memberof VolumeFileArchiveImportResponse
40
- */
41
- bytes: number;
42
- }
43
- /**
44
- * Check if a given object implements the VolumeFileArchiveImportResponse interface.
45
- */
46
- export declare function instanceOfVolumeFileArchiveImportResponse(value: object): value is VolumeFileArchiveImportResponse;
47
- export declare function VolumeFileArchiveImportResponseFromJSON(json: any): VolumeFileArchiveImportResponse;
48
- export declare function VolumeFileArchiveImportResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): VolumeFileArchiveImportResponse;
49
- export declare function VolumeFileArchiveImportResponseToJSON(json: any): VolumeFileArchiveImportResponse;
50
- export declare function VolumeFileArchiveImportResponseToJSONTyped(value?: VolumeFileArchiveImportResponse | null, ignoreDiscriminator?: boolean): any;
51
- //# sourceMappingURL=VolumeFileArchiveImportResponse.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VolumeFileArchiveImportResponse.d.ts","sourceRoot":"","sources":["../../../../src/apispec/src/models/VolumeFileArchiveImportResponse.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC5C;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,yCAAyC,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,+BAA+B,CAMjH;AAED,wBAAgB,uCAAuC,CAAC,IAAI,EAAE,GAAG,GAAG,+BAA+B,CAElG;AAED,wBAAgB,4CAA4C,CAAC,IAAI,EAAE,GAAG,EAAE,mBAAmB,EAAE,OAAO,GAAG,+BAA+B,CAWrI;AAED,wBAAgB,qCAAqC,CAAC,IAAI,EAAE,GAAG,GAAG,+BAA+B,CAEhG;AAED,wBAAgB,0CAA0C,CAAC,KAAK,CAAC,EAAE,+BAA+B,GAAG,IAAI,EAAE,mBAAmB,GAAE,OAAe,GAAG,GAAG,CAYpJ"}
@@ -1,55 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Sandbox0 API
5
- * Public HTTP APIs exposed by Sandbox0 regional gateways and the global gateway.
6
- *
7
- * The version of the OpenAPI document: 0.1.0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- /**
15
- * Check if a given object implements the VolumeFileArchiveImportResponse interface.
16
- */
17
- export function instanceOfVolumeFileArchiveImportResponse(value) {
18
- if (!('files' in value) || value['files'] === undefined)
19
- return false;
20
- if (!('directories' in value) || value['directories'] === undefined)
21
- return false;
22
- if (!('symlinks' in value) || value['symlinks'] === undefined)
23
- return false;
24
- if (!('bytes' in value) || value['bytes'] === undefined)
25
- return false;
26
- return true;
27
- }
28
- export function VolumeFileArchiveImportResponseFromJSON(json) {
29
- return VolumeFileArchiveImportResponseFromJSONTyped(json, false);
30
- }
31
- export function VolumeFileArchiveImportResponseFromJSONTyped(json, ignoreDiscriminator) {
32
- if (json == null) {
33
- return json;
34
- }
35
- return {
36
- 'files': json['files'],
37
- 'directories': json['directories'],
38
- 'symlinks': json['symlinks'],
39
- 'bytes': json['bytes'],
40
- };
41
- }
42
- export function VolumeFileArchiveImportResponseToJSON(json) {
43
- return VolumeFileArchiveImportResponseToJSONTyped(json, false);
44
- }
45
- export function VolumeFileArchiveImportResponseToJSONTyped(value, ignoreDiscriminator = false) {
46
- if (value == null) {
47
- return value;
48
- }
49
- return {
50
- 'files': value['files'],
51
- 'directories': value['directories'],
52
- 'symlinks': value['symlinks'],
53
- 'bytes': value['bytes'],
54
- };
55
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * Sandbox0 API
3
- * Public HTTP APIs exposed by Sandbox0 regional gateways and the global gateway.
4
- *
5
- * The version of the OpenAPI document: 0.1.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- /**
13
- *
14
- * @export
15
- * @interface VolumeMountSpec
16
- */
17
- export interface VolumeMountSpec {
18
- /**
19
- *
20
- * @type {string}
21
- * @memberof VolumeMountSpec
22
- */
23
- name: string;
24
- /**
25
- *
26
- * @type {string}
27
- * @memberof VolumeMountSpec
28
- */
29
- mountPath: string;
30
- /**
31
- *
32
- * @type {boolean}
33
- * @memberof VolumeMountSpec
34
- */
35
- readOnly?: boolean;
36
- }
37
- /**
38
- * Check if a given object implements the VolumeMountSpec interface.
39
- */
40
- export declare function instanceOfVolumeMountSpec(value: object): value is VolumeMountSpec;
41
- export declare function VolumeMountSpecFromJSON(json: any): VolumeMountSpec;
42
- export declare function VolumeMountSpecFromJSONTyped(json: any, ignoreDiscriminator: boolean): VolumeMountSpec;
43
- export declare function VolumeMountSpecToJSON(json: any): VolumeMountSpec;
44
- export declare function VolumeMountSpecToJSONTyped(value?: VolumeMountSpec | null, ignoreDiscriminator?: boolean): any;
45
- //# sourceMappingURL=VolumeMountSpec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VolumeMountSpec.d.ts","sourceRoot":"","sources":["../../../../src/apispec/src/models/VolumeMountSpec.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAGH;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAIjF;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,GAAG,GAAG,eAAe,CAElE;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,GAAG,EAAE,mBAAmB,EAAE,OAAO,GAAG,eAAe,CAUrG;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,eAAe,CAEhE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI,EAAE,mBAAmB,GAAE,OAAe,GAAG,GAAG,CAWpH"}
@@ -1,49 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Sandbox0 API
5
- * Public HTTP APIs exposed by Sandbox0 regional gateways and the global gateway.
6
- *
7
- * The version of the OpenAPI document: 0.1.0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- /**
15
- * Check if a given object implements the VolumeMountSpec interface.
16
- */
17
- export function instanceOfVolumeMountSpec(value) {
18
- if (!('name' in value) || value['name'] === undefined)
19
- return false;
20
- if (!('mountPath' in value) || value['mountPath'] === undefined)
21
- return false;
22
- return true;
23
- }
24
- export function VolumeMountSpecFromJSON(json) {
25
- return VolumeMountSpecFromJSONTyped(json, false);
26
- }
27
- export function VolumeMountSpecFromJSONTyped(json, ignoreDiscriminator) {
28
- if (json == null) {
29
- return json;
30
- }
31
- return {
32
- 'name': json['name'],
33
- 'mountPath': json['mountPath'],
34
- 'readOnly': json['readOnly'] == null ? undefined : json['readOnly'],
35
- };
36
- }
37
- export function VolumeMountSpecToJSON(json) {
38
- return VolumeMountSpecToJSONTyped(json, false);
39
- }
40
- export function VolumeMountSpecToJSONTyped(value, ignoreDiscriminator = false) {
41
- if (value == null) {
42
- return value;
43
- }
44
- return {
45
- 'name': value['name'],
46
- 'mountPath': value['mountPath'],
47
- 'readOnly': value['readOnly'],
48
- };
49
- }
@@ -1,31 +0,0 @@
1
- import type { CreateSandboxVolumeRequest, FileInfo, ForkVolumeRequest, CreateSnapshotRequest, SandboxVolume, Snapshot, SuccessCreatedResponse, SuccessDeletedResponse, SuccessRestoreResponse, SuccessMovedResponse, VolumeFileArchiveImportResponse, SuccessWrittenResponse } from "../apispec/src/models/index.js";
2
- import type { Client } from "../client.js";
3
- import { VolumeSession } from "../sessions.js";
4
- import { FileWatchStream } from "../sandbox.js";
5
- export declare class Volumes {
6
- private readonly client;
7
- constructor(client: Client);
8
- create(request: CreateSandboxVolumeRequest): Promise<SandboxVolume>;
9
- open(request: CreateSandboxVolumeRequest): Promise<VolumeSession>;
10
- list(): Promise<SandboxVolume[]>;
11
- get(volumeId: string): Promise<SandboxVolume>;
12
- delete(volumeId: string, options?: {
13
- force?: boolean;
14
- }): Promise<SuccessDeletedResponse>;
15
- fork(volumeId: string, request?: ForkVolumeRequest): Promise<SandboxVolume>;
16
- createSnapshot(volumeId: string, request: CreateSnapshotRequest): Promise<Snapshot>;
17
- listSnapshots(volumeId: string): Promise<Snapshot[]>;
18
- getSnapshot(volumeId: string, snapshotId: string): Promise<Snapshot>;
19
- deleteSnapshot(volumeId: string, snapshotId: string): Promise<SuccessDeletedResponse>;
20
- restoreSnapshot(volumeId: string, snapshotId: string): Promise<SuccessRestoreResponse>;
21
- readFile(volumeId: string, path: string): Promise<Uint8Array>;
22
- statFile(volumeId: string, path: string): Promise<FileInfo>;
23
- listFiles(volumeId: string, path: string): Promise<FileInfo[]>;
24
- writeFile(volumeId: string, path: string, data: Uint8Array | string): Promise<SuccessWrittenResponse>;
25
- importArchive(volumeId: string, path: string, archive: Blob | Uint8Array | ArrayBuffer | string): Promise<VolumeFileArchiveImportResponse>;
26
- mkdir(volumeId: string, path: string, recursive?: boolean): Promise<SuccessCreatedResponse>;
27
- deleteFile(volumeId: string, path: string): Promise<SuccessDeletedResponse>;
28
- moveFile(volumeId: string, source: string, destination: string): Promise<SuccessMovedResponse>;
29
- watchFiles(volumeId: string, path: string, recursive?: boolean): Promise<FileWatchStream>;
30
- }
31
- //# sourceMappingURL=volumes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"volumes.d.ts","sourceRoot":"","sources":["../../src/resources/volumes.ts"],"names":[],"mappings":"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"}
@@ -1,222 +0,0 @@
1
- import { models } from "../apispec_compat.js";
2
- import { APIError } from "../errors.js";
3
- import { ensureData, ensureModel } from "../response.js";
4
- import { wrapApiCall } from "../errors.js";
5
- import { VolumeSession } from "../sessions.js";
6
- import { FileWatchStream } from "../sandbox.js";
7
- import { WebSocketClient } from "../ws_client.js";
8
- export class Volumes {
9
- client;
10
- constructor(client) {
11
- this.client = client;
12
- }
13
- async create(request) {
14
- const response = await wrapApiCall(() => this.client.apispec.sandboxVolumes.apiV1SandboxvolumesPost({
15
- createSandboxVolumeRequest: request,
16
- }));
17
- return ensureData(response, "create volume returned empty response");
18
- }
19
- async open(request) {
20
- const volume = await this.create(request);
21
- return new VolumeSession(volume, async () => {
22
- await this.delete(volume.id);
23
- });
24
- }
25
- async list() {
26
- const response = await wrapApiCall(() => this.client.apispec.sandboxVolumes.apiV1SandboxvolumesGet());
27
- const data = ensureData(response, "list volumes returned empty response");
28
- return data;
29
- }
30
- async get(volumeId) {
31
- const response = await wrapApiCall(() => this.client.apispec.sandboxVolumes.apiV1SandboxvolumesIdGet({ id: volumeId }));
32
- return ensureData(response, "get volume returned empty response");
33
- }
34
- async delete(volumeId, options) {
35
- const response = await wrapApiCall(() => this.client.apispec.sandboxVolumes.apiV1SandboxvolumesIdDelete({
36
- id: volumeId,
37
- force: options?.force,
38
- }));
39
- return ensureModel(response, "delete volume returned empty response");
40
- }
41
- async fork(volumeId, request) {
42
- const response = await wrapApiCall(() => this.client.apispec.sandboxVolumes.apiV1SandboxvolumesIdForkPost({
43
- id: volumeId,
44
- forkVolumeRequest: request,
45
- }));
46
- return ensureData(response, "fork volume returned empty response");
47
- }
48
- async createSnapshot(volumeId, request) {
49
- const response = await wrapApiCall(() => this.client.apispec.snapshots.apiV1SandboxvolumesIdSnapshotsPost({
50
- id: volumeId,
51
- createSnapshotRequest: request,
52
- }));
53
- return ensureData(response, "create snapshot returned empty response");
54
- }
55
- async listSnapshots(volumeId) {
56
- const response = await wrapApiCall(() => this.client.apispec.snapshots.apiV1SandboxvolumesIdSnapshotsGet({ id: volumeId }));
57
- const data = ensureData(response, "list snapshots returned empty response");
58
- return data;
59
- }
60
- async getSnapshot(volumeId, snapshotId) {
61
- const response = await wrapApiCall(() => this.client.apispec.snapshots.apiV1SandboxvolumesIdSnapshotsSnapshotIdGet({
62
- id: volumeId,
63
- snapshotId,
64
- }));
65
- return ensureData(response, "get snapshot returned empty response");
66
- }
67
- async deleteSnapshot(volumeId, snapshotId) {
68
- const response = await wrapApiCall(() => this.client.apispec.snapshots.apiV1SandboxvolumesIdSnapshotsSnapshotIdDelete({
69
- id: volumeId,
70
- snapshotId,
71
- }));
72
- return ensureModel(response, "delete snapshot returned empty response");
73
- }
74
- async restoreSnapshot(volumeId, snapshotId) {
75
- const response = await wrapApiCall(() => this.client.apispec.snapshots.apiV1SandboxvolumesIdSnapshotsSnapshotIdRestorePost({
76
- id: volumeId,
77
- snapshotId,
78
- }));
79
- return ensureModel(response, "restore snapshot returned empty response");
80
- }
81
- async readFile(volumeId, path) {
82
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesGetRaw({
83
- id: volumeId,
84
- path,
85
- }));
86
- const contentType = response.raw.headers.get("content-type")?.toLowerCase() ?? "";
87
- if (contentType.includes("application/json")) {
88
- const payload = (await response.raw.json());
89
- const data = ensureData(payload, "read volume file returned empty response");
90
- const content = data.content ?? "";
91
- const encoding = data.encoding;
92
- if (encoding && encoding !== models.FileContentResponseEncodingEnum.Base64) {
93
- throw new APIError({
94
- statusCode: response.raw.status,
95
- code: "unsupported_encoding",
96
- message: `unsupported file encoding: ${encoding}`,
97
- });
98
- }
99
- return Buffer.from(content, "base64");
100
- }
101
- const blob = await response.value();
102
- const buffer = await blob.arrayBuffer();
103
- return new Uint8Array(buffer);
104
- }
105
- async statFile(volumeId, path) {
106
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesStatGet({
107
- id: volumeId,
108
- path,
109
- }));
110
- return ensureData(response, "stat volume file returned empty response");
111
- }
112
- async listFiles(volumeId, path) {
113
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesListGet({
114
- id: volumeId,
115
- path,
116
- }));
117
- const data = ensureData(response, "list volume files returned empty response");
118
- return data.entries ?? [];
119
- }
120
- async writeFile(volumeId, path, data) {
121
- const payload = typeof data === "string" ? Buffer.from(data) : data;
122
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesPost({
123
- id: volumeId,
124
- path,
125
- body: new Blob([payload]),
126
- }));
127
- return ensureModel(response, "write volume file returned empty response");
128
- }
129
- async importArchive(volumeId, path, archive) {
130
- const body = archive instanceof Blob ? archive : new Blob([archive]);
131
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesArchivePut({
132
- id: volumeId,
133
- path,
134
- body,
135
- }));
136
- return ensureData(response, "import volume archive returned empty response");
137
- }
138
- async mkdir(volumeId, path, recursive = false) {
139
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesPost({
140
- id: volumeId,
141
- path,
142
- mkdir: true,
143
- recursive: recursive || undefined,
144
- body: new Blob([]),
145
- }));
146
- return ensureModel(response, "mkdir volume path returned empty response");
147
- }
148
- async deleteFile(volumeId, path) {
149
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesDelete({
150
- id: volumeId,
151
- path,
152
- }));
153
- return ensureModel(response, "delete volume file returned empty response");
154
- }
155
- async moveFile(volumeId, source, destination) {
156
- const response = await wrapApiCall(() => this.client.apispec.files.apiV1SandboxvolumesIdFilesMovePost({
157
- id: volumeId,
158
- moveFileRequest: { source, destination },
159
- }));
160
- return ensureModel(response, "move volume file returned empty response");
161
- }
162
- async watchFiles(volumeId, path, recursive = false) {
163
- const wsUrl = this.client.websocketUrl(`/api/v1/sandboxvolumes/${volumeId}/files/watch`);
164
- const headers = await this.client.wsHeaders();
165
- const socket = await WebSocketClient.connect(wsUrl, { headers });
166
- await socket.waitForOpen();
167
- socket.send(JSON.stringify({ action: "subscribe", path, recursive: !!recursive }));
168
- const firstRaw = await socket.waitForMessage();
169
- const first = firstRaw ? parseWsMessage(firstRaw) : null;
170
- if (!first) {
171
- socket.close();
172
- throw new APIError({
173
- statusCode: 0,
174
- code: "watch_failed",
175
- message: "watch subscribe failed: empty response",
176
- });
177
- }
178
- if (first.type === "error") {
179
- socket.close();
180
- throw new APIError({
181
- statusCode: 0,
182
- code: "watch_failed",
183
- message: `watch subscribe failed: ${first.error ?? ""}`,
184
- });
185
- }
186
- if (first.type !== "subscribed" || !first.watch_id) {
187
- socket.close();
188
- throw new APIError({
189
- statusCode: 0,
190
- code: "watch_failed",
191
- message: `unexpected watch response: ${first.type ?? ""}`,
192
- });
193
- }
194
- const stream = new FileWatchStream(socket);
195
- stream.watchId = String(first.watch_id);
196
- return stream;
197
- }
198
- }
199
- function parseWsMessage(data) {
200
- try {
201
- let text;
202
- if (typeof data === "string") {
203
- text = data;
204
- }
205
- else if (Buffer.isBuffer(data)) {
206
- text = data.toString("utf-8");
207
- }
208
- else if (Array.isArray(data)) {
209
- text = Buffer.concat(data).toString("utf-8");
210
- }
211
- else if (data instanceof ArrayBuffer) {
212
- text = Buffer.from(data).toString("utf-8");
213
- }
214
- else {
215
- text = Buffer.from(data).toString("utf-8");
216
- }
217
- return JSON.parse(text);
218
- }
219
- catch {
220
- return null;
221
- }
222
- }