@hotmeshio/hotmesh 0.0.8 → 0.0.10

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 (362) hide show
  1. package/LICENSE +4 -7
  2. package/README.md +82 -85
  3. package/build/{cjs/modules → modules}/key.d.ts +2 -2
  4. package/build/{cjs/modules → modules}/key.js +3 -3
  5. package/build/{esm/package.json → package.json} +4 -11
  6. package/build/{cjs/services → services}/durable/native.js +2 -3
  7. package/build/{esm/services → services}/durable/worker.d.ts +1 -3
  8. package/build/{cjs/services → services}/durable/worker.js +9 -33
  9. package/build/{cjs/services → services}/durable/workflow.js +6 -1
  10. package/build/{cjs/services → services}/hotmesh/index.js +1 -1
  11. package/build/{cjs/services → services}/store/index.js +2 -2
  12. package/build/{cjs/services → services}/stream/clients/ioredis.js +1 -1
  13. package/build/{cjs/services → services}/stream/clients/redis.js +1 -1
  14. package/build/{cjs/services → services}/sub/clients/ioredis.js +1 -1
  15. package/build/{cjs/services → services}/sub/clients/redis.js +1 -1
  16. package/build/{cjs/types → types}/durable.d.ts +5 -7
  17. package/modules/key.ts +2 -2
  18. package/package.json +4 -11
  19. package/services/durable/native.ts +2 -3
  20. package/services/durable/worker.ts +9 -10
  21. package/services/durable/workflow.ts +7 -1
  22. package/services/hotmesh/index.ts +2 -2
  23. package/services/store/index.ts +3 -3
  24. package/services/stream/clients/ioredis.ts +2 -2
  25. package/services/stream/clients/redis.ts +2 -2
  26. package/services/sub/clients/ioredis.ts +2 -2
  27. package/services/sub/clients/redis.ts +2 -2
  28. package/types/durable.ts +5 -5
  29. package/build/cjs/package.json +0 -82
  30. package/build/cjs/services/durable/worker.d.ts +0 -38
  31. package/build/esm/index.d.ts +0 -4
  32. package/build/esm/index.js +0 -3
  33. package/build/esm/modules/errors.d.ts +0 -28
  34. package/build/esm/modules/errors.js +0 -41
  35. package/build/esm/modules/key.d.ts +0 -75
  36. package/build/esm/modules/key.js +0 -111
  37. package/build/esm/modules/utils.d.ts +0 -34
  38. package/build/esm/modules/utils.js +0 -154
  39. package/build/esm/services/activities/activity.d.ts +0 -67
  40. package/build/esm/services/activities/activity.js +0 -486
  41. package/build/esm/services/activities/await.d.ts +0 -16
  42. package/build/esm/services/activities/await.js +0 -140
  43. package/build/esm/services/activities/cycle.d.ts +0 -19
  44. package/build/esm/services/activities/cycle.js +0 -74
  45. package/build/esm/services/activities/emit.d.ts +0 -9
  46. package/build/esm/services/activities/emit.js +0 -10
  47. package/build/esm/services/activities/index.d.ts +0 -17
  48. package/build/esm/services/activities/index.js +0 -16
  49. package/build/esm/services/activities/iterate.d.ts +0 -9
  50. package/build/esm/services/activities/iterate.js +0 -10
  51. package/build/esm/services/activities/trigger.d.ts +0 -22
  52. package/build/esm/services/activities/trigger.js +0 -158
  53. package/build/esm/services/activities/worker.d.ts +0 -11
  54. package/build/esm/services/activities/worker.js +0 -70
  55. package/build/esm/services/collator/index.d.ts +0 -73
  56. package/build/esm/services/collator/index.js +0 -221
  57. package/build/esm/services/compiler/deployer.d.ts +0 -36
  58. package/build/esm/services/compiler/deployer.js +0 -423
  59. package/build/esm/services/compiler/index.d.ts +0 -30
  60. package/build/esm/services/compiler/index.js +0 -82
  61. package/build/esm/services/compiler/validator.d.ts +0 -32
  62. package/build/esm/services/compiler/validator.js +0 -131
  63. package/build/esm/services/connector/clients/ioredis.d.ts +0 -13
  64. package/build/esm/services/connector/clients/ioredis.js +0 -47
  65. package/build/esm/services/connector/clients/redis.d.ts +0 -13
  66. package/build/esm/services/connector/clients/redis.js +0 -59
  67. package/build/esm/services/connector/index.d.ts +0 -5
  68. package/build/esm/services/connector/index.js +0 -27
  69. package/build/esm/services/dimension/index.d.ts +0 -29
  70. package/build/esm/services/dimension/index.js +0 -32
  71. package/build/esm/services/durable/asyncLocalStorage.d.ts +0 -3
  72. package/build/esm/services/durable/asyncLocalStorage.js +0 -2
  73. package/build/esm/services/durable/client.d.ts +0 -15
  74. package/build/esm/services/durable/client.js +0 -114
  75. package/build/esm/services/durable/connection.d.ts +0 -4
  76. package/build/esm/services/durable/connection.js +0 -47
  77. package/build/esm/services/durable/factory.d.ts +0 -3
  78. package/build/esm/services/durable/factory.js +0 -135
  79. package/build/esm/services/durable/handle.d.ts +0 -8
  80. package/build/esm/services/durable/handle.js +0 -34
  81. package/build/esm/services/durable/index.d.ts +0 -57
  82. package/build/esm/services/durable/index.js +0 -55
  83. package/build/esm/services/durable/native.d.ts +0 -4
  84. package/build/esm/services/durable/native.js +0 -43
  85. package/build/esm/services/durable/worker.js +0 -267
  86. package/build/esm/services/durable/workflow.d.ts +0 -6
  87. package/build/esm/services/durable/workflow.js +0 -132
  88. package/build/esm/services/engine/index.d.ts +0 -82
  89. package/build/esm/services/engine/index.js +0 -522
  90. package/build/esm/services/hotmesh/index.d.ts +0 -45
  91. package/build/esm/services/hotmesh/index.js +0 -131
  92. package/build/esm/services/logger/index.d.ts +0 -17
  93. package/build/esm/services/logger/index.js +0 -70
  94. package/build/esm/services/mapper/index.d.ts +0 -24
  95. package/build/esm/services/mapper/index.js +0 -72
  96. package/build/esm/services/pipe/functions/array.d.ts +0 -24
  97. package/build/esm/services/pipe/functions/array.js +0 -66
  98. package/build/esm/services/pipe/functions/bitwise.d.ts +0 -9
  99. package/build/esm/services/pipe/functions/bitwise.js +0 -21
  100. package/build/esm/services/pipe/functions/conditional.d.ts +0 -10
  101. package/build/esm/services/pipe/functions/conditional.js +0 -24
  102. package/build/esm/services/pipe/functions/date.d.ts +0 -57
  103. package/build/esm/services/pipe/functions/date.js +0 -164
  104. package/build/esm/services/pipe/functions/index.d.ts +0 -25
  105. package/build/esm/services/pipe/functions/index.js +0 -24
  106. package/build/esm/services/pipe/functions/json.d.ts +0 -5
  107. package/build/esm/services/pipe/functions/json.js +0 -9
  108. package/build/esm/services/pipe/functions/math.d.ts +0 -38
  109. package/build/esm/services/pipe/functions/math.js +0 -108
  110. package/build/esm/services/pipe/functions/number.d.ts +0 -25
  111. package/build/esm/services/pipe/functions/number.js +0 -130
  112. package/build/esm/services/pipe/functions/object.d.ts +0 -22
  113. package/build/esm/services/pipe/functions/object.js +0 -60
  114. package/build/esm/services/pipe/functions/string.d.ts +0 -23
  115. package/build/esm/services/pipe/functions/string.js +0 -66
  116. package/build/esm/services/pipe/functions/symbol.d.ts +0 -12
  117. package/build/esm/services/pipe/functions/symbol.js +0 -30
  118. package/build/esm/services/pipe/functions/unary.d.ts +0 -7
  119. package/build/esm/services/pipe/functions/unary.js +0 -15
  120. package/build/esm/services/pipe/index.d.ts +0 -30
  121. package/build/esm/services/pipe/index.js +0 -122
  122. package/build/esm/services/quorum/index.d.ts +0 -34
  123. package/build/esm/services/quorum/index.js +0 -144
  124. package/build/esm/services/reporter/index.d.ts +0 -47
  125. package/build/esm/services/reporter/index.js +0 -327
  126. package/build/esm/services/serializer/index.d.ts +0 -41
  127. package/build/esm/services/serializer/index.js +0 -251
  128. package/build/esm/services/signaler/store.d.ts +0 -15
  129. package/build/esm/services/signaler/store.js +0 -50
  130. package/build/esm/services/signaler/stream.d.ts +0 -43
  131. package/build/esm/services/signaler/stream.js +0 -314
  132. package/build/esm/services/store/cache.d.ts +0 -66
  133. package/build/esm/services/store/cache.js +0 -124
  134. package/build/esm/services/store/clients/ioredis.d.ts +0 -27
  135. package/build/esm/services/store/clients/ioredis.js +0 -93
  136. package/build/esm/services/store/clients/redis.d.ts +0 -29
  137. package/build/esm/services/store/clients/redis.js +0 -140
  138. package/build/esm/services/store/index.d.ts +0 -88
  139. package/build/esm/services/store/index.js +0 -623
  140. package/build/esm/services/stream/clients/ioredis.d.ts +0 -23
  141. package/build/esm/services/stream/clients/ioredis.js +0 -112
  142. package/build/esm/services/stream/clients/redis.d.ts +0 -23
  143. package/build/esm/services/stream/clients/redis.js +0 -116
  144. package/build/esm/services/stream/index.d.ts +0 -21
  145. package/build/esm/services/stream/index.js +0 -6
  146. package/build/esm/services/sub/clients/ioredis.d.ts +0 -20
  147. package/build/esm/services/sub/clients/ioredis.js +0 -69
  148. package/build/esm/services/sub/clients/redis.d.ts +0 -20
  149. package/build/esm/services/sub/clients/redis.js +0 -60
  150. package/build/esm/services/sub/index.d.ts +0 -18
  151. package/build/esm/services/sub/index.js +0 -6
  152. package/build/esm/services/task/index.d.ts +0 -18
  153. package/build/esm/services/task/index.js +0 -70
  154. package/build/esm/services/telemetry/index.d.ts +0 -49
  155. package/build/esm/services/telemetry/index.js +0 -217
  156. package/build/esm/services/worker/index.d.ts +0 -30
  157. package/build/esm/services/worker/index.js +0 -102
  158. package/build/esm/types/activity.d.ts +0 -92
  159. package/build/esm/types/activity.js +0 -1
  160. package/build/esm/types/app.d.ts +0 -16
  161. package/build/esm/types/app.js +0 -1
  162. package/build/esm/types/async.d.ts +0 -5
  163. package/build/esm/types/async.js +0 -1
  164. package/build/esm/types/cache.d.ts +0 -1
  165. package/build/esm/types/cache.js +0 -1
  166. package/build/esm/types/collator.d.ts +0 -8
  167. package/build/esm/types/collator.js +0 -8
  168. package/build/esm/types/durable.d.ts +0 -59
  169. package/build/esm/types/durable.js +0 -1
  170. package/build/esm/types/hook.d.ts +0 -31
  171. package/build/esm/types/hook.js +0 -6
  172. package/build/esm/types/hotmesh.d.ts +0 -82
  173. package/build/esm/types/hotmesh.js +0 -1
  174. package/build/esm/types/index.d.ts +0 -20
  175. package/build/esm/types/index.js +0 -5
  176. package/build/esm/types/ioredisclient.d.ts +0 -5
  177. package/build/esm/types/ioredisclient.js +0 -2
  178. package/build/esm/types/job.d.ts +0 -50
  179. package/build/esm/types/job.js +0 -1
  180. package/build/esm/types/logger.d.ts +0 -6
  181. package/build/esm/types/logger.js +0 -1
  182. package/build/esm/types/map.d.ts +0 -4
  183. package/build/esm/types/map.js +0 -1
  184. package/build/esm/types/pipe.d.ts +0 -4
  185. package/build/esm/types/pipe.js +0 -1
  186. package/build/esm/types/quorum.d.ts +0 -46
  187. package/build/esm/types/quorum.js +0 -1
  188. package/build/esm/types/redis.d.ts +0 -8
  189. package/build/esm/types/redis.js +0 -1
  190. package/build/esm/types/redisclient.d.ts +0 -25
  191. package/build/esm/types/redisclient.js +0 -1
  192. package/build/esm/types/serializer.d.ts +0 -33
  193. package/build/esm/types/serializer.js +0 -1
  194. package/build/esm/types/stats.d.ts +0 -83
  195. package/build/esm/types/stats.js +0 -1
  196. package/build/esm/types/stream.d.ts +0 -67
  197. package/build/esm/types/stream.js +0 -22
  198. package/build/esm/types/telemetry.d.ts +0 -1
  199. package/build/esm/types/telemetry.js +0 -1
  200. package/build/esm/types/transition.d.ts +0 -17
  201. package/build/esm/types/transition.js +0 -1
  202. package/tsconfig.cjs.json +0 -8
  203. package/tsconfig.esm.json +0 -9
  204. /package/build/{cjs/index.d.ts → index.d.ts} +0 -0
  205. /package/build/{cjs/index.js → index.js} +0 -0
  206. /package/build/{cjs/modules → modules}/errors.d.ts +0 -0
  207. /package/build/{cjs/modules → modules}/errors.js +0 -0
  208. /package/build/{cjs/modules → modules}/utils.d.ts +0 -0
  209. /package/build/{cjs/modules → modules}/utils.js +0 -0
  210. /package/build/{cjs/services → services}/activities/activity.d.ts +0 -0
  211. /package/build/{cjs/services → services}/activities/activity.js +0 -0
  212. /package/build/{cjs/services → services}/activities/await.d.ts +0 -0
  213. /package/build/{cjs/services → services}/activities/await.js +0 -0
  214. /package/build/{cjs/services → services}/activities/cycle.d.ts +0 -0
  215. /package/build/{cjs/services → services}/activities/cycle.js +0 -0
  216. /package/build/{cjs/services → services}/activities/emit.d.ts +0 -0
  217. /package/build/{cjs/services → services}/activities/emit.js +0 -0
  218. /package/build/{cjs/services → services}/activities/index.d.ts +0 -0
  219. /package/build/{cjs/services → services}/activities/index.js +0 -0
  220. /package/build/{cjs/services → services}/activities/iterate.d.ts +0 -0
  221. /package/build/{cjs/services → services}/activities/iterate.js +0 -0
  222. /package/build/{cjs/services → services}/activities/trigger.d.ts +0 -0
  223. /package/build/{cjs/services → services}/activities/trigger.js +0 -0
  224. /package/build/{cjs/services → services}/activities/worker.d.ts +0 -0
  225. /package/build/{cjs/services → services}/activities/worker.js +0 -0
  226. /package/build/{cjs/services → services}/collator/index.d.ts +0 -0
  227. /package/build/{cjs/services → services}/collator/index.js +0 -0
  228. /package/build/{cjs/services → services}/compiler/deployer.d.ts +0 -0
  229. /package/build/{cjs/services → services}/compiler/deployer.js +0 -0
  230. /package/build/{cjs/services → services}/compiler/index.d.ts +0 -0
  231. /package/build/{cjs/services → services}/compiler/index.js +0 -0
  232. /package/build/{cjs/services → services}/compiler/validator.d.ts +0 -0
  233. /package/build/{cjs/services → services}/compiler/validator.js +0 -0
  234. /package/build/{cjs/services → services}/connector/clients/ioredis.d.ts +0 -0
  235. /package/build/{cjs/services → services}/connector/clients/ioredis.js +0 -0
  236. /package/build/{cjs/services → services}/connector/clients/redis.d.ts +0 -0
  237. /package/build/{cjs/services → services}/connector/clients/redis.js +0 -0
  238. /package/build/{cjs/services → services}/connector/index.d.ts +0 -0
  239. /package/build/{cjs/services → services}/connector/index.js +0 -0
  240. /package/build/{cjs/services → services}/dimension/index.d.ts +0 -0
  241. /package/build/{cjs/services → services}/dimension/index.js +0 -0
  242. /package/build/{cjs/services → services}/durable/asyncLocalStorage.d.ts +0 -0
  243. /package/build/{cjs/services → services}/durable/asyncLocalStorage.js +0 -0
  244. /package/build/{cjs/services → services}/durable/client.d.ts +0 -0
  245. /package/build/{cjs/services → services}/durable/client.js +0 -0
  246. /package/build/{cjs/services → services}/durable/connection.d.ts +0 -0
  247. /package/build/{cjs/services → services}/durable/connection.js +0 -0
  248. /package/build/{cjs/services → services}/durable/factory.d.ts +0 -0
  249. /package/build/{cjs/services → services}/durable/factory.js +0 -0
  250. /package/build/{cjs/services → services}/durable/handle.d.ts +0 -0
  251. /package/build/{cjs/services → services}/durable/handle.js +0 -0
  252. /package/build/{cjs/services → services}/durable/index.d.ts +0 -0
  253. /package/build/{cjs/services → services}/durable/index.js +0 -0
  254. /package/build/{cjs/services → services}/durable/native.d.ts +0 -0
  255. /package/build/{cjs/services → services}/durable/workflow.d.ts +0 -0
  256. /package/build/{cjs/services → services}/engine/index.d.ts +0 -0
  257. /package/build/{cjs/services → services}/engine/index.js +0 -0
  258. /package/build/{cjs/services → services}/hotmesh/index.d.ts +0 -0
  259. /package/build/{cjs/services → services}/logger/index.d.ts +0 -0
  260. /package/build/{cjs/services → services}/logger/index.js +0 -0
  261. /package/build/{cjs/services → services}/mapper/index.d.ts +0 -0
  262. /package/build/{cjs/services → services}/mapper/index.js +0 -0
  263. /package/build/{cjs/services → services}/pipe/functions/array.d.ts +0 -0
  264. /package/build/{cjs/services → services}/pipe/functions/array.js +0 -0
  265. /package/build/{cjs/services → services}/pipe/functions/bitwise.d.ts +0 -0
  266. /package/build/{cjs/services → services}/pipe/functions/bitwise.js +0 -0
  267. /package/build/{cjs/services → services}/pipe/functions/conditional.d.ts +0 -0
  268. /package/build/{cjs/services → services}/pipe/functions/conditional.js +0 -0
  269. /package/build/{cjs/services → services}/pipe/functions/date.d.ts +0 -0
  270. /package/build/{cjs/services → services}/pipe/functions/date.js +0 -0
  271. /package/build/{cjs/services → services}/pipe/functions/index.d.ts +0 -0
  272. /package/build/{cjs/services → services}/pipe/functions/index.js +0 -0
  273. /package/build/{cjs/services → services}/pipe/functions/json.d.ts +0 -0
  274. /package/build/{cjs/services → services}/pipe/functions/json.js +0 -0
  275. /package/build/{cjs/services → services}/pipe/functions/math.d.ts +0 -0
  276. /package/build/{cjs/services → services}/pipe/functions/math.js +0 -0
  277. /package/build/{cjs/services → services}/pipe/functions/number.d.ts +0 -0
  278. /package/build/{cjs/services → services}/pipe/functions/number.js +0 -0
  279. /package/build/{cjs/services → services}/pipe/functions/object.d.ts +0 -0
  280. /package/build/{cjs/services → services}/pipe/functions/object.js +0 -0
  281. /package/build/{cjs/services → services}/pipe/functions/string.d.ts +0 -0
  282. /package/build/{cjs/services → services}/pipe/functions/string.js +0 -0
  283. /package/build/{cjs/services → services}/pipe/functions/symbol.d.ts +0 -0
  284. /package/build/{cjs/services → services}/pipe/functions/symbol.js +0 -0
  285. /package/build/{cjs/services → services}/pipe/functions/unary.d.ts +0 -0
  286. /package/build/{cjs/services → services}/pipe/functions/unary.js +0 -0
  287. /package/build/{cjs/services → services}/pipe/index.d.ts +0 -0
  288. /package/build/{cjs/services → services}/pipe/index.js +0 -0
  289. /package/build/{cjs/services → services}/quorum/index.d.ts +0 -0
  290. /package/build/{cjs/services → services}/quorum/index.js +0 -0
  291. /package/build/{cjs/services → services}/reporter/index.d.ts +0 -0
  292. /package/build/{cjs/services → services}/reporter/index.js +0 -0
  293. /package/build/{cjs/services → services}/serializer/index.d.ts +0 -0
  294. /package/build/{cjs/services → services}/serializer/index.js +0 -0
  295. /package/build/{cjs/services → services}/signaler/store.d.ts +0 -0
  296. /package/build/{cjs/services → services}/signaler/store.js +0 -0
  297. /package/build/{cjs/services → services}/signaler/stream.d.ts +0 -0
  298. /package/build/{cjs/services → services}/signaler/stream.js +0 -0
  299. /package/build/{cjs/services → services}/store/cache.d.ts +0 -0
  300. /package/build/{cjs/services → services}/store/cache.js +0 -0
  301. /package/build/{cjs/services → services}/store/clients/ioredis.d.ts +0 -0
  302. /package/build/{cjs/services → services}/store/clients/ioredis.js +0 -0
  303. /package/build/{cjs/services → services}/store/clients/redis.d.ts +0 -0
  304. /package/build/{cjs/services → services}/store/clients/redis.js +0 -0
  305. /package/build/{cjs/services → services}/store/index.d.ts +0 -0
  306. /package/build/{cjs/services → services}/stream/clients/ioredis.d.ts +0 -0
  307. /package/build/{cjs/services → services}/stream/clients/redis.d.ts +0 -0
  308. /package/build/{cjs/services → services}/stream/index.d.ts +0 -0
  309. /package/build/{cjs/services → services}/stream/index.js +0 -0
  310. /package/build/{cjs/services → services}/sub/clients/ioredis.d.ts +0 -0
  311. /package/build/{cjs/services → services}/sub/clients/redis.d.ts +0 -0
  312. /package/build/{cjs/services → services}/sub/index.d.ts +0 -0
  313. /package/build/{cjs/services → services}/sub/index.js +0 -0
  314. /package/build/{cjs/services → services}/task/index.d.ts +0 -0
  315. /package/build/{cjs/services → services}/task/index.js +0 -0
  316. /package/build/{cjs/services → services}/telemetry/index.d.ts +0 -0
  317. /package/build/{cjs/services → services}/telemetry/index.js +0 -0
  318. /package/build/{cjs/services → services}/worker/index.d.ts +0 -0
  319. /package/build/{cjs/services → services}/worker/index.js +0 -0
  320. /package/build/{cjs/types → types}/activity.d.ts +0 -0
  321. /package/build/{cjs/types → types}/activity.js +0 -0
  322. /package/build/{cjs/types → types}/app.d.ts +0 -0
  323. /package/build/{cjs/types → types}/app.js +0 -0
  324. /package/build/{cjs/types → types}/async.d.ts +0 -0
  325. /package/build/{cjs/types → types}/async.js +0 -0
  326. /package/build/{cjs/types → types}/cache.d.ts +0 -0
  327. /package/build/{cjs/types → types}/cache.js +0 -0
  328. /package/build/{cjs/types → types}/collator.d.ts +0 -0
  329. /package/build/{cjs/types → types}/collator.js +0 -0
  330. /package/build/{cjs/types → types}/durable.js +0 -0
  331. /package/build/{cjs/types → types}/hook.d.ts +0 -0
  332. /package/build/{cjs/types → types}/hook.js +0 -0
  333. /package/build/{cjs/types → types}/hotmesh.d.ts +0 -0
  334. /package/build/{cjs/types → types}/hotmesh.js +0 -0
  335. /package/build/{cjs/types → types}/index.d.ts +0 -0
  336. /package/build/{cjs/types → types}/index.js +0 -0
  337. /package/build/{cjs/types → types}/ioredisclient.d.ts +0 -0
  338. /package/build/{cjs/types → types}/ioredisclient.js +0 -0
  339. /package/build/{cjs/types → types}/job.d.ts +0 -0
  340. /package/build/{cjs/types → types}/job.js +0 -0
  341. /package/build/{cjs/types → types}/logger.d.ts +0 -0
  342. /package/build/{cjs/types → types}/logger.js +0 -0
  343. /package/build/{cjs/types → types}/map.d.ts +0 -0
  344. /package/build/{cjs/types → types}/map.js +0 -0
  345. /package/build/{cjs/types → types}/pipe.d.ts +0 -0
  346. /package/build/{cjs/types → types}/pipe.js +0 -0
  347. /package/build/{cjs/types → types}/quorum.d.ts +0 -0
  348. /package/build/{cjs/types → types}/quorum.js +0 -0
  349. /package/build/{cjs/types → types}/redis.d.ts +0 -0
  350. /package/build/{cjs/types → types}/redis.js +0 -0
  351. /package/build/{cjs/types → types}/redisclient.d.ts +0 -0
  352. /package/build/{cjs/types → types}/redisclient.js +0 -0
  353. /package/build/{cjs/types → types}/serializer.d.ts +0 -0
  354. /package/build/{cjs/types → types}/serializer.js +0 -0
  355. /package/build/{cjs/types → types}/stats.d.ts +0 -0
  356. /package/build/{cjs/types → types}/stats.js +0 -0
  357. /package/build/{cjs/types → types}/stream.d.ts +0 -0
  358. /package/build/{cjs/types → types}/stream.js +0 -0
  359. /package/build/{cjs/types → types}/telemetry.d.ts +0 -0
  360. /package/build/{cjs/types → types}/telemetry.js +0 -0
  361. /package/build/{cjs/types → types}/transition.d.ts +0 -0
  362. /package/build/{cjs/types → types}/transition.js +0 -0
