@blaxel/core 0.2.69 → 0.2.70
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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/client/sdk.gen.js +124 -3
- package/dist/cjs/common/settings.js +2 -2
- package/dist/cjs/drive/index.js +182 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/sandbox/drive/drive.js +70 -0
- package/dist/cjs/sandbox/drive/index.js +17 -0
- package/dist/cjs/sandbox/sandbox.js +9 -6
- package/dist/cjs/types/client/sdk.gen.d.ts +47 -1
- package/dist/cjs/types/client/types.gen.d.ts +237 -0
- package/dist/cjs/types/drive/index.d.ts +34 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/sandbox/drive/drive.d.ts +42 -0
- package/dist/cjs/types/sandbox/drive/index.d.ts +1 -0
- package/dist/cjs/types/sandbox/sandbox.d.ts +2 -0
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/client/sdk.gen.js +124 -3
- package/dist/cjs-browser/common/settings.js +2 -2
- package/dist/cjs-browser/drive/index.js +182 -0
- package/dist/cjs-browser/index.js +1 -0
- package/dist/cjs-browser/sandbox/drive/drive.js +70 -0
- package/dist/cjs-browser/sandbox/drive/index.js +17 -0
- package/dist/cjs-browser/sandbox/sandbox.js +9 -6
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +47 -1
- package/dist/cjs-browser/types/client/types.gen.d.ts +237 -0
- package/dist/cjs-browser/types/drive/index.d.ts +34 -0
- package/dist/cjs-browser/types/index.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/drive/drive.d.ts +42 -0
- package/dist/cjs-browser/types/sandbox/drive/index.d.ts +1 -0
- package/dist/cjs-browser/types/sandbox/sandbox.d.ts +2 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/client/sdk.gen.js +114 -0
- package/dist/esm/common/settings.js +2 -2
- package/dist/esm/drive/index.js +178 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/sandbox/drive/drive.js +66 -0
- package/dist/esm/sandbox/drive/index.js +1 -0
- package/dist/esm/sandbox/sandbox.js +3 -0
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/client/sdk.gen.js +114 -0
- package/dist/esm-browser/common/settings.js +2 -2
- package/dist/esm-browser/drive/index.js +178 -0
- package/dist/esm-browser/index.js +1 -0
- package/dist/esm-browser/sandbox/drive/drive.js +66 -0
- package/dist/esm-browser/sandbox/drive/index.js +1 -0
- package/dist/esm-browser/sandbox/sandbox.js +3 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.acceptWorkspaceInvitation = exports.declineWorkspaceInvitation = exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getEgressIp = exports.deleteEgressIp = exports.createEgressIp = exports.listEgressIps = exports.getEgressGateway = exports.deleteEgressGateway = exports.createEgressGateway = exports.listEgressGateways = exports.getVpc = exports.deleteVpc = exports.createVpc = void 0;
|
|
4
|
+
exports.listJobExecutions = exports.updateJob = exports.getJob = exports.deleteJob = exports.createJob = exports.listJobs = exports.getIntegrationConnectionModel = exports.listIntegrationConnectionModels = exports.getIntegrationConnectionModelEndpointConfigurations = exports.updateIntegrationConnection = exports.getIntegrationConnection = exports.deleteIntegrationConnection = exports.createIntegrationConnection = exports.listIntegrationConnections = exports.getIntegration = exports.deleteImageTag = exports.getImage = exports.deleteImage = exports.listImages = exports.cleanupImages = exports.listFunctionRevisions = exports.updateFunction = exports.getFunction = exports.deleteFunction = exports.createFunction = exports.listFunctions = exports.testFeatureFlag = exports.getWorkspaceFeatures = exports.listAllEgressIps = exports.listAllEgressGateways = exports.getDriveJwks = exports.createDriveAccessToken = exports.updateDrive = exports.getDrive = exports.deleteDrive = exports.createDrive = exports.listDrives = exports.verifyCustomDomain = exports.updateCustomDomain = exports.getCustomDomain = exports.deleteCustomDomain = exports.createCustomDomain = exports.listCustomDomains = exports.getConfiguration = exports.listAgentRevisions = exports.updateAgent = exports.getAgent = exports.deleteAgent = exports.createAgent = exports.listAgents = void 0;
|
|
5
|
+
exports.updateVolumeTemplate = exports.getVolumeTemplate = exports.deleteVolumeTemplate = exports.createVolumeTemplate = exports.listVolumeTemplates = exports.updateWorkspaceUserRole = exports.removeWorkspaceUser = exports.inviteWorkspaceUser = exports.listWorkspaceUsers = exports.getTemplate = exports.listTemplates = exports.deleteApiKeyForServiceAccount = exports.createApiKeyForServiceAccount = exports.listApiKeysForServiceAccount = exports.updateWorkspaceServiceAccount = exports.deleteWorkspaceServiceAccount = exports.createWorkspaceServiceAccount = exports.getWorkspaceServiceAccounts = exports.deleteSandboxPreviewToken = exports.createSandboxPreviewToken = exports.listSandboxPreviewTokens = exports.updateSandboxPreview = exports.getSandboxPreview = exports.deleteSandboxPreview = exports.createSandboxPreview = exports.listSandboxPreviews = exports.updateSandbox = exports.getSandbox = exports.deleteSandbox = exports.createSandbox = exports.listSandboxes = exports.listSandboxHubDefinitions = exports.listPublicIps = exports.updatePolicy = exports.getPolicy = exports.deletePolicy = exports.createPolicy = exports.listPolicies = exports.listModelRevisions = exports.updateModel = exports.getModel = exports.deleteModel = exports.createModel = exports.listModels = exports.listMcpHubDefinitions = exports.listLocations = exports.listJobRevisions = exports.getJobExecution = exports.deleteJobExecution = exports.createJobExecution = void 0;
|
|
6
|
+
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.acceptWorkspaceInvitation = exports.declineWorkspaceInvitation = exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getEgressIp = exports.deleteEgressIp = exports.createEgressIp = exports.listEgressIps = exports.getEgressGateway = exports.deleteEgressGateway = exports.createEgressGateway = exports.listEgressGateways = exports.getVpc = exports.deleteVpc = exports.createVpc = exports.listVpcs = exports.updateVolume = exports.getVolume = exports.deleteVolume = exports.createVolume = exports.listVolumes = exports.deleteVolumeTemplateVersion = void 0;
|
|
7
7
|
const client_gen_1 = require("./client.gen");
|
|
8
8
|
/**
|
|
9
9
|
* List all agents
|
|
@@ -237,6 +237,127 @@ const verifyCustomDomain = (options) => {
|
|
|
237
237
|
});
|
|
238
238
|
};
|
|
239
239
|
exports.verifyCustomDomain = verifyCustomDomain;
|
|
240
|
+
/**
|
|
241
|
+
* List drives
|
|
242
|
+
* Returns all drives in the workspace. Drives provide persistent storage that can be attached to agents, functions, and sandboxes.
|
|
243
|
+
*/
|
|
244
|
+
const listDrives = (options) => {
|
|
245
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
246
|
+
security: [
|
|
247
|
+
{
|
|
248
|
+
scheme: 'bearer',
|
|
249
|
+
type: 'http'
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
url: '/drives',
|
|
253
|
+
...options
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
exports.listDrives = listDrives;
|
|
257
|
+
/**
|
|
258
|
+
* Create a drive
|
|
259
|
+
* Creates a new drive in the workspace. Drives are backed by SeaweedFS buckets and can be mounted at runtime to sandboxes.
|
|
260
|
+
*/
|
|
261
|
+
const createDrive = (options) => {
|
|
262
|
+
return (options.client ?? client_gen_1.client).post({
|
|
263
|
+
security: [
|
|
264
|
+
{
|
|
265
|
+
scheme: 'bearer',
|
|
266
|
+
type: 'http'
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
url: '/drives',
|
|
270
|
+
...options,
|
|
271
|
+
headers: {
|
|
272
|
+
'Content-Type': 'application/json',
|
|
273
|
+
...options?.headers
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
exports.createDrive = createDrive;
|
|
278
|
+
/**
|
|
279
|
+
* Delete a drive
|
|
280
|
+
* Deletes a drive immediately. The drive record is removed from the database synchronously.
|
|
281
|
+
*/
|
|
282
|
+
const deleteDrive = (options) => {
|
|
283
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
284
|
+
security: [
|
|
285
|
+
{
|
|
286
|
+
scheme: 'bearer',
|
|
287
|
+
type: 'http'
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
url: '/drives/{driveName}',
|
|
291
|
+
...options
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
exports.deleteDrive = deleteDrive;
|
|
295
|
+
/**
|
|
296
|
+
* Get a drive
|
|
297
|
+
* Retrieves details of a specific drive including its status and events.
|
|
298
|
+
*/
|
|
299
|
+
const getDrive = (options) => {
|
|
300
|
+
return (options.client ?? client_gen_1.client).get({
|
|
301
|
+
security: [
|
|
302
|
+
{
|
|
303
|
+
scheme: 'bearer',
|
|
304
|
+
type: 'http'
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
url: '/drives/{driveName}',
|
|
308
|
+
...options
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
exports.getDrive = getDrive;
|
|
312
|
+
/**
|
|
313
|
+
* Update a drive
|
|
314
|
+
* Updates an existing drive. Metadata fields like displayName and labels can be changed. Size can be set if not already configured.
|
|
315
|
+
*/
|
|
316
|
+
const updateDrive = (options) => {
|
|
317
|
+
return (options.client ?? client_gen_1.client).put({
|
|
318
|
+
security: [
|
|
319
|
+
{
|
|
320
|
+
scheme: 'bearer',
|
|
321
|
+
type: 'http'
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
url: '/drives/{driveName}',
|
|
325
|
+
...options,
|
|
326
|
+
headers: {
|
|
327
|
+
'Content-Type': 'application/json',
|
|
328
|
+
...options?.headers
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
exports.updateDrive = updateDrive;
|
|
333
|
+
/**
|
|
334
|
+
* Create drive access token
|
|
335
|
+
* Issues a short-lived JWT access token scoped to a specific drive. The token can be used as Bearer authentication for direct S3 operations against the drive's SeaweedFS bucket.
|
|
336
|
+
*/
|
|
337
|
+
const createDriveAccessToken = (options) => {
|
|
338
|
+
return (options.client ?? client_gen_1.client).post({
|
|
339
|
+
security: [
|
|
340
|
+
{
|
|
341
|
+
scheme: 'bearer',
|
|
342
|
+
type: 'http'
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
url: '/drives/{driveName}/access-token',
|
|
346
|
+
...options
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
exports.createDriveAccessToken = createDriveAccessToken;
|
|
350
|
+
/**
|
|
351
|
+
* Get drive token JWKS
|
|
352
|
+
* Returns the JSON Web Key Set containing the Ed25519 public key used to verify drive access tokens. SeaweedFS or other S3-compatible storage can use this endpoint to validate Bearer tokens.
|
|
353
|
+
*/
|
|
354
|
+
const getDriveJwks = (options) => {
|
|
355
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
356
|
+
url: '/drives/jwks.json',
|
|
357
|
+
...options
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
exports.getDriveJwks = getDriveJwks;
|
|
240
361
|
/**
|
|
241
362
|
* List all egress gateways across all VPCs in the workspace
|
|
242
363
|
*/
|
|
@@ -9,8 +9,8 @@ const index_js_1 = require("../authentication/index.js");
|
|
|
9
9
|
const env_js_1 = require("../common/env.js");
|
|
10
10
|
const node_js_1 = require("../common/node.js");
|
|
11
11
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
12
|
-
const BUILD_VERSION = "0.2.
|
|
13
|
-
const BUILD_COMMIT = "
|
|
12
|
+
const BUILD_VERSION = "0.2.70";
|
|
13
|
+
const BUILD_COMMIT = "a3bbb13aa4ec149d33f1662d30dfb10ce3683baf";
|
|
14
14
|
const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
|
|
15
15
|
// Cache for config.yaml tracking value
|
|
16
16
|
let configTrackingValue = null;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DriveInstance = void 0;
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const index_js_1 = require("../client/index.js");
|
|
6
|
+
const settings_js_1 = require("../common/settings.js");
|
|
7
|
+
class DriveInstance {
|
|
8
|
+
drive;
|
|
9
|
+
constructor(drive) {
|
|
10
|
+
this.drive = drive;
|
|
11
|
+
}
|
|
12
|
+
get metadata() {
|
|
13
|
+
return this.drive.metadata;
|
|
14
|
+
}
|
|
15
|
+
get spec() {
|
|
16
|
+
return this.drive.spec;
|
|
17
|
+
}
|
|
18
|
+
get state() {
|
|
19
|
+
return this.drive.state;
|
|
20
|
+
}
|
|
21
|
+
get status() {
|
|
22
|
+
return this.drive.status;
|
|
23
|
+
}
|
|
24
|
+
get name() {
|
|
25
|
+
return this.drive.metadata.name;
|
|
26
|
+
}
|
|
27
|
+
get displayName() {
|
|
28
|
+
return this.drive.metadata.displayName;
|
|
29
|
+
}
|
|
30
|
+
get size() {
|
|
31
|
+
return this.drive.spec.size;
|
|
32
|
+
}
|
|
33
|
+
get region() {
|
|
34
|
+
return this.drive.spec.region;
|
|
35
|
+
}
|
|
36
|
+
static async create(config) {
|
|
37
|
+
const defaultName = `drive-${(0, uuid_1.v4)().replace(/-/g, '').substring(0, 8)}`;
|
|
38
|
+
let drive;
|
|
39
|
+
// Handle DriveCreateConfiguration or simple config object
|
|
40
|
+
if ('spec' in config && 'metadata' in config) {
|
|
41
|
+
// It's already a Drive object
|
|
42
|
+
drive = config;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
drive = {
|
|
46
|
+
metadata: {
|
|
47
|
+
name: config.name || defaultName,
|
|
48
|
+
displayName: config.displayName || config.name || defaultName,
|
|
49
|
+
labels: config.labels
|
|
50
|
+
},
|
|
51
|
+
spec: {
|
|
52
|
+
size: config.size,
|
|
53
|
+
region: config.region || settings_js_1.settings.region
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Ensure required fields have defaults
|
|
58
|
+
if (!drive.metadata) {
|
|
59
|
+
drive.metadata = { name: defaultName };
|
|
60
|
+
}
|
|
61
|
+
if (!drive.metadata.name) {
|
|
62
|
+
drive.metadata.name = defaultName;
|
|
63
|
+
}
|
|
64
|
+
if (!drive.spec) {
|
|
65
|
+
drive.spec = {};
|
|
66
|
+
}
|
|
67
|
+
if (!drive.spec.region && settings_js_1.settings.region) {
|
|
68
|
+
drive.spec.region = settings_js_1.settings.region;
|
|
69
|
+
}
|
|
70
|
+
if (!drive.spec.region) {
|
|
71
|
+
console.warn("DriveInstance.create: 'region' is not set. In a future version, 'region' will be a required parameter. " +
|
|
72
|
+
"Please specify a region (e.g. 'us-pdx-1', 'eu-lon-1', 'eu-dub-1') in the drive configuration or set the BL_REGION environment variable.");
|
|
73
|
+
}
|
|
74
|
+
const { data } = await (0, index_js_1.createDrive)({
|
|
75
|
+
body: drive,
|
|
76
|
+
throwOnError: true,
|
|
77
|
+
});
|
|
78
|
+
return new DriveInstance(data);
|
|
79
|
+
}
|
|
80
|
+
static async get(driveName) {
|
|
81
|
+
const { data } = await (0, index_js_1.getDrive)({
|
|
82
|
+
path: {
|
|
83
|
+
driveName,
|
|
84
|
+
},
|
|
85
|
+
throwOnError: true,
|
|
86
|
+
});
|
|
87
|
+
return new DriveInstance(data);
|
|
88
|
+
}
|
|
89
|
+
static async list() {
|
|
90
|
+
const { data } = await (0, index_js_1.listDrives)({ throwOnError: true });
|
|
91
|
+
return data.map((drive) => new DriveInstance(drive));
|
|
92
|
+
}
|
|
93
|
+
static async delete(driveName) {
|
|
94
|
+
const { data } = await (0, index_js_1.deleteDrive)({
|
|
95
|
+
path: {
|
|
96
|
+
driveName,
|
|
97
|
+
},
|
|
98
|
+
throwOnError: true,
|
|
99
|
+
});
|
|
100
|
+
return data;
|
|
101
|
+
}
|
|
102
|
+
async delete() {
|
|
103
|
+
return await DriveInstance.delete(this.metadata.name);
|
|
104
|
+
}
|
|
105
|
+
static async update(driveName, updates) {
|
|
106
|
+
const drive = await DriveInstance.get(driveName);
|
|
107
|
+
const metadataUpdates = {};
|
|
108
|
+
const specUpdates = {};
|
|
109
|
+
if ('spec' in updates && 'metadata' in updates) {
|
|
110
|
+
// It's a Drive object - only include defined fields
|
|
111
|
+
if (updates.metadata) {
|
|
112
|
+
if (updates.metadata.displayName !== undefined)
|
|
113
|
+
metadataUpdates.displayName = updates.metadata.displayName;
|
|
114
|
+
if (updates.metadata.labels !== undefined)
|
|
115
|
+
metadataUpdates.labels = updates.metadata.labels;
|
|
116
|
+
}
|
|
117
|
+
if (updates.spec) {
|
|
118
|
+
if (updates.spec.size !== undefined)
|
|
119
|
+
specUpdates.size = updates.spec.size;
|
|
120
|
+
if (updates.spec.region !== undefined)
|
|
121
|
+
specUpdates.region = updates.spec.region;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// It's a DriveCreateConfiguration - only include defined fields
|
|
126
|
+
if (updates.displayName !== undefined)
|
|
127
|
+
metadataUpdates.displayName = updates.displayName;
|
|
128
|
+
if (updates.labels !== undefined)
|
|
129
|
+
metadataUpdates.labels = updates.labels;
|
|
130
|
+
if (updates.size !== undefined)
|
|
131
|
+
specUpdates.size = updates.size;
|
|
132
|
+
if (updates.region !== undefined)
|
|
133
|
+
specUpdates.region = updates.region;
|
|
134
|
+
}
|
|
135
|
+
const body = {
|
|
136
|
+
metadata: {
|
|
137
|
+
...drive.metadata,
|
|
138
|
+
...metadataUpdates,
|
|
139
|
+
},
|
|
140
|
+
spec: {
|
|
141
|
+
...drive.spec,
|
|
142
|
+
...specUpdates,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
const { data } = await (0, index_js_1.updateDrive)({
|
|
146
|
+
path: { driveName },
|
|
147
|
+
body,
|
|
148
|
+
throwOnError: true,
|
|
149
|
+
});
|
|
150
|
+
const newDrive = {
|
|
151
|
+
metadata: data.metadata,
|
|
152
|
+
spec: data.spec,
|
|
153
|
+
events: data.events,
|
|
154
|
+
state: data.state,
|
|
155
|
+
status: data.status,
|
|
156
|
+
};
|
|
157
|
+
// This is for safe update
|
|
158
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
159
|
+
return new DriveInstance(newDrive);
|
|
160
|
+
}
|
|
161
|
+
async update(updates) {
|
|
162
|
+
const updated = await DriveInstance.update(this.metadata.name, updates);
|
|
163
|
+
return updated;
|
|
164
|
+
}
|
|
165
|
+
static async createIfNotExists(config) {
|
|
166
|
+
try {
|
|
167
|
+
return await DriveInstance.create(config);
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
if (typeof e === "object" && e !== null && "code" in e && (e.code === 409 || e.code === 'DRIVE_ALREADY_EXISTS')) {
|
|
171
|
+
const name = 'name' in config ? config.name : config.metadata.name;
|
|
172
|
+
if (!name) {
|
|
173
|
+
throw new Error("Drive name is required");
|
|
174
|
+
}
|
|
175
|
+
const driveInstance = await DriveInstance.get(name);
|
|
176
|
+
return driveInstance;
|
|
177
|
+
}
|
|
178
|
+
throw e;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.DriveInstance = DriveInstance;
|
|
@@ -25,6 +25,7 @@ __exportStar(require("./common/internal.js"), exports);
|
|
|
25
25
|
__exportStar(require("./common/logger.js"), exports);
|
|
26
26
|
__exportStar(require("./common/settings.js"), exports);
|
|
27
27
|
__exportStar(require("./common/webhook.js"), exports);
|
|
28
|
+
__exportStar(require("./drive/index.js"), exports);
|
|
28
29
|
__exportStar(require("./image/index.js"), exports);
|
|
29
30
|
__exportStar(require("./jobs/index.js"), exports);
|
|
30
31
|
__exportStar(require("./mcp/index.js"), exports);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxDrive = void 0;
|
|
4
|
+
const settings_js_1 = require("../../common/settings.js");
|
|
5
|
+
const action_js_1 = require("../action.js");
|
|
6
|
+
class SandboxDrive extends action_js_1.SandboxAction {
|
|
7
|
+
constructor(sandbox) {
|
|
8
|
+
super(sandbox);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Mount a drive to the sandbox at a specific mount path
|
|
12
|
+
*/
|
|
13
|
+
async mount(request) {
|
|
14
|
+
const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings_js_1.settings.headers;
|
|
15
|
+
const body = {
|
|
16
|
+
driveName: request.driveName,
|
|
17
|
+
mountPath: request.mountPath,
|
|
18
|
+
drivePath: request.drivePath || "/",
|
|
19
|
+
};
|
|
20
|
+
const response = await fetch(`${this.url}/drives/mount`, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
headers: {
|
|
23
|
+
...headers,
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
body: JSON.stringify(body),
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
const errorText = await response.text();
|
|
30
|
+
throw new Error(`Failed to mount drive: ${errorText}`);
|
|
31
|
+
}
|
|
32
|
+
return await response.json();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Unmount a drive from the sandbox by mount path
|
|
36
|
+
*/
|
|
37
|
+
async unmount(mountPath) {
|
|
38
|
+
const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings_js_1.settings.headers;
|
|
39
|
+
// Ensure mountPath starts with /
|
|
40
|
+
const normalizedPath = mountPath.startsWith('/') ? mountPath : `/${mountPath}`;
|
|
41
|
+
// Remove leading slash for URL (DELETE /drives/mnt/test not /drives//mnt/test)
|
|
42
|
+
const urlPath = normalizedPath.substring(1);
|
|
43
|
+
const response = await fetch(`${this.url}/drives/mount/${urlPath}`, {
|
|
44
|
+
method: 'DELETE',
|
|
45
|
+
headers,
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const errorText = await response.text();
|
|
49
|
+
throw new Error(`Failed to unmount drive: ${errorText}`);
|
|
50
|
+
}
|
|
51
|
+
return await response.json();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* List all mounted drives in the sandbox
|
|
55
|
+
*/
|
|
56
|
+
async list() {
|
|
57
|
+
const headers = this.sandbox.forceUrl ? this.sandbox.headers : settings_js_1.settings.headers;
|
|
58
|
+
const response = await fetch(`${this.url}/drives/mount`, {
|
|
59
|
+
method: 'GET',
|
|
60
|
+
headers,
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
const errorText = await response.text();
|
|
64
|
+
throw new Error(`Failed to list drives: ${errorText}`);
|
|
65
|
+
}
|
|
66
|
+
const data = await response.json();
|
|
67
|
+
return data.mounts || [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.SandboxDrive = SandboxDrive;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./drive.js"), exports);
|
|
@@ -6,10 +6,11 @@ const index_js_1 = require("../client/index.js");
|
|
|
6
6
|
const logger_js_1 = require("../common/logger.js");
|
|
7
7
|
const settings_js_1 = require("../common/settings.js");
|
|
8
8
|
const index_js_2 = require("./codegen/index.js");
|
|
9
|
-
const index_js_3 = require("./
|
|
10
|
-
const index_js_4 = require("./
|
|
9
|
+
const index_js_3 = require("./drive/index.js");
|
|
10
|
+
const index_js_4 = require("./filesystem/index.js");
|
|
11
|
+
const index_js_5 = require("./network/index.js");
|
|
11
12
|
const preview_js_1 = require("./preview.js");
|
|
12
|
-
const
|
|
13
|
+
const index_js_6 = require("./process/index.js");
|
|
13
14
|
const session_js_1 = require("./session.js");
|
|
14
15
|
const system_js_1 = require("./system.js");
|
|
15
16
|
const types_js_1 = require("./types.js");
|
|
@@ -22,15 +23,17 @@ class SandboxInstance {
|
|
|
22
23
|
sessions;
|
|
23
24
|
codegen;
|
|
24
25
|
system;
|
|
26
|
+
drives;
|
|
25
27
|
constructor(sandbox) {
|
|
26
28
|
this.sandbox = sandbox;
|
|
27
|
-
this.process = new
|
|
28
|
-
this.fs = new
|
|
29
|
-
this.network = new
|
|
29
|
+
this.process = new index_js_6.SandboxProcess(sandbox);
|
|
30
|
+
this.fs = new index_js_4.SandboxFileSystem(sandbox, this.process);
|
|
31
|
+
this.network = new index_js_5.SandboxNetwork(sandbox);
|
|
30
32
|
this.previews = new preview_js_1.SandboxPreviews(sandbox);
|
|
31
33
|
this.sessions = new session_js_1.SandboxSessions(sandbox);
|
|
32
34
|
this.codegen = new index_js_2.SandboxCodegen(sandbox);
|
|
33
35
|
this.system = new system_js_1.SandboxSystem(sandbox);
|
|
36
|
+
this.drives = new index_js_3.SandboxDrive(sandbox);
|
|
34
37
|
}
|
|
35
38
|
get metadata() {
|
|
36
39
|
return this.sandbox.metadata;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListAllEgressGatewaysData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, DeleteImageData, GetImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, DeclineWorkspaceInvitationData, AcceptWorkspaceInvitationData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
2
|
+
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListDrivesData, CreateDriveData, DeleteDriveData, GetDriveData, UpdateDriveData, CreateDriveAccessTokenData, GetDriveJwksData, ListAllEgressGatewaysData, ListAllEgressIpsData, GetWorkspaceFeaturesData, TestFeatureFlagData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, DeleteImageData, GetImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, UpdateVolumeData, ListVpcsData, CreateVpcData, DeleteVpcData, GetVpcData, ListEgressGatewaysData, CreateEgressGatewayData, DeleteEgressGatewayData, GetEgressGatewayData, ListEgressIpsData, CreateEgressIpData, DeleteEgressIpData, GetEgressIpData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, DeclineWorkspaceInvitationData, AcceptWorkspaceInvitationData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -73,6 +73,52 @@ export declare const updateCustomDomain: <ThrowOnError extends boolean = false>(
|
|
|
73
73
|
* Verify custom domain
|
|
74
74
|
*/
|
|
75
75
|
export declare const verifyCustomDomain: <ThrowOnError extends boolean = false>(options: Options<VerifyCustomDomainData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").CustomDomain, unknown, ThrowOnError>;
|
|
76
|
+
/**
|
|
77
|
+
* List drives
|
|
78
|
+
* Returns all drives in the workspace. Drives provide persistent storage that can be attached to agents, functions, and sandboxes.
|
|
79
|
+
*/
|
|
80
|
+
export declare const listDrives: <ThrowOnError extends boolean = false>(options?: Options<ListDrivesData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Drive[], unknown, ThrowOnError>;
|
|
81
|
+
/**
|
|
82
|
+
* Create a drive
|
|
83
|
+
* Creates a new drive in the workspace. Drives are backed by SeaweedFS buckets and can be mounted at runtime to sandboxes.
|
|
84
|
+
*/
|
|
85
|
+
export declare const createDrive: <ThrowOnError extends boolean = false>(options: Options<CreateDriveData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Drive, unknown, ThrowOnError>;
|
|
86
|
+
/**
|
|
87
|
+
* Delete a drive
|
|
88
|
+
* Deletes a drive immediately. The drive record is removed from the database synchronously.
|
|
89
|
+
*/
|
|
90
|
+
export declare const deleteDrive: <ThrowOnError extends boolean = false>(options: Options<DeleteDriveData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
|
|
91
|
+
message?: string;
|
|
92
|
+
name?: string;
|
|
93
|
+
}, unknown, ThrowOnError>;
|
|
94
|
+
/**
|
|
95
|
+
* Get a drive
|
|
96
|
+
* Retrieves details of a specific drive including its status and events.
|
|
97
|
+
*/
|
|
98
|
+
export declare const getDrive: <ThrowOnError extends boolean = false>(options: Options<GetDriveData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Drive, unknown, ThrowOnError>;
|
|
99
|
+
/**
|
|
100
|
+
* Update a drive
|
|
101
|
+
* Updates an existing drive. Metadata fields like displayName and labels can be changed. Size can be set if not already configured.
|
|
102
|
+
*/
|
|
103
|
+
export declare const updateDrive: <ThrowOnError extends boolean = false>(options: Options<UpdateDriveData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").Drive, unknown, ThrowOnError>;
|
|
104
|
+
/**
|
|
105
|
+
* Create drive access token
|
|
106
|
+
* Issues a short-lived JWT access token scoped to a specific drive. The token can be used as Bearer authentication for direct S3 operations against the drive's SeaweedFS bucket.
|
|
107
|
+
*/
|
|
108
|
+
export declare const createDriveAccessToken: <ThrowOnError extends boolean = false>(options: Options<CreateDriveAccessTokenData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
|
|
109
|
+
access_token?: string;
|
|
110
|
+
expires_in?: number;
|
|
111
|
+
token_type?: string;
|
|
112
|
+
}, unknown, ThrowOnError>;
|
|
113
|
+
/**
|
|
114
|
+
* Get drive token JWKS
|
|
115
|
+
* Returns the JSON Web Key Set containing the Ed25519 public key used to verify drive access tokens. SeaweedFS or other S3-compatible storage can use this endpoint to validate Bearer tokens.
|
|
116
|
+
*/
|
|
117
|
+
export declare const getDriveJwks: <ThrowOnError extends boolean = false>(options?: Options<GetDriveJwksData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
|
|
118
|
+
keys?: Array<{
|
|
119
|
+
[key: string]: unknown;
|
|
120
|
+
}>;
|
|
121
|
+
}, unknown, ThrowOnError>;
|
|
76
122
|
/**
|
|
77
123
|
* List all egress gateways across all VPCs in the workspace
|
|
78
124
|
*/
|