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