@ahoo-wang/wow-client 10.0.0-alpha.7 → 10.0.0-beta.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.
Files changed (233) hide show
  1. package/README.md +8 -5
  2. package/README.zh-CN.md +4 -3
  3. package/dist/commands.cjs +1 -1
  4. package/dist/commands.cjs.map +1 -1
  5. package/dist/commands.d.cts +9 -13
  6. package/dist/commands.d.ts +9 -13
  7. package/dist/commands.es.js +60 -54
  8. package/dist/commands.es.js.map +1 -1
  9. package/dist/dsl/aggregation/admit.cjs +1 -1
  10. package/dist/dsl/aggregation/admit.cjs.map +1 -1
  11. package/dist/dsl/aggregation/admit.es.js +73 -69
  12. package/dist/dsl/aggregation/admit.es.js.map +1 -1
  13. package/dist/dsl/aggregation/aliases.cjs +2 -0
  14. package/dist/dsl/aggregation/aliases.cjs.map +1 -0
  15. package/dist/dsl/aggregation/aliases.d.cts +2 -0
  16. package/dist/dsl/aggregation/aliases.d.ts +2 -0
  17. package/dist/dsl/aggregation/aliases.es.js +13 -0
  18. package/dist/dsl/aggregation/aliases.es.js.map +1 -0
  19. package/dist/dsl/aggregation/builders.cjs +1 -1
  20. package/dist/dsl/aggregation/builders.cjs.map +1 -1
  21. package/dist/dsl/aggregation/builders.d.cts +17 -243
  22. package/dist/dsl/aggregation/builders.d.ts +17 -243
  23. package/dist/dsl/aggregation/builders.es.js +36 -171
  24. package/dist/dsl/aggregation/builders.es.js.map +1 -1
  25. package/dist/dsl/aggregation/derived.cjs +1 -1
  26. package/dist/dsl/aggregation/derived.cjs.map +1 -1
  27. package/dist/dsl/aggregation/derived.d.cts +123 -1
  28. package/dist/dsl/aggregation/derived.d.ts +123 -1
  29. package/dist/dsl/aggregation/derived.es.js +43 -28
  30. package/dist/dsl/aggregation/derived.es.js.map +1 -1
  31. package/dist/dsl/aggregation/groups.cjs +2 -0
  32. package/dist/dsl/aggregation/groups.cjs.map +1 -0
  33. package/dist/dsl/aggregation/groups.d.cts +325 -0
  34. package/dist/dsl/aggregation/groups.d.ts +325 -0
  35. package/dist/dsl/aggregation/groups.es.js +80 -0
  36. package/dist/dsl/aggregation/groups.es.js.map +1 -0
  37. package/dist/dsl/aggregation/having.cjs +1 -1
  38. package/dist/dsl/aggregation/having.cjs.map +1 -1
  39. package/dist/dsl/aggregation/having.d.cts +63 -1
  40. package/dist/dsl/aggregation/having.d.ts +63 -1
  41. package/dist/dsl/aggregation/having.es.js +33 -30
  42. package/dist/dsl/aggregation/having.es.js.map +1 -1
  43. package/dist/dsl/aggregation/index.d.cts +4 -2
  44. package/dist/dsl/aggregation/index.d.ts +4 -2
  45. package/dist/dsl/aggregation/metrics.cjs +2 -0
  46. package/dist/dsl/aggregation/metrics.cjs.map +1 -0
  47. package/dist/dsl/aggregation/metrics.d.cts +279 -0
  48. package/dist/dsl/aggregation/metrics.d.ts +279 -0
  49. package/dist/dsl/aggregation/metrics.es.js +75 -0
  50. package/dist/dsl/aggregation/metrics.es.js.map +1 -0
  51. package/dist/dsl/aggregation/types.cjs +1 -1
  52. package/dist/dsl/aggregation/types.cjs.map +1 -1
  53. package/dist/dsl/aggregation/types.d.cts +4 -524
  54. package/dist/dsl/aggregation/types.d.ts +4 -524
  55. package/dist/dsl/aggregation/types.es.js +5 -25
  56. package/dist/dsl/aggregation/types.es.js.map +1 -1
  57. package/dist/dsl/cursorQuery.cjs +1 -1
  58. package/dist/dsl/cursorQuery.cjs.map +1 -1
  59. package/dist/dsl/cursorQuery.d.cts +18 -7
  60. package/dist/dsl/cursorQuery.d.ts +18 -7
  61. package/dist/dsl/cursorQuery.es.js +13 -12
  62. package/dist/dsl/cursorQuery.es.js.map +1 -1
  63. package/dist/dsl/descriptor.cjs +1 -1
  64. package/dist/dsl/descriptor.cjs.map +1 -1
  65. package/dist/dsl/descriptor.d.cts +24 -379
  66. package/dist/dsl/descriptor.d.ts +24 -379
  67. package/dist/dsl/descriptor.es.js +6 -32
  68. package/dist/dsl/descriptor.es.js.map +1 -1
  69. package/dist/dsl/fieldDescriptor.cjs +2 -0
  70. package/dist/dsl/fieldDescriptor.cjs.map +1 -0
  71. package/dist/dsl/fieldDescriptor.d.cts +246 -0
  72. package/dist/dsl/fieldDescriptor.d.ts +246 -0
  73. package/dist/dsl/fieldDescriptor.es.js +24 -0
  74. package/dist/dsl/fieldDescriptor.es.js.map +1 -0
  75. package/dist/dsl/filter/builders.cjs +1 -1
  76. package/dist/dsl/filter/builders.cjs.map +1 -1
  77. package/dist/dsl/filter/builders.d.cts +7 -949
  78. package/dist/dsl/filter/builders.d.ts +7 -949
  79. package/dist/dsl/filter/builders.es.js +14 -285
  80. package/dist/dsl/filter/builders.es.js.map +1 -1
  81. package/dist/dsl/filter/expressionFilter.cjs +2 -0
  82. package/dist/dsl/filter/expressionFilter.cjs.map +1 -0
  83. package/dist/dsl/filter/expressionFilter.d.cts +35 -0
  84. package/dist/dsl/filter/expressionFilter.d.ts +35 -0
  85. package/dist/dsl/filter/expressionFilter.es.js +18 -0
  86. package/dist/dsl/filter/expressionFilter.es.js.map +1 -0
  87. package/dist/dsl/filter/fieldFilters.cjs +2 -0
  88. package/dist/dsl/filter/fieldFilters.cjs.map +1 -0
  89. package/dist/dsl/filter/fieldFilters.d.cts +297 -0
  90. package/dist/dsl/filter/fieldFilters.d.ts +297 -0
  91. package/dist/dsl/filter/fieldFilters.es.js +110 -0
  92. package/dist/dsl/filter/fieldFilters.es.js.map +1 -0
  93. package/dist/dsl/filter/index.d.cts +2 -1
  94. package/dist/dsl/filter/index.d.ts +2 -1
  95. package/dist/dsl/filter/logicalFilters.cjs +2 -0
  96. package/dist/dsl/filter/logicalFilters.cjs.map +1 -0
  97. package/dist/dsl/filter/logicalFilters.d.cts +109 -0
  98. package/dist/dsl/filter/logicalFilters.d.ts +109 -0
  99. package/dist/dsl/filter/logicalFilters.es.js +36 -0
  100. package/dist/dsl/filter/logicalFilters.es.js.map +1 -0
  101. package/dist/dsl/filter/metadataFilters.cjs +2 -0
  102. package/dist/dsl/filter/metadataFilters.cjs.map +1 -0
  103. package/dist/dsl/filter/metadataFilters.d.cts +132 -0
  104. package/dist/dsl/filter/metadataFilters.d.ts +132 -0
  105. package/dist/dsl/filter/metadataFilters.es.js +56 -0
  106. package/dist/dsl/filter/metadataFilters.es.js.map +1 -0
  107. package/dist/dsl/filter/operator.cjs +1 -1
  108. package/dist/dsl/filter/operator.cjs.map +1 -1
  109. package/dist/dsl/filter/operator.d.cts +11 -9
  110. package/dist/dsl/filter/operator.d.ts +11 -9
  111. package/dist/dsl/filter/operator.es.js +1 -1
  112. package/dist/dsl/filter/operator.es.js.map +1 -1
  113. package/dist/dsl/filter/searchFilter.cjs +2 -0
  114. package/dist/dsl/filter/searchFilter.cjs.map +1 -0
  115. package/dist/dsl/filter/searchFilter.d.cts +39 -0
  116. package/dist/dsl/filter/searchFilter.d.ts +39 -0
  117. package/dist/dsl/filter/searchFilter.es.js +19 -0
  118. package/dist/dsl/filter/searchFilter.es.js.map +1 -0
  119. package/dist/dsl/filter/timeFilters.cjs +2 -0
  120. package/dist/dsl/filter/timeFilters.cjs.map +1 -0
  121. package/dist/dsl/filter/timeFilters.d.cts +290 -0
  122. package/dist/dsl/filter/timeFilters.d.ts +290 -0
  123. package/dist/dsl/filter/timeFilters.es.js +89 -0
  124. package/dist/dsl/filter/timeFilters.es.js.map +1 -0
  125. package/dist/dsl/filter/types.d.cts +4 -14
  126. package/dist/dsl/filter/types.d.ts +4 -14
  127. package/dist/dsl/filter/validate.cjs +1 -1
  128. package/dist/dsl/filter/validate.cjs.map +1 -1
  129. package/dist/dsl/filter/validate.d.cts +2 -4
  130. package/dist/dsl/filter/validate.d.ts +2 -4
  131. package/dist/dsl/filter/validate.es.js +25 -31
  132. package/dist/dsl/filter/validate.es.js.map +1 -1
  133. package/dist/dsl/queryErrorCodes.cjs +1 -1
  134. package/dist/dsl/queryErrorCodes.cjs.map +1 -1
  135. package/dist/dsl/queryErrorCodes.d.cts +0 -2
  136. package/dist/dsl/queryErrorCodes.d.ts +0 -2
  137. package/dist/dsl/queryErrorCodes.es.js +0 -1
  138. package/dist/dsl/queryErrorCodes.es.js.map +1 -1
  139. package/dist/dsl/queryFilter.cjs +2 -0
  140. package/dist/dsl/queryFilter.cjs.map +1 -0
  141. package/dist/dsl/queryFilter.d.cts +3 -0
  142. package/dist/dsl/queryFilter.d.ts +3 -0
  143. package/dist/dsl/queryFilter.es.js +9 -0
  144. package/dist/dsl/queryFilter.es.js.map +1 -0
  145. package/dist/dsl/queryable.cjs +1 -1
  146. package/dist/dsl/queryable.cjs.map +1 -1
  147. package/dist/dsl/queryable.es.js +12 -16
  148. package/dist/dsl/queryable.es.js.map +1 -1
  149. package/dist/dsl/semanticTypes.cjs +2 -0
  150. package/dist/dsl/semanticTypes.cjs.map +1 -0
  151. package/dist/dsl/semanticTypes.d.cts +128 -0
  152. package/dist/dsl/semanticTypes.d.ts +128 -0
  153. package/dist/dsl/semanticTypes.es.js +13 -0
  154. package/dist/dsl/semanticTypes.es.js.map +1 -0
  155. package/dist/dsl.cjs +1 -1
  156. package/dist/dsl.d.cts +2 -0
  157. package/dist/dsl.d.ts +2 -0
  158. package/dist/dsl.es.js +14 -8
  159. package/dist/exactJson.cjs +2 -2
  160. package/dist/exactJson.cjs.map +1 -1
  161. package/dist/exactJson.d.cts +41 -16
  162. package/dist/exactJson.d.ts +41 -16
  163. package/dist/exactJson.es.js +104 -102
  164. package/dist/exactJson.es.js.map +1 -1
  165. package/dist/frameworkErrors.cjs.map +1 -1
  166. package/dist/frameworkErrors.d.cts +5 -5
  167. package/dist/frameworkErrors.d.ts +5 -5
  168. package/dist/frameworkErrors.es.js.map +1 -1
  169. package/dist/http.cjs +1 -1
  170. package/dist/http.cjs.map +1 -1
  171. package/dist/http.d.cts +29 -9
  172. package/dist/http.d.ts +29 -9
  173. package/dist/http.es.js +24 -19
  174. package/dist/http.es.js.map +1 -1
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.d.cts +3 -3
  177. package/dist/index.d.ts +3 -3
  178. package/dist/index.es.js +12 -12
  179. package/dist/manifest.cjs +1 -1
  180. package/dist/manifest.cjs.map +1 -1
  181. package/dist/manifest.d.cts +30 -2
  182. package/dist/manifest.d.ts +30 -2
  183. package/dist/manifest.es.js +34 -6
  184. package/dist/manifest.es.js.map +1 -1
  185. package/dist/manifestTypes.d.cts +21 -4
  186. package/dist/manifestTypes.d.ts +21 -4
  187. package/dist/queries.cjs +1 -1
  188. package/dist/queries.cjs.map +1 -1
  189. package/dist/queries.d.cts +18 -8
  190. package/dist/queries.d.ts +18 -8
  191. package/dist/queries.es.js +46 -35
  192. package/dist/queries.es.js.map +1 -1
  193. package/dist/routes.cjs +1 -1
  194. package/dist/routes.cjs.map +1 -1
  195. package/dist/routes.d.cts +16 -3
  196. package/dist/routes.d.ts +16 -3
  197. package/dist/routes.es.js +24 -25
  198. package/dist/routes.es.js.map +1 -1
  199. package/dist/state.cjs +1 -1
  200. package/dist/state.cjs.map +1 -1
  201. package/dist/state.d.cts +21 -19
  202. package/dist/state.d.ts +21 -19
  203. package/dist/state.es.js +27 -22
  204. package/dist/state.es.js.map +1 -1
  205. package/dist/streams.cjs +1 -1
  206. package/dist/streams.cjs.map +1 -1
  207. package/dist/streams.d.cts +14 -7
  208. package/dist/streams.d.ts +14 -7
  209. package/dist/streams.es.js +65 -50
  210. package/dist/streams.es.js.map +1 -1
  211. package/dist/testing/wire.cjs +1 -1
  212. package/dist/testing/wire.cjs.map +1 -1
  213. package/dist/testing/wire.es.js +1 -1
  214. package/dist/testing/wire.es.js.map +1 -1
  215. package/dist/wait.cjs +1 -1
  216. package/dist/wait.cjs.map +1 -1
  217. package/dist/wait.d.cts +18 -5
  218. package/dist/wait.d.ts +18 -5
  219. package/dist/wait.es.js +36 -34
  220. package/dist/wait.es.js.map +1 -1
  221. package/dist/wire.cjs +1 -1
  222. package/dist/wire.cjs.map +1 -1
  223. package/dist/wire.d.cts +76 -31
  224. package/dist/wire.d.ts +76 -31
  225. package/dist/wire.es.js +1 -3
  226. package/dist/wire.es.js.map +1 -1
  227. package/package.json +5 -5
  228. package/dist/dsl/filter/datePattern.cjs +0 -2
  229. package/dist/dsl/filter/datePattern.cjs.map +0 -1
  230. package/dist/dsl/filter/datePattern.d.cts +0 -8
  231. package/dist/dsl/filter/datePattern.d.ts +0 -8
  232. package/dist/dsl/filter/datePattern.es.js +0 -96
  233. package/dist/dsl/filter/datePattern.es.js.map +0 -1
