tsdf 10.1.0 → 11.0.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.cjs +0 -30
- package/dist/main.d.ts +3 -6
- package/dist/main.js +0 -30
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -397,7 +397,6 @@ function newTSDFDocumentStore({
|
|
|
397
397
|
debugName,
|
|
398
398
|
fetchFn,
|
|
399
399
|
initialData,
|
|
400
|
-
disableRefetchOnWindowFocus,
|
|
401
400
|
disableRefetchOnMount: globalDisableRefetchOnMount,
|
|
402
401
|
lowPriorityThrottleMs,
|
|
403
402
|
mediumPriorityThrottleMs,
|
|
@@ -557,14 +556,6 @@ function newTSDFDocumentStore({
|
|
|
557
556
|
{ action: "update-state" }
|
|
558
557
|
);
|
|
559
558
|
}
|
|
560
|
-
if (!disableRefetchOnWindowFocus) {
|
|
561
|
-
let handleFocus2 = function() {
|
|
562
|
-
invalidateData("lowPriority");
|
|
563
|
-
};
|
|
564
|
-
var handleFocus = handleFocus2;
|
|
565
|
-
window.addEventListener("focus", handleFocus2);
|
|
566
|
-
window.addEventListener("visibilitychange", handleFocus2);
|
|
567
|
-
}
|
|
568
559
|
return {
|
|
569
560
|
store,
|
|
570
561
|
awaitFetch,
|
|
@@ -632,7 +623,6 @@ var import_json = require("klona/json");
|
|
|
632
623
|
function newTSDFCollectionStore({
|
|
633
624
|
debugName,
|
|
634
625
|
fetchFn,
|
|
635
|
-
disableRefetchOnWindowFocus,
|
|
636
626
|
lowPriorityThrottleMs,
|
|
637
627
|
errorNormalizer,
|
|
638
628
|
disableInitialDataInvalidation,
|
|
@@ -1010,14 +1000,6 @@ function newTSDFCollectionStore({
|
|
|
1010
1000
|
);
|
|
1011
1001
|
return someItemWasUpdated;
|
|
1012
1002
|
}
|
|
1013
|
-
if (!disableRefetchOnWindowFocus) {
|
|
1014
|
-
let handleFocus2 = function() {
|
|
1015
|
-
invalidateItem(() => true, "lowPriority");
|
|
1016
|
-
};
|
|
1017
|
-
var handleFocus = handleFocus2;
|
|
1018
|
-
window.addEventListener("focus", handleFocus2);
|
|
1019
|
-
window.addEventListener("visibilitychange", handleFocus2);
|
|
1020
|
-
}
|
|
1021
1003
|
return {
|
|
1022
1004
|
store,
|
|
1023
1005
|
scheduleFetch,
|
|
@@ -1062,7 +1044,6 @@ function newTSDFListQueryStore({
|
|
|
1062
1044
|
errorNormalizer,
|
|
1063
1045
|
defaultQuerySize = 50,
|
|
1064
1046
|
initialData,
|
|
1065
|
-
disableRefetchOnWindowFocus,
|
|
1066
1047
|
disableRefetchOnMount: globalDisableRefetchOnMount,
|
|
1067
1048
|
lowPriorityThrottleMs,
|
|
1068
1049
|
disableInitialDataInvalidation,
|
|
@@ -1941,17 +1922,6 @@ function newTSDFListQueryStore({
|
|
|
1941
1922
|
{ action: { type: "delete-item-state", itemId } }
|
|
1942
1923
|
);
|
|
1943
1924
|
}
|
|
1944
|
-
if (!disableRefetchOnWindowFocus) {
|
|
1945
|
-
let handleFocus2 = function() {
|
|
1946
|
-
invalidateQuery(() => true, "lowPriority");
|
|
1947
|
-
if (fetchItemFn) {
|
|
1948
|
-
invalidateItem(() => true, "lowPriority");
|
|
1949
|
-
}
|
|
1950
|
-
};
|
|
1951
|
-
var handleFocus = handleFocus2;
|
|
1952
|
-
window.addEventListener("focus", handleFocus2);
|
|
1953
|
-
window.addEventListener("visibilitychange", handleFocus2);
|
|
1954
|
-
}
|
|
1955
1925
|
return {
|
|
1956
1926
|
store,
|
|
1957
1927
|
scheduleListQueryFetch,
|
package/dist/main.d.ts
CHANGED
|
@@ -20,13 +20,12 @@ type TSDFUseDocumentReturn<Selected, NError> = {
|
|
|
20
20
|
error: NError | null;
|
|
21
21
|
isLoading: boolean;
|
|
22
22
|
};
|
|
23
|
-
declare function newTSDFDocumentStore<State extends ValidStoreState, NError>({ debugName, fetchFn, initialData,
|
|
23
|
+
declare function newTSDFDocumentStore<State extends ValidStoreState, NError>({ debugName, fetchFn, initialData, disableRefetchOnMount: globalDisableRefetchOnMount, lowPriorityThrottleMs, mediumPriorityThrottleMs, dynamicRealtimeThrottleMs, disableInitialDataInvalidation, errorNormalizer, }: {
|
|
24
24
|
debugName?: string;
|
|
25
25
|
fetchFn: () => Promise<State>;
|
|
26
26
|
initialData?: State;
|
|
27
27
|
disableInitialDataInvalidation?: boolean;
|
|
28
28
|
errorNormalizer: (exception: unknown) => NError;
|
|
29
|
-
disableRefetchOnWindowFocus?: boolean;
|
|
30
29
|
disableRefetchOnMount?: boolean;
|
|
31
30
|
lowPriorityThrottleMs?: number;
|
|
32
31
|
mediumPriorityThrottleMs?: number;
|
|
@@ -77,12 +76,11 @@ type CollectionInitialStateItem<ItemPayload extends ValidPayload, ItemState exte
|
|
|
77
76
|
payload: ItemPayload;
|
|
78
77
|
data: ItemState;
|
|
79
78
|
};
|
|
80
|
-
declare function newTSDFCollectionStore<ItemState extends ValidStoreState, NError, ItemPayload extends ValidPayload>({ debugName, fetchFn,
|
|
79
|
+
declare function newTSDFCollectionStore<ItemState extends ValidStoreState, NError, ItemPayload extends ValidPayload>({ debugName, fetchFn, lowPriorityThrottleMs, errorNormalizer, disableInitialDataInvalidation, mediumPriorityThrottleMs, initialStateItems, disableRefetchOnMount: globalDisableRefetchOnMount, dynamicRealtimeThrottleMs, getCollectionItemKey: filterCollectionItemObjKey, }: {
|
|
81
80
|
debugName?: string;
|
|
82
81
|
fetchFn: (params: ItemPayload) => Promise<ItemState>;
|
|
83
82
|
getCollectionItemKey?: (params: ItemPayload) => ValidPayload | any[];
|
|
84
83
|
errorNormalizer: (exception: unknown) => NError;
|
|
85
|
-
disableRefetchOnWindowFocus?: boolean;
|
|
86
84
|
disableRefetchOnMount?: boolean;
|
|
87
85
|
initialStateItems?: CollectionInitialStateItem<ItemPayload, ItemState>[];
|
|
88
86
|
disableInitialDataInvalidation?: boolean;
|
|
@@ -187,7 +185,7 @@ type ListQueryStoreInitialData<ItemState extends ValidStoreState, QueryPayload e
|
|
|
187
185
|
hasMore: boolean;
|
|
188
186
|
}[];
|
|
189
187
|
};
|
|
190
|
-
declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload>({ debugName, fetchListFn, fetchItemFn, errorNormalizer, defaultQuerySize, initialData,
|
|
188
|
+
declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload>({ debugName, fetchListFn, fetchItemFn, errorNormalizer, defaultQuerySize, initialData, disableRefetchOnMount: globalDisableRefetchOnMount, lowPriorityThrottleMs, disableInitialDataInvalidation, mediumPriorityThrottleMs, dynamicRealtimeThrottleMs, syncMutationsAndInvalidations, }: {
|
|
191
189
|
debugName?: string;
|
|
192
190
|
fetchListFn: (payload: QueryPayload, size: number) => Promise<FetchListFnReturn<ItemState, ItemPayload>>;
|
|
193
191
|
fetchItemFn?: (itemId: ItemPayload) => Promise<ItemState>;
|
|
@@ -195,7 +193,6 @@ declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError
|
|
|
195
193
|
defaultQuerySize?: number;
|
|
196
194
|
initialData?: ListQueryStoreInitialData<ItemState, QueryPayload, ItemPayload>;
|
|
197
195
|
disableInitialDataInvalidation?: boolean;
|
|
198
|
-
disableRefetchOnWindowFocus?: boolean;
|
|
199
196
|
syncMutationsAndInvalidations?: {
|
|
200
197
|
syncQueries: (query1: QueryPayload, query2: QueryPayload) => boolean;
|
|
201
198
|
syncItemAndQuery: (itemPayload: ItemPayload, query: QueryPayload) => boolean;
|
package/dist/main.js
CHANGED
|
@@ -363,7 +363,6 @@ function newTSDFDocumentStore({
|
|
|
363
363
|
debugName,
|
|
364
364
|
fetchFn,
|
|
365
365
|
initialData,
|
|
366
|
-
disableRefetchOnWindowFocus,
|
|
367
366
|
disableRefetchOnMount: globalDisableRefetchOnMount,
|
|
368
367
|
lowPriorityThrottleMs,
|
|
369
368
|
mediumPriorityThrottleMs,
|
|
@@ -523,14 +522,6 @@ function newTSDFDocumentStore({
|
|
|
523
522
|
{ action: "update-state" }
|
|
524
523
|
);
|
|
525
524
|
}
|
|
526
|
-
if (!disableRefetchOnWindowFocus) {
|
|
527
|
-
let handleFocus2 = function() {
|
|
528
|
-
invalidateData("lowPriority");
|
|
529
|
-
};
|
|
530
|
-
var handleFocus = handleFocus2;
|
|
531
|
-
window.addEventListener("focus", handleFocus2);
|
|
532
|
-
window.addEventListener("visibilitychange", handleFocus2);
|
|
533
|
-
}
|
|
534
525
|
return {
|
|
535
526
|
store,
|
|
536
527
|
awaitFetch,
|
|
@@ -598,7 +589,6 @@ import { klona } from "klona/json";
|
|
|
598
589
|
function newTSDFCollectionStore({
|
|
599
590
|
debugName,
|
|
600
591
|
fetchFn,
|
|
601
|
-
disableRefetchOnWindowFocus,
|
|
602
592
|
lowPriorityThrottleMs,
|
|
603
593
|
errorNormalizer,
|
|
604
594
|
disableInitialDataInvalidation,
|
|
@@ -976,14 +966,6 @@ function newTSDFCollectionStore({
|
|
|
976
966
|
);
|
|
977
967
|
return someItemWasUpdated;
|
|
978
968
|
}
|
|
979
|
-
if (!disableRefetchOnWindowFocus) {
|
|
980
|
-
let handleFocus2 = function() {
|
|
981
|
-
invalidateItem(() => true, "lowPriority");
|
|
982
|
-
};
|
|
983
|
-
var handleFocus = handleFocus2;
|
|
984
|
-
window.addEventListener("focus", handleFocus2);
|
|
985
|
-
window.addEventListener("visibilitychange", handleFocus2);
|
|
986
|
-
}
|
|
987
969
|
return {
|
|
988
970
|
store,
|
|
989
971
|
scheduleFetch,
|
|
@@ -1028,7 +1010,6 @@ function newTSDFListQueryStore({
|
|
|
1028
1010
|
errorNormalizer,
|
|
1029
1011
|
defaultQuerySize = 50,
|
|
1030
1012
|
initialData,
|
|
1031
|
-
disableRefetchOnWindowFocus,
|
|
1032
1013
|
disableRefetchOnMount: globalDisableRefetchOnMount,
|
|
1033
1014
|
lowPriorityThrottleMs,
|
|
1034
1015
|
disableInitialDataInvalidation,
|
|
@@ -1907,17 +1888,6 @@ function newTSDFListQueryStore({
|
|
|
1907
1888
|
{ action: { type: "delete-item-state", itemId } }
|
|
1908
1889
|
);
|
|
1909
1890
|
}
|
|
1910
|
-
if (!disableRefetchOnWindowFocus) {
|
|
1911
|
-
let handleFocus2 = function() {
|
|
1912
|
-
invalidateQuery(() => true, "lowPriority");
|
|
1913
|
-
if (fetchItemFn) {
|
|
1914
|
-
invalidateItem(() => true, "lowPriority");
|
|
1915
|
-
}
|
|
1916
|
-
};
|
|
1917
|
-
var handleFocus = handleFocus2;
|
|
1918
|
-
window.addEventListener("focus", handleFocus2);
|
|
1919
|
-
window.addEventListener("visibilitychange", handleFocus2);
|
|
1920
|
-
}
|
|
1921
1891
|
return {
|
|
1922
1892
|
store,
|
|
1923
1893
|
scheduleListQueryFetch,
|