use-abcd 1.4.0 → 1.4.1
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/README.md +209 -226
- package/dist/collection.d.ts +2 -3
- package/dist/index.js +203 -213
- package/dist/index.js.map +1 -1
- package/dist/item-cache.test.d.ts +1 -0
- package/dist/item.d.ts +1 -5
- package/dist/types.d.ts +1 -1
- package/dist/useCrud.d.ts +1 -1
- package/dist/useItem.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/item.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { Draft } from 'mutative';
|
|
2
2
|
import { Collection } from './collection';
|
|
3
3
|
import { ItemStatus } from './types';
|
|
4
|
-
export declare class Item<T, C = unknown> {
|
|
4
|
+
export declare class Item<T extends object, C = unknown> {
|
|
5
5
|
private _collection;
|
|
6
6
|
private _id;
|
|
7
7
|
private _cachedStatus;
|
|
8
|
-
private _refCount;
|
|
9
8
|
constructor(collection: Collection<T, C>, id: string);
|
|
10
|
-
_retain(): void;
|
|
11
|
-
_release(): void;
|
|
12
|
-
get refCount(): number;
|
|
13
9
|
get id(): string;
|
|
14
10
|
get data(): T | undefined;
|
|
15
11
|
update(mutate: (draft: Draft<T>) => void): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export type SyncQueueState<T> = {
|
|
|
45
45
|
isSyncing: boolean;
|
|
46
46
|
};
|
|
47
47
|
export type FetchState = "idle" | "fetching" | "error";
|
|
48
|
-
export type Config<T, C> = {
|
|
48
|
+
export type Config<T extends object, C> = {
|
|
49
49
|
id: string;
|
|
50
50
|
initialContext: C;
|
|
51
51
|
getId: (item: T) => string;
|
package/dist/useCrud.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Draft } from 'mutative';
|
|
2
2
|
import { Config, Mutator } from './types';
|
|
3
3
|
export type { Config, Change, SyncResult, ItemStatus, SyncQueueState, SyncState, ChangeType, ItemSyncStatus, FetchState, } from './types';
|
|
4
|
-
export declare function useCrud<T, C>(config: Config<T, C>): {
|
|
4
|
+
export declare function useCrud<T extends object, C>(config: Config<T, C>): {
|
|
5
5
|
items: Map<string, T>;
|
|
6
6
|
context: C;
|
|
7
7
|
syncState: import('./types').SyncState;
|
package/dist/useItem.d.ts
CHANGED