@hotmeshio/hotmesh 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/README.md +3 -3
  2. package/build/{package.json → cjs/package.json} +12 -5
  3. package/build/{services → cjs/services}/activities/activity.d.ts +2 -0
  4. package/build/{services → cjs/services}/activities/activity.js +27 -9
  5. package/build/{services → cjs/services}/activities/trigger.js +2 -2
  6. package/build/{services → cjs/services}/activities/worker.js +1 -0
  7. package/build/{services → cjs/services}/collator/index.d.ts +7 -5
  8. package/build/{services → cjs/services}/collator/index.js +29 -6
  9. package/build/{services → cjs/services}/compiler/deployer.d.ts +4 -3
  10. package/build/{services → cjs/services}/compiler/deployer.js +14 -0
  11. package/build/{services → cjs/services}/connector/index.js +3 -3
  12. package/build/{services → cjs/services}/dimension/index.d.ts +1 -1
  13. package/build/{services → cjs/services}/durable/client.js +2 -2
  14. package/build/{services → cjs/services}/durable/connection.js +2 -2
  15. package/build/{services → cjs/services}/durable/handle.d.ts +1 -1
  16. package/build/{services → cjs/services}/engine/index.d.ts +1 -1
  17. package/build/{services → cjs/services}/engine/index.js +22 -5
  18. package/build/{services → cjs/services}/hotmesh/index.d.ts +1 -1
  19. package/build/{services → cjs/services}/hotmesh/index.js +4 -4
  20. package/build/{services → cjs/services}/mapper/index.d.ts +3 -3
  21. package/build/{services → cjs/services}/serializer/index.d.ts +6 -1
  22. package/build/{services → cjs/services}/serializer/index.js +55 -22
  23. package/build/{services → cjs/services}/signaler/stream.js +1 -0
  24. package/build/{services → cjs/services}/store/index.d.ts +3 -3
  25. package/build/{services → cjs/services}/store/index.js +11 -24
  26. package/build/{types → cjs/types}/activity.d.ts +1 -0
  27. package/build/esm/index.d.ts +4 -0
  28. package/build/esm/index.js +3 -0
  29. package/build/esm/modules/errors.d.ts +28 -0
  30. package/build/esm/modules/errors.js +41 -0
  31. package/build/esm/modules/key.d.ts +75 -0
  32. package/build/esm/modules/key.js +111 -0
  33. package/build/esm/modules/utils.d.ts +34 -0
  34. package/build/esm/modules/utils.js +154 -0
  35. package/build/esm/package.json +80 -0
  36. package/build/esm/services/activities/activity.d.ts +61 -0
  37. package/build/esm/services/activities/activity.js +411 -0
  38. package/build/esm/services/activities/await.d.ts +16 -0
  39. package/build/esm/services/activities/await.js +140 -0
  40. package/build/esm/services/activities/emit.d.ts +9 -0
  41. package/build/esm/services/activities/emit.js +10 -0
  42. package/build/esm/services/activities/index.d.ts +15 -0
  43. package/build/esm/services/activities/index.js +14 -0
  44. package/build/esm/services/activities/iterate.d.ts +9 -0
  45. package/build/esm/services/activities/iterate.js +10 -0
  46. package/build/esm/services/activities/trigger.d.ts +22 -0
  47. package/build/esm/services/activities/trigger.js +158 -0
  48. package/build/esm/services/activities/worker.d.ts +17 -0
  49. package/build/esm/services/activities/worker.js +162 -0
  50. package/build/esm/services/collator/index.d.ts +56 -0
  51. package/build/esm/services/collator/index.js +191 -0
  52. package/build/esm/services/compiler/deployer.d.ts +36 -0
  53. package/build/esm/services/compiler/deployer.js +423 -0
  54. package/build/esm/services/compiler/index.d.ts +30 -0
  55. package/build/esm/services/compiler/index.js +82 -0
  56. package/build/esm/services/compiler/validator.d.ts +32 -0
  57. package/build/esm/services/compiler/validator.js +131 -0
  58. package/build/esm/services/connector/clients/ioredis.d.ts +13 -0
  59. package/build/esm/services/connector/clients/ioredis.js +47 -0
  60. package/build/esm/services/connector/clients/redis.d.ts +13 -0
  61. package/build/esm/services/connector/clients/redis.js +59 -0
  62. package/build/esm/services/connector/index.d.ts +5 -0
  63. package/build/esm/services/connector/index.js +27 -0
  64. package/build/esm/services/dimension/index.d.ts +29 -0
  65. package/build/esm/services/dimension/index.js +32 -0
  66. package/build/esm/services/durable/asyncLocalStorage.d.ts +3 -0
  67. package/build/esm/services/durable/asyncLocalStorage.js +2 -0
  68. package/build/esm/services/durable/client.d.ts +15 -0
  69. package/build/esm/services/durable/client.js +114 -0
  70. package/build/esm/services/durable/connection.d.ts +4 -0
  71. package/build/esm/services/durable/connection.js +47 -0
  72. package/build/esm/services/durable/factory.d.ts +3 -0
  73. package/build/esm/services/durable/factory.js +119 -0
  74. package/build/esm/services/durable/handle.d.ts +8 -0
  75. package/build/esm/services/durable/handle.js +34 -0
  76. package/build/esm/services/durable/index.d.ts +57 -0
  77. package/build/esm/services/durable/index.js +55 -0
  78. package/build/esm/services/durable/native.d.ts +4 -0
  79. package/build/esm/services/durable/native.js +43 -0
  80. package/build/esm/services/durable/worker.d.ts +36 -0
  81. package/build/esm/services/durable/worker.js +258 -0
  82. package/build/esm/services/durable/workflow.d.ts +6 -0
  83. package/build/esm/services/durable/workflow.js +128 -0
  84. package/build/esm/services/engine/index.d.ts +82 -0
  85. package/build/esm/services/engine/index.js +522 -0
  86. package/build/esm/services/hotmesh/index.d.ts +45 -0
  87. package/build/esm/services/hotmesh/index.js +131 -0
  88. package/build/esm/services/logger/index.d.ts +17 -0
  89. package/build/esm/services/logger/index.js +70 -0
  90. package/build/esm/services/mapper/index.d.ts +24 -0
  91. package/build/esm/services/mapper/index.js +69 -0
  92. package/build/esm/services/pipe/functions/array.d.ts +24 -0
  93. package/build/esm/services/pipe/functions/array.js +66 -0
  94. package/build/esm/services/pipe/functions/bitwise.d.ts +9 -0
  95. package/build/esm/services/pipe/functions/bitwise.js +21 -0
  96. package/build/esm/services/pipe/functions/conditional.d.ts +10 -0
  97. package/build/esm/services/pipe/functions/conditional.js +24 -0
  98. package/build/esm/services/pipe/functions/date.d.ts +57 -0
  99. package/build/esm/services/pipe/functions/date.js +164 -0
  100. package/build/esm/services/pipe/functions/index.d.ts +25 -0
  101. package/build/esm/services/pipe/functions/index.js +24 -0
  102. package/build/esm/services/pipe/functions/json.d.ts +5 -0
  103. package/build/esm/services/pipe/functions/json.js +9 -0
  104. package/build/esm/services/pipe/functions/math.d.ts +38 -0
  105. package/build/esm/services/pipe/functions/math.js +108 -0
  106. package/build/esm/services/pipe/functions/number.d.ts +25 -0
  107. package/build/esm/services/pipe/functions/number.js +130 -0
  108. package/build/esm/services/pipe/functions/object.d.ts +22 -0
  109. package/build/esm/services/pipe/functions/object.js +60 -0
  110. package/build/esm/services/pipe/functions/string.d.ts +23 -0
  111. package/build/esm/services/pipe/functions/string.js +66 -0
  112. package/build/esm/services/pipe/functions/symbol.d.ts +12 -0
  113. package/build/esm/services/pipe/functions/symbol.js +30 -0
  114. package/build/esm/services/pipe/functions/unary.d.ts +7 -0
  115. package/build/esm/services/pipe/functions/unary.js +15 -0
  116. package/build/esm/services/pipe/index.d.ts +30 -0
  117. package/build/esm/services/pipe/index.js +122 -0
  118. package/build/esm/services/quorum/index.d.ts +34 -0
  119. package/build/esm/services/quorum/index.js +144 -0
  120. package/build/esm/services/reporter/index.d.ts +47 -0
  121. package/build/esm/services/reporter/index.js +327 -0
  122. package/build/esm/services/serializer/index.d.ts +41 -0
  123. package/build/esm/services/serializer/index.js +251 -0
  124. package/build/esm/services/signaler/store.d.ts +15 -0
  125. package/build/esm/services/signaler/store.js +50 -0
  126. package/build/esm/services/signaler/stream.d.ts +43 -0
  127. package/build/esm/services/signaler/stream.js +315 -0
  128. package/build/esm/services/store/cache.d.ts +66 -0
  129. package/build/esm/services/store/cache.js +124 -0
  130. package/build/esm/services/store/clients/ioredis.d.ts +27 -0
  131. package/build/esm/services/store/clients/ioredis.js +93 -0
  132. package/build/esm/services/store/clients/redis.d.ts +29 -0
  133. package/build/esm/services/store/clients/redis.js +140 -0
  134. package/build/esm/services/store/index.d.ts +88 -0
  135. package/build/esm/services/store/index.js +623 -0
  136. package/build/esm/services/stream/clients/ioredis.d.ts +23 -0
  137. package/build/esm/services/stream/clients/ioredis.js +112 -0
  138. package/build/esm/services/stream/clients/redis.d.ts +23 -0
  139. package/build/esm/services/stream/clients/redis.js +116 -0
  140. package/build/esm/services/stream/index.d.ts +21 -0
  141. package/build/esm/services/stream/index.js +6 -0
  142. package/build/esm/services/sub/clients/ioredis.d.ts +20 -0
  143. package/build/esm/services/sub/clients/ioredis.js +69 -0
  144. package/build/esm/services/sub/clients/redis.d.ts +20 -0
  145. package/build/esm/services/sub/clients/redis.js +60 -0
  146. package/build/esm/services/sub/index.d.ts +18 -0
  147. package/build/esm/services/sub/index.js +6 -0
  148. package/build/esm/services/task/index.d.ts +18 -0
  149. package/build/esm/services/task/index.js +70 -0
  150. package/build/esm/services/telemetry/index.d.ts +49 -0
  151. package/build/esm/services/telemetry/index.js +217 -0
  152. package/build/esm/services/worker/index.d.ts +30 -0
  153. package/build/esm/services/worker/index.js +102 -0
  154. package/build/esm/types/activity.d.ts +87 -0
  155. package/build/esm/types/activity.js +1 -0
  156. package/build/esm/types/app.d.ts +16 -0
  157. package/build/esm/types/app.js +1 -0
  158. package/build/esm/types/async.d.ts +5 -0
  159. package/build/esm/types/async.js +1 -0
  160. package/build/esm/types/cache.d.ts +1 -0
  161. package/build/esm/types/cache.js +1 -0
  162. package/build/esm/types/collator.d.ts +8 -0
  163. package/build/esm/types/collator.js +8 -0
  164. package/build/esm/types/durable.d.ts +59 -0
  165. package/build/esm/types/durable.js +1 -0
  166. package/build/esm/types/hook.d.ts +31 -0
  167. package/build/esm/types/hook.js +6 -0
  168. package/build/esm/types/hotmesh.d.ts +82 -0
  169. package/build/esm/types/hotmesh.js +1 -0
  170. package/build/esm/types/index.d.ts +20 -0
  171. package/build/esm/types/index.js +5 -0
  172. package/build/esm/types/ioredisclient.d.ts +5 -0
  173. package/build/esm/types/ioredisclient.js +2 -0
  174. package/build/esm/types/job.d.ts +50 -0
  175. package/build/esm/types/job.js +1 -0
  176. package/build/esm/types/logger.d.ts +6 -0
  177. package/build/esm/types/logger.js +1 -0
  178. package/build/esm/types/map.d.ts +4 -0
  179. package/build/esm/types/map.js +1 -0
  180. package/build/esm/types/pipe.d.ts +4 -0
  181. package/build/esm/types/pipe.js +1 -0
  182. package/build/esm/types/quorum.d.ts +46 -0
  183. package/build/esm/types/quorum.js +1 -0
  184. package/build/esm/types/redis.d.ts +8 -0
  185. package/build/esm/types/redis.js +1 -0
  186. package/build/esm/types/redisclient.d.ts +25 -0
  187. package/build/esm/types/redisclient.js +1 -0
  188. package/build/esm/types/serializer.d.ts +33 -0
  189. package/build/esm/types/serializer.js +1 -0
  190. package/build/esm/types/stats.d.ts +83 -0
  191. package/build/esm/types/stats.js +1 -0
  192. package/build/esm/types/stream.d.ts +67 -0
  193. package/build/esm/types/stream.js +22 -0
  194. package/build/esm/types/telemetry.d.ts +1 -0
  195. package/build/esm/types/telemetry.js +1 -0
  196. package/build/esm/types/transition.d.ts +17 -0
  197. package/build/esm/types/transition.js +1 -0
  198. package/package.json +12 -5
  199. package/services/activities/activity.ts +28 -9
  200. package/services/activities/trigger.ts +2 -2
  201. package/services/activities/worker.ts +1 -0
  202. package/services/collator/index.ts +38 -13
  203. package/services/compiler/deployer.ts +24 -9
  204. package/services/connector/index.ts +3 -3
  205. package/services/dimension/index.ts +1 -1
  206. package/services/durable/client.ts +2 -2
  207. package/services/durable/connection.ts +2 -2
  208. package/services/durable/handle.ts +2 -2
  209. package/services/engine/index.ts +23 -5
  210. package/services/hotmesh/index.ts +4 -4
  211. package/services/mapper/index.ts +6 -8
  212. package/services/serializer/index.ts +57 -22
  213. package/services/signaler/stream.ts +1 -0
  214. package/services/store/index.ts +13 -25
  215. package/tsconfig.cjs.json +8 -0
  216. package/tsconfig.esm.json +9 -0
  217. package/types/activity.ts +1 -0
  218. /package/build/{index.d.ts → cjs/index.d.ts} +0 -0
  219. /package/build/{index.js → cjs/index.js} +0 -0
  220. /package/build/{modules → cjs/modules}/errors.d.ts +0 -0
  221. /package/build/{modules → cjs/modules}/errors.js +0 -0
  222. /package/build/{modules → cjs/modules}/key.d.ts +0 -0
  223. /package/build/{modules → cjs/modules}/key.js +0 -0
  224. /package/build/{modules → cjs/modules}/utils.d.ts +0 -0
  225. /package/build/{modules → cjs/modules}/utils.js +0 -0
  226. /package/build/{services → cjs/services}/activities/await.d.ts +0 -0
  227. /package/build/{services → cjs/services}/activities/await.js +0 -0
  228. /package/build/{services → cjs/services}/activities/emit.d.ts +0 -0
  229. /package/build/{services → cjs/services}/activities/emit.js +0 -0
  230. /package/build/{services → cjs/services}/activities/index.d.ts +0 -0
  231. /package/build/{services → cjs/services}/activities/index.js +0 -0
  232. /package/build/{services → cjs/services}/activities/iterate.d.ts +0 -0
  233. /package/build/{services → cjs/services}/activities/iterate.js +0 -0
  234. /package/build/{services → cjs/services}/activities/trigger.d.ts +0 -0
  235. /package/build/{services → cjs/services}/activities/worker.d.ts +0 -0
  236. /package/build/{services → cjs/services}/compiler/index.d.ts +0 -0
  237. /package/build/{services → cjs/services}/compiler/index.js +0 -0
  238. /package/build/{services → cjs/services}/compiler/validator.d.ts +0 -0
  239. /package/build/{services → cjs/services}/compiler/validator.js +0 -0
  240. /package/build/{services → cjs/services}/connector/clients/ioredis.d.ts +0 -0
  241. /package/build/{services → cjs/services}/connector/clients/ioredis.js +0 -0
  242. /package/build/{services → cjs/services}/connector/clients/redis.d.ts +0 -0
  243. /package/build/{services → cjs/services}/connector/clients/redis.js +0 -0
  244. /package/build/{services → cjs/services}/connector/index.d.ts +0 -0
  245. /package/build/{services → cjs/services}/dimension/index.js +0 -0
  246. /package/build/{services → cjs/services}/durable/asyncLocalStorage.d.ts +0 -0
  247. /package/build/{services → cjs/services}/durable/asyncLocalStorage.js +0 -0
  248. /package/build/{services → cjs/services}/durable/client.d.ts +0 -0
  249. /package/build/{services → cjs/services}/durable/connection.d.ts +0 -0
  250. /package/build/{services → cjs/services}/durable/factory.d.ts +0 -0
  251. /package/build/{services → cjs/services}/durable/factory.js +0 -0
  252. /package/build/{services → cjs/services}/durable/handle.js +0 -0
  253. /package/build/{services → cjs/services}/durable/index.d.ts +0 -0
  254. /package/build/{services → cjs/services}/durable/index.js +0 -0
  255. /package/build/{services → cjs/services}/durable/native.d.ts +0 -0
  256. /package/build/{services → cjs/services}/durable/native.js +0 -0
  257. /package/build/{services → cjs/services}/durable/worker.d.ts +0 -0
  258. /package/build/{services → cjs/services}/durable/worker.js +0 -0
  259. /package/build/{services → cjs/services}/durable/workflow.d.ts +0 -0
  260. /package/build/{services → cjs/services}/durable/workflow.js +0 -0
  261. /package/build/{services → cjs/services}/logger/index.d.ts +0 -0
  262. /package/build/{services → cjs/services}/logger/index.js +0 -0
  263. /package/build/{services → cjs/services}/mapper/index.js +0 -0
  264. /package/build/{services → cjs/services}/pipe/functions/array.d.ts +0 -0
  265. /package/build/{services → cjs/services}/pipe/functions/array.js +0 -0
  266. /package/build/{services → cjs/services}/pipe/functions/bitwise.d.ts +0 -0
  267. /package/build/{services → cjs/services}/pipe/functions/bitwise.js +0 -0
  268. /package/build/{services → cjs/services}/pipe/functions/conditional.d.ts +0 -0
  269. /package/build/{services → cjs/services}/pipe/functions/conditional.js +0 -0
  270. /package/build/{services → cjs/services}/pipe/functions/date.d.ts +0 -0
  271. /package/build/{services → cjs/services}/pipe/functions/date.js +0 -0
  272. /package/build/{services → cjs/services}/pipe/functions/index.d.ts +0 -0
  273. /package/build/{services → cjs/services}/pipe/functions/index.js +0 -0
  274. /package/build/{services → cjs/services}/pipe/functions/json.d.ts +0 -0
  275. /package/build/{services → cjs/services}/pipe/functions/json.js +0 -0
  276. /package/build/{services → cjs/services}/pipe/functions/math.d.ts +0 -0
  277. /package/build/{services → cjs/services}/pipe/functions/math.js +0 -0
  278. /package/build/{services → cjs/services}/pipe/functions/number.d.ts +0 -0
  279. /package/build/{services → cjs/services}/pipe/functions/number.js +0 -0
  280. /package/build/{services → cjs/services}/pipe/functions/object.d.ts +0 -0
  281. /package/build/{services → cjs/services}/pipe/functions/object.js +0 -0
  282. /package/build/{services → cjs/services}/pipe/functions/string.d.ts +0 -0
  283. /package/build/{services → cjs/services}/pipe/functions/string.js +0 -0
  284. /package/build/{services → cjs/services}/pipe/functions/symbol.d.ts +0 -0
  285. /package/build/{services → cjs/services}/pipe/functions/symbol.js +0 -0
  286. /package/build/{services → cjs/services}/pipe/functions/unary.d.ts +0 -0
  287. /package/build/{services → cjs/services}/pipe/functions/unary.js +0 -0
  288. /package/build/{services → cjs/services}/pipe/index.d.ts +0 -0
  289. /package/build/{services → cjs/services}/pipe/index.js +0 -0
  290. /package/build/{services → cjs/services}/quorum/index.d.ts +0 -0
  291. /package/build/{services → cjs/services}/quorum/index.js +0 -0
  292. /package/build/{services → cjs/services}/reporter/index.d.ts +0 -0
  293. /package/build/{services → cjs/services}/reporter/index.js +0 -0
  294. /package/build/{services → cjs/services}/signaler/store.d.ts +0 -0
  295. /package/build/{services → cjs/services}/signaler/store.js +0 -0
  296. /package/build/{services → cjs/services}/signaler/stream.d.ts +0 -0
  297. /package/build/{services → cjs/services}/store/cache.d.ts +0 -0
  298. /package/build/{services → cjs/services}/store/cache.js +0 -0
  299. /package/build/{services → cjs/services}/store/clients/ioredis.d.ts +0 -0
  300. /package/build/{services → cjs/services}/store/clients/ioredis.js +0 -0
  301. /package/build/{services → cjs/services}/store/clients/redis.d.ts +0 -0
  302. /package/build/{services → cjs/services}/store/clients/redis.js +0 -0
  303. /package/build/{services → cjs/services}/stream/clients/ioredis.d.ts +0 -0
  304. /package/build/{services → cjs/services}/stream/clients/ioredis.js +0 -0
  305. /package/build/{services → cjs/services}/stream/clients/redis.d.ts +0 -0
  306. /package/build/{services → cjs/services}/stream/clients/redis.js +0 -0
  307. /package/build/{services → cjs/services}/stream/index.d.ts +0 -0
  308. /package/build/{services → cjs/services}/stream/index.js +0 -0
  309. /package/build/{services → cjs/services}/sub/clients/ioredis.d.ts +0 -0
  310. /package/build/{services → cjs/services}/sub/clients/ioredis.js +0 -0
  311. /package/build/{services → cjs/services}/sub/clients/redis.d.ts +0 -0
  312. /package/build/{services → cjs/services}/sub/clients/redis.js +0 -0
  313. /package/build/{services → cjs/services}/sub/index.d.ts +0 -0
  314. /package/build/{services → cjs/services}/sub/index.js +0 -0
  315. /package/build/{services → cjs/services}/task/index.d.ts +0 -0
  316. /package/build/{services → cjs/services}/task/index.js +0 -0
  317. /package/build/{services → cjs/services}/telemetry/index.d.ts +0 -0
  318. /package/build/{services → cjs/services}/telemetry/index.js +0 -0
  319. /package/build/{services → cjs/services}/worker/index.d.ts +0 -0
  320. /package/build/{services → cjs/services}/worker/index.js +0 -0
  321. /package/build/{types → cjs/types}/activity.js +0 -0
  322. /package/build/{types → cjs/types}/app.d.ts +0 -0
  323. /package/build/{types → cjs/types}/app.js +0 -0
  324. /package/build/{types → cjs/types}/async.d.ts +0 -0
  325. /package/build/{types → cjs/types}/async.js +0 -0
  326. /package/build/{types → cjs/types}/cache.d.ts +0 -0
  327. /package/build/{types → cjs/types}/cache.js +0 -0
  328. /package/build/{types → cjs/types}/collator.d.ts +0 -0
  329. /package/build/{types → cjs/types}/collator.js +0 -0
  330. /package/build/{types → cjs/types}/durable.d.ts +0 -0
  331. /package/build/{types → cjs/types}/durable.js +0 -0
  332. /package/build/{types → cjs/types}/hook.d.ts +0 -0
  333. /package/build/{types → cjs/types}/hook.js +0 -0
  334. /package/build/{types → cjs/types}/hotmesh.d.ts +0 -0
  335. /package/build/{types → cjs/types}/hotmesh.js +0 -0
  336. /package/build/{types → cjs/types}/index.d.ts +0 -0
  337. /package/build/{types → cjs/types}/index.js +0 -0
  338. /package/build/{types → cjs/types}/ioredisclient.d.ts +0 -0
  339. /package/build/{types → cjs/types}/ioredisclient.js +0 -0
  340. /package/build/{types → cjs/types}/job.d.ts +0 -0
  341. /package/build/{types → cjs/types}/job.js +0 -0
  342. /package/build/{types → cjs/types}/logger.d.ts +0 -0
  343. /package/build/{types → cjs/types}/logger.js +0 -0
  344. /package/build/{types → cjs/types}/map.d.ts +0 -0
  345. /package/build/{types → cjs/types}/map.js +0 -0
  346. /package/build/{types → cjs/types}/pipe.d.ts +0 -0
  347. /package/build/{types → cjs/types}/pipe.js +0 -0
  348. /package/build/{types → cjs/types}/quorum.d.ts +0 -0
  349. /package/build/{types → cjs/types}/quorum.js +0 -0
  350. /package/build/{types → cjs/types}/redis.d.ts +0 -0
  351. /package/build/{types → cjs/types}/redis.js +0 -0
  352. /package/build/{types → cjs/types}/redisclient.d.ts +0 -0
  353. /package/build/{types → cjs/types}/redisclient.js +0 -0
  354. /package/build/{types → cjs/types}/serializer.d.ts +0 -0
  355. /package/build/{types → cjs/types}/serializer.js +0 -0
  356. /package/build/{types → cjs/types}/stats.d.ts +0 -0
  357. /package/build/{types → cjs/types}/stats.js +0 -0
  358. /package/build/{types → cjs/types}/stream.d.ts +0 -0
  359. /package/build/{types → cjs/types}/stream.js +0 -0
  360. /package/build/{types → cjs/types}/telemetry.d.ts +0 -0
  361. /package/build/{types → cjs/types}/telemetry.js +0 -0
  362. /package/build/{types → cjs/types}/transition.d.ts +0 -0
  363. /package/build/{types → cjs/types}/transition.js +0 -0
