bytex-sdk 1.2.0 → 1.4.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/index.js +23 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -6,11 +6,18 @@ const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdWJh
|
|
|
6
6
|
export class BytexCloud {
|
|
7
7
|
constructor(config = {}) {
|
|
8
8
|
this.apiKey = config.apiKey || null;
|
|
9
|
+
this.byoc = config.byoc || null;
|
|
9
10
|
this.supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
|
|
10
11
|
this.user = null;
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
if (this.byoc) {
|
|
14
|
+
console.log(`🚀 ByteX SDK Initialized in BYOC Mode (External Cloud Bound)`);
|
|
15
|
+
} else {
|
|
16
|
+
console.log(`🚀 ByteX SDK Initialized!`);
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
|
|
14
21
|
// Auth: Log in using ByteX Email & Password
|
|
15
22
|
async login(email, password) {
|
|
16
23
|
const { data, error } = await this.supabase.auth.signInWithPassword({ email, password });
|
|
@@ -54,11 +61,26 @@ export class BytexCloud {
|
|
|
54
61
|
return { success: true, url: `https://bytex.work/v1/${name}` };
|
|
55
62
|
}
|
|
56
63
|
|
|
64
|
+
// Storage: Download file
|
|
65
|
+
async download(name) {
|
|
66
|
+
if (!this.apiKey) throw new Error("API Key Required!");
|
|
67
|
+
console.log(`[ByteX] 📥 Downloading ${name} from Cloud...`);
|
|
68
|
+
// Mock return file buffer
|
|
69
|
+
return { success: true, data: new Blob() };
|
|
70
|
+
}
|
|
71
|
+
|
|
57
72
|
// Storage: Delete file
|
|
58
73
|
async delete(name) {
|
|
59
74
|
if (!this.apiKey) throw new Error("API Key Required!");
|
|
60
75
|
console.log(`[ByteX] 🗑️ Removing ${name} from Cloud...`);
|
|
61
76
|
return { success: true };
|
|
62
77
|
}
|
|
78
|
+
|
|
79
|
+
// Storage: Rename file
|
|
80
|
+
async rename(oldName, newName) {
|
|
81
|
+
if (!this.apiKey) throw new Error("API Key Required!");
|
|
82
|
+
console.log(`[ByteX] ✏️ Renaming ${oldName} to ${newName}...`);
|
|
83
|
+
return { success: true };
|
|
84
|
+
}
|
|
63
85
|
}
|
|
64
86
|
|