@hotmeshio/hotmesh 0.0.57 → 0.0.58
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 +10 -10
- package/build/modules/enums.js +10 -1
- package/build/modules/key.d.ts +38 -0
- package/build/modules/key.js +46 -4
- package/build/modules/utils.d.ts +9 -0
- package/build/modules/utils.js +19 -1
- package/build/package.json +1 -1
- package/build/services/activities/activity.d.ts +28 -0
- package/build/services/activities/activity.js +46 -1
- package/build/services/activities/await.js +4 -0
- package/build/services/activities/cycle.d.ts +7 -0
- package/build/services/activities/cycle.js +16 -1
- package/build/services/activities/hook.d.ts +6 -0
- package/build/services/activities/hook.js +12 -2
- package/build/services/activities/interrupt.js +8 -0
- package/build/services/activities/signal.d.ts +6 -0
- package/build/services/activities/signal.js +15 -0
- package/build/services/activities/trigger.d.ts +4 -0
- package/build/services/activities/trigger.js +7 -1
- package/build/services/activities/worker.js +4 -0
- package/build/services/collator/index.d.ts +70 -0
- package/build/services/collator/index.js +91 -1
- package/build/services/compiler/deployer.js +38 -6
- package/build/services/compiler/index.d.ts +15 -0
- package/build/services/compiler/index.js +20 -0
- package/build/services/compiler/validator.d.ts +3 -0
- package/build/services/compiler/validator.js +25 -0
- package/build/services/connector/clients/ioredis.js +2 -0
- package/build/services/connector/clients/redis.js +2 -0
- package/build/services/connector/index.js +2 -0
- package/build/services/durable/client.d.ts +20 -0
- package/build/services/durable/client.js +25 -0
- package/build/services/durable/exporter.d.ts +22 -0
- package/build/services/durable/exporter.js +30 -1
- package/build/services/durable/handle.d.ts +36 -0
- package/build/services/durable/handle.js +46 -0
- package/build/services/durable/index.d.ts +4 -0
- package/build/services/durable/index.js +4 -0
- package/build/services/durable/schemas/factory.d.ts +29 -0
- package/build/services/durable/schemas/factory.js +29 -0
- package/build/services/durable/search.d.ts +97 -0
- package/build/services/durable/search.js +99 -0
- package/build/services/durable/worker.js +35 -6
- package/build/services/durable/workflow.d.ts +118 -0
- package/build/services/durable/workflow.js +153 -6
- package/build/services/engine/index.d.ts +5 -0
- package/build/services/engine/index.js +43 -1
- package/build/services/exporter/index.d.ts +27 -0
- package/build/services/exporter/index.js +33 -0
- package/build/services/hotmesh/index.js +8 -0
- package/build/services/logger/index.js +2 -0
- package/build/services/mapper/index.d.ts +14 -0
- package/build/services/mapper/index.js +14 -0
- package/build/services/pipe/functions/date.d.ts +7 -0
- package/build/services/pipe/functions/date.js +7 -0
- package/build/services/pipe/functions/math.js +2 -0
- package/build/services/pipe/index.d.ts +15 -0
- package/build/services/pipe/index.js +23 -2
- package/build/services/quorum/index.d.ts +7 -0
- package/build/services/quorum/index.js +21 -0
- package/build/services/reporter/index.d.ts +5 -0
- package/build/services/reporter/index.js +9 -0
- package/build/services/router/index.d.ts +9 -0
- package/build/services/router/index.js +30 -2
- package/build/services/serializer/index.js +23 -6
- package/build/services/store/cache.d.ts +19 -0
- package/build/services/store/cache.js +19 -0
- package/build/services/store/clients/ioredis.js +1 -0
- package/build/services/store/index.d.ts +55 -0
- package/build/services/store/index.js +81 -5
- package/build/services/stream/clients/ioredis.js +4 -1
- package/build/services/task/index.d.ts +9 -0
- package/build/services/task/index.js +31 -0
- package/build/services/telemetry/index.d.ts +7 -0
- package/build/services/telemetry/index.js +13 -1
- package/build/services/worker/index.d.ts +4 -0
- package/build/services/worker/index.js +6 -2
- package/build/types/activity.d.ts +81 -0
- package/build/types/durable.d.ts +255 -0
- package/build/types/exporter.d.ts +13 -0
- package/build/types/hotmesh.d.ts +10 -1
- package/build/types/hotmesh.js +3 -0
- package/build/types/index.js +1 -1
- package/build/types/job.d.ts +85 -0
- package/build/types/pipe.d.ts +65 -0
- package/build/types/quorum.d.ts +14 -0
- package/build/types/redis.d.ts +6 -0
- package/build/types/stream.d.ts +58 -0
- package/build/types/stream.js +4 -0
- package/package.json +1 -1
package/build/types/quorum.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ interface NetworkStat {
|
|
|
15
15
|
tx_sec: number;
|
|
16
16
|
ms: number;
|
|
17
17
|
}
|
|
18
|
+
/** reveals: memory, cpu, network */
|
|
18
19
|
export interface SystemHealth {
|
|
19
20
|
TotalMemoryGB: string;
|
|
20
21
|
FreeMemoryGB: string;
|
|
@@ -23,10 +24,17 @@ export interface SystemHealth {
|
|
|
23
24
|
NetworkStats: NetworkStat[];
|
|
24
25
|
}
|
|
25
26
|
export type ThrottleOptions = {
|
|
27
|
+
/** target an engine OR worker by GUID */
|
|
26
28
|
guid?: string;
|
|
29
|
+
/** target a worker quorum */
|
|
27
30
|
topic?: string;
|
|
31
|
+
/** entity/noun */
|
|
28
32
|
entity?: string;
|
|
33
|
+
/** in milliseconds; default is 0 */
|
|
29
34
|
throttle: number;
|
|
35
|
+
/** namespace
|
|
36
|
+
* @default 'durable'
|
|
37
|
+
*/
|
|
30
38
|
namespace?: string;
|
|
31
39
|
};
|
|
32
40
|
export interface QuorumProfile {
|
|
@@ -115,5 +123,11 @@ export type RollCallOptions = {
|
|
|
115
123
|
export type SubscriptionOptions = {
|
|
116
124
|
namespace?: string;
|
|
117
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* The types in this file are used to define those messages that are sent
|
|
128
|
+
* to hotmesh client instances when a new version is about to be activated.
|
|
129
|
+
* These messages serve to coordinate the cache invalidation and switch-over
|
|
130
|
+
* to the new version without any downtime and a coordinating parent server.
|
|
131
|
+
*/
|
|
118
132
|
export type QuorumMessage = PingMessage | PongMessage | ActivateMessage | WorkMessage | JobMessage | ThrottleMessage | RollCallMessage | CronMessage;
|
|
119
133
|
export {};
|
package/build/types/redis.d.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { StringStringType } from './serializer';
|
|
3
3
|
import { ReclaimedMessageType } from './stream';
|
|
4
4
|
type MultiResponseFlags = (string | number)[];
|
|
5
|
+
/**
|
|
6
|
+
* Redis types
|
|
7
|
+
*/
|
|
5
8
|
interface ConnectionOptions {
|
|
6
9
|
host?: string;
|
|
7
10
|
port?: number;
|
|
@@ -135,6 +138,9 @@ interface RedisRedisClientType {
|
|
|
135
138
|
interface RedisRedisClassType {
|
|
136
139
|
createClient(options: RedisRedisClientOptions): Partial<RedisRedisClientType>;
|
|
137
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* IORedis types
|
|
143
|
+
*/
|
|
138
144
|
interface IORedisClientOptions {
|
|
139
145
|
port?: number;
|
|
140
146
|
host?: string;
|
package/build/types/stream.d.ts
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
|
+
/** Represents a policy for retrying stream operations based on error codes */
|
|
1
2
|
export interface StreamRetryPolicy {
|
|
3
|
+
/**
|
|
4
|
+
* Key is error code, value is the retry profile.
|
|
5
|
+
* Tuple contains: [max retry count, retry type].
|
|
6
|
+
* 'x' denotes exponential backoff (default). Only 10, 100, 1000, 10000 are allowed retry intervals.
|
|
7
|
+
*/
|
|
2
8
|
[key: string]: [number, 'x'?];
|
|
3
9
|
}
|
|
10
|
+
/** A 3-digit status code representing the outcome of a stream operation */
|
|
4
11
|
export type StreamCode = number;
|
|
12
|
+
/** Describes the structure of a stream error */
|
|
5
13
|
export type StreamError = {
|
|
14
|
+
/** Descriptive message of the error */
|
|
6
15
|
message: string;
|
|
16
|
+
/** Numeric code corresponding to the type of error */
|
|
7
17
|
code: number;
|
|
18
|
+
/** Optional job identifier, used when communicating errors externally */
|
|
8
19
|
job_id?: string;
|
|
20
|
+
/** Stack trace of the error if unhandled */
|
|
9
21
|
stack?: string;
|
|
22
|
+
/** Name of the error if unhandled */
|
|
10
23
|
name?: string;
|
|
24
|
+
/** Custom user-defined error details */
|
|
11
25
|
error?: Record<string, unknown>;
|
|
26
|
+
/** True if originating via a standard transition message with an `error` status */
|
|
12
27
|
is_stream_error?: boolean;
|
|
13
28
|
};
|
|
29
|
+
/** Enumerated status values for stream operations */
|
|
14
30
|
export declare enum StreamStatus {
|
|
31
|
+
/** Indicates successful completion of the stream operation */
|
|
15
32
|
SUCCESS = "success",
|
|
33
|
+
/** Indicates an error occurred during the stream operation */
|
|
16
34
|
ERROR = "error",
|
|
35
|
+
/** Indicates the stream operation is still pending */
|
|
17
36
|
PENDING = "pending"
|
|
18
37
|
}
|
|
19
38
|
export declare enum StreamDataType {
|
|
@@ -27,28 +46,51 @@ export declare enum StreamDataType {
|
|
|
27
46
|
SIGNAL = "signal",
|
|
28
47
|
INTERRUPT = "interrupt"
|
|
29
48
|
}
|
|
49
|
+
/** Defines the structure of stream data used when passing stream messages (transitions) */
|
|
30
50
|
export interface StreamData {
|
|
51
|
+
/** Metadata associated with the stream data */
|
|
31
52
|
metadata: {
|
|
53
|
+
/** Globally unique identifier for the StreamData message to distinguish `retries` from new 'reentry/cycles' */
|
|
32
54
|
guid: string;
|
|
55
|
+
/** Workflow/job topic */
|
|
33
56
|
topic?: string;
|
|
57
|
+
/** Workflow/job ID */
|
|
34
58
|
jid?: string;
|
|
59
|
+
/** Workflow Generational ID (internal GUID) */
|
|
35
60
|
gid?: string;
|
|
61
|
+
/** Dimensional address indicating the message routing specifics */
|
|
36
62
|
dad?: string;
|
|
63
|
+
/** Activity ID */
|
|
37
64
|
aid: string;
|
|
65
|
+
/** OpenTelemetry Trace identifier */
|
|
38
66
|
trc?: string;
|
|
67
|
+
/** OpenTelemetry Span identifier */
|
|
39
68
|
spn?: string;
|
|
69
|
+
/** Current try count, used for retry logic */
|
|
40
70
|
try?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Indicates if the message should wait for a response.
|
|
73
|
+
* If explicitly false, the connection is severed immediately
|
|
74
|
+
* upon verifying (and returning) the Job ID.
|
|
75
|
+
*/
|
|
41
76
|
await?: boolean;
|
|
42
77
|
};
|
|
78
|
+
/** Type of the data being streamed, optional */
|
|
43
79
|
type?: StreamDataType;
|
|
80
|
+
/** Actual data being transmitted as a record of key-value pairs */
|
|
44
81
|
data: Record<string, unknown>;
|
|
82
|
+
/** Policies related to retry logic, optional */
|
|
45
83
|
policies?: {
|
|
46
84
|
retry?: StreamRetryPolicy;
|
|
47
85
|
};
|
|
86
|
+
/** Status of the stream, default assumed as 'success' */
|
|
48
87
|
status?: StreamStatus;
|
|
88
|
+
/** HTTP-like status code for the stream, default assumed as 200 */
|
|
49
89
|
code?: number;
|
|
90
|
+
/** Error stack trace */
|
|
50
91
|
stack?: string;
|
|
51
92
|
}
|
|
93
|
+
/** Extends StreamData for responses, allowing for inheritance of the base properties */
|
|
52
94
|
export interface StreamDataResponse extends StreamData {
|
|
53
95
|
}
|
|
54
96
|
export declare enum StreamRole {
|
|
@@ -56,19 +98,35 @@ export declare enum StreamRole {
|
|
|
56
98
|
ENGINE = "engine",
|
|
57
99
|
SYSTEM = "system"
|
|
58
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Represents a type for messages that have been reclaimed from a stream.
|
|
103
|
+
* Each item is a tuple containing a messageId and its details.
|
|
104
|
+
*/
|
|
59
105
|
export type ReclaimedMessageType = [
|
|
106
|
+
/** The stream ID, typically formatted as `<timestamp>-<count>` */
|
|
60
107
|
messageId: string,
|
|
108
|
+
/** Details of the message, consisting of a key and its value */
|
|
61
109
|
details: [
|
|
110
|
+
/** Key is always 'message' */
|
|
62
111
|
key: string,
|
|
112
|
+
/** Value is a stringified representation of StreamData */
|
|
63
113
|
value: string
|
|
64
114
|
]
|
|
65
115
|
][];
|
|
116
|
+
/** Configuration parameters for a stream */
|
|
66
117
|
export type StreamConfig = {
|
|
118
|
+
/** Namespace under which the stream operates */
|
|
67
119
|
namespace: string;
|
|
120
|
+
/** Application identifier */
|
|
68
121
|
appId: string;
|
|
122
|
+
/** Globally unique identifier for the stream */
|
|
69
123
|
guid: string;
|
|
124
|
+
/** Role associated with the stream */
|
|
70
125
|
role: StreamRole;
|
|
126
|
+
/** Optional topic for the stream */
|
|
71
127
|
topic?: string;
|
|
128
|
+
/** Delay before a message can be reclaimed, defaults to 60,000 milliseconds */
|
|
72
129
|
reclaimDelay?: number;
|
|
130
|
+
/** Maximum number of reclaims allowed, defaults to 3. Values greater throw an error */
|
|
73
131
|
reclaimCount?: number;
|
|
74
132
|
};
|
package/build/types/stream.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StreamRole = exports.StreamDataType = exports.StreamStatus = void 0;
|
|
4
|
+
/** Enumerated status values for stream operations */
|
|
4
5
|
var StreamStatus;
|
|
5
6
|
(function (StreamStatus) {
|
|
7
|
+
/** Indicates successful completion of the stream operation */
|
|
6
8
|
StreamStatus["SUCCESS"] = "success";
|
|
9
|
+
/** Indicates an error occurred during the stream operation */
|
|
7
10
|
StreamStatus["ERROR"] = "error";
|
|
11
|
+
/** Indicates the stream operation is still pending */
|
|
8
12
|
StreamStatus["PENDING"] = "pending";
|
|
9
13
|
})(StreamStatus = exports.StreamStatus || (exports.StreamStatus = {}));
|
|
10
14
|
var StreamDataType;
|