@hotmeshio/hotmesh 0.0.1

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 (263) hide show
  1. package/LICENSE +214 -0
  2. package/README.md +241 -0
  3. package/build/index.d.ts +4 -0
  4. package/build/index.js +7 -0
  5. package/build/modules/errors.d.ts +28 -0
  6. package/build/modules/errors.js +50 -0
  7. package/build/modules/key.d.ts +75 -0
  8. package/build/modules/key.js +116 -0
  9. package/build/modules/utils.d.ts +34 -0
  10. package/build/modules/utils.js +173 -0
  11. package/build/package.json +73 -0
  12. package/build/services/activities/activity.d.ts +59 -0
  13. package/build/services/activities/activity.js +396 -0
  14. package/build/services/activities/await.d.ts +16 -0
  15. package/build/services/activities/await.js +143 -0
  16. package/build/services/activities/emit.d.ts +9 -0
  17. package/build/services/activities/emit.js +13 -0
  18. package/build/services/activities/index.d.ts +15 -0
  19. package/build/services/activities/index.js +16 -0
  20. package/build/services/activities/iterate.d.ts +9 -0
  21. package/build/services/activities/iterate.js +13 -0
  22. package/build/services/activities/trigger.d.ts +22 -0
  23. package/build/services/activities/trigger.js +161 -0
  24. package/build/services/activities/worker.d.ts +17 -0
  25. package/build/services/activities/worker.js +164 -0
  26. package/build/services/collator/index.d.ts +54 -0
  27. package/build/services/collator/index.js +171 -0
  28. package/build/services/compiler/deployer.d.ts +35 -0
  29. package/build/services/compiler/deployer.js +412 -0
  30. package/build/services/compiler/index.d.ts +30 -0
  31. package/build/services/compiler/index.js +111 -0
  32. package/build/services/compiler/validator.d.ts +32 -0
  33. package/build/services/compiler/validator.js +134 -0
  34. package/build/services/connector/clients/ioredis.d.ts +13 -0
  35. package/build/services/connector/clients/ioredis.js +50 -0
  36. package/build/services/connector/clients/redis.d.ts +13 -0
  37. package/build/services/connector/clients/redis.js +62 -0
  38. package/build/services/connector/index.d.ts +5 -0
  39. package/build/services/connector/index.js +31 -0
  40. package/build/services/dimension/index.d.ts +29 -0
  41. package/build/services/dimension/index.js +35 -0
  42. package/build/services/durable/asyncLocalStorage.d.ts +3 -0
  43. package/build/services/durable/asyncLocalStorage.js +5 -0
  44. package/build/services/durable/client.d.ts +15 -0
  45. package/build/services/durable/client.js +108 -0
  46. package/build/services/durable/connection.d.ts +4 -0
  47. package/build/services/durable/connection.js +51 -0
  48. package/build/services/durable/factory.d.ts +3 -0
  49. package/build/services/durable/factory.js +123 -0
  50. package/build/services/durable/handle.d.ts +8 -0
  51. package/build/services/durable/handle.js +38 -0
  52. package/build/services/durable/index.d.ts +57 -0
  53. package/build/services/durable/index.js +58 -0
  54. package/build/services/durable/native.d.ts +4 -0
  55. package/build/services/durable/native.js +47 -0
  56. package/build/services/durable/worker.d.ts +36 -0
  57. package/build/services/durable/worker.js +266 -0
  58. package/build/services/durable/workflow.d.ts +6 -0
  59. package/build/services/durable/workflow.js +135 -0
  60. package/build/services/engine/index.d.ts +82 -0
  61. package/build/services/engine/index.js +511 -0
  62. package/build/services/hotmesh/index.d.ts +45 -0
  63. package/build/services/hotmesh/index.js +134 -0
  64. package/build/services/logger/index.d.ts +17 -0
  65. package/build/services/logger/index.js +73 -0
  66. package/build/services/mapper/index.d.ts +24 -0
  67. package/build/services/mapper/index.js +72 -0
  68. package/build/services/pipe/functions/array.d.ts +24 -0
  69. package/build/services/pipe/functions/array.js +69 -0
  70. package/build/services/pipe/functions/bitwise.d.ts +9 -0
  71. package/build/services/pipe/functions/bitwise.js +24 -0
  72. package/build/services/pipe/functions/conditional.d.ts +10 -0
  73. package/build/services/pipe/functions/conditional.js +27 -0
  74. package/build/services/pipe/functions/date.d.ts +57 -0
  75. package/build/services/pipe/functions/date.js +167 -0
  76. package/build/services/pipe/functions/index.d.ts +25 -0
  77. package/build/services/pipe/functions/index.js +26 -0
  78. package/build/services/pipe/functions/json.d.ts +5 -0
  79. package/build/services/pipe/functions/json.js +12 -0
  80. package/build/services/pipe/functions/math.d.ts +38 -0
  81. package/build/services/pipe/functions/math.js +111 -0
  82. package/build/services/pipe/functions/number.d.ts +25 -0
  83. package/build/services/pipe/functions/number.js +133 -0
  84. package/build/services/pipe/functions/object.d.ts +22 -0
  85. package/build/services/pipe/functions/object.js +63 -0
  86. package/build/services/pipe/functions/string.d.ts +23 -0
  87. package/build/services/pipe/functions/string.js +69 -0
  88. package/build/services/pipe/functions/symbol.d.ts +12 -0
  89. package/build/services/pipe/functions/symbol.js +33 -0
  90. package/build/services/pipe/functions/unary.d.ts +7 -0
  91. package/build/services/pipe/functions/unary.js +18 -0
  92. package/build/services/pipe/index.d.ts +30 -0
  93. package/build/services/pipe/index.js +128 -0
  94. package/build/services/quorum/index.d.ts +34 -0
  95. package/build/services/quorum/index.js +147 -0
  96. package/build/services/reporter/index.d.ts +47 -0
  97. package/build/services/reporter/index.js +330 -0
  98. package/build/services/serializer/index.d.ts +36 -0
  99. package/build/services/serializer/index.js +222 -0
  100. package/build/services/signaler/store.d.ts +15 -0
  101. package/build/services/signaler/store.js +53 -0
  102. package/build/services/signaler/stream.d.ts +43 -0
  103. package/build/services/signaler/stream.js +317 -0
  104. package/build/services/store/cache.d.ts +66 -0
  105. package/build/services/store/cache.js +127 -0
  106. package/build/services/store/clients/ioredis.d.ts +27 -0
  107. package/build/services/store/clients/ioredis.js +96 -0
  108. package/build/services/store/clients/redis.d.ts +29 -0
  109. package/build/services/store/clients/redis.js +143 -0
  110. package/build/services/store/index.d.ts +88 -0
  111. package/build/services/store/index.js +657 -0
  112. package/build/services/stream/clients/ioredis.d.ts +23 -0
  113. package/build/services/stream/clients/ioredis.js +115 -0
  114. package/build/services/stream/clients/redis.d.ts +23 -0
  115. package/build/services/stream/clients/redis.js +119 -0
  116. package/build/services/stream/index.d.ts +21 -0
  117. package/build/services/stream/index.js +9 -0
  118. package/build/services/sub/clients/ioredis.d.ts +20 -0
  119. package/build/services/sub/clients/ioredis.js +72 -0
  120. package/build/services/sub/clients/redis.d.ts +20 -0
  121. package/build/services/sub/clients/redis.js +63 -0
  122. package/build/services/sub/index.d.ts +18 -0
  123. package/build/services/sub/index.js +9 -0
  124. package/build/services/task/index.d.ts +18 -0
  125. package/build/services/task/index.js +73 -0
  126. package/build/services/telemetry/index.d.ts +49 -0
  127. package/build/services/telemetry/index.js +223 -0
  128. package/build/services/worker/index.d.ts +30 -0
  129. package/build/services/worker/index.js +105 -0
  130. package/build/types/activity.d.ts +86 -0
  131. package/build/types/activity.js +2 -0
  132. package/build/types/app.d.ts +16 -0
  133. package/build/types/app.js +2 -0
  134. package/build/types/async.d.ts +5 -0
  135. package/build/types/async.js +2 -0
  136. package/build/types/cache.d.ts +1 -0
  137. package/build/types/cache.js +2 -0
  138. package/build/types/collator.d.ts +8 -0
  139. package/build/types/collator.js +11 -0
  140. package/build/types/durable.d.ts +59 -0
  141. package/build/types/durable.js +2 -0
  142. package/build/types/hook.d.ts +31 -0
  143. package/build/types/hook.js +9 -0
  144. package/build/types/hotmesh.d.ts +82 -0
  145. package/build/types/hotmesh.js +2 -0
  146. package/build/types/index.d.ts +20 -0
  147. package/build/types/index.js +21 -0
  148. package/build/types/ioredisclient.d.ts +5 -0
  149. package/build/types/ioredisclient.js +5 -0
  150. package/build/types/job.d.ts +50 -0
  151. package/build/types/job.js +2 -0
  152. package/build/types/logger.d.ts +6 -0
  153. package/build/types/logger.js +2 -0
  154. package/build/types/map.d.ts +4 -0
  155. package/build/types/map.js +2 -0
  156. package/build/types/pipe.d.ts +4 -0
  157. package/build/types/pipe.js +2 -0
  158. package/build/types/quorum.d.ts +46 -0
  159. package/build/types/quorum.js +2 -0
  160. package/build/types/redis.d.ts +8 -0
  161. package/build/types/redis.js +2 -0
  162. package/build/types/redisclient.d.ts +25 -0
  163. package/build/types/redisclient.js +2 -0
  164. package/build/types/serializer.d.ts +33 -0
  165. package/build/types/serializer.js +2 -0
  166. package/build/types/stats.d.ts +83 -0
  167. package/build/types/stats.js +2 -0
  168. package/build/types/stream.d.ts +67 -0
  169. package/build/types/stream.js +25 -0
  170. package/build/types/telemetry.d.ts +1 -0
  171. package/build/types/telemetry.js +11 -0
  172. package/build/types/transition.d.ts +17 -0
  173. package/build/types/transition.js +2 -0
  174. package/index.ts +5 -0
  175. package/modules/errors.ts +55 -0
  176. package/modules/key.ts +129 -0
  177. package/modules/utils.ts +170 -0
  178. package/package.json +73 -0
  179. package/services/activities/activity.ts +473 -0
  180. package/services/activities/await.ts +172 -0
  181. package/services/activities/emit.ts +25 -0
  182. package/services/activities/index.ts +15 -0
  183. package/services/activities/iterate.ts +26 -0
  184. package/services/activities/trigger.ts +196 -0
  185. package/services/activities/worker.ts +190 -0
  186. package/services/collator/README.md +102 -0
  187. package/services/collator/index.ts +182 -0
  188. package/services/compiler/deployer.ts +432 -0
  189. package/services/compiler/index.ts +98 -0
  190. package/services/compiler/validator.ts +154 -0
  191. package/services/connector/clients/ioredis.ts +57 -0
  192. package/services/connector/clients/redis.ts +72 -0
  193. package/services/connector/index.ts +44 -0
  194. package/services/dimension/README.md +73 -0
  195. package/services/dimension/index.ts +39 -0
  196. package/services/durable/asyncLocalStorage.ts +3 -0
  197. package/services/durable/client.ts +116 -0
  198. package/services/durable/connection.ts +50 -0
  199. package/services/durable/factory.ts +124 -0
  200. package/services/durable/handle.ts +43 -0
  201. package/services/durable/index.ts +60 -0
  202. package/services/durable/native.ts +46 -0
  203. package/services/durable/worker.ts +254 -0
  204. package/services/durable/workflow.ts +136 -0
  205. package/services/engine/index.ts +615 -0
  206. package/services/hotmesh/index.ts +182 -0
  207. package/services/logger/index.ts +79 -0
  208. package/services/mapper/index.ts +84 -0
  209. package/services/pipe/functions/array.ts +87 -0
  210. package/services/pipe/functions/bitwise.ts +27 -0
  211. package/services/pipe/functions/conditional.ts +31 -0
  212. package/services/pipe/functions/date.ts +214 -0
  213. package/services/pipe/functions/index.ts +25 -0
  214. package/services/pipe/functions/json.ts +11 -0
  215. package/services/pipe/functions/math.ts +143 -0
  216. package/services/pipe/functions/number.ts +150 -0
  217. package/services/pipe/functions/object.ts +79 -0
  218. package/services/pipe/functions/string.ts +86 -0
  219. package/services/pipe/functions/symbol.ts +39 -0
  220. package/services/pipe/functions/unary.ts +19 -0
  221. package/services/pipe/index.ts +138 -0
  222. package/services/quorum/index.ts +200 -0
  223. package/services/reporter/index.ts +379 -0
  224. package/services/serializer/README.md +10 -0
  225. package/services/serializer/index.ts +243 -0
  226. package/services/signaler/store.ts +61 -0
  227. package/services/signaler/stream.ts +354 -0
  228. package/services/store/cache.ts +172 -0
  229. package/services/store/clients/ioredis.ts +123 -0
  230. package/services/store/clients/redis.ts +169 -0
  231. package/services/store/index.ts +757 -0
  232. package/services/stream/clients/ioredis.ts +148 -0
  233. package/services/stream/clients/redis.ts +144 -0
  234. package/services/stream/index.ts +57 -0
  235. package/services/sub/clients/ioredis.ts +83 -0
  236. package/services/sub/clients/redis.ts +74 -0
  237. package/services/sub/index.ts +25 -0
  238. package/services/task/index.ts +86 -0
  239. package/services/telemetry/index.ts +267 -0
  240. package/services/worker/index.ts +165 -0
  241. package/types/activity.ts +115 -0
  242. package/types/app.ts +20 -0
  243. package/types/async.ts +7 -0
  244. package/types/cache.ts +1 -0
  245. package/types/collator.ts +9 -0
  246. package/types/durable.ts +81 -0
  247. package/types/hook.ts +32 -0
  248. package/types/hotmesh.ts +102 -0
  249. package/types/index.ts +138 -0
  250. package/types/ioredisclient.ts +10 -0
  251. package/types/job.ts +59 -0
  252. package/types/logger.ts +6 -0
  253. package/types/map.ts +5 -0
  254. package/types/ms.d.ts +7 -0
  255. package/types/pipe.ts +7 -0
  256. package/types/quorum.ts +59 -0
  257. package/types/redis.ts +27 -0
  258. package/types/redisclient.ts +29 -0
  259. package/types/serializer.ts +38 -0
  260. package/types/stats.ts +100 -0
  261. package/types/stream.ts +75 -0
  262. package/types/telemetry.ts +15 -0
  263. package/types/transition.ts +20 -0
