@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,423 @@
1
+ import { KeyType } from '../../modules/key';
2
+ import { getSymKey } from '../../modules/utils';
3
+ import { CollatorService } from '../collator';
4
+ import { SerializerService } from '../serializer';
5
+ const DEFAULT_METADATA_RANGE_SIZE = 26; //metadata is 26 slots ([a-z] * 1)
6
+ const DEFAULT_DATA_RANGE_SIZE = 260; //data is 260 slots ([a-zA-Z] * 5)
7
+ const DEFAULT_RANGE_SIZE = DEFAULT_METADATA_RANGE_SIZE + DEFAULT_DATA_RANGE_SIZE;
8
+ class Deployer {
9
+ constructor(manifest) {
10
+ this.manifest = null;
11
+ this.manifest = manifest;
12
+ }
13
+ async deploy(store) {
14
+ this.store = store;
15
+ CollatorService.compile(this.manifest.app.graphs);
16
+ this.convertTopicsToTypes();
17
+ this.copyJobSchemas();
18
+ this.bindBackRefs();
19
+ this.bindParents();
20
+ this.resolveMappingDependencies();
21
+ this.resolveJobMapsPaths();
22
+ await this.generateSymKeys();
23
+ await this.generateSymVals();
24
+ await this.deployHookPatterns();
25
+ await this.deployActivitySchemas();
26
+ await this.deploySubscriptions();
27
+ await this.deployTransitions();
28
+ await this.deployConsumerGroups();
29
+ }
30
+ getVID() {
31
+ return {
32
+ id: this.manifest.app.id,
33
+ version: this.manifest.app.version,
34
+ };
35
+ }
36
+ async generateSymKeys() {
37
+ //note: symbol ranges are additive (per version); path assignments are immutable
38
+ const appId = this.manifest.app.id;
39
+ for (const graph of this.manifest.app.graphs) {
40
+ //generate JOB symbols
41
+ const [, trigger] = this.findTrigger(graph);
42
+ const topic = trigger.subscribes;
43
+ const [lower, upper, symbols] = await this.store.reserveSymbolRange(`$${topic}`, DEFAULT_RANGE_SIZE, 'JOB');
44
+ const prefix = ''; //job meta/data is NOT namespaced
45
+ const newSymbols = this.bindSymbols(lower, upper, symbols, prefix, trigger.PRODUCES);
46
+ if (Object.keys(newSymbols).length) {
47
+ await this.store.addSymbols(`$${topic}`, newSymbols);
48
+ }
49
+ //generate ACTIVITY symbols
50
+ for (const [activityId, activity] of Object.entries(graph.activities)) {
51
+ const [lower, upper, symbols] = await this.store.reserveSymbolRange(activityId, DEFAULT_RANGE_SIZE, 'ACTIVITY');
52
+ const prefix = `${activityId}/`; //activity meta/data is namespaced
53
+ this.bindSelf(activity.consumes, activity.produces, activityId);
54
+ const newSymbols = this.bindSymbols(lower, upper, symbols, prefix, activity.produces);
55
+ if (Object.keys(newSymbols).length) {
56
+ await this.store.addSymbols(activityId, newSymbols);
57
+ }
58
+ }
59
+ }
60
+ }
61
+ bindSelf(consumes, produces, activityId) {
62
+ //bind self-referential mappings
63
+ for (const selfId of [activityId, '$self']) {
64
+ const selfConsumes = consumes[selfId];
65
+ if (selfConsumes) {
66
+ for (const path of selfConsumes) {
67
+ if (!produces.includes(path)) {
68
+ produces.push(path);
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+ bindSymbols(startIndex, maxIndex, existingSymbols, prefix, produces) {
75
+ let newSymbols = {};
76
+ let currentSymbols = { ...existingSymbols };
77
+ for (let path of produces) {
78
+ const fullPath = `${prefix}${path}`;
79
+ if (!currentSymbols[fullPath]) {
80
+ if (startIndex > maxIndex) {
81
+ throw new Error('Symbol index out of bounds');
82
+ }
83
+ const symbol = getSymKey(startIndex);
84
+ startIndex++;
85
+ newSymbols[fullPath] = symbol;
86
+ currentSymbols[fullPath] = symbol; // update the currentSymbols to include this new symbol
87
+ }
88
+ }
89
+ return newSymbols;
90
+ }
91
+ copyJobSchemas() {
92
+ const graphs = this.manifest.app.graphs;
93
+ for (const graph of graphs) {
94
+ const jobSchema = graph.output?.schema;
95
+ const outputSchema = graph.input?.schema;
96
+ if (!jobSchema && !outputSchema)
97
+ continue;
98
+ const activities = graph.activities;
99
+ // Find the trigger activity and bind the job schema to it
100
+ // at execution time, the trigger is a standin for the job
101
+ for (const activityKey in activities) {
102
+ if (activities[activityKey].type === 'trigger') {
103
+ const trigger = activities[activityKey];
104
+ if (jobSchema) {
105
+ //possible for trigger to have job mappings
106
+ if (!trigger.job) {
107
+ trigger.job = {};
108
+ }
109
+ trigger.job.schema = jobSchema;
110
+ }
111
+ if (outputSchema) {
112
+ //impossible for trigger to have output mappings.
113
+ trigger.output = { schema: outputSchema };
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ bindBackRefs() {
120
+ for (const graph of this.manifest.app.graphs) {
121
+ const activities = graph.activities;
122
+ const triggerId = this.findTrigger(graph)[0];
123
+ for (const activityKey in activities) {
124
+ activities[activityKey].trigger = triggerId;
125
+ activities[activityKey].subscribes = graph.subscribes;
126
+ if (graph.publishes) {
127
+ activities[activityKey].publishes = graph.publishes;
128
+ }
129
+ if (graph.expire) {
130
+ activities[activityKey].expire = graph.expire;
131
+ }
132
+ }
133
+ }
134
+ }
135
+ //more intuitive for SDK users to use 'topic',
136
+ //but the compiler is desiged to be generic and uses 'subtypes'
137
+ convertTopicsToTypes() {
138
+ for (const graph of this.manifest.app.graphs) {
139
+ const activities = graph.activities;
140
+ for (const activityKey in activities) {
141
+ const activity = activities[activityKey];
142
+ if (['worker', 'await'].includes(activity.type) && activity.topic && !activity.subtype) {
143
+ activity.subtype = activity.topic;
144
+ }
145
+ }
146
+ }
147
+ }
148
+ async bindParents() {
149
+ const graphs = this.manifest.app.graphs;
150
+ for (const graph of graphs) {
151
+ if (graph.transitions) {
152
+ for (const fromActivity in graph.transitions) {
153
+ const toTransitions = graph.transitions[fromActivity];
154
+ for (const transition of toTransitions) {
155
+ const to = transition.to;
156
+ //DAGs have one parent; easy to optimize for
157
+ graph.activities[to].parent = fromActivity;
158
+ }
159
+ }
160
+ }
161
+ }
162
+ }
163
+ collectValues(schema, values) {
164
+ for (const [key, value] of Object.entries(schema)) {
165
+ if (key === 'enum' || key === 'examples' || key === 'default') {
166
+ if (Array.isArray(value)) {
167
+ for (const v of value) {
168
+ if (typeof v === 'string' && v.length > 5) {
169
+ values.add(v);
170
+ }
171
+ }
172
+ }
173
+ else if (typeof value === 'string' && value.length > 5) {
174
+ values.add(value);
175
+ }
176
+ }
177
+ else if (typeof value === 'object') {
178
+ this.collectValues(value, values);
179
+ }
180
+ }
181
+ }
182
+ traverse(obj, values) {
183
+ for (const value of Object.values(obj)) {
184
+ if (typeof value === 'object') {
185
+ if ('schema' in value) {
186
+ this.collectValues(value.schema, values);
187
+ }
188
+ else {
189
+ this.traverse(value, values);
190
+ }
191
+ }
192
+ }
193
+ }
194
+ async generateSymVals() {
195
+ const uniqueStrings = new Set();
196
+ for (const graph of this.manifest.app.graphs) {
197
+ this.traverse(graph, uniqueStrings);
198
+ }
199
+ const existingSymbols = await this.store.getSymbolValues();
200
+ const startIndex = Object.keys(existingSymbols).length;
201
+ const maxIndex = Math.pow(52, 2) - 1;
202
+ const newSymbols = SerializerService.filterSymVals(startIndex, maxIndex, existingSymbols, uniqueStrings);
203
+ await this.store.addSymbolValues(newSymbols);
204
+ }
205
+ resolveJobMapsPaths() {
206
+ function parsePaths(obj) {
207
+ let result = [];
208
+ function traverse(obj, path = []) {
209
+ for (let key in obj) {
210
+ if (typeof obj[key] === 'object' && obj[key] !== null && !('@pipe' in obj[key])) {
211
+ let newPath = [...path, key];
212
+ traverse(obj[key], newPath);
213
+ }
214
+ else {
215
+ const finalPath = `data/${[...path, key].join('/')}`;
216
+ if (!result.includes(finalPath)) {
217
+ result.push(finalPath);
218
+ }
219
+ }
220
+ }
221
+ }
222
+ if (obj) {
223
+ traverse(obj);
224
+ }
225
+ return result;
226
+ }
227
+ for (const graph of this.manifest.app.graphs) {
228
+ let results = [];
229
+ const [, trigger] = this.findTrigger(graph);
230
+ for (const activityKey in graph.activities) {
231
+ const activity = graph.activities[activityKey];
232
+ results = results.concat(parsePaths(activity.job?.maps));
233
+ }
234
+ trigger.PRODUCES = results;
235
+ }
236
+ }
237
+ resolveMappingDependencies() {
238
+ const dynamicMappingRules = [];
239
+ //recursive function to descend into the object and find all dynamic mapping rules
240
+ function traverse(obj, consumes) {
241
+ for (const key in obj) {
242
+ if (typeof obj[key] === 'string') {
243
+ const stringValue = obj[key];
244
+ const dynamicMappingRuleMatch = stringValue.match(/^\{[^@].*}$/);
245
+ if (dynamicMappingRuleMatch) {
246
+ if (stringValue.split('.')[1] !== 'input') {
247
+ dynamicMappingRules.push(stringValue);
248
+ consumes.push(stringValue);
249
+ }
250
+ }
251
+ }
252
+ else if (typeof obj[key] === 'object' && obj[key] !== null) {
253
+ traverse(obj[key], consumes);
254
+ }
255
+ }
256
+ }
257
+ const graphs = this.manifest.app.graphs;
258
+ for (const graph of graphs) {
259
+ const activities = graph.activities;
260
+ for (const activityId in activities) {
261
+ const activity = activities[activityId];
262
+ activity.consumes = [];
263
+ traverse(activity, activity.consumes);
264
+ activity.consumes = this.groupMappingRules(activity.consumes);
265
+ }
266
+ }
267
+ const groupedRules = this.groupMappingRules(dynamicMappingRules);
268
+ // Iterate through the graph and add 'produces' field to each activity
269
+ for (const graph of graphs) {
270
+ const activities = graph.activities;
271
+ for (const activityId in activities) {
272
+ const activity = activities[activityId];
273
+ activity.produces = groupedRules[`${activityId}`] || [];
274
+ }
275
+ }
276
+ }
277
+ groupMappingRules(rules) {
278
+ rules = Array.from(new Set(rules)).sort();
279
+ // Group by the first symbol before the period (this is the activity name)
280
+ const groupedRules = {};
281
+ for (const rule of rules) {
282
+ const [group, resolved] = this.resolveMappableValue(rule);
283
+ if (!groupedRules[group]) {
284
+ groupedRules[group] = [];
285
+ }
286
+ groupedRules[group].push(resolved);
287
+ }
288
+ return groupedRules;
289
+ }
290
+ resolveMappableValue(mappable) {
291
+ mappable = mappable.substring(1, mappable.length - 1);
292
+ const parts = mappable.split('.');
293
+ if (parts[0] === '$job') {
294
+ const [group, ...path] = parts;
295
+ return [group, path.join('/')];
296
+ }
297
+ else {
298
+ //normalize paths to be relative to the activity
299
+ const [group, type, subtype, ...path] = parts;
300
+ const prefix = {
301
+ hook: 'hook/data',
302
+ input: 'input/data',
303
+ output: subtype === 'data' ? 'output/data' : 'output/metadata'
304
+ }[type];
305
+ return [group, `${prefix}/${path.join('/')}`];
306
+ }
307
+ }
308
+ async deployActivitySchemas() {
309
+ const graphs = this.manifest.app.graphs;
310
+ const activitySchemas = {};
311
+ for (const graph of graphs) {
312
+ const activities = graph.activities;
313
+ for (const activityKey in activities) {
314
+ activitySchemas[activityKey] = activities[activityKey];
315
+ }
316
+ }
317
+ await this.store.setSchemas(activitySchemas, this.getVID());
318
+ }
319
+ async deploySubscriptions() {
320
+ const graphs = this.manifest.app.graphs;
321
+ const publicSubscriptions = {};
322
+ for (const graph of graphs) {
323
+ const activities = graph.activities;
324
+ const subscribesTopic = graph.subscribes;
325
+ // Find the activity ID associated with the subscribes topic
326
+ for (const activityKey in activities) {
327
+ if (activities[activityKey].type === 'trigger') {
328
+ publicSubscriptions[subscribesTopic] = activityKey;
329
+ break;
330
+ }
331
+ }
332
+ }
333
+ await this.store.setSubscriptions(publicSubscriptions, this.getVID());
334
+ }
335
+ findTrigger(graph) {
336
+ for (const activityKey in graph.activities) {
337
+ const activity = graph.activities[activityKey];
338
+ if (activity.type === 'trigger') {
339
+ return [activityKey, activity];
340
+ }
341
+ }
342
+ return null;
343
+ }
344
+ async deployTransitions() {
345
+ const graphs = this.manifest.app.graphs;
346
+ const privateSubscriptions = {};
347
+ for (const graph of graphs) {
348
+ if (graph.subscribes && graph.subscribes.startsWith('.')) {
349
+ const [triggerId] = this.findTrigger(graph);
350
+ if (triggerId) {
351
+ privateSubscriptions[graph.subscribes] = { [triggerId]: true };
352
+ }
353
+ }
354
+ if (graph.transitions) {
355
+ for (const fromActivity in graph.transitions) {
356
+ const toTransitions = graph.transitions[fromActivity];
357
+ const toValues = {};
358
+ for (const transition of toTransitions) {
359
+ const to = transition.to;
360
+ if (transition.conditions) {
361
+ toValues[to] = transition.conditions;
362
+ }
363
+ else {
364
+ toValues[to] = true;
365
+ }
366
+ }
367
+ if (Object.keys(toValues).length > 0) {
368
+ privateSubscriptions['.' + fromActivity] = toValues;
369
+ }
370
+ }
371
+ }
372
+ }
373
+ await this.store.setTransitions(privateSubscriptions, this.getVID());
374
+ }
375
+ async deployHookPatterns() {
376
+ const graphs = this.manifest.app.graphs;
377
+ const hookRules = {};
378
+ for (const graph of graphs) {
379
+ if (graph.hooks) {
380
+ for (const topic in graph.hooks) {
381
+ hookRules[topic] = graph.hooks[topic];
382
+ const activityId = graph.hooks[topic][0].to;
383
+ const targetActivity = graph.activities[activityId];
384
+ if (targetActivity) {
385
+ if (!targetActivity.hook) {
386
+ targetActivity.hook = {};
387
+ }
388
+ //create back-reference to the hook topic
389
+ targetActivity.hook.topic = topic;
390
+ }
391
+ }
392
+ }
393
+ }
394
+ await this.store.setHookRules(hookRules);
395
+ }
396
+ async deployConsumerGroups() {
397
+ //create one engine group
398
+ const params = { appId: this.manifest.app.id };
399
+ const key = this.store.mintKey(KeyType.STREAMS, params);
400
+ await this.deployConsumerGroup(key, 'ENGINE');
401
+ for (const graph of this.manifest.app.graphs) {
402
+ const activities = graph.activities;
403
+ for (const activityKey in activities) {
404
+ const activity = activities[activityKey];
405
+ if (activity.type === 'worker') {
406
+ params.topic = activity.subtype;
407
+ const key = this.store.mintKey(KeyType.STREAMS, params);
408
+ //create one worker group per unique activity subtype (the topic)
409
+ await this.deployConsumerGroup(key, 'WORKER');
410
+ }
411
+ }
412
+ }
413
+ }
414
+ async deployConsumerGroup(stream, group) {
415
+ try {
416
+ await this.store.xgroup('CREATE', stream, group, '$', 'MKSTREAM');
417
+ }
418
+ catch (err) {
419
+ this.store.logger.info('consumer-group-exists', { stream, group });
420
+ }
421
+ }
422
+ }
423
+ export { Deployer };
@@ -0,0 +1,30 @@
1
+ import { ILogger } from '../logger';
2
+ import { StoreService } from '../store';
3
+ import { HotMeshManifest } from '../../types/hotmesh';
4
+ import { RedisClient, RedisMulti } from '../../types/redis';
5
+ /**
6
+ * The compiler service converts a graph into a executable program.
7
+ */
8
+ declare class CompilerService {
9
+ store: StoreService<RedisClient, RedisMulti> | null;
10
+ logger: ILogger;
11
+ constructor(store: StoreService<RedisClient, RedisMulti>, logger: ILogger);
12
+ /**
13
+ * verifies and plans the deployment of an app to Redis; the app is not deployed yet
14
+ * @param path
15
+ */
16
+ plan(mySchemaOrPath: string): Promise<HotMeshManifest>;
17
+ isPath(input: string): boolean;
18
+ /**
19
+ * deploys an app to Redis but does NOT activate it.
20
+ */
21
+ deploy(mySchemaOrPath: string): Promise<HotMeshManifest>;
22
+ /**
23
+ * activates a deployed version of an app;
24
+ * @param appId
25
+ * @param appVersion
26
+ */
27
+ activate(appId: string, appVersion: string): Promise<boolean>;
28
+ saveAsJSON(originalPath: string, schema: HotMeshManifest): Promise<void>;
29
+ }
30
+ export { CompilerService };
@@ -0,0 +1,82 @@
1
+ import $RefParser from '@apidevtools/json-schema-ref-parser';
2
+ import yaml from 'js-yaml';
3
+ import * as fs from 'fs/promises';
4
+ import * as path from 'path';
5
+ import { Deployer } from './deployer';
6
+ import { Validator } from './validator';
7
+ /**
8
+ * The compiler service converts a graph into a executable program.
9
+ */
10
+ class CompilerService {
11
+ constructor(store, logger) {
12
+ this.store = store;
13
+ this.logger = logger;
14
+ }
15
+ /**
16
+ * verifies and plans the deployment of an app to Redis; the app is not deployed yet
17
+ * @param path
18
+ */
19
+ async plan(mySchemaOrPath) {
20
+ try {
21
+ let schema;
22
+ if (this.isPath(mySchemaOrPath)) {
23
+ schema = await $RefParser.dereference(mySchemaOrPath);
24
+ }
25
+ else {
26
+ schema = yaml.load(mySchemaOrPath);
27
+ }
28
+ // 1) validate the manifest file
29
+ const validator = new Validator(schema);
30
+ validator.validate(this.store);
31
+ // 2) todo: add a PlannerService module that will plan the deployment (what might break, drift, etc)
32
+ return schema;
33
+ }
34
+ catch (err) {
35
+ this.logger.error('compiler-plan-error', err);
36
+ }
37
+ }
38
+ isPath(input) {
39
+ return !input.trim().startsWith('app:');
40
+ }
41
+ /**
42
+ * deploys an app to Redis but does NOT activate it.
43
+ */
44
+ async deploy(mySchemaOrPath) {
45
+ try {
46
+ let schema;
47
+ if (this.isPath(mySchemaOrPath)) {
48
+ schema = await $RefParser.dereference(mySchemaOrPath);
49
+ await this.saveAsJSON(mySchemaOrPath, schema);
50
+ }
51
+ else {
52
+ schema = yaml.load(mySchemaOrPath);
53
+ }
54
+ // 2) validate the manifest file (synchronous operation...no callbacks)
55
+ const validator = new Validator(schema);
56
+ validator.validate(this.store);
57
+ // 3) deploy the schema (segment, optimize, etc; save to Redis)
58
+ const deployer = new Deployer(schema);
59
+ await deployer.deploy(this.store);
60
+ // 4) save the app version to Redis (so it can be activated later)
61
+ await this.store.setApp(schema.app.id, schema.app.version);
62
+ return schema;
63
+ }
64
+ catch (err) {
65
+ this.logger.error('compiler-deploy-error', err);
66
+ }
67
+ }
68
+ /**
69
+ * activates a deployed version of an app;
70
+ * @param appId
71
+ * @param appVersion
72
+ */
73
+ async activate(appId, appVersion) {
74
+ return await this.store.activateAppVersion(appId, appVersion);
75
+ }
76
+ async saveAsJSON(originalPath, schema) {
77
+ const json = JSON.stringify(schema, null, 2);
78
+ const newPath = path.join(path.dirname(originalPath), `.hotmesh.${schema.app.id}.${schema.app.version}.json`);
79
+ await fs.writeFile(newPath, json, 'utf8');
80
+ }
81
+ }
82
+ export { CompilerService };
@@ -0,0 +1,32 @@
1
+ import { StoreService } from '../store';
2
+ import { MappingStatements } from "../../types/map";
3
+ import { HotMeshManifest } from "../../types/hotmesh";
4
+ import { RedisClient, RedisMulti } from "../../types/redis";
5
+ declare class Validator {
6
+ manifest: HotMeshManifest | null;
7
+ activityIds: string[];
8
+ mappingStatements: MappingStatements;
9
+ store: StoreService<RedisClient, RedisMulti> | null;
10
+ static SYS_VARS: string[];
11
+ constructor(manifest: HotMeshManifest);
12
+ /**
13
+ * validate the manifest file
14
+ */
15
+ validate(store: StoreService<RedisClient, RedisMulti>): Promise<void>;
16
+ validateActivityIds(): void;
17
+ isMappingStatement(value: string): boolean;
18
+ extractMappingStatements(obj: any, result: MappingStatements, currentActivityId: string): void;
19
+ getMappingStatements(): void;
20
+ validateReferencedActivityIds(): void;
21
+ isFunction(value: string): boolean;
22
+ validateMappingStatements(): void;
23
+ validateTransitions(): void;
24
+ validateTransitionConditions(): void;
25
+ validateStats(): void;
26
+ validateSchemas(): void;
27
+ validateUniqueHandledTopics(): void;
28
+ validateGraphPublishSubscribe(): void;
29
+ validateHooks(): void;
30
+ validateConditionalStatements(): void;
31
+ }
32
+ export { Validator };