@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.
- package/README.md +128 -823
- package/build/index.d.ts +9 -9
- package/build/index.js +10 -10
- package/build/modules/enums.d.ts +23 -23
- package/build/modules/enums.js +26 -26
- package/build/modules/errors.d.ts +16 -16
- package/build/modules/errors.js +28 -28
- package/build/modules/key.js +190 -1
- package/build/modules/utils.js +374 -1
- package/build/package.json +22 -21
- package/build/services/activities/activity.js +549 -1
- package/build/services/activities/await.js +114 -1
- package/build/services/activities/cycle.js +112 -1
- package/build/services/activities/hook.js +168 -1
- package/build/services/activities/index.js +20 -1
- package/build/services/activities/interrupt.js +158 -1
- package/build/services/activities/signal.js +134 -1
- package/build/services/activities/trigger.js +246 -1
- package/build/services/activities/worker.js +106 -1
- package/build/services/collator/index.js +293 -1
- package/build/services/compiler/deployer.js +488 -1
- package/build/services/compiler/index.js +112 -1
- package/build/services/compiler/validator.js +147 -1
- package/build/services/engine/index.js +761 -1
- package/build/services/exporter/index.js +126 -1
- package/build/services/hotmesh/index.d.ts +160 -17
- package/build/services/hotmesh/index.js +160 -17
- package/build/services/mapper/index.js +81 -1
- package/build/services/{meshflow → memflow}/client.d.ts +3 -3
- package/build/services/{meshflow → memflow}/client.js +17 -16
- package/build/services/{meshflow → memflow}/connection.d.ts +2 -2
- package/build/services/{meshflow → memflow}/connection.js +1 -1
- package/build/services/memflow/context.d.ts +143 -0
- package/build/services/memflow/context.js +299 -0
- package/build/services/{meshflow → memflow}/exporter.d.ts +6 -6
- package/build/services/memflow/exporter.js +215 -0
- package/build/services/{meshflow → memflow}/handle.d.ts +4 -4
- package/build/services/{meshflow → memflow}/handle.js +2 -2
- package/build/services/{meshflow → memflow}/index.d.ts +18 -13
- package/build/services/{meshflow → memflow}/index.js +26 -21
- package/build/services/{meshflow → memflow}/schemas/factory.d.ts +4 -4
- package/build/services/{meshflow → memflow}/schemas/factory.js +5 -5
- package/build/services/{meshflow → memflow}/search.d.ts +1 -1
- package/build/services/{meshflow → memflow}/search.js +4 -4
- package/build/services/{meshflow → memflow}/worker.d.ts +5 -5
- package/build/services/{meshflow → memflow}/worker.js +24 -24
- package/build/services/memflow/workflow/common.d.ts +20 -0
- package/build/services/memflow/workflow/common.js +47 -0
- package/build/services/memflow/workflow/contextMethods.d.ts +14 -0
- package/build/services/memflow/workflow/contextMethods.js +33 -0
- package/build/services/{meshflow → memflow}/workflow/execChild.js +12 -12
- package/build/services/memflow/workflow/execHook.d.ts +65 -0
- package/build/services/memflow/workflow/execHook.js +73 -0
- package/build/services/{meshflow → memflow}/workflow/hook.js +19 -3
- package/build/services/{meshflow → memflow}/workflow/index.d.ts +7 -3
- package/build/services/{meshflow → memflow}/workflow/index.js +7 -3
- package/build/services/{meshflow → memflow}/workflow/proxyActivities.d.ts +2 -2
- package/build/services/{meshflow → memflow}/workflow/proxyActivities.js +8 -8
- package/build/services/{meshflow → memflow}/workflow/sleepFor.js +2 -2
- package/build/services/{meshflow → memflow}/workflow/waitFor.js +2 -2
- package/build/services/meshdata/index.d.ts +24 -24
- package/build/services/meshdata/index.js +40 -40
- package/build/services/pipe/functions/array.js +74 -1
- package/build/services/pipe/functions/bitwise.js +24 -1
- package/build/services/pipe/functions/conditional.js +36 -1
- package/build/services/pipe/functions/cron.js +40 -1
- package/build/services/pipe/functions/date.js +171 -1
- package/build/services/pipe/functions/index.js +30 -1
- package/build/services/pipe/functions/json.js +12 -1
- package/build/services/pipe/functions/logical.js +12 -1
- package/build/services/pipe/functions/math.js +184 -1
- package/build/services/pipe/functions/number.js +60 -1
- package/build/services/pipe/functions/object.js +81 -1
- package/build/services/pipe/functions/string.js +69 -1
- package/build/services/pipe/functions/symbol.js +33 -1
- package/build/services/pipe/functions/unary.js +18 -1
- package/build/services/pipe/index.js +242 -1
- package/build/services/quorum/index.js +263 -1
- package/build/services/reporter/index.js +348 -1
- package/build/services/router/config/index.d.ts +11 -0
- package/build/services/router/config/index.js +36 -0
- package/build/services/router/consumption/index.d.ts +34 -0
- package/build/services/router/consumption/index.js +395 -0
- package/build/services/router/error-handling/index.d.ts +8 -0
- package/build/services/router/error-handling/index.js +98 -0
- package/build/services/router/index.d.ts +13 -16
- package/build/services/router/index.js +121 -1
- package/build/services/router/lifecycle/index.d.ts +27 -0
- package/build/services/router/lifecycle/index.js +80 -0
- package/build/services/router/telemetry/index.d.ts +11 -0
- package/build/services/router/telemetry/index.js +32 -0
- package/build/services/router/throttling/index.d.ts +23 -0
- package/build/services/router/throttling/index.js +76 -0
- package/build/services/search/index.d.ts +2 -1
- package/build/services/search/providers/postgres/postgres.d.ts +2 -1
- package/build/services/search/providers/postgres/postgres.js +149 -1
- package/build/services/search/providers/redis/ioredis.d.ts +1 -0
- package/build/services/search/providers/redis/ioredis.js +121 -1
- package/build/services/search/providers/redis/redis.d.ts +1 -0
- package/build/services/search/providers/redis/redis.js +134 -1
- package/build/services/serializer/index.js +282 -1
- package/build/services/store/providers/postgres/kvsql.d.ts +1 -1
- package/build/services/store/providers/postgres/kvsql.js +198 -1
- package/build/services/store/providers/postgres/kvtables.js +441 -1
- package/build/services/store/providers/postgres/kvtransaction.js +248 -1
- package/build/services/store/providers/postgres/kvtypes/hash.d.ts +1 -1
- package/build/services/store/providers/postgres/kvtypes/hash.js +1287 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +194 -1
- package/build/services/store/providers/postgres/kvtypes/string.js +115 -1
- package/build/services/store/providers/postgres/kvtypes/zset.js +214 -1
- package/build/services/store/providers/postgres/postgres.js +1036 -1
- package/build/services/store/providers/redis/_base.js +980 -1
- package/build/services/store/providers/redis/ioredis.js +180 -1
- package/build/services/store/providers/redis/redis.js +199 -1
- package/build/services/store/providers/store-initializable.js +2 -1
- package/build/services/stream/index.d.ts +5 -0
- package/build/services/stream/providers/nats/nats.d.ts +1 -0
- package/build/services/stream/providers/nats/nats.js +225 -1
- package/build/services/stream/providers/postgres/kvtables.d.ts +1 -0
- package/build/services/stream/providers/postgres/kvtables.js +146 -1
- package/build/services/stream/providers/postgres/postgres.d.ts +19 -0
- package/build/services/stream/providers/postgres/postgres.js +519 -1
- package/build/services/stream/providers/redis/ioredis.d.ts +1 -0
- package/build/services/stream/providers/redis/ioredis.js +272 -1
- package/build/services/stream/providers/redis/redis.d.ts +1 -0
- package/build/services/stream/providers/redis/redis.js +305 -1
- package/build/services/stream/providers/stream-initializable.js +2 -1
- package/build/services/sub/providers/nats/nats.js +105 -1
- package/build/services/sub/providers/postgres/postgres.js +92 -1
- package/build/services/sub/providers/redis/ioredis.js +81 -1
- package/build/services/sub/providers/redis/redis.js +72 -1
- package/build/services/task/index.js +206 -1
- package/build/services/telemetry/index.js +306 -1
- package/build/services/worker/index.js +197 -1
- package/build/types/error.d.ts +5 -5
- package/build/types/exporter.d.ts +1 -1
- package/build/types/index.d.ts +3 -3
- package/build/types/manifest.d.ts +2 -2
- package/build/types/{meshflow.d.ts → memflow.d.ts} +15 -15
- package/build/types/meshdata.d.ts +3 -3
- package/build/types/postgres.d.ts +7 -0
- package/build/types/stream.d.ts +3 -0
- package/index.ts +11 -11
- package/package.json +22 -21
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/build/services/meshflow/exporter.js +0 -1
- package/build/services/meshflow/workflow/common.d.ts +0 -18
- package/build/services/meshflow/workflow/common.js +0 -45
- package/typedoc.json +0 -46
- package/types/activity.ts +0 -268
- package/types/app.ts +0 -20
- package/types/async.ts +0 -6
- package/types/cache.ts +0 -1
- package/types/collator.ts +0 -9
- package/types/error.ts +0 -56
- package/types/exporter.ts +0 -102
- package/types/hook.ts +0 -44
- package/types/hotmesh.ts +0 -314
- package/types/index.ts +0 -306
- package/types/job.ts +0 -233
- package/types/logger.ts +0 -8
- package/types/manifest.ts +0 -70
- package/types/map.ts +0 -5
- package/types/meshcall.ts +0 -235
- package/types/meshdata.ts +0 -278
- package/types/meshflow.ts +0 -645
- package/types/ms.d.ts +0 -7
- package/types/nats.ts +0 -270
- package/types/pipe.ts +0 -90
- package/types/postgres.ts +0 -105
- package/types/provider.ts +0 -161
- package/types/quorum.ts +0 -167
- package/types/redis.ts +0 -404
- package/types/serializer.ts +0 -40
- package/types/stats.ts +0 -117
- package/types/stream.ts +0 -227
- package/types/task.ts +0 -7
- package/types/telemetry.ts +0 -16
- package/types/transition.ts +0 -20
- /package/build/services/{meshflow → memflow}/workflow/all.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/all.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/context.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/context.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/didRun.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/didRun.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/emit.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/emit.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/enrich.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/enrich.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/execChild.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/hook.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/interrupt.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/interrupt.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/isSideEffectAllowed.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/isSideEffectAllowed.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/random.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/random.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/searchMethods.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/searchMethods.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/signal.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/signal.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/sleepFor.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/trace.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/trace.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/waitFor.d.ts +0 -0
- /package/build/types/{meshflow.js → memflow.js} +0 -0
|
@@ -1 +1,147 @@
|
|
|
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
|
+
/**
|
|
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
|
+
];
|