vyoma 0.1.0

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 ADDED
@@ -0,0 +1,117 @@
1
+ # Vyoma SDK
2
+
3
+ Official JavaScript / TypeScript SDK for **Vyoma** — a developer platform for creating, managing, and controlling isolated development sandboxes programmatically.
4
+
5
+ The SDK is fully typed, lightweight, and designed to work cleanly with modern Node.js and TypeScript environments.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install vyoma
13
+ ```
14
+
15
+ ---
16
+
17
+ ## Quick Start
18
+
19
+ This is the minimum working example to verify the SDK is installed and usable.
20
+
21
+ ```ts
22
+ import { VyomaClient } from "vyoma";
23
+
24
+ const vyoma = new VyomaClient({
25
+ apiKey: process.env.VYOMA_API_KEY!,
26
+ });
27
+
28
+ // Create a sandbox
29
+ const { sandbox } = await vyoma.sandbox.create({
30
+ templateId: "nextjs-preview",
31
+ timeout: 600,
32
+ });
33
+
34
+ console.log(sandbox.id, sandbox.status);
35
+ ```
36
+
37
+ If this runs and you get autocomplete, the SDK is working correctly.
38
+
39
+ ---
40
+
41
+ ## Configuration
42
+
43
+ ### VyomaClient
44
+
45
+ ```ts
46
+ new VyomaClient({
47
+ apiKey: string; // required
48
+ baseUrl?: string; // optional, defaults to Vyoma API
49
+ });
50
+ ```
51
+
52
+ Example:
53
+
54
+ ```ts
55
+ const vyoma = new VyomaClient({
56
+ apiKey: "vk_live_xxx",
57
+ });
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Sandbox API
63
+
64
+ ### Create Sandbox
65
+
66
+ ```ts
67
+ const response = await vyoma.sandbox.create({
68
+ templateId: "nextjs-preview",
69
+ timeout: 600,
70
+ });
71
+ ```
72
+
73
+ ### Stop Sandbox
74
+
75
+ ```ts
76
+ await vyoma.sandbox.stop("sandbox_id");
77
+ ```
78
+
79
+ ### Get Sandbox Status
80
+
81
+ ```ts
82
+ const status = await vyoma.sandbox.status("sandbox_id");
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Type Safety
88
+
89
+ The Vyoma SDK is fully typed.
90
+
91
+ All request payloads and responses are strict TypeScript contracts that mirror the Vyoma API.
92
+ This enables autocomplete, compile-time validation, and safe refactoring.
93
+
94
+ ---
95
+
96
+ ## Runtime Support
97
+
98
+ - Node.js 18+
99
+ - Bun
100
+ - Deno (npm compatibility)
101
+ - Vite
102
+ - Next.js (App Router & Pages Router)
103
+
104
+ ---
105
+
106
+ ## Versioning
107
+
108
+ The SDK follows semantic versioning.
109
+
110
+ - 0.x → early development
111
+ - Breaking changes may occur before 1.0.0
112
+
113
+ ---
114
+
115
+ ## License
116
+
117
+ MIT © Vyoma
@@ -0,0 +1,52 @@
1
+ type ID = string;
2
+ type ISODate = string;
3
+ interface ApiError {
4
+ error: string;
5
+ code?: string;
6
+ }
7
+
8
+ interface SandboxCreateRequest {
9
+ templateId: ID;
10
+ timeout?: number;
11
+ }
12
+ interface SandboxStopRequest {
13
+ sandboxId: ID;
14
+ }
15
+ type SandboxStatus = "starting" | "running" | "stopped" | "error";
16
+ interface Sandbox {
17
+ id: ID;
18
+ templateId: ID;
19
+ status: SandboxStatus;
20
+ createdAt: ISODate;
21
+ expiresAt?: ISODate;
22
+ url?: string;
23
+ }
24
+ interface SandboxCreateResponse {
25
+ sandbox: Sandbox;
26
+ }
27
+ interface SandboxStatusResponse {
28
+ sandboxId: ID;
29
+ status: SandboxStatus;
30
+ }
31
+
32
+ declare class SandboxResource {
33
+ private client;
34
+ constructor(client: VyomaClient);
35
+ create(data: SandboxCreateRequest): Promise<SandboxCreateResponse>;
36
+ stop(sandboxId: string): Promise<unknown>;
37
+ status(sandboxId: string): Promise<SandboxStatusResponse>;
38
+ }
39
+
40
+ interface VyomaClientOptions {
41
+ apiKey: string;
42
+ baseUrl?: string;
43
+ }
44
+ declare class VyomaClient {
45
+ private apiKey;
46
+ private baseUrl;
47
+ constructor(options: VyomaClientOptions);
48
+ request<T>(path: string, options?: RequestInit): Promise<T>;
49
+ sandbox: SandboxResource;
50
+ }
51
+
52
+ export { type ApiError, type ID, type ISODate, type Sandbox, type SandboxCreateRequest, type SandboxCreateResponse, type SandboxStatus, type SandboxStatusResponse, type SandboxStopRequest, VyomaClient };
@@ -0,0 +1,52 @@
1
+ type ID = string;
2
+ type ISODate = string;
3
+ interface ApiError {
4
+ error: string;
5
+ code?: string;
6
+ }
7
+
8
+ interface SandboxCreateRequest {
9
+ templateId: ID;
10
+ timeout?: number;
11
+ }
12
+ interface SandboxStopRequest {
13
+ sandboxId: ID;
14
+ }
15
+ type SandboxStatus = "starting" | "running" | "stopped" | "error";
16
+ interface Sandbox {
17
+ id: ID;
18
+ templateId: ID;
19
+ status: SandboxStatus;
20
+ createdAt: ISODate;
21
+ expiresAt?: ISODate;
22
+ url?: string;
23
+ }
24
+ interface SandboxCreateResponse {
25
+ sandbox: Sandbox;
26
+ }
27
+ interface SandboxStatusResponse {
28
+ sandboxId: ID;
29
+ status: SandboxStatus;
30
+ }
31
+
32
+ declare class SandboxResource {
33
+ private client;
34
+ constructor(client: VyomaClient);
35
+ create(data: SandboxCreateRequest): Promise<SandboxCreateResponse>;
36
+ stop(sandboxId: string): Promise<unknown>;
37
+ status(sandboxId: string): Promise<SandboxStatusResponse>;
38
+ }
39
+
40
+ interface VyomaClientOptions {
41
+ apiKey: string;
42
+ baseUrl?: string;
43
+ }
44
+ declare class VyomaClient {
45
+ private apiKey;
46
+ private baseUrl;
47
+ constructor(options: VyomaClientOptions);
48
+ request<T>(path: string, options?: RequestInit): Promise<T>;
49
+ sandbox: SandboxResource;
50
+ }
51
+
52
+ export { type ApiError, type ID, type ISODate, type Sandbox, type SandboxCreateRequest, type SandboxCreateResponse, type SandboxStatus, type SandboxStatusResponse, type SandboxStopRequest, VyomaClient };
package/dist/index.js ADDED
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ VyomaClient: () => VyomaClient
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/resources/sandbox.ts
28
+ var SandboxResource = class {
29
+ constructor(client) {
30
+ this.client = client;
31
+ }
32
+ create(data) {
33
+ return this.client.request(
34
+ "/sandbox/create",
35
+ {
36
+ method: "POST",
37
+ body: JSON.stringify(data)
38
+ }
39
+ );
40
+ }
41
+ stop(sandboxId) {
42
+ return this.client.request(
43
+ "/sandbox/stop",
44
+ {
45
+ method: "POST",
46
+ body: JSON.stringify({ sandboxId })
47
+ }
48
+ );
49
+ }
50
+ status(sandboxId) {
51
+ return this.client.request(
52
+ `/sandbox/status?sandboxId=${sandboxId}`
53
+ );
54
+ }
55
+ };
56
+
57
+ // src/core/client.ts
58
+ var VyomaClient = class {
59
+ constructor(options) {
60
+ this.sandbox = new SandboxResource(this);
61
+ if (!options.apiKey) {
62
+ throw new Error("Vyoma API key is required");
63
+ }
64
+ this.apiKey = options.apiKey;
65
+ this.baseUrl = options.baseUrl ?? "https://api.vyoma.dev";
66
+ }
67
+ async request(path, options = {}) {
68
+ const res = await fetch(`${this.baseUrl}${path}`, {
69
+ ...options,
70
+ headers: {
71
+ "Content-Type": "application/json",
72
+ Authorization: `Bearer ${this.apiKey}`,
73
+ ...options.headers || {}
74
+ }
75
+ });
76
+ if (!res.ok) {
77
+ const text = await res.text();
78
+ throw new Error(`Vyoma API error (${res.status}): ${text}`);
79
+ }
80
+ return res.json();
81
+ }
82
+ };
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ VyomaClient
86
+ });
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/resources/sandbox.ts","../src/core/client.ts"],"sourcesContent":["export { VyomaClient } from \"./core/client\";\r\nexport * from \"./types\";\r\n","import { VyomaClient } from \"../core/client\";\r\nimport {\r\n SandboxCreateRequest,\r\n SandboxCreateResponse,\r\n SandboxStatusResponse,\r\n} from \"../types/sandbox\";\r\n\r\nexport class SandboxResource {\r\n constructor(private client: VyomaClient) {}\r\n\r\n create(data: SandboxCreateRequest) {\r\n return this.client.request<SandboxCreateResponse>(\r\n \"/sandbox/create\",\r\n {\r\n method: \"POST\",\r\n body: JSON.stringify(data),\r\n }\r\n );\r\n }\r\n\r\n stop(sandboxId: string) {\r\n return this.client.request(\r\n \"/sandbox/stop\",\r\n {\r\n method: \"POST\",\r\n body: JSON.stringify({ sandboxId }),\r\n }\r\n );\r\n }\r\n\r\n status(sandboxId: string) {\r\n return this.client.request<SandboxStatusResponse>(\r\n `/sandbox/status?sandboxId=${sandboxId}`\r\n );\r\n }\r\n}\r\n","import { SandboxResource } from \"../resources/sandbox\";\r\n\r\nexport interface VyomaClientOptions {\r\n apiKey: string;\r\n baseUrl?: string;\r\n}\r\n\r\nexport class VyomaClient {\r\n private apiKey: string;\r\n private baseUrl: string;\r\n\r\n constructor(options: VyomaClientOptions) {\r\n if (!options.apiKey) {\r\n throw new Error(\"Vyoma API key is required\");\r\n }\r\n\r\n this.apiKey = options.apiKey;\r\n this.baseUrl = options.baseUrl ?? \"https://api.vyoma.dev\";\r\n }\r\n\r\n async request<T>(path: string, options: RequestInit = {}): Promise<T> {\r\n const res = await fetch(`${this.baseUrl}${path}`, {\r\n ...options,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n Authorization: `Bearer ${this.apiKey}`,\r\n ...(options.headers || {}),\r\n },\r\n });\r\n\r\n if (!res.ok) {\r\n const text = await res.text();\r\n throw new Error(`Vyoma API error (${res.status}): ${text}`);\r\n }\r\n\r\n return res.json() as Promise<T>;\r\n }\r\n sandbox = new SandboxResource(this);\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAAoB,QAAqB;AAArB;AAAA,EAAsB;AAAA,EAE1C,OAAO,MAA4B;AACjC,WAAO,KAAK,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,MAAM,KAAK,UAAU,IAAI;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AAAA,EAEA,KAAK,WAAmB;AACtB,WAAO,KAAK,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,MAAM,KAAK,UAAU,EAAE,UAAU,CAAC;AAAA,MACpC;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAO,WAAmB;AACxB,WAAO,KAAK,OAAO;AAAA,MACjB,6BAA6B,SAAS;AAAA,IACxC;AAAA,EACF;AACF;;;AC5BO,IAAM,cAAN,MAAkB;AAAA,EAIvB,YAAY,SAA6B;AA0BzC,mBAAU,IAAI,gBAAgB,IAAI;AAzBhC,QAAI,CAAC,QAAQ,QAAQ;AACnB,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC7C;AAEA,SAAK,SAAS,QAAQ;AACtB,SAAK,UAAU,QAAQ,WAAW;AAAA,EACpC;AAAA,EAEA,MAAM,QAAW,MAAc,UAAuB,CAAC,GAAe;AACpE,UAAM,MAAM,MAAM,MAAM,GAAG,KAAK,OAAO,GAAG,IAAI,IAAI;AAAA,MAChD,GAAG;AAAA,MACH,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,eAAe,UAAU,KAAK,MAAM;AAAA,QACpC,GAAI,QAAQ,WAAW,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAED,QAAI,CAAC,IAAI,IAAI;AACX,YAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,YAAM,IAAI,MAAM,oBAAoB,IAAI,MAAM,MAAM,IAAI,EAAE;AAAA,IAC5D;AAEA,WAAO,IAAI,KAAK;AAAA,EAClB;AAEF;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,60 @@
1
+ // src/resources/sandbox.ts
2
+ var SandboxResource = class {
3
+ constructor(client) {
4
+ this.client = client;
5
+ }
6
+ create(data) {
7
+ return this.client.request(
8
+ "/sandbox/create",
9
+ {
10
+ method: "POST",
11
+ body: JSON.stringify(data)
12
+ }
13
+ );
14
+ }
15
+ stop(sandboxId) {
16
+ return this.client.request(
17
+ "/sandbox/stop",
18
+ {
19
+ method: "POST",
20
+ body: JSON.stringify({ sandboxId })
21
+ }
22
+ );
23
+ }
24
+ status(sandboxId) {
25
+ return this.client.request(
26
+ `/sandbox/status?sandboxId=${sandboxId}`
27
+ );
28
+ }
29
+ };
30
+
31
+ // src/core/client.ts
32
+ var VyomaClient = class {
33
+ constructor(options) {
34
+ this.sandbox = new SandboxResource(this);
35
+ if (!options.apiKey) {
36
+ throw new Error("Vyoma API key is required");
37
+ }
38
+ this.apiKey = options.apiKey;
39
+ this.baseUrl = options.baseUrl ?? "https://api.vyoma.dev";
40
+ }
41
+ async request(path, options = {}) {
42
+ const res = await fetch(`${this.baseUrl}${path}`, {
43
+ ...options,
44
+ headers: {
45
+ "Content-Type": "application/json",
46
+ Authorization: `Bearer ${this.apiKey}`,
47
+ ...options.headers || {}
48
+ }
49
+ });
50
+ if (!res.ok) {
51
+ const text = await res.text();
52
+ throw new Error(`Vyoma API error (${res.status}): ${text}`);
53
+ }
54
+ return res.json();
55
+ }
56
+ };
57
+ export {
58
+ VyomaClient
59
+ };
60
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resources/sandbox.ts","../src/core/client.ts"],"sourcesContent":["import { VyomaClient } from \"../core/client\";\r\nimport {\r\n SandboxCreateRequest,\r\n SandboxCreateResponse,\r\n SandboxStatusResponse,\r\n} from \"../types/sandbox\";\r\n\r\nexport class SandboxResource {\r\n constructor(private client: VyomaClient) {}\r\n\r\n create(data: SandboxCreateRequest) {\r\n return this.client.request<SandboxCreateResponse>(\r\n \"/sandbox/create\",\r\n {\r\n method: \"POST\",\r\n body: JSON.stringify(data),\r\n }\r\n );\r\n }\r\n\r\n stop(sandboxId: string) {\r\n return this.client.request(\r\n \"/sandbox/stop\",\r\n {\r\n method: \"POST\",\r\n body: JSON.stringify({ sandboxId }),\r\n }\r\n );\r\n }\r\n\r\n status(sandboxId: string) {\r\n return this.client.request<SandboxStatusResponse>(\r\n `/sandbox/status?sandboxId=${sandboxId}`\r\n );\r\n }\r\n}\r\n","import { SandboxResource } from \"../resources/sandbox\";\r\n\r\nexport interface VyomaClientOptions {\r\n apiKey: string;\r\n baseUrl?: string;\r\n}\r\n\r\nexport class VyomaClient {\r\n private apiKey: string;\r\n private baseUrl: string;\r\n\r\n constructor(options: VyomaClientOptions) {\r\n if (!options.apiKey) {\r\n throw new Error(\"Vyoma API key is required\");\r\n }\r\n\r\n this.apiKey = options.apiKey;\r\n this.baseUrl = options.baseUrl ?? \"https://api.vyoma.dev\";\r\n }\r\n\r\n async request<T>(path: string, options: RequestInit = {}): Promise<T> {\r\n const res = await fetch(`${this.baseUrl}${path}`, {\r\n ...options,\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n Authorization: `Bearer ${this.apiKey}`,\r\n ...(options.headers || {}),\r\n },\r\n });\r\n\r\n if (!res.ok) {\r\n const text = await res.text();\r\n throw new Error(`Vyoma API error (${res.status}): ${text}`);\r\n }\r\n\r\n return res.json() as Promise<T>;\r\n }\r\n sand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ClB;AAEF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "vyoma",
3
+ "version": "0.1.0",
4
+ "description": "Vyoma JavaScript SDK",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "dev": "tsup --watch",
19
+ "lint": "eslint .",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "vyoma",
24
+ "sdk",
25
+ "sandbox"
26
+ ],
27
+ "license": "MIT",
28
+ "devDependencies": {
29
+ "@typescript-eslint/eslint-plugin": "^8.50.1",
30
+ "@typescript-eslint/parser": "^8.50.1",
31
+ "eslint": "^9.39.2",
32
+ "tsup": "^8.5.1",
33
+ "typescript": "^5.9.3"
34
+ }
35
+ }