@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.
package/dist/react.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-Y1a7Vkgk.mjs';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-DwGxAKzx.mjs';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-D4ft4_oG.mjs';
4
4
 
package/dist/react.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as HaexVaultSdk, S as StorageAPI } from './client-DGSamcol.js';
1
+ import { H as HaexVaultSdk, S as StorageAPI } from './client-s83JV-k0.js';
2
2
  import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
3
3
  import { H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext } from './types-D4ft4_oG.js';
4
4
 
package/dist/react.js CHANGED
@@ -513,6 +513,52 @@ var REMOTE_STORAGE_COMMANDS = {
513
513
  list: "extension_remote_storage_list"
514
514
  };
515
515
 
516
+ // src/commands/localsend.ts
517
+ var LOCALSEND_COMMANDS = {
518
+ // Initialization
519
+ /** Initialize LocalSend (generate identity, etc.) */
520
+ init: "localsend_init",
521
+ /** Get our device info */
522
+ getDeviceInfo: "localsend_get_device_info",
523
+ /** Set our device alias */
524
+ setAlias: "localsend_set_alias",
525
+ // Settings
526
+ /** Get current settings */
527
+ getSettings: "localsend_get_settings",
528
+ /** Update settings */
529
+ setSettings: "localsend_set_settings",
530
+ // Discovery (desktop only)
531
+ /** Start device discovery via multicast UDP */
532
+ startDiscovery: "localsend_start_discovery",
533
+ /** Stop device discovery */
534
+ stopDiscovery: "localsend_stop_discovery",
535
+ /** Get list of discovered devices */
536
+ getDevices: "localsend_get_devices",
537
+ // Network scan (mobile only)
538
+ /** Scan network for devices via HTTP */
539
+ scanNetwork: "localsend_scan_network",
540
+ // Server (receiving files)
541
+ /** Start the HTTPS server for receiving files */
542
+ startServer: "localsend_start_server",
543
+ /** Stop the HTTPS server */
544
+ stopServer: "localsend_stop_server",
545
+ /** Get server status */
546
+ getServerStatus: "localsend_get_server_status",
547
+ /** Get pending incoming transfer requests */
548
+ getPendingTransfers: "localsend_get_pending_transfers",
549
+ /** Accept an incoming transfer */
550
+ acceptTransfer: "localsend_accept_transfer",
551
+ /** Reject an incoming transfer */
552
+ rejectTransfer: "localsend_reject_transfer",
553
+ // Client (sending files)
554
+ /** Prepare files for sending - collect metadata */
555
+ prepareFiles: "localsend_prepare_files",
556
+ /** Send files to a device */
557
+ sendFiles: "localsend_send_files",
558
+ /** Cancel an outgoing transfer */
559
+ cancelSend: "localsend_cancel_send"
560
+ };
561
+
516
562
  // src/api/storage.ts
