@haex-space/vault-sdk 2.5.87 → 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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HaexVaultSdk } from './client-DGSamcol.js';
2
- export { D as DatabaseAPI, b as DirEntry, a as FileStat, F as FilesystemAPI, P as PermissionsAPI, A as RemoteAddBackendRequest, f as RemoteS3Config, g as RemoteS3PublicConfig, R as RemoteStorageAPI, e as RemoteStorageBackendInfo, h as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, d as SelectFileOptions, c as SelectFolderOptions, W as WebAPI } from './client-DGSamcol.js';
1
+ import { H as HaexVaultSdk } from './client-s83JV-k0.js';
2
+ export { D as DatabaseAPI, h as Device, g as DeviceInfo, f as DeviceType, b as DirEntry, a as FileStat, F as FilesystemAPI, e as LOCALSEND_EVENTS, L as LocalSendAPI, p as LocalSendEvent, i as LocalSendFileInfo, l as LocalSendSettings, m as PendingTransfer, P as PermissionsAPI, A as RemoteAddBackendRequest, r as RemoteS3Config, s as RemoteS3PublicConfig, R as RemoteStorageAPI, q as RemoteStorageBackendInfo, t as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, d as SelectFileOptions, c as SelectFolderOptions, j as ServerInfo, k as ServerStatus, o as TransferDirection, T as TransferProgress, n as TransferState, W as WebAPI } from './client-s83JV-k0.js';
3
3
  import { E as ExtensionManifest, H as HaexHubConfig } from './types-D4ft4_oG.js';
4
4
  export { A as ApplicationContext, t as AuthorizedClient, B as BlockedClient, C as ContextChangedEvent, F as DEFAULT_TIMEOUT, o as DatabaseColumnInfo, m as DatabaseExecuteParams, k as DatabasePermission, d as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, n as DatabaseTableInfo, Y as EXTERNAL_EVENTS, z as ErrorCode, g as EventCallback, a as ExtensionInfo, v as ExternalAuthDecision, x as ExternalConnection, J as ExternalConnectionErrorCode, I as ExternalConnectionState, Z as ExternalEvent, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, O as FileChangeEvent, Q as FileChangeType, V as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, N as HaexVaultSdkError, X as HaextensionEvent, u as PendingAuthorization, P as PermissionResponse, y as PermissionStatus, R as RequestedExtension, p as SearchQuery, q as SearchRequestEvent, S as SearchResult, w as SessionAuthorization, U as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, L as canExternalClientSendRequests, G as getTableName, K as isExternalClientConnected } from './types-D4ft4_oG.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
@@ -310,6 +310,55 @@ declare const REMOTE_STORAGE_COMMANDS: {
310
310
  readonly list: "extension_remote_storage_list";
311
311
  };
312
312
 
