@hotmeshio/hotmesh 0.3.32 → 0.4.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 (207) hide show
  1. package/README.md +128 -823
  2. package/build/index.d.ts +9 -9
  3. package/build/index.js +10 -10
  4. package/build/modules/enums.d.ts +23 -23
  5. package/build/modules/enums.js +26 -26
  6. package/build/modules/errors.d.ts +16 -16
  7. package/build/modules/errors.js +28 -28
  8. package/build/modules/key.js +190 -1
  9. package/build/modules/utils.js +374 -1
  10. package/build/package.json +22 -21
  11. package/build/services/activities/activity.js +549 -1
  12. package/build/services/activities/await.js +114 -1
  13. package/build/services/activities/cycle.js +112 -1
  14. package/build/services/activities/hook.js +168 -1
  15. package/build/services/activities/index.js +20 -1
  16. package/build/services/activities/interrupt.js +158 -1
  17. package/build/services/activities/signal.js +134 -1
  18. package/build/services/activities/trigger.js +246 -1
  19. package/build/services/activities/worker.js +106 -1
  20. package/build/services/collator/index.js +293 -1
  21. package/build/services/compiler/deployer.js +488 -1
  22. package/build/services/compiler/index.js +112 -1
  23. package/build/services/compiler/validator.js +147 -1
  24. package/build/services/engine/index.js +761 -1
  25. package/build/services/exporter/index.js +126 -1
  26. package/build/services/hotmesh/index.d.ts +160 -17
  27. package/build/services/hotmesh/index.js +160 -17
  28. package/build/services/mapper/index.js +81 -1
  29. package/build/services/{meshflow → memflow}/client.d.ts +3 -3
  30. package/build/services/{meshflow → memflow}/client.js +17 -16
  31. package/build/services/{meshflow → memflow}/connection.d.ts +2 -2
  32. package/build/services/{meshflow → memflow}/connection.js +1 -1
  33. package/build/services/memflow/context.d.ts +143 -0
  34. package/build/services/memflow/context.js +299 -0
  35. package/build/services/{meshflow → memflow}/exporter.d.ts +6 -6
  36. package/build/services/memflow/exporter.js +215 -0
  37. package/build/services/{meshflow → memflow}/handle.d.ts +4 -4
  38. package/build/services/{meshflow → memflow}/handle.js +2 -2
  39. package/build/services/{meshflow → memflow}/index.d.ts +18 -13
  40. package/build/services/{meshflow → memflow}/index.js +26 -21
  41. package/build/services/{meshflow → memflow}/schemas/factory.d.ts +4 -4
  42. package/build/services/{meshflow → memflow}/schemas/factory.js +5 -5
  43. package/build/services/{meshflow → memflow}/search.d.ts +1 -1
  44. package/build/services/{meshflow → memflow}/search.js +4 -4
  45. package/build/services/{meshflow → memflow}/worker.d.ts +5 -5
  46. package/build/services/{meshflow → memflow}/worker.js +24 -24
  47. package/build/services/memflow/workflow/common.d.ts +20 -0
  48. package/build/services/memflow/workflow/common.js +47 -0
  49. package/build/services/memflow/workflow/contextMethods.d.ts +14 -0
  50. package/build/services/memflow/workflow/contextMethods.js +33 -0
  51. package/build/services/{meshflow → memflow}/workflow/execChild.js +12 -12
  52. package/build/services/memflow/workflow/execHook.d.ts +65 -0
  53. package/build/services/memflow/workflow/execHook.js +73 -0
  54. package/build/services/{meshflow → memflow}/workflow/hook.js +19 -3
  55. package/build/services/{meshflow → memflow}/workflow/index.d.ts +7 -3
  56. package/build/services/{meshflow → memflow}/workflow/index.js +7 -3
  57. package/build/services/{meshflow → memflow}/workflow/proxyActivities.d.ts +2 -2
  58. package/build/services/{meshflow → memflow}/workflow/proxyActivities.js +8 -8
  59. package/build/services/{meshflow → memflow}/workflow/sleepFor.js +2 -2
  60. package/build/services/{meshflow → memflow}/workflow/waitFor.js +2 -2
  61. package/build/services/meshdata/index.d.ts +24 -24
  62. package/build/services/meshdata/index.js +40 -40
  63. package/build/services/pipe/functions/array.js +74 -1
  64. package/build/services/pipe/functions/bitwise.js +24 -1
  65. package/build/services/pipe/functions/conditional.js +36 -1
  66. package/build/services/pipe/functions/cron.js +40 -1
  67. package/build/services/pipe/functions/date.js +171 -1
  68. package/build/services/pipe/functions/index.js +30 -1
  69. package/build/services/pipe/functions/json.js +12 -1
  70. package/build/services/pipe/functions/logical.js +12 -1
  71. package/build/services/pipe/functions/math.js +184 -1
  72. package/build/services/pipe/functions/number.js +60 -1
  73. package/build/services/pipe/functions/object.js +81 -1
  74. package/build/services/pipe/functions/string.js +69 -1
  75. package/build/services/pipe/functions/symbol.js +33 -1
  76. package/build/services/pipe/functions/unary.js +18 -1
  77. package/build/services/pipe/index.js +242 -1
  78. package/build/services/quorum/index.js +263 -1
  79. package/build/services/reporter/index.js +348 -1
  80. package/build/services/router/config/index.d.ts +11 -0
  81. package/build/services/router/config/index.js +36 -0
  82. package/build/services/router/consumption/index.d.ts +34 -0
  83. package/build/services/router/consumption/index.js +395 -0
  84. package/build/services/router/error-handling/index.d.ts +8 -0
  85. package/build/services/router/error-handling/index.js +98 -0
  86. package/build/services/router/index.d.ts +13 -16
  87. package/build/services/router/index.js +121 -1
  88. package/build/services/router/lifecycle/index.d.ts +27 -0
  89. package/build/services/router/lifecycle/index.js +80 -0
  90. package/build/services/router/telemetry/index.d.ts +11 -0
  91. package/build/services/router/telemetry/index.js +32 -0
  92. package/build/services/router/throttling/index.d.ts +23 -0
  93. package/build/services/router/throttling/index.js +76 -0
  94. package/build/services/search/index.d.ts +2 -1
  95. package/build/services/search/providers/postgres/postgres.d.ts +2 -1
  96. package/build/services/search/providers/postgres/postgres.js +149 -1
  97. package/build/services/search/providers/redis/ioredis.d.ts +1 -0
  98. package/build/services/search/providers/redis/ioredis.js +121 -1
  99. package/build/services/search/providers/redis/redis.d.ts +1 -0
  100. package/build/services/search/providers/redis/redis.js +134 -1
  101. package/build/services/serializer/index.js +282 -1
  102. package/build/services/store/providers/postgres/kvsql.d.ts +1 -1
  103. package/build/services/store/providers/postgres/kvsql.js +198 -1
  104. package/build/services/store/providers/postgres/kvtables.js +441 -1
  105. package/build/services/store/providers/postgres/kvtransaction.js +248 -1
  106. package/build/services/store/providers/postgres/kvtypes/hash.d.ts +1 -1
  107. package/build/services/store/providers/postgres/kvtypes/hash.js +1287 -1
  108. package/build/services/store/providers/postgres/kvtypes/list.js +194 -1
  109. package/build/services/store/providers/postgres/kvtypes/string.js +115 -1
  110. package/build/services/store/providers/postgres/kvtypes/zset.js +214 -1
  111. package/build/services/store/providers/postgres/postgres.js +1036 -1
  112. package/build/services/store/providers/redis/_base.js +980 -1
  113. package/build/services/store/providers/redis/ioredis.js +180 -1
  114. package/build/services/store/providers/redis/redis.js +199 -1
  115. package/build/services/store/providers/store-initializable.js +2 -1
  116. package/build/services/stream/index.d.ts +5 -0
  117. package/build/services/stream/providers/nats/nats.d.ts +1 -0
  118. package/build/services/stream/providers/nats/nats.js +225 -1
  119. package/build/services/stream/providers/postgres/kvtables.d.ts +1 -0
  120. package/build/services/stream/providers/postgres/kvtables.js +146 -1
  121. package/build/services/stream/providers/postgres/postgres.d.ts +19 -0
  122. package/build/services/stream/providers/postgres/postgres.js +519 -1
  123. package/build/services/stream/providers/redis/ioredis.d.ts +1 -0
  124. package/build/services/stream/providers/redis/ioredis.js +272 -1
  125. package/build/services/stream/providers/redis/redis.d.ts +1 -0
  126. package/build/services/stream/providers/redis/redis.js +305 -1
  127. package/build/services/stream/providers/stream-initializable.js +2 -1
  128. package/build/services/sub/providers/nats/nats.js +105 -1
  129. package/build/services/sub/providers/postgres/postgres.js +92 -1
  130. package/build/services/sub/providers/redis/ioredis.js +81 -1
  131. package/build/services/sub/providers/redis/redis.js +72 -1
  132. package/build/services/task/index.js +206 -1
  133. package/build/services/telemetry/index.js +306 -1
  134. package/build/services/worker/index.js +197 -1
  135. package/build/types/error.d.ts +5 -5
  136. package/build/types/exporter.d.ts +1 -1
  137. package/build/types/index.d.ts +3 -3
  138. package/build/types/manifest.d.ts +2 -2
  139. package/build/types/{meshflow.d.ts → memflow.d.ts} +15 -15
  140. package/build/types/meshdata.d.ts +3 -3
  141. package/build/types/postgres.d.ts +7 -0
  142. package/build/types/stream.d.ts +3 -0
  143. package/index.ts +11 -11
  144. package/package.json +22 -21
  145. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  146. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  147. package/build/services/meshflow/exporter.js +0 -1
  148. package/build/services/meshflow/workflow/common.d.ts +0 -18
  149. package/build/services/meshflow/workflow/common.js +0 -45
  150. package/typedoc.json +0 -46
  151. package/types/activity.ts +0 -268
  152. package/types/app.ts +0 -20
  153. package/types/async.ts +0 -6
  154. package/types/cache.ts +0 -1
  155. package/types/collator.ts +0 -9
  156. package/types/error.ts +0 -56
  157. package/types/exporter.ts +0 -102
  158. package/types/hook.ts +0 -44
  159. package/types/hotmesh.ts +0 -314
  160. package/types/index.ts +0 -306
  161. package/types/job.ts +0 -233
  162. package/types/logger.ts +0 -8
  163. package/types/manifest.ts +0 -70
  164. package/types/map.ts +0 -5
  165. package/types/meshcall.ts +0 -235
  166. package/types/meshdata.ts +0 -278
  167. package/types/meshflow.ts +0 -645
  168. package/types/ms.d.ts +0 -7
  169. package/types/nats.ts +0 -270
  170. package/types/pipe.ts +0 -90
  171. package/types/postgres.ts +0 -105
  172. package/types/provider.ts +0 -161
  173. package/types/quorum.ts +0 -167
  174. package/types/redis.ts +0 -404
  175. package/types/serializer.ts +0 -40
  176. package/types/stats.ts +0 -117
  177. package/types/stream.ts +0 -227
  178. package/types/task.ts +0 -7
  179. package/types/telemetry.ts +0 -16
  180. package/types/transition.ts +0 -20
  181. /package/build/services/{meshflow → memflow}/workflow/all.d.ts +0 -0
  182. /package/build/services/{meshflow → memflow}/workflow/all.js +0 -0
  183. /package/build/services/{meshflow → memflow}/workflow/context.d.ts +0 -0
  184. /package/build/services/{meshflow → memflow}/workflow/context.js +0 -0
  185. /package/build/services/{meshflow → memflow}/workflow/didRun.d.ts +0 -0
  186. /package/build/services/{meshflow → memflow}/workflow/didRun.js +0 -0
  187. /package/build/services/{meshflow → memflow}/workflow/emit.d.ts +0 -0
  188. /package/build/services/{meshflow → memflow}/workflow/emit.js +0 -0
  189. /package/build/services/{meshflow → memflow}/workflow/enrich.d.ts +0 -0
  190. /package/build/services/{meshflow → memflow}/workflow/enrich.js +0 -0
  191. /package/build/services/{meshflow → memflow}/workflow/execChild.d.ts +0 -0
  192. /package/build/services/{meshflow → memflow}/workflow/hook.d.ts +0 -0
  193. /package/build/services/{meshflow → memflow}/workflow/interrupt.d.ts +0 -0
  194. /package/build/services/{meshflow → memflow}/workflow/interrupt.js +0 -0
  195. /package/build/services/{meshflow → memflow}/workflow/isSideEffectAllowed.d.ts +0 -0
  196. /package/build/services/{meshflow → memflow}/workflow/isSideEffectAllowed.js +0 -0
  197. /package/build/services/{meshflow → memflow}/workflow/random.d.ts +0 -0
  198. /package/build/services/{meshflow → memflow}/workflow/random.js +0 -0
  199. /package/build/services/{meshflow → memflow}/workflow/searchMethods.d.ts +0 -0
  200. /package/build/services/{meshflow → memflow}/workflow/searchMethods.js +0 -0
  201. /package/build/services/{meshflow → memflow}/workflow/signal.d.ts +0 -0
  202. /package/build/services/{meshflow → memflow}/workflow/signal.js +0 -0
  203. /package/build/services/{meshflow → memflow}/workflow/sleepFor.d.ts +0 -0
  204. /package/build/services/{meshflow → memflow}/workflow/trace.d.ts +0 -0
  205. /package/build/services/{meshflow → memflow}/workflow/trace.js +0 -0
  206. /package/build/services/{meshflow → memflow}/workflow/waitFor.d.ts +0 -0
  207. /package/build/types/{meshflow.js → memflow.js} +0 -0
