@hotmeshio/hotmesh 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/LICENSE +4 -7
  2. package/README.md +82 -85
  3. package/build/{cjs/modules → modules}/key.d.ts +2 -2
  4. package/build/{cjs/modules → modules}/key.js +3 -3
  5. package/build/{esm/package.json → package.json} +4 -11
  6. package/build/{cjs/services → services}/durable/native.js +2 -3
  7. package/build/{esm/services → services}/durable/worker.d.ts +1 -3
  8. package/build/{cjs/services → services}/durable/worker.js +9 -33
  9. package/build/{cjs/services → services}/durable/workflow.js +6 -1
  10. package/build/{cjs/services → services}/hotmesh/index.js +1 -1
  11. package/build/{cjs/services → services}/store/index.js +2 -2
  12. package/build/{cjs/services → services}/stream/clients/ioredis.js +1 -1
  13. package/build/{cjs/services → services}/stream/clients/redis.js +1 -1
  14. package/build/{cjs/services → services}/sub/clients/ioredis.js +1 -1
  15. package/build/{cjs/services → services}/sub/clients/redis.js +1 -1
  16. package/build/{cjs/types → types}/durable.d.ts +5 -7
  17. package/modules/key.ts +2 -2
  18. package/package.json +4 -11
  19. package/services/durable/native.ts +2 -3
  20. package/services/durable/worker.ts +9 -10
  21. package/services/durable/workflow.ts +7 -1
  22. package/services/hotmesh/index.ts +2 -2
  23. package/services/store/index.ts +3 -3
  24. package/services/stream/clients/ioredis.ts +2 -2
  25. package/services/stream/clients/redis.ts +2 -2
  26. package/services/sub/clients/ioredis.ts +2 -2
  27. package/services/sub/clients/redis.ts +2 -2
  28. package/types/durable.ts +5 -5
  29. package/build/cjs/package.json +0 -82
  30. package/build/cjs/services/durable/worker.d.ts +0 -38
  31. package/build/esm/index.d.ts +0 -4
  32. package/build/esm/index.js +0 -3
  33. package/build/esm/modules/errors.d.ts +0 -28
  34. package/build/esm/modules/errors.js +0 -41
  35. package/build/esm/modules/key.d.ts +0 -75
  36. package/build/esm/modules/key.js +0 -111
  37. package/build/esm/modules/utils.d.ts +0 -34
  38. package/build/esm/modules/utils.js +0 -154
  39. package/build/esm/services/activities/activity.d.ts +0 -67
  40. package/build/esm/services/activities/activity.js +0 -486
  41. package/build/esm/services/activities/await.d.ts +0 -16
  42. package/build/esm/services/activities/await.js +0 -140
  43. package/build/esm/services/activities/cycle.d.ts +0 -19
  44. package/build/esm/services/activities/cycle.js +0 -74
  45. package/build/esm/services/activities/emit.d.ts +0 -9
  46. package/build/esm/services/activities/emit.js +0 -10
  47. package/build/esm/services/activities/index.d.ts +0 -17
  48. package/build/esm/services/activities/index.js +0 -16
  49. package/build/esm/services/activities/iterate.d.ts +0 -9
  50. package/build/esm/services/activities/iterate.js +0 -10
  51. package/build/esm/services/activities/trigger.d.ts +0 -22
  52. package/build/esm/services/activities/trigger.js +0 -158
  53. package/build/esm/services/activities/worker.d.ts +0 -11
  54. package/build/esm/services/activities/worker.js +0 -70
  55. package/build/esm/services/collator/index.d.ts +0 -73
  56. package/build/esm/services/collator/index.js +0 -221
  57. package/build/esm/services/compiler/deployer.d.ts +0 -36
  58. package/build/esm/services/compiler/deployer.js +0 -423
  59. package/build/esm/services/compiler/index.d.ts +0 -30
  60. package/build/esm/services/compiler/index.js +0 -82
  61. package/build/esm/services/compiler/validator.d.ts +0 -32
  62. package/build/esm/services/compiler/validator.js +0 -131
  63. package/build/esm/services/connector/clients/ioredis.d.ts +0 -13
  64. package/build/esm/services/connector/clients/ioredis.js +0 -47
  65. package/build/esm/services/connector/clients/redis.d.ts +0 -13
  66. package/build/esm/services/connector/clients/redis.js +0 -59
  67. package/build/esm/services/connector/index.d.ts +0 -5
  68. package/build/esm/services/connector/index.js +0 -27
  69. package/build/esm/services/dimension/index.d.ts +0 -29
  70. package/build/esm/services/dimension/index.js +0 -32
  71. package/build/esm/services/durable/asyncLocalStorage.d.ts +0 -3
  72. package/build/esm/services/durable/asyncLocalStorage.js +0 -2
  73. package/build/esm/services/durable/client.d.ts +0 -15
  74. package/build/esm/services/durable/client.js +0 -114
  75. package/build/esm/services/durable/connection.d.ts +0 -4
  76. package/build/esm/services/durable/connection.js +0 -47
  77. package/build/esm/services/durable/factory.d.ts +0 -3
  78. package/build/esm/services/durable/factory.js +0 -135
  79. package/build/esm/services/durable/handle.d.ts +0 -8
  80. package/build/esm/services/durable/handle.js +0 -34
  81. package/build/esm/services/durable/index.d.ts +0 -57
  82. package/build/esm/services/durable/index.js +0 -55
  83. package/build/esm/services/durable/native.d.ts +0 -4
  84. package/build/esm/services/durable/native.js +0 -43
  85. package/build/esm/services/durable/worker.js +0 -267
  86. package/build/esm/services/durable/workflow.d.ts +0 -6
  87. package/build/esm/services/durable/workflow.js +0 -132
  88. package/build/esm/services/engine/index.d.ts +0 -82
  89. package/build/esm/services/engine/index.js +0 -522
  90. package/build/esm/services/hotmesh/index.d.ts +0 -45
  91. package/build/esm/services/hotmesh/index.js +0 -131
  92. package/build/esm/services/logger/index.d.ts +0 -17
  93. package/build/esm/services/logger/index.js +0 -70
  94. package/build/esm/services/mapper/index.d.ts +0 -24
  95. package/build/esm/services/mapper/index.js +0 -72
  96. package/build/esm/services/pipe/functions/array.d.ts +0 -24
  97. package/build/esm/services/pipe/functions/array.js +0 -66
  98. package/build/esm/services/pipe/functions/bitwise.d.ts +0 -9
  99. package/build/esm/services/pipe/functions/bitwise.js +0 -21
  100. package/build/esm/services/pipe/functions/conditional.d.ts +0 -10
  101. package/build/esm/services/pipe/functions/conditional.js +0 -24
  102. package/build/esm/services/pipe/functions/date.d.ts +0 -57
  103. package/build/esm/services/pipe/functions/date.js +0 -164
  104. package/build/esm/services/pipe/functions/index.d.ts +0 -25
  105. package/build/esm/services/pipe/functions/index.js +0 -24
  106. package/build/esm/services/pipe/functions/json.d.ts +0 -5
  107. package/build/esm/services/pipe/functions/json.js +0 -9
  108. package/build/esm/services/pipe/functions/math.d.ts +0 -38
  109. package/build/esm/services/pipe/functions/math.js +0 -108
  110. package/build/esm/services/pipe/functions/number.d.ts +0 -25
  111. package/build/esm/services/pipe/functions/number.js +0 -130
  112. package/build/esm/services/pipe/functions/object.d.ts +0 -22
  113. package/build/esm/services/pipe/functions/object.js +0 -60
  114. package/build/esm/services/pipe/functions/string.d.ts +0 -23
  115. package/build/esm/services/pipe/functions/string.js +0 -66
  116. package/build/esm/services/pipe/functions/symbol.d.ts +0 -12
  117. package/build/esm/services/pipe/functions/symbol.js +0 -30
  118. package/build/esm/services/pipe/functions/unary.d.ts +0 -7
  119. package/build/esm/services/pipe/functions/unary.js +0 -15
  120. package/build/esm/services/pipe/index.d.ts +0 -30
  121. package/build/esm/services/pipe/index.js +0 -122
  122. package/build/esm/services/quorum/index.d.ts +0 -34
  123. package/build/esm/services/quorum/index.js +0 -144
  124. package/build/esm/services/reporter/index.d.ts +0 -47
  125. package/build/esm/services/reporter/index.js +0 -327
  126. package/build/esm/services/serializer/index.d.ts +0 -41
  127. package/build/esm/services/serializer/index.js +0 -251
  128. package/build/esm/services/signaler/store.d.ts +0 -15
  129. package/build/esm/services/signaler/store.js +0 -50
  130. package/build/esm/services/signaler/stream.d.ts +0 -43
  131. package/build/esm/services/signaler/stream.js +0 -314
  132. package/build/esm/services/store/cache.d.ts +0 -66
  133. package/build/esm/services/store/cache.js +0 -124
  134. package/build/esm/services/store/clients/ioredis.d.ts +0 -27
  135. package/build/esm/services/store/clients/ioredis.js +0 -93
  136. package/build/esm/services/store/clients/redis.d.ts +0 -29
  137. package/build/esm/services/store/clients/redis.js +0 -140
  138. package/build/esm/services/store/index.d.ts +0 -88
  139. package/build/esm/services/store/index.js +0 -623
  140. package/build/esm/services/stream/clients/ioredis.d.ts +0 -23
  141. package/build/esm/services/stream/clients/ioredis.js +0 -112
  142. package/build/esm/services/stream/clients/redis.d.ts +0 -23
  143. package/build/esm/services/stream/clients/redis.js +0 -116
  144. package/build/esm/services/stream/index.d.ts +0 -21
  145. package/build/esm/services/stream/index.js +0 -6
  146. package/build/esm/services/sub/clients/ioredis.d.ts +0 -20
  147. package/build/esm/services/sub/clients/ioredis.js +0 -69
  148. package/build/esm/services/sub/clients/redis.d.ts +0 -20
  149. package/build/esm/services/sub/clients/redis.js +0 -60
  150. package/build/esm/services/sub/index.d.ts +0 -18
  151. package/build/esm/services/sub/index.js +0 -6
  152. package/build/esm/services/task/index.d.ts +0 -18
  153. package/build/esm/services/task/index.js +0 -70
  154. package/build/esm/services/telemetry/index.d.ts +0 -49
  155. package/build/esm/services/telemetry/index.js +0 -217
  156. package/build/esm/services/worker/index.d.ts +0 -30
  157. package/build/esm/services/worker/index.js +0 -102
  158. package/build/esm/types/activity.d.ts +0 -92
  159. package/build/esm/types/activity.js +0 -1
  160. package/build/esm/types/app.d.ts +0 -16
  161. package/build/esm/types/app.js +0 -1
  162. package/build/esm/types/async.d.ts +0 -5
  163. package/build/esm/types/async.js +0 -1
  164. package/build/esm/types/cache.d.ts +0 -1
  165. package/build/esm/types/cache.js +0 -1
  166. package/build/esm/types/collator.d.ts +0 -8
  167. package/build/esm/types/collator.js +0 -8
  168. package/build/esm/types/durable.d.ts +0 -59
  169. package/build/esm/types/durable.js +0 -1
  170. package/build/esm/types/hook.d.ts +0 -31
  171. package/build/esm/types/hook.js +0 -6
  172. package/build/esm/types/hotmesh.d.ts +0 -82
  173. package/build/esm/types/hotmesh.js +0 -1
  174. package/build/esm/types/index.d.ts +0 -20
  175. package/build/esm/types/index.js +0 -5
  176. package/build/esm/types/ioredisclient.d.ts +0 -5
  177. package/build/esm/types/ioredisclient.js +0 -2
  178. package/build/esm/types/job.d.ts +0 -50
  179. package/build/esm/types/job.js +0 -1
  180. package/build/esm/types/logger.d.ts +0 -6
  181. package/build/esm/types/logger.js +0 -1
  182. package/build/esm/types/map.d.ts +0 -4
  183. package/build/esm/types/map.js +0 -1
  184. package/build/esm/types/pipe.d.ts +0 -4
  185. package/build/esm/types/pipe.js +0 -1
  186. package/build/esm/types/quorum.d.ts +0 -46
  187. package/build/esm/types/quorum.js +0 -1
  188. package/build/esm/types/redis.d.ts +0 -8
  189. package/build/esm/types/redis.js +0 -1
  190. package/build/esm/types/redisclient.d.ts +0 -25
  191. package/build/esm/types/redisclient.js +0 -1
  192. package/build/esm/types/serializer.d.ts +0 -33
  193. package/build/esm/types/serializer.js +0 -1
  194. package/build/esm/types/stats.d.ts +0 -83
  195. package/build/esm/types/stats.js +0 -1
  196. package/build/esm/types/stream.d.ts +0 -67
  197. package/build/esm/types/stream.js +0 -22
  198. package/build/esm/types/telemetry.d.ts +0 -1
  199. package/build/esm/types/telemetry.js +0 -1
  200. package/build/esm/types/transition.d.ts +0 -17
  201. package/build/esm/types/transition.js +0 -1
  202. package/tsconfig.cjs.json +0 -8
  203. package/tsconfig.esm.json +0 -9
  204. /package/build/{cjs/index.d.ts → index.d.ts} +0 -0
  205. /package/build/{cjs/index.js → index.js} +0 -0
  206. /package/build/{cjs/modules → modules}/errors.d.ts +0 -0
  207. /package/build/{cjs/modules → modules}/errors.js +0 -0
  208. /package/build/{cjs/modules → modules}/utils.d.ts +0 -0
  209. /package/build/{cjs/modules → modules}/utils.js +0 -0
  210. /package/build/{cjs/services → services}/activities/activity.d.ts +0 -0
  211. /package/build/{cjs/services → services}/activities/activity.js +0 -0
  212. /package/build/{cjs/services → services}/activities/await.d.ts +0 -0
  213. /package/build/{cjs/services → services}/activities/await.js +0 -0
  214. /package/build/{cjs/services → services}/activities/cycle.d.ts +0 -0
  215. /package/build/{cjs/services → services}/activities/cycle.js +0 -0
  216. /package/build/{cjs/services → services}/activities/emit.d.ts +0 -0
  217. /package/build/{cjs/services → services}/activities/emit.js +0 -0
  218. /package/build/{cjs/services → services}/activities/index.d.ts +0 -0
  219. /package/build/{cjs/services → services}/activities/index.js +0 -0
  220. /package/build/{cjs/services → services}/activities/iterate.d.ts +0 -0
  221. /package/build/{cjs/services → services}/activities/iterate.js +0 -0
  222. /package/build/{cjs/services → services}/activities/trigger.d.ts +0 -0
  223. /package/build/{cjs/services → services}/activities/trigger.js +0 -0
  224. /package/build/{cjs/services → services}/activities/worker.d.ts +0 -0
  225. /package/build/{cjs/services → services}/activities/worker.js +0 -0
  226. /package/build/{cjs/services → services}/collator/index.d.ts +0 -0
  227. /package/build/{cjs/services → services}/collator/index.js +0 -0
  228. /package/build/{cjs/services → services}/compiler/deployer.d.ts +0 -0
  229. /package/build/{cjs/services → services}/compiler/deployer.js +0 -0
  230. /package/build/{cjs/services → services}/compiler/index.d.ts +0 -0
  231. /package/build/{cjs/services → services}/compiler/index.js +0 -0
  232. /package/build/{cjs/services → services}/compiler/validator.d.ts +0 -0
  233. /package/build/{cjs/services → services}/compiler/validator.js +0 -0
  234. /package/build/{cjs/services → services}/connector/clients/ioredis.d.ts +0 -0
  235. /package/build/{cjs/services → services}/connector/clients/ioredis.js +0 -0
  236. /package/build/{cjs/services → services}/connector/clients/redis.d.ts +0 -0
  237. /package/build/{cjs/services → services}/connector/clients/redis.js +0 -0
  238. /package/build/{cjs/services → services}/connector/index.d.ts +0 -0
  239. /package/build/{cjs/services → services}/connector/index.js +0 -0
  240. /package/build/{cjs/services → services}/dimension/index.d.ts +0 -0
  241. /package/build/{cjs/services → services}/dimension/index.js +0 -0
  242. /package/build/{cjs/services → services}/durable/asyncLocalStorage.d.ts +0 -0
  243. /package/build/{cjs/services → services}/durable/asyncLocalStorage.js +0 -0
  244. /package/build/{cjs/services → services}/durable/client.d.ts +0 -0
  245. /package/build/{cjs/services → services}/durable/client.js +0 -0
  246. /package/build/{cjs/services → services}/durable/connection.d.ts +0 -0
  247. /package/build/{cjs/services → services}/durable/connection.js +0 -0
  248. /package/build/{cjs/services → services}/durable/factory.d.ts +0 -0
  249. /package/build/{cjs/services → services}/durable/factory.js +0 -0
  250. /package/build/{cjs/services → services}/durable/handle.d.ts +0 -0
  251. /package/build/{cjs/services → services}/durable/handle.js +0 -0
  252. /package/build/{cjs/services → services}/durable/index.d.ts +0 -0
  253. /package/build/{cjs/services → services}/durable/index.js +0 -0
  254. /package/build/{cjs/services → services}/durable/native.d.ts +0 -0
  255. /package/build/{cjs/services → services}/durable/workflow.d.ts +0 -0
  256. /package/build/{cjs/services → services}/engine/index.d.ts +0 -0
  257. /package/build/{cjs/services → services}/engine/index.js +0 -0
  258. /package/build/{cjs/services → services}/hotmesh/index.d.ts +0 -0
  259. /package/build/{cjs/services → services}/logger/index.d.ts +0 -0
  260. /package/build/{cjs/services → services}/logger/index.js +0 -0
  261. /package/build/{cjs/services → services}/mapper/index.d.ts +0 -0
  262. /package/build/{cjs/services → services}/mapper/index.js +0 -0
  263. /package/build/{cjs/services → services}/pipe/functions/array.d.ts +0 -0
  264. /package/build/{cjs/services → services}/pipe/functions/array.js +0 -0
  265. /package/build/{cjs/services → services}/pipe/functions/bitwise.d.ts +0 -0
  266. /package/build/{cjs/services → services}/pipe/functions/bitwise.js +0 -0
  267. /package/build/{cjs/services → services}/pipe/functions/conditional.d.ts +0 -0
  268. /package/build/{cjs/services → services}/pipe/functions/conditional.js +0 -0
  269. /package/build/{cjs/services → services}/pipe/functions/date.d.ts +0 -0
  270. /package/build/{cjs/services → services}/pipe/functions/date.js +0 -0
  271. /package/build/{cjs/services → services}/pipe/functions/index.d.ts +0 -0
  272. /package/build/{cjs/services → services}/pipe/functions/index.js +0 -0
  273. /package/build/{cjs/services → services}/pipe/functions/json.d.ts +0 -0
  274. /package/build/{cjs/services → services}/pipe/functions/json.js +0 -0
  275. /package/build/{cjs/services → services}/pipe/functions/math.d.ts +0 -0
  276. /package/build/{cjs/services → services}/pipe/functions/math.js +0 -0
  277. /package/build/{cjs/services → services}/pipe/functions/number.d.ts +0 -0
  278. /package/build/{cjs/services → services}/pipe/functions/number.js +0 -0
  279. /package/build/{cjs/services → services}/pipe/functions/object.d.ts +0 -0
  280. /package/build/{cjs/services → services}/pipe/functions/object.js +0 -0
  281. /package/build/{cjs/services → services}/pipe/functions/string.d.ts +0 -0
  282. /package/build/{cjs/services → services}/pipe/functions/string.js +0 -0
  283. /package/build/{cjs/services → services}/pipe/functions/symbol.d.ts +0 -0
  284. /package/build/{cjs/services → services}/pipe/functions/symbol.js +0 -0
  285. /package/build/{cjs/services → services}/pipe/functions/unary.d.ts +0 -0
  286. /package/build/{cjs/services → services}/pipe/functions/unary.js +0 -0
  287. /package/build/{cjs/services → services}/pipe/index.d.ts +0 -0
  288. /package/build/{cjs/services → services}/pipe/index.js +0 -0
  289. /package/build/{cjs/services → services}/quorum/index.d.ts +0 -0
  290. /package/build/{cjs/services → services}/quorum/index.js +0 -0
  291. /package/build/{cjs/services → services}/reporter/index.d.ts +0 -0
  292. /package/build/{cjs/services → services}/reporter/index.js +0 -0
  293. /package/build/{cjs/services → services}/serializer/index.d.ts +0 -0
  294. /package/build/{cjs/services → services}/serializer/index.js +0 -0
  295. /package/build/{cjs/services → services}/signaler/store.d.ts +0 -0
  296. /package/build/{cjs/services → services}/signaler/store.js +0 -0
  297. /package/build/{cjs/services → services}/signaler/stream.d.ts +0 -0
  298. /package/build/{cjs/services → services}/signaler/stream.js +0 -0
  299. /package/build/{cjs/services → services}/store/cache.d.ts +0 -0
  300. /package/build/{cjs/services → services}/store/cache.js +0 -0
  301. /package/build/{cjs/services → services}/store/clients/ioredis.d.ts +0 -0
  302. /package/build/{cjs/services → services}/store/clients/ioredis.js +0 -0
  303. /package/build/{cjs/services → services}/store/clients/redis.d.ts +0 -0
  304. /package/build/{cjs/services → services}/store/clients/redis.js +0 -0
  305. /package/build/{cjs/services → services}/store/index.d.ts +0 -0
  306. /package/build/{cjs/services → services}/stream/clients/ioredis.d.ts +0 -0
  307. /package/build/{cjs/services → services}/stream/clients/redis.d.ts +0 -0
  308. /package/build/{cjs/services → services}/stream/index.d.ts +0 -0
  309. /package/build/{cjs/services → services}/stream/index.js +0 -0
  310. /package/build/{cjs/services → services}/sub/clients/ioredis.d.ts +0 -0
  311. /package/build/{cjs/services → services}/sub/clients/redis.d.ts +0 -0
  312. /package/build/{cjs/services → services}/sub/index.d.ts +0 -0
  313. /package/build/{cjs/services → services}/sub/index.js +0 -0
  314. /package/build/{cjs/services → services}/task/index.d.ts +0 -0
  315. /package/build/{cjs/services → services}/task/index.js +0 -0
  316. /package/build/{cjs/services → services}/telemetry/index.d.ts +0 -0
  317. /package/build/{cjs/services → services}/telemetry/index.js +0 -0
  318. /package/build/{cjs/services → services}/worker/index.d.ts +0 -0
  319. /package/build/{cjs/services → services}/worker/index.js +0 -0
  320. /package/build/{cjs/types → types}/activity.d.ts +0 -0
  321. /package/build/{cjs/types → types}/activity.js +0 -0
  322. /package/build/{cjs/types → types}/app.d.ts +0 -0
  323. /package/build/{cjs/types → types}/app.js +0 -0
  324. /package/build/{cjs/types → types}/async.d.ts +0 -0
  325. /package/build/{cjs/types → types}/async.js +0 -0
  326. /package/build/{cjs/types → types}/cache.d.ts +0 -0
  327. /package/build/{cjs/types → types}/cache.js +0 -0
  328. /package/build/{cjs/types → types}/collator.d.ts +0 -0
  329. /package/build/{cjs/types → types}/collator.js +0 -0
  330. /package/build/{cjs/types → types}/durable.js +0 -0
  331. /package/build/{cjs/types → types}/hook.d.ts +0 -0
  332. /package/build/{cjs/types → types}/hook.js +0 -0
  333. /package/build/{cjs/types → types}/hotmesh.d.ts +0 -0
  334. /package/build/{cjs/types → types}/hotmesh.js +0 -0
  335. /package/build/{cjs/types → types}/index.d.ts +0 -0
  336. /package/build/{cjs/types → types}/index.js +0 -0
  337. /package/build/{cjs/types → types}/ioredisclient.d.ts +0 -0
  338. /package/build/{cjs/types → types}/ioredisclient.js +0 -0
  339. /package/build/{cjs/types → types}/job.d.ts +0 -0
  340. /package/build/{cjs/types → types}/job.js +0 -0
  341. /package/build/{cjs/types → types}/logger.d.ts +0 -0
  342. /package/build/{cjs/types → types}/logger.js +0 -0
  343. /package/build/{cjs/types → types}/map.d.ts +0 -0
  344. /package/build/{cjs/types → types}/map.js +0 -0
  345. /package/build/{cjs/types → types}/pipe.d.ts +0 -0
  346. /package/build/{cjs/types → types}/pipe.js +0 -0
  347. /package/build/{cjs/types → types}/quorum.d.ts +0 -0
  348. /package/build/{cjs/types → types}/quorum.js +0 -0
  349. /package/build/{cjs/types → types}/redis.d.ts +0 -0
  350. /package/build/{cjs/types → types}/redis.js +0 -0
  351. /package/build/{cjs/types → types}/redisclient.d.ts +0 -0
  352. /package/build/{cjs/types → types}/redisclient.js +0 -0
  353. /package/build/{cjs/types → types}/serializer.d.ts +0 -0
  354. /package/build/{cjs/types → types}/serializer.js +0 -0
  355. /package/build/{cjs/types → types}/stats.d.ts +0 -0
  356. /package/build/{cjs/types → types}/stats.js +0 -0
  357. /package/build/{cjs/types → types}/stream.d.ts +0 -0
  358. /package/build/{cjs/types → types}/stream.js +0 -0
  359. /package/build/{cjs/types → types}/telemetry.d.ts +0 -0
  360. /package/build/{cjs/types → types}/telemetry.js +0 -0
  361. /package/build/{cjs/types → types}/transition.d.ts +0 -0
  362. /package/build/{cjs/types → types}/transition.js +0 -0
