@blaxel/core 0.2.96-preview.204 → 0.2.96-preview.205
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 +37 -2
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/common/pagination.js +92 -0
- package/dist/cjs/common/pagination.test.js +81 -0
- package/dist/cjs/common/settings.js +3 -3
- package/dist/cjs/common/settings.test.js +3 -3
- package/dist/cjs/drive/index.js +39 -4
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/jobs/jobs.js +42 -10
- package/dist/cjs/sandbox/client/sdk.gen.js +2 -2
- package/dist/cjs/sandbox/preview.js +8 -3
- package/dist/cjs/sandbox/sandbox.js +40 -33
- package/dist/cjs/types/common/pagination.d.ts +35 -0
- package/dist/cjs/types/common/pagination.test.d.ts +1 -0
- package/dist/cjs/types/drive/index.d.ts +35 -5
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/jobs/jobs.d.ts +33 -3
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +2 -2
- package/dist/cjs/types/sandbox/client/types.gen.d.ts +28 -1
- package/dist/cjs/types/sandbox/preview.d.ts +2 -2
- package/dist/cjs/types/sandbox/sandbox.d.ts +36 -3
- package/dist/cjs/types/volume/index.d.ts +37 -4
- package/dist/cjs/volume/index.js +41 -4
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/common/pagination.js +92 -0
- package/dist/cjs-browser/common/pagination.test.js +81 -0
- package/dist/cjs-browser/common/settings.js +3 -3
- package/dist/cjs-browser/common/settings.test.js +3 -3
- package/dist/cjs-browser/drive/index.js +39 -4
- package/dist/cjs-browser/index.js +1 -0
- package/dist/cjs-browser/jobs/jobs.js +42 -10
- package/dist/cjs-browser/sandbox/client/sdk.gen.js +2 -2
- package/dist/cjs-browser/sandbox/preview.js +8 -3
- package/dist/cjs-browser/sandbox/sandbox.js +40 -33
- package/dist/cjs-browser/types/common/pagination.d.ts +35 -0
- package/dist/cjs-browser/types/common/pagination.test.d.ts +1 -0
- package/dist/cjs-browser/types/drive/index.d.ts +35 -5
- package/dist/cjs-browser/types/index.d.ts +1 -0
- package/dist/cjs-browser/types/jobs/jobs.d.ts +33 -3
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +2 -2
- package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +28 -1
- package/dist/cjs-browser/types/sandbox/preview.d.ts +2 -2
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +36 -3
- package/dist/cjs-browser/types/volume/index.d.ts +37 -4
- package/dist/cjs-browser/volume/index.js +41 -4
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/common/pagination.js +88 -0
- package/dist/esm/common/pagination.test.js +79 -0
- package/dist/esm/common/settings.js +3 -3
- package/dist/esm/common/settings.test.js +3 -3
- package/dist/esm/drive/index.js +39 -4
- package/dist/esm/index.js +1 -0
- package/dist/esm/jobs/jobs.js +42 -10
- package/dist/esm/sandbox/client/sdk.gen.js +2 -2
- package/dist/esm/sandbox/preview.js +8 -3
- package/dist/esm/sandbox/sandbox.js +40 -33
- package/dist/esm/volume/index.js +41 -4
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/common/pagination.js +88 -0
- package/dist/esm-browser/common/pagination.test.js +79 -0
- package/dist/esm-browser/common/settings.js +3 -3
- package/dist/esm-browser/common/settings.test.js +3 -3
- package/dist/esm-browser/drive/index.js +39 -4
- package/dist/esm-browser/index.js +1 -0
- package/dist/esm-browser/jobs/jobs.js +42 -10
- package/dist/esm-browser/sandbox/client/sdk.gen.js +2 -2
- package/dist/esm-browser/sandbox/preview.js +8 -3
- package/dist/esm-browser/sandbox/sandbox.js +40 -33
- package/dist/esm-browser/volume/index.js +41 -4
- package/package.json +1 -1
|
@@ -37,8 +37,16 @@ export type DriveListResponse = {
|
|
|
37
37
|
export type DriveMountInfo = {
|
|
38
38
|
driveName?: string;
|
|
39
39
|
drivePath?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The local GID used for this mount
|
|
42
|
+
*/
|
|
43
|
+
gidMap?: string;
|
|
40
44
|
mountPath?: string;
|
|
41
45
|
readOnly?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The local UID used for this mount
|
|
48
|
+
*/
|
|
49
|
+
uidMap?: string;
|
|
42
50
|
};
|
|
43
51
|
export type DriveMountRequest = {
|
|
44
52
|
driveName: string;
|
|
@@ -46,19 +54,35 @@ export type DriveMountRequest = {
|
|
|
46
54
|
* Optional, defaults to "/"
|
|
47
55
|
*/
|
|
48
56
|
drivePath?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Optional, local GID to map (filer GID is always 0)
|
|
59
|
+
*/
|
|
60
|
+
gidMap?: string;
|
|
49
61
|
mountPath: string;
|
|
50
62
|
/**
|
|
51
63
|
* Optional, defaults to false
|
|
52
64
|
*/
|
|
53
65
|
readOnly?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Optional, local UID to map (filer UID is always 0)
|
|
68
|
+
*/
|
|
69
|
+
uidMap?: string;
|
|
54
70
|
};
|
|
55
71
|
export type DriveMountResponse = {
|
|
56
72
|
driveName?: string;
|
|
57
73
|
drivePath?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The local GID used for this mount
|
|
76
|
+
*/
|
|
77
|
+
gidMap?: string;
|
|
58
78
|
message?: string;
|
|
59
79
|
mountPath?: string;
|
|
60
80
|
readOnly?: boolean;
|
|
61
81
|
success?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The local UID used for this mount
|
|
84
|
+
*/
|
|
85
|
+
uidMap?: string;
|
|
62
86
|
};
|
|
63
87
|
export type DriveUnmountResponse = {
|
|
64
88
|
message?: string;
|
|
@@ -175,6 +199,9 @@ export type ProcessRequest = {
|
|
|
175
199
|
* Disable scale-to-zero while process runs. Default timeout is 600s (10 minutes). Set timeout to 0 for infinite.
|
|
176
200
|
*/
|
|
177
201
|
keepAlive?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Maximum number of restarts on failure. Set to a negative value (e.g. -1) for unlimited restarts.
|
|
204
|
+
*/
|
|
178
205
|
maxRestarts?: number;
|
|
179
206
|
name?: string;
|
|
180
207
|
restartOnFailure?: boolean;
|
|
@@ -241,7 +268,7 @@ export type UpgradeRequest = {
|
|
|
241
268
|
*/
|
|
242
269
|
baseUrl?: string;
|
|
243
270
|
/**
|
|
244
|
-
* Version to upgrade to: "
|
|
271
|
+
* Version to upgrade to: "latest" (default), "develop", "main", or specific tag like "v1.0.0"
|
|
245
272
|
*/
|
|
246
273
|
version?: string;
|
|
247
274
|
};
|
|
@@ -30,8 +30,8 @@ export declare class SandboxPreviews {
|
|
|
30
30
|
constructor(sandbox: Sandbox);
|
|
31
31
|
get sandboxName(): string;
|
|
32
32
|
list(): Promise<SandboxPreview[]>;
|
|
33
|
-
create(preview: Preview): Promise<SandboxPreview>;
|
|
34
|
-
createIfNotExists(preview: Preview): Promise<SandboxPreview>;
|
|
33
|
+
create(preview: Preview, force?: boolean): Promise<SandboxPreview>;
|
|
34
|
+
createIfNotExists(preview: Preview, force?: boolean): Promise<SandboxPreview>;
|
|
35
35
|
get(previewName: string): Promise<SandboxPreview>;
|
|
36
36
|
delete(previewName: string): Promise<Preview>;
|
|
37
37
|
private waitForDeletion;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type http2 from "http2";
|
|
2
|
-
import { SandboxLifecycle, Sandbox as SandboxModel } from "../client/index.js";
|
|
2
|
+
import { type ListSandboxesData, type SandboxLifecycle, type Sandbox as SandboxModel } from "../client/index.js";
|
|
3
3
|
import { SandboxCodegen } from "./codegen/index.js";
|
|
4
4
|
import { SandboxDrive } from "./drive/index.js";
|
|
5
5
|
import { SandboxFileSystem } from "./filesystem/index.js";
|
|
@@ -10,6 +10,7 @@ import { SandboxSchedules } from "./schedule.js";
|
|
|
10
10
|
import { SandboxSessions } from "./session.js";
|
|
11
11
|
import { SandboxSystem } from "./system.js";
|
|
12
12
|
import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SandboxUpdateNetwork, SessionWithToken } from "./types.js";
|
|
13
|
+
export type SandboxListQuery = NonNullable<ListSandboxesData["query"]>;
|
|
13
14
|
export declare class SandboxInstance {
|
|
14
15
|
private sandbox;
|
|
15
16
|
fs: SandboxFileSystem;
|
|
@@ -54,9 +55,41 @@ export declare class SandboxInstance {
|
|
|
54
55
|
}): Promise<SandboxInstance>;
|
|
55
56
|
static get(sandboxName: string): Promise<SandboxInstance>;
|
|
56
57
|
static getByExternalId(externalId: string): Promise<SandboxInstance>;
|
|
57
|
-
|
|
58
|
+
/**
|
|
59
|
+
* List one page of sandboxes.
|
|
60
|
+
*
|
|
61
|
+
* The returned page exposes `data` for the current page, `meta` for cursor
|
|
62
|
+
* metadata, and helpers to fetch more pages only when you need them.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const page = await SandboxInstance.list({ limit: 50 });
|
|
67
|
+
*
|
|
68
|
+
* for (const sandbox of page.data) {
|
|
69
|
+
* console.log(sandbox.metadata.name);
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* const nextPage = await page.nextPage();
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const page = await SandboxInstance.list({ limit: 100 });
|
|
78
|
+
*
|
|
79
|
+
* for await (const sandbox of page) {
|
|
80
|
+
* console.log(sandbox.metadata.name);
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
static list(query?: SandboxListQuery): Promise<import("../common/pagination.js").PaginatedList<SandboxInstance, {
|
|
85
|
+
showTerminated?: boolean;
|
|
86
|
+
cursor?: string;
|
|
87
|
+
limit?: number;
|
|
88
|
+
sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
|
|
89
|
+
q?: string;
|
|
90
|
+
anchor?: "end";
|
|
58
91
|
externalId?: string;
|
|
59
|
-
}
|
|
92
|
+
}>>;
|
|
60
93
|
static delete(sandboxName: string): Promise<SandboxModel>;
|
|
61
94
|
delete(): Promise<SandboxModel>;
|
|
62
95
|
static updateMetadata(sandboxName: string, metadata: SandboxUpdateMetadata): Promise<SandboxInstance>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { Volume } from "../client/index.js";
|
|
2
|
-
export
|
|
1
|
+
import { type ListVolumesData, type Volume } from "../client/index.js";
|
|
2
|
+
export type VolumeListQuery = NonNullable<ListVolumesData["query"]>;
|
|
3
|
+
export type VolumeCreateConfiguration = {
|
|
3
4
|
name?: string;
|
|
4
5
|
displayName?: string;
|
|
5
6
|
labels?: Record<string, string>;
|
|
6
7
|
size?: number;
|
|
7
8
|
region?: string;
|
|
8
9
|
template?: string;
|
|
9
|
-
}
|
|
10
|
+
};
|
|
10
11
|
export declare class VolumeInstance {
|
|
11
12
|
private volume;
|
|
12
13
|
constructor(volume: Volume);
|
|
@@ -19,7 +20,39 @@ export declare class VolumeInstance {
|
|
|
19
20
|
get region(): string | undefined;
|
|
20
21
|
static create(config: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
|
|
21
22
|
static get(volumeName: string): Promise<VolumeInstance>;
|
|
22
|
-
|
|
23
|
+
/**
|
|
24
|
+
* List one page of volumes.
|
|
25
|
+
*
|
|
26
|
+
* The returned page exposes `data` for the current page, `meta` for cursor
|
|
27
|
+
* metadata, and helpers to fetch more pages only when you need them.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const page = await VolumeInstance.list({ limit: 50 });
|
|
32
|
+
*
|
|
33
|
+
* for (const volume of page.data) {
|
|
34
|
+
* console.log(volume.name);
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* const nextPage = await page.nextPage();
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const page = await VolumeInstance.list({ limit: 100 });
|
|
43
|
+
*
|
|
44
|
+
* for await (const volume of page) {
|
|
45
|
+
* console.log(volume.name);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
static list(query?: VolumeListQuery): Promise<import("../common/pagination.js").PaginatedList<VolumeInstance, {
|
|
50
|
+
cursor?: string;
|
|
51
|
+
limit?: number;
|
|
52
|
+
sort?: "createdAt:desc" | "createdAt:asc" | "name:asc" | "name:desc";
|
|
53
|
+
q?: string;
|
|
54
|
+
anchor?: "end";
|
|
55
|
+
}>>;
|
|
23
56
|
static delete(volumeName: string): Promise<Volume>;
|
|
24
57
|
delete(): Promise<Volume>;
|
|
25
58
|
static update(volumeName: string, updates: VolumeCreateConfiguration | Volume): Promise<VolumeInstance>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VolumeInstance = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
const index_js_1 = require("../client/index.js");
|
|
6
|
+
const pagination_js_1 = require("../common/pagination.js");
|
|
6
7
|
const settings_js_1 = require("../common/settings.js");
|
|
7
8
|
class VolumeInstance {
|
|
8
9
|
volume;
|
|
@@ -88,10 +89,46 @@ class VolumeInstance {
|
|
|
88
89
|
});
|
|
89
90
|
return new VolumeInstance(data);
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
/**
|
|
93
|
+
* List one page of volumes.
|
|
94
|
+
*
|
|
95
|
+
* The returned page exposes `data` for the current page, `meta` for cursor
|
|
96
|
+
* metadata, and helpers to fetch more pages only when you need them.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const page = await VolumeInstance.list({ limit: 50 });
|
|
101
|
+
*
|
|
102
|
+
* for (const volume of page.data) {
|
|
103
|
+
* console.log(volume.name);
|
|
104
|
+
* }
|
|
105
|
+
*
|
|
106
|
+
* const nextPage = await page.nextPage();
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const page = await VolumeInstance.list({ limit: 100 });
|
|
112
|
+
*
|
|
113
|
+
* for await (const volume of page) {
|
|
114
|
+
* console.log(volume.name);
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
static async list(query) {
|
|
119
|
+
const fetchPage = async (pageQuery) => {
|
|
120
|
+
const { data } = await (0, index_js_1.listVolumes)({
|
|
121
|
+
query: pageQuery,
|
|
122
|
+
throwOnError: true,
|
|
123
|
+
});
|
|
124
|
+
return data;
|
|
125
|
+
};
|
|
126
|
+
return (0, pagination_js_1.createPaginatedList)({
|
|
127
|
+
response: await fetchPage(query),
|
|
128
|
+
fetchPage,
|
|
129
|
+
mapItem: (volume) => new VolumeInstance(volume),
|
|
130
|
+
query,
|
|
131
|
+
});
|
|
95
132
|
}
|
|
96
133
|
static async delete(volumeName) {
|
|
97
134
|
const { data } = await (0, index_js_1.deleteVolume)({
|