@hotmeshio/hotmesh 0.0.59 → 0.1.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/README.md +1 -1
- package/build/modules/enums.d.ts +2 -1
- package/build/modules/enums.js +13 -3
- package/build/modules/errors.d.ts +3 -3
- package/build/modules/errors.js +8 -8
- package/build/modules/key.d.ts +1 -1
- package/build/modules/key.js +3 -3
- package/build/modules/utils.d.ts +6 -6
- package/build/modules/utils.js +22 -14
- package/build/package.json +41 -38
- package/build/services/activities/activity.js +37 -20
- package/build/services/activities/await.d.ts +1 -1
- package/build/services/activities/await.js +15 -7
- package/build/services/activities/cycle.d.ts +1 -1
- package/build/services/activities/cycle.js +16 -8
- package/build/services/activities/hook.d.ts +1 -1
- package/build/services/activities/hook.js +8 -4
- package/build/services/activities/interrupt.d.ts +1 -1
- package/build/services/activities/interrupt.js +14 -6
- package/build/services/activities/signal.d.ts +1 -1
- package/build/services/activities/signal.js +12 -4
- package/build/services/activities/trigger.d.ts +1 -1
- package/build/services/activities/trigger.js +19 -12
- package/build/services/activities/worker.d.ts +1 -1
- package/build/services/activities/worker.js +15 -7
- package/build/services/collator/index.js +12 -12
- package/build/services/compiler/deployer.js +17 -12
- package/build/services/compiler/index.js +4 -4
- package/build/services/compiler/validator.d.ts +3 -3
- package/build/services/compiler/validator.js +12 -3
- package/build/services/durable/client.d.ts +1 -1
- package/build/services/durable/client.js +18 -12
- package/build/services/durable/connection.d.ts +1 -1
- package/build/services/durable/exporter.d.ts +1 -1
- package/build/services/durable/exporter.js +3 -4
- package/build/services/durable/handle.d.ts +1 -1
- package/build/services/durable/handle.js +4 -1
- package/build/services/durable/index.d.ts +1 -1
- package/build/services/durable/index.js +2 -2
- package/build/services/durable/schemas/factory.d.ts +1 -1
- package/build/services/durable/search.js +19 -11
- package/build/services/durable/worker.js +50 -30
- package/build/services/durable/workflow.d.ts +5 -5
- package/build/services/durable/workflow.js +34 -18
- package/build/services/engine/index.js +33 -26
- package/build/services/exporter/index.d.ts +1 -1
- package/build/services/exporter/index.js +3 -3
- package/build/services/hotmesh/index.js +1 -1
- package/build/services/logger/index.js +1 -1
- package/build/services/mapper/index.js +3 -1
- package/build/services/pipe/functions/date.js +1 -1
- package/build/services/pipe/index.js +37 -10
- package/build/services/quorum/index.js +14 -11
- package/build/services/reporter/index.js +15 -12
- package/build/services/router/index.d.ts +2 -2
- package/build/services/router/index.js +73 -23
- package/build/services/serializer/index.js +48 -26
- package/build/services/store/cache.d.ts +5 -5
- package/build/services/store/cache.js +2 -2
- package/build/services/store/clients/ioredis.js +3 -3
- package/build/services/store/clients/redis.js +24 -4
- package/build/services/store/index.d.ts +9 -3
- package/build/services/store/index.js +122 -60
- package/build/services/stream/clients/ioredis.js +4 -4
- package/build/services/stream/clients/redis.js +31 -4
- package/build/services/task/index.js +8 -11
- package/build/services/telemetry/index.js +21 -14
- package/build/services/worker/index.d.ts +6 -6
- package/build/services/worker/index.js +12 -7
- package/build/types/activity.d.ts +3 -3
- package/build/types/exporter.d.ts +2 -2
- package/build/types/exporter.js +0 -6
- package/build/types/hook.d.ts +1 -1
- package/build/types/hotmesh.js +0 -1
- package/build/types/index.d.ts +12 -12
- package/build/types/job.d.ts +1 -1
- package/build/types/logger.js +0 -1
- package/build/types/quorum.d.ts +1 -1
- package/build/types/stats.d.ts +1 -1
- package/build/types/stream.d.ts +1 -2
- package/build/types/telemetry.d.ts +1 -1
- package/build/types/transition.d.ts +1 -1
- package/package.json +41 -38
- package/types/activity.ts +56 -39
- package/types/async.ts +2 -3
- package/types/collator.ts +5 -5
- package/types/durable.ts +161 -161
- package/types/error.ts +37 -37
- package/types/exporter.ts +14 -9
- package/types/hook.ts +11 -4
- package/types/hotmesh.ts +26 -25
- package/types/index.ts +53 -53
- package/types/job.ts +33 -33
- package/types/logger.ts +1 -1
- package/types/map.ts +1 -1
- package/types/pipe.ts +10 -8
- package/types/quorum.ts +20 -13
- package/types/redis.ts +70 -15
- package/types/serializer.ts +8 -6
- package/types/stats.ts +22 -6
- package/types/stream.ts +9 -9
- package/types/task.ts +7 -1
- package/types/telemetry.ts +2 -1
- package/types/transition.ts +8 -8
package/types/hook.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
interface HookCondition {
|
|
3
2
|
expected: string;
|
|
4
3
|
actual: string;
|
|
@@ -23,10 +22,18 @@ interface HookRules {
|
|
|
23
22
|
[eventName: string]: HookRule[];
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
type HookSignal = { topic: string
|
|
25
|
+
type HookSignal = { topic: string; resolved: string; jobId: string };
|
|
27
26
|
|
|
28
27
|
interface HookInterface {
|
|
29
|
-
(topic: string, data: { [key: string]: any
|
|
28
|
+
(topic: string, data: { [key: string]: any; id: string }): Promise<void>;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
export {
|
|
31
|
+
export {
|
|
32
|
+
HookCondition,
|
|
33
|
+
HookConditions,
|
|
34
|
+
HookGate,
|
|
35
|
+
HookInterface,
|
|
36
|
+
HookRule,
|
|
37
|
+
HookRules,
|
|
38
|
+
HookSignal,
|
|
39
|
+
};
|
package/types/hotmesh.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ILogger } from '../services/logger';
|
|
2
2
|
import { HotMeshService } from '../services/hotmesh';
|
|
3
|
+
|
|
3
4
|
import { HookRules } from './hook';
|
|
4
5
|
import { RedisClass, RedisClient, RedisOptions } from './redis';
|
|
5
6
|
import { StreamData, StreamDataResponse } from './stream';
|
|
@@ -28,22 +29,22 @@ enum KeyType {
|
|
|
28
29
|
SYMVALS = 'SYMVALS',
|
|
29
30
|
TIME_RANGE = 'TIME_RANGE',
|
|
30
31
|
WORK_ITEMS = 'WORK_ITEMS',
|
|
31
|
-
}
|
|
32
|
+
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* minting keys, requires one or more of the following parameters
|
|
35
36
|
*/
|
|
36
37
|
type KeyStoreParams = {
|
|
37
|
-
appId?: string;
|
|
38
|
-
engineId?: string;
|
|
39
|
-
appVersion?: string;
|
|
40
|
-
jobId?: string;
|
|
41
|
-
activityId?: string;
|
|
42
|
-
jobKey?: string;
|
|
43
|
-
dateTime?: string;
|
|
44
|
-
facet?: string;
|
|
45
|
-
topic?: string;
|
|
46
|
-
timeValue?: number;
|
|
38
|
+
appId?: string; //app id is a uuid for a hotmesh app
|
|
39
|
+
engineId?: string; //unique auto-generated guid for an ephemeral engine instance
|
|
40
|
+
appVersion?: string; //(e.g. "1.0.0", "1", "1.0")
|
|
41
|
+
jobId?: string; //a customer-defined id for job; must be unique for the entire app
|
|
42
|
+
activityId?: string; //activity id is a uuid for a given hotmesh app
|
|
43
|
+
jobKey?: string; //a customer-defined label for a job that serves to categorize events
|
|
44
|
+
dateTime?: string; //UTC date time: YYYY-MM-DDTHH:MM (20203-04-12T00:00); serves as a time-series bucket for the job_key
|
|
45
|
+
facet?: string; //data path starting at root with values separated by colons (e.g. "object/type:bar")
|
|
46
|
+
topic?: string; //topic name (e.g., "foo" or "" for top-level)
|
|
47
|
+
timeValue?: number; //time value (rounded to minute) (for delete range)
|
|
47
48
|
scoutType?: 'signal' | 'time' | 'activate'; //a single member of the quorum serves as the 'scout' for the group, triaging tasks for the collective
|
|
48
49
|
};
|
|
49
50
|
|
|
@@ -52,27 +53,27 @@ type HotMesh = typeof HotMeshService;
|
|
|
52
53
|
type RedisConfig = {
|
|
53
54
|
class: Partial<RedisClass>;
|
|
54
55
|
options: Partial<RedisOptions>;
|
|
55
|
-
}
|
|
56
|
+
};
|
|
56
57
|
|
|
57
58
|
type HotMeshEngine = {
|
|
58
|
-
store?: RedisClient;
|
|
59
|
+
store?: RedisClient; //set by hotmesh using instanced `redis` class
|
|
59
60
|
stream?: RedisClient; //set by hotmesh using instanced `redis` class
|
|
60
|
-
sub?: RedisClient;
|
|
61
|
+
sub?: RedisClient; //set by hotmesh using instanced `redis` class
|
|
61
62
|
redis?: RedisConfig;
|
|
62
63
|
reclaimDelay?: number; //milliseconds
|
|
63
64
|
reclaimCount?: number;
|
|
64
|
-
}
|
|
65
|
+
};
|
|
65
66
|
|
|
66
67
|
type HotMeshWorker = {
|
|
67
68
|
topic: string;
|
|
68
|
-
store?: RedisClient;
|
|
69
|
+
store?: RedisClient; //set by hotmesh using instanced `redis` class
|
|
69
70
|
stream?: RedisClient; //set by hotmesh using instanced `redis` class
|
|
70
|
-
sub?: RedisClient;
|
|
71
|
+
sub?: RedisClient; //set by hotmesh using instanced `redis` class
|
|
71
72
|
redis?: RedisConfig;
|
|
72
73
|
reclaimDelay?: number; //milliseconds
|
|
73
74
|
reclaimCount?: number; //max number of times to reclaim a stream
|
|
74
|
-
callback: (payload: StreamData) => Promise<StreamDataResponse|void>;
|
|
75
|
-
}
|
|
75
|
+
callback: (payload: StreamData) => Promise<StreamDataResponse | void>;
|
|
76
|
+
};
|
|
76
77
|
|
|
77
78
|
type HotMeshConfig = {
|
|
78
79
|
appId: string;
|
|
@@ -82,7 +83,7 @@ type HotMeshConfig = {
|
|
|
82
83
|
logLevel?: LogLevel;
|
|
83
84
|
engine?: HotMeshEngine;
|
|
84
85
|
workers?: HotMeshWorker[];
|
|
85
|
-
}
|
|
86
|
+
};
|
|
86
87
|
|
|
87
88
|
type HotMeshGraph = {
|
|
88
89
|
subscribes: string;
|
|
@@ -118,10 +119,10 @@ type VersionedFields = {
|
|
|
118
119
|
};
|
|
119
120
|
|
|
120
121
|
type HotMeshApp = VersionedFields & {
|
|
121
|
-
id: string;
|
|
122
|
-
version: string;
|
|
122
|
+
id: string; // customer's chosen app id
|
|
123
|
+
version: string; // customer's chosen version scheme (semver, etc)
|
|
123
124
|
settings?: string; // stringified JSON for app settings
|
|
124
|
-
active?: boolean;
|
|
125
|
+
active?: boolean; // is the app active?
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
type HotMeshApps = {
|
|
@@ -134,8 +135,8 @@ export {
|
|
|
134
135
|
RedisConfig,
|
|
135
136
|
HotMeshWorker,
|
|
136
137
|
HotMeshSettings,
|
|
137
|
-
HotMeshApp,
|
|
138
|
-
HotMeshApps,
|
|
138
|
+
HotMeshApp, //a single app in the db
|
|
139
|
+
HotMeshApps, //object array of all apps in the db
|
|
139
140
|
HotMeshConfig, //customer config
|
|
140
141
|
HotMeshManifest,
|
|
141
142
|
HotMeshGraph,
|
package/types/index.ts
CHANGED
|
@@ -15,50 +15,45 @@ export {
|
|
|
15
15
|
InterruptActivity,
|
|
16
16
|
SignalActivity,
|
|
17
17
|
TriggerActivity,
|
|
18
|
-
TriggerActivityStats
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
AppVID,
|
|
22
|
-
AppTransitions,
|
|
23
|
-
AppSubscriptions
|
|
24
|
-
} from './app';
|
|
18
|
+
TriggerActivityStats,
|
|
19
|
+
} from './activity';
|
|
20
|
+
export { App, AppVID, AppTransitions, AppSubscriptions } from './app';
|
|
25
21
|
export { AsyncSignal } from './async';
|
|
26
22
|
export { CacheMode } from './cache';
|
|
27
|
-
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
WorkflowOptions,
|
|
55
|
-
} from './durable';
|
|
23
|
+
export { CollationFaultType, CollationStage } from './collator';
|
|
24
|
+
export {
|
|
25
|
+
ActivityConfig,
|
|
26
|
+
ActivityWorkflowDataType,
|
|
27
|
+
ChildResponseType,
|
|
28
|
+
ClientConfig,
|
|
29
|
+
ContextType,
|
|
30
|
+
ConnectionConfig,
|
|
31
|
+
Connection,
|
|
32
|
+
ProxyResponseType,
|
|
33
|
+
ProxyType,
|
|
34
|
+
Registry,
|
|
35
|
+
SignalOptions,
|
|
36
|
+
FindJobsOptions,
|
|
37
|
+
FindOptions,
|
|
38
|
+
FindWhereOptions,
|
|
39
|
+
FindWhereQuery,
|
|
40
|
+
HookOptions,
|
|
41
|
+
SearchResults,
|
|
42
|
+
WorkflowConfig,
|
|
43
|
+
WorkerConfig,
|
|
44
|
+
WorkerOptions,
|
|
45
|
+
WorkflowContext,
|
|
46
|
+
WorkflowSearchOptions,
|
|
47
|
+
WorkflowDataType,
|
|
48
|
+
WorkflowOptions,
|
|
49
|
+
} from './durable';
|
|
56
50
|
export {
|
|
57
51
|
DurableChildErrorType,
|
|
58
52
|
DurableProxyErrorType,
|
|
59
53
|
DurableSleepErrorType,
|
|
60
54
|
DurableWaitForAllErrorType,
|
|
61
|
-
DurableWaitForErrorType
|
|
55
|
+
DurableWaitForErrorType,
|
|
56
|
+
} from './error';
|
|
62
57
|
export {
|
|
63
58
|
ActivityAction,
|
|
64
59
|
DependencyExport,
|
|
@@ -70,7 +65,8 @@ export {
|
|
|
70
65
|
JobAction,
|
|
71
66
|
JobExport,
|
|
72
67
|
JobActionExport,
|
|
73
|
-
JobTimeline
|
|
68
|
+
JobTimeline,
|
|
69
|
+
} from './exporter';
|
|
74
70
|
export {
|
|
75
71
|
HookCondition,
|
|
76
72
|
HookConditions,
|
|
@@ -78,7 +74,7 @@ export {
|
|
|
78
74
|
HookInterface,
|
|
79
75
|
HookRule,
|
|
80
76
|
HookRules,
|
|
81
|
-
HookSignal
|
|
77
|
+
HookSignal,
|
|
82
78
|
} from './hook';
|
|
83
79
|
export { ILogger } from './logger';
|
|
84
80
|
export {
|
|
@@ -91,7 +87,8 @@ export {
|
|
|
91
87
|
JobOutput,
|
|
92
88
|
JobState,
|
|
93
89
|
JobStatus,
|
|
94
|
-
PartialJobState
|
|
90
|
+
PartialJobState,
|
|
91
|
+
} from './job';
|
|
95
92
|
export { MappingStatements } from './map';
|
|
96
93
|
export {
|
|
97
94
|
Pipe,
|
|
@@ -99,7 +96,8 @@ export {
|
|
|
99
96
|
PipeItem,
|
|
100
97
|
PipeItems,
|
|
101
98
|
PipeObject,
|
|
102
|
-
ReduceObject
|
|
99
|
+
ReduceObject,
|
|
100
|
+
} from './pipe';
|
|
103
101
|
export {
|
|
104
102
|
HotMesh,
|
|
105
103
|
HotMeshApp,
|
|
@@ -112,7 +110,8 @@ export {
|
|
|
112
110
|
HotMeshSettings,
|
|
113
111
|
HotMeshWorker,
|
|
114
112
|
KeyStoreParams,
|
|
115
|
-
KeyType
|
|
113
|
+
KeyType,
|
|
114
|
+
} from './hotmesh';
|
|
116
115
|
export {
|
|
117
116
|
ActivateMessage,
|
|
118
117
|
CronMessage,
|
|
@@ -130,7 +129,8 @@ export {
|
|
|
130
129
|
SystemHealth,
|
|
131
130
|
ThrottleMessage,
|
|
132
131
|
ThrottleOptions,
|
|
133
|
-
WorkMessage
|
|
132
|
+
WorkMessage,
|
|
133
|
+
} from './quorum';
|
|
134
134
|
export {
|
|
135
135
|
RedisClass,
|
|
136
136
|
RedisRedisClientType,
|
|
@@ -157,7 +157,8 @@ export {
|
|
|
157
157
|
SymbolMaps,
|
|
158
158
|
SymbolRanges,
|
|
159
159
|
Symbols,
|
|
160
|
-
SymbolSets
|
|
160
|
+
SymbolSets,
|
|
161
|
+
} from './serializer';
|
|
161
162
|
export {
|
|
162
163
|
AggregatedData,
|
|
163
164
|
CountByFacet,
|
|
@@ -174,7 +175,8 @@ export {
|
|
|
174
175
|
JobStatsRange,
|
|
175
176
|
StatsResponse,
|
|
176
177
|
Segment,
|
|
177
|
-
TimeSegment
|
|
178
|
+
TimeSegment,
|
|
179
|
+
} from './stats';
|
|
178
180
|
export {
|
|
179
181
|
ReclaimedMessageType,
|
|
180
182
|
StreamCode,
|
|
@@ -185,7 +187,8 @@ export {
|
|
|
185
187
|
StreamDataResponse,
|
|
186
188
|
StreamRetryPolicy,
|
|
187
189
|
StreamRole,
|
|
188
|
-
StreamStatus
|
|
190
|
+
StreamStatus,
|
|
191
|
+
} from './stream';
|
|
189
192
|
export {
|
|
190
193
|
context,
|
|
191
194
|
Context,
|
|
@@ -200,10 +203,7 @@ export {
|
|
|
200
203
|
SpanKind,
|
|
201
204
|
trace,
|
|
202
205
|
Tracer,
|
|
203
|
-
ValueType
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
export {
|
|
207
|
-
TransitionMatch,
|
|
208
|
-
TransitionRule,
|
|
209
|
-
Transitions } from './transition';
|
|
206
|
+
ValueType,
|
|
207
|
+
} from './telemetry';
|
|
208
|
+
export { WorkListTaskType } from './task';
|
|
209
|
+
export { TransitionMatch, TransitionRule, Transitions } from './transition';
|
package/types/job.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StringStringType } from
|
|
1
|
+
import { StringStringType } from './serializer';
|
|
2
2
|
|
|
3
|
-
type JobData = Record<string, unknown|Record<string, unknown>>;
|
|
3
|
+
type JobData = Record<string, unknown | Record<string, unknown>>;
|
|
4
4
|
type JobsData = Record<string, unknown>;
|
|
5
5
|
|
|
6
6
|
type ActivityData = {
|
|
@@ -11,75 +11,75 @@ type ActivityData = {
|
|
|
11
11
|
type JobMetadata = {
|
|
12
12
|
/** job_key */
|
|
13
13
|
key?: string;
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
/** system assigned guid that corresponds to the transition message guid that spawned reentry */
|
|
16
16
|
guid?: string;
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
/** system assigned guid; ensured created/deleted/created jobs are unique */
|
|
19
19
|
gid: string;
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
/** job_id (jid+dad+aid) is composite key for activity */
|
|
22
22
|
jid: string;
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
/** dimensional address for the activity (,0,0,1) */
|
|
25
25
|
dad: string;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
/** activity_id as in the YAML file */
|
|
28
28
|
aid: string;
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
/** parent_job_id (pj+pd+pa) is composite key for parent activity */
|
|
31
31
|
pj?: string;
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
/** parent_generational_id (system assigned at trigger inception); pg is the parent job's gid (just in case user created/deleted/created a job with same jid) */
|
|
34
34
|
pg?: string;
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
/** parent_dimensional_address */
|
|
37
37
|
pd?: string;
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
/** parent_activity_id */
|
|
40
40
|
pa?: string;
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
/** sever the dependency chain if true (startChild/vs/execChild) */
|
|
43
43
|
px?: boolean;
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
/** engine guid (one time subscriptions) */
|
|
46
46
|
ngn?: string;
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
/** app_id */
|
|
49
49
|
app: string;
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
/** app version */
|
|
52
52
|
vrs: string;
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
/** subscription topic */
|
|
55
55
|
tpc: string;
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
/** 201203120005 (slice of time) //time series */
|
|
58
58
|
ts: string;
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
/** GMT created //job_created */
|
|
61
61
|
jc: string;
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
/** GMT updated //job_updated */
|
|
64
64
|
ju: string;
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
js: JobStatus;
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
/** activity_type */
|
|
69
69
|
atp: string;
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
/** activity_subtype */
|
|
72
72
|
stp: string;
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
/** open telemetry span context */
|
|
75
75
|
spn: string;
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
/** open telemetry trace context */
|
|
78
78
|
trc: string;
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
/** stringified job error json: {message: string, code: number, error?} */
|
|
81
81
|
err?: string;
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
/** process data expire policy */
|
|
84
84
|
expire?: number;
|
|
85
85
|
};
|
|
@@ -106,7 +106,7 @@ type ExtensionType = {
|
|
|
106
106
|
* the initial data set.
|
|
107
107
|
*/
|
|
108
108
|
marker?: StringStringType;
|
|
109
|
-
}
|
|
109
|
+
};
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* job_status semaphore
|
|
@@ -126,19 +126,19 @@ type JobState = {
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
128
|
type JobInterruptOptions = {
|
|
129
|
-
/**
|
|
129
|
+
/**
|
|
130
130
|
* optional Reason; will be used as the error `message` when thrown
|
|
131
131
|
* @default 'Job Interrupted'
|
|
132
132
|
*/
|
|
133
133
|
reason?: string;
|
|
134
134
|
|
|
135
|
-
/**
|
|
135
|
+
/**
|
|
136
136
|
* throw JobInterrupted error upon interrupting
|
|
137
137
|
* @default true
|
|
138
138
|
*/
|
|
139
139
|
throw?: boolean;
|
|
140
140
|
|
|
141
|
-
/**
|
|
141
|
+
/**
|
|
142
142
|
* interrupt child/descendant jobs
|
|
143
143
|
* @default false
|
|
144
144
|
*/
|
|
@@ -157,7 +157,7 @@ type JobInterruptOptions = {
|
|
|
157
157
|
*/
|
|
158
158
|
expire?: number;
|
|
159
159
|
|
|
160
|
-
/**
|
|
160
|
+
/**
|
|
161
161
|
* Optional Error Code; will be used as the error `code` when thrown
|
|
162
162
|
* @default 410
|
|
163
163
|
*/
|
|
@@ -188,10 +188,10 @@ type PartialJobState = {
|
|
|
188
188
|
type JobCompletionOptions = {
|
|
189
189
|
/** default false */
|
|
190
190
|
emit?: boolean;
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
/** default undefined */
|
|
193
193
|
interrupt?: boolean;
|
|
194
|
-
|
|
194
|
+
|
|
195
195
|
/**
|
|
196
196
|
* in seconds to wait before deleting/expiring job hash
|
|
197
197
|
* @default 1 second
|
package/types/logger.ts
CHANGED
package/types/map.ts
CHANGED
package/types/pipe.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
2
|
* Represents a single cell value in a pipeline row
|
|
3
3
|
* If the value is a string, the value will be a literal OR mapping expression
|
|
4
4
|
*/
|
|
@@ -22,20 +22,20 @@ type PipeObject = { '@pipe': Array<PipeItem[] | PipeObject | ReduceObject> };
|
|
|
22
22
|
* But it also iterates and produces output. The context variables,
|
|
23
23
|
* `$input`, `$output`, `$item`, `$key`, and `$index` are available.
|
|
24
24
|
* @example
|
|
25
|
-
*
|
|
25
|
+
*
|
|
26
26
|
* // Example of a reduce expression. The optional object is empty and
|
|
27
27
|
* // serves as the $output during iteration. The last step in the iteration
|
|
28
28
|
* // sets $output. if ther are no more iterations, the $output is returned
|
|
29
|
-
* // and provided to the next step in the pipeline.
|
|
30
|
-
*
|
|
29
|
+
* // and provided to the next step in the pipeline.
|
|
30
|
+
*
|
|
31
31
|
* // If data is:
|
|
32
32
|
* // { response: ['a', 'b', 'c'] }
|
|
33
|
-
*
|
|
33
|
+
*
|
|
34
34
|
* // The reduced/transformed expression will be:
|
|
35
35
|
* // { 'a': 0, 'b': 1, 'c': 2 }
|
|
36
|
-
*
|
|
36
|
+
*
|
|
37
37
|
* // Arrays and objects may be iterated over and transformed.
|
|
38
|
-
*
|
|
38
|
+
*
|
|
39
39
|
* //YAML
|
|
40
40
|
* '@pipe':
|
|
41
41
|
* - ['{data.response}', {}]
|
|
@@ -48,7 +48,9 @@ type PipeObject = { '@pipe': Array<PipeItem[] | PipeObject | ReduceObject> };
|
|
|
48
48
|
* - ['{$index}']
|
|
49
49
|
* - ['{@object.set}']
|
|
50
50
|
*/
|
|
51
|
-
type ReduceObject = {
|
|
51
|
+
type ReduceObject = {
|
|
52
|
+
'@reduce': Array<PipeItem[] | PipeObject | ReduceObject>;
|
|
53
|
+
};
|
|
52
54
|
|
|
53
55
|
/**
|
|
54
56
|
* Represents a sequence in the pipeline that can include arrays of `PipeItem`, `PipeObject`, or `ReduceObject`.
|
package/types/quorum.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JobOutput } from
|
|
1
|
+
import { JobOutput } from './job';
|
|
2
2
|
|
|
3
3
|
interface CPULoad {
|
|
4
4
|
[cpu: string]: string;
|
|
@@ -71,7 +71,7 @@ interface QuorumMessageBase {
|
|
|
71
71
|
export interface PingMessage extends QuorumMessageBase {
|
|
72
72
|
type: 'ping';
|
|
73
73
|
originator: string; //guid
|
|
74
|
-
details?: boolean;
|
|
74
|
+
details?: boolean; //if true, all endpoints will include their profile
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export interface WorkMessage extends QuorumMessageBase {
|
|
@@ -86,9 +86,9 @@ export interface CronMessage extends QuorumMessageBase {
|
|
|
86
86
|
|
|
87
87
|
export interface PongMessage extends QuorumMessageBase {
|
|
88
88
|
type: 'pong';
|
|
89
|
-
guid: string;
|
|
90
|
-
originator: string;
|
|
91
|
-
entity?: string;
|
|
89
|
+
guid: string; //call initiator
|
|
90
|
+
originator: string; //clone of originator guid passed in ping
|
|
91
|
+
entity?: string; //optional entity
|
|
92
92
|
profile?: QuorumProfile; //contains details about the engine/worker
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -102,25 +102,25 @@ export interface JobMessage extends QuorumMessageBase {
|
|
|
102
102
|
type: 'job';
|
|
103
103
|
entity?: string;
|
|
104
104
|
topic: string; //this comes from the 'publishes' field in the YAML
|
|
105
|
-
job: JobOutput
|
|
105
|
+
job: JobOutput;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export interface ThrottleMessage extends QuorumMessageBase {
|
|
109
109
|
type: 'throttle';
|
|
110
110
|
guid?: string; //target engine AND workers with this guid
|
|
111
111
|
entity?: string;
|
|
112
|
-
topic?: string;
|
|
112
|
+
topic?: string; //target worker(s) matching this topic (pass null to only target the engine, pass undefined to target engine and workers)
|
|
113
113
|
throttle: number; //0-n; millis
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export interface RollCallMessage extends QuorumMessageBase {
|
|
117
117
|
type: 'rollcall';
|
|
118
|
-
guid?: string;
|
|
118
|
+
guid?: string; //target the engine quorum
|
|
119
119
|
entity?: string;
|
|
120
|
-
topic?: string | null;
|
|
120
|
+
topic?: string | null; //target a worker if string; suppress if `null`;
|
|
121
121
|
interval: number; //every 'n' seconds
|
|
122
|
-
max?: number;
|
|
123
|
-
signature?: boolean; //include bound worker function in broadcast
|
|
122
|
+
max?: number; //max broadcasts
|
|
123
|
+
signature?: boolean; //include bound worker function in broadcast
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export interface JobMessageCallback {
|
|
@@ -144,11 +144,18 @@ export type SubscriptionOptions = {
|
|
|
144
144
|
namespace?: string;
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
|
|
148
147
|
/**
|
|
149
148
|
* The types in this file are used to define those messages that are sent
|
|
150
149
|
* to hotmesh client instances when a new version is about to be activated.
|
|
151
150
|
* These messages serve to coordinate the cache invalidation and switch-over
|
|
152
151
|
* to the new version without any downtime and a coordinating parent server.
|
|
153
152
|
*/
|
|
154
|
-
export type QuorumMessage =
|
|
153
|
+
export type QuorumMessage =
|
|
154
|
+
| PingMessage
|
|
155
|
+
| PongMessage
|
|
156
|
+
| ActivateMessage
|
|
157
|
+
| WorkMessage
|
|
158
|
+
| JobMessage
|
|
159
|
+
| ThrottleMessage
|
|
160
|
+
| RollCallMessage
|
|
161
|
+
| CronMessage;
|