@ahoo-wang/wow-client 9.2.0-rc.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 (404) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +291 -0
  3. package/README.zh-CN.md +267 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.cjs +1 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.es.js +9 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.cjs +1 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.es.js +6 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateParam.cjs +1 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateParam.es.js +8 -0
  10. package/dist/client/bindMethods.cjs +2 -0
  11. package/dist/client/bindMethods.cjs.map +1 -0
  12. package/dist/client/bindMethods.d.cts +13 -0
  13. package/dist/client/bindMethods.d.ts +13 -0
  14. package/dist/client/bindMethods.es.js +19 -0
  15. package/dist/client/bindMethods.es.js.map +1 -0
  16. package/dist/client/command/commandClient.cjs +2 -0
  17. package/dist/client/command/commandClient.cjs.map +1 -0
  18. package/dist/client/command/commandClient.d.cts +67 -0
  19. package/dist/client/command/commandClient.d.ts +67 -0
  20. package/dist/client/command/commandClient.es.js +38 -0
  21. package/dist/client/command/commandClient.es.js.map +1 -0
  22. package/dist/client/command/commandHeaders.cjs +2 -0
  23. package/dist/client/command/commandHeaders.cjs.map +1 -0
  24. package/dist/client/command/commandHeaders.d.cts +75 -0
  25. package/dist/client/command/commandHeaders.d.ts +75 -0
  26. package/dist/client/command/commandHeaders.es.js +31 -0
  27. package/dist/client/command/commandHeaders.es.js.map +1 -0
  28. package/dist/client/command/commandRequest.cjs +2 -0
  29. package/dist/client/command/commandRequest.cjs.map +1 -0
  30. package/dist/client/command/commandRequest.d.cts +180 -0
  31. package/dist/client/command/commandRequest.d.ts +180 -0
  32. package/dist/client/command/commandRequest.es.js +31 -0
  33. package/dist/client/command/commandRequest.es.js.map +1 -0
  34. package/dist/client/command/commandResult.d.cts +15 -0
  35. package/dist/client/command/commandResult.d.ts +15 -0
  36. package/dist/client/command/index.d.cts +5 -0
  37. package/dist/client/command/index.d.ts +5 -0
  38. package/dist/client/command/types.d.cts +71 -0
  39. package/dist/client/command/types.d.ts +71 -0
  40. package/dist/client/metadata/index.d.cts +2 -0
  41. package/dist/client/metadata/index.d.ts +2 -0
  42. package/dist/client/metadata/wowMetadata.d.cts +48 -0
  43. package/dist/client/metadata/wowMetadata.d.ts +48 -0
  44. package/dist/client/metadata/wowMetadataClient.cjs +2 -0
  45. package/dist/client/metadata/wowMetadataClient.cjs.map +1 -0
  46. package/dist/client/metadata/wowMetadataClient.d.cts +23 -0
  47. package/dist/client/metadata/wowMetadataClient.d.ts +23 -0
  48. package/dist/client/metadata/wowMetadataClient.es.js +25 -0
  49. package/dist/client/metadata/wowMetadataClient.es.js.map +1 -0
  50. package/dist/client/query/descriptor/descriptorEndpoints.cjs +2 -0
  51. package/dist/client/query/descriptor/descriptorEndpoints.cjs.map +1 -0
  52. package/dist/client/query/descriptor/descriptorEndpoints.d.cts +29 -0
  53. package/dist/client/query/descriptor/descriptorEndpoints.d.ts +29 -0
  54. package/dist/client/query/descriptor/descriptorEndpoints.es.js +69 -0
  55. package/dist/client/query/descriptor/descriptorEndpoints.es.js.map +1 -0
  56. package/dist/client/query/descriptor/endpointPaths.cjs +2 -0
  57. package/dist/client/query/descriptor/endpointPaths.cjs.map +1 -0
  58. package/dist/client/query/descriptor/endpointPaths.d.cts +4 -0
  59. package/dist/client/query/descriptor/endpointPaths.d.ts +4 -0
  60. package/dist/client/query/descriptor/endpointPaths.es.js +9 -0
  61. package/dist/client/query/descriptor/endpointPaths.es.js.map +1 -0
  62. package/dist/client/query/descriptor/index.d.cts +2 -0
  63. package/dist/client/query/descriptor/index.d.ts +2 -0
  64. package/dist/client/query/descriptor/queryDescriptorApi.d.cts +58 -0
  65. package/dist/client/query/descriptor/queryDescriptorApi.d.ts +58 -0
  66. package/dist/client/query/descriptor/queryDescriptorClient.cjs +2 -0
  67. package/dist/client/query/descriptor/queryDescriptorClient.cjs.map +1 -0
  68. package/dist/client/query/descriptor/queryDescriptorClient.d.cts +61 -0
  69. package/dist/client/query/descriptor/queryDescriptorClient.d.ts +61 -0
  70. package/dist/client/query/descriptor/queryDescriptorClient.es.js +20 -0
  71. package/dist/client/query/descriptor/queryDescriptorClient.es.js.map +1 -0
  72. package/dist/client/query/event/domainEventStream.cjs +2 -0
  73. package/dist/client/query/event/domainEventStream.cjs.map +1 -0
  74. package/dist/client/query/event/domainEventStream.d.cts +105 -0
  75. package/dist/client/query/event/domainEventStream.d.ts +105 -0
  76. package/dist/client/query/event/domainEventStream.es.js +23 -0
  77. package/dist/client/query/event/domainEventStream.es.js.map +1 -0
  78. package/dist/client/query/event/endpointPaths.cjs +2 -0
  79. package/dist/client/query/event/endpointPaths.cjs.map +1 -0
  80. package/dist/client/query/event/endpointPaths.d.cts +8 -0
  81. package/dist/client/query/event/endpointPaths.d.ts +8 -0
  82. package/dist/client/query/event/endpointPaths.es.js +13 -0
  83. package/dist/client/query/event/endpointPaths.es.js.map +1 -0
  84. package/dist/client/query/event/eventStreamQueryApi.d.cts +29 -0
  85. package/dist/client/query/event/eventStreamQueryApi.d.ts +29 -0
  86. package/dist/client/query/event/eventStreamQueryClient.cjs +2 -0
  87. package/dist/client/query/event/eventStreamQueryClient.cjs.map +1 -0
  88. package/dist/client/query/event/eventStreamQueryClient.d.cts +190 -0
  89. package/dist/client/query/event/eventStreamQueryClient.d.ts +190 -0
  90. package/dist/client/query/event/eventStreamQueryClient.es.js +160 -0
  91. package/dist/client/query/event/eventStreamQueryClient.es.js.map +1 -0
  92. package/dist/client/query/event/index.d.cts +3 -0
  93. package/dist/client/query/event/index.d.ts +3 -0
  94. package/dist/client/query/factory.cjs +2 -0
  95. package/dist/client/query/factory.cjs.map +1 -0
  96. package/dist/client/query/factory.d.cts +165 -0
  97. package/dist/client/query/factory.d.ts +165 -0
  98. package/dist/client/query/factory.es.js +45 -0
  99. package/dist/client/query/factory.es.js.map +1 -0
  100. package/dist/client/query/index.d.cts +6 -0
  101. package/dist/client/query/index.d.ts +6 -0
  102. package/dist/client/query/queryApi.d.cts +68 -0
  103. package/dist/client/query/queryApi.d.ts +68 -0
  104. package/dist/client/query/requests.d.cts +24 -0
  105. package/dist/client/query/requests.d.ts +24 -0
  106. package/dist/client/query/snapshot/endpointPaths.cjs +2 -0
  107. package/dist/client/query/snapshot/endpointPaths.cjs.map +1 -0
  108. package/dist/client/query/snapshot/endpointPaths.d.cts +12 -0
  109. package/dist/client/query/snapshot/endpointPaths.d.ts +12 -0
  110. package/dist/client/query/snapshot/endpointPaths.es.js +17 -0
  111. package/dist/client/query/snapshot/endpointPaths.es.js.map +1 -0
  112. package/dist/client/query/snapshot/index.d.cts +3 -0
  113. package/dist/client/query/snapshot/index.d.ts +3 -0
  114. package/dist/client/query/snapshot/snapshot.cjs +2 -0
  115. package/dist/client/query/snapshot/snapshot.cjs.map +1 -0
  116. package/dist/client/query/snapshot/snapshot.d.cts +51 -0
  117. package/dist/client/query/snapshot/snapshot.d.ts +51 -0
  118. package/dist/client/query/snapshot/snapshot.es.js +20 -0
  119. package/dist/client/query/snapshot/snapshot.es.js.map +1 -0
  120. package/dist/client/query/snapshot/snapshotQueryApi.d.cts +101 -0
  121. package/dist/client/query/snapshot/snapshotQueryApi.d.ts +101 -0
  122. package/dist/client/query/snapshot/snapshotQueryClient.cjs +2 -0
  123. package/dist/client/query/snapshot/snapshotQueryClient.cjs.map +1 -0
  124. package/dist/client/query/snapshot/snapshotQueryClient.d.cts +369 -0
  125. package/dist/client/query/snapshot/snapshotQueryClient.d.ts +369 -0
  126. package/dist/client/query/snapshot/snapshotQueryClient.es.js +239 -0
  127. package/dist/client/query/snapshot/snapshotQueryClient.es.js.map +1 -0
  128. package/dist/client/query/state/endpointPaths.cjs +2 -0
  129. package/dist/client/query/state/endpointPaths.cjs.map +1 -0
  130. package/dist/client/query/state/endpointPaths.d.cts +10 -0
  131. package/dist/client/query/state/endpointPaths.d.ts +10 -0
  132. package/dist/client/query/state/endpointPaths.es.js +14 -0
  133. package/dist/client/query/state/endpointPaths.es.js.map +1 -0
  134. package/dist/client/query/state/index.d.cts +4 -0
  135. package/dist/client/query/state/index.d.ts +4 -0
  136. package/dist/client/query/state/loadOwnerStateAggregateApi.d.cts +36 -0
  137. package/dist/client/query/state/loadOwnerStateAggregateApi.d.ts +36 -0
  138. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs +2 -0
  139. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs.map +1 -0
  140. package/dist/client/query/state/loadOwnerStateAggregateClient.d.cts +58 -0
  141. package/dist/client/query/state/loadOwnerStateAggregateClient.d.ts +58 -0
  142. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js +56 -0
  143. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js.map +1 -0
  144. package/dist/client/query/state/loadStateAggregateApi.d.cts +37 -0
  145. package/dist/client/query/state/loadStateAggregateApi.d.ts +37 -0
  146. package/dist/client/query/state/loadStateAggregateClient.cjs +2 -0
  147. package/dist/client/query/state/loadStateAggregateClient.cjs.map +1 -0
  148. package/dist/client/query/state/loadStateAggregateClient.d.cts +62 -0
  149. package/dist/client/query/state/loadStateAggregateClient.d.ts +62 -0
  150. package/dist/client/query/state/loadStateAggregateClient.es.js +65 -0
  151. package/dist/client/query/state/loadStateAggregateClient.es.js.map +1 -0
  152. package/dist/client/routing.cjs +2 -0
  153. package/dist/client/routing.cjs.map +1 -0
  154. package/dist/client/routing.d.cts +47 -0
  155. package/dist/client/routing.d.ts +47 -0
  156. package/dist/client/routing.es.js +8 -0
  157. package/dist/client/routing.es.js.map +1 -0
  158. package/dist/dsl/aggregation/admit.cjs +2 -0
  159. package/dist/dsl/aggregation/admit.cjs.map +1 -0
  160. package/dist/dsl/aggregation/admit.d.cts +6 -0
  161. package/dist/dsl/aggregation/admit.d.ts +6 -0
  162. package/dist/dsl/aggregation/admit.es.js +142 -0
  163. package/dist/dsl/aggregation/admit.es.js.map +1 -0
  164. package/dist/dsl/aggregation/builders.cjs +2 -0
  165. package/dist/dsl/aggregation/builders.cjs.map +1 -0
  166. package/dist/dsl/aggregation/builders.d.cts +309 -0
  167. package/dist/dsl/aggregation/builders.d.ts +309 -0
  168. package/dist/dsl/aggregation/builders.es.js +188 -0
  169. package/dist/dsl/aggregation/builders.es.js.map +1 -0
  170. package/dist/dsl/aggregation/derived.cjs +2 -0
  171. package/dist/dsl/aggregation/derived.cjs.map +1 -0
  172. package/dist/dsl/aggregation/derived.d.cts +33 -0
  173. package/dist/dsl/aggregation/derived.d.ts +33 -0
  174. package/dist/dsl/aggregation/derived.es.js +31 -0
  175. package/dist/dsl/aggregation/derived.es.js.map +1 -0
  176. package/dist/dsl/aggregation/expressionTrees.cjs +2 -0
  177. package/dist/dsl/aggregation/expressionTrees.cjs.map +1 -0
  178. package/dist/dsl/aggregation/expressionTrees.d.cts +10 -0
  179. package/dist/dsl/aggregation/expressionTrees.d.ts +10 -0
  180. package/dist/dsl/aggregation/expressionTrees.es.js +44 -0
  181. package/dist/dsl/aggregation/expressionTrees.es.js.map +1 -0
  182. package/dist/dsl/aggregation/having.cjs +2 -0
  183. package/dist/dsl/aggregation/having.cjs.map +1 -0
  184. package/dist/dsl/aggregation/having.d.cts +94 -0
  185. package/dist/dsl/aggregation/having.d.ts +94 -0
  186. package/dist/dsl/aggregation/having.es.js +62 -0
  187. package/dist/dsl/aggregation/having.es.js.map +1 -0
  188. package/dist/dsl/aggregation/index.d.cts +4 -0
  189. package/dist/dsl/aggregation/index.d.ts +4 -0
  190. package/dist/dsl/aggregation/sort.cjs +2 -0
  191. package/dist/dsl/aggregation/sort.cjs.map +1 -0
  192. package/dist/dsl/aggregation/sort.d.cts +7 -0
  193. package/dist/dsl/aggregation/sort.d.ts +7 -0
  194. package/dist/dsl/aggregation/sort.es.js +10 -0
  195. package/dist/dsl/aggregation/sort.es.js.map +1 -0
  196. package/dist/dsl/aggregation/types.cjs +2 -0
  197. package/dist/dsl/aggregation/types.cjs.map +1 -0
  198. package/dist/dsl/aggregation/types.d.cts +608 -0
  199. package/dist/dsl/aggregation/types.d.ts +608 -0
  200. package/dist/dsl/aggregation/types.es.js +37 -0
  201. package/dist/dsl/aggregation/types.es.js.map +1 -0
  202. package/dist/dsl/cursorQuery.cjs +2 -0
  203. package/dist/dsl/cursorQuery.cjs.map +1 -0
  204. package/dist/dsl/cursorQuery.d.cts +69 -0
  205. package/dist/dsl/cursorQuery.d.ts +69 -0
  206. package/dist/dsl/cursorQuery.es.js +19 -0
  207. package/dist/dsl/cursorQuery.es.js.map +1 -0
  208. package/dist/dsl/deletionState.cjs +2 -0
  209. package/dist/dsl/deletionState.cjs.map +1 -0
  210. package/dist/dsl/deletionState.d.cts +19 -0
  211. package/dist/dsl/deletionState.d.ts +19 -0
  212. package/dist/dsl/deletionState.es.js +8 -0
  213. package/dist/dsl/deletionState.es.js.map +1 -0
  214. package/dist/dsl/descriptor.cjs +2 -0
  215. package/dist/dsl/descriptor.cjs.map +1 -0
  216. package/dist/dsl/descriptor.d.cts +629 -0
  217. package/dist/dsl/descriptor.d.ts +629 -0
  218. package/dist/dsl/descriptor.es.js +37 -0
  219. package/dist/dsl/descriptor.es.js.map +1 -0
  220. package/dist/dsl/documents.d.cts +8 -0
  221. package/dist/dsl/documents.d.ts +8 -0
  222. package/dist/dsl/field.cjs +2 -0
  223. package/dist/dsl/field.cjs.map +1 -0
  224. package/dist/dsl/field.d.cts +2 -0
  225. package/dist/dsl/field.d.ts +2 -0
  226. package/dist/dsl/field.es.js +10 -0
  227. package/dist/dsl/field.es.js.map +1 -0
  228. package/dist/dsl/filter/builders.cjs +2 -0
  229. package/dist/dsl/filter/builders.cjs.map +1 -0
  230. package/dist/dsl/filter/builders.d.cts +962 -0
  231. package/dist/dsl/filter/builders.d.ts +962 -0
  232. package/dist/dsl/filter/builders.es.js +289 -0
  233. package/dist/dsl/filter/builders.es.js.map +1 -0
  234. package/dist/dsl/filter/datePattern.cjs +2 -0
  235. package/dist/dsl/filter/datePattern.cjs.map +1 -0
  236. package/dist/dsl/filter/datePattern.d.cts +8 -0
  237. package/dist/dsl/filter/datePattern.d.ts +8 -0
  238. package/dist/dsl/filter/datePattern.es.js +100 -0
  239. package/dist/dsl/filter/datePattern.es.js.map +1 -0
  240. package/dist/dsl/filter/index.d.cts +3 -0
  241. package/dist/dsl/filter/index.d.ts +3 -0
  242. package/dist/dsl/filter/operator.cjs +2 -0
  243. package/dist/dsl/filter/operator.cjs.map +1 -0
  244. package/dist/dsl/filter/operator.d.cts +113 -0
  245. package/dist/dsl/filter/operator.d.ts +113 -0
  246. package/dist/dsl/filter/operator.es.js +14 -0
  247. package/dist/dsl/filter/operator.es.js.map +1 -0
  248. package/dist/dsl/filter/scope.cjs +2 -0
  249. package/dist/dsl/filter/scope.cjs.map +1 -0
  250. package/dist/dsl/filter/scope.d.cts +15 -0
  251. package/dist/dsl/filter/scope.d.ts +15 -0
  252. package/dist/dsl/filter/scope.es.js +32 -0
  253. package/dist/dsl/filter/scope.es.js.map +1 -0
  254. package/dist/dsl/filter/types.d.cts +274 -0
  255. package/dist/dsl/filter/types.d.ts +274 -0
  256. package/dist/dsl/filter/validate.cjs +2 -0
  257. package/dist/dsl/filter/validate.cjs.map +1 -0
  258. package/dist/dsl/filter/validate.d.cts +18 -0
  259. package/dist/dsl/filter/validate.d.ts +18 -0
  260. package/dist/dsl/filter/validate.es.js +56 -0
  261. package/dist/dsl/filter/validate.es.js.map +1 -0
  262. package/dist/dsl/pagination.cjs +2 -0
  263. package/dist/dsl/pagination.cjs.map +1 -0
  264. package/dist/dsl/pagination.d.cts +28 -0
  265. package/dist/dsl/pagination.d.ts +28 -0
  266. package/dist/dsl/pagination.es.js +15 -0
  267. package/dist/dsl/pagination.es.js.map +1 -0
  268. package/dist/dsl/projection.cjs +2 -0
  269. package/dist/dsl/projection.cjs.map +1 -0
  270. package/dist/dsl/projection.d.cts +27 -0
  271. package/dist/dsl/projection.d.ts +27 -0
  272. package/dist/dsl/projection.es.js +12 -0
  273. package/dist/dsl/projection.es.js.map +1 -0
  274. package/dist/dsl/queryable.cjs +2 -0
  275. package/dist/dsl/queryable.cjs.map +1 -0
  276. package/dist/dsl/queryable.d.cts +101 -0
  277. package/dist/dsl/queryable.d.ts +101 -0
  278. package/dist/dsl/queryable.es.js +40 -0
  279. package/dist/dsl/queryable.es.js.map +1 -0
  280. package/dist/dsl/sort.cjs +2 -0
  281. package/dist/dsl/sort.cjs.map +1 -0
  282. package/dist/dsl/sort.d.cts +33 -0
  283. package/dist/dsl/sort.d.ts +33 -0
  284. package/dist/dsl/sort.es.js +21 -0
  285. package/dist/dsl/sort.es.js.map +1 -0
  286. package/dist/dsl.cjs +1 -0
  287. package/dist/dsl.d.cts +23 -0
  288. package/dist/dsl.d.ts +23 -0
  289. package/dist/dsl.es.js +14 -0
  290. package/dist/error/errorInfo.cjs +2 -0
  291. package/dist/error/errorInfo.cjs.map +1 -0
  292. package/dist/error/errorInfo.d.cts +139 -0
  293. package/dist/error/errorInfo.d.ts +139 -0
  294. package/dist/error/errorInfo.es.js +32 -0
  295. package/dist/error/errorInfo.es.js.map +1 -0
  296. package/dist/error/headers.cjs +2 -0
  297. package/dist/error/headers.cjs.map +1 -0
  298. package/dist/error/headers.d.cts +38 -0
  299. package/dist/error/headers.d.ts +38 -0
  300. package/dist/error/headers.es.js +10 -0
  301. package/dist/error/headers.es.js.map +1 -0
  302. package/dist/error/index.d.cts +21 -0
  303. package/dist/error/index.d.ts +21 -0
  304. package/dist/error/queryErrorCodes.cjs +2 -0
  305. package/dist/error/queryErrorCodes.cjs.map +1 -0
  306. package/dist/error/queryErrorCodes.d.cts +199 -0
  307. package/dist/error/queryErrorCodes.d.ts +199 -0
  308. package/dist/error/queryErrorCodes.es.js +53 -0
  309. package/dist/error/queryErrorCodes.es.js.map +1 -0
  310. package/dist/error/wowError.cjs +2 -0
  311. package/dist/error/wowError.cjs.map +1 -0
  312. package/dist/error/wowError.d.cts +99 -0
  313. package/dist/error/wowError.d.ts +99 -0
  314. package/dist/error/wowError.es.js +53 -0
  315. package/dist/error/wowError.es.js.map +1 -0
  316. package/dist/index.cjs +1 -0
  317. package/dist/index.d.cts +17 -0
  318. package/dist/index.d.ts +17 -0
  319. package/dist/index.es.js +34 -0
  320. package/dist/legacy/condition.cjs +2 -0
  321. package/dist/legacy/condition.cjs.map +1 -0
  322. package/dist/legacy/condition.d.cts +517 -0
  323. package/dist/legacy/condition.d.ts +517 -0
  324. package/dist/legacy/condition.es.js +338 -0
  325. package/dist/legacy/condition.es.js.map +1 -0
  326. package/dist/legacy/index.d.cts +16 -0
  327. package/dist/legacy/index.d.ts +16 -0
  328. package/dist/legacy/locale/en_US.cjs +2 -0
  329. package/dist/legacy/locale/en_US.cjs.map +1 -0
  330. package/dist/legacy/locale/en_US.d.cts +7 -0
  331. package/dist/legacy/locale/en_US.d.ts +7 -0
  332. package/dist/legacy/locale/en_US.es.js +50 -0
  333. package/dist/legacy/locale/en_US.es.js.map +1 -0
  334. package/dist/legacy/locale/operatorLocale.d.cts +10 -0
  335. package/dist/legacy/locale/operatorLocale.d.ts +10 -0
  336. package/dist/legacy/locale/zh_CN.cjs +2 -0
  337. package/dist/legacy/locale/zh_CN.cjs.map +1 -0
  338. package/dist/legacy/locale/zh_CN.d.cts +7 -0
  339. package/dist/legacy/locale/zh_CN.d.ts +7 -0
  340. package/dist/legacy/locale/zh_CN.es.js +50 -0
  341. package/dist/legacy/locale/zh_CN.es.js.map +1 -0
  342. package/dist/legacy/operator.cjs +2 -0
  343. package/dist/legacy/operator.cjs.map +1 -0
  344. package/dist/legacy/operator.d.cts +218 -0
  345. package/dist/legacy/operator.d.ts +218 -0
  346. package/dist/legacy/operator.es.js +25 -0
  347. package/dist/legacy/operator.es.js.map +1 -0
  348. package/dist/legacy/queryable.cjs +2 -0
  349. package/dist/legacy/queryable.cjs.map +1 -0
  350. package/dist/legacy/queryable.d.cts +61 -0
  351. package/dist/legacy/queryable.d.ts +61 -0
  352. package/dist/legacy/queryable.es.js +34 -0
  353. package/dist/legacy/queryable.es.js.map +1 -0
  354. package/dist/legacy.cjs +1 -0
  355. package/dist/legacy.es.js +6 -0
  356. package/dist/model/abac.cjs +2 -0
  357. package/dist/model/abac.cjs.map +1 -0
  358. package/dist/model/abac.d.cts +33 -0
  359. package/dist/model/abac.d.ts +33 -0
  360. package/dist/model/abac.es.js +6 -0
  361. package/dist/model/abac.es.js.map +1 -0
  362. package/dist/model/bi.cjs +2 -0
  363. package/dist/model/bi.cjs.map +1 -0
  364. package/dist/model/bi.d.cts +12 -0
  365. package/dist/model/bi.d.ts +12 -0
  366. package/dist/model/bi.es.js +8 -0
  367. package/dist/model/bi.es.js.map +1 -0
  368. package/dist/model/command.cjs +2 -0
  369. package/dist/model/command.cjs.map +1 -0
  370. package/dist/model/command.d.cts +137 -0
  371. package/dist/model/command.d.ts +137 -0
  372. package/dist/model/command.es.js +8 -0
  373. package/dist/model/command.es.js.map +1 -0
  374. package/dist/model/common.d.cts +19 -0
  375. package/dist/model/common.d.ts +19 -0
  376. package/dist/model/function.cjs +2 -0
  377. package/dist/model/function.cjs.map +1 -0
  378. package/dist/model/function.d.cts +41 -0
  379. package/dist/model/function.d.ts +41 -0
  380. package/dist/model/function.es.js +8 -0
  381. package/dist/model/function.es.js.map +1 -0
  382. package/dist/model/index.d.cts +22 -0
  383. package/dist/model/index.d.ts +22 -0
  384. package/dist/model/messaging.d.cts +5 -0
  385. package/dist/model/messaging.d.ts +5 -0
  386. package/dist/model/modeling.d.cts +145 -0
  387. package/dist/model/modeling.d.ts +145 -0
  388. package/dist/model/naming.d.cts +27 -0
  389. package/dist/model/naming.d.ts +27 -0
  390. package/dist/transport/endpoints.cjs +2 -0
  391. package/dist/transport/endpoints.cjs.map +1 -0
  392. package/dist/transport/endpoints.d.cts +79 -0
  393. package/dist/transport/endpoints.d.ts +79 -0
  394. package/dist/transport/endpoints.es.js +14 -0
  395. package/dist/transport/endpoints.es.js.map +1 -0
  396. package/dist/transport/eventStreams.cjs +2 -0
  397. package/dist/transport/eventStreams.cjs.map +1 -0
  398. package/dist/transport/eventStreams.d.cts +23 -0
  399. package/dist/transport/eventStreams.d.ts +23 -0
  400. package/dist/transport/eventStreams.es.js +22 -0
  401. package/dist/transport/eventStreams.es.js.map +1 -0
  402. package/dist/transport/index.d.cts +1 -0
  403. package/dist/transport/index.d.ts +1 -0
  404. package/package.json +110 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor.es.js","names":["QueryModels","QueryValueTypes","QueryValueKind","\"UNKNOWN\"","\"NULL\"","\"SCALAR\"","\"OBJECT\"","\"ARRAY\"","\"UNION\"","PagingMode","\"LIST\"","\"PAGED\"","\"CURSOR\"","QueryFieldRoles","QueryConstraintTypes","SensitivityLevel","\"DISPLAY\"","\"CONFIDENTIAL\""],"sources":["../../src/dsl/descriptor.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// The capability descriptor `GET {aggregate}/{snapshot|event}/schema`\n// answers with: `wow.api.query.QueryModelDescriptor` of Wow 9.2, mirrored\n// from `wow-api/src/main/kotlin/me/ahoo/wow/api/query/descriptor/`.\n//\n// Kotlin leaves a null out of the JSON of every descriptor class annotated\n// `@JsonInclude(NON_NULL)`, so those properties are optional here; the\n// limits are not annotated and send `null`. A set the OpenAPI document\n// describes as a plain string is open: a known union plus `string & {}`.\n\nimport type {\n AggregationDatePart,\n AggregationDateUnit,\n DateDiffUnit,\n AggregationFunction,\n AggregationGroupType,\n AggregationMetricType,\n} from './aggregation/types.js';\nimport type { DeletionState } from './deletionState.js';\nimport type { FilterOperator, SearchMode, TimeUnit } from './filter/index.js';\n\n/**\n * The query models Wow names in a descriptor's `model`. The set is open: a\n * server may register a model of its own, so a descriptor's `model` is a\n * {@link QueryModel}.\n */\nexport const QueryModels = Object.freeze({\n /** The snapshot query model: `{aggregate}/snapshot/*`. */\n SNAPSHOT: 'SNAPSHOT',\n /** The event stream query model: `{aggregate}/event/*`. */\n EVENT_STREAM: 'EVENT_STREAM',\n} as const);\n\n/** A query model's name: one of {@link QueryModels}, or one a server added. */\nexport type QueryModel =\n (typeof QueryModels)[keyof typeof QueryModels] | (string & {});\n\n/**\n * The value types Wow names in a field's `types`. The set is open, like\n * {@link QueryModels}.\n */\nexport const QueryValueTypes = Object.freeze({\n /** A JSON string. */\n STRING: 'STRING',\n /** A whole number. */\n INTEGER: 'INTEGER',\n /** A number with a fraction. */\n DECIMAL: 'DECIMAL',\n /** `true` or `false`. */\n BOOLEAN: 'BOOLEAN',\n /** A JSON object. */\n OBJECT: 'OBJECT',\n} as const);\n\n/** A field's value type: one of {@link QueryValueTypes}, or one a server added. */\nexport type QueryValueType =\n (typeof QueryValueTypes)[keyof typeof QueryValueTypes] | (string & {});\n\n/** The structural shape of a field's value, sent as its `kind`. */\nexport enum QueryValueKind {\n /** Wow could not tell. */\n UNKNOWN = 'UNKNOWN',\n /** Always `null`. */\n NULL = 'NULL',\n /** A single string, number or boolean. */\n SCALAR = 'SCALAR',\n /** An object. */\n OBJECT = 'OBJECT',\n /** An array. */\n ARRAY = 'ARRAY',\n /** One of several of the above. */\n UNION = 'UNION',\n}\n\n/** The ways a model can be read page by page, listed in `record.paging`. */\nexport enum PagingMode {\n /** `list` and `listStream`: the first `limit` rows. */\n LIST = 'LIST',\n /** `paged`: numbered pages with a total. */\n PAGED = 'PAGED',\n /** `cursor`: forward-only pages after the last row seen. */\n CURSOR = 'CURSOR',\n}\n\n/**\n * The system roles Wow names in a field's `role`: the system fields a root\n * operator targets, and the model's times. The set is open, like\n * {@link QueryModels}.\n */\nexport const QueryFieldRoles = Object.freeze({\n /** The record's own identity, `record.identity`. */\n IDENTITY: 'IDENTITY',\n /** The aggregate id. */\n AGGREGATE_ID: 'AGGREGATE_ID',\n /** The tenant id. */\n TENANT_ID: 'TENANT_ID',\n /** The owner id. */\n OWNER_ID: 'OWNER_ID',\n /** The space id. */\n SPACE_ID: 'SPACE_ID',\n /** Whether the aggregate is deleted. */\n DELETED: 'DELETED',\n /**\n * When the record's events happened: a snapshot's last event\n * (`eventTime`), an event stream's events (`createTime`). `FIRST` and\n * `LAST` order by it when they name no `orderBy`. Wow 9.2 and later.\n */\n EVENT_TIME: 'EVENT_TIME',\n /**\n * When a snapshot's aggregate got its first event, i.e. was created\n * (`firstEventTime`). Wow 9.2 and later.\n */\n FIRST_EVENT_TIME: 'FIRST_EVENT_TIME',\n} as const);\n\n/** A system field's role: one of {@link QueryFieldRoles}, or one a server added. */\nexport type QueryFieldRole =\n (typeof QueryFieldRoles)[keyof typeof QueryFieldRoles] | (string & {});\n\n/**\n * The combination rules Wow names in a descriptor's `constraints`: rules\n * that no single capability shows. The set is open, like {@link QueryModels}.\n */\nexport const QueryConstraintTypes = Object.freeze({\n /**\n * A cursor's sort always ends with the identity field; the server appends\n * it (the constraint's `appended`) when the sort does not.\n */\n CURSOR_UNIQUE_SORT: 'CURSOR_UNIQUE_SORT',\n /** A count or paged query must not match every record. */\n COUNT_REQUIRES_FILTER: 'COUNT_REQUIRES_FILTER',\n /** `STARTS_WITH` needs a non-empty, case-sensitive prefix. */\n STARTS_WITH_REQUIRES_PREFIX: 'STARTS_WITH_REQUIRES_PREFIX',\n /**\n * A sort names at most one of the constraint's `fields`: they are\n * array-valued and the storage cannot order by two independent arrays.\n * Fields on one array path, one nested in the other, may still combine.\n * A sort that breaks it is refused with `PARALLEL_ARRAY_SORT`.\n */\n PARALLEL_ARRAY_SORT: 'PARALLEL_ARRAY_SORT',\n /**\n * On the constraint's `fields`, a stored `null` or empty array cannot be\n * told from a missing field: `EXISTS` does not match it, `NOT_EXISTS` and\n * `IS_NULL` do, and `IS_EMPTY` also matches a missing or `null` field. A\n * presence filter on such a field answers \"has a non-empty value\", not\n * \"has the key\"; say so to a user who writes one.\n */\n NULL_OR_EMPTY_AS_MISSING: 'NULL_OR_EMPTY_AS_MISSING',\n /**\n * Model-wide, without `fields`: `EQ` and `NE` take only a scalar operand,\n * because the storage cannot compare a whole array. Match an array\n * field's elements instead (`IN`, `CONTAINS_ALL`, `ELEMENT_MATCH`); an `EQ` or\n * `NE` with an array operand is refused with `ARRAY_EQUALITY`.\n */\n ARRAY_EQUALITY: 'ARRAY_EQUALITY',\n} as const);\n\n/** A constraint's type: one of {@link QueryConstraintTypes}, or one a server added. */\nexport type QueryConstraintType =\n | (typeof QueryConstraintTypes)[keyof typeof QueryConstraintTypes]\n | (string & {});\n\n/** A field that holds a calendar date. */\nexport interface TemporalDate {\n /** The discriminator. */\n type: 'TEMPORAL_DATE';\n}\n\n/** A field that holds a number of time units since the epoch. */\nexport interface TemporalEpoch {\n /** The discriminator. */\n type: 'TEMPORAL_EPOCH';\n /** The unit the number counts; milliseconds when absent. */\n timeUnit?: TimeUnit;\n}\n\n/** A field that holds a time written as text in a `java.time` pattern. */\nexport interface TemporalFormatted {\n /** The discriminator. */\n type: 'TEMPORAL_FORMATTED';\n /** The `java.time` pattern, such as `yyyy-MM-dd`. */\n pattern: string;\n}\n\n/**\n * A number field meant as a fixed-point decimal with `scale` fraction\n * digits: format and total it at that precision. Declared on the model\n * (`@QueryDecimal`), never inferred. Wow 9.2 and later.\n */\nexport interface NumericDecimal {\n /** The discriminator. */\n type: 'DECIMAL';\n /** The number of digits after the decimal point, 0 or more. */\n scale: number;\n}\n\n/**\n * A number field meant as an amount of money, in exactly one of a fixed\n * ISO 4217 `currency` or the currency held by the sibling string field\n * `currencyField` (a property of the same object or element). `scale` is\n * always sent: with a fixed currency the server resolves an omitted one to\n * that currency's standard fraction digits (2 for CNY, 0 for JPY).\n * Amounts in different currencies must not be totalled together. Declared\n * on the model (`@QueryMoney`), never inferred. Wow 9.2 and later.\n */\nexport type NumericMoney = {\n /** The discriminator. */\n type: 'MONEY';\n /** The number of digits after the decimal point, 0 or more. */\n scale: number;\n} & (\n | {\n /** The fixed ISO 4217 currency code, such as `CNY`. */\n currency: string;\n currencyField?: undefined;\n }\n | {\n currency?: undefined;\n /** The sibling property that holds each value's currency code. */\n currencyField: string;\n }\n);\n\n/**\n * A number field that is a length of time counted in `timeUnit`, such as a\n * timeout in seconds: format it as a duration. Declared on the model\n * (`@QueryDuration`), never inferred. Wow 9.2 and later.\n */\nexport interface DurationSemantic {\n /** The discriminator. */\n type: 'DURATION';\n /** The unit the number counts; always sent. */\n timeUnit: TimeUnit;\n}\n\n/**\n * A field whose value is the id of an aggregate, to look it up and link to\n * it: either a fixed aggregate, `contextName` and `aggregateName`, or per\n * record the aggregate the sibling string fields `contextNameField` and\n * `aggregateNameField` name (as in an `AggregateId`). The id is always the\n * aggregate's own. Declared on the model (`@QueryReference`), or inferred\n * for an `AggregateId`. Wow 9.2 and later.\n */\nexport type ReferenceSemantic = {\n /** The discriminator. */\n type: 'REFERENCE';\n} & (\n | {\n /** The referenced aggregate's bounded context. */\n contextName: string;\n /** The referenced aggregate's name. */\n aggregateName: string;\n contextNameField?: undefined;\n aggregateNameField?: undefined;\n }\n | {\n contextName?: undefined;\n aggregateName?: undefined;\n /** The sibling property that holds each value's bounded context. */\n contextNameField: string;\n /** The sibling property that holds each value's aggregate name. */\n aggregateNameField: string;\n }\n);\n\n/**\n * What a field's value means beyond its type, sent as its `semantic`: one\n * of the three temporal kinds, which the relative time filters (`TODAY`,\n * `RECENT_DAYS`, …) and date histograms need; one of the two numeric\n * formats, which say how a number is read and displayed; a duration; or a\n * reference to an aggregate. A field has one; an array field's is its\n * items'.\n *\n * The union grows in minor releases, as the server learns a semantic, and a\n * server newer than this client may send a `type` not listed here. The\n * descriptor is read as JSON, not parsed, so it arrives as it is: keep a\n * `default` branch in a `switch` over `type`, and treat a `type` you do not\n * know as no semantic at all. The union stays closed so that narrowing on\n * `type` still works.\n */\nexport type QuerySemanticType =\n | TemporalDate\n | TemporalEpoch\n | TemporalFormatted\n | NumericDecimal\n | NumericMoney\n | DurationSemantic\n | ReferenceSemantic;\n\n/** One declared value of an enum field, with its description when it has one. */\nexport interface EnumValueDescriptor {\n /** The value as it is stored and filtered by. */\n value: unknown;\n /**\n * What the value means, when the model describes it: set by the `enum`\n * entry of the model's declaration file.\n */\n description?: string;\n}\n\n/**\n * How much Wow protects a sensitive field's raw value, sent as its\n * `sensitivity.level`. Both levels mask the value in every query result;\n * they differ in what a query may do with the raw value.\n */\nexport enum SensitivityLevel {\n /**\n * Masked in results. Filters and paged sorts still compare the raw value,\n * unless the server turned that off; grouping, `ANY`, field metrics,\n * arithmetic references and cursor sorts are refused.\n */\n DISPLAY = 'DISPLAY',\n /**\n * Masked in results and never compared: no filter, sort, search, grouping\n * or metric may name it.\n */\n CONFIDENTIAL = 'CONFIDENTIAL',\n}\n\n/**\n * Why a field is deprecated. The field can still be queried, but new\n * queries and view definitions should avoid it.\n */\nexport interface QueryDeprecation {\n /** Why, or what to use instead; absent when the declaration gave no reason. */\n message?: string;\n}\n\n/** How a sensitive field is protected. */\nexport interface SensitivityDescriptor {\n /** How much its raw value is protected. */\n level: SensitivityLevel;\n /**\n * Whether filters and paged sorts may still compare its raw value: `false`\n * for {@link SensitivityLevel.CONFIDENTIAL}, and for\n * {@link SensitivityLevel.DISPLAY} when the server turned comparison off.\n * A field that is not comparable lists no filter operators, has\n * `sort.paged` `false` and is left out of `record.search`; naming it in a\n * filter, sort or search is refused with `PROTECTED_COMPARISON`.\n */\n comparable: boolean;\n}\n\n/** The filter operators a field admits. */\nexport interface FieldFilterDescriptor {\n /**\n * Each operator admitted on this field when used alone; empty when none,\n * as for a sensitive field that is not comparable.\n */\n operators: FilterOperator[];\n}\n\n/** Where a field may appear in a sort. */\nexport interface FieldSortDescriptor {\n /** In the sort of a list or paged query; never for a field that is not comparable. */\n paged: boolean;\n /** In the sort of a cursor query. */\n cursor: boolean;\n}\n\n/** How a field may be used in an aggregation. */\nexport interface FieldAggregateDescriptor {\n /**\n * The group types it may be grouped by; a time field lists both\n * `DATE_HISTOGRAM` and `DATE_PART`.\n */\n groups: (AggregationGroupType | (string & {}))[];\n /** Whether a terms group on it may set `missingKey`. */\n missingKey: boolean;\n /** The numeric functions (`SUM`, `AVG`, …) it may feed. */\n functions: (AggregationFunction | (string & {}))[];\n /** Whether it may feed a `DISTINCT_COUNT` metric. */\n distinctCount: boolean;\n /** Whether it may feed a `PERCENTILE` metric. */\n percentile: boolean;\n /** Whether it may feed an `ANY` metric. */\n any: boolean;\n /** Whether a `FIRST` or `LAST` metric may read its value. */\n firstLast: boolean;\n /** Whether it may appear in an arithmetic expression. */\n expressionInput: boolean;\n /** Whether a metric's filter may name it. */\n inMetricFilter: boolean;\n}\n\n/** One queryable field, by the logical path a query names it with. */\nexport interface FieldDescriptor {\n /** The logical path, such as `state.items.productId`. */\n path: string;\n /** The system role of a system field; absent on ordinary fields. */\n role?: QueryFieldRole;\n /** The value types it holds. */\n types: QueryValueType[];\n /** The structural shape of its value. */\n kind: QueryValueKind;\n /** Whether it may be `null`. */\n nullable: boolean;\n /** What its value means beyond its type; absent when nothing more. */\n semantic?: QuerySemanticType;\n /** Its declared values; never listed for a protected field. */\n enum?: EnumValueDescriptor[];\n /** Its description, when the model gives one. */\n description?: string;\n /** How it is protected; absent when it is not sensitive. */\n sensitivity?: SensitivityDescriptor;\n /** Whether a projection may select it. */\n project: boolean;\n /** The filter operators it admits. */\n filter: FieldFilterDescriptor;\n /** Where it may be sorted by. */\n sort: FieldSortDescriptor;\n /** How it may be aggregated; absent when it cannot be at all. */\n aggregate?: FieldAggregateDescriptor;\n /**\n * The element (array field) it lives in, by path; absent at the record\n * level. A filter on it goes inside `ELEMENT_MATCH` on that element.\n */\n scope?: string;\n /**\n * Set when the field is deprecated: still queryable, but new queries\n * should avoid it. An object, so it is truthy even without a message.\n */\n deprecated?: QueryDeprecation;\n /**\n * Other paths a query may name this field by, sorted; empty when none.\n * The server replaces an alias with `path` before it checks and runs a\n * query, so results, projections and errors use `path`, and an alias is\n * never listed as a field of its own. A variant's field lists them\n * relative to the element, like its `path`.\n */\n aliases: string[];\n}\n\n/** An array field whose elements can be filtered or aggregated one by one. */\nexport interface ElementDescriptor {\n /** The array field's logical path. */\n path: string;\n /** Whether `ELEMENT_MATCH` may filter its elements. */\n filter: boolean;\n /** Whether an aggregation may run over its elements. */\n aggregate: boolean;\n /**\n * Full-text search on its fields: a `SEARCH` that names them, relative\n * to the element, inside an `ELEMENT_MATCH` on it. Absent when the\n * storage can search none of them, as on MongoDB.\n */\n search?: SearchDescriptor;\n}\n\n/**\n * The fields under a map's dynamic keys, written with `{key}` in place of\n * the key: any key matches, except those in `excludedKeys`. Each pattern\n * has one entry, resolved as the server resolves a concrete key: a pattern\n * whose values are arrays is one `ARRAY` entry, its items implicit.\n */\nexport interface DynamicFieldDescriptor {\n /** The path pattern, such as `state.attributes.{key}`. */\n pattern: string;\n /** The value types they hold. */\n types: QueryValueType[];\n /** The structural shape of their values. */\n kind: QueryValueKind;\n /** The filter operators they admit. */\n filter: FieldFilterDescriptor;\n /**\n * The map's keys that are declared as fields of their own and so are not\n * covered by this pattern; absent when there are none. For\n * `state.attributes.{key}` with `state.attributes.color` declared, it is\n * `['color']`: a filter on `state.attributes.color` takes that field's\n * entry in `fields`, with its own operators, not this pattern's.\n */\n excludedKeys?: string[];\n}\n\n/**\n * Full-text search in one scope: the record's (`record.search`) or an\n * element's (`elements[].search`).\n */\nexport interface SearchDescriptor {\n /**\n * For the record, the modes of a model-wide `SEARCH` (without fields);\n * empty when one of its fields is not comparable, since a search across\n * the model would match that field. For an element, the modes every\n * listed field accepts.\n */\n modes: SearchMode[];\n /**\n * The fields a `SEARCH` may name, by full logical path; never one that is\n * not comparable. For the record, only record-level fields, never one\n * inside an element; for an element, its own fields, which the query\n * writes relative to the element.\n */\n fields: string[];\n}\n\n/** What holds for the model's records as a whole. */\nexport interface RecordDescriptor {\n /** The logical path of the field that identifies a record. */\n identity: string;\n /** The ways the model can be read page by page. */\n paging: PagingMode[];\n /** The deletion scope a query without one gets; absent when the model has none. */\n defaultScope?: DeletionState;\n /**\n * Operators that name no field of their own: the system-field ones, such\n * as `ID` or `TENANT_ID`, and `EXPRESSION`, whose expression names its\n * fields, where the server allows expensive operators.\n */\n rootOperators: FilterOperator[];\n /** Model-wide full-text search; absent when the model offers none. */\n search?: SearchDescriptor;\n}\n\n/** The fixed limits of an aggregation query. */\nexport interface AggregationLimitsDescriptor {\n /** Most groups in `groupBy`. */\n maxGroups: number;\n /** Most metrics. */\n maxMetrics: number;\n /** Most elements an aggregation runs over. */\n maxElements: number;\n /** Largest `limit` on the result rows. */\n maxLimit: number;\n /** Deepest arithmetic expression. */\n maxExpressionDepth: number;\n /** Most nodes in one arithmetic expression. */\n maxExpressionNodes: number;\n}\n\n/**\n * The effective limits of the entry the descriptor was read from: the\n * protocol's and the entry's budget, whichever is smaller. `null` is\n * unlimited.\n */\nexport interface LimitsDescriptor {\n /** Largest `limit` of a list query. */\n maxListSize: number | null;\n /** The `limit` a list query without one gets. */\n defaultListSize: number | null;\n /** Largest page `size` of a paged or cursor query. */\n maxPageSize: number | null;\n /** How far a paged query may reach: page index times size. */\n maxPageWindow: number | null;\n /** Most nodes in one filter. */\n maxFilterNodes: number | null;\n /** Most values in one filter, `IN` lists included. */\n maxFilterValues: number | null;\n /** Most fields in one sort. */\n maxSortFields: number;\n /** The limits of an aggregation query. */\n aggregation: AggregationLimitsDescriptor;\n}\n\n/** The metrics a `having` clause may test. */\nexport interface HavingDescriptor {\n /** The metric types it may name; never `ANY`, `FIRST` or `LAST`. */\n metrics: (AggregationMetricType | (string & {}))[];\n}\n\n/** What an aggregation's result rows may be sorted by. */\nexport interface AnalysisSortDescriptor {\n /** By a group. */\n groups: boolean;\n /** By a metric. */\n metrics: boolean;\n}\n\n/** The aggregation features the model offers. */\nexport interface AnalysisDescriptor {\n /** The metric types it admits. */\n metrics: (AggregationMetricType | (string & {}))[];\n /**\n * The metric types among `metrics` whose results this backend estimates\n * rather than computes exactly, such as `PERCENTILE` on MongoDB, or\n * `DISTINCT_COUNT` and `PERCENTILE` on Elasticsearch; empty when every\n * result is exact. The set is open, like `metrics`: label a result of a\n * listed type as approximate.\n */\n approximate: (AggregationMetricType | (string & {}))[];\n /**\n * Whether computed expressions (arithmetic and `DATE_DIFF`) may feed\n * metrics and TERMS / HISTOGRAM groups, and be compared by an `EXPRESSION`\n * filter. A `DATE_DIFF` operand is any field whose `aggregate.groups`\n * lists `DATE_HISTOGRAM`.\n */\n expressions: boolean;\n /** What `having` may test. */\n having: HavingDescriptor;\n /** What result rows may be sorted by. */\n sort: AnalysisSortDescriptor;\n /**\n * Whether a date histogram or a date part group may fill its empty\n * buckets (`dense`).\n */\n dense: boolean;\n /** The calendar units a `DATE_HISTOGRAM` group may bucket by. */\n dateUnits: AggregationDateUnit[];\n /** The calendar parts a `DATE_PART` group may group by. */\n dateParts: AggregationDatePart[];\n /** The units a `DATE_DIFF` may measure in; empty when `expressions` is `false`. */\n dateDiffUnits: DateDiffUnit[];\n /**\n * The field `FIRST` and `LAST` order by when they name no `orderBy`, at\n * the record level: the model's event time. Absent when the model has no\n * event time or the storage offers no `FIRST` / `LAST`. An explicit\n * `orderBy` may be any single-valued field whose `sort.paged` is `true` in\n * the metric's scope.\n */\n firstLastOrderBy?: string;\n}\n\n/** A rule about combinations that no single capability shows. */\nexport interface ConstraintDescriptor {\n /** Which rule; see {@link QueryConstraintTypes}. */\n type: QueryConstraintType;\n /** For `CURSOR_UNIQUE_SORT`, the field the server appends to the sort. */\n appended?: string;\n /**\n * The fields the rule is about, when it names several: for\n * `PARALLEL_ARRAY_SORT`, the array fields a sort may name only one of;\n * for `NULL_OR_EMPTY_AS_MISSING`, the fields whose `null` or empty value\n * reads as missing.\n */\n fields?: string[];\n}\n\n/**\n * One variant of an element: the value of its discriminator and the fields\n * that variant has. For an event stream, one event type and its payload\n * fields.\n */\nexport interface VariantDescriptor {\n /** The discriminator's value, such as the event's `bodyType`. */\n value: string;\n /**\n * The variant's fields, by paths relative to the element, such as\n * `body.added.productId` inside `body`. Each field states the variant's\n * own types; its operators, sorts and aggregation are those of the shared\n * logical path, which admission checks. A field's `scope` is relative to\n * the element too, and absent for a field directly in it.\n */\n fields: FieldDescriptor[];\n /** What the variant means, when the model describes it. */\n description?: string;\n}\n\n/**\n * An element of every record whose fields differ by variant: an event\n * stream record's `body` holds events whose payload fields depend on\n * `bodyType`. A condition on one variant's field goes inside an\n * `ELEMENT_MATCH` on `element`, together with a condition on the\n * `discriminator`, so both hold for the same element.\n */\nexport interface VariantsDescriptor {\n /** The element's logical path, such as `body`. */\n element: string;\n /** The element-relative field that names each element's variant, such as `bodyType`. */\n discriminator: string;\n /** Each variant, sorted by `value`. */\n values: VariantDescriptor[];\n}\n\n/**\n * How a query model can be queried over HTTP: the answer\n * `GET {aggregate}/snapshot/schema` and `GET {aggregate}/event/schema` give.\n * Read it with `QueryDescriptorClient`.\n *\n * The contract: every operator, sort, paging mode, group and function it\n * lists is admitted when used on its own, and anything it does not list is\n * rejected; `constraints` names the rules about combinations. A value, a\n * scope or a policy can still reject a query, with a\n * `QueryViolation`. It exposes no storage names and does not depend on\n * the caller, so it can be cached: `version` is a hash of its content and is\n * also the response's ETag.\n */\nexport interface QueryModelDescriptor {\n /** The query model it describes. */\n model: QueryModel;\n /** `sha256:` and the hash of its content; also the ETag, quoted. */\n version: string;\n /** The server's default time zone, used when a request names none. */\n timeZone: string;\n /** What holds for the records as a whole. */\n record: RecordDescriptor;\n /** The entry's effective limits. */\n limits: LimitsDescriptor;\n /** The aggregation features. */\n analysis: AnalysisDescriptor;\n /** Every queryable field, those inside elements included (see `scope`). */\n fields: FieldDescriptor[];\n /** The array fields whose elements can be queried one by one. */\n elements: ElementDescriptor[];\n /** Fields under dynamic map keys. */\n dynamic: DynamicFieldDescriptor[];\n /** The rules about combinations. */\n constraints: ConstraintDescriptor[];\n /**\n * The variants of an element whose fields differ by a discriminator, such\n * as an event stream's event types; absent when the model has none, as a\n * snapshot model never does.\n */\n variants?: VariantsDescriptor;\n}\n"],"mappings":";AAsCA,IAAaA,IAAc,OAAO,OAAO;CAEvC,UAAU;CAEV,cAAc;AAChB,CAAU,GAUGC,IAAkB,OAAO,OAAO;CAE3C,QAAQ;CAER,SAAS;CAET,SAAS;CAET,SAAS;CAET,QAAQ;AACV,CAAU,GAOEC,IAAL,yBAAA,GAAA;QAEL,EAAAC,UAAA,WAEA,EAAAC,OAAA,QAEA,EAAAC,SAAA,UAEA,EAAAC,SAAA,UAEA,EAAAC,QAAA,SAEA,EAAAC,QAAA;AACF,EAAA,CAAA,CAAA,GAGYC,IAAL,yBAAA,GAAA;QAEL,EAAAC,OAAA,QAEA,EAAAC,QAAA,SAEA,EAAAC,SAAA;AACF,EAAA,CAAA,CAAA,GAOaC,IAAkB,OAAO,OAAO;CAE3C,UAAU;CAEV,cAAc;CAEd,WAAW;CAEX,UAAU;CAEV,UAAU;CAEV,SAAS;CAMT,YAAY;CAKZ,kBAAkB;AACpB,CAAU,GAUGC,IAAuB,OAAO,OAAO;CAKhD,oBAAoB;CAEpB,uBAAuB;CAEvB,6BAA6B;CAO7B,qBAAqB;CAQrB,0BAA0B;CAO1B,gBAAgB;AAClB,CAAU,GAsJEC,IAAL,yBAAA,GAAA;QAML,EAAAC,UAAA,WAKA,EAAAC,eAAA;AACF,EAAA,CAAA,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A JSON object whose shape the types do not know; Wow's `DynamicDocument`.
