quetch 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/groupFilters.d.ts +13 -0
- package/dist/tools/groupFilters.js +30 -0
- package/dist/tools/groupFilters.js.map +1 -0
- package/dist/tools.d.ts +1 -0
- package/dist/tools.js +1 -0
- package/dist/tools.js.map +1 -1
- package/doc/README.md +1 -0
- package/doc/classes/RequestError.md +5 -5
- package/doc/functions/aggregate.md +1 -1
- package/doc/functions/branch.md +1 -1
- package/doc/functions/cache.md +1 -1
- package/doc/functions/combine.md +1 -1
- package/doc/functions/cork.md +1 -1
- package/doc/functions/defineCheckQuery.md +1 -1
- package/doc/functions/defineCustomFetch.md +1 -1
- package/doc/functions/defineGenericFetch.md +1 -1
- package/doc/functions/escapeRegex.md +1 -1
- package/doc/functions/fetchExternal.md +1 -1
- package/doc/functions/fetchLocal.md +1 -1
- package/doc/functions/fieldListFromFilter.md +1 -1
- package/doc/functions/filterChildren.md +1 -1
- package/doc/functions/filterFromValue.md +1 -1
- package/doc/functions/get.md +1 -1
- package/doc/functions/groupFilters.md +41 -0
- package/doc/functions/identity.md +1 -1
- package/doc/functions/isFilterGroup.md +1 -1
- package/doc/functions/log.md +1 -1
- package/doc/functions/normalizeOrder.md +1 -1
- package/doc/functions/queryItemList.md +1 -1
- package/doc/functions/retry.md +1 -1
- package/doc/functions/reverseOrder.md +1 -1
- package/doc/functions/sameField.md +1 -1
- package/doc/functions/sortItemList.md +1 -1
- package/doc/functions/splitPath.md +2 -2
- package/doc/functions/testFilter.md +1 -1
- package/doc/interfaces/CustomFetch.md +1 -1
- package/doc/type-aliases/AggregateFunction.md +1 -1
- package/doc/type-aliases/AggregateFunctionOperator.md +1 -1
- package/doc/type-aliases/CombineUnion.md +1 -1
- package/doc/type-aliases/Context.md +1 -1
- package/doc/type-aliases/CustomFieldAggregateMap.md +1 -1
- package/doc/type-aliases/CustomFieldMap.md +1 -1
- package/doc/type-aliases/Field.md +1 -1
- package/doc/type-aliases/FieldFiltered.md +1 -1
- package/doc/type-aliases/FieldFunction.md +1 -1
- package/doc/type-aliases/FieldFunctionCustom.md +1 -1
- package/doc/type-aliases/FieldFunctionFormatDate.md +1 -1
- package/doc/type-aliases/FieldFunctionReturn.md +1 -1
- package/doc/type-aliases/FieldKey.md +1 -1
- package/doc/type-aliases/FieldMap.md +1 -1
- package/doc/type-aliases/Filter.md +1 -1
- package/doc/type-aliases/FilterArray.md +1 -1
- package/doc/type-aliases/FilterBoolean.md +1 -1
- package/doc/type-aliases/FilterChildren.md +1 -1
- package/doc/type-aliases/FilterCustom.md +1 -1
- package/doc/type-aliases/FilterField.md +1 -1
- package/doc/type-aliases/FilterGroup.md +1 -1
- package/doc/type-aliases/FilterNumber.md +1 -1
- package/doc/type-aliases/FilterOperator.md +1 -1
- package/doc/type-aliases/FilterString.md +1 -1
- package/doc/type-aliases/FilterStringIntersect.md +1 -1
- package/doc/type-aliases/FilterStringMatch.md +1 -1
- package/doc/type-aliases/Get.md +1 -1
- package/doc/type-aliases/Group.md +1 -1
- package/doc/type-aliases/Handler.md +1 -1
- package/doc/type-aliases/Immutable.md +1 -1
- package/doc/type-aliases/Increment.md +1 -1
- package/doc/type-aliases/InjectCustomFields.md +1 -1
- package/doc/type-aliases/IntersectUnion.md +1 -1
- package/doc/type-aliases/Item.md +1 -1
- package/doc/type-aliases/Join.md +1 -1
- package/doc/type-aliases/Key.md +1 -1
- package/doc/type-aliases/KeyFiltered.md +1 -1
- package/doc/type-aliases/KeyFromUnion.md +1 -1
- package/doc/type-aliases/Locale.md +1 -1
- package/doc/type-aliases/NextHandler.md +1 -1
- package/doc/type-aliases/Order.md +1 -1
- package/doc/type-aliases/OrderNormalized.md +1 -1
- package/doc/type-aliases/Parameters.md +1 -1
- package/doc/type-aliases/Path.md +1 -1
- package/doc/type-aliases/PathFiltered.md +1 -1
- package/doc/type-aliases/Primitive.md +1 -1
- package/doc/type-aliases/PrimitiveObject.md +1 -1
- package/doc/type-aliases/Query.md +1 -1
- package/doc/type-aliases/QueryAggregate.md +1 -1
- package/doc/type-aliases/QueryCreate.md +1 -1
- package/doc/type-aliases/QueryCreateMultiple.md +1 -1
- package/doc/type-aliases/QueryDelete.md +1 -1
- package/doc/type-aliases/QueryDeleteMultiple.md +1 -1
- package/doc/type-aliases/QueryMethod.md +1 -1
- package/doc/type-aliases/QueryRead.md +1 -1
- package/doc/type-aliases/QueryReadMultiple.md +1 -1
- package/doc/type-aliases/QuerySettings.md +1 -1
- package/doc/type-aliases/QueryUpdate.md +1 -1
- package/doc/type-aliases/QueryUpdateMultiple.md +1 -1
- package/doc/type-aliases/Result.md +1 -1
- package/doc/type-aliases/Store.md +1 -1
- package/doc/type-aliases/Value.md +1 -1
- package/doc/type-aliases/ValueMap.md +1 -1
- package/doc/variables/CACHE.md +1 -1
- package/doc/variables/SELF.md +1 -1
- package/lib/tools/groupFilters.test.ts +49 -0
- package/lib/tools/groupFilters.ts +35 -0
- package/lib/tools.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Filter } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Groups filters together with the specified operator.
|
|
4
|
+
*
|
|
5
|
+
* If no filters are provided, returns `undefined` for `"all"` and `"any"`, and `{ operator: "none" }` for `"none"`.
|
|
6
|
+
*
|
|
7
|
+
* If only one filter is provided, returns that filter directly for `"all"` and `"any"`, and wraps it in a `"none"` filter for `"none"`.
|
|
8
|
+
*
|
|
9
|
+
* @param operator - The operator to use for grouping the filters (`"all"`, `"any"`, or `"none"`).
|
|
10
|
+
* @param filters - The filters to group together.
|
|
11
|
+
* @returns - A single filter representing the grouped filters, or `undefined` if no filters are provided and the operator is `"all"` or `"any"`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function groupFilters<T>(operator: "all" | "any" | "none", ...filters: readonly (Filter<T> | undefined)[]): Filter<T> | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isDefined } from "unchangeable";
|
|
2
|
+
/**
|
|
3
|
+
* Groups filters together with the specified operator.
|
|
4
|
+
*
|
|
5
|
+
* If no filters are provided, returns `undefined` for `"all"` and `"any"`, and `{ operator: "none" }` for `"none"`.
|
|
6
|
+
*
|
|
7
|
+
* If only one filter is provided, returns that filter directly for `"all"` and `"any"`, and wraps it in a `"none"` filter for `"none"`.
|
|
8
|
+
*
|
|
9
|
+
* @param operator - The operator to use for grouping the filters (`"all"`, `"any"`, or `"none"`).
|
|
10
|
+
* @param filters - The filters to group together.
|
|
11
|
+
* @returns - A single filter representing the grouped filters, or `undefined` if no filters are provided and the operator is `"all"` or `"any"`.
|
|
12
|
+
*/
|
|
13
|
+
export function groupFilters(operator, ...filters) {
|
|
14
|
+
const definedFilters = filters.filter(isDefined);
|
|
15
|
+
switch (definedFilters.length) {
|
|
16
|
+
case 0:
|
|
17
|
+
if (operator === "none") {
|
|
18
|
+
return { operator: "none" };
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
case 1:
|
|
22
|
+
if (operator === "none") {
|
|
23
|
+
return { operator: "none", value: definedFilters };
|
|
24
|
+
}
|
|
25
|
+
return definedFilters[0];
|
|
26
|
+
default:
|
|
27
|
+
return { operator, value: definedFilters };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=groupFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupFilters.js","sourceRoot":"","sources":["../../lib/tools/groupFilters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAC1B,QAAgC,EAChC,GAAG,OAA2C;IAE9C,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,QAAQ,cAAc,CAAC,MAAM,EAAE,CAAC;QAC9B,KAAK,CAAC;YACJ,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YAC9B,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,KAAK,CAAC;YACJ,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;YACrD,CAAC;YACD,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC;QAC3B;YACE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { fieldListFromFilter } from "./tools/fieldListFromFilter.js";
|
|
|
7
7
|
export { filterChildren } from "./tools/filterChildren.js";
|
|
8
8
|
export { filterFromValue } from "./tools/filterFromValue.js";
|
|
9
9
|
export { get } from "./tools/get.js";
|
|
10
|
+
export { groupFilters } from "./tools/groupFilters.js";
|
|
10
11
|
export { isFilterGroup } from "./tools/isFilterGroup.js";
|
|
11
12
|
export { normalizeOrder } from "./tools/normalizeOrder.js";
|
|
12
13
|
export { queryItemList } from "./tools/queryItemList.js";
|
package/dist/tools.js
CHANGED
|
@@ -8,6 +8,7 @@ export { fieldListFromFilter } from "./tools/fieldListFromFilter.js";
|
|
|
8
8
|
export { filterChildren } from "./tools/filterChildren.js";
|
|
9
9
|
export { filterFromValue } from "./tools/filterFromValue.js";
|
|
10
10
|
export { get } from "./tools/get.js";
|
|
11
|
+
export { groupFilters } from "./tools/groupFilters.js";
|
|
11
12
|
export { isFilterGroup } from "./tools/isFilterGroup.js";
|
|
12
13
|
export { normalizeOrder } from "./tools/normalizeOrder.js";
|
|
13
14
|
export { queryItemList } from "./tools/queryItemList.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,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,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;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,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,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,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;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
package/doc/README.md
CHANGED
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
- [filterChildren](functions/filterChildren.md)
|
|
101
101
|
- [filterFromValue](functions/filterFromValue.md)
|
|
102
102
|
- [get](functions/get.md)
|
|
103
|
+
- [groupFilters](functions/groupFilters.md)
|
|
103
104
|
- [identity](functions/identity.md)
|
|
104
105
|
- [isFilterGroup](functions/isFilterGroup.md)
|
|
105
106
|
- [log](functions/log.md)
|
|
@@ -50,7 +50,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
50
50
|
|
|
51
51
|
#### Defined in
|
|
52
52
|
|
|
53
|
-
[lib/errors/RequestError.ts:7](https://github.com/nevoland/quetch/blob/
|
|
53
|
+
[lib/errors/RequestError.ts:7](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/errors/RequestError.ts#L7)
|
|
54
54
|
|
|
55
55
|
## Properties
|
|
56
56
|
|
|
@@ -60,7 +60,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
60
60
|
|
|
61
61
|
#### Defined in
|
|
62
62
|
|
|
63
|
-
[lib/errors/RequestError.ts:10](https://github.com/nevoland/quetch/blob/
|
|
63
|
+
[lib/errors/RequestError.ts:10](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/errors/RequestError.ts#L10)
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
@@ -70,7 +70,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
70
70
|
|
|
71
71
|
#### Defined in
|
|
72
72
|
|
|
73
|
-
[lib/errors/RequestError.ts:11](https://github.com/nevoland/quetch/blob/
|
|
73
|
+
[lib/errors/RequestError.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/errors/RequestError.ts#L11)
|
|
74
74
|
|
|
75
75
|
***
|
|
76
76
|
|
|
@@ -80,7 +80,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
80
80
|
|
|
81
81
|
#### Defined in
|
|
82
82
|
|
|
83
|
-
[lib/errors/RequestError.ts:12](https://github.com/nevoland/quetch/blob/
|
|
83
|
+
[lib/errors/RequestError.ts:12](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/errors/RequestError.ts#L12)
|
|
84
84
|
|
|
85
85
|
***
|
|
86
86
|
|
|
@@ -90,4 +90,4 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
90
90
|
|
|
91
91
|
#### Defined in
|
|
92
92
|
|
|
93
|
-
[lib/errors/RequestError.ts:9](https://github.com/nevoland/quetch/blob/
|
|
93
|
+
[lib/errors/RequestError.ts:9](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/errors/RequestError.ts#L9)
|
|
@@ -58,4 +58,4 @@ If a query occurs twice, `mergeQuery(query, currentQuery)` is called and the out
|
|
|
58
58
|
|
|
59
59
|
## Defined in
|
|
60
60
|
|
|
61
|
-
[lib/middlewares/aggregate.ts:17](https://github.com/nevoland/quetch/blob/
|
|
61
|
+
[lib/middlewares/aggregate.ts:17](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/aggregate.ts#L17)
|
package/doc/functions/branch.md
CHANGED
|
@@ -49,4 +49,4 @@ const customFetch = combine(
|
|
|
49
49
|
|
|
50
50
|
## Defined in
|
|
51
51
|
|
|
52
|
-
[lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/
|
|
52
|
+
[lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/branch.ts#L21)
|
package/doc/functions/cache.md
CHANGED
|
@@ -68,4 +68,4 @@ Cache store.
|
|
|
68
68
|
|
|
69
69
|
## Defined in
|
|
70
70
|
|
|
71
|
-
[lib/middlewares/cache.ts:8](https://github.com/nevoland/quetch/blob/
|
|
71
|
+
[lib/middlewares/cache.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/cache.ts#L8)
|
package/doc/functions/combine.md
CHANGED
|
@@ -116,4 +116,4 @@ Handler that combines all provided handlers.
|
|
|
116
116
|
|
|
117
117
|
## Defined in
|
|
118
118
|
|
|
119
|
-
[lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/
|
|
119
|
+
[lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/combine.ts#L801)
|
package/doc/functions/cork.md
CHANGED
|
@@ -22,4 +22,4 @@ Uncallable handler used to terminate a sequence of handlers combined with `combi
|
|
|
22
22
|
|
|
23
23
|
## Defined in
|
|
24
24
|
|
|
25
|
-
[lib/tools/cork.ts:6](https://github.com/nevoland/quetch/blob/
|
|
25
|
+
[lib/tools/cork.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/cork.ts#L6)
|
|
@@ -56,4 +56,4 @@ Function that checks queries.
|
|
|
56
56
|
|
|
57
57
|
## Defined in
|
|
58
58
|
|
|
59
|
-
[lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/
|
|
59
|
+
[lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/defineCheckQuery.ts#L8)
|
|
@@ -68,4 +68,4 @@ A custom fetch function.
|
|
|
68
68
|
|
|
69
69
|
## Defined in
|
|
70
70
|
|
|
71
|
-
[lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/
|
|
71
|
+
[lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/defineCustomFetch.ts#L11)
|
|
@@ -55,4 +55,4 @@ A curried generic fetch function.
|
|
|
55
55
|
|
|
56
56
|
## Defined in
|
|
57
57
|
|
|
58
|
-
[lib/tools/defineGenericFetch.ts:14](https://github.com/nevoland/quetch/blob/
|
|
58
|
+
[lib/tools/defineGenericFetch.ts:14](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/defineGenericFetch.ts#L14)
|
|
@@ -26,4 +26,4 @@ Escaped regular expression
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/
|
|
29
|
+
[lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/escapeRegex.ts#L7)
|
|
@@ -26,4 +26,4 @@ Handler that returns a promise that resolves to the response.
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/
|
|
29
|
+
[lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/fetchExternal.ts#L12)
|
|
@@ -22,4 +22,4 @@ Promise that resolves to the response.
|
|
|
22
22
|
|
|
23
23
|
## Defined in
|
|
24
24
|
|
|
25
|
-
[lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/
|
|
25
|
+
[lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/fetchLocal.ts#L9)
|
|
@@ -30,4 +30,4 @@ A list of fields.
|
|
|
30
30
|
|
|
31
31
|
## Defined in
|
|
32
32
|
|
|
33
|
-
[lib/tools/fieldListFromFilter.ts:11](https://github.com/nevoland/quetch/blob/
|
|
33
|
+
[lib/tools/fieldListFromFilter.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/fieldListFromFilter.ts#L11)
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/filterChildren.ts#L5)
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
|
|
25
25
|
## Defined in
|
|
26
26
|
|
|
27
|
-
[lib/tools/filterFromValue.ts:8](https://github.com/nevoland/quetch/blob/
|
|
27
|
+
[lib/tools/filterFromValue.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/filterFromValue.ts#L8)
|
package/doc/functions/get.md
CHANGED
|
@@ -41,4 +41,4 @@ The property value found at the given path, or `undefined` if it cannot be found
|
|
|
41
41
|
|
|
42
42
|
## Defined in
|
|
43
43
|
|
|
44
|
-
[lib/tools/get.ts:14](https://github.com/nevoland/quetch/blob/
|
|
44
|
+
[lib/tools/get.ts:14](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/get.ts#L14)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[**quetch**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[quetch](../README.md) / groupFilters
|
|
6
|
+
|
|
7
|
+
# Function: groupFilters()
|
|
8
|
+
|
|
9
|
+
> **groupFilters**\<`T`\>(`operator`, ...`filters`): [`Filter`](../type-aliases/Filter.md)\<`T`\> \| `undefined`
|
|
10
|
+
|
|
11
|
+
Groups filters together with the specified operator.
|
|
12
|
+
|
|
13
|
+
If no filters are provided, returns `undefined` for `"all"` and `"any"`, and `{ operator: "none" }` for `"none"`.
|
|
14
|
+
|
|
15
|
+
If only one filter is provided, returns that filter directly for `"all"` and `"any"`, and wraps it in a `"none"` filter for `"none"`.
|
|
16
|
+
|
|
17
|
+
## Type Parameters
|
|
18
|
+
|
|
19
|
+
• **T**
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
### operator
|
|
24
|
+
|
|
25
|
+
`"all"` | `"any"` | `"none"`
|
|
26
|
+
|
|
27
|
+
### filters
|
|
28
|
+
|
|
29
|
+
...readonly (`undefined` \| [`Filter`](../type-aliases/Filter.md)\<`T`\>)[]
|
|
30
|
+
|
|
31
|
+
The filters to group together.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
[`Filter`](../type-aliases/Filter.md)\<`T`\> \| `undefined`
|
|
36
|
+
|
|
37
|
+
- A single filter representing the grouped filters, or `undefined` if no filters are provided and the operator is `"all"` or `"any"`.
|
|
38
|
+
|
|
39
|
+
## Defined in
|
|
40
|
+
|
|
41
|
+
[lib/tools/groupFilters.ts:16](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/groupFilters.ts#L16)
|
|
@@ -34,4 +34,4 @@
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/
|
|
37
|
+
[lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/identity.ts#L3)
|
|
@@ -28,4 +28,4 @@ Whether the provided filter is a group filter or not.
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/tools/isFilterGroup.ts:9](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/tools/isFilterGroup.ts:9](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/isFilterGroup.ts#L9)
|
package/doc/functions/log.md
CHANGED
|
@@ -34,4 +34,4 @@ Query handler
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/
|
|
37
|
+
[lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/log.ts#L13)
|
|
@@ -38,4 +38,4 @@ The normalized order object.
|
|
|
38
38
|
|
|
39
39
|
## Defined in
|
|
40
40
|
|
|
41
|
-
[lib/tools/normalizeOrder.ts:11](https://github.com/nevoland/quetch/blob/
|
|
41
|
+
[lib/tools/normalizeOrder.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/normalizeOrder.ts#L11)
|
|
@@ -32,4 +32,4 @@ The result of the query.
|
|
|
32
32
|
|
|
33
33
|
## Defined in
|
|
34
34
|
|
|
35
|
-
[lib/tools/queryItemList.ts:48](https://github.com/nevoland/quetch/blob/
|
|
35
|
+
[lib/tools/queryItemList.ts:48](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/queryItemList.ts#L48)
|
package/doc/functions/retry.md
CHANGED
|
@@ -36,4 +36,4 @@ Handler
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/middlewares/retry.ts#L15)
|
|
@@ -38,4 +38,4 @@ The reversed order.
|
|
|
38
38
|
|
|
39
39
|
## Defined in
|
|
40
40
|
|
|
41
|
-
[lib/tools/reverseOrder.ts:11](https://github.com/nevoland/quetch/blob/
|
|
41
|
+
[lib/tools/reverseOrder.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/reverseOrder.ts#L11)
|
|
@@ -32,4 +32,4 @@ Whether the fields are the same.
|
|
|
32
32
|
|
|
33
33
|
## Defined in
|
|
34
34
|
|
|
35
|
-
[lib/tools/sameField.ts:12](https://github.com/nevoland/quetch/blob/
|
|
35
|
+
[lib/tools/sameField.ts:12](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/sameField.ts#L12)
|
|
@@ -40,4 +40,4 @@ A new sorted array.
|
|
|
40
40
|
|
|
41
41
|
## Defined in
|
|
42
42
|
|
|
43
|
-
[lib/tools/sortItemList.ts:16](https://github.com/nevoland/quetch/blob/
|
|
43
|
+
[lib/tools/sortItemList.ts:16](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/sortItemList.ts#L16)
|
|
@@ -38,7 +38,7 @@ An array containing the splitted path items if `path` is defined, or a function
|
|
|
38
38
|
|
|
39
39
|
### Defined in
|
|
40
40
|
|
|
41
|
-
[lib/tools/splitPath.ts:22](https://github.com/nevoland/quetch/blob/
|
|
41
|
+
[lib/tools/splitPath.ts:22](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/splitPath.ts#L22)
|
|
42
42
|
|
|
43
43
|
## Call Signature
|
|
44
44
|
|
|
@@ -70,4 +70,4 @@ An array containing the splitted path items if `path` is defined, or a function
|
|
|
70
70
|
|
|
71
71
|
### Defined in
|
|
72
72
|
|
|
73
|
-
[lib/tools/splitPath.ts:27](https://github.com/nevoland/quetch/blob/
|
|
73
|
+
[lib/tools/splitPath.ts:27](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/splitPath.ts#L27)
|
|
@@ -38,4 +38,4 @@ Optional query settings.
|
|
|
38
38
|
|
|
39
39
|
## Defined in
|
|
40
40
|
|
|
41
|
-
[lib/tools/testFilter.ts:28](https://github.com/nevoland/quetch/blob/
|
|
41
|
+
[lib/tools/testFilter.ts:28](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/tools/testFilter.ts#L28)
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/types/CustomFetch.ts:5](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/types/CustomFetch.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/CustomFetch.ts#L5)
|
|
@@ -16,4 +16,4 @@ Aggregation function.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/AggregateFunction.ts:7](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/AggregateFunction.ts:7](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/AggregateFunction.ts#L7)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/AggregateFunctionOperator.ts#L3)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/CombineUnion.ts:4](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/CombineUnion.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/CombineUnion.ts#L4)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Context.ts:5](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Context.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Context.ts#L5)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/CustomFieldAggregateMap.ts#L3)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/CustomFieldMap.ts#L3)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Field.ts:5](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Field.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Field.ts#L5)
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/FieldFiltered.ts:5](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/FieldFiltered.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FieldFiltered.ts#L5)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FieldFunction.ts#L4)
|
|
@@ -36,4 +36,4 @@ Applies a custom field transform function.
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FieldFunctionCustom.ts#L4)
|
|
@@ -30,4 +30,4 @@ Formats the date found in a given field, which can be an ISO string date or a ti
|
|
|
30
30
|
|
|
31
31
|
## Defined in
|
|
32
32
|
|
|
33
|
-
[lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/
|
|
33
|
+
[lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FieldFunctionFormatDate.ts#L6)
|
|
@@ -18,4 +18,4 @@ Return types of custom field functions.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FieldFunctionReturn.ts#L4)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/FieldKey.ts:5](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/FieldKey.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FieldKey.ts#L5)
|
|
@@ -18,4 +18,4 @@ Maps the fields of the provided value `T` to a specific value `V`.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/FieldMap.ts:6](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/FieldMap.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FieldMap.ts#L6)
|
|
@@ -16,4 +16,4 @@ Describes a predicate for filtering items.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Filter.ts#L15)
|
|
@@ -32,4 +32,4 @@ Checks if a given array field matches a given array value according to a given o
|
|
|
32
32
|
|
|
33
33
|
## Defined in
|
|
34
34
|
|
|
35
|
-
[lib/types/FilterArray.ts:11](https://github.com/nevoland/quetch/blob/
|
|
35
|
+
[lib/types/FilterArray.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterArray.ts#L11)
|
|
@@ -26,4 +26,4 @@ Checks if a given boolean field is `true` or `false`.
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[lib/types/FilterBoolean.ts:7](https://github.com/nevoland/quetch/blob/
|
|
29
|
+
[lib/types/FilterBoolean.ts:7](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterBoolean.ts#L7)
|
|
@@ -35,4 +35,4 @@ If `deep` is `true`, also captures all the descendants.
|
|
|
35
35
|
|
|
36
36
|
## Defined in
|
|
37
37
|
|
|
38
|
-
[lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/
|
|
38
|
+
[lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterChildren.ts#L10)
|
|
@@ -36,4 +36,4 @@ Custom filter where `value(item)` returns `true` for matching items.
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/types/FilterCustom.ts:4](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/types/FilterCustom.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterCustom.ts#L4)
|
|
@@ -28,4 +28,4 @@ The field name or path for which to check its existence.
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/types/FilterField.ts:6](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/types/FilterField.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterField.ts#L6)
|
|
@@ -84,4 +84,4 @@ Filters to join.
|
|
|
84
84
|
|
|
85
85
|
## Defined in
|
|
86
86
|
|
|
87
|
-
[lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/
|
|
87
|
+
[lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterGroup.ts#L6)
|
|
@@ -26,4 +26,4 @@ Checks if a given number field matches a given number value according to a given
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[lib/types/FilterNumber.ts:7](https://github.com/nevoland/quetch/blob/
|
|
29
|
+
[lib/types/FilterNumber.ts:7](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterNumber.ts#L7)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterOperator.ts#L3)
|
|
@@ -34,4 +34,4 @@ Checks if a given string field matches a given string value according to a given
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[lib/types/FilterString.ts:8](https://github.com/nevoland/quetch/blob/
|
|
37
|
+
[lib/types/FilterString.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterString.ts#L8)
|
|
@@ -34,4 +34,4 @@ Checks if a given string field has any of the provided values.
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[lib/types/FilterStringIntersect.ts:8](https://github.com/nevoland/quetch/blob/
|
|
37
|
+
[lib/types/FilterStringIntersect.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterStringIntersect.ts#L8)
|
|
@@ -50,4 +50,4 @@ Ignore casing differences if `true`.
|
|
|
50
50
|
|
|
51
51
|
## Defined in
|
|
52
52
|
|
|
53
|
-
[lib/types/FilterStringMatch.ts:9](https://github.com/nevoland/quetch/blob/
|
|
53
|
+
[lib/types/FilterStringMatch.ts:9](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/FilterStringMatch.ts#L9)
|
package/doc/type-aliases/Get.md
CHANGED
|
@@ -18,4 +18,4 @@ Returns the type of the property at the specified `P` path.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/Get.ts:6](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/Get.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Get.ts#L6)
|
|
@@ -16,4 +16,4 @@ Specifies how items should be grouped.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Group.ts#L4)
|
|
@@ -36,4 +36,4 @@ Handles an `input` query and returns an `output` promise, eventually using the `
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Handler.ts#L6)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Immutable.ts#L1)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Increment.ts:5](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Increment.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Increment.ts#L5)
|
|
@@ -18,4 +18,4 @@ Injects the custom fields into the entity type.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/InjectCustomFields.ts#L8)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/IntersectUnion.ts:1](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/IntersectUnion.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/IntersectUnion.ts#L1)
|
package/doc/type-aliases/Item.md
CHANGED
|
@@ -18,4 +18,4 @@ Returns the inferred item type of an array, or an alternative type if it is some
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Item.ts#L4)
|
package/doc/type-aliases/Join.md
CHANGED
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Join.ts:1](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Join.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Join.ts#L1)
|
package/doc/type-aliases/Key.md
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Key.ts#L1)
|
|
@@ -18,4 +18,4 @@ Returns union of keys whose mapped value extend the provided `P` type.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/KeyFiltered.ts:10](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/KeyFiltered.ts:10](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/KeyFiltered.ts#L10)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/KeyFromUnion.ts:1](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/KeyFromUnion.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/KeyFromUnion.ts#L1)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/Locale.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/Locale.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Locale.ts#L1)
|
|
@@ -28,4 +28,4 @@ Handles an `input` query and returns an `output` promise.
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/NextHandler.ts#L4)
|
|
@@ -16,4 +16,4 @@ Order item.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Order.ts:6](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Order.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Order.ts#L6)
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
|
|
25
25
|
## Defined in
|
|
26
26
|
|
|
27
|
-
[lib/types/OrderNormalized.ts:3](https://github.com/nevoland/quetch/blob/
|
|
27
|
+
[lib/types/OrderNormalized.ts:3](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/OrderNormalized.ts#L3)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/Parameters.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/Parameters.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Parameters.ts#L1)
|
package/doc/type-aliases/Path.md
CHANGED
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Path.ts:5](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Path.ts:5](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Path.ts#L5)
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/PathFiltered.ts:4](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/PathFiltered.ts:4](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/PathFiltered.ts#L4)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/Primitive.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/Primitive.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Primitive.ts#L1)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/PrimitiveObject.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/PrimitiveObject.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/PrimitiveObject.ts#L1)
|
|
@@ -16,4 +16,4 @@ Query that fetches or mutates an entity.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Query.ts:14](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Query.ts:14](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Query.ts#L14)
|
|
@@ -68,4 +68,4 @@ Query settings.
|
|
|
68
68
|
|
|
69
69
|
## Defined in
|
|
70
70
|
|
|
71
|
-
[lib/types/QueryAggregate.ts:11](https://github.com/nevoland/quetch/blob/
|
|
71
|
+
[lib/types/QueryAggregate.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryAggregate.ts#L11)
|
|
@@ -50,4 +50,4 @@ Value properties of the item to create.
|
|
|
50
50
|
|
|
51
51
|
## Defined in
|
|
52
52
|
|
|
53
|
-
[lib/types/QueryCreate.ts:8](https://github.com/nevoland/quetch/blob/
|
|
53
|
+
[lib/types/QueryCreate.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryCreate.ts#L8)
|
|
@@ -48,4 +48,4 @@ Query settings.
|
|
|
48
48
|
|
|
49
49
|
## Defined in
|
|
50
50
|
|
|
51
|
-
[lib/types/QueryCreateMultiple.ts:8](https://github.com/nevoland/quetch/blob/
|
|
51
|
+
[lib/types/QueryCreateMultiple.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryCreateMultiple.ts#L8)
|
|
@@ -60,4 +60,4 @@ Query settings.
|
|
|
60
60
|
|
|
61
61
|
## Defined in
|
|
62
62
|
|
|
63
|
-
[lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/
|
|
63
|
+
[lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryDelete.ts#L9)
|
|
@@ -62,4 +62,4 @@ Query settings.
|
|
|
62
62
|
|
|
63
63
|
## Defined in
|
|
64
64
|
|
|
65
|
-
[lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/
|
|
65
|
+
[lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryDeleteMultiple.ts#L9)
|
|
@@ -12,4 +12,4 @@ Available query methods.
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/
|
|
15
|
+
[lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryMethod.ts#L6)
|
|
@@ -76,4 +76,4 @@ Query settings.
|
|
|
76
76
|
|
|
77
77
|
## Defined in
|
|
78
78
|
|
|
79
|
-
[lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/
|
|
79
|
+
[lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryRead.ts#L10)
|
|
@@ -80,4 +80,4 @@ Query settings.
|
|
|
80
80
|
|
|
81
81
|
## Defined in
|
|
82
82
|
|
|
83
|
-
[lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/
|
|
83
|
+
[lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryReadMultiple.ts#L11)
|
|
@@ -80,4 +80,4 @@ A filter that captures the items expressed by the provided `FilterChildren`.
|
|
|
80
80
|
|
|
81
81
|
## Defined in
|
|
82
82
|
|
|
83
|
-
[lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/
|
|
83
|
+
[lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QuerySettings.ts#L8)
|
|
@@ -68,4 +68,4 @@ Partial property values to update.
|
|
|
68
68
|
|
|
69
69
|
## Defined in
|
|
70
70
|
|
|
71
|
-
[lib/types/QueryUpdate.ts:9](https://github.com/nevoland/quetch/blob/
|
|
71
|
+
[lib/types/QueryUpdate.ts:9](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryUpdate.ts#L9)
|
|
@@ -74,4 +74,4 @@ Partial property values to update.
|
|
|
74
74
|
|
|
75
75
|
## Defined in
|
|
76
76
|
|
|
77
|
-
[lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/
|
|
77
|
+
[lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/QueryUpdateMultiple.ts#L10)
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Result.ts#L20)
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
|
|
69
69
|
## Defined in
|
|
70
70
|
|
|
71
|
-
[lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/
|
|
71
|
+
[lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Store.ts#L2)
|
|
@@ -36,4 +36,4 @@ Path leading to the value.
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/types/Value.ts:6](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/types/Value.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/Value.ts#L6)
|
|
@@ -18,4 +18,4 @@ Maps the properties of the provided value `T` to a specific value `V`.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/ValueMap.ts:6](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/ValueMap.ts:6](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/types/ValueMap.ts#L6)
|
package/doc/variables/CACHE.md
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/constants/CACHE.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/constants/CACHE.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/constants/CACHE.ts#L1)
|
package/doc/variables/SELF.md
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/constants/SELF.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/constants/SELF.ts:1](https://github.com/nevoland/quetch/blob/1dbcbe5bf2276e5e4dfe5bc56d7adf82ee0d0a42/lib/constants/SELF.ts#L1)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { groupFilters } from "./groupFilters.js";
|
|
4
|
+
|
|
5
|
+
test("groups filters together", () => {
|
|
6
|
+
expect(
|
|
7
|
+
groupFilters<{ a: string; b: string }>(
|
|
8
|
+
"all",
|
|
9
|
+
{ field: "a", operator: "equal", value: "foo" },
|
|
10
|
+
{ field: "b", operator: "equal", value: "bar" },
|
|
11
|
+
),
|
|
12
|
+
).toEqual({
|
|
13
|
+
operator: "all",
|
|
14
|
+
value: [
|
|
15
|
+
{ field: "a", operator: "equal", value: "foo" },
|
|
16
|
+
{ field: "b", operator: "equal", value: "bar" },
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
expect(
|
|
20
|
+
groupFilters<{ a: string }>("all", {
|
|
21
|
+
field: "a",
|
|
22
|
+
operator: "equal",
|
|
23
|
+
value: "foo",
|
|
24
|
+
}),
|
|
25
|
+
).toEqual({
|
|
26
|
+
field: "a",
|
|
27
|
+
operator: "equal",
|
|
28
|
+
value: "foo",
|
|
29
|
+
});
|
|
30
|
+
expect(
|
|
31
|
+
groupFilters<{ a: string }>("none", {
|
|
32
|
+
field: "a",
|
|
33
|
+
operator: "equal",
|
|
34
|
+
value: "foo",
|
|
35
|
+
}),
|
|
36
|
+
).toEqual({
|
|
37
|
+
operator: "none",
|
|
38
|
+
value: [{ field: "a", operator: "equal", value: "foo" }],
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("handles undefined filters", () => {
|
|
43
|
+
expect(groupFilters("all")).toBeUndefined();
|
|
44
|
+
expect(groupFilters("any")).toBeUndefined();
|
|
45
|
+
expect(groupFilters("none")).toEqual({ operator: "none" });
|
|
46
|
+
expect(groupFilters("all", undefined)).toBeUndefined();
|
|
47
|
+
expect(groupFilters("any", undefined)).toBeUndefined();
|
|
48
|
+
expect(groupFilters("none", undefined)).toEqual({ operator: "none" });
|
|
49
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isDefined } from "unchangeable";
|
|
2
|
+
|
|
3
|
+
import type { Filter } from "../types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Groups filters together with the specified operator.
|
|
7
|
+
*
|
|
8
|
+
* If no filters are provided, returns `undefined` for `"all"` and `"any"`, and `{ operator: "none" }` for `"none"`.
|
|
9
|
+
*
|
|
10
|
+
* If only one filter is provided, returns that filter directly for `"all"` and `"any"`, and wraps it in a `"none"` filter for `"none"`.
|
|
11
|
+
*
|
|
12
|
+
* @param operator - The operator to use for grouping the filters (`"all"`, `"any"`, or `"none"`).
|
|
13
|
+
* @param filters - The filters to group together.
|
|
14
|
+
* @returns - A single filter representing the grouped filters, or `undefined` if no filters are provided and the operator is `"all"` or `"any"`.
|
|
15
|
+
*/
|
|
16
|
+
export function groupFilters<T>(
|
|
17
|
+
operator: "all" | "any" | "none",
|
|
18
|
+
...filters: readonly (Filter<T> | undefined)[]
|
|
19
|
+
): Filter<T> | undefined {
|
|
20
|
+
const definedFilters = filters.filter(isDefined);
|
|
21
|
+
switch (definedFilters.length) {
|
|
22
|
+
case 0:
|
|
23
|
+
if (operator === "none") {
|
|
24
|
+
return { operator: "none" };
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
case 1:
|
|
28
|
+
if (operator === "none") {
|
|
29
|
+
return { operator: "none", value: definedFilters };
|
|
30
|
+
}
|
|
31
|
+
return definedFilters[0];
|
|
32
|
+
default:
|
|
33
|
+
return { operator, value: definedFilters };
|
|
34
|
+
}
|
|
35
|
+
}
|
package/lib/tools.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { fieldListFromFilter } from "./tools/fieldListFromFilter.js";
|
|
|
8
8
|
export { filterChildren } from "./tools/filterChildren.js";
|
|
9
9
|
export { filterFromValue } from "./tools/filterFromValue.js";
|
|
10
10
|
export { get } from "./tools/get.js";
|
|
11
|
+
export { groupFilters } from "./tools/groupFilters.js";
|
|
11
12
|
export { isFilterGroup } from "./tools/isFilterGroup.js";
|
|
12
13
|
export { normalizeOrder } from "./tools/normalizeOrder.js";
|
|
13
14
|
export { queryItemList } from "./tools/queryItemList.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quetch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/main.js",
|
|
6
6
|
"exports": {
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"futurise": "^1.9.1",
|
|
83
|
-
"unchangeable": "^2.
|
|
83
|
+
"unchangeable": "^2.2.0"
|
|
84
84
|
}
|
|
85
85
|
}
|