@dhis2/app-service-data 3.7.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/build/cjs/__tests__/integration.test.js +16 -10
  2. package/build/cjs/__tests__/mutations.test.js +8 -5
  3. package/build/cjs/engine/DataEngine.js +14 -12
  4. package/build/cjs/engine/helpers/resolveDynamicQuery.js +14 -11
  5. package/build/cjs/engine/helpers/resolveDynamicQuery.test.js +23 -14
  6. package/build/cjs/engine/helpers/validate.js +6 -4
  7. package/build/cjs/engine/helpers/validate.test.js +74 -15
  8. package/build/cjs/engine/types/FetchError.js +6 -5
  9. package/build/cjs/engine/types/InvalidQueryError.js +1 -1
  10. package/build/cjs/index.js +10 -10
  11. package/build/cjs/links/CustomDataLink.js +8 -6
  12. package/build/cjs/links/CustomDataLink.test.js +2 -2
  13. package/build/cjs/links/RestAPILink/fetchData.js +3 -2
  14. package/build/cjs/links/RestAPILink/fetchData.test.js +1 -1
  15. package/build/cjs/links/RestAPILink/metadataResources.js +1 -1
  16. package/build/cjs/links/RestAPILink/path.js +5 -1
  17. package/build/cjs/links/RestAPILink/queryToRequestOptions/multipartFormDataMatchers.js +29 -16
  18. package/build/cjs/links/RestAPILink/queryToRequestOptions/requestContentType.js +9 -6
  19. package/build/cjs/links/RestAPILink/queryToRequestOptions/requestContentType.test.js +2 -2
  20. package/build/cjs/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +51 -33
  21. package/build/cjs/links/RestAPILink/queryToRequestOptions/xWwwFormUrlencodedMatchers.js +6 -3
  22. package/build/cjs/links/RestAPILink/queryToRequestOptions.js +1 -1
  23. package/build/cjs/links/RestAPILink/queryToRequestOptions.test.js +56 -6
  24. package/build/cjs/links/RestAPILink/queryToResourcePath.js +14 -6
  25. package/build/cjs/links/RestAPILink/queryToResourcePath.test.js +16 -16
  26. package/build/cjs/links/RestAPILink/validateQuery.test.js +12 -12
  27. package/build/cjs/links/RestAPILink.js +4 -3
  28. package/build/cjs/react/components/CustomDataProvider.js +7 -6
  29. package/build/cjs/react/components/DataMutation.js +8 -7
  30. package/build/cjs/react/components/DataProvider.js +1 -1
  31. package/build/cjs/react/components/DataQuery.js +9 -8
  32. package/build/cjs/react/context/defaultContext.test.js +10 -2
  33. package/build/cjs/react/hooks/stableVariablesHash.js +1 -2
  34. package/build/cjs/react/hooks/stableVariablesHash.test.js +6 -6
  35. package/build/cjs/react/hooks/useDataMutation.js +7 -6
  36. package/build/cjs/react/hooks/useDataMutation.test.js +70 -43
  37. package/build/cjs/react/hooks/useDataQuery.js +13 -9
  38. package/build/cjs/react/hooks/useDataQuery.test.js +259 -162
  39. package/build/cjs/react/hooks/useQueryExecutor.js +11 -9
  40. package/build/cjs/react/hooks/useQueryExecutor.test.js +16 -12
  41. package/build/cjs/react/hooks/useStaticInput.js +7 -6
  42. package/build/cjs/react/hooks/useStaticInput.test.js +44 -25
  43. package/build/cjs/react/index.js +6 -6
  44. package/build/es/__tests__/integration.test.js +16 -10
  45. package/build/es/__tests__/mutations.test.js +8 -5
  46. package/build/es/engine/DataEngine.js +14 -12
  47. package/build/es/engine/helpers/resolveDynamicQuery.js +14 -11
  48. package/build/es/engine/helpers/resolveDynamicQuery.test.js +23 -14
  49. package/build/es/engine/helpers/validate.js +6 -4
  50. package/build/es/engine/helpers/validate.test.js +74 -15
  51. package/build/es/engine/types/FetchError.js +6 -5
  52. package/build/es/engine/types/InvalidQueryError.js +1 -1
  53. package/build/es/links/CustomDataLink.js +8 -6
  54. package/build/es/links/CustomDataLink.test.js +2 -2
  55. package/build/es/links/RestAPILink/fetchData.js +3 -2
  56. package/build/es/links/RestAPILink/fetchData.test.js +1 -1
  57. package/build/es/links/RestAPILink/path.js +5 -1
  58. package/build/es/links/RestAPILink/queryToRequestOptions/multipartFormDataMatchers.js +28 -15
  59. package/build/es/links/RestAPILink/queryToRequestOptions/requestContentType.js +8 -5
  60. package/build/es/links/RestAPILink/queryToRequestOptions/requestContentType.test.js +2 -2
  61. package/build/es/links/RestAPILink/queryToRequestOptions/textPlainMatchers.js +50 -32
  62. package/build/es/links/RestAPILink/queryToRequestOptions/xWwwFormUrlencodedMatchers.js +6 -3
  63. package/build/es/links/RestAPILink/queryToRequestOptions.js +1 -1
  64. package/build/es/links/RestAPILink/queryToRequestOptions.test.js +56 -6
  65. package/build/es/links/RestAPILink/queryToResourcePath.js +14 -6
  66. package/build/es/links/RestAPILink/queryToResourcePath.test.js +16 -16
  67. package/build/es/links/RestAPILink/validateQuery.test.js +12 -12
  68. package/build/es/links/RestAPILink.js +4 -3
  69. package/build/es/react/components/CustomDataProvider.js +7 -6
  70. package/build/es/react/components/DataMutation.js +8 -7
  71. package/build/es/react/components/DataQuery.js +9 -8
  72. package/build/es/react/context/defaultContext.test.js +10 -2
  73. package/build/es/react/hooks/stableVariablesHash.js +1 -2
  74. package/build/es/react/hooks/stableVariablesHash.test.js +6 -6
  75. package/build/es/react/hooks/useDataMutation.js +7 -6
  76. package/build/es/react/hooks/useDataMutation.test.js +70 -43
  77. package/build/es/react/hooks/useDataQuery.js +13 -9
  78. package/build/es/react/hooks/useDataQuery.test.js +259 -162
  79. package/build/es/react/hooks/useQueryExecutor.js +11 -9
  80. package/build/es/react/hooks/useQueryExecutor.test.js +16 -12
  81. package/build/es/react/hooks/useStaticInput.js +7 -6
  82. package/build/es/react/hooks/useStaticInput.test.js +44 -25
  83. package/package.json +2 -2
