@haex-space/vault-sdk 2.5.40 → 2.5.42

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/dist/svelte.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-BEWYbywm.mjs';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-BAu3VPE3.mjs';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { Readable } from 'svelte/store';
4
4
  import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-DiXJ5SF6.mjs';
package/dist/svelte.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-CYgMbZKT.js';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-CF0wJxT2.js';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { Readable } from 'svelte/store';
4
4
  import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-DiXJ5SF6.js';
package/dist/svelte.js CHANGED
@@ -452,6 +452,19 @@ var HAEXTENSION_METHODS = {
452
452
  clear: "haextension:storage:clear",
453
453
  keys: "haextension:storage:keys"
454
454
  },
455
+ // Remote Storage API (S3, WebDAV, FTP, etc.)
456
+ remoteStorage: {
457
+ // Backend Management
458
+ listBackends: "haextension:remote-storage:list-backends",
459
+ addBackend: "haextension:remote-storage:add-backend",
460
+ removeBackend: "haextension:remote-storage:remove-backend",
461
+ testBackend: "haextension:remote-storage:test-backend",
462
+ // Storage Operations
463
+ upload: "haextension:remote-storage:upload",
464
+ download: "haextension:remote-storage:download",
465
+ delete: "haextension:remote-storage:delete",
466
+ list: "haextension:remote-storage:list"
467
+ },
455
468
  web: {
456
469
  fetch: "haextension:web:fetch"
457
470
  },
@@ -1104,6 +1117,111 @@ var PermissionsAPI = class {
1104
1117
  }
1105
1118
  };
1106
1119
 
1120
+ // src/api/remoteStorage.ts
1121
+ var RemoteStorageAPI = class {
1122
+ constructor(client) {
1123
+ this.client = client;
1124
+ this.backends = new BackendManagement(client);
1125
+ }
1126
+ /**
1127
+ * Upload data to a storage backend
1128
+ * @param backendId - Backend ID to upload to
1129
+ * @param key - Object key (path in the bucket)
1130
+ * @param data - Data to upload
1131
+ */
1132
+ async upload(backendId, key, data) {
1133
+ const base64 = btoa(String.fromCharCode(...data));
1134
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.upload, {
1135
+ backendId,
1136
+ key,
1137
+ data: base64
1138
+ });
1139
+ }
1140
+ /**
1141
+ * Download data from a storage backend
1142
+ * @param backendId - Backend ID to download from
1143
+ * @param key - Object key (path in the bucket)
1144
+ * @returns Downloaded data as Uint8Array
1145
+ */
1146
+ async download(backendId, key) {
1147
+ const base64 = await this.client.request(
1148
+ HAEXTENSION_METHODS.remoteStorage.download,
1149
+ { backendId, key }
1150
+ );
1151
+ const binary = atob(base64);
1152
+ const bytes = new Uint8Array(binary.length);
1153
+ for (let i = 0; i < binary.length; i++) {
1154
+ bytes[i] = binary.charCodeAt(i);
1155
+ }
1156
+ return bytes;
1157
+ }
1158
+ /**
1159
+ * Delete an object from a storage backend
1160
+ * @param backendId - Backend ID
1161
+ * @param key - Object key to delete
1162
+ */
1163
+ async delete(backendId, key) {
1164
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.delete, {
1165
+ backendId,
1166
+ key
1167
+ });
1168
+ }
1169
+ /**
1170
+ * List objects in a storage backend
1171
+ * @param backendId - Backend ID
1172
+ * @param prefix - Optional prefix to filter objects
1173
+ * @returns List of objects
1174
+ */
1175
+ async list(backendId, prefix) {
1176
+ return this.client.request(
1177
+ HAEXTENSION_METHODS.remoteStorage.list,
1178
+ { backendId, prefix }
1179
+ );
1180
+ }
1181
+ };
1182
+ var BackendManagement = class {
1183
+ constructor(client) {
1184
+ this.client = client;
1185
+ }
1186
+ /**
1187
+ * List all available storage backends
1188
+ */
1189
+ async list() {
1190
+ return this.client.request(
1191
+ HAEXTENSION_METHODS.remoteStorage.listBackends
1192
+ );
1193
+ }
1194
+ /**
1195
+ * Add a new storage backend
1196
+ * @param request - Backend configuration
1197
+ * @returns Created backend info
1198
+ */
1199
+ async add(request) {
1200
+ return this.client.request(
1201
+ HAEXTENSION_METHODS.remoteStorage.addBackend,
1202
+ request
1203
+ );
1204
+ }
1205
+ /**
1206
+ * Remove a storage backend
1207
+ * @param backendId - Backend ID to remove
1208
+ */
1209
+ async remove(backendId) {
1210
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.removeBackend, {
1211
+ backendId
1212
+ });
1213
+ }
1214
+ /**
1215
+ * Test connection to a storage backend
1216
+ * @param backendId - Backend ID to test
1217
+ */
1218
+ async test(backendId) {
1219
+ await this.client.request(HAEXTENSION_METHODS.remoteStorage.testBackend, {
1220
+ backendId
1221
+ });
1222
+ }
1223
+ };
1224
+
1107
1225
  // src/client/tableName.ts
1108
1226
  function validatePublicKey(publicKey) {
1109
1227
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
@@ -1949,6 +2067,7 @@ var HaexVaultSdk = class {
1949
2067
  this.filesystem = new FilesystemAPI(this);
1950
2068
  this.web = new WebAPI(this);
1951
2069
  this.permissions = new PermissionsAPI(this);
2070
+ this.remoteStorage = new RemoteStorageAPI(this);
1952
2071
  installConsoleForwarding(this.config.debug);
1953
2072
  this.readyPromise = new Promise((resolve) => {
1954
2073
  this.resolveReady = resolve;