quetch 0.23.1 → 0.24.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 (111) hide show
  1. package/dist/tools/filterFromValue.d.ts +2 -0
  2. package/dist/tools/{filterFromContext.js → filterFromValue.js} +2 -2
  3. package/dist/tools/filterFromValue.js.map +1 -0
  4. package/dist/tools/queryItemList.js +3 -3
  5. package/dist/tools/queryItemList.js.map +1 -1
  6. package/dist/tools.d.ts +1 -1
  7. package/dist/tools.js +1 -1
  8. package/dist/tools.js.map +1 -1
  9. package/doc/README.md +1 -1
  10. package/doc/classes/RequestError.md +5 -5
  11. package/doc/functions/aggregate.md +1 -1
  12. package/doc/functions/branch.md +1 -1
  13. package/doc/functions/cache.md +1 -1
  14. package/doc/functions/combine.md +1 -1
  15. package/doc/functions/cork.md +1 -1
  16. package/doc/functions/defineCheckQuery.md +1 -1
  17. package/doc/functions/defineCustomFetch.md +1 -1
  18. package/doc/functions/defineGenericFetch.md +1 -1
  19. package/doc/functions/escapeRegex.md +1 -1
  20. package/doc/functions/fetchExternal.md +1 -1
  21. package/doc/functions/fetchLocal.md +1 -1
  22. package/doc/functions/fieldListFromFilter.md +1 -1
  23. package/doc/functions/filterChildren.md +1 -1
  24. package/doc/functions/filterFromValue.md +27 -0
  25. package/doc/functions/get.md +2 -2
  26. package/doc/functions/identity.md +1 -1
  27. package/doc/functions/isFilterGroup.md +1 -1
  28. package/doc/functions/log.md +1 -1
  29. package/doc/functions/normalizeOrder.md +1 -1
  30. package/doc/functions/queryItemList.md +1 -1
  31. package/doc/functions/retry.md +1 -1
  32. package/doc/functions/reverseOrder.md +1 -1
  33. package/doc/functions/sameField.md +9 -1
  34. package/doc/functions/sortItemList.md +1 -1
  35. package/doc/functions/splitPath.md +2 -2
  36. package/doc/functions/testFilter.md +1 -1
  37. package/doc/interfaces/CustomFetch.md +1 -1
  38. package/doc/type-aliases/AggregateFunction.md +1 -1
  39. package/doc/type-aliases/AggregateFunctionOperator.md +1 -1
  40. package/doc/type-aliases/CombineUnion.md +1 -1
  41. package/doc/type-aliases/Context.md +1 -1
  42. package/doc/type-aliases/CustomFieldAggregateMap.md +1 -1
  43. package/doc/type-aliases/CustomFieldMap.md +1 -1
  44. package/doc/type-aliases/Field.md +1 -1
  45. package/doc/type-aliases/FieldFiltered.md +1 -1
  46. package/doc/type-aliases/FieldFunction.md +1 -1
  47. package/doc/type-aliases/FieldFunctionCustom.md +1 -1
  48. package/doc/type-aliases/FieldFunctionFormatDate.md +1 -1
  49. package/doc/type-aliases/FieldFunctionReturn.md +1 -1
  50. package/doc/type-aliases/FieldKey.md +1 -1
  51. package/doc/type-aliases/FieldMap.md +1 -1
  52. package/doc/type-aliases/Filter.md +1 -1
  53. package/doc/type-aliases/FilterArray.md +1 -1
  54. package/doc/type-aliases/FilterBoolean.md +1 -1
  55. package/doc/type-aliases/FilterChildren.md +1 -1
  56. package/doc/type-aliases/FilterCustom.md +1 -1
  57. package/doc/type-aliases/FilterField.md +1 -1
  58. package/doc/type-aliases/FilterGroup.md +44 -6
  59. package/doc/type-aliases/FilterNumber.md +1 -1
  60. package/doc/type-aliases/FilterOperator.md +1 -1
  61. package/doc/type-aliases/FilterString.md +1 -1
  62. package/doc/type-aliases/FilterStringIntersect.md +1 -1
  63. package/doc/type-aliases/FilterStringMatch.md +1 -1
  64. package/doc/type-aliases/Get.md +1 -1
  65. package/doc/type-aliases/Group.md +1 -1
  66. package/doc/type-aliases/Handler.md +1 -1
  67. package/doc/type-aliases/Immutable.md +1 -1
  68. package/doc/type-aliases/Increment.md +1 -1
  69. package/doc/type-aliases/InjectCustomFields.md +1 -1
  70. package/doc/type-aliases/IntersectUnion.md +1 -1
  71. package/doc/type-aliases/Item.md +1 -1
  72. package/doc/type-aliases/Join.md +1 -1
  73. package/doc/type-aliases/Key.md +1 -1
  74. package/doc/type-aliases/KeyFiltered.md +1 -1
  75. package/doc/type-aliases/KeyFromUnion.md +1 -1
  76. package/doc/type-aliases/Locale.md +1 -1
  77. package/doc/type-aliases/NextHandler.md +1 -1
  78. package/doc/type-aliases/Order.md +1 -1
  79. package/doc/type-aliases/OrderNormalized.md +1 -1
  80. package/doc/type-aliases/Parameters.md +1 -1
  81. package/doc/type-aliases/Path.md +2 -2
  82. package/doc/type-aliases/PathFiltered.md +1 -1
  83. package/doc/type-aliases/Primitive.md +1 -1
  84. package/doc/type-aliases/PrimitiveObject.md +1 -1
  85. package/doc/type-aliases/Query.md +1 -1
  86. package/doc/type-aliases/QueryAggregate.md +1 -1
  87. package/doc/type-aliases/QueryCreate.md +1 -1
  88. package/doc/type-aliases/QueryCreateMultiple.md +1 -1
  89. package/doc/type-aliases/QueryDelete.md +1 -1
  90. package/doc/type-aliases/QueryDeleteMultiple.md +1 -1
  91. package/doc/type-aliases/QueryMethod.md +1 -1
  92. package/doc/type-aliases/QueryRead.md +1 -1
  93. package/doc/type-aliases/QueryReadMultiple.md +1 -1
  94. package/doc/type-aliases/QuerySettings.md +1 -1
  95. package/doc/type-aliases/QueryUpdate.md +1 -1
  96. package/doc/type-aliases/QueryUpdateMultiple.md +1 -1
  97. package/doc/type-aliases/Result.md +1 -1
  98. package/doc/type-aliases/Store.md +1 -1
  99. package/doc/type-aliases/Value.md +1 -1
  100. package/doc/type-aliases/ValueMap.md +1 -1
  101. package/doc/variables/CACHE.md +1 -1
  102. package/doc/variables/SELF.md +1 -1
  103. package/lib/tools/{filterFromContext.test.ts → filterFromValue.test.ts} +8 -8
  104. package/lib/tools/{filterFromContext.ts → filterFromValue.ts} +2 -2
  105. package/lib/tools/queryItemList.ts +3 -3
  106. package/lib/tools/testFilter.test.ts +2 -2
  107. package/lib/tools.ts +1 -1
  108. package/package.json +1 -1
  109. package/dist/tools/filterFromContext.d.ts +0 -2
  110. package/dist/tools/filterFromContext.js.map +0 -1
  111. package/doc/functions/filterFromContext.md +0 -27
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type Alias: FilterGroup\<T\>
8
8
 
