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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/README.md +85 -230
  2. package/README.zh-CN.md +74 -209
  3. package/dist/commands.cjs +2 -0
  4. package/dist/commands.cjs.map +1 -0
  5. package/dist/commands.d.cts +123 -0
  6. package/dist/commands.d.ts +123 -0
  7. package/dist/commands.es.js +96 -0
  8. package/dist/commands.es.js.map +1 -0
  9. package/dist/dsl/aggregation/types.cjs.map +1 -1
  10. package/dist/dsl/aggregation/types.d.cts +1 -1
  11. package/dist/dsl/aggregation/types.d.ts +1 -1
  12. package/dist/dsl/aggregation/types.es.js.map +1 -1
  13. package/dist/dsl/cursorQuery.cjs.map +1 -1
  14. package/dist/dsl/cursorQuery.d.cts +7 -8
  15. package/dist/dsl/cursorQuery.d.ts +7 -8
  16. package/dist/dsl/cursorQuery.es.js.map +1 -1
  17. package/dist/dsl/descriptor.cjs.map +1 -1
  18. package/dist/dsl/descriptor.d.cts +8 -1
  19. package/dist/dsl/descriptor.d.ts +8 -1
  20. package/dist/dsl/descriptor.es.js.map +1 -1
  21. package/dist/dsl/documents.d.cts +1 -1
  22. package/dist/dsl/documents.d.ts +1 -1
  23. package/dist/dsl/filter/types.d.cts +2 -1
  24. package/dist/dsl/filter/types.d.ts +2 -1
  25. package/dist/dsl/projection.cjs.map +1 -1
  26. package/dist/dsl/projection.d.cts +22 -0
  27. package/dist/dsl/projection.d.ts +22 -0
  28. package/dist/dsl/projection.es.js.map +1 -1
  29. package/dist/dsl/queryErrorCodes.cjs +2 -0
  30. package/dist/dsl/queryErrorCodes.cjs.map +1 -0
  31. package/dist/{error → dsl}/queryErrorCodes.d.cts +25 -24
  32. package/dist/{error → dsl}/queryErrorCodes.d.ts +25 -24
  33. package/dist/{error → dsl}/queryErrorCodes.es.js +2 -1
  34. package/dist/{error/queryErrorCodes.cjs.map → dsl/queryErrorCodes.es.js.map} +1 -1
  35. package/dist/dsl.cjs +1 -1
  36. package/dist/dsl.d.cts +1 -2
  37. package/dist/dsl.d.ts +1 -2
  38. package/dist/dsl.es.js +2 -3
  39. package/dist/exactJson.cjs +3 -0
  40. package/dist/exactJson.cjs.map +1 -0
  41. package/dist/exactJson.d.cts +54 -0
  42. package/dist/exactJson.d.ts +54 -0
  43. package/dist/exactJson.es.js +213 -0
  44. package/dist/exactJson.es.js.map +1 -0
  45. package/dist/http.cjs +2 -0
  46. package/dist/http.cjs.map +1 -0
  47. package/dist/http.d.cts +96 -0
  48. package/dist/http.d.ts +96 -0
  49. package/dist/http.es.js +77 -0
  50. package/dist/http.es.js.map +1 -0
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.d.cts +19 -17
  53. package/dist/index.d.ts +19 -17
  54. package/dist/index.es.js +10 -36
  55. package/dist/manifest.cjs +2 -0
  56. package/dist/manifest.cjs.map +1 -0
  57. package/dist/manifest.d.cts +109 -0
  58. package/dist/manifest.d.ts +109 -0
  59. package/dist/manifest.es.js +14 -0
  60. package/dist/manifest.es.js.map +1 -0
  61. package/dist/problem.cjs +2 -0
  62. package/dist/problem.cjs.map +1 -0
  63. package/dist/problem.d.cts +211 -0
  64. package/dist/problem.d.ts +211 -0
  65. package/dist/problem.es.js +138 -0
  66. package/dist/problem.es.js.map +1 -0
  67. package/dist/queries.cjs +2 -0
  68. package/dist/queries.cjs.map +1 -0
  69. package/dist/queries.d.cts +182 -0
  70. package/dist/queries.d.ts +182 -0
  71. package/dist/queries.es.js +112 -0
  72. package/dist/queries.es.js.map +1 -0
  73. package/dist/state.cjs +2 -0
  74. package/dist/state.cjs.map +1 -0
  75. package/dist/state.d.cts +75 -0
  76. package/dist/state.d.ts +75 -0
  77. package/dist/state.es.js +70 -0
  78. package/dist/state.es.js.map +1 -0
  79. package/dist/streams.cjs +2 -0
  80. package/dist/streams.cjs.map +1 -0
  81. package/dist/streams.d.cts +74 -0
  82. package/dist/streams.d.ts +74 -0
  83. package/dist/streams.es.js +103 -0
  84. package/dist/streams.es.js.map +1 -0
  85. package/dist/wait.cjs +2 -0
  86. package/dist/wait.cjs.map +1 -0
  87. package/dist/wait.d.cts +61 -0
  88. package/dist/wait.d.ts +61 -0
  89. package/dist/wait.es.js +44 -0
  90. package/dist/wait.es.js.map +1 -0
  91. package/dist/wire.cjs +2 -0
  92. package/dist/wire.cjs.map +1 -0
  93. package/dist/wire.d.cts +326 -0
  94. package/dist/wire.d.ts +326 -0
  95. package/dist/wire.es.js +10 -0
  96. package/dist/wire.es.js.map +1 -0
  97. package/package.json +4 -16
  98. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.cjs +0 -1
  99. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.es.js +0 -9
  100. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.cjs +0 -1
  101. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.es.js +0 -6
  102. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.cjs +0 -1
  103. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.es.js +0 -8
  104. package/dist/client/bindMethods.cjs +0 -2
  105. package/dist/client/bindMethods.cjs.map +0 -1
  106. package/dist/client/bindMethods.d.cts +0 -13
  107. package/dist/client/bindMethods.d.ts +0 -13
  108. package/dist/client/bindMethods.es.js +0 -19
  109. package/dist/client/bindMethods.es.js.map +0 -1
  110. package/dist/client/command/commandClient.cjs +0 -2
  111. package/dist/client/command/commandClient.cjs.map +0 -1
  112. package/dist/client/command/commandClient.d.cts +0 -67
  113. package/dist/client/command/commandClient.d.ts +0 -67
  114. package/dist/client/command/commandClient.es.js +0 -38
  115. package/dist/client/command/commandClient.es.js.map +0 -1
  116. package/dist/client/command/commandHeaders.cjs +0 -2
  117. package/dist/client/command/commandHeaders.cjs.map +0 -1
  118. package/dist/client/command/commandHeaders.d.cts +0 -75
  119. package/dist/client/command/commandHeaders.d.ts +0 -75
  120. package/dist/client/command/commandHeaders.es.js +0 -31
  121. package/dist/client/command/commandHeaders.es.js.map +0 -1
  122. package/dist/client/command/commandRequest.cjs +0 -2
  123. package/dist/client/command/commandRequest.cjs.map +0 -1
  124. package/dist/client/command/commandRequest.d.cts +0 -180
  125. package/dist/client/command/commandRequest.d.ts +0 -180
  126. package/dist/client/command/commandRequest.es.js +0 -31
  127. package/dist/client/command/commandRequest.es.js.map +0 -1
  128. package/dist/client/command/commandResult.d.cts +0 -15
  129. package/dist/client/command/commandResult.d.ts +0 -15
  130. package/dist/client/command/index.d.cts +0 -5
  131. package/dist/client/command/index.d.ts +0 -5
  132. package/dist/client/command/types.d.cts +0 -71
  133. package/dist/client/command/types.d.ts +0 -71
  134. package/dist/client/metadata/index.d.cts +0 -2
  135. package/dist/client/metadata/index.d.ts +0 -2
  136. package/dist/client/metadata/wowMetadata.d.cts +0 -48
  137. package/dist/client/metadata/wowMetadata.d.ts +0 -48
  138. package/dist/client/metadata/wowMetadataClient.cjs +0 -2
  139. package/dist/client/metadata/wowMetadataClient.cjs.map +0 -1
  140. package/dist/client/metadata/wowMetadataClient.d.cts +0 -23
  141. package/dist/client/metadata/wowMetadataClient.d.ts +0 -23
  142. package/dist/client/metadata/wowMetadataClient.es.js +0 -25
  143. package/dist/client/metadata/wowMetadataClient.es.js.map +0 -1
  144. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs +0 -2
  145. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs.map +0 -1
  146. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.cts +0 -8
  147. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.ts +0 -8
  148. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js +0 -34
  149. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js.map +0 -1
  150. package/dist/client/query/dataset/datasetDirectoryClient.cjs +0 -2
  151. package/dist/client/query/dataset/datasetDirectoryClient.cjs.map +0 -1
  152. package/dist/client/query/dataset/datasetDirectoryClient.d.cts +0 -29
  153. package/dist/client/query/dataset/datasetDirectoryClient.d.ts +0 -29
  154. package/dist/client/query/dataset/datasetDirectoryClient.es.js +0 -25
  155. package/dist/client/query/dataset/datasetDirectoryClient.es.js.map +0 -1
  156. package/dist/client/query/dataset/datasetQueryApi.d.cts +0 -40
  157. package/dist/client/query/dataset/datasetQueryApi.d.ts +0 -40
  158. package/dist/client/query/dataset/datasetQueryClient.cjs +0 -2
  159. package/dist/client/query/dataset/datasetQueryClient.cjs.map +0 -1
  160. package/dist/client/query/dataset/datasetQueryClient.d.cts +0 -57
  161. package/dist/client/query/dataset/datasetQueryClient.d.ts +0 -57
  162. package/dist/client/query/dataset/datasetQueryClient.es.js +0 -154
  163. package/dist/client/query/dataset/datasetQueryClient.es.js.map +0 -1
  164. package/dist/client/query/dataset/endpointPaths.cjs +0 -2
  165. package/dist/client/query/dataset/endpointPaths.cjs.map +0 -1
  166. package/dist/client/query/dataset/endpointPaths.d.cts +0 -9
  167. package/dist/client/query/dataset/endpointPaths.d.ts +0 -9
  168. package/dist/client/query/dataset/endpointPaths.es.js +0 -14
  169. package/dist/client/query/dataset/endpointPaths.es.js.map +0 -1
  170. package/dist/client/query/dataset/index.d.cts +0 -3
  171. package/dist/client/query/dataset/index.d.ts +0 -3
  172. package/dist/client/query/descriptor/descriptorEndpoints.cjs +0 -2
  173. package/dist/client/query/descriptor/descriptorEndpoints.cjs.map +0 -1
  174. package/dist/client/query/descriptor/descriptorEndpoints.d.cts +0 -29
  175. package/dist/client/query/descriptor/descriptorEndpoints.d.ts +0 -29
  176. package/dist/client/query/descriptor/descriptorEndpoints.es.js +0 -69
  177. package/dist/client/query/descriptor/descriptorEndpoints.es.js.map +0 -1
  178. package/dist/client/query/descriptor/endpointPaths.cjs +0 -2
  179. package/dist/client/query/descriptor/endpointPaths.cjs.map +0 -1
  180. package/dist/client/query/descriptor/endpointPaths.d.cts +0 -4
  181. package/dist/client/query/descriptor/endpointPaths.d.ts +0 -4
  182. package/dist/client/query/descriptor/endpointPaths.es.js +0 -9
  183. package/dist/client/query/descriptor/endpointPaths.es.js.map +0 -1
  184. package/dist/client/query/descriptor/index.d.cts +0 -2
  185. package/dist/client/query/descriptor/index.d.ts +0 -2
  186. package/dist/client/query/descriptor/queryDescriptorApi.d.cts +0 -58
  187. package/dist/client/query/descriptor/queryDescriptorApi.d.ts +0 -58
  188. package/dist/client/query/descriptor/queryDescriptorClient.cjs +0 -2
  189. package/dist/client/query/descriptor/queryDescriptorClient.cjs.map +0 -1
  190. package/dist/client/query/descriptor/queryDescriptorClient.d.cts +0 -61
  191. package/dist/client/query/descriptor/queryDescriptorClient.d.ts +0 -61
  192. package/dist/client/query/descriptor/queryDescriptorClient.es.js +0 -20
  193. package/dist/client/query/descriptor/queryDescriptorClient.es.js.map +0 -1
  194. package/dist/client/query/event/endpointPaths.cjs +0 -2
  195. package/dist/client/query/event/endpointPaths.cjs.map +0 -1
  196. package/dist/client/query/event/endpointPaths.d.cts +0 -8
  197. package/dist/client/query/event/endpointPaths.d.ts +0 -8
  198. package/dist/client/query/event/endpointPaths.es.js +0 -13
  199. package/dist/client/query/event/endpointPaths.es.js.map +0 -1
  200. package/dist/client/query/event/eventStreamQueryApi.d.cts +0 -29
  201. package/dist/client/query/event/eventStreamQueryApi.d.ts +0 -29
  202. package/dist/client/query/event/eventStreamQueryClient.cjs +0 -2
  203. package/dist/client/query/event/eventStreamQueryClient.cjs.map +0 -1
  204. package/dist/client/query/event/eventStreamQueryClient.d.cts +0 -193
  205. package/dist/client/query/event/eventStreamQueryClient.d.ts +0 -193
  206. package/dist/client/query/event/eventStreamQueryClient.es.js +0 -160
  207. package/dist/client/query/event/eventStreamQueryClient.es.js.map +0 -1
  208. package/dist/client/query/event/index.d.cts +0 -2
  209. package/dist/client/query/event/index.d.ts +0 -2
  210. package/dist/client/query/factory.cjs +0 -2
  211. package/dist/client/query/factory.cjs.map +0 -1
  212. package/dist/client/query/factory.d.cts +0 -165
  213. package/dist/client/query/factory.d.ts +0 -165
  214. package/dist/client/query/factory.es.js +0 -45
  215. package/dist/client/query/factory.es.js.map +0 -1
  216. package/dist/client/query/index.d.cts +0 -7
  217. package/dist/client/query/index.d.ts +0 -7
  218. package/dist/client/query/queryApi.d.cts +0 -68
  219. package/dist/client/query/queryApi.d.ts +0 -68
  220. package/dist/client/query/requests.d.cts +0 -24
  221. package/dist/client/query/requests.d.ts +0 -24
  222. package/dist/client/query/snapshot/endpointPaths.cjs +0 -2
  223. package/dist/client/query/snapshot/endpointPaths.cjs.map +0 -1
  224. package/dist/client/query/snapshot/endpointPaths.d.cts +0 -12
  225. package/dist/client/query/snapshot/endpointPaths.d.ts +0 -12
  226. package/dist/client/query/snapshot/endpointPaths.es.js +0 -17
  227. package/dist/client/query/snapshot/endpointPaths.es.js.map +0 -1
  228. package/dist/client/query/snapshot/index.d.cts +0 -2
  229. package/dist/client/query/snapshot/index.d.ts +0 -2
  230. package/dist/client/query/snapshot/snapshotQueryApi.d.cts +0 -101
  231. package/dist/client/query/snapshot/snapshotQueryApi.d.ts +0 -101
  232. package/dist/client/query/snapshot/snapshotQueryClient.cjs +0 -2
  233. package/dist/client/query/snapshot/snapshotQueryClient.cjs.map +0 -1
  234. package/dist/client/query/snapshot/snapshotQueryClient.d.cts +0 -372
  235. package/dist/client/query/snapshot/snapshotQueryClient.d.ts +0 -372
  236. package/dist/client/query/snapshot/snapshotQueryClient.es.js +0 -239
  237. package/dist/client/query/snapshot/snapshotQueryClient.es.js.map +0 -1
  238. package/dist/client/query/state/endpointPaths.cjs +0 -2
  239. package/dist/client/query/state/endpointPaths.cjs.map +0 -1
  240. package/dist/client/query/state/endpointPaths.d.cts +0 -10
  241. package/dist/client/query/state/endpointPaths.d.ts +0 -10
  242. package/dist/client/query/state/endpointPaths.es.js +0 -14
  243. package/dist/client/query/state/endpointPaths.es.js.map +0 -1
  244. package/dist/client/query/state/index.d.cts +0 -4
  245. package/dist/client/query/state/index.d.ts +0 -4
  246. package/dist/client/query/state/loadOwnerStateAggregateApi.d.cts +0 -36
  247. package/dist/client/query/state/loadOwnerStateAggregateApi.d.ts +0 -36
  248. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs +0 -2
  249. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs.map +0 -1
  250. package/dist/client/query/state/loadOwnerStateAggregateClient.d.cts +0 -58
  251. package/dist/client/query/state/loadOwnerStateAggregateClient.d.ts +0 -58
  252. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js +0 -56
  253. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js.map +0 -1
  254. package/dist/client/query/state/loadStateAggregateApi.d.cts +0 -37
  255. package/dist/client/query/state/loadStateAggregateApi.d.ts +0 -37
  256. package/dist/client/query/state/loadStateAggregateClient.cjs +0 -2
  257. package/dist/client/query/state/loadStateAggregateClient.cjs.map +0 -1
  258. package/dist/client/query/state/loadStateAggregateClient.d.cts +0 -62
  259. package/dist/client/query/state/loadStateAggregateClient.d.ts +0 -62
  260. package/dist/client/query/state/loadStateAggregateClient.es.js +0 -65
  261. package/dist/client/query/state/loadStateAggregateClient.es.js.map +0 -1
  262. package/dist/client/routing.cjs +0 -2
  263. package/dist/client/routing.cjs.map +0 -1
  264. package/dist/client/routing.d.cts +0 -47
  265. package/dist/client/routing.d.ts +0 -47
  266. package/dist/client/routing.es.js +0 -8
  267. package/dist/client/routing.es.js.map +0 -1
  268. package/dist/error/errorInfo.cjs +0 -2
  269. package/dist/error/errorInfo.cjs.map +0 -1
  270. package/dist/error/errorInfo.d.cts +0 -139
  271. package/dist/error/errorInfo.d.ts +0 -139
  272. package/dist/error/errorInfo.es.js +0 -32
  273. package/dist/error/errorInfo.es.js.map +0 -1
  274. package/dist/error/headers.cjs +0 -2
  275. package/dist/error/headers.cjs.map +0 -1
  276. package/dist/error/headers.d.cts +0 -39
  277. package/dist/error/headers.d.ts +0 -39
  278. package/dist/error/headers.es.js +0 -10
  279. package/dist/error/headers.es.js.map +0 -1
  280. package/dist/error/index.d.cts +0 -21
  281. package/dist/error/index.d.ts +0 -21
  282. package/dist/error/queryErrorCodes.cjs +0 -2
  283. package/dist/error/queryErrorCodes.es.js.map +0 -1
  284. package/dist/error/wowError.cjs +0 -2
  285. package/dist/error/wowError.cjs.map +0 -1
  286. package/dist/error/wowError.d.cts +0 -99
  287. package/dist/error/wowError.d.ts +0 -99
  288. package/dist/error/wowError.es.js +0 -53
  289. package/dist/error/wowError.es.js.map +0 -1
  290. package/dist/legacy/condition.cjs +0 -2
  291. package/dist/legacy/condition.cjs.map +0 -1
  292. package/dist/legacy/condition.d.cts +0 -517
  293. package/dist/legacy/condition.d.ts +0 -517
  294. package/dist/legacy/condition.es.js +0 -338
  295. package/dist/legacy/condition.es.js.map +0 -1
  296. package/dist/legacy/index.d.cts +0 -16
  297. package/dist/legacy/index.d.ts +0 -16
  298. package/dist/legacy/locale/en_US.cjs +0 -2
  299. package/dist/legacy/locale/en_US.cjs.map +0 -1
  300. package/dist/legacy/locale/en_US.d.cts +0 -7
  301. package/dist/legacy/locale/en_US.d.ts +0 -7
  302. package/dist/legacy/locale/en_US.es.js +0 -50
  303. package/dist/legacy/locale/en_US.es.js.map +0 -1
  304. package/dist/legacy/locale/operatorLocale.d.cts +0 -10
  305. package/dist/legacy/locale/operatorLocale.d.ts +0 -10
  306. package/dist/legacy/locale/zh_CN.cjs +0 -2
  307. package/dist/legacy/locale/zh_CN.cjs.map +0 -1
  308. package/dist/legacy/locale/zh_CN.d.cts +0 -7
  309. package/dist/legacy/locale/zh_CN.d.ts +0 -7
  310. package/dist/legacy/locale/zh_CN.es.js +0 -50
  311. package/dist/legacy/locale/zh_CN.es.js.map +0 -1
  312. package/dist/legacy/operator.cjs +0 -2
  313. package/dist/legacy/operator.cjs.map +0 -1
  314. package/dist/legacy/operator.d.cts +0 -218
  315. package/dist/legacy/operator.d.ts +0 -218
  316. package/dist/legacy/operator.es.js +0 -25
  317. package/dist/legacy/operator.es.js.map +0 -1
  318. package/dist/legacy/queryable.cjs +0 -2
  319. package/dist/legacy/queryable.cjs.map +0 -1
  320. package/dist/legacy/queryable.d.cts +0 -61
  321. package/dist/legacy/queryable.d.ts +0 -61
  322. package/dist/legacy/queryable.es.js +0 -34
  323. package/dist/legacy/queryable.es.js.map +0 -1
  324. package/dist/legacy.cjs +0 -1
  325. package/dist/legacy.es.js +0 -6
  326. package/dist/model/abac.cjs +0 -2
  327. package/dist/model/abac.cjs.map +0 -1
  328. package/dist/model/abac.d.cts +0 -33
  329. package/dist/model/abac.d.ts +0 -33
  330. package/dist/model/abac.es.js +0 -6
  331. package/dist/model/abac.es.js.map +0 -1
  332. package/dist/model/bi.cjs +0 -2
  333. package/dist/model/bi.cjs.map +0 -1
  334. package/dist/model/bi.d.cts +0 -12
  335. package/dist/model/bi.d.ts +0 -12
  336. package/dist/model/bi.es.js +0 -8
  337. package/dist/model/bi.es.js.map +0 -1
  338. package/dist/model/command.cjs +0 -2
  339. package/dist/model/command.cjs.map +0 -1
  340. package/dist/model/command.d.cts +0 -137
  341. package/dist/model/command.d.ts +0 -137
  342. package/dist/model/command.es.js +0 -8
  343. package/dist/model/command.es.js.map +0 -1
  344. package/dist/model/common.d.cts +0 -19
  345. package/dist/model/common.d.ts +0 -19
  346. package/dist/model/domainEventStream.cjs +0 -2
  347. package/dist/model/domainEventStream.cjs.map +0 -1
  348. package/dist/model/domainEventStream.d.cts +0 -109
  349. package/dist/model/domainEventStream.d.ts +0 -109
  350. package/dist/model/domainEventStream.es.js +0 -23
  351. package/dist/model/domainEventStream.es.js.map +0 -1
  352. package/dist/model/function.cjs +0 -2
  353. package/dist/model/function.cjs.map +0 -1
  354. package/dist/model/function.d.cts +0 -41
  355. package/dist/model/function.d.ts +0 -41
  356. package/dist/model/function.es.js +0 -8
  357. package/dist/model/function.es.js.map +0 -1
  358. package/dist/model/index.d.cts +0 -24
  359. package/dist/model/index.d.ts +0 -24
  360. package/dist/model/messaging.d.cts +0 -5
  361. package/dist/model/messaging.d.ts +0 -5
  362. package/dist/model/modeling.d.cts +0 -145
  363. package/dist/model/modeling.d.ts +0 -145
  364. package/dist/model/naming.d.cts +0 -27
  365. package/dist/model/naming.d.ts +0 -27
  366. package/dist/model/snapshot.cjs +0 -2
  367. package/dist/model/snapshot.cjs.map +0 -1
  368. package/dist/model/snapshot.d.cts +0 -53
  369. package/dist/model/snapshot.d.ts +0 -53
  370. package/dist/model/snapshot.es.js +0 -20
  371. package/dist/model/snapshot.es.js.map +0 -1
  372. package/dist/transport/endpoints.cjs +0 -2
  373. package/dist/transport/endpoints.cjs.map +0 -1
  374. package/dist/transport/endpoints.d.cts +0 -79
  375. package/dist/transport/endpoints.d.ts +0 -79
  376. package/dist/transport/endpoints.es.js +0 -14
  377. package/dist/transport/endpoints.es.js.map +0 -1
  378. package/dist/transport/eventStreams.cjs +0 -2
  379. package/dist/transport/eventStreams.cjs.map +0 -1
  380. package/dist/transport/eventStreams.d.cts +0 -25
  381. package/dist/transport/eventStreams.d.ts +0 -25
  382. package/dist/transport/eventStreams.es.js +0 -21
  383. package/dist/transport/eventStreams.es.js.map +0 -1
  384. package/dist/transport/index.d.cts +0 -1
  385. package/dist/transport/index.d.ts +0 -1
