scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
184 lines (181 loc) • 10.9 kB
TypeScript
import { AbsRecurrenceRule } from 'scriptable-abstract';
/**
* Interface representing the state of a recurrence rule
*/
interface RecurrenceRuleState {
interval: number;
endDate?: Date;
occurrenceCount?: number;
daysOfTheWeek?: readonly number[];
daysOfTheMonth?: readonly number[];
monthsOfTheYear?: readonly number[];
weeksOfTheYear?: readonly number[];
daysOfTheYear?: readonly number[];
setPositions?: readonly number[];
}
/**
* Mock implementation of Scriptable's RecurrenceRule class
*/
declare class MockRecurrenceRule extends AbsRecurrenceRule<RecurrenceRuleState> {
private constructor();
get asRecurrenceRule(): RecurrenceRule;
get interval(): number;
get endDate(): Date | null;
get occurrenceCount(): number | null;
get daysOfTheWeek(): readonly number[];
get daysOfTheMonth(): readonly number[];
get monthsOfTheYear(): readonly number[];
get weeksOfTheYear(): readonly number[];
get daysOfTheYear(): readonly number[];
get setPositions(): readonly number[];
/**
* Constructs a daily recurrence rule
* @param interval - Interval at which to repeat the rule
*/
static daily(interval: number): RecurrenceRule;
/**
* Constructs a daily recurrence rule with an end date
* @param interval - Interval at which to repeat the rule
* @param endDate - Date at which the recurrence rule should end
*/
static dailyEndDate(interval: number, endDate: Date): RecurrenceRule;
/**
* Constructs a daily recurrence rule with an occurrence count
* @param interval - Interval at which to repeat the rule
* @param occurrenceCount - Number of times the rule should repeat before it ends
*/
static dailyOccurrenceCount(interval: number, occurrenceCount: number): RecurrenceRule;
/**
* Constructs a weekly recurrence rule
* @param interval - Interval at which to repeat the rule
*/
static weekly(interval: number): RecurrenceRule;
/**
* Constructs a weekly recurrence rule with an end date
* @param interval - Interval at which to repeat the rule
* @param endDate - Date at which the recurrence rule should end
*/
static weeklyEndDate(interval: number, endDate: Date): RecurrenceRule;
/**
* Constructs a weekly recurrence rule with an occurrence count
* @param interval - Interval at which to repeat the rule
* @param occurrenceCount - Number of times the rule should repeat before it ends
*/
static weeklyOccurrenceCount(interval: number, occurrenceCount: number): RecurrenceRule;
/**
* Constructs a monthly recurrence rule
* @param interval - Interval at which to repeat the rule
*/
static monthly(interval: number): RecurrenceRule;
/**
* Constructs a monthly recurrence rule with an end date
* @param interval - Interval at which to repeat the rule
* @param endDate - Date at which the recurrence rule should end
*/
static monthlyEndDate(interval: number, endDate: Date): RecurrenceRule;
/**
* Constructs a monthly recurrence rule with an occurrence count
* @param interval - Interval at which to repeat the rule
* @param occurrenceCount - Number of times the rule should repeat before it ends
*/
static monthlyOccurrenceCount(interval: number, occurrenceCount: number): RecurrenceRule;
/**
* Constructs a yearly recurrence rule
* @param interval - Interval at which to repeat the rule
*/
static yearly(interval: number): RecurrenceRule;
/**
* Constructs a yearly recurrence rule with an end date
* @param interval - Interval at which to repeat the rule
* @param endDate - Date at which the recurrence rule should end
*/
static yearlyEndDate(interval: number, endDate: Date): RecurrenceRule;
/**
* Constructs a yearly recurrence rule with an occurrence count
* @param interval - Interval at which to repeat the rule
* @param occurrenceCount - Number of times the rule should repeat before it ends
*/
static yearlyOccurrenceCount(interval: number, occurrenceCount: number): RecurrenceRule;
/**
* Constructs a complex weekly recurrence rule
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param setPositions - Filters which recurrences to include in the rule's frequency
*/
static complexWeekly(interval: number, daysOfTheWeek: readonly number[], setPositions: readonly number[]): RecurrenceRule;
/**
* Constructs a complex weekly recurrence rule with an end date
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param setPositions - Filters which recurrences to include in the rule's frequency
* @param endDate - Date at which the recurrence rule should end
*/
static complexWeeklyEndDate(interval: number, daysOfTheWeek: readonly number[], setPositions: readonly number[], endDate: Date): RecurrenceRule;
/**
* Constructs a complex weekly recurrence rule with an occurrence count
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param setPositions - Filters which recurrences to include in the rule's frequency
* @param occurrenceCount - Number of times the rule should repeat before it ends
*/
static complexWeeklyOccurrenceCount(interval: number, daysOfTheWeek: readonly number[], setPositions: readonly number[], occurrenceCount: number): RecurrenceRule;
/**
* Constructs a complex monthly recurrence rule
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param daysOfTheMonth - Days of the month to repeat the rule. Values range from 1 to 31 and from -1 to -31
* @param setPositions - Filters which recurrences to include in the rule's frequency
*/
static complexMonthly(interval: number, daysOfTheWeek: readonly number[], daysOfTheMonth: readonly number[], setPositions: readonly number[]): RecurrenceRule;
/**
* Constructs a complex monthly recurrence rule with an end date
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param daysOfTheMonth - Days of the month to repeat the rule. Values range from 1 to 31 and from -1 to -31
* @param setPositions - Filters which recurrences to include in the rule's frequency
* @param endDate - Date at which the recurrence rule should end
*/
static complexMonthlyEndDate(interval: number, daysOfTheWeek: readonly number[], daysOfTheMonth: readonly number[], setPositions: readonly number[], endDate: Date): RecurrenceRule;
/**
* Constructs a complex monthly recurrence rule with an occurrence count
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param daysOfTheMonth - Days of the month to repeat the rule. Values range from 1 to 31 and from -1 to -31
* @param setPositions - Filters which recurrences to include in the rule's frequency
* @param occurrenceCount - Number of times the rule should repeat before it ends
*/
static complexMonthlyOccurrenceCount(interval: number, daysOfTheWeek: readonly number[], daysOfTheMonth: readonly number[], setPositions: readonly number[], occurrenceCount: number): RecurrenceRule;
/**
* Constructs a complex yearly recurrence rule
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param monthsOfTheYear - Months of the year to repeat the rule. Values range from 1 to 12
* @param weeksOfTheYear - Weeks of the year to repeat the rule. Values range from 1 to 53 and from -1 to -53
* @param daysOfTheYear - Days of the year to repeat the rule. Values range from 1 to 366 and from -1 to -366
* @param setPositions - Filters which recurrences to include in the rule's frequency
*/
static complexYearly(interval: number, daysOfTheWeek: readonly number[], monthsOfTheYear: readonly number[], weeksOfTheYear: readonly number[], daysOfTheYear: readonly number[], setPositions: readonly number[]): RecurrenceRule;
/**
* Constructs a complex yearly recurrence rule with an end date
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param monthsOfTheYear - Months of the year to repeat the rule. Values range from 1 to 12
* @param weeksOfTheYear - Weeks of the year to repeat the rule. Values range from 1 to 53 and from -1 to -53
* @param daysOfTheYear - Days of the year to repeat the rule. Values range from 1 to 366 and from -1 to -366
* @param setPositions - Filters which recurrences to include in the rule's frequency
* @param endDate - Date at which the recurrence rule should end
*/
static complexYearlyEndDate(interval: number, daysOfTheWeek: readonly number[], monthsOfTheYear: readonly number[], weeksOfTheYear: readonly number[], daysOfTheYear: readonly number[], setPositions: readonly number[], endDate: Date): RecurrenceRule;
/**
* Constructs a complex yearly recurrence rule with an occurrence count
* @param interval - Interval at which to repeat the rule
* @param daysOfTheWeek - Days of the week to repeat the rule. Values range from 1 to 7, with Sunday being 1
* @param monthsOfTheYear - Months of the year to repeat the rule. Values range from 1 to 12
* @param weeksOfTheYear - Weeks of the year to repeat the rule. Values range from 1 to 53 and from -1 to -53
* @param daysOfTheYear - Days of the year to repeat the rule. Values range from 1 to 366 and from -1 to -366
* @param setPositions - Filters which recurrences to include in the rule's frequency
* @param occurrenceCount - Number of times the rule should repeat before it ends
*/
static complexYearlyOccurrenceCount(interval: number, daysOfTheWeek: readonly number[], monthsOfTheYear: readonly number[], weeksOfTheYear: readonly number[], daysOfTheYear: readonly number[], setPositions: readonly number[], occurrenceCount: number): RecurrenceRule;
}
export { MockRecurrenceRule };