@miosa/sdk 3.0.2 → 3.1.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.
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/package.json +12 -13
package/dist/index.js
CHANGED
|
@@ -168,7 +168,7 @@ var TokenRefreshFailedError = class extends MiosaError {
|
|
|
168
168
|
};
|
|
169
169
|
|
|
170
170
|
// src/version.ts
|
|
171
|
-
var SDK_VERSION = "
|
|
171
|
+
var SDK_VERSION = "3.1.0";
|
|
172
172
|
var SDK_USER_AGENT = `@miosa/sdk/${SDK_VERSION}`;
|
|
173
173
|
|
|
174
174
|
// src/http.ts
|
|
@@ -8510,9 +8510,10 @@ function createBody(params = {}) {
|
|
|
8510
8510
|
if (legacyPersistencePolicy) metadata.miosa_persistent = persistent;
|
|
8511
8511
|
const cpuCount = params.cpuCount ?? params.cpu_count;
|
|
8512
8512
|
const memoryMb = params.memoryMb ?? params.memory_mb;
|
|
8513
|
+
const diskSizeMb = params.diskSizeMb ?? params.disk_size_mb;
|
|
8513
8514
|
const resolvedSize = params.size;
|
|
8514
8515
|
if (cpuCount !== void 0 || memoryMb !== void 0) {
|
|
8515
|
-
|
|
8516
|
+
resolveRawShape(cpuCount, memoryMb, diskSizeMb, resolvedSize);
|
|
8516
8517
|
}
|
|
8517
8518
|
if (snapshotExpirationSec !== void 0) {
|
|
8518
8519
|
metadata.snapshot_expiration_sec = snapshotExpirationSec;
|
|
@@ -8527,7 +8528,7 @@ function createBody(params = {}) {
|
|
|
8527
8528
|
cpu_count: cpuCount,
|
|
8528
8529
|
memory_mb: memoryMb,
|
|
8529
8530
|
disk_mb: params.diskMb ?? params.disk_mb,
|
|
8530
|
-
disk_size_mb:
|
|
8531
|
+
disk_size_mb: diskSizeMb,
|
|
8531
8532
|
timeout_sec: params.timeoutSec ?? params.timeout_sec ?? (legacyPersistencePolicy && persistent === true ? 86400 : void 0),
|
|
8532
8533
|
idle_timeout_sec: params.idleTimeoutSec ?? params.idle_timeout_sec ?? (legacyPersistencePolicy && persistent === true ? 1800 : void 0),
|
|
8533
8534
|
always_on: params.alwaysOn ?? params.always_on,
|
|
@@ -8558,17 +8559,27 @@ function createBody(params = {}) {
|
|
|
8558
8559
|
external_project_id: params.externalProjectId ?? params.external_project_id
|
|
8559
8560
|
});
|
|
8560
8561
|
}
|
|
8561
|
-
function
|
|
8562
|
+
function resolveRawShape(cpuCount, memoryMb, diskSizeMb, requestedSize) {
|
|
8562
8563
|
const tier = cpuCount === void 0 ? void 0 : SANDBOX_TIER_BY_CPU[cpuCount];
|
|
8563
|
-
|
|
8564
|
+
const matchedSize = tier && tier.memoryMb === memoryMb ? tier.size : void 0;
|
|
8565
|
+
if (matchedSize === void 0 && (cpuCount === void 0 || memoryMb === void 0 || diskSizeMb === void 0)) {
|
|
8566
|
+
raiseUnresolvableShape(cpuCount, memoryMb, tier);
|
|
8567
|
+
}
|
|
8568
|
+
if (requestedSize !== void 0 && requestedSize !== matchedSize) {
|
|
8569
|
+
throw new TypeError(
|
|
8570
|
+
`Raw sandbox resources (${cpuCount} vCPU / ${memoryMb} MiB) do not match requested size "${requestedSize}".`
|
|
8571
|
+
);
|
|
8572
|
+
}
|
|
8573
|
+
}
|
|
8574
|
+
function raiseUnresolvableShape(cpuCount, memoryMb, tier) {
|
|
8564
8575
|
const supplied = `${cpuCount ?? "?"} vCPU / ${memoryMb ?? "?"} MiB`;
|
|
8565
8576
|
if (tier) {
|
|
8566
8577
|
throw new TypeError(
|
|
8567
|
-
`Unsupported cpu/memory combination (${supplied}); nearest
|
|
8578
|
+
`Unsupported cpu/memory combination (${supplied}); nearest published tier is ${tier.size} (${cpuCount} vCPU / ${tier.memoryMb} MiB). Pass size: "${tier.size}" or memoryMb: ${tier.memoryMb}, or supply cpuCount, memoryMb, and diskSizeMb together for a custom shape.`
|
|
8568
8579
|
);
|
|
8569
8580
|
}
|
|
8570
8581
|
throw new TypeError(
|
|
8571
|
-
`Unsupported cpu/memory combination (${supplied}). Supported tiers: xs (1/2048), small (2/4096), medium (4/8192), large (8/16384), xl (16/32768). Pass a matching cpuCount + memoryMb (any diskSizeMb is allowed) or
|
|
8582
|
+
`Unsupported cpu/memory combination (${supplied}). Supported tiers: xs (1/2048), small (2/4096), medium (4/8192), large (8/16384), xl (16/32768). Pass a matching cpuCount + memoryMb (any diskSizeMb is allowed), use size, or supply cpuCount, memoryMb, and diskSizeMb together for a custom shape.`
|
|
8572
8583
|
);
|
|
8573
8584
|
}
|
|
8574
8585
|
function execBody(command, options = {}) {
|