@ahoo-wang/wow-client 9.9.0 → 10.0.0-alpha.4

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 (385) hide show
  1. package/README.md +85 -230
  2. package/README.zh-CN.md +74 -209
  3. package/dist/commands.cjs +2 -0
  4. package/dist/commands.cjs.map +1 -0
  5. package/dist/commands.d.cts +123 -0
  6. package/dist/commands.d.ts +123 -0
  7. package/dist/commands.es.js +96 -0
  8. package/dist/commands.es.js.map +1 -0
  9. package/dist/dsl/aggregation/types.cjs.map +1 -1
  10. package/dist/dsl/aggregation/types.d.cts +1 -1
  11. package/dist/dsl/aggregation/types.d.ts +1 -1
  12. package/dist/dsl/aggregation/types.es.js.map +1 -1
  13. package/dist/dsl/cursorQuery.cjs.map +1 -1
  14. package/dist/dsl/cursorQuery.d.cts +7 -8
  15. package/dist/dsl/cursorQuery.d.ts +7 -8
  16. package/dist/dsl/cursorQuery.es.js.map +1 -1
  17. package/dist/dsl/descriptor.cjs.map +1 -1
  18. package/dist/dsl/descriptor.d.cts +8 -1
  19. package/dist/dsl/descriptor.d.ts +8 -1
  20. package/dist/dsl/descriptor.es.js.map +1 -1
  21. package/dist/dsl/documents.d.cts +1 -1
  22. package/dist/dsl/documents.d.ts +1 -1
  23. package/dist/dsl/filter/types.d.cts +2 -1
  24. package/dist/dsl/filter/types.d.ts +2 -1
  25. package/dist/dsl/projection.cjs.map +1 -1
  26. package/dist/dsl/projection.d.cts +22 -0
  27. package/dist/dsl/projection.d.ts +22 -0
  28. package/dist/dsl/projection.es.js.map +1 -1
  29. package/dist/dsl/queryErrorCodes.cjs +2 -0
  30. package/dist/dsl/queryErrorCodes.cjs.map +1 -0
  31. package/dist/{error → dsl}/queryErrorCodes.d.cts +25 -24
  32. package/dist/{error → dsl}/queryErrorCodes.d.ts +25 -24
  33. package/dist/{error → dsl}/queryErrorCodes.es.js +2 -1
  34. package/dist/{error/queryErrorCodes.cjs.map → dsl/queryErrorCodes.es.js.map} +1 -1
  35. package/dist/dsl.cjs +1 -1
  36. package/dist/dsl.d.cts +1 -2
  37. package/dist/dsl.d.ts +1 -2
  38. package/dist/dsl.es.js +2 -3
  39. package/dist/exactJson.cjs +3 -0
  40. package/dist/exactJson.cjs.map +1 -0
  41. package/dist/exactJson.d.cts +54 -0
  42. package/dist/exactJson.d.ts +54 -0
  43. package/dist/exactJson.es.js +213 -0
  44. package/dist/exactJson.es.js.map +1 -0
  45. package/dist/http.cjs +2 -0
  46. package/dist/http.cjs.map +1 -0
  47. package/dist/http.d.cts +96 -0
  48. package/dist/http.d.ts +96 -0
  49. package/dist/http.es.js +77 -0
  50. package/dist/http.es.js.map +1 -0
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.d.cts +19 -17
  53. package/dist/index.d.ts +19 -17
  54. package/dist/index.es.js +10 -36
  55. package/dist/manifest.cjs +2 -0
  56. package/dist/manifest.cjs.map +1 -0
  57. package/dist/manifest.d.cts +109 -0
  58. package/dist/manifest.d.ts +109 -0
  59. package/dist/manifest.es.js +14 -0
  60. package/dist/manifest.es.js.map +1 -0
  61. package/dist/problem.cjs +2 -0
  62. package/dist/problem.cjs.map +1 -0
  63. package/dist/problem.d.cts +211 -0
  64. package/dist/problem.d.ts +211 -0
  65. package/dist/problem.es.js +138 -0
  66. package/dist/problem.es.js.map +1 -0
  67. package/dist/queries.cjs +2 -0
  68. package/dist/queries.cjs.map +1 -0
  69. package/dist/queries.d.cts +182 -0
  70. package/dist/queries.d.ts +182 -0
  71. package/dist/queries.es.js +112 -0
  72. package/dist/queries.es.js.map +1 -0
  73. package/dist/state.cjs +2 -0
  74. package/dist/state.cjs.map +1 -0
  75. package/dist/state.d.cts +75 -0
  76. package/dist/state.d.ts +75 -0
  77. package/dist/state.es.js +70 -0
  78. package/dist/state.es.js.map +1 -0
  79. package/dist/streams.cjs +2 -0
  80. package/dist/streams.cjs.map +1 -0
  81. package/dist/streams.d.cts +74 -0
  82. package/dist/streams.d.ts +74 -0
  83. package/dist/streams.es.js +103 -0
  84. package/dist/streams.es.js.map +1 -0
  85. package/dist/wait.cjs +2 -0
  86. package/dist/wait.cjs.map +1 -0
  87. package/dist/wait.d.cts +61 -0
  88. package/dist/wait.d.ts +61 -0
  89. package/dist/wait.es.js +44 -0
  90. package/dist/wait.es.js.map +1 -0
  91. package/dist/wire.cjs +2 -0
  92. package/dist/wire.cjs.map +1 -0
  93. package/dist/wire.d.cts +326 -0
  94. package/dist/wire.d.ts +326 -0
  95. package/dist/wire.es.js +10 -0
  96. package/dist/wire.es.js.map +1 -0
  97. package/package.json +4 -16
  98. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.cjs +0 -1
  99. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.es.js +0 -9
  100. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.cjs +0 -1
  101. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.es.js +0 -6
  102. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.cjs +0 -1
  103. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.es.js +0 -8
  104. package/dist/client/bindMethods.cjs +0 -2
  105. package/dist/client/bindMethods.cjs.map +0 -1
  106. package/dist/client/bindMethods.d.cts +0 -13
  107. package/dist/client/bindMethods.d.ts +0 -13
  108. package/dist/client/bindMethods.es.js +0 -19
  109. package/dist/client/bindMethods.es.js.map +0 -1
  110. package/dist/client/command/commandClient.cjs +0 -2
  111. package/dist/client/command/commandClient.cjs.map +0 -1
  112. package/dist/client/command/commandClient.d.cts +0 -67
  113. package/dist/client/command/commandClient.d.ts +0 -67
  114. package/dist/client/command/commandClient.es.js +0 -38
  115. package/dist/client/command/commandClient.es.js.map +0 -1
  116. package/dist/client/command/commandHeaders.cjs +0 -2
  117. package/dist/client/command/commandHeaders.cjs.map +0 -1
  118. package/dist/client/command/commandHeaders.d.cts +0 -75
  119. package/dist/client/command/commandHeaders.d.ts +0 -75
  120. package/dist/client/command/commandHeaders.es.js +0 -31
  121. package/dist/client/command/commandHeaders.es.js.map +0 -1
  122. package/dist/client/command/commandRequest.cjs +0 -2
  123. package/dist/client/command/commandRequest.cjs.map +0 -1
  124. package/dist/client/command/commandRequest.d.cts +0 -180
  125. package/dist/client/command/commandRequest.d.ts +0 -180
  126. package/dist/client/command/commandRequest.es.js +0 -31
  127. package/dist/client/command/commandRequest.es.js.map +0 -1
  128. package/dist/client/command/commandResult.d.cts +0 -15
  129. package/dist/client/command/commandResult.d.ts +0 -15
  130. package/dist/client/command/index.d.cts +0 -5
  131. package/dist/client/command/index.d.ts +0 -5
  132. package/dist/client/command/types.d.cts +0 -71
  133. package/dist/client/command/types.d.ts +0 -71
  134. package/dist/client/metadata/index.d.cts +0 -2
  135. package/dist/client/metadata/index.d.ts +0 -2
  136. package/dist/client/metadata/wowMetadata.d.cts +0 -48
  137. package/dist/client/metadata/wowMetadata.d.ts +0 -48
  138. package/dist/client/metadata/wowMetadataClient.cjs +0 -2
  139. package/dist/client/metadata/wowMetadataClient.cjs.map +0 -1
  140. package/dist/client/metadata/wowMetadataClient.d.cts +0 -23
  141. package/dist/client/metadata/wowMetadataClient.d.ts +0 -23
  142. package/dist/client/metadata/wowMetadataClient.es.js +0 -25
  143. package/dist/client/metadata/wowMetadataClient.es.js.map +0 -1
  144. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs +0 -2
  145. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs.map +0 -1
  146. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.cts +0 -8
  147. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.ts +0 -8
  148. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js +0 -34
  149. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js.map +0 -1
  150. package/dist/client/query/dataset/datasetDirectoryClient.cjs +0 -2
  151. package/dist/client/query/dataset/datasetDirectoryClient.cjs.map +0 -1
  152. package/dist/client/query/dataset/datasetDirectoryClient.d.cts +0 -29
  153. package/dist/client/query/dataset/datasetDirectoryClient.d.ts +0 -29
  154. package/dist/client/query/dataset/datasetDirectoryClient.es.js +0 -25
  155. package/dist/client/query/dataset/datasetDirectoryClient.es.js.map +0 -1
  156. package/dist/client/query/dataset/datasetQueryApi.d.cts +0 -40
  157. package/dist/client/query/dataset/datasetQueryApi.d.ts +0 -40
  158. package/dist/client/query/dataset/datasetQueryClient.cjs +0 -2
  159. package/dist/client/query/dataset/datasetQueryClient.cjs.map +0 -1
  160. package/dist/client/query/dataset/datasetQueryClient.d.cts +0 -57
  161. package/dist/client/query/dataset/datasetQueryClient.d.ts +0 -57
  162. package/dist/client/query/dataset/datasetQueryClient.es.js +0 -154
  163. package/dist/client/query/dataset/datasetQueryClient.es.js.map +0 -1
  164. package/dist/client/query/dataset/endpointPaths.cjs +0 -2
  165. package/dist/client/query/dataset/endpointPaths.cjs.map +0 -1
  166. package/dist/client/query/dataset/endpointPaths.d.cts +0 -9
  167. package/dist/client/query/dataset/endpointPaths.d.ts +0 -9
  168. package/dist/client/query/dataset/endpointPaths.es.js +0 -14
  169. package/dist/client/query/dataset/endpointPaths.es.js.map +0 -1
  170. package/dist/client/query/dataset/index.d.cts +0 -3
  171. package/dist/client/query/dataset/index.d.ts +0 -3
  172. package/dist/client/query/descriptor/descriptorEndpoints.cjs +0 -2
  173. package/dist/client/query/descriptor/descriptorEndpoints.cjs.map +0 -1
  174. package/dist/client/query/descriptor/descriptorEndpoints.d.cts +0 -29
  175. package/dist/client/query/descriptor/descriptorEndpoints.d.ts +0 -29
  176. package/dist/client/query/descriptor/descriptorEndpoints.es.js +0 -69
  177. package/dist/client/query/descriptor/descriptorEndpoints.es.js.map +0 -1
  178. package/dist/client/query/descriptor/endpointPaths.cjs +0 -2
  179. package/dist/client/query/descriptor/endpointPaths.cjs.map +0 -1
  180. package/dist/client/query/descriptor/endpointPaths.d.cts +0 -4
  181. package/dist/client/query/descriptor/endpointPaths.d.ts +0 -4
  182. package/dist/client/query/descriptor/endpointPaths.es.js +0 -9
  183. package/dist/client/query/descriptor/endpointPaths.es.js.map +0 -1
  184. package/dist/client/query/descriptor/index.d.cts +0 -2
  185. package/dist/client/query/descriptor/index.d.ts +0 -2
  186. package/dist/client/query/descriptor/queryDescriptorApi.d.cts +0 -58
  187. package/dist/client/query/descriptor/queryDescriptorApi.d.ts +0 -58
  188. package/dist/client/query/descriptor/queryDescriptorClient.cjs +0 -2
  189. package/dist/client/query/descriptor/queryDescriptorClient.cjs.map +0 -1
  190. package/dist/client/query/descriptor/queryDescriptorClient.d.cts +0 -61
  191. package/dist/client/query/descriptor/queryDescriptorClient.d.ts +0 -61
  192. package/dist/client/query/descriptor/queryDescriptorClient.es.js +0 -20
  193. package/dist/client/query/descriptor/queryDescriptorClient.es.js.map +0 -1
  194. package/dist/client/query/event/endpointPaths.cjs +0 -2
  195. package/dist/client/query/event/endpointPaths.cjs.map +0 -1
  196. package/dist/client/query/event/endpointPaths.d.cts +0 -8
  197. package/dist/client/query/event/endpointPaths.d.ts +0 -8
  198. package/dist/client/query/event/endpointPaths.es.js +0 -13
  199. package/dist/client/query/event/endpointPaths.es.js.map +0 -1
  200. package/dist/client/query/event/eventStreamQueryApi.d.cts +0 -29
  201. package/dist/client/query/event/eventStreamQueryApi.d.ts +0 -29
  202. package/dist/client/query/event/eventStreamQueryClient.cjs +0 -2
  203. package/dist/client/query/event/eventStreamQueryClient.cjs.map +0 -1
  204. package/dist/client/query/event/eventStreamQueryClient.d.cts +0 -193
  205. package/dist/client/query/event/eventStreamQueryClient.d.ts +0 -193
  206. package/dist/client/query/event/eventStreamQueryClient.es.js +0 -160
  207. package/dist/client/query/event/eventStreamQueryClient.es.js.map +0 -1
  208. package/dist/client/query/event/index.d.cts +0 -2
  209. package/dist/client/query/event/index.d.ts +0 -2
  210. package/dist/client/query/factory.cjs +0 -2
  211. package/dist/client/query/factory.cjs.map +0 -1
  212. package/dist/client/query/factory.d.cts +0 -165
  213. package/dist/client/query/factory.d.ts +0 -165
  214. package/dist/client/query/factory.es.js +0 -45
  215. package/dist/client/query/factory.es.js.map +0 -1
  216. package/dist/client/query/index.d.cts +0 -7
  217. package/dist/client/query/index.d.ts +0 -7
  218. package/dist/client/query/queryApi.d.cts +0 -68
  219. package/dist/client/query/queryApi.d.ts +0 -68
  220. package/dist/client/query/requests.d.cts +0 -24
  221. package/dist/client/query/requests.d.ts +0 -24
  222. package/dist/client/query/snapshot/endpointPaths.cjs +0 -2
  223. package/dist/client/query/snapshot/endpointPaths.cjs.map +0 -1
  224. package/dist/client/query/snapshot/endpointPaths.d.cts +0 -12
  225. package/dist/client/query/snapshot/endpointPaths.d.ts +0 -12
  226. package/dist/client/query/snapshot/endpointPaths.es.js +0 -17
  227. package/dist/client/query/snapshot/endpointPaths.es.js.map +0 -1
  228. package/dist/client/query/snapshot/index.d.cts +0 -2
  229. package/dist/client/query/snapshot/index.d.ts +0 -2
  230. package/dist/client/query/snapshot/snapshotQueryApi.d.cts +0 -101
  231. package/dist/client/query/snapshot/snapshotQueryApi.d.ts +0 -101
  232. package/dist/client/query/snapshot/snapshotQueryClient.cjs +0 -2
  233. package/dist/client/query/snapshot/snapshotQueryClient.cjs.map +0 -1
  234. package/dist/client/query/snapshot/snapshotQueryClient.d.cts +0 -372
  235. package/dist/client/query/snapshot/snapshotQueryClient.d.ts +0 -372
  236. package/dist/client/query/snapshot/snapshotQueryClient.es.js +0 -239
  237. package/dist/client/query/snapshot/snapshotQueryClient.es.js.map +0 -1
  238. package/dist/client/query/state/endpointPaths.cjs +0 -2
  239. package/dist/client/query/state/endpointPaths.cjs.map +0 -1
  240. package/dist/client/query/state/endpointPaths.d.cts +0 -10
  241. package/dist/client/query/state/endpointPaths.d.ts +0 -10
  242. package/dist/client/query/state/endpointPaths.es.js +0 -14
  243. package/dist/client/query/state/endpointPaths.es.js.map +0 -1
  244. package/dist/client/query/state/index.d.cts +0 -4
  245. package/dist/client/query/state/index.d.ts +0 -4
  246. package/dist/client/query/state/loadOwnerStateAggregateApi.d.cts +0 -36
  247. package/dist/client/query/state/loadOwnerStateAggregateApi.d.ts +0 -36
  248. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs +0 -2
  249. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs.map +0 -1
  250. package/dist/client/query/state/loadOwnerStateAggregateClient.d.cts +0 -58
  251. package/dist/client/query/state/loadOwnerStateAggregateClient.d.ts +0 -58
  252. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js +0 -56
  253. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js.map +0 -1
  254. package/dist/client/query/state/loadStateAggregateApi.d.cts +0 -37
  255. package/dist/client/query/state/loadStateAggregateApi.d.ts +0 -37
  256. package/dist/client/query/state/loadStateAggregateClient.cjs +0 -2
  257. package/dist/client/query/state/loadStateAggregateClient.cjs.map +0 -1
  258. package/dist/client/query/state/loadStateAggregateClient.d.cts +0 -62
  259. package/dist/client/query/state/loadStateAggregateClient.d.ts +0 -62
  260. package/dist/client/query/state/loadStateAggregateClient.es.js +0 -65
  261. package/dist/client/query/state/loadStateAggregateClient.es.js.map +0 -1
  262. package/dist/client/routing.cjs +0 -2
  263. package/dist/client/routing.cjs.map +0 -1
  264. package/dist/client/routing.d.cts +0 -47
  265. package/dist/client/routing.d.ts +0 -47
  266. package/dist/client/routing.es.js +0 -8
  267. package/dist/client/routing.es.js.map +0 -1
  268. package/dist/error/errorInfo.cjs +0 -2
  269. package/dist/error/errorInfo.cjs.map +0 -1
  270. package/dist/error/errorInfo.d.cts +0 -139
  271. package/dist/error/errorInfo.d.ts +0 -139
  272. package/dist/error/errorInfo.es.js +0 -32
  273. package/dist/error/errorInfo.es.js.map +0 -1
  274. package/dist/error/headers.cjs +0 -2
  275. package/dist/error/headers.cjs.map +0 -1
  276. package/dist/error/headers.d.cts +0 -39
  277. package/dist/error/headers.d.ts +0 -39
  278. package/dist/error/headers.es.js +0 -10
  279. package/dist/error/headers.es.js.map +0 -1
  280. package/dist/error/index.d.cts +0 -21
  281. package/dist/error/index.d.ts +0 -21
  282. package/dist/error/queryErrorCodes.cjs +0 -2
  283. package/dist/error/queryErrorCodes.es.js.map +0 -1
  284. package/dist/error/wowError.cjs +0 -2
  285. package/dist/error/wowError.cjs.map +0 -1
  286. package/dist/error/wowError.d.cts +0 -99
  287. package/dist/error/wowError.d.ts +0 -99
  288. package/dist/error/wowError.es.js +0 -53
  289. package/dist/error/wowError.es.js.map +0 -1
  290. package/dist/legacy/condition.cjs +0 -2
  291. package/dist/legacy/condition.cjs.map +0 -1
  292. package/dist/legacy/condition.d.cts +0 -517
  293. package/dist/legacy/condition.d.ts +0 -517
  294. package/dist/legacy/condition.es.js +0 -338
  295. package/dist/legacy/condition.es.js.map +0 -1
  296. package/dist/legacy/index.d.cts +0 -16
  297. package/dist/legacy/index.d.ts +0 -16
  298. package/dist/legacy/locale/en_US.cjs +0 -2
  299. package/dist/legacy/locale/en_US.cjs.map +0 -1
  300. package/dist/legacy/locale/en_US.d.cts +0 -7
  301. package/dist/legacy/locale/en_US.d.ts +0 -7
  302. package/dist/legacy/locale/en_US.es.js +0 -50
  303. package/dist/legacy/locale/en_US.es.js.map +0 -1
  304. package/dist/legacy/locale/operatorLocale.d.cts +0 -10
  305. package/dist/legacy/locale/operatorLocale.d.ts +0 -10
  306. package/dist/legacy/locale/zh_CN.cjs +0 -2
  307. package/dist/legacy/locale/zh_CN.cjs.map +0 -1
  308. package/dist/legacy/locale/zh_CN.d.cts +0 -7
  309. package/dist/legacy/locale/zh_CN.d.ts +0 -7
  310. package/dist/legacy/locale/zh_CN.es.js +0 -50
  311. package/dist/legacy/locale/zh_CN.es.js.map +0 -1
  312. package/dist/legacy/operator.cjs +0 -2
  313. package/dist/legacy/operator.cjs.map +0 -1
  314. package/dist/legacy/operator.d.cts +0 -218
  315. package/dist/legacy/operator.d.ts +0 -218
  316. package/dist/legacy/operator.es.js +0 -25
  317. package/dist/legacy/operator.es.js.map +0 -1
  318. package/dist/legacy/queryable.cjs +0 -2
  319. package/dist/legacy/queryable.cjs.map +0 -1
  320. package/dist/legacy/queryable.d.cts +0 -61
  321. package/dist/legacy/queryable.d.ts +0 -61
  322. package/dist/legacy/queryable.es.js +0 -34
  323. package/dist/legacy/queryable.es.js.map +0 -1
  324. package/dist/legacy.cjs +0 -1
  325. package/dist/legacy.es.js +0 -6
  326. package/dist/model/abac.cjs +0 -2
  327. package/dist/model/abac.cjs.map +0 -1
  328. package/dist/model/abac.d.cts +0 -33
  329. package/dist/model/abac.d.ts +0 -33
  330. package/dist/model/abac.es.js +0 -6
  331. package/dist/model/abac.es.js.map +0 -1
  332. package/dist/model/bi.cjs +0 -2
  333. package/dist/model/bi.cjs.map +0 -1
  334. package/dist/model/bi.d.cts +0 -12
  335. package/dist/model/bi.d.ts +0 -12
  336. package/dist/model/bi.es.js +0 -8
  337. package/dist/model/bi.es.js.map +0 -1
  338. package/dist/model/command.cjs +0 -2
  339. package/dist/model/command.cjs.map +0 -1
  340. package/dist/model/command.d.cts +0 -137
  341. package/dist/model/command.d.ts +0 -137
  342. package/dist/model/command.es.js +0 -8
  343. package/dist/model/command.es.js.map +0 -1
  344. package/dist/model/common.d.cts +0 -19
  345. package/dist/model/common.d.ts +0 -19
  346. package/dist/model/domainEventStream.cjs +0 -2
  347. package/dist/model/domainEventStream.cjs.map +0 -1
  348. package/dist/model/domainEventStream.d.cts +0 -109
  349. package/dist/model/domainEventStream.d.ts +0 -109
  350. package/dist/model/domainEventStream.es.js +0 -23
  351. package/dist/model/domainEventStream.es.js.map +0 -1
  352. package/dist/model/function.cjs +0 -2
  353. package/dist/model/function.cjs.map +0 -1
  354. package/dist/model/function.d.cts +0 -41
  355. package/dist/model/function.d.ts +0 -41
  356. package/dist/model/function.es.js +0 -8
  357. package/dist/model/function.es.js.map +0 -1
  358. package/dist/model/index.d.cts +0 -24
  359. package/dist/model/index.d.ts +0 -24
  360. package/dist/model/messaging.d.cts +0 -5
  361. package/dist/model/messaging.d.ts +0 -5
  362. package/dist/model/modeling.d.cts +0 -145
  363. package/dist/model/modeling.d.ts +0 -145
  364. package/dist/model/naming.d.cts +0 -27
  365. package/dist/model/naming.d.ts +0 -27
  366. package/dist/model/snapshot.cjs +0 -2
  367. package/dist/model/snapshot.cjs.map +0 -1
  368. package/dist/model/snapshot.d.cts +0 -53
  369. package/dist/model/snapshot.d.ts +0 -53
  370. package/dist/model/snapshot.es.js +0 -20
  371. package/dist/model/snapshot.es.js.map +0 -1
  372. package/dist/transport/endpoints.cjs +0 -2
  373. package/dist/transport/endpoints.cjs.map +0 -1
  374. package/dist/transport/endpoints.d.cts +0 -79
  375. package/dist/transport/endpoints.d.ts +0 -79
  376. package/dist/transport/endpoints.es.js +0 -14
  377. package/dist/transport/endpoints.es.js.map +0 -1
  378. package/dist/transport/eventStreams.cjs +0 -2
  379. package/dist/transport/eventStreams.cjs.map +0 -1
  380. package/dist/transport/eventStreams.d.cts +0 -25
  381. package/dist/transport/eventStreams.d.ts +0 -25
  382. package/dist/transport/eventStreams.es.js +0 -21
  383. package/dist/transport/eventStreams.es.js.map +0 -1
  384. package/dist/transport/index.d.cts +0 -1
  385. package/dist/transport/index.d.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor.cjs","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 WindowFunction,\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 /** A declared dataset, such as a ClickHouse wide table: `dataset/{context}/{dataset}/*`. */\n DATASET: 'DATASET',\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 * The window functions a derived metric may compute over the groups; empty\n * when expensive operators are off. Absent from servers before Wow 9.9,\n * which compute no windows.\n */\n windows?: WindowFunction[];\n /**\n * Whether a group of a query that expands elements may name a field of the\n * root record (`scope: 'ROOT'`); `false` when expensive operators are off.\n * Absent from servers before Wow 9.9, which group elements by element\n * fields only.\n */\n rootGroups?: boolean;\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":"AAuCA,IAAaA,EAAc,OAAO,OAAO,CAEvC,SAAU,WAEV,aAAc,eAEd,QAAS,SACX,CAAU,EAUGC,EAAkB,OAAO,OAAO,CAE3C,OAAQ,SAER,QAAS,UAET,QAAS,UAET,QAAS,UAET,OAAQ,QACV,CAAU,EAOEC,EAAL,SAAA,EAAA,OAEL,GAAAC,QAAA,UAEA,EAAAC,KAAA,OAEA,EAAAC,OAAA,SAEA,EAAAC,OAAA,SAEA,EAAAC,MAAA,QAEA,EAAAC,MAAA,SACF,EAAA,CAAA,CAAA,EAGYC,EAAL,SAAA,EAAA,OAEL,GAAAC,KAAA,OAEA,EAAAC,MAAA,QAEA,EAAAC,OAAA,UACF,EAAA,CAAA,CAAA,EAOaC,EAAkB,OAAO,OAAO,CAE3C,SAAU,WAEV,aAAc,eAEd,UAAW,YAEX,SAAU,WAEV,SAAU,WAEV,QAAS,UAMT,WAAY,aAKZ,iBAAkB,kBACpB,CAAU,EAUGC,EAAuB,OAAO,OAAO,CAKhD,mBAAoB,qBAEpB,sBAAuB,wBAEvB,4BAA6B,8BAO7B,oBAAqB,sBAQrB,yBAA0B,2BAO1B,eAAgB,gBAClB,CAAU,EAsJEC,EAAL,SAAA,EAAA,OAML,GAAAC,QAAA,UAKA,EAAAC,aAAA,gBACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"descriptor.cjs","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 WindowFunction,\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 /** A declared dataset, such as a ClickHouse wide table: `dataset/{context}/{dataset}/*`. */\n DATASET: 'DATASET',\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 * The most groups an aggregation may read where the server computes part of\n * it (HAVING, a metric sort, dense fill or windows its storage cannot run),\n * beyond which the query fails; `null` or absent is unlimited. Absent from\n * servers before Wow 9.10.\n */\n maxResidualGroups?: number | null;\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 * The window functions a derived metric may compute over the groups; empty\n * when expensive operators are off. Absent from servers before Wow 9.9,\n * which compute no windows.\n */\n windows?: WindowFunction[];\n /**\n * Whether a group of a query that expands elements may name a field of the\n * root record (`scope: 'ROOT'`); `false` when expensive operators are off.\n * Absent from servers before Wow 9.9, which group elements by element\n * fields only.\n */\n rootGroups?: boolean;\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 zone a request that names none is read in: UTC (review R4-Q, Q-10). */\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":"AAuCA,IAAaA,EAAc,OAAO,OAAO,CAEvC,SAAU,WAEV,aAAc,eAEd,QAAS,SACX,CAAU,EAUGC,EAAkB,OAAO,OAAO,CAE3C,OAAQ,SAER,QAAS,UAET,QAAS,UAET,QAAS,UAET,OAAQ,QACV,CAAU,EAOEC,EAAL,SAAA,EAAA,OAEL,GAAAC,QAAA,UAEA,EAAAC,KAAA,OAEA,EAAAC,OAAA,SAEA,EAAAC,OAAA,SAEA,EAAAC,MAAA,QAEA,EAAAC,MAAA,SACF,EAAA,CAAA,CAAA,EAGYC,EAAL,SAAA,EAAA,OAEL,GAAAC,KAAA,OAEA,EAAAC,MAAA,QAEA,EAAAC,OAAA,UACF,EAAA,CAAA,CAAA,EAOaC,EAAkB,OAAO,OAAO,CAE3C,SAAU,WAEV,aAAc,eAEd,UAAW,YAEX,SAAU,WAEV,SAAU,WAEV,QAAS,UAMT,WAAY,aAKZ,iBAAkB,kBACpB,CAAU,EAUGC,EAAuB,OAAO,OAAO,CAKhD,mBAAoB,qBAEpB,sBAAuB,wBAEvB,4BAA6B,8BAO7B,oBAAqB,sBAQrB,yBAA0B,2BAO1B,eAAgB,gBAClB,CAAU,EAsJEC,EAAL,SAAA,EAAA,OAML,GAAAC,QAAA,UAKA,EAAAC,aAAA,gBACF,EAAA,CAAA,CAAA"}