313
+ /**
314
+ * LocalSend Commands
315
+ *
316
+ * Commands for LocalSend file sharing operations.
317
+ * These commands are used for both:
318
+ * - Tauri invoke (WebView extensions)
319
+ * - postMessage (iframe extensions)
320
+ *
321
+ * Naming convention: `localsend_<action>`
322
+ */
323
+ declare const LOCALSEND_COMMANDS: {
324
+ /** Initialize LocalSend (generate identity, etc.) */
325
+ readonly init: "localsend_init";
326
+ /** Get our device info */
327
+ readonly getDeviceInfo: "localsend_get_device_info";
328
+ /** Set our device alias */
329
+ readonly setAlias: "localsend_set_alias";
330
+ /** Get current settings */
331
+ readonly getSettings: "localsend_get_settings";
332
+ /** Update settings */
333
+ readonly setSettings: "localsend_set_settings";
334
+ /** Start device discovery via multicast UDP */
335
+ readonly startDiscovery: "localsend_start_discovery";
336
+ /** Stop device discovery */
337
+ readonly stopDiscovery: "localsend_stop_discovery";
338
+ /** Get list of discovered devices */
339
+ readonly getDevices: "localsend_get_devices";
340
+ /** Scan network for devices via HTTP */
341
+ readonly scanNetwork: "localsend_scan_network";
342
+ /** Start the HTTPS server for receiving files */
343
+ readonly startServer: "localsend_start_server";
344
+ /** Stop the HTTPS server */
345
+ readonly stopServer: "localsend_stop_server";
346
+ /** Get server status */
347
+ readonly getServerStatus: "localsend_get_server_status";
348
+ /** Get pending incoming transfer requests */
349
+ readonly getPendingTransfers: "localsend_get_pending_transfers";
350
+ /** Accept an incoming transfer */
351
+ readonly acceptTransfer: "localsend_accept_transfer";
352
+ /** Reject an incoming transfer */
353
+ readonly rejectTransfer: "localsend_reject_transfer";
354
+ /** Prepare files for sending - collect metadata */
355
+ readonly prepareFiles: "localsend_prepare_files";
356
+ /** Send files to a device */
357
+ readonly sendFiles: "localsend_send_files";
358
+ /** Cancel an outgoing transfer */
359
+ readonly cancelSend: "localsend_cancel_send";
360
+ };
361
+
313
362
  /**
314
363
  * Tauri Command Names
315
364
  *
@@ -403,8 +452,28 @@ declare const TAURI_COMMANDS: {
403
452
  readonly delete: "extension_remote_storage_delete";
404
453
  readonly list: "extension_remote_storage_list";
405
454
  };
455
+ readonly localsend: {
456
+ readonly init: "localsend_init";
457
+ readonly getDeviceInfo: "localsend_get_device_info";
458
+ readonly setAlias: "localsend_set_alias";
459
+ readonly getSettings: "localsend_get_settings";
460
+ readonly setSettings: "localsend_set_settings";
461
+ readonly startDiscovery: "localsend_start_discovery";
462
+ readonly stopDiscovery: "localsend_stop_discovery";
463
+ readonly getDevices: "localsend_get_devices";
464
+ readonly scanNetwork: "localsend_scan_network";
465
+ readonly startServer: "localsend_start_server";
466
+ readonly stopServer: "localsend_stop_server";
467
+ readonly getServerStatus: "localsend_get_server_status";
468
+ readonly getPendingTransfers: "localsend_get_pending_transfers";
469
+ readonly acceptTransfer: "localsend_accept_transfer";
470
+ readonly rejectTransfer: "localsend_reject_transfer";
471
+ readonly prepareFiles: "localsend_prepare_files";
472
+ readonly sendFiles: "localsend_send_files";
473
+ readonly cancelSend: "localsend_cancel_send";
474
+ };
406
475
  };
407
- type TauriCommand = (typeof DATABASE_COMMANDS)[keyof typeof DATABASE_COMMANDS] | (typeof PERMISSIONS_COMMANDS)[keyof typeof PERMISSIONS_COMMANDS] | (typeof WEB_COMMANDS)[keyof typeof WEB_COMMANDS] | (typeof WEB_STORAGE_COMMANDS)[keyof typeof WEB_STORAGE_COMMANDS] | (typeof FILESYSTEM_COMMANDS)[keyof typeof FILESYSTEM_COMMANDS] | (typeof EXTERNAL_BRIDGE_COMMANDS)[keyof typeof EXTERNAL_BRIDGE_COMMANDS] | (typeof EXTENSION_COMMANDS)[keyof typeof EXTENSION_COMMANDS] | (typeof REMOTE_STORAGE_COMMANDS)[keyof typeof REMOTE_STORAGE_COMMANDS];
476
+ type TauriCommand = (typeof DATABASE_COMMANDS)[keyof typeof DATABASE_COMMANDS] | (typeof PERMISSIONS_COMMANDS)[keyof typeof PERMISSIONS_COMMANDS] | (typeof WEB_COMMANDS)[keyof typeof WEB_COMMANDS] | (typeof WEB_STORAGE_COMMANDS)[keyof typeof WEB_STORAGE_COMMANDS] | (typeof FILESYSTEM_COMMANDS)[keyof typeof FILESYSTEM_COMMANDS] | (typeof EXTERNAL_BRIDGE_COMMANDS)[keyof typeof EXTERNAL_BRIDGE_COMMANDS] | (typeof EXTENSION_COMMANDS)[keyof typeof EXTENSION_COMMANDS] | (typeof REMOTE_STORAGE_COMMANDS)[keyof typeof REMOTE_STORAGE_COMMANDS] | (typeof LOCALSEND_COMMANDS)[keyof typeof LOCALSEND_COMMANDS];
408
477
 
409
478
  interface VerifyResult {
410
479
  valid: boolean;
package/dist/index.js CHANGED
@@ -633,6 +633,52 @@ var REMOTE_STORAGE_COMMANDS = {
633
633
  list: "extension_remote_storage_list"
634
634
  };
635
635
 
636
+ // src/commands/localsend.ts
637
+ var LOCALSEND_COMMANDS = {
638
+ // Initialization
639
+ /** Initialize LocalSend (generate identity, etc.) */
640
+ init: "localsend_init",
641
+ /** Get our device info */
642
+ getDeviceInfo: "localsend_get_device_info",
643
+ /** Set our device alias */
644
+ setAlias: "localsend_set_alias",
645
+ // Settings
646
+ /** Get current settings */
647
+ getSettings: "localsend_get_settings",
648
+ /** Update settings */
649
+ setSettings: "localsend_set_settings",
650
+ // Discovery (desktop only)
651
+ /** Start device discovery via multicast UDP */
652
+ startDiscovery: "localsend_start_discovery",
653
+ /** Stop device discovery */
654
+ stopDiscovery: "localsend_stop_discovery",
655
+ /** Get list of discovered devices */
656
+ getDevices: "localsend_get_devices",
657
+ // Network scan (mobile only)
658
+ /** Scan network for devices via HTTP */
659
+ scanNetwork: "localsend_scan_network",
660
+ // Server (receiving files)
661
+ /** Start the HTTPS server for receiving files */
662
+ startServer: "localsend_start_server",
663
+ /** Stop the HTTPS server */
664
+ stopServer: "localsend_stop_server",
665
+ /** Get server status */
666
+ getServerStatus: "localsend_get_server_status",
667
+ /** Get pending incoming transfer requests */
668
+ getPendingTransfers: "localsend_get_pending_transfers",
669
+ /** Accept an incoming transfer */
670
+ acceptTransfer: "localsend_accept_transfer",
671
+ /** Reject an incoming transfer */
672
+ rejectTransfer: "localsend_reject_transfer",
673
+ // Client (sending files)
674
+ /** Prepare files for sending - collect metadata */
675
+ prepareFiles: "localsend_prepare_files",
676
+ /** Send files to a device */
677
+ sendFiles: "localsend_send_files",
678
+ /** Cancel an outgoing transfer */
679
+ cancelSend: "localsend_cancel_send"
680
+ };
681
+
636
682
  // src/commands/index.ts
