@forcecalendar/core 2.1.16 → 2.1.18
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.
|
@@ -122,6 +122,13 @@ export class EventStore {
|
|
|
122
122
|
// Store updated event
|
|
123
123
|
this.events.set(eventId, updatedEvent);
|
|
124
124
|
|
|
125
|
+
// Update cache with new event data
|
|
126
|
+
this.optimizer.cache(eventId, updatedEvent, 'event');
|
|
127
|
+
|
|
128
|
+
// Clear query and date range caches since results may have changed
|
|
129
|
+
this.optimizer.queryCache.clear();
|
|
130
|
+
this.optimizer.dateRangeCache.clear();
|
|
131
|
+
|
|
125
132
|
// Re-index
|
|
126
133
|
this._indexEvent(updatedEvent);
|
|
127
134
|
|
|
@@ -150,6 +157,11 @@ export class EventStore {
|
|
|
150
157
|
// Remove from primary storage
|
|
151
158
|
this.events.delete(eventId);
|
|
152
159
|
|
|
160
|
+
// Invalidate caches
|
|
161
|
+
this.optimizer.eventCache.delete(eventId);
|
|
162
|
+
this.optimizer.queryCache.clear();
|
|
163
|
+
this.optimizer.dateRangeCache.clear();
|
|
164
|
+
|
|
153
165
|
// Remove from indices
|
|
154
166
|
this._unindexEvent(event);
|
|
155
167
|
|
|
@@ -998,7 +1010,7 @@ export class EventStore {
|
|
|
998
1010
|
*/
|
|
999
1011
|
addEvents(events) {
|
|
1000
1012
|
return this.optimizer.measure('addEvents', () => {
|
|
1001
|
-
this.startBatch();
|
|
1013
|
+
this.startBatch(true);
|
|
1002
1014
|
const results = [];
|
|
1003
1015
|
const errors = [];
|
|
1004
1016
|
|
|
@@ -1010,7 +1022,11 @@ export class EventStore {
|
|
|
1010
1022
|
}
|
|
1011
1023
|
}
|
|
1012
1024
|
|
|
1013
|
-
|
|
1025
|
+
if (errors.length > 0 && results.length === 0) {
|
|
1026
|
+
this.rollbackBatch();
|
|
1027
|
+
} else {
|
|
1028
|
+
this.commitBatch();
|
|
1029
|
+
}
|
|
1014
1030
|
|
|
1015
1031
|
if (errors.length > 0) {
|
|
1016
1032
|
console.warn(`Failed to add ${errors.length} events:`, errors);
|
|
@@ -1027,7 +1043,7 @@ export class EventStore {
|
|
|
1027
1043
|
*/
|
|
1028
1044
|
updateEvents(updates) {
|
|
1029
1045
|
return this.optimizer.measure('updateEvents', () => {
|
|
1030
|
-
this.startBatch();
|
|
1046
|
+
this.startBatch(true);
|
|
1031
1047
|
const results = [];
|
|
1032
1048
|
const errors = [];
|
|
1033
1049
|
|
|
@@ -1039,7 +1055,11 @@ export class EventStore {
|
|
|
1039
1055
|
}
|
|
1040
1056
|
}
|
|
1041
1057
|
|
|
1042
|
-
|
|
1058
|
+
if (errors.length > 0 && results.length === 0) {
|
|
1059
|
+
this.rollbackBatch();
|
|
1060
|
+
} else {
|
|
1061
|
+
this.commitBatch();
|
|
1062
|
+
}
|
|
1043
1063
|
|
|
1044
1064
|
if (errors.length > 0) {
|
|
1045
1065
|
console.warn(`Failed to update ${errors.length} events:`, errors);
|
|
@@ -1056,7 +1076,7 @@ export class EventStore {
|
|
|
1056
1076
|
*/
|
|
1057
1077
|
removeEvents(eventIds) {
|
|
1058
1078
|
return this.optimizer.measure('removeEvents', () => {
|
|
1059
|
-
this.startBatch();
|
|
1079
|
+
this.startBatch(true);
|
|
1060
1080
|
let removed = 0;
|
|
1061
1081
|
|
|
1062
1082
|
for (const id of eventIds) {
|
|
@@ -1065,7 +1085,11 @@ export class EventStore {
|
|
|
1065
1085
|
}
|
|
1066
1086
|
}
|
|
1067
1087
|
|
|
1068
|
-
|
|
1088
|
+
if (removed === 0 && eventIds.length > 0) {
|
|
1089
|
+
this.rollbackBatch();
|
|
1090
|
+
} else {
|
|
1091
|
+
this.commitBatch();
|
|
1092
|
+
}
|
|
1069
1093
|
return removed;
|
|
1070
1094
|
});
|
|
1071
1095
|
}
|
package/core/ics/ICSParser.js
CHANGED
|
@@ -160,7 +160,9 @@ export class ICSParser {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// Categories
|
|
163
|
-
if (event.
|
|
163
|
+
if (event.categories && event.categories.length > 0) {
|
|
164
|
+
lines.push(`CATEGORIES:${event.categories.join(',')}`);
|
|
165
|
+
} else if (event.category) {
|
|
164
166
|
lines.push(`CATEGORIES:${event.category}`);
|
|
165
167
|
}
|
|
166
168
|
|
|
@@ -246,7 +248,8 @@ export class ICSParser {
|
|
|
246
248
|
break;
|
|
247
249
|
|
|
248
250
|
case 'CATEGORIES':
|
|
249
|
-
event.
|
|
251
|
+
event.categories = value.split(',').map(c => c.trim());
|
|
252
|
+
event.category = event.categories[0];
|
|
250
253
|
break;
|
|
251
254
|
|
|
252
255
|
case 'STATUS': {
|
|
@@ -110,7 +110,7 @@ export class TimezoneManager {
|
|
|
110
110
|
timezone = this.database.resolveAlias(timezone);
|
|
111
111
|
|
|
112
112
|
// Check cache first
|
|
113
|
-
const cacheKey = `${timezone}_${date.getFullYear()}_${date.getMonth()}_${date.getDate()}`;
|
|
113
|
+
const cacheKey = `${timezone}_${date.getFullYear()}_${date.getMonth()}_${date.getDate()}_${date.getHours()}`;
|
|
114
114
|
if (this.offsetCache.has(cacheKey)) {
|
|
115
115
|
this.cacheHits++;
|
|
116
116
|
this._manageCacheSize();
|