@@ -1,43 +0,0 @@
1
- /// <reference types="node" />
2
- import { ILogger } from '../logger';
3
- import { StoreService } from '../store';
4
- import { StreamService } from '../stream';
5
- import { RedisClient, RedisMulti } from '../../types/redis';
6
- import { ReclaimedMessageType, StreamConfig, StreamData, StreamDataResponse, StreamRole } from '../../types/stream';
7
- declare class StreamSignaler {
8
- static signalers: Set<StreamSignaler>;
9
- appId: string;
10
- guid: string;
11
- role: StreamRole;
12
- topic: string | undefined;
13
- store: StoreService<RedisClient, RedisMulti>;
14
- stream: StreamService<RedisClient, RedisMulti>;
15
- reclaimDelay: number;
16
- reclaimCount: number;
17
- logger: ILogger;
18
- throttle: number;
19
- errorCount: number;
20
- currentTimerId: NodeJS.Timeout | null;
21
- shouldConsume: boolean;
22
- constructor(config: StreamConfig, stream: StreamService<RedisClient, RedisMulti>, store: StoreService<RedisClient, RedisMulti>, logger: ILogger);
23
- createGroup(stream: string, group: string): Promise<void>;
24
- publishMessage(topic: string, streamData: StreamData | StreamDataResponse, multi?: RedisMulti): Promise<string | RedisMulti>;
25
- consumeMessages(stream: string, group: string, consumer: string, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<void>;
26
- isStreamMessage(result: any): boolean;
27
- consumeOne(stream: string, group: string, id: string, message: string[], callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<void>;
28
- execStreamLeg(input: StreamData, stream: string, id: string, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<StreamDataResponse>;
29
- ackAndDelete(stream: string, group: string, id: string): Promise<void>;
30
- publishResponse(input: StreamData, output: StreamDataResponse | void): Promise<string>;
31
- shouldRetry(input: StreamData, output: StreamDataResponse): [boolean, number];
32
- structureUnhandledError(input: StreamData, err: Error): StreamDataResponse;
33
- structureUnacknowledgedError(input: StreamData): StreamDataResponse;
34
- structureError(input: StreamData, output: StreamDataResponse): StreamDataResponse;
35
- static stopConsuming(): Promise<void>;
36
- stopConsuming(): Promise<void>;
37
- cancelThrottle(): void;
38
- setThrottle(delayInMillis: number): void;
39
- claimUnacknowledged(stream: string, group: string, consumer: string, idleTimeMs?: number, limit?: number): Promise<[string, [string, string]][]>;
40
- expireUnacknowledged(reclaimedMessage: ReclaimedMessageType, stream: string, group: string, consumer: string, id: string, count: number): Promise<void>;
41
- parseStreamData(str: string): [undefined, StreamData] | [Error];
42
- }
43
- export { StreamSignaler };
@@ -1,314 +0,0 @@
1
- import { KeyType } from '../../modules/key';
2
- import { XSleepFor, sleepFor } from '../../modules/utils';
3
- import { TelemetryService } from '../telemetry';
4
- import { StreamDataType, StreamRole, StreamStatus } from '../../types/stream';
5
- const MAX_RETRIES = 4; //max delay (10s using exponential backoff);
6
- const MAX_TIMEOUT_MS = 60000;
7
- const GRADUATED_INTERVAL_MS = 5000;
8
- const BLOCK_DURATION = 15000; //Set to `15` so SIGINT/SIGTERM can interrupt; set to `0` to BLOCK indefinitely
9
- const TEST_BLOCK_DURATION = 1000; //Set to `1000` so tests can interrupt quickly
10
- const BLOCK_TIME_MS = process.env.NODE_ENV === 'test' ? TEST_BLOCK_DURATION : BLOCK_DURATION;
11
- const SYSTEM_STATUS_CODE = 999;
12
- const UNKNOWN_STATUS_CODE = 500;
13
- const UNKNOWN_STATUS_MESSAGE = 'unknown';
14
- const XCLAIM_DELAY_MS = 1000 * 60; //max time a message can be unacked before it is claimed by another
15
- const XCLAIM_COUNT = 3; //max number of times a message can be claimed by another before it is dead-lettered
16
- const XPENDING_COUNT = 10;
17
- class StreamSignaler {
18
- constructor(config, stream, store, logger) {
19
- this.throttle = 0;
20
- this.errorCount = 0;
21
- this.currentTimerId = null;
22
- this.appId = config.appId;
23
- this.guid = config.guid;
24
- this.role = config.role;
25
- this.topic = config.topic;
26
- this.stream = stream;
27
- this.store = store;
28
- this.reclaimDelay = config.reclaimDelay || XCLAIM_DELAY_MS;
29
- this.reclaimCount = config.reclaimCount || XCLAIM_COUNT;
30
- this.logger = logger;
31
- }
32
- async createGroup(stream, group) {
33
- try {
34
- await this.store.xgroup('CREATE', stream, group, '$', 'MKSTREAM');
35
- }
36
- catch (err) {
37
- this.logger.info('consumer-group-exists', { stream, group });
38
- }
39
- }
40
- async publishMessage(topic, streamData, multi) {
41
- const stream = this.store.mintKey(KeyType.STREAMS, { appId: this.store.appId, topic });
42
- return await this.store.xadd(stream, '*', 'message', JSON.stringify(streamData), multi);
43
- }
44
- async consumeMessages(stream, group, consumer, callback) {
45
- this.logger.info(`stream-consumer-starting`, { group, consumer, stream });
46
- StreamSignaler.signalers.add(this);
47
- this.shouldConsume = true;
48
- await this.createGroup(stream, group);
49
- let lastCheckedPendingMessagesAt = Date.now();
50
- async function consume() {
51
- let sleep = XSleepFor(this.throttle);
52
- this.currentTimerId = sleep.timerId;
53
- await sleep.promise;
54
- if (!this.shouldConsume) {
55
- this.logger.info(`stream-consumer-stopping`, { group, consumer, stream });
56
- return;
57
- }
58
- try {
59
- const result = await this.stream.xreadgroup('GROUP', group, consumer, 'BLOCK', BLOCK_TIME_MS, 'STREAMS', stream, '>');
60
- if (this.isStreamMessage(result)) {
61
- const [[, messages]] = result;
62
- for (const [id, message] of messages) {
63
- await this.consumeOne(stream, group, id, message, callback);
64
- }
65
- }
66
- // Check for pending messages (note: Redis 6.2 simplifies)
67
- const now = Date.now();
68
- if (now - lastCheckedPendingMessagesAt > this.reclaimDelay) {
69
- lastCheckedPendingMessagesAt = now;
70
- const pendingMessages = await this.claimUnacknowledged(stream, group, consumer);
71
- for (const [id, message] of pendingMessages) {
72
- await this.consumeOne(stream, group, id, message, callback);
73
- }
74
- }
75
- setImmediate(consume.bind(this));
76
- }
77
- catch (err) {
78
- if (this.shouldConsume && process.env.NODE_ENV !== 'test') {
79
- this.logger.error(`stream-consume-message-error`, { err, stream, group, consumer });
80
- this.errorCount++;
81
- const timeout = Math.min(GRADUATED_INTERVAL_MS * (2 ** this.errorCount), MAX_TIMEOUT_MS);
82
- setTimeout(consume.bind(this), timeout);
83
- }
84
- }
85
- }
86
- consume.call(this);
87
- }
88
- isStreamMessage(result) {
89
- return Array.isArray(result) && Array.isArray(result[0]);
90
- }
91
- async consumeOne(stream, group, id, message, callback) {
92
- this.logger.debug(`stream-consume-one`, { group, stream, id });
93
- const [err, input] = this.parseStreamData(message[1]);
94
- let output;
95
- let telemetry;
96
- try {
97
- telemetry = new TelemetryService(this.appId);
98
- telemetry.startStreamSpan(input, this.role);
99
- output = await this.execStreamLeg(input, stream, id, callback.bind(this));
100
- if (output?.status === StreamStatus.ERROR) {
101
- telemetry.setStreamError(`Function Status Code ${output.code || UNKNOWN_STATUS_CODE}`);
102
- }
103
- this.errorCount = 0;
104
- }
105
- catch (err) {
106
- this.logger.error(`stream-consume-one-error`, { group, stream, id, err });
107
- telemetry.setStreamError(err.message);
108
- }
109
- const messageId = await this.publishResponse(input, output);
110
- telemetry.setStreamAttributes({ 'app.worker.mid': messageId });
111
- await this.ackAndDelete(stream, group, id);
112
- telemetry.endStreamSpan();
113
- this.logger.debug(`stream-consume-one-end`, { group, stream, id });
114
- }
115
- async execStreamLeg(input, stream, id, callback) {
116
- let output;
117
- try {
118
- output = await callback(input);
119
- }
120
- catch (err) {
121
- this.logger.error(`stream-call-function-error`, { stream, id, err });
122
- output = this.structureUnhandledError(input, err);
123
- }
124
- return output;
125
- }
126
- async ackAndDelete(stream, group, id) {
127
- const multi = this.stream.getMulti();
128
- await this.stream.xack(stream, group, id, multi);
129
- await this.stream.xdel(stream, id, multi);
130
- await multi.exec();
131
- }
132
- async publishResponse(input, output) {
133
- if (output && typeof output === 'object') {
134
- if (output.status === 'error') {
135
- const [shouldRetry, timeout] = this.shouldRetry(input, output);
136
- if (shouldRetry) {
137
- await sleepFor(timeout);
138
- return await this.publishMessage(input.metadata.topic, {
139
- data: input.data,
140
- metadata: { ...input.metadata, try: (input.metadata.try || 0) + 1 },
141
- policies: input.policies,
142
- });
143
- }
144
- else {
145
- output = this.structureError(input, output);
146
- }
147
- }
148
- output.type = StreamDataType.RESPONSE;
149
- return await this.publishMessage(null, output);
150
- }
151
- }
152
- shouldRetry(input, output) {
153
- const policies = input.policies?.retry;
154
- const errorCode = output.code.toString();
155
- const policy = policies?.[errorCode];
156
- const maxRetries = policy?.[0];
157
- const tryCount = Math.min(input.metadata.try || 0, MAX_RETRIES);
158
- if (maxRetries >= tryCount) {
159
- return [true, Math.pow(10, tryCount)];
160
- }
161
- return [false, 0];
162
- }
163
- structureUnhandledError(input, err) {
164
- let error = {};
165
- if (typeof err.message === 'string') {
166
- error.message = err.message;
167
- }
168
- else {
169
- error.message = UNKNOWN_STATUS_MESSAGE;
170
- }
171
- if (typeof err.stack === 'string') {
172
- error.stack = err.stack;
173
- }
174
- if (typeof err.name === 'string') {
175
- error.name = err.name;
176
- }
177
- return {
178
- status: 'error',
179
- code: UNKNOWN_STATUS_CODE,
180
- metadata: { ...input.metadata },
181
- data: error
182
- };
183
- }
184
- structureUnacknowledgedError(input) {
185
- const message = 'stream message max delivery count exceeded';
186
- const code = SYSTEM_STATUS_CODE;
187
- const data = { message, code };
188
- const output = {
189
- metadata: { ...input.metadata },
190
- status: StreamStatus.ERROR,
191
- code,
192
- data,
193
- };
194
- //send unacknowleded errors to the engine (it has no topic)
195
- delete output.metadata.topic;
196
- return output;
197
- }
198
- structureError(input, output) {
199
- const message = output.data?.message ? output.data?.message.toString() : UNKNOWN_STATUS_MESSAGE;
200
- const statusCode = output.code || output.data?.code;
201
- const code = isNaN(statusCode) ? UNKNOWN_STATUS_CODE : parseInt(statusCode.toString());
202
- const data = { message, code };
203
- if (typeof output.data?.error === 'object') {
204
- data.error = { ...output.data.error };
205
- }
206
- return {
207
- status: StreamStatus.ERROR,
208
- code,
209
- metadata: { ...input.metadata },
210
- data
211
- };
212
- }
213
- static async stopConsuming() {
214
- for (const instance of [...StreamSignaler.signalers]) {
215
- instance.stopConsuming();
216
- }
217
- await sleepFor(BLOCK_TIME_MS);
218
- }
219
- async stopConsuming() {
220
- this.shouldConsume = false;
221
- this.logger.info(`stream-consumer-stopping`, this.topic ? { topic: this.topic } : undefined);
222
- this.cancelThrottle();
223
- await sleepFor(BLOCK_TIME_MS);
224
- }
225
- cancelThrottle() {
226
- if (this.currentTimerId !== undefined) {
227
- clearTimeout(this.currentTimerId);
228
- this.currentTimerId = undefined;
229
- }
230
- }
231
- setThrottle(delayInMillis) {
232
- if (!Number.isInteger(delayInMillis) || delayInMillis < 0) {
233
- throw new Error('Throttle must be a non-negative integer');
234
- }
235
- this.throttle = delayInMillis;
236
- this.logger.info(`stream-throttle-reset`, { delay: this.throttle, topic: this.topic });
237
- }
238
- async claimUnacknowledged(stream, group, consumer, idleTimeMs = this.reclaimDelay, limit = XPENDING_COUNT) {
239
- let pendingMessages = [];
240
- const pendingMessagesInfo = await this.stream.xpending(stream, group, '-', '+', limit); //[[ '1688768134881-0', 'testConsumer1', 1017, 1 ]]
241
- for (const pendingMessageInfo of pendingMessagesInfo) {
242
- if (Array.isArray(pendingMessageInfo)) {
243
- const [id, , elapsedTimeMs, deliveryCount] = pendingMessageInfo;
244
- if (elapsedTimeMs > idleTimeMs) {
245
- const reclaimedMessage = await this.stream.xclaim(stream, group, consumer, idleTimeMs, id);
246
- if (reclaimedMessage.length) {
247
- if (deliveryCount <= this.reclaimCount) {
248
- pendingMessages = pendingMessages.concat(reclaimedMessage);
249
- }
250
- else {
251
- await this.expireUnacknowledged(reclaimedMessage, stream, group, consumer, id, deliveryCount);
252
- }
253
- }
254
- }
255
- }
256
- }
257
- return pendingMessages;
258
- }
259
- async expireUnacknowledged(reclaimedMessage, stream, group, consumer, id, count) {
260
- //The stream activity was not processed within established limits. Possibilities Include:
261
- // 1) user error: the workers were not properly configured and are timing out
262
- // 2a) system error: JSON is corrupt
263
- // i) bad/unwitting actor
264
- // ii) corrupt hardware/network/transport/etc
265
- // 3b) system error: Redis unable to accept `xadd` request
266
- // 4c) system error: Redis unable to accept `xdel`/`xack` request
267
- this.logger.error('stream-message-max-delivery-count-exceeded', { id, stream, group, consumer, code: SYSTEM_STATUS_CODE, count });
268
- const streamData = reclaimedMessage[0]?.[1]?.[1];
269
- //fatal risk point 1 of 3): json is corrupt
270
- const [err, input] = this.parseStreamData(streamData);
271
- if (err) {
272
- return this.logger.error('expire-unacknowledged-parse-fatal-error', { id, err });
273
- }
274
- else if (!input || !input.metadata) {
275
- return this.logger.error('expire-unacknowledged-parse-fatal-error', { id });
276
- }
277
- let telemetry;
278
- let messageId;
279
- try {
280
- telemetry = new TelemetryService(this.appId);
281
- telemetry.startStreamSpan(input, StreamRole.SYSTEM);
282
- telemetry.setStreamError(`Stream Message Max Delivery Count Exceeded`);
283
- //fatal risk point 2 of 3): unable to publish error message (to notify the parent job)
284
- const output = this.structureUnacknowledgedError(input);
285
- messageId = await this.publishResponse(input, output);
286
- telemetry.setStreamAttributes({ 'app.worker.mid': messageId });
287
- //fatal risk point 3 of 3): unable to ack and delete stream message
288
- await this.ackAndDelete(stream, group, id);
289
- }
290
- catch (err) {
291
- if (messageId) {
292
- this.logger.error('expire-unacknowledged-pub-fatal-error', { id, err, ...input.metadata });
293
- telemetry.setStreamAttributes({ 'app.system.fatal': 'expire-unacknowledged-pub-fatal-error' });
294
- }
295
- else {
296
- this.logger.error('expire-unacknowledged-ack-fatal-error', { id, err, ...input.metadata });
297
- telemetry.setStreamAttributes({ 'app.system.fatal': 'expire-unacknowledged-ack-fatal-error' });
298
- }
299
- }
300
- finally {
301
- telemetry.endStreamSpan();
302
- }
303
- }
304
- parseStreamData(str) {
305
- try {
306
- return [, JSON.parse(str)];
307
- }
308
- catch (e) {
309
- return [e];
310
- }
311
- }
312
- }
313
- StreamSignaler.signalers = new Set();
314
- export { StreamSignaler };
@@ -1,66 +0,0 @@
1
- /**
2
- * The Cache is a key/value store and used to store commonly accessed Redis metadata
3
- * (mainly the execution rules for the app) to save time accessing them as they
4
- * are immutable per verison. The only time the rules are ejected are when
5
- * a new version is deployed to the quorum and the cache is invalidated/cleared.
6
- */
7
- import { ActivityType } from "../../types/activity";
8
- import { HookRule } from "../../types/hook";
9
- import { HotMeshApp, HotMeshSettings } from "../../types/hotmesh";
10
- import { Symbols } from "../../types/serializer";
11
- import { Transitions } from "../../types/transition";
12
- declare class Cache {
13
- settings: HotMeshSettings;
14
- appId: string;
15
- apps: Record<string, HotMeshApp>;
16
- schemas: Record<string, ActivityType>;
17
- subscriptions: Record<string, Record<string, string>>;
18
- symbols: Record<string, Symbols>;
19
- symvals: Record<string, Symbols>;
20
- transitions: Record<string, Record<string, unknown>>;
21
- hookRules: Record<string, Record<string, HookRule[]>>;
22
- workItems: Record<string, string>;
23
- /**
24
- * The cache is ALWAYS initialized with HotMeshSettings. The other parameters are optional.
25
- * @param settings
26
- * @param apps
27
- * @param schemas
28
- * @param subscriptions
29
- * @param transitions
30
- * @param hookRules
31
- */
32
- constructor(appId: string, settings: HotMeshSettings, apps?: Record<string, HotMeshApp>, schemas?: Record<string, ActivityType>, subscriptions?: Record<string, Record<string, string>>, symbols?: Record<string, Symbols>, symvals?: Record<string, Symbols>, transitions?: Record<string, Record<string, unknown>>, hookRules?: Record<string, Record<string, HookRule[]>>, workItems?: Record<string, string>);
33
- /**
34
- * invalidate the cache; settings are not invalidated!
35
- */
36
- invalidate(): void;
37
- getSettings(): HotMeshSettings;
38
- setSettings(settings: HotMeshSettings): void;
39
- getApps(): Record<string, HotMeshApp>;
40
- getApp(appId: string): HotMeshApp;
41
- setApps(apps: Record<string, HotMeshApp>): void;
42
- setApp(appId: string, app: HotMeshApp): void;
43
- getSchemas(appId: string, version: string): Record<string, ActivityType>;
44
- getSchema(appId: string, version: string, activityId: string): ActivityType;
45
- setSchemas(appId: string, version: string, schemas: Record<string, ActivityType>): void;
46
- setSchema(appId: string, version: string, activityId: string, schema: ActivityType): void;
47
- getSubscriptions(appId: string, version: string): Record<string, string>;
48
- getSubscription(appId: string, version: string, topic: string): unknown;
49
- setSubscriptions(appId: string, version: string, subscriptions: Record<string, string>): void;
50
- getSymbols(appId: string, targetEntityId: string): Symbols;
51
- setSymbols(appId: string, targetEntityId: string, symbols: Symbols): void;
52
- deleteSymbols(appId: string, targetEntityId: string): void;
53
- getSymbolValues(appId: string): Symbols;
54
- setSymbolValues(appId: string, symvals: Symbols): void;
55
- deleteSymbolValues(appId: string): void;
56
- getTransitions(appId: string, version: string): Transitions;
57
- setTransitions(appId: string, version: string, transitions: Transitions): void;
58
- getHookRules(appId: string): Record<string, HookRule[]>;
59
- setHookRules(appId: string, hookRules: Record<string, HookRule[]>): void;
60
- getSignals(appId: string, version: string): Record<string, unknown>;
61
- setSignals(appId: string, version: string): Record<string, unknown>;
62
- getActiveTaskQueue(appId: string): string;
63
- setWorkItem(appId: string, workItem: string): void;
64
- removeWorkItem(appId: string): void;
65
- }
66
- export { Cache };
@@ -1,124 +0,0 @@
1
- /**
2
- * The Cache is a key/value store and used to store commonly accessed Redis metadata
3
- * (mainly the execution rules for the app) to save time accessing them as they
4
- * are immutable per verison. The only time the rules are ejected are when
5
- * a new version is deployed to the quorum and the cache is invalidated/cleared.
6
- */
7
- class Cache {
8
- /**
9
- * The cache is ALWAYS initialized with HotMeshSettings. The other parameters are optional.
10
- * @param settings
11
- * @param apps
12
- * @param schemas
13
- * @param subscriptions
14
- * @param transitions
15
- * @param hookRules
16
- */
17
- constructor(appId, settings, apps = {}, schemas = {}, subscriptions = {}, symbols = {}, symvals = {}, transitions = {}, hookRules = {}, workItems = {}) {
18
- this.appId = appId;
19
- this.settings = settings;
20
- this.apps = apps;
21
- this.schemas = schemas;
22
- this.subscriptions = subscriptions;
23
- this.symbols = symbols;
24
- this.symvals = symvals;
25
- this.transitions = transitions;
26
- this.hookRules = hookRules;
27
- this.workItems = workItems;
28
- }
29
- /**
30
- * invalidate the cache; settings are not invalidated!
31
- */
32
- invalidate() {
33
- this.apps = {};
34
- this.schemas = {};
35
- this.subscriptions = {};
36
- this.transitions = {};
37
- this.hookRules = {};
38
- }
39
- getSettings() {
40
- return this.settings;
41
- }
42
- setSettings(settings) {
43
- this.settings = settings;
44
- }
45
- getApps() {
46
- return this.apps;
47
- }
48
- getApp(appId) {
49
- return this.apps[appId];
50
- }
51
- setApps(apps) {
52
- this.apps = apps;
53
- }
54
- setApp(appId, app) {
55
- this.apps[appId] = app;
56
- }
57
- getSchemas(appId, version) {
58
- return this.schemas[`${appId}/${version}`];
59
- }
60
- getSchema(appId, version, activityId) {
61
- return this.schemas?.[`${appId}/${version}`]?.[activityId];
62
- }
63
- setSchemas(appId, version, schemas) {
64
- this.schemas[`${appId}/${version}`] = schemas;
65
- }
66
- setSchema(appId, version, activityId, schema) {
67
- this.schemas[`${appId}/${version}`][activityId] = schema;
68
- }
69
- getSubscriptions(appId, version) {
70
- return this.subscriptions[`${appId}/${version}`];
71
- }
72
- getSubscription(appId, version, topic) {
73
- return this.subscriptions?.[`${appId}/${version}`]?.[topic];
74
- }
75
- setSubscriptions(appId, version, subscriptions) {
76
- this.subscriptions[`${appId}/${version}`] = subscriptions;
77
- }
78
- getSymbols(appId, targetEntityId) {
79
- return this.symbols[`${appId}/${targetEntityId}`];
80
- }
81
- setSymbols(appId, targetEntityId, symbols) {
82
- this.symbols[`${appId}/${targetEntityId}`] = symbols;
83
- }
84
- deleteSymbols(appId, targetEntityId) {
85
- delete this.symbols[`${appId}/${targetEntityId}`];
86
- }
87
- getSymbolValues(appId) {
88
- return this.symvals[`${appId}`];
89
- }
90
- setSymbolValues(appId, symvals) {
91
- this.symvals[`${appId}`] = symvals;
92
- }
93
- deleteSymbolValues(appId) {
94
- delete this.symvals[`${appId}`];
95
- }
96
- getTransitions(appId, version) {
97
- return this.transitions[`${appId}/${version}`];
98
- }
99
- setTransitions(appId, version, transitions) {
100
- this.transitions[`${appId}/${version}`] = transitions;
101
- }
102
- getHookRules(appId) {
103
- return this.hookRules[`${appId}`];
104
- }
105
- setHookRules(appId, hookRules) {
106
- this.hookRules[`${appId}`] = hookRules;
107
- }
108
- getSignals(appId, version) {
109
- throw new Error("SIGNAL (getHooks) is not supported");
110
- }
111
- setSignals(appId, version) {
112
- throw new Error("SIGNAL (setHook) is not supported");
113
- }
114
- getActiveTaskQueue(appId) {
115
- return this.workItems[appId];
116
- }
117
- setWorkItem(appId, workItem) {
118
- this.workItems[appId] = workItem;
119
- }
120
- removeWorkItem(appId) {
121
- delete this.workItems[appId];
122
- }
123
- }
124
- export { Cache };
@@ -1,27 +0,0 @@
1
- import { KeyType } from '../../../modules/key';
2
- import { ILogger } from '../../logger';
3
- import { SerializerService as Serializer } from '../../serializer';
4
- import { Cache } from '../cache';
5
- import { StoreService } from '../index';
6
- import { RedisClientType, RedisMultiType } from '../../../types/ioredisclient';
7
- import { ReclaimedMessageType } from '../../../types/stream';
8
- declare class IORedisStoreService extends StoreService<RedisClientType, RedisMultiType> {
9
- redisClient: RedisClientType;
10
- cache: Cache;
11
- namespace: string;
12
- appId: string;
13
- logger: ILogger;
14
- serializer: Serializer;
15
- constructor(redisClient: RedisClientType);
16
- getMulti(): RedisMultiType;
17
- hGetAllResult(result: any): any;
18
- addTaskQueues(keys: string[]): Promise<void>;
19
- publish(keyType: KeyType.QUORUM, message: Record<string, any>, appId: string, engineId?: string): Promise<boolean>;
20
- xgroup(command: 'CREATE', key: string, groupName: string, id: string, mkStream?: 'MKSTREAM'): Promise<boolean>;
21
- xadd(key: string, id: string, messageId: string, messageValue: string, multi?: RedisMultiType): Promise<string | RedisMultiType>;
22
- xpending(key: string, group: string, start?: string, end?: string, count?: number, consumer?: string): Promise<[string, string, number, [string, number][]][] | [string, string, number, number] | unknown[]>;
23
- xclaim(key: string, group: string, consumer: string, minIdleTime: number, id: string, ...args: string[]): Promise<ReclaimedMessageType>;
24
- xack(key: string, group: string, id: string, multi?: RedisMultiType): Promise<number | RedisMultiType>;
25
- xdel(key: string, id: string, multi?: RedisMultiType): Promise<number | RedisMultiType>;
26
- }
27
- export { IORedisStoreService };
@@ -1,93 +0,0 @@
1
- import { KeyType } from '../../../modules/key';
2
- import { StoreService } from '../index';
3
- class IORedisStoreService extends StoreService {
4
- constructor(redisClient) {
5
- super(redisClient);
6
- }
7
- getMulti() {
8
- return this.redisClient.multi();
9
- }
10
- hGetAllResult(result) {
11
- //ioredis response signature is [null, {}] or [null, null]
12
- return result[1];
13
- }
14
- async addTaskQueues(keys) {
15
- const multi = this.redisClient.multi();
16
- const zsetKey = this.mintKey(KeyType.WORK_ITEMS, { appId: this.appId });
17
- for (const key of keys) {
18
- multi.zadd(zsetKey, 'NX', Date.now(), key);
19
- }
20
- await multi.exec();
21
- }
22
- async publish(keyType, message, appId, engineId) {
23
- const topic = this.mintKey(keyType, { appId, engineId });
24
- const status = await this.redisClient.publish(topic, JSON.stringify(message));
25
- return status === 1;
26
- }
27
- async xgroup(command, key, groupName, id, mkStream) {
28
- if (mkStream === 'MKSTREAM') {
29
- try {
30
- return (await this.redisClient.xgroup(command, key, groupName, id, mkStream)) === 'OK';
31
- }
32
- catch (err) {
33
- this.logger.info(`Consumer group not created with MKSTREAM for key: ${key} and group: ${groupName}`);
34
- throw err;
35
- }
36
- }
37
- else {
38
- try {
39
- return (await this.redisClient.xgroup(command, key, groupName, id)) === 'OK';
40
- }
41
- catch (err) {
42
- this.logger.info(`Consumer group not created for key: ${key} and group: ${groupName}`);
43
- throw err;
44
- }
45
- }
46
- }
47
- async xadd(key, id, messageId, messageValue, multi) {
48
- try {
49
- return await (multi || this.redisClient).xadd(key, id, messageId, messageValue);
50
- }
51
- catch (err) {
52
- this.logger.error(`Error publishing 'xadd'; key: ${key}`, err);
53
- throw err;
54
- }
55
- }
56
- async xpending(key, group, start, end, count, consumer) {
57
- try {
58
- return await this.redisClient.xpending(key, group, start, end, count, consumer);
59
- }
60
- catch (err) {
61
- this.logger.error(`Error in retrieving pending messages for [stream ${key}], [group ${group}]`, err);
62
- throw err;
63
- }
64
- }
65
- async xclaim(key, group, consumer, minIdleTime, id, ...args) {
66
- try {
67
- return await this.redisClient.xclaim(key, group, consumer, minIdleTime, id, ...args);
68
- }
69
- catch (err) {
70
- this.logger.error(`Error in claiming message with id: ${id} in group: ${group} for key: ${key}`, err);
71
- throw err;
72
- }
73
- }
74
- async xack(key, group, id, multi) {
75
- try {
76
- return await (multi || this.redisClient).xack(key, group, id);
77
- }
78
- catch (err) {
79
- this.logger.error(`Error in acknowledging messages in group: ${group} for key: ${key}`, err);
80
- throw err;
81
- }
82
- }
83
- async xdel(key, id, multi) {
84
- try {
85
- return await (multi || this.redisClient).xdel(key, id);
86
- }
87
- catch (err) {
88
- this.logger.error(`Error in deleting messages with id: ${id} for key: ${key}`, err);
89
- throw err;
90
- }
91
- }
92
- }
93
- export { IORedisStoreService };