quetch 0.2.0 → 0.2.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.
package/dist/types.d.ts CHANGED
@@ -33,7 +33,7 @@ export type EntityItem<E extends object, C extends CustomFieldMap<E>, Q extends
33
33
  /**
34
34
  * Query that fetches or mutates an entity.
35
35
  */
36
- export type Query<T extends object, C extends CustomFieldMap<T>> = QueryGet<T, C> | QueryGetMultiple<T, C> | QueryCreate<T> | QueryCreateMultiple<T> | QueryUpdate<T, C> | QueryUpdateMultiple<T, C> | QueryDelete<T> | QueryDeleteMultiple<T> | QueryAggregate<T>;
36
+ export type Query<T extends object, C extends CustomFieldMap<T>> = QueryGet<T, C> | QueryGetMultiple<T, C> | QueryCreate<T> | QueryCreateMultiple<T> | QueryUpdate<T, C> | QueryUpdateMultiple<T, C> | QueryDelete<T, C> | QueryDeleteMultiple<T, C> | QueryAggregate<T, C>;
37
37
  export type AnyQuery = Query<any, any>;
38
38
  export type AnyQueryExternal = Omit<Query<any, any>, "type"> & {
39
39
  type: string;
@@ -219,25 +219,25 @@ export type QueryUpdateMultiple<T extends object, C extends CustomFieldMap<T>> =
219
219
  /**
220
220
  * Query for deleting an item.
221
221
  */
222
- export type QueryDelete<T extends object> = QueryBase<T> & {
222
+ export type QueryDelete<T extends object, C extends CustomFieldMap<T>> = QueryBase<T> & {
223
223
  method: "delete";
224
- filter?: Filter<T>;
224
+ filter?: Filter<InjectCustomField<T, C>>;
225
225
  };
226
226
  /**
227
227
  * Query for deleting multiple items.
228
228
  */
229
- export type QueryDeleteMultiple<T extends object> = QueryBase<T> & {
229
+ export type QueryDeleteMultiple<T extends object, C extends CustomFieldMap<T>> = QueryBase<T> & {
230
230
  method: "delete";
231
231
  multiple: true;
232
- filter?: Filter<T>;
232
+ filter?: Filter<InjectCustomField<T, C>>;
233
233
  };
234
234
  /**
235
235
  * Query for computing an aggregated value.
236
236
  */
237
- export type QueryAggregate<T extends object> = QueryBase<T> & {
237
+ export type QueryAggregate<T extends object, C extends CustomFieldMap<T>> = QueryBase<T> & {
238
238
  method: "aggregate";
239
- aggregator: AggregateFunction<T>;
240
- filter?: Filter<T>;
239
+ aggregator: AggregateFunction<InjectCustomField<T, C>>;
240
+ filter?: Filter<InjectCustomField<T, C>>;
241
241
  };
242
242
  /**
243
243
  * Order item.
package/doc/README.md CHANGED
@@ -24,6 +24,7 @@ quetch
24
24
  - [FilterArray](README.md#filterarray)
25
25
  - [FilterBoolean](README.md#filterboolean)
26
26
  - [FilterField](README.md#filterfield)
27
+ - [FilterKeys](README.md#filterkeys)
27
28
  - [FilterList](README.md#filterlist)
28
29
  - [FilterNumber](README.md#filternumber)
29
30
  - [FilterOperator](README.md#filteroperator)
@@ -83,7 +84,7 @@ Aggregation function.
83
84
 
84
85
  #### Defined in
85
86
 
86
- [lib/types.ts:387](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L387)
87
+ [lib/types.ts:387](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L387)
87
88
 
88
89
  ___
89
90
 
@@ -93,7 +94,7 @@ ___
93
94
 
94
95
  #### Defined in
95
96
 
96
- [lib/types.ts:402](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L402)
97
+ [lib/types.ts:402](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L402)
97
98
 
98
99
  ___
99
100
 
@@ -103,7 +104,7 @@ ___
103
104
 
104
105
  #### Defined in
105
106
 
106
- [lib/types.ts:1](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L1)
107
+ [lib/types.ts:1](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L1)
107
108
 
108
109
  ___
109
110
 
@@ -113,7 +114,7 @@ ___
113
114
 
114
115
  #### Defined in
115
116
 
116
- [lib/types.ts:92](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L92)
117
+ [lib/types.ts:92](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L92)
117
118
 
118
119
  ___
119
120
 
@@ -123,7 +124,7 @@ ___
123
124
 
124
125
  #### Defined in
125
126
 
126
- [lib/types.ts:94](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L94)
127
+ [lib/types.ts:94](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L94)
127
128
 
128
129
  ___
129
130
 
@@ -133,7 +134,7 @@ ___
133
134
 
134
135
  #### Defined in
135
136
 
136
- [lib/types.ts:96](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L96)
137
+ [lib/types.ts:96](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L96)
137
138
 
138
139
  ___
139
140
 
@@ -149,7 +150,7 @@ ___
149
150
 
150
151
  #### Defined in
151
152
 
152
- [lib/types.ts:98](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L98)
153
+ [lib/types.ts:98](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L98)
153
154
 
154
155
  ___
155
156
 
@@ -165,7 +166,7 @@ ___
165
166
 
166
167
  #### Defined in
167
168
 
168
- [lib/types.ts:382](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L382)
169
+ [lib/types.ts:382](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L382)
169
170
 
170
171
  ___
171
172
 
@@ -185,7 +186,7 @@ Entity type for a given query.
185
186
 
186
187
  #### Defined in
187
188
 
188
- [lib/types.ts:49](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L49)
189
+ [lib/types.ts:49](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L49)
189
190
 
190
191
  ___
191
192
 
@@ -201,7 +202,7 @@ ___
201
202
 
202
203
  #### Defined in
203
204
 
204
- [lib/types.ts:349](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L349)
205
+ [lib/types.ts:349](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L349)
205
206
 
206
207
  ___
207
208
 
@@ -226,7 +227,7 @@ Applies a custom field transform function.
226
227
 
227
228
  #### Defined in
228
229
 
229
- [lib/types.ts:356](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L356)
230
+ [lib/types.ts:356](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L356)
230
231
 
231
232
  ___
232
233
 
@@ -246,13 +247,13 @@ Formats the date found in a given field, which can be an ISO string date or a ti
246
247
 
247
248
  | Name | Type |
248
249
  | :------ | :------ |
249
- | `field` | `FilterKeys`<`T`, `string` \| `number`\> |
250
+ | `field` | [`FilterKeys`](README.md#filterkeys)<`T`, `string` \| `number`\> |
250
251
  | `format` | `string` |
251
252
  | `operator` | ``"formatDate"`` |
252
253
 
253
254
  #### Defined in
254
255
 
255
- [lib/types.ts:364](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L364)
256
+ [lib/types.ts:364](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L364)
256
257
 
257
258
  ___
258
259
 
@@ -264,7 +265,7 @@ Possible field function operators.
264
265
 
265
266
  #### Defined in
266
267
 
267
- [lib/types.ts:373](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L373)
268
+ [lib/types.ts:373](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L373)
268
269
 
269
270
  ___
270
271
 
@@ -282,7 +283,7 @@ Return types of custom field functions.
282
283
 
283
284
  #### Defined in
284
285
 
285
- [lib/types.ts:378](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L378)
286
+ [lib/types.ts:378](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L378)
286
287
 
287
288
  ___
288
289
 
@@ -300,7 +301,7 @@ Describes a predicate for filtering items.
300
301
 
301
302
  #### Defined in
302
303
 
303
- [lib/types.ts:422](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L422)
304
+ [lib/types.ts:422](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L422)
304
305
 
305
306
  ___
306
307
 
@@ -321,13 +322,13 @@ Checks if a given array field matches a given array value according to a given o
321
322
 
322
323
  | Name | Type |
323
324
  | :------ | :------ |
324
- | `field` | `FilterKeys`<`T`, `P`[]\> |
325
+ | `field` | [`FilterKeys`](README.md#filterkeys)<`T`, `P`[]\> |
325
326
  | `operator` | ``"equal"`` \| ``"include"`` \| ``"intersect"`` |
326
327
  | `value` | `P`[] |
327
328
 
328
329
  #### Defined in
329
330
 
330
- [lib/types.ts:550](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L550)
331
+ [lib/types.ts:550](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L550)
331
332
 
332
333
  ___
333
334
 
@@ -347,13 +348,13 @@ Checks if a given boolean field is `true` or `false`.
347
348
 
348
349
  | Name | Type |
349
350
  | :------ | :------ |
350
- | `field` | `FilterKeys`<`T`, `boolean`\> |
351
+ | `field` | [`FilterKeys`](README.md#filterkeys)<`T`, `boolean`\> |
351
352
  | `operator` | ``"equal"`` \| ``"notEqual"`` |
352
353
  | `value` | `boolean` |
353
354
 
354
355
  #### Defined in
355
356
 
356
- [lib/types.ts:470](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L470)
357
+ [lib/types.ts:470](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L470)
357
358
 
358
359
  ___
359
360
 
@@ -378,7 +379,24 @@ Checks if a given field exists.
378
379
 
379
380
  #### Defined in
380
381
 
381
- [lib/types.ts:462](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L462)
382
+ [lib/types.ts:462](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L462)
383
+
384
+ ___
385
+
386
+ ### FilterKeys
387
+
388
+ Ƭ **FilterKeys**<`T`, `P`\>: { [K in keyof T]-?: T[K] extends P ? K : never }[keyof `T`]
389
+
390
+ #### Type parameters
391
+
392
+ | Name | Type |
393
+ | :------ | :------ |
394
+ | `T` | extends `object` |
395
+ | `P` | `P` |
396
+
397
+ #### Defined in
398
+
399
+ [lib/types.ts:345](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L345)
382
400
 
383
401
  ___
384
402
 
@@ -396,7 +414,7 @@ Joins a list of filters with a specific boolean operator.
396
414
 
397
415
  #### Defined in
398
416
 
399
- [lib/types.ts:437](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L437)
417
+ [lib/types.ts:437](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L437)
400
418
 
401
419
  ___
402
420
 
@@ -416,13 +434,13 @@ Checks if a given number field matches a given number value according to a given
416
434
 
417
435
  | Name | Type |
418
436
  | :------ | :------ |
419
- | `field` | `FilterKeys`<`T`, `number`\> |
437
+ | `field` | [`FilterKeys`](README.md#filterkeys)<`T`, `number`\> |
420
438
  | `operator` | ``"equal"`` \| ``"notEqual"`` \| ``"greaterThan"`` \| ``"greaterThanOrEqual"`` \| ``"lowerThan"`` \| ``"lowerThanOrEqual"`` |
421
439
  | `value` | `number` |
422
440
 
423
441
  #### Defined in
424
442
 
425
- [lib/types.ts:535](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L535)
443
+ [lib/types.ts:535](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L535)
426
444
 
427
445
  ___
428
446
 
@@ -432,7 +450,7 @@ ___
432
450
 
433
451
  #### Defined in
434
452
 
435
- [lib/types.ts:432](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L432)
453
+ [lib/types.ts:432](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L432)
436
454
 
437
455
  ___
438
456
 
@@ -452,13 +470,13 @@ Checks if a given string field matches a given string value according to a given
452
470
 
453
471
  | Name | Type |
454
472
  | :------ | :------ |
455
- | `field` | `FilterKeys`<`T`, `string`\> |
473
+ | `field` | [`FilterKeys`](README.md#filterkeys)<`T`, `string`\> |
456
474
  | `operator` | ``"equal"`` \| ``"notEqual"`` \| ``"startWith"`` \| ``"endWith"`` \| ``"include"`` \| ``"greaterThan"`` \| ``"greaterThanOrEqual"`` \| ``"lowerThan"`` \| ``"lowerThanOrEqual"`` |
457
475
  | `value` | `string` |
458
476
 
459
477
  #### Defined in
460
478
 
461
- [lib/types.ts:479](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L479)
479
+ [lib/types.ts:479](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L479)
462
480
 
463
481
  ___
464
482
 
@@ -478,13 +496,13 @@ Checks if a given string field has any of the provided values.
478
496
 
479
497
  | Name | Type |
480
498
  | :------ | :------ |
481
- | `field` | `FilterKeys`<`T`, `string`\> |
499
+ | `field` | [`FilterKeys`](README.md#filterkeys)<`T`, `string`\> |
482
500
  | `operator` | ``"intersect"`` |
483
501
  | `value` | `string`[] |
484
502
 
485
503
  #### Defined in
486
504
 
487
- [lib/types.ts:526](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L526)
505
+ [lib/types.ts:526](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L526)
488
506
 
489
507
  ___
490
508
 
@@ -504,7 +522,7 @@ Checks if a given string field matches a given regular expression.
504
522
 
505
523
  | Name | Type | Description |
506
524
  | :------ | :------ | :------ |
507
- | `field` | `FilterKeys`<`T`, `string`\> | - |
525
+ | `field` | [`FilterKeys`](README.md#filterkeys)<`T`, `string`\> | - |
508
526
  | `operator` | ``"match"`` | - |
509
527
  | `options?` | { `dotAll?`: `boolean` ; `ignoreCase?`: `boolean` } | Regular expression options. |
510
528
  | `options.dotAll?` | `boolean` | Allows . to match newlines. |
@@ -514,7 +532,7 @@ Checks if a given string field matches a given regular expression.
514
532
 
515
533
  #### Defined in
516
534
 
517
- [lib/types.ts:497](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L497)
535
+ [lib/types.ts:497](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L497)
518
536
 
519
537
  ___
520
538
 
@@ -550,7 +568,7 @@ Handles an `input` query and returns an `output` promise, eventually using the `
550
568
 
551
569
  #### Defined in
552
570
 
553
- [lib/types.ts:23](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L23)
571
+ [lib/types.ts:23](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L23)
554
572
 
555
573
  ___
556
574
 
@@ -583,7 +601,7 @@ Handles an `input` query and returns an `output` promise.
583
601
 
584
602
  #### Defined in
585
603
 
586
- [lib/types.ts:31](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L31)
604
+ [lib/types.ts:31](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L31)
587
605
 
588
606
  ___
589
607
 
@@ -601,7 +619,7 @@ Order item.
601
619
 
602
620
  #### Defined in
603
621
 
604
- [lib/types.ts:338](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L338)
622
+ [lib/types.ts:338](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L338)
605
623
 
606
624
  ___
607
625
 
@@ -620,7 +638,7 @@ Query that fetches or mutates an entity.
620
638
 
621
639
  #### Defined in
622
640
 
623
- [lib/types.ts:80](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L80)
641
+ [lib/types.ts:80](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L80)
624
642
 
625
643
  ___
626
644
 
@@ -638,7 +656,7 @@ Query for computing an aggregated value.
638
656
 
639
657
  #### Defined in
640
658
 
641
- [lib/types.ts:329](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L329)
659
+ [lib/types.ts:329](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L329)
642
660
 
643
661
  ___
644
662
 
@@ -662,7 +680,7 @@ ___
662
680
 
663
681
  #### Defined in
664
682
 
665
- [lib/types.ts:102](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L102)
683
+ [lib/types.ts:102](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L102)
666
684
 
667
685
  ___
668
686
 
@@ -680,7 +698,7 @@ Query for creating an item.
680
698
 
681
699
  #### Defined in
682
700
 
683
- [lib/types.ts:244](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L244)
701
+ [lib/types.ts:244](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L244)
684
702
 
685
703
  ___
686
704
 
@@ -698,7 +716,7 @@ Query for creating multiple items.
698
716
 
699
717
  #### Defined in
700
718
 
701
- [lib/types.ts:252](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L252)
719
+ [lib/types.ts:252](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L252)
702
720
 
703
721
  ___
704
722
 
@@ -716,7 +734,7 @@ Query for deleting an item.
716
734
 
717
735
  #### Defined in
718
736
 
719
- [lib/types.ts:312](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L312)
737
+ [lib/types.ts:312](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L312)
720
738
 
721
739
  ___
722
740
 
@@ -734,7 +752,7 @@ Query for deleting multiple items.
734
752
 
735
753
  #### Defined in
736
754
 
737
- [lib/types.ts:320](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L320)
755
+ [lib/types.ts:320](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L320)
738
756
 
739
757
  ___
740
758
 
@@ -753,7 +771,7 @@ Query for getting a single item.
753
771
 
754
772
  #### Defined in
755
773
 
756
- [lib/types.ts:143](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L143)
774
+ [lib/types.ts:143](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L143)
757
775
 
758
776
  ___
759
777
 
@@ -772,7 +790,7 @@ Query for getting a list of items.
772
790
 
773
791
  #### Defined in
774
792
 
775
- [lib/types.ts:183](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L183)
793
+ [lib/types.ts:183](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L183)
776
794
 
777
795
  ___
778
796
 
@@ -784,7 +802,7 @@ Available query methods.
784
802
 
785
803
  #### Defined in
786
804
 
787
- [lib/types.ts:123](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L123)
805
+ [lib/types.ts:123](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L123)
788
806
 
789
807
  ___
790
808
 
@@ -803,7 +821,7 @@ Query for updating an item.
803
821
 
804
822
  #### Defined in
805
823
 
806
- [lib/types.ts:261](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L261)
824
+ [lib/types.ts:261](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L261)
807
825
 
808
826
  ___
809
827
 
@@ -822,7 +840,7 @@ Query for updating multiple items.
822
840
 
823
841
  #### Defined in
824
842
 
825
- [lib/types.ts:283](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L283)
843
+ [lib/types.ts:283](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L283)
826
844
 
827
845
  ___
828
846
 
@@ -847,7 +865,7 @@ ___
847
865
 
848
866
  #### Defined in
849
867
 
850
- [lib/types.ts:13](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L13)
868
+ [lib/types.ts:13](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L13)
851
869
 
852
870
  ## Functions
853
871
 
@@ -888,7 +906,7 @@ If a query occurs twice, `mergeQuery(query, currentQuery)` is called and the out
888
906
 
889
907
  #### Defined in
890
908
 
891
- [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/aggregate.ts#L16)
909
+ [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/aggregate.ts#L16)
892
910
 
893
911
  ___
894
912
 
@@ -930,7 +948,7 @@ const customFetch = combine(
930
948
 
931
949
  #### Defined in
932
950
 
933
- [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/branch.ts#L21)
951
+ [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/branch.ts#L21)
934
952
 
935
953
  ___
936
954
 
@@ -959,7 +977,7 @@ ___
959
977
 
960
978
  #### Defined in
961
979
 
962
- [lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/cache.ts#L39)
980
+ [lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/cache.ts#L39)
963
981
 
964
982
  ___
965
983
 
@@ -1032,7 +1050,7 @@ Handler that combines all provided handlers.
1032
1050
 
1033
1051
  #### Defined in
1034
1052
 
1035
- [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/combine.ts#L801)
1053
+ [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/combine.ts#L801)
1036
1054
 
1037
1055
  ___
1038
1056
 
@@ -1093,7 +1111,7 @@ typeof `query`
1093
1111
 
1094
1112
  #### Defined in
1095
1113
 
1096
- [lib/tools/defineCheckQuery.ts:3](https://github.com/nevoland/quetch/blob/4d845da/lib/tools/defineCheckQuery.ts#L3)
1114
+ [lib/tools/defineCheckQuery.ts:3](https://github.com/nevoland/quetch/blob/3a78cd1/lib/tools/defineCheckQuery.ts#L3)
1097
1115
 
1098
1116
  ___
1099
1117
 
@@ -1160,7 +1178,7 @@ ___
1160
1178
 
1161
1179
  #### Defined in
1162
1180
 
1163
- [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/4d845da/lib/tools/defineCustomFetch.ts#L11)
1181
+ [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/3a78cd1/lib/tools/defineCustomFetch.ts#L11)
1164
1182
 
1165
1183
  ___
1166
1184
 
@@ -1184,7 +1202,7 @@ Handler that returns a promise that resolves to the response.
1184
1202
 
1185
1203
  #### Defined in
1186
1204
 
1187
- [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/fetchExternal.ts#L12)
1205
+ [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/fetchExternal.ts#L12)
1188
1206
 
1189
1207
  ___
1190
1208
 
@@ -1209,7 +1227,7 @@ Promise that resolves to the response.
1209
1227
 
1210
1228
  #### Defined in
1211
1229
 
1212
- [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/fetchLocal.ts#L9)
1230
+ [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/fetchLocal.ts#L9)
1213
1231
 
1214
1232
  ___
1215
1233
 
@@ -1235,7 +1253,7 @@ ___
1235
1253
 
1236
1254
  #### Defined in
1237
1255
 
1238
- [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/4d845da/lib/tools/filterFromContext.ts#L5)
1256
+ [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/3a78cd1/lib/tools/filterFromContext.ts#L5)
1239
1257
 
1240
1258
  ___
1241
1259
 
@@ -1266,7 +1284,7 @@ Checks wether the provided `value` matches the `filter` or not.
1266
1284
 
1267
1285
  #### Defined in
1268
1286
 
1269
- [lib/tools/filterItem.ts:12](https://github.com/nevoland/quetch/blob/4d845da/lib/tools/filterItem.ts#L12)
1287
+ [lib/tools/filterItem.ts:12](https://github.com/nevoland/quetch/blob/3a78cd1/lib/tools/filterItem.ts#L12)
1270
1288
 
1271
1289
  ___
1272
1290
 
@@ -1296,7 +1314,7 @@ ___
1296
1314
 
1297
1315
  #### Defined in
1298
1316
 
1299
- [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/identity.ts#L3)
1317
+ [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/identity.ts#L3)
1300
1318
 
1301
1319
  ___
1302
1320
 
@@ -1318,7 +1336,7 @@ Handles an `input` query and returns an `output` promise.
1318
1336
 
1319
1337
  #### Defined in
1320
1338
 
1321
- [lib/types.ts:31](https://github.com/nevoland/quetch/blob/4d845da/lib/types.ts#L31)
1339
+ [lib/types.ts:31](https://github.com/nevoland/quetch/blob/3a78cd1/lib/types.ts#L31)
1322
1340
 
1323
1341
  ___
1324
1342
 
@@ -1351,7 +1369,7 @@ Query handler
1351
1369
 
1352
1370
  #### Defined in
1353
1371
 
1354
- [lib/middlewares/log.ts:11](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/log.ts#L11)
1372
+ [lib/middlewares/log.ts:11](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/log.ts#L11)
1355
1373
 
1356
1374
  ___
1357
1375
 
@@ -1382,7 +1400,7 @@ ___
1382
1400
 
1383
1401
  #### Defined in
1384
1402
 
1385
- [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/4d845da/lib/tools/normalizeOrder.ts#L3)
1403
+ [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/3a78cd1/lib/tools/normalizeOrder.ts#L3)
1386
1404
 
1387
1405
  ___
1388
1406
 
@@ -1409,7 +1427,7 @@ ___
1409
1427
 
1410
1428
  #### Defined in
1411
1429
 
1412
- [lib/tools/queryItemList.ts:41](https://github.com/nevoland/quetch/blob/4d845da/lib/tools/queryItemList.ts#L41)
1430
+ [lib/tools/queryItemList.ts:41](https://github.com/nevoland/quetch/blob/3a78cd1/lib/tools/queryItemList.ts#L41)
1413
1431
 
1414
1432
  ___
1415
1433
 
@@ -1438,7 +1456,7 @@ Handler
1438
1456
 
1439
1457
  #### Defined in
1440
1458
 
1441
- [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/4d845da/lib/middlewares/retry.ts#L15)
1459
+ [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/3a78cd1/lib/middlewares/retry.ts#L15)
1442
1460
 
1443
1461
  ___
1444
1462
 
@@ -1469,4 +1487,4 @@ The same array sorted in place.
1469
1487
 
1470
1488
  #### Defined in
1471
1489
 
1472
- [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/4d845da/lib/tools/sortItemList.ts#L12)
1490
+ [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/3a78cd1/lib/tools/sortItemList.ts#L12)
package/lib/types.ts CHANGED
@@ -84,10 +84,9 @@ export type Query<T extends object, C extends CustomFieldMap<T>> =
84
84
  | QueryCreateMultiple<T>
85
85
  | QueryUpdate<T, C>
86
86
  | QueryUpdateMultiple<T, C>
87
- | QueryDelete<T>
88
- | QueryDeleteMultiple<T>
89
- // TODO: Handle custom fields
90
- | QueryAggregate<T>;
87
+ | QueryDelete<T, C>
88
+ | QueryDeleteMultiple<T, C>
89
+ | QueryAggregate<T, C>;
91
90
 
92
91
  export type AnyQuery = Query<any, any>;
93
92
 
@@ -309,27 +308,36 @@ export type QueryUpdateMultiple<
309
308
  /**
310
309
  * Query for deleting an item.
311
310
  */
312
- export type QueryDelete<T extends object> = QueryBase<T> & {
311
+ export type QueryDelete<
312
+ T extends object,
313
+ C extends CustomFieldMap<T>,
314
+ > = QueryBase<T> & {
313
315
  method: "delete";
314
- filter?: Filter<T>;
316
+ filter?: Filter<InjectCustomField<T, C>>;
315
317
  };
316
318
 
317
319
  /**
318
320
  * Query for deleting multiple items.
319
321
  */
320
- export type QueryDeleteMultiple<T extends object> = QueryBase<T> & {
322
+ export type QueryDeleteMultiple<
323
+ T extends object,
324
+ C extends CustomFieldMap<T>,
325
+ > = QueryBase<T> & {
321
326
  method: "delete";
322
327
  multiple: true;
323
- filter?: Filter<T>;
328
+ filter?: Filter<InjectCustomField<T, C>>;
324
329
  };
325
330
 
326
331
  /**
327
332
  * Query for computing an aggregated value.
328
333
  */
329
- export type QueryAggregate<T extends object> = QueryBase<T> & {
334
+ export type QueryAggregate<
335
+ T extends object,
336
+ C extends CustomFieldMap<T>,
337
+ > = QueryBase<T> & {
330
338
  method: "aggregate";
331
- aggregator: AggregateFunction<T>;
332
- filter?: Filter<T>;
339
+ aggregator: AggregateFunction<InjectCustomField<T, C>>;
340
+ filter?: Filter<InjectCustomField<T, C>>;
333
341
  };
334
342
 
335
343
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quetch",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "./dist/main.js",
6
6
  "exports": {