@dereekb/date 13.0.7 → 13.1.0

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.
Files changed (40) hide show
  1. package/index.cjs.js +3526 -993
  2. package/index.esm.js +3515 -983
  3. package/package.json +5 -6
  4. package/src/lib/date/date.calendar.d.ts +63 -9
  5. package/src/lib/date/date.cell.d.ts +203 -104
  6. package/src/lib/date/date.cell.factory.d.ts +319 -86
  7. package/src/lib/date/date.cell.filter.d.ts +104 -2
  8. package/src/lib/date/date.cell.index.d.ts +202 -92
  9. package/src/lib/date/date.cell.schedule.d.ts +285 -102
  10. package/src/lib/date/date.cell.schedule.day.d.ts +13 -3
  11. package/src/lib/date/date.cell.validator.d.ts +6 -8
  12. package/src/lib/date/date.cell.week.d.ts +24 -3
  13. package/src/lib/date/date.d.ts +481 -54
  14. package/src/lib/date/date.day.d.ts +139 -49
  15. package/src/lib/date/date.duration.d.ts +49 -11
  16. package/src/lib/date/date.format.d.ts +355 -36
  17. package/src/lib/date/date.hashset.d.ts +11 -0
  18. package/src/lib/date/date.logical.d.ts +61 -3
  19. package/src/lib/date/date.range.d.ts +355 -77
  20. package/src/lib/date/date.range.string.d.ts +39 -0
  21. package/src/lib/date/date.range.timezone.d.ts +18 -6
  22. package/src/lib/date/date.round.d.ts +46 -1
  23. package/src/lib/date/date.rxjs.d.ts +29 -7
  24. package/src/lib/date/date.sort.d.ts +36 -9
  25. package/src/lib/date/date.time.d.ts +197 -26
  26. package/src/lib/date/date.time.limit.d.ts +67 -4
  27. package/src/lib/date/date.time.minute.d.ts +269 -30
  28. package/src/lib/date/date.timezone.d.ts +286 -70
  29. package/src/lib/date/date.unix.d.ts +3 -0
  30. package/src/lib/date/date.week.d.ts +115 -51
  31. package/src/lib/query/query.builder.d.ts +91 -0
  32. package/src/lib/query/query.builder.mongo.d.ts +50 -0
  33. package/src/lib/query/query.filter.d.ts +29 -2
  34. package/src/lib/query/query.request.d.ts +16 -0
  35. package/src/lib/rrule/date.recurrence.d.ts +66 -22
  36. package/src/lib/rrule/date.rrule.d.ts +131 -8
  37. package/src/lib/rrule/date.rrule.extension.d.ts +50 -9
  38. package/src/lib/rrule/date.rrule.parse.d.ts +85 -2
  39. package/src/lib/timezone/timezone.d.ts +102 -2
  40. package/src/lib/timezone/timezone.validator.d.ts +9 -4
