@hotmeshio/hotmesh 0.1.15 → 0.1.16

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 (134) hide show
  1. package/README.md +623 -209
  2. package/build/index.d.ts +14 -3
  3. package/build/index.js +17 -4
  4. package/build/modules/enums.d.ts +12 -12
  5. package/build/modules/enums.js +15 -25
  6. package/build/modules/errors.d.ts +16 -16
  7. package/build/modules/errors.js +28 -28
  8. package/build/modules/key.d.ts +0 -37
  9. package/build/modules/key.js +4 -45
  10. package/build/modules/utils.d.ts +7 -15
  11. package/build/modules/utils.js +21 -44
  12. package/build/package.json +18 -15
  13. package/build/services/activities/activity.d.ts +0 -31
  14. package/build/services/activities/activity.js +1 -50
  15. package/build/services/activities/await.js +0 -4
  16. package/build/services/activities/cycle.d.ts +0 -7
  17. package/build/services/activities/cycle.js +1 -16
  18. package/build/services/activities/hook.d.ts +0 -6
  19. package/build/services/activities/hook.js +2 -12
  20. package/build/services/activities/interrupt.js +0 -8
  21. package/build/services/activities/signal.d.ts +0 -6
  22. package/build/services/activities/signal.js +0 -15
  23. package/build/services/activities/trigger.d.ts +4 -5
  24. package/build/services/activities/trigger.js +22 -16
  25. package/build/services/activities/worker.js +0 -4
  26. package/build/services/collator/index.d.ts +0 -70
  27. package/build/services/collator/index.js +1 -91
  28. package/build/services/compiler/deployer.js +6 -38
  29. package/build/services/compiler/index.d.ts +0 -15
  30. package/build/services/compiler/index.js +0 -20
  31. package/build/services/compiler/validator.d.ts +0 -3
  32. package/build/services/compiler/validator.js +0 -25
  33. package/build/services/connector/clients/ioredis.js +0 -2
  34. package/build/services/connector/clients/redis.js +0 -2
  35. package/build/services/connector/index.js +0 -2
  36. package/build/services/engine/index.d.ts +1 -10
  37. package/build/services/engine/index.js +1 -48
  38. package/build/services/exporter/index.d.ts +0 -27
  39. package/build/services/exporter/index.js +0 -33
  40. package/build/services/hotmesh/index.d.ts +8 -4
  41. package/build/services/hotmesh/index.js +20 -19
  42. package/build/services/logger/index.js +0 -2
  43. package/build/services/mapper/index.d.ts +0 -14
  44. package/build/services/mapper/index.js +0 -14
  45. package/build/services/meshcall/index.d.ts +21 -0
  46. package/build/services/meshcall/index.js +202 -0
  47. package/build/services/meshcall/schemas/factory.d.ts +2 -0
  48. package/build/services/meshcall/schemas/factory.js +179 -0
  49. package/build/services/meshdata/index.d.ts +75 -0
  50. package/build/services/meshdata/index.js +541 -0
  51. package/build/services/meshflow/client.d.ts +18 -0
  52. package/build/services/{durable → meshflow}/client.js +9 -40
  53. package/build/services/{durable → meshflow}/connection.d.ts +2 -1
  54. package/build/services/{durable → meshflow}/connection.js +1 -0
  55. package/build/services/meshflow/exporter.d.ts +29 -0
  56. package/build/services/{durable → meshflow}/exporter.js +0 -29
  57. package/build/services/meshflow/handle.d.ts +22 -0
  58. package/build/services/{durable → meshflow}/handle.js +0 -46
  59. package/build/services/meshflow/index.d.ts +17 -0
  60. package/build/services/meshflow/index.js +23 -0
  61. package/build/services/meshflow/schemas/factory.d.ts +4 -0
  62. package/build/services/{durable → meshflow}/schemas/factory.js +2 -30
  63. package/build/services/meshflow/search.d.ts +23 -0
  64. package/build/services/{durable → meshflow}/search.js +0 -99
  65. package/build/services/{durable → meshflow}/worker.d.ts +3 -2
  66. package/build/services/{durable → meshflow}/worker.js +23 -39
  67. package/build/services/meshflow/workflow.d.ts +27 -0
  68. package/build/services/{durable → meshflow}/workflow.js +27 -169
  69. package/build/services/pipe/functions/date.d.ts +0 -7
  70. package/build/services/pipe/functions/date.js +0 -7
  71. package/build/services/pipe/functions/math.js +0 -2
  72. package/build/services/pipe/index.d.ts +0 -15
  73. package/build/services/pipe/index.js +2 -23
  74. package/build/services/quorum/index.d.ts +1 -7
  75. package/build/services/quorum/index.js +0 -21
  76. package/build/services/reporter/index.d.ts +0 -5
  77. package/build/services/reporter/index.js +0 -9
  78. package/build/services/router/index.d.ts +0 -9
  79. package/build/services/router/index.js +2 -30
  80. package/build/services/serializer/index.js +6 -23
  81. package/build/services/store/cache.d.ts +0 -19
  82. package/build/services/store/cache.js +0 -19
  83. package/build/services/store/clients/ioredis.d.ts +0 -6
  84. package/build/services/store/clients/ioredis.js +0 -7
  85. package/build/services/store/clients/redis.d.ts +0 -6
  86. package/build/services/store/clients/redis.js +0 -6
  87. package/build/services/store/index.d.ts +0 -55
  88. package/build/services/store/index.js +14 -87
  89. package/build/services/stream/clients/ioredis.js +1 -4
  90. package/build/services/task/index.d.ts +0 -9
  91. package/build/services/task/index.js +0 -31
  92. package/build/services/telemetry/index.d.ts +0 -7
  93. package/build/services/telemetry/index.js +1 -13
  94. package/build/services/worker/index.d.ts +1 -4
  95. package/build/services/worker/index.js +0 -6
  96. package/build/types/activity.d.ts +0 -81
  97. package/build/types/error.d.ts +5 -5
  98. package/build/types/exporter.d.ts +1 -14
  99. package/build/types/hotmesh.d.ts +4 -12
  100. package/build/types/hotmesh.js +0 -3
  101. package/build/types/index.d.ts +5 -3
  102. package/build/types/index.js +1 -1
  103. package/build/types/job.d.ts +1 -95
  104. package/build/types/meshcall.d.ts +54 -0
  105. package/build/types/meshdata.d.ts +59 -0
  106. package/build/types/meshdata.js +2 -0
  107. package/build/types/meshflow.d.ts +202 -0
  108. package/build/types/meshflow.js +2 -0
  109. package/build/types/pipe.d.ts +0 -65
  110. package/build/types/quorum.d.ts +0 -12
  111. package/build/types/redis.d.ts +0 -6
  112. package/build/types/stream.d.ts +0 -59
  113. package/build/types/stream.js +0 -4
  114. package/index.ts +22 -3
  115. package/package.json +18 -15
  116. package/typedoc.json +38 -0
  117. package/types/error.ts +5 -5
  118. package/types/exporter.ts +1 -1
  119. package/types/hotmesh.ts +3 -2
  120. package/types/index.ts +25 -7
  121. package/types/job.ts +19 -1
  122. package/types/meshcall.ts +123 -0
  123. package/types/meshdata.ts +273 -0
  124. package/types/{durable.ts → meshflow.ts} +33 -9
  125. package/build/services/durable/client.d.ts +0 -49
  126. package/build/services/durable/exporter.d.ts +0 -51
  127. package/build/services/durable/handle.d.ts +0 -58
  128. package/build/services/durable/index.d.ts +0 -19
  129. package/build/services/durable/index.js +0 -25
  130. package/build/services/durable/schemas/factory.d.ts +0 -33
  131. package/build/services/durable/search.d.ts +0 -120
  132. package/build/services/durable/workflow.d.ts +0 -143
  133. package/build/types/durable.d.ts +0 -467
  134. /package/build/types/{durable.js → meshcall.js} +0 -0
