@hotmeshio/hotmesh 0.9.0 → 0.10.0

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 (96) hide show
  1. package/README.md +38 -23
  2. package/build/index.d.ts +12 -11
  3. package/build/index.js +15 -13
  4. package/build/modules/enums.d.ts +23 -34
  5. package/build/modules/enums.js +26 -38
  6. package/build/modules/errors.d.ts +16 -16
  7. package/build/modules/errors.js +37 -37
  8. package/build/package.json +23 -22
  9. package/build/services/activities/activity.js +1 -1
  10. package/build/services/dba/index.d.ts +171 -0
  11. package/build/services/dba/index.js +280 -0
  12. package/build/services/{memflow → durable}/client.d.ts +3 -3
  13. package/build/services/{memflow → durable}/client.js +13 -13
  14. package/build/services/{memflow → durable}/connection.d.ts +2 -2
  15. package/build/services/{memflow → durable}/connection.js +1 -1
  16. package/build/services/{memflow → durable}/exporter.d.ts +6 -6
  17. package/build/services/{memflow → durable}/exporter.js +2 -2
  18. package/build/services/{memflow → durable}/handle.d.ts +4 -4
  19. package/build/services/{memflow → durable}/handle.js +2 -2
  20. package/build/services/{memflow → durable}/index.d.ts +125 -33
  21. package/build/services/{memflow → durable}/index.js +145 -49
  22. package/build/services/{memflow → durable}/interceptor.d.ts +45 -22
  23. package/build/services/{memflow → durable}/interceptor.js +54 -21
  24. package/build/services/{memflow → durable}/schemas/factory.d.ts +4 -4
  25. package/build/services/{memflow → durable}/schemas/factory.js +5 -5
  26. package/build/services/{memflow → durable}/search.d.ts +1 -1
  27. package/build/services/{memflow → durable}/search.js +4 -4
  28. package/build/services/{memflow → durable}/worker.d.ts +11 -11
  29. package/build/services/{memflow → durable}/worker.js +61 -60
  30. package/build/services/{memflow → durable}/workflow/all.d.ts +5 -5
  31. package/build/services/{memflow → durable}/workflow/all.js +5 -5
  32. package/build/services/{memflow → durable}/workflow/common.d.ts +5 -5
  33. package/build/services/durable/workflow/common.js +47 -0
  34. package/build/services/{memflow → durable}/workflow/context.d.ts +5 -5
  35. package/build/services/{memflow → durable}/workflow/context.js +5 -5
  36. package/build/services/{memflow → durable}/workflow/emit.d.ts +5 -5
  37. package/build/services/{memflow → durable}/workflow/emit.js +5 -5
  38. package/build/services/{memflow → durable}/workflow/enrich.d.ts +4 -4
  39. package/build/services/{memflow → durable}/workflow/enrich.js +4 -4
  40. package/build/services/{memflow → durable}/workflow/entityMethods.d.ts +4 -4
  41. package/build/services/{memflow → durable}/workflow/entityMethods.js +4 -4
  42. package/build/services/{memflow → durable}/workflow/execChild.d.ts +9 -9
  43. package/build/services/{memflow → durable}/workflow/execChild.js +22 -22
  44. package/build/services/{memflow → durable}/workflow/execHook.d.ts +8 -8
  45. package/build/services/{memflow → durable}/workflow/execHook.js +10 -10
  46. package/build/services/{memflow → durable}/workflow/execHookBatch.d.ts +5 -5
  47. package/build/services/{memflow → durable}/workflow/execHookBatch.js +8 -8
  48. package/build/services/{memflow → durable}/workflow/hook.d.ts +5 -5
  49. package/build/services/{memflow → durable}/workflow/hook.js +11 -11
  50. package/build/services/{memflow → durable}/workflow/index.d.ts +6 -6
  51. package/build/services/{memflow → durable}/workflow/index.js +6 -6
  52. package/build/services/{memflow → durable}/workflow/interrupt.d.ts +7 -7
  53. package/build/services/{memflow → durable}/workflow/interrupt.js +7 -7
  54. package/build/services/{memflow → durable}/workflow/interruption.d.ts +10 -10
  55. package/build/services/{memflow → durable}/workflow/interruption.js +19 -19
  56. package/build/services/{memflow → durable}/workflow/proxyActivities.d.ts +7 -7
  57. package/build/services/{memflow → durable}/workflow/proxyActivities.js +31 -21
  58. package/build/services/{memflow → durable}/workflow/random.d.ts +4 -4
  59. package/build/services/{memflow → durable}/workflow/random.js +4 -4
  60. package/build/services/{memflow → durable}/workflow/searchMethods.d.ts +5 -5
  61. package/build/services/{memflow → durable}/workflow/searchMethods.js +5 -5
  62. package/build/services/{memflow → durable}/workflow/signal.d.ts +8 -8
  63. package/build/services/{memflow → durable}/workflow/signal.js +8 -8
  64. package/build/services/{memflow → durable}/workflow/sleepFor.d.ts +7 -7
  65. package/build/services/{memflow → durable}/workflow/sleepFor.js +10 -10
  66. package/build/services/{memflow → durable}/workflow/trace.d.ts +5 -5
  67. package/build/services/{memflow → durable}/workflow/trace.js +5 -5
  68. package/build/services/{memflow → durable}/workflow/waitFor.d.ts +9 -9
  69. package/build/services/{memflow → durable}/workflow/waitFor.js +12 -12
  70. package/build/services/hotmesh/index.d.ts +3 -3
  71. package/build/services/hotmesh/index.js +3 -3
  72. package/build/services/{meshcall → virtual}/index.d.ts +29 -29
  73. package/build/services/{meshcall → virtual}/index.js +49 -49
  74. package/build/services/{meshcall → virtual}/schemas/factory.d.ts +1 -1
  75. package/build/services/{meshcall → virtual}/schemas/factory.js +1 -1
  76. package/build/types/dba.d.ts +64 -0
  77. package/build/types/{memflow.d.ts → durable.d.ts} +74 -18
  78. package/build/types/error.d.ts +5 -5
  79. package/build/types/exporter.d.ts +1 -1
  80. package/build/types/index.d.ts +5 -4
  81. package/build/types/{meshcall.d.ts → virtual.d.ts} +15 -15
  82. package/build/types/virtual.js +2 -0
  83. package/index.ts +15 -13
  84. package/package.json +23 -22
  85. package/.claude/settings.local.json +0 -8
  86. package/build/services/memflow/workflow/common.js +0 -47
  87. package/build/vitest.config.d.ts +0 -2
  88. package/build/vitest.config.js +0 -18
  89. /package/build/services/{memflow → durable}/entity.d.ts +0 -0
  90. /package/build/services/{memflow → durable}/entity.js +0 -0
  91. /package/build/services/{memflow → durable}/workflow/didRun.d.ts +0 -0
  92. /package/build/services/{memflow → durable}/workflow/didRun.js +0 -0
  93. /package/build/services/{memflow → durable}/workflow/isSideEffectAllowed.d.ts +0 -0
  94. /package/build/services/{memflow → durable}/workflow/isSideEffectAllowed.js +0 -0
  95. /package/build/types/{memflow.js → dba.js} +0 -0
  96. /package/build/types/{meshcall.js → durable.js} +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 replacement** — MemFlow provides a Temporal-compatible API that runs directly on Postgres. No app server required.
