tsdf 9.2.0 → 10.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 +4 -4
- package/dist/main.d.ts +18 -17
- package/dist/main.js +4 -4
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -1216,7 +1216,7 @@ function newTSDFListQueryStore({
|
|
|
1216
1216
|
const queryKeys = getQueriesKeyArray(params);
|
|
1217
1217
|
return filterAndMap(queryKeys, ({ key }) => {
|
|
1218
1218
|
const query = store.state.queries[key];
|
|
1219
|
-
return query
|
|
1219
|
+
return query ? { query, key } : false;
|
|
1220
1220
|
});
|
|
1221
1221
|
}
|
|
1222
1222
|
function getQueriesRelatedToItem(itemPayload) {
|
|
@@ -1263,7 +1263,7 @@ function newTSDFListQueryStore({
|
|
|
1263
1263
|
return filterAndMap(query.items, (itemKey, ignore) => {
|
|
1264
1264
|
const item = store.state.items[itemKey];
|
|
1265
1265
|
const itemPayload = store.state.itemQueries[itemKey]?.payload;
|
|
1266
|
-
return item && itemPayload ? itemDataSelector(item, itemPayload) : ignore;
|
|
1266
|
+
return item && itemPayload ? itemDataSelector(item, itemPayload, itemKey) : ignore;
|
|
1267
1267
|
});
|
|
1268
1268
|
}
|
|
1269
1269
|
async function awaitListQueryFetch(params, size = defaultQuerySize) {
|
|
@@ -1375,8 +1375,8 @@ function newTSDFListQueryStore({
|
|
|
1375
1375
|
);
|
|
1376
1376
|
}
|
|
1377
1377
|
}
|
|
1378
|
-
function defaultItemSelector(data
|
|
1379
|
-
return
|
|
1378
|
+
function defaultItemSelector(data) {
|
|
1379
|
+
return data;
|
|
1380
1380
|
}
|
|
1381
1381
|
function useMultipleListQueries(queries, {
|
|
1382
1382
|
itemSelector = defaultItemSelector,
|
package/dist/main.d.ts
CHANGED
|
@@ -168,11 +168,12 @@ type TSFDUseListItemReturn<Selected, NError, ItemPayload> = {
|
|
|
168
168
|
error: NError | null;
|
|
169
169
|
isLoading: boolean;
|
|
170
170
|
};
|
|
171
|
+
type FetchListFnReturnItem<ItemPayload extends ValidPayload, ItemState extends ValidStoreState> = {
|
|
172
|
+
itemPayload: ItemPayload;
|
|
173
|
+
data: ItemState;
|
|
174
|
+
};
|
|
171
175
|
type FetchListFnReturn<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = {
|
|
172
|
-
items:
|
|
173
|
-
itemPayload: ItemPayload;
|
|
174
|
-
data: ItemState;
|
|
175
|
-
}[];
|
|
176
|
+
items: FetchListFnReturnItem<ItemPayload, ItemState>[];
|
|
176
177
|
hasMore: boolean;
|
|
177
178
|
};
|
|
178
179
|
type ListQueryStoreInitialData<ItemState extends ValidStoreState, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload> = {
|
|
@@ -246,22 +247,16 @@ declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError
|
|
|
246
247
|
error: null;
|
|
247
248
|
hasMore: boolean;
|
|
248
249
|
}>;
|
|
249
|
-
useMultipleListQueries: <SelectedItem = {
|
|
250
|
-
id: string;
|
|
251
|
-
data: ItemState;
|
|
252
|
-
}>(queries: readonly QueryPayload[], { itemSelector, omitPayload, returnIdleStatus, returnRefetchingStatus, loadSize, disableRefetchOnMount, }?: {
|
|
253
|
-
itemSelector?: ((data: ItemState, id: ItemPayload) => SelectedItem) | undefined;
|
|
250
|
+
useMultipleListQueries: <SelectedItem = ItemState>(queries: readonly QueryPayload[], { itemSelector, omitPayload, returnIdleStatus, returnRefetchingStatus, loadSize, disableRefetchOnMount, }?: {
|
|
251
|
+
itemSelector?: ((data: ItemState, id: ItemPayload, itemKey: string) => SelectedItem) | undefined;
|
|
254
252
|
omitPayload?: boolean | undefined;
|
|
255
253
|
disableRefetchOnMount?: boolean | undefined;
|
|
256
254
|
returnIdleStatus?: boolean | undefined;
|
|
257
255
|
returnRefetchingStatus?: boolean | undefined;
|
|
258
256
|
loadSize?: number | undefined;
|
|
259
257
|
}) => readonly TSFDUseListQueryReturn<SelectedItem, QueryPayload, NError>[];
|
|
260
|
-
useListQuery: <SelectedItem_1 = {
|
|
261
|
-
id: string;
|
|
262
|
-
data: ItemState;
|
|
263
|
-
}>(payload: QueryPayload | false | null | undefined, options?: {
|
|
264
|
-
itemSelector?: ((data: ItemState, id: ItemPayload) => SelectedItem_1) | undefined;
|
|
258
|
+
useListQuery: <SelectedItem_1 = ItemState>(payload: QueryPayload | false | null | undefined, options?: {
|
|
259
|
+
itemSelector?: ((data: ItemState, id: ItemPayload, itemKey: string) => SelectedItem_1) | undefined;
|
|
265
260
|
omitPayload?: boolean | undefined;
|
|
266
261
|
disableRefetchOnMount?: boolean | undefined;
|
|
267
262
|
returnIdleStatus?: boolean | undefined;
|
|
@@ -295,12 +290,18 @@ declare function newTSDFListQueryStore<ItemState extends ValidStoreState, NError
|
|
|
295
290
|
ifNothingWasUpdated?: (() => void) | undefined;
|
|
296
291
|
}) => boolean;
|
|
297
292
|
startItemMutation: (itemId: ItemPayload | ((ItemPayload: ItemPayload, itemState: ItemState) => boolean) | ItemPayload[]) => () => void;
|
|
298
|
-
getQueriesState: (params: ((params: QueryPayload, data: TSFDListQuery<NError, QueryPayload>, queryKey: string) => boolean) | QueryPayload[]) =>
|
|
299
|
-
|
|
293
|
+
getQueriesState: (params: ((params: QueryPayload, data: TSFDListQuery<NError, QueryPayload>, queryKey: string) => boolean) | QueryPayload[]) => {
|
|
294
|
+
query: TSFDListQuery<NError, QueryPayload>;
|
|
295
|
+
key: string;
|
|
296
|
+
}[];
|
|
297
|
+
getQueriesRelatedToItem: (itemPayload: ItemPayload) => {
|
|
298
|
+
query: TSFDListQuery<NError, QueryPayload>;
|
|
299
|
+
key: string;
|
|
300
|
+
}[];
|
|
300
301
|
useFindItem: <SelectedItem_4 = ItemState | null>(findItem: (item: ItemState, itemPayload: ItemPayload) => boolean, { selector, }?: {
|
|
301
302
|
selector?: ((data: ItemState, id: ItemPayload) => SelectedItem_4) | undefined;
|
|
302
303
|
}) => Readonly<SelectedItem_4 | null>;
|
|
303
304
|
};
|
|
304
305
|
type TSFDListQueryStore<ItemState extends ValidStoreState, NError, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload> = ReturnType<typeof newTSDFListQueryStore<ItemState, NError, QueryPayload, ItemPayload>>;
|
|
305
306
|
|
|
306
|
-
export { CollectionInitialStateItem, FetchListFnReturn, ListQueryStoreInitialData, TSDFCollectionStore, TSDFDocumentStore, TSDFDocumentStoreState, TSDFItemQuery, TSDFStatus, TSDFUseDocumentReturn, TSFDCollectionItem, TSFDCollectionState, TSFDListQuery, TSFDListQueryState, TSFDListQueryStore, TSFDUseCollectionItemReturn, TSFDUseListItemReturn, TSFDUseListQueryReturn, ValidPayload, ValidStoreState, newTSDFCollectionStore, newTSDFDocumentStore, newTSDFListQueryStore };
|
|
307
|
+
export { CollectionInitialStateItem, FetchListFnReturn, FetchListFnReturnItem, ListQueryStoreInitialData, TSDFCollectionStore, TSDFDocumentStore, TSDFDocumentStoreState, TSDFItemQuery, TSDFStatus, TSDFUseDocumentReturn, TSFDCollectionItem, TSFDCollectionState, TSFDListQuery, TSFDListQueryState, TSFDListQueryStore, TSFDUseCollectionItemReturn, TSFDUseListItemReturn, TSFDUseListQueryReturn, ValidPayload, ValidStoreState, newTSDFCollectionStore, newTSDFDocumentStore, newTSDFListQueryStore };
|
package/dist/main.js
CHANGED
|
@@ -1182,7 +1182,7 @@ function newTSDFListQueryStore({
|
|
|
1182
1182
|
const queryKeys = getQueriesKeyArray(params);
|
|
1183
1183
|
return filterAndMap(queryKeys, ({ key }) => {
|
|
1184
1184
|
const query = store.state.queries[key];
|
|
1185
|
-
return query
|
|
1185
|
+
return query ? { query, key } : false;
|
|
1186
1186
|
});
|
|
1187
1187
|
}
|
|
1188
1188
|
function getQueriesRelatedToItem(itemPayload) {
|
|
@@ -1229,7 +1229,7 @@ function newTSDFListQueryStore({
|
|
|
1229
1229
|
return filterAndMap(query.items, (itemKey, ignore) => {
|
|
1230
1230
|
const item = store.state.items[itemKey];
|
|
1231
1231
|
const itemPayload = store.state.itemQueries[itemKey]?.payload;
|
|
1232
|
-
return item && itemPayload ? itemDataSelector(item, itemPayload) : ignore;
|
|
1232
|
+
return item && itemPayload ? itemDataSelector(item, itemPayload, itemKey) : ignore;
|
|
1233
1233
|
});
|
|
1234
1234
|
}
|
|
1235
1235
|
async function awaitListQueryFetch(params, size = defaultQuerySize) {
|
|
@@ -1341,8 +1341,8 @@ function newTSDFListQueryStore({
|
|
|
1341
1341
|
);
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
|
-
function defaultItemSelector(data
|
|
1345
|
-
return
|
|
1344
|
+
function defaultItemSelector(data) {
|
|
1345
|
+
return data;
|
|
1346
1346
|
}
|
|
1347
1347
|
function useMultipleListQueries(queries, {
|
|
1348
1348
|
itemSelector = defaultItemSelector,
|