package/build/index.d.ts CHANGED
@@ -1,5 +1,16 @@
1
- import { Durable } from './services/durable';
2
- import { HotMeshService as HotMesh } from './services/hotmesh';
1
+ import { MeshCall } from './services/meshcall';
2
+ import { MeshData } from './services/meshdata';
3
+ 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';
3
8
  import { HotMeshConfig } from './types/hotmesh';
4
- export { Durable, HotMesh, HotMeshConfig };
9
+ declare const MeshFlow: {
10
+ Client: typeof ClientService;
11
+ Worker: typeof WorkerService;
12
+ workflow: typeof WorkflowService;
13
+ Connection: typeof ConnectionService;
14
+ };
15
+ export { HotMesh, MeshCall, MeshData, MeshFlow, HotMeshConfig, };
5
16
  export * as Types from './types';
package/build/index.js CHANGED
@@ -23,9 +23,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Types = exports.HotMesh = exports.Durable = void 0;
27
- const durable_1 = require("./services/durable");
28
- Object.defineProperty(exports, "Durable", { enumerable: true, get: function () { return durable_1.Durable; } });
26
+ exports.Types = exports.MeshFlow = exports.MeshData = exports.MeshCall = exports.HotMesh = void 0;
27
+ const meshcall_1 = require("./services/meshcall");
28
+ Object.defineProperty(exports, "MeshCall", { enumerable: true, get: function () { return meshcall_1.MeshCall; } });
29
+ const meshdata_1 = require("./services/meshdata");
30
+ Object.defineProperty(exports, "MeshData", { enumerable: true, get: function () { return meshdata_1.MeshData; } });
29
31
  const hotmesh_1 = require("./services/hotmesh");
30
- Object.defineProperty(exports, "HotMesh", { enumerable: true, get: function () { return hotmesh_1.HotMeshService; } });
32
+ 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;
31
44
  exports.Types = __importStar(require("./types"));
@@ -8,15 +8,15 @@ export declare const HMSH_CODE_INTERRUPT = 410;
8
8
  export declare const HMSH_CODE_UNKNOWN = 500;
9
9
  export declare const HMSH_CODE_TIMEOUT = 504;
10
10
  export declare const HMSH_CODE_UNACKED = 999;
11
- export declare const HMSH_CODE_DURABLE_SLEEP = 588;
12
- export declare const HMSH_CODE_DURABLE_ALL = 589;
13
- export declare const HMSH_CODE_DURABLE_CHILD = 590;
14
- export declare const HMSH_CODE_DURABLE_PROXY = 591;
15
- export declare const HMSH_CODE_DURABLE_WAIT = 595;
16
- export declare const HMSH_CODE_DURABLE_TIMEOUT = 596;
17
- export declare const HMSH_CODE_DURABLE_MAXED = 597;
18
- export declare const HMSH_CODE_DURABLE_FATAL = 598;
19
- export declare const HMSH_CODE_DURABLE_RETRYABLE = 599;
11
+ export declare const HMSH_CODE_MESHFLOW_SLEEP = 588;
12
+ export declare const HMSH_CODE_MESHFLOW_ALL = 589;
13
+ export declare const HMSH_CODE_MESHFLOW_CHILD = 590;
14
+ export declare const HMSH_CODE_MESHFLOW_PROXY = 591;
15
+ export declare const HMSH_CODE_MESHFLOW_WAIT = 595;
16
+ export declare const HMSH_CODE_MESHFLOW_TIMEOUT = 596;
17
+ export declare const HMSH_CODE_MESHFLOW_MAXED = 597;
18
+ export declare const HMSH_CODE_MESHFLOW_FATAL = 598;
19
+ export declare const HMSH_CODE_MESHFLOW_RETRYABLE = 599;
20
20
  export declare const HMSH_STATUS_UNKNOWN = "unknown";
21
21
  export declare const HMSH_QUORUM_ROLLCALL_CYCLES = 12;
22
22
  export declare const HMSH_QUORUM_DELAY_MS = 250;
@@ -27,9 +27,9 @@ export declare const MAX_DELAY = 2147483647;
27
27
  export declare const HMSH_MAX_RETRIES: number;
28
28
  export declare const HMSH_MAX_TIMEOUT_MS: number;
