react-redux-cache 0.22.1 → 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.
@@ -1,4 +1,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
+ 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,29 +1,62 @@
1
- import type { CacheOptions, EntitiesMap, EntityChanges, Key, Mutable, QueryState, QueryStateComparer, Typenames } from './types';
2
- export declare const PACKAGE_SHORT_NAME = "rrc";
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
+
3
14
  export declare const optionalUtils: {
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[];
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
+
11
28
  /** Empty function. */
12
- export declare const noop: () => void;
29
+ export declare const noop: () => void
30
+
13
31
  /** Default getCacheKey implementation. */
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;
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
+
16
40
  /** Returns true if object has no keys. */
17
- export declare const isEmptyObject: (obj: object) => boolean;
41
+ export declare const isEmptyObject: (obj: object) => boolean
42
+
18
43
  /** Returns query state comparer that compares only provided fields. Used in implementation of `selectorComparer` option. */
19
- export declare const createStateComparer: <T extends Typenames = Typenames, Q = unknown, P = unknown>(fields: (keyof QueryState<T, Q, P>)[]) => QueryStateComparer<T, Q, P>;
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
+
20
48
  export declare const FetchPolicy: {
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;
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
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.1",
5
+ "version": "0.22.2",
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 generate-docs",
26
+ "build": "yarn clean && yarn lint && yarn build-cjs && yarn build-esm && yarn build-types && yarn lint-fix-dist && yarn size && yarn generate-docs && yarn benchmark",
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",
@@ -32,7 +32,7 @@
32
32
  "remove-rc": "npm version <same-version-without-rc>",
33
33
  "prepublishOnly": "yarn build && yarn test",
34
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
+ "benchmark": "NODE_ENV=production node --expose-gc benchmark.mjs"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "fast-deep-equal": "*",
@@ -55,7 +55,7 @@
55
55
  "@types/redux-logger": "3.0.9",
56
56
  "@typescript-eslint/eslint-plugin": "8.51.0",
57
57
  "@typescript-eslint/parser": "8.51.0",
58
- "eslint": "8.57.1",
58
+ "eslint": "9.39.2",
59
59
  "eslint-config-prettier": "10.1.8",
60
60
  "eslint-plugin-import": "2.32.0",
61
61
  "eslint-plugin-prettier": "5.5.4",
@@ -73,7 +73,6 @@
73
73
  "redux": "4.2.1",
74
74
  "redux-logger": "3.0.6",
75
75
  "ts-jest": "29.1.0",
76
- "ts-node": "10.9.2",
77
76
  "typescript": "5.6.3"
78
77
  },
79
78
  "files": [