@asaidimu/utils-database 3.1.5 → 3.1.7

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/index.d.mts CHANGED
@@ -738,7 +738,8 @@ declare class IndexedDBStore<T extends Record<string, any>> implements Store<T>
738
738
  */
739
739
  declare const createIndexedDbStore: <T extends Record<string, any>>(config: StoreConfig) => Store<T>;
740
740
 
741
- declare function DatabaseConnection(config: Omit<DatabaseConfig, "keyPath">, createStore: <T extends Record<string, any>>(config: StoreConfig, indexes: IndexDefinition[]) => Store<T>): Promise<Database>;
741
+ type StoreFactory = <T extends Record<string, any>>(config: StoreConfig, indexes: IndexDefinition[]) => Store<T>;
742
+ declare function DatabaseConnection(config: Omit<DatabaseConfig, "keyPath">, createStore: StoreFactory): Promise<Database>;
742
743
 
743
744
  interface MutexOptions {
744
745
  /**
@@ -843,10 +844,18 @@ interface EventBus<TEventMap extends Record<string, any>> {
843
844
  metrics: () => EventMetrics;
844
845
  /**
845
846
  * Clears all subscriptions and resets metrics.
846
- * After calling clear(), the bus is fully reset and can be reused —
847
+ *
848
+ * After calling `clear()`, the bus is fully reset and can be reused
847
849
  * cross-tab communication is re-established if it was previously enabled.
850
+ *
851
+ * @param options - Optional configuration object.
852
+ * @param options.permanent - If `true`, the bus becomes permanently unusable after clearing.
853
+ * Defaults to `false`.
854
+ * @returns {void}
848
855
  */
849
- clear: () => void;
856
+ clear: (options?: {
857
+ permanent?: boolean;
858
+ }) => void;
850
859
  }
851
860
  /**
852
861
  * Interface defining the metrics tracked by the EventBus.
@@ -977,4 +986,4 @@ declare class DatabaseError extends Error {
977
986
  constructor(type: DatabaseErrorType, message: string, schema?: SchemaDefinition, cause?: unknown, issues?: any);
978
987
  }
979
988
 
980
- export { type BufferedOperation, type Collection, type CollectionEvent, type CollectionEventType, type CollectionMigrationOptions, ConnectionManager, type CursorCallback, type CursorCallbackResult, type CursorPaginationOptions, DEFAULT_KEYPATH, type Database, type DatabaseConfig, DatabaseConnection, DatabaseError, DatabaseErrorType, type DatabaseEvent, type DatabaseEventType, type Document, type DocumentEvent, type DocumentEventType, type DocumentMetadata, IndexedDBStore, type Store, type StoreConfig, type StoreKeyRange, type TelemetryEvent, type TelemetryEventType, createDocument, createEphemeralStore, createIndexedDbStore, openCollection };
989
+ export { type BufferedOperation, type Collection, type CollectionEvent, type CollectionEventType, type CollectionMigrationOptions, ConnectionManager, type CursorCallback, type CursorCallbackResult, type CursorPaginationOptions, DEFAULT_KEYPATH, type Database, type DatabaseConfig, DatabaseConnection, DatabaseError, DatabaseErrorType, type DatabaseEvent, type DatabaseEventType, type Document, type DocumentEvent, type DocumentEventType, type DocumentMetadata, IndexedDBStore, type Store, type StoreConfig, type StoreFactory, type StoreKeyRange, type TelemetryEvent, type TelemetryEventType, createDocument, createEphemeralStore, createIndexedDbStore, openCollection };
package/index.d.ts CHANGED
@@ -738,7 +738,8 @@ declare class IndexedDBStore<T extends Record<string, any>> implements Store<T>
738
738
  */
739
739
  declare const createIndexedDbStore: <T extends Record<string, any>>(config: StoreConfig) => Store<T>;
740
740
 
741
- declare function DatabaseConnection(config: Omit<DatabaseConfig, "keyPath">, createStore: <T extends Record<string, any>>(config: StoreConfig, indexes: IndexDefinition[]) => Store<T>): Promise<Database>;
741
+ type StoreFactory = <T extends Record<string, any>>(config: StoreConfig, indexes: IndexDefinition[]) => Store<T>;
742
+ declare function DatabaseConnection(config: Omit<DatabaseConfig, "keyPath">, createStore: StoreFactory): Promise<Database>;
742
743
 
743
744
  interface MutexOptions {
744
745
  /**
@@ -843,10 +844,18 @@ interface EventBus<TEventMap extends Record<string, any>> {
843
844
  metrics: () => EventMetrics;
844
845
  /**
845
846
  * Clears all subscriptions and resets metrics.
846
- * After calling clear(), the bus is fully reset and can be reused —
847
+ *
848
+ * After calling `clear()`, the bus is fully reset and can be reused
847
849
  * cross-tab communication is re-established if it was previously enabled.
850
+ *
851
+ * @param options - Optional configuration object.
852
+ * @param options.permanent - If `true`, the bus becomes permanently unusable after clearing.
853
+ * Defaults to `false`.
854
+ * @returns {void}
848
855
  */
849
- clear: () => void;
856
+ clear: (options?: {
857
+ permanent?: boolean;
858
+ }) => void;
850
859
  }
851
860
  /**
852
861
  * Interface defining the metrics tracked by the EventBus.
@@ -977,4 +986,4 @@ declare class DatabaseError extends Error {
977
986
  constructor(type: DatabaseErrorType, message: string, schema?: SchemaDefinition, cause?: unknown, issues?: any);
978
987
  }
979
988
 
980
- export { type BufferedOperation, type Collection, type CollectionEvent, type CollectionEventType, type CollectionMigrationOptions, ConnectionManager, type CursorCallback, type CursorCallbackResult, type CursorPaginationOptions, DEFAULT_KEYPATH, type Database, type DatabaseConfig, DatabaseConnection, DatabaseError, DatabaseErrorType, type DatabaseEvent, type DatabaseEventType, type Document, type DocumentEvent, type DocumentEventType, type DocumentMetadata, IndexedDBStore, type Store, type StoreConfig, type StoreKeyRange, type TelemetryEvent, type TelemetryEventType, createDocument, createEphemeralStore, createIndexedDbStore, openCollection };
989
+ export { type BufferedOperation, type Collection, type CollectionEvent, type CollectionEventType, type CollectionMigrationOptions, ConnectionManager, type CursorCallback, type CursorCallbackResult, type CursorPaginationOptions, DEFAULT_KEYPATH, type Database, type DatabaseConfig, DatabaseConnection, DatabaseError, DatabaseErrorType, type DatabaseEvent, type DatabaseEventType, type Document, type DocumentEvent, type DocumentEventType, type DocumentMetadata, IndexedDBStore, type Store, type StoreConfig, type StoreFactory, type StoreKeyRange, type TelemetryEvent, type TelemetryEventType, createDocument, createEphemeralStore, createIndexedDbStore, openCollection };