@@ -1 +1,147 @@
1
- 'use strict';const j=b;(function(c,d){const i=b,e=c();while(!![]){try{const f=parseInt(i(0x1ef))/0x1+parseInt(i(0x1cd))/0x2+-parseInt(i(0x1d5))/0x3*(-parseInt(i(0x1d7))/0x4)+parseInt(i(0x1f6))/0x5+-parseInt(i(0x203))/0x6*(-parseInt(i(0x1df))/0x7)+-parseInt(i(0x1d0))/0x8+-parseInt(i(0x1f1))/0x9;if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x3aded));function a(){const x=['8079912GBzMzJ','forEach','{$index}','validateTransitionConditions','Duplicate\x20activity\x20id\x20found:\x20','929065niqlKY','activities','getMappingStatements','$self','extractMappingStatements','split','Mapping\x20statement\x20references\x20non-existent\x20activity:\x20','add','SYS_VARS','isMappingStatement','startsWith','{$item}','Validator','2562qNjKKE','manifest','$job','836978BJLqfX','validateTransitions','validateReferencedActivityIds','3731584aPGheV','includes','__esModule','validateActivityIds','isContextVariable','285VAakxT','{$output}','13636QqnYtc','validateConditionalStatements','resolveFunction','store','app','object','{$input}','$graph','5019KRfsao','isFunction','has','validateSchemas','validateGraphPublishSubscribe','../pipe','validateUniqueHandledTopics','Pipe','$app','validate','string','CONTEXT_VARS','validateStats','activityIds','validateMappingStatements','from','371033RzSWGd','graphs'];a=function(){return x;};return a();}Object['defineProperty'](exports,j(0x1d2),{'value':!0x0}),exports[j(0x202)]=void 0x0;const pipe_1=require(j(0x1e4));function b(c,d){const e=a();return b=function(f,g){f=f-0x1cd;let h=e[f];return h;},b(c,d);}class Validator{constructor(c){const k=j;this['manifest']=null,this['activityIds']=[],this['mappingStatements']={},this[k(0x1da)]=null,this[k(0x204)]=c;}async[j(0x1e8)](c){const l=j;this['store']=c,this[l(0x1f8)](),this[l(0x1d3)](),this[l(0x1cf)](),this[l(0x1ed)](),this[l(0x1ce)](),this[l(0x1f4)](),this[l(0x1eb)](),this[l(0x1e2)](),this[l(0x1e5)](),this[l(0x1e3)](),this['validateHooks'](),this[l(0x1d8)]();}[j(0x1d3)](){const m=j,c=new Set();this[m(0x204)][m(0x1db)]['graphs']['forEach'](d=>{const n=m;Object['keys'](d[n(0x1f7)])['forEach'](e=>{const o=n;if(c[o(0x1e1)](e))throw new Error(o(0x1f5)+e);c[o(0x1fd)](e);});}),this[m(0x1ec)]=Array[m(0x1ee)](c);}[j(0x1ff)](c){const p=j;return p(0x1e9)==typeof c&&c[p(0x200)]('{')&&c['endsWith']('}');}[j(0x1fa)](c,d,f){const q=j;for(const g in c)q(0x1dc)==typeof c[g]&&null!==c[g]?this['extractMappingStatements'](c[g],d,f):this['isMappingStatement'](c[g])&&(d[f]||(d[f]=[]),d[f]['push'](c[g]));}['getMappingStatements'](){const r=j,c={};this[r(0x204)][r(0x1db)][r(0x1f0)]['forEach'](d=>{const s=r,f=d[s(0x1f7)];for(const g in f){const h=f[g];this[s(0x1fa)](h,c,g);}}),this['mappingStatements']=c;}['validateReferencedActivityIds'](){const t=j,c=this['mappingStatements'],d=this[t(0x1ec)];for(const e in c){c[e][t(0x1f2)](f=>{const u=t;if(f[u(0x200)]('{')&&f['endsWith']('}')){const g=f['slice'](0x1,-0x1)[u(0x1fb)]('.')[0x0];if(!(Validator[u(0x1fe)][u(0x1d1)](g)||d[u(0x1d1)](g)||this[u(0x1e0)](f)||this[u(0x1d4)](f)))throw new Error(u(0x1fc)+f);}});}}[j(0x1e0)](c){const v=j;return c['startsWith']('{@')&&pipe_1[v(0x1e6)][v(0x1d9)](c);}[j(0x1d4)](c){const w=j;return[w(0x1dd),w(0x1d6),'{$item}','{$key}',w(0x1f3)][w(0x1d1)](c);}[j(0x1ed)](){}[j(0x1ce)](){}['validateTransitionConditions'](){}[j(0x1eb)](){}[j(0x1e2)](){}[j(0x1e5)](){}[j(0x1e3)](){}['validateHooks'](){}[j(0x1d8)](){}}exports[j(0x202)]=Validator,Validator[j(0x1fe)]=[j(0x1e7),j(0x1f9),j(0x1de),j(0x205)],Validator[j(0x1ea)]=[j(0x1dd),j(0x1d6),j(0x201),'{$key}',j(0x1f3)];
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Validator = void 0;
4
+ const pipe_1 = require("../pipe");
5
+ class Validator {
6
+ constructor(manifest) {
7
+ this.manifest = null;
8
+ this.activityIds = [];
9
+ this.mappingStatements = {};
10
+ this.store = null;
11
+ this.manifest = manifest;
12
+ }
13
+ /**
14
+ * validate the manifest file
15
+ */
16
+ async validate(store) {
17
+ this.store = store;
18
+ this.getMappingStatements();
19
+ this.validateActivityIds();
20
+ this.validateReferencedActivityIds();
21
+ this.validateMappingStatements();
22
+ this.validateTransitions();
23
+ this.validateTransitionConditions();
24
+ this.validateStats();
25
+ this.validateSchemas();
26
+ this.validateUniqueHandledTopics();
27
+ this.validateGraphPublishSubscribe();
28
+ this.validateHooks();
29
+ this.validateConditionalStatements();
30
+ }
31
+ // 1.1) Validate the manifest file activity ids are unique (no duplicates)
32
+ validateActivityIds() {
33
+ const activityIdsSet = new Set();
34
+ this.manifest.app.graphs.forEach((graph) => {
35
+ const ids = Object.keys(graph.activities);
36
+ // Check for duplicates and add ids to the set
37
+ ids.forEach((id) => {
38
+ if (activityIdsSet.has(id)) {
39
+ throw new Error(`Duplicate activity id found: ${id}`);
40
+ }
41
+ else {
42
+ activityIdsSet.add(id);
43
+ }
44
+ });
45
+ });
46
+ this.activityIds = Array.from(activityIdsSet);
47
+ }
48
+ isMappingStatement(value) {
49
+ return (typeof value === 'string' && value.startsWith('{') && value.endsWith('}'));
50
+ }
51
+ extractMappingStatements(obj, result, currentActivityId) {
52
+ for (const key in obj) {
53
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
54
+ this.extractMappingStatements(obj[key], result, currentActivityId);
55
+ }
56
+ else if (this.isMappingStatement(obj[key])) {
57
+ if (!result[currentActivityId]) {
58
+ result[currentActivityId] = [];
59
+ }
60
+ result[currentActivityId].push(obj[key]);
61
+ }
62
+ }
63
+ }
64
+ getMappingStatements() {
65
+ const mappingStatements = {};
66
+ this.manifest.app.graphs.forEach((graph) => {
67
+ const activities = graph.activities;
68
+ for (const activityId in activities) {
69
+ const activity = activities[activityId];
70
+ this.extractMappingStatements(activity, mappingStatements, activityId);
71
+ }
72
+ });
73
+ this.mappingStatements = mappingStatements;
74
+ }
75
+ // 1.2) Validate no activity ids are referenced that don't exist
76
+ validateReferencedActivityIds() {
77
+ // get list of all mapping statements and validate
78
+ const mappingStatements = this.mappingStatements;
79
+ const activityIds = this.activityIds;
80
+ for (const activity in mappingStatements) {
81
+ const statements = mappingStatements[activity];
82
+ statements.forEach((statement) => {
83
+ if (statement.startsWith('{') && statement.endsWith('}')) {
84
+ const statementParts = statement.slice(1, -1).split('.');
85
+ const referencedActivityId = statementParts[0];
86
+ if (!(Validator.SYS_VARS.includes(referencedActivityId) ||
87
+ activityIds.includes(referencedActivityId) ||
88
+ this.isFunction(statement) ||
89
+ this.isContextVariable(statement))) {
90
+ throw new Error(`Mapping statement references non-existent activity: ${statement}`);
91
+ }
92
+ }
93
+ });
94
+ }
95
+ }
96
+ isFunction(value) {
97
+ return value.startsWith('{@') && pipe_1.Pipe.resolveFunction(value);
98
+ }
99
+ isContextVariable(value) {
100
+ return ['{$input}', '{$output}', '{$item}', '{$key}', '{$index}'].includes(value);
101
+ }
102
+ // 1.3) Validate the mapping/@pipe statements are valid
103
+ validateMappingStatements() {
104
+ // Implement the method content
105
+ }
106
+ // 1.4) Validate the transitions are valid
107
+ validateTransitions() {
108
+ // Implement the method content
109
+ }
110
+ // 1.5) Validate the transition conditions are valid
111
+ validateTransitionConditions() {
112
+ // Implement the method content
113
+ }
114
+ // 1.6) Validate the stats
115
+ validateStats() {
116
+ // Implement the method content
117
+ }
118
+ // 1.7) Validate the schemas
119
+ validateSchemas() {
120
+ // Implement the method content
121
+ }
122
+ // 1.8) Validate the topics are unique and handled
123
+ validateUniqueHandledTopics() {
124
+ // Implement the method content
125
+ }
126
+ // 1.9) Validate that every graph has publishes and subscribes
127
+ validateGraphPublishSubscribe() {
128
+ // Implement the method content
129
+ }
130
+ // 1.10) Validate hooks, including mapping statements
131
+ validateHooks() {
132
+ // Implement the method content
133
+ }
134
+ // 1.11) Validate conditional statements
135
+ validateConditionalStatements() {
136
+ // Implement the method content
137
+ }
138
+ }
139
+ exports.Validator = Validator;
140
+ Validator.SYS_VARS = ['$app', '$self', '$graph', '$job'];
141
+ Validator.CONTEXT_VARS = [
142
+ '{$input}',
143
+ '{$output}',
144
+ '{$item}',
145
+ '{$key}',
146
+ '{$index}',
147
+ ];