quetch 0.28.0 → 0.29.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.
Files changed (122) hide show
  1. package/dist/tools/filterChildren.d.ts +12 -2
  2. package/dist/tools/filterChildren.js +17 -6
  3. package/dist/tools/filterChildren.js.map +1 -1
  4. package/dist/tools/testFilter.js +0 -16
  5. package/dist/tools/testFilter.js.map +1 -1
  6. package/dist/types/Filter.d.ts +1 -2
  7. package/dist/types/FilterChildren.d.ts +2 -2
  8. package/dist/types/IntrinsicFilter.d.ts +1 -1
  9. package/dist/types/QuerySettings.d.ts +0 -8
  10. package/dist/types.d.ts +0 -1
  11. package/doc/README.md +0 -1
  12. package/doc/classes/RequestError.md +5 -5
  13. package/doc/functions/aggregate.md +1 -1
  14. package/doc/functions/branch.md +1 -1
  15. package/doc/functions/cache.md +1 -1
  16. package/doc/functions/combine.md +1 -1
  17. package/doc/functions/cork.md +1 -1
  18. package/doc/functions/defineCheckQuery.md +1 -1
  19. package/doc/functions/defineCustomFetch.md +1 -1
  20. package/doc/functions/defineGenericFetch.md +1 -1
  21. package/doc/functions/escapeRegex.md +1 -1
  22. package/doc/functions/fetchExternal.md +1 -1
  23. package/doc/functions/fetchLocal.md +1 -1
  24. package/doc/functions/fieldListFromFilter.md +1 -1
  25. package/doc/functions/filterChildren.md +18 -4
  26. package/doc/functions/filterFromValue.md +1 -1
  27. package/doc/functions/get.md +1 -1
  28. package/doc/functions/groupFilters.md +1 -1
  29. package/doc/functions/identity.md +1 -1
  30. package/doc/functions/isFilterGroup.md +1 -1
  31. package/doc/functions/log.md +1 -1
  32. package/doc/functions/normalizeOrder.md +1 -1
  33. package/doc/functions/queryItemList.md +1 -1
  34. package/doc/functions/retry.md +1 -1
  35. package/doc/functions/reverseOrder.md +1 -1
  36. package/doc/functions/sameField.md +1 -1
  37. package/doc/functions/sortItemList.md +1 -1
  38. package/doc/functions/splitPath.md +2 -2
  39. package/doc/functions/testFilter.md +1 -1
  40. package/doc/interfaces/CustomFetch.md +1 -1
  41. package/doc/type-aliases/AggregateFunction.md +1 -1
  42. package/doc/type-aliases/AggregateFunctionOperator.md +1 -1
  43. package/doc/type-aliases/CombineUnion.md +1 -1
  44. package/doc/type-aliases/Context.md +1 -1
  45. package/doc/type-aliases/CustomFieldAggregateMap.md +1 -1
  46. package/doc/type-aliases/CustomFieldMap.md +1 -1
  47. package/doc/type-aliases/Field.md +1 -1
  48. package/doc/type-aliases/FieldFiltered.md +1 -1
  49. package/doc/type-aliases/FieldFunction.md +1 -1
  50. package/doc/type-aliases/FieldFunctionCustom.md +1 -1
  51. package/doc/type-aliases/FieldFunctionFormatDate.md +1 -1
  52. package/doc/type-aliases/FieldFunctionReturn.md +1 -1
  53. package/doc/type-aliases/FieldKey.md +1 -1
  54. package/doc/type-aliases/FieldMap.md +1 -1
  55. package/doc/type-aliases/Filter.md +2 -2
  56. package/doc/type-aliases/FilterArray.md +1 -1
  57. package/doc/type-aliases/FilterBoolean.md +1 -1
  58. package/doc/type-aliases/FilterChildren.md +3 -3
  59. package/doc/type-aliases/FilterCustom.md +1 -1
  60. package/doc/type-aliases/FilterField.md +1 -1
  61. package/doc/type-aliases/FilterGroup.md +1 -1
  62. package/doc/type-aliases/FilterNumber.md +1 -1
  63. package/doc/type-aliases/FilterOperator.md +1 -1
  64. package/doc/type-aliases/FilterString.md +1 -1
  65. package/doc/type-aliases/FilterStringIntersect.md +1 -1
  66. package/doc/type-aliases/FilterStringMatch.md +1 -1
  67. package/doc/type-aliases/Get.md +1 -1
  68. package/doc/type-aliases/Group.md +1 -1
  69. package/doc/type-aliases/Handler.md +1 -1
  70. package/doc/type-aliases/Immutable.md +1 -1
  71. package/doc/type-aliases/Increment.md +1 -1
  72. package/doc/type-aliases/InjectCustomFields.md +1 -1
  73. package/doc/type-aliases/IntersectUnion.md +1 -1
  74. package/doc/type-aliases/IntrinsicFilter.md +1 -1
  75. package/doc/type-aliases/Item.md +1 -1
  76. package/doc/type-aliases/Join.md +1 -1
  77. package/doc/type-aliases/Key.md +1 -1
  78. package/doc/type-aliases/KeyFiltered.md +1 -1
  79. package/doc/type-aliases/KeyFromUnion.md +1 -1
  80. package/doc/type-aliases/Locale.md +1 -1
  81. package/doc/type-aliases/NextHandler.md +1 -1
  82. package/doc/type-aliases/Order.md +1 -1
  83. package/doc/type-aliases/OrderNormalized.md +1 -1
  84. package/doc/type-aliases/Parameters.md +1 -1
  85. package/doc/type-aliases/Path.md +1 -1
  86. package/doc/type-aliases/PathFiltered.md +1 -1
  87. package/doc/type-aliases/Primitive.md +1 -1
  88. package/doc/type-aliases/PrimitiveObject.md +1 -1
  89. package/doc/type-aliases/Query.md +1 -1
  90. package/doc/type-aliases/QueryAggregate.md +1 -1
  91. package/doc/type-aliases/QueryCreate.md +1 -1
  92. package/doc/type-aliases/QueryCreateMultiple.md +1 -1
  93. package/doc/type-aliases/QueryDelete.md +1 -1
  94. package/doc/type-aliases/QueryDeleteMultiple.md +1 -1
  95. package/doc/type-aliases/QueryMethod.md +1 -1
  96. package/doc/type-aliases/QueryRead.md +1 -1
  97. package/doc/type-aliases/QueryReadMultiple.md +1 -1
  98. package/doc/type-aliases/QuerySettings.md +1 -17
  99. package/doc/type-aliases/QueryUpdate.md +1 -1
  100. package/doc/type-aliases/QueryUpdateMultiple.md +1 -1
  101. package/doc/type-aliases/Result.md +1 -1
  102. package/doc/type-aliases/Store.md +1 -1
  103. package/doc/type-aliases/Value.md +1 -1
  104. package/doc/type-aliases/ValueMap.md +1 -1
  105. package/doc/variables/CACHE.md +1 -1
  106. package/doc/variables/FILTER_ANY.md +1 -1
  107. package/doc/variables/FILTER_NONE.md +1 -1
  108. package/doc/variables/SELF.md +1 -1
  109. package/lib/tools/filterChildren.ts +20 -16
  110. package/lib/tools/testFilter.test.ts +6 -51
  111. package/lib/tools/testFilter.ts +0 -16
  112. package/lib/types/Filter.ts +0 -2
  113. package/lib/types/FilterChildren.ts +2 -2
  114. package/lib/types/IntrinsicFilter.ts +1 -1
  115. package/lib/types/QuerySettings.ts +0 -8
  116. package/lib/types.ts +0 -1
  117. package/package.json +1 -1
  118. package/dist/types/FilterContext.d.ts +0 -11
  119. package/dist/types/FilterContext.js +0 -1
  120. package/dist/types/FilterContext.js.map +0 -1
  121. package/doc/type-aliases/FilterContext.md +0 -33
  122. package/lib/types/FilterContext.ts +0 -13