517
563
  var StorageAPI = class {
518
564
  constructor(client) {
@@ -1150,6 +1196,163 @@ var BackendManagement = class {
1150
1196
  }
1151
1197
  };
1152
1198
 
1199
+ // src/api/localsend.ts
1200
+ var LocalSendAPI = class {
1201
+ constructor(client) {
1202
+ this.client = client;
1203
+ }
1204
+ // ==========================================================================
1205
+ // Initialization
1206
+ // ==========================================================================
1207
+ /**
1208
+ * Initialize LocalSend (generate identity, etc.)
1209
+ * Call this on app start
1210
+ * @returns Our device info
1211
+ */
1212
+ async init() {
1213
+ return this.client.request(LOCALSEND_COMMANDS.init, {});
1214
+ }
1215
+ /**
1216
+ * Get our device info
1217
+ * @returns Our device info
1218
+ */
1219
+ async getDeviceInfo() {
1220
+ return this.client.request(LOCALSEND_COMMANDS.getDeviceInfo, {});
1221
+ }
1222
+ /**
1223
+ * Set our device alias (display name)
1224
+ * @param alias New alias
1225
+ */
1226
+ async setAlias(alias) {
1227
+ await this.client.request(LOCALSEND_COMMANDS.setAlias, { alias });
1228
+ }
1229
+ // ==========================================================================
1230
+ // Settings
1231
+ // ==========================================================================
1232
+ /**
1233
+ * Get current LocalSend settings
1234
+ * @returns Settings
1235
+ */
1236
+ async getSettings() {
1237
+ return this.client.request(LOCALSEND_COMMANDS.getSettings, {});
1238
+ }
1239
+ /**
1240
+ * Update LocalSend settings
1241
+ * @param settings New settings
1242
+ */
1243
+ async setSettings(settings) {
1244
+ await this.client.request(LOCALSEND_COMMANDS.setSettings, { settings });
1245
+ }
1246
+ // ==========================================================================
1247
+ // Discovery (Desktop only - multicast UDP)
1248
+ // ==========================================================================
1249
+ /**
1250
+ * Start device discovery via multicast UDP
1251
+ * Desktop only - on mobile use scanNetwork()
1252
+ */
1253
+ async startDiscovery() {
1254
+ await this.client.request(LOCALSEND_COMMANDS.startDiscovery, {});
1255
+ }
1256
+ /**
1257
+ * Stop device discovery
1258
+ * Desktop only
1259
+ */
1260
+ async stopDiscovery() {
1261
+ await this.client.request(LOCALSEND_COMMANDS.stopDiscovery, {});
1262
+ }
1263
+ /**
1264
+ * Get list of discovered devices
1265
+ * @returns Array of discovered devices
1266
+ */
1267
+ async getDevices() {
1268
+ return this.client.request(LOCALSEND_COMMANDS.getDevices, {});
1269
+ }
1270
+ // ==========================================================================
1271
+ // Network Scan (Mobile only - HTTP)
1272
+ // ==========================================================================
1273
+ /**
1274
+ * Scan network for devices via HTTP
1275
+ * Mobile only - on desktop use startDiscovery()
1276
+ * @returns Array of discovered devices
1277
+ */
1278
+ async scanNetwork() {
1279
+ return this.client.request(LOCALSEND_COMMANDS.scanNetwork, {});
1280
+ }
1281
+ // ==========================================================================
1282
+ // Server (Receiving files)
1283
+ // ==========================================================================
1284
+ /**
1285
+ * Start the HTTPS server for receiving files
1286
+ * @param port Optional port to listen on (default: 53317)
1287
+ * @returns Server info with port, fingerprint, and addresses
1288
+ */
1289
+ async startServer(port) {
1290
+ return this.client.request(LOCALSEND_COMMANDS.startServer, { port });
1291
+ }
1292
+ /**
1293
+ * Stop the HTTPS server
1294
+ */
1295
+ async stopServer() {
1296
+ await this.client.request(LOCALSEND_COMMANDS.stopServer, {});
1297
+ }
1298
+ /**
1299
+ * Get server status
1300
+ * @returns Server status
1301
+ */
1302
+ async getServerStatus() {
1303
+ return this.client.request(LOCALSEND_COMMANDS.getServerStatus, {});
1304
+ }
1305
+ /**
1306
+ * Get pending incoming transfer requests
1307
+ * @returns Array of pending transfers
1308
+ */
1309
+ async getPendingTransfers() {
1310
+ return this.client.request(LOCALSEND_COMMANDS.getPendingTransfers, {});
1311
+ }
1312
+ /**
1313
+ * Accept an incoming transfer
1314
+ * @param sessionId Session ID of the transfer
1315
+ * @param saveDir Directory to save files to
1316
+ */
1317
+ async acceptTransfer(sessionId, saveDir) {
1318
+ await this.client.request(LOCALSEND_COMMANDS.acceptTransfer, { sessionId, saveDir });
1319
+ }
1320
+ /**
1321
+ * Reject an incoming transfer
1322
+ * @param sessionId Session ID of the transfer
1323
+ */
1324
+ async rejectTransfer(sessionId) {
1325
+ await this.client.request(LOCALSEND_COMMANDS.rejectTransfer, { sessionId });
1326
+ }
1327
+ // ==========================================================================
1328
+ // Client (Sending files)
1329
+ // ==========================================================================
1330
+ /**
1331
+ * Prepare files for sending - collect metadata
1332
+ * @param paths Array of file/folder paths to send
1333
+ * @returns Array of file info with metadata
1334
+ */
1335
+ async prepareFiles(paths) {
1336
+ return this.client.request(LOCALSEND_COMMANDS.prepareFiles, { paths });
1337
+ }
1338
+ /**
1339
+ * Send files to a device
1340
+ * @param device Target device
1341
+ * @param files Files to send (from prepareFiles)
1342
+ * @returns Session ID for tracking progress
1343
+ */
1344
+ async sendFiles(device, files) {
1345
+ return this.client.request(LOCALSEND_COMMANDS.sendFiles, { device, files });
1346
+ }
1347
+ /**
1348
+ * Cancel an outgoing transfer
1349
+ * @param sessionId Session ID of the transfer
1350
+ */
1351
+ async cancelSend(sessionId) {
1352
+ await this.client.request(LOCALSEND_COMMANDS.cancelSend, { sessionId });
1353
+ }
1354
+ };
1355
+
1153
1356
  // src/client/tableName.ts
1154
1357
  function validatePublicKey(publicKey) {
1155
1358
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
@@ -1329,6 +1532,25 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
1329
1532
  console.error("[HaexVault SDK] Failed to setup file change listener:", error);
1330
1533
  log("Failed to setup file change listener:", error);
1331
1534
  }
1535
+ console.log("[HaexVault SDK] About to register sync tables updated listener for:", HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED);
1536
+ try {
1537
+ await listen(HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED, (event) => {
1538
+ console.log("[HaexVault SDK] Sync tables updated event received:", event.payload);
1539
+ log("Received sync tables updated event:", event);
1540
+ if (event.payload) {
1541
+ const payload = event.payload;
1542
+ onEvent({
1543
+ type: HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED,
1544
+ data: { tables: payload.tables },
1545
+ timestamp: Date.now()
1546
+ });
1547
+ }
1548
+ });
1549
+ console.log("[HaexVault SDK] Sync tables updated listener registered successfully");
1550
+ } catch (error) {
1551
+ console.error("[HaexVault SDK] Failed to setup sync tables updated listener:", error);
1552
+ log("Failed to setup sync tables updated listener:", error);
1553
+ }
1332
1554
  }
1333
1555
  async function initIframeMode(ctx, log, messageHandler, request) {
1334
1556
  if (!isInIframe()) {
@@ -1662,6 +1884,7 @@ var HaexVaultSdk = class {
1662
1884
  this.web = new WebAPI(this);
1663
1885
  this.permissions = new PermissionsAPI(this);
1664
1886
  this.remoteStorage = new RemoteStorageAPI(this);
1887
+ this.localsend = new LocalSendAPI(this);
1665
1888
  installConsoleForwarding(this.config.debug);
1666
1889
  this.readyPromise = new Promise((resolve) => {
1667
1890
  this.resolveReady = resolve;