tsdf 17.0.0-alpha.6 → 17.0.0-alpha.7

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.
Files changed (2) hide show
  1. package/dist/main.d.ts +187 -83
  2. package/package.json +1 -1
package/dist/main.d.ts CHANGED
@@ -1528,12 +1528,16 @@ type SnapshotConsistency = 'optimistic' | 'confirmed';
1528
1528
  //#endregion
1529
1529
  //#region src/collectionStore/useMultipleItems.d.ts
1530
1530
  type UseMultipleItemsOptions$1<ItemState extends ValidStoreState, Selected> = {
1531
- selector?: (data: ItemState | null) => Selected;
1532
- returnIdleStatus?: boolean;
1533
- returnRefetchingStatus?: boolean;
1534
- omitPayload?: boolean; /** Only loads the data if it is not already loaded and skip any other refetches */
1535
- disableRefetches?: boolean;
1536
- disableRefetchOnMount?: boolean;
1531
+ /** Maps each item before it is returned from the hook. */selector?: (data: ItemState | null) => Selected; /** Returns `idle` instead of `loading` while items have not been fetched. */
1532
+ returnIdleStatus?: boolean; /** Returns `refetching` instead of keeping `loaded` status during refetches. */
1533
+ returnRefetchingStatus?: boolean; /** Omits `payload` from each query result unless overridden per item. */
1534
+ omitPayload?: boolean;
1535
+ /**
1536
+ * Only fetches when an item is missing from state, skipping stale-state and
1537
+ * invalidation refetches.
1538
+ */
1539
+ disableRefetches?: boolean; /** Prevents automatic mount refetches for stale loaded data. */
1540
+ disableRefetchOnMount?: boolean; /** Marks these subscriptions as off-screen, lowering automatic fetch priority. */
1537
1541
  isOffScreen?: boolean;
1538
1542
  /**
1539
1543
  * Debounces automatic fetches caused by payload changes, while selection
@@ -1575,13 +1579,17 @@ type TSFDUseCollectionItemReturn<Selected, ItemPayload, QueryMetadata extends un
1575
1579
  queryMetadata: QueryMetadata;
1576
1580
  };
1577
1581
  type CollectionUseMultipleItemsQuery<ItemPayload extends ValidPayload, QueryMetadata extends undefined | Record<string, unknown> = undefined> = {
1578
- payload: ItemPayload;
1579
- queryMetadata?: QueryMetadata;
1580
- omitPayload?: boolean; /** Only loads the data if it is not already loaded and skip any other refetches */
1581
- disableRefetches?: boolean;
1582
- disableRefetchOnMount?: boolean;
1583
- returnIdleStatus?: boolean;
1584
- returnRefetchingStatus?: boolean;
1582
+ /** Item payload to subscribe to and fetch when needed. */payload: ItemPayload; /** Metadata returned with this query result for caller-side bookkeeping. */
1583
+ queryMetadata?: QueryMetadata; /** Omits `payload` from this query result. */
1584
+ omitPayload?: boolean;
1585
+ /**
1586
+ * Only fetches when the item is missing from state, skipping stale-state and
1587
+ * invalidation refetches.
1588
+ */
1589
+ disableRefetches?: boolean; /** Prevents the automatic mount refetch for stale loaded data. */
1590
+ disableRefetchOnMount?: boolean; /** Returns `idle` instead of `loading` while the item has not been fetched. */
1591
+ returnIdleStatus?: boolean; /** Returns `refetching` instead of keeping `loaded` status during refetches. */
1592
+ returnRefetchingStatus?: boolean; /** Marks this subscription as off-screen, lowering automatic fetch priority. */
1585
1593
  isOffScreen?: boolean;
1586
1594
  };
