payload 3.82.0 → 3.83.0-internal.791f423

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.
@@ -1848,6 +1848,7 @@ type UpdateManyArgs = {
1848
1848
  type UpdateMany = (args: UpdateManyArgs) => Promise<Document[] | null>;
1849
1849
  type UpdateJobsArgs = {
1850
1850
  data: Record<string, unknown>;
1851
+ debugID?: string;
1851
1852
  req?: Partial<PayloadRequest>;
1852
1853
  /**
1853
1854
  * If true, returns the updated documents
@@ -9908,6 +9909,7 @@ type RunJobsArgs = {
9908
9909
  * @default jobs from the `default` queue will be executed.
9909
9910
  */
9910
9911
  queue?: string;
9912
+ randomID?: string;
9911
9913
  req: PayloadRequest;
9912
9914
  /**
9913
9915
  * By default, jobs are run in parallel.
@@ -11270,102 +11272,42 @@ type Options<TSlug extends GlobalSlug, TSelect extends SelectType> = BaseOptions
11270
11272
 
11271
11273
  // Generated by dts-bundle-generator v9.5.1
11272
11274
 
11273
- type CatchCallbackFn = (e: unknown, job: Cron) => void;
11274
- type ProtectCallbackFn = (job: Cron) => void;
11275
11275
  /**
11276
- * Options for configuring cron jobs.
11277
- *
11278
- * @interface
11276
+ * Cron pattern mode for controlling precision level
11279
11277
  */
11280
- interface CronOptions {
11281
- /**
11282
- * The name of the cron job. If provided, the job will be added to the
11283
- * `scheduledJobs` array, allowing it to be accessed by name.
11284
- */
11285
- name?: string;
11286
- /**
11287
- * If true, the job will be paused initially.
11288
- * @default false
11289
- */
11290
- paused?: boolean;
11291
- /**
11292
- * If true, the job will be stopped permanently.
11293
- * @default false
11294
- */
11295
- kill?: boolean;
11296
- /**
11297
- * If true, errors thrown by the job function will be caught.
11298
- * If a function is provided, it will be called with the error and the job instance.
11299
- * @default false
11300
- */
11301
- catch?: boolean | CatchCallbackFn;
11302
- /**
11303
- * If true, the underlying timer will be unreferenced, allowing the Node.js
11304
- * process to exit even if the job is still running.
11305
- * @default false
11306
- */
11307
- unref?: boolean;
11308
- /**
11309
- * The maximum number of times the job will run.
11310
- * @default Infinity
11311
- */
11312
- maxRuns?: number;
11313
- /**
11314
- * The minimum interval between job executions, in seconds.
11315
- * @default 1
11316
- */
11317
- interval?: number;
11318
- /**
11319
- * If true, prevents the job from running if the previous execution is still in progress.
11320
- * If a function is provided, it will be called if the job is blocked.
11321
- * @default false
11322
- */
11323
- protect?: boolean | ProtectCallbackFn;
11324
- /**
11325
- * The date and time at which the job should start running.
11326
- */
11327
- startAt?: string | Date | CronDate;
11328
- /**
11329
- * The date and time at which the job should stop running.
11330
- */
11331
- stopAt?: string | Date | CronDate;
11332
- /**
11333
- * The timezone for the cron job.
11334
- */
11335
- timezone?: string;
11336
- /**
11337
- * The UTC offset for the cron job, in minutes.
11338
- */
11339
- utcOffset?: number;
11340
- /**
11341
- * If true, enables legacy mode for compatibility with older cron implementations.
11342
- * @default true
11343
- */
11344
- legacyMode?: boolean;
11345
- /**
11346
- * An optional context object that will be passed to the job function.
11347
- */
11348
- context?: unknown;
11349
- }
11278
+ type CronMode = "auto" | "5-part" | "6-part" | "7-part" | "5-or-6-parts" | "6-or-7-parts";
11350
11279
  /**
11351
11280
  * Create a CronPattern instance from pattern string ('* * * * * *')
11352
11281
  * @constructor
11353
11282
  * @param {string} pattern - Input pattern
11354
11283
  * @param {string} timezone - Input timezone, used for '?'-substitution
11284
+ * @param {object} options - Cron options including mode
11355
11285
  */
11356
11286
  declare class CronPattern {
11357
11287
  pattern: string;
11358
11288
  timezone?: string;
11289
+ mode: CronMode;
11290
+ alternativeWeekdays: boolean;
11291
+ sloppyRanges: boolean;
11359
11292
  second: number[];
11360
11293
  minute: number[];
11361
11294
  hour: number[];
11362
11295
  day: number[];
11363
11296
  month: number[];
11364
11297
  dayOfWeek: number[];
11298
+ year: number[];
11365
11299
  lastDayOfMonth: boolean;
11300
+ lastWeekday: boolean;
11301
+ nearestWeekdays: number[];
11366
11302
  starDOM: boolean;
11367
11303
  starDOW: boolean;
11368
- constructor(pattern: string, timezone?: string);
11304
+ starYear: boolean;
11305
+ useAndLogic: boolean;
11306
+ constructor(pattern: string, timezone?: string, options?: {
11307
+ mode?: CronMode;
11308
+ alternativeWeekdays?: boolean;
11309
+ sloppyRanges?: boolean;
11310
+ });
11369
11311
  /**
11370
11312
  * Parse current pattern, will throw on any type of failure
11371
11313
  * @private
@@ -11381,7 +11323,7 @@ declare class CronPattern {
11381
11323
  */
11382
11324
  private throwAtIllegalCharacters;
11383
11325
  /**
11384
- * Nothing but a number left, handle that
11326
+ * Nothing but a number, potentially with a modifier, left - handle that
11385
11327
  *
11386
11328
  * @param conf Current part, expected to be a number, as a string
11387
11329
  * @param type One of "seconds", "minutes" etc
@@ -11396,6 +11338,28 @@ declare class CronPattern {
11396
11338
  * @param value The value to set, typically 0 or 1, in case of "nth weekday" it will be the weekday number used for further processing
11397
11339
  */
11398
11340
  private setPart;
11341
+ /**
11342
+ * Validates that a parsed number is not NaN.
11343
+ * Throws a TypeError with a descriptive message if the value is NaN.
11344
+ *
11345
+ * @param value - The value to validate
11346
+ * @param errorMessage - The error message to throw if validation fails
11347
+ * @throws {TypeError} If the value is NaN
11348
+ * @private
11349
+ */
11350
+ private validateNotNaN;
11351
+ /**
11352
+ * Validates that a range is valid (lower <= upper) and that steps are valid (> 0 and <= array length).
11353
+ *
11354
+ * @param lower - Lower bound of range
11355
+ * @param upper - Upper bound of range
11356
+ * @param steps - Optional step value to validate
11357
+ * @param type - The type of pattern part being validated
11358
+ * @param conf - The original configuration string for error messages
11359
+ * @throws {TypeError} If validation fails
11360
+ * @private
11361
+ */
11362
+ private validateRange;
11399
11363
  /**
11400
11364
  * Take care of ranges with stepping (e.g. 3-23/5)
11401
11365
  *
@@ -11428,6 +11392,15 @@ declare class CronPattern {
11428
11392
  * @returns Conf with 0 instead of sun etc.
11429
11393
  */
11430
11394
  private replaceAlphaDays;
11395
+ /**
11396
+ * Replace day name with day numbers (Quartz mode)
11397
+ * In Quartz mode: Sunday=1, Monday=2, ..., Saturday=7
11398
+ *
11399
+ * @param conf Current part, expected to be a string that might contain sun,mon etc.
11400
+ *
11401
+ * @returns Conf with Quartz-style numbering
11402
+ */
11403
+ private replaceAlphaDaysQuartz;
11431
11404
  /**
11432
11405
  * Replace month name with month numbers
11433
11406
  *
@@ -11452,13 +11425,132 @@ declare class CronPattern {
11452
11425
  */
11453
11426
  private setNthWeekdayOfMonth;
11454
11427
  }
11428
+ type CatchCallbackFn = (e: unknown, job: Cron) => void;
11429
+ type ProtectCallbackFn = (job: Cron) => void;
11430
+ /**
11431
+ * Options for configuring cron jobs.
11432
+ *
11433
+ * @interface
11434
+ */
11435
+ interface CronOptions<T = undefined> {
11436
+ /**
11437
+ * The name of the cron job. If provided, the job will be added to the
11438
+ * `scheduledJobs` array, allowing it to be accessed by name.
11439
+ */
11440
+ name?: string;
11441
+ /**
11442
+ * If true, the job will be paused initially.
11443
+ * @default false
11444
+ */
11445
+ paused?: boolean;
11446
+ /**
11447
+ * If true, the job will be stopped permanently.
11448
+ * @default false
11449
+ */
11450
+ kill?: boolean;
11451
+ /**
11452
+ * If true, errors thrown by the job function will be caught.
11453
+ * If a function is provided, it will be called with the error and the job instance.
11454
+ * @default false
11455
+ */
11456
+ catch?: boolean | CatchCallbackFn;
11457
+ /**
11458
+ * If true, the underlying timer will be unreferenced, allowing the Node.js
11459
+ * process to exit even if the job is still running.
11460
+ * @default false
11461
+ */
11462
+ unref?: boolean;
11463
+ /**
11464
+ * The maximum number of times the job will run.
11465
+ * @default Infinity
11466
+ */
11467
+ maxRuns?: number;
11468
+ /**
11469
+ * The minimum interval between job executions, in seconds.
11470
+ * @default 1
11471
+ */
11472
+ interval?: number;
11473
+ /**
11474
+ * If true, prevents the job from running if the previous execution is still in progress.
11475
+ * If a function is provided, it will be called if the job is blocked.
11476
+ * @default false
11477
+ */
11478
+ protect?: boolean | ProtectCallbackFn;
11479
+ /**
11480
+ * The date and time at which the job should start running.
11481
+ */
11482
+ startAt?: string | Date | CronDate<T>;
11483
+ /**
11484
+ * The date and time at which the job should stop running.
11485
+ */
11486
+ stopAt?: string | Date | CronDate<T>;
11487
+ /**
11488
+ * The timezone for the cron job.
11489
+ */
11490
+ timezone?: string;
11491
+ /**
11492
+ * The UTC offset for the cron job, in minutes.
11493
+ */
11494
+ utcOffset?: number;
11495
+ /**
11496
+ * If true, uses AND logic when combining day-of-month and day-of-week.
11497
+ * If false, uses OR logic for combining day-of-month and day-of-week (legacy behavior).
11498
+ * @default false
11499
+ */
11500
+ domAndDow?: boolean;
11501
+ /**
11502
+ * @deprecated Use domAndDow instead. This option will be removed in a future version.
11503
+ * If true, enables legacy mode (OR logic) for compatibility with older cron implementations.
11504
+ * Offset the scheduled date by a number of days.
11505
+ * Positive values shift the date forward, negative values shift it backward.
11506
+ * For example, dayOffset: -1 schedules the job one day before the pattern match.
11507
+ * @default 0
11508
+ */
11509
+ dayOffset?: number;
11510
+ /**
11511
+ * If true, enables legacy mode for compatibility with older cron implementations.
11512
+ * @default true
11513
+ */
11514
+ legacyMode?: boolean;
11515
+ /**
11516
+ * Specifies the cron pattern mode to use for parsing and execution.
11517
+ *
11518
+ * - "auto": Automatically detect pattern format (default behavior)
11519
+ * - "5-part": Traditional 5-field cron (minute-level precision, seconds forced to 0, years wildcarded)
11520
+ * - "6-part": Extended 6-field cron (second-level precision, years wildcarded)
11521
+ * - "7-part": Full 7-field cron (second-level and year-specific precision)
11522
+ * - "5-or-6-parts": Accept 5 or 6 field patterns (years wildcarded)
11523
+ * - "6-or-7-parts": Accept 6 or 7 field patterns (no additional constraints)
11524
+ *
11525
+ * @default "auto"
11526
+ */
11527
+ mode?: CronMode;
11528
+ /**
11529
+ * An optional context object that will be passed to the job function.
11530
+ */
11531
+ context?: T;
11532
+ /**
11533
+ * If true, enables alternative weekday numbering (Quartz mode).
11534
+ * In standard mode (false): Sunday=0, Monday=1, ..., Saturday=6
11535
+ * In Quartz mode (true): Sunday=1, Monday=2, ..., Saturday=7
11536
+ * @default false
11537
+ */
11538
+ alternativeWeekdays?: boolean;
11539
+ /**
11540
+ * If true, allows non-standard stepping formats for backward compatibility.
11541
+ * When false (default), only wildcard (*\/step) or range (min-max\/step) formats are allowed.
11542
+ * When true, allows numeric prefix formats like /10, 5/5, 30/30.
11543
+ * @default false
11544
+ */
11545
+ sloppyRanges?: boolean;
11546
+ }
11455
11547
  /**
11456
11548
  * Converts date to CronDate
11457
11549
  *
11458
11550
  * @param d Input date, if using string representation ISO 8001 (2015-11-24T19:40:00) local timezone is expected
11459
11551
  * @param tz String representation of target timezone in Europe/Stockholm format, or a number representing offset in minutes.
11460
11552
  */
11461
- declare class CronDate {
11553
+ declare class CronDate<T = undefined> {
11462
11554
  tz: string | number | undefined;
11463
11555
  /**
11464
11556
  * Current milliseconds
@@ -11494,7 +11586,36 @@ declare class CronDate {
11494
11586
  * Current full year, in local time or target timezone specified by `this.tz`
11495
11587
  */
11496
11588
  year: number;
11497
- constructor(d?: CronDate | Date | string | null, tz?: string | number);
11589
+ constructor(d?: CronDate<T> | Date | string | null, tz?: string | number);
11590
+ /**
11591
+ * Calculates the last day of a given month.
11592
+ * Uses a performance optimization for months other than February.
11593
+ *
11594
+ * @param year The year
11595
+ * @param month The month (0-11)
11596
+ * @returns The last day of the month (1-31)
11597
+ * @private
11598
+ */
11599
+ private getLastDayOfMonth;
11600
+ /**
11601
+ * Calculates the last weekday (Mon-Fri) of a given month.
11602
+ *
11603
+ * @param year The target year.
11604
+ * @param month The target month (0-11).
11605
+ * @returns The day of the month (1-31) that is the last weekday.
11606
+ * @private
11607
+ */
11608
+ private getLastWeekday;
11609
+ /**
11610
+ * Calculates the nearest weekday (Mon-Fri) to a given day of the month.
11611
+ * Handles month boundaries.
11612
+ *
11613
+ * @param year The target year.
11614
+ * @param month The target month (0-11).
11615
+ * @param day The target day (1-31).
11616
+ * @returns The day of the month (1-31) that is the nearest weekday, or -1 if the day doesn't exist in the month.
11617
+ */
11618
+ private getNearestWeekday;
11498
11619
  /**
11499
11620
  * Check if the given date is the nth occurrence of a weekday in its month.
11500
11621
  *
@@ -11530,6 +11651,21 @@ declare class CronDate {
11530
11651
  * Find next match of current part
11531
11652
  */
11532
11653
  private findNext;
11654
+ /**
11655
+ * Internal unified method to find a matching time component in either direction.
11656
+ * This method searches through the pattern to find the next or previous valid value
11657
+ * for the specified target component (second, minute, hour, day, or month).
11658
+ *
11659
+ * @param options Cron options
11660
+ * @param target Target property (second, minute, hour, day, month)
11661
+ * @param pattern Pattern to use
11662
+ * @param offset Offset to use
11663
+ * @param direction 1 for forward (next), -1 for backward (previous)
11664
+ * @returns Status code: 1 = same value matches, 2 = value changed, 3 = no match found
11665
+ *
11666
+ * @private
11667
+ */
11668
+ private _findMatch;
11533
11669
  /**
11534
11670
  * Increment to next run time recursively.
11535
11671
  *
@@ -11538,9 +11674,9 @@ declare class CronDate {
11538
11674
  * approach to handle the dependencies between different components. For example,
11539
11675
  * if the day changes, the hour, minute, and second need to be reset.
11540
11676
  *
11541
- * The recursion is currently limited to the year 3000 to prevent potential
11542
- * infinite loops or excessive stack depth. If you need to schedule beyond
11543
- * the year 3000, please open an issue on GitHub to discuss possible solutions.
11677
+ * The recursion is limited to the year 10000 to prevent potential
11678
+ * infinite loops or excessive stack depth, and to match the maximum supported
11679
+ * year in OCPS 1.2 (years 1-9999).
11544
11680
  *
11545
11681
  * @param pattern The cron pattern used to determine the next run time.
11546
11682
  * @param options The cron options that influence the incrementing behavior.
@@ -11548,7 +11684,7 @@ declare class CronDate {
11548
11684
  * date component being processed. 0 represents "month", 1 represents "day", etc.
11549
11685
  *
11550
11686
  * @returns This `CronDate` instance for chaining, or null if incrementing
11551
- * was not possible (e.g., reached year 3000 limit or no matching date).
11687
+ * was not possible (e.g., reached year 10000 limit or no matching date).
11552
11688
  *
11553
11689
  * @private
11554
11690
  */
@@ -11561,7 +11697,57 @@ declare class CronDate {
11561
11697
  * @param hasPreviousRun True if there was a previous run, false otherwise. This is used to determine whether to apply the minimum interval.
11562
11698
  * @returns This CronDate instance for chaining, or null if incrementing was not possible (e.g., reached year 3000 limit).
11563
11699
  */
11564
- increment(pattern: CronPattern, options: CronOptions, hasPreviousRun: boolean): CronDate | null;
11700
+ increment(pattern: CronPattern, options: CronOptions<T>, hasPreviousRun: boolean): CronDate<T> | null;
11701
+ /**
11702
+ * Decrement to previous run time
11703
+ *
11704
+ * @param pattern The pattern used to decrement the current date.
11705
+ * @param options Cron options used for decrementing.
11706
+ * @returns This CronDate instance for chaining, or null if decrementing was not possible (e.g., reached year 0).
11707
+ */
11708
+ decrement(pattern: CronPattern, options: CronOptions<T>): CronDate<T> | null;
11709
+ /**
11710
+ * Find previous match by recursively checking pattern parts in reverse.
11711
+ *
11712
+ * This is the backward equivalent of the recurse() method. It searches backwards
11713
+ * through time to find the previous date/time that matches the cron pattern.
11714
+ *
11715
+ * @param pattern The cron pattern used to determine the previous run time.
11716
+ * @param options The cron options that influence the decrementing behavior.
11717
+ * @param doing The index of the `RecursionSteps` array indicating the current
11718
+ * date component being processed.
11719
+ *
11720
+ * @returns This `CronDate` instance for chaining, or null if decrementing
11721
+ * was not possible (e.g., reached year 0 or no matching date).
11722
+ *
11723
+ * @private
11724
+ */
11725
+ private recurseBackward;
11726
+ /**
11727
+ * Get the maximum value in a pattern for a given target.
11728
+ * Used when resetting components during backward recursion.
11729
+ *
11730
+ * @param target The target component (second, minute, hour, day, month)
11731
+ * @param pattern The cron pattern
11732
+ * @param offset The offset to apply
11733
+ * @returns The maximum valid value for the target component
11734
+ *
11735
+ * @private
11736
+ */
11737
+ private getMaxPatternValue;
11738
+ /**
11739
+ * Find previous match for a specific component going backwards in time.
11740
+ * This is the backward equivalent of the findNext() method.
11741
+ *
11742
+ * @param options Cron options
11743
+ * @param target Target property (second, minute, hour, day, month)
11744
+ * @param pattern Pattern to use
11745
+ * @param offset Offset to use
11746
+ * @returns Status code: 1 = same value matches, 2 = value changed to earlier value, 3 = no match found
11747
+ *
11748
+ * @private
11749
+ */
11750
+ private findPrevious;
11565
11751
  /**
11566
11752
  * Convert current state back to a javascript Date()
11567
11753
  *
@@ -11572,6 +11758,14 @@ declare class CronDate {
11572
11758
  * Convert current state back to a javascript Date() and return UTC milliseconds
11573
11759
  */
11574
11760
  getTime(): number;
11761
+ /**
11762
+ * Check if the current CronDate matches a cron pattern
11763
+ *
11764
+ * @param pattern The cron pattern to match against
11765
+ * @param options The cron options that influence matching
11766
+ * @returns true if the date matches the pattern, false otherwise
11767
+ */
11768
+ match(pattern: CronPattern, options: CronOptions<T>): boolean;
11575
11769
  }
11576
11770
  /**
11577
11771
  * Callback function type
@@ -11581,7 +11775,7 @@ declare class CronDate {
11581
11775
  *
11582
11776
  * @returns void or Promise<void> for async callbacks
11583
11777
  */
11584
- type CronCallback = (self: InstanceType<typeof Cron>, context: unknown) => void | Promise<void>;
11778
+ type CronCallback<T = undefined> = (self: InstanceType<typeof Cron<T>>, context: T) => void | Promise<void>;
11585
11779
  /**
11586
11780
  * Cron entrypoint
11587
11781
  *
@@ -11590,19 +11784,36 @@ type CronCallback = (self: InstanceType<typeof Cron>, context: unknown) => void
11590
11784
  * @param [fnOrOptions1] - Options or function to be run each iteration of pattern
11591
11785
  * @param [fnOrOptions2] - Options or function to be run each iteration of pattern
11592
11786
  */
11593
- declare class Cron {
11787
+ declare class Cron<T = undefined> {
11594
11788
  name: string | undefined;
11595
- options: CronOptions;
11789
+ options: CronOptions<T>;
11596
11790
  private _states;
11597
11791
  private fn?;
11598
- constructor(pattern: string | Date, fnOrOptions1?: CronOptions | CronCallback, fnOrOptions2?: CronOptions | CronCallback);
11792
+ /**
11793
+ * Internal helper to get the timezone or UTC offset for date operations.
11794
+ * Reduces duplication of `this.options.timezone || this.options.utcOffset` throughout the codebase.
11795
+ *
11796
+ * @returns The timezone string or UTC offset number
11797
+ * @private
11798
+ */
11799
+ private getTz;
11800
+ /**
11801
+ * Internal helper to apply dayOffset to a date if configured.
11802
+ * Reduces duplication of dayOffset calculation logic.
11803
+ *
11804
+ * @param date - The base date to apply offset to
11805
+ * @returns The date with dayOffset applied, or the original date if no offset is configured
11806
+ * @private
11807
+ */
11808
+ private applyDayOffset;
11809
+ constructor(pattern: string | Date, fnOrOptions1?: CronOptions<T> | CronCallback<T>, fnOrOptions2?: CronOptions<T> | CronCallback<T>);
11599
11810
  /**
11600
11811
  * Find next runtime, based on supplied date. Strips milliseconds.
11601
11812
  *
11602
11813
  * @param prev - Optional. Date to start from. Can be a CronDate, Date object, or a string representing a date.
11603
11814
  * @returns The next run time as a Date object, or null if there is no next run.
11604
11815
  */
11605
- nextRun(prev?: CronDate | Date | string | null): Date | null;
11816
+ nextRun(prev?: CronDate<T> | Date | string | null): Date | null;
11606
11817
  /**
11607
11818
  * Find next n runs, based on supplied date. Strips milliseconds.
11608
11819
  *
@@ -11612,11 +11823,43 @@ declare class Cron {
11612
11823
  */
11613
11824
  nextRuns(n: number, previous?: Date | string): Date[];
11614
11825
  /**
11615
- * Return the original pattern, if there was one
11826
+ * Find previous n runs, based on supplied date. Strips milliseconds.
11827
+ *
11828
+ * @param n - Number of runs to enumerate
11829
+ * @param reference - Date to start from (defaults to now)
11830
+ * @returns - Previous n run times in reverse chronological order (most recent first)
11831
+ */
11832
+ previousRuns(n: number, reference?: Date | string): Date[];
11833
+ /**
11834
+ * Internal helper to enumerate runs in either direction.
11835
+ *
11836
+ * @param n - Number of runs to enumerate
11837
+ * @param startDate - Date to start from
11838
+ * @param direction - Direction to enumerate ("next" or "previous")
11839
+ * @returns Array of run times with dayOffset applied
11840
+ * @private
11841
+ */
11842
+ private _enumerateRuns;
11843
+ /**
11844
+ * Check if a given date matches the cron pattern
11845
+ *
11846
+ * @param date - Date to check. Can be a Date object or a string representing a date.
11847
+ * @returns true if the date matches the pattern, false otherwise
11848
+ */
11849
+ match(date: Date | string): boolean;
11850
+ /**
11851
+ * Return the original pattern, if there was one.
11852
+ * Returns undefined when the job was created with a Date or ISO 8601 string instead of a cron pattern.
11616
11853
  *
11617
- * @returns Original pattern
11854
+ * @returns Original cron pattern, or undefined for date-based jobs
11618
11855
  */
11619
11856
  getPattern(): string | undefined;
11857
+ /**
11858
+ * Return the original run-once date, if there was one
11859
+ *
11860
+ * @returns Original run-once date, or null if not a run-once job
11861
+ */
11862
+ getOnce(): Date | null;
11620
11863
  /**
11621
11864
  * Indicates whether or not the cron job is scheduled and running, e.g. awaiting next trigger
11622
11865
  *
@@ -11652,7 +11895,7 @@ declare class Cron {
11652
11895
  *
11653
11896
  * @param prev Starting date, defaults to now - minimum interval
11654
11897
  */
11655
- msToNext(prev?: CronDate | Date | string): number | null;
11898
+ msToNext(prev?: CronDate<T> | Date | string): number | null;
11656
11899
  /**
11657
11900
  * Stop execution
11658
11901
  *
@@ -11677,7 +11920,7 @@ declare class Cron {
11677
11920
  *
11678
11921
  * @param func - Function to be run each iteration of pattern
11679
11922
  */
11680
- schedule(func?: CronCallback): Cron;
11923
+ schedule(func?: CronCallback<T>): Cron<T>;
11681
11924
  /**
11682
11925
  * Internal function to trigger a run, used by both scheduled and manual trigger
11683
11926
  */
@@ -11700,6 +11943,13 @@ declare class Cron {
11700
11943
  * Internal version of next. Cron needs millseconds internally, hence _next.
11701
11944
  */
11702
11945
  private _next;
11946
+ /**
11947
+ * Internal version of previous. Finds the previous scheduled run time.
11948
+ *
11949
+ * @param referenceDate - Optional reference date to search backwards from (defaults to now)
11950
+ * @returns Previous scheduled run time, or null if no previous run exists
11951
+ */
11952
+ private _previous;
11703
11953
  /**
11704
11954
  * Calculate the previous run if no previous run is supplied, but startAt and interval are set.
11705
11955
  * This calculation is only necessary if the startAt time is before the current time.
@@ -13670,11 +13920,17 @@ declare class BasePayload {
13670
13920
  workflow: TTaskOrWorkflowSlug extends keyof TypedJobs["workflows"] ? TTaskOrWorkflowSlug : never;
13671
13921
  }) => Promise<TTaskOrWorkflowSlug extends keyof TypedJobs["workflows"] ? Job<TTaskOrWorkflowSlug> : RunningJobFromTask<TTaskOrWorkflowSlug>>;
13672
13922
  run: (args?: {
13673
- allQueues?: boolean;
13923
+ allQueues
13924
+ /**
13925
+ * Interface to be module-augmented by the `payload-types.ts` file.
13926
+ * When augmented, its properties take precedence over UntypedPayloadTypes.
13927
+ */
13928
+ ?: boolean;
13674
13929
  limit?: number;
13675
13930
  overrideAccess?: boolean;
13676
13931
  processingOrder?: Sort;
13677
13932
  queue?: string;
13933
+ randomID?: string;
13678
13934
  req?: PayloadRequest;
13679
13935
  sequential?: boolean;
13680
13936
  silent?: RunJobsSilent;
package/dist/index.d.ts CHANGED
@@ -353,11 +353,17 @@ export declare class BasePayload {
353
353
  workflow: TTaskOrWorkflowSlug extends keyof TypedJobs["workflows"] ? TTaskOrWorkflowSlug : never;
354
354
  }) => Promise<TTaskOrWorkflowSlug extends keyof TypedJobs["workflows"] ? Job<TTaskOrWorkflowSlug> : import("./queues/config/types/workflowTypes.js").RunningJobFromTask<TTaskOrWorkflowSlug>>;
355
355
  run: (args?: {
356
- allQueues?: boolean;
356
+ allQueues
357
+ /**
358
+ * Interface to be module-augmented by the `payload-types.ts` file.
359
+ * When augmented, its properties take precedence over UntypedPayloadTypes.
360
+ */
361
+ ?: boolean;
357
362
  limit?: number;
358
363
  overrideAccess?: boolean;
359
364
  processingOrder?: import("./types/index.js").Sort;
360
365
  queue?: string;
366
+ randomID?: string;
361
367
  req?: import("./types/index.js").PayloadRequest;
362
368
  sequential?: boolean;
363
369
  silent?: import("./queues/localAPI.js").RunJobsSilent;