14
+ - **Temporal replacement** — 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
- Start Postgres locally (or use an existing instance), then:
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 (and NATS, if needed):
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 postgres
35
+ docker compose up -d
38
36
  ```
39
37
 
40
- Then follow the [Quick Start guide](./docs/quickstart.md) for a progressive walkthrough — from a single trigger to conditional, parallel, and compositional workflows.
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 { MemFlow } from '@hotmeshio/hotmesh';
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
- MemFlow.workflow.proxyActivities<typeof activities>({
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 MemFlow.registerActivityWorker({
88
+ await Durable.registerActivityWorker({
91
89
  connection,
92
90
  taskQueue: 'inventory-tasks'
93
91
  }, activities, 'inventory-activities');
94
92
 
95
- await MemFlow.Worker.create({
93
+ await Durable.Worker.create({
96
94
  connection,
97
95
  taskQueue: 'orders',
98
96
  workflow: orderWorkflow
99
97
  });
100
98
 
101
- const client = new MemFlow.Client({ connection });
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). MemFlow methods are available as static imports:
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 { MemFlow } from '@hotmeshio/hotmesh';
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 MemFlow.workflow.sleepFor('30 days');
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 MemFlow.workflow.startChild(validateOrder, {
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 MemFlow.workflow.waitFor<{ approved: boolean }>('manager-approval');
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
- // MemFlow: per-activity retry policy
254
- const { reserveItem } = MemFlow.workflow.proxyActivities<typeof activities>({
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
- ## It's just data
284
+ ## Workflow state is queryable data
287
285
 
288
- There is nothing between you and your data. 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.
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 (Jaeger, Datadog, etc.).
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,12 +333,29 @@ For a deep dive into the transactional execution model — how every step is cra
335
333
 
336
334
  ## Familiar with Temporal?
337
335
 
338
- MemFlow is designed as a drop-in-compatible alternative for common Temporal patterns.
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
340
  **What's different:** No Temporal server or cluster to operate. Postgres is the only infrastructure dependency — it stores state, coordinates workers, and delivers messages. HotMesh also offers a YAML-based approach for declarative workflows that compile to the same execution model.
343
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
+ ```
358
+
344
359
  ## License