1587
1595
  type OnCollectionItemInvalidate<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = (props: {
@@ -1752,22 +1760,22 @@ type CollectionStore<ItemState extends ValidStoreState, ItemPayload extends Vali
1752
1760
  useMultipleItems: <Selected = ItemState | null, QueryMetadata extends undefined | Record<string, unknown> = undefined>(items: CollectionUseMultipleItemsQuery<ItemPayload, QueryMetadata>[], options?: UseMultipleItemsOptions$1<ItemState, Selected>) => readonly TSFDUseCollectionItemReturn<Selected, ItemPayload, QueryMetadata>[];
1753
1761
  useItem: <Selected = ItemState | null>(payload: ItemPayload | undefined | false | null, options?: UseItemOptions$1<ItemState, Selected>) => TSFDUseCollectionItemReturn<Selected, ItemPayload>;
1754
1762
  useListItemIsLoading: (payload: ItemPayload, args: {
1755
- itemId: string;
1756
- selector: (data: ItemState | null) => unknown;
1757
- loadItemFallback?: () => void;
1763
+ /** Unique identifier of the sub-item within the collection item. */itemId: string; /** Extracts the sub-item from the collection item data. */
1764
+ selector: (data: ItemState | null) => unknown; /** Called if the sub-item is still missing and no refetch is in progress. */
1765
+ loadItemFallback?: () => void; /** Forces a high-priority fetch and keeps the hook loading until data is loaded. */
1758
1766
  ensureIsLoaded?: boolean;
1759
1767
  }) => boolean;
1760
1768
  useListItemIsDeleted: (payload: ItemPayload, args: {
1761
- itemId: string;
1762
- selector: (data: ItemState | null) => unknown;
1763
- onDelete?: () => void;
1769
+ /** Unique identifier of the sub-item within the collection item. */itemId: string; /** Extracts the sub-item from the collection item data. */
1770
+ selector: (data: ItemState | null) => unknown; /** Called once when deletion is detected. */
1771
+ onDelete?: () => void; /** Forces a high-priority fetch and keeps the hook loading until data is loaded. */
1764
1772
  ensureIsLoaded?: boolean;
1765
1773
  }) => boolean;
1766
1774
  useListItem: <Selected>(payload: ItemPayload, args: {
1767
- itemId: string;
1768
- selector: (data: ItemState | null) => Selected;
1769
- loadItemFallback?: () => void;
1770
- onDelete?: () => void;
1775
+ /** Unique identifier of the sub-item within the collection item. */itemId: string; /** Extracts and maps the sub-item from the collection item data. */
1776
+ selector: (data: ItemState | null) => Selected; /** Called if the sub-item is still missing and no refetch is in progress. */
1777
+ loadItemFallback?: () => void; /** Called once when deletion is detected. */
1778
+ onDelete?: () => void; /** Forces a high-priority fetch and keeps the hook loading until data is loaded. */
1771
1779
  ensureIsLoaded?: boolean;
1772
1780
  }) => {
1773
1781
  isLoading: boolean;
@@ -1977,32 +1985,40 @@ type DocumentStore<State extends ValidStoreState, TOfflineOperations extends Doc
1977
1985
  parseOfflineResolutionConflict: (resolution: OfflineResolutionRecord) => ParsedOfflineResolutionConflictResultForStore<ResolvedDocumentOfflineOperations<TOfflineOperations>>;
1978
1986
  resolveOfflineResolution: <TName extends keyof ResolvedDocumentOfflineOperations<TOfflineOperations> & string>(resolutionId: string, operationName: TName, resolution: OfflineResolutionActionForOperation<ResolvedDocumentOfflineOperations<TOfflineOperations>, TName>) => Promise<void> | void;
1979
1987
  useDocument: <Selected = State | null>(args?: {
1980
- selector?: (data: State | null) => Selected;
1981
- disabled?: boolean;
1988
+ /** Maps the document data before it is returned from the hook. */selector?: (data: State | null) => Selected; /** Disables this hook subscription and prevents automatic fetches. */
1989
+ disabled?: boolean; /** Marks this subscription as off-screen, lowering automatic fetch priority. */
1982
1990
  isOffScreen?: boolean;
1983
- disableRefetches?: boolean;
1984
- disableRefetchOnMount?: boolean;
1991
+ /**
1992
+ * Only fetches when the document is missing from state, skipping stale-state
1993
+ * and invalidation refetches.
1994
+ */
1995
+ disableRefetches?: boolean; /** Prevents the automatic mount refetch for stale loaded data. */
1996
+ disableRefetchOnMount?: boolean; /** Returns `idle` instead of `loading` while the document has not been fetched. */
1985
1997
  returnIdleStatus?: boolean;
1986
- ensureIsLoaded?: boolean;
1998
+ /**
1999
+ * Forces a high-priority fetch on mount and keeps the hook in `loading`
2000
+ * until the document finishes loading.
2001
+ */
2002
+ ensureIsLoaded?: boolean; /** Returns `refetching` instead of keeping `loaded` status during refetches. */
1987
2003
  returnRefetchingStatus?: boolean;
1988
2004
  }) => TSDFUseDocumentReturn<Selected>;
1989
2005
  useListItemIsLoading: (args: {
1990
- itemId: string;
1991
- selector: (data: State | null) => unknown;
1992
- loadItemFallback?: () => void;
2006
+ /** Unique identifier of the item within the document. */itemId: string; /** Extracts the item from the document data. */
2007
+ selector: (data: State | null) => unknown; /** Called if the item is still missing and no refetch is in progress. */
2008
+ loadItemFallback?: () => void; /** Forces a high-priority fetch and keeps the hook loading until data is loaded. */
1993
2009
  ensureIsLoaded?: boolean;
1994
2010
  }) => boolean;
1995
2011
  useListItemIsDeleted: (args: {
1996
- itemId: string;
1997
- selector: (data: State | null) => unknown;
1998
- onDelete?: () => void;
2012
+ /** Unique identifier of the item within the document. */itemId: string; /** Extracts the item from the document data. */
2013
+ selector: (data: State | null) => unknown; /** Called once when deletion is detected. */
2014
+ onDelete?: () => void; /** Forces a high-priority fetch and keeps the hook loading until data is loaded. */
1999
2015
  ensureIsLoaded?: boolean;
2000
2016
  }) => boolean;
2001
2017
  useListItem: <Selected>(args: {
2002
- itemId: string;
2003
- selector: (data: State | null) => Selected;
2004
- loadItemFallback?: () => void;
2005
- onDelete?: () => void;
2018
+ /** Unique identifier of the item within the document. */itemId: string; /** Extracts and maps the item from the document data. */
2019
+ selector: (data: State | null) => Selected; /** Called if the item is still missing and no refetch is in progress. */
2020
+ loadItemFallback?: () => void; /** Called once when deletion is detected. */
2021
+ onDelete?: () => void; /** Forces a high-priority fetch and keeps the hook loading until data is loaded. */
2006
2022
  ensureIsLoaded?: boolean;
2007
2023
  }) => {
2008
2024
  isLoading: boolean;
@@ -2065,6 +2081,12 @@ type TSFDListQueryState<ItemState extends ValidStoreState, QueryPayload extends
2065
2081
  itemLoadedFields: Record<string, string[]>;
2066
2082
  itemFieldInvalidationFields: Record<string, string[]>;
2067
2083
  };
2084
+ /**
2085
+ * Partial-resource fields to request.
2086
+ *
2087
+ * Pass a field-name array to load only those fields, or `'*'` to load the
2088
+ * complete item.
2089
+ */
2068
2090
  type FieldsInput = string[] | '*';
2069
2091
  type TSFDUseListQueryReturn<Selected, QueryPayload, QueryMetadata extends undefined | Record<string, unknown> = undefined, HasPartialResources extends boolean = false> = {
2070
2092
  items: Selected[];
@@ -2116,35 +2138,55 @@ type ListQueryStoreInitialData<ItemState extends ValidStoreState, QueryPayload e
2116
2138
  }[];
2117
2139
  };
2118
2140
  type ListQueryUseMultipleItemsQuery<ItemPayload extends ValidPayload, QueryMetadata extends undefined | Record<string, unknown> = undefined> = {
2119
- payload: ItemPayload;
2120
- fields?: FieldsInput;
2121
- queryMetadata?: QueryMetadata; /** Only loads the data if it is not already loaded and skip any other refetches */
2122
- disableRefetches?: boolean;
2123
- disableRefetchOnMount?: boolean;
2124
- returnIdleStatus?: boolean;
2141
+ /** Item payload to subscribe to and fetch when needed. */payload: ItemPayload;
2142
+ /**
2143
+ * Partial-resource fields to request for this item.
2144
+ *
2145
+ * Pass `'*'` to fetch the complete item. This option is required when
2146
+ * `partialResources` is enabled and optional otherwise.
2147
+ */
2148
+ fields?: FieldsInput; /** Metadata returned with this item result for caller-side bookkeeping. */
2149
+ queryMetadata?: QueryMetadata;
2150
+ /**
2151
+ * Only fetches when the item is missing from state, skipping stale-state and
2152
+ * invalidation refetches.
2153
+ */
2154
+ disableRefetches?: boolean; /** Prevents the automatic mount refetch for stale loaded data. */
2155
+ disableRefetchOnMount?: boolean; /** Returns `idle` instead of `loading` while the item has not been fetched. */
2156
+ returnIdleStatus?: boolean; /** Returns `refetching` instead of keeping `loaded` status during refetches. */
2125
2157
  returnRefetchingStatus?: boolean;
2126
2158
  /**
2127
2159
  * When requested fields are missing but cached partial data exists, return
2128
2160
  * `refetching` instead of `loading`.
2129
2161
  */
2130
- showPartialAsRefetching?: boolean;
2162
+ showPartialAsRefetching?: boolean; /** Marks this subscription as off-screen, lowering automatic fetch priority. */
2131
2163
  isOffScreen?: boolean;
2132
2164
  };
2133
2165
  type ListQueryUseMultipleListQueriesQuery<QueryPayload extends ValidPayload, QueryMetadata extends undefined | Record<string, unknown> = undefined> = {
2134
- payload: QueryPayload;
2135
- fields?: FieldsInput;
2136
- queryMetadata?: QueryMetadata;
2137
- omitPayload?: boolean; /** Only loads the data if it is not already loaded and skip any other refetches */
2138
- disableRefetches?: boolean;
2139
- disableRefetchOnMount?: boolean;
2140
- returnIdleStatus?: boolean;
2166
+ /** Query payload to subscribe to and fetch when needed. */payload: QueryPayload;
2167
+ /**
2168
+ * Partial-resource fields to request for each item in this query.
2169
+ *
2170
+ * Pass `'*'` to fetch complete items. This option is required when
2171
+ * `partialResources` is enabled and optional otherwise.
2172
+ */
2173
+ fields?: FieldsInput; /** Metadata returned with this query result for caller-side bookkeeping. */
2174
+ queryMetadata?: QueryMetadata; /** Omits `payload` from this query result. */
2175
+ omitPayload?: boolean;
2176
+ /**
2177
+ * Only fetches when the query is missing from state, skipping stale-state and
2178
+ * invalidation refetches.
2179
+ */
2180
+ disableRefetches?: boolean; /** Prevents the automatic mount refetch for stale loaded data. */
2181
+ disableRefetchOnMount?: boolean; /** Returns `idle` instead of `loading` while the query has not been fetched. */
2182
+ returnIdleStatus?: boolean; /** Returns `refetching` instead of keeping `loaded` status during refetches. */
2141
2183
  returnRefetchingStatus?: boolean;
2142
2184
  /**
2143
2185
  * When requested fields are missing but cached partial data exists, return
2144
2186
  * `refetching` instead of `loading`.
2145
2187
  */
2146
- showPartialAsRefetching?: boolean;
2147
- isOffScreen?: boolean;
2188
+ showPartialAsRefetching?: boolean; /** Marks this subscription as off-screen, lowering automatic fetch priority. */
2189
+ isOffScreen?: boolean; /** Number of items to request when fetching this query page. */
2148
2190
  loadSize?: number;
2149
2191
  };
2150
2192
  type OnListQueryInvalidate<QueryPayload extends ValidPayload> = (query: QueryPayload, priority: FetchType) => void;
@@ -2164,10 +2206,10 @@ type OptimisticListUpdate<ItemState extends ValidStoreState, QueryPayload extend
2164
2206
  };
2165
2207
  };
