@forcecalendar/core 2.1.70 → 2.3.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/core/calendar/Calendar.js +5 -5
- package/core/conflicts/ConflictDetector.js +5 -5
- package/core/events/Event.js +17 -17
- package/core/events/EventStore.js +16 -16
- package/core/events/RecurrenceEngine.js +229 -14
- package/core/ics/ICSHandler.js +5 -3
- package/core/index.js +5 -1
- package/core/state/StateManager.js +3 -3
- package/core/timezone/TimezoneManager.js +79 -1
- package/core/types.js +17 -14
- package/package.json +40 -20
- package/types/calendar/Calendar.d.ts +287 -0
- package/types/calendar/DateUtils.d.ts +298 -0
- package/types/conflicts/ConflictDetector.d.ts +103 -0
- package/types/events/Event.d.ts +329 -0
- package/types/events/EventStore.d.ts +341 -0
- package/types/events/RRuleParser.d.ts +60 -0
- package/types/events/RecurrenceEngine.d.ts +167 -0
- package/types/events/RecurrenceEngineV2.d.ts +140 -0
- package/types/ics/ICSHandler.d.ts +111 -0
- package/types/ics/ICSParser.d.ts +111 -0
- package/types/index.d.ts +22 -0
- package/types/integration/EnhancedCalendar.d.ts +76 -0
- package/types/performance/AdaptiveMemoryManager.d.ts +104 -0
- package/types/performance/LRUCache.d.ts +59 -0
- package/types/performance/PerformanceOptimizer.d.ts +134 -0
- package/types/search/EventSearch.d.ts +91 -0
- package/types/search/SearchWorkerManager.d.ts +116 -0
- package/types/state/StateManager.d.ts +200 -0
- package/types/timezone/TimezoneDatabase.d.ts +993 -0
- package/types/timezone/TimezoneManager.d.ts +154 -0
- package/types/types.d.ts +1225 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RRuleParser - Full RFC 5545 compliant RRULE parser
|
|
3
|
+
* Supports all RFC 5545 recurrence rule features
|
|
4
|
+
*/
|
|
5
|
+
export declare class RRuleParser {
|
|
6
|
+
/**
|
|
7
|
+
* Parse an RRULE string into a structured rule object
|
|
8
|
+
* @param {string|Object} rrule - RRULE string or rule object
|
|
9
|
+
* @returns {Object} Parsed rule object
|
|
10
|
+
*/
|
|
11
|
+
static parse(rrule: string | Object): Object;
|
|
12
|
+
/**
|
|
13
|
+
* Parse frequency value
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
private static parseFrequency;
|
|
17
|
+
/**
|
|
18
|
+
* Parse BYDAY value
|
|
19
|
+
* Returns array of strings like ['MO', '2TU', '-1FR'] for compatibility with RecurrenceEngine
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
private static parseByDay;
|
|
23
|
+
/**
|
|
24
|
+
* Parse comma-separated integer list
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private static parseIntList;
|
|
28
|
+
/**
|
|
29
|
+
* Parse date/datetime value
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
private static parseDateTime;
|
|
33
|
+
/**
|
|
34
|
+
* Parse exception dates
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
private static parseExceptionDates;
|
|
38
|
+
/**
|
|
39
|
+
* Validate and normalize rule
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
private static validateRule;
|
|
43
|
+
/**
|
|
44
|
+
* Build RRULE string from rule object
|
|
45
|
+
* @param {Object} rule - Rule object
|
|
46
|
+
* @returns {string} RRULE string
|
|
47
|
+
*/
|
|
48
|
+
static buildRRule(rule: Object): string;
|
|
49
|
+
/**
|
|
50
|
+
* Format date/datetime for RRULE
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private static formatDateTime;
|
|
54
|
+
/**
|
|
55
|
+
* Get human-readable description of rule
|
|
56
|
+
* @param {Object} rule - Parsed rule object
|
|
57
|
+
* @returns {string} Human-readable description
|
|
58
|
+
*/
|
|
59
|
+
static getDescription(rule: Object): string;
|
|
60
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RecurrenceEngine - Handles expansion of recurring events
|
|
3
|
+
* Full support for RFC 5545 (iCalendar) RRULE specification
|
|
4
|
+
*/
|
|
5
|
+
export declare class RecurrenceEngine {
|
|
6
|
+
static _systemTransitions: any;
|
|
7
|
+
static MAX_OCCURRENCES_HARD_LIMIT: number;
|
|
8
|
+
static _ruleCache: Map<any, any>;
|
|
9
|
+
static _RULE_CACHE_MAX: number;
|
|
10
|
+
/**
|
|
11
|
+
* Expand a recurring event into individual occurrences
|
|
12
|
+
* @param {import('./Event.js').Event} event - The recurring event
|
|
13
|
+
* @param {Date} rangeStart - Start of the expansion range
|
|
14
|
+
* @param {Date} rangeEnd - End of the expansion range
|
|
15
|
+
* @param {number} [maxOccurrences=365] - Maximum number of occurrences to generate
|
|
16
|
+
* @param {string} [timezone] - Timezone for expansion (important for DST)
|
|
17
|
+
* @returns {import('../types.js').EventOccurrence[]} Array of occurrence objects with start/end dates
|
|
18
|
+
*/
|
|
19
|
+
static expandEvent(event: import('./Event.js').Event, rangeStart: Date, rangeEnd: Date, maxOccurrences?: number, timezone?: string): import('../types.js').EventOccurrence[];
|
|
20
|
+
/**
|
|
21
|
+
* General expansion loop: advances a Date cursor per step. Handles every
|
|
22
|
+
* frequency and degenerate rules (non-advancing dates, invalid intervals).
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
private static _expandGeneral;
|
|
26
|
+
/**
|
|
27
|
+
* Numeric expansion loop for DAILY and WEEKLY rules.
|
|
28
|
+
*
|
|
29
|
+
* Between DST transitions a wall-clock-preserving day step is a constant
|
|
30
|
+
* number of milliseconds, so the loop is pure numeric addition. Transition
|
|
31
|
+
* instants — in the system timezone (which defines Date arithmetic) and in
|
|
32
|
+
* the event's timezone (which drives occurrence adjustment) — are
|
|
33
|
+
* discovered by binary search and cached, so only the one step that
|
|
34
|
+
* crosses a transition falls back to Date arithmetic, and only the first
|
|
35
|
+
* occurrence after a transition queries a timezone offset.
|
|
36
|
+
*
|
|
37
|
+
* Produces output identical to _expandGeneral for the rules it accepts;
|
|
38
|
+
* returns null to delegate anything it cannot handle exactly.
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
private static _expandFast;
|
|
42
|
+
/**
|
|
43
|
+
* Find the next system-timezone offset transition after fromMs.
|
|
44
|
+
* Cached module-wide: the system timezone is fixed for the process.
|
|
45
|
+
* @param {number} fromMs - Search from this timestamp (exclusive)
|
|
46
|
+
* @param {number} toMs - Extend cache coverage at least this far
|
|
47
|
+
* @returns {number} Transition timestamp, or Infinity if none within coverage
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
private static _nextSystemTransition;
|
|
51
|
+
/**
|
|
52
|
+
* Scan for system-timezone offset transitions via Date#getTimezoneOffset.
|
|
53
|
+
* Probes weekly (shorter than any real-world gap between transitions)
|
|
54
|
+
* and binary-searches each change to the exact millisecond.
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
private static _scanSystemTransitions;
|
|
58
|
+
/**
|
|
59
|
+
* Apply BYSETPOS to filter occurrences within each frequency period
|
|
60
|
+
* @param {Array} occurrences - Generated occurrences
|
|
61
|
+
* @param {Object} rule - Recurrence rule
|
|
62
|
+
* @returns {Array} Filtered occurrences
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
private static _applyBySetPos;
|
|
66
|
+
/**
|
|
67
|
+
* Parse an RRULE string into a rule object
|
|
68
|
+
* @param {string|import('../types.js').RecurrenceRule} ruleString - RRULE string (e.g., "FREQ=DAILY;INTERVAL=1;COUNT=10") or rule object
|
|
69
|
+
* @returns {import('../types.js').RecurrenceRule} Parsed rule object
|
|
70
|
+
*/
|
|
71
|
+
static parseRule(ruleString: string | import('../types.js').RecurrenceRule): import('../types.js').RecurrenceRule;
|
|
72
|
+
/**
|
|
73
|
+
* Parse a rule with caching for string rules (internal use by expandEvent).
|
|
74
|
+
* Cached rule objects are shared across calls and must not be mutated.
|
|
75
|
+
* @param {string|Object} recurrenceRule - RRULE string or rule object
|
|
76
|
+
* @returns {import('../types.js').RecurrenceRule} Parsed rule object
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
private static _getParsedRule;
|
|
80
|
+
/**
|
|
81
|
+
* Calculate the next occurrence based on the rule
|
|
82
|
+
* @param {Date} currentDate - Current occurrence date
|
|
83
|
+
* @param {Object} rule - Recurrence rule object
|
|
84
|
+
* @param {string} [timezone] - Timezone for calculation
|
|
85
|
+
* @returns {Date} Next occurrence date
|
|
86
|
+
*/
|
|
87
|
+
static getNextOccurrence(currentDate: Date, rule: Object, _timezone?: string): Date;
|
|
88
|
+
/**
|
|
89
|
+
* Advance a date to the next occurrence, mutating it in place.
|
|
90
|
+
* Used by expandEvent to avoid one Date allocation per step.
|
|
91
|
+
* @param {Date} next - Date to advance (mutated)
|
|
92
|
+
* @param {Object} rule - Recurrence rule object
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
private static _advanceInPlace;
|
|
96
|
+
/**
|
|
97
|
+
* Days to add from each weekday (index 0-6) to reach the next weekday
|
|
98
|
+
* present in the given set
|
|
99
|
+
* @param {Set<number>} daySet - Non-empty set of weekday numbers
|
|
100
|
+
* @returns {number[]} Delta table indexed by Date#getDay()
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
private static _buildByDayDeltas;
|
|
104
|
+
/**
|
|
105
|
+
* Number of days in a month without allocating a Date
|
|
106
|
+
* @param {number} year - Full year
|
|
107
|
+
* @param {number} month - Month index (0-11)
|
|
108
|
+
* @returns {number}
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
111
|
+
private static _daysInMonth;
|
|
112
|
+
/**
|
|
113
|
+
* Build a Set of numeric weekdays (0-6) from BYDAY codes
|
|
114
|
+
* @param {Array<string>} byDay - Array of day codes (e.g., ['MO', '2TU'])
|
|
115
|
+
* @returns {Set<number>} Weekday numbers; invalid codes are skipped
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
private static _buildByDaySet;
|
|
119
|
+
/**
|
|
120
|
+
* Check if a date matches the BYDAY rule
|
|
121
|
+
* @param {Date} date - Date to check
|
|
122
|
+
* @param {Array<string>} byDay - Array of day codes (e.g., ['MO', 'WE', 'FR'])
|
|
123
|
+
* @returns {boolean}
|
|
124
|
+
*/
|
|
125
|
+
static matchesByDay(date: Date, byDay: Array<string>): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Set date to specific weekday of month
|
|
128
|
+
* @param {Date} date - Date to modify
|
|
129
|
+
* @param {string} weekday - Weekday code (e.g., 'MO', 'TU')
|
|
130
|
+
* @param {number} position - Position in month (1-5, or -1 for last)
|
|
131
|
+
*/
|
|
132
|
+
static setToWeekdayOfMonth(date: Date, weekday: string, position?: number): void;
|
|
133
|
+
/**
|
|
134
|
+
* Check if a date is an exception
|
|
135
|
+
* @param {Date} date - Date to check
|
|
136
|
+
* @param {Object} rule - Rule object with exceptions
|
|
137
|
+
* @param {string} [eventId] - Event ID for better exception tracking
|
|
138
|
+
* @returns {boolean}
|
|
139
|
+
*/
|
|
140
|
+
static isException(date: Date, rule: Object, _eventId?: null): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Add exception dates to a recurrence rule
|
|
143
|
+
* @param {Object} rule - Recurrence rule
|
|
144
|
+
* @param {Date|Date[]} exceptions - Exception date(s) to add
|
|
145
|
+
* @param {Object} [options] - Options for exception
|
|
146
|
+
* @returns {Object} Updated rule
|
|
147
|
+
*/
|
|
148
|
+
static addExceptions(rule: Object, exceptions: Date | Date[], options?: Object): Object;
|
|
149
|
+
/**
|
|
150
|
+
* Parse date from RRULE format (YYYYMMDDTHHMMSSZ)
|
|
151
|
+
* @param {string} dateStr - Date string in RRULE format
|
|
152
|
+
* @returns {Date}
|
|
153
|
+
*/
|
|
154
|
+
static parseDate(dateStr: string): Date;
|
|
155
|
+
/**
|
|
156
|
+
* Generate a human-readable description of the recurrence rule
|
|
157
|
+
* @param {Object|string} rule - Recurrence rule
|
|
158
|
+
* @returns {string} Human-readable description
|
|
159
|
+
*/
|
|
160
|
+
static getDescription(rule: Object | string): string;
|
|
161
|
+
/**
|
|
162
|
+
* Get day name from RRULE day code
|
|
163
|
+
* @param {string} dayCode - Day code (e.g., 'MO', '2TU')
|
|
164
|
+
* @returns {string} Day name
|
|
165
|
+
*/
|
|
166
|
+
static getDayName(dayCode: string): string;
|
|
167
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RecurrenceEngineV2 - Enhanced recurrence engine with advanced features
|
|
3
|
+
* Handles modified instances, complex timezone transitions, and performance optimization
|
|
4
|
+
*/
|
|
5
|
+
import { TimezoneManager } from '../timezone/TimezoneManager.js';
|
|
6
|
+
export declare class RecurrenceEngineV2 {
|
|
7
|
+
tzManager: TimezoneManager;
|
|
8
|
+
occurrenceCache: Map<any, any>;
|
|
9
|
+
cacheSize: number;
|
|
10
|
+
modifiedInstances: Map<any, any>;
|
|
11
|
+
exceptionStore: Map<any, any>;
|
|
12
|
+
static MAX_OCCURRENCES_HARD_LIMIT: number;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Expand recurring event with advanced handling
|
|
16
|
+
* @param {Event} event - Recurring event
|
|
17
|
+
* @param {Date} rangeStart - Start of expansion range
|
|
18
|
+
* @param {Date} rangeEnd - End of expansion range
|
|
19
|
+
* @param {Object} options - Expansion options
|
|
20
|
+
* @returns {Array} Expanded occurrences
|
|
21
|
+
*/
|
|
22
|
+
expandEvent(event: Event, rangeStart: Date, rangeEnd: Date, options?: Object): any[];
|
|
23
|
+
/**
|
|
24
|
+
* Generate a single occurrence with timezone handling
|
|
25
|
+
*/
|
|
26
|
+
generateOccurrence(event: any, date: any, duration: any, timezone: any, state: any): {
|
|
27
|
+
id: string;
|
|
28
|
+
recurringEventId: any;
|
|
29
|
+
title: any;
|
|
30
|
+
start: Date;
|
|
31
|
+
end: Date;
|
|
32
|
+
startUTC: Date;
|
|
33
|
+
endUTC: Date;
|
|
34
|
+
timezone: any;
|
|
35
|
+
originalStart: any;
|
|
36
|
+
allDay: any;
|
|
37
|
+
description: any;
|
|
38
|
+
location: any;
|
|
39
|
+
categories: any;
|
|
40
|
+
status: string;
|
|
41
|
+
isRecurring: boolean;
|
|
42
|
+
isModified: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Get next occurrence date with complex pattern support
|
|
46
|
+
*/
|
|
47
|
+
getNextDate(currentDate: any, rule: any, timezone: any, _state?: {}): Date;
|
|
48
|
+
/**
|
|
49
|
+
* Get next daily occurrence
|
|
50
|
+
*/
|
|
51
|
+
getNextDaily(date: any, rule: any): Date;
|
|
52
|
+
/**
|
|
53
|
+
* Get next weekly occurrence with BYDAY support
|
|
54
|
+
*/
|
|
55
|
+
getNextWeekly(date: any, rule: any, _timezone: any): Date;
|
|
56
|
+
/**
|
|
57
|
+
* Get next monthly occurrence with complex patterns
|
|
58
|
+
*/
|
|
59
|
+
getNextMonthly(date: any, rule: any, _timezone: any): Date;
|
|
60
|
+
/**
|
|
61
|
+
* Get next yearly occurrence
|
|
62
|
+
*/
|
|
63
|
+
getNextYearly(date: any, rule: any, _timezone: any): Date;
|
|
64
|
+
/**
|
|
65
|
+
* Set date to Nth weekday of month
|
|
66
|
+
*/
|
|
67
|
+
setToNthWeekdayOfMonth(date: any, weekday: any, nth: any): void;
|
|
68
|
+
/**
|
|
69
|
+
* Find DST transitions in date range
|
|
70
|
+
*/
|
|
71
|
+
findDSTTransitions(start: any, end: any, timezone: any): {
|
|
72
|
+
date: Date;
|
|
73
|
+
oldOffset: number;
|
|
74
|
+
newOffset: number;
|
|
75
|
+
type: string;
|
|
76
|
+
}[];
|
|
77
|
+
/**
|
|
78
|
+
* Adjust occurrence for DST transitions
|
|
79
|
+
*/
|
|
80
|
+
adjustForDST(start: any, end: any, timezone: any, transitions: any): {
|
|
81
|
+
start: any;
|
|
82
|
+
end: any;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Add or update a modified instance
|
|
86
|
+
*/
|
|
87
|
+
addModifiedInstance(eventId: any, occurrenceDate: any, modifications: any): void;
|
|
88
|
+
/**
|
|
89
|
+
* Get modified instance data
|
|
90
|
+
*/
|
|
91
|
+
getModifiedInstance(eventId: any, occurrenceDate: any): any;
|
|
92
|
+
/**
|
|
93
|
+
* Add exception with reason
|
|
94
|
+
*/
|
|
95
|
+
addException(eventId: any, date: any, reason?: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Check if date is an exception
|
|
98
|
+
*/
|
|
99
|
+
isException(eventId: any, date: any, rule: any): any;
|
|
100
|
+
/**
|
|
101
|
+
* Get exception reason
|
|
102
|
+
*/
|
|
103
|
+
getExceptionReason(eventId: any, date: any): any;
|
|
104
|
+
/**
|
|
105
|
+
* Create date key for indexing
|
|
106
|
+
*/
|
|
107
|
+
getDateKey(date: any): string;
|
|
108
|
+
/**
|
|
109
|
+
* Create cache key
|
|
110
|
+
*/
|
|
111
|
+
getCacheKey(eventId: any, start: any, end: any, options: any): string;
|
|
112
|
+
/**
|
|
113
|
+
* Cache occurrences
|
|
114
|
+
*/
|
|
115
|
+
cacheOccurrences(key: any, occurrences: any): void;
|
|
116
|
+
/**
|
|
117
|
+
* Clone occurrence results before returning or caching.
|
|
118
|
+
*/
|
|
119
|
+
cloneOccurrences(occurrences: any): any;
|
|
120
|
+
/**
|
|
121
|
+
* Clear cache for specific event
|
|
122
|
+
*/
|
|
123
|
+
clearEventCache(eventId: any): void;
|
|
124
|
+
/**
|
|
125
|
+
* Create occurrence object
|
|
126
|
+
*/
|
|
127
|
+
createOccurrence(event: any, start: any, end: any): {
|
|
128
|
+
id: any;
|
|
129
|
+
title: any;
|
|
130
|
+
start: any;
|
|
131
|
+
end: any;
|
|
132
|
+
allDay: any;
|
|
133
|
+
description: any;
|
|
134
|
+
location: any;
|
|
135
|
+
categories: any;
|
|
136
|
+
timezone: any;
|
|
137
|
+
isRecurring: boolean;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export default RecurrenceEngineV2;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ICS Import/Export Handler
|
|
3
|
+
* High-level API for calendar data interchange
|
|
4
|
+
*/
|
|
5
|
+
import { ICSParser } from './ICSParser.js';
|
|
6
|
+
export declare class ICSHandler {
|
|
7
|
+
calendar: any;
|
|
8
|
+
parser: ICSParser;
|
|
9
|
+
constructor(calendar: any);
|
|
10
|
+
/**
|
|
11
|
+
* Import events from ICS file or string
|
|
12
|
+
* @param {string|File|Blob} input - ICS data source
|
|
13
|
+
* @param {Object} options - Import options
|
|
14
|
+
* @returns {Promise<Object>} Import results
|
|
15
|
+
*/
|
|
16
|
+
import(input: string | File | Blob, options?: Object): Promise<Object>;
|
|
17
|
+
/**
|
|
18
|
+
* Export calendar events to ICS format
|
|
19
|
+
* @param {Object} options - Export options
|
|
20
|
+
* @returns {string} ICS formatted string
|
|
21
|
+
*/
|
|
22
|
+
export(options?: Object): string;
|
|
23
|
+
/**
|
|
24
|
+
* Export and download as file
|
|
25
|
+
* @param {string} filename - Name for the downloaded file
|
|
26
|
+
* @param {Object} options - Export options
|
|
27
|
+
*/
|
|
28
|
+
downloadAsFile(filename?: string, options?: Object): void;
|
|
29
|
+
/**
|
|
30
|
+
* Import from URL
|
|
31
|
+
* @param {string} url - URL to ICS file
|
|
32
|
+
* @param {Object} options - Import options
|
|
33
|
+
* @returns {Promise<Object>} Import results
|
|
34
|
+
*/
|
|
35
|
+
importFromURL(url: string, options?: Object): Promise<Object>;
|
|
36
|
+
/**
|
|
37
|
+
* Fetch a URL after validating the initial URL and each redirect target.
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private fetchSafeURL;
|
|
41
|
+
/**
|
|
42
|
+
* Read a response body while enforcing a byte limit.
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private readResponseText;
|
|
46
|
+
/**
|
|
47
|
+
* Validate a URL for safety (prevent SSRF attacks)
|
|
48
|
+
* @param {string} url - URL to validate
|
|
49
|
+
* @throws {Error} If URL is not safe
|
|
50
|
+
*/
|
|
51
|
+
static validateURL(url: string): URL;
|
|
52
|
+
/**
|
|
53
|
+
* Validate a URL and, in Node runtimes, ensure DNS does not resolve privately.
|
|
54
|
+
* @param {string} url - URL to validate
|
|
55
|
+
* @returns {Promise<URL>} Parsed safe URL
|
|
56
|
+
*/
|
|
57
|
+
static validateURLForFetch(url: string): Promise<URL>;
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
private static isNodeRuntime;
|
|
62
|
+
/**
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
private static normalizeHostname;
|
|
66
|
+
/**
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private static isBlockedHostname;
|
|
70
|
+
/**
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
private static isIPAddress;
|
|
74
|
+
/**
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
private static isPrivateIPAddress;
|
|
78
|
+
/**
|
|
79
|
+
* Subscribe to calendar feed
|
|
80
|
+
* @param {string} url - URL to ICS feed
|
|
81
|
+
* @param {Object} options - Subscription options
|
|
82
|
+
* @returns {Object} Subscription object
|
|
83
|
+
*/
|
|
84
|
+
subscribe(url: string, options?: Object): Object;
|
|
85
|
+
/**
|
|
86
|
+
* Get ICS string from various input types
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
private getICSString;
|
|
90
|
+
/**
|
|
91
|
+
* Check if event is in date range
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
private isInDateRange;
|
|
95
|
+
/**
|
|
96
|
+
* Generate new ID for duplicate event
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
private generateNewId;
|
|
100
|
+
/**
|
|
101
|
+
* Expand recurring events into individual instances
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private expandRecurringEvents;
|
|
105
|
+
/**
|
|
106
|
+
* Validate ICS string
|
|
107
|
+
* @param {string} icsString - ICS content to validate
|
|
108
|
+
* @returns {Object} Validation results
|
|
109
|
+
*/
|
|
110
|
+
validate(icsString: string): Object;
|
|
111
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ICS (iCalendar) Parser
|
|
3
|
+
* Converts between ICS format and Calendar events
|
|
4
|
+
* RFC 5545 compliant
|
|
5
|
+
*/
|
|
6
|
+
export declare class ICSParser {
|
|
7
|
+
maxFileSize: any;
|
|
8
|
+
maxLineLength: number;
|
|
9
|
+
propertyMap: {
|
|
10
|
+
SUMMARY: string;
|
|
11
|
+
DESCRIPTION: string;
|
|
12
|
+
LOCATION: string;
|
|
13
|
+
DTSTART: string;
|
|
14
|
+
DTEND: string;
|
|
15
|
+
UID: string;
|
|
16
|
+
CATEGORIES: string;
|
|
17
|
+
STATUS: string;
|
|
18
|
+
TRANSP: string;
|
|
19
|
+
ORGANIZER: string;
|
|
20
|
+
ATTENDEE: string;
|
|
21
|
+
RRULE: string;
|
|
22
|
+
EXDATE: string;
|
|
23
|
+
};
|
|
24
|
+
static MAX_INPUT_SIZE: number;
|
|
25
|
+
static MAX_LINES: number;
|
|
26
|
+
static MAX_EVENTS: number;
|
|
27
|
+
constructor(options?: {});
|
|
28
|
+
/**
|
|
29
|
+
* Parse ICS string into events
|
|
30
|
+
* @param {string} icsString - The ICS formatted string
|
|
31
|
+
* @returns {Array} Array of event objects
|
|
32
|
+
*/
|
|
33
|
+
parse(icsString: string): any[];
|
|
34
|
+
/**
|
|
35
|
+
* Export events to ICS format
|
|
36
|
+
* @param {Array} events - Array of event objects
|
|
37
|
+
* @param {string} calendarName - Name of the calendar
|
|
38
|
+
* @returns {string} ICS formatted string
|
|
39
|
+
*/
|
|
40
|
+
export(events: any[], calendarName?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Convert single event to ICS lines
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private eventToICS;
|
|
46
|
+
/**
|
|
47
|
+
* Parse ICS property into event object
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
private parseProperty;
|
|
51
|
+
/**
|
|
52
|
+
* Parse ICS date string
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
private parseDate;
|
|
56
|
+
/**
|
|
57
|
+
* Parse property name and parameters from a line prefix.
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
private parsePropertyParts;
|
|
61
|
+
/**
|
|
62
|
+
* Escape an ICS parameter value.
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
private escapeParamValue;
|
|
66
|
+
/**
|
|
67
|
+
* Format date for ICS
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
private formatDate;
|
|
71
|
+
/**
|
|
72
|
+
* Unfold ICS lines (reverse line folding)
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
private unfoldLines;
|
|
76
|
+
/**
|
|
77
|
+
* Fold long lines per ICS spec
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
private foldLines;
|
|
81
|
+
/**
|
|
82
|
+
* Escape special characters for ICS
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
private escapeText;
|
|
86
|
+
/**
|
|
87
|
+
* Unescape ICS text
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
private unescapeText;
|
|
91
|
+
/**
|
|
92
|
+
* Generate unique ID
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
private generateUID;
|
|
96
|
+
/**
|
|
97
|
+
* Create empty event object
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
private createEmptyEvent;
|
|
101
|
+
/**
|
|
102
|
+
* Normalize event object
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
private normalizeEvent;
|
|
106
|
+
/**
|
|
107
|
+
* Convert recurrence object to RRULE string
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
private objectToRRule;
|
|
111
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Force Calendar Core - Main entry point
|
|
3
|
+
* A modern, lightweight, framework-agnostic calendar library
|
|
4
|
+
* Optimized for Salesforce and Locker Service
|
|
5
|
+
*/
|
|
6
|
+
export { Calendar } from './calendar/Calendar.js';
|
|
7
|
+
export { Event } from './events/Event.js';
|
|
8
|
+
export { EventStore } from './events/EventStore.js';
|
|
9
|
+
export { StateManager } from './state/StateManager.js';
|
|
10
|
+
export { DateUtils } from './calendar/DateUtils.js';
|
|
11
|
+
export { ICSParser } from './ics/ICSParser.js';
|
|
12
|
+
export { ICSHandler } from './ics/ICSHandler.js';
|
|
13
|
+
export { EventSearch } from './search/EventSearch.js';
|
|
14
|
+
export { SearchWorkerManager, InvertedIndex } from './search/SearchWorkerManager.js';
|
|
15
|
+
export { RecurrenceEngine } from './events/RecurrenceEngine.js';
|
|
16
|
+
export { RecurrenceEngineV2 } from './events/RecurrenceEngineV2.js';
|
|
17
|
+
export { RRuleParser } from './events/RRuleParser.js';
|
|
18
|
+
export { TimezoneManager } from './timezone/TimezoneManager.js';
|
|
19
|
+
export { ConflictDetector } from './conflicts/ConflictDetector.js';
|
|
20
|
+
export { EnhancedCalendar } from './integration/EnhancedCalendar.js';
|
|
21
|
+
export declare const VERSION = "2.3.0";
|
|
22
|
+
export { Calendar as default } from './calendar/Calendar.js';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EnhancedCalendar - Integration of advanced search and recurrence features
|
|
3
|
+
* Demonstrates how to use the new scalable components
|
|
4
|
+
*/
|
|
5
|
+
import { Calendar } from '../calendar/Calendar.js';
|
|
6
|
+
import { SearchWorkerManager } from '../search/SearchWorkerManager.js';
|
|
7
|
+
import { RecurrenceEngineV2 } from '../events/RecurrenceEngineV2.js';
|
|
8
|
+
export declare class EnhancedCalendar extends Calendar {
|
|
9
|
+
searchManager: SearchWorkerManager;
|
|
10
|
+
recurrenceEngine: RecurrenceEngineV2;
|
|
11
|
+
performanceMetrics: {
|
|
12
|
+
searchTime: never[];
|
|
13
|
+
expansionTime: never[];
|
|
14
|
+
renderTime: never[];
|
|
15
|
+
};
|
|
16
|
+
_clearReindexTimeout: (() => void) | null | undefined;
|
|
17
|
+
constructor(config: any);
|
|
18
|
+
/**
|
|
19
|
+
* Enhanced search with worker support
|
|
20
|
+
*/
|
|
21
|
+
search(query: any, options?: {}): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Get events with enhanced recurrence expansion
|
|
24
|
+
*/
|
|
25
|
+
getEventsInRange(startDate: any, endDate: any, options?: {}): any[];
|
|
26
|
+
/**
|
|
27
|
+
* Modify a single occurrence of a recurring event
|
|
28
|
+
*/
|
|
29
|
+
modifyOccurrence(eventId: any, occurrenceDate: any, modifications: any): void;
|
|
30
|
+
/**
|
|
31
|
+
* Cancel a single occurrence of a recurring event
|
|
32
|
+
*/
|
|
33
|
+
cancelOccurrence(eventId: any, occurrenceDate: any, reason?: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Bulk operations for recurring events
|
|
36
|
+
*/
|
|
37
|
+
bulkModifyOccurrences(eventId: any, dateRange: any, modifications: any): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Advanced search with filters and recurrence awareness
|
|
40
|
+
*/
|
|
41
|
+
advancedSearch(query: any, filters?: {}, options?: {}): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Setup real-time indexing for search
|
|
44
|
+
*/
|
|
45
|
+
setupRealtimeIndexing(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Get search suggestions (autocomplete)
|
|
48
|
+
*/
|
|
49
|
+
getSuggestions(partial: any, field?: string): Promise<any[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Performance monitoring
|
|
52
|
+
*/
|
|
53
|
+
recordMetric(type: any, value: any): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get performance statistics
|
|
56
|
+
*/
|
|
57
|
+
getPerformanceStats(): {};
|
|
58
|
+
/**
|
|
59
|
+
* Export calendar with recurrence data
|
|
60
|
+
*/
|
|
61
|
+
exportWithRecurrence(format?: string): string | {
|
|
62
|
+
events: import("../index.js").Event[];
|
|
63
|
+
modifiedInstances: {};
|
|
64
|
+
exceptions: {};
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Import calendar with recurrence data
|
|
68
|
+
*/
|
|
69
|
+
importWithRecurrence(data: any, format?: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Clean up resources
|
|
72
|
+
*/
|
|
73
|
+
destroy(): void;
|
|
74
|
+
}
|
|
75
|
+
export declare function createEnhancedCalendar(config: any): EnhancedCalendar;
|
|
76
|
+
export default EnhancedCalendar;
|