package/dist/wire.d.ts ADDED
@@ -0,0 +1,326 @@
1
+ import { TextNumbers } from './exactJson.js';
2
+ /**
3
+ * The wire model of a Wow service: what its routes answer, as the server
4
+ * writes it (`wow-api`'s `CommandResult`, the edge's state views, the query
5
+ * records). Types and wire values only.
6
+ */
7
+ /** An aggregate type: its bounded context and its name. */
8
+ export interface AggregateType {
9
+ readonly context: string;
10
+ readonly name: string;
11
+ /**
12
+ * Which numbers of its states, events and commands are read and written
13
+ * as their exact text (review R4-Q, Q-9): the `int64`, `bigint` and
14
+ * `decimal` fields of its Manifest, as wow-generator writes them.
15
+ */
16
+ readonly textNumbers?: AggregateTextNumbers;
17
+ }
18
+ /** The numbers of an aggregate type kept as their exact text ({@link TextNumbers}). */
19
+ export interface AggregateTextNumbers {
20
+ /** Those of its state. */
21
+ readonly state?: TextNumbers;
22
+ /** Those of each event's body, by the event's name as the server sends it. */
23
+ readonly events?: Readonly<Record<string, TextNumbers>>;
24
+ /** Those of each command's body, by the command's name. */
25
+ readonly commands?: Readonly<Record<string, TextNumbers>>;
26
+ }
27
+ /** One aggregate: its type, its tenant and its id. */
28
+ export interface AggregateRef {
29
+ readonly type: AggregateType;
30
+ readonly tenantId: string;
31
+ readonly id: string;
32
+ }
33
+ /** The owner and the space an aggregate belongs to, beside its tenant. */
34
+ export interface Scope {
35
+ readonly ownerId?: string | null;
36
+ readonly spaceId?: string | null;
37
+ }
38
+ /**
39
+ * Who sent a command (decision D163): the opaque id of the authenticated
40
+ * subject, its own tenant, and whether it acted in another tenant or scope.
41
+ * Resolve the id to a display name in the application, never from Wow.
42
+ */
43
+ export interface Operator {
44
+ readonly id: string;
45
+ readonly tenantId: string;
46
+ readonly crossScope: boolean;
47
+ }
48
+ /** How far a command has come (decision D61). */
49
+ export declare const Stage: {
50
+ /** The command passed admission. */
51
+ readonly ACCEPTED: "ACCEPTED";
52
+ /** The command's events are appended to the log. */
53
+ readonly COMMITTED: "COMMITTED";
54
+ /** A named subscription has handled the commit. */
55
+ readonly HANDLED: "HANDLED";
56
+ };
57
+ /** A {@link Stage} value. */
58
+ export type Stage = (typeof Stage)[keyof typeof Stage];
59
+ /**
60
+ * One hop of a wait chain (decision D62): a stage, in a context (the
61
+ * command's own when absent), of a subscription when the stage is
62
+ * `HANDLED`. The snapshot is the subscription named `snapshot`.
63
+ */
64
+ export interface Hop {
65
+ readonly stage: Stage;
66
+ readonly context?: string | null;
67
+ readonly subscription?: string | null;
68
+ }
69
+ /** The kind of function that produced a result. */
70
+ export type FunctionKind = 'COMMAND' | 'PROJECT' | 'REACT' | 'SAGA' | 'SNAPSHOT' | 'RESERVATION' | 'TIMERS';
71
+ /** Who produced a result: a function of `kind` in `context`. */
72
+ export interface FunctionInfo {
73
+ readonly kind: FunctionKind;
74
+ readonly context: string;
75
+ readonly processor: string;
76
+ readonly name: string;
77
+ }
78
+ /** A field-level validation error. */
79
+ export interface Violation {
80
+ /** The path of the field, or the query part, that broke the rule. */
81
+ readonly path: string;
82
+ /** The rule's code, such as `NotBlank` or `UNKNOWN_FIELD`. */
83
+ readonly code: string;
84
+ /** A human-readable message. */
85
+ readonly message: string;
86
+ }
87
+ /** Why a command was rejected or failed. */
88
+ export interface ErrorInfo {
89
+ /** A framework code (`wow.*`) or the domain's own. */
90
+ readonly code: string;
91
+ readonly message: string;
92
+ readonly violations?: readonly Violation[];
93
+ /**
94
+ * The rejection's structured data (decision D211), which a problem
95
+ * writes as its extension members.
96
+ */
97
+ readonly extensions?: Readonly<Record<string, unknown>>;
98
+ }
99
+ /** How a command ended at a hop. */
100
+ export type CommandResultStatus = 'SUCCEEDED' | 'REJECTED' | 'FAILED';
101
+ /**
102
+ * The command a request named before a transformer turned it into the one
103
+ * that ran (decision D182).
104
+ */
105
+ export interface TransformedFrom {
106
+ /** The full type name, `context.aggregate.Command`. */
107
+ readonly command: string;
108
+ readonly aggregateId?: string | null;
109
+ }
110
+ /**
111
+ * The one outward result of a command (design 08 §7): what it reached at one
112
+ * hop of its wait chain. A command route answers the last one; its event
113
+ * stream sends one per hop.
114
+ *
115
+ * A chain can end before its plan does (decision D212): a hop, such as a
116
+ * saga's that sent no command (a declined payment, say), leaves nothing to
117
+ * reach the later hops. Its result is then the last one, at that hop with its
118
+ * own status, `chainEnded` and the hops not reached in `pending`; a server
119
+ * before D212 sends neither, so read them as `false` and empty when absent.
120
+ *
121
+ * @typeParam R - The shape of `results`, what the command's decide function
122
+ * answered with.
123
+ */
124
+ export interface CommandResult<R = Record<string, unknown>> {
125
+ readonly format: number;
126
+ readonly commandId: string;
127
+ readonly requestId: string;
128
+ readonly correlationId: string;
129
+ readonly ref: AggregateRef;
130
+ readonly hop: Hop;
131
+ readonly function: FunctionInfo;
132
+ readonly status: CommandResultStatus;
133
+ /** The aggregate's version after the commit, or the unchanged one. */
134
+ readonly version?: number | null;
135
+ /** The request was already committed: it was not decided again. */
136
+ readonly duplicate: boolean;
137
+ /** Set when `status` is `REJECTED` or `FAILED`. */
138
+ readonly error?: ErrorInfo | null;
139
+ readonly results: R;
140
+ /** On a saga's hop, the ids of the commands it derived. */
141
+ readonly derived: readonly string[];
142
+ /** When it was produced, in epoch milliseconds. */
143
+ readonly signalTime: number;
144
+ readonly transformedFrom?: TransformedFrom | null;
145
+ /**
146
+ * The chain ended at this hop before its plan did (decision D212): the
147
+ * hops in `pending` will not come.
148
+ */
149
+ readonly chainEnded?: boolean;
150
+ /** When `chainEnded`, the hops of the plan not reached, in order. */
151
+ readonly pending?: readonly Hop[];
152
+ }
153
+ /** The tags of an aggregate: names to values. */
154
+ export type Tags = Readonly<Record<string, readonly string[]>>;
155
+ /**
156
+ * An aggregate's state at a version (decision D40), as
157
+ * `GET /{context}/{aggregate}/{id}/state` answers it.
158
+ *
159
+ * @typeParam S - The state's type.
160
+ */
161
+ export interface StateView<S = unknown> {
162
+ readonly ref: AggregateRef;
163
+ readonly version: number;
164
+ readonly scope: Scope;
165
+ readonly deleted: boolean;
166
+ readonly tags: Tags;
167
+ readonly state: S;
168
+ }
169
+ /**
170
+ * An event as Wow reads it now: under its current name, upgraded to its latest revision. The `events` query gives
171
+ * every stored event so, however old its record, and leaves out the events its aggregate retired, so a generated
172
+ * `<Aggregate>Event` union, with {@link SystemEvent}, covers each event it returns.
173
+ *
174
+ * @typeParam N - The event's name.
175
+ * @typeParam B - The event's body.
176
+ */
177
+ export interface EventView<N extends string = string, B = unknown> {
178
+ readonly name: N;
179
+ readonly revision: number;
180
+ readonly body: B;
181
+ }
182
+ /** The body of `wow.lifecycle.OwnerTransferred`: the aggregate's new owner. */
183
+ export interface OwnerTransferred {
184
+ readonly ownerId: string;
185
+ }
186
+ /** The body of `wow.lifecycle.SpaceTransferred`: the aggregate's new space. */
187
+ export interface SpaceTransferred {
188
+ readonly spaceId: string;
189
+ }
190
+ /** The body of `wow.lifecycle.TagsApplied`: the aggregate's tags now. */
191
+ export interface TagsApplied {
192
+ readonly tags: Tags;
193
+ }
194
+ /**
195
+ * The body of `wow.ScheduleSet` (decision D198): the aggregate set its
196
+ * schedule `key`, to send `target` the command of type `commandType`
197
+ * (`command` its JSON text) as `rule` says.
198
+ */
199
+ export interface ScheduleSet {
200
+ readonly key: string;
201
+ readonly rule: ScheduleRule;
202
+ readonly target: AggregateRef;
203
+ readonly commandType: string;
204
+ readonly command: string;
205
+ }
206
+ /** The body of `wow.ScheduleCancelled` (decision D198). */
207
+ export interface ScheduleCancelled {
208
+ readonly key: string;
209
+ }
210
+ /**
211
+ * The system events the kernel gives every aggregate (decisions D113, D198):
212
+ * the lifecycle events and the schedule events. A state trace and an event
213
+ * stream carry them beside the aggregate's own events, so the event union
214
+ * `wow-generator` writes for an aggregate includes this one.
215
+ */
216
+ export type SystemEvent = EventView<'wow.lifecycle.AggregateDeleted', Readonly<Record<string, never>>> | EventView<'wow.lifecycle.AggregateRestored', Readonly<Record<string, never>>> | EventView<'wow.lifecycle.OwnerTransferred', OwnerTransferred> | EventView<'wow.lifecycle.SpaceTransferred', SpaceTransferred> | EventView<'wow.lifecycle.TagsApplied', TagsApplied> | EventView<'wow.ScheduleSet', ScheduleSet> | EventView<'wow.ScheduleCancelled', ScheduleCancelled>;
217
+ /**
218
+ * One commit of a state trace (decision D40): the events of a version and the
219
+ * aggregate after it.
220
+ *
221
+ * @typeParam S - The state's type.
222
+ * @typeParam E - The events' type.
223
+ */
224
+ export interface CommitView<S = unknown, E extends EventView = EventView> {
225
+ readonly version: number;
226
+ /** When it was committed, in epoch milliseconds. */
227
+ readonly commitTime: number;
228
+ readonly commandId: string;
229
+ readonly requestId: string;
230
+ readonly commandType: string;
231
+ readonly events: readonly E[];
232
+ readonly scope: Scope;
233
+ readonly deleted: boolean;
234
+ readonly tags: Tags;
235
+ readonly state: S;
236
+ readonly operator?: Operator | null;
237
+ }
238
+ /**
239
+ * What `GET /{context}/{aggregate}/{id}/state/trace` answers: the aggregate
240
+ * and its commits in version order.
241
+ */
242
+ export interface StateTrace<S = unknown, E extends EventView = EventView> {
243
+ readonly ref: AggregateRef;
244
+ readonly commits: readonly CommitView<S, E>[];
245
+ }
246
+ /**
247
+ * A record of the `snapshot` query model (decisions D128, D163): the
248
+ * aggregate's system fields and its state.
249
+ *
250
+ * @typeParam S - The state's type.
251
+ */
252
+ export interface SnapshotRecord<S = unknown> {
253
+ readonly tenantId: string;
254
+ readonly aggregateId: string;
255
+ readonly version: number;
256
+ readonly ownerId: string | null;
257
+ readonly spaceId: string | null;
258
+ readonly deleted: boolean;
259
+ readonly tags: Tags;
260
+ /** The first commit's time, in epoch milliseconds. */
261
+ readonly firstEventTime: number;
262
+ /** The last commit's time, in epoch milliseconds. */
263
+ readonly lastEventTime: number;
264
+ /** Who sent the last command; null for an anonymous caller. */
265
+ readonly operator: Operator | null;
266
+ /** Who created the aggregate; null for an anonymous caller. */
267
+ readonly firstOperator: Operator | null;
268
+ /**
269
+ * The schedules the aggregate keeps (decision D198): each rule, `{type,
270
+ * ...}`, by its key; absent from a server before 6.8c.
271
+ */
272
+ readonly schedules?: Readonly<Record<string, ScheduleRule>>;
273
+ readonly state: S;
274
+ }
275
+ /**
276
+ * The system fields of a snapshot record a query can filter, sort and
277
+ * project on; a state field is `state.<path>`.
278
+ */
279
+ export type SnapshotSystemField = 'tenantId' | 'aggregateId' | 'version' | 'ownerId' | 'spaceId' | 'deleted' | 'tags' | 'firstEventTime' | 'lastEventTime' | 'operator' | 'operator.id' | 'operator.tenantId' | 'operator.crossScope' | 'firstOperator' | 'firstOperator.id' | 'firstOperator.tenantId' | 'firstOperator.crossScope' | 'schedules';
280
+ /** A schedule rule of a snapshot's `schedules` (decision D198). */
281
+ export interface ScheduleRule {
282
+ /** The rule's type: `at`, `after`, `cron`, … */
283
+ readonly type: string;
284
+ readonly [property: string]: unknown;
285
+ }
286
+ /**
287
+ * A record of the `events` query model (decision D131): one commit of one
288
+ * aggregate and its events.
289
+ *
290
+ * @typeParam E - The events' type.
291
+ */
292
+ export interface EventStreamRecord<E extends EventView = EventView> {
293
+ readonly aggregateId: string;
294
+ readonly tenantId: string;
295
+ readonly version: number;
296
+ /** When it was committed, in epoch milliseconds. */
297
+ readonly commitTime: number;
298
+ readonly commandId: string;
299
+ readonly requestId: string;
300
+ readonly commandType: string;
301
+ /** Null when the stream has none (`Scope.NONE`). */
302
+ readonly ownerId?: string | null;
303
+ readonly spaceId?: string | null;
304
+ /** Null for an anonymous caller (decision D163). */
305
+ readonly operator?: Operator | null;
306
+ readonly events: readonly E[];
307
+ }
308
+ /**
309
+ * The fields of an event stream record a query names (decision D235): its
310
+ * system fields and `events`, the array an `elementMatch` filter and an
311
+ * aggregation's `elements` reach an event through, by the event's own
312
+ * `name`, `revision` and `body.*`.
313
+ */
314
+ export type EventStreamField = 'aggregateId' | 'tenantId' | 'version' | 'commitTime' | 'commandId' | 'requestId' | 'commandType' | 'ownerId' | 'spaceId' | 'operator' | 'operator.id' | 'operator.tenantId' | 'operator.crossScope' | 'events';
315
+ /** How an aggregate belongs to its callers (decision D189). */
316
+ export type Ownership = 'OWNER' | 'TENANT';
317
+ /** One dataset of `GET /wow/dataset` (decision D145). */
318
+ export interface DatasetEntry {
319
+ /** `{context}.{dataset}`. */
320
+ readonly name: string;
321
+ readonly context: string;
322
+ readonly dataset: string;
323
+ readonly title?: string | null;
324
+ /** The path of its query route. */
325
+ readonly path: string;
326
+ }
@@ -0,0 +1,10 @@
1
+ //#region src/wire.ts
2
+ var e = {
3
+ ACCEPTED: "ACCEPTED",
4
+ COMMITTED: "COMMITTED",
5
+ HANDLED: "HANDLED"
6
+ };
7
+ //#endregion
8
+ export { e as Stage };
9
+
10
+ //# sourceMappingURL=wire.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.es.js","names":["Stage"],"sources":["../src/wire.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 { TextNumbers } from './exactJson.js';\n\n/**\n * The wire model of a Wow service: what its routes answer, as the server\n * writes it (`wow-api`'s `CommandResult`, the edge's state views, the query\n * records). Types and wire values only.\n */\n\n/** An aggregate type: its bounded context and its name. */\nexport interface AggregateType {\n readonly context: string;\n readonly name: string;\n /**\n * Which numbers of its states, events and commands are read and written\n * as their exact text (review R4-Q, Q-9): the `int64`, `bigint` and\n * `decimal` fields of its Manifest, as wow-generator writes them.\n */\n readonly textNumbers?: AggregateTextNumbers;\n}\n\n/** The numbers of an aggregate type kept as their exact text ({@link TextNumbers}). */\nexport interface AggregateTextNumbers {\n /** Those of its state. */\n readonly state?: TextNumbers;\n /** Those of each event's body, by the event's name as the server sends it. */\n readonly events?: Readonly<Record<string, TextNumbers>>;\n /** Those of each command's body, by the command's name. */\n readonly commands?: Readonly<Record<string, TextNumbers>>;\n}\n\n/** One aggregate: its type, its tenant and its id. */\nexport interface AggregateRef {\n readonly type: AggregateType;\n readonly tenantId: string;\n readonly id: string;\n}\n\n/** The owner and the space an aggregate belongs to, beside its tenant. */\nexport interface Scope {\n readonly ownerId?: string | null;\n readonly spaceId?: string | null;\n}\n\n/**\n * Who sent a command (decision D163): the opaque id of the authenticated\n * subject, its own tenant, and whether it acted in another tenant or scope.\n * Resolve the id to a display name in the application, never from Wow.\n */\nexport interface Operator {\n readonly id: string;\n readonly tenantId: string;\n readonly crossScope: boolean;\n}\n\n/** How far a command has come (decision D61). */\nexport const Stage = {\n /** The command passed admission. */\n ACCEPTED: 'ACCEPTED',\n /** The command's events are appended to the log. */\n COMMITTED: 'COMMITTED',\n /** A named subscription has handled the commit. */\n HANDLED: 'HANDLED',\n} as const;\n\n/** A {@link Stage} value. */\nexport type Stage = (typeof Stage)[keyof typeof Stage];\n\n/**\n * One hop of a wait chain (decision D62): a stage, in a context (the\n * command's own when absent), of a subscription when the stage is\n * `HANDLED`. The snapshot is the subscription named `snapshot`.\n */\nexport interface Hop {\n readonly stage: Stage;\n readonly context?: string | null;\n readonly subscription?: string | null;\n}\n\n/** The kind of function that produced a result. */\nexport type FunctionKind =\n | 'COMMAND'\n | 'PROJECT'\n | 'REACT'\n | 'SAGA'\n | 'SNAPSHOT'\n | 'RESERVATION'\n | 'TIMERS';\n\n/** Who produced a result: a function of `kind` in `context`. */\nexport interface FunctionInfo {\n readonly kind: FunctionKind;\n readonly context: string;\n readonly processor: string;\n readonly name: string;\n}\n\n/** A field-level validation error. */\nexport interface Violation {\n /** The path of the field, or the query part, that broke the rule. */\n readonly path: string;\n /** The rule's code, such as `NotBlank` or `UNKNOWN_FIELD`. */\n readonly code: string;\n /** A human-readable message. */\n readonly message: string;\n}\n\n/** Why a command was rejected or failed. */\nexport interface ErrorInfo {\n /** A framework code (`wow.*`) or the domain's own. */\n readonly code: string;\n readonly message: string;\n readonly violations?: readonly Violation[];\n /**\n * The rejection's structured data (decision D211), which a problem\n * writes as its extension members.\n */\n readonly extensions?: Readonly<Record<string, unknown>>;\n}\n\n/** How a command ended at a hop. */\nexport type CommandResultStatus = 'SUCCEEDED' | 'REJECTED' | 'FAILED';\n\n/**\n * The command a request named before a transformer turned it into the one\n * that ran (decision D182).\n */\nexport interface TransformedFrom {\n /** The full type name, `context.aggregate.Command`. */\n readonly command: string;\n readonly aggregateId?: string | null;\n}\n\n/**\n * The one outward result of a command (design 08 §7): what it reached at one\n * hop of its wait chain. A command route answers the last one; its event\n * stream sends one per hop.\n *\n * A chain can end before its plan does (decision D212): a hop, such as a\n * saga's that sent no command (a declined payment, say), leaves nothing to\n * reach the later hops. Its result is then the last one, at that hop with its\n * own status, `chainEnded` and the hops not reached in `pending`; a server\n * before D212 sends neither, so read them as `false` and empty when absent.\n *\n * @typeParam R - The shape of `results`, what the command's decide function\n * answered with.\n */\nexport interface CommandResult<R = Record<string, unknown>> {\n readonly format: number;\n readonly commandId: string;\n readonly requestId: string;\n readonly correlationId: string;\n readonly ref: AggregateRef;\n readonly hop: Hop;\n readonly function: FunctionInfo;\n readonly status: CommandResultStatus;\n /** The aggregate's version after the commit, or the unchanged one. */\n readonly version?: number | null;\n /** The request was already committed: it was not decided again. */\n readonly duplicate: boolean;\n /** Set when `status` is `REJECTED` or `FAILED`. */\n readonly error?: ErrorInfo | null;\n readonly results: R;\n /** On a saga's hop, the ids of the commands it derived. */\n readonly derived: readonly string[];\n /** When it was produced, in epoch milliseconds. */\n readonly signalTime: number;\n readonly transformedFrom?: TransformedFrom | null;\n /**\n * The chain ended at this hop before its plan did (decision D212): the\n * hops in `pending` will not come.\n */\n readonly chainEnded?: boolean;\n /** When `chainEnded`, the hops of the plan not reached, in order. */\n readonly pending?: readonly Hop[];\n}\n\n/** The tags of an aggregate: names to values. */\nexport type Tags = Readonly<Record<string, readonly string[]>>;\n\n/**\n * An aggregate's state at a version (decision D40), as\n * `GET /{context}/{aggregate}/{id}/state` answers it.\n *\n * @typeParam S - The state's type.\n */\nexport interface StateView<S = unknown> {\n readonly ref: AggregateRef;\n readonly version: number;\n readonly scope: Scope;\n readonly deleted: boolean;\n readonly tags: Tags;\n readonly state: S;\n}\n\n/**\n * An event as Wow reads it now: under its current name, upgraded to its latest revision. The `events` query gives\n * every stored event so, however old its record, and leaves out the events its aggregate retired, so a generated\n * `<Aggregate>Event` union, with {@link SystemEvent}, covers each event it returns.\n *\n * @typeParam N - The event's name.\n * @typeParam B - The event's body.\n */\nexport interface EventView<N extends string = string, B = unknown> {\n readonly name: N;\n readonly revision: number;\n readonly body: B;\n}\n\n/** The body of `wow.lifecycle.OwnerTransferred`: the aggregate's new owner. */\nexport interface OwnerTransferred {\n readonly ownerId: string;\n}\n\n/** The body of `wow.lifecycle.SpaceTransferred`: the aggregate's new space. */\nexport interface SpaceTransferred {\n readonly spaceId: string;\n}\n\n/** The body of `wow.lifecycle.TagsApplied`: the aggregate's tags now. */\nexport interface TagsApplied {\n readonly tags: Tags;\n}\n\n/**\n * The body of `wow.ScheduleSet` (decision D198): the aggregate set its\n * schedule `key`, to send `target` the command of type `commandType`\n * (`command` its JSON text) as `rule` says.\n */\nexport interface ScheduleSet {\n readonly key: string;\n readonly rule: ScheduleRule;\n readonly target: AggregateRef;\n readonly commandType: string;\n readonly command: string;\n}\n\n/** The body of `wow.ScheduleCancelled` (decision D198). */\nexport interface ScheduleCancelled {\n readonly key: string;\n}\n\n/**\n * The system events the kernel gives every aggregate (decisions D113, D198):\n * the lifecycle events and the schedule events. A state trace and an event\n * stream carry them beside the aggregate's own events, so the event union\n * `wow-generator` writes for an aggregate includes this one.\n */\nexport type SystemEvent =\n | EventView<'wow.lifecycle.AggregateDeleted', Readonly<Record<string, never>>>\n | EventView<\n 'wow.lifecycle.AggregateRestored',\n Readonly<Record<string, never>>\n >\n | EventView<'wow.lifecycle.OwnerTransferred', OwnerTransferred>\n | EventView<'wow.lifecycle.SpaceTransferred', SpaceTransferred>\n | EventView<'wow.lifecycle.TagsApplied', TagsApplied>\n | EventView<'wow.ScheduleSet', ScheduleSet>\n | EventView<'wow.ScheduleCancelled', ScheduleCancelled>;\n\n/**\n * One commit of a state trace (decision D40): the events of a version and the\n * aggregate after it.\n *\n * @typeParam S - The state's type.\n * @typeParam E - The events' type.\n */\nexport interface CommitView<S = unknown, E extends EventView = EventView> {\n readonly version: number;\n /** When it was committed, in epoch milliseconds. */\n readonly commitTime: number;\n readonly commandId: string;\n readonly requestId: string;\n readonly commandType: string;\n readonly events: readonly E[];\n readonly scope: Scope;\n readonly deleted: boolean;\n readonly tags: Tags;\n readonly state: S;\n readonly operator?: Operator | null;\n}\n\n/**\n * What `GET /{context}/{aggregate}/{id}/state/trace` answers: the aggregate\n * and its commits in version order.\n */\nexport interface StateTrace<S = unknown, E extends EventView = EventView> {\n readonly ref: AggregateRef;\n readonly commits: readonly CommitView<S, E>[];\n}\n\n/**\n * A record of the `snapshot` query model (decisions D128, D163): the\n * aggregate's system fields and its state.\n *\n * @typeParam S - The state's type.\n */\nexport interface SnapshotRecord<S = unknown> {\n readonly tenantId: string;\n readonly aggregateId: string;\n readonly version: number;\n readonly ownerId: string | null;\n readonly spaceId: string | null;\n readonly deleted: boolean;\n readonly tags: Tags;\n /** The first commit's time, in epoch milliseconds. */\n readonly firstEventTime: number;\n /** The last commit's time, in epoch milliseconds. */\n readonly lastEventTime: number;\n /** Who sent the last command; null for an anonymous caller. */\n readonly operator: Operator | null;\n /** Who created the aggregate; null for an anonymous caller. */\n readonly firstOperator: Operator | null;\n /**\n * The schedules the aggregate keeps (decision D198): each rule, `{type,\n * ...}`, by its key; absent from a server before 6.8c.\n */\n readonly schedules?: Readonly<Record<string, ScheduleRule>>;\n readonly state: S;\n}\n\n/**\n * The system fields of a snapshot record a query can filter, sort and\n * project on; a state field is `state.<path>`.\n */\nexport type SnapshotSystemField =\n | 'tenantId'\n | 'aggregateId'\n | 'version'\n | 'ownerId'\n | 'spaceId'\n | 'deleted'\n | 'tags'\n | 'firstEventTime'\n | 'lastEventTime'\n | 'operator'\n | 'operator.id'\n | 'operator.tenantId'\n | 'operator.crossScope'\n | 'firstOperator'\n | 'firstOperator.id'\n | 'firstOperator.tenantId'\n | 'firstOperator.crossScope'\n | 'schedules';\n\n/** A schedule rule of a snapshot's `schedules` (decision D198). */\nexport interface ScheduleRule {\n /** The rule's type: `at`, `after`, `cron`, … */\n readonly type: string;\n readonly [property: string]: unknown;\n}\n\n/**\n * A record of the `events` query model (decision D131): one commit of one\n * aggregate and its events.\n *\n * @typeParam E - The events' type.\n */\nexport interface EventStreamRecord<E extends EventView = EventView> {\n readonly aggregateId: string;\n readonly tenantId: string;\n readonly version: number;\n /** When it was committed, in epoch milliseconds. */\n readonly commitTime: number;\n readonly commandId: string;\n readonly requestId: string;\n readonly commandType: string;\n /** Null when the stream has none (`Scope.NONE`). */\n readonly ownerId?: string | null;\n readonly spaceId?: string | null;\n /** Null for an anonymous caller (decision D163). */\n readonly operator?: Operator | null;\n readonly events: readonly E[];\n}\n\n/**\n * The fields of an event stream record a query names (decision D235): its\n * system fields and `events`, the array an `elementMatch` filter and an\n * aggregation's `elements` reach an event through, by the event's own\n * `name`, `revision` and `body.*`.\n */\nexport type EventStreamField =\n | 'aggregateId'\n | 'tenantId'\n | 'version'\n | 'commitTime'\n | 'commandId'\n | 'requestId'\n | 'commandType'\n | 'ownerId'\n | 'spaceId'\n | 'operator'\n | 'operator.id'\n | 'operator.tenantId'\n | 'operator.crossScope'\n | 'events';\n\n/** How an aggregate belongs to its callers (decision D189). */\nexport type Ownership = 'OWNER' | 'TENANT';\n\n/** One dataset of `GET /wow/dataset` (decision D145). */\nexport interface DatasetEntry {\n /** `{context}.{dataset}`. */\n readonly name: string;\n readonly context: string;\n readonly dataset: string;\n readonly title?: string | null;\n /** The path of its query route. */\n readonly path: string;\n}\n"],"mappings":";AAoEA,IAAaA,IAAQ;CAEnB,UAAU;CAEV,WAAW;CAEX,SAAS;AACX"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ahoo-wang/wow-client",
3
- "version": "9.9.0",
4
- "description": "TypeScript client for Wow (https://github.com/Ahoo-Wang/Wow): commands, snapshot and event-stream queries, and the query DSL, built on Fetcher.",
3
+ "version": "10.0.0-alpha.4",
4
+ "description": "TypeScript client for Wow (https://github.com/Ahoo-Wang/Wow): commands with their waits and event streams, state reads, snapshot, event and dataset queries, the Manifest and RFC 9457 problems, and the query DSL, built on Fetcher.",
5
5
  "keywords": [
6
6
  "wow",
7
7
  "wow-client",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "author": "Ahoo-Wang",
18
18
  "license": "Apache-2.0",
19
- "homepage": "https://wow.ahoo.me/reference/typescript/wow-client/",
19
+ "homepage": "https://github.com/Ahoo-Wang/Wow/tree/main/typescript/wow-client#readme",
20
20
  "repository": {
21
21
  "type": "git",
22
22
  "url": "git+https://github.com/Ahoo-Wang/Wow.git",
@@ -53,16 +53,6 @@
53
53
  "default": "./dist/dsl.cjs"
54
54
  }
55
55
  },
