@haex-space/vault-sdk 2.5.42 → 2.5.43

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.
@@ -502,6 +502,64 @@ interface ShowImageResult {
502
502
  */
503
503
  success: boolean;
504
504
  }
505
+ /**
506
+ * File/directory metadata
507
+ */
508
+ interface FileStat {
509
+ /** File size in bytes */
510
+ size: number;
511
+ /** True if this is a file */
512
+ isFile: boolean;
513
+ /** True if this is a directory */
514
+ isDirectory: boolean;
515
+ /** True if this is a symbolic link */
516
+ isSymlink: boolean;
517
+ /** Last modified time (Unix timestamp in milliseconds) */
518
+ modified?: number;
519
+ /** Created time (Unix timestamp in milliseconds) */
520
+ created?: number;
521
+ /** Whether the file is read-only */
522
+ readonly: boolean;
523
+ }
524
+ /**
525
+ * Directory entry
526
+ */
527
+ interface DirEntry {
528
+ /** Entry name (not full path) */
529
+ name: string;
530
+ /** Full path */
531
+ path: string;
532
+ /** True if this is a file */
533
+ isFile: boolean;
534
+ /** True if this is a directory */
535
+ isDirectory: boolean;
536
+ /** File size in bytes (0 for directories) */
537
+ size: number;
538
+ /** Last modified time (Unix timestamp in milliseconds) */
539
+ modified?: number;
540
+ }
541
+ /**
542
+ * Options for selecting a folder
543
+ */
544
+ interface SelectFolderOptions {
545
+ /** Dialog title */
546
+ title?: string;
547
+ /** Default path to open */
548
+ defaultPath?: string;
549
+ }
550
+ /**
551
+ * Options for selecting files
552
+ */
553
+ interface SelectFileOptions {
554
+ /** Dialog title */
555
+ title?: string;
556
+ /** Default path to open */
557
+ defaultPath?: string;
558
+ /** File filters (name -> extensions) */
559
+ filters?: Array<[string, string[]]>;
560
+ /** Allow multiple file selection */
561
+ multiple?: boolean;
562
+ }
505
563
  declare class FilesystemAPI {
506
564
  private client;
507
565
  readonly sync: FileSyncAPI;
@@ -528,6 +586,71 @@ declare class FilesystemAPI {
528
586
  * @returns The result of the operation
529
587
  */
530
588
  showImageAsync(options: ShowImageOptions): Promise<ShowImageResult>;
589
+ /**
590
+ * Read file contents
591
+ * @param path Absolute path to the file
592
+ * @returns File contents as Uint8Array
593
+ */
594
+ readFile(path: string): Promise<Uint8Array>;
595
+ /**
596
+ * Write file contents
597
+ * @param path Absolute path to the file
598
+ * @param data File contents as Uint8Array
599
+ */
600
+ writeFile(path: string, data: Uint8Array): Promise<void>;
601
+ /**
602
+ * Read directory contents
603
+ * @param path Absolute path to the directory
604
+ * @returns Array of directory entries
605
+ */
606
+ readDir(path: string): Promise<DirEntry[]>;
607
+ /**
608
+ * Create a directory (and parent directories if needed)
609
+ * @param path Absolute path to create
610
+ */
611
+ mkdir(path: string): Promise<void>;
612
+ /**
613
+ * Remove a file or directory
614
+ * @param path Absolute path to remove
615
+ * @param recursive If true, remove directories recursively
616
+ */
617
+ remove(path: string, recursive?: boolean): Promise<void>;
618
+ /**
619
+ * Check if a path exists
620
+ * @param path Absolute path to check
621
+ * @returns True if the path exists
622
+ */
623
+ exists(path: string): Promise<boolean>;
624
+ /**
625
+ * Get file/directory metadata
626
+ * @param path Absolute path
627
+ * @returns File metadata
628
+ */
629
+ stat(path: string): Promise<FileStat>;
630
+ /**
631
+ * Open a folder selection dialog
632
+ * @param options Dialog options
633
+ * @returns Selected folder path, or null if cancelled
634
+ */
635
+ selectFolder(options?: SelectFolderOptions): Promise<string | null>;
636
+ /**
637
+ * Open a file selection dialog
638
+ * @param options Dialog options
639
+ * @returns Selected file paths, or null if cancelled
640
+ */
641
+ selectFile(options?: SelectFileOptions): Promise<string[] | null>;
642
+ /**
643
+ * Rename/move a file or directory
644
+ * @param from Source path
645
+ * @param to Destination path
646
+ */
647
+ rename(from: string, to: string): Promise<void>;
648
+ /**
649
+ * Copy a file
650
+ * @param from Source path
651
+ * @param to Destination path
652
+ */
653
+ copy(from: string, to: string): Promise<void>;
531
654
  }
532
655
 
533
656
  declare class WebAPI {
@@ -791,4 +914,4 @@ declare class HaexVaultSdk {
791
914
  private log;
792
915
  }
793
916
 
794
- export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueSummary as E, FilesystemAPI as F, type GetQueueOptions as G, HaexVaultSdk as H, FILE_SYNC_STATE as I, SYNC_DIRECTION as J, STORAGE_BACKEND_TYPE as K, type ListFilesOptions as L, CONFLICT_STRATEGY as M, QUEUE_OPERATION as N, QUEUE_STATUS as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, type UpdateSyncRuleOptions as U, WebAPI as W, FileSyncAPI as a, type StorageBackendInfo as b, type S3Config as c, type StorageObjectInfo as d, type FileSpace as e, type FileInfo as f, type FileSyncState as g, type StorageBackendInfo$1 as h, type StorageBackendType as i, type S3BackendConfig as j, type SyncRule as k, type SyncDirection as l, type SyncStatus as m, type SyncError as n, type SyncProgress as o, type CreateSpaceOptions as p, type AddBackendOptions as q, type AddSyncRuleOptions as r, type ScanLocalOptions as s, type UploadFileOptions as t, type DownloadFileOptions as u, type LocalFileInfo as v, type QueueStatus as w, type SyncQueueEntry as x, type AddToQueueOptions as y, type QueueFileEntry as z };
917
+ export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueStatus as E, FilesystemAPI as F, type SyncQueueEntry as G, HaexVaultSdk as H, type AddToQueueOptions as I, type QueueFileEntry as J, type GetQueueOptions as K, type ListFilesOptions as L, type QueueSummary as M, FILE_SYNC_STATE as N, SYNC_DIRECTION as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, STORAGE_BACKEND_TYPE as T, type UpdateSyncRuleOptions as U, CONFLICT_STRATEGY as V, WebAPI as W, QUEUE_OPERATION as X, QUEUE_STATUS as Y, type FileStat as a, type DirEntry as b, type SelectFolderOptions as c, type SelectFileOptions as d, FileSyncAPI as e, type StorageBackendInfo as f, type S3Config as g, type StorageObjectInfo as h, type FileSpace as i, type FileInfo as j, type FileSyncState as k, type StorageBackendInfo$1 as l, type StorageBackendType as m, type S3BackendConfig as n, type SyncRule as o, type SyncDirection as p, type SyncStatus as q, type SyncError as r, type SyncProgress as s, type CreateSpaceOptions as t, type AddBackendOptions as u, type AddSyncRuleOptions as v, type ScanLocalOptions as w, type UploadFileOptions as x, type DownloadFileOptions as y, type LocalFileInfo as z };
@@ -502,6 +502,64 @@ interface ShowImageResult {
502
502
  */
503
503
  success: boolean;
504
504
  }
