@computesdk/vercel 1.7.43 → 1.7.44
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/README.md +9 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ const compute = vercel({
|
|
|
47
47
|
timeout: 600000 // 10 minutes
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
const sandbox = await compute.
|
|
50
|
+
const sandbox = await compute.instances.create();
|
|
51
51
|
|
|
52
52
|
const result = await sandbox.runCommand('node -e "console.log(\"Hello from Vercel!\")"');
|
|
53
53
|
console.log(result.stdout);
|
|
@@ -158,10 +158,10 @@ const info = await sandbox.getInfo();
|
|
|
158
158
|
console.log(info.id, info.provider, info.status);
|
|
159
159
|
|
|
160
160
|
// Get existing sandbox
|
|
161
|
-
const existing = await compute.
|
|
161
|
+
const existing = await compute.instances.getById('sandbox-id');
|
|
162
162
|
|
|
163
163
|
// Destroy sandbox
|
|
164
|
-
await compute.
|
|
164
|
+
await compute.instances.destroy('sandbox-id');
|
|
165
165
|
|
|
166
166
|
// Note: Vercel doesn't support listing all sandboxes
|
|
167
167
|
// Each sandbox is ephemeral and single-use
|
|
@@ -172,7 +172,7 @@ await compute.sandbox.destroy('sandbox-id');
|
|
|
172
172
|
Sandboxes are created with `persistent: false` by default — a persistent sandbox auto-snapshots its filesystem on every `stop()`, which accrues Vercel Snapshot Storage charges. To opt in to persistence (required if you plan to resume or snapshot the sandbox later), pass `persistent: true` (or the shared `ephemeral: false` durable-sandbox selector) at create time:
|
|
173
173
|
|
|
174
174
|
```typescript
|
|
175
|
-
const sandbox = await compute.
|
|
175
|
+
const sandbox = await compute.instances.create({ persistent: true });
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
## Error Handling
|
|
@@ -186,7 +186,7 @@ try {
|
|
|
186
186
|
teamId: process.env.VERCEL_TEAM_ID,
|
|
187
187
|
projectId: process.env.VERCEL_PROJECT_ID
|
|
188
188
|
});
|
|
189
|
-
const sandbox = await compute.
|
|
189
|
+
const sandbox = await compute.instances.create();
|
|
190
190
|
|
|
191
191
|
const result = await sandbox.runCommand('invalid code');
|
|
192
192
|
} catch (error) {
|
|
@@ -210,7 +210,7 @@ try {
|
|
|
210
210
|
import { vercel } from '@computesdk/vercel';
|
|
211
211
|
|
|
212
212
|
const compute = vercel({});
|
|
213
|
-
const sandbox = await compute.
|
|
213
|
+
const sandbox = await compute.instances.create();
|
|
214
214
|
|
|
215
215
|
const result = await sandbox.runCommand(`node - <<'JS'
|
|
216
216
|
const http = require('http');
|
|
@@ -247,7 +247,7 @@ await sandbox.destroy();
|
|
|
247
247
|
import { vercel } from '@computesdk/vercel';
|
|
248
248
|
|
|
249
249
|
const compute = vercel({});
|
|
250
|
-
const sandbox = await compute.
|
|
250
|
+
const sandbox = await compute.instances.create();
|
|
251
251
|
|
|
252
252
|
const result = await sandbox.runCommand(`python - <<'PY'
|
|
253
253
|
import json
|
|
@@ -292,7 +292,7 @@ await sandbox.destroy();
|
|
|
292
292
|
import { vercel } from '@computesdk/vercel';
|
|
293
293
|
|
|
294
294
|
const compute = vercel({});
|
|
295
|
-
const sandbox = await compute.
|
|
295
|
+
const sandbox = await compute.instances.create();
|
|
296
296
|
|
|
297
297
|
// Create project structure
|
|
298
298
|
await sandbox.filesystem.mkdir('/tmp/project');
|
|
@@ -406,7 +406,7 @@ await sandbox.destroy();
|
|
|
406
406
|
import { vercel } from '@computesdk/vercel';
|
|
407
407
|
|
|
408
408
|
const compute = vercel({});
|
|
409
|
-
const sandbox = await compute.
|
|
409
|
+
const sandbox = await compute.instances.create();
|
|
410
410
|
|
|
411
411
|
// Install lodash
|
|
412
412
|
const installResult = await sandbox.runCommand('npm install lodash');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@computesdk/vercel",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.44",
|
|
4
4
|
"description": "Vercel Sandbox provider for ComputeSDK - serverless code execution for Python and Node.js on Vercel's edge network",
|
|
5
5
|
"author": "Garrison",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@vercel/sandbox": "^3.0.0",
|
|
22
22
|
"ms": "^2.1.3",
|
|
23
|
-
"
|
|
24
|
-
"computesdk": "
|
|
23
|
+
"computesdk": "4.1.12",
|
|
24
|
+
"@computesdk/provider": "2.1.14"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"computesdk",
|