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