quetch 0.5.0 → 0.5.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.
@@ -4,6 +4,11 @@ import type { CustomFieldMap, Handler, Query } from "../types";
4
4
  *
5
5
  * @returns Promise that resolves to the response.
6
6
  */
7
+ export declare function fetchLocal<T extends object>(): Handler<Query<T, {}> & {
8
+ type: T[];
9
+ customFields: never;
10
+ }, any, never, never>;
7
11
  export declare function fetchLocal<T extends object, C extends CustomFieldMap<T>>(): Handler<Query<T, C> & {
8
12
  type: T[];
13
+ customFields: C;
9
14
  }, any, never, never>;
@@ -1,9 +1,4 @@
1
1
  import { queryItemList } from "../tools/queryItemList";
2
- /**
3
- * Performs the fetch query on local data.
4
- *
5
- * @returns Promise that resolves to the response.
6
- */
7
2
  export function fetchLocal() {
8
3
  return async (query, _) => queryItemList(query);
9
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fetchLocal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchLocal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD;;;;GAIG;AACH,MAAM,UAAU,UAAU;IAIxB,OAAO,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAO,KAAK,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"fetchLocal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchLocal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAkBvD,MAAM,UAAU,UAAU;IASxB,OAAO,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC"}
@@ -1,4 +1,10 @@
1
- import type { CustomFieldMap, Query } from "../types";
2
- export declare function queryItemList<T extends object, C extends CustomFieldMap<T>>(query: Query<T, C> & {
1
+ import type { CustomFieldMap, Query, Result } from "../types";
2
+ declare function queryItemList<T extends object, const Q extends Query<T, {}>>(query: Q & {
3
3
  type: T[];
4
- }): number | T | T[];
4
+ customFields?: never;
5
+ }): Result<T, Q, {}>;
6
+ declare function queryItemList<T extends object, const Q extends Query<T, C>, const C extends CustomFieldMap<T>>(query: Q & {
7
+ type: T[];
8
+ customFields: C;
9
+ }): Result<T, Q, C>;
10
+ export { queryItemList };
@@ -20,7 +20,7 @@ function normalizeAggregator(aggregator) {
20
20
  }
21
21
  return aggregator.operator;
22
22
  }
