@hotmeshio/hotmesh 0.9.0 → 0.10.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 +39 -24
- package/build/index.d.ts +12 -11
- package/build/index.js +15 -13
- package/build/modules/enums.d.ts +23 -34
- package/build/modules/enums.js +26 -38
- package/build/modules/errors.d.ts +16 -16
- package/build/modules/errors.js +37 -37
- package/build/package.json +25 -25
- package/build/services/activities/activity.js +1 -1
- package/build/services/dba/index.d.ts +171 -0
- package/build/services/dba/index.js +280 -0
- package/build/services/{memflow → durable}/client.d.ts +3 -3
- package/build/services/{memflow → durable}/client.js +13 -13
- package/build/services/{memflow → durable}/connection.d.ts +2 -2
- package/build/services/{memflow → durable}/connection.js +1 -1
- package/build/services/{memflow → durable}/exporter.d.ts +6 -6
- package/build/services/{memflow → durable}/exporter.js +2 -2
- package/build/services/{memflow → durable}/handle.d.ts +4 -4
- package/build/services/{memflow → durable}/handle.js +2 -2
- package/build/services/{memflow → durable}/index.d.ts +155 -34
- package/build/services/{memflow → durable}/index.js +175 -50
- package/build/services/{memflow → durable}/interceptor.d.ts +118 -22
- package/build/services/{memflow → durable}/interceptor.js +127 -21
- package/build/services/{memflow → durable}/schemas/factory.d.ts +4 -4
- package/build/services/{memflow → durable}/schemas/factory.js +5 -5
- package/build/services/{memflow → durable}/search.d.ts +1 -1
- package/build/services/{memflow → durable}/search.js +4 -4
- package/build/services/{memflow → durable}/worker.d.ts +11 -11
- package/build/services/{memflow → durable}/worker.js +61 -60
- package/build/services/{memflow → durable}/workflow/all.d.ts +5 -5
- package/build/services/{memflow → durable}/workflow/all.js +5 -5
- package/build/services/{memflow → durable}/workflow/common.d.ts +5 -5
- package/build/services/durable/workflow/common.js +47 -0
- package/build/services/{memflow → durable}/workflow/context.d.ts +5 -5
- package/build/services/{memflow → durable}/workflow/context.js +5 -5
- package/build/services/{memflow → durable}/workflow/emit.d.ts +5 -5
- package/build/services/{memflow → durable}/workflow/emit.js +5 -5
- package/build/services/{memflow → durable}/workflow/enrich.d.ts +4 -4
- package/build/services/{memflow → durable}/workflow/enrich.js +4 -4
- package/build/services/{memflow → durable}/workflow/entityMethods.d.ts +4 -4
- package/build/services/{memflow → durable}/workflow/entityMethods.js +4 -4
- package/build/services/{memflow → durable}/workflow/execChild.d.ts +9 -9
- package/build/services/{memflow → durable}/workflow/execChild.js +22 -22
- package/build/services/{memflow → durable}/workflow/execHook.d.ts +8 -8
- package/build/services/{memflow → durable}/workflow/execHook.js +10 -10
- package/build/services/{memflow → durable}/workflow/execHookBatch.d.ts +5 -5
- package/build/services/{memflow → durable}/workflow/execHookBatch.js +8 -8
- package/build/services/{memflow → durable}/workflow/hook.d.ts +5 -5
- package/build/services/{memflow → durable}/workflow/hook.js +11 -11
- package/build/services/{memflow → durable}/workflow/index.d.ts +6 -6
- package/build/services/{memflow → durable}/workflow/index.js +6 -6
- package/build/services/{memflow → durable}/workflow/interrupt.d.ts +7 -7
- package/build/services/{memflow → durable}/workflow/interrupt.js +7 -7
- package/build/services/{memflow → durable}/workflow/interruption.d.ts +10 -10
- package/build/services/{memflow → durable}/workflow/interruption.js +19 -19
- package/build/services/{memflow → durable}/workflow/proxyActivities.d.ts +7 -7
- package/build/services/{memflow → durable}/workflow/proxyActivities.js +49 -35
- package/build/services/{memflow → durable}/workflow/random.d.ts +4 -4
- package/build/services/{memflow → durable}/workflow/random.js +4 -4
- package/build/services/{memflow → durable}/workflow/searchMethods.d.ts +5 -5
- package/build/services/{memflow → durable}/workflow/searchMethods.js +5 -5
- package/build/services/{memflow → durable}/workflow/signal.d.ts +8 -8
- package/build/services/{memflow → durable}/workflow/signal.js +8 -8
- package/build/services/{memflow → durable}/workflow/sleepFor.d.ts +7 -7
- package/build/services/{memflow → durable}/workflow/sleepFor.js +10 -10
- package/build/services/{memflow → durable}/workflow/trace.d.ts +5 -5
- package/build/services/{memflow → durable}/workflow/trace.js +5 -5
- package/build/services/{memflow → durable}/workflow/waitFor.d.ts +9 -9
- package/build/services/{memflow → durable}/workflow/waitFor.js +12 -12
- package/build/services/hotmesh/index.d.ts +3 -3
- package/build/services/hotmesh/index.js +3 -3
- package/build/services/{meshcall → virtual}/index.d.ts +29 -29
- package/build/services/{meshcall → virtual}/index.js +49 -49
- package/build/services/{meshcall → virtual}/schemas/factory.d.ts +1 -1
- package/build/services/{meshcall → virtual}/schemas/factory.js +1 -1
- package/build/types/dba.d.ts +64 -0
- package/build/types/{memflow.d.ts → durable.d.ts} +96 -22
- package/build/types/error.d.ts +5 -5
- package/build/types/exporter.d.ts +1 -1
- package/build/types/index.d.ts +5 -4
- package/build/types/{meshcall.d.ts → virtual.d.ts} +15 -15
- package/build/types/virtual.js +2 -0
- package/index.ts +15 -13
- package/package.json +25 -25
- package/.claude/settings.local.json +0 -8
- package/build/services/memflow/workflow/common.js +0 -47
- package/build/vitest.config.d.ts +0 -2
- package/build/vitest.config.js +0 -18
- /package/build/services/{memflow → durable}/entity.d.ts +0 -0
- /package/build/services/{memflow → durable}/entity.js +0 -0
- /package/build/services/{memflow → durable}/workflow/didRun.d.ts +0 -0
- /package/build/services/{memflow → durable}/workflow/didRun.js +0 -0
- /package/build/services/{memflow → durable}/workflow/isSideEffectAllowed.d.ts +0 -0
- /package/build/services/{memflow → durable}/workflow/isSideEffectAllowed.js +0 -0
- /package/build/types/{memflow.js → dba.js} +0 -0
- /package/build/types/{meshcall.js → durable.js} +0 -0
- /package/{vitest.config.ts → vitest.config.mts} +0 -0
package/README.md
CHANGED
|
@@ -11,12 +11,10 @@ npm install @hotmeshio/hotmesh
|
|
|
11
11
|
## Use HotMesh for
|
|
12
12
|
|
|
13
13
|
- **Durable pipelines** — Orchestrate long-running, multi-step pipelines transactionally.
|
|
14
|
-
- **Temporal
|
|
14
|
+
- **Temporal alternative** — The `Durable` module provides a Temporal-compatible API (`Client`, `Worker`, `proxyActivities`, `sleepFor`, `startChild`, signals) that runs directly on Postgres. No app server required.
|
|
15
15
|
- **Distributed state machines** — Build stateful applications where every component can [fail and recover](https://github.com/hotmeshio/sdk-typescript/blob/main/services/collator/README.md).
|
|
16
16
|
- **AI and training pipelines** — Multi-step AI workloads where each stage is expensive and must not be repeated on failure. A crashed pipeline resumes from the last committed step, not from the beginning.
|
|
17
17
|
|
|
18
|
-
> **MemFlow** is HotMesh's Temporal-compatible workflow module — a static class (`MemFlow.Client`, `MemFlow.Worker`, `MemFlow.workflow`) that provides the same developer experience as Temporal's SDK but runs entirely on Postgres.
|
|
19
|
-
|
|
20
18
|
## How it works in 30 seconds
|
|
21
19
|
|
|
22
20
|
1. **You write workflow functions.** Plain TypeScript — branching, loops, error handling. HotMesh also supports a YAML syntax for declarative, functional workflows.
|
|
@@ -25,19 +23,19 @@ npm install @hotmeshio/hotmesh
|
|
|
25
23
|
|
|
26
24
|
## Quickstart
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
Install the package:
|
|
29
27
|
|
|
30
28
|
```bash
|
|
31
29
|
npm install @hotmeshio/hotmesh
|
|
32
30
|
```
|
|
33
31
|
|
|
34
|
-
The repo includes a `docker-compose.yml` that starts Postgres
|
|
32
|
+
The repo includes a `docker-compose.yml` that starts Postgres, NATS, and a development container:
|
|
35
33
|
|
|
36
34
|
```bash
|
|
37
|
-
docker compose up -d
|
|
35
|
+
docker compose up -d
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
Then follow the [Quick Start guide](
|
|
38
|
+
Then follow the [Quick Start guide](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/quickstart.md) for a progressive walkthrough — from a single trigger to conditional, parallel, and compositional workflows.
|
|
41
39
|
|
|
42
40
|
## Two ways to write workflows
|
|
43
41
|
|
|
@@ -62,12 +60,12 @@ export async function notifyBackorder(itemId: string): Promise<void> {
|
|
|
62
60
|
|
|
63
61
|
```typescript
|
|
64
62
|
// workflows.ts
|
|
65
|
-
import {
|
|
63
|
+
import { Durable } from '@hotmeshio/hotmesh';
|
|
66
64
|
import * as activities from './activities';
|
|
67
65
|
|
|
68
66
|
export async function orderWorkflow(itemId: string, qty: number) {
|
|
69
67
|
const { checkInventory, reserveItem, notifyBackorder } =
|
|
70
|
-
|
|
68
|
+
Durable.workflow.proxyActivities<typeof activities>({
|
|
71
69
|
taskQueue: 'inventory-tasks'
|
|
72
70
|
});
|
|
73
71
|
|
|
@@ -87,18 +85,18 @@ const connection = {
|
|
|
87
85
|
options: { connectionString: 'postgresql://localhost:5432/mydb' }
|
|
88
86
|
};
|
|
89
87
|
|
|
90
|
-
await
|
|
88
|
+
await Durable.registerActivityWorker({
|
|
91
89
|
connection,
|
|
92
90
|
taskQueue: 'inventory-tasks'
|
|
93
91
|
}, activities, 'inventory-activities');
|
|
94
92
|
|
|
95
|
-
await
|
|
93
|
+
await Durable.Worker.create({
|
|
96
94
|
connection,
|
|
97
95
|
taskQueue: 'orders',
|
|
98
96
|
workflow: orderWorkflow
|
|
99
97
|
});
|
|
100
98
|
|
|
101
|
-
const client = new
|
|
99
|
+
const client = new Durable.Client({ connection });
|
|
102
100
|
const handle = await client.workflow.start({
|
|
103
101
|
args: ['item-123', 5],
|
|
104
102
|
taskQueue: 'orders',
|
|
@@ -202,17 +200,17 @@ Both compile to the same distributed execution model.
|
|
|
202
200
|
|
|
203
201
|
## Common patterns
|
|
204
202
|
|
|
205
|
-
All snippets below run inside a workflow function (like `orderWorkflow` above).
|
|
203
|
+
All snippets below run inside a workflow function (like `orderWorkflow` above). Durable methods are available as static imports:
|
|
206
204
|
|
|
207
205
|
```typescript
|
|
208
|
-
import {
|
|
206
|
+
import { Durable } from '@hotmeshio/hotmesh';
|
|
209
207
|
```
|
|
210
208
|
|
|
211
209
|
**Long-running workflows** — `sleepFor` is durable. The process can restart; the timer survives.
|
|
212
210
|
|
|
213
211
|
```typescript
|
|
214
212
|
// sendFollowUp is a proxied activity from proxyActivities()
|
|
215
|
-
await
|
|
213
|
+
await Durable.workflow.sleepFor('30 days');
|
|
216
214
|
await sendFollowUp();
|
|
217
215
|
```
|
|
218
216
|
|
|
@@ -230,7 +228,7 @@ const [payment, inventory, shipment] = await Promise.all([
|
|
|
230
228
|
**Child workflows** — compose workflows from other workflows.
|
|
231
229
|
|
|
232
230
|
```typescript
|
|
233
|
-
const childHandle = await
|
|
231
|
+
const childHandle = await Durable.workflow.startChild(validateOrder, {
|
|
234
232
|
args: [orderId],
|
|
235
233
|
taskQueue: 'validation',
|
|
236
234
|
workflowId: `validate-${orderId}`
|
|
@@ -241,7 +239,7 @@ const validation = await childHandle.result();
|
|
|
241
239
|
**Signals** — pause a workflow until an external event arrives.
|
|
242
240
|
|
|
243
241
|
```typescript
|
|
244
|
-
const approval = await
|
|
242
|
+
const approval = await Durable.workflow.waitFor<{ approved: boolean }>('manager-approval');
|
|
245
243
|
if (!approval.approved) return 'rejected';
|
|
246
244
|
```
|
|
247
245
|
|
|
@@ -250,8 +248,8 @@ if (!approval.approved) return 'rejected';
|
|
|
250
248
|
Activities retry automatically on failure. Configure the policy per activity or per worker:
|
|
251
249
|
|
|
252
250
|
```typescript
|
|
253
|
-
//
|
|
254
|
-
const { reserveItem } =
|
|
251
|
+
// Durable: per-activity retry policy
|
|
252
|
+
const { reserveItem } = Durable.workflow.proxyActivities<typeof activities>({
|
|
255
253
|
taskQueue: 'inventory-tasks',
|
|
256
254
|
retryPolicy: {
|
|
257
255
|
maximumAttempts: 5,
|
|
@@ -283,9 +281,9 @@ Defaults: 3 attempts, coefficient 10, 120s cap. Delay formula: `min(coefficient
|
|
|
283
281
|
|
|
284
282
|
If all retries are exhausted, the activity fails and the error propagates to the workflow function — handle it with a standard `try/catch`.
|
|
285
283
|
|
|
286
|
-
##
|
|
284
|
+
## Workflow state is queryable data
|
|
287
285
|
|
|
288
|
-
|
|
286
|
+
Workflow state lives in your database as ordinary rows — `jobs` and `jobs_attributes`. Query it directly, back it up with pg_dump, replicate it, join it against your application tables.
|
|
289
287
|
|
|
290
288
|
```sql
|
|
291
289
|
SELECT
|
|
@@ -327,7 +325,7 @@ There is no proprietary dashboard. Workflow state lives in Postgres, so use what
|
|
|
327
325
|
- **Direct SQL** — query `jobs` and `jobs_attributes` to inspect state, as shown above.
|
|
328
326
|
- **Handle API** — `handle.status()`, `handle.state(true)`, and `handle.export()` give programmatic access to any running or completed workflow.
|
|
329
327
|
- **Logging** — set `HMSH_LOGLEVEL` (`debug`, `info`, `warn`, `error`, `silent`) to control log verbosity.
|
|
330
|
-
- **OpenTelemetry** — set `HMSH_TELEMETRY=true` to emit spans and metrics. Plug in any OTel-compatible collector
|
|
328
|
+
- **OpenTelemetry** — set `HMSH_TELEMETRY=true` to emit spans and metrics. Plug in any OTel-compatible collector.
|
|
331
329
|
|
|
332
330
|
## Architecture
|
|
333
331
|
|
|
@@ -335,11 +333,28 @@ For a deep dive into the transactional execution model — how every step is cra
|
|
|
335
333
|
|
|
336
334
|
## Familiar with Temporal?
|
|
337
335
|
|
|
338
|
-
|
|
336
|
+
Durable is designed as a drop-in-compatible alternative for common Temporal patterns.
|
|
339
337
|
|
|
340
338
|
**What's the same:** `Client`, `Worker`, `proxyActivities`, `sleepFor`, `startChild`/`execChild`, signals (`waitFor`/`signal`), retry policies, and the overall workflow-as-code programming model.
|
|
341
339
|
|
|
342
|
-
**What's different:**
|
|
340
|
+
**What's different:** Postgres is the only infrastructure dependency — it stores state and coordinates workers.
|
|
341
|
+
|
|
342
|
+
## Running tests
|
|
343
|
+
|
|
344
|
+
Tests run inside Docker. Start the services and run the full suite:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
docker compose up -d
|
|
348
|
+
docker compose exec hotmesh npm test
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Run a specific test group:
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
docker compose exec hotmesh npm run test:durable # all Durable tests (Temporal pattern coverage proofs)
|
|
355
|
+
docker compose exec hotmesh npm run test:durable:hello # single Durable test (hello world proxyActivity proof)
|
|
356
|
+
docker compose exec hotmesh npm run test:virtual # all Virtual network function (VNF) tests
|
|
357
|
+
```
|
|
343
358
|
|
|
344
359
|
## License
|
|
345
360
|
|
package/build/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { HotMesh } from './services/hotmesh';
|
|
2
2
|
import { HotMeshConfig } from './types/hotmesh';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
3
|
+
import { Virtual } from './services/virtual';
|
|
4
|
+
import { Durable } from './services/durable';
|
|
5
|
+
import { DBA } from './services/dba';
|
|
6
|
+
import { ClientService as Client } from './services/durable/client';
|
|
7
|
+
import { ConnectionService as Connection } from './services/durable/connection';
|
|
8
|
+
import { Search } from './services/durable/search';
|
|
9
|
+
import { Entity } from './services/durable/entity';
|
|
10
|
+
import { WorkerService as Worker } from './services/durable/worker';
|
|
11
|
+
import { WorkflowService as workflow } from './services/durable/workflow';
|
|
12
|
+
import { WorkflowHandleService as WorkflowHandle } from './services/durable/handle';
|
|
13
|
+
import { proxyActivities } from './services/durable/workflow/proxyActivities';
|
|
13
14
|
import * as Errors from './modules/errors';
|
|
14
15
|
import * as Utils from './modules/utils';
|
|
15
16
|
import * as Enums from './modules/enums';
|
|
@@ -18,5 +19,5 @@ import { ConnectorService as Connector } from './services/connector/factory';
|
|
|
18
19
|
import { PostgresConnection as ConnectorPostgres } from './services/connector/providers/postgres';
|
|
19
20
|
import { NatsConnection as ConnectorNATS } from './services/connector/providers/nats';
|
|
20
21
|
export { Connector, //factory
|
|
21
|
-
ConnectorNATS, ConnectorPostgres, HotMesh, HotMeshConfig,
|
|
22
|
+
ConnectorNATS, ConnectorPostgres, HotMesh, HotMeshConfig, Virtual, Durable, DBA, Client, Connection, proxyActivities, Search, Entity, Worker, workflow, WorkflowHandle, Enums, Errors, Utils, KeyStore, };
|
|
22
23
|
export * as Types from './types';
|
package/build/index.js
CHANGED
|
@@ -23,28 +23,30 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Types = exports.KeyStore = exports.Utils = exports.Errors = exports.Enums = exports.WorkflowHandle = exports.workflow = exports.Worker = exports.Entity = exports.Search = exports.proxyActivities = exports.Connection = exports.Client = exports.
|
|
26
|
+
exports.Types = exports.KeyStore = exports.Utils = exports.Errors = exports.Enums = exports.WorkflowHandle = exports.workflow = exports.Worker = exports.Entity = exports.Search = exports.proxyActivities = exports.Connection = exports.Client = exports.DBA = exports.Durable = exports.Virtual = exports.HotMesh = exports.ConnectorPostgres = exports.ConnectorNATS = exports.Connector = void 0;
|
|
27
27
|
const hotmesh_1 = require("./services/hotmesh");
|
|
28
28
|
Object.defineProperty(exports, "HotMesh", { enumerable: true, get: function () { return hotmesh_1.HotMesh; } });
|
|
29
|
-
const
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
const
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
const
|
|
29
|
+
const virtual_1 = require("./services/virtual");
|
|
30
|
+
Object.defineProperty(exports, "Virtual", { enumerable: true, get: function () { return virtual_1.Virtual; } });
|
|
31
|
+
const durable_1 = require("./services/durable");
|
|
32
|
+
Object.defineProperty(exports, "Durable", { enumerable: true, get: function () { return durable_1.Durable; } });
|
|
33
|
+
const dba_1 = require("./services/dba");
|
|
34
|
+
Object.defineProperty(exports, "DBA", { enumerable: true, get: function () { return dba_1.DBA; } });
|
|
35
|
+
const client_1 = require("./services/durable/client");
|
|
34
36
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.ClientService; } });
|
|
35
|
-
const connection_1 = require("./services/
|
|
37
|
+
const connection_1 = require("./services/durable/connection");
|
|
36
38
|
Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return connection_1.ConnectionService; } });
|
|
37
|
-
const search_1 = require("./services/
|
|
39
|
+
const search_1 = require("./services/durable/search");
|
|
38
40
|
Object.defineProperty(exports, "Search", { enumerable: true, get: function () { return search_1.Search; } });
|
|
39
|
-
const entity_1 = require("./services/
|
|
41
|
+
const entity_1 = require("./services/durable/entity");
|
|
40
42
|
Object.defineProperty(exports, "Entity", { enumerable: true, get: function () { return entity_1.Entity; } });
|
|
41
|
-
const worker_1 = require("./services/
|
|
43
|
+
const worker_1 = require("./services/durable/worker");
|
|
42
44
|
Object.defineProperty(exports, "Worker", { enumerable: true, get: function () { return worker_1.WorkerService; } });
|
|
43
|
-
const workflow_1 = require("./services/
|
|
45
|
+
const workflow_1 = require("./services/durable/workflow");
|
|
44
46
|
Object.defineProperty(exports, "workflow", { enumerable: true, get: function () { return workflow_1.WorkflowService; } });
|
|
45
|
-
const handle_1 = require("./services/
|
|
47
|
+
const handle_1 = require("./services/durable/handle");
|
|
46
48
|
Object.defineProperty(exports, "WorkflowHandle", { enumerable: true, get: function () { return handle_1.WorkflowHandleService; } });
|
|
47
|
-
const proxyActivities_1 = require("./services/
|
|
49
|
+
const proxyActivities_1 = require("./services/durable/workflow/proxyActivities");
|
|
48
50
|
Object.defineProperty(exports, "proxyActivities", { enumerable: true, get: function () { return proxyActivities_1.proxyActivities; } });
|
|
49
51
|
const Errors = __importStar(require("./modules/errors"));
|
|
50
52
|
exports.Errors = Errors;
|
package/build/modules/enums.d.ts
CHANGED
|
@@ -11,10 +11,6 @@ export declare const HMSH_TELEMETRY: "debug" | "info";
|
|
|
11
11
|
* Default cleanup time for signal in the db when its associated job is completed.
|
|
12
12
|
*/
|
|
13
13
|
export declare const HMSH_SIGNAL_EXPIRE = 3600;
|
|
14
|
-
/**
|
|
15
|
-
* Determines if the system is running in cluster mode (for Redis cluster support).
|
|
16
|
-
*/
|
|
17
|
-
export declare const HMSH_IS_CLUSTER: boolean;
|
|
18
14
|
export declare const HMSH_CODE_SUCCESS = 200;
|
|
19
15
|
export declare const HMSH_CODE_PENDING = 202;
|
|
20
16
|
export declare const HMSH_CODE_NOTFOUND = 404;
|
|
@@ -23,43 +19,43 @@ export declare const HMSH_CODE_UNKNOWN = 500;
|
|
|
23
19
|
export declare const HMSH_CODE_TIMEOUT = 504;
|
|
24
20
|
export declare const HMSH_CODE_UNACKED = 999;
|
|
25
21
|
/**
|
|
26
|
-
* This is thrown when a
|
|
22
|
+
* This is thrown when a Durable has been interrupted by a sleepFor call.
|
|
27
23
|
*/
|
|
28
|
-
export declare const
|
|
24
|
+
export declare const HMSH_CODE_DURABLE_SLEEP = 588;
|
|
29
25
|
/**
|
|
30
|
-
* This is thrown when a
|
|
26
|
+
* This is thrown when a Durable has been interrupted by a Promise.all call.
|
|
31
27
|
*/
|
|
32
|
-
export declare const
|
|
28
|
+
export declare const HMSH_CODE_DURABLE_ALL = 589;
|
|
33
29
|
/**
|
|
34
|
-
* This is thrown when a
|
|
30
|
+
* This is thrown when a Durable has been interrupted by an execChild or startChild call.
|
|
35
31
|
*/
|
|
36
|
-
export declare const
|
|
32
|
+
export declare const HMSH_CODE_DURABLE_CHILD = 590;
|
|
37
33
|
/**
|
|
38
|
-
* This is thrown when a
|
|
34
|
+
* This is thrown when a Durable has been interrupted by a proxyActivity call.
|
|
39
35
|
*/
|
|
40
|
-
export declare const
|
|
36
|
+
export declare const HMSH_CODE_DURABLE_PROXY = 591;
|
|
41
37
|
/**
|
|
42
|
-
* This is thrown when a
|
|
38
|
+
* This is thrown when a Durable has been interrupted by a waitForSignal call.
|
|
43
39
|
*/
|
|
44
|
-
export declare const
|
|
40
|
+
export declare const HMSH_CODE_DURABLE_WAIT = 595;
|
|
45
41
|
/**
|
|
46
|
-
* The timeout status code for
|
|
42
|
+
* The timeout status code for Durable. This status code is thrown when Durable has encountered a timeout error and needs to aler the caller why the call failed.
|
|
47
43
|
*/
|
|
48
|
-
export declare const
|
|
44
|
+
export declare const HMSH_CODE_DURABLE_TIMEOUT = 596;
|
|
49
45
|
/**
|
|
50
|
-
* The maxed status code for
|
|
46
|
+
* The maxed status code for Durable. This status code is used to indicate that the Durable has reached the maximum
|
|
51
47
|
* number of attempts and should be halted. Thrown from a proxied activity or a flow to halt standard execution
|
|
52
48
|
* and prevent further attempts.
|
|
53
49
|
*/
|
|
54
|
-
export declare const
|
|
50
|
+
export declare const HMSH_CODE_DURABLE_MAXED = 597;
|
|
55
51
|
/**
|
|
56
|
-
* The fatal status code for
|
|
52
|
+
* The fatal status code for Durable. This status code is used to indicate that the Durable has encountered a fatal error. Throw from a proxied activity or a flow to halt standard execution.
|
|
57
53
|
*/
|
|
58
|
-
export declare const
|
|
54
|
+
export declare const HMSH_CODE_DURABLE_FATAL = 598;
|
|
59
55
|
/**
|
|
60
|
-
* The retryable status code for
|
|
56
|
+
* The retryable status code for Durable. This status code is used to indicate that the Durable has encountered a retryable error (essentially unknown and covered by the standard retry policy).
|
|
61
57
|
*/
|
|
62
|
-
export declare const
|
|
58
|
+
export declare const HMSH_CODE_DURABLE_RETRYABLE = 599;
|
|
63
59
|
export declare const HMSH_STATUS_UNKNOWN = "unknown";
|
|
64
60
|
/**
|
|
65
61
|
* The number of cycles to re/try for a quorum to be established.
|
|
@@ -85,20 +81,20 @@ export declare const HMSH_MAX_RETRIES: number;
|
|
|
85
81
|
export declare const HMSH_MAX_TIMEOUT_MS: number;
|
|
86
82
|
export declare const HMSH_GRADUATED_INTERVAL_MS: number;
|
|
87
83
|
/**
|
|
88
|
-
* The maximum number of attempts to retry a
|
|
84
|
+
* The maximum number of attempts to retry a Durable job before it is considered failed.
|
|
89
85
|
* @default 3
|
|
90
86
|
*/
|
|
91
|
-
export declare const
|
|
87
|
+
export declare const HMSH_DURABLE_MAX_ATTEMPTS = 3;
|
|
92
88
|
/**
|
|
93
|
-
* The maximum interval to wait before retrying a
|
|
89
|
+
* The maximum interval to wait before retrying a Durable job.
|
|
94
90
|
* @default 120s
|
|
95
91
|
*/
|
|
96
|
-
export declare const
|
|
92
|
+
export declare const HMSH_DURABLE_MAX_INTERVAL = "120s";
|
|
97
93
|
/**
|
|
98
94
|
* The exponential backoff factor to apply to the interval between retries.
|
|
99
95
|
* @default 10
|
|
100
96
|
*/
|
|
101
|
-
export declare const
|
|
97
|
+
export declare const HMSH_DURABLE_EXP_BACKOFF = 10;
|
|
102
98
|
export declare const HMSH_BLOCK_TIME_MS: number;
|
|
103
99
|
export declare const HMSH_XCLAIM_DELAY_MS: number;
|
|
104
100
|
export declare const HMSH_XCLAIM_COUNT: number;
|
|
@@ -124,10 +120,3 @@ export declare const HMSH_NOTIFY_PAYLOAD_LIMIT: number;
|
|
|
124
120
|
* Used when LISTEN/NOTIFY is unavailable or fails. Default 30 seconds.
|
|
125
121
|
*/
|
|
126
122
|
export declare const HMSH_ROUTER_POLL_FALLBACK_INTERVAL: number;
|
|
127
|
-
/**
|
|
128
|
-
* Serializer compression threshold. When a stringified object exceeds this size
|
|
129
|
-
* in bytes, it will be gzipped and base64 encoded (with /b prefix) to reduce
|
|
130
|
-
* Redis hash storage size. Default 100 bytes - small enough to catch most
|
|
131
|
-
* workflow state but compression only applies if it actually reduces size.
|
|
132
|
-
*/
|
|
133
|
-
export declare const HMSH_SERIALIZER_COMPRESSION_THRESHOLD: number;
|
package/build/modules/enums.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HMSH_NOTIFY_PAYLOAD_LIMIT = exports.DEFAULT_TASK_QUEUE = exports.HMSH_GUID_SIZE = exports.HMSH_ROUTER_SCOUT_INTERVAL_MS = exports.HMSH_ROUTER_SCOUT_INTERVAL_SECONDS = exports.HMSH_SCOUT_INTERVAL_SECONDS = exports.HMSH_FIDELITY_SECONDS = exports.HMSH_EXPIRE_DURATION = exports.HMSH_XPENDING_COUNT = exports.HMSH_XCLAIM_COUNT = exports.HMSH_XCLAIM_DELAY_MS = exports.HMSH_BLOCK_TIME_MS = exports.
|
|
4
|
-
exports.HMSH_SERIALIZER_COMPRESSION_THRESHOLD = exports.HMSH_ROUTER_POLL_FALLBACK_INTERVAL = void 0;
|
|
3
|
+
exports.HMSH_ROUTER_POLL_FALLBACK_INTERVAL = exports.HMSH_NOTIFY_PAYLOAD_LIMIT = exports.DEFAULT_TASK_QUEUE = exports.HMSH_GUID_SIZE = exports.HMSH_ROUTER_SCOUT_INTERVAL_MS = exports.HMSH_ROUTER_SCOUT_INTERVAL_SECONDS = exports.HMSH_SCOUT_INTERVAL_SECONDS = exports.HMSH_FIDELITY_SECONDS = exports.HMSH_EXPIRE_DURATION = exports.HMSH_XPENDING_COUNT = exports.HMSH_XCLAIM_COUNT = exports.HMSH_XCLAIM_DELAY_MS = exports.HMSH_BLOCK_TIME_MS = exports.HMSH_DURABLE_EXP_BACKOFF = exports.HMSH_DURABLE_MAX_INTERVAL = exports.HMSH_DURABLE_MAX_ATTEMPTS = exports.HMSH_GRADUATED_INTERVAL_MS = exports.HMSH_MAX_TIMEOUT_MS = exports.HMSH_MAX_RETRIES = exports.MAX_DELAY = exports.MAX_STREAM_RETRIES = exports.INITIAL_STREAM_BACKOFF = exports.MAX_STREAM_BACKOFF = exports.HMSH_EXPIRE_JOB_SECONDS = exports.HMSH_OTT_WAIT_TIME = exports.HMSH_DEPLOYMENT_PAUSE = exports.HMSH_DEPLOYMENT_DELAY = exports.HMSH_ACTIVATION_MAX_RETRY = exports.HMSH_QUORUM_DELAY_MS = exports.HMSH_QUORUM_ROLLCALL_CYCLES = exports.HMSH_STATUS_UNKNOWN = exports.HMSH_CODE_DURABLE_RETRYABLE = exports.HMSH_CODE_DURABLE_FATAL = exports.HMSH_CODE_DURABLE_MAXED = exports.HMSH_CODE_DURABLE_TIMEOUT = exports.HMSH_CODE_DURABLE_WAIT = exports.HMSH_CODE_DURABLE_PROXY = exports.HMSH_CODE_DURABLE_CHILD = exports.HMSH_CODE_DURABLE_ALL = exports.HMSH_CODE_DURABLE_SLEEP = exports.HMSH_CODE_UNACKED = exports.HMSH_CODE_TIMEOUT = exports.HMSH_CODE_UNKNOWN = exports.HMSH_CODE_INTERRUPT = exports.HMSH_CODE_NOTFOUND = exports.HMSH_CODE_PENDING = exports.HMSH_CODE_SUCCESS = exports.HMSH_SIGNAL_EXPIRE = exports.HMSH_TELEMETRY = exports.HMSH_LOGLEVEL = void 0;
|
|
5
4
|
/**
|
|
6
5
|
* Determines the log level for the application. The default is 'info'.
|
|
7
6
|
*/
|
|
@@ -14,10 +13,6 @@ exports.HMSH_TELEMETRY = process.env.HMSH_TELEMETRY || 'info';
|
|
|
14
13
|
* Default cleanup time for signal in the db when its associated job is completed.
|
|
15
14
|
*/
|
|
16
15
|
exports.HMSH_SIGNAL_EXPIRE = 3600; //seconds
|
|
17
|
-
/**
|
|
18
|
-
* Determines if the system is running in cluster mode (for Redis cluster support).
|
|
19
|
-
*/
|
|
20
|
-
exports.HMSH_IS_CLUSTER = process.env.HMSH_IS_CLUSTER === 'true';
|
|
21
16
|
// HOTMESH STATUS CODES
|
|
22
17
|
exports.HMSH_CODE_SUCCESS = 200;
|
|
23
18
|
exports.HMSH_CODE_PENDING = 202;
|
|
@@ -26,45 +21,45 @@ exports.HMSH_CODE_INTERRUPT = 410;
|
|
|
26
21
|
exports.HMSH_CODE_UNKNOWN = 500;
|
|
27
22
|
exports.HMSH_CODE_TIMEOUT = 504;
|
|
28
23
|
exports.HMSH_CODE_UNACKED = 999;
|
|
29
|
-
//
|
|
24
|
+
// DURABLE STATUS CODES
|
|
30
25
|
/**
|
|
31
|
-
* This is thrown when a
|
|
26
|
+
* This is thrown when a Durable has been interrupted by a sleepFor call.
|
|
32
27
|
*/
|
|
33
|
-
exports.
|
|
28
|
+
exports.HMSH_CODE_DURABLE_SLEEP = 588;
|
|
34
29
|
/**
|
|
35
|
-
* This is thrown when a
|
|
30
|
+
* This is thrown when a Durable has been interrupted by a Promise.all call.
|
|
36
31
|
*/
|
|
37
|
-
exports.
|
|
32
|
+
exports.HMSH_CODE_DURABLE_ALL = 589;
|
|
38
33
|
/**
|
|
39
|
-
* This is thrown when a
|
|
34
|
+
* This is thrown when a Durable has been interrupted by an execChild or startChild call.
|
|
40
35
|
*/
|
|
41
|
-
exports.
|
|
36
|
+
exports.HMSH_CODE_DURABLE_CHILD = 590;
|
|
42
37
|
/**
|
|
43
|
-
* This is thrown when a
|
|
38
|
+
* This is thrown when a Durable has been interrupted by a proxyActivity call.
|
|
44
39
|
*/
|
|
45
|
-
exports.
|
|
40
|
+
exports.HMSH_CODE_DURABLE_PROXY = 591;
|
|
46
41
|
/**
|
|
47
|
-
* This is thrown when a
|
|
42
|
+
* This is thrown when a Durable has been interrupted by a waitForSignal call.
|
|
48
43
|
*/
|
|
49
|
-
exports.
|
|
44
|
+
exports.HMSH_CODE_DURABLE_WAIT = 595;
|
|
50
45
|
/**
|
|
51
|
-
* The timeout status code for
|
|
46
|
+
* The timeout status code for Durable. This status code is thrown when Durable has encountered a timeout error and needs to aler the caller why the call failed.
|
|
52
47
|
*/
|
|
53
|
-
exports.
|
|
48
|
+
exports.HMSH_CODE_DURABLE_TIMEOUT = 596;
|
|
54
49
|
/**
|
|
55
|
-
* The maxed status code for
|
|
50
|
+
* The maxed status code for Durable. This status code is used to indicate that the Durable has reached the maximum
|
|
56
51
|
* number of attempts and should be halted. Thrown from a proxied activity or a flow to halt standard execution
|
|
57
52
|
* and prevent further attempts.
|
|
58
53
|
*/
|
|
59
|
-
exports.
|
|
54
|
+
exports.HMSH_CODE_DURABLE_MAXED = 597;
|
|
60
55
|
/**
|
|
61
|
-
* The fatal status code for
|
|
56
|
+
* The fatal status code for Durable. This status code is used to indicate that the Durable has encountered a fatal error. Throw from a proxied activity or a flow to halt standard execution.
|
|
62
57
|
*/
|
|
63
|
-
exports.
|
|
58
|
+
exports.HMSH_CODE_DURABLE_FATAL = 598;
|
|
64
59
|
/**
|
|
65
|
-
* The retryable status code for
|
|
60
|
+
* The retryable status code for Durable. This status code is used to indicate that the Durable has encountered a retryable error (essentially unknown and covered by the standard retry policy).
|
|
66
61
|
*/
|
|
67
|
-
exports.
|
|
62
|
+
exports.HMSH_CODE_DURABLE_RETRYABLE = 599;
|
|
68
63
|
// HOTMESH MESSAGES
|
|
69
64
|
exports.HMSH_STATUS_UNKNOWN = 'unknown';
|
|
70
65
|
// QUORUM
|
|
@@ -94,22 +89,22 @@ exports.MAX_DELAY = 2147483647; // Maximum allowed delay in milliseconds for set
|
|
|
94
89
|
exports.HMSH_MAX_RETRIES = parseInt(process.env.HMSH_MAX_RETRIES, 10) || 3;
|
|
95
90
|
exports.HMSH_MAX_TIMEOUT_MS = parseInt(process.env.HMSH_MAX_TIMEOUT_MS, 10) || 60000;
|
|
96
91
|
exports.HMSH_GRADUATED_INTERVAL_MS = parseInt(process.env.HMSH_GRADUATED_INTERVAL_MS, 10) || 5000;
|
|
97
|
-
//
|
|
92
|
+
// DURABLE
|
|
98
93
|
/**
|
|
99
|
-
* The maximum number of attempts to retry a
|
|
94
|
+
* The maximum number of attempts to retry a Durable job before it is considered failed.
|
|
100
95
|
* @default 3
|
|
101
96
|
*/
|
|
102
|
-
exports.
|
|
97
|
+
exports.HMSH_DURABLE_MAX_ATTEMPTS = 3;
|
|
103
98
|
/**
|
|
104
|
-
* The maximum interval to wait before retrying a
|
|
99
|
+
* The maximum interval to wait before retrying a Durable job.
|
|
105
100
|
* @default 120s
|
|
106
101
|
*/
|
|
107
|
-
exports.
|
|
102
|
+
exports.HMSH_DURABLE_MAX_INTERVAL = '120s';
|
|
108
103
|
/**
|
|
109
104
|
* The exponential backoff factor to apply to the interval between retries.
|
|
110
105
|
* @default 10
|
|
111
106
|
*/
|
|
112
|
-
exports.
|
|
107
|
+
exports.HMSH_DURABLE_EXP_BACKOFF = 10;
|
|
113
108
|
const BASE_BLOCK_DURATION = 10000;
|
|
114
109
|
const TEST_BLOCK_DURATION = 1000;
|
|
115
110
|
exports.HMSH_BLOCK_TIME_MS = process.env.HMSH_BLOCK_TIME_MS
|
|
@@ -156,10 +151,3 @@ exports.HMSH_NOTIFY_PAYLOAD_LIMIT = parseInt(process.env.HMSH_NOTIFY_PAYLOAD_LIM
|
|
|
156
151
|
* Used when LISTEN/NOTIFY is unavailable or fails. Default 30 seconds.
|
|
157
152
|
*/
|
|
158
153
|
exports.HMSH_ROUTER_POLL_FALLBACK_INTERVAL = parseInt(process.env.HOTMESH_POSTGRES_FALLBACK_INTERVAL, 10) || 30000;
|
|
159
|
-
/**
|
|
160
|
-
* Serializer compression threshold. When a stringified object exceeds this size
|
|
161
|
-
* in bytes, it will be gzipped and base64 encoded (with /b prefix) to reduce
|
|
162
|
-
* Redis hash storage size. Default 100 bytes - small enough to catch most
|
|
163
|
-
* workflow state but compression only applies if it actually reduces size.
|
|
164
|
-
*/
|
|
165
|
-
exports.HMSH_SERIALIZER_COMPRESSION_THRESHOLD = parseInt(process.env.HMSH_SERIALIZER_COMPRESSION_THRESHOLD, 10) || 100000000;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActivityDuplex } from '../types/activity';
|
|
2
2
|
import { CollationFaultType, CollationStage } from '../types/collator';
|
|
3
|
-
import {
|
|
3
|
+
import { DurableChildErrorType, DurableProxyErrorType, DurableSleepErrorType, DurableWaitForAllErrorType, DurableWaitForErrorType } from '../types/error';
|
|
4
4
|
declare class GetStateError extends Error {
|
|
5
5
|
jobId: string;
|
|
6
6
|
code: number;
|
|
@@ -9,16 +9,16 @@ declare class GetStateError extends Error {
|
|
|
9
9
|
declare class SetStateError extends Error {
|
|
10
10
|
constructor();
|
|
11
11
|
}
|
|
12
|
-
declare class
|
|
12
|
+
declare class DurableWaitForError extends Error {
|
|
13
13
|
code: number;
|
|
14
14
|
signalId: string;
|
|
15
15
|
workflowId: string;
|
|
16
16
|
index: number;
|
|
17
17
|
workflowDimension: string;
|
|
18
18
|
type: string;
|
|
19
|
-
constructor(params:
|
|
19
|
+
constructor(params: DurableWaitForErrorType);
|
|
20
20
|
}
|
|
21
|
-
declare class
|
|
21
|
+
declare class DurableProxyError extends Error {
|
|
22
22
|
activityName: string;
|
|
23
23
|
arguments: string[];
|
|
24
24
|
backoffCoefficient: number;
|
|
@@ -33,9 +33,9 @@ declare class MemFlowProxyError extends Error {
|
|
|
33
33
|
workflowId: string;
|
|
34
34
|
workflowTopic: string;
|
|
35
35
|
type: string;
|
|
36
|
-
constructor(params:
|
|
36
|
+
constructor(params: DurableProxyErrorType);
|
|
37
37
|
}
|
|
38
|
-
declare class
|
|
38
|
+
declare class DurableChildError extends Error {
|
|
39
39
|
await: boolean;
|
|
40
40
|
entity: string;
|
|
41
41
|
arguments: string[];
|
|
@@ -53,9 +53,9 @@ declare class MemFlowChildError extends Error {
|
|
|
53
53
|
workflowId: string;
|
|
54
54
|
workflowTopic: string;
|
|
55
55
|
type: string;
|
|
56
|
-
constructor(params:
|
|
56
|
+
constructor(params: DurableChildErrorType);
|
|
57
57
|
}
|
|
58
|
-
declare class
|
|
58
|
+
declare class DurableWaitForAllError extends Error {
|
|
59
59
|
items: any[];
|
|
60
60
|
code: number;
|
|
61
61
|
workflowDimension: string;
|
|
@@ -66,33 +66,33 @@ declare class MemFlowWaitForAllError extends Error {
|
|
|
66
66
|
workflowId: string;
|
|
67
67
|
workflowTopic: string;
|
|
68
68
|
type: string;
|
|
69
|
-
constructor(params:
|
|
69
|
+
constructor(params: DurableWaitForAllErrorType);
|
|
70
70
|
}
|
|
71
|
-
declare class
|
|
71
|
+
declare class DurableSleepError extends Error {
|
|
72
72
|
workflowId: string;
|
|
73
73
|
code: number;
|
|
74
74
|
duration: number;
|
|
75
75
|
index: number;
|
|
76
76
|
workflowDimension: string;
|
|
77
77
|
type: string;
|
|
78
|
-
constructor(params:
|
|
78
|
+
constructor(params: DurableSleepErrorType);
|
|
79
79
|
}
|
|
80
|
-
declare class
|
|
80
|
+
declare class DurableTimeoutError extends Error {
|
|
81
81
|
code: number;
|
|
82
82
|
type: string;
|
|
83
83
|
constructor(message: string, stack?: string);
|
|
84
84
|
}
|
|
85
|
-
declare class
|
|
85
|
+
declare class DurableMaxedError extends Error {
|
|
86
86
|
code: number;
|
|
87
87
|
type: string;
|
|
88
88
|
constructor(message: string, stackTrace?: string);
|
|
89
89
|
}
|
|
90
|
-
declare class
|
|
90
|
+
declare class DurableFatalError extends Error {
|
|
91
91
|
code: number;
|
|
92
92
|
type: string;
|
|
93
93
|
constructor(message: string, stackTrace?: string);
|
|
94
94
|
}
|
|
95
|
-
declare class
|
|
95
|
+
declare class DurableRetryError extends Error {
|
|
96
96
|
code: number;
|
|
97
97
|
type: string;
|
|
98
98
|
constructor(message: string, stackTrace?: string);
|
|
@@ -131,4 +131,4 @@ declare class CollationError extends Error {
|
|
|
131
131
|
fault: CollationFaultType;
|
|
132
132
|
constructor(status: number, leg: ActivityDuplex, stage: CollationStage, fault?: CollationFaultType);
|
|
133
133
|
}
|
|
134
|
-
export { CollationError,
|
|
134
|
+
export { CollationError, DurableChildError, DurableFatalError, DurableMaxedError, DurableProxyError, DurableRetryError, DurableSleepError, DurableTimeoutError, DurableWaitForAllError, DurableWaitForError, DuplicateJobError, ExecActivityError, GenerationalError, GetStateError, InactiveJobError, MapDataError, RegisterTimeoutError, SetStateError, };
|