345
360
 
346
361
  HotMesh is source-available under the [HotMesh Source Available License](./LICENSE).
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 { MeshCall } from './services/meshcall';
4
- import { MemFlow } from './services/memflow';
5
- import { ClientService as Client } from './services/memflow/client';
6
- import { ConnectionService as Connection } from './services/memflow/connection';
7
- import { Search } from './services/memflow/search';
8
- import { Entity } from './services/memflow/entity';
9
- import { WorkerService as Worker } from './services/memflow/worker';
10
- import { WorkflowService as workflow } from './services/memflow/workflow';
11
- import { WorkflowHandleService as WorkflowHandle } from './services/memflow/handle';
12
- import { proxyActivities } from './services/memflow/workflow/proxyActivities';
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, MeshCall, MemFlow, Client, Connection, proxyActivities, Search, Entity, Worker, workflow, WorkflowHandle, Enums, Errors, Utils, KeyStore, };
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.MemFlow = exports.MeshCall = exports.HotMesh = exports.ConnectorPostgres = exports.ConnectorNATS = exports.Connector = void 0;
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 meshcall_1 = require("./services/meshcall");
30
- Object.defineProperty(exports, "MeshCall", { enumerable: true, get: function () { return meshcall_1.MeshCall; } });
31
- const memflow_1 = require("./services/memflow");
32
- Object.defineProperty(exports, "MemFlow", { enumerable: true, get: function () { return memflow_1.MemFlow; } });
33
- const client_1 = require("./services/memflow/client");
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/memflow/connection");
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/memflow/search");
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/memflow/entity");
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/memflow/worker");
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/memflow/workflow");
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/memflow/handle");
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/memflow/workflow/proxyActivities");
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;
@@ -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 MemFlow has been interrupted by a sleepFor call.
22
+ * This is thrown when a Durable has been interrupted by a sleepFor call.
27
23
  */
28
- export declare const HMSH_CODE_MEMFLOW_SLEEP = 588;
24
+ export declare const HMSH_CODE_DURABLE_SLEEP = 588;
29
25
  /**
30
- * This is thrown when a MemFlow has been interrupted by a Promise.all call.
26
+ * This is thrown when a Durable has been interrupted by a Promise.all call.
31
27
  */
32
- export declare const HMSH_CODE_MEMFLOW_ALL = 589;
28
+ export declare const HMSH_CODE_DURABLE_ALL = 589;
33
29
  /**
34
- * This is thrown when a MemFlow has been interrupted by an execChild or startChild call.
30
+ * This is thrown when a Durable has been interrupted by an execChild or startChild call.
35
31
  */
36
- export declare const HMSH_CODE_MEMFLOW_CHILD = 590;
32
+ export declare const HMSH_CODE_DURABLE_CHILD = 590;
37
33
  /**
38
- * This is thrown when a MemFlow has been interrupted by a proxyActivity call.
34
+ * This is thrown when a Durable has been interrupted by a proxyActivity call.
39
35
  */
40
- export declare const HMSH_CODE_MEMFLOW_PROXY = 591;
36
+ export declare const HMSH_CODE_DURABLE_PROXY = 591;
41
37
  /**
42
- * This is thrown when a MemFlow has been interrupted by a waitForSignal call.
38
+ * This is thrown when a Durable has been interrupted by a waitForSignal call.
43
39
  */
