@hotmeshio/hotmesh 0.0.2 → 0.0.3
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 +13 -13
- package/build/package.json +3 -3
- package/build/services/durable/client.d.ts +3 -3
- package/build/services/durable/client.js +10 -1
- package/build/services/durable/worker.js +20 -2
- package/build/services/store/index.js +6 -1
- package/build/types/hotmesh.d.ts +5 -5
- package/package.json +3 -3
- package/services/durable/client.ts +13 -6
- package/services/durable/worker.ts +16 -2
- package/services/store/index.ts +5 -1
- package/types/hotmesh.ts +5 -5
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# HotMesh
|
|
2
2
|

|
|
3
3
|
|
|
4
|
-
Build sophisticated, durable workflows without the overhead of a dedicated server cluster. With HotMesh, your code remains front and center using [infrastructure](
|
|
4
|
+
Build sophisticated, durable workflows without the overhead of a dedicated server cluster. With HotMesh, your code remains front and center using [infrastructure](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/faq.md#what-is-hotmesh) you already own.
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
[](https://badge.fury.io/js/%40hotmeshio%2Fhotmesh)
|
|
@@ -98,7 +98,7 @@ run().catch((err) => {
|
|
|
98
98
|
});
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
>HotMesh delivers durable function execution using a swarm of [distributed engines](
|
|
101
|
+
>HotMesh delivers durable function execution using a swarm of [distributed engines](https://github.com/hotmeshio/sdk-typescript/blob/main/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
102
|
|
|
103
103
|
## Advanced Design
|
|
104
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.
|
|
@@ -208,34 +208,34 @@ const hotMesh = await HotMesh.init({
|
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
### Observability
|
|
211
|
-
Workflows and activities are run according to the rules you define, offering [Graph-Oriented](
|
|
211
|
+
Workflows and activities are run according to the rules you define, offering [Graph-Oriented](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/system_lifecycle.md#telemetry) telemetry insights into your legacy function executions.
|
|
212
212
|
|
|
213
213
|
## FAQ
|
|
214
|
-
Refer to the [FAQ](
|
|
214
|
+
Refer to the [FAQ](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/faq.md) for terminology, definitions, and an exploration of how HotMesh facilitates orchestration use cases.
|
|
215
215
|
|
|
216
216
|
## Quick Start
|
|
217
|
-
Refer to the [Quick Start](
|
|
217
|
+
Refer to the [Quick Start](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/quickstart.md) for sample flows you can easily copy, paste, and modify to get started.
|
|
218
218
|
|
|
219
219
|
## Developer Guide
|
|
220
|
-
For more details on the complete development process, including information about schemas, APIs, and deployment, consult the [Developer Guide](
|
|
220
|
+
For more details on the complete development process, including information about schemas, APIs, and deployment, consult the [Developer Guide](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/developer_guide.md).
|
|
221
221
|
|
|
222
222
|
## Model Driven Development
|
|
223
|
-
[Model Driven Development](
|
|
223
|
+
[Model Driven Development](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/model_driven_development.md) is an established strategy for managing process-oriented tasks. Check out this guide to understand its foundational principles.
|
|
224
224
|
|
|
225
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](
|
|
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](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/data_mapping.md).
|
|
227
227
|
|
|
228
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](
|
|
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](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/composable_workflow.md).
|
|
230
230
|
|
|
231
231
|
## Architectural First Principles
|
|
232
|
-
For a deep dive into HotMesh's distributed orchestration philosophy, refer to the [Architectural First Principles Overview](
|
|
232
|
+
For a deep dive into HotMesh's distributed orchestration philosophy, refer to the [Architectural First Principles Overview](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/architecture.md).
|
|
233
233
|
|
|
234
234
|
## Distributed Orchestration
|
|
235
|
-
HotMesh is a distributed orchestration engine. Refer to the [Distributed Orchestration Guide](
|
|
235
|
+
HotMesh is a distributed orchestration engine. Refer to the [Distributed Orchestration Guide](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/distributed_orchestration.md) for a detailed breakdown of the approach.
|
|
236
236
|
|
|
237
237
|
## System Lifecycle
|
|
238
|
-
Gain insight into the HotMesh's monitoring, exception handling, and alarm configurations via the [System Lifecycle Guide](
|
|
238
|
+
Gain insight into the HotMesh's monitoring, exception handling, and alarm configurations via the [System Lifecycle Guide](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/system_lifecycle.md).
|
|
239
239
|
|
|
240
240
|
## Alpha Release
|
|
241
|
-
So what exacty is an [alpha release](
|
|
241
|
+
So what exacty is an [alpha release](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/alpha.md)?!
|
package/build/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Durable Workflows",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/hotmeshio/
|
|
9
|
+
"url": "https://github.com/hotmeshio/sdk-typescript.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/hotmeshio/
|
|
11
|
+
"homepage": "https://github.com/hotmeshio/sdk-typescript#readme",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WorkflowHandleService } from
|
|
2
|
-
import { HotMeshService as HotMesh } from
|
|
3
|
-
import { ClientConfig, Connection, WorkflowOptions } from
|
|
1
|
+
import { WorkflowHandleService } from './handle';
|
|
2
|
+
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
3
|
+
import { ClientConfig, Connection, WorkflowOptions } from '../../types/durable';
|
|
4
4
|
export declare class ClientService {
|
|
5
5
|
connection: Connection;
|
|
6
6
|
options: WorkflowOptions;
|
|
@@ -92,7 +92,16 @@ class ClientService {
|
|
|
92
92
|
await hotMesh.activate(version);
|
|
93
93
|
}
|
|
94
94
|
catch (err) {
|
|
95
|
-
hotMesh.engine.logger.error('durable-client-
|
|
95
|
+
hotMesh.engine.logger.error('durable-client-deploy-activate-err', err);
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else if (app && !app.active) {
|
|
100
|
+
try {
|
|
101
|
+
await hotMesh.activate(version);
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
hotMesh.engine.logger.error('durable-client-activate-err', err);
|
|
96
105
|
throw err;
|
|
97
106
|
}
|
|
98
107
|
}
|
|
@@ -73,7 +73,16 @@ class WorkerService {
|
|
|
73
73
|
await hotMesh.activate(version);
|
|
74
74
|
}
|
|
75
75
|
catch (err) {
|
|
76
|
-
hotMesh.engine.logger.error('durable-worker-
|
|
76
|
+
hotMesh.engine.logger.error('durable-worker-deploy-activate-err', err);
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (app && !app.active) {
|
|
81
|
+
try {
|
|
82
|
+
await hotMesh.activate(version);
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
hotMesh.engine.logger.error('durable-worker-activate-err', err);
|
|
77
86
|
throw err;
|
|
78
87
|
}
|
|
79
88
|
}
|
|
@@ -176,7 +185,16 @@ class WorkerService {
|
|
|
176
185
|
await hotMesh.activate(version);
|
|
177
186
|
}
|
|
178
187
|
catch (err) {
|
|
179
|
-
console.log('durable-worker-activity-
|
|
188
|
+
console.log('durable-worker-activity-deploy-activate-error', err);
|
|
189
|
+
throw err;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else if (app && !app.active) {
|
|
193
|
+
try {
|
|
194
|
+
await hotMesh.activate(version);
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
hotMesh.engine.logger.error('durable-worker-activity-activate-err', err);
|
|
180
198
|
throw err;
|
|
181
199
|
}
|
|
182
200
|
}
|
|
@@ -238,7 +238,12 @@ class StoreService {
|
|
|
238
238
|
app = {};
|
|
239
239
|
for (const field in sApp) {
|
|
240
240
|
try {
|
|
241
|
-
|
|
241
|
+
if (field === 'active') {
|
|
242
|
+
app[field] = sApp[field] === 'true';
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
app[field] = sApp[field];
|
|
246
|
+
}
|
|
242
247
|
}
|
|
243
248
|
catch (e) {
|
|
244
249
|
app[field] = sApp[field];
|
package/build/types/hotmesh.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ILogger } from
|
|
2
|
-
import { HotMeshService } from
|
|
3
|
-
import { HookRules } from
|
|
4
|
-
import { RedisClass, RedisClient, RedisOptions } from
|
|
5
|
-
import { StreamData, StreamDataResponse } from
|
|
1
|
+
import { ILogger } from '../services/logger';
|
|
2
|
+
import { HotMeshService } from '../services/hotmesh';
|
|
3
|
+
import { HookRules } from './hook';
|
|
4
|
+
import { RedisClass, RedisClient, RedisOptions } from './redis';
|
|
5
|
+
import { StreamData, StreamDataResponse } from './stream';
|
|
6
6
|
type HotMesh = typeof HotMeshService;
|
|
7
7
|
type RedisConfig = {
|
|
8
8
|
class: RedisClass;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Durable Workflows",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/hotmeshio/
|
|
9
|
+
"url": "https://github.com/hotmeshio/sdk-typescript.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/hotmeshio/
|
|
11
|
+
"homepage": "https://github.com/hotmeshio/sdk-typescript#readme",
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { WorkflowHandleService } from
|
|
2
|
-
import { HotMeshService as HotMesh } from
|
|
3
|
-
import { ClientConfig, Connection, WorkflowOptions } from
|
|
4
|
-
import { getWorkflowYAML } from
|
|
5
|
-
import { JobState } from
|
|
1
|
+
import { WorkflowHandleService } from './handle';
|
|
2
|
+
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
3
|
+
import { ClientConfig, Connection, WorkflowOptions } from '../../types/durable';
|
|
4
|
+
import { getWorkflowYAML } from './factory';
|
|
5
|
+
import { JobState } from '../../types/job';
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Here is an example of how the methods in this file are used:
|
|
@@ -101,7 +101,14 @@ export class ClientService {
|
|
|
101
101
|
await hotMesh.deploy(getWorkflowYAML(workflowTopic, version));
|
|
102
102
|
await hotMesh.activate(version);
|
|
103
103
|
} catch (err) {
|
|
104
|
-
hotMesh.engine.logger.error('durable-client-
|
|
104
|
+
hotMesh.engine.logger.error('durable-client-deploy-activate-err', err);
|
|
105
|
+
throw err;
|
|
106
|
+
}
|
|
107
|
+
} else if(app && !app.active) {
|
|
108
|
+
try {
|
|
109
|
+
await hotMesh.activate(version);
|
|
110
|
+
} catch (err) {
|
|
111
|
+
hotMesh.engine.logger.error('durable-client-activate-err', err);
|
|
105
112
|
throw err;
|
|
106
113
|
}
|
|
107
114
|
}
|
|
@@ -67,7 +67,14 @@ export class WorkerService {
|
|
|
67
67
|
await hotMesh.deploy(factory(topic, version));
|
|
68
68
|
await hotMesh.activate(version);
|
|
69
69
|
} catch (err) {
|
|
70
|
-
hotMesh.engine.logger.error('durable-worker-
|
|
70
|
+
hotMesh.engine.logger.error('durable-worker-deploy-activate-err', err);
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
} else if(app && !app.active) {
|
|
74
|
+
try {
|
|
75
|
+
await hotMesh.activate(version);
|
|
76
|
+
} catch (err) {
|
|
77
|
+
hotMesh.engine.logger.error('durable-worker-activate-err', err);
|
|
71
78
|
throw err;
|
|
72
79
|
}
|
|
73
80
|
}
|
|
@@ -176,7 +183,14 @@ export class WorkerService {
|
|
|
176
183
|
await hotMesh.deploy(getActivityYAML(activityTopic, version));
|
|
177
184
|
await hotMesh.activate(version);
|
|
178
185
|
} catch (err) {
|
|
179
|
-
console.log('durable-worker-activity-
|
|
186
|
+
console.log('durable-worker-activity-deploy-activate-error', err);
|
|
187
|
+
throw err;
|
|
188
|
+
}
|
|
189
|
+
} else if(app && !app.active) {
|
|
190
|
+
try {
|
|
191
|
+
await hotMesh.activate(version);
|
|
192
|
+
} catch (err) {
|
|
193
|
+
hotMesh.engine.logger.error('durable-worker-activity-activate-err', err);
|
|
180
194
|
throw err;
|
|
181
195
|
}
|
|
182
196
|
}
|
package/services/store/index.ts
CHANGED
|
@@ -310,7 +310,11 @@ abstract class StoreService<T, U extends AbstractRedisClient> {
|
|
|
310
310
|
app = {};
|
|
311
311
|
for (const field in sApp) {
|
|
312
312
|
try {
|
|
313
|
-
|
|
313
|
+
if (field === 'active') {
|
|
314
|
+
app[field] = sApp[field] === 'true';
|
|
315
|
+
} else {
|
|
316
|
+
app[field] = sApp[field];
|
|
317
|
+
}
|
|
314
318
|
} catch (e) {
|
|
315
319
|
app[field] = sApp[field];
|
|
316
320
|
}
|
package/types/hotmesh.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ILogger } from
|
|
2
|
-
import { HotMeshService } from
|
|
3
|
-
import { HookRules } from
|
|
4
|
-
import { RedisClass, RedisClient, RedisOptions } from
|
|
5
|
-
import { StreamData, StreamDataResponse } from
|
|
1
|
+
import { ILogger } from '../services/logger';
|
|
2
|
+
import { HotMeshService } from '../services/hotmesh';
|
|
3
|
+
import { HookRules } from './hook';
|
|
4
|
+
import { RedisClass, RedisClient, RedisOptions } from './redis';
|
|
5
|
+
import { StreamData, StreamDataResponse } from './stream';
|
|
6
6
|
|
|
7
7
|
type HotMesh = typeof HotMeshService;
|
|
8
8
|
|