@@ -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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FieldFunctionReturn.ts#L4)
21
+ [lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FieldKey.ts#L5)
17
+ [lib/types/FieldKey.ts:5](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FieldMap.ts#L6)
21
+ [lib/types/FieldMap.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/FieldMap.ts#L6)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type Alias: Filter\<T\>
8
8
 
9
- > **Filter**\<`T`\>: [`FilterArray`](FilterArray.md)\<`T`\> \| [`FilterBoolean`](FilterBoolean.md)\<`T`\> \| [`FilterChildren`](FilterChildren.md)\<`T`\> \| [`FilterCustom`](FilterCustom.md)\<`T`\> \| [`FilterField`](FilterField.md)\<`T`\> \| [`FilterNumber`](FilterNumber.md)\<`T`\> \| [`FilterGroup`](FilterGroup.md)\<`T`\> \| [`FilterString`](FilterString.md)\<`T`\> \| [`FilterStringIntersect`](FilterStringIntersect.md)\<`T`\> \| [`FilterContext`](FilterContext.md)\<`T`\> \| [`FilterStringMatch`](FilterStringMatch.md)\<`T`\>
9
+ > **Filter**\<`T`\>: [`FilterArray`](FilterArray.md)\<`T`\> \| [`FilterBoolean`](FilterBoolean.md)\<`T`\> \| [`FilterChildren`](FilterChildren.md)\<`T`\> \| [`FilterCustom`](FilterCustom.md)\<`T`\> \| [`FilterField`](FilterField.md)\<`T`\> \| [`FilterNumber`](FilterNumber.md)\<`T`\> \| [`FilterGroup`](FilterGroup.md)\<`T`\> \| [`FilterString`](FilterString.md)\<`T`\> \| [`FilterStringIntersect`](FilterStringIntersect.md)\<`T`\> \| [`FilterStringMatch`](FilterStringMatch.md)\<`T`\>
10
10
 
11
11
  Describes a predicate for filtering items.
12
12
 
@@ -16,4 +16,4 @@ Describes a predicate for filtering items.
16
16
 
17
17
  ## Defined in
18
18
 
19
- [lib/types/Filter.ts:16](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Filter.ts#L16)
19
+ [lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterArray.ts#L11)
35
+ [lib/types/FilterArray.ts:11](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterBoolean.ts#L7)
29
+ [lib/types/FilterBoolean.ts:7](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/FilterBoolean.ts#L7)
@@ -36,12 +36,12 @@ Infinity
36
36
 
37
37
  > `optional` **minDepth**: `number`
38
38
 
39
- Minimum depth of the children to match. If `0`, matches the direct children. If `1`, matches the grandchildren, and so on.
39
+ Minimum depth of the children to match. If `0`, matches the parent. If `1`, matches the direct children, if `2`, the grandchildren, and so on.
40
40
 
41
41
  #### Default
42
42
 
43
43
  ```ts
44
- 0
44
+ 1
45
45
  ```
46
46
 
47
47
  ### operator
@@ -54,4 +54,4 @@ Minimum depth of the children to match. If `0`, matches the direct children. If
54
54
 
55
55
  ## Defined in
56
56
 
57
- [lib/types/FilterChildren.ts:9](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterChildren.ts#L9)
57
+ [lib/types/FilterChildren.ts:9](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/FilterChildren.ts#L9)
@@ -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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterCustom.ts#L4)
39
+ [lib/types/FilterCustom.ts:4](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterField.ts#L6)
31
+ [lib/types/FilterField.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterGroup.ts#L6)
87
+ [lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterNumber.ts#L7)
29
+ [lib/types/FilterNumber.ts:7](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterOperator.ts#L3)
13
+ [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterString.ts#L8)
37
+ [lib/types/FilterString.ts:8](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterStringIntersect.ts#L8)
37
+ [lib/types/FilterStringIntersect.ts:8](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/FilterStringMatch.ts#L9)
53
+ [lib/types/FilterStringMatch.ts:9](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/FilterStringMatch.ts#L9)
@@ -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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Get.ts#L6)
21
+ [lib/types/Get.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Group.ts#L4)
19
+ [lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Handler.ts#L6)
39
+ [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Immutable.ts#L1)
17
+ [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Increment.ts#L5)
17
+ [lib/types/Increment.ts:5](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/InjectCustomFields.ts#L8)
21
+ [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/IntersectUnion.ts#L1)
17
+ [lib/types/IntersectUnion.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/IntersectUnion.ts#L1)
@@ -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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/IntrinsicFilter.ts#L6)
19
+ [lib/types/IntrinsicFilter.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/IntrinsicFilter.ts#L6)
@@ -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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Item.ts#L4)
21
+ [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/Item.ts#L4)
@@ -16,4 +16,4 @@
16
16
 
17
17
  ## Defined in
18
18
 
19
- [lib/types/Join.ts:1](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Join.ts#L1)
19
+ [lib/types/Join.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/Join.ts#L1)
@@ -10,4 +10,4 @@
10
10
 
11
11
  ## Defined in
12
12
 
13
- [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Key.ts#L1)
13
+ [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/KeyFiltered.ts#L10)
21
+ [lib/types/KeyFiltered.ts:10](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/KeyFromUnion.ts#L1)
17
+ [lib/types/KeyFromUnion.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Locale.ts#L1)
13
+ [lib/types/Locale.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/NextHandler.ts#L4)
31
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Order.ts#L6)
19
+ [lib/types/Order.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/OrderNormalized.ts#L3)
27
+ [lib/types/OrderNormalized.ts:3](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Parameters.ts#L1)
13
+ [lib/types/Parameters.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/Parameters.ts#L1)
@@ -16,4 +16,4 @@
16
16
 
17
17
  ## Defined in
18
18
 
19
- [lib/types/Path.ts:5](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Path.ts#L5)
19
+ [lib/types/Path.ts:5](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/PathFiltered.ts#L4)
21
+ [lib/types/PathFiltered.ts:4](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Primitive.ts#L1)
13
+ [lib/types/Primitive.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/PrimitiveObject.ts#L1)
13
+ [lib/types/PrimitiveObject.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Query.ts#L14)
19
+ [lib/types/Query.ts:14](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryAggregate.ts#L11)
71
+ [lib/types/QueryAggregate.ts:11](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryCreate.ts#L8)
53
+ [lib/types/QueryCreate.ts:8](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryCreateMultiple.ts#L8)
51
+ [lib/types/QueryCreateMultiple.ts:8](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryDelete.ts#L9)
63
+ [lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryDeleteMultiple.ts#L9)
65
+ [lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryMethod.ts#L6)
15
+ [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryRead.ts#L10)
79
+ [lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryReadMultiple.ts#L11)
83
+ [lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/QueryReadMultiple.ts#L11)
@@ -78,22 +78,6 @@ The provided `FilterChildren` to express.
78
78
 
79
79
  A filter that captures the items expressed by the provided `FilterChildren`.
80
80
 
81
- ### transformFilterContext()?
82
-
83
- > `optional` **transformFilterContext**: (`filter`) => [`IntrinsicFilter`](IntrinsicFilter.md)\<`T`\>
84
-
85
- Returns a filter that captures the items expressed by the provided `FilterContext`. The return filter cannot use filters of type `FilterContext` or `FilterChildren`.
86
-
87
- #### Parameters
88
-
89
- ##### filter
90
-
91
- [`FilterContext`](FilterContext.md)\<`T`\>
92
-
93
- #### Returns
94
-
95
- [`IntrinsicFilter`](IntrinsicFilter.md)\<`T`\>
96
-
97
81
  ## Defined in
98
82
 
99
- [lib/types/QuerySettings.ts:9](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QuerySettings.ts#L9)
83
+ [lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryUpdate.ts#L9)
71
+ [lib/types/QueryUpdate.ts:9](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/QueryUpdateMultiple.ts#L10)
77
+ [lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Result.ts#L20)
19
+ [lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Store.ts#L2)
71
+ [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/Value.ts#L6)
39
+ [lib/types/Value.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/types/ValueMap.ts#L6)
21
+ [lib/types/ValueMap.ts:6](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/types/ValueMap.ts#L6)
@@ -10,4 +10,4 @@
10
10
 
11
11
  ## Defined in
12
12
 
13
- [lib/constants/CACHE.ts:1](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/constants/CACHE.ts#L1)
13
+ [lib/constants/CACHE.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/constants/FILTER_ANY.ts#L1)
19
+ [lib/constants/FILTER\_ANY.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/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/90f88a16e6d59a9c61398498a63289d526194476/lib/constants/FILTER_NONE.ts#L1)
19
+ [lib/constants/FILTER\_NONE.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/constants/FILTER_NONE.ts#L1)
@@ -10,4 +10,4 @@
10
10
 
11
11
  ## Defined in
12
12
 
13
- [lib/constants/SELF.ts:1](https://github.com/nevoland/quetch/blob/90f88a16e6d59a9c61398498a63289d526194476/lib/constants/SELF.ts#L1)
13
+ [lib/constants/SELF.ts:1](https://github.com/nevoland/quetch/blob/439120295bc3ab3895611a5a04d7281d9d40fc45/lib/constants/SELF.ts#L1)
@@ -1,29 +1,33 @@
1
- import type { FieldFiltered, IntrinsicFilter } from "../types.ts";
1
+ import type { FieldFiltered, FilterStringMatch } from "../types.js";
2
2
 
3
3
  import { escapeRegex } from "./escapeRegex.js";
4
4
 
5
+ /**
6
+ * Generates a filter that matches items whose path field indicates they are children of a given parent path, with an optional depth range.
7
+ *
8
+ * @param parentPath - The path of the parent item.
9
+ * @param pathFieldKey - The key of the field that contains the path information.
10
+ * @param minDepth - The minimum depth of the child items relative to the parent.
11
+ * @param maxDepth - The maximum depth of the child items relative to the parent.
12
+ * @param pathSeparator - The character used to separate path segments.
13
+ * @returns A filter that can be used to match child items.
14
+ */
5
15
  export function filterChildren<T>(
6
16
  parentPath: string,
7
17
  pathFieldKey: FieldFiltered<T, string>,
8
- minDepth = 0,
18
+ minDepth = 1,
9
19
  maxDepth = Infinity,
10
20
  pathSeparator = "/",
11
- ): IntrinsicFilter<T> {
21
+ ): FilterStringMatch<T> {
22
+ const escapedSeparator = escapeRegex(pathSeparator);
23
+ const segment = `${escapedSeparator}[^${escapedSeparator}]+`;
24
+ const quantifier =
25
+ minDepth === 1 && maxDepth === 1
26
+ ? ""
27
+ : `{${minDepth},${maxDepth === Infinity ? "" : maxDepth}}`;
12
28
  return {
13
29
  field: pathFieldKey,
14
30
  operator: "match",
15
- value: childrenRegex(parentPath, minDepth, maxDepth, pathSeparator),
31
+ value: `^${escapeRegex(parentPath)}(?:${segment})${quantifier}$`,
16
32
  };
17
33
  }
18
-
19
- function childrenRegex(
20
- parentPath: string,
21
- minDepth = 0,
22
- maxDepth = Infinity,
23
- pathSeparator = "/",
24
- ): string {
25
- const escapedSeparator = escapeRegex(pathSeparator);
26
- return `^${escapeRegex(parentPath)}${
27
- parentPath === "" ? "" : escapedSeparator
28
- }${minDepth === 0 && maxDepth === Infinity ? "" : `(?:[^${escapedSeparator}]{1,}){${minDepth + 1},${maxDepth === Infinity ? "" : maxDepth}}$`}`;
29
- }
@@ -354,6 +354,12 @@ test("tests filter with children predicates", () => {
354
354
  expect(
355
355
  testFilter({ operator: "children", value: { id: "a" } }, { id: "a/b" }),
356
356
  ).toBe(true);
357
+ expect(
358
+ testFilter(
359
+ { operator: "children", value: { id: "a" }, minDepth: 0 },
360
+ { id: "a" },
361
+ ),
362
+ ).toBe(true);
357
363
  expect(
358
364
  testFilter({ operator: "notChildren", value: { id: "a" } }, { id: "a/b" }),
359
365
  ).toBe(false);
@@ -442,54 +448,3 @@ test("tests filter with children predicates", () => {
442
448
  ),
443
449
  ).toBe(true);
444
450
  });
445
-
446
- test("tests filter with context predicates", () => {
447
- const context = { id: "a" };
448
- expect(testFilter({ operator: "is", value: context }, { id: "a" })).toBe(
449
- true,
450
- );
451
- expect(testFilter({ operator: "notIs", value: context }, { id: "a" })).toBe(
452
- false,
453
- );
454
- const filterContext: FilterContext<typeof context> = {
455
- operator: "is",
456
- value: context,
457
- };
458
- expect(
459
- testFilter(
460
- filterContext,
461
- { id: "a" },
462
- {
463
- transformFilterContext(filter) {
464
- return {
465
- field: "id",
466
- operator: "equal",
467
- value: filter.value?.id ?? "",
468
- };
469
- },
470
- },
471
- ),
472
- ).toBe(true);
473
- expect(
474
- testFilter(
475
- { operator: "all", value: [filterContext] },
476
- { id: "a" },
477
- {
478
- transformFilterContext(filter) {
479
- return {
480
- field: "id",
481
- operator: "equal",
482
- value: filter.value?.id ?? "",
483
- };
484
- },
485
- },
486
- ),
487
- ).toBe(true);
488
- expect(filterContext[CACHE]).toBeDefined();
489
- expect(testFilter({ operator: "is", value: { id: "b" } }, { id: "a" })).toBe(
490
- false,
491
- );
492
- expect(
493
- testFilter({ operator: "notIs", value: { id: "b" } }, { id: "a" }),
494
- ).toBe(true);
495
- });
@@ -11,7 +11,6 @@ import type {
11
11
  } from "../types.js";
12
12
 
13
13
  import { filterChildren } from "./filterChildren.js";
14
- import { filterFromValue } from "./filterFromValue.js";
15
14
  import { get } from "./get.js";
16
15
 
17
16
  const { isArray } = Array;
@@ -153,21 +152,6 @@ export function testFilter<T>(
153
152
  }
154
153
  return negate(testFilter(filter[CACHE], value, settings), not);
155
154
  }
156
- case "is":
157
- case "notIs": {
158
- const not = filter.operator[0] === "n";
159
- if (filter[CACHE] === undefined) {
160
- switch (true) {
161
- case settings?.transformFilterContext !== undefined:
162
- filter[CACHE] = settings.transformFilterContext(filter);
163
- break;
164
- default: {
165
- filter[CACHE] = filterFromValue(filter.value as T);
166
- }
167
- }
168
- }
169
- return negate(testFilter(filter[CACHE], value), not);
170
- }
171
155
  case "custom": {
172
156
  return filter.value(value);
173
157
  }