637
683
  var TAURI_COMMANDS = {
638
684
  database: DATABASE_COMMANDS,
@@ -642,7 +688,8 @@ var TAURI_COMMANDS = {
642
688
  filesystem: FILESYSTEM_COMMANDS,
643
689
  externalBridge: EXTERNAL_BRIDGE_COMMANDS,
644
690
  extension: EXTENSION_COMMANDS,
645
- remoteStorage: REMOTE_STORAGE_COMMANDS
691
+ remoteStorage: REMOTE_STORAGE_COMMANDS,
692
+ localsend: LOCALSEND_COMMANDS
646
693
  };
647
694
 
648
695
  // src/api/storage.ts
@@ -1473,6 +1520,177 @@ var BackendManagement = class {
1473
1520
  }
1474
1521
  };
1475
1522
 
1523
+ // src/api/localsend.ts
1524
+ var LOCALSEND_EVENTS = {
1525
+ /** New device discovered */
1526
+ deviceDiscovered: "localsend:device-discovered",
1527
+ /** Device lost (no longer visible) */
1528
+ deviceLost: "localsend:device-lost",
1529
+ /** New incoming transfer request */
1530
+ transferRequest: "localsend:transfer-request",
1531
+ /** Transfer progress update */
1532
+ transferProgress: "localsend:transfer-progress",
1533
+ /** Transfer completed */
1534
+ transferComplete: "localsend:transfer-complete",
1535
+ /** Transfer failed */
1536
+ transferFailed: "localsend:transfer-failed"
1537
+ };
1538
+ var LocalSendAPI = class {
1539
+ constructor(client) {
1540
+ this.client = client;
1541
+ }
1542
+ // ==========================================================================
1543
+ // Initialization
1544
+ // ==========================================================================
1545
+ /**
1546
+ * Initialize LocalSend (generate identity, etc.)
1547
+ * Call this on app start
1548
+ * @returns Our device info
1549
+ */
1550
+ async init() {
1551
+ return this.client.request(LOCALSEND_COMMANDS.init, {});
1552
+ }
1553
+ /**
1554
+ * Get our device info
1555
+ * @returns Our device info
1556
+ */
1557
+ async getDeviceInfo() {
1558
+ return this.client.request(LOCALSEND_COMMANDS.getDeviceInfo, {});
1559
+ }
1560
+ /**
1561
+ * Set our device alias (display name)
1562
+ * @param alias New alias
1563
+ */
1564
+ async setAlias(alias) {
1565
+ await this.client.request(LOCALSEND_COMMANDS.setAlias, { alias });
1566
+ }
1567
+ // ==========================================================================
1568
+ // Settings
1569
+ // ==========================================================================
1570
+ /**
1571
+ * Get current LocalSend settings
1572
+ * @returns Settings
1573
+ */
1574
+ async getSettings() {
1575
+ return this.client.request(LOCALSEND_COMMANDS.getSettings, {});
1576
+ }
1577
+ /**
1578
+ * Update LocalSend settings
1579
+ * @param settings New settings
1580
+ */
1581
+ async setSettings(settings) {
1582
+ await this.client.request(LOCALSEND_COMMANDS.setSettings, { settings });
1583
+ }
1584
+ // ==========================================================================
1585
+ // Discovery (Desktop only - multicast UDP)
1586
+ // ==========================================================================
1587
+ /**
1588
+ * Start device discovery via multicast UDP
1589
+ * Desktop only - on mobile use scanNetwork()
1590
+ */
1591
+ async startDiscovery() {
1592
+ await this.client.request(LOCALSEND_COMMANDS.startDiscovery, {});
1593
+ }
1594
+ /**
1595
+ * Stop device discovery
1596
+ * Desktop only
1597
+ */
1598
+ async stopDiscovery() {
1599
+ await this.client.request(LOCALSEND_COMMANDS.stopDiscovery, {});
1600
+ }
1601
+ /**
1602
+ * Get list of discovered devices
1603
+ * @returns Array of discovered devices
1604
+ */
1605
+ async getDevices() {
1606
+ return this.client.request(LOCALSEND_COMMANDS.getDevices, {});
1607
+ }
1608
+ // ==========================================================================
1609
+ // Network Scan (Mobile only - HTTP)
1610
+ // ==========================================================================
1611
+ /**
1612
+ * Scan network for devices via HTTP
1613
+ * Mobile only - on desktop use startDiscovery()
1614
+ * @returns Array of discovered devices
1615
+ */
1616
+ async scanNetwork() {
1617
+ return this.client.request(LOCALSEND_COMMANDS.scanNetwork, {});
1618
+ }
1619
+ // ==========================================================================
1620
+ // Server (Receiving files)
1621
+ // ==========================================================================
1622
+ /**
1623
+ * Start the HTTPS server for receiving files
1624
+ * @param port Optional port to listen on (default: 53317)
1625
+ * @returns Server info with port, fingerprint, and addresses
1626
+ */
1627
+ async startServer(port) {
1628
+ return this.client.request(LOCALSEND_COMMANDS.startServer, { port });
1629
+ }
1630
+ /**
1631
+ * Stop the HTTPS server
1632
+ */
1633
+ async stopServer() {
1634
+ await this.client.request(LOCALSEND_COMMANDS.stopServer, {});
1635
+ }
1636
+ /**
1637
+ * Get server status
1638
+ * @returns Server status
1639
+ */
1640
+ async getServerStatus() {
1641
+ return this.client.request(LOCALSEND_COMMANDS.getServerStatus, {});
1642
+ }
1643
+ /**
1644
+ * Get pending incoming transfer requests
1645
+ * @returns Array of pending transfers
1646
+ */
1647
+ async getPendingTransfers() {
1648
+ return this.client.request(LOCALSEND_COMMANDS.getPendingTransfers, {});
1649
+ }
1650
+ /**
1651
+ * Accept an incoming transfer
1652
+ * @param sessionId Session ID of the transfer
1653
+ * @param saveDir Directory to save files to
1654
+ */
1655
+ async acceptTransfer(sessionId, saveDir) {
1656
+ await this.client.request(LOCALSEND_COMMANDS.acceptTransfer, { sessionId, saveDir });
1657
+ }
1658
+ /**
1659
+ * Reject an incoming transfer
1660
+ * @param sessionId Session ID of the transfer
1661
+ */
1662
+ async rejectTransfer(sessionId) {
1663
+ await this.client.request(LOCALSEND_COMMANDS.rejectTransfer, { sessionId });
1664
+ }
1665
+ // ==========================================================================
1666
+ // Client (Sending files)
1667
+ // ==========================================================================
1668
+ /**
1669
+ * Prepare files for sending - collect metadata
1670
+ * @param paths Array of file/folder paths to send
1671
+ * @returns Array of file info with metadata
1672
+ */
1673
+ async prepareFiles(paths) {
1674
+ return this.client.request(LOCALSEND_COMMANDS.prepareFiles, { paths });
1675
+ }
1676
+ /**
1677
+ * Send files to a device
1678
+ * @param device Target device
1679
+ * @param files Files to send (from prepareFiles)
1680
+ * @returns Session ID for tracking progress
1681
+ */
1682
+ async sendFiles(device, files) {
1683
+ return this.client.request(LOCALSEND_COMMANDS.sendFiles, { device, files });
1684
+ }
1685
+ /**
1686
+ * Cancel an outgoing transfer
1687
+ * @param sessionId Session ID of the transfer
1688
+ */
1689
+ async cancelSend(sessionId) {
1690
+ await this.client.request(LOCALSEND_COMMANDS.cancelSend, { sessionId });
1691
+ }
1692
+ };
1693
+
1476
1694
  // src/client/tableName.ts