2166
2208
  type QueryFetchPayload<QueryPayload extends ValidPayload> = {
2167
- type: 'load' | 'loadMore';
2168
- payload: QueryPayload;
2169
- offset: number;
2170
- limit: number;
2209
+ /** Whether this request loads the first page or a later page. */type: 'load' | 'loadMore'; /** Query payload being fetched. */
2210
+ payload: QueryPayload; /** Offset used for offset-paginated fetches. */
2211
+ offset: number; /** Maximum number of items requested. */
2212
+ limit: number; /** Partial-resource fields requested for each item in the fetched query. */
2171
2213
  fields?: string[];
2172
2214
  };
2173
2215
  type OffsetPaginationConfig = {
@@ -2218,24 +2260,40 @@ type DerivedQueriesConfig<ItemState extends ValidStoreState, QueryPayload extend
2218
2260
  deriveQuery: (queryPayload: QueryPayload, items: DerivedQueryItem<ItemState>[], context: DerivedQueryContext) => string[] | false;
2219
2261
  };
2220
2262
  type FieldsOption<HasPartialResources extends boolean> = HasPartialResources extends true ? {
2263
+ /**
2264
+ * Partial-resource fields to request.
2265
+ *
2266
+ * Pass `'*'` to fetch complete items. This option is required when
2267
+ * `partialResources` is enabled.
2268
+ */
2221
2269
  fields: FieldsInput;
2222
2270
  } : {
2271
+ /**
2272
+ * Partial-resource fields to request.
2273
+ *
2274
+ * Pass `'*'` to fetch complete items. This option is optional when
2275
+ * `partialResources` is not enabled.
2276
+ */
2223
2277
  fields?: FieldsInput;
2224
2278
  };
