@hotmeshio/hotmesh 0.14.7 → 0.14.9

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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.arrayToHash = exports.isStreamMessage = exports.parseStreamMessage = exports.normalizeRetryPolicy = exports.s = exports.isValidCron = exports.restoreHierarchy = exports.getValueByPath = exports.getIndexedHash = exports.getSymVal = exports.getSymKey = exports.formatISODate = exports.getTimeSeries = exports.getSubscriptionTopic = exports.findSubscriptionForTrigger = exports.findTopKey = exports.matchesStatus = exports.matchesStatusCode = exports.polyfill = exports.identifyProvider = exports.XSleepFor = exports.sleepImmediate = exports.sleepFor = exports.guid = exports.deterministicRandom = exports.deepCopy = exports.getSystemHealth = exports.hashOptions = void 0;
7
7
  const os_1 = __importDefault(require("os"));
8
8
  const crypto_1 = require("crypto");
9
+ const cron_parser_1 = require("cron-parser");
9
10
  const nanoid_1 = require("nanoid");
10
11
  const ms_1 = __importDefault(require("ms"));
11
12
  const logger_1 = require("../services/logger");
@@ -276,8 +277,13 @@ exports.restoreHierarchy = restoreHierarchy;
276
277
  * @private
277
278
  */
278
279
  function isValidCron(cronExpression) {
279
- const cronRegex = /^(\*|([0-5]?\d)) (\*|([01]?\d|2[0-3])) (\*|([12]?\d|3[01])) (\*|([1-9]|1[0-2])) (\*|([0-6](?:-[0-6])?(?:,[0-6])?))$/;
280
- return cronRegex.test(cronExpression);
280
+ try {
281
+ (0, cron_parser_1.parseExpression)(cronExpression);
282
+ return true;
283
+ }
284
+ catch {
285
+ return false;
286
+ }
281
287
  }
282
288
  exports.isValidCron = isValidCron;
283
289
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.14.7",
3
+ "version": "0.14.9",
4
4
  "description": "Durable Workflow",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -181,6 +181,20 @@ class Worker extends activity_1.Activity {
181
181
  retry: this.config.retry,
182
182
  };
183
183
  }
184
+ // Propagate per-activity retry config as _streamRetryConfig so
185
+ // the engine-level retry mechanism uses it for exponential backoff.
186
+ // The durable module's maximumAttempts means max retries
187
+ // (total executions = 1 + maximumAttempts), while the engine's
188
+ // max_retry_attempts means total attempts. Add 1 to align.
189
+ if (jobData?.maximumAttempts || jobData?.backoffCoefficient || jobData?.maximumInterval || jobData?.initialInterval) {
190
+ const durableMaxAttempts = jobData.maximumAttempts ?? 50;
191
+ streamData._streamRetryConfig = {
192
+ max_retry_attempts: durableMaxAttempts + 1,
193
+ backoff_coefficient: jobData.backoffCoefficient ?? 10,
194
+ maximum_interval_seconds: jobData.maximumInterval ?? 120,
195
+ initialInterval: jobData.initialInterval ?? 1,
196
+ };
197
+ }
184
198
  return (await this.engine.router?.publishMessage(topic, streamData, transaction));
185
199
  }
186
200
  }
@@ -474,10 +474,10 @@ class ExporterService {
474
474
  const activityArgsField = this.resolveSymbolField(symbolSets, 'activity_trigger', 'activity_trigger/output/data/arguments');
475
475
  const workflowArgsField = this.resolveSymbolField(symbolSets, 'trigger', 'trigger/output/data/arguments');
476
476
  // ── 1. Enrich activity inputs ──
477
- if (activityArgsField) {
477
+ {
478
478
  const activityEvents = execution.events.filter((e) => e.event_type === 'activity_task_scheduled' || e.event_type === 'activity_task_completed' || e.event_type === 'activity_task_failed');
479
479
  if (activityEvents.length > 0) {
480
- const { byJobId, byNameIndex } = await this.store.getActivityInputs(workflowId, activityArgsField);
480
+ const { byJobId, byNameIndex } = await this.store.getActivityInputs(workflowId, activityArgsField || '');
481
481
  for (const evt of activityEvents) {
482
482
  const attrs = evt.attributes;
483
483
  let input = attrs.timeline_key ? byJobId.get(attrs.timeline_key) : undefined;
@@ -1,22 +1,4 @@
1
- /**
2
- *********** HOTMESH 'DURABLE' MODULE APPLICATION GRAPH **********
3
- *
4
- * This HotMesh application spec uses 50 activities and 25 transitions
5
- * to model a durable workflow engine using a pluggable backend.
6
- *
7
- * This YAML file can also serve as a useful starting point for building
8
- * Integration/BPM/Workflow servers in general (MuleSoft, etc) without the need
9
- * for a physical application server.
10
- *
11
- * Possible use cases include:
12
- * * Orchestration servers
13
- * * Integration servers
14
- * * BPMN engines
15
- * * Reentrant process servers
16
- * * Service Meshes
17
- * * Master Data Management systems
18
- */
19
- declare const APP_VERSION = "11";
1
+ declare const APP_VERSION = "12";
20
2
  declare const APP_ID = "durable";
21
3
  /**
22
4
  * returns a new durable workflow schema