@forcecalendar/core 2.1.69 → 2.2.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 +123 -29
- 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 +91 -53
- 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 +128 -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 +134 -0
- package/types/types.d.ts +1225 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event class - represents a calendar event with timezone support
|
|
3
|
+
* Pure JavaScript, no DOM dependencies
|
|
4
|
+
* Locker Service compatible
|
|
5
|
+
*/
|
|
6
|
+
import { TimezoneManager } from '../timezone/TimezoneManager.js';
|
|
7
|
+
export declare class Event {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
_timezoneManager: TimezoneManager;
|
|
11
|
+
timeZone: string;
|
|
12
|
+
endTimeZone: string;
|
|
13
|
+
start: string | Date;
|
|
14
|
+
end: string | Date | undefined;
|
|
15
|
+
startUTC: Date;
|
|
16
|
+
endUTC: Date;
|
|
17
|
+
allDay: boolean | undefined;
|
|
18
|
+
description: string | undefined;
|
|
19
|
+
location: string | undefined;
|
|
20
|
+
color: string | undefined;
|
|
21
|
+
backgroundColor: string | undefined;
|
|
22
|
+
borderColor: string | undefined;
|
|
23
|
+
textColor: string | undefined;
|
|
24
|
+
recurring: boolean | undefined;
|
|
25
|
+
recurrenceRule: string | import("../types.js").RecurrenceRule | undefined;
|
|
26
|
+
_originalTimeZone: string | null;
|
|
27
|
+
status: import("../types.js").EventStatus | undefined;
|
|
28
|
+
visibility: import("../types.js").EventVisibility | undefined;
|
|
29
|
+
organizer: import("../types.js").Organizer | undefined;
|
|
30
|
+
attendees: any[];
|
|
31
|
+
reminders: any[];
|
|
32
|
+
categories: string[];
|
|
33
|
+
attachments: any[];
|
|
34
|
+
conferenceData: import("../types.js").ConferenceData | undefined;
|
|
35
|
+
metadata: Object;
|
|
36
|
+
_cache: {};
|
|
37
|
+
static FIELD_LIMITS: {
|
|
38
|
+
id: number;
|
|
39
|
+
title: number;
|
|
40
|
+
description: number;
|
|
41
|
+
location: number;
|
|
42
|
+
};
|
|
43
|
+
static MAX_METADATA_SIZE: number;
|
|
44
|
+
/**
|
|
45
|
+
* Normalize event data
|
|
46
|
+
* @param {import('../types.js').EventData} data - Raw event data
|
|
47
|
+
* @returns {import('../types.js').EventData} Normalized event data
|
|
48
|
+
*/
|
|
49
|
+
static normalize(data: import('../types.js').EventData): import('../types.js').EventData;
|
|
50
|
+
/**
|
|
51
|
+
* Validate event data
|
|
52
|
+
* @param {import('../types.js').EventData} data - Normalized event data
|
|
53
|
+
* @throws {Error} If validation fails
|
|
54
|
+
*/
|
|
55
|
+
static validate(data: import('../types.js').EventData): void;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new Event instance
|
|
58
|
+
* @param {import('../types.js').EventData} eventData - Event data object
|
|
59
|
+
* @throws {Error} If required fields are missing or invalid
|
|
60
|
+
*/
|
|
61
|
+
constructor({ id, title, start, end, allDay, description, location, color, backgroundColor, borderColor, textColor, recurring, recurrenceRule, recurrence, // Backward-compatible alias for recurrenceRule
|
|
62
|
+
timeZone, endTimeZone, status, visibility, organizer, attendees, reminders, category, // Support singular category (no default)
|
|
63
|
+
categories, // Support plural categories (no default)
|
|
64
|
+
attachments, conferenceData, metadata, ...rest }: import('../types.js').EventData);
|
|
65
|
+
/**
|
|
66
|
+
* Get event duration in milliseconds
|
|
67
|
+
* @returns {number} Duration in milliseconds
|
|
68
|
+
*/
|
|
69
|
+
get duration(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Get start date in a specific timezone
|
|
72
|
+
* @param {string} timezone - Target timezone
|
|
73
|
+
* @returns {Date} Start date in specified timezone
|
|
74
|
+
*/
|
|
75
|
+
getStartInTimezone(timezone: string): Date;
|
|
76
|
+
/**
|
|
77
|
+
* Get end date in a specific timezone
|
|
78
|
+
* @param {string} timezone - Target timezone
|
|
79
|
+
* @returns {Date} End date in specified timezone
|
|
80
|
+
*/
|
|
81
|
+
getEndInTimezone(timezone: string): Date;
|
|
82
|
+
/**
|
|
83
|
+
* Update event times preserving the timezone
|
|
84
|
+
* @param {Date} start - New start date
|
|
85
|
+
* @param {Date} end - New end date
|
|
86
|
+
* @param {string} [timezone] - Timezone for the new dates
|
|
87
|
+
*/
|
|
88
|
+
updateTimes(start: Date, end: Date, timezone?: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* Get event duration in minutes
|
|
91
|
+
* @returns {number} Duration in minutes
|
|
92
|
+
*/
|
|
93
|
+
get durationMinutes(): number;
|
|
94
|
+
/**
|
|
95
|
+
* Get event duration in hours
|
|
96
|
+
* @returns {number} Duration in hours
|
|
97
|
+
*/
|
|
98
|
+
get durationHours(): number;
|
|
99
|
+
/**
|
|
100
|
+
* Check if this is a multi-day event
|
|
101
|
+
* @returns {boolean} True if event spans multiple days
|
|
102
|
+
*/
|
|
103
|
+
get isMultiDay(): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Check if event is recurring
|
|
106
|
+
* @returns {boolean} True if event is recurring
|
|
107
|
+
*/
|
|
108
|
+
isRecurring(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Backward-compatible alias for recurrenceRule
|
|
111
|
+
* @returns {import('../types.js').RecurrenceRule|string|null}
|
|
112
|
+
*/
|
|
113
|
+
get recurrence(): import('../types.js').RecurrenceRule | string | null;
|
|
114
|
+
/**
|
|
115
|
+
* Check if event occurs on a specific date
|
|
116
|
+
* @param {Date|string} date - The date to check
|
|
117
|
+
* @returns {boolean} True if event occurs on the given date
|
|
118
|
+
*/
|
|
119
|
+
occursOn(date: Date | string): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Check if this event overlaps with another event
|
|
122
|
+
* @param {Event|{start: Date, end: Date}} otherEvent - The other event or time range to check
|
|
123
|
+
* @returns {boolean} True if events overlap
|
|
124
|
+
* @throws {Error} If otherEvent is not an Event instance or doesn't have start/end
|
|
125
|
+
*/
|
|
126
|
+
overlaps(otherEvent: Event | {
|
|
127
|
+
start: Date;
|
|
128
|
+
end: Date;
|
|
129
|
+
}): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Check if event contains a specific datetime
|
|
132
|
+
* @param {Date|string} datetime - The datetime to check
|
|
133
|
+
* @returns {boolean} True if the datetime falls within the event
|
|
134
|
+
*/
|
|
135
|
+
contains(datetime: Date | string): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Clone the event with optional updates
|
|
138
|
+
* @param {Partial<import('../types.js').EventData>} [updates={}] - Properties to update in the clone
|
|
139
|
+
* @returns {Event} New Event instance with updated properties
|
|
140
|
+
*/
|
|
141
|
+
clone(updates?: Partial<import('../types.js').EventData>): Event;
|
|
142
|
+
/**
|
|
143
|
+
* Convert event to plain object
|
|
144
|
+
* @returns {import('../types.js').EventData} Plain object representation of the event
|
|
145
|
+
*/
|
|
146
|
+
toObject(): import('../types.js').EventData;
|
|
147
|
+
/**
|
|
148
|
+
* Create Event from plain object
|
|
149
|
+
* @param {import('../types.js').EventData} obj - Plain object with event properties
|
|
150
|
+
* @returns {Event} New Event instance
|
|
151
|
+
*/
|
|
152
|
+
static fromObject(obj: import('../types.js').EventData): Event;
|
|
153
|
+
/**
|
|
154
|
+
* Compare events for equality
|
|
155
|
+
* @param {Event} other - The other event
|
|
156
|
+
* @returns {boolean} True if events are equal
|
|
157
|
+
*/
|
|
158
|
+
equals(other: Event): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Add an attendee to the event
|
|
161
|
+
* @param {import('../types.js').Attendee} attendee - Attendee to add
|
|
162
|
+
* @returns {boolean} True if attendee was added, false if already exists
|
|
163
|
+
*/
|
|
164
|
+
addAttendee(attendee: import('../types.js').Attendee): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Remove an attendee from the event
|
|
167
|
+
* @param {string} emailOrId - Email or ID of the attendee to remove
|
|
168
|
+
* @returns {boolean} True if attendee was removed
|
|
169
|
+
*/
|
|
170
|
+
removeAttendee(emailOrId: string): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Update an attendee's response status
|
|
173
|
+
* @param {string} email - Attendee's email
|
|
174
|
+
* @param {import('../types.js').AttendeeResponseStatus} responseStatus - New response status
|
|
175
|
+
* @returns {boolean} True if attendee was updated
|
|
176
|
+
*/
|
|
177
|
+
updateAttendeeResponse(email: string, responseStatus: import('../types.js').AttendeeResponseStatus): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Get an attendee by email
|
|
180
|
+
* @param {string} email - Attendee's email
|
|
181
|
+
* @returns {import('../types.js').Attendee|null} The attendee or null
|
|
182
|
+
*/
|
|
183
|
+
getAttendee(email: string): import('../types.js').Attendee | null;
|
|
184
|
+
/**
|
|
185
|
+
* Check if an attendee exists
|
|
186
|
+
* @param {string} email - Attendee's email
|
|
187
|
+
* @returns {boolean} True if attendee exists
|
|
188
|
+
*/
|
|
189
|
+
hasAttendee(email: string): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Get attendees by response status
|
|
192
|
+
* @param {import('../types.js').AttendeeResponseStatus} status - Response status to filter by
|
|
193
|
+
* @returns {import('../types.js').Attendee[]} Filtered attendees
|
|
194
|
+
*/
|
|
195
|
+
getAttendeesByStatus(status: import('../types.js').AttendeeResponseStatus): import('../types.js').Attendee[];
|
|
196
|
+
/**
|
|
197
|
+
* Get count of attendees by response status
|
|
198
|
+
* @returns {Object.<string, number>} Count by status
|
|
199
|
+
*/
|
|
200
|
+
getAttendeeCounts(): Record<string, number>;
|
|
201
|
+
/**
|
|
202
|
+
* Add a reminder to the event
|
|
203
|
+
* @param {import('../types.js').Reminder} reminder - Reminder to add
|
|
204
|
+
* @returns {boolean} True if reminder was added
|
|
205
|
+
*/
|
|
206
|
+
addReminder(reminder: import('../types.js').Reminder): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Remove a reminder from the event
|
|
209
|
+
* @param {string} reminderId - ID of the reminder to remove
|
|
210
|
+
* @returns {boolean} True if reminder was removed
|
|
211
|
+
*/
|
|
212
|
+
removeReminder(reminderId: string): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Get active reminders
|
|
215
|
+
* @returns {import('../types.js').Reminder[]} Active reminders
|
|
216
|
+
*/
|
|
217
|
+
getActiveReminders(): import('../types.js').Reminder[];
|
|
218
|
+
/**
|
|
219
|
+
* Get reminder trigger times
|
|
220
|
+
* @returns {Date[]} Array of dates when reminders should trigger
|
|
221
|
+
*/
|
|
222
|
+
getReminderTriggerTimes(): Date[];
|
|
223
|
+
/**
|
|
224
|
+
* Add a category to the event
|
|
225
|
+
* @param {string} category - Category to add
|
|
226
|
+
* @returns {boolean} True if category was added
|
|
227
|
+
*/
|
|
228
|
+
addCategory(category: string): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Remove a category from the event
|
|
231
|
+
* @param {string} category - Category to remove
|
|
232
|
+
* @returns {boolean} True if category was removed
|
|
233
|
+
*/
|
|
234
|
+
removeCategory(category: string): boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Get primary category (first in array) for backward compatibility
|
|
237
|
+
* @returns {string|null} Primary category or null
|
|
238
|
+
*/
|
|
239
|
+
get category(): string | null;
|
|
240
|
+
/**
|
|
241
|
+
* Check if event has a specific category
|
|
242
|
+
* @param {string} category - Category to check
|
|
243
|
+
* @returns {boolean} True if event has the category
|
|
244
|
+
*/
|
|
245
|
+
hasCategory(category: string): boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Check if event has any of the specified categories
|
|
248
|
+
* @param {string[]} categories - Categories to check
|
|
249
|
+
* @returns {boolean} True if event has any of the categories
|
|
250
|
+
*/
|
|
251
|
+
hasAnyCategory(categories: string[]): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Check if event has all of the specified categories
|
|
254
|
+
* @param {string[]} categories - Categories to check
|
|
255
|
+
* @returns {boolean} True if event has all of the categories
|
|
256
|
+
*/
|
|
257
|
+
hasAllCategories(categories: string[]): boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Sanitize metadata to enforce size limits and reject unsafe types
|
|
260
|
+
* @param {Object} metadata - Raw metadata object
|
|
261
|
+
* @returns {Object} Sanitized metadata
|
|
262
|
+
* @private
|
|
263
|
+
*/
|
|
264
|
+
private static _sanitizeMetadata;
|
|
265
|
+
/**
|
|
266
|
+
* Validate attendees
|
|
267
|
+
* @private
|
|
268
|
+
* @throws {Error} If attendees are invalid
|
|
269
|
+
*/
|
|
270
|
+
private _validateAttendees;
|
|
271
|
+
/**
|
|
272
|
+
* Validate reminders
|
|
273
|
+
* @private
|
|
274
|
+
* @throws {Error} If reminders are invalid
|
|
275
|
+
*/
|
|
276
|
+
private _validateReminders;
|
|
277
|
+
/**
|
|
278
|
+
* Validate email address
|
|
279
|
+
* @private
|
|
280
|
+
* @param {string} email - Email to validate
|
|
281
|
+
* @returns {boolean} True if email is valid
|
|
282
|
+
*/
|
|
283
|
+
private _isValidEmail;
|
|
284
|
+
/**
|
|
285
|
+
* Check if the event is cancelled
|
|
286
|
+
* @returns {boolean} True if event is cancelled
|
|
287
|
+
*/
|
|
288
|
+
get isCancelled(): boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Check if the event is tentative
|
|
291
|
+
* @returns {boolean} True if event is tentative
|
|
292
|
+
*/
|
|
293
|
+
get isTentative(): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Check if the event is confirmed
|
|
296
|
+
* @returns {boolean} True if event is confirmed
|
|
297
|
+
*/
|
|
298
|
+
get isConfirmed(): boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Check if the event is private
|
|
301
|
+
* @returns {boolean} True if event is private
|
|
302
|
+
*/
|
|
303
|
+
get isPrivate(): boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Check if the event is public
|
|
306
|
+
* @returns {boolean} True if event is public
|
|
307
|
+
*/
|
|
308
|
+
get isPublic(): boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Check if the event has attendees
|
|
311
|
+
* @returns {boolean} True if event has attendees
|
|
312
|
+
*/
|
|
313
|
+
get hasAttendees(): boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Check if the event has reminders
|
|
316
|
+
* @returns {boolean} True if event has reminders
|
|
317
|
+
*/
|
|
318
|
+
get hasReminders(): boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Check if the event is a meeting (has attendees or conference data)
|
|
321
|
+
* @returns {boolean} True if event is a meeting
|
|
322
|
+
*/
|
|
323
|
+
get isMeeting(): boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Check if the event is virtual (has conference data)
|
|
326
|
+
* @returns {boolean} True if event is virtual
|
|
327
|
+
*/
|
|
328
|
+
get isVirtual(): boolean;
|
|
329
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { Event } from './Event.js';
|
|
2
|
+
import { PerformanceOptimizer } from '../performance/PerformanceOptimizer.js';
|
|
3
|
+
import { ConflictDetector } from '../conflicts/ConflictDetector.js';
|
|
4
|
+
import { TimezoneManager } from '../timezone/TimezoneManager.js';
|
|
5
|
+
/**
|
|
6
|
+
* EventStore - Manages calendar events with efficient querying
|
|
7
|
+
* Uses Map for O(1) lookups and spatial indexing concepts for date queries
|
|
8
|
+
* Now with performance optimizations for large datasets
|
|
9
|
+
*/
|
|
10
|
+
export declare class EventStore {
|
|
11
|
+
/** @type {Map<string, Event>} */
|
|
12
|
+
events: Map<string, Event>;
|
|
13
|
+
indices: {
|
|
14
|
+
/** @type {Map<string, Set<string>>} UTC Date string -> Set of event IDs */
|
|
15
|
+
byDate: Map<string, Set<string>>;
|
|
16
|
+
/** @type {Map<string, Set<string>>} YYYY-MM (UTC) -> Set of event IDs */
|
|
17
|
+
byMonth: Map<string, Set<string>>;
|
|
18
|
+
/** @type {Set<string>} Set of recurring event IDs */
|
|
19
|
+
recurring: Set<string>;
|
|
20
|
+
/** @type {Map<string, Set<string>>} Category -> Set of event IDs */
|
|
21
|
+
byCategory: Map<string, Set<string>>;
|
|
22
|
+
/** @type {Map<string, Set<string>>} Status -> Set of event IDs */
|
|
23
|
+
byStatus: Map<string, Set<string>>;
|
|
24
|
+
};
|
|
25
|
+
eventIndexRefs: Map<any, any>;
|
|
26
|
+
timezoneManager: TimezoneManager;
|
|
27
|
+
defaultTimezone: any;
|
|
28
|
+
optimizer: PerformanceOptimizer;
|
|
29
|
+
recurrenceEngine: any;
|
|
30
|
+
conflictDetector: ConflictDetector;
|
|
31
|
+
isBatchMode: boolean;
|
|
32
|
+
batchNotifications: any[];
|
|
33
|
+
batchBackup: {
|
|
34
|
+
events: Map<string, Event>;
|
|
35
|
+
indices: {
|
|
36
|
+
byDate: Map<string, Set<string>>;
|
|
37
|
+
byMonth: Map<string, Set<string>>;
|
|
38
|
+
recurring: Set<string>;
|
|
39
|
+
byCategory: Map<string, Set<string>>;
|
|
40
|
+
byStatus: Map<string, Set<string>>;
|
|
41
|
+
};
|
|
42
|
+
eventIndexRefs: Map<any, {
|
|
43
|
+
byDate: Set<any>;
|
|
44
|
+
byMonth: Set<any>;
|
|
45
|
+
byCategory: Set<any>;
|
|
46
|
+
byStatus: Set<any>;
|
|
47
|
+
recurring: any;
|
|
48
|
+
}>;
|
|
49
|
+
version: number;
|
|
50
|
+
} | null;
|
|
51
|
+
_batchLock: Promise<any> | null;
|
|
52
|
+
_batchLockResolve: ((value: any) => void) | null;
|
|
53
|
+
/** @type {number} */
|
|
54
|
+
version: number;
|
|
55
|
+
/** @type {Set<import('../types.js').EventListener>} */
|
|
56
|
+
listeners: Set<import('../types.js').EventListener>;
|
|
57
|
+
constructor(config?: {});
|
|
58
|
+
/**
|
|
59
|
+
* Add an event to the store
|
|
60
|
+
* @param {Event|import('../types.js').EventData} event - The event to add
|
|
61
|
+
* @returns {Event} The added event
|
|
62
|
+
* @throws {Error} If event with same ID already exists
|
|
63
|
+
*/
|
|
64
|
+
addEvent(event: Event | import('../types.js').EventData): Event;
|
|
65
|
+
/**
|
|
66
|
+
* Update an existing event
|
|
67
|
+
* @param {string} eventId - The event ID
|
|
68
|
+
* @param {Partial<import('../types.js').EventData>} updates - Properties to update
|
|
69
|
+
* @returns {Event} The updated event
|
|
70
|
+
* @throws {Error} If event not found
|
|
71
|
+
*/
|
|
72
|
+
updateEvent(eventId: string, updates: Partial<import('../types.js').EventData>): Event;
|
|
73
|
+
/**
|
|
74
|
+
* Remove an event from the store
|
|
75
|
+
* @param {string} eventId - The event ID to remove
|
|
76
|
+
* @returns {boolean} True if removed, false if not found
|
|
77
|
+
*/
|
|
78
|
+
removeEvent(eventId: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Get an event by ID
|
|
81
|
+
* @param {string} eventId - The event ID
|
|
82
|
+
* @returns {Event|null} The event or null if not found
|
|
83
|
+
*/
|
|
84
|
+
getEvent(eventId: string): Event | null;
|
|
85
|
+
/**
|
|
86
|
+
* Get all events
|
|
87
|
+
* @returns {Event[]} Array of all events
|
|
88
|
+
*/
|
|
89
|
+
getAllEvents(): Event[];
|
|
90
|
+
/**
|
|
91
|
+
* Query events with filters
|
|
92
|
+
* @param {import('../types.js').QueryFilters} [filters={}] - Query filters
|
|
93
|
+
* @returns {Event[]} Filtered events
|
|
94
|
+
*/
|
|
95
|
+
queryEvents(filters?: import('../types.js').QueryFilters): Event[];
|
|
96
|
+
/**
|
|
97
|
+
* Get events for a specific date
|
|
98
|
+
* @param {Date} date - The date to query
|
|
99
|
+
* @param {string} [timezone] - Timezone for the query (defaults to store timezone)
|
|
100
|
+
* @returns {Event[]} Events occurring on the date, sorted by start time
|
|
101
|
+
*/
|
|
102
|
+
getEventsForDate(date: Date, timezone?: string): Event[];
|
|
103
|
+
/**
|
|
104
|
+
* Get events that overlap with a given time range
|
|
105
|
+
* @param {Date} start - Start time
|
|
106
|
+
* @param {Date} end - End time
|
|
107
|
+
* @param {string} [excludeId=null] - Optional event ID to exclude (useful when checking for conflicts)
|
|
108
|
+
* @returns {Event[]} Array of overlapping events
|
|
109
|
+
*/
|
|
110
|
+
getOverlappingEvents(start: Date, end: Date, excludeId?: string): Event[];
|
|
111
|
+
/**
|
|
112
|
+
* Check if an event would conflict with existing events
|
|
113
|
+
* @param {Date} start - Start time
|
|
114
|
+
* @param {Date} end - End time
|
|
115
|
+
* @param {string} excludeId - Optional event ID to exclude
|
|
116
|
+
* @returns {boolean} True if there are conflicts
|
|
117
|
+
*/
|
|
118
|
+
hasConflicts(start: Date, end: Date, excludeId?: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Get events grouped by overlapping time slots
|
|
121
|
+
* Useful for calculating event positions in week/day views
|
|
122
|
+
* @param {Date} date - The date to analyze
|
|
123
|
+
* @param {boolean} timedOnly - Only include timed events (not all-day)
|
|
124
|
+
* @returns {Array<Event[]>} Array of event groups that overlap
|
|
125
|
+
*/
|
|
126
|
+
getOverlapGroups(date: Date, timedOnly?: boolean): Array<Event[]>;
|
|
127
|
+
/**
|
|
128
|
+
* Calculate positions for overlapping events (for rendering)
|
|
129
|
+
* @param {Event[]} events - Array of overlapping events
|
|
130
|
+
* @returns {Map<string, {column: number, totalColumns: number}>} Position data for each event
|
|
131
|
+
*/
|
|
132
|
+
calculateEventPositions(events: Event[]): Map<string, {
|
|
133
|
+
column: number;
|
|
134
|
+
totalColumns: number;
|
|
135
|
+
}>;
|
|
136
|
+
/**
|
|
137
|
+
* Get events for a date range
|
|
138
|
+
* @param {Date} start - Start date
|
|
139
|
+
* @param {Date} end - End date
|
|
140
|
+
* @param {boolean|Object} [expandRecurringOrOptions=true] - Boolean to expand recurring events,
|
|
141
|
+
* or options object: { expandRecurring?: boolean, timezone?: string }
|
|
142
|
+
* @param {string} [timezone] - Timezone for the query
|
|
143
|
+
* @returns {Event[]}
|
|
144
|
+
*/
|
|
145
|
+
getEventsInRange(start: Date, end: Date, expandRecurringOrOptions?: boolean | Object, timezone?: string): Event[];
|
|
146
|
+
/**
|
|
147
|
+
* Expand a recurring event into individual occurrences
|
|
148
|
+
* @param {Event} event - The recurring event
|
|
149
|
+
* @param {Date} rangeStart - Start of the expansion range
|
|
150
|
+
* @param {Date} rangeEnd - End of the expansion range
|
|
151
|
+
* @param {string} [timezone] - Timezone for the expansion
|
|
152
|
+
* @returns {Event[]} Array of event occurrences
|
|
153
|
+
*/
|
|
154
|
+
expandRecurringEvent(event: Event, rangeStart: Date, rangeEnd: Date, timezone?: string): Event[];
|
|
155
|
+
/**
|
|
156
|
+
* Clear all events
|
|
157
|
+
*/
|
|
158
|
+
clear(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Bulk load events
|
|
161
|
+
* @param {Event[]} events - Array of events or event data
|
|
162
|
+
*/
|
|
163
|
+
loadEvents(events: Event[]): void;
|
|
164
|
+
/**
|
|
165
|
+
* Subscribe to store changes
|
|
166
|
+
* @param {Function} callback - Callback function
|
|
167
|
+
* @returns {Function} Unsubscribe function
|
|
168
|
+
*/
|
|
169
|
+
subscribe(callback: Function): Function;
|
|
170
|
+
/**
|
|
171
|
+
* Index an event for efficient queries
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
private _indexEvent;
|
|
175
|
+
/**
|
|
176
|
+
* Lazy index for events with large date ranges
|
|
177
|
+
* @private
|
|
178
|
+
*/
|
|
179
|
+
private _indexEventLazy;
|
|
180
|
+
/**
|
|
181
|
+
* Create reverse index references for an event.
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
private _createIndexRefs;
|
|
185
|
+
/**
|
|
186
|
+
* Add an event to a keyed index and record the reverse reference.
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
private _addToKeyedIndex;
|
|
190
|
+
/**
|
|
191
|
+
* Remove event from indices
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
private _unindexEvent;
|
|
195
|
+
/**
|
|
196
|
+
* Remove an event from only the keys it was indexed into.
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
private _removeFromReferencedIndex;
|
|
200
|
+
/**
|
|
201
|
+
* Notify listeners of changes
|
|
202
|
+
* @private
|
|
203
|
+
*/
|
|
204
|
+
private _notifyChange;
|
|
205
|
+
/**
|
|
206
|
+
* Get store statistics
|
|
207
|
+
* @returns {Object}
|
|
208
|
+
*/
|
|
209
|
+
getStats(): Object;
|
|
210
|
+
/**
|
|
211
|
+
* Start batch mode for bulk operations
|
|
212
|
+
* Delays notifications until batch is committed
|
|
213
|
+
* @param {boolean} [enableRollback=false] - Enable rollback support (creates backup)
|
|
214
|
+
*/
|
|
215
|
+
startBatch(enableRollback?: boolean): void;
|
|
216
|
+
/**
|
|
217
|
+
* Commit batch operations
|
|
218
|
+
* Sends all notifications at once
|
|
219
|
+
*/
|
|
220
|
+
commitBatch(): void;
|
|
221
|
+
/**
|
|
222
|
+
* Rollback batch operations
|
|
223
|
+
* Restores state to before batch started
|
|
224
|
+
*/
|
|
225
|
+
rollbackBatch(): void;
|
|
226
|
+
/**
|
|
227
|
+
* Execute batch operation with automatic rollback on error
|
|
228
|
+
* Uses a lock to prevent concurrent batch operations from corrupting state
|
|
229
|
+
* @param {Function} operation - Operation to execute
|
|
230
|
+
* @param {boolean} [enableRollback=true] - Enable automatic rollback on error
|
|
231
|
+
* @returns {*} Result of operation
|
|
232
|
+
* @throws {Error} If operation fails
|
|
233
|
+
*/
|
|
234
|
+
executeBatch(operation: Function, enableRollback?: boolean): any;
|
|
235
|
+
/**
|
|
236
|
+
* Add multiple events in batch
|
|
237
|
+
* @param {Array<Event|import('../types.js').EventData>} events - Events to add
|
|
238
|
+
* @returns {Event[]} Added events
|
|
239
|
+
*/
|
|
240
|
+
addEvents(events: Array<Event | import('../types.js').EventData>): Event[];
|
|
241
|
+
/**
|
|
242
|
+
* Update multiple events in batch
|
|
243
|
+
* @param {Array<{id: string, updates: Object}>} updates - Update operations
|
|
244
|
+
* @returns {Event[]} Updated events
|
|
245
|
+
*/
|
|
246
|
+
updateEvents(updates: Array<{
|
|
247
|
+
id: string;
|
|
248
|
+
updates: Object;
|
|
249
|
+
}>): Event[];
|
|
250
|
+
/**
|
|
251
|
+
* Remove multiple events in batch
|
|
252
|
+
* @param {string[]} eventIds - Event IDs to remove
|
|
253
|
+
* @returns {number} Number of events removed
|
|
254
|
+
*/
|
|
255
|
+
removeEvents(eventIds: string[]): number;
|
|
256
|
+
/**
|
|
257
|
+
* Get performance metrics
|
|
258
|
+
* @returns {Object} Performance metrics
|
|
259
|
+
*/
|
|
260
|
+
getPerformanceMetrics(): Object;
|
|
261
|
+
/**
|
|
262
|
+
* Clear all caches
|
|
263
|
+
*/
|
|
264
|
+
clearCaches(): void;
|
|
265
|
+
/**
|
|
266
|
+
* Optimize indices by removing old or irrelevant entries
|
|
267
|
+
* @param {Date} [cutoffDate] - Remove indices older than this date
|
|
268
|
+
*/
|
|
269
|
+
optimizeIndices(cutoffDate?: Date): number;
|
|
270
|
+
/**
|
|
271
|
+
* Destroy the store and clean up resources
|
|
272
|
+
*/
|
|
273
|
+
destroy(): void;
|
|
274
|
+
/**
|
|
275
|
+
* Check for conflicts for an event
|
|
276
|
+
* @param {Event|import('../types.js').EventData} event - Event to check
|
|
277
|
+
* @param {import('../types.js').ConflictCheckOptions} [options={}] - Check options
|
|
278
|
+
* @returns {import('../types.js').ConflictSummary} Conflict summary
|
|
279
|
+
*/
|
|
280
|
+
checkConflicts(event: Event | import('../types.js').EventData, options?: import('../types.js').ConflictCheckOptions): import('../types.js').ConflictSummary;
|
|
281
|
+
/**
|
|
282
|
+
* Check conflicts between two events
|
|
283
|
+
* @param {string} eventId1 - First event ID
|
|
284
|
+
* @param {string} eventId2 - Second event ID
|
|
285
|
+
* @param {import('../types.js').ConflictCheckOptions} [options={}] - Check options
|
|
286
|
+
* @returns {import('../types.js').ConflictDetails[]} Conflicts between events
|
|
287
|
+
*/
|
|
288
|
+
checkEventPairConflicts(eventId1: string, eventId2: string, options?: import('../types.js').ConflictCheckOptions): import('../types.js').ConflictDetails[];
|
|
289
|
+
/**
|
|
290
|
+
* Get all conflicts in a date range
|
|
291
|
+
* @param {Date} start - Start date
|
|
292
|
+
* @param {Date} end - End date
|
|
293
|
+
* @param {import('../types.js').ConflictCheckOptions} [options={}] - Check options
|
|
294
|
+
* @returns {import('../types.js').ConflictSummary} All conflicts in range
|
|
295
|
+
*/
|
|
296
|
+
getAllConflicts(start: Date, end: Date, options?: import('../types.js').ConflictCheckOptions): import('../types.js').ConflictSummary;
|
|
297
|
+
/**
|
|
298
|
+
* Get busy periods for attendees
|
|
299
|
+
* @param {string[]} attendeeEmails - Attendee emails
|
|
300
|
+
* @param {Date} start - Start date
|
|
301
|
+
* @param {Date} end - End date
|
|
302
|
+
* @param {Object} [options={}] - Options
|
|
303
|
+
* @returns {Array<{start: Date, end: Date, eventIds: string[]}>} Busy periods
|
|
304
|
+
*/
|
|
305
|
+
getBusyPeriods(attendeeEmails: string[], start: Date, end: Date, options?: Object): Array<{
|
|
306
|
+
start: Date;
|
|
307
|
+
end: Date;
|
|
308
|
+
eventIds: string[];
|
|
309
|
+
}>;
|
|
310
|
+
/**
|
|
311
|
+
* Get free periods for scheduling
|
|
312
|
+
* @param {Date} start - Start date
|
|
313
|
+
* @param {Date} end - End date
|
|
314
|
+
* @param {number} durationMinutes - Required duration in minutes
|
|
315
|
+
* @param {Object} [options={}] - Options
|
|
316
|
+
* @returns {Array<{start: Date, end: Date}>} Free periods
|
|
317
|
+
*/
|
|
318
|
+
getFreePeriods(start: Date, end: Date, durationMinutes: number, options?: Object): Array<{
|
|
319
|
+
start: Date;
|
|
320
|
+
end: Date;
|
|
321
|
+
}>;
|
|
322
|
+
/**
|
|
323
|
+
* Add event with conflict checking
|
|
324
|
+
* @param {Event|import('../types.js').EventData} event - Event to add
|
|
325
|
+
* @param {boolean} [allowConflicts=true] - Whether to allow adding with conflicts
|
|
326
|
+
* @returns {{event: Event, conflicts: import('../types.js').ConflictSummary}} Result
|
|
327
|
+
*/
|
|
328
|
+
addEventWithConflictCheck(event: Event | import('../types.js').EventData, allowConflicts?: boolean): {
|
|
329
|
+
event: Event;
|
|
330
|
+
conflicts: import('../types.js').ConflictSummary;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Find events with conflicts
|
|
334
|
+
* @param {Object} [options={}] - Options
|
|
335
|
+
* @returns {Array<{event: Event, conflicts: import('../types.js').ConflictDetails[]}>} Events with conflicts
|
|
336
|
+
*/
|
|
337
|
+
findEventsWithConflicts(options?: Object): Array<{
|
|
338
|
+
event: Event;
|
|
339
|
+
conflicts: import('../types.js').ConflictDetails[];
|
|
340
|
+
}>;
|
|
341
|
+
}
|