forceCalendar/Docs
API Reference

EventStore

API reference for the EventStore class.

import { EventStore } from '@forcecalendar/core';

Constructor

new EventStore(options?: { timezone?: string })

Event CRUD

MethodSignatureReturns
addEvent(data: EventData) => EventCreated Event
updateEvent(id: string, updates: object) => EventUpdated Event
removeEvent(id: string) => void
getEvent(id: string) => Event | undefinedEvent
getAllEvents() => Event[]All events
clear() => void
loadEvents(events: EventData[]) => void

Querying

MethodSignatureReturns
queryEvents(filters: QueryFilters) => Event[]Filtered events
getEventsForDate(date: Date, tz?: string) => Event[]Events on date
getEventsInRange(start: Date, end: Date, expand?: boolean, tz?: string) => Event[]Events in range
getOverlappingEvents(start: Date, end: Date, excludeId = null) => Event[]Overlapping events

QueryFilters

FieldType
startDate
endDate
dateDate
monthnumber
yearnumber
allDayboolean
recurringboolean
statusstring
categoriesstring[]
hasAttendeesboolean
organizerEmailstring
sort'start' | 'end' | 'title'

Conflict Detection

MethodSignatureReturns
hasConflicts(start: Date, end: Date, excludeId = null) => boolean
checkConflicts(event: Event, options?: object) => objectConflict details
getAllConflicts(start: Date, end: Date, options?: object) => Array<[Event, Event]>All conflict pairs
getOverlapGroups(date: Date, timedOnly = true) => Event[][]Overlap groups
calculateEventPositions(events: Event[]) => MapPositions
getBusyPeriods(attendeeEmails: string[], start: Date, end: Date, options?: object) => Array<{start, end}>Busy periods
getFreePeriods(start: Date, end: Date, durationMinutes: number, options?: object) => Array<{start, end}>Free periods
addEventWithConflictCheck(event: EventData, allowConflicts = true) => EventCreated Event
findEventsWithConflicts() => Event[]Conflicting events

Batch Operations

MethodSignatureReturns
startBatch(enableRollback?: boolean) => void
commitBatch() => void
rollbackBatch() => void
executeBatch(fn: Function, enableRollback?: boolean) => void
addEvents(events: EventData[]) => Event[]Created events
updateEvents(updates: Array<{id, ...}>) => Event[]Updated events
removeEvents(ids: string[]) => void

Recurrence

MethodSignatureReturns
expandRecurringEvent(event: Event, start: Date, end: Date) => Event[]Occurrences

Subscriptions

MethodSignatureReturns
subscribe(callback: Function) => FunctionUnsubscribe function

Lifecycle

MethodSignatureReturns
destroy() => void