2225
2279
  //#endregion
2226
2280
  //#region src/listQueryStore/useMultipleItems.d.ts
2227
2281
  type UseMultipleItemsOptions<ItemState extends ValidStoreState, Selected> = {
2228
- selector?: (data: ItemState | null, payload: ValidPayload | null) => Selected;
2229
- loadFromStateOnly?: boolean;
2230
- returnIdleStatus?: boolean;
2282
+ /** Maps each item before it is returned from the hook. */selector?: (data: ItemState | null, payload: ValidPayload | null) => Selected; /** Reads only from the current store state and never schedules fetches. */
2283
+ loadFromStateOnly?: boolean; /** Returns `idle` instead of `loading` while items have not been fetched. */
2284
+ returnIdleStatus?: boolean; /** Returns `refetching` instead of keeping `loaded` status during refetches. */
2231
2285
  returnRefetchingStatus?: boolean;
2232
2286
  /**
2233
2287
  * When requested fields are missing but cached partial data exists, return
2234
2288
  * `refetching` instead of `loading`.
2235
2289
  */
2236
- showPartialAsRefetching?: boolean; /** Only loads the data if it is not already loaded and skip any other refetches */
2237
- disableRefetches?: boolean;
2238
- disableRefetchOnMount?: boolean;
2290
+ showPartialAsRefetching?: boolean;
2291
+ /**
2292
+ * Only fetches when an item is missing from state, skipping stale-state and
2293
+ * invalidation refetches.
2294
+ */
2295
+ disableRefetches?: boolean; /** Prevents automatic mount refetches for stale loaded data. */
2296
+ disableRefetchOnMount?: boolean; /** Marks these subscriptions as off-screen, lowering automatic fetch priority. */
2239
2297
  isOffScreen?: boolean;
2240
2298
  /**
2241
2299
  * Debounces automatic fetches caused by payload changes, while selection
@@ -2253,6 +2311,12 @@ type UseItemOptions<ItemState extends ValidStoreState, Selected> = UseMultipleIt
2253
2311
  * `debouncePayload`.
2254
2312
  */
2255
2313
  ensureIsLoaded?: boolean;
2314
+ /**
2315
+ * Partial-resource fields to request for this item.
2316
+ *
2317
+ * Pass `'*'` to fetch the complete item. This option is required when
2318
+ * `partialResources` is enabled and optional otherwise.
2319
+ */
2256
2320
  fields?: FieldsInput;
2257
2321
  /**
2258
2322
  * When requested fields are missing but cached partial data exists, return
@@ -2263,18 +2327,22 @@ type UseItemOptions<ItemState extends ValidStoreState, Selected> = UseMultipleIt
2263
2327
  //#endregion
2264
2328
  //#region src/listQueryStore/useMultipleListQueries.d.ts
2265
2329
  type UseMultipleListQueriesOptions<ItemState extends ValidStoreState, ItemPayload extends ValidPayload, SelectedItem> = {
2266
- itemSelector?: (data: ItemState, itemPayload: ItemPayload, itemKey: string) => SelectedItem;
2267
- returnIdleStatus?: boolean;
2330
+ /** Maps each query item before it is returned from the hook. */itemSelector?: (data: ItemState, itemPayload: ItemPayload, itemKey: string) => SelectedItem; /** Returns `idle` instead of `loading` while queries have not been fetched. */
2331
+ returnIdleStatus?: boolean; /** Returns `refetching` instead of keeping `loaded` status during refetches. */
2268
2332
  returnRefetchingStatus?: boolean;
2269
2333
  /**
2270
2334
  * When requested fields are missing but cached partial data exists, return
2271
2335
  * `refetching` instead of `loading`.
2272
2336
  */
2273
- showPartialAsRefetching?: boolean;
2274
- omitPayload?: boolean; /** Only loads the data if it is not already loaded and skip any other refetches */
2275
- disableRefetches?: boolean;
2276
- disableRefetchOnMount?: boolean;
2277
- isOffScreen?: boolean;
2337
+ showPartialAsRefetching?: boolean; /** Omits `payload` from each query result unless overridden per query. */
2338
+ omitPayload?: boolean;
2339
+ /**
2340
+ * Only fetches when a query is missing from state, skipping stale-state and
2341
+ * invalidation refetches.
2342
+ */
2343
+ disableRefetches?: boolean; /** Prevents automatic mount refetches for stale loaded data. */
2344
+ disableRefetchOnMount?: boolean; /** Marks these subscriptions as off-screen, lowering automatic fetch priority. */
2345
+ isOffScreen?: boolean; /** Number of items to request when fetching each query page. */
2278
2346
  loadSize?: number;
2279
2347
  /**
2280
2348
  * Debounces automatic fetches caused by payload changes, while selection
@@ -2292,6 +2360,12 @@ type UseListQueryOptions<ItemState extends ValidStoreState, ItemPayload extends
2292
2360
  * `debouncePayload`.
2293
2361
  */
2294
2362
  ensureIsLoaded?: boolean;
2363
+ /**
2364
+ * Partial-resource fields to request for each item in this query.
2365
+ *
2366
+ * Pass `'*'` to fetch complete items. This option is required when
2367
+ * `partialResources` is enabled and optional otherwise.
2368
+ */
2295
2369
  fields?: FieldsInput;
2296
2370
  /**
2297
2371
  * When requested fields are missing but cached partial data exists, return
@@ -2337,8 +2411,20 @@ type ListQueryStoreStoreEvents<ItemPayload extends ValidPayload> = {
2337
2411
  type ResolvedListQueryOfflineOperations<TOfflineOperations> = TOfflineOperations extends null ? Record<never, never> : Exclude<TOfflineOperations, null>;
2338
2412
  type ListQueryHasPartialResources<TPartialResources extends boolean> = [TPartialResources] extends [true] ? true : false;
2339
2413
  type ListQueryFetchFieldsOption<TPartialResources extends boolean> = ListQueryHasPartialResources<TPartialResources> extends true ? {
2414
+ /**
2415
+ * Partial-resource fields to request.
2416
+ *
2417
+ * Pass `'*'` to fetch complete items. This option is required when
2418
+ * `partialResources` is enabled.
2419
+ */
2340
2420
  fields: FieldsInput;
2341
2421
  } : {
2422
+ /**
2423
+ * Partial-resource fields to request.
2424
+ *
2425
+ * Pass `'*'` to fetch complete items. This option is optional when
2426
+ * `partialResources` is not enabled.
2427
+ */
2342
2428
  fields?: FieldsInput;
2343
2429
  };
