@keystrokehq/keystroke 0.1.30 → 0.1.31

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.
@@ -3,87 +3,859 @@ import { n as Agent } from "./index-Mr9EjUhy.cjs";
3
3
  import { v as WorkflowDefinition } from "./index-DHCs9z3O.cjs";
4
4
  import { z } from "zod";
5
5
 
6
- //#region ../../node_modules/.pnpm/cron-schedule@6.0.0/node_modules/cron-schedule/dist/cron.d.ts
6
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/CronDate.d.ts
7
+ declare enum TimeUnit {
8
+ Second = "Second",
9
+ Minute = "Minute",
10
+ Hour = "Hour",
11
+ Day = "Day",
12
+ Month = "Month",
13
+ Year = "Year"
14
+ }
15
+ declare enum DateMathOp {
16
+ Add = "Add",
17
+ Subtract = "Subtract"
18
+ }
7
19
  /**
8
- * An object with contains for each element of a date, which values are allowed.
9
- * Everything starting at 0, except for days.
20
+ * CronDate class that wraps the Luxon DateTime object to provide
21
+ * a consistent API for working with dates and times in the context of cron.
10
22
  */
11
- interface ICronDefinition {
12
- readonly seconds: Set<number>;
13
- readonly minutes: Set<number>;
14
- readonly hours: Set<number>;
15
- readonly days: Set<number>;
16
- readonly months: Set<number>;
17
- readonly weekdays: Set<number>;
23
+ declare class CronDate {
24
+ #private;
25
+ /**
26
+ * Constructs a new CronDate instance.
27
+ * @param {CronDate | Date | number | string} [timestamp] - The timestamp to initialize the CronDate with.
28
+ * @param {string} [tz] - The timezone to use for the CronDate.
29
+ */
30
+ constructor(timestamp?: CronDate | Date | number | string, tz?: string);
31
+ /**
32
+ * Returns daylight savings start time.
33
+ * @returns {number | null}
34
+ */
35
+ get dstStart(): number | null;
36
+ /**
37
+ * Sets daylight savings start time.
38
+ * @param {number | null} value
39
+ */
40
+ set dstStart(value: number | null);
41
+ /**
42
+ * Returns daylight savings end time.
43
+ * @returns {number | null}
44
+ */
45
+ get dstEnd(): number | null;
46
+ /**
47
+ * Sets daylight savings end time.
48
+ * @param {number | null} value
49
+ */
50
+ set dstEnd(value: number | null);
51
+ /**
52
+ * Adds one year to the current CronDate.
53
+ */
54
+ addYear(): void;
55
+ /**
56
+ * Adds one month to the current CronDate.
57
+ */
58
+ addMonth(): void;
59
+ /**
60
+ * Adds one day to the current CronDate.
61
+ */
62
+ addDay(): void;
63
+ /**
64
+ * Adds one hour to the current CronDate.
65
+ */
66
+ addHour(): void;
67
+ /**
68
+ * Adds one minute to the current CronDate.
69
+ */
70
+ addMinute(): void;
71
+ /**
72
+ * Adds one second to the current CronDate.
73
+ */
74
+ addSecond(): void;
75
+ /**
76
+ * Subtracts one year from the current CronDate.
77
+ */
78
+ subtractYear(): void;
79
+ /**
80
+ * Subtracts one month from the current CronDate.
81
+ * If the month is 1, it will subtract one year instead.
82
+ */
83
+ subtractMonth(): void;
84
+ /**
85
+ * Subtracts one day from the current CronDate.
86
+ * If the day is 1, it will subtract one month instead.
87
+ */
88
+ subtractDay(): void;
89
+ /**
90
+ * Subtracts one hour from the current CronDate.
91
+ * If the hour is 0, it will subtract one day instead.
92
+ */
93
+ subtractHour(): void;
94
+ /**
95
+ * Subtracts one minute from the current CronDate.
96
+ * If the minute is 0, it will subtract one hour instead.
97
+ */
98
+ subtractMinute(): void;
99
+ /**
100
+ * Subtracts one second from the current CronDate.
101
+ * If the second is 0, it will subtract one minute instead.
102
+ */
103
+ subtractSecond(): void;
104
+ /**
105
+ * Adds a unit of time to the current CronDate.
106
+ * @param {TimeUnit} unit
107
+ */
108
+ addUnit(unit: TimeUnit): void;
109
+ /**
110
+ * Subtracts a unit of time from the current CronDate.
111
+ * @param {TimeUnit} unit
112
+ */
113
+ subtractUnit(unit: TimeUnit): void;
114
+ /**
115
+ * Handles a math operation.
116
+ * @param {DateMathOp} verb - {'add' | 'subtract'}
117
+ * @param {TimeUnit} unit - {'year' | 'month' | 'day' | 'hour' | 'minute' | 'second'}
118
+ */
119
+ invokeDateOperation(verb: DateMathOp, unit: TimeUnit): void;
120
+ /**
121
+ * Returns the day.
122
+ * @returns {number}
123
+ */
124
+ getDate(): number;
125
+ /**
126
+ * Returns the year.
127
+ * @returns {number}
128
+ */
129
+ getFullYear(): number;
130
+ /**
131
+ * Returns the day of the week.
132
+ * @returns {number}
133
+ */
134
+ getDay(): number;
135
+ /**
136
+ * Returns the month.
137
+ * @returns {number}
138
+ */
139
+ getMonth(): number;
140
+ /**
141
+ * Returns the hour.
142
+ * @returns {number}
143
+ */
144
+ getHours(): number;
145
+ /**
146
+ * Returns the minutes.
147
+ * @returns {number}
148
+ */
149
+ getMinutes(): number;
150
+ /**
151
+ * Returns the seconds.
152
+ * @returns {number}
153
+ */
154
+ getSeconds(): number;
155
+ /**
156
+ * Returns the milliseconds.
157
+ * @returns {number}
158
+ */
159
+ getMilliseconds(): number;
160
+ /**
161
+ * Returns the timezone offset from UTC in minutes (e.g. UTC+2 => 120).
162
+ * Useful for detecting DST transition days.
163
+ *
164
+ * @returns {number} UTC offset in minutes
165
+ */
166
+ getUTCOffset(): number;
167
+ /**
168
+ * Sets the time to the start of the day (00:00:00.000) in the current timezone.
169
+ */
170
+ setStartOfDay(): void;
171
+ /**
172
+ * Sets the time to the end of the day (23:59:59.999) in the current timezone.
173
+ */
174
+ setEndOfDay(): void;
175
+ /**
176
+ * Returns the time.
177
+ * @returns {number}
178
+ */
179
+ getTime(): number;
180
+ /**
181
+ * Returns the UTC day.
182
+ * @returns {number}
183
+ */
184
+ getUTCDate(): number;
185
+ /**
186
+ * Returns the UTC year.
187
+ * @returns {number}
188
+ */
189
+ getUTCFullYear(): number;
190
+ /**
191
+ * Returns the UTC day of the week.
192
+ * @returns {number}
193
+ */
194
+ getUTCDay(): number;
195
+ /**
196
+ * Returns the UTC month.
197
+ * @returns {number}
198
+ */
199
+ getUTCMonth(): number;
200
+ /**
201
+ * Returns the UTC hour.
202
+ * @returns {number}
203
+ */
204
+ getUTCHours(): number;
205
+ /**
206
+ * Returns the UTC minutes.
207
+ * @returns {number}
208
+ */
209
+ getUTCMinutes(): number;
210
+ /**
211
+ * Returns the UTC seconds.
212
+ * @returns {number}
213
+ */
214
+ getUTCSeconds(): number;
215
+ /**
216
+ * Returns the UTC milliseconds.
217
+ * @returns {string | null}
218
+ */
219
+ toISOString(): string | null;
220
+ /**
221
+ * Returns the date as a JSON string.
222
+ * @returns {string | null}
223
+ */
224
+ toJSON(): string | null;
225
+ /**
226
+ * Sets the day.
227
+ * @param d
228
+ */
229
+ setDate(d: number): void;
230
+ /**
231
+ * Sets the year.
232
+ * @param y
233
+ */
234
+ setFullYear(y: number): void;
235
+ /**
236
+ * Sets the day of the week.
237
+ * @param d
238
+ */
239
+ setDay(d: number): void;
240
+ /**
241
+ * Sets the month.
242
+ * @param m
243
+ */
244
+ setMonth(m: number): void;
245
+ /**
246
+ * Sets the hour.
247
+ * @param h
248
+ */
249
+ setHours(h: number): void;
250
+ /**
251
+ * Sets the minutes.
252
+ * @param m
253
+ */
254
+ setMinutes(m: number): void;
255
+ /**
256
+ * Sets the seconds.
257
+ * @param s
258
+ */
259
+ setSeconds(s: number): void;
260
+ /**
261
+ * Sets the milliseconds.
262
+ * @param s
263
+ */
264
+ setMilliseconds(s: number): void;
265
+ /**
266
+ * Returns the date as a string.
267
+ * @returns {string}
268
+ */
269
+ toString(): string;
270
+ /**
271
+ * Returns the date as a Date object.
272
+ * @returns {Date}
273
+ */
274
+ toDate(): Date;
275
+ /**
276
+ * Returns true if the day is the last day of the month.
277
+ * @returns {boolean}
278
+ */
279
+ isLastDayOfMonth(): boolean;
280
+ /**
281
+ * Returns true if the day is the last weekday of the month.
282
+ * @returns {boolean}
283
+ */
284
+ isLastWeekdayOfMonth(): boolean;
285
+ /**
286
+ * Primarily for internal use.
287
+ * @param {DateMathOp} op - The operation to perform.
288
+ * @param {TimeUnit} unit - The unit of time to use.
289
+ * @param {number} [hoursLength] - The length of the hours. Required when unit is not month or day.
290
+ */
291
+ applyDateOperation(op: DateMathOp, unit: TimeUnit, hoursLength?: number): void;
18
292
  }
19
- declare class Cron {
20
- readonly seconds: ReadonlyArray<number>;
21
- readonly minutes: ReadonlyArray<number>;
22
- readonly hours: ReadonlyArray<number>;
23
- readonly days: ReadonlyArray<number>;
24
- readonly months: ReadonlyArray<number>;
25
- readonly weekdays: ReadonlyArray<number>;
26
- readonly reversed: {
27
- seconds: ReadonlyArray<number>;
28
- minutes: ReadonlyArray<number>;
29
- hours: ReadonlyArray<number>;
30
- days: ReadonlyArray<number>;
31
- months: ReadonlyArray<number>;
32
- weekdays: ReadonlyArray<number>;
293
+ //#endregion
294
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/types.d.ts
295
+ type RangeFrom<LENGTH extends number, ACC extends unknown[] = []> = ACC['length'] extends LENGTH ? ACC : RangeFrom<LENGTH, [...ACC, 1]>;
296
+ type IntRange<FROM extends number[], TO extends number, ACC extends number = never> = FROM['length'] extends TO ? ACC | TO : IntRange<[...FROM, 1], TO, ACC | FROM['length']>;
297
+ type SixtyRange = IntRange<RangeFrom<0>, 59>;
298
+ type HourRange = IntRange<RangeFrom<0>, 23>;
299
+ type DayOfMonthRange = IntRange<RangeFrom<1>, 31> | 'L';
300
+ type MonthRange = IntRange<RangeFrom<1>, 12>;
301
+ type DayOfWeekRange = IntRange<RangeFrom<0>, 7> | 'L';
302
+ type CronFieldType = SixtyRange[] | HourRange[] | DayOfMonthRange[] | MonthRange[] | DayOfWeekRange[];
303
+ type CronChars = 'L' | 'W';
304
+ type CronMin = 0 | 1;
305
+ type CronMax = 7 | 12 | 23 | 31 | 59;
306
+ type CronConstraints = {
307
+ min: CronMin;
308
+ max: CronMax;
309
+ chars: readonly CronChars[];
310
+ validChars: RegExp;
311
+ };
312
+ //#endregion
313
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/CronField.d.ts
314
+ /**
315
+ * Represents the serialized form of a cron field.
316
+ * @typedef {Object} SerializedCronField
317
+ * @property {boolean} wildcard - Indicates if the field is a wildcard.
318
+ * @property {(number|string)[]} values - The values of the field.
319
+ */
320
+ type SerializedCronField = {
321
+ wildcard: boolean;
322
+ values: (number | string)[];
323
+ };
324
+ /**
325
+ * Represents the options for a cron field.
326
+ * @typedef {Object} CronFieldOptions
327
+ * @property {string} rawValue - The raw value of the field.
328
+ * @property {boolean} [wildcard] - Indicates if the field is a wildcard.
329
+ * @property {number} [nthDayOfWeek] - The nth day of the week.
330
+ */
331
+ type CronFieldOptions = {
332
+ rawValue?: string;
333
+ wildcard?: boolean;
334
+ nthDayOfWeek?: number;
335
+ };
336
+ /**
337
+ * Represents a field within a cron expression.
338
+ * This is a base class and should not be instantiated directly.
339
+ * @class CronField
340
+ */
341
+ declare abstract class CronField$1 {
342
+ #private;
343
+ protected readonly options: CronFieldOptions & {
344
+ rawValue: string;
33
345
  };
346
+ /**
347
+ * Returns the minimum value allowed for this field.
348
+ */
349
+ static get min(): CronMin;
350
+ /**
351
+ * Returns the maximum value allowed for this field.
352
+ */
353
+ static get max(): CronMax;
354
+ /**
355
+ * Returns the allowed characters for this field.
356
+ */
357
+ static get chars(): readonly CronChars[];
358
+ /**
359
+ * Returns the regular expression used to validate this field.
360
+ */
361
+ static get validChars(): RegExp;
362
+ /**
363
+ * Returns the constraints for this field.
364
+ */
365
+ static get constraints(): CronConstraints;
366
+ /**
367
+ * CronField constructor. Initializes the field with the provided values.
368
+ * @param {number[] | string[]} values - Values for this field
369
+ * @param {CronFieldOptions} [options] - Options provided by the parser
370
+ * @throws {TypeError} if the constructor is called directly
371
+ * @throws {Error} if validation fails
372
+ */
373
+ protected constructor(values: (number | string)[], options?: CronFieldOptions);
374
+ /**
375
+ * Returns the minimum value allowed for this field.
376
+ * @returns {number}
377
+ */
378
+ get min(): number;
379
+ /**
380
+ * Returns the maximum value allowed for this field.
381
+ * @returns {number}
382
+ */
383
+ get max(): number;
384
+ /**
385
+ * Returns an array of allowed special characters for this field.
386
+ * @returns {string[]}
387
+ */
388
+ get chars(): readonly string[];
389
+ /**
390
+ * Indicates whether this field has a "last" character.
391
+ * @returns {boolean}
392
+ */
393
+ get hasLastChar(): boolean;
394
+ /**
395
+ * Indicates whether this field has a "question mark" character.
396
+ * @returns {boolean}
397
+ */
398
+ get hasQuestionMarkChar(): boolean;
399
+ /**
400
+ * Indicates whether this field is a wildcard.
401
+ * @returns {boolean}
402
+ */
403
+ get isWildcard(): boolean;
404
+ /**
405
+ * Returns an array of allowed values for this field.
406
+ * @returns {CronFieldType}
407
+ */
408
+ get values(): CronFieldType;
409
+ /**
410
+ * Helper function to sort values in ascending order.
411
+ * @param {number | string} a - First value to compare
412
+ * @param {number | string} b - Second value to compare
413
+ * @returns {number} - A negative, zero, or positive value, depending on the sort order
414
+ */
415
+ static sorter(a: number | string, b: number | string): number;
416
+ /**
417
+ * Find the next (or previous when `reverse` is true) numeric value in a sorted list.
418
+ * Returns null if there's no value strictly after/before the current one.
419
+ *
420
+ * @param values - Sorted numeric values
421
+ * @param currentValue - Current value to compare against
422
+ * @param reverse - When true, search in reverse for previous smaller value
423
+ */
424
+ static findNearestValueInList(values: number[], currentValue: number, reverse?: boolean): number | null;
425
+ /**
426
+ * Instance helper that operates on this field's numeric `values`.
427
+ *
428
+ * @param currentValue - Current value to compare against
429
+ * @param reverse - When true, search in reverse for previous smaller value
430
+ */
431
+ findNearestValue(currentValue: number, reverse?: boolean): number | null;
432
+ /**
433
+ * Serializes the field to an object.
434
+ * @returns {SerializedCronField}
435
+ */
436
+ serialize(): SerializedCronField;
437
+ /**
438
+ * Validates the field values against the allowed range and special characters.
439
+ * @throws {Error} if validation fails
440
+ */
441
+ validate(): void;
442
+ }
443
+ //#endregion
444
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/CronDayOfMonth.d.ts
445
+ /**
446
+ * Represents the "day of the month" field within a cron expression.
447
+ * @class CronDayOfMonth
448
+ * @extends CronField
449
+ */
450
+ declare class CronDayOfMonth extends CronField$1 {
451
+ static get min(): CronMin;
452
+ static get max(): CronMax;
453
+ static get chars(): CronChars[];
454
+ static get validChars(): RegExp;
455
+ /**
456
+ * CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values.
457
+ * @param {DayOfMonthRange[]} values - Values for the "day of the month" field
458
+ * @param {CronFieldOptions} [options] - Options provided by the parser
459
+ * @throws {Error} if validation fails
460
+ */
461
+ constructor(values: DayOfMonthRange[], options?: CronFieldOptions);
462
+ /**
463
+ * Returns an array of allowed values for the "day of the month" field.
464
+ * @returns {DayOfMonthRange[]}
465
+ */
466
+ get values(): DayOfMonthRange[];
467
+ }
468
+ //#endregion
469
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/CronDayOfWeek.d.ts
470
+ /**
471
+ * Represents the "day of the week" field within a cron expression.
472
+ * @class CronDayOfTheWeek
473
+ * @extends CronField
474
+ */
475
+ declare class CronDayOfWeek extends CronField$1 {
476
+ static get min(): CronMin;
477
+ static get max(): CronMax;
478
+ static get chars(): readonly CronChars[];
479
+ static get validChars(): RegExp;
480
+ /**
481
+ * CronDayOfTheWeek constructor. Initializes the "day of the week" field with the provided values.
482
+ * @param {DayOfWeekRange[]} values - Values for the "day of the week" field
483
+ * @param {CronFieldOptions} [options] - Options provided by the parser
484
+ */
485
+ constructor(values: DayOfWeekRange[], options?: CronFieldOptions);
486
+ /**
487
+ * Returns an array of allowed values for the "day of the week" field.
488
+ * @returns {DayOfWeekRange[]}
489
+ */
490
+ get values(): DayOfWeekRange[];
491
+ /**
492
+ * Returns the nth day of the week if specified in the cron expression.
493
+ * This is used for the '#' character in the cron expression.
494
+ * @returns {number} The nth day of the week (1-5) or 0 if not specified.
495
+ */
496
+ get nthDay(): number;
497
+ }
498
+ //#endregion
499
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/CronHour.d.ts
500
+ /**
501
+ * Represents the "hour" field within a cron expression.
502
+ * @class CronHour
503
+ * @extends CronField
504
+ */
505
+ declare class CronHour extends CronField$1 {
506
+ static get min(): CronMin;
507
+ static get max(): CronMax;
508
+ static get chars(): readonly CronChars[];
509
+ /**
510
+ * CronHour constructor. Initializes the "hour" field with the provided values.
511
+ * @param {HourRange[]} values - Values for the "hour" field
512
+ * @param {CronFieldOptions} [options] - Options provided by the parser
513
+ */
514
+ constructor(values: HourRange[], options?: CronFieldOptions);
515
+ /**
516
+ * Returns an array of allowed values for the "hour" field.
517
+ * @returns {HourRange[]}
518
+ */
519
+ get values(): HourRange[];
520
+ }
521
+ //#endregion
522
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/CronMinute.d.ts
523
+ /**
524
+ * Represents the "second" field within a cron expression.
525
+ * @class CronSecond
526
+ * @extends CronField
527
+ */
528
+ declare class CronMinute extends CronField$1 {
529
+ static get min(): CronMin;
530
+ static get max(): CronMax;
531
+ static get chars(): readonly CronChars[];
532
+ /**
533
+ * CronSecond constructor. Initializes the "second" field with the provided values.
534
+ * @param {SixtyRange[]} values - Values for the "second" field
535
+ * @param {CronFieldOptions} [options] - Options provided by the parser
536
+ */
537
+ constructor(values: SixtyRange[], options?: CronFieldOptions);
538
+ /**
539
+ * Returns an array of allowed values for the "second" field.
540
+ * @returns {SixtyRange[]}
541
+ */
542
+ get values(): SixtyRange[];
543
+ }
544
+ //#endregion
545
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/CronMonth.d.ts
546
+ /**
547
+ * Represents the "day of the month" field within a cron expression.
548
+ * @class CronDayOfMonth
549
+ * @extends CronField
550
+ */
551
+ declare class CronMonth extends CronField$1 {
552
+ static get min(): CronMin;
553
+ static get max(): CronMax;
554
+ static get chars(): readonly CronChars[];
555
+ static get daysInMonth(): readonly number[];
556
+ /**
557
+ * CronDayOfMonth constructor. Initializes the "day of the month" field with the provided values.
558
+ * @param {MonthRange[]} values - Values for the "day of the month" field
559
+ * @param {CronFieldOptions} [options] - Options provided by the parser
560
+ */
561
+ constructor(values: MonthRange[], options?: CronFieldOptions);
562
+ /**
563
+ * Returns an array of allowed values for the "day of the month" field.
564
+ * @returns {MonthRange[]}
565
+ */
566
+ get values(): MonthRange[];
567
+ }
568
+ //#endregion
569
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/fields/CronSecond.d.ts
570
+ /**
571
+ * Represents the "second" field within a cron expression.
572
+ * @class CronSecond
573
+ * @extends CronField
574
+ */
575
+ declare class CronSecond extends CronField$1 {
576
+ static get min(): CronMin;
577
+ static get max(): CronMax;
578
+ static get chars(): readonly CronChars[];
579
+ /**
580
+ * CronSecond constructor. Initializes the "second" field with the provided values.
581
+ * @param {SixtyRange[]} values - Values for the "second" field
582
+ * @param {CronFieldOptions} [options] - Options provided by the parser
583
+ */
584
+ constructor(values: SixtyRange[], options?: CronFieldOptions);
585
+ /**
586
+ * Returns an array of allowed values for the "second" field.
587
+ * @returns {SixtyRange[]}
588
+ */
589
+ get values(): SixtyRange[];
590
+ }
591
+ //#endregion
592
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/CronFieldCollection.d.ts
593
+ type FieldRange = {
594
+ start: number | CronChars;
595
+ count: number;
596
+ end?: number;
597
+ step?: number;
598
+ };
599
+ type CronFields = {
600
+ second: CronSecond;
601
+ minute: CronMinute;
602
+ hour: CronHour;
603
+ dayOfMonth: CronDayOfMonth;
604
+ month: CronMonth;
605
+ dayOfWeek: CronDayOfWeek;
606
+ };
607
+ type CronFieldOverride = {
608
+ second?: CronSecond | SixtyRange[];
609
+ minute?: CronMinute | SixtyRange[];
610
+ hour?: CronHour | HourRange[];
611
+ dayOfMonth?: CronDayOfMonth | DayOfMonthRange[];
612
+ month?: CronMonth | MonthRange[];
613
+ dayOfWeek?: CronDayOfWeek | DayOfWeekRange[];
614
+ };
615
+ type SerializedCronFields = {
616
+ second: SerializedCronField;
617
+ minute: SerializedCronField;
618
+ hour: SerializedCronField;
619
+ dayOfMonth: SerializedCronField;
620
+ month: SerializedCronField;
621
+ dayOfWeek: SerializedCronField;
622
+ };
623
+ /**
624
+ * Represents a complete set of cron fields.
625
+ * @class CronFieldCollection
626
+ */
627
+ declare class CronFieldCollection {
628
+ #private;
629
+ /**
630
+ * Creates a new CronFieldCollection instance by partially overriding fields from an existing one.
631
+ * @param {CronFieldCollection} base - The base CronFieldCollection to copy fields from
632
+ * @param {CronFieldOverride} fields - The fields to override, can be CronField instances or raw values
633
+ * @returns {CronFieldCollection} A new CronFieldCollection instance
634
+ * @example
635
+ * const base = new CronFieldCollection({
636
+ * second: new CronSecond([0]),
637
+ * minute: new CronMinute([0]),
638
+ * hour: new CronHour([12]),
639
+ * dayOfMonth: new CronDayOfMonth([1]),
640
+ * month: new CronMonth([1]),
641
+ * dayOfWeek: new CronDayOfWeek([1])
642
+ * });
643
+ *
644
+ * // Using CronField instances
645
+ * const modified1 = CronFieldCollection.from(base, {
646
+ * hour: new CronHour([15]),
647
+ * minute: new CronMinute([30])
648
+ * });
649
+ *
650
+ * // Using raw values
651
+ * const modified2 = CronFieldCollection.from(base, {
652
+ * hour: [15], // Will create new CronHour
653
+ * minute: [30] // Will create new CronMinute
654
+ * });
655
+ */
656
+ static from(base: CronFieldCollection, fields: CronFieldOverride): CronFieldCollection;
657
+ /**
658
+ * Resolves a field value, either using the provided CronField instance or creating a new one from raw values.
659
+ * @param constructor - The constructor for creating new field instances
660
+ * @param baseField - The base field to use if no override is provided
661
+ * @param fieldValue - The override value, either a CronField instance or raw values
662
+ * @returns The resolved CronField instance
663
+ * @private
664
+ */
665
+ private static resolveField;
666
+ /**
667
+ * CronFieldCollection constructor. Initializes the cron fields with the provided values.
668
+ * @param {CronFields} param0 - The cron fields values
669
+ * @throws {Error} if validation fails
670
+ * @example
671
+ * const cronFields = new CronFieldCollection({
672
+ * second: new CronSecond([0]),
673
+ * minute: new CronMinute([0, 30]),
674
+ * hour: new CronHour([9]),
675
+ * dayOfMonth: new CronDayOfMonth([15]),
676
+ * month: new CronMonth([1]),
677
+ * dayOfWeek: new CronDayOfTheWeek([1, 2, 3, 4, 5]),
678
+ * })
679
+ *
680
+ * console.log(cronFields.second.values); // [0]
681
+ * console.log(cronFields.minute.values); // [0, 30]
682
+ * console.log(cronFields.hour.values); // [9]
683
+ * console.log(cronFields.dayOfMonth.values); // [15]
684
+ * console.log(cronFields.month.values); // [1]
685
+ * console.log(cronFields.dayOfWeek.values); // [1, 2, 3, 4, 5]
686
+ */
34
687
  constructor({
35
- seconds,
36
- minutes,
37
- hours,
38
- days,
39
- months,
40
- weekdays
41
- }: ICronDefinition);
688
+ second,
689
+ minute,
690
+ hour,
691
+ dayOfMonth,
692
+ month,
693
+ dayOfWeek
694
+ }: CronFields);
695
+ /**
696
+ * Returns the second field.
697
+ * @returns {CronSecond}
698
+ */
699
+ get second(): CronSecond;
700
+ /**
701
+ * Returns the minute field.
702
+ * @returns {CronMinute}
703
+ */
704
+ get minute(): CronMinute;
705
+ /**
706
+ * Returns the hour field.
707
+ * @returns {CronHour}
708
+ */
709
+ get hour(): CronHour;
710
+ /**
711
+ * Returns the day of the month field.
712
+ * @returns {CronDayOfMonth}
713
+ */
714
+ get dayOfMonth(): CronDayOfMonth;
715
+ /**
716
+ * Returns the month field.
717
+ * @returns {CronMonth}
718
+ */
719
+ get month(): CronMonth;
720
+ /**
721
+ * Returns the day of the week field.
722
+ * @returns {CronDayOfWeek}
723
+ */
724
+ get dayOfWeek(): CronDayOfWeek;
725
+ /**
726
+ * Returns a string representation of the cron fields.
727
+ * @param {(number | CronChars)[]} input - The cron fields values
728
+ * @static
729
+ * @returns {FieldRange[]} - The compacted cron fields
730
+ */
731
+ static compactField(input: (number | CronChars)[]): FieldRange[];
732
+ /**
733
+ * Returns a string representation of the cron fields.
734
+ * @param {CronField} field - The cron field to stringify
735
+ * @static
736
+ * @returns {string} - The stringified cron field
737
+ */
738
+ stringifyField(field: CronField$1): string;
739
+ /**
740
+ * Returns a string representation of the cron field values.
741
+ * @param {boolean} includeSeconds - Whether to include seconds in the output
742
+ * @returns {string} The formatted cron string
743
+ */
744
+ stringify(includeSeconds?: boolean): string;
745
+ /**
746
+ * Returns a serialized representation of the cron fields values.
747
+ * @returns {SerializedCronFields} An object containing the cron field values
748
+ */
749
+ serialize(): SerializedCronFields;
750
+ }
751
+ //#endregion
752
+ //#region ../../node_modules/.pnpm/cron-parser@5.5.0/node_modules/cron-parser/dist/types/CronExpression.d.ts
753
+ type CronExpressionOptions = {
754
+ currentDate?: Date | string | number | CronDate;
755
+ endDate?: Date | string | number | CronDate;
756
+ startDate?: Date | string | number | CronDate;
757
+ tz?: string;
758
+ expression?: string;
759
+ hashSeed?: string;
760
+ strict?: boolean;
761
+ };
762
+ /**
763
+ * Class representing a Cron expression.
764
+ */
765
+ declare class CronExpression$1 {
766
+ #private;
767
+ /**
768
+ * Creates a new CronExpression instance.
769
+ *
770
+ * @param {CronFieldCollection} fields - Cron fields.
771
+ * @param {CronExpressionOptions} options - Parser options.
772
+ */
773
+ constructor(fields: CronFieldCollection, options: CronExpressionOptions);
774
+ /**
775
+ * Getter for the cron fields.
776
+ *
777
+ * @returns {CronFieldCollection} Cron fields.
778
+ */
779
+ get fields(): CronFieldCollection;
780
+ /**
781
+ * Converts cron fields back to a CronExpression instance.
782
+ *
783
+ * @public
784
+ * @param {Record<string, number[]>} fields - The input cron fields object.
785
+ * @param {CronExpressionOptions} [options] - Optional parsing options.
786
+ * @returns {CronExpression} - A new CronExpression instance.
787
+ */
788
+ static fieldsToExpression(fields: CronFieldCollection, options?: CronExpressionOptions): CronExpression$1;
789
+ /**
790
+ * Find the next scheduled date based on the cron expression.
791
+ * @returns {CronDate} - The next scheduled date or an ES6 compatible iterator object.
792
+ * @memberof CronExpression
793
+ * @public
794
+ */
795
+ next(): CronDate;
796
+ /**
797
+ * Find the previous scheduled date based on the cron expression.
798
+ * @returns {CronDate} - The previous scheduled date or an ES6 compatible iterator object.
799
+ * @memberof CronExpression
800
+ * @public
801
+ */
802
+ prev(): CronDate;
803
+ /**
804
+ * Check if there is a next scheduled date based on the current date and cron expression.
805
+ * @returns {boolean} - Returns true if there is a next scheduled date, false otherwise.
806
+ * @memberof CronExpression
807
+ * @public
808
+ */
809
+ hasNext(): boolean;
42
810
  /**
43
- * Find the next or previous hour, starting from the given start hour that matches the hour constraint.
44
- * startHour itself might also be allowed.
811
+ * Check if there is a previous scheduled date based on the current date and cron expression.
812
+ * @returns {boolean} - Returns true if there is a previous scheduled date, false otherwise.
813
+ * @memberof CronExpression
814
+ * @public
45
815
  */
46
- private findAllowedHour;
816
+ hasPrev(): boolean;
47
817
  /**
48
- * Find the next or previous minute, starting from the given start minute that matches the minute constraint.
49
- * startMinute itself might also be allowed.
818
+ * Iterate over a specified number of steps and optionally execute a callback function for each step.
819
+ * @param {number} steps - The number of steps to iterate. Positive value iterates forward, negative value iterates backward.
820
+ * @returns {CronDate[]} - An array of iterator fields or CronDate objects.
821
+ * @memberof CronExpression
822
+ * @public
50
823
  */
51
- private findAllowedMinute;
824
+ take(limit: number): CronDate[];
52
825
  /**
53
- * Find the next or previous second, starting from the given start second that matches the second constraint.
54
- * startSecond itself IS NOT allowed.
826
+ * Reset the iterators current date to a new date or the initial date.
827
+ * @param {Date | CronDate} [newDate] - Optional new date to reset to. If not provided, it will reset to the initial date.
828
+ * @memberof CronExpression
829
+ * @public
55
830
  */
56
- private findAllowedSecond;
831
+ reset(newDate?: Date | CronDate): void;
57
832
  /**
58
- * Find the next or previous time, starting from the given start time that matches the hour, minute
59
- * and second constraints. startTime itself might also be allowed.
833
+ * Generate a string representation of the cron expression.
834
+ * @param {boolean} [includeSeconds=false] - Whether to include the seconds field in the string representation.
835
+ * @returns {string} - The string representation of the cron expression.
836
+ * @memberof CronExpression
837
+ * @public
60
838
  */
61
- private findAllowedTime;
839
+ stringify(includeSeconds?: boolean): string;
62
840
  /**
63
- * Find the next or previous day in the given month, starting from the given startDay
64
- * that matches either the day or the weekday constraint. startDay itself might also be allowed.
841
+ * Check if the cron expression includes the given date
842
+ * @param {Date|CronDate} date
843
+ * @returns {boolean}
65
844
  */
66
- private findAllowedDayInMonth;
67
- /** Gets the next date starting from the given start date or now. */
68
- getNextDate(startDate?: Date): Date;
69
- /** Gets the specified amount of future dates starting from the given start date or now. */
70
- getNextDates(amount: number, startDate?: Date): Date[];
845
+ includesDate(date: Date | CronDate): boolean;
71
846
  /**
72
- * Get an ES6 compatible iterator which iterates over the next dates starting from startDate or now.
73
- * The iterator runs until the optional endDate is reached or forever.
847
+ * Returns the string representation of the cron expression.
848
+ * @returns {CronDate} - The next schedule date.
74
849
  */
75
- getNextDatesIterator(startDate?: Date, endDate?: Date): Generator<Date, undefined, undefined>;
76
- /** Gets the previous date starting from the given start date or now. */
77
- getPrevDate(startDate?: Date): Date;
78
- /** Gets the specified amount of previous dates starting from the given start date or now. */
79
- getPrevDates(amount: number, startDate?: Date): Date[];
850
+ toString(): string;
80
851
  /**
81
- * Get an ES6 compatible iterator which iterates over the previous dates starting from startDate or now.
82
- * The iterator runs until the optional endDate is reached or forever.
852
+ * Returns an iterator for iterating through future CronDate instances
853
+ *
854
+ * @name Symbol.iterator
855
+ * @memberof CronExpression
856
+ * @returns {Iterator<CronDate>} An iterator object for CronExpression that returns CronDate values.
83
857
  */
84
- getPrevDatesIterator(startDate?: Date, endDate?: Date): Generator<Date, undefined, undefined>;
85
- /** Returns true when there is a cron date at the given date. */
86
- matchDate(date: Date): boolean;
858
+ [Symbol.iterator](): Iterator<CronDate>;
87
859
  }
88
860
  //#endregion
89
861
  //#region ../trigger/dist/index.d.mts
@@ -108,7 +880,7 @@ type CronField = "*" | `${number}` | `${number}-${number}` | `*/${number}` | `${
108
880
  */
109
881
  type CronExpression = `${CronField} ${CronField} ${CronField} ${CronField} ${CronField}`;
110
882
  /**
111
- * Validates and brands a cron expression. Accepts anything the `cron-schedule`
883
+ * Validates and brands a cron expression. Accepts anything the `cron-parser`
112
884
  * engine accepts (5/6 fields, named months/weekdays, `@daily`-style nicknames)
113
885
  * so authoring validation never rejects a schedule the scheduler can run. The
114
886
  * `.brand()` makes `CronSchedule` nominally distinct from a plain `string`, so
@@ -130,8 +902,8 @@ declare function resolveCronSchedule(attachmentId: string, schedule: string, opt
130
902
  cronScheduleOverride?: string;
131
903
  attachmentScheduleOverrides?: Record<string, string>;
132
904
  }): string;
133
- /** Parse a schedule into a `cron-schedule` `Cron` instance (throws on invalid input). */
134
- declare function parseTriggerSchedule(schedule: string): Cron;
905
+ /** Parse a schedule into a `cron-parser` expression (throws on invalid input). */
906
+ declare function parseTriggerSchedule(schedule: string): CronExpression$1;
135
907
  /** The next time the schedule fires at or after `from`. */
136
908
  declare function nextTriggerRunAt(schedule: string, from?: Date): Date; //#endregion
137
909
  //#region src/attach-options.d.ts