oblien 2.2.37 → 2.2.39

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.
Files changed (54) hide show
  1. package/README.md +2 -0
  2. package/dist/cdn.d.ts +135 -0
  3. package/dist/cdn.d.ts.map +1 -0
  4. package/dist/cdn.js +251 -0
  5. package/dist/cdn.js.map +1 -0
  6. package/dist/cli/commands/cdn.d.ts +3 -0
  7. package/dist/cli/commands/cdn.d.ts.map +1 -0
  8. package/dist/cli/commands/cdn.js +216 -0
  9. package/dist/cli/commands/cdn.js.map +1 -0
  10. package/dist/cli/commands/serve.d.ts +17 -0
  11. package/dist/cli/commands/serve.d.ts.map +1 -0
  12. package/dist/cli/commands/serve.js +113 -0
  13. package/dist/cli/commands/serve.js.map +1 -0
  14. package/dist/cli/commands/tunnel.d.ts +1 -0
  15. package/dist/cli/commands/tunnel.d.ts.map +1 -1
  16. package/dist/cli/commands/tunnel.js +100 -3
  17. package/dist/cli/commands/tunnel.js.map +1 -1
  18. package/dist/cli/index.js +14 -0
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/client.d.ts +5 -0
  21. package/dist/client.d.ts.map +1 -1
  22. package/dist/client.js +7 -0
  23. package/dist/client.js.map +1 -1
  24. package/dist/index.d.ts +6 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +3 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/mcp/tools.d.ts.map +1 -1
  29. package/dist/mcp/tools.js +48 -0
  30. package/dist/mcp/tools.js.map +1 -1
  31. package/dist/runtime/proxy.d.ts +55 -0
  32. package/dist/runtime/proxy.d.ts.map +1 -0
  33. package/dist/runtime/proxy.js +79 -0
  34. package/dist/runtime/proxy.js.map +1 -0
  35. package/dist/runtime.d.ts +16 -0
  36. package/dist/runtime.d.ts.map +1 -1
  37. package/dist/runtime.js +18 -0
  38. package/dist/runtime.js.map +1 -1
  39. package/dist/server/static.d.ts +81 -0
  40. package/dist/server/static.d.ts.map +1 -0
  41. package/dist/server/static.js +465 -0
  42. package/dist/server/static.js.map +1 -0
  43. package/dist/types/cdn.d.ts +368 -0
  44. package/dist/types/cdn.d.ts.map +1 -0
  45. package/dist/types/cdn.js +10 -0
  46. package/dist/types/cdn.js.map +1 -0
  47. package/dist/types/client.d.ts +10 -0
  48. package/dist/types/client.d.ts.map +1 -1
  49. package/dist/types/index.d.ts +1 -0
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/docs/cdn.md +119 -0
  52. package/docs/runtime.md +30 -0
  53. package/docs/serve.md +84 -0
  54. package/package.json +1 -1
