@panneau/data 4.0.50 → 4.0.56
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.
- package/dist/index.d.ts +17 -11
- package/dist/index.js +3 -5
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions, UseQueryResult, UseMutationResult, UseMutationOptions, QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { Item, Pagination, Resource, ResourceItem } from '@panneau/core';
|
|
4
|
-
import * as
|
|
4
|
+
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|
|
7
7
|
declare function useItem<T = Item>(scope: any, id: any, loader: (id: any) => Promise<T>, opts?: any): {
|
|
@@ -27,10 +27,10 @@ declare function useItem<T = Item>(scope: any, id: any, loader: (id: any) => Pro
|
|
|
27
27
|
isRefetching: boolean;
|
|
28
28
|
isStale: boolean;
|
|
29
29
|
isEnabled: boolean;
|
|
30
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
30
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<T>, Error>>;
|
|
31
31
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
32
|
-
promise: Promise<
|
|
33
|
-
item:
|
|
32
|
+
promise: Promise<NoInfer<T>>;
|
|
33
|
+
item: T;
|
|
34
34
|
} | {
|
|
35
35
|
error: null;
|
|
36
36
|
isError: false;
|
|
@@ -54,10 +54,10 @@ declare function useItem<T = Item>(scope: any, id: any, loader: (id: any) => Pro
|
|
|
54
54
|
isRefetching: boolean;
|
|
55
55
|
isStale: boolean;
|
|
56
56
|
isEnabled: boolean;
|
|
57
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<
|
|
57
|
+
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<T>, Error>>;
|
|
58
58
|
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
59
|
-
promise: Promise<
|
|
60
|
-
item:
|
|
59
|
+
promise: Promise<NoInfer<T>>;
|
|
60
|
+
item: T;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
type UseItemsResponse<T> = {
|
|
@@ -66,17 +66,23 @@ type UseItemsResponse<T> = {
|
|
|
66
66
|
meta?: Pagination;
|
|
67
67
|
} | T[];
|
|
68
68
|
type UseItemsKey = [string, Record<string, unknown> | null, number | null, number | null];
|
|
69
|
+
type Query = {
|
|
70
|
+
page?: number | null;
|
|
71
|
+
count?: number | null;
|
|
72
|
+
[key: string]: unknown;
|
|
73
|
+
};
|
|
69
74
|
type UseItemsOptions<T> = Omit<UseQueryOptions<UseItemsResponse<T>, Error, UseItemsResponse<T>, UseItemsKey>, 'queryKey' | 'queryFn'> & {
|
|
70
75
|
url?: string | null;
|
|
71
76
|
getItems?: ((query: Record<string, unknown> | null, page: number | null, count: number | null) => Promise<UseItemsResponse<T>>) | null;
|
|
72
77
|
page?: number | null;
|
|
73
78
|
count?: number | null;
|
|
74
|
-
query?:
|
|
79
|
+
query?: Query | null;
|
|
75
80
|
keepData?: boolean;
|
|
76
81
|
};
|
|
77
82
|
type UseItemsResult<T> = {
|
|
78
83
|
items: T[];
|
|
79
84
|
allItems: T[];
|
|
85
|
+
pages: Record<string, UseItemsResponse<T>>;
|
|
80
86
|
pagination: {
|
|
81
87
|
page: number;
|
|
82
88
|
lastPage: number;
|
|
@@ -221,7 +227,7 @@ interface ApiProviderProps {
|
|
|
221
227
|
children: ReactNode;
|
|
222
228
|
}
|
|
223
229
|
declare function useApi(): Api;
|
|
224
|
-
declare function ApiProvider({ api: initialApi, baseUrl, onUnauthorized, children, }: ApiProviderProps):
|
|
230
|
+
declare function ApiProvider({ api: initialApi, baseUrl, onUnauthorized, children, }: ApiProviderProps): react.JSX.Element;
|
|
225
231
|
|
|
226
232
|
type QueryInitialData = Record<string, unknown> | Array<Record<string, unknown>>;
|
|
227
233
|
interface QueryProviderProps {
|
|
@@ -231,14 +237,14 @@ interface QueryProviderProps {
|
|
|
231
237
|
children: ReactNode;
|
|
232
238
|
}
|
|
233
239
|
declare function useQueryContext(): QueryClient;
|
|
234
|
-
declare function QueryProvider({ config: initialConfig, initialKey, initialData, children, }: QueryProviderProps):
|
|
240
|
+
declare function QueryProvider({ config: initialConfig, initialKey, initialData, children, }: QueryProviderProps): react.JSX.Element;
|
|
235
241
|
|
|
236
242
|
interface DataProviderProps {
|
|
237
243
|
api?: Api | null;
|
|
238
244
|
apiBaseUrl?: string;
|
|
239
245
|
children?: ReactNode;
|
|
240
246
|
}
|
|
241
|
-
declare function DataProvider({ api, apiBaseUrl, children }: DataProviderProps):
|
|
247
|
+
declare function DataProvider({ api, apiBaseUrl, children }: DataProviderProps): react.JSX.Element;
|
|
242
248
|
|
|
243
249
|
export { Api, ApiProvider, Base as BaseApi, DataProvider, QueryProvider, useApi, useItem, useItems, useQueryContext, useResourceClone, useResourceDestroy, useResourceItem, useResourceItems, useResourceRestore, useResourceCreate as useResourceStore, useResourceUpdate };
|
|
244
250
|
export type { UseItemsResponse };
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import queryString from 'query-string';
|
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
import { useQuery, keepPreviousData, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
8
8
|
import { c } from 'react/compiler-runtime';
|
|
9
|
-
import isArray from 'lodash/isArray';
|
|
10
|
-
import isObject from 'lodash/isObject';
|
|
11
|
-
import isString from 'lodash/isString';
|
|
9
|
+
import isArray from 'lodash-es/isArray';
|
|
10
|
+
import isObject from 'lodash-es/isObject';
|
|
11
|
+
import isString from 'lodash-es/isString';
|
|
12
12
|
|
|
13
13
|
function useItem(scope, id, loader, t0) {
|
|
14
14
|
const $ = c(15);
|
|
@@ -822,8 +822,6 @@ class Api extends Base {
|
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
826
|
-
|
|
827
825
|
const ApiContext = /*#__PURE__*/createContext(null);
|
|
828
826
|
function useApi() {
|
|
829
827
|
return use(ApiContext);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/data",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.56",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"type": "module",
|
|
37
37
|
"module": "dist/index.js",
|
|
38
38
|
"types": "dist/index.d.ts",
|
|
39
|
+
"sideEffects": false,
|
|
39
40
|
"exports": {
|
|
40
41
|
".": {
|
|
41
42
|
"types": "./dist/index.d.ts",
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
"@babel/runtime": "^7.28.6",
|
|
63
64
|
"@folklore/fetch": "^0.1.21",
|
|
64
65
|
"@folklore/routes": "^0.2.44",
|
|
65
|
-
"@panneau/core": "^4.0.
|
|
66
|
+
"@panneau/core": "^4.0.56",
|
|
66
67
|
"@tanstack/react-query": "^5.100.9",
|
|
67
68
|
"lodash": "^4.17.21",
|
|
68
69
|
"query-string": "^9.0.0"
|
|
@@ -70,5 +71,5 @@
|
|
|
70
71
|
"publishConfig": {
|
|
71
72
|
"access": "public"
|
|
72
73
|
},
|
|
73
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "9c3ba1bdd04699e0150f84a35f2bdbdec073bd59"
|
|
74
75
|
}
|