@@ -1,70 +1,8 @@
1
1
  import { ElementFilterExpression, FilterExpression, QueryField, ExpressionFilter } from '../filter/index.js';
2
- import { FieldSort, SortDirection } from '../sort.js';
3
- /** The kind of an {@link AggregationGroup}, sent as its `type`. */
4
- export declare enum AggregationGroupType {
5
- /** One group per distinct value; {@link aggregation.terms}. */
6
- TERMS = "terms",
7
- /** Number buckets of equal width; {@link aggregation.histogram}. */
8
- HISTOGRAM = "histogram",
9
- /** Calendar buckets of a time field; {@link aggregation.dateHistogram}. */
10
- DATE_HISTOGRAM = "date-histogram",
11
- /**
12
- * One calendar part of a time field, such as the weekday or the hour;
13
- * {@link aggregation.datePart}. Wow 9.2 and later.
14
- */
15
- DATE_PART = "date-part"
16
- }
17
- /**
18
- * What an {@link AggregationGroup}'s field is relative to when the query
19
- * expands elements, sent as its `scope`. Wow 9.9 and later.
20
- */
21
- export declare enum AggregationGroupScope {
22
- /** The innermost expanded element; the default. */
23
- ELEMENT = "element",
24
- /** The root record, so the elements are grouped by a field of their root. */
25
- ROOT = "root"
26
- }
27
- /**
28
- * The kind of an {@link AggregationMetric}, sent as its `type`. Wow 8.12
29
- * knows `COUNT` and `NUMERIC`, Wow 9.0 adds `ANY`, and the other three need
30
- * Wow 9.1.
31
- */
32
- export declare enum AggregationMetricType {
33
- /** The number of rows; {@link aggregation.count}. */
34
- COUNT = "count",
35
- /**
36
- * An {@link AggregationFunction} of an expression; {@link aggregation.sum}
37
- * and its siblings.
38
- */
39
- NUMERIC = "numeric",
40
- /** Any one value of a field; {@link aggregation.any}. Wow 9.0 and later. */
41
- ANY = "any",
42
- /**
43
- * The number of distinct values; {@link aggregation.distinctCount}. Wow 9.1
44
- * and later.
45
- */
46
- DISTINCT_COUNT = "distinct-count",
47
- /**
48
- * A percentile of an expression; {@link aggregation.percentile}. Wow 9.1
49
- * and later.
50
- */
51
- PERCENTILE = "percentile",
52
- /**
53
- * Arithmetic over other metrics; {@link aggregation.derived}. Wow 9.1 and
54
- * later.
55
- */
56
- DERIVED = "derived",
57
- /**
58
- * A field's value on the group's earliest record; {@link aggregation.first}.
59
- * Wow 9.2 and later.
60
- */
61
- FIRST = "first",
62
- /**
63
- * A field's value on the group's latest record; {@link aggregation.last}.
64
- * Wow 9.2 and later.
65
- */
66
- LAST = "last"
67
- }
2
+ import { FieldSort } from '../sort.js';
3
+ import { AggregationGroup } from './groups.js';
4
+ import { HavingExpression } from './having.js';
5
+ import { AggregationMetric } from './metrics.js';
68
6
  /** The kind of an {@link AggregationExpression} node, sent as its `type`. */