2344
2430
  type ListQueryScheduleFetchWithFieldsOption<TPartialResources extends boolean> = ScheduleFetchOptions & ListQueryFetchFieldsOption<TPartialResources>;
@@ -2402,18 +2488,14 @@ type ListQueryUseMultipleListQueriesApi<ItemState extends ValidStoreState, Query
2402
2488
  <S = ItemState>(queries: ListQueryUseMultipleListQueriesQuery<QueryPayload, undefined>[], options: UseMultipleListQueriesOptions<ItemState, ItemPayload, S>): readonly TSFDUseListQueryReturn<S, QueryPayload, undefined>[];
2403
2489
  };
2404
2490
  type ListQueryUseListQueryApi<ItemState extends ValidStoreState, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload, TPartialResources extends boolean> = {
2405
- <SelectedItem = ItemState>(payload: QueryPayload | false | null | undefined, ...args: ListQueryHasPartialResources<TPartialResources> extends true ? [options: UseListQueryOptions<ItemState, ItemPayload, SelectedItem> & {
2406
- fields: FieldsInput;
2407
- }] : [options?: UseListQueryOptions<ItemState, ItemPayload, SelectedItem>]): TSFDUseListQueryReturn<SelectedItem, QueryPayload, undefined>;
2491
+ <SelectedItem = ItemState>(payload: QueryPayload | false | null | undefined, ...args: ListQueryHasPartialResources<TPartialResources> extends true ? [options: UseListQueryOptions<ItemState, ItemPayload, SelectedItem> & FieldsOption<true>] : [options?: UseListQueryOptions<ItemState, ItemPayload, SelectedItem>]): TSFDUseListQueryReturn<SelectedItem, QueryPayload, undefined>;
2408
2492
  };