@@ -461,6 +461,13 @@ export interface AggregationLimitsDescriptor {
461
461
  maxExpressionDepth: number;
462
462
  /** Most nodes in one arithmetic expression. */
463
463
  maxExpressionNodes: number;
464
+ /**
465
+ * The most groups an aggregation may read where the server computes part of
466
+ * it (HAVING, a metric sort, dense fill or windows its storage cannot run),
467
+ * beyond which the query fails; `null` or absent is unlimited. Absent from
468
+ * servers before Wow 9.10.
469
+ */
470
+ maxResidualGroups?: number | null;
464
471
  }
465
472
  /**
466
473
  * The effective limits of the entry the descriptor was read from: the
@@ -619,7 +626,7 @@ export interface QueryModelDescriptor {
619
626
  model: QueryModel;
620
627
  /** `sha256:` and the hash of its content; also the ETag, quoted. */
621
628
  version: string;
622
- /** The server's default time zone, used when a request names none. */
629
+ /** The zone a request that names none is read in: UTC (review R4-Q, Q-10). */
623
630
  timeZone: string;
624
631
  /** What holds for the records as a whole. */
625
632
  record: RecordDescriptor;
@@ -461,6 +461,13 @@ export interface AggregationLimitsDescriptor {
461
461
  maxExpressionDepth: number;
462
462
  /** Most nodes in one arithmetic expression. */
463
463
  maxExpressionNodes: number;
464
+ /**
465
+ * The most groups an aggregation may read where the server computes part of
466
+ * it (HAVING, a metric sort, dense fill or windows its storage cannot run),
467
+ * beyond which the query fails; `null` or absent is unlimited. Absent from
468
+ * servers before Wow 9.10.
469
+ */
470
+ maxResidualGroups?: number | null;
464
471
  }