505
+ /**
506
+ * File/directory metadata
507
+ */
508
+ interface FileStat {
509
+ /** File size in bytes */
510
+ size: number;
511
+ /** True if this is a file */
512
+ isFile: boolean;
513
+ /** True if this is a directory */
514
+ isDirectory: boolean;
515
+ /** True if this is a symbolic link */
516
+ isSymlink: boolean;
517
+ /** Last modified time (Unix timestamp in milliseconds) */
518
+ modified?: number;
519
+ /** Created time (Unix timestamp in milliseconds) */
520
+ created?: number;
521
+ /** Whether the file is read-only */
522
+ readonly: boolean;
523
+ }
524
+ /**
525
+ * Directory entry
526
+ */
527
+ interface DirEntry {
528
+ /** Entry name (not full path) */
529
+ name: string;
530
+ /** Full path */
531
+ path: string;
532
+ /** True if this is a file */
533
+ isFile: boolean;
534
+ /** True if this is a directory */
535
+ isDirectory: boolean;
536
+ /** File size in bytes (0 for directories) */
537
+ size: number;
538
+ /** Last modified time (Unix timestamp in milliseconds) */
539
+ modified?: number;
540
+ }
541
+ /**
542
+ * Options for selecting a folder
543
+ */
544
+ interface SelectFolderOptions {
545
+ /** Dialog title */
546
+ title?: string;
547
+ /** Default path to open */
548
+ defaultPath?: string;
549
+ }
550
+ /**
551
+ * Options for selecting files
552
+ */
553
+ interface SelectFileOptions {
554
+ /** Dialog title */
555
+ title?: string;
556
+ /** Default path to open */
557
+ defaultPath?: string;
558
+ /** File filters (name -> extensions) */
559
+ filters?: Array<[string, string[]]>;
560
+ /** Allow multiple file selection */
561
+ multiple?: boolean;
562
+ }
505
563
  declare class FilesystemAPI {
506
564
  private client;
507
565
  readonly sync: FileSyncAPI;
@@ -528,6 +586,71 @@ declare class FilesystemAPI {
528
586
  * @returns The result of the operation
529
587
  */
530
588
  showImageAsync(options: ShowImageOptions): Promise<ShowImageResult>;
589
+ /**
590
+ * Read file contents
591
+ * @param path Absolute path to the file
592
+ * @returns File contents as Uint8Array
593
+ */
594
+ readFile(path: string): Promise<Uint8Array>;
595
+ /**
596
+ * Write file contents
597
+ * @param path Absolute path to the file
598
+ * @param data File contents as Uint8Array
599
+ */
600
+ writeFile(path: string, data: Uint8Array): Promise<void>;
601
+ /**
602
+ * Read directory contents
603
+ * @param path Absolute path to the directory
604
+ * @returns Array of directory entries
605
+ */
606
+ readDir(path: string): Promise<DirEntry[]>;
607
+ /**
608
+ * Create a directory (and parent directories if needed)
609
+ * @param path Absolute path to create
610
+ */
611
+ mkdir(path: string): Promise<void>;
612
+ /**
613
+ * Remove a file or directory
614
+ * @param path Absolute path to remove
615
+ * @param recursive If true, remove directories recursively
616
+ */
617
+ remove(path: string, recursive?: boolean): Promise<void>;
618
+ /**
619
+ * Check if a path exists
620
+ * @param path Absolute path to check
621
+ * @returns True if the path exists
622
+ */
623
+ exists(path: string): Promise<boolean>;
624
+ /**
625
+ * Get file/directory metadata
626
+ * @param path Absolute path
627
+ * @returns File metadata
628
+ */
629
+ stat(path: string): Promise<FileStat>;
630
+ /**
631
+ * Open a folder selection dialog
632
+ * @param options Dialog options
633
+ * @returns Selected folder path, or null if cancelled
634
+ */
635
+ selectFolder(options?: SelectFolderOptions): Promise<string | null>;
636
+ /**
637
+ * Open a file selection dialog
638
+ * @param options Dialog options
639
+ * @returns Selected file paths, or null if cancelled
640
+ */
641
+ selectFile(options?: SelectFileOptions): Promise<string[] | null>;
642
+ /**
643
+ * Rename/move a file or directory
644
+ * @param from Source path
645
+ * @param to Destination path
646
+ */
647
+ rename(from: string, to: string): Promise<void>;
648
+ /**
649
+ * Copy a file
650
+ * @param from Source path
651
+ * @param to Destination path
652
+ */
653
+ copy(from: string, to: string): Promise<void>;
531
654
  }
532
655
 
533
656
  declare class WebAPI {
@@ -791,4 +914,4 @@ declare class HaexVaultSdk {
791
914
  private log;
792
915
  }
793
916
 
794
- export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueSummary as E, FilesystemAPI as F, type GetQueueOptions as G, HaexVaultSdk as H, FILE_SYNC_STATE as I, SYNC_DIRECTION as J, STORAGE_BACKEND_TYPE as K, type ListFilesOptions as L, CONFLICT_STRATEGY as M, QUEUE_OPERATION as N, QUEUE_STATUS as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, type UpdateSyncRuleOptions as U, WebAPI as W, FileSyncAPI as a, type StorageBackendInfo as b, type S3Config as c, type StorageObjectInfo as d, type FileSpace as e, type FileInfo as f, type FileSyncState as g, type StorageBackendInfo$1 as h, type StorageBackendType as i, type S3BackendConfig as j, type SyncRule as k, type SyncDirection as l, type SyncStatus as m, type SyncError as n, type SyncProgress as o, type CreateSpaceOptions as p, type AddBackendOptions as q, type AddSyncRuleOptions as r, type ScanLocalOptions as s, type UploadFileOptions as t, type DownloadFileOptions as u, type LocalFileInfo as v, type QueueStatus as w, type SyncQueueEntry as x, type AddToQueueOptions as y, type QueueFileEntry as z };
917
+ export { type AddBackendRequest as A, type BackendConfig as B, type ConflictStrategy as C, DatabaseAPI as D, type QueueStatus as E, FilesystemAPI as F, type SyncQueueEntry as G, HaexVaultSdk as H, type AddToQueueOptions as I, type QueueFileEntry as J, type GetQueueOptions as K, type ListFilesOptions as L, type QueueSummary as M, FILE_SYNC_STATE as N, SYNC_DIRECTION as O, PermissionsAPI as P, type QueueOperation as Q, RemoteStorageAPI as R, StorageAPI as S, STORAGE_BACKEND_TYPE as T, type UpdateSyncRuleOptions as U, CONFLICT_STRATEGY as V, WebAPI as W, QUEUE_OPERATION as X, QUEUE_STATUS as Y, type FileStat as a, type DirEntry as b, type SelectFolderOptions as c, type SelectFileOptions as d, FileSyncAPI as e, type StorageBackendInfo as f, type S3Config as g, type StorageObjectInfo as h, type FileSpace as i, type FileInfo as j, type FileSyncState as k, type StorageBackendInfo$1 as l, type StorageBackendType as m, type S3BackendConfig as n, type SyncRule as o, type SyncDirection as p, type SyncStatus as q, type SyncError as r, type SyncProgress as s, type CreateSpaceOptions as t, type AddBackendOptions as u, type AddSyncRuleOptions as v, type ScanLocalOptions as w, type UploadFileOptions as x, type DownloadFileOptions as y, type LocalFileInfo as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HaexVaultSdk } from './client-BAu3VPE3.mjs';
2
- export { q as AddBackendOptions, r as AddSyncRuleOptions, y as AddToQueueOptions, B as BackendConfig, M as CONFLICT_STRATEGY, C as ConflictStrategy, p as CreateSpaceOptions, D as DatabaseAPI, u as DownloadFileOptions, I as FILE_SYNC_STATE, f as FileInfo, e as FileSpace, a as FileSyncAPI, g as FileSyncState, F as FilesystemAPI, G as GetQueueOptions, L as ListFilesOptions, v as LocalFileInfo, P as PermissionsAPI, N as QUEUE_OPERATION, O as QUEUE_STATUS, z as QueueFileEntry, Q as QueueOperation, w as QueueStatus, E as QueueSummary, A as RemoteAddBackendRequest, c as RemoteS3Config, R as RemoteStorageAPI, b as RemoteStorageBackendInfo, d as RemoteStorageObjectInfo, j as S3BackendConfig, K as STORAGE_BACKEND_TYPE, J as SYNC_DIRECTION, s as ScanLocalOptions, h as StorageBackendInfo, i as StorageBackendType, l as SyncDirection, n as SyncError, o as SyncProgress, x as SyncQueueEntry, k as SyncRule, m as SyncStatus, U as UpdateSyncRuleOptions, t as UploadFileOptions, W as WebAPI } from './client-BAu3VPE3.mjs';
1
+ import { H as HaexVaultSdk } from './client-9QruY0rX.mjs';
2
+ export { u as AddBackendOptions, v as AddSyncRuleOptions, I as AddToQueueOptions, B as BackendConfig, V as CONFLICT_STRATEGY, C as ConflictStrategy, t as CreateSpaceOptions, D as DatabaseAPI, b as DirEntry, y as DownloadFileOptions, N as FILE_SYNC_STATE, j as FileInfo, i as FileSpace, a as FileStat, e as FileSyncAPI, k as FileSyncState, F as FilesystemAPI, K as GetQueueOptions, L as ListFilesOptions, z as LocalFileInfo, P as PermissionsAPI, X as QUEUE_OPERATION, Y as QUEUE_STATUS, J as QueueFileEntry, Q as QueueOperation, E as QueueStatus, M as QueueSummary, A as RemoteAddBackendRequest, g as RemoteS3Config, R as RemoteStorageAPI, f as RemoteStorageBackendInfo, h as RemoteStorageObjectInfo, n as S3BackendConfig, T as STORAGE_BACKEND_TYPE, O as SYNC_DIRECTION, w as ScanLocalOptions, d as SelectFileOptions, c as SelectFolderOptions, l as StorageBackendInfo, m as StorageBackendType, p as SyncDirection, r as SyncError, s as SyncProgress, G as SyncQueueEntry, o as SyncRule, q as SyncStatus, U as UpdateSyncRuleOptions, x as UploadFileOptions, W as WebAPI } from './client-9QruY0rX.mjs';
3
3
  import { E as ExtensionManifest, H as HaexHubConfig } from './types-DiXJ5SF6.mjs';
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, U as EXTERNAL_EVENTS, z as ErrorCode, g as EventCallback, a as ExtensionInfo, v as ExternalAuthDecision, x as ExternalConnection, J as ExternalConnectionErrorCode, I as ExternalConnectionState, V as ExternalEvent, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, O as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, N as HaexVaultSdkError, Q 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, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, L as canExternalClientSendRequests, G as getTableName, K as isExternalClientConnected } from './types-DiXJ5SF6.mjs';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
@@ -103,6 +103,17 @@ declare const HAEXTENSION_METHODS: {
103
103
  readonly saveFile: "haextension:filesystem:save-file";
104
104
  readonly openFile: "haextension:filesystem:open-file";
105
105
  readonly showImage: "haextension:filesystem:show-image";
106
+ readonly readFile: "haextension:filesystem:read-file";
107
+ readonly writeFile: "haextension:filesystem:write-file";
108
+ readonly readDir: "haextension:filesystem:read-dir";
109
+ readonly mkdir: "haextension:filesystem:mkdir";
110
+ readonly remove: "haextension:filesystem:remove";
111
+ readonly exists: "haextension:filesystem:exists";
112
+ readonly stat: "haextension:filesystem:stat";
113
+ readonly selectFolder: "haextension:filesystem:select-folder";
114
+ readonly selectFile: "haextension:filesystem:select-file";
115
+ readonly rename: "haextension:filesystem:rename";
116
+ readonly copy: "haextension:filesystem:copy";
106
117
  };