2409
2493
  type ListQueryUseMultipleItemsApi<ItemState extends ValidStoreState, ItemPayload extends ValidPayload, TPartialResources extends boolean> = {
2410
2494
  <Selected = ItemState | null, QueryMetadata extends undefined | Record<string, unknown> = undefined>(items: (ListQueryUseMultipleItemsQuery<ItemPayload, QueryMetadata> & FieldsOption<ListQueryHasPartialResources<TPartialResources>>)[], options?: UseMultipleItemsOptions<ItemState, Selected>): readonly TSFDUseListItemReturn<Selected, ItemPayload, QueryMetadata>[];
2411
2495
  <S = ItemState | null>(items: ListQueryUseMultipleItemsQuery<ItemPayload, undefined>[], options: UseMultipleItemsOptions<ItemState, S>): readonly TSFDUseListItemReturn<S, ItemPayload, undefined>[];
2412
2496
  };
2413
2497
  type ListQueryUseItemApi<ItemState extends ValidStoreState, ItemPayload extends ValidPayload, TPartialResources extends boolean> = {
2414
- <Selected = ItemState | null>(itemPayload: ItemPayload | false | null | undefined, ...args: ListQueryHasPartialResources<TPartialResources> extends true ? [options: UseItemOptions<ItemState, Selected> & {
2415
- fields: FieldsInput;
2416
- }] : [options?: UseItemOptions<ItemState, Selected>]): TSFDUseListItemReturn<Selected, ItemPayload>;
2498
+ <Selected = ItemState | null>(itemPayload: ItemPayload | false | null | undefined, ...args: ListQueryHasPartialResources<TPartialResources> extends true ? [options: UseItemOptions<ItemState, Selected> & FieldsOption<true>] : [options?: UseItemOptions<ItemState, Selected>]): TSFDUseListItemReturn<Selected, ItemPayload>;
2417
2499
  };
