@hotmeshio/hotmesh 0.1.2 → 0.1.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.
Files changed (48) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  3. package/README.md +17 -14
  4. package/build/modules/enums.d.ts +1 -0
  5. package/build/modules/enums.js +2 -1
  6. package/build/modules/key.d.ts +1 -2
  7. package/build/modules/key.js +3 -4
  8. package/build/modules/utils.js +10 -11
  9. package/build/package.json +3 -2
  10. package/build/services/activities/activity.js +1 -1
  11. package/build/services/activities/await.js +1 -1
  12. package/build/services/activities/cycle.js +1 -1
  13. package/build/services/activities/hook.js +1 -1
  14. package/build/services/activities/interrupt.js +1 -1
  15. package/build/services/activities/signal.js +1 -1
  16. package/build/services/activities/trigger.d.ts +2 -1
  17. package/build/services/activities/trigger.js +21 -9
  18. package/build/services/activities/worker.js +1 -1
  19. package/build/services/compiler/deployer.js +1 -1
  20. package/build/services/durable/client.js +5 -1
  21. package/build/services/durable/worker.js +1 -1
  22. package/build/services/engine/index.d.ts +1 -1
  23. package/build/services/engine/index.js +13 -6
  24. package/build/services/hotmesh/index.js +13 -1
  25. package/build/services/router/index.d.ts +2 -0
  26. package/build/services/router/index.js +37 -15
  27. package/build/services/store/clients/ioredis.js +28 -8
  28. package/build/services/store/clients/redis.js +27 -10
  29. package/build/services/store/index.d.ts +6 -2
  30. package/build/services/store/index.js +37 -5
  31. package/build/services/stream/clients/ioredis.js +1 -1
  32. package/build/services/stream/clients/redis.js +23 -23
  33. package/build/services/worker/index.d.ts +1 -1
  34. package/build/services/worker/index.js +4 -2
  35. package/build/types/durable.d.ts +11 -0
  36. package/build/types/hotmesh.d.ts +1 -1
  37. package/build/types/hotmesh.js +1 -1
  38. package/build/types/job.d.ts +11 -0
  39. package/build/types/quorum.d.ts +2 -4
  40. package/build/types/redis.d.ts +3 -0
  41. package/build/types/stream.d.ts +2 -0
  42. package/package.json +3 -2
  43. package/types/durable.ts +14 -1
  44. package/types/hotmesh.ts +1 -1
  45. package/types/job.ts +12 -0
  46. package/types/quorum.ts +2 -4
  47. package/types/redis.ts +3 -0
  48. package/types/stream.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "test:durable:collision": "NODE_ENV=test jest ./tests/durable/collision/index.test.ts --detectOpenHandles --forceExit --verbose",
32
32
  "test:durable:fatal": "NODE_ENV=test jest ./tests/durable/fatal/index.test.ts --detectOpenHandles --forceExit --verbose",
33
33
  "test:durable:goodbye": "NODE_ENV=test jest ./tests/durable/goodbye/index.test.ts --detectOpenHandles --forceExit --verbose",
34
- "test:durable:hello": "NODE_ENV=test jest ./tests/durable/helloworld/index.test.ts --detectOpenHandles --forceExit --verbose",
34
+ "test:durable:hello": "HMSH_IS_CLUSTER=true NODE_ENV=test jest ./tests/durable/helloworld/index.test.ts --detectOpenHandles --forceExit --verbose",
35
35
  "test:durable:hook": "NODE_ENV=test jest ./tests/durable/hook/index.test.ts --detectOpenHandles --forceExit --verbose",
36
36
  "test:durable:interrupt": "NODE_ENV=test jest ./tests/durable/interrupt/index.test.ts --detectOpenHandles --forceExit --verbose",
37
37
  "test:durable:loopactivity": "NODE_ENV=test jest ./tests/durable/loopactivity/index.test.ts --detectOpenHandles --forceExit --verbose",
@@ -41,6 +41,7 @@
41
41
  "test:durable:signal": "NODE_ENV=test jest ./tests/durable/signal/index.test.ts --detectOpenHandles --forceExit --verbose",
42
42
  "test:durable:unknown": "NODE_ENV=test jest ./tests/durable/unknown/index.test.ts --detectOpenHandles --forceExit --verbose",
43
43
  "test:emit": "NODE_ENV=test jest ./tests/functional/emit/index.test.ts --detectOpenHandles --forceExit --verbose",
44
+ "test:expired": "NODE_ENV=test jest ./tests/functional/expired/index.test.ts --detectOpenHandles --forceExit --verbose",
44
45
  "test:functional": "NODE_ENV=test jest ./tests/functional/*/index.test.ts --detectOpenHandles --forceExit --verbose",
