rrule-temporal 2.0.2 → 2.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.
package/README.md CHANGED
@@ -303,9 +303,31 @@ Notes
303
303
 
304
304
  ## Benchmarks
305
305
 
306
+ COUNT-bound query results from a MacBook Pro M2 Max / Node 25 run, comparing
307
+ `v2.0.3` with the `v2.1.0` candidate. Times are milliseconds per call; both
308
+ builds used the same harness and result checksum.
309
+
310
+ | Scenario | v2.0.3 first | v2.1.0 first | First speedup | v2.0.3 warm | v2.1.0 warm | Warm speedup |
311
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: |
312
+ | SECONDLY next, COUNT 128, rank 63 | 3.10 | 0.584 | 5.3x | 0.242 | 0.00951 | 25.5x |
313
+ | SECONDLY next, COUNT 250k, rank 200k | 886.0 | 0.137 | 6,481x | 806.3 | 0.00950 | 84,874x |
314
+ | DAILY next, COUNT 9k, rank 8.5k, UTC | 50.6 | 0.291 | 174x | 47.6 | 0.00984 | 4,837x |
315
+ | DAILY previous, COUNT 9k, rank 8.5k, Chicago | 60.2 | 7.59 | 7.9x | 53.4 | 0.01250 | 4,272x |
316
+ | DAILY weekdays next, COUNT 9k, distant, UTC | 68.7 | 0.0895 | 768x | 61.4 | 0.01010 | 6,079x |
317
+ | DAILY slots narrow between, COUNT 9k, UTC | 32.6 | 0.326 | 100x | 30.4 | 0.03466 | 877x |
318
+ | WEEKLY M/W/F slots next, COUNT 9k, UTC | 122.5 | 0.353 | 347x | 81.8 | 0.01037 | 7,888x |
319
+ | MONTHLY last weekday next, COUNT 9k, UTC | 197.8 | 8.54 | 23.2x | 186.3 | 0.03191 | 5,838x |
320
+ | MONTHLY last weekday next, COUNT 128, rank 63 | 1.49 | 0.321 | 4.6x | 1.40 | 0.02155 | 65.0x |
321
+
322
+ The named-zone first call includes lazy transition-table construction. Its
323
+ warmed path reuses both that table and the immutable rule's numeric query plan.
324
+
325
+ ### Full recurrence generation
326
+
306
327
  Uncached median ops/s from the benchmark suite on a MacBook Pro M2 Max
307
328
  (Node 25, polyfill backend). The full three-library comparison, including
308
- `rrule-rust` and cached-mode results, lives in `benchmarks/README.md`.
329
+ `rrule-rust`, query methodology, and cached-mode results, lives in
330
+ [`benchmarks/README.md`](benchmarks/README.md).
309
331
 
310
332
  | Scenario | TZ | rrule-temporal median ops/s | rrule median ops/s | vs rrule |
311
333
  | --- | --- | ---: | ---: | ---: |
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-BQ3CQXjR.cjs");
2
+ const require_src = require("./src-BL9G7GR8.cjs");
3
3
  exports.RRuleTemporal = require_src.RRuleTemporal;
4
4
  exports.allowedFreq = require_src.allowedFreq;
5
5
  exports.allowedWeekdays = require_src.allowedWeekdays;
