@haex-space/vault-sdk 2.5.86 → 2.5.88

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-Y1a7Vkgk.mjs';
3
+ import { H as HaexVaultSdk } from '../client-DwGxAKzx.mjs';
4
4
  import { A as ApplicationContext } from '../types-D4ft4_oG.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-DGSamcol.js';
3
+ import { H as HaexVaultSdk } from '../client-s83JV-k0.js';
4
4
  import { A as ApplicationContext } from '../types-D4ft4_oG.js';
5
5
  import 'drizzle-orm/sqlite-proxy';
6
6
 
@@ -187,6 +187,52 @@ var REMOTE_STORAGE_COMMANDS = {
187
187
  list: "extension_remote_storage_list"
188
188
  };
189
189
 
190
+ // src/commands/localsend.ts
191
+ var LOCALSEND_COMMANDS = {
192
+ // Initialization
193
+ /** Initialize LocalSend (generate identity, etc.) */
194
+ init: "localsend_init",
195
+ /** Get our device info */
196
+ getDeviceInfo: "localsend_get_device_info",
197
+ /** Set our device alias */
198
+ setAlias: "localsend_set_alias",
199
+ // Settings
200
+ /** Get current settings */
201
+ getSettings: "localsend_get_settings",
202
+ /** Update settings */
203
+ setSettings: "localsend_set_settings",
204
+ // Discovery (desktop only)
205
+ /** Start device discovery via multicast UDP */
206
+ startDiscovery: "localsend_start_discovery",
207
+ /** Stop device discovery */
208
+ stopDiscovery: "localsend_stop_discovery",
209
+ /** Get list of discovered devices */
210
+ getDevices: "localsend_get_devices",
211
+ // Network scan (mobile only)
212
+ /** Scan network for devices via HTTP */
213
+ scanNetwork: "localsend_scan_network",
214
+ // Server (receiving files)
215
+ /** Start the HTTPS server for receiving files */
216
+ startServer: "localsend_start_server",
217
+ /** Stop the HTTPS server */
218
+ stopServer: "localsend_stop_server",
219
+ /** Get server status */
220
+ getServerStatus: "localsend_get_server_status",
221
+ /** Get pending incoming transfer requests */
222
+ getPendingTransfers: "localsend_get_pending_transfers",
223
+ /** Accept an incoming transfer */
224
+ acceptTransfer: "localsend_accept_transfer",
225
+ /** Reject an incoming transfer */
226
+ rejectTransfer: "localsend_reject_transfer",
227
+ // Client (sending files)
228
+ /** Prepare files for sending - collect metadata */
229
+ prepareFiles: "localsend_prepare_files",
230
+ /** Send files to a device */
231
+ sendFiles: "localsend_send_files",
232
+ /** Cancel an outgoing transfer */
233
+ cancelSend: "localsend_cancel_send"
234
+ };
235
+
190
236
  // src/api/storage.ts