@@ -5,6 +5,12 @@ import { type DateCellTimingRelativeIndexFactoryInput, type DateCellTimingExpans
5
5
  import { type DateCellRangeOrDateRange, type DateCellRangeWithRange } from './date.cell.index';
6
6
  import { type DateTimezoneUtcNormalInstance } from './date.timezone';
7
7
  import { type YearWeekCodeConfig } from './date.week';
8
+ /**
9
+ * Encodes days of the week as numeric codes for use in schedule filtering.
10
+ *
11
+ * Values 1-7 map to individual days (offset by +1 from DayOfWeek), while
12
+ * 8 and 9 serve as shorthand for all weekdays or weekend days respectively.
13
+ */
8
14
  export declare enum DateCellScheduleDayCode {
9
15
  /**
10
16
  * Special no-op/unused code
@@ -26,21 +32,36 @@ export declare enum DateCellScheduleDayCode {
26
32
  */
27
33
  WEEKEND = 9
28
34
  }
35
+ /**
36
+ * Returns day codes representing all seven days of the week using the WEEKDAY and WEEKEND shorthand codes.
37
+ *
38
+ * @returns array containing WEEKDAY and WEEKEND codes
39
+ */
29
40
  export declare function fullWeekDateCellScheduleDayCodes(): DateCellScheduleDayCode[];
41
+ /**
42
+ * Returns individual day codes for Monday through Friday.
43
+ *
44
+ * @returns array of five weekday codes
45
+ */
30
46
  export declare function weekdayDateCellScheduleDayCodes(): DateCellScheduleDayCode[];
47
+ /**
48
+ * Returns individual day codes for Saturday and Sunday.
49
+ *
50
+ * @returns array of two weekend codes
51
+ */
31
52
  export declare function weekendDateCellScheduleDayCodes(): DateCellScheduleDayCode[];
32
53
  /**
33
- * Creates an EnabledDays from the input.
54
+ * Creates an EnabledDays from the input by expanding schedule day codes to their corresponding days of the week.
34
55
  *
35
- * @param input
36
- * @returns
56
+ * @param input - schedule day codes to convert (WEEKDAY/WEEKEND shorthand codes are expanded)
57
+ * @returns an EnabledDays object with boolean flags for each day
37
58
  */
38
59
  export declare function enabledDaysFromDateCellScheduleDayCodes(input: Maybe<Iterable<DateCellScheduleDayCode>>): EnabledDays;
39
60
  /**
40
- * Creates an array of simplified DateCellScheduleDayCode[] values from the input.
61
+ * Creates an array of simplified DateCellScheduleDayCode values from the input EnabledDays, using shorthand codes (WEEKDAY/WEEKEND) where possible.
41
62
  *
42
- * @param input
43
- * @returns
63
+ * @param input - enabled days to convert back to schedule day codes
64
+ * @returns simplified array of day codes
44
65
  */
45
66
  export declare function dateCellScheduleDayCodesFromEnabledDays(input: Maybe<EnabledDays>): DateCellScheduleDayCode[];
46
67
  /**
@@ -51,88 +72,133 @@ export declare const DATE_CELL_SCHEDULE_ENCODED_WEEK_REGEX: RegExp;
51
72
  /**
52
73
  * Returns true if the input is a DateCellScheduleEncodedWeek.
53
74
  *
54
- * @param input
55
- * @returns
75
+ * @param input - string to validate against the encoded week regex
76
+ * @returns whether the string matches the encoded week format
56
77
  */
57
78
  export declare function isDateCellScheduleEncodedWeek(input: string): input is DateCellScheduleEncodedWeek;
58
79
  /**
59
- * Returns true if the input string represents an empty DateCellScheduleEncodedWeek.
80
+ * Returns true if the input string represents an empty DateCellScheduleEncodedWeek (no days selected).
60
81
  *
61
- * @param input
62
- * @returns
82
+ * @param input - string to check for emptiness
83
+ * @returns whether the encoded week represents no selected days
63
84
  */
64
85
  export declare function isEmptyDateCellScheduleEncodedWeek(input: string): input is DateCellScheduleEncodedWeek;
65
86
  /**
66
87
  * Creates a DateCellScheduleEncodedWeek from an array of DateCellScheduleDayCode values.
67
88
  *
68
- * The returned encoded week is simplified.
89
+ * The returned encoded week is simplified so redundant individual day codes are replaced with shorthand (e.g., Mon-Fri becomes WEEKDAY).
90
+ *
91
+ * @param codes - day codes to encode into the compact string representation
92
+ * @returns the encoded week string
69
93
  *
70
- * @param codes
94
+ * @example
95
+ * ```ts
96
+ * // Encode weekdays only
97
+ * dateCellScheduleEncodedWeek([DateCellScheduleDayCode.MONDAY, DateCellScheduleDayCode.TUESDAY, DateCellScheduleDayCode.WEDNESDAY, DateCellScheduleDayCode.THURSDAY, DateCellScheduleDayCode.FRIDAY]);
98
+ * // Returns '8' (WEEKDAY shorthand)
99
+ *
100
+ * // Encode specific days
101
+ * dateCellScheduleEncodedWeek([DateCellScheduleDayCode.MONDAY, DateCellScheduleDayCode.WEDNESDAY]);
102
+ * // Returns '24'
103
+ * ```
71
104
  */
72
105
  export declare function dateCellScheduleEncodedWeek(codes: Iterable<DateCellScheduleDayCode>): DateCellScheduleEncodedWeek;
73
106
  /**
74
107
  * Reduces/merges any day codes into more simplified day codes.
75
108
  *
76
- * For instance, if all days of the week are selected, they will be reduced to "8".
109
+ * For instance, if all five weekdays are selected, they will be reduced to WEEKDAY (8).
110
+ * Similarly, Saturday + Sunday becomes WEEKEND (9).
111
+ *
112
+ * @param codes - day codes to simplify
113
+ * @returns simplified array with shorthand codes where applicable
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * // All weekdays collapse to WEEKDAY
118
+ * simplifyDateCellScheduleDayCodes([2, 3, 4, 5, 6]);
119
+ * // Returns [DateCellScheduleDayCode.WEEKDAY] // [8]
120
+ *
121
+ * // Saturday + Sunday collapses to WEEKEND
122
+ * simplifyDateCellScheduleDayCodes([1, 7]);
123
+ * // Returns [DateCellScheduleDayCode.WEEKEND] // [9]
77
124
  *
78
- * @param codes
79
- * @returns
125
+ * // Mixed: partial weekdays remain individual
126
+ * simplifyDateCellScheduleDayCodes([2, 4]);
127
+ * // Returns [DateCellScheduleDayCode.MONDAY, DateCellScheduleDayCode.WEDNESDAY] // [2, 4]
128
+ * ```
80
129
  */
81
130
  export declare function simplifyDateCellScheduleDayCodes(codes: Iterable<DateCellScheduleDayCode>): DateCellScheduleDayCode[];
131
+ /**
132
+ * Flexible input type for day codes: accepts an encoded week string, a single code, an array, or a Set.
133
+ */
82
134
  export type DateCellScheduleDayCodesInput = DateCellScheduleEncodedWeek | ArrayOrValue<DateCellScheduleDayCode> | Set<DateCellScheduleDayCode>;
83
135
  /**
84
- * Expands the input DateCellScheduleDayCodesInput to a Set of DayOfWeek values.
136
+ * Expands the input DateCellScheduleDayCodesInput to a Set of DayOfWeek values, converting from the +1 offset used by schedule day codes back to standard DayOfWeek.
85
137
  *
86
- * @param input
87
- * @returns
138
+ * @param input - day codes to expand (shorthand codes like WEEKDAY are expanded to individual days)
139
+ * @returns set of DayOfWeek values
88
140
  */
89
141
  export declare function expandDateCellScheduleDayCodesToDayOfWeekSet(input: DateCellScheduleDayCodesInput): Set<DayOfWeek>;
142
+ /**
143
+ * Converts DayOfWeek values to their corresponding DateCellScheduleDayCode values (offset by +1).
144
+ *
145
+ * @param input - days of the week to convert
146
+ * @returns set of individual schedule day codes (no shorthand grouping applied)
147
+ */
90
148
  export declare function dateCellScheduleDayCodesSetFromDaysOfWeek(input: Iterable<DayOfWeek>): Set<DateCellScheduleDayCode>;
91
149
  /**
92
- * Expands the input into an array of DateCellScheduleDayCode values.
150
+ * Expands the input into a sorted array of individual DateCellScheduleDayCode values.
93
151
  *
94
- * The values are sorted in ascending order.
152
+ * Shorthand codes (WEEKDAY, WEEKEND) are expanded to their constituent day codes, sorted ascending.
95
153
  *
96
- * @param input
97
- * @returns
154
+ * @param input - day codes to expand
155
+ * @returns sorted array of individual day codes (1-7 only, no shorthand)
98
156
  */
99
157
  export declare function expandDateCellScheduleDayCodes(input: DateCellScheduleDayCodesInput): DateCellScheduleDayCode[];
100
158
  /**
101
- * Expands the input DateCellScheduleDayCodesInput to a Set of DayOfWeek values.
159
+ * Expands the input DateCellScheduleDayCodesInput to a Set of individual DateCellScheduleDayCode values (1-7), expanding shorthand codes like WEEKDAY and WEEKEND.
102
160
  *
103
- * @param input
104
- * @returns
161
+ * @param input - day codes to expand into a set
162
+ * @returns set of individual day codes with shorthand codes resolved
105
163
  */
106
164
  export declare function expandDateCellScheduleDayCodesToDayCodesSet(input: DateCellScheduleDayCodesInput): Set<DateCellScheduleDayCode>;
107
165
  /**
108
- * Converts the input DateCellScheduleDayCodesInput to an array of DateCellScheduleDayCode values, but does not expand
166
+ * Converts the input to an array of DateCellScheduleDayCode values without expanding shorthand codes (WEEKDAY/WEEKEND remain as-is).
167
+ *
168
+ * Filters out the NONE (0) code.
109
169
  *
110
- * @param input
111
- * @returns
170
+ * @param input - day codes input in any supported format
171
+ * @returns raw array of day codes with NONE values removed
112
172
  */
113
173
  export declare function rawDateCellScheduleDayCodes(input: DateCellScheduleDayCodesInput): DateCellScheduleDayCode[];
114
174
  /**
115
175
  * Used to convert the input dates into a DateCellScheduleDayCode.
116
176
  */
117
177
  export type DateCellScheduleDayCodeFactory = (date: Date) => DateCellScheduleDayCode;
178
+ /**
179
+ * Configuration for creating a DateCellScheduleDayCodeFactory, specifying the timezone context.
180
+ */
118
181
  export type DateCellScheduleDayCodeConfig = Pick<YearWeekCodeConfig, 'timezone'>;
119
182
  /**
120
- * Creates a DateCellScheduleDayCodeFactory using the optional input config.
183
+ * Creates a DateCellScheduleDayCodeFactory that converts dates to their corresponding day code, accounting for timezone normalization.
121
184
  *
122
- * @param config
123
- * @returns
185
+ * @param config - optional timezone configuration; defaults to system timezone if not provided
186
+ * @returns a factory function that maps a Date to its DateCellScheduleDayCode
124
187
  */
125
188
  export declare function dateCellScheduleDayCodeFactory(config?: DateCellScheduleDayCodeConfig): DateCellScheduleDayCodeFactory;
126
189
  /**
127
- * Returns true if the input codes, when expanded, are equivalent.
190
+ * Returns true if both inputs, when fully expanded to individual day codes, represent the same set of days.
128
191
  *
129
- * @param a
130
- * @param b
131
- * @returns
192
+ * @param a - first day codes input to compare
193
+ * @param b - second day codes input to compare
194
+ * @returns whether both inputs resolve to the same days of the week
132
195
  */
133
196
  export declare function dateCellScheduleDayCodesAreSetsEquivalent(a: DateCellScheduleDayCodesInput, b: DateCellScheduleDayCodesInput): boolean;
134
197
  /**
135
- * Scheduled used to filter to disable DateCell values for a job.
198
+ * Schedule configuration used to control which DateCell values are active for a recurring event.
199
+ *
200
+ * Combines weekly recurrence patterns (via encoded week days) with explicit include/exclude lists
201
+ * for fine-grained control over individual date cell indices.
136
202
  */
137
203
  export interface DateCellSchedule {
138
204
  /**
@@ -149,21 +215,30 @@ export interface DateCellSchedule {
149
215
  ex?: DateCellIndex[];
150
216
  }
151
217
  /**
152
- * Returns true if the input is a DateCellSchedule.
218
+ * Returns true if the input is structurally a DateCellSchedule (has the expected shape).
153
219
  *
154
- * @param input
155
- * @returns
220
+ * @param input - object to check
221
+ * @returns whether the input matches the DateCellSchedule structure
156
222
  */
157
223
  export declare function isDateCellSchedule(input: object): input is DateCellSchedule;
224
+ /**
225
+ * Returns true if both schedules have the same encoded week, included indices, and excluded indices.
226
+ *
227
+ * @param a - first schedule to compare
228
+ * @param b - second schedule to compare
229
+ * @returns whether both schedules are equivalent
230
+ */
158
231
  export declare function isSameDateCellSchedule(a: Maybe<DateCellSchedule>, b: Maybe<DateCellSchedule>): boolean;
159
- export declare class DateCellSchedule implements DateCellSchedule {
160
- w: DateCellScheduleEncodedWeek;
161
- d?: DateCellIndex[];
162
- ex?: DateCellIndex[];
163
- constructor(template?: DateCellSchedule);
164
- }
165
232
  /**
166
- * A DateCellSchedule with a DateRange that signifies and end days.
233
+ * ArkType schema for {@link DateCellSchedule}.
234
+ */
235
+ export declare const dateCellScheduleType: import("arktype/internal/variants/object.ts").ObjectType<{
236
+ w: string;
237
+ d?: number[] | undefined;
238
+ ex?: number[] | undefined;
239
+ }, {}>;
240
+ /**
241
+ * A DateCellSchedule combined with a DateRange and timezone, bounding the schedule to a specific date window.
167
242
  */
168
243
  export interface DateCellScheduleDateRange extends DateCellSchedule, DateCellTimingDateRange {
169
244
  }
@@ -172,27 +247,27 @@ export interface DateCellScheduleDateRange extends DateCellSchedule, DateCellTim
172
247
  */
173
248
  export type DateCellScheduleStartOfDayDateRange = DateCellScheduleDateRange;
174
249
  /**
175
- * Returns true if the input is possibly a FullDateCellScheduleRange.
250
+ * Returns true if the input is possibly a DateCellScheduleDateRange (has schedule fields and valid start/end dates).
176
251
  *
177
252
  * Does not check that the input is a valid FullDateCellScheduleRange.
178
253
  *
179
- * @param input
180
- * @returns
254
+ * @param input - object to check
255
+ * @returns whether the input has the structure of a DateCellScheduleDateRange
181
256
  */
182
257
  export declare function isDateCellScheduleDateRange(input: object): input is DateCellScheduleDateRange;
183
258
  /**
184
- * Returns true if the input is a DateCellScheduleDateRange without a duration or startsAt.
259
+ * Returns true if the input is a DateCellScheduleDateRange whose start and end are both at the start of day in its timezone, and has no duration or startsAt fields.
185
260
  *
186
- * @param input
187
- * @returns
261
+ * @param input - object to check
262
+ * @returns whether the input is a start-of-day schedule date range
188
263
  */
189
264
  export declare function isDateCellScheduleStartOfDayDateRange(input: object): input is DateCellScheduleStartOfDayDateRange;
190
265
  /**
191
266
  * Returns true if both inputs have the same schedule and date range.
192
267
  *
193
- * @param a
194
- * @param b
195
- * @returns
268
+ * @param a - first schedule date range to compare
269
+ * @param b - second schedule date range to compare
270
+ * @returns whether both have identical date ranges and schedules
196
271
  */
197
272
  export declare function isSameDateCellScheduleDateRange(a: Maybe<DateCellScheduleDateRange>, b: Maybe<DateCellScheduleDateRange>): boolean;
198
273
  /**
@@ -204,10 +279,12 @@ export declare function isSameDateCellScheduleDateRange(a: Maybe<DateCellSchedul
204
279
  */
205
280
  export type DateCellScheduleDateRangeInput = DateCellSchedule & Partial<TimezoneStringRef & (DateRange | DateCellTimingStartsAtEndRange)>;
206
281
  /**
207
- * Creates a DateCellScheduleDateRange from the input.
282
+ * Creates a DateCellScheduleDateRange from the input, normalizing the start date to the start of day in the target timezone.
283
+ *
284
+ * Accepts either a start/end pair or a startsAt/end pair. If no end is provided, defaults to one minute after start.
208
285
  *
209
- * @param input
210
- * @returns
286
+ * @param input - schedule and partial date range information to assemble
287
+ * @returns a fully resolved schedule date range with timezone-aware start/end
211
288
  */
212
289
  export declare function dateCellScheduleDateRange(input: DateCellScheduleDateRangeInput): DateCellScheduleDateRange;
213
290
  /**
@@ -217,18 +294,18 @@ export type ChangeDateCellScheduleDateRangeToTimezoneFunction = ((dateRange: Dat
217
294
  readonly _normalInstance: DateTimezoneUtcNormalInstance;
218
295
  };
219
296
  /**
220
- * Creates a ChangeDateCellScheduleDateRangeToTimezoneFunction for the input timezone.
297
+ * Creates a reusable function that converts any DateCellScheduleDateRange to the specified target timezone while preserving the same wall-clock day boundaries.
221
298
  *
222
- * @param timezoneInput
223
- * @returns
299
+ * @param timezoneInput - the target timezone to convert ranges into
300
+ * @returns a conversion function with the internal normal instance exposed as `_normalInstance`
224
301
  */
225
302
  export declare function changeDateCellScheduleDateRangeToTimezoneFunction(timezoneInput: DateCellTimingTimezoneInput): ChangeDateCellScheduleDateRangeToTimezoneFunction;
226
303
  /**
227
304
  * Convenience function for calling changeDateCellScheduleDateRangeToTimezoneFunction() and passing the new timing and timezone.
228
305
  *
229
- * @param timing
230
- * @param timezone
231
- * @returns
306
+ * @param timing - the schedule date range to convert
307
+ * @param timezone - the target timezone
308
+ * @returns the schedule date range re-expressed in the target timezone
232
309
  */
233
310
  export declare function changeDateCellScheduleDateRangeToTimezone(timing: DateCellScheduleDateRange, timezone: DateCellTimingTimezoneInput): DateCellScheduleDateRange;
234
311
  /**
@@ -237,11 +314,11 @@ export declare function changeDateCellScheduleDateRangeToTimezone(timing: DateCe
237
314
  export interface DateCellScheduleEventRange extends DateCellScheduleDateRange, DateCellTimingEventStartsAt {
238
315
  }
239
316
  /**
240
- * Returns true if both inputs have the same FullDateCellScheduleRange.
317
+ * Returns true if both inputs have the same schedule, date range, and event startsAt.
241
318
  *
242
- * @param a
243
- * @param b
244
- * @returns
319
+ * @param a - first event range to compare
320
+ * @param b - second event range to compare
321
+ * @returns whether both event ranges are equivalent
245
322
  */
246
323
  export declare function isSameDateCellScheduleEventRange(a: Maybe<DateCellScheduleEventRange>, b: Maybe<DateCellScheduleEventRange>): boolean;
247
324
  /**
@@ -250,24 +327,24 @@ export declare function isSameDateCellScheduleEventRange(a: Maybe<DateCellSchedu
250
327
  export interface FullDateCellScheduleRange extends DateCellScheduleEventRange, FullDateCellTiming {
251
328
  }
252
329
  /**
253
- * Returns true if the input is possibly a FullDateCellScheduleRange.
330
+ * Returns true if the input is possibly a FullDateCellScheduleRange (has schedule fields and full timing fields).
254
331
  *
255
332
  * Does not check that the input is a valid FullDateCellScheduleRange.
256
333
  *
257
- * @param input
258
- * @returns
334
+ * @param input - object to check
335
+ * @returns whether the input has the structure of a FullDateCellScheduleRange
259
336
  */
260
337
  export declare function isFullDateCellScheduleDateRange(input: object): input is FullDateCellScheduleRange;
261
338
  /**
262
- * Returns true if both inputs have the same FullDateCellScheduleRange.
339
+ * Returns true if both inputs have the same FullDateCellScheduleRange (schedule, date range, startsAt, and duration).
263
340
  *
264
- * @param a
265
- * @param b
266
- * @returns
341
+ * @param a - first full schedule range to compare
342
+ * @param b - second full schedule range to compare
343
+ * @returns whether both full schedule ranges are equivalent
267
344
  */
268
345
  export declare function isSameFullDateCellScheduleDateRange(a: Maybe<FullDateCellScheduleRange>, b: Maybe<FullDateCellScheduleRange>): boolean;
269
346
  /**
270
- * Different types of inputs for fullDateCellScheduleRange() that can be used to derive a FullDateCellScheduleRange.
347
+ * Union of schedule range types accepted by fullDateCellScheduleRange(), ordered from most complete (FullDateCellScheduleRange) to partial (DateCellScheduleDateRangeInput).
271
348
  */
272
349
  export type FullDateCellScheduleRangeInputDateRange = DateCellScheduleDateRange | DateCellScheduleEventRange | FullDateCellScheduleRange | DateCellScheduleDateRangeInput;
273
350
  export interface FullDateCellScheduleRangeInput {
@@ -299,11 +376,32 @@ export interface FullDateCellScheduleRangeInput {
299
376
  */
300
377
  export declare const DEFAULT_FULL_DATE_SCHEDULE_RANGE_DURATION = 1;
301
378
  /**
302
- * Creates a FullDateCellScheduleRange from the input.
379
+ * Creates a FullDateCellScheduleRange from the input, filling in missing startsAt, duration, and end values with defaults.
380
+ *
381
+ * If the input already has full timing info, it is used as-is unless `updateWithDefaults` forces overrides.
382
+ * When startsAt or duration are missing, they are derived from the start date or use a 1-minute default duration.
383
+ *
384
+ * @param input - configuration with the schedule range and optional default overrides
385
+ * @returns a fully populated schedule range with timing, duration, and schedule data
386
+ *
387
+ * @example
388
+ * ```ts
389
+ * const range = fullDateCellScheduleRange({
390
+ * dateCellScheduleRange: {
391
+ * w: '89', // all week
392
+ * start: startDate,
393
+ * end: endDate,
394
+ * timezone: 'America/Denver'
395
+ * },
396
+ * startsAtTime: new Date('2025-01-01T09:00:00Z'),
397
+ * duration: 60
398
+ * });
399
+ * // range now has startsAt, duration, and correctly adjusted end date
400
+ * ```
303
401
  */
304
402
  export declare function fullDateCellScheduleRange(input: FullDateCellScheduleRangeInput): FullDateCellScheduleRange;
305
403
  /**
306
- * DateCellScheduleDateFilter input.
404
+ * Input for a DateCellScheduleDateFilter: accepts either a Date or a DateCellIndex to test against the schedule.
307
405
  */
308
406
  export type DateCellScheduleDateFilterInput = DateCellTimingRelativeIndexFactoryInput;
309
407
  /**
@@ -325,18 +423,57 @@ export interface DateCellScheduleDateFilterConfig extends DateCellSchedule, Part
325
423
  */
326
424
  readonly setStartAsMinDate?: boolean;
327
425
  }
426
+ /**
427
+ * Creates a shallow copy of a DateCellScheduleDateFilterConfig, useful for preserving configuration before mutation.
428
+ *
429
+ * @param inputFilter - the filter config to copy
430
+ * @returns a new config object with the same values
431
+ */
328
432
  export declare function copyDateCellScheduleDateFilterConfig(inputFilter: DateCellScheduleDateFilterConfig): DateCellScheduleDateFilterConfig;
329
433
  /**
330
- * Creates a DateCellScheduleDateFilter.
434
+ * Creates a DateCellScheduleDateFilter that decides whether a given date or index falls within the schedule.
435
+ *
436
+ * The filter checks: (1) allowed days of the week from the encoded week, (2) explicit include/exclude lists,
437
+ * and (3) optional min/max date boundaries. The filter accounts for timezone normalization.
438
+ *
439
+ * @param config - schedule, timing, and boundary configuration
440
+ * @returns a decision function that returns true when the input date/index is within the schedule
441
+ *
442
+ * @example
443
+ * ```ts
444
+ * const filter = dateCellScheduleDateFilter({
445
+ * w: '8', // weekdays only
446
+ * startsAt: new Date('2025-01-06T09:00:00Z'),
447
+ * end: new Date('2025-01-31T10:00:00Z'),
448
+ * timezone: 'America/Denver',
449
+ * ex: [2] // exclude index 2 (Wednesday Jan 8)
450
+ * });
331
451
  *
332
- * @param config
333
- * @returns
452
+ * filter(0); // true (Monday Jan 6)
453
+ * filter(2); // false (excluded)
454
+ * filter(5); // false (Saturday Jan 11)
455
+ * ```
334
456
  */
335
457
  export declare function dateCellScheduleDateFilter(config: DateCellScheduleDateFilterConfig): DateCellScheduleDateFilter;
458
+ /**
459
+ * Configuration for findNextDateInDateCellScheduleFilter().
460
+ */
336
461
  export interface FindNextDateInDateCellScheduleFilterInput {
462
+ /**
463
+ * Starting date or index to search from.
464
+ */
337
465
  readonly date: DateCellScheduleDateFilterInput;
466
+ /**
467
+ * The schedule filter to test against.
468
+ */
338
469
  readonly filter: DateCellScheduleDateFilter;
470
+ /**
471
+ * Direction to search: 'past' moves backward, 'future' moves forward.
472
+ */
339
473
  readonly direction: DateRelativeDirection;
474
+ /**
475
+ * Maximum number of days to search before giving up.
476
+ */
340
477
  readonly maxDistance: Days;
341
478
  /**
342
479
  * Whether or not to exclude the input date. False by default.
@@ -344,13 +481,36 @@ export interface FindNextDateInDateCellScheduleFilterInput {
344
481
  readonly excludeInputDate?: boolean;
345
482
  }
346
483
  /**
347
- * Passes a number of day values until it reaches an open day on a schedule. There's a maximum distance it searches in a direction before returning null.
484
+ * Searches forward or backward from a starting date/index to find the next date cell index that passes the schedule filter.
485
+ *
486
+ * Returns null if no matching date is found within the maxDistance limit.
487
+ *
488
+ * @param config - search parameters including start date, filter, direction, and distance limit
489
+ * @returns the matching index/date pair, or null if none found within range
348
490
  *
349
- * @param date
350
- * @param filter
351
- * @param maxDistance
491
+ * @example
492
+ * ```ts
493
+ * const filter = dateCellScheduleDateFilter({
494
+ * w: '8', // weekdays
495
+ * startsAt: mondayDate,
496
+ * end: endDate,
497
+ * timezone: 'America/Denver'
498
+ * });
499
+ *
500
+ * // Find next weekday from a Saturday
501
+ * const next = findNextDateInDateCellScheduleFilter({
502
+ * date: saturdayDate,
503
+ * filter,
504
+ * direction: 'future',
505
+ * maxDistance: 7
506
+ * });
507
+ * // next.date is the following Monday
508
+ * ```
352
509
  */
353
510
  export declare function findNextDateInDateCellScheduleFilter(config: FindNextDateInDateCellScheduleFilterInput): Maybe<DateCellIndexDatePair>;
511
+ /**
512
+ * A decision function that filters DateCell blocks based on a schedule applied to a specific timing.
513
+ */
354
514
  export type DateCellScheduleDateCellTimingFilter<B extends DateCell = DateCell> = DecisionFunction<B>;
355
515
  /**
356
516
  * Configuration for dateCellScheduleDateCellTimingFilter()
@@ -400,38 +560,49 @@ export interface DateCellScheduleDateCellTimingFilterConfig {
400
560
  maxDateCellsToReturn?: number;
401
561
  }
402
562
  /**
403
- * Creates a DateCellScheduleDateCellTimingFilter.
563
+ * Creates a DateCellScheduleDateCellTimingFilter that tests whether a DateCell block's index is allowed by the schedule within the given timing.
404
564
  *
405
- * @param param0
406
- * @returns
565
+ * @param config - timing and schedule to build the filter from
566
+ * @returns a decision function returning true for allowed blocks
407
567
  */
408
568
  export declare function dateCellScheduleDateCellTimingFilter<B extends DateCell = DateCell>({ timing, schedule }: DateCellScheduleDateCellTimingFilterConfig): DateCellScheduleDateCellTimingFilter<B>;
409
569
  /**
410
- * Creates a DateCellTimingExpansionFactory using the input DateCellScheduleDateCellTimingFilterConfig.
570
+ * Creates a DateCellTimingExpansionFactory that expands date cell ranges into duration spans, filtered by a schedule and optional time-based criteria (started, ended, etc.).
411
571
  *
412
- * @param config
413
- * @returns
572
+ * @param config - timing, schedule, and optional temporal/custom filters
573
+ * @returns an expansion factory that converts DateCellRange arrays into filtered DateCellDurationSpan arrays
414
574
  */
415
575
  export declare function expandDateCellScheduleFactory<B extends DateCell = DateCell>(config: DateCellScheduleDateCellTimingFilterConfig): DateCellTimingExpansionFactory<B>;
576
+ /**
577
+ * Input for expandDateCellSchedule(), extending the filter config with an optional index range limit.
578
+ */
416
579
  export interface ExpandDateCellScheduleInput extends DateCellScheduleDateCellTimingFilterConfig {
417
580
  /**
418
- * Index range to limit the expansion to.
581
+ * Index range to limit the expansion to. Capped to the timing's own range.
419
582
  */
420
583
  readonly limitIndexRange?: IndexRange;
421
584
  }
422
585
  /**
423
- * Expands the input DateCellTiming and DateCellSchedule into an array of DateCellDurationSpan value that correspond with blocks in the event.
586
+ * Expands a DateCellTiming and DateCellSchedule into concrete DateCellDurationSpan values representing each active block in the event.
587
+ *
588
+ * Only blocks whose indices pass the schedule filter (and any time-based filters) are included.
589
+ * An optional limitIndexRange further restricts which indices are expanded, capped to the timing's own range.
424
590
  *
425
- * Can optionally provide an IndexRange to specify a specific range to filter on. The range will be capped to the range of the timing.
591
+ * @param input - timing, schedule, and optional filters/range limit
592
+ * @returns array of duration spans for each active date cell
426
593
  *
427
- * @param timing
428
- * @param schedule
429
- * @param inputRange
430
- * @returns
594
+ * @example
595
+ * ```ts
596
+ * const spans = expandDateCellSchedule({
597
+ * timing: myTiming,
598
+ * schedule: { w: '8', ex: [3] } // weekdays, excluding index 3
599
+ * });
600
+ * // Returns DateCellDurationSpan[] for each weekday block except index 3
601
+ * ```
431
602
  */
432
603
  export declare function expandDateCellSchedule(input: ExpandDateCellScheduleInput): DateCellDurationSpan<DateCell>[];
433
604
  /**
434
- * Input for ExpandDateCellScheduleRangeInput
605
+ * Input for expandDateCellScheduleRange(), which derives both timing and schedule from a single schedule range.
435
606
  */
436
607
  export interface ExpandDateCellScheduleRangeInput extends Omit<DateCellScheduleDateCellTimingFilterConfig, 'schedule' | 'timing'> {
437
608
  readonly dateCellScheduleRange: FullDateCellScheduleRangeInputDateRange;
@@ -447,10 +618,22 @@ export interface ExpandDateCellScheduleRangeInput extends Omit<DateCellScheduleD
447
618
  readonly startsAtTime?: Date;
448
619
  }
449
620
  /**
621
+ * Expands a schedule range into concrete DateCellDurationSpan values by first building a FullDateCellScheduleRange from the input, then expanding it.
450
622
  *
451
- * @param input
452
- * @returns
623
+ * Allows overriding the duration and startsAt time on the schedule range before expansion.
624
+ *
625
+ * @param input - schedule range and optional override values
626
+ * @returns array of duration spans for each active date cell in the range
453
627
  */
454
628
  export declare function expandDateCellScheduleRange(input: ExpandDateCellScheduleRangeInput): DateCellDurationSpan<DateCell>[];
629
+ /**
630
+ * Alias for ExpandDateCellScheduleRangeInput used when the goal is to produce DateCellRange groups.
631
+ */
455
632
  export type ExpandDateCellScheduleRangeToDateCellRangeInput = ExpandDateCellScheduleRangeInput;
633
+ /**
634
+ * Expands a schedule range and groups the resulting duration spans into contiguous DateCellRangeWithRange values.
635
+ *
636
+ * @param input - schedule range expansion configuration
637
+ * @returns grouped date cell ranges with their associated date ranges
638
+ */
456
639
  export declare function expandDateCellScheduleRangeToDateCellRanges(input: ExpandDateCellScheduleRangeToDateCellRangeInput): DateCellRangeWithRange[];
@@ -1,9 +1,19 @@
1
1
  import { type DateCellIndex } from './date.cell';
2
2
  import { type DateCellScheduleDayCodesInput } from './date.cell.schedule';
3
3
  /**
4
- * Converts the input day codes into DateCellIndex values.
4
+ * Converts schedule day codes into absolute {@link DateCellIndex} values relative to a known Sunday index.
5
5
  *
6
- * @param dayCodes
7
- * @returns
6
+ * Each day code is expanded to its corresponding day(s) of the week, then offset from the Sunday reference index.
7
+ *
8
+ * @param sundayIndex - the DateCellIndex for the Sunday of the target week
9
+ * @param dayCodes - day codes to convert (e.g. WEEKDAY, individual days)
10
+ * @returns array of DateCellIndex values for the matching days
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // If index 0 is Sunday, get indexes for weekdays (Mon-Fri)
15
+ * dateCellIndexsForDateCellScheduleDayCodes(0, [DateCellScheduleDayCode.WEEKDAY]);
16
+ * // [1, 2, 3, 4, 5]
17
+ * ```
8
18
  */
9
19
  export declare function dateCellIndexsForDateCellScheduleDayCodes(sundayIndex: DateCellIndex, dayCodes: DateCellScheduleDayCodesInput): DateCellIndex[];
@@ -1,14 +1,12 @@
1
- import { type ObjectWithConstructor } from '@dereekb/util';
2
- import { type ValidationOptions } from 'class-validator';
3
1
  /**
4
- * isValidDateCellTiming validator
2
+ * ArkType schema that validates a value is a valid {@link DateCellTiming}.
5
3
  */
6
- export declare function IsValidDateCellTiming(validationOptions?: ValidationOptions): (object: ObjectWithConstructor, propertyName: string) => void;
4
+ export declare const validDateCellTimingType: import("arktype").BaseType<unknown, {}>;
7
5
  /**
8
- * isValidDateCellRange validator
6
+ * ArkType schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
9
7
  */
10
- export declare function IsValidDateCellRange(validationOptions?: ValidationOptions): (object: ObjectWithConstructor, propertyName: string) => void;
8
+ export declare const validDateCellRangeType: import("arktype").BaseType<unknown, {}>;
11
9
  /**
12
- * isValidDateCellRangeSeries validator
10
+ * ArkType schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
13
11
  */
14
- export declare function IsValidDateCellRangeSeries(validationOptions?: ValidationOptions): (object: ObjectWithConstructor, propertyName: string) => void;
12
+ export declare const validDateCellRangeSeriesType: import("arktype").BaseType<unknown, {}>;