@hotmeshio/hotmesh 0.22.5 → 0.22.6

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.22.5",
3
+ "version": "0.22.6",
4
4
  "description": "Durable Workflow",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -365,7 +365,10 @@ class ClientService {
365
365
  throw error;
366
366
  }
367
367
  }
368
- else if (isNaN(Number(appVersion)) || appVersion < version) {
368
+ else if (isNaN(Number(appVersion)) ||
369
+ Number(appVersion) < Number(version)) {
370
+ // Numeric compare: string `<` mis-orders at digit boundaries (e.g. '9' < '16'
371
+ // is false as strings). Redeploy + hot-swap when an older schema is deployed.
369
372
  try {
370
373
  await hotMesh.deploy((0, factory_1.getWorkflowYAML)(appId, version));
371
374
  await hotMesh.activate(version);
@@ -1,4 +1,4 @@
1
- declare const APP_VERSION = "15";
1
+ declare const APP_VERSION = "16";
2
2
  declare const APP_ID = "durable";
3
3
  /**
4
4
  * returns a new durable workflow schema
@@ -1,7 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.APP_ID = exports.APP_VERSION = exports.getWorkflowYAML = void 0;
4
- const APP_VERSION = '15';
4
+ // Schema content version for the generated durable app YAML below. BUMP THIS
5
+ // whenever `getWorkflowYAML` changes — it is how existing deployments detect a
6
+ // schema upgrade and hot-swap to it (see WorkerService.activateWorkflow and
7
+ // ClientService.deployAndActivate). Changing the YAML without a bump leaves
8
+ // every already-deployed database on the old schema forever. Numeric string —
9
+ // compared with `Number()` for ordering. (v16: condition() escalation hook.)
10
+ const APP_VERSION = '16';
5
11
  exports.APP_VERSION = APP_VERSION;
6
12
  const APP_ID = 'durable';
7
13
  exports.APP_ID = APP_ID;
@@ -128,7 +128,16 @@ class WorkerService {
128
128
  static async activateWorkflow(hotMesh) {
129
129
  const app = await hotMesh.engine.store.getApp(hotMesh.engine.appId);
130
130
  const appVersion = app?.version;
131
- if (!appVersion) {
131
+ if (!appVersion ||
132
+ isNaN(Number(appVersion)) ||
133
+ Number(appVersion) < Number(factory_1.APP_VERSION)) {
134
+ // Not deployed, or an OLDER schema version is deployed (the SDK was
135
+ // upgraded). Deploy this SDK's schema and hot-swap to it. HotMesh keeps
136
+ // the prior version deployed, so in-flight jobs drain on the old schema
137
+ // while new jobs use APP_VERSION. Without this branch an existing, active
138
+ // app would never pick up a new schema — atomic-escalation hooks and any
139
+ // other schema-encoded feature would silently never activate after an
140
+ // upgrade. Mirrors ClientService.deployAndActivate.
132
141
  try {
133
142
  await hotMesh.deploy((0, factory_1.getWorkflowYAML)(hotMesh.engine.appId, factory_1.APP_VERSION));
134
143
  await hotMesh.activate(factory_1.APP_VERSION);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.22.5",
3
+ "version": "0.22.6",
4
4
  "description": "Durable Workflow",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",