191
237
  var StorageAPI = class {
192
238
  constructor(client) {
@@ -824,6 +870,163 @@ var BackendManagement = class {
824
870
  }
825
871
  };
826
872
 
873
+ // src/api/localsend.ts
874
+ var LocalSendAPI = class {
875
+ constructor(client) {
876
+ this.client = client;
877
+ }
878
+ // ==========================================================================
879
+ // Initialization
880
+ // ==========================================================================
881
+ /**
882
+ * Initialize LocalSend (generate identity, etc.)
883
+ * Call this on app start
884
+ * @returns Our device info
885
+ */
886
+ async init() {
887
+ return this.client.request(LOCALSEND_COMMANDS.init, {});
888
+ }
889
+ /**
890
+ * Get our device info
891
+ * @returns Our device info
892
+ */
893
+ async getDeviceInfo() {
894
+ return this.client.request(LOCALSEND_COMMANDS.getDeviceInfo, {});
895
+ }
896
+ /**
897
+ * Set our device alias (display name)
898
+ * @param alias New alias
899
+ */
900
+ async setAlias(alias) {
901
+ await this.client.request(LOCALSEND_COMMANDS.setAlias, { alias });
902
+ }
903
+ // ==========================================================================
904
+ // Settings
905
+ // ==========================================================================
906
+ /**
907
+ * Get current LocalSend settings
908
+ * @returns Settings
909
+ */
910
+ async getSettings() {
911
+ return this.client.request(LOCALSEND_COMMANDS.getSettings, {});
912
+ }
913
+ /**
914
+ * Update LocalSend settings
915
+ * @param settings New settings
916
+ */
917
+ async setSettings(settings) {
918
+ await this.client.request(LOCALSEND_COMMANDS.setSettings, { settings });
919
+ }
920
+ // ==========================================================================
921
+ // Discovery (Desktop only - multicast UDP)
922
+ // ==========================================================================
923
+ /**
924
+ * Start device discovery via multicast UDP
925
+ * Desktop only - on mobile use scanNetwork()
926
+ */
927
+ async startDiscovery() {
928
+ await this.client.request(LOCALSEND_COMMANDS.startDiscovery, {});
929
+ }
930
+ /**
931
+ * Stop device discovery
932
+ * Desktop only
933
+ */
934
+ async stopDiscovery() {
935
+ await this.client.request(LOCALSEND_COMMANDS.stopDiscovery, {});
936
+ }
937
+ /**
938
+ * Get list of discovered devices
939
+ * @returns Array of discovered devices
940
+ */
941
+ async getDevices() {
942
+ return this.client.request(LOCALSEND_COMMANDS.getDevices, {});
943
+ }
944
+ // ==========================================================================
945
+ // Network Scan (Mobile only - HTTP)
946
+ // ==========================================================================
947
+ /**
948
+ * Scan network for devices via HTTP
949
+ * Mobile only - on desktop use startDiscovery()
950
+ * @returns Array of discovered devices
951
+ */
952
+ async scanNetwork() {
953
+ return this.client.request(LOCALSEND_COMMANDS.scanNetwork, {});
954
+ }
955
+ // ==========================================================================
956
+ // Server (Receiving files)
957
+ // ==========================================================================
958
+ /**
959
+ * Start the HTTPS server for receiving files
960
+ * @param port Optional port to listen on (default: 53317)
961
+ * @returns Server info with port, fingerprint, and addresses
962
+ */
963
+ async startServer(port) {
964
+ return this.client.request(LOCALSEND_COMMANDS.startServer, { port });
965
+ }
966
+ /**
967
+ * Stop the HTTPS server
968
+ */
969
+ async stopServer() {
970
+ await this.client.request(LOCALSEND_COMMANDS.stopServer, {});
971
+ }
972
+ /**
973
+ * Get server status
974
+ * @returns Server status
975
+ */
976
+ async getServerStatus() {
977
+ return this.client.request(LOCALSEND_COMMANDS.getServerStatus, {});
978
+ }
979
+ /**
980
+ * Get pending incoming transfer requests
981
+ * @returns Array of pending transfers
982
+ */
983
+ async getPendingTransfers() {
984
+ return this.client.request(LOCALSEND_COMMANDS.getPendingTransfers, {});
985
+ }
986
+ /**
987
+ * Accept an incoming transfer
988
+ * @param sessionId Session ID of the transfer
989
+ * @param saveDir Directory to save files to
990
+ */
991
+ async acceptTransfer(sessionId, saveDir) {
992
+ await this.client.request(LOCALSEND_COMMANDS.acceptTransfer, { sessionId, saveDir });
993
+ }
994
+ /**
995
+ * Reject an incoming transfer
996
+ * @param sessionId Session ID of the transfer
997
+ */
998
+ async rejectTransfer(sessionId) {
999
+ await this.client.request(LOCALSEND_COMMANDS.rejectTransfer, { sessionId });
1000
+ }
1001
+ // ==========================================================================
1002
+ // Client (Sending files)
1003
+ // ==========================================================================
1004
+ /**
1005
+ * Prepare files for sending - collect metadata
1006
+ * @param paths Array of file/folder paths to send
1007
+ * @returns Array of file info with metadata
1008
+ */
1009
+ async prepareFiles(paths) {
1010
+ return this.client.request(LOCALSEND_COMMANDS.prepareFiles, { paths });
1011
+ }
1012
+ /**
1013
+ * Send files to a device
1014
+ * @param device Target device
1015
+ * @param files Files to send (from prepareFiles)
1016
+ * @returns Session ID for tracking progress
1017
+ */
1018
+ async sendFiles(device, files) {
1019
+ return this.client.request(LOCALSEND_COMMANDS.sendFiles, { device, files });
1020
+ }
1021
+ /**
1022
+ * Cancel an outgoing transfer
1023
+ * @param sessionId Session ID of the transfer
1024
+ */
1025
+ async cancelSend(sessionId) {
1026
+ await this.client.request(LOCALSEND_COMMANDS.cancelSend, { sessionId });
1027
+ }
1028
+ };
1029
+
827
1030
  // src/messages.ts
828
1031
  var HAEXSPACE_MESSAGE_TYPES = {
829
1032
  /** Debug message for development/troubleshooting */
@@ -1077,6 +1280,25 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1077
1280
  console.error("[HaexVault SDK] Failed to setup file change listener:", error);
1078
1281
  log("Failed to setup file change listener:", error);
1079
1282
  }
1283
+ console.log("[HaexVault SDK] About to register sync tables updated listener for:", HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED);
1284
+ try {
1285
+ await listen(HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED, (event) => {
1286
+ console.log("[HaexVault SDK] Sync tables updated event received:", event.payload);
1287
+ log("Received sync tables updated event:", event);
1288
+ if (event.payload) {
1289
+ const payload = event.payload;
1290
+ onEvent({
1291
+ type: HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED,
1292
+ data: { tables: payload.tables },
1293
+ timestamp: Date.now()
1294
+ });
1295
+ }
1296
+ });
1297
+ console.log("[HaexVault SDK] Sync tables updated listener registered successfully");
1298
+ } catch (error) {
1299
+ console.error("[HaexVault SDK] Failed to setup sync tables updated listener:", error);
1300
+ log("Failed to setup sync tables updated listener:", error);
1301
+ }
1080
1302
  }
1081
1303
  async function initIframeMode(ctx, log, messageHandler, request) {
1082
1304
  if (!isInIframe()) {
@@ -1410,6 +1632,7 @@ var HaexVaultSdk = class {
1410
1632
  this.web = new WebAPI(this);
1411
1633
  this.permissions = new PermissionsAPI(this);
1412
1634
  this.remoteStorage = new RemoteStorageAPI(this);
1635
+ this.localsend = new LocalSendAPI(this);
1413
1636
  installConsoleForwarding(this.config.debug);
1414
1637
  this.readyPromise = new Promise((resolve) => {
1415
1638
  this.resolveReady = resolve;