@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
@@ -0,0 +1,411 @@
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
+ //******** SIGNALER RE-ENTRY POINT (B) ********//
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
+ //todo: hooks are currently singletons. but they can support
126
+ // dimensional threads like `await` and `worker` do.
127
+ // Copy code from those activities to support cyclical
128
+ // timehook and eventhook inputs by adding a 'pending'
129
+ // flag to hooks that allows for repeated signals
130
+ async processHookEvent(jobId) {
131
+ this.logger.debug('activity-process-hook-event', { jobId });
132
+ let telemetry;
133
+ try {
134
+ this.setLeg(2);
135
+ await this.getState(jobId);
136
+ const aState = await CollatorService.notarizeReentry(this);
137
+ this.adjacentIndex = CollatorService.getDimensionalIndex(aState);
138
+ telemetry = new TelemetryService(this.engine.appId, this.config, this.metadata, this.context);
139
+ telemetry.startActivitySpan(this.leg);
140
+ this.bindActivityData('hook');
141
+ this.mapJobData();
142
+ this.adjacencyList = await this.filterAdjacent();
143
+ const multi = this.engine.store.getMulti();
144
+ await this.setState(multi);
145
+ await CollatorService.notarizeCompletion(this, multi);
146
+ await this.setStatus(this.adjacencyList.length - 1, multi);
147
+ const multiResponse = await multi.exec();
148
+ telemetry.mapActivityAttributes();
149
+ const jobStatus = this.resolveStatus(multiResponse);
150
+ const attrs = { 'app.job.jss': jobStatus };
151
+ const messageIds = await this.transition(this.adjacencyList, jobStatus);
152
+ if (messageIds.length) {
153
+ attrs['app.activity.mids'] = messageIds.join(',');
154
+ }
155
+ telemetry.setActivityAttributes(attrs);
156
+ return jobStatus;
157
+ }
158
+ catch (error) {
159
+ console.error('this error?', error);
160
+ this.logger.error('engine-process-hook-event-error', error);
161
+ telemetry.setActivityError(error.message);
162
+ throw error;
163
+ }
164
+ finally {
165
+ telemetry.endActivitySpan();
166
+ }
167
+ }
168
+ resolveStatus(multiResponse) {
169
+ const activityStatus = multiResponse[multiResponse.length - 1];
170
+ if (Array.isArray(activityStatus)) {
171
+ return Number(activityStatus[1]);
172
+ }
173
+ else {
174
+ return Number(activityStatus);
175
+ }
176
+ }
177
+ mapJobData() {
178
+ if (this.config.job?.maps) {
179
+ const mapper = new MapperService(this.config.job.maps, this.context);
180
+ this.context.data = mapper.mapRules();
181
+ }
182
+ }
183
+ mapInputData() {
184
+ if (this.config.input?.maps) {
185
+ const mapper = new MapperService(this.config.input.maps, this.context);
186
+ this.context.data = mapper.mapRules();
187
+ }
188
+ }
189
+ async registerTimeout() {
190
+ //set timeout in support of hook and/or duplex
191
+ }
192
+ bindActivityError(data) {
193
+ //todo: map activity error data into the job error (if defined)
194
+ // map job status via: (500: [3**, 4**, 5**], 202: [$pending])
195
+ this.context.metadata.err = JSON.stringify(data);
196
+ }
197
+ async getTriggerConfig() {
198
+ return await this.store.getSchema(this.config.trigger, await this.engine.getVID());
199
+ }
200
+ getJobStatus() {
201
+ return null;
202
+ }
203
+ async setStatus(amount, multi) {
204
+ const { id: appId } = await this.engine.getVID();
205
+ await this.store.setStatus(amount, this.context.metadata.jid, appId, multi);
206
+ }
207
+ authorizeEntry(state) {
208
+ //pre-authorize activity state to allow entry for adjacent activities
209
+ return this.adjacencyList?.map((streamData) => {
210
+ const { metadata: { aid } } = streamData;
211
+ state[`${aid}/output/metadata/as`] = CollatorService.getSeed();
212
+ return aid;
213
+ }) ?? [];
214
+ }
215
+ bindDimensionalAddress(state) {
216
+ const dad = this.resolveDad();
217
+ state[`${this.metadata.aid}/output/metadata/dad`] = dad;
218
+ }
219
+ async setState(multi) {
220
+ const jobId = this.context.metadata.jid;
221
+ this.bindJobMetadata();
222
+ this.bindActivityMetadata();
223
+ let state = {};
224
+ await this.bindJobState(state);
225
+ const presets = this.authorizeEntry(state);
226
+ this.bindDimensionalAddress(state);
227
+ this.bindActivityState(state);
228
+ //symbolNames holds symkeys
229
+ const symbolNames = [
230
+ `$${this.config.subscribes}`,
231
+ this.metadata.aid,
232
+ ...presets
233
+ ];
234
+ const dIds = CollatorService.getDimensionsById([...this.config.ancestors, this.metadata.aid], this.resolveDad());
235
+ return await this.store.setState(state, this.getJobStatus(), jobId, symbolNames, dIds, multi);
236
+ }
237
+ bindJobMetadata() {
238
+ //both legs of the most recently run activity (1 and 2) modify ju (job_updated)
239
+ this.context.metadata.ju = formatISODate(new Date());
240
+ }
241
+ bindActivityMetadata() {
242
+ const self = this.context['$self'];
243
+ if (!self.output.metadata) {
244
+ self.output.metadata = {};
245
+ }
246
+ if (this.status === StreamStatus.ERROR) {
247
+ self.output.metadata.err = JSON.stringify(this.data);
248
+ }
249
+ //todo: verify leg2 never overwrites leg1 `ac`
250
+ self.output.metadata.ac =
251
+ self.output.metadata.au = formatISODate(new Date());
252
+ self.output.metadata.atp = this.config.type;
253
+ if (this.config.subtype) {
254
+ self.output.metadata.stp = this.config.subtype;
255
+ }
256
+ self.output.metadata.aid = this.metadata.aid;
257
+ }
258
+ async bindJobState(state) {
259
+ const triggerConfig = await this.getTriggerConfig();
260
+ const PRODUCES = [
261
+ ...(triggerConfig.PRODUCES || []),
262
+ ...this.bindJobMetadataPaths()
263
+ ];
264
+ for (const path of PRODUCES) {
265
+ const value = getValueByPath(this.context, path);
266
+ if (value !== undefined) {
267
+ state[path] = value;
268
+ }
269
+ }
270
+ TelemetryService.bindJobTelemetryToState(state, this.config, this.context);
271
+ }
272
+ bindActivityState(state) {
273
+ const produces = [
274
+ ...this.config.produces,
275
+ ...this.bindActivityMetadataPaths()
276
+ ];
277
+ for (const path of produces) {
278
+ const prefixedPath = `${this.metadata.aid}/${path}`;
279
+ const value = getValueByPath(this.context, prefixedPath);
280
+ if (value !== undefined) {
281
+ state[prefixedPath] = value;
282
+ }
283
+ }
284
+ TelemetryService.bindActivityTelemetryToState(state, this.config, this.metadata, this.context, this.leg);
285
+ }
286
+ bindJobMetadataPaths() {
287
+ return MDATA_SYMBOLS.JOB_UPDATE.KEYS.map((key) => `metadata/${key}`);
288
+ }
289
+ bindActivityMetadataPaths() {
290
+ const keys_to_save = this.leg === 1 ? 'ACTIVITY' : 'ACTIVITY_UPDATE';
291
+ return MDATA_SYMBOLS[keys_to_save].KEYS.map((key) => `output/metadata/${key}`);
292
+ }
293
+ async getState(jobId) {
294
+ //assemble list of paths necessary to create 'job state' from the 'symbol hash'
295
+ const jobSymbolHashName = `$${this.config.subscribes}`;
296
+ const consumes = {
297
+ [jobSymbolHashName]: MDATA_SYMBOLS.JOB.KEYS.map((key) => `metadata/${key}`)
298
+ };
299
+ for (let [activityId, paths] of Object.entries(this.config.consumes)) {
300
+ if (activityId === '$job') {
301
+ for (const path of paths) {
302
+ consumes[jobSymbolHashName].push(path);
303
+ }
304
+ }
305
+ else {
306
+ if (activityId === '$self') {
307
+ activityId = this.metadata.aid;
308
+ }
309
+ if (!consumes[activityId]) {
310
+ consumes[activityId] = [];
311
+ }
312
+ for (const path of paths) {
313
+ consumes[activityId].push(`${activityId}/${path}`);
314
+ }
315
+ }
316
+ }
317
+ TelemetryService.addTargetTelemetryPaths(consumes, this.config, this.metadata, this.leg);
318
+ let { dad, jid } = this.context.metadata;
319
+ jobId = jobId || jid;
320
+ //`state` is a flat hash
321
+ const dIds = CollatorService.getDimensionsById([...this.config.ancestors, this.metadata.aid], dad);
322
+ const [state, status] = await this.store.getState(jobId, consumes, dIds);
323
+ //`context` is a tree
324
+ this.context = restoreHierarchy(state);
325
+ this.initDimensionalAddress(dad);
326
+ this.initSelf(this.context);
327
+ this.initPolicies(this.context);
328
+ }
329
+ initDimensionalAddress(dad) {
330
+ this.metadata.dad = dad;
331
+ }
332
+ initSelf(context) {
333
+ const activityId = this.metadata.aid;
334
+ if (!context[activityId]) {
335
+ context[activityId] = {};
336
+ }
337
+ const self = context[activityId];
338
+ if (!self.output) {
339
+ self.output = {};
340
+ }
341
+ if (!self.input) {
342
+ self.input = {};
343
+ }
344
+ if (!self.hook) {
345
+ self.hook = {};
346
+ }
347
+ context['$self'] = self;
348
+ context['$job'] = context; //NEVER call STRINGIFY! (circular)
349
+ return context;
350
+ }
351
+ initPolicies(context) {
352
+ context.metadata.expire = this.config.expire;
353
+ }
354
+ bindActivityData(type) {
355
+ this.context[this.metadata.aid][type].data = this.data;
356
+ }
357
+ resolveDad() {
358
+ let dad = this.metadata.dad;
359
+ if (this.adjacentIndex > 0) {
360
+ //if adjacent index > 0 the activity is cycling; replace last index with cycle index
361
+ dad = `${dad.substring(0, dad.lastIndexOf(','))},${this.adjacentIndex}`;
362
+ }
363
+ return dad;
364
+ }
365
+ resolveAdjacentDad() {
366
+ //concat self and child dimension (all children (leg 1) begin life at 0)
367
+ return `${this.resolveDad()}${DimensionService.getSeed(0)}`;
368
+ }
369
+ ;
370
+ async filterAdjacent() {
371
+ const adjacencyList = [];
372
+ const transitions = await this.store.getTransitions(await this.engine.getVID());
373
+ const transition = transitions[`.${this.metadata.aid}`];
374
+ //resolve the dimensional address for adjacent children
375
+ const adjacentDad = this.resolveAdjacentDad();
376
+ if (transition) {
377
+ for (const toActivityId in transition) {
378
+ const transitionRule = transition[toActivityId];
379
+ if (MapperService.evaluate(transitionRule, this.context, this.code)) {
380
+ adjacencyList.push({
381
+ metadata: {
382
+ jid: this.context.metadata.jid,
383
+ dad: adjacentDad,
384
+ aid: toActivityId,
385
+ spn: this.context['$self'].output.metadata?.l2s,
386
+ trc: this.context.metadata.trc,
387
+ },
388
+ type: StreamDataType.TRANSITION,
389
+ data: {}
390
+ });
391
+ }
392
+ }
393
+ }
394
+ return adjacencyList;
395
+ }
396
+ async transition(adjacencyList, jobStatus) {
397
+ let mIds = [];
398
+ if (adjacencyList.length) {
399
+ const multi = this.store.getMulti();
400
+ for (const execSignal of adjacencyList) {
401
+ await this.engine.streamSignaler?.publishMessage(null, execSignal, multi);
402
+ }
403
+ mIds = (await multi.exec());
404
+ }
405
+ else if (jobStatus <= 0) {
406
+ await this.engine.runJobCompletionTasks(this.context);
407
+ }
408
+ return mIds;
409
+ }
410
+ }
411
+ export { Activity };
@@ -0,0 +1,16 @@
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
+ processSuccess(adjacencyList: StreamData[]): Promise<MultiResponseFlags>;
14
+ processError(adjacencyList: StreamData[]): Promise<MultiResponseFlags>;
15
+ }
16
+ export { Await };
@@ -0,0 +1,140 @@
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
+ //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.processSuccess(this.adjacencyList);
96
+ }
97
+ else {
98
+ this.bindActivityError(this.data);
99
+ this.adjacencyList = await this.filterAdjacent();
100
+ multiResponse = await this.processError(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 processSuccess(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 processError(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 };
@@ -0,0 +1,9 @@
1
+ import { EngineService } from '../engine';
2
+ import { Activity, ActivityType } from './activity';
3
+ import { ActivityData, ActivityMetadata, EmitActivity } from '../../types/activity';
4
+ declare class Emit extends Activity {
5
+ config: EmitActivity;
6
+ constructor(config: ActivityType, data: ActivityData, metadata: ActivityMetadata, hook: ActivityData | null, engine: EngineService);
7
+ mapInputData(): Promise<void>;
8
+ }
9
+ export { Emit };
@@ -0,0 +1,10 @@
1
+ import { Activity } from './activity';
2
+ class Emit extends Activity {
3
+ constructor(config, data, metadata, hook, engine) {
4
+ super(config, data, metadata, hook, engine);
5
+ }
6
+ async mapInputData() {
7
+ this.logger.info('emit-map-input-data');
8
+ }
9
+ }
10
+ export { Emit };
@@ -0,0 +1,15 @@
1
+ import { Activity } from './activity';
2
+ import { Await } from './await';
3
+ import { Worker } from './worker';
4
+ import { Iterate } from './iterate';
5
+ import { Emit } from './emit';
6
+ import { Trigger } from './trigger';
7
+ declare const _default: {
8
+ activity: typeof Activity;
9
+ await: typeof Await;
10
+ iterate: typeof Iterate;
11
+ emit: typeof Emit;
12
+ trigger: typeof Trigger;
13
+ worker: typeof Worker;
14
+ };
15
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { Activity } from './activity';
2
+ import { Await } from './await';
3
+ import { Worker } from './worker';
4
+ import { Iterate } from './iterate';
5
+ import { Emit } from './emit';
6
+ import { Trigger } from './trigger';
7
+ export default {
8
+ activity: Activity,
9
+ await: Await,
10
+ iterate: Iterate,
11
+ emit: Emit,
12
+ trigger: Trigger,
13
+ worker: Worker,
14
+ };
@@ -0,0 +1,9 @@
1
+ import { EngineService } from '../engine';
2
+ import { Activity, ActivityType } from './activity';
3
+ import { ActivityData, ActivityMetadata, IterateActivity } from '../../types/activity';
4
+ declare class Iterate extends Activity {
5
+ config: IterateActivity;
6
+ constructor(config: ActivityType, data: ActivityData, metadata: ActivityMetadata, hook: ActivityData | null, engine: EngineService);
7
+ mapInputData(): Promise<void>;
8
+ }
9
+ export { Iterate };
@@ -0,0 +1,10 @@
1
+ import { Activity } from './activity';
2
+ class Iterate extends Activity {
3
+ constructor(config, data, metadata, hook, engine) {
4
+ super(config, data, metadata, hook, engine);
5
+ }
6
+ async mapInputData() {
7
+ this.logger.info('iterate-map-input-data');
8
+ }
9
+ }
10
+ export { Iterate };
@@ -0,0 +1,22 @@
1
+ import { Activity } from './activity';
2
+ import { EngineService } from '../engine';
3
+ import { ActivityData, ActivityMetadata, ActivityType, TriggerActivity } from '../../types/activity';
4
+ import { JobState } from '../../types/job';
5
+ import { RedisMulti } from '../../types/redis';
6
+ declare class Trigger extends Activity {
7
+ config: TriggerActivity;
8
+ constructor(config: ActivityType, data: ActivityData, metadata: ActivityMetadata, hook: ActivityData | null, engine: EngineService, context?: JobState);
9
+ process(): Promise<string>;
10
+ setStatus(amount: number): Promise<void>;
11
+ createInputContext(): Partial<JobState>;
12
+ getState(): Promise<void>;
13
+ bindJobMetadataPaths(): string[];
14
+ bindActivityMetadataPaths(): string[];
15
+ resolveGranularity(): string;
16
+ getJobStatus(): number;
17
+ resolveJobId(context: Partial<JobState>): string;
18
+ resolveJobKey(context: Partial<JobState>): string;
19
+ setStateNX(): Promise<void>;
20
+ setStats(multi?: RedisMulti): Promise<void>;
21
+ }
22
+ export { Trigger };