quetch 0.11.1 → 0.11.2

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.
@@ -11,12 +11,9 @@ export function fetchExternal(fetch = getGlobal().fetch) {
11
11
  console.error("Could not find a global `fetch` function");
12
12
  }
13
13
  return async (request, _) => {
14
+ let response;
14
15
  try {
15
- const response = await fetch(request);
16
- if (!response.ok) {
17
- throw new RequestError(response.statusText, response.status, undefined, request, response);
18
- }
19
- return response;
16
+ response = await fetch(request);
20
17
  }
21
18
  catch (error) {
22
19
  if (error instanceof Error) {
@@ -24,6 +21,10 @@ export function fetchExternal(fetch = getGlobal().fetch) {
24
21
  }
25
22
  throw new RequestError(String(error), 500, undefined, request);
26
23
  }
24
+ if (!response.ok) {
25
+ throw new RequestError(response.statusText, response.status, undefined, request, response);
26
+ }
27
+ return response;
27
28
  };
28
29
  }
29
30
  //# sourceMappingURL=fetchExternal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchExternal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchExternal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAK,GAAG,SAAS,EAAE,CAAC,KAAK;IAEzB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC;QACpD,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,YAAY,CACpB,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,MAAM,EACf,SAAS,EACT,OAAO,EACP,QAAQ,CACT,CAAC;YACJ,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACjE,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"fetchExternal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchExternal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAK,GAAG,SAAS,EAAE,CAAC,KAAK;IAEzB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC;QACpD,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;QAC1B,IAAI,QAAQ,CAAC;QACb,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,MAAM,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,YAAY,CACpB,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,MAAM,EACf,SAAS,EACT,OAAO,EACP,QAAQ,CACT,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
package/doc/README.md CHANGED
@@ -103,7 +103,7 @@ Aggregation function.
103
103
 
104
104
  #### Defined in
105
105
 
