@hotmeshio/hotmesh 0.3.5 → 0.3.7

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 (132) hide show
  1. package/build/index.d.ts +6 -4
  2. package/build/index.js +13 -5
  3. package/build/modules/key.js +1 -62
  4. package/build/modules/utils.d.ts +1 -0
  5. package/build/modules/utils.js +1 -242
  6. package/build/package.json +14 -9
  7. package/build/services/activities/activity.js +1 -495
  8. package/build/services/activities/await.js +1 -109
  9. package/build/services/activities/cycle.js +1 -96
  10. package/build/services/activities/hook.js +1 -154
  11. package/build/services/activities/index.js +1 -20
  12. package/build/services/activities/interrupt.js +1 -149
  13. package/build/services/activities/signal.js +1 -118
  14. package/build/services/activities/trigger.d.ts +0 -1
  15. package/build/services/activities/trigger.js +1 -269
  16. package/build/services/activities/worker.js +1 -101
  17. package/build/services/collator/index.js +1 -197
  18. package/build/services/compiler/deployer.d.ts +3 -1
  19. package/build/services/compiler/deployer.js +1 -455
  20. package/build/services/compiler/index.d.ts +3 -1
  21. package/build/services/compiler/index.js +1 -91
  22. package/build/services/compiler/validator.js +1 -122
  23. package/build/services/engine/index.d.ts +5 -2
  24. package/build/services/engine/index.js +1 -583
  25. package/build/services/exporter/index.js +1 -93
  26. package/build/services/mapper/index.js +1 -67
  27. package/build/services/meshdata/index.d.ts +0 -1
  28. package/build/services/meshdata/index.js +16 -24
  29. package/build/services/meshflow/client.js +4 -8
  30. package/build/services/meshflow/exporter.js +1 -186
  31. package/build/services/meshflow/search.d.ts +4 -5
  32. package/build/services/meshflow/search.js +48 -36
  33. package/build/services/meshflow/worker.js +1 -1
  34. package/build/services/meshflow/workflow.d.ts +1 -1
  35. package/build/services/meshflow/workflow.js +5 -30
  36. package/build/services/meshos/index.d.ts +81 -0
  37. package/build/services/meshos/index.js +339 -0
  38. package/build/services/pipe/functions/array.js +1 -74
  39. package/build/services/pipe/functions/bitwise.js +1 -24
  40. package/build/services/pipe/functions/conditional.js +1 -36
  41. package/build/services/pipe/functions/cron.js +1 -32
  42. package/build/services/pipe/functions/date.js +1 -164
  43. package/build/services/pipe/functions/index.js +1 -30
  44. package/build/services/pipe/functions/json.js +1 -12
  45. package/build/services/pipe/functions/logical.js +1 -12
  46. package/build/services/pipe/functions/math.js +1 -182
  47. package/build/services/pipe/functions/number.js +1 -60
  48. package/build/services/pipe/functions/object.js +1 -81
  49. package/build/services/pipe/functions/string.js +1 -69
  50. package/build/services/pipe/functions/symbol.js +1 -33
  51. package/build/services/pipe/functions/unary.js +1 -18
  52. package/build/services/pipe/index.js +1 -221
  53. package/build/services/quorum/index.d.ts +1 -1
  54. package/build/services/quorum/index.js +1 -233
  55. package/build/services/reporter/index.js +1 -331
  56. package/build/services/router/index.js +1 -420
  57. package/build/services/search/factory.d.ts +7 -0
  58. package/build/services/search/factory.js +20 -0
  59. package/build/services/search/index.d.ts +21 -0
  60. package/build/services/search/index.js +10 -0
  61. package/build/services/search/providers/redis/ioredis.d.ts +18 -0
  62. package/build/services/search/providers/redis/ioredis.js +1 -0
  63. package/build/services/search/providers/redis/redis.d.ts +18 -0
  64. package/build/services/search/providers/redis/redis.js +1 -0
  65. package/build/services/serializer/index.js +1 -265
  66. package/build/services/store/factory.d.ts +8 -0
  67. package/build/services/store/factory.js +20 -0
  68. package/build/services/store/index.d.ts +71 -98
  69. package/build/services/store/index.js +2 -941
  70. package/build/services/store/providers/postgres/postgres.d.ts +0 -0
  71. package/build/services/store/providers/postgres/postgres.js +0 -0
  72. package/build/services/store/providers/postgres/types/hash.d.ts +0 -0
  73. package/build/services/store/providers/postgres/types/hash.js +0 -0
  74. package/build/services/store/providers/postgres/types/list.d.ts +0 -0
  75. package/build/services/store/providers/postgres/types/list.js +0 -0
  76. package/build/services/store/providers/postgres/types/string.d.ts +0 -0
  77. package/build/services/store/providers/postgres/types/string.js +0 -0
  78. package/build/services/store/providers/postgres/types/zset.d.ts +0 -0
  79. package/build/services/store/providers/postgres/types/zset.js +0 -0
  80. package/build/services/store/providers/redis/_base.d.ts +98 -0
  81. package/build/services/store/providers/redis/_base.js +1 -0
  82. package/build/services/store/providers/redis/ioredis.d.ts +12 -0
  83. package/build/services/store/providers/redis/ioredis.js +1 -0
  84. package/build/services/store/providers/redis/redis.d.ts +13 -0
  85. package/build/services/store/providers/redis/redis.js +1 -0
  86. package/build/services/store/providers/store-initializable.d.ts +5 -0
  87. package/build/services/store/providers/store-initializable.js +1 -0
  88. package/build/services/stream/factory.d.ts +8 -0
  89. package/build/services/stream/factory.js +20 -0
  90. package/build/services/stream/index.d.ts +13 -14
  91. package/build/services/stream/index.js +3 -2
  92. package/build/services/stream/providers/postgres/_deploy.d.ts +4 -0
  93. package/build/services/stream/providers/postgres/_deploy.js +1 -0
  94. package/build/services/stream/providers/redis/ioredis.d.ts +21 -0
  95. package/build/services/stream/providers/redis/ioredis.js +1 -0
  96. package/build/services/stream/providers/redis/redis.d.ts +21 -0
  97. package/build/services/stream/providers/redis/redis.js +1 -0
  98. package/build/services/stream/providers/stream-initializable.d.ts +5 -0
  99. package/build/services/stream/providers/stream-initializable.js +1 -0
  100. package/build/services/sub/factory.d.ts +7 -0
  101. package/build/services/sub/factory.js +20 -0
  102. package/build/services/sub/index.d.ts +9 -7
  103. package/build/services/sub/index.js +3 -2
  104. package/build/services/sub/{clients → providers/redis}/ioredis.d.ts +7 -10
  105. package/build/services/sub/providers/redis/ioredis.js +1 -0
  106. package/build/services/sub/{clients → providers/redis}/redis.d.ts +7 -10
  107. package/build/services/sub/providers/redis/redis.js +1 -0
  108. package/build/services/task/index.js +1 -171
  109. package/build/services/telemetry/index.js +1 -225
  110. package/build/services/worker/index.d.ts +2 -2
  111. package/build/services/worker/index.js +1 -179
  112. package/build/types/index.d.ts +1 -0
  113. package/build/types/manifest.d.ts +49 -0
  114. package/build/types/manifest.js +2 -0
  115. package/build/types/redis.d.ts +5 -5
  116. package/index.ts +19 -4
  117. package/package.json +14 -9
  118. package/typedoc.json +1 -0
  119. package/types/index.ts +15 -0
  120. package/types/manifest.ts +68 -0
  121. package/types/meshflow.ts +1 -1
  122. package/types/redis.ts +5 -5
  123. package/build/services/store/clients/ioredis.d.ts +0 -30
  124. package/build/services/store/clients/ioredis.js +0 -220
  125. package/build/services/store/clients/redis.d.ts +0 -32
  126. package/build/services/store/clients/redis.js +0 -319
  127. package/build/services/stream/clients/ioredis.d.ts +0 -24
  128. package/build/services/stream/clients/ioredis.js +0 -121
  129. package/build/services/stream/clients/redis.d.ts +0 -24
  130. package/build/services/stream/clients/redis.js +0 -161
  131. package/build/services/sub/clients/ioredis.js +0 -72
  132. package/build/services/sub/clients/redis.js +0 -63
