croner 4.1.93 → 4.1.97

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 CHANGED
@@ -51,12 +51,12 @@ Benchmark at 2022-02-01:
51
51
  ```
52
52
  > node cron-implementation-test.js
53
53
 
54
- Test: When is next saturday 29th of february, pattern '0 0 0 29 2 6'
54
+ Test: When is next monday in october, pattern '0 0 0 * 10 1'
55
55
 
56
- node-schedule: 2022-02-05 00:00:00 in 55.13ms
57
- node-cron: ??? in 14.587ms
58
- cron: 2022-03-05 00:00:00 in 21.07ms
59
- croner: 2048-02-29 00:00:00 in 10.508ms
56
+ node-schedule: 2022-10-03 00:00:00 in 15.26ms
57
+ node-cron: ??? in 1.076ms
58
+ cron: 2022-11-07 00:00:00 in 2.923ms
59
+ croner: 2022-10-03 00:00:00 in 1.774ms
60
60
  ```
61
61
 
62
62
  <details>
@@ -70,13 +70,6 @@ node-cron: ??? in 1.676ms
70
70
  cron: 2022-03-15 00:00:00 in 6.066ms
71
71
  croner: 2022-02-15 00:00:00 in 0.575ms
72
72
 
73
- Test: When is next monday in october, pattern '0 0 0 * 10 1'
74
-
75
- node-schedule: 2022-10-03 00:00:00 in 15.26ms
76
- node-cron: ??? in 1.076ms
77
- cron: 2022-11-07 00:00:00 in 2.923ms
78
- croner: 2022-10-03 00:00:00 in 1.774ms
79
-
80
73
  Test: When is 23:00 next 31st march, pattern '0 0 23 31 3 *'
81
74
 
82
75
  node-schedule: 2022-03-31 23:00:00 in 18.894ms
@@ -215,7 +208,7 @@ job.stop();
215
208
 
216
209
  The expressions of Croner are very similar to the ones of Vixie Cron, with a few additions and changes listed below.
217
210
 