package/README.md CHANGED
@@ -66,7 +66,7 @@ run().catch((err) => {
66
66
  ```javascript
67
67
  import { Durable } from '@hotmeshio/hotmesh';
68
68
  import Redis from 'ioredis';
69
- import { nanoid } from 'nanoid';
69
+ import { v4 as uuidv4 } from 'uuid';
70
70
 
71
71
  async function run() {
72
72
  const connection = await Durable.Connection.connect({
@@ -85,7 +85,7 @@ async function run() {
85
85
  args: ['HotMesh'],
86
86
  taskQueue: 'hello-world',
87
87
  workflowName: 'example',
88
- workflowId: 'workflow-' + nanoid(),
88
+ workflowId: 'workflow-' + uuidv4(),
89
89
  });
90
90
 
91
91
  console.log(`Started workflow ${handle.workflowId}`);
@@ -98,7 +98,7 @@ run().catch((err) => {
98
98
  });
99
99
  ```
100
100
 
101
- >HotMesh delivers durable function execution using a swarm of [distributed engines](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.
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.
102
102
 
103
103
  ## Advanced Design
104
104
  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.
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Durable Workflows",
5
- "main": "build/index.js",
6
- "types": "build/index.d.ts",
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
+ },
7
12
  "repository": {
8
13
  "type": "git",
9
14
  "url": "https://github.com/hotmeshio/sdk-typescript.git"
@@ -14,7 +19,9 @@
14
19
  },
15
20
  "scripts": {
16
21
  "clean": "rimraf ./build",
17
- "build": "tsc --build tsconfig.json",
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",
18
25
  "clean-build": "npm run clean && npm run build",
19
26
  "lint": "eslint . --ext .ts",
20
27
  "lint:fix": "eslint . --fix --ext .ts",
@@ -52,7 +59,7 @@
52
59
  "@opentelemetry/api": "^1.4.1",
53
60
  "js-yaml": "^4.1.0",
54
61
  "ms": "^2.1.3",
55
- "nanoid": "^3.3.6",
62
+ "uuid": "^9.0.1",
56
63
  "winston": "^3.8.2"
57
64
  },
58
65
  "devDependencies": {
@@ -53,6 +53,8 @@ declare class Activity {
53
53
  initSelf(context: StringAnyType): JobState;
54
54
  initPolicies(context: JobState): void;
55
55
  bindActivityData(type: 'output' | 'hook'): void;
56
+ resolveDad(): string;
57
+ resolveAdjacentDad(): string;
56
58
  filterAdjacent(): Promise<StreamData[]>;
57
59
  transition(adjacencyList: StreamData[], jobStatus: JobStatus): Promise<string[]>;
58
60
  }
@@ -100,7 +100,8 @@ class Activity {
100
100
  const durationInSeconds = pipe_1.Pipe.resolve(this.config.sleep, this.context);
101
101
  const jobId = this.context.metadata.jid;
102
102
  const activityId = this.metadata.aid;
103
- await this.engine.task.registerTimeHook(jobId, activityId, 'sleep', durationInSeconds);
103
+ const dId = this.metadata.dad;
104
+ await this.engine.task.registerTimeHook(jobId, `${activityId}${dId || ''}`, 'sleep', durationInSeconds);
104
105
  return jobId;
105
106
  }
106
107
  }
@@ -158,6 +159,7 @@ class Activity {
158
159
  return jobStatus;
159
160
  }
160
161
  catch (error) {
162
+ console.error('this error?', error);
161
163
  this.logger.error('engine-process-hook-event-error', error);
162
164
  telemetry.setActivityError(error.message);
163
165
  throw error;
@@ -214,11 +216,10 @@ class Activity {
214
216
  }) ?? [];
215
217
  }
216
218
  bindDimensionalAddress(state) {
217
- const { aid, dad } = this.metadata;
218
- state[`${aid}/output/metadata/dad`] = dad;
219
+ const dad = this.resolveDad();
220
+ state[`${this.metadata.aid}/output/metadata/dad`] = dad;
219
221
  }
220
222
  async setState(multi) {
221
- const { id: appId } = await this.engine.getVID();
222
223
  const jobId = this.context.metadata.jid;
223
224
  this.bindJobMetadata();
224
225
  this.bindActivityMetadata();
@@ -233,7 +234,8 @@ class Activity {
233
234
  this.metadata.aid,
234
235
  ...presets
235
236
  ];
236
- return await this.store.setState(state, this.getJobStatus(), jobId, appId, symbolNames, multi);
237
+ const dIds = collator_1.CollatorService.getDimensionsById([...this.config.ancestors, this.metadata.aid], this.resolveDad());
238
+ return await this.store.setState(state, this.getJobStatus(), jobId, symbolNames, dIds, multi);
237
239
  }
238
240
  bindJobMetadata() {
239
241
  //both legs of the most recently run activity (1 and 2) modify ju (job_updated)
@@ -247,6 +249,7 @@ class Activity {
247
249
  if (this.status === stream_1.StreamStatus.ERROR) {
248
250
  self.output.metadata.err = JSON.stringify(this.data);
249
251
  }
252
+ //todo: verify leg2 never overwrites leg1 `ac`
250
253
  self.output.metadata.ac =
251
254
  self.output.metadata.au = (0, utils_1.formatISODate)(new Date());
252
255
  self.output.metadata.atp = this.config.type;
@@ -315,10 +318,11 @@ class Activity {
315
318
  }
316
319
  }
317
320
  telemetry_1.TelemetryService.addTargetTelemetryPaths(consumes, this.config, this.metadata, this.leg);
318
- const { dad, jid } = this.context.metadata;
321
+ let { dad, jid } = this.context.metadata;
319
322
  jobId = jobId || jid;
320
323
  //`state` is a flat hash
321
- const [state, status] = await this.store.getState(jobId, consumes);
324
+ const dIds = collator_1.CollatorService.getDimensionsById([...this.config.ancestors, this.metadata.aid], dad);
325
+ const [state, status] = await this.store.getState(jobId, consumes, dIds);
322
326
  //`context` is a tree
323
327
  this.context = (0, utils_1.restoreHierarchy)(state);
324
328
  this.initDimensionalAddress(dad);
@@ -353,11 +357,25 @@ class Activity {
353
357
  bindActivityData(type) {
354
358
  this.context[this.metadata.aid][type].data = this.data;
355
359
  }
360
+ resolveDad() {
361
+ let dad = this.metadata.dad;
362
+ if (this.adjacentIndex > 0) {
363
+ //if adjacent index > 0 the activity is cycling; replace last index with cycle index
364
+ dad = `${dad.substring(0, dad.lastIndexOf(','))},${this.adjacentIndex}`;
365
+ }
366
+ return dad;
367
+ }
368
+ resolveAdjacentDad() {
369
+ //concat self and child dimension (all children (leg 1) begin life at 0)
370
+ return `${this.resolveDad()}${dimension_1.DimensionService.getSeed(0)}`;
371
+ }
372
+ ;
356
373
  async filterAdjacent() {
357
374
  const adjacencyList = [];
358
375
  const transitions = await this.store.getTransitions(await this.engine.getVID());
359
376
  const transition = transitions[`.${this.metadata.aid}`];
360
- const adjacentSuffix = dimension_1.DimensionService.getSeed(this.adjacentIndex);
377
+ //resolve the dimensional address for adjacent children
378
+ const adjacentDad = this.resolveAdjacentDad();
361
379
  if (transition) {
362
380
  for (const toActivityId in transition) {
363
381
  const transitionRule = transition[toActivityId];
@@ -365,7 +383,7 @@ class Activity {
365
383
  adjacencyList.push({
366
384
  metadata: {
367
385
  jid: this.context.metadata.jid,
368
- dad: `${this.metadata.dad}${adjacentSuffix}`,
386
+ dad: adjacentDad,
369
387
  aid: toActivityId,
370
388
  spn: this.context['$self'].output.metadata?.l2s,
371
389
  trc: this.context.metadata.trc,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Trigger = void 0;
4
- const nanoid_1 = require("nanoid");
4
+ const uuid_1 = require("uuid");
5
5
  const errors_1 = require("../../modules/errors");
6
6
  const utils_1 = require("../../modules/utils");
7
7
  const activity_1 = require("./activity");
@@ -137,7 +137,7 @@ class Trigger extends activity_1.Activity {
137
137
  }
138
138
  resolveJobId(context) {
139
139
  const jobId = this.config.stats?.id;
140
- return jobId ? pipe_1.Pipe.resolve(jobId, context) : (0, nanoid_1.nanoid)();
140
+ return jobId ? pipe_1.Pipe.resolve(jobId, context) : (0, uuid_1.v4)();
141
141
  }
142
142
  resolveJobKey(context) {
143
143
  const jobKey = this.config.stats?.key;
@@ -42,6 +42,7 @@ class Worker extends activity_1.Activity {
42
42
  this.logger.error('worker-get-state-error', error);
43
43
  }
44
44
  else {
45
+ console.error(error);
45
46
  this.logger.error('worker-process-error', error);
46
47
  }
47
48
  telemetry.setActivityError(error.message);
@@ -1,10 +1,11 @@
1
- import { RedisMulti } from "../../types/redis";
2
- import { CollationStage } from "../../types/collator";
3
- import { ActivityDuplex } from "../../types/activity";
4
- import { HotMeshGraph } from "../../types/hotmesh";
5
- import { Activity } from "../activities/activity";
1
+ import { RedisMulti } from '../../types/redis';
2
+ import { CollationStage } from '../../types/collator';
3
+ import { ActivityDuplex } from '../../types/activity';
4
+ import { HotMeshGraph } from '../../types/hotmesh';
5
+ import { Activity } from '../activities/activity';
6
6
  declare class CollatorService {
7
7
  static targetLength: number;
8
+ static getDimensionalAddress(activity: Activity): Record<string, string>;
8
9
  static notarizeEntry(activity: Activity, multi?: RedisMulti): Promise<number>;
9
10
  static authorizeReentry(activity: Activity, multi?: RedisMulti): Promise<number>;
10
11
  static notarizeEarlyCompletion(activity: Activity, multi?: RedisMulti): Promise<number>;
@@ -17,6 +18,7 @@ declare class CollatorService {
17
18
  static isInactive(num: number): boolean;
18
19
  static isPrimed(amount: number, leg: ActivityDuplex): boolean;
19
20
  static verifyInteger(amount: number, leg: ActivityDuplex, stage: CollationStage): void;
21
+ static getDimensionsById(ancestors: string[], dad: string): Record<string, string>;
20
22
  /**
21
23
  * All non-trigger activities are assigned a status seed by their parent
22
24
  */
@@ -4,9 +4,18 @@ exports.CollatorService = void 0;
4
4
  const errors_1 = require("../../modules/errors");
5
5
  const collator_1 = require("../../types/collator");
6
6
  class CollatorService {
7
+ static getDimensionalAddress(activity) {
8
+ let dad = activity.context.metadata.dad || activity.metadata.dad;
9
+ //todo: unsure about this reset
10
+ // if (dad && activity.leg === 2) {
11
+ // console.log('setting dad index back to 0=>', dad);
12
+ // dad = `${dad.substring(0, dad.lastIndexOf(','))},0`;
13
+ // }
14
+ return CollatorService.getDimensionsById([...activity.config.ancestors, activity.metadata.aid], dad);
15
+ }
7
16
  static async notarizeEntry(activity, multi) {
8
17
  //decrement by -100_000_000_000_000
9
- const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -100000000000000, multi);
18
+ const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -100000000000000, this.getDimensionalAddress(activity), multi);
10
19
  this.verifyInteger(amount, 1, 'enter');
11
20
  return amount;
12
21
  }
@@ -14,30 +23,30 @@ class CollatorService {
14
23
  static async authorizeReentry(activity, multi) {
15
24
  //set second digit to 8, allowing for re-entry
16
25
  //decrement by -10_000_000_000_000
17
- const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -10000000000000, multi);
26
+ const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, -10000000000000, this.getDimensionalAddress(activity), multi);
18
27
  //this.verifyInteger(amount, 1, 'exit');
19
28
  return amount;
20
29
  }
21
30
  static async notarizeEarlyCompletion(activity, multi) {
22
31
  //initialize both `possible` (1m) and `actualized` (1) zero dimension, while decrementing the 2nd and 3rd digits to deactivate the activity
23
- return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1000001 - 11000000000000, multi);
32
+ return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1000001 - 11000000000000, this.getDimensionalAddress(activity), multi);
24
33
  }
25
34
  ;
26
35
  static async notarizeReentry(activity, multi) {
27
36
  //increment by 1_000_000 (indicates re-entry and is used to drive the 'dimensional address' for adjacent activities (minus 1))
28
- const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1000000, multi);
37
+ const amount = await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1000000, this.getDimensionalAddress(activity), multi);
29
38
  this.verifyInteger(amount, 2, 'enter');
30
39
  return amount;
31
40
  }
32
41
  ;
33
42
  static async notarizeContinuation(activity, multi) {
34
43
  //keep open; actualize the leg2 dimension (+1)
35
- return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1, multi);
44
+ return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1, this.getDimensionalAddress(activity), multi);
36
45
  }
37
46
  ;
38
47
  static async notarizeCompletion(activity, multi) {
39
48
  //close out; actualize leg2 dimension (+1) and decrement the 3rd digit (-1_000_000_000_000)
40
- return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1 - 1000000000000, multi);
49
+ return await activity.store.collate(activity.context.metadata.jid, activity.metadata.aid, 1 - 1000000000000, this.getDimensionalAddress(activity), multi);
41
50
  }
42
51
  ;
43
52
  static getDigitAtIndex(num, targetDigitIndex) {
@@ -106,6 +115,20 @@ class CollatorService {
106
115
  throw new errors_1.CollationError(amount, leg, stage, faultType);
107
116
  }
108
117
  }
118
+ static getDimensionsById(ancestors, dad) {
119
+ //ancestors is an ordered list of all ancestors, starting with the trigger (['t1', 'a1', 'a2'])
120
+ //dad is the dimensional address of the ancestors list (',0,5,3')
121
+ //loop through the ancestors list and create a map of the ancestor to the dimensional address.
122
+ //return { 't1': ',0', 'a1': ',0,5', 'a1': ',0,5,3', $ADJACENT: ',0,5,3,0' };
123
+ // `adjacent` is a special key that is used to track the dimensional address of adjacent activities
124
+ const map = { '$ADJACENT': `${dad},0` };
125
+ let dadStr = dad;
126
+ ancestors.reverse().forEach((ancestor) => {
127
+ map[ancestor] = dadStr;
128
+ dadStr = dadStr.substring(0, dadStr.lastIndexOf(','));
129
+ });
130
+ return map;
131
+ }
109
132
  /**
110
133
  * All non-trigger activities are assigned a status seed by their parent
111
134
  */
@@ -1,7 +1,7 @@
1
1
  import { StoreService } from '../store';
2
- import { HotMeshGraph, HotMeshManifest } from "../../types/hotmesh";
3
- import { RedisClient, RedisMulti } from "../../types/redis";
4
- import { Symbols } from "../../types/serializer";
2
+ import { HotMeshGraph, HotMeshManifest } from '../../types/hotmesh';
3
+ import { RedisClient, RedisMulti } from '../../types/redis';
4
+ import { Symbols } from '../../types/serializer';
5
5
  declare class Deployer {
6
6
  manifest: HotMeshManifest | null;
7
7
  store: StoreService<RedisClient, RedisMulti> | null;
@@ -12,6 +12,7 @@ declare class Deployer {
12
12
  version: string;
13
13
  };
14
14
  generateSymKeys(): Promise<void>;
15
+ bindSelf(consumes: Record<string, string[]>, produces: string[], activityId: string): void;
15
16
  bindSymbols(startIndex: number, maxIndex: number, existingSymbols: Symbols, prefix: string, produces: string[]): Symbols;
16
17
  copyJobSchemas(): void;
17
18
  bindBackRefs(): void;
@@ -53,6 +53,7 @@ class Deployer {
53
53
  for (const [activityId, activity] of Object.entries(graph.activities)) {
54
54
  const [lower, upper, symbols] = await this.store.reserveSymbolRange(activityId, DEFAULT_RANGE_SIZE, 'ACTIVITY');
55
55
  const prefix = `${activityId}/`; //activity meta/data is namespaced
56
+ this.bindSelf(activity.consumes, activity.produces, activityId);
56
57
  const newSymbols = this.bindSymbols(lower, upper, symbols, prefix, activity.produces);
57
58
  if (Object.keys(newSymbols).length) {
58
59
  await this.store.addSymbols(activityId, newSymbols);
@@ -60,6 +61,19 @@ class Deployer {
60
61
  }
61
62
  }
62
63
  }
64
+ bindSelf(consumes, produces, activityId) {
65
+ //bind self-referential mappings
66
+ for (const selfId of [activityId, '$self']) {
67
+ const selfConsumes = consumes[selfId];
68
+ if (selfConsumes) {
69
+ for (const path of selfConsumes) {
70
+ if (!produces.includes(path)) {
71
+ produces.push(path);
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
63
77
  bindSymbols(startIndex, maxIndex, existingSymbols, prefix, produces) {
64
78
  let newSymbols = {};
65
79
  let currentSymbols = { ...existingSymbols };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectorService = void 0;
4
- const nanoid_1 = require("nanoid");
4
+ const uuid_1 = require("uuid");
5
5
  const utils_1 = require("../../modules/utils");
6
6
  const ioredis_1 = require("../connector/clients/ioredis");
7
7
  const redis_1 = require("../connector/clients/redis");
@@ -13,12 +13,12 @@ class ConnectorService {
13
13
  const instances = [];
14
14
  if ((0, utils_1.identifyRedisTypeFromClass)(Redis) === 'redis') {
15
15
  for (let i = 1; i <= 3; i++) {
16
- instances.push(redis_1.RedisConnection.connect((0, nanoid_1.nanoid)(), Redis, options));
16
+ instances.push(redis_1.RedisConnection.connect((0, uuid_1.v4)(), Redis, options));
17
17
  }
18
18
  }
19
19
  else {
20
20
  for (let i = 1; i <= 3; i++) {
21
- instances.push(ioredis_1.RedisConnection.connect((0, nanoid_1.nanoid)(), Redis, options));
21
+ instances.push(ioredis_1.RedisConnection.connect((0, uuid_1.v4)(), Redis, options));
22
22
  }
23
23
  }
24
24
  const [store, stream, sub] = await Promise.all(instances);
@@ -1,4 +1,4 @@
1
- import { HotMeshGraph } from "../../types/hotmesh";
1
+ import { HotMeshGraph } from '../../types/hotmesh';
2
2
  declare class DimensionService {
3
3
  static targetLength: number;
4
4
  /**
@@ -12,7 +12,7 @@ Here is an example of how the methods in this file are used:
12
12
  import { Durable } from '@hotmeshio/hotmesh';
13
13
  import Redis from 'ioredis';
14
14
  import { example } from './workflows';
15
- import { nanoid } from 'nanoid';
15
+ import { v4 as uuidv4 } from 'uuid';
16
16
 
17
17
  async function run() {
18
18
  const connection = await Durable.Connection.connect({
@@ -31,7 +31,7 @@ async function run() {
31
31
  args: ['HotMesh'],
32
32
  taskQueue: 'hello-world',
33
33
  workflowName: 'example',
34
- workflowId: 'workflow-' + nanoid(),
34
+ workflowId: 'workflow-' + uuidv4(),
35
35
  });
36
36
 
37
37
  console.log(`Started workflow ${handle.workflowId}`);
@@ -8,7 +8,7 @@ Here is an example of how the methods in this file are used:
8
8
 
9
9
  import { Durable } from '@hotmeshio/hotmesh';
10
10
  import Redis from 'ioredis';
11
- import { nanoid } from 'nanoid';
11
+ import { v4 as uuidv4 } from 'uuid';
12
12
 
13
13
  async function run() {
14
14
  const connection = await Durable.Connection.connect({
@@ -27,7 +27,7 @@ async function run() {
27
27
  taskQueue: 'hello-world',
28
28
  args: ['HotMesh'],
29
29
  workflowName: 'example',
30
- workflowId: nanoid(),
30
+ workflowId: uuidv4(),
31
31
  });
32
32
 
33
33
  console.log(`Started workflow ${handle.workflowId}`);
@@ -1,4 +1,4 @@
1
- import { HotMeshService as HotMesh } from "../hotmesh";
1
+ import { HotMeshService as HotMesh } from '../hotmesh';
2
2
  export declare class WorkflowHandleService {
3
3
  hotMesh: HotMesh;
4
4
  workflowTopic: string;
@@ -58,7 +58,7 @@ declare class EngineService {
58
58
  hasParentJob(context: JobState): boolean;
59
59
  resolveError(metadata: JobMetadata): StreamError | undefined;
60
60
  scrub(jobId: string): Promise<void>;
61
- hook(topic: string, data: JobData): Promise<JobStatus | void>;
61
+ hook(topic: string, data: JobData, dad?: string): Promise<JobStatus | void>;
62
62
  hookTime(jobId: string, activityId: string): Promise<JobStatus | void>;
63
63
  hookAll(hookTopic: string, data: JobData, query: JobStatsInput, queryFacets?: string[]): Promise<string[]>;
64
64
  pub(topic: string, data: JobData, context?: JobState): Promise<string>;
@@ -317,21 +317,37 @@ class EngineService {
317
317
  await this.store.scrub(jobId);
318
318
  }
319
319
  // ****************** `HOOK` ACTIVITY RE-ENTRY POINT *****************
320
- async hook(topic, data) {
320
+ async hook(topic, data, dad) {
321
321
  const hookRule = await this.storeSignaler.getHookRule(topic);
322
+ const [aid, schema] = await this.getSchema(`.${hookRule.to}`);
323
+ if (!dad) {
324
+ //assume dimensional address is singular (0)
325
+ // for ancestors and self if not provided
326
+ // todo: register
327
+ dad = ',0'.repeat(schema.ancestors.length + 1);
328
+ }
322
329
  const streamData = {
323
330
  type: stream_2.StreamDataType.WEBHOOK,
324
- metadata: { aid: `${hookRule.to}`, topic },
331
+ metadata: {
332
+ //jid is unknown at this point; will be resolved using the data
333
+ aid,
334
+ dad,
335
+ topic
336
+ },
325
337
  data,
326
338
  };
327
339
  await this.streamSignaler.publishMessage(null, streamData);
328
340
  }
329
341
  async hookTime(jobId, activityId) {
342
+ //the activityid is concatenated with its dimensional address (dad); split to resolve
343
+ const [aid, ...dimensions] = activityId.split(',');
344
+ const dad = `,${dimensions.join(',')}`;
330
345
  const streamData = {
331
346
  type: stream_2.StreamDataType.TIMEHOOK,
332
347
  metadata: {
333
348
  jid: jobId,
334
- aid: activityId,
349
+ aid,
350
+ dad,
335
351
  },
336
352
  data: { timestamp: Date.now() },
337
353
  };
@@ -484,12 +500,13 @@ class EngineService {
484
500
  // (e.g, if {dimensions:true}, use hscan to deliver
485
501
  // the full set of dimensional job data)
486
502
  async getState(topic, jobId) {
487
- const { id: appId } = await this.getVID();
488
503
  const jobSymbols = await this.store.getSymbols(`$${topic}`);
489
504
  const consumes = {
490
505
  [`$${topic}`]: Object.keys(jobSymbols)
491
506
  };
492
- const output = await this.store.getState(jobId, consumes);
507
+ //job data exists at the 'zero' dimension; pass an empty object
508
+ const dIds = {};
509
+ const output = await this.store.getState(jobId, consumes, dIds);
493
510
  if (!output) {
494
511
  throw new Error(`not found ${jobId}`);
495
512
  }
@@ -37,7 +37,7 @@ declare class HotMeshService {
37
37
  getIds(topic: string, query: JobStatsInput, queryFacets?: any[]): Promise<IdsResponse>;
38
38
  resolveQuery(topic: string, query: JobStatsInput): Promise<GetStatsOptions>;
39
39
  scrub(jobId: string): Promise<void>;
40
- hook(topic: string, data: JobData): Promise<JobStatus | void>;
40
+ hook(topic: string, data: JobData, dad?: string): Promise<JobStatus | void>;
41
41
  hookAll(hookTopic: string, data: JobData, query: JobStatsInput, queryFacets?: string[]): Promise<string[]>;
42
42
  stop(): Promise<void>;
43
43
  compress(terms: string[]): Promise<boolean>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HotMeshService = void 0;
4
- const nanoid_1 = require("nanoid");
4
+ const uuid_1 = require("uuid");
5
5
  const key_1 = require("../../modules/key");
6
6
  const engine_1 = require("../engine");
7
7
  const logger_1 = require("../logger");
@@ -39,7 +39,7 @@ class HotMeshService {
39
39
  }
40
40
  static async init(config) {
41
41
  const instance = new HotMeshService();
42
- instance.guid = (0, nanoid_1.nanoid)();
42
+ instance.guid = (0, uuid_1.v4)();
43
43
  instance.verifyAndSetNamespace(config.namespace);
44
44
  instance.verifyAndSetAppId(config.appId);
45
45
  instance.logger = new logger_1.LoggerService(config.appId, instance.guid, config.name || '', config.logLevel);
@@ -116,9 +116,9 @@ class HotMeshService {
116
116
  await this.engine?.scrub(jobId);
117
117
  }
118
118
  // ****** `HOOK` ACTIVITY RE-ENTRY POINT ******
119
- async hook(topic, data) {
119
+ async hook(topic, data, dad) {
120
120
  //return collation int
121
- return await this.engine?.hook(topic, data);
121
+ return await this.engine?.hook(topic, data, dad);
122
122
  }
123
123
  async hookAll(hookTopic, data, query, queryFacets = []) {
124
124
  return await this.engine?.hookAll(hookTopic, data, query, queryFacets);
@@ -1,6 +1,6 @@
1
- import { JobState } from "../../types/job";
2
- import { TransitionRule } from "../../types/transition";
3
- import { StreamCode } from "../../types";
1
+ import { JobState } from '../../types/job';
2
+ import { TransitionRule } from '../../types/transition';
3
+ import { StreamCode } from '../../types';
4
4
  declare class MapperService {
5
5
  private rules;
6
6
  private data;
@@ -1,3 +1,4 @@
1
+ import { Consumes } from '../../types/activity';
1
2
  import { StringStringType, StringAnyType, SymbolMap, SymbolMaps, SymbolSets, Symbols } from '../../types/serializer';
2
3
  export declare const MDATA_SYMBOLS: {
3
4
  SLOTS: number;
@@ -15,12 +16,16 @@ export declare const MDATA_SYMBOLS: {
15
16
  };
16
17
  };
17
18
  export declare class SerializerService {
19
+ dIds: StringStringType;
18
20
  symKeys: SymbolMaps;
19
21
  symReverseKeys: SymbolMaps;
20
22
  symValMaps: SymbolMap;
21
23
  symValReverseMaps: SymbolMap;
22
24
  constructor();
23
- resetSymbols(symKeys: SymbolSets, symVals: Symbols): void;
25
+ abbreviate(consumes: Consumes, symbolNames: string[], fields?: string[]): string[];
26
+ resolveDimensionalIndex(path: string): string;
27
+ isJobPath(path: string): boolean;
28
+ resetSymbols(symKeys: SymbolSets, symVals: Symbols, dIds: StringStringType): void;
24
29
  getReverseKeyMap(keyMap: SymbolMap, id?: string): SymbolMap;
25
30
  getReverseValueMap(valueMap: SymbolMap): SymbolMap;
26
31
  static filterSymVals(startIndex: number, maxIndex: number, existingSymbolValues: Symbols, proposedValues: Set<string>): Symbols;