56
- "./legacy": {
57
- "import": {
58
- "types": "./dist/legacy/index.d.ts",
59
- "default": "./dist/legacy.es.js"
60
- },
61
- "require": {
62
- "types": "./dist/legacy/index.d.cts",
63
- "default": "./dist/legacy.cjs"
64
- }
65
- },
66
56
  "./package.json": "./package.json"
67
57
  },
68
58
  "files": [
@@ -73,19 +63,17 @@
73
63
  "sideEffects": false,
74
64
  "peerDependencies": {
75
65
  "@ahoo-wang/fetcher": "^5.1.5 || ^6.0.0",
76
- "@ahoo-wang/fetcher-decorator": "^5.1.5 || ^6.0.0",
77
66
  "@ahoo-wang/fetcher-eventstream": "^5.1.5 || ^6.0.0"
78
67
  },
79
68
  "devDependencies": {
80
69
  "@ahoo-wang/fetcher": "^6.0.1",
81
- "@ahoo-wang/fetcher-decorator": "^6.0.1",
82
70
  "@ahoo-wang/fetcher-eventstream": "^6.0.1",
83
71
  "@eslint/js": "^10.0.1",
84
72
  "@microsoft/api-extractor": "^7.59.4",
85
73
  "@types/node": "^26.6.5",
86
74
  "@vitest/coverage-v8": "4.1.11",
87
75
  "@vitest/ui": "^4.1.11",
88
- "eslint": "^10.12.0",
76
+ "eslint": "^10.13.0",
89
77
  "globals": "^17.13.0",
90
78
  "prettier": "3.9.9",
91
79
  "typescript": "~6.0.3",
@@ -1 +0,0 @@
1
- function e(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}exports.default=e;
@@ -1,9 +0,0 @@
1
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
2
- function e(e, t, n, r) {
3
- var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
4
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
5
- else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
6
- return i > 3 && a && Object.defineProperty(t, n, a), a;
7
- }
8
- //#endregion
9
- export { e as default };
@@ -1 +0,0 @@
1
- function e(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}exports.default=e;
@@ -1,6 +0,0 @@
1
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateMetadata.js
2
- function e(e, t) {
3
- if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
4
- }
5
- //#endregion
6
- export { e as default };
@@ -1 +0,0 @@
1
- function e(e,t){return function(n,r){t(n,r,e)}}exports.default=e;
@@ -1,8 +0,0 @@
1
- //#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
2
- function e(e, t) {
3
- return function(n, r) {
4
- t(n, r, e);
5
- };
6
- }
7
- //#endregion
8
- export { e as default };
@@ -1,2 +0,0 @@
1
- function e(e){let t=new Set(Object.getOwnPropertyNames(e));for(let n=Object.getPrototypeOf(e);n!==null&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let r of Object.getOwnPropertyNames(n)){if(r===`constructor`||t.has(r))continue;t.add(r);let i=Object.getOwnPropertyDescriptor(n,r)?.value;typeof i==`function`&&Object.defineProperty(e,r,{value:i.bind(e),writable:!0,configurable:!0,enumerable:!1})}}exports.bindMethods=e;
2
- //# sourceMappingURL=bindMethods.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bindMethods.cjs","names":["bindMethods","seen","client","prototype","name","method"],"sources":["../../src/client/bindMethods.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 * (internal) Binds every method a client inherits to the client itself, so a\n * method handed on as a function — `execute: client.listState` in a\n * wow-react hook, `ids.map(client.getStateById)` — still reaches its fetcher.\n * The decorated methods read the client's metadata through `this`; unbound,\n * they failed with `Cannot read properties of undefined`.\n *\n * Each bound copy is an own, non-enumerable property, so spreading or\n * serialising a client is unchanged, and the prototype keeps the methods for\n * reflection. A subclass's override is the one bound: the lookup starts at\n * the instance.\n */\nexport function bindMethods(client: object): void {\n const seen = new Set(Object.getOwnPropertyNames(client));\n for (\n let prototype: object | null = Object.getPrototypeOf(client);\n prototype !== null && prototype !== Object.prototype;\n prototype = Object.getPrototypeOf(prototype)\n ) {\n for (const name of Object.getOwnPropertyNames(prototype)) {\n if (name === 'constructor' || seen.has(name)) continue;\n seen.add(name);\n // The first prototype that names it is the one a lookup finds; a\n // getter is left alone rather than run.\n const method: unknown = Object.getOwnPropertyDescriptor(\n prototype,\n name,\n )?.value;\n if (typeof method !== 'function') continue;\n Object.defineProperty(client, name, {\n value: method.bind(client),\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n }\n}\n"],"mappings":"AAyBA,SAAgBA,EAAY,EAAsB,CAChD,IAAMC,EAAO,IAAI,IAAI,OAAO,oBAAoBC,CAAM,CAAC,EACvD,IACE,IAAIC,EAA2B,OAAO,eAAeD,CAAM,EAC3DC,IAAc,MAAQA,IAAc,OAAO,UAC3C,EAAY,OAAO,eAAeA,CAAS,EAE3C,IAAK,IAAMC,KAAQ,OAAO,oBAAoBD,CAAS,EAAG,CACxD,GAAIC,IAAS,eAAiBH,EAAK,IAAIG,CAAI,EAAG,SAC9CH,EAAK,IAAIG,CAAI,EAGb,IAAMC,EAAkB,OAAO,yBAC7BF,EACAC,CACF,CAAC,EAAE,MACC,OAAOC,GAAW,YACtB,OAAO,eAAeH,EAAQE,EAAM,CAClC,MAAOC,EAAO,KAAKH,CAAM,EACzB,SAAU,GACV,aAAc,GACd,WAAY,EACd,CAAC,CACH,CAEJ"}
@@ -1,13 +0,0 @@
1
- /**
2
- * (internal) Binds every method a client inherits to the client itself, so a
3
- * method handed on as a function — `execute: client.listState` in a
4
- * wow-react hook, `ids.map(client.getStateById)` — still reaches its fetcher.
5
- * The decorated methods read the client's metadata through `this`; unbound,
6
- * they failed with `Cannot read properties of undefined`.
7
- *
8
- * Each bound copy is an own, non-enumerable property, so spreading or
9
- * serialising a client is unchanged, and the prototype keeps the methods for
10
- * reflection. A subclass's override is the one bound: the lookup starts at
11
- * the instance.
12
- */
13
- export declare function bindMethods(client: object): void;
@@ -1,13 +0,0 @@
1
- /**
2
- * (internal) Binds every method a client inherits to the client itself, so a
3
- * method handed on as a function — `execute: client.listState` in a
4
- * wow-react hook, `ids.map(client.getStateById)` — still reaches its fetcher.
5
- * The decorated methods read the client's metadata through `this`; unbound,
6
- * they failed with `Cannot read properties of undefined`.
7
- *
8
- * Each bound copy is an own, non-enumerable property, so spreading or
9
- * serialising a client is unchanged, and the prototype keeps the methods for
10
- * reflection. A subclass's override is the one bound: the lookup starts at
11
- * the instance.
12
- */
13
- export declare function bindMethods(client: object): void;
@@ -1,19 +0,0 @@
1
- //#region src/client/bindMethods.ts
2
- function e(e) {
3
- let t = new Set(Object.getOwnPropertyNames(e));
4
- for (let n = Object.getPrototypeOf(e); n !== null && n !== Object.prototype; n = Object.getPrototypeOf(n)) for (let r of Object.getOwnPropertyNames(n)) {
5
- if (r === "constructor" || t.has(r)) continue;
6
- t.add(r);
7
- let i = Object.getOwnPropertyDescriptor(n, r)?.value;
8
- typeof i == "function" && Object.defineProperty(e, r, {
9
- value: i.bind(e),
10
- writable: !0,
11
- configurable: !0,
12
- enumerable: !1
13
- });
14
- }
15
- }
16
- //#endregion
17
- export { e as bindMethods };
18
-
19
- //# sourceMappingURL=bindMethods.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bindMethods.es.js","names":["bindMethods","seen","client","prototype","name","method"],"sources":["../../src/client/bindMethods.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 * (internal) Binds every method a client inherits to the client itself, so a\n * method handed on as a function — `execute: client.listState` in a\n * wow-react hook, `ids.map(client.getStateById)` — still reaches its fetcher.\n * The decorated methods read the client's metadata through `this`; unbound,\n * they failed with `Cannot read properties of undefined`.\n *\n * Each bound copy is an own, non-enumerable property, so spreading or\n * serialising a client is unchanged, and the prototype keeps the methods for\n * reflection. A subclass's override is the one bound: the lookup starts at\n * the instance.\n */\nexport function bindMethods(client: object): void {\n const seen = new Set(Object.getOwnPropertyNames(client));\n for (\n let prototype: object | null = Object.getPrototypeOf(client);\n prototype !== null && prototype !== Object.prototype;\n prototype = Object.getPrototypeOf(prototype)\n ) {\n for (const name of Object.getOwnPropertyNames(prototype)) {\n if (name === 'constructor' || seen.has(name)) continue;\n seen.add(name);\n // The first prototype that names it is the one a lookup finds; a\n // getter is left alone rather than run.\n const method: unknown = Object.getOwnPropertyDescriptor(\n prototype,\n name,\n )?.value;\n if (typeof method !== 'function') continue;\n Object.defineProperty(client, name, {\n value: method.bind(client),\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n }\n}\n"],"mappings":";AAyBA,SAAgBA,EAAY,GAAsB;CAChD,IAAMC,IAAO,IAAI,IAAI,OAAO,oBAAoBC,CAAM,CAAC;CACvD,KACE,IAAIC,IAA2B,OAAO,eAAeD,CAAM,GAC3DC,MAAc,QAAQA,MAAc,OAAO,WAC3C,IAAY,OAAO,eAAeA,CAAS,GAE3C,KAAK,IAAMC,KAAQ,OAAO,oBAAoBD,CAAS,GAAG;EACxD,IAAIC,MAAS,iBAAiBH,EAAK,IAAIG,CAAI,GAAG;EAC9C,EAAK,IAAIA,CAAI;EAGb,IAAMC,IAAkB,OAAO,yBAC7BF,GACAC,CACF,CAAC,EAAE;EACH,AAAI,OAAOC,KAAW,cACtB,OAAO,eAAeH,GAAQE,GAAM;GAClC,OAAOC,EAAO,KAAKH,CAAM;GACzB,UAAU;GACV,cAAc;GACd,YAAY;EACd,CAAC;CACH;AAEJ"}
@@ -1,2 +0,0 @@
1
- const e=require("../../transport/endpoints.cjs"),t=require("../bindMethods.cjs"),n=require("../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.cjs"),r=require("../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.cjs"),i=require("../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.cjs");let a=require("@ahoo-wang/fetcher-decorator");var o=class{constructor(e){this.apiMetadata=e,t.bindMethods(this)}send(e,t){throw(0,a.autoGeneratedError)(e,t)}sendAndWaitStream(e,t){throw(0,a.autoGeneratedError)(e,t)}};i.default([(0,a.endpoint)(),r.default(0,(0,a.request)()),r.default(1,(0,a.attribute)()),n.default(`design:type`,Function),n.default(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),n.default(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`send`,null),i.default([(0,a.endpoint)(void 0,void 0,e.COMMAND_STREAM_ENDPOINT),r.default(0,(0,a.request)()),r.default(1,(0,a.attribute)()),n.default(`design:type`,Function),n.default(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),n.default(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`sendAndWaitStream`,null),o=i.default([(0,a.api)(),n.default(`design:paramtypes`,[Object])],o),Object.defineProperty(exports,"CommandClient",{enumerable:!0,get:function(){return o}});
2
- //# sourceMappingURL=commandClient.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandClient.cjs","names":["autoGeneratedError","_decorate","endpoint","_decorateParam","request","attribute","_decorateMetadata","COMMAND_STREAM_ENDPOINT","api","require_endpoints","require_bindMethods","require_decorateMetadata","require_decorateParam","require_decorate","_ahoo_wang_fetcher_decorator","CommandClient","apiMetadata","commandRequest","attributes"],"sources":["../../../src/client/command/commandClient.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 CommandRequest } from './commandRequest.js';\nimport type { CommandResult } from '../../model/index.js';\nimport type { CommandResultEventStream } from './commandResult.js';\nimport { COMMAND_STREAM_ENDPOINT } from '../../transport/endpoints.js';\n\nimport type {\n ApiMetadata,\n ApiMetadataCapable,\n} from '@ahoo-wang/fetcher-decorator';\nimport {\n api,\n attribute,\n autoGeneratedError,\n endpoint,\n request,\n} from '@ahoo-wang/fetcher-decorator';\nimport { bindMethods } from '../bindMethods.js';\n\n/**\n * Sends commands to a Wow command route.\n *\n * The request's `path` names the command route, relative to the client's base\n * path; its `headers` say who the command is for and what to wait for (see\n * {@link commandHeaders} and {@link waitStrategy}); its `body` is the command.\n * The body type is chosen per call, so one client sends every command of an\n * aggregate.\n *\n * @example\n * ```typescript\n * const commandClient = new CommandClient({\n * fetcher: new Fetcher({ baseURL: 'http://localhost:8080/' }),\n * basePath: 'owner/{ownerId}/cart',\n * });\n *\n * const result = await commandClient.send<{ productId: string; quantity: number }>({\n * path: 'add_cart_item',\n * method: 'POST',\n * urlParams: { path: { ownerId: 'user-1' } },\n * headers: waitStrategy({ stage: CommandStage.SNAPSHOT }),\n * body: { productId: 'product-1', quantity: 1 },\n * });\n * ```\n */\n@api()\nexport class CommandClient implements ApiMetadataCapable {\n constructor(public readonly apiMetadata?: ApiMetadata) {\n bindMethods(this);\n }\n\n /**\n * Sends a command and resolves to the result of the stage it waited for\n * (`PROCESSED` unless the headers say otherwise). A command the server\n * refuses or fails to process rejects: Wow answers the failed result with\n * the HTTP status its `errorCode` maps to. Read it with `toWowError`.\n *\n * @param commandRequest - The route path, headers and body of the command\n * @param attributes - Optional shared attributes for the interceptors\n * @returns The command result\n */\n @endpoint()\n /* v8 ignore start */\n send<C extends object = object>(\n @request() commandRequest: CommandRequest<C>,\n @attribute() attributes?: Record<string, unknown>,\n ): Promise<CommandResult> {\n throw autoGeneratedError(commandRequest, attributes);\n }\n /* v8 ignore stop */\n\n /**\n * Sends a command and streams one result for every stage it reaches, up to\n * the one it waits for. The stream errors with a `WowError` if the server\n * fails midway, for example when the wait times out.\n *\n * @param commandRequest - The route path, headers and body of the command\n * @param attributes - Optional shared attributes for the interceptors\n * @returns A stream of command results\n *\n * @example\n * ```typescript\n * const results = await commandClient.sendAndWaitStream({\n * path: 'add_cart_item',\n * method: 'POST',\n * headers: waitStrategy({ stage: CommandStage.PROJECTED }),\n * body: { productId: 'product-1', quantity: 2 },\n * });\n * for await (const result of results) {\n * console.log(result.stage);\n * }\n * ```\n */\n @endpoint(undefined, undefined, COMMAND_STREAM_ENDPOINT)\n /* v8 ignore start */\n sendAndWaitStream<C extends object = object>(\n @request() commandRequest: CommandRequest<C>,\n @attribute() attributes?: Record<string, unknown>,\n ): Promise<CommandResultEventStream> {\n throw autoGeneratedError(commandRequest, attributes);\n }\n /* v8 ignore stop */\n}\n"],"mappings":"qYAyDO,IAAMe,EAAN,KAAkD,CACvD,YAAY,EAA2C,CAA3B,KAAA,YAAAC,EAC1BN,EAAA,YAAY,IAAI,CAClB,CAYA,KAGE,EACA,EACwB,CACxB,MAAA,EAAMV,EAAAA,mBAAAA,CAAmBiB,EAAgBC,CAAU,CACrD,CAyBA,kBAGE,EACA,EACmC,CACnC,MAAA,EAAMlB,EAAAA,mBAAAA,CAAmBiB,EAAgBC,CAAU,CACrD,CAEF,cAzCGhB,EAAAA,EAAAA,SAAAA,CAAS,EAGPC,EAAAA,QAAA,GAAA,EAAAC,EAAAA,QAAAA,CAAQ,CAAA,EACRD,EAAAA,QAAA,GAAA,EAAAE,EAAAA,UAAAA,CAAU,CAAA,mNA4BZH,EAAAA,EAAAA,SAAAA,CAAS,IAAA,GAAW,IAAA,GAAWK,EAAAA,uBAAuB,EAGpDJ,EAAAA,QAAA,GAAA,EAAAC,EAAAA,QAAAA,CAAQ,CAAA,EACRD,EAAAA,QAAA,GAAA,EAAAE,EAAAA,UAAAA,CAAU,CAAA,oNApDd,EAAAJ,EAAAA,QAAA,EAAA,EAAAO,EAAAA,IAAAA,CAAI,EAAAF,EAAAA,QAAA,oBAAA,CAAA,MAAA,CAAA,CAAA,EAAAS,CAAA"}
@@ -1,67 +0,0 @@
1
- import { CommandRequest } from './commandRequest.cjs';
2
- import { CommandResult } from '../../model/index.cjs';
3
- import { CommandResultEventStream } from './commandResult.cjs';
4
- import { ApiMetadata, ApiMetadataCapable } from '@ahoo-wang/fetcher-decorator';
5
- /**
6
- * Sends commands to a Wow command route.
7
- *
8
- * The request's `path` names the command route, relative to the client's base
9
- * path; its `headers` say who the command is for and what to wait for (see
10
- * {@link commandHeaders} and {@link waitStrategy}); its `body` is the command.
11
- * The body type is chosen per call, so one client sends every command of an
12
- * aggregate.
13
- *
14
- * @example
15
- * ```typescript
16
- * const commandClient = new CommandClient({
17
- * fetcher: new Fetcher({ baseURL: 'http://localhost:8080/' }),
18
- * basePath: 'owner/{ownerId}/cart',
19
- * });
20
- *
21
- * const result = await commandClient.send<{ productId: string; quantity: number }>({
22
- * path: 'add_cart_item',
23
- * method: 'POST',
24
- * urlParams: { path: { ownerId: 'user-1' } },
25
- * headers: waitStrategy({ stage: CommandStage.SNAPSHOT }),
26
- * body: { productId: 'product-1', quantity: 1 },
27
- * });
28
- * ```
29
- */
30
- export declare class CommandClient implements ApiMetadataCapable {
31
- readonly apiMetadata?: ApiMetadata | undefined;
32
- constructor(apiMetadata?: ApiMetadata | undefined);
33
- /**
34
- * Sends a command and resolves to the result of the stage it waited for
35
- * (`PROCESSED` unless the headers say otherwise). A command the server
36
- * refuses or fails to process rejects: Wow answers the failed result with
37
- * the HTTP status its `errorCode` maps to. Read it with `toWowError`.
38
- *
39
- * @param commandRequest - The route path, headers and body of the command
40
- * @param attributes - Optional shared attributes for the interceptors
41
- * @returns The command result
42
- */
43
- send<C extends object = object>(commandRequest: CommandRequest<C>, attributes?: Record<string, unknown>): Promise<CommandResult>;
44
- /**
45
- * Sends a command and streams one result for every stage it reaches, up to
46
- * the one it waits for. The stream errors with a `WowError` if the server
47
- * fails midway, for example when the wait times out.
48
- *
49
- * @param commandRequest - The route path, headers and body of the command
50
- * @param attributes - Optional shared attributes for the interceptors
51
- * @returns A stream of command results
52
- *
53
- * @example
54
- * ```typescript
55
- * const results = await commandClient.sendAndWaitStream({
56
- * path: 'add_cart_item',
57
- * method: 'POST',
58
- * headers: waitStrategy({ stage: CommandStage.PROJECTED }),
59
- * body: { productId: 'product-1', quantity: 2 },
60
- * });
61
- * for await (const result of results) {
62
- * console.log(result.stage);
63
- * }
64
- * ```
65
- */
66
- sendAndWaitStream<C extends object = object>(commandRequest: CommandRequest<C>, attributes?: Record<string, unknown>): Promise<CommandResultEventStream>;
67
- }