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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/README.md +85 -230
  2. package/README.zh-CN.md +74 -209
  3. package/dist/commands.cjs +2 -0
  4. package/dist/commands.cjs.map +1 -0
  5. package/dist/commands.d.cts +123 -0
  6. package/dist/commands.d.ts +123 -0
  7. package/dist/commands.es.js +96 -0
  8. package/dist/commands.es.js.map +1 -0
  9. package/dist/dsl/aggregation/types.cjs.map +1 -1
  10. package/dist/dsl/aggregation/types.d.cts +1 -1
  11. package/dist/dsl/aggregation/types.d.ts +1 -1
  12. package/dist/dsl/aggregation/types.es.js.map +1 -1
  13. package/dist/dsl/cursorQuery.cjs.map +1 -1
  14. package/dist/dsl/cursorQuery.d.cts +7 -8
  15. package/dist/dsl/cursorQuery.d.ts +7 -8
  16. package/dist/dsl/cursorQuery.es.js.map +1 -1
  17. package/dist/dsl/descriptor.cjs.map +1 -1
  18. package/dist/dsl/descriptor.d.cts +8 -1
  19. package/dist/dsl/descriptor.d.ts +8 -1
  20. package/dist/dsl/descriptor.es.js.map +1 -1
  21. package/dist/dsl/documents.d.cts +1 -1
  22. package/dist/dsl/documents.d.ts +1 -1
  23. package/dist/dsl/filter/types.d.cts +2 -1
  24. package/dist/dsl/filter/types.d.ts +2 -1
  25. package/dist/dsl/projection.cjs.map +1 -1
  26. package/dist/dsl/projection.d.cts +22 -0
  27. package/dist/dsl/projection.d.ts +22 -0
  28. package/dist/dsl/projection.es.js.map +1 -1
  29. package/dist/dsl/queryErrorCodes.cjs +2 -0
  30. package/dist/dsl/queryErrorCodes.cjs.map +1 -0
  31. package/dist/{error → dsl}/queryErrorCodes.d.cts +25 -24
  32. package/dist/{error → dsl}/queryErrorCodes.d.ts +25 -24
  33. package/dist/{error → dsl}/queryErrorCodes.es.js +2 -1
  34. package/dist/{error/queryErrorCodes.cjs.map → dsl/queryErrorCodes.es.js.map} +1 -1
  35. package/dist/dsl.cjs +1 -1
  36. package/dist/dsl.d.cts +1 -2
  37. package/dist/dsl.d.ts +1 -2
  38. package/dist/dsl.es.js +2 -3
  39. package/dist/exactJson.cjs +3 -0
  40. package/dist/exactJson.cjs.map +1 -0
  41. package/dist/exactJson.d.cts +54 -0
  42. package/dist/exactJson.d.ts +54 -0
  43. package/dist/exactJson.es.js +213 -0
  44. package/dist/exactJson.es.js.map +1 -0
  45. package/dist/http.cjs +2 -0
  46. package/dist/http.cjs.map +1 -0
  47. package/dist/http.d.cts +96 -0
  48. package/dist/http.d.ts +96 -0
  49. package/dist/http.es.js +77 -0
  50. package/dist/http.es.js.map +1 -0
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.d.cts +19 -17
  53. package/dist/index.d.ts +19 -17
  54. package/dist/index.es.js +10 -36
  55. package/dist/manifest.cjs +2 -0
  56. package/dist/manifest.cjs.map +1 -0
  57. package/dist/manifest.d.cts +109 -0
  58. package/dist/manifest.d.ts +109 -0
  59. package/dist/manifest.es.js +14 -0
  60. package/dist/manifest.es.js.map +1 -0
  61. package/dist/problem.cjs +2 -0
  62. package/dist/problem.cjs.map +1 -0
  63. package/dist/problem.d.cts +211 -0
  64. package/dist/problem.d.ts +211 -0
  65. package/dist/problem.es.js +138 -0
  66. package/dist/problem.es.js.map +1 -0
  67. package/dist/queries.cjs +2 -0
  68. package/dist/queries.cjs.map +1 -0
  69. package/dist/queries.d.cts +182 -0
  70. package/dist/queries.d.ts +182 -0
  71. package/dist/queries.es.js +112 -0
  72. package/dist/queries.es.js.map +1 -0
  73. package/dist/state.cjs +2 -0
  74. package/dist/state.cjs.map +1 -0
  75. package/dist/state.d.cts +75 -0
  76. package/dist/state.d.ts +75 -0
  77. package/dist/state.es.js +70 -0
  78. package/dist/state.es.js.map +1 -0
  79. package/dist/streams.cjs +2 -0
  80. package/dist/streams.cjs.map +1 -0
  81. package/dist/streams.d.cts +74 -0
  82. package/dist/streams.d.ts +74 -0
  83. package/dist/streams.es.js +103 -0
  84. package/dist/streams.es.js.map +1 -0
  85. package/dist/wait.cjs +2 -0
  86. package/dist/wait.cjs.map +1 -0
  87. package/dist/wait.d.cts +61 -0
  88. package/dist/wait.d.ts +61 -0
  89. package/dist/wait.es.js +44 -0
  90. package/dist/wait.es.js.map +1 -0
  91. package/dist/wire.cjs +2 -0
  92. package/dist/wire.cjs.map +1 -0
  93. package/dist/wire.d.cts +326 -0
  94. package/dist/wire.d.ts +326 -0
  95. package/dist/wire.es.js +10 -0
  96. package/dist/wire.es.js.map +1 -0
  97. package/package.json +4 -16
  98. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.cjs +0 -1
  99. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.es.js +0 -9
  100. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.cjs +0 -1
  101. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.es.js +0 -6
  102. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.cjs +0 -1
  103. package/dist/_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.es.js +0 -8
  104. package/dist/client/bindMethods.cjs +0 -2
  105. package/dist/client/bindMethods.cjs.map +0 -1
  106. package/dist/client/bindMethods.d.cts +0 -13
  107. package/dist/client/bindMethods.d.ts +0 -13
  108. package/dist/client/bindMethods.es.js +0 -19
  109. package/dist/client/bindMethods.es.js.map +0 -1
  110. package/dist/client/command/commandClient.cjs +0 -2
  111. package/dist/client/command/commandClient.cjs.map +0 -1
  112. package/dist/client/command/commandClient.d.cts +0 -67
  113. package/dist/client/command/commandClient.d.ts +0 -67
  114. package/dist/client/command/commandClient.es.js +0 -38
  115. package/dist/client/command/commandClient.es.js.map +0 -1
  116. package/dist/client/command/commandHeaders.cjs +0 -2
  117. package/dist/client/command/commandHeaders.cjs.map +0 -1
  118. package/dist/client/command/commandHeaders.d.cts +0 -75
  119. package/dist/client/command/commandHeaders.d.ts +0 -75
  120. package/dist/client/command/commandHeaders.es.js +0 -31
  121. package/dist/client/command/commandHeaders.es.js.map +0 -1
  122. package/dist/client/command/commandRequest.cjs +0 -2
  123. package/dist/client/command/commandRequest.cjs.map +0 -1
  124. package/dist/client/command/commandRequest.d.cts +0 -180
  125. package/dist/client/command/commandRequest.d.ts +0 -180
  126. package/dist/client/command/commandRequest.es.js +0 -31
  127. package/dist/client/command/commandRequest.es.js.map +0 -1
  128. package/dist/client/command/commandResult.d.cts +0 -15
  129. package/dist/client/command/commandResult.d.ts +0 -15
  130. package/dist/client/command/index.d.cts +0 -5
  131. package/dist/client/command/index.d.ts +0 -5
  132. package/dist/client/command/types.d.cts +0 -71
  133. package/dist/client/command/types.d.ts +0 -71
  134. package/dist/client/metadata/index.d.cts +0 -2
  135. package/dist/client/metadata/index.d.ts +0 -2
  136. package/dist/client/metadata/wowMetadata.d.cts +0 -48
  137. package/dist/client/metadata/wowMetadata.d.ts +0 -48
  138. package/dist/client/metadata/wowMetadataClient.cjs +0 -2
  139. package/dist/client/metadata/wowMetadataClient.cjs.map +0 -1
  140. package/dist/client/metadata/wowMetadataClient.d.cts +0 -23
  141. package/dist/client/metadata/wowMetadataClient.d.ts +0 -23
  142. package/dist/client/metadata/wowMetadataClient.es.js +0 -25
  143. package/dist/client/metadata/wowMetadataClient.es.js.map +0 -1
  144. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs +0 -2
  145. package/dist/client/query/dataset/datasetDescriptorEndpoint.cjs.map +0 -1
  146. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.cts +0 -8
  147. package/dist/client/query/dataset/datasetDescriptorEndpoint.d.ts +0 -8
  148. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js +0 -34
  149. package/dist/client/query/dataset/datasetDescriptorEndpoint.es.js.map +0 -1
  150. package/dist/client/query/dataset/datasetDirectoryClient.cjs +0 -2
  151. package/dist/client/query/dataset/datasetDirectoryClient.cjs.map +0 -1
  152. package/dist/client/query/dataset/datasetDirectoryClient.d.cts +0 -29
  153. package/dist/client/query/dataset/datasetDirectoryClient.d.ts +0 -29
  154. package/dist/client/query/dataset/datasetDirectoryClient.es.js +0 -25
  155. package/dist/client/query/dataset/datasetDirectoryClient.es.js.map +0 -1
  156. package/dist/client/query/dataset/datasetQueryApi.d.cts +0 -40
  157. package/dist/client/query/dataset/datasetQueryApi.d.ts +0 -40
  158. package/dist/client/query/dataset/datasetQueryClient.cjs +0 -2
  159. package/dist/client/query/dataset/datasetQueryClient.cjs.map +0 -1
  160. package/dist/client/query/dataset/datasetQueryClient.d.cts +0 -57
  161. package/dist/client/query/dataset/datasetQueryClient.d.ts +0 -57
  162. package/dist/client/query/dataset/datasetQueryClient.es.js +0 -154
  163. package/dist/client/query/dataset/datasetQueryClient.es.js.map +0 -1
  164. package/dist/client/query/dataset/endpointPaths.cjs +0 -2
  165. package/dist/client/query/dataset/endpointPaths.cjs.map +0 -1
  166. package/dist/client/query/dataset/endpointPaths.d.cts +0 -9
  167. package/dist/client/query/dataset/endpointPaths.d.ts +0 -9
  168. package/dist/client/query/dataset/endpointPaths.es.js +0 -14
  169. package/dist/client/query/dataset/endpointPaths.es.js.map +0 -1
  170. package/dist/client/query/dataset/index.d.cts +0 -3
  171. package/dist/client/query/dataset/index.d.ts +0 -3
  172. package/dist/client/query/descriptor/descriptorEndpoints.cjs +0 -2
  173. package/dist/client/query/descriptor/descriptorEndpoints.cjs.map +0 -1
  174. package/dist/client/query/descriptor/descriptorEndpoints.d.cts +0 -29
  175. package/dist/client/query/descriptor/descriptorEndpoints.d.ts +0 -29
  176. package/dist/client/query/descriptor/descriptorEndpoints.es.js +0 -69
  177. package/dist/client/query/descriptor/descriptorEndpoints.es.js.map +0 -1
  178. package/dist/client/query/descriptor/endpointPaths.cjs +0 -2
  179. package/dist/client/query/descriptor/endpointPaths.cjs.map +0 -1
  180. package/dist/client/query/descriptor/endpointPaths.d.cts +0 -4
  181. package/dist/client/query/descriptor/endpointPaths.d.ts +0 -4
  182. package/dist/client/query/descriptor/endpointPaths.es.js +0 -9
  183. package/dist/client/query/descriptor/endpointPaths.es.js.map +0 -1
  184. package/dist/client/query/descriptor/index.d.cts +0 -2
  185. package/dist/client/query/descriptor/index.d.ts +0 -2
  186. package/dist/client/query/descriptor/queryDescriptorApi.d.cts +0 -58
  187. package/dist/client/query/descriptor/queryDescriptorApi.d.ts +0 -58
  188. package/dist/client/query/descriptor/queryDescriptorClient.cjs +0 -2
  189. package/dist/client/query/descriptor/queryDescriptorClient.cjs.map +0 -1
  190. package/dist/client/query/descriptor/queryDescriptorClient.d.cts +0 -61
  191. package/dist/client/query/descriptor/queryDescriptorClient.d.ts +0 -61
  192. package/dist/client/query/descriptor/queryDescriptorClient.es.js +0 -20
  193. package/dist/client/query/descriptor/queryDescriptorClient.es.js.map +0 -1
  194. package/dist/client/query/event/endpointPaths.cjs +0 -2
  195. package/dist/client/query/event/endpointPaths.cjs.map +0 -1
  196. package/dist/client/query/event/endpointPaths.d.cts +0 -8
  197. package/dist/client/query/event/endpointPaths.d.ts +0 -8
  198. package/dist/client/query/event/endpointPaths.es.js +0 -13
  199. package/dist/client/query/event/endpointPaths.es.js.map +0 -1
  200. package/dist/client/query/event/eventStreamQueryApi.d.cts +0 -29
  201. package/dist/client/query/event/eventStreamQueryApi.d.ts +0 -29
  202. package/dist/client/query/event/eventStreamQueryClient.cjs +0 -2
  203. package/dist/client/query/event/eventStreamQueryClient.cjs.map +0 -1
  204. package/dist/client/query/event/eventStreamQueryClient.d.cts +0 -193
  205. package/dist/client/query/event/eventStreamQueryClient.d.ts +0 -193
  206. package/dist/client/query/event/eventStreamQueryClient.es.js +0 -160
  207. package/dist/client/query/event/eventStreamQueryClient.es.js.map +0 -1
  208. package/dist/client/query/event/index.d.cts +0 -2
  209. package/dist/client/query/event/index.d.ts +0 -2
  210. package/dist/client/query/factory.cjs +0 -2
  211. package/dist/client/query/factory.cjs.map +0 -1
  212. package/dist/client/query/factory.d.cts +0 -165
  213. package/dist/client/query/factory.d.ts +0 -165
  214. package/dist/client/query/factory.es.js +0 -45
  215. package/dist/client/query/factory.es.js.map +0 -1
  216. package/dist/client/query/index.d.cts +0 -7
  217. package/dist/client/query/index.d.ts +0 -7
  218. package/dist/client/query/queryApi.d.cts +0 -68
  219. package/dist/client/query/queryApi.d.ts +0 -68
  220. package/dist/client/query/requests.d.cts +0 -24
  221. package/dist/client/query/requests.d.ts +0 -24
  222. package/dist/client/query/snapshot/endpointPaths.cjs +0 -2
  223. package/dist/client/query/snapshot/endpointPaths.cjs.map +0 -1
  224. package/dist/client/query/snapshot/endpointPaths.d.cts +0 -12
  225. package/dist/client/query/snapshot/endpointPaths.d.ts +0 -12
  226. package/dist/client/query/snapshot/endpointPaths.es.js +0 -17
  227. package/dist/client/query/snapshot/endpointPaths.es.js.map +0 -1
  228. package/dist/client/query/snapshot/index.d.cts +0 -2
  229. package/dist/client/query/snapshot/index.d.ts +0 -2
  230. package/dist/client/query/snapshot/snapshotQueryApi.d.cts +0 -101
  231. package/dist/client/query/snapshot/snapshotQueryApi.d.ts +0 -101
  232. package/dist/client/query/snapshot/snapshotQueryClient.cjs +0 -2
  233. package/dist/client/query/snapshot/snapshotQueryClient.cjs.map +0 -1
  234. package/dist/client/query/snapshot/snapshotQueryClient.d.cts +0 -372
  235. package/dist/client/query/snapshot/snapshotQueryClient.d.ts +0 -372
  236. package/dist/client/query/snapshot/snapshotQueryClient.es.js +0 -239
  237. package/dist/client/query/snapshot/snapshotQueryClient.es.js.map +0 -1
  238. package/dist/client/query/state/endpointPaths.cjs +0 -2
  239. package/dist/client/query/state/endpointPaths.cjs.map +0 -1
  240. package/dist/client/query/state/endpointPaths.d.cts +0 -10
  241. package/dist/client/query/state/endpointPaths.d.ts +0 -10
  242. package/dist/client/query/state/endpointPaths.es.js +0 -14
  243. package/dist/client/query/state/endpointPaths.es.js.map +0 -1
  244. package/dist/client/query/state/index.d.cts +0 -4
  245. package/dist/client/query/state/index.d.ts +0 -4
  246. package/dist/client/query/state/loadOwnerStateAggregateApi.d.cts +0 -36
  247. package/dist/client/query/state/loadOwnerStateAggregateApi.d.ts +0 -36
  248. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs +0 -2
  249. package/dist/client/query/state/loadOwnerStateAggregateClient.cjs.map +0 -1
  250. package/dist/client/query/state/loadOwnerStateAggregateClient.d.cts +0 -58
  251. package/dist/client/query/state/loadOwnerStateAggregateClient.d.ts +0 -58
  252. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js +0 -56
  253. package/dist/client/query/state/loadOwnerStateAggregateClient.es.js.map +0 -1
  254. package/dist/client/query/state/loadStateAggregateApi.d.cts +0 -37
  255. package/dist/client/query/state/loadStateAggregateApi.d.ts +0 -37
  256. package/dist/client/query/state/loadStateAggregateClient.cjs +0 -2
  257. package/dist/client/query/state/loadStateAggregateClient.cjs.map +0 -1
  258. package/dist/client/query/state/loadStateAggregateClient.d.cts +0 -62
  259. package/dist/client/query/state/loadStateAggregateClient.d.ts +0 -62
  260. package/dist/client/query/state/loadStateAggregateClient.es.js +0 -65
  261. package/dist/client/query/state/loadStateAggregateClient.es.js.map +0 -1
  262. package/dist/client/routing.cjs +0 -2
  263. package/dist/client/routing.cjs.map +0 -1
  264. package/dist/client/routing.d.cts +0 -47
  265. package/dist/client/routing.d.ts +0 -47
  266. package/dist/client/routing.es.js +0 -8
  267. package/dist/client/routing.es.js.map +0 -1
  268. package/dist/error/errorInfo.cjs +0 -2
  269. package/dist/error/errorInfo.cjs.map +0 -1
  270. package/dist/error/errorInfo.d.cts +0 -139
  271. package/dist/error/errorInfo.d.ts +0 -139
  272. package/dist/error/errorInfo.es.js +0 -32
  273. package/dist/error/errorInfo.es.js.map +0 -1
  274. package/dist/error/headers.cjs +0 -2
  275. package/dist/error/headers.cjs.map +0 -1
  276. package/dist/error/headers.d.cts +0 -39
  277. package/dist/error/headers.d.ts +0 -39
  278. package/dist/error/headers.es.js +0 -10
  279. package/dist/error/headers.es.js.map +0 -1
  280. package/dist/error/index.d.cts +0 -21
  281. package/dist/error/index.d.ts +0 -21
  282. package/dist/error/queryErrorCodes.cjs +0 -2
  283. package/dist/error/queryErrorCodes.es.js.map +0 -1
  284. package/dist/error/wowError.cjs +0 -2
  285. package/dist/error/wowError.cjs.map +0 -1
  286. package/dist/error/wowError.d.cts +0 -99
  287. package/dist/error/wowError.d.ts +0 -99
  288. package/dist/error/wowError.es.js +0 -53
  289. package/dist/error/wowError.es.js.map +0 -1
  290. package/dist/legacy/condition.cjs +0 -2
  291. package/dist/legacy/condition.cjs.map +0 -1
  292. package/dist/legacy/condition.d.cts +0 -517
  293. package/dist/legacy/condition.d.ts +0 -517
  294. package/dist/legacy/condition.es.js +0 -338
  295. package/dist/legacy/condition.es.js.map +0 -1
  296. package/dist/legacy/index.d.cts +0 -16
  297. package/dist/legacy/index.d.ts +0 -16
  298. package/dist/legacy/locale/en_US.cjs +0 -2
  299. package/dist/legacy/locale/en_US.cjs.map +0 -1
  300. package/dist/legacy/locale/en_US.d.cts +0 -7
  301. package/dist/legacy/locale/en_US.d.ts +0 -7
  302. package/dist/legacy/locale/en_US.es.js +0 -50
  303. package/dist/legacy/locale/en_US.es.js.map +0 -1
  304. package/dist/legacy/locale/operatorLocale.d.cts +0 -10
  305. package/dist/legacy/locale/operatorLocale.d.ts +0 -10
  306. package/dist/legacy/locale/zh_CN.cjs +0 -2
  307. package/dist/legacy/locale/zh_CN.cjs.map +0 -1
  308. package/dist/legacy/locale/zh_CN.d.cts +0 -7
  309. package/dist/legacy/locale/zh_CN.d.ts +0 -7
  310. package/dist/legacy/locale/zh_CN.es.js +0 -50
  311. package/dist/legacy/locale/zh_CN.es.js.map +0 -1
  312. package/dist/legacy/operator.cjs +0 -2
  313. package/dist/legacy/operator.cjs.map +0 -1
  314. package/dist/legacy/operator.d.cts +0 -218
  315. package/dist/legacy/operator.d.ts +0 -218
  316. package/dist/legacy/operator.es.js +0 -25
  317. package/dist/legacy/operator.es.js.map +0 -1
  318. package/dist/legacy/queryable.cjs +0 -2
  319. package/dist/legacy/queryable.cjs.map +0 -1
  320. package/dist/legacy/queryable.d.cts +0 -61
  321. package/dist/legacy/queryable.d.ts +0 -61
  322. package/dist/legacy/queryable.es.js +0 -34
  323. package/dist/legacy/queryable.es.js.map +0 -1
  324. package/dist/legacy.cjs +0 -1
  325. package/dist/legacy.es.js +0 -6
  326. package/dist/model/abac.cjs +0 -2
  327. package/dist/model/abac.cjs.map +0 -1
  328. package/dist/model/abac.d.cts +0 -33
  329. package/dist/model/abac.d.ts +0 -33
  330. package/dist/model/abac.es.js +0 -6
  331. package/dist/model/abac.es.js.map +0 -1
  332. package/dist/model/bi.cjs +0 -2
  333. package/dist/model/bi.cjs.map +0 -1
  334. package/dist/model/bi.d.cts +0 -12
  335. package/dist/model/bi.d.ts +0 -12
  336. package/dist/model/bi.es.js +0 -8
  337. package/dist/model/bi.es.js.map +0 -1
  338. package/dist/model/command.cjs +0 -2
  339. package/dist/model/command.cjs.map +0 -1
  340. package/dist/model/command.d.cts +0 -137
  341. package/dist/model/command.d.ts +0 -137
  342. package/dist/model/command.es.js +0 -8
  343. package/dist/model/command.es.js.map +0 -1
  344. package/dist/model/common.d.cts +0 -19
  345. package/dist/model/common.d.ts +0 -19
  346. package/dist/model/domainEventStream.cjs +0 -2
  347. package/dist/model/domainEventStream.cjs.map +0 -1
  348. package/dist/model/domainEventStream.d.cts +0 -109
  349. package/dist/model/domainEventStream.d.ts +0 -109
  350. package/dist/model/domainEventStream.es.js +0 -23
  351. package/dist/model/domainEventStream.es.js.map +0 -1
  352. package/dist/model/function.cjs +0 -2
  353. package/dist/model/function.cjs.map +0 -1
  354. package/dist/model/function.d.cts +0 -41
  355. package/dist/model/function.d.ts +0 -41
  356. package/dist/model/function.es.js +0 -8
  357. package/dist/model/function.es.js.map +0 -1
  358. package/dist/model/index.d.cts +0 -24
  359. package/dist/model/index.d.ts +0 -24
  360. package/dist/model/messaging.d.cts +0 -5
  361. package/dist/model/messaging.d.ts +0 -5
  362. package/dist/model/modeling.d.cts +0 -145
  363. package/dist/model/modeling.d.ts +0 -145
  364. package/dist/model/naming.d.cts +0 -27
  365. package/dist/model/naming.d.ts +0 -27
  366. package/dist/model/snapshot.cjs +0 -2
  367. package/dist/model/snapshot.cjs.map +0 -1
  368. package/dist/model/snapshot.d.cts +0 -53
  369. package/dist/model/snapshot.d.ts +0 -53
  370. package/dist/model/snapshot.es.js +0 -20
  371. package/dist/model/snapshot.es.js.map +0 -1
  372. package/dist/transport/endpoints.cjs +0 -2
  373. package/dist/transport/endpoints.cjs.map +0 -1
  374. package/dist/transport/endpoints.d.cts +0 -79
  375. package/dist/transport/endpoints.d.ts +0 -79
  376. package/dist/transport/endpoints.es.js +0 -14
  377. package/dist/transport/endpoints.es.js.map +0 -1
  378. package/dist/transport/eventStreams.cjs +0 -2
  379. package/dist/transport/eventStreams.cjs.map +0 -1
  380. package/dist/transport/eventStreams.d.cts +0 -25
  381. package/dist/transport/eventStreams.d.ts +0 -25
  382. package/dist/transport/eventStreams.es.js +0 -21
  383. package/dist/transport/eventStreams.es.js.map +0 -1
  384. package/dist/transport/index.d.cts +0 -1
  385. package/dist/transport/index.d.ts +0 -1
