@hotmeshio/hotmesh 0.9.0 → 0.10.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.
Files changed (96) hide show
  1. package/README.md +38 -23
  2. package/build/index.d.ts +12 -11
  3. package/build/index.js +15 -13
  4. package/build/modules/enums.d.ts +23 -34
  5. package/build/modules/enums.js +26 -38
  6. package/build/modules/errors.d.ts +16 -16
  7. package/build/modules/errors.js +37 -37
  8. package/build/package.json +23 -22
  9. package/build/services/activities/activity.js +1 -1
  10. package/build/services/dba/index.d.ts +171 -0
  11. package/build/services/dba/index.js +280 -0
  12. package/build/services/{memflow → durable}/client.d.ts +3 -3
  13. package/build/services/{memflow → durable}/client.js +13 -13
  14. package/build/services/{memflow → durable}/connection.d.ts +2 -2
  15. package/build/services/{memflow → durable}/connection.js +1 -1
  16. package/build/services/{memflow → durable}/exporter.d.ts +6 -6
  17. package/build/services/{memflow → durable}/exporter.js +2 -2
  18. package/build/services/{memflow → durable}/handle.d.ts +4 -4
  19. package/build/services/{memflow → durable}/handle.js +2 -2
  20. package/build/services/{memflow → durable}/index.d.ts +125 -33
  21. package/build/services/{memflow → durable}/index.js +145 -49
  22. package/build/services/{memflow → durable}/interceptor.d.ts +45 -22
  23. package/build/services/{memflow → durable}/interceptor.js +54 -21
  24. package/build/services/{memflow → durable}/schemas/factory.d.ts +4 -4
  25. package/build/services/{memflow → durable}/schemas/factory.js +5 -5
  26. package/build/services/{memflow → durable}/search.d.ts +1 -1
  27. package/build/services/{memflow → durable}/search.js +4 -4
  28. package/build/services/{memflow → durable}/worker.d.ts +11 -11
  29. package/build/services/{memflow → durable}/worker.js +61 -60
  30. package/build/services/{memflow → durable}/workflow/all.d.ts +5 -5
  31. package/build/services/{memflow → durable}/workflow/all.js +5 -5
  32. package/build/services/{memflow → durable}/workflow/common.d.ts +5 -5
  33. package/build/services/durable/workflow/common.js +47 -0
  34. package/build/services/{memflow → durable}/workflow/context.d.ts +5 -5
  35. package/build/services/{memflow → durable}/workflow/context.js +5 -5
  36. package/build/services/{memflow → durable}/workflow/emit.d.ts +5 -5
  37. package/build/services/{memflow → durable}/workflow/emit.js +5 -5
  38. package/build/services/{memflow → durable}/workflow/enrich.d.ts +4 -4
  39. package/build/services/{memflow → durable}/workflow/enrich.js +4 -4
  40. package/build/services/{memflow → durable}/workflow/entityMethods.d.ts +4 -4
  41. package/build/services/{memflow → durable}/workflow/entityMethods.js +4 -4
  42. package/build/services/{memflow → durable}/workflow/execChild.d.ts +9 -9
  43. package/build/services/{memflow → durable}/workflow/execChild.js +22 -22
  44. package/build/services/{memflow → durable}/workflow/execHook.d.ts +8 -8
  45. package/build/services/{memflow → durable}/workflow/execHook.js +10 -10
  46. package/build/services/{memflow → durable}/workflow/execHookBatch.d.ts +5 -5
  47. package/build/services/{memflow → durable}/workflow/execHookBatch.js +8 -8
  48. package/build/services/{memflow → durable}/workflow/hook.d.ts +5 -5
  49. package/build/services/{memflow → durable}/workflow/hook.js +11 -11
  50. package/build/services/{memflow → durable}/workflow/index.d.ts +6 -6
  51. package/build/services/{memflow → durable}/workflow/index.js +6 -6
  52. package/build/services/{memflow → durable}/workflow/interrupt.d.ts +7 -7
  53. package/build/services/{memflow → durable}/workflow/interrupt.js +7 -7
  54. package/build/services/{memflow → durable}/workflow/interruption.d.ts +10 -10
  55. package/build/services/{memflow → durable}/workflow/interruption.js +19 -19
  56. package/build/services/{memflow → durable}/workflow/proxyActivities.d.ts +7 -7
  57. package/build/services/{memflow → durable}/workflow/proxyActivities.js +31 -21
  58. package/build/services/{memflow → durable}/workflow/random.d.ts +4 -4
  59. package/build/services/{memflow → durable}/workflow/random.js +4 -4
  60. package/build/services/{memflow → durable}/workflow/searchMethods.d.ts +5 -5
  61. package/build/services/{memflow → durable}/workflow/searchMethods.js +5 -5
  62. package/build/services/{memflow → durable}/workflow/signal.d.ts +8 -8
  63. package/build/services/{memflow → durable}/workflow/signal.js +8 -8
  64. package/build/services/{memflow → durable}/workflow/sleepFor.d.ts +7 -7
  65. package/build/services/{memflow → durable}/workflow/sleepFor.js +10 -10
  66. package/build/services/{memflow → durable}/workflow/trace.d.ts +5 -5
  67. package/build/services/{memflow → durable}/workflow/trace.js +5 -5
  68. package/build/services/{memflow → durable}/workflow/waitFor.d.ts +9 -9
  69. package/build/services/{memflow → durable}/workflow/waitFor.js +12 -12
  70. package/build/services/hotmesh/index.d.ts +3 -3
  71. package/build/services/hotmesh/index.js +3 -3
  72. package/build/services/{meshcall → virtual}/index.d.ts +29 -29
  73. package/build/services/{meshcall → virtual}/index.js +49 -49
  74. package/build/services/{meshcall → virtual}/schemas/factory.d.ts +1 -1
  75. package/build/services/{meshcall → virtual}/schemas/factory.js +1 -1
  76. package/build/types/dba.d.ts +64 -0
  77. package/build/types/{memflow.d.ts → durable.d.ts} +74 -18
  78. package/build/types/error.d.ts +5 -5
  79. package/build/types/exporter.d.ts +1 -1
  80. package/build/types/index.d.ts +5 -4
  81. package/build/types/{meshcall.d.ts → virtual.d.ts} +15 -15
  82. package/build/types/virtual.js +2 -0
  83. package/index.ts +15 -13
  84. package/package.json +23 -22
  85. package/.claude/settings.local.json +0 -8
  86. package/build/services/memflow/workflow/common.js +0 -47
  87. package/build/vitest.config.d.ts +0 -2
  88. package/build/vitest.config.js +0 -18
  89. /package/build/services/{memflow → durable}/entity.d.ts +0 -0
  90. /package/build/services/{memflow → durable}/entity.js +0 -0
  91. /package/build/services/{memflow → durable}/workflow/didRun.d.ts +0 -0
  92. /package/build/services/{memflow → durable}/workflow/didRun.js +0 -0
  93. /package/build/services/{memflow → durable}/workflow/isSideEffectAllowed.d.ts +0 -0
  94. /package/build/services/{memflow → durable}/workflow/isSideEffectAllowed.js +0 -0
  95. /package/build/types/{memflow.js → dba.js} +0 -0
  96. /package/build/types/{meshcall.js → durable.js} +0 -0