69
7
  export declare enum AggregationExpressionType {
70
8
  /** The value of a field; {@link aggregation.field}. */
@@ -104,56 +42,6 @@ export declare enum AggregationExpressionOperator {
104
42
  /** `left / right` */
105
43
  DIVIDE = "divide"
106
44
  }
107
- /**
108
- * The calendar unit of a `DATE_HISTOGRAM` bucket, cut in the group's
109
- * `timeZone`.
110
- */
111
- export declare enum AggregationDateUnit {
112
- YEAR = "year",
113
- QUARTER = "quarter",
114
- MONTH = "month",
115
- WEEK = "week",
116
- DAY = "day",
117
- HOUR = "hour",
118
- MINUTE = "minute",
119
- SECOND = "second"
120
- }
121
- /**
122
- * The calendar part a `DATE_PART` group takes of each instant, read in the
123
- * group's `timeZone`. Its keys are integers from a fixed domain, so records
124
- * from different days, weeks or years fall into one bucket.
125
- */
126
- export declare enum AggregationDatePart {
127
- /** The ISO weekday: 1 is Monday, 7 is Sunday. */
128
- DAY_OF_WEEK = "day-of-week",
129
- /**
130
- * The day of the month, 1 to 31; days 29 to 31 exist only in the months
131
- * that have them.
132
- */
133
- DAY_OF_MONTH = "day-of-month",
134
- /** The hour on the wall clock of the group's `timeZone`, 0 to 23. */
135
- HOUR_OF_DAY = "hour-of-day",
136
- /** The month of the year, 1 (January) to 12. */
137
- MONTH_OF_YEAR = "month-of-year"
138
- }
139
- /**
140
- * What a `NUMERIC` metric computes over its expression; each has a builder,
141
- * {@link aggregation.sum} through {@link aggregation.variance}.
142
- */
143
- export declare enum AggregationFunction {
144
- /** The sum */
145
- SUM = "sum",
146
- /** The average */
147
- AVG = "avg",
148
- /** The least value */
149
- MIN = "min",
150
- /** The greatest value */
151
- MAX = "max",
152
- /** The standard deviation */
153
- STDDEV = "stddev",
154
- /** The variance */
155
- VARIANCE = "variance"
156
- }
157
45
  /**
158
46
  * An array field whose elements the query aggregates over instead of the
159
47
  * root documents; build it with {@link aggregation.element}. A query takes at
@@ -168,111 +56,6 @@ export interface AggregationElement {
168
56
  */
169
57
  filter?: ElementFilterExpression | ExpressionFilter;
170
58
  }
