@openmrs/esm-react-utils 10.0.1-pre.5396 → 10.0.1-pre.5426

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,3 +1,3 @@
1
- [0] Successfully compiled: 55 files with swc (179.54ms)
1
+ [0] Successfully compiled: 55 files with swc (172.93ms)
2
2
  [0] swc --strip-leading-paths src -d dist exited with code 0
3
3
  [1] tsc --project tsconfig.build.json exited with code 0
@@ -23,7 +23,7 @@ export declare function useFhirPagination<T extends fhir.ResourceBase>(url: stri
23
23
  error: any;
24
24
  mutate: import("swr").KeyedMutator<FetchResponse<fhir.Bundle>>;
25
25
  isValidating: boolean;
26
- isLoading: boolean;
26
+ isLoading: import("swr/_internal").IsLoadingResponse<Data, Config>;
27
27
  data: T[] | undefined;
28
28
  totalPages: number;
29
29
  totalCount: number;
@@ -1,8 +1,7 @@
1
1
  /** @module @category UI */
2
2
  import { type FetchResponse } from '@openmrs/esm-api';
3
- import { type SWRInfiniteConfiguration, type SWRInfiniteResponse } from 'swr/infinite';
3
+ import { type SWRInfiniteConfiguration, type SWRInfiniteKeyedMutator } from 'swr/infinite';
4
4
  import { type ServerPaginationHandlers, type OpenMRSPaginatedResponse } from './useOpenmrsPagination';
5
- type InfiniteKeyedMutator<T> = SWRInfiniteResponse<T extends (infer I)[] ? I : T>['mutate'];
6
5
  export interface UseServerInfiniteOptions<R> {
7
6
  /**
8
7
  * The fetcher to use. Defaults to openmrsFetch
@@ -42,7 +41,7 @@ export interface UseServerInfiniteReturnObject<T, R> {
42
41
  /**
43
42
  * from useSWRInfinite
44
43
  */
45
- mutate: InfiniteKeyedMutator<FetchResponse<R>[]>;
44
+ mutate: SWRInfiniteKeyedMutator<FetchResponse<R>[]>;
46
45
  /**
47
46
  * from useSWRInfinite
48
47
  */
@@ -82,5 +81,4 @@ export interface UseServerInfiniteReturnObject<T, R> {
82
81
  */
83
82
  export declare function useOpenmrsInfinite<T>(url: string | URL, options?: UseServerInfiniteOptions<OpenMRSPaginatedResponse<T>>): UseServerInfiniteReturnObject<T, OpenMRSPaginatedResponse<T>>;
84
83
  export declare function useServerInfinite<T, R>(url: string | URL, serverPaginationHandlers: ServerPaginationHandlers<T, R>, options?: UseServerInfiniteOptions<R>): UseServerInfiniteReturnObject<T, R>;
85
- export {};
86
84
  //# sourceMappingURL=useOpenmrsInfinite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOpenmrsInfinite.d.ts","sourceRoot":"","sources":["../src/useOpenmrsInfinite.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAEpE,OAAuB,EAAE,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACvG,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAGhC,KAAK,oBAAoB,CAAC,CAAC,IAAI,mBAAmB,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE5F,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;CAC9C;AAED,MAAM,WAAW,6BAA6B,CAAC,CAAC,EAAE,CAAC;IACjD;;;;OAIG;IACH,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC;IAEtB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE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("swr").KeyedMutator<FetchResponse<OpenMRSPaginatedResponse<T>>>;
58
58
  isValidating: boolean;
59
- isLoading: boolean;
59
+ isLoading: import("swr/_internal").IsLoadingResponse<Data, Config>;
60
60
  data: T[] | undefined;
61
61
  totalPages: number;
62
62
  totalCount: number;
@@ -82,7 +82,7 @@ export declare function useServerPagination<T, R>(url: string | URL, pageSize: n
82
82
  error: any;
83
83
  mutate: import("swr").KeyedMutator<FetchResponse<R>>;
84
84
  isValidating: boolean;
85
- isLoading: boolean;
85
+ isLoading: import("swr/_internal").IsLoadingResponse<Data, Config>;
86
86
  data: T[] | undefined;
87
87
  totalPages: number;
88
88
  totalCount: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-react-utils",
3
- "version": "10.0.1-pre.5396",
3
+ "version": "10.0.1-pre.5426",
4
4
  "license": "MPL-2.0",
5
5
  "description": "React utilities for OpenMRS.",
6
6
  "type": "module",
@@ -60,17 +60,17 @@
60
60
  "single-spa-react": "^6.0.2"
61
61
  },
62
62
  "peerDependencies": {
63
- "@openmrs/esm-api": "^10.0.1-pre.5396",
64
- "@openmrs/esm-config": "^10.0.1-pre.5396",
65
- "@openmrs/esm-context": "^10.0.1-pre.5396",
66
- "@openmrs/esm-emr-api": "^10.0.1-pre.5396",
67
- "@openmrs/esm-error-handling": "^10.0.1-pre.5396",
68
- "@openmrs/esm-extensions": "^10.0.1-pre.5396",
69
- "@openmrs/esm-feature-flags": "^10.0.1-pre.5396",
70
- "@openmrs/esm-globals": "^10.0.1-pre.5396",
71
- "@openmrs/esm-navigation": "^10.0.1-pre.5396",
72
- "@openmrs/esm-state": "^10.0.1-pre.5396",
73
- "@openmrs/esm-utils": "^10.0.1-pre.5396",
63
+ "@openmrs/esm-api": "^10.0.1-pre.5426",
64
+ "@openmrs/esm-config": "^10.0.1-pre.5426",
65
+ "@openmrs/esm-context": "^10.0.1-pre.5426",
66
+ "@openmrs/esm-emr-api": "^10.0.1-pre.5426",
67
+ "@openmrs/esm-error-handling": "^10.0.1-pre.5426",
68
+ "@openmrs/esm-extensions": "^10.0.1-pre.5426",
69
+ "@openmrs/esm-feature-flags": "^10.0.1-pre.5426",
70
+ "@openmrs/esm-globals": "^10.0.1-pre.5426",
71
+ "@openmrs/esm-navigation": "^10.0.1-pre.5426",
72
+ "@openmrs/esm-state": "^10.0.1-pre.5426",
73
+ "@openmrs/esm-utils": "^10.0.1-pre.5426",
74
74
  "dayjs": "1.x",
75
75
  "i18next": "25.x",
76
76
  "react": "18.x",
@@ -80,17 +80,17 @@
80
80
  "swr": "2.x"
81
81
  },
82
82
  "devDependencies": {
83
- "@openmrs/esm-api": "10.0.1-pre.5396",
84
- "@openmrs/esm-config": "10.0.1-pre.5396",
85
- "@openmrs/esm-context": "10.0.1-pre.5396",
86
- "@openmrs/esm-emr-api": "10.0.1-pre.5396",
87
- "@openmrs/esm-error-handling": "10.0.1-pre.5396",
88
- "@openmrs/esm-extensions": "10.0.1-pre.5396",
89
- "@openmrs/esm-feature-flags": "10.0.1-pre.5396",
90
- "@openmrs/esm-globals": "10.0.1-pre.5396",
91
- "@openmrs/esm-navigation": "10.0.1-pre.5396",
92
- "@openmrs/esm-state": "10.0.1-pre.5396",
93
- "@openmrs/esm-utils": "10.0.1-pre.5396",
83
+ "@openmrs/esm-api": "10.0.1-pre.5426",
84
+ "@openmrs/esm-config": "10.0.1-pre.5426",
85
+ "@openmrs/esm-context": "10.0.1-pre.5426",
86
+ "@openmrs/esm-emr-api": "10.0.1-pre.5426",
87
+ "@openmrs/esm-error-handling": "10.0.1-pre.5426",
88
+ "@openmrs/esm-extensions": "10.0.1-pre.5426",
89
+ "@openmrs/esm-feature-flags": "10.0.1-pre.5426",
90
+ "@openmrs/esm-globals": "10.0.1-pre.5426",
91
+ "@openmrs/esm-navigation": "10.0.1-pre.5426",
92
+ "@openmrs/esm-state": "10.0.1-pre.5426",
93
+ "@openmrs/esm-utils": "10.0.1-pre.5426",
94
94
  "@swc/cli": "0.8.1",
95
95
  "@swc/core": "1.15.21",
96
96
  "@vitest/coverage-v8": "^4.1.2",
@@ -104,7 +104,7 @@
104
104
  "react-i18next": "^16.0.0",
105
105
  "rimraf": "^6.1.3",
106
106
  "rxjs": "^6.5.3",
107
- "swr": "2.2.5",
107
+ "swr": "2.5.1",
108
108
  "vitest": "^4.1.2"
109
109
  },
110
110
  "stableVersion": "10.0.0"
@@ -1,16 +1,13 @@
1
1
  /** @module @category UI */
2
2
  import { type FetchResponse, openmrsFetch } from '@openmrs/esm-api';
3
3
  import { useCallback } from 'react';
4
- import useSWRInfinite, { type SWRInfiniteConfiguration, type SWRInfiniteResponse } from 'swr/infinite';
4
+ import useSWRInfinite, { type SWRInfiniteConfiguration, type SWRInfiniteKeyedMutator } from 'swr/infinite';
5
5
  import {
6
6
  openmrsServerPaginationHandlers,
7
7
  type ServerPaginationHandlers,
8
8
  type OpenMRSPaginatedResponse,
9
9
  } from './useOpenmrsPagination';
10
10
 
11
- // "swr/infinite" doesn't export InfiniteKeyedMutator directly
12
- type InfiniteKeyedMutator<T> = SWRInfiniteResponse<T extends (infer I)[] ? I : T>['mutate'];
13
-
14
11
  export interface UseServerInfiniteOptions<R> {
15
12
  /**
16
13
  * The fetcher to use. Defaults to openmrsFetch
@@ -58,7 +55,7 @@ export interface UseServerInfiniteReturnObject<T, R> {
58
55
  /**
59
56
  * from useSWRInfinite
60
57
  */
61
- mutate: InfiniteKeyedMutator<FetchResponse<R>[]>;
58
+ mutate: SWRInfiniteKeyedMutator<FetchResponse<R>[]>;
62
59
 
63
60
  /**
64
61
  * from useSWRInfinite