@hotmeshio/hotmesh 0.7.0 → 0.9.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 (138) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/README.md +158 -38
  3. package/build/index.d.ts +1 -3
  4. package/build/index.js +1 -5
  5. package/build/modules/utils.js +3 -31
  6. package/build/package.json +63 -79
  7. package/build/services/activities/activity.d.ts +97 -9
  8. package/build/services/activities/activity.js +323 -86
  9. package/build/services/activities/await.d.ts +101 -0
  10. package/build/services/activities/await.js +103 -2
  11. package/build/services/activities/cycle.d.ts +82 -0
  12. package/build/services/activities/cycle.js +86 -8
  13. package/build/services/activities/hook.d.ts +144 -1
  14. package/build/services/activities/hook.js +162 -21
  15. package/build/services/activities/interrupt.d.ts +112 -0
  16. package/build/services/activities/interrupt.js +134 -29
  17. package/build/services/activities/signal.d.ts +111 -4
  18. package/build/services/activities/signal.js +136 -28
  19. package/build/services/activities/trigger.d.ts +56 -4
  20. package/build/services/activities/trigger.js +119 -35
  21. package/build/services/activities/worker.d.ts +107 -0
  22. package/build/services/activities/worker.js +109 -2
  23. package/build/services/collator/index.d.ts +116 -30
  24. package/build/services/collator/index.js +211 -115
  25. package/build/services/connector/factory.d.ts +1 -1
  26. package/build/services/connector/factory.js +1 -11
  27. package/build/services/engine/index.d.ts +22 -6
  28. package/build/services/engine/index.js +49 -18
  29. package/build/services/exporter/index.d.ts +2 -0
  30. package/build/services/exporter/index.js +1 -0
  31. package/build/services/hotmesh/index.d.ts +471 -236
  32. package/build/services/hotmesh/index.js +473 -238
  33. package/build/services/memflow/client.js +2 -2
  34. package/build/services/memflow/handle.js +1 -1
  35. package/build/services/memflow/index.d.ts +1 -1
  36. package/build/services/memflow/index.js +1 -1
  37. package/build/services/memflow/workflow/all.d.ts +28 -3
  38. package/build/services/memflow/workflow/all.js +28 -3
  39. package/build/services/memflow/workflow/context.d.ts +44 -1
  40. package/build/services/memflow/workflow/context.js +44 -1
  41. package/build/services/memflow/workflow/didRun.d.ts +23 -3
  42. package/build/services/memflow/workflow/didRun.js +23 -3
  43. package/build/services/memflow/workflow/emit.d.ts +43 -4
  44. package/build/services/memflow/workflow/emit.js +43 -4
  45. package/build/services/memflow/workflow/enrich.d.ts +32 -4
  46. package/build/services/memflow/workflow/enrich.js +32 -4
  47. package/build/services/memflow/workflow/entityMethods.d.ts +54 -7
  48. package/build/services/memflow/workflow/entityMethods.js +54 -7
  49. package/build/services/memflow/workflow/execChild.d.ts +96 -8
  50. package/build/services/memflow/workflow/execChild.js +96 -8
  51. package/build/services/memflow/workflow/execHook.d.ts +54 -39
  52. package/build/services/memflow/workflow/execHook.js +52 -38
  53. package/build/services/memflow/workflow/execHookBatch.d.ts +82 -29
  54. package/build/services/memflow/workflow/execHookBatch.js +80 -28
  55. package/build/services/memflow/workflow/hook.d.ts +68 -3
  56. package/build/services/memflow/workflow/hook.js +69 -4
  57. package/build/services/memflow/workflow/index.d.ts +65 -10
  58. package/build/services/memflow/workflow/index.js +65 -10
  59. package/build/services/memflow/workflow/interrupt.d.ts +50 -4
  60. package/build/services/memflow/workflow/interrupt.js +50 -4
  61. package/build/services/memflow/workflow/interruption.d.ts +49 -16
  62. package/build/services/memflow/workflow/interruption.js +49 -16
  63. package/build/services/memflow/workflow/isSideEffectAllowed.d.ts +21 -4
  64. package/build/services/memflow/workflow/isSideEffectAllowed.js +21 -4
  65. package/build/services/memflow/workflow/proxyActivities.d.ts +70 -42
  66. package/build/services/memflow/workflow/proxyActivities.js +70 -42
  67. package/build/services/memflow/workflow/random.d.ts +33 -3
  68. package/build/services/memflow/workflow/random.js +33 -3
  69. package/build/services/memflow/workflow/searchMethods.d.ts +49 -2
  70. package/build/services/memflow/workflow/searchMethods.js +49 -2
  71. package/build/services/memflow/workflow/signal.d.ts +51 -22
  72. package/build/services/memflow/workflow/signal.js +52 -23
  73. package/build/services/memflow/workflow/sleepFor.d.ts +57 -18
  74. package/build/services/memflow/workflow/sleepFor.js +57 -18
  75. package/build/services/memflow/workflow/trace.d.ts +39 -6
  76. package/build/services/memflow/workflow/trace.js +39 -6
  77. package/build/services/memflow/workflow/waitFor.d.ts +55 -18
  78. package/build/services/memflow/workflow/waitFor.js +55 -18
  79. package/build/services/router/consumption/index.js +1 -1
  80. package/build/services/search/factory.js +1 -9
  81. package/build/services/store/factory.js +1 -9
  82. package/build/services/store/index.d.ts +6 -1
  83. package/build/services/store/providers/postgres/kvsql.d.ts +4 -0
  84. package/build/services/store/providers/postgres/kvsql.js +4 -0
  85. package/build/services/store/providers/postgres/kvtransaction.d.ts +2 -0
  86. package/build/services/store/providers/postgres/kvtransaction.js +23 -0
  87. package/build/services/store/providers/postgres/kvtypes/hash/basic.d.ts +51 -0
  88. package/build/services/store/providers/postgres/kvtypes/hash/basic.js +193 -1
  89. package/build/services/store/providers/postgres/kvtypes/hash/index.d.ts +4 -0
  90. package/build/services/store/providers/postgres/kvtypes/hash/index.js +6 -0
  91. package/build/services/store/providers/postgres/postgres.d.ts +21 -1
  92. package/build/services/store/providers/postgres/postgres.js +42 -4
  93. package/build/services/stream/factory.js +1 -17
  94. package/build/services/stream/providers/postgres/scout.js +2 -2
  95. package/build/services/sub/factory.js +1 -9
  96. package/build/services/sub/index.d.ts +1 -1
  97. package/build/services/sub/providers/postgres/postgres.d.ts +1 -1
  98. package/build/services/sub/providers/postgres/postgres.js +25 -10
  99. package/build/services/task/index.d.ts +1 -1
  100. package/build/services/task/index.js +2 -6
  101. package/build/services/telemetry/index.js +6 -0
  102. package/build/types/activity.d.ts +1 -1
  103. package/build/types/hotmesh.d.ts +1 -1
  104. package/build/types/index.d.ts +0 -1
  105. package/build/types/index.js +1 -4
  106. package/build/types/job.d.ts +1 -1
  107. package/build/types/memflow.d.ts +1 -1
  108. package/build/types/provider.d.ts +1 -1
  109. package/build/types/quorum.d.ts +2 -2
  110. package/build/vitest.config.d.ts +2 -0
  111. package/build/vitest.config.js +18 -0
  112. package/index.ts +0 -4
  113. package/package.json +63 -79
  114. package/vitest.config.ts +17 -0
  115. package/build/services/connector/providers/ioredis.d.ts +0 -9
  116. package/build/services/connector/providers/ioredis.js +0 -26
  117. package/build/services/connector/providers/redis.d.ts +0 -9
  118. package/build/services/connector/providers/redis.js +0 -38
  119. package/build/services/search/providers/redis/ioredis.d.ts +0 -23
  120. package/build/services/search/providers/redis/ioredis.js +0 -189
  121. package/build/services/search/providers/redis/redis.d.ts +0 -23
  122. package/build/services/search/providers/redis/redis.js +0 -202
  123. package/build/services/store/providers/redis/_base.d.ts +0 -137
  124. package/build/services/store/providers/redis/_base.js +0 -980
  125. package/build/services/store/providers/redis/ioredis.d.ts +0 -20
  126. package/build/services/store/providers/redis/ioredis.js +0 -190
  127. package/build/services/store/providers/redis/redis.d.ts +0 -18
  128. package/build/services/store/providers/redis/redis.js +0 -199
  129. package/build/services/stream/providers/redis/ioredis.d.ts +0 -61
  130. package/build/services/stream/providers/redis/ioredis.js +0 -272
  131. package/build/services/stream/providers/redis/redis.d.ts +0 -61
  132. package/build/services/stream/providers/redis/redis.js +0 -305
  133. package/build/services/sub/providers/redis/ioredis.d.ts +0 -20
  134. package/build/services/sub/providers/redis/ioredis.js +0 -161
  135. package/build/services/sub/providers/redis/redis.d.ts +0 -18
  136. package/build/services/sub/providers/redis/redis.js +0 -148
  137. package/build/types/redis.d.ts +0 -258
  138. package/build/types/redis.js +0 -11
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npx tsc:*)",
5
+ "Bash(wc:*)"
6
+ ]
7
+ }
8
+ }
package/README.md CHANGED
@@ -4,27 +4,41 @@
4
4
 
