@hotmeshio/hotmesh 0.0.1

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 (263) hide show
  1. package/LICENSE +214 -0
  2. package/README.md +241 -0
  3. package/build/index.d.ts +4 -0
  4. package/build/index.js +7 -0
  5. package/build/modules/errors.d.ts +28 -0
  6. package/build/modules/errors.js +50 -0
  7. package/build/modules/key.d.ts +75 -0
  8. package/build/modules/key.js +116 -0
  9. package/build/modules/utils.d.ts +34 -0
  10. package/build/modules/utils.js +173 -0
  11. package/build/package.json +73 -0
  12. package/build/services/activities/activity.d.ts +59 -0
  13. package/build/services/activities/activity.js +396 -0
  14. package/build/services/activities/await.d.ts +16 -0
  15. package/build/services/activities/await.js +143 -0
  16. package/build/services/activities/emit.d.ts +9 -0
  17. package/build/services/activities/emit.js +13 -0
  18. package/build/services/activities/index.d.ts +15 -0
  19. package/build/services/activities/index.js +16 -0
  20. package/build/services/activities/iterate.d.ts +9 -0
  21. package/build/services/activities/iterate.js +13 -0
  22. package/build/services/activities/trigger.d.ts +22 -0
  23. package/build/services/activities/trigger.js +161 -0
  24. package/build/services/activities/worker.d.ts +17 -0
  25. package/build/services/activities/worker.js +164 -0
  26. package/build/services/collator/index.d.ts +54 -0
  27. package/build/services/collator/index.js +171 -0
  28. package/build/services/compiler/deployer.d.ts +35 -0
  29. package/build/services/compiler/deployer.js +412 -0
  30. package/build/services/compiler/index.d.ts +30 -0
  31. package/build/services/compiler/index.js +111 -0
  32. package/build/services/compiler/validator.d.ts +32 -0
  33. package/build/services/compiler/validator.js +134 -0
  34. package/build/services/connector/clients/ioredis.d.ts +13 -0
  35. package/build/services/connector/clients/ioredis.js +50 -0
  36. package/build/services/connector/clients/redis.d.ts +13 -0
  37. package/build/services/connector/clients/redis.js +62 -0
  38. package/build/services/connector/index.d.ts +5 -0
  39. package/build/services/connector/index.js +31 -0
  40. package/build/services/dimension/index.d.ts +29 -0
  41. package/build/services/dimension/index.js +35 -0
  42. package/build/services/durable/asyncLocalStorage.d.ts +3 -0
  43. package/build/services/durable/asyncLocalStorage.js +5 -0
  44. package/build/services/durable/client.d.ts +15 -0
  45. package/build/services/durable/client.js +108 -0
  46. package/build/services/durable/connection.d.ts +4 -0
  47. package/build/services/durable/connection.js +51 -0
  48. package/build/services/durable/factory.d.ts +3 -0
  49. package/build/services/durable/factory.js +123 -0
  50. package/build/services/durable/handle.d.ts +8 -0
  51. package/build/services/durable/handle.js +38 -0
  52. package/build/services/durable/index.d.ts +57 -0
  53. package/build/services/durable/index.js +58 -0
  54. package/build/services/durable/native.d.ts +4 -0
  55. package/build/services/durable/native.js +47 -0
  56. package/build/services/durable/worker.d.ts +36 -0
  57. package/build/services/durable/worker.js +266 -0
  58. package/build/services/durable/workflow.d.ts +6 -0
  59. package/build/services/durable/workflow.js +135 -0
  60. package/build/services/engine/index.d.ts +82 -0
  61. package/build/services/engine/index.js +511 -0
  62. package/build/services/hotmesh/index.d.ts +45 -0
  63. package/build/services/hotmesh/index.js +134 -0
  64. package/build/services/logger/index.d.ts +17 -0
  65. package/build/services/logger/index.js +73 -0
  66. package/build/services/mapper/index.d.ts +24 -0
  67. package/build/services/mapper/index.js +72 -0
  68. package/build/services/pipe/functions/array.d.ts +24 -0
  69. package/build/services/pipe/functions/array.js +69 -0
  70. package/build/services/pipe/functions/bitwise.d.ts +9 -0
  71. package/build/services/pipe/functions/bitwise.js +24 -0
  72. package/build/services/pipe/functions/conditional.d.ts +10 -0
  73. package/build/services/pipe/functions/conditional.js +27 -0
  74. package/build/services/pipe/functions/date.d.ts +57 -0
  75. package/build/services/pipe/functions/date.js +167 -0
  76. package/build/services/pipe/functions/index.d.ts +25 -0
  77. package/build/services/pipe/functions/index.js +26 -0
  78. package/build/services/pipe/functions/json.d.ts +5 -0
  79. package/build/services/pipe/functions/json.js +12 -0
  80. package/build/services/pipe/functions/math.d.ts +38 -0
  81. package/build/services/pipe/functions/math.js +111 -0
  82. package/build/services/pipe/functions/number.d.ts +25 -0
  83. package/build/services/pipe/functions/number.js +133 -0
  84. package/build/services/pipe/functions/object.d.ts +22 -0
  85. package/build/services/pipe/functions/object.js +63 -0
  86. package/build/services/pipe/functions/string.d.ts +23 -0
  87. package/build/services/pipe/functions/string.js +69 -0
  88. package/build/services/pipe/functions/symbol.d.ts +12 -0
  89. package/build/services/pipe/functions/symbol.js +33 -0
  90. package/build/services/pipe/functions/unary.d.ts +7 -0
  91. package/build/services/pipe/functions/unary.js +18 -0
  92. package/build/services/pipe/index.d.ts +30 -0
  93. package/build/services/pipe/index.js +128 -0
  94. package/build/services/quorum/index.d.ts +34 -0
  95. package/build/services/quorum/index.js +147 -0
  96. package/build/services/reporter/index.d.ts +47 -0
  97. package/build/services/reporter/index.js +330 -0
  98. package/build/services/serializer/index.d.ts +36 -0
  99. package/build/services/serializer/index.js +222 -0
  100. package/build/services/signaler/store.d.ts +15 -0
  101. package/build/services/signaler/store.js +53 -0
  102. package/build/services/signaler/stream.d.ts +43 -0
  103. package/build/services/signaler/stream.js +317 -0
  104. package/build/services/store/cache.d.ts +66 -0
  105. package/build/services/store/cache.js +127 -0
  106. package/build/services/store/clients/ioredis.d.ts +27 -0
  107. package/build/services/store/clients/ioredis.js +96 -0
  108. package/build/services/store/clients/redis.d.ts +29 -0
  109. package/build/services/store/clients/redis.js +143 -0
  110. package/build/services/store/index.d.ts +88 -0
  111. package/build/services/store/index.js +657 -0
  112. package/build/services/stream/clients/ioredis.d.ts +23 -0
  113. package/build/services/stream/clients/ioredis.js +115 -0
  114. package/build/services/stream/clients/redis.d.ts +23 -0
  115. package/build/services/stream/clients/redis.js +119 -0
  116. package/build/services/stream/index.d.ts +21 -0
  117. package/build/services/stream/index.js +9 -0
  118. package/build/services/sub/clients/ioredis.d.ts +20 -0
  119. package/build/services/sub/clients/ioredis.js +72 -0
  120. package/build/services/sub/clients/redis.d.ts +20 -0
  121. package/build/services/sub/clients/redis.js +63 -0
  122. package/build/services/sub/index.d.ts +18 -0
  123. package/build/services/sub/index.js +9 -0
  124. package/build/services/task/index.d.ts +18 -0
  125. package/build/services/task/index.js +73 -0
  126. package/build/services/telemetry/index.d.ts +49 -0
  127. package/build/services/telemetry/index.js +223 -0
  128. package/build/services/worker/index.d.ts +30 -0
  129. package/build/services/worker/index.js +105 -0
  130. package/build/types/activity.d.ts +86 -0
  131. package/build/types/activity.js +2 -0
  132. package/build/types/app.d.ts +16 -0
  133. package/build/types/app.js +2 -0
  134. package/build/types/async.d.ts +5 -0
  135. package/build/types/async.js +2 -0
  136. package/build/types/cache.d.ts +1 -0
  137. package/build/types/cache.js +2 -0
  138. package/build/types/collator.d.ts +8 -0
  139. package/build/types/collator.js +11 -0
  140. package/build/types/durable.d.ts +59 -0
  141. package/build/types/durable.js +2 -0
  142. package/build/types/hook.d.ts +31 -0
  143. package/build/types/hook.js +9 -0
  144. package/build/types/hotmesh.d.ts +82 -0
  145. package/build/types/hotmesh.js +2 -0
  146. package/build/types/index.d.ts +20 -0
  147. package/build/types/index.js +21 -0
  148. package/build/types/ioredisclient.d.ts +5 -0
  149. package/build/types/ioredisclient.js +5 -0
  150. package/build/types/job.d.ts +50 -0
  151. package/build/types/job.js +2 -0
  152. package/build/types/logger.d.ts +6 -0
  153. package/build/types/logger.js +2 -0
  154. package/build/types/map.d.ts +4 -0
  155. package/build/types/map.js +2 -0
  156. package/build/types/pipe.d.ts +4 -0
  157. package/build/types/pipe.js +2 -0
  158. package/build/types/quorum.d.ts +46 -0
  159. package/build/types/quorum.js +2 -0
  160. package/build/types/redis.d.ts +8 -0
  161. package/build/types/redis.js +2 -0
  162. package/build/types/redisclient.d.ts +25 -0
  163. package/build/types/redisclient.js +2 -0
  164. package/build/types/serializer.d.ts +33 -0
  165. package/build/types/serializer.js +2 -0
  166. package/build/types/stats.d.ts +83 -0
  167. package/build/types/stats.js +2 -0
  168. package/build/types/stream.d.ts +67 -0
  169. package/build/types/stream.js +25 -0
  170. package/build/types/telemetry.d.ts +1 -0
  171. package/build/types/telemetry.js +11 -0
  172. package/build/types/transition.d.ts +17 -0
  173. package/build/types/transition.js +2 -0
  174. package/index.ts +5 -0
  175. package/modules/errors.ts +55 -0
  176. package/modules/key.ts +129 -0
  177. package/modules/utils.ts +170 -0
  178. package/package.json +73 -0
  179. package/services/activities/activity.ts +473 -0
  180. package/services/activities/await.ts +172 -0
  181. package/services/activities/emit.ts +25 -0
  182. package/services/activities/index.ts +15 -0
  183. package/services/activities/iterate.ts +26 -0
  184. package/services/activities/trigger.ts +196 -0
  185. package/services/activities/worker.ts +190 -0
  186. package/services/collator/README.md +102 -0
  187. package/services/collator/index.ts +182 -0
  188. package/services/compiler/deployer.ts +432 -0
  189. package/services/compiler/index.ts +98 -0
  190. package/services/compiler/validator.ts +154 -0
  191. package/services/connector/clients/ioredis.ts +57 -0
  192. package/services/connector/clients/redis.ts +72 -0
  193. package/services/connector/index.ts +44 -0
  194. package/services/dimension/README.md +73 -0
  195. package/services/dimension/index.ts +39 -0
  196. package/services/durable/asyncLocalStorage.ts +3 -0
  197. package/services/durable/client.ts +116 -0
  198. package/services/durable/connection.ts +50 -0
  199. package/services/durable/factory.ts +124 -0
  200. package/services/durable/handle.ts +43 -0
  201. package/services/durable/index.ts +60 -0
  202. package/services/durable/native.ts +46 -0
  203. package/services/durable/worker.ts +254 -0
  204. package/services/durable/workflow.ts +136 -0
  205. package/services/engine/index.ts +615 -0
  206. package/services/hotmesh/index.ts +182 -0
  207. package/services/logger/index.ts +79 -0
  208. package/services/mapper/index.ts +84 -0
  209. package/services/pipe/functions/array.ts +87 -0
  210. package/services/pipe/functions/bitwise.ts +27 -0
  211. package/services/pipe/functions/conditional.ts +31 -0
  212. package/services/pipe/functions/date.ts +214 -0
  213. package/services/pipe/functions/index.ts +25 -0
  214. package/services/pipe/functions/json.ts +11 -0
  215. package/services/pipe/functions/math.ts +143 -0
  216. package/services/pipe/functions/number.ts +150 -0
  217. package/services/pipe/functions/object.ts +79 -0
  218. package/services/pipe/functions/string.ts +86 -0
  219. package/services/pipe/functions/symbol.ts +39 -0
  220. package/services/pipe/functions/unary.ts +19 -0
  221. package/services/pipe/index.ts +138 -0
  222. package/services/quorum/index.ts +200 -0
  223. package/services/reporter/index.ts +379 -0
  224. package/services/serializer/README.md +10 -0
  225. package/services/serializer/index.ts +243 -0
  226. package/services/signaler/store.ts +61 -0
  227. package/services/signaler/stream.ts +354 -0
  228. package/services/store/cache.ts +172 -0
  229. package/services/store/clients/ioredis.ts +123 -0
  230. package/services/store/clients/redis.ts +169 -0
  231. package/services/store/index.ts +757 -0
  232. package/services/stream/clients/ioredis.ts +148 -0
  233. package/services/stream/clients/redis.ts +144 -0
  234. package/services/stream/index.ts +57 -0
  235. package/services/sub/clients/ioredis.ts +83 -0
  236. package/services/sub/clients/redis.ts +74 -0
  237. package/services/sub/index.ts +25 -0
  238. package/services/task/index.ts +86 -0
  239. package/services/telemetry/index.ts +267 -0
  240. package/services/worker/index.ts +165 -0
  241. package/types/activity.ts +115 -0
  242. package/types/app.ts +20 -0
  243. package/types/async.ts +7 -0
  244. package/types/cache.ts +1 -0
  245. package/types/collator.ts +9 -0
  246. package/types/durable.ts +81 -0
  247. package/types/hook.ts +32 -0
  248. package/types/hotmesh.ts +102 -0
  249. package/types/index.ts +138 -0
  250. package/types/ioredisclient.ts +10 -0
  251. package/types/job.ts +59 -0
  252. package/types/logger.ts +6 -0
  253. package/types/map.ts +5 -0
  254. package/types/ms.d.ts +7 -0
  255. package/types/pipe.ts +7 -0
  256. package/types/quorum.ts +59 -0
  257. package/types/redis.ts +27 -0
  258. package/types/redisclient.ts +29 -0
  259. package/types/serializer.ts +38 -0
  260. package/types/stats.ts +100 -0
  261. package/types/stream.ts +75 -0
  262. package/types/telemetry.ts +15 -0
  263. package/types/transition.ts +20 -0
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WorkflowService = void 0;
7
+ const ms_1 = __importDefault(require("ms"));
8
+ const asyncLocalStorage_1 = require("./asyncLocalStorage");
9
+ const worker_1 = require("./worker");
10
+ const client_1 = require("./client");
11
+ const connection_1 = require("./connection");
12
+ /*
13
+ `proxyActivities` returns a wrapped instance of the
14
+ target activity, so that when the workflow calls a
15
+ proxied activity, it is actually calling the proxy
16
+ function, which in turn calls the activity function.
17
+
18
+ `proxyActivities` must be called AFTER the activities
19
+ have been registered in order to work properly.
20
+ If the activities are not already registered,
21
+ `proxyActivities` will throw an error. This is OK.
22
+
23
+ The `client` (client.ts) is equivalent to the
24
+ HotMesh `engine`. The jobs it creates will be
25
+ put in the taskQueue. When the `worker` (worker.ts)
26
+ is eventually initialized (if it happens to be inited later),
27
+ it will see the items in the queue and process them. If it happens
28
+ to already be inited, the jobs will immediately be dequeued and
29
+ processed. In either case, the jobs will be processed.
30
+
31
+ Here is an example of how the methods in this file are used:
32
+
33
+ ./workflows.ts
34
+
35
+ import { Durable } from '@hotmeshio/hotmesh';
36
+ import type * as activities from './activities';
37
+ const { greet } = Durable.workflow.proxyActivities<typeof activities>({
38
+ startToCloseTimeout: '1 minute',
39
+ retryPolicy: {
40
+ initialInterval: '5 seconds', // Initial delay between retries
41
+ maximumAttempts: 3, // Max number of retry attempts
42
+ backoffCoefficient: 2.0, // Backoff factor for delay between retries: delay = initialInterval * (backoffCoefficient ^ retry_attempt)
43
+ maximumInterval: '30 seconds', // Max delay between retries
44
+ },
45
+ });
46
+
47
+ export async function example(name: string): Promise<string> {
48
+ return await greet(name);
49
+ }
50
+ */
51
+ class WorkflowService {
52
+ static async executeChild(options) {
53
+ const store = asyncLocalStorage_1.asyncLocalStorage.getStore();
54
+ if (!store) {
55
+ throw new Error('durable-store-not-found');
56
+ }
57
+ const workflowId = store.get('workflowId');
58
+ const workflowTrace = store.get('workflowTrace');
59
+ const workflowSpan = store.get('workflowSpan');
60
+ const client = new client_1.ClientService({
61
+ connection: await connection_1.ConnectionService.connect(worker_1.WorkerService.connection),
62
+ });
63
+ //todo: should I allow-cross/app callback (pj:'@DURABLE@hello-world@<pjid>'/pa: <paid>/pd: <pdad>)
64
+ const handle = await client.workflow.start({
65
+ ...options,
66
+ workflowId: `${workflowId}${options.workflowId}`,
67
+ workflowTrace,
68
+ workflowSpan,
69
+ });
70
+ const result = await handle.result();
71
+ return result;
72
+ }
73
+ static proxyActivities(options) {
74
+ const proxy = {};
75
+ const keys = Object.keys(worker_1.WorkerService.activityRegistry);
76
+ if (keys.length) {
77
+ keys.forEach((key) => {
78
+ const activityFunction = worker_1.WorkerService.activityRegistry[key];
79
+ proxy[key] = WorkflowService.wrapActivity(key, options);
80
+ });
81
+ }
82
+ return proxy;
83
+ }
84
+ static wrapActivity(activityName, options) {
85
+ return async function () {
86
+ const store = asyncLocalStorage_1.asyncLocalStorage.getStore();
87
+ if (!store) {
88
+ throw new Error('durable-store-not-found');
89
+ }
90
+ const COUNTER = store.get('counter');
91
+ //increment by state (not value) to avoid race conditions
92
+ const execIndex = COUNTER.counter = COUNTER.counter + 1;
93
+ const workflowId = store.get('workflowId');
94
+ const workflowTopic = store.get('workflowTopic');
95
+ const trc = store.get('workflowTrace');
96
+ const spn = store.get('workflowSpan');
97
+ const activityTopic = `${workflowTopic}-activity`;
98
+ const activityJobId = `${workflowId}-${activityName}-${execIndex}`;
99
+ let activityState;
100
+ try {
101
+ const hmshInstance = await worker_1.WorkerService.getHotMesh(activityTopic);
102
+ activityState = await hmshInstance.getState(activityTopic, activityJobId);
103
+ if (activityState.metadata.js == 1) {
104
+ //return immediately
105
+ return activityState.data?.response;
106
+ }
107
+ //one time subscription
108
+ return await new Promise((resolve, reject) => {
109
+ hmshInstance.sub(activityTopic, async (topic, message) => {
110
+ const response = message.data?.response;
111
+ hmshInstance.unsub(activityTopic);
112
+ // Resolve the Promise when the callback is triggered with a message
113
+ resolve(response);
114
+ });
115
+ });
116
+ }
117
+ catch (e) {
118
+ //expected; thrown by `getState` when the job cannot be found
119
+ const duration = (0, ms_1.default)(options?.startToCloseTimeout || '1 minute');
120
+ const payload = {
121
+ arguments: Array.from(arguments),
122
+ workflowId: activityJobId,
123
+ workflowTopic,
124
+ activityName,
125
+ };
126
+ //start the job
127
+ const hmshInstance = await worker_1.WorkerService.getHotMesh(activityTopic);
128
+ const context = { metadata: { trc, spn }, data: {} };
129
+ const jobOutput = await hmshInstance.pubsub(activityTopic, payload, context, duration);
130
+ return jobOutput.data.response;
131
+ }
132
+ };
133
+ }
134
+ }
135
+ exports.WorkflowService = WorkflowService;
@@ -0,0 +1,82 @@
1
+ import { Activity } from '../activities/activity';
2
+ import { ILogger } from '../logger';
3
+ import { StoreSignaler } from '../signaler/store';
4
+ import { StreamSignaler } from '../signaler/stream';
5
+ import { StoreService } from '../store';
6
+ import { StreamService } from '../stream';
7
+ import { SubService } from '../sub';
8
+ import { TaskService } from '../task';
9
+ import { AppVID } from '../../types/app';
10
+ import { ActivityType } from '../../types/activity';
11
+ import { CacheMode } from '../../types/cache';
12
+ import { JobState, JobData, JobMetadata, JobOutput, JobStatus } from '../../types/job';
13
+ import { HotMeshApps, HotMeshConfig, HotMeshManifest, HotMeshSettings } from '../../types/hotmesh';
14
+ import { JobMessageCallback } from '../../types/quorum';
15
+ import { RedisClient, RedisMulti } from '../../types/redis';
16
+ import { GetStatsOptions, IdsResponse, JobStatsInput, StatsResponse } from '../../types/stats';
17
+ import { StreamData, StreamDataResponse, StreamError } from '../../types/stream';
18
+ declare class EngineService {
19
+ namespace: string;
20
+ apps: HotMeshApps | null;
21
+ appId: string;
22
+ guid: string;
23
+ store: StoreService<RedisClient, RedisMulti> | null;
24
+ stream: StreamService<RedisClient, RedisMulti> | null;
25
+ subscribe: SubService<RedisClient, RedisMulti> | null;
26
+ storeSignaler: StoreSignaler | null;
27
+ streamSignaler: StreamSignaler | null;
28
+ task: TaskService | null;
29
+ logger: ILogger;
30
+ cacheMode: CacheMode;
31
+ untilVersion: string | null;
32
+ jobCallbacks: Record<string, JobMessageCallback>;
33
+ reporting: boolean;
34
+ jobId: number;
35
+ static init(namespace: string, appId: string, guid: string, config: HotMeshConfig, logger: ILogger): Promise<EngineService>;
36
+ verifyEngineFields(config: HotMeshConfig): void;
37
+ initStoreChannel(store: RedisClient): Promise<void>;
38
+ initSubChannel(sub: RedisClient): Promise<void>;
39
+ initStreamChannel(stream: RedisClient): Promise<void>;
40
+ initStreamSignaler(config: HotMeshConfig): StreamSignaler;
41
+ getVID(vid?: AppVID): Promise<AppVID>;
42
+ setCacheMode(cacheMode: CacheMode, untilVersion: string): void;
43
+ routeToSubscribers(topic: string, message: JobOutput): Promise<void>;
44
+ processWebHooks(): Promise<void>;
45
+ processTimeHooks(): Promise<void>;
46
+ throttle(delayInMillis: number): Promise<void>;
47
+ initActivity(topic: string, data?: JobData, context?: JobState): Promise<Activity>;
48
+ getSchema(topic: string): Promise<[activityId: string, schema: ActivityType]>;
49
+ getSettings(): Promise<HotMeshSettings>;
50
+ isPrivate(topic: string): boolean;
51
+ plan(pathOrYAML: string): Promise<HotMeshManifest>;
52
+ deploy(pathOrYAML: string): Promise<HotMeshManifest>;
53
+ getStats(topic: string, query: JobStatsInput): Promise<StatsResponse>;
54
+ getIds(topic: string, query: JobStatsInput, queryFacets?: any[]): Promise<IdsResponse>;
55
+ resolveQuery(topic: string, query: JobStatsInput): Promise<GetStatsOptions>;
56
+ processStreamMessage(streamData: StreamDataResponse): Promise<void>;
57
+ execAdjacentParent(context: JobState, jobOutput: JobOutput): Promise<string>;
58
+ hasParentJob(context: JobState): boolean;
59
+ resolveError(metadata: JobMetadata): StreamError | undefined;
60
+ scrub(jobId: string): Promise<void>;
61
+ hook(topic: string, data: JobData): Promise<JobStatus | void>;
62
+ hookTime(jobId: string, activityId: string): Promise<JobStatus | void>;
63
+ hookAll(hookTopic: string, data: JobData, query: JobStatsInput, queryFacets?: string[]): Promise<string[]>;
64
+ pub(topic: string, data: JobData, context?: JobState): Promise<string>;
65
+ sub(topic: string, callback: JobMessageCallback): Promise<void>;
66
+ unsub(topic: string): Promise<void>;
67
+ psub(wild: string, callback: JobMessageCallback): Promise<void>;
68
+ punsub(wild: string): Promise<void>;
69
+ pubsub(topic: string, data: JobData, context?: JobState | null, timeout?: number): Promise<JobOutput>;
70
+ resolveOneTimeSubscription(context: JobState, jobOutput: JobOutput): Promise<void>;
71
+ getPublishesTopic(context: JobState): Promise<string>;
72
+ resolvePersistentSubscriptions(context: JobState, jobOutput: JobOutput): Promise<void>;
73
+ add(streamData: StreamData | StreamDataResponse): Promise<string>;
74
+ registerJobCallback(jobId: string, jobCallback: JobMessageCallback): void;
75
+ delistJobCallback(jobId: string): void;
76
+ hasOneTimeSubscription(context: JobState): boolean;
77
+ runJobCompletionTasks(context: JobState): Promise<void>;
78
+ getStatus(jobId: string): Promise<JobStatus>;
79
+ getState(topic: string, jobId: string): Promise<JobOutput>;
80
+ compress(terms: string[]): Promise<boolean>;
81
+ }
82
+ export { EngineService };