package/docs/serve.md ADDED
@@ -0,0 +1,84 @@
1
+ # Static server
2
+
3
+ Serve a folder over HTTP and put it on the public internet in one step. The
4
+ server is built entirely on Node's `http`/`fs` — **no extra dependencies** — and
5
+ the CLI wires it straight into the [edge tunnel](./edge-tunnel.md), so a
6
+ directory becomes a public HTTPS URL with a single command.
7
+
8
+ ## CLI
9
+
10
+ ```bash
11
+ oblien serve # serve ./public
12
+ oblien serve ./dist # serve ./dist
13
+ oblien serve ./dist --slug my-app # pick the public subdomain
14
+ oblien serve ./build --spa # single-page-app fallback
15
+ oblien serve ./site --domain preview.example.com
16
+ ```
17
+
18
+ `oblien serve` starts a static server on a loopback port and then forwards it
19
+ through the edge exactly like `oblien tunnel <port>` — so every tunnel flag
20
+ works here too:
21
+
22
+ | Flag | Description |
23
+ | --- | --- |
24
+ | `--port <n>` | Local port to serve on (default: an OS-assigned free port) |
25
+ | `--slug <slug>` | Custom subdomain slug for the public URL |
26
+ | `--name <name>` | Tunnel display name (default: the folder name) |
27
+ | `--domain <domain>` | Base domain or exact custom hostname (see [edge-tunnel](./edge-tunnel.md)) |
28
+ | `--expires-in <ttl>` | Tunnel token TTL, e.g. `30s`, `5m`, `1h`, `7d` |
29
+ | `--spa` | Serve `index.html` for any unmatched path (client-side routing) |
30
+ | `--no-listing` | Disable auto-generated directory listings |
31
+ | `--index <file>` | Directory index filename (default: `index.html`) |
32
+
33
+ Press `Ctrl+C` to stop — the tunnel disconnects and the local server shuts down.
34
+
35
+ ## What the server handles
36
+
37
+ - **Correct MIME types** for common web, font, image, media, and document extensions.
38
+ - **Streamed responses** (`createReadStream`) — large files never buffer in memory.
39
+ - **`Range` requests** — media seeking / resumable downloads return `206 Partial Content`.
40
+ - **Revalidation** — `ETag` + `Last-Modified` yield `304 Not Modified` on conditional requests.
41
+ - **Directory handling** — serves `index.html`, redirects `/dir` → `/dir/`, and renders a clean listing when there's no index (unless `--no-listing`).
42
+ - **SPA fallback** (`--spa`) — unmatched paths return the root `index.html`.
43
+ - **Path-traversal protection** — requests are resolved against the root; anything escaping it lexically is rejected (`403`), and a file whose canonical path (following symlinks) leaves the root is rejected (`404`).
44
+ - **Dotfiles denied by default** — `.git/`, `.env`, and other dot-paths return `404` (the server is often public), except `.well-known/`. Opt in with `allowDotfiles`.
45
+
46
+ ## Programmatic use
47
+
48
+ The same server is exported from the SDK, so you can start it yourself and pair
49
+ it with the [`TunnelClient`](./edge-tunnel.md) or use it standalone:
50
+
51
+ ```typescript
52
+ import { startStaticServer } from 'oblien';
53
+
54
+ const site = await startStaticServer({
55
+ root: './public',
56
+ spa: true, // optional: index.html fallback
57
+ // port: 8080, // optional: default is an OS-assigned free port
58
+ // host: '127.0.0.1' // optional: default loopback only
59
+ });
60
+
61
+ console.log(`serving on ${site.url}`); // http://127.0.0.1:<port>
62
+
63
+ // ...later
64
+ await site.close();
65
+ ```
66
+
67
+ `startStaticServer(options)` resolves once the server is listening and returns a
68
+ handle: `{ port, host, url, server, close() }`. The `port` is always resolved —
69
+ even when you omit it and let the OS choose. For finer control, `createStaticServer(options)`
70
+ returns a non-listening `http.Server`, and `createStaticHandler(options)` returns a
71
+ raw `(req, res)` handler you can mount on your own server.
72
+
73
+ ### Options
74
+
75
+ | Option | Type | Default | Description |
76
+ | --- | --- | --- | --- |
77
+ | `root` | `string` | — | Directory to serve (resolved against cwd) |
78
+ | `host` | `string` | `127.0.0.1` | Interface to bind |
79
+ | `port` | `number` | `0` (auto) | Port to listen on |
80
+ | `index` | `string` | `index.html` | Directory index filename |
81
+ | `listing` | `boolean` | `true` | Render a listing when a directory has no index |
82
+ | `spa` | `boolean` | `false` | Serve the root index for unmatched paths |
83
+ | `allowDotfiles` | `boolean` | `false` | Serve dotfiles/dot-directories (`.well-known/` is always allowed) |
84
+ | `onRequest` | `(info) => void` | — | Per-request hook: `{ method, path, status }` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oblien",
3
- "version": "2.2.37",
3
+ "version": "2.2.39",
4
4
  "description": "Official TypeScript SDK for the Oblien Workspace API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",