@webority/mobile-core 0.165.0 → 0.167.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.
@@ -48,7 +48,7 @@ export interface DataStateOptions<T> {
48
48
  /** Default false. True keeps the last result on screen, refreshing, while a query with new arguments loads. */
49
49
  readonly keepPreviousData?: boolean;
50
50
  }
51
- export interface InfiniteQueryResultLike<T, P extends PagedDataObject<T> = PagedDataObject<T>> {
51
+ export interface InfiniteQueryResultLike<P extends PagedDataObject<unknown>> {
52
52
  readonly currentData?: {
53
53
  readonly pages: readonly P[];
54
54
  } | undefined;
@@ -76,6 +76,7 @@ export interface InfiniteDataStateOptions {
76
76
  /** Default false. True keeps the last loaded pages on screen, refreshing, while a query with new arguments loads. */
77
77
  readonly keepPreviousData?: boolean;
78
78
  }
79
+ export type PageItem<P extends PagedDataObject<unknown>> = P["items"][number];
79
80
  /** What a paged list's footer and header read. */
80
81
  export interface InfiniteListPaging extends PagedListPaging {
81
82
  /** The server's count from the newest page shown; null before any page is shown. */
@@ -106,8 +107,8 @@ export declare function useDataState<T>(result: QueryResultLike<T>, options?: Da
106
107
  * State rules follow useDataState: currentData, then a failed new query ("error"), then a skipped query ("idle"), then
107
108
  * kept pages (refreshing while isFetching), else "loading".
108
109
  */
109
- export declare function useInfiniteDataState<T, P extends PagedDataObject<T> = PagedDataObject<T>>(result: InfiniteQueryResultLike<T, P>, options?: InfiniteDataStateOptions): {
110
- readonly state: DataState<readonly T[]>;
110
+ export declare function useInfiniteDataState<P extends PagedDataObject<unknown>>(result: InfiniteQueryResultLike<P>, options?: InfiniteDataStateOptions): {
111
+ readonly state: DataState<readonly PageItem<P>[]>;
111
112
  readonly paging: InfiniteListPaging;
112
113
  readonly firstPage: Omit<P, "items"> | undefined;
113
114
  };
@@ -5,7 +5,7 @@ export { createApiBaseQuery } from "./apiBaseQuery";
5
5
  export type { ContractQuery, ContractQueryOptions, ContractResponse } from "./contractQuery";
6
6
  export { createContractQuery } from "./contractQuery";
7
7
  export { APP_API_DEFAULTS, createAppApi } from "./createAppApi";
8
- export type { DataState, DataStateOptions, InfiniteDataStateOptions, InfiniteListPaging, InfiniteQueryResultLike, QueryResultLike, } from "./dataState";
8
+ export type { DataState, DataStateOptions, InfiniteDataStateOptions, InfiniteListPaging, InfiniteQueryResultLike, PageItem, QueryResultLike, } from "./dataState";
9
9
  export { useDataState, useInfiniteDataState } from "./dataState";
10
10
  export type { SaveWithVersionOptions, SaveWithVersionResult, VersionedRead } from "./entityVersion";
11
11
  export { entityTagOf, saveWithVersion, versionOf, withIfMatch } from "./entityVersion";
@@ -48,7 +48,7 @@ export interface DataStateOptions<T> {
48
48
  /** Default false. True keeps the last result on screen, refreshing, while a query with new arguments loads. */
49
49
  readonly keepPreviousData?: boolean;
50
50
  }
51
- export interface InfiniteQueryResultLike<T, P extends PagedDataObject<T> = PagedDataObject<T>> {
51
+ export interface InfiniteQueryResultLike<P extends PagedDataObject<unknown>> {
52
52
  readonly currentData?: {
53
53
  readonly pages: readonly P[];
54
54
  } | undefined;
@@ -76,6 +76,7 @@ export interface InfiniteDataStateOptions {
76
76
  /** Default false. True keeps the last loaded pages on screen, refreshing, while a query with new arguments loads. */
77
77
  readonly keepPreviousData?: boolean;
78
78
  }
79
+ export type PageItem<P extends PagedDataObject<unknown>> = P["items"][number];
79
80
  /** What a paged list's footer and header read. */
80
81
  export interface InfiniteListPaging extends PagedListPaging {
81
82
  /** The server's count from the newest page shown; null before any page is shown. */
@@ -106,8 +107,8 @@ export declare function useDataState<T>(result: QueryResultLike<T>, options?: Da
106
107
  * State rules follow useDataState: currentData, then a failed new query ("error"), then a skipped query ("idle"), then
107
108
  * kept pages (refreshing while isFetching), else "loading".
108
109
  */
109
- export declare function useInfiniteDataState<T, P extends PagedDataObject<T> = PagedDataObject<T>>(result: InfiniteQueryResultLike<T, P>, options?: InfiniteDataStateOptions): {
110
- readonly state: DataState<readonly T[]>;
110
+ export declare function useInfiniteDataState<P extends PagedDataObject<unknown>>(result: InfiniteQueryResultLike<P>, options?: InfiniteDataStateOptions): {
111
+ readonly state: DataState<readonly PageItem<P>[]>;
111
112
  readonly paging: InfiniteListPaging;
112
113
  readonly firstPage: Omit<P, "items"> | undefined;
113
114
  };
@@ -5,7 +5,7 @@ export { createApiBaseQuery } from "./apiBaseQuery.js";
5
5
  export type { ContractQuery, ContractQueryOptions, ContractResponse } from "./contractQuery.js";
6
6
  export { createContractQuery } from "./contractQuery.js";
7
7
  export { APP_API_DEFAULTS, createAppApi } from "./createAppApi.js";
8
- export type { DataState, DataStateOptions, InfiniteDataStateOptions, InfiniteListPaging, InfiniteQueryResultLike, QueryResultLike, } from "./dataState.js";
8
+ export type { DataState, DataStateOptions, InfiniteDataStateOptions, InfiniteListPaging, InfiniteQueryResultLike, PageItem, QueryResultLike, } from "./dataState.js";
9
9
  export { useDataState, useInfiniteDataState } from "./dataState.js";
10
10
  export type { SaveWithVersionOptions, SaveWithVersionResult, VersionedRead } from "./entityVersion.js";
11
11
  export { entityTagOf, saveWithVersion, versionOf, withIfMatch } from "./entityVersion.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-core",
3
- "version": "0.165.0",
3
+ "version": "0.167.0",
4
4
  "description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage, version checks and over-the-air updates. No UI.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -399,7 +399,7 @@
399
399
  }
400
400
  },
401
401
  "dependencies": {
402
- "@webority/api-contract": "0.165.0",
402
+ "@webority/api-contract": "0.167.0",
403
403
  "axios": "^1.19.0",
404
404
  "libphonenumber-js": "^1.12.41"
405
405
  },