@hotmeshio/hotmesh 0.14.2 → 0.14.4
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/build/package.json +5 -3
- package/build/services/durable/worker.js +4 -0
- package/build/services/engine/init.js +1 -1
- package/build/services/engine/schema.js +5 -1
- package/build/services/mapper/index.d.ts +57 -2
- package/build/services/mapper/index.js +57 -2
- package/build/services/pipe/index.d.ts +444 -10
- package/build/services/pipe/index.js +444 -10
- package/build/services/quorum/index.js +1 -1
- package/build/services/router/consumption/index.js +20 -2
- package/build/services/router/error-handling/index.js +1 -1
- package/build/services/store/factory.d.ts +1 -1
- package/build/services/store/factory.js +2 -2
- package/build/services/store/index.d.ts +1 -1
- package/build/services/store/providers/postgres/kvsql.d.ts +11 -1
- package/build/services/store/providers/postgres/kvsql.js +22 -12
- package/build/services/store/providers/postgres/kvtables.js +39 -6
- package/build/services/store/providers/postgres/kvtypes/hash/basic.js +6 -6
- package/build/services/store/providers/postgres/kvtypes/hash/scan.js +2 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +7 -6
- package/build/services/store/providers/postgres/kvtypes/string.js +3 -3
- package/build/services/store/providers/postgres/kvtypes/zset.js +7 -7
- package/build/services/store/providers/postgres/postgres.d.ts +3 -2
- package/build/services/store/providers/postgres/postgres.js +55 -55
- package/build/services/store/providers/postgres/time-notify.js +18 -25
- package/build/services/store/providers/store-initializable.d.ts +1 -1
- package/build/services/stream/registry.d.ts +1 -0
- package/build/services/stream/registry.js +12 -8
- package/build/services/worker/index.js +3 -1
- package/build/types/hotmesh.d.ts +8 -0
- package/package.json +5 -3
- package/vitest.config.mts +1 -1
|
@@ -29,6 +29,7 @@ class StreamConsumerRegistry {
|
|
|
29
29
|
topic: taskQueue,
|
|
30
30
|
reclaimDelay: config?.reclaimDelay,
|
|
31
31
|
reclaimCount: config?.reclaimCount,
|
|
32
|
+
readonly: config?.readonly || false,
|
|
32
33
|
throttle,
|
|
33
34
|
retry: config?.retry,
|
|
34
35
|
}, stream, logger);
|
|
@@ -39,14 +40,17 @@ class StreamConsumerRegistry {
|
|
|
39
40
|
logger,
|
|
40
41
|
};
|
|
41
42
|
StreamConsumerRegistry.workerConsumers.set(key, entry);
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
// Only start consuming if not readonly
|
|
44
|
+
if (!config?.readonly) {
|
|
45
|
+
// Create the dispatch callback that routes by workflow_name
|
|
46
|
+
const dispatchCallback = StreamConsumerRegistry.createWorkerDispatcher(key);
|
|
47
|
+
// Start consuming from the task queue stream
|
|
48
|
+
const streamKey = stream.mintKey(key_1.KeyType.STREAMS, {
|
|
49
|
+
appId,
|
|
50
|
+
topic: taskQueue,
|
|
51
|
+
});
|
|
52
|
+
router.consumeMessages(streamKey, 'WORKER', guid, dispatchCallback);
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
// Register the callback for this workflow name
|
|
52
56
|
entry.callbacks.set(workflowName, callback);
|
|
@@ -51,6 +51,7 @@ class WorkerService {
|
|
|
51
51
|
await registry_1.StreamConsumerRegistry.registerWorker(namespace, appId, guid, worker.topic, worker.workflowName, worker.callback, service.stream, service.store, logger, {
|
|
52
52
|
reclaimDelay: worker.reclaimDelay,
|
|
53
53
|
reclaimCount: worker.reclaimCount,
|
|
54
|
+
readonly: worker.readonly,
|
|
54
55
|
retry: worker.retry,
|
|
55
56
|
});
|
|
56
57
|
// Still need a router for publishing responses back to engine
|
|
@@ -86,7 +87,7 @@ class WorkerService {
|
|
|
86
87
|
* @private
|
|
87
88
|
*/
|
|
88
89
|
async initStoreChannel(service, store) {
|
|
89
|
-
service.store = await factory_4.StoreServiceFactory.init(store, service.namespace, service.appId, service.logger);
|
|
90
|
+
service.store = await factory_4.StoreServiceFactory.init(store, service.namespace, service.appId, service.logger, service.guid, 'worker');
|
|
90
91
|
}
|
|
91
92
|
/**
|
|
92
93
|
* @private
|
|
@@ -114,6 +115,7 @@ class WorkerService {
|
|
|
114
115
|
reclaimDelay: worker.reclaimDelay,
|
|
115
116
|
reclaimCount: worker.reclaimCount,
|
|
116
117
|
throttle,
|
|
118
|
+
readonly: worker.readonly || false,
|
|
117
119
|
retry: worker.retry,
|
|
118
120
|
}, this.stream, logger);
|
|
119
121
|
}
|
package/build/types/hotmesh.d.ts
CHANGED
|
@@ -284,6 +284,14 @@ type HotMeshWorker = {
|
|
|
284
284
|
user: string;
|
|
285
285
|
password: string;
|
|
286
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* If true, the worker's router will not consume messages from the
|
|
289
|
+
* stream. The worker can still publish responses but will never
|
|
290
|
+
* dequeue or process messages. This is inherited from the
|
|
291
|
+
* connection's `readonly` flag by the Durable layer.
|
|
292
|
+
* @default false
|
|
293
|
+
*/
|
|
294
|
+
readonly?: boolean;
|
|
287
295
|
};
|
|
288
296
|
type HotMeshConfig = {
|
|
289
297
|
appId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "Durable Workflow",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"obfuscate": "ts-node scripts/obfuscate.ts",
|
|
15
15
|
"clean-build": "npm run clean && npm run build",
|
|
16
16
|
"clean-build-obfuscate": "npm run clean-build && npm run obfuscate",
|
|
17
|
-
"docs": "typedoc",
|
|
18
|
-
"docs:clean": "rimraf ./docs/hotmesh && typedoc",
|
|
17
|
+
"docs": "typedoc && cp -R docs/hotmesh/* docs/ && rm -rf docs/hotmesh",
|
|
18
|
+
"docs:clean": "rimraf ./docs/hotmesh && typedoc && cp -R docs/hotmesh/* docs/ && rm -rf docs/hotmesh",
|
|
19
19
|
"lint": "eslint . --ext .ts",
|
|
20
20
|
"lint:fix": "eslint . --fix --ext .ts",
|
|
21
21
|
"start": "ts-node src/index.ts",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"test:durable:retrypolicy": "vitest run tests/durable/retry-policy",
|
|
48
48
|
"test:durable:sleep": "vitest run tests/durable/sleep/postgres.test.ts",
|
|
49
49
|
"test:durable:signal": "vitest run tests/durable/signal/postgres.test.ts",
|
|
50
|
+
"test:durable:readonly": "docker compose --profile readonly up -d --build && docker compose exec hotmesh-readonly npx vitest run --config tests/durable/readonly/vitest.config.mts",
|
|
50
51
|
"test:durable:unknown": "vitest run tests/durable/unknown/postgres.test.ts",
|
|
51
52
|
"test:durable:exporter": "HMSH_LOGLEVEL=info vitest run tests/durable/exporter",
|
|
52
53
|
"test:durable:exporter:debug": "EXPORT_DEBUG=1 HMSH_LOGLEVEL=error vitest run tests/durable/basic/postgres.test.ts",
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
"test:unit": "vitest run tests/unit"
|
|
86
87
|
},
|
|
87
88
|
"keywords": [
|
|
89
|
+
"Invisible Infrastructure",
|
|
88
90
|
"Headless Orchestration",
|
|
89
91
|
"Durable Workflows",
|
|
90
92
|
"Data in Motion",
|
package/vitest.config.mts
CHANGED
|
@@ -5,7 +5,7 @@ export default defineConfig({
|
|
|
5
5
|
globals: true,
|
|
6
6
|
environment: 'node',
|
|
7
7
|
include: ['tests/**/*.test.ts'],
|
|
8
|
-
exclude: ['node_modules', 'build', 'config'],
|
|
8
|
+
exclude: ['node_modules', 'build', 'config', 'tests/durable/readonly/**'],
|
|
9
9
|
testTimeout: 60_000,
|
|
10
10
|
hookTimeout: 120_000,
|
|
11
11
|
fileParallelism: false,
|