@panneau/data 4.0.84 → 4.1.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +22 -16
  2. package/dist/index.js +693 -402
  3. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -5,11 +5,10 @@ import { getJSON, getCSRFHeaders, postJSON } from '@folklore/fetch';
5
5
  import { generatePath } from '@folklore/routes';
6
6
  import queryString from 'query-string';
7
7
  import { jsx } from 'react/jsx-runtime';
8
- import { useQuery, keepPreviousData, hashKey, useMutation, useQueryClient, QueryClient, QueryClientProvider } from '@tanstack/react-query';
8
+ import { useQuery, keepPreviousData, hashKey, useQueryClient, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
9
9
  import isArray from 'lodash-es/isArray';
10
10
  import isObject from 'lodash-es/isObject';
11
11
  import isString from 'lodash-es/isString';
12
- import { isObject as isObject$1, isString as isString$1 } from 'lodash-es';
13
12
 
14
13
  function useItem(scope, id, loader, t0) {
15
14
  const $ = c(15);
@@ -85,7 +84,7 @@ function useItem(scope, id, loader, t0) {
85
84
  // The new, better version
86
85
 
87
86
  function useItems(scope, t0) {
88
- const $ = c(52);
87
+ const $ = c(51);
89
88
  const {
90
89
  url: t1,
91
90
  getItems: t2,
@@ -208,14 +207,14 @@ function useItems(scope, t0) {
208
207
  }
209
208
  const [updatedItems, setUpdatedItems] = useState(t20);
210
209
  let t21;
211
- if ($[11] !== updatedItems) {
210
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
212
211
  t21 = item => {
213
212
  const {
214
213
  id: t22
215
214
  } = item || {};
216
215
  const itemId = t22 === undefined ? null : t22;
217
216
  if (itemId !== null) {
218
- setUpdatedItems([...(updatedItems || []).filter(t23 => {
217
+ setUpdatedItems(currentUpdatedItems => [...(currentUpdatedItems || []).filter(t23 => {
219
218
  const {
220
219
  id: t24
221
220
  } = t23 === undefined ? {} : t23;
@@ -224,14 +223,13 @@ function useItems(scope, t0) {
224
223
  }), item]);
225
224
  }
226
225
  };
227
- $[11] = updatedItems;
228
- $[12] = t21;
226
+ $[11] = t21;
229
227
  } else {
230
- t21 = $[12];
228
+ t21 = $[11];
231
229
  }
232
230
  const updateItem = t21;
233
231
  let t22;
234
- if ($[13] !== updatedItems) {
232
+ if ($[12] !== updatedItems) {
235
233
  t22 = currentItems => {
236
234
  if (currentItems === null || updatedItems === null || updatedItems.length === 0) {
237
235
  return currentItems;
@@ -254,66 +252,66 @@ function useItems(scope, t0) {
254
252
  return item_0;
255
253
  }, []);
256
254
  };
257
- $[13] = updatedItems;
258
- $[14] = t22;
255
+ $[12] = updatedItems;
256
+ $[13] = t22;
259
257
  } else {
260
- t22 = $[14];
258
+ t22 = $[13];
261
259
  }
262
260
  const replaceUpdatedItems = t22;
263
261
  let t23;
264
- if ($[15] !== items || $[16] !== replaceUpdatedItems) {
262
+ if ($[14] !== items || $[15] !== replaceUpdatedItems) {
265
263
  t23 = replaceUpdatedItems(items);
266
- $[15] = items;
267
- $[16] = replaceUpdatedItems;
268
- $[17] = t23;
264
+ $[14] = items;
265
+ $[15] = replaceUpdatedItems;
266
+ $[16] = t23;
269
267
  } else {
270
- t23 = $[17];
268
+ t23 = $[16];
271
269
  }
272
270
  const finalItems = t23;
273
271
  const pagesKey = hashKey([scope, queryWithoutPage, count]);
274
272
  let t24;
275
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
273
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
276
274
  t24 = {};
277
- $[18] = t24;
275
+ $[17] = t24;
278
276
  } else {
279
- t24 = $[18];
277
+ t24 = $[17];
280
278
  }
281
279
  let t25;
282
- if ($[19] !== pagesKey) {
280
+ if ($[18] !== pagesKey) {
283
281
  t25 = {
284
282
  key: pagesKey,
285
283
  pages: t24
286
284
  };
287
- $[19] = pagesKey;
288
- $[20] = t25;
285
+ $[18] = pagesKey;
286
+ $[19] = t25;
289
287
  } else {
290
- t25 = $[20];
288
+ t25 = $[19];
291
289
  }
292
290
  const [pagesState, setPagesState] = useState(t25);
293
291
  let t26;
294
- if ($[21] !== pagesKey || $[22] !== pagesState.key || $[23] !== pagesState.pages) {
292
+ if ($[20] !== pagesKey || $[21] !== pagesState.key || $[22] !== pagesState.pages) {
295
293
  t26 = pagesState.key === pagesKey ? pagesState.pages : {};
296
- $[21] = pagesKey;
297
- $[22] = pagesState.key;
298
- $[23] = pagesState.pages;
299
- $[24] = t26;
294
+ $[20] = pagesKey;
295
+ $[21] = pagesState.key;
296
+ $[22] = pagesState.pages;
297
+ $[23] = t26;
300
298
  } else {
301
- t26 = $[24];
299
+ t26 = $[23];
302
300
  }
303
301
  const pages = t26;
304
- if (isFetched && !isPlaceholderData && page !== null && data !== null && typeof pages[page] === "undefined") {
302
+ if (isFetched && !isPlaceholderData && page !== null && data !== null && pages[page] !== data) {
305
303
  let t27;
306
- if ($[25] !== data || $[26] !== page || $[27] !== pages) {
304
+ if ($[24] !== data || $[25] !== page || $[26] !== pages) {
307
305
  t27 = {
308
306
  ...pages,
309
307
  [page]: data
310
308
  };
311
- $[25] = data;
312
- $[26] = page;
313
- $[27] = pages;
314
- $[28] = t27;
309
+ $[24] = data;
310
+ $[25] = page;
311
+ $[26] = pages;
312
+ $[27] = t27;
315
313
  } else {
316
- t27 = $[28];
314
+ t27 = $[27];
317
315
  }
318
316
  setPagesState({
319
317
  key: pagesKey,
@@ -321,34 +319,34 @@ function useItems(scope, t0) {
321
319
  });
322
320
  }
323
321
  let t27;
324
- if ($[29] !== finalItems || $[30] !== pages || $[31] !== replaceUpdatedItems) {
322
+ if ($[28] !== finalItems || $[29] !== pages || $[30] !== replaceUpdatedItems) {
325
323
  t27 = Object.keys(pages).length > 0 ? replaceUpdatedItems(Object.keys(pages).flatMap(k => pages[k]?.data)) : finalItems;
326
- $[29] = finalItems;
327
- $[30] = pages;
328
- $[31] = replaceUpdatedItems;
329
- $[32] = t27;
324
+ $[28] = finalItems;
325
+ $[29] = pages;
326
+ $[30] = replaceUpdatedItems;
327
+ $[31] = t27;
330
328
  } else {
331
- t27 = $[32];
329
+ t27 = $[31];
332
330
  }
333
331
  const allItems = t27;
334
332
  const finalLoading = isLoading || isFetching || isRefetching;
335
333
  let t28;
336
- if ($[33] !== currentPage || $[34] !== lastPage || $[35] !== paginated || $[36] !== total) {
334
+ if ($[32] !== currentPage || $[33] !== lastPage || $[34] !== paginated || $[35] !== total) {
337
335
  t28 = paginated ? {
338
336
  page: currentPage,
339
337
  lastPage,
340
338
  total
341
339
  } : null;
342
- $[33] = currentPage;
343
- $[34] = lastPage;
344
- $[35] = paginated;
345
- $[36] = total;
346
- $[37] = t28;
340
+ $[32] = currentPage;
341
+ $[33] = lastPage;
342
+ $[34] = paginated;
343
+ $[35] = total;
344
+ $[36] = t28;
347
345
  } else {
348
- t28 = $[37];
346
+ t28 = $[36];
349
347
  }
350
348
  let t29;
351
- if ($[38] !== allItems || $[39] !== finalItems || $[40] !== finalLoading || $[41] !== isFetched || $[42] !== isFetching || $[43] !== isLoading || $[44] !== isPlaceholderData || $[45] !== isRefetching || $[46] !== otherProps || $[47] !== pages || $[48] !== reload || $[49] !== t28 || $[50] !== updateItem) {
349
+ if ($[37] !== allItems || $[38] !== finalItems || $[39] !== finalLoading || $[40] !== isFetched || $[41] !== isFetching || $[42] !== isLoading || $[43] !== isPlaceholderData || $[44] !== isRefetching || $[45] !== otherProps || $[46] !== pages || $[47] !== reload || $[48] !== t28 || $[49] !== updateItem) {
352
350
  t29 = {
353
351
  ...otherProps,
354
352
  isLoading,
@@ -365,22 +363,22 @@ function useItems(scope, t0) {
365
363
  updateItem,
366
364
  pagination: t28
367
365
  };
368
- $[38] = allItems;
369
- $[39] = finalItems;
370
- $[40] = finalLoading;
371
- $[41] = isFetched;
372
- $[42] = isFetching;
373
- $[43] = isLoading;
374
- $[44] = isPlaceholderData;
375
- $[45] = isRefetching;
376
- $[46] = otherProps;
377
- $[47] = pages;
378
- $[48] = reload;
379
- $[49] = t28;
380
- $[50] = updateItem;
381
- $[51] = t29;
382
- } else {
383
- t29 = $[51];
366
+ $[37] = allItems;
367
+ $[38] = finalItems;
368
+ $[39] = finalLoading;
369
+ $[40] = isFetched;
370
+ $[41] = isFetching;
371
+ $[42] = isLoading;
372
+ $[43] = isPlaceholderData;
373
+ $[44] = isRefetching;
374
+ $[45] = otherProps;
375
+ $[46] = pages;
376
+ $[47] = reload;
377
+ $[48] = t28;
378
+ $[49] = updateItem;
379
+ $[50] = t29;
380
+ } else {
381
+ t29 = $[50];
384
382
  }
385
383
  return t29;
386
384
  }
@@ -441,12 +439,19 @@ class Base {
441
439
  routes,
442
440
  generateUrl = null
443
441
  } = this.options;
444
- if (generateUrl !== null) {
445
- return generateUrl(route, params);
442
+ // The url generator returns null for routes it doesn't know: fallback to the routes option
443
+ const url = generateUrl !== null ? generateUrl(route, params) : null;
444
+ if (url !== null && typeof url !== 'undefined') {
445
+ return url;
446
446
  }
447
- return generatePath(routes?.[route] || route, params);
447
+ const path = routes?.[route] ?? null;
448
+ // Return null for unknown routes, so callers can fallback to another route
449
+ return path !== null ? generatePath(path, params || {}) : null;
448
450
  }
449
451
  getFullUrl(path, query = null) {
452
+ if (path === null || typeof path === 'undefined') {
453
+ throw new Error('Api: route not found');
454
+ }
450
455
  const {
451
456
  baseUrl = null
452
457
  } = this.options;
@@ -748,8 +753,42 @@ function ApiProvider(t0) {
748
753
  return t6;
749
754
  }
750
755
 
756
+ /**
757
+ * Resolve the arguments of resource hooks supporting these call forms:
758
+ * (resource), (id), (resource, id), (resource, options), (id, options), (resource, id, options)
759
+ *
760
+ * The first argument is the resource when it is an object or a known resource id, or when a
761
+ * non-null id is passed as second argument. Otherwise, it is considered as the item id and the
762
+ * resource from the context is used.
763
+ */
764
+ function useResourceArguments(resource, id, options) {
765
+ const $ = c(4);
766
+ const idIsOptions = isObject(id);
767
+ const providedResource = usePanneauResource(resource);
768
+ const contextResource = useResource();
769
+ const resourceIsExplicit = providedResource !== null || !idIsOptions && id !== null;
770
+ const t0 = providedResource || contextResource || null;
771
+ const t1 = resourceIsExplicit ? idIsOptions ? null : id : resource;
772
+ const t2 = idIsOptions ? id : options;
773
+ let t3;
774
+ if ($[0] !== t0 || $[1] !== t1 || $[2] !== t2) {
775
+ t3 = {
776
+ resource: t0,
777
+ id: t1,
778
+ options: t2
779
+ };
780
+ $[0] = t0;
781
+ $[1] = t1;
782
+ $[2] = t2;
783
+ $[3] = t3;
784
+ } else {
785
+ t3 = $[3];
786
+ }
787
+ return t3;
788
+ }
789
+
751
790
  function useResourceDestroy(t0, t1, t2) {
752
- const $ = c(19);
791
+ const $ = c(32);
753
792
  const resource = t0 === undefined ? null : t0;
754
793
  const id = t1 === undefined ? null : t1;
755
794
  let t3;
@@ -761,62 +800,127 @@ function useResourceDestroy(t0, t1, t2) {
761
800
  t3 = $[1];
762
801
  }
763
802
  const options = t3;
764
- const providedResource = usePanneauResource(id !== null && !isObject(id) ? resource : null);
765
- const contextResource = useResource();
766
- const finalResource = providedResource || contextResource;
767
- const finalId = providedResource !== null ? id : resource;
768
- const api = useApi();
803
+ const {
804
+ resource: finalResource,
805
+ id: finalId,
806
+ options: finalOptions
807
+ } = useResourceArguments(resource, id, options);
769
808
  let t4;
770
- if ($[2] !== api || $[3] !== finalId || $[4] !== finalResource) {
771
- t4 = t5 => {
772
- const providedId = t5 === undefined ? null : t5;
809
+ if ($[2] !== finalOptions) {
810
+ t4 = finalOptions || {};
811
+ $[2] = finalOptions;
812
+ $[3] = t4;
813
+ } else {
814
+ t4 = $[3];
815
+ }
816
+ let otherOptions;
817
+ let t5;
818
+ if ($[4] !== t4) {
819
+ ({
820
+ onSuccess: t5,
821
+ ...otherOptions
822
+ } = t4);
823
+ $[4] = t4;
824
+ $[5] = otherOptions;
825
+ $[6] = t5;
826
+ } else {
827
+ otherOptions = $[5];
828
+ t5 = $[6];
829
+ }
830
+ const customOnSuccess = t5 === undefined ? null : t5;
831
+ let t6;
832
+ if ($[7] !== finalResource) {
833
+ t6 = finalResource || {};
834
+ $[7] = finalResource;
835
+ $[8] = t6;
836
+ } else {
837
+ t6 = $[8];
838
+ }
839
+ const {
840
+ id: t7
841
+ } = t6;
842
+ const resourceId = t7 === undefined ? null : t7;
843
+ const api = useApi();
844
+ const queryClient = useQueryClient();
845
+ let t8;
846
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
847
+ t8 = t9 => {
848
+ const providedId = t9 === undefined ? null : t9;
773
849
  return api.resources.destroy(finalResource, providedId ?? finalId);
774
850
  };
775
- $[2] = api;
776
- $[3] = finalId;
777
- $[4] = finalResource;
778
- $[5] = t4;
851
+ $[9] = api;
852
+ $[10] = finalId;
853
+ $[11] = finalResource;
854
+ $[12] = t8;
779
855
  } else {
780
- t4 = $[5];
856
+ t8 = $[12];
781
857
  }
782
- let t5;
783
- if ($[6] !== options || $[7] !== t4) {
784
- t5 = {
785
- mutationFn: t4,
786
- ...options
858
+ let t9;
859
+ if ($[13] !== customOnSuccess || $[14] !== finalId || $[15] !== queryClient || $[16] !== resourceId) {
860
+ t9 = (data, variables, ...t10) => {
861
+ const args = t10;
862
+ const destroyedId = variables ?? finalId;
863
+ queryClient.invalidateQueries({
864
+ queryKey: [resourceId],
865
+ predicate: t11 => {
866
+ const {
867
+ queryKey
868
+ } = t11;
869
+ return String(queryKey[1]) !== String(destroyedId);
870
+ }
871
+ });
872
+ if (customOnSuccess !== null) {
873
+ return customOnSuccess(data, variables, ...args);
874
+ }
787
875
  };
788
- $[6] = options;
789
- $[7] = t4;
790
- $[8] = t5;
876
+ $[13] = customOnSuccess;
877
+ $[14] = finalId;
878
+ $[15] = queryClient;
879
+ $[16] = resourceId;
880
+ $[17] = t9;
791
881
  } else {
792
- t5 = $[8];
882
+ t9 = $[17];
883
+ }
884
+ let t10;
885
+ if ($[18] !== otherOptions || $[19] !== t8 || $[20] !== t9) {
886
+ t10 = {
887
+ mutationFn: t8,
888
+ onSuccess: t9,
889
+ ...otherOptions
890
+ };
891
+ $[18] = otherOptions;
892
+ $[19] = t8;
893
+ $[20] = t9;
894
+ $[21] = t10;
895
+ } else {
896
+ t10 = $[21];
793
897
  }
794
- const t6 = useMutation(t5);
898
+ const t11 = useMutation(t10);
795
899
  let isPending;
796
900
  let mutate;
797
901
  let mutateAsync;
798
902
  let other;
799
- if ($[9] !== t6) {
903
+ if ($[22] !== t11) {
800
904
  ({
801
905
  mutate,
802
906
  mutateAsync,
803
907
  isPending,
804
908
  ...other
805
- } = t6);
806
- $[9] = t6;
807
- $[10] = isPending;
808
- $[11] = mutate;
809
- $[12] = mutateAsync;
810
- $[13] = other;
909
+ } = t11);
910
+ $[22] = t11;
911
+ $[23] = isPending;
912
+ $[24] = mutate;
913
+ $[25] = mutateAsync;
914
+ $[26] = other;
811
915
  } else {
812
- isPending = $[10];
813
- mutate = $[11];
814
- mutateAsync = $[12];
815
- other = $[13];
916
+ isPending = $[23];
917
+ mutate = $[24];
918
+ mutateAsync = $[25];
919
+ other = $[26];
816
920
  }
817
- let t7;
818
- if ($[14] !== isPending || $[15] !== mutate || $[16] !== mutateAsync || $[17] !== other) {
819
- t7 = {
921
+ let t12;
922
+ if ($[27] !== isPending || $[28] !== mutate || $[29] !== mutateAsync || $[30] !== other) {
923
+ t12 = {
820
924
  destroy: mutate,
821
925
  destroyAsync: mutateAsync,
822
926
  loading: isPending,
@@ -825,19 +929,19 @@ function useResourceDestroy(t0, t1, t2) {
825
929
  isPending,
826
930
  ...other
827
931
  };
828
- $[14] = isPending;
829
- $[15] = mutate;
830
- $[16] = mutateAsync;
831
- $[17] = other;
832
- $[18] = t7;
932
+ $[27] = isPending;
933
+ $[28] = mutate;
934
+ $[29] = mutateAsync;
935
+ $[30] = other;
936
+ $[31] = t12;
833
937
  } else {
834
- t7 = $[18];
938
+ t12 = $[31];
835
939
  }
836
- return t7;
940
+ return t12;
837
941
  }
838
942
 
839
943
  function useResourceItem(resource, t0, t1) {
840
- const $ = c(17);
944
+ const $ = c(19);
841
945
  const id = t0 === undefined ? null : t0;
842
946
  const opts = t1 === undefined ? null : t1;
843
947
  const api = useApi();
@@ -845,71 +949,81 @@ function useResourceItem(resource, t0, t1) {
845
949
  const contextResource = useResource();
846
950
  const finalResource = providedResource || contextResource;
847
951
  const finalId = providedResource !== null ? id : resource;
848
- const {
849
- id: resourceId
850
- } = finalResource;
851
952
  let t2;
852
- if ($[0] !== finalId || $[1] !== resourceId) {
853
- t2 = [resourceId, finalId];
854
- $[0] = finalId;
855
- $[1] = resourceId;
856
- $[2] = t2;
953
+ if ($[0] !== finalResource) {
954
+ t2 = finalResource || {};
955
+ $[0] = finalResource;
956
+ $[1] = t2;
857
957
  } else {
858
- t2 = $[2];
958
+ t2 = $[1];
859
959
  }
860
- let t3;
861
- if ($[3] !== api || $[4] !== finalId || $[5] !== finalResource) {
862
- t3 = () => api.resources.find(finalResource, finalId);
863
- $[3] = api;
864
- $[4] = finalId;
865
- $[5] = finalResource;
866
- $[6] = t3;
960
+ const {
961
+ id: t3
962
+ } = t2;
963
+ const resourceId = t3 === undefined ? null : t3;
964
+ const t4 = finalId !== null ? String(finalId) : null;
965
+ let t5;
966
+ if ($[2] !== resourceId || $[3] !== t4) {
967
+ t5 = [resourceId, t4];
968
+ $[2] = resourceId;
969
+ $[3] = t4;
970
+ $[4] = t5;
867
971
  } else {
868
- t3 = $[6];
972
+ t5 = $[4];
869
973
  }
870
- let t4;
871
- if ($[7] !== opts || $[8] !== t2 || $[9] !== t3) {
872
- t4 = {
873
- queryKey: t2,
874
- queryFn: t3,
974
+ let t6;
975
+ if ($[5] !== api || $[6] !== finalId || $[7] !== finalResource) {
976
+ t6 = () => api.resources.find(finalResource, finalId);
977
+ $[5] = api;
978
+ $[6] = finalId;
979
+ $[7] = finalResource;
980
+ $[8] = t6;
981
+ } else {
982
+ t6 = $[8];
983
+ }
984
+ let t7;
985
+ if ($[9] !== opts || $[10] !== t5 || $[11] !== t6) {
986
+ t7 = {
987
+ queryKey: t5,
988
+ queryFn: t6,
875
989
  ...opts
876
990
  };
877
- $[7] = opts;
878
- $[8] = t2;
879
- $[9] = t3;
880
- $[10] = t4;
991
+ $[9] = opts;
992
+ $[10] = t5;
993
+ $[11] = t6;
994
+ $[12] = t7;
881
995
  } else {
882
- t4 = $[10];
996
+ t7 = $[12];
883
997
  }
884
- const t5 = useQuery(t4);
998
+ const t8 = useQuery(t7);
885
999
  let request;
886
- let t6;
887
- if ($[11] !== t5) {
1000
+ let t9;
1001
+ if ($[13] !== t8) {
888
1002
  ({
889
- data: t6,
1003
+ data: t9,
890
1004
  ...request
891
- } = t5);
892
- $[11] = t5;
893
- $[12] = request;
894
- $[13] = t6;
1005
+ } = t8);
1006
+ $[13] = t8;
1007
+ $[14] = request;
1008
+ $[15] = t9;
895
1009
  } else {
896
- request = $[12];
897
- t6 = $[13];
1010
+ request = $[14];
1011
+ t9 = $[15];
898
1012
  }
899
- const data = t6 === undefined ? null : t6;
900
- let t7;
901
- if ($[14] !== data || $[15] !== request) {
902
- t7 = {
1013
+ const data = t9 === undefined ? null : t9;
1014
+ let t10;
1015
+ if ($[16] !== data || $[17] !== request) {
1016
+ t10 = {
903
1017
  item: data,
904
1018
  ...request
905
1019
  };
906
- $[14] = data;
907
- $[15] = request;
908
- $[16] = t7;
1020
+ $[16] = data;
1021
+ $[17] = request;
1022
+ $[18] = t10;
909
1023
  } else {
910
- t7 = $[16];
1024
+ t10 = $[18];
911
1025
  }
912
- return t7;
1026
+ return t10;
913
1027
  }
914
1028
 
915
1029
  function useResourceItems(t0, t1, t2, t3, t4) {
@@ -976,7 +1090,7 @@ function useResourceItems(t0, t1, t2, t3, t4) {
976
1090
  }
977
1091
 
978
1092
  function useResourceStore(resource, t0) {
979
- const $ = c(18);
1093
+ const $ = c(30);
980
1094
  let t1;
981
1095
  if ($[0] !== t0) {
982
1096
  t1 = t0 === undefined ? {} : t0;
@@ -989,54 +1103,110 @@ function useResourceStore(resource, t0) {
989
1103
  const providedResource = usePanneauResource(resource);
990
1104
  const contextResource = useResource();
991
1105
  const finalResource = providedResource || contextResource;
992
- const api = useApi();
993
1106
  let t2;
994
- if ($[2] !== api || $[3] !== finalResource) {
995
- t2 = data => api.resources.store(finalResource, data);
996
- $[2] = api;
997
- $[3] = finalResource;
998
- $[4] = t2;
1107
+ if ($[2] !== finalResource) {
1108
+ t2 = finalResource || {};
1109
+ $[2] = finalResource;
1110
+ $[3] = t2;
999
1111
  } else {
1000
- t2 = $[4];
1112
+ t2 = $[3];
1001
1113
  }
1002
- let t3;
1003
- if ($[5] !== options || $[6] !== t2) {
1004
- t3 = {
1005
- mutationFn: t2,
1006
- ...options
1114
+ const {
1115
+ id: t3
1116
+ } = t2;
1117
+ const resourceId = t3 === undefined ? null : t3;
1118
+ let t4;
1119
+ if ($[4] !== options) {
1120
+ t4 = options || {};
1121
+ $[4] = options;
1122
+ $[5] = t4;
1123
+ } else {
1124
+ t4 = $[5];
1125
+ }
1126
+ let otherOptions;
1127
+ let t5;
1128
+ if ($[6] !== t4) {
1129
+ ({
1130
+ onSuccess: t5,
1131
+ ...otherOptions
1132
+ } = t4);
1133
+ $[6] = t4;
1134
+ $[7] = otherOptions;
1135
+ $[8] = t5;
1136
+ } else {
1137
+ otherOptions = $[7];
1138
+ t5 = $[8];
1139
+ }
1140
+ const customOnSuccess = t5 === undefined ? null : t5;
1141
+ const api = useApi();
1142
+ const queryClient = useQueryClient();
1143
+ let t6;
1144
+ if ($[9] !== api || $[10] !== finalResource) {
1145
+ t6 = data => api.resources.store(finalResource, data);
1146
+ $[9] = api;
1147
+ $[10] = finalResource;
1148
+ $[11] = t6;
1149
+ } else {
1150
+ t6 = $[11];
1151
+ }
1152
+ let t7;
1153
+ if ($[12] !== customOnSuccess || $[13] !== queryClient || $[14] !== resourceId) {
1154
+ t7 = (data_0, ...t8) => {
1155
+ const args = t8;
1156
+ queryClient.invalidateQueries({
1157
+ queryKey: [resourceId]
1158
+ });
1159
+ if (customOnSuccess !== null) {
1160
+ return customOnSuccess(data_0, ...args);
1161
+ }
1007
1162
  };
1008
- $[5] = options;
1009
- $[6] = t2;
1010
- $[7] = t3;
1163
+ $[12] = customOnSuccess;
1164
+ $[13] = queryClient;
1165
+ $[14] = resourceId;
1166
+ $[15] = t7;
1011
1167
  } else {
1012
- t3 = $[7];
1168
+ t7 = $[15];
1013
1169
  }
1014
- const t4 = useMutation(t3);
1170
+ let t8;
1171
+ if ($[16] !== otherOptions || $[17] !== t6 || $[18] !== t7) {
1172
+ t8 = {
1173
+ mutationFn: t6,
1174
+ onSuccess: t7,
1175
+ ...otherOptions
1176
+ };
1177
+ $[16] = otherOptions;
1178
+ $[17] = t6;
1179
+ $[18] = t7;
1180
+ $[19] = t8;
1181
+ } else {
1182
+ t8 = $[19];
1183
+ }
1184
+ const t9 = useMutation(t8);
1015
1185
  let isPending;
1016
1186
  let mutate;
1017
1187
  let mutateAsync;
1018
1188
  let other;
1019
- if ($[8] !== t4) {
1189
+ if ($[20] !== t9) {
1020
1190
  ({
1021
1191
  mutate,
1022
1192
  mutateAsync,
1023
1193
  isPending,
1024
1194
  ...other
1025
- } = t4);
1026
- $[8] = t4;
1027
- $[9] = isPending;
1028
- $[10] = mutate;
1029
- $[11] = mutateAsync;
1030
- $[12] = other;
1195
+ } = t9);
1196
+ $[20] = t9;
1197
+ $[21] = isPending;
1198
+ $[22] = mutate;
1199
+ $[23] = mutateAsync;
1200
+ $[24] = other;
1031
1201
  } else {
1032
- isPending = $[9];
1033
- mutate = $[10];
1034
- mutateAsync = $[11];
1035
- other = $[12];
1202
+ isPending = $[21];
1203
+ mutate = $[22];
1204
+ mutateAsync = $[23];
1205
+ other = $[24];
1036
1206
  }
1037
- let t5;
1038
- if ($[13] !== isPending || $[14] !== mutate || $[15] !== mutateAsync || $[16] !== other) {
1039
- t5 = {
1207
+ let t10;
1208
+ if ($[25] !== isPending || $[26] !== mutate || $[27] !== mutateAsync || $[28] !== other) {
1209
+ t10 = {
1040
1210
  store: mutate,
1041
1211
  storeAsync: mutateAsync,
1042
1212
  loading: isPending,
@@ -1045,19 +1215,19 @@ function useResourceStore(resource, t0) {
1045
1215
  isPending,
1046
1216
  ...other
1047
1217
  };
1048
- $[13] = isPending;
1049
- $[14] = mutate;
1050
- $[15] = mutateAsync;
1051
- $[16] = other;
1052
- $[17] = t5;
1218
+ $[25] = isPending;
1219
+ $[26] = mutate;
1220
+ $[27] = mutateAsync;
1221
+ $[28] = other;
1222
+ $[29] = t10;
1053
1223
  } else {
1054
- t5 = $[17];
1224
+ t10 = $[29];
1055
1225
  }
1056
- return t5;
1226
+ return t10;
1057
1227
  }
1058
1228
 
1059
1229
  function useResourceUpdate(resource, t0, t1) {
1060
- const $ = c(35);
1230
+ const $ = c(32);
1061
1231
  const id = t0 === undefined ? null : t0;
1062
1232
  let t2;
1063
1233
  if ($[0] !== t1) {
@@ -1068,78 +1238,69 @@ function useResourceUpdate(resource, t0, t1) {
1068
1238
  t2 = $[1];
1069
1239
  }
1070
1240
  const options = t2;
1071
- const providedResource = usePanneauResource(isObject$1(resource) || isString$1(id) ? resource : null);
1072
- const contextResource = useResource();
1073
- const finalResource = providedResource || contextResource;
1074
- const finalId = !isObject$1(id) ? id : resource;
1241
+ const {
1242
+ resource: finalResource,
1243
+ id: finalId,
1244
+ options: finalOptions
1245
+ } = useResourceArguments(resource, id, options);
1075
1246
  let t3;
1076
- if ($[2] !== id || $[3] !== options) {
1077
- t3 = isObject$1(id) ? id : options;
1078
- $[2] = id;
1079
- $[3] = options;
1080
- $[4] = t3;
1247
+ if ($[2] !== finalOptions) {
1248
+ t3 = finalOptions || {};
1249
+ $[2] = finalOptions;
1250
+ $[3] = t3;
1081
1251
  } else {
1082
- t3 = $[4];
1252
+ t3 = $[3];
1083
1253
  }
1084
- const finalOptions = t3;
1254
+ let otherOptions;
1085
1255
  let t4;
1086
- if ($[5] !== finalOptions) {
1087
- t4 = finalOptions || {};
1088
- $[5] = finalOptions;
1256
+ if ($[4] !== t3) {
1257
+ ({
1258
+ onSuccess: t4,
1259
+ ...otherOptions
1260
+ } = t3);
1261
+ $[4] = t3;
1262
+ $[5] = otherOptions;
1089
1263
  $[6] = t4;
1090
1264
  } else {
1265
+ otherOptions = $[5];
1091
1266
  t4 = $[6];
1092
1267
  }
1093
- let otherOptions;
1268
+ const customOnSuccess = t4 === undefined ? null : t4;
1094
1269
  let t5;
1095
- if ($[7] !== t4) {
1096
- ({
1097
- onSuccess: t5,
1098
- ...otherOptions
1099
- } = t4);
1100
- $[7] = t4;
1101
- $[8] = otherOptions;
1102
- $[9] = t5;
1103
- } else {
1104
- otherOptions = $[8];
1105
- t5 = $[9];
1106
- }
1107
- const customOnSuccess = t5 === undefined ? null : t5;
1108
- let t6;
1109
- if ($[10] !== finalResource) {
1110
- t6 = finalResource || {};
1111
- $[10] = finalResource;
1112
- $[11] = t6;
1270
+ if ($[7] !== finalResource) {
1271
+ t5 = finalResource || {};
1272
+ $[7] = finalResource;
1273
+ $[8] = t5;
1113
1274
  } else {
1114
- t6 = $[11];
1275
+ t5 = $[8];
1115
1276
  }
1116
1277
  const {
1117
- id: t7
1118
- } = t6;
1119
- const resourceId = t7 === undefined ? null : t7;
1278
+ id: t6
1279
+ } = t5;
1280
+ const resourceId = t6 === undefined ? null : t6;
1120
1281
  const api = useApi();
1121
1282
  const queryClient = useQueryClient();
1122
- let t8;
1123
- if ($[12] !== api || $[13] !== finalId || $[14] !== finalResource) {
1124
- t8 = data => api.resources.update(finalResource, finalId, data);
1125
- $[12] = api;
1126
- $[13] = finalId;
1127
- $[14] = finalResource;
1128
- $[15] = t8;
1283
+ let t7;
1284
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
1285
+ t7 = data => api.resources.update(finalResource, finalId, data);
1286
+ $[9] = api;
1287
+ $[10] = finalId;
1288
+ $[11] = finalResource;
1289
+ $[12] = t7;
1129
1290
  } else {
1130
- t8 = $[15];
1291
+ t7 = $[12];
1131
1292
  }
1132
- let t9;
1133
- if ($[16] !== customOnSuccess || $[17] !== finalId || $[18] !== queryClient || $[19] !== resourceId) {
1134
- t9 = (data_0, ...t10) => {
1135
- const args = t10;
1136
- queryClient.setQueryData([resourceId, finalId], data_0);
1293
+ let t8;
1294
+ if ($[13] !== customOnSuccess || $[14] !== finalId || $[15] !== queryClient || $[16] !== resourceId) {
1295
+ t8 = (data_0, ...t9) => {
1296
+ const args = t9;
1297
+ queryClient.setQueryData([resourceId, String(finalId)], data_0);
1137
1298
  queryClient.invalidateQueries({
1138
1299
  queryKey: [resourceId],
1139
- predicate: t11 => {
1300
+ predicate: t10 => {
1140
1301
  const {
1141
1302
  queryKey
1142
- } = t11;
1303
+ } = t10;
1143
1304
  return String(queryKey[1]) !== String(finalId);
1144
1305
  }
1145
1306
  });
@@ -1147,54 +1308,54 @@ function useResourceUpdate(resource, t0, t1) {
1147
1308
  return customOnSuccess(data_0, ...args);
1148
1309
  }
1149
1310
  };
1150
- $[16] = customOnSuccess;
1151
- $[17] = finalId;
1152
- $[18] = queryClient;
1153
- $[19] = resourceId;
1154
- $[20] = t9;
1311
+ $[13] = customOnSuccess;
1312
+ $[14] = finalId;
1313
+ $[15] = queryClient;
1314
+ $[16] = resourceId;
1315
+ $[17] = t8;
1155
1316
  } else {
1156
- t9 = $[20];
1317
+ t8 = $[17];
1157
1318
  }
1158
- let t10;
1159
- if ($[21] !== otherOptions || $[22] !== t8 || $[23] !== t9) {
1160
- t10 = {
1161
- mutationFn: t8,
1162
- onSuccess: t9,
1319
+ let t9;
1320
+ if ($[18] !== otherOptions || $[19] !== t7 || $[20] !== t8) {
1321
+ t9 = {
1322
+ mutationFn: t7,
1323
+ onSuccess: t8,
1163
1324
  ...otherOptions
1164
1325
  };
1165
- $[21] = otherOptions;
1166
- $[22] = t8;
1167
- $[23] = t9;
1168
- $[24] = t10;
1326
+ $[18] = otherOptions;
1327
+ $[19] = t7;
1328
+ $[20] = t8;
1329
+ $[21] = t9;
1169
1330
  } else {
1170
- t10 = $[24];
1331
+ t9 = $[21];
1171
1332
  }
1172
- const t11 = useMutation(t10);
1333
+ const t10 = useMutation(t9);
1173
1334
  let isPending;
1174
1335
  let mutate;
1175
1336
  let mutateAsync;
1176
1337
  let other;
1177
- if ($[25] !== t11) {
1338
+ if ($[22] !== t10) {
1178
1339
  ({
1179
1340
  mutate,
1180
1341
  mutateAsync,
1181
1342
  isPending,
1182
1343
  ...other
1183
- } = t11);
1184
- $[25] = t11;
1185
- $[26] = isPending;
1186
- $[27] = mutate;
1187
- $[28] = mutateAsync;
1188
- $[29] = other;
1344
+ } = t10);
1345
+ $[22] = t10;
1346
+ $[23] = isPending;
1347
+ $[24] = mutate;
1348
+ $[25] = mutateAsync;
1349
+ $[26] = other;
1189
1350
  } else {
1190
- isPending = $[26];
1191
- mutate = $[27];
1192
- mutateAsync = $[28];
1193
- other = $[29];
1351
+ isPending = $[23];
1352
+ mutate = $[24];
1353
+ mutateAsync = $[25];
1354
+ other = $[26];
1194
1355
  }
1195
- let t12;
1196
- if ($[30] !== isPending || $[31] !== mutate || $[32] !== mutateAsync || $[33] !== other) {
1197
- t12 = {
1356
+ let t11;
1357
+ if ($[27] !== isPending || $[28] !== mutate || $[29] !== mutateAsync || $[30] !== other) {
1358
+ t11 = {
1198
1359
  update: mutate,
1199
1360
  updateAsync: mutateAsync,
1200
1361
  loading: isPending,
@@ -1203,19 +1364,19 @@ function useResourceUpdate(resource, t0, t1) {
1203
1364
  isPending,
1204
1365
  ...other
1205
1366
  };
1206
- $[30] = isPending;
1207
- $[31] = mutate;
1208
- $[32] = mutateAsync;
1209
- $[33] = other;
1210
- $[34] = t12;
1367
+ $[27] = isPending;
1368
+ $[28] = mutate;
1369
+ $[29] = mutateAsync;
1370
+ $[30] = other;
1371
+ $[31] = t11;
1211
1372
  } else {
1212
- t12 = $[34];
1373
+ t11 = $[31];
1213
1374
  }
1214
- return t12;
1375
+ return t11;
1215
1376
  }
1216
1377
 
1217
1378
  function useResourceClone(t0, t1, t2) {
1218
- const $ = c(19);
1379
+ const $ = c(31);
1219
1380
  const resource = t0 === undefined ? null : t0;
1220
1381
  const id = t1 === undefined ? null : t1;
1221
1382
  let t3;
@@ -1227,62 +1388,119 @@ function useResourceClone(t0, t1, t2) {
1227
1388
  t3 = $[1];
1228
1389
  }
1229
1390
  const options = t3;
1230
- const providedResource = usePanneauResource(id !== null && !isObject(id) ? resource : null);
1231
- const contextResource = useResource();
1232
- const finalResource = providedResource || contextResource;
1233
- const finalId = providedResource !== null ? id : resource;
1234
- const api = useApi();
1391
+ const {
1392
+ resource: finalResource,
1393
+ id: finalId,
1394
+ options: finalOptions
1395
+ } = useResourceArguments(resource, id, options);
1235
1396
  let t4;
1236
- if ($[2] !== api || $[3] !== finalId || $[4] !== finalResource) {
1237
- t4 = t5 => {
1238
- const providedId = t5 === undefined ? null : t5;
1397
+ if ($[2] !== finalOptions) {
1398
+ t4 = finalOptions || {};
1399
+ $[2] = finalOptions;
1400
+ $[3] = t4;
1401
+ } else {
1402
+ t4 = $[3];
1403
+ }
1404
+ let otherOptions;
1405
+ let t5;
1406
+ if ($[4] !== t4) {
1407
+ ({
1408
+ onSuccess: t5,
1409
+ ...otherOptions
1410
+ } = t4);
1411
+ $[4] = t4;
1412
+ $[5] = otherOptions;
1413
+ $[6] = t5;
1414
+ } else {
1415
+ otherOptions = $[5];
1416
+ t5 = $[6];
1417
+ }
1418
+ const customOnSuccess = t5 === undefined ? null : t5;
1419
+ let t6;
1420
+ if ($[7] !== finalResource) {
1421
+ t6 = finalResource || {};
1422
+ $[7] = finalResource;
1423
+ $[8] = t6;
1424
+ } else {
1425
+ t6 = $[8];
1426
+ }
1427
+ const {
1428
+ id: t7
1429
+ } = t6;
1430
+ const resourceId = t7 === undefined ? null : t7;
1431
+ const api = useApi();
1432
+ const queryClient = useQueryClient();
1433
+ let t8;
1434
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
1435
+ t8 = t9 => {
1436
+ const providedId = t9 === undefined ? null : t9;
1239
1437
  return api.resources.clone(finalResource, providedId ?? finalId);
1240
1438
  };
1241
- $[2] = api;
1242
- $[3] = finalId;
1243
- $[4] = finalResource;
1244
- $[5] = t4;
1439
+ $[9] = api;
1440
+ $[10] = finalId;
1441
+ $[11] = finalResource;
1442
+ $[12] = t8;
1245
1443
  } else {
1246
- t4 = $[5];
1444
+ t8 = $[12];
1247
1445
  }
1248
- let t5;
1249
- if ($[6] !== options || $[7] !== t4) {
1250
- t5 = {
1251
- mutationFn: t4,
1252
- ...options
1446
+ let t9;
1447
+ if ($[13] !== customOnSuccess || $[14] !== queryClient || $[15] !== resourceId) {
1448
+ t9 = (data, variables, ...t10) => {
1449
+ const args = t10;
1450
+ queryClient.invalidateQueries({
1451
+ queryKey: [resourceId]
1452
+ });
1453
+ if (customOnSuccess !== null) {
1454
+ return customOnSuccess(data, variables, ...args);
1455
+ }
1253
1456
  };
1254
- $[6] = options;
1255
- $[7] = t4;
1256
- $[8] = t5;
1457
+ $[13] = customOnSuccess;
1458
+ $[14] = queryClient;
1459
+ $[15] = resourceId;
1460
+ $[16] = t9;
1257
1461
  } else {
1258
- t5 = $[8];
1462
+ t9 = $[16];
1463
+ }
1464
+ let t10;
1465
+ if ($[17] !== otherOptions || $[18] !== t8 || $[19] !== t9) {
1466
+ t10 = {
1467
+ mutationFn: t8,
1468
+ onSuccess: t9,
1469
+ ...otherOptions
1470
+ };
1471
+ $[17] = otherOptions;
1472
+ $[18] = t8;
1473
+ $[19] = t9;
1474
+ $[20] = t10;
1475
+ } else {
1476
+ t10 = $[20];
1259
1477
  }
1260
- const t6 = useMutation(t5);
1478
+ const t11 = useMutation(t10);
1261
1479
  let isPending;
1262
1480
  let mutate;
1263
1481
  let mutateAsync;
1264
1482
  let other;
1265
- if ($[9] !== t6) {
1483
+ if ($[21] !== t11) {
1266
1484
  ({
1267
1485
  mutate,
1268
1486
  mutateAsync,
1269
1487
  isPending,
1270
1488
  ...other
1271
- } = t6);
1272
- $[9] = t6;
1273
- $[10] = isPending;
1274
- $[11] = mutate;
1275
- $[12] = mutateAsync;
1276
- $[13] = other;
1489
+ } = t11);
1490
+ $[21] = t11;
1491
+ $[22] = isPending;
1492
+ $[23] = mutate;
1493
+ $[24] = mutateAsync;
1494
+ $[25] = other;
1277
1495
  } else {
1278
- isPending = $[10];
1279
- mutate = $[11];
1280
- mutateAsync = $[12];
1281
- other = $[13];
1496
+ isPending = $[22];
1497
+ mutate = $[23];
1498
+ mutateAsync = $[24];
1499
+ other = $[25];
1282
1500
  }
1283
- let t7;
1284
- if ($[14] !== isPending || $[15] !== mutate || $[16] !== mutateAsync || $[17] !== other) {
1285
- t7 = {
1501
+ let t12;
1502
+ if ($[26] !== isPending || $[27] !== mutate || $[28] !== mutateAsync || $[29] !== other) {
1503
+ t12 = {
1286
1504
  clone: mutate,
1287
1505
  cloneAsync: mutateAsync,
1288
1506
  loading: isPending,
@@ -1291,19 +1509,19 @@ function useResourceClone(t0, t1, t2) {
1291
1509
  isPending,
1292
1510
  ...other
1293
1511
  };
1294
- $[14] = isPending;
1295
- $[15] = mutate;
1296
- $[16] = mutateAsync;
1297
- $[17] = other;
1298
- $[18] = t7;
1512
+ $[26] = isPending;
1513
+ $[27] = mutate;
1514
+ $[28] = mutateAsync;
1515
+ $[29] = other;
1516
+ $[30] = t12;
1299
1517
  } else {
1300
- t7 = $[18];
1518
+ t12 = $[30];
1301
1519
  }
1302
- return t7;
1520
+ return t12;
1303
1521
  }
1304
1522
 
1305
1523
  function useResourceRestore(t0, t1, t2) {
1306
- const $ = c(19);
1524
+ const $ = c(31);
1307
1525
  const resource = t0 === undefined ? null : t0;
1308
1526
  const id = t1 === undefined ? null : t1;
1309
1527
  let t3;
@@ -1315,62 +1533,119 @@ function useResourceRestore(t0, t1, t2) {
1315
1533
  t3 = $[1];
1316
1534
  }
1317
1535
  const options = t3;
1318
- const providedResource = usePanneauResource(id !== null && !isObject(id) ? resource : null);
1319
- const contextResource = useResource();
1320
- const finalResource = providedResource || contextResource;
1321
- const finalId = providedResource !== null ? id : resource;
1322
- const api = useApi();
1536
+ const {
1537
+ resource: finalResource,
1538
+ id: finalId,
1539
+ options: finalOptions
1540
+ } = useResourceArguments(resource, id, options);
1323
1541
  let t4;
1324
- if ($[2] !== api || $[3] !== finalId || $[4] !== finalResource) {
1325
- t4 = t5 => {
1326
- const providedId = t5 === undefined ? null : t5;
1542
+ if ($[2] !== finalOptions) {
1543
+ t4 = finalOptions || {};
1544
+ $[2] = finalOptions;
1545
+ $[3] = t4;
1546
+ } else {
1547
+ t4 = $[3];
1548
+ }
1549
+ let otherOptions;
1550
+ let t5;
1551
+ if ($[4] !== t4) {
1552
+ ({
1553
+ onSuccess: t5,
1554
+ ...otherOptions
1555
+ } = t4);
1556
+ $[4] = t4;
1557
+ $[5] = otherOptions;
1558
+ $[6] = t5;
1559
+ } else {
1560
+ otherOptions = $[5];
1561
+ t5 = $[6];
1562
+ }
1563
+ const customOnSuccess = t5 === undefined ? null : t5;
1564
+ let t6;
1565
+ if ($[7] !== finalResource) {
1566
+ t6 = finalResource || {};
1567
+ $[7] = finalResource;
1568
+ $[8] = t6;
1569
+ } else {
1570
+ t6 = $[8];
1571
+ }
1572
+ const {
1573
+ id: t7
1574
+ } = t6;
1575
+ const resourceId = t7 === undefined ? null : t7;
1576
+ const api = useApi();
1577
+ const queryClient = useQueryClient();
1578
+ let t8;
1579
+ if ($[9] !== api || $[10] !== finalId || $[11] !== finalResource) {
1580
+ t8 = t9 => {
1581
+ const providedId = t9 === undefined ? null : t9;
1327
1582
  return api.resources.restore(finalResource, providedId ?? finalId);
1328
1583
  };
1329
- $[2] = api;
1330
- $[3] = finalId;
1331
- $[4] = finalResource;
1332
- $[5] = t4;
1584
+ $[9] = api;
1585
+ $[10] = finalId;
1586
+ $[11] = finalResource;
1587
+ $[12] = t8;
1333
1588
  } else {
1334
- t4 = $[5];
1589
+ t8 = $[12];
1335
1590
  }
1336
- let t5;
1337
- if ($[6] !== options || $[7] !== t4) {
1338
- t5 = {
1339
- mutationFn: t4,
1340
- ...options
1591
+ let t9;
1592
+ if ($[13] !== customOnSuccess || $[14] !== queryClient || $[15] !== resourceId) {
1593
+ t9 = (data, variables, ...t10) => {
1594
+ const args = t10;
1595
+ queryClient.invalidateQueries({
1596
+ queryKey: [resourceId]
1597
+ });
1598
+ if (customOnSuccess !== null) {
1599
+ return customOnSuccess(data, variables, ...args);
1600
+ }
1341
1601
  };
1342
- $[6] = options;
1343
- $[7] = t4;
1344
- $[8] = t5;
1602
+ $[13] = customOnSuccess;
1603
+ $[14] = queryClient;
1604
+ $[15] = resourceId;
1605
+ $[16] = t9;
1345
1606
  } else {
1346
- t5 = $[8];
1607
+ t9 = $[16];
1608
+ }
1609
+ let t10;
1610
+ if ($[17] !== otherOptions || $[18] !== t8 || $[19] !== t9) {
1611
+ t10 = {
1612
+ mutationFn: t8,
1613
+ onSuccess: t9,
1614
+ ...otherOptions
1615
+ };
1616
+ $[17] = otherOptions;
1617
+ $[18] = t8;
1618
+ $[19] = t9;
1619
+ $[20] = t10;
1620
+ } else {
1621
+ t10 = $[20];
1347
1622
  }
1348
- const t6 = useMutation(t5);
1623
+ const t11 = useMutation(t10);
1349
1624
  let isPending;
1350
1625
  let mutate;
1351
1626
  let mutateAsync;
1352
1627
  let other;
1353
- if ($[9] !== t6) {
1628
+ if ($[21] !== t11) {
1354
1629
  ({
1355
1630
  mutate,
1356
1631
  mutateAsync,
1357
1632
  isPending,
1358
1633
  ...other
1359
- } = t6);
1360
- $[9] = t6;
1361
- $[10] = isPending;
1362
- $[11] = mutate;
1363
- $[12] = mutateAsync;
1364
- $[13] = other;
1634
+ } = t11);
1635
+ $[21] = t11;
1636
+ $[22] = isPending;
1637
+ $[23] = mutate;
1638
+ $[24] = mutateAsync;
1639
+ $[25] = other;
1365
1640
  } else {
1366
- isPending = $[10];
1367
- mutate = $[11];
1368
- mutateAsync = $[12];
1369
- other = $[13];
1641
+ isPending = $[22];
1642
+ mutate = $[23];
1643
+ mutateAsync = $[24];
1644
+ other = $[25];
1370
1645
  }
1371
- let t7;
1372
- if ($[14] !== isPending || $[15] !== mutate || $[16] !== mutateAsync || $[17] !== other) {
1373
- t7 = {
1646
+ let t12;
1647
+ if ($[26] !== isPending || $[27] !== mutate || $[28] !== mutateAsync || $[29] !== other) {
1648
+ t12 = {
1374
1649
  restore: mutate,
1375
1650
  restoreAsync: mutateAsync,
1376
1651
  loading: isPending,
@@ -1379,15 +1654,15 @@ function useResourceRestore(t0, t1, t2) {
1379
1654
  isPending,
1380
1655
  ...other
1381
1656
  };
1382
- $[14] = isPending;
1383
- $[15] = mutate;
1384
- $[16] = mutateAsync;
1385
- $[17] = other;
1386
- $[18] = t7;
1657
+ $[26] = isPending;
1658
+ $[27] = mutate;
1659
+ $[28] = mutateAsync;
1660
+ $[29] = other;
1661
+ $[30] = t12;
1387
1662
  } else {
1388
- t7 = $[18];
1663
+ t12 = $[30];
1389
1664
  }
1390
- return t7;
1665
+ return t12;
1391
1666
  }
1392
1667
 
1393
1668
  const QueryContext = /*#__PURE__*/createContext(null);
@@ -1395,7 +1670,7 @@ function useQueryContext() {
1395
1670
  return use(QueryContext);
1396
1671
  }
1397
1672
  function QueryProvider(t0) {
1398
- const $ = c(7);
1673
+ const $ = c(10);
1399
1674
  const {
1400
1675
  config: t1,
1401
1676
  initialKey: t2,
@@ -1405,39 +1680,55 @@ function QueryProvider(t0) {
1405
1680
  const initialConfig = t1 === undefined ? null : t1;
1406
1681
  const initialKey = t2 === undefined ? null : t2;
1407
1682
  const initialData = t3 === undefined ? null : t3;
1408
- let client;
1683
+ let t4;
1409
1684
  if ($[0] !== initialConfig || $[1] !== initialData || $[2] !== initialKey) {
1410
- client = new QueryClient({
1411
- defaultOptions: {
1412
- queries: {
1413
- staleTime: Infinity
1414
- }
1415
- },
1416
- ...initialConfig
1417
- });
1418
- if (initialKey !== null && initialData !== null) {
1419
- client.setQueryData(initialKey, initialData);
1420
- }
1685
+ t4 = () => {
1686
+ const newClient = new QueryClient({
1687
+ defaultOptions: {
1688
+ queries: {
1689
+ staleTime: Infinity
1690
+ }
1691
+ },
1692
+ ...initialConfig
1693
+ });
1694
+ if (initialKey !== null && initialData !== null) {
1695
+ newClient.setQueryData(initialKey, initialData);
1696
+ }
1697
+ return newClient;
1698
+ };
1421
1699
  $[0] = initialConfig;
1422
1700
  $[1] = initialData;
1423
1701
  $[2] = initialKey;
1424
- $[3] = client;
1702
+ $[3] = t4;
1425
1703
  } else {
1426
- client = $[3];
1704
+ t4 = $[3];
1427
1705
  }
1428
- let t4;
1706
+ const [client] = useState(t4);
1707
+ let t5;
1429
1708
  if ($[4] !== children || $[5] !== client) {
1430
- t4 = /*#__PURE__*/jsx(QueryClientProvider, {
1709
+ t5 = /*#__PURE__*/jsx(QueryClientProvider, {
1431
1710
  client: client,
1432
1711
  children: children
1433
1712
  });
1434
1713
  $[4] = children;
1435
1714
  $[5] = client;
1436
- $[6] = t4;
1715
+ $[6] = t5;
1437
1716
  } else {
1438
- t4 = $[6];
1717
+ t5 = $[6];
1439
1718
  }
1440
- return t4;
1719
+ let t6;
1720
+ if ($[7] !== client || $[8] !== t5) {
1721
+ t6 = /*#__PURE__*/jsx(QueryContext, {
1722
+ value: client,
1723
+ children: t5
1724
+ });
1725
+ $[7] = client;
1726
+ $[8] = t5;
1727
+ $[9] = t6;
1728
+ } else {
1729
+ t6 = $[9];
1730
+ }
1731
+ return t6;
1441
1732
  }
1442
1733
 
1443
1734
  function DataProvider(t0) {