@haex-space/vault-sdk 2.5.111 → 2.5.112

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.
@@ -939,6 +939,79 @@ declare class LocalSendAPI {
939
939
  cancelSend(sessionId: string): Promise<void>;
940
940
  }
941
941
 
942
+ /**
943
+ * A mapping of a row to a shared space.
944
+ */
945
+ interface SpaceAssignment {
946
+ /** The extension-scoped table name */
947
+ tableName: string;
948
+ /** Serialized primary key(s) identifying the row */
949
+ rowPks: string;
950
+ /** The shared space ID this row is assigned to */
951
+ spaceId: string;
952
+ }
953
+ /**
954
+ * Spaces API for managing row-to-space assignments.
955
+ *
956
+ * Extensions use this API to control which rows are synced to which
957
+ * shared spaces. The sync engine reads these assignments to filter
958
+ * data when pushing to space backends.
959
+ *
960
+ * @example
961
+ * ```typescript
962
+ * // Assign a single row to a space
963
+ * await sdk.spaces.assignRowAsync("events", "evt_123", "space_abc");
964
+ *
965
+ * // Bulk assign multiple rows
966
+ * await sdk.spaces.assignAsync([
967
+ * { tableName: "events", rowPks: "evt_1", spaceId: "space_abc" },
968
+ * { tableName: "events", rowPks: "evt_2", spaceId: "space_abc" },
969
+ * ]);
970
+ *
971
+ * // Query assignments
972
+ * const assignments = await sdk.spaces.getAssignmentsAsync("events");
973
+ * ```
974
+ */
975
+ declare class SpacesAPI {
976
+ private client;
977
+ constructor(client: HaexVaultSdk);
978
+ /**
979
+ * Bulk assign rows to spaces.
980
+ * @param assignments - Array of row-to-space mappings
981
+ * @returns Number of assignments created
982
+ */
983
+ assignAsync(assignments: SpaceAssignment[]): Promise<number>;
984
+ /**
985
+ * Bulk unassign rows from spaces.
986
+ * @param assignments - Array of row-to-space mappings to remove
987
+ * @returns Number of assignments removed
988
+ */
989
+ unassignAsync(assignments: SpaceAssignment[]): Promise<number>;
990
+ /**
991
+ * Get space assignments for a table, optionally filtered by row.
992
+ * @param tableName - The table to query assignments for
993
+ * @param rowPks - Optional row primary key(s) to filter by
994
+ * @returns Array of space assignments
995
+ */
996
+ getAssignmentsAsync(tableName: string, rowPks?: string): Promise<SpaceAssignment[]>;
997
+ /**
998
+ * Convenience method to assign a single row to a space.
999
+ * @param tableName - The table name
1000
+ * @param rowPks - The row primary key(s)
1001
+ * @param spaceId - The space ID to assign to
1002
+ * @returns Number of assignments created (0 or 1)
1003
+ */
1004
+ assignRowAsync(tableName: string, rowPks: string, spaceId: string): Promise<number>;
1005
+ /**
1006
+ * Convenience method to unassign a single row from a space.
1007
+ * @param tableName - The table name
1008
+ * @param rowPks - The row primary key(s)
1009
+ * @param spaceId - The space ID to unassign from
1010
+ * @returns Number of assignments removed (0 or 1)
1011
+ */
1012
+ unassignRowAsync(tableName: string, rowPks: string, spaceId: string): Promise<number>;
1013
+ }
1014
+
942
1015
  /**
943
1016
  * HaexVault Client
944
1017
  *
@@ -971,6 +1044,7 @@ declare class HaexVaultSdk {
971
1044
  readonly permissions: PermissionsAPI;
972
1045
  readonly remoteStorage: RemoteStorageAPI;
973
1046
  readonly localsend: LocalSendAPI;
1047
+ readonly spaces: SpacesAPI;
974
1048
  constructor(config?: HaexHubConfig);
975
1049
  ready(): Promise<void>;
976
1050
  get setupCompleted(): boolean;
@@ -1014,4 +1088,4 @@ declare class HaexVaultSdk {
1014
1088
  private log;
1015
1089
  }
1016
1090
 
1017
- export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type TransferProgress as K, LOCALSEND_EVENTS as L, type TransferState as M, canExternalClientSendRequests as N, isExternalClientConnected as O, type PendingAuthorization as P, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
1091
+ export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type SpaceAssignment as K, LOCALSEND_EVENTS as L, SpacesAPI as M, type TransferProgress as N, type TransferState as O, type PendingAuthorization as P, canExternalClientSendRequests as Q, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, isExternalClientConnected as V, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
@@ -939,6 +939,79 @@ declare class LocalSendAPI {
939
939
  cancelSend(sessionId: string): Promise<void>;
940
940
  }
941
941
 
942
+ /**
943
+ * A mapping of a row to a shared space.
944
+ */
945
+ interface SpaceAssignment {
946
+ /** The extension-scoped table name */
947
+ tableName: string;
948
+ /** Serialized primary key(s) identifying the row */
949
+ rowPks: string;
950
+ /** The shared space ID this row is assigned to */
951
+ spaceId: string;
952
+ }
953
+ /**
954
+ * Spaces API for managing row-to-space assignments.
955
+ *
956
+ * Extensions use this API to control which rows are synced to which
957
+ * shared spaces. The sync engine reads these assignments to filter
958
+ * data when pushing to space backends.
959
+ *
960
+ * @example
961
+ * ```typescript
962
+ * // Assign a single row to a space
963
+ * await sdk.spaces.assignRowAsync("events", "evt_123", "space_abc");
964
+ *
965
+ * // Bulk assign multiple rows
966
+ * await sdk.spaces.assignAsync([
967
+ * { tableName: "events", rowPks: "evt_1", spaceId: "space_abc" },
968
+ * { tableName: "events", rowPks: "evt_2", spaceId: "space_abc" },
969
+ * ]);
970
+ *
971
+ * // Query assignments
972
+ * const assignments = await sdk.spaces.getAssignmentsAsync("events");
973
+ * ```
974
+ */
975
+ declare class SpacesAPI {
976
+ private client;
977
+ constructor(client: HaexVaultSdk);
978
+ /**
979
+ * Bulk assign rows to spaces.
980
+ * @param assignments - Array of row-to-space mappings
981
+ * @returns Number of assignments created
982
+ */
983
+ assignAsync(assignments: SpaceAssignment[]): Promise<number>;
984
+ /**
985
+ * Bulk unassign rows from spaces.
986
+ * @param assignments - Array of row-to-space mappings to remove
987
+ * @returns Number of assignments removed
988
+ */
989
+ unassignAsync(assignments: SpaceAssignment[]): Promise<number>;
990
+ /**
991
+ * Get space assignments for a table, optionally filtered by row.
992
+ * @param tableName - The table to query assignments for
993
+ * @param rowPks - Optional row primary key(s) to filter by
994
+ * @returns Array of space assignments
995
+ */
996
+ getAssignmentsAsync(tableName: string, rowPks?: string): Promise<SpaceAssignment[]>;
997
+ /**
998
+ * Convenience method to assign a single row to a space.
999
+ * @param tableName - The table name
1000
+ * @param rowPks - The row primary key(s)
1001
+ * @param spaceId - The space ID to assign to
1002
+ * @returns Number of assignments created (0 or 1)
1003
+ */
1004
+ assignRowAsync(tableName: string, rowPks: string, spaceId: string): Promise<number>;
1005
+ /**
1006
+ * Convenience method to unassign a single row from a space.
1007
+ * @param tableName - The table name
1008
+ * @param rowPks - The row primary key(s)
1009
+ * @param spaceId - The space ID to unassign from
1010
+ * @returns Number of assignments removed (0 or 1)
1011
+ */
1012
+ unassignRowAsync(tableName: string, rowPks: string, spaceId: string): Promise<number>;
1013
+ }
1014
+
942
1015
  /**
943
1016
  * HaexVault Client
944
1017
  *
@@ -971,6 +1044,7 @@ declare class HaexVaultSdk {
971
1044
  readonly permissions: PermissionsAPI;
972
1045
  readonly remoteStorage: RemoteStorageAPI;
973
1046
  readonly localsend: LocalSendAPI;
1047
+ readonly spaces: SpacesAPI;
974
1048
  constructor(config?: HaexHubConfig);
975
1049
  ready(): Promise<void>;
976
1050
  get setupCompleted(): boolean;
@@ -1014,4 +1088,4 @@ declare class HaexVaultSdk {
1014
1088
  private log;
1015
1089
  }
1016
1090
 
1017
- export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type TransferProgress as K, LOCALSEND_EVENTS as L, type TransferState as M, canExternalClientSendRequests as N, isExternalClientConnected as O, type PendingAuthorization as P, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
1091
+ export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type SpaceAssignment as K, LOCALSEND_EVENTS as L, SpacesAPI as M, type TransferProgress as N, type TransferState as O, type PendingAuthorization as P, canExternalClientSendRequests as Q, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, isExternalClientConnected as V, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HaexVaultSdk } from './client-DFGx115H.mjs';
2
- export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, T as TransferDirection, K as TransferProgress, M as TransferState, W as WebAPI, N as canExternalClientSendRequests, O as isExternalClientConnected } from './client-DFGx115H.mjs';
1
+ import { H as HaexVaultSdk } from './client-GPE112vL.mjs';
2
+ export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, K as SpaceAssignment, M as SpacesAPI, T as TransferDirection, N as TransferProgress, O as TransferState, W as WebAPI, Q as canExternalClientSendRequests, V as isExternalClientConnected } from './client-GPE112vL.mjs';
3
3
  import { E as ExtensionManifest, H as HaexHubConfig } from './types-gfc9eCL4.mjs';
4
4
  export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-gfc9eCL4.mjs';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
@@ -551,6 +551,25 @@ declare const LOCALSEND_COMMANDS: {
551
551
  readonly cancelSend: "localsend_cancel_send";
552
552
  };
553
553
 
554
+ /**
555
+ * Space Commands
556
+ *
557
+ * Commands for managing row-to-space assignments (shared space sync).
558
+ * These commands are used for both:
559
+ * - Tauri invoke (WebView extensions)
560
+ * - postMessage (iframe extensions)
561
+ *
562
+ * Naming convention: `extension_space_<action>`
563
+ */
564
+ declare const SPACE_COMMANDS: {
565
+ /** Bulk assign rows to spaces */
566
+ readonly assign: "extension_space_assign";
567
+ /** Bulk unassign rows from spaces */
568
+ readonly unassign: "extension_space_unassign";
569
+ /** Get space assignments for a table */
570
+ readonly getAssignments: "extension_space_get_assignments";
571
+ };
572
+
554
573
  /**
555
574
  * Tauri Command Names
556
575
  *
@@ -669,8 +688,13 @@ declare const TAURI_COMMANDS: {
669
688
  readonly sendFiles: "localsend_send_files";
670
689
  readonly cancelSend: "localsend_cancel_send";
671
690
  };
691
+ readonly spaces: {
692
+ readonly assign: "extension_space_assign";
693
+ readonly unassign: "extension_space_unassign";
694
+ readonly getAssignments: "extension_space_get_assignments";
695
+ };
672
696
  };
673
- 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];
697
+ 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] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS];
674
698
 
675
699
  interface VerifyResult {
676
700
  valid: boolean;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HaexVaultSdk } from './client-8dlKVNDZ.js';
2
- export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, T as TransferDirection, K as TransferProgress, M as TransferState, W as WebAPI, N as canExternalClientSendRequests, O as isExternalClientConnected } from './client-8dlKVNDZ.js';
1
+ import { H as HaexVaultSdk } from './client-BVMJXZiK.js';
2
+ export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, K as SpaceAssignment, M as SpacesAPI, T as TransferDirection, N as TransferProgress, O as TransferState, W as WebAPI, Q as canExternalClientSendRequests, V as isExternalClientConnected } from './client-BVMJXZiK.js';
3
3
  import { E as ExtensionManifest, H as HaexHubConfig } from './types-gfc9eCL4.js';
4
4
  export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-gfc9eCL4.js';
5
5
  export { H as HaextensionConfig } from './config-D_HXjsEV.js';
@@ -551,6 +551,25 @@ declare const LOCALSEND_COMMANDS: {
551
551
  readonly cancelSend: "localsend_cancel_send";
552
552
  };
553
553
 
554
+ /**
555
+ * Space Commands
556
+ *
557
+ * Commands for managing row-to-space assignments (shared space sync).
558
+ * These commands are used for both:
559
+ * - Tauri invoke (WebView extensions)
560
+ * - postMessage (iframe extensions)
561
+ *
562
+ * Naming convention: `extension_space_<action>`
563
+ */
564
+ declare const SPACE_COMMANDS: {
565
+ /** Bulk assign rows to spaces */
566
+ readonly assign: "extension_space_assign";
567
+ /** Bulk unassign rows from spaces */
568
+ readonly unassign: "extension_space_unassign";
569
+ /** Get space assignments for a table */
570
+ readonly getAssignments: "extension_space_get_assignments";
571
+ };
572
+
554
573
  /**
555
574
  * Tauri Command Names
556
575
  *
@@ -669,8 +688,13 @@ declare const TAURI_COMMANDS: {
669
688
  readonly sendFiles: "localsend_send_files";
670
689
  readonly cancelSend: "localsend_cancel_send";
671
690
  };
691
+ readonly spaces: {
692
+ readonly assign: "extension_space_assign";
693
+ readonly unassign: "extension_space_unassign";
694
+ readonly getAssignments: "extension_space_get_assignments";
695
+ };
672
696
  };
673
- 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];
697
+ 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] | (typeof SPACE_COMMANDS)[keyof typeof SPACE_COMMANDS];
674
698
 
675
699
  interface VerifyResult {
676
700
  valid: boolean;
package/dist/index.js CHANGED
@@ -676,6 +676,16 @@ var LOCALSEND_COMMANDS = {
676
676
  cancelSend: "localsend_cancel_send"
677
677
  };
678
678
 
679
+ // src/commands/spaces.ts
680
+ var SPACE_COMMANDS = {
681
+ /** Bulk assign rows to spaces */
682
+ assign: "extension_space_assign",
683
+ /** Bulk unassign rows from spaces */
684
+ unassign: "extension_space_unassign",
685
+ /** Get space assignments for a table */
686
+ getAssignments: "extension_space_get_assignments"
687
+ };
688
+
679
689
  // src/commands/index.ts
