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