465
472
  /**
466
473
  * The effective limits of the entry the descriptor was read from: the
@@ -619,7 +626,7 @@ export interface QueryModelDescriptor {
619
626
  model: QueryModel;
620
627
  /** `sha256:` and the hash of its content; also the ETag, quoted. */
621
628
  version: string;
622
- /** The server's default time zone, used when a request names none. */
629
+ /** The zone a request that names none is read in: UTC (review R4-Q, Q-10). */
623
630
  timeZone: string;
624
631
  /** What holds for the records as a whole. */
625
632
  record: RecordDescriptor;
@@ -1 +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 WindowFunction,\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 /** A declared dataset, such as a ClickHouse wide table: `dataset/{context}/{dataset}/*`. */\n DATASET: 'DATASET',\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 * The window functions a derived metric may compute over the groups; empty\n * when expensive operators are off. Absent from servers before Wow 9.9,\n * which compute no windows.\n */\n windows?: WindowFunction[];\n /**\n * Whether a group of a query that expands elements may name a field of the\n * root record (`scope: 'ROOT'`); `false` when expensive operators are off.\n * Absent from servers before Wow 9.9, which group elements by element\n * fields only.\n */\n rootGroups?: boolean;\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":";AAuCA,IAAaA,IAAc,OAAO,OAAO;CAEvC,UAAU;CAEV,cAAc;CAEd,SAAS;AACX,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"}
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 WindowFunction,\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 /** A declared dataset, such as a ClickHouse wide table: `dataset/{context}/{dataset}/*`. */\n DATASET: 'DATASET',\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 * The most groups an aggregation may read where the server computes part of\n * it (HAVING, a metric sort, dense fill or windows its storage cannot run),\n * beyond which the query fails; `null` or absent is unlimited. Absent from\n * servers before Wow 9.10.\n */\n maxResidualGroups?: number | null;\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 * The window functions a derived metric may compute over the groups; empty\n * when expensive operators are off. Absent from servers before Wow 9.9,\n * which compute no windows.\n */\n windows?: WindowFunction[];\n /**\n * Whether a group of a query that expands elements may name a field of the\n * root record (`scope: 'ROOT'`); `false` when expensive operators are off.\n * Absent from servers before Wow 9.9, which group elements by element\n * fields only.\n */\n rootGroups?: boolean;\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 zone a request that names none is read in: UTC (review R4-Q, Q-10). */\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":";AAuCA,IAAaA,IAAc,OAAO,OAAO;CAEvC,UAAU;CAEV,cAAc;CAEd,SAAS;AACX,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"}
@@ -1,6 +1,6 @@
1
1
  /**
2
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
3
+ * It is the default row of `QueryModelClient.aggregate`, keyed by the aliases of the
4
4
  * query's groups and metrics.
5
5
  */
