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,40 +1,4 @@
1
- import {Actions} from './createActions'
2
- import {Selectors} from './createSelectors'
3
- import {Cache, QueryOptions, QueryState, Typenames, UseQueryOptions} from './types'
4
-
5
- export declare const useQuery: <
6
- N extends string,
7
- T extends Typenames,
8
- QP,
9
- QR,
10
- MP,
11
- MR,
12
- QK extends keyof (QP & QR)
13
- >(
14
- cache: Pick<Cache<N, T, QP, QR, MP, MR>, 'options' | 'globals' | 'queries' | 'storeHooks'>,
15
- actions: Actions<N, T, QP, QR, MP, MR>,
16
- selectors: Selectors<N, T, QP, QR, MP, MR>,
17
- options: UseQueryOptions<N, T, QK, QP, QR, MP, MR>
18
- ) => readonly [
19
- Omit<
20
- QueryState<
21
- T,
22
- QK extends keyof QP & keyof QR ? QP[QK] : never,
23
- QK extends keyof QP & keyof QR ? QR[QK] : never
24
- >,
25
- 'expiresAt'
26
- >,
27
- (
28
- options?: Partial<Pick<QueryOptions<N, T, QP, QR, QK, MP, MR>, 'params' | 'onlyIfExpired'>>
29
- ) => Promise<
30
- import('./types').QueryResult<
31
- QK extends infer T_1
32
- ? T_1 extends QK
33
- ? T_1 extends keyof QP & keyof QR
34
- ? QR[T_1]
35
- : never
36
- : never
37
- : never
38
- >
39
- >
40
- ]
1
+ import { Actions } from './createActions';
2
+ import { Selectors } from './createSelectors';
3
+ import { Cache, QueryOptions, QueryState, Typenames, UseQueryOptions } from './types';
4
+ export declare const useQuery: <N extends string, T extends Typenames, QP, QR, MP, MR, QK extends keyof (QP & QR)>(cache: Pick<Cache<N, T, QP, QR, MP, MR>, "options" | "globals" | "queries" | "storeHooks">, actions: Actions<N, T, QP, QR, MP, MR>, selectors: Selectors<N, T, QP, QR, MP, MR>, options: UseQueryOptions<N, T, QK, QP, QR, MP, MR>) => readonly [Omit<QueryState<T, QK extends keyof QP & keyof QR ? QP[QK] : never, QK extends keyof QP & keyof QR ? QR[QK] : never>, "expiresAt">, (options?: Partial<Pick<QueryOptions<N, T, QP, QR, QK, MP, MR>, "params" | "onlyIfExpired">>) => Promise<import("./types").QueryResult<QK extends infer T_1 ? T_1 extends QK ? T_1 extends keyof QP & keyof QR ? QR[T_1] : never : never : never>>];
@@ -1,62 +1,29 @@
1
- import type {
2
- CacheOptions,
3
- EntitiesMap,
4
- EntityChanges,
5
- Key,
6
- Mutable,
7
- QueryState,
8
- QueryStateComparer,
9
- Typenames,
10
- } from './types'
11
-
12
- export declare const PACKAGE_SHORT_NAME = 'rrc'
13
-
1
+ import type { CacheOptions, EntitiesMap, EntityChanges, Key, Mutable, QueryState, QueryStateComparer, Typenames } from './types';
2
+ export declare const PACKAGE_SHORT_NAME = "rrc";
14
3
  export declare const optionalUtils: {
15
- deepEqual?: (a: any, b: any) => boolean
16
- }
17
-
18
- export declare const logDebug: (tag: string, data?: unknown) => void
19
-
20
- export declare const logWarn: (tag: string, data?: unknown) => void
21
-
22
- export declare const IS_DEV: boolean
23
-
24
- export declare const EMPTY_OBJECT: Readonly<{}>
25
-
26
- export declare const EMPTY_ARRAY: readonly never[]
27
-
4
+ deepEqual?: (a: any, b: any) => boolean;
5
+ };
6
+ export declare const logDebug: (tag: string, data?: unknown) => void;
7
+ export declare const logWarn: (tag: string, data?: unknown) => void;
8
+ export declare const IS_DEV: boolean;
9
+ export declare const EMPTY_OBJECT: Readonly<{}>;
10
+ export declare const EMPTY_ARRAY: readonly never[];
28
11
  /** Empty function. */
29
- export declare const noop: () => void
30
-
12
+ export declare const noop: () => void;
31
13
  /** Default getCacheKey implementation. */
32
- export declare const defaultGetCacheKey: <P = unknown>(params: P) => Key
33
-
34
- export declare const applyEntityChanges: <T extends Typenames>(
35
- entities: EntitiesMap<T> & Mutable,
36
- changes: EntityChanges<T>,
37
- options: CacheOptions
38
- ) => EntitiesMap<T> | undefined
39
-
14
+ export declare const defaultGetCacheKey: <P = unknown>(params: P) => Key;
15
+ export declare const applyEntityChanges: <T extends Typenames>(entities: EntitiesMap<T> & Mutable, changes: EntityChanges<T>, options: CacheOptions) => EntitiesMap<T> | undefined;
40
16
  /** Returns true if object has no keys. */
