@ahoo-wang/wow-client 10.0.0-alpha.3 → 10.0.0-alpha.5

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 (420) 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/{v10/commands.d.cts → commands.d.cts} +21 -3
  6. package/dist/{v10/commands.d.ts → commands.d.ts} +21 -3
  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 +1 -1
  19. package/dist/dsl/descriptor.d.ts +1 -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/{v10/http.d.cts → http.d.cts} +16 -7
  48. package/dist/{v10/http.d.ts → http.d.ts} +16 -7
  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.map +1 -0
  56. package/dist/{v10/manifest.es.js → manifest.es.js} +1 -1
  57. package/dist/manifest.es.js.map +1 -0
  58. package/dist/problem.cjs +2 -0
  59. package/dist/problem.cjs.map +1 -0
  60. package/dist/{v10/problem.d.cts → problem.d.cts} +51 -4
  61. package/dist/{v10/problem.d.ts → problem.d.ts} +51 -4
  62. package/dist/{v10/problem.es.js → problem.es.js} +30 -11
  63. package/dist/problem.es.js.map +1 -0
  64. package/dist/queries.cjs +2 -0
  65. package/dist/queries.cjs.map +1 -0
  66. package/dist/{v10/queries.d.cts → queries.d.cts} +63 -17
  67. package/dist/{v10/queries.d.ts → queries.d.ts} +63 -17
  68. package/dist/queries.es.js +112 -0
  69. package/dist/queries.es.js.map +1 -0
  70. package/dist/state.cjs +2 -0
  71. package/dist/state.cjs.map +1 -0
  72. package/dist/{v10/state.d.cts → state.d.cts} +26 -4
  73. package/dist/{v10/state.d.ts → state.d.ts} +26 -4
  74. package/dist/state.es.js +70 -0
  75. package/dist/state.es.js.map +1 -0
  76. package/dist/streams.cjs +2 -0
  77. package/dist/streams.cjs.map +1 -0
  78. package/dist/streams.d.cts +74 -0
  79. package/dist/streams.d.ts +74 -0
  80. package/dist/streams.es.js +103 -0
  81. package/dist/streams.es.js.map +1 -0
  82. package/dist/wait.cjs.map +1 -0
  83. package/dist/{v10/wait.es.js → wait.es.js} +1 -1
  84. package/dist/wait.es.js.map +1 -0
  85. package/dist/wire.cjs.map +1 -0
  86. package/dist/{v10/wire.d.cts → wire.d.cts} +32 -7
  87. package/dist/{v10/wire.d.ts → wire.d.ts} +32 -7
  88. package/dist/{v10/wire.es.js → wire.es.js} +1 -1
  89. package/dist/wire.es.js.map +1 -0
  90. package/package.json +4 -26
  91. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.cjs +0 -1
  92. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.es.js +0 -9
  93. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.cjs +0 -1
  94. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.es.js +0 -6
  95. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.cjs +0 -1
  96. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.es.js +0 -8
  97. package/dist/client/bindMethods.cjs +0 -2
  98. package/dist/client/bindMethods.cjs.map +0 -1
  99. package/dist/client/bindMethods.d.cts +0 -13
  100. package/dist/client/bindMethods.d.ts +0 -13
  101. package/dist/client/bindMethods.es.js +0 -19
  102. package/dist/client/bindMethods.es.js.map +0 -1
  103. package/dist/client/command/commandClient.cjs +0 -2
  104. package/dist/client/command/commandClient.cjs.map +0 -1
  105. package/dist/client/command/commandClient.d.cts +0 -67
  106. package/dist/client/command/commandClient.d.ts +0 -67
  107. package/dist/client/command/commandClient.es.js +0 -38
  108. package/dist/client/command/commandClient.es.js.map +0 -1
  109. package/dist/client/command/commandHeaders.cjs +0 -2
  110. package/dist/client/command/commandHeaders.cjs.map +0 -1
  111. package/dist/client/command/commandHeaders.d.cts +0 -75
  112. package/dist/client/command/commandHeaders.d.ts +0 -75
  113. package/dist/client/command/commandHeaders.es.js +0 -31
  114. package/dist/client/command/commandHeaders.es.js.map +0 -1
  115. package/dist/client/command/commandRequest.cjs +0 -2
  116. package/dist/client/command/commandRequest.cjs.map +0 -1
  117. package/dist/client/command/commandRequest.d.cts +0 -180
  118. package/dist/client/command/commandRequest.d.ts +0 -180
  119. package/dist/client/command/commandRequest.es.js +0 -31
  120. package/dist/client/command/commandRequest.es.js.map +0 -1
  121. package/dist/client/command/commandResult.d.cts +0 -15
  122. package/dist/client/command/commandResult.d.ts +0 -15
  123. package/dist/client/command/index.d.cts +0 -5
  124. package/dist/client/command/index.d.ts +0 -5
  125. package/dist/client/command/types.d.cts +0 -71
  126. package/dist/client/command/types.d.ts +0 -71
  127. package/dist/client/metadata/index.d.cts +0 -2
  128. package/dist/client/metadata/index.d.ts +0 -2
  129. package/dist/client/metadata/wowMetadata.d.cts +0 -48
  130. package/dist/client/metadata/wowMetadata.d.ts +0 -48
  131. package/dist/client/metadata/wowMetadataClient.cjs +0 -2
  132. package/dist/client/metadata/wowMetadataClient.cjs.map +0 -1
  133. package/dist/client/metadata/wowMetadataClient.d.cts +0 -23
  134. package/dist/client/metadata/wowMetadataClient.d.ts +0 -23
  135. package/dist/client/metadata/wowMetadataClient.es.js +0 -25
  136. package/dist/client/metadata/wowMetadataClient.es.js.map +0 -1
  137. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs +0 -2
  138. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs.map +0 -1
  139. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.cts +0 -8
  140. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.ts +0 -8
  141. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js +0 -34
  142. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js.map +0 -1
  143. package/dist/client/query/dataset/datasetDirectoryClient.cjs +0 -2
  144. package/dist/client/query/dataset/datasetDirectoryClient.cjs.map +0 -1
  145. package/dist/client/query/dataset/datasetDirectoryClient.d.cts +0 -29
  146. package/dist/client/query/dataset/datasetDirectoryClient.d.ts +0 -29
  147. package/dist/client/query/dataset/datasetDirectoryClient.es.js +0 -25
  148. package/dist/client/query/dataset/datasetDirectoryClient.es.js.map +0 -1
  149. package/dist/client/query/dataset/datasetQueryApi.d.cts +0 -40
  150. package/dist/client/query/dataset/datasetQueryApi.d.ts +0 -40
  151. package/dist/client/query/dataset/datasetQueryClient.cjs +0 -2
  152. package/dist/client/query/dataset/datasetQueryClient.cjs.map +0 -1
  153. package/dist/client/query/dataset/datasetQueryClient.d.cts +0 -57
  154. package/dist/client/query/dataset/datasetQueryClient.d.ts +0 -57
  155. package/dist/client/query/dataset/datasetQueryClient.es.js +0 -154
  156. package/dist/client/query/dataset/datasetQueryClient.es.js.map +0 -1
  157. package/dist/client/query/dataset/endpointPaths.cjs +0 -2
  158. package/dist/client/query/dataset/endpointPaths.cjs.map +0 -1
  159. package/dist/client/query/dataset/endpointPaths.d.cts +0 -9
  160. package/dist/client/query/dataset/endpointPaths.d.ts +0 -9
  161. package/dist/client/query/dataset/endpointPaths.es.js +0 -14
  162. package/dist/client/query/dataset/endpointPaths.es.js.map +0 -1
  163. package/dist/client/query/dataset/index.d.cts +0 -3
  164. package/dist/client/query/dataset/index.d.ts +0 -3
  165. package/dist/client/query/descriptor/descriptorEndpoints.cjs +0 -2
  166. package/dist/client/query/descriptor/descriptorEndpoints.cjs.map +0 -1
  167. package/dist/client/query/descriptor/descriptorEndpoints.d.cts +0 -29
  168. package/dist/client/query/descriptor/descriptorEndpoints.d.ts +0 -29
  169. package/dist/client/query/descriptor/descriptorEndpoints.es.js +0 -69
  170. package/dist/client/query/descriptor/descriptorEndpoints.es.js.map +0 -1
  171. package/dist/client/query/descriptor/endpointPaths.cjs +0 -2
  172. package/dist/client/query/descriptor/endpointPaths.cjs.map +0 -1
  173. package/dist/client/query/descriptor/endpointPaths.d.cts +0 -4
  174. package/dist/client/query/descriptor/endpointPaths.d.ts +0 -4
  175. package/dist/client/query/descriptor/endpointPaths.es.js +0 -9
  176. package/dist/client/query/descriptor/endpointPaths.es.js.map +0 -1
  177. package/dist/client/query/descriptor/index.d.cts +0 -2
  178. package/dist/client/query/descriptor/index.d.ts +0 -2
  179. package/dist/client/query/descriptor/queryDescriptorApi.d.cts +0 -58
  180. package/dist/client/query/descriptor/queryDescriptorApi.d.ts +0 -58
  181. package/dist/client/query/descriptor/queryDescriptorClient.cjs +0 -2
  182. package/dist/client/query/descriptor/queryDescriptorClient.cjs.map +0 -1
  183. package/dist/client/query/descriptor/queryDescriptorClient.d.cts +0 -61
  184. package/dist/client/query/descriptor/queryDescriptorClient.d.ts +0 -61
  185. package/dist/client/query/descriptor/queryDescriptorClient.es.js +0 -20
  186. package/dist/client/query/descriptor/queryDescriptorClient.es.js.map +0 -1
  187. package/dist/client/query/event/endpointPaths.cjs +0 -2
  188. package/dist/client/query/event/endpointPaths.cjs.map +0 -1
  189. package/dist/client/query/event/endpointPaths.d.cts +0 -8
  190. package/dist/client/query/event/endpointPaths.d.ts +0 -8
  191. package/dist/client/query/event/endpointPaths.es.js +0 -13
  192. package/dist/client/query/event/endpointPaths.es.js.map +0 -1
  193. package/dist/client/query/event/eventStreamQueryApi.d.cts +0 -29
  194. package/dist/client/query/event/eventStreamQueryApi.d.ts +0 -29
  195. package/dist/client/query/event/eventStreamQueryClient.cjs +0 -2
  196. package/dist/client/query/event/eventStreamQueryClient.cjs.map +0 -1
  197. package/dist/client/query/event/eventStreamQueryClient.d.cts +0 -193
  198. package/dist/client/query/event/eventStreamQueryClient.d.ts +0 -193
  199. package/dist/client/query/event/eventStreamQueryClient.es.js +0 -160
  200. package/dist/client/query/event/eventStreamQueryClient.es.js.map +0 -1
  201. package/dist/client/query/event/index.d.cts +0 -2
  202. package/dist/client/query/event/index.d.ts +0 -2
  203. package/dist/client/query/factory.cjs +0 -2
  204. package/dist/client/query/factory.cjs.map +0 -1
  205. package/dist/client/query/factory.d.cts +0 -165
  206. package/dist/client/query/factory.d.ts +0 -165
  207. package/dist/client/query/factory.es.js +0 -45
  208. package/dist/client/query/factory.es.js.map +0 -1
  209. package/dist/client/query/index.d.cts +0 -7
  210. package/dist/client/query/index.d.ts +0 -7
  211. package/dist/client/query/queryApi.d.cts +0 -68
  212. package/dist/client/query/queryApi.d.ts +0 -68
  213. package/dist/client/query/requests.d.cts +0 -24
  214. package/dist/client/query/requests.d.ts +0 -24
  215. package/dist/client/query/snapshot/endpointPaths.cjs +0 -2
  216. package/dist/client/query/snapshot/endpointPaths.cjs.map +0 -1
  217. package/dist/client/query/snapshot/endpointPaths.d.cts +0 -12
  218. package/dist/client/query/snapshot/endpointPaths.d.ts +0 -12
  219. package/dist/client/query/snapshot/endpointPaths.es.js +0 -17
  220. package/dist/client/query/snapshot/endpointPaths.es.js.map +0 -1
  221. package/dist/client/query/snapshot/index.d.cts +0 -2
  222. package/dist/client/query/snapshot/index.d.ts +0 -2
  223. package/dist/client/query/snapshot/snapshotQueryApi.d.cts +0 -101
  224. package/dist/client/query/snapshot/snapshotQueryApi.d.ts +0 -101
  225. package/dist/client/query/snapshot/snapshotQueryClient.cjs +0 -2
  226. package/dist/client/query/snapshot/snapshotQueryClient.cjs.map +0 -1
  227. package/dist/client/query/snapshot/snapshotQueryClient.d.cts +0 -372
  228. package/dist/client/query/snapshot/snapshotQueryClient.d.ts +0 -372
  229. package/dist/client/query/snapshot/snapshotQueryClient.es.js +0 -239
  230. package/dist/client/query/snapshot/snapshotQueryClient.es.js.map +0 -1
  231. package/dist/client/query/state/endpointPaths.cjs +0 -2
  232. package/dist/client/query/state/endpointPaths.cjs.map +0 -1
  233. package/dist/client/query/state/endpointPaths.d.cts +0 -10
  234. package/dist/client/query/state/endpointPaths.d.ts +0 -10
  235. package/dist/client/query/state/endpointPaths.es.js +0 -14
  236. package/dist/client/query/state/endpointPaths.es.js.map +0 -1
  237. package/dist/client/query/state/index.d.cts +0 -4
  238. package/dist/client/query/state/index.d.ts +0 -4
  239. package/dist/client/query/state/loadOwnerStateAggregateApi.d.cts +0 -36
  240. package/dist/client/query/state/loadOwnerStateAggregateApi.d.ts +0 -36
  241. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs +0 -2
  242. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs.map +0 -1
  243. package/dist/client/query/state/loadOwnerStateAggregateClient.d.cts +0 -58
  244. package/dist/client/query/state/loadOwnerStateAggregateClient.d.ts +0 -58
  245. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js +0 -56
  246. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js.map +0 -1
  247. package/dist/client/query/state/loadStateAggregateApi.d.cts +0 -37
  248. package/dist/client/query/state/loadStateAggregateApi.d.ts +0 -37
  249. package/dist/client/query/state/loadStateAggregateClient.cjs +0 -2
  250. package/dist/client/query/state/loadStateAggregateClient.cjs.map +0 -1
  251. package/dist/client/query/state/loadStateAggregateClient.d.cts +0 -62
  252. package/dist/client/query/state/loadStateAggregateClient.d.ts +0 -62
  253. package/dist/client/query/state/loadStateAggregateClient.es.js +0 -65
  254. package/dist/client/query/state/loadStateAggregateClient.es.js.map +0 -1
  255. package/dist/client/routing.cjs +0 -2
  256. package/dist/client/routing.cjs.map +0 -1
  257. package/dist/client/routing.d.cts +0 -47
  258. package/dist/client/routing.d.ts +0 -47
  259. package/dist/client/routing.es.js +0 -8
  260. package/dist/client/routing.es.js.map +0 -1
  261. package/dist/error/errorInfo.cjs +0 -2
  262. package/dist/error/errorInfo.cjs.map +0 -1
  263. package/dist/error/errorInfo.d.cts +0 -139
  264. package/dist/error/errorInfo.d.ts +0 -139
  265. package/dist/error/errorInfo.es.js +0 -32
  266. package/dist/error/errorInfo.es.js.map +0 -1
  267. package/dist/error/headers.cjs +0 -2
  268. package/dist/error/headers.cjs.map +0 -1
  269. package/dist/error/headers.d.cts +0 -39
  270. package/dist/error/headers.d.ts +0 -39
  271. package/dist/error/headers.es.js +0 -10
  272. package/dist/error/headers.es.js.map +0 -1
  273. package/dist/error/index.d.cts +0 -21
  274. package/dist/error/index.d.ts +0 -21
  275. package/dist/error/queryErrorCodes.cjs +0 -2
  276. package/dist/error/queryErrorCodes.es.js.map +0 -1
  277. package/dist/error/wowError.cjs +0 -2
  278. package/dist/error/wowError.cjs.map +0 -1
  279. package/dist/error/wowError.d.cts +0 -99
  280. package/dist/error/wowError.d.ts +0 -99
  281. package/dist/error/wowError.es.js +0 -53
  282. package/dist/error/wowError.es.js.map +0 -1
  283. package/dist/legacy/condition.cjs +0 -2
  284. package/dist/legacy/condition.cjs.map +0 -1
  285. package/dist/legacy/condition.d.cts +0 -517
  286. package/dist/legacy/condition.d.ts +0 -517
  287. package/dist/legacy/condition.es.js +0 -338
  288. package/dist/legacy/condition.es.js.map +0 -1
  289. package/dist/legacy/index.d.cts +0 -16
  290. package/dist/legacy/index.d.ts +0 -16
  291. package/dist/legacy/locale/en_US.cjs +0 -2
  292. package/dist/legacy/locale/en_US.cjs.map +0 -1
  293. package/dist/legacy/locale/en_US.d.cts +0 -7
  294. package/dist/legacy/locale/en_US.d.ts +0 -7
  295. package/dist/legacy/locale/en_US.es.js +0 -50
  296. package/dist/legacy/locale/en_US.es.js.map +0 -1
  297. package/dist/legacy/locale/operatorLocale.d.cts +0 -10
  298. package/dist/legacy/locale/operatorLocale.d.ts +0 -10
  299. package/dist/legacy/locale/zh_CN.cjs +0 -2
  300. package/dist/legacy/locale/zh_CN.cjs.map +0 -1
  301. package/dist/legacy/locale/zh_CN.d.cts +0 -7
  302. package/dist/legacy/locale/zh_CN.d.ts +0 -7
  303. package/dist/legacy/locale/zh_CN.es.js +0 -50
  304. package/dist/legacy/locale/zh_CN.es.js.map +0 -1
  305. package/dist/legacy/operator.cjs +0 -2
  306. package/dist/legacy/operator.cjs.map +0 -1
  307. package/dist/legacy/operator.d.cts +0 -218
  308. package/dist/legacy/operator.d.ts +0 -218
  309. package/dist/legacy/operator.es.js +0 -25
  310. package/dist/legacy/operator.es.js.map +0 -1
  311. package/dist/legacy/queryable.cjs +0 -2
  312. package/dist/legacy/queryable.cjs.map +0 -1
  313. package/dist/legacy/queryable.d.cts +0 -61
  314. package/dist/legacy/queryable.d.ts +0 -61
  315. package/dist/legacy/queryable.es.js +0 -34
  316. package/dist/legacy/queryable.es.js.map +0 -1
  317. package/dist/legacy.cjs +0 -1
  318. package/dist/legacy.es.js +0 -6
  319. package/dist/model/abac.cjs +0 -2
  320. package/dist/model/abac.cjs.map +0 -1
  321. package/dist/model/abac.d.cts +0 -33
  322. package/dist/model/abac.d.ts +0 -33
  323. package/dist/model/abac.es.js +0 -6
  324. package/dist/model/abac.es.js.map +0 -1
  325. package/dist/model/bi.cjs +0 -2
  326. package/dist/model/bi.cjs.map +0 -1
  327. package/dist/model/bi.d.cts +0 -12
  328. package/dist/model/bi.d.ts +0 -12
  329. package/dist/model/bi.es.js +0 -8
  330. package/dist/model/bi.es.js.map +0 -1
  331. package/dist/model/command.cjs +0 -2
  332. package/dist/model/command.cjs.map +0 -1
  333. package/dist/model/command.d.cts +0 -137
  334. package/dist/model/command.d.ts +0 -137
  335. package/dist/model/command.es.js +0 -8
  336. package/dist/model/command.es.js.map +0 -1
  337. package/dist/model/common.d.cts +0 -19
  338. package/dist/model/common.d.ts +0 -19
  339. package/dist/model/domainEventStream.cjs +0 -2
  340. package/dist/model/domainEventStream.cjs.map +0 -1
  341. package/dist/model/domainEventStream.d.cts +0 -109
  342. package/dist/model/domainEventStream.d.ts +0 -109
  343. package/dist/model/domainEventStream.es.js +0 -23
  344. package/dist/model/domainEventStream.es.js.map +0 -1
  345. package/dist/model/function.cjs +0 -2
  346. package/dist/model/function.cjs.map +0 -1
  347. package/dist/model/function.d.cts +0 -41
  348. package/dist/model/function.d.ts +0 -41
  349. package/dist/model/function.es.js +0 -8
  350. package/dist/model/function.es.js.map +0 -1
  351. package/dist/model/index.d.cts +0 -24
  352. package/dist/model/index.d.ts +0 -24
  353. package/dist/model/messaging.d.cts +0 -5
  354. package/dist/model/messaging.d.ts +0 -5
  355. package/dist/model/modeling.d.cts +0 -145
  356. package/dist/model/modeling.d.ts +0 -145
  357. package/dist/model/naming.d.cts +0 -27
  358. package/dist/model/naming.d.ts +0 -27
  359. package/dist/model/snapshot.cjs +0 -2
  360. package/dist/model/snapshot.cjs.map +0 -1
  361. package/dist/model/snapshot.d.cts +0 -53
  362. package/dist/model/snapshot.d.ts +0 -53
  363. package/dist/model/snapshot.es.js +0 -20
  364. package/dist/model/snapshot.es.js.map +0 -1
  365. package/dist/transport/endpoints.cjs +0 -2
  366. package/dist/transport/endpoints.cjs.map +0 -1
  367. package/dist/transport/endpoints.d.cts +0 -79
  368. package/dist/transport/endpoints.d.ts +0 -79
  369. package/dist/transport/endpoints.es.js +0 -14
  370. package/dist/transport/endpoints.es.js.map +0 -1
  371. package/dist/transport/eventStreams.cjs +0 -2
  372. package/dist/transport/eventStreams.cjs.map +0 -1
  373. package/dist/transport/eventStreams.d.cts +0 -25
  374. package/dist/transport/eventStreams.d.ts +0 -25
  375. package/dist/transport/eventStreams.es.js +0 -21
  376. package/dist/transport/eventStreams.es.js.map +0 -1
  377. package/dist/transport/index.d.cts +0 -1
  378. package/dist/transport/index.d.ts +0 -1
  379. package/dist/v10/commands.cjs +0 -2
  380. package/dist/v10/commands.cjs.map +0 -1
  381. package/dist/v10/commands.es.js +0 -68
  382. package/dist/v10/commands.es.js.map +0 -1
  383. package/dist/v10/http.cjs +0 -2
  384. package/dist/v10/http.cjs.map +0 -1
  385. package/dist/v10/http.es.js +0 -73
  386. package/dist/v10/http.es.js.map +0 -1
  387. package/dist/v10/index.d.cts +0 -19
  388. package/dist/v10/index.d.ts +0 -19
  389. package/dist/v10/manifest.cjs.map +0 -1
  390. package/dist/v10/manifest.es.js.map +0 -1
  391. package/dist/v10/problem.cjs +0 -2
  392. package/dist/v10/problem.cjs.map +0 -1
  393. package/dist/v10/problem.es.js.map +0 -1
  394. package/dist/v10/queries.cjs +0 -2
  395. package/dist/v10/queries.cjs.map +0 -1
  396. package/dist/v10/queries.es.js +0 -88
  397. package/dist/v10/queries.es.js.map +0 -1
  398. package/dist/v10/state.cjs +0 -2
  399. package/dist/v10/state.cjs.map +0 -1
  400. package/dist/v10/state.es.js +0 -51
  401. package/dist/v10/state.es.js.map +0 -1
  402. package/dist/v10/streams.cjs +0 -2
  403. package/dist/v10/streams.cjs.map +0 -1
  404. package/dist/v10/streams.d.cts +0 -14
  405. package/dist/v10/streams.d.ts +0 -14
  406. package/dist/v10/streams.es.js +0 -22
  407. package/dist/v10/streams.es.js.map +0 -1
  408. package/dist/v10/wait.cjs.map +0 -1
  409. package/dist/v10/wait.es.js.map +0 -1
  410. package/dist/v10/wire.cjs.map +0 -1
  411. package/dist/v10/wire.es.js.map +0 -1
  412. package/dist/v10.cjs +0 -1
  413. package/dist/v10.es.js +0 -9
  414. /package/dist/{v10/manifest.cjs → manifest.cjs} +0 -0
  415. /package/dist/{v10/manifest.d.cts → manifest.d.cts} +0 -0
  416. /package/dist/{v10/manifest.d.ts → manifest.d.ts} +0 -0
  417. /package/dist/{v10/wait.cjs → wait.cjs} +0 -0
  418. /package/dist/{v10/wait.d.cts → wait.d.cts} +0 -0
  419. /package/dist/{v10/wait.d.ts → wait.d.ts} +0 -0
  420. /package/dist/{v10/wire.cjs → wire.cjs} +0 -0
