@computesdk/sandbox0 1.0.12 → 1.0.14
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _computesdk_provider from '@computesdk/provider';
|
|
2
|
+
import * as computesdk from 'computesdk';
|
|
2
3
|
import { Sandbox } from 'sandbox0';
|
|
3
4
|
export { Sandbox as Sandbox0Sandbox } from 'sandbox0';
|
|
4
5
|
|
|
@@ -22,6 +23,6 @@ interface Sandbox0Config {
|
|
|
22
23
|
/** Default command timeout in milliseconds. */
|
|
23
24
|
commandTimeout?: number;
|
|
24
25
|
}
|
|
25
|
-
declare const sandbox0: (config?: Sandbox0Config) => _computesdk_provider.Provider<Sandbox, any, any>;
|
|
26
|
+
declare const sandbox0: (config?: Sandbox0Config) => _computesdk_provider.Provider<Sandbox, any, any, computesdk.Volume>;
|
|
26
27
|
|
|
27
28
|
export { type Sandbox0Config, sandbox0 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _computesdk_provider from '@computesdk/provider';
|
|
2
|
+
import * as computesdk from 'computesdk';
|
|
2
3
|
import { Sandbox } from 'sandbox0';
|
|
3
4
|
export { Sandbox as Sandbox0Sandbox } from 'sandbox0';
|
|
4
5
|
|
|
@@ -22,6 +23,6 @@ interface Sandbox0Config {
|
|
|
22
23
|
/** Default command timeout in milliseconds. */
|
|
23
24
|
commandTimeout?: number;
|
|
24
25
|
}
|
|
25
|
-
declare const sandbox0: (config?: Sandbox0Config) => _computesdk_provider.Provider<Sandbox, any, any>;
|
|
26
|
+
declare const sandbox0: (config?: Sandbox0Config) => _computesdk_provider.Provider<Sandbox, any, any, computesdk.Volume>;
|
|
26
27
|
|
|
27
28
|
export { type Sandbox0Config, sandbox0 };
|
package/dist/index.js
CHANGED
|
@@ -22561,6 +22561,17 @@ function buildClaimOptions(config, options) {
|
|
|
22561
22561
|
const claimOptions = {
|
|
22562
22562
|
...Object.keys(sandboxConfig).length > 0 ? { config: sandboxConfig } : {},
|
|
22563
22563
|
...options?.snapshotId ? { snapshotId: options.snapshotId } : {},
|
|
22564
|
+
// Unified mounts → claim's [{sandboxvolumeId, mountPoint}] wire shape.
|
|
22565
|
+
...Array.isArray(options?.volumes) && options.volumes.length > 0 ? {
|
|
22566
|
+
mounts: options.volumes.map((m) => {
|
|
22567
|
+
const ref = (0, import_provider.resolveVolumeRef)(m.volume);
|
|
22568
|
+
const sandboxvolumeId = ref.id ?? ref.name;
|
|
22569
|
+
if (!sandboxvolumeId) {
|
|
22570
|
+
throw new Error("sandbox0 volume mount requires a volume id");
|
|
22571
|
+
}
|
|
22572
|
+
return { sandboxvolumeId, mountPoint: m.mountPath };
|
|
22573
|
+
})
|
|
22574
|
+
} : {},
|
|
22564
22575
|
...providerOptions?.memory !== void 0 || config.memory !== void 0 ? { memory: normalizeMemory(providerOptions?.memory ?? config.memory) } : {}
|
|
22565
22576
|
};
|
|
22566
22577
|
return Object.keys(claimOptions).length > 0 ? claimOptions : void 0;
|
|
@@ -22895,6 +22906,31 @@ var _provider = (0, import_provider.defineProvider)({
|
|
|
22895
22906
|
}
|
|
22896
22907
|
},
|
|
22897
22908
|
getInstance: (sandbox) => sandbox
|
|
22909
|
+
},
|
|
22910
|
+
volume: {
|
|
22911
|
+
create: async (config, options) => {
|
|
22912
|
+
const client = createClient(config);
|
|
22913
|
+
const volume = await client.volumes.create({ backend: "s0fs", accessMode: "RWO" });
|
|
22914
|
+
return { id: volume.id, native: volume };
|
|
22915
|
+
},
|
|
22916
|
+
get: async (config, id) => {
|
|
22917
|
+
const client = createClient(config);
|
|
22918
|
+
try {
|
|
22919
|
+
const volume = await client.volumes.get(id);
|
|
22920
|
+
return { id: volume.id, native: volume };
|
|
22921
|
+
} catch {
|
|
22922
|
+
return null;
|
|
22923
|
+
}
|
|
22924
|
+
},
|
|
22925
|
+
list: async (config) => {
|
|
22926
|
+
const client = createClient(config);
|
|
22927
|
+
const volumes = await client.volumes.list();
|
|
22928
|
+
return (volumes ?? []).map((v) => ({ id: v.id, native: v }));
|
|
22929
|
+
},
|
|
22930
|
+
delete: async (config, id) => {
|
|
22931
|
+
const client = createClient(config);
|
|
22932
|
+
await (0, import_provider.withVolumeSettle)(() => client.volumes.delete(id, { force: true }));
|
|
22933
|
+
}
|
|
22898
22934
|
}
|
|
22899
22935
|
}
|
|
22900
22936
|
});
|