@hotmeshio/hotmesh 0.3.8 → 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.
Files changed (154) hide show
  1. package/README.md +2 -17
  2. package/build/index.d.ts +4 -2
  3. package/build/index.js +6 -3
  4. package/build/modules/key.js +1 -1
  5. package/build/modules/utils.d.ts +12 -4
  6. package/build/modules/utils.js +1 -1
  7. package/build/package.json +14 -7
  8. package/build/services/activities/activity.d.ts +9 -9
  9. package/build/services/activities/activity.js +1 -1
  10. package/build/services/activities/await.d.ts +2 -2
  11. package/build/services/activities/await.js +1 -1
  12. package/build/services/activities/cycle.d.ts +2 -2
  13. package/build/services/activities/cycle.js +1 -1
  14. package/build/services/activities/hook.d.ts +2 -2
  15. package/build/services/activities/hook.js +1 -1
  16. package/build/services/activities/index.js +1 -1
  17. package/build/services/activities/interrupt.js +1 -1
  18. package/build/services/activities/signal.js +1 -1
  19. package/build/services/activities/trigger.d.ts +3 -3
  20. package/build/services/activities/trigger.js +1 -1
  21. package/build/services/activities/worker.d.ts +2 -2
  22. package/build/services/activities/worker.js +1 -1
  23. package/build/services/collator/index.d.ts +9 -9
  24. package/build/services/collator/index.js +1 -1
  25. package/build/services/compiler/deployer.d.ts +4 -4
  26. package/build/services/compiler/deployer.js +1 -1
  27. package/build/services/compiler/index.d.ts +4 -4
  28. package/build/services/compiler/index.js +1 -1
  29. package/build/services/compiler/validator.d.ts +3 -3
  30. package/build/services/compiler/validator.js +1 -1
  31. package/build/services/connector/factory.d.ts +6 -0
  32. package/build/services/connector/factory.js +56 -0
  33. package/build/services/connector/index.d.ts +13 -4
  34. package/build/services/connector/index.js +30 -23
  35. package/build/services/connector/providers/ioredis.d.ts +9 -0
  36. package/build/services/connector/providers/ioredis.js +26 -0
  37. package/build/services/connector/providers/nats.d.ts +9 -0
  38. package/build/services/connector/providers/nats.js +26 -0
  39. package/build/services/connector/providers/postgres.d.ts +9 -0
  40. package/build/services/connector/providers/postgres.js +39 -0
  41. package/build/services/connector/providers/redis.d.ts +9 -0
  42. package/build/services/connector/providers/redis.js +38 -0
  43. package/build/services/engine/index.d.ts +12 -12
  44. package/build/services/engine/index.js +1 -1
  45. package/build/services/exporter/index.d.ts +3 -3
  46. package/build/services/exporter/index.js +1 -1
  47. package/build/services/hotmesh/index.js +4 -4
  48. package/build/services/mapper/index.js +1 -1
  49. package/build/services/meshcall/index.d.ts +5 -4
  50. package/build/services/meshcall/index.js +31 -14
  51. package/build/services/meshdata/index.d.ts +6 -6
  52. package/build/services/meshdata/index.js +7 -15
  53. package/build/services/meshflow/connection.d.ts +3 -2
  54. package/build/services/meshflow/exporter.d.ts +3 -3
  55. package/build/services/meshflow/exporter.js +1 -1
  56. package/build/services/meshflow/search.js +12 -4
  57. package/build/services/meshflow/worker.js +7 -7
  58. package/build/services/meshos/index.d.ts +1 -4
  59. package/build/services/meshos/index.js +11 -44
  60. package/build/services/pipe/functions/array.js +1 -1
  61. package/build/services/pipe/functions/bitwise.js +1 -1
  62. package/build/services/pipe/functions/conditional.js +1 -1
  63. package/build/services/pipe/functions/cron.d.ts +2 -0
  64. package/build/services/pipe/functions/cron.js +1 -1
  65. package/build/services/pipe/functions/date.js +1 -1
  66. package/build/services/pipe/functions/index.js +1 -1
  67. package/build/services/pipe/functions/json.js +1 -1
  68. package/build/services/pipe/functions/logical.js +1 -1
  69. package/build/services/pipe/functions/math.js +1 -1
  70. package/build/services/pipe/functions/number.js +1 -1
  71. package/build/services/pipe/functions/object.js +1 -1
  72. package/build/services/pipe/functions/string.js +1 -1
  73. package/build/services/pipe/functions/symbol.js +1 -1
  74. package/build/services/pipe/functions/unary.js +1 -1
  75. package/build/services/pipe/index.js +1 -1
  76. package/build/services/quorum/index.d.ts +5 -5
  77. package/build/services/quorum/index.js +1 -1
  78. package/build/services/reporter/index.d.ts +2 -2
  79. package/build/services/reporter/index.js +1 -1
  80. package/build/services/router/index.d.ts +8 -13
  81. package/build/services/router/index.js +1 -1
  82. package/build/services/search/factory.d.ts +2 -2
  83. package/build/services/search/factory.js +1 -1
  84. package/build/services/search/index.d.ts +5 -4
  85. package/build/services/search/providers/redis/ioredis.js +1 -1
  86. package/build/services/search/providers/redis/redis.js +1 -1
  87. package/build/services/serializer/index.js +1 -1
  88. package/build/services/store/factory.d.ts +3 -3
  89. package/build/services/store/factory.js +1 -1
  90. package/build/services/store/index.d.ts +18 -17
  91. package/build/services/store/providers/redis/_base.d.ts +13 -15
  92. package/build/services/store/providers/redis/_base.js +1 -1
  93. package/build/services/store/providers/redis/ioredis.d.ts +2 -2
  94. package/build/services/store/providers/redis/ioredis.js +1 -1
  95. package/build/services/store/providers/redis/redis.d.ts +2 -2
  96. package/build/services/store/providers/redis/redis.js +1 -1
  97. package/build/services/store/providers/store-initializable.js +1 -1
  98. package/build/services/stream/factory.d.ts +3 -3
  99. package/build/services/stream/factory.js +16 -4
  100. package/build/services/stream/index.d.ts +57 -18
  101. package/build/services/stream/index.js +2 -1
  102. package/build/services/stream/providers/nats/nats.d.ts +59 -0
  103. package/build/services/stream/providers/nats/nats.js +1 -0
  104. package/build/services/stream/providers/postgres/_deploy.d.ts +2 -1
  105. package/build/services/stream/providers/postgres/_deploy.js +1 -1
  106. package/build/services/stream/providers/postgres/postgres.d.ts +0 -0
  107. package/build/services/stream/providers/postgres/postgres.js +0 -0
  108. package/build/services/stream/providers/redis/ioredis.d.ts +53 -14
  109. package/build/services/stream/providers/redis/ioredis.js +1 -1
  110. package/build/services/stream/providers/redis/redis.d.ts +54 -15
  111. package/build/services/stream/providers/redis/redis.js +1 -1
  112. package/build/services/stream/providers/stream-initializable.d.ts +1 -2
  113. package/build/services/stream/providers/stream-initializable.js +1 -1
  114. package/build/services/sub/factory.d.ts +2 -2
  115. package/build/services/sub/factory.js +1 -1
  116. package/build/services/sub/index.d.ts +6 -5
  117. package/build/services/sub/providers/redis/ioredis.d.ts +1 -1
  118. package/build/services/sub/providers/redis/ioredis.js +1 -1
  119. package/build/services/sub/providers/redis/redis.d.ts +4 -4
  120. package/build/services/sub/providers/redis/redis.js +1 -1
  121. package/build/services/task/index.d.ts +5 -5
  122. package/build/services/task/index.js +1 -1
  123. package/build/services/telemetry/index.js +1 -1
  124. package/build/services/worker/index.d.ts +9 -9
  125. package/build/services/worker/index.js +1 -1
  126. package/build/types/hotmesh.d.ts +26 -14
  127. package/build/types/index.d.ts +6 -5
  128. package/build/types/manifest.d.ts +1 -9
  129. package/build/types/meshcall.d.ts +12 -7
  130. package/build/types/meshflow.d.ts +3 -7
  131. package/build/types/nats.d.ts +150 -0
  132. package/build/types/nats.js +2 -0
  133. package/build/types/postgres.d.ts +48 -0
  134. package/build/types/postgres.js +2 -0
  135. package/build/types/provider.d.ts +26 -0
  136. package/build/types/provider.js +2 -0
  137. package/build/types/redis.d.ts +33 -15
  138. package/build/types/stream.d.ts +65 -1
  139. package/index.ts +8 -5
  140. package/package.json +14 -7
  141. package/types/hotmesh.ts +139 -22
  142. package/types/index.ts +26 -17
  143. package/types/manifest.ts +1 -10
  144. package/types/meshcall.ts +38 -13
  145. package/types/meshflow.ts +2 -7
  146. package/types/nats.ts +231 -0
  147. package/types/postgres.ts +54 -0
  148. package/types/provider.ts +71 -0
  149. package/types/redis.ts +63 -18
  150. package/types/stream.ts +85 -1
  151. package/build/services/connector/clients/ioredis.d.ts +0 -13
  152. package/build/services/connector/clients/ioredis.js +0 -48
  153. package/build/services/connector/clients/redis.d.ts +0 -13
  154. 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 StreamConfig = {
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
- };