reactjrx 1.45.0 → 1.46.0

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.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +6 -3
  3. package/dist/index.js +6 -3
  4. package/dist/lib/binding/useObserve.test.d.ts +1 -0
  5. package/dist/lib/queries/client/cache/cache.garbage.test.d.ts +1 -0
  6. package/dist/lib/queries/client/cache/cacheClient.test.d.ts +1 -0
  7. package/dist/lib/queries/client/cache/logger.d.ts +2 -2
  8. package/dist/lib/queries/client/deduplication/deduplicate.test.d.ts +1 -0
  9. package/dist/lib/queries/client/invalidation/invalidation.test.d.ts +1 -0
  10. package/dist/lib/queries/client/invalidation/logger.d.ts +2 -2
  11. package/dist/lib/queries/client/keys/compareKeys.test.d.ts +1 -0
  12. package/dist/lib/queries/client/keys/keys.test.d.ts +1 -0
  13. package/dist/lib/queries/client/keys/serializeKey.test.d.ts +1 -0
  14. package/dist/lib/queries/client/keys/withKeyComparison.d.ts +16 -0
  15. package/dist/lib/queries/client/refetch/logger.d.ts +2 -2
  16. package/dist/lib/queries/client/refetch/refetch.test.d.ts +1 -0
  17. package/dist/lib/queries/react/useAsyncQuery.test.d.ts +1 -0
  18. package/dist/lib/queries/react/useQuery.deduplication.test.d.ts +1 -0
  19. package/dist/lib/queries/react/useQuery.invalidation.test.d.ts +1 -0
  20. package/dist/lib/queries/react/useQuery.keys.test.d.ts +1 -0
  21. package/dist/lib/queries/react/useQuery.test.d.ts +1 -0
  22. package/dist/lib/state/persistance/withPersistance.d.ts +2 -2
  23. package/dist/lib/state/signal.test.d.ts +1 -0
  24. package/dist/lib/utils/emitToSubject.d.ts +2 -0
  25. package/dist/lib/utils/shallowEqual.test.d.ts +1 -0
  26. package/dist/lib/utils/shareLatest.d.ts +10 -0
  27. package/dist/lib/utils/trackSubscriptions.d.ts +2 -0
  28. package/dist/lib/utils/useLiveRef.d.ts +1 -0
  29. package/dist/lib/utils/useLiveRef.test.d.ts +1 -0
  30. package/dist/lib/utils/useUnmountObservable.test.d.ts +1 -0
  31. package/dist/main.d.ts +1 -0
  32. package/dist/tests/testUtils.d.ts +1 -0
  33. package/dist/tests/utils.d.ts +1 -0
  34. package/package.json +10 -10
package/README.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  `reactjrx` is a javascript library which provides a simple and efficient API for handling global state, flow control, and queries in React applications using RxJS. With a small footprint and scalability to suit any project size, it is a great alternative to other popular libraries such as Recoil, Redux, React Query, Zustand, etc.
4
4
 
5
- Please visit the [documentation](https://bret-maxime.gitbook.io/reactjrx/) for more information on how to use.
5
+ Please visit the [documentation](https://bret-maxime.gitbook.io/reactjrx/) for more information on how to use.
package/dist/index.cjs CHANGED
@@ -428,13 +428,13 @@ function retryBackoff(config) {
428
428
  });
429
429
  }
