@hotmeshio/hotmesh 0.1.17 → 0.2.0

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/index.d.ts CHANGED
@@ -1,16 +1,7 @@
1
1
  import { MeshCall } from './services/meshcall';
2
2
  import { MeshData } from './services/meshdata';
3
+ import { MeshFlow } from './services/meshflow';
3
4
  import { HotMesh } from './services/hotmesh';
4
- import { ClientService } from './services/meshflow/client';
5
- import { WorkerService } from './services/meshflow/worker';
6
- import { WorkflowService } from './services/meshflow/workflow';
7
- import { ConnectionService } from './services/meshflow/connection';
8
5
  import { HotMeshConfig } from './types/hotmesh';
9
- declare const MeshFlow: {
10
- Client: typeof ClientService;
11
- Worker: typeof WorkerService;
12
- workflow: typeof WorkflowService;
13
- Connection: typeof ConnectionService;
14
- };
15
6
  export { HotMesh, MeshCall, MeshData, MeshFlow, HotMeshConfig, };
16
7
  export * as Types from './types';
package/build/index.js CHANGED
@@ -28,17 +28,8 @@ const meshcall_1 = require("./services/meshcall");
28
28
  Object.defineProperty(exports, "MeshCall", { enumerable: true, get: function () { return meshcall_1.MeshCall; } });
29
29
  const meshdata_1 = require("./services/meshdata");
30
30
  Object.defineProperty(exports, "MeshData", { enumerable: true, get: function () { return meshdata_1.MeshData; } });
31
+ const meshflow_1 = require("./services/meshflow");
32
+ Object.defineProperty(exports, "MeshFlow", { enumerable: true, get: function () { return meshflow_1.MeshFlow; } });
31
33
  const hotmesh_1 = require("./services/hotmesh");
32
34
  Object.defineProperty(exports, "HotMesh", { enumerable: true, get: function () { return hotmesh_1.HotMesh; } });
33
- const client_1 = require("./services/meshflow/client");
34
- const worker_1 = require("./services/meshflow/worker");
35
- const workflow_1 = require("./services/meshflow/workflow");
36
- const connection_1 = require("./services/meshflow/connection");
37
- const MeshFlow = {
38
- Client: client_1.ClientService,
39
- Worker: worker_1.WorkerService,
40
- workflow: workflow_1.WorkflowService,
41
- Connection: connection_1.ConnectionService,
42
- };
43
- exports.MeshFlow = MeshFlow;
44
35
  exports.Types = __importStar(require("./types"));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.1.16",
3
+ "version": "0.2.0",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -127,7 +127,7 @@ class MeshCall {
127
127
  }
128
128
  static async flush(params) {
129
129
  const hotMeshInstance = await MeshCall.getInstance(params.namespace, params.redis);
130
- await hotMeshInstance.scrub(params.id);
130
+ await hotMeshInstance.scrub(params.id ?? params?.options?.id);
131
131
  }
132
132
  static async cron(params) {
133
133
  try {
@@ -140,14 +140,17 @@ class MeshCall {
140
140
  namespace: params.namespace,
141
141
  });
142
142
  const TOPIC = `${params.namespace ?? key_1.HMNS}.cron`;
143
+ const interval = (0, ms_1.default)(params.options.interval) / 1000;
144
+ const delay = params.options.delay ? (0, ms_1.default)(params.options.delay) / 1000 : undefined;
145
+ const maxCycles = params.options.maxCycles ?? 1000000;
143
146
  const hotMeshInstance = await MeshCall.getInstance(params.namespace, params.redis);
144
147
  await hotMeshInstance.pub(TOPIC, {
145
148
  id: params.options.id,
146
149
  topic: params.topic,
147
150
  args: params.args,
148
- interval: params.options.interval,
149
- maxCycles: params.options.maxCycles ?? 1000000000,
150
- maxDuration: params.options.maxDuration,
151
+ interval,
152
+ maxCycles,
153
+ delay,
151
154
  });
152
155
  return true;
153
156
  }
@@ -98,10 +98,6 @@ const getWorkflowYAML = (appId = key_1.HMNS, version = exports.VERSION) => {
98
98
  maxCycles:
99
99
  type: number
100
100
  description: maximum number of cycles to run before stopping
101
- maxDuration:
102
- type: integer
103
- description: timevalue (GMT) ceiling. If the current time exceeds this value, the cron will stop.
104
- example: 1630000000000
105
101
 
106
102
  output:
107
103
  schema:
@@ -11,7 +11,7 @@ interface MeshCallConnectParams {
11
11
  namespace?: string;
12
12
  topic: string;
13
13
  redis: RedisConfig;
14
- callback: <T extends any[], U>(...args: T) => Promise<U>;
14
+ callback: (...args: any[]) => any;
15
15
  }
16
16
  interface MeshCallExecParams {
17
17
  namespace?: string;
@@ -20,17 +20,21 @@ interface MeshCallExecParams {
20
20
  redis: RedisConfig;
21
21
  options?: MeshCallExecOptions;
22
22
  }
23
+ interface MeshCallFlushOptions {
24
+ id: string;
25
+ }
23
26
  interface MeshCallFlushParams {
24
27
  namespace?: string;
25
- id: string;
28
+ id?: string;
26
29
  topic: string;
27
30
  redis: RedisConfig;
31
+ options?: MeshCallFlushOptions;
28
32
  }
29
33
  interface MeshCallCronOptions {
30
34
  id: string;
31
35
  interval: string;
32
36
  maxCycles?: number;
33
- maxDuration?: string;
37
+ delay?: string;
34
38
  }
35
39
  interface MeshCallInterruptOptions {
36
40
  id: string;
@@ -42,7 +46,7 @@ interface MeshCallCronParams {
42
46
  topic: string;
43
47
  redis: RedisConfig;
44
48
  args: any[];
45
- callback: <T extends any[], U>(...args: T) => Promise<U>;
49
+ callback: (...args: any[]) => any;
46
50
  options: MeshCallCronOptions;
47
51
  }
48
52
  interface MeshCallInterruptParams {
@@ -51,4 +55,4 @@ interface MeshCallInterruptParams {
51
55
  redis: RedisConfig;
52
56
  options: MeshCallInterruptOptions;
53
57
  }
54
- export { MeshCallConnectParams, MeshCallExecParams, MeshCallCronParams, MeshCallExecOptions, MeshCallCronOptions, MeshCallInterruptOptions, MeshCallInterruptParams, MeshCallFlushParams, };
58
+ export { MeshCallConnectParams, MeshCallExecParams, MeshCallCronParams, MeshCallExecOptions, MeshCallCronOptions, MeshCallInterruptOptions, MeshCallInterruptParams, MeshCallFlushOptions, MeshCallFlushParams, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.1.17",
3
+ "version": "0.2.0",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",