218
- * In croner, a combination of day-of-week and day-of-month will only trigger when both conditions match. An example: ```0 20 1 * MON``` will only trigger when monday occur the first day of any month. In Vixie Cron, it would trigger every monday AND the first day of every month.
211
+ * In croner, a combination of day-of-week and day-of-month will only trigger when both conditions match. An example: ```0 20 1 * MON``` will only trigger when monday occur the first day of any month. In Vixie Cron, it would trigger every monday AND the first day of every month. See issue [#53](https://github.com/Hexagon/croner/issues/53).
219
212
 
220
213
  * Croner expressions support the following additional modifiers
221
214
  - *?* A question mark is substituted with croner initialization time, as an example - `? ? * * * *` would be substituted with `25 8 * * * *` if time is `<any hour>:08:25` at the time of `new Cron('? ? * * * *', <...>)`. The question mark can be used in any field.
package/dist/croner.cjs CHANGED
@@ -16,9 +16,9 @@
16
16
  * (for example) will return local time in new york, but getUTCHours()
17
17
  * will return something irrelevant.
18
18
  *
19
- * @param {date} date - Input date
19
+ * @param {Date} date - Input date
20
20
  * @param {string} tzString - Timezone string in Europe/Stockholm format
21
- * @returns {date}
21
+ * @returns {Date}
22
22
  */
23
23
  function convertTZ(date, tzString) {
24
24
  return new Date(date.toLocaleString("en-US", {timeZone: tzString}));
@@ -160,7 +160,7 @@
160
160
  for( let i = startPos; i < pattern[target].length; i++ ) {
161
161
 
162
162
  // If pattern matches and, in case of days, weekday matches, go on
163
- if( pattern[target][i] && (target !== "days" || (pattern.daysOfWeek[this.getDate(true).getDay()])) ) {
163
+ if( pattern[target][i] ) {
164
164
 
165
165
  // Special handling for L (last day of month), when we are searching for days
166
166
  if (target === "days" && pattern.lastDayOfMonth) {
@@ -254,6 +254,16 @@
254
254
  doing++;
255
255
  }
256
256
 
257
+ // This is a special case for weekday, as the user isn't able to combine date/month patterns
258
+ // with weekday patterns, it's just to increment days until we get a match.
259
+ while (!pattern.daysOfWeek[this.getDate(true).getDay()]) {
260
+ this.days += 1;
261
+
262
+ // Reset everything before days
263
+ doing = 2;
264
+ resetPrevious();
265
+ }
266
+
257
267
  // If anything changed, recreate this CronDate and run again without incrementing
258
268
  if (origTime != this.getTime()) {
259
269
  this.apply();
@@ -561,7 +571,7 @@
561
571
  let [, lower, upper, steps] = matches;
562
572
  lower = parseInt(lower, 10) + valueIndexOffset;
563
573
  upper = parseInt(upper, 10) + valueIndexOffset;
564
- steps = parseInt(steps, 10) + valueIndexOffset;
574
+ steps = parseInt(steps, 10);
565
575
 
566
576
  if( isNaN(lower) ) throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");
567
577
  if( isNaN(upper) ) throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");
@@ -574,7 +584,7 @@
574
584
  if( lower > upper ) throw new TypeError("CronPattern: From value is larger than to value: '" + conf + "'");
575
585
 
576
586
  for (let i = lower; i <= upper; i += steps) {
577
- this[type][(i + valueIndexOffset)] = 1;
587
+ this[type][i] = 1;
578
588
  }
579
589
  };
580
590
 
@@ -613,7 +623,7 @@
613
623
  }
614
624
 
615
625
  for( let i = lower; i <= upper; i++ ) {
616
- this[type][(i + valueIndexOffset)] = 1;
626
+ this[type][i] = 1;
617
627
  }
618
628
  };
619
629
 
@@ -623,9 +633,8 @@
623
633
  *
624
634
  * @param {string} conf - Current part, expected to be a string like * /20 (without the space)
625
635
  * @param {string} type - One of "seconds", "minutes" etc
626
- * @param {number} valueIndexOffset - -1 for day of month, and month, as they start at 1. 0 for seconds, hours, minutes
627
636
  */
628
- CronPattern.prototype.handleStepping = function (conf, type, valueIndexOffset) {
637
+ CronPattern.prototype.handleStepping = function (conf, type) {
629
638
 
630
639
  const split = conf.split("/");
631
640
 
@@ -645,7 +654,7 @@
645
654
  if( steps > this[type].length ) throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");
646
655
 
647
656
  for( let i = start; i < this[type].length; i+= steps ) {
648
- this[type][(i + valueIndexOffset)] = 1;
657
+ this[type][i] = 1;
649
658
  }
650
659
  };
651
660
 
@@ -751,7 +760,7 @@
751
760
  * Cron entrypoint
752
761
  *
753
762
  * @constructor
754
- * @param {string|date} pattern - Input pattern, input date, or input ISO 8601 time string
763
+ * @param {string|Date} pattern - Input pattern, input date, or input ISO 8601 time string
755
764
  * @param {CronOptions|Function} [options] - Options
756
765
  * @param {Function} [func] - Function to be run each iteration of pattern
757
766
  * @returns {Cron}
@@ -776,7 +785,7 @@
776
785
  if (pattern && (pattern instanceof Date)) {
777
786
  this.once = new CronDate(pattern, this.options.timezone);
778
787
  } else if (pattern && (typeof pattern === "string") && pattern.indexOf(":") > 0) {
779
- /** @type {CronPattern} */
788
+ /** @type {CronDate} */
780
789
  this.once = new CronDate(pattern, this.options.timezone);
781
790
  } else {
782
791
  /** @type {CronPattern} */
@@ -842,7 +851,7 @@
842
851
  * Find next n runs, based on supplied date. Strips milliseconds.
843
852
  *
844
853
  * @param {number} n - Number of runs to enumerate
845
- * @param {Date|string} [prev] - Date to start from
854
+ * @param {Date|string} [previous] - Date to start from
846
855
  * @returns {Date[]} - Next n run times
847
856
  */
848
857
  Cron.prototype.enumerate = function (n, previous) {
@@ -1 +1 @@
1
- (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.Cron=factory())})(this,function(){"use strict";function convertTZ(date,tzString){return new Date(date.toLocaleString("en-US",{timeZone:tzString}))}function CronDate(date,timezone){this.timezone=timezone;if(date&&date instanceof Date){this.fromDate(date)}else if(date===void 0){this.fromDate(new Date)}else if(date&&typeof date==="string"){this.fromString(date)}else if(date instanceof CronDate){this.fromCronDate(date)}else{throw new TypeError("CronDate: Invalid type ("+typeof date+") passed as parameter to CronDate constructor")}}CronDate.prototype.fromDate=function(date){if(this.timezone){date=convertTZ(date,this.timezone)}this.milliseconds=date.getMilliseconds();this.seconds=date.getSeconds();this.minutes=date.getMinutes();this.hours=date.getHours();this.days=date.getDate();this.months=date.getMonth();this.years=date.getFullYear()};CronDate.prototype.fromCronDate=function(date){this.timezone=date.timezone;this.milliseconds=date.milliseconds;this.seconds=date.seconds;this.minutes=date.minutes;this.hours=date.hours;this.days=date.days;this.months=date.months;this.years=date.years};CronDate.prototype.apply=function(){const newDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);this.milliseconds=newDate.getMilliseconds();this.seconds=newDate.getSeconds();this.minutes=newDate.getMinutes();this.hours=newDate.getHours();this.days=newDate.getDate();this.months=newDate.getMonth();this.years=newDate.getFullYear()};CronDate.prototype.fromString=function(str){const parsedDate=this.parseISOLocal(str);if(isNaN(parsedDate)){throw new TypeError("CronDate: Provided string value for CronDate could not be parsed as date.")}this.fromDate(parsedDate)};CronDate.prototype.increment=function(pattern,rerun){if(!rerun){this.seconds+=1}this.milliseconds=0;const origTime=this.getTime(),findNext=(target,pattern,offset,override)=>{const startPos=override===void 0?this[target]+offset:0+offset;for(let i=startPos;i<pattern[target].length;i++){if(pattern[target][i]&&(target!=="days"||pattern.daysOfWeek[this.getDate(true).getDay()])){if(target==="days"&&pattern.lastDayOfMonth){let baseDate=this.getDate(true);baseDate.setDate(i-offset+1);if(baseDate.getMonth()!==this["months"]){this[target]=i-offset;return true}}else{this[target]=i-offset;return true}}}return false},resetPrevious=offset=>{while(doing+offset>=0){findNext(toDo[doing+offset][0],pattern,toDo[doing+offset][2],0);doing--}};const toDo=[["seconds","minutes",0],["minutes","hours",0],["hours","days",0],["days","months",-1],["months","years",0]];let doing=0;while(doing<5){let currentValue=this[toDo[doing][0]];if(!findNext(toDo[doing][0],pattern,toDo[doing][2])){this[toDo[doing][1]]++;resetPrevious(0)}else if(currentValue!==this[toDo[doing][0]]){resetPrevious(-1)}if(this.years>=4e3){return null}doing++}if(origTime!=this.getTime()){this.apply();return this.increment(pattern,true)}else{return this}};CronDate.prototype.getDate=function(internal){const targetDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);if(internal||!this.timezone){return targetDate}else{const offset=convertTZ(targetDate,this.timezone).getTime()-targetDate.getTime();return new Date(targetDate.getTime()-offset)}};CronDate.prototype.getTime=function(internal){return this.getDate(internal).getTime()};CronDate.prototype.parseISOLocal=function(dateTimeString){const dateTimeStringSplit=dateTimeString.split(/\D/);if(dateTimeStringSplit.length<6){return NaN}const year=parseInt(dateTimeStringSplit[0],10),month=parseInt(dateTimeStringSplit[1],10),day=parseInt(dateTimeStringSplit[2],10),hour=parseInt(dateTimeStringSplit[3],10),minute=parseInt(dateTimeStringSplit[4],10),second=parseInt(dateTimeStringSplit[5],10);if(isNaN(year)||isNaN(month)||isNaN(day)||isNaN(hour)||isNaN(minute)||isNaN(second)){return NaN}else{let generatedDate;if(dateTimeString.indexOf("Z")>0){generatedDate=new Date(Date.UTC(year,month-1,day,hour,minute,second));if(year==generatedDate.getUTCFullYear()&&month==generatedDate.getUTCMonth()+1&&day==generatedDate.getUTCDate()&&hour==generatedDate.getUTCHours()&&minute==generatedDate.getUTCMinutes()&&second==generatedDate.getUTCSeconds()){return generatedDate}else{return NaN}}else{generatedDate=new Date(year,month-1,day,hour,minute,second);if(year==generatedDate.getFullYear()&&month==generatedDate.getMonth()+1&&day==generatedDate.getDate()&&hour==generatedDate.getHours()&&minute==generatedDate.getMinutes()&&second==generatedDate.getSeconds()){return generatedDate}else{return NaN}}}};function CronPattern(pattern,timezone){this.pattern=pattern;this.timezone=timezone;this.seconds=Array(60).fill(0);this.minutes=Array(60).fill(0);this.hours=Array(24).fill(0);this.days=Array(31).fill(0);this.months=Array(12).fill(0);this.daysOfWeek=Array(8).fill(0);this.lastDayOfMonth=false;this.parse()}CronPattern.prototype.parse=function(){if(!(typeof this.pattern==="string"||this.pattern.constructor===String)){throw new TypeError("CronPattern: Pattern has to be of type string.")}const parts=this.pattern.trim().replace(/\s+/g," ").split(" ");if(parts.length<5||parts.length>6){throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exacly five or six space separated parts required.")}if(parts.length===5){parts.unshift("0")}if(parts[3].toUpperCase()=="L"){parts[3]="28,29,30,31";this.lastDayOfMonth=true}parts[4]=this.replaceAlphaMonths(parts[4]);parts[5]=this.replaceAlphaDays(parts[5]);let initDate=new CronDate(new Date,this.timezone).getDate(true);parts[0]=parts[0].replace("?",initDate.getSeconds());parts[1]=parts[1].replace("?",initDate.getMinutes());parts[2]=parts[2].replace("?",initDate.getHours());parts[3]=parts[3].replace("?",initDate.getDate());parts[4]=parts[4].replace("?",initDate.getMonth()+1);parts[5]=parts[5].replace("?",initDate.getDay());this.throwAtIllegalCharacters(parts);this.partToArray("seconds",parts[0],0);this.partToArray("minutes",parts[1],0);this.partToArray("hours",parts[2],0);this.partToArray("days",parts[3],-1);this.partToArray("months",parts[4],-1);this.partToArray("daysOfWeek",parts[5],0);if(this.daysOfWeek[7]){this.daysOfWeek[0]=1}};CronPattern.prototype.partToArray=function(type,conf,valueIndexOffset,recursed){const arr=this[type];if(conf==="*"){for(let i=0;i<arr.length;i++){arr[i]=1}return}const split=conf.split(",");if(split.length>1){for(let i=0;i<split.length;i++){this.partToArray(type,split[i],valueIndexOffset,true)}}else if(conf.indexOf("-")!==-1&&conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRangeWithStepping(conf,type,valueIndexOffset)}else if(conf.indexOf("-")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRange(conf,type,valueIndexOffset)}else if(conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleStepping(conf,type,valueIndexOffset)}else{this.handleNumber(conf,type,valueIndexOffset)}};CronPattern.prototype.throwAtIllegalCharacters=function(parts){const reValidCron=/[^/*0-9,-]+/;for(let i=0;i<parts.length;i++){if(reValidCron.test(parts[i])){throw new TypeError("CronPattern: configuration entry "+i+" ("+parts[i]+") contains illegal characters.")}}};CronPattern.prototype.handleNumber=function(conf,type,valueIndexOffset){const i=parseInt(conf,10)+valueIndexOffset;if(i<0||i>=this[type].length){throw new TypeError("CronPattern: "+type+" value out of range: '"+conf+"'")}this[type][i]=1};CronPattern.prototype.handleRangeWithStepping=function(conf,type,valueIndexOffset){const matches=conf.match(/^(\d+)-(\d+)\/(\d+)$/);if(matches===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+conf+"'");let[,lower,upper,steps]=matches;lower=parseInt(lower,10)+valueIndexOffset;upper=parseInt(upper,10)+valueIndexOffset;steps=parseInt(steps,10)+valueIndexOffset;if(isNaN(lower))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(upper))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");if(lower<0||upper>=this[type].length)throw new TypeError("CronPattern: Value out of range: '"+conf+"'");if(lower>upper)throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'");for(let i=lower;i<=upper;i+=steps){this[type][i+valueIndexOffset]=1}};CronPattern.prototype.handleRange=function(conf,type,valueIndexOffset){const split=conf.split("-");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal range: '"+conf+"'")}const lower=parseInt(split[0],10)+valueIndexOffset,upper=parseInt(split[1],10)+valueIndexOffset;if(isNaN(lower)){throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)")}else if(isNaN(upper)){throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)")}if(lower<0||upper>=this[type].length){throw new TypeError("CronPattern: Value out of range: '"+conf+"'")}if(lower>upper){throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'")}for(let i=lower;i<=upper;i++){this[type][i+valueIndexOffset]=1}};CronPattern.prototype.handleStepping=function(conf,type,valueIndexOffset){const split=conf.split("/");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+conf+"'")}let start=0;if(split[0]!=="*"){start=parseInt(split[0],10)}const steps=parseInt(split[1],10);if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");for(let i=start;i<this[type].length;i+=steps){this[type][i+valueIndexOffset]=1}};CronPattern.prototype.replaceAlphaDays=function(conf){return conf.replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")};CronPattern.prototype.replaceAlphaMonths=function(conf){return conf.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")};const maxDelay=Math.pow(2,32-1)-1;function Cron(pattern,options,func){if(!(this instanceof Cron)){return new Cron(pattern,options,func)}if(typeof options==="function"){func=options;options=void 0}this.options=this.processOptions(options);if(pattern&&pattern instanceof Date){this.once=new CronDate(pattern,this.options.timezone)}else if(pattern&&typeof pattern==="string"&&pattern.indexOf(":")>0){this.once=new CronDate(pattern,this.options.timezone)}else{this.pattern=new CronPattern(pattern,this.options.timezone)}if(func!==void 0){this.fn=func;this.schedule()}return this}Cron.prototype.processOptions=function(options){if(options===void 0){options={}}options.paused=options.paused===void 0?false:options.paused;options.maxRuns=options.maxRuns===void 0?Infinity:options.maxRuns;options.catch=options.catch===void 0?false:options.catch;options.kill=false;if(options.startAt){options.startAt=new CronDate(options.startAt,options.timezone)}if(options.stopAt){options.stopAt=new CronDate(options.stopAt,options.timezone)}return options};Cron.prototype.next=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);return next?next.getDate():null};Cron.prototype.enumerate=function(n,previous){let enumeration=[];while(n--&&(previous=this.next(previous))){enumeration.push(previous)}return enumeration};Cron.prototype.running=function(){const msLeft=this.msToNext(this.previousrun);const running=!this.options.paused&&this.fn!==void 0;return msLeft!==null&&running};Cron.prototype.previous=function(){return this.previousrun?this.previousrun.getDate():null};Cron.prototype._next=function(prev){if(this.options.startAt&&prev&&prev.getTime(true)<this.options.startAt.getTime(true)){prev=this.options.startAt}const nextRun=this.once||new CronDate(prev,this.options.timezone).increment(this.pattern);if(this.once&&this.once.getTime(true)<=prev.getTime(true)){return null}else if(nextRun===null||this.options.maxRuns<=0||this.options.kill||this.options.stopAt&&nextRun.getTime(true)>=this.options.stopAt.getTime(true)){return null}else{return nextRun}};Cron.prototype.msToNext=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);if(next){return next.getTime(true)-prev.getTime(true)}else{return null}};Cron.prototype.stop=function(){this.options.kill=true;if(this.currentTimeout){clearTimeout(this.currentTimeout)}};Cron.prototype.pause=function(){return(this.options.paused=true)&&!this.options.kill};Cron.prototype.resume=function(){return!(this.options.paused=false)&&!this.options.kill};Cron.prototype.schedule=function(func){if(func&&this.fn){throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.")}else if(func){this.fn=func}let waitMs=this.msToNext(this.previousrun);if(waitMs===null)return this;if(waitMs>maxDelay){waitMs=maxDelay}this.currentTimeout=setTimeout(()=>{if(waitMs!==maxDelay&&!this.options.paused){this.options.maxRuns--;if(this.options.catch){try{this.fn(this,this.options.context)}catch(_e){}}else{this.fn(this,this.options.context)}this.previousrun=new CronDate(void 0,this.options.timezone)}this.schedule()},waitMs);return this};return Cron});
1
+ (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,global.Cron=factory())})(this,function(){"use strict";function convertTZ(date,tzString){return new Date(date.toLocaleString("en-US",{timeZone:tzString}))}function CronDate(date,timezone){this.timezone=timezone;if(date&&date instanceof Date){this.fromDate(date)}else if(date===void 0){this.fromDate(new Date)}else if(date&&typeof date==="string"){this.fromString(date)}else if(date instanceof CronDate){this.fromCronDate(date)}else{throw new TypeError("CronDate: Invalid type ("+typeof date+") passed as parameter to CronDate constructor")}}CronDate.prototype.fromDate=function(date){if(this.timezone){date=convertTZ(date,this.timezone)}this.milliseconds=date.getMilliseconds();this.seconds=date.getSeconds();this.minutes=date.getMinutes();this.hours=date.getHours();this.days=date.getDate();this.months=date.getMonth();this.years=date.getFullYear()};CronDate.prototype.fromCronDate=function(date){this.timezone=date.timezone;this.milliseconds=date.milliseconds;this.seconds=date.seconds;this.minutes=date.minutes;this.hours=date.hours;this.days=date.days;this.months=date.months;this.years=date.years};CronDate.prototype.apply=function(){const newDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);this.milliseconds=newDate.getMilliseconds();this.seconds=newDate.getSeconds();this.minutes=newDate.getMinutes();this.hours=newDate.getHours();this.days=newDate.getDate();this.months=newDate.getMonth();this.years=newDate.getFullYear()};CronDate.prototype.fromString=function(str){const parsedDate=this.parseISOLocal(str);if(isNaN(parsedDate)){throw new TypeError("CronDate: Provided string value for CronDate could not be parsed as date.")}this.fromDate(parsedDate)};CronDate.prototype.increment=function(pattern,rerun){if(!rerun){this.seconds+=1}this.milliseconds=0;const origTime=this.getTime(),findNext=(target,pattern,offset,override)=>{const startPos=override===void 0?this[target]+offset:0+offset;for(let i=startPos;i<pattern[target].length;i++){if(pattern[target][i]){if(target==="days"&&pattern.lastDayOfMonth){let baseDate=this.getDate(true);baseDate.setDate(i-offset+1);if(baseDate.getMonth()!==this["months"]){this[target]=i-offset;return true}}else{this[target]=i-offset;return true}}}return false},resetPrevious=offset=>{while(doing+offset>=0){findNext(toDo[doing+offset][0],pattern,toDo[doing+offset][2],0);doing--}};const toDo=[["seconds","minutes",0],["minutes","hours",0],["hours","days",0],["days","months",-1],["months","years",0]];let doing=0;while(doing<5){let currentValue=this[toDo[doing][0]];if(!findNext(toDo[doing][0],pattern,toDo[doing][2])){this[toDo[doing][1]]++;resetPrevious(0)}else if(currentValue!==this[toDo[doing][0]]){resetPrevious(-1)}if(this.years>=4e3){return null}doing++}while(!pattern.daysOfWeek[this.getDate(true).getDay()]){this.days+=1;doing=2;resetPrevious()}if(origTime!=this.getTime()){this.apply();return this.increment(pattern,true)}else{return this}};CronDate.prototype.getDate=function(internal){const targetDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);if(internal||!this.timezone){return targetDate}else{const offset=convertTZ(targetDate,this.timezone).getTime()-targetDate.getTime();return new Date(targetDate.getTime()-offset)}};CronDate.prototype.getTime=function(internal){return this.getDate(internal).getTime()};CronDate.prototype.parseISOLocal=function(dateTimeString){const dateTimeStringSplit=dateTimeString.split(/\D/);if(dateTimeStringSplit.length<6){return NaN}const year=parseInt(dateTimeStringSplit[0],10),month=parseInt(dateTimeStringSplit[1],10),day=parseInt(dateTimeStringSplit[2],10),hour=parseInt(dateTimeStringSplit[3],10),minute=parseInt(dateTimeStringSplit[4],10),second=parseInt(dateTimeStringSplit[5],10);if(isNaN(year)||isNaN(month)||isNaN(day)||isNaN(hour)||isNaN(minute)||isNaN(second)){return NaN}else{let generatedDate;if(dateTimeString.indexOf("Z")>0){generatedDate=new Date(Date.UTC(year,month-1,day,hour,minute,second));if(year==generatedDate.getUTCFullYear()&&month==generatedDate.getUTCMonth()+1&&day==generatedDate.getUTCDate()&&hour==generatedDate.getUTCHours()&&minute==generatedDate.getUTCMinutes()&&second==generatedDate.getUTCSeconds()){return generatedDate}else{return NaN}}else{generatedDate=new Date(year,month-1,day,hour,minute,second);if(year==generatedDate.getFullYear()&&month==generatedDate.getMonth()+1&&day==generatedDate.getDate()&&hour==generatedDate.getHours()&&minute==generatedDate.getMinutes()&&second==generatedDate.getSeconds()){return generatedDate}else{return NaN}}}};function CronPattern(pattern,timezone){this.pattern=pattern;this.timezone=timezone;this.seconds=Array(60).fill(0);this.minutes=Array(60).fill(0);this.hours=Array(24).fill(0);this.days=Array(31).fill(0);this.months=Array(12).fill(0);this.daysOfWeek=Array(8).fill(0);this.lastDayOfMonth=false;this.parse()}CronPattern.prototype.parse=function(){if(!(typeof this.pattern==="string"||this.pattern.constructor===String)){throw new TypeError("CronPattern: Pattern has to be of type string.")}const parts=this.pattern.trim().replace(/\s+/g," ").split(" ");if(parts.length<5||parts.length>6){throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exacly five or six space separated parts required.")}if(parts.length===5){parts.unshift("0")}if(parts[3].toUpperCase()=="L"){parts[3]="28,29,30,31";this.lastDayOfMonth=true}parts[4]=this.replaceAlphaMonths(parts[4]);parts[5]=this.replaceAlphaDays(parts[5]);let initDate=new CronDate(new Date,this.timezone).getDate(true);parts[0]=parts[0].replace("?",initDate.getSeconds());parts[1]=parts[1].replace("?",initDate.getMinutes());parts[2]=parts[2].replace("?",initDate.getHours());parts[3]=parts[3].replace("?",initDate.getDate());parts[4]=parts[4].replace("?",initDate.getMonth()+1);parts[5]=parts[5].replace("?",initDate.getDay());this.throwAtIllegalCharacters(parts);this.partToArray("seconds",parts[0],0);this.partToArray("minutes",parts[1],0);this.partToArray("hours",parts[2],0);this.partToArray("days",parts[3],-1);this.partToArray("months",parts[4],-1);this.partToArray("daysOfWeek",parts[5],0);if(this.daysOfWeek[7]){this.daysOfWeek[0]=1}};CronPattern.prototype.partToArray=function(type,conf,valueIndexOffset,recursed){const arr=this[type];if(conf==="*"){for(let i=0;i<arr.length;i++){arr[i]=1}return}const split=conf.split(",");if(split.length>1){for(let i=0;i<split.length;i++){this.partToArray(type,split[i],valueIndexOffset,true)}}else if(conf.indexOf("-")!==-1&&conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRangeWithStepping(conf,type,valueIndexOffset)}else if(conf.indexOf("-")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRange(conf,type,valueIndexOffset)}else if(conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleStepping(conf,type,valueIndexOffset)}else{this.handleNumber(conf,type,valueIndexOffset)}};CronPattern.prototype.throwAtIllegalCharacters=function(parts){const reValidCron=/[^/*0-9,-]+/;for(let i=0;i<parts.length;i++){if(reValidCron.test(parts[i])){throw new TypeError("CronPattern: configuration entry "+i+" ("+parts[i]+") contains illegal characters.")}}};CronPattern.prototype.handleNumber=function(conf,type,valueIndexOffset){const i=parseInt(conf,10)+valueIndexOffset;if(i<0||i>=this[type].length){throw new TypeError("CronPattern: "+type+" value out of range: '"+conf+"'")}this[type][i]=1};CronPattern.prototype.handleRangeWithStepping=function(conf,type,valueIndexOffset){const matches=conf.match(/^(\d+)-(\d+)\/(\d+)$/);if(matches===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+conf+"'");let[,lower,upper,steps]=matches;lower=parseInt(lower,10)+valueIndexOffset;upper=parseInt(upper,10)+valueIndexOffset;steps=parseInt(steps,10);if(isNaN(lower))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(upper))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");if(lower<0||upper>=this[type].length)throw new TypeError("CronPattern: Value out of range: '"+conf+"'");if(lower>upper)throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'");for(let i=lower;i<=upper;i+=steps){this[type][i]=1}};CronPattern.prototype.handleRange=function(conf,type,valueIndexOffset){const split=conf.split("-");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal range: '"+conf+"'")}const lower=parseInt(split[0],10)+valueIndexOffset,upper=parseInt(split[1],10)+valueIndexOffset;if(isNaN(lower)){throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)")}else if(isNaN(upper)){throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)")}if(lower<0||upper>=this[type].length){throw new TypeError("CronPattern: Value out of range: '"+conf+"'")}if(lower>upper){throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'")}for(let i=lower;i<=upper;i++){this[type][i]=1}};CronPattern.prototype.handleStepping=function(conf,type){const split=conf.split("/");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+conf+"'")}let start=0;if(split[0]!=="*"){start=parseInt(split[0],10)}const steps=parseInt(split[1],10);if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");for(let i=start;i<this[type].length;i+=steps){this[type][i]=1}};CronPattern.prototype.replaceAlphaDays=function(conf){return conf.replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")};CronPattern.prototype.replaceAlphaMonths=function(conf){return conf.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")};const maxDelay=Math.pow(2,32-1)-1;function Cron(pattern,options,func){if(!(this instanceof Cron)){return new Cron(pattern,options,func)}if(typeof options==="function"){func=options;options=void 0}this.options=this.processOptions(options);if(pattern&&pattern instanceof Date){this.once=new CronDate(pattern,this.options.timezone)}else if(pattern&&typeof pattern==="string"&&pattern.indexOf(":")>0){this.once=new CronDate(pattern,this.options.timezone)}else{this.pattern=new CronPattern(pattern,this.options.timezone)}if(func!==void 0){this.fn=func;this.schedule()}return this}Cron.prototype.processOptions=function(options){if(options===void 0){options={}}options.paused=options.paused===void 0?false:options.paused;options.maxRuns=options.maxRuns===void 0?Infinity:options.maxRuns;options.catch=options.catch===void 0?false:options.catch;options.kill=false;if(options.startAt){options.startAt=new CronDate(options.startAt,options.timezone)}if(options.stopAt){options.stopAt=new CronDate(options.stopAt,options.timezone)}return options};Cron.prototype.next=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);return next?next.getDate():null};Cron.prototype.enumerate=function(n,previous){let enumeration=[];while(n--&&(previous=this.next(previous))){enumeration.push(previous)}return enumeration};Cron.prototype.running=function(){const msLeft=this.msToNext(this.previousrun);const running=!this.options.paused&&this.fn!==void 0;return msLeft!==null&&running};Cron.prototype.previous=function(){return this.previousrun?this.previousrun.getDate():null};Cron.prototype._next=function(prev){if(this.options.startAt&&prev&&prev.getTime(true)<this.options.startAt.getTime(true)){prev=this.options.startAt}const nextRun=this.once||new CronDate(prev,this.options.timezone).increment(this.pattern);if(this.once&&this.once.getTime(true)<=prev.getTime(true)){return null}else if(nextRun===null||this.options.maxRuns<=0||this.options.kill||this.options.stopAt&&nextRun.getTime(true)>=this.options.stopAt.getTime(true)){return null}else{return nextRun}};Cron.prototype.msToNext=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);if(next){return next.getTime(true)-prev.getTime(true)}else{return null}};Cron.prototype.stop=function(){this.options.kill=true;if(this.currentTimeout){clearTimeout(this.currentTimeout)}};Cron.prototype.pause=function(){return(this.options.paused=true)&&!this.options.kill};Cron.prototype.resume=function(){return!(this.options.paused=false)&&!this.options.kill};Cron.prototype.schedule=function(func){if(func&&this.fn){throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.")}else if(func){this.fn=func}let waitMs=this.msToNext(this.previousrun);if(waitMs===null)return this;if(waitMs>maxDelay){waitMs=maxDelay}this.currentTimeout=setTimeout(()=>{if(waitMs!==maxDelay&&!this.options.paused){this.options.maxRuns--;if(this.options.catch){try{this.fn(this,this.options.context)}catch(_e){}}else{this.fn(this,this.options.context)}this.previousrun=new CronDate(void 0,this.options.timezone)}this.schedule()},waitMs);return this};return Cron});
@@ -1 +1 @@
1
- {"version":3,"sources":["dist/croner.cjs"],"names":["global","factory","exports","module","define","amd","globalThis","self","Cron","this","convertTZ","date","tzString","Date","toLocaleString","timeZone","CronDate","timezone","fromDate","fromString","fromCronDate","TypeError","prototype","milliseconds","getMilliseconds","seconds","getSeconds","minutes","getMinutes","hours","getHours","days","getDate","months","getMonth","years","getFullYear","apply","newDate","str","parsedDate","parseISOLocal","isNaN","increment","pattern","rerun","origTime","getTime","findNext","target","offset","override","startPos","let","i","length","daysOfWeek","getDay","lastDayOfMonth","baseDate","setDate","resetPrevious","doing","toDo","currentValue","internal","targetDate","dateTimeString","dateTimeStringSplit","split","NaN","year","parseInt","month","day","hour","minute","second","generatedDate","indexOf","UTC","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","CronPattern","Array","fill","parse","constructor","String","parts","trim","replace","unshift","toUpperCase","replaceAlphaMonths","replaceAlphaDays","initDate","throwAtIllegalCharacters","partToArray","type","conf","valueIndexOffset","recursed","arr","Error","handleRangeWithStepping","handleRange","handleStepping","handleNumber","reValidCron","test","matches","match","lower","upper","steps","start","maxDelay","Math","pow","options","func","processOptions","once","fn","schedule","paused","maxRuns","Infinity","catch","kill","startAt","stopAt","next","prev","_next","enumerate","n","previous","enumeration","push","running","msLeft","msToNext","previousrun","nextRun","stop","currentTimeout","clearTimeout","pause","resume","waitMs","setTimeout","context","_e"],"mappings":"CAAA,SAAWA,OAAQC,gBACXC,UAAY,iBAAmBC,SAAW,YAAcA,OAAOD,QAAUD,iBACzEG,SAAW,YAAcA,OAAOC,IAAMD,OAAOH,UACnDD,cAAgBM,aAAe,YAAcA,WAAaN,QAAUO,KAAMP,OAAOQ,KAAOP,YAH1F,CAIGQ,KAAM,wBAkBR,SAASC,UAAUC,KAAMC,UACxB,OAAO,IAAIC,KAAKF,KAAKG,eAAe,QAAS,CAACC,SAAUH,YAUzD,SAASI,SAAUL,KAAMM,UAExBR,KAAKQ,SAAWA,SAEhB,GAAIN,MAAQA,gBAAgBE,KAAM,CACjCJ,KAAKS,SAASP,WACR,GAAIA,YAAc,EAAG,CAC3BF,KAAKS,SAAS,IAAIL,WACZ,GAAIF,aAAeA,OAAS,SAAU,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KAAKkI,MAAMD,MACxB,GAAID,KAAO,CACV,OAAQA,KAAK1F,QAAQ,MAAQ2F,KAAK3F,QAAQ,UACpC,CACN,OAAO,OAQTvC,KAAKc,UAAUgI,KAAO,WACrB7I,KAAKmH,QAAQU,KAAO,KAEpB,GAAI7H,KAAK8I,eAAiB,CACzBC,aAAc/I,KAAK8I,kBAUrB/I,KAAKc,UAAUmI,MAAQ,WACtB,OAAQhJ,KAAKmH,QAAQM,OAAS,QAAUzH,KAAKmH,QAAQU,MAStD9H,KAAKc,UAAUoI,OAAS,WACvB,QAASjJ,KAAKmH,QAAQM,OAAS,SAAWzH,KAAKmH,QAAQU,MAUxD9H,KAAKc,UAAU2G,SAAW,SAAUJ,MAGnC,GAAIA,MAAQpH,KAAKuH,GAAI,CACpB,MAAM,IAAIpB,MAAM,0FAGV,GAAIiB,KAAM,CAChBpH,KAAKuH,GAAKH,KAIXxE,IAAIsG,OAASlJ,KAAK0I,SAAS1I,KAAK2I,aAChC,GAAMO,SAAW,KAAQ,OAAOlJ,KAGhC,GAAIkJ,OAASlC,SAAW,CACvBkC,OAASlC,SAIVhH,KAAK8I,eAAiBK,WAAW,KAEhC,GAAID,SAAWlC,WAAahH,KAAKmH,QAAQM,OAAS,CAEjDzH,KAAKmH,QAAQO,UAGb,GAAI1H,KAAKmH,QAAQS,MAAO,CACvB,IACC5H,KAAKuH,GAAGvH,KAAMA,KAAKmH,QAAQiC,SAC1B,MAAOC,UAGH,CACNrJ,KAAKuH,GAAGvH,KAAMA,KAAKmH,QAAQiC,SAG5BpJ,KAAK2I,YAAc,IAAIpI,cAAc,EAAGP,KAAKmH,QAAQ3G,UAKtDR,KAAKwH,YAEH0B,QAEH,OAAOlJ,MAIR,OAAOD"}
1
+ {"version":3,"sources":["dist/croner.cjs"],"names":["global","factory","exports","module","define","amd","globalThis","self","Cron","this","convertTZ","date","tzString","Date","toLocaleString","timeZone","CronDate","timezone","fromDate","fromString","fromCronDate","TypeError","prototype","milliseconds","getMilliseconds","seconds","getSeconds","minutes","getMinutes","hours","getHours","days","getDate","months","getMonth","years","getFullYear","apply","newDate","str","parsedDate","parseISOLocal","isNaN","increment","pattern","rerun","origTime","getTime","findNext","target","offset","override","startPos","let","i","length","lastDayOfMonth","baseDate","setDate","resetPrevious","doing","toDo","currentValue","daysOfWeek","getDay","internal","targetDate","dateTimeString","dateTimeStringSplit","split","NaN","year","parseInt","month","day","hour","minute","second","generatedDate","indexOf","UTC","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","CronPattern","Array","fill","parse","constructor","String","parts","trim","replace","unshift","toUpperCase","replaceAlphaMonths","replaceAlphaDays","initDate","throwAtIllegalCharacters","partToArray","type","conf","valueIndexOffset","recursed","arr","Error","handleRangeWithStepping","handleRange","handleStepping","handleNumber","reValidCron","test","matches","match","lower","upper","steps","start","maxDelay","Math","pow","options","func","processOptions","once","fn","schedule","paused","maxRuns","Infinity","catch","kill","startAt","stopAt","next","prev","_next","enumerate","n","previous","enumeration","push","running","msLeft","msToNext","previousrun","nextRun","stop","currentTimeout","clearTimeout","pause","resume","waitMs","setTimeout","context","_e"],"mappings":"CAAA,SAAWA,OAAQC,gBACXC,UAAY,iBAAmBC,SAAW,YAAcA,OAAOD,QAAUD,iBACzEG,SAAW,YAAcA,OAAOC,IAAMD,OAAOH,UACnDD,cAAgBM,aAAe,YAAcA,WAAaN,QAAUO,KAAMP,OAAOQ,KAAOP,YAH1F,CAIGQ,KAAM,wBAkBR,SAASC,UAAUC,KAAMC,UACxB,OAAO,IAAIC,KAAKF,KAAKG,eAAe,QAAS,CAACC,SAAUH,YAUzD,SAASI,SAAUL,KAAMM,UAExBR,KAAKQ,SAAWA,SAEhB,GAAIN,MAAQA,gBAAgBE,KAAM,CACjCJ,KAAKS,SAASP,WACR,GAAIA,YAAc,EAAG,CAC3BF,KAAKS,SAAS,IAAIL,WACZ,GAAIF,aAAeA,OAAS,SAAU,CAC5CF,KAAKU,WAAWR,WACV,GAA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AO,CACV,OAAQA,KAAK1F,QAAQ,MAAQ2F,KAAK3F,QAAQ,UACpC,CACN,OAAO,OAQTvC,KAAKc,UAAUgI,KAAO,WACrB7I,KAAKmH,QAAQU,KAAO,KAEpB,GAAI7H,KAAK8I,eAAiB,CACzBC,aAAc/I,KAAK8I,kBAUrB/I,KAAKc,UAAUmI,MAAQ,WACtB,OAAQhJ,KAAKmH,QAAQM,OAAS,QAAUzH,KAAKmH,QAAQU,MAStD9H,KAAKc,UAAUoI,OAAS,WACvB,QAASjJ,KAAKmH,QAAQM,OAAS,SAAWzH,KAAKmH,QAAQU,MAUxD9H,KAAKc,UAAU2G,SAAW,SAAUJ,MAGnC,GAAIA,MAAQpH,KAAKuH,GAAI,CACpB,MAAM,IAAIpB,MAAM,0FAGV,GAAIiB,KAAM,CAChBpH,KAAKuH,GAAKH,KAIXxE,IAAIsG,OAASlJ,KAAK0I,SAAS1I,KAAK2I,aAChC,GAAMO,SAAW,KAAQ,OAAOlJ,KAGhC,GAAIkJ,OAASlC,SAAW,CACvBkC,OAASlC,SAIVhH,KAAK8I,eAAiBK,WAAW,KAEhC,GAAID,SAAWlC,WAAahH,KAAKmH,QAAQM,OAAS,CAEjDzH,KAAKmH,QAAQO,UAGb,GAAI1H,KAAKmH,QAAQS,MAAO,CACvB,IACC5H,KAAKuH,GAAGvH,KAAMA,KAAKmH,QAAQiC,SAC1B,MAAOC,UAGH,CACNrJ,KAAKuH,GAAGvH,KAAMA,KAAKmH,QAAQiC,SAG5BpJ,KAAK2I,YAAc,IAAIpI,cAAc,EAAGP,KAAKmH,QAAQ3G,UAKtDR,KAAKwH,YAEH0B,QAEH,OAAOlJ,MAIR,OAAOD"}
@@ -1 +1 @@
1
- function convertTZ(date,tzString){return new Date(date.toLocaleString("en-US",{timeZone:tzString}))}function CronDate(date,timezone){this.timezone=timezone;if(date&&date instanceof Date){this.fromDate(date)}else if(date===void 0){this.fromDate(new Date)}else if(date&&typeof date==="string"){this.fromString(date)}else if(date instanceof CronDate){this.fromCronDate(date)}else{throw new TypeError("CronDate: Invalid type ("+typeof date+") passed as parameter to CronDate constructor")}}CronDate.prototype.fromDate=function(date){if(this.timezone){date=convertTZ(date,this.timezone)}this.milliseconds=date.getMilliseconds();this.seconds=date.getSeconds();this.minutes=date.getMinutes();this.hours=date.getHours();this.days=date.getDate();this.months=date.getMonth();this.years=date.getFullYear()};CronDate.prototype.fromCronDate=function(date){this.timezone=date.timezone;this.milliseconds=date.milliseconds;this.seconds=date.seconds;this.minutes=date.minutes;this.hours=date.hours;this.days=date.days;this.months=date.months;this.years=date.years};CronDate.prototype.apply=function(){const newDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);this.milliseconds=newDate.getMilliseconds();this.seconds=newDate.getSeconds();this.minutes=newDate.getMinutes();this.hours=newDate.getHours();this.days=newDate.getDate();this.months=newDate.getMonth();this.years=newDate.getFullYear()};CronDate.prototype.fromString=function(str){const parsedDate=this.parseISOLocal(str);if(isNaN(parsedDate)){throw new TypeError("CronDate: Provided string value for CronDate could not be parsed as date.")}this.fromDate(parsedDate)};CronDate.prototype.increment=function(pattern,rerun){if(!rerun){this.seconds+=1}this.milliseconds=0;const origTime=this.getTime(),findNext=(target,pattern,offset,override)=>{const startPos=override===void 0?this[target]+offset:0+offset;for(let i=startPos;i<pattern[target].length;i++){if(pattern[target][i]&&(target!=="days"||pattern.daysOfWeek[this.getDate(true).getDay()])){if(target==="days"&&pattern.lastDayOfMonth){let baseDate=this.getDate(true);baseDate.setDate(i-offset+1);if(baseDate.getMonth()!==this["months"]){this[target]=i-offset;return true}}else{this[target]=i-offset;return true}}}return false},resetPrevious=offset=>{while(doing+offset>=0){findNext(toDo[doing+offset][0],pattern,toDo[doing+offset][2],0);doing--}};const toDo=[["seconds","minutes",0],["minutes","hours",0],["hours","days",0],["days","months",-1],["months","years",0]];let doing=0;while(doing<5){let currentValue=this[toDo[doing][0]];if(!findNext(toDo[doing][0],pattern,toDo[doing][2])){this[toDo[doing][1]]++;resetPrevious(0)}else if(currentValue!==this[toDo[doing][0]]){resetPrevious(-1)}if(this.years>=4e3){return null}doing++}if(origTime!=this.getTime()){this.apply();return this.increment(pattern,true)}else{return this}};CronDate.prototype.getDate=function(internal){const targetDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);if(internal||!this.timezone){return targetDate}else{const offset=convertTZ(targetDate,this.timezone).getTime()-targetDate.getTime();return new Date(targetDate.getTime()-offset)}};CronDate.prototype.getTime=function(internal){return this.getDate(internal).getTime()};CronDate.prototype.parseISOLocal=function(dateTimeString){const dateTimeStringSplit=dateTimeString.split(/\D/);if(dateTimeStringSplit.length<6){return NaN}const year=parseInt(dateTimeStringSplit[0],10),month=parseInt(dateTimeStringSplit[1],10),day=parseInt(dateTimeStringSplit[2],10),hour=parseInt(dateTimeStringSplit[3],10),minute=parseInt(dateTimeStringSplit[4],10),second=parseInt(dateTimeStringSplit[5],10);if(isNaN(year)||isNaN(month)||isNaN(day)||isNaN(hour)||isNaN(minute)||isNaN(second)){return NaN}else{let generatedDate;if(dateTimeString.indexOf("Z")>0){generatedDate=new Date(Date.UTC(year,month-1,day,hour,minute,second));if(year==generatedDate.getUTCFullYear()&&month==generatedDate.getUTCMonth()+1&&day==generatedDate.getUTCDate()&&hour==generatedDate.getUTCHours()&&minute==generatedDate.getUTCMinutes()&&second==generatedDate.getUTCSeconds()){return generatedDate}else{return NaN}}else{generatedDate=new Date(year,month-1,day,hour,minute,second);if(year==generatedDate.getFullYear()&&month==generatedDate.getMonth()+1&&day==generatedDate.getDate()&&hour==generatedDate.getHours()&&minute==generatedDate.getMinutes()&&second==generatedDate.getSeconds()){return generatedDate}else{return NaN}}}};function CronPattern(pattern,timezone){this.pattern=pattern;this.timezone=timezone;this.seconds=Array(60).fill(0);this.minutes=Array(60).fill(0);this.hours=Array(24).fill(0);this.days=Array(31).fill(0);this.months=Array(12).fill(0);this.daysOfWeek=Array(8).fill(0);this.lastDayOfMonth=false;this.parse()}CronPattern.prototype.parse=function(){if(!(typeof this.pattern==="string"||this.pattern.constructor===String)){throw new TypeError("CronPattern: Pattern has to be of type string.")}const parts=this.pattern.trim().replace(/\s+/g," ").split(" ");if(parts.length<5||parts.length>6){throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exacly five or six space separated parts required.")}if(parts.length===5){parts.unshift("0")}if(parts[3].toUpperCase()=="L"){parts[3]="28,29,30,31";this.lastDayOfMonth=true}parts[4]=this.replaceAlphaMonths(parts[4]);parts[5]=this.replaceAlphaDays(parts[5]);let initDate=new CronDate(new Date,this.timezone).getDate(true);parts[0]=parts[0].replace("?",initDate.getSeconds());parts[1]=parts[1].replace("?",initDate.getMinutes());parts[2]=parts[2].replace("?",initDate.getHours());parts[3]=parts[3].replace("?",initDate.getDate());parts[4]=parts[4].replace("?",initDate.getMonth()+1);parts[5]=parts[5].replace("?",initDate.getDay());this.throwAtIllegalCharacters(parts);this.partToArray("seconds",parts[0],0);this.partToArray("minutes",parts[1],0);this.partToArray("hours",parts[2],0);this.partToArray("days",parts[3],-1);this.partToArray("months",parts[4],-1);this.partToArray("daysOfWeek",parts[5],0);if(this.daysOfWeek[7]){this.daysOfWeek[0]=1}};CronPattern.prototype.partToArray=function(type,conf,valueIndexOffset,recursed){const arr=this[type];if(conf==="*"){for(let i=0;i<arr.length;i++){arr[i]=1}return}const split=conf.split(",");if(split.length>1){for(let i=0;i<split.length;i++){this.partToArray(type,split[i],valueIndexOffset,true)}}else if(conf.indexOf("-")!==-1&&conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRangeWithStepping(conf,type,valueIndexOffset)}else if(conf.indexOf("-")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRange(conf,type,valueIndexOffset)}else if(conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleStepping(conf,type,valueIndexOffset)}else{this.handleNumber(conf,type,valueIndexOffset)}};CronPattern.prototype.throwAtIllegalCharacters=function(parts){const reValidCron=/[^/*0-9,-]+/;for(let i=0;i<parts.length;i++){if(reValidCron.test(parts[i])){throw new TypeError("CronPattern: configuration entry "+i+" ("+parts[i]+") contains illegal characters.")}}};CronPattern.prototype.handleNumber=function(conf,type,valueIndexOffset){const i=parseInt(conf,10)+valueIndexOffset;if(i<0||i>=this[type].length){throw new TypeError("CronPattern: "+type+" value out of range: '"+conf+"'")}this[type][i]=1};CronPattern.prototype.handleRangeWithStepping=function(conf,type,valueIndexOffset){const matches=conf.match(/^(\d+)-(\d+)\/(\d+)$/);if(matches===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+conf+"'");let[,lower,upper,steps]=matches;lower=parseInt(lower,10)+valueIndexOffset;upper=parseInt(upper,10)+valueIndexOffset;steps=parseInt(steps,10)+valueIndexOffset;if(isNaN(lower))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(upper))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");if(lower<0||upper>=this[type].length)throw new TypeError("CronPattern: Value out of range: '"+conf+"'");if(lower>upper)throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'");for(let i=lower;i<=upper;i+=steps){this[type][i+valueIndexOffset]=1}};CronPattern.prototype.handleRange=function(conf,type,valueIndexOffset){const split=conf.split("-");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal range: '"+conf+"'")}const lower=parseInt(split[0],10)+valueIndexOffset,upper=parseInt(split[1],10)+valueIndexOffset;if(isNaN(lower)){throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)")}else if(isNaN(upper)){throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)")}if(lower<0||upper>=this[type].length){throw new TypeError("CronPattern: Value out of range: '"+conf+"'")}if(lower>upper){throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'")}for(let i=lower;i<=upper;i++){this[type][i+valueIndexOffset]=1}};CronPattern.prototype.handleStepping=function(conf,type,valueIndexOffset){const split=conf.split("/");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+conf+"'")}let start=0;if(split[0]!=="*"){start=parseInt(split[0],10)}const steps=parseInt(split[1],10);if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");for(let i=start;i<this[type].length;i+=steps){this[type][i+valueIndexOffset]=1}};CronPattern.prototype.replaceAlphaDays=function(conf){return conf.replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")};CronPattern.prototype.replaceAlphaMonths=function(conf){return conf.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")};const maxDelay=Math.pow(2,32-1)-1;function Cron(pattern,options,func){if(!(this instanceof Cron)){return new Cron(pattern,options,func)}if(typeof options==="function"){func=options;options=void 0}this.options=this.processOptions(options);if(pattern&&pattern instanceof Date){this.once=new CronDate(pattern,this.options.timezone)}else if(pattern&&typeof pattern==="string"&&pattern.indexOf(":")>0){this.once=new CronDate(pattern,this.options.timezone)}else{this.pattern=new CronPattern(pattern,this.options.timezone)}if(func!==void 0){this.fn=func;this.schedule()}return this}Cron.prototype.processOptions=function(options){if(options===void 0){options={}}options.paused=options.paused===void 0?false:options.paused;options.maxRuns=options.maxRuns===void 0?Infinity:options.maxRuns;options.catch=options.catch===void 0?false:options.catch;options.kill=false;if(options.startAt){options.startAt=new CronDate(options.startAt,options.timezone)}if(options.stopAt){options.stopAt=new CronDate(options.stopAt,options.timezone)}return options};Cron.prototype.next=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);return next?next.getDate():null};Cron.prototype.enumerate=function(n,previous){let enumeration=[];while(n--&&(previous=this.next(previous))){enumeration.push(previous)}return enumeration};Cron.prototype.running=function(){const msLeft=this.msToNext(this.previousrun);const running=!this.options.paused&&this.fn!==void 0;return msLeft!==null&&running};Cron.prototype.previous=function(){return this.previousrun?this.previousrun.getDate():null};Cron.prototype._next=function(prev){if(this.options.startAt&&prev&&prev.getTime(true)<this.options.startAt.getTime(true)){prev=this.options.startAt}const nextRun=this.once||new CronDate(prev,this.options.timezone).increment(this.pattern);if(this.once&&this.once.getTime(true)<=prev.getTime(true)){return null}else if(nextRun===null||this.options.maxRuns<=0||this.options.kill||this.options.stopAt&&nextRun.getTime(true)>=this.options.stopAt.getTime(true)){return null}else{return nextRun}};Cron.prototype.msToNext=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);if(next){return next.getTime(true)-prev.getTime(true)}else{return null}};Cron.prototype.stop=function(){this.options.kill=true;if(this.currentTimeout){clearTimeout(this.currentTimeout)}};Cron.prototype.pause=function(){return(this.options.paused=true)&&!this.options.kill};Cron.prototype.resume=function(){return!(this.options.paused=false)&&!this.options.kill};Cron.prototype.schedule=function(func){if(func&&this.fn){throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.")}else if(func){this.fn=func}let waitMs=this.msToNext(this.previousrun);if(waitMs===null)return this;if(waitMs>maxDelay){waitMs=maxDelay}this.currentTimeout=setTimeout(()=>{if(waitMs!==maxDelay&&!this.options.paused){this.options.maxRuns--;if(this.options.catch){try{this.fn(this,this.options.context)}catch(_e){}}else{this.fn(this,this.options.context)}this.previousrun=new CronDate(void 0,this.options.timezone)}this.schedule()},waitMs);return this};export{Cron,Cron as default};
1
+ function convertTZ(date,tzString){return new Date(date.toLocaleString("en-US",{timeZone:tzString}))}function CronDate(date,timezone){this.timezone=timezone;if(date&&date instanceof Date){this.fromDate(date)}else if(date===void 0){this.fromDate(new Date)}else if(date&&typeof date==="string"){this.fromString(date)}else if(date instanceof CronDate){this.fromCronDate(date)}else{throw new TypeError("CronDate: Invalid type ("+typeof date+") passed as parameter to CronDate constructor")}}CronDate.prototype.fromDate=function(date){if(this.timezone){date=convertTZ(date,this.timezone)}this.milliseconds=date.getMilliseconds();this.seconds=date.getSeconds();this.minutes=date.getMinutes();this.hours=date.getHours();this.days=date.getDate();this.months=date.getMonth();this.years=date.getFullYear()};CronDate.prototype.fromCronDate=function(date){this.timezone=date.timezone;this.milliseconds=date.milliseconds;this.seconds=date.seconds;this.minutes=date.minutes;this.hours=date.hours;this.days=date.days;this.months=date.months;this.years=date.years};CronDate.prototype.apply=function(){const newDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);this.milliseconds=newDate.getMilliseconds();this.seconds=newDate.getSeconds();this.minutes=newDate.getMinutes();this.hours=newDate.getHours();this.days=newDate.getDate();this.months=newDate.getMonth();this.years=newDate.getFullYear()};CronDate.prototype.fromString=function(str){const parsedDate=this.parseISOLocal(str);if(isNaN(parsedDate)){throw new TypeError("CronDate: Provided string value for CronDate could not be parsed as date.")}this.fromDate(parsedDate)};CronDate.prototype.increment=function(pattern,rerun){if(!rerun){this.seconds+=1}this.milliseconds=0;const origTime=this.getTime(),findNext=(target,pattern,offset,override)=>{const startPos=override===void 0?this[target]+offset:0+offset;for(let i=startPos;i<pattern[target].length;i++){if(pattern[target][i]){if(target==="days"&&pattern.lastDayOfMonth){let baseDate=this.getDate(true);baseDate.setDate(i-offset+1);if(baseDate.getMonth()!==this["months"]){this[target]=i-offset;return true}}else{this[target]=i-offset;return true}}}return false},resetPrevious=offset=>{while(doing+offset>=0){findNext(toDo[doing+offset][0],pattern,toDo[doing+offset][2],0);doing--}};const toDo=[["seconds","minutes",0],["minutes","hours",0],["hours","days",0],["days","months",-1],["months","years",0]];let doing=0;while(doing<5){let currentValue=this[toDo[doing][0]];if(!findNext(toDo[doing][0],pattern,toDo[doing][2])){this[toDo[doing][1]]++;resetPrevious(0)}else if(currentValue!==this[toDo[doing][0]]){resetPrevious(-1)}if(this.years>=4e3){return null}doing++}while(!pattern.daysOfWeek[this.getDate(true).getDay()]){this.days+=1;doing=2;resetPrevious()}if(origTime!=this.getTime()){this.apply();return this.increment(pattern,true)}else{return this}};CronDate.prototype.getDate=function(internal){const targetDate=new Date(this.years,this.months,this.days,this.hours,this.minutes,this.seconds,this.milliseconds);if(internal||!this.timezone){return targetDate}else{const offset=convertTZ(targetDate,this.timezone).getTime()-targetDate.getTime();return new Date(targetDate.getTime()-offset)}};CronDate.prototype.getTime=function(internal){return this.getDate(internal).getTime()};CronDate.prototype.parseISOLocal=function(dateTimeString){const dateTimeStringSplit=dateTimeString.split(/\D/);if(dateTimeStringSplit.length<6){return NaN}const year=parseInt(dateTimeStringSplit[0],10),month=parseInt(dateTimeStringSplit[1],10),day=parseInt(dateTimeStringSplit[2],10),hour=parseInt(dateTimeStringSplit[3],10),minute=parseInt(dateTimeStringSplit[4],10),second=parseInt(dateTimeStringSplit[5],10);if(isNaN(year)||isNaN(month)||isNaN(day)||isNaN(hour)||isNaN(minute)||isNaN(second)){return NaN}else{let generatedDate;if(dateTimeString.indexOf("Z")>0){generatedDate=new Date(Date.UTC(year,month-1,day,hour,minute,second));if(year==generatedDate.getUTCFullYear()&&month==generatedDate.getUTCMonth()+1&&day==generatedDate.getUTCDate()&&hour==generatedDate.getUTCHours()&&minute==generatedDate.getUTCMinutes()&&second==generatedDate.getUTCSeconds()){return generatedDate}else{return NaN}}else{generatedDate=new Date(year,month-1,day,hour,minute,second);if(year==generatedDate.getFullYear()&&month==generatedDate.getMonth()+1&&day==generatedDate.getDate()&&hour==generatedDate.getHours()&&minute==generatedDate.getMinutes()&&second==generatedDate.getSeconds()){return generatedDate}else{return NaN}}}};function CronPattern(pattern,timezone){this.pattern=pattern;this.timezone=timezone;this.seconds=Array(60).fill(0);this.minutes=Array(60).fill(0);this.hours=Array(24).fill(0);this.days=Array(31).fill(0);this.months=Array(12).fill(0);this.daysOfWeek=Array(8).fill(0);this.lastDayOfMonth=false;this.parse()}CronPattern.prototype.parse=function(){if(!(typeof this.pattern==="string"||this.pattern.constructor===String)){throw new TypeError("CronPattern: Pattern has to be of type string.")}const parts=this.pattern.trim().replace(/\s+/g," ").split(" ");if(parts.length<5||parts.length>6){throw new TypeError("CronPattern: invalid configuration format ('"+this.pattern+"'), exacly five or six space separated parts required.")}if(parts.length===5){parts.unshift("0")}if(parts[3].toUpperCase()=="L"){parts[3]="28,29,30,31";this.lastDayOfMonth=true}parts[4]=this.replaceAlphaMonths(parts[4]);parts[5]=this.replaceAlphaDays(parts[5]);let initDate=new CronDate(new Date,this.timezone).getDate(true);parts[0]=parts[0].replace("?",initDate.getSeconds());parts[1]=parts[1].replace("?",initDate.getMinutes());parts[2]=parts[2].replace("?",initDate.getHours());parts[3]=parts[3].replace("?",initDate.getDate());parts[4]=parts[4].replace("?",initDate.getMonth()+1);parts[5]=parts[5].replace("?",initDate.getDay());this.throwAtIllegalCharacters(parts);this.partToArray("seconds",parts[0],0);this.partToArray("minutes",parts[1],0);this.partToArray("hours",parts[2],0);this.partToArray("days",parts[3],-1);this.partToArray("months",parts[4],-1);this.partToArray("daysOfWeek",parts[5],0);if(this.daysOfWeek[7]){this.daysOfWeek[0]=1}};CronPattern.prototype.partToArray=function(type,conf,valueIndexOffset,recursed){const arr=this[type];if(conf==="*"){for(let i=0;i<arr.length;i++){arr[i]=1}return}const split=conf.split(",");if(split.length>1){for(let i=0;i<split.length;i++){this.partToArray(type,split[i],valueIndexOffset,true)}}else if(conf.indexOf("-")!==-1&&conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRangeWithStepping(conf,type,valueIndexOffset)}else if(conf.indexOf("-")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleRange(conf,type,valueIndexOffset)}else if(conf.indexOf("/")!==-1){if(recursed)throw new Error("CronPattern: Range with stepping cannot coexist with ,");this.handleStepping(conf,type,valueIndexOffset)}else{this.handleNumber(conf,type,valueIndexOffset)}};CronPattern.prototype.throwAtIllegalCharacters=function(parts){const reValidCron=/[^/*0-9,-]+/;for(let i=0;i<parts.length;i++){if(reValidCron.test(parts[i])){throw new TypeError("CronPattern: configuration entry "+i+" ("+parts[i]+") contains illegal characters.")}}};CronPattern.prototype.handleNumber=function(conf,type,valueIndexOffset){const i=parseInt(conf,10)+valueIndexOffset;if(i<0||i>=this[type].length){throw new TypeError("CronPattern: "+type+" value out of range: '"+conf+"'")}this[type][i]=1};CronPattern.prototype.handleRangeWithStepping=function(conf,type,valueIndexOffset){const matches=conf.match(/^(\d+)-(\d+)\/(\d+)$/);if(matches===null)throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '"+conf+"'");let[,lower,upper,steps]=matches;lower=parseInt(lower,10)+valueIndexOffset;upper=parseInt(upper,10)+valueIndexOffset;steps=parseInt(steps,10);if(isNaN(lower))throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");if(isNaN(upper))throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");if(lower<0||upper>=this[type].length)throw new TypeError("CronPattern: Value out of range: '"+conf+"'");if(lower>upper)throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'");for(let i=lower;i<=upper;i+=steps){this[type][i]=1}};CronPattern.prototype.handleRange=function(conf,type,valueIndexOffset){const split=conf.split("-");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal range: '"+conf+"'")}const lower=parseInt(split[0],10)+valueIndexOffset,upper=parseInt(split[1],10)+valueIndexOffset;if(isNaN(lower)){throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)")}else if(isNaN(upper)){throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)")}if(lower<0||upper>=this[type].length){throw new TypeError("CronPattern: Value out of range: '"+conf+"'")}if(lower>upper){throw new TypeError("CronPattern: From value is larger than to value: '"+conf+"'")}for(let i=lower;i<=upper;i++){this[type][i]=1}};CronPattern.prototype.handleStepping=function(conf,type){const split=conf.split("/");if(split.length!==2){throw new TypeError("CronPattern: Syntax error, illegal stepping: '"+conf+"'")}let start=0;if(split[0]!=="*"){start=parseInt(split[0],10)}const steps=parseInt(split[1],10);if(isNaN(steps))throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");if(steps===0)throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");if(steps>this[type].length)throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");for(let i=start;i<this[type].length;i+=steps){this[type][i]=1}};CronPattern.prototype.replaceAlphaDays=function(conf){return conf.replace(/sun/gi,"0").replace(/mon/gi,"1").replace(/tue/gi,"2").replace(/wed/gi,"3").replace(/thu/gi,"4").replace(/fri/gi,"5").replace(/sat/gi,"6")};CronPattern.prototype.replaceAlphaMonths=function(conf){return conf.replace(/jan/gi,"1").replace(/feb/gi,"2").replace(/mar/gi,"3").replace(/apr/gi,"4").replace(/may/gi,"5").replace(/jun/gi,"6").replace(/jul/gi,"7").replace(/aug/gi,"8").replace(/sep/gi,"9").replace(/oct/gi,"10").replace(/nov/gi,"11").replace(/dec/gi,"12")};const maxDelay=Math.pow(2,32-1)-1;function Cron(pattern,options,func){if(!(this instanceof Cron)){return new Cron(pattern,options,func)}if(typeof options==="function"){func=options;options=void 0}this.options=this.processOptions(options);if(pattern&&pattern instanceof Date){this.once=new CronDate(pattern,this.options.timezone)}else if(pattern&&typeof pattern==="string"&&pattern.indexOf(":")>0){this.once=new CronDate(pattern,this.options.timezone)}else{this.pattern=new CronPattern(pattern,this.options.timezone)}if(func!==void 0){this.fn=func;this.schedule()}return this}Cron.prototype.processOptions=function(options){if(options===void 0){options={}}options.paused=options.paused===void 0?false:options.paused;options.maxRuns=options.maxRuns===void 0?Infinity:options.maxRuns;options.catch=options.catch===void 0?false:options.catch;options.kill=false;if(options.startAt){options.startAt=new CronDate(options.startAt,options.timezone)}if(options.stopAt){options.stopAt=new CronDate(options.stopAt,options.timezone)}return options};Cron.prototype.next=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);return next?next.getDate():null};Cron.prototype.enumerate=function(n,previous){let enumeration=[];while(n--&&(previous=this.next(previous))){enumeration.push(previous)}return enumeration};Cron.prototype.running=function(){const msLeft=this.msToNext(this.previousrun);const running=!this.options.paused&&this.fn!==void 0;return msLeft!==null&&running};Cron.prototype.previous=function(){return this.previousrun?this.previousrun.getDate():null};Cron.prototype._next=function(prev){if(this.options.startAt&&prev&&prev.getTime(true)<this.options.startAt.getTime(true)){prev=this.options.startAt}const nextRun=this.once||new CronDate(prev,this.options.timezone).increment(this.pattern);if(this.once&&this.once.getTime(true)<=prev.getTime(true)){return null}else if(nextRun===null||this.options.maxRuns<=0||this.options.kill||this.options.stopAt&&nextRun.getTime(true)>=this.options.stopAt.getTime(true)){return null}else{return nextRun}};Cron.prototype.msToNext=function(prev){prev=new CronDate(prev,this.options.timezone);const next=this._next(prev);if(next){return next.getTime(true)-prev.getTime(true)}else{return null}};Cron.prototype.stop=function(){this.options.kill=true;if(this.currentTimeout){clearTimeout(this.currentTimeout)}};Cron.prototype.pause=function(){return(this.options.paused=true)&&!this.options.kill};Cron.prototype.resume=function(){return!(this.options.paused=false)&&!this.options.kill};Cron.prototype.schedule=function(func){if(func&&this.fn){throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.")}else if(func){this.fn=func}let waitMs=this.msToNext(this.previousrun);if(waitMs===null)return this;if(waitMs>maxDelay){waitMs=maxDelay}this.currentTimeout=setTimeout(()=>{if(waitMs!==maxDelay&&!this.options.paused){this.options.maxRuns--;if(this.options.catch){try{this.fn(this,this.options.context)}catch(_e){}}else{this.fn(this,this.options.context)}this.previousrun=new CronDate(void 0,this.options.timezone)}this.schedule()},waitMs);return this};export{Cron,Cron as default};
@@ -1 +1 @@
1
- {"version":3,"sources":["dist/croner.mjs"],"names":["convertTZ","date","tzString","Date","toLocaleString","timeZone","CronDate","timezone","this","fromDate","fromString","fromCronDate","TypeError","prototype","milliseconds","getMilliseconds","seconds","getSeconds","minutes","getMinutes","hours","getHours","days","getDate","months","getMonth","years","getFullYear","apply","newDate","str","parsedDate","parseISOLocal","isNaN","increment","pattern","rerun","origTime","getTime","findNext","target","offset","override","startPos","let","i","length","daysOfWeek","getDay","lastDayOfMonth","baseDate","setDate","resetPrevious","doing","toDo","currentValue","internal","targetDate","dateTimeString","dateTimeStringSplit","split","NaN","year","parseInt","month","day","hour","minute","second","generatedDate","indexOf","UTC","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","CronPattern","Array","fill","parse","constructor","String","parts","trim","replace","unshift","toUpperCase","replaceAlphaMonths","replaceAlphaDays","initDate","throwAtIllegalCharacters","partToArray","type","conf","valueIndexOffset","recursed","arr","Error","handleRangeWithStepping","handleRange","handleStepping","handleNumber","reValidCron","test","matches","match","lower","upper","steps","start","maxDelay","Math","pow","Cron","options","func","processOptions","once","fn","schedule","paused","maxRuns","Infinity","catch","kill","startAt","stopAt","next","prev","_next","enumerate","n","previous","enumeration","push","running","msLeft","msToNext","previousrun","nextRun","stop","currentTimeout","clearTimeout","pause","resume","waitMs","setTimeout","context","_e"],"mappings":"AAgBA,SAASA,UAAUC,KAAMC,UACxB,OAAO,IAAIC,KAAKF,KAAKG,eAAe,QAAS,CAACC,SAAUH,YAUzD,SAASI,SAAUL,KAAMM,UAExBC,KAAKD,SAA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","timeZone","CronDate","timezone","this","fromDate","fromString","fromCronDate","TypeError","prototype","milliseconds","getMilliseconds","seconds","getSeconds","minutes","getMinutes","hours","getHours","days","getDate","months","getMonth","years","getFullYear","apply","newDate","str","parsedDate","parseISOLocal","isNaN","increment","pattern","rerun","origTime","getTime","findNext","target","offset","override","startPos","let","i","length","lastDayOfMonth","baseDate","setDate","resetPrevious","doing","toDo","currentValue","daysOfWeek","getDay","internal","targetDate","dateTimeString","dateTimeStringSplit","split","NaN","year","parseInt","month","day","hour","minute","second","generatedDate","indexOf","UTC","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","CronPattern","Array","fill","parse","constructor","String","parts","trim","replace","unshift","toUpperCase","replaceAlphaMonths","replaceAlphaDays","initDate","throwAtIllegalCharacters","partToArray","type","conf","valueIndexOffset","recursed","arr","Error","handleRangeWithStepping","handleRange","handleStepping","handleNumber","reValidCron","test","matches","match","lower","upper","steps","start","maxDelay","Math","pow","Cron","options","func","processOptions","once","fn","schedule","paused","maxRuns","Infinity","catch","kill","startAt","stopAt","next","prev","_next","enumerate","n","previous","enumeration","push","running","msLeft","msToNext","previousrun","nextRun","stop","currentTimeout","clearTimeout","pause","resume","waitMs","setTimeout","context","_e"],"mappings":"AAgBA,SAASA,UAAUC,KAAMC,UACxB,OAAO,IAAIC,KAAKF,KAAKG,eAAe,QAAS,CAACC,SAAUH,YAUzD,SAASI,SAAUL,KAAMM,UAExBC,KAAKD,SAAWA,SAEhB,GAAIN,MAAQA,gBAAgBE,KAAM,CACjCK,KAAKC,SAASR,WACR,GAAIA,YAAc,EAAG,CAC3BO,KAAKC,SAAS,IAAIN,WACZ,GAAIF,aAAeA,OAAS,SAAU,CAC5CO,KAAKE,WAAWT,WACV,GAAIA,gBAAgBK,SAAU,CACpCE,KAAKG,aAAaV,UACZ,CACN,MAAM,IAAIW,UAAU,kCAAoCX,KAAO,kDAUjEK,SAASO,UAAUJ,SAAW,SAAUR,MAEvC,GAAI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AKuI,kBAUrB5B,KAAKtG,UAAUoI,MAAQ,WACtB,OAAQzI,KAAK4G,QAAQM,OAAS,QAAUlH,KAAK4G,QAAQU,MAStDX,KAAKtG,UAAUqI,OAAS,WACvB,QAAS1I,KAAK4G,QAAQM,OAAS,SAAWlH,KAAK4G,QAAQU,MAUxDX,KAAKtG,UAAU4G,SAAW,SAAUJ,MAGnC,GAAIA,MAAQ7G,KAAKgH,GAAI,CACpB,MAAM,IAAIrB,MAAM,0FAGV,GAAIkB,KAAM,CAChB7G,KAAKgH,GAAKH,KAIXzE,IAAIuG,OAAS3I,KAAKmI,SAASnI,KAAKoI,aAChC,GAAMO,SAAW,KAAQ,OAAO3I,KAGhC,GAAI2I,OAASnC,SAAW,CACvBmC,OAASnC,SAIVxG,KAAKuI,eAAiBK,WAAW,KAEhC,GAAID,SAAWnC,WAAaxG,KAAK4G,QAAQM,OAAS,CAEjDlH,KAAK4G,QAAQO,UAGb,GAAInH,KAAK4G,QAAQS,MAAO,CACvB,IACCrH,KAAKgH,GAAGhH,KAAMA,KAAK4G,QAAQiC,SAC1B,MAAOC,UAGH,CACN9I,KAAKgH,GAAGhH,KAAMA,KAAK4G,QAAQiC,SAG5B7I,KAAKoI,YAAc,IAAItI,cAAc,EAAGE,KAAK4G,QAAQ7G,UAKtDC,KAAKiH,YAEH0B,QAEH,OAAO3I,aAIC2G,KAAMA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "croner",
3
- "version": "4.1.93",
3
+ "version": "4.1.97",
4
4
  "description": "Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environmens.",
5
5
  "author": "Hexagon <github.com/hexagon>",
6
6
  "homepage": "https://hexagon.github.io/croner",
@@ -34,10 +34,11 @@
34
34
  ],
35
35
  "scripts": {
36
36
  "test": "uvu test test.croner.js",
37
- "test:dist": "uvu test",
37
+ "test:dist": "uvu test js && npm run test:ts",
38
38
  "test:coverage": "c8 --include=src npm test",
39
39
  "test:lint": "eslint ./**/*.js ./**/*.cjs",
40
40
  "test:lint:fix": "eslint --fix ./**/*.js ./**/*.cjs",
41
+ "test:ts": "tsc --noEmit ./test/ts/basics.ts",
41
42
  "build": "npm update && npm run build:precleanup && npm run test:lint && npm run build:typings && npm run build:dist && npm run build:minify && npm run build:cleanup && npm run test:coverage && npm run test:dist",
42
43
  "build:ci": "npm run test:lint && npm run build:typings && npm run build:dist && npm run build:minify && npm run build:cleanup && npm run test:coverage && npm run test:dist",
43
44
  "build:precleanup": "(rm -rf types/* || del /Q types\\*) && (rm -rf dist/* || del /Q dist\\*)",
package/src/croner.js CHANGED
@@ -58,7 +58,7 @@ const maxDelay = Math.pow(2, 32 - 1) - 1;
58
58
  * Cron entrypoint
59
59
  *
60
60
  * @constructor
61
- * @param {string|date} pattern - Input pattern, input date, or input ISO 8601 time string
61
+ * @param {string|Date} pattern - Input pattern, input date, or input ISO 8601 time string
62
62
  * @param {CronOptions|Function} [options] - Options
63
63
  * @param {Function} [func] - Function to be run each iteration of pattern
64
64
  * @returns {Cron}
@@ -83,7 +83,7 @@ function Cron (pattern, options, func) {
83
83
  if (pattern && (pattern instanceof Date)) {
84
84
  this.once = new CronDate(pattern, this.options.timezone);
85
85
  } else if (pattern && (typeof pattern === "string") && pattern.indexOf(":") > 0) {
86
- /** @type {CronPattern} */
86
+ /** @type {CronDate} */
87
87
  this.once = new CronDate(pattern, this.options.timezone);
88
88
  } else {
89
89
  /** @type {CronPattern} */
@@ -149,7 +149,7 @@ Cron.prototype.next = function (prev) {
149
149
  * Find next n runs, based on supplied date. Strips milliseconds.
150
150
  *
151
151
  * @param {number} n - Number of runs to enumerate
152
- * @param {Date|string} [prev] - Date to start from
152
+ * @param {Date|string} [previous] - Date to start from
153
153
  * @returns {Date[]} - Next n run times
154
154
  */
155
155
  Cron.prototype.enumerate = function (n, previous) {
package/src/date.js CHANGED
@@ -136,7 +136,7 @@ CronDate.prototype.increment = function (pattern, rerun) {
136
136
  for( let i = startPos; i < pattern[target].length; i++ ) {
137
137
 
138
138
  // If pattern matches and, in case of days, weekday matches, go on
139
- if( pattern[target][i] && (target !== "days" || (pattern.daysOfWeek[this.getDate(true).getDay()])) ) {
139
+ if( pattern[target][i] ) {
140
140
 
141
141
  // Special handling for L (last day of month), when we are searching for days
142
142
  if (target === "days" && pattern.lastDayOfMonth) {
@@ -230,6 +230,16 @@ CronDate.prototype.increment = function (pattern, rerun) {
230
230
  doing++;
231
231
  }
232
232
 
233
+ // This is a special case for weekday, as the user isn't able to combine date/month patterns
234
+ // with weekday patterns, it's just to increment days until we get a match.
235
+ while (!pattern.daysOfWeek[this.getDate(true).getDay()]) {
236
+ this.days += 1;
237
+
238
+ // Reset everything before days
239
+ doing = 2;
240
+ resetPrevious();
241
+ }
242
+
233
243
  // If anything changed, recreate this CronDate and run again without incrementing
234
244
  if (origTime != this.getTime()) {
235
245
  this.apply();
package/src/pattern.js CHANGED
@@ -202,7 +202,7 @@ CronPattern.prototype.handleRangeWithStepping = function (conf, type, valueIndex
202
202
  let [, lower, upper, steps] = matches;
203
203
  lower = parseInt(lower, 10) + valueIndexOffset;
204
204
  upper = parseInt(upper, 10) + valueIndexOffset;
205
- steps = parseInt(steps, 10) + valueIndexOffset;
205
+ steps = parseInt(steps, 10);
206
206
 
207
207
  if( isNaN(lower) ) throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");
208
208
  if( isNaN(upper) ) throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");
@@ -215,7 +215,7 @@ CronPattern.prototype.handleRangeWithStepping = function (conf, type, valueIndex
215
215
  if( lower > upper ) throw new TypeError("CronPattern: From value is larger than to value: '" + conf + "'");
216
216
 
217
217
  for (let i = lower; i <= upper; i += steps) {
218
- this[type][(i + valueIndexOffset)] = 1;
218
+ this[type][i] = 1;
219
219
  }
220
220
  };
221
221
 
@@ -254,7 +254,7 @@ CronPattern.prototype.handleRange = function (conf, type, valueIndexOffset) {
254
254
  }
255
255
 
256
256
  for( let i = lower; i <= upper; i++ ) {
257
- this[type][(i + valueIndexOffset)] = 1;
257
+ this[type][i] = 1;
258
258
  }
259
259
  };
260
260
 
@@ -264,9 +264,8 @@ CronPattern.prototype.handleRange = function (conf, type, valueIndexOffset) {
264
264
  *
265
265
  * @param {string} conf - Current part, expected to be a string like * /20 (without the space)
266
266
  * @param {string} type - One of "seconds", "minutes" etc
267
- * @param {number} valueIndexOffset - -1 for day of month, and month, as they start at 1. 0 for seconds, hours, minutes
268
267
  */
269
- CronPattern.prototype.handleStepping = function (conf, type, valueIndexOffset) {
268
+ CronPattern.prototype.handleStepping = function (conf, type) {
270
269
 
271
270
  const split = conf.split("/");
272
271
 
@@ -286,7 +285,7 @@ CronPattern.prototype.handleStepping = function (conf, type, valueIndexOffset) {
286
285
  if( steps > this[type].length ) throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part ("+this[type].length+")");
287
286
 
288
287
  for( let i = start; i < this[type].length; i+= steps ) {
289
- this[type][(i + valueIndexOffset)] = 1;
288
+ this[type][i] = 1;
290
289
  }
291
290
  };
292
291
 
package/src/timezone.js CHANGED
@@ -10,9 +10,9 @@
10
10
  * (for example) will return local time in new york, but getUTCHours()
11
11
  * will return something irrelevant.
12
12
  *
13
- * @param {date} date - Input date
13
+ * @param {Date} date - Input date
14
14
  * @param {string} tzString - Timezone string in Europe/Stockholm format
15
- * @returns {date}
15
+ * @returns {Date}
16
16
  */
17
17
  function convertTZ(date, tzString) {
18
18
  return new Date(date.toLocaleString("en-US", {timeZone: tzString}));
package/types/croner.d.ts CHANGED
@@ -40,26 +40,26 @@ export type CronOptions = {
40
40
  * Cron entrypoint
41
41
  *
42
42
  * @constructor
43
- * @param {string|date} pattern - Input pattern, input date, or input ISO 8601 time string
43
+ * @param {string|Date} pattern - Input pattern, input date, or input ISO 8601 time string
44
44
  * @param {CronOptions|Function} [options] - Options
45
45
  * @param {Function} [func] - Function to be run each iteration of pattern
46
46
  * @returns {Cron}
47
47
  */
48
- export function Cron(pattern: string | date, options?: CronOptions | Function, func?: Function): Cron;
48
+ export function Cron(pattern: string | Date, options?: CronOptions | Function, func?: Function): Cron;
49
49
  export class Cron {
50
50
  /**
51
51
  * Cron entrypoint
52
52
  *
53
53
  * @constructor
54
- * @param {string|date} pattern - Input pattern, input date, or input ISO 8601 time string
54
+ * @param {string|Date} pattern - Input pattern, input date, or input ISO 8601 time string
55
55
  * @param {CronOptions|Function} [options] - Options
56
56
  * @param {Function} [func] - Function to be run each iteration of pattern
57
57
  * @returns {Cron}
58
58
  */
59
- constructor(pattern: string | date, options?: CronOptions | Function, func?: Function);
59
+ constructor(pattern: string | Date, options?: CronOptions | Function, func?: Function);
60
60
  /** @type {CronOptions} */
61
61
  options: CronOptions;
62
- once: CronPattern;
62
+ once: CronDate;
63
63
  /** @type {CronPattern} */
64
64
  pattern: CronPattern;
65
65
  fn: Function;
@@ -75,10 +75,10 @@ export class Cron {
75
75
  * Find next n runs, based on supplied date. Strips milliseconds.
76
76
  *
77
77
  * @param {number} n - Number of runs to enumerate
78
- * @param {Date|string} [prev] - Date to start from
78
+ * @param {Date|string} [previous] - Date to start from
79
79
  * @returns {Date[]} - Next n run times
80
80
  */
81
- enumerate(n: number, previous: any): Date[];
81
+ enumerate(n: number, previous?: Date | string): Date[];
82
82
  /**
83
83
  * Is running?
84
84
  * @public
@@ -132,5 +132,5 @@ export class Cron {
132
132
  currentTimeout: number;
133
133
  previousrun: CronDate;
134
134
  }
135
- import { CronPattern } from "./pattern.js";
136
135
  import { CronDate } from "./date.js";
136
+ import { CronPattern } from "./pattern.js";
@@ -11,8 +11,8 @@ export default convertTZ;
11
11
  * (for example) will return local time in new york, but getUTCHours()
12
12
  * will return something irrelevant.
13
13
  *
14
- * @param {date} date - Input date
14
+ * @param {Date} date - Input date
15
15
  * @param {string} tzString - Timezone string in Europe/Stockholm format
16
- * @returns {date}
16
+ * @returns {Date}
17
17
  */
18
- declare function convertTZ(date: any, tzString: string): any;
18
+ declare function convertTZ(date: Date, tzString: string): Date;