quetch 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.d.ts +3 -3
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/middlewares/aggregate.js +1 -1
- package/dist/middlewares/aggregate.js.map +1 -1
- package/dist/middlewares/branch.js +1 -1
- package/dist/middlewares/branch.js.map +1 -1
- package/dist/middlewares/fetchExternal.js +1 -1
- package/dist/middlewares/fetchExternal.js.map +1 -1
- package/dist/middlewares/fetchLocal.d.ts +5 -0
- package/dist/middlewares/fetchLocal.js +1 -6
- package/dist/middlewares/fetchLocal.js.map +1 -1
- package/dist/middlewares/retry.js +1 -1
- package/dist/middlewares/retry.js.map +1 -1
- package/dist/tools/defineGenericFetch.js +1 -1
- package/dist/tools/defineGenericFetch.js.map +1 -1
- package/dist/tools/queryItemList.d.ts +9 -3
- package/dist/tools/queryItemList.js +6 -5
- package/dist/tools/queryItemList.js.map +1 -1
- package/dist/tools/sortItemList.js +1 -1
- package/dist/tools/sortItemList.js.map +1 -1
- package/dist/types/{GenericFetch.d.ts → CustomFetch.d.ts} +1 -1
- package/dist/types/CustomFetch.js +2 -0
- package/dist/types/CustomFetch.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/doc/README.md +111 -71
- package/doc/interfaces/{GenericFetch.md → CustomFetch.md} +8 -8
- package/lib/main.ts +3 -3
- package/lib/middlewares/aggregate.ts +1 -1
- package/lib/middlewares/branch.ts +1 -1
- package/lib/middlewares/fetchExternal.ts +1 -1
- package/lib/middlewares/fetchLocal.ts +18 -3
- package/lib/middlewares/retry.ts +1 -1
- package/lib/tools/defineGenericFetch.ts +1 -1
- package/lib/tools/queryItemList.ts +25 -12
- package/lib/tools/sortItemList.ts +1 -1
- package/lib/types/{GenericFetch.ts → CustomFetch.ts} +1 -1
- package/lib/types.ts +1 -1
- package/package.json +1 -1
- package/dist/types/GenericFetch.js +0 -2
- package/dist/types/GenericFetch.js.map +0 -1
package/dist/main.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type * from "./types";
|
|
2
|
-
export * from "./tools";
|
|
3
|
-
export * from "./middlewares";
|
|
1
|
+
export type * from "./types.js";
|
|
2
|
+
export * from "./tools.js";
|
|
3
|
+
export * from "./middlewares.js";
|
package/dist/main.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./tools";
|
|
2
|
-
export * from "./middlewares";
|
|
1
|
+
export * from "./tools.js";
|
|
2
|
+
export * from "./middlewares.js";
|
|
3
3
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../lib/main.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../lib/main.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sleep } from "futurise";
|
|
2
|
-
import { RequestError } from "../errors";
|
|
2
|
+
import { RequestError } from "../errors.js";
|
|
3
3
|
/**
|
|
4
4
|
* Aggregates multiple incoming query calls into one query.
|
|
5
5
|
* Queries are grouped according to the string key returned by `queryGroupId(query)`. Inside a group, each query is identified with `queryId(query)`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../lib/middlewares/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../lib/middlewares/aggregate.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../lib/middlewares/branch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../lib/middlewares/branch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,MAAM,CACpB,SAAgC,EAChC,IAA2B,EAC3B,QAA+B,QAAiC;IAEhE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getGlobal } from "@davidbonnet/get-global";
|
|
2
|
-
import { RequestError } from "../errors/RequestError";
|
|
2
|
+
import { RequestError } from "../errors/RequestError.js";
|
|
3
3
|
/**
|
|
4
4
|
* Calls the provided `fetch` function, which defaults to the DOM `fetch` function, with the incoming `query`.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchExternal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchExternal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fetchExternal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchExternal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAK,GAAG,SAAS,EAAE,CAAC,KAAK;IAEzB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,CAAC,KAAK,EAAE;QACnD,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC3D;IACD,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;QAC1B,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;gBAChB,MAAM,IAAI,YAAY,CACpB,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,MAAM,EACf,SAAS,EACT,OAAO,EACP,QAAQ,CACT,CAAC;aACH;YACD,OAAO,QAAQ,CAAC;SACjB;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,KAAK,EAAE;gBAC1B,MAAM,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;aAChE;YACD,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;SAChE;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -4,6 +4,11 @@ import type { CustomFieldMap, Handler, Query } from "../types";
|
|
|
4
4
|
*
|
|
5
5
|
* @returns Promise that resolves to the response.
|
|
6
6
|
*/
|
|
7
|
+
export declare function fetchLocal<T extends object>(): Handler<Query<T, {}> & {
|
|
8
|
+
type: T[];
|
|
9
|
+
customFields: never;
|
|
10
|
+
}, any, never, never>;
|
|
7
11
|
export declare function fetchLocal<T extends object, C extends CustomFieldMap<T>>(): Handler<Query<T, C> & {
|
|
8
12
|
type: T[];
|
|
13
|
+
customFields: C;
|
|
9
14
|
}, any, never, never>;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { queryItemList } from "../tools/queryItemList";
|
|
2
|
-
/**
|
|
3
|
-
* Performs the fetch query on local data.
|
|
4
|
-
*
|
|
5
|
-
* @returns Promise that resolves to the response.
|
|
6
|
-
*/
|
|
1
|
+
import { queryItemList } from "../tools/queryItemList.js";
|
|
7
2
|
export function fetchLocal() {
|
|
8
3
|
return async (query, _) => queryItemList(query);
|
|
9
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchLocal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchLocal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fetchLocal.js","sourceRoot":"","sources":["../../lib/middlewares/fetchLocal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAkB1D,MAAM,UAAU,UAAU;IASxB,OAAO,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getGlobal } from "@davidbonnet/get-global";
|
|
2
2
|
import { sleep, untilOnline } from "futurise";
|
|
3
|
-
import { RequestError } from "../errors/RequestError";
|
|
3
|
+
import { RequestError } from "../errors/RequestError.js";
|
|
4
4
|
/**
|
|
5
5
|
* Retries a failed query call up to `amount` times, with a given `delay` in milliseconds at ±`delayDelta` milliseconds.
|
|
6
6
|
* Note that an `amount` set to `Infinity` results in indefinitely trying to resolve a query call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../lib/middlewares/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../lib/middlewares/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,MAAM,GAAG,CAAC,EACV,KAAK,GAAG,IAAI,EACZ,UAAU,GAAG,GAAG,GACjB,GAAG,EAAE;IACJ,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC;IAClC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,UAAU,GAAG,MAAM,CAAC;QACxB,MAAM,KAAK,GAAG,KAAK,IAAuB,EAAE;YAC1C,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC;aAC1B;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;oBAChD,UAAU,GAAG,MAAM,CAAC;oBACpB,MAAM,WAAW,EAAE,CAAC;iBACrB;qBAAM,IAAI,CAAC,CAAC,KAAK,YAAY,YAAY,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE;oBACjE,MAAM,KAAK,CAAC;iBACb;gBACD,IAAI,EAAE,UAAU,GAAG,CAAC,EAAE;oBACpB,MAAM,KAAK,CACT,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAC3D,KAAK,CAAC,MAAM,CACb,CAAC;oBACF,OAAO,KAAK,EAAE,CAAC;iBAChB;gBACD,MAAM,KAAK,CAAC;aACb;QACH,CAAC,CAAC;QACF,OAAO,KAAK,EAAE,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineGenericFetch.js","sourceRoot":"","sources":["../../lib/tools/defineGenericFetch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"defineGenericFetch.js","sourceRoot":"","sources":["../../lib/tools/defineGenericFetch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,kBAAkB,CAChC,OAKC;IAED,mHAAmH;IACnH,SAAS,YAAY;QAQnB,KAAK,UAAU,WAAW,CAIxB,KAA8C;YAE9C,OAAO,MAAM,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { CustomFieldMap, Query } from "../types";
|
|
2
|
-
|
|
1
|
+
import type { CustomFieldMap, Query, Result } from "../types.js";
|
|
2
|
+
declare function queryItemList<T extends object, const Q extends Query<T, {}>>(query: Q & {
|
|
3
3
|
type: T[];
|
|
4
|
-
|
|
4
|
+
customFields?: never;
|
|
5
|
+
}): Result<T, Q, {}>;
|
|
6
|
+
declare function queryItemList<T extends object, const Q extends Query<T, C>, const C extends CustomFieldMap<T>>(query: Q & {
|
|
7
|
+
type: T[];
|
|
8
|
+
customFields: C;
|
|
9
|
+
}): Result<T, Q, C>;
|
|
10
|
+
export { queryItemList };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RequestError } from "../errors";
|
|
2
|
-
import { filterFromContext } from "./filterFromContext";
|
|
3
|
-
import { filterItem } from "./filterItem";
|
|
4
|
-
import { sortItemList } from "./sortItemList";
|
|
1
|
+
import { RequestError } from "../errors.js";
|
|
2
|
+
import { filterFromContext } from "./filterFromContext.js";
|
|
3
|
+
import { filterItem } from "./filterItem.js";
|
|
4
|
+
import { sortItemList } from "./sortItemList.js";
|
|
5
5
|
function mergeContextAndFilter(context, filter) {
|
|
6
6
|
if (context === undefined) {
|
|
7
7
|
return filter ?? { operator: "any" };
|
|
@@ -20,7 +20,7 @@ function normalizeAggregator(aggregator) {
|
|
|
20
20
|
}
|
|
21
21
|
return aggregator.operator;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
function queryItemList(query) {
|
|
24
24
|
const data = query.type;
|
|
25
25
|
switch (query.method) {
|
|
26
26
|
case "read":
|
|
@@ -74,4 +74,5 @@ export function queryItemList(query) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
export { queryItemList };
|
|
77
78
|
//# sourceMappingURL=queryItemList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryItemList.js","sourceRoot":"","sources":["../../lib/tools/queryItemList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"queryItemList.js","sourceRoot":"","sources":["../../lib/tools/queryItemList.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortItemList.js","sourceRoot":"","sources":["../../lib/tools/sortItemList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"sortItemList.js","sourceRoot":"","sources":["../../lib/tools/sortItemList.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAiC,EACjC,KAAU;IAEV,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QACrD,OAAO,KAAK,CAAC;KACd;IACD,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACzB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC3D,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YACrD,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EAAE;gBACzB,SAAS;aACV;YACD,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;gBACvB,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC5B;YACD,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5B;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CustomFieldMap } from "./CustomFieldMap";
|
|
2
2
|
import type { Query } from "./Query";
|
|
3
3
|
import type { Result } from "./Result";
|
|
4
|
-
export interface
|
|
4
|
+
export interface CustomFetch<T extends object> {
|
|
5
5
|
<Q extends Query<T, {}>>(query: Q & {
|
|
6
6
|
customFields?: never;
|
|
7
7
|
}): Promise<Result<T, Q, {}>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomFetch.js","sourceRoot":"","sources":["../../lib/types/CustomFetch.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type { AggregateFunction } from "./types/AggregateFunction";
|
|
|
2
2
|
export type { AggregateFunctionOperator } from "./types/AggregateFunctionOperator";
|
|
3
3
|
export type { Any } from "./types/Any";
|
|
4
4
|
export type { Context } from "./types/Context";
|
|
5
|
+
export type { CustomFetch } from "./types/CustomFetch";
|
|
5
6
|
export type { CustomFieldAggregateMap } from "./types/CustomFieldAggregateMap";
|
|
6
7
|
export type { CustomFieldMap } from "./types/CustomFieldMap";
|
|
7
8
|
export type { CustomRequest } from "./types/CustomRequest";
|
|
@@ -20,7 +21,6 @@ export type { FilterSequence } from "./types/FilterSequence";
|
|
|
20
21
|
export type { FilterString } from "./types/FilterString";
|
|
21
22
|
export type { FilterStringIntersect } from "./types/FilterStringIntersect";
|
|
22
23
|
export type { FilterStringMatch } from "./types/FilterStringMatch";
|
|
23
|
-
export type { GenericFetch } from "./types/GenericFetch";
|
|
24
24
|
export type { Get } from "./types/Get";
|
|
25
25
|
export type { Group } from "./types/Group";
|
|
26
26
|
export type { Handler } from "./types/Handler";
|
package/doc/README.md
CHANGED
|
@@ -6,7 +6,7 @@ quetch
|
|
|
6
6
|
|
|
7
7
|
### Interfaces
|
|
8
8
|
|
|
9
|
-
- [
|
|
9
|
+
- [CustomFetch](interfaces/CustomFetch.md)
|
|
10
10
|
|
|
11
11
|
### Type Aliases
|
|
12
12
|
|
|
@@ -94,7 +94,7 @@ Aggregation function.
|
|
|
94
94
|
|
|
95
95
|
#### Defined in
|
|
96
96
|
|
|
97
|
-
[lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/
|
|
97
|
+
[lib/types/AggregateFunction.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/AggregateFunction.ts#L4)
|
|
98
98
|
|
|
99
99
|
___
|
|
100
100
|
|
|
@@ -104,7 +104,7 @@ ___
|
|
|
104
104
|
|
|
105
105
|
#### Defined in
|
|
106
106
|
|
|
107
|
-
[lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/
|
|
107
|
+
[lib/types/AggregateFunctionOperator.ts:3](https://github.com/nevoland/quetch/blob/970ac46/lib/types/AggregateFunctionOperator.ts#L3)
|
|
108
108
|
|
|
109
109
|
___
|
|
110
110
|
|
|
@@ -114,7 +114,7 @@ ___
|
|
|
114
114
|
|
|
115
115
|
#### Defined in
|
|
116
116
|
|
|
117
|
-
[lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/
|
|
117
|
+
[lib/types/Any.ts:1](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Any.ts#L1)
|
|
118
118
|
|
|
119
119
|
___
|
|
120
120
|
|
|
@@ -130,7 +130,7 @@ ___
|
|
|
130
130
|
|
|
131
131
|
#### Defined in
|
|
132
132
|
|
|
133
|
-
[lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/
|
|
133
|
+
[lib/types/Context.ts:1](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Context.ts#L1)
|
|
134
134
|
|
|
135
135
|
___
|
|
136
136
|
|
|
@@ -146,7 +146,7 @@ ___
|
|
|
146
146
|
|
|
147
147
|
#### Defined in
|
|
148
148
|
|
|
149
|
-
[lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/
|
|
149
|
+
[lib/types/CustomFieldAggregateMap.ts:3](https://github.com/nevoland/quetch/blob/970ac46/lib/types/CustomFieldAggregateMap.ts#L3)
|
|
150
150
|
|
|
151
151
|
___
|
|
152
152
|
|
|
@@ -162,7 +162,7 @@ ___
|
|
|
162
162
|
|
|
163
163
|
#### Defined in
|
|
164
164
|
|
|
165
|
-
[lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/
|
|
165
|
+
[lib/types/CustomFieldMap.ts:3](https://github.com/nevoland/quetch/blob/970ac46/lib/types/CustomFieldMap.ts#L3)
|
|
166
166
|
|
|
167
167
|
___
|
|
168
168
|
|
|
@@ -188,7 +188,7 @@ ___
|
|
|
188
188
|
|
|
189
189
|
#### Defined in
|
|
190
190
|
|
|
191
|
-
[lib/types/CustomRequest.ts:4](https://github.com/nevoland/quetch/blob/
|
|
191
|
+
[lib/types/CustomRequest.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/CustomRequest.ts#L4)
|
|
192
192
|
|
|
193
193
|
___
|
|
194
194
|
|
|
@@ -204,7 +204,7 @@ ___
|
|
|
204
204
|
|
|
205
205
|
#### Defined in
|
|
206
206
|
|
|
207
|
-
[lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/
|
|
207
|
+
[lib/types/FieldFunction.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FieldFunction.ts#L4)
|
|
208
208
|
|
|
209
209
|
___
|
|
210
210
|
|
|
@@ -229,7 +229,7 @@ Applies a custom field transform function.
|
|
|
229
229
|
|
|
230
230
|
#### Defined in
|
|
231
231
|
|
|
232
|
-
[lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/
|
|
232
|
+
[lib/types/FieldFunctionCustom.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FieldFunctionCustom.ts#L4)
|
|
233
233
|
|
|
234
234
|
___
|
|
235
235
|
|
|
@@ -255,7 +255,7 @@ Formats the date found in a given field, which can be an ISO string date or a ti
|
|
|
255
255
|
|
|
256
256
|
#### Defined in
|
|
257
257
|
|
|
258
|
-
[lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/
|
|
258
|
+
[lib/types/FieldFunctionFormatDate.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FieldFunctionFormatDate.ts#L6)
|
|
259
259
|
|
|
260
260
|
___
|
|
261
261
|
|
|
@@ -273,7 +273,7 @@ Return types of custom field functions.
|
|
|
273
273
|
|
|
274
274
|
#### Defined in
|
|
275
275
|
|
|
276
|
-
[lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/
|
|
276
|
+
[lib/types/FieldFunctionReturn.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FieldFunctionReturn.ts#L4)
|
|
277
277
|
|
|
278
278
|
___
|
|
279
279
|
|
|
@@ -291,7 +291,7 @@ Describes a predicate for filtering items.
|
|
|
291
291
|
|
|
292
292
|
#### Defined in
|
|
293
293
|
|
|
294
|
-
[lib/types/Filter.ts:12](https://github.com/nevoland/quetch/blob/
|
|
294
|
+
[lib/types/Filter.ts:12](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Filter.ts#L12)
|
|
295
295
|
|
|
296
296
|
___
|
|
297
297
|
|
|
@@ -318,7 +318,7 @@ Checks if a given array field matches a given array value according to a given o
|
|
|
318
318
|
|
|
319
319
|
#### Defined in
|
|
320
320
|
|
|
321
|
-
[lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/
|
|
321
|
+
[lib/types/FilterArray.ts:7](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterArray.ts#L7)
|
|
322
322
|
|
|
323
323
|
___
|
|
324
324
|
|
|
@@ -344,7 +344,7 @@ Checks if a given boolean field is `true` or `false`.
|
|
|
344
344
|
|
|
345
345
|
#### Defined in
|
|
346
346
|
|
|
347
|
-
[lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/
|
|
347
|
+
[lib/types/FilterBoolean.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterBoolean.ts#L6)
|
|
348
348
|
|
|
349
349
|
___
|
|
350
350
|
|
|
@@ -369,7 +369,7 @@ Checks if a given field exists.
|
|
|
369
369
|
|
|
370
370
|
#### Defined in
|
|
371
371
|
|
|
372
|
-
[lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/
|
|
372
|
+
[lib/types/FilterField.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterField.ts#L4)
|
|
373
373
|
|
|
374
374
|
___
|
|
375
375
|
|
|
@@ -388,7 +388,7 @@ Returns object type with field extending the provided `P` type.
|
|
|
388
388
|
|
|
389
389
|
#### Defined in
|
|
390
390
|
|
|
391
|
-
[lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/
|
|
391
|
+
[lib/types/FilterKeys.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterKeys.ts#L4)
|
|
392
392
|
|
|
393
393
|
___
|
|
394
394
|
|
|
@@ -414,7 +414,7 @@ Checks if a given number field matches a given number value according to a given
|
|
|
414
414
|
|
|
415
415
|
#### Defined in
|
|
416
416
|
|
|
417
|
-
[lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/
|
|
417
|
+
[lib/types/FilterNumber.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterNumber.ts#L6)
|
|
418
418
|
|
|
419
419
|
___
|
|
420
420
|
|
|
@@ -424,7 +424,7 @@ ___
|
|
|
424
424
|
|
|
425
425
|
#### Defined in
|
|
426
426
|
|
|
427
|
-
[lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/
|
|
427
|
+
[lib/types/FilterOperator.ts:3](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterOperator.ts#L3)
|
|
428
428
|
|
|
429
429
|
___
|
|
430
430
|
|
|
@@ -442,7 +442,7 @@ Joins a list of filters with a specific boolean operator.
|
|
|
442
442
|
|
|
443
443
|
#### Defined in
|
|
444
444
|
|
|
445
|
-
[lib/types/FilterSequence.ts:6](https://github.com/nevoland/quetch/blob/
|
|
445
|
+
[lib/types/FilterSequence.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterSequence.ts#L6)
|
|
446
446
|
|
|
447
447
|
___
|
|
448
448
|
|
|
@@ -468,7 +468,7 @@ Checks if a given string field matches a given string value according to a given
|
|
|
468
468
|
|
|
469
469
|
#### Defined in
|
|
470
470
|
|
|
471
|
-
[lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/
|
|
471
|
+
[lib/types/FilterString.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterString.ts#L6)
|
|
472
472
|
|
|
473
473
|
___
|
|
474
474
|
|
|
@@ -494,7 +494,7 @@ Checks if a given string field has any of the provided values.
|
|
|
494
494
|
|
|
495
495
|
#### Defined in
|
|
496
496
|
|
|
497
|
-
[lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/
|
|
497
|
+
[lib/types/FilterStringIntersect.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterStringIntersect.ts#L6)
|
|
498
498
|
|
|
499
499
|
___
|
|
500
500
|
|
|
@@ -524,7 +524,7 @@ Checks if a given string field matches a given regular expression.
|
|
|
524
524
|
|
|
525
525
|
#### Defined in
|
|
526
526
|
|
|
527
|
-
[lib/types/FilterStringMatch.ts:6](https://github.com/nevoland/quetch/blob/
|
|
527
|
+
[lib/types/FilterStringMatch.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/FilterStringMatch.ts#L6)
|
|
528
528
|
|
|
529
529
|
___
|
|
530
530
|
|
|
@@ -544,7 +544,7 @@ Returns the type of the property at the specified `K` key.
|
|
|
544
544
|
|
|
545
545
|
#### Defined in
|
|
546
546
|
|
|
547
|
-
[lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/
|
|
547
|
+
[lib/types/Get.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Get.ts#L4)
|
|
548
548
|
|
|
549
549
|
___
|
|
550
550
|
|
|
@@ -562,7 +562,7 @@ Specifies how items should be grouped.
|
|
|
562
562
|
|
|
563
563
|
#### Defined in
|
|
564
564
|
|
|
565
|
-
[lib/types/Group.ts:6](https://github.com/nevoland/quetch/blob/
|
|
565
|
+
[lib/types/Group.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Group.ts#L6)
|
|
566
566
|
|
|
567
567
|
___
|
|
568
568
|
|
|
@@ -598,7 +598,7 @@ Handles an `input` query and returns an `output` promise, eventually using the `
|
|
|
598
598
|
|
|
599
599
|
#### Defined in
|
|
600
600
|
|
|
601
|
-
[lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/
|
|
601
|
+
[lib/types/Handler.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Handler.ts#L6)
|
|
602
602
|
|
|
603
603
|
___
|
|
604
604
|
|
|
@@ -614,7 +614,7 @@ ___
|
|
|
614
614
|
|
|
615
615
|
#### Defined in
|
|
616
616
|
|
|
617
|
-
[lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/
|
|
617
|
+
[lib/types/Immutable.ts:1](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Immutable.ts#L1)
|
|
618
618
|
|
|
619
619
|
___
|
|
620
620
|
|
|
@@ -633,7 +633,7 @@ Injects the custom fields into the entity type.
|
|
|
633
633
|
|
|
634
634
|
#### Defined in
|
|
635
635
|
|
|
636
|
-
[lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/
|
|
636
|
+
[lib/types/InjectCustomFields.ts:8](https://github.com/nevoland/quetch/blob/970ac46/lib/types/InjectCustomFields.ts#L8)
|
|
637
637
|
|
|
638
638
|
___
|
|
639
639
|
|
|
@@ -652,7 +652,7 @@ Returns the inferred item type of an array, or an alternative type if it is some
|
|
|
652
652
|
|
|
653
653
|
#### Defined in
|
|
654
654
|
|
|
655
|
-
[lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/
|
|
655
|
+
[lib/types/Item.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Item.ts#L4)
|
|
656
656
|
|
|
657
657
|
___
|
|
658
658
|
|
|
@@ -662,7 +662,7 @@ ___
|
|
|
662
662
|
|
|
663
663
|
#### Defined in
|
|
664
664
|
|
|
665
|
-
[lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/
|
|
665
|
+
[lib/types/Key.ts:1](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Key.ts#L1)
|
|
666
666
|
|
|
667
667
|
___
|
|
668
668
|
|
|
@@ -678,7 +678,7 @@ ___
|
|
|
678
678
|
|
|
679
679
|
#### Defined in
|
|
680
680
|
|
|
681
|
-
[lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/
|
|
681
|
+
[lib/types/Mutable.ts:1](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Mutable.ts#L1)
|
|
682
682
|
|
|
683
683
|
___
|
|
684
684
|
|
|
@@ -711,7 +711,7 @@ Handles an `input` query and returns an `output` promise.
|
|
|
711
711
|
|
|
712
712
|
#### Defined in
|
|
713
713
|
|
|
714
|
-
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/
|
|
714
|
+
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/NextHandler.ts#L4)
|
|
715
715
|
|
|
716
716
|
___
|
|
717
717
|
|
|
@@ -729,7 +729,7 @@ Order item.
|
|
|
729
729
|
|
|
730
730
|
#### Defined in
|
|
731
731
|
|
|
732
|
-
[lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/
|
|
732
|
+
[lib/types/Order.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Order.ts#L4)
|
|
733
733
|
|
|
734
734
|
___
|
|
735
735
|
|
|
@@ -750,7 +750,7 @@ Query that fetches or mutates an entity.
|
|
|
750
750
|
|
|
751
751
|
#### Defined in
|
|
752
752
|
|
|
753
|
-
[lib/types/Query.ts:28](https://github.com/nevoland/quetch/blob/
|
|
753
|
+
[lib/types/Query.ts:28](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Query.ts#L28)
|
|
754
754
|
|
|
755
755
|
___
|
|
756
756
|
|
|
@@ -776,7 +776,7 @@ Query for computing an aggregated value.
|
|
|
776
776
|
|
|
777
777
|
#### Defined in
|
|
778
778
|
|
|
779
|
-
[lib/types/QueryAggregate.ts:7](https://github.com/nevoland/quetch/blob/
|
|
779
|
+
[lib/types/QueryAggregate.ts:7](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryAggregate.ts#L7)
|
|
780
780
|
|
|
781
781
|
___
|
|
782
782
|
|
|
@@ -786,7 +786,7 @@ ___
|
|
|
786
786
|
|
|
787
787
|
#### Defined in
|
|
788
788
|
|
|
789
|
-
[lib/types/QueryAny.ts:5](https://github.com/nevoland/quetch/blob/
|
|
789
|
+
[lib/types/QueryAny.ts:5](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryAny.ts#L5)
|
|
790
790
|
|
|
791
791
|
___
|
|
792
792
|
|
|
@@ -812,7 +812,7 @@ Query for creating an item.
|
|
|
812
812
|
|
|
813
813
|
#### Defined in
|
|
814
814
|
|
|
815
|
-
[lib/types/QueryCreate.ts:4](https://github.com/nevoland/quetch/blob/
|
|
815
|
+
[lib/types/QueryCreate.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryCreate.ts#L4)
|
|
816
816
|
|
|
817
817
|
___
|
|
818
818
|
|
|
@@ -838,7 +838,7 @@ Query for creating multiple items.
|
|
|
838
838
|
|
|
839
839
|
#### Defined in
|
|
840
840
|
|
|
841
|
-
[lib/types/QueryCreateMultiple.ts:4](https://github.com/nevoland/quetch/blob/
|
|
841
|
+
[lib/types/QueryCreateMultiple.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryCreateMultiple.ts#L4)
|
|
842
842
|
|
|
843
843
|
___
|
|
844
844
|
|
|
@@ -865,7 +865,7 @@ Query for deleting an item.
|
|
|
865
865
|
|
|
866
866
|
#### Defined in
|
|
867
867
|
|
|
868
|
-
[lib/types/QueryDelete.ts:7](https://github.com/nevoland/quetch/blob/
|
|
868
|
+
[lib/types/QueryDelete.ts:7](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryDelete.ts#L7)
|
|
869
869
|
|
|
870
870
|
___
|
|
871
871
|
|
|
@@ -892,7 +892,7 @@ Query for deleting multiple items.
|
|
|
892
892
|
|
|
893
893
|
#### Defined in
|
|
894
894
|
|
|
895
|
-
[lib/types/QueryDeleteMultiple.ts:7](https://github.com/nevoland/quetch/blob/
|
|
895
|
+
[lib/types/QueryDeleteMultiple.ts:7](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryDeleteMultiple.ts#L7)
|
|
896
896
|
|
|
897
897
|
___
|
|
898
898
|
|
|
@@ -904,7 +904,7 @@ Available query methods.
|
|
|
904
904
|
|
|
905
905
|
#### Defined in
|
|
906
906
|
|
|
907
|
-
[lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/
|
|
907
|
+
[lib/types/QueryMethod.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryMethod.ts#L6)
|
|
908
908
|
|
|
909
909
|
___
|
|
910
910
|
|
|
@@ -934,7 +934,7 @@ Query for reading a single item.
|
|
|
934
934
|
|
|
935
935
|
#### Defined in
|
|
936
936
|
|
|
937
|
-
[lib/types/QueryRead.ts:7](https://github.com/nevoland/quetch/blob/
|
|
937
|
+
[lib/types/QueryRead.ts:7](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryRead.ts#L7)
|
|
938
938
|
|
|
939
939
|
___
|
|
940
940
|
|
|
@@ -965,7 +965,7 @@ Query for getting a list of items.
|
|
|
965
965
|
|
|
966
966
|
#### Defined in
|
|
967
967
|
|
|
968
|
-
[lib/types/QueryReadMultiple.ts:8](https://github.com/nevoland/quetch/blob/
|
|
968
|
+
[lib/types/QueryReadMultiple.ts:8](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryReadMultiple.ts#L8)
|
|
969
969
|
|
|
970
970
|
___
|
|
971
971
|
|
|
@@ -995,7 +995,7 @@ Query for updating an item.
|
|
|
995
995
|
|
|
996
996
|
#### Defined in
|
|
997
997
|
|
|
998
|
-
[lib/types/QueryUpdate.ts:6](https://github.com/nevoland/quetch/blob/
|
|
998
|
+
[lib/types/QueryUpdate.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryUpdate.ts#L6)
|
|
999
999
|
|
|
1000
1000
|
___
|
|
1001
1001
|
|
|
@@ -1025,7 +1025,7 @@ Query for updating multiple items.
|
|
|
1025
1025
|
|
|
1026
1026
|
#### Defined in
|
|
1027
1027
|
|
|
1028
|
-
[lib/types/QueryUpdateMultiple.ts:7](https://github.com/nevoland/quetch/blob/
|
|
1028
|
+
[lib/types/QueryUpdateMultiple.ts:7](https://github.com/nevoland/quetch/blob/970ac46/lib/types/QueryUpdateMultiple.ts#L7)
|
|
1029
1029
|
|
|
1030
1030
|
___
|
|
1031
1031
|
|
|
@@ -1044,7 +1044,7 @@ ___
|
|
|
1044
1044
|
|
|
1045
1045
|
#### Defined in
|
|
1046
1046
|
|
|
1047
|
-
[lib/types/Result.ts:25](https://github.com/nevoland/quetch/blob/
|
|
1047
|
+
[lib/types/Result.ts:25](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Result.ts#L25)
|
|
1048
1048
|
|
|
1049
1049
|
___
|
|
1050
1050
|
|
|
@@ -1069,7 +1069,7 @@ ___
|
|
|
1069
1069
|
|
|
1070
1070
|
#### Defined in
|
|
1071
1071
|
|
|
1072
|
-
[lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/
|
|
1072
|
+
[lib/types/Store.ts:2](https://github.com/nevoland/quetch/blob/970ac46/lib/types/Store.ts#L2)
|
|
1073
1073
|
|
|
1074
1074
|
## Functions
|
|
1075
1075
|
|
|
@@ -1110,7 +1110,7 @@ If a query occurs twice, `mergeQuery(query, currentQuery)` is called and the out
|
|
|
1110
1110
|
|
|
1111
1111
|
#### Defined in
|
|
1112
1112
|
|
|
1113
|
-
[lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/
|
|
1113
|
+
[lib/middlewares/aggregate.ts:16](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/aggregate.ts#L16)
|
|
1114
1114
|
|
|
1115
1115
|
___
|
|
1116
1116
|
|
|
@@ -1152,7 +1152,7 @@ const customFetch = combine(
|
|
|
1152
1152
|
|
|
1153
1153
|
#### Defined in
|
|
1154
1154
|
|
|
1155
|
-
[lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/
|
|
1155
|
+
[lib/middlewares/branch.ts:21](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/branch.ts#L21)
|
|
1156
1156
|
|
|
1157
1157
|
___
|
|
1158
1158
|
|
|
@@ -1181,7 +1181,7 @@ ___
|
|
|
1181
1181
|
|
|
1182
1182
|
#### Defined in
|
|
1183
1183
|
|
|
1184
|
-
[lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/
|
|
1184
|
+
[lib/middlewares/cache.ts:39](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/cache.ts#L39)
|
|
1185
1185
|
|
|
1186
1186
|
___
|
|
1187
1187
|
|
|
@@ -1254,7 +1254,7 @@ Handler that combines all provided handlers.
|
|
|
1254
1254
|
|
|
1255
1255
|
#### Defined in
|
|
1256
1256
|
|
|
1257
|
-
[lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/
|
|
1257
|
+
[lib/middlewares/combine.ts:801](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/combine.ts#L801)
|
|
1258
1258
|
|
|
1259
1259
|
___
|
|
1260
1260
|
|
|
@@ -1276,7 +1276,7 @@ Uncallable handler used to terminate a sequence of handlers combined with `combi
|
|
|
1276
1276
|
|
|
1277
1277
|
#### Defined in
|
|
1278
1278
|
|
|
1279
|
-
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/
|
|
1279
|
+
[lib/types/NextHandler.ts:4](https://github.com/nevoland/quetch/blob/970ac46/lib/types/NextHandler.ts#L4)
|
|
1280
1280
|
|
|
1281
1281
|
___
|
|
1282
1282
|
|
|
@@ -1341,7 +1341,7 @@ typeof `query`
|
|
|
1341
1341
|
|
|
1342
1342
|
#### Defined in
|
|
1343
1343
|
|
|
1344
|
-
[lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/
|
|
1344
|
+
[lib/tools/defineCheckQuery.ts:8](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/defineCheckQuery.ts#L8)
|
|
1345
1345
|
|
|
1346
1346
|
___
|
|
1347
1347
|
|
|
@@ -1448,7 +1448,7 @@ ___
|
|
|
1448
1448
|
|
|
1449
1449
|
#### Defined in
|
|
1450
1450
|
|
|
1451
|
-
[lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/
|
|
1451
|
+
[lib/tools/defineCustomFetch.ts:11](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/defineCustomFetch.ts#L11)
|
|
1452
1452
|
|
|
1453
1453
|
___
|
|
1454
1454
|
|
|
@@ -1523,7 +1523,7 @@ ___
|
|
|
1523
1523
|
|
|
1524
1524
|
#### Defined in
|
|
1525
1525
|
|
|
1526
|
-
[lib/tools/defineGenericFetch.ts:5](https://github.com/nevoland/quetch/blob/
|
|
1526
|
+
[lib/tools/defineGenericFetch.ts:5](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/defineGenericFetch.ts#L5)
|
|
1527
1527
|
|
|
1528
1528
|
___
|
|
1529
1529
|
|
|
@@ -1547,13 +1547,13 @@ Handler that returns a promise that resolves to the response.
|
|
|
1547
1547
|
|
|
1548
1548
|
#### Defined in
|
|
1549
1549
|
|
|
1550
|
-
[lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/
|
|
1550
|
+
[lib/middlewares/fetchExternal.ts:12](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/fetchExternal.ts#L12)
|
|
1551
1551
|
|
|
1552
1552
|
___
|
|
1553
1553
|
|
|
1554
1554
|
### fetchLocal
|
|
1555
1555
|
|
|
1556
|
-
▸ **fetchLocal**<`T
|
|
1556
|
+
▸ **fetchLocal**<`T`\>(): [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, {}\> & { `customFields`: `never` ; `type`: `T`[] }, `any`, `never`, `never`\>
|
|
1557
1557
|
|
|
1558
1558
|
Performs the fetch query on local data.
|
|
1559
1559
|
|
|
@@ -1562,17 +1562,33 @@ Performs the fetch query on local data.
|
|
|
1562
1562
|
| Name | Type |
|
|
1563
1563
|
| :------ | :------ |
|
|
1564
1564
|
| `T` | extends `object` |
|
|
1565
|
-
| `C` | extends [`CustomFieldMap`](README.md#customfieldmap)<`T`\> |
|
|
1566
1565
|
|
|
1567
1566
|
#### Returns
|
|
1568
1567
|
|
|
1569
|
-
[`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`,
|
|
1568
|
+
[`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, {}\> & { `customFields`: `never` ; `type`: `T`[] }, `any`, `never`, `never`\>
|
|
1570
1569
|
|
|
1571
1570
|
Promise that resolves to the response.
|
|
1572
1571
|
|
|
1573
1572
|
#### Defined in
|
|
1574
1573
|
|
|
1575
|
-
[lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/
|
|
1574
|
+
[lib/middlewares/fetchLocal.ts:9](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/fetchLocal.ts#L9)
|
|
1575
|
+
|
|
1576
|
+
▸ **fetchLocal**<`T`, `C`\>(): [`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, `C`\> & { `customFields`: `C` ; `type`: `T`[] }, `any`, `never`, `never`\>
|
|
1577
|
+
|
|
1578
|
+
#### Type parameters
|
|
1579
|
+
|
|
1580
|
+
| Name | Type |
|
|
1581
|
+
| :------ | :------ |
|
|
1582
|
+
| `T` | extends `object` |
|
|
1583
|
+
| `C` | extends [`CustomFieldMap`](README.md#customfieldmap)<`T`\> |
|
|
1584
|
+
|
|
1585
|
+
#### Returns
|
|
1586
|
+
|
|
1587
|
+
[`Handler`](README.md#handler)<[`Query`](README.md#query)<`T`, `C`\> & { `customFields`: `C` ; `type`: `T`[] }, `any`, `never`, `never`\>
|
|
1588
|
+
|
|
1589
|
+
#### Defined in
|
|
1590
|
+
|
|
1591
|
+
[lib/middlewares/fetchLocal.ts:15](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/fetchLocal.ts#L15)
|
|
1576
1592
|
|
|
1577
1593
|
___
|
|
1578
1594
|
|
|
@@ -1598,7 +1614,7 @@ ___
|
|
|
1598
1614
|
|
|
1599
1615
|
#### Defined in
|
|
1600
1616
|
|
|
1601
|
-
[lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/
|
|
1617
|
+
[lib/tools/filterFromContext.ts:5](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/filterFromContext.ts#L5)
|
|
1602
1618
|
|
|
1603
1619
|
___
|
|
1604
1620
|
|
|
@@ -1629,7 +1645,7 @@ Checks wether the provided `value` matches the `filter` or not.
|
|
|
1629
1645
|
|
|
1630
1646
|
#### Defined in
|
|
1631
1647
|
|
|
1632
|
-
[lib/tools/filterItem.ts:12](https://github.com/nevoland/quetch/blob/
|
|
1648
|
+
[lib/tools/filterItem.ts:12](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/filterItem.ts#L12)
|
|
1633
1649
|
|
|
1634
1650
|
___
|
|
1635
1651
|
|
|
@@ -1659,7 +1675,7 @@ ___
|
|
|
1659
1675
|
|
|
1660
1676
|
#### Defined in
|
|
1661
1677
|
|
|
1662
|
-
[lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/
|
|
1678
|
+
[lib/middlewares/identity.ts:3](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/identity.ts#L3)
|
|
1663
1679
|
|
|
1664
1680
|
___
|
|
1665
1681
|
|
|
@@ -1692,7 +1708,7 @@ Query handler
|
|
|
1692
1708
|
|
|
1693
1709
|
#### Defined in
|
|
1694
1710
|
|
|
1695
|
-
[lib/middlewares/log.ts:11](https://github.com/nevoland/quetch/blob/
|
|
1711
|
+
[lib/middlewares/log.ts:11](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/log.ts#L11)
|
|
1696
1712
|
|
|
1697
1713
|
___
|
|
1698
1714
|
|
|
@@ -1723,34 +1739,58 @@ ___
|
|
|
1723
1739
|
|
|
1724
1740
|
#### Defined in
|
|
1725
1741
|
|
|
1726
|
-
[lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/
|
|
1742
|
+
[lib/tools/normalizeOrder.ts:3](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/normalizeOrder.ts#L3)
|
|
1727
1743
|
|
|
1728
1744
|
___
|
|
1729
1745
|
|
|
1730
1746
|
### queryItemList
|
|
1731
1747
|
|
|
1732
|
-
▸ **queryItemList**<`T`, `
|
|
1748
|
+
▸ **queryItemList**<`T`, `Q`\>(`query`): [`Result`](README.md#result)<`T`, `Q`, {}\>
|
|
1749
|
+
|
|
1750
|
+
#### Type parameters
|
|
1751
|
+
|
|
1752
|
+
| Name | Type |
|
|
1753
|
+
| :------ | :------ |
|
|
1754
|
+
| `T` | extends `object` |
|
|
1755
|
+
| `Q` | extends [`Query`](README.md#query)<`T`, {}\> |
|
|
1756
|
+
|
|
1757
|
+
#### Parameters
|
|
1758
|
+
|
|
1759
|
+
| Name | Type |
|
|
1760
|
+
| :------ | :------ |
|
|
1761
|
+
| `query` | `Q` & { `customFields?`: `undefined` ; `type`: `T`[] } |
|
|
1762
|
+
|
|
1763
|
+
#### Returns
|
|
1764
|
+
|
|
1765
|
+
[`Result`](README.md#result)<`T`, `Q`, {}\>
|
|
1766
|
+
|
|
1767
|
+
#### Defined in
|
|
1768
|
+
|
|
1769
|
+
[lib/tools/queryItemList.ts:42](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/queryItemList.ts#L42)
|
|
1770
|
+
|
|
1771
|
+
▸ **queryItemList**<`T`, `Q`, `C`\>(`query`): [`Result`](README.md#result)<`T`, `Q`, `C`\>
|
|
1733
1772
|
|
|
1734
1773
|
#### Type parameters
|
|
1735
1774
|
|
|
1736
1775
|
| Name | Type |
|
|
1737
1776
|
| :------ | :------ |
|
|
1738
1777
|
| `T` | extends `object` |
|
|
1778
|
+
| `Q` | extends [`Query`](README.md#query)<`T`, `C`\> |
|
|
1739
1779
|
| `C` | extends [`CustomFieldMap`](README.md#customfieldmap)<`T`\> |
|
|
1740
1780
|
|
|
1741
1781
|
#### Parameters
|
|
1742
1782
|
|
|
1743
1783
|
| Name | Type |
|
|
1744
1784
|
| :------ | :------ |
|
|
1745
|
-
| `query` | `
|
|
1785
|
+
| `query` | `Q` & { `customFields`: `C` ; `type`: `T`[] } |
|
|
1746
1786
|
|
|
1747
1787
|
#### Returns
|
|
1748
1788
|
|
|
1749
|
-
`
|
|
1789
|
+
[`Result`](README.md#result)<`T`, `Q`, `C`\>
|
|
1750
1790
|
|
|
1751
1791
|
#### Defined in
|
|
1752
1792
|
|
|
1753
|
-
[lib/tools/queryItemList.ts:
|
|
1793
|
+
[lib/tools/queryItemList.ts:45](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/queryItemList.ts#L45)
|
|
1754
1794
|
|
|
1755
1795
|
___
|
|
1756
1796
|
|
|
@@ -1779,7 +1819,7 @@ Handler
|
|
|
1779
1819
|
|
|
1780
1820
|
#### Defined in
|
|
1781
1821
|
|
|
1782
|
-
[lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/
|
|
1822
|
+
[lib/middlewares/retry.ts:15](https://github.com/nevoland/quetch/blob/970ac46/lib/middlewares/retry.ts#L15)
|
|
1783
1823
|
|
|
1784
1824
|
___
|
|
1785
1825
|
|
|
@@ -1810,4 +1850,4 @@ The same array sorted in place.
|
|
|
1810
1850
|
|
|
1811
1851
|
#### Defined in
|
|
1812
1852
|
|
|
1813
|
-
[lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/
|
|
1853
|
+
[lib/tools/sortItemList.ts:12](https://github.com/nevoland/quetch/blob/970ac46/lib/tools/sortItemList.ts#L12)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
[quetch](../README.md) /
|
|
1
|
+
[quetch](../README.md) / CustomFetch
|
|
2
2
|
|
|
3
|
-
# Interface:
|
|
3
|
+
# Interface: CustomFetch<T\>
|
|
4
4
|
|
|
5
5
|
## Type parameters
|
|
6
6
|
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
## Callable
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### CustomFetch
|
|
14
14
|
|
|
15
|
-
▸ **
|
|
15
|
+
▸ **CustomFetch**<`Q`\>(`query`): `Promise`<[`Result`](../README.md#result)<`T`, `Q`, {}, { readonly [K in string \| number \| symbol]: K extends keyof T ? T[K] : K extends never ? Object[K] extends FieldFunctionCustom<T\> ? ReturnType<Object[K]["value"]\> : Object[K]["operator"] extends "formatDate" ? FieldFunctionReturn[Object[K]["operator"]] : never : never }\>\>
|
|
16
16
|
|
|
17
17
|
#### Type parameters
|
|
18
18
|
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
|
|
33
33
|
#### Defined in
|
|
34
34
|
|
|
35
|
-
[lib/types/
|
|
35
|
+
[lib/types/CustomFetch.ts:6](https://github.com/nevoland/quetch/blob/970ac46/lib/types/CustomFetch.ts#L6)
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### CustomFetch
|
|
38
38
|
|
|
39
|
-
▸ **
|
|
39
|
+
▸ **CustomFetch**<`Q`, `C`\>(`query`): `Promise`<[`Result`](../README.md#result)<`T`, `Q`, `C`, [`InjectCustomFields`](../README.md#injectcustomfields)<`T`, `C`\>\>\>
|
|
40
40
|
|
|
41
41
|
#### Type parameters
|
|
42
42
|
|
|
@@ -57,4 +57,4 @@
|
|
|
57
57
|
|
|
58
58
|
#### Defined in
|
|
59
59
|
|
|
60
|
-
[lib/types/
|
|
60
|
+
[lib/types/CustomFetch.ts:9](https://github.com/nevoland/quetch/blob/970ac46/lib/types/CustomFetch.ts#L9)
|
package/lib/main.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type * from "./types";
|
|
1
|
+
export type * from "./types.js";
|
|
2
2
|
|
|
3
|
-
export * from "./tools";
|
|
4
|
-
export * from "./middlewares";
|
|
3
|
+
export * from "./tools.js";
|
|
4
|
+
export * from "./middlewares.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Handler } from "../types";
|
|
2
2
|
|
|
3
|
-
import { identity } from "./identity";
|
|
3
|
+
import { identity } from "./identity.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dispatches an incoming query to `left` if `condition(query)` returns a truthy value, `right` otherwise. This is helpful for sending queries to different resolvers.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { queryItemList } from "../tools/queryItemList";
|
|
1
|
+
import { queryItemList } from "../tools/queryItemList.js";
|
|
2
2
|
import type { CustomFieldMap, Handler, Query } from "../types";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -6,9 +6,24 @@ import type { CustomFieldMap, Handler, Query } from "../types";
|
|
|
6
6
|
*
|
|
7
7
|
* @returns Promise that resolves to the response.
|
|
8
8
|
*/
|
|
9
|
+
export function fetchLocal<T extends object>(): Handler<
|
|
10
|
+
Query<T, {}> & { type: T[]; customFields: never },
|
|
11
|
+
any,
|
|
12
|
+
never,
|
|
13
|
+
never
|
|
14
|
+
>;
|
|
9
15
|
export function fetchLocal<
|
|
10
16
|
T extends object,
|
|
11
17
|
C extends CustomFieldMap<T>,
|
|
12
|
-
>(): Handler<Query<T, C> & { type: T[] }, any, never, never
|
|
13
|
-
|
|
18
|
+
>(): Handler<Query<T, C> & { type: T[]; customFields: C }, any, never, never>;
|
|
19
|
+
export function fetchLocal<
|
|
20
|
+
T extends object,
|
|
21
|
+
C extends CustomFieldMap<T>,
|
|
22
|
+
>(): Handler<
|
|
23
|
+
Query<T, C> & { type: T[]; customFields: C | never },
|
|
24
|
+
any,
|
|
25
|
+
never,
|
|
26
|
+
never
|
|
27
|
+
> {
|
|
28
|
+
return async (query, _) => queryItemList(query);
|
|
14
29
|
}
|
package/lib/middlewares/retry.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getGlobal } from "@davidbonnet/get-global";
|
|
2
2
|
import { sleep, untilOnline } from "futurise";
|
|
3
3
|
|
|
4
|
-
import { RequestError } from "../errors/RequestError";
|
|
4
|
+
import { RequestError } from "../errors/RequestError.js";
|
|
5
5
|
import type { Handler } from "../types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequestError } from "../errors";
|
|
1
|
+
import { RequestError } from "../errors.js";
|
|
2
2
|
import type {
|
|
3
3
|
AggregateFunction,
|
|
4
4
|
AggregateFunctionOperator,
|
|
@@ -7,11 +7,12 @@ import type {
|
|
|
7
7
|
Filter,
|
|
8
8
|
Order,
|
|
9
9
|
Query,
|
|
10
|
-
|
|
10
|
+
Result,
|
|
11
|
+
} from "../types.js";
|
|
11
12
|
|
|
12
|
-
import { filterFromContext } from "./filterFromContext";
|
|
13
|
-
import { filterItem } from "./filterItem";
|
|
14
|
-
import { sortItemList } from "./sortItemList";
|
|
13
|
+
import { filterFromContext } from "./filterFromContext.js";
|
|
14
|
+
import { filterItem } from "./filterItem.js";
|
|
15
|
+
import { sortItemList } from "./sortItemList.js";
|
|
15
16
|
|
|
16
17
|
function mergeContextAndFilter<T extends object>(
|
|
17
18
|
context?: Context<T>,
|
|
@@ -38,9 +39,19 @@ function normalizeAggregator<T extends object>(
|
|
|
38
39
|
return aggregator.operator;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
query:
|
|
43
|
-
) {
|
|
42
|
+
function queryItemList<T extends object, const Q extends Query<T, {}>>(
|
|
43
|
+
query: Q & { type: T[]; customFields?: never },
|
|
44
|
+
): Result<T, Q, {}>;
|
|
45
|
+
function queryItemList<
|
|
46
|
+
T extends object,
|
|
47
|
+
const Q extends Query<T, C>,
|
|
48
|
+
const C extends CustomFieldMap<T>,
|
|
49
|
+
>(query: Q & { type: T[]; customFields: C }): Result<T, Q, C>;
|
|
50
|
+
function queryItemList<
|
|
51
|
+
T extends object,
|
|
52
|
+
const Q extends Query<T, C>,
|
|
53
|
+
const C extends CustomFieldMap<T>,
|
|
54
|
+
>(query: Q & { type: T[]; customFields?: C }): Result<T, Q, C> {
|
|
44
55
|
const data = query.type as T[];
|
|
45
56
|
switch (query.method) {
|
|
46
57
|
case "read":
|
|
@@ -66,7 +77,7 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
|
|
|
66
77
|
if (offset !== 0 || limit !== Infinity) {
|
|
67
78
|
result = result.slice(offset, offset + limit);
|
|
68
79
|
}
|
|
69
|
-
return result
|
|
80
|
+
return result as Result<T, Q, C>;
|
|
70
81
|
}
|
|
71
82
|
const normalizedFilter = mergeContextAndFilter(
|
|
72
83
|
context,
|
|
@@ -76,14 +87,14 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
|
|
|
76
87
|
if (result === undefined) {
|
|
77
88
|
throw new RequestError("Not found", 404, query);
|
|
78
89
|
}
|
|
79
|
-
return result
|
|
90
|
+
return result as Result<T, Q, C>;
|
|
80
91
|
}
|
|
81
92
|
case "aggregate": {
|
|
82
93
|
const { context, filter, aggregator } = query;
|
|
83
94
|
switch (normalizeAggregator(aggregator)) {
|
|
84
95
|
case "length": {
|
|
85
96
|
if (filter === undefined && context === undefined) {
|
|
86
|
-
return data.length
|
|
97
|
+
return data.length as Result<T, Q, C>;
|
|
87
98
|
}
|
|
88
99
|
const normalizedFilter = mergeContextAndFilter(
|
|
89
100
|
context,
|
|
@@ -94,7 +105,7 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
|
|
|
94
105
|
return result + 1;
|
|
95
106
|
}
|
|
96
107
|
return result;
|
|
97
|
-
}, 0)
|
|
108
|
+
}, 0 as number) as Result<T, Q, C>;
|
|
98
109
|
}
|
|
99
110
|
default: {
|
|
100
111
|
throw new Error("Not implemented");
|
|
@@ -106,3 +117,5 @@ export function queryItemList<T extends object, C extends CustomFieldMap<T>>(
|
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
}
|
|
120
|
+
|
|
121
|
+
export { queryItemList };
|
|
@@ -2,7 +2,7 @@ import type { CustomFieldMap } from "./CustomFieldMap";
|
|
|
2
2
|
import type { Query } from "./Query";
|
|
3
3
|
import type { Result } from "./Result";
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface CustomFetch<T extends object> {
|
|
6
6
|
<Q extends Query<T, {}>>(
|
|
7
7
|
query: Q & { customFields?: never },
|
|
8
8
|
): Promise<Result<T, Q, {}>>;
|
package/lib/types.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { AggregateFunction } from "./types/AggregateFunction";
|
|
|
3
3
|
export type { AggregateFunctionOperator } from "./types/AggregateFunctionOperator";
|
|
4
4
|
export type { Any } from "./types/Any";
|
|
5
5
|
export type { Context } from "./types/Context";
|
|
6
|
+
export type { CustomFetch } from "./types/CustomFetch";
|
|
6
7
|
export type { CustomFieldAggregateMap } from "./types/CustomFieldAggregateMap";
|
|
7
8
|
export type { CustomFieldMap } from "./types/CustomFieldMap";
|
|
8
9
|
export type { CustomRequest } from "./types/CustomRequest";
|
|
@@ -21,7 +22,6 @@ export type { FilterSequence } from "./types/FilterSequence";
|
|
|
21
22
|
export type { FilterString } from "./types/FilterString";
|
|
22
23
|
export type { FilterStringIntersect } from "./types/FilterStringIntersect";
|
|
23
24
|
export type { FilterStringMatch } from "./types/FilterStringMatch";
|
|
24
|
-
export type { GenericFetch } from "./types/GenericFetch";
|
|
25
25
|
export type { Get } from "./types/Get";
|
|
26
26
|
export type { Group } from "./types/Group";
|
|
27
27
|
export type { Handler } from "./types/Handler";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFetch.js","sourceRoot":"","sources":["../../lib/types/GenericFetch.ts"],"names":[],"mappings":""}
|