@hotmeshio/hotmesh 0.0.4 → 0.0.6

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 (355) 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}/durable/worker.d.ts +1 -0
  8. package/build/{services → cjs/services}/durable/worker.js +13 -3
  9. package/build/{services → cjs/services}/hotmesh/index.js +2 -2
  10. package/build/{services → cjs/services}/mapper/index.d.ts +3 -3
  11. package/build/{services → cjs/services}/store/index.js +1 -1
  12. package/build/esm/index.d.ts +4 -0
  13. package/build/esm/index.js +3 -0
  14. package/build/esm/modules/errors.d.ts +28 -0
  15. package/build/esm/modules/errors.js +41 -0
  16. package/build/esm/modules/key.d.ts +75 -0
  17. package/build/esm/modules/key.js +111 -0
  18. package/build/esm/modules/utils.d.ts +34 -0
  19. package/build/esm/modules/utils.js +154 -0
  20. package/build/esm/package.json +80 -0
  21. package/build/esm/services/activities/activity.d.ts +61 -0
  22. package/build/esm/services/activities/activity.js +411 -0
  23. package/build/esm/services/activities/await.d.ts +16 -0
  24. package/build/esm/services/activities/await.js +140 -0
  25. package/build/esm/services/activities/emit.d.ts +9 -0
  26. package/build/esm/services/activities/emit.js +10 -0
  27. package/build/esm/services/activities/index.d.ts +15 -0
  28. package/build/esm/services/activities/index.js +14 -0
  29. package/build/esm/services/activities/iterate.d.ts +9 -0
  30. package/build/esm/services/activities/iterate.js +10 -0
  31. package/build/esm/services/activities/trigger.d.ts +22 -0
  32. package/build/esm/services/activities/trigger.js +158 -0
  33. package/build/esm/services/activities/worker.d.ts +17 -0
  34. package/build/esm/services/activities/worker.js +162 -0
  35. package/build/esm/services/collator/index.d.ts +56 -0
  36. package/build/esm/services/collator/index.js +191 -0
  37. package/build/esm/services/compiler/deployer.d.ts +36 -0
  38. package/build/esm/services/compiler/deployer.js +423 -0
  39. package/build/esm/services/compiler/index.d.ts +30 -0
  40. package/build/esm/services/compiler/index.js +82 -0
  41. package/build/esm/services/compiler/validator.d.ts +32 -0
  42. package/build/esm/services/compiler/validator.js +131 -0
  43. package/build/esm/services/connector/clients/ioredis.d.ts +13 -0
  44. package/build/esm/services/connector/clients/ioredis.js +47 -0
  45. package/build/esm/services/connector/clients/redis.d.ts +13 -0
  46. package/build/esm/services/connector/clients/redis.js +59 -0
  47. package/build/esm/services/connector/index.d.ts +5 -0
  48. package/build/esm/services/connector/index.js +27 -0
  49. package/build/esm/services/dimension/index.d.ts +29 -0
  50. package/build/esm/services/dimension/index.js +32 -0
  51. package/build/esm/services/durable/asyncLocalStorage.d.ts +3 -0
  52. package/build/esm/services/durable/asyncLocalStorage.js +2 -0
  53. package/build/esm/services/durable/client.d.ts +15 -0
  54. package/build/esm/services/durable/client.js +114 -0
  55. package/build/esm/services/durable/connection.d.ts +4 -0
  56. package/build/esm/services/durable/connection.js +47 -0
  57. package/build/esm/services/durable/factory.d.ts +3 -0
  58. package/build/esm/services/durable/factory.js +119 -0
  59. package/build/esm/services/durable/handle.d.ts +8 -0
  60. package/build/esm/services/durable/handle.js +34 -0
  61. package/build/esm/services/durable/index.d.ts +57 -0
  62. package/build/esm/services/durable/index.js +55 -0
  63. package/build/esm/services/durable/native.d.ts +4 -0
  64. package/build/esm/services/durable/native.js +43 -0
  65. package/build/esm/services/durable/worker.d.ts +37 -0
  66. package/build/esm/services/durable/worker.js +268 -0
  67. package/build/esm/services/durable/workflow.d.ts +6 -0
  68. package/build/esm/services/durable/workflow.js +128 -0
  69. package/build/esm/services/engine/index.d.ts +82 -0
  70. package/build/esm/services/engine/index.js +522 -0
  71. package/build/esm/services/hotmesh/index.d.ts +45 -0
  72. package/build/esm/services/hotmesh/index.js +131 -0
  73. package/build/esm/services/logger/index.d.ts +17 -0
  74. package/build/esm/services/logger/index.js +70 -0
  75. package/build/esm/services/mapper/index.d.ts +24 -0
  76. package/build/esm/services/mapper/index.js +69 -0
  77. package/build/esm/services/pipe/functions/array.d.ts +24 -0
  78. package/build/esm/services/pipe/functions/array.js +66 -0
  79. package/build/esm/services/pipe/functions/bitwise.d.ts +9 -0
  80. package/build/esm/services/pipe/functions/bitwise.js +21 -0
  81. package/build/esm/services/pipe/functions/conditional.d.ts +10 -0
  82. package/build/esm/services/pipe/functions/conditional.js +24 -0
  83. package/build/esm/services/pipe/functions/date.d.ts +57 -0
  84. package/build/esm/services/pipe/functions/date.js +164 -0
  85. package/build/esm/services/pipe/functions/index.d.ts +25 -0
  86. package/build/esm/services/pipe/functions/index.js +24 -0
  87. package/build/esm/services/pipe/functions/json.d.ts +5 -0
  88. package/build/esm/services/pipe/functions/json.js +9 -0
  89. package/build/esm/services/pipe/functions/math.d.ts +38 -0
  90. package/build/esm/services/pipe/functions/math.js +108 -0
  91. package/build/esm/services/pipe/functions/number.d.ts +25 -0
  92. package/build/esm/services/pipe/functions/number.js +130 -0
  93. package/build/esm/services/pipe/functions/object.d.ts +22 -0
  94. package/build/esm/services/pipe/functions/object.js +60 -0
  95. package/build/esm/services/pipe/functions/string.d.ts +23 -0
  96. package/build/esm/services/pipe/functions/string.js +66 -0
  97. package/build/esm/services/pipe/functions/symbol.d.ts +12 -0
  98. package/build/esm/services/pipe/functions/symbol.js +30 -0
  99. package/build/esm/services/pipe/functions/unary.d.ts +7 -0
  100. package/build/esm/services/pipe/functions/unary.js +15 -0
  101. package/build/esm/services/pipe/index.d.ts +30 -0
  102. package/build/esm/services/pipe/index.js +122 -0
  103. package/build/esm/services/quorum/index.d.ts +34 -0
  104. package/build/esm/services/quorum/index.js +144 -0
  105. package/build/esm/services/reporter/index.d.ts +47 -0
  106. package/build/esm/services/reporter/index.js +327 -0
  107. package/build/esm/services/serializer/index.d.ts +41 -0
  108. package/build/esm/services/serializer/index.js +251 -0
  109. package/build/esm/services/signaler/store.d.ts +15 -0
  110. package/build/esm/services/signaler/store.js +50 -0
  111. package/build/esm/services/signaler/stream.d.ts +43 -0
  112. package/build/esm/services/signaler/stream.js +315 -0
  113. package/build/esm/services/store/cache.d.ts +66 -0
  114. package/build/esm/services/store/cache.js +124 -0
  115. package/build/esm/services/store/clients/ioredis.d.ts +27 -0
  116. package/build/esm/services/store/clients/ioredis.js +93 -0
  117. package/build/esm/services/store/clients/redis.d.ts +29 -0
  118. package/build/esm/services/store/clients/redis.js +140 -0
  119. package/build/esm/services/store/index.d.ts +88 -0
  120. package/build/esm/services/store/index.js +623 -0
  121. package/build/esm/services/stream/clients/ioredis.d.ts +23 -0
  122. package/build/esm/services/stream/clients/ioredis.js +112 -0
  123. package/build/esm/services/stream/clients/redis.d.ts +23 -0
  124. package/build/esm/services/stream/clients/redis.js +116 -0
  125. package/build/esm/services/stream/index.d.ts +21 -0
  126. package/build/esm/services/stream/index.js +6 -0
  127. package/build/esm/services/sub/clients/ioredis.d.ts +20 -0
  128. package/build/esm/services/sub/clients/ioredis.js +69 -0
  129. package/build/esm/services/sub/clients/redis.d.ts +20 -0
  130. package/build/esm/services/sub/clients/redis.js +60 -0
  131. package/build/esm/services/sub/index.d.ts +18 -0
  132. package/build/esm/services/sub/index.js +6 -0
  133. package/build/esm/services/task/index.d.ts +18 -0
  134. package/build/esm/services/task/index.js +70 -0
  135. package/build/esm/services/telemetry/index.d.ts +49 -0
  136. package/build/esm/services/telemetry/index.js +217 -0
  137. package/build/esm/services/worker/index.d.ts +30 -0
  138. package/build/esm/services/worker/index.js +102 -0
  139. package/build/esm/types/activity.d.ts +87 -0
  140. package/build/esm/types/activity.js +1 -0
  141. package/build/esm/types/app.d.ts +16 -0
  142. package/build/esm/types/app.js +1 -0
  143. package/build/esm/types/async.d.ts +5 -0
  144. package/build/esm/types/async.js +1 -0
  145. package/build/esm/types/cache.d.ts +1 -0
  146. package/build/esm/types/cache.js +1 -0
  147. package/build/esm/types/collator.d.ts +8 -0
  148. package/build/esm/types/collator.js +8 -0
  149. package/build/esm/types/durable.d.ts +59 -0
  150. package/build/esm/types/durable.js +1 -0
  151. package/build/esm/types/hook.d.ts +31 -0
  152. package/build/esm/types/hook.js +6 -0
  153. package/build/esm/types/hotmesh.d.ts +82 -0
  154. package/build/esm/types/hotmesh.js +1 -0
  155. package/build/esm/types/index.d.ts +20 -0
  156. package/build/esm/types/index.js +5 -0
  157. package/build/esm/types/ioredisclient.d.ts +5 -0
  158. package/build/esm/types/ioredisclient.js +2 -0
  159. package/build/esm/types/job.d.ts +50 -0
  160. package/build/esm/types/job.js +1 -0
  161. package/build/esm/types/logger.d.ts +6 -0
  162. package/build/esm/types/logger.js +1 -0
  163. package/build/esm/types/map.d.ts +4 -0
  164. package/build/esm/types/map.js +1 -0
  165. package/build/esm/types/pipe.d.ts +4 -0
  166. package/build/esm/types/pipe.js +1 -0
  167. package/build/esm/types/quorum.d.ts +46 -0
  168. package/build/esm/types/quorum.js +1 -0
  169. package/build/esm/types/redis.d.ts +8 -0
  170. package/build/esm/types/redis.js +1 -0
  171. package/build/esm/types/redisclient.d.ts +25 -0
  172. package/build/esm/types/redisclient.js +1 -0
  173. package/build/esm/types/serializer.d.ts +33 -0
  174. package/build/esm/types/serializer.js +1 -0
  175. package/build/esm/types/stats.d.ts +83 -0
  176. package/build/esm/types/stats.js +1 -0
  177. package/build/esm/types/stream.d.ts +67 -0
  178. package/build/esm/types/stream.js +22 -0
  179. package/build/esm/types/telemetry.d.ts +1 -0
  180. package/build/esm/types/telemetry.js +1 -0
  181. package/build/esm/types/transition.d.ts +17 -0
  182. package/build/esm/types/transition.js +1 -0
  183. package/package.json +12 -5
  184. package/services/activities/activity.ts +1 -1
  185. package/services/activities/trigger.ts +2 -2
  186. package/services/connector/index.ts +3 -3
  187. package/services/durable/client.ts +2 -2
  188. package/services/durable/connection.ts +2 -2
  189. package/services/durable/worker.ts +13 -3
  190. package/services/hotmesh/index.ts +2 -2
  191. package/services/mapper/index.ts +6 -7
  192. package/services/store/index.ts +3 -3
  193. package/tsconfig.cjs.json +8 -0
  194. package/tsconfig.esm.json +9 -0
  195. package/build/{index.d.ts → cjs/index.d.ts} +0 -0
  196. package/build/{index.js → cjs/index.js} +0 -0
  197. package/build/{modules → cjs/modules}/errors.d.ts +0 -0
  198. package/build/{modules → cjs/modules}/errors.js +0 -0
  199. package/build/{modules → cjs/modules}/key.d.ts +0 -0
  200. package/build/{modules → cjs/modules}/key.js +0 -0
  201. package/build/{modules → cjs/modules}/utils.d.ts +0 -0
  202. package/build/{modules → cjs/modules}/utils.js +0 -0
  203. package/build/{services → cjs/services}/activities/activity.d.ts +0 -0
  204. package/build/{services → cjs/services}/activities/activity.js +1 -1
  205. /package/build/{services → cjs/services}/activities/await.d.ts +0 -0
  206. /package/build/{services → cjs/services}/activities/await.js +0 -0
  207. /package/build/{services → cjs/services}/activities/emit.d.ts +0 -0
  208. /package/build/{services → cjs/services}/activities/emit.js +0 -0
  209. /package/build/{services → cjs/services}/activities/index.d.ts +0 -0
  210. /package/build/{services → cjs/services}/activities/index.js +0 -0
  211. /package/build/{services → cjs/services}/activities/iterate.d.ts +0 -0
  212. /package/build/{services → cjs/services}/activities/iterate.js +0 -0
  213. /package/build/{services → cjs/services}/activities/trigger.d.ts +0 -0
  214. /package/build/{services → cjs/services}/activities/worker.d.ts +0 -0
  215. /package/build/{services → cjs/services}/activities/worker.js +0 -0
  216. /package/build/{services → cjs/services}/collator/index.d.ts +0 -0
  217. /package/build/{services → cjs/services}/collator/index.js +0 -0
  218. /package/build/{services → cjs/services}/compiler/deployer.d.ts +0 -0
  219. /package/build/{services → cjs/services}/compiler/deployer.js +0 -0
  220. /package/build/{services → cjs/services}/compiler/index.d.ts +0 -0
  221. /package/build/{services → cjs/services}/compiler/index.js +0 -0
  222. /package/build/{services → cjs/services}/compiler/validator.d.ts +0 -0
  223. /package/build/{services → cjs/services}/compiler/validator.js +0 -0
  224. /package/build/{services → cjs/services}/connector/clients/ioredis.d.ts +0 -0
  225. /package/build/{services → cjs/services}/connector/clients/ioredis.js +0 -0
  226. /package/build/{services → cjs/services}/connector/clients/redis.d.ts +0 -0
  227. /package/build/{services → cjs/services}/connector/clients/redis.js +0 -0
  228. /package/build/{services → cjs/services}/connector/index.d.ts +0 -0
  229. /package/build/{services → cjs/services}/dimension/index.d.ts +0 -0
  230. /package/build/{services → cjs/services}/dimension/index.js +0 -0
  231. /package/build/{services → cjs/services}/durable/asyncLocalStorage.d.ts +0 -0
  232. /package/build/{services → cjs/services}/durable/asyncLocalStorage.js +0 -0
  233. /package/build/{services → cjs/services}/durable/client.d.ts +0 -0
  234. /package/build/{services → cjs/services}/durable/connection.d.ts +0 -0
  235. /package/build/{services → cjs/services}/durable/factory.d.ts +0 -0
  236. /package/build/{services → cjs/services}/durable/factory.js +0 -0
  237. /package/build/{services → cjs/services}/durable/handle.d.ts +0 -0
  238. /package/build/{services → cjs/services}/durable/handle.js +0 -0
  239. /package/build/{services → cjs/services}/durable/index.d.ts +0 -0
  240. /package/build/{services → cjs/services}/durable/index.js +0 -0
  241. /package/build/{services → cjs/services}/durable/native.d.ts +0 -0
  242. /package/build/{services → cjs/services}/durable/native.js +0 -0
  243. /package/build/{services → cjs/services}/durable/workflow.d.ts +0 -0
  244. /package/build/{services → cjs/services}/durable/workflow.js +0 -0
  245. /package/build/{services → cjs/services}/engine/index.d.ts +0 -0
  246. /package/build/{services → cjs/services}/engine/index.js +0 -0
  247. /package/build/{services → cjs/services}/hotmesh/index.d.ts +0 -0
  248. /package/build/{services → cjs/services}/logger/index.d.ts +0 -0
  249. /package/build/{services → cjs/services}/logger/index.js +0 -0
  250. /package/build/{services → cjs/services}/mapper/index.js +0 -0
  251. /package/build/{services → cjs/services}/pipe/functions/array.d.ts +0 -0
  252. /package/build/{services → cjs/services}/pipe/functions/array.js +0 -0
  253. /package/build/{services → cjs/services}/pipe/functions/bitwise.d.ts +0 -0
  254. /package/build/{services → cjs/services}/pipe/functions/bitwise.js +0 -0
  255. /package/build/{services → cjs/services}/pipe/functions/conditional.d.ts +0 -0
  256. /package/build/{services → cjs/services}/pipe/functions/conditional.js +0 -0
  257. /package/build/{services → cjs/services}/pipe/functions/date.d.ts +0 -0
  258. /package/build/{services → cjs/services}/pipe/functions/date.js +0 -0
  259. /package/build/{services → cjs/services}/pipe/functions/index.d.ts +0 -0
  260. /package/build/{services → cjs/services}/pipe/functions/index.js +0 -0
  261. /package/build/{services → cjs/services}/pipe/functions/json.d.ts +0 -0
  262. /package/build/{services → cjs/services}/pipe/functions/json.js +0 -0
  263. /package/build/{services → cjs/services}/pipe/functions/math.d.ts +0 -0
  264. /package/build/{services → cjs/services}/pipe/functions/math.js +0 -0
  265. /package/build/{services → cjs/services}/pipe/functions/number.d.ts +0 -0
  266. /package/build/{services → cjs/services}/pipe/functions/number.js +0 -0
  267. /package/build/{services → cjs/services}/pipe/functions/object.d.ts +0 -0
  268. /package/build/{services → cjs/services}/pipe/functions/object.js +0 -0
  269. /package/build/{services → cjs/services}/pipe/functions/string.d.ts +0 -0
  270. /package/build/{services → cjs/services}/pipe/functions/string.js +0 -0
  271. /package/build/{services → cjs/services}/pipe/functions/symbol.d.ts +0 -0
  272. /package/build/{services → cjs/services}/pipe/functions/symbol.js +0 -0
  273. /package/build/{services → cjs/services}/pipe/functions/unary.d.ts +0 -0
  274. /package/build/{services → cjs/services}/pipe/functions/unary.js +0 -0
  275. /package/build/{services → cjs/services}/pipe/index.d.ts +0 -0
  276. /package/build/{services → cjs/services}/pipe/index.js +0 -0
  277. /package/build/{services → cjs/services}/quorum/index.d.ts +0 -0
  278. /package/build/{services → cjs/services}/quorum/index.js +0 -0
  279. /package/build/{services → cjs/services}/reporter/index.d.ts +0 -0
  280. /package/build/{services → cjs/services}/reporter/index.js +0 -0
  281. /package/build/{services → cjs/services}/serializer/index.d.ts +0 -0
  282. /package/build/{services → cjs/services}/serializer/index.js +0 -0
  283. /package/build/{services → cjs/services}/signaler/store.d.ts +0 -0
  284. /package/build/{services → cjs/services}/signaler/store.js +0 -0
  285. /package/build/{services → cjs/services}/signaler/stream.d.ts +0 -0
  286. /package/build/{services → cjs/services}/signaler/stream.js +0 -0
  287. /package/build/{services → cjs/services}/store/cache.d.ts +0 -0
  288. /package/build/{services → cjs/services}/store/cache.js +0 -0
  289. /package/build/{services → cjs/services}/store/clients/ioredis.d.ts +0 -0
  290. /package/build/{services → cjs/services}/store/clients/ioredis.js +0 -0
  291. /package/build/{services → cjs/services}/store/clients/redis.d.ts +0 -0
  292. /package/build/{services → cjs/services}/store/clients/redis.js +0 -0
  293. /package/build/{services → cjs/services}/store/index.d.ts +0 -0
  294. /package/build/{services → cjs/services}/stream/clients/ioredis.d.ts +0 -0
  295. /package/build/{services → cjs/services}/stream/clients/ioredis.js +0 -0
  296. /package/build/{services → cjs/services}/stream/clients/redis.d.ts +0 -0
  297. /package/build/{services → cjs/services}/stream/clients/redis.js +0 -0
  298. /package/build/{services → cjs/services}/stream/index.d.ts +0 -0
  299. /package/build/{services → cjs/services}/stream/index.js +0 -0
  300. /package/build/{services → cjs/services}/sub/clients/ioredis.d.ts +0 -0
  301. /package/build/{services → cjs/services}/sub/clients/ioredis.js +0 -0
  302. /package/build/{services → cjs/services}/sub/clients/redis.d.ts +0 -0
  303. /package/build/{services → cjs/services}/sub/clients/redis.js +0 -0
  304. /package/build/{services → cjs/services}/sub/index.d.ts +0 -0
  305. /package/build/{services → cjs/services}/sub/index.js +0 -0
  306. /package/build/{services → cjs/services}/task/index.d.ts +0 -0
  307. /package/build/{services → cjs/services}/task/index.js +0 -0
  308. /package/build/{services → cjs/services}/telemetry/index.d.ts +0 -0
  309. /package/build/{services → cjs/services}/telemetry/index.js +0 -0
  310. /package/build/{services → cjs/services}/worker/index.d.ts +0 -0
  311. /package/build/{services → cjs/services}/worker/index.js +0 -0
  312. /package/build/{types → cjs/types}/activity.d.ts +0 -0
  313. /package/build/{types → cjs/types}/activity.js +0 -0
  314. /package/build/{types → cjs/types}/app.d.ts +0 -0
  315. /package/build/{types → cjs/types}/app.js +0 -0
  316. /package/build/{types → cjs/types}/async.d.ts +0 -0
  317. /package/build/{types → cjs/types}/async.js +0 -0
  318. /package/build/{types → cjs/types}/cache.d.ts +0 -0
  319. /package/build/{types → cjs/types}/cache.js +0 -0
  320. /package/build/{types → cjs/types}/collator.d.ts +0 -0
  321. /package/build/{types → cjs/types}/collator.js +0 -0
  322. /package/build/{types → cjs/types}/durable.d.ts +0 -0
  323. /package/build/{types → cjs/types}/durable.js +0 -0
  324. /package/build/{types → cjs/types}/hook.d.ts +0 -0
  325. /package/build/{types → cjs/types}/hook.js +0 -0
  326. /package/build/{types → cjs/types}/hotmesh.d.ts +0 -0
  327. /package/build/{types → cjs/types}/hotmesh.js +0 -0
  328. /package/build/{types → cjs/types}/index.d.ts +0 -0
  329. /package/build/{types → cjs/types}/index.js +0 -0
  330. /package/build/{types → cjs/types}/ioredisclient.d.ts +0 -0
  331. /package/build/{types → cjs/types}/ioredisclient.js +0 -0
  332. /package/build/{types → cjs/types}/job.d.ts +0 -0
  333. /package/build/{types → cjs/types}/job.js +0 -0
  334. /package/build/{types → cjs/types}/logger.d.ts +0 -0
  335. /package/build/{types → cjs/types}/logger.js +0 -0
  336. /package/build/{types → cjs/types}/map.d.ts +0 -0
  337. /package/build/{types → cjs/types}/map.js +0 -0
  338. /package/build/{types → cjs/types}/pipe.d.ts +0 -0
  339. /package/build/{types → cjs/types}/pipe.js +0 -0
  340. /package/build/{types → cjs/types}/quorum.d.ts +0 -0
  341. /package/build/{types → cjs/types}/quorum.js +0 -0
  342. /package/build/{types → cjs/types}/redis.d.ts +0 -0
  343. /package/build/{types → cjs/types}/redis.js +0 -0
  344. /package/build/{types → cjs/types}/redisclient.d.ts +0 -0
  345. /package/build/{types → cjs/types}/redisclient.js +0 -0
  346. /package/build/{types → cjs/types}/serializer.d.ts +0 -0
  347. /package/build/{types → cjs/types}/serializer.js +0 -0
  348. /package/build/{types → cjs/types}/stats.d.ts +0 -0
  349. /package/build/{types → cjs/types}/stats.js +0 -0
  350. /package/build/{types → cjs/types}/stream.d.ts +0 -0
  351. /package/build/{types → cjs/types}/stream.js +0 -0
  352. /package/build/{types → cjs/types}/telemetry.d.ts +0 -0
  353. /package/build/{types → cjs/types}/telemetry.js +0 -0
  354. /package/build/{types → cjs/types}/transition.d.ts +0 -0
  355. /package/build/{types → cjs/types}/transition.js +0 -0