106
- [lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/AggregateFunction.ts#L4)
106
+ [lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/AggregateFunction.ts#L4)
107
107
 
108
108
  ___
109
109
 
@@ -113,7 +113,7 @@ ___
113
113
 
114
114
  #### Defined in
115
115
 
116
- [lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/AggregateFunctionOperator.ts#L3)
116
+ [lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/6055b33/lib/types/AggregateFunctionOperator.ts#L3)
117
117
 
118
118
  ___
119
119
 
@@ -123,7 +123,7 @@ ___
123
123
 
124
124
  #### Defined in
125
125
 
126
- [lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Any.ts#L1)
126
+ [lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Any.ts#L1)
127
127
 
128
128
  ___
129
129
 
@@ -139,7 +139,7 @@ ___
139
139
 
140
140
  #### Defined in
141
141
 
142
- [lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Context.ts#L1)
142
+ [lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Context.ts#L1)
143
143
 
144
144
  ___
145
145
 
@@ -155,7 +155,7 @@ ___
155
155
 
156
156
  #### Defined in
157
157
 
158
- [lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/CustomFieldAggregateMap.ts#L3)
158
+ [lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/6055b33/lib/types/CustomFieldAggregateMap.ts#L3)
159
159
 
160
160
  ___
161
161
 
@@ -171,7 +171,7 @@ ___
171
171
 
172
172
  #### Defined in
173
173
 
174
- [lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/CustomFieldMap.ts#L3)
174
+ [lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/6055b33/lib/types/CustomFieldMap.ts#L3)
175
175
 
176
176
  ___
177
177
 
@@ -187,7 +187,7 @@ ___
187
187
 
188
188
  #### Defined in
189
189
 
190
- [lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FieldFunction.ts#L4)
190
+ [lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FieldFunction.ts#L4)
191
191
 
192
192
  ___
193
193
 
@@ -212,7 +212,7 @@ Applies a custom field transform function.
212
212
 
213
213
  #### Defined in
214
214
 
215
- [lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FieldFunctionCustom.ts#L4)
215
+ [lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FieldFunctionCustom.ts#L4)
216
216
 
217
217
  ___
218
218
 
@@ -238,7 +238,7 @@ Formats the date found in a given field, which can be an ISO string date or a ti
238
238
 
239
239
  #### Defined in
240
240
 
241
- [lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FieldFunctionFormatDate.ts#L6)
241
+ [lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FieldFunctionFormatDate.ts#L6)
242
242
 
243
243
  ___
244
244
 
@@ -256,7 +256,7 @@ Return types of custom field functions.
256
256
 
257
257
  #### Defined in
258
258
 
259
- [lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FieldFunctionReturn.ts#L4)
259
+ [lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FieldFunctionReturn.ts#L4)
260
260
 
261
261
  ___
262
262
 
@@ -274,7 +274,7 @@ Describes a predicate for filtering items.
274
274
 
275
275
  #### Defined in
276
276
 
277
- [lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Filter.ts#L15)
277
+ [lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Filter.ts#L15)
278
278
 
279
279
  ___
280
280
 
@@ -301,7 +301,7 @@ Checks if a given array field matches a given array value according to a given o
301
301
 
302
302
  #### Defined in
303
303
 
304
- [lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterArray.ts#L7)
304
+ [lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterArray.ts#L7)
305
305
 
306
306
  ___
307
307
 
@@ -327,7 +327,7 @@ Checks if a given boolean field is `true` or `false`.
327
327
 
328
328
  #### Defined in
329
329
 
330
- [lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterBoolean.ts#L6)
330
+ [lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterBoolean.ts#L6)
331
331
 
332
332
  ___
333
333
 
@@ -355,7 +355,7 @@ If `deep` is `true`, also captures all the descendants.
355
355
 
356
356
  #### Defined in
357
357
 
358
- [lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterChildren.ts#L10)
358
+ [lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterChildren.ts#L10)
359
359
 
360
360
  ___
361
361
 
@@ -380,7 +380,7 @@ Custom filter where `value(item)` returns `true` for matching items.
380
380
 
381
381
  #### Defined in
382
382
 
383
- [lib/types/FilterCustom.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterCustom.ts#L4)
383
+ [lib/types/FilterCustom.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterCustom.ts#L4)
384
384
 
385
385
  ___
386
386
 
@@ -405,7 +405,7 @@ Checks if a given field exists.
405
405
 
406
406
  #### Defined in
407
407
 
408
- [lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterField.ts#L4)
408
+ [lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterField.ts#L4)
409
409
 
410
410
  ___
411
411
 
@@ -423,7 +423,7 @@ Joins a list of filters with a specific boolean operator.
423
423
 
424
424
  #### Defined in
425
425
 
426
- [lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterGroup.ts#L6)
426
+ [lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterGroup.ts#L6)
427
427
 
428
428
  ___
429
429
 
@@ -442,7 +442,7 @@ Returns object type with field extending the provided `P` type.
442
442
 
443
443
  #### Defined in
444
444
 
445
- [lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterKeys.ts#L4)
445
+ [lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterKeys.ts#L4)
446
446
 
447
447
  ___
448
448
 
@@ -468,7 +468,7 @@ Checks if a given number field matches a given number value according to a given
468
468
 
469
469
  #### Defined in
470
470
 
471
- [lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterNumber.ts#L6)
471
+ [lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterNumber.ts#L6)
472
472
 
473
473
  ___
474
474
 
@@ -478,7 +478,7 @@ ___
478
478
 
479
479
  #### Defined in
480
480
 
481
- [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterOperator.ts#L3)
481
+ [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterOperator.ts#L3)
482
482
 
483
483
  ___
484
484
 
@@ -504,7 +504,7 @@ Checks if a given string field matches a given string value according to a given
504
504
 
505
505
  #### Defined in
506
506
 
507
- [lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterString.ts#L6)
507
+ [lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterString.ts#L6)
508
508
 
509
509
  ___
510
510
 
@@ -530,7 +530,7 @@ Checks if a given string field has any of the provided values.
530
530
 
531
531
  #### Defined in
532
532
 
533
- [lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterStringIntersect.ts#L6)
533
+ [lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterStringIntersect.ts#L6)
534
534
 
535
535
  ___
536
536
 
@@ -560,7 +560,7 @@ Checks if a given string field matches a given regular expression.
560
560
 
561
561
  #### Defined in
562
562
 
563
- [lib/types/FilterStringMatch.ts:8](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/FilterStringMatch.ts#L8)
563
+ [lib/types/FilterStringMatch.ts:8](https://github.com/nevoland/quetch/blob/6055b33/lib/types/FilterStringMatch.ts#L8)
564
564
 
565
565
  ___
566
566
 
@@ -580,7 +580,7 @@ Returns the type of the property at the specified `K` key.
580
580
 
581
581
  #### Defined in
582
582
 
583
- [lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Get.ts#L4)
583
+ [lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Get.ts#L4)
584
584
 
585
585
  ___
586
586
 
@@ -598,7 +598,7 @@ Specifies how items should be grouped.
598
598
 
599
599
  #### Defined in
600
600
 
601
- [lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Group.ts#L4)
601
+ [lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Group.ts#L4)
602
602
 
603
603
  ___
604
604
 
@@ -634,7 +634,7 @@ Handles an `input` query and returns an `output` promise, eventually using the `
634
634
 
635
635
  #### Defined in
636
636
 
637
- [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Handler.ts#L6)
637
+ [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Handler.ts#L6)
638
638
 
639
639
  ___
640
640
 
@@ -650,7 +650,7 @@ ___
650
650
 
651
651
  #### Defined in
652
652
 
653
- [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Immutable.ts#L1)
653
+ [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Immutable.ts#L1)
654
654
 
655
655
  ___
656
656
 
@@ -669,7 +669,7 @@ Injects the custom fields into the entity type.
669
669
 
670
670
  #### Defined in
671
671
 
672
- [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/InjectCustomFields.ts#L8)
672
+ [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/6055b33/lib/types/InjectCustomFields.ts#L8)
673
673
 
674
674
  ___
675
675
 
@@ -688,7 +688,7 @@ Returns the inferred item type of an array, or an alternative type if it is some
688
688
 
689
689
  #### Defined in
690
690
 
691
- [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Item.ts#L4)
691
+ [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Item.ts#L4)
692
692
 
693
693
  ___
694
694
 
@@ -698,7 +698,7 @@ ___
698
698
 
699
699
  #### Defined in
700
700
 
701
- [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Key.ts#L1)
701
+ [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Key.ts#L1)
702
702
 
703
703
  ___
704
704
 
@@ -714,7 +714,7 @@ ___
714
714
 
715
715
  #### Defined in
716
716
 
717
- [lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Mutable.ts#L1)
717
+ [lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Mutable.ts#L1)
718
718
 
719
719
  ___
720
720
 
@@ -747,7 +747,7 @@ Handles an `input` query and returns an `output` promise.
747
747
 
748
748
  #### Defined in
749
749
 
750
- [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/NextHandler.ts#L4)
750
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/NextHandler.ts#L4)
751
751
 
752
752
  ___
753
753
 
@@ -765,7 +765,7 @@ Order item.
765
765
 
766
766
  #### Defined in
767
767
 
768
- [lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Order.ts#L4)
768
+ [lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Order.ts#L4)
769
769
 
770
770
  ___
771
771
 
@@ -775,7 +775,7 @@ ___
775
775
 
776
776
  #### Defined in
777
777
 
778
- [lib/types/Parameters.ts:1](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Parameters.ts#L1)
778
+ [lib/types/Parameters.ts:1](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Parameters.ts#L1)
779
779
 
780
780
  ___
781
781
 
@@ -793,7 +793,7 @@ Query that fetches or mutates an entity.
793
793
 
794
794
  #### Defined in
795
795
 
796
- [lib/types/Query.ts:14](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Query.ts#L14)
796
+ [lib/types/Query.ts:14](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Query.ts#L14)
797
797
 
798
798
  ___
799
799
 
@@ -822,7 +822,7 @@ Query for computing an aggregated value.
822
822
 
823
823
  #### Defined in
824
824
 
825
- [lib/types/QueryAggregate.ts:10](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryAggregate.ts#L10)
825
+ [lib/types/QueryAggregate.ts:10](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryAggregate.ts#L10)
826
826
 
827
827
  ___
828
828
 
@@ -851,7 +851,7 @@ Query for creating an item.
851
851
 
852
852
  #### Defined in
853
853
 
854
- [lib/types/QueryCreate.ts:8](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryCreate.ts#L8)
854
+ [lib/types/QueryCreate.ts:8](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryCreate.ts#L8)
855
855
 
856
856
  ___
857
857
 
@@ -880,7 +880,7 @@ Query for creating multiple items.
880
880
 
881
881
  #### Defined in
882
882
 
883
- [lib/types/QueryCreateMultiple.ts:8](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryCreateMultiple.ts#L8)
883
+ [lib/types/QueryCreateMultiple.ts:8](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryCreateMultiple.ts#L8)
884
884
 
885
885
  ___
886
886
 
@@ -909,7 +909,7 @@ Query for deleting an item.
909
909
 
910
910
  #### Defined in
911
911
 
912
- [lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryDelete.ts#L9)
912
+ [lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryDelete.ts#L9)
913
913
 
914
914
  ___
915
915
 
@@ -938,7 +938,7 @@ Query for deleting multiple items.
938
938
 
939
939
  #### Defined in
940
940
 
941
- [lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryDeleteMultiple.ts#L9)
941
+ [lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryDeleteMultiple.ts#L9)
942
942
 
943
943
  ___
944
944
 
@@ -950,7 +950,7 @@ Available query methods.
950
950
 
951
951
  #### Defined in
952
952
 
953
- [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryMethod.ts#L6)
953
+ [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryMethod.ts#L6)
954
954
 
955
955
  ___
956
956
 
@@ -984,7 +984,7 @@ Query for reading a single item.
984
984
 
985
985
  #### Defined in
986
986
 
987
- [lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryRead.ts#L10)
987
+ [lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryRead.ts#L10)
988
988
 
989
989
  ___
990
990
 
@@ -1018,7 +1018,7 @@ Query for getting a list of items.
1018
1018
 
1019
1019
  #### Defined in
1020
1020
 
1021
- [lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryReadMultiple.ts#L11)
1021
+ [lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryReadMultiple.ts#L11)
1022
1022
 
1023
1023
  ___
1024
1024
 
@@ -1045,7 +1045,7 @@ Settings to use when doing a query.
1045
1045
 
1046
1046
  #### Defined in
1047
1047
 
1048
- [lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QuerySettings.ts#L8)
1048
+ [lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QuerySettings.ts#L8)
1049
1049
 
1050
1050
  ___
1051
1051
 
@@ -1078,7 +1078,7 @@ Query for updating an item.
1078
1078
 
1079
1079
  #### Defined in
1080
1080
 
1081
- [lib/types/QueryUpdate.ts:9](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryUpdate.ts#L9)
1081
+ [lib/types/QueryUpdate.ts:9](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryUpdate.ts#L9)
1082
1082
 
1083
1083
  ___
1084
1084
 
@@ -1111,7 +1111,7 @@ Query for updating multiple items.
1111
1111
 
1112
1112
  #### Defined in
1113
1113
 
1114
- [lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/QueryUpdateMultiple.ts#L10)
1114
+ [lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/6055b33/lib/types/QueryUpdateMultiple.ts#L10)
1115
1115
 
1116
1116
  ___
1117
1117
 
@@ -1128,7 +1128,7 @@ ___
1128
1128
 
1129
1129
  #### Defined in
1130
1130
 
1131
- [lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Result.ts#L20)
1131
+ [lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Result.ts#L20)
1132
1132
 
1133
1133
  ___
1134
1134
 
@@ -1153,7 +1153,7 @@ ___
1153
1153
 
1154
1154
  #### Defined in
1155
1155
 
1156
- [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/Store.ts#L2)
1156
+ [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/6055b33/lib/types/Store.ts#L2)
1157
1157
 
1158
1158
  ## Functions
1159
1159
 
@@ -1194,7 +1194,7 @@ If a query occurs twice, `mergeQuery(query, currentQuery)` is called and the out
1194
1194
 
1195
1195
  #### Defined in
1196
1196
 
1197
- [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/aggregate.ts#L16)
1197
+ [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/aggregate.ts#L16)
1198
1198
 
1199
1199
  ___
1200
1200
 
@@ -1236,7 +1236,7 @@ const customFetch = combine(
1236
1236
 
1237
1237
  #### Defined in
1238
1238
 
1239
- [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/branch.ts#L21)
1239
+ [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/branch.ts#L21)
1240
1240
 
1241
1241
  ___
1242
1242
 
@@ -1271,7 +1271,7 @@ ___
1271
1271
 
1272
1272
  #### Defined in
1273
1273
 
1274
- [lib/middlewares/cache.ts:8](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/cache.ts#L8)
1274
+ [lib/middlewares/cache.ts:8](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/cache.ts#L8)
1275
1275
 
1276
1276
  ___
1277
1277
 
@@ -1344,7 +1344,7 @@ Handler that combines all provided handlers.
1344
1344
 
1345
1345
  #### Defined in
1346
1346
 
1347
- [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/combine.ts#L801)
1347
+ [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/combine.ts#L801)
1348
1348
 
1349
1349
  ___
1350
1350
 
@@ -1366,7 +1366,7 @@ Uncallable handler used to terminate a sequence of handlers combined with `combi
1366
1366
 
1367
1367
  #### Defined in
1368
1368
 
1369
- [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/NextHandler.ts#L4)
1369
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/6055b33/lib/types/NextHandler.ts#L4)
1370
1370
 
1371
1371
  ___
1372
1372
 
@@ -1429,7 +1429,7 @@ typeof `query`
1429
1429
 
1430
1430
  #### Defined in
1431
1431
 
1432
- [lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/defineCheckQuery.ts#L8)
1432
+ [lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/defineCheckQuery.ts#L8)
1433
1433
 
1434
1434
  ___
1435
1435
 
@@ -1499,7 +1499,7 @@ A custom fetch function.
1499
1499
 
1500
1500
  #### Defined in
1501
1501
 
1502
- [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/defineCustomFetch.ts#L11)
1502
+ [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/defineCustomFetch.ts#L11)
1503
1503
 
1504
1504
  ___
1505
1505
 
@@ -1562,7 +1562,7 @@ A curried generic fetch function.
1562
1562
 
1563
1563
  #### Defined in
1564
1564
 
1565
- [lib/tools/defineGenericFetch.ts:14](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/defineGenericFetch.ts#L14)
1565
+ [lib/tools/defineGenericFetch.ts:14](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/defineGenericFetch.ts#L14)
1566
1566
 
1567
1567
  ___
1568
1568
 
@@ -1586,7 +1586,7 @@ Escaped regular expression
1586
1586
 
1587
1587
  #### Defined in
1588
1588
 
1589
- [lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/escapeRegex.ts#L7)
1589
+ [lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/escapeRegex.ts#L7)
1590
1590
 
1591
1591
  ___
1592
1592
 
@@ -1610,7 +1610,7 @@ Handler that returns a promise that resolves to the response.
1610
1610
 
1611
1611
  #### Defined in
1612
1612
 
1613
- [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/fetchExternal.ts#L12)
1613
+ [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/fetchExternal.ts#L12)
1614
1614
 
1615
1615
  ___
1616
1616
 
@@ -1634,7 +1634,7 @@ Promise that resolves to the response.
1634
1634
 
1635
1635
  #### Defined in
1636
1636
 
1637
- [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/fetchLocal.ts#L9)
1637
+ [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/fetchLocal.ts#L9)
1638
1638
 
1639
1639
  ___
1640
1640
 
@@ -1663,7 +1663,7 @@ ___
1663
1663
 
1664
1664
  #### Defined in
1665
1665
 
1666
- [lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/filterChildren.ts#L5)
1666
+ [lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/filterChildren.ts#L5)
1667
1667
 
1668
1668
  ___
1669
1669
 
@@ -1689,7 +1689,7 @@ ___
1689
1689
 
1690
1690
  #### Defined in
1691
1691
 
1692
- [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/filterFromContext.ts#L5)
1692
+ [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/filterFromContext.ts#L5)
1693
1693
 
1694
1694
  ___
1695
1695
 
@@ -1721,7 +1721,7 @@ Checks wether the provided `value` matches the `filter` or not.
1721
1721
 
1722
1722
  #### Defined in
1723
1723
 
1724
- [lib/tools/filterItem.ts:17](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/filterItem.ts#L17)
1724
+ [lib/tools/filterItem.ts:17](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/filterItem.ts#L17)
1725
1725
 
1726
1726
  ___
1727
1727
 
@@ -1751,7 +1751,7 @@ ___
1751
1751
 
1752
1752
  #### Defined in
1753
1753
 
1754
- [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/identity.ts#L3)
1754
+ [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/identity.ts#L3)
1755
1755
 
1756
1756
  ___
1757
1757
 
@@ -1781,7 +1781,7 @@ Whether the provided filter is a group filter or not.
1781
1781
 
1782
1782
  #### Defined in
1783
1783
 
1784
- [lib/tools/isFilterGroup.ts:9](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/isFilterGroup.ts#L9)
1784
+ [lib/tools/isFilterGroup.ts:9](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/isFilterGroup.ts#L9)
1785
1785
 
1786
1786
  ___
1787
1787
 
@@ -1814,7 +1814,7 @@ Query handler
1814
1814
 
1815
1815
  #### Defined in
1816
1816
 
1817
- [lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/log.ts#L13)
1817
+ [lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/log.ts#L13)
1818
1818
 
1819
1819
  ___
1820
1820
 
@@ -1845,7 +1845,7 @@ ___
1845
1845
 
1846
1846
  #### Defined in
1847
1847
 
1848
- [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/normalizeOrder.ts#L3)
1848
+ [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/normalizeOrder.ts#L3)
1849
1849
 
1850
1850
  ___
1851
1851
 
@@ -1872,7 +1872,7 @@ ___
1872
1872
 
1873
1873
  #### Defined in
1874
1874
 
1875
- [lib/tools/queryItemList.ts:41](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/queryItemList.ts#L41)
1875
+ [lib/tools/queryItemList.ts:41](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/queryItemList.ts#L41)
1876
1876
 
1877
1877
  ___
1878
1878
 
@@ -1901,7 +1901,7 @@ Handler
1901
1901
 
1902
1902
  #### Defined in
1903
1903
 
1904
- [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/8bdd08f/lib/middlewares/retry.ts#L15)
1904
+ [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/6055b33/lib/middlewares/retry.ts#L15)
1905
1905
 
1906
1906
  ___
1907
1907
 
@@ -1932,4 +1932,4 @@ The same array sorted in place.
1932
1932
 
1933
1933
  #### Defined in
1934
1934
 
1935
- [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/8bdd08f/lib/tools/sortItemList.ts#L12)
1935
+ [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/6055b33/lib/tools/sortItemList.ts#L12)
@@ -45,7 +45,7 @@ Error.constructor
45
45
 
46
46
  #### Defined in
47
47
 
48
- [lib/errors/RequestError.ts:7](https://github.com/nevoland/quetch/blob/8bdd08f/lib/errors/RequestError.ts#L7)
48
+ [lib/errors/RequestError.ts:7](https://github.com/nevoland/quetch/blob/6055b33/lib/errors/RequestError.ts#L7)
49
49
 
50
50
  ## Properties
51
51
 
@@ -55,7 +55,7 @@ Error.constructor
55
55
 
56
56
  #### Defined in
57
57
 
58
- [lib/errors/RequestError.ts:10](https://github.com/nevoland/quetch/blob/8bdd08f/lib/errors/RequestError.ts#L10)
58
+ [lib/errors/RequestError.ts:10](https://github.com/nevoland/quetch/blob/6055b33/lib/errors/RequestError.ts#L10)
59
59
 
60
60
  ___
61
61
 
@@ -65,7 +65,7 @@ ___
65
65
 
66
66
  #### Defined in
67
67
 
68
- [lib/errors/RequestError.ts:11](https://github.com/nevoland/quetch/blob/8bdd08f/lib/errors/RequestError.ts#L11)
68
+ [lib/errors/RequestError.ts:11](https://github.com/nevoland/quetch/blob/6055b33/lib/errors/RequestError.ts#L11)
69
69
 
70
70
  ___
71
71
 
@@ -75,7 +75,7 @@ ___
75
75
 
76
76
  #### Defined in
77
77
 
78
- [lib/errors/RequestError.ts:12](https://github.com/nevoland/quetch/blob/8bdd08f/lib/errors/RequestError.ts#L12)
78
+ [lib/errors/RequestError.ts:12](https://github.com/nevoland/quetch/blob/6055b33/lib/errors/RequestError.ts#L12)
79
79
 
80
80
  ___
81
81
 
@@ -85,4 +85,4 @@ ___
85
85
 
86
86
  #### Defined in
87
87
 
88
- [lib/errors/RequestError.ts:9](https://github.com/nevoland/quetch/blob/8bdd08f/lib/errors/RequestError.ts#L9)
88
+ [lib/errors/RequestError.ts:9](https://github.com/nevoland/quetch/blob/6055b33/lib/errors/RequestError.ts#L9)
@@ -32,4 +32,4 @@
32
32
 
33
33
  #### Defined in
34
34
 
35
- [lib/types/CustomFetch.ts:5](https://github.com/nevoland/quetch/blob/8bdd08f/lib/types/CustomFetch.ts#L5)
35
+ [lib/types/CustomFetch.ts:5](https://github.com/nevoland/quetch/blob/6055b33/lib/types/CustomFetch.ts#L5)
@@ -16,23 +16,24 @@ export function fetchExternal(
16
16
  console.error("Could not find a global `fetch` function");
17
17
  }
18
18
  return async (request, _) => {
19
+ let response;
19
20
  try {
20
- const response = await fetch(request);
21
- if (!response.ok) {
22
- throw new RequestError(
23
- response.statusText,
24
- response.status,
25
- undefined,
26
- request,
27
- response,
28
- );
29
- }
30
- return response;
21
+ response = await fetch(request);
31
22
  } catch (error) {
32
23
  if (error instanceof Error) {
33
24
  throw new RequestError(error.message, 500, undefined, request);
34
25
  }
35
26
  throw new RequestError(String(error), 500, undefined, request);
36
27
  }
28
+ if (!response.ok) {
29
+ throw new RequestError(
30
+ response.statusText,
31
+ response.status,
32
+ undefined,
33
+ request,
34
+ response,
35
+ );
36
+ }
37
+ return response;
37
38
  };
38
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quetch",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "type": "module",
5
5
  "main": "./dist/main.js",
6
6
  "exports": {