9
- > **FilterGroup**\<`T`\>: \{`operator`: `"all"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \} \| \{`operator`: `"any"` \| `"none"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \}
9
+ > **FilterGroup**\<`T`\>: \{`operator`: `"all"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \} \| \{`maximum`: `number`;`minimum`: `number`;`operator`: `"any"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \} \| \{`operator`: `"none"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \}
10
10
 
11
11
  Joins a list of filters with a specific boolean operator.
12
12
 
@@ -22,7 +22,7 @@ Joins a list of filters with a specific boolean operator.
22
22
 
23
23
  > **operator**: `"all"`
24
24
 
25
- Boolean operator to use for joining the filters.
25
+ Checks if all filters are true.
26
26
 
27
27
  ### value
28
28
 
@@ -30,13 +30,51 @@ Boolean operator to use for joining the filters.
30
30
 
31
31
  Filters to join.
32
32
 
33
- \{`operator`: `"any"` \| `"none"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \}
33
+ \{`maximum`: `number`;`minimum`: `number`;`operator`: `"any"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \}
34
+
35
+ ### maximum?
36
+
37
+ > `optional` **maximum**: `number`
38
+
39
+ Maximum number of filters that can match.
40
+
41
+ #### Default
42
+
43
+ ```ts
44
+ Infinity
45
+ ```
46
+
47
+ ### minimum?
48
+
49
+ > `optional` **minimum**: `number`
50
+
51
+ Minimum number of filters that must match.
52
+
53
+ #### Default
54
+
55
+ `1` if filters are provided, `0` otherwise
56
+
57
+ ### operator
58
+
59
+ > **operator**: `"any"`
60
+
61
+ Checks if at least one of the filters match.
62
+ Always true if no filters are provided.
63
+
64
+ ### value?
65
+
66
+ > `optional` **value**: readonly [`Filter`](Filter.md)\<`T`\>[]
67
+
68
+ Filters to join.
69
+
70
+ \{`operator`: `"none"`;`value`: readonly [`Filter`](Filter.md)\<`T`\>[]; \}
34
71
 
35
72
  ### operator
36
73
 
37
- > **operator**: `"any"` \| `"none"`
74
+ > **operator**: `"none"`
38
75
 
39
- Boolean operator to use for joining the filters.
76
+ Checks if none of the filters match.
77
+ Always false if no filters are provided.
40
78
 
41
79
  ### value?
42
80
 
@@ -46,4 +84,4 @@ Filters to join.
46
84
 
47
85
  ## Defined in
48
86
 
49
- [lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/FilterGroup.ts#L6)
87
+ [lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/FilterNumber.ts#L7)
29
+ [lib/types/FilterNumber.ts:7](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/FilterOperator.ts#L3)
13
+ [lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/FilterString.ts#L8)
37
+ [lib/types/FilterString.ts:8](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/FilterStringIntersect.ts#L8)
37
+ [lib/types/FilterStringIntersect.ts:8](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/FilterStringMatch.ts#L9)
53
+ [lib/types/FilterStringMatch.ts:9](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Get.ts#L6)
21
+ [lib/types/Get.ts:6](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Group.ts#L4)
19
+ [lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Handler.ts#L6)
39
+ [lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Immutable.ts#L1)
17
+ [lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Increment.ts#L5)
17
+ [lib/types/Increment.ts:5](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/InjectCustomFields.ts#L8)
21
+ [lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/IntersectUnion.ts#L1)
17
+ [lib/types/IntersectUnion.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/lib/types/IntersectUnion.ts#L1)
@@ -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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Item.ts#L4)
21
+ [lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Join.ts#L1)
19
+ [lib/types/Join.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Key.ts#L1)
13
+ [lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/KeyFiltered.ts#L10)
21
+ [lib/types/KeyFiltered.ts:10](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/KeyFromUnion.ts#L1)
17
+ [lib/types/KeyFromUnion.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Locale.ts#L1)
13
+ [lib/types/Locale.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/NextHandler.ts#L4)
31
+ [lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Order.ts#L6)
19
+ [lib/types/Order.ts:6](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/OrderNormalized.ts#L3)
27
+ [lib/types/OrderNormalized.ts:3](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Parameters.ts#L1)
13
+ [lib/types/Parameters.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/lib/types/Parameters.ts#L1)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Type Alias: Path\<T, D\>
8
8
 
9
- > **Path**\<`T`, `D`\>: [`0`] *extends* [`1` & `T`] ? readonly ([`Key`](Key.md) \| `never`)[] : `D` *extends* `-1` ? `never` : `T` *extends* [`Primitive`](Primitive.md) ? readonly `never`[] : `T` *extends* infer P[] ? readonly [`number`] \| readonly [`number`, `...Path<P, Increment<D>>`] : `T` *extends* `object` ? \{ \[K in keyof T\]: \[K\] \| \[K, ...Path\<(...), (...)\>\] \}\[keyof `T`\] : `never`
9
+ > **Path**\<`T`, `D`\>: [`0`] *extends* [`1` & `T`] ? readonly ([`Key`](Key.md) \| `never`)[] : `D` *extends* `-1` ? `never` : `T` *extends* [`Primitive`](Primitive.md) ? readonly `never`[] : `T` *extends* infer P[] ? readonly [`number`] \| readonly [`number`, `...Path<P, Increment<D>>`] : `T` *extends* `object` ? \{ \[K in keyof T\]: readonly \[K\] \| readonly \[K, ...(...)\] \}\[keyof `T`\] : `never`
10
10
 
11
11
  ## Type Parameters
12
12
 
@@ -16,4 +16,4 @@
16
16
 
17
17
  ## Defined in
18
18
 
19
- [lib/types/Path.ts:5](https://github.com/nevoland/quetch/blob/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Path.ts#L5)
19
+ [lib/types/Path.ts:5](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/PathFiltered.ts#L4)
21
+ [lib/types/PathFiltered.ts:4](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Primitive.ts#L1)
13
+ [lib/types/Primitive.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/PrimitiveObject.ts#L1)
13
+ [lib/types/PrimitiveObject.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Query.ts#L14)
19
+ [lib/types/Query.ts:14](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryAggregate.ts#L11)
71
+ [lib/types/QueryAggregate.ts:11](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryCreate.ts#L8)
53
+ [lib/types/QueryCreate.ts:8](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryCreateMultiple.ts#L8)
51
+ [lib/types/QueryCreateMultiple.ts:8](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/lib/types/QueryCreateMultiple.ts#L8)
@@ -48,4 +48,4 @@ Query settings.
48
48
 
49
49
  ## Defined in
50
50
 
51
- [lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryDelete.ts#L9)
51
+ [lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/lib/types/QueryDelete.ts#L9)
@@ -48,4 +48,4 @@ Query settings.
48
48
 
49
49
  ## Defined in
50
50
 
51
- [lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryDeleteMultiple.ts#L9)
51
+ [lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryMethod.ts#L6)
15
+ [lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryRead.ts#L10)
79
+ [lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryReadMultiple.ts#L11)
83
+ [lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QuerySettings.ts#L8)
83
+ [lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryUpdate.ts#L9)
71
+ [lib/types/QueryUpdate.ts:9](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/lib/types/QueryUpdate.ts#L9)
@@ -72,4 +72,4 @@ Partial property values to update.
72
72
 
73
73
  ## Defined in
74
74
 
75
- [lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/QueryUpdateMultiple.ts#L10)
75
+ [lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Result.ts#L20)
19
+ [lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Store.ts#L2)
71
+ [lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/Value.ts#L6)
39
+ [lib/types/Value.ts:6](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/types/ValueMap.ts#L6)
21
+ [lib/types/ValueMap.ts:6](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/constants/CACHE.ts#L1)
13
+ [lib/constants/CACHE.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/lib/constants/CACHE.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/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/constants/SELF.ts#L1)
13
+ [lib/constants/SELF.ts:1](https://github.com/nevoland/quetch/blob/a3ccd863643bdab12f1ae3f17b69623aaeed1b9f/lib/constants/SELF.ts#L1)
@@ -2,10 +2,10 @@ import { expect, test } from "vitest";
2
2
 
3
3
  import { SELF } from "../constants.js";
4
4
 
5
- import { filterFromContext } from "./filterFromContext.js";
5
+ import { filterFromValue } from "./filterFromValue.js";
6
6
 
7
7
  test("returns filter from context", () => {
8
- expect(filterFromContext({ a: 1 })).toEqual({
8
+ expect(filterFromValue({ a: 1 })).toEqual({
9
9
  operator: "all",
10
10
  value: [
11
11
  {
@@ -15,7 +15,7 @@ test("returns filter from context", () => {
15
15
  },
16
16
  ],
17
17
  });
18
- expect(filterFromContext({ a: { b: 1 } })).toEqual({
18
+ expect(filterFromValue({ a: { b: 1 } })).toEqual({
19
19
  operator: "all",
20
20
  value: [
21
21
  {
@@ -25,7 +25,7 @@ test("returns filter from context", () => {
25
25
  },
26
26
  ],
27
27
  });
28
- expect(filterFromContext({ a: { b: undefined } })).toEqual({
28
+ expect(filterFromValue({ a: { b: undefined } })).toEqual({
29
29
  operator: "all",
30
30
  value: [
31
31
  {
@@ -35,7 +35,7 @@ test("returns filter from context", () => {
35
35
  },
36
36
  ],
37
37
  });
38
- expect(filterFromContext({ a: { b: null } })).toEqual({
38
+ expect(filterFromValue({ a: { b: null } })).toEqual({
39
39
  operator: "all",
40
40
  value: [
41
41
  {
@@ -45,7 +45,7 @@ test("returns filter from context", () => {
45
45
  },
46
46
  ],
47
47
  });
48
- expect(filterFromContext({ [SELF]: 3 })).toEqual({
48
+ expect(filterFromValue({ [SELF]: 3 })).toEqual({
49
49
  operator: "all",
50
50
  value: [
51
51
  {
@@ -55,7 +55,7 @@ test("returns filter from context", () => {
55
55
  },
56
56
  ],
57
57
  });
58
- expect(filterFromContext({ a: null })).toEqual({
58
+ expect(filterFromValue({ a: null })).toEqual({
59
59
  operator: "all",
60
60
  value: [
61
61
  {
@@ -65,7 +65,7 @@ test("returns filter from context", () => {
65
65
  },
66
66
  ],
67
67
  });
68
- expect(filterFromContext({ a: { b: 1 }, c: 2 })).toEqual({
68
+ expect(filterFromValue({ a: { b: 1 }, c: 2 })).toEqual({
69
69
  operator: "all",
70
70
  value: [
71
71
  {
@@ -1,11 +1,11 @@
1
1
  import { EMPTY_ARRAY } from "unchangeable";
2
2
 
3
3
  import { SELF } from "../constants/SELF.js";
4
- import type { Context, Filter } from "../types";
4
+ import type { Context, Filter } from "../types.js";
5
5
 
6
6
  const { entries } = Object;
7
7
 
8
- export function filterFromContext<T>(context: Context<T>): Filter<T> {
8
+ export function filterFromValue<T>(context: Context<T>): Filter<T> {
9
9
  return {
10
10
  operator: "all",
11
11
  value: criteria(context),
@@ -7,7 +7,7 @@ import type {
7
7
  Result,
8
8
  } from "../types.js";
9
9
 
10
- import { filterFromContext } from "./filterFromContext.js";
10
+ import { filterFromValue } from "./filterFromValue.js";
11
11
  import { sortItemList } from "./sortItemList.js";
12
12
  import { testFilter } from "./testFilter.js";
13
13
 
@@ -22,11 +22,11 @@ function mergeContextAndFilter<T>(
22
22
  return filter ?? { operator: "any" };
23
23
  }
24
24
  if (filter === undefined) {
25
- return filterFromContext(context);
25
+ return filterFromValue(context);
26
26
  }
27
27
  return {
28
28
  operator: "all",
29
- value: [filterFromContext(context), filter],
29
+ value: [filterFromValue(context), filter],
30
30
  };
31
31
  }
32
32
 
@@ -4,7 +4,7 @@ import { CACHE } from "../constants/CACHE.js";
4
4
  import { SELF } from "../constants.js";
5
5
  import type { FilterChildren } from "../types.js";
6
6
 
7
- import { filterFromContext } from "./filterFromContext.js";
7
+ import { filterFromValue } from "./filterFromValue.js";
8
8
  import { testFilter } from "./testFilter.js";
9
9
 
10
10
  test("tests filter lists", () => {
@@ -344,7 +344,7 @@ test("tests filter on array values", () => {
344
344
  test("tests filter with paths", () => {
345
345
  const context = { value: { filter: { field: "label" } } };
346
346
  expect(
347
- testFilter(filterFromContext(context), {
347
+ testFilter(filterFromValue(context), {
348
348
  value: { filter: { field: "label" } },
349
349
  }),
350
350
  ).toBe(true);
package/lib/tools.ts CHANGED
@@ -6,7 +6,7 @@ export { defineGenericFetch } from "./tools/defineGenericFetch.js";
6
6
  export { escapeRegex } from "./tools/escapeRegex.js";
7
7
  export { fieldListFromFilter } from "./tools/fieldListFromFilter.js";
8
8
  export { filterChildren } from "./tools/filterChildren.js";
9
- export { filterFromContext } from "./tools/filterFromContext.js";
9
+ export { filterFromValue } from "./tools/filterFromValue.js";
10
10
  export { get } from "./tools/get.js";
11
11
  export { isFilterGroup } from "./tools/isFilterGroup.js";
12
12
  export { normalizeOrder } from "./tools/normalizeOrder.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quetch",
3
- "version": "0.23.1",
3
+ "version": "0.24.0",
4
4
  "type": "module",
5
5
  "main": "./dist/main.js",
6
6
  "exports": {
@@ -1,2 +0,0 @@
1
- import type { Context, Filter } from "../types";
2
- export declare function filterFromContext<T>(context: Context<T>): Filter<T>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"filterFromContext.js","sourceRoot":"","sources":["../../lib/tools/filterFromContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAG5C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;AAE3B,MAAM,UAAU,iBAAiB,CAAI,OAAmB;IACtD,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CACf,OAAe,EACf,OAA0B,WAAW;IAErC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE;QACxD,QAAQ,OAAO,KAAK,EAAE,CAAC;YACrB,KAAK,QAAQ;gBACX,OAAO;oBACL;wBACE,KAAK,EAAE,IAAI;wBACX,QAAQ,EAAE,OAAO;wBACjB,KAAK;qBACC;iBACT,CAAC;YACJ,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,SAAS,CAAC;YACf,KAAK,WAAW;gBACd,OAAO;oBACL;wBACE,KAAK,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC;wBACnD,QAAQ,EAAE,OAAO;wBACjB,KAAK;qBACO;iBACf,CAAC;YACJ,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;oBAClB,OAAO;wBACL;4BACE,KAAK,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC;4BACnD,QAAQ,EAAE,OAAO;4BACjB,KAAK;yBACO;qBACf,CAAC;gBACJ,CAAC;gBACD,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,KAAe,CAAC,CAAC,CAAC;YACrD,CAAC;YACD;gBACE,OAAO,WAAW,CAAC;YACrB,SAAS;QACX,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CACrB,OAAe;IAEf,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAkC,CAAC;IACjE,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,27 +0,0 @@
1
- [**quetch**](../README.md)
2
-
3
- ***
4
-
5
- [quetch](../README.md) / filterFromContext
6
-
7
- # Function: filterFromContext()
8
-
9
- > **filterFromContext**\<`T`\>(`context`): [`Filter`](../type-aliases/Filter.md)\<`T`\>
10
-
11
- ## Type Parameters
12
-
13
- • **T**
14
-
15
- ## Parameters
16
-
17
- ### context
18
-
19
- [`Context`](../type-aliases/Context.md)\<`T`\>
20
-
21
- ## Returns
22
-
23
- [`Filter`](../type-aliases/Filter.md)\<`T`\>
24
-
25
- ## Defined in
26
-
27
- [lib/tools/filterFromContext.ts:8](https://github.com/nevoland/quetch/blob/5d54d23c7450a0f85309e15fdf3a25ea832b3452/lib/tools/filterFromContext.ts#L8)