680
690
  var TAURI_COMMANDS = {
681
691
  database: DATABASE_COMMANDS,
@@ -686,7 +696,8 @@ var TAURI_COMMANDS = {
686
696
  externalBridge: EXTERNAL_BRIDGE_COMMANDS,
687
697
  extension: EXTENSION_COMMANDS,
688
698
  remoteStorage: REMOTE_STORAGE_COMMANDS,
689
- localsend: LOCALSEND_COMMANDS
699
+ localsend: LOCALSEND_COMMANDS,
700
+ spaces: SPACE_COMMANDS
690
701
  };
691
702
 
692
703
  // src/api/storage.ts
@@ -1688,6 +1699,83 @@ var LocalSendAPI = class {
1688
1699
  }
1689
1700
  };
1690
1701
 
1702
+ // src/api/spaces.ts
1703
+ var SpacesAPI = class {
1704
+ constructor(client) {
1705
+ this.client = client;
1706
+ }
1707
+ /**
1708
+ * Bulk assign rows to spaces.
1709
+ * @param assignments - Array of row-to-space mappings
1710
+ * @returns Number of assignments created
1711
+ */
1712
+ async assignAsync(assignments) {
1713
+ return this.client.request(SPACE_COMMANDS.assign, {
1714
+ assignments: assignments.map(toSnakeCase)
1715
+ });
1716
+ }
1717
+ /**
1718
+ * Bulk unassign rows from spaces.
1719
+ * @param assignments - Array of row-to-space mappings to remove
1720
+ * @returns Number of assignments removed
1721
+ */
1722
+ async unassignAsync(assignments) {
1723
+ return this.client.request(SPACE_COMMANDS.unassign, {
1724
+ assignments: assignments.map(toSnakeCase)
1725
+ });
1726
+ }
1727
+ /**
1728
+ * Get space assignments for a table, optionally filtered by row.
1729
+ * @param tableName - The table to query assignments for
1730
+ * @param rowPks - Optional row primary key(s) to filter by
1731
+ * @returns Array of space assignments
1732
+ */
1733
+ async getAssignmentsAsync(tableName, rowPks) {
1734
+ const result = await this.client.request(
1735
+ SPACE_COMMANDS.getAssignments,
1736
+ {
1737
+ table_name: tableName,
1738
+ row_pks: rowPks
1739
+ }
1740
+ );
1741
+ return result.map(fromSnakeCase);
1742
+ }
1743
+ /**
1744
+ * Convenience method to assign a single row to a space.
1745
+ * @param tableName - The table name
1746
+ * @param rowPks - The row primary key(s)
1747
+ * @param spaceId - The space ID to assign to
1748
+ * @returns Number of assignments created (0 or 1)
1749
+ */
1750
+ async assignRowAsync(tableName, rowPks, spaceId) {
1751
+ return this.assignAsync([{ tableName, rowPks, spaceId }]);
1752
+ }
1753
+ /**
1754
+ * Convenience method to unassign a single row from a space.
1755
+ * @param tableName - The table name
1756
+ * @param rowPks - The row primary key(s)
1757
+ * @param spaceId - The space ID to unassign from
1758
+ * @returns Number of assignments removed (0 or 1)
1759
+ */
1760
+ async unassignRowAsync(tableName, rowPks, spaceId) {
1761
+ return this.unassignAsync([{ tableName, rowPks, spaceId }]);
1762
+ }
1763
+ };
1764
+ function toSnakeCase(a) {
1765
+ return {
1766
+ table_name: a.tableName,
1767
+ row_pks: a.rowPks,
1768
+ space_id: a.spaceId
1769
+ };
1770
+ }
1771
+ function fromSnakeCase(a) {
1772
+ return {
1773
+ tableName: a.table_name,
1774
+ rowPks: a.row_pks,
1775
+ spaceId: a.space_id
1776
+ };
1777
+ }
1778
+
1691
1779
  // src/client/tableName.ts
1692
1780
  function validatePublicKey(publicKey) {
1693
1781
  if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
@@ -2312,6 +2400,7 @@ var HaexVaultSdk = class {
2312
2400
  this.permissions = new PermissionsAPI(this);
2313
2401
  this.remoteStorage = new RemoteStorageAPI(this);
2314
2402
  this.localsend = new LocalSendAPI(this);
2403
+ this.spaces = new SpacesAPI(this);
2315
2404
  installConsoleForwarding(this.config.debug);
2316
2405
  this.readyPromise = new Promise((resolve) => {
2317
2406
  this.resolveReady = resolve;
@@ -3114,6 +3203,7 @@ exports.PermissionStatus = PermissionStatus;
3114
3203
  exports.PermissionsAPI = PermissionsAPI;
3115
3204
  exports.RemoteStorageAPI = RemoteStorageAPI;
3116
3205
  exports.SIGNING_ALGO = SIGNING_ALGO;
3206
+ exports.SpacesAPI = SpacesAPI;
3117
3207
  exports.TABLE_SEPARATOR = TABLE_SEPARATOR;
3118
3208
  exports.TAURI_COMMANDS = TAURI_COMMANDS;
3119
3209
  exports.WebAPI = WebAPI;