430
430
  function shallowEqual(objA, objB) {
431
- if (objA === null || objA === void 0 || objB === null || objB === void 0) {
431
+ if (objA === null || objA === void 0 || objB === void 0) {
432
432
  return objA === objB;
433
433
  }
434
434
  if (typeof objA !== "object" || typeof objB !== "object") {
435
435
  return objA === objB;
436
436
  }
437
- if (objA.constructor !== objB.constructor) {
437
+ if (objA.constructor !== (objB == null ? void 0 : objB.constructor)) {
438
438
  return false;
439
439
  }
440
440
  const keysA = Object.keys(objA);
@@ -818,7 +818,10 @@ const resetStyle = { backgroundColor: "transparent", color: "inherit" };
818
818
  function createLogger(env) {
819
819
  const _logger = {
820
820
  namespaces: [
821
- { name: "@reactjrx", style: { backgroundColor: "#d02f4e", color: "white" } }
821
+ {
822
+ name: "@reactjrx",
823
+ style: { backgroundColor: "#d02f4e", color: "white" }
824
+ }
822
825
  ],
823
826
  namespace(name, style) {
824
827
  const logger2 = createLogger(env);
package/dist/index.js CHANGED
@@ -426,13 +426,13 @@ function retryBackoff(config) {
426
426
  });
427
427
  }
428
428
  function shallowEqual(objA, objB) {
429
- if (objA === null || objA === void 0 || objB === null || objB === void 0) {
429
+ if (objA === null || objA === void 0 || objB === void 0) {
430
430
  return objA === objB;
431
431
  }
432
432
  if (typeof objA !== "object" || typeof objB !== "object") {
433
433
  return objA === objB;
434
434
  }
435
- if (objA.constructor !== objB.constructor) {
435
+ if (objA.constructor !== (objB == null ? void 0 : objB.constructor)) {
436
436
  return false;
437
437
  }
438
438
  const keysA = Object.keys(objA);
@@ -816,7 +816,10 @@ const resetStyle = { backgroundColor: "transparent", color: "inherit" };
816
816
  function createLogger(env) {
817
817
  const _logger = {
818
818
  namespaces: [
819
- { name: "@reactjrx", style: { backgroundColor: "#d02f4e", color: "white" } }
819
+ {
820
+ name: "@reactjrx",
821
+ style: { backgroundColor: "#d02f4e", color: "white" }
822
+ }
820
823
  ],
821
824
  namespace(name, style) {
822
825
  const logger2 = createLogger(env);
@@ -0,0 +1 @@
1
+ export {};
@@ -14,8 +14,8 @@ export declare const logger: {
14
14
  namespaces: string;
15
15
  styles: string[];
16
16
  };
17
- print(method: "log" | "warn" | "error" | "group", ...message: any[]): any;
18
- printWithoutNamespace(method: "log" | "warn" | "error" | "group", ...message: any[]): any;
17
+ print(method: "error" | "log" | "warn" | "group", ...message: any[]): any;
18
+ printWithoutNamespace(method: "error" | "log" | "warn" | "group", ...message: any[]): any;
19
19
  log(...message: any): any;
20
20
  warn(...message: any): any;
21
21
  error(...message: any): any;
@@ -14,8 +14,8 @@ export declare const logger: {
14
14
  namespaces: string;
15
15
  styles: string[];
16
16
  };
17
- print(method: "log" | "warn" | "error" | "group", ...message: any[]): any;
18
- printWithoutNamespace(method: "log" | "warn" | "error" | "group", ...message: any[]): any;
17
+ print(method: "error" | "log" | "warn" | "group", ...message: any[]): any;
18
+ printWithoutNamespace(method: "error" | "log" | "warn" | "group", ...message: any[]): any;
19
19
  log(...message: any): any;
20
20
  warn(...message: any): any;
21
21
  error(...message: any): any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { Observable } from "rxjs";
2
+ export declare const withKeyComparison: <T extends {
3
+ key: any[];
4
+ }>(stream: Observable<T>) => Observable<(T & {
5
+ previousKey: undefined;
6
+ isUsingDifferentKey: boolean;
7
+ } extends infer T_1 ? T_1 extends T & {
8
+ previousKey: undefined;
9
+ isUsingDifferentKey: boolean;
10
+ } ? T_1 extends null | undefined ? never : T_1 : never : never) | (T & {
11
+ previousKey: any[];
12
+ isUsingDifferentKey: boolean;
13
+ } extends infer T_2 ? T_2 extends T & {
14
+ previousKey: any[];
15
+ isUsingDifferentKey: boolean;
16
+ } ? T_2 extends null | undefined ? never : T_2 : never : never)>;
@@ -14,8 +14,8 @@ export declare const logger: {
14
14
  namespaces: string;
15
15
  styles: string[];
16
16
  };
17
- print(method: "log" | "warn" | "error" | "group", ...message: any[]): any;
18
- printWithoutNamespace(method: "log" | "warn" | "error" | "group", ...message: any[]): any;
17
+ print(method: "error" | "log" | "warn" | "group", ...message: any[]): any;
18
+ printWithoutNamespace(method: "error" | "log" | "warn" | "group", ...message: any[]): any;
19
19
  log(...message: any): any;
20
20
  warn(...message: any): any;
21
21
  error(...message: any): any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -7,8 +7,8 @@ export interface WithPersistanceReturn<T> {
7
7
  persistValue: (params: {
8
8
  adapter: Adapter;
9
9
  }) => Promise<void>;
10
- setValue: Signal<T, T>['setState'];
11
- $: Signal<T, T>['subject'];
10
+ setValue: Signal<T, T>["setState"];
11
+ $: Signal<T, T>["subject"];
12
12
  options: {
13
13
  key?: string;
14
14
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type MonoTypeOperatorFunction, type Subject } from "rxjs";
2
+ export declare function emitToSubject<T>(subject: Subject<T>): MonoTypeOperatorFunction<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type MonoTypeOperatorFunction } from "rxjs";
2
+ /**
3
+ * Share the latest value to every new observers but clean up
4
+ * otherwise.
5
+ *
6
+ * We cannot use shareReplay with react since it would never clean
7
+ * selectors and create memory leak. shareLatest ensure when the selector
8
+ * is not mounted anywhere we reset it
9
+ */
10
+ export declare const shareLatest: <T>() => MonoTypeOperatorFunction<T>;
@@ -0,0 +1,2 @@
1
+ import { type Observable } from "rxjs";
2
+ export declare function trackSubscriptions(onCountUpdate: (activeSubscriptions: number) => void): <T>(source$: Observable<T>) => Observable<T>;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const useLiveRef: <T>(value: T) => import("react").MutableRefObject<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const printQuery: (data: any) => string;
@@ -0,0 +1 @@
1
+ export declare const waitForTimeout: (timeout: number) => Promise<unknown>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjrx",
3
3
  "private": false,
4
- "version": "1.45.0",
4
+ "version": "1.46.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -39,25 +39,25 @@
39
39
  "devDependencies": {
40
40
  "@types/react": "^18.0.28",
41
41
  "@types/react-dom": "^18.0.11",
42
- "@typescript-eslint/eslint-plugin": "^5.59.0",
42
+ "@typescript-eslint/eslint-plugin": "^6.11.0",
43
43
  "@vitejs/plugin-react": "^4.0.0",
44
44
  "eslint": "^8.47.0",
45
- "eslint-config-prettier": "^8.8.0",
46
- "eslint-config-standard-with-typescript": "^34.0.1",
45
+ "eslint-config-prettier": "^9.0.0",
46
+ "eslint-config-standard-with-typescript": "^39.1.1",
47
47
  "eslint-plugin-import": "^2.27.5",
48
- "eslint-plugin-n": "^15.7.0",
48
+ "eslint-plugin-n": "^16.3.1",
49
49
  "eslint-plugin-promise": "^6.1.1",
50
50
  "eslint-plugin-react": "^7.32.2",
51
51
  "global-jsdom": "^9.0.1",
52
52
  "jsdom": "^22.0.0",
53
- "prettier": "^2.8.7",
54
- "rollup-plugin-node-externals": "^5.1.2",
53
+ "prettier": "^3.1.0",
54
+ "rollup-plugin-node-externals": "^6.1.2",
55
55
  "rxjs": "^7.8.0",
56
- "semantic-release": "^21.0.1",
56
+ "semantic-release": "^22.0.7",
57
57
  "typescript": "^5.0.4",
58
58
  "vite": "^4.2.1",
59
- "vite-plugin-dts": "^2.2.0",
60
- "vitest": "^0.31.0",
59
+ "vite-plugin-dts": "^3.6.3",
60
+ "vitest": "^0.34.6",
61
61
  "@testing-library/react": "^14.0.0",
62
62
  "@types/node": "^18.15.11"
63
63
  },