react-redux-cache 0.22.0 → 0.22.2

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.
@@ -7,18 +7,18 @@ export type Actions<
7
7
  QP = unknown,
8
8
  QR = unknown,
9
9
  MP = unknown,
10
- MR = unknown
10
+ MR = unknown,
11
11
  > = ReturnType<typeof createActions<N, T, QP, QR, MP, MR>>
12
12
 
13
13
  export declare const createActions: <N extends string, T extends Typenames, QP, QR, MP, MR>(
14
- name: N
14
+ name: N,
15
15
  ) => {
16
16
  updateQueryStateAndEntities: {
17
17
  <K extends keyof (QP | QR)>(
18
18
  queryKey: K,
19
19
  queryCacheKey: Key,
20
20
  state?: Partial<QueryState<T, QP[K], QR[K]>>,
21
- entityChanges?: EntityChanges<T>
21
+ entityChanges?: EntityChanges<T>,
22
22
  ): {
23
23
  type: `@rrc/${N}/updateQueryStateAndEntities`
24
24
  queryKey: K
@@ -32,7 +32,7 @@ export declare const createActions: <N extends string, T extends Typenames, QP,
32
32
  <K extends keyof (MP | MR)>(
33
33
  mutationKey: K,
34
34
  state?: Partial<MutationState<T, MP[K], MR[K]>>,
35
- entityChanges?: EntityChanges<T>
35
+ entityChanges?: EntityChanges<T>,
36
36
  ): {
37
37
  type: `@rrc/${N}/updateMutationStateAndEntities`
38
38
  mutationKey: K
@@ -57,7 +57,7 @@ export declare const createActions: <N extends string, T extends Typenames, QP,
57
57
  cacheKey?: Key
58
58
  /** Unix timestamp at which query expires. Is set to the query state. @Default Date.now() */
59
59
  expiresAt?: number
60
- }[]
60
+ }[],
61
61
  ): {
62
62
  type: `@rrc/${N}/invalidateQuery`
63
63
  queries: {
@@ -78,7 +78,7 @@ export declare const createActions: <N extends string, T extends Typenames, QP,
78
78
  query: K
79
79
  /** Query cache key */
80
80
  cacheKey?: Key
81
- }[]
81
+ }[],
82
82
  ): {
83
83
  type: `@rrc/${N}/clearQueryState`
84
84
  queries: {
@@ -91,7 +91,9 @@ export declare const createActions: <N extends string, T extends Typenames, QP,
91
91
  type: `@rrc/${N}/clearQueryState`
92
92
  }
93
93
  clearMutationState: {
94
- <K extends keyof (MP | MR)>(mutationKeys: K[]): {
94
+ <K extends keyof (MP | MR)>(
95
+ mutationKeys: K[],
96
+ ): {
95
97
  type: `@rrc/${N}/clearMutationState`
96
98
  mutationKeys: K[]
97
99
  }
@@ -38,7 +38,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
38
38
  'options' | 'queries' | 'mutations' | 'cacheStateSelector' | 'storeHooks'
39
39
  > & {
40
40
  globals?: OptionalPartial<Cache<N, T, QP, QR, MP, MR>['globals'], 'queries'>
41
- }
41
+ },
42
42
  ) => {
43
43
  /** Keeps all options, passed while creating the cache. */
44
44
  cache: Cache<N, T, QP, QR, MP, MR>
@@ -85,7 +85,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
85
85
  | {
86
86
  type: `@rrc/${N}/clearCache`
87
87
  stateToKeep: Partial<CacheState<T, QP, QR, MP, MR>> | undefined
88
- }
88
+ },
89
89
  ) => CacheState<T, QP, QR, MP, MR>
