@hotmeshio/hotmesh 0.0.7 → 0.0.9

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 (365) hide show
  1. package/LICENSE +4 -7
  2. package/README.md +37 -46
  3. package/build/{esm/package.json → package.json} +6 -11
  4. package/build/{cjs/services → services}/activities/activity.d.ts +6 -0
  5. package/build/{cjs/services → services}/activities/activity.js +83 -7
  6. package/build/{cjs/services → services}/activities/await.d.ts +2 -2
  7. package/build/{cjs/services → services}/activities/await.js +5 -5
  8. package/build/services/activities/cycle.d.ts +19 -0
  9. package/build/services/activities/cycle.js +77 -0
  10. package/build/{esm/services → services}/activities/index.d.ts +4 -2
  11. package/build/{cjs/services → services}/activities/index.js +4 -2
  12. package/build/{cjs/services → services}/activities/worker.d.ts +0 -8
  13. package/build/services/activities/worker.js +73 -0
  14. package/build/{esm/services → services}/collator/index.d.ts +18 -1
  15. package/build/{cjs/services → services}/collator/index.js +41 -11
  16. package/build/{cjs/services → services}/durable/factory.js +17 -1
  17. package/build/{cjs/services → services}/durable/native.js +2 -2
  18. package/build/{cjs/services → services}/durable/worker.d.ts +2 -3
  19. package/build/{esm/services → services}/durable/worker.js +35 -37
  20. package/build/{cjs/services → services}/durable/workflow.js +11 -2
  21. package/build/{cjs/services → services}/mapper/index.js +3 -0
  22. package/build/{cjs/services → services}/signaler/stream.js +0 -1
  23. package/build/{esm/types → types}/activity.d.ts +7 -2
  24. package/build/{cjs/types → types}/durable.d.ts +4 -6
  25. package/build/{cjs/types → types}/index.d.ts +1 -1
  26. package/package.json +6 -11
  27. package/services/activities/activity.ts +90 -7
  28. package/services/activities/await.ts +5 -5
  29. package/services/activities/cycle.ts +96 -0
  30. package/services/activities/index.ts +4 -2
  31. package/services/activities/worker.ts +2 -93
  32. package/services/collator/index.ts +43 -11
  33. package/services/durable/factory.ts +17 -1
  34. package/services/durable/native.ts +2 -2
  35. package/services/durable/worker.ts +19 -22
  36. package/services/durable/workflow.ts +11 -2
  37. package/services/mapper/index.ts +3 -0
  38. package/services/signaler/stream.ts +0 -1
  39. package/types/activity.ts +8 -1
  40. package/types/durable.ts +4 -4
  41. package/types/index.ts +1 -0
  42. package/build/cjs/package.json +0 -80
  43. package/build/cjs/services/activities/index.d.ts +0 -15
  44. package/build/cjs/services/activities/worker.js +0 -159
  45. package/build/cjs/services/collator/index.d.ts +0 -56
  46. package/build/cjs/services/durable/worker.js +0 -298
  47. package/build/cjs/types/activity.d.ts +0 -87
  48. package/build/esm/index.d.ts +0 -4
  49. package/build/esm/index.js +0 -3
  50. package/build/esm/modules/errors.d.ts +0 -28
  51. package/build/esm/modules/errors.js +0 -41
  52. package/build/esm/modules/key.d.ts +0 -75
  53. package/build/esm/modules/key.js +0 -111
  54. package/build/esm/modules/utils.d.ts +0 -34
  55. package/build/esm/modules/utils.js +0 -154
  56. package/build/esm/services/activities/activity.d.ts +0 -61
  57. package/build/esm/services/activities/activity.js +0 -410
  58. package/build/esm/services/activities/await.d.ts +0 -16
  59. package/build/esm/services/activities/await.js +0 -140
  60. package/build/esm/services/activities/emit.d.ts +0 -9
  61. package/build/esm/services/activities/emit.js +0 -10
  62. package/build/esm/services/activities/index.js +0 -14
  63. package/build/esm/services/activities/iterate.d.ts +0 -9
  64. package/build/esm/services/activities/iterate.js +0 -10
  65. package/build/esm/services/activities/trigger.d.ts +0 -22
  66. package/build/esm/services/activities/trigger.js +0 -158
  67. package/build/esm/services/activities/worker.d.ts +0 -19
  68. package/build/esm/services/activities/worker.js +0 -156
  69. package/build/esm/services/collator/index.js +0 -191
  70. package/build/esm/services/compiler/deployer.d.ts +0 -36
  71. package/build/esm/services/compiler/deployer.js +0 -423
  72. package/build/esm/services/compiler/index.d.ts +0 -30
  73. package/build/esm/services/compiler/index.js +0 -82
  74. package/build/esm/services/compiler/validator.d.ts +0 -32
  75. package/build/esm/services/compiler/validator.js +0 -131
  76. package/build/esm/services/connector/clients/ioredis.d.ts +0 -13
  77. package/build/esm/services/connector/clients/ioredis.js +0 -47
  78. package/build/esm/services/connector/clients/redis.d.ts +0 -13
  79. package/build/esm/services/connector/clients/redis.js +0 -59
  80. package/build/esm/services/connector/index.d.ts +0 -5
  81. package/build/esm/services/connector/index.js +0 -27
  82. package/build/esm/services/dimension/index.d.ts +0 -29
  83. package/build/esm/services/dimension/index.js +0 -32
  84. package/build/esm/services/durable/asyncLocalStorage.d.ts +0 -3
  85. package/build/esm/services/durable/asyncLocalStorage.js +0 -2
  86. package/build/esm/services/durable/client.d.ts +0 -15
  87. package/build/esm/services/durable/client.js +0 -114
  88. package/build/esm/services/durable/connection.d.ts +0 -4
  89. package/build/esm/services/durable/connection.js +0 -47
  90. package/build/esm/services/durable/factory.d.ts +0 -3
  91. package/build/esm/services/durable/factory.js +0 -119
  92. package/build/esm/services/durable/handle.d.ts +0 -8
  93. package/build/esm/services/durable/handle.js +0 -34
  94. package/build/esm/services/durable/index.d.ts +0 -57
  95. package/build/esm/services/durable/index.js +0 -55
  96. package/build/esm/services/durable/native.d.ts +0 -4
  97. package/build/esm/services/durable/native.js +0 -43
  98. package/build/esm/services/durable/worker.d.ts +0 -37
  99. package/build/esm/services/durable/workflow.d.ts +0 -6
  100. package/build/esm/services/durable/workflow.js +0 -128
  101. package/build/esm/services/engine/index.d.ts +0 -82
  102. package/build/esm/services/engine/index.js +0 -522
  103. package/build/esm/services/hotmesh/index.d.ts +0 -45
  104. package/build/esm/services/hotmesh/index.js +0 -131
  105. package/build/esm/services/logger/index.d.ts +0 -17
  106. package/build/esm/services/logger/index.js +0 -70
  107. package/build/esm/services/mapper/index.d.ts +0 -24
  108. package/build/esm/services/mapper/index.js +0 -69
  109. package/build/esm/services/pipe/functions/array.d.ts +0 -24
  110. package/build/esm/services/pipe/functions/array.js +0 -66
  111. package/build/esm/services/pipe/functions/bitwise.d.ts +0 -9
  112. package/build/esm/services/pipe/functions/bitwise.js +0 -21
  113. package/build/esm/services/pipe/functions/conditional.d.ts +0 -10
  114. package/build/esm/services/pipe/functions/conditional.js +0 -24
  115. package/build/esm/services/pipe/functions/date.d.ts +0 -57
  116. package/build/esm/services/pipe/functions/date.js +0 -164
  117. package/build/esm/services/pipe/functions/index.d.ts +0 -25
  118. package/build/esm/services/pipe/functions/index.js +0 -24
  119. package/build/esm/services/pipe/functions/json.d.ts +0 -5
  120. package/build/esm/services/pipe/functions/json.js +0 -9
  121. package/build/esm/services/pipe/functions/math.d.ts +0 -38
  122. package/build/esm/services/pipe/functions/math.js +0 -108
  123. package/build/esm/services/pipe/functions/number.d.ts +0 -25
  124. package/build/esm/services/pipe/functions/number.js +0 -130
  125. package/build/esm/services/pipe/functions/object.d.ts +0 -22
  126. package/build/esm/services/pipe/functions/object.js +0 -60
  127. package/build/esm/services/pipe/functions/string.d.ts +0 -23
  128. package/build/esm/services/pipe/functions/string.js +0 -66
  129. package/build/esm/services/pipe/functions/symbol.d.ts +0 -12
  130. package/build/esm/services/pipe/functions/symbol.js +0 -30
  131. package/build/esm/services/pipe/functions/unary.d.ts +0 -7
  132. package/build/esm/services/pipe/functions/unary.js +0 -15
  133. package/build/esm/services/pipe/index.d.ts +0 -30
  134. package/build/esm/services/pipe/index.js +0 -122
  135. package/build/esm/services/quorum/index.d.ts +0 -34
  136. package/build/esm/services/quorum/index.js +0 -144
  137. package/build/esm/services/reporter/index.d.ts +0 -47
  138. package/build/esm/services/reporter/index.js +0 -327
  139. package/build/esm/services/serializer/index.d.ts +0 -41
  140. package/build/esm/services/serializer/index.js +0 -251
  141. package/build/esm/services/signaler/store.d.ts +0 -15
  142. package/build/esm/services/signaler/store.js +0 -50
  143. package/build/esm/services/signaler/stream.d.ts +0 -43
  144. package/build/esm/services/signaler/stream.js +0 -315
  145. package/build/esm/services/store/cache.d.ts +0 -66
  146. package/build/esm/services/store/cache.js +0 -124
  147. package/build/esm/services/store/clients/ioredis.d.ts +0 -27
  148. package/build/esm/services/store/clients/ioredis.js +0 -93
  149. package/build/esm/services/store/clients/redis.d.ts +0 -29
  150. package/build/esm/services/store/clients/redis.js +0 -140
  151. package/build/esm/services/store/index.d.ts +0 -88
  152. package/build/esm/services/store/index.js +0 -623
  153. package/build/esm/services/stream/clients/ioredis.d.ts +0 -23
  154. package/build/esm/services/stream/clients/ioredis.js +0 -112
  155. package/build/esm/services/stream/clients/redis.d.ts +0 -23
  156. package/build/esm/services/stream/clients/redis.js +0 -116
  157. package/build/esm/services/stream/index.d.ts +0 -21
  158. package/build/esm/services/stream/index.js +0 -6
  159. package/build/esm/services/sub/clients/ioredis.d.ts +0 -20
  160. package/build/esm/services/sub/clients/ioredis.js +0 -69
  161. package/build/esm/services/sub/clients/redis.d.ts +0 -20
  162. package/build/esm/services/sub/clients/redis.js +0 -60
  163. package/build/esm/services/sub/index.d.ts +0 -18
  164. package/build/esm/services/sub/index.js +0 -6
  165. package/build/esm/services/task/index.d.ts +0 -18
  166. package/build/esm/services/task/index.js +0 -70
  167. package/build/esm/services/telemetry/index.d.ts +0 -49
  168. package/build/esm/services/telemetry/index.js +0 -217
  169. package/build/esm/services/worker/index.d.ts +0 -30
  170. package/build/esm/services/worker/index.js +0 -102
  171. package/build/esm/types/activity.js +0 -1
  172. package/build/esm/types/app.d.ts +0 -16
  173. package/build/esm/types/app.js +0 -1
  174. package/build/esm/types/async.d.ts +0 -5
  175. package/build/esm/types/async.js +0 -1
  176. package/build/esm/types/cache.d.ts +0 -1
  177. package/build/esm/types/cache.js +0 -1
  178. package/build/esm/types/collator.d.ts +0 -8
  179. package/build/esm/types/collator.js +0 -8
  180. package/build/esm/types/durable.d.ts +0 -59
  181. package/build/esm/types/durable.js +0 -1
  182. package/build/esm/types/hook.d.ts +0 -31
  183. package/build/esm/types/hook.js +0 -6
  184. package/build/esm/types/hotmesh.d.ts +0 -82
  185. package/build/esm/types/hotmesh.js +0 -1
  186. package/build/esm/types/index.d.ts +0 -20
  187. package/build/esm/types/index.js +0 -5
  188. package/build/esm/types/ioredisclient.d.ts +0 -5
  189. package/build/esm/types/ioredisclient.js +0 -2
  190. package/build/esm/types/job.d.ts +0 -50
  191. package/build/esm/types/job.js +0 -1
  192. package/build/esm/types/logger.d.ts +0 -6
  193. package/build/esm/types/logger.js +0 -1
  194. package/build/esm/types/map.d.ts +0 -4
  195. package/build/esm/types/map.js +0 -1
  196. package/build/esm/types/pipe.d.ts +0 -4
  197. package/build/esm/types/pipe.js +0 -1
  198. package/build/esm/types/quorum.d.ts +0 -46
  199. package/build/esm/types/quorum.js +0 -1
  200. package/build/esm/types/redis.d.ts +0 -8
  201. package/build/esm/types/redis.js +0 -1
  202. package/build/esm/types/redisclient.d.ts +0 -25
  203. package/build/esm/types/redisclient.js +0 -1
  204. package/build/esm/types/serializer.d.ts +0 -33
  205. package/build/esm/types/serializer.js +0 -1
  206. package/build/esm/types/stats.d.ts +0 -83
  207. package/build/esm/types/stats.js +0 -1
  208. package/build/esm/types/stream.d.ts +0 -67
  209. package/build/esm/types/stream.js +0 -22
  210. package/build/esm/types/telemetry.d.ts +0 -1
  211. package/build/esm/types/telemetry.js +0 -1
  212. package/build/esm/types/transition.d.ts +0 -17
  213. package/build/esm/types/transition.js +0 -1
  214. package/tsconfig.cjs.json +0 -8
  215. package/tsconfig.esm.json +0 -9
  216. /package/build/{cjs/index.d.ts → index.d.ts} +0 -0
  217. /package/build/{cjs/index.js → index.js} +0 -0
  218. /package/build/{cjs/modules → modules}/errors.d.ts +0 -0
  219. /package/build/{cjs/modules → modules}/errors.js +0 -0
  220. /package/build/{cjs/modules → modules}/key.d.ts +0 -0
  221. /package/build/{cjs/modules → modules}/key.js +0 -0
  222. /package/build/{cjs/modules → modules}/utils.d.ts +0 -0
  223. /package/build/{cjs/modules → modules}/utils.js +0 -0
  224. /package/build/{cjs/services → services}/activities/emit.d.ts +0 -0
  225. /package/build/{cjs/services → services}/activities/emit.js +0 -0
  226. /package/build/{cjs/services → services}/activities/iterate.d.ts +0 -0
  227. /package/build/{cjs/services → services}/activities/iterate.js +0 -0
  228. /package/build/{cjs/services → services}/activities/trigger.d.ts +0 -0
  229. /package/build/{cjs/services → services}/activities/trigger.js +0 -0
  230. /package/build/{cjs/services → services}/compiler/deployer.d.ts +0 -0
  231. /package/build/{cjs/services → services}/compiler/deployer.js +0 -0
  232. /package/build/{cjs/services → services}/compiler/index.d.ts +0 -0
  233. /package/build/{cjs/services → services}/compiler/index.js +0 -0
  234. /package/build/{cjs/services → services}/compiler/validator.d.ts +0 -0
  235. /package/build/{cjs/services → services}/compiler/validator.js +0 -0
  236. /package/build/{cjs/services → services}/connector/clients/ioredis.d.ts +0 -0
  237. /package/build/{cjs/services → services}/connector/clients/ioredis.js +0 -0
  238. /package/build/{cjs/services → services}/connector/clients/redis.d.ts +0 -0
  239. /package/build/{cjs/services → services}/connector/clients/redis.js +0 -0
  240. /package/build/{cjs/services → services}/connector/index.d.ts +0 -0
  241. /package/build/{cjs/services → services}/connector/index.js +0 -0
  242. /package/build/{cjs/services → services}/dimension/index.d.ts +0 -0
  243. /package/build/{cjs/services → services}/dimension/index.js +0 -0
  244. /package/build/{cjs/services → services}/durable/asyncLocalStorage.d.ts +0 -0
  245. /package/build/{cjs/services → services}/durable/asyncLocalStorage.js +0 -0
  246. /package/build/{cjs/services → services}/durable/client.d.ts +0 -0
  247. /package/build/{cjs/services → services}/durable/client.js +0 -0
  248. /package/build/{cjs/services → services}/durable/connection.d.ts +0 -0
  249. /package/build/{cjs/services → services}/durable/connection.js +0 -0
  250. /package/build/{cjs/services → services}/durable/factory.d.ts +0 -0
  251. /package/build/{cjs/services → services}/durable/handle.d.ts +0 -0
  252. /package/build/{cjs/services → services}/durable/handle.js +0 -0
  253. /package/build/{cjs/services → services}/durable/index.d.ts +0 -0
  254. /package/build/{cjs/services → services}/durable/index.js +0 -0
  255. /package/build/{cjs/services → services}/durable/native.d.ts +0 -0
  256. /package/build/{cjs/services → services}/durable/workflow.d.ts +0 -0
  257. /package/build/{cjs/services → services}/engine/index.d.ts +0 -0
  258. /package/build/{cjs/services → services}/engine/index.js +0 -0
  259. /package/build/{cjs/services → services}/hotmesh/index.d.ts +0 -0
  260. /package/build/{cjs/services → services}/hotmesh/index.js +0 -0
  261. /package/build/{cjs/services → services}/logger/index.d.ts +0 -0
  262. /package/build/{cjs/services → services}/logger/index.js +0 -0
  263. /package/build/{cjs/services → services}/mapper/index.d.ts +0 -0
  264. /package/build/{cjs/services → services}/pipe/functions/array.d.ts +0 -0
  265. /package/build/{cjs/services → services}/pipe/functions/array.js +0 -0
  266. /package/build/{cjs/services → services}/pipe/functions/bitwise.d.ts +0 -0
  267. /package/build/{cjs/services → services}/pipe/functions/bitwise.js +0 -0
  268. /package/build/{cjs/services → services}/pipe/functions/conditional.d.ts +0 -0
  269. /package/build/{cjs/services → services}/pipe/functions/conditional.js +0 -0
  270. /package/build/{cjs/services → services}/pipe/functions/date.d.ts +0 -0
  271. /package/build/{cjs/services → services}/pipe/functions/date.js +0 -0
  272. /package/build/{cjs/services → services}/pipe/functions/index.d.ts +0 -0
  273. /package/build/{cjs/services → services}/pipe/functions/index.js +0 -0
  274. /package/build/{cjs/services → services}/pipe/functions/json.d.ts +0 -0
  275. /package/build/{cjs/services → services}/pipe/functions/json.js +0 -0
  276. /package/build/{cjs/services → services}/pipe/functions/math.d.ts +0 -0
  277. /package/build/{cjs/services → services}/pipe/functions/math.js +0 -0
  278. /package/build/{cjs/services → services}/pipe/functions/number.d.ts +0 -0
  279. /package/build/{cjs/services → services}/pipe/functions/number.js +0 -0
  280. /package/build/{cjs/services → services}/pipe/functions/object.d.ts +0 -0
  281. /package/build/{cjs/services → services}/pipe/functions/object.js +0 -0
  282. /package/build/{cjs/services → services}/pipe/functions/string.d.ts +0 -0
  283. /package/build/{cjs/services → services}/pipe/functions/string.js +0 -0
  284. /package/build/{cjs/services → services}/pipe/functions/symbol.d.ts +0 -0
  285. /package/build/{cjs/services → services}/pipe/functions/symbol.js +0 -0
  286. /package/build/{cjs/services → services}/pipe/functions/unary.d.ts +0 -0
  287. /package/build/{cjs/services → services}/pipe/functions/unary.js +0 -0
  288. /package/build/{cjs/services → services}/pipe/index.d.ts +0 -0
  289. /package/build/{cjs/services → services}/pipe/index.js +0 -0
  290. /package/build/{cjs/services → services}/quorum/index.d.ts +0 -0
  291. /package/build/{cjs/services → services}/quorum/index.js +0 -0
  292. /package/build/{cjs/services → services}/reporter/index.d.ts +0 -0
  293. /package/build/{cjs/services → services}/reporter/index.js +0 -0
  294. /package/build/{cjs/services → services}/serializer/index.d.ts +0 -0
  295. /package/build/{cjs/services → services}/serializer/index.js +0 -0
  296. /package/build/{cjs/services → services}/signaler/store.d.ts +0 -0
  297. /package/build/{cjs/services → services}/signaler/store.js +0 -0
  298. /package/build/{cjs/services → services}/signaler/stream.d.ts +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}/store/index.js +0 -0
  307. /package/build/{cjs/services → services}/stream/clients/ioredis.d.ts +0 -0
  308. /package/build/{cjs/services → services}/stream/clients/ioredis.js +0 -0
  309. /package/build/{cjs/services → services}/stream/clients/redis.d.ts +0 -0
  310. /package/build/{cjs/services → services}/stream/clients/redis.js +0 -0
  311. /package/build/{cjs/services → services}/stream/index.d.ts +0 -0
  312. /package/build/{cjs/services → services}/stream/index.js +0 -0
  313. /package/build/{cjs/services → services}/sub/clients/ioredis.d.ts +0 -0
  314. /package/build/{cjs/services → services}/sub/clients/ioredis.js +0 -0
  315. /package/build/{cjs/services → services}/sub/clients/redis.d.ts +0 -0
  316. /package/build/{cjs/services → services}/sub/clients/redis.js +0 -0
  317. /package/build/{cjs/services → services}/sub/index.d.ts +0 -0
  318. /package/build/{cjs/services → services}/sub/index.js +0 -0
  319. /package/build/{cjs/services → services}/task/index.d.ts +0 -0
  320. /package/build/{cjs/services → services}/task/index.js +0 -0
  321. /package/build/{cjs/services → services}/telemetry/index.d.ts +0 -0
  322. /package/build/{cjs/services → services}/telemetry/index.js +0 -0
  323. /package/build/{cjs/services → services}/worker/index.d.ts +0 -0
  324. /package/build/{cjs/services → services}/worker/index.js +0 -0
  325. /package/build/{cjs/types → types}/activity.js +0 -0
  326. /package/build/{cjs/types → types}/app.d.ts +0 -0
  327. /package/build/{cjs/types → types}/app.js +0 -0
  328. /package/build/{cjs/types → types}/async.d.ts +0 -0
  329. /package/build/{cjs/types → types}/async.js +0 -0
  330. /package/build/{cjs/types → types}/cache.d.ts +0 -0
  331. /package/build/{cjs/types → types}/cache.js +0 -0
  332. /package/build/{cjs/types → types}/collator.d.ts +0 -0
  333. /package/build/{cjs/types → types}/collator.js +0 -0
  334. /package/build/{cjs/types → types}/durable.js +0 -0
  335. /package/build/{cjs/types → types}/hook.d.ts +0 -0
  336. /package/build/{cjs/types → types}/hook.js +0 -0
  337. /package/build/{cjs/types → types}/hotmesh.d.ts +0 -0
  338. /package/build/{cjs/types → types}/hotmesh.js +0 -0
  339. /package/build/{cjs/types → types}/index.js +0 -0
  340. /package/build/{cjs/types → types}/ioredisclient.d.ts +0 -0
  341. /package/build/{cjs/types → types}/ioredisclient.js +0 -0
  342. /package/build/{cjs/types → types}/job.d.ts +0 -0
  343. /package/build/{cjs/types → types}/job.js +0 -0
  344. /package/build/{cjs/types → types}/logger.d.ts +0 -0
  345. /package/build/{cjs/types → types}/logger.js +0 -0
  346. /package/build/{cjs/types → types}/map.d.ts +0 -0
  347. /package/build/{cjs/types → types}/map.js +0 -0
  348. /package/build/{cjs/types → types}/pipe.d.ts +0 -0
  349. /package/build/{cjs/types → types}/pipe.js +0 -0
  350. /package/build/{cjs/types → types}/quorum.d.ts +0 -0
  351. /package/build/{cjs/types → types}/quorum.js +0 -0
  352. /package/build/{cjs/types → types}/redis.d.ts +0 -0
  353. /package/build/{cjs/types → types}/redis.js +0 -0
  354. /package/build/{cjs/types → types}/redisclient.d.ts +0 -0
  355. /package/build/{cjs/types → types}/redisclient.js +0 -0
  356. /package/build/{cjs/types → types}/serializer.d.ts +0 -0
  357. /package/build/{cjs/types → types}/serializer.js +0 -0
  358. /package/build/{cjs/types → types}/stats.d.ts +0 -0
  359. /package/build/{cjs/types → types}/stats.js +0 -0
  360. /package/build/{cjs/types → types}/stream.d.ts +0 -0
  361. /package/build/{cjs/types → types}/stream.js +0 -0
  362. /package/build/{cjs/types → types}/telemetry.d.ts +0 -0
  363. /package/build/{cjs/types → types}/telemetry.js +0 -0
  364. /package/build/{cjs/types → types}/transition.d.ts +0 -0
  365. /package/build/{cjs/types → types}/transition.js +0 -0
