tsdf 12.2.0 → 12.3.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/main.d.cts +17 -13
- package/dist/main.d.ts +17 -13
- package/package.json +1 -1
package/dist/main.d.cts
CHANGED
|
@@ -20,6 +20,7 @@ type TSDFUseDocumentReturn<Selected, NError> = {
|
|
|
20
20
|
error: NError | null;
|
|
21
21
|
isLoading: boolean;
|
|
22
22
|
};
|
|
23
|
+
type OnDocumentInvalidate = (priority: FetchType) => void;
|
|
23
24
|
declare function newTSDFDocumentStore<State extends ValidStoreState, NError>({ debugName, fetchFn, getInitialData, disableRefetchOnMount: globalDisableRefetchOnMount, lowPriorityThrottleMs, mediumPriorityThrottleMs, dynamicRealtimeThrottleMs, disableInitialDataInvalidation, errorNormalizer, onInvalidate, }: {
|
|
24
25
|
debugName?: string;
|
|
25
26
|
fetchFn: () => Promise<State>;
|
|
@@ -30,7 +31,7 @@ declare function newTSDFDocumentStore<State extends ValidStoreState, NError>({ d
|
|
|
30
31
|
lowPriorityThrottleMs?: number;
|
|
31
32
|
mediumPriorityThrottleMs?: number;
|
|
32
33
|
dynamicRealtimeThrottleMs?: (lastFetchDuration: number) => number;
|
|
33
|
-
onInvalidate?:
|
|
34
|
+
onInvalidate?: OnDocumentInvalidate;
|
|
34
35
|
}): {
|
|
35
36
|
store: Store<TSDFDocumentStoreState<State, NError>>;
|
|
36
37
|
reset: () => void;
|
|
@@ -78,6 +79,11 @@ type CollectionInitialStateItem<ItemPayload extends ValidPayload, ItemState exte
|
|
|
78
79
|
payload: ItemPayload;
|
|
79
80
|
data: ItemState;
|
|
80
81
|
};
|
|
82
|
+
type OnCollectionItemInvalidate<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = (props: {
|
|
83
|
+
itemState: ItemState;
|
|
84
|
+
payload: ItemPayload;
|
|
85
|
+
priority: FetchType;
|
|
86
|
+
}) => void;
|
|
81
87
|
declare function newTSDFCollectionStore<ItemState extends ValidStoreState, NError, ItemPayload extends ValidPayload>({ debugName, fetchFn, lowPriorityThrottleMs, errorNormalizer, disableInitialDataInvalidation, mediumPriorityThrottleMs, getInitialData, disableRefetchOnMount: globalDisableRefetchOnMount, dynamicRealtimeThrottleMs, getCollectionItemKey: filterCollectionItemObjKey, onInvalidate, }: {
|
|
82
88
|
debugName?: string;
|
|
83
89
|
fetchFn: (params: ItemPayload) => Promise<ItemState>;
|
|
@@ -89,11 +95,7 @@ declare function newTSDFCollectionStore<ItemState extends ValidStoreState, NErro
|
|
|
89
95
|
lowPriorityThrottleMs?: number;
|
|
90
96
|
mediumPriorityThrottleMs?: number;
|
|
91
97
|
dynamicRealtimeThrottleMs?: (lastFetchDuration: number) => number;
|
|
92
|
-
onInvalidate?:
|
|
93
|
-
itemState: ItemState;
|
|
94
|
-
payload: ItemPayload;
|
|
95
|
-
priority: FetchType;
|
|
96
|
-
}) => void;
|
|
98
|
+
onInvalidate?: OnCollectionItemInvalidate<ItemState, ItemPayload>;
|
|
97
99
|
}): {
|
|
98
100
|
store: Store<TSFDCollectionState<ItemState, ItemPayload, NError>>;
|
|
99
101
|
scheduleFetch: {
|
|
@@ -194,6 +196,12 @@ type ListQueryStoreInitialData<ItemState extends ValidStoreState, QueryPayload e
|
|
|
194
196
|
hasMore: boolean;
|
|
195
197
|
}[];
|
|
196
198
|
};
|
|
199
|
+
type OnListQueryInvalidate<QueryPayload extends ValidPayload> = (query: QueryPayload, priority: FetchType) => void;
|
|
200
|
+
type OnListQueryItemInvalidate<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = (props: {
|
|
201
|
+
itemState: ItemState;
|
|
202
|
+
payload: ItemPayload;
|
|
203
|
+
priority: FetchType;
|
|
204
|
+
}) => void;
|
|
197
205
|
declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload>({ debugName, fetchListFn, fetchItemFn, errorNormalizer, defaultQuerySize, getInitialData, disableRefetchOnMount: globalDisableRefetchOnMount, lowPriorityThrottleMs, disableInitialDataInvalidation, mediumPriorityThrottleMs, dynamicRealtimeThrottleMs, syncMutationsAndInvalidations, optimisticListUpdates, onInvalidateItem, onInvalidateQuery, }: {
|
|
198
206
|
debugName?: string;
|
|
199
207
|
fetchListFn: (payload: QueryPayload, size: number) => Promise<FetchListFnReturn<ItemState, ItemPayload>>;
|
|
@@ -222,12 +230,8 @@ declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError
|
|
|
222
230
|
order?: 'asc' | 'desc' | ('asc' | 'desc')[];
|
|
223
231
|
};
|
|
224
232
|
}[];
|
|
225
|
-
onInvalidateQuery?:
|
|
226
|
-
onInvalidateItem?:
|
|
227
|
-
itemState: ItemState;
|
|
228
|
-
payload: ItemPayload;
|
|
229
|
-
priority: FetchType;
|
|
230
|
-
}) => void;
|
|
233
|
+
onInvalidateQuery?: OnListQueryInvalidate<QueryPayload>;
|
|
234
|
+
onInvalidateItem?: OnListQueryItemInvalidate<ItemState, ItemPayload>;
|
|
231
235
|
}): {
|
|
232
236
|
store: Store<TSFDListQueryState<ItemState, NError, QueryPayload, ItemPayload>>;
|
|
233
237
|
reset: () => void;
|
|
@@ -329,4 +333,4 @@ declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError
|
|
|
329
333
|
};
|
|
330
334
|
type TSFDListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload> = ReturnType<typeof newTSDFListQueryStore<ItemState, NError, QueryPayload, ItemPayload>>;
|
|
331
335
|
|
|
332
|
-
export { CollectionInitialStateItem, FetchListFnReturn, FetchListFnReturnItem, ListQueryStoreInitialData, TSDFCollectionStore, TSDFDocumentStore, TSDFDocumentStoreState, TSDFItemQuery, TSDFStatus, TSDFUseDocumentReturn, TSFDCollectionItem, TSFDCollectionState, TSFDListQuery, TSFDListQueryState, TSFDListQueryStore, TSFDUseCollectionItemReturn, TSFDUseListItemReturn, TSFDUseListQueryReturn, ValidPayload, ValidStoreState, newTSDFCollectionStore, newTSDFDocumentStore, newTSDFListQueryStore };
|
|
336
|
+
export { CollectionInitialStateItem, FetchListFnReturn, FetchListFnReturnItem, ListQueryStoreInitialData, OnCollectionItemInvalidate, OnDocumentInvalidate, OnListQueryInvalidate, OnListQueryItemInvalidate, TSDFCollectionStore, TSDFDocumentStore, TSDFDocumentStoreState, TSDFItemQuery, TSDFStatus, TSDFUseDocumentReturn, TSFDCollectionItem, TSFDCollectionState, TSFDListQuery, TSFDListQueryState, TSFDListQueryStore, TSFDUseCollectionItemReturn, TSFDUseListItemReturn, TSFDUseListQueryReturn, ValidPayload, ValidStoreState, newTSDFCollectionStore, newTSDFDocumentStore, newTSDFListQueryStore };
|
package/dist/main.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ type TSDFUseDocumentReturn<Selected, NError> = {
|
|
|
20
20
|
error: NError | null;
|
|
21
21
|
isLoading: boolean;
|
|
22
22
|
};
|
|
23
|
+
type OnDocumentInvalidate = (priority: FetchType) => void;
|
|
23
24
|
declare function newTSDFDocumentStore<State extends ValidStoreState, NError>({ debugName, fetchFn, getInitialData, disableRefetchOnMount: globalDisableRefetchOnMount, lowPriorityThrottleMs, mediumPriorityThrottleMs, dynamicRealtimeThrottleMs, disableInitialDataInvalidation, errorNormalizer, onInvalidate, }: {
|
|
24
25
|
debugName?: string;
|
|
25
26
|
fetchFn: () => Promise<State>;
|
|
@@ -30,7 +31,7 @@ declare function newTSDFDocumentStore<State extends ValidStoreState, NError>({ d
|
|
|
30
31
|
lowPriorityThrottleMs?: number;
|
|
31
32
|
mediumPriorityThrottleMs?: number;
|
|
32
33
|
dynamicRealtimeThrottleMs?: (lastFetchDuration: number) => number;
|
|
33
|
-
onInvalidate?:
|
|
34
|
+
onInvalidate?: OnDocumentInvalidate;
|
|
34
35
|
}): {
|
|
35
36
|
store: Store<TSDFDocumentStoreState<State, NError>>;
|
|
36
37
|
reset: () => void;
|
|
@@ -78,6 +79,11 @@ type CollectionInitialStateItem<ItemPayload extends ValidPayload, ItemState exte
|
|
|
78
79
|
payload: ItemPayload;
|
|
79
80
|
data: ItemState;
|
|
80
81
|
};
|
|
82
|
+
type OnCollectionItemInvalidate<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = (props: {
|
|
83
|
+
itemState: ItemState;
|
|
84
|
+
payload: ItemPayload;
|
|
85
|
+
priority: FetchType;
|
|
86
|
+
}) => void;
|
|
81
87
|
declare function newTSDFCollectionStore<ItemState extends ValidStoreState, NError, ItemPayload extends ValidPayload>({ debugName, fetchFn, lowPriorityThrottleMs, errorNormalizer, disableInitialDataInvalidation, mediumPriorityThrottleMs, getInitialData, disableRefetchOnMount: globalDisableRefetchOnMount, dynamicRealtimeThrottleMs, getCollectionItemKey: filterCollectionItemObjKey, onInvalidate, }: {
|
|
82
88
|
debugName?: string;
|
|
83
89
|
fetchFn: (params: ItemPayload) => Promise<ItemState>;
|
|
@@ -89,11 +95,7 @@ declare function newTSDFCollectionStore<ItemState extends ValidStoreState, NErro
|
|
|
89
95
|
lowPriorityThrottleMs?: number;
|
|
90
96
|
mediumPriorityThrottleMs?: number;
|
|
91
97
|
dynamicRealtimeThrottleMs?: (lastFetchDuration: number) => number;
|
|
92
|
-
onInvalidate?:
|
|
93
|
-
itemState: ItemState;
|
|
94
|
-
payload: ItemPayload;
|
|
95
|
-
priority: FetchType;
|
|
96
|
-
}) => void;
|
|
98
|
+
onInvalidate?: OnCollectionItemInvalidate<ItemState, ItemPayload>;
|
|
97
99
|
}): {
|
|
98
100
|
store: Store<TSFDCollectionState<ItemState, ItemPayload, NError>>;
|
|
99
101
|
scheduleFetch: {
|
|
@@ -194,6 +196,12 @@ type ListQueryStoreInitialData<ItemState extends ValidStoreState, QueryPayload e
|
|
|
194
196
|
hasMore: boolean;
|
|
195
197
|
}[];
|
|
196
198
|
};
|
|
199
|
+
type OnListQueryInvalidate<QueryPayload extends ValidPayload> = (query: QueryPayload, priority: FetchType) => void;
|
|
200
|
+
type OnListQueryItemInvalidate<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = (props: {
|
|
201
|
+
itemState: ItemState;
|
|
202
|
+
payload: ItemPayload;
|
|
203
|
+
priority: FetchType;
|
|
204
|
+
}) => void;
|
|
197
205
|
declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload>({ debugName, fetchListFn, fetchItemFn, errorNormalizer, defaultQuerySize, getInitialData, disableRefetchOnMount: globalDisableRefetchOnMount, lowPriorityThrottleMs, disableInitialDataInvalidation, mediumPriorityThrottleMs, dynamicRealtimeThrottleMs, syncMutationsAndInvalidations, optimisticListUpdates, onInvalidateItem, onInvalidateQuery, }: {
|
|
198
206
|
debugName?: string;
|
|
199
207
|
fetchListFn: (payload: QueryPayload, size: number) => Promise<FetchListFnReturn<ItemState, ItemPayload>>;
|
|
@@ -222,12 +230,8 @@ declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError
|
|
|
222
230
|
order?: 'asc' | 'desc' | ('asc' | 'desc')[];
|
|
223
231
|
};
|
|
224
232
|
}[];
|
|
225
|
-
onInvalidateQuery?:
|
|
226
|
-
onInvalidateItem?:
|
|
227
|
-
itemState: ItemState;
|
|
228
|
-
payload: ItemPayload;
|
|
229
|
-
priority: FetchType;
|
|
230
|
-
}) => void;
|
|
233
|
+
onInvalidateQuery?: OnListQueryInvalidate<QueryPayload>;
|
|
234
|
+
onInvalidateItem?: OnListQueryItemInvalidate<ItemState, ItemPayload>;
|
|
231
235
|
}): {
|
|
232
236
|
store: Store<TSFDListQueryState<ItemState, NError, QueryPayload, ItemPayload>>;
|
|
233
237
|
reset: () => void;
|
|
@@ -329,4 +333,4 @@ declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError
|
|
|
329
333
|
};
|
|
330
334
|
type TSFDListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload> = ReturnType<typeof newTSDFListQueryStore<ItemState, NError, QueryPayload, ItemPayload>>;
|
|
331
335
|
|
|
332
|
-
export { CollectionInitialStateItem, FetchListFnReturn, FetchListFnReturnItem, ListQueryStoreInitialData, TSDFCollectionStore, TSDFDocumentStore, TSDFDocumentStoreState, TSDFItemQuery, TSDFStatus, TSDFUseDocumentReturn, TSFDCollectionItem, TSFDCollectionState, TSFDListQuery, TSFDListQueryState, TSFDListQueryStore, TSFDUseCollectionItemReturn, TSFDUseListItemReturn, TSFDUseListQueryReturn, ValidPayload, ValidStoreState, newTSDFCollectionStore, newTSDFDocumentStore, newTSDFListQueryStore };
|
|
336
|
+
export { CollectionInitialStateItem, FetchListFnReturn, FetchListFnReturnItem, ListQueryStoreInitialData, OnCollectionItemInvalidate, OnDocumentInvalidate, OnListQueryInvalidate, OnListQueryItemInvalidate, TSDFCollectionStore, TSDFDocumentStore, TSDFDocumentStoreState, TSDFItemQuery, TSDFStatus, TSDFUseDocumentReturn, TSFDCollectionItem, TSFDCollectionState, TSFDListQuery, TSFDListQueryState, TSFDListQueryStore, TSFDUseCollectionItemReturn, TSFDUseListItemReturn, TSFDUseListQueryReturn, ValidPayload, ValidStoreState, newTSDFCollectionStore, newTSDFDocumentStore, newTSDFListQueryStore };
|