quetch 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/errors/RequestError.d.ts +3 -3
  2. package/dist/errors.d.ts +1 -1
  3. package/dist/errors.js +1 -1
  4. package/dist/errors.js.map +1 -1
  5. package/dist/middlewares/aggregate.d.ts +3 -3
  6. package/dist/middlewares/aggregate.js +1 -1
  7. package/dist/middlewares/aggregate.js.map +1 -1
  8. package/dist/middlewares/cache.d.ts +4 -4
  9. package/dist/middlewares/cache.js +3 -3
  10. package/dist/middlewares/cache.js.map +1 -1
  11. package/dist/middlewares.d.ts +9 -9
  12. package/dist/middlewares.js +9 -9
  13. package/dist/middlewares.js.map +1 -1
  14. package/dist/tools/cork.d.ts +5 -0
  15. package/dist/tools/cork.js +5 -0
  16. package/dist/tools/cork.js.map +1 -0
  17. package/dist/tools/defineCheckQuery.d.ts +12 -7
  18. package/dist/tools/defineCheckQuery.js +5 -0
  19. package/dist/tools/defineCheckQuery.js.map +1 -1
  20. package/dist/tools/defineCustomFetch.d.ts +26 -18
  21. package/dist/tools/defineCustomFetch.js +9 -3
  22. package/dist/tools/defineCustomFetch.js.map +1 -1
  23. package/dist/tools/defineGenericFetch.d.ts +14 -0
  24. package/dist/tools/defineGenericFetch.js +12 -0
  25. package/dist/tools/defineGenericFetch.js.map +1 -0
  26. package/dist/tools/queryItemList.js +3 -3
  27. package/dist/tools/queryItemList.js.map +1 -1
  28. package/dist/tools/sortItemList.js +3 -3
  29. package/dist/tools/sortItemList.js.map +1 -1
  30. package/dist/tools.d.ts +9 -8
  31. package/dist/tools.js +9 -8
  32. package/dist/tools.js.map +1 -1
  33. package/dist/types/AggregateFunction.d.ts +9 -0
  34. package/dist/types/AggregateFunction.js +2 -0
  35. package/dist/types/AggregateFunction.js.map +1 -0
  36. package/dist/types/AggregateFunctionOperator.d.ts +2 -0
  37. package/dist/types/AggregateFunctionOperator.js +2 -0
  38. package/dist/types/AggregateFunctionOperator.js.map +1 -0
  39. package/dist/types/Any.d.ts +1 -0
  40. package/dist/types/Any.js +2 -0
  41. package/dist/types/Any.js.map +1 -0
  42. package/dist/types/Context.d.ts +3 -0
  43. package/dist/types/Context.js +2 -0
  44. package/dist/types/Context.js.map +1 -0
  45. package/dist/types/CustomFieldAggregateMap.d.ts +2 -0
  46. package/dist/types/CustomFieldAggregateMap.js +2 -0
  47. package/dist/types/CustomFieldAggregateMap.js.map +1 -0
  48. package/dist/types/CustomFieldMap.d.ts +2 -0
  49. package/dist/types/CustomFieldMap.js +2 -0
  50. package/dist/types/CustomFieldMap.js.map +1 -0
  51. package/dist/types/CustomRequest.d.ts +16 -0
  52. package/dist/types/CustomRequest.js +2 -0
  53. package/dist/types/CustomRequest.js.map +1 -0
  54. package/dist/types/FieldFunction.d.ts +3 -0
  55. package/dist/types/FieldFunction.js +2 -0
  56. package/dist/types/FieldFunction.js.map +1 -0
  57. package/dist/types/FieldFunctionCustom.d.ts +7 -0
  58. package/dist/types/FieldFunctionCustom.js +2 -0
  59. package/dist/types/FieldFunctionCustom.js.map +1 -0
  60. package/dist/types/FieldFunctionFormatDate.d.ts +9 -0
  61. package/dist/types/FieldFunctionFormatDate.js +2 -0
  62. package/dist/types/FieldFunctionFormatDate.js.map +1 -0
  63. package/dist/types/FieldFunctionReturn.d.ts +6 -0
  64. package/dist/types/FieldFunctionReturn.js +2 -0
  65. package/dist/types/FieldFunctionReturn.js.map +1 -0
  66. package/dist/types/Filter.d.ts +12 -0
  67. package/dist/types/Filter.js +2 -0
  68. package/dist/types/Filter.js.map +1 -0
  69. package/dist/types/FilterArray.d.ts +10 -0
  70. package/dist/types/FilterArray.js +2 -0
  71. package/dist/types/FilterArray.js.map +1 -0
  72. package/dist/types/FilterBoolean.d.ts +9 -0
  73. package/dist/types/FilterBoolean.js +2 -0
  74. package/dist/types/FilterBoolean.js.map +1 -0
  75. package/dist/types/FilterField.d.ts +7 -0
  76. package/dist/types/FilterField.js +2 -0
  77. package/dist/types/FilterField.js.map +1 -0
  78. package/dist/types/FilterKeys.d.ts +6 -0
  79. package/dist/types/FilterKeys.js +2 -0
  80. package/dist/types/FilterKeys.js.map +1 -0
  81. package/dist/types/FilterNumber.d.ts +9 -0
  82. package/dist/types/FilterNumber.js +2 -0
  83. package/dist/types/FilterNumber.js.map +1 -0
  84. package/dist/types/FilterOperator.d.ts +2 -0
  85. package/dist/types/FilterOperator.js +2 -0
  86. package/dist/types/FilterOperator.js.map +1 -0
  87. package/dist/types/FilterSequence.d.ts +23 -0
  88. package/dist/types/FilterSequence.js +2 -0
  89. package/dist/types/FilterSequence.js.map +1 -0
  90. package/dist/types/FilterString.d.ts +9 -0
  91. package/dist/types/FilterString.js +2 -0
  92. package/dist/types/FilterString.js.map +1 -0
  93. package/dist/types/FilterStringIntersect.d.ts +9 -0
  94. package/dist/types/FilterStringIntersect.js +2 -0
  95. package/dist/types/FilterStringIntersect.js.map +1 -0
  96. package/dist/types/FilterStringMatch.d.ts +29 -0
  97. package/dist/types/FilterStringMatch.js +2 -0
  98. package/dist/types/FilterStringMatch.js.map +1 -0
  99. package/dist/types/Get.d.ts +6 -0
  100. package/dist/types/Get.js +2 -0
  101. package/dist/types/Get.js.map +1 -0
  102. package/dist/types/Group.d.ts +8 -0
  103. package/dist/types/Group.js +2 -0
  104. package/dist/types/Group.js.map +1 -0
  105. package/dist/types/Handler.d.ts +5 -0
  106. package/dist/types/Handler.js +2 -0
  107. package/dist/types/Handler.js.map +1 -0
  108. package/dist/types/Immutable.d.ts +3 -0
  109. package/dist/types/Immutable.js +2 -0
  110. package/dist/types/Immutable.js.map +1 -0
  111. package/dist/types/InjectCustomFields.d.ts +9 -0
  112. package/dist/types/InjectCustomFields.js +2 -0
  113. package/dist/types/InjectCustomFields.js.map +1 -0
  114. package/dist/types/Item.d.ts +4 -0
  115. package/dist/types/Item.js +2 -0
  116. package/dist/types/Item.js.map +1 -0
  117. package/dist/types/Key.d.ts +1 -0
  118. package/dist/types/Key.js +2 -0
  119. package/dist/types/Key.js.map +1 -0
  120. package/dist/types/Mutable.d.ts +3 -0
  121. package/dist/types/Mutable.js +2 -0
  122. package/dist/types/Mutable.js.map +1 -0
  123. package/dist/types/NextHandler.d.ts +4 -0
  124. package/dist/types/NextHandler.js +2 -0
  125. package/dist/types/NextHandler.js.map +1 -0
  126. package/dist/types/Order.d.ts +7 -0
  127. package/dist/types/Order.js +2 -0
  128. package/dist/types/Order.js.map +1 -0
  129. package/dist/types/Query.d.ts +23 -0
  130. package/dist/types/Query.js +2 -0
  131. package/dist/types/Query.js.map +1 -0
  132. package/dist/types/QueryAggregate.d.ts +10 -0
  133. package/dist/types/QueryAggregate.js +2 -0
  134. package/dist/types/QueryAggregate.js.map +1 -0
  135. package/dist/types/QueryAny.d.ts +7 -0
  136. package/dist/types/QueryAny.js +2 -0
  137. package/dist/types/QueryAny.js.map +1 -0
  138. package/dist/types/QueryCreate.d.ts +7 -0
  139. package/dist/types/QueryCreate.js +2 -0
  140. package/dist/types/QueryCreate.js.map +1 -0
  141. package/dist/types/QueryCreateMultiple.d.ts +8 -0
  142. package/dist/types/QueryCreateMultiple.js +2 -0
  143. package/dist/types/QueryCreateMultiple.js.map +1 -0
  144. package/dist/types/QueryDelete.d.ts +10 -0
  145. package/dist/types/QueryDelete.js +2 -0
  146. package/dist/types/QueryDelete.js.map +1 -0
  147. package/dist/types/QueryDeleteMultiple.d.ts +11 -0
  148. package/dist/types/QueryDeleteMultiple.js +2 -0
  149. package/dist/types/QueryDeleteMultiple.js.map +1 -0
  150. package/dist/types/QueryMethod.d.ts +5 -0
  151. package/dist/types/QueryMethod.js +2 -0
  152. package/dist/types/QueryMethod.js.map +1 -0
  153. package/dist/types/QueryRead.d.ts +23 -0
  154. package/dist/types/QueryRead.js +2 -0
  155. package/dist/types/QueryRead.js.map +1 -0
  156. package/dist/types/QueryReadMultiple.d.ts +34 -0
  157. package/dist/types/QueryReadMultiple.js +2 -0
  158. package/dist/types/QueryReadMultiple.js.map +1 -0
  159. package/dist/types/QueryUpdate.d.ts +18 -0
  160. package/dist/types/QueryUpdate.js +2 -0
  161. package/dist/types/QueryUpdate.js.map +1 -0
  162. package/dist/types/QueryUpdateMultiple.d.ts +26 -0
  163. package/dist/types/QueryUpdateMultiple.js +2 -0
  164. package/dist/types/QueryUpdateMultiple.js.map +1 -0
  165. package/dist/types/Result.d.ts +25 -0
  166. package/dist/types/Result.js +2 -0
  167. package/dist/types/Result.js.map +1 -0
  168. package/dist/types/Store.d.ts +6 -0
  169. package/dist/types/Store.js +2 -0
  170. package/dist/types/Store.js.map +1 -0
  171. package/dist/types.d.ts +46 -396
  172. package/doc/README.md +533 -219
  173. package/lib/errors/RequestError.ts +2 -2
  174. package/lib/errors.ts +1 -1
  175. package/lib/middlewares/aggregate.ts +5 -5
  176. package/lib/middlewares/cache.ts +7 -12
  177. package/lib/middlewares.ts +9 -9
  178. package/lib/tools/cork.ts +6 -0
  179. package/lib/tools/defineCheckQuery.ts +20 -15
  180. package/lib/tools/defineCustomFetch.ts +40 -62
  181. package/lib/tools/defineGenericFetch.ts +33 -0
  182. package/lib/tools/queryItemList.test.ts +6 -6
  183. package/lib/tools/queryItemList.ts +3 -3
  184. package/lib/tools/sortItemList.ts +3 -3
  185. package/lib/tools.ts +9 -8
  186. package/lib/types/AggregateFunction.ts +17 -0
  187. package/lib/types/AggregateFunctionOperator.ts +6 -0
  188. package/lib/types/Any.ts +10 -0
  189. package/lib/types/Context.ts +3 -0
  190. package/lib/types/CustomFieldAggregateMap.ts +6 -0
  191. package/lib/types/CustomFieldMap.ts +3 -0
  192. package/lib/types/CustomRequest.ts +21 -0
  193. package/lib/types/FieldFunction.ts +6 -0
  194. package/lib/types/FieldFunctionCustom.ts +7 -0
  195. package/lib/types/FieldFunctionFormatDate.ts +10 -0
  196. package/lib/types/FieldFunctionReturn.ts +6 -0
  197. package/lib/types/Filter.ts +20 -0
  198. package/lib/types/FilterArray.ts +11 -0
  199. package/lib/types/FilterBoolean.ts +10 -0
  200. package/lib/types/FilterField.ts +7 -0
  201. package/lib/types/FilterKeys.ts +6 -0
  202. package/lib/types/FilterNumber.ts +16 -0
  203. package/lib/types/FilterOperator.ts +3 -0
  204. package/lib/types/FilterSequence.ts +26 -0
  205. package/lib/types/FilterString.ts +19 -0
  206. package/lib/types/FilterStringIntersect.ts +10 -0
  207. package/lib/types/FilterStringMatch.ts +30 -0
  208. package/lib/types/Get.ts +8 -0
  209. package/lib/types/Group.ts +11 -0
  210. package/lib/types/Handler.ts +9 -0
  211. package/lib/types/Immutable.ts +3 -0
  212. package/lib/types/InjectCustomFields.ts +23 -0
  213. package/lib/types/Item.ts +8 -0
  214. package/lib/types/Key.ts +1 -0
  215. package/lib/types/Mutable.ts +3 -0
  216. package/lib/types/NextHandler.ts +4 -0
  217. package/lib/types/Order.ts +9 -0
  218. package/lib/types/Query.ts +36 -0
  219. package/lib/types/QueryAggregate.ts +11 -0
  220. package/lib/types/QueryAny.ts +8 -0
  221. package/lib/types/QueryCreate.ts +7 -0
  222. package/lib/types/QueryCreateMultiple.ts +8 -0
  223. package/lib/types/QueryDelete.ts +11 -0
  224. package/lib/types/QueryDeleteMultiple.ts +12 -0
  225. package/lib/types/QueryMethod.ts +6 -0
  226. package/lib/types/QueryRead.ts +24 -0
  227. package/lib/types/QueryReadMultiple.ts +36 -0
  228. package/lib/types/QueryUpdate.ts +19 -0
  229. package/lib/types/QueryUpdateMultiple.ts +27 -0
  230. package/lib/types/Result.ts +38 -0
  231. package/lib/types/Store.ts +7 -0
  232. package/lib/types.ts +47 -562
  233. package/package.json +3 -3
  234. package/dist/errors/QueryError.d.ts +0 -5
  235. package/dist/errors/QueryError.js +0 -23
  236. package/dist/errors/QueryError.js.map +0 -1
  237. package/dist/middlewares/concurrent.d.ts +0 -2
  238. package/dist/middlewares/concurrent.js +0 -20
  239. package/dist/middlewares/concurrent.js.map +0 -1
  240. package/dist/middlewares/fetch.d.ts +0 -2
  241. package/dist/middlewares/fetch.js +0 -20
  242. package/dist/middlewares/fetch.js.map +0 -1
  243. package/dist/middlewares/logQuery.d.ts +0 -2
  244. package/dist/middlewares/logQuery.js +0 -25
  245. package/dist/middlewares/logQuery.js.map +0 -1
  246. package/dist/tools/add.d.ts +0 -8
  247. package/dist/tools/add.js +0 -11
  248. package/dist/tools/add.js.map +0 -1
  249. package/dist/tools/add.test.d.ts +0 -1
  250. package/dist/tools/add.test.js +0 -6
  251. package/dist/tools/add.test.js.map +0 -1
  252. package/dist/tools/filterItem.test.d.ts +0 -1
  253. package/dist/tools/filterItem.test.js +0 -86
  254. package/dist/tools/filterItem.test.js.map +0 -1
  255. package/dist/tools/impasse.d.ts +0 -2
  256. package/dist/tools/impasse.js +0 -2
  257. package/dist/tools/impasse.js.map +0 -1
  258. package/dist/tools/queryItemList.test.d.ts +0 -1
  259. package/dist/tools/queryItemList.test.js +0 -181
  260. package/dist/tools/queryItemList.test.js.map +0 -1
  261. package/dist/tools/sortItemList.test.d.ts +0 -1
  262. package/dist/tools/sortItemList.test.js +0 -47
  263. package/dist/tools/sortItemList.test.js.map +0 -1
  264. package/lib/tools/impasse.ts +0 -3
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FieldFunctionFormatDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldFunctionFormatDate.js","sourceRoot":"","sources":["../../lib/types/FieldFunctionFormatDate.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Return types of custom field functions.
3
+ */
4
+ export type FieldFunctionReturn = {
5
+ formatDate: string;
6
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FieldFunctionReturn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldFunctionReturn.js","sourceRoot":"","sources":["../../lib/types/FieldFunctionReturn.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { FilterArray } from "./FilterArray";
2
+ import type { FilterBoolean } from "./FilterBoolean";
3
+ import type { FilterField } from "./FilterField";
4
+ import type { FilterNumber } from "./FilterNumber";
5
+ import type { FilterSequence } from "./FilterSequence";
6
+ import type { FilterString } from "./FilterString";
7
+ import type { FilterStringIntersect } from "./FilterStringIntersect";
8
+ import type { FilterStringMatch } from "./FilterStringMatch";
9
+ /**
10
+ * Describes a predicate for filtering items.
11
+ */
12
+ export type Filter<T extends object> = FilterSequence<T> | FilterField<T> | FilterBoolean<T> | FilterString<T> | FilterStringMatch<T> | FilterStringIntersect<T> | FilterNumber<T> | FilterArray<T>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../lib/types/Filter.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { Any } from "./Any";
2
+ import type { FilterKeys } from "./FilterKeys";
3
+ /**
4
+ * Checks if a given array field matches a given array value according to a given operator.
5
+ */
6
+ export type FilterArray<T extends object, P = Any> = {
7
+ operator: "equal" | "include" | "intersect";
8
+ field: FilterKeys<T, P[]>;
9
+ value: P[];
10
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterArray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterArray.js","sourceRoot":"","sources":["../../lib/types/FilterArray.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { FilterKeys } from "./FilterKeys";
2
+ /**
3
+ * Checks if a given boolean field is `true` or `false`.
4
+ */
5
+ export type FilterBoolean<T extends object> = {
6
+ operator: "equal" | "notEqual";
7
+ field: FilterKeys<T, boolean>;
8
+ value: boolean;
9
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterBoolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterBoolean.js","sourceRoot":"","sources":["../../lib/types/FilterBoolean.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Checks if a given field exists.
3
+ */
4
+ export type FilterField<T extends object> = {
5
+ operator: "exist";
6
+ field: keyof T;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterField.js","sourceRoot":"","sources":["../../lib/types/FilterField.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns object type with field extending the provided `P` type.
3
+ */
4
+ export type FilterKeys<T extends object, P> = {
5
+ [K in keyof T]-?: T[K] extends P ? K : never;
6
+ }[keyof T];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterKeys.js","sourceRoot":"","sources":["../../lib/types/FilterKeys.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { FilterKeys } from "./FilterKeys";
2
+ /**
3
+ * Checks if a given number field matches a given number value according to a given operator.
4
+ */
5
+ export type FilterNumber<T extends object> = {
6
+ operator: "equal" | "notEqual" | "greaterThan" | "greaterThanOrEqual" | "lowerThan" | "lowerThanOrEqual";
7
+ field: FilterKeys<T, number>;
8
+ value: number;
9
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterNumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterNumber.js","sourceRoot":"","sources":["../../lib/types/FilterNumber.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import type { Filter } from "./Filter";
2
+ export type FilterOperator = Filter<never>["operator"];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterOperator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterOperator.js","sourceRoot":"","sources":["../../lib/types/FilterOperator.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { Filter } from "./Filter";
2
+ /**
3
+ * Joins a list of filters with a specific boolean operator.
4
+ */
5
+ export type FilterSequence<T extends object> = {
6
+ /**
7
+ * Boolean operator to use for joining the filters.
8
+ */
9
+ operator: "all";
10
+ /**
11
+ * Filters to join.
12
+ */
13
+ value: Filter<T>[];
14
+ } | {
15
+ /**
16
+ * Boolean operator to use for joining the filters.
17
+ */
18
+ operator: "any" | "none";
19
+ /**
20
+ * Filters to join.
21
+ */
22
+ value?: Filter<T>[];
23
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterSequence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterSequence.js","sourceRoot":"","sources":["../../lib/types/FilterSequence.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { FilterKeys } from "./FilterKeys";
2
+ /**
3
+ * Checks if a given string field matches a given string value according to a given operator.
4
+ */
5
+ export type FilterString<T extends object> = {
6
+ operator: "equal" | "notEqual" | "startWith" | "endWith" | "include" | "greaterThan" | "greaterThanOrEqual" | "lowerThan" | "lowerThanOrEqual";
7
+ field: FilterKeys<T, string>;
8
+ value: string;
9
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterString.js","sourceRoot":"","sources":["../../lib/types/FilterString.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { FilterKeys } from "./FilterKeys";
2
+ /**
3
+ * Checks if a given string field has any of the provided values.
4
+ */
5
+ export type FilterStringIntersect<T extends object> = {
6
+ operator: "intersect";
7
+ field: FilterKeys<T, string>;
8
+ value: string[];
9
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterStringIntersect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterStringIntersect.js","sourceRoot":"","sources":["../../lib/types/FilterStringIntersect.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import type { FilterKeys } from "./FilterKeys";
2
+ /**
3
+ * Checks if a given string field matches a given regular expression.
4
+ */
5
+ export type FilterStringMatch<T extends object> = {
6
+ operator: "match";
7
+ field: FilterKeys<T, string>;
8
+ /**
9
+ * Raw regular expression string.
10
+ */
11
+ value: string;
12
+ /**
13
+ * Regular expression options.
14
+ */
15
+ options?: {
16
+ /**
17
+ * When matching, casing differences are ignored.
18
+ */
19
+ ignoreCase?: boolean;
20
+ /**
21
+ * Allows . to match newlines.
22
+ */
23
+ dotAll?: boolean;
24
+ };
25
+ /**
26
+ * Compiled regular expression generated by the `testFilter` function.
27
+ */
28
+ regularExpression?: RegExp;
29
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FilterStringMatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterStringMatch.js","sourceRoot":"","sources":["../../lib/types/FilterStringMatch.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns the type of the property at the specified `K` key.
3
+ */
4
+ export type Get<T extends object, K extends string, D> = T extends {
5
+ [key in K]: any;
6
+ } ? T[K] : D;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Get.js","sourceRoot":"","sources":["../../lib/types/Get.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { CustomFieldAggregateMap } from "./CustomFieldAggregateMap";
2
+ /**
3
+ * Specifies how items should be grouped.
4
+ */
5
+ export type Group<T extends object> = keyof T | {
6
+ field: keyof T;
7
+ customFields?: CustomFieldAggregateMap<T>;
8
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Group.js","sourceRoot":"","sources":["../../lib/types/Group.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { NextHandler } from "./NextHandler";
2
+ /**
3
+ * Handles an `input` query and returns an `output` promise, eventually using the `next` handler.
4
+ */
5
+ export type Handler<I, O, NI, No> = (input: I, next: NextHandler<NI, No>) => Promise<O>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Handler.js","sourceRoot":"","sources":["../../lib/types/Handler.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type Immutable<T extends object> = {
2
+ readonly [K in keyof T]: T[K];
3
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Immutable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Immutable.js","sourceRoot":"","sources":["../../lib/types/Immutable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { CustomFieldMap } from "./CustomFieldMap";
2
+ import type { FieldFunctionCustom } from "./FieldFunctionCustom";
3
+ import type { FieldFunctionReturn } from "./FieldFunctionReturn";
4
+ /**
5
+ * Injects the custom fields into the entity type.
6
+ */
7
+ export type InjectCustomFields<T extends object, C extends CustomFieldMap<T> | undefined> = C extends CustomFieldMap<T> ? {
8
+ readonly [K in keyof T | keyof C]: K extends keyof T ? T[K] : K extends keyof C ? C[K] extends FieldFunctionCustom<T> ? ReturnType<C[K]["value"]> : C[K]["operator"] extends keyof FieldFunctionReturn ? FieldFunctionReturn[C[K]["operator"]] : never : never;
9
+ } : T;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InjectCustomFields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectCustomFields.js","sourceRoot":"","sources":["../../lib/types/InjectCustomFields.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns the inferred item type of an array, or an alternative type if it is something else (e.g., `undefined`).
3
+ */
4
+ export type Item<T, S = undefined> = T extends Array<infer I> ? I : T extends ReadonlyArray<infer I> ? I : S;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Item.js","sourceRoot":"","sources":["../../lib/types/Item.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export type Key = string | number | symbol;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Key.js","sourceRoot":"","sources":["../../lib/types/Key.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type Mutable<T extends object> = {
2
+ -readonly [K in keyof T]: T[K];
3
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Mutable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mutable.js","sourceRoot":"","sources":["../../lib/types/Mutable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Handles an `input` query and returns an `output` promise.
3
+ */
4
+ export type NextHandler<I, R> = (input: I) => Promise<R>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=NextHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextHandler.js","sourceRoot":"","sources":["../../lib/types/NextHandler.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Order item.
3
+ */
4
+ export type Order<T extends object> = keyof T | {
5
+ field: keyof T;
6
+ descending?: boolean;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Order.js","sourceRoot":"","sources":["../../lib/types/Order.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { Context } from "./Context";
2
+ import type { CustomFieldMap } from "./CustomFieldMap";
3
+ import type { InjectCustomFields } from "./InjectCustomFields";
4
+ import type { QueryAggregate } from "./QueryAggregate";
5
+ import type { QueryCreate } from "./QueryCreate";
6
+ import type { QueryCreateMultiple } from "./QueryCreateMultiple";
7
+ import type { QueryDelete } from "./QueryDelete";
8
+ import type { QueryDeleteMultiple } from "./QueryDeleteMultiple";
9
+ import type { QueryRead } from "./QueryRead";
10
+ import type { QueryReadMultiple } from "./QueryReadMultiple";
11
+ import type { QueryUpdate } from "./QueryUpdate";
12
+ import type { QueryUpdateMultiple } from "./QueryUpdateMultiple";
13
+ type QueryBase<T extends object> = QueryRead<T> | QueryReadMultiple<T> | QueryCreate<T> | QueryCreateMultiple<T> | QueryUpdate<T> | QueryUpdateMultiple<T> | QueryDelete<T> | QueryDeleteMultiple<T> | QueryAggregate<T>;
14
+ /**
15
+ * Query that fetches or mutates an entity.
16
+ */
17
+ export type Query<T extends object, C extends CustomFieldMap<T> | undefined> = QueryBase<InjectCustomFields<T, C>> & {
18
+ /**
19
+ * Common item properties to use for identifying the item.
20
+ */
21
+ context?: Context<T>;
22
+ };
23
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Query.js","sourceRoot":"","sources":["../../lib/types/Query.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { AggregateFunction } from "./AggregateFunction";
2
+ import type { Filter } from "./Filter";
3
+ /**
4
+ * Query for computing an aggregated value.
5
+ */
6
+ export type QueryAggregate<T extends object> = {
7
+ method: "aggregate";
8
+ aggregator: AggregateFunction<T>;
9
+ filter?: Filter<T>;
10
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryAggregate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryAggregate.js","sourceRoot":"","sources":["../../lib/types/QueryAggregate.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { CustomFieldMap } from "./CustomFieldMap";
2
+ import type { Key } from "./Key";
3
+ import type { Query } from "./Query";
4
+ export type QueryAny = Query<any, any> & {
5
+ type: Key | any[];
6
+ customFields?: CustomFieldMap<any>;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryAny.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryAny.js","sourceRoot":"","sources":["../../lib/types/QueryAny.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Query for creating an item.
3
+ */
4
+ export type QueryCreate<T extends object> = {
5
+ method: "create";
6
+ value: Partial<T>;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryCreate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryCreate.js","sourceRoot":"","sources":["../../lib/types/QueryCreate.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Query for creating multiple items.
3
+ */
4
+ export type QueryCreateMultiple<T extends object> = {
5
+ method: "create";
6
+ multiple: true;
7
+ value: Partial<T>[];
8
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryCreateMultiple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryCreateMultiple.js","sourceRoot":"","sources":["../../lib/types/QueryCreateMultiple.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { CustomFieldMap } from "./CustomFieldMap";
2
+ import type { Filter } from "./Filter";
3
+ /**
4
+ * Query for deleting an item.
5
+ */
6
+ export type QueryDelete<T extends object> = {
7
+ method: "delete";
8
+ filter?: Filter<T>;
9
+ customFields?: CustomFieldMap<T>;
10
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryDelete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryDelete.js","sourceRoot":"","sources":["../../lib/types/QueryDelete.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { CustomFieldMap } from "./CustomFieldMap";
2
+ import type { Filter } from "./Filter";
3
+ /**
4
+ * Query for deleting multiple items.
5
+ */
6
+ export type QueryDeleteMultiple<T extends object> = {
7
+ method: "delete";
8
+ multiple: true;
9
+ filter?: Filter<T>;
10
+ customFields?: CustomFieldMap<T>;
11
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryDeleteMultiple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryDeleteMultiple.js","sourceRoot":"","sources":["../../lib/types/QueryDeleteMultiple.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { Query } from "./Query";
2
+ /**
3
+ * Available query methods.
4
+ */
5
+ export type QueryMethod = Exclude<Query<never, never>["method"], undefined>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryMethod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryMethod.js","sourceRoot":"","sources":["../../lib/types/QueryMethod.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { Filter } from "./Filter";
2
+ import type { Order } from "./Order";
3
+ /**
4
+ * Query for reading a single item.
5
+ */
6
+ export type QueryRead<T extends object> = {
7
+ method?: "read";
8
+ multiple?: false;
9
+ offset?: never;
10
+ group?: never;
11
+ /**
12
+ * Item fields to pick. If omitted, all fields are picked.
13
+ */
14
+ fields?: readonly (keyof T)[];
15
+ /**
16
+ * Filter for finding the item, if it cannot be found based on the `context`.
17
+ */
18
+ filter?: Filter<T>;
19
+ /**
20
+ * Order by which the items should be sorted.
21
+ */
22
+ order?: Order<T>[];
23
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QueryRead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryRead.js","sourceRoot":"","sources":["../../lib/types/QueryRead.ts"],"names":[],"mappings":""}