41
- export declare const isEmptyObject: (obj: object) => boolean
42
-
17
+ export declare const isEmptyObject: (obj: object) => boolean;
43
18
  /** Returns query state comparer that compares only provided fields. Used in implementation of `selectorComparer` option. */
44
- export declare const createStateComparer: <T extends Typenames = Typenames, Q = unknown, P = unknown>(
45
- fields: (keyof QueryState<T, Q, P>)[]
46
- ) => QueryStateComparer<T, Q, P>
47
-
19
+ export declare const createStateComparer: <T extends Typenames = Typenames, Q = unknown, P = unknown>(fields: (keyof QueryState<T, Q, P>)[]) => QueryStateComparer<T, Q, P>;
48
20
  export declare const FetchPolicy: {
49
- /**
50
- * Only if cache does not exist (result is undefined) or expired. Default.
51
- * @param expired `true` when `expiresAt` is defined and lower than `Date.now()`
52
- */
53
- NoCacheOrExpired: <T extends Typenames = Typenames, P = unknown, R = unknown>(
54
- expired: boolean,
55
- _params: P,
56
- state: QueryState<T, P, R>
57
- ) => boolean
58
- /** Every fetch trigger. */
59
- Always: () => boolean
60
- }
61
-
62
- export declare const incrementChangeKey: (mutable: Mutable) => void
21
+ /**
22
+ * Only if cache does not exist (result is undefined) or expired. Default.
23
+ * @param expired `true` when `expiresAt` is defined and lower than `Date.now()`
24
+ */
25
+ NoCacheOrExpired: <T extends Typenames = Typenames, P = unknown, R = unknown>(expired: boolean, _params: P, state: QueryState<T, P, R>) => boolean;
26
+ /** Every fetch trigger. */
27
+ Always: () => boolean;
28
+ };
29
+ export declare const incrementChangeKey: (mutable: Mutable) => void;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-redux-cache",
3
3
  "author": "Alexander Danilov",
4
4
  "license": "MIT",
5
- "version": "0.22.0",
5
+ "version": "0.22.1",
6
6
  "description": "Powerful data fetching and caching library for Redux and Zustand that supports normalization.",
7
7
  "main": "./dist/cjs/index.js",
8
8
  "module": "./dist/esm/index.js",
@@ -23,7 +23,7 @@
23
23
  "build-cjs": "tsc -p tsconfig.cjs.json && rm -rf dist/cjs/testing && rm -rf dist/cjs/__tests__",
24
24
  "build-esm": "tsc -p tsconfig.esm.json > /dev/null ; rm -rf dist/esm/testing && rm -rf dist/esm/__tests__",
25
25
  "build-types": "tsc -p tsconfig.types.json > /dev/null ; rm -rf dist/types/testing && rm -rf dist/types/__tests__",
26
- "build": "yarn clean && yarn lint && yarn build-cjs && yarn build-esm && yarn build-types && yarn size && yarn lint-fix-dist && yarn generate-docs",
26
+ "build": "yarn clean && yarn lint && yarn build-cjs && yarn build-esm && yarn build-types && yarn size && yarn generate-docs",
27
27
  "size": "npx minified-size dist/esm/*.js | grep 'total:' | sed -E 's/.*total: [^,]*, ([^,]*), ([^,]*), ([^,]*).*/<br\\/>minified: \\1<br\\/>gzipped: \\2<br\\/>brotlied: \\3/'",
28
28
  "test": "node node_modules/jest/bin/jest.js",
29
29
  "preminor-rc": "yarn build && npm version preminor --preid rc",
@@ -53,19 +53,19 @@
53
53
  "@types/jest": "29.5.1",
54
54
  "@types/node": "20.1.2",
55
55
  "@types/redux-logger": "3.0.9",
56
- "@typescript-eslint/eslint-plugin": "5.59.5",
57
- "@typescript-eslint/parser": "5.59.5",
58
- "eslint": "8.40.0",
59
- "eslint-config-prettier": "8.8.0",
56
+ "@typescript-eslint/eslint-plugin": "8.51.0",
57
+ "@typescript-eslint/parser": "8.51.0",
58
+ "eslint": "8.57.1",
59
+ "eslint-config-prettier": "10.1.8",
60
60
  "eslint-plugin-import": "2.32.0",
61
- "eslint-plugin-prettier": "4.2.1",
62
- "eslint-plugin-react": "7.33.2",
63
- "eslint-plugin-react-hooks": "4.6.0",
64
- "eslint-plugin-simple-import-sort": "10.0.0",
61
+ "eslint-plugin-prettier": "5.5.4",
62
+ "eslint-plugin-react": "7.37.5",
63
+ "eslint-plugin-react-hooks": "7.0.1",
64
+ "eslint-plugin-simple-import-sort": "12.1.1",
65
65
  "jest": "29.5.0",
66
66
  "jest-environment-jsdom": "29.7.0",
67
67
  "minified-size": "4.0.0",
68
- "prettier": "2.8.8",
68
+ "prettier": "3.7.4",
69
69
  "react": "18.2.0",
70
70
  "react-dom": "18.2.0",
71
71
  "react-redux": "8.0.5",