quetch 0.32.1 → 0.33.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/comparatorFieldValues.js +11 -4
- package/dist/tools/comparatorFieldValues.js.map +1 -1
- package/dist/tools/normalizeOrder.js.map +1 -1
- package/dist/tools/sortItemList.js +3 -3
- package/dist/tools/sortItemList.js.map +1 -1
- package/dist/types/FieldKey.d.ts +1 -1
- package/dist/types/FilterWithField.d.ts +7 -0
- package/dist/types/FilterWithField.js +1 -0
- package/dist/types/FilterWithField.js.map +1 -0
- package/dist/types/QuerySettings.d.ts +3 -2
- package/dist/types/ValueMap.d.ts +1 -1
- package/dist/types.d.ts +1 -0
- 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/comparatorFieldValues.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/fieldListUnion.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 +1 -1
- package/doc/functions/identity.md +1 -1
- package/doc/functions/intrinsicFilter.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/querySettings.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/functions/transformerFilterChildren.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/Decrement.md +1 -1
- package/doc/type-aliases/DepthLimit.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/FilterWithField.md +19 -0
- 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/InjectCustomFields.md +1 -1
- package/doc/type-aliases/IntersectUnion.md +1 -1
- package/doc/type-aliases/IntrinsicFilter.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/NormalizedPathFieldSettings.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/Prettify.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/FILTER_ANY.md +1 -1
- package/doc/variables/FILTER_NONE.md +1 -1
- package/doc/variables/SELF.md +1 -1
- package/lib/tools/comparatorFieldValues.ts +11 -4
- package/lib/tools/normalizeOrder.ts +1 -1
- package/lib/tools/sortItemList.test.ts +58 -0
- package/lib/tools/sortItemList.ts +8 -3
- package/lib/types/FieldKey.ts +4 -4
- package/lib/types/FilterWithField.ts +6 -0
- package/lib/types/QuerySettings.ts +3 -1
- package/lib/types/ValueMap.ts +10 -8
- package/lib/types.ts +1 -0
- package/package.json +1 -1
|
@@ -54,4 +54,4 @@ Minimum depth of the children to match. If `0`, matches the parent. If `1`, matc
|
|
|
54
54
|
|
|
55
55
|
## Defined in
|
|
56
56
|
|
|
57
|
-
[lib/types/FilterChildren.ts:8](https://github.com/nevoland/quetch/blob/
|
|
57
|
+
[lib/types/FilterChildren.ts:8](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/FilterChildren.ts#L8)
|
|
@@ -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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/FilterStringMatch.ts#L9)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[**quetch**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[quetch](../README.md) / FilterWithField
|
|
6
|
+
|
|
7
|
+
# Type Alias: FilterWithField\<T\>
|
|
8
|
+
|
|
9
|
+
> **FilterWithField**\<`T`\>: `Extract`\<[`Filter`](Filter.md)\<`T`\>, `object`\>
|
|
10
|
+
|
|
11
|
+
A filter that includes a field.
|
|
12
|
+
|
|
13
|
+
## Type Parameters
|
|
14
|
+
|
|
15
|
+
• **T**
|
|
16
|
+
|
|
17
|
+
## Defined in
|
|
18
|
+
|
|
19
|
+
[lib/types/FilterWithField.ts:6](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/FilterWithField.ts#L6)
|
package/doc/type-aliases/Get.md
CHANGED
|
@@ -20,4 +20,4 @@ Returns the type of the property at the specified `P` path.
|
|
|
20
20
|
|
|
21
21
|
## Defined in
|
|
22
22
|
|
|
23
|
-
[lib/types/Get.ts:8](https://github.com/nevoland/quetch/blob/
|
|
23
|
+
[lib/types/Get.ts:8](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/Get.ts#L8)
|
|
@@ -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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/Immutable.ts#L1)
|
|
@@ -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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/InjectCustomFields.ts#L8)
|
|
@@ -16,4 +16,4 @@ Converts a union type to an intersection type.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/IntersectUnion.ts:4](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/IntersectUnion.ts:4](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/IntersectUnion.ts#L4)
|
|
@@ -16,4 +16,4 @@ Filter that does not rely on query settings, and thus can be evaluated directly
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/IntrinsicFilter.ts:6](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/IntrinsicFilter.ts:6](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/IntrinsicFilter.ts#L6)
|
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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/NextHandler.ts#L4)
|
|
@@ -54,4 +54,4 @@ String used to escape the separator.
|
|
|
54
54
|
|
|
55
55
|
## Defined in
|
|
56
56
|
|
|
57
|
-
[lib/types/NormalizedPathFieldSettings.ts:6](https://github.com/nevoland/quetch/blob/
|
|
57
|
+
[lib/types/NormalizedPathFieldSettings.ts:6](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/NormalizedPathFieldSettings.ts#L6)
|
|
@@ -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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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:6](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Path.ts:6](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/Path.ts#L6)
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/PathFiltered.ts:5](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/PathFiltered.ts:5](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/PathFiltered.ts#L5)
|
|
@@ -16,4 +16,4 @@ Prettifies a type by recursively removing any intersections or unions.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Prettify.ts:4](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Prettify.ts:4](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/Prettify.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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/QueryMethod.ts#L6)
|
|
@@ -76,4 +76,4 @@ Query settings.
|
|
|
76
76
|
|
|
77
77
|
## Defined in
|
|
78
78
|
|
|
79
|
-
[lib/types/QueryRead.ts:11](https://github.com/nevoland/quetch/blob/
|
|
79
|
+
[lib/types/QueryRead.ts:11](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/QueryRead.ts#L11)
|
|
@@ -80,4 +80,4 @@ Query settings.
|
|
|
80
80
|
|
|
81
81
|
## Defined in
|
|
82
82
|
|
|
83
|
-
[lib/types/QueryReadMultiple.ts:12](https://github.com/nevoland/quetch/blob/
|
|
83
|
+
[lib/types/QueryReadMultiple.ts:12](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/QueryReadMultiple.ts#L12)
|
|
@@ -86,4 +86,4 @@ The second value to compare.
|
|
|
86
86
|
|
|
87
87
|
## Defined in
|
|
88
88
|
|
|
89
|
-
[lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/
|
|
89
|
+
[lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/QueryUpdateMultiple.ts#L10)
|
|
@@ -18,4 +18,4 @@ Result of a read and aggregate query.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/Result.ts:64](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/Result.ts:64](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/types/Result.ts#L64)
|
|
@@ -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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/constants/CACHE.ts#L1)
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/constants/FILTER\_ANY.ts:1](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/constants/FILTER\_ANY.ts:1](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/constants/FILTER_ANY.ts#L1)
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/constants/FILTER\_NONE.ts:1](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/constants/FILTER\_NONE.ts:1](https://github.com/nevoland/quetch/blob/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/constants/FILTER_NONE.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/b61dbca54473f80e71fa7a49ff56d6963b3a7e91/lib/constants/SELF.ts#L1)
|
|
@@ -23,13 +23,20 @@ export function comparatorFieldValues<T>({
|
|
|
23
23
|
const fieldSeparatorRegexp = new RegExp(
|
|
24
24
|
!pathFieldSeparatorEscape
|
|
25
25
|
? escapeRegex(pathFieldSeparator)
|
|
26
|
-
: `(
|
|
26
|
+
: `(?<!(?:${escapeRegex(pathFieldSeparatorEscape)}{2})*${escapeRegex(pathFieldSeparatorEscape)})${escapeRegex(pathFieldSeparator)}`,
|
|
27
27
|
"g",
|
|
28
28
|
);
|
|
29
|
-
return (field, a, b) => {
|
|
29
|
+
return (field, descending, a, b) => {
|
|
30
30
|
if (!sameField(field, pathField)) {
|
|
31
31
|
return undefined;
|
|
32
32
|
}
|
|
33
|
+
// Parents should always appear before their children, regardless of the order direction
|
|
34
|
+
if ((a as string).startsWith(`${b}${pathFieldSeparator}`)) {
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
if ((b as string).startsWith(`${a}${pathFieldSeparator}`)) {
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
33
40
|
const normalizedA = (a as string).replaceAll?.(
|
|
34
41
|
fieldSeparatorRegexp,
|
|
35
42
|
"\x00",
|
|
@@ -39,8 +46,8 @@ export function comparatorFieldValues<T>({
|
|
|
39
46
|
"\x00",
|
|
40
47
|
);
|
|
41
48
|
if (normalizedA > normalizedB) {
|
|
42
|
-
return 1;
|
|
49
|
+
return descending ? -1 : 1;
|
|
43
50
|
}
|
|
44
|
-
return -1;
|
|
51
|
+
return descending ? 1 : -1;
|
|
45
52
|
};
|
|
46
53
|
}
|
|
@@ -143,3 +143,61 @@ test("sorts items with separator setting", () => {
|
|
|
143
143
|
{ path: "a\\.b.c" },
|
|
144
144
|
]);
|
|
145
145
|
});
|
|
146
|
+
|
|
147
|
+
test("sorts trees appropriately", () => {
|
|
148
|
+
expect(
|
|
149
|
+
sortItemList(
|
|
150
|
+
[{ descending: false, field: "path" }],
|
|
151
|
+
[
|
|
152
|
+
{ path: "a" },
|
|
153
|
+
{ path: "a/b" },
|
|
154
|
+
{ path: "a/c" },
|
|
155
|
+
{ path: "a.b" },
|
|
156
|
+
{ path: "a/b/c" },
|
|
157
|
+
{ path: "a.b.c" },
|
|
158
|
+
{ path: "a/b.c" },
|
|
159
|
+
{ path: "a\\/b.c" },
|
|
160
|
+
{ path: "a.b/c" },
|
|
161
|
+
],
|
|
162
|
+
querySettings(),
|
|
163
|
+
),
|
|
164
|
+
).toEqual([
|
|
165
|
+
{ path: "a" },
|
|
166
|
+
{ path: "a/b" },
|
|
167
|
+
{ path: "a/b/c" },
|
|
168
|
+
{ path: "a/b.c" },
|
|
169
|
+
{ path: "a/c" },
|
|
170
|
+
{ path: "a.b" },
|
|
171
|
+
{ path: "a.b/c" },
|
|
172
|
+
{ path: "a.b.c" },
|
|
173
|
+
{ path: "a\\/b.c" },
|
|
174
|
+
]);
|
|
175
|
+
|
|
176
|
+
expect(
|
|
177
|
+
sortItemList(
|
|
178
|
+
[{ descending: true, field: "path" }],
|
|
179
|
+
[
|
|
180
|
+
{ path: "a" },
|
|
181
|
+
{ path: "a/c" },
|
|
182
|
+
{ path: "a/b" },
|
|
183
|
+
{ path: "a.b" },
|
|
184
|
+
{ path: "a/b/c" },
|
|
185
|
+
{ path: "a.b.c" },
|
|
186
|
+
{ path: "a/b.c" },
|
|
187
|
+
{ path: "a\\/b.c" },
|
|
188
|
+
{ path: "a.b/c" },
|
|
189
|
+
],
|
|
190
|
+
querySettings(),
|
|
191
|
+
),
|
|
192
|
+
).toEqual([
|
|
193
|
+
{ path: "a\\/b.c" },
|
|
194
|
+
{ path: "a.b.c" },
|
|
195
|
+
{ path: "a.b" },
|
|
196
|
+
{ path: "a.b/c" },
|
|
197
|
+
{ path: "a" },
|
|
198
|
+
{ path: "a/c" },
|
|
199
|
+
{ path: "a/b.c" },
|
|
200
|
+
{ path: "a/b" },
|
|
201
|
+
{ path: "a/b/c" },
|
|
202
|
+
]);
|
|
203
|
+
});
|
|
@@ -25,7 +25,7 @@ export function sortItemList<T>(
|
|
|
25
25
|
const normalizedOrder = orderList.map(normalizeOrder);
|
|
26
26
|
return value.toSorted((a, b) => {
|
|
27
27
|
for (let index = 0; index < normalizedOrder.length; index++) {
|
|
28
|
-
const { field, descending } = normalizedOrder[index]!;
|
|
28
|
+
const { field, descending = false } = normalizedOrder[index]!;
|
|
29
29
|
const valueA = get(a, field);
|
|
30
30
|
const valueB = get(b, field);
|
|
31
31
|
if (valueA === valueB) {
|
|
@@ -37,7 +37,12 @@ export function sortItemList<T>(
|
|
|
37
37
|
if (valueB == null) {
|
|
38
38
|
return descending ? -1 : 1;
|
|
39
39
|
}
|
|
40
|
-
const comparison = compareFieldValues?.(
|
|
40
|
+
const comparison = compareFieldValues?.(
|
|
41
|
+
field,
|
|
42
|
+
descending,
|
|
43
|
+
valueA,
|
|
44
|
+
valueB,
|
|
45
|
+
);
|
|
41
46
|
if (comparison === undefined) {
|
|
42
47
|
if (valueA > valueB) {
|
|
43
48
|
return descending ? -1 : 1;
|
|
@@ -47,7 +52,7 @@ export function sortItemList<T>(
|
|
|
47
52
|
if (comparison === 0) {
|
|
48
53
|
continue;
|
|
49
54
|
}
|
|
50
|
-
return
|
|
55
|
+
return comparison;
|
|
51
56
|
}
|
|
52
57
|
return 0;
|
|
53
58
|
});
|
package/lib/types/FieldKey.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { SELF } from "../constants/SELF.ts";
|
|
|
3
3
|
import type { Key } from "./Key.ts";
|
|
4
4
|
import type { Primitive } from "./Primitive";
|
|
5
5
|
|
|
6
|
-
export type FieldKey<T> =
|
|
7
|
-
?
|
|
8
|
-
:
|
|
9
|
-
?
|
|
6
|
+
export type FieldKey<T> = [unknown] extends [T]
|
|
7
|
+
? Key
|
|
8
|
+
: T extends Primitive
|
|
9
|
+
? typeof SELF
|
|
10
10
|
: keyof T;
|
|
@@ -18,13 +18,15 @@ export type QuerySettings<T> = {
|
|
|
18
18
|
*
|
|
19
19
|
* This function is called only when both `a` and `b` are defined and different. If it returns `undefined`, the default comparison operators are used as a fallback.
|
|
20
20
|
*
|
|
21
|
+
* @param field - The field for which the values are compared.
|
|
22
|
+
* @param descending - Whether the comparison is for a descending order.
|
|
21
23
|
* @param a - The first value to compare.
|
|
22
24
|
* @param b - The second value to compare.
|
|
23
|
-
* @param field - The field for which the values are compared.
|
|
24
25
|
* @returns `-1` if `a` should be sorted before `b`, `1` if `a` should be sorted after `b`, `0` if they are considered equal, or `undefined` to use the default comparison operators.
|
|
25
26
|
*/
|
|
26
27
|
compareFieldValues?<T>(
|
|
27
28
|
field: Field<T>,
|
|
29
|
+
descending: boolean,
|
|
28
30
|
a: NonNullable<any>,
|
|
29
31
|
b: NonNullable<any>,
|
|
30
32
|
): -1 | 0 | 1 | undefined;
|
package/lib/types/ValueMap.ts
CHANGED
|
@@ -3,12 +3,14 @@ import type { Primitive } from "./Primitive";
|
|
|
3
3
|
/**
|
|
4
4
|
* Maps the properties of the provided value `T` to a specific value `V`.
|
|
5
5
|
*/
|
|
6
|
-
export type ValueMap<T, V> =
|
|
6
|
+
export type ValueMap<T, V> = [unknown] extends [T]
|
|
7
7
|
? V
|
|
8
|
-
: T extends
|
|
9
|
-
?
|
|
10
|
-
: T extends
|
|
11
|
-
?
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
: T extends Primitive
|
|
9
|
+
? V
|
|
10
|
+
: T extends Array<infer P>
|
|
11
|
+
? Record<number, ValueMap<P, V>>
|
|
12
|
+
: T extends object
|
|
13
|
+
? {
|
|
14
|
+
[K in keyof T]?: ValueMap<T[K], V>;
|
|
15
|
+
}
|
|
16
|
+
: never;
|