3
+ * It is the default row of `QueryApi.aggregate`, keyed by the aliases of the
4
+ * query's groups and metrics.
5
+ */
6
+ export type DynamicDocument = Record<string, unknown>;
7
+ /** A list of {@link DynamicDocument} rows. */
8
+ export type DynamicDocumentArray = DynamicDocument[];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A JSON object whose shape the types do not know; Wow's `DynamicDocument`.
3
+ * It is the default row of `QueryApi.aggregate`, keyed by the aliases of the
4
+ * query's groups and metrics.
5
+ */
6
+ export type DynamicDocument = Record<string, unknown>;
7
+ /** A list of {@link DynamicDocument} rows. */
8
+ export type DynamicDocumentArray = DynamicDocument[];
@@ -0,0 +1,2 @@
1
+ var e=/^@?[A-Za-z_][A-Za-z0-9_-]*(\.(?:@?[A-Za-z_][A-Za-z0-9_-]*|[0-9]+))*$/;function t(t){if(typeof t!=`string`||!e.test(t))throw TypeError(`Query field is invalid: [${String(t)}].`);return t}exports.queryField=t;
2
+ //# sourceMappingURL=field.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.cjs","names":["QUERY_FIELD_PATTERN","queryField","field"],"sources":["../../src/dsl/field.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Wow's `QueryField` pattern, shared by every place that names a path.\n *\n * Internal on purpose: no entry re-exports this module, so the\n * validator stays an implementation detail rather than becoming public API\n * that has to be documented and kept. A filter, a sort and a projection all\n * hold paths, and Kotlin wraps all three in `QueryField`, so they agree here\n * rather than each inventing its own idea of a path.\n */\nconst QUERY_FIELD_PATTERN =\n /^@?[A-Za-z_][A-Za-z0-9_-]*(\\.(?:@?[A-Za-z_][A-Za-z0-9_-]*|[0-9]+))*$/;\n\n/** Admits a field path, the way `QueryField`'s `init` does. */\nexport function queryField<FIELDS extends string>(field: FIELDS): FIELDS {\n if (typeof field !== 'string' || !QUERY_FIELD_PATTERN.test(field)) {\n throw new TypeError(`Query field is invalid: [${String(field)}].`);\n }\n return field;\n}\n"],"mappings":"AAsBA,IAAMA,EACJ,uEAGF,SAAgBC,EAAkC,EAAuB,CACvE,GAAI,OAAOC,GAAU,UAAY,CAACF,EAAoB,KAAKE,CAAK,EAC9D,MAAU,UAAU,4BAA4B,OAAOA,CAAK,EAAE,GAAG,EAEnE,OAAOA,CACT"}
@@ -0,0 +1,2 @@
1
+ /** Admits a field path, the way `QueryField`'s `init` does. */
2
+ export declare function queryField<FIELDS extends string>(field: FIELDS): FIELDS;
@@ -0,0 +1,2 @@
1
+ /** Admits a field path, the way `QueryField`'s `init` does. */
2
+ export declare function queryField<FIELDS extends string>(field: FIELDS): FIELDS;
@@ -0,0 +1,10 @@
1
+ //#region src/dsl/field.ts
2
+ var e = /^@?[A-Za-z_][A-Za-z0-9_-]*(\.(?:@?[A-Za-z_][A-Za-z0-9_-]*|[0-9]+))*$/;
3
+ function t(t) {
4
+ if (typeof t != "string" || !e.test(t)) throw TypeError(`Query field is invalid: [${String(t)}].`);
5
+ return t;
6
+ }
7
+ //#endregion
8
+ export { t as queryField };
9
+
10
+ //# sourceMappingURL=field.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.es.js","names":["QUERY_FIELD_PATTERN","queryField","field"],"sources":["../../src/dsl/field.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Wow's `QueryField` pattern, shared by every place that names a path.\n *\n * Internal on purpose: no entry re-exports this module, so the\n * validator stays an implementation detail rather than becoming public API\n * that has to be documented and kept. A filter, a sort and a projection all\n * hold paths, and Kotlin wraps all three in `QueryField`, so they agree here\n * rather than each inventing its own idea of a path.\n */\nconst QUERY_FIELD_PATTERN =\n /^@?[A-Za-z_][A-Za-z0-9_-]*(\\.(?:@?[A-Za-z_][A-Za-z0-9_-]*|[0-9]+))*$/;\n\n/** Admits a field path, the way `QueryField`'s `init` does. */\nexport function queryField<FIELDS extends string>(field: FIELDS): FIELDS {\n if (typeof field !== 'string' || !QUERY_FIELD_PATTERN.test(field)) {\n throw new TypeError(`Query field is invalid: [${String(field)}].`);\n }\n return field;\n}\n"],"mappings":";AAsBA,IAAMA,IACJ;AAGF,SAAgBC,EAAkC,GAAuB;CACvE,IAAI,OAAOC,KAAU,YAAY,CAACF,EAAoB,KAAKE,CAAK,GAC9D,MAAU,UAAU,4BAA4B,OAAOA,CAAK,EAAE,GAAG;CAEnE,OAAOA;AACT"}
@@ -0,0 +1,2 @@
1
+ const e=require("./operator.cjs"),t=require("../aggregation/types.cjs"),n=require("../aggregation/expressionTrees.cjs"),r=require("../deletionState.cjs"),i=require("../field.cjs"),a=require("./scope.cjs"),o=require("./validate.cjs");function s(e,t){return{op:e,value:o.requiredString(`${e} value`,t)}}function c(e,t){return o.requireNonEmpty(`${e} values`,t),t.forEach(t=>o.requiredString(`${e} value`,t)),{op:e,values:[...t]}}function l(e,t){return o.requireNonEmpty(`${e} operands`,t),{op:e,operands:[...t]}}function u(e,t,n){return{op:e,field:i.queryField(t),value:o.filterLiteral(n,!0)}}function d(e,t,n){return{op:e,field:i.queryField(t),value:o.filterLiteral(n,!1)}}function f(e,t,n,r){return o.validateStringComparison(r),{op:e,field:i.queryField(t),value:o.requiredString(`${e} value`,n),stringComparison:r}}function p(e,t,n){return o.requireNonEmpty(`${e} values`,n),n.forEach(e=>o.filterLiteral(e,!1)),{op:e,field:i.queryField(t),values:[...n]}}function m(e,t){return{op:e,field:i.queryField(t)}}function h(e,t,n){return{...o.validateRelativeTimeOptions(n),op:e,field:i.queryField(t)}}function g(e,t,n,r){return o.validateDays(e,n),{...o.validateRelativeTimeOptions(r),op:e,field:i.queryField(t),days:n}}function _(e,t,n,r){return o.requireDuration(e,n),{...o.validateRelativeTimeOptions(r),op:e,field:i.queryField(t),offset:n}}function v(t){return l(e.FilterOperator.AND,t)}function y(t){return l(e.FilterOperator.OR,t)}function b(t){return l(e.FilterOperator.NOR,t)}function x(t,n){if(typeof t!=`string`||!t.trim())throw TypeError(`SEARCH query cannot be blank.`);if(n!==void 0&&(typeof n!=`object`||!n||Array.isArray(n)))throw TypeError(`SEARCH options must be a non-null object.`);let{fields:r=[],mode:a=e.SearchMode.TERMS}=n??{};if(!Object.values(e.SearchMode).includes(a))throw TypeError(`SEARCH mode is invalid: [${String(a)}].`);return{op:e.FilterOperator.SEARCH,query:t,mode:a,fields:r.map(i.queryField)}}var S={matchAll(){return{op:e.FilterOperator.MATCH_ALL}},matchNone(){return{op:e.FilterOperator.MATCH_NONE}},id(t){return s(e.FilterOperator.ID,t)},ids(t){return c(e.FilterOperator.IDS,t)},aggregateId(t){return s(e.FilterOperator.AGGREGATE_ID,t)},aggregateIds(t){return c(e.FilterOperator.AGGREGATE_IDS,t)},tenantId(t){return s(e.FilterOperator.TENANT_ID,t)},ownerId(t){return s(e.FilterOperator.OWNER_ID,t)},spaceId(t){return s(e.FilterOperator.SPACE_ID,t)},and:v,or:y,nor:b,eq(t,n){return u(e.FilterOperator.EQ,t,n)},ne(t,n){return u(e.FilterOperator.NE,t,n)},gt(t,n){return d(e.FilterOperator.GT,t,n)},gte(t,n){return d(e.FilterOperator.GTE,t,n)},lt(t,n){return d(e.FilterOperator.LT,t,n)},lte(t,n){return d(e.FilterOperator.LTE,t,n)},contains(t,n,r=e.StringComparison.CASE_SENSITIVE){return f(e.FilterOperator.CONTAINS,t,n,r)},startsWith(t,n,r=e.StringComparison.CASE_SENSITIVE){return f(e.FilterOperator.STARTS_WITH,t,n,r)},endsWith(t,n,r=e.StringComparison.CASE_SENSITIVE){return f(e.FilterOperator.ENDS_WITH,t,n,r)},isIn(t,n){return p(e.FilterOperator.IN,t,n)},notIn(t,n){return p(e.FilterOperator.NOT_IN,t,n)},containsAll(t,n){return p(e.FilterOperator.CONTAINS_ALL,t,n)},between(t,n,r){return{op:e.FilterOperator.BETWEEN,field:i.queryField(t),lowerBound:o.filterLiteral(n,!1),upperBound:o.filterLiteral(r,!1)}},isEmpty(t){return m(e.FilterOperator.IS_EMPTY,t)},isEmptyString(t){return m(e.FilterOperator.IS_EMPTY_STRING,t)},isNotEmptyString(t){return m(e.FilterOperator.IS_NOT_EMPTY_STRING,t)},isNull(t){return m(e.FilterOperator.IS_NULL,t)},isNotNull(t){return m(e.FilterOperator.IS_NOT_NULL,t)},exists(t){return m(e.FilterOperator.EXISTS,t)},notExists(t){return m(e.FilterOperator.NOT_EXISTS,t)},deletion(t){if(t!==r.DeletionState.ACTIVE&&t!==r.DeletionState.DELETED&&t!==r.DeletionState.ALL)throw TypeError(`Deletion state is invalid: [${String(t)}].`);return{op:e.FilterOperator.DELETION,state:t}},elementMatch(t,n){return a.requireElementScopedFilter(n,`ELEMENT_MATCH predicate`),{op:e.FilterOperator.ELEMENT_MATCH,field:i.queryField(t),predicate:n}},search:x,today(t,n={}){return h(e.FilterOperator.TODAY,t,n)},beforeToday(t,n,r={}){let a=o.requireLocalTime(n);return{...o.validateRelativeTimeOptions(r),op:e.FilterOperator.BEFORE_TODAY,field:i.queryField(t),time:a}},tomorrow(t,n={}){return h(e.FilterOperator.TOMORROW,t,n)},thisWeek(t,n={}){return h(e.FilterOperator.THIS_WEEK,t,n)},nextWeek(t,n={}){return h(e.FilterOperator.NEXT_WEEK,t,n)},lastWeek(t,n={}){return h(e.FilterOperator.LAST_WEEK,t,n)},thisMonth(t,n={}){return h(e.FilterOperator.THIS_MONTH,t,n)},lastMonth(t,n={}){return h(e.FilterOperator.LAST_MONTH,t,n)},yesterday(t,n={}){return h(e.FilterOperator.YESTERDAY,t,n)},nextMonth(t,n={}){return h(e.FilterOperator.NEXT_MONTH,t,n)},lastYear(t,n={}){return h(e.FilterOperator.LAST_YEAR,t,n)},thisYear(t,n={}){return h(e.FilterOperator.THIS_YEAR,t,n)},nextYear(t,n={}){return h(e.FilterOperator.NEXT_YEAR,t,n)},recentDays(t,n,r={}){return g(e.FilterOperator.RECENT_DAYS,t,n,r)},earlierDays(t,n,r={}){return g(e.FilterOperator.EARLIER_DAYS,t,n,r)},beforeNow(t,n=`PT0S`,r={}){return _(e.FilterOperator.BEFORE_NOW,t,n,r)},afterNow(t,n=`PT0S`,r={}){return _(e.FilterOperator.AFTER_NOW,t,n,r)},expression(r,i,a){if(!Number.isFinite(a))throw TypeError(`EXPRESSION value must be finite.`);if(!Object.values(t.ComparisonOperator).includes(i))throw TypeError(`EXPRESSION comparison is invalid: [${String(i)}].`);if(n.expressionFields(r).length===0)throw TypeError(`EXPRESSION must read at least one field.`);return n.requireValidExpressionTrees([r]),{op:e.FilterOperator.EXPRESSION,expression:r,comparison:i,value:a}}};exports.filter=S;
2
+ //# sourceMappingURL=builders.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builders.cjs","names":["requiredString","queryField","filterLiteral","validateRelativeTimeOptions","FilterOperator","SearchMode","StringComparison","DeletionState","requireLocalTime","ComparisonOperator","expressionFields","require_operator","require_types","require_expressionTrees","require_deletionState","require_field","require_scope","require_validate","metadataValue","op","value","metadataValues","values","logical","operands","equality","field","comparison","stringMatch","stringComparison","collection","presence","calendar","options","dayWindow","days","nowRelative","offset","andFilter","orFilter","norFilter","search","query","mode","fields","filter","lowerBound","upperBound","state","predicate","localTime","time","expression"],"sources":["../../../src/dsl/filter/builders.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n expressionFields,\n requireValidExpressionTrees,\n} from '../aggregation/expressionTrees.js';\nimport {\n ComparisonOperator,\n type AggregationExpression,\n} from '../aggregation/types.js';\nimport { DeletionState } from '../deletionState.js';\nimport { queryField } from '../field.js';\nimport { FilterOperator, SearchMode, StringComparison } from './operator.js';\nimport { requireElementScopedFilter } from './scope.js';\nimport type {\n BeforeTodayFilter,\n BetweenFilter,\n CalendarFilter,\n CollectionFilter,\n ComparableFilterLiteral,\n ComparisonFilter,\n DaysFilter,\n DeletionFilter,\n ElementFilterExpression,\n ElementLogicalFilter,\n ElementMatchFilter,\n EqualityFilter,\n EqualityFilterValue,\n FieldPresenceFilter,\n FilterExpression,\n LogicalFilter,\n MatchFilter,\n MetadataValueFilter,\n MetadataValuesFilter,\n NowFilter,\n RelativeTimeFilterOptions,\n SearchFilter,\n SearchFilterOptions,\n StringFilter,\n ElementSearchFilter,\n QueryField,\n ExpressionFilter,\n} from './types.js';\nimport {\n filterLiteral,\n requireLocalTime,\n requireDuration,\n requireNonEmpty,\n requiredString,\n validateDays,\n validateRelativeTimeOptions,\n validateStringComparison,\n} from './validate.js';\n\n// One builder per filter shape, keyed by the operator. Each shape's public\n// builders below differ only in the operator they pass, so a new operator of\n// an existing shape is one enum member, one type-union member and one line\n// here; its JSDoc goes on the public builder, where the IDE shows it.\n\nfunction metadataValue(\n op: MetadataValueFilter['op'],\n value: string,\n): MetadataValueFilter {\n return { op, value: requiredString(`${op} value`, value) };\n}\n\nfunction metadataValues(\n op: MetadataValuesFilter['op'],\n values: readonly string[],\n): MetadataValuesFilter {\n requireNonEmpty(`${op} values`, values);\n values.forEach(value => requiredString(`${op} value`, value));\n return { op, values: [...values] };\n}\n\nfunction logical<FIELDS extends string>(\n op: LogicalFilter['op'],\n operands: readonly FilterExpression<FIELDS>[],\n): LogicalFilter<FIELDS> {\n requireNonEmpty(`${op} operands`, operands);\n return { op, operands: [...operands] };\n}\n\nfunction equality<FIELDS extends string>(\n op: EqualityFilter['op'],\n field: FIELDS,\n value: EqualityFilterValue,\n): EqualityFilter<FIELDS> {\n return { op, field: queryField(field), value: filterLiteral(value, true) };\n}\n\nfunction comparison<FIELDS extends string>(\n op: ComparisonFilter['op'],\n field: FIELDS,\n value: ComparableFilterLiteral,\n): ComparisonFilter<FIELDS> {\n return { op, field: queryField(field), value: filterLiteral(value, false) };\n}\n\nfunction stringMatch<FIELDS extends string>(\n op: StringFilter['op'],\n field: FIELDS,\n value: string,\n stringComparison: StringComparison,\n): StringFilter<FIELDS> {\n validateStringComparison(stringComparison);\n return {\n op,\n field: queryField(field),\n value: requiredString(`${op} value`, value),\n stringComparison,\n };\n}\n\nfunction collection<FIELDS extends string>(\n op: CollectionFilter['op'],\n field: FIELDS,\n values: readonly ComparableFilterLiteral[],\n): CollectionFilter<FIELDS> {\n requireNonEmpty(`${op} values`, values);\n values.forEach(value => filterLiteral(value, false));\n return { op, field: queryField(field), values: [...values] };\n}\n\nfunction presence<FIELDS extends string>(\n op: FieldPresenceFilter['op'],\n field: FIELDS,\n): FieldPresenceFilter<FIELDS> {\n return { op, field: queryField(field) };\n}\n\nfunction calendar<FIELDS extends string>(\n op: CalendarFilter['op'],\n field: FIELDS,\n options: RelativeTimeFilterOptions,\n): CalendarFilter<FIELDS> {\n return {\n ...validateRelativeTimeOptions(options),\n op,\n field: queryField(field),\n };\n}\n\nfunction dayWindow<FIELDS extends string>(\n op: DaysFilter['op'],\n field: FIELDS,\n days: number,\n options: RelativeTimeFilterOptions,\n): DaysFilter<FIELDS> {\n validateDays(op, days);\n return {\n ...validateRelativeTimeOptions(options),\n op,\n field: queryField(field),\n days,\n };\n}\n\nfunction nowRelative<FIELDS extends string>(\n op: NowFilter['op'],\n field: FIELDS,\n offset: string,\n options: RelativeTimeFilterOptions,\n): NowFilter<FIELDS> {\n requireDuration(op, offset);\n return {\n ...validateRelativeTimeOptions(options),\n op,\n field: queryField(field),\n offset,\n };\n}\n\n/**\n * `filter.and`: matches when all of `operands` match. With element-scoped\n * operands only, the result is element-scoped too, so it can be an\n * `ELEMENT_MATCH` predicate.\n */\nfunction andFilter<FIELDS extends string>(\n operands: readonly ElementFilterExpression<FIELDS>[],\n): ElementLogicalFilter<FIELDS>;\n/** `filter.and`: matches when all of `operands` match. */\nfunction andFilter<FIELDS extends string>(\n operands: readonly FilterExpression<FIELDS>[],\n): LogicalFilter<FIELDS>;\nfunction andFilter<FIELDS extends string>(\n operands: readonly FilterExpression<FIELDS>[],\n): LogicalFilter<FIELDS> {\n return logical(FilterOperator.AND, operands);\n}\n\n/**\n * `filter.or`: matches when at least one of `operands` matches. With\n * element-scoped operands only, the result is element-scoped too, so it can\n * be an `ELEMENT_MATCH` predicate.\n */\nfunction orFilter<FIELDS extends string>(\n operands: readonly ElementFilterExpression<FIELDS>[],\n): ElementLogicalFilter<FIELDS>;\n/** `filter.or`: matches when at least one of `operands` matches. */\nfunction orFilter<FIELDS extends string>(\n operands: readonly FilterExpression<FIELDS>[],\n): LogicalFilter<FIELDS>;\nfunction orFilter<FIELDS extends string>(\n operands: readonly FilterExpression<FIELDS>[],\n): LogicalFilter<FIELDS> {\n return logical(FilterOperator.OR, operands);\n}\n\n/**\n * `filter.nor`: matches when none of `operands` match. With element-scoped\n * operands only, the result is element-scoped too, so it can be an\n * `ELEMENT_MATCH` predicate.\n */\nfunction norFilter<FIELDS extends string>(\n operands: readonly ElementFilterExpression<FIELDS>[],\n): ElementLogicalFilter<FIELDS>;\n/** `filter.nor`: matches when none of `operands` match. */\nfunction norFilter<FIELDS extends string>(\n operands: readonly FilterExpression<FIELDS>[],\n): LogicalFilter<FIELDS>;\nfunction norFilter<FIELDS extends string>(\n operands: readonly FilterExpression<FIELDS>[],\n): LogicalFilter<FIELDS> {\n return logical(FilterOperator.NOR, operands);\n}\n\n/**\n * The overloads of {@link filter.search}: naming at least one field, as an\n * array literal, types the result as an {@link ElementSearchFilter}, which\n * `ELEMENT_MATCH` takes; otherwise it is a {@link SearchFilter}, root-only\n * when its `fields` are empty.\n */\nexport interface SearchBuilder {\n <FIELDS extends string>(\n query: string,\n options: SearchFilterOptions<FIELDS> & {\n fields: readonly [QueryField<FIELDS>, ...QueryField<FIELDS>[]];\n },\n ): ElementSearchFilter<FIELDS>;\n <FIELDS extends string>(\n query: string,\n options?: SearchFilterOptions<FIELDS>,\n ): SearchFilter<FIELDS>;\n}\n\nfunction search<FIELDS extends string>(\n query: string,\n options?: SearchFilterOptions<FIELDS>,\n): SearchFilter<FIELDS> {\n if (typeof query !== 'string' || !query.trim()) {\n throw new TypeError('SEARCH query cannot be blank.');\n }\n if (\n options !== undefined &&\n (options === null || typeof options !== 'object' || Array.isArray(options))\n ) {\n throw new TypeError('SEARCH options must be a non-null object.');\n }\n const { fields = [], mode = SearchMode.TERMS } = options ?? {};\n if (!Object.values(SearchMode).includes(mode)) {\n throw new TypeError(`SEARCH mode is invalid: [${String(mode)}].`);\n }\n return {\n op: FilterOperator.SEARCH,\n query,\n mode,\n fields: fields.map(queryField),\n };\n}\n\n/**\n * Builders for {@link FilterExpression} values. Each builder validates its\n * arguments, throws `TypeError` on invalid input, and returns a plain JSON\n * object in the server wire shape.\n *\n * @example\n * ```typescript\n * const paid = filter.and([\n * filter.eq('state.status', 'PAID'),\n * filter.gte('state.total', 100),\n * ]);\n * ```\n */\nexport const filter = {\n /**\n * Matches every record in the query scope.\n *\n * @returns `{ op: 'MATCH_ALL' }`.\n * @example\n * ```typescript\n * filter.matchAll();\n * ```\n */\n matchAll(): MatchFilter {\n return { op: FilterOperator.MATCH_ALL };\n },\n /**\n * Matches no record.\n *\n * @returns `{ op: 'MATCH_NONE' }`.\n * @example\n * ```typescript\n * filter.matchNone();\n * ```\n */\n matchNone(): MatchFilter {\n return { op: FilterOperator.MATCH_NONE };\n },\n /**\n * Matches the record whose record ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The record ID.\n * @returns `{ op: 'ID', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.id('order-1');\n * ```\n */\n id(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.ID, value);\n },\n /**\n * Matches records whose record ID is one of `values`. Root-only: not\n * allowed inside `elementMatch`.\n *\n * @param values - Non-empty list of record IDs.\n * @returns `{ op: 'IDS', values }` with a copy of `values`.\n * @throws TypeError If `values` is empty, contains `null` or `undefined`,\n * or contains a non-string.\n * @example\n * ```typescript\n * filter.ids(['order-1', 'order-2']);\n * ```\n */\n ids(values: readonly string[]): MetadataValuesFilter {\n return metadataValues(FilterOperator.IDS, values);\n },\n /**\n * Matches the record whose aggregate ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The aggregate ID.\n * @returns `{ op: 'AGGREGATE_ID', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.aggregateId('order-1');\n * ```\n */\n aggregateId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.AGGREGATE_ID, value);\n },\n /**\n * Matches records whose aggregate ID is one of `values`. Root-only: not\n * allowed inside `elementMatch`.\n *\n * @param values - Non-empty list of aggregate IDs.\n * @returns `{ op: 'AGGREGATE_IDS', values }` with a copy of `values`.\n * @throws TypeError If `values` is empty, contains `null` or `undefined`,\n * or contains a non-string.\n * @example\n * ```typescript\n * filter.aggregateIds(['order-1', 'order-2']);\n * ```\n */\n aggregateIds(values: readonly string[]): MetadataValuesFilter {\n return metadataValues(FilterOperator.AGGREGATE_IDS, values);\n },\n /**\n * Matches the record whose tenant ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The tenant ID.\n * @returns `{ op: 'TENANT_ID', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.tenantId('tenant-a');\n * ```\n */\n tenantId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.TENANT_ID, value);\n },\n /**\n * Matches the record whose owner ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The owner ID.\n * @returns `{ op: 'OWNER_ID', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.ownerId('user-1');\n * ```\n */\n ownerId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.OWNER_ID, value);\n },\n /**\n * Matches the record whose space ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The space ID.\n * @returns `{ op: 'SPACE_ID', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.spaceId('space-1');\n * ```\n */\n spaceId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.SPACE_ID, value);\n },\n /**\n * Matches when all of `operands` match. Returns an element-scoped\n * filter when every operand is element-scoped, so the result can be used\n * inside `elementMatch`.\n *\n * @param operands - Non-empty list of filter expressions.\n * @returns `{ op: 'AND', operands }` with a copy of `operands`.\n * @throws TypeError If `operands` is empty or contains `null` or\n * `undefined`.\n * @example\n * ```typescript\n * filter.and([\n * filter.eq('state.status', 'PAID'),\n * filter.eq('state.status', 'SHIPPED'),\n * ]);\n * ```\n */\n and: andFilter,\n /**\n * Matches when at least one of `operands` match. Returns an element-scoped\n * filter when every operand is element-scoped, so the result can be used\n * inside `elementMatch`.\n *\n * @param operands - Non-empty list of filter expressions.\n * @returns `{ op: 'OR', operands }` with a copy of `operands`.\n * @throws TypeError If `operands` is empty or contains `null` or\n * `undefined`.\n * @example\n * ```typescript\n * filter.or([\n * filter.eq('state.status', 'PAID'),\n * filter.eq('state.status', 'SHIPPED'),\n * ]);\n * ```\n */\n or: orFilter,\n /**\n * Matches when none of `operands` match. Returns an element-scoped\n * filter when every operand is element-scoped, so the result can be used\n * inside `elementMatch`.\n *\n * @param operands - Non-empty list of filter expressions.\n * @returns `{ op: 'NOR', operands }` with a copy of `operands`.\n * @throws TypeError If `operands` is empty or contains `null` or\n * `undefined`.\n * @example\n * ```typescript\n * filter.nor([\n * filter.eq('state.status', 'PAID'),\n * filter.eq('state.status', 'SHIPPED'),\n * ]);\n * ```\n */\n nor: norFilter,\n /**\n * Matches records whose `field` equals `value`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - JSON scalar. `null` is sent as is; the server rewrites it\n * to `IS_NULL`.\n * @returns `{ op: 'EQ', field, value }`.\n * @throws TypeError If `field` is not a valid query field path, or `value` is not\n * `null`, a string, a boolean or a finite number.\n * @example\n * ```typescript\n * filter.eq('state.status', 'PAID');\n * ```\n */\n eq<FIELDS extends string>(\n field: FIELDS,\n value: EqualityFilterValue,\n ): EqualityFilter<FIELDS> {\n return equality(FilterOperator.EQ, field, value);\n },\n /**\n * Matches records whose `field` does not equal `value`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - JSON scalar. `null` is sent as is; the server rewrites it\n * to `IS_NOT_NULL`.\n * @returns `{ op: 'NE', field, value }`.\n * @throws TypeError If `field` is not a valid query field path, or `value` is not\n * `null`, a string, a boolean or a finite number.\n * @example\n * ```typescript\n * filter.ne('state.status', 'CANCELLED');\n * ```\n */\n ne<FIELDS extends string>(\n field: FIELDS,\n value: EqualityFilterValue,\n ): EqualityFilter<FIELDS> {\n return equality(FilterOperator.NE, field, value);\n },\n /**\n * Matches records whose `field` is greater than `value` (`field > value`).\n * Numbers compare at the backend's stored precision.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - Non-null JSON scalar.\n * @returns `{ op: 'GT', field, value }`.\n * @throws TypeError If `field` is not a valid query field path, or `value` is not a\n * string, a boolean or a finite number.\n * @example\n * ```typescript\n * filter.gt('state.total', 100);\n * ```\n */\n gt<FIELDS extends string>(\n field: FIELDS,\n value: ComparableFilterLiteral,\n ): ComparisonFilter<FIELDS> {\n return comparison(FilterOperator.GT, field, value);\n },\n /**\n * Matches records whose `field` is greater than or equal to `value` (`field >= value`).\n * Numbers compare at the backend's stored precision.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - Non-null JSON scalar.\n * @returns `{ op: 'GTE', field, value }`.\n * @throws TypeError If `field` is not a valid query field path, or `value` is not a\n * string, a boolean or a finite number.\n * @example\n * ```typescript\n * filter.gte('state.total', 100);\n * ```\n */\n gte<FIELDS extends string>(\n field: FIELDS,\n value: ComparableFilterLiteral,\n ): ComparisonFilter<FIELDS> {\n return comparison(FilterOperator.GTE, field, value);\n },\n /**\n * Matches records whose `field` is less than `value` (`field < value`).\n * Numbers compare at the backend's stored precision.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - Non-null JSON scalar.\n * @returns `{ op: 'LT', field, value }`.\n * @throws TypeError If `field` is not a valid query field path, or `value` is not a\n * string, a boolean or a finite number.\n * @example\n * ```typescript\n * filter.lt('state.total', 100);\n * ```\n */\n lt<FIELDS extends string>(\n field: FIELDS,\n value: ComparableFilterLiteral,\n ): ComparisonFilter<FIELDS> {\n return comparison(FilterOperator.LT, field, value);\n },\n /**\n * Matches records whose `field` is less than or equal to `value` (`field <= value`).\n * Numbers compare at the backend's stored precision.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - Non-null JSON scalar.\n * @returns `{ op: 'LTE', field, value }`.\n * @throws TypeError If `field` is not a valid query field path, or `value` is not a\n * string, a boolean or a finite number.\n * @example\n * ```typescript\n * filter.lte('state.total', 100);\n * ```\n */\n lte<FIELDS extends string>(\n field: FIELDS,\n value: ComparableFilterLiteral,\n ): ComparisonFilter<FIELDS> {\n return comparison(FilterOperator.LTE, field, value);\n },\n /**\n * Matches records whose string `field` contains `value` literally. No\n * full-text analyzer is applied.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - Literal text.\n * @param stringComparison - Case handling. Defaults to\n * `StringComparison.CASE_SENSITIVE`.\n * @returns `{ op: 'CONTAINS', field, value, stringComparison }`.\n * @throws TypeError If `stringComparison` is not a {@link StringComparison}\n * member, `field` is not a valid query field path, or `value` is not a string.\n * @example\n * ```typescript\n * filter.contains('state.note', 'vip', StringComparison.CASE_INSENSITIVE);\n * ```\n */\n contains<FIELDS extends string>(\n field: FIELDS,\n value: string,\n stringComparison = StringComparison.CASE_SENSITIVE,\n ): StringFilter<FIELDS> {\n return stringMatch(FilterOperator.CONTAINS, field, value, stringComparison);\n },\n /**\n * Matches records whose string `field` starts with `value` literally. No\n * full-text analyzer is applied.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - Literal text.\n * @param stringComparison - Case handling. Defaults to\n * `StringComparison.CASE_SENSITIVE`.\n * @returns `{ op: 'STARTS_WITH', field, value, stringComparison }`.\n * @throws TypeError If `stringComparison` is not a {@link StringComparison}\n * member, `field` is not a valid query field path, or `value` is not a string.\n * @example\n * ```typescript\n * filter.startsWith('state.note', 'VIP-', StringComparison.CASE_INSENSITIVE);\n * ```\n */\n startsWith<FIELDS extends string>(\n field: FIELDS,\n value: string,\n stringComparison = StringComparison.CASE_SENSITIVE,\n ): StringFilter<FIELDS> {\n return stringMatch(\n FilterOperator.STARTS_WITH,\n field,\n value,\n stringComparison,\n );\n },\n /**\n * Matches records whose string `field` ends with `value` literally. No\n * full-text analyzer is applied.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param value - Literal text.\n * @param stringComparison - Case handling. Defaults to\n * `StringComparison.CASE_SENSITIVE`.\n * @returns `{ op: 'ENDS_WITH', field, value, stringComparison }`.\n * @throws TypeError If `stringComparison` is not a {@link StringComparison}\n * member, `field` is not a valid query field path, or `value` is not a string.\n * @example\n * ```typescript\n * filter.endsWith('state.note', '.pdf', StringComparison.CASE_INSENSITIVE);\n * ```\n */\n endsWith<FIELDS extends string>(\n field: FIELDS,\n value: string,\n stringComparison = StringComparison.CASE_SENSITIVE,\n ): StringFilter<FIELDS> {\n return stringMatch(\n FilterOperator.ENDS_WITH,\n field,\n value,\n stringComparison,\n );\n },\n /**\n * Matches records whose `field` equals one of `values`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param values - Non-empty list of non-null JSON scalars.\n * @returns `{ op: 'IN', field, values }` with a copy of `values`.\n * @throws TypeError If `values` is empty, contains `null` or `undefined`,\n * or contains a value that is not a string, a boolean or a finite\n * number, or if `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.isIn('state.status', ['PAID', 'SHIPPED']);\n * ```\n */\n isIn<FIELDS extends string>(\n field: FIELDS,\n values: readonly ComparableFilterLiteral[],\n ): CollectionFilter<FIELDS> {\n return collection(FilterOperator.IN, field, values);\n },\n /**\n * Matches records whose `field` equals none of `values`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param values - Non-empty list of non-null JSON scalars.\n * @returns `{ op: 'NOT_IN', field, values }` with a copy of `values`.\n * @throws TypeError If `values` is empty, contains `null` or `undefined`,\n * or contains a value that is not a string, a boolean or a finite\n * number, or if `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.notIn('state.status', ['CANCELLED', 'REFUNDED']);\n * ```\n */\n notIn<FIELDS extends string>(\n field: FIELDS,\n values: readonly ComparableFilterLiteral[],\n ): CollectionFilter<FIELDS> {\n return collection(FilterOperator.NOT_IN, field, values);\n },\n /**\n * Matches records whose array `field` contains every value in `values`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param values - Non-empty list of non-null JSON scalars.\n * @returns `{ op: 'CONTAINS_ALL', field, values }` with a copy of `values`.\n * @throws TypeError If `values` is empty, contains `null` or `undefined`,\n * or contains a value that is not a string, a boolean or a finite\n * number, or if `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.containsAll('state.tags', ['vip', 'new']);\n * ```\n */\n containsAll<FIELDS extends string>(\n field: FIELDS,\n values: readonly ComparableFilterLiteral[],\n ): CollectionFilter<FIELDS> {\n return collection(FilterOperator.CONTAINS_ALL, field, values);\n },\n /**\n * Matches records whose `field` lies in the inclusive range\n * `lowerBound <= field <= upperBound`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param lowerBound - Inclusive lower bound; non-null JSON scalar.\n * @param upperBound - Inclusive upper bound; non-null JSON scalar.\n * @returns `{ op: 'BETWEEN', field, lowerBound, upperBound }`.\n * @throws TypeError If `field` is not a valid query field path, or either bound is not a\n * string, a boolean or a finite number.\n * @example\n * ```typescript\n * filter.between('state.total', 100, 200);\n * ```\n */\n between<FIELDS extends string>(\n field: FIELDS,\n lowerBound: ComparableFilterLiteral,\n upperBound: ComparableFilterLiteral,\n ): BetweenFilter<FIELDS> {\n return {\n op: FilterOperator.BETWEEN,\n field: queryField(field),\n lowerBound: filterLiteral(lowerBound, false),\n upperBound: filterLiteral(upperBound, false),\n };\n },\n /**\n * Matches records whose array `field` is empty. On Elasticsearch it may also\n * match a missing or `null` field.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @returns `{ op: 'IS_EMPTY', field }`.\n * @throws TypeError If `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.isEmpty('state.items');\n * ```\n */\n isEmpty<FIELDS extends string>(field: FIELDS): FieldPresenceFilter<FIELDS> {\n return presence(FilterOperator.IS_EMPTY, field);\n },\n /**\n * Matches records whose string `field` equals `\"\"`. Whitespace-only\n * strings do not match.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @returns `{ op: 'IS_EMPTY_STRING', field }`.\n * @throws TypeError If `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.isEmptyString('state.note');\n * ```\n */\n isEmptyString<FIELDS extends string>(\n field: FIELDS,\n ): FieldPresenceFilter<FIELDS> {\n return presence(FilterOperator.IS_EMPTY_STRING, field);\n },\n /**\n * Matches records whose string `field` exists, is not `null` and is not\n * `\"\"`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @returns `{ op: 'IS_NOT_EMPTY_STRING', field }`.\n * @throws TypeError If `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.isNotEmptyString('state.note');\n * ```\n */\n isNotEmptyString<FIELDS extends string>(\n field: FIELDS,\n ): FieldPresenceFilter<FIELDS> {\n return presence(FilterOperator.IS_NOT_EMPTY_STRING, field);\n },\n /**\n * Matches records whose `field` is `null` or missing, following the\n * backend's null semantics.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @returns `{ op: 'IS_NULL', field }`.\n * @throws TypeError If `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.isNull('state.note');\n * ```\n */\n isNull<FIELDS extends string>(field: FIELDS): FieldPresenceFilter<FIELDS> {\n return presence(FilterOperator.IS_NULL, field);\n },\n /**\n * Matches records whose `field` exists and is not `null`, following the\n * backend's null semantics.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @returns `{ op: 'IS_NOT_NULL', field }`.\n * @throws TypeError If `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.isNotNull('state.note');\n * ```\n */\n isNotNull<FIELDS extends string>(field: FIELDS): FieldPresenceFilter<FIELDS> {\n return presence(FilterOperator.IS_NOT_NULL, field);\n },\n /**\n * Matches records where `field` exists. On MongoDB this includes a `null`\n * value.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @returns `{ op: 'EXISTS', field }`.\n * @throws TypeError If `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.exists('state.note');\n * ```\n */\n exists<FIELDS extends string>(field: FIELDS): FieldPresenceFilter<FIELDS> {\n return presence(FilterOperator.EXISTS, field);\n },\n /**\n * Matches records where `field` is missing.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @returns `{ op: 'NOT_EXISTS', field }`.\n * @throws TypeError If `field` is not a valid query field path.\n * @example\n * ```typescript\n * filter.notExists('state.note');\n * ```\n */\n notExists<FIELDS extends string>(field: FIELDS): FieldPresenceFilter<FIELDS> {\n return presence(FilterOperator.NOT_EXISTS, field);\n },\n /**\n * Matches snapshots by deletion state. An explicit `DELETION` at the root or\n * in a root `AND` replaces the gateway's default `ACTIVE` scope. Root-only:\n * not allowed inside `elementMatch`.\n *\n * @param state - `ACTIVE`, `DELETED` or `ALL`.\n * @returns `{ op: 'DELETION', state }`.\n * @throws TypeError If `state` is not a {@link DeletionState} member.\n * @example\n * ```typescript\n * filter.deletion(DeletionState.ALL);\n * ```\n */\n deletion(state: DeletionState): DeletionFilter {\n if (\n state !== DeletionState.ACTIVE &&\n state !== DeletionState.DELETED &&\n state !== DeletionState.ALL\n ) {\n throw new TypeError(`Deletion state is invalid: [${String(state)}].`);\n }\n return { op: FilterOperator.DELETION, state };\n },\n /**\n * Matches records where a single element of the array `field` satisfies\n * `predicate`. Fields in `predicate` are relative to the element.\n *\n * @param field - Query field path of the array, e.g. `state.items`.\n * @param predicate - Element-scoped filter expression.\n * @returns `{ op: 'ELEMENT_MATCH', field, predicate }`.\n * A `SEARCH` inside it must name the fields it searches, relative to the\n * element (Wow 9.2 and later, where the descriptor lists\n * `elements[].search`); a model-wide `SEARCH` is a root filter.\n *\n * @throws TypeError If `predicate` contains, at any depth, a root-only filter\n * (`ID`, `IDS`, `AGGREGATE_ID`, `AGGREGATE_IDS`, `TENANT_ID`, `OWNER_ID`,\n * `SPACE_ID`, `DELETION` or a `SEARCH` without fields) or an `AND`, `OR`\n * or `NOR` whose operands are empty or contain `null`, or if `field` is\n * not a valid query field path.\n * @example\n * ```typescript\n * filter.elementMatch('state.items', filter.gt('quantity', 1));\n * filter.elementMatch(\n * 'state.items',\n * filter.search('usb cable', { fields: ['productName'] }),\n * );\n * ```\n */\n elementMatch<FIELDS extends string, ELEMENT_FIELDS extends string>(\n field: FIELDS,\n predicate: ElementFilterExpression<ELEMENT_FIELDS>,\n ): ElementMatchFilter<FIELDS, ELEMENT_FIELDS> {\n requireElementScopedFilter(predicate, 'ELEMENT_MATCH predicate');\n return {\n op: FilterOperator.ELEMENT_MATCH,\n field: queryField(field),\n predicate,\n };\n },\n /**\n * Matches records by full-text search. Tokenization and matching depend on\n * the backend's analyzer. Inside `elementMatch` it must name its fields,\n * relative to the element; with fields given as a non-empty array literal\n * it returns an {@link ElementSearchFilter}, which `elementMatch` takes.\n *\n * @param query - Search text.\n * @param options - Optional `fields` (defaults to `[]`, the backend's default\n * search fields) and `mode` (defaults to `SearchMode.TERMS`).\n * @returns `{ op: 'SEARCH', query, mode, fields }`.\n * @throws TypeError If `query` is not a string or is blank, `options` is\n * given but is `null`, an array or not an object, `mode` is not a\n * {@link SearchMode} member, or any of `fields` is not a valid query field\n * path.\n * @example\n * ```typescript\n * filter.search('event sourcing', {\n * fields: ['state.description'],\n * mode: SearchMode.PHRASE,\n * });\n * ```\n */\n search: search as SearchBuilder,\n /**\n * Matches times within today, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'TODAY', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.today('state.createTime', { zoneId: 'Asia/Shanghai' });\n * ```\n */\n today<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.TODAY, field, options);\n },\n /**\n * Matches times earlier than today at the local time `time`\n * (`field < today at time`) in the configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param time - 24-hour local time: `HH:mm`, `HH:mm:ss` or `HH:mm:ss.S` with\n * 1 to 9 fraction digits.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'BEFORE_TODAY', field, time, timeUnit }`, plus `zoneId`\n * and `datePattern` when set.\n * @throws TypeError If `time` is not a string in one of the formats above,\n * `field` is not a valid query field path, `zoneId` is blank or an invalid UTC offset,\n * `datePattern` is blank or not a valid `java.time` pattern, or\n * `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.beforeToday('state.createTime', '12:00');\n * ```\n */\n beforeToday<FIELDS extends string>(\n field: FIELDS,\n time: string,\n options: RelativeTimeFilterOptions = {},\n ): BeforeTodayFilter<FIELDS> {\n const localTime = requireLocalTime(time);\n return {\n ...validateRelativeTimeOptions(options),\n op: FilterOperator.BEFORE_TODAY,\n field: queryField(field),\n time: localTime,\n };\n },\n /**\n * Matches times within tomorrow, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'TOMORROW', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.tomorrow('state.createTime');\n * ```\n */\n tomorrow<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.TOMORROW, field, options);\n },\n /**\n * Matches times within the current Monday-start week, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'THIS_WEEK', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.thisWeek('state.createTime');\n * ```\n */\n thisWeek<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.THIS_WEEK, field, options);\n },\n /**\n * Matches times within the next Monday-start week, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'NEXT_WEEK', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.nextWeek('state.createTime');\n * ```\n */\n nextWeek<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.NEXT_WEEK, field, options);\n },\n /**\n * Matches times within the previous Monday-start week, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'LAST_WEEK', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.lastWeek('state.createTime');\n * ```\n */\n lastWeek<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.LAST_WEEK, field, options);\n },\n /**\n * Matches times within the current calendar month, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'THIS_MONTH', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.thisMonth('state.createTime');\n * ```\n */\n thisMonth<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.THIS_MONTH, field, options);\n },\n /**\n * Matches times within the previous calendar month, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'LAST_MONTH', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.lastMonth('state.createTime');\n * ```\n */\n lastMonth<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.LAST_MONTH, field, options);\n },\n /**\n * Matches times within yesterday, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'YESTERDAY', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.yesterday('state.createTime');\n * ```\n */\n yesterday<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.YESTERDAY, field, options);\n },\n /**\n * Matches times within the next calendar month, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'NEXT_MONTH', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.nextMonth('state.createTime');\n * ```\n */\n nextMonth<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.NEXT_MONTH, field, options);\n },\n /**\n * Matches times within the previous calendar year, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'LAST_YEAR', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.lastYear('state.createTime');\n * ```\n */\n lastYear<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.LAST_YEAR, field, options);\n },\n /**\n * Matches times within the current calendar year, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'THIS_YEAR', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.thisYear('state.createTime', { timeUnit: TimeUnit.SECONDS });\n * ```\n */\n thisYear<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.THIS_YEAR, field, options);\n },\n /**\n * Matches times within the next calendar year, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'NEXT_YEAR', field, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `field` is not a valid query field path, `zoneId` is blank or an\n * invalid UTC offset, `datePattern` is blank or not a valid\n * `java.time` pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.nextYear('state.createTime');\n * ```\n */\n nextYear<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.NEXT_YEAR, field, options);\n },\n /**\n * Matches times from the start of the day `days - 1` days ago until the end\n * of today. `recentDays(field, 7)` covers today and the six previous days.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param days - Number of calendar days, including today; an integer from\n * 1 to 2147483647.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'RECENT_DAYS', field, days, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `days` is not an integer from 1 to 2147483647,\n * `field` is not a valid query field path, `zoneId` is blank or an invalid UTC offset,\n * `datePattern` is blank or not a valid `java.time` pattern, or\n * `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.recentDays('state.createTime', 7);\n * ```\n */\n recentDays<FIELDS extends string>(\n field: FIELDS,\n days: number,\n options: RelativeTimeFilterOptions = {},\n ): DaysFilter<FIELDS> {\n return dayWindow(FilterOperator.RECENT_DAYS, field, days, options);\n },\n /**\n * Matches times before the start of the day `days - 1` days ago, that is,\n * before the window that `recentDays` covers with the same `days`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param days - Number of calendar days, including today; an integer from\n * 1 to 2147483647.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'EARLIER_DAYS', field, days, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `days` is not an integer from 1 to 2147483647,\n * `field` is not a valid query field path, `zoneId` is blank or an invalid UTC offset,\n * `datePattern` is blank or not a valid `java.time` pattern, or\n * `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * filter.earlierDays('state.createTime', 7);\n * ```\n */\n earlierDays<FIELDS extends string>(\n field: FIELDS,\n days: number,\n options: RelativeTimeFilterOptions = {},\n ): DaysFilter<FIELDS> {\n return dayWindow(FilterOperator.EARLIER_DAYS, field, days, options);\n },\n /**\n * Matches times strictly before the server's `now + offset`\n * (`field < now + offset`). The server reads its clock once per query,\n * so a saved query never depends on the client's clock, and the moment is\n * encoded the way the field stores time: an epoch in `timeUnit`, or text\n * in `datePattern` and `zoneId`.\n *\n * Needs a Wow server of 9.2.0 or later; an earlier one refuses `BEFORE_NOW`.\n *\n * @param field - Query field path, e.g. `state.timeoutAt`.\n * @param offset - ISO-8601 duration added to now, as\n * `java.time.Duration.parse` reads it: days, hours, minutes and seconds,\n * each optionally signed, e.g. `PT0S`, `-PT30M` or `P1DT2H`. A negative\n * offset looks back. Defaults to `PT0S`, now itself.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'BEFORE_NOW', field, offset, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `offset` is not an ISO-8601 duration in that\n * grammar, `field` is not a valid query field path, `zoneId` is blank or\n * an invalid UTC offset, `datePattern` is blank or not a valid `java.time`\n * pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * // Timed out: the deadline has passed.\n * filter.beforeNow('state.timeoutAt');\n * ```\n */\n beforeNow<FIELDS extends string>(\n field: FIELDS,\n offset = 'PT0S',\n options: RelativeTimeFilterOptions = {},\n ): NowFilter<FIELDS> {\n return nowRelative(FilterOperator.BEFORE_NOW, field, offset, options);\n },\n /**\n * Matches times strictly after the server's `now + offset`\n * (`field > now + offset`). The server reads its clock once per query,\n * so a saved query never depends on the client's clock, and the moment is\n * encoded the way the field stores time: an epoch in `timeUnit`, or text\n * in `datePattern` and `zoneId`.\n *\n * Needs a Wow server of 9.2.0 or later; an earlier one refuses `AFTER_NOW`.\n *\n * @param field - Query field path, e.g. `state.timeoutAt`.\n * @param offset - ISO-8601 duration added to now, as\n * `java.time.Duration.parse` reads it: days, hours, minutes and seconds,\n * each optionally signed, e.g. `PT0S`, `-PT30M` or `P1DT2H`. A negative\n * offset looks back. Defaults to `PT0S`, now itself.\n * @param options - Optional `zoneId`, `datePattern` and `timeUnit`; see\n * {@link RelativeTimeFilterOptions}. `timeUnit` defaults to\n * `TimeUnit.MILLISECONDS`.\n * @returns `{ op: 'AFTER_NOW', field, offset, timeUnit }`, plus `zoneId` and\n * `datePattern` when set.\n * @throws TypeError If `offset` is not an ISO-8601 duration in that\n * grammar, `field` is not a valid query field path, `zoneId` is blank or\n * an invalid UTC offset, `datePattern` is blank or not a valid `java.time`\n * pattern, or `timeUnit` is not a {@link TimeUnit} member.\n * @example\n * ```typescript\n * // Created in the last 30 minutes.\n * filter.afterNow('state.createTime', '-PT30M');\n * ```\n */\n afterNow<FIELDS extends string>(\n field: FIELDS,\n offset = 'PT0S',\n options: RelativeTimeFilterOptions = {},\n ): NowFilter<FIELDS> {\n return nowRelative(FilterOperator.AFTER_NOW, field, offset, options);\n },\n /**\n * Compares a computed expression with a number, such as the hours from\n * `paidAt` to `shippedAt`. `{ op: 'EXPRESSION', expression, comparison,\n * value }`.\n *\n * The expression is evaluated per record, so this is an expensive\n * operator, admitted where the descriptor lists `EXPRESSION` in\n * `record.rootOperators`. A record whose expression has no value (an\n * operand absent or holding several values, or a division by zero) does\n * not match, whatever the comparison, `NE` included. Allowed at the root,\n * in a metric's filter and in an aggregation element's filter, but not\n * inside `elementMatch`. Needs a Wow server of 9.2.0 or later.\n *\n * @param expression - What is compared; it must read at least one field.\n * @param comparison - How it compares with `value`.\n * @param value - A finite number.\n * @throws TypeError If `value` is not finite, `comparison` is not a\n * {@link ComparisonOperator}, `expression` reads no field, or the tree is\n * too deep or too large.\n * @example\n * ```typescript\n * // Shipped more than two days after it was paid.\n * filter.expression(\n * aggregation.dateDiff('state.paidAt', 'state.shippedAt', DateDiffUnit.HOUR),\n * ComparisonOperator.GT,\n * 48,\n * );\n * ```\n */\n expression<FIELDS extends string>(\n expression: AggregationExpression<FIELDS>,\n comparison: ComparisonOperator,\n value: number,\n ): ExpressionFilter<FIELDS> {\n if (!Number.isFinite(value)) {\n throw new TypeError('EXPRESSION value must be finite.');\n }\n if (!Object.values(ComparisonOperator).includes(comparison)) {\n throw new TypeError(\n `EXPRESSION comparison is invalid: [${String(comparison)}].`,\n );\n }\n if (expressionFields(expression).length === 0) {\n throw new TypeError('EXPRESSION must read at least one field.');\n }\n requireValidExpressionTrees([expression]);\n return { op: FilterOperator.EXPRESSION, expression, comparison, value };\n },\n};\n"],"mappings":"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"}