react-redux-cache 0.21.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,59 +1,29 @@
1
- import type {
2
- CacheOptions,
3
- EntitiesMap,
4
- EntityChanges,
5
- Key,
6
- QueryState,
7
- QueryStateComparer,
8
- Typenames,
9
- } from './types'
10
-
11
- export declare const PACKAGE_SHORT_NAME = 'rrc'
12
-
1
+ import type { CacheOptions, EntitiesMap, EntityChanges, Key, Mutable, QueryState, QueryStateComparer, Typenames } from './types';
2
+ export declare const PACKAGE_SHORT_NAME = "rrc";
13
3
  export declare const optionalUtils: {
14
- deepEqual?: (a: any, b: any) => boolean
15
- }
16
-
17
- export declare const logDebug: (tag: string, data?: unknown) => void
18
-
19
- export declare const logWarn: (tag: string, data?: unknown) => void
20
-
21
- export declare const IS_DEV: boolean
22
-
23
- export declare const EMPTY_OBJECT: Readonly<{}>
24
-
25
- export declare const EMPTY_ARRAY: readonly never[]
26
-
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[];
27
11
  /** Empty function. */
28
- export declare const noop: () => void
29
-
12
+ export declare const noop: () => void;
30
13
  /** Default getCacheKey implementation. */
31
- export declare const defaultGetCacheKey: <P = unknown>(params: P) => Key
32
-
33
- export declare const applyEntityChanges: <T extends Typenames>(
34
- entities: EntitiesMap<T>,
35
- changes: EntityChanges<T>,
36
- options: CacheOptions
37
- ) => EntitiesMap<T> | undefined
38
-
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;
39
16
  /** Returns true if object has no keys. */
40
- export declare const isEmptyObject: (o: object) => boolean
41
-
17
+ export declare const isEmptyObject: (obj: object) => boolean;
42
18
  /** Returns query state comparer that compares only provided fields. Used in implementation of `selectorComparer` option. */
43
- export declare const createStateComparer: <T extends Typenames = Typenames, Q = unknown, P = unknown>(
44
- fields: (keyof QueryState<T, Q, P>)[]
45
- ) => QueryStateComparer<T, Q, P>
46
-
19
+ export declare const createStateComparer: <T extends Typenames = Typenames, Q = unknown, P = unknown>(fields: (keyof QueryState<T, Q, P>)[]) => QueryStateComparer<T, Q, P>;
47
20
  export declare const FetchPolicy: {
48
- /**
49
- * Only if cache does not exist (result is undefined) or expired. Default.
50
- * @param expired `true` when `expiresAt` is defined and lower than `Date.now()`
51
- */
52
- NoCacheOrExpired: <T extends Typenames = Typenames, P = unknown, R = unknown>(
53
- expired: boolean,
54
- _params: P,
55
- state: QueryState<T, P, R>
56
- ) => boolean
57
- /** Every fetch trigger. */
58
- Always: () => boolean
59
- }
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.21.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",
@@ -17,13 +17,13 @@
17
17
  "scripts": {
18
18
  "example": "(cd example && yarn --production && yarn dev)",
19
19
  "clean": "rm -rf dist",
20
- "lint": "yarn eslint",
21
- "lint-fix": "yarn eslint --fix",
20
+ "lint": "yarn eslint ./src",
21
+ "lint-fix": "yarn eslint --fix ./src",
22
22
  "lint-fix-dist": "yarn eslint --quiet --fix dist/ > /dev/null 2>&1 || true",
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",
@@ -31,7 +31,8 @@
31
31
  "publish-rc": "npm publish --tag rc",
32
32
  "remove-rc": "npm version <same-version-without-rc>",
33
33
  "prepublishOnly": "yarn build && yarn test",
34
- "generate-docs": "node --experimental-strip-types scripts/generate-docs.ts"
34
+ "generate-docs": "node --experimental-strip-types scripts/generate-docs.ts",
35
+ "benchmark": "NODE_ENV=production node -r ts-node/register --expose-gc benchmark.ts"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "fast-deep-equal": "*",
@@ -52,19 +53,19 @@
52
53
  "@types/jest": "29.5.1",
53
54
  "@types/node": "20.1.2",
54
55
  "@types/redux-logger": "3.0.9",
55
- "@typescript-eslint/eslint-plugin": "5.59.5",
56
- "@typescript-eslint/parser": "5.59.5",
57
- "eslint": "8.40.0",
58
- "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",
59
60
  "eslint-plugin-import": "2.32.0",
60
- "eslint-plugin-prettier": "4.2.1",
61
- "eslint-plugin-react": "7.33.2",
62
- "eslint-plugin-react-hooks": "4.6.0",
63
- "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",
64
65
  "jest": "29.5.0",
65
66
  "jest-environment-jsdom": "29.7.0",
66
67
  "minified-size": "4.0.0",
67
- "prettier": "2.8.8",
68
+ "prettier": "3.7.4",
68
69
  "react": "18.2.0",
69
70
  "react-dom": "18.2.0",
70
71
  "react-redux": "8.0.5",
@@ -72,6 +73,7 @@
72
73
  "redux": "4.2.1",
73
74
  "redux-logger": "3.0.6",
74
75
  "ts-jest": "29.1.0",
76
+ "ts-node": "10.9.2",
75
77
  "typescript": "5.6.3"
76
78
  },
77
79
  "files": [