29
29
  export declare const HMSH_GRADUATED_INTERVAL_MS: number;
30
- export declare const HMSH_DURABLE_MAX_ATTEMPTS = 3;
31
- export declare const HMSH_DURABLE_MAX_INTERVAL = "120s";
32
- export declare const HMSH_DURABLE_EXP_BACKOFF = 10;
30
+ export declare const HMSH_MESHFLOW_MAX_ATTEMPTS = 3;
31
+ export declare const HMSH_MESHFLOW_MAX_INTERVAL = "120s";
32
+ export declare const HMSH_MESHFLOW_EXP_BACKOFF = 10;
33
33
  export declare const HMSH_BLOCK_TIME_MS: number;
34
34
  export declare const HMSH_XCLAIM_DELAY_MS: number;
35
35
  export declare const HMSH_XCLAIM_COUNT: number;
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HMSH_GUID_SIZE = exports.HMSH_SCOUT_INTERVAL_SECONDS = exports.HMSH_FIDELITY_SECONDS = exports.HMSH_EXPIRE_DURATION = exports.HMSH_XPENDING_COUNT = exports.HMSH_XCLAIM_COUNT = exports.HMSH_XCLAIM_DELAY_MS = exports.HMSH_BLOCK_TIME_MS = exports.HMSH_DURABLE_EXP_BACKOFF = exports.HMSH_DURABLE_MAX_INTERVAL = exports.HMSH_DURABLE_MAX_ATTEMPTS = exports.HMSH_GRADUATED_INTERVAL_MS = exports.HMSH_MAX_TIMEOUT_MS = exports.HMSH_MAX_RETRIES = exports.MAX_DELAY = exports.HMSH_EXPIRE_JOB_SECONDS = exports.HMSH_OTT_WAIT_TIME = exports.HMSH_ACTIVATION_MAX_RETRY = exports.HMSH_QUORUM_DELAY_MS = exports.HMSH_QUORUM_ROLLCALL_CYCLES = exports.HMSH_STATUS_UNKNOWN = exports.HMSH_CODE_DURABLE_RETRYABLE = exports.HMSH_CODE_DURABLE_FATAL = exports.HMSH_CODE_DURABLE_MAXED = exports.HMSH_CODE_DURABLE_TIMEOUT = exports.HMSH_CODE_DURABLE_WAIT = exports.HMSH_CODE_DURABLE_PROXY = exports.HMSH_CODE_DURABLE_CHILD = exports.HMSH_CODE_DURABLE_ALL = exports.HMSH_CODE_DURABLE_SLEEP = exports.HMSH_CODE_UNACKED = exports.HMSH_CODE_TIMEOUT = exports.HMSH_CODE_UNKNOWN = exports.HMSH_CODE_INTERRUPT = exports.HMSH_CODE_NOTFOUND = exports.HMSH_CODE_PENDING = exports.HMSH_CODE_SUCCESS = exports.HMSH_IS_CLUSTER = exports.HMSH_LOGLEVEL = void 0;
4
- // HOTMESH SYSTEM
3
+ exports.HMSH_GUID_SIZE = exports.HMSH_SCOUT_INTERVAL_SECONDS = exports.HMSH_FIDELITY_SECONDS = exports.HMSH_EXPIRE_DURATION = exports.HMSH_XPENDING_COUNT = exports.HMSH_XCLAIM_COUNT = exports.HMSH_XCLAIM_DELAY_MS = exports.HMSH_BLOCK_TIME_MS = exports.HMSH_MESHFLOW_EXP_BACKOFF = exports.HMSH_MESHFLOW_MAX_INTERVAL = exports.HMSH_MESHFLOW_MAX_ATTEMPTS = exports.HMSH_GRADUATED_INTERVAL_MS = exports.HMSH_MAX_TIMEOUT_MS = exports.HMSH_MAX_RETRIES = exports.MAX_DELAY = exports.HMSH_EXPIRE_JOB_SECONDS = exports.HMSH_OTT_WAIT_TIME = exports.HMSH_ACTIVATION_MAX_RETRY = exports.HMSH_QUORUM_DELAY_MS = exports.HMSH_QUORUM_ROLLCALL_CYCLES = exports.HMSH_STATUS_UNKNOWN = exports.HMSH_CODE_MESHFLOW_RETRYABLE = exports.HMSH_CODE_MESHFLOW_FATAL = exports.HMSH_CODE_MESHFLOW_MAXED = exports.HMSH_CODE_MESHFLOW_TIMEOUT = exports.HMSH_CODE_MESHFLOW_WAIT = exports.HMSH_CODE_MESHFLOW_PROXY = exports.HMSH_CODE_MESHFLOW_CHILD = exports.HMSH_CODE_MESHFLOW_ALL = exports.HMSH_CODE_MESHFLOW_SLEEP = exports.HMSH_CODE_UNACKED = exports.HMSH_CODE_TIMEOUT = exports.HMSH_CODE_UNKNOWN = exports.HMSH_CODE_INTERRUPT = exports.HMSH_CODE_NOTFOUND = exports.HMSH_CODE_PENDING = exports.HMSH_CODE_SUCCESS = exports.HMSH_IS_CLUSTER = exports.HMSH_LOGLEVEL = void 0;
5
4
  exports.HMSH_LOGLEVEL = process.env.HMSH_LOGLEVEL || 'info';
6
5
  exports.HMSH_IS_CLUSTER = process.env.HMSH_IS_CLUSTER === 'true';
7
- // HOTMESH STATUS CODES
8
6
  exports.HMSH_CODE_SUCCESS = 200;
9
7
  exports.HMSH_CODE_PENDING = 202;
10
8
  exports.HMSH_CODE_NOTFOUND = 404;
@@ -12,34 +10,28 @@ exports.HMSH_CODE_INTERRUPT = 410;
12
10
  exports.HMSH_CODE_UNKNOWN = 500;
13
11
  exports.HMSH_CODE_TIMEOUT = 504;
14
12
  exports.HMSH_CODE_UNACKED = 999;
