@webority/web-core 0.155.0 → 0.155.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 +1 @@
1
- import{extractApiError as e}from"../errors/extractApiError.js";import{useMemo as t}from"react";function n(n,i){let{currentData:a,error:o,isFetching:s,isUninitialized:c,refetch:l,fulfilledTimeStamp:u}=n,d=i?.keepPreviousData===!0?n.data:void 0,f=i?.isEmpty??r;return t(()=>{let t=()=>{l()},n=e=>f(e)?{status:`empty`,refreshing:s,refresh:t,refetch:t,fulfilledTimeStamp:u}:{status:`data`,data:e,refreshing:s,refresh:t,refetch:t,fulfilledTimeStamp:u};return a===void 0?o===void 0?c===!0?{status:`idle`}:d===void 0?{status:`loading`,refetch:t}:n(d):{status:`error`,error:e(o),retry:t,refetch:t}:n(a)},[a,d,o,s,c,l,f,u])}var r=e=>Array.isArray(e)?e.length===0:typeof e==`object`&&e&&`items`in e&&Array.isArray(e.items)?e.items.length===0:!1;function i(n){let{currentData:r,error:i,isFetching:a,isFetchingNextPage:o,hasNextPage:s,isError:c,isFetchNextPageError:l,isUninitialized:u,refetch:d,fetchNextPage:f,fulfilledTimeStamp:p}=n,m=t(()=>(r?.pages??[]).flatMap(e=>e.items),[r]),h=t(()=>{let t=()=>{d()};if(r===void 0)return i===void 0?u===!0?{status:`idle`}:{status:`loading`,refetch:t}:{status:`error`,error:e(i),retry:t,refetch:t};let n=a&&!o;return m.length===0?{status:`empty`,refreshing:n,refresh:t,refetch:t,fulfilledTimeStamp:p}:{status:`data`,data:m,refreshing:n,refresh:t,refetch:t,fulfilledTimeStamp:p}},[r,i,a,o,u,m,d,p]),g=c&&l;return{state:h,paging:t(()=>({hasMore:s,loadingMore:o,errorMore:g?e(i):null,loadMore:()=>{s&&!o&&!g&&f()},retryMore:()=>{g&&f()}}),[s,o,g,i,f])}}export{n as useDataState,i as useInfiniteDataState};
1
+ import{extractApiError as e}from"../errors/extractApiError.js";import{useMemo as t}from"react";function n(n,i){let{currentData:a,error:o,isFetching:s,isUninitialized:c,refetch:l,fulfilledTimeStamp:u}=n,d=i?.keepPreviousData===!0?n.data:void 0,f=i?.isEmpty??r;return t(()=>{let t=()=>{l()},n=e=>f(e)?{status:`empty`,refreshing:s,refresh:t,refetch:t,fulfilledTimeStamp:u}:{status:`data`,data:e,refreshing:s,refresh:t,refetch:t,fulfilledTimeStamp:u};return a===void 0?o===void 0?c===!0?{status:`idle`}:d===void 0?{status:`loading`,refetch:t}:n(d):{status:`error`,error:e(o),retry:t,refetch:t}:n(a)},[a,d,o,s,c,l,f,u])}var r=e=>Array.isArray(e)?e.length===0:typeof e==`object`&&e&&`items`in e&&Array.isArray(e.items)?e.items.length===0:!1;function i(n){let{currentData:r,error:i,isFetching:a,isFetchingNextPage:o,hasNextPage:s,isError:c,isFetchNextPageError:l,isUninitialized:u,refetch:d,fetchNextPage:f,fulfilledTimeStamp:p}=n,m=t(()=>(r?.pages??[]).flatMap(e=>e.items),[r]),h=t(()=>{let t=()=>{d()};if(r===void 0)return i===void 0?u===!0?{status:`idle`}:{status:`loading`,refetch:t}:{status:`error`,error:e(i),retry:t,refetch:t};let n=a&&!o;return m.length===0?{status:`empty`,refreshing:n,refresh:t,refetch:t,fulfilledTimeStamp:p}:{status:`data`,data:m,refreshing:n,refresh:t,refetch:t,fulfilledTimeStamp:p}},[r,i,a,o,u,m,d,p]),g=c&&l===!0;return{state:h,paging:t(()=>({hasMore:s,loadingMore:o,errorMore:g?e(i):null,loadMore:()=>{s&&!o&&!g&&f()},retryMore:()=>{g&&f()}}),[s,o,g,i,f])}}export{n as useDataState,i as useInfiniteDataState};
@@ -73,8 +73,11 @@ export interface InfiniteQueryResultLike<T> {
73
73
  readonly isFetchingNextPage: boolean;
74
74
  readonly hasNextPage: boolean;
75
75
  readonly isError: boolean;
76
- /** True when the last next-page fetch failed; isError alone is also true for a failed refresh. */
77
- readonly isFetchNextPageError: boolean;
76
+ /**
77
+ * True when the last next-page fetch failed; isError alone is also true for a failed refresh.
78
+ * Optional because RTK Query's hook result types do not declare it, though every hook result carries it; missing reads as false.
79
+ */
80
+ readonly isFetchNextPageError?: boolean | undefined;
78
81
  /** True while the query has never started, which for an RTK Query hook means it is skipped. */
79
82
  readonly isUninitialized?: boolean | undefined;
80
83
  readonly fulfilledTimeStamp?: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/web-core",
3
- "version": "0.155.0",
3
+ "version": "0.155.1",
4
4
  "description": "Platform layer for Webority React web portals: HTTP clients with single-flight token refresh, auth store, API error extraction, RTK Query base query, logger, formatters, storage, version check and route guards. No UI.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -98,7 +98,7 @@
98
98
  },
99
99
  "sideEffects": false,
100
100
  "dependencies": {
101
- "@webority/api-contract": "0.155.0"
101
+ "@webority/api-contract": "0.155.1"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "@microsoft/applicationinsights-web": "^3.4.5",
@@ -120,7 +120,7 @@
120
120
  "@types/node": "25.6.0",
121
121
  "@types/react": "^19.3.0",
122
122
  "@vitest/coverage-v8": "5.1.0",
123
- "@webority/biome-config": "0.155.0",
123
+ "@webority/biome-config": "0.155.1",
124
124
  "axios": "^1.18.0",
125
125
  "jsdom": "30.1.1",
126
126
  "react": "^19.3.1",