23
- export function queryItemList(query) {
23
+ function queryItemList(query) {
24
24
  const data = query.type;
25
25
  switch (query.method) {
26
26
  case "read":
@@ -74,4 +74,5 @@ export function queryItemList(query) {
74
74
  }
75
75
  }
76
76
  }
77
+ export { queryItemList };
77
78
  //# sourceMappingURL=queryItemList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryItemList.js","sourceRoot":"","sources":["../../lib/tools/queryItemList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAWzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,SAAS,qBAAqB,CAC5B,OAAoB,EACpB,MAAkB;IAElB,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,MAAM,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;KACtC;IACD,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;KACnC;IACD,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,UAAgC;IAEhC,IAAI,UAAU,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B,EAAE,IAAI,CAAC,EAAE;4BACtC,OAAO,MAAM,GAAG,CAAC,CAAC;yBACnB;wBACD,OAAO,MAAM,CAAC;oBAChB,CAAC,EAAE,CAAW,CAAoB,CAAC;iBACpC;gBACD,OAAO,CAAC,CAAC;oBACP,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;iBACpC;aACF;SACF;QACD,OAAO,CAAC,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;SAC3D;KACF;AACH,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
package/doc/README.md CHANGED
@@ -94,7 +94,7 @@ Aggregation function.
94
94
 
95
95
  #### Defined in
96
96
 
97
- [lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/AggregateFunction.ts#L4)
97
+ [lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/AggregateFunction.ts#L4)
98
98
 
99
99
  ___
100
100
 
@@ -104,7 +104,7 @@ ___
104
104
 
105
105
  #### Defined in
106
106
 
107
- [lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/AggregateFunctionOperator.ts#L3)
107
+ [lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/AggregateFunctionOperator.ts#L3)
108
108
 
109
109
  ___
110
110
 
@@ -114,7 +114,7 @@ ___
114
114
 
115
115
  #### Defined in
116
116
 
117
- [lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Any.ts#L1)
117
+ [lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Any.ts#L1)
118
118
 
119
119
  ___
120
120
 
@@ -130,7 +130,7 @@ ___
130
130
 
131
131
  #### Defined in
132
132
 
133
- [lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Context.ts#L1)
133
+ [lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Context.ts#L1)
134
134
 
135
135
  ___
136
136
 
@@ -146,7 +146,7 @@ ___
146
146
 
147
147
  #### Defined in
148
148
 
149
- [lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/CustomFieldAggregateMap.ts#L3)
149
+ [lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/CustomFieldAggregateMap.ts#L3)
150
150
 
151
151
  ___
152
152
 
@@ -162,7 +162,7 @@ ___
162
162
 
163
163
  #### Defined in
164
164
 
165
- [lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/CustomFieldMap.ts#L3)
165
+ [lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/CustomFieldMap.ts#L3)
166
166
 
167
167
  ___
168
168
 
@@ -188,7 +188,7 @@ ___
188
188
 
189
189
  #### Defined in
190
190
 
191
- [lib/types/CustomRequest.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/CustomRequest.ts#L4)
191
+ [lib/types/CustomRequest.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/CustomRequest.ts#L4)
192
192
 
193
193
  ___
194
194
 
@@ -204,7 +204,7 @@ ___
204
204
 
205
205
  #### Defined in
206
206
 
207
- [lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FieldFunction.ts#L4)
207
+ [lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FieldFunction.ts#L4)
208
208
 
209
209
  ___
210
210
 
@@ -229,7 +229,7 @@ Applies a custom field transform function.
229
229
 
230
230
  #### Defined in
231
231
 
232
- [lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FieldFunctionCustom.ts#L4)
232
+ [lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FieldFunctionCustom.ts#L4)
233
233
 
234
234
  ___
235
235
 
@@ -255,7 +255,7 @@ Formats the date found in a given field, which can be an ISO string date or a ti
255
255
 
256
256
  #### Defined in
257
257
 
258
- [lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FieldFunctionFormatDate.ts#L6)
258
+ [lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FieldFunctionFormatDate.ts#L6)
259
259
 
260
260
  ___
261
261
 
@@ -273,7 +273,7 @@ Return types of custom field functions.
273
273
 
274
274
  #### Defined in
275
275
 
276
- [lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FieldFunctionReturn.ts#L4)
276
+ [lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FieldFunctionReturn.ts#L4)
277
277
 
278
278
  ___
279
279
 
@@ -291,7 +291,7 @@ Describes a predicate for filtering items.
291
291
 
292
292
  #### Defined in
293
293
 
294
- [lib/types/Filter.ts:12](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Filter.ts#L12)
294
+ [lib/types/Filter.ts:12](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Filter.ts#L12)
295
295
 
296
296
  ___
297
297
 
@@ -318,7 +318,7 @@ Checks if a given array field matches a given array value according to a given o
318
318
 
319
319
  #### Defined in
320
320
 
321
- [lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterArray.ts#L7)
321
+ [lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterArray.ts#L7)
322
322
 
323
323
  ___
324
324
 
@@ -344,7 +344,7 @@ Checks if a given boolean field is `true` or `false`.
344
344
 
345
345
  #### Defined in
346
346
 
347
- [lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterBoolean.ts#L6)
347
+ [lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterBoolean.ts#L6)
348
348
 
349
349
  ___
350
350
 
@@ -369,7 +369,7 @@ Checks if a given field exists.
369
369
 
370
370
  #### Defined in
371
371
 
372
- [lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterField.ts#L4)
372
+ [lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterField.ts#L4)
373
373
 
374
374
  ___
375
375
 
@@ -388,7 +388,7 @@ Returns object type with field extending the provided `P` type.
388
388
 
389
389
  #### Defined in
390
390
 
391
- [lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterKeys.ts#L4)
391
+ [lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterKeys.ts#L4)
392
392
 
393
393
  ___
394
394
 
@@ -414,7 +414,7 @@ Checks if a given number field matches a given number value according to a given
414
414
 
415
415
  #### Defined in
416
416
 
417
- [lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterNumber.ts#L6)
417
+ [lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterNumber.ts#L6)
418
418
 
419
419
  ___
420
420
 
@@ -424,7 +424,7 @@ ___
424
424
 
425
425
  #### Defined in
426
426
 
427
- [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterOperator.ts#L3)
427
+ [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterOperator.ts#L3)
428
428
 
429
429
  ___
430
430
 
@@ -442,7 +442,7 @@ Joins a list of filters with a specific boolean operator.
442
442
 
443
443
  #### Defined in
444
444
 
445
- [lib/types/FilterSequence.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterSequence.ts#L6)
445
+ [lib/types/FilterSequence.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterSequence.ts#L6)
446
446
 
447
447
  ___
448
448
 
@@ -468,7 +468,7 @@ Checks if a given string field matches a given string value according to a given
468
468
 
469
469
  #### Defined in
470
470
 
471
- [lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterString.ts#L6)
471
+ [lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterString.ts#L6)
472
472
 
473
473
  ___
474
474
 
@@ -494,7 +494,7 @@ Checks if a given string field has any of the provided values.
494
494
 
495
495
  #### Defined in
496
496
 
497
- [lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterStringIntersect.ts#L6)
497
+ [lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterStringIntersect.ts#L6)
498
498
 
499
499
  ___
500
500
 
@@ -524,7 +524,7 @@ Checks if a given string field matches a given regular expression.
524
524
 
525
525
  #### Defined in
526
526
 
527
- [lib/types/FilterStringMatch.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/FilterStringMatch.ts#L6)
527
+ [lib/types/FilterStringMatch.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/FilterStringMatch.ts#L6)
528
528
 
529
529
  ___
530
530
 
@@ -544,7 +544,7 @@ Returns the type of the property at the specified `K` key.
544
544
 
545
545
  #### Defined in
546
546
 
547
- [lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Get.ts#L4)
547
+ [lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Get.ts#L4)
548
548
 
549
549
  ___
550
550
 
@@ -562,7 +562,7 @@ Specifies how items should be grouped.
562
562
 
563
563
  #### Defined in
564
564
 
565
- [lib/types/Group.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Group.ts#L6)
565
+ [lib/types/Group.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Group.ts#L6)
566
566
 
567
567
  ___
568
568
 
@@ -598,7 +598,7 @@ Handles an `input` query and returns an `output` promise, eventually using the `
598
598
 
599
599
  #### Defined in
600
600
 
601
- [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Handler.ts#L6)
601
+ [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Handler.ts#L6)
602
602
 
603
603
  ___
604
604
 
@@ -614,7 +614,7 @@ ___
614
614
 
615
615
  #### Defined in
616
616
 
617
- [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Immutable.ts#L1)
617
+ [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Immutable.ts#L1)
618
618
 
619
619
  ___
620
620
 
@@ -633,7 +633,7 @@ Injects the custom fields into the entity type.
633
633
 
634
634
  #### Defined in
635
635
 
636
- [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/InjectCustomFields.ts#L8)
636
+ [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/InjectCustomFields.ts#L8)
637
637
 
638
638
  ___
639
639
 
@@ -652,7 +652,7 @@ Returns the inferred item type of an array, or an alternative type if it is some
652
652
 
653
653
  #### Defined in
654
654
 
655
- [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Item.ts#L4)
655
+ [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Item.ts#L4)
656
656
 
657
657
  ___
658
658
 
@@ -662,7 +662,7 @@ ___
662
662
 
663
663
  #### Defined in
664
664
 
665
- [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Key.ts#L1)
665
+ [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Key.ts#L1)
666
666
 
667
667
  ___
668
668
 
@@ -678,7 +678,7 @@ ___
678
678
 
679
679
  #### Defined in
680
680
 
681
- [lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Mutable.ts#L1)
681
+ [lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Mutable.ts#L1)
682
682
 
683
683
  ___
684
684
 
@@ -711,7 +711,7 @@ Handles an `input` query and returns an `output` promise.
711
711
 
712
712
  #### Defined in
713
713
 
714
- [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/NextHandler.ts#L4)
714
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/NextHandler.ts#L4)
715
715
 
716
716
  ___
717
717
 
@@ -729,7 +729,7 @@ Order item.
729
729
 
730
730
  #### Defined in
731
731
 
732
- [lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Order.ts#L4)
732
+ [lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Order.ts#L4)
733
733
 
734
734
  ___
735
735
 
@@ -750,7 +750,7 @@ Query that fetches or mutates an entity.
750
750
 
751
751
  #### Defined in
752
752
 
753
- [lib/types/Query.ts:28](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Query.ts#L28)
753
+ [lib/types/Query.ts:28](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Query.ts#L28)
754
754
 
755
755
  ___
756
756
 
@@ -776,7 +776,7 @@ Query for computing an aggregated value.
776
776
 
777
777
  #### Defined in
778
778
 
779
- [lib/types/QueryAggregate.ts:7](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryAggregate.ts#L7)
779
+ [lib/types/QueryAggregate.ts:7](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryAggregate.ts#L7)
780
780
 
781
781
  ___
782
782
 
@@ -786,7 +786,7 @@ ___
786
786
 
787
787
  #### Defined in
788
788
 
789
- [lib/types/QueryAny.ts:5](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryAny.ts#L5)
789
+ [lib/types/QueryAny.ts:5](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryAny.ts#L5)
790
790
 
791
791
  ___
792
792
 
@@ -812,7 +812,7 @@ Query for creating an item.
812
812
 
813
813
  #### Defined in
814
814
 
815
- [lib/types/QueryCreate.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryCreate.ts#L4)
815
+ [lib/types/QueryCreate.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryCreate.ts#L4)
816
816
 
817
817
  ___
818
818
 
@@ -838,7 +838,7 @@ Query for creating multiple items.
838
838
 
839
839
  #### Defined in
840
840
 
841
- [lib/types/QueryCreateMultiple.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryCreateMultiple.ts#L4)
841
+ [lib/types/QueryCreateMultiple.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryCreateMultiple.ts#L4)
842
842
 
843
843
  ___
844
844
 
@@ -865,7 +865,7 @@ Query for deleting an item.
865
865
 
866
866
  #### Defined in
867
867
 
868
- [lib/types/QueryDelete.ts:7](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryDelete.ts#L7)
868
+ [lib/types/QueryDelete.ts:7](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryDelete.ts#L7)
869
869
 
870
870
  ___
871
871
 
@@ -892,7 +892,7 @@ Query for deleting multiple items.
892
892
 
893
893
  #### Defined in
894
894
 
895
- [lib/types/QueryDeleteMultiple.ts:7](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryDeleteMultiple.ts#L7)
895
+ [lib/types/QueryDeleteMultiple.ts:7](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryDeleteMultiple.ts#L7)
896
896
 
897
897
  ___
898
898
 
@@ -904,7 +904,7 @@ Available query methods.
904
904
 
905
905
  #### Defined in
906
906
 
907
- [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryMethod.ts#L6)
907
+ [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryMethod.ts#L6)
908
908
 
909
909
  ___
910
910
 
@@ -934,7 +934,7 @@ Query for reading a single item.
934
934
 
935
935
  #### Defined in
936
936
 
937
- [lib/types/QueryRead.ts:7](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryRead.ts#L7)
937
+ [lib/types/QueryRead.ts:7](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryRead.ts#L7)
938
938
 
939
939
  ___
940
940
 
@@ -965,7 +965,7 @@ Query for getting a list of items.
965
965
 
966
966
  #### Defined in
967
967
 
968
- [lib/types/QueryReadMultiple.ts:8](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryReadMultiple.ts#L8)
968
+ [lib/types/QueryReadMultiple.ts:8](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryReadMultiple.ts#L8)
969
969
 
970
970
  ___
971
971
 
@@ -995,7 +995,7 @@ Query for updating an item.
995
995
 
996
996
  #### Defined in
997
997
 
998
- [lib/types/QueryUpdate.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryUpdate.ts#L6)
998
+ [lib/types/QueryUpdate.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryUpdate.ts#L6)
999
999
 
1000
1000
  ___
1001
1001
 
@@ -1025,7 +1025,7 @@ Query for updating multiple items.
1025
1025
 
1026
1026
  #### Defined in
1027
1027
 
1028
- [lib/types/QueryUpdateMultiple.ts:7](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/QueryUpdateMultiple.ts#L7)
1028
+ [lib/types/QueryUpdateMultiple.ts:7](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/QueryUpdateMultiple.ts#L7)
1029
1029
 
1030
1030
  ___
1031
1031
 
@@ -1044,7 +1044,7 @@ ___
1044
1044
 
1045
1045
  #### Defined in
1046
1046
 
1047
- [lib/types/Result.ts:25](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Result.ts#L25)
1047
+ [lib/types/Result.ts:25](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Result.ts#L25)
1048
1048
 
1049
1049
  ___
1050
1050
 
@@ -1069,7 +1069,7 @@ ___
1069
1069
 
1070
1070
  #### Defined in
1071
1071
 
1072
- [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/Store.ts#L2)
1072
+ [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/Store.ts#L2)
1073
1073
 
1074
1074
  ## Functions
1075
1075
 
@@ -1110,7 +1110,7 @@ If a query occurs twice, `mergeQuery(query, currentQuery)` is called and the out
1110
1110
 
1111
1111
  #### Defined in
1112
1112
 
1113
- [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/aggregate.ts#L16)
1113
+ [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/aggregate.ts#L16)
1114
1114
 
1115
1115
  ___
1116
1116
 
@@ -1152,7 +1152,7 @@ const customFetch = combine(
1152
1152
 
1153
1153
  #### Defined in
1154
1154
 
1155
- [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/branch.ts#L21)
1155
+ [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/branch.ts#L21)
1156
1156
 
1157
1157
  ___
1158
1158
 
@@ -1181,7 +1181,7 @@ ___
1181
1181
 
1182
1182
  #### Defined in
1183
1183
 
1184
- [lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/cache.ts#L39)
1184
+ [lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/cache.ts#L39)
1185
1185
 
1186
1186
  ___
1187
1187
 
@@ -1254,7 +1254,7 @@ Handler that combines all provided handlers.
1254
1254
 
1255
1255
  #### Defined in
1256
1256
 
1257
- [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/combine.ts#L801)
1257
+ [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/combine.ts#L801)
1258
1258
 
1259
1259
  ___
1260
1260
 
@@ -1276,7 +1276,7 @@ Uncallable handler used to terminate a sequence of handlers combined with `combi
1276
1276
 
1277
1277
  #### Defined in
1278
1278
 
1279
- [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/NextHandler.ts#L4)
1279
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/NextHandler.ts#L4)
1280
1280
 
1281
1281
  ___
1282
1282
 
@@ -1341,7 +1341,7 @@ typeof `query`
1341
1341
 
1342
1342
  #### Defined in
1343
1343
 
1344
- [lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/defineCheckQuery.ts#L8)
1344
+ [lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/defineCheckQuery.ts#L8)
1345
1345
 
1346
1346
  ___
1347
1347
 
@@ -1448,7 +1448,7 @@ ___
1448
1448
 
1449
1449
  #### Defined in
1450
1450
 
1451
- [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/defineCustomFetch.ts#L11)
1451
+ [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/defineCustomFetch.ts#L11)
1452
1452
 
1453
1453
  ___
1454
1454
 
@@ -1523,7 +1523,7 @@ ___
1523
1523
 
1524
1524
  #### Defined in
1525
1525
 
1526
- [lib/tools/defineGenericFetch.ts:5](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/defineGenericFetch.ts#L5)
1526
+ [lib/tools/defineGenericFetch.ts:5](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/defineGenericFetch.ts#L5)
1527
1527
 
1528
1528
  ___
1529
1529
 
@@ -1547,13 +1547,13 @@ Handler that returns a promise that resolves to the response.
1547
1547
 
1548
1548
  #### Defined in
1549
1549
 
1550
- [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/fetchExternal.ts#L12)
1550
+ [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/fetchExternal.ts#L12)
1551
1551
 
1552
1552
  ___
1553
1553
 
1554
1554
  ### fetchLocal
1555
1555
 
1556
- ▸ **fetchLocal**<`T`, `C`\>(): [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, `C`\> & { `type`: `T`[] }, `any`, `never`, `never`\>
1556
+ ▸ **fetchLocal**<`T`\>(): [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, {}\> & { `customFields`: `never` ; `type`: `T`[] }, `any`, `never`, `never`\>
1557
1557
 
1558
1558
  Performs the fetch query on local data.
1559
1559
 
@@ -1562,17 +1562,33 @@ Performs the fetch query on local data.
1562
1562
  | Name | Type |
1563
1563
  | :------ | :------ |
1564
1564
  | `T` | extends `object` |
1565
- | `C` | extends [`CustomFieldMap`](README.md#customfieldmap)<`T`\> |
1566
1565
 
1567
1566
  #### Returns
1568
1567
 
1569
- [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, `C`\> & { `type`: `T`[] }, `any`, `never`, `never`\>
1568
+ [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, {}\> & { `customFields`: `never` ; `type`: `T`[] }, `any`, `never`, `never`\>
1570
1569
 
1571
1570
  Promise that resolves to the response.
1572
1571
 
1573
1572
  #### Defined in
1574
1573
 
1575
- [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/fetchLocal.ts#L9)
1574
+ [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/fetchLocal.ts#L9)
1575
+
1576
+ ▸ **fetchLocal**<`T`, `C`\>(): [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, `C`\> & { `customFields`: `C` ; `type`: `T`[] }, `any`, `never`, `never`\>
1577
+
1578
+ #### Type parameters
1579
+
1580
+ | Name | Type |
1581
+ | :------ | :------ |
1582
+ | `T` | extends `object` |
1583
+ | `C` | extends [`CustomFieldMap`](README.md#customfieldmap)<`T`\> |
1584
+
1585
+ #### Returns
1586
+
1587
+ [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, `C`\> & { `customFields`: `C` ; `type`: `T`[] }, `any`, `never`, `never`\>
1588
+
1589
+ #### Defined in
1590
+
1591
+ [lib/middlewares/fetchLocal.ts:15](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/fetchLocal.ts#L15)
1576
1592
 
1577
1593
  ___
1578
1594
 
@@ -1598,7 +1614,7 @@ ___
1598
1614
 
1599
1615
  #### Defined in
1600
1616
 
1601
- [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/filterFromContext.ts#L5)
1617
+ [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/filterFromContext.ts#L5)
1602
1618
 
1603
1619
  ___
1604
1620
 
@@ -1629,7 +1645,7 @@ Checks wether the provided `value` matches the `filter` or not.
1629
1645
 
1630
1646
  #### Defined in
1631
1647
 
1632
- [lib/tools/filterItem.ts:12](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/filterItem.ts#L12)
1648
+ [lib/tools/filterItem.ts:12](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/filterItem.ts#L12)
1633
1649
 
1634
1650
  ___
1635
1651
 
@@ -1659,7 +1675,7 @@ ___
1659
1675
 
1660
1676
  #### Defined in
1661
1677
 
1662
- [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/identity.ts#L3)
1678
+ [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/identity.ts#L3)
1663
1679
 
1664
1680
  ___
1665
1681
 
@@ -1692,7 +1708,7 @@ Query handler
1692
1708
 
1693
1709
  #### Defined in
1694
1710
 
1695
- [lib/middlewares/log.ts:11](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/log.ts#L11)
1711
+ [lib/middlewares/log.ts:11](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/log.ts#L11)
1696
1712
 
1697
1713
  ___
1698
1714
 
@@ -1723,34 +1739,58 @@ ___
1723
1739
 
1724
1740
  #### Defined in
1725
1741
 
1726
- [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/normalizeOrder.ts#L3)
1742
+ [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/normalizeOrder.ts#L3)
1727
1743
 
1728
1744
  ___
1729
1745
 
1730
1746
  ### queryItemList
1731
1747
 
1732
- ▸ **queryItemList**<`T`, `C`\>(`query`): `number` \| `T` \| `T`[]
1748
+ ▸ **queryItemList**<`T`, `Q`\>(`query`): [`Result`](README.md#result)<`T`, `Q`, {}\>
1749
+
1750
+ #### Type parameters
1751
+
1752
+ | Name | Type |
1753
+ | :------ | :------ |
1754
+ | `T` | extends `object` |
1755
+ | `Q` | extends [`Query`](README.md#query)<`T`, {}\> |
1756
+
1757
+ #### Parameters
1758
+
1759
+ | Name | Type |
1760
+ | :------ | :------ |
1761
+ | `query` | `Q` & { `customFields?`: `undefined` ; `type`: `T`[] } |
1762
+
1763
+ #### Returns
1764
+
1765
+ [`Result`](README.md#result)<`T`, `Q`, {}\>
1766
+
1767
+ #### Defined in
1768
+
1769
+ [lib/tools/queryItemList.ts:42](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/queryItemList.ts#L42)
1770
+
1771
+ ▸ **queryItemList**<`T`, `Q`, `C`\>(`query`): [`Result`](README.md#result)<`T`, `Q`, `C`\>
1733
1772
 
1734
1773
  #### Type parameters
1735
1774
 
1736
1775
  | Name | Type |
1737
1776
  | :------ | :------ |
1738
1777
  | `T` | extends `object` |
1778
+ | `Q` | extends [`Query`](README.md#query)<`T`, `C`\> |
1739
1779
  | `C` | extends [`CustomFieldMap`](README.md#customfieldmap)<`T`\> |
1740
1780
 
1741
1781
  #### Parameters
1742
1782
 
1743
1783
  | Name | Type |
1744
1784
  | :------ | :------ |
1745
- | `query` | `Object` |
1785
+ | `query` | `Q` & { `customFields`: `C` ; `type`: `T`[] } |
1746
1786
 
1747
1787
  #### Returns
1748
1788
 
1749
- `number` \| `T` \| `T`[]
1789
+ [`Result`](README.md#result)<`T`, `Q`, `C`\>
1750
1790
 
1751
1791
  #### Defined in
1752
1792
 
1753
- [lib/tools/queryItemList.ts:41](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/queryItemList.ts#L41)
1793
+ [lib/tools/queryItemList.ts:45](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/queryItemList.ts#L45)
1754
1794
 
1755
1795
  ___
1756
1796
 
@@ -1779,7 +1819,7 @@ Handler
1779
1819
 
1780
1820
  #### Defined in
1781
1821
 
1782
- [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/c839ceb/lib/middlewares/retry.ts#L15)
1822
+ [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/fd3c43e/lib/middlewares/retry.ts#L15)
1783
1823
 
1784
1824
  ___
1785
1825
 
@@ -1810,4 +1850,4 @@ The same array sorted in place.
1810
1850
 
1811
1851
  #### Defined in
1812
1852
 
1813
- [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/c839ceb/lib/tools/sortItemList.ts#L12)
1853
+ [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/fd3c43e/lib/tools/sortItemList.ts#L12)
@@ -32,7 +32,7 @@
32
32
 
33
33
  #### Defined in
34
34
 
35
- [lib/types/GenericFetch.ts:6](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/GenericFetch.ts#L6)
35
+ [lib/types/GenericFetch.ts:6](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/GenericFetch.ts#L6)
36
36
 
37
37
  ### GenericFetch
38
38
 
@@ -57,4 +57,4 @@
57
57
 
58
58
  #### Defined in
59
59
 
60
- [lib/types/GenericFetch.ts:9](https://github.com/nevoland/quetch/blob/c839ceb/lib/types/GenericFetch.ts#L9)
60
+ [lib/types/GenericFetch.ts:9](https://github.com/nevoland/quetch/blob/fd3c43e/lib/types/GenericFetch.ts#L9)
@@ -6,9 +6,24 @@ import type { CustomFieldMap, Handler, Query } from "../types";
6
6
  *
7
7
  * @returns Promise that resolves to the response.
8
8
  */
9
+ export function fetchLocal<T extends object>(): Handler<
10
+ Query<T, {}> & { type: T[]; customFields: never },
11
+ any,
12
+ never,
13
+ never
14
+ >;
9
15
  export function fetchLocal<
10
16
  T extends object,
11
17
  C extends CustomFieldMap<T>,
12
- >(): Handler<Query<T, C> & { type: T[] }, any, never, never> {
13
- return async (query, _) => queryItemList<T, C>(query);
18
+ >(): Handler<Query<T, C> & { type: T[]; customFields: C }, any, never, never>;
19
+ export function fetchLocal<
20
+ T extends object,
21
+ C extends CustomFieldMap<T>,
22
+ >(): Handler<
23
+ Query<T, C> & { type: T[]; customFields: C | never },
24
+ any,
25
+ never,
26
+ never
27
+ > {
28
+ return async (query, _) => queryItemList(query);
14
29
  }
@@ -7,6 +7,7 @@ import type {
7
7
  Filter,
8
8
  Order,
9
9
  Query,
10
+ Result,
10
11
  } from "../types";
11
12
 
12
13
  import { filterFromContext } from "./filterFromContext";
@@ -38,9 +39,19 @@ function normalizeAggregator<T extends object>(
38
39
  return aggregator.operator;
39
40
  }
40
41
 
41
- export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
42
- query: Query<T, C> & { type: T[] },
43
- ) {
42
+ function queryItemList<T extends object, const Q extends Query<T, {}>>(
43
+ query: Q & { type: T[]; customFields?: never },
44
+ ): Result<T, Q, {}>;
45
+ function queryItemList<
46
+ T extends object,
47
+ const Q extends Query<T, C>,
48
+ const C extends CustomFieldMap<T>,
49
+ >(query: Q & { type: T[]; customFields: C }): Result<T, Q, C>;
50
+ function queryItemList<
51
+ T extends object,
52
+ const Q extends Query<T, C>,
53
+ const C extends CustomFieldMap<T>,
54
+ >(query: Q & { type: T[]; customFields?: C }): Result<T, Q, C> {
44
55
  const data = query.type as T[];
45
56
  switch (query.method) {
46
57
  case "read":
@@ -66,7 +77,7 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
66
77
  if (offset !== 0 || limit !== Infinity) {
67
78
  result = result.slice(offset, offset + limit);
68
79
  }
69
- return result;
80
+ return result as Result<T, Q, C>;
70
81
  }
71
82
  const normalizedFilter = mergeContextAndFilter(
72
83
  context,
@@ -76,14 +87,14 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
76
87
  if (result === undefined) {
77
88
  throw new RequestError("Not found", 404, query);
78
89
  }
79
- return result;
90
+ return result as Result<T, Q, C>;
80
91
  }
81
92
  case "aggregate": {
82
93
  const { context, filter, aggregator } = query;
83
94
  switch (normalizeAggregator(aggregator)) {
84
95
  case "length": {
85
96
  if (filter === undefined && context === undefined) {
86
- return data.length;
97
+ return data.length as Result<T, Q, C>;
87
98
  }
88
99
  const normalizedFilter = mergeContextAndFilter(
89
100
  context,
@@ -94,7 +105,7 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
94
105
  return result + 1;
95
106
  }
96
107
  return result;
97
- }, 0);
108
+ }, 0 as number) as Result<T, Q, C>;
98
109
  }
99
110
  default: {
100
111
  throw new Error("Not implemented");
@@ -106,3 +117,5 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
106
117
  }
107
118
  }
108
119
  }
120
+
121
+ export { queryItemList };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quetch",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "main": "./dist/main.js",
6
6
  "exports": {