@panneau/data 4.0.73 → 4.0.75
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 +314 -113
- package/dist/index.js +519 -382
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { UseQueryOptions,
|
|
2
|
+
import { UseQueryOptions, UseMutationOptions, QueryClientConfig, QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { Item, Pagination, Resource, ResourceItem } from '@panneau/core';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
@@ -79,157 +79,357 @@ type UseItemsOptions<T> = Omit<UseQueryOptions<UseItemsResponse<T>, Error, UseIt
|
|
|
79
79
|
query?: Query | null;
|
|
80
80
|
keepData?: boolean;
|
|
81
81
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
declare function useItems<T = Item>(scope: string, { url, getItems, page: initialPage, count: initialCount, query, keepData, ...queryConfig }: UseItemsOptions<T>): {
|
|
83
|
+
isLoading: boolean;
|
|
84
|
+
isFetching: boolean;
|
|
85
|
+
isRefetching: boolean;
|
|
86
|
+
isFetched: boolean;
|
|
87
|
+
items: any;
|
|
88
|
+
pages: {};
|
|
89
|
+
allItems: any;
|
|
90
|
+
loading: boolean;
|
|
91
|
+
loaded: boolean;
|
|
92
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<UseItemsResponse<T>>, Error>>;
|
|
93
|
+
updateItem: (item: any) => void;
|
|
86
94
|
pagination: {
|
|
87
95
|
page: number;
|
|
88
96
|
lastPage: number;
|
|
89
97
|
total: number;
|
|
90
|
-
}
|
|
98
|
+
};
|
|
99
|
+
error: Error;
|
|
100
|
+
isError: true;
|
|
101
|
+
isPending: false;
|
|
102
|
+
isLoadingError: false;
|
|
103
|
+
isRefetchError: true;
|
|
104
|
+
isSuccess: false;
|
|
105
|
+
isPlaceholderData: false;
|
|
106
|
+
status: "error";
|
|
107
|
+
dataUpdatedAt: number;
|
|
108
|
+
errorUpdatedAt: number;
|
|
109
|
+
failureCount: number;
|
|
110
|
+
failureReason: Error;
|
|
111
|
+
errorUpdateCount: number;
|
|
112
|
+
isFetchedAfterMount: boolean;
|
|
113
|
+
isInitialLoading: boolean;
|
|
114
|
+
isPaused: boolean;
|
|
115
|
+
isStale: boolean;
|
|
116
|
+
isEnabled: boolean;
|
|
117
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
118
|
+
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
119
|
+
} | {
|
|
120
|
+
isLoading: boolean;
|
|
121
|
+
isFetching: boolean;
|
|
122
|
+
isRefetching: boolean;
|
|
123
|
+
isFetched: boolean;
|
|
124
|
+
items: any;
|
|
125
|
+
pages: {};
|
|
126
|
+
allItems: any;
|
|
91
127
|
loading: boolean;
|
|
92
128
|
loaded: boolean;
|
|
93
|
-
reload: () =>
|
|
94
|
-
updateItem: (item:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
129
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<UseItemsResponse<T>>, Error>>;
|
|
130
|
+
updateItem: (item: any) => void;
|
|
131
|
+
pagination: {
|
|
132
|
+
page: number;
|
|
133
|
+
lastPage: number;
|
|
134
|
+
total: number;
|
|
135
|
+
};
|
|
136
|
+
error: null;
|
|
137
|
+
isError: false;
|
|
138
|
+
isPending: false;
|
|
139
|
+
isLoadingError: false;
|
|
140
|
+
isRefetchError: false;
|
|
141
|
+
isSuccess: true;
|
|
142
|
+
isPlaceholderData: false;
|
|
143
|
+
status: "success";
|
|
144
|
+
dataUpdatedAt: number;
|
|
145
|
+
errorUpdatedAt: number;
|
|
146
|
+
failureCount: number;
|
|
147
|
+
failureReason: Error;
|
|
148
|
+
errorUpdateCount: number;
|
|
149
|
+
isFetchedAfterMount: boolean;
|
|
150
|
+
isInitialLoading: boolean;
|
|
151
|
+
isPaused: boolean;
|
|
152
|
+
isStale: boolean;
|
|
153
|
+
isEnabled: boolean;
|
|
154
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
155
|
+
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
156
|
+
} | {
|
|
157
|
+
isLoading: boolean;
|
|
158
|
+
isFetching: boolean;
|
|
159
|
+
isRefetching: boolean;
|
|
160
|
+
isFetched: boolean;
|
|
161
|
+
items: any;
|
|
162
|
+
pages: {};
|
|
163
|
+
allItems: any;
|
|
164
|
+
loading: boolean;
|
|
165
|
+
loaded: boolean;
|
|
166
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<UseItemsResponse<T>>, Error>>;
|
|
167
|
+
updateItem: (item: any) => void;
|
|
168
|
+
pagination: {
|
|
169
|
+
page: number;
|
|
170
|
+
lastPage: number;
|
|
171
|
+
total: number;
|
|
172
|
+
};
|
|
173
|
+
error: Error;
|
|
174
|
+
isError: true;
|
|
175
|
+
isPending: false;
|
|
176
|
+
isLoadingError: true;
|
|
177
|
+
isRefetchError: false;
|
|
178
|
+
isSuccess: false;
|
|
179
|
+
isPlaceholderData: false;
|
|
180
|
+
status: "error";
|
|
181
|
+
dataUpdatedAt: number;
|
|
182
|
+
errorUpdatedAt: number;
|
|
183
|
+
failureCount: number;
|
|
184
|
+
failureReason: Error;
|
|
185
|
+
errorUpdateCount: number;
|
|
186
|
+
isFetchedAfterMount: boolean;
|
|
187
|
+
isInitialLoading: boolean;
|
|
188
|
+
isPaused: boolean;
|
|
189
|
+
isStale: boolean;
|
|
190
|
+
isEnabled: boolean;
|
|
191
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
192
|
+
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
193
|
+
} | {
|
|
194
|
+
isLoading: boolean;
|
|
195
|
+
isFetching: boolean;
|
|
196
|
+
isRefetching: boolean;
|
|
197
|
+
isFetched: boolean;
|
|
198
|
+
items: any;
|
|
199
|
+
pages: {};
|
|
200
|
+
allItems: any;
|
|
201
|
+
loading: boolean;
|
|
202
|
+
loaded: boolean;
|
|
203
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<UseItemsResponse<T>>, Error>>;
|
|
204
|
+
updateItem: (item: any) => void;
|
|
205
|
+
pagination: {
|
|
206
|
+
page: number;
|
|
207
|
+
lastPage: number;
|
|
208
|
+
total: number;
|
|
209
|
+
};
|
|
210
|
+
error: null;
|
|
211
|
+
isError: false;
|
|
212
|
+
isPending: true;
|
|
213
|
+
isLoadingError: false;
|
|
214
|
+
isRefetchError: false;
|
|
215
|
+
isSuccess: false;
|
|
216
|
+
isPlaceholderData: false;
|
|
217
|
+
status: "pending";
|
|
218
|
+
dataUpdatedAt: number;
|
|
219
|
+
errorUpdatedAt: number;
|
|
220
|
+
failureCount: number;
|
|
221
|
+
failureReason: Error;
|
|
222
|
+
errorUpdateCount: number;
|
|
223
|
+
isFetchedAfterMount: boolean;
|
|
224
|
+
isInitialLoading: boolean;
|
|
225
|
+
isPaused: boolean;
|
|
226
|
+
isStale: boolean;
|
|
227
|
+
isEnabled: boolean;
|
|
228
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
229
|
+
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
230
|
+
} | {
|
|
231
|
+
isLoading: boolean;
|
|
232
|
+
isFetching: boolean;
|
|
233
|
+
isRefetching: boolean;
|
|
234
|
+
isFetched: boolean;
|
|
235
|
+
items: any;
|
|
236
|
+
pages: {};
|
|
237
|
+
allItems: any;
|
|
238
|
+
loading: boolean;
|
|
239
|
+
loaded: boolean;
|
|
240
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<UseItemsResponse<T>>, Error>>;
|
|
241
|
+
updateItem: (item: any) => void;
|
|
242
|
+
pagination: {
|
|
243
|
+
page: number;
|
|
244
|
+
lastPage: number;
|
|
245
|
+
total: number;
|
|
246
|
+
};
|
|
247
|
+
error: null;
|
|
248
|
+
isError: false;
|
|
249
|
+
isPending: true;
|
|
250
|
+
isLoadingError: false;
|
|
251
|
+
isRefetchError: false;
|
|
252
|
+
isSuccess: false;
|
|
253
|
+
isPlaceholderData: false;
|
|
254
|
+
status: "pending";
|
|
255
|
+
dataUpdatedAt: number;
|
|
256
|
+
errorUpdatedAt: number;
|
|
257
|
+
failureCount: number;
|
|
258
|
+
failureReason: Error;
|
|
259
|
+
errorUpdateCount: number;
|
|
260
|
+
isFetchedAfterMount: boolean;
|
|
261
|
+
isInitialLoading: boolean;
|
|
262
|
+
isPaused: boolean;
|
|
263
|
+
isStale: boolean;
|
|
264
|
+
isEnabled: boolean;
|
|
265
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
266
|
+
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
267
|
+
} | {
|
|
268
|
+
isLoading: boolean;
|
|
269
|
+
isFetching: boolean;
|
|
270
|
+
isRefetching: boolean;
|
|
271
|
+
isFetched: boolean;
|
|
272
|
+
items: any;
|
|
273
|
+
pages: {};
|
|
274
|
+
allItems: any;
|
|
101
275
|
loading: boolean;
|
|
276
|
+
loaded: boolean;
|
|
277
|
+
reload: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<NoInfer<UseItemsResponse<T>>, Error>>;
|
|
278
|
+
updateItem: (item: any) => void;
|
|
279
|
+
pagination: {
|
|
280
|
+
page: number;
|
|
281
|
+
lastPage: number;
|
|
282
|
+
total: number;
|
|
283
|
+
};
|
|
284
|
+
isError: false;
|
|
285
|
+
error: null;
|
|
286
|
+
isPending: false;
|
|
287
|
+
isLoadingError: false;
|
|
288
|
+
isRefetchError: false;
|
|
289
|
+
isSuccess: true;
|
|
290
|
+
isPlaceholderData: true;
|
|
291
|
+
status: "success";
|
|
292
|
+
dataUpdatedAt: number;
|
|
293
|
+
errorUpdatedAt: number;
|
|
294
|
+
failureCount: number;
|
|
295
|
+
failureReason: Error;
|
|
296
|
+
errorUpdateCount: number;
|
|
297
|
+
isFetchedAfterMount: boolean;
|
|
298
|
+
isInitialLoading: boolean;
|
|
299
|
+
isPaused: boolean;
|
|
300
|
+
isStale: boolean;
|
|
301
|
+
isEnabled: boolean;
|
|
302
|
+
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
303
|
+
promise: Promise<NoInfer<UseItemsResponse<T>>>;
|
|
102
304
|
};
|
|
103
|
-
declare function useResourceDestroy(resource: Resource | string): UseResourceDestroyResult;
|
|
104
|
-
declare function useResourceDestroy(id: string | null): UseResourceDestroyResult;
|
|
105
|
-
declare function useResourceDestroy(resource: Resource | string, id: string | null): UseResourceDestroyResult;
|
|
106
|
-
declare function useResourceDestroy(id: string | null, options: UseMutationOptions): UseResourceDestroyResult;
|
|
107
|
-
declare function useResourceDestroy(resource: Resource | string, id: string | null, options: UseMutationOptions): UseResourceDestroyResult;
|
|
108
305
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
declare function
|
|
113
|
-
declare function
|
|
114
|
-
|
|
115
|
-
declare function useResourceItem
|
|
306
|
+
declare function useResourceDestroy(resource: Resource | string): any;
|
|
307
|
+
declare function useResourceDestroy(id: string | null): any;
|
|
308
|
+
declare function useResourceDestroy(resource: Resource | string, id: string | null): any;
|
|
309
|
+
declare function useResourceDestroy(id: string | null, options: UseMutationOptions): any;
|
|
310
|
+
declare function useResourceDestroy(resource: Resource | string, id: string | null, options: UseMutationOptions): any;
|
|
311
|
+
|
|
312
|
+
declare function useResourceItem(id: string | null): any;
|
|
313
|
+
declare function useResourceItem(id: string | null, opts: any): any;
|
|
314
|
+
declare function useResourceItem(resource: Resource | string | null, id: string | null): any;
|
|
315
|
+
declare function useResourceItem(resource: Resource | string | null, id: string | null, opts: any): any;
|
|
116
316
|
|
|
117
|
-
declare function useResourceItems
|
|
118
|
-
declare function useResourceItems
|
|
119
|
-
declare function useResourceItems
|
|
120
|
-
declare function useResourceItems
|
|
121
|
-
declare function useResourceItems
|
|
317
|
+
declare function useResourceItems(): any;
|
|
318
|
+
declare function useResourceItems(resource: Resource | string): any;
|
|
319
|
+
declare function useResourceItems(resource: Resource | string, query: Record<string, unknown> | null): any;
|
|
320
|
+
declare function useResourceItems(resource: Resource | string, query: Record<string, unknown> | null, page: number | null): any;
|
|
321
|
+
declare function useResourceItems(resource: Resource | string, query: Record<string, unknown> | null, page: number | null, count: number | null): any;
|
|
122
322
|
declare function useResourceItems<T = ResourceItem>(resource: Resource | string, query: Record<string, unknown> | null, page: number | null, count: number | null, opts: UseItemsOptions<T>): any;
|
|
123
|
-
declare function useResourceItems
|
|
124
|
-
declare function useResourceItems
|
|
125
|
-
declare function useResourceItems
|
|
323
|
+
declare function useResourceItems(query: Record<string, unknown> | null): any;
|
|
324
|
+
declare function useResourceItems(query: Record<string, unknown> | null, page: number | null): any;
|
|
325
|
+
declare function useResourceItems(query: Record<string, unknown> | null, page: number | null, count: number | null): any;
|
|
126
326
|
declare function useResourceItems<T = ResourceItem>(query: Record<string, unknown> | null, page: number | null, count: number | null, opts: UseItemsOptions<T>): any;
|
|
127
327
|
|
|
128
|
-
declare function
|
|
129
|
-
|
|
130
|
-
loading: boolean;
|
|
131
|
-
};
|
|
328
|
+
declare function useResourceStore(resource: Resource | string, options: any): any;
|
|
329
|
+
declare function useResourceStore(options: any): any;
|
|
132
330
|
|
|
133
|
-
declare function useResourceUpdate(resource:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
331
|
+
declare function useResourceUpdate(resource: Resource | string, id: string): any;
|
|
332
|
+
declare function useResourceUpdate(resource: Resource | string, id: string, options: UseMutationOptions): any;
|
|
333
|
+
declare function useResourceUpdate(id: string): any;
|
|
334
|
+
declare function useResourceUpdate(id: string, options: UseMutationOptions): any;
|
|
137
335
|
|
|
138
|
-
declare function useResourceClone(resource:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
336
|
+
declare function useResourceClone(resource: Resource | string): any;
|
|
337
|
+
declare function useResourceClone(id: string | null): any;
|
|
338
|
+
declare function useResourceClone(resource: Resource | string, id: string | null): any;
|
|
339
|
+
declare function useResourceClone(id: string | null, options: UseMutationOptions): any;
|
|
340
|
+
declare function useResourceClone(resource: Resource | string, id: string | null, options: UseMutationOptions): any;
|
|
142
341
|
|
|
143
|
-
declare function useResourceRestore(resource:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
342
|
+
declare function useResourceRestore(resource: Resource | string): any;
|
|
343
|
+
declare function useResourceRestore(id: string | null): any;
|
|
344
|
+
declare function useResourceRestore(resource: Resource | string, id: string | null): any;
|
|
345
|
+
declare function useResourceRestore(id: string | null, options: UseMutationOptions): any;
|
|
346
|
+
declare function useResourceRestore(resource: Resource | string, id: string | null, options: UseMutationOptions): any;
|
|
147
347
|
|
|
348
|
+
interface ApiOptions {
|
|
349
|
+
baseUrl?: string | null;
|
|
350
|
+
routes?: Record<string, string>;
|
|
351
|
+
generateUrl?: ((routeName: string, params?: Record<string, unknown>) => string | null) | null;
|
|
352
|
+
onUnauthorized?: (() => void) | null;
|
|
353
|
+
}
|
|
148
354
|
declare class Base {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
requestDelete(path: any): Promise<unknown>;
|
|
161
|
-
hasRoute(route: any): boolean;
|
|
162
|
-
route(route: any, params: any): any;
|
|
163
|
-
getFullUrl(path: any): any;
|
|
164
|
-
onError(err: any): any;
|
|
355
|
+
options: ApiOptions;
|
|
356
|
+
constructor(opts: ApiOptions);
|
|
357
|
+
requestGet<T = unknown>(path: string, query?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
358
|
+
requestPost<T = unknown>(path: string, data?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
359
|
+
requestPut<T = unknown>(path: string, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T>;
|
|
360
|
+
requestPatch<T = unknown>(path: string, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
361
|
+
requestDelete<T = unknown>(path: string, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
362
|
+
hasRoute(route: string): boolean;
|
|
363
|
+
route(route: string, params?: Record<string, unknown> | null): string;
|
|
364
|
+
getFullUrl(path: string, query?: Record<string, unknown> | null): string;
|
|
365
|
+
onError(err: any): void;
|
|
165
366
|
}
|
|
166
367
|
|
|
167
|
-
declare class
|
|
168
|
-
constructor(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
login(email: any, password: any): any;
|
|
173
|
-
register(data: any): any;
|
|
174
|
-
logout(): Promise<Response>;
|
|
175
|
-
requestPassword(email: any): any;
|
|
176
|
-
resetPassword(data: any): any;
|
|
368
|
+
declare class AccountApi extends Base {
|
|
369
|
+
constructor(opts: any);
|
|
370
|
+
update(data: any): Promise<unknown>;
|
|
371
|
+
updatePassword(data: any): Promise<unknown>;
|
|
372
|
+
delete(data: any): Promise<unknown>;
|
|
177
373
|
}
|
|
178
374
|
|
|
179
|
-
declare class
|
|
180
|
-
constructor(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
375
|
+
declare class AuthApi extends Base {
|
|
376
|
+
constructor(opts: any);
|
|
377
|
+
check(): Promise<unknown>;
|
|
378
|
+
login(email: any, password: any): Promise<unknown>;
|
|
379
|
+
register(data: any): Promise<unknown>;
|
|
380
|
+
logout(): Promise<unknown>;
|
|
381
|
+
requestPassword(email: any): Promise<unknown>;
|
|
382
|
+
resetPassword(data: any): Promise<unknown>;
|
|
187
383
|
}
|
|
188
384
|
|
|
189
385
|
declare class MediasApi extends Base {
|
|
386
|
+
constructor(opts: any);
|
|
190
387
|
find(id: any): Promise<unknown>;
|
|
191
|
-
get(query?:
|
|
192
|
-
getTrashed(query?:
|
|
193
|
-
getTags(query?:
|
|
194
|
-
create(data:
|
|
195
|
-
update(id:
|
|
196
|
-
trash(id:
|
|
197
|
-
restore(id:
|
|
198
|
-
destroy(id:
|
|
199
|
-
replace(id:
|
|
388
|
+
get(query?: Record<string, unknown>, page?: number | null, count?: number | null): Promise<unknown>;
|
|
389
|
+
getTrashed(query?: Record<string, unknown>, page?: number | null, count?: number | null): Promise<unknown>;
|
|
390
|
+
getTags(query?: Record<string, unknown>, count?: number | null): Promise<unknown>;
|
|
391
|
+
create(data: Record<string, unknown>): Promise<unknown>;
|
|
392
|
+
update(id: string, data: Record<string, unknown>): Promise<unknown>;
|
|
393
|
+
trash(id: string): Promise<unknown>;
|
|
394
|
+
restore(id: string): Promise<unknown>;
|
|
395
|
+
destroy(id: string): Promise<unknown>;
|
|
396
|
+
replace(id: string, data: Record<string, unknown>): Promise<unknown>;
|
|
200
397
|
}
|
|
201
398
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
find(resource:
|
|
210
|
-
get(resource:
|
|
211
|
-
store(resource:
|
|
212
|
-
update(resource:
|
|
213
|
-
destroy(resource:
|
|
214
|
-
clone(resource:
|
|
215
|
-
restore(resource:
|
|
399
|
+
type ItemsResponse<T> = {
|
|
400
|
+
data: T[];
|
|
401
|
+
pagination: Pagination;
|
|
402
|
+
meta?: Pagination;
|
|
403
|
+
} | T[];
|
|
404
|
+
declare class ResourcesApi extends Base {
|
|
405
|
+
constructor(opts: any);
|
|
406
|
+
find<T = ResourceItem>(resource: Resource, id: string, opts?: Record<string, unknown> | null): Promise<T>;
|
|
407
|
+
get<T = ResourceItem, TResponse = ItemsResponse<T>>(resource: Resource, query: Record<string, unknown>, page?: number, count?: number, opts?: Record<string, unknown> | null): Promise<TResponse>;
|
|
408
|
+
store<T = ResourceItem>(resource: Resource, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T>;
|
|
409
|
+
update<T = ResourceItem>(resource: Resource, id: string, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T>;
|
|
410
|
+
destroy<T = unknown>(resource: Resource, id: string, opts?: Record<string, unknown> | null): Promise<T>;
|
|
411
|
+
clone<T = ResourceItem>(resource: Resource, id: string, data?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T>;
|
|
412
|
+
restore<T = ResourceItem>(resource: Resource, id: string, data?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T>;
|
|
413
|
+
resourceRoute({ id }: Resource, route: string, params?: Record<string, unknown> | null): string | null;
|
|
216
414
|
}
|
|
217
415
|
|
|
218
416
|
declare class Api extends Base {
|
|
417
|
+
resources: ResourcesApi;
|
|
418
|
+
medias: MediasApi;
|
|
219
419
|
auth: AuthApi;
|
|
220
420
|
account: AccountApi;
|
|
221
|
-
|
|
222
|
-
resources: ResourcesApi;
|
|
421
|
+
constructor(opts: any);
|
|
223
422
|
}
|
|
224
423
|
|
|
424
|
+
declare function useApi(): Api;
|
|
225
425
|
interface ApiProviderProps {
|
|
226
426
|
api?: Api | null;
|
|
227
427
|
baseUrl?: string;
|
|
228
428
|
onUnauthorized?: (() => void) | null;
|
|
429
|
+
routes?: Record<string, string> | null;
|
|
229
430
|
children: ReactNode;
|
|
230
431
|
}
|
|
231
|
-
declare function
|
|
232
|
-
declare function ApiProvider({ api: initialApi, baseUrl, onUnauthorized, children, }: ApiProviderProps): react.JSX.Element;
|
|
432
|
+
declare function ApiProvider({ api: initialApi, baseUrl, onUnauthorized, routes: apiRoutes, children, }: ApiProviderProps): react.JSX.Element;
|
|
233
433
|
|
|
234
434
|
type QueryInitialData = Record<string, unknown> | Array<Record<string, unknown>>;
|
|
235
435
|
interface QueryProviderProps {
|
|
@@ -244,6 +444,7 @@ declare function QueryProvider({ config: initialConfig, initialKey, initialData,
|
|
|
244
444
|
interface DataProviderProps {
|
|
245
445
|
api?: Api | null;
|
|
246
446
|
apiBaseUrl?: string;
|
|
447
|
+
routes?: Record<string, string> | null;
|
|
247
448
|
baseUrl?: string;
|
|
248
449
|
queryConfig?: QueryClientConfig | null;
|
|
249
450
|
initialQueryKey?: string[] | null;
|
|
@@ -251,7 +452,7 @@ interface DataProviderProps {
|
|
|
251
452
|
onUnauthorized?: (() => void) | null;
|
|
252
453
|
children?: ReactNode;
|
|
253
454
|
}
|
|
254
|
-
declare function DataProvider({ api, apiBaseUrl, baseUrl, children, queryConfig, initialQueryKey, initialQueryData, onUnauthorized, }: DataProviderProps): react.JSX.Element;
|
|
455
|
+
declare function DataProvider({ api, apiBaseUrl, routes, baseUrl, children, queryConfig, initialQueryKey, initialQueryData, onUnauthorized, }: DataProviderProps): react.JSX.Element;
|
|
255
456
|
|
|
256
|
-
export { Api, ApiProvider, Base as BaseApi, DataProvider, QueryProvider, useApi, useItem, useItems, useQueryContext, useResourceClone, useResourceDestroy, useResourceItem, useResourceItems, useResourceRestore,
|
|
457
|
+
export { Api, ApiProvider, Base as BaseApi, DataProvider, QueryProvider, useApi, useItem, useItems, useQueryContext, useResourceClone, useResourceDestroy, useResourceItem, useResourceItems, useResourceRestore, useResourceStore, useResourceUpdate };
|
|
257
458
|
export type { UseItemsResponse };
|