171
- /** What every {@link AggregationGroup} has. */
172
- interface AggregationGroupBase<FIELDS extends string = string> {
173
- /** The field the rows are grouped by. */
174
- field: QueryField<FIELDS>;
175
- /** The name of the group's column in the result rows. */
176
- alias: string;
177
- /**
178
- * What `field` is relative to when the query expands elements: the
179
- * innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
180
- * A `ROOT` group names a field, never an expression. Wow 9.9 and later,
181
- * where `analysis.rootGroups` is `true`.
182
- */
183
- scope?: AggregationGroupScope;
184
- }
185
- /**
186
- * What a TERMS or HISTOGRAM group groups by: a field, or a computed
187
- * expression in its place (Wow 9.2 and later), never both. An expression
188
- * input is an expensive computation the server admits only where
189
- * `analysis.expressions` is `true`.
190
- */
191
- export type AggregationGroupInput<FIELDS extends string = string> = {
192
- /** The field the rows are grouped by. */
193
- field: QueryField<FIELDS>;
194
- expression?: undefined;
195
- } | {
196
- field?: undefined;
197
- /** The per-row value the rows are grouped by, such as a `DATE_DIFF`. */
198
- expression: AggregationExpression<FIELDS>;
199
- };
200
- /**
201
- * One group per distinct value of a field, or of an expression;
202
- * {@link aggregation.terms}. `missingKey` needs a field.
203
- */
204
- export type TermsAggregationGroup<FIELDS extends string = string> = {
205
- type: AggregationGroupType.TERMS;
206
- /** The name of the group's column in the result rows. */
207
- alias: string;
208
- /** The key the rows without a value are grouped under. Wow 9.1 and later. */
209
- missingKey?: string;
210
- /**
211
- * What `field` is relative to when the query expands elements: the
212
- * innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
213
- * A `ROOT` group names a field, never an expression. Wow 9.9 and later,
214
- * where `analysis.rootGroups` is `true`.
215
- */
216
- scope?: AggregationGroupScope;
217
- } & AggregationGroupInput<FIELDS>;
218
- /**
219
- * Buckets of equal width over a number field, or over an expression;
220
- * {@link aggregation.histogram}.
221
- */
222
- export type HistogramAggregationGroup<FIELDS extends string = string> = {
223
- type: AggregationGroupType.HISTOGRAM;
224
- /** The name of the group's column in the result rows. */
225
- alias: string;
226
- /** The width of each bucket, greater than 0. */
227
- interval: number;
228
- /**
229
- * What `field` is relative to when the query expands elements: the
230
- * innermost element (`ELEMENT`, the default) or the root record (`ROOT`).
231
- * A `ROOT` group names a field, never an expression. Wow 9.9 and later,
232
- * where `analysis.rootGroups` is `true`.
233
- */
234
- scope?: AggregationGroupScope;
235
- } & AggregationGroupInput<FIELDS>;
236
- /**
237
- * Calendar buckets over a time field in epoch milliseconds;
238
- * {@link aggregation.dateHistogram}.
239
- */
240
- export interface DateHistogramAggregationGroup<FIELDS extends string = string> extends AggregationGroupBase<FIELDS> {
241
- type: AggregationGroupType.DATE_HISTOGRAM;
242
- /** The calendar unit of each bucket. */
243
- unit: AggregationDateUnit;
244
- /** The IANA zone the buckets are cut in; `UTC` when absent. */
245
- timeZone?: string;
246
- /**
247
- * Whether the server fills in the empty buckets of the range. Wow 9.1 and
248
- * later, and only when this is the query's only group.
249
- */
250
- dense?: boolean;
251
- }
252
- /**
253
- * One calendar part of a time field in epoch milliseconds, such as the
254
- * weekday or the hour; {@link aggregation.datePart}. Its keys in the result
255
- * rows are integers from the part's domain, such as 1 (Monday) to 7 (Sunday)
256
- * for `DAY_OF_WEEK`. Wow 9.2 and later.
257
- */
258
- export interface DatePartAggregationGroup<FIELDS extends string = string> extends AggregationGroupBase<FIELDS> {
259
- type: AggregationGroupType.DATE_PART;
260
- /** The calendar part each row is grouped by. */
261
- part: AggregationDatePart;
262
- /** The IANA zone the part is read in; `UTC` when absent. */
263
- timeZone?: string;
264
- /**
265
- * Whether the server returns every key of the part's domain, filling a
266
- * key with no records with each metric's empty value. Only when this is
267
- * the query's only group.
268
- */
269
- dense?: boolean;
270
- }
271
- /**
272
- * One dimension of an {@link AggregationQuery}'s `groupBy`: each result row
273
- * is one combination of the groups' keys.
274
- */
275
- export type AggregationGroup<FIELDS extends string = string> = TermsAggregationGroup<FIELDS> | HistogramAggregationGroup<FIELDS> | DateHistogramAggregationGroup<FIELDS> | DatePartAggregationGroup<FIELDS>;
276
59
  /** The value of a field, as an operand; {@link aggregation.field}. */
