@hotmeshio/hotmesh 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/README.md +2 -2
  2. package/build/{package.json → cjs/package.json} +12 -5
  3. package/build/{services → cjs/services}/activities/trigger.js +2 -2
  4. package/build/{services → cjs/services}/connector/index.js +3 -3
  5. package/build/{services → cjs/services}/durable/client.js +2 -2
  6. package/build/{services → cjs/services}/durable/connection.js +2 -2
  7. package/build/{services → cjs/services}/hotmesh/index.js +2 -2
  8. package/build/{services → cjs/services}/mapper/index.d.ts +3 -3
  9. package/build/{services → cjs/services}/store/index.js +1 -1
  10. package/build/esm/index.d.ts +4 -0
  11. package/build/esm/index.js +3 -0
  12. package/build/esm/modules/errors.d.ts +28 -0
  13. package/build/esm/modules/errors.js +41 -0
  14. package/build/esm/modules/key.d.ts +75 -0
  15. package/build/esm/modules/key.js +111 -0
  16. package/build/esm/modules/utils.d.ts +34 -0
  17. package/build/esm/modules/utils.js +154 -0
  18. package/build/esm/package.json +80 -0
  19. package/build/esm/services/activities/activity.d.ts +61 -0
  20. package/build/esm/services/activities/activity.js +411 -0
  21. package/build/esm/services/activities/await.d.ts +16 -0
  22. package/build/esm/services/activities/await.js +140 -0
  23. package/build/esm/services/activities/emit.d.ts +9 -0
  24. package/build/esm/services/activities/emit.js +10 -0
  25. package/build/esm/services/activities/index.d.ts +15 -0
  26. package/build/esm/services/activities/index.js +14 -0
  27. package/build/esm/services/activities/iterate.d.ts +9 -0
  28. package/build/esm/services/activities/iterate.js +10 -0
  29. package/build/esm/services/activities/trigger.d.ts +22 -0
  30. package/build/esm/services/activities/trigger.js +158 -0
  31. package/build/esm/services/activities/worker.d.ts +17 -0
  32. package/build/esm/services/activities/worker.js +162 -0
  33. package/build/esm/services/collator/index.d.ts +56 -0
  34. package/build/esm/services/collator/index.js +191 -0
  35. package/build/esm/services/compiler/deployer.d.ts +36 -0
  36. package/build/esm/services/compiler/deployer.js +423 -0
  37. package/build/esm/services/compiler/index.d.ts +30 -0
  38. package/build/esm/services/compiler/index.js +82 -0
  39. package/build/esm/services/compiler/validator.d.ts +32 -0
  40. package/build/esm/services/compiler/validator.js +131 -0
  41. package/build/esm/services/connector/clients/ioredis.d.ts +13 -0
  42. package/build/esm/services/connector/clients/ioredis.js +47 -0
  43. package/build/esm/services/connector/clients/redis.d.ts +13 -0
  44. package/build/esm/services/connector/clients/redis.js +59 -0
  45. package/build/esm/services/connector/index.d.ts +5 -0
  46. package/build/esm/services/connector/index.js +27 -0
  47. package/build/esm/services/dimension/index.d.ts +29 -0
  48. package/build/esm/services/dimension/index.js +32 -0
  49. package/build/esm/services/durable/asyncLocalStorage.d.ts +3 -0
  50. package/build/esm/services/durable/asyncLocalStorage.js +2 -0
  51. package/build/esm/services/durable/client.d.ts +15 -0
  52. package/build/esm/services/durable/client.js +114 -0
  53. package/build/esm/services/durable/connection.d.ts +4 -0
  54. package/build/esm/services/durable/connection.js +47 -0
  55. package/build/esm/services/durable/factory.d.ts +3 -0
  56. package/build/esm/services/durable/factory.js +119 -0
  57. package/build/esm/services/durable/handle.d.ts +8 -0
  58. package/build/esm/services/durable/handle.js +34 -0
  59. package/build/esm/services/durable/index.d.ts +57 -0
  60. package/build/esm/services/durable/index.js +55 -0
  61. package/build/esm/services/durable/native.d.ts +4 -0
  62. package/build/esm/services/durable/native.js +43 -0
  63. package/build/esm/services/durable/worker.d.ts +36 -0
  64. package/build/esm/services/durable/worker.js +258 -0
  65. package/build/esm/services/durable/workflow.d.ts +6 -0
  66. package/build/esm/services/durable/workflow.js +128 -0
  67. package/build/esm/services/engine/index.d.ts +82 -0
  68. package/build/esm/services/engine/index.js +522 -0
  69. package/build/esm/services/hotmesh/index.d.ts +45 -0
  70. package/build/esm/services/hotmesh/index.js +131 -0
  71. package/build/esm/services/logger/index.d.ts +17 -0
  72. package/build/esm/services/logger/index.js +70 -0
  73. package/build/esm/services/mapper/index.d.ts +24 -0
  74. package/build/esm/services/mapper/index.js +69 -0
  75. package/build/esm/services/pipe/functions/array.d.ts +24 -0
  76. package/build/esm/services/pipe/functions/array.js +66 -0
  77. package/build/esm/services/pipe/functions/bitwise.d.ts +9 -0
  78. package/build/esm/services/pipe/functions/bitwise.js +21 -0
  79. package/build/esm/services/pipe/functions/conditional.d.ts +10 -0
  80. package/build/esm/services/pipe/functions/conditional.js +24 -0
  81. package/build/esm/services/pipe/functions/date.d.ts +57 -0
  82. package/build/esm/services/pipe/functions/date.js +164 -0
  83. package/build/esm/services/pipe/functions/index.d.ts +25 -0
  84. package/build/esm/services/pipe/functions/index.js +24 -0
  85. package/build/esm/services/pipe/functions/json.d.ts +5 -0
  86. package/build/esm/services/pipe/functions/json.js +9 -0
  87. package/build/esm/services/pipe/functions/math.d.ts +38 -0
  88. package/build/esm/services/pipe/functions/math.js +108 -0
  89. package/build/esm/services/pipe/functions/number.d.ts +25 -0
  90. package/build/esm/services/pipe/functions/number.js +130 -0
  91. package/build/esm/services/pipe/functions/object.d.ts +22 -0
  92. package/build/esm/services/pipe/functions/object.js +60 -0
  93. package/build/esm/services/pipe/functions/string.d.ts +23 -0
  94. package/build/esm/services/pipe/functions/string.js +66 -0
  95. package/build/esm/services/pipe/functions/symbol.d.ts +12 -0
  96. package/build/esm/services/pipe/functions/symbol.js +30 -0
  97. package/build/esm/services/pipe/functions/unary.d.ts +7 -0
  98. package/build/esm/services/pipe/functions/unary.js +15 -0
  99. package/build/esm/services/pipe/index.d.ts +30 -0
  100. package/build/esm/services/pipe/index.js +122 -0
  101. package/build/esm/services/quorum/index.d.ts +34 -0
  102. package/build/esm/services/quorum/index.js +144 -0
  103. package/build/esm/services/reporter/index.d.ts +47 -0
  104. package/build/esm/services/reporter/index.js +327 -0
  105. package/build/esm/services/serializer/index.d.ts +41 -0
  106. package/build/esm/services/serializer/index.js +251 -0
  107. package/build/esm/services/signaler/store.d.ts +15 -0
  108. package/build/esm/services/signaler/store.js +50 -0
  109. package/build/esm/services/signaler/stream.d.ts +43 -0
  110. package/build/esm/services/signaler/stream.js +315 -0
  111. package/build/esm/services/store/cache.d.ts +66 -0
  112. package/build/esm/services/store/cache.js +124 -0
  113. package/build/esm/services/store/clients/ioredis.d.ts +27 -0
  114. package/build/esm/services/store/clients/ioredis.js +93 -0
  115. package/build/esm/services/store/clients/redis.d.ts +29 -0
  116. package/build/esm/services/store/clients/redis.js +140 -0
  117. package/build/esm/services/store/index.d.ts +88 -0
  118. package/build/esm/services/store/index.js +623 -0
  119. package/build/esm/services/stream/clients/ioredis.d.ts +23 -0
  120. package/build/esm/services/stream/clients/ioredis.js +112 -0
  121. package/build/esm/services/stream/clients/redis.d.ts +23 -0
  122. package/build/esm/services/stream/clients/redis.js +116 -0
  123. package/build/esm/services/stream/index.d.ts +21 -0
  124. package/build/esm/services/stream/index.js +6 -0
  125. package/build/esm/services/sub/clients/ioredis.d.ts +20 -0
  126. package/build/esm/services/sub/clients/ioredis.js +69 -0
  127. package/build/esm/services/sub/clients/redis.d.ts +20 -0
  128. package/build/esm/services/sub/clients/redis.js +60 -0
  129. package/build/esm/services/sub/index.d.ts +18 -0
  130. package/build/esm/services/sub/index.js +6 -0
  131. package/build/esm/services/task/index.d.ts +18 -0
  132. package/build/esm/services/task/index.js +70 -0
  133. package/build/esm/services/telemetry/index.d.ts +49 -0
  134. package/build/esm/services/telemetry/index.js +217 -0
  135. package/build/esm/services/worker/index.d.ts +30 -0
  136. package/build/esm/services/worker/index.js +102 -0
  137. package/build/esm/types/activity.d.ts +87 -0
  138. package/build/esm/types/activity.js +1 -0
  139. package/build/esm/types/app.d.ts +16 -0
  140. package/build/esm/types/app.js +1 -0
  141. package/build/esm/types/async.d.ts +5 -0
  142. package/build/esm/types/async.js +1 -0
  143. package/build/esm/types/cache.d.ts +1 -0
  144. package/build/esm/types/cache.js +1 -0
  145. package/build/esm/types/collator.d.ts +8 -0
  146. package/build/esm/types/collator.js +8 -0
  147. package/build/esm/types/durable.d.ts +59 -0
  148. package/build/esm/types/durable.js +1 -0
  149. package/build/esm/types/hook.d.ts +31 -0
  150. package/build/esm/types/hook.js +6 -0
  151. package/build/esm/types/hotmesh.d.ts +82 -0
  152. package/build/esm/types/hotmesh.js +1 -0
  153. package/build/esm/types/index.d.ts +20 -0
  154. package/build/esm/types/index.js +5 -0
  155. package/build/esm/types/ioredisclient.d.ts +5 -0
  156. package/build/esm/types/ioredisclient.js +2 -0
  157. package/build/esm/types/job.d.ts +50 -0
  158. package/build/esm/types/job.js +1 -0
  159. package/build/esm/types/logger.d.ts +6 -0
  160. package/build/esm/types/logger.js +1 -0
  161. package/build/esm/types/map.d.ts +4 -0
  162. package/build/esm/types/map.js +1 -0
  163. package/build/esm/types/pipe.d.ts +4 -0
  164. package/build/esm/types/pipe.js +1 -0
  165. package/build/esm/types/quorum.d.ts +46 -0
  166. package/build/esm/types/quorum.js +1 -0
  167. package/build/esm/types/redis.d.ts +8 -0
  168. package/build/esm/types/redis.js +1 -0
  169. package/build/esm/types/redisclient.d.ts +25 -0
  170. package/build/esm/types/redisclient.js +1 -0
  171. package/build/esm/types/serializer.d.ts +33 -0
  172. package/build/esm/types/serializer.js +1 -0
  173. package/build/esm/types/stats.d.ts +83 -0
  174. package/build/esm/types/stats.js +1 -0
  175. package/build/esm/types/stream.d.ts +67 -0
  176. package/build/esm/types/stream.js +22 -0
  177. package/build/esm/types/telemetry.d.ts +1 -0
  178. package/build/esm/types/telemetry.js +1 -0
  179. package/build/esm/types/transition.d.ts +17 -0
  180. package/build/esm/types/transition.js +1 -0
  181. package/package.json +12 -5
  182. package/services/activities/trigger.ts +2 -2
  183. package/services/connector/index.ts +3 -3
  184. package/services/durable/client.ts +2 -2
  185. package/services/durable/connection.ts +2 -2
  186. package/services/hotmesh/index.ts +2 -2
  187. package/services/mapper/index.ts +6 -7
  188. package/services/store/index.ts +3 -3
  189. package/tsconfig.cjs.json +8 -0
  190. package/tsconfig.esm.json +9 -0
  191. /package/build/{index.d.ts → cjs/index.d.ts} +0 -0
  192. /package/build/{index.js → cjs/index.js} +0 -0
  193. /package/build/{modules → cjs/modules}/errors.d.ts +0 -0
  194. /package/build/{modules → cjs/modules}/errors.js +0 -0
  195. /package/build/{modules → cjs/modules}/key.d.ts +0 -0
  196. /package/build/{modules → cjs/modules}/key.js +0 -0
  197. /package/build/{modules → cjs/modules}/utils.d.ts +0 -0
  198. /package/build/{modules → cjs/modules}/utils.js +0 -0
  199. /package/build/{services → cjs/services}/activities/activity.d.ts +0 -0
  200. /package/build/{services → cjs/services}/activities/activity.js +0 -0
  201. /package/build/{services → cjs/services}/activities/await.d.ts +0 -0
  202. /package/build/{services → cjs/services}/activities/await.js +0 -0
  203. /package/build/{services → cjs/services}/activities/emit.d.ts +0 -0
  204. /package/build/{services → cjs/services}/activities/emit.js +0 -0
  205. /package/build/{services → cjs/services}/activities/index.d.ts +0 -0
  206. /package/build/{services → cjs/services}/activities/index.js +0 -0
  207. /package/build/{services → cjs/services}/activities/iterate.d.ts +0 -0
  208. /package/build/{services → cjs/services}/activities/iterate.js +0 -0
  209. /package/build/{services → cjs/services}/activities/trigger.d.ts +0 -0
  210. /package/build/{services → cjs/services}/activities/worker.d.ts +0 -0
  211. /package/build/{services → cjs/services}/activities/worker.js +0 -0
  212. /package/build/{services → cjs/services}/collator/index.d.ts +0 -0
  213. /package/build/{services → cjs/services}/collator/index.js +0 -0
  214. /package/build/{services → cjs/services}/compiler/deployer.d.ts +0 -0
  215. /package/build/{services → cjs/services}/compiler/deployer.js +0 -0
  216. /package/build/{services → cjs/services}/compiler/index.d.ts +0 -0
  217. /package/build/{services → cjs/services}/compiler/index.js +0 -0
  218. /package/build/{services → cjs/services}/compiler/validator.d.ts +0 -0
  219. /package/build/{services → cjs/services}/compiler/validator.js +0 -0
  220. /package/build/{services → cjs/services}/connector/clients/ioredis.d.ts +0 -0
  221. /package/build/{services → cjs/services}/connector/clients/ioredis.js +0 -0
  222. /package/build/{services → cjs/services}/connector/clients/redis.d.ts +0 -0
  223. /package/build/{services → cjs/services}/connector/clients/redis.js +0 -0
  224. /package/build/{services → cjs/services}/connector/index.d.ts +0 -0
  225. /package/build/{services → cjs/services}/dimension/index.d.ts +0 -0
  226. /package/build/{services → cjs/services}/dimension/index.js +0 -0
  227. /package/build/{services → cjs/services}/durable/asyncLocalStorage.d.ts +0 -0
  228. /package/build/{services → cjs/services}/durable/asyncLocalStorage.js +0 -0
  229. /package/build/{services → cjs/services}/durable/client.d.ts +0 -0
  230. /package/build/{services → cjs/services}/durable/connection.d.ts +0 -0
  231. /package/build/{services → cjs/services}/durable/factory.d.ts +0 -0
  232. /package/build/{services → cjs/services}/durable/factory.js +0 -0
  233. /package/build/{services → cjs/services}/durable/handle.d.ts +0 -0
  234. /package/build/{services → cjs/services}/durable/handle.js +0 -0
  235. /package/build/{services → cjs/services}/durable/index.d.ts +0 -0
  236. /package/build/{services → cjs/services}/durable/index.js +0 -0
  237. /package/build/{services → cjs/services}/durable/native.d.ts +0 -0
  238. /package/build/{services → cjs/services}/durable/native.js +0 -0
  239. /package/build/{services → cjs/services}/durable/worker.d.ts +0 -0
  240. /package/build/{services → cjs/services}/durable/worker.js +0 -0
  241. /package/build/{services → cjs/services}/durable/workflow.d.ts +0 -0
  242. /package/build/{services → cjs/services}/durable/workflow.js +0 -0
  243. /package/build/{services → cjs/services}/engine/index.d.ts +0 -0
  244. /package/build/{services → cjs/services}/engine/index.js +0 -0
  245. /package/build/{services → cjs/services}/hotmesh/index.d.ts +0 -0
  246. /package/build/{services → cjs/services}/logger/index.d.ts +0 -0
  247. /package/build/{services → cjs/services}/logger/index.js +0 -0
  248. /package/build/{services → cjs/services}/mapper/index.js +0 -0
  249. /package/build/{services → cjs/services}/pipe/functions/array.d.ts +0 -0
  250. /package/build/{services → cjs/services}/pipe/functions/array.js +0 -0
  251. /package/build/{services → cjs/services}/pipe/functions/bitwise.d.ts +0 -0
  252. /package/build/{services → cjs/services}/pipe/functions/bitwise.js +0 -0
  253. /package/build/{services → cjs/services}/pipe/functions/conditional.d.ts +0 -0
  254. /package/build/{services → cjs/services}/pipe/functions/conditional.js +0 -0
  255. /package/build/{services → cjs/services}/pipe/functions/date.d.ts +0 -0
  256. /package/build/{services → cjs/services}/pipe/functions/date.js +0 -0
  257. /package/build/{services → cjs/services}/pipe/functions/index.d.ts +0 -0
  258. /package/build/{services → cjs/services}/pipe/functions/index.js +0 -0
  259. /package/build/{services → cjs/services}/pipe/functions/json.d.ts +0 -0
  260. /package/build/{services → cjs/services}/pipe/functions/json.js +0 -0
  261. /package/build/{services → cjs/services}/pipe/functions/math.d.ts +0 -0
  262. /package/build/{services → cjs/services}/pipe/functions/math.js +0 -0
  263. /package/build/{services → cjs/services}/pipe/functions/number.d.ts +0 -0
  264. /package/build/{services → cjs/services}/pipe/functions/number.js +0 -0
  265. /package/build/{services → cjs/services}/pipe/functions/object.d.ts +0 -0
  266. /package/build/{services → cjs/services}/pipe/functions/object.js +0 -0
  267. /package/build/{services → cjs/services}/pipe/functions/string.d.ts +0 -0
  268. /package/build/{services → cjs/services}/pipe/functions/string.js +0 -0
  269. /package/build/{services → cjs/services}/pipe/functions/symbol.d.ts +0 -0
  270. /package/build/{services → cjs/services}/pipe/functions/symbol.js +0 -0
  271. /package/build/{services → cjs/services}/pipe/functions/unary.d.ts +0 -0
  272. /package/build/{services → cjs/services}/pipe/functions/unary.js +0 -0
  273. /package/build/{services → cjs/services}/pipe/index.d.ts +0 -0
  274. /package/build/{services → cjs/services}/pipe/index.js +0 -0
  275. /package/build/{services → cjs/services}/quorum/index.d.ts +0 -0
  276. /package/build/{services → cjs/services}/quorum/index.js +0 -0
  277. /package/build/{services → cjs/services}/reporter/index.d.ts +0 -0
  278. /package/build/{services → cjs/services}/reporter/index.js +0 -0
  279. /package/build/{services → cjs/services}/serializer/index.d.ts +0 -0
  280. /package/build/{services → cjs/services}/serializer/index.js +0 -0
  281. /package/build/{services → cjs/services}/signaler/store.d.ts +0 -0
  282. /package/build/{services → cjs/services}/signaler/store.js +0 -0
  283. /package/build/{services → cjs/services}/signaler/stream.d.ts +0 -0
  284. /package/build/{services → cjs/services}/signaler/stream.js +0 -0
  285. /package/build/{services → cjs/services}/store/cache.d.ts +0 -0
  286. /package/build/{services → cjs/services}/store/cache.js +0 -0
  287. /package/build/{services → cjs/services}/store/clients/ioredis.d.ts +0 -0
  288. /package/build/{services → cjs/services}/store/clients/ioredis.js +0 -0
  289. /package/build/{services → cjs/services}/store/clients/redis.d.ts +0 -0
  290. /package/build/{services → cjs/services}/store/clients/redis.js +0 -0
  291. /package/build/{services → cjs/services}/store/index.d.ts +0 -0
  292. /package/build/{services → cjs/services}/stream/clients/ioredis.d.ts +0 -0
  293. /package/build/{services → cjs/services}/stream/clients/ioredis.js +0 -0
  294. /package/build/{services → cjs/services}/stream/clients/redis.d.ts +0 -0
  295. /package/build/{services → cjs/services}/stream/clients/redis.js +0 -0
  296. /package/build/{services → cjs/services}/stream/index.d.ts +0 -0
  297. /package/build/{services → cjs/services}/stream/index.js +0 -0
  298. /package/build/{services → cjs/services}/sub/clients/ioredis.d.ts +0 -0
  299. /package/build/{services → cjs/services}/sub/clients/ioredis.js +0 -0
  300. /package/build/{services → cjs/services}/sub/clients/redis.d.ts +0 -0
  301. /package/build/{services → cjs/services}/sub/clients/redis.js +0 -0
  302. /package/build/{services → cjs/services}/sub/index.d.ts +0 -0
  303. /package/build/{services → cjs/services}/sub/index.js +0 -0
  304. /package/build/{services → cjs/services}/task/index.d.ts +0 -0
  305. /package/build/{services → cjs/services}/task/index.js +0 -0
  306. /package/build/{services → cjs/services}/telemetry/index.d.ts +0 -0
  307. /package/build/{services → cjs/services}/telemetry/index.js +0 -0
  308. /package/build/{services → cjs/services}/worker/index.d.ts +0 -0
  309. /package/build/{services → cjs/services}/worker/index.js +0 -0
  310. /package/build/{types → cjs/types}/activity.d.ts +0 -0
  311. /package/build/{types → cjs/types}/activity.js +0 -0
  312. /package/build/{types → cjs/types}/app.d.ts +0 -0
  313. /package/build/{types → cjs/types}/app.js +0 -0
  314. /package/build/{types → cjs/types}/async.d.ts +0 -0
  315. /package/build/{types → cjs/types}/async.js +0 -0
  316. /package/build/{types → cjs/types}/cache.d.ts +0 -0
  317. /package/build/{types → cjs/types}/cache.js +0 -0
  318. /package/build/{types → cjs/types}/collator.d.ts +0 -0
  319. /package/build/{types → cjs/types}/collator.js +0 -0
  320. /package/build/{types → cjs/types}/durable.d.ts +0 -0
  321. /package/build/{types → cjs/types}/durable.js +0 -0
  322. /package/build/{types → cjs/types}/hook.d.ts +0 -0
  323. /package/build/{types → cjs/types}/hook.js +0 -0
  324. /package/build/{types → cjs/types}/hotmesh.d.ts +0 -0
  325. /package/build/{types → cjs/types}/hotmesh.js +0 -0
  326. /package/build/{types → cjs/types}/index.d.ts +0 -0
  327. /package/build/{types → cjs/types}/index.js +0 -0
  328. /package/build/{types → cjs/types}/ioredisclient.d.ts +0 -0
  329. /package/build/{types → cjs/types}/ioredisclient.js +0 -0
  330. /package/build/{types → cjs/types}/job.d.ts +0 -0
  331. /package/build/{types → cjs/types}/job.js +0 -0
  332. /package/build/{types → cjs/types}/logger.d.ts +0 -0
  333. /package/build/{types → cjs/types}/logger.js +0 -0
  334. /package/build/{types → cjs/types}/map.d.ts +0 -0
  335. /package/build/{types → cjs/types}/map.js +0 -0
  336. /package/build/{types → cjs/types}/pipe.d.ts +0 -0
  337. /package/build/{types → cjs/types}/pipe.js +0 -0
  338. /package/build/{types → cjs/types}/quorum.d.ts +0 -0
  339. /package/build/{types → cjs/types}/quorum.js +0 -0
  340. /package/build/{types → cjs/types}/redis.d.ts +0 -0
  341. /package/build/{types → cjs/types}/redis.js +0 -0
  342. /package/build/{types → cjs/types}/redisclient.d.ts +0 -0
  343. /package/build/{types → cjs/types}/redisclient.js +0 -0
  344. /package/build/{types → cjs/types}/serializer.d.ts +0 -0
  345. /package/build/{types → cjs/types}/serializer.js +0 -0
  346. /package/build/{types → cjs/types}/stats.d.ts +0 -0
  347. /package/build/{types → cjs/types}/stats.js +0 -0
  348. /package/build/{types → cjs/types}/stream.d.ts +0 -0
  349. /package/build/{types → cjs/types}/stream.js +0 -0
  350. /package/build/{types → cjs/types}/telemetry.d.ts +0 -0
  351. /package/build/{types → cjs/types}/telemetry.js +0 -0
  352. /package/build/{types → cjs/types}/transition.d.ts +0 -0
  353. /package/build/{types → cjs/types}/transition.js +0 -0