2418
2500
  type ListQueryUsePendingOfflineItemsApi<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = {
2419
2501
  <SelectedItem = ItemState>(options?: UsePendingOfflineItemsOptions<ItemState, ItemPayload, SelectedItem>): TSFDUsePendingOfflineItemsReturn<SelectedItem, ItemPayload>;
@@ -2465,16 +2547,38 @@ type ListQueryAddItemToStateApi<ItemState extends ValidStoreState, QueryPayload
2465
2547
  }) => void;
2466
2548
  type ListQueryDeleteItemStateApi<ItemState extends ValidStoreState, ItemPayload extends ValidPayload> = (itemId: ItemPayload | ItemPayload[] | ListQueryFilterItem<ItemState, ItemPayload>) => void;
2467
2549
  type ListQueryInvalidateQueryAndItemsArgs<ItemState extends ValidStoreState, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload> = {
2468
- /** Invalidate every cached query and every cached item. */all: true;
2550
+ /** Invalidate every cached query and every cached item. */all: true; /** Fetch priority used for refetches triggered by this invalidation. */
2469
2551
  type?: FetchType;
2470
- fields?: string[];
2471
- itemPayload?: undefined;
2552
+ /**
2553
+ * Partial-resource fields to invalidate on matching items.
2554
+ *
2555
+ * Omit to invalidate the full item data.
2556
+ */
2557
+ fields?: string[]; /** Not allowed when invalidating every query and item. */
2558
+ itemPayload?: undefined; /** Not allowed when invalidating every query and item. */
2472
2559
  queryPayload?: undefined;
2473
2560
  } | {
2474
- all?: undefined;
2561
+ /** Leave unset when invalidating selected queries or items. */all?: undefined;
2562
+ /**
2563
+ * Items to invalidate.
2564
+ *
2565
+ * Pass one payload, many payloads, a predicate over cached items, or
2566
+ * `false` to skip item invalidation.
2567
+ */
2475
2568
  itemPayload: ItemPayload | ItemPayload[] | ListQueryFilterItem<ItemState, ItemPayload> | false;
2476
- queryPayload: QueryPayload | QueryPayload[] | ListQueryFilterQuery<QueryPayload> | false;
2569
+ /**
2570
+ * Queries to invalidate.
2571
+ *
2572
+ * Pass one payload, many payloads, a predicate over cached queries, or
2573
+ * `false` to skip query invalidation.
2574
+ */
2575
+ queryPayload: QueryPayload | QueryPayload[] | ListQueryFilterQuery<QueryPayload> | false; /** Fetch priority used for refetches triggered by this invalidation. */
2477
2576
  type?: FetchType;
2577
+ /**
2578
+ * Partial-resource fields to invalidate on matching items.
2579
+ *
2580
+ * Omit to invalidate the full item data.
2581
+ */
2478
2582
  fields?: string[];
2479
2583
  };