@@ -1,122 +1 @@
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
- async validate(store) {
14
- this.store = store;
15
- this.getMappingStatements();
16
- this.validateActivityIds();
17
- this.validateReferencedActivityIds();
18
- this.validateMappingStatements();
19
- this.validateTransitions();
20
- this.validateTransitionConditions();
21
- this.validateStats();
22
- this.validateSchemas();
23
- this.validateUniqueHandledTopics();
24
- this.validateGraphPublishSubscribe();
25
- this.validateHooks();
26
- this.validateConditionalStatements();
27
- }
28
- validateActivityIds() {
29
- const activityIdsSet = new Set();
30
- this.manifest.app.graphs.forEach((graph) => {
31
- const ids = Object.keys(graph.activities);
32
- ids.forEach((id) => {
33
- if (activityIdsSet.has(id)) {
34
- throw new Error(`Duplicate activity id found: ${id}`);
35
- }
36
- else {
37
- activityIdsSet.add(id);
38
- }
39
- });
40
- });
41
- this.activityIds = Array.from(activityIdsSet);
42
- }
43
- isMappingStatement(value) {
44
- return (typeof value === 'string' && value.startsWith('{') && value.endsWith('}'));
45
- }
46
- extractMappingStatements(obj, result, currentActivityId) {
47
- for (const key in obj) {
48
- if (typeof obj[key] === 'object' && obj[key] !== null) {
49
- this.extractMappingStatements(obj[key], result, currentActivityId);
50
- }
51
- else if (this.isMappingStatement(obj[key])) {
52
- if (!result[currentActivityId]) {
53
- result[currentActivityId] = [];
54
- }
55
- result[currentActivityId].push(obj[key]);
56
- }
57
- }
58
- }
59
- getMappingStatements() {
60
- const mappingStatements = {};
61
- this.manifest.app.graphs.forEach((graph) => {
62
- const activities = graph.activities;
63
- for (const activityId in activities) {
64
- const activity = activities[activityId];
65
- this.extractMappingStatements(activity, mappingStatements, activityId);
66
- }
67
- });
68
- this.mappingStatements = mappingStatements;
69
- }
70
- validateReferencedActivityIds() {
71
- const mappingStatements = this.mappingStatements;
72
- const activityIds = this.activityIds;
73
- for (const activity in mappingStatements) {
74
- const statements = mappingStatements[activity];
75
- statements.forEach((statement) => {
76
- if (statement.startsWith('{') && statement.endsWith('}')) {
77
- const statementParts = statement.slice(1, -1).split('.');
78
- const referencedActivityId = statementParts[0];
79
- if (!(Validator.SYS_VARS.includes(referencedActivityId) ||
80
- activityIds.includes(referencedActivityId) ||
81
- this.isFunction(statement) ||
82
- this.isContextVariable(statement))) {
83
- throw new Error(`Mapping statement references non-existent activity: ${statement}`);
84
- }
85
- }
86
- });
87
- }
88
- }
89
- isFunction(value) {
90
- return value.startsWith('{@') && pipe_1.Pipe.resolveFunction(value);
91
- }
92
- isContextVariable(value) {
93
- return ['{$input}', '{$output}', '{$item}', '{$key}', '{$index}'].includes(value);
94
- }
95
- validateMappingStatements() {
96
- }
97
- validateTransitions() {
98
- }
99
- validateTransitionConditions() {
100
- }
101
- validateStats() {
102
- }
103
- validateSchemas() {
104
- }
105
- validateUniqueHandledTopics() {
106
- }
107
- validateGraphPublishSubscribe() {
108
- }
109
- validateHooks() {
110
- }
111
- validateConditionalStatements() {
112
- }
113
- }
114
- exports.Validator = Validator;
115
- Validator.SYS_VARS = ['$app', '$self', '$graph', '$job'];
116
- Validator.CONTEXT_VARS = [
117
- '{$input}',
118
- '{$output}',
119
- '{$item}',
120
- '{$key}',
121
- '{$index}',
122
- ];
1
+ 'use strict';function _0x1228(_0x196f04,_0x2026c0){const _0x34a1f4=_0x34a1();return _0x1228=function(_0x1228a6,_0x3a685d){_0x1228a6=_0x1228a6-0x8b;let _0x1dd612=_0x34a1f4[_0x1228a6];return _0x1dd612;},_0x1228(_0x196f04,_0x2026c0);}(function(_0x55267c,_0xa09a3a){const _0x143fbe=_0x1228,_0x1c06bf=_0x55267c();while(!![]){try{const _0x2ad2ef=parseInt(_0x143fbe(0x93))/0x1+parseInt(_0x143fbe(0x8d))/0x2*(-parseInt(_0x143fbe(0x94))/0x3)+parseInt(_0x143fbe(0x8c))/0x4+parseInt(_0x143fbe(0x8e))/0x5+parseInt(_0x143fbe(0x91))/0x6*(-parseInt(_0x143fbe(0x8f))/0x7)+-parseInt(_0x143fbe(0x8b))/0x8+parseInt(_0x143fbe(0x90))/0x9*(parseInt(_0x143fbe(0x92))/0xa);if(_0x2ad2ef===_0xa09a3a)break;else _0x1c06bf['push'](_0x1c06bf['shift']());}catch(_0x2f912f){_0x1c06bf['push'](_0x1c06bf['shift']());}}}(_0x34a1,0xc96c1));Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['Validator']=void 0x0;const pipe_1=require('../pipe');class Validator{constructor(_0x4184b7){this['manifest']=null,this['activityIds']=[],this['mappingStatements']={},this['store']=null,this['manifest']=_0x4184b7;}async['validate'](_0xd0081f){this['store']=_0xd0081f,this['getMappingStatements'](),this['validateActivityIds'](),this['validateReferencedActivityIds'](),this['validateMappingStatements'](),this['validateTransitions'](),this['validateTransitionConditions'](),this['validateStats'](),this['validateSchemas'](),this['validateUniqueHandledTopics'](),this['validateGraphPublishSubscribe'](),this['validateHooks'](),this['validateConditionalStatements']();}['validateActivityIds'](){const _0x2740e3=new Set();this['manifest']['app']['graphs']['forEach'](_0x1b17f3=>{const _0x29a15e=Object['keys'](_0x1b17f3['activities']);_0x29a15e['forEach'](_0x3c3fd0=>{if(_0x2740e3['has'](_0x3c3fd0))throw new Error('Duplicate\x20activity\x20id\x20found:\x20'+_0x3c3fd0);else _0x2740e3['add'](_0x3c3fd0);});}),this['activityIds']=Array['from'](_0x2740e3);}['isMappingStatement'](_0x550fb8){return typeof _0x550fb8==='string'&&_0x550fb8['startsWith']('{')&&_0x550fb8['endsWith']('}');}['extractMappingStatements'](_0x3ad9d6,_0x4d23dd,_0x2b4da0){for(const _0x95eeb0 in _0x3ad9d6){if(typeof _0x3ad9d6[_0x95eeb0]==='object'&&_0x3ad9d6[_0x95eeb0]!==null)this['extractMappingStatements'](_0x3ad9d6[_0x95eeb0],_0x4d23dd,_0x2b4da0);else this['isMappingStatement'](_0x3ad9d6[_0x95eeb0])&&(!_0x4d23dd[_0x2b4da0]&&(_0x4d23dd[_0x2b4da0]=[]),_0x4d23dd[_0x2b4da0]['push'](_0x3ad9d6[_0x95eeb0]));}}['getMappingStatements'](){const _0x3745bf={};this['manifest']['app']['graphs']['forEach'](_0x454c48=>{const _0x4e3c75=_0x454c48['activities'];for(const _0x41cf20 in _0x4e3c75){const _0x4bf386=_0x4e3c75[_0x41cf20];this['extractMappingStatements'](_0x4bf386,_0x3745bf,_0x41cf20);}}),this['mappingStatements']=_0x3745bf;}['validateReferencedActivityIds'](){const _0x47a3c6=this['mappingStatements'],_0x39cbde=this['activityIds'];for(const _0x1b0798 in _0x47a3c6){const _0x5e1cb3=_0x47a3c6[_0x1b0798];_0x5e1cb3['forEach'](_0x2aa372=>{if(_0x2aa372['startsWith']('{')&&_0x2aa372['endsWith']('}')){const _0x5caae0=_0x2aa372['slice'](0x1,-0x1)['split']('.'),_0x962e31=_0x5caae0[0x0];if(!(Validator['SYS_VARS']['includes'](_0x962e31)||_0x39cbde['includes'](_0x962e31)||this['isFunction'](_0x2aa372)||this['isContextVariable'](_0x2aa372)))throw new Error('Mapping\x20statement\x20references\x20non-existent\x20activity:\x20'+_0x2aa372);}});}}['isFunction'](_0xb07413){return _0xb07413['startsWith']('{@')&&pipe_1['Pipe']['resolveFunction'](_0xb07413);}['isContextVariable'](_0x533055){return['{$input}','{$output}','{$item}','{$key}','{$index}']['includes'](_0x533055);}['validateMappingStatements'](){}['validateTransitions'](){}['validateTransitionConditions'](){}['validateStats'](){}['validateSchemas'](){}['validateUniqueHandledTopics'](){}['validateGraphPublishSubscribe'](){}['validateHooks'](){}['validateConditionalStatements'](){}}exports['Validator']=Validator,Validator['SYS_VARS']=['$app','$self','$graph','$job'],Validator['CONTEXT_VARS']=['{$input}','{$output}','{$item}','{$key}','{$index}'];function _0x34a1(){const _0x19d4d5=['48lVozYu','11878752ypgwRC','6149932exXlRO','201392sKKdBR','3333905SAjmaI','343tAdLBy','132588jckJeQ','27906FsBsRI','1270HYeSGd','73676bjIZiF'];_0x34a1=function(){return _0x19d4d5;};return _0x34a1();}
@@ -24,6 +24,7 @@ import { StringAnyType, StringStringType } from '../../types/serializer';
24
24
  import { GetStatsOptions, IdsResponse, JobStatsInput, StatsResponse } from '../../types/stats';
