@hotmeshio/hotmesh 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +7 -45
  2. package/build/index.d.ts +1 -3
  3. package/build/index.js +1 -5
  4. package/build/modules/enums.d.ts +0 -5
  5. package/build/modules/enums.js +1 -6
  6. package/build/modules/utils.d.ts +1 -1
  7. package/build/modules/utils.js +2 -29
  8. package/build/package.json +6 -17
  9. package/build/services/activities/hook.js +1 -5
  10. package/build/services/activities/trigger.js +1 -1
  11. package/build/services/compiler/index.d.ts +2 -2
  12. package/build/services/compiler/index.js +4 -4
  13. package/build/services/connector/factory.d.ts +1 -1
  14. package/build/services/connector/factory.js +3 -12
  15. package/build/services/connector/providers/postgres.js +11 -6
  16. package/build/services/exporter/index.d.ts +8 -8
  17. package/build/services/exporter/index.js +8 -8
  18. package/build/services/memflow/client.js +5 -10
  19. package/build/services/memflow/connection.d.ts +0 -2
  20. package/build/services/memflow/connection.js +0 -2
  21. package/build/services/memflow/exporter.d.ts +3 -3
  22. package/build/services/memflow/exporter.js +3 -3
  23. package/build/services/memflow/index.d.ts +154 -34
  24. package/build/services/memflow/index.js +165 -33
  25. package/build/services/memflow/interceptor.d.ts +241 -0
  26. package/build/services/memflow/interceptor.js +256 -0
  27. package/build/services/memflow/schemas/factory.js +1 -1
  28. package/build/services/memflow/search.d.ts +11 -4
  29. package/build/services/memflow/search.js +98 -71
  30. package/build/services/memflow/worker.d.ts +1 -1
  31. package/build/services/memflow/worker.js +11 -2
  32. package/build/services/memflow/workflow/execChild.js +3 -1
  33. package/build/services/memflow/workflow/execHook.js +1 -1
  34. package/build/services/memflow/workflow/hook.js +4 -2
  35. package/build/services/memflow/workflow/proxyActivities.js +2 -1
  36. package/build/services/meshcall/index.d.ts +1 -1
  37. package/build/services/meshcall/index.js +1 -1
  38. package/build/services/reporter/index.d.ts +1 -1
  39. package/build/services/reporter/index.js +12 -12
  40. package/build/services/router/consumption/index.js +23 -9
  41. package/build/services/router/error-handling/index.js +3 -3
  42. package/build/services/search/factory.js +0 -8
  43. package/build/services/search/providers/postgres/postgres.js +48 -20
  44. package/build/services/store/cache.d.ts +1 -1
  45. package/build/services/store/cache.js +1 -1
  46. package/build/services/store/factory.js +1 -9
  47. package/build/services/store/index.d.ts +1 -1
  48. package/build/services/store/providers/postgres/kvtypes/hash/basic.js +1 -1
  49. package/build/services/store/providers/postgres/kvtypes/hash/index.js +59 -2
  50. package/build/services/store/providers/postgres/kvtypes/hash/jsonb.js +11 -11
  51. package/build/services/store/providers/postgres/kvtypes/hash/udata.d.ts +10 -0
  52. package/build/services/store/providers/postgres/kvtypes/hash/udata.js +384 -0
  53. package/build/services/store/providers/postgres/postgres.js +10 -14
  54. package/build/services/stream/factory.js +0 -16
  55. package/build/services/stream/providers/postgres/postgres.js +23 -20
  56. package/build/services/sub/factory.js +0 -8
  57. package/build/services/sub/providers/nats/nats.js +0 -1
  58. package/build/services/sub/providers/postgres/postgres.js +11 -3
  59. package/build/services/task/index.js +4 -5
  60. package/build/types/activity.d.ts +1 -5
  61. package/build/types/hotmesh.d.ts +0 -5
  62. package/build/types/index.d.ts +0 -1
  63. package/build/types/index.js +1 -4
  64. package/build/types/job.d.ts +1 -1
  65. package/build/types/memflow.d.ts +83 -4
  66. package/build/types/meshcall.d.ts +0 -25
  67. package/build/types/provider.d.ts +1 -1
  68. package/build/types/stream.d.ts +1 -6
  69. package/index.ts +0 -4
  70. package/package.json +6 -17
  71. package/build/services/connector/providers/ioredis.d.ts +0 -9
  72. package/build/services/connector/providers/ioredis.js +0 -26
  73. package/build/services/connector/providers/redis.d.ts +0 -9
  74. package/build/services/connector/providers/redis.js +0 -38
  75. package/build/services/search/providers/redis/ioredis.d.ts +0 -23
  76. package/build/services/search/providers/redis/ioredis.js +0 -134
  77. package/build/services/search/providers/redis/redis.d.ts +0 -23
  78. package/build/services/search/providers/redis/redis.js +0 -147
  79. package/build/services/store/providers/redis/_base.d.ts +0 -137
  80. package/build/services/store/providers/redis/_base.js +0 -980
  81. package/build/services/store/providers/redis/ioredis.d.ts +0 -20
  82. package/build/services/store/providers/redis/ioredis.js +0 -180
  83. package/build/services/store/providers/redis/redis.d.ts +0 -18
  84. package/build/services/store/providers/redis/redis.js +0 -199
  85. package/build/services/stream/providers/redis/ioredis.d.ts +0 -61
  86. package/build/services/stream/providers/redis/ioredis.js +0 -272
  87. package/build/services/stream/providers/redis/redis.d.ts +0 -61
  88. package/build/services/stream/providers/redis/redis.js +0 -305
  89. package/build/services/sub/providers/redis/ioredis.d.ts +0 -17
  90. package/build/services/sub/providers/redis/ioredis.js +0 -81
  91. package/build/services/sub/providers/redis/redis.d.ts +0 -17
  92. package/build/services/sub/providers/redis/redis.js +0 -72
  93. package/build/types/redis.d.ts +0 -258
  94. package/build/types/redis.js +0 -11
