@hotmeshio/hotmesh 0.0.55 → 0.0.56

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 (181) hide show
  1. package/build/modules/enums.js +1 -10
  2. package/build/modules/key.d.ts +0 -38
  3. package/build/modules/key.js +4 -46
  4. package/build/modules/utils.d.ts +0 -8
  5. package/build/modules/utils.js +0 -14
  6. package/build/package.json +11 -4
  7. package/build/services/activities/activity.d.ts +0 -28
  8. package/build/services/activities/activity.js +1 -46
  9. package/build/services/activities/await.js +0 -4
  10. package/build/services/activities/cycle.d.ts +0 -7
  11. package/build/services/activities/cycle.js +1 -16
  12. package/build/services/activities/hook.d.ts +0 -6
  13. package/build/services/activities/hook.js +2 -12
  14. package/build/services/activities/interrupt.js +0 -8
  15. package/build/services/activities/signal.d.ts +0 -6
  16. package/build/services/activities/signal.js +0 -15
  17. package/build/services/activities/trigger.d.ts +0 -4
  18. package/build/services/activities/trigger.js +1 -7
  19. package/build/services/activities/worker.js +0 -4
  20. package/build/services/collator/index.d.ts +0 -70
  21. package/build/services/collator/index.js +1 -91
  22. package/build/services/compiler/deployer.js +6 -38
  23. package/build/services/compiler/index.d.ts +0 -15
  24. package/build/services/compiler/index.js +0 -20
  25. package/build/services/compiler/validator.d.ts +0 -3
  26. package/build/services/compiler/validator.js +0 -25
  27. package/build/services/connector/clients/ioredis.d.ts +2 -2
  28. package/build/services/connector/clients/ioredis.js +0 -2
  29. package/build/services/connector/clients/redis.d.ts +4 -4
  30. package/build/services/connector/clients/redis.js +1 -3
  31. package/build/services/connector/index.d.ts +1 -1
  32. package/build/services/connector/index.js +0 -2
  33. package/build/services/durable/client.d.ts +1 -26
  34. package/build/services/durable/client.js +0 -56
  35. package/build/services/durable/exporter.d.ts +0 -22
  36. package/build/services/durable/exporter.js +1 -30
  37. package/build/services/durable/handle.d.ts +0 -36
  38. package/build/services/durable/handle.js +0 -46
  39. package/build/services/durable/index.d.ts +0 -4
  40. package/build/services/durable/index.js +0 -4
  41. package/build/services/durable/schemas/factory.d.ts +0 -29
  42. package/build/services/durable/schemas/factory.js +0 -29
  43. package/build/services/durable/search.d.ts +1 -36
  44. package/build/services/durable/search.js +57 -56
  45. package/build/services/durable/worker.js +2 -22
  46. package/build/services/durable/workflow.d.ts +0 -114
  47. package/build/services/durable/workflow.js +1 -141
  48. package/build/services/engine/index.d.ts +1 -6
  49. package/build/services/engine/index.js +1 -43
  50. package/build/services/exporter/index.d.ts +0 -27
  51. package/build/services/exporter/index.js +0 -33
  52. package/build/services/hotmesh/index.d.ts +2 -2
  53. package/build/services/hotmesh/index.js +1 -9
  54. package/build/services/logger/index.js +0 -2
  55. package/build/services/mapper/index.d.ts +0 -14
  56. package/build/services/mapper/index.js +0 -14
  57. package/build/services/pipe/functions/date.d.ts +0 -7
  58. package/build/services/pipe/functions/date.js +0 -7
  59. package/build/services/pipe/functions/math.js +0 -2
  60. package/build/services/pipe/index.d.ts +0 -15
  61. package/build/services/pipe/index.js +2 -23
  62. package/build/services/quorum/index.d.ts +0 -7
  63. package/build/services/quorum/index.js +0 -21
  64. package/build/services/reporter/index.d.ts +0 -5
  65. package/build/services/reporter/index.js +0 -9
  66. package/build/services/router/index.d.ts +0 -9
  67. package/build/services/router/index.js +2 -38
  68. package/build/services/serializer/index.js +7 -26
  69. package/build/services/store/cache.d.ts +0 -18
  70. package/build/services/store/cache.js +0 -18
  71. package/build/services/store/clients/ioredis.d.ts +1 -1
  72. package/build/services/store/clients/ioredis.js +0 -1
  73. package/build/services/store/clients/redis.d.ts +1 -1
  74. package/build/services/store/index.d.ts +0 -55
  75. package/build/services/store/index.js +5 -81
  76. package/build/services/stream/clients/ioredis.d.ts +1 -1
  77. package/build/services/stream/clients/ioredis.js +1 -4
  78. package/build/services/stream/clients/redis.d.ts +1 -1
  79. package/build/services/sub/clients/ioredis.d.ts +1 -1
  80. package/build/services/sub/clients/redis.d.ts +1 -1
  81. package/build/services/task/index.d.ts +0 -9
  82. package/build/services/task/index.js +0 -31
  83. package/build/services/telemetry/index.d.ts +0 -7
  84. package/build/services/telemetry/index.js +1 -13
  85. package/build/services/worker/index.d.ts +0 -4
  86. package/build/services/worker/index.js +2 -6
  87. package/build/types/activity.d.ts +0 -81
  88. package/build/types/durable.d.ts +25 -177
  89. package/build/types/exporter.d.ts +0 -13
  90. package/build/types/hotmesh.d.ts +4 -16
  91. package/build/types/hotmesh.js +0 -3
  92. package/build/types/index.d.ts +4 -6
  93. package/build/types/index.js +4 -3
  94. package/build/types/job.d.ts +1 -86
  95. package/build/types/pipe.d.ts +0 -65
  96. package/build/types/quorum.d.ts +15 -10
  97. package/build/types/redis.d.ts +225 -7
  98. package/build/types/redis.js +9 -0
  99. package/build/types/stream.d.ts +0 -58
  100. package/build/types/stream.js +0 -4
  101. package/package.json +11 -4
  102. package/types/durable.ts +121 -3
  103. package/types/hotmesh.ts +3 -6
  104. package/types/index.ts +23 -10
  105. package/types/job.ts +1 -1
  106. package/types/quorum.ts +22 -0
  107. package/types/redis.ts +267 -18
  108. package/build/types/ioredisclient.d.ts +0 -5
  109. package/build/types/ioredisclient.js +0 -5
  110. package/build/types/redisclient.d.ts +0 -26
  111. package/build/types/redisclient.js +0 -2
  112. package/modules/enums.ts +0 -62
  113. package/modules/errors.ts +0 -280
  114. package/modules/key.ts +0 -101
  115. package/modules/storage.ts +0 -3
  116. package/modules/utils.ts +0 -242
  117. package/services/activities/activity.ts +0 -589
  118. package/services/activities/await.ts +0 -113
  119. package/services/activities/cycle.ts +0 -115
  120. package/services/activities/hook.ts +0 -197
  121. package/services/activities/index.ts +0 -19
  122. package/services/activities/interrupt.ts +0 -172
  123. package/services/activities/signal.ts +0 -148
  124. package/services/activities/trigger.ts +0 -295
  125. package/services/activities/worker.ts +0 -107
  126. package/services/collator/README.md +0 -102
  127. package/services/collator/index.ts +0 -291
  128. package/services/compiler/deployer.ts +0 -504
  129. package/services/compiler/index.ts +0 -98
  130. package/services/compiler/validator.ts +0 -158
  131. package/services/connector/clients/ioredis.ts +0 -57
  132. package/services/connector/clients/redis.ts +0 -72
  133. package/services/connector/index.ts +0 -42
  134. package/services/durable/client.ts +0 -266
  135. package/services/durable/connection.ts +0 -10
  136. package/services/durable/exporter.ts +0 -232
  137. package/services/durable/handle.ts +0 -160
  138. package/services/durable/index.ts +0 -27
  139. package/services/durable/schemas/factory.ts +0 -2358
  140. package/services/durable/search.ts +0 -196
  141. package/services/durable/worker.ts +0 -401
  142. package/services/durable/workflow.ts +0 -557
  143. package/services/engine/index.ts +0 -761
  144. package/services/exporter/index.ts +0 -146
  145. package/services/hotmesh/index.ts +0 -237
  146. package/services/logger/index.ts +0 -79
  147. package/services/mapper/index.ts +0 -89
  148. package/services/pipe/functions/array.ts +0 -78
  149. package/services/pipe/functions/bitwise.ts +0 -27
  150. package/services/pipe/functions/conditional.ts +0 -35
  151. package/services/pipe/functions/date.ts +0 -220
  152. package/services/pipe/functions/index.ts +0 -27
  153. package/services/pipe/functions/json.ts +0 -11
  154. package/services/pipe/functions/logical.ts +0 -11
  155. package/services/pipe/functions/math.ts +0 -217
  156. package/services/pipe/functions/number.ts +0 -75
  157. package/services/pipe/functions/object.ts +0 -98
  158. package/services/pipe/functions/string.ts +0 -86
  159. package/services/pipe/functions/symbol.ts +0 -39
  160. package/services/pipe/functions/unary.ts +0 -19
  161. package/services/pipe/index.ts +0 -216
  162. package/services/quorum/index.ts +0 -319
  163. package/services/reporter/index.ts +0 -387
  164. package/services/router/index.ts +0 -426
  165. package/services/serializer/README.md +0 -10
  166. package/services/serializer/index.ts +0 -285
  167. package/services/store/cache.ts +0 -172
  168. package/services/store/clients/ioredis.ts +0 -145
  169. package/services/store/clients/redis.ts +0 -191
  170. package/services/store/index.ts +0 -1091
  171. package/services/stream/clients/ioredis.ts +0 -157
  172. package/services/stream/clients/redis.ts +0 -158
  173. package/services/stream/index.ts +0 -58
  174. package/services/sub/clients/ioredis.ts +0 -83
  175. package/services/sub/clients/redis.ts +0 -74
  176. package/services/sub/index.ts +0 -25
  177. package/services/task/index.ts +0 -250
  178. package/services/telemetry/index.ts +0 -273
  179. package/services/worker/index.ts +0 -248
  180. package/types/ioredisclient.ts +0 -10
  181. package/types/redisclient.ts +0 -30