90
90
  actions: {
91
91
  /** Updates query state, and optionally merges entity changes in a single action. */
@@ -94,7 +94,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
94
94
  queryKey: K,
95
95
  queryCacheKey: Key,
96
96
  state?: Partial<QueryState<T, QP[K], QR[K]>> | undefined,
97
- entityChanges?: EntityChanges<T> | undefined
97
+ entityChanges?: EntityChanges<T> | undefined,
98
98
  ): {
99
99
  type: `@rrc/${N}/updateQueryStateAndEntities`
100
100
  queryKey: K
@@ -109,7 +109,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
109
109
  <K extends keyof MP & keyof MR>(
110
110
  mutationKey: K,
111
111
  state?: Partial<MutationState<T, MP[K], MR[K]>> | undefined,
112
- entityChanges?: EntityChanges<T> | undefined
112
+ entityChanges?: EntityChanges<T> | undefined,
113
113
  ): {
114
114
  type: `@rrc/${N}/updateMutationStateAndEntities`
115
115
  mutationKey: K
@@ -133,7 +133,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
133
133
  query: K
134
134
  cacheKey?: Key
135
135
  expiresAt?: number
136
- }[]
136
+ }[],
137
137
  ): {
138
138
  type: `@rrc/${N}/invalidateQuery`
139
139
  queries: {
@@ -151,7 +151,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
151
151
  queries: {
152
152
  query: K
153
153
  cacheKey?: Key
154
- }[]
154
+ }[],
155
155
  ): {
156
156
  type: `@rrc/${N}/clearQueryState`
157
157
  queries: {
@@ -163,7 +163,9 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
163
163
  }
164
164
  /** Clears states for provided mutation keys. */
165
165
  clearMutationState: {
166
- <K extends keyof MP & keyof MR>(mutationKeys: K[]): {
166
+ <K extends keyof MP & keyof MR>(
167
+ mutationKeys: K[],
168
+ ): {
167
169
  type: `@rrc/${N}/clearMutationState`
168
170
  mutationKeys: K[]
169
171
  }
@@ -185,7 +187,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
185
187
  selectQueryState: <QK extends keyof QP | keyof QR>(
186
188
  state: unknown,
187
189
  query: QK,
188
- cacheKey: Key
190
+ cacheKey: Key,
189
191
  ) => QueryState<
190
192
  T,
191
193
  QK extends keyof QP & keyof QR ? QP[QK] : never,
@@ -195,36 +197,36 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
195
197
  selectQueryResult: <QK extends keyof QP | keyof QR>(
196
198
  state: unknown,
197
199
  query: QK,
198
- cacheKey: Key
200
+ cacheKey: Key,
199
201
  ) => (QK extends keyof QP & keyof QR ? QR[QK] : never) | undefined
200
202
  /** Selects query loading state. */
201
203
  selectQueryLoading: <QK extends keyof QP | keyof QR>(
202
204
  state: unknown,
203
205
  query: QK,
204
- cacheKey: Key
206
+ cacheKey: Key,
205
207
  ) => false | Promise<NormalizedQueryResponse<T, QK extends keyof QP & keyof QR ? QR[QK] : never>>
206
208
  /** Selects query latest error. */
207
209
  selectQueryError: <QK extends keyof QP | keyof QR>(
208
210
  state: unknown,
209
211
  query: QK,
210
- cacheKey: Key
212
+ cacheKey: Key,
211
213
  ) => Error | undefined
212
214
  /** Selects query latest params. */
213
215
  selectQueryParams: <QK extends keyof QP | keyof QR>(
214
216
  state: unknown,
215
217
  query: QK,
216
- cacheKey: Key
218
+ cacheKey: Key,
217
219
  ) => (QK extends keyof QP & keyof QR ? QP[QK] : never) | undefined
218
220
  /** Selects query latest expiresAt. */
219
221
  selectQueryExpiresAt: <QK extends keyof QP | keyof QR>(
220
222
  state: unknown,
221
223
  query: QK,
222
- cacheKey: Key
224
+ cacheKey: Key,
223
225
  ) => number | undefined
224
226
  /** Selects mutation state. */
225
227
  selectMutationState: <MK extends keyof MP | keyof MR>(
226
228
  state: unknown,
227
- mutation: MK
229
+ mutation: MK,
228
230
  ) => MutationState<
229
231
  T,
230
232
  MK extends keyof MP & keyof MR ? MP[MK] : never,
@@ -233,32 +235,32 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
233
235
  /** Selects mutation latest result. */
234
236
  selectMutationResult: <MK extends keyof MP | keyof MR>(
235
237
  state: unknown,
236
- mutation: MK
238
+ mutation: MK,
237
239
  ) => (MK extends keyof MP & keyof MR ? MR[MK] : never) | undefined
238
240
  /** Selects mutation loading state. */
239
241
  selectMutationLoading: <MK extends keyof MP | keyof MR>(
240
242
  state: unknown,
241
- mutation: MK
243
+ mutation: MK,
242
244
  ) => false | Promise<NormalizedQueryResponse<T, MK extends keyof MP & keyof MR ? MR[MK] : never>>
243
245
  /** Selects mutation latest error. */
244
246
  selectMutationError: <MK extends keyof MP | keyof MR>(state: unknown, mutation: MK) => Error | undefined
245
247
  /** Selects mutation latest params. */
246
248
  selectMutationParams: <MK extends keyof MP | keyof MR>(
247
249
  state: unknown,
248
- mutation: MK
250
+ mutation: MK,
249
251
  ) => (MK extends keyof MP & keyof MR ? MP[MK] : never) | undefined
250
252
  /** Selects entity by id and typename. */
251
253
  selectEntityById: <TN extends keyof T>(
252
254
  state: unknown,
253
255
  id: Key | null | undefined,
254
- typename: TN
256
+ typename: TN,
255
257
  ) => T[TN] | undefined
256
258
  /** Selects all entities. */
257
259
  selectEntities: (state: unknown) => EntitiesMap<T> & import('./types').Mutable
258
260
  /** Selects all entities of provided typename. */
259
261
  selectEntitiesByTypename: <TN extends keyof T>(
260
262
  state: unknown,
261
- typename: TN
263
+ typename: TN,
262
264
  ) => (EntitiesMap<T> & import('./types').Mutable)[TN]
263
265
  }
264
266
  hooks: {
@@ -270,18 +272,18 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
270
272
  * @param skipFetch Fetch is cancelled and current cached result is returned.
271
273
  */
272
274
  query: <QK extends keyof (QP & QR)>(
273
- options: QueryOptions<N, T, QP, QR, QK, MP, MR>
275
+ options: QueryOptions<N, T, QP, QR, QK, MP, MR>,
274
276
  ) => Promise<QueryResult<QK extends keyof QP & keyof QR ? QR[QK] : never>>
275
277
  /**
276
278
  * Performs a mutation, aborting previous one with the same mutation key. Returns result only if finished succesfully.
277
279
  */
278
280
  mutate: <MK extends keyof (MP & MR)>(
279
- options: MutateOptions<N, T, QP, QR, MP, MR, MK>
281
+ options: MutateOptions<N, T, QP, QR, MP, MR, MK>,
280
282
  ) => Promise<MutationResult<MK extends keyof MP & keyof MR ? MR[MK] : never>>
281
283
  }
282
284
  /** Fetches query when params change and subscribes to query state changes (subscription depends on `selectorComparer`). */
283
285
  useQuery: <QK extends keyof (QP & QR)>(
284
- options: Parameters<typeof useQuery<N, T, QP, QR, MP, MR, QK>>[3]
286
+ options: Parameters<typeof useQuery<N, T, QP, QR, MP, MR, QK>>[3],
285
287
  ) => readonly [
286
288
  Omit<
287
289
  QueryState<
@@ -294,7 +296,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
294
296
  (
295
297
  options?:
296
298
  | Partial<Pick<QueryOptions<N, T, QP, QR, QK, MP, MR>, 'params' | 'onlyIfExpired'>>
297
- | undefined
299
+ | undefined,
298
300
  ) => Promise<
299
301
  QueryResult<
300
302
  QK extends infer T_1
@@ -305,14 +307,14 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
305
307
  : never
306
308
  : never
307
309
  >
308
- >
310
+ >,
309
311
  ]
310
312
  /** Subscribes to provided mutation state and provides mutate function. */
311
313
  useMutation: <MK extends keyof (MP & MR)>(
312
- options: Parameters<typeof useMutation<N, T, QP, QR, MP, MR, MK>>[3]
314
+ options: Parameters<typeof useMutation<N, T, QP, QR, MP, MR, MK>>[3],
313
315
  ) => readonly [
314
316
  (
315
- params: MK extends keyof MP & keyof MR ? MP[MK] : never
317
+ params: MK extends keyof MP & keyof MR ? MP[MK] : never,
316
318
  ) => Promise<
317
319
  MutationResult<
318
320
  MK extends infer T_1
@@ -329,7 +331,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
329
331
  MK extends keyof MP & keyof MR ? MP[MK] : never,
330
332
  MK extends keyof MP & keyof MR ? MP[MK] : never
331
333
  >,
332
- () => boolean
334
+ () => boolean,
333
335
  ]
334
336
  /** useSelector + selectEntityById. */
335
337
  useSelectEntityById: <TN extends keyof T>(id: Key | null | undefined, typename: TN) => T[TN] | undefined
@@ -338,7 +340,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
338
340
  * @warning Subscribing to collections should be avoided.
339
341
  * */
340
342
  useEntitiesByTypename: <TN extends keyof T>(
341
- typename: TN
343
+ typename: TN,
342
344
  ) => (EntitiesMap<T> & import('./types').Mutable)[TN]
343
345
  }
344
346
  utils: {
@@ -350,13 +352,13 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
350
352
  * @param skipFetch Fetch is cancelled and current cached result is returned.
351
353
  */
352
354
  query: <QK extends keyof (QP & QR)>(
353
- options: QueryOptions<N, T, QP, QR, QK, MP, MR>
355
+ options: QueryOptions<N, T, QP, QR, QK, MP, MR>,
354
356
  ) => Promise<QueryResult<QK extends keyof QP & keyof QR ? QR[QK] : never>>
355
357
  /**
356
358
  * Performs a mutation, aborting previous one with the same mutation key. Returns result only if finished succesfully.
357
359
  */
358
360
  mutate: <MK extends keyof (MP & MR)>(
359
- options: MutateOptions<N, T, QP, QR, MP, MR, MK>
361
+ options: MutateOptions<N, T, QP, QR, MP, MR, MK>,
360
362
  ) => Promise<MutationResult<MK extends keyof MP & keyof MR ? MR[MK] : never>>
361
363
  }
362
364
  /** Generates the initial state by calling a reducer. Not needed for redux — it already generates it the same way when creating the store. */
@@ -369,7 +371,7 @@ export declare const withTypenames: <T extends Typenames = Typenames>() => {
369
371
  */
370
372
  applyEntityChanges: (
371
373
  entities: Parameters<typeof applyEntityChanges<T>>[0],
372
- changes: Parameters<typeof applyEntityChanges<T>>[1]
374
+ changes: Parameters<typeof applyEntityChanges<T>>[1],
373
375
  ) => EntitiesMap<T> | undefined
374
376
  }
375
377
  }