277
60
  export interface FieldAggregationExpression<FIELDS extends string = string> {
278
61
  type: AggregationExpressionType.FIELD;
@@ -323,214 +106,6 @@ export interface DateDiffAggregationExpression<FIELDS extends string = string> {
323
106
  * filter on its own.
324
107
  */
325
108
  export type AggregationExpression<FIELDS extends string = string> = FieldAggregationExpression<FIELDS> | ConstantAggregationExpression | BinaryAggregationExpression<FIELDS> | DateDiffAggregationExpression<FIELDS>;
326
- /** The number of rows in each group; {@link aggregation.count}. */
327
- export interface CountAggregationMetric<FIELDS extends string = string> {
328
- /** Counts only the rows that match. Wow 9.1 and later. */
329
- filter?: FilterExpression<FIELDS>;
330
- type: AggregationMetricType.COUNT;
331
- /** The name of the metric's column in the result rows. */
332
- alias: string;
333
- }
334
- /**
335
- * An {@link AggregationFunction} of an expression; {@link aggregation.sum},
336
- * `avg`, `min`, `max`, `stddev`, `variance`.
337
- */
338
- export interface NumericAggregationMetric<FIELDS extends string = string> {
339
- /** Aggregates only the rows that match. Wow 9.1 and later. */
340
- filter?: FilterExpression<FIELDS>;
341
- type: AggregationMetricType.NUMERIC;
342
- /** What is computed. */
343
- function: AggregationFunction;
344
- /** The per-row value it is computed over. */
345
- expression: AggregationExpression<FIELDS>;
346
- /** The name of the metric's column in the result rows. */
347
- alias: string;
348
- }
349
- /**
350
- * Any one value of a field within each group, of any type;
351
- * {@link aggregation.any}. Wow 9.0 and later. Neither a derived metric nor
352
- * `having` may refer to it.
353
- */
354
- export interface AnyAggregationMetric<FIELDS extends string = string> {
355
- /** Aggregates only the rows that match. Wow 9.1 and later. */
356
- filter?: FilterExpression<FIELDS>;
357
- type: AggregationMetricType.ANY;
358
- /** The field whose value is taken. */
359
- field: QueryField<FIELDS>;
360
- /** The name of the metric's column in the result rows. */
361
- alias: string;
362
- }
363
- /**
364
- * A field's value on the earliest (`FIRST`) or latest (`LAST`) record of
365
- * each group, ordered by `orderBy`; {@link aggregation.first} and
366
- * {@link aggregation.last}. Wow 9.2 and later.
367
- *
368
- * The value comes back in the field's own type, not as a number, and is
369
- * `null` when no record of the group has both a value and an `orderBy`
370
- * position. Without `orderBy` the server orders by the model's event time,
371
- * the field the descriptor names as `analysis.firstLastOrderBy`. Records
372
- * tied on `orderBy` may yield any one of their values. Like `ANY`, neither a
373
- * derived metric nor `having` may refer to it.
374
- */
375
- export interface EdgeAggregationMetric<FIELDS extends string = string> {
376
- type: AggregationMetricType.FIRST | AggregationMetricType.LAST;
377
- /** The single-valued field whose value is taken. */
378
- field: QueryField<FIELDS>;
379
- /**
380
- * The single-valued, sortable field that orders the records; the model's
381
- * event time when absent.
382
- */
383
- orderBy?: QueryField<FIELDS>;
384
- /** The name of the metric's column in the result rows. */
385
- alias: string;
386
- /** Aggregates only the rows that match. */
387
- filter?: FilterExpression<FIELDS>;
388
- }
389
- /**
390
- * The number of distinct values of an expression;
391
- * {@link aggregation.distinctCount}. Wow 9.1 and later.
392
- */
393
- export interface DistinctCountAggregationMetric<FIELDS extends string = string> {
394
- type: AggregationMetricType.DISTINCT_COUNT;
395
- /** The per-row value whose distinct values are counted. */
396
- expression: AggregationExpression<FIELDS>;
397
- /** The name of the metric's column in the result rows. */
398
- alias: string;
399
- /** Aggregates only the rows that match. */
400
- filter?: FilterExpression<FIELDS>;
401
- }
402
- /**
403
- * A percentile of an expression; {@link aggregation.percentile}. Wow 9.1 and
404
- * later.
405
- */
406
- export interface PercentileAggregationMetric<FIELDS extends string = string> {
407
- type: AggregationMetricType.PERCENTILE;
408
- /** The per-row value the percentile is taken over. */
409
- expression: AggregationExpression<FIELDS>;
410
- /** Which percentile, within (0, 100). */
411
- percentile: number;
412
- /** The name of the metric's column in the result rows. */
413
- alias: string;
414
- /** Aggregates only the rows that match. */
415
- filter?: FilterExpression<FIELDS>;
416
- }
417
- /** The kind of a {@link DerivedExpression} node, sent as its `type`. */
418
- export declare enum DerivedExpressionType {
419
- /** The value of another metric of the row, by its alias. */
420
- METRIC_REF = "metric-ref",
421
- /** A number. */
422
- CONSTANT = "constant",
423
- /** Two operands and an {@link AggregationExpressionOperator}. */
424
- BINARY = "binary",
425
- /** A window: the metric summed over a partition of the groups. */
426
- TOTAL = "total",
427
- /** A window: the metric accumulated along an order, or its moving average. */
428
- RUNNING = "running",
429
- /** A window: the metric of an earlier period along a date group. */
430
- PREVIOUS = "previous",
431
- /** A window: the dense rank of the metric within a partition. */
432
- RANK = "rank"
433
- }
434
- /**
435
- * The window functions of derived expressions, as a storage declares them in
436
- * `analysis.windows` of its descriptor.
437
- */
438
- export declare enum WindowFunction {
439
- TOTAL = "total",
440
- RUNNING = "running",
441
- PREVIOUS = "previous",
442
- RANK = "rank"
443
- }
444
- /** What a `RUNNING` window computes over its frame. */
445
- export declare enum RunningFunction {
446
- SUM = "sum",
447
- AVG = "avg"
448
- }
449
- /**
450
- * A window over the groups of the aggregation. Wow computes it over every
451
- * group the filter selects, before `having`, `sort` and `limit`; `metric`
452
- * names a non-derived numeric metric declared before the derived one, and
453
- * `within`, `order` and `along` name groups of the query. Wow 9.9 and later,
454
- * where `analysis.windows` lists the function.
455
- */
456
- export type DerivedWindow = {
457
- type: DerivedExpressionType.TOTAL;
458
- /** A `COUNT` or `SUM` metric. */
459
- metric: string;
460
- /** The partition's group aliases; every group when absent. */
461
- within?: string[];
462
- } | {
463
- type: DerivedExpressionType.RUNNING;
464
- /** A `COUNT` or `SUM` metric for `SUM`; any numeric metric for `AVG`. */
465
- metric: string;
466
- /** A group alias or a non-derived numeric metric, with its direction. */
467
- order: FieldSort;
468
- within?: string[];
469
- /** The last this many groups; every group up to this one when absent. */
470
- frame?: number;
471
- /** `SUM` when absent. */
472
- function?: RunningFunction;
473
- } | {
474
- type: DerivedExpressionType.PREVIOUS;
475
- metric: string;
476
- /** The alias of a `DATE_HISTOGRAM` group. */
477
- along: string;
478
- /** How many steps back; 1 when absent. */
479
- shift?: number;
480
- /** Step by this calendar period instead of by one bucket of `along`. */
481
- period?: AggregationDateUnit;
482
- } | {
483
- type: DerivedExpressionType.RANK;
484
- metric: string;
485
- within?: string[];
486
- /** `DESC` when absent. */
487
- direction?: SortDirection;
488
- };
489
- /**
490
- * Post-aggregation arithmetic; references must name earlier metrics that are
491
- * not `ANY`, `FIRST` or `LAST`.
492
- */
493
- export type DerivedExpression = {
494
- type: DerivedExpressionType.METRIC_REF;
495
- metric: string;
496
- } | {
497
- type: DerivedExpressionType.CONSTANT;
498
- value: number;
499
- } | {
500
- type: DerivedExpressionType.BINARY;
501
- operator: AggregationExpressionOperator;
502
- left: DerivedExpression;
503
- right: DerivedExpression;
504
- } | DerivedWindow;
505
- /**
506
- * A metric computed from metrics declared before it in the same query, after
507
- * aggregation; {@link aggregation.derived}. Wow 9.1 and later.
508
- */
509
- export interface DerivedAggregationMetric {
510
- type: AggregationMetricType.DERIVED;
511
- /** The arithmetic over the other metrics. */
512
- expression: DerivedExpression;
513
- /** The name of the metric's column in the result rows. */
514
- alias: string;
515
- }
516
- /** The kind of a {@link HavingExpression} node, sent as its `type`. */
517
- export declare enum HavingExpressionType {
518
- /** A metric compared with a number; `aggregation.having.eq` … `lte`. */
519
- CONDITION = "condition",
520
- /** A metric within bounds, inclusive; `aggregation.having.between`. */
521
- BETWEEN = "between",
522
- /** A metric equal to one of the numbers; `aggregation.having.isIn`. */
523
- IN = "in",
524
- /**
525
- * A metric without a value, or with one when `negated`;
526
- * `aggregation.having.isNull`, `isNotNull`.
527
- */
528
- IS_NULL = "is-null",
529
- /** All operands hold; `aggregation.having.and`. */
530
- AND = "and",
531
- /** At least one operand holds; `aggregation.having.or`. */
532
- OR = "or"
533
- }
534
109
  /** The comparison of a `CONDITION` in a {@link HavingExpression}. */
535
110
  export declare enum ComparisonOperator {
536
111
  /** `=` */
@@ -546,37 +121,6 @@ export declare enum ComparisonOperator {
546
121
  /** `≤` */
547
122
  LTE = "lte"
548
123
  }
549
- /**
550
- * Filters grouped results by metric aliases, before sorting/limit; never an
551
- * `ANY`, `FIRST` or `LAST` metric.
552
- */
553
- export type HavingExpression = {
554
- type: HavingExpressionType.CONDITION;
555
- metric: string;
556
- operator: ComparisonOperator;
557
- value: number;
558
- } | {
559
- type: HavingExpressionType.BETWEEN;
560
- metric: string;
561
- lower: number;
562
- upper: number;
563
- } | {
564
- type: HavingExpressionType.IN;
565
- metric: string;
566
- values: [number, ...number[]];
567
- } | {
568
- type: HavingExpressionType.IS_NULL;
569
- metric: string;
570
- negated?: boolean;
571
- } | {
572
- type: HavingExpressionType.AND | HavingExpressionType.OR;
573
- operands: [HavingExpression, ...HavingExpression[]];
574
- };
575
- /**
576
- * One column an {@link AggregationQuery} computes for each group; a query
577
- * takes 1 to `AGGREGATION_LIMITS.MAX_METRICS` of them.
578
- */
579
- export type AggregationMetric<FIELDS extends string = string> = CountAggregationMetric<FIELDS> | NumericAggregationMetric<FIELDS> | AnyAggregationMetric<FIELDS> | DistinctCountAggregationMetric<FIELDS> | PercentileAggregationMetric<FIELDS> | DerivedAggregationMetric | EdgeAggregationMetric<FIELDS>;
580
124
  /**
581
125
  * An aggregation request: which documents, grouped how, computing which
582
126
  * metrics. `QueryModelClient.aggregate` sends it, and each
@@ -620,69 +164,6 @@ export interface AggregationQuery<ROOT_FIELDS extends string = string, AGGREGATI
620
164
  */
621
165
  having?: HavingExpression;
622
166
  }
623
- /**
624
- * The options every metric builder takes after its target and alias.
625
- */
626
- export interface AggregationMetricOptions<FIELDS extends string = string> {
627
- /** Counts only the rows that match; sent as the metric's `filter`. */
628
- filter?: FilterExpression<FIELDS>;
629
- }
630
- /** The option every group builder takes. */
631
- export interface AggregationGroupScopeOptions {
632
- /**
633
- * What the field is relative to when the query expands elements; the
634
- * innermost element when absent. `ROOT` needs a field input. Wow 9.9 and
635
- * later.
636
- */
637
- scope?: AggregationGroupScope;
638
- }
639
- /** The options of {@link aggregation.terms}. */
640
- export interface TermsAggregationOptions extends AggregationGroupScopeOptions {
641
- /** The key rows without a value are grouped under; must not be blank. */
642
- missingKey?: string;
643
- }
644
- /** The options of {@link aggregation.histogram}. */
645
- export interface HistogramAggregationOptions extends AggregationGroupScopeOptions {
646
- /** The width of each bucket: finite and greater than 0. */
647
- interval: number;
648
- }
649
- /** The options of {@link aggregation.dateHistogram}. */
650
- export interface DateHistogramAggregationOptions extends AggregationGroupScopeOptions {
651
- /** The calendar unit of each bucket. */
652
- unit: AggregationDateUnit;
653
- /** The zone the buckets are cut in, an IANA id. Defaults to `UTC`. */
654
- timeZone?: string;
655
- /**
656
- * Whether the server fills in the empty buckets of the range. Only when
657
- * this is the only group.
658
- */
659
- dense?: boolean;
660
- }
661
- /** The options of {@link aggregation.datePart}. */
662
- export interface DatePartAggregationOptions extends AggregationGroupScopeOptions {
663
- /** The calendar part each row is grouped by. */
664
- part: AggregationDatePart;
665
- /** The zone the part is read in, an IANA id. Defaults to `UTC`. */
666
- timeZone?: string;
667
- /**
668
- * Whether the server returns every key of the part's domain, the empty
669
- * ones filled in. Only when this is the only group.
670
- */
671
- dense?: boolean;
672
- }
673
- /** The options of {@link aggregation.first} and {@link aggregation.last}. */
674
- export interface EdgeAggregationOptions<FIELDS extends string = string> extends AggregationMetricOptions<FIELDS> {
675
- /**
676
- * The single-valued, sortable field that orders the records. Defaults to
677
- * the model's event time, `analysis.firstLastOrderBy` in the descriptor.
678
- */
679
- orderBy?: FIELDS;
680
- }
681
- /** The options of {@link aggregation.percentile}. */
682
- export interface PercentileAggregationOptions<FIELDS extends string = string> extends AggregationMetricOptions<FIELDS> {
683
- /** Which percentile: finite and within (0, 100). */
684
- percentile: number;
685
- }
686
167
  /**
687
168
  * The sizes Wow's own `AggregationQuery` enforces by throwing.
688
169
  *
@@ -710,4 +191,3 @@ export declare const AGGREGATION_LIMITS: Readonly<{
710
191
  /** The most windows in the whole query. */
711
192
  MAX_WINDOWS: 8;
712
193
  }>;
713
- export {};
@@ -1,33 +1,13 @@
1
1
  // src/dsl/aggregation/types.ts
2
2
  var e = /* @__PURE__ */ function(e) {
3
- return e.TERMS = "terms", e.HISTOGRAM = "histogram", e.DATE_HISTOGRAM = "date-histogram", e.DATE_PART = "date-part", e;
4
- }({}), t = /* @__PURE__ */ function(e) {
5
- return e.ELEMENT = "element", e.ROOT = "root", e;
6
- }({}), n = /* @__PURE__ */ function(e) {
7
- return e.COUNT = "count", e.NUMERIC = "numeric", e.ANY = "any", e.DISTINCT_COUNT = "distinct-count", e.PERCENTILE = "percentile", e.DERIVED = "derived", e.FIRST = "first", e.LAST = "last", e;
8
- }({}), r = /* @__PURE__ */ function(e) {
9
3
  return e.FIELD = "field", e.CONSTANT = "constant", e.BINARY = "binary", e.DATE_DIFF = "date-diff", e;
10
- }({}), i = /* @__PURE__ */ function(e) {
4
+ }({}), t = /* @__PURE__ */ function(e) {
11
5
  return e.SECOND = "second", e.MINUTE = "minute", e.HOUR = "hour", e.DAY = "day", e;
12
- }({}), a = /* @__PURE__ */ function(e) {
6
+ }({}), n = /* @__PURE__ */ function(e) {
13
7
  return e.ADD = "add", e.SUBTRACT = "subtract", e.MULTIPLY = "multiply", e.DIVIDE = "divide", e;
14
- }({}), o = /* @__PURE__ */ function(e) {
15
- return e.YEAR = "year", e.QUARTER = "quarter", e.MONTH = "month", e.WEEK = "week", e.DAY = "day", e.HOUR = "hour", e.MINUTE = "minute", e.SECOND = "second", e;
16
- }({}), s = /* @__PURE__ */ function(e) {
17
- return e.DAY_OF_WEEK = "day-of-week", e.DAY_OF_MONTH = "day-of-month", e.HOUR_OF_DAY = "hour-of-day", e.MONTH_OF_YEAR = "month-of-year", e;
18
- }({}), c = /* @__PURE__ */ function(e) {
19
- return e.SUM = "sum", e.AVG = "avg", e.MIN = "min", e.MAX = "max", e.STDDEV = "stddev", e.VARIANCE = "variance", e;
20
- }({}), l = /* @__PURE__ */ function(e) {
21
- return e.METRIC_REF = "metric-ref", e.CONSTANT = "constant", e.BINARY = "binary", e.TOTAL = "total", e.RUNNING = "running", e.PREVIOUS = "previous", e.RANK = "rank", e;
22
- }({}), u = /* @__PURE__ */ function(e) {
23
- return e.TOTAL = "total", e.RUNNING = "running", e.PREVIOUS = "previous", e.RANK = "rank", e;
24
- }({}), d = /* @__PURE__ */ function(e) {
25
- return e.SUM = "sum", e.AVG = "avg", e;
26
- }({}), f = /* @__PURE__ */ function(e) {
27
- return e.CONDITION = "condition", e.BETWEEN = "between", e.IN = "in", e.IS_NULL = "is-null", e.AND = "and", e.OR = "or", e;
28
- }({}), p = /* @__PURE__ */ function(e) {
8
+ }({}), r = /* @__PURE__ */ function(e) {
29
9
  return e.EQ = "eq", e.NE = "ne", e.GT = "gt", e.GTE = "gte", e.LT = "lt", e.LTE = "lte", e;
30
- }({}), m = Object.freeze({
10
+ }({}), i = Object.freeze({
31
11
  DEFAULT_LIMIT: 100,
32
12
  MAX_LIMIT: 1e4,
33
13
  MAX_ELEMENTS: 5,
@@ -38,6 +18,6 @@ var e = /* @__PURE__ */ function(e) {
38
18
  MAX_EXPRESSION_NODES: 256,
39
19
  MAX_WINDOWS: 8
40
20
  });
41
- export { m as AGGREGATION_LIMITS, s as AggregationDatePart, o as AggregationDateUnit, a as AggregationExpressionOperator, r as AggregationExpressionType, c as AggregationFunction, t as AggregationGroupScope, e as AggregationGroupType, n as AggregationMetricType, p as ComparisonOperator, i as DateDiffUnit, l as DerivedExpressionType, f as HavingExpressionType, d as RunningFunction, u as WindowFunction };
21
+ export { i as AGGREGATION_LIMITS, n as AggregationExpressionOperator, e as AggregationExpressionType, r as ComparisonOperator, t as DateDiffUnit };
42
22
 
43
23
  //# sourceMappingURL=types.es.js.map