@@ -0,0 +1,131 @@
1
+ import { Pipe } from "../pipe";
2
+ class Validator {
3
+ constructor(manifest) {
4
+ this.manifest = null;
5
+ this.activityIds = [];
6
+ this.mappingStatements = {};
7
+ this.store = null;
8
+ this.manifest = manifest;
9
+ }
10
+ /**
11
+ * validate the manifest file
12
+ */
13
+ async validate(store) {
14
+ this.store = store;
15
+ this.getMappingStatements();
16
+ this.validateActivityIds();
17
+ this.validateReferencedActivityIds();
18
+ this.validateMappingStatements();
19
+ this.validateTransitions();
20
+ this.validateTransitionConditions();
21
+ this.validateStats();
22
+ this.validateSchemas();
23
+ this.validateUniqueHandledTopics();
24
+ this.validateGraphPublishSubscribe();
25
+ this.validateHooks();
26
+ this.validateConditionalStatements();
27
+ }
28
+ // 1.1) Validate the manifest file activity ids are unique (no duplicates)
29
+ validateActivityIds() {
30
+ const activityIdsSet = new Set();
31
+ this.manifest.app.graphs.forEach((graph) => {
32
+ const ids = Object.keys(graph.activities);
33
+ // Check for duplicates and add ids to the set
34
+ ids.forEach((id) => {
35
+ if (activityIdsSet.has(id)) {
36
+ throw new Error(`Duplicate activity id found: ${id}`);
37
+ }
38
+ else {
39
+ activityIdsSet.add(id);
40
+ }
41
+ });
42
+ });
43
+ this.activityIds = Array.from(activityIdsSet);
44
+ }
45
+ isMappingStatement(value) {
46
+ return typeof value === 'string' && value.startsWith('{') && value.endsWith('}');
47
+ }
48
+ extractMappingStatements(obj, result, currentActivityId) {
49
+ for (const key in obj) {
50
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
51
+ this.extractMappingStatements(obj[key], result, currentActivityId);
52
+ }
53
+ else if (this.isMappingStatement(obj[key])) {
54
+ if (!result[currentActivityId]) {
55
+ result[currentActivityId] = [];
56
+ }
57
+ result[currentActivityId].push(obj[key]);
58
+ }
59
+ }
60
+ }
61
+ getMappingStatements() {
62
+ const mappingStatements = {};
63
+ this.manifest.app.graphs.forEach((graph) => {
64
+ const activities = graph.activities;
65
+ for (const activityId in activities) {
66
+ const activity = activities[activityId];
67
+ this.extractMappingStatements(activity, mappingStatements, activityId);
68
+ }
69
+ });
70
+ this.mappingStatements = mappingStatements;
71
+ }
72
+ // 1.2) Validate no activity ids are referenced that don't exist
73
+ validateReferencedActivityIds() {
74
+ // get list of all mapping statements and validate
75
+ const mappingStatements = this.mappingStatements;
76
+ const activityIds = this.activityIds;
77
+ for (const activity in mappingStatements) {
78
+ const statements = mappingStatements[activity];
79
+ statements.forEach((statement) => {
80
+ if (statement.startsWith('{') && statement.endsWith('}')) {
81
+ const statementParts = statement.slice(1, -1).split('.');
82
+ const referencedActivityId = statementParts[0];
83
+ if (!(Validator.SYS_VARS.includes(referencedActivityId) || activityIds.includes(referencedActivityId) || this.isFunction(statement))) {
84
+ throw new Error(`Mapping statement references non-existent activity: ${statement}`);
85
+ }
86
+ }
87
+ });
88
+ }
89
+ }
90
+ isFunction(value) {
91
+ return value.startsWith('{@') && Pipe.resolveFunction(value);
92
+ }
93
+ // 1.3) Validate the mapping/@pipe statements are valid
94
+ validateMappingStatements() {
95
+ // Implement the method content
96
+ }
97
+ // 1.4) Validate the transitions are valid
98
+ validateTransitions() {
99
+ // Implement the method content
100
+ }
101
+ // 1.5) Validate the transition conditions are valid
102
+ validateTransitionConditions() {
103
+ // Implement the method content
104
+ }
105
+ // 1.6) Validate the stats
106
+ validateStats() {
107
+ // Implement the method content
108
+ }
109
+ // 1.7) Validate the schemas
110
+ validateSchemas() {
111
+ // Implement the method content
112
+ }
113
+ // 1.8) Validate the topics are unique and handled
114
+ validateUniqueHandledTopics() {
115
+ // Implement the method content
116
+ }
117
+ // 1.9) Validate that every graph has publishes and subscribes
118
+ validateGraphPublishSubscribe() {
119
+ // Implement the method content
120
+ }
121
+ // 1.10) Validate hooks, including mapping statements
122
+ validateHooks() {
123
+ // Implement the method content
124
+ }
125
+ // 1.11) Validate conditional statements
126
+ validateConditionalStatements() {
127
+ // Implement the method content
128
+ }
129
+ }
130
+ Validator.SYS_VARS = ['$app', '$self', '$graph', '$job'];
131
+ export { Validator };
@@ -0,0 +1,13 @@
1
+ import { RedisClientOptions, RedisClassType, RedisClientType } from '../../../types/ioredisclient';
2
+ declare class RedisConnection {
3
+ private connection;
4
+ private static instances;
5
+ private id;
6
+ private static clientOptions;
7
+ private createConnection;
8
+ getClient(): RedisClientType;
9
+ disconnect(): Promise<void>;
10
+ static connect(id: string, Redis: RedisClassType, options?: RedisClientOptions): Promise<RedisConnection>;
11
+ static disconnectAll(): Promise<void>;
12
+ }
13
+ export { RedisConnection };
@@ -0,0 +1,47 @@
1
+ class RedisConnection {
2
+ constructor() {
3
+ this.connection = null;
4
+ this.id = null;
5
+ }
6
+ async createConnection(Redis, options) {
7
+ return new Redis(options);
8
+ }
9
+ getClient() {
10
+ if (!this.connection) {
11
+ throw new Error('Redis client is not connected');
12
+ }
13
+ return this.connection;
14
+ }
15
+ async disconnect() {
16
+ if (this.connection) {
17
+ await this.connection.quit();
18
+ this.connection = null;
19
+ }
20
+ if (this.id) {
21
+ RedisConnection.instances.delete(this.id);
22
+ }
23
+ }
24
+ static async connect(id, Redis, options) {
25
+ if (this.instances.has(id)) {
26
+ return this.instances.get(id);
27
+ }
28
+ const instance = new RedisConnection();
29
+ const opts = options ? { ...options } : { ...this.clientOptions };
30
+ instance.connection = await instance.createConnection(Redis, opts);
31
+ instance.id = id;
32
+ this.instances.set(id, instance);
33
+ return instance;
34
+ }
35
+ static async disconnectAll() {
36
+ await Promise.all(Array.from(this.instances.values()).map((instance) => instance.disconnect()));
37
+ this.instances.clear();
38
+ }
39
+ }
40
+ RedisConnection.instances = new Map();
41
+ RedisConnection.clientOptions = {
42
+ host: 'localhost',
43
+ port: 6379,
44
+ //password: config.REDIS_PASSWORD,
45
+ //db: config.REDIS_DATABASE,
46
+ };
47
+ export { RedisConnection };
@@ -0,0 +1,13 @@
1
+ import { RedisClientType, RedisClientOptions, RedisClassType } from '../../../types/redisclient';
2
+ declare class RedisConnection {
3
+ private connection;
4
+ private static instances;
5
+ private id;
6
+ private static clientOptions;
7
+ private createConnection;
8
+ getClient(): RedisClientType;
9
+ disconnect(): Promise<void>;
10
+ static connect(id: string, Redis: RedisClassType, options?: RedisClientOptions): Promise<RedisConnection>;
11
+ static disconnectAll(): Promise<void>;
12
+ }
13
+ export { RedisConnection, RedisClientType };
@@ -0,0 +1,59 @@
1
+ class RedisConnection {
2
+ constructor() {
3
+ this.connection = null;
4
+ this.id = null;
5
+ }
6
+ async createConnection(Redis, options) {
7
+ return new Promise((resolve, reject) => {
8
+ const client = Redis.createClient(options);
9
+ client.on('error', (error) => {
10
+ reject(error);
11
+ });
12
+ client.on('ready', () => {
13
+ resolve(client);
14
+ });
15
+ client.connect();
16
+ });
17
+ }
18
+ getClient() {
19
+ if (!this.connection) {
20
+ throw new Error('Redis client is not connected');
21
+ }
22
+ return this.connection;
23
+ }
24
+ async disconnect() {
25
+ if (this.connection) {
26
+ await this.connection.quit();
27
+ this.connection = null;
28
+ }
29
+ if (this.id) {
30
+ RedisConnection.instances.delete(this.id);
31
+ }
32
+ }
33
+ static async connect(id, Redis, options) {
34
+ if (this.instances.has(id)) {
35
+ return this.instances.get(id);
36
+ }
37
+ const instance = new RedisConnection();
38
+ const opts = options ? { ...options } : { ...this.clientOptions };
39
+ instance.connection = await instance.createConnection(Redis, opts);
40
+ instance.id = id;
41
+ this.instances.set(id, instance);
42
+ return instance;
43
+ }
44
+ static async disconnectAll() {
45
+ await Promise.all(Array.from(this.instances.values()).map((instance) => instance.disconnect()));
46
+ this.instances.clear();
47
+ }
48
+ }
49
+ RedisConnection.instances = new Map();
50
+ RedisConnection.clientOptions = {
51
+ socket: {
52
+ host: 'localhost',
53
+ port: 6379,
54
+ tls: false,
55
+ },
56
+ //password: config.REDIS_PASSWORD,
57
+ //database: config.REDIS_DATABASE,
58
+ };
59
+ export { RedisConnection };
@@ -0,0 +1,5 @@
1
+ import { HotMeshEngine, HotMeshWorker } from '../../types/hotmesh';
2
+ import { RedisClass, RedisOptions } from '../../types/redis';
3
+ export declare class ConnectorService {
4
+ static initRedisClients(Redis: RedisClass, options: RedisOptions, target: HotMeshEngine | HotMeshWorker): Promise<void>;
5
+ }
@@ -0,0 +1,27 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+ import { identifyRedisTypeFromClass } from '../../modules/utils';
3
+ import { RedisConnection as IORedisConnection } from '../connector/clients/ioredis';
4
+ import { RedisConnection } from '../connector/clients/redis';
5
+ export class ConnectorService {
6
+ //1) Initialize `store`, `stream`, and `subscription` Redis clients.
7
+ //2) Bind to the target if not already present
8
+ static async initRedisClients(Redis, options, target) {
9
+ if (!target.store || !target.stream || !target.sub) {
10
+ const instances = [];
11
+ if (identifyRedisTypeFromClass(Redis) === 'redis') {
12
+ for (let i = 1; i <= 3; i++) {
13
+ instances.push(RedisConnection.connect(uuidv4(), Redis, options));
14
+ }
15
+ }
16
+ else {
17
+ for (let i = 1; i <= 3; i++) {
18
+ instances.push(IORedisConnection.connect(uuidv4(), Redis, options));
19
+ }
20
+ }
21
+ const [store, stream, sub] = await Promise.all(instances);
22
+ target.store = target.store || store.getClient();
23
+ target.stream = target.stream || stream.getClient();
24
+ target.sub = target.sub || sub.getClient();
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,29 @@
1
+ import { HotMeshGraph } from '../../types/hotmesh';
2
+ declare class DimensionService {
3
+ static targetLength: number;
4
+ /**
5
+ * entry point for compiler-type activities. This is called by the compiler
6
+ * to bind the sorted activity IDs to the trigger activity. These are then used
7
+ * at runtime by the activities to track job/activity status.
8
+ * @param graphs
9
+ */
10
+ static compile(graphs: HotMeshGraph[]): void;
11
+ /**
12
+ * All activities exist on a dimensional plane. Zero
13
+ * is the default and is implied if no dimension is
14
+ * present in the hash item key. EVERY value in the
15
+ * job ledger is dimensionalized even if the dimension
16
+ * is not present. The key, `AaA`, might not contain
17
+ * a dimensional index, but it is still implicitly
18
+ * dimensionalized as `AaA,0` (assuming a trigger).
19
+ * A value of `AxY,0,0,0,0,1,0,0` would reflect that
20
+ * an ancestor activity was dimensionalized beyond
21
+ * the default. The dimensional string must
22
+ * be included if not zero. There is likely a preceding
23
+ * sibling dimension, so it would not need to include
24
+ * the suffix, so these addresses are equivalent:
25
+ * `AxY,0,0,0,0,0,0,0` == `AxY` for said sibling.
26
+ */
27
+ static getSeed(index?: number): string;
28
+ }
29
+ export { DimensionService };
@@ -0,0 +1,32 @@
1
+ class DimensionService {
2
+ /**
3
+ * entry point for compiler-type activities. This is called by the compiler
4
+ * to bind the sorted activity IDs to the trigger activity. These are then used
5
+ * at runtime by the activities to track job/activity status.
6
+ * @param graphs
7
+ */
8
+ static compile(graphs) {
9
+ }
10
+ /**
11
+ * All activities exist on a dimensional plane. Zero
12
+ * is the default and is implied if no dimension is
13
+ * present in the hash item key. EVERY value in the
14
+ * job ledger is dimensionalized even if the dimension
15
+ * is not present. The key, `AaA`, might not contain
16
+ * a dimensional index, but it is still implicitly
17
+ * dimensionalized as `AaA,0` (assuming a trigger).
18
+ * A value of `AxY,0,0,0,0,1,0,0` would reflect that
19
+ * an ancestor activity was dimensionalized beyond
20
+ * the default. The dimensional string must
21
+ * be included if not zero. There is likely a preceding
22
+ * sibling dimension, so it would not need to include
23
+ * the suffix, so these addresses are equivalent:
24
+ * `AxY,0,0,0,0,0,0,0` == `AxY` for said sibling.
25
+ */
26
+ static getSeed(index = 0) {
27
+ return `,${index}`;
28
+ }
29
+ }
30
+ //max int digit count that supports `hincrby`
31
+ DimensionService.targetLength = 15;
32
+ export { DimensionService };
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ import { AsyncLocalStorage } from 'async_hooks';
3
+ export declare const asyncLocalStorage: AsyncLocalStorage<Map<string, any>>;
@@ -0,0 +1,2 @@
1
+ import { AsyncLocalStorage } from 'async_hooks';
2
+ export const asyncLocalStorage = new AsyncLocalStorage();
@@ -0,0 +1,15 @@
1
+ import { WorkflowHandleService } from './handle';
2
+ import { HotMeshService as HotMesh } from '../hotmesh';
3
+ import { ClientConfig, Connection, WorkflowOptions } from '../../types/durable';
4
+ export declare class ClientService {
5
+ connection: Connection;
6
+ options: WorkflowOptions;
7
+ static instances: Map<string, HotMesh | Promise<HotMesh>>;
8
+ constructor(config: ClientConfig);
9
+ getHotMesh: (worflowTopic: string) => Promise<HotMesh>;
10
+ workflow: {
11
+ start: (options: WorkflowOptions) => Promise<WorkflowHandleService>;
12
+ };
13
+ activateWorkflow(hotMesh: HotMesh, workflowTopic: string): Promise<void>;
14
+ static shutdown(): Promise<void>;
15
+ }
@@ -0,0 +1,114 @@
1
+ import { WorkflowHandleService } from './handle';
2
+ import { HotMeshService as HotMesh } from '../hotmesh';
3
+ import { getWorkflowYAML } from './factory';
4
+ /*
5
+ Here is an example of how the methods in this file are used:
6
+
7
+ ./client.ts
8
+
9
+ import { Durable } from '@hotmeshio/hotmesh';
10
+ import Redis from 'ioredis';
11
+ import { example } from './workflows';
12
+ import { v4 as uuidv4 } from 'uuid';
13
+
14
+ async function run() {
15
+ const connection = await Durable.Connection.connect({
16
+ class: Redis,
17
+ options: {
18
+ host: 'localhost',
19
+ port: 6379,
20
+ },
21
+ });
22
+
23
+ const client = new Durable.Client({
24
+ connection,
25
+ });
26
+
27
+ const handle = await client.workflow.start({
28
+ args: ['HotMesh'],
29
+ taskQueue: 'hello-world',
30
+ workflowName: 'example',
31
+ workflowId: 'workflow-' + uuidv4(),
32
+ });
33
+
34
+ console.log(`Started workflow ${handle.workflowId}`);
35
+ console.log(await handle.result());
36
+ }
37
+
38
+ run().catch((err) => {
39
+ console.error(err);
40
+ process.exit(1);
41
+ });
42
+
43
+ */
44
+ class ClientService {
45
+ constructor(config) {
46
+ this.getHotMesh = async (worflowTopic) => {
47
+ if (ClientService.instances.has(worflowTopic)) {
48
+ return await ClientService.instances.get(worflowTopic);
49
+ }
50
+ const hotMesh = HotMesh.init({
51
+ appId: worflowTopic,
52
+ engine: {
53
+ redis: {
54
+ class: this.connection.class,
55
+ options: this.connection.options,
56
+ }
57
+ }
58
+ });
59
+ ClientService.instances.set(worflowTopic, hotMesh);
60
+ await this.activateWorkflow(await hotMesh, worflowTopic);
61
+ return hotMesh;
62
+ };
63
+ this.workflow = {
64
+ start: async (options) => {
65
+ const taskQueueName = options.taskQueue;
66
+ const workflowName = options.workflowName;
67
+ const trc = options.workflowTrace;
68
+ const spn = options.workflowSpan;
69
+ const workflowTopic = `${taskQueueName}-${workflowName}`;
70
+ const hotMesh = await this.getHotMesh(workflowTopic);
71
+ const payload = {
72
+ arguments: [...options.args],
73
+ workflowId: options.workflowId,
74
+ };
75
+ const context = { metadata: { trc, spn }, data: {} };
76
+ const jobId = await hotMesh.pub(workflowTopic, payload, context);
77
+ return new WorkflowHandleService(hotMesh, workflowTopic, jobId);
78
+ },
79
+ };
80
+ this.connection = config.connection;
81
+ }
82
+ async activateWorkflow(hotMesh, workflowTopic) {
83
+ const version = '1';
84
+ const app = await hotMesh.engine.store.getApp(workflowTopic);
85
+ const appVersion = app?.version;
86
+ if (isNaN(appVersion)) {
87
+ try {
88
+ await hotMesh.deploy(getWorkflowYAML(workflowTopic, version));
89
+ await hotMesh.activate(version);
90
+ }
91
+ catch (err) {
92
+ hotMesh.engine.logger.error('durable-client-deploy-activate-err', err);
93
+ throw err;
94
+ }
95
+ }
96
+ else if (app && !app.active) {
97
+ try {
98
+ await hotMesh.activate(version);
99
+ }
100
+ catch (err) {
101
+ hotMesh.engine.logger.error('durable-client-activate-err', err);
102
+ throw err;
103
+ }
104
+ }
105
+ }
106
+ static async shutdown() {
107
+ for (const [key, value] of ClientService.instances) {
108
+ const hotMesh = await value;
109
+ await hotMesh.stop();
110
+ }
111
+ }
112
+ }
113
+ ClientService.instances = new Map();
114
+ export { ClientService };
@@ -0,0 +1,4 @@
1
+ import { Connection, ConnectionConfig } from "../../types/durable";
2
+ export declare class ConnectionService {
3
+ static connect(config: ConnectionConfig): Promise<Connection>;
4
+ }
@@ -0,0 +1,47 @@
1
+ /*
2
+ Here is an example of how the methods in this file are used:
3
+
4
+ ./client.ts
5
+
6
+ import { Durable } from '@hotmeshio/hotmesh';
7
+ import Redis from 'ioredis';
8
+ import { v4 as uuidv4 } from 'uuid';
9
+
10
+ async function run() {
11
+ const connection = await Durable.Connection.connect({
12
+ class: Redis,
13
+ options: {
14
+ host: 'localhost',
15
+ port: 6379,
16
+ },
17
+ });
18
+
19
+ const client = new Durable.Client({
20
+ connection,
21
+ });
22
+
23
+ const handle = await client.workflow.start(example, {
24
+ taskQueue: 'hello-world',
25
+ args: ['HotMesh'],
26
+ workflowName: 'example',
27
+ workflowId: uuidv4(),
28
+ });
29
+
30
+ console.log(`Started workflow ${handle.workflowId}`);
31
+ console.log(await handle.result());
32
+ }
33
+
34
+ run().catch((err) => {
35
+ console.error(err);
36
+ process.exit(1);
37
+ });
38
+
39
+ */
40
+ export class ConnectionService {
41
+ static async connect(config) {
42
+ return {
43
+ class: config.class,
44
+ options: { ...config.options },
45
+ };
46
+ }
47
+ }
@@ -0,0 +1,3 @@
1
+ declare const getWorkflowYAML: (topic: string, version?: string) => string;
2
+ declare const getActivityYAML: (topic: string, version?: string) => string;
3
+ export { getActivityYAML, getWorkflowYAML };
@@ -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 };