@@ -17,12 +17,12 @@ const index_1 = require("./index");
17
17
  *
18
18
  * @example
19
19
  * ```typescript
20
- * import { MemFlow } from '@hotmeshio/hotmesh';
20
+ * import { Durable } from '@hotmeshio/hotmesh';
21
21
  * import { Client as Postgres } from 'pg';
22
22
  * import * as workflows from './workflows';
23
23
  *
24
24
  * async function run() {
25
- * const worker = await MemFlow.Worker.create({
25
+ * const worker = await Durable.Worker.create({
26
26
  * connection: {
27
27
  * class: Postgres,
28
28
  * options: { connectionString: 'postgres://user:password@localhost:5432/db' }
@@ -68,7 +68,7 @@ class WorkerService {
68
68
  await hotMesh.activate(factory_1.APP_VERSION);
69
69
  }
70
70
  catch (err) {
71
- hotMesh.engine.logger.error('memflow-worker-deploy-activate-err', err);
71
+ hotMesh.engine.logger.error('durable-worker-deploy-activate-err', err);
72
72
  throw err;
73
73
  }
74
74
  }
@@ -77,7 +77,7 @@ class WorkerService {
77
77
  await hotMesh.activate(factory_1.APP_VERSION);
78
78
  }
79
79
  catch (err) {
80
- hotMesh.engine.logger.error('memflow-worker-activate-err', err);
80
+ hotMesh.engine.logger.error('durable-worker-activate-err', err);
81
81
  throw err;
82
82
  }
83
83
  }
@@ -121,7 +121,7 @@ class WorkerService {
121
121
  * @example
122
122
  * ```typescript
123
123
  * // Activity worker (can be on separate server)
124
- * import { MemFlow } from '@hotmeshio/hotmesh';
124
+ * import { Durable } from '@hotmeshio/hotmesh';
125
125
  * import { Client as Postgres } from 'pg';
126
126
  *
127
127
  * const activities = {
@@ -133,7 +133,7 @@ class WorkerService {
133
133
  * }
134
134
  * };
135
135
  *
