croner 6.0.0-dev.0 → 6.0.0-dev.2

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.
@@ -34,7 +34,6 @@ declare class Cron {
34
34
  * @private
35
35
  */
36
36
  private _states;
37
- pattern: CronPattern;
38
37
  fn: Function | CronOptions;
39
38
  /**
40
39
  * Find next runtime, based on supplied date. Strips milliseconds.
@@ -42,7 +41,7 @@ declare class Cron {
42
41
  * @param {CronDate|Date|string} [prev] - Date to start from
43
42
  * @returns {Date | null} - Next run time
44
43
  */
45
- next(prev?: CronDate | Date | string): Date | null;
44
+ nextRun(prev?: CronDate | Date | string): Date | null;
46
45
  /**
47
46
  * Find next n runs, based on supplied date. Strips milliseconds.
48
47
  *
@@ -50,35 +49,41 @@ declare class Cron {
50
49
  * @param {Date|string} [previous] - Date to start from
51
50
  * @returns {Date[]} - Next n run times
52
51
  */
53
- enumerate(n: number, previous?: Date | string): Date[];
52
+ nextRuns(n: number, previous?: Date | string): Date[];
53
+ /**
54
+ * Return the original pattern, it there was one
55
+ *
56
+ * @returns {string|undefined} - Original pattern
57
+ */
58
+ getPattern(): string | undefined;
54
59
  /**
55
60
  * Indicates wether or not the cron job is active, e.g. awaiting next trigger
56
61
  * @public
57
62
  *
58
63
  * @returns {boolean} - Running or not
59
64
  */
60
- public running(): boolean;
65
+ public isRunning(): boolean;
61
66
  /**
62
67
  * Indicates wether or not the cron job is currently working
63
68
  * @public
64
69
  *
65
70
  * @returns {boolean} - Running or not
66
71
  */
67
- public busy(): boolean;
72
+ public isBusy(): boolean;
68
73
  /**
69
74
  * Return current/previous run start time
70
75
  * @public
71
76
  *
72
77
  * @returns {Date | null} - Previous run time
73
78
  */
74
- public started(): Date | null;
79
+ public currentRun(): Date | null;
75
80
  /**
76
81
  * Return previous run start time
77
82
  * @public
78
83
  *
79
84
  * @returns {Date | null} - Previous run time
80
85
  */
81
- public previous(): Date | null;
86
+ public previousRun(): Date | null;
82
87
  /**
83
88
  * Returns number of milliseconds to next run
84
89
  * @public
@@ -165,68 +170,6 @@ declare namespace Cron {
165
170
  * @returns {CronOptions}
166
171
  */
167
172
  declare function CronOptions(options: CronOptions): CronOptions;
168
- /**
169
- * Name for each part of the cron pattern
170
- * @typedef {("second" | "minute" | "hour" | "day" | "month" | "dayOfWeek")} CronPatternPart
171
- */
172
- /**
173
- * Offset, 0 or -1.
174
- *
175
- * 0 offset is used for seconds,minutes and hours as they start on 1.
176
- * -1 on days and months, as they start on 0
177
- *
178
- * @typedef {Number} CronIndexOffset
179
- */
180
- /**
181
- * Create a CronPattern instance from pattern string ('* * * * * *')
182
- * @constructor
183
- * @param {string} pattern - Input pattern
184
- * @param {string} timezone - Input timezone, used for '?'-substitution
185
- */
186
- declare function CronPattern(pattern: string, timezone: string): void;
187
- declare class CronPattern {
188
- /**
189
- * Name for each part of the cron pattern
190
- * @typedef {("second" | "minute" | "hour" | "day" | "month" | "dayOfWeek")} CronPatternPart
191
- */
192
- /**
193
- * Offset, 0 or -1.
194
- *
195
- * 0 offset is used for seconds,minutes and hours as they start on 1.
196
- * -1 on days and months, as they start on 0
197
- *
198
- * @typedef {Number} CronIndexOffset
199
- */
200
- /**
201
- * Create a CronPattern instance from pattern string ('* * * * * *')
202
- * @constructor
203
- * @param {string} pattern - Input pattern
204
- * @param {string} timezone - Input timezone, used for '?'-substitution
205
- */
206
- constructor(pattern: string, timezone: string);
207
- pattern: string;
208
- timezone: string;
209
- second: any[];
210
- minute: any[];
211
- hour: any[];
212
- day: any[];
213
- month: any[];
214
- dayOfWeek: any[];
215
- lastDayOfMonth: boolean;
216
- lastWeekdayOfMonth: boolean;
217
- starDOM: boolean;
218
- starDOW: boolean;
219
- private parse;
220
- private partToArray;
221
- private throwAtIllegalCharacters;
222
- private handleNumber;
223
- private handleRangeWithStepping;
224
- private handleRange;
225
- private handleStepping;
226
- private replaceAlphaDays;
227
- private replaceAlphaMonths;
228
- private handleNicknames;
229
- }
230
173
  /**
231
174
  * - Cron scheduler options
232
175
  */
package/types/croner.d.ts CHANGED
@@ -138,7 +138,6 @@ export class Cron {
138
138
  * @private
139
139
  */
140
140
  private _states;
141
- pattern: CronPattern;
142
141
  fn: Function | CronOptions;
143
142
  /**
144
143
  * Find next runtime, based on supplied date. Strips milliseconds.
@@ -146,7 +145,7 @@ export class Cron {
146
145
  * @param {CronDate|Date|string} [prev] - Date to start from
147
146
  * @returns {Date | null} - Next run time
148
147
  */
149
- next(prev?: CronDate | Date | string): Date | null;
148
+ nextRun(prev?: CronDate | Date | string): Date | null;
150
149
  /**
151
150
  * Find next n runs, based on supplied date. Strips milliseconds.
152
151
  *
@@ -154,35 +153,41 @@ export class Cron {
154
153
  * @param {Date|string} [previous] - Date to start from
155
154
  * @returns {Date[]} - Next n run times
156
155
  */
157
- enumerate(n: number, previous?: Date | string): Date[];
156
+ nextRuns(n: number, previous?: Date | string): Date[];
157
+ /**
158
+ * Return the original pattern, it there was one
159
+ *
160
+ * @returns {string|undefined} - Original pattern
161
+ */
162
+ getPattern(): string | undefined;
158
163
  /**
159
164
  * Indicates wether or not the cron job is active, e.g. awaiting next trigger
160
165
  * @public
161
166
  *
162
167
  * @returns {boolean} - Running or not
163
168
  */
164
- public running(): boolean;
169
+ public isRunning(): boolean;
165
170
  /**
166
171
  * Indicates wether or not the cron job is currently working
167
172
  * @public
168
173
  *
169
174
  * @returns {boolean} - Running or not
170
175
  */
171
- public busy(): boolean;
176
+ public isBusy(): boolean;
172
177
  /**
173
178
  * Return current/previous run start time
174
179
  * @public
175
180
  *
176
181
  * @returns {Date | null} - Previous run time
177
182
  */
178
- public started(): Date | null;
183
+ public currentRun(): Date | null;
179
184
  /**
180
185
  * Return previous run start time
181
186
  * @public
182
187
  *
183
188
  * @returns {Date | null} - Previous run time
184
189
  */
185
- public previous(): Date | null;
190
+ public previousRun(): Date | null;
186
191
  /**
187
192
  * Returns number of milliseconds to next run
188
193
  * @public
@@ -277,68 +282,6 @@ export const scheduledJobs: Cron[];
277
282
  * @returns {CronOptions}
278
283
  */
279
284
  declare function CronOptions(options: CronOptions): CronOptions;
280
- /**
281
- * Name for each part of the cron pattern
282
- * @typedef {("second" | "minute" | "hour" | "day" | "month" | "dayOfWeek")} CronPatternPart
283
- */
284
- /**
285
- * Offset, 0 or -1.
286
- *
287
- * 0 offset is used for seconds,minutes and hours as they start on 1.
288
- * -1 on days and months, as they start on 0
289
- *
290
- * @typedef {Number} CronIndexOffset
291
- */
292
- /**
293
- * Create a CronPattern instance from pattern string ('* * * * * *')
294
- * @constructor
295
- * @param {string} pattern - Input pattern
296
- * @param {string} timezone - Input timezone, used for '?'-substitution
297
- */
298
- declare function CronPattern(pattern: string, timezone: string): void;
299
- declare class CronPattern {
300
- /**
301
- * Name for each part of the cron pattern
302
- * @typedef {("second" | "minute" | "hour" | "day" | "month" | "dayOfWeek")} CronPatternPart
303
- */
304
- /**
305
- * Offset, 0 or -1.
306
- *
307
- * 0 offset is used for seconds,minutes and hours as they start on 1.
308
- * -1 on days and months, as they start on 0
309
- *
310
- * @typedef {Number} CronIndexOffset
311
- */
312
- /**
313
- * Create a CronPattern instance from pattern string ('* * * * * *')
314
- * @constructor
315
- * @param {string} pattern - Input pattern
316
- * @param {string} timezone - Input timezone, used for '?'-substitution
317
- */
318
- constructor(pattern: string, timezone: string);
319
- pattern: string;
320
- timezone: string;
321
- second: any;
322
- minute: any;
323
- hour: any;
324
- day: any;
325
- month: any;
326
- dayOfWeek: any;
327
- lastDayOfMonth: boolean;
328
- lastWeekdayOfMonth: boolean;
329
- starDOM: boolean;
330
- starDOW: boolean;
331
- private parse;
332
- private partToArray;
333
- private throwAtIllegalCharacters;
334
- private handleNumber;
335
- private handleRangeWithStepping;
336
- private handleRange;
337
- private handleStepping;
338
- private replaceAlphaDays;
339
- private replaceAlphaMonths;
340
- private handleNicknames;
341
- }
342
285
  /**
343
286
  * Converts date to CronDate
344
287
  * @constructor