runcloud 0.1.22 → 0.1.23
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/commands/sandbox.js +4 -6
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/sandbox.js
CHANGED
|
@@ -167,11 +167,13 @@ function parseMetricInterval(value) {
|
|
|
167
167
|
function formatMetricBytes(value) {
|
|
168
168
|
if (!Number.isFinite(value) || value <= 0)
|
|
169
169
|
return '0 B';
|
|
170
|
-
const unit = Math.min(Math.floor(Math.log(value) / Math.log(1024)), BYTE_UNITS.length - 1);
|
|
170
|
+
const unit = Math.max(0, Math.min(Math.floor(Math.log(value) / Math.log(1024)), BYTE_UNITS.length - 1));
|
|
171
171
|
const amount = value / 1024 ** unit;
|
|
172
172
|
return `${amount.toFixed(amount >= 10 || unit === 0 ? 0 : 1)} ${BYTE_UNITS[unit]}`;
|
|
173
173
|
}
|
|
174
174
|
function formatMetricCpu(millicores) {
|
|
175
|
+
if (!Number.isFinite(millicores) || millicores <= 0)
|
|
176
|
+
return '0m';
|
|
175
177
|
return millicores >= 1000
|
|
176
178
|
? `${(millicores / 1000).toFixed(2).replace(/\.?0+$/, '')} cores`
|
|
177
179
|
: `${Math.round(millicores)}m`;
|
|
@@ -361,11 +363,7 @@ export function registerSandbox(program) {
|
|
|
361
363
|
const api = runCloudApi();
|
|
362
364
|
const [data, boxes] = await Promise.all([
|
|
363
365
|
api.get(`/run-cloud/sandboxes${qs}`),
|
|
364
|
-
api.get('/run-cloud/boxes').catch((
|
|
365
|
-
if (err instanceof ApiError && err.status === 404)
|
|
366
|
-
return { items: [] };
|
|
367
|
-
throw err;
|
|
368
|
-
}),
|
|
366
|
+
api.get('/run-cloud/boxes').catch(() => ({ items: [] })),
|
|
369
367
|
]);
|
|
370
368
|
const bySandbox = new Map((boxes?.items ?? []).map((box) => [box.sandboxId, box]));
|
|
371
369
|
const items = (data?.items ?? []).map((item) => {
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.1.
|
|
1
|
+
export const CLI_VERSION = '0.1.23';
|