45
46
  "test:hmsh": "NODE_ENV=test jest ./tests/functional/index.test.ts --detectOpenHandles --verbose",
46
47
  "test:hook": "NODE_ENV=test jest ./tests/functional/hook/index.test.ts --detectOpenHandles --forceExit --verbose",
package/types/durable.ts CHANGED
@@ -200,7 +200,8 @@ export type WorkflowSearchSchema = Record<
200
200
  * literal value to use for the indexed field name (without including the standard underscore (_) prefix isolate)
201
201
  */
202
202
  fieldName?: string;
203
- }>;
203
+ }
204
+ >;
204
205
 
205
206
  type WorkflowSearchOptions = {
206
207
  /** FT index name (myapp:myindex) */
@@ -312,6 +313,18 @@ type WorkflowOptions = {
312
313
  * default is true; if false, will not await the execution
313
314
  */
314
315
  await?: boolean;
316
+
317
+ /**
318
+ * If provided, the job will initialize in an expired state, reserving
319
+ * only the job ID (HSETNX) and persisting search and marker (if provided).
320
+ * If a `resume` signal is sent before the specified number of seconds,
321
+ * the job will resume as normal, transition to the adjacent children
322
+ * of the trigger. If the job is not resumed within the number
323
+ * of seconds specified, the job will be scrubbed. No dependencies
324
+ * are added for a job in an expired state; however, dependencies
325
+ * will be added after the job is resumed if relevant.
326
+ */
327
+ expired?: number;
315
328
  };
316
329
 
317
330
  /**
package/types/hotmesh.ts CHANGED
@@ -11,7 +11,7 @@ import { LogLevel } from './logger';
11
11
  */
12
12
  enum KeyType {
13
13
  APP = 'APP',
14
- ENGINE_ID = 'ENGINE',
14
+ THROTTLE_RATE = 'THROTTLE_RATE',
15
15
  HOOKS = 'HOOKS',
16
16
  JOB_DEPENDENTS = 'JOB_DEPENDENTS',
17
17
  JOB_STATE = 'JOB_STATE',
package/types/job.ts CHANGED
@@ -106,6 +106,18 @@ type ExtensionType = {
106
106
  * the initial data set.
107
107
  */
108
108
  marker?: StringStringType;
109
+
110
+ /**
111
+ * If provided, the job will initialize in an expired state, reserving
112
+ * only the job ID (HSETNX) and persisting search and marker (if provided).
113
+ * If a `resume` signal is sent before the specified number of seconds,
114
+ * the job will resume as normal, transition the the adjacent children
115
+ * of the trigger. If the job is not resumed within the
116
+ * number of seconds specified, the job will be scrubbed. No dependencies
117
+ * are added for a job in an expired state; however, dependencies will be
118
+ * added after the job is resumed if relevant.
119
+ */
120
+ expired?: number;
109
121
  };
110
122
 
111
123
  /**
package/types/quorum.ts CHANGED
@@ -34,11 +34,9 @@ export type ThrottleOptions = {
34
34
  topic?: string;
35
35
  /** entity/noun */
36
36
  entity?: string;
37
- /** in milliseconds; default is 0 */
37
+ /** in milliseconds; set to -1 for indefinite throttle */
38
38
  throttle: number;
39
- /** namespace
40
- * @default 'durable'
41
- */
39
+ /** namespace */
42
40
  namespace?: string;
43
41
  };
44
42
 
package/types/redis.ts CHANGED
@@ -74,6 +74,7 @@ interface RedisRedisMultiType {
74
74
  XLEN(key: string): this;
75
75
  DEL(key: string): this;
76
76
  EXISTS(key: string): this;
77
+ EXPIRE(key: string, seconds: number): this;
77
78
  HDEL(key: string, itemId: string): this;
78
79
  HGET(key: string, itemId: string): this;
79
80
  HGETALL(key: string): this;
@@ -303,6 +304,8 @@ interface IORedisMultiType {
303
304
  id: string,
304
305
  ...args: string[]
305
306
  ): this;
307
+ del(key: string): this;
308
+ expire(key: string, seconds: number): this;
306
309
  hdel(key: string, itemId: string): this;
307
310
  hget(key: string, itemId: string): this;
308
311
  hgetall(key: string): this;
package/types/stream.ts CHANGED
@@ -130,6 +130,8 @@ export type StreamConfig = {
130
130
  guid: string;
131
131
  /** Role associated with the stream */
132
132
  role: StreamRole;
133
+ /** Default throttle (read from KeyType.THROTTLE_RATE) */
134
+ throttle: number;
133
135
  /** Optional topic for the stream */
134
136
  topic?: string;
135
137
  /** Delay before a message can be reclaimed, defaults to 60,000 milliseconds */