@@ -24,11 +24,14 @@ describe('useDataQuery', () => {
24
24
  answer: 42
25
25
  };
26
26
 
27
- const wrapper = ({
28
- children
29
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
30
- data: data
31
- }, children);
27
+ const wrapper = (_ref) => {
28
+ let {
29
+ children
30
+ } = _ref;
31
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
32
+ data: data
33
+ }, children);
34
+ };
32
35
 
33
36
  const onComplete = jest.fn();
34
37
  const onError = jest.fn();
@@ -72,11 +75,14 @@ describe('useDataQuery', () => {
72
75
  }
73
76
  };
74
77
 
75
- const wrapper = ({
76
- children
77
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
78
- data: data
79
- }, children);
78
+ const wrapper = (_ref2) => {
79
+ let {
80
+ children
81
+ } = _ref2;
82
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
83
+ data: data
84
+ }, children);
85
+ };
80
86
 
81
87
  const onComplete = jest.fn();
82
88
  const onError = jest.fn();
@@ -110,14 +116,19 @@ describe('useDataQuery', () => {
110
116
  const query = {
111
117
  x: {
112
118
  resource: 'answer',
113
- id: ({
114
- id
115
- }) => id
119
+ id: (_ref3) => {
120
+ let {
121
+ id
122
+ } = _ref3;
123
+ return id;
124
+ }
116
125
  }
117
126
  };
118
- const mockSpy = jest.fn((_, {
119
- id
120
- }) => {
127
+ const mockSpy = jest.fn((_, _ref4) => {
128
+ let {
129
+ id
130
+ } = _ref4;
131
+
121
132
  switch (id) {
122
133
  case one:
123
134
  return Promise.resolve(resultOne);
@@ -130,11 +141,14 @@ describe('useDataQuery', () => {
130
141
  answer: mockSpy
131
142
  };
132
143
 
133
- const wrapper = ({
134
- children
135
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
136
- data: data
137
- }, children);
144
+ const wrapper = (_ref5) => {
145
+ let {
146
+ children
147
+ } = _ref5;
148
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
149
+ data: data
150
+ }, children);
151
+ };
138
152
 
139
153
  const initialProps = {
140
154
  query,
@@ -194,11 +208,14 @@ describe('useDataQuery', () => {
194
208
  answer: mockSpy
195
209
  };
196
210
 
197
- const wrapper = ({
198
- children
199
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
200
- data: data
201
- }, children);
211
+ const wrapper = (_ref6) => {
212
+ let {
213
+ children
214
+ } = _ref6;
215
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
216
+ data: data
217
+ }, children);
218
+ };
202
219
 
203
220
  const {
204
221
  result,
@@ -242,12 +259,15 @@ describe('useDataQuery', () => {
242
259
  }
243
260
  };
244
261
 
245
- const wrapper = ({
246
- children
247
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
248
- data: data,
249
- queryClientOptions: queryClientOptions
250
- }, children);
262
+ const wrapper = (_ref7) => {
263
+ let {
264
+ children
265
+ } = _ref7;
266
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
267
+ data: data,
268
+ queryClientOptions: queryClientOptions
269
+ }, children);
270
+ };
251
271
 
252
272
  const {
253
273
  result,
@@ -316,11 +336,14 @@ describe('useDataQuery', () => {
316
336
  }
317
337
  };
318
338
 
319
- const wrapper = ({
320
- children
321
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
322
- data: data
323
- }, children);
339
+ const wrapper = (_ref8) => {
340
+ let {
341
+ children
342
+ } = _ref8;
343
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
344
+ data: data
345
+ }, children);
346
+ };
324
347
 
325
348
  const {
326
349
  result,
@@ -362,11 +385,14 @@ describe('useDataQuery', () => {
362
385
  answer: 42
363
386
  };
364
387
 
365
- const wrapper = ({
366
- children
367
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
368
- data: data
369
- }, children);
388
+ const wrapper = (_ref9) => {
389
+ let {
390
+ children
391
+ } = _ref9;
392
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
393
+ data: data
394
+ }, children);
395
+ };
370
396
 
371
397
  const {
372
398
  result,
@@ -401,11 +427,14 @@ describe('useDataQuery', () => {
401
427
  opposite: 24
402
428
  };
403
429
 
404
- const wrapper = ({
405
- children
406
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
407
- data: data
408
- }, children);
430
+ const wrapper = (_ref10) => {
431
+ let {
432
+ children
433
+ } = _ref10;
434
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
435
+ data: data
436
+ }, children);
437
+ };
409
438
 
410
439
  const {
411
440
  result,
@@ -442,11 +471,14 @@ describe('useDataQuery', () => {
442
471
  }
443
472
  };
444
473
 
445
- const wrapper = ({
446
- children
447
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
448
- data: data
449
- }, children);
474
+ const wrapper = (_ref11) => {
475
+ let {
476
+ children
477
+ } = _ref11;
478
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
479
+ data: data
480
+ }, children);
481
+ };
450
482
 
451
483
  const {
452
484
  result,
@@ -482,11 +514,14 @@ describe('useDataQuery', () => {
482
514
  opposite: 24
483
515
  };
484
516
 
485
- const wrapper = ({
486
- children
487
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
488
- data: data
489
- }, children);
517
+ const wrapper = (_ref12) => {
518
+ let {
519
+ children
520
+ } = _ref12;
521
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
522
+ data: data
523
+ }, children);
524
+ };
490
525
 
491
526
  const {
492
527
  result,
@@ -522,11 +557,14 @@ describe('useDataQuery', () => {
522
557
  }
523
558
  };
524
559
 
525
- const wrapper = ({
526
- children
527
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
528
- data: data
529
- }, children);
560
+ const wrapper = (_ref13) => {
561
+ let {
562
+ children
563
+ } = _ref13;
564
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
565
+ data: data
566
+ }, children);
567
+ };
530
568
 
531
569
  const {
532
570
  result,
@@ -580,17 +618,23 @@ describe('useDataQuery', () => {
580
618
  const query = {
581
619
  x: {
582
620
  resource: 'answer',
583
- id: ({
584
- id
585
- }) => id
621
+ id: (_ref14) => {
622
+ let {
623
+ id
624
+ } = _ref14;
625
+ return id;
626
+ }
586
627
  }
587
628
  };
588
629
 
589
- const wrapper = ({
590
- children
591
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
592
- data: data
593
- }, children);
630
+ const wrapper = (_ref15) => {
631
+ let {
632
+ children
633
+ } = _ref15;
634
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
635
+ data: data
636
+ }, children);
637
+ };
594
638
 
595
639
  const {
596
640
  result,
@@ -631,17 +675,23 @@ describe('useDataQuery', () => {
631
675
  const query = {
632
676
  x: {
633
677
  resource: 'answer',
634
- id: ({
635
- id
636
- }) => id
678
+ id: (_ref16) => {
679
+ let {
680
+ id
681
+ } = _ref16;
682
+ return id;
683
+ }
637
684
  }
638
685
  };
639
686
 
640
- const wrapper = ({
641
- children
642
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
643
- data: data
644
- }, children);
687
+ const wrapper = (_ref17) => {
688
+ let {
689
+ children
690
+ } = _ref17;
691
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
692
+ data: data
693
+ }, children);
694
+ };
645
695
 
646
696
  const {
647
697
  result,
@@ -681,11 +731,14 @@ describe('useDataQuery', () => {
681
731
  }
682
732
  };
683
733
 
684
- const wrapper = ({
685
- children
686
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
687
- data: data
688
- }, children);
734
+ const wrapper = (_ref18) => {
735
+ let {
736
+ children
737
+ } = _ref18;
738
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
739
+ data: data
740
+ }, children);
741
+ };
689
742
 
690
743
  const {
691
744
  result,
@@ -721,11 +774,14 @@ describe('useDataQuery', () => {
721
774
  }
722
775
  };
723
776
 
724
- const wrapper = ({
725
- children
726
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
727
- data: data
728
- }, children);
777
+ const wrapper = (_ref19) => {
778
+ let {
779
+ children
780
+ } = _ref19;
781
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
782
+ data: data
783
+ }, children);
784
+ };
729
785
 
730
786
  const {
731
787
  result,
@@ -788,11 +844,14 @@ describe('useDataQuery', () => {
788
844
  answer: mockSpy
789
845
  };
790
846
 
791
- const wrapper = ({
792
- children
793
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
794
- data: data
795
- }, children);
847
+ const wrapper = (_ref20) => {
848
+ let {
849
+ children
850
+ } = _ref20;
851
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
852
+ data: data
853
+ }, children);
854
+ };
796
855
 
797
856
  const {
798
857
  result,
@@ -834,11 +893,14 @@ describe('useDataQuery', () => {
834
893
  answer: 42
835
894
  };
836
895
 
837
- const wrapper = ({
838
- children
839
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
840
- data: data
841
- }, children);
896
+ const wrapper = (_ref21) => {
897
+ let {
898
+ children
899
+ } = _ref21;
900
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
901
+ data: data
902
+ }, children);
903
+ };
842
904
 
843
905
  const onComplete = jest.fn();
844
906
  const onError = jest.fn();
@@ -881,11 +943,14 @@ describe('useDataQuery', () => {
881
943
  }
882
944
  };
883
945
 
884
- const wrapper = ({
885
- children
886
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
887
- data: data
888
- }, children);
946
+ const wrapper = (_ref22) => {
947
+ let {
948
+ children
949
+ } = _ref22;
950
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
951
+ data: data
952
+ }, children);
953
+ };
889
954
 