@@ -400,7 +402,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
400
402
  'queries' | 'mutations' | 'options' | 'storeHooks' | 'cacheStateSelector'
401
403
  > & {
402
404
  globals?: OptionalPartial<Globals<N, Typenames, QP, QR, MP, MR>, 'queries'> | undefined
403
- }
405
+ },
404
406
  ) => {
405
407
  /** Keeps all options, passed while creating the cache. */
406
408
  cache: Cache<N, Typenames, QP, QR, MP, MR>
@@ -449,7 +451,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
449
451
  | {
450
452
  type: `@rrc/${N}/clearCache`
451
453
  stateToKeep: Partial<CacheState<Typenames, QP, QR, MP, MR>> | undefined
452
- }
454
+ },
453
455
  ) => CacheState<Typenames, QP, QR, MP, MR>
454
456
  actions: {
455
457
  /** Updates query state, and optionally merges entity changes in a single action. */
@@ -458,7 +460,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
458
460
  queryKey: K,
459
461
  queryCacheKey: Key,
460
462
  state?: Partial<QueryState<Typenames, QP[K], QR[K]>> | undefined,
461
- entityChanges?: EntityChanges<Typenames> | undefined
463
+ entityChanges?: EntityChanges<Typenames> | undefined,
462
464
  ): {
463
465
  type: `@rrc/${N}/updateQueryStateAndEntities`
464
466
  queryKey: K
@@ -473,7 +475,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
473
475
  <K extends keyof MP & keyof MR>(
474
476
  mutationKey: K,
475
477
  state?: Partial<MutationState<Typenames, MP[K], MR[K]>> | undefined,
476
- entityChanges?: EntityChanges<Typenames> | undefined
478
+ entityChanges?: EntityChanges<Typenames> | undefined,
477
479
  ): {
478
480
  type: `@rrc/${N}/updateMutationStateAndEntities`
479
481
  mutationKey: K
@@ -497,7 +499,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
497
499
  query: K
498
500
  cacheKey?: Key
499
501
  expiresAt?: number
500
- }[]
502
+ }[],
501
503
  ): {
502
504
  type: `@rrc/${N}/invalidateQuery`
503
505
  queries: {
@@ -515,7 +517,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
515
517
  queries: {
516
518
  query: K
517
519
  cacheKey?: Key
518
- }[]
520
+ }[],
519
521
  ): {
520
522
  type: `@rrc/${N}/clearQueryState`
521
523
  queries: {
@@ -527,7 +529,9 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
527
529
  }
528
530
  /** Clears states for provided mutation keys. */
529
531
  clearMutationState: {
530
- <K extends keyof MP & keyof MR>(mutationKeys: K[]): {
532
+ <K extends keyof MP & keyof MR>(
533
+ mutationKeys: K[],
534
+ ): {
531
535
  type: `@rrc/${N}/clearMutationState`
532
536
  mutationKeys: K[]
533
537
  }
@@ -549,7 +553,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
549
553
  selectQueryState: <QK_1 extends keyof QP | keyof QR>(
550
554
  state: unknown,
551
555
  query: QK_1,
552
- cacheKey: Key
556
+ cacheKey: Key,
553
557
  ) => QueryState<
554
558
  Typenames,
555
559
  QK_1 extends keyof QP & keyof QR ? QP[QK_1] : never,
@@ -559,13 +563,13 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
559
563
  selectQueryResult: <QK_1 extends keyof QP | keyof QR>(
560
564
  state: unknown,
561
565
  query: QK_1,
562
- cacheKey: Key
566
+ cacheKey: Key,
563
567
  ) => (QK_1 extends keyof QP & keyof QR ? QR[QK_1] : never) | undefined
564
568
  /** Selects query loading state. */
565
569
  selectQueryLoading: <QK_1 extends keyof QP | keyof QR>(
566
570
  state: unknown,
567
571
  query: QK_1,
568
- cacheKey: Key
572
+ cacheKey: Key,
569
573
  ) =>
570
574
  | false
571
575
  | Promise<NormalizedQueryResponse<Typenames, QK_1 extends keyof QP & keyof QR ? QR[QK_1] : never>>
@@ -573,24 +577,24 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
573
577
  selectQueryError: <QK_1 extends keyof QP | keyof QR>(
574
578
  state: unknown,
575
579
  query: QK_1,
576
- cacheKey: Key
580
+ cacheKey: Key,
577
581
  ) => Error | undefined
578
582
  /** Selects query latest params. */
579
583
  selectQueryParams: <QK_1 extends keyof QP | keyof QR>(
580
584
  state: unknown,
581
585
  query: QK_1,
582
- cacheKey: Key
586
+ cacheKey: Key,
583
587
  ) => (QK_1 extends keyof QP & keyof QR ? QP[QK_1] : never) | undefined
584
588
  /** Selects query latest expiresAt. */
585
589
  selectQueryExpiresAt: <QK_1 extends keyof QP | keyof QR>(
586
590
  state: unknown,
587
591
  query: QK_1,
588
- cacheKey: Key
592
+ cacheKey: Key,
589
593
  ) => number | undefined
590
594
  /** Selects mutation state. */
591
595
  selectMutationState: <MK_1 extends keyof MP | keyof MR>(
592
596
  state: unknown,
593
- mutation: MK_1
597
+ mutation: MK_1,
594
598
  ) => MutationState<
595
599
  Typenames,
596
600
  MK_1 extends keyof MP & keyof MR ? MP[MK_1] : never,
@@ -599,37 +603,37 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
599
603
  /** Selects mutation latest result. */
600
604
  selectMutationResult: <MK_1 extends keyof MP | keyof MR>(
601
605
  state: unknown,
602
- mutation: MK_1
606
+ mutation: MK_1,
603
607
  ) => (MK_1 extends keyof MP & keyof MR ? MR[MK_1] : never) | undefined
604
608
  /** Selects mutation loading state. */
605
609
  selectMutationLoading: <MK_1 extends keyof MP | keyof MR>(
606
610
  state: unknown,
607
- mutation: MK_1
611
+ mutation: MK_1,
608
612
  ) =>
609
613
  | false
610
614
  | Promise<NormalizedQueryResponse<Typenames, MK_1 extends keyof MP & keyof MR ? MR[MK_1] : never>>
611
615
  /** Selects mutation latest error. */
612
616
  selectMutationError: <MK_1 extends keyof MP | keyof MR>(
613
617
  state: unknown,
614
- mutation: MK_1
618
+ mutation: MK_1,
615
619
  ) => Error | undefined
616
620
  /** Selects mutation latest params. */
617
621
  selectMutationParams: <MK_1 extends keyof MP | keyof MR>(
618
622
  state: unknown,
619
- mutation: MK_1
623
+ mutation: MK_1,
620
624
  ) => (MK_1 extends keyof MP & keyof MR ? MP[MK_1] : never) | undefined
621
625
  /** Selects entity by id and typename. */
622
626
  selectEntityById: <TN extends string>(
623
627
  state: unknown,
624
628
  id: Key | null | undefined,
625
- typename: TN
629
+ typename: TN,
626
630
  ) => object | undefined
627
631
  /** Selects all entities. */
628
632
  selectEntities: (state: unknown) => EntitiesMap<Typenames> & import('./types').Mutable
629
633
  /** Selects all entities of provided typename. */
630
634
  selectEntitiesByTypename: <TN extends string>(
631
635
  state: unknown,
632
- typename: TN
636
+ typename: TN,
633
637
  ) => (EntitiesMap<Typenames> & import('./types').Mutable)[TN]
634
638
  }
635
639
  hooks: {
@@ -641,18 +645,18 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
641
645
  * @param skipFetch Fetch is cancelled and current cached result is returned.
642
646
  */
643
647
  query: <QK_1 extends keyof QP | keyof QR>(
644
- options: QueryOptions<N, Typenames, QP, QR, QK_1, MP, MR>
648
+ options: QueryOptions<N, Typenames, QP, QR, QK_1, MP, MR>,
645
649
  ) => Promise<QueryResult<QK_1 extends keyof QP & keyof QR ? QR[QK_1] : never>>
646
650
  /**
647
651
  * Performs a mutation, aborting previous one with the same mutation key. Returns result only if finished succesfully.
648
652
  */
649
653
  mutate: <MK_1 extends keyof MP | keyof MR>(
650
- options: MutateOptions<N, Typenames, QP, QR, MP, MR, MK_1>
654
+ options: MutateOptions<N, Typenames, QP, QR, MP, MR, MK_1>,
651
655
  ) => Promise<MutationResult<MK_1 extends keyof MP & keyof MR ? MR[MK_1] : never>>
652
656
  }
653
657
  /** Fetches query when params change and subscribes to query state changes (subscription depends on `selectorComparer`). */
654
658
  useQuery: <QK_1 extends keyof QP | keyof QR>(
655
- options: UseQueryOptions<N, Typenames, QK_1, QP, QR, MP, MR>
659
+ options: UseQueryOptions<N, Typenames, QK_1, QP, QR, MP, MR>,
656
660
  ) => readonly [
657
661
  Omit<
658
662
  QueryState<
@@ -665,7 +669,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
665
669
  (
666
670
  options?:
667
671
  | Partial<Pick<QueryOptions<N, Typenames, QP, QR, QK_1, MP, MR>, 'params' | 'onlyIfExpired'>>
668
- | undefined
672
+ | undefined,
669
673
  ) => Promise<
670
674
  QueryResult<
671
675
  QK_1 extends infer T
@@ -676,14 +680,14 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
676
680
  : never
677
681
  : never
678
682
  >
679
- >
683
+ >,
680
684
  ]
681
685
  /** Subscribes to provided mutation state and provides mutate function. */
682
686
  useMutation: <MK_1 extends keyof MP | keyof MR>(
683
- options: Omit<MutateOptions<N, Typenames, QP, QR, MP, MR, MK_1>, 'params'>
687
+ options: Omit<MutateOptions<N, Typenames, QP, QR, MP, MR, MK_1>, 'params'>,
684
688
  ) => readonly [
685
689
  (
686
- params: MK_1 extends keyof MP & keyof MR ? MP[MK_1] : never
690
+ params: MK_1 extends keyof MP & keyof MR ? MP[MK_1] : never,
687
691
  ) => Promise<
688
692
  MutationResult<
689
693
  MK_1 extends infer T
@@ -700,7 +704,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
700
704
  MK_1 extends keyof MP & keyof MR ? MP[MK_1] : never,
701
705
  MK_1 extends keyof MP & keyof MR ? MP[MK_1] : never
702
706
  >,
703
- () => boolean
707
+ () => boolean,
704
708
  ]
705
709
  /** useSelector + selectEntityById. */
706
710
  useSelectEntityById: <TN extends string>(id: Key | null | undefined, typename: TN) => object | undefined
@@ -709,7 +713,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
709
713
  * @warning Subscribing to collections should be avoided.
710
714
  * */
711
715
  useEntitiesByTypename: <TN extends string>(
712
- typename: TN
716
+ typename: TN,
713
717
  ) => (EntitiesMap<Typenames> & import('./types').Mutable)[TN]
714
718
  }
715
719
  utils: {
@@ -721,13 +725,13 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
721
725
  * @param skipFetch Fetch is cancelled and current cached result is returned.
722
726
  */
723
727
  query: <QK_1 extends keyof QP | keyof QR>(
724
- options: QueryOptions<N, Typenames, QP, QR, QK_1, MP, MR>
728
+ options: QueryOptions<N, Typenames, QP, QR, QK_1, MP, MR>,
725
729
  ) => Promise<QueryResult<QK_1 extends keyof QP & keyof QR ? QR[QK_1] : never>>
726
730
  /**
727
731
  * Performs a mutation, aborting previous one with the same mutation key. Returns result only if finished succesfully.
728
732
  */
729
733
  mutate: <MK_1 extends keyof MP | keyof MR>(
730
- options: MutateOptions<N, Typenames, QP, QR, MP, MR, MK_1>
734
+ options: MutateOptions<N, Typenames, QP, QR, MP, MR, MK_1>,
731
735
  ) => Promise<MutationResult<MK_1 extends keyof MP & keyof MR ? MR[MK_1] : never>>
732
736
  }
733
737
  /** Generates the initial state by calling a reducer. Not needed for redux — it already generates it the same way when creating the store. */
@@ -740,7 +744,7 @@ export declare const createCache: <N extends string, QP, QR, MP, MR>(
740
744
  */
741
745
  applyEntityChanges: (
742
746
  entities: EntitiesMap<Typenames> & import('./types').Mutable,
743
- changes: EntityChanges<Typenames>
747
+ changes: EntityChanges<Typenames>,
744
748
  ) => EntitiesMap<Typenames> | undefined
745
749
  }
746
750
  }