@@ -1,28 +1,23 @@
1
1
  /**
2
- * The codes a rejected query carries as `BindingError.code`: which rule the
3
- * request broke, stable where the human text (`errorMsg`) is not.
2
+ * The codes the violations of a rejected query carry: which rule the request
3
+ * broke, stable where the human text is not. A query route answers a query it
4
+ * refuses with the problem `wow.query.invalid` (`WowProblemError`), each of
5
+ * whose `violations` names one of these codes and where it applies.
4
6
  *
5
7
  * Mirrors `QueryErrorCodes` in
6
- * `wow-api/src/main/kotlin/me/ahoo/wow/api/query/QueryErrorCodes.kt`, which the
7
- * server also publishes as the `BindingError.code` enum of its OpenAPI
8
- * document. The list is open: Wow adds codes and never renames or reuses one,
9
- * so a client treats a code it does not know as a generic rejection and shows
10
- * `errorMsg`. {@link QueryErrorCode} admits those codes too.
8
+ * `api/query-api/src/main/kotlin/me/ahoo/wow/api/query/QueryErrorCodes.kt`.
9
+ * The list is open: Wow adds codes and never renames or reuses one, so a
10
+ * client treats a code it does not know as a generic rejection and shows the
11
+ * violation's message. {@link QueryErrorCode} admits those codes too.
11
12
  *
12
- * Three groups, which `BindingError.name` locates differently:
13
- * - decoding the request body (`errorCode` `IllegalArgument`): `name` is the
14
- * JSON path of the offending value, such as `filter.state` or `metrics[0]`,
15
- * or `body` for the body as a whole;
16
- * - the entry's budget and gates (`errorCode` `IllegalArgument`): `name` is
17
- * the part of the request the rule bounds, such as `limit` or `filter`;
18
- * - admission against the query model (`errorCode` `QuerySchemaValidation`):
19
- * `name` is the absolute logical field path, such as `state.items.sku`, or
20
- * `''` when the rule is about the model rather than one field.
21
- *
22
- * Budget and gate rejections carry a code from Wow 9.2 on; an older server
23
- * answers them with text alone (`HTTP list query limit[...] must be …`). A
24
- * failure of the server itself is no rejection: it answers HTTP 500
25
- * `InternalServerError` without a binding error.
13
+ * A violation's `path` locates it three ways:
14
+ * - decoding the request body: the JSON path of the offending value, such as
15
+ * `filter.state` or `metrics[0]`, or `body` for the body as a whole;
16
+ * - the entry's budget and gates: the part of the request the rule bounds,
17
+ * such as `limit` or `filter`;
18
+ * - admission against the query model: the absolute logical field path, such
19
+ * as `state.items.sku`, or `''` when the rule is about the model rather
20
+ * than one field.
26
21
  */