5
5
  Run durable workflows on Postgres. No servers, no queues, just your database.
6
6
 
7
+ ```bash
8
+ npm install @hotmeshio/hotmesh
9
+ ```
10
+
11
+ ## Use HotMesh for
7
12
 
8
- ## Common Use Cases
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.
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
+ - **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.
9
17
 
10
- ### 1. Pipeline Database
11
- Transform Postgres into a durable pipeline processor. Orchestrate long-running, multi-step pipelines transactionally and durably.
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.
12
19
 
13
- ### 2. Temporal You Own
14
- Get the power of Temporal without the infrastructure. HotMesh includes MemFlow, a Temporal-compatible API that runs directly on your Postgres database. No app server required.
20
+ ## How it works in 30 seconds
15
21
 
16
- ### 3. Distributed State Machine
17
- Build resilient, stateful applications where every component can fail and recover. HotMesh manages state transitions, retries, and coordination.
22
+ 1. **You write workflow functions.** Plain TypeScript — branching, loops, error handling. HotMesh also supports a YAML syntax for declarative, functional workflows.
23
+ 2. **HotMesh compiles them into a transactional execution plan.** Each step becomes a committed database row. If the process crashes mid-workflow, it resumes from the last committed step.
24
+ 3. **Your Postgres database is the engine.** It stores state, coordinates retries, and delivers messages. Every connected client participates in execution — there is no central server.
18
25
 