890
955
  const onComplete = jest.fn();
891
956
  const onError = jest.fn();
@@ -918,15 +983,18 @@ describe('useDataQuery', () => {
918
983
  const query = {
919
984
  x: {
920
985
  resource: 'answer',
921
- params: ({
922
- one,
923
- two,
924
- three
925
- }) => ({
926
- one,
927
- two,
928
- three
929
- })
986
+ params: (_ref23) => {
987
+ let {
988
+ one,
989
+ two,
990
+ three
991
+ } = _ref23;
992
+ return {
993
+ one,
994
+ two,
995
+ three
996
+ };
997
+ }
930
998
  }
931
999
  };
932
1000
  const spy = jest.fn(() => 42);
@@ -934,11 +1002,14 @@ describe('useDataQuery', () => {
934
1002
  answer: spy
935
1003
  };
936
1004
 
937
- const wrapper = ({
938
- children
939
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
940
- data: data
941
- }, children);
1005
+ const wrapper = (_ref24) => {
1006
+ let {
1007
+ children
1008
+ } = _ref24;
1009
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1010
+ data: data
1011
+ }, children);
1012
+ };
942
1013
 
943
1014
  const {
944
1015
  result,
@@ -980,11 +1051,14 @@ describe('useDataQuery', () => {
980
1051
  answer: 42
981
1052
  };
982
1053
 
983
- const wrapper = ({
984
- children
985
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
986
- data: data
987
- }, children);
1054
+ const wrapper = (_ref25) => {
1055
+ let {
1056
+ children
1057
+ } = _ref25;
1058
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1059
+ data: data
1060
+ }, children);
1061
+ };
988
1062
 
989
1063
  const {
990
1064
  result,
@@ -1021,11 +1095,14 @@ describe('useDataQuery', () => {
1021
1095
  answer: 42
1022
1096
  };
1023
1097
 
1024
- const wrapper = ({
1025
- children
1026
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1027
- data: data
1028
- }, children);
1098
+ const wrapper = (_ref26) => {
1099
+ let {
1100
+ children
1101
+ } = _ref26;
1102
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1103
+ data: data
1104
+ }, children);
1105
+ };
1029
1106
 
1030
1107
  const {
1031
1108
  result,
@@ -1065,11 +1142,14 @@ describe('useDataQuery', () => {
1065
1142
  }
1066
1143
  };
1067
1144
 
1068
- const wrapper = ({
1069
- children
1070
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1071
- data: data
1072
- }, children);
1145
+ const wrapper = (_ref27) => {
1146
+ let {
1147
+ children
1148
+ } = _ref27;
1149
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1150
+ data: data
1151
+ }, children);
1152
+ };
1073
1153
 