@@ -1,486 +0,0 @@
1
- import { GetStateError } from '../../modules/errors';
2
- import { formatISODate, getValueByPath, restoreHierarchy } from '../../modules/utils';
3
- import { CollatorService } from '../collator';
4
- import { DimensionService } from '../dimension';
5
- import { MapperService } from '../mapper';
6
- import { Pipe } from '../pipe';
7
- import { MDATA_SYMBOLS } from '../serializer';
8
- import { StoreSignaler } from '../signaler/store';
9
- import { TelemetryService } from '../telemetry';
10
- import { StreamDataType, StreamStatus } from '../../types/stream';
11
- /**
12
- * The base class for all activities
13
- */
14
- class Activity {
15
- constructor(config, data, metadata, hook, engine, context) {
16
- this.status = StreamStatus.SUCCESS;
17
- this.code = 200;
18
- this.adjacentIndex = 0; //can be updated by leg2 using 'as' metadata hincrby output
19
- this.config = config;
20
- this.data = data;
21
- this.metadata = metadata;
22
- this.hook = hook;
23
- this.engine = engine;
24
- this.context = context || { data: {}, metadata: {} };
25
- this.logger = engine.logger;
26
- this.store = engine.store;
27
- }
28
- //******** INITIAL ENTRY POINT (A) ********//
29
- async process() {
30
- this.logger.debug('activity-process', { jid: this.context.metadata.jid, aid: this.metadata.aid });
31
- let telemetry;
32
- try {
33
- this.setLeg(1);
34
- await CollatorService.notarizeEntry(this);
35
- await this.getState();
36
- telemetry = new TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
37
- telemetry.startActivitySpan(this.leg);
38
- let multiResponse;
39
- const multi = this.store.getMulti();
40
- if (this.doesHook()) {
41
- //sleep and wait to awaken upon a signal
42
- await this.registerHook(multi);
43
- this.mapJobData();
44
- await this.setState(multi);
45
- await CollatorService.authorizeReentry(this, multi);
46
- await this.setStatus(0, multi);
47
- await multi.exec();
48
- telemetry.mapActivityAttributes();
49
- }
50
- else {
51
- //end the activity and transition to its children
52
- this.adjacencyList = await this.filterAdjacent();
53
- this.mapJobData();
54
- await this.setState(multi);
55
- await CollatorService.notarizeEarlyCompletion(this, multi);
56
- await this.setStatus(this.adjacencyList.length - 1, multi);
57
- multiResponse = await multi.exec();
58
- telemetry.mapActivityAttributes();
59
- const jobStatus = this.resolveStatus(multiResponse);
60
- const attrs = { 'app.job.jss': jobStatus };
61
- const messageIds = await this.transition(this.adjacencyList, jobStatus);
62
- if (messageIds.length) {
63
- attrs['app.activity.mids'] = messageIds.join(',');
64
- }
65
- telemetry.setActivityAttributes(attrs);
66
- }
67
- return this.context.metadata.aid;
68
- }
69
- catch (error) {
70
- if (error instanceof GetStateError) {
71
- this.logger.error('activity-get-state-error', error);
72
- }
73
- else {
74
- this.logger.error('activity-process-error', error);
75
- }
76
- telemetry.setActivityError(error.message);
77
- throw error;
78
- }
79
- finally {
80
- telemetry.endActivitySpan();
81
- this.logger.debug('activity-process-end', { jid: this.context.metadata.jid, aid: this.metadata.aid });
82
- }
83
- }
84
- setLeg(leg) {
85
- this.leg = leg;
86
- }
87
- //******** SIGNAL RE-ENTRY POINT ********//
88
- doesHook() {
89
- return !!(this.config.hook?.topic || this.config.sleep);
90
- }
91
- async registerHook(multi) {
92
- if (this.config.hook?.topic) {
93
- const signaler = new StoreSignaler(this.store, this.logger);
94
- return await signaler.registerWebHook(this.config.hook.topic, this.context, multi);
95
- }
96
- else if (this.config.sleep) {
97
- const durationInSeconds = Pipe.resolve(this.config.sleep, this.context);
98
- const jobId = this.context.metadata.jid;
99
- const activityId = this.metadata.aid;
100
- const dId = this.metadata.dad;
101
- await this.engine.task.registerTimeHook(jobId, `${activityId}${dId || ''}`, 'sleep', durationInSeconds);
102
- return jobId;
103
- }
104
- }
105
- async processWebHookEvent() {
106
- this.logger.debug('engine-process-web-hook-event', {
107
- topic: this.config.hook.topic,
108
- aid: this.metadata.aid
109
- });
110
- const signaler = new StoreSignaler(this.store, this.logger);
111
- const data = { ...this.data };
112
- const jobId = await signaler.processWebHookSignal(this.config.hook.topic, data);
113
- if (jobId) {
114
- await this.processHookEvent(jobId);
115
- await signaler.deleteWebHookSignal(this.config.hook.topic, data);
116
- } //else => already resolved
117
- }
118
- async processTimeHookEvent(jobId) {
119
- this.logger.debug('engine-process-time-hook-event', {
120
- jid: jobId,
121
- aid: this.metadata.aid
122
- });
123
- return await this.processHookEvent(jobId);
124
- }
125
- async processHookEvent(jobId) {
126
- this.logger.debug('activity-process-hook-event', { jobId });
127
- let telemetry;
128
- try {
129
- this.setLeg(2);
130
- await this.getState(jobId);
131
- const aState = await CollatorService.notarizeReentry(this);
132
- this.adjacentIndex = CollatorService.getDimensionalIndex(aState);
133
- telemetry = new TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
134
- telemetry.startActivitySpan(this.leg);
135
- this.bindActivityData('hook');
136
- this.mapJobData();
137
- this.adjacencyList = await this.filterAdjacent();
138
- const multi = this.engine.store.getMulti();
139
- await this.setState(multi);
140
- await CollatorService.notarizeCompletion(this, multi);
141
- await this.setStatus(this.adjacencyList.length - 1, multi);
142
- const multiResponse = await multi.exec();
143
- telemetry.mapActivityAttributes();
144
- const jobStatus = this.resolveStatus(multiResponse);
145
- const attrs = { 'app.job.jss': jobStatus };
146
- const messageIds = await this.transition(this.adjacencyList, jobStatus);
147
- if (messageIds.length) {
148
- attrs['app.activity.mids'] = messageIds.join(',');
149
- }
150
- telemetry.setActivityAttributes(attrs);
151
- return jobStatus;
152
- }
153
- catch (error) {
154
- this.logger.error('engine-process-hook-event-error', error);
155
- telemetry.setActivityError(error.message);
156
- throw error;
157
- }
158
- finally {
159
- telemetry.endActivitySpan();
160
- }
161
- }
162
- //******** DUPLEX RE-ENTRY POINT ********//
163
- async processEvent(status = StreamStatus.SUCCESS, code = 200) {
164
- this.setLeg(2);
165
- const jid = this.context.metadata.jid;
166
- const aid = this.metadata.aid;
167
- this.status = status;
168
- this.code = code;
169
- this.logger.debug('activity-process-event', { topic: this.config.subtype, jid, aid, status, code });
170
- let telemetry;
171
- try {
172
- await this.getState();
173
- const aState = await CollatorService.notarizeReentry(this);
174
- this.adjacentIndex = CollatorService.getDimensionalIndex(aState);
175
- telemetry = new TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
176
- let isComplete = CollatorService.isActivityComplete(this.context.metadata.js);
177
- if (isComplete) {
178
- this.logger.warn('activity-process-event-duplicate', { jid, aid });
179
- this.logger.debug('activity-process-event-duplicate-resolution', { resolution: 'Increase HotMesh config `reclaimDelay` timeout.' });
180
- return;
181
- }
182
- telemetry.startActivitySpan(this.leg);
183
- let multiResponse;
184
- if (status === StreamStatus.PENDING) {
185
- multiResponse = await this.processPending(telemetry);
186
- }
187
- else if (status === StreamStatus.SUCCESS) {
188
- multiResponse = await this.processSuccess(telemetry);
189
- }
190
- else {
191
- multiResponse = await this.processError(telemetry);
192
- }
193
- this.transitionAdjacent(multiResponse, telemetry);
194
- }
195
- catch (error) {
196
- this.logger.error('activity-process-event-error', error);
197
- telemetry.setActivityError(error.message);
198
- throw error;
199
- }
200
- finally {
201
- telemetry.endActivitySpan();
202
- this.logger.debug('activity-process-event-end', { jid, aid });
203
- }
204
- }
205
- async processPending(telemetry) {
206
- this.bindActivityData('output');
207
- this.adjacencyList = await this.filterAdjacent();
208
- this.mapJobData();
209
- const multi = this.store.getMulti();
210
- await this.setState(multi);
211
- await CollatorService.notarizeContinuation(this, multi);
212
- await this.setStatus(this.adjacencyList.length, multi);
213
- return await multi.exec();
214
- }
215
- async processSuccess(telemetry) {
216
- this.bindActivityData('output');
217
- this.adjacencyList = await this.filterAdjacent();
218
- this.mapJobData();
219
- const multi = this.store.getMulti();
220
- await this.setState(multi);
221
- await CollatorService.notarizeCompletion(this, multi);
222
- await this.setStatus(this.adjacencyList.length - 1, multi);
223
- return await multi.exec();
224
- }
225
- async processError(telemetry) {
226
- this.bindActivityError(this.data);
227
- this.adjacencyList = await this.filterAdjacent();
228
- const multi = this.store.getMulti();
229
- await this.setState(multi);
230
- await CollatorService.notarizeCompletion(this, multi);
231
- await this.setStatus(this.adjacencyList.length - 1, multi);
232
- return await multi.exec();
233
- }
234
- async transitionAdjacent(multiResponse, telemetry) {
235
- telemetry.mapActivityAttributes();
236
- const jobStatus = this.resolveStatus(multiResponse);
237
- const attrs = { 'app.job.jss': jobStatus };
238
- const messageIds = await this.transition(this.adjacencyList, jobStatus);
239
- if (messageIds.length) {
240
- attrs['app.activity.mids'] = messageIds.join(',');
241
- }
242
- telemetry.setActivityAttributes(attrs);
243
- }
244
- resolveStatus(multiResponse) {
245
- const activityStatus = multiResponse[multiResponse.length - 1];
246
- if (Array.isArray(activityStatus)) {
247
- return Number(activityStatus[1]);
248
- }
249
- else {
250
- return Number(activityStatus);
251
- }
252
- }
253
- mapJobData() {
254
- if (this.config.job?.maps) {
255
- const mapper = new MapperService(this.config.job.maps, this.context);
256
- this.context.data = mapper.mapRules();
257
- }
258
- }
259
- mapInputData() {
260
- if (this.config.input?.maps) {
261
- const mapper = new MapperService(this.config.input.maps, this.context);
262
- this.context.data = mapper.mapRules();
263
- }
264
- }
265
- async registerTimeout() {
266
- //set timeout in support of hook and/or duplex
267
- }
268
- bindActivityError(data) {
269
- //todo: map activity error data into the job error (if defined)
270
- // map job status via: (500: [3**, 4**, 5**], 202: [$pending])
271
- this.context.metadata.err = JSON.stringify(data);
272
- }
273
- async getTriggerConfig() {
274
- return await this.store.getSchema(this.config.trigger, await this.engine.getVID());
275
- }
276
- getJobStatus() {
277
- return null;
278
- }
279
- async setStatus(amount, multi) {
280
- const { id: appId } = await this.engine.getVID();
281
- await this.store.setStatus(amount, this.context.metadata.jid, appId, multi);
282
- }
283
- authorizeEntry(state) {
284
- //pre-authorize activity state to allow entry for adjacent activities
285
- return this.adjacencyList?.map((streamData) => {
286
- const { metadata: { aid } } = streamData;
287
- state[`${aid}/output/metadata/as`] = CollatorService.getSeed();
288
- return aid;
289
- }) ?? [];
290
- }
291
- bindDimensionalAddress(state) {
292
- const dad = this.resolveDad();
293
- state[`${this.metadata.aid}/output/metadata/dad`] = dad;
294
- }
295
- async setState(multi) {
296
- const jobId = this.context.metadata.jid;
297
- this.bindJobMetadata();
298
- this.bindActivityMetadata();
299
- let state = {};
300
- await this.bindJobState(state);
301
- const presets = this.authorizeEntry(state);
302
- this.bindDimensionalAddress(state);
303
- this.bindActivityState(state);
304
- //symbolNames holds symkeys
305
- const symbolNames = [
306
- `$${this.config.subscribes}`,
307
- this.metadata.aid,
308
- ...presets
309
- ];
310
- const dIds = CollatorService.getDimensionsById([...this.config.ancestors, this.metadata.aid], this.resolveDad());
311
- return await this.store.setState(state, this.getJobStatus(), jobId, symbolNames, dIds, multi);
312
- }
313
- bindJobMetadata() {
314
- //both legs of the most recently run activity (1 and 2) modify ju (job_updated)
315
- this.context.metadata.ju = formatISODate(new Date());
316
- }
317
- bindActivityMetadata() {
318
- const self = this.context['$self'];
319
- if (!self.output.metadata) {
320
- self.output.metadata = {};
321
- }
322
- if (this.status === StreamStatus.ERROR) {
323
- self.output.metadata.err = JSON.stringify(this.data);
324
- }
325
- //todo: verify leg2 never overwrites leg1 `ac`
326
- self.output.metadata.ac =
327
- self.output.metadata.au = formatISODate(new Date());
328
- self.output.metadata.atp = this.config.type;
329
- if (this.config.subtype) {
330
- self.output.metadata.stp = this.config.subtype;
331
- }
332
- self.output.metadata.aid = this.metadata.aid;
333
- }
334
- async bindJobState(state) {
335
- const triggerConfig = await this.getTriggerConfig();
336
- const PRODUCES = [
337
- ...(triggerConfig.PRODUCES || []),
338
- ...this.bindJobMetadataPaths()
339
- ];
340
- for (const path of PRODUCES) {
341
- const value = getValueByPath(this.context, path);
342
- if (value !== undefined) {
343
- state[path] = value;
344
- }
345
- }
346
- TelemetryService.bindJobTelemetryToState(state, this.config, this.context);
347
- }
348
- bindActivityState(state) {
349
- const produces = [
350
- ...this.config.produces,
351
- ...this.bindActivityMetadataPaths()
352
- ];
353
- for (const path of produces) {
354
- const prefixedPath = `${this.metadata.aid}/${path}`;
355
- const value = getValueByPath(this.context, prefixedPath);
356
- if (value !== undefined) {
357
- state[prefixedPath] = value;
358
- }
359
- }
360
- TelemetryService.bindActivityTelemetryToState(state, this.config, this.metadata, this.context, this.leg);
361
- }
362
- bindJobMetadataPaths() {
363
- return MDATA_SYMBOLS.JOB_UPDATE.KEYS.map((key) => `metadata/${key}`);
364
- }
365
- bindActivityMetadataPaths() {
366
- const keys_to_save = this.leg === 1 ? 'ACTIVITY' : 'ACTIVITY_UPDATE';
367
- return MDATA_SYMBOLS[keys_to_save].KEYS.map((key) => `output/metadata/${key}`);
368
- }
369
- async getState(jobId) {
370
- //assemble list of paths necessary to create 'job state' from the 'symbol hash'
371
- const jobSymbolHashName = `$${this.config.subscribes}`;
372
- const consumes = {
373
- [jobSymbolHashName]: MDATA_SYMBOLS.JOB.KEYS.map((key) => `metadata/${key}`)
374
- };
375
- for (let [activityId, paths] of Object.entries(this.config.consumes)) {
376
- if (activityId === '$job') {
377
- for (const path of paths) {
378
- consumes[jobSymbolHashName].push(path);
379
- }
380
- }
381
- else {
382
- if (activityId === '$self') {
383
- activityId = this.metadata.aid;
384
- }
385
- if (!consumes[activityId]) {
386
- consumes[activityId] = [];
387
- }
388
- for (const path of paths) {
389
- consumes[activityId].push(`${activityId}/${path}`);
390
- }
391
- }
392
- }
393
- TelemetryService.addTargetTelemetryPaths(consumes, this.config, this.metadata, this.leg);
394
- let { dad, jid } = this.context.metadata;
395
- jobId = jobId || jid;
396
- const dIds = CollatorService.getDimensionsById([...this.config.ancestors, this.metadata.aid], dad);
397
- //`state` is a flat hash; context is a tree
398
- const [state, status] = await this.store.getState(jobId, consumes, dIds);
399
- this.context = restoreHierarchy(state);
400
- this.initDimensionalAddress(dad);
401
- this.initSelf(this.context);
402
- this.initPolicies(this.context);
403
- }
404
- initDimensionalAddress(dad) {
405
- this.metadata.dad = dad;
406
- }
407
- initSelf(context) {
408
- const activityId = this.metadata.aid;
409
- if (!context[activityId]) {
410
- context[activityId] = {};
411
- }
412
- const self = context[activityId];
413
- if (!self.output) {
414
- self.output = {};
415
- }
416
- if (!self.input) {
417
- self.input = {};
418
- }
419
- if (!self.hook) {
420
- self.hook = {};
421
- }
422
- context['$self'] = self;
423
- context['$job'] = context; //NEVER call STRINGIFY! (circular)
424
- return context;
425
- }
426
- initPolicies(context) {
427
- context.metadata.expire = this.config.expire;
428
- }
429
- bindActivityData(type) {
430
- this.context[this.metadata.aid][type].data = this.data;
431
- }
432
- resolveDad() {
433
- let dad = this.metadata.dad;
434
- if (this.adjacentIndex > 0) {
435
- //if adjacent index > 0 the activity is cycling; replace last index with cycle index
436
- dad = `${dad.substring(0, dad.lastIndexOf(','))},${this.adjacentIndex}`;
437
- }
438
- return dad;
439
- }
440
- resolveAdjacentDad() {
441
- //concat self and child dimension (all children (leg 1) begin life at 0)
442
- return `${this.resolveDad()}${DimensionService.getSeed(0)}`;
443
- }
444
- ;
445
- async filterAdjacent() {
446
- const adjacencyList = [];
447
- const transitions = await this.store.getTransitions(await this.engine.getVID());
448
- const transition = transitions[`.${this.metadata.aid}`];
449
- //resolve the dimensional address for adjacent children
450
- const adjacentDad = this.resolveAdjacentDad();
451
- if (transition) {
452
- for (const toActivityId in transition) {
453
- const transitionRule = transition[toActivityId];
454
- if (MapperService.evaluate(transitionRule, this.context, this.code)) {
455
- adjacencyList.push({
456
- metadata: {
457
- jid: this.context.metadata.jid,
458
- dad: adjacentDad,
459
- aid: toActivityId,
460
- spn: this.context['$self'].output.metadata?.l2s,
461
- trc: this.context.metadata.trc,
462
- },
463
- type: StreamDataType.TRANSITION,
464
- data: {}
465
- });
466
- }
467
- }
468
- }
469
- return adjacencyList;
470
- }
471
- async transition(adjacencyList, jobStatus) {
472
- let mIds = [];
473
- if (adjacencyList.length) {
474
- const multi = this.store.getMulti();
475
- for (const execSignal of adjacencyList) {
476
- await this.engine.streamSignaler?.publishMessage(null, execSignal, multi);
477
- }
478
- mIds = (await multi.exec());
479
- }
480
- else if (jobStatus <= 0) {
481
- await this.engine.runJobCompletionTasks(this.context);
482
- }
483
- return mIds;
484
- }
485
- }
486
- export { Activity };
@@ -1,16 +0,0 @@
1
- import { Activity } from './activity';
2
- import { EngineService } from '../engine';
3
- import { ActivityData, ActivityMetadata, AwaitActivity, ActivityType } from '../../types/activity';
4
- import { JobState } from '../../types/job';
5
- import { MultiResponseFlags } from '../../types/redis';
6
- import { StreamCode, StreamData, StreamStatus } from '../../types/stream';
7
- declare class Await extends Activity {
8
- config: AwaitActivity;
9
- constructor(config: ActivityType, data: ActivityData, metadata: ActivityMetadata, hook: ActivityData | null, engine: EngineService, context?: JobState);
10
- process(): Promise<string>;
11
- execActivity(): Promise<string>;
12
- processEvent(status?: StreamStatus, code?: StreamCode): Promise<void>;
13
- processSuccessResponse(adjacencyList: StreamData[]): Promise<MultiResponseFlags>;
14
- processErrorResponse(adjacencyList: StreamData[]): Promise<MultiResponseFlags>;
15
- }
16
- export { Await };
@@ -1,140 +0,0 @@
1
- import { GetStateError } from '../../modules/errors';
2
- import { Activity } from './activity';
3
- import { StreamDataType, StreamStatus } from '../../types/stream';
4
- import { TelemetryService } from '../telemetry';
5
- import { CollatorService } from '../collator';
6
- class Await extends Activity {
7
- constructor(config, data, metadata, hook, engine, context) {
8
- super(config, data, metadata, hook, engine, context);
9
- }
10
- //******** INITIAL ENTRY POINT (A) ********//
11
- async process() {
12
- this.logger.debug('await-process', { jid: this.context.metadata.jid, aid: this.metadata.aid });
13
- let telemetry;
14
- try {
15
- this.setLeg(1);
16
- await CollatorService.notarizeEntry(this);
17
- await this.getState();
18
- telemetry = new TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
19
- telemetry.startActivitySpan(this.leg);
20
- this.mapInputData();
21
- const multi = this.store.getMulti();
22
- //todo: await this.registerTimeout();
23
- await CollatorService.authorizeReentry(this, multi);
24
- await this.setState(multi);
25
- await this.setStatus(0, multi);
26
- const multiResponse = await multi.exec();
27
- telemetry.mapActivityAttributes();
28
- const jobStatus = this.resolveStatus(multiResponse);
29
- const messageId = await this.execActivity();
30
- telemetry.setActivityAttributes({
31
- 'app.activity.mid': messageId,
32
- 'app.job.jss': jobStatus
33
- });
34
- return this.context.metadata.aid;
35
- }
36
- catch (error) {
37
- telemetry.setActivityError(error.message);
38
- if (error instanceof GetStateError) {
39
- this.logger.error('await-get-state-error', error);
40
- }
41
- else {
42
- this.logger.error('await-process-error', error);
43
- }
44
- throw error;
45
- }
46
- finally {
47
- telemetry.endActivitySpan();
48
- this.logger.debug('await-process-end', { jid: this.context.metadata.jid, aid: this.metadata.aid });
49
- }
50
- }
51
- async execActivity() {
52
- const streamData = {
53
- metadata: {
54
- jid: this.context.metadata.jid,
55
- dad: this.metadata.dad,
56
- aid: this.metadata.aid,
57
- topic: this.config.subtype,
58
- spn: this.context['$self'].output.metadata?.l1s,
59
- trc: this.context.metadata.trc,
60
- },
61
- type: StreamDataType.AWAIT,
62
- data: this.context.data
63
- };
64
- if (this.config.retry) {
65
- streamData.policies = {
66
- retry: this.config.retry
67
- };
68
- }
69
- return (await this.engine.streamSignaler?.publishMessage(null, streamData));
70
- }
71
- //******** `RESOLVE` ENTRY POINT (B) ********//
72
- //this method is invoked when the job spawned by this job ends;
73
- //`this.data` is the job data produced by the spawned job
74
- async processEvent(status = StreamStatus.SUCCESS, code = 200) {
75
- this.setLeg(2);
76
- const jid = this.context.metadata.jid;
77
- const aid = this.metadata.aid;
78
- if (!jid) {
79
- throw new Error('await-process-event-error');
80
- }
81
- this.logger.debug('await-resolve-await', { jid, aid, status, code });
82
- this.status = status;
83
- this.code = code;
84
- let telemetry;
85
- try {
86
- await this.getState();
87
- const aState = await CollatorService.notarizeReentry(this);
88
- this.adjacentIndex = CollatorService.getDimensionalIndex(aState);
89
- telemetry = new TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
90
- telemetry.startActivitySpan(this.leg);
91
- let multiResponse = [];
92
- if (status === StreamStatus.SUCCESS) {
93
- this.bindActivityData('output');
94
- this.adjacencyList = await this.filterAdjacent();
95
- multiResponse = await this.processSuccessResponse(this.adjacencyList);
96
- }
97
- else {
98
- this.bindActivityError(this.data);
99
- this.adjacencyList = await this.filterAdjacent();
100
- multiResponse = await this.processErrorResponse(this.adjacencyList);
101
- }
102
- telemetry.mapActivityAttributes();
103
- const jobStatus = this.resolveStatus(multiResponse);
104
- const attrs = { 'app.job.jss': jobStatus };
105
- const messageIds = await this.transition(this.adjacencyList, jobStatus);
106
- if (messageIds.length) {
107
- attrs['app.activity.mids'] = messageIds.join(',');
108
- }
109
- telemetry.setActivityAttributes(attrs);
110
- }
111
- catch (error) {
112
- this.logger.error('await-resolve-await-error', error);
113
- telemetry.setActivityError(error.message);
114
- throw error;
115
- }
116
- finally {
117
- telemetry.endActivitySpan();
118
- this.logger.debug('await-resolve-await-end', { jid, aid, status, code });
119
- }
120
- }
121
- async processSuccessResponse(adjacencyList) {
122
- this.mapJobData();
123
- const multi = this.store.getMulti();
124
- await this.setState(multi);
125
- await CollatorService.notarizeCompletion(this, multi);
126
- await this.setStatus(adjacencyList.length - 1, multi);
127
- return await multi.exec();
128
- }
129
- async processErrorResponse(adjacencyList) {
130
- //todo: if adjacencyList.length == 0, then map to the job output
131
- // this method would be added to Base activity class
132
- //this.mapJobData();
133
- const multi = this.store.getMulti();
134
- await this.setState(multi);
135
- await CollatorService.notarizeCompletion(this, multi);
136
- await this.setStatus(adjacencyList.length - 1, multi);
137
- return await multi.exec();
138
- }
139
- }
140
- export { Await };
@@ -1,19 +0,0 @@
1
- import { EngineService } from '../engine';
2
- import { Activity, ActivityType } from './activity';
3
- import { ActivityData, ActivityMetadata, CycleActivity } from '../../types/activity';
4
- import { JobState } from '../../types/job';
5
- import { RedisMulti } from '../../types/redis';
6
- declare class Cycle extends Activity {
7
- config: CycleActivity;
8
- constructor(config: ActivityType, data: ActivityData, metadata: ActivityMetadata, hook: ActivityData | null, engine: EngineService, context?: JobState);
9
- process(): Promise<string>;
10
- /**
11
- * Trigger the target ancestor to execute in a cycle,
12
- * without violating the constraints of the DAG. Immutable
13
- * `individual activity state` will execute in a new dimensional
14
- * thread while `shared job state` can change. This
15
- * pattern allows for retries without violating the DAG.
16
- */
17
- cycleAncestorActivity(multi: RedisMulti): Promise<string>;
18
- }
19
- export { Cycle };