live-cache 0.1.0 → 0.2.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.
@@ -24,12 +24,15 @@ export interface UseControllerResult<TVariable, TName extends string> {
24
24
  * @param where - optional `Collection.find()` filter (string `_id` or partial)
25
25
  * @param options - store selection, initialise behavior, abort-on-unmount, and invalidation wiring
26
26
  *
27
- * When `options.withInvalidation` is true, this hook calls `controller.invalidate()` once on mount
28
- * and calls the returned cleanup function on unmount.
27
+ * When `options.withInvalidation` is true, this hook calls
28
+ * `controller.invalidator.registerInvalidation()` on mount and
29
+ * `controller.invalidator.unregisterInvalidation()` on unmount.
29
30
  *
30
31
  * @example
31
32
  * ```tsx
32
- * const { data, controller } = useController<User, "users">("users");
33
+ * const { data, controller } = useController<User, "users">("users", undefined, {
34
+ * withInvalidation: true,
35
+ * });
33
36
  * return (
34
37
  * <button onClick={() => void controller.invalidate()}>Refresh</button>
35
38
  * );
@@ -23,7 +23,6 @@ export interface IndexDbStorageManagerOptions {
23
23
  export default class IndexDbStorageManager extends StorageManager<any> {
24
24
  private dbName;
25
25
  private storeName;
26
- private prefix;
27
26
  private dbPromise;
28
27
  constructor(options?: IndexDbStorageManagerOptions);
29
28
  private key;
@@ -34,4 +33,5 @@ export default class IndexDbStorageManager extends StorageManager<any> {
34
33
  get<T>(name: string): Promise<T[]>;
35
34
  set(name: string, models: any[]): Promise<void>;
36
35
  delete(name: string): Promise<void>;
36
+ getParams(): Promise<string[]>;
37
37
  }
@@ -6,10 +6,10 @@ import { StorageManager } from "../core/StorageManager";
6
6
  * Reads return `[]` on failure (private mode, JSON parse issues, etc).
7
7
  */
8
8
  export default class LocalStorageStorageManager extends StorageManager<any> {
9
- prefix: string;
10
9
  constructor(prefix?: string);
11
10
  private key;
12
11
  get<T>(name: string): Promise<T[]>;
13
12
  set(name: string, models: any[]): Promise<void>;
14
13
  delete(name: string): Promise<void>;
14
+ getParams(): Promise<string[]>;
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "live-cache",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A client-side cache + controller library for stateful resources",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",