@hynaweb/sdk 0.0.0-stage → 1.0.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.
Files changed (3) hide show
  1. package/index.js +47 -0
  2. package/package.json +8 -4
  3. package/README.md +0 -3
package/index.js ADDED
@@ -0,0 +1,47 @@
1
+ // HYNA-Stage SDK v1.0.0
2
+ export class HynaClient {
3
+ constructor(token, baseUrl = 'https://mczesspakhkomlnmfstw.supabase.co/functions/v1') {
4
+ this.token = token;
5
+ this.baseUrl = baseUrl;
6
+ }
7
+
8
+ async _request(endpoint, body) {
9
+ const res = await fetch(`${this.baseUrl}/${endpoint}`, {
10
+ method: 'POST',
11
+ headers: {
12
+ 'Content-Type': 'application/json',
13
+ 'Authorization': `Bearer ${this.token}`
14
+ },
15
+ body: JSON.stringify(body)
16
+ });
17
+ const data = await res.json();
18
+ if (!res.ok) throw new Error(data.error || 'SDK Request Failed');
19
+ return data;
20
+ }
21
+
22
+ /**
23
+ * Deploy a template from the Marketplace
24
+ * @param {string} template - e.g., 'node' or 'python@1.0.0'
25
+ * @param {number} ttl - Time to live in seconds
26
+ */
27
+ async deployTemplate(template, ttl = 3600) {
28
+ return this._request('deploy-stage', { template, ttl });
29
+ }
30
+
31
+ /**
32
+ * Upload a single file and deploy it
33
+ * @param {string} filename - e.g., 'index.html'
34
+ * @param {string} content - The raw file content
35
+ */
36
+ async deployFile(filename, content, ttl = 3600) {
37
+ return this._request('deploy-stage', { file: filename, content, ttl });
38
+ }
39
+
40
+ /**
41
+ * Destroy a running sandbox
42
+ * @param {string} sandboxId - The E2B sandbox ID
43
+ */
44
+ async destroy(sandboxId) {
45
+ return this._request('destroy-stage', { sandbox_id: sandboxId });
46
+ }
47
+ }
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@hynaweb/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Official JavaScript SDK for HYNA-Stage",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "keywords": ["hyna", "e2b", "sandbox", "deployment"],
8
+ "author": "Harun",
9
+ "license": "MIT"
10
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.