package/README.md CHANGED
@@ -2,31 +2,18 @@
2
2
 
3
3
  **Durable Memory + Coordinated Execution**
4
4
 
5
- ![beta release](https://img.shields.io/badge/release-beta-blue.svg) ![made with typescript](https://img.shields.io/badge/built%20with-typescript-lightblue.svg)
5
+ ![beta release](https://img.shields.io/badge/release-beta-blue.svg)
6
6
 
7
- HotMesh removes the repetitive glue of building durable agents, pipelines, and long‑running workflows. Instead of you designing queues, schedulers, cache layers, and ad‑hoc state stores for each agent or pipeline, HotMesh standardizes the pattern:
8
-
9
- * **Entity (Core Memory)**: The authoritative JSONB document + its indexable “surface” fields.
10
- * **Hooks (Durable Units of Work)**: Re‑entrant, idempotent functions that *maintain* the entity over time.
11
- * **Workflow (Coordinator)**: The thin orchestration entry that seeds state, spawns hooks, and optionally synthesizes results.
12
- * **Commands (State Mutation API)**: Atomic `set / merge / append / increment / tag / signal` updates with optimistic invariants handled by Postgres transactions.
13
-
14
- You focus on *what should change in memory*; HotMesh handles *how it changes safely and durably.*
7
+ HotMesh removes the repetitive glue of building durable agents, pipelines, and long‑running workflows. You focus on *what* to change; HotMesh handles *how*, safely and durably.
15
8
 
16
9
  ---
17
10
 
18
- ## Why It’s Easier with HotMesh
11
+ ## Why Choose HotMesh
19
12
 
20
- | Problem You Usually Solve Manually | HotMesh Built‑In | Impact |
21
- | --------------------------------------------------- | ----------------------------------------- | ---------------------------------------------- |
22
- | Designing per‑agent persistence and caches | Unified JSONB entity + typed accessors | One memory model across agents/pipelines |
23
- | Preventing race conditions on shared state | Transactional hook writes | Safe parallel maintenance |
24
- | Coordinating multi-perspective / multi-step work | Hook spawning + signals | Decomposed work without orchestration glue |
25
- | Schema evolution / optional fields | Flexible JSONB + selective indexes | Add / adapt state incrementally |
26
- | Querying live pipeline / agent status | SQL over materialized surfaces | Operational observability using standard tools |
27
- | Avoiding duplicate side-effects during retry/replay | Deterministic re‑entry + idempotent hooks | Simplifies error handling |
28
- | Per‑tenant isolation | Schema (or prefix) scoping | Clean multi‑tenant boundary |
29
- | Background progression / fan‑out | `execHook` + signals | Natural concurrency without queue plumbing |
13
+ - **Zero Boilerplate** - Transactional Postgres without the setup hassle
14
+ - **Built-in Durability** - Automatic crash recovery and replay protection
15
+ - **Parallel by Default** - Run hooks concurrently without coordination
16
+ - **SQL-First** - Query pipeline status and agent memory directly
30
17
 
31
18
  ---
32
19
 
@@ -76,31 +63,6 @@ Thin entrypoints that:
76
63
  | `get` | Read value at path (or full entity) | `await e.get('user.email')` |
77
64
  | `signal` | Mark hook milestone / unlock waiters | `await MemFlow.workflow.signal('phase-x', data)` |
78
65
 
79
- The Entity module also provides static methods for cross-entity querying:
80
-
81
- ```typescript
82
- // Find entities matching conditions
83
- const activeUsers = await Entity.find('user', {
84
- status: 'active',
85
- country: 'US'
86
- });
87
-
88
- // Find by specific field condition
89
- const highValueOrders = await Entity.findByCondition(
90
- 'order',
91
- 'total_amount',
92
- 1000,
93
- '>=',
94
- hotMeshClient
95
- );
96
-
97
- // Find single entity by ID
98
- const user = await Entity.findById('user', 'user123', hotMeshClient);
99
-
100
- // Create optimized index for queries
101
- await Entity.createIndex('user', 'email', hotMeshClient);
102
- ```
103
-
104
66
  ---
105
67
 
106
68
  ## Table of Contents
package/build/index.d.ts CHANGED
@@ -16,9 +16,7 @@ import * as Enums from './modules/enums';
16
16
  import * as KeyStore from './modules/key';
17
17
  import { ConnectorService as Connector } from './services/connector/factory';
18
18
  import { PostgresConnection as ConnectorPostgres } from './services/connector/providers/postgres';
19
- import { RedisConnection as ConnectorIORedis } from './services/connector/providers/ioredis';
20
- import { RedisConnection as ConnectorRedis } from './services/connector/providers/redis';
21
19
  import { NatsConnection as ConnectorNATS } from './services/connector/providers/nats';
22
20
  export { Connector, //factory
23
- ConnectorIORedis, ConnectorNATS, ConnectorPostgres, ConnectorRedis, HotMesh, HotMeshConfig, MeshCall, MemFlow, Client, Connection, proxyActivities, Search, Entity, Worker, workflow, WorkflowHandle, Enums, Errors, Utils, KeyStore, };
21
+ ConnectorNATS, ConnectorPostgres, HotMesh, HotMeshConfig, MeshCall, MemFlow, Client, Connection, proxyActivities, Search, Entity, Worker, workflow, WorkflowHandle, Enums, Errors, Utils, KeyStore, };
24
22
  export * as Types from './types';
package/build/index.js CHANGED
@@ -23,7 +23,7 @@ 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.ConnectorRedis = exports.ConnectorPostgres = exports.ConnectorNATS = exports.ConnectorIORedis = 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.MemFlow = exports.MeshCall = 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
29
  const meshcall_1 = require("./services/meshcall");
@@ -58,10 +58,6 @@ const factory_1 = require("./services/connector/factory");
58
58
  Object.defineProperty(exports, "Connector", { enumerable: true, get: function () { return factory_1.ConnectorService; } });
59
59
  const postgres_1 = require("./services/connector/providers/postgres");
60
60
  Object.defineProperty(exports, "ConnectorPostgres", { enumerable: true, get: function () { return postgres_1.PostgresConnection; } });
61
- const ioredis_1 = require("./services/connector/providers/ioredis");
62
- Object.defineProperty(exports, "ConnectorIORedis", { enumerable: true, get: function () { return ioredis_1.RedisConnection; } });
63
- const redis_1 = require("./services/connector/providers/redis");
64
- Object.defineProperty(exports, "ConnectorRedis", { enumerable: true, get: function () { return redis_1.RedisConnection; } });
65
61
  const nats_1 = require("./services/connector/providers/nats");
66
62
  Object.defineProperty(exports, "ConnectorNATS", { enumerable: true, get: function () { return nats_1.NatsConnection; } });
67
63
  exports.Types = __importStar(require("./types"));
@@ -7,11 +7,6 @@ export declare const HMSH_LOGLEVEL: LogLevel;
7
7
  * Determines the log level for telemetry. The default is 'info' which emits worker and trigger spans. 'debug' emits all spans.
8
8
  */
9
9
  export declare const HMSH_TELEMETRY: "debug" | "info";
10
- /**
11
- * If Redis, explicitly sets whether the application is running in a cluster. The default is false.
12
- * @deprecated
13
- */
14
- export declare const HMSH_IS_CLUSTER: boolean;
15
10
  /**
16
11
  * Default cleanup time for signal in the db when its associated job is completed.
17
12
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_TASK_QUEUE = exports.HMSH_GUID_SIZE = 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_SIGNAL_EXPIRE = exports.HMSH_IS_CLUSTER = exports.HMSH_TELEMETRY = exports.HMSH_LOGLEVEL = void 0;
3
+ exports.DEFAULT_TASK_QUEUE = exports.HMSH_GUID_SIZE = 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_SIGNAL_EXPIRE = exports.HMSH_TELEMETRY = exports.HMSH_LOGLEVEL = void 0;
4
4
  /**
5
5
  * Determines the log level for the application. The default is 'info'.
6
6
  */
@@ -9,11 +9,6 @@ exports.HMSH_LOGLEVEL = process.env.HMSH_LOGLEVEL || 'info';
9
9
  * Determines the log level for telemetry. The default is 'info' which emits worker and trigger spans. 'debug' emits all spans.
10
10
  */
11
11
  exports.HMSH_TELEMETRY = process.env.HMSH_TELEMETRY || 'info';
12
- /**
13
- * If Redis, explicitly sets whether the application is running in a cluster. The default is false.
14
- * @deprecated
15
- */
16
- exports.HMSH_IS_CLUSTER = process.env.HMSH_IS_CLUSTER === 'true';
17
12
  /**
18
13
  * Default cleanup time for signal in the db when its associated job is completed.
19
14
  */
@@ -31,7 +31,7 @@ export declare function identifyProvider(provider: any): Providers | null;
31
31
  */
32
32
  export declare const polyfill: {
33
33
  /**
34
- * `redis` is deprecated; `connection` is the generic replacement
34
+ * `connection` is the generic replacement
35
35
  */
36
36
  providerConfig(obj: any): any;
37
37
  };
@@ -79,38 +79,11 @@ function identifyProvider(provider) {
79
79
  else if (provider.toString().toLowerCase().includes('nats')) {
80
80
  return 'nats';
81
81
  }
82
- else if ('defineCommand' in prototype ||
83
- Object.keys(prototype).includes('multi')) {
84
- return 'ioredis';
85
- }
86
- else if (Object.keys(prototype).includes('Multi')) {
87
- return 'redis';
88
- }
89
- if (provider.constructor) {
90
- if (provider.constructor.name === 'Redis' ||
91
- provider.constructor.name === 'EventEmitter') {
92
- if ('hset' in provider) {
93
- return 'ioredis';
94
- }
95
- }
96
- else if (provider.constructor.name === 'ProviderClient' ||
97
- provider.constructor.name === 'Commander') {
98
- if ('HSET' in provider) {
99
- return 'redis';
100
- }
101
- }
102
- }
103
82
  let type = null;
104
83
  if (Object.keys(provider).includes('connection') ||
105
84
  !isNaN(provider.totalCount) && !isNaN(provider.idleCount)) {
106
85
  type = 'postgres';
107
86
  }
108
- else if (Object.keys(provider).includes('Pipeline')) {
109
- type = 'ioredis';
110
- }
111
- else if (Object.keys(provider).includes('createClient')) {
112
- type = 'redis';
113
- }
114
87
  else if (prototype.constructor.toString().includes('NatsConnectionImpl')) {
115
88
  type = 'nats';
116
89
  }
@@ -122,10 +95,10 @@ exports.identifyProvider = identifyProvider;
122
95
  */
123
96
  exports.polyfill = {
124
97
  /**
125
- * `redis` is deprecated; `connection` is the generic replacement
98
+ * `connection` is the generic replacement
126
99
  */
127
100
  providerConfig(obj) {
128
- return obj?.connection ?? obj?.redis ?? obj?.connections;
101
+ return obj?.connection ?? obj?.connections;
129
102
  },
130
103
  };
131
104
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "Permanent-Memory Workflows & AI Agents",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -23,18 +23,17 @@
23
23
  "test:await": "NODE_ENV=test jest ./tests/functional/awaiter/postgres.test.ts --detectOpenHandles --forceExit --verbose",
24
24
  "test:compile": "NODE_ENV=test jest ./tests/functional/compile/index.test.ts --detectOpenHandles --forceExit --verbose",
25
25
  "test:connect": "NODE_ENV=test jest ./tests/unit/services/connector/* --detectOpenHandles --forceExit --verbose",
26
- "test:connect:ioredis": "NODE_ENV=test jest ./tests/unit/services/connector/providers/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
27
26
  "test:connect:postgres": "NODE_ENV=test jest ./tests/unit/services/connector/providers/postgres.test.ts --detectOpenHandles --forceExit --verbose",
28
- "test:connect:redis": "NODE_ENV=test jest ./tests/unit/services/connector/providers/redis.test.ts --detectOpenHandles --forceExit --verbose",
29
27
  "test:connect:nats": "NODE_ENV=test jest ./tests/unit/services/connector/providers/nats.test.ts --detectOpenHandles --forceExit --verbose",
30
28
  "test:memflow": "NODE_ENV=test jest ./tests/memflow/*/postgres.test.ts --detectOpenHandles --forceExit --verbose",
31
29
  "test:memflow:basic": "HMSH_LOGLEVEL=info NODE_ENV=test jest ./tests/memflow/basic/postgres.test.ts --detectOpenHandles --forceExit --verbose",
32
30
  "test:memflow:collision": "NODE_ENV=test jest ./tests/memflow/collision/*.test.ts --detectOpenHandles --forceExit --verbose",
33
31
  "test:memflow:fatal": "NODE_ENV=test jest ./tests/memflow/fatal/*.test.ts --detectOpenHandles --forceExit --verbose",
34
- "test:memflow:goodbye": "NODE_ENV=test jest ./tests/memflow/goodbye/*.test.ts --detectOpenHandles --forceExit --verbose",
32
+ "test:memflow:goodbye": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/goodbye/postgres.test.ts --detectOpenHandles --forceExit --verbose",
33
+ "test:memflow:interceptor": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/interceptor/postgres.test.ts --detectOpenHandles --forceExit --verbose",
35
34
  "test:memflow:entity": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/entity/postgres.test.ts --detectOpenHandles --forceExit --verbose",
36
35
  "test:memflow:agent": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/agent/postgres.test.ts --detectOpenHandles --forceExit --verbose",
37
- "test:memflow:hello": "HMSH_TELEMETRY=debug HMSH_LOGLEVEL=debug HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/memflow/helloworld/postgres.test.ts --detectOpenHandles --forceExit --verbose",
36
+ "test:memflow:hello": "HMSH_TELEMETRY=debug HMSH_LOGLEVEL=debug NODE_ENV=test jest ./tests/memflow/helloworld/postgres.test.ts --detectOpenHandles --forceExit --verbose",
38
37
  "test:memflow:hook": "NODE_ENV=test jest ./tests/memflow/hook/postgres.test.ts --detectOpenHandles --forceExit --verbose",
39
38
  "test:memflow:interrupt": "NODE_ENV=test jest ./tests/memflow/interrupt/postgres.test.ts --detectOpenHandles --forceExit --verbose",
40
39
  "test:memflow:loopactivity": "NODE_ENV=test jest ./tests/memflow/loopactivity/postgres.test.ts --detectOpenHandles --forceExit --verbose",
@@ -53,7 +52,7 @@
53
52
  "test:interrupt": "NODE_ENV=test jest ./tests/functional/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
54
53
  "test:parallel": "NODE_ENV=test jest ./tests/functional/parallel/index.test.ts --detectOpenHandles --forceExit --verbose",
55
54
  "test:pipe": "NODE_ENV=test jest ./tests/unit/services/pipe/index.test.ts --detectOpenHandles --forceExit --verbose",
56
- "test:quorum": "HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/functional/quorum/*.test.ts --detectOpenHandles --forceExit --verbose",
55
+ "test:quorum": "NODE_ENV=test jest ./tests/functional/quorum/*.test.ts --detectOpenHandles --forceExit --verbose",
57
56
  "test:reclaim": "NODE_ENV=test jest ./tests/functional/reclaim/*.test.ts --detectOpenHandles --forceExit --verbose",
58
57
  "test:redeploy": "NODE_ENV=test jest ./tests/functional/redeploy/*.test.ts --detectOpenHandles --forceExit --verbose",
59
58
  "test:reporter": "NODE_ENV=test jest ./tests/unit/services/reporter/index.test.ts --detectOpenHandles --forceExit --verbose",
@@ -63,15 +62,9 @@
63
62
  "test:signal": "NODE_ENV=test jest ./tests/functional/signal/*.test.ts --detectOpenHandles --forceExit --verbose",
64
63
  "test:status": "NODE_ENV=test jest ./tests/functional/status/index.test.ts --detectOpenHandles --forceExit --verbose",
65
64
  "test:providers": "NODE_ENV=test jest ./tests/functional/*/providers/*/*.test.ts --detectOpenHandles --forceExit --verbose",
66
- "test:store:ioredis": "NODE_ENV=test jest ./tests/functional/store/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
67
- "test:store:redis": "NODE_ENV=test jest ./tests/functional/store/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
68
65
  "test:store:postgres": "NODE_ENV=test jest ./tests/functional/store/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
69
- "test:stream:ioredis": "NODE_ENV=test jest ./tests/functional/stream/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
70
- "test:stream:redis": "NODE_ENV=test jest ./tests/functional/stream/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
71
66
  "test:stream:postgres": "NODE_ENV=test jest ./tests/functional/stream/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
72
67
  "test:stream:nats": "NODE_ENV=test jest ./tests/functional/stream/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
73
- "test:sub:ioredis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
74
- "test:sub:redis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
75
68
  "test:sub:postgres": "NODE_ENV=test jest ./tests/functional/sub/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
76
69
  "test:sub:nats": "NODE_ENV=test jest ./tests/functional/sub/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
77
70
  "test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
@@ -113,13 +106,11 @@
113
106
  "eslint-config-prettier": "^9.1.0",
114
107
  "eslint-plugin-import": "^2.29.1",
115
108
  "eslint-plugin-prettier": "^5.1.3",
116
- "ioredis": "^5.3.2",
117
109
  "javascript-obfuscator": "^4.1.1",
118
110
  "jest": "^29.5.0",
119
111
  "nats": "^2.28.0",
120
112
  "openai": "^5.9.0",
121
113
  "pg": "^8.10.0",
122
- "redis": "^4.6.13",
123
114
  "rimraf": "^4.4.1",
124
115
  "terser": "^5.37.0",
125
116
  "ts-jest": "^29.0.5",
@@ -129,9 +120,7 @@
129
120
  "typescript": "^5.0.4"
130
121
  },
131
122
  "peerDependencies": {
132
- "ioredis": "^4.0.0 || ^5.0.0",
133
123
  "nats": "^2.0.0",
134
- "pg": "^8.0.0",
135
- "redis": "^4.0.0"
124
+ "pg": "^8.0.0"
136
125
  }
137
126
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Hook = void 0;
4
- const enums_1 = require("../../modules/enums");
5
4
  const errors_1 = require("../../modules/errors");
6
5
  const collator_1 = require("../collator");
7
6
  const pipe_1 = require("../pipe");
@@ -89,10 +88,7 @@ class Hook extends activity_1.Activity {
89
88
  }
90
89
  async doHook(telemetry) {
91
90
  const transaction = this.store.transact();
92
- //call registerHook separately if in cluster mode
93
- //(ok to run this command multiple times if it fails),
94
- //but the commands that follow must exec as a transaction
95
- await this.registerHook(enums_1.HMSH_IS_CLUSTER ? undefined : transaction);
91
+ await this.registerHook(transaction);
96
92
  this.mapOutputData();
97
93
  this.mapJobData();
98
94
  await this.setState(transaction);
@@ -8,8 +8,8 @@ const pipe_1 = require("../pipe");
8
8
  const reporter_1 = require("../reporter");
9
9
  const serializer_1 = require("../serializer");
10
10
  const telemetry_1 = require("../telemetry");
11
- const activity_1 = require("./activity");
12
11
  const mapper_1 = require("../mapper");
12
+ const activity_1 = require("./activity");
13
13
  class Trigger extends activity_1.Activity {
14
14
  constructor(config, data, metadata, hook, engine, context) {
15
15
  super(config, data, metadata, hook, engine, context);
@@ -12,13 +12,13 @@ declare class CompilerService {
12
12
  logger: ILogger;
13
13
  constructor(store: StoreService<ProviderClient, ProviderTransaction>, stream: StreamService<ProviderClient, ProviderTransaction>, logger: ILogger);
14
14
  /**
15
- * verifies and plans the deployment of an app to Redis; the app is not deployed yet
15
+ * verifies and plans the deployment of an app to the DB; the app is not deployed yet
16
16
  * @param path
17
17
  */
18
18
  plan(mySchemaOrPath: string): Promise<HotMeshManifest>;
19
19
  isPath(input: string): boolean;
20
20
  /**
21
- * deploys an app to Redis but does NOT activate it.
21
+ * deploys an app to the DB but does NOT activate it.
22
22
  */
23
23
  deploy(mySchemaOrPath: string): Promise<HotMeshManifest>;
24
24
  /**
@@ -43,7 +43,7 @@ class CompilerService {
43
43
  this.logger = logger;
44
44
  }
45
45
  /**
46
- * verifies and plans the deployment of an app to Redis; the app is not deployed yet
46
+ * verifies and plans the deployment of an app to the DB; the app is not deployed yet
47
47
  * @param path
48
48
  */
49
49
  async plan(mySchemaOrPath) {
@@ -69,7 +69,7 @@ class CompilerService {
69
69
  return !input.trim().startsWith('app:');
70
70
  }
71
71
  /**
72
- * deploys an app to Redis but does NOT activate it.
72
+ * deploys an app to the DB but does NOT activate it.
73
73
  */
74
74
  async deploy(mySchemaOrPath) {
75
75
  try {
@@ -84,10 +84,10 @@ class CompilerService {
84
84
  // 2) validate the manifest file (synchronous operation...no callbacks)
85
85
  const validator = new validator_1.Validator(schema);
86
86
  validator.validate(this.store);
87
- // 3) deploy the schema (segment, optimize, etc; save to Redis)
87
+ // 3) deploy the schema (segment, optimize, etc; save to the DB)
88
88
  const deployer = new deployer_1.Deployer(schema);
89
89
  await deployer.deploy(this.store, this.stream);
90
- // 4) save the app version to Redis (so it can be activated later)
90
+ // 4) save the app version to the DB (so it can be activated later)
91
91
  await this.store.setApp(schema.app.id, schema.app.version);
92
92
  return schema;
93
93
  }
@@ -3,7 +3,7 @@ import { ProviderConfig, ProviderNativeClient } from '../../types/provider';
3
3
  export declare class ConnectorService {
4
4
  static disconnectAll(): Promise<void>;
5
5
  /**
6
- * Connect to a provider (redis, nats, postgres) and return the native
6
+ * Connect to a provider (postgres, nats) and return the native
7
7
  * client. Connections are handled by the engine and worker routers at
8
8
  * initialization, but the factory method provided here is useful
9
9
  * for testing provider configurations.
@@ -2,19 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectorService = void 0;
4
4
  const utils_1 = require("../../modules/utils");
5
- const ioredis_1 = require("./providers/ioredis");
6
5
  const nats_1 = require("./providers/nats");
7
6
  const postgres_1 = require("./providers/postgres");
8
- const redis_1 = require("./providers/redis");
9
7
  class ConnectorService {
10
8
  static async disconnectAll() {
11
- await redis_1.RedisConnection.disconnectAll();
12
- await ioredis_1.RedisConnection.disconnectAll();
13
9
  await postgres_1.PostgresConnection.disconnectAll();
14
10
  await nats_1.NatsConnection.disconnectAll();
15
11
  }
16
12
  /**
17
- * Connect to a provider (redis, nats, postgres) and return the native
13
+ * Connect to a provider (postgres, nats) and return the native
18
14
  * client. Connections are handled by the engine and worker routers at
19
15
  * initialization, but the factory method provided here is useful
20
16
  * for testing provider configurations.
@@ -77,12 +73,6 @@ class ConnectorService {
77
73
  let clientInstance;
78
74
  const id = (0, utils_1.guid)();
79
75
  switch (providerType) {
80
- case 'redis':
81
- clientInstance = await redis_1.RedisConnection.connect(id, providerClass, options, { provider: providerName });
82
- break;
83
- case 'ioredis':
84
- clientInstance = await ioredis_1.RedisConnection.connect(id, providerClass, options, { provider: providerName });
85
- break;
86
76
  case 'nats':
87
77
  clientInstance = await nats_1.NatsConnection.connect(id, providerClass, options, { provider: providerName });
88
78
  break;
@@ -90,7 +80,8 @@ class ConnectorService {
90
80
  //if connecting as a poolClient for subscription, auto connect the client
91
81
  const bAutoConnect = field === 'sub';
92
82
  // Use taskQueue-based connection pooling for PostgreSQL
93
- clientInstance = await postgres_1.PostgresConnection.getOrCreateTaskQueueConnection(id, taskQueue, providerClass, options, { connect: bAutoConnect, provider: providerName });
83
+ clientInstance =
84
+ await postgres_1.PostgresConnection.getOrCreateTaskQueueConnection(id, taskQueue, providerClass, options, { connect: bAutoConnect, provider: providerName });
94
85
  break;
95
86
  default:
96
87
  throw new Error(`Unknown provider type: ${providerType}`);
@@ -23,13 +23,13 @@ class PostgresConnection extends __1.AbstractConnection {
23
23
  const taskQueueDetails = Array.from(this.taskQueueConnections.entries()).map(([key, connection]) => ({
24
24
  key,
25
25
  connectionId: connection.getConnectionId() || 'unknown',
26
- reusedCount: connection.reusedCount || 0
26
+ reusedCount: connection.reusedCount || 0,
27
27
  }));
28
28
  return {
29
29
  totalPoolClients: this.poolClientInstances.size,
30
30
  totalConnections: this.connectionInstances.size,
31
31
  taskQueueConnections: this.taskQueueConnections.size,
32
- taskQueueDetails
32
+ taskQueueDetails,
33
33
  };
34
34
  }
35
35
  /**
@@ -41,7 +41,7 @@ class PostgresConnection extends __1.AbstractConnection {
41
41
  if (logger) {
42
42
  logger.info('postgres-connection-stats', {
43
43
  ...stats,
44
- message
44
+ message,
45
45
  });
46
46
  }
47
47
  else {
@@ -54,8 +54,12 @@ class PostgresConnection extends __1.AbstractConnection {
54
54
  static getPoolingEffectiveness() {
55
55
  const stats = this.getConnectionStats();
56
56
  const totalReuses = stats.taskQueueDetails.reduce((sum, detail) => sum + detail.reusedCount, 0);
57
- const averageReusesPerPool = stats.taskQueueConnections > 0 ? totalReuses / stats.taskQueueConnections : 0;
58
- const poolingEfficiency = stats.totalConnections > 0 ? (stats.taskQueueConnections / stats.totalConnections) * 100 : 0;
57
+ const averageReusesPerPool = stats.taskQueueConnections > 0
58
+ ? totalReuses / stats.taskQueueConnections
59
+ : 0;
60
+ const poolingEfficiency = stats.totalConnections > 0
61
+ ? stats.taskQueueConnections / stats.totalConnections * 100
62
+ : 0;
59
63
  return {
60
64
  totalConnections: stats.totalConnections,
61
65
  taskQueuePools: stats.taskQueueConnections,
@@ -164,7 +168,8 @@ class PostgresConnection extends __1.AbstractConnection {
164
168
  if (this.taskQueueConnections.has(connectionKey)) {
165
169
  const existingConnection = this.taskQueueConnections.get(connectionKey);
166
170
  // Track reuse count for monitoring
167
- existingConnection.reusedCount = (existingConnection.reusedCount || 0) + 1;
171
+ existingConnection.reusedCount =
172
+ (existingConnection.reusedCount || 0) + 1;
168
173
  this.logger.debug('postgres-connection-reused', {
169
174
  connectionKey,
170
175
  taskQueue,
@@ -4,8 +4,8 @@ import { DependencyExport, ExportOptions, JobActionExport, JobExport } from '../
4
4
  import { ProviderClient, ProviderTransaction } from '../../types/provider';
5
5
  import { StringStringType, Symbols } from '../../types/serializer';
6
6
  /**
7
- * Downloads job data from Redis (hscan, hmget, hgetall)
8
- * Expands process data and includes dependency list
7
+ * Downloads job data and expands process data and
8
+ * includes dependency list
9
9
  */
10
10
  declare class ExporterService {
11
11
  appId: string;
@@ -20,23 +20,23 @@ declare class ExporterService {
20
20
  */
21
21
  export(jobId: string, options?: ExportOptions): Promise<JobExport>;
22
22
  /**
23
- * Inflates the key from Redis, 3-character symbol
23
+ * Inflates the key
24
24
  * into a human-readable JSON path, reflecting the
25
25
  * tree-like structure of the unidimensional Hash
26
26
  */
27
27
  inflateKey(key: string): string;
28
28
  /**
29
- * Inflates the job data from Redis into a JobExport object
30
- * @param jobHash - the job data from Redis
29
+ * Inflates the job data into a JobExport object
30
+ * @param jobHash - the job data
31
31
  * @param dependencyList - the list of dependencies for the job
32
32
  * @returns - the inflated job data
33
33
  */
34
34
  inflate(jobHash: StringStringType, dependencyList: string[]): JobExport;
35
35
  /**
36
- * Inflates the dependency data from Redis into a JobExport object by
37
- * organizing the dimensional isolate in sch a way asto interleave
36
+ * Inflates the dependency data into a JobExport object by
37
+ * organizing the dimensional isolate in such a way as to interleave
38
38
  * into a story
39
- * @param data - the dependency data from Redis
39
+ * @param data - the dependency data
40
40
  * @returns - the organized dependency data
41
41
  */
42
42
  inflateDependencyData(data: string[], actions: JobActionExport): DependencyExport[];
@@ -5,8 +5,8 @@ const key_1 = require("../../modules/key");
5
5
  const utils_1 = require("../../modules/utils");
6
6
  const serializer_1 = require("../serializer");
7
7
  /**
8
- * Downloads job data from Redis (hscan, hmget, hgetall)
9
- * Expands process data and includes dependency list
8
+ * Downloads job data and expands process data and
9
+ * includes dependency list
10
10
  */
11
11
  class ExporterService {
12
12
  constructor(appId, store, logger) {
@@ -30,7 +30,7 @@ class ExporterService {
30
30
  return jobExport;
31
31
  }
32
32
  /**
33
- * Inflates the key from Redis, 3-character symbol
33
+ * Inflates the key
34
34
  * into a human-readable JSON path, reflecting the
35
35
  * tree-like structure of the unidimensional Hash
36
36
  */
@@ -38,8 +38,8 @@ class ExporterService {
38
38
  return key in this.symbols ? this.symbols[key] : key;
39
39
  }
40
40
  /**
41
- * Inflates the job data from Redis into a JobExport object
42
- * @param jobHash - the job data from Redis
41
+ * Inflates the job data into a JobExport object
42
+ * @param jobHash - the job data
43
43
  * @param dependencyList - the list of dependencies for the job
44
44
  * @returns - the inflated job data
45
45
  */
@@ -77,10 +77,10 @@ class ExporterService {
77
77
  };
78
78
  }
79
79
  /**
80
- * Inflates the dependency data from Redis into a JobExport object by
81
- * organizing the dimensional isolate in sch a way asto interleave
80
+ * Inflates the dependency data into a JobExport object by
81
+ * organizing the dimensional isolate in such a way as to interleave
82
82
  * into a story
83
- * @param data - the dependency data from Redis
83
+ * @param data - the dependency data
84
84
  * @returns - the organized dependency data
85
85
  */
86
86
  inflateDependencyData(data, actions) {
@@ -69,7 +69,7 @@ class ClientService {
69
69
  }
70
70
  //init, but don't await
71
71
  const readonly = this.connection.readonly ?? undefined;
72
- let hotMeshClient = hotmesh_1.HotMesh.init({
72
+ const hotMeshClient = hotmesh_1.HotMesh.init({
73
73
  appId: targetNS,
74
74
  taskQueue,
75
75
  logLevel: enums_1.HMSH_LOGLEVEL,
@@ -126,7 +126,9 @@ class ClientService {
126
126
  */
127
127
  start: async (options) => {
128
128
  const taskQueueName = options.taskQueue ?? options.entity;
129
- const workflowName = options.taskQueue ? options.workflowName : (options.entity ?? options.workflowName);
129
+ const workflowName = options.taskQueue
130
+ ? options.workflowName
131
+ : options.entity ?? options.workflowName;
130
132
  const trc = options.workflowTrace;
131
133
  const spn = options.workflowSpan;
132
134
  //hotmesh `topic` is equivalent to `queue+workflowname` pattern in other systems
@@ -228,14 +230,7 @@ class ClientService {
228
230
  return new handle_1.WorkflowHandleService(hotMeshClient, workflowTopic, workflowId);
229
231
  },
230
232
  /**
231
- * Provides direct access to the SEARCH backend when making
232
- * queries. Taskqueues and workflow names are
233
- * used to identify the point of presence to use. `...args` is
234
- * the tokenized query. When querying Redis/FTSEARCH, the trailing
235
- * ...args might be `'@_custom1:memflow'`. For postgres,
236
- * the trailing ...args would be: `'_custom', 'memflow'`. In each case,
237
- * the query looks for all job data where the field `_custom` is
238
- * equal to `memflow`.
233
+ * Provides direct access to the SEARCH backend
239
234
  *
240
235
  * @example
241
236
  * ```typescript
@@ -8,8 +8,6 @@ import { ProviderConfig, ProvidersConfig } from '../../types/provider';
8
8
  *
9
9
  * The config options optionall support a multi-connection setup
10
10
  * where the `store` connection explicitly defined along with `stream`, `sub`, etc.
11
- * For example, Postgres can be used for stream and store while
12
- * Redis is used for sub.
13
11
  */
14
12
  export declare class ConnectionService {
15
13
  /**
@@ -9,8 +9,6 @@ exports.ConnectionService = void 0;
9
9
  *
10
10
  * The config options optionall support a multi-connection setup
11
11
  * where the `store` connection explicitly defined along with `stream`, `sub`, etc.
12
- * For example, Postgres can be used for stream and store while
13
- * Redis is used for sub.
14
12
  */
15
13
  class ConnectionService {
16
14
  /**
@@ -16,15 +16,15 @@ declare class ExporterService {
16
16
  */
17
17
  export(jobId: string, options?: ExportOptions): Promise<MemFlowJobExport>;
18
18
  /**
19
- * Inflates the job data from Redis into a MemFlowJobExport object
20
- * @param jobHash - the job data from Redis
19
+ * Inflates the job data into a MemFlowJobExport object
20
+ * @param jobHash - the job data
21
21
  * @param dependencyList - the list of dependencies for the job
22
22
  * @returns - the inflated job data
23
23
  */
24
24
  inflate(jobHash: StringStringType, options: ExportOptions): MemFlowJobExport;
25
25
  resolveValue(raw: string, withValues: boolean): Record<string, any> | string | number | null;
26
26
  /**
27
- * Inflates the key from Redis, 3-character symbol
27
+ * Inflates the key
28
28
  * into a human-readable JSON path, reflecting the
29
29
  * tree-like structure of the unidimensional Hash
30
30
  * @private