15
- // DURABLE STATUS CODES
16
- exports.HMSH_CODE_DURABLE_SLEEP = 588;
17
- exports.HMSH_CODE_DURABLE_ALL = 589;
18
- exports.HMSH_CODE_DURABLE_CHILD = 590;
19
- exports.HMSH_CODE_DURABLE_PROXY = 591;
20
- exports.HMSH_CODE_DURABLE_WAIT = 595;
21
- exports.HMSH_CODE_DURABLE_TIMEOUT = 596;
22
- exports.HMSH_CODE_DURABLE_MAXED = 597;
23
- exports.HMSH_CODE_DURABLE_FATAL = 598;
24
- exports.HMSH_CODE_DURABLE_RETRYABLE = 599;
25
- // HOTMESH MESSAGES
13
+ exports.HMSH_CODE_MESHFLOW_SLEEP = 588;
14
+ exports.HMSH_CODE_MESHFLOW_ALL = 589;
15
+ exports.HMSH_CODE_MESHFLOW_CHILD = 590;
16
+ exports.HMSH_CODE_MESHFLOW_PROXY = 591;
17
+ exports.HMSH_CODE_MESHFLOW_WAIT = 595;
18
+ exports.HMSH_CODE_MESHFLOW_TIMEOUT = 596;
19
+ exports.HMSH_CODE_MESHFLOW_MAXED = 597;
20
+ exports.HMSH_CODE_MESHFLOW_FATAL = 598;
21
+ exports.HMSH_CODE_MESHFLOW_RETRYABLE = 599;
26
22
  exports.HMSH_STATUS_UNKNOWN = 'unknown';
27
- // QUORUM
28
- exports.HMSH_QUORUM_ROLLCALL_CYCLES = 12; //max iterations
23
+ exports.HMSH_QUORUM_ROLLCALL_CYCLES = 12;
29
24
  exports.HMSH_QUORUM_DELAY_MS = 250;
30
25
  exports.HMSH_ACTIVATION_MAX_RETRY = 3;
31
- // ENGINE
32
26
  exports.HMSH_OTT_WAIT_TIME = parseInt(process.env.HMSH_OTT_WAIT_TIME, 10) || 1000;
33
27
  exports.HMSH_EXPIRE_JOB_SECONDS = parseInt(process.env.HMSH_EXPIRE_JOB_SECONDS, 10) || 1;
34
- // STREAM ROUTER
35
- exports.MAX_DELAY = 2147483647; // Maximum allowed delay in milliseconds for setTimeout
28
+ exports.MAX_DELAY = 2147483647;
36
29
  exports.HMSH_MAX_RETRIES = parseInt(process.env.HMSH_MAX_RETRIES, 10) || 3;
37
30
  exports.HMSH_MAX_TIMEOUT_MS = parseInt(process.env.HMSH_MAX_TIMEOUT_MS, 10) || 60000;
38
31
  exports.HMSH_GRADUATED_INTERVAL_MS = parseInt(process.env.HMSH_GRADUATED_INTERVAL_MS, 10) || 5000;
39
- // DURABLE
40
- exports.HMSH_DURABLE_MAX_ATTEMPTS = 3;
41
- exports.HMSH_DURABLE_MAX_INTERVAL = '120s';
42
- exports.HMSH_DURABLE_EXP_BACKOFF = 10;
32
+ exports.HMSH_MESHFLOW_MAX_ATTEMPTS = 3;
33
+ exports.HMSH_MESHFLOW_MAX_INTERVAL = '120s';
34
+ exports.HMSH_MESHFLOW_EXP_BACKOFF = 10;
43
35
  const BASE_BLOCK_DURATION = 10000;
44
36
  const TEST_BLOCK_DURATION = 1000;
45
37
  exports.HMSH_BLOCK_TIME_MS = process.env.HMSH_BLOCK_TIME_MS
@@ -50,7 +42,6 @@ exports.HMSH_BLOCK_TIME_MS = process.env.HMSH_BLOCK_TIME_MS
50
42
  exports.HMSH_XCLAIM_DELAY_MS = parseInt(process.env.HMSH_XCLAIM_DELAY_MS, 10) || 1000 * 60;
51
43
  exports.HMSH_XCLAIM_COUNT = parseInt(process.env.HMSH_XCLAIM_COUNT, 10) || 3;
52
44
  exports.HMSH_XPENDING_COUNT = parseInt(process.env.HMSH_XPENDING_COUNT, 10) || 10;
53
- // TASK WORKER
54
45
  exports.HMSH_EXPIRE_DURATION = parseInt(process.env.HMSH_EXPIRE_DURATION, 10) || 1;
55
46
  const BASE_FIDELITY_SECONDS = 5;
56
47
  const TEST_FIDELITY_SECONDS = 1;
@@ -60,5 +51,4 @@ exports.HMSH_FIDELITY_SECONDS = process.env.HMSH_FIDELITY_SECONDS
60
51
  ? TEST_FIDELITY_SECONDS
61
52
  : BASE_FIDELITY_SECONDS;
62
53
  exports.HMSH_SCOUT_INTERVAL_SECONDS = parseInt(process.env.HMSH_SCOUT_INTERVAL_SECONDS, 10) || 60;
63
- // UTILS
64
54
  exports.HMSH_GUID_SIZE = Math.min(parseInt(process.env.HMSH_GUID_SIZE, 10) || 22, 32);
@@ -1,6 +1,6 @@
1
1
  import { ActivityDuplex } from '../types/activity';
2
2
  import { CollationFaultType, CollationStage } from '../types/collator';