6
6
  export type DynamicDocument = Record<string, unknown>;
@@ -1,6 +1,6 @@
1
1
  /**
2
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
3
+ * It is the default row of `QueryModelClient.aggregate`, keyed by the aliases of the
4
4
  * query's groups and metrics.
5
5
  */
6
6
  export type DynamicDocument = Record<string, unknown>;
@@ -174,7 +174,8 @@ export interface SearchFilterOptions<FIELDS extends string = string> {
174
174
  export interface RelativeTimeFilterOptions {
175
175
  /**
176
176
  * Time zone that defines calendar days, e.g. `Asia/Shanghai` or `+08:00`.
177
- * Defaults to the server process time zone. Must not be blank. A value
177
+ * Sent only when set; without it the server reads the days in UTC, never
178
+ * in its own zone (review R4-Q, Q-10). Must not be blank. A value
178
179
  * that starts with an optional `UTC`, `GMT` or `UT` prefix followed by `+`
179
180
  * or `-` must be a valid offset within +/-18:00; region IDs are checked by
180
181
  * the server only.
@@ -174,7 +174,8 @@ export interface SearchFilterOptions<FIELDS extends string = string> {
174
174
  export interface RelativeTimeFilterOptions {
175
175
  /**
176
176
  * Time zone that defines calendar days, e.g. `Asia/Shanghai` or `+08:00`.
177
- * Defaults to the server process time zone. Must not be blank. A value
177
+ * Sent only when set; without it the server reads the days in UTC, never
178
+ * in its own zone (review R4-Q, Q-10). Must not be blank. A value
178
179
  * that starts with an optional `UTC`, `GMT` or `UT` prefix followed by `+`
179
180
  * or `-` must be a valid offset within +/-18:00; region IDs are checked by
180
181
  * the server only.
@@ -1 +1 @@
1
- {"version":3,"file":"projection.cjs","names":["queryField","require_field","projection","include","exclude"],"sources":["../../src/dsl/projection.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 { queryField } from './field.js';\n\n/**\n * Interface for field projection.\n */\nexport interface Projection<FIELDS extends string = string> {\n include?: FIELDS[];\n exclude?: FIELDS[];\n}\n\n/**\n * Creates a Projection object with the provided parameters.\n *\n * This function is a factory for creating Projection objects, which represent\n * field projection specifications for queries. It allows specifying which fields\n * to include or exclude in query results.\n *\n * @param options - The projection options. Defaults to none, which includes\n * every field.\n * @param options.include - Array of field names to include in the projection. Optional.\n * @param options.exclude - Array of field names to exclude from the projection. Optional.\n * @returns A Projection object with the specified parameters\n */\nexport function projection<FIELDS extends string = string>({\n include,\n exclude,\n}: Projection<FIELDS> = {}): Projection<FIELDS> {\n // Kotlin holds these as `QueryField`, which refuses a path its pattern does\n // not match. A projection entry is a path like any other. Both keys stay\n // present whether or not they were given: the shape this factory returns is\n // its own contract, and validating a path is no reason to change it.\n return {\n include: include?.map(queryField),\n exclude: exclude?.map(queryField),\n };\n}\n\n/**\n * Interface for objects that support field projection.\n */\nexport interface ProjectionCapable<FIELDS extends string = string> {\n projection?: Projection<FIELDS>;\n}\n"],"mappings":"+BAoCA,SAAgBE,EAA2C,CACzD,UACA,WACsB,CAAC,EAAuB,CAK9C,MAAO,CACL,QAASC,GAAS,IAAIH,EAAAA,UAAU,EAChC,QAASI,GAAS,IAAIJ,EAAAA,UAAU,CAClC,CACF"}
1
+ {"version":3,"file":"projection.cjs","names":["queryField","require_field","projection","include","exclude"],"sources":["../../src/dsl/projection.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 { queryField } from './field.js';\n\n/**\n * Interface for field projection.\n */\nexport interface Projection<FIELDS extends string = string> {\n include?: FIELDS[];\n exclude?: FIELDS[];\n}\n\n/** The first segment of a dotted path. */\ntype Head<P extends string> = P extends `${infer H}.${string}` ? H : P;\n\n/** What follows `K.` in the dotted paths of `P`. */\ntype Tail<P extends string, K extends string> = P extends `${K}.${infer R}`\n ? R\n : never;\n\n/**\n * `T` with only the dotted paths `P` (and the objects that lead to them): an\n * included path keeps its descendants, an array its items' paths, and a\n * nullable or optional value stays so.\n */\nexport type PickPaths<T, P extends string> = T extends readonly (infer E)[]\n ? PickPaths<E, P>[]\n : T extends object\n ? {\n [K in keyof T as K extends Head<P> ? K : never]: K extends P\n ? T[K]\n : PickPaths<T[K], Tail<P, K & string>>;\n }\n : T;\n\n/**\n * The records of type `R` a query whose projection includes the paths\n * `INCLUDE` returns (review R4-Q, Q-14): `R` narrowed to those paths\n * ({@link PickPaths}), or `R` itself when they are not literal. A query\n * client answers so for a query whose `include` it sees as literal paths;\n * any other query (an exclusion alone, or one whose projection is optional,\n * as the DSL builds it) answers whole records.\n */\nexport type Projected<R, INCLUDE extends string> = string extends INCLUDE\n ? R\n : PickPaths<R, INCLUDE>;\n\n/**\n * Creates a Projection object with the provided parameters.\n *\n * This function is a factory for creating Projection objects, which represent\n * field projection specifications for queries. It allows specifying which fields\n * to include or exclude in query results.\n *\n * @param options - The projection options. Defaults to none, which includes\n * every field.\n * @param options.include - Array of field names to include in the projection. Optional.\n * @param options.exclude - Array of field names to exclude from the projection. Optional.\n * @returns A Projection object with the specified parameters\n */\nexport function projection<FIELDS extends string = string>({\n include,\n exclude,\n}: Projection<FIELDS> = {}): Projection<FIELDS> {\n // Kotlin holds these as `QueryField`, which refuses a path its pattern does\n // not match. A projection entry is a path like any other. Both keys stay\n // present whether or not they were given: the shape this factory returns is\n // its own contract, and validating a path is no reason to change it.\n return {\n include: include?.map(queryField),\n exclude: exclude?.map(queryField),\n };\n}\n\n/**\n * Interface for objects that support field projection.\n */\nexport interface ProjectionCapable<FIELDS extends string = string> {\n projection?: Projection<FIELDS>;\n}\n"],"mappings":"+BAuEA,SAAgBE,EAA2C,CACzD,UACA,WACsB,CAAC,EAAuB,CAK9C,MAAO,CACL,QAASC,GAAS,IAAIH,EAAAA,UAAU,EAChC,QAASI,GAAS,IAAIJ,EAAAA,UAAU,CAClC,CACF"}
@@ -5,6 +5,27 @@ export interface Projection<FIELDS extends string = string> {
5
5
  include?: FIELDS[];
6
6
  exclude?: FIELDS[];
7
7
  }
8
+ /** The first segment of a dotted path. */
9
+ type Head<P extends string> = P extends `${infer H}.${string}` ? H : P;
10
+ /** What follows `K.` in the dotted paths of `P`. */
11
+ type Tail<P extends string, K extends string> = P extends `${K}.${infer R}` ? R : never;
12
+ /**
13
+ * `T` with only the dotted paths `P` (and the objects that lead to them): an
14
+ * included path keeps its descendants, an array its items' paths, and a
15
+ * nullable or optional value stays so.
16
+ */
17
+ export type PickPaths<T, P extends string> = T extends readonly (infer E)[] ? PickPaths<E, P>[] : T extends object ? {
18
+ [K in keyof T as K extends Head<P> ? K : never]: K extends P ? T[K] : PickPaths<T[K], Tail<P, K & string>>;
19
+ } : T;
20
+ /**
21
+ * The records of type `R` a query whose projection includes the paths
22
+ * `INCLUDE` returns (review R4-Q, Q-14): `R` narrowed to those paths
23
+ * ({@link PickPaths}), or `R` itself when they are not literal. A query
24
+ * client answers so for a query whose `include` it sees as literal paths;
25
+ * any other query (an exclusion alone, or one whose projection is optional,
26
+ * as the DSL builds it) answers whole records.
27
+ */
28
+ export type Projected<R, INCLUDE extends string> = string extends INCLUDE ? R : PickPaths<R, INCLUDE>;
8
29
  /**
9
30
  * Creates a Projection object with the provided parameters.
10
31
  *
@@ -25,3 +46,4 @@ export declare function projection<FIELDS extends string = string>({ include, ex
25
46
  export interface ProjectionCapable<FIELDS extends string = string> {
26
47
  projection?: Projection<FIELDS>;
27
48
  }
49
+ export {};
@@ -5,6 +5,27 @@ export interface Projection<FIELDS extends string = string> {
5
5
  include?: FIELDS[];
6
6
  exclude?: FIELDS[];
7
7
  }
8
+ /** The first segment of a dotted path. */
9
+ type Head<P extends string> = P extends `${infer H}.${string}` ? H : P;
10
+ /** What follows `K.` in the dotted paths of `P`. */
11
+ type Tail<P extends string, K extends string> = P extends `${K}.${infer R}` ? R : never;
12
+ /**
13
+ * `T` with only the dotted paths `P` (and the objects that lead to them): an
14
+ * included path keeps its descendants, an array its items' paths, and a
15
+ * nullable or optional value stays so.
16
+ */
17
+ export type PickPaths<T, P extends string> = T extends readonly (infer E)[] ? PickPaths<E, P>[] : T extends object ? {
18
+ [K in keyof T as K extends Head<P> ? K : never]: K extends P ? T[K] : PickPaths<T[K], Tail<P, K & string>>;
19
+ } : T;
20
+ /**
21
+ * The records of type `R` a query whose projection includes the paths
22
+ * `INCLUDE` returns (review R4-Q, Q-14): `R` narrowed to those paths
23
+ * ({@link PickPaths}), or `R` itself when they are not literal. A query
24
+ * client answers so for a query whose `include` it sees as literal paths;
25
+ * any other query (an exclusion alone, or one whose projection is optional,
26
+ * as the DSL builds it) answers whole records.
27
+ */
28
+ export type Projected<R, INCLUDE extends string> = string extends INCLUDE ? R : PickPaths<R, INCLUDE>;
8
29
  /**
9
30
  * Creates a Projection object with the provided parameters.
10
31
  *
@@ -25,3 +46,4 @@ export declare function projection<FIELDS extends string = string>({ include, ex
25
46
  export interface ProjectionCapable<FIELDS extends string = string> {
26
47
  projection?: Projection<FIELDS>;
27
48
  }
49
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"projection.es.js","names":["projection","include","queryField","exclude"],"sources":["../../src/dsl/projection.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 { queryField } from './field.js';\n\n/**\n * Interface for field projection.\n */\nexport interface Projection<FIELDS extends string = string> {\n include?: FIELDS[];\n exclude?: FIELDS[];\n}\n\n/**\n * Creates a Projection object with the provided parameters.\n *\n * This function is a factory for creating Projection objects, which represent\n * field projection specifications for queries. It allows specifying which fields\n * to include or exclude in query results.\n *\n * @param options - The projection options. Defaults to none, which includes\n * every field.\n * @param options.include - Array of field names to include in the projection. Optional.\n * @param options.exclude - Array of field names to exclude from the projection. Optional.\n * @returns A Projection object with the specified parameters\n */\nexport function projection<FIELDS extends string = string>({\n include,\n exclude,\n}: Projection<FIELDS> = {}): Projection<FIELDS> {\n // Kotlin holds these as `QueryField`, which refuses a path its pattern does\n // not match. A projection entry is a path like any other. Both keys stay\n // present whether or not they were given: the shape this factory returns is\n // its own contract, and validating a path is no reason to change it.\n return {\n include: include?.map(queryField),\n exclude: exclude?.map(queryField),\n };\n}\n\n/**\n * Interface for objects that support field projection.\n */\nexport interface ProjectionCapable<FIELDS extends string = string> {\n projection?: Projection<FIELDS>;\n}\n"],"mappings":";;AAoCA,SAAgBA,EAA2C,EACzD,YACA,eACsB,CAAC,GAAuB;CAK9C,OAAO;EACL,SAASC,GAAS,IAAIC,CAAU;EAChC,SAASC,GAAS,IAAID,CAAU;CAClC;AACF"}
1
+ {"version":3,"file":"projection.es.js","names":["projection","include","queryField","exclude"],"sources":["../../src/dsl/projection.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 { queryField } from './field.js';\n\n/**\n * Interface for field projection.\n */\nexport interface Projection<FIELDS extends string = string> {\n include?: FIELDS[];\n exclude?: FIELDS[];\n}\n\n/** The first segment of a dotted path. */\ntype Head<P extends string> = P extends `${infer H}.${string}` ? H : P;\n\n/** What follows `K.` in the dotted paths of `P`. */\ntype Tail<P extends string, K extends string> = P extends `${K}.${infer R}`\n ? R\n : never;\n\n/**\n * `T` with only the dotted paths `P` (and the objects that lead to them): an\n * included path keeps its descendants, an array its items' paths, and a\n * nullable or optional value stays so.\n */\nexport type PickPaths<T, P extends string> = T extends readonly (infer E)[]\n ? PickPaths<E, P>[]\n : T extends object\n ? {\n [K in keyof T as K extends Head<P> ? K : never]: K extends P\n ? T[K]\n : PickPaths<T[K], Tail<P, K & string>>;\n }\n : T;\n\n/**\n * The records of type `R` a query whose projection includes the paths\n * `INCLUDE` returns (review R4-Q, Q-14): `R` narrowed to those paths\n * ({@link PickPaths}), or `R` itself when they are not literal. A query\n * client answers so for a query whose `include` it sees as literal paths;\n * any other query (an exclusion alone, or one whose projection is optional,\n * as the DSL builds it) answers whole records.\n */\nexport type Projected<R, INCLUDE extends string> = string extends INCLUDE\n ? R\n : PickPaths<R, INCLUDE>;\n\n/**\n * Creates a Projection object with the provided parameters.\n *\n * This function is a factory for creating Projection objects, which represent\n * field projection specifications for queries. It allows specifying which fields\n * to include or exclude in query results.\n *\n * @param options - The projection options. Defaults to none, which includes\n * every field.\n * @param options.include - Array of field names to include in the projection. Optional.\n * @param options.exclude - Array of field names to exclude from the projection. Optional.\n * @returns A Projection object with the specified parameters\n */\nexport function projection<FIELDS extends string = string>({\n include,\n exclude,\n}: Projection<FIELDS> = {}): Projection<FIELDS> {\n // Kotlin holds these as `QueryField`, which refuses a path its pattern does\n // not match. A projection entry is a path like any other. Both keys stay\n // present whether or not they were given: the shape this factory returns is\n // its own contract, and validating a path is no reason to change it.\n return {\n include: include?.map(queryField),\n exclude: exclude?.map(queryField),\n };\n}\n\n/**\n * Interface for objects that support field projection.\n */\nexport interface ProjectionCapable<FIELDS extends string = string> {\n projection?: Projection<FIELDS>;\n}\n"],"mappings":";;AAuEA,SAAgBA,EAA2C,EACzD,YACA,eACsB,CAAC,GAAuB;CAK9C,OAAO;EACL,SAASC,GAAS,IAAIC,CAAU;EAChC,SAASC,GAAS,IAAID,CAAU;CAClC;AACF"}
@@ -0,0 +1,2 @@
1
+ var e=Object.freeze({INVALID_JSON:`INVALID_JSON`,BODY_NOT_OBJECT:`BODY_NOT_OBJECT`,EMPTY_BODY:`EMPTY_BODY`,UNKNOWN_PROPERTY:`UNKNOWN_PROPERTY`,UNKNOWN_TYPE:`UNKNOWN_TYPE`,UNKNOWN_VALUE:`UNKNOWN_VALUE`,INVALID_VALUE:`INVALID_VALUE`,INVALID_REQUEST:`INVALID_REQUEST`,CURSOR_SORT_DUPLICATE:`CURSOR_SORT_DUPLICATE`,CURSOR_SORT_TOO_MANY:`CURSOR_SORT_TOO_MANY`,INVALID_CURSOR:`INVALID_CURSOR`,SIZE_OUT_OF_RANGE:`SIZE_OUT_OF_RANGE`,FILTER_TOO_LARGE:`FILTER_TOO_LARGE`,EXPENSIVE_OPERATOR_DISABLED:`EXPENSIVE_OPERATOR_DISABLED`,COUNT_REQUIRES_FILTER:`COUNT_REQUIRES_FILTER`,RESIDUAL_GROUPS_EXCEEDED:`RESIDUAL_GROUPS_EXCEEDED`,EXPLICIT_ENTRY_REQUIRED:`EXPLICIT_ENTRY_REQUIRED`,REPLAY_TOO_LONG:`REPLAY_TOO_LONG`,UNKNOWN_FIELD:`UNKNOWN_FIELD`,UNSUPPORTED_CAPABILITY:`UNSUPPORTED_CAPABILITY`,ELEMENT_SCOPE_REQUIRED:`ELEMENT_SCOPE_REQUIRED`,VALUE_MISMATCH:`VALUE_MISMATCH`,NOT_COLLECTION:`NOT_COLLECTION`,NOT_SINGLE_STRING:`NOT_SINGLE_STRING`,MODEL_SEARCH_UNSUPPORTED:`MODEL_SEARCH_UNSUPPORTED`,CURSOR_NOT_ALLOWED:`CURSOR_NOT_ALLOWED`,PROTECTED_AGGREGATION:`PROTECTED_AGGREGATION`,PROTECTED_COMPARISON:`PROTECTED_COMPARISON`,MISSING_KEY_REQUIRES_STRING:`MISSING_KEY_REQUIRES_STRING`,ANY_REQUIRES_SINGLE_VALUE:`ANY_REQUIRES_SINGLE_VALUE`,INCOMPLETE_PROJECTION:`INCOMPLETE_PROJECTION`,METRIC_FILTER_SEARCH:`METRIC_FILTER_SEARCH`,METRIC_FILTER_ELEMENT_MATCH:`METRIC_FILTER_ELEMENT_MATCH`,METRIC_FILTER_ARRAY_FIELD:`METRIC_FILTER_ARRAY_FIELD`,NOT_PROJECTABLE:`NOT_PROJECTABLE`,EVENT_PROJECTION_TYPE_REQUIRED:`EVENT_PROJECTION_TYPE_REQUIRED`,TEMPORAL_REPRESENTATION_REQUIRED:`TEMPORAL_REPRESENTATION_REQUIRED`,TEMPORAL_CONFIGURATION_CONFLICT:`TEMPORAL_CONFIGURATION_CONFLICT`,PARALLEL_ARRAY_SORT:`PARALLEL_ARRAY_SORT`,ARRAY_EQUALITY:`ARRAY_EQUALITY`,FIRST_LAST_REQUIRES_SINGLE_VALUE:`FIRST_LAST_REQUIRES_SINGLE_VALUE`,FIRST_LAST_REQUIRES_ORDER_BY:`FIRST_LAST_REQUIRES_ORDER_BY`,TEMPORAL_AGGREGATION_UNSUPPORTED:`TEMPORAL_AGGREGATION_UNSUPPORTED`,SORT_TOO_MANY:`SORT_TOO_MANY`,SORT_FIELD_DUPLICATE:`SORT_FIELD_DUPLICATE`,IDENTITY_UNDEFINED:`IDENTITY_UNDEFINED`,STORAGE_UNSUPPORTED:`STORAGE_UNSUPPORTED`,PREVIOUS_UNSHIFTABLE:`PREVIOUS_UNSHIFTABLE`});exports.QueryErrorCodes=e;
2
+ //# sourceMappingURL=queryErrorCodes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryErrorCodes.cjs","names":["QueryErrorCodes"],"sources":["../../src/dsl/queryErrorCodes.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 * The codes the violations of a rejected query carry: which rule the request\n * broke, stable where the human text is not. A query route answers a query it\n * refuses with the problem `wow.query.invalid` (`WowProblemError`), each of\n * whose `violations` names one of these codes and where it applies.\n *\n * Mirrors `QueryErrorCodes` in\n * `api/query-api/src/main/kotlin/me/ahoo/wow/api/query/QueryErrorCodes.kt`.\n * The list is open: Wow adds codes and never renames or reuses one, so a\n * client treats a code it does not know as a generic rejection and shows the\n * violation's message. {@link QueryErrorCode} admits those codes too.\n *\n * A violation's `path` locates it three ways:\n * - decoding the request body: the JSON path of the offending value, such as\n * `filter.state` or `metrics[0]`, or `body` for the body as a whole;\n * - the entry's budget and gates: the part of the request the rule bounds,\n * such as `limit` or `filter`;\n * - admission against the query model: the absolute logical field path, such\n * as `state.items.sku`, or `''` when the rule is about the model rather\n * than one field.\n */\nexport const QueryErrorCodes = Object.freeze({\n /** The body is not valid JSON. */\n INVALID_JSON: 'INVALID_JSON',\n /** The body is JSON but not an object. */\n BODY_NOT_OBJECT: 'BODY_NOT_OBJECT',\n /** The body is empty. */\n EMPTY_BODY: 'EMPTY_BODY',\n /** The body has a property the query type does not declare. */\n UNKNOWN_PROPERTY: 'UNKNOWN_PROPERTY',\n /** An `op`, metric or other type discriminator names no known type. */\n UNKNOWN_TYPE: 'UNKNOWN_TYPE',\n /** An enum value is not one the server knows. */\n UNKNOWN_VALUE: 'UNKNOWN_VALUE',\n /** A value is missing or has the wrong JSON type. */\n INVALID_VALUE: 'INVALID_VALUE',\n /** Any other request rule; the message names it. */\n INVALID_REQUEST: 'INVALID_REQUEST',\n /** A cursor sort names a field twice; `path` is the repeated field. */\n CURSOR_SORT_DUPLICATE: 'CURSOR_SORT_DUPLICATE',\n /** A cursor sort has too many fields once the identity tie-breaker is appended. */\n CURSOR_SORT_TOO_MANY: 'CURSOR_SORT_TOO_MANY',\n /**\n * The cursor token was not issued for this model and effective sort, or\n * does not decode; `path` is `cursor`. Start again from the first page.\n */\n INVALID_CURSOR: 'INVALID_CURSOR',\n /**\n * The entry's budget: a list or aggregation `limit`, a page's index, size,\n * window or offset, or a cursor page's `size` is out of range; `path` names\n * which (`limit`, `pagination.size`, `size`, …).\n */\n SIZE_OUT_OF_RANGE: 'SIZE_OUT_OF_RANGE',\n /**\n * The entry's budget: the filter or `having` has too many nodes or values;\n * `path` is `filter` or `having`.\n */\n FILTER_TOO_LARGE: 'FILTER_TOO_LARGE',\n /**\n * The entry does not allow expensive operators, and the query uses one: an\n * operator, an element expansion, a metric sort, an arithmetic or\n * expression group, a date part, a dense fill or FIRST / LAST; `path` names\n * the part (`filter`, `elements`, `sort`, `metrics`, `groupBy`).\n */\n EXPENSIVE_OPERATOR_DISABLED: 'EXPENSIVE_OPERATOR_DISABLED',\n /**\n * A counting query (count, or a paged query's total) would match every\n * record, which the entry refuses; `path` is `filter`.\n */\n COUNT_REQUIRES_FILTER: 'COUNT_REQUIRES_FILTER',\n /**\n * A `having` or metric sort the storage evaluates after grouping read more\n * groups than the server allows; `path` is `body`. It may end a stream\n * partway through.\n */\n RESIDUAL_GROUPS_EXCEEDED: 'RESIDUAL_GROUPS_EXCEEDED',\n /**\n * An in-process query named no entry where one is required. Never\n * answered over HTTP; listed so the mirror stays complete.\n */\n EXPLICIT_ENTRY_REQUIRED: 'EXPLICIT_ENTRY_REQUIRED',\n /**\n * A state point read (`GET …/{id}/state?version=|at=`, `…/state/trace`): the\n * state asked for is more commits away from the snapshot, or from version 1,\n * than a state read replays. The path is the query parameter.\n */\n REPLAY_TOO_LONG: 'REPLAY_TOO_LONG',\n /** The model has no such logical field. */\n UNKNOWN_FIELD: 'UNKNOWN_FIELD',\n /** The field does not offer the capability the query uses (sort, range, …). */\n UNSUPPORTED_CAPABILITY: 'UNSUPPORTED_CAPABILITY',\n /** The field is an element field and must be queried inside its element scope. */\n ELEMENT_SCOPE_REQUIRED: 'ELEMENT_SCOPE_REQUIRED',\n /** A filter value falls outside the field's declared domain. */\n VALUE_MISMATCH: 'VALUE_MISMATCH',\n /** The field is not a known collection (for example under `isEmpty`). */\n NOT_COLLECTION: 'NOT_COLLECTION',\n /** The field is not a single string. */\n NOT_SINGLE_STRING: 'NOT_SINGLE_STRING',\n /** The model does not support search. */\n MODEL_SEARCH_UNSUPPORTED: 'MODEL_SEARCH_UNSUPPORTED',\n /** The field cannot be used for a cursor. */\n CURSOR_NOT_ALLOWED: 'CURSOR_NOT_ALLOWED',\n /** The field is protected and cannot be aggregated. */\n PROTECTED_AGGREGATION: 'PROTECTED_AGGREGATION',\n /**\n * The field is protected and cannot be filtered or sorted: its descriptor\n * says `sensitivity.comparable: false`. A search that names it is refused\n * the same way.\n */\n PROTECTED_COMPARISON: 'PROTECTED_COMPARISON',\n /** A terms group's `missingKey` needs a single-valued string field. */\n MISSING_KEY_REQUIRES_STRING: 'MISSING_KEY_REQUIRES_STRING',\n /** `ANY` needs a single value. */\n ANY_REQUIRES_SINGLE_VALUE: 'ANY_REQUIRES_SINGLE_VALUE',\n /** The storage cannot deliver a complete projection; select fields explicitly. */\n INCOMPLETE_PROJECTION: 'INCOMPLETE_PROJECTION',\n /** A metric filter uses a search filter. */\n METRIC_FILTER_SEARCH: 'METRIC_FILTER_SEARCH',\n /** A metric filter uses `ELEMENT_MATCH`. */\n METRIC_FILTER_ELEMENT_MATCH: 'METRIC_FILTER_ELEMENT_MATCH',\n /** A metric filter names an array field; it must be scalar. */\n METRIC_FILTER_ARRAY_FIELD: 'METRIC_FILTER_ARRAY_FIELD',\n /** The field cannot be projected. */\n NOT_PROJECTABLE: 'NOT_PROJECTABLE',\n /** An event projection that keeps payloads must keep their `bodyType`. */\n EVENT_PROJECTION_TYPE_REQUIRED: 'EVENT_PROJECTION_TYPE_REQUIRED',\n /** A relative-time filter needs a field with a known temporal representation. */\n TEMPORAL_REPRESENTATION_REQUIRED: 'TEMPORAL_REPRESENTATION_REQUIRED',\n /** A relative-time filter's zone, pattern or unit conflicts with the field's definition. */\n TEMPORAL_CONFIGURATION_CONFLICT: 'TEMPORAL_CONFIGURATION_CONFLICT',\n /**\n * A sort names two array fields on independent arrays, which the storage\n * cannot order by together; `path` is the second of them. The descriptor\n * lists such fields under a `PARALLEL_ARRAY_SORT` constraint.\n */\n PARALLEL_ARRAY_SORT: 'PARALLEL_ARRAY_SORT',\n /**\n * An `EQ` or `NE` compares the field to an array, which the storage cannot\n * do: it takes only a scalar operand. The descriptor says so with an\n * `ARRAY_EQUALITY` constraint.\n */\n ARRAY_EQUALITY: 'ARRAY_EQUALITY',\n /**\n * A `FIRST` or `LAST` metric names a field that may hold several values;\n * it needs a single-valued one (`aggregate.firstLast` in the descriptor).\n */\n FIRST_LAST_REQUIRES_SINGLE_VALUE: 'FIRST_LAST_REQUIRES_SINGLE_VALUE',\n /**\n * A `FIRST` or `LAST` metric names no `orderBy` where there is no event\n * time to order by, such as inside an element or on a model whose\n * descriptor has no `analysis.firstLastOrderBy`; `path` is its field.\n */\n FIRST_LAST_REQUIRES_ORDER_BY: 'FIRST_LAST_REQUIRES_ORDER_BY',\n /**\n * A date group or date difference names a field that stores neither a\n * date nor an epoch (a formatted string, say), so it cannot be aggregated\n * by time.\n */\n TEMPORAL_AGGREGATION_UNSUPPORTED: 'TEMPORAL_AGGREGATION_UNSUPPORTED',\n /** The sort has more fields than the protocol allows; `path` is `''`. */\n SORT_TOO_MANY: 'SORT_TOO_MANY',\n /** Two sort fields name the same stored field; `path` is the second. */\n SORT_FIELD_DUPLICATE: 'SORT_FIELD_DUPLICATE',\n /**\n * An identity filter or a cursor on a model that defines no record\n * identity; `path` is `''`.\n */\n IDENTITY_UNDEFINED: 'IDENTITY_UNDEFINED',\n /**\n * The storage does not support the feature the query uses, or its native\n * query language cannot express it (a MongoDB PHRASE search with a quote,\n * say); `path` is the field, or `''`.\n */\n STORAGE_UNSUPPORTED: 'STORAGE_UNSUPPORTED',\n /**\n * A `PREVIOUS` window steps along a date group whose field the filter\n * conditions where its range cannot be shifted to the earlier period:\n * outside the top-level `AND`, or with a value that is not an instant;\n * `path` is the field.\n */\n PREVIOUS_UNSHIFTABLE: 'PREVIOUS_UNSHIFTABLE',\n} as const);\n\n/** One of the codes this package knows; see {@link QueryErrorCodes}. */\nexport type KnownQueryErrorCode =\n (typeof QueryErrorCodes)[keyof typeof QueryErrorCodes];\n\n/**\n * The code of a rejected query: one this package knows, which editors\n * complete, or one a newer server added.\n */\nexport type QueryErrorCode = KnownQueryErrorCode | (string & {});\n\n/**\n * Why the server rejected a query: one violation of its `wow.query.invalid`\n * problem, which rule failed, where, and the server's words.\n */\nexport interface QueryViolation {\n /** Which rule failed; switch on it against {@link QueryErrorCodes}. */\n code: QueryErrorCode;\n /**\n * Where: the JSON path of the offending value for a decoding error\n * (`filter.state`, `metrics[0]`, `body`), the absolute logical field path\n * for an admission error (`state.items.sku`), or `''` when the rule is about\n * the model rather than a field.\n */\n path: string;\n /** The server's words. */\n message: string;\n}\n"],"mappings":"AAkCA,IAAaA,EAAkB,OAAO,OAAO,CAE3C,aAAc,eAEd,gBAAiB,kBAEjB,WAAY,aAEZ,iBAAkB,mBAElB,aAAc,eAEd,cAAe,gBAEf,cAAe,gBAEf,gBAAiB,kBAEjB,sBAAuB,wBAEvB,qBAAsB,uBAKtB,eAAgB,iBAMhB,kBAAmB,oBAKnB,iBAAkB,mBAOlB,4BAA6B,8BAK7B,sBAAuB,wBAMvB,yBAA0B,2BAK1B,wBAAyB,0BAMzB,gBAAiB,kBAEjB,cAAe,gBAEf,uBAAwB,yBAExB,uBAAwB,yBAExB,eAAgB,iBAEhB,eAAgB,iBAEhB,kBAAmB,oBAEnB,yBAA0B,2BAE1B,mBAAoB,qBAEpB,sBAAuB,wBAMvB,qBAAsB,uBAEtB,4BAA6B,8BAE7B,0BAA2B,4BAE3B,sBAAuB,wBAEvB,qBAAsB,uBAEtB,4BAA6B,8BAE7B,0BAA2B,4BAE3B,gBAAiB,kBAEjB,+BAAgC,iCAEhC,iCAAkC,mCAElC,gCAAiC,kCAMjC,oBAAqB,sBAMrB,eAAgB,iBAKhB,iCAAkC,mCAMlC,6BAA8B,+BAM9B,iCAAkC,mCAElC,cAAe,gBAEf,qBAAsB,uBAKtB,mBAAoB,qBAMpB,oBAAqB,sBAOrB,qBAAsB,sBACxB,CAAU"}