@@ -4,8 +4,8 @@ import type {CacheOptions, CacheState, Typenames} from './types'
4
4
  export declare const createReducer: <N extends string, T extends Typenames, QP, QR, MP, MR>(
5
5
  actions: Actions<N, T, QP, QR, MP, MR>,
6
6
  queryKeys: (keyof (QP | QR))[],
7
- cacheOptions: CacheOptions
7
+ cacheOptions: CacheOptions,
8
8
  ) => (
9
9
  state: CacheState<T, QP, QR, MP, MR> | undefined,
10
- action: ReturnType<(typeof actions)[keyof typeof actions]>
10
+ action: ReturnType<(typeof actions)[keyof typeof actions]>,
11
11
  ) => CacheState<T, QP, QR, MP, MR>
@@ -6,52 +6,52 @@ export type Selectors<
6
6
  QP = unknown,
7
7
  QR = unknown,
8
8
  MP = unknown,
9
- MR = unknown
9
+ MR = unknown,
10
10
  > = ReturnType<typeof createSelectors<N, T, QP, QR, MP, MR>>
11
11
 
12
12
  export declare const createSelectors: <N extends string, T extends Typenames, QP, QR, MP, MR>(
13
- cache: Cache<N, T, QP, QR, MP, MR>
13
+ cache: Cache<N, T, QP, QR, MP, MR>,
14
14
  ) => {
15
15
  selectEntityById: <TN extends keyof T>(
16
16
  state: unknown,
17
17
  id: Key | null | undefined,
18
- typename: TN
18
+ typename: TN,
19
19
  ) => T[TN] | undefined
20
20
  selectQueryState: <QK extends keyof (QP & QR)>(
21
21
  state: unknown,
22
22
  query: QK,
23
- cacheKey: Key
23
+ cacheKey: Key,
24
24
  ) => QueryState<T, QK extends keyof (QP | QR) ? QP[QK] : never, QK extends keyof (QP | QR) ? QR[QK] : never>
25
25
  selectQueryResult: <QK extends keyof (QP & QR)>(
26
26
  state: unknown,
27
27
  query: QK,
28
- cacheKey: Key
28
+ cacheKey: Key,
29
29
  ) => (QK extends keyof QP & keyof QR ? QR[QK] : never) | undefined
30
30
  selectQueryLoading: <QK extends keyof (QP & QR)>(
31
31
  state: unknown,
32
32
  query: QK,
33
- cacheKey: Key
33
+ cacheKey: Key,
34
34
  ) =>
35
35
  | false
36
36
  | Promise<import('./types').NormalizedQueryResponse<T, QK extends keyof QP & keyof QR ? QR[QK] : never>>
37
37
  selectQueryError: <QK extends keyof (QP & QR)>(
38
38
  state: unknown,
39
39
  query: QK,
40
- cacheKey: Key
40
+ cacheKey: Key,
41
41
  ) => Error | undefined
42
42
  selectQueryParams: <QK extends keyof (QP & QR)>(
43
43
  state: unknown,
44
44
  query: QK,
45
- cacheKey: Key
45
+ cacheKey: Key,
46
46
  ) => (QK extends keyof QP & keyof QR ? QP[QK] : never) | undefined
47
47
  selectQueryExpiresAt: <QK extends keyof (QP & QR)>(
48
48
  state: unknown,
49
49
  query: QK,
50
- cacheKey: Key
50
+ cacheKey: Key,
51
51
  ) => number | undefined
52
52
  selectMutationState: <MK extends keyof (MP & MR)>(
53
53
  state: unknown,
54
- mutation: MK
54
+ mutation: MK,
55
55
  ) => MutationState<
56
56
  T,
57
57
  MK extends keyof (MP | MR) ? MP[MK] : never,
@@ -59,22 +59,22 @@ export declare const createSelectors: <N extends string, T extends Typenames, QP
59
59
  >
60
60
  selectMutationResult: <MK extends keyof (MP & MR)>(
61
61
  state: unknown,
62
- mutation: MK
62
+ mutation: MK,
63
63
  ) => (MK extends keyof MP & keyof MR ? MR[MK] : never) | undefined
64
64
  selectMutationLoading: <MK extends keyof (MP & MR)>(
65
65
  state: unknown,
66
- mutation: MK
66
+ mutation: MK,
67
67
  ) =>
68
68
  | false
69
69
  | Promise<import('./types').NormalizedQueryResponse<T, MK extends keyof MP & keyof MR ? MR[MK] : never>>
70
70
  selectMutationError: <MK extends keyof (MP & MR)>(state: unknown, mutation: MK) => Error | undefined
71
71
  selectMutationParams: <MK extends keyof (MP & MR)>(
72
72
  state: unknown,
73
- mutation: MK
73
+ mutation: MK,
74
74
  ) => (MK extends keyof MP & keyof MR ? MP[MK] : never) | undefined
75
75
  selectEntities: (state: unknown) => import('./types').EntitiesMap<T> & import('./types').Mutable
76
76
  selectEntitiesByTypename: <TN extends keyof T>(
77
77
  state: unknown,
78
- typename: TN
78
+ typename: TN,
79
79
  ) => (import('./types').EntitiesMap<T> & import('./types').Mutable)[TN]
80
80
  }
@@ -1,5 +1,3 @@
1
1
  export {createCache, withTypenames} from './createCache'
2
-
3
2
  export * from './types'
4
-
5
3
  export {createStateComparer, defaultGetCacheKey, FetchPolicy, isEmptyObject, noop} from './utilsAndConstants'