@@ -0,0 +1,119 @@
1
+ const getWorkflowYAML = (topic, version = '1') => {
2
+ return `app:
3
+ id: ${topic}
4
+ version: '${version}'
5
+ graphs:
6
+ - subscribes: ${topic}
7
+ publishes: ${topic}
8
+ expire: 120
9
+ input:
10
+ schema:
11
+ type: object
12
+ properties:
13
+ workflowId:
14
+ type: string
15
+ arguments:
16
+ type: array
17
+ output:
18
+ schema:
19
+ type: object
20
+ properties:
21
+ response:
22
+ type: any
23
+
24
+ activities:
25
+ t1:
26
+ type: trigger
27
+ stats:
28
+ id: '{$self.input.data.workflowId}'
29
+ a1:
30
+ type: worker
31
+ topic: ${topic}
32
+ input:
33
+ schema:
34
+ type: object
35
+ properties:
36
+ workflowId:
37
+ type: string
38
+ arguments:
39
+ type: array
40
+ maps:
41
+ workflowId: '{t1.output.data.workflowId}'
42
+ arguments: '{t1.output.data.arguments}'
43
+ output:
44
+ schema:
45
+ type: object
46
+ properties:
47
+ response:
48
+ type: any
49
+ job:
50
+ maps:
51
+ response: '{$self.output.data.response}'
52
+ transitions:
53
+ t1:
54
+ - to: a1`;
55
+ };
56
+ const getActivityYAML = (topic, version = '1') => {
57
+ return `app:
58
+ id: ${topic}
59
+ version: '${version}'
60
+ graphs:
61
+ - subscribes: ${topic}
62
+ input:
63
+ schema:
64
+ type: object
65
+ properties:
66
+ workflowId:
67
+ type: string
68
+ workflowTopic:
69
+ type: string
70
+ activityName:
71
+ type: array
72
+ arguments:
73
+ type: array
74
+ output:
75
+ schema:
76
+ type: object
77
+ properties:
78
+ response:
79
+ type: any
80
+
81
+ activities:
82
+ t1:
83
+ type: trigger
84
+ stats:
85
+ id: '{$self.input.data.workflowId}'
86
+ a1:
87
+ type: worker
88
+ topic: ${topic}
89
+ input:
90
+ schema:
91
+ type: object
92
+ properties:
93
+ workflowId:
94
+ type: string
95
+ workflowTopic:
96
+ type: string
97
+ activityName:
98
+ type: array
99
+ arguments:
100
+ type: array
101
+ maps:
102
+ workflowId: '{t1.output.data.workflowId}'
103
+ workflowTopic: '{t1.output.data.workflowTopic}'
104
+ activityName: '{t1.output.data.activityName}'
105
+ arguments: '{t1.output.data.arguments}'
106
+ output:
107
+ schema:
108
+ type: object
109
+ properties:
110
+ response:
111
+ type: any
112
+ job:
113
+ maps:
114
+ response: '{$self.output.data.response}'
115
+ transitions:
116
+ t1:
117
+ - to: a1`;
118
+ };
119
+ export { getActivityYAML, getWorkflowYAML };
@@ -0,0 +1,8 @@
1
+ import { HotMeshService as HotMesh } from '../hotmesh';
2
+ export declare class WorkflowHandleService {
3
+ hotMesh: HotMesh;
4
+ workflowTopic: string;
5
+ workflowId: string;
6
+ constructor(hotMesh: HotMesh, workflowTopic: string, workflowId: string);
7
+ result(): Promise<any>;
8
+ }
@@ -0,0 +1,34 @@
1
+ export class WorkflowHandleService {
2
+ constructor(hotMesh, workflowTopic, workflowId) {
3
+ this.workflowTopic = workflowTopic;
4
+ this.workflowId = workflowId;
5
+ this.hotMesh = hotMesh;
6
+ }
7
+ async result() {
8
+ let status = await this.hotMesh.getStatus(this.workflowId);
9
+ const topic = `${this.workflowTopic}.${this.workflowId}`;
10
+ if (status == 0) {
11
+ return (await this.hotMesh.getState(this.workflowTopic, this.workflowId)).data?.response;
12
+ }
13
+ return new Promise((resolve, reject) => {
14
+ let isResolved = false;
15
+ //common fulfill/unsubscribe
16
+ const complete = async (response) => {
17
+ if (isResolved)
18
+ return;
19
+ isResolved = true;
20
+ this.hotMesh.unsub(topic);
21
+ resolve(response || (await this.hotMesh.getState(this.workflowTopic, this.workflowId)).data?.response);
22
+ };
23
+ this.hotMesh.sub(topic, async (topic, message) => {
24
+ await complete(message.data?.response);
25
+ });
26
+ setTimeout(async () => {
27
+ status = await this.hotMesh.getStatus(this.workflowId);
28
+ if (status == 0) {
29
+ await complete();
30
+ }
31
+ }, 0);
32
+ });
33
+ }
34
+ }
@@ -0,0 +1,57 @@
1
+ import { ClientService } from './client';
2
+ import { ConnectionService } from './connection';
3
+ import { NativeConnectionService } from './native';
4
+ import { WorkerService } from './worker';
5
+ import { WorkflowService } from './workflow';
6
+ import { ContextType } from '../../types/durable';
7
+ /**
8
+ * As a durable integration platform, HotMesh
9
+ * can model and emulate other durable systems
10
+ * (like Temporal). As you review the code in
11
+ * this file, note the following:
12
+ *
13
+ * 1) There is no central governing server.
14
+ * HotMesh is a client-side SDK that connects to Redis
15
+ * using CQRS principles to implicitly drive
16
+ * orchestrations using a headless quorum. Stream
17
+ * semantics guarantee that all events are
18
+ * processed by the quorum of connected clients.
19
+ *
20
+ * 2) Every developer-defined `workflow` function
21
+ * is assigned a HotMesh workflow (which runs in
22
+ * the background) to support it.
23
+ *
24
+ * If the HotMesh workflow is not yet defined,
25
+ * it will be deployed and activated on-the-fly.
26
+ * (The generated DAG will have one Trigger Activity
27
+ * and one Worker Activity.) The Worker Activity
28
+ * is configured to catch execution errors and
29
+ * return them, using a 'pending' status to
30
+ * indicate that the workflow is still running.
31
+ * It is possible for workflow activities to throw
32
+ * errors that will force the entire workflow to
33
+ * fail. This is not the case here. The workflow will
34
+ * continue to run until it is completed or cancelled.
35
+ *
36
+ * 2) Every developer-defined `activity` function
37
+ * is assigned a HotMesh workflow (which runs in
38
+ * the background) to support it.
39
+ *
40
+ * (The generated DAG will have one Trigger Activity and one
41
+ * Worker Activity.) The JOB ID for Worker Activity executions
42
+ * is derived from the containing JOB ID,
43
+ * allowing Activity state to be 'replayed' when the workflow
44
+ * is run again. The Activity Function Runner (activity proxy)
45
+ * is configured similar to how the workflow worker is and will
46
+ * catch execution errors and return them to the caller, using a
47
+ * 'pending' status to indicate that the activity is still running.
48
+ * This allows the activity to be retried until it succeeds.
49
+ */
50
+ export declare const Durable: {
51
+ Client: typeof ClientService;
52
+ Connection: typeof ConnectionService;
53
+ NativeConnection: typeof NativeConnectionService;
54
+ Worker: typeof WorkerService;
55
+ workflow: typeof WorkflowService;
56
+ };
57
+ export type { ContextType };
@@ -0,0 +1,55 @@
1
+ import { ClientService } from './client';
2
+ import { ConnectionService } from './connection';
3
+ import { NativeConnectionService } from './native';
4
+ import { WorkerService } from './worker';
5
+ import { WorkflowService } from './workflow';
6
+ /**
7
+ * As a durable integration platform, HotMesh
8
+ * can model and emulate other durable systems
9
+ * (like Temporal). As you review the code in
10
+ * this file, note the following:
11
+ *
12
+ * 1) There is no central governing server.
13
+ * HotMesh is a client-side SDK that connects to Redis
14
+ * using CQRS principles to implicitly drive
15
+ * orchestrations using a headless quorum. Stream
16
+ * semantics guarantee that all events are
17
+ * processed by the quorum of connected clients.
18
+ *
19
+ * 2) Every developer-defined `workflow` function
20
+ * is assigned a HotMesh workflow (which runs in
21
+ * the background) to support it.
22
+ *
23
+ * If the HotMesh workflow is not yet defined,
24
+ * it will be deployed and activated on-the-fly.
25
+ * (The generated DAG will have one Trigger Activity
26
+ * and one Worker Activity.) The Worker Activity
27
+ * is configured to catch execution errors and
28
+ * return them, using a 'pending' status to
29
+ * indicate that the workflow is still running.
30
+ * It is possible for workflow activities to throw
31
+ * errors that will force the entire workflow to
32
+ * fail. This is not the case here. The workflow will
33
+ * continue to run until it is completed or cancelled.
34
+ *
35
+ * 2) Every developer-defined `activity` function
36
+ * is assigned a HotMesh workflow (which runs in
37
+ * the background) to support it.
38
+ *
39
+ * (The generated DAG will have one Trigger Activity and one
40
+ * Worker Activity.) The JOB ID for Worker Activity executions
41
+ * is derived from the containing JOB ID,
42
+ * allowing Activity state to be 'replayed' when the workflow
43
+ * is run again. The Activity Function Runner (activity proxy)
44
+ * is configured similar to how the workflow worker is and will
45
+ * catch execution errors and return them to the caller, using a
46
+ * 'pending' status to indicate that the activity is still running.
47
+ * This allows the activity to be retried until it succeeds.
48
+ */
49
+ export const Durable = {
50
+ Client: ClientService,
51
+ Connection: ConnectionService,
52
+ NativeConnection: NativeConnectionService,
53
+ Worker: WorkerService,
54
+ workflow: WorkflowService,
55
+ };
@@ -0,0 +1,4 @@
1
+ import { Connection, ConnectionConfig } from "../../types/durable";
2
+ export declare class NativeConnectionService {
3
+ static connect(config: ConnectionConfig): Promise<Connection>;
4
+ }
@@ -0,0 +1,43 @@
1
+ /*
2
+
3
+ Here is an example of how the methods in this file are used:
4
+
5
+ ./worker.ts
6
+
7
+ import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
8
+ import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
9
+
10
+ import * as activities from './activities';
11
+
12
+ async function run() {
13
+ const connection = await NativeConnection.connect({
14
+ class: Redis,
15
+ options: {
16
+ host: 'localhost',
17
+ port: 6379,
18
+ },
19
+ });
20
+ const worker = await Worker.create({
21
+ connection,
22
+ namespace: 'default',
23
+ taskQueue: 'hello-world',
24
+ workflowsPath: require.resolve('./workflows'),
25
+ activities,
26
+ });
27
+ await worker.run();
28
+ }
29
+
30
+ run().catch((err) => {
31
+ console.error(err);
32
+ process.exit(1);
33
+ });
34
+
35
+ */
36
+ export class NativeConnectionService {
37
+ static async connect(config) {
38
+ return {
39
+ class: config.class,
40
+ options: { ...config.options },
41
+ };
42
+ }
43
+ }
@@ -0,0 +1,36 @@
1
+ import { HotMeshService as HotMesh } from '../hotmesh';
2
+ import { Connection, Registry, WorkerConfig } from "../../types/durable";
3
+ export declare class WorkerService {
4
+ static activityRegistry: Registry;
5
+ static connection: Connection;
6
+ static instances: Map<string, HotMesh | Promise<HotMesh>>;
7
+ workflowRunner: HotMesh;
8
+ static getHotMesh: (worflowTopic: string) => Promise<HotMesh>;
9
+ static activateWorkflow(hotMesh: HotMesh, topic: string, factory: Function): Promise<void>;
10
+ /**
11
+ * The `worker` calls `registerActivities` immediately BEFORE
12
+ * dynamically importing the user's workflow module. That file
13
+ * contains a call, `proxyActivities`, which needs this info.
14
+ *
15
+ * NOTE: The `worker` and `client` both call `proxyActivities`,
16
+ * as a natural result of importing worflows.ts. However,
17
+ * because the worker imports the workflows dynamically AFTER
18
+ * the activities are loaded, there will be items in the registry,
19
+ * allowing proxyActivities to succeed.
20
+ */
21
+ static registerActivities<ACT>(activities: ACT): Registry;
22
+ static create(config: WorkerConfig): Promise<WorkerService>;
23
+ run(): Promise<void>;
24
+ initActivityWorkflow(config: WorkerConfig, activityTopic: string): Promise<HotMesh>;
25
+ wrapActivityFunctions(): Function;
26
+ activateActivityWorkflow(hotMesh: HotMesh, activityTopic: string): Promise<void>;
27
+ initWorkerWorkflow(config: WorkerConfig, workflowTopic: string, workflowFunction: Function): Promise<HotMesh>;
28
+ static Context: {
29
+ info: () => {
30
+ workflowId: string;
31
+ workflowTopic: string;
32
+ };
33
+ };
34
+ wrapWorkflowFunction(workflowFunction: Function, workflowTopic: string): Function;
35
+ static shutdown(): Promise<void>;
36
+ }
@@ -0,0 +1,258 @@
1
+ var _a;
2
+ import { asyncLocalStorage } from './asyncLocalStorage';
3
+ import { HotMeshService as HotMesh } from '../hotmesh';
4
+ import { StreamStatus } from '../../types/stream';
5
+ import { getWorkflowYAML, getActivityYAML } from './factory';
6
+ /*
7
+ Here is an example of how the methods in this file are used:
8
+
9
+ ./worker.ts
10
+
11
+ import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
12
+ import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
13
+
14
+ import * as activities from './activities';
15
+
16
+ async function run() {
17
+ const connection = await NativeConnection.connect({
18
+ class: Redis,
19
+ options: {
20
+ host: 'localhost',
21
+ port: 6379,
22
+ },
23
+ });
24
+ const worker = await Worker.create({
25
+ connection,
26
+ namespace: 'default',
27
+ taskQueue: 'hello-world',
28
+ workflowsPath: require.resolve('./workflows'),
29
+ activities,
30
+ });
31
+ await worker.run();
32
+ }
33
+
34
+ run().catch((err) => {
35
+ console.error(err);
36
+ process.exit(1);
37
+ });
38
+ */
39
+ class WorkerService {
40
+ static async activateWorkflow(hotMesh, topic, factory) {
41
+ const version = '1';
42
+ const app = await hotMesh.engine.store.getApp(topic);
43
+ const appVersion = app?.version;
44
+ if (!appVersion) {
45
+ try {
46
+ await hotMesh.deploy(factory(topic, version));
47
+ await hotMesh.activate(version);
48
+ }
49
+ catch (err) {
50
+ hotMesh.engine.logger.error('durable-worker-deploy-activate-err', err);
51
+ throw err;
52
+ }
53
+ }
54
+ else if (app && !app.active) {
55
+ try {
56
+ await hotMesh.activate(version);
57
+ }
58
+ catch (err) {
59
+ hotMesh.engine.logger.error('durable-worker-activate-err', err);
60
+ throw err;
61
+ }
62
+ }
63
+ }
64
+ /**
65
+ * The `worker` calls `registerActivities` immediately BEFORE
66
+ * dynamically importing the user's workflow module. That file
67
+ * contains a call, `proxyActivities`, which needs this info.
68
+ *
69
+ * NOTE: The `worker` and `client` both call `proxyActivities`,
70
+ * as a natural result of importing worflows.ts. However,
71
+ * because the worker imports the workflows dynamically AFTER
72
+ * the activities are loaded, there will be items in the registry,
73
+ * allowing proxyActivities to succeed.
74
+ */
75
+ static registerActivities(activities) {
76
+ Object.keys(activities).forEach(key => {
77
+ WorkerService.activityRegistry[key] = activities[key];
78
+ });
79
+ return WorkerService.activityRegistry;
80
+ }
81
+ static async create(config) {
82
+ WorkerService.connection = config.connection;
83
+ //pre-cache user activity functions
84
+ WorkerService.registerActivities(config.activities);
85
+ //import the user's workflow file (triggers activity functions to be wrapped)
86
+ const workflow = await import(config.workflowsPath);
87
+ const workflowFunctionNames = Object.keys(workflow);
88
+ const workflowFunctionName = workflowFunctionNames[workflowFunctionNames.length - 1];
89
+ const workflowFunction = workflow[workflowFunctionName];
90
+ const baseTopic = `${config.taskQueue}-${workflowFunctionName}`;
91
+ const activityTopic = `${baseTopic}-activity`;
92
+ const workflowTopic = `${baseTopic}`;
93
+ //initialize supporting workflows
94
+ const worker = new WorkerService();
95
+ const activityRunner = await worker.initActivityWorkflow(config, activityTopic);
96
+ await WorkerService.activateWorkflow(activityRunner, activityTopic, getActivityYAML);
97
+ worker.workflowRunner = await worker.initWorkerWorkflow(config, workflowTopic, workflowFunction);
98
+ await WorkerService.activateWorkflow(worker.workflowRunner, workflowTopic, getWorkflowYAML);
99
+ return worker;
100
+ }
101
+ async run() {
102
+ if (this.workflowRunner) {
103
+ this.workflowRunner.engine.logger.info('WorkerService is running');
104
+ }
105
+ else {
106
+ console.log('WorkerService is running');
107
+ }
108
+ }
109
+ async initActivityWorkflow(config, activityTopic) {
110
+ const redisConfig = {
111
+ class: config.connection.class,
112
+ options: config.connection.options
113
+ };
114
+ const hmshInstance = await HotMesh.init({
115
+ appId: activityTopic,
116
+ engine: { redis: redisConfig },
117
+ workers: [
118
+ { topic: activityTopic,
119
+ redis: redisConfig,
120
+ callback: this.wrapActivityFunctions().bind(this)
121
+ }
122
+ ]
123
+ });
124
+ WorkerService.instances.set(activityTopic, hmshInstance);
125
+ return hmshInstance;
126
+ }
127
+ wrapActivityFunctions() {
128
+ return async (data) => {
129
+ try {
130
+ //always run the activity function when instructed; return the response
131
+ const activityInput = data.data;
132
+ const activityName = activityInput.activityName;
133
+ const activityFunction = WorkerService.activityRegistry[activityName];
134
+ const pojoResponse = await activityFunction.apply(this, activityInput.arguments);
135
+ return {
136
+ status: StreamStatus.SUCCESS,
137
+ metadata: { ...data.metadata },
138
+ data: { response: pojoResponse }
139
+ };
140
+ }
141
+ catch (err) {
142
+ console.error(err);
143
+ //todo (make retry configurable)
144
+ return {
145
+ status: StreamStatus.PENDING,
146
+ metadata: { ...data.metadata },
147
+ data: { error: err }
148
+ };
149
+ }
150
+ };
151
+ }
152
+ async activateActivityWorkflow(hotMesh, activityTopic) {
153
+ const version = '1';
154
+ const app = await hotMesh.engine.store.getApp(activityTopic);
155
+ const appVersion = app?.version;
156
+ if (isNaN(appVersion)) {
157
+ try {
158
+ await hotMesh.deploy(getActivityYAML(activityTopic, version));
159
+ await hotMesh.activate(version);
160
+ }
161
+ catch (err) {
162
+ console.log('durable-worker-activity-deploy-activate-error', err);
163
+ throw err;
164
+ }
165
+ }
166
+ else if (app && !app.active) {
167
+ try {
168
+ await hotMesh.activate(version);
169
+ }
170
+ catch (err) {
171
+ hotMesh.engine.logger.error('durable-worker-activity-activate-err', err);
172
+ throw err;
173
+ }
174
+ }
175
+ }
176
+ async initWorkerWorkflow(config, workflowTopic, workflowFunction) {
177
+ const redisConfig = {
178
+ class: config.connection.class,
179
+ options: config.connection.options
180
+ };
181
+ const hmshInstance = await HotMesh.init({
182
+ appId: workflowTopic,
183
+ engine: { redis: redisConfig },
184
+ workers: [
185
+ { topic: workflowTopic,
186
+ redis: redisConfig,
187
+ callback: this.wrapWorkflowFunction(workflowFunction, workflowTopic).bind(this)
188
+ }
189
+ ]
190
+ });
191
+ WorkerService.instances.set(workflowTopic, hmshInstance);
192
+ return hmshInstance;
193
+ }
194
+ wrapWorkflowFunction(workflowFunction, workflowTopic) {
195
+ return async (data) => {
196
+ try {
197
+ //incoming data payload has arguments and workflowId
198
+ const workflowInput = data.data;
199
+ const context = new Map();
200
+ const counter = { counter: 0 };
201
+ context.set('counter', counter);
202
+ context.set('workflowId', workflowInput.workflowId);
203
+ context.set('workflowTopic', workflowTopic);
204
+ context.set('workflowName', workflowTopic.split('-').pop());
205
+ context.set('workflowTrace', data.metadata.trc);
206
+ context.set('workflowSpan', data.metadata.spn);
207
+ const workflowResponse = await asyncLocalStorage.run(context, async () => {
208
+ return await workflowFunction.apply(this, workflowInput.arguments);
209
+ });
210
+ return {
211
+ code: 200,
212
+ status: StreamStatus.SUCCESS,
213
+ metadata: { ...data.metadata },
214
+ data: { response: workflowResponse }
215
+ };
216
+ }
217
+ catch (err) {
218
+ //todo: (retryable error types)
219
+ return {
220
+ code: 500,
221
+ status: StreamStatus.PENDING,
222
+ metadata: { ...data.metadata },
223
+ data: { error: err }
224
+ };
225
+ }
226
+ };
227
+ }
228
+ static async shutdown() {
229
+ for (const [key, value] of WorkerService.instances) {
230
+ const hotMesh = await value;
231
+ await hotMesh.stop();
232
+ }
233
+ }
234
+ }
235
+ _a = WorkerService;
236
+ WorkerService.activityRegistry = {}; //user's activities
237
+ WorkerService.instances = new Map();
238
+ WorkerService.getHotMesh = async (worflowTopic) => {
239
+ if (WorkerService.instances.has(worflowTopic)) {
240
+ return await WorkerService.instances.get(worflowTopic);
241
+ }
242
+ const hotMesh = HotMesh.init({
243
+ appId: worflowTopic,
244
+ engine: { redis: { ...WorkerService.connection } }
245
+ });
246
+ WorkerService.instances.set(worflowTopic, hotMesh);
247
+ await WorkerService.activateWorkflow(await hotMesh, worflowTopic, getWorkflowYAML);
248
+ return hotMesh;
249
+ };
250
+ WorkerService.Context = {
251
+ info: () => {
252
+ return {
253
+ workflowId: '',
254
+ workflowTopic: '',
255
+ };
256
+ },
257
+ };
258
+ export { WorkerService };
@@ -0,0 +1,6 @@
1
+ import { ActivityConfig, ProxyType, WorkflowOptions } from "../../types/durable";
2
+ export declare class WorkflowService {
3
+ static executeChild<T>(options: WorkflowOptions): Promise<T>;
4
+ static proxyActivities<ACT>(options?: ActivityConfig): ProxyType<ACT>;
5
+ static wrapActivity<T>(activityName: string, options?: ActivityConfig): T;
6
+ }