136
- * await MemFlow.registerActivityWorker({
136
+ * await Durable.registerActivityWorker({
137
137
  * connection: {
138
138
  * class: Postgres,
139
139
  * options: { connectionString: 'postgresql://usr:pwd@localhost:5432/db' }
@@ -146,7 +146,7 @@ class WorkerService {
146
146
  * ```typescript
147
147
  * // Workflow worker (can be on different server)
148
148
  * async function orderWorkflow(orderId: string, amount: number) {
149
- * const { processPayment, sendEmail } = MemFlow.workflow.proxyActivities<{
149
+ * const { processPayment, sendEmail } = Durable.workflow.proxyActivities<{
150
150
  * processPayment: (amount: number) => Promise<string>;
151
151
  * sendEmail: (to: string, subject: string) => Promise<void>;
152
152
  * }>({
@@ -159,7 +159,7 @@ class WorkerService {
159
159
  * return result;
160
160
  * }
161
161
  *
162
- * await MemFlow.Worker.create({
162
+ * await Durable.Worker.create({
163
163
  * connection: {
164
164
  * class: Postgres,
165
165
  * options: { connectionString: 'postgresql://usr:pwd@localhost:5432/db' }
@@ -172,7 +172,7 @@ class WorkerService {
172
172
  * @example
173
173
  * ```typescript
174
174
  * // Shared activity pool for interceptors
175
- * await MemFlow.registerActivityWorker({
175
+ * await Durable.registerActivityWorker({
176
176
  * connection: {
177
177
  * class: Postgres,
178
178
  * options: { connectionString: 'postgresql://usr:pwd@localhost:5432/db' }
@@ -182,7 +182,7 @@ class WorkerService {
182
182
  *
183
183
  * const interceptor: WorkflowInterceptor = {
184
184
  * async execute(ctx, next) {
185
- * const { auditLog } = MemFlow.workflow.proxyActivities<{
185
+ * const { auditLog } = Durable.workflow.proxyActivities<{
186
186
  * auditLog: (id: string, action: string) => Promise<void>;
187
187
  * }>({
188
188
  * taskQueue: 'shared',
@@ -198,7 +198,7 @@ class WorkerService {
198
198
  // Register activities globally in the registry
199
199
  WorkerService.registerActivities(activities);
200
200
  // Use provided activityTaskQueue or fall back to config.taskQueue
201
- const taskQueue = activityTaskQueue || config.taskQueue || 'memflow-activities';
201
+ const taskQueue = activityTaskQueue || config.taskQueue || 'durable-activities';
202
202
  // Append '-activity' suffix for the worker topic
203
203
  const activityTopic = `${taskQueue}-activity`;
204
204
  const targetNamespace = config?.namespace ?? factory_1.APP_ID;
@@ -249,14 +249,14 @@ class WorkerService {
249
249
  }
250
250
  catch (err) {
251
251
  // Log error (note: we don't have access to this.activityRunner here)
252
- console.error('memflow-worker-activity-err', {
252
+ console.error('durable-worker-activity-err', {
253
253
  name: err.name,
254
254
  message: err.message,
255
255
  stack: err.stack,
256
256
  });
257
- if (!(err instanceof errors_1.MemFlowTimeoutError) &&
258
- !(err instanceof errors_1.MemFlowMaxedError) &&
259
- !(err instanceof errors_1.MemFlowFatalError)) {
257
+ if (!(err instanceof errors_1.DurableTimeoutError) &&
258
+ !(err instanceof errors_1.DurableMaxedError) &&
259
+ !(err instanceof errors_1.DurableFatalError)) {
260
260
  //use code 599 as a proxy for all retryable errors
261
261
  // (basically anything not 596, 597, 598)
262
262
  return {
@@ -267,12 +267,12 @@ class WorkerService {
267
267
  $error: {
268
268
  message: err.message,
269
269
  stack: err.stack,
270
- code: enums_1.HMSH_CODE_MEMFLOW_RETRYABLE,
270
+ code: enums_1.HMSH_CODE_DURABLE_RETRYABLE,
271
271
  },
272
272
  },
273
273
  };
274
274
  }
275
- else if (err instanceof errors_1.MemFlowTimeoutError) {
275
+ else if (err instanceof errors_1.DurableTimeoutError) {
276
276
  return {
277
277
  status: stream_1.StreamStatus.SUCCESS,
278
278
  code: 596,
@@ -281,12 +281,12 @@ class WorkerService {
281
281
  $error: {
282
282
  message: err.message,
283
283
  stack: err.stack,
284
- code: enums_1.HMSH_CODE_MEMFLOW_TIMEOUT,
284
+ code: enums_1.HMSH_CODE_DURABLE_TIMEOUT,
285
285
  },
286
286
  },
287
287
  };
288
288
  }
289
- else if (err instanceof errors_1.MemFlowMaxedError) {
289
+ else if (err instanceof errors_1.DurableMaxedError) {
290
290
  return {
291
291
  status: stream_1.StreamStatus.SUCCESS,
292
292
  code: 597,
@@ -295,12 +295,12 @@ class WorkerService {
295
295
  $error: {
296
296
  message: err.message,
297
297
  stack: err.stack,
298
- code: enums_1.HMSH_CODE_MEMFLOW_MAXED,
298
+ code: enums_1.HMSH_CODE_DURABLE_MAXED,
299
299
  },
300
300
  },
301
301
  };
302
302
  }
303
- else if (err instanceof errors_1.MemFlowFatalError) {
303
+ else if (err instanceof errors_1.DurableFatalError) {
304
304
  return {
305
305
  status: stream_1.StreamStatus.SUCCESS,
306
306
  code: 598,
@@ -309,7 +309,7 @@ class WorkerService {
309
309
  $error: {
310
310
  message: err.message,
311
311
  stack: err.stack,
312
- code: enums_1.HMSH_CODE_MEMFLOW_FATAL,
312
+ code: enums_1.HMSH_CODE_DURABLE_FATAL,
313
313
  },
314
314
  },
315
315
  };
@@ -322,12 +322,12 @@ class WorkerService {
322
322
  *
323
323
  * @example
324
324
  * ```typescript
325
- * import { MemFlow } from '@hotmeshio/hotmesh';
325
+ * import { Durable } from '@hotmeshio/hotmesh';
326
326
  * import { Client as Postgres } from 'pg';
327
327
  * import * as workflows from './workflows';
328
328
  *
329
329
  * async function run() {
330
- * const worker = await MemFlow.Worker.create({
330
+ * const worker = await Durable.Worker.create({
331
331
  * connection: {
332
332
  * class: Postgres,
333
333
  * options: {
@@ -376,7 +376,7 @@ class WorkerService {
376
376
  * Run the connected worker; no-op (unnecessary to call)
377
377
  */
378
378
  async run() {
379
- this.workflowRunner.engine.logger.info('memflow-worker-running');
379
+ this.workflowRunner.engine.logger.info('durable-worker-running');
380
380
  }
381
381
  /**
382
382
  * @private
@@ -425,19 +425,19 @@ class WorkerService {
425
425
  };
426
426
  }
427
427
  catch (err) {
428
- this.activityRunner.engine.logger.error('memflow-worker-activity-err', {
428
+ this.activityRunner.engine.logger.error('durable-worker-activity-err', {
429
429
  name: err.name,
430
430
  message: err.message,
431
431
  stack: err.stack,
432
432
  });
433
- if (!(err instanceof errors_1.MemFlowTimeoutError) &&
434
- !(err instanceof errors_1.MemFlowMaxedError) &&
435
- !(err instanceof errors_1.MemFlowFatalError)) {
433
+ if (!(err instanceof errors_1.DurableTimeoutError) &&
434
+ !(err instanceof errors_1.DurableMaxedError) &&
435
+ !(err instanceof errors_1.DurableFatalError)) {
436
436
  //use code 599 as a proxy for all retryable errors
437
437
  // (basically anything not 596, 597, 598)
438
438
  return {
439
439
  status: stream_1.StreamStatus.SUCCESS,
440
- code: enums_1.HMSH_CODE_MEMFLOW_RETRYABLE,
440
+ code: enums_1.HMSH_CODE_DURABLE_RETRYABLE,
441
441
  metadata: { ...data.metadata },
442
442
  data: {
443
443
  $error: {
@@ -449,7 +449,7 @@ class WorkerService {
449
449
  };
450
450
  }
451
451
  return {
452
- //always returrn success (the MemFlow module is just fine);
452
+ //always returrn success (the Durable module is just fine);
453
453
  // it's the user's function that has failed
454
454
  status: stream_1.StreamStatus.SUCCESS,
455
455
  code: err.code,
@@ -539,10 +539,11 @@ class WorkerService {
539
539
  const [cursor, replay] = await store.findJobFields(workflowInput.workflowId, replayQuery, 50000, 5000);
540
540
  context.set('replay', replay);
541
541
  context.set('cursor', cursor); // if != 0, more remain
542
+ context.set('activityInterceptorService', index_1.Durable.getInterceptorService());
542
543
  // Execute workflow with interceptors
543
544
  const workflowResponse = await storage_1.asyncLocalStorage.run(context, async () => {
544
545
  // Get the interceptor service
545
- const interceptorService = index_1.MemFlow.getInterceptorService();
546
+ const interceptorService = index_1.Durable.getInterceptorService();
546
547
  // Create the workflow execution function
547
548
  const execWorkflow = async () => {
548
549
  return await workflowFunction.apply(this, workflowInput.arguments);
@@ -555,24 +556,24 @@ class WorkerService {
555
556
  if (interruptionRegistry.length > 0) {
556
557
  const payload = interruptionRegistry[0];
557
558
  switch (payload.type) {
558
- case 'MemFlowWaitForError':
559
- throw new errors_1.MemFlowWaitForError(payload);
560
- case 'MemFlowProxyError':
561
- throw new errors_1.MemFlowProxyError(payload);
562
- case 'MemFlowChildError':
563
- throw new errors_1.MemFlowChildError(payload);
564
- case 'MemFlowSleepError':
565
- throw new errors_1.MemFlowSleepError(payload);
566
- case 'MemFlowTimeoutError':
567
- throw new errors_1.MemFlowTimeoutError(payload.message, payload.stack);
568
- case 'MemFlowMaxedError':
569
- throw new errors_1.MemFlowMaxedError(payload.message, payload.stack);
570
- case 'MemFlowFatalError':
571
- throw new errors_1.MemFlowFatalError(payload.message, payload.stack);
572
- case 'MemFlowRetryError':
573
- throw new errors_1.MemFlowRetryError(payload.message, payload.stack);
559
+ case 'DurableWaitForError':
560
+ throw new errors_1.DurableWaitForError(payload);
561
+ case 'DurableProxyError':
562
+ throw new errors_1.DurableProxyError(payload);
563
+ case 'DurableChildError':
564
+ throw new errors_1.DurableChildError(payload);
565
+ case 'DurableSleepError':
566
+ throw new errors_1.DurableSleepError(payload);
567
+ case 'DurableTimeoutError':
568
+ throw new errors_1.DurableTimeoutError(payload.message, payload.stack);
569
+ case 'DurableMaxedError':
570
+ throw new errors_1.DurableMaxedError(payload.message, payload.stack);
571
+ case 'DurableFatalError':
572
+ throw new errors_1.DurableFatalError(payload.message, payload.stack);
573
+ case 'DurableRetryError':
574
+ throw new errors_1.DurableRetryError(payload.message, payload.stack);
574
575
  default:
575
- throw new errors_1.MemFlowRetryError(`Unknown interruption type: ${payload.type}`);
576
+ throw new errors_1.DurableRetryError(`Unknown interruption type: ${payload.type}`);
576
577
  }
577
578
  }
578
579
  return {
@@ -586,7 +587,7 @@ class WorkerService {
586
587
  if (isProcessing) {
587
588
  return;
588
589
  }
589
- if (err instanceof errors_1.MemFlowWaitForError ||
590
+ if (err instanceof errors_1.DurableWaitForError ||
590
591
  interruptionRegistry.length > 1) {
591
592
  isProcessing = true;
592
593
  //NOTE: this type is spawned when `Promise.all` is used OR if the interruption is a `waitFor`
@@ -596,10 +597,10 @@ class WorkerService {
596
597
  const collatorFlowId = `${(0, utils_1.guid)()}$C`;
597
598
  return {
598
599
  status: stream_1.StreamStatus.SUCCESS,
599
- code: enums_1.HMSH_CODE_MEMFLOW_ALL,
600
+ code: enums_1.HMSH_CODE_DURABLE_ALL,
600
601
  metadata: { ...data.metadata },
601
602
  data: {
602
- code: enums_1.HMSH_CODE_MEMFLOW_ALL,
603
+ code: enums_1.HMSH_CODE_DURABLE_ALL,
603
604
  items: [...interruptionRegistry],
604
605
  size: interruptionRegistry.length,
605
606
  workflowDimension: workflowDimension || '',
@@ -612,7 +613,7 @@ class WorkerService {
612
613
  },
613
614
  };
614
615
  }
615
- else if (err instanceof errors_1.MemFlowSleepError) {
616
+ else if (err instanceof errors_1.DurableSleepError) {
616
617
  //return the sleep interruption
617
618
  isProcessing = true;
618
619
  return {
@@ -632,7 +633,7 @@ class WorkerService {
632
633
  },
633
634
  };
634
635
  }
635
- else if (err instanceof errors_1.MemFlowProxyError) {
636
+ else if (err instanceof errors_1.DurableProxyError) {
636
637
  //return the proxyActivity interruption
637
638
  isProcessing = true;
638
639
  return {
@@ -662,7 +663,7 @@ class WorkerService {
662
663
  },
663
664
  };
664
665
  }
665
- else if (err instanceof errors_1.MemFlowChildError) {
666
+ else if (err instanceof errors_1.DurableChildError) {
666
667
  //return the child interruption
667
668
  isProcessing = true;
668
669
  const msg = {
@@ -677,12 +678,12 @@ class WorkerService {
677
678
  data: {
678
679
  arguments: err.arguments,
679
680
  await: err.await,
680
- backoffCoefficient: err.backoffCoefficient || enums_1.HMSH_MEMFLOW_EXP_BACKOFF,
681
+ backoffCoefficient: err.backoffCoefficient || enums_1.HMSH_DURABLE_EXP_BACKOFF,
681
682
  code: err.code,
682
683
  index: err.index,
683
684
  message: JSON.stringify(msg),
684
- maximumAttempts: err.maximumAttempts || enums_1.HMSH_MEMFLOW_MAX_ATTEMPTS,
685
- maximumInterval: err.maximumInterval || (0, utils_1.s)(enums_1.HMSH_MEMFLOW_MAX_INTERVAL),
685
+ maximumAttempts: err.maximumAttempts || enums_1.HMSH_DURABLE_MAX_ATTEMPTS,
686
+ maximumInterval: err.maximumInterval || (0, utils_1.s)(enums_1.HMSH_DURABLE_MAX_INTERVAL),
686
687
  originJobId: err.originJobId,
687
688
  entity: err.entity,
688
689
  parentWorkflowId: err.parentWorkflowId,
@@ -700,7 +701,7 @@ class WorkerService {
700
701
  isProcessing = true;
701
702
  return {
702
703
  status: stream_1.StreamStatus.SUCCESS,
703
- code: err.code || new errors_1.MemFlowRetryError(err.message).code,
704
+ code: err.code || new errors_1.DurableRetryError(err.message).code,
704
705
  metadata: { ...data.metadata },
705
706
  data: {
706
707
  $error: {
@@ -708,7 +709,7 @@ class WorkerService {
708
709
  type: err.name,
709
710
  name: err.name,
710
711
  stack: err.stack,
711
- code: err.code || new errors_1.MemFlowRetryError(err.message).code,
712
+ code: err.code || new errors_1.DurableRetryError(err.message).code,
712
713
  },
713
714
  },
714
715
  };
@@ -4,20 +4,20 @@
4
4
  * deterministic execution counter. Use this when you need to run
5
5
  * multiple durable operations concurrently within a workflow function.
6
6
  *
7
- * In most cases, standard `Promise.all` works correctly for MemFlow
8
- * operations (e.g., parallel `waitFor` calls). Use `MemFlow.workflow.all`
7
+ * In most cases, standard `Promise.all` works correctly for Durable
8
+ * operations (e.g., parallel `waitFor` calls). Use `Durable.workflow.all`
9
9
  * when you observe counter-sequencing issues with complex parallel
10
10
  * patterns.
11
11
  *
12
12
  * ## Example
13
13
  *
14
14
  * ```typescript
15
- * import { MemFlow } from '@hotmeshio/hotmesh';
15
+ * import { Durable } from '@hotmeshio/hotmesh';
16
16
  *
17
17
  * export async function parallelWorkflow(): Promise<[string, number]> {
18
- * const { fetchName, fetchScore } = MemFlow.workflow.proxyActivities<typeof activities>();
18
+ * const { fetchName, fetchScore } = Durable.workflow.proxyActivities<typeof activities>();
19
19
  *
20
- * const [name, score] = await MemFlow.workflow.all(
20
+ * const [name, score] = await Durable.workflow.all(
21
21
  * fetchName('user-1'),
22
22
  * fetchScore('user-1'),
23
23
  * );
@@ -7,20 +7,20 @@ exports.all = void 0;
7
7
  * deterministic execution counter. Use this when you need to run
8
8
  * multiple durable operations concurrently within a workflow function.
9
9
  *
10
- * In most cases, standard `Promise.all` works correctly for MemFlow
11
- * operations (e.g., parallel `waitFor` calls). Use `MemFlow.workflow.all`
10
+ * In most cases, standard `Promise.all` works correctly for Durable
11
+ * operations (e.g., parallel `waitFor` calls). Use `Durable.workflow.all`
12
12
  * when you observe counter-sequencing issues with complex parallel
13
13
  * patterns.
14
14
  *
15
15
  * ## Example
16
16
  *
17
17
  * ```typescript
18
- * import { MemFlow } from '@hotmeshio/hotmesh';
18
+ * import { Durable } from '@hotmeshio/hotmesh';
19
19
  *
20
20
  * export async function parallelWorkflow(): Promise<[string, number]> {
21
- * const { fetchName, fetchScore } = MemFlow.workflow.proxyActivities<typeof activities>();
21
+ * const { fetchName, fetchScore } = Durable.workflow.proxyActivities<typeof activities>();
22
22
  *
23
- * const [name, score] = await MemFlow.workflow.all(
23
+ * const [name, score] = await Durable.workflow.all(
24
24
  * fetchName('user-1'),
25
25
  * fetchScore('user-1'),
26
26
  * );
@@ -1,15 +1,15 @@
1
- import { MemFlowChildError, MemFlowFatalError, MemFlowMaxedError, MemFlowProxyError, MemFlowRetryError, MemFlowSleepError, MemFlowTimeoutError, MemFlowWaitForError } from '../../../modules/errors';
1
+ import { DurableChildError, DurableFatalError, DurableMaxedError, DurableProxyError, DurableRetryError, DurableSleepError, DurableTimeoutError, DurableWaitForError } from '../../../modules/errors';
2
2
  import { KeyService, KeyType } from '../../../modules/key';
3
3
  import { asyncLocalStorage } from '../../../modules/storage';
4
4
  import { deterministicRandom, guid, s, sleepImmediate } from '../../../modules/utils';
5
5
  import { HotMesh } from '../../hotmesh';
6
6
  import { SerializerService } from '../../serializer';
7
- import { ActivityConfig, ChildResponseType, HookOptions, ProxyResponseType, ProxyType, WorkflowContext, WorkflowOptions } from '../../../types/memflow';
7
+ import { ActivityConfig, ChildResponseType, HookOptions, ProxyResponseType, ProxyType, WorkflowContext, WorkflowOptions } from '../../../types/durable';
8
8
  import { JobInterruptOptions } from '../../../types/job';
9
9
  import { StreamCode, StreamStatus } from '../../../types/stream';
10
10
  import { StringAnyType, StringScalarType, StringStringType } from '../../../types/serializer';
11
- import { HMSH_CODE_MEMFLOW_CHILD, HMSH_CODE_MEMFLOW_FATAL, HMSH_CODE_MEMFLOW_MAXED, HMSH_CODE_MEMFLOW_PROXY, HMSH_CODE_MEMFLOW_SLEEP, HMSH_CODE_MEMFLOW_TIMEOUT, HMSH_CODE_MEMFLOW_WAIT, HMSH_MEMFLOW_EXP_BACKOFF, HMSH_MEMFLOW_MAX_ATTEMPTS, HMSH_MEMFLOW_MAX_INTERVAL } from '../../../modules/enums';
12
- import { MemFlowChildErrorType, MemFlowProxyErrorType } from '../../../types/error';
11
+ import { HMSH_CODE_DURABLE_CHILD, HMSH_CODE_DURABLE_FATAL, HMSH_CODE_DURABLE_MAXED, HMSH_CODE_DURABLE_PROXY, HMSH_CODE_DURABLE_SLEEP, HMSH_CODE_DURABLE_TIMEOUT, HMSH_CODE_DURABLE_WAIT, HMSH_DURABLE_EXP_BACKOFF, HMSH_DURABLE_MAX_ATTEMPTS, HMSH_DURABLE_MAX_INTERVAL } from '../../../modules/enums';
12
+ import { DurableChildErrorType, DurableProxyErrorType } from '../../../types/error';
13
13
  import { TelemetryService } from '../../telemetry';
14
14
  import { QuorumMessage } from '../../../types';
15
15
  import { UserMessage } from '../../../types/quorum';
@@ -17,4 +17,4 @@ import { Search } from '../search';
17
17
  import { WorkerService } from '../worker';
18
18
  import { Entity } from '../entity';
19
19
  import { ExecHookOptions } from './execHook';
20
- export { MemFlowChildError, MemFlowFatalError, MemFlowMaxedError, MemFlowProxyError, MemFlowRetryError, MemFlowSleepError, MemFlowTimeoutError, MemFlowWaitForError, KeyService, KeyType, asyncLocalStorage, deterministicRandom, guid, s, sleepImmediate, HotMesh, SerializerService, ActivityConfig, ChildResponseType, HookOptions, ExecHookOptions, ProxyResponseType, ProxyType, WorkflowContext, WorkflowOptions, JobInterruptOptions, StreamCode, StreamStatus, StringAnyType, StringScalarType, StringStringType, HMSH_CODE_MEMFLOW_CHILD, HMSH_CODE_MEMFLOW_FATAL, HMSH_CODE_MEMFLOW_MAXED, HMSH_CODE_MEMFLOW_PROXY, HMSH_CODE_MEMFLOW_SLEEP, HMSH_CODE_MEMFLOW_TIMEOUT, HMSH_CODE_MEMFLOW_WAIT, HMSH_MEMFLOW_EXP_BACKOFF, HMSH_MEMFLOW_MAX_ATTEMPTS, HMSH_MEMFLOW_MAX_INTERVAL, MemFlowChildErrorType, MemFlowProxyErrorType, TelemetryService, QuorumMessage, UserMessage, Search, WorkerService, Entity, };
20
+ export { DurableChildError, DurableFatalError, DurableMaxedError, DurableProxyError, DurableRetryError, DurableSleepError, DurableTimeoutError, DurableWaitForError, KeyService, KeyType, asyncLocalStorage, deterministicRandom, guid, s, sleepImmediate, HotMesh, SerializerService, ActivityConfig, ChildResponseType, HookOptions, ExecHookOptions, ProxyResponseType, ProxyType, WorkflowContext, WorkflowOptions, JobInterruptOptions, StreamCode, StreamStatus, StringAnyType, StringScalarType, StringStringType, HMSH_CODE_DURABLE_CHILD, HMSH_CODE_DURABLE_FATAL, HMSH_CODE_DURABLE_MAXED, HMSH_CODE_DURABLE_PROXY, HMSH_CODE_DURABLE_SLEEP, HMSH_CODE_DURABLE_TIMEOUT, HMSH_CODE_DURABLE_WAIT, HMSH_DURABLE_EXP_BACKOFF, HMSH_DURABLE_MAX_ATTEMPTS, HMSH_DURABLE_MAX_INTERVAL, DurableChildErrorType, DurableProxyErrorType, TelemetryService, QuorumMessage, UserMessage, Search, WorkerService, Entity, };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Entity = exports.WorkerService = exports.Search = exports.TelemetryService = exports.HMSH_DURABLE_MAX_INTERVAL = exports.HMSH_DURABLE_MAX_ATTEMPTS = exports.HMSH_DURABLE_EXP_BACKOFF = exports.HMSH_CODE_DURABLE_WAIT = exports.HMSH_CODE_DURABLE_TIMEOUT = exports.HMSH_CODE_DURABLE_SLEEP = exports.HMSH_CODE_DURABLE_PROXY = exports.HMSH_CODE_DURABLE_MAXED = exports.HMSH_CODE_DURABLE_FATAL = exports.HMSH_CODE_DURABLE_CHILD = exports.StreamStatus = exports.SerializerService = exports.HotMesh = exports.sleepImmediate = exports.s = exports.guid = exports.deterministicRandom = exports.asyncLocalStorage = exports.KeyType = exports.KeyService = exports.DurableWaitForError = exports.DurableTimeoutError = exports.DurableSleepError = exports.DurableRetryError = exports.DurableProxyError = exports.DurableMaxedError = exports.DurableFatalError = exports.DurableChildError = void 0;
4
+ const errors_1 = require("../../../modules/errors");
5
+ Object.defineProperty(exports, "DurableChildError", { enumerable: true, get: function () { return errors_1.DurableChildError; } });
6
+ Object.defineProperty(exports, "DurableFatalError", { enumerable: true, get: function () { return errors_1.DurableFatalError; } });
7
+ Object.defineProperty(exports, "DurableMaxedError", { enumerable: true, get: function () { return errors_1.DurableMaxedError; } });
8
+ Object.defineProperty(exports, "DurableProxyError", { enumerable: true, get: function () { return errors_1.DurableProxyError; } });
9
+ Object.defineProperty(exports, "DurableRetryError", { enumerable: true, get: function () { return errors_1.DurableRetryError; } });
10
+ Object.defineProperty(exports, "DurableSleepError", { enumerable: true, get: function () { return errors_1.DurableSleepError; } });
11
+ Object.defineProperty(exports, "DurableTimeoutError", { enumerable: true, get: function () { return errors_1.DurableTimeoutError; } });
12
+ Object.defineProperty(exports, "DurableWaitForError", { enumerable: true, get: function () { return errors_1.DurableWaitForError; } });
13
+ const key_1 = require("../../../modules/key");
14
+ Object.defineProperty(exports, "KeyService", { enumerable: true, get: function () { return key_1.KeyService; } });
15
+ Object.defineProperty(exports, "KeyType", { enumerable: true, get: function () { return key_1.KeyType; } });
16
+ const storage_1 = require("../../../modules/storage");
17
+ Object.defineProperty(exports, "asyncLocalStorage", { enumerable: true, get: function () { return storage_1.asyncLocalStorage; } });
18
+ const utils_1 = require("../../../modules/utils");
19
+ Object.defineProperty(exports, "deterministicRandom", { enumerable: true, get: function () { return utils_1.deterministicRandom; } });
20
+ Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return utils_1.guid; } });
21
+ Object.defineProperty(exports, "s", { enumerable: true, get: function () { return utils_1.s; } });
22
+ Object.defineProperty(exports, "sleepImmediate", { enumerable: true, get: function () { return utils_1.sleepImmediate; } });
23
+ const hotmesh_1 = require("../../hotmesh");
24
+ Object.defineProperty(exports, "HotMesh", { enumerable: true, get: function () { return hotmesh_1.HotMesh; } });
25
+ const serializer_1 = require("../../serializer");
26
+ Object.defineProperty(exports, "SerializerService", { enumerable: true, get: function () { return serializer_1.SerializerService; } });
27
+ const stream_1 = require("../../../types/stream");
28
+ Object.defineProperty(exports, "StreamStatus", { enumerable: true, get: function () { return stream_1.StreamStatus; } });
29
+ const enums_1 = require("../../../modules/enums");
30
+ Object.defineProperty(exports, "HMSH_CODE_DURABLE_CHILD", { enumerable: true, get: function () { return enums_1.HMSH_CODE_DURABLE_CHILD; } });
31
+ Object.defineProperty(exports, "HMSH_CODE_DURABLE_FATAL", { enumerable: true, get: function () { return enums_1.HMSH_CODE_DURABLE_FATAL; } });
32
+ Object.defineProperty(exports, "HMSH_CODE_DURABLE_MAXED", { enumerable: true, get: function () { return enums_1.HMSH_CODE_DURABLE_MAXED; } });
33
+ Object.defineProperty(exports, "HMSH_CODE_DURABLE_PROXY", { enumerable: true, get: function () { return enums_1.HMSH_CODE_DURABLE_PROXY; } });
34
+ Object.defineProperty(exports, "HMSH_CODE_DURABLE_SLEEP", { enumerable: true, get: function () { return enums_1.HMSH_CODE_DURABLE_SLEEP; } });
35
+ Object.defineProperty(exports, "HMSH_CODE_DURABLE_TIMEOUT", { enumerable: true, get: function () { return enums_1.HMSH_CODE_DURABLE_TIMEOUT; } });
36
+ Object.defineProperty(exports, "HMSH_CODE_DURABLE_WAIT", { enumerable: true, get: function () { return enums_1.HMSH_CODE_DURABLE_WAIT; } });
37
+ Object.defineProperty(exports, "HMSH_DURABLE_EXP_BACKOFF", { enumerable: true, get: function () { return enums_1.HMSH_DURABLE_EXP_BACKOFF; } });
38
+ Object.defineProperty(exports, "HMSH_DURABLE_MAX_ATTEMPTS", { enumerable: true, get: function () { return enums_1.HMSH_DURABLE_MAX_ATTEMPTS; } });
39
+ Object.defineProperty(exports, "HMSH_DURABLE_MAX_INTERVAL", { enumerable: true, get: function () { return enums_1.HMSH_DURABLE_MAX_INTERVAL; } });
40
+ const telemetry_1 = require("../../telemetry");
41
+ Object.defineProperty(exports, "TelemetryService", { enumerable: true, get: function () { return telemetry_1.TelemetryService; } });
42
+ const search_1 = require("../search");
43
+ Object.defineProperty(exports, "Search", { enumerable: true, get: function () { return search_1.Search; } });
44
+ const worker_1 = require("../worker");
45
+ Object.defineProperty(exports, "WorkerService", { enumerable: true, get: function () { return worker_1.WorkerService; } });
46
+ const entity_1 = require("../entity");
47
+ Object.defineProperty(exports, "Entity", { enumerable: true, get: function () { return entity_1.Entity; } });
@@ -11,11 +11,11 @@ import { WorkflowContext } from './common';
11
11
  * ## Examples
12
12
  *
13
13
  * ```typescript
14
- * import { MemFlow } from '@hotmeshio/hotmesh';
14
+ * import { Durable } from '@hotmeshio/hotmesh';
15
15
  *
16
16
  * // Access the workflow ID and namespace
17
17
  * export async function contextAwareWorkflow(): Promise<string> {
18
- * const ctx = MemFlow.workflow.getContext();
18
+ * const ctx = Durable.workflow.getContext();
19
19
  * console.log(`Running workflow ${ctx.workflowId} in ${ctx.namespace}`);
20
20
  * return ctx.workflowId;
21
21
  * }
@@ -24,7 +24,7 @@ import { WorkflowContext } from './common';
24
24
  * ```typescript
25
25
  * // Check if the current execution is a replay
26
26
  * export async function replayAwareWorkflow(): Promise<void> {
27
- * const { counter, workflowDimension } = MemFlow.workflow.getContext();
27
+ * const { counter, workflowDimension } = Durable.workflow.getContext();
28
28
  *
29
29
  * // Use context for logging/debugging
30
30
  * console.log(`Execution counter: ${counter}, dimension: ${workflowDimension}`);
@@ -34,9 +34,9 @@ import { WorkflowContext } from './common';
34
34
  * ```typescript
35
35
  * // Pass context info to child workflows
36
36
  * export async function parentWorkflow(): Promise<void> {
37
- * const { workflowId } = MemFlow.workflow.getContext();
37
+ * const { workflowId } = Durable.workflow.getContext();
38
38
  *
39
- * await MemFlow.workflow.execChild({
39
+ * await Durable.workflow.execChild({
40
40
  * taskQueue: 'children',
41
41
  * workflowName: 'childWorkflow',
42
42
  * args: [workflowId], // pass parent ID to child
@@ -14,11 +14,11 @@ const common_1 = require("./common");
14
14
  * ## Examples
15
15
  *
16
16
  * ```typescript
17
- * import { MemFlow } from '@hotmeshio/hotmesh';
17
+ * import { Durable } from '@hotmeshio/hotmesh';
18
18
  *
19
19
  * // Access the workflow ID and namespace
20
20
  * export async function contextAwareWorkflow(): Promise<string> {
21
- * const ctx = MemFlow.workflow.getContext();
21
+ * const ctx = Durable.workflow.getContext();
22
22
  * console.log(`Running workflow ${ctx.workflowId} in ${ctx.namespace}`);
23
23
  * return ctx.workflowId;
24
24
  * }
@@ -27,7 +27,7 @@ const common_1 = require("./common");
27
27
  * ```typescript
28
28
  * // Check if the current execution is a replay
29
29
  * export async function replayAwareWorkflow(): Promise<void> {
30
- * const { counter, workflowDimension } = MemFlow.workflow.getContext();
30
+ * const { counter, workflowDimension } = Durable.workflow.getContext();
31
31
  *
32
32
  * // Use context for logging/debugging
33
33
  * console.log(`Execution counter: ${counter}, dimension: ${workflowDimension}`);
@@ -37,9 +37,9 @@ const common_1 = require("./common");
37
37
  * ```typescript
38
38
  * // Pass context info to child workflows
39
39
  * export async function parentWorkflow(): Promise<void> {
40
- * const { workflowId } = MemFlow.workflow.getContext();
40
+ * const { workflowId } = Durable.workflow.getContext();
41
41
  *
42
- * await MemFlow.workflow.execChild({
42
+ * await Durable.workflow.execChild({
43
43
  * taskQueue: 'children',
44
44
  * workflowName: 'childWorkflow',
45
45
  * args: [workflowId], // pass parent ID to child
@@ -12,14 +12,14 @@ import { StringAnyType } from './common';
12
12
  * ## Examples
13
13
  *
14
14
  * ```typescript
15
- * import { MemFlow } from '@hotmeshio/hotmesh';
15
+ * import { Durable } from '@hotmeshio/hotmesh';
16
16
  *
17
17
  * // Emit a domain event when an order is processed
18
18
  * export async function orderWorkflow(orderId: string): Promise<void> {
19
- * const { processOrder } = MemFlow.workflow.proxyActivities<typeof activities>();
19
+ * const { processOrder } = Durable.workflow.proxyActivities<typeof activities>();
20
20
  * const result = await processOrder(orderId);
21
21
  *
22
- * await MemFlow.workflow.emit({
22
+ * await Durable.workflow.emit({
23
23
  * 'order.completed': { orderId, total: result.total },
24
24
  * 'analytics.event': { type: 'order', orderId },
25
25
  * });
@@ -29,11 +29,11 @@ import { StringAnyType } from './common';
29
29
  * ```typescript
30
30
  * // Emit progress events during a long-running workflow
31
31
  * export async function batchWorkflow(items: string[]): Promise<void> {
32
- * const { processItem } = MemFlow.workflow.proxyActivities<typeof activities>();
32
+ * const { processItem } = Durable.workflow.proxyActivities<typeof activities>();
33
33
  *
34
34
  * for (let i = 0; i < items.length; i++) {
35
35
  * await processItem(items[i]);
36
- * await MemFlow.workflow.emit(
36
+ * await Durable.workflow.emit(
37
37
  * { 'batch.progress': { completed: i + 1, total: items.length } },
38
38
  * { once: false }, // emit on every execution (progress updates)
39
39
  * );
@@ -16,14 +16,14 @@ const isSideEffectAllowed_1 = require("./isSideEffectAllowed");
16
16
  * ## Examples
17
17
  *
18
18
  * ```typescript
19
- * import { MemFlow } from '@hotmeshio/hotmesh';
19
+ * import { Durable } from '@hotmeshio/hotmesh';
20
20
  *
21
21
  * // Emit a domain event when an order is processed
22
22
  * export async function orderWorkflow(orderId: string): Promise<void> {
23
- * const { processOrder } = MemFlow.workflow.proxyActivities<typeof activities>();
23
+ * const { processOrder } = Durable.workflow.proxyActivities<typeof activities>();
24
24
  * const result = await processOrder(orderId);
25
25
  *
26
- * await MemFlow.workflow.emit({
26
+ * await Durable.workflow.emit({
27
27
  * 'order.completed': { orderId, total: result.total },
28
28
  * 'analytics.event': { type: 'order', orderId },
29
29
  * });
@@ -33,11 +33,11 @@ const isSideEffectAllowed_1 = require("./isSideEffectAllowed");
33
33
  * ```typescript
34
34
  * // Emit progress events during a long-running workflow
35
35
  * export async function batchWorkflow(items: string[]): Promise<void> {
36
- * const { processItem } = MemFlow.workflow.proxyActivities<typeof activities>();
36
+ * const { processItem } = Durable.workflow.proxyActivities<typeof activities>();
37
37
  *
38
38
  * for (let i = 0; i < items.length; i++) {
39
39
  * await processItem(items[i]);
40
- * await MemFlow.workflow.emit(
40
+ * await Durable.workflow.emit(
41
41
  * { 'batch.progress': { completed: i + 1, total: items.length } },
42
42
  * { once: false }, // emit on every execution (progress updates)
43
43
  * );