@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/{client-BEWYbywm.d.mts → client-BAu3VPE3.d.mts} +134 -4
- package/dist/{client-CYgMbZKT.d.ts → client-CF0wJxT2.d.ts} +134 -4
- package/dist/index.d.mts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +134 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +119 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +119 -0
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +1 -1
- package/dist/runtime/nuxt.plugin.client.d.ts +1 -1
- package/dist/runtime/nuxt.plugin.client.js +119 -0
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +119 -0
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +119 -0
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +119 -0
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +119 -0
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +119 -0
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -124,6 +124,19 @@ var HAEXTENSION_METHODS = {
|
|
|
124
124
|
clear: "haextension:storage:clear",
|
|
125
125
|
keys: "haextension:storage:keys"
|
|
126
126
|
},
|
|
127
|
+
// Remote Storage API (S3, WebDAV, FTP, etc.)
|
|
128
|
+
remoteStorage: {
|
|
129
|
+
// Backend Management
|
|
130
|
+
listBackends: "haextension:remote-storage:list-backends",
|
|
131
|
+
addBackend: "haextension:remote-storage:add-backend",
|
|
132
|
+
removeBackend: "haextension:remote-storage:remove-backend",
|
|
133
|
+
testBackend: "haextension:remote-storage:test-backend",
|
|
134
|
+
// Storage Operations
|
|
135
|
+
upload: "haextension:remote-storage:upload",
|
|
136
|
+
download: "haextension:remote-storage:download",
|
|
137
|
+
delete: "haextension:remote-storage:delete",
|
|
138
|
+
list: "haextension:remote-storage:list"
|
|
139
|
+
},
|
|
127
140
|
web: {
|
|
128
141
|
fetch: "haextension:web:fetch"
|
|
129
142
|
},
|
|
@@ -776,6 +789,111 @@ var PermissionsAPI = class {
|
|
|
776
789
|
}
|
|
777
790
|
};
|
|
778
791
|
|
|
792
|
+
// src/api/remoteStorage.ts
|
|
793
|
+
var RemoteStorageAPI = class {
|
|
794
|
+
constructor(client) {
|
|
795
|
+
this.client = client;
|
|
796
|
+
this.backends = new BackendManagement(client);
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Upload data to a storage backend
|
|
800
|
+
* @param backendId - Backend ID to upload to
|
|
801
|
+
* @param key - Object key (path in the bucket)
|
|
802
|
+
* @param data - Data to upload
|
|
803
|
+
*/
|
|
804
|
+
async upload(backendId, key, data) {
|
|
805
|
+
const base64 = btoa(String.fromCharCode(...data));
|
|
806
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.upload, {
|
|
807
|
+
backendId,
|
|
808
|
+
key,
|
|
809
|
+
data: base64
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Download data from a storage backend
|
|
814
|
+
* @param backendId - Backend ID to download from
|
|
815
|
+
* @param key - Object key (path in the bucket)
|
|
816
|
+
* @returns Downloaded data as Uint8Array
|
|
817
|
+
*/
|
|
818
|
+
async download(backendId, key) {
|
|
819
|
+
const base64 = await this.client.request(
|
|
820
|
+
HAEXTENSION_METHODS.remoteStorage.download,
|
|
821
|
+
{ backendId, key }
|
|
822
|
+
);
|
|
823
|
+
const binary = atob(base64);
|
|
824
|
+
const bytes = new Uint8Array(binary.length);
|
|
825
|
+
for (let i = 0; i < binary.length; i++) {
|
|
826
|
+
bytes[i] = binary.charCodeAt(i);
|
|
827
|
+
}
|
|
828
|
+
return bytes;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Delete an object from a storage backend
|
|
832
|
+
* @param backendId - Backend ID
|
|
833
|
+
* @param key - Object key to delete
|
|
834
|
+
*/
|
|
835
|
+
async delete(backendId, key) {
|
|
836
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.delete, {
|
|
837
|
+
backendId,
|
|
838
|
+
key
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* List objects in a storage backend
|
|
843
|
+
* @param backendId - Backend ID
|
|
844
|
+
* @param prefix - Optional prefix to filter objects
|
|
845
|
+
* @returns List of objects
|
|
846
|
+
*/
|
|
847
|
+
async list(backendId, prefix) {
|
|
848
|
+
return this.client.request(
|
|
849
|
+
HAEXTENSION_METHODS.remoteStorage.list,
|
|
850
|
+
{ backendId, prefix }
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
var BackendManagement = class {
|
|
855
|
+
constructor(client) {
|
|
856
|
+
this.client = client;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* List all available storage backends
|
|
860
|
+
*/
|
|
861
|
+
async list() {
|
|
862
|
+
return this.client.request(
|
|
863
|
+
HAEXTENSION_METHODS.remoteStorage.listBackends
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Add a new storage backend
|
|
868
|
+
* @param request - Backend configuration
|
|
869
|
+
* @returns Created backend info
|
|
870
|
+
*/
|
|
871
|
+
async add(request) {
|
|
872
|
+
return this.client.request(
|
|
873
|
+
HAEXTENSION_METHODS.remoteStorage.addBackend,
|
|
874
|
+
request
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Remove a storage backend
|
|
879
|
+
* @param backendId - Backend ID to remove
|
|
880
|
+
*/
|
|
881
|
+
async remove(backendId) {
|
|
882
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.removeBackend, {
|
|
883
|
+
backendId
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Test connection to a storage backend
|
|
888
|
+
* @param backendId - Backend ID to test
|
|
889
|
+
*/
|
|
890
|
+
async test(backendId) {
|
|
891
|
+
await this.client.request(HAEXTENSION_METHODS.remoteStorage.testBackend, {
|
|
892
|
+
backendId
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
|
|
779
897
|
// src/messages.ts
|
|
780
898
|
var HAEXSPACE_MESSAGE_TYPES = {
|
|
781
899
|
/** Debug message for development/troubleshooting */
|
|
@@ -1695,6 +1813,7 @@ var HaexVaultSdk = class {
|
|
|
1695
1813
|
this.filesystem = new FilesystemAPI(this);
|
|
1696
1814
|
this.web = new WebAPI(this);
|
|
1697
1815
|
this.permissions = new PermissionsAPI(this);
|
|
1816
|
+
this.remoteStorage = new RemoteStorageAPI(this);
|
|
1698
1817
|
installConsoleForwarding(this.config.debug);
|
|
1699
1818
|
this.readyPromise = new Promise((resolve) => {
|
|
1700
1819
|
this.resolveReady = resolve;
|