@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.
- package/.claude/settings.local.json +8 -0
- package/README.md +158 -38
- package/build/index.d.ts +1 -3
- package/build/index.js +1 -5
- package/build/modules/utils.js +3 -31
- package/build/package.json +63 -79
- package/build/services/activities/activity.d.ts +97 -9
- package/build/services/activities/activity.js +323 -86
- package/build/services/activities/await.d.ts +101 -0
- package/build/services/activities/await.js +103 -2
- package/build/services/activities/cycle.d.ts +82 -0
- package/build/services/activities/cycle.js +86 -8
- package/build/services/activities/hook.d.ts +144 -1
- package/build/services/activities/hook.js +162 -21
- package/build/services/activities/interrupt.d.ts +112 -0
- package/build/services/activities/interrupt.js +134 -29
- package/build/services/activities/signal.d.ts +111 -4
- package/build/services/activities/signal.js +136 -28
- package/build/services/activities/trigger.d.ts +56 -4
- package/build/services/activities/trigger.js +119 -35
- package/build/services/activities/worker.d.ts +107 -0
- package/build/services/activities/worker.js +109 -2
- package/build/services/collator/index.d.ts +116 -30
- package/build/services/collator/index.js +211 -115
- package/build/services/connector/factory.d.ts +1 -1
- package/build/services/connector/factory.js +1 -11
- package/build/services/engine/index.d.ts +22 -6
- package/build/services/engine/index.js +49 -18
- package/build/services/exporter/index.d.ts +2 -0
- package/build/services/exporter/index.js +1 -0
- package/build/services/hotmesh/index.d.ts +471 -236
- package/build/services/hotmesh/index.js +473 -238
- package/build/services/memflow/client.js +2 -2
- package/build/services/memflow/handle.js +1 -1
- package/build/services/memflow/index.d.ts +1 -1
- package/build/services/memflow/index.js +1 -1
- package/build/services/memflow/workflow/all.d.ts +28 -3
- package/build/services/memflow/workflow/all.js +28 -3
- package/build/services/memflow/workflow/context.d.ts +44 -1
- package/build/services/memflow/workflow/context.js +44 -1
- package/build/services/memflow/workflow/didRun.d.ts +23 -3
- package/build/services/memflow/workflow/didRun.js +23 -3
- package/build/services/memflow/workflow/emit.d.ts +43 -4
- package/build/services/memflow/workflow/emit.js +43 -4
- package/build/services/memflow/workflow/enrich.d.ts +32 -4
- package/build/services/memflow/workflow/enrich.js +32 -4
- package/build/services/memflow/workflow/entityMethods.d.ts +54 -7
- package/build/services/memflow/workflow/entityMethods.js +54 -7
- package/build/services/memflow/workflow/execChild.d.ts +96 -8
- package/build/services/memflow/workflow/execChild.js +96 -8
- package/build/services/memflow/workflow/execHook.d.ts +54 -39
- package/build/services/memflow/workflow/execHook.js +52 -38
- package/build/services/memflow/workflow/execHookBatch.d.ts +82 -29
- package/build/services/memflow/workflow/execHookBatch.js +80 -28
- package/build/services/memflow/workflow/hook.d.ts +68 -3
- package/build/services/memflow/workflow/hook.js +69 -4
- package/build/services/memflow/workflow/index.d.ts +65 -10
- package/build/services/memflow/workflow/index.js +65 -10
- package/build/services/memflow/workflow/interrupt.d.ts +50 -4
- package/build/services/memflow/workflow/interrupt.js +50 -4
- package/build/services/memflow/workflow/interruption.d.ts +49 -16
- package/build/services/memflow/workflow/interruption.js +49 -16
- package/build/services/memflow/workflow/isSideEffectAllowed.d.ts +21 -4
- package/build/services/memflow/workflow/isSideEffectAllowed.js +21 -4
- package/build/services/memflow/workflow/proxyActivities.d.ts +70 -42
- package/build/services/memflow/workflow/proxyActivities.js +70 -42
- package/build/services/memflow/workflow/random.d.ts +33 -3
- package/build/services/memflow/workflow/random.js +33 -3
- package/build/services/memflow/workflow/searchMethods.d.ts +49 -2
- package/build/services/memflow/workflow/searchMethods.js +49 -2
- package/build/services/memflow/workflow/signal.d.ts +51 -22
- package/build/services/memflow/workflow/signal.js +52 -23
- package/build/services/memflow/workflow/sleepFor.d.ts +57 -18
- package/build/services/memflow/workflow/sleepFor.js +57 -18
- package/build/services/memflow/workflow/trace.d.ts +39 -6
- package/build/services/memflow/workflow/trace.js +39 -6
- package/build/services/memflow/workflow/waitFor.d.ts +55 -18
- package/build/services/memflow/workflow/waitFor.js +55 -18
- package/build/services/router/consumption/index.js +1 -1
- package/build/services/search/factory.js +1 -9
- package/build/services/store/factory.js +1 -9
- package/build/services/store/index.d.ts +6 -1
- package/build/services/store/providers/postgres/kvsql.d.ts +4 -0
- package/build/services/store/providers/postgres/kvsql.js +4 -0
- package/build/services/store/providers/postgres/kvtransaction.d.ts +2 -0
- package/build/services/store/providers/postgres/kvtransaction.js +23 -0
- package/build/services/store/providers/postgres/kvtypes/hash/basic.d.ts +51 -0
- package/build/services/store/providers/postgres/kvtypes/hash/basic.js +193 -1
- package/build/services/store/providers/postgres/kvtypes/hash/index.d.ts +4 -0
- package/build/services/store/providers/postgres/kvtypes/hash/index.js +6 -0
- package/build/services/store/providers/postgres/postgres.d.ts +21 -1
- package/build/services/store/providers/postgres/postgres.js +42 -4
- package/build/services/stream/factory.js +1 -17
- package/build/services/stream/providers/postgres/scout.js +2 -2
- package/build/services/sub/factory.js +1 -9
- package/build/services/sub/index.d.ts +1 -1
- package/build/services/sub/providers/postgres/postgres.d.ts +1 -1
- package/build/services/sub/providers/postgres/postgres.js +25 -10
- package/build/services/task/index.d.ts +1 -1
- package/build/services/task/index.js +2 -6
- package/build/services/telemetry/index.js +6 -0
- package/build/types/activity.d.ts +1 -1
- package/build/types/hotmesh.d.ts +1 -1
- package/build/types/index.d.ts +0 -1
- package/build/types/index.js +1 -4
- package/build/types/job.d.ts +1 -1
- package/build/types/memflow.d.ts +1 -1
- package/build/types/provider.d.ts +1 -1
- package/build/types/quorum.d.ts +2 -2
- package/build/vitest.config.d.ts +2 -0
- package/build/vitest.config.js +18 -0
- package/index.ts +0 -4
- package/package.json +63 -79
- package/vitest.config.ts +17 -0
- package/build/services/connector/providers/ioredis.d.ts +0 -9
- package/build/services/connector/providers/ioredis.js +0 -26
- package/build/services/connector/providers/redis.d.ts +0 -9
- package/build/services/connector/providers/redis.js +0 -38
- package/build/services/search/providers/redis/ioredis.d.ts +0 -23
- package/build/services/search/providers/redis/ioredis.js +0 -189
- package/build/services/search/providers/redis/redis.d.ts +0 -23
- package/build/services/search/providers/redis/redis.js +0 -202
- package/build/services/store/providers/redis/_base.d.ts +0 -137
- package/build/services/store/providers/redis/_base.js +0 -980
- package/build/services/store/providers/redis/ioredis.d.ts +0 -20
- package/build/services/store/providers/redis/ioredis.js +0 -190
- package/build/services/store/providers/redis/redis.d.ts +0 -18
- package/build/services/store/providers/redis/redis.js +0 -199
- package/build/services/stream/providers/redis/ioredis.d.ts +0 -61
- package/build/services/stream/providers/redis/ioredis.js +0 -272
- package/build/services/stream/providers/redis/redis.d.ts +0 -61
- package/build/services/stream/providers/redis/redis.js +0 -305
- package/build/services/sub/providers/redis/ioredis.d.ts +0 -20
- package/build/services/sub/providers/redis/ioredis.js +0 -161
- package/build/services/sub/providers/redis/redis.d.ts +0 -18
- package/build/services/sub/providers/redis/redis.js +0 -148
- package/build/types/redis.d.ts +0 -258
- package/build/types/redis.js +0 -11
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
20
|
-
Choose your style: procedural workflows with MemFlow's Temporal API, or functional workflows with HotMesh's YAML syntax.
|
|
26
|
+
## Quickstart
|
|
21
27
|
|
|
22
|
-
|
|
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
|
-
##
|
|
203
|
+
## Common patterns
|
|
189
204
|
|
|
190
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
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, {
|
|
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
|
-
|
|
241
|
+
**Signals** — pause a workflow until an external event arrives.
|
|
223
242
|
|
|
224
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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"));
|
package/build/modules/utils.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
87
|
+
return 'nats';
|
|
116
88
|
}
|
|
117
|
-
return
|
|
89
|
+
return null;
|
|
118
90
|
}
|
|
119
91
|
exports.identifyProvider = identifyProvider;
|
|
120
92
|
/**
|
package/build/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "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": "
|
|
23
|
-
"test:
|
|
24
|
-
"test:
|
|
25
|
-
"test:
|
|
26
|
-
"test:connect
|
|
27
|
-
"test:connect:postgres": "
|
|
28
|
-
"test:connect:
|
|
29
|
-
"test:
|
|
30
|
-
"test:memflow": "
|
|
31
|
-
"test:memflow:basic": "HMSH_LOGLEVEL=info
|
|
32
|
-
"test:memflow:collision": "
|
|
33
|
-
"test:memflow:fatal": "
|
|
34
|
-
"test:memflow:goodbye": "
|
|
35
|
-
"test:memflow:interceptor": "
|
|
36
|
-
"test:memflow:entity": "
|
|
37
|
-
"test:memflow:agent": "
|
|
38
|
-
"test:memflow:hello": "HMSH_TELEMETRY=debug HMSH_LOGLEVEL=
|
|
39
|
-
"test:memflow:hook": "
|
|
40
|
-
"test:memflow:interrupt": "
|
|
41
|
-
"test:memflow:loopactivity": "
|
|
42
|
-
"test:memflow:nested": "
|
|
43
|
-
"test:memflow:pipeline": "
|
|
44
|
-
"test:memflow:retry": "
|
|
45
|
-
"test:memflow:retrypolicy": "
|
|
46
|
-
"test:memflow:sleep": "
|
|
47
|
-
"test:memflow:signal": "
|
|
48
|
-
"test:memflow:unknown": "
|
|
49
|
-
"test:cycle": "
|
|
50
|
-
"test:functional": "
|
|
51
|
-
"test:emit": "
|
|
52
|
-
"test:pending": "
|
|
53
|
-
"test:hmsh": "
|
|
54
|
-
"test:hook": "
|
|
55
|
-
"test:interrupt": "
|
|
56
|
-
"test:parallel": "
|
|
57
|
-
"test:pipe": "
|
|
58
|
-
"test:quorum": "
|
|
59
|
-
"test:reclaim": "
|
|
60
|
-
"test:redeploy": "
|
|
61
|
-
"test:reporter": "
|
|
62
|
-
"test:reentrant": "
|
|
63
|
-
"test:retry": "
|
|
64
|
-
"test:retrypolicy": "
|
|
65
|
-
"test:sequence": "
|
|
66
|
-
"test:signal": "
|
|
67
|
-
"test:status": "
|
|
68
|
-
"test:providers": "
|
|
69
|
-
"test:store:
|
|
70
|
-
"test:
|
|
71
|
-
"test:
|
|
72
|
-
"test:
|
|
73
|
-
"test:
|
|
74
|
-
"test:
|
|
75
|
-
"test:
|
|
76
|
-
"test:
|
|
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
|
-
"
|
|
87
|
-
"
|
|
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/
|
|
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
|
}
|