jw-automator 4.0.0 → 4.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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/Automator.js +12 -10
package/README.md
CHANGED
|
@@ -495,6 +495,6 @@ MIT
|
|
|
495
495
|
|
|
496
496
|
## ❤️ Acknowledgments
|
|
497
497
|
|
|
498
|
-
jw-automator
|
|
498
|
+
jw-automator v4 is a ground-up rethinking of the original jw-automator library, preserving the spirit while strengthening the foundations.
|
|
499
499
|
|
|
500
500
|
If you're building automation logic and want predictable, human-friendly scheduling that survives the real world — **welcome.**
|
package/package.json
CHANGED
package/src/Automator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Automator.js
|
|
3
3
|
*
|
|
4
|
-
* Main API class for jw-automator
|
|
4
|
+
* Main API class for jw-automator v4
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const SchedulerHost = require('./host/SchedulerHost');
|
|
@@ -135,7 +135,6 @@ class Automator {
|
|
|
135
135
|
cmd: actionSpec.cmd,
|
|
136
136
|
payload: actionSpec.payload !== undefined ? actionSpec.payload : null,
|
|
137
137
|
date: startDate,
|
|
138
|
-
unBuffered: actionSpec.unBuffered !== undefined ? actionSpec.unBuffered : false,
|
|
139
138
|
catchUpWindow: catchUpWindow,
|
|
140
139
|
repeat: actionSpec.repeat ? { ...actionSpec.repeat } : null,
|
|
141
140
|
count: 0
|
|
@@ -193,6 +192,7 @@ class Automator {
|
|
|
193
192
|
// Re-normalize catchUpWindow if unBuffered or catchUpWindow was updated
|
|
194
193
|
if ('unBuffered' in updates || 'catchUpWindow' in updates) {
|
|
195
194
|
action.catchUpWindow = this._normalizeCatchUpWindow(action);
|
|
195
|
+
delete action.unBuffered; // Remove legacy property
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
this._emit('update', {
|
|
@@ -242,6 +242,7 @@ class Automator {
|
|
|
242
242
|
// Re-normalize catchUpWindow if unBuffered or catchUpWindow was updated
|
|
243
243
|
if ('unBuffered' in updates || 'catchUpWindow' in updates) {
|
|
244
244
|
action.catchUpWindow = this._normalizeCatchUpWindow(action);
|
|
245
|
+
delete action.unBuffered; // Remove legacy property
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
this._emit('update', {
|
|
@@ -403,7 +404,7 @@ class Automator {
|
|
|
403
404
|
description += `\n Command: ${action.cmd}`;
|
|
404
405
|
description += `\n Next run: ${action.date ? action.date.toLocaleString() : 'None'}`;
|
|
405
406
|
description += `\n Executions: ${action.count}`;
|
|
406
|
-
description += `\n
|
|
407
|
+
description += `\n Catch-up Window: ${action.catchUpWindow === 'unlimited' ? 'unlimited' : `${action.catchUpWindow}ms`}`;
|
|
407
408
|
|
|
408
409
|
if (action.repeat) {
|
|
409
410
|
description += `\n Recurrence: ${action.repeat.type}`;
|
|
@@ -466,14 +467,15 @@ class Automator {
|
|
|
466
467
|
try {
|
|
467
468
|
const state = this.options.storage.load();
|
|
468
469
|
|
|
469
|
-
// Normalize catchUpWindow for existing actions (for backwards compatibility)
|
|
470
470
|
if (state.actions && state.actions.length > 0) {
|
|
471
|
-
state.actions
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
471
|
+
state.actions.forEach(action => {
|
|
472
|
+
// Set catchUpWindow if missing, using legacy unBuffered if present
|
|
473
|
+
if (action.catchUpWindow === undefined) {
|
|
474
|
+
action.catchUpWindow = this._normalizeCatchUpWindow(action);
|
|
475
|
+
}
|
|
476
|
+
// Remove legacy property after normalization
|
|
477
|
+
delete action.unBuffered;
|
|
478
|
+
});
|
|
477
479
|
|
|
478
480
|
const maxId = Math.max(...state.actions.map(a => a.id || 0));
|
|
479
481
|
this.nextId = maxId + 1;
|