@@ -1,160 +0,0 @@
1
- import { QUERY_STREAM_ENDPOINT as e } from "../../../transport/endpoints.es.js";
2
- import { bindMethods as t } from "../../bindMethods.es.js";
3
- import n from "../../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateMetadata.es.js";
4
- import r from "../../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorateParam.es.js";
5
- import i from "../../../_virtual/_@oxc-project_runtime@0.153.0/helpers/esm/decorate.es.js";
6
- import { EventStreamQueryEndpointPaths as a } from "./endpointPaths.es.js";
7
- import { api as o, attribute as s, autoGeneratedError as c, body as l, get as u, path as d, post as f } from "@ahoo-wang/fetcher-decorator";
8
- //#region src/client/query/event/eventStreamQueryClient.ts
9
- var p = class {
10
- constructor(e) {
11
- this.apiMetadata = e, t(this);
12
- }
13
- aggregate(e, t, n) {
14
- throw c(e, t, n);
15
- }
16
- /* v8 ignore stop */
17
- aggregateStream(e, t, n) {
18
- throw c(e, t, n);
19
- }
20
- /* v8 ignore stop */
21
- cursor(e, t, n) {
22
- throw c(e, t, n);
23
- }
24
- /* v8 ignore stop */
25
- count(e, t, n) {
26
- throw c(e, t, n);
27
- }
28
- /* v8 ignore stop */
29
- list(e, t, n) {
30
- throw c(e, t, n);
31
- }
32
- /* v8 ignore stop */
33
- listStream(e, t, n) {
34
- throw c(e, t, n);
35
- }
36
- /* v8 ignore stop */
37
- paged(e, t, n) {
38
- throw c(e, t, n);
39
- }
40
- /* v8 ignore stop */
41
- load(e, t, n, r, i) {
42
- throw c(e, t, n, r, i);
43
- }
44
- /* v8 ignore stop */
45
- loadStream(e, t, n, r, i) {
46
- throw c(e, t, n, r, i);
47
- }
48
- };
49
- i([
50
- f(a.AGGREGATION),
51
- r(0, l()),
52
- r(1, s()),
53
- n("design:type", Function),
54
- n("design:paramtypes", [
55
- Object,
56
- typeof Record > "u" ? Object : Record,
57
- Object
58
- ]),
59
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
60
- ], p.prototype, "aggregate", null), i([
61
- f(a.AGGREGATION, e),
62
- r(0, l()),
63
- r(1, s()),
64
- n("design:type", Function),
65
- n("design:paramtypes", [
66
- Object,
67
- typeof Record > "u" ? Object : Record,
68
- Object
69
- ]),
70
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
71
- ], p.prototype, "aggregateStream", null), i([
72
- f(a.CURSOR),
73
- r(0, l()),
74
- r(1, s()),
75
- n("design:type", Function),
76
- n("design:paramtypes", [
77
- Object,
78
- typeof Record > "u" ? Object : Record,
79
- Object
80
- ]),
81
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
82
- ], p.prototype, "cursor", null), i([
83
- f(a.COUNT),
84
- r(0, l()),
85
- r(1, s()),
86
- n("design:type", Function),
87
- n("design:paramtypes", [
88
- Object,
89
- typeof Record > "u" ? Object : Record,
90
- Object
91
- ]),
92
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
93
- ], p.prototype, "count", null), i([
94
- f(a.LIST),
95
- r(0, l()),
96
- r(1, s()),
97
- n("design:type", Function),
98
- n("design:paramtypes", [
99
- Object,
100
- typeof Record > "u" ? Object : Record,
101
- Object
102
- ]),
103
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
104
- ], p.prototype, "list", null), i([
105
- f(a.LIST, e),
106
- r(0, l()),
107
- r(1, s()),
108
- n("design:type", Function),
109
- n("design:paramtypes", [
110
- Object,
111
- typeof Record > "u" ? Object : Record,
112
- Object
113
- ]),
114
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
115
- ], p.prototype, "listStream", null), i([
116
- f(a.PAGED),
117
- r(0, l()),
118
- r(1, s()),
119
- n("design:type", Function),
120
- n("design:paramtypes", [
121
- Object,
122
- typeof Record > "u" ? Object : Record,
123
- Object
124
- ]),
125
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
126
- ], p.prototype, "paged", null), i([
127
- u(a.LOAD),
128
- r(0, d("id")),
129
- r(1, d("headVersion")),
130
- r(2, d("tailVersion")),
131
- r(3, s()),
132
- n("design:type", Function),
133
- n("design:paramtypes", [
134
- String,
135
- Number,
136
- Number,
137
- typeof Record > "u" ? Object : Record,
138
- Object
139
- ]),
140
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
141
- ], p.prototype, "load", null), i([
142
- u(a.LOAD, e),
143
- r(0, d("id")),
144
- r(1, d("headVersion")),
145
- r(2, d("tailVersion")),
146
- r(3, s()),
147
- n("design:type", Function),
148
- n("design:paramtypes", [
149
- String,
150
- Number,
151
- Number,
152
- typeof Record > "u" ? Object : Record,
153
- Object
154
- ]),
155
- n("design:returntype", typeof Promise > "u" ? Object : Promise)
156
- ], p.prototype, "loadStream", null), p = i([o(), n("design:paramtypes", [Object])], p);
157
- //#endregion
158
- export { p as EventStreamQueryClient };
159
-
160
- //# sourceMappingURL=eventStreamQueryClient.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eventStreamQueryClient.es.js","names":["_decorate","_decorateParam","_decorateMetadata","__decorateMetadata","__decorateParam","__decorate","EventStreamQueryClient","apiMetadata","bindMethods","autoGeneratedError","query","attributes","abort","filter","listQuery","pagedQuery","id","headVersion","tailVersion","post","EventStreamQueryEndpointPaths","body","attribute","QUERY_STREAM_ENDPOINT","get","path","api"],"sources":["../../../../src/client/query/event/eventStreamQueryClient.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 { EventStreamQueryApi } from './eventStreamQueryApi.js';\nimport { EventStreamQueryEndpointPaths } from './endpointPaths.js';\nimport type { AggregationQuery } from '../../../dsl/aggregation/index.js';\nimport type { FilterExpression } from '../../../dsl/filter/index.js';\nimport type {\n Condition,\n ListQueryRequest,\n PagedQueryRequest,\n} from '../requests.js';\nimport type { PagedList } from '../../../dsl/queryable.js';\nimport type { DomainEventStream } from '../../../model/domainEventStream.js';\nimport type { DynamicDocument } from '../../../dsl/documents.js';\nimport { QUERY_STREAM_ENDPOINT } from '../../../transport/endpoints.js';\nimport type { CursorPage, CursorQuery } from '../../../dsl/cursorQuery.js';\n\nimport type {\n ApiMetadata,\n ApiMetadataCapable,\n} from '@ahoo-wang/fetcher-decorator';\nimport {\n api,\n attribute,\n autoGeneratedError,\n body,\n get,\n path,\n post,\n} from '@ahoo-wang/fetcher-decorator';\nimport { bindMethods } from '../../bindMethods.js';\n\n/**\n * Client for querying event streams through HTTP endpoints.\n * Implements EventStreamQueryApi to provide methods\n * for querying domain event streams with different query patterns.\n * This client supports counting, listing, streaming, and paging operations on event streams.\n *\n * @example\n * ```typescript\n * import { Fetcher } from '@ahoo-wang/fetcher';\n * import type { ApiMetadata } from '@ahoo-wang/fetcher-decorator';\n *\n * // Create client options configuration\n * const clientOptions: ApiMetadata = {\n * fetcher: new Fetcher({ baseURL: 'http://localhost:8080/' }),\n * basePath: 'owner/{ownerId}/cart'\n * };\n *\n * // Create an event stream query client instance\n * const eventStreamQueryClient = new EventStreamQueryClient(clientOptions);\n *\n * // Count event streams\n * const count = await eventStreamQueryClient.count(filter.matchAll());\n *\n * // List event streams\n * const listQuery: FilterListQuery = {\n * filter: filter.matchAll()\n * };\n * const list = await eventStreamQueryClient.list(listQuery);\n *\n * // List event streams as stream\n * const listStream = await eventStreamQueryClient.listStream(listQuery);\n * for await (const domainEventStream of listStream) {\n * console.log('Received:', domainEventStream);\n * }\n *\n * // Paged event streams\n * const pagedQuery: FilterPagedQuery = {\n * filter: filter.matchAll()\n * };\n * const paged = await eventStreamQueryClient.paged(pagedQuery);\n * ```\n */\n@api()\nexport class EventStreamQueryClient<\n DomainEventBody = unknown,\n FIELDS extends string = string,\n>\n implements EventStreamQueryApi<DomainEventBody, FIELDS>, ApiMetadataCapable\n{\n /**\n * Creates a new EventStreamQueryClient instance.\n */\n constructor(public readonly apiMetadata?: ApiMetadata) {\n bindMethods(this);\n }\n\n /** Runs an event stream aggregation and returns all result rows. */\n @post(EventStreamQueryEndpointPaths.AGGREGATION)\n /* v8 ignore start */\n aggregate<\n Row extends object = DynamicDocument,\n AGGREGATION_FIELDS extends string = string,\n >(\n @body() query: AggregationQuery<FIELDS, AGGREGATION_FIELDS>,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<Row[]> {\n throw autoGeneratedError(query, attributes, abort);\n }\n /* v8 ignore stop */\n\n /** Runs an event stream aggregation and streams the result rows, one per server-sent event. */\n @post(EventStreamQueryEndpointPaths.AGGREGATION, QUERY_STREAM_ENDPOINT)\n /* v8 ignore start */\n aggregateStream<\n Row extends object = DynamicDocument,\n AGGREGATION_FIELDS extends string = string,\n >(\n @body() query: AggregationQuery<FIELDS, AGGREGATION_FIELDS>,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<ReadableStream<Row>> {\n throw autoGeneratedError(query, attributes, abort);\n }\n /* v8 ignore stop */\n\n /** Retrieves the next cursor page of domain event streams. */\n @post(EventStreamQueryEndpointPaths.CURSOR)\n /* v8 ignore start */\n cursor<\n T extends Partial<DomainEventStream<DomainEventBody>> =\n DomainEventStream<DomainEventBody>,\n >(\n @body() query: CursorQuery<FIELDS>,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<CursorPage<T>> {\n throw autoGeneratedError(query, attributes, abort);\n }\n /* v8 ignore stop */\n\n /**\n * Counts the number of domain event streams that match the given filter.\n *\n * @param filter - The filter expression or legacy condition\n * @param attributes - Optional shared attributes that can be accessed by interceptors\n * throughout the request lifecycle. These attributes allow passing\n * custom data between different interceptors.\n * @param abort - Cancels the request: an `AbortController`, or an `AbortSignal` such as `AbortSignal.timeout(ms)` or the `signal` a data-fetching library passes.\n * @returns A promise that resolves to the count of matching event streams\n *\n * @example\n * ```typescript\n * const controller = new AbortController();\n * const count = await eventStreamQueryClient.count(filter.matchAll(), undefined, controller);\n * console.log('Total event streams:', count);\n *\n * // Cancel the request if needed\n * controller.abort();\n * ```\n */\n @post(EventStreamQueryEndpointPaths.COUNT)\n /* v8 ignore start */\n count(\n // compat(wow<9): accepts the deprecated Condition, which Wow < 8.11 needs; narrow to FilterExpression in v10.\n @body() filter: FilterExpression<FIELDS> | Condition<FIELDS>,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<number> {\n throw autoGeneratedError(filter, attributes, abort);\n }\n /* v8 ignore stop */\n\n /**\n * Retrieves a list of domain event streams based on the provided query parameters.\n *\n * @param listQuery - The query parameters for listing event streams\n * @param attributes - Optional shared attributes that can be accessed by interceptors\n * throughout the request lifecycle. These attributes allow passing\n * custom data between different interceptors.\n * @param abort - Cancels the request: an `AbortController`, or an `AbortSignal` such as `AbortSignal.timeout(ms)` or the `signal` a data-fetching library passes.\n * @returns A promise that resolves to an array of partial domain event streams\n *\n * @example\n * ```typescript\n * const controller = new AbortController();\n * const listQuery: FilterListQuery = {\n * filter: filter.matchAll()\n * };\n * const list = await eventStreamQueryClient.list(listQuery, undefined, controller);\n * for (const domainEventStream of list) {\n * console.log('Event stream:', domainEventStream);\n * }\n *\n * // Cancel the request if needed\n * controller.abort();\n * ```\n */\n @post(EventStreamQueryEndpointPaths.LIST)\n /* v8 ignore start */\n list<\n T extends Partial<DomainEventStream<DomainEventBody>> =\n DomainEventStream<DomainEventBody>,\n >(\n @body() listQuery: ListQueryRequest<FIELDS>,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<T[]> {\n throw autoGeneratedError(listQuery, attributes, abort);\n }\n /* v8 ignore stop */\n\n /**\n * Retrieves a stream of domain event streams based on the provided query parameters.\n * Sets the Accept header to text/event-stream to indicate that the response should be streamed.\n *\n * @param listQuery - The query parameters for listing event streams\n * @param attributes - Optional shared attributes that can be accessed by interceptors\n * throughout the request lifecycle. These attributes allow passing\n * custom data between different interceptors.\n * @param abort - Cancels the request: an `AbortController`, or an `AbortSignal` such as `AbortSignal.timeout(ms)` or the `signal` a data-fetching library passes.\n * @returns A promise that resolves to a readable stream of partial domain event streams\n *\n * @example\n * ```typescript\n * const controller = new AbortController();\n * const listQuery: FilterListQuery = {\n * filter: filter.matchAll()\n * };\n * const listStream = await eventStreamQueryClient.listStream(listQuery, undefined, controller);\n * for await (const domainEventStream of listStream) {\n * console.log('Received event stream:', domainEventStream);\n * }\n *\n * // Cancel the request if needed\n * controller.abort();\n * ```\n */\n @post(EventStreamQueryEndpointPaths.LIST, QUERY_STREAM_ENDPOINT)\n /* v8 ignore start */\n listStream<\n T extends Partial<DomainEventStream<DomainEventBody>> =\n DomainEventStream<DomainEventBody>,\n >(\n @body() listQuery: ListQueryRequest<FIELDS>,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<ReadableStream<T>> {\n throw autoGeneratedError(listQuery, attributes, abort);\n }\n /* v8 ignore stop */\n\n /**\n * Retrieves a paged list of domain event streams based on the provided query parameters.\n *\n * @param pagedQuery - The query parameters for paging event streams\n * @param attributes - Optional shared attributes that can be accessed by interceptors\n * throughout the request lifecycle. These attributes allow passing\n * custom data between different interceptors.\n * @param abort - Cancels the request: an `AbortController`, or an `AbortSignal` such as `AbortSignal.timeout(ms)` or the `signal` a data-fetching library passes.\n * @returns A promise that resolves to a paged list of partial domain event streams\n *\n * @example\n * ```typescript\n * const controller = new AbortController();\n * const pagedQuery: FilterPagedQuery = {\n * filter: filter.matchAll(),\n * pagination: { index: 1, size: 10 }\n * };\n * const paged = await eventStreamQueryClient.paged(pagedQuery, undefined, controller);\n * console.log('Total:', paged.total);\n * for (const domainEventStream of paged.list) {\n * console.log('Event stream:', domainEventStream);\n * }\n *\n * // Cancel the request if needed\n * controller.abort();\n * ```\n */\n @post(EventStreamQueryEndpointPaths.PAGED)\n /* v8 ignore start */\n paged<\n T extends Partial<DomainEventStream<DomainEventBody>> =\n DomainEventStream<DomainEventBody>,\n >(\n @body() pagedQuery: PagedQueryRequest<FIELDS>,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<PagedList<T>> {\n throw autoGeneratedError(pagedQuery, attributes, abort);\n }\n /* v8 ignore stop */\n\n /**\n * Loads one aggregate's event streams from `headVersion` to `tailVersion`,\n * both inclusive, in version order — how an audit trail or an event\n * sourcing view replays an aggregate. `GET {id}/event/{headVersion}/{tailVersion}`.\n *\n * The server treats the range as a list query: more than its maximum list\n * size (1000 by default) is refused. The route carries a tenant segment by\n * default but no owner segment, like the load-state routes.\n *\n * @param id - The aggregate id\n * @param headVersion - The first version, from 1\n * @param tailVersion - The last version\n * @param attributes - Optional shared attributes for the interceptors\n * @param abort - Cancels the request: an `AbortController`, or an `AbortSignal` such as `AbortSignal.timeout(ms)` or the `signal` a data-fetching library passes.\n * @returns The event streams of versions `headVersion` to `tailVersion`\n *\n * @example\n * ```typescript\n * const firstTen = await eventStreamQueryClient.load(cartId, 1, 10);\n * ```\n */\n @get(EventStreamQueryEndpointPaths.LOAD)\n /* v8 ignore start */\n load<\n T extends Partial<DomainEventStream<DomainEventBody>> =\n DomainEventStream<DomainEventBody>,\n >(\n @path('id') id: string,\n @path('headVersion') headVersion: number,\n @path('tailVersion') tailVersion: number,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<T[]> {\n throw autoGeneratedError(id, headVersion, tailVersion, attributes, abort);\n }\n /* v8 ignore stop */\n\n /**\n * {@link load} as a stream, one event stream per server-sent event.\n * The stream errors with a `WowError` if the server fails midway.\n */\n @get(EventStreamQueryEndpointPaths.LOAD, QUERY_STREAM_ENDPOINT)\n /* v8 ignore start */\n loadStream<\n T extends Partial<DomainEventStream<DomainEventBody>> =\n DomainEventStream<DomainEventBody>,\n >(\n @path('id') id: string,\n @path('headVersion') headVersion: number,\n @path('tailVersion') tailVersion: number,\n @attribute() attributes?: Record<string, unknown>,\n abort?: AbortController | AbortSignal,\n ): Promise<ReadableStream<T>> {\n throw autoGeneratedError(id, headVersion, tailVersion, attributes, abort);\n }\n /* v8 ignore stop */\n}\n"],"mappings":";;;;;;;;AAsFO,IAAMM,IAAN,MAKP;CAIE,YAAY,GAA2C;EACrD,AAD0B,KAAA,cAAAC,GAC1BC,EAAY,IAAI;CAClB;CAGA,UAME,GACA,GACA,GACgB;EAChB,MAAMC,EAAmBC,GAAOC,GAAYC,CAAK;CACnD;;CAIA,gBAME,GACA,GACA,GAC8B;EAC9B,MAAMH,EAAmBC,GAAOC,GAAYC,CAAK;CACnD;;CAIA,OAME,GACA,GACA,GACwB;EACxB,MAAMH,EAAmBC,GAAOC,GAAYC,CAAK;CACnD;;CAuBA,MAIE,GACA,GACA,GACiB;EACjB,MAAMH,EAAmBI,GAAQF,GAAYC,CAAK;CACpD;;CA4BA,KAME,GACA,GACA,GACc;EACd,MAAMH,EAAmBK,GAAWH,GAAYC,CAAK;CACvD;;CA6BA,WAME,GACA,GACA,GAC4B;EAC5B,MAAMH,EAAmBK,GAAWH,GAAYC,CAAK;CACvD;;CA8BA,MAME,GACA,GACA,GACuB;EACvB,MAAMH,EAAmBM,GAAYJ,GAAYC,CAAK;CACxD;;CAwBA,KAME,GACA,GACA,GACA,GACA,GACc;EACd,MAAMH,EAAmBO,GAAIC,GAAaC,GAAaP,GAAYC,CAAK;CAC1E;;CAOA,WAME,GACA,GACA,GACA,GACA,GAC4B;EAC5B,MAAMH,EAAmBO,GAAIC,GAAaC,GAAaP,GAAYC,CAAK;CAC1E;AAEF;;CA5PGO,EAAKC,EAA8B,WAAW;CAM5CnB,EAAA,GAAAoB,EAAK,CAAA;CACLpB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;CAQZH,EAAKC,EAA8B,aAAaG,CAAqB;CAMnEtB,EAAA,GAAAoB,EAAK,CAAA;CACLpB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;CAQZH,EAAKC,EAA8B,MAAM;CAMvCnB,EAAA,GAAAoB,EAAK,CAAA;CACLpB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;CA2BZH,EAAKC,EAA8B,KAAK;CAItCnB,EAAA,GAAAoB,EAAK,CAAA;CACLpB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;CAgCZH,EAAKC,EAA8B,IAAI;CAMrCnB,EAAA,GAAAoB,EAAK,CAAA;CACLpB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;CAiCZH,EAAKC,EAA8B,MAAMG,CAAqB;CAM5DtB,EAAA,GAAAoB,EAAK,CAAA;CACLpB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;CAkCZH,EAAKC,EAA8B,KAAK;CAMtCnB,EAAA,GAAAoB,EAAK,CAAA;CACLpB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;CA4BZE,EAAIJ,EAA8B,IAAI;CAMpCnB,EAAA,GAAAwB,EAAK,IAAI,CAAA;CACTxB,EAAA,GAAAwB,EAAK,aAAa,CAAA;CAClBxB,EAAA,GAAAwB,EAAK,aAAa,CAAA;CAClBxB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;;;CAWZE,EAAIJ,EAA8B,MAAMG,CAAqB;CAM3DtB,EAAA,GAAAwB,EAAK,IAAI,CAAA;CACTxB,EAAA,GAAAwB,EAAK,aAAa,CAAA;CAClBxB,EAAA,GAAAwB,EAAK,aAAa,CAAA;CAClBxB,EAAA,GAAAqB,EAAU,CAAA;;;;;;;;;;qCArQd,IAAAtB,EAAA,CAAA0B,EAAI,GAAAxB,EAAA,qBAAA,CAAA,MAAA,CAAA,CAAA,GAAAI,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './eventStreamQueryApi.cjs';
2
- export * from './eventStreamQueryClient.cjs';
@@ -1,2 +0,0 @@
1
- export * from './eventStreamQueryApi.js';
2
- export * from './eventStreamQueryClient.js';
@@ -1,2 +0,0 @@
1
- const e=require("./event/eventStreamQueryClient.cjs"),t=require("./snapshot/snapshotQueryClient.cjs"),n=require("./state/loadStateAggregateClient.cjs"),r=require("./state/loadOwnerStateAggregateClient.cjs"),i=require("./descriptor/queryDescriptorClient.cjs");let a=require("@ahoo-wang/fetcher");function o(e,t,n=!0){let{contextAlias:r,resourceAttribution:i,aggregateName:a,...o}={...e,...t};return{...o,basePath:t?.basePath??e.basePath??s(r,n?i:void 0,a)}}function s(e,t,n){let r=(0,a.combineURLs)(t??``,n??``);return e?(0,a.combineURLs)(e,r):r}var c=class{constructor(e){this.defaultOptions=e}createSnapshotQueryClient(e){return new t.SnapshotQueryClient(o(this.defaultOptions,e))}createLoadStateAggregateClient(e){return new n.LoadStateAggregateClient(o(this.defaultOptions,e))}createLoadOwnerStateAggregateClient(e){return new r.LoadOwnerStateAggregateClient(o(this.defaultOptions,e))}createEventStreamQueryClient(t){return new e.EventStreamQueryClient(o(this.defaultOptions,t))}createQueryDescriptorClient(e){return new i.QueryDescriptorClient(o(this.defaultOptions,e,!1))}};exports.QueryClientFactory=c;
2
- //# sourceMappingURL=factory.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.cjs","names":["combineURLs","SnapshotQueryClient","LoadStateAggregateClient","LoadOwnerStateAggregateClient","EventStreamQueryClient","QueryDescriptorClient","require_eventStreamQueryClient","require_snapshotQueryClient","require_loadStateAggregateClient","require_loadOwnerStateAggregateClient","require_queryDescriptorClient","_ahoo_wang_fetcher","queryApiMetadata","apiMetadata","defaults","options","routePath","contextAlias","attributed","resourceAttribution","aggregateName","path","QueryClientFactory","defaultOptions"],"sources":["../../../src/client/query/factory.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 { PartialBy } from '@ahoo-wang/fetcher';\nimport { combineURLs } from '@ahoo-wang/fetcher';\nimport type { ApiMetadata } from '@ahoo-wang/fetcher-decorator';\nimport type {\n AggregateNameCapable,\n AliasBoundedContext,\n} from '../../model/index.js';\nimport type { ResourceAttributionPathSpec } from '../routing.js';\nimport { SnapshotQueryClient } from './snapshot/index.js';\nimport { EventStreamQueryClient } from './event/index.js';\nimport { LoadStateAggregateClient } from './state/index.js';\nimport { LoadOwnerStateAggregateClient } from './state/index.js';\nimport { QueryDescriptorClient } from './descriptor/index.js';\n\n/**\n * Configuration options for query clients: the client's `ApiMetadata`\n * (`fetcher`, `headers`, `urlParams`, …, with `basePath` optional), plus\n * three keys only {@link QueryClientFactory} reads to build the base path:\n * `contextAlias`, `resourceAttribution` and `aggregateName`.\n *\n * The base path is `basePath` when one is given, and then the three keys\n * are not used. Otherwise it is\n * `{contextAlias}{resourceAttribution}/{aggregateName}`, each part left out\n * when absent. The three keys are not passed on to the client.\n */\nexport interface QueryClientOptions\n extends\n PartialBy<ApiMetadata, 'basePath'>,\n Partial<AliasBoundedContext>,\n Partial<AggregateNameCapable> {\n contextAlias?: string;\n resourceAttribution?: ResourceAttributionPathSpec;\n}\n\n/**\n * The `ApiMetadata` a factory gives a client: `options` over the factory's\n * `defaults`, the base path resolved, and the keys only the factory reads\n * left out. `attributed: false` leaves the resource attribution out of the\n * base path, for routes that have no tenant or owner segment.\n */\nfunction queryApiMetadata(\n defaults: QueryClientOptions,\n options?: QueryClientOptions,\n attributed = true,\n): ApiMetadata {\n const { contextAlias, resourceAttribution, aggregateName, ...apiMetadata } = {\n ...defaults,\n ...options,\n };\n return {\n ...apiMetadata,\n basePath:\n options?.basePath ??\n defaults.basePath ??\n routePath(\n contextAlias,\n attributed ? resourceAttribution : undefined,\n aggregateName,\n ),\n };\n}\n\n/** `{contextAlias}{resourceAttribution}/{aggregateName}`. */\nfunction routePath(\n contextAlias: string | undefined,\n resourceAttribution: ResourceAttributionPathSpec | undefined,\n aggregateName: string | undefined,\n): string {\n const path = combineURLs(resourceAttribution ?? '', aggregateName ?? '');\n return contextAlias ? combineURLs(contextAlias, path) : path;\n}\n\n/**\n * Creates the query clients of one aggregate from shared defaults: its\n * snapshot, event stream, load-state and query descriptor clients. Each `create*` call may\n * override the defaults; see {@link QueryClientOptions} for how the base path\n * is built. Generated code creates one factory per aggregate.\n *\n * @template S - The type of the aggregate state\n * @template FIELDS - The field paths snapshot queries may name\n * @template DomainEventBody - The type of the aggregate's event bodies\n */\nexport class QueryClientFactory<\n S,\n FIELDS extends string = string,\n DomainEventBody = unknown,\n> {\n /**\n * Creates a new QueryClientFactory instance with the specified default options.\n *\n * @param defaultOptions - The default options to be used for all query clients created by this factory\n *\n * @example\n * ```typescript\n * import { QueryClientFactory, ResourceAttributionPathSpec } from '@ahoo-wang/wow-client';\n *\n * const factory = new QueryClientFactory({\n * contextAlias: 'example',\n * aggregateName: 'cart',\n * resourceAttribution: ResourceAttributionPathSpec.OWNER,\n * });\n * ```\n */\n constructor(private readonly defaultOptions: QueryClientOptions) {}\n\n /**\n * Creates a snapshot query client for querying aggregate snapshots.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates a SnapshotQueryClient.\n *\n * @param options - The query client options used to configure the snapshot query client\n * @returns A new instance of SnapshotQueryClient\n *\n * @example\n * ```typescript\n * const snapshotClient = factory.createSnapshotQueryClient({\n * aggregateName: 'cart',\n * });\n *\n * const cartState = await snapshotClient.singleState(singleQuery());\n * ```\n */\n createSnapshotQueryClient(\n options?: QueryClientOptions,\n ): SnapshotQueryClient<S, FIELDS> {\n return new SnapshotQueryClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates a client for loading aggregate state by ID.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates a LoadStateAggregateClient.\n * The client supports loading current state, versioned state, and time-based state.\n *\n * @param options - The query client options used to configure the state aggregate client\n * @returns A new instance of LoadStateAggregateClient\n *\n * @example\n * ```typescript\n * const stateClient = factory.createLoadStateAggregateClient({\n * aggregateName: 'cart',\n * });\n *\n * // Load current state\n * const currentState = await stateClient.load('cart-123');\n *\n * // Load specific version\n * const versionedState = await stateClient.loadVersioned('cart-123', 5);\n *\n * // Load state at specific time\n * const timeBasedState = await stateClient.loadTimeBased('cart-123', Date.now());\n * ```\n */\n createLoadStateAggregateClient(\n options?: QueryClientOptions,\n ): LoadStateAggregateClient<S> {\n return new LoadStateAggregateClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates a client for loading owner-specific aggregate state.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates a LoadOwnerStateAggregateClient.\n * Unlike the standard state client, this client loads state for the current owner\n * without requiring an explicit ID parameter.\n *\n * @param options - The query client options used to configure the owner state aggregate client\n * @returns A new instance of LoadOwnerStateAggregateClient\n *\n * @example\n * ```typescript\n * const ownerStateClient = factory.createLoadOwnerStateAggregateClient({\n * aggregateName: 'cart',\n * resourceAttribution: ResourceAttributionPathSpec.OWNER,\n * });\n *\n * // Load current owner's state\n * const currentState = await ownerStateClient.load();\n *\n * // Load specific version of owner's state\n * const versionedState = await ownerStateClient.loadVersioned(5);\n *\n * // Load owner's state at specific time\n * const timeBasedState = await ownerStateClient.loadTimeBased(Date.now());\n * ```\n */\n createLoadOwnerStateAggregateClient(\n options?: QueryClientOptions,\n ): LoadOwnerStateAggregateClient<S> {\n return new LoadOwnerStateAggregateClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates an event stream query client for querying domain event streams.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates an EventStreamQueryClient.\n *\n * @param options - The query client options used to configure the event stream query client\n * @returns A new instance of EventStreamQueryClient\n *\n * @example\n * ```typescript\n * const eventClient = factory.createEventStreamQueryClient({\n * aggregateName: 'cart',\n * });\n *\n * const events = await eventClient.list(listQuery());\n * ```\n */\n createEventStreamQueryClient<EVENT_FIELDS extends string = string>(\n options?: QueryClientOptions,\n ): EventStreamQueryClient<DomainEventBody, EVENT_FIELDS> {\n return new EventStreamQueryClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates a client that reads the aggregate's query capability\n * descriptors (`{aggregate}/snapshot/schema`, `{aggregate}/event/schema`).\n *\n * Its base path is `basePath` when one is given, as for the other clients;\n * otherwise `{contextAlias}/{aggregateName}` without the\n * `resourceAttribution`: the schema routes have no tenant or owner segment.\n *\n * @param options - Overrides the factory's defaults, as for the other clients\n * @returns A new instance of QueryDescriptorClient\n *\n * @example\n * ```typescript\n * const descriptors = factory.createQueryDescriptorClient();\n * const snapshot = await descriptors.describeSnapshot();\n * ```\n */\n createQueryDescriptorClient(\n options?: QueryClientOptions,\n ): QueryDescriptorClient {\n return new QueryDescriptorClient(\n queryApiMetadata(this.defaultOptions, options, false),\n );\n }\n}\n"],"mappings":"uSAqDA,SAASY,EACP,EACA,EACA,EAAa,GACA,CACb,GAAM,CAAE,eAAc,sBAAqB,gBAAe,GAAGC,GAAgB,CAC3E,GAAGC,EACH,GAAGC,CACL,EACA,MAAO,CACL,GAAGF,EACH,SACEE,GAAS,UACTD,EAAS,UACTE,EACEC,EACAC,EAAaC,EAAsB,IAAA,GACnCC,CACF,CACJ,CACF,CAGA,SAASJ,EACP,EACA,EACA,EACQ,CACR,IAAMK,GAAA,EAAOrB,EAAAA,YAAAA,CAAYmB,GAAuB,GAAIC,GAAiB,EAAE,EACvE,OAAOH,GAAA,EAAejB,EAAAA,YAAAA,CAAYiB,EAAcI,CAAI,EAAIA,CAC1D,CAYA,IAAaC,EAAb,KAIE,CAiBA,YAAY,EAAqD,CAApC,KAAA,eAAAC,CAAqC,CAoBlE,0BACE,EACgC,CAChC,OAAO,IAAItB,EAAAA,oBACTW,EAAiB,KAAK,eAAgBG,CAAO,CAC/C,CACF,CA4BA,+BACE,EAC6B,CAC7B,OAAO,IAAIb,EAAAA,yBACTU,EAAiB,KAAK,eAAgBG,CAAO,CAC/C,CACF,CA8BA,oCACE,EACkC,CAClC,OAAO,IAAIZ,EAAAA,8BACTS,EAAiB,KAAK,eAAgBG,CAAO,CAC/C,CACF,CAoBA,6BACE,EACuD,CACvD,OAAO,IAAIX,EAAAA,uBACTQ,EAAiB,KAAK,eAAgBG,CAAO,CAC/C,CACF,CAmBA,4BACE,EACuB,CACvB,OAAO,IAAIV,EAAAA,sBACTO,EAAiB,KAAK,eAAgBG,EAAS,EAAK,CACtD,CACF,CACF"}
@@ -1,165 +0,0 @@
1
- import { PartialBy } from '@ahoo-wang/fetcher';
2
- import { ApiMetadata } from '@ahoo-wang/fetcher-decorator';
3
- import { AggregateNameCapable, AliasBoundedContext } from '../../model/index.cjs';
4
- import { ResourceAttributionPathSpec } from '../routing.cjs';
5
- import { SnapshotQueryClient } from './snapshot/index.cjs';
6
- import { EventStreamQueryClient } from './event/index.cjs';
7
- import { LoadStateAggregateClient, LoadOwnerStateAggregateClient } from './state/index.cjs';
8
- import { QueryDescriptorClient } from './descriptor/index.cjs';
9
- /**
10
- * Configuration options for query clients: the client's `ApiMetadata`
11
- * (`fetcher`, `headers`, `urlParams`, …, with `basePath` optional), plus
12
- * three keys only {@link QueryClientFactory} reads to build the base path:
13
- * `contextAlias`, `resourceAttribution` and `aggregateName`.
14
- *
15
- * The base path is `basePath` when one is given, and then the three keys
16
- * are not used. Otherwise it is
17
- * `{contextAlias}{resourceAttribution}/{aggregateName}`, each part left out
18
- * when absent. The three keys are not passed on to the client.
19
- */
20
- export interface QueryClientOptions extends PartialBy<ApiMetadata, 'basePath'>, Partial<AliasBoundedContext>, Partial<AggregateNameCapable> {
21
- contextAlias?: string;
22
- resourceAttribution?: ResourceAttributionPathSpec;
23
- }
24
- /**
25
- * Creates the query clients of one aggregate from shared defaults: its
26
- * snapshot, event stream, load-state and query descriptor clients. Each `create*` call may
27
- * override the defaults; see {@link QueryClientOptions} for how the base path
28
- * is built. Generated code creates one factory per aggregate.
29
- *
30
- * @template S - The type of the aggregate state
31
- * @template FIELDS - The field paths snapshot queries may name
32
- * @template DomainEventBody - The type of the aggregate's event bodies
33
- */
34
- export declare class QueryClientFactory<S, FIELDS extends string = string, DomainEventBody = unknown> {
35
- private readonly defaultOptions;
36
- /**
37
- * Creates a new QueryClientFactory instance with the specified default options.
38
- *
39
- * @param defaultOptions - The default options to be used for all query clients created by this factory
40
- *
41
- * @example
42
- * ```typescript
43
- * import { QueryClientFactory, ResourceAttributionPathSpec } from '@ahoo-wang/wow-client';
44
- *
45
- * const factory = new QueryClientFactory({
46
- * contextAlias: 'example',
47
- * aggregateName: 'cart',
48
- * resourceAttribution: ResourceAttributionPathSpec.OWNER,
49
- * });
50
- * ```
51
- */
52
- constructor(defaultOptions: QueryClientOptions);
53
- /**
54
- * Creates a snapshot query client for querying aggregate snapshots.
55
- *
56
- * This method merges the provided options with the factory's default options,
57
- * then creates API metadata and instantiates a SnapshotQueryClient.
58
- *
59
- * @param options - The query client options used to configure the snapshot query client
60
- * @returns A new instance of SnapshotQueryClient
61
- *
62
- * @example
63
- * ```typescript
64
- * const snapshotClient = factory.createSnapshotQueryClient({
65
- * aggregateName: 'cart',
66
- * });
67
- *
68
- * const cartState = await snapshotClient.singleState(singleQuery());
69
- * ```
70
- */
71
- createSnapshotQueryClient(options?: QueryClientOptions): SnapshotQueryClient<S, FIELDS>;
72
- /**
73
- * Creates a client for loading aggregate state by ID.
74
- *
75
- * This method merges the provided options with the factory's default options,
76
- * then creates API metadata and instantiates a LoadStateAggregateClient.
77
- * The client supports loading current state, versioned state, and time-based state.
78
- *
79
- * @param options - The query client options used to configure the state aggregate client
80
- * @returns A new instance of LoadStateAggregateClient
81
- *
82
- * @example
83
- * ```typescript
84
- * const stateClient = factory.createLoadStateAggregateClient({
85
- * aggregateName: 'cart',
86
- * });
87
- *
88
- * // Load current state
89
- * const currentState = await stateClient.load('cart-123');
90
- *
91
- * // Load specific version
92
- * const versionedState = await stateClient.loadVersioned('cart-123', 5);
93
- *
94
- * // Load state at specific time
95
- * const timeBasedState = await stateClient.loadTimeBased('cart-123', Date.now());
96
- * ```
97
- */
98
- createLoadStateAggregateClient(options?: QueryClientOptions): LoadStateAggregateClient<S>;
99
- /**
100
- * Creates a client for loading owner-specific aggregate state.
101
- *
102
- * This method merges the provided options with the factory's default options,
103
- * then creates API metadata and instantiates a LoadOwnerStateAggregateClient.
104
- * Unlike the standard state client, this client loads state for the current owner
105
- * without requiring an explicit ID parameter.
106
- *
107
- * @param options - The query client options used to configure the owner state aggregate client
108
- * @returns A new instance of LoadOwnerStateAggregateClient
109
- *
110
- * @example
111
- * ```typescript
112
- * const ownerStateClient = factory.createLoadOwnerStateAggregateClient({
113
- * aggregateName: 'cart',
114
- * resourceAttribution: ResourceAttributionPathSpec.OWNER,
115
- * });
116
- *
117
- * // Load current owner's state
118
- * const currentState = await ownerStateClient.load();
119
- *
120
- * // Load specific version of owner's state
121
- * const versionedState = await ownerStateClient.loadVersioned(5);
122
- *
123
- * // Load owner's state at specific time
124
- * const timeBasedState = await ownerStateClient.loadTimeBased(Date.now());
125
- * ```
126
- */
127
- createLoadOwnerStateAggregateClient(options?: QueryClientOptions): LoadOwnerStateAggregateClient<S>;
128
- /**
129
- * Creates an event stream query client for querying domain event streams.
130
- *
131
- * This method merges the provided options with the factory's default options,
132
- * then creates API metadata and instantiates an EventStreamQueryClient.
133
- *
134
- * @param options - The query client options used to configure the event stream query client
135
- * @returns A new instance of EventStreamQueryClient
136
- *
137
- * @example
138
- * ```typescript
139
- * const eventClient = factory.createEventStreamQueryClient({
140
- * aggregateName: 'cart',
141
- * });
142
- *
143
- * const events = await eventClient.list(listQuery());
144
- * ```
145
- */
146
- createEventStreamQueryClient<EVENT_FIELDS extends string = string>(options?: QueryClientOptions): EventStreamQueryClient<DomainEventBody, EVENT_FIELDS>;
147
- /**
148
- * Creates a client that reads the aggregate's query capability
149
- * descriptors (`{aggregate}/snapshot/schema`, `{aggregate}/event/schema`).
150
- *
151
- * Its base path is `basePath` when one is given, as for the other clients;
152
- * otherwise `{contextAlias}/{aggregateName}` without the
153
- * `resourceAttribution`: the schema routes have no tenant or owner segment.
154
- *
155
- * @param options - Overrides the factory's defaults, as for the other clients
156
- * @returns A new instance of QueryDescriptorClient
157
- *
158
- * @example
159
- * ```typescript
160
- * const descriptors = factory.createQueryDescriptorClient();
161
- * const snapshot = await descriptors.describeSnapshot();
162
- * ```
163
- */
164
- createQueryDescriptorClient(options?: QueryClientOptions): QueryDescriptorClient;
165
- }
@@ -1,165 +0,0 @@
1
- import { PartialBy } from '@ahoo-wang/fetcher';
2
- import { ApiMetadata } from '@ahoo-wang/fetcher-decorator';
3
- import { AggregateNameCapable, AliasBoundedContext } from '../../model/index.js';
4
- import { ResourceAttributionPathSpec } from '../routing.js';
5
- import { SnapshotQueryClient } from './snapshot/index.js';
6
- import { EventStreamQueryClient } from './event/index.js';
7
- import { LoadStateAggregateClient, LoadOwnerStateAggregateClient } from './state/index.js';
8
- import { QueryDescriptorClient } from './descriptor/index.js';
9
- /**
10
- * Configuration options for query clients: the client's `ApiMetadata`
11
- * (`fetcher`, `headers`, `urlParams`, …, with `basePath` optional), plus
12
- * three keys only {@link QueryClientFactory} reads to build the base path:
13
- * `contextAlias`, `resourceAttribution` and `aggregateName`.
14
- *
15
- * The base path is `basePath` when one is given, and then the three keys
16
- * are not used. Otherwise it is
17
- * `{contextAlias}{resourceAttribution}/{aggregateName}`, each part left out
18
- * when absent. The three keys are not passed on to the client.
19
- */
20
- export interface QueryClientOptions extends PartialBy<ApiMetadata, 'basePath'>, Partial<AliasBoundedContext>, Partial<AggregateNameCapable> {
21
- contextAlias?: string;
22
- resourceAttribution?: ResourceAttributionPathSpec;
23
- }
24
- /**
25
- * Creates the query clients of one aggregate from shared defaults: its
26
- * snapshot, event stream, load-state and query descriptor clients. Each `create*` call may
27
- * override the defaults; see {@link QueryClientOptions} for how the base path
28
- * is built. Generated code creates one factory per aggregate.
29
- *
30
- * @template S - The type of the aggregate state
31
- * @template FIELDS - The field paths snapshot queries may name
32
- * @template DomainEventBody - The type of the aggregate's event bodies
33
- */
34
- export declare class QueryClientFactory<S, FIELDS extends string = string, DomainEventBody = unknown> {
35
- private readonly defaultOptions;
36
- /**
37
- * Creates a new QueryClientFactory instance with the specified default options.
38
- *
39
- * @param defaultOptions - The default options to be used for all query clients created by this factory
40
- *
41
- * @example
42
- * ```typescript
43
- * import { QueryClientFactory, ResourceAttributionPathSpec } from '@ahoo-wang/wow-client';
44
- *
45
- * const factory = new QueryClientFactory({
46
- * contextAlias: 'example',
47
- * aggregateName: 'cart',
48
- * resourceAttribution: ResourceAttributionPathSpec.OWNER,
49
- * });
50
- * ```
51
- */
52
- constructor(defaultOptions: QueryClientOptions);
53
- /**
54
- * Creates a snapshot query client for querying aggregate snapshots.
55
- *
56
- * This method merges the provided options with the factory's default options,
57
- * then creates API metadata and instantiates a SnapshotQueryClient.
58
- *
59
- * @param options - The query client options used to configure the snapshot query client
60
- * @returns A new instance of SnapshotQueryClient
61
- *
62
- * @example
63
- * ```typescript
64
- * const snapshotClient = factory.createSnapshotQueryClient({
65
- * aggregateName: 'cart',
66
- * });
67
- *
68
- * const cartState = await snapshotClient.singleState(singleQuery());
69
- * ```
70
- */
71
- createSnapshotQueryClient(options?: QueryClientOptions): SnapshotQueryClient<S, FIELDS>;
72
- /**
73
- * Creates a client for loading aggregate state by ID.
74
- *
75
- * This method merges the provided options with the factory's default options,
76
- * then creates API metadata and instantiates a LoadStateAggregateClient.
77
- * The client supports loading current state, versioned state, and time-based state.
78
- *
79
- * @param options - The query client options used to configure the state aggregate client
80
- * @returns A new instance of LoadStateAggregateClient
81
- *
82
- * @example
83
- * ```typescript
84
- * const stateClient = factory.createLoadStateAggregateClient({
85
- * aggregateName: 'cart',
86
- * });
87
- *
88
- * // Load current state
89
- * const currentState = await stateClient.load('cart-123');
90
- *
91
- * // Load specific version
92
- * const versionedState = await stateClient.loadVersioned('cart-123', 5);
93
- *
94
- * // Load state at specific time
95
- * const timeBasedState = await stateClient.loadTimeBased('cart-123', Date.now());
96
- * ```
97
- */
98
- createLoadStateAggregateClient(options?: QueryClientOptions): LoadStateAggregateClient<S>;
99
- /**
100
- * Creates a client for loading owner-specific aggregate state.
101
- *
102
- * This method merges the provided options with the factory's default options,
103
- * then creates API metadata and instantiates a LoadOwnerStateAggregateClient.
104
- * Unlike the standard state client, this client loads state for the current owner
105
- * without requiring an explicit ID parameter.
106
- *
107
- * @param options - The query client options used to configure the owner state aggregate client
108
- * @returns A new instance of LoadOwnerStateAggregateClient
109
- *
110
- * @example
111
- * ```typescript
112
- * const ownerStateClient = factory.createLoadOwnerStateAggregateClient({
113
- * aggregateName: 'cart',
114
- * resourceAttribution: ResourceAttributionPathSpec.OWNER,
115
- * });
116
- *
117
- * // Load current owner's state
118
- * const currentState = await ownerStateClient.load();
119
- *
120
- * // Load specific version of owner's state
121
- * const versionedState = await ownerStateClient.loadVersioned(5);
122
- *
123
- * // Load owner's state at specific time
124
- * const timeBasedState = await ownerStateClient.loadTimeBased(Date.now());
125
- * ```
126
- */
127
- createLoadOwnerStateAggregateClient(options?: QueryClientOptions): LoadOwnerStateAggregateClient<S>;
128
- /**
129
- * Creates an event stream query client for querying domain event streams.
130
- *
131
- * This method merges the provided options with the factory's default options,
132
- * then creates API metadata and instantiates an EventStreamQueryClient.
133
- *
134
- * @param options - The query client options used to configure the event stream query client
135
- * @returns A new instance of EventStreamQueryClient
136
- *
137
- * @example
138
- * ```typescript
139
- * const eventClient = factory.createEventStreamQueryClient({
140
- * aggregateName: 'cart',
141
- * });
142
- *
143
- * const events = await eventClient.list(listQuery());
144
- * ```
145
- */
146
- createEventStreamQueryClient<EVENT_FIELDS extends string = string>(options?: QueryClientOptions): EventStreamQueryClient<DomainEventBody, EVENT_FIELDS>;
147
- /**
148
- * Creates a client that reads the aggregate's query capability
149
- * descriptors (`{aggregate}/snapshot/schema`, `{aggregate}/event/schema`).
150
- *
151
- * Its base path is `basePath` when one is given, as for the other clients;
152
- * otherwise `{contextAlias}/{aggregateName}` without the
153
- * `resourceAttribution`: the schema routes have no tenant or owner segment.
154
- *
155
- * @param options - Overrides the factory's defaults, as for the other clients
156
- * @returns A new instance of QueryDescriptorClient
157
- *
158
- * @example
159
- * ```typescript
160
- * const descriptors = factory.createQueryDescriptorClient();
161
- * const snapshot = await descriptors.describeSnapshot();
162
- * ```
163
- */
164
- createQueryDescriptorClient(options?: QueryClientOptions): QueryDescriptorClient;
165
- }
@@ -1,45 +0,0 @@
1
- import { EventStreamQueryClient as e } from "./event/eventStreamQueryClient.es.js";
2
- import { SnapshotQueryClient as t } from "./snapshot/snapshotQueryClient.es.js";
3
- import { LoadStateAggregateClient as n } from "./state/loadStateAggregateClient.es.js";
4
- import { LoadOwnerStateAggregateClient as r } from "./state/loadOwnerStateAggregateClient.es.js";
5
- import { QueryDescriptorClient as i } from "./descriptor/queryDescriptorClient.es.js";
6
- import { combineURLs as a } from "@ahoo-wang/fetcher";
7
- //#region src/client/query/factory.ts
8
- function o(e, t, n = !0) {
9
- let { contextAlias: r, resourceAttribution: i, aggregateName: a, ...o } = {
10
- ...e,
11
- ...t
12
- };
13
- return {
14
- ...o,
15
- basePath: t?.basePath ?? e.basePath ?? s(r, n ? i : void 0, a)
16
- };
17
- }
18
- function s(e, t, n) {
19
- let r = a(t ?? "", n ?? "");
20
- return e ? a(e, r) : r;
21
- }
22
- var c = class {
23
- constructor(e) {
24
- this.defaultOptions = e;
25
- }
26
- createSnapshotQueryClient(e) {
27
- return new t(o(this.defaultOptions, e));
28
- }
29
- createLoadStateAggregateClient(e) {
30
- return new n(o(this.defaultOptions, e));
31
- }
32
- createLoadOwnerStateAggregateClient(e) {
33
- return new r(o(this.defaultOptions, e));
34
- }
35
- createEventStreamQueryClient(t) {
36
- return new e(o(this.defaultOptions, t));
37
- }
38
- createQueryDescriptorClient(e) {
39
- return new i(o(this.defaultOptions, e, !1));
40
- }
41
- };
42
- //#endregion
43
- export { c as QueryClientFactory };
44
-
45
- //# sourceMappingURL=factory.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.es.js","names":["queryApiMetadata","apiMetadata","defaults","options","routePath","contextAlias","attributed","resourceAttribution","aggregateName","path","combineURLs","QueryClientFactory","defaultOptions","SnapshotQueryClient","LoadStateAggregateClient","LoadOwnerStateAggregateClient","EventStreamQueryClient","QueryDescriptorClient"],"sources":["../../../src/client/query/factory.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 { PartialBy } from '@ahoo-wang/fetcher';\nimport { combineURLs } from '@ahoo-wang/fetcher';\nimport type { ApiMetadata } from '@ahoo-wang/fetcher-decorator';\nimport type {\n AggregateNameCapable,\n AliasBoundedContext,\n} from '../../model/index.js';\nimport type { ResourceAttributionPathSpec } from '../routing.js';\nimport { SnapshotQueryClient } from './snapshot/index.js';\nimport { EventStreamQueryClient } from './event/index.js';\nimport { LoadStateAggregateClient } from './state/index.js';\nimport { LoadOwnerStateAggregateClient } from './state/index.js';\nimport { QueryDescriptorClient } from './descriptor/index.js';\n\n/**\n * Configuration options for query clients: the client's `ApiMetadata`\n * (`fetcher`, `headers`, `urlParams`, …, with `basePath` optional), plus\n * three keys only {@link QueryClientFactory} reads to build the base path:\n * `contextAlias`, `resourceAttribution` and `aggregateName`.\n *\n * The base path is `basePath` when one is given, and then the three keys\n * are not used. Otherwise it is\n * `{contextAlias}{resourceAttribution}/{aggregateName}`, each part left out\n * when absent. The three keys are not passed on to the client.\n */\nexport interface QueryClientOptions\n extends\n PartialBy<ApiMetadata, 'basePath'>,\n Partial<AliasBoundedContext>,\n Partial<AggregateNameCapable> {\n contextAlias?: string;\n resourceAttribution?: ResourceAttributionPathSpec;\n}\n\n/**\n * The `ApiMetadata` a factory gives a client: `options` over the factory's\n * `defaults`, the base path resolved, and the keys only the factory reads\n * left out. `attributed: false` leaves the resource attribution out of the\n * base path, for routes that have no tenant or owner segment.\n */\nfunction queryApiMetadata(\n defaults: QueryClientOptions,\n options?: QueryClientOptions,\n attributed = true,\n): ApiMetadata {\n const { contextAlias, resourceAttribution, aggregateName, ...apiMetadata } = {\n ...defaults,\n ...options,\n };\n return {\n ...apiMetadata,\n basePath:\n options?.basePath ??\n defaults.basePath ??\n routePath(\n contextAlias,\n attributed ? resourceAttribution : undefined,\n aggregateName,\n ),\n };\n}\n\n/** `{contextAlias}{resourceAttribution}/{aggregateName}`. */\nfunction routePath(\n contextAlias: string | undefined,\n resourceAttribution: ResourceAttributionPathSpec | undefined,\n aggregateName: string | undefined,\n): string {\n const path = combineURLs(resourceAttribution ?? '', aggregateName ?? '');\n return contextAlias ? combineURLs(contextAlias, path) : path;\n}\n\n/**\n * Creates the query clients of one aggregate from shared defaults: its\n * snapshot, event stream, load-state and query descriptor clients. Each `create*` call may\n * override the defaults; see {@link QueryClientOptions} for how the base path\n * is built. Generated code creates one factory per aggregate.\n *\n * @template S - The type of the aggregate state\n * @template FIELDS - The field paths snapshot queries may name\n * @template DomainEventBody - The type of the aggregate's event bodies\n */\nexport class QueryClientFactory<\n S,\n FIELDS extends string = string,\n DomainEventBody = unknown,\n> {\n /**\n * Creates a new QueryClientFactory instance with the specified default options.\n *\n * @param defaultOptions - The default options to be used for all query clients created by this factory\n *\n * @example\n * ```typescript\n * import { QueryClientFactory, ResourceAttributionPathSpec } from '@ahoo-wang/wow-client';\n *\n * const factory = new QueryClientFactory({\n * contextAlias: 'example',\n * aggregateName: 'cart',\n * resourceAttribution: ResourceAttributionPathSpec.OWNER,\n * });\n * ```\n */\n constructor(private readonly defaultOptions: QueryClientOptions) {}\n\n /**\n * Creates a snapshot query client for querying aggregate snapshots.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates a SnapshotQueryClient.\n *\n * @param options - The query client options used to configure the snapshot query client\n * @returns A new instance of SnapshotQueryClient\n *\n * @example\n * ```typescript\n * const snapshotClient = factory.createSnapshotQueryClient({\n * aggregateName: 'cart',\n * });\n *\n * const cartState = await snapshotClient.singleState(singleQuery());\n * ```\n */\n createSnapshotQueryClient(\n options?: QueryClientOptions,\n ): SnapshotQueryClient<S, FIELDS> {\n return new SnapshotQueryClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates a client for loading aggregate state by ID.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates a LoadStateAggregateClient.\n * The client supports loading current state, versioned state, and time-based state.\n *\n * @param options - The query client options used to configure the state aggregate client\n * @returns A new instance of LoadStateAggregateClient\n *\n * @example\n * ```typescript\n * const stateClient = factory.createLoadStateAggregateClient({\n * aggregateName: 'cart',\n * });\n *\n * // Load current state\n * const currentState = await stateClient.load('cart-123');\n *\n * // Load specific version\n * const versionedState = await stateClient.loadVersioned('cart-123', 5);\n *\n * // Load state at specific time\n * const timeBasedState = await stateClient.loadTimeBased('cart-123', Date.now());\n * ```\n */\n createLoadStateAggregateClient(\n options?: QueryClientOptions,\n ): LoadStateAggregateClient<S> {\n return new LoadStateAggregateClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates a client for loading owner-specific aggregate state.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates a LoadOwnerStateAggregateClient.\n * Unlike the standard state client, this client loads state for the current owner\n * without requiring an explicit ID parameter.\n *\n * @param options - The query client options used to configure the owner state aggregate client\n * @returns A new instance of LoadOwnerStateAggregateClient\n *\n * @example\n * ```typescript\n * const ownerStateClient = factory.createLoadOwnerStateAggregateClient({\n * aggregateName: 'cart',\n * resourceAttribution: ResourceAttributionPathSpec.OWNER,\n * });\n *\n * // Load current owner's state\n * const currentState = await ownerStateClient.load();\n *\n * // Load specific version of owner's state\n * const versionedState = await ownerStateClient.loadVersioned(5);\n *\n * // Load owner's state at specific time\n * const timeBasedState = await ownerStateClient.loadTimeBased(Date.now());\n * ```\n */\n createLoadOwnerStateAggregateClient(\n options?: QueryClientOptions,\n ): LoadOwnerStateAggregateClient<S> {\n return new LoadOwnerStateAggregateClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates an event stream query client for querying domain event streams.\n *\n * This method merges the provided options with the factory's default options,\n * then creates API metadata and instantiates an EventStreamQueryClient.\n *\n * @param options - The query client options used to configure the event stream query client\n * @returns A new instance of EventStreamQueryClient\n *\n * @example\n * ```typescript\n * const eventClient = factory.createEventStreamQueryClient({\n * aggregateName: 'cart',\n * });\n *\n * const events = await eventClient.list(listQuery());\n * ```\n */\n createEventStreamQueryClient<EVENT_FIELDS extends string = string>(\n options?: QueryClientOptions,\n ): EventStreamQueryClient<DomainEventBody, EVENT_FIELDS> {\n return new EventStreamQueryClient(\n queryApiMetadata(this.defaultOptions, options),\n );\n }\n\n /**\n * Creates a client that reads the aggregate's query capability\n * descriptors (`{aggregate}/snapshot/schema`, `{aggregate}/event/schema`).\n *\n * Its base path is `basePath` when one is given, as for the other clients;\n * otherwise `{contextAlias}/{aggregateName}` without the\n * `resourceAttribution`: the schema routes have no tenant or owner segment.\n *\n * @param options - Overrides the factory's defaults, as for the other clients\n * @returns A new instance of QueryDescriptorClient\n *\n * @example\n * ```typescript\n * const descriptors = factory.createQueryDescriptorClient();\n * const snapshot = await descriptors.describeSnapshot();\n * ```\n */\n createQueryDescriptorClient(\n options?: QueryClientOptions,\n ): QueryDescriptorClient {\n return new QueryDescriptorClient(\n queryApiMetadata(this.defaultOptions, options, false),\n );\n }\n}\n"],"mappings":";;;;;;;AAqDA,SAASA,EACP,GACA,GACA,IAAa,IACA;CACb,IAAM,EAAE,iBAAc,wBAAqB,kBAAe,GAAGC,MAAgB;EAC3E,GAAGC;EACH,GAAGC;CACL;CACA,OAAO;EACL,GAAGF;EACH,UACEE,GAAS,YACTD,EAAS,YACTE,EACEC,GACAC,IAAaC,IAAsB,KAAA,GACnCC,CACF;CACJ;AACF;AAGA,SAASJ,EACP,GACA,GACA,GACQ;CACR,IAAMK,IAAOC,EAAYH,KAAuB,IAAIC,KAAiB,EAAE;CACvE,OAAOH,IAAeK,EAAYL,GAAcI,CAAI,IAAIA;AAC1D;AAYA,IAAaE,IAAb,MAIE;CAiBA,YAAY,GAAqD;EAApC,KAAA,iBAAAC;CAAqC;CAoBlE,0BACE,GACgC;EAChC,OAAO,IAAIC,EACTb,EAAiB,KAAK,gBAAgBG,CAAO,CAC/C;CACF;CA4BA,+BACE,GAC6B;EAC7B,OAAO,IAAIW,EACTd,EAAiB,KAAK,gBAAgBG,CAAO,CAC/C;CACF;CA8BA,oCACE,GACkC;EAClC,OAAO,IAAIY,EACTf,EAAiB,KAAK,gBAAgBG,CAAO,CAC/C;CACF;CAoBA,6BACE,GACuD;EACvD,OAAO,IAAIa,EACThB,EAAiB,KAAK,gBAAgBG,CAAO,CAC/C;CACF;CAmBA,4BACE,GACuB;EACvB,OAAO,IAAIc,EACTjB,EAAiB,KAAK,gBAAgBG,GAAS,EAAK,CACtD;CACF;AACF"}
@@ -1,7 +0,0 @@
1
- export * from './queryApi.cjs';
2
- export * from './event/index.cjs';
3
- export * from './snapshot/index.cjs';
4
- export * from './state/index.cjs';
5
- export * from './descriptor/index.cjs';
6
- export * from './dataset/index.cjs';
7
- export * from './factory.cjs';