package/dist/index.d.cts CHANGED
@@ -113,6 +113,7 @@ declare class RRuleTemporal {
113
113
  private allResultCache?;
114
114
  private zoneResolver?;
115
115
  private emitAnchorZdt?;
116
+ private numericQueryPlanCache;
116
117
  private static readonly rscaleCalendarSupport;
117
118
  /**
118
119
  * Normalize a ZonedDateTime to the polyfill implementation.
@@ -169,6 +170,15 @@ declare class RRuleTemporal {
169
170
  private utcZdtFromEpochMilliseconds;
170
171
  private canUseUtcEpochMillisecondsPrecision;
171
172
  private buildTimeSlotOffsetsMs;
173
+ private createNumericQueryPlan;
174
+ private buildFixedStepNumericQueryPlan;
175
+ private resolveNumericWallMilliseconds;
176
+ private numericQueryGapHazard;
177
+ private buildDailyNumericQueryPlan;
178
+ private buildWeeklyNumericQueryPlan;
179
+ private buildMonthlyNumericQueryPlan;
180
+ private buildNumericQueryPlan;
181
+ private getNumericQueryPlan;
172
182
  private findFirstMatchingDailyStep;
173
183
  private allUtcFastPath;
174
184
  private _allUtcFixedStepSimple;
@@ -255,19 +265,28 @@ declare class RRuleTemporal {
255
265
  */
256
266
  private excludeExDates;
257
267
  /**
258
- * Applies count limit and merges rDates with the rule-generated dates.
268
+ * Finalizes the recurrence set in RFC 5545 order: bound the RRULE-generated
269
+ * dates by COUNT, union RDATE, then subtract EXDATE.
259
270
  * @param dates - Array of dates generated by the rule
260
271
  * @param iterator - Optional iterator function
261
- * @returns Final array of dates after merging and applying count limit
272
+ * @returns Final recurrence set
262
273
  */
263
274
  private applyCountLimitAndMergeRDates;
264
275
  /**
265
- * Checks if the count limit should break the loop based on rDate presence.
266
- * @param matchCount - Current number of matches
267
- * @returns true if the loop should break
276
+ * Streams the final recurrence set without materializing the complete RRULE.
277
+ * A rule-only instance keeps COUNT/UNTIL scoped to RRULE generation while
278
+ * sorted RDATE values are merged and EXDATE values are filtered at emission.
268
279
  */
280
+ private iterateRecurrenceSet;
281
+ private applyIterator;
282
+ /** Stops RRULE generation once COUNT rule occurrences have been found. */
269
283
  private shouldBreakForCountLimit;
270
284
  private hasTimeOfDayBetween;
285
+ private assertNumericCandidateReachable;
286
+ private numericExhaustionCandidate;
287
+ private tryNumericNext;
288
+ private tryNumericPrevious;
289
+ private tryNumericBetween;
271
290
  /**
272
291
  * Returns all occurrences of the rule within a specified time window.
273
292
  * @param after - The start date or Temporal.ZonedDateTime object.
package/dist/index.d.ts CHANGED
@@ -113,6 +113,7 @@ declare class RRuleTemporal {
113
113
  private allResultCache?;
114
114
  private zoneResolver?;
115
115
  private emitAnchorZdt?;
116
+ private numericQueryPlanCache;
116
117
  private static readonly rscaleCalendarSupport;
117
118
  /**
118
119
  * Normalize a ZonedDateTime to the polyfill implementation.
@@ -169,6 +170,15 @@ declare class RRuleTemporal {
169
170
  private utcZdtFromEpochMilliseconds;
170
171
  private canUseUtcEpochMillisecondsPrecision;
171
172
  private buildTimeSlotOffsetsMs;
173
+ private createNumericQueryPlan;
174
+ private buildFixedStepNumericQueryPlan;
175
+ private resolveNumericWallMilliseconds;
176
+ private numericQueryGapHazard;
177
+ private buildDailyNumericQueryPlan;
178
+ private buildWeeklyNumericQueryPlan;
179
+ private buildMonthlyNumericQueryPlan;
180
+ private buildNumericQueryPlan;
181
+ private getNumericQueryPlan;
172
182
  private findFirstMatchingDailyStep;
173
183
  private allUtcFastPath;
174
184
  private _allUtcFixedStepSimple;
@@ -255,19 +265,28 @@ declare class RRuleTemporal {
255
265
  */
256
266
  private excludeExDates;
257
267
  /**
258
- * Applies count limit and merges rDates with the rule-generated dates.
268
+ * Finalizes the recurrence set in RFC 5545 order: bound the RRULE-generated
269
+ * dates by COUNT, union RDATE, then subtract EXDATE.
259
270
  * @param dates - Array of dates generated by the rule
260
271
  * @param iterator - Optional iterator function
261
- * @returns Final array of dates after merging and applying count limit
272
+ * @returns Final recurrence set
262
273
  */
263
274
  private applyCountLimitAndMergeRDates;
264
275
  /**
265
- * Checks if the count limit should break the loop based on rDate presence.
266
- * @param matchCount - Current number of matches
267
- * @returns true if the loop should break
276
+ * Streams the final recurrence set without materializing the complete RRULE.
277
+ * A rule-only instance keeps COUNT/UNTIL scoped to RRULE generation while
278
+ * sorted RDATE values are merged and EXDATE values are filtered at emission.
268
279
  */
280
+ private iterateRecurrenceSet;
281
+ private applyIterator;
282
+ /** Stops RRULE generation once COUNT rule occurrences have been found. */
269
283
  private shouldBreakForCountLimit;
270
284
  private hasTimeOfDayBetween;
285
+ private assertNumericCandidateReachable;
286
+ private numericExhaustionCandidate;
287
+ private tryNumericNext;
288
+ private tryNumericPrevious;
289
+ private tryNumericBetween;
271
290
  /**
272
291
  * Returns all occurrences of the rule within a specified time window.
273
292
  * @param after - The start date or Temporal.ZonedDateTime object.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as weekdayToIsoDay, n as allowedFreq, r as allowedWeekdays, t as RRuleTemporal } from "./src-PFG2hz2E.js";
1
+ import { i as weekdayToIsoDay, n as allowedFreq, r as allowedWeekdays, t as RRuleTemporal } from "./src-b3FbAWaY.js";
2
2
  export { RRuleTemporal, allowedFreq, allowedWeekdays, weekdayToIsoDay };