@react-pakistan/util-functions 1.25.31 → 1.25.32
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/general/generic-cache.d.ts +13 -4
- package/package.json +1 -1
|
@@ -23,19 +23,29 @@
|
|
|
23
23
|
* - Single Item Cache Functions
|
|
24
24
|
* - Cache Utilities
|
|
25
25
|
*/
|
|
26
|
-
interface CacheConfig {
|
|
26
|
+
export interface CacheConfig {
|
|
27
27
|
cacheKey: string;
|
|
28
28
|
apiUrl: string;
|
|
29
29
|
expirationMs?: number;
|
|
30
30
|
responseKey?: string;
|
|
31
31
|
params?: Record<string, unknown>;
|
|
32
32
|
}
|
|
33
|
-
interface GetCachedDataOptions {
|
|
33
|
+
export interface GetCachedDataOptions {
|
|
34
34
|
config: CacheConfig;
|
|
35
35
|
params?: Record<string, unknown>;
|
|
36
36
|
headers?: Record<string, string>;
|
|
37
37
|
}
|
|
38
|
-
interface
|
|
38
|
+
export interface CachedData<T> {
|
|
39
|
+
items: Record<string, T>;
|
|
40
|
+
cachedAt: string;
|
|
41
|
+
count: number;
|
|
42
|
+
currentPage?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface CachedSingleData<T> {
|
|
45
|
+
item: T;
|
|
46
|
+
cachedAt: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ListResponse<T> {
|
|
39
49
|
count: number;
|
|
40
50
|
items: T[];
|
|
41
51
|
currentPage?: number;
|
|
@@ -158,4 +168,3 @@ export declare const preloadCache: <T>(config: CacheConfig) => Promise<ListRespo
|
|
|
158
168
|
* }
|
|
159
169
|
*/
|
|
160
170
|
export declare const isCacheStale: (cacheKey: string, expirationMs?: number) => boolean;
|
|
161
|
-
export {};
|