@panneau/data 4.0.73 → 4.0.74
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 +312 -113
- package/dist/index.js +508 -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,355 @@ 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
|
-
loading: boolean;
|
|
136
|
-
};
|
|
331
|
+
declare function useResourceUpdate(resource: Resource | string, id: string, options: any): any;
|
|
332
|
+
declare function useResourceUpdate(id: string, options: any): any;
|
|
137
333
|
|
|
138
|
-
declare function useResourceClone(resource:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
334
|
+
declare function useResourceClone(resource: Resource | string): any;
|
|
335
|
+
declare function useResourceClone(id: string | null): any;
|
|
336
|
+
declare function useResourceClone(resource: Resource | string, id: string | null): any;
|
|
337
|
+
declare function useResourceClone(id: string | null, options: UseMutationOptions): any;
|
|
338
|
+
declare function useResourceClone(resource: Resource | string, id: string | null, options: UseMutationOptions): any;
|
|
142
339
|
|
|
143
|
-
declare function useResourceRestore(resource:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
340
|
+
declare function useResourceRestore(resource: Resource | string): any;
|
|
341
|
+
declare function useResourceRestore(id: string | null): any;
|
|
342
|
+
declare function useResourceRestore(resource: Resource | string, id: string | null): any;
|
|
343
|
+
declare function useResourceRestore(id: string | null, options: UseMutationOptions): any;
|
|
344
|
+
declare function useResourceRestore(resource: Resource | string, id: string | null, options: UseMutationOptions): any;
|
|
147
345
|
|
|
346
|
+
interface ApiOptions {
|
|
347
|
+
baseUrl?: string | null;
|
|
348
|
+
routes?: Record<string, string>;
|
|
349
|
+
generateUrl?: ((routeName: string, params?: Record<string, unknown>) => string | null) | null;
|
|
350
|
+
onUnauthorized?: (() => void) | null;
|
|
351
|
+
}
|
|
148
352
|
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;
|
|
353
|
+
options: ApiOptions;
|
|
354
|
+
constructor(opts: ApiOptions);
|
|
355
|
+
requestGet<T = unknown>(path: string, query?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
356
|
+
requestPost<T = unknown>(path: string, data?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
357
|
+
requestPut<T = unknown>(path: string, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T>;
|
|
358
|
+
requestPatch<T = unknown>(path: string, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
359
|
+
requestDelete<T = unknown>(path: string, opts?: Record<string, unknown> | null): Promise<T | null>;
|
|
360
|
+
hasRoute(route: string): boolean;
|
|
361
|
+
route(route: string, params?: Record<string, unknown> | null): string;
|
|
362
|
+
getFullUrl(path: string, query?: Record<string, unknown> | null): string;
|
|
363
|
+
onError(err: any): void;
|
|
165
364
|
}
|
|
166
365
|
|
|
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;
|
|
366
|
+
declare class AccountApi extends Base {
|
|
367
|
+
constructor(opts: any);
|
|
368
|
+
update(data: any): Promise<unknown>;
|
|
369
|
+
updatePassword(data: any): Promise<unknown>;
|
|
370
|
+
delete(data: any): Promise<unknown>;
|
|
177
371
|
}
|
|
178
372
|
|
|
179
|
-
declare class
|
|
180
|
-
constructor(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
373
|
+
declare class AuthApi extends Base {
|
|
374
|
+
constructor(opts: any);
|
|
375
|
+
check(): Promise<unknown>;
|
|
376
|
+
login(email: any, password: any): Promise<unknown>;
|
|
377
|
+
register(data: any): Promise<unknown>;
|
|
378
|
+
logout(): Promise<unknown>;
|
|
379
|
+
requestPassword(email: any): Promise<unknown>;
|
|
380
|
+
resetPassword(data: any): Promise<unknown>;
|
|
187
381
|
}
|
|
188
382
|
|
|
189
383
|
declare class MediasApi extends Base {
|
|
384
|
+
constructor(opts: any);
|
|
190
385
|
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:
|
|
386
|
+
get(query?: Record<string, unknown>, page?: number | null, count?: number | null): Promise<unknown>;
|
|
387
|
+
getTrashed(query?: Record<string, unknown>, page?: number | null, count?: number | null): Promise<unknown>;
|
|
388
|
+
getTags(query?: Record<string, unknown>, count?: number | null): Promise<unknown>;
|
|
389
|
+
create(data: Record<string, unknown>): Promise<unknown>;
|
|
390
|
+
update(id: string, data: Record<string, unknown>): Promise<unknown>;
|
|
391
|
+
trash(id: string): Promise<unknown>;
|
|
392
|
+
restore(id: string): Promise<unknown>;
|
|
393
|
+
destroy(id: string): Promise<unknown>;
|
|
394
|
+
replace(id: string, data: Record<string, unknown>): Promise<unknown>;
|
|
200
395
|
}
|
|
201
396
|
|
|
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:
|
|
397
|
+
type ItemsResponse<T> = {
|
|
398
|
+
data: T[];
|
|
399
|
+
pagination: Pagination;
|
|
400
|
+
meta?: Pagination;
|
|
401
|
+
} | T[];
|
|
402
|
+
declare class ResourcesApi extends Base {
|
|
403
|
+
constructor(opts: any);
|
|
404
|
+
find<T = ResourceItem>(resource: Resource, id: string, opts?: Record<string, unknown> | null): Promise<T>;
|
|
405
|
+
get<T = ResourceItem, TResponse = ItemsResponse<T>>(resource: Resource, query: Record<string, unknown>, page?: number, count?: number, opts?: Record<string, unknown> | null): Promise<TResponse>;
|
|
406
|
+
store<T = ResourceItem>(resource: Resource, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T>;
|
|
407
|
+
update<T = ResourceItem>(resource: Resource, id: string, data: Record<string, unknown>, opts?: Record<string, unknown> | null): Promise<T>;
|
|
408
|
+
destroy<T = unknown>(resource: Resource, id: string, opts?: Record<string, unknown> | null): Promise<T>;
|
|
409
|
+
clone<T = ResourceItem>(resource: Resource, id: string, data?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T>;
|
|
410
|
+
restore<T = ResourceItem>(resource: Resource, id: string, data?: Record<string, unknown> | null, opts?: Record<string, unknown> | null): Promise<T>;
|
|
411
|
+
resourceRoute({ id }: Resource, route: string, params?: Record<string, unknown> | null): string | null;
|
|
216
412
|
}
|
|
217
413
|
|
|
218
414
|
declare class Api extends Base {
|
|
415
|
+
resources: ResourcesApi;
|
|
416
|
+
medias: MediasApi;
|
|
219
417
|
auth: AuthApi;
|
|
220
418
|
account: AccountApi;
|
|
221
|
-
|
|
222
|
-
resources: ResourcesApi;
|
|
419
|
+
constructor(opts: any);
|
|
223
420
|
}
|
|
224
421
|
|
|
422
|
+
declare function useApi(): Api;
|
|
225
423
|
interface ApiProviderProps {
|
|
226
424
|
api?: Api | null;
|
|
227
425
|
baseUrl?: string;
|
|
228
426
|
onUnauthorized?: (() => void) | null;
|
|
427
|
+
routes?: Record<string, string> | null;
|
|
229
428
|
children: ReactNode;
|
|
230
429
|
}
|
|
231
|
-
declare function
|
|
232
|
-
declare function ApiProvider({ api: initialApi, baseUrl, onUnauthorized, children, }: ApiProviderProps): react.JSX.Element;
|
|
430
|
+
declare function ApiProvider({ api: initialApi, baseUrl, onUnauthorized, routes: apiRoutes, children, }: ApiProviderProps): react.JSX.Element;
|
|
233
431
|
|
|
234
432
|
type QueryInitialData = Record<string, unknown> | Array<Record<string, unknown>>;
|
|
235
433
|
interface QueryProviderProps {
|
|
@@ -244,6 +442,7 @@ declare function QueryProvider({ config: initialConfig, initialKey, initialData,
|
|
|
244
442
|
interface DataProviderProps {
|
|
245
443
|
api?: Api | null;
|
|
246
444
|
apiBaseUrl?: string;
|
|
445
|
+
routes?: Record<string, string> | null;
|
|
247
446
|
baseUrl?: string;
|
|
248
447
|
queryConfig?: QueryClientConfig | null;
|
|
249
448
|
initialQueryKey?: string[] | null;
|
|
@@ -251,7 +450,7 @@ interface DataProviderProps {
|
|
|
251
450
|
onUnauthorized?: (() => void) | null;
|
|
252
451
|
children?: ReactNode;
|
|
253
452
|
}
|
|
254
|
-
declare function DataProvider({ api, apiBaseUrl, baseUrl, children, queryConfig, initialQueryKey, initialQueryData, onUnauthorized, }: DataProviderProps): react.JSX.Element;
|
|
453
|
+
declare function DataProvider({ api, apiBaseUrl, routes, baseUrl, children, queryConfig, initialQueryKey, initialQueryData, onUnauthorized, }: DataProviderProps): react.JSX.Element;
|
|
255
454
|
|
|
256
|
-
export { Api, ApiProvider, Base as BaseApi, DataProvider, QueryProvider, useApi, useItem, useItems, useQueryContext, useResourceClone, useResourceDestroy, useResourceItem, useResourceItems, useResourceRestore,
|
|
455
|
+
export { Api, ApiProvider, Base as BaseApi, DataProvider, QueryProvider, useApi, useItem, useItems, useQueryContext, useResourceClone, useResourceDestroy, useResourceItem, useResourceItems, useResourceRestore, useResourceStore, useResourceUpdate };
|
|
257
456
|
export type { UseItemsResponse };
|