quetch 0.9.0 → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  import type { Filter, FilterGroup } from "../types";
2
2
  /**
3
- * Return `true` if the provided filter `value` is a group filter or not.
3
+ * Returns `true` if the provided filter `value` is a group filter or not.
4
4
  *
5
5
  * @param value The filter to test.
6
6
  * @returns Whether the provided filter is a group filter or not.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Return `true` if the provided filter `value` is a group filter or not.
2
+ * Returns `true` if the provided filter `value` is a group filter or not.
3
3
  *
4
4
  * @param value The filter to test.
5
5
  * @returns Whether the provided filter is a group filter or not.
package/dist/tools.d.ts CHANGED
@@ -6,6 +6,7 @@ export { escapeRegex } from "./tools/escapeRegex.js";
6
6
  export { filterChildren } from "./tools/filterChildren.js";
7
7
  export { filterFromContext } from "./tools/filterFromContext.js";
8
8
  export { filterItem } from "./tools/filterItem.js";
9
+ export { isFilterGroup } from "./tools/isFilterGroup.js";
9
10
  export { normalizeOrder } from "./tools/normalizeOrder.js";
10
11
  export { queryItemList } from "./tools/queryItemList.js";
11
12
  export { sortItemList } from "./tools/sortItemList.js";
package/dist/tools.js CHANGED
@@ -7,6 +7,7 @@ export { escapeRegex } from "./tools/escapeRegex.js";
7
7
  export { filterChildren } from "./tools/filterChildren.js";
8
8
  export { filterFromContext } from "./tools/filterFromContext.js";
9
9
  export { filterItem } from "./tools/filterItem.js";
10
+ export { isFilterGroup } from "./tools/isFilterGroup.js";
10
11
  export { normalizeOrder } from "./tools/normalizeOrder.js";
11
12
  export { queryItemList } from "./tools/queryItemList.js";
12
13
  export { sortItemList } from "./tools/sortItemList.js";
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../lib/tools.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../lib/tools.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { FilterArray } from "./FilterArray";
2
2
  import type { FilterBoolean } from "./FilterBoolean";
3
3
  import type { FilterChildren } from "./FilterChildren";
4
+ import type { FilterCustom } from "./FilterCustom";
4
5
  import type { FilterField } from "./FilterField";
5
6
  import type { FilterGroup } from "./FilterGroup";
6
7
  import type { FilterNumber } from "./FilterNumber";
@@ -10,4 +11,4 @@ import type { FilterStringMatch } from "./FilterStringMatch";
10
11
  /**
11
12
  * Describes a predicate for filtering items.
12
13
  */
