@hotmeshio/hotmesh 0.3.7 → 0.3.9
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 +15 -18
- package/build/index.d.ts +4 -1
- package/build/index.js +7 -1
- package/build/modules/key.js +1 -1
- package/build/modules/utils.d.ts +12 -4
- package/build/modules/utils.js +1 -1
- package/build/package.json +14 -7
- package/build/services/activities/activity.d.ts +9 -9
- package/build/services/activities/activity.js +1 -1
- package/build/services/activities/await.d.ts +2 -2
- package/build/services/activities/await.js +1 -1
- package/build/services/activities/cycle.d.ts +2 -2
- package/build/services/activities/cycle.js +1 -1
- package/build/services/activities/hook.d.ts +2 -2
- 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.d.ts +3 -3
- package/build/services/activities/trigger.js +1 -1
- package/build/services/activities/worker.d.ts +2 -2
- package/build/services/activities/worker.js +1 -1
- package/build/services/collator/index.d.ts +9 -9
- package/build/services/collator/index.js +1 -1
- package/build/services/compiler/deployer.d.ts +4 -4
- package/build/services/compiler/deployer.js +1 -1
- package/build/services/compiler/index.d.ts +4 -4
- package/build/services/compiler/index.js +1 -1
- package/build/services/compiler/validator.d.ts +3 -3
- package/build/services/compiler/validator.js +1 -1
- package/build/services/connector/factory.d.ts +6 -0
- package/build/services/connector/factory.js +56 -0
- package/build/services/connector/index.d.ts +13 -4
- package/build/services/connector/index.js +30 -23
- package/build/services/connector/providers/ioredis.d.ts +9 -0
- package/build/services/connector/providers/ioredis.js +26 -0
- package/build/services/connector/providers/nats.d.ts +9 -0
- package/build/services/connector/providers/nats.js +26 -0
- package/build/services/connector/providers/postgres.d.ts +9 -0
- package/build/services/connector/providers/postgres.js +39 -0
- package/build/services/connector/providers/redis.d.ts +9 -0
- package/build/services/connector/providers/redis.js +38 -0
- package/build/services/engine/index.d.ts +12 -12
- package/build/services/engine/index.js +1 -1
- package/build/services/exporter/index.d.ts +3 -3
- package/build/services/exporter/index.js +1 -1
- package/build/services/hotmesh/index.js +4 -4
- package/build/services/mapper/index.js +1 -1
- package/build/services/meshcall/index.d.ts +5 -4
- package/build/services/meshcall/index.js +31 -14
- package/build/services/meshdata/index.d.ts +6 -6
- package/build/services/meshdata/index.js +7 -15
- package/build/services/meshflow/connection.d.ts +3 -2
- package/build/services/meshflow/exporter.d.ts +3 -3
- package/build/services/meshflow/exporter.js +1 -1
- package/build/services/meshflow/index.d.ts +2 -0
- package/build/services/meshflow/index.js +2 -0
- package/build/services/meshflow/search.js +12 -4
- package/build/services/meshflow/worker.js +7 -7
- package/build/services/meshos/index.d.ts +1 -4
- package/build/services/meshos/index.js +11 -44
- 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.d.ts +2 -0
- 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.d.ts +5 -5
- package/build/services/quorum/index.js +1 -1
- package/build/services/reporter/index.d.ts +2 -2
- package/build/services/reporter/index.js +1 -1
- package/build/services/router/index.d.ts +8 -13
- package/build/services/router/index.js +1 -1
- package/build/services/search/factory.d.ts +2 -2
- package/build/services/search/factory.js +1 -1
- package/build/services/search/index.d.ts +5 -4
- 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/factory.d.ts +3 -3
- package/build/services/store/factory.js +1 -1
- package/build/services/store/index.d.ts +18 -17
- package/build/services/store/providers/redis/_base.d.ts +13 -15
- package/build/services/store/providers/redis/_base.js +1 -1
- package/build/services/store/providers/redis/ioredis.d.ts +2 -2
- package/build/services/store/providers/redis/ioredis.js +1 -1
- package/build/services/store/providers/redis/redis.d.ts +2 -2
- package/build/services/store/providers/redis/redis.js +1 -1
- package/build/services/store/providers/store-initializable.js +1 -1
- package/build/services/stream/factory.d.ts +3 -3
- package/build/services/stream/factory.js +16 -4
- package/build/services/stream/index.d.ts +57 -18
- package/build/services/stream/index.js +2 -1
- package/build/services/stream/providers/nats/nats.d.ts +59 -0
- package/build/services/stream/providers/nats/nats.js +1 -0
- package/build/services/stream/providers/postgres/_deploy.d.ts +2 -1
- package/build/services/stream/providers/postgres/_deploy.js +1 -1
- package/build/services/stream/providers/postgres/postgres.d.ts +0 -0
- package/build/services/stream/providers/postgres/postgres.js +0 -0
- package/build/services/stream/providers/redis/ioredis.d.ts +53 -14
- package/build/services/stream/providers/redis/ioredis.js +1 -1
- package/build/services/stream/providers/redis/redis.d.ts +54 -15
- package/build/services/stream/providers/redis/redis.js +1 -1
- package/build/services/stream/providers/stream-initializable.d.ts +1 -2
- 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 +1 -1
- package/build/services/sub/index.d.ts +6 -5
- package/build/services/sub/providers/redis/ioredis.d.ts +1 -1
- package/build/services/sub/providers/redis/ioredis.js +1 -1
- package/build/services/sub/providers/redis/redis.d.ts +4 -4
- package/build/services/sub/providers/redis/redis.js +1 -1
- package/build/services/task/index.d.ts +5 -5
- package/build/services/task/index.js +1 -1
- package/build/services/telemetry/index.js +1 -1
- package/build/services/worker/index.d.ts +9 -9
- package/build/services/worker/index.js +1 -1
- package/build/types/hotmesh.d.ts +26 -14
- package/build/types/index.d.ts +6 -5
- package/build/types/manifest.d.ts +1 -9
- package/build/types/meshcall.d.ts +12 -7
- package/build/types/meshflow.d.ts +3 -7
- package/build/types/nats.d.ts +150 -0
- package/build/types/nats.js +2 -0
- package/build/types/postgres.d.ts +48 -0
- package/build/types/postgres.js +2 -0
- package/build/types/provider.d.ts +26 -0
- package/build/types/provider.js +2 -0
- package/build/types/redis.d.ts +33 -15
- package/build/types/stream.d.ts +65 -1
- package/index.ts +10 -4
- package/package.json +14 -7
- package/typedoc.json +2 -1
- package/types/hotmesh.ts +139 -22
- package/types/index.ts +26 -17
- package/types/manifest.ts +1 -10
- package/types/meshcall.ts +38 -13
- package/types/meshflow.ts +2 -7
- package/types/nats.ts +231 -0
- package/types/postgres.ts +54 -0
- package/types/provider.ts +71 -0
- package/types/redis.ts +63 -18
- package/types/stream.ts +85 -1
- package/build/services/connector/clients/ioredis.d.ts +0 -13
- package/build/services/connector/clients/ioredis.js +0 -48
- package/build/services/connector/clients/redis.d.ts +0 -13
- package/build/services/connector/clients/redis.js +0 -60
package/types/stream.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ProviderTransaction } from './provider';
|
|
2
|
+
|
|
1
3
|
/** Represents a policy for retrying stream operations based on error codes */
|
|
2
4
|
export interface StreamRetryPolicy {
|
|
3
5
|
/**
|
|
@@ -121,7 +123,7 @@ export type ReclaimedMessageType = [
|
|
|
121
123
|
][];
|
|
122
124
|
|
|
123
125
|
/** Configuration parameters for a stream */
|
|
124
|
-
export type
|
|
126
|
+
export type RouterConfig = {
|
|
125
127
|
/** Namespace under which the stream operates */
|
|
126
128
|
namespace: string;
|
|
127
129
|
/** Application identifier */
|
|
@@ -141,3 +143,85 @@ export type StreamConfig = {
|
|
|
141
143
|
/** if true, will not process stream messages; default true */
|
|
142
144
|
readonly?: boolean;
|
|
143
145
|
};
|
|
146
|
+
|
|
147
|
+
export type StreamProviderType =
|
|
148
|
+
| 'redis'
|
|
149
|
+
| 'ioredis'
|
|
150
|
+
| 'postgres'
|
|
151
|
+
| 'nats'
|
|
152
|
+
| 'sqs';
|
|
153
|
+
|
|
154
|
+
export interface StreamConfig {
|
|
155
|
+
// Common configuration
|
|
156
|
+
provider?: StreamProviderType;
|
|
157
|
+
namespace?: string;
|
|
158
|
+
appId?: string;
|
|
159
|
+
maxRetries?: number;
|
|
160
|
+
batchSize?: number;
|
|
161
|
+
timeout?: number;
|
|
162
|
+
|
|
163
|
+
// Provider-specific configurations
|
|
164
|
+
redis?: {
|
|
165
|
+
claimTimeout?: number;
|
|
166
|
+
blockingTimeout?: number;
|
|
167
|
+
minIdleTime?: number;
|
|
168
|
+
};
|
|
169
|
+
postgres?: {
|
|
170
|
+
pollInterval?: number;
|
|
171
|
+
vacuumInterval?: number;
|
|
172
|
+
partitionInterval?: 'daily' | 'weekly' | 'monthly';
|
|
173
|
+
cleanupInterval?: number;
|
|
174
|
+
};
|
|
175
|
+
nats?: {
|
|
176
|
+
jetstream?: boolean;
|
|
177
|
+
durableName?: string;
|
|
178
|
+
deliverPolicy?: 'all' | 'last' | 'new' | 'byStartSequence' | 'byStartTime';
|
|
179
|
+
ackWait?: number;
|
|
180
|
+
};
|
|
181
|
+
sqs?: {
|
|
182
|
+
deadLetterQueue?: string;
|
|
183
|
+
visibilityTimeout?: number;
|
|
184
|
+
waitTimeSeconds?: number;
|
|
185
|
+
messageRetentionPeriod?: number;
|
|
186
|
+
dlqArn?: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface StreamMessage {
|
|
191
|
+
id: string;
|
|
192
|
+
data: StreamData;
|
|
193
|
+
metadata?: StreamMessageMetadata;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface StreamMessageMetadata {
|
|
197
|
+
timestamp?: number;
|
|
198
|
+
stream?: string;
|
|
199
|
+
groupName?: string;
|
|
200
|
+
consumerName?: string;
|
|
201
|
+
retryCount?: number;
|
|
202
|
+
deliveryTime?: number;
|
|
203
|
+
originalMessageId?: string;
|
|
204
|
+
[key: string]: any; // For provider-specific metadata
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface StreamStats {
|
|
208
|
+
messageCount: number;
|
|
209
|
+
consumerCount?: number;
|
|
210
|
+
bytesInMemory?: number;
|
|
211
|
+
oldestMessageTimestamp?: number;
|
|
212
|
+
pendingMessages?: number;
|
|
213
|
+
deadLetterQueueMessageCount?: number;
|
|
214
|
+
averageProcessingTime?: number;
|
|
215
|
+
lastErrorTimestamp?: number;
|
|
216
|
+
lastErrorMessage?: string;
|
|
217
|
+
[key: string]: any; // For provider-specific stats
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* When publishing a message to the stream, the configuration
|
|
222
|
+
* can include a transaction object to execute the operation
|
|
223
|
+
* atomically.
|
|
224
|
+
*/
|
|
225
|
+
export interface PublishMessageConfig {
|
|
226
|
+
transaction?: ProviderTransaction;
|
|
227
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IORedisClientOptions as RedisClientOptions, IORedisClassType as RedisClassType, IORedisClientType as RedisClientType } from '../../../types/redis';
|
|
2
|
-
declare class RedisConnection {
|
|
3
|
-
private connection;
|
|
4
|
-
private static instances;
|
|
5
|
-
private id;
|
|
6
|
-
private static clientOptions;
|
|
7
|
-
private createConnection;
|
|
8
|
-
getClient(): RedisClientType;
|
|
9
|
-
disconnect(): Promise<void>;
|
|
10
|
-
static connect(id: string, Redis: Partial<RedisClassType>, options?: RedisClientOptions): Promise<RedisConnection>;
|
|
11
|
-
static disconnectAll(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export { RedisConnection };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RedisConnection = void 0;
|
|
4
|
-
class RedisConnection {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.connection = null;
|
|
7
|
-
this.id = null;
|
|
8
|
-
}
|
|
9
|
-
async createConnection(Redis, options) {
|
|
10
|
-
return new Redis(options);
|
|
11
|
-
}
|
|
12
|
-
getClient() {
|
|
13
|
-
if (!this.connection) {
|
|
14
|
-
throw new Error('Redis client is not connected');
|
|
15
|
-
}
|
|
16
|
-
return this.connection;
|
|
17
|
-
}
|
|
18
|
-
async disconnect() {
|
|
19
|
-
if (this.connection) {
|
|
20
|
-
await this.connection.quit();
|
|
21
|
-
this.connection = null;
|
|
22
|
-
}
|
|
23
|
-
if (this.id) {
|
|
24
|
-
RedisConnection.instances.delete(this.id);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
static async connect(id, Redis, options) {
|
|
28
|
-
if (this.instances.has(id)) {
|
|
29
|
-
return this.instances.get(id);
|
|
30
|
-
}
|
|
31
|
-
const instance = new RedisConnection();
|
|
32
|
-
const opts = options ? { ...options } : { ...this.clientOptions };
|
|
33
|
-
instance.connection = await instance.createConnection(Redis, opts);
|
|
34
|
-
instance.id = id;
|
|
35
|
-
this.instances.set(id, instance);
|
|
36
|
-
return instance;
|
|
37
|
-
}
|
|
38
|
-
static async disconnectAll() {
|
|
39
|
-
await Promise.all(Array.from(this.instances.values()).map((instance) => instance.disconnect()));
|
|
40
|
-
this.instances.clear();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.RedisConnection = RedisConnection;
|
|
44
|
-
RedisConnection.instances = new Map();
|
|
45
|
-
RedisConnection.clientOptions = {
|
|
46
|
-
host: 'localhost',
|
|
47
|
-
port: 6379,
|
|
48
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RedisRedisClassType, RedisRedisClientType, RedisRedisClientOptions } from '../../../types/redis';
|
|
2
|
-
declare class RedisConnection {
|
|
3
|
-
private connection;
|
|
4
|
-
private static instances;
|
|
5
|
-
private id;
|
|
6
|
-
private static clientOptions;
|
|
7
|
-
private createConnection;
|
|
8
|
-
getClient(): RedisRedisClientType;
|
|
9
|
-
disconnect(): Promise<void>;
|
|
10
|
-
static connect(id: string, Redis: Partial<RedisRedisClassType>, options?: RedisRedisClientOptions): Promise<RedisConnection>;
|
|
11
|
-
static disconnectAll(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
export { RedisConnection, RedisRedisClientType };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RedisConnection = void 0;
|
|
4
|
-
class RedisConnection {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.connection = null;
|
|
7
|
-
this.id = null;
|
|
8
|
-
}
|
|
9
|
-
async createConnection(Redis, options) {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
const client = Redis.createClient(options);
|
|
12
|
-
client.on('error', (error) => {
|
|
13
|
-
reject(error);
|
|
14
|
-
});
|
|
15
|
-
client.on('ready', () => {
|
|
16
|
-
resolve(client);
|
|
17
|
-
});
|
|
18
|
-
client.connect();
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
getClient() {
|
|
22
|
-
if (!this.connection) {
|
|
23
|
-
throw new Error('Redis client is not connected');
|
|
24
|
-
}
|
|
25
|
-
return this.connection;
|
|
26
|
-
}
|
|
27
|
-
async disconnect() {
|
|
28
|
-
if (this.connection) {
|
|
29
|
-
await this.connection.quit();
|
|
30
|
-
this.connection = null;
|
|
31
|
-
}
|
|
32
|
-
if (this.id) {
|
|
33
|
-
RedisConnection.instances.delete(this.id);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
static async connect(id, Redis, options) {
|
|
37
|
-
if (this.instances.has(id)) {
|
|
38
|
-
return this.instances.get(id);
|
|
39
|
-
}
|
|
40
|
-
const instance = new RedisConnection();
|
|
41
|
-
const opts = options ? { ...options } : { ...this.clientOptions };
|
|
42
|
-
instance.connection = (await instance.createConnection(Redis, opts));
|
|
43
|
-
instance.id = id;
|
|
44
|
-
this.instances.set(id, instance);
|
|
45
|
-
return instance;
|
|
46
|
-
}
|
|
47
|
-
static async disconnectAll() {
|
|
48
|
-
await Promise.all(Array.from(this.instances.values()).map((instance) => instance.disconnect()));
|
|
49
|
-
this.instances.clear();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.RedisConnection = RedisConnection;
|
|
53
|
-
RedisConnection.instances = new Map();
|
|
54
|
-
RedisConnection.clientOptions = {
|
|
55
|
-
socket: {
|
|
56
|
-
host: 'localhost',
|
|
57
|
-
port: 6379,
|
|
58
|
-
tls: false,
|
|
59
|
-
},
|
|
60
|
-
};
|