mindcache 2.2.0 → 2.4.0
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-XM7bmK7C.d.mts → CloudAdapter-B04-OWx3.d.mts} +75 -11
- package/dist/{index-XM7bmK7C.d.ts → CloudAdapter-B04-OWx3.d.ts} +75 -11
- package/dist/cloud/index.d.mts +2 -2
- package/dist/cloud/index.d.ts +2 -2
- package/dist/cloud/index.js +458 -103
- package/dist/cloud/index.js.map +1 -1
- package/dist/cloud/index.mjs +458 -103
- package/dist/cloud/index.mjs.map +1 -1
- package/dist/index.d.mts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +497 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +497 -104
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.d.mts
CHANGED
|
@@ -1 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
import { M as MindCache, a as MindCacheOptions } from './CloudAdapter-B04-OWx3.mjs';
|
|
2
|
+
export { C as CloudAdapter, g as CloudAdapterEvents, e as CloudConfig, f as ConnectionState, D as DEFAULT_KEY_ATTRIBUTES, K as KeyAttributes, L as Listener, c as MindCacheCloudOptions, d as MindCacheIndexedDBOptions, S as STM, b as STMEntry, m as mindcache } from './CloudAdapter-B04-OWx3.mjs';
|
|
3
|
+
|
|
4
|
+
interface IndexedDBConfig {
|
|
5
|
+
/** Database name (defaults to 'mindcache_db') */
|
|
6
|
+
dbName?: string;
|
|
7
|
+
/** Store name (defaults to 'mindcache_store') */
|
|
8
|
+
storeName?: string;
|
|
9
|
+
/** Storage key (defaults to 'mindcache_data') */
|
|
10
|
+
key?: string;
|
|
11
|
+
/** Debounce time in ms for saving (defaults to 1000) */
|
|
12
|
+
debounceMs?: number;
|
|
13
|
+
}
|
|
14
|
+
declare class IndexedDBAdapter {
|
|
15
|
+
private config;
|
|
16
|
+
private mindcache;
|
|
17
|
+
private unsubscribe;
|
|
18
|
+
private saveTimeout;
|
|
19
|
+
private db;
|
|
20
|
+
private dbName;
|
|
21
|
+
private storeName;
|
|
22
|
+
private key;
|
|
23
|
+
constructor(config?: IndexedDBConfig);
|
|
24
|
+
attach(mc: MindCache): Promise<void>;
|
|
25
|
+
detach(): void;
|
|
26
|
+
private initDB;
|
|
27
|
+
private load;
|
|
28
|
+
private scheduleSave;
|
|
29
|
+
private save;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface UseMindCacheResult {
|
|
33
|
+
/** The MindCache instance, null until loaded */
|
|
34
|
+
mindcache: MindCache | null;
|
|
35
|
+
/** Whether the MindCache is fully loaded and ready to use */
|
|
36
|
+
isLoaded: boolean;
|
|
37
|
+
/** Any error that occurred during initialization */
|
|
38
|
+
error: Error | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* React hook for using MindCache with automatic lifecycle management.
|
|
42
|
+
*
|
|
43
|
+
* Handles async initialization (IndexedDB/Cloud) and provides loading state.
|
|
44
|
+
* The MindCache instance is created once and persists across re-renders.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* function MyComponent() {
|
|
49
|
+
* const { mindcache, isLoaded } = useMindCache({
|
|
50
|
+
* indexedDB: { dbName: 'my-app' }
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* if (!isLoaded) return <Loading />;
|
|
54
|
+
*
|
|
55
|
+
* return <div>{mindcache.get_value('key')}</div>;
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function useMindCache(options?: MindCacheOptions): UseMindCacheResult;
|
|
60
|
+
|
|
61
|
+
export { IndexedDBAdapter, type IndexedDBConfig, MindCache, MindCacheOptions, type UseMindCacheResult, useMindCache };
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
import { M as MindCache, a as MindCacheOptions } from './CloudAdapter-B04-OWx3.js';
|
|
2
|
+
export { C as CloudAdapter, g as CloudAdapterEvents, e as CloudConfig, f as ConnectionState, D as DEFAULT_KEY_ATTRIBUTES, K as KeyAttributes, L as Listener, c as MindCacheCloudOptions, d as MindCacheIndexedDBOptions, S as STM, b as STMEntry, m as mindcache } from './CloudAdapter-B04-OWx3.js';
|
|
3
|
+
|
|
4
|
+
interface IndexedDBConfig {
|
|
5
|
+
/** Database name (defaults to 'mindcache_db') */
|
|
6
|
+
dbName?: string;
|
|
7
|
+
/** Store name (defaults to 'mindcache_store') */
|
|
8
|
+
storeName?: string;
|
|
9
|
+
/** Storage key (defaults to 'mindcache_data') */
|
|
10
|
+
key?: string;
|
|
11
|
+
/** Debounce time in ms for saving (defaults to 1000) */
|
|
12
|
+
debounceMs?: number;
|
|
13
|
+
}
|
|
14
|
+
declare class IndexedDBAdapter {
|
|
15
|
+
private config;
|
|
16
|
+
private mindcache;
|
|
17
|
+
private unsubscribe;
|
|
18
|
+
private saveTimeout;
|
|
19
|
+
private db;
|
|
20
|
+
private dbName;
|
|
21
|
+
private storeName;
|
|
22
|
+
private key;
|
|
23
|
+
constructor(config?: IndexedDBConfig);
|
|
24
|
+
attach(mc: MindCache): Promise<void>;
|
|
25
|
+
detach(): void;
|
|
26
|
+
private initDB;
|
|
27
|
+
private load;
|
|
28
|
+
private scheduleSave;
|
|
29
|
+
private save;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface UseMindCacheResult {
|
|
33
|
+
/** The MindCache instance, null until loaded */
|
|
34
|
+
mindcache: MindCache | null;
|
|
35
|
+
/** Whether the MindCache is fully loaded and ready to use */
|
|
36
|
+
isLoaded: boolean;
|
|
37
|
+
/** Any error that occurred during initialization */
|
|
38
|
+
error: Error | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* React hook for using MindCache with automatic lifecycle management.
|
|
42
|
+
*
|
|
43
|
+
* Handles async initialization (IndexedDB/Cloud) and provides loading state.
|
|
44
|
+
* The MindCache instance is created once and persists across re-renders.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* function MyComponent() {
|
|
49
|
+
* const { mindcache, isLoaded } = useMindCache({
|
|
50
|
+
* indexedDB: { dbName: 'my-app' }
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* if (!isLoaded) return <Loading />;
|
|
54
|
+
*
|
|
55
|
+
* return <div>{mindcache.get_value('key')}</div>;
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function useMindCache(options?: MindCacheOptions): UseMindCacheResult;
|
|
60
|
+
|
|
61
|
+
export { IndexedDBAdapter, type IndexedDBConfig, MindCache, MindCacheOptions, type UseMindCacheResult, useMindCache };
|