@@ -1,87 +0,0 @@
1
- import { MetricTypes } from "./stats";
2
- import { StreamRetryPolicy } from "./stream";
3
- type ActivityExecutionType = 'trigger' | 'await' | 'worker' | 'activity' | 'emit' | 'iterate';
4
- type Consumes = Record<string, string[]>;
5
- interface BaseActivity {
6
- title?: string;
7
- type?: ActivityExecutionType;
8
- subtype?: string;
9
- input?: Record<string, any>;
10
- output?: Record<string, any>;
11
- settings?: Record<string, any>;
12
- job?: Record<string, any>;
13
- hook?: Record<string, any>;
14
- telemetry?: Record<string, any>;
15
- sleep?: number;
16
- expire?: number;
17
- retry?: StreamRetryPolicy;
18
- collationInt?: number;
19
- consumes?: Consumes;
20
- PRODUCES?: string[];
21
- produces?: string[];
22
- publishes?: string;
23
- subscribes?: string;
24
- trigger?: string;
25
- parent?: string;
26
- ancestors?: string[];
27
- }
28
- interface Measure {
29
- measure: MetricTypes;
30
- target: string;
31
- }
32
- interface TriggerActivityStats {
33
- id?: {
34
- [key: string]: unknown;
35
- } | string;
36
- key?: {
37
- [key: string]: unknown;
38
- } | string;
39
- measures?: Measure[];
40
- }
41
- interface TriggerActivity extends BaseActivity {
42
- type: 'trigger';
43
- stats?: TriggerActivityStats;
44
- }
45
- interface AwaitActivity extends BaseActivity {
46
- type: 'await';
47
- eventName: string;
48
- timeout: number;
49
- }
50
- interface WorkerActivity extends BaseActivity {
51
- type: 'worker';
52
- topic: string;
53
- timeout: number;
54
- }
55
- interface EmitActivity extends BaseActivity {
56
- type: 'emit';
57
- }
58
- interface IterateActivity extends BaseActivity {
59
- type: 'iterate';
60
- }
61
- type ActivityType = BaseActivity | TriggerActivity | AwaitActivity | WorkerActivity | EmitActivity | IterateActivity;
62
- type ActivityData = Record<string, any>;
63
- type ActivityMetadata = {
64
- aid: string;
65
- atp: string;
66
- stp: string;
67
- ac: string;
68
- au: string;
69
- err?: string;
70
- l1s?: string;
71
- l2s?: string;
72
- dad?: string;
73
- as?: string;
74
- };
75
- type ActivityContext = {
76
- data?: ActivityData | null;
77
- metadata: ActivityMetadata;
78
- hook?: ActivityData;
79
- };
80
- type ActivityDuplex = 1 | 2;
81
- type ActivityDataType = {
82
- data?: Record<string, unknown>;
83
- metadata?: Record<string, unknown>;
84
- hook?: Record<string, unknown>;
85
- };
86
- type ActivityLeg = 1 | 2;
87
- export { ActivityContext, ActivityData, ActivityDataType, ActivityDuplex, ActivityLeg, ActivityMetadata, ActivityType, Consumes, TriggerActivityStats, AwaitActivity, BaseActivity, EmitActivity, IterateActivity, TriggerActivity, WorkerActivity };
@@ -1,4 +0,0 @@
1
- import { Durable } from './services/durable';
2
- import { HotMeshService as HotMesh } from './services/hotmesh';
3
- import { HotMeshConfig } from './types/hotmesh';
4
- export { Durable, HotMesh, HotMeshConfig };
@@ -1,3 +0,0 @@
1
- import { Durable } from './services/durable';
2
- import { HotMeshService as HotMesh } from './services/hotmesh';
3
- export { Durable, HotMesh };
@@ -1,28 +0,0 @@
1
- import { ActivityDuplex } from "../types/activity";
2
- import { CollationFaultType, CollationStage } from "../types/collator";
3
- declare class GetStateError extends Error {
4
- constructor();
5
- }
6
- declare class SetStateError extends Error {
7
- constructor();
8
- }
9
- declare class MapDataError extends Error {
10
- constructor();
11
- }
12
- declare class RegisterTimeoutError extends Error {
13
- constructor();
14
- }
15
- declare class DuplicateJobError extends Error {
16
- constructor(jobId: string);
17
- }
18
- declare class ExecActivityError extends Error {
19
- constructor();
20
- }
21
- declare class CollationError extends Error {
22
- status: number;
23
- leg: ActivityDuplex;
24
- stage: CollationStage;
25
- fault: CollationFaultType;
26
- constructor(status: number, leg: ActivityDuplex, stage: CollationStage, fault?: CollationFaultType);
27
- }
28
- export { CollationError, DuplicateJobError, GetStateError, SetStateError, MapDataError, RegisterTimeoutError, ExecActivityError };
@@ -1,41 +0,0 @@
1
- class GetStateError extends Error {
2
- constructor() {
3
- super("Error occurred while getting job state");
4
- }
5
- }
6
- class SetStateError extends Error {
7
- constructor() {
8
- super("Error occurred while setting job state");
9
- }
10
- }
11
- class MapDataError extends Error {
12
- constructor() {
13
- super("Error occurred while mapping data");
14
- }
15
- }
16
- class RegisterTimeoutError extends Error {
17
- constructor() {
18
- super("Error occurred while registering activity timeout");
19
- }
20
- }
21
- class DuplicateJobError extends Error {
22
- constructor(jobId) {
23
- super("Duplicate job");
24
- this.message = `Duplicate job: ${jobId}`;
25
- }
26
- }
27
- class ExecActivityError extends Error {
28
- constructor() {
29
- super("Error occurred while executing activity");
30
- }
31
- }
32
- class CollationError extends Error {
33
- constructor(status, leg, stage, fault) {
34
- super("collation-error");
35
- this.leg = leg;
36
- this.status = status;
37
- this.stage = stage;
38
- this.fault = fault;
39
- }
40
- }
41
- export { CollationError, DuplicateJobError, GetStateError, SetStateError, MapDataError, RegisterTimeoutError, ExecActivityError };
@@ -1,75 +0,0 @@
1
- /**
2
- * Keys
3
- *
4
- * hmsh -> {hash} hotmesh config {version: "0.0.1", namespace: "hmsh"}
5
- * hmsh:a:<appid> -> {hash} app profile { "id": "appid", "version": "2", "versions/1": "GMT", "versions/2": "GMT"}
6
- * hmsh:<appid>:e:<engineId> -> {string} setnx to ensure only one engine of given id
7
- * hmsh:<appid>:w: -> {zset} work items/tasks an engine must do like garbage collect or hook a set of matching records (hookAll)
8
- * hmsh:<appid>:t: -> {zset} an ordered set of list (work lists) ids
9
- * hmsh:<appid>:t:<timeValue?> -> {list} a worklist of `jobId+activityId` items that should be awakened
10
- * hmsh:<appid>:q: -> {hash} quorum-wide messages
11
- * hmsh:<appid>:q:<ngnid> -> {hash} engine-targeted messages (targeted quorum-oriented message)
12
- * hmsh:<appid>:j:<jobid> -> {hash} job data
13
- * hmsh:<appid>:j:<jobid>:<activityid> -> {hash} job activity data (a1)
14
- * hmsh:<appid>:s:<jobkey>:<dateTime> -> {hash} job stats (general)
15
- * hmsh:<appid>:s:<jobkey>:<dateTime>:mdn:<field/path>:<fieldvalue> -> {zset} job stats (median)
16
- * hmsh:<appid>:s:<jobkey>:<dateTime>:index:<field/path>:<fieldvalue> -> {list} job stats (index of jobid[])
17
- * hmsh:<appid>:v:<version>:activities -> {hash} schemas [cache]
18
- * hmsh:<appid>:v:<version>:transitions -> {hash} transitions [cache]
19
- * hmsh:<appid>:v:<version>:subscriptions -> {hash} subscriptions [cache]
20
- * hmsh:<appid>:x: -> {xstream} when an engine is sent or reads a buffered task (engines read from their custom topic)
21
- * hmsh:<appid>:x:<topic> -> {xstream} when a worker is sent or reads a buffered task (workers read from their custom topic)
22
- * hmsh:<appid>:hooks -> {hash} hook patterns/rules; set at compile time
23
- * hmsh:<appid>:signals -> {hash} dynamic hook signals (hget/hdel) when resolving (always self-clean); added/removed at runtime
24
- * hmsh:<appid>:sym:keys: -> {hash} list of symbol ranges and :cursor assigned at version deploy time for job keys
25
- * hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys)
26
- * hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
27
- */
28
- declare const PSNS = "hmsh";
29
- declare enum KeyType {
30
- APP = 0,
31
- ENGINE_ID = 1,
32
- HOOKS = 2,
33
- JOB_STATE = 3,
34
- JOB_STATS_GENERAL = 4,
35
- JOB_STATS_MEDIAN = 5,
36
- JOB_STATS_INDEX = 6,
37
- HOTMESH = 7,
38
- QUORUM = 8,
39
- SCHEMAS = 9,
40
- SIGNALS = 10,
41
- STREAMS = 11,
42
- SUBSCRIPTIONS = 12,
43
- SUBSCRIPTION_PATTERNS = 13,
44
- SYMKEYS = 14,
45
- SYMVALS = 15,
46
- TIME_RANGE = 16,
47
- WORK_ITEMS = 17
48
- }
49
- type KeyStoreParams = {
50
- appId?: string;
51
- engineId?: string;
52
- appVersion?: string;
53
- jobId?: string;
54
- activityId?: string;
55
- jobKey?: string;
56
- dateTime?: string;
57
- facet?: string;
58
- topic?: string;
59
- timeValue?: number;
60
- };
61
- declare class KeyService {
62
- /**
63
- * returns a key that can be used to access a value in the key/value store
64
- * appropriate for the given key type; the keys have an implicit hierarchy
65
- * and are used to organize data in the store in a tree-like structure
66
- * via the use of colons as separators. The top-level entity is the hmsh manifest.
67
- * This file will reveal the full scope of what is on the server (apps, versions, etc)
68
- * @param namespace
69
- * @param keyType
70
- * @param params
71
- * @returns {string}
72
- */
73
- static mintKey(namespace: string, keyType: KeyType, params: KeyStoreParams): string;
74
- }
75
- export { KeyService, KeyType, KeyStoreParams, PSNS };
@@ -1,111 +0,0 @@
1
- /**
2
- * Keys
3
- *
4
- * hmsh -> {hash} hotmesh config {version: "0.0.1", namespace: "hmsh"}
5
- * hmsh:a:<appid> -> {hash} app profile { "id": "appid", "version": "2", "versions/1": "GMT", "versions/2": "GMT"}
6
- * hmsh:<appid>:e:<engineId> -> {string} setnx to ensure only one engine of given id
7
- * hmsh:<appid>:w: -> {zset} work items/tasks an engine must do like garbage collect or hook a set of matching records (hookAll)
8
- * hmsh:<appid>:t: -> {zset} an ordered set of list (work lists) ids
9
- * hmsh:<appid>:t:<timeValue?> -> {list} a worklist of `jobId+activityId` items that should be awakened
10
- * hmsh:<appid>:q: -> {hash} quorum-wide messages
11
- * hmsh:<appid>:q:<ngnid> -> {hash} engine-targeted messages (targeted quorum-oriented message)
12
- * hmsh:<appid>:j:<jobid> -> {hash} job data
13
- * hmsh:<appid>:j:<jobid>:<activityid> -> {hash} job activity data (a1)
14
- * hmsh:<appid>:s:<jobkey>:<dateTime> -> {hash} job stats (general)
15
- * hmsh:<appid>:s:<jobkey>:<dateTime>:mdn:<field/path>:<fieldvalue> -> {zset} job stats (median)
16
- * hmsh:<appid>:s:<jobkey>:<dateTime>:index:<field/path>:<fieldvalue> -> {list} job stats (index of jobid[])
17
- * hmsh:<appid>:v:<version>:activities -> {hash} schemas [cache]
18
- * hmsh:<appid>:v:<version>:transitions -> {hash} transitions [cache]
19
- * hmsh:<appid>:v:<version>:subscriptions -> {hash} subscriptions [cache]
20
- * hmsh:<appid>:x: -> {xstream} when an engine is sent or reads a buffered task (engines read from their custom topic)
21
- * hmsh:<appid>:x:<topic> -> {xstream} when a worker is sent or reads a buffered task (workers read from their custom topic)
22
- * hmsh:<appid>:hooks -> {hash} hook patterns/rules; set at compile time
23
- * hmsh:<appid>:signals -> {hash} dynamic hook signals (hget/hdel) when resolving (always self-clean); added/removed at runtime
24
- * hmsh:<appid>:sym:keys: -> {hash} list of symbol ranges and :cursor assigned at version deploy time for job keys
25
- * hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys)
26
- * hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
27
- */
28
- //default namespace for hotmesh
29
- const PSNS = "hmsh";
30
- //these are the entity types that are stored in the key/value store
31
- var KeyType;
32
- (function (KeyType) {
33
- KeyType[KeyType["APP"] = 0] = "APP";
34
- KeyType[KeyType["ENGINE_ID"] = 1] = "ENGINE_ID";
35
- KeyType[KeyType["HOOKS"] = 2] = "HOOKS";
36
- KeyType[KeyType["JOB_STATE"] = 3] = "JOB_STATE";
37
- KeyType[KeyType["JOB_STATS_GENERAL"] = 4] = "JOB_STATS_GENERAL";
38
- KeyType[KeyType["JOB_STATS_MEDIAN"] = 5] = "JOB_STATS_MEDIAN";
39
- KeyType[KeyType["JOB_STATS_INDEX"] = 6] = "JOB_STATS_INDEX";
40
- KeyType[KeyType["HOTMESH"] = 7] = "HOTMESH";
41
- KeyType[KeyType["QUORUM"] = 8] = "QUORUM";
42
- KeyType[KeyType["SCHEMAS"] = 9] = "SCHEMAS";
43
- KeyType[KeyType["SIGNALS"] = 10] = "SIGNALS";
44
- KeyType[KeyType["STREAMS"] = 11] = "STREAMS";
45
- KeyType[KeyType["SUBSCRIPTIONS"] = 12] = "SUBSCRIPTIONS";
46
- KeyType[KeyType["SUBSCRIPTION_PATTERNS"] = 13] = "SUBSCRIPTION_PATTERNS";
47
- KeyType[KeyType["SYMKEYS"] = 14] = "SYMKEYS";
48
- KeyType[KeyType["SYMVALS"] = 15] = "SYMVALS";
49
- KeyType[KeyType["TIME_RANGE"] = 16] = "TIME_RANGE";
50
- KeyType[KeyType["WORK_ITEMS"] = 17] = "WORK_ITEMS";
51
- })(KeyType || (KeyType = {}));
52
- class KeyService {
53
- /**
54
- * returns a key that can be used to access a value in the key/value store
55
- * appropriate for the given key type; the keys have an implicit hierarchy
56
- * and are used to organize data in the store in a tree-like structure
57
- * via the use of colons as separators. The top-level entity is the hmsh manifest.
58
- * This file will reveal the full scope of what is on the server (apps, versions, etc)
59
- * @param namespace
60
- * @param keyType
61
- * @param params
62
- * @returns {string}
63
- */
64
- static mintKey(namespace, keyType, params) {
65
- switch (keyType) {
66
- case KeyType.HOTMESH:
67
- return namespace;
68
- case KeyType.ENGINE_ID:
69
- return `${namespace}:${params.appId}:e:${params.engineId}`;
70
- case KeyType.WORK_ITEMS:
71
- return `${namespace}:${params.appId}:w:`;
72
- case KeyType.TIME_RANGE:
73
- return `${namespace}:${params.appId}:t:${params.timeValue || ''}`;
74
- case KeyType.APP:
75
- return `${namespace}:a:${params.appId || ''}`;
76
- case KeyType.QUORUM:
77
- return `${namespace}:${params.appId}:q:${params.engineId || ''}`;
78
- case KeyType.JOB_STATE:
79
- return `${namespace}:${params.appId}:j:${params.jobId}`;
80
- case KeyType.JOB_STATS_GENERAL:
81
- return `${namespace}:${params.appId}:s:${params.jobKey}:${params.dateTime}`;
82
- case KeyType.JOB_STATS_MEDIAN:
83
- return `${namespace}:${params.appId}:s:${params.jobKey}:${params.dateTime}:${params.facet}`;
84
- case KeyType.JOB_STATS_INDEX:
85
- return `${namespace}:${params.appId}:s:${params.jobKey}:${params.dateTime}:${params.facet}`;
86
- case KeyType.SCHEMAS:
87
- return `${namespace}:${params.appId}:v:${params.appVersion}:schemas`;
88
- case KeyType.SUBSCRIPTIONS:
89
- return `${namespace}:${params.appId}:v:${params.appVersion}:subscriptions`;
90
- case KeyType.SUBSCRIPTION_PATTERNS:
91
- return `${namespace}:${params.appId}:v:${params.appVersion}:transitions`;
92
- case KeyType.HOOKS:
93
- //`hooks` provide the pattern to resolve a value
94
- return `${namespace}:${params.appId}:hooks`;
95
- case KeyType.SIGNALS:
96
- //`signals` provide the registry of resolved values that link back to paused jobs
97
- return `${namespace}:${params.appId}:signals`;
98
- case KeyType.SYMKEYS:
99
- //`symbol keys` provide the registry of replacement values for job keys
100
- return `${namespace}:${params.appId}:sym:keys:${params.activityId || ''}`;
101
- case KeyType.SYMVALS:
102
- //`symbol vals` provide the registry of replacement values for job vals
103
- return `${namespace}:${params.appId}:sym:vals:`;
104
- case KeyType.STREAMS:
105
- return `${namespace}:${params.appId || ''}:x:${params.topic || ''}`;
106
- default:
107
- throw new Error("Invalid key type.");
108
- }
109
- }
110
- }
111
- export { KeyService, KeyType, PSNS };
@@ -1,34 +0,0 @@
1
- /// <reference types="node" />
2
- import { StoreService } from "../services/store";
3
- import { AppSubscriptions, AppTransitions, AppVID } from "../types/app";
4
- import { RedisClient, RedisMulti } from "../types/redis";
5
- import { StringAnyType } from "../types/serializer";
6
- import { StreamCode, StreamStatus } from "../types/stream";
7
- export declare function sleepFor(ms: number): Promise<unknown>;
8
- export declare function identifyRedisType(redisInstance: any): 'redis' | 'ioredis' | null;
9
- export declare function identifyRedisTypeFromClass(redisClass: any): 'redis' | 'ioredis' | null;
10
- export declare function matchesStatusCode(code: StreamCode, pattern: string | RegExp): boolean;
11
- export declare function matchesStatus(status: StreamStatus, targetStatus: StreamStatus): boolean;
12
- export declare function XSleepFor(ms: number): {
13
- promise: Promise<unknown>;
14
- timerId: NodeJS.Timeout;
15
- };
16
- export declare function findTopKey(obj: AppTransitions, input: string): string | null;
17
- export declare function findSubscriptionForTrigger(obj: AppSubscriptions, value: string): string | null;
18
- /**
19
- * Get the subscription topic for the flow to which @activityId belongs.
20
- * TODO: resolve this value in the compiler...do not call this at runtime
21
- */
22
- export declare function getSubscriptionTopic(activityId: string, store: StoreService<RedisClient, RedisMulti>, appVID: AppVID): Promise<string | undefined>;
23
- /**
24
- * returns the 12-digit format of the iso timestamp (e.g, 202101010000)
25
- */
26
- export declare function getTimeSeries(granularity: string): string;
27
- export declare function formatISODate(input: Date | string): string;
28
- export declare function getSymKey(number: number): string;
29
- export declare function getSymVal(number: number): string;
30
- export declare function getIndexedHash<T>(hash: T, target: string): [number, T];
31
- export declare function getValueByPath(obj: {
32
- [key: string]: any;
33
- }, path: string): any;
34
- export declare function restoreHierarchy(obj: StringAnyType): StringAnyType;
@@ -1,154 +0,0 @@
1
- export async function sleepFor(ms) {
2
- return new Promise((resolve) => setTimeout(resolve, ms));
3
- }
4
- export function identifyRedisType(redisInstance) {
5
- if (redisInstance.constructor) {
6
- if (redisInstance.constructor.name === 'Redis' || redisInstance.constructor.name === 'EventEmitter') {
7
- if ('hset' in redisInstance) {
8
- return 'ioredis';
9
- }
10
- }
11
- else if (redisInstance.constructor.name === 'RedisClient' || redisInstance.constructor.name === 'Commander') {
12
- if ('HSET' in redisInstance) {
13
- return 'redis';
14
- }
15
- }
16
- }
17
- return null;
18
- }
19
- export function identifyRedisTypeFromClass(redisClass) {
20
- if (redisClass && redisClass.name === 'Redis' || redisClass.name === 'EventEmitter') {
21
- return 'ioredis';
22
- }
23
- else if (redisClass && 'createClient' in redisClass) {
24
- return 'redis';
25
- }
26
- return null;
27
- }
28
- export function matchesStatusCode(code, pattern) {
29
- if (typeof pattern === 'string') {
30
- // Convert '*' wildcard to its regex equivalent (\d)
31
- const regexPattern = `^${pattern.replace(/\*/g, "\\d")}$`;
32
- return new RegExp(regexPattern).test(code.toString());
33
- }
34
- return pattern.test(code.toString());
35
- }
36
- export function matchesStatus(status, targetStatus) {
37
- return status === targetStatus;
38
- }
39
- export function XSleepFor(ms) {
40
- //can be interrupted with `clearTimeout`
41
- let timerId;
42
- let promise = new Promise((resolve) => {
43
- timerId = setTimeout(resolve, ms);
44
- });
45
- return { promise, timerId };
46
- }
47
- export function findTopKey(obj, input) {
48
- for (const [key, value] of Object.entries(obj)) {
49
- if (value.hasOwnProperty(input)) {
50
- const parentKey = findTopKey(obj, key.replace(/^\./, ''));
51
- return (parentKey || key).replace(/^\./, '');
52
- }
53
- }
54
- return null;
55
- }
56
- export function findSubscriptionForTrigger(obj, value) {
57
- for (const [key, itemValue] of Object.entries(obj)) {
58
- if (itemValue === value) {
59
- return key;
60
- }
61
- }
62
- return null;
63
- }
64
- /**
65
- * Get the subscription topic for the flow to which @activityId belongs.
66
- * TODO: resolve this value in the compiler...do not call this at runtime
67
- */
68
- export async function getSubscriptionTopic(activityId, store, appVID) {
69
- const appTransitions = await store.getTransitions(appVID);
70
- const appSubscriptions = await store.getSubscriptions(appVID);
71
- const triggerId = findTopKey(appTransitions, activityId);
72
- const topic = findSubscriptionForTrigger(appSubscriptions, triggerId);
73
- return topic;
74
- }
75
- /**
76
- * returns the 12-digit format of the iso timestamp (e.g, 202101010000)
77
- */
78
- export function getTimeSeries(granularity) {
79
- const now = new Date();
80
- const granularityUnit = granularity.slice(-1);
81
- const granularityValue = parseInt(granularity.slice(0, -1), 10);
82
- if (granularityUnit === 'm') {
83
- const minute = Math.floor(now.getMinutes() / granularityValue) * granularityValue;
84
- now.setUTCMinutes(minute, 0, 0);
85
- }
86
- else if (granularityUnit === 'h') {
87
- now.setUTCMinutes(0, 0, 0);
88
- }
89
- return now.toISOString().replace(/:\d\d\..+|-|T/g, '').replace(':', '');
90
- }
91
- export function formatISODate(input) {
92
- const date = input instanceof Date ? input : new Date(input);
93
- return date.toISOString().replace(/[:TZ-]/g, '');
94
- }
95
- export function getSymKey(number) {
96
- const alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
97
- const base = alphabet.length;
98
- if (number < 0 || number >= Math.pow(base, 3)) {
99
- throw new Error('Number out of range');
100
- }
101
- let [q1, r1] = divmod(number, base);
102
- let [q2, r2] = divmod(q1, base);
103
- return alphabet[q2] + alphabet[r1] + alphabet[r2];
104
- }
105
- export function getSymVal(number) {
106
- const alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
107
- const base = alphabet.length;
108
- if (number < 0 || number >= Math.pow(base, 2)) {
109
- throw new Error('Number out of range');
110
- }
111
- let [q, r] = divmod(number, base);
112
- return alphabet[q] + alphabet[r];
113
- }
114
- function divmod(m, n) {
115
- return [Math.floor(m / n), m % n];
116
- }
117
- export function getIndexedHash(hash, target) {
118
- const index = hash[target] || 0;
119
- const newHash = { ...hash };
120
- delete newHash[target];
121
- return [index, newHash];
122
- }
123
- export function getValueByPath(obj, path) {
124
- const pathParts = path.split('/');
125
- let currentValue = obj;
126
- for (const part of pathParts) {
127
- if (currentValue[part] !== undefined) {
128
- currentValue = currentValue[part];
129
- }
130
- else {
131
- return undefined;
132
- }
133
- }
134
- return currentValue;
135
- }
136
- export function restoreHierarchy(obj) {
137
- const result = {};
138
- for (const key in obj) {
139
- if (obj[key] === undefined)
140
- continue;
141
- const keys = key.split('/');
142
- let current = result;
143
- for (let i = 0; i < keys.length; i++) {
144
- if (i === keys.length - 1) {
145
- current[keys[i]] = obj[key];
146
- }
147
- else {
148
- current[keys[i]] = current[keys[i]] || {};
149
- current = current[keys[i]];
150
- }
151
- }
152
- }
153
- return result;
154
- }
@@ -1,61 +0,0 @@
1
- import { EngineService } from '../engine';
2
- import { ILogger } from '../logger';
3
- import { StoreService } from '../store';
4
- import { ActivityData, ActivityLeg, ActivityMetadata, ActivityType } from '../../types/activity';
5
- import { JobState, JobStatus } from '../../types/job';
6
- import { MultiResponseFlags, RedisClient, RedisMulti } from '../../types/redis';
7
- import { StringAnyType } from '../../types/serializer';
8
- import { StreamCode, StreamData, StreamStatus } from '../../types/stream';
9
- /**
10
- * The base class for all activities
11
- */
12
- declare class Activity {
13
- config: ActivityType;
14
- data: ActivityData;
15
- hook: ActivityData;
16
- metadata: ActivityMetadata;
17
- store: StoreService<RedisClient, RedisMulti>;
18
- context: JobState;
19
- engine: EngineService;
20
- logger: ILogger;
21
- status: StreamStatus;
22
- code: StreamCode;
23
- leg: ActivityLeg;
24
- adjacencyList: StreamData[];
25
- adjacentIndex: number;
26
- constructor(config: ActivityType, data: ActivityData, metadata: ActivityMetadata, hook: ActivityData | null, engine: EngineService, context?: JobState);
27
- process(): Promise<string>;
28
- setLeg(leg: ActivityLeg): void;
29
- doesHook(): boolean;
30
- registerHook(multi?: RedisMulti): Promise<string | void>;
31
- processWebHookEvent(): Promise<JobStatus | void>;
32
- processTimeHookEvent(jobId: string): Promise<JobStatus | void>;
33
- processHookEvent(jobId: string): Promise<JobStatus | void>;
34
- resolveStatus(multiResponse: MultiResponseFlags): number;
35
- mapJobData(): void;
36
- mapInputData(): void;
37
- registerTimeout(): Promise<void>;
38
- bindActivityError(data: Record<string, unknown>): void;
39
- getTriggerConfig(): Promise<ActivityType>;
40
- getJobStatus(): null | number;
41
- setStatus(amount: number, multi?: RedisMulti): Promise<void>;
42
- authorizeEntry(state: StringAnyType): string[];
43
- bindDimensionalAddress(state: StringAnyType): void;
44
- setState(multi?: RedisMulti): Promise<string>;
45
- bindJobMetadata(): void;
46
- bindActivityMetadata(): void;
47
- bindJobState(state: StringAnyType): Promise<void>;
48
- bindActivityState(state: StringAnyType): void;
49
- bindJobMetadataPaths(): string[];
50
- bindActivityMetadataPaths(): string[];
51
- getState(jobId?: string): Promise<void>;
52
- initDimensionalAddress(dad: string): void;
53
- initSelf(context: StringAnyType): JobState;
54
- initPolicies(context: JobState): void;
55
- bindActivityData(type: 'output' | 'hook'): void;
56
- resolveDad(): string;
57
- resolveAdjacentDad(): string;
58
- filterAdjacent(): Promise<StreamData[]>;
59
- transition(adjacencyList: StreamData[], jobStatus: JobStatus): Promise<string[]>;
60
- }
61
- export { Activity, ActivityType };