25
25
  import { StreamCode, StreamData, StreamDataResponse, StreamError, StreamStatus } from '../../types/stream';
26
26
  import { WorkListTaskType } from '../../types/task';
27
+ import { SearchService } from '../search';
27
28
  declare class EngineService {
28
29
  namespace: string;
29
30
  apps: HotMeshApps | null;
@@ -31,6 +32,7 @@ declare class EngineService {
31
32
  guid: string;
32
33
  exporter: ExporterService | null;
33
34
  router: Router | null;
35
+ search: SearchService<RedisClient> | null;
34
36
  store: StoreService<RedisClient, RedisMulti> | null;
35
37
  stream: StreamService<RedisClient, RedisMulti> | null;
36
38
  subscribe: SubService<RedisClient, RedisMulti> | null;
@@ -45,9 +47,10 @@ declare class EngineService {
45
47
  constructor();
46
48
  static init(namespace: string, appId: string, guid: string, config: HotMeshConfig, logger: ILogger): Promise<EngineService>;
47
49
  verifyEngineFields(config: HotMeshConfig): void;
50
+ initSearchChannel(search: RedisClient, store?: RedisClient): Promise<void>;
48
51
  initStoreChannel(store: RedisClient): Promise<void>;
49
- initSubChannel(sub: RedisClient): Promise<void>;
50
- initStreamChannel(stream: RedisClient): Promise<void>;
52
+ initSubChannel(sub: RedisClient, store: RedisClient): Promise<void>;
53
+ initStreamChannel(stream: RedisClient, store: RedisClient): Promise<void>;
51
54
  initRouter(config: HotMeshConfig): Promise<Router>;
52
55
  fetchAndVerifyVID(vid: AppVID, count?: number): Promise<AppVID>;
53
56
  getVID(vid?: AppVID): Promise<AppVID>;