44
- export declare const HMSH_CODE_MEMFLOW_WAIT = 595;
40
+ export declare const HMSH_CODE_DURABLE_WAIT = 595;
45
41
  /**
46
- * The timeout status code for MemFlow. This status code is thrown when MemFlow has encountered a timeout error and needs to aler the caller why the call failed.
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 HMSH_CODE_MEMFLOW_TIMEOUT = 596;
44
+ export declare const HMSH_CODE_DURABLE_TIMEOUT = 596;
49
45
  /**
50
- * The maxed status code for MemFlow. This status code is used to indicate that the MemFlow has reached the maximum
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 HMSH_CODE_MEMFLOW_MAXED = 597;
50
+ export declare const HMSH_CODE_DURABLE_MAXED = 597;
55
51
  /**
56
- * The fatal status code for MemFlow. This status code is used to indicate that the MemFlow has encountered a fatal error. Throw from a proxied activity or a flow to halt standard execution.
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 HMSH_CODE_MEMFLOW_FATAL = 598;
54
+ export declare const HMSH_CODE_DURABLE_FATAL = 598;
59
55
  /**
60
- * The retryable status code for MemFlow. This status code is used to indicate that the MemFlow has encountered a retryable error (essentially unknown and covered by the standard retry policy).
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 HMSH_CODE_MEMFLOW_RETRYABLE = 599;
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 MemFlow job before it is considered failed.
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 HMSH_MEMFLOW_MAX_ATTEMPTS = 3;
87
+ export declare const HMSH_DURABLE_MAX_ATTEMPTS = 3;
92
88
  /**
93
- * The maximum interval to wait before retrying a MemFlow job.
89
+ * The maximum interval to wait before retrying a Durable job.
94
90
  * @default 120s
95
91
  */
96
- export declare const HMSH_MEMFLOW_MAX_INTERVAL = "120s";
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 HMSH_MEMFLOW_EXP_BACKOFF = 10;
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;
@@ -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.HMSH_MEMFLOW_EXP_BACKOFF = exports.HMSH_MEMFLOW_MAX_INTERVAL = exports.HMSH_MEMFLOW_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_MEMFLOW_RETRYABLE = exports.HMSH_CODE_MEMFLOW_FATAL = exports.HMSH_CODE_MEMFLOW_MAXED = exports.HMSH_CODE_MEMFLOW_TIMEOUT = exports.HMSH_CODE_MEMFLOW_WAIT = exports.HMSH_CODE_MEMFLOW_PROXY = exports.HMSH_CODE_MEMFLOW_CHILD = exports.HMSH_CODE_MEMFLOW_ALL = exports.HMSH_CODE_MEMFLOW_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_IS_CLUSTER = exports.HMSH_SIGNAL_EXPIRE = exports.HMSH_TELEMETRY = exports.HMSH_LOGLEVEL = void 0;
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
- // MEMFLOW STATUS CODES
24
+ // DURABLE STATUS CODES
30
25
  /**
31
- * This is thrown when a MemFlow has been interrupted by a sleepFor call.
26
+ * This is thrown when a Durable has been interrupted by a sleepFor call.
32
27
  */
33
- exports.HMSH_CODE_MEMFLOW_SLEEP = 588;
28
+ exports.HMSH_CODE_DURABLE_SLEEP = 588;
34
29
  /**
35
- * This is thrown when a MemFlow has been interrupted by a Promise.all call.
30
+ * This is thrown when a Durable has been interrupted by a Promise.all call.
36
31
  */
37
- exports.HMSH_CODE_MEMFLOW_ALL = 589;
32
+ exports.HMSH_CODE_DURABLE_ALL = 589;
38
33
  /**
39
- * This is thrown when a MemFlow has been interrupted by an execChild or startChild call.
34
+ * This is thrown when a Durable has been interrupted by an execChild or startChild call.
40
35
  */
41
- exports.HMSH_CODE_MEMFLOW_CHILD = 590;
36
+ exports.HMSH_CODE_DURABLE_CHILD = 590;
42
37
  /**
43
- * This is thrown when a MemFlow has been interrupted by a proxyActivity call.
38
+ * This is thrown when a Durable has been interrupted by a proxyActivity call.
44
39
  */
45
- exports.HMSH_CODE_MEMFLOW_PROXY = 591;
40
+ exports.HMSH_CODE_DURABLE_PROXY = 591;
46
41
  /**
47
- * This is thrown when a MemFlow has been interrupted by a waitForSignal call.
42
+ * This is thrown when a Durable has been interrupted by a waitForSignal call.
48
43
  */
