ppio-sandbox 2.0.2-a1 → 2.0.4-a1
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/{chunk-V2Q62RZL.mjs → chunk-E4DEQD23.mjs} +29 -26
- package/dist/chunk-E4DEQD23.mjs.map +1 -0
- package/dist/code-interpreter.d.mts +2 -2
- package/dist/code-interpreter.d.ts +2 -2
- package/dist/code-interpreter.js +28 -25
- package/dist/code-interpreter.js.map +1 -1
- package/dist/code-interpreter.mjs +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/desktop.js +28 -25
- package/dist/desktop.js.map +1 -1
- package/dist/desktop.mjs +1 -1
- package/dist/{index-COUoJrLZ.d.mts → index-PaKQyDnI.d.mts} +0 -4
- package/dist/{index-COUoJrLZ.d.ts → index-PaKQyDnI.d.ts} +0 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-V2Q62RZL.mjs.map +0 -1
|
@@ -60,7 +60,7 @@ import createClient from "openapi-fetch";
|
|
|
60
60
|
import platform2 from "platform";
|
|
61
61
|
|
|
62
62
|
// package.json
|
|
63
|
-
var version = "2.0.
|
|
63
|
+
var version = "2.0.4-a1";
|
|
64
64
|
|
|
65
65
|
// src/core/utils.ts
|
|
66
66
|
import platform from "platform";
|
|
@@ -393,10 +393,14 @@ var ApiClient = class {
|
|
|
393
393
|
|
|
394
394
|
// src/core/connectionConfig.ts
|
|
395
395
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
396
|
+
var LEGACY_REQUEST_TIMEOUT_MS = 18e5;
|
|
396
397
|
var DEFAULT_SANDBOX_TIMEOUT_MS = 3e5;
|
|
397
398
|
var KEEPALIVE_PING_INTERVAL_SEC = 50;
|
|
398
399
|
var KEEPALIVE_PING_HEADER = "Keepalive-Ping-Interval";
|
|
399
|
-
var LEGACY_DOMAINS = [
|
|
400
|
+
var LEGACY_DOMAINS = [
|
|
401
|
+
"sandbox.ppio.cn",
|
|
402
|
+
"sandbox-test.ppio.cn"
|
|
403
|
+
];
|
|
400
404
|
function isLegacyDomain(domain) {
|
|
401
405
|
return domain ? LEGACY_DOMAINS.includes(domain) : true;
|
|
402
406
|
}
|
|
@@ -418,7 +422,7 @@ var _ConnectionConfig = class _ConnectionConfig {
|
|
|
418
422
|
this.domain = (opts == null ? void 0 : opts.domain) || _ConnectionConfig.domain;
|
|
419
423
|
this.isLegacyDomain = isLegacyDomain(this.domain);
|
|
420
424
|
this.accessToken = (opts == null ? void 0 : opts.accessToken) || _ConnectionConfig.accessToken;
|
|
421
|
-
this.requestTimeoutMs = (_a3 = opts == null ? void 0 : opts.requestTimeoutMs) != null ? _a3 : REQUEST_TIMEOUT_MS;
|
|
425
|
+
this.requestTimeoutMs = (_a3 = opts == null ? void 0 : opts.requestTimeoutMs) != null ? _a3 : this.isLegacyDomain ? LEGACY_REQUEST_TIMEOUT_MS : REQUEST_TIMEOUT_MS;
|
|
422
426
|
this.logger = opts == null ? void 0 : opts.logger;
|
|
423
427
|
this.headers = (opts == null ? void 0 : opts.headers) || {};
|
|
424
428
|
this.headers["User-Agent"] = `ppio-sandbox-sdk-js/${version}`;
|
|
@@ -2342,6 +2346,9 @@ var Git = class {
|
|
|
2342
2346
|
};
|
|
2343
2347
|
|
|
2344
2348
|
// src/core/volume/index.ts
|
|
2349
|
+
function quotaInodesForSize(quotaSizeGiB) {
|
|
2350
|
+
return quotaSizeGiB * 1e3;
|
|
2351
|
+
}
|
|
2345
2352
|
var Volume = class _Volume {
|
|
2346
2353
|
/**
|
|
2347
2354
|
* Create a local Volume instance with no API call.
|
|
@@ -2368,7 +2375,6 @@ var Volume = class _Volume {
|
|
|
2368
2375
|
* @param name name of the volume.
|
|
2369
2376
|
* @param opts connection options.
|
|
2370
2377
|
* @param [opts.quotaSizeGiB] capacity quota in GiB.
|
|
2371
|
-
* @param [opts.quotaInodes] inode quota.
|
|
2372
2378
|
*
|
|
2373
2379
|
* @returns new Volume instance.
|
|
2374
2380
|
*/
|
|
@@ -2376,12 +2382,13 @@ var Volume = class _Volume {
|
|
|
2376
2382
|
const config = new ConnectionConfig(opts);
|
|
2377
2383
|
raiseIfLegacy(config, "Volume.create", VolumeError);
|
|
2378
2384
|
const client = new ApiClient(config);
|
|
2385
|
+
const body = { name };
|
|
2386
|
+
if ((opts == null ? void 0 : opts.quotaSizeGiB) !== void 0) {
|
|
2387
|
+
body.quotaSizeGiB = opts.quotaSizeGiB;
|
|
2388
|
+
body.quotaInodes = quotaInodesForSize(opts.quotaSizeGiB);
|
|
2389
|
+
}
|
|
2379
2390
|
const res = await client.api.POST("/volumes", {
|
|
2380
|
-
body
|
|
2381
|
-
name,
|
|
2382
|
-
quotaSizeGiB: opts == null ? void 0 : opts.quotaSizeGiB,
|
|
2383
|
-
quotaInodes: opts == null ? void 0 : opts.quotaInodes
|
|
2384
|
-
},
|
|
2391
|
+
body,
|
|
2385
2392
|
signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
2386
2393
|
});
|
|
2387
2394
|
const err = handleApiError(res, VolumeError);
|
|
@@ -2422,7 +2429,7 @@ var Volume = class _Volume {
|
|
|
2422
2429
|
* @returns volume information.
|
|
2423
2430
|
*/
|
|
2424
2431
|
static async getInfo(volumeId, opts) {
|
|
2425
|
-
var _a3, _b
|
|
2432
|
+
var _a3, _b;
|
|
2426
2433
|
const config = new ConnectionConfig(opts);
|
|
2427
2434
|
raiseIfLegacy(config, "Volume.getInfo", VolumeError);
|
|
2428
2435
|
const client = new ApiClient(config);
|
|
@@ -2447,9 +2454,7 @@ var Volume = class _Volume {
|
|
|
2447
2454
|
name: data.name,
|
|
2448
2455
|
token: data.token,
|
|
2449
2456
|
quotaSizeGiB: (_a3 = data.quotaSizeGiB) != null ? _a3 : 0,
|
|
2450
|
-
|
|
2451
|
-
usedSizeBytes: (_c = data.usedSizeBytes) != null ? _c : 0,
|
|
2452
|
-
usedInodes: (_d = data.usedInodes) != null ? _d : 0
|
|
2457
|
+
usedSizeBytes: (_b = data.usedSizeBytes) != null ? _b : 0
|
|
2453
2458
|
};
|
|
2454
2459
|
}
|
|
2455
2460
|
/**
|
|
@@ -2472,14 +2477,12 @@ var Volume = class _Volume {
|
|
|
2472
2477
|
throw err;
|
|
2473
2478
|
}
|
|
2474
2479
|
return ((_a3 = res.data) != null ? _a3 : []).map((vol) => {
|
|
2475
|
-
var _a4, _b
|
|
2480
|
+
var _a4, _b;
|
|
2476
2481
|
return {
|
|
2477
2482
|
volumeId: vol.volumeID,
|
|
2478
2483
|
name: vol.name,
|
|
2479
2484
|
quotaSizeGiB: (_a4 = vol.quotaSizeGiB) != null ? _a4 : 0,
|
|
2480
|
-
|
|
2481
|
-
usedSizeBytes: (_c = vol.usedSizeBytes) != null ? _c : 0,
|
|
2482
|
-
usedInodes: (_d = vol.usedInodes) != null ? _d : 0
|
|
2485
|
+
usedSizeBytes: (_b = vol.usedSizeBytes) != null ? _b : 0
|
|
2483
2486
|
};
|
|
2484
2487
|
});
|
|
2485
2488
|
}
|
|
@@ -2493,9 +2496,14 @@ var Volume = class _Volume {
|
|
|
2493
2496
|
* @returns updated volume information.
|
|
2494
2497
|
*/
|
|
2495
2498
|
static async updateQuota(volumeId, params, opts) {
|
|
2496
|
-
var _a3, _b
|
|
2499
|
+
var _a3, _b;
|
|
2497
2500
|
const config = new ConnectionConfig(opts);
|
|
2498
2501
|
raiseIfLegacy(config, "Volume.updateQuota", VolumeError);
|
|
2502
|
+
const body = {};
|
|
2503
|
+
if (params.quotaSizeGiB !== void 0) {
|
|
2504
|
+
body.quotaSizeGiB = params.quotaSizeGiB;
|
|
2505
|
+
body.quotaInodes = quotaInodesForSize(params.quotaSizeGiB);
|
|
2506
|
+
}
|
|
2499
2507
|
const res = await fetch(
|
|
2500
2508
|
`${config.apiUrl}/volumes/${encodeURIComponent(volumeId)}`,
|
|
2501
2509
|
{
|
|
@@ -2503,10 +2511,7 @@ var Volume = class _Volume {
|
|
|
2503
2511
|
headers: __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, config.headers), {
|
|
2504
2512
|
"Content-Type": "application/json"
|
|
2505
2513
|
}), config.apiKey ? { "X-API-KEY": config.apiKey } : {}), config.accessToken ? { Authorization: `Bearer ${config.accessToken}` } : {}),
|
|
2506
|
-
body: JSON.stringify(
|
|
2507
|
-
quotaSizeGiB: params.quotaSizeGiB,
|
|
2508
|
-
quotaInodes: params.quotaInodes
|
|
2509
|
-
}),
|
|
2514
|
+
body: JSON.stringify(body),
|
|
2510
2515
|
signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
2511
2516
|
}
|
|
2512
2517
|
);
|
|
@@ -2522,9 +2527,7 @@ var Volume = class _Volume {
|
|
|
2522
2527
|
name: data.name,
|
|
2523
2528
|
token: data.token,
|
|
2524
2529
|
quotaSizeGiB: (_a3 = data.quotaSizeGiB) != null ? _a3 : 0,
|
|
2525
|
-
|
|
2526
|
-
usedSizeBytes: (_c = data.usedSizeBytes) != null ? _c : 0,
|
|
2527
|
-
usedInodes: (_d = data.usedInodes) != null ? _d : 0
|
|
2530
|
+
usedSizeBytes: (_b = data.usedSizeBytes) != null ? _b : 0
|
|
2528
2531
|
};
|
|
2529
2532
|
}
|
|
2530
2533
|
/**
|
|
@@ -6849,4 +6852,4 @@ export {
|
|
|
6849
6852
|
Template,
|
|
6850
6853
|
core_default
|
|
6851
6854
|
};
|
|
6852
|
-
//# sourceMappingURL=chunk-
|
|
6855
|
+
//# sourceMappingURL=chunk-E4DEQD23.mjs.map
|