2480
2584
  type ListQueryStore<ItemState extends ValidStoreState, QueryPayload extends ValidPayload, ItemPayload extends ValidPayload, TPartialResources extends boolean = false, TOfflineOperations extends ListQueryOfflineOperationsConfig<ItemState, QueryPayload, ItemPayload> = null> = {
@@ -2531,7 +2635,7 @@ type ListQueryStore<ItemState extends ValidStoreState, QueryPayload extends Vali
2531
2635
  useMultipleItems: ListQueryUseMultipleItemsApi<ItemState, ItemPayload, TPartialResources>;
2532
2636
  useItem: ListQueryUseItemApi<ItemState, ItemPayload, TPartialResources>;
2533
2637
  useFindItem: <SelectedItem = ItemState | null>(findItemFn: (item: ItemState, itemPayload: ItemPayload) => boolean, options?: {
2534
- selector?: (data: ItemState, id: ItemPayload) => SelectedItem;
2638
+ /** Maps the matched item before it is returned from the hook. */selector?: (data: ItemState, id: ItemPayload) => SelectedItem;
2535
2639
  }) => SelectedItem | null;
2536
2640
  onTransportReconnect: () => void;
2537
2641
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdf",
3
- "version": "17.0.0-alpha.6",
3
+ "version": "17.0.0-alpha.7",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "MIT",
6
6
  "author": "Lucas Santos",