19
- ### 4. Workflow-as-Code Platform
20
- Choose your style: procedural workflows with MemFlow's Temporal API, or functional workflows with HotMesh's YAML syntax.
26
+ ## Quickstart
21
27
 
22
- ## Installation
28
+ Start Postgres locally (or use an existing instance), then:
23
29
 
24
30
  ```bash
25
31
  npm install @hotmeshio/hotmesh
26
32
  ```
27
33
 
34
+ The repo includes a `docker-compose.yml` that starts Postgres (and NATS, if needed):
35
+
36
+ ```bash
37
+ docker compose up -d postgres
38
+ ```
39
+
40
+ Then follow the [Quick Start guide](./docs/quickstart.md) for a progressive walkthrough — from a single trigger to conditional, parallel, and compositional workflows.
41
+
28
42
  ## Two ways to write workflows
29
43
 
30
44
  Both approaches reuse your activity functions:
@@ -52,13 +66,13 @@ import { MemFlow } from '@hotmeshio/hotmesh';
52
66
  import * as activities from './activities';
53
67
 
54
68
  export async function orderWorkflow(itemId: string, qty: number) {
55
- const { checkInventory, reserveItem, notifyBackorder } =
69
+ const { checkInventory, reserveItem, notifyBackorder } =
56
70
  MemFlow.workflow.proxyActivities<typeof activities>({
57
71
  taskQueue: 'inventory-tasks'
58
72
  });
59
-
73
+
60
74
  const available = await checkInventory(itemId);
61
-
75
+
62
76
  if (available >= qty) {
63
77
  return await reserveItem(itemId, qty);
64
78
  } else {
@@ -102,23 +116,23 @@ const result = await handle.result();
102
116
  activities:
103
117
  trigger:
104
118
  type: trigger
105
-
119
+
106
120
  checkInventory:
107
121
  type: worker
108
122
  topic: inventory.check
109
-
123
+
110
124
  reserveItem:
111
125
  type: worker
112
126
  topic: inventory.reserve
113
-
127
+
114
128
  notifyBackorder:
115
129
  type: worker
116
130
  topic: inventory.backorder.notify
117
-
131
+
118
132
  transitions:
119
133
  trigger:
120
134
  - to: checkInventory
121
-
135
+
122
136
  checkInventory:
123
137
  - to: reserveItem
124
138
  conditions:
@@ -128,7 +142,7 @@ transitions:
128
142
  '@pipe':
129
143
  - ['{checkInventory.output.data.availableQty}', '{trigger.output.data.requestedQty}']
130
144
  - ['{@conditional.gte}']
131
-
145
+
132
146
  - to: notifyBackorder
133
147
  conditions:
134
148
  match:
@@ -139,6 +153,7 @@ transitions:
139
153
  - ['{@conditional.gte}']
140
154
  ```
141
155
 
156
+ Deploy and run as follows:
142
157
  ```typescript
143
158
  // main.ts (reuses same activities.ts)
144
159
  import * as activities from './activities';
@@ -185,42 +200,147 @@ const result = await hotMesh.pubsub('order.requested', {
185
200
 
186
201
  Both compile to the same distributed execution model.
187
202
 
188
- ## Core features
203
+ ## Common patterns
189
204
 
190
- - **Durable execution** - Survives crashes, retries automatically
191
- - **No infrastructure** - Runs on your existing Postgres
192
- - **Temporal compatible** - Drop-in replacement for many use cases
193
- - **Distributed** - Every client participates in execution
194
- - **Observable** - Full execution history in your database
205
+ All snippets below run inside a workflow function (like `orderWorkflow` above). MemFlow methods are available as static imports:
195
206
 
196
- ## Common patterns
207
+ ```typescript
208
+ import { MemFlow } from '@hotmeshio/hotmesh';
209
+ ```
197
210
 
198
- **Long-running workflows**
211
+ **Long-running workflows** — `sleepFor` is durable. The process can restart; the timer survives.
199
212
 
200
213
  ```typescript
201
- await sleep('30 days');
214
+ // sendFollowUp is a proxied activity from proxyActivities()
215
+ await MemFlow.workflow.sleepFor('30 days');
202
216
  await sendFollowUp();
203
217
  ```
204
218
 
205
- **Parallel execution**
219
+ **Parallel execution** — fan out to multiple activities and wait for all results.
206
220
 
207
221
  ```typescript
208
- const results = await Promise.all([
209
- processPayment(),
210
- updateInventory(),
211
- notifyWarehouse()
222
+ // proxied activities run as durable, retryable steps
223
+ const [payment, inventory, shipment] = await Promise.all([
224
+ processPayment(orderId),
225
+ updateInventory(orderId),
226
+ notifyWarehouse(orderId)
212
227
  ]);
213
228
  ```
214
229
 
215
- **Child workflows**
230
+ **Child workflows** — compose workflows from other workflows.
216
231
 
217
232
  ```typescript
218
- const childHandle = await startChild(validateOrder, { args: [orderId] });
233
+ const childHandle = await MemFlow.workflow.startChild(validateOrder, {
234
+ args: [orderId],
235
+ taskQueue: 'validation',
236
+ workflowId: `validate-${orderId}`
237
+ });
219
238
  const validation = await childHandle.result();
220
239
  ```
221
240
 
222
- ## License
241
+ **Signals** — pause a workflow until an external event arrives.
223
242
 
224
- HotMesh is licensed under the Apache License, Version 2.0.
243
+ ```typescript
244
+ const approval = await MemFlow.workflow.waitFor<{ approved: boolean }>('manager-approval');
245
+ if (!approval.approved) return 'rejected';
246
+ ```
247
+
248
+ ## Retries and error handling
249
+
250
+ Activities retry automatically on failure. Configure the policy per activity or per worker:
251
+
252
+ ```typescript
253
+ // MemFlow: per-activity retry policy
254
+ const { reserveItem } = MemFlow.workflow.proxyActivities<typeof activities>({
255
+ taskQueue: 'inventory-tasks',
256
+ retryPolicy: {
257
+ maximumAttempts: 5,
258
+ backoffCoefficient: 2,
259
+ maximumInterval: '60s'
260
+ }
261
+ });
262
+ ```
263
+
264
+ ```typescript
265
+ // HotMesh: worker-level retry policy
266
+ const hotMesh = await HotMesh.init({
267
+ appId: 'orders',
268
+ engine: { connection },
269
+ workers: [{
270
+ topic: 'inventory.reserve',
271
+ connection,
272
+ retryPolicy: {
273
+ maximumAttempts: 5,
274
+ backoffCoefficient: 2,
275
+ maximumInterval: '60s'
276
+ },
277
+ callback: async (data) => { /* ... */ }
278
+ }]
279
+ });
280
+ ```
281
+
282
+ Defaults: 3 attempts, coefficient 10, 120s cap. Delay formula: `min(coefficient ^ attempt, maximumInterval)`. Duration strings like `'5 seconds'`, `'2 minutes'`, and `'1 hour'` are supported.
283
+
284
+ If all retries are exhausted, the activity fails and the error propagates to the workflow function — handle it with a standard `try/catch`.
285
+
286
+ ## It's just data
287
+
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.
289
+
290
+ ```sql
291
+ SELECT
292
+ j.key AS job_key,
293
+ j.status AS semaphore,
294
+ j.entity AS workflow,
295
+ a.field AS attribute,
296
+ a.value AS value,
297
+ j.created_at,
298
+ j.updated_at
299
+ FROM
300
+ jobs j
301
+ JOIN jobs_attributes a ON a.job_id = j.id
302
+ WHERE
303
+ j.key = 'order-456'
304
+ ORDER BY
305
+ a.field;
306
+ ```
307
+
308
+ What happened? Consult the database. What's still running? Query the semaphore. What failed? Read the row. The execution state isn't reconstructed from a log — it was committed transactionally as each step ran.
309
+
310
+ You can also use the Temporal-compatible API:
311
+
312
+ ```typescript
313
+ const handle = client.workflow.getHandle('orders', 'orderWorkflow', 'order-456');
314
+
315
+ const result = await handle.result(); // final output
316
+ const status = await handle.status(); // semaphore (0 = complete)
317
+ const state = await handle.state(true); // full state with metadata
318
+ const exported = await handle.export({ // selective export
319
+ allow: ['data', 'state', 'status', 'timeline']
320
+ });
321
+ ```
322
+
323
+ ## Observability
324
+
325
+ There is no proprietary dashboard. Workflow state lives in Postgres, so use whatever tools you already have:
326
+
327
+ - **Direct SQL** — query `jobs` and `jobs_attributes` to inspect state, as shown above.
328
+ - **Handle API** — `handle.status()`, `handle.state(true)`, and `handle.export()` give programmatic access to any running or completed workflow.
329
+ - **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.).
331
+
332
+ ## Architecture
333
+
334
+ For a deep dive into the transactional execution model — how every step is crash-safe, how the monotonic collation ledger guarantees exactly-once delivery, and how cycles and retries remain correct under arbitrary failure — see the [Collation Design Document](https://github.com/hotmeshio/sdk-typescript/blob/main/services/collator/README.md). The symbolic system (how to design workflows) and lifecycle details (how to deploy workflows) are covered in the [Architectural Overview](https://zenodo.org/records/12168558).
335
+
336
+ ## Familiar with Temporal?
337
+
338
+ MemFlow is designed as a drop-in-compatible alternative for common Temporal patterns.
339
+
340
+ **What's the same:** `Client`, `Worker`, `proxyActivities`, `sleepFor`, `startChild`/`execChild`, signals (`waitFor`/`signal`), retry policies, and the overall workflow-as-code programming model.
341
+
342
+ **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
+
344
+ ## License
225
345
 
226
- You may use, modify, and distribute HotMesh in accordance with the license, including as part of your own applications and services. However, offering HotMesh itself as a standalone, hosted commercial orchestration service (or a substantially similar service) requires prior written permission from the author.
346
+ HotMesh is source-available under the [HotMesh Source Available License](./LICENSE).
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"));
@@ -79,42 +79,14 @@ 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
- let type = null;
104
82
  if (Object.keys(provider).includes('connection') ||
105
83
  !isNaN(provider.totalCount) && !isNaN(provider.idleCount)) {
106
- type = 'postgres';
107
- }
108
- else if (Object.keys(provider).includes('Pipeline')) {
109
- type = 'ioredis';
110
- }
111
- else if (Object.keys(provider).includes('createClient')) {
112
- type = 'redis';
84
+ return 'postgres';
113
85
  }
114
86
  else if (prototype.constructor.toString().includes('NatsConnectionImpl')) {
115
- type = 'nats';
87
+ return 'nats';
116
88
  }
117
- return type;
89
+ return null;
118
90
  }
119
91
  exports.identifyProvider = identifyProvider;
120
92
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Permanent-Memory Workflows & AI Agents",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -19,79 +19,69 @@
19
19
  "lint": "eslint . --ext .ts",
20
20
  "lint:fix": "eslint . --fix --ext .ts",
21
21
  "start": "ts-node src/index.ts",
22
- "test": "NODE_ENV=test jest --detectOpenHandles --forceExit --verbose",
23
- "test:await": "NODE_ENV=test jest ./tests/functional/awaiter/postgres.test.ts --detectOpenHandles --forceExit --verbose",
24
- "test:compile": "NODE_ENV=test jest ./tests/functional/compile/index.test.ts --detectOpenHandles --forceExit --verbose",
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
- "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/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
29
- "test:connect:nats": "NODE_ENV=test jest ./tests/unit/services/connector/providers/nats.test.ts --detectOpenHandles --forceExit --verbose",
30
- "test:memflow": "NODE_ENV=test jest ./tests/memflow/*/*.test.ts --detectOpenHandles --forceExit --verbose",
31
- "test:memflow:basic": "HMSH_LOGLEVEL=info NODE_ENV=test jest ./tests/memflow/basic/postgres.test.ts --detectOpenHandles --forceExit --verbose",
32
- "test:memflow:collision": "NODE_ENV=test jest ./tests/memflow/collision/postgres.test.ts --detectOpenHandles --forceExit --verbose",
33
- "test:memflow:fatal": "NODE_ENV=test jest ./tests/memflow/fatal/*.test.ts --detectOpenHandles --forceExit --verbose",
34
- "test:memflow:goodbye": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/goodbye/postgres.test.ts --detectOpenHandles --forceExit --verbose",
35
- "test:memflow:interceptor": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/interceptor/postgres.test.ts --detectOpenHandles --forceExit --verbose",
36
- "test:memflow:entity": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/entity/postgres.test.ts --detectOpenHandles --forceExit --verbose",
37
- "test:memflow:agent": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/memflow/agent/postgres.test.ts --detectOpenHandles --forceExit --verbose",
38
- "test:memflow:hello": "HMSH_TELEMETRY=debug HMSH_LOGLEVEL=debug NODE_ENV=test jest ./tests/memflow/helloworld/postgres.test.ts --detectOpenHandles --forceExit --verbose",
39
- "test:memflow:hook": "NODE_ENV=test jest ./tests/memflow/hook/postgres.test.ts --detectOpenHandles --forceExit --verbose",
40
- "test:memflow:interrupt": "NODE_ENV=test jest ./tests/memflow/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
41
- "test:memflow:loopactivity": "NODE_ENV=test jest ./tests/memflow/loopactivity/*.test.ts --detectOpenHandles --forceExit --verbose",
42
- "test:memflow:nested": "NODE_ENV=test jest ./tests/memflow/nested/postgres.test.ts --detectOpenHandles --forceExit --verbose",
43
- "test:memflow:pipeline": "NODE_ENV=test jest ./tests/memflow/pipeline/postgres.test.ts --detectOpenHandles --forceExit --verbose",
44
- "test:memflow:retry": "NODE_ENV=test jest ./tests/memflow/retry/postgres.test.ts --detectOpenHandles --forceExit --verbose",
45
- "test:memflow:retrypolicy": "NODE_ENV=test jest ./tests/memflow/retry-policy/*.test.ts --detectOpenHandles --forceExit --verbose",
46
- "test:memflow:sleep": "NODE_ENV=test jest ./tests/memflow/sleep/postgres.test.ts --detectOpenHandles --forceExit --verbose",
47
- "test:memflow:signal": "NODE_ENV=test jest ./tests/memflow/signal/postgres.test.ts --detectOpenHandles --forceExit --verbose",
48
- "test:memflow:unknown": "NODE_ENV=test jest ./tests/memflow/unknown/*.test.ts --detectOpenHandles --forceExit --verbose",
49
- "test:cycle": "NODE_ENV=test jest ./tests/functional/cycle/*.test.ts --detectOpenHandles --forceExit --verbose",
50
- "test:functional": "NODE_ENV=test jest ./tests/functional/* --detectOpenHandles --forceExit --verbose",
51
- "test:emit": "NODE_ENV=test jest ./tests/functional/emit/*.test.ts --detectOpenHandles --forceExit --verbose",
52
- "test:pending": "NODE_ENV=test jest ./tests/functional/pending/index.test.ts --detectOpenHandles --forceExit --verbose",
53
- "test:hmsh": "NODE_ENV=test jest ./tests/functional/*.test.ts --detectOpenHandles --verbose --forceExit",
54
- "test:hook": "NODE_ENV=test jest ./tests/functional/hook/postgres.test.ts --detectOpenHandles --forceExit --verbose",
55
- "test:interrupt": "NODE_ENV=test jest ./tests/functional/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
56
- "test:parallel": "NODE_ENV=test jest ./tests/functional/parallel/index.test.ts --detectOpenHandles --forceExit --verbose",
57
- "test:pipe": "NODE_ENV=test jest ./tests/unit/services/pipe/index.test.ts --detectOpenHandles --forceExit --verbose",
58
- "test:quorum": "NODE_ENV=test jest ./tests/functional/quorum/postgres.test.ts --detectOpenHandles --forceExit --verbose",
59
- "test:reclaim": "NODE_ENV=test jest ./tests/functional/reclaim/*.test.ts --detectOpenHandles --forceExit --verbose",
60
- "test:redeploy": "NODE_ENV=test jest ./tests/functional/redeploy/*.test.ts --detectOpenHandles --forceExit --verbose",
61
- "test:reporter": "NODE_ENV=test jest ./tests/unit/services/reporter/index.test.ts --detectOpenHandles --forceExit --verbose",
62
- "test:reentrant": "NODE_ENV=test jest ./tests/functional/reentrant/*.test.ts --detectOpenHandles --forceExit --verbose",
63
- "test:retry": "NODE_ENV=test jest ./tests/functional/retry/*.test.ts --detectOpenHandles --forceExit --verbose",
64
- "test:retrypolicy": "NODE_ENV=test jest ./tests/functional/retry-policy/*.test.ts --detectOpenHandles --forceExit --verbose",
65
- "test:sequence": "NODE_ENV=test HMSH_LOGLEVEL=debug jest ./tests/functional/sequence/*.test.ts --detectOpenHandles --forceExit --verbose",
66
- "test:signal": "NODE_ENV=test jest ./tests/functional/signal/*.test.ts --detectOpenHandles --forceExit --verbose",
67
- "test:status": "NODE_ENV=test jest ./tests/functional/status/index.test.ts --detectOpenHandles --forceExit --verbose",
68
- "test:providers": "NODE_ENV=test jest ./tests/functional/*/providers/*/*.test.ts --detectOpenHandles --forceExit --verbose",
69
- "test:store:ioredis": "NODE_ENV=test jest ./tests/functional/store/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
70
- "test:store:redis": "NODE_ENV=test jest ./tests/functional/store/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
71
- "test:store:postgres": "NODE_ENV=test jest ./tests/functional/store/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
72
- "test:stream:ioredis": "NODE_ENV=test jest ./tests/functional/stream/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
73
- "test:stream:redis": "NODE_ENV=test jest ./tests/functional/stream/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
74
- "test:stream:postgres": "NODE_ENV=test jest ./tests/functional/stream/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
75
- "test:stream:nats": "NODE_ENV=test jest ./tests/functional/stream/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
76
- "test:sub:ioredis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
77
- "test:sub:redis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
78
- "test:sub:postgres": "NODE_ENV=test jest ./tests/functional/sub/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
79
- "test:sub:nats": "NODE_ENV=test jest ./tests/functional/sub/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
80
- "test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
81
- "test:meshcall": "NODE_ENV=test jest ./tests/meshcall/*.test.ts --forceExit --verbose --detectOpenHandles",
82
- "test:unit": "NODE_ENV=test jest ./tests/unit/*/*/index.test.ts --detectOpenHandles --forceExit --verbose"
22
+ "test": "vitest run",
23
+ "test:watch": "vitest",
24
+ "test:await": "vitest run tests/functional/awaiter/postgres.test.ts",
25
+ "test:compile": "vitest run tests/functional/compile/index.test.ts",
26
+ "test:connect": "vitest run tests/unit/services/connector",
27
+ "test:connect:postgres": "vitest run tests/unit/services/connector/providers/postgres.test.ts",
28
+ "test:connect:nats": "vitest run tests/unit/services/connector/providers/nats.test.ts",
29
+ "test:memflow": "vitest run tests/memflow",
30
+ "test:memflow:postgres": "HMSH_LOGLEVEL=info vitest run tests/memflow",
31
+ "test:memflow:basic": "HMSH_LOGLEVEL=info vitest run tests/memflow/basic/postgres.test.ts",
32
+ "test:memflow:collision": "vitest run tests/memflow/collision/postgres.test.ts",
33
+ "test:memflow:fatal": "vitest run tests/memflow/fatal",
34
+ "test:memflow:goodbye": "HMSH_LOGLEVEL=debug vitest run tests/memflow/goodbye/postgres.test.ts",
35
+ "test:memflow:interceptor": "HMSH_LOGLEVEL=info vitest run tests/memflow/interceptor/postgres.test.ts",
36
+ "test:memflow:entity": "HMSH_LOGLEVEL=debug vitest run tests/memflow/entity/postgres.test.ts",
37
+ "test:memflow:agent": "HMSH_LOGLEVEL=debug vitest run tests/memflow/agent/postgres.test.ts",
38
+ "test:memflow:hello": "HMSH_TELEMETRY=debug HMSH_LOGLEVEL=info vitest run tests/memflow/helloworld/postgres.test.ts",
39
+ "test:memflow:hook": "vitest run tests/memflow/hook/postgres.test.ts",
40
+ "test:memflow:interrupt": "vitest run tests/memflow/interrupt/postgres.test.ts",
41
+ "test:memflow:loopactivity": "vitest run tests/memflow/loopactivity/postgres.test.ts",
42
+ "test:memflow:nested": "vitest run tests/memflow/nested/postgres.test.ts",
43
+ "test:memflow:pipeline": "vitest run tests/memflow/pipeline/postgres.test.ts",
44
+ "test:memflow:retry": "vitest run tests/memflow/retry/postgres.test.ts",
45
+ "test:memflow:retrypolicy": "vitest run tests/memflow/retry-policy",
46
+ "test:memflow:sleep": "vitest run tests/memflow/sleep/postgres.test.ts",
47
+ "test:memflow:signal": "vitest run tests/memflow/signal/postgres.test.ts",
48
+ "test:memflow:unknown": "vitest run tests/memflow/unknown/postgres.test.ts",
49
+ "test:cycle": "vitest run tests/functional/cycle",
50
+ "test:functional": "vitest run tests/functional",
51
+ "test:emit": "vitest run tests/functional/emit",
52
+ "test:pending": "vitest run tests/functional/pending/index.test.ts",
53
+ "test:hmsh": "vitest run tests/functional/postgres.test.ts",
54
+ "test:hook": "vitest run tests/functional/hook/postgres.test.ts",
55
+ "test:interrupt": "vitest run tests/functional/interrupt/postgres.test.ts",
56
+ "test:parallel": "vitest run tests/functional/parallel/index.test.ts",
57
+ "test:pipe": "vitest run tests/unit/services/pipe/index.test.ts",
58
+ "test:quorum": "vitest run tests/functional/quorum/postgres.test.ts",
59
+ "test:reclaim": "vitest run tests/functional/reclaim/postgres.test.ts",
60
+ "test:redeploy": "vitest run tests/functional/redeploy/postgres.test.ts",
61
+ "test:reporter": "vitest run tests/unit/services/reporter/index.test.ts",
62
+ "test:reentrant": "vitest run tests/functional/reentrant/postgres.test.ts",
63
+ "test:retry": "vitest run tests/functional/retry/postgres.test.ts",
64
+ "test:retrypolicy": "vitest run tests/functional/retry-policy",
65
+ "test:sequence": "HMSH_LOGLEVEL=info vitest run tests/functional/sequence/postgres.test.ts",
66
+ "test:signal": "vitest run tests/functional/signal/postgres.test.ts",
67
+ "test:status": "vitest run tests/functional/status/index.test.ts",
68
+ "test:providers": "vitest run tests/functional/*/providers",
69
+ "test:store:postgres": "vitest run tests/functional/store/providers/postgres/postgres.test.ts",
70
+ "test:stream:postgres": "vitest run tests/functional/stream/providers/postgres/postgres.test.ts",
71
+ "test:stream:nats": "vitest run tests/functional/stream/providers/nats/nats.test.ts",
72
+ "test:sub:postgres": "vitest run tests/functional/sub/providers/postgres/postgres.test.ts",
73
+ "test:sub:nats": "vitest run tests/functional/sub/providers/nats/nats.test.ts",
74
+ "test:trigger": "vitest run tests/unit/services/activities/trigger.test.ts",
75
+ "test:meshcall": "vitest run tests/meshcall",
76
+ "test:unit": "vitest run tests/unit"
83
77
  },
84
78
  "keywords": [
85
79
  "Headless Orchestration",
86
- "Persistent Workflow",
87
- "Durable Workflow",
88
- "Operational Data",
80
+ "Durable Workflows",
81
+ "Data in Motion",
89
82
  "Service Mesh",
90
83
  "HotMesh",
91
- "Postgres",
92
- "OLAP",
93
- "OLTP",
94
- "HTAP"
84
+ "Postgres"
95
85
  ],
96
86
  "author": "luke.birdeau@gmail.com",
97
87
  "license": "SEE LICENSE IN LICENSE",
@@ -106,8 +96,7 @@
106
96
  "winston": "^3.8.2"
107
97
  },
108
98
  "devDependencies": {
109
- "@types/jest": "^29.5.0",
110
- "@types/node": "^18.15.11",
99
+ "@types/node": "^20.19.33",
111
100
  "@types/pg": "^8.10.0",
112
101
  "@typescript-eslint/eslint-plugin": "^5.62.0",
113
102
  "@typescript-eslint/parser": "^5.62.0",
@@ -116,25 +105,20 @@
116
105
  "eslint-config-prettier": "^9.1.0",
117
106
  "eslint-plugin-import": "^2.29.1",
118
107
  "eslint-plugin-prettier": "^5.1.3",
119
- "ioredis": "^5.3.2",
120
108
  "javascript-obfuscator": "^0.6.2",
121
- "jest": "^29.5.0",
122
109
  "nats": "^2.28.0",
123
110
  "openai": "^5.9.0",
124
111
  "pg": "^8.10.0",
125
- "redis": "^4.6.13",
126
112
  "rimraf": "^4.4.1",
127
113
  "terser": "^5.37.0",
128
- "ts-jest": "^29.0.5",
129
114
  "ts-node": "^10.9.1",
130
115
  "ts-node-dev": "^2.0.0",
131
116
  "typedoc": "^0.26.4",
132
- "typescript": "^5.0.4"
117
+ "typescript": "^5.0.4",
118
+ "vitest": "^2.1.9"
133
119
  },
134
120
  "peerDependencies": {
135
- "ioredis": "^4.0.0 || ^5.0.0",
136
121
  "nats": "^2.0.0",
137
- "pg": "^8.0.0",
138
- "redis": "^4.0.0"
122
+ "pg": "^8.0.0"
139
123
  }
140
124
  }