1477
1695
  function validatePublicKey(publicKey) {
1478
1696
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
@@ -2004,6 +2222,7 @@ var HaexVaultSdk = class {
2004
2222
  this.web = new WebAPI(this);
2005
2223
  this.permissions = new PermissionsAPI(this);
2006
2224
  this.remoteStorage = new RemoteStorageAPI(this);
2225
+ this.localsend = new LocalSendAPI(this);
2007
2226
  installConsoleForwarding(this.config.debug);
2008
2227
  this.readyPromise = new Promise((resolve) => {
2009
2228
  this.resolveReady = resolve;
@@ -2592,6 +2811,8 @@ exports.HAEXSPACE_MESSAGE_TYPES = HAEXSPACE_MESSAGE_TYPES;
2592
2811
  exports.HAEXTENSION_EVENTS = HAEXTENSION_EVENTS;
2593
2812
  exports.HaexVaultSdk = HaexVaultSdk;
2594
2813
  exports.HaexVaultSdkError = HaexVaultSdkError;
2814
+ exports.LOCALSEND_EVENTS = LOCALSEND_EVENTS;
2815
+ exports.LocalSendAPI = LocalSendAPI;
2595
2816
  exports.PermissionStatus = PermissionStatus;
2596
2817
  exports.PermissionsAPI = PermissionsAPI;
2597
2818
  exports.RemoteStorageAPI = RemoteStorageAPI;