@hotmeshio/hotmesh 0.3.19 → 0.3.21
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/README.md +72 -36
- package/build/index.d.ts +7 -1
- package/build/index.js +13 -1
- package/build/modules/key.js +1 -1
- package/build/modules/utils.d.ts +1 -3
- package/build/modules/utils.js +1 -1
- package/build/package.json +5 -4
- package/build/services/activities/activity.js +1 -1
- package/build/services/activities/await.js +1 -1
- package/build/services/activities/cycle.js +1 -1
- package/build/services/activities/hook.js +1 -1
- package/build/services/activities/index.js +1 -1
- package/build/services/activities/interrupt.js +1 -1
- package/build/services/activities/signal.js +1 -1
- package/build/services/activities/trigger.js +1 -1
- package/build/services/activities/worker.js +1 -1
- package/build/services/collator/index.js +1 -1
- package/build/services/compiler/deployer.js +1 -1
- package/build/services/compiler/index.js +1 -1
- package/build/services/compiler/validator.js +1 -1
- package/build/services/connector/factory.d.ts +1 -0
- package/build/services/connector/factory.js +35 -32
- package/build/services/connector/index.d.ts +4 -2
- package/build/services/connector/index.js +10 -5
- package/build/services/connector/providers/postgres.d.ts +13 -2
- package/build/services/connector/providers/postgres.js +54 -9
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.js +1 -1
- package/build/services/hotmesh/index.js +1 -6
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.js +3 -5
- package/build/services/meshdata/index.d.ts +3 -4
- package/build/services/meshdata/index.js +4 -9
- package/build/services/meshflow/client.js +1 -2
- package/build/services/meshflow/connection.js +1 -0
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/worker.js +5 -8
- package/build/services/meshos/index.d.ts +2 -2
- package/build/services/meshos/index.js +6 -9
- package/build/services/pipe/functions/array.js +1 -1
- package/build/services/pipe/functions/bitwise.js +1 -1
- package/build/services/pipe/functions/conditional.js +1 -1
- package/build/services/pipe/functions/cron.js +1 -1
- package/build/services/pipe/functions/date.js +1 -1
- package/build/services/pipe/functions/index.js +1 -1
- package/build/services/pipe/functions/json.js +1 -1
- package/build/services/pipe/functions/logical.js +1 -1
- package/build/services/pipe/functions/math.js +1 -1
- package/build/services/pipe/functions/number.js +1 -1
- package/build/services/pipe/functions/object.js +1 -1
- package/build/services/pipe/functions/string.js +1 -1
- package/build/services/pipe/functions/symbol.js +1 -1
- package/build/services/pipe/functions/unary.js +1 -1
- package/build/services/pipe/index.js +1 -1
- package/build/services/quorum/index.js +1 -1
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.js +1 -1
- package/build/services/search/providers/postgres/postgres.js +1 -1
- package/build/services/search/providers/redis/ioredis.js +1 -1
- package/build/services/search/providers/redis/redis.js +1 -1
- package/build/services/serializer/index.js +1 -1
- package/build/services/store/providers/postgres/kvsql.js +1 -1
- package/build/services/store/providers/postgres/kvtables.d.ts +2 -2
- package/build/services/store/providers/postgres/kvtables.js +1 -1
- package/build/services/store/providers/postgres/kvtransaction.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/hash.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/string.js +1 -1
- package/build/services/store/providers/postgres/kvtypes/zset.js +1 -1
- package/build/services/store/providers/postgres/postgres.js +1 -1
- package/build/services/store/providers/redis/_base.js +1 -1
- package/build/services/store/providers/redis/ioredis.js +1 -1
- package/build/services/store/providers/redis/redis.js +1 -1
- package/build/services/store/providers/store-initializable.js +1 -1
- package/build/services/stream/providers/nats/nats.js +1 -1
- package/build/services/stream/providers/postgres/postgres.js +1 -1
- package/build/services/stream/providers/redis/ioredis.js +1 -1
- package/build/services/stream/providers/redis/redis.js +1 -1
- package/build/services/stream/providers/stream-initializable.js +1 -1
- package/build/services/sub/factory.d.ts +2 -2
- package/build/services/sub/factory.js +13 -8
- package/build/services/sub/providers/nats/nats.d.ts +19 -0
- package/build/services/sub/providers/nats/nats.js +1 -0
- package/build/services/sub/providers/postgres/postgres.d.ts +1 -0
- package/build/services/sub/providers/postgres/postgres.js +1 -1
- package/build/services/sub/providers/redis/ioredis.js +1 -1
- package/build/services/sub/providers/redis/redis.js +1 -1
- package/build/services/task/index.js +1 -1
- package/build/services/telemetry/index.js +1 -1
- package/build/services/worker/index.js +1 -1
- package/build/types/hotmesh.d.ts +3 -17
- package/build/types/manifest.d.ts +2 -10
- package/build/types/nats.d.ts +8 -0
- package/build/types/postgres.d.ts +10 -1
- package/build/types/provider.d.ts +1 -0
- package/index.ts +24 -5
- package/package.json +5 -4
- package/types/hotmesh.ts +17 -17
- package/types/manifest.ts +2 -10
- package/types/nats.ts +34 -0
- package/types/postgres.ts +13 -2
- package/types/provider.ts +4 -0
package/index.ts
CHANGED
|
@@ -7,26 +7,45 @@ import { MeshData } from './services/meshdata';
|
|
|
7
7
|
import { MeshOS } from './services/meshos';
|
|
8
8
|
import * as Errors from './modules/errors';
|
|
9
9
|
import * as Utils from './modules/utils';
|
|
10
|
+
import * as Enums from './modules/enums';
|
|
11
|
+
import * as KeyStore from './modules/key';
|
|
10
12
|
import { ConnectorService as Connector } from './services/connector/factory';
|
|
13
|
+
import { PostgresConnection as ConnectorPostgres } from './services/connector/providers/postgres';
|
|
14
|
+
import { RedisConnection as ConnectorIORedis } from './services/connector/providers/ioredis';
|
|
15
|
+
import { RedisConnection as ConnectorRedis } from './services/connector/providers/redis';
|
|
16
|
+
import { NatsConnection as ConnectorNATS } from './services/connector/providers/nats';
|
|
11
17
|
|
|
12
18
|
const { Client, Connection, Search, Worker, workflow } = MeshFlow;
|
|
13
19
|
|
|
14
20
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
//Provider Connectors
|
|
22
|
+
Connector, //factory
|
|
23
|
+
ConnectorIORedis,
|
|
24
|
+
ConnectorNATS,
|
|
25
|
+
ConnectorPostgres,
|
|
26
|
+
ConnectorRedis,
|
|
27
|
+
|
|
28
|
+
//Top-level Modules
|
|
19
29
|
HotMesh,
|
|
20
30
|
HotMeshConfig,
|
|
21
31
|
MeshCall,
|
|
22
32
|
MeshData,
|
|
23
33
|
MeshFlow,
|
|
24
34
|
MeshOS,
|
|
35
|
+
|
|
36
|
+
//MeshFlow Submodules
|
|
37
|
+
Client,
|
|
38
|
+
Connection,
|
|
25
39
|
Search,
|
|
26
|
-
Utils,
|
|
27
40
|
Worker,
|
|
28
41
|
workflow,
|
|
29
42
|
WorkflowHandle,
|
|
43
|
+
|
|
44
|
+
//Global Modules
|
|
45
|
+
Enums,
|
|
46
|
+
Errors,
|
|
47
|
+
Utils,
|
|
48
|
+
KeyStore,
|
|
30
49
|
};
|
|
31
50
|
|
|
32
51
|
export * as Types from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/hotmesh",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Serverless Workflow",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"test:connect:nats": "NODE_ENV=test jest ./tests/unit/services/connector/providers/nats.test.ts --detectOpenHandles --forceExit --verbose",
|
|
28
28
|
"test:cycle": "NODE_ENV=test jest ./tests/functional/cycle/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
29
29
|
"test:meshflow": "NODE_ENV=test jest ./tests/meshflow/*/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
30
|
-
"test:meshflow:basic": "NODE_ENV=test jest ./tests/meshflow/basic/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
30
|
+
"test:meshflow:basic": "HMSH_LOGLEVEL=info NODE_ENV=test jest ./tests/meshflow/basic/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
31
31
|
"test:meshflow:collision": "NODE_ENV=test jest ./tests/meshflow/collision/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
32
32
|
"test:meshflow:fatal": "NODE_ENV=test jest ./tests/meshflow/fatal/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
33
33
|
"test:meshflow:goodbye": "NODE_ENV=test jest ./tests/meshflow/goodbye/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
34
34
|
"test:meshflow:hello": "HMSH_LOGLEVEL=debug HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/meshflow/helloworld/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
35
35
|
"test:meshflow:hook": "NODE_ENV=test jest ./tests/meshflow/hook/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
36
36
|
"test:meshflow:interrupt": "NODE_ENV=test jest ./tests/meshflow/interrupt/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
37
|
-
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity
|
|
37
|
+
"test:meshflow:loopactivity": "NODE_ENV=test jest ./tests/meshflow/loopactivity/I.test.ts --detectOpenHandles --forceExit --verbose",
|
|
38
38
|
"test:meshflow:nested": "NODE_ENV=test jest ./tests/meshflow/nested/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
39
39
|
"test:meshflow:retry": "NODE_ENV=test jest ./tests/meshflow/retry/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
40
40
|
"test:meshflow:sleep": "NODE_ENV=test jest ./tests/meshflow/sleep/*.test.ts --detectOpenHandles --forceExit --verbose",
|
|
@@ -68,8 +68,9 @@
|
|
|
68
68
|
"test:sub:ioredis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/ioredis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
69
69
|
"test:sub:redis": "NODE_ENV=test jest ./tests/functional/sub/providers/redis/redis.test.ts --detectOpenHandles --forceExit --verbose",
|
|
70
70
|
"test:sub:postgres": "NODE_ENV=test jest ./tests/functional/sub/providers/postgres/postgres.test.ts --detectOpenHandles --forceExit --verbose",
|
|
71
|
+
"test:sub:nats": "NODE_ENV=test jest ./tests/functional/sub/providers/nats/nats.test.ts --detectOpenHandles --forceExit --verbose",
|
|
71
72
|
"test:trigger": "NODE_ENV=test jest ./tests/unit/services/activities/trigger.test.ts --detectOpenHandles --forceExit --verbose",
|
|
72
|
-
"test:meshdata": "NODE_ENV=test jest ./tests/meshdata
|
|
73
|
+
"test:meshdata": "NODE_ENV=test jest ./tests/meshdata/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
73
74
|
"test:meshos": "NODE_ENV=test HMSH_IS_CLUSTER=true jest ./tests/meshos/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
74
75
|
"test:meshcall": "NODE_ENV=test jest ./tests/meshcall/*.test.ts --forceExit --verbose --detectOpenHandles",
|
|
75
76
|
"test:unit": "NODE_ENV=test jest ./tests/unit/*/*/index.test.ts --detectOpenHandles --forceExit --verbose"
|
package/types/hotmesh.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { HotMesh as HotMeshService } from '../services/hotmesh';
|
|
|
4
4
|
import { HookRules } from './hook';
|
|
5
5
|
import { StreamData, StreamDataResponse } from './stream';
|
|
6
6
|
import { LogLevel } from './logger';
|
|
7
|
-
import { ProviderClient, ProviderConfig } from './provider';
|
|
7
|
+
import { ProviderClient, ProviderConfig, ProvidersConfig } from './provider';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* the full set of entity types that are stored in the key/value store
|
|
@@ -88,19 +88,19 @@ type HotMeshEngine = {
|
|
|
88
88
|
* short-form format for the connection options for the
|
|
89
89
|
* store, stream, sub, and search clients
|
|
90
90
|
*/
|
|
91
|
-
connection?: ProviderConfig;
|
|
91
|
+
connection?: ProviderConfig | ProvidersConfig;
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* long-form format for the connection options for the
|
|
95
95
|
* store, stream, sub, and search clients
|
|
96
96
|
*/
|
|
97
|
-
connections?: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
97
|
+
// connections?: {
|
|
98
|
+
// store: ProviderConfig;
|
|
99
|
+
// stream: ProviderConfig;
|
|
100
|
+
// sub: ProviderConfig;
|
|
101
|
+
// pub?: ProviderConfig; //system injects if necessary (if store channel cannot be used for pub)
|
|
102
|
+
// search?: ProviderConfig; //inherits from store if not set
|
|
103
|
+
// };
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* the number of milliseconds to wait before reclaiming a stream;
|
|
@@ -171,19 +171,19 @@ type HotMeshWorker = {
|
|
|
171
171
|
* short-form format for the connection options for the
|
|
172
172
|
* store, stream, sub, and search clients
|
|
173
173
|
*/
|
|
174
|
-
connection?: ProviderConfig;
|
|
174
|
+
connection?: ProviderConfig | ProvidersConfig;
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* long-form format for the connection options for the
|
|
178
178
|
* store, stream, sub, and search clients
|
|
179
179
|
*/
|
|
180
|
-
connections?: {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
};
|
|
180
|
+
// connections?: {
|
|
181
|
+
// store: ProviderConfig;
|
|
182
|
+
// stream: ProviderConfig;
|
|
183
|
+
// sub: ProviderConfig;
|
|
184
|
+
// pub?: ProviderConfig; //if store channel cannot be used for pub
|
|
185
|
+
// search?: ProviderConfig; //inherits from store if not set
|
|
186
|
+
// };
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
189
|
* the number of milliseconds to wait before reclaiming a stream;
|
package/types/manifest.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { MeshOS } from '../services/meshos';
|
|
2
2
|
|
|
3
3
|
import { WorkflowSearchSchema } from './meshflow';
|
|
4
|
-
import
|
|
5
|
-
import { ProviderConfig } from './provider';
|
|
4
|
+
import { ProviderConfig, ProvidersConfig } from './provider';
|
|
6
5
|
|
|
7
6
|
export type DB = {
|
|
8
7
|
name: string;
|
|
9
8
|
label: string;
|
|
10
9
|
search: boolean;
|
|
11
|
-
connection
|
|
12
|
-
connections?: {
|
|
13
|
-
store: ProviderConfig;
|
|
14
|
-
stream: ProviderConfig;
|
|
15
|
-
sub: ProviderConfig;
|
|
16
|
-
pub?: ProviderConfig; //system injects if necessary (if store channel cannot be used for pub)
|
|
17
|
-
search?: ProviderConfig; //inherits from store if not set
|
|
18
|
-
};
|
|
10
|
+
connection: ProviderConfig | ProvidersConfig;
|
|
19
11
|
};
|
|
20
12
|
|
|
21
13
|
export type SubClassInstance<T extends typeof MeshOS> = T extends abstract new (
|
package/types/nats.ts
CHANGED
|
@@ -35,6 +35,40 @@ export interface NatsConnection extends ProviderClient {
|
|
|
35
35
|
close(): Promise<void>;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export interface NatsSubscriptionType {
|
|
39
|
+
/**
|
|
40
|
+
* Unsubscribes from the subject, stopping message delivery.
|
|
41
|
+
*/
|
|
42
|
+
unsubscribe(): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Drains the subscription, ensuring all pending messages are delivered
|
|
46
|
+
* before unsubscribing.
|
|
47
|
+
* @returns Promise<void>
|
|
48
|
+
*/
|
|
49
|
+
drain(): Promise<void>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The subject this subscription is listening to.
|
|
53
|
+
*/
|
|
54
|
+
subject: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The queue group this subscription belongs to, if any.
|
|
58
|
+
*/
|
|
59
|
+
queue?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Indicates whether this subscription is currently active.
|
|
63
|
+
*/
|
|
64
|
+
isClosed: boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Async iterator for processing incoming messages.
|
|
68
|
+
*/
|
|
69
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<NatsMessageType>;
|
|
70
|
+
}
|
|
71
|
+
|
|
38
72
|
/** Type representing the NATS Connection */
|
|
39
73
|
export type NatsClientType = NatsConnection;
|
|
40
74
|
|
package/types/postgres.ts
CHANGED
|
@@ -21,18 +21,29 @@ export type PostgresJobEnumType =
|
|
|
21
21
|
|
|
22
22
|
export type PostgresClassType = {
|
|
23
23
|
new (options: PostgresClientOptions): PostgresClientType;
|
|
24
|
-
connect: (options: PostgresClientOptions) => Promise<PostgresClientType>;
|
|
25
24
|
};
|
|
26
25
|
|
|
26
|
+
export type PostgresPoolType = {
|
|
27
|
+
new (options: PostgresClientOptions): PostgresPoolClientType;
|
|
28
|
+
connect: (options: PostgresClientOptions) => Promise<PostgresClientType>;
|
|
29
|
+
//NOTE: query is a shorthand and includes implicit `connect/release` handled by pool
|
|
30
|
+
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
31
|
+
};
|
|
32
|
+
|
|
27
33
|
export interface PostgresClientType {
|
|
34
|
+
connect: () => Promise<PostgresClientType>;
|
|
28
35
|
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
29
36
|
end: () => Promise<void>;
|
|
30
37
|
// Include other methods if necessary
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
export interface PostgresPoolClientType {
|
|
34
|
-
|
|
41
|
+
connect: () => Promise<PostgresClientType>;
|
|
35
42
|
release: () => void;
|
|
43
|
+
end: () => Promise<void>;
|
|
44
|
+
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
45
|
+
idleCount: number;
|
|
46
|
+
totalCount: number;
|
|
36
47
|
// Include other methods if necessary
|
|
37
48
|
}
|
|
38
49
|
|
package/types/provider.ts
CHANGED
|
@@ -67,8 +67,12 @@ export type TransactionResultList = (string | number)[]; // e.g., [3, 2, '0']
|
|
|
67
67
|
export type ProviderConfig = {
|
|
68
68
|
class: any;
|
|
69
69
|
options: StringAnyType;
|
|
70
|
+
/* 'redis' (Class) | 'ioredis' (Class) | 'postgres' (Client module) | 'postgres.pool' | 'postgres.poolclient', 'nats' */
|
|
71
|
+
provider?: string;
|
|
70
72
|
};
|
|
71
73
|
|
|
74
|
+
|
|
75
|
+
|
|
72
76
|
export type ProvidersConfig = {
|
|
73
77
|
sub: ProviderConfig;
|
|
74
78
|
store: ProviderConfig;
|