@@ -1,232 +0,0 @@
1
- import { restoreHierarchy } from '../../modules/utils';
2
- import { ILogger } from '../logger';
3
- import { SerializerService } from '../serializer';
4
- import { StoreService } from '../store';
5
- import {
6
- ExportOptions,
7
- DurableJobExport,
8
- TimelineType,
9
- TransitionType,
10
- ExportFields} from '../../types/exporter';
11
- import { RedisClient, RedisMulti } from '../../types/redis';
12
- import { StringAnyType, StringStringType, Symbols } from "../../types/serializer";
13
-
14
- class ExporterService {
15
- appId: string;
16
- logger: ILogger;
17
- store: StoreService<RedisClient, RedisMulti>;
18
- symbols: Promise<Symbols> | Symbols;
19
- private static symbols: Map<string, Symbols> = new Map();
20
-
21
- constructor(appId: string, store: StoreService<RedisClient, RedisMulti>, logger: ILogger) {
22
- this.appId = appId;
23
- this.logger = logger;
24
- this.store = store;
25
- }
26
-
27
- /**
28
- * Convert the job hash from its compiles format into a DurableJobExport object with
29
- * facets that describe the workflow in terms relevant to narrative storytelling.
30
- */
31
- async export(jobId: string, options: ExportOptions = {}): Promise<DurableJobExport> {
32
- if (!ExporterService.symbols.has(this.appId)) {
33
- const symbols: Symbols | Promise<Symbols> = this.store.getAllSymbols();
34
- ExporterService.symbols.set(this.appId, await symbols);
35
- }
36
- const jobData = await this.store.getRaw(jobId);
37
- const jobExport = this.inflate(jobData, options);
38
- return jobExport;
39
- }
40
-
41
- /**
42
- * Inflates the job data from Redis into a DurableJobExport object
43
- * @param jobHash - the job data from Redis
44
- * @param dependencyList - the list of dependencies for the job
45
- * @returns - the inflated job data
46
- */
47
- inflate(jobHash: StringStringType, options: ExportOptions): DurableJobExport {
48
- const timeline: TimelineType[] = [];
49
- const state: StringAnyType = {};
50
- const data: StringStringType = {};
51
- const transitionsObject: Record<string, TransitionType> = {};
52
- const regex = /^([a-zA-Z]{3}),(\d+(?:,\d+)*)/;
53
-
54
- Object.entries(jobHash).forEach(([key, value]) => {
55
- const match = key.match(regex);
56
-
57
- if (match) {
58
- //transitions
59
- this.inflateTransition(match, value, transitionsObject);
60
-
61
- } else if (key.length === 3) {
62
- //state
63
- state[this.inflateKey(key)] = SerializerService.fromString(value);
64
-
65
- } else if (key.startsWith('_')) {
66
- //data
67
- data[key.substring(1)] = value;
68
-
69
- } else if (key.startsWith('-')) {
70
- //timeline
71
- const keyParts = this.keyToObject(key); //key parts have meaning
72
- timeline.push({
73
- ...keyParts,
74
- key,
75
- value: this.resolveValue(value, options.values),
76
- });
77
- }
78
- });
79
-
80
- return this.filterFields({
81
- data: restoreHierarchy(data),
82
- state: Object.entries(restoreHierarchy(state))[0][1],
83
- status: parseInt(jobHash[':'], 10),
84
- timeline: this.sortParts(timeline),
85
- transitions: this.sortEntriesByCreated(transitionsObject),
86
- }, options.block, options.allow);
87
- }
88
-
89
- resolveValue(raw: string, withValues: boolean): Record<string, any> | string | number | null {
90
- const resolved = SerializerService.fromString(raw);
91
- if (withValues !== false) {
92
- return resolved;
93
- }
94
- if (resolved && typeof resolved === 'object') {
95
- if ('data' in resolved) {
96
- resolved.data = {};
97
- }
98
- if ('$error' in resolved) {
99
- resolved.$error = {};
100
- }
101
- }
102
- return resolved;
103
- }
104
-
105
- /**
106
- * Inflates the key from Redis, 3-character symbol
107
- * into a human-readable JSON path, reflecting the
108
- * tree-like structure of the unidimensional Hash
109
- * @private
110
- */
111
- inflateKey(key: string): string {
112
- const symbols = ExporterService.symbols.get(this.appId);
113
- if (key in symbols) {
114
- const path = symbols[key];
115
- const parts = path.split('/');
116
- return parts.join('/');
117
- }
118
- return key;
119
- }
120
-
121
- filterFields(fullObject: DurableJobExport, block: ExportFields[] = [], allow: ExportFields[] = []): Partial<DurableJobExport> {
122
- let result: Partial<DurableJobExport> = {};
123
- if (allow && allow.length > 0) {
124
- allow.forEach(field => {
125
- if (field in fullObject) {
126
- result[field] = fullObject[field] as StringAnyType & number & TimelineType[] & TransitionType[];
127
- }
128
- });
129
- } else {
130
- result = { ...fullObject };
131
- }
132
- if (block && block.length > 0) {
133
- block.forEach(field => {
134
- if (field in result) {
135
- delete result[field];
136
- }
137
- });
138
- }
139
- return result as DurableJobExport;
140
- }
141
-
142
- inflateTransition(match: RegExpMatchArray, value: string, transitionsObject: Record<string, TransitionType>) {
143
- const [_, letters, dimensions] = match;
144
- const path = this.inflateKey(letters);
145
- const parts = path.split('/');
146
- const activity = parts[0];
147
- const isCreate = path.endsWith('/output/metadata/ac');
148
- const isUpdate = path.endsWith('/output/metadata/au');
149
- //for now only export activity start/stop; activity data would also be interesting
150
- if (isCreate || isUpdate) {
151
- const targetName = `${activity},${dimensions}`;
152
- let target = transitionsObject[targetName];
153
- if (!target) {
154
- transitionsObject[targetName] = {
155
- activity,
156
- dimensions,
157
- created: isCreate ? value : null,
158
- updated: isUpdate ? value : null,
159
- };
160
- } else {
161
- target[isCreate ? 'created' : 'updated'] = value;
162
- }
163
- }
164
- }
165
-
166
- sortEntriesByCreated(obj: { [key: string]: TransitionType }): TransitionType[] {
167
- const entriesArray: TransitionType[] = Object.values(obj);
168
- entriesArray.sort((a, b) => {
169
- return (a.created || a.updated).localeCompare(b.created || b.updated);
170
- });
171
- return entriesArray;
172
- }
173
-
174
- /**
175
- * marker names are overloaded with details like sequence, type, etc
176
- */
177
- keyToObject(key: string): {index: number, dimension?: string, secondary?: number} {
178
- function extractDimension(label: string): string {
179
- const parts = label.split(',');
180
- if (parts.length > 1) {
181
- parts.shift();
182
- return parts.join(',');
183
- }
184
- }
185
- const parts = key.split('-');
186
- if (parts.length === 4) {
187
- //-proxy-5- -search-1-1-
188
- return {
189
- index: parseInt(parts[2], 10),
190
- dimension: extractDimension(parts[1]),
191
- }
192
- } else {
193
- //-search,0,0-1-1- -proxy,0,0-1-
194
- return {
195
- index: parseInt(parts[2], 10),
196
- secondary: parseInt(parts[3], 10),
197
- dimension: extractDimension(parts[1]),
198
- }
199
- }
200
- }
201
-
202
- /**
203
- * idem list has a complicated sort order based on indexes and dimensions
204
- */
205
- sortParts(parts: TimelineType[]): TimelineType[] {
206
- return parts.sort((a, b) => {
207
- const { dimension: aDim, index: aIdx, secondary: aSec } = a;
208
- const { dimension: bDim, index: bIdx, secondary: bSec } = b;
209
-
210
- if (aDim === undefined && bDim !== undefined) return -1;
211
- if (aDim !== undefined && bDim === undefined) return 1;
212
- if (aDim !== undefined && bDim !== undefined) {
213
- if (aDim < bDim) return -1;
214
- if (aDim > bDim) return 1;
215
- }
216
-
217
- if (aIdx < bIdx) return -1;
218
- if (aIdx > bIdx) return 1;
219
-
220
- if (aSec === undefined && bSec !== undefined) return -1;
221
- if (aSec !== undefined && bSec === undefined) return 1;
222
- if (aSec !== undefined && bSec !== undefined) {
223
- if (aSec < bSec) return -1;
224
- if (aSec > bSec) return 1;
225
- }
226
-
227
- return 0;
228
- });
229
- };
230
- }
231
-
232
- export { ExporterService };
@@ -1,160 +0,0 @@
1
- import { ExporterService } from './exporter';
2
- import { HotMeshService as HotMesh } from '../hotmesh';
3
- import { DurableJobExport, ExportOptions } from '../../types/exporter';
4
- import { JobInterruptOptions, JobOutput } from '../../types/job';
5
- import { StreamError } from '../../types/stream';
6
-
7
- export class WorkflowHandleService {
8
- exporter: ExporterService
9
- hotMesh: HotMesh;
10
- workflowTopic: string;
11
- workflowId: string;
12
-
13
- constructor(hotMesh: HotMesh, workflowTopic: string, workflowId: string) {
14
- this.workflowTopic = workflowTopic;
15
- this.workflowId = workflowId;
16
- this.hotMesh = hotMesh;
17
- this.exporter = new ExporterService(
18
- this.hotMesh.appId,
19
- this.hotMesh.engine.store,
20
- this.hotMesh.engine.logger,
21
- );
22
- }
23
-
24
- async export(options?: ExportOptions): Promise<DurableJobExport> {
25
- return this.exporter.export(this.workflowId, options);
26
- }
27
-
28
- /**
29
- * Sends a signal to the workflow. This is a way to send
30
- * a message to a workflow that is paused due to having
31
- * executed `Durable.workflow.waitFor`. The workflow
32
- * will awaken if no other signals are pending.
33
- */
34
- async signal(signalId: string, data: Record<any, any>): Promise<void> {
35
- await this.hotMesh.hook(`${this.hotMesh.appId}.wfs.signal`, { id: signalId, data });
36
- }
37
-
38
- /**
39
- * Returns the job state of the workflow. If the workflow has completed
40
- * this is also the job output. If the workflow is still running, this
41
- * is the current state of the job, but it may change depending upon
42
- * the activities that remain.
43
- */
44
- async state(metadata = false): Promise<Record<string, any>> {
45
- const state = await this.hotMesh.getState(`${this.hotMesh.appId}.execute`, this.workflowId);
46
- if (!state.data && state.metadata.err) {
47
- throw new Error(JSON.parse(state.metadata.err));
48
- }
49
- return metadata ? state : state.data;
50
- }
51
-
52
- /**
53
- * Returns the current search state of the workflow. This is
54
- * different than the job state or individual activity state.
55
- * Search state represents name/value pairs that were added
56
- * to the workflow. As the workflow is stored in a Redis hash,
57
- * this is a way to store additional data that is indexed
58
- * and searchable using the RediSearch module.
59
- */
60
- async queryState(fields: string[]): Promise<Record<string, any>> {
61
- return await this.hotMesh.getQueryState(this.workflowId, fields);
62
- }
63
-
64
- /**
65
- * Returns the current status of the workflow. This is a semaphore
66
- * value that represents the current state of the workflow, where
67
- * 0 is complete and a negative value represents that the flow was
68
- * interrupted.
69
- */
70
- async status(): Promise<number> {
71
- return await this.hotMesh.getStatus(this.workflowId);
72
- }
73
-
74
- /**
75
- * Interrupts a running workflow. Standard Job Completion tasks will
76
- * run. Subscribers will be notified and the job hash will be expired.
77
- */
78
- async interrupt(options?: JobInterruptOptions): Promise<string> {
79
- return await this.hotMesh.interrupt(`${this.hotMesh.appId}.execute`, this.workflowId, options);
80
- }
81
-
82
- /**
83
- * Waits for the workflow to complete and returns the result. If
84
- * the workflow response includes an error, this method will rethrow
85
- * the error, including the stack trace if available.
86
- * Wrap calls in a try/catch as necessary to avoid unhandled exceptions.
87
- */
88
- async result<T>(config?: {state?: boolean, throwOnError?: boolean}): Promise<T | StreamError> {
89
- const topic = `${this.hotMesh.appId}.executed.${this.workflowId}`;
90
- let isResolved = false;
91
-
92
- return new Promise(async (resolve, reject) => {
93
-
94
- /**
95
- * rejects/resolves the promise based on the `throwOnError`
96
- * default behavior is to throw if error
97
- */
98
- const safeReject = (err: StreamError) => {
99
- if (config?.throwOnError === false) {
100
- return resolve(err);
101
- }
102
- reject(err);
103
- };
104
-
105
- /**
106
- * Common completion function that unsubscribes from the topic/returns
107
- */
108
- const complete = async (response?: T, err?: StreamError) => {
109
- if (isResolved) return;
110
- isResolved = true;
111
-
112
- if (err) {
113
- return safeReject(err as StreamError);
114
- } else if (!response) {
115
- const state = await this.hotMesh.getState(`${this.hotMesh.appId}.execute`, this.workflowId);
116
- if (state.data?.done && !state.data?.$error) {
117
- return resolve(state.data.response as T);
118
- } else if (state.data?.$error) {
119
- return safeReject(state.data.$error as StreamError)
120
- } else if (state.metadata.err) {
121
- return safeReject(JSON.parse(state.metadata.err) as StreamError);
122
- }
123
- response = state.data?.response as T;
124
- }
125
- resolve(response as T);
126
- };
127
-
128
- //more expensive; fetches the entire job, not just the `status`
129
- if (config?.state) {
130
- const state = await this.hotMesh.getState(`${this.hotMesh.appId}.execute`, this.workflowId);
131
- if (state?.data?.done && !state.data?.$error) {
132
- return complete(state.data.response as T);
133
- } else if (state.data?.$error) {
134
- return complete(null, state.data.$error as StreamError);
135
- } else if (state.metadata.err) {
136
- return complete(null, JSON.parse(state.metadata.err) as StreamError);
137
- }
138
- }
139
-
140
- //subscribe to 'done' topic
141
- this.hotMesh.sub(topic, async (_topic: string, state: JobOutput) => {
142
- this.hotMesh.unsub(topic);
143
- if (state.data.done && !state.data?.$error) {
144
- await complete(state.data?.response as T);
145
- } else if (state.data?.$error) {
146
- return complete(null, state.data.$error as StreamError)
147
- } else if (state.metadata.err) {
148
- const error = JSON.parse(state.metadata.err) as StreamError;
149
- return await complete(null, error);
150
- }
151
- });
152
-
153
- //check state in case completed during wiring
154
- const status = await this.hotMesh.getStatus(this.workflowId);
155
- if (status <= 0) {
156
- await complete();
157
- }
158
- });
159
- }
160
- }
@@ -1,27 +0,0 @@
1
- import { ClientService } from './client';
2
- import { ConnectionService } from './connection';
3
- import { Search } from './search';
4
- import { WorkerService } from './worker';
5
- import { WorkflowService } from './workflow';
6
- import { HotMeshService } from '../hotmesh';
7
- import { ContextType } from '../../types/durable';
8
-
9
- export const Durable = {
10
- Client: ClientService,
11
- Connection: ConnectionService,
12
- Search,
13
- Worker: WorkerService,
14
- workflow: WorkflowService,
15
-
16
- /**
17
- * Shutdown everything. All connections, workers, and clients will be closed.
18
- * Include in your signal handlers to ensure a clean shutdown.
19
- */
20
- async shutdown(): Promise<void> {
21
- await ClientService.shutdown();
22
- await WorkerService.shutdown();
23
- await HotMeshService.stop();
24
- }
25
- };
26
-
27
- export type { ContextType };