1074
1154
  const {
1075
1155
  result,
@@ -1103,11 +1183,14 @@ describe('useDataQuery', () => {
1103
1183
  }
1104
1184
  };
1105
1185
 
1106
- const wrapper = ({
1107
- children
1108
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1109
- data: data
1110
- }, children);
1186
+ const wrapper = (_ref28) => {
1187
+ let {
1188
+ children
1189
+ } = _ref28;
1190
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1191
+ data: data
1192
+ }, children);
1193
+ };
1111
1194
 
1112
1195
  const {
1113
1196
  result,
@@ -1136,14 +1219,19 @@ describe('useDataQuery', () => {
1136
1219
  const query = {
1137
1220
  x: {
1138
1221
  resource: 'answer',
1139
- id: ({
1140
- id
1141
- }) => id
1222
+ id: (_ref29) => {
1223
+ let {
1224
+ id
1225
+ } = _ref29;
1226
+ return id;
1227
+ }
1142
1228
  }
1143
1229
  };
1144
- const mockSpy = jest.fn((_, {
1145
- id
1146
- }) => {
1230
+ const mockSpy = jest.fn((_, _ref30) => {
1231
+ let {
1232
+ id
1233
+ } = _ref30;
1234
+
1147
1235
  switch (id) {
1148
1236
  case one:
1149
1237
  return Promise.resolve(resultOne);
@@ -1156,11 +1244,14 @@ describe('useDataQuery', () => {
1156
1244
  answer: mockSpy
1157
1245
  };
1158
1246
 
1159
- const wrapper = ({
1160
- children
1161
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1162
- data: data
1163
- }, children);
1247
+ const wrapper = (_ref31) => {
1248
+ let {
1249
+ children
1250
+ } = _ref31;
1251
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1252
+ data: data
1253
+ }, children);
1254
+ };
1164
1255
 
1165
1256
  const initialProps = {
1166
1257
  query,
@@ -1209,15 +1300,18 @@ describe('useDataQuery', () => {
1209
1300
  const query = {
1210
1301
  x: {
1211
1302
  resource: 'answer',
1212
- params: ({
1213
- one,
1214
- two,
1215
- three
1216
- }) => ({
1217
- one,
1218
- two,
1219
- three
1220
- })
1303
+ params: (_ref32) => {
1304
+ let {
1305
+ one,
1306
+ two,
1307
+ three
1308
+ } = _ref32;
1309
+ return {
1310
+ one,
1311
+ two,
1312
+ three
1313
+ };
1314
+ }
1221
1315
  }
1222
1316
  };
1223
1317
  const mockSpy = jest.fn(() => Promise.resolve(42));
@@ -1225,11 +1319,14 @@ describe('useDataQuery', () => {
1225
1319
  answer: mockSpy
1226
1320
  };
1227
1321
 
1228
- const wrapper = ({
1229
- children
1230
- }) => /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1231
- data: data
1232
- }, children);
1322
+ const wrapper = (_ref33) => {
1323
+ let {
1324
+ children
1325
+ } = _ref33;
1326
+ return /*#__PURE__*/React.createElement(_CustomDataProvider.CustomDataProvider, {
1327
+ data: data
1328
+ }, children);
1329
+ };
1233
1330
 
1234
1331
  const {
1235
1332
  result,
@@ -11,14 +11,15 @@ var _engine = require("../../engine");
11
11
 
12
12
  var _useStaticInput = require("./useStaticInput");
13
13
 
14
- const useQueryExecutor = ({
15
- execute,
16
- variables: initialVariables,
17
- singular,
18
- immediate,
19
- onComplete,
20
- onError
21
- }) => {
14
+ const useQueryExecutor = (_ref) => {
15
+ let {
16
+ execute,
17
+ variables: initialVariables,
18
+ singular,
19
+ immediate,
20
+ onComplete,
21
+ onError
22
+ } = _ref;
22
23
  const [theExecute] = (0, _useStaticInput.useStaticInput)(execute);
23
24
  const [state, setState] = (0, _react.useState)({
24
25
  called: !!immediate,
@@ -41,7 +42,8 @@ const useQueryExecutor = ({
41
42
  })
42
43
  }));
43
44
  }, [abort]);
44
- const refetch = (0, _react.useCallback)((newVariables = {}) => {
45
+ const refetch = (0, _react.useCallback)(function () {
46
+ let newVariables = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
45
47
  setState(state => !state.called || !state.loading ? {
46
48
  called: true,
47
49
  loading: true