@forcecalendar/core 2.1.17 → 2.1.19

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 ADDED
@@ -0,0 +1,9 @@
1
+ # @forcecalendar/core
2
+
3
+ [![Tests](https://github.com/forceCalendar/core/actions/workflows/test.yml/badge.svg)](https://github.com/forceCalendar/core/actions/workflows/test.yml)
4
+ [![Code Quality](https://github.com/forceCalendar/core/actions/workflows/code-quality.yml/badge.svg)](https://github.com/forceCalendar/core/actions/workflows/code-quality.yml)
5
+ [![npm version](https://img.shields.io/npm/v/@forcecalendar/core.svg)](https://www.npmjs.com/package/@forcecalendar/core)
6
+ [![npm downloads](https://img.shields.io/npm/dw/@forcecalendar/core.svg)](https://www.npmjs.com/package/@forcecalendar/core)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ A modern, lightweight, framework-agnostic calendar engine optimized for Salesforce.
@@ -1010,7 +1010,7 @@ export class EventStore {
1010
1010
  */
1011
1011
  addEvents(events) {
1012
1012
  return this.optimizer.measure('addEvents', () => {
1013
- this.startBatch();
1013
+ this.startBatch(true);
1014
1014
  const results = [];
1015
1015
  const errors = [];
1016
1016
 
@@ -1022,7 +1022,11 @@ export class EventStore {
1022
1022
  }
1023
1023
  }
1024
1024
 
1025
- this.commitBatch();
1025
+ if (errors.length > 0 && results.length === 0) {
1026
+ this.rollbackBatch();
1027
+ } else {
1028
+ this.commitBatch();
1029
+ }
1026
1030
 
1027
1031
  if (errors.length > 0) {
1028
1032
  console.warn(`Failed to add ${errors.length} events:`, errors);
@@ -1039,7 +1043,7 @@ export class EventStore {
1039
1043
  */
1040
1044
  updateEvents(updates) {
1041
1045
  return this.optimizer.measure('updateEvents', () => {
1042
- this.startBatch();
1046
+ this.startBatch(true);
1043
1047
  const results = [];
1044
1048
  const errors = [];
1045
1049
 
@@ -1051,7 +1055,11 @@ export class EventStore {
1051
1055
  }
1052
1056
  }
1053
1057
 
1054
- this.commitBatch();
1058
+ if (errors.length > 0 && results.length === 0) {
1059
+ this.rollbackBatch();
1060
+ } else {
1061
+ this.commitBatch();
1062
+ }
1055
1063
 
1056
1064
  if (errors.length > 0) {
1057
1065
  console.warn(`Failed to update ${errors.length} events:`, errors);
@@ -1068,7 +1076,7 @@ export class EventStore {
1068
1076
  */
1069
1077
  removeEvents(eventIds) {
1070
1078
  return this.optimizer.measure('removeEvents', () => {
1071
- this.startBatch();
1079
+ this.startBatch(true);
1072
1080
  let removed = 0;
1073
1081
 
1074
1082
  for (const id of eventIds) {
@@ -1077,7 +1085,11 @@ export class EventStore {
1077
1085
  }
1078
1086
  }
1079
1087
 
1080
- this.commitBatch();
1088
+ if (removed === 0 && eventIds.length > 0) {
1089
+ this.rollbackBatch();
1090
+ } else {
1091
+ this.commitBatch();
1092
+ }
1081
1093
  return removed;
1082
1094
  });
1083
1095
  }
@@ -39,8 +39,7 @@ export class RecurrenceEngine {
39
39
  // Track DST transitions for proper timezone handling
40
40
  let lastOffset = tzManager.getTimezoneOffset(currentDate, eventTimezone);
41
41
 
42
- // Track last date to detect infinite loop (date not advancing)
43
- const lastDateTimestamp = null;
42
+ // Track stuck iterations to detect infinite loop (date not advancing)
44
43
  let stuckCount = 0;
45
44
  const maxStuckIterations = 3;
46
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forcecalendar/core",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "A modern, lightweight, framework-agnostic calendar engine optimized for Salesforce",