@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
package/LICENSE CHANGED
@@ -178,13 +178,10 @@ Terms and Conditions for Use, Reproduction, and Distribution
178
178
  product that includes the Work or any part of it, as a commercial
179
179
  service to third parties, or in any other commercial context where
180
180
  you derive direct or indirect financial benefit from the use of the
181
- Work. This includes, but is not limited to, providing
182
- routing-as-a-service, bpm-as-a-service, workflow-as-a-service,
183
- integration-as-a-service, operational-data-as-a-service
184
- or any other similar service that would compete with
185
- HotMesh's commercial offering of workflow and routing services.
186
- Any such use requires explicit written permission from the
187
- Licensor.
181
+ Work in a manner that would compete with the Licensor's commercial
182
+ service-mesh-as-a-service, bpm-as-a-service, workflow-as-a-service,
183
+ integration-as-a-service or similar orchestration-type service.
184
+ Any such use requires explicit written permission from the Licensor.
188
185
 
189
186
  END OF TERMS AND CONDITIONS
190
187
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # HotMesh
2
2
  ![alpha release](https://img.shields.io/badge/release-alpha-yellow)
3
3
 
4
- Build sophisticated, durable workflows without the overhead of a dedicated server cluster. With HotMesh, your code remains front and center using [infrastructure](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/faq.md#what-is-hotmesh) you already own.
4
+ Elevate Redis from an in-memory data store to a game-changing [service mesh](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/faq.md#what-is-hotmesh). Turn your unpredictable functions into unbreakable workflows.
5
5
 
6
6
  ## Install
7
7
  [![npm version](https://badge.fury.io/js/%40hotmeshio%2Fhotmesh.svg)](https://badge.fury.io/js/%40hotmeshio%2Fhotmesh)
@@ -11,94 +11,91 @@ npm install @hotmeshio/hotmesh
11
11
  ```
12
12
 
13
13
  ## Design
14
- HotMesh's TypeScript SDK is modeled after [Temporal IO's](https://github.com/temporalio) developer-friendly approach. Design and deploy durable workflows using familiar paradigms that keep your code delightful to maintain. Deploying Temporal's [hello-world tutorial](https://github.com/temporalio/samples-typescript/tree/main/hello-world/src), for example, requires few changes beyond using the HotMesh SDK and saving to Redis.
14
+ The HotMesh SDK is designed to keep your code front-and-center. Write functions as you normally would, then use the HotMesh to make them durable.
15
15
 
16
- **./activities.ts**
17
- ```javascript
18
- export async function greet(name: string): Promise<string> {
19
- return `Hello, ${name}!`;
20
- }
21
- ```
22
-
23
- **./workflows.ts**
24
- ```javascript
25
- import { Durable } from '@hotmeshio/hotmesh';
26
- import type * as activities from './activities';
27
-
28
- const { greet } = Durable.workflow.proxyActivities<typeof activities>();
16
+ 1. Start by defining **activities**. Activities are those functions that will be invoked by your workflow. They are commonly used to read and write to databases and invoke external services. They can be written in any style, using any framework, and can even be legacy functions you've already written. The only requirement is that they return a Promise.
17
+ ```javascript
18
+ //activities.ts
29
19
 
30
- export async function example(name: string): Promise<string> {
31
- return await greet(name);
32
- }
33
- ```
34
-
35
- **./worker.ts**
36
- ```javascript
37
- import { Durable } from '@hotmeshio/hotmesh';
38
- import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
39
- import * as activities from './activities';
40
-
41
- async function run() {
42
- const connection = await Durable.NativeConnection.connect({
43
- class: Redis,
44
- options: {
45
- host: 'localhost',
46
- port: 6379,
47
- },
48
- });
49
- const worker = await Durable.Worker.create({
50
- connection,
51
- namespace: 'default',
52
- taskQueue: 'hello-world',
53
- workflowsPath: require.resolve('./workflows'),
54
- activities,
55
- });
56
- await worker.run();
57
- }
58
-
59
- run().catch((err) => {
60
- console.error(err);
61
- process.exit(1);
62
- });
63
- ```
20
+ export async function greet(name: string): Promise<string> {
21
+ return `Hello, ${name}!`;
22
+ }
64
23
 
65
- **./client.ts**
66
- ```javascript
67
- import { Durable } from '@hotmeshio/hotmesh';
68
- import Redis from 'ioredis';
69
- import { v4 as uuidv4 } from 'uuid';
70
-
71
- async function run() {
72
- const connection = await Durable.Connection.connect({
73
- class: Redis,
74
- options: {
75
- host: 'localhost',
76
- port: 6379,
77
- },
78
- });
79
-
80
- const client = new Durable.Client({
81
- connection,
82
- });
83
-
84
- const handle = await client.workflow.start({
85
- args: ['HotMesh'],
86
- taskQueue: 'hello-world',
87
- workflowName: 'example',
88
- workflowId: 'workflow-' + uuidv4(),
89
- });
90
-
91
- console.log(`Started workflow ${handle.workflowId}`);
92
- console.log(await handle.result());
93
- }
94
-
95
- run().catch((err) => {
96
- console.error(err);
97
- process.exit(1);
98
- });
99
- ```
24
+ export async function saludar(nombre: string): Promise<string> {
25
+ return `¡Hola, ${nombre}!`;
26
+ }
27
+ ```
28
+ 2. Define your **workflow** logic. Include conditional branching, loops, etc to control activity execution. It's vanilla code written in your own coding style. The only requirement is to use `proxyActivities`, ensuring your activities are executed with HotMesh's durability guarantee.
29
+ ```javascript
30
+ //workflows.ts
31
+
32
+ import { Durable } from '@hotmeshio/hotmesh';
33
+ import * as activities from './activities';
34
+
35
+ const { greet, saludar } = Durable.workflow
36
+ .proxyActivities<typeof activities>({
37
+ activities
38
+ });
39
+
40
+ export async function example(name: string, lang: string): Promise<string> {
41
+ if (lang === 'es') {
42
+ return await saludar(name);
43
+ } else {
44
+ return await greet(name);
45
+ }
46
+ }
47
+ ```
48
+
49
+ 3. Although you could call your workflow directly (it's just a vanilla function), it's only durable when invoked and orchestrated via HotMesh. By using a HotMesh **client** to send the request, the function is guaranteed to return a result.
50
+ ```javascript
51
+ //client.ts
52
+
53
+ import { Durable } from '@hotmeshio/hotmesh';
54
+ import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
55
+ import { v4 as uuidv4 } from 'uuid';
56
+
57
+ async function run(): Promise<string> {
58
+ const client = new Durable.Client({
59
+ connection: {
60
+ class: Redis,
61
+ options: { host: 'localhost', port: 6379 }
62
+ }
63
+ });
64
+
65
+ const handle = await client.workflow.start({
66
+ args: ['HotMesh', 'es'],
67
+ taskQueue: 'hello-world',
68
+ workflowName: 'example',
69
+ workflowId: uuidv4()
70
+ });
71
+
72
+ return await handle.result();
73
+ //returns '¡Hola, HotMesh!'
74
+ }
75
+ ```
76
+
77
+ 4. The last step is to create a **worker** that executes the workflow. Workers listen for tasks on their assigned channel, executing their assigned workflow function until it succeeds.
78
+ ```javascript
79
+ //worker.ts
80
+
81
+ import { Durable } from '@hotmeshio/hotmesh';
82
+ import Redis from 'ioredis';
83
+ import * as workflows from './workflows';
84
+
85
+ async function run() {
86
+ const worker = await Durable.Worker.create({
87
+ connection: {
88
+ class: Redis,
89
+ options: { host: 'localhost', port: 6379 },
90
+ },
91
+ taskQueue: 'hello-world',
92
+ workflow: workflows.example,
93
+ });
94
+ await worker.run();
95
+ }
96
+ ```
100
97
 
101
- >HotMesh delivers durable function execution using a [distributed service mesh](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/distributed_orchestration.md). The design consumes leftover CPU on your microservices to execute workflows without the cost and complexity of a central server/control plane.
98
+ >HotMesh delivers durable workflows without the cost and complexity of a centralized service mesh. Refer to the [samples-typescript](https://github.com/hotmeshio/samples-typescript) Git Repo for a range of examples, including compositional workflows (where one workflow calls another) and remote execution (where calls are brokered across microservices).
102
99
 
103
100
  ## Advanced Design
104
101
  HotMesh's TypeScript SDK is the easiest way to make your functions durable. But if you need full control over your function lifecycles (including high-volume, high-speed use cases), you can use HotMesh's underlying YAML models to optimize your durable workflows. The following model depicts a sequence of activities orchestrated by HotMesh. Any function you associate with a `topic` in your YAML definition is guaranteed to be durable.
@@ -25,7 +25,7 @@
25
25
  * hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys)
26
26
  * hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
27
27
  */
28
- declare const PSNS = "hmsh";
28
+ declare const HMNS = "hmsh";
29
29
  declare enum KeyType {
30
30
  APP = 0,
31
31
  ENGINE_ID = 1,
@@ -72,4 +72,4 @@ declare class KeyService {
72
72
  */
73
73
  static mintKey(namespace: string, keyType: KeyType, params: KeyStoreParams): string;
74
74
  }
75
- export { KeyService, KeyType, KeyStoreParams, PSNS };
75
+ export { KeyService, KeyType, KeyStoreParams, HMNS };
@@ -27,10 +27,10 @@
27
27
  * hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
28
28
  */
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.PSNS = exports.KeyType = exports.KeyService = void 0;
30
+ exports.HMNS = exports.KeyType = exports.KeyService = void 0;
31
31
  //default namespace for hotmesh
32
- const PSNS = "hmsh";
33
- exports.PSNS = PSNS;
32
+ const HMNS = "hmsh";
33
+ exports.HMNS = HMNS;
34
34
  //these are the entity types that are stored in the key/value store
35
35
  var KeyType;
36
36
  (function (KeyType) {
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Durable Workflows",
5
- "main": "build/cjs/index.js",
6
- "module": "build/esm/index.js",
7
- "types": "build/cjs/index.d.ts",
8
- "exports": {
9
- "import": "./build/esm/index.js",
10
- "require": "./build/cjs/index.js"
11
- },
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
12
7
  "repository": {
13
8
  "type": "git",
14
9
  "url": "https://github.com/hotmeshio/sdk-typescript.git"
@@ -19,9 +14,7 @@
19
14
  },
20
15
  "scripts": {
21
16
  "clean": "rimraf ./build",
22
- "build:cjs": "tsc --build tsconfig.cjs.json",
23
- "build:esm": "tsc --build tsconfig.esm.json",
24
- "build": "npm run build:cjs && npm run build:esm",
17
+ "build": "tsc --build tsconfig.json",
25
18
  "clean-build": "npm run clean && npm run build",
26
19
  "lint": "eslint . --ext .ts",
27
20
  "lint:fix": "eslint . --fix --ext .ts",
@@ -10,7 +10,7 @@ Here is an example of how the methods in this file are used:
10
10
  import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
11
11
  import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
12
12
 
13
- import * as activities from './activities';
13
+ import * as workflows from './workflows';
14
14
 
15
15
  async function run() {
16
16
  const connection = await NativeConnection.connect({
@@ -22,9 +22,8 @@ async function run() {
22
22
  });
23
23
  const worker = await Worker.create({
24
24
  connection,
25
- namespace: 'default',
26
25
  taskQueue: 'hello-world',
27
- workflowsPath: require.resolve('./workflows'),
26
+ workflow: workflows.example,
28
27
  activities,
29
28
  });
30
29
  await worker.run();
@@ -13,9 +13,7 @@ export declare class WorkerService {
13
13
  * dynamically importing the user's workflow module. That file
14
14
  * contains a call, `proxyActivities`, which needs this info.
15
15
  *
16
- * NOTE: The `worker` and `client` both call `proxyActivities`,
17
- * as a natural result of importing worflows.ts. However,
18
- * because the worker imports the workflows dynamically AFTER
16
+ * NOTE: Because the worker imports the workflows dynamically AFTER
19
17
  * the activities are loaded, there will be items in the registry,
20
18
  * allowing proxyActivities to succeed.
21
19
  */
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var _a;
26
3
  Object.defineProperty(exports, "__esModule", { value: true });
27
4
  exports.WorkerService = void 0;
@@ -37,7 +14,7 @@ Here is an example of how the methods in this file are used:
37
14
  import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
38
15
  import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
39
16
 
40
- import * as activities from './activities';
17
+ import * as workflows from './workflows';
41
18
 
42
19
  async function run() {
43
20
  const connection = await NativeConnection.connect({
@@ -49,9 +26,8 @@ async function run() {
49
26
  });
50
27
  const worker = await Worker.create({
51
28
  connection,
52
- namespace: 'default',
53
29
  taskQueue: 'hello-world',
54
- workflowsPath: require.resolve('./workflows'),
30
+ workflow: workflows.example,
55
31
  activities,
56
32
  });
57
33
  await worker.run();
@@ -92,19 +68,19 @@ class WorkerService {
92
68
  * dynamically importing the user's workflow module. That file
93
69
  * contains a call, `proxyActivities`, which needs this info.
94
70
  *
95
- * NOTE: The `worker` and `client` both call `proxyActivities`,
96
- * as a natural result of importing worflows.ts. However,
97
- * because the worker imports the workflows dynamically AFTER
71
+ * NOTE: Because the worker imports the workflows dynamically AFTER
98
72
  * the activities are loaded, there will be items in the registry,
99
73
  * allowing proxyActivities to succeed.
100
74
  */
101
75
  static registerActivities(activities) {
102
- if (typeof activities === 'function') {
76
+ if (typeof activities === 'function' && typeof WorkerService.activityRegistry[activities.name] !== 'function') {
103
77
  WorkerService.activityRegistry[activities.name] = activities;
104
78
  }
105
79
  else {
106
80
  Object.keys(activities).forEach(key => {
107
- WorkerService.activityRegistry[activities[key].name] = activities[key];
81
+ if (activities[key].name && typeof WorkerService.activityRegistry[activities[key].name] !== 'function') {
82
+ WorkerService.activityRegistry[activities[key].name] = activities[key];
83
+ }
108
84
  });
109
85
  }
110
86
  return WorkerService.activityRegistry;
@@ -112,8 +88,8 @@ class WorkerService {
112
88
  static async create(config) {
113
89
  //always call `registerActivities` before `import`
114
90
  WorkerService.connection = config.connection;
115
- WorkerService.registerActivities(config.activities);
116
- const workflow = await Promise.resolve(`${config.workflowsPath}`).then(s => __importStar(require(s)));
91
+ //user can provide the workflow file directly
92
+ const workflow = config.workflow;
117
93
  const [workflowFunctionName, workflowFunction] = WorkerService.resolveWorkflowTarget(workflow);
118
94
  const baseTopic = `${config.taskQueue}-${workflowFunctionName}`;
119
95
  const activityTopic = `${baseTopic}-activity`;
@@ -33,8 +33,10 @@ Here is an example of how the methods in this file are used:
33
33
  ./workflows.ts
34
34
 
35
35
  import { Durable } from '@hotmeshio/hotmesh';
36
- import type * as activities from './activities';
36
+ import * as activities from './activities';
37
+
37
38
  const { greet } = Durable.workflow.proxyActivities<typeof activities>({
39
+ activities: activities,
38
40
  startToCloseTimeout: '1 minute',
39
41
  retryPolicy: {
40
42
  initialInterval: '5 seconds', // Initial delay between retries
@@ -71,6 +73,9 @@ class WorkflowService {
71
73
  return result;
72
74
  }
73
75
  static proxyActivities(options) {
76
+ if (options.activities) {
77
+ worker_1.WorkerService.registerActivities(options.activities);
78
+ }
74
79
  const proxy = {};
75
80
  const keys = Object.keys(worker_1.WorkerService.activityRegistry);
76
81
  if (keys.length) {
@@ -17,7 +17,7 @@ class HotMeshService {
17
17
  }
18
18
  verifyAndSetNamespace(namespace) {
19
19
  if (!namespace) {
20
- this.namespace = key_1.PSNS;
20
+ this.namespace = key_1.HMNS;
21
21
  }
22
22
  else if (!namespace.match(/^[A-Za-z0-9-]+$/)) {
23
23
  throw new Error(`config.namespace [${namespace}] is invalid`);
@@ -58,7 +58,7 @@ class StoreService {
58
58
  };
59
59
  this.redisClient = redisClient;
60
60
  }
61
- async init(namespace = key_1.PSNS, appId, logger) {
61
+ async init(namespace = key_1.HMNS, appId, logger) {
62
62
  this.namespace = namespace;
63
63
  this.appId = appId;
64
64
  this.logger = logger;
@@ -111,7 +111,7 @@ class StoreService {
111
111
  if (bCreate) {
112
112
  const packageJson = await Promise.resolve().then(() => __importStar(require('../../package.json')));
113
113
  const version = packageJson['version'] || '0.0.0';
114
- settings = { namespace: key_1.PSNS, version };
114
+ settings = { namespace: key_1.HMNS, version };
115
115
  await this.setSettings(settings);
116
116
  return settings;
117
117
  }
@@ -7,7 +7,7 @@ class IORedisStreamService extends index_1.StreamService {
7
7
  constructor(redisClient) {
8
8
  super(redisClient);
9
9
  }
10
- async init(namespace = key_1.PSNS, appId, logger) {
10
+ async init(namespace = key_1.HMNS, appId, logger) {
11
11
  this.namespace = namespace;
12
12
  this.logger = logger;
13
13
  this.appId = appId;
@@ -7,7 +7,7 @@ class RedisStreamService extends index_1.StreamService {
7
7
  constructor(redisClient) {
8
8
  super(redisClient);
9
9
  }
10
- async init(namespace = key_1.PSNS, appId, logger) {
10
+ async init(namespace = key_1.HMNS, appId, logger) {
11
11
  this.namespace = namespace;
12
12
  this.logger = logger;
13
13
  this.appId = appId;
@@ -7,7 +7,7 @@ class IORedisSubService extends index_1.SubService {
7
7
  constructor(redisClient) {
8
8
  super(redisClient);
9
9
  }
10
- async init(namespace = key_1.PSNS, appId, engineId, logger) {
10
+ async init(namespace = key_1.HMNS, appId, engineId, logger) {
11
11
  this.namespace = namespace;
12
12
  this.logger = logger;
13
13
  this.appId = appId;
@@ -7,7 +7,7 @@ class RedisSubService extends index_1.SubService {
7
7
  constructor(redisClient) {
8
8
  super(redisClient);
9
9
  }
10
- async init(namespace = key_1.PSNS, appId, engineId, logger) {
10
+ async init(namespace = key_1.HMNS, appId, engineId, logger) {
11
11
  this.namespace = namespace;
12
12
  this.logger = logger;
13
13
  this.appId = appId;
@@ -32,12 +32,9 @@ type Registry = {
32
32
  };
33
33
  type WorkerConfig = {
34
34
  connection: Connection;
35
- namespace: string;
35
+ namespace?: string;
36
36
  taskQueue: string;
37
- workflowsPath: string;
38
- activities: {
39
- [key: string]: Function;
40
- };
37
+ workflow: Function;
41
38
  };
42
39
  type ContextType = {
43
40
  workflowId: string;
@@ -48,8 +45,9 @@ type ProxyType<ACT> = {
48
45
  [K in keyof ACT]: FunctionSignature<ACT[K]>;
49
46
  };
50
47
  type ActivityConfig = {
51
- startToCloseTimeout: string;
52
- retryPolicy: {
48
+ startToCloseTimeout?: string;
49
+ activities?: any;
50
+ retryPolicy?: {
53
51
  initialInterval: string;
54
52
  maximumAttempts: number;
55
53
  backoffCoefficient: number;
package/modules/key.ts CHANGED
@@ -27,7 +27,7 @@
27
27
  */
28
28
 
29
29
  //default namespace for hotmesh
30
- const PSNS = "hmsh";
30
+ const HMNS = "hmsh";
31
31
 
32
32
  //these are the entity types that are stored in the key/value store
33
33
  enum KeyType {
@@ -126,4 +126,4 @@ class KeyService {
126
126
  }
127
127
  }
128
128
 
129
- export { KeyService, KeyType, KeyStoreParams, PSNS };
129
+ export { KeyService, KeyType, KeyStoreParams, HMNS };
package/package.json CHANGED
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Durable Workflows",
5
- "main": "build/cjs/index.js",
6
- "module": "build/esm/index.js",
7
- "types": "build/cjs/index.d.ts",
8
- "exports": {
9
- "import": "./build/esm/index.js",
10
- "require": "./build/cjs/index.js"
11
- },
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
12
7
  "repository": {
13
8
  "type": "git",
14
9
  "url": "https://github.com/hotmeshio/sdk-typescript.git"
@@ -19,9 +14,7 @@
19
14
  },
20
15
  "scripts": {
21
16
  "clean": "rimraf ./build",
22
- "build:cjs": "tsc --build tsconfig.cjs.json",
23
- "build:esm": "tsc --build tsconfig.esm.json",
24
- "build": "npm run build:cjs && npm run build:esm",
17
+ "build": "tsc --build tsconfig.json",
25
18
  "clean-build": "npm run clean && npm run build",
26
19
  "lint": "eslint . --ext .ts",
27
20
  "lint:fix": "eslint . --fix --ext .ts",
@@ -9,7 +9,7 @@ Here is an example of how the methods in this file are used:
9
9
  import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
10
10
  import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
11
11
 
12
- import * as activities from './activities';
12
+ import * as workflows from './workflows';
13
13
 
14
14
  async function run() {
15
15
  const connection = await NativeConnection.connect({
@@ -21,9 +21,8 @@ async function run() {
21
21
  });
22
22
  const worker = await Worker.create({
23
23
  connection,
24
- namespace: 'default',
25
24
  taskQueue: 'hello-world',
26
- workflowsPath: require.resolve('./workflows'),
25
+ workflow: workflows.example,
27
26
  activities,
28
27
  });
29
28
  await worker.run();
@@ -13,7 +13,7 @@ Here is an example of how the methods in this file are used:
13
13
  import { Durable: { NativeConnection, Worker } } from '@hotmeshio/hotmesh';
14
14
  import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
15
15
 
16
- import * as activities from './activities';
16
+ import * as workflows from './workflows';
17
17
 
18
18
  async function run() {
19
19
  const connection = await NativeConnection.connect({
@@ -25,9 +25,8 @@ async function run() {
25
25
  });
26
26
  const worker = await Worker.create({
27
27
  connection,
28
- namespace: 'default',
29
28
  taskQueue: 'hello-world',
30
- workflowsPath: require.resolve('./workflows'),
29
+ workflow: workflows.example,
31
30
  activities,
32
31
  });
33
32
  await worker.run();
@@ -86,18 +85,18 @@ export class WorkerService {
86
85
  * dynamically importing the user's workflow module. That file
87
86
  * contains a call, `proxyActivities`, which needs this info.
88
87
  *
89
- * NOTE: The `worker` and `client` both call `proxyActivities`,
90
- * as a natural result of importing worflows.ts. However,
91
- * because the worker imports the workflows dynamically AFTER
88
+ * NOTE: Because the worker imports the workflows dynamically AFTER
92
89
  * the activities are loaded, there will be items in the registry,
93
90
  * allowing proxyActivities to succeed.
94
91
  */
95
92
  static registerActivities<ACT>(activities: ACT): Registry {
96
- if (typeof activities === 'function') {
93
+ if (typeof activities === 'function' && typeof WorkerService.activityRegistry[activities.name] !== 'function') {
97
94
  WorkerService.activityRegistry[activities.name] = activities as Function;
98
95
  } else {
99
96
  Object.keys(activities).forEach(key => {
100
- WorkerService.activityRegistry[activities[key].name] = (activities as any)[key] as Function;
97
+ if (activities[key].name && typeof WorkerService.activityRegistry[activities[key].name] !== 'function') {
98
+ WorkerService.activityRegistry[activities[key].name] = (activities as any)[key] as Function;
99
+ }
101
100
  });
102
101
  }
103
102
  return WorkerService.activityRegistry;
@@ -106,8 +105,8 @@ export class WorkerService {
106
105
  static async create(config: WorkerConfig) {
107
106
  //always call `registerActivities` before `import`
108
107
  WorkerService.connection = config.connection;
109
- WorkerService.registerActivities<typeof config.activities>(config.activities);
110
- const workflow = await import(config.workflowsPath);
108
+ //user can provide the workflow file directly
109
+ const workflow = config.workflow;
111
110
  const [workflowFunctionName, workflowFunction] = WorkerService.resolveWorkflowTarget(workflow);
112
111
  const baseTopic = `${config.taskQueue}-${workflowFunctionName}`;
113
112
  const activityTopic = `${baseTopic}-activity`;
@@ -31,8 +31,10 @@ Here is an example of how the methods in this file are used:
31
31
  ./workflows.ts
32
32
 
33
33
  import { Durable } from '@hotmeshio/hotmesh';
34
- import type * as activities from './activities';
34
+ import * as activities from './activities';
35
+
35
36
  const { greet } = Durable.workflow.proxyActivities<typeof activities>({
37
+ activities: activities,
36
38
  startToCloseTimeout: '1 minute',
37
39
  retryPolicy: {
38
40
  initialInterval: '5 seconds', // Initial delay between retries
@@ -72,6 +74,10 @@ export class WorkflowService {
72
74
  }
73
75
 
74
76
  static proxyActivities<ACT>(options?: ActivityConfig): ProxyType<ACT> {
77
+ if (options.activities) {
78
+ WorkerService.registerActivities(options.activities)
79
+ }
80
+
75
81
  const proxy: any = {};
76
82
  const keys = Object.keys(WorkerService.activityRegistry);
77
83
  if (keys.length) {