@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
@@ -20,9 +20,45 @@ exports.MDATA_SYMBOLS = {
20
20
  };
21
21
  class SerializerService {
22
22
  constructor() {
23
- this.resetSymbols({}, {});
23
+ this.resetSymbols({}, {}, {});
24
24
  }
25
- resetSymbols(symKeys, symVals) {
25
+ abbreviate(consumes, symbolNames, fields = []) {
26
+ for (const symbolName of symbolNames) {
27
+ const symbolSet = this.symKeys.get(symbolName);
28
+ const symbolPaths = consumes[symbolName];
29
+ for (const symbolPath of symbolPaths) {
30
+ const abbreviation = symbolSet.get(symbolPath);
31
+ if (abbreviation) {
32
+ const dimensionalIndex = this.resolveDimensionalIndex(symbolPath);
33
+ fields.push(`${abbreviation}${dimensionalIndex}`);
34
+ }
35
+ else {
36
+ fields.push(symbolPath);
37
+ }
38
+ }
39
+ }
40
+ return fields;
41
+ }
42
+ resolveDimensionalIndex(path) {
43
+ if (this.isJobPath(path)) {
44
+ return '';
45
+ }
46
+ else {
47
+ const [activityId] = path.split('/');
48
+ if (activityId in this.dIds) {
49
+ return this.dIds[activityId];
50
+ }
51
+ else if ('$ADJACENT' in this.dIds) {
52
+ //else=> pre-authorizing adjacent activity entry
53
+ return this.dIds['$ADJACENT'];
54
+ }
55
+ return ',0';
56
+ }
57
+ }
58
+ isJobPath(path) {
59
+ return path.startsWith('data/') || path.startsWith('metadata/');
60
+ }
61
+ resetSymbols(symKeys, symVals, dIds) {
26
62
  this.symKeys = new Map();
27
63
  this.symReverseKeys = new Map();
28
64
  for (const id in symKeys) {
@@ -30,6 +66,7 @@ class SerializerService {
30
66
  }
31
67
  this.symValMaps = new Map(Object.entries(symVals));
32
68
  this.symValReverseMaps = this.getReverseValueMap(this.symValMaps);
69
+ this.dIds = dIds;
33
70
  }
34
71
  getReverseKeyMap(keyMap, id) {
35
72
  let map = this.symReverseKeys.get(id);
@@ -70,24 +107,22 @@ class SerializerService {
70
107
  if (this.symKeys.size === 0) {
71
108
  return document;
72
109
  }
73
- let result = { ...document };
74
- const compressWithMap = (abbreviationMap) => {
75
- for (let key in result) {
76
- let safeKey = abbreviationMap.get(key) || key;
77
- let value = result[key];
78
- let safeValue = abbreviationMap.get(value) || value;
79
- if (safeKey !== key || safeValue !== value) {
80
- result[safeKey] = safeValue;
81
- if (safeKey !== key) {
82
- delete result[key];
83
- }
110
+ let source = { ...document };
111
+ let result = {};
112
+ const compressWithMap = (abbreviationMap, id) => {
113
+ for (let key in source) {
114
+ if (key.startsWith(`${id}/`) || (id.startsWith('$') && ['data', 'metadata'].includes(key.split('/')[0]))) {
115
+ const dimensionalIndex = this.resolveDimensionalIndex(key);
116
+ let shortKey = abbreviationMap.get(key) || key;
117
+ const shortDimensionalKey = `${shortKey}${dimensionalIndex}`;
118
+ result[shortDimensionalKey] = source[key];
84
119
  }
85
120
  }
86
121
  };
87
122
  for (let id of ids) {
88
123
  const abbreviationMap = this.symKeys.get(id);
89
124
  if (abbreviationMap) {
90
- compressWithMap(abbreviationMap);
125
+ compressWithMap(abbreviationMap, id);
91
126
  }
92
127
  }
93
128
  return result;
@@ -100,14 +135,12 @@ class SerializerService {
100
135
  const inflateWithMap = (abbreviationMap, id) => {
101
136
  const reversedAbbreviationMap = this.getReverseKeyMap(abbreviationMap, id);
102
137
  for (let key in result) {
103
- let safeKey = reversedAbbreviationMap.get(key) || key;
104
- let value = result[key];
105
- let safeValue = reversedAbbreviationMap.get(value) || value;
106
- if (safeKey !== key || safeValue !== value) {
107
- result[safeKey] = safeValue;
108
- if (safeKey !== key) {
109
- delete result[key];
110
- }
138
+ //strip dimensional index from key
139
+ const shortKey = key.split(',')[0];
140
+ let longKey = reversedAbbreviationMap.get(shortKey);
141
+ if (longKey) {
142
+ result[longKey] = result[key];
143
+ delete result[key];
111
144
  }
112
145
  }
113
146
  };
@@ -121,6 +121,7 @@ class StreamSignaler {
121
121
  output = await callback(input);
122
122
  }
123
123
  catch (err) {
124
+ console.error(err);
124
125
  this.logger.error(`stream-call-function-error`, { stream, id, err });
125
126
  output = this.structureUnhandledError(input, err);
126
127
  }
@@ -59,9 +59,9 @@ declare abstract class StoreService<T, U extends AbstractRedisClient> {
59
59
  getJobIds(indexKeys: string[], idRange: [number, number]): Promise<IdsData>;
60
60
  setStatus(collationKeyStatus: number, jobId: string, appId: string, multi?: U): Promise<any>;
61
61
  getStatus(jobId: string, appId: string): Promise<number>;
62
- setState({ ...state }: StringAnyType, status: number | null, jobId: string, appId: string, symbolNames: string[], multi?: U): Promise<string>;
63
- getState(jobId: string, consumes: Consumes): Promise<[StringAnyType, number] | undefined>;
64
- collate(jobId: string, activityId: string, amount: number, multi?: U): Promise<number>;
62
+ setState({ ...state }: StringAnyType, status: number | null, jobId: string, symbolNames: string[], dIds: StringStringType, multi?: U): Promise<string>;
63
+ getState(jobId: string, consumes: Consumes, dIds: StringStringType): Promise<[StringAnyType, number] | undefined>;
64
+ collate(jobId: string, activityId: string, amount: number, dIds: StringStringType, multi?: U): Promise<number>;
65
65
  setStateNX(jobId: string, appId: string): Promise<boolean>;
66
66
  getSchema(activityId: string, appVersion: AppVID): Promise<ActivityType>;
67
67
  getSchemas(appVersion: AppVID): Promise<Record<string, ActivityType>>;
@@ -110,7 +110,7 @@ class StoreService {
110
110
  else {
111
111
  if (bCreate) {
112
112
  const packageJson = await Promise.resolve().then(() => __importStar(require('../../package.json')));
113
- const version = packageJson.version;
113
+ const version = packageJson['version'] || '0.0.0';
114
114
  settings = { namespace: key_1.PSNS, version };
115
115
  await this.setSettings(settings);
116
116
  return settings;
@@ -374,12 +374,12 @@ class StoreService {
374
374
  const status = await this.redisClient[this.commands.hget](jobKey, ':');
375
375
  return Number(status);
376
376
  }
377
- async setState({ ...state }, status, jobId, appId, symbolNames, multi) {
377
+ async setState({ ...state }, status, jobId, symbolNames, dIds, multi) {
378
378
  delete state['metadata/js'];
379
- const hashKey = this.mintKey(key_1.KeyType.JOB_STATE, { appId, jobId });
379
+ const hashKey = this.mintKey(key_1.KeyType.JOB_STATE, { appId: this.appId, jobId });
380
380
  const symKeys = await this.getSymbolKeys(symbolNames);
381
381
  const symVals = await this.getSymbolValues();
382
- this.serializer.resetSymbols(symKeys, symVals);
382
+ this.serializer.resetSymbols(symKeys, symVals, dIds);
383
383
  const hashData = this.serializer.package(state, symbolNames);
384
384
  if (status !== null) {
385
385
  hashData[':'] = status.toString();
@@ -390,26 +390,13 @@ class StoreService {
390
390
  await (multi || this.redisClient)[this.commands.hset](hashKey, hashData);
391
391
  return jobId;
392
392
  }
393
- async getState(jobId, consumes) {
394
- //todo: refactor into semantic submethods
393
+ async getState(jobId, consumes, dIds) {
394
+ //get abbreviated field list (the symbols for the paths)
395
395
  const key = this.mintKey(key_1.KeyType.JOB_STATE, { appId: this.appId, jobId });
396
396
  const symbolNames = Object.keys(consumes);
397
397
  const symKeys = await this.getSymbolKeys(symbolNames);
398
- //always fetch the job status (':') when fetching state
399
- const fields = [':'];
400
- for (const symbolName of symbolNames) {
401
- const symbolSet = symKeys[symbolName];
402
- const symbolPaths = consumes[symbolName];
403
- for (const symbolPath of symbolPaths) {
404
- const abbreviation = symbolSet[symbolPath];
405
- if (abbreviation) {
406
- fields.push(abbreviation);
407
- }
408
- else {
409
- fields.push(symbolPath);
410
- }
411
- }
412
- }
398
+ this.serializer.resetSymbols(symKeys, {}, dIds);
399
+ const fields = this.serializer.abbreviate(consumes, symbolNames, [':']);
413
400
  const jobDataArray = await this.redisClient[this.commands.hmget](key, fields);
414
401
  const jobData = {};
415
402
  let atLeast1 = false; //if status field (':') isn't present assume 404
@@ -421,7 +408,7 @@ class StoreService {
421
408
  });
422
409
  if (atLeast1) {
423
410
  const symVals = await this.getSymbolValues();
424
- this.serializer.resetSymbols(symKeys, symVals);
411
+ this.serializer.resetSymbols(symKeys, symVals, dIds);
425
412
  const state = this.serializer.unpackage(jobData, symbolNames);
426
413
  let status = 0;
427
414
  if (state[':']) {
@@ -432,13 +419,13 @@ class StoreService {
432
419
  return [state, status];
433
420
  }
434
421
  }
435
- async collate(jobId, activityId, amount, multi) {
422
+ async collate(jobId, activityId, amount, dIds, multi) {
436
423
  const jobKey = this.mintKey(key_1.KeyType.JOB_STATE, { appId: this.appId, jobId });
437
424
  const collationKey = `${activityId}/output/metadata/as`; //activity state
438
425
  const symbolNames = [activityId];
439
426
  const symKeys = await this.getSymbolKeys(symbolNames);
440
427
  const symVals = await this.getSymbolValues();
441
- this.serializer.resetSymbols(symKeys, symVals);
428
+ this.serializer.resetSymbols(symKeys, symVals, dIds);
442
429
  const payload = { [collationKey]: amount.toString() };
443
430
  const hashData = this.serializer.package(payload, symbolNames);
444
431
  const targetId = Object.keys(hashData)[0];
@@ -23,6 +23,7 @@ interface BaseActivity {
23
23
  subscribes?: string;
24
24
  trigger?: string;
25
25
  parent?: string;
26
+ ancestors?: string[];
26
27
  }
27
28
  interface Measure {
28
29
  measure: MetricTypes;
@@ -0,0 +1,4 @@
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 };
@@ -0,0 +1,3 @@
1
+ import { Durable } from './services/durable';
2
+ import { HotMeshService as HotMesh } from './services/hotmesh';
3
+ export { Durable, HotMesh };
@@ -0,0 +1,28 @@
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 };
@@ -0,0 +1,41 @@
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 };
@@ -0,0 +1,75 @@
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 };
@@ -0,0 +1,111 @@
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 };
@@ -0,0 +1,34 @@
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;