107
118
  readonly filesync: {
108
119
  readonly listSpaces: "haextension:filesync:list-spaces";
@@ -206,6 +217,17 @@ declare const TAURI_COMMANDS: {
206
217
  readonly saveFile: "webview_extension_fs_save_file";
207
218
  readonly openFile: "webview_extension_fs_open_file";
208
219
  readonly showImage: "webview_extension_fs_show_image";
220
+ readonly readFile: "filesystem_read_file";
221
+ readonly writeFile: "filesystem_write_file";
222
+ readonly readDir: "filesystem_read_dir";
223
+ readonly mkdir: "filesystem_mkdir";
224
+ readonly remove: "filesystem_remove";
225
+ readonly exists: "filesystem_exists";
226
+ readonly stat: "filesystem_stat";
227
+ readonly selectFolder: "filesystem_select_folder";
228
+ readonly selectFile: "filesystem_select_file";
229
+ readonly rename: "filesystem_rename";
230
+ readonly copy: "filesystem_copy";
209
231
  };
210
232
  readonly external: {
211
233
  readonly respond: "webview_extension_external_respond";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HaexVaultSdk } from './client-CF0wJxT2.js';
2
- export { q as AddBackendOptions, r as AddSyncRuleOptions, y as AddToQueueOptions, B as BackendConfig, M as CONFLICT_STRATEGY, C as ConflictStrategy, p as CreateSpaceOptions, D as DatabaseAPI, u as DownloadFileOptions, I as FILE_SYNC_STATE, f as FileInfo, e as FileSpace, a as FileSyncAPI, g as FileSyncState, F as FilesystemAPI, G as GetQueueOptions, L as ListFilesOptions, v as LocalFileInfo, P as PermissionsAPI, N as QUEUE_OPERATION, O as QUEUE_STATUS, z as QueueFileEntry, Q as QueueOperation, w as QueueStatus, E as QueueSummary, A as RemoteAddBackendRequest, c as RemoteS3Config, R as RemoteStorageAPI, b as RemoteStorageBackendInfo, d as RemoteStorageObjectInfo, j as S3BackendConfig, K as STORAGE_BACKEND_TYPE, J as SYNC_DIRECTION, s as ScanLocalOptions, h as StorageBackendInfo, i as StorageBackendType, l as SyncDirection, n as SyncError, o as SyncProgress, x as SyncQueueEntry, k as SyncRule, m as SyncStatus, U as UpdateSyncRuleOptions, t as UploadFileOptions, W as WebAPI } from './client-CF0wJxT2.js';
1
+ import { H as HaexVaultSdk } from './client-Bp4IqvzW.js';
2
+ export { u as AddBackendOptions, v as AddSyncRuleOptions, I as AddToQueueOptions, B as BackendConfig, V as CONFLICT_STRATEGY, C as ConflictStrategy, t as CreateSpaceOptions, D as DatabaseAPI, b as DirEntry, y as DownloadFileOptions, N as FILE_SYNC_STATE, j as FileInfo, i as FileSpace, a as FileStat, e as FileSyncAPI, k as FileSyncState, F as FilesystemAPI, K as GetQueueOptions, L as ListFilesOptions, z as LocalFileInfo, P as PermissionsAPI, X as QUEUE_OPERATION, Y as QUEUE_STATUS, J as QueueFileEntry, Q as QueueOperation, E as QueueStatus, M as QueueSummary, A as RemoteAddBackendRequest, g as RemoteS3Config, R as RemoteStorageAPI, f as RemoteStorageBackendInfo, h as RemoteStorageObjectInfo, n as S3BackendConfig, T as STORAGE_BACKEND_TYPE, O as SYNC_DIRECTION, w as ScanLocalOptions, d as SelectFileOptions, c as SelectFolderOptions, l as StorageBackendInfo, m as StorageBackendType, p as SyncDirection, r as SyncError, s as SyncProgress, G as SyncQueueEntry, o as SyncRule, q as SyncStatus, U as UpdateSyncRuleOptions, x as UploadFileOptions, W as WebAPI } from './client-Bp4IqvzW.js';
3
3
  import { E as ExtensionManifest, H as HaexHubConfig } from './types-DiXJ5SF6.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, U as EXTERNAL_EVENTS, z as ErrorCode, g as EventCallback, a as ExtensionInfo, v as ExternalAuthDecision, x as ExternalConnection, J as ExternalConnectionErrorCode, I as ExternalConnectionState, V as ExternalEvent, s as ExternalRequest, r as ExternalRequestEvent, e as ExternalRequestHandler, f as ExternalResponse, O as HAEXTENSION_EVENTS, j as HaexHubEvent, h as HaexHubRequest, i as HaexHubResponse, N as HaexVaultSdkError, Q 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, T as TABLE_SEPARATOR, W as WebRequestOptions, c as WebResponse, L as canExternalClientSendRequests, G as getTableName, K as isExternalClientConnected } from './types-DiXJ5SF6.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
@@ -103,6 +103,17 @@ declare const HAEXTENSION_METHODS: {
103
103
  readonly saveFile: "haextension:filesystem:save-file";
104
104
  readonly openFile: "haextension:filesystem:open-file";
105
105
  readonly showImage: "haextension:filesystem:show-image";
106
+ readonly readFile: "haextension:filesystem:read-file";
107
+ readonly writeFile: "haextension:filesystem:write-file";
108
+ readonly readDir: "haextension:filesystem:read-dir";
109
+ readonly mkdir: "haextension:filesystem:mkdir";
110
+ readonly remove: "haextension:filesystem:remove";
111
+ readonly exists: "haextension:filesystem:exists";
112
+ readonly stat: "haextension:filesystem:stat";
113
+ readonly selectFolder: "haextension:filesystem:select-folder";
114
+ readonly selectFile: "haextension:filesystem:select-file";
115
+ readonly rename: "haextension:filesystem:rename";
116
+ readonly copy: "haextension:filesystem:copy";
106
117
  };
107
118
  readonly filesync: {
108
119
  readonly listSpaces: "haextension:filesync:list-spaces";
@@ -206,6 +217,17 @@ declare const TAURI_COMMANDS: {
206
217
  readonly saveFile: "webview_extension_fs_save_file";
207
218
  readonly openFile: "webview_extension_fs_open_file";
208
219
  readonly showImage: "webview_extension_fs_show_image";
220
+ readonly readFile: "filesystem_read_file";
221
+ readonly writeFile: "filesystem_write_file";
222
+ readonly readDir: "filesystem_read_dir";
223
+ readonly mkdir: "filesystem_mkdir";
224
+ readonly remove: "filesystem_remove";
225
+ readonly exists: "filesystem_exists";
226
+ readonly stat: "filesystem_stat";
227
+ readonly selectFolder: "filesystem_select_folder";
228
+ readonly selectFile: "filesystem_select_file";
229
+ readonly rename: "filesystem_rename";
230
+ readonly copy: "filesystem_copy";
209
231
  };
210
232
  readonly external: {
211
233
  readonly respond: "webview_extension_external_respond";
package/dist/index.js CHANGED
@@ -487,7 +487,19 @@ var HAEXTENSION_METHODS = {
487
487
  filesystem: {
488
488
  saveFile: "haextension:filesystem:save-file",
489
489
  openFile: "haextension:filesystem:open-file",
490
- showImage: "haextension:filesystem:show-image"
490
+ showImage: "haextension:filesystem:show-image",
491
+ // Generic FS operations (Phase 2)
492
+ readFile: "haextension:filesystem:read-file",
493
+ writeFile: "haextension:filesystem:write-file",
494
+ readDir: "haextension:filesystem:read-dir",
495
+ mkdir: "haextension:filesystem:mkdir",
496
+ remove: "haextension:filesystem:remove",
497
+ exists: "haextension:filesystem:exists",
498
+ stat: "haextension:filesystem:stat",
499
+ selectFolder: "haextension:filesystem:select-folder",
500
+ selectFile: "haextension:filesystem:select-file",
501
+ rename: "haextension:filesystem:rename",
502
+ copy: "haextension:filesystem:copy"
491
503
  },
492
504
  filesync: {
493
505
  // Spaces
@@ -1077,6 +1089,136 @@ var FilesystemAPI = class {
1077
1089
  );
1078
1090
  return result;
1079
1091
  }
1092
+ // ==========================================================================
1093
+ // Generic Filesystem Operations (Phase 2)
1094
+ // ==========================================================================
1095
+ /**
1096
+ * Read file contents
1097
+ * @param path Absolute path to the file
1098
+ * @returns File contents as Uint8Array
1099
+ */
1100
+ async readFile(path) {
1101
+ const base64 = await this.client.request(
1102
+ HAEXTENSION_METHODS.filesystem.readFile,
1103
+ { path }
1104
+ );
1105
+ const binary = atob(base64);
1106
+ const bytes = new Uint8Array(binary.length);
1107
+ for (let i = 0; i < binary.length; i++) {
1108
+ bytes[i] = binary.charCodeAt(i);
1109
+ }
1110
+ return bytes;
1111
+ }
1112
+ /**
1113
+ * Write file contents
1114
+ * @param path Absolute path to the file
1115
+ * @param data File contents as Uint8Array
1116
+ */
1117
+ async writeFile(path, data) {
1118
+ const base64 = btoa(String.fromCharCode(...data));
1119
+ await this.client.request(
1120
+ HAEXTENSION_METHODS.filesystem.writeFile,
1121
+ { path, data: base64 }
1122
+ );
1123
+ }
1124
+ /**
1125
+ * Read directory contents
1126
+ * @param path Absolute path to the directory
1127
+ * @returns Array of directory entries
1128
+ */
1129
+ async readDir(path) {
1130
+ return this.client.request(
1131
+ HAEXTENSION_METHODS.filesystem.readDir,
1132
+ { path }
1133
+ );
1134
+ }
1135
+ /**
1136
+ * Create a directory (and parent directories if needed)
1137
+ * @param path Absolute path to create
1138
+ */
1139
+ async mkdir(path) {
1140
+ await this.client.request(
1141
+ HAEXTENSION_METHODS.filesystem.mkdir,
1142
+ { path }
1143
+ );
1144
+ }
1145
+ /**
1146
+ * Remove a file or directory
1147
+ * @param path Absolute path to remove
1148
+ * @param recursive If true, remove directories recursively
1149
+ */
1150
+ async remove(path, recursive = false) {
1151
+ await this.client.request(
1152
+ HAEXTENSION_METHODS.filesystem.remove,
1153
+ { path, recursive }
1154
+ );
1155
+ }
1156
+ /**
1157
+ * Check if a path exists
1158
+ * @param path Absolute path to check
1159
+ * @returns True if the path exists
1160
+ */
1161
+ async exists(path) {
1162
+ return this.client.request(
1163
+ HAEXTENSION_METHODS.filesystem.exists,
1164
+ { path }
1165
+ );
1166
+ }
1167
+ /**
1168
+ * Get file/directory metadata
1169
+ * @param path Absolute path
1170
+ * @returns File metadata
1171
+ */
1172
+ async stat(path) {
1173
+ return this.client.request(
1174
+ HAEXTENSION_METHODS.filesystem.stat,
1175
+ { path }
1176
+ );
1177
+ }
1178
+ /**
1179
+ * Open a folder selection dialog
1180
+ * @param options Dialog options
1181
+ * @returns Selected folder path, or null if cancelled
1182
+ */
1183
+ async selectFolder(options = {}) {
1184
+ return this.client.request(
1185
+ HAEXTENSION_METHODS.filesystem.selectFolder,
1186
+ options
1187
+ );
1188
+ }
1189
+ /**
1190
+ * Open a file selection dialog
1191
+ * @param options Dialog options
1192
+ * @returns Selected file paths, or null if cancelled
1193
+ */
1194
+ async selectFile(options = {}) {
1195
+ return this.client.request(
1196
+ HAEXTENSION_METHODS.filesystem.selectFile,
1197
+ options
1198
+ );
1199
+ }
1200
+ /**
1201
+ * Rename/move a file or directory
1202
+ * @param from Source path
1203
+ * @param to Destination path
1204
+ */
1205
+ async rename(from, to) {
1206
+ await this.client.request(
1207
+ HAEXTENSION_METHODS.filesystem.rename,
1208
+ { from, to }
1209
+ );
1210
+ }
1211
+ /**
1212
+ * Copy a file
1213
+ * @param from Source path
1214
+ * @param to Destination path
1215
+ */
1216
+ async copy(from, to) {
1217
+ await this.client.request(
1218
+ HAEXTENSION_METHODS.filesystem.copy,
1219
+ { from, to }
1220
+ );
1221
+ }
1080
1222
  };
1081
1223
 
1082
1224
  // src/api/web.ts
@@ -1571,7 +1713,20 @@ var TAURI_COMMANDS = {
1571
1713
  filesystem: {
1572
1714
  saveFile: "webview_extension_fs_save_file",
1573
1715
  openFile: "webview_extension_fs_open_file",
1574
- showImage: "webview_extension_fs_show_image"
1716
+ showImage: "webview_extension_fs_show_image",
1717
+ // Generic filesystem operations (no webview_ prefix because they're global)
1718
+ // Permission checks happen in the message handler layer
1719
+ readFile: "filesystem_read_file",
1720
+ writeFile: "filesystem_write_file",
1721
+ readDir: "filesystem_read_dir",
1722
+ mkdir: "filesystem_mkdir",
1723
+ remove: "filesystem_remove",
1724
+ exists: "filesystem_exists",
1725
+ stat: "filesystem_stat",
1726
+ selectFolder: "filesystem_select_folder",
1727
+ selectFile: "filesystem_select_file",
1728
+ rename: "filesystem_rename",
1729
+ copy: "filesystem_copy"
1575
1730
  },
1576
1731
  external: {
1577
1732
  // Response handling (called by extensions running in WebView)