13
- export type Filter<T extends object> = FilterArray<T> | FilterBoolean<T> | FilterChildren<T> | FilterField<T> | FilterNumber<T> | FilterGroup<T> | FilterString<T> | FilterStringIntersect<T> | FilterStringMatch<T>;
14
+ export type Filter<T extends object> = FilterArray<T> | FilterBoolean<T> | FilterChildren<T> | FilterCustom<T> | FilterField<T> | FilterNumber<T> | FilterGroup<T> | FilterString<T> | FilterStringIntersect<T> | FilterStringMatch<T>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Custom filter where `value(item)` returns `true` for matching items.
3
+ */
4
+ export type FilterCustom<T extends object> = {
5
+ operator: "custom";
6
+ value: (item: T) => boolean;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterCustom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterCustom.js","sourceRoot":"","sources":["../../lib/types/FilterCustom.ts"],"names":[],"mappings":""}
package/doc/README.md CHANGED
@@ -76,6 +76,7 @@ quetch
76
76
  - [filterFromContext](README.md#filterfromcontext)
77
77
  - [filterItem](README.md#filteritem)
78
78
  - [identity](README.md#identity)
79
+ - [isFilterGroup](README.md#isfiltergroup)
79
80
  - [log](README.md#log)
80
81
  - [normalizeOrder](README.md#normalizeorder)
81
82
  - [queryItemList](README.md#queryitemlist)
@@ -98,7 +99,7 @@ Aggregation function.
98
99
 
99
100
  #### Defined in
100
101
 
101
- [lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/AggregateFunction.ts#L4)
102
+ [lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/AggregateFunction.ts#L4)
102
103
 
103
104
  ___
104
105
 
@@ -108,7 +109,7 @@ ___
108
109
 
109
110
  #### Defined in
110
111
 
111
- [lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/AggregateFunctionOperator.ts#L3)
112
+ [lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/AggregateFunctionOperator.ts#L3)
112
113
 
113
114
  ___
114
115
 
@@ -118,7 +119,7 @@ ___
118
119
 
119
120
  #### Defined in
120
121
 
121
- [lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Any.ts#L1)
122
+ [lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Any.ts#L1)
122
123
 
123
124
  ___
124
125
 
@@ -134,7 +135,7 @@ ___
134
135
 
135
136
  #### Defined in
136
137
 
137
- [lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Context.ts#L1)
138
+ [lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Context.ts#L1)
138
139
 
139
140
  ___
140
141
 
@@ -150,7 +151,7 @@ ___
150
151
 
151
152
  #### Defined in
152
153
 
153
- [lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/CustomFieldAggregateMap.ts#L3)
154
+ [lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/CustomFieldAggregateMap.ts#L3)
154
155
 
155
156
  ___
156
157
 
@@ -166,7 +167,7 @@ ___
166
167
 
167
168
  #### Defined in
168
169
 
169
- [lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/CustomFieldMap.ts#L3)
170
+ [lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/CustomFieldMap.ts#L3)
170
171
 
171
172
  ___
172
173
 
@@ -192,7 +193,7 @@ ___
192
193
 
193
194
  #### Defined in
194
195
 
195
- [lib/types/CustomRequest.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/CustomRequest.ts#L4)
196
+ [lib/types/CustomRequest.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/CustomRequest.ts#L4)
196
197
 
197
198
  ___
198
199
 
@@ -208,7 +209,7 @@ ___
208
209
 
209
210
  #### Defined in
210
211
 
211
- [lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FieldFunction.ts#L4)
212
+ [lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FieldFunction.ts#L4)
212
213
 
213
214
  ___
214
215
 
@@ -233,7 +234,7 @@ Applies a custom field transform function.
233
234
 
234
235
  #### Defined in
235
236
 
236
- [lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FieldFunctionCustom.ts#L4)
237
+ [lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FieldFunctionCustom.ts#L4)
237
238
 
238
239
  ___
239
240
 
@@ -259,7 +260,7 @@ Formats the date found in a given field, which can be an ISO string date or a ti
259
260
 
260
261
  #### Defined in
261
262
 
262
- [lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FieldFunctionFormatDate.ts#L6)
263
+ [lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FieldFunctionFormatDate.ts#L6)
263
264
 
264
265
  ___
265
266
 
@@ -277,13 +278,13 @@ Return types of custom field functions.
277
278
 
278
279
  #### Defined in
279
280
 
280
- [lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FieldFunctionReturn.ts#L4)
281
+ [lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FieldFunctionReturn.ts#L4)
281
282
 
282
283
  ___
283
284
 
284
285
  ### Filter
285
286
 
286
- Ƭ **Filter**<`T`\>: [`FilterArray`](README.md#filterarray)<`T`\> \| [`FilterBoolean`](README.md#filterboolean)<`T`\> \| [`FilterChildren`](README.md#filterchildren)<`T`\> \| [`FilterField`](README.md#filterfield)<`T`\> \| [`FilterNumber`](README.md#filternumber)<`T`\> \| [`FilterGroup`](README.md#filtergroup)<`T`\> \| [`FilterString`](README.md#filterstring)<`T`\> \| [`FilterStringIntersect`](README.md#filterstringintersect)<`T`\> \| [`FilterStringMatch`](README.md#filterstringmatch)<`T`\>
287
+ Ƭ **Filter**<`T`\>: [`FilterArray`](README.md#filterarray)<`T`\> \| [`FilterBoolean`](README.md#filterboolean)<`T`\> \| [`FilterChildren`](README.md#filterchildren)<`T`\> \| `FilterCustom`<`T`\> \| [`FilterField`](README.md#filterfield)<`T`\> \| [`FilterNumber`](README.md#filternumber)<`T`\> \| [`FilterGroup`](README.md#filtergroup)<`T`\> \| [`FilterString`](README.md#filterstring)<`T`\> \| [`FilterStringIntersect`](README.md#filterstringintersect)<`T`\> \| [`FilterStringMatch`](README.md#filterstringmatch)<`T`\>
287
288
 
288
289
  Describes a predicate for filtering items.
289
290
 
@@ -295,7 +296,7 @@ Describes a predicate for filtering items.
295
296
 
296
297
  #### Defined in
297
298
 
298
- [lib/types/Filter.ts:14](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Filter.ts#L14)
299
+ [lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Filter.ts#L15)
299
300
 
300
301
  ___
301
302
 
@@ -322,7 +323,7 @@ Checks if a given array field matches a given array value according to a given o
322
323
 
323
324
  #### Defined in
324
325
 
325
- [lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterArray.ts#L7)
326
+ [lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterArray.ts#L7)
326
327
 
327
328
  ___
328
329
 
@@ -348,7 +349,7 @@ Checks if a given boolean field is `true` or `false`.
348
349
 
349
350
  #### Defined in
350
351
 
351
- [lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterBoolean.ts#L6)
352
+ [lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterBoolean.ts#L6)
352
353
 
353
354
  ___
354
355
 
@@ -376,7 +377,7 @@ If `deep` is `true`, also captures all the descendants.
376
377
 
377
378
  #### Defined in
378
379
 
379
- [lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterChildren.ts#L10)
380
+ [lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterChildren.ts#L10)
380
381
 
381
382
  ___
382
383
 
@@ -401,7 +402,7 @@ Checks if a given field exists.
401
402
 
402
403
  #### Defined in
403
404
 
404
- [lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterField.ts#L4)
405
+ [lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterField.ts#L4)
405
406
 
406
407
  ___
407
408
 
@@ -419,7 +420,7 @@ Joins a list of filters with a specific boolean operator.
419
420
 
420
421
  #### Defined in
421
422
 
422
- [lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterGroup.ts#L6)
423
+ [lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterGroup.ts#L6)
423
424
 
424
425
  ___
425
426
 
@@ -438,7 +439,7 @@ Returns object type with field extending the provided `P` type.
438
439
 
439
440
  #### Defined in
440
441
 
441
- [lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterKeys.ts#L4)
442
+ [lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterKeys.ts#L4)
442
443
 
443
444
  ___
444
445
 
@@ -464,7 +465,7 @@ Checks if a given number field matches a given number value according to a given
464
465
 
465
466
  #### Defined in
466
467
 
467
- [lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterNumber.ts#L6)
468
+ [lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterNumber.ts#L6)
468
469
 
469
470
  ___
470
471
 
@@ -474,7 +475,7 @@ ___
474
475
 
475
476
  #### Defined in
476
477
 
477
- [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterOperator.ts#L3)
478
+ [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterOperator.ts#L3)
478
479
 
479
480
  ___
480
481
 
@@ -500,7 +501,7 @@ Checks if a given string field matches a given string value according to a given
500
501
 
501
502
  #### Defined in
502
503
 
503
- [lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterString.ts#L6)
504
+ [lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterString.ts#L6)
504
505
 
505
506
  ___
506
507
 
@@ -526,7 +527,7 @@ Checks if a given string field has any of the provided values.
526
527
 
527
528
  #### Defined in
528
529
 
529
- [lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterStringIntersect.ts#L6)
530
+ [lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterStringIntersect.ts#L6)
530
531
 
531
532
  ___
532
533
 
@@ -556,7 +557,7 @@ Checks if a given string field matches a given regular expression.
556
557
 
557
558
  #### Defined in
558
559
 
559
- [lib/types/FilterStringMatch.ts:8](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/FilterStringMatch.ts#L8)
560
+ [lib/types/FilterStringMatch.ts:8](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/FilterStringMatch.ts#L8)
560
561
 
561
562
  ___
562
563
 
@@ -576,7 +577,7 @@ Returns the type of the property at the specified `K` key.
576
577
 
577
578
  #### Defined in
578
579
 
579
- [lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Get.ts#L4)
580
+ [lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Get.ts#L4)
580
581
 
581
582
  ___
582
583
 
@@ -594,7 +595,7 @@ Specifies how items should be grouped.
594
595
 
595
596
  #### Defined in
596
597
 
597
- [lib/types/Group.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Group.ts#L6)
598
+ [lib/types/Group.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Group.ts#L6)
598
599
 
599
600
  ___
600
601
 
@@ -630,7 +631,7 @@ Handles an `input` query and returns an `output` promise, eventually using the `
630
631
 
631
632
  #### Defined in
632
633
 
633
- [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Handler.ts#L6)
634
+ [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Handler.ts#L6)
634
635
 
635
636
  ___
636
637
 
@@ -646,7 +647,7 @@ ___
646
647
 
647
648
  #### Defined in
648
649
 
649
- [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Immutable.ts#L1)
650
+ [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Immutable.ts#L1)
650
651
 
651
652
  ___
652
653
 
@@ -665,7 +666,7 @@ Injects the custom fields into the entity type.
665
666
 
666
667
  #### Defined in
667
668
 
668
- [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/InjectCustomFields.ts#L8)
669
+ [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/InjectCustomFields.ts#L8)
669
670
 
670
671
  ___
671
672
 
@@ -684,7 +685,7 @@ Returns the inferred item type of an array, or an alternative type if it is some
684
685
 
685
686
  #### Defined in
686
687
 
687
- [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Item.ts#L4)
688
+ [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Item.ts#L4)
688
689
 
689
690
  ___
690
691
 
@@ -694,7 +695,7 @@ ___
694
695
 
695
696
  #### Defined in
696
697
 
697
- [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Key.ts#L1)
698
+ [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Key.ts#L1)
698
699
 
699
700
  ___
700
701
 
@@ -710,7 +711,7 @@ ___
710
711
 
711
712
  #### Defined in
712
713
 
713
- [lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Mutable.ts#L1)
714
+ [lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Mutable.ts#L1)
714
715
 
715
716
  ___
716
717
 
@@ -743,7 +744,7 @@ Handles an `input` query and returns an `output` promise.
743
744
 
744
745
  #### Defined in
745
746
 
746
- [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/NextHandler.ts#L4)
747
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/NextHandler.ts#L4)
747
748
 
748
749
  ___
749
750
 
@@ -761,7 +762,7 @@ Order item.
761
762
 
762
763
  #### Defined in
763
764
 
764
- [lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Order.ts#L4)
765
+ [lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Order.ts#L4)
765
766
 
766
767
  ___
767
768
 
@@ -782,7 +783,7 @@ Query that fetches or mutates an entity.
782
783
 
783
784
  #### Defined in
784
785
 
785
- [lib/types/Query.ts:29](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Query.ts#L29)
786
+ [lib/types/Query.ts:29](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Query.ts#L29)
786
787
 
787
788
  ___
788
789
 
@@ -808,7 +809,7 @@ Query for computing an aggregated value.
808
809
 
809
810
  #### Defined in
810
811
 
811
- [lib/types/QueryAggregate.ts:7](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryAggregate.ts#L7)
812
+ [lib/types/QueryAggregate.ts:7](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryAggregate.ts#L7)
812
813
 
813
814
  ___
814
815
 
@@ -818,7 +819,7 @@ ___
818
819
 
819
820
  #### Defined in
820
821
 
821
- [lib/types/QueryAny.ts:5](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryAny.ts#L5)
822
+ [lib/types/QueryAny.ts:5](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryAny.ts#L5)
822
823
 
823
824
  ___
824
825
 
@@ -844,7 +845,7 @@ Query for creating an item.
844
845
 
845
846
  #### Defined in
846
847
 
847
- [lib/types/QueryCreate.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryCreate.ts#L4)
848
+ [lib/types/QueryCreate.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryCreate.ts#L4)
848
849
 
849
850
  ___
850
851
 
@@ -870,7 +871,7 @@ Query for creating multiple items.
870
871
 
871
872
  #### Defined in
872
873
 
873
- [lib/types/QueryCreateMultiple.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryCreateMultiple.ts#L4)
874
+ [lib/types/QueryCreateMultiple.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryCreateMultiple.ts#L4)
874
875
 
875
876
  ___
876
877
 
@@ -897,7 +898,7 @@ Query for deleting an item.
897
898
 
898
899
  #### Defined in
899
900
 
900
- [lib/types/QueryDelete.ts:7](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryDelete.ts#L7)
901
+ [lib/types/QueryDelete.ts:7](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryDelete.ts#L7)
901
902
 
902
903
  ___
903
904
 
@@ -924,7 +925,7 @@ Query for deleting multiple items.
924
925
 
925
926
  #### Defined in
926
927
 
927
- [lib/types/QueryDeleteMultiple.ts:7](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryDeleteMultiple.ts#L7)
928
+ [lib/types/QueryDeleteMultiple.ts:7](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryDeleteMultiple.ts#L7)
928
929
 
929
930
  ___
930
931
 
@@ -936,7 +937,7 @@ Available query methods.
936
937
 
937
938
  #### Defined in
938
939
 
939
- [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryMethod.ts#L6)
940
+ [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryMethod.ts#L6)
940
941
 
941
942
  ___
942
943
 
@@ -967,7 +968,7 @@ Query for reading a single item.
967
968
 
968
969
  #### Defined in
969
970
 
970
- [lib/types/QueryRead.ts:7](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryRead.ts#L7)
971
+ [lib/types/QueryRead.ts:7](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryRead.ts#L7)
971
972
 
972
973
  ___
973
974
 
@@ -998,7 +999,7 @@ Query for getting a list of items.
998
999
 
999
1000
  #### Defined in
1000
1001
 
1001
- [lib/types/QueryReadMultiple.ts:8](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryReadMultiple.ts#L8)
1002
+ [lib/types/QueryReadMultiple.ts:8](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryReadMultiple.ts#L8)
1002
1003
 
1003
1004
  ___
1004
1005
 
@@ -1022,7 +1023,7 @@ ___
1022
1023
 
1023
1024
  #### Defined in
1024
1025
 
1025
- [lib/types/QuerySettings.ts:5](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QuerySettings.ts#L5)
1026
+ [lib/types/QuerySettings.ts:5](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QuerySettings.ts#L5)
1026
1027
 
1027
1028
  ___
1028
1029
 
@@ -1052,7 +1053,7 @@ Query for updating an item.
1052
1053
 
1053
1054
  #### Defined in
1054
1055
 
1055
- [lib/types/QueryUpdate.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryUpdate.ts#L6)
1056
+ [lib/types/QueryUpdate.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryUpdate.ts#L6)
1056
1057
 
1057
1058
  ___
1058
1059
 
@@ -1082,7 +1083,7 @@ Query for updating multiple items.
1082
1083
 
1083
1084
  #### Defined in
1084
1085
 
1085
- [lib/types/QueryUpdateMultiple.ts:7](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/QueryUpdateMultiple.ts#L7)
1086
+ [lib/types/QueryUpdateMultiple.ts:7](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/QueryUpdateMultiple.ts#L7)
1086
1087
 
1087
1088
  ___
1088
1089
 
@@ -1101,7 +1102,7 @@ ___
1101
1102
 
1102
1103
  #### Defined in
1103
1104
 
1104
- [lib/types/Result.ts:26](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Result.ts#L26)
1105
+ [lib/types/Result.ts:26](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Result.ts#L26)
1105
1106
 
1106
1107
  ___
1107
1108
 
@@ -1126,7 +1127,7 @@ ___
1126
1127
 
1127
1128
  #### Defined in
1128
1129
 
1129
- [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/Store.ts#L2)
1130
+ [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/Store.ts#L2)
1130
1131
 
1131
1132
  ## Functions
1132
1133
 
@@ -1167,7 +1168,7 @@ If a query occurs twice, `mergeQuery(query, currentQuery)` is called and the out
1167
1168
 
1168
1169
  #### Defined in
1169
1170
 
1170
- [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/aggregate.ts#L16)
1171
+ [lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/aggregate.ts#L16)
1171
1172
 
1172
1173
  ___
1173
1174
 
@@ -1209,7 +1210,7 @@ const customFetch = combine(
1209
1210
 
1210
1211
  #### Defined in
1211
1212
 
1212
- [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/branch.ts#L21)
1213
+ [lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/branch.ts#L21)
1213
1214
 
1214
1215
  ___
1215
1216
 
@@ -1238,7 +1239,7 @@ ___
1238
1239
 
1239
1240
  #### Defined in
1240
1241
 
1241
- [lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/cache.ts#L39)
1242
+ [lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/cache.ts#L39)
1242
1243
 
1243
1244
  ___
1244
1245
 
@@ -1311,7 +1312,7 @@ Handler that combines all provided handlers.
1311
1312
 
1312
1313
  #### Defined in
1313
1314
 
1314
- [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/combine.ts#L801)
1315
+ [lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/combine.ts#L801)
1315
1316
 
1316
1317
  ___
1317
1318
 
@@ -1333,7 +1334,7 @@ Uncallable handler used to terminate a sequence of handlers combined with `combi
1333
1334
 
1334
1335
  #### Defined in
1335
1336
 
1336
- [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/NextHandler.ts#L4)
1337
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/NextHandler.ts#L4)
1337
1338
 
1338
1339
  ___
1339
1340
 
@@ -1398,7 +1399,7 @@ typeof `query`
1398
1399
 
1399
1400
  #### Defined in
1400
1401
 
1401
- [lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/defineCheckQuery.ts#L8)
1402
+ [lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/defineCheckQuery.ts#L8)
1402
1403
 
1403
1404
  ___
1404
1405
 
@@ -1505,7 +1506,7 @@ ___
1505
1506
 
1506
1507
  #### Defined in
1507
1508
 
1508
- [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/defineCustomFetch.ts#L11)
1509
+ [lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/defineCustomFetch.ts#L11)
1509
1510
 
1510
1511
  ___
1511
1512
 
@@ -1580,7 +1581,7 @@ ___
1580
1581
 
1581
1582
  #### Defined in
1582
1583
 
1583
- [lib/tools/defineGenericFetch.ts:5](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/defineGenericFetch.ts#L5)
1584
+ [lib/tools/defineGenericFetch.ts:5](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/defineGenericFetch.ts#L5)
1584
1585
 
1585
1586
  ___
1586
1587
 
@@ -1604,7 +1605,7 @@ Escaped regular expression
1604
1605
 
1605
1606
  #### Defined in
1606
1607
 
1607
- [lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/escapeRegex.ts#L7)
1608
+ [lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/escapeRegex.ts#L7)
1608
1609
 
1609
1610
  ___
1610
1611
 
@@ -1628,7 +1629,7 @@ Handler that returns a promise that resolves to the response.
1628
1629
 
1629
1630
  #### Defined in
1630
1631
 
1631
- [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/fetchExternal.ts#L12)
1632
+ [lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/fetchExternal.ts#L12)
1632
1633
 
1633
1634
  ___
1634
1635
 
@@ -1652,7 +1653,7 @@ Promise that resolves to the response.
1652
1653
 
1653
1654
  #### Defined in
1654
1655
 
1655
- [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/fetchLocal.ts#L9)
1656
+ [lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/fetchLocal.ts#L9)
1656
1657
 
1657
1658
  ▸ **fetchLocal**<`T`, `C`\>(): [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, `C`\> & { `customFields`: `C` ; `type`: `T`[] }, `any`, `never`, `never`\>
1658
1659
 
@@ -1669,7 +1670,7 @@ Promise that resolves to the response.
1669
1670
 
1670
1671
  #### Defined in
1671
1672
 
1672
- [lib/middlewares/fetchLocal.ts:15](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/fetchLocal.ts#L15)
1673
+ [lib/middlewares/fetchLocal.ts:15](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/fetchLocal.ts#L15)
1673
1674
 
1674
1675
  ___
1675
1676
 
@@ -1698,7 +1699,7 @@ ___
1698
1699
 
1699
1700
  #### Defined in
1700
1701
 
1701
- [lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/filterChildren.ts#L5)
1702
+ [lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/filterChildren.ts#L5)
1702
1703
 
1703
1704
  ___
1704
1705
 
@@ -1724,7 +1725,7 @@ ___
1724
1725
 
1725
1726
  #### Defined in
1726
1727
 
1727
- [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/filterFromContext.ts#L5)
1728
+ [lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/filterFromContext.ts#L5)
1728
1729
 
1729
1730
  ___
1730
1731
 
@@ -1756,7 +1757,7 @@ Checks wether the provided `value` matches the `filter` or not.
1756
1757
 
1757
1758
  #### Defined in
1758
1759
 
1759
- [lib/tools/filterItem.ts:17](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/filterItem.ts#L17)
1760
+ [lib/tools/filterItem.ts:17](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/filterItem.ts#L17)
1760
1761
 
1761
1762
  ___
1762
1763
 
@@ -1786,7 +1787,37 @@ ___
1786
1787
 
1787
1788
  #### Defined in
1788
1789
 
1789
- [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/identity.ts#L3)
1790
+ [lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/identity.ts#L3)
1791
+
1792
+ ___
1793
+
1794
+ ### isFilterGroup
1795
+
1796
+ ▸ **isFilterGroup**<`T`\>(`value`): value is FilterGroup<T\>
1797
+
1798
+ Returns `true` if the provided filter `value` is a group filter or not.
1799
+
1800
+ #### Type parameters
1801
+
1802
+ | Name | Type |
1803
+ | :------ | :------ |
1804
+ | `T` | extends `object` |
1805
+
1806
+ #### Parameters
1807
+
1808
+ | Name | Type | Description |
1809
+ | :------ | :------ | :------ |
1810
+ | `value` | `undefined` \| [`Filter`](README.md#filter)<`T`\> | The filter to test. |
1811
+
1812
+ #### Returns
1813
+
1814
+ value is FilterGroup<T\>
1815
+
1816
+ Whether the provided filter is a group filter or not.
1817
+
1818
+ #### Defined in
1819
+
1820
+ [lib/tools/isFilterGroup.ts:9](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/isFilterGroup.ts#L9)
1790
1821
 
1791
1822
  ___
1792
1823
 
@@ -1819,7 +1850,7 @@ Query handler
1819
1850
 
1820
1851
  #### Defined in
1821
1852
 
1822
- [lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/log.ts#L13)
1853
+ [lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/log.ts#L13)
1823
1854
 
1824
1855
  ___
1825
1856
 
@@ -1850,7 +1881,7 @@ ___
1850
1881
 
1851
1882
  #### Defined in
1852
1883
 
1853
- [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/normalizeOrder.ts#L3)
1884
+ [lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/normalizeOrder.ts#L3)
1854
1885
 
1855
1886
  ___
1856
1887
 
@@ -1877,7 +1908,7 @@ ___
1877
1908
 
1878
1909
  #### Defined in
1879
1910
 
1880
- [lib/tools/queryItemList.ts:43](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/queryItemList.ts#L43)
1911
+ [lib/tools/queryItemList.ts:43](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/queryItemList.ts#L43)
1881
1912
 
1882
1913
  ▸ **queryItemList**<`T`, `Q`, `C`\>(`query`): [`Result`](README.md#result)<`T`, `Q`, `C`\>
1883
1914
 
@@ -1901,7 +1932,7 @@ ___
1901
1932
 
1902
1933
  #### Defined in
1903
1934
 
1904
- [lib/tools/queryItemList.ts:46](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/queryItemList.ts#L46)
1935
+ [lib/tools/queryItemList.ts:46](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/queryItemList.ts#L46)
1905
1936
 
1906
1937
  ___
1907
1938
 
@@ -1930,7 +1961,7 @@ Handler
1930
1961
 
1931
1962
  #### Defined in
1932
1963
 
1933
- [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/af55a6c/lib/middlewares/retry.ts#L15)
1964
+ [lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/91f8b5b/lib/middlewares/retry.ts#L15)
1934
1965
 
1935
1966
  ___
1936
1967
 
@@ -1961,4 +1992,4 @@ The same array sorted in place.
1961
1992
 
1962
1993
  #### Defined in
1963
1994
 
1964
- [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/af55a6c/lib/tools/sortItemList.ts#L12)
1995
+ [lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/91f8b5b/lib/tools/sortItemList.ts#L12)
@@ -32,7 +32,7 @@
32
32
 
33
33
  #### Defined in
34
34
 
35
- [lib/types/CustomFetch.ts:6](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/CustomFetch.ts#L6)
35
+ [lib/types/CustomFetch.ts:6](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/CustomFetch.ts#L6)
36
36
 
37
37
  ### CustomFetch
38
38
 
@@ -57,4 +57,4 @@
57
57
 
58
58
  #### Defined in
59
59
 
60
- [lib/types/CustomFetch.ts:9](https://github.com/nevoland/quetch/blob/af55a6c/lib/types/CustomFetch.ts#L9)
60
+ [lib/types/CustomFetch.ts:9](https://github.com/nevoland/quetch/blob/91f8b5b/lib/types/CustomFetch.ts#L9)
@@ -1,7 +1,7 @@
1
1
  import type { Filter, FilterGroup } from "../types";
2
2
 
3
3
  /**
4
- * Return `true` if the provided filter `value` is a group filter or not.
4
+ * Returns `true` if the provided filter `value` is a group filter or not.
5
5
  *
6
6
  * @param value The filter to test.
7
7
  * @returns Whether the provided filter is a group filter or not.
package/lib/tools.ts CHANGED
@@ -7,6 +7,7 @@ export { escapeRegex } from "./tools/escapeRegex.js";
7
7
  export { filterChildren } from "./tools/filterChildren.js";
8
8
  export { filterFromContext } from "./tools/filterFromContext.js";
9
9
  export { filterItem } from "./tools/filterItem.js";
10
+ export { isFilterGroup } from "./tools/isFilterGroup.js";
10
11
  export { normalizeOrder } from "./tools/normalizeOrder.js";
11
12
  export { queryItemList } from "./tools/queryItemList.js";
12
13
  export { sortItemList } from "./tools/sortItemList.js";
@@ -1,6 +1,7 @@
1
1
  import type { FilterArray } from "./FilterArray";
2
2
  import type { FilterBoolean } from "./FilterBoolean";
3
3
  import type { FilterChildren } from "./FilterChildren";
4
+ import type { FilterCustom } from "./FilterCustom";
4
5
  import type { FilterField } from "./FilterField";
5
6
  import type { FilterGroup } from "./FilterGroup";
6
7
  import type { FilterNumber } from "./FilterNumber";
@@ -15,6 +16,7 @@ export type Filter<T extends object> =
15
16
  | FilterArray<T>
16
17
  | FilterBoolean<T>
17
18
  | FilterChildren<T>
19
+ | FilterCustom<T>
18
20
  | FilterField<T>
19
21
  | FilterNumber<T>
20
22
  | FilterGroup<T>
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Custom filter where `value(item)` returns `true` for matching items.
3
+ */
4
+ export type FilterCustom<T extends object> = {
5
+ operator: "custom";
6
+ value: (item: T) => boolean;
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quetch",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "main": "./dist/main.js",
6
6
  "exports": {