49
- exports.HMSH_CODE_MEMFLOW_WAIT = 595;
44
+ exports.HMSH_CODE_DURABLE_WAIT = 595;
50
45
  /**
51
- * The timeout status code for MemFlow. This status code is thrown when MemFlow has encountered a timeout error and needs to aler the caller why the call failed.
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.HMSH_CODE_MEMFLOW_TIMEOUT = 596;
48
+ exports.HMSH_CODE_DURABLE_TIMEOUT = 596;
54
49
  /**
55
- * The maxed status code for MemFlow. This status code is used to indicate that the MemFlow has reached the maximum
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.HMSH_CODE_MEMFLOW_MAXED = 597;
54
+ exports.HMSH_CODE_DURABLE_MAXED = 597;
60
55
  /**
61
- * The fatal status code for MemFlow. This status code is used to indicate that the MemFlow has encountered a fatal error. Throw from a proxied activity or a flow to halt standard execution.
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.HMSH_CODE_MEMFLOW_FATAL = 598;
58
+ exports.HMSH_CODE_DURABLE_FATAL = 598;
64
59
  /**
65
- * The retryable status code for MemFlow. This status code is used to indicate that the MemFlow has encountered a retryable error (essentially unknown and covered by the standard retry policy).
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.HMSH_CODE_MEMFLOW_RETRYABLE = 599;
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
- // MEMFLOW
92
+ // DURABLE
98
93
  /**
99
- * The maximum number of attempts to retry a MemFlow job before it is considered failed.
94
+ * The maximum number of attempts to retry a Durable job before it is considered failed.
100
95
  * @default 3
101
96
  */
102
- exports.HMSH_MEMFLOW_MAX_ATTEMPTS = 3;
97
+ exports.HMSH_DURABLE_MAX_ATTEMPTS = 3;
103
98
  /**
104
- * The maximum interval to wait before retrying a MemFlow job.
99
+ * The maximum interval to wait before retrying a Durable job.
105
100
  * @default 120s
106
101
  */
107
- exports.HMSH_MEMFLOW_MAX_INTERVAL = '120s';
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.HMSH_MEMFLOW_EXP_BACKOFF = 10;
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 { MemFlowChildErrorType, MemFlowProxyErrorType, MemFlowSleepErrorType, MemFlowWaitForAllErrorType, MemFlowWaitForErrorType } from '../types/error';
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 MemFlowWaitForError extends Error {
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: MemFlowWaitForErrorType);
19
+ constructor(params: DurableWaitForErrorType);
20
20
  }
21
- declare class MemFlowProxyError extends Error {
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: MemFlowProxyErrorType);
36
+ constructor(params: DurableProxyErrorType);
37
37
  }
38
- declare class MemFlowChildError extends Error {
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: MemFlowChildErrorType);
56
+ constructor(params: DurableChildErrorType);
57
57
  }
58
- declare class MemFlowWaitForAllError extends Error {
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: MemFlowWaitForAllErrorType);
69
+ constructor(params: DurableWaitForAllErrorType);
70
70
  }
71
- declare class MemFlowSleepError extends Error {
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: MemFlowSleepErrorType);
78
+ constructor(params: DurableSleepErrorType);
79
79
  }
80
- declare class MemFlowTimeoutError extends Error {
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 MemFlowMaxedError extends Error {
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 MemFlowFatalError extends Error {
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 MemFlowRetryError extends Error {
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, MemFlowChildError, MemFlowFatalError, MemFlowMaxedError, MemFlowProxyError, MemFlowRetryError, MemFlowSleepError, MemFlowTimeoutError, MemFlowWaitForAllError, MemFlowWaitForError, DuplicateJobError, ExecActivityError, GenerationalError, GetStateError, InactiveJobError, MapDataError, RegisterTimeoutError, SetStateError, };
134
+ export { CollationError, DurableChildError, DurableFatalError, DurableMaxedError, DurableProxyError, DurableRetryError, DurableSleepError, DurableTimeoutError, DurableWaitForAllError, DurableWaitForError, DuplicateJobError, ExecActivityError, GenerationalError, GetStateError, InactiveJobError, MapDataError, RegisterTimeoutError, SetStateError, };