blink 0.1.94 → 0.1.96

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.
@@ -70,39 +70,6 @@ interface StoreEntry {
70
70
  * It works with filesystem locks - so multiple processes can
71
71
  * read and write to the store concurrently.
72
72
  */
73
- interface Store<T extends object> {
74
- get: (key: string) => Promise<T | undefined>;
75
- list: () => Promise<StoreEntry[]>;
76
- lock: (key: string, opts?: {
77
- force?: boolean;
78
- }) => Promise<LockedStoreEntry<T>>;
79
- dispose: () => void;
80
- }
81
- /**
82
- * createFileStore creates a simple file-based store with atomic read/write.
83
- * All operations are protected by filesystem locks for multi-process safety.
84
- */
85
-
86
- interface DiskStoreWatcher<T = any> {
87
- onChange: (callback: (event: {
88
- key: string;
89
- value: T | undefined;
90
- locked: boolean;
91
- pid?: number;
92
- }) => void) => () => void;
93
- dispose: () => void;
94
- }
95
- /**
96
- * createDiskStoreWatcher creates a watcher for the disk store.
97
- * It watches the disk store for changes and emits events when the
98
- * store changes.
99
- *
100
- * It also polls the store for changes in case the watcher misses
101
- * any changes.
102
- *
103
- * It also debounces the changes to prevent too many events from
104
- * being emitted.
105
- */
106
73
  //#endregion
107
74
  //#region src/local/types.d.ts
108
75
  interface StoredChat {
@@ -144,8 +111,7 @@ interface ChatState {
144
111
  }
145
112
  interface ChatManagerOptions {
146
113
  readonly chatId: string;
147
- readonly store: Store<StoredChat>;
148
- readonly watcher: DiskStoreWatcher<StoredChat>;
114
+ readonly chatsDirectory: string;
149
115
  /**
150
116
  * Optional function to filter messages before persisting them.
151
117
  * Return undefined to skip persisting the message.
@@ -176,7 +142,7 @@ declare class ChatManager {
176
142
  private abortController;
177
143
  private isProcessingQueue;
178
144
  private listeners;
179
- private unwatchStore;
145
+ private watcher;
180
146
  private disposed;
181
147
  constructor(options: ChatManagerOptions);
182
148
  /**
@@ -70,39 +70,6 @@ interface StoreEntry {
70
70
  * It works with filesystem locks - so multiple processes can
71
71
  * read and write to the store concurrently.
72
72
  */
73
- interface Store<T extends object> {
74
- get: (key: string) => Promise<T | undefined>;
75
- list: () => Promise<StoreEntry[]>;
76
- lock: (key: string, opts?: {
77
- force?: boolean;
78
- }) => Promise<LockedStoreEntry<T>>;
79
- dispose: () => void;
80
- }
81
- /**
82
- * createFileStore creates a simple file-based store with atomic read/write.
83
- * All operations are protected by filesystem locks for multi-process safety.
84
- */
85
-
86
- interface DiskStoreWatcher<T = any> {
87
- onChange: (callback: (event: {
88
- key: string;
89
- value: T | undefined;
90
- locked: boolean;
91
- pid?: number;
92
- }) => void) => () => void;
93
- dispose: () => void;
94
- }
95
- /**
96
- * createDiskStoreWatcher creates a watcher for the disk store.
97
- * It watches the disk store for changes and emits events when the
98
- * store changes.
99
- *
100
- * It also polls the store for changes in case the watcher misses
101
- * any changes.
102
- *
103
- * It also debounces the changes to prevent too many events from
104
- * being emitted.
105
- */
106
73
  //#endregion
107
74
  //#region src/local/types.d.ts
108
75
  interface StoredChat {
@@ -144,8 +111,7 @@ interface ChatState {
144
111
  }
145
112
  interface ChatManagerOptions {
146
113
  readonly chatId: string;
147
- readonly store: Store<StoredChat>;
148
- readonly watcher: DiskStoreWatcher<StoredChat>;
114
+ readonly chatsDirectory: string;
149
115
  /**
150
116
  * Optional function to filter messages before persisting them.
151
117
  * Return undefined to skip persisting the message.
@@ -176,7 +142,7 @@ declare class ChatManager {
176
142
  private abortController;
177
143
  private isProcessingQueue;
178
144
  private listeners;
179
- private unwatchStore;
145
+ private watcher;
180
146
  private disposed;
181
147
  constructor(options: ChatManagerOptions);
182
148
  /**