3
- import { DurableChildErrorType, DurableProxyErrorType, DurableSleepErrorType, DurableWaitForAllErrorType, DurableWaitForErrorType } from '../types/error';
3
+ import { MeshFlowChildErrorType, MeshFlowProxyErrorType, MeshFlowSleepErrorType, MeshFlowWaitForAllErrorType, MeshFlowWaitForErrorType } from '../types/error';
4
4
  declare class GetStateError extends Error {
5
5
  jobId: string;
6
6
  code: number;
@@ -9,15 +9,15 @@ declare class GetStateError extends Error {
9
9
  declare class SetStateError extends Error {
10
10
  constructor();
11
11
  }
12
- declare class DurableWaitForError extends Error {
12
+ declare class MeshFlowWaitForError extends Error {
13
13
  code: number;
14
14
  signalId: string;
15
15
  workflowId: string;
16
16
  index: number;
17
17
  workflowDimension: string;
18
- constructor(params: DurableWaitForErrorType);
18
+ constructor(params: MeshFlowWaitForErrorType);
19
19
  }
20
- declare class DurableProxyError extends Error {
20
+ declare class MeshFlowProxyError extends Error {
21
21
  activityName: string;
22
22
  arguments: string[];
23
23
  backoffCoefficient: number;
@@ -31,9 +31,9 @@ declare class DurableProxyError extends Error {
31
31
  workflowDimension: string;
32
32
  workflowId: string;
33
33
  workflowTopic: string;
34
- constructor(params: DurableProxyErrorType);
34
+ constructor(params: MeshFlowProxyErrorType);
35
35
  }
36
- declare class DurableChildError extends Error {
36
+ declare class MeshFlowChildError extends Error {
37
37
  await: boolean;
38
38
  arguments: string[];
39
39
  backoffCoefficient: number;
@@ -48,9 +48,9 @@ declare class DurableChildError extends Error {
48
48
  parentWorkflowId: string;
49
49
  workflowId: string;
50
50
  workflowTopic: string;
51
- constructor(params: DurableChildErrorType);
51
+ constructor(params: MeshFlowChildErrorType);
52
52
  }
53
- declare class DurableWaitForAllError extends Error {
53
+ declare class MeshFlowWaitForAllError extends Error {
54
54
  items: any[];
55
55
  code: number;
56
56
  workflowDimension: string;
@@ -60,29 +60,29 @@ declare class DurableWaitForAllError extends Error {
60
60
  parentWorkflowId: string;
61
61
  workflowId: string;
62
62
  workflowTopic: string;
63
- constructor(params: DurableWaitForAllErrorType);
63
+ constructor(params: MeshFlowWaitForAllErrorType);
64
64
  }
65
- declare class DurableSleepError extends Error {
65
+ declare class MeshFlowSleepError extends Error {
66
66
  workflowId: string;
67
67
  code: number;
68
68
  duration: number;
69
69
  index: number;
70
70
  workflowDimension: string;
71
- constructor(params: DurableSleepErrorType);
71
+ constructor(params: MeshFlowSleepErrorType);
72
72
  }
73
- declare class DurableTimeoutError extends Error {
73
+ declare class MeshFlowTimeoutError extends Error {
74
74
  code: number;
75
75
  constructor(message: string, stack?: string);
76
76
  }
77
- declare class DurableMaxedError extends Error {
77
+ declare class MeshFlowMaxedError extends Error {
78
78
  code: number;
79
79
  constructor(message: string, stackTrace?: string);
80
80
  }
81
- declare class DurableFatalError extends Error {
81
+ declare class MeshFlowFatalError extends Error {
82
82
  code: number;
83
83
  constructor(message: string, stackTrace?: string);
84
84
  }
85
- declare class DurableRetryError extends Error {
85
+ declare class MeshFlowRetryError extends Error {
86
86
  code: number;
87
87
  constructor(message: string, stackTrace?: string);
88
88
  }
@@ -120,4 +120,4 @@ declare class CollationError extends Error {
120
120
  fault: CollationFaultType;
121
121
  constructor(status: number, leg: ActivityDuplex, stage: CollationStage, fault?: CollationFaultType);
122
122
  }
123
- export { CollationError, DurableChildError, DurableFatalError, DurableMaxedError, DurableProxyError, DurableRetryError, DurableSleepError, DurableTimeoutError, DurableWaitForAllError, DurableWaitForError, DuplicateJobError, ExecActivityError, GenerationalError, GetStateError, InactiveJobError, MapDataError, RegisterTimeoutError, SetStateError, };
123
+ export { CollationError, MeshFlowChildError, MeshFlowFatalError, MeshFlowMaxedError, MeshFlowProxyError, MeshFlowRetryError, MeshFlowSleepError, MeshFlowTimeoutError, MeshFlowWaitForAllError, MeshFlowWaitForError, DuplicateJobError, ExecActivityError, GenerationalError, GetStateError, InactiveJobError, MapDataError, RegisterTimeoutError, SetStateError, };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SetStateError = exports.RegisterTimeoutError = exports.MapDataError = exports.InactiveJobError = exports.GetStateError = exports.GenerationalError = exports.ExecActivityError = exports.DuplicateJobError = exports.DurableWaitForError = exports.DurableWaitForAllError = exports.DurableTimeoutError = exports.DurableSleepError = exports.DurableRetryError = exports.DurableProxyError = exports.DurableMaxedError = exports.DurableFatalError = exports.DurableChildError = exports.CollationError = void 0;
3
+ exports.SetStateError = exports.RegisterTimeoutError = exports.MapDataError = exports.InactiveJobError = exports.GetStateError = exports.GenerationalError = exports.ExecActivityError = exports.DuplicateJobError = exports.MeshFlowWaitForError = exports.MeshFlowWaitForAllError = exports.MeshFlowTimeoutError = exports.MeshFlowSleepError = exports.MeshFlowRetryError = exports.MeshFlowProxyError = exports.MeshFlowMaxedError = exports.MeshFlowFatalError = exports.MeshFlowChildError = exports.CollationError = void 0;
4
4
  const enums_1 = require("./enums");
5
5
  class GetStateError extends Error {
6
6
  constructor(jobId) {
@@ -16,17 +16,17 @@ class SetStateError extends Error {
16
16
  }
17
17
  }
18
18
  exports.SetStateError = SetStateError;
19
- class DurableWaitForError extends Error {
19
+ class MeshFlowWaitForError extends Error {
20
20
  constructor(params) {
21
21
  super(`WaitFor Interruption`);
22
22
  this.signalId = params.signalId;
23
23
  this.index = params.index;
24
24
  this.workflowDimension = params.workflowDimension;
25
- this.code = enums_1.HMSH_CODE_DURABLE_WAIT;
25
+ this.code = enums_1.HMSH_CODE_MESHFLOW_WAIT;
26
26
  }
27
27
  }
28
- exports.DurableWaitForError = DurableWaitForError;
29
- class DurableProxyError extends Error {
28
+ exports.MeshFlowWaitForError = MeshFlowWaitForError;
29
+ class MeshFlowProxyError extends Error {
30
30
  constructor(params) {
31
31
  super(`ProxyActivity Interruption`);
32
32
  this.arguments = params.arguments;
@@ -41,11 +41,11 @@ class DurableProxyError extends Error {
41
41
  this.backoffCoefficient = params.backoffCoefficient;
42
42
  this.maximumAttempts = params.maximumAttempts;
43
43
  this.maximumInterval = params.maximumInterval;
44
- this.code = enums_1.HMSH_CODE_DURABLE_PROXY;
44
+ this.code = enums_1.HMSH_CODE_MESHFLOW_PROXY;
45
45
  }
46
46
  }
47
- exports.DurableProxyError = DurableProxyError;
48
- class DurableChildError extends Error {
47
+ exports.MeshFlowProxyError = MeshFlowProxyError;
48
+ class MeshFlowChildError extends Error {
49
49
  constructor(params) {
50
50
  super(`ExecChild Interruption`);
51
51
  this.arguments = params.arguments;
@@ -57,15 +57,15 @@ class DurableChildError extends Error {
57
57
  this.originJobId = params.originJobId;
58
58
  this.index = params.index;
59
59
  this.workflowDimension = params.workflowDimension;
60
- this.code = enums_1.HMSH_CODE_DURABLE_CHILD;
60
+ this.code = enums_1.HMSH_CODE_MESHFLOW_CHILD;
61
61
  this.await = params.await;
62
62
  this.backoffCoefficient = params.backoffCoefficient;
63
63
  this.maximumAttempts = params.maximumAttempts;
64
64
  this.maximumInterval = params.maximumInterval;
65
65
  }
66
66
  }
67
- exports.DurableChildError = DurableChildError;
68
- class DurableWaitForAllError extends Error {
67
+ exports.MeshFlowChildError = MeshFlowChildError;
68
+ class MeshFlowWaitForAllError extends Error {
69
69
  constructor(params) {
70
70
  super(`Collation Interruption`);
71
71
  this.items = params.items;
@@ -76,61 +76,61 @@ class DurableWaitForAllError extends Error {
76
76
  this.originJobId = params.originJobId;
77
77
  this.index = params.index;
78
78
  this.workflowDimension = params.workflowDimension;
79
- this.code = enums_1.HMSH_CODE_DURABLE_ALL;
79
+ this.code = enums_1.HMSH_CODE_MESHFLOW_ALL;
80
80
  }
81
81
  }
82
- exports.DurableWaitForAllError = DurableWaitForAllError;
83
- class DurableSleepError extends Error {
82
+ exports.MeshFlowWaitForAllError = MeshFlowWaitForAllError;
83
+ class MeshFlowSleepError extends Error {
84
84
  constructor(params) {
85
85
  super(`SleepFor Interruption`);
86
86
  this.duration = params.duration;
87
87
  this.workflowId = params.workflowId;
88
88
  this.index = params.index;
89
89
  this.workflowDimension = params.workflowDimension;
90
- this.code = enums_1.HMSH_CODE_DURABLE_SLEEP;
90
+ this.code = enums_1.HMSH_CODE_MESHFLOW_SLEEP;
91
91
  }
92
92
  }
93
- exports.DurableSleepError = DurableSleepError;
94
- class DurableTimeoutError extends Error {
93
+ exports.MeshFlowSleepError = MeshFlowSleepError;
94
+ class MeshFlowTimeoutError extends Error {
95
95
  constructor(message, stack) {
96
96
  super(message);
97
97
  if (this.stack) {
98
98
  this.stack = stack;
99
99
  }
100
- this.code = enums_1.HMSH_CODE_DURABLE_TIMEOUT;
100
+ this.code = enums_1.HMSH_CODE_MESHFLOW_TIMEOUT;
101
101
  }
102
102
  }
103
- exports.DurableTimeoutError = DurableTimeoutError;
104
- class DurableMaxedError extends Error {
103
+ exports.MeshFlowTimeoutError = MeshFlowTimeoutError;
104
+ class MeshFlowMaxedError extends Error {
105
105
  constructor(message, stackTrace) {
106
106
  super(message);
107
107
  if (stackTrace) {
108
108
  this.stack = stackTrace;
109
109
  }
110
- this.code = enums_1.HMSH_CODE_DURABLE_MAXED;
110
+ this.code = enums_1.HMSH_CODE_MESHFLOW_MAXED;
111
111
  }
112
112
  }
113
- exports.DurableMaxedError = DurableMaxedError;
114
- class DurableFatalError extends Error {
113
+ exports.MeshFlowMaxedError = MeshFlowMaxedError;
114
+ class MeshFlowFatalError extends Error {
115
115
  constructor(message, stackTrace) {
116
116
  super(message);
117
117
  if (stackTrace) {
118
118
  this.stack = stackTrace;
119
119
  }
120
- this.code = enums_1.HMSH_CODE_DURABLE_FATAL;
120
+ this.code = enums_1.HMSH_CODE_MESHFLOW_FATAL;
121
121
  }
122
122
  }
123
- exports.DurableFatalError = DurableFatalError;
124
- class DurableRetryError extends Error {
123
+ exports.MeshFlowFatalError = MeshFlowFatalError;
124
+ class MeshFlowRetryError extends Error {
125
125
  constructor(message, stackTrace) {
126
126
  super(message);
127
127
  if (stackTrace) {
128
128
  this.stack = stackTrace;
129
129
  }
130
- this.code = enums_1.HMSH_CODE_DURABLE_RETRYABLE;
130
+ this.code = enums_1.HMSH_CODE_MESHFLOW_RETRYABLE;
131
131
  }
132
132
  }
133
- exports.DurableRetryError = DurableRetryError;
133
+ exports.MeshFlowRetryError = MeshFlowRetryError;
134
134
  class MapDataError extends Error {
135
135
  constructor() {
136
136
  super('Error occurred while mapping data');
@@ -1,47 +1,10 @@
1
1
  import { KeyStoreParams, KeyType } from '../types/hotmesh';
2
- /**
3
- * Keys
4
- *
5
- * hmsh -> {hash} hotmesh config {version: "0.0.1", namespace: "hmsh"}
6
- * hmsh:a:<appid> -> {hash} app profile { "id": "appid", "version": "2", "versions/1": "GMT", "versions/2": "GMT"}
7
- * hmsh:<appid>:r: -> {hash} throttle rates {':': '23', 'topic.thing': '555'} => {':i': 'all', 'topic.thing': '555seconds'}
8
- * hmsh:<appid>:w: -> {zset} work items/tasks an engine must do like garbage collect or hook a set of matching records (hookAll)
9
- * hmsh:<appid>:t: -> {zset} an ordered set of list (work lists) ids
10
- * hmsh:<appid>:t:<timeValue?> -> {list} a worklist of `jobId+activityId` items that should be awakened
11
- * hmsh:<appid>:q: -> {hash} quorum-wide messages
12
- * hmsh:<appid>:q:<ngnid> -> {hash} engine-targeted messages (targeted quorum-oriented message)
13
- * hmsh:<appid>:j:<jobid> -> {hash} job data
14
- * hmsh:<appid>:s:<jobkey>:<dateTime> -> {hash} job stats (general)
15
- * hmsh:<appid>:s:<jobkey>:<dateTime>:mdn:<field/path>:<fieldvalue> -> {zset} job stats (median)
16
- * hmsh:<appid>:s:<jobkey>:<dateTime>:index:<field/path>:<fieldvalue> -> {list} job stats (index of jobid[])
17
- * hmsh:<appid>:v:<version>:activities -> {hash} schemas [cache]
18
- * hmsh:<appid>:v:<version>:transitions -> {hash} transitions [cache]
19
- * hmsh:<appid>:v:<version>:subscriptions -> {hash} subscriptions [cache]
20
- * hmsh:<appid>:x: -> {xstream} when an engine is sent or reads a buffered task (engines read from their custom topic)
21
- * hmsh:<appid>:x:<topic> -> {xstream} when a worker is sent or reads a buffered task (workers read from their custom topic)
22
- * hmsh:<appid>:hooks -> {hash} hook patterns/rules; set at compile time
23
- * hmsh:<appid>:signals -> {hash} dynamic hook signals (hget/hdel) when resolving (always self-clean); added/removed at runtime
24
- * hmsh:<appid>:sym:keys: -> {hash} list of symbol ranges and :cursor assigned at version deploy time for job keys
25
- * hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys)
26
- * hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
27
- */
28
2
  declare const HMNS = "hmsh";
29
3
  declare const KEYSEP = ":";
30
4
  declare const VALSEP = "::";
31
5
  declare const WEBSEP = "::";
32
6
  declare const TYPSEP = "::";
33
7
  declare class KeyService {
34
- /**
35
- * returns a key that can be used to access a value in the key/value store
36
- * appropriate for the given key type; the keys have an implicit hierarchy
37
- * and are used to organize data in the store in a tree-like structure
38
- * via the use of colons as separators. The top-level entity is the hmsh manifest.
39
- * This file will reveal the full scope of what is on the server (apps, versions, etc)
40
- * @param namespace
41
- * @param keyType
42
- * @param params
43
- * @returns {string}
44
- */
45
8
  static mintKey(namespace: string, keyType: KeyType, params: KeyStoreParams): string;
46
9
  }
47
10
  export { KeyService, KeyType, KeyStoreParams, HMNS, KEYSEP, TYPSEP, WEBSEP, VALSEP, };
@@ -3,54 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VALSEP = exports.WEBSEP = exports.TYPSEP = exports.KEYSEP = exports.HMNS = exports.KeyType = exports.KeyService = void 0;
4
4
  const hotmesh_1 = require("../types/hotmesh");
5
5
  Object.defineProperty(exports, "KeyType", { enumerable: true, get: function () { return hotmesh_1.KeyType; } });
6
- /**
7
- * Keys
8
- *
9
- * hmsh -> {hash} hotmesh config {version: "0.0.1", namespace: "hmsh"}
10
- * hmsh:a:<appid> -> {hash} app profile { "id": "appid", "version": "2", "versions/1": "GMT", "versions/2": "GMT"}
11
- * hmsh:<appid>:r: -> {hash} throttle rates {':': '23', 'topic.thing': '555'} => {':i': 'all', 'topic.thing': '555seconds'}
12
- * hmsh:<appid>:w: -> {zset} work items/tasks an engine must do like garbage collect or hook a set of matching records (hookAll)
13
- * hmsh:<appid>:t: -> {zset} an ordered set of list (work lists) ids
14
- * hmsh:<appid>:t:<timeValue?> -> {list} a worklist of `jobId+activityId` items that should be awakened
15
- * hmsh:<appid>:q: -> {hash} quorum-wide messages
16
- * hmsh:<appid>:q:<ngnid> -> {hash} engine-targeted messages (targeted quorum-oriented message)
17
- * hmsh:<appid>:j:<jobid> -> {hash} job data
18
- * hmsh:<appid>:s:<jobkey>:<dateTime> -> {hash} job stats (general)
19
- * hmsh:<appid>:s:<jobkey>:<dateTime>:mdn:<field/path>:<fieldvalue> -> {zset} job stats (median)
20
- * hmsh:<appid>:s:<jobkey>:<dateTime>:index:<field/path>:<fieldvalue> -> {list} job stats (index of jobid[])
21
- * hmsh:<appid>:v:<version>:activities -> {hash} schemas [cache]
22
- * hmsh:<appid>:v:<version>:transitions -> {hash} transitions [cache]
23
- * hmsh:<appid>:v:<version>:subscriptions -> {hash} subscriptions [cache]
24
- * hmsh:<appid>:x: -> {xstream} when an engine is sent or reads a buffered task (engines read from their custom topic)
25
- * hmsh:<appid>:x:<topic> -> {xstream} when a worker is sent or reads a buffered task (workers read from their custom topic)
26
- * hmsh:<appid>:hooks -> {hash} hook patterns/rules; set at compile time
27
- * hmsh:<appid>:signals -> {hash} dynamic hook signals (hget/hdel) when resolving (always self-clean); added/removed at runtime
28
- * hmsh:<appid>:sym:keys: -> {hash} list of symbol ranges and :cursor assigned at version deploy time for job keys
29
- * hmsh:<appid>:sym:keys:<activityid|$subscribes> -> {hash} list of symbols based upon schema enums (initially) and adaptively optimized (later) during runtime; if '$subscribes' is used as the activityid, it is a top-level `job` symbol set (for job keys)
30
- * hmsh:<appid>:sym:vals: -> {hash} list of symbols for job values across all app versions
31
- */
32
6
  const HMNS = 'hmsh';
33
7
  exports.HMNS = HMNS;
34
- const KEYSEP = ':'; //default delimiter for keys
8
+ const KEYSEP = ':';
35
9
  exports.KEYSEP = KEYSEP;
36
- const VALSEP = '::'; //default delimiter for vals
10
+ const VALSEP = '::';
37
11
  exports.VALSEP = VALSEP;
38
- const WEBSEP = '::'; //default delimiter for webhook vals
12
+ const WEBSEP = '::';
39
13
  exports.WEBSEP = WEBSEP;
40
- const TYPSEP = '::'; //delimiter for ZSET task typing (how should a list be used?)
14
+ const TYPSEP = '::';
41
15
  exports.TYPSEP = TYPSEP;
42
16
  class KeyService {
43
- /**
44
- * returns a key that can be used to access a value in the key/value store
45
- * appropriate for the given key type; the keys have an implicit hierarchy
46
- * and are used to organize data in the store in a tree-like structure
47
- * via the use of colons as separators. The top-level entity is the hmsh manifest.
48
- * This file will reveal the full scope of what is on the server (apps, versions, etc)
49
- * @param namespace
50
- * @param keyType
51
- * @param params
52
- * @returns {string}
53
- */
54
17
  static mintKey(namespace, keyType, params) {
55
18
  switch (keyType) {
56
19
  case hotmesh_1.KeyType.HOTMESH:
@@ -82,16 +45,12 @@ class KeyService {
82
45
  case hotmesh_1.KeyType.SUBSCRIPTION_PATTERNS:
83
46
  return `${namespace}:${params.appId}:v:${params.appVersion}:transitions`;
84
47
  case hotmesh_1.KeyType.HOOKS:
85
- //`hooks` provide the pattern to resolve a value
86
48
  return `${namespace}:${params.appId}:hooks`;
87
49
  case hotmesh_1.KeyType.SIGNALS:
88
- //`signals` provide the registry of resolved values that link back to paused jobs
89
50
  return `${namespace}:${params.appId}:signals`;
90
51
  case hotmesh_1.KeyType.SYMKEYS:
91
- //`symbol keys` provide the registry of replacement values for job keys
92
52
  return `${namespace}:${params.appId}:sym:keys:${params.activityId || ''}`;
93
53
  case hotmesh_1.KeyType.SYMVALS:
94
- //`symbol vals` provide the registry of replacement values for job vals
95
54
  return `${namespace}:${params.appId}:sym:vals:`;
96
55
  case hotmesh_1.KeyType.STREAMS:
97
56
  return `${namespace}:${params.appId || ''}:x:${params.topic || ''}`;
@@ -7,11 +7,15 @@ import { StreamCode, StreamStatus } from '../types/stream';
7
7
  import { SystemHealth } from '../types/quorum';
8
8
  export declare const hashOptions: (options: any) => string;
9
9
  export declare function getSystemHealth(): Promise<SystemHealth>;
10
- export declare function sleepFor(ms: number): Promise<unknown>;
11
- export declare function sleepImmediate(): Promise<void>;
12
10
  export declare function deepCopy<T>(obj: T): T;
13
- export declare function guid(size?: number): string;
14
11
  export declare function deterministicRandom(seed: number): number;
12
+ export declare function guid(size?: number): string;
13
+ export declare function sleepFor(ms: number): Promise<void>;
14
+ export declare function sleepImmediate(): Promise<void>;
15
+ export declare function XSleepFor(ms: number): {
16
+ promise: Promise<unknown>;
17
+ timerId: NodeJS.Timeout;
18
+ };
15
19
  export declare function identifyRedisType(redisInstance: any): 'redis' | 'ioredis' | null;
16
20
  export declare const polyfill: {
17
21
  resolveActivityType(activityType: string): string;
@@ -19,21 +23,9 @@ export declare const polyfill: {
19
23
  export declare function identifyRedisTypeFromClass(redisClass: any): 'redis' | 'ioredis' | null;
20
24
  export declare function matchesStatusCode(code: StreamCode, pattern: string | RegExp): boolean;
21
25
  export declare function matchesStatus(status: StreamStatus, targetStatus: StreamStatus): boolean;
22
- export declare function XSleepFor(ms: number): {
23
- promise: Promise<unknown>;
24
- timerId: NodeJS.Timeout;
25
- };
26
26
  export declare function findTopKey(obj: AppTransitions, input: string): string | null;
27
27
  export declare function findSubscriptionForTrigger(obj: AppSubscriptions, value: string): string | null;
28
- /**
29
- * Get the subscription topic for the flow to which @activityId belongs.
30
- * TODO: resolve this value in the compiler...do not call this at runtime
31
- */
32
28
  export declare function getSubscriptionTopic(activityId: string, store: StoreService<RedisClient, RedisMulti>, appVID: AppVID): Promise<string | undefined>;
33
- /**
34
- * returns the 12-digit format of the iso timestamp (e.g, 202101010000); returns
35
- * an empty string if overridden by the user to not segment by time (infinity).
36
- */
37
29
  export declare function getTimeSeries(granularity: string): string;
38
30
  export declare function formatISODate(input: Date | string): string;
39
31
  export declare function getSymKey(number: number): string;