package/LICENSE ADDED
@@ -0,0 +1,214 @@
1
+ HotMesh Source Available License
2
+ Version 1.0, Apr 2023
3
+
4
+ Terms and Conditions for Use, Reproduction, and Distribution
5
+
6
+ 1. Definitions.
7
+
8
+ "License" shall mean the terms and conditions for use, reproduction,
9
+ and distribution as defined by Sections 1 through 10 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by
12
+ the copyright owner that is granting the License.
13
+
14
+ "Legal Entity" shall mean the union of the acting entity and all
15
+ other entities that control, are controlled by, or are under common
16
+ control with that entity. For the purposes of this definition,
17
+ "control" means (i) the power, direct or indirect, to cause the
18
+ direction or management of such entity, whether by contract or
19
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity
23
+ exercising permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications,
26
+ including but not limited to software source code, documentation
27
+ source, and configuration files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical
30
+ transformation or translation of a Source form, including but
31
+ not limited to compiled object code, generated documentation,
32
+ and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or
35
+ Object form, made available under the License, as indicated by a
36
+ copyright notice that is included in or attached to the work
37
+ (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original version of the Work and any modifications or additions
49
+ to that Work or Derivative Works thereof, that is intentionally
50
+ submitted to Licensor for inclusion in the Work by the copyright owner
51
+ or by an individual or Legal Entity authorized to submit on behalf of
52
+ the copyright owner. For the purposes of this definition, "submitted"
53
+ means any form of electronic, verbal, or written communication sent
54
+ to the Licensor or its representatives, including but not limited to
55
+ communication on electronic mailing lists, source code control systems,
56
+ and issue tracking systems that are managed by, or on behalf of, the
57
+ Licensor for the purpose of discussing and improving the Work, but
58
+ excluding communication that is conspicuously marked or otherwise
59
+ designated in writing by the copyright owner as "Not a Contribution."
60
+
61
+ "Contributor" shall mean Licensor and any individual or Legal Entity
62
+ on behalf of whom a Contribution has been received by Licensor and
63
+ subsequently incorporated within the Work.
64
+
65
+ 2. Grant of Copyright License. Subject to the terms and conditions of
66
+ this License, each Contributor hereby grants to You a perpetual,
67
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
68
+ copyright license to reproduce, prepare Derivative Works of,
69
+ publicly display, publicly perform, sublicense, and distribute the
70
+ Work and such Derivative Works in Source or Object form.
71
+
72
+ 3. Grant of Patent License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ (except as stated in this section) patent license to make, have made,
76
+ use, offer to sell, sell, import, and otherwise transfer the Work,
77
+ where such license applies only to those patent claims licensable
78
+ by such Contributor that are necessarily infringed by their
79
+ Contribution(s) alone or by combination of their Contribution(s)
80
+ with the Work to which such Contribution(s) was submitted. If You
81
+ institute patent litigation against any entity (including a
82
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
83
+ or a Contribution incorporated within the Work constitutes direct
84
+ or contributory patent infringement, then any patent licenses
85
+ granted to You under this License for that Work shall terminate
86
+ as of the date such litigation is filed.
87
+
88
+ 4. Redistribution. You may reproduce and distribute copies of the
89
+ Work or Derivative Works thereof in any medium, with or without
90
+ modifications, and in Source or Object form, provided that You
91
+ meet the following conditions:
92
+
93
+ (a) You must give any other recipients of the Work or
94
+ Derivative Works a copy of this License; and
95
+
96
+ (b) You must cause any modified files to carry prominent notices
97
+ stating that You changed the files; and
98
+
99
+ (c) You must retain, in the Source form of any Derivative Works
100
+ that You distribute, all copyright, patent, trademark, and
101
+ attribution notices from the Source form of the Work,
102
+ excluding those notices that do not pertain to any part of
103
+ the Derivative Works; and
104
+
105
+ (d) If the Work includes a "NOTICE" text file as part of its
106
+ distribution, then any Derivative Works that You distribute must
107
+ include a readable copy of the attribution notices contained
108
+ within such NOTICE file, excluding those notices that do not
109
+ pertain to any part of the Derivative Works, in at least one
110
+ of the following places: within a NOTICE text file distributed
111
+ as part of the Derivative Works; within the Source form or
112
+ documentation, if provided along with the Derivative Works; or,
113
+ within a display generated by the Derivative Works, if and
114
+ wherever such third-party notices normally appear. The contents
115
+ of the NOTICE file are for informational purposes only and
116
+ do not modify the License. You may add Your own attribution
117
+ notices within Derivative Works that You distribute, alongside
118
+ or as an addendum to the NOTICE text from the Work, provided
119
+ that such additional attribution notices cannot be construed
120
+ as modifying the License.
121
+
122
+ You may add Your own copyright statement to Your modifications and
123
+ may provide additional or different license terms and conditions
124
+ for use, reproduction, or distribution of Your modifications, or
125
+ for any such Derivative Works as a whole, provided Your use,
126
+ reproduction, and distribution of the Work otherwise complies with
127
+ the conditions stated in this License.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or redistributing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ 10. Commercial Service Restrictions.
176
+ You are not permitted to use the Work, or any modified or derivative
177
+ version of the Work, for the purpose of offering the Work, or any
178
+ product that includes the Work or any part of it, as a commercial
179
+ service to third parties, or in any other commercial context where
180
+ you derive direct or indirect financial benefit from the use of the
181
+ Work. This includes, but is not limited to, providing
182
+ routing-as-a-service, bpm-as-a-service, workflow-as-a-service,
183
+ integration-as-a-service, operational-data-as-a-service
184
+ or any other similar service that would compete with
185
+ HotMesh's commercial offering of workflow and routing services.
186
+ Any such use requires explicit written permission from the
187
+ Licensor.
188
+
189
+ END OF TERMS AND CONDITIONS
190
+
191
+ APPENDIX: How to apply the HotMesh Source Available License to your work.
192
+
193
+ To apply the HotMesh Source Available License to your work,
194
+ attach the following boilerplate notice, with the fields enclosed by
195
+ brackets "[]" replaced with your own identifying information. (Don't
196
+ include the brackets!) The text should be enclosed in the appropriate
197
+ comment syntax for the file format. We also recommend that a
198
+ file or class name and description of purpose be included on the
199
+ same "printed page" as the copyright notice for easier
200
+ identification within third-party archives.
201
+
202
+ Copyright [yyyy] [name of copyright owner]
203
+
204
+ Licensed under the HotMesh Source Available License;
205
+ you may not use this file except in compliance with the License.
206
+ You may obtain a copy of the License at
207
+
208
+ https://github.com/hotmeshio/hotmesh/blob/main/LICENSE
209
+
210
+ Unless required by applicable law or agreed to in writing, software
211
+ distributed under the License is distributed on an "AS IS" BASIS,
212
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
213
+ See the License for the specific language governing permissions and
214
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,241 @@
1
+ # HotMesh
2
+ ![alpha release](https://img.shields.io/badge/release-alpha-yellow)
3
+
4
+ Build sophisticated, durable workflows without the overhead of a dedicated server cluster. With HotMesh, your code remains front and center using [infrastructure](./docs/faq.md#what-is-hotmesh) you already own.
5
+
6
+ ## Install
7
+ [![npm version](https://badge.fury.io/js/%40hotmesh%2Fhotmesh.svg)](https://badge.fury.io/js/%40hotmesh%2Fhotmesh)
8
+
9
+ ```sh
10
+ npm install @hotmeshio/hotmesh
11
+ ```
12
+
13
+ ## Design
14
+ HotMesh's TypeScript SDK is modeled after [Temporal IO's](https://github.com/temporalio) developer-friendly approach. Design and deploy durable workflows using familiar paradigms that keep your code delightful to maintain. Deploying Temporal's [hello-world tutorial](https://github.com/temporalio/samples-typescript/tree/main/hello-world/src), for example, requires few changes beyond using the HotMesh SDK and saving to Redis.
15
+
16
+ **./activities.ts**
17
+ ```javascript
18
+ export async function greet(name: string): Promise<string> {
19
+ return `Hello, ${name}!`;
20
+ }
21
+ ```
22
+
23
+ **./workflows.ts**
24
+ ```javascript
25
+ import { Durable } from '@hotmeshio/hotmesh';
26
+ import type * as activities from './activities';
27
+
28
+ const { greet } = Durable.workflow.proxyActivities<typeof activities>();
29
+
30
+ export async function example(name: string): Promise<string> {
31
+ return await greet(name);
32
+ }
33
+ ```
34
+
35
+ **./worker.ts**
36
+ ```javascript
37
+ import { Durable } from '@hotmeshio/hotmesh';
38
+ import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
39
+ import * as activities from './activities';
40
+
41
+ async function run() {
42
+ const connection = await Durable.NativeConnection.connect({
43
+ class: Redis,
44
+ options: {
45
+ host: 'localhost',
46
+ port: 6379,
47
+ },
48
+ });
49
+ const worker = await Durable.Worker.create({
50
+ connection,
51
+ namespace: 'default',
52
+ taskQueue: 'hello-world',
53
+ workflowsPath: require.resolve('./workflows'),
54
+ activities,
55
+ });
56
+ await worker.run();
57
+ }
58
+
59
+ run().catch((err) => {
60
+ console.error(err);
61
+ process.exit(1);
62
+ });
63
+ ```
64
+
65
+ **./client.ts**
66
+ ```javascript
67
+ import { Durable } from '@hotmeshio/hotmesh';
68
+ import Redis from 'ioredis';
69
+ import { nanoid } from 'nanoid';
70
+
71
+ async function run() {
72
+ const connection = await Durable.Connection.connect({
73
+ class: Redis,
74
+ options: {
75
+ host: 'localhost',
76
+ port: 6379,
77
+ },
78
+ });
79
+
80
+ const client = new Durable.Client({
81
+ connection,
82
+ });
83
+
84
+ const handle = await client.workflow.start({
85
+ args: ['HotMesh'],
86
+ taskQueue: 'hello-world',
87
+ workflowName: 'example',
88
+ workflowId: 'workflow-' + nanoid(),
89
+ });
90
+
91
+ console.log(`Started workflow ${handle.workflowId}`);
92
+ console.log(await handle.result());
93
+ }
94
+
95
+ run().catch((err) => {
96
+ console.error(err);
97
+ process.exit(1);
98
+ });
99
+ ```
100
+
101
+ >HotMesh delivers durable function execution using a swarm of [distributed engines](./docs/distributed_orchestration.md). The design consumes leftover CPU on your microservices to execute workflows without the cost and complexity of a central server.
102
+
103
+ ## Advanced Design
104
+ HotMesh's TypeScript SDK is the easiest way to make your functions durable. But if you need full control over your function lifecycles (including high-volume, high-speed use cases), you can use HotMesh's underlying YAML models to optimize your durable workflows. The following model depicts a sequence of activities orchestrated by HotMesh. Any function you associate with a `topic` in your YAML definition is guaranteed to be durable.
105
+
106
+ ```yaml
107
+ app:
108
+ id: sandbox
109
+ version: '1'
110
+ graphs:
111
+ - subscribes: sandbox.work.do
112
+ publishes: sandbox.work.done
113
+
114
+ activities:
115
+ gateway:
116
+ type: trigger
117
+ servicec:
118
+ type: worker
119
+ topic: sandbox.work.do.servicec
120
+ serviced:
121
+ type: worker
122
+ topic: sandbox.work.do.serviced
123
+ sforcecloud:
124
+ type: worker
125
+ topic: sandbox.work.do.sforcecloud
126
+
127
+ transitions:
128
+ gateway:
129
+ - to: servicec
130
+ servicec:
131
+ - to: serviced
132
+ serviced:
133
+ - to: sforcecloud
134
+ ```
135
+
136
+ ### Initialize
137
+ Provide your chosen Redis instance and configuration options to start a HotMesh Client. *HotMesh supports both `ioredis` and `redis` clients interchangeably.*
138
+
139
+ ```javascript
140
+ import { HotMesh } from '@hotmeshio/hotmesh';
141
+ import Redis from 'ioredis'; //OR `import * as Redis from 'redis';`
142
+
143
+ const hotMesh = await HotMesh.init({
144
+ appId: 'sandbox',
145
+ engine: {
146
+ redis: {
147
+ class: Redis,
148
+ options: { host, port, password, db } //per your chosen Redis client
149
+ }
150
+ }
151
+ });
152
+ ```
153
+
154
+ A HotMesh Client can be used to trigger worfkows and subscribe to results.
155
+
156
+ ### Trigger a Workflow
157
+ Call `pub` to initiate a workflow. This function returns a job ID that allows you to monitor the progress of the workflow.
158
+
159
+ ```javascript
160
+ const topic = 'sandbox.work.do';
161
+ const payload = { };
162
+ const jobId = await hotMesh.pub(topic, payload);
163
+ ```
164
+
165
+ ### Subscribe to Events
166
+ Call `sub` to subscribe to all workflow results for a given topic.
167
+
168
+ ```javascript
169
+ await hotMesh.sub('sandbox.work.done', (topic, jobOutput) => {
170
+ // use jobOutput.data
171
+ });
172
+ ```
173
+
174
+ ### Trigger and Wait
175
+ Call `pubsub` to start a workflow and *wait for the response*. HotMesh establishes a one-time subscription and delivers the job result once the workflow concludes.
176
+
177
+ ```javascript
178
+ const jobOutput = await hotMesh.pubsub(topic, payload);
179
+ ```
180
+
181
+ >The `pubsub` method is a convenience function that merges pub and sub into a single call. Opt for HotMesh's queue-driven engine over fragile HTTP requests to develop resilient solutions.
182
+
183
+ ### Link Worker Functions
184
+ Link worker functions to a topic of your choice. When a workflow activity in the YAML definition with a corresponding topic runs, HotMesh will invoke your function, retrying as configured until it succeeds.
185
+
186
+ ```javascript
187
+ import { HotMesh } from '@hotmeshio/hotmesh';
188
+ import Redis from 'ioredis';
189
+
190
+ const hotMesh = await HotMesh.init({
191
+ appId: 'sandbox',
192
+ workers: [
193
+ {
194
+ topic: 'sandbox.work.do.servicec',
195
+ redis: {
196
+ class: Redis,
197
+ options: { host, port, password, db }
198
+ }
199
+ callback: async (data: StreamData) => {
200
+ return {
201
+ metadata: { ...data.metadata },
202
+ data: { }
203
+ };
204
+ }
205
+ }
206
+ ]
207
+ };
208
+ ```
209
+
210
+ ### Observability
211
+ Workflows and activities are run according to the rules you define, offering [Graph-Oriented](./docs/system_lifecycle.md#telemetry) telemetry insights into your legacy function executions.
212
+
213
+ ## FAQ
214
+ Refer to the [FAQ](./docs/faq.md) for terminology, definitions, and an exploration of how HotMesh facilitates orchestration use cases.
215
+
216
+ ## Quick Start
217
+ Refer to the [Quick Start](./docs/quickstart.md) for sample flows you can easily copy, paste, and modify to get started.
218
+
219
+ ## Developer Guide
220
+ For more details on the complete development process, including information about schemas, APIs, and deployment, consult the [Developer Guide](./docs/developer_guide.md).
221
+
222
+ ## Model Driven Development
223
+ [Model Driven Development](./docs/model_driven_development.md) is an established strategy for managing process-oriented tasks. Check out this guide to understand its foundational principles.
224
+
225
+ ## Data Mapping
226
+ Exchanging data between activities is central to HotMesh. For detailed information on supported functions and the functional mapping syntax (@pipes), see the [Data Mapping Overview](./docs/data_mapping.md).
227
+
228
+ ## Composition
229
+ While the simplest graphs are linear, detailing a consistent sequence of non-cyclical activities, graphs can be layered to represent intricate business scenarios. Some can even be designed to accommodate long-lasting workflows that span months. For more details, check out the [Composable Workflow Guide](./docs/composable_workflow.md).
230
+
231
+ ## Architectural First Principles
232
+ For a deep dive into HotMesh's distributed orchestration philosophy, refer to the [Architectural First Principles Overview](./docs/architecture.md).
233
+
234
+ ## Distributed Orchestration
235
+ HotMesh is a distributed orchestration engine. Refer to the [Distributed Orchestration Guide](./docs/distributed_orchestration.md) for a detailed breakdown of the approach.
236
+
237
+ ## System Lifecycle
238
+ Gain insight into the HotMesh's monitoring, exception handling, and alarm configurations via the [System Lifecycle Guide](./docs/system_lifecycle.md).
239
+
240
+ ## Alpha Release
241
+ So what exacty is an [alpha release](./docs/alpha.md)?!
@@ -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 };
package/build/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HotMesh = exports.Durable = void 0;
4
+ const durable_1 = require("./services/durable");
5
+ Object.defineProperty(exports, "Durable", { enumerable: true, get: function () { return durable_1.Durable; } });
6
+ const hotmesh_1 = require("./services/hotmesh");
7
+ Object.defineProperty(exports, "HotMesh", { enumerable: true, get: function () { return hotmesh_1.HotMeshService; } });
@@ -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,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecActivityError = exports.RegisterTimeoutError = exports.MapDataError = exports.SetStateError = exports.GetStateError = exports.DuplicateJobError = exports.CollationError = void 0;
4
+ class GetStateError extends Error {
5
+ constructor() {
6
+ super("Error occurred while getting job state");
7
+ }
8
+ }
9
+ exports.GetStateError = GetStateError;
10
+ class SetStateError extends Error {
11
+ constructor() {
12
+ super("Error occurred while setting job state");
13
+ }
14
+ }
15
+ exports.SetStateError = SetStateError;
16
+ class MapDataError extends Error {
17
+ constructor() {
18
+ super("Error occurred while mapping data");
19
+ }
20
+ }
21
+ exports.MapDataError = MapDataError;
22
+ class RegisterTimeoutError extends Error {
23
+ constructor() {
24
+ super("Error occurred while registering activity timeout");
25
+ }
26
+ }
27
+ exports.RegisterTimeoutError = RegisterTimeoutError;
28
+ class DuplicateJobError extends Error {
29
+ constructor(jobId) {
30
+ super("Duplicate job");
31
+ this.message = `Duplicate job: ${jobId}`;
32
+ }
33
+ }
34
+ exports.DuplicateJobError = DuplicateJobError;
35
+ class ExecActivityError extends Error {
36
+ constructor() {
37
+ super("Error occurred while executing activity");
38
+ }
39
+ }
40
+ exports.ExecActivityError = ExecActivityError;
41
+ class CollationError extends Error {
42
+ constructor(status, leg, stage, fault) {
43
+ super("collation-error");
44
+ this.leg = leg;
45
+ this.status = status;
46
+ this.stage = stage;
47
+ this.fault = fault;
48
+ }
49
+ }
50
+ exports.CollationError = CollationError;
@@ -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 };