27
22
  export declare const QueryErrorCodes: Readonly<{
28
23
  /** The body is not valid JSON. */
@@ -84,6 +79,12 @@ export declare const QueryErrorCodes: Readonly<{
84
79
  * answered over HTTP; listed so the mirror stays complete.
85
80
  */
86
81
  readonly EXPLICIT_ENTRY_REQUIRED: "EXPLICIT_ENTRY_REQUIRED";
82
+ /**
83
+ * A state point read (`GET …/{id}/state?version=|at=`, `…/state/trace`): the
84
+ * state asked for is more commits away from the snapshot, or from version 1,
85
+ * than a state read replays. The path is the query parameter.
86
+ */
87
+ readonly REPLAY_TOO_LONG: "REPLAY_TOO_LONG";
87
88
  /** The model has no such logical field. */
88
89
  readonly UNKNOWN_FIELD: "UNKNOWN_FIELD";
89
90
  /** The field does not offer the capability the query uses (sort, range, …). */
@@ -188,8 +189,8 @@ export type KnownQueryErrorCode = (typeof QueryErrorCodes)[keyof typeof QueryErr
188
189
  */
189
190
  export type QueryErrorCode = KnownQueryErrorCode | (string & {});
190
191
  /**
191
- * Why the server rejected a request, read from its first binding error that
192
- * carries a code: which rule failed, where, and the server's words.
192
+ * Why the server rejected a query: one violation of its `wow.query.invalid`
193
+ * problem, which rule failed, where, and the server's words.
193
194
  */
194
195
  export interface QueryViolation {
195
196
  /** Which rule failed; switch on it against {@link QueryErrorCodes}. */
@@ -201,6 +202,6 @@ export interface QueryViolation {
201
202
  * the model rather than a field.
202
203
  */
203
204
  path: string;
204
- /** The server's words, the same as the error's `errorMsg`. */
205
+ /** The server's words. */
205
206
  message: string;
206
207
  }
@@ -1,4 +1,4 @@
1
- //#region src/error/queryErrorCodes.ts
1
+ //#region src/dsl/queryErrorCodes.ts
2
2
  var e = Object.freeze({
3
3
  INVALID_JSON: "INVALID_JSON",
4
4
  BODY_NOT_OBJECT: "BODY_NOT_OBJECT",
@@ -17,6 +17,7 @@ var e = Object.freeze({
17
17
  COUNT_REQUIRES_FILTER: "COUNT_REQUIRES_FILTER",
18
18
  RESIDUAL_GROUPS_EXCEEDED: "RESIDUAL_GROUPS_EXCEEDED",
19
19
  EXPLICIT_ENTRY_REQUIRED: "EXPLICIT_ENTRY_REQUIRED",
20
+ REPLAY_TOO_LONG: "REPLAY_TOO_LONG",
20
21
  UNKNOWN_FIELD: "UNKNOWN_FIELD",
21
22
  UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY",
22
23
  ELEMENT_SCOPE_REQUIRED: "ELEMENT_SCOPE_REQUIRED",
@@ -1 +1 @@
1
- {"version":3,"file":"queryErrorCodes.cjs","names":["QueryErrorCodes"],"sources":["../../src/error/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 a rejected query carries as `BindingError.code`: which rule the\n * request broke, stable where the human text (`errorMsg`) is not.\n *\n * Mirrors `QueryErrorCodes` in\n * `wow-api/src/main/kotlin/me/ahoo/wow/api/query/QueryErrorCodes.kt`, which the\n * server also publishes as the `BindingError.code` enum of its OpenAPI\n * document. The list is open: Wow adds codes and never renames or reuses one,\n * so a client treats a code it does not know as a generic rejection and shows\n * `errorMsg`. {@link QueryErrorCode} admits those codes too.\n *\n * Three groups, which `BindingError.name` locates differently:\n * - decoding the request body (`errorCode` `IllegalArgument`): `name` is the\n * JSON path of the offending value, such as `filter.state` or `metrics[0]`,\n * or `body` for the body as a whole;\n * - the entry's budget and gates (`errorCode` `IllegalArgument`): `name` is\n * the part of the request the rule bounds, such as `limit` or `filter`;\n * - admission against the query model (`errorCode` `QuerySchemaValidation`):\n * `name` is the absolute logical field path, such as `state.items.sku`, or\n * `''` when the rule is about the model rather than one field.\n *\n * Budget and gate rejections carry a code from Wow 9.2 on; an older server\n * answers them with text alone (`HTTP list query limit[...] must be …`). A\n * failure of the server itself is no rejection: it answers HTTP 500\n * `InternalServerError` without a binding error.\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 /** 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 request, read from its first binding error that\n * carries a code: 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, the same as the error's `errorMsg`. */\n message: string;\n}\n"],"mappings":"AAuCA,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,0BAEzB,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"}
1
+ {"version":3,"file":"queryErrorCodes.es.js","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,IAAkB,OAAO,OAAO;CAE3C,cAAc;CAEd,iBAAiB;CAEjB,YAAY;CAEZ,kBAAkB;CAElB,cAAc;CAEd,eAAe;CAEf,eAAe;CAEf,iBAAiB;CAEjB,uBAAuB;CAEvB,sBAAsB;CAKtB,gBAAgB;CAMhB,mBAAmB;CAKnB,kBAAkB;CAOlB,6BAA6B;CAK7B,uBAAuB;CAMvB,0BAA0B;CAK1B,yBAAyB;CAMzB,iBAAiB;CAEjB,eAAe;CAEf,wBAAwB;CAExB,wBAAwB;CAExB,gBAAgB;CAEhB,gBAAgB;CAEhB,mBAAmB;CAEnB,0BAA0B;CAE1B,oBAAoB;CAEpB,uBAAuB;CAMvB,sBAAsB;CAEtB,6BAA6B;CAE7B,2BAA2B;CAE3B,uBAAuB;CAEvB,sBAAsB;CAEtB,6BAA6B;CAE7B,2BAA2B;CAE3B,iBAAiB;CAEjB,gCAAgC;CAEhC,kCAAkC;CAElC,iCAAiC;CAMjC,qBAAqB;CAMrB,gBAAgB;CAKhB,kCAAkC;CAMlC,8BAA8B;CAM9B,kCAAkC;CAElC,eAAe;CAEf,sBAAsB;CAKtB,oBAAoB;CAMpB,qBAAqB;CAOrB,sBAAsB;AACxB,CAAU"}
package/dist/dsl.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./dsl/filter/operator.cjs"),t=require("./dsl/aggregation/types.cjs"),n=require("./dsl/deletionState.cjs"),r=require("./dsl/filter/builders.cjs"),i=require("./dsl/sort.cjs"),a=require("./dsl/aggregation/builders.cjs"),o=require("./dsl/projection.cjs"),s=require("./dsl/pagination.cjs"),c=require("./dsl/cursorQuery.cjs"),l=require("./dsl/queryable.cjs"),u=require("./dsl/descriptor.cjs"),d=require("./model/domainEventStream.cjs"),f=require("./model/snapshot.cjs");exports.AGGREGATION_LIMITS=t.AGGREGATION_LIMITS,exports.AggregationDatePart=t.AggregationDatePart,exports.AggregationDateUnit=t.AggregationDateUnit,exports.AggregationExpressionOperator=t.AggregationExpressionOperator,exports.AggregationExpressionType=t.AggregationExpressionType,exports.AggregationFunction=t.AggregationFunction,exports.AggregationGroupScope=t.AggregationGroupScope,exports.AggregationGroupType=t.AggregationGroupType,exports.AggregationMetricType=t.AggregationMetricType,exports.ComparisonOperator=t.ComparisonOperator,exports.DEFAULT_CURSOR_SIZE=c.DEFAULT_CURSOR_SIZE,exports.DEFAULT_PAGINATION=s.DEFAULT_PAGINATION,exports.DateDiffUnit=t.DateDiffUnit,exports.DeletionState=n.DeletionState,exports.DerivedExpressionType=t.DerivedExpressionType,exports.DomainEventStreamMetadataFields=d.DomainEventStreamMetadataFields,exports.FilterOperator=e.FilterOperator,exports.HavingExpressionType=t.HavingExpressionType,exports.MAX_CURSOR_SIZE=c.MAX_CURSOR_SIZE,exports.MAX_CURSOR_SORT_FIELDS=c.MAX_CURSOR_SORT_FIELDS,exports.PagingMode=u.PagingMode,exports.QueryConstraintTypes=u.QueryConstraintTypes,exports.QueryFieldRoles=u.QueryFieldRoles,exports.QueryModels=u.QueryModels,exports.QueryValueKind=u.QueryValueKind,exports.QueryValueTypes=u.QueryValueTypes,exports.RunningFunction=t.RunningFunction,exports.SearchMode=e.SearchMode,exports.SensitivityLevel=u.SensitivityLevel,exports.SnapshotMetadataFields=f.SnapshotMetadataFields,exports.SortDirection=i.SortDirection,exports.StringComparison=e.StringComparison,exports.TimeUnit=e.TimeUnit,exports.WindowFunction=t.WindowFunction,exports.aggregation=a.aggregation,exports.asc=i.asc,exports.cursorQuery=c.cursorQuery,exports.desc=i.desc,exports.filter=r.filter,exports.listQuery=l.listQuery,exports.pagedList=l.pagedList,exports.pagedQuery=l.pagedQuery,exports.pagination=s.pagination,exports.projection=o.projection,exports.singleQuery=l.singleQuery;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./dsl/filter/operator.cjs"),t=require("./dsl/aggregation/types.cjs"),n=require("./dsl/deletionState.cjs"),r=require("./dsl/filter/builders.cjs"),i=require("./dsl/sort.cjs"),a=require("./dsl/aggregation/builders.cjs"),o=require("./dsl/projection.cjs"),s=require("./dsl/pagination.cjs"),c=require("./dsl/cursorQuery.cjs"),l=require("./dsl/queryable.cjs"),u=require("./dsl/descriptor.cjs"),d=require("./dsl/queryErrorCodes.cjs");exports.AGGREGATION_LIMITS=t.AGGREGATION_LIMITS,exports.AggregationDatePart=t.AggregationDatePart,exports.AggregationDateUnit=t.AggregationDateUnit,exports.AggregationExpressionOperator=t.AggregationExpressionOperator,exports.AggregationExpressionType=t.AggregationExpressionType,exports.AggregationFunction=t.AggregationFunction,exports.AggregationGroupScope=t.AggregationGroupScope,exports.AggregationGroupType=t.AggregationGroupType,exports.AggregationMetricType=t.AggregationMetricType,exports.ComparisonOperator=t.ComparisonOperator,exports.DEFAULT_CURSOR_SIZE=c.DEFAULT_CURSOR_SIZE,exports.DEFAULT_PAGINATION=s.DEFAULT_PAGINATION,exports.DateDiffUnit=t.DateDiffUnit,exports.DeletionState=n.DeletionState,exports.DerivedExpressionType=t.DerivedExpressionType,exports.FilterOperator=e.FilterOperator,exports.HavingExpressionType=t.HavingExpressionType,exports.MAX_CURSOR_SIZE=c.MAX_CURSOR_SIZE,exports.MAX_CURSOR_SORT_FIELDS=c.MAX_CURSOR_SORT_FIELDS,exports.PagingMode=u.PagingMode,exports.QueryConstraintTypes=u.QueryConstraintTypes,exports.QueryErrorCodes=d.QueryErrorCodes,exports.QueryFieldRoles=u.QueryFieldRoles,exports.QueryModels=u.QueryModels,exports.QueryValueKind=u.QueryValueKind,exports.QueryValueTypes=u.QueryValueTypes,exports.RunningFunction=t.RunningFunction,exports.SearchMode=e.SearchMode,exports.SensitivityLevel=u.SensitivityLevel,exports.SortDirection=i.SortDirection,exports.StringComparison=e.StringComparison,exports.TimeUnit=e.TimeUnit,exports.WindowFunction=t.WindowFunction,exports.aggregation=a.aggregation,exports.asc=i.asc,exports.cursorQuery=c.cursorQuery,exports.desc=i.desc,exports.filter=r.filter,exports.listQuery=l.listQuery,exports.pagedList=l.pagedList,exports.pagedQuery=l.pagedQuery,exports.pagination=s.pagination,exports.projection=o.projection,exports.singleQuery=l.singleQuery;
package/dist/dsl.d.cts CHANGED
@@ -19,5 +19,4 @@ export * from './dsl/queryable.cjs';
19
19
  export * from './dsl/deletionState.cjs';
20
20
  export * from './dsl/documents.cjs';
21
21
  export * from './dsl/descriptor.cjs';
22
- export { SnapshotMetadataFields } from './model/snapshot.cjs';
23
- export { DomainEventStreamMetadataFields } from './model/domainEventStream.cjs';
22
+ export * from './dsl/queryErrorCodes.cjs';
package/dist/dsl.d.ts CHANGED
@@ -19,5 +19,4 @@ export * from './dsl/queryable.js';
19
19
  export * from './dsl/deletionState.js';
20
20
  export * from './dsl/documents.js';
21
21
  export * from './dsl/descriptor.js';
22
- export { SnapshotMetadataFields } from './model/snapshot.js';
23
- export { DomainEventStreamMetadataFields } from './model/domainEventStream.js';
22
+ export * from './dsl/queryErrorCodes.js';
package/dist/dsl.es.js CHANGED
@@ -9,6 +9,5 @@ import { DEFAULT_PAGINATION as E, pagination as D } from "./dsl/pagination.es.js
9
9
  import { DEFAULT_CURSOR_SIZE as O, MAX_CURSOR_SIZE as k, MAX_CURSOR_SORT_FIELDS as A, cursorQuery as j } from "./dsl/cursorQuery.es.js";
10
10
  import { listQuery as M, pagedList as N, pagedQuery as P, singleQuery as F } from "./dsl/queryable.es.js";
11
11
  import { PagingMode as I, QueryConstraintTypes as L, QueryFieldRoles as R, QueryModels as z, QueryValueKind as B, QueryValueTypes as V, SensitivityLevel as H } from "./dsl/descriptor.es.js";
12
- import { DomainEventStreamMetadataFields as U } from "./model/domainEventStream.es.js";
13
- import { SnapshotMetadataFields as W } from "./model/snapshot.es.js";
14
- export { i as AGGREGATION_LIMITS, a as AggregationDatePart, o as AggregationDateUnit, s as AggregationExpressionOperator, c as AggregationExpressionType, l as AggregationFunction, u as AggregationGroupScope, d as AggregationGroupType, f as AggregationMetricType, p as ComparisonOperator, O as DEFAULT_CURSOR_SIZE, E as DEFAULT_PAGINATION, m as DateDiffUnit, y as DeletionState, h as DerivedExpressionType, U as DomainEventStreamMetadataFields, e as FilterOperator, g as HavingExpressionType, k as MAX_CURSOR_SIZE, A as MAX_CURSOR_SORT_FIELDS, I as PagingMode, L as QueryConstraintTypes, R as QueryFieldRoles, z as QueryModels, B as QueryValueKind, V as QueryValueTypes, _ as RunningFunction, t as SearchMode, H as SensitivityLevel, W as SnapshotMetadataFields, x as SortDirection, n as StringComparison, r as TimeUnit, v as WindowFunction, w as aggregation, S as asc, j as cursorQuery, C as desc, b as filter, M as listQuery, N as pagedList, P as pagedQuery, D as pagination, T as projection, F as singleQuery };
12
+ import { QueryErrorCodes as U } from "./dsl/queryErrorCodes.es.js";
13
+ export { i as AGGREGATION_LIMITS, a as AggregationDatePart, o as AggregationDateUnit, s as AggregationExpressionOperator, c as AggregationExpressionType, l as AggregationFunction, u as AggregationGroupScope, d as AggregationGroupType, f as AggregationMetricType, p as ComparisonOperator, O as DEFAULT_CURSOR_SIZE, E as DEFAULT_PAGINATION, m as DateDiffUnit, y as DeletionState, h as DerivedExpressionType, e as FilterOperator, g as HavingExpressionType, k as MAX_CURSOR_SIZE, A as MAX_CURSOR_SORT_FIELDS, I as PagingMode, L as QueryConstraintTypes, U as QueryErrorCodes, R as QueryFieldRoles, z as QueryModels, B as QueryValueKind, V as QueryValueTypes, _ as RunningFunction, t as SearchMode, H as SensitivityLevel, x as SortDirection, n as StringComparison, r as TimeUnit, v as WindowFunction, w as aggregation, S as asc, j as cursorQuery, C as desc, b as filter, M as listQuery, N as pagedList, P as pagedQuery, D as pagination, T as projection, F as singleQuery };
@@ -0,0 +1,3 @@
1
+ var e=Symbol(`wow.textNumbersBy`);function t(t,n,r){return{[e]:{discriminant:t,member:n,cases:r}}}function n(t){return t===void 0?!0:t===!0?!1:e in t?Object.values(t[e].cases).every(n):Object.values(t).every(n)}var r=class{constructor(e){this.text=e}};function i(t,n){if(!(t===void 0||t===!0||e in t))return Object.prototype.hasOwnProperty.call(t,n)?t[n]:Object.prototype.hasOwnProperty.call(t,`*`)?t[`*`]:void 0}function a(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function o(t,n){if(t instanceof r)return n===!0?t.text:Number(t.text);if(Array.isArray(t)){for(let e=0;e<t.length;e++)t[e]=o(t[e],i(n,String(e)));return t}if(typeof t==`object`&&t){let r=t,s=n!==void 0&&n!==!0&&e in n?n[e]:void 0,c=s===void 0?void 0:r[s.discriminant];for(let e of Object.keys(r)){let t=s===void 0?i(n,e):e===s.member&&typeof c==`string`?s.cases[c]:void 0;a(r,e,o(r[e],t))}}return t}var s={TAB:9,LF:10,CR:13,SPACE:32,QUOTE:34,PLUS:43,COMMA:44,MINUS:45,DOT:46,ZERO:48,NINE:57,COLON:58,UPPER_E:69,OPEN_BRACKET:91,BACKSLASH:92,CLOSE_BRACKET:93,LOWER_E:101,OPEN_BRACE:123,CLOSE_BRACE:125},c={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
2
+ `,r:`\r`,t:` `},l=class{constructor(e){this.text=e,this.at=0}parse(e){this.skipSpaces();let t=this.value(e,!1);return this.skipSpaces(),this.at<this.text.length&&this.fail(),t}value(e,t){switch(this.text.charCodeAt(this.at)){case s.OPEN_BRACE:return this.object(e,t);case s.OPEN_BRACKET:return this.array(e,t);case s.QUOTE:return this.string();case 116:return this.literal(`true`,!0);case 102:return this.literal(`false`,!1);case 110:return this.literal(`null`,null);default:{let n=this.number();return t?new r(n):e===!0?n:Number(n)}}}object(t,n){this.at++;let r={},c=!n&&t!==void 0&&t!==!0&&e in t?t[e]:void 0;if(this.skipSpaces(),this.text.charCodeAt(this.at)===s.CLOSE_BRACE)return this.at++,r;for(;;){this.text.charCodeAt(this.at)!==s.QUOTE&&this.fail();let e=this.string();this.skipSpaces(),this.expect(s.COLON),this.skipSpaces(),a(r,e,c!==void 0&&e===c.member?this.value(void 0,!0):this.value(n?void 0:i(t,e),n)),this.skipSpaces();let o=this.text.charCodeAt(this.at++);if(o===s.CLOSE_BRACE)break;o!==s.COMMA&&this.fail(this.at-1),this.skipSpaces()}if(c!==void 0&&Object.prototype.hasOwnProperty.call(r,c.member)){let e=r[c.discriminant];a(r,c.member,o(r[c.member],typeof e==`string`?c.cases[e]:void 0))}return r}array(e,t){this.at++;let n=[];if(this.skipSpaces(),this.text.charCodeAt(this.at)===s.CLOSE_BRACKET)return this.at++,n;let r=t?void 0:i(e,`*`);for(;;){n.push(this.value(r,t)),this.skipSpaces();let e=this.text.charCodeAt(this.at++);if(e===s.CLOSE_BRACKET)return n;e!==s.COMMA&&this.fail(this.at-1),this.skipSpaces()}}string(){let e=this.text,t=++this.at,n=``;for(;;){let r=e.charCodeAt(this.at);if(r===s.QUOTE)return n+=e.slice(t,this.at++),n;if(r===s.BACKSLASH){n+=e.slice(t,this.at);let r=e[this.at+1];if(r===`u`){let t=e.slice(this.at+2,this.at+6);/^[0-9a-fA-F]{4}$/.test(t)||this.fail(this.at),n+=String.fromCharCode(Number.parseInt(t,16)),this.at+=6}else{let e=r===void 0?void 0:c[r];e===void 0&&this.fail(this.at),n+=e,this.at+=2}t=this.at}else r<s.SPACE||Number.isNaN(r)?this.fail():this.at++}}number(){let e=this.text,t=this.at;e.charCodeAt(this.at)===s.MINUS&&this.at++;let n=e.charCodeAt(this.at);n===s.ZERO?this.at++:n>s.ZERO&&n<=s.NINE?this.digits():this.fail(),e.charCodeAt(this.at)===s.DOT&&(this.at++,this.digits()||this.fail());let r=e.charCodeAt(this.at);if(r===s.LOWER_E||r===s.UPPER_E){this.at++;let t=e.charCodeAt(this.at);(t===s.PLUS||t===s.MINUS)&&this.at++,this.digits()||this.fail()}return e.slice(t,this.at)}digits(){let e=this.at,t=this.text.charCodeAt(this.at);for(;t>=s.ZERO&&t<=s.NINE;)t=this.text.charCodeAt(++this.at);return this.at>e}literal(e,t){return this.text.startsWith(e,this.at)||this.fail(),this.at+=e.length,t}skipSpaces(){let e=this.text.charCodeAt(this.at);for(;e===s.SPACE||e===s.LF||e===s.CR||e===s.TAB;)e=this.text.charCodeAt(++this.at)}expect(e){this.text.charCodeAt(this.at)!==e&&this.fail(),this.at++}fail(e=this.at){throw SyntaxError(e>=this.text.length?`Unexpected end of JSON input`:`Unexpected token in JSON at position ${e}`)}};function u(e,t){return n(t)?JSON.parse(e):new l(e).parse(t)}var d=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function f(e,t){if(n(t))return JSON.stringify(e);let r=[],i=`\u0000wow-number-${Math.random().toString(36).slice(2)}:`,a=p(e,t,r,i),o=JSON.stringify(a);if(r.length===0)return o;let s=RegExp(`"${JSON.stringify(i).slice(1,-1).replace(/\\/g,`\\\\`)}(\\d+)"`,`g`);return o.replace(s,(e,t)=>r[Number(t)])}function p(t,n,r,o){if(n===void 0||t==null)return t;if(n===!0){if(typeof t!=`string`)return t;if(!d.test(t))throw TypeError(`Not a JSON number: [${t}].`);return r.push(t),`${o}${r.length-1}`}if(Array.isArray(t))return t.map((e,t)=>p(e,i(n,String(t)),r,o));if(typeof t!=`object`)return t;let s=t;if(typeof s.toJSON==`function`)return t;let c=e in n?n[e]:void 0,l=c===void 0?void 0:s[c.discriminant],u={};for(let e of Object.keys(s)){let t=c===void 0?i(n,e):e===c.member&&typeof l==`string`?c.cases[l]:void 0;a(u,e,p(s[e],t,r,o))}return u}function m(e){let n=e.textNumbers?.events;return n===void 0?void 0:t(`name`,`body`,n)}exports.eventNumbers=m,exports.marksNothing=n,exports.parseJson=u,exports.stringifyJson=f,exports.textNumbersBy=t;
3
+ //# sourceMappingURL=exactJson.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exactJson.cjs","names":["BY","textNumbersBy","marksNothing","marks","Captured","text","child","name","define","key","target","value","resolve","index","object","by","discriminant","marksOf","Code","ESCAPES","Parser","capture","next","array","items","start","code","escape","hex","unescaped","first","exponent","sign","word","at","parseJson","JSON_NUMBER","stringifyJson","numbers","prefix","replaced","replace","placeholder","item","copy","eventNumbers","events","type"],"sources":["../src/exactJson.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 type { AggregateType } from './wire.js';\n\n/**\n * Which numbers of a JSON value a client reads and writes as their exact\n * text (review R4-Q, Q-9; decision D254): an `int64`, `bigint` or `decimal`\n * field of a Manifest, which JavaScript's `number` would round. The wire\n * keeps JSON numbers (decision D122); such a field is a `string` in the\n * generated types, its digits exactly as the server wrote them.\n *\n * - `true`: this value is such a number.\n * - An object: the marks of its members by name, `'*'` for every item of an\n * array and every value of a map.\n * - {@link textNumbersBy}: the marks of one member chosen by a sibling's\n * value, such as an event's `body` by its `name`.\n */\nexport type TextNumbers =\n true | TextNumbersByName | { readonly [member: string]: TextNumbers };\n\n/** The key of a {@link TextNumbersByName}: a symbol, so no member name is mistaken for it. */\nconst BY: unique symbol = Symbol('wow.textNumbersBy');\n\n/** The marks of one member of an object chosen by the value of another. */\nexport interface TextNumbersByName {\n readonly [BY]: {\n readonly discriminant: string;\n readonly member: string;\n readonly cases: Readonly<Record<string, TextNumbers>>;\n };\n}\n\n/**\n * The marks of `member` chosen by the string value of `discriminant`, its\n * sibling: `textNumbersBy('name', 'body', { 'shop.cart.ItemAdded': { price:\n * true } })` reads an event's body by the event's name.\n */\nexport function textNumbersBy(\n discriminant: string,\n member: string,\n cases: Readonly<Record<string, TextNumbers>>,\n): TextNumbersByName {\n return { [BY]: { discriminant, member, cases } };\n}\n\n/** Whether `marks` marks nothing, so plain `JSON.parse` reads the value. */\nexport function marksNothing(marks: TextNumbers | undefined): boolean {\n if (marks === undefined) return true;\n if (marks === true) return false;\n if (BY in marks) {\n return Object.values(marks[BY].cases).every(marksNothing);\n }\n return Object.values(marks).every(marksNothing);\n}\n\n/** A number of a captured member, kept as its text until its marks are known. */\nclass Captured {\n constructor(readonly text: string) {}\n}\n\n/** The marks of a member or item of a value marked `marks`. */\nfunction child(\n marks: TextNumbers | undefined,\n name: string,\n): TextNumbers | undefined {\n if (marks === undefined || marks === true || BY in marks) return undefined;\n return Object.prototype.hasOwnProperty.call(marks, name)\n ? marks[name]\n : Object.prototype.hasOwnProperty.call(marks, '*')\n ? marks['*']\n : undefined;\n}\n\n/** Sets a member as `JSON.parse` does: an own data property, `__proto__` too. */\nfunction define(target: Record<string, unknown>, key: string, value: unknown) {\n if (key === '__proto__') {\n Object.defineProperty(target, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n } else {\n target[key] = value;\n }\n}\n\n/** Resolves the numbers of a captured value against its now known marks. */\nfunction resolve(value: unknown, marks: TextNumbers | undefined): unknown {\n if (value instanceof Captured) {\n return marks === true ? value.text : Number(value.text);\n }\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) {\n value[index] = resolve(value[index], child(marks, String(index)));\n }\n return value;\n }\n if (value !== null && typeof value === 'object') {\n const object = value as Record<string, unknown>;\n const by =\n marks !== undefined && marks !== true && BY in marks\n ? marks[BY]\n : undefined;\n const discriminant = by === undefined ? undefined : object[by.discriminant];\n for (const key of Object.keys(object)) {\n const marksOf =\n by === undefined\n ? child(marks, key)\n : key === by.member && typeof discriminant === 'string'\n ? by.cases[discriminant]\n : undefined;\n define(object, key, resolve(object[key], marksOf));\n }\n }\n return value;\n}\n\nconst Code = {\n TAB: 0x09,\n LF: 0x0a,\n CR: 0x0d,\n SPACE: 0x20,\n QUOTE: 0x22,\n PLUS: 0x2b,\n COMMA: 0x2c,\n MINUS: 0x2d,\n DOT: 0x2e,\n ZERO: 0x30,\n NINE: 0x39,\n COLON: 0x3a,\n UPPER_E: 0x45,\n OPEN_BRACKET: 0x5b,\n BACKSLASH: 0x5c,\n CLOSE_BRACKET: 0x5d,\n LOWER_E: 0x65,\n OPEN_BRACE: 0x7b,\n CLOSE_BRACE: 0x7d,\n} as const;\n\nconst ESCAPES: Readonly<Record<string, string>> = {\n '\"': '\"',\n '\\\\': '\\\\',\n '/': '/',\n b: '\\b',\n f: '\\f',\n n: '\\n',\n r: '\\r',\n t: '\\t',\n};\n\n/** A JSON text read as `JSON.parse` reads it, but for the numbers `marks` marks. */\nclass Parser {\n private at = 0;\n\n constructor(private readonly text: string) {}\n\n parse(marks: TextNumbers | undefined): unknown {\n this.skipSpaces();\n const value = this.value(marks, false);\n this.skipSpaces();\n if (this.at < this.text.length) this.fail();\n return value;\n }\n\n /** A value; `capture` keeps its numbers as {@link Captured} text. */\n private value(marks: TextNumbers | undefined, capture: boolean): unknown {\n const code = this.text.charCodeAt(this.at);\n switch (code) {\n case Code.OPEN_BRACE:\n return this.object(marks, capture);\n case Code.OPEN_BRACKET:\n return this.array(marks, capture);\n case Code.QUOTE:\n return this.string();\n case 0x74: // t\n return this.literal('true', true);\n case 0x66: // f\n return this.literal('false', false);\n case 0x6e: // n\n return this.literal('null', null);\n default: {\n const text = this.number();\n if (capture) return new Captured(text);\n return marks === true ? text : Number(text);\n }\n }\n }\n\n private object(marks: TextNumbers | undefined, capture: boolean): unknown {\n this.at++;\n const object: Record<string, unknown> = {};\n const by =\n !capture && marks !== undefined && marks !== true && BY in marks\n ? marks[BY]\n : undefined;\n this.skipSpaces();\n if (this.text.charCodeAt(this.at) === Code.CLOSE_BRACE) {\n this.at++;\n return object;\n }\n for (;;) {\n if (this.text.charCodeAt(this.at) !== Code.QUOTE) this.fail();\n const key = this.string();\n this.skipSpaces();\n this.expect(Code.COLON);\n this.skipSpaces();\n const member =\n by !== undefined && key === by.member\n ? this.value(undefined, true)\n : this.value(capture ? undefined : child(marks, key), capture);\n define(object, key, member);\n this.skipSpaces();\n const next = this.text.charCodeAt(this.at++);\n if (next === Code.CLOSE_BRACE) break;\n if (next !== Code.COMMA) this.fail(this.at - 1);\n this.skipSpaces();\n }\n if (\n by !== undefined &&\n Object.prototype.hasOwnProperty.call(object, by.member)\n ) {\n const discriminant = object[by.discriminant];\n define(\n object,\n by.member,\n resolve(\n object[by.member],\n typeof discriminant === 'string' ? by.cases[discriminant] : undefined,\n ),\n );\n }\n return object;\n }\n\n private array(marks: TextNumbers | undefined, capture: boolean): unknown[] {\n this.at++;\n const array: unknown[] = [];\n this.skipSpaces();\n if (this.text.charCodeAt(this.at) === Code.CLOSE_BRACKET) {\n this.at++;\n return array;\n }\n const items = capture ? undefined : child(marks, '*');\n for (;;) {\n array.push(this.value(items, capture));\n this.skipSpaces();\n const next = this.text.charCodeAt(this.at++);\n if (next === Code.CLOSE_BRACKET) return array;\n if (next !== Code.COMMA) this.fail(this.at - 1);\n this.skipSpaces();\n }\n }\n\n private string(): string {\n const text = this.text;\n let start = ++this.at;\n let value = '';\n for (;;) {\n const code = text.charCodeAt(this.at);\n if (code === Code.QUOTE) {\n value += text.slice(start, this.at++);\n return value;\n }\n if (code === Code.BACKSLASH) {\n value += text.slice(start, this.at);\n const escape = text[this.at + 1];\n if (escape === 'u') {\n const hex = text.slice(this.at + 2, this.at + 6);\n if (!/^[0-9a-fA-F]{4}$/.test(hex)) this.fail(this.at);\n value += String.fromCharCode(Number.parseInt(hex, 16));\n this.at += 6;\n } else {\n const unescaped = escape === undefined ? undefined : ESCAPES[escape];\n if (unescaped === undefined) this.fail(this.at);\n value += unescaped;\n this.at += 2;\n }\n start = this.at;\n } else if (code < Code.SPACE || Number.isNaN(code)) {\n this.fail();\n } else {\n this.at++;\n }\n }\n }\n\n /** The text of a number, checked against JSON's grammar. */\n private number(): string {\n const text = this.text;\n const start = this.at;\n if (text.charCodeAt(this.at) === Code.MINUS) this.at++;\n const first = text.charCodeAt(this.at);\n if (first === Code.ZERO) {\n this.at++;\n } else if (first > Code.ZERO && first <= Code.NINE) {\n this.digits();\n } else {\n this.fail();\n }\n if (text.charCodeAt(this.at) === Code.DOT) {\n this.at++;\n if (!this.digits()) this.fail();\n }\n const exponent = text.charCodeAt(this.at);\n if (exponent === Code.LOWER_E || exponent === Code.UPPER_E) {\n this.at++;\n const sign = text.charCodeAt(this.at);\n if (sign === Code.PLUS || sign === Code.MINUS) this.at++;\n if (!this.digits()) this.fail();\n }\n return text.slice(start, this.at);\n }\n\n /** Skips digits; whether there was one. */\n private digits(): boolean {\n const start = this.at;\n let code = this.text.charCodeAt(this.at);\n while (code >= Code.ZERO && code <= Code.NINE) {\n code = this.text.charCodeAt(++this.at);\n }\n return this.at > start;\n }\n\n private literal<T>(word: string, value: T): T {\n if (!this.text.startsWith(word, this.at)) this.fail();\n this.at += word.length;\n return value;\n }\n\n private skipSpaces(): void {\n let code = this.text.charCodeAt(this.at);\n while (\n code === Code.SPACE ||\n code === Code.LF ||\n code === Code.CR ||\n code === Code.TAB\n ) {\n code = this.text.charCodeAt(++this.at);\n }\n }\n\n private expect(code: number): void {\n if (this.text.charCodeAt(this.at) !== code) this.fail();\n this.at++;\n }\n\n private fail(at: number = this.at): never {\n throw new SyntaxError(\n at >= this.text.length\n ? 'Unexpected end of JSON input'\n : `Unexpected token in JSON at position ${at}`,\n );\n }\n}\n\n/**\n * `text` read as `JSON.parse` reads it, but each number `marks` marks comes\n * back as its exact text, a string (review R4-Q, Q-9). Without marks it is\n * `JSON.parse` itself. Malformed text throws a `SyntaxError`.\n */\nexport function parseJson(text: string, marks?: TextNumbers): unknown {\n if (marksNothing(marks)) return JSON.parse(text);\n return new Parser(text).parse(marks);\n}\n\n/** JSON's number grammar. */\nconst JSON_NUMBER = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$/;\n\n/**\n * `value` written as `JSON.stringify` writes it, but each string `marks`\n * marks goes on the wire as the JSON number it spells, unquoted (decision\n * D122): `{\"price\": \"19.99\"}` marked `{price: true}` is `{\"price\":19.99}`.\n * A marked string that is not a JSON number is a `TypeError`.\n */\nexport function stringifyJson(value: unknown, marks?: TextNumbers): string {\n if (marksNothing(marks)) return JSON.stringify(value);\n const numbers: string[] = [];\n // A NUL and a fresh nonce: no string of the value is the placeholder.\n const prefix = `\\u0000wow-number-${Math.random().toString(36).slice(2)}:`;\n const replaced = replace(value, marks, numbers, prefix);\n const text = JSON.stringify(replaced);\n if (numbers.length === 0) return text;\n const placeholder = new RegExp(\n `\"${JSON.stringify(prefix).slice(1, -1).replace(/\\\\/g, '\\\\\\\\')}(\\\\d+)\"`,\n 'g',\n );\n return text.replace(\n placeholder,\n (_, index: string) => numbers[Number(index)]!,\n );\n}\n\n/**\n * A copy of `value` along the marked paths, each marked string replaced by a\n * placeholder of its number; everything else shared.\n */\nfunction replace(\n value: unknown,\n marks: TextNumbers | undefined,\n numbers: string[],\n prefix: string,\n): unknown {\n if (marks === undefined || value === null || value === undefined) {\n return value;\n }\n if (marks === true) {\n if (typeof value !== 'string') return value;\n if (!JSON_NUMBER.test(value)) {\n throw new TypeError(`Not a JSON number: [${value}].`);\n }\n numbers.push(value);\n return `${prefix}${numbers.length - 1}`;\n }\n if (Array.isArray(value)) {\n return value.map((item, index) =>\n replace(item, child(marks, String(index)), numbers, prefix),\n );\n }\n if (typeof value !== 'object') return value;\n const object = value as Record<string, unknown>;\n // `JSON.stringify` writes what `toJSON` returns (a `Date`, say): not a path.\n if (typeof object.toJSON === 'function') return value;\n const by = BY in marks ? marks[BY] : undefined;\n const discriminant = by === undefined ? undefined : object[by.discriminant];\n const copy: Record<string, unknown> = {};\n for (const key of Object.keys(object)) {\n const marksOf =\n by === undefined\n ? child(marks, key)\n : key === by.member && typeof discriminant === 'string'\n ? by.cases[discriminant]\n : undefined;\n define(copy, key, replace(object[key], marksOf, numbers, prefix));\n }\n return copy;\n}\n\n/**\n * The exact numbers ({@link TextNumbers}) of an aggregate type's events: each\n * event's `body` by its `name`.\n */\nexport function eventNumbers(type: AggregateType): TextNumbers | undefined {\n const events = type.textNumbers?.events;\n return events === undefined\n ? undefined\n : textNumbersBy('name', 'body', events);\n}\n"],"mappings":"AAgCA,IAAMA,EAAoB,OAAO,mBAAmB,EAgBpD,SAAgBC,EACd,EACA,EACA,EACmB,CACnB,MAAO,EAAGD,GAAK,CAAE,eAAc,SAAQ,OAAM,CAAE,CACjD,CAGA,SAAgBE,EAAa,EAAyC,CAMpE,OALIC,IAAU,IAAA,GAAkB,GAC5BA,IAAU,GAAa,GACvBH,KAAMG,EACD,OAAO,OAAOA,EAAMH,EAAG,CAAC,KAAK,CAAC,CAAC,MAAME,CAAY,EAEnD,OAAO,OAAOC,CAAK,CAAC,CAAC,MAAMD,CAAY,CAChD,CAGA,IAAME,EAAN,KAAe,CACb,YAAY,EAAuB,CAAd,KAAA,KAAAC,CAAe,CACtC,EAGA,SAASC,EACP,EACA,EACyB,CACzB,GAAI,MAAU,IAAA,IAAaH,IAAU,IAAQH,KAAMG,GACnD,OAAO,OAAO,UAAU,eAAe,KAAKA,EAAOI,CAAI,EACnDJ,EAAMI,GACN,OAAO,UAAU,eAAe,KAAKJ,EAAO,GAAG,EAC7CA,EAAM,KACN,IAAA,EACR,CAGA,SAASK,EAAO,EAAiC,EAAa,EAAgB,CACxEC,IAAQ,YACV,OAAO,eAAeC,EAAQD,EAAK,CACjC,QACA,SAAU,GACV,WAAY,GACZ,aAAc,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CACT,CAMA,SAAgBC,EAAa,EAA8C,CACzE,IAAMC,EAASC,EAAK,aAAa,OACjC,OAAOD,IAAW,IAAA,GACd,IAAA,GACA7C,EAAc,OAAQ,OAAQ6C,CAAM,CAC1C"}
@@ -0,0 +1,54 @@
1
+ import { AggregateType } from './wire.cjs';
2
+ /**
3
+ * Which numbers of a JSON value a client reads and writes as their exact
4
+ * text (review R4-Q, Q-9; decision D254): an `int64`, `bigint` or `decimal`
5
+ * field of a Manifest, which JavaScript's `number` would round. The wire
6
+ * keeps JSON numbers (decision D122); such a field is a `string` in the
7
+ * generated types, its digits exactly as the server wrote them.
8
+ *
9
+ * - `true`: this value is such a number.
10
+ * - An object: the marks of its members by name, `'*'` for every item of an
11
+ * array and every value of a map.
12
+ * - {@link textNumbersBy}: the marks of one member chosen by a sibling's
13
+ * value, such as an event's `body` by its `name`.
14
+ */
15
+ export type TextNumbers = true | TextNumbersByName | {
16
+ readonly [member: string]: TextNumbers;
17
+ };
18
+ /** The key of a {@link TextNumbersByName}: a symbol, so no member name is mistaken for it. */
19
+ declare const BY: unique symbol;
20
+ /** The marks of one member of an object chosen by the value of another. */
21
+ export interface TextNumbersByName {
22
+ readonly [BY]: {
23
+ readonly discriminant: string;
24
+ readonly member: string;
25
+ readonly cases: Readonly<Record<string, TextNumbers>>;
26
+ };
27
+ }
28
+ /**
29
+ * The marks of `member` chosen by the string value of `discriminant`, its
30
+ * sibling: `textNumbersBy('name', 'body', { 'shop.cart.ItemAdded': { price:
31
+ * true } })` reads an event's body by the event's name.
32
+ */
33
+ export declare function textNumbersBy(discriminant: string, member: string, cases: Readonly<Record<string, TextNumbers>>): TextNumbersByName;
34
+ /** Whether `marks` marks nothing, so plain `JSON.parse` reads the value. */
35
+ export declare function marksNothing(marks: TextNumbers | undefined): boolean;
36
+ /**
37
+ * `text` read as `JSON.parse` reads it, but each number `marks` marks comes
38
+ * back as its exact text, a string (review R4-Q, Q-9). Without marks it is
39
+ * `JSON.parse` itself. Malformed text throws a `SyntaxError`.
40
+ */
41
+ export declare function parseJson(text: string, marks?: TextNumbers): unknown;
42
+ /**
43
+ * `value` written as `JSON.stringify` writes it, but each string `marks`
44
+ * marks goes on the wire as the JSON number it spells, unquoted (decision
45
+ * D122): `{"price": "19.99"}` marked `{price: true}` is `{"price":19.99}`.
46
+ * A marked string that is not a JSON number is a `TypeError`.
47
+ */
48
+ export declare function stringifyJson(value: unknown, marks?: TextNumbers): string;
49
+ /**
50
+ * The exact numbers ({@link TextNumbers}) of an aggregate type's events: each
51
+ * event's `body` by its `name`.
52
+ */
53
+ export declare function eventNumbers(type: AggregateType): TextNumbers | undefined;
54
+ export {};
@@ -0,0 +1,54 @@
1
+ import { AggregateType } from './wire.js';
2
+ /**
3
+ * Which numbers of a JSON value a client reads and writes as their exact
4
+ * text (review R4-Q, Q-9; decision D254): an `int64`, `bigint` or `decimal`
5
+ * field of a Manifest, which JavaScript's `number` would round. The wire
6
+ * keeps JSON numbers (decision D122); such a field is a `string` in the
7
+ * generated types, its digits exactly as the server wrote them.
8
+ *
9
+ * - `true`: this value is such a number.
10
+ * - An object: the marks of its members by name, `'*'` for every item of an
11
+ * array and every value of a map.
12
+ * - {@link textNumbersBy}: the marks of one member chosen by a sibling's
13
+ * value, such as an event's `body` by its `name`.
14
+ */
15
+ export type TextNumbers = true | TextNumbersByName | {
16
+ readonly [member: string]: TextNumbers;
17
+ };
18
+ /** The key of a {@link TextNumbersByName}: a symbol, so no member name is mistaken for it. */
19
+ declare const BY: unique symbol;
20
+ /** The marks of one member of an object chosen by the value of another. */
21
+ export interface TextNumbersByName {
22
+ readonly [BY]: {
23
+ readonly discriminant: string;
24
+ readonly member: string;
25
+ readonly cases: Readonly<Record<string, TextNumbers>>;
26
+ };
27
+ }
28
+ /**
29
+ * The marks of `member` chosen by the string value of `discriminant`, its
30
+ * sibling: `textNumbersBy('name', 'body', { 'shop.cart.ItemAdded': { price:
31
+ * true } })` reads an event's body by the event's name.
32
+ */
33
+ export declare function textNumbersBy(discriminant: string, member: string, cases: Readonly<Record<string, TextNumbers>>): TextNumbersByName;
34
+ /** Whether `marks` marks nothing, so plain `JSON.parse` reads the value. */
35
+ export declare function marksNothing(marks: TextNumbers | undefined): boolean;
36
+ /**
37
+ * `text` read as `JSON.parse` reads it, but each number `marks` marks comes
38
+ * back as its exact text, a string (review R4-Q, Q-9). Without marks it is
39
+ * `JSON.parse` itself. Malformed text throws a `SyntaxError`.
40
+ */
41
+ export declare function parseJson(text: string, marks?: TextNumbers): unknown;
42
+ /**
43
+ * `value` written as `JSON.stringify` writes it, but each string `marks`
44
+ * marks goes on the wire as the JSON number it spells, unquoted (decision
45
+ * D122): `{"price": "19.99"}` marked `{price: true}` is `{"price":19.99}`.
46
+ * A marked string that is not a JSON number is a `TypeError`.
47
+ */
48
+ export declare function stringifyJson(value: unknown, marks?: TextNumbers): string;
49
+ /**
50
+ * The exact numbers ({@link TextNumbers}) of an aggregate type's events: each
51
+ * event's `body` by its `name`.
52
+ */
53
+ export declare function eventNumbers(type: AggregateType): TextNumbers | undefined;
54
+ export {};
@@ -0,0 +1,213 @@
1
+ //#region src/exactJson.ts
2
+ var e = Symbol("wow.textNumbersBy");
3
+ function t(t, n, r) {
4
+ return { [e]: {
5
+ discriminant: t,
6
+ member: n,
7
+ cases: r
8
+ } };
9
+ }
10
+ function n(t) {
11
+ return t === void 0 ? !0 : t === !0 ? !1 : e in t ? Object.values(t[e].cases).every(n) : Object.values(t).every(n);
12
+ }
13
+ var r = class {
14
+ constructor(e) {
15
+ this.text = e;
16
+ }
17
+ };
18
+ function i(t, n) {
19
+ if (!(t === void 0 || t === !0 || e in t)) return Object.prototype.hasOwnProperty.call(t, n) ? t[n] : Object.prototype.hasOwnProperty.call(t, "*") ? t["*"] : void 0;
20
+ }
21
+ function a(e, t, n) {
22
+ t === "__proto__" ? Object.defineProperty(e, t, {
23
+ value: n,
24
+ writable: !0,
25
+ enumerable: !0,
26
+ configurable: !0
27
+ }) : e[t] = n;
28
+ }
29
+ function o(t, n) {
30
+ if (t instanceof r) return n === !0 ? t.text : Number(t.text);
31
+ if (Array.isArray(t)) {
32
+ for (let e = 0; e < t.length; e++) t[e] = o(t[e], i(n, String(e)));
33
+ return t;
34
+ }
35
+ if (typeof t == "object" && t) {
36
+ let r = t, s = n !== void 0 && n !== !0 && e in n ? n[e] : void 0, c = s === void 0 ? void 0 : r[s.discriminant];
37
+ for (let e of Object.keys(r)) {
38
+ let t = s === void 0 ? i(n, e) : e === s.member && typeof c == "string" ? s.cases[c] : void 0;
39
+ a(r, e, o(r[e], t));
40
+ }
41
+ }
42
+ return t;
43
+ }
44
+ var s = {
45
+ TAB: 9,
46
+ LF: 10,
47
+ CR: 13,
48
+ SPACE: 32,
49
+ QUOTE: 34,
50
+ PLUS: 43,
51
+ COMMA: 44,
52
+ MINUS: 45,
53
+ DOT: 46,
54
+ ZERO: 48,
55
+ NINE: 57,
56
+ COLON: 58,
57
+ UPPER_E: 69,
58
+ OPEN_BRACKET: 91,
59
+ BACKSLASH: 92,
60
+ CLOSE_BRACKET: 93,
61
+ LOWER_E: 101,
62
+ OPEN_BRACE: 123,
63
+ CLOSE_BRACE: 125
64
+ }, c = {
65
+ "\"": "\"",
66
+ "\\": "\\",
67
+ "/": "/",
68
+ b: "\b",
69
+ f: "\f",
70
+ n: "\n",
71
+ r: "\r",
72
+ t: " "
73
+ }, l = class {
74
+ constructor(e) {
75
+ this.text = e, this.at = 0;
76
+ }
77
+ parse(e) {
78
+ this.skipSpaces();
79
+ let t = this.value(e, !1);
80
+ return this.skipSpaces(), this.at < this.text.length && this.fail(), t;
81
+ }
82
+ value(e, t) {
83
+ switch (this.text.charCodeAt(this.at)) {
84
+ case s.OPEN_BRACE: return this.object(e, t);
85
+ case s.OPEN_BRACKET: return this.array(e, t);
86
+ case s.QUOTE: return this.string();
87
+ case 116: return this.literal("true", !0);
88
+ case 102: return this.literal("false", !1);
89
+ case 110: return this.literal("null", null);
90
+ default: {
91
+ let n = this.number();
92
+ return t ? new r(n) : e === !0 ? n : Number(n);
93
+ }
94
+ }
95
+ }
96
+ object(t, n) {
97
+ this.at++;
98
+ let r = {}, c = !n && t !== void 0 && t !== !0 && e in t ? t[e] : void 0;
99
+ if (this.skipSpaces(), this.text.charCodeAt(this.at) === s.CLOSE_BRACE) return this.at++, r;
100
+ for (;;) {
101
+ this.text.charCodeAt(this.at) !== s.QUOTE && this.fail();
102
+ let e = this.string();
103
+ this.skipSpaces(), this.expect(s.COLON), this.skipSpaces(), a(r, e, c !== void 0 && e === c.member ? this.value(void 0, !0) : this.value(n ? void 0 : i(t, e), n)), this.skipSpaces();
104
+ let o = this.text.charCodeAt(this.at++);
105
+ if (o === s.CLOSE_BRACE) break;
106
+ o !== s.COMMA && this.fail(this.at - 1), this.skipSpaces();
107
+ }
108
+ if (c !== void 0 && Object.prototype.hasOwnProperty.call(r, c.member)) {
109
+ let e = r[c.discriminant];
110
+ a(r, c.member, o(r[c.member], typeof e == "string" ? c.cases[e] : void 0));
111
+ }
112
+ return r;
113
+ }
114
+ array(e, t) {
115
+ this.at++;
116
+ let n = [];
117
+ if (this.skipSpaces(), this.text.charCodeAt(this.at) === s.CLOSE_BRACKET) return this.at++, n;
118
+ let r = t ? void 0 : i(e, "*");
119
+ for (;;) {
120
+ n.push(this.value(r, t)), this.skipSpaces();
121
+ let e = this.text.charCodeAt(this.at++);
122
+ if (e === s.CLOSE_BRACKET) return n;
123
+ e !== s.COMMA && this.fail(this.at - 1), this.skipSpaces();
124
+ }
125
+ }
126
+ string() {
127
+ let e = this.text, t = ++this.at, n = "";
128
+ for (;;) {
129
+ let r = e.charCodeAt(this.at);
130
+ if (r === s.QUOTE) return n += e.slice(t, this.at++), n;
131
+ if (r === s.BACKSLASH) {
132
+ n += e.slice(t, this.at);
133
+ let r = e[this.at + 1];
134
+ if (r === "u") {
135
+ let t = e.slice(this.at + 2, this.at + 6);
136
+ /^[0-9a-fA-F]{4}$/.test(t) || this.fail(this.at), n += String.fromCharCode(Number.parseInt(t, 16)), this.at += 6;
137
+ } else {
138
+ let e = r === void 0 ? void 0 : c[r];
139
+ e === void 0 && this.fail(this.at), n += e, this.at += 2;
140
+ }
141
+ t = this.at;
142
+ } else r < s.SPACE || Number.isNaN(r) ? this.fail() : this.at++;
143
+ }
144
+ }
145
+ number() {
146
+ let e = this.text, t = this.at;
147
+ e.charCodeAt(this.at) === s.MINUS && this.at++;
148
+ let n = e.charCodeAt(this.at);
149
+ n === s.ZERO ? this.at++ : n > s.ZERO && n <= s.NINE ? this.digits() : this.fail(), e.charCodeAt(this.at) === s.DOT && (this.at++, this.digits() || this.fail());
150
+ let r = e.charCodeAt(this.at);
151
+ if (r === s.LOWER_E || r === s.UPPER_E) {
152
+ this.at++;
153
+ let t = e.charCodeAt(this.at);
154
+ (t === s.PLUS || t === s.MINUS) && this.at++, this.digits() || this.fail();
155
+ }
156
+ return e.slice(t, this.at);
157
+ }
158
+ digits() {
159
+ let e = this.at, t = this.text.charCodeAt(this.at);
160
+ for (; t >= s.ZERO && t <= s.NINE;) t = this.text.charCodeAt(++this.at);
161
+ return this.at > e;
162
+ }
163
+ literal(e, t) {
164
+ return this.text.startsWith(e, this.at) || this.fail(), this.at += e.length, t;
165
+ }
166
+ skipSpaces() {
167
+ let e = this.text.charCodeAt(this.at);
168
+ for (; e === s.SPACE || e === s.LF || e === s.CR || e === s.TAB;) e = this.text.charCodeAt(++this.at);
169
+ }
170
+ expect(e) {
171
+ this.text.charCodeAt(this.at) !== e && this.fail(), this.at++;
172
+ }
173
+ fail(e = this.at) {
174
+ throw SyntaxError(e >= this.text.length ? "Unexpected end of JSON input" : `Unexpected token in JSON at position ${e}`);
175
+ }
176
+ };
177
+ function u(e, t) {
178
+ return n(t) ? JSON.parse(e) : new l(e).parse(t);
179
+ }
180
+ var d = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
181
+ function f(e, t) {
182
+ if (n(t)) return JSON.stringify(e);
183
+ let r = [], i = `\u0000wow-number-${Math.random().toString(36).slice(2)}:`, a = p(e, t, r, i), o = JSON.stringify(a);
184
+ if (r.length === 0) return o;
185
+ let s = RegExp(`"${JSON.stringify(i).slice(1, -1).replace(/\\/g, "\\\\")}(\\d+)"`, "g");
186
+ return o.replace(s, (e, t) => r[Number(t)]);
187
+ }
188
+ function p(t, n, r, o) {
189
+ if (n === void 0 || t == null) return t;
190
+ if (n === !0) {
191
+ if (typeof t != "string") return t;
192
+ if (!d.test(t)) throw TypeError(`Not a JSON number: [${t}].`);
193
+ return r.push(t), `${o}${r.length - 1}`;
194
+ }
195
+ if (Array.isArray(t)) return t.map((e, t) => p(e, i(n, String(t)), r, o));
196
+ if (typeof t != "object") return t;
197
+ let s = t;
198
+ if (typeof s.toJSON == "function") return t;
199
+ let c = e in n ? n[e] : void 0, l = c === void 0 ? void 0 : s[c.discriminant], u = {};
200
+ for (let e of Object.keys(s)) {
201
+ let t = c === void 0 ? i(n, e) : e === c.member && typeof l == "string" ? c.cases[l] : void 0;
202
+ a(u, e, p(s[e], t, r, o));
203
+ }
204
+ return u;
205
+ }
206
+ function m(e) {
207
+ let n = e.textNumbers?.events;
208
+ return n === void 0 ? void 0 : t("name", "body", n);
209
+ }
210
+ //#endregion
211
+ export { m as eventNumbers, n as marksNothing, u as parseJson, f as stringifyJson, t as textNumbersBy };
212
+
213
+ //# sourceMappingURL=exactJson.es.js.map