quetch 0.16.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors/RequestError.js +8 -24
- package/dist/errors/RequestError.js.map +1 -1
- package/dist/tools/queryItemList.js +11 -12
- package/dist/tools/queryItemList.js.map +1 -1
- package/dist/tools/testFilter.js +2 -2
- package/dist/types/AggregateFunction.d.ts +2 -1
- package/doc/classes/RequestError.md +5 -5
- package/doc/functions/aggregate.md +1 -1
- package/doc/functions/branch.md +1 -1
- package/doc/functions/cache.md +1 -1
- package/doc/functions/combine.md +1 -1
- package/doc/functions/cork.md +1 -1
- package/doc/functions/defineCheckQuery.md +1 -1
- package/doc/functions/defineCustomFetch.md +1 -1
- package/doc/functions/defineGenericFetch.md +1 -1
- package/doc/functions/escapeRegex.md +1 -1
- package/doc/functions/fetchExternal.md +1 -1
- package/doc/functions/fetchLocal.md +1 -1
- package/doc/functions/fieldListFromFilter.md +1 -1
- package/doc/functions/filterChildren.md +1 -1
- package/doc/functions/filterFromContext.md +1 -1
- package/doc/functions/get.md +1 -1
- package/doc/functions/identity.md +1 -1
- package/doc/functions/isFilterGroup.md +1 -1
- package/doc/functions/log.md +1 -1
- package/doc/functions/normalizeOrder.md +1 -1
- package/doc/functions/queryItemList.md +1 -1
- package/doc/functions/retry.md +1 -1
- package/doc/functions/reverseOrder.md +1 -1
- package/doc/functions/sortItemList.md +1 -1
- package/doc/functions/testFilter.md +1 -1
- package/doc/interfaces/CustomFetch.md +1 -1
- package/doc/type-aliases/AggregateFunction.md +2 -2
- package/doc/type-aliases/AggregateFunctionOperator.md +1 -1
- package/doc/type-aliases/Any.md +1 -1
- package/doc/type-aliases/Context.md +1 -1
- package/doc/type-aliases/CustomFieldAggregateMap.md +1 -1
- package/doc/type-aliases/CustomFieldMap.md +1 -1
- package/doc/type-aliases/Field.md +1 -1
- package/doc/type-aliases/FieldFiltered.md +1 -1
- package/doc/type-aliases/FieldFunction.md +1 -1
- package/doc/type-aliases/FieldFunctionCustom.md +1 -1
- package/doc/type-aliases/FieldFunctionFormatDate.md +1 -1
- package/doc/type-aliases/FieldFunctionReturn.md +1 -1
- package/doc/type-aliases/Filter.md +1 -1
- package/doc/type-aliases/FilterArray.md +1 -1
- package/doc/type-aliases/FilterBoolean.md +1 -1
- package/doc/type-aliases/FilterChildren.md +1 -1
- package/doc/type-aliases/FilterCustom.md +1 -1
- package/doc/type-aliases/FilterField.md +1 -1
- package/doc/type-aliases/FilterGroup.md +1 -1
- package/doc/type-aliases/FilterNumber.md +1 -1
- package/doc/type-aliases/FilterOperator.md +1 -1
- package/doc/type-aliases/FilterString.md +1 -1
- package/doc/type-aliases/FilterStringIntersect.md +1 -1
- package/doc/type-aliases/FilterStringMatch.md +1 -1
- package/doc/type-aliases/Get.md +1 -1
- package/doc/type-aliases/Group.md +1 -1
- package/doc/type-aliases/Handler.md +1 -1
- package/doc/type-aliases/Immutable.md +1 -1
- package/doc/type-aliases/Increment.md +1 -1
- package/doc/type-aliases/InjectCustomFields.md +1 -1
- package/doc/type-aliases/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/Locale.md +1 -1
- package/doc/type-aliases/Mutable.md +1 -1
- package/doc/type-aliases/NextHandler.md +1 -1
- package/doc/type-aliases/Order.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/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/lib/tools/queryItemList.ts +12 -15
- package/lib/tools/testFilter.test.ts +11 -0
- package/lib/tools/testFilter.ts +2 -2
- package/lib/types/AggregateFunction.ts +1 -2
- package/package.json +1 -1
|
@@ -2,32 +2,16 @@
|
|
|
2
2
|
* Error to be thrown in case there is an issue with the query call. Only instances of this error will be caught by the `retry()` middleware.
|
|
3
3
|
*/
|
|
4
4
|
export class RequestError extends Error {
|
|
5
|
+
status;
|
|
6
|
+
query;
|
|
7
|
+
request;
|
|
8
|
+
response;
|
|
5
9
|
constructor(message, status, query, request, response) {
|
|
6
10
|
super(message);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: status
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(this, "query", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: query
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(this, "request", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: request
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(this, "response", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: response
|
|
30
|
-
});
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.query = query;
|
|
13
|
+
this.request = request;
|
|
14
|
+
this.response = response;
|
|
31
15
|
}
|
|
32
16
|
}
|
|
33
17
|
//# sourceMappingURL=RequestError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestError.js","sourceRoot":"","sources":["../../lib/errors/RequestError.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"RequestError.js","sourceRoot":"","sources":["../../lib/errors/RequestError.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAG5B;IACA;IACA;IACA;IALT,YACE,OAAe,EACR,MAAc,EACd,KAAkB,EAClB,OAAiB,EACjB,QAAmB;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,WAAM,GAAN,MAAM,CAAQ;QACd,UAAK,GAAL,KAAK,CAAa;QAClB,YAAO,GAAP,OAAO,CAAU;QACjB,aAAQ,GAAR,QAAQ,CAAW;IAG5B,CAAC;CACF"}
|
|
@@ -18,13 +18,10 @@ function mergeContextAndFilter(context, filter) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function normalizeAggregator(aggregator) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case "index":
|
|
24
|
-
return { operator: aggregator };
|
|
25
|
-
default:
|
|
26
|
-
return aggregator;
|
|
21
|
+
if (typeof aggregator === "string") {
|
|
22
|
+
return { operator: aggregator };
|
|
27
23
|
}
|
|
24
|
+
return aggregator;
|
|
28
25
|
}
|
|
29
26
|
/**
|
|
30
27
|
* Performs a provided `query` on local data, provided through the `query.type` property.
|
|
@@ -87,7 +84,7 @@ export function queryItemList(query) {
|
|
|
87
84
|
}
|
|
88
85
|
case "index": {
|
|
89
86
|
const { offset = 0, order, limit = Infinity } = query;
|
|
90
|
-
const filterItem = normalizedAggregator
|
|
87
|
+
const { filter: filterItem, last } = normalizedAggregator;
|
|
91
88
|
let result = data;
|
|
92
89
|
// Filter
|
|
93
90
|
const normalizedFilter = mergeContextAndFilter(context, filter);
|
|
@@ -100,11 +97,13 @@ export function queryItemList(query) {
|
|
|
100
97
|
if (offset !== 0 || limit !== Infinity) {
|
|
101
98
|
result = result.slice(offset, offset + limit);
|
|
102
99
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
if (result.length === 0) {
|
|
101
|
+
return -1;
|
|
102
|
+
}
|
|
103
|
+
if (filterItem === undefined) {
|
|
104
|
+
return (last ? result.length - 1 : 0);
|
|
105
|
+
}
|
|
106
|
+
return result[last ? "findLastIndex" : "findIndex"]((item) => testFilter(filterItem, item, settings));
|
|
108
107
|
}
|
|
109
108
|
default: {
|
|
110
109
|
throw new Error(`Aggregator operator "${normalizedAggregator.operator}" is not implemented`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryItemList.js","sourceRoot":"","sources":["../../lib/tools/queryItemList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAS5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,SAAS,qBAAqB,CAC5B,OAAoB,EACpB,MAAkB;IAElB,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAClD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACvC,CAAC;IACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,UAAgC;IAEhC,
|
|
1
|
+
{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-99,7 +99,7 @@ export function testFilter(filter, value, settings) {
|
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
if (filter.options !== undefined || filter.locale !== undefined) {
|
|
102
|
-
return (rightValue.localeCompare(leftValue.slice(0, rightValue.length), filter.locale, filter.options)
|
|
102
|
+
return (rightValue.localeCompare(leftValue.slice(0, rightValue.length), filter.locale, filter.options) === 0);
|
|
103
103
|
}
|
|
104
104
|
return leftValue.startsWith(rightValue) ?? false;
|
|
105
105
|
}
|
|
@@ -110,7 +110,7 @@ export function testFilter(filter, value, settings) {
|
|
|
110
110
|
return false;
|
|
111
111
|
}
|
|
112
112
|
if (filter.options !== undefined || filter.locale !== undefined) {
|
|
113
|
-
return (rightValue.localeCompare(leftValue.slice(-rightValue.length), filter.locale, filter.options)
|
|
113
|
+
return (rightValue.localeCompare(leftValue.slice(-rightValue.length), filter.locale, filter.options) === 0);
|
|
114
114
|
}
|
|
115
115
|
return leftValue.endsWith(rightValue) ?? false;
|
|
116
116
|
}
|
|
@@ -4,9 +4,10 @@ import type { Filter } from "./Filter";
|
|
|
4
4
|
*/
|
|
5
5
|
export type AggregateFunction<T extends object> = "length" | {
|
|
6
6
|
operator: "length";
|
|
7
|
-
} |
|
|
7
|
+
} | {
|
|
8
8
|
operator: "index";
|
|
9
9
|
filter?: Filter<T>;
|
|
10
|
+
last?: boolean;
|
|
10
11
|
} | {
|
|
11
12
|
operator: "median" | "standardDeviation" | "mean" | "minimum" | "maximum" | "variance" | "mode";
|
|
12
13
|
field: keyof T;
|
|
@@ -40,7 +40,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
40
40
|
|
|
41
41
|
#### Defined in
|
|
42
42
|
|
|
43
|
-
[lib/errors/RequestError.ts:7](https://github.com/nevoland/quetch/blob/
|
|
43
|
+
[lib/errors/RequestError.ts:7](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/errors/RequestError.ts#L7)
|
|
44
44
|
|
|
45
45
|
## Properties
|
|
46
46
|
|
|
@@ -50,7 +50,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
50
50
|
|
|
51
51
|
#### Defined in
|
|
52
52
|
|
|
53
|
-
[lib/errors/RequestError.ts:10](https://github.com/nevoland/quetch/blob/
|
|
53
|
+
[lib/errors/RequestError.ts:10](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/errors/RequestError.ts#L10)
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
@@ -60,7 +60,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
60
60
|
|
|
61
61
|
#### Defined in
|
|
62
62
|
|
|
63
|
-
[lib/errors/RequestError.ts:11](https://github.com/nevoland/quetch/blob/
|
|
63
|
+
[lib/errors/RequestError.ts:11](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/errors/RequestError.ts#L11)
|
|
64
64
|
|
|
65
65
|
***
|
|
66
66
|
|
|
@@ -70,7 +70,7 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
70
70
|
|
|
71
71
|
#### Defined in
|
|
72
72
|
|
|
73
|
-
[lib/errors/RequestError.ts:12](https://github.com/nevoland/quetch/blob/
|
|
73
|
+
[lib/errors/RequestError.ts:12](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/errors/RequestError.ts#L12)
|
|
74
74
|
|
|
75
75
|
***
|
|
76
76
|
|
|
@@ -80,4 +80,4 @@ Error to be thrown in case there is an issue with the query call. Only instances
|
|
|
80
80
|
|
|
81
81
|
#### Defined in
|
|
82
82
|
|
|
83
|
-
[lib/errors/RequestError.ts:9](https://github.com/nevoland/quetch/blob/
|
|
83
|
+
[lib/errors/RequestError.ts:9](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/errors/RequestError.ts#L9)
|
|
@@ -46,4 +46,4 @@ If a query occurs twice, `mergeQuery(query, currentQuery)` is called and the out
|
|
|
46
46
|
|
|
47
47
|
## Defined in
|
|
48
48
|
|
|
49
|
-
[lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/
|
|
49
|
+
[lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/aggregate.ts#L16)
|
package/doc/functions/branch.md
CHANGED
|
@@ -43,4 +43,4 @@ const customFetch = combine(
|
|
|
43
43
|
|
|
44
44
|
## Defined in
|
|
45
45
|
|
|
46
|
-
[lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/
|
|
46
|
+
[lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/branch.ts#L21)
|
package/doc/functions/cache.md
CHANGED
|
@@ -56,4 +56,4 @@ Cache store.
|
|
|
56
56
|
|
|
57
57
|
## Defined in
|
|
58
58
|
|
|
59
|
-
[lib/middlewares/cache.ts:8](https://github.com/nevoland/quetch/blob/
|
|
59
|
+
[lib/middlewares/cache.ts:8](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/cache.ts#L8)
|
package/doc/functions/combine.md
CHANGED
|
@@ -114,4 +114,4 @@ Handler that combines all provided handlers.
|
|
|
114
114
|
|
|
115
115
|
## Defined in
|
|
116
116
|
|
|
117
|
-
[lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/
|
|
117
|
+
[lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/combine.ts#L801)
|
package/doc/functions/cork.md
CHANGED
|
@@ -20,4 +20,4 @@ Uncallable handler used to terminate a sequence of handlers combined with `combi
|
|
|
20
20
|
|
|
21
21
|
## Defined in
|
|
22
22
|
|
|
23
|
-
[lib/tools/cork.ts:6](https://github.com/nevoland/quetch/blob/
|
|
23
|
+
[lib/tools/cork.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/cork.ts#L6)
|
|
@@ -52,4 +52,4 @@ Function that checks queries.
|
|
|
52
52
|
|
|
53
53
|
## Defined in
|
|
54
54
|
|
|
55
|
-
[lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/
|
|
55
|
+
[lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/defineCheckQuery.ts#L8)
|
|
@@ -60,4 +60,4 @@ A custom fetch function.
|
|
|
60
60
|
|
|
61
61
|
## Defined in
|
|
62
62
|
|
|
63
|
-
[lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/
|
|
63
|
+
[lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/defineCustomFetch.ts#L11)
|
|
@@ -51,4 +51,4 @@ A curried generic fetch function.
|
|
|
51
51
|
|
|
52
52
|
## Defined in
|
|
53
53
|
|
|
54
|
-
[lib/tools/defineGenericFetch.ts:14](https://github.com/nevoland/quetch/blob/
|
|
54
|
+
[lib/tools/defineGenericFetch.ts:14](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/defineGenericFetch.ts#L14)
|
|
@@ -24,4 +24,4 @@ Escaped regular expression
|
|
|
24
24
|
|
|
25
25
|
## Defined in
|
|
26
26
|
|
|
27
|
-
[lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/
|
|
27
|
+
[lib/tools/escapeRegex.ts:7](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/escapeRegex.ts#L7)
|
|
@@ -24,4 +24,4 @@ Handler that returns a promise that resolves to the response.
|
|
|
24
24
|
|
|
25
25
|
## Defined in
|
|
26
26
|
|
|
27
|
-
[lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/
|
|
27
|
+
[lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/fetchExternal.ts#L12)
|
|
@@ -22,4 +22,4 @@ Promise that resolves to the response.
|
|
|
22
22
|
|
|
23
23
|
## Defined in
|
|
24
24
|
|
|
25
|
-
[lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/
|
|
25
|
+
[lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/fetchLocal.ts#L9)
|
|
@@ -28,4 +28,4 @@ A list of fields.
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/tools/fieldListFromFilter.ts:11](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/tools/fieldListFromFilter.ts:11](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/fieldListFromFilter.ts#L11)
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/tools/filterChildren.ts:5](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/filterChildren.ts#L5)
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
|
|
23
23
|
## Defined in
|
|
24
24
|
|
|
25
|
-
[lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/
|
|
25
|
+
[lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/filterFromContext.ts#L5)
|
package/doc/functions/get.md
CHANGED
|
@@ -37,4 +37,4 @@ The property value found at the given path, or `undefined` if it cannot be found
|
|
|
37
37
|
|
|
38
38
|
## Defined in
|
|
39
39
|
|
|
40
|
-
[lib/tools/get.ts:13](https://github.com/nevoland/quetch/blob/
|
|
40
|
+
[lib/tools/get.ts:13](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/get.ts#L13)
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
|
|
31
31
|
## Defined in
|
|
32
32
|
|
|
33
|
-
[lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/
|
|
33
|
+
[lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/identity.ts#L3)
|
|
@@ -28,4 +28,4 @@ Whether the provided filter is a group filter or not.
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/tools/isFilterGroup.ts:9](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/tools/isFilterGroup.ts:9](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/isFilterGroup.ts#L9)
|
package/doc/functions/log.md
CHANGED
|
@@ -32,4 +32,4 @@ Query handler
|
|
|
32
32
|
|
|
33
33
|
## Defined in
|
|
34
34
|
|
|
35
|
-
[lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/
|
|
35
|
+
[lib/middlewares/log.ts:13](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/log.ts#L13)
|
|
@@ -36,4 +36,4 @@ The normalized order object.
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/tools/normalizeOrder.ts:11](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/tools/normalizeOrder.ts:11](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/normalizeOrder.ts#L11)
|
|
@@ -30,4 +30,4 @@ The result of the query.
|
|
|
30
30
|
|
|
31
31
|
## Defined in
|
|
32
32
|
|
|
33
|
-
[lib/tools/queryItemList.ts:
|
|
33
|
+
[lib/tools/queryItemList.ts:48](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/queryItemList.ts#L48)
|
package/doc/functions/retry.md
CHANGED
|
@@ -30,4 +30,4 @@ Handler
|
|
|
30
30
|
|
|
31
31
|
## Defined in
|
|
32
32
|
|
|
33
|
-
[lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/
|
|
33
|
+
[lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/middlewares/retry.ts#L15)
|
|
@@ -36,4 +36,4 @@ The reversed order.
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/tools/reverseOrder.ts:11](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/tools/reverseOrder.ts:11](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/reverseOrder.ts#L11)
|
|
@@ -32,4 +32,4 @@ A new sorted array.
|
|
|
32
32
|
|
|
33
33
|
## Defined in
|
|
34
34
|
|
|
35
|
-
[lib/tools/sortItemList.ts:13](https://github.com/nevoland/quetch/blob/
|
|
35
|
+
[lib/tools/sortItemList.ts:13](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/sortItemList.ts#L13)
|
|
@@ -36,4 +36,4 @@ Optional query settings.
|
|
|
36
36
|
|
|
37
37
|
## Defined in
|
|
38
38
|
|
|
39
|
-
[lib/tools/testFilter.ts:28](https://github.com/nevoland/quetch/blob/
|
|
39
|
+
[lib/tools/testFilter.ts:28](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/tools/testFilter.ts#L28)
|
|
@@ -26,4 +26,4 @@
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[lib/types/CustomFetch.ts:5](https://github.com/nevoland/quetch/blob/
|
|
29
|
+
[lib/types/CustomFetch.ts:5](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/CustomFetch.ts#L5)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Type Alias: AggregateFunction\<T\>
|
|
8
8
|
|
|
9
|
-
> **AggregateFunction**\<`T`\>: `"length"` \| `object` \| `
|
|
9
|
+
> **AggregateFunction**\<`T`\>: `"length"` \| `object` \| `object` \| `object`
|
|
10
10
|
|
|
11
11
|
Aggregation function.
|
|
12
12
|
|
|
@@ -16,4 +16,4 @@ Aggregation function.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/AggregateFunction.ts:6](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/AggregateFunction.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/AggregateFunction.ts#L6)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/AggregateFunctionOperator.ts#L3)
|
package/doc/type-aliases/Any.md
CHANGED
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/
|
|
13
|
+
[lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Any.ts#L1)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Context.ts#L1)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/CustomFieldAggregateMap.ts#L3)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/CustomFieldMap.ts#L3)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Field.ts:3](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Field.ts:3](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Field.ts#L3)
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/FieldFiltered.ts:4](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/FieldFiltered.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FieldFiltered.ts#L4)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FieldFunction.ts#L4)
|
|
@@ -34,4 +34,4 @@ Applies a custom field transform function.
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/
|
|
37
|
+
[lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FieldFunctionCustom.ts#L4)
|
|
@@ -30,4 +30,4 @@ Formats the date found in a given field, which can be an ISO string date or a ti
|
|
|
30
30
|
|
|
31
31
|
## Defined in
|
|
32
32
|
|
|
33
|
-
[lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/
|
|
33
|
+
[lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FieldFunctionFormatDate.ts#L6)
|
|
@@ -18,4 +18,4 @@ Return types of custom field functions.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FieldFunctionReturn.ts#L4)
|
|
@@ -16,4 +16,4 @@ Describes a predicate for filtering items.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Filter.ts:15](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Filter.ts#L15)
|
|
@@ -28,4 +28,4 @@ Checks if a given array field matches a given array value according to a given o
|
|
|
28
28
|
|
|
29
29
|
## Defined in
|
|
30
30
|
|
|
31
|
-
[lib/types/FilterArray.ts:8](https://github.com/nevoland/quetch/blob/
|
|
31
|
+
[lib/types/FilterArray.ts:8](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FilterArray.ts#L8)
|
|
@@ -26,4 +26,4 @@ Checks if a given boolean field is `true` or `false`.
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[lib/types/FilterBoolean.ts:7](https://github.com/nevoland/quetch/blob/
|
|
29
|
+
[lib/types/FilterBoolean.ts:7](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FilterBoolean.ts#L7)
|
|
@@ -35,4 +35,4 @@ If `deep` is `true`, also captures all the descendants.
|
|
|
35
35
|
|
|
36
36
|
## Defined in
|
|
37
37
|
|
|
38
|
-
[lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/
|
|
38
|
+
[lib/types/FilterChildren.ts:10](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FilterChildren.ts#L10)
|
|
@@ -34,4 +34,4 @@ Custom filter where `value(item)` returns `true` for matching items.
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[lib/types/FilterCustom.ts:4](https://github.com/nevoland/quetch/blob/
|
|
37
|
+
[lib/types/FilterCustom.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FilterField.ts#L6)
|
|
@@ -16,4 +16,4 @@ Joins a list of filters with a specific boolean operator.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/FilterGroup.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/FilterStringMatch.ts#L9)
|
package/doc/type-aliases/Get.md
CHANGED
|
@@ -18,4 +18,4 @@ Returns the type of the property at the specified `P` path.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/Get.ts:6](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/Get.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Get.ts#L6)
|
|
@@ -16,4 +16,4 @@ Specifies how items should be grouped.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Group.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Group.ts#L4)
|
|
@@ -32,4 +32,4 @@ Handles an `input` query and returns an `output` promise, eventually using the `
|
|
|
32
32
|
|
|
33
33
|
## Defined in
|
|
34
34
|
|
|
35
|
-
[lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/
|
|
35
|
+
[lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Immutable.ts#L1)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Increment.ts:5](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Increment.ts:5](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Increment.ts#L5)
|
|
@@ -18,4 +18,4 @@ Injects the custom fields into the entity type.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/InjectCustomFields.ts#L8)
|
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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Key.ts#L1)
|
|
@@ -18,4 +18,4 @@ Returns object type with field extending the provided `P` type.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/KeyFiltered.ts:4](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/KeyFiltered.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/KeyFiltered.ts#L4)
|
|
@@ -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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Locale.ts#L1)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
|
|
15
15
|
## Defined in
|
|
16
16
|
|
|
17
|
-
[lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/
|
|
17
|
+
[lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Mutable.ts#L1)
|
|
@@ -26,4 +26,4 @@ Handles an `input` query and returns an `output` promise.
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/
|
|
29
|
+
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/NextHandler.ts#L4)
|
|
@@ -16,4 +16,4 @@ Order item.
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Order.ts:6](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Order.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Order.ts#L6)
|
|
@@ -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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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:3](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Path.ts:3](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Path.ts#L3)
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/PathFiltered.ts:3](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/PathFiltered.ts:3](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/PathFiltered.ts#L3)
|
|
@@ -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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/
|
|
51
|
+
[lib/types/QueryDelete.ts:9](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/
|
|
51
|
+
[lib/types/QueryDeleteMultiple.ts:9](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/QueryMethod.ts#L6)
|
|
@@ -76,4 +76,4 @@ Query settings.
|
|
|
76
76
|
|
|
77
77
|
## Defined in
|
|
78
78
|
|
|
79
|
-
[lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/
|
|
79
|
+
[lib/types/QueryRead.ts:10](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/QueryRead.ts#L10)
|
|
@@ -80,4 +80,4 @@ Query settings.
|
|
|
80
80
|
|
|
81
81
|
## Defined in
|
|
82
82
|
|
|
83
|
-
[lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/
|
|
83
|
+
[lib/types/QueryReadMultiple.ts:11](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/QueryReadMultiple.ts#L11)
|
|
@@ -60,4 +60,4 @@ A filter that captures the items expressed by the provided `FilterChildren`.
|
|
|
60
60
|
|
|
61
61
|
## Defined in
|
|
62
62
|
|
|
63
|
-
[lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/
|
|
63
|
+
[lib/types/QuerySettings.ts:8](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/4c3c4d08a348f3317d0dfdffa7516132c18306c7/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/
|
|
75
|
+
[lib/types/QueryUpdateMultiple.ts:10](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/QueryUpdateMultiple.ts#L10)
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
|
|
17
17
|
## Defined in
|
|
18
18
|
|
|
19
|
-
[lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/
|
|
19
|
+
[lib/types/Result.ts:20](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Result.ts#L20)
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
|
|
59
59
|
## Defined in
|
|
60
60
|
|
|
61
|
-
[lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/
|
|
61
|
+
[lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Store.ts#L2)
|
|
@@ -18,4 +18,4 @@ Actual `value` or `valueField` leading to the value.
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[lib/types/Value.ts:6](https://github.com/nevoland/quetch/blob/
|
|
21
|
+
[lib/types/Value.ts:6](https://github.com/nevoland/quetch/blob/4c3c4d08a348f3317d0dfdffa7516132c18306c7/lib/types/Value.ts#L6)
|
|
@@ -33,13 +33,10 @@ function mergeContextAndFilter<T extends object>(
|
|
|
33
33
|
function normalizeAggregator<T extends object>(
|
|
34
34
|
aggregator: AggregateFunction<T>,
|
|
35
35
|
): Exclude<AggregateFunction<T>, string> {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
case "index":
|
|
39
|
-
return { operator: aggregator };
|
|
40
|
-
default:
|
|
41
|
-
return aggregator;
|
|
36
|
+
if (typeof aggregator === "string") {
|
|
37
|
+
return { operator: aggregator };
|
|
42
38
|
}
|
|
39
|
+
return aggregator;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
/**
|
|
@@ -118,7 +115,7 @@ export function queryItemList<T extends object, const Q extends Query<T>>(
|
|
|
118
115
|
}
|
|
119
116
|
case "index": {
|
|
120
117
|
const { offset = 0, order, limit = Infinity } = query;
|
|
121
|
-
const filterItem = normalizedAggregator
|
|
118
|
+
const { filter: filterItem, last } = normalizedAggregator;
|
|
122
119
|
let result = data;
|
|
123
120
|
// Filter
|
|
124
121
|
const normalizedFilter = mergeContextAndFilter(context, filter);
|
|
@@ -133,14 +130,14 @@ export function queryItemList<T extends object, const Q extends Query<T>>(
|
|
|
133
130
|
if (offset !== 0 || limit !== Infinity) {
|
|
134
131
|
result = result.slice(offset, offset + limit);
|
|
135
132
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
if (result.length === 0) {
|
|
134
|
+
return -1 as Result<T, Q>;
|
|
135
|
+
}
|
|
136
|
+
if (filterItem === undefined) {
|
|
137
|
+
return (last ? result.length - 1 : 0) as Result<T, Q>;
|
|
138
|
+
}
|
|
139
|
+
return result[last ? "findLastIndex" : "findIndex"]((item) =>
|
|
140
|
+
testFilter(filterItem, item, settings),
|
|
144
141
|
) as Result<T, Q>;
|
|
145
142
|
}
|
|
146
143
|
default: {
|
|
@@ -134,6 +134,17 @@ test("tests filter on string values", () => {
|
|
|
134
134
|
{ a: "foo" },
|
|
135
135
|
),
|
|
136
136
|
).toBe(true);
|
|
137
|
+
expect(
|
|
138
|
+
testFilter(
|
|
139
|
+
{
|
|
140
|
+
field: "a",
|
|
141
|
+
operator: "startWith",
|
|
142
|
+
options: { sensitivity: "base" },
|
|
143
|
+
value: "HELLO",
|
|
144
|
+
},
|
|
145
|
+
{ a: "hello there!" },
|
|
146
|
+
),
|
|
147
|
+
).toBe(true);
|
|
137
148
|
expect(
|
|
138
149
|
testFilter(
|
|
139
150
|
{ field: "a", operator: "include", value: "bar" },
|
package/lib/tools/testFilter.ts
CHANGED
|
@@ -141,7 +141,7 @@ export function testFilter<T extends object>(
|
|
|
141
141
|
leftValue.slice(0, rightValue.length),
|
|
142
142
|
filter.locale,
|
|
143
143
|
filter.options,
|
|
144
|
-
)
|
|
144
|
+
) === 0
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
return leftValue.startsWith(rightValue) ?? false;
|
|
@@ -158,7 +158,7 @@ export function testFilter<T extends object>(
|
|
|
158
158
|
leftValue.slice(-rightValue.length),
|
|
159
159
|
filter.locale,
|
|
160
160
|
filter.options,
|
|
161
|
-
)
|
|
161
|
+
) === 0
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
164
|
return leftValue.endsWith(rightValue) ?? false;
|
|
@@ -6,8 +6,7 @@ import type { Filter } from "./Filter";
|
|
|
6
6
|
export type AggregateFunction<T extends object> =
|
|
7
7
|
| "length"
|
|
8
8
|
| { operator: "length" }
|
|
9
|
-
| "index"
|
|
10
|
-
| { operator: "index"; filter?: Filter<T> }
|
|
9
|
+
| { operator: "index"; filter?: Filter<T>; last?: boolean }
|
|
11
10
|
| {
|
|
12
11
|
operator:
|
|
13
12
|
| "median"
|