react-redux-cache 0.22.0 → 0.22.1

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.
@@ -1,107 +1,83 @@
1
- import type {EntityChanges, Key, MutationState, QueryState, Typenames} from './types'
2
- import {CacheState} from './types'
3
-
4
- export type Actions<
5
- N extends string = string,
6
- T extends Typenames = Typenames,
7
- QP = unknown,
8
- QR = unknown,
9
- MP = unknown,
10
- MR = unknown
11
- > = ReturnType<typeof createActions<N, T, QP, QR, MP, MR>>
12
-
13
- export declare const createActions: <N extends string, T extends Typenames, QP, QR, MP, MR>(
14
- name: N
15
- ) => {
16
- updateQueryStateAndEntities: {
17
- <K extends keyof (QP | QR)>(
18
- queryKey: K,
19
- queryCacheKey: Key,
20
- state?: Partial<QueryState<T, QP[K], QR[K]>>,
21
- entityChanges?: EntityChanges<T>
22
- ): {
23
- type: `@rrc/${N}/updateQueryStateAndEntities`
24
- queryKey: K
25
- queryCacheKey: Key
26
- state: Partial<QueryState<T, QP[K], QR[K]>> | undefined
27
- entityChanges: EntityChanges<T> | undefined
28
- }
29
- type: `@rrc/${N}/updateQueryStateAndEntities`
30
- }
31
- updateMutationStateAndEntities: {
32
- <K extends keyof (MP | MR)>(
33
- mutationKey: K,
34
- state?: Partial<MutationState<T, MP[K], MR[K]>>,
35
- entityChanges?: EntityChanges<T>
36
- ): {
37
- type: `@rrc/${N}/updateMutationStateAndEntities`
38
- mutationKey: K
39
- state: Partial<MutationState<T, MP[K], MR[K]>> | undefined
40
- entityChanges: EntityChanges<T> | undefined
41
- }
42
- type: `@rrc/${N}/updateMutationStateAndEntities`
43
- }
44
- mergeEntityChanges: {
45
- (changes: EntityChanges<T>): {
46
- type: `@rrc/${N}/mergeEntityChanges`
47
- changes: EntityChanges<T>
48
- }
49
- type: `@rrc/${N}/mergeEntityChanges`
50
- }
51
- invalidateQuery: {
52
- <K extends keyof (QP | QR)>(
53
- queries: {
54
- /** Query key */
55
- query: K
56
- /** Query cache key */
57
- cacheKey?: Key
58
- /** Unix timestamp at which query expires. Is set to the query state. @Default Date.now() */
59
- expiresAt?: number
60
- }[]
61
- ): {
62
- type: `@rrc/${N}/invalidateQuery`
63
- queries: {
64
- /** Query key */
65
- query: K
66
- /** Query cache key */
67
- cacheKey?: Key
68
- /** Unix timestamp at which query expires. Is set to the query state. @Default Date.now() */
69
- expiresAt?: number
70
- }[]
71
- }
72
- type: `@rrc/${N}/invalidateQuery`
73
- }
74
- clearQueryState: {
75
- <K extends keyof (QP | QR)>(
76
- queries: {
77
- /** Query key */
78
- query: K
79
- /** Query cache key */
80
- cacheKey?: Key
81
- }[]
82
- ): {
83
- type: `@rrc/${N}/clearQueryState`
84
- queries: {
85
- /** Query key */
86
- query: K
87
- /** Query cache key */
88
- cacheKey?: Key
89
- }[]
90
- }
91
- type: `@rrc/${N}/clearQueryState`
92
- }
93
- clearMutationState: {
94
- <K extends keyof (MP | MR)>(mutationKeys: K[]): {
95
- type: `@rrc/${N}/clearMutationState`
96
- mutationKeys: K[]
97
- }
98
- type: `@rrc/${N}/clearMutationState`
99
- }
100
- clearCache: {
101
- (stateToKeep?: Partial<CacheState<T, QP, QR, MP, MR>>): {
102
- type: `@rrc/${N}/clearCache`
103
- stateToKeep: Partial<CacheState<T, QP, QR, MP, MR>> | undefined
104
- }
105
- type: `@rrc/${N}/clearCache`
106
- }
107
- }
1
+ import type { EntityChanges, Key, MutationState, QueryState, Typenames } from './types';
2
+ import { CacheState } from './types';
3
+ export type Actions<N extends string = string, T extends Typenames = Typenames, QP = unknown, QR = unknown, MP = unknown, MR = unknown> = ReturnType<typeof createActions<N, T, QP, QR, MP, MR>>;
4
+ export declare const createActions: <N extends string, T extends Typenames, QP, QR, MP, MR>(name: N) => {
5
+ updateQueryStateAndEntities: {
6
+ <K extends keyof (QP | QR)>(queryKey: K, queryCacheKey: Key, state?: Partial<QueryState<T, QP[K], QR[K]>>, entityChanges?: EntityChanges<T>): {
7
+ type: `@rrc/${N}/updateQueryStateAndEntities`;
8
+ queryKey: K;
9
+ queryCacheKey: Key;
10
+ state: Partial<QueryState<T, QP[K], QR[K]>> | undefined;
11
+ entityChanges: EntityChanges<T> | undefined;
12
+ };
13
+ type: `@rrc/${N}/updateQueryStateAndEntities`;
14
+ };
15
+ updateMutationStateAndEntities: {
16
+ <K extends keyof (MP | MR)>(mutationKey: K, state?: Partial<MutationState<T, MP[K], MR[K]>>, entityChanges?: EntityChanges<T>): {
17
+ type: `@rrc/${N}/updateMutationStateAndEntities`;
18
+ mutationKey: K;
19
+ state: Partial<MutationState<T, MP[K], MR[K]>> | undefined;
20
+ entityChanges: EntityChanges<T> | undefined;
21
+ };
22
+ type: `@rrc/${N}/updateMutationStateAndEntities`;
23
+ };
24
+ mergeEntityChanges: {
25
+ (changes: EntityChanges<T>): {
26
+ type: `@rrc/${N}/mergeEntityChanges`;
27
+ changes: EntityChanges<T>;
28
+ };
29
+ type: `@rrc/${N}/mergeEntityChanges`;
30
+ };
31
+ invalidateQuery: {
32
+ <K extends keyof (QP | QR)>(queries: {
33
+ /** Query key */
34
+ query: K;
35
+ /** Query cache key */
36
+ cacheKey?: Key;
37
+ /** Unix timestamp at which query expires. Is set to the query state. @Default Date.now() */
38
+ expiresAt?: number;
39
+ }[]): {
40
+ type: `@rrc/${N}/invalidateQuery`;
41
+ queries: {
42
+ /** Query key */
43
+ query: K;
44
+ /** Query cache key */
45
+ cacheKey?: Key;
46
+ /** Unix timestamp at which query expires. Is set to the query state. @Default Date.now() */
47
+ expiresAt?: number;
48
+ }[];
49
+ };
50
+ type: `@rrc/${N}/invalidateQuery`;
51
+ };
52
+ clearQueryState: {
53
+ <K extends keyof (QP | QR)>(queries: {
54
+ /** Query key */
55
+ query: K;
56
+ /** Query cache key */
57
+ cacheKey?: Key;
58
+ }[]): {
59
+ type: `@rrc/${N}/clearQueryState`;
60
+ queries: {
61
+ /** Query key */
62
+ query: K;
63
+ /** Query cache key */
64
+ cacheKey?: Key;
65
+ }[];
66
+ };
67
+ type: `@rrc/${N}/clearQueryState`;
68
+ };
69
+ clearMutationState: {
70
+ <K extends keyof (MP | MR)>(mutationKeys: K[]): {
71
+ type: `@rrc/${N}/clearMutationState`;
72
+ mutationKeys: K[];
73
+ };
74
+ type: `@rrc/${N}/clearMutationState`;
75
+ };
76
+ clearCache: {
77
+ (stateToKeep?: Partial<CacheState<T, QP, QR, MP, MR>>): {
78
+ type: `@rrc/${N}/clearCache`;
79
+ stateToKeep: Partial<CacheState<T, QP, QR, MP, MR>> | undefined;
80
+ };
81
+ type: `@rrc/${N}/clearCache`;
82
+ };
83
+ };