@sistemo/sdk 0.1.0 → 0.1.1
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 +14 -3
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,18 @@ Requires Node 18+ (uses the global `fetch`). Zero runtime dependencies.
|
|
|
10
10
|
|
|
11
11
|
## Quickstart (< 10 lines)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
First, get an API key from the dashboard (**Dashboard → API Keys**) and export it:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
export SISTEMO_API_KEY=sk_live_xxxxxxxx
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then save this as `hello.mjs` — it is a source file, not something to paste at a shell
|
|
20
|
+
prompt. The `.mjs` extension matters: the snippet uses `import` and top-level
|
|
21
|
+
`await`, so a plain `.js` file needs `"type": "module"` in your `package.json`.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
// hello.mjs
|
|
14
25
|
import { Sandbox } from "@sistemo/sdk";
|
|
15
26
|
|
|
16
27
|
const sb = await Sandbox.create(); // reads SISTEMO_API_KEY
|
|
@@ -19,10 +30,10 @@ console.log(res.stdout, res.exitCode); // "4\n" 0
|
|
|
19
30
|
await sb.close();
|
|
20
31
|
```
|
|
21
32
|
|
|
22
|
-
|
|
33
|
+
Then run it:
|
|
23
34
|
|
|
24
35
|
```bash
|
|
25
|
-
|
|
36
|
+
node hello.mjs
|
|
26
37
|
```
|
|
27
38
|
|
|
28
39
|
## Configuration
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const DEFAULT_BASE_URL = "https://api.sistemo.io";
|
|
|
15
15
|
// User-Agent is required: the production WAF (Cloudflare) blocks generic
|
|
16
16
|
// library UAs with a 403. Browsers ignore attempts to set User-Agent and send
|
|
17
17
|
// their own (which the WAF allows), so this is a no-op there.
|
|
18
|
-
const USER_AGENT = "@sistemo/sdk/0.1.
|
|
18
|
+
const USER_AGENT = "@sistemo/sdk/0.1.1";
|
|
19
19
|
const RETRY_STATUSES = new Set([408, 429, 500, 502, 503, 504]);
|
|
20
20
|
export class SistemoError extends Error {
|
|
21
21
|
}
|