@forcecalendar/core 2.2.0 → 2.4.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 +96 -4
- package/core/events/Event.js +112 -0
- package/core/events/EventStore.js +176 -39
- package/core/events/RecurrenceEngine.js +442 -12
- package/core/events/RecurrenceEngineV2.js +103 -3
- package/core/index.js +1 -1
- package/core/timezone/TimezoneManager.js +79 -1
- package/core/types.js +43 -1
- package/package.json +1 -1
- package/types/calendar/Calendar.d.ts +60 -3
- package/types/events/Event.d.ts +36 -0
- package/types/events/EventStore.d.ts +50 -1
- package/types/events/RecurrenceEngine.d.ts +99 -1
- package/types/events/RecurrenceEngineV2.d.ts +45 -2
- package/types/index.d.ts +1 -1
- package/types/timezone/TimezoneManager.d.ts +20 -0
- package/types/types.d.ts +121 -2
package/types/types.d.ts
CHANGED
|
@@ -688,7 +688,7 @@ export type EventStoreChange = {
|
|
|
688
688
|
/**
|
|
689
689
|
* - Type of change
|
|
690
690
|
*/
|
|
691
|
-
type: ('add' | 'update' | 'remove' | 'clear');
|
|
691
|
+
type: ('add' | 'update' | 'remove' | 'clear' | 'batch');
|
|
692
692
|
/**
|
|
693
693
|
* - Affected event
|
|
694
694
|
*/
|
|
@@ -701,11 +701,94 @@ export type EventStoreChange = {
|
|
|
701
701
|
* - Previous events (for clear)
|
|
702
702
|
*/
|
|
703
703
|
oldEvents?: import('./events/Event.js').Event[];
|
|
704
|
+
/**
|
|
705
|
+
* - Individual changes (for batch)
|
|
706
|
+
*/
|
|
707
|
+
changes?: EventStoreChange[];
|
|
708
|
+
/**
|
|
709
|
+
* - Number of individual changes (for batch)
|
|
710
|
+
*/
|
|
711
|
+
count?: number;
|
|
704
712
|
/**
|
|
705
713
|
* - Store version number
|
|
706
714
|
*/
|
|
707
715
|
version: number;
|
|
708
716
|
};
|
|
717
|
+
export type EventEquivalenceFn = (a: import('./events/Event.js').Event, b: import('./events/Event.js').Event) => boolean;
|
|
718
|
+
export type ReconcileOptions = {
|
|
719
|
+
/**
|
|
720
|
+
* - Remove stored events that are absent from the snapshot
|
|
721
|
+
*/
|
|
722
|
+
removeMissing?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* - Comparator deciding whether a stored event is unchanged (defaults to Event.isEquivalent)
|
|
725
|
+
*/
|
|
726
|
+
isEquivalent?: EventEquivalenceFn;
|
|
727
|
+
};
|
|
728
|
+
export type ReconciledUpdate = {
|
|
729
|
+
/**
|
|
730
|
+
* - Event now in the store
|
|
731
|
+
*/
|
|
732
|
+
event: import('./events/Event.js').Event;
|
|
733
|
+
/**
|
|
734
|
+
* - Event it replaced
|
|
735
|
+
*/
|
|
736
|
+
oldEvent: import('./events/Event.js').Event;
|
|
737
|
+
};
|
|
738
|
+
export type ReconcileResult = {
|
|
739
|
+
/**
|
|
740
|
+
* - Events that were not in the store before
|
|
741
|
+
*/
|
|
742
|
+
added: import('./events/Event.js').Event[];
|
|
743
|
+
/**
|
|
744
|
+
* - Events whose data changed
|
|
745
|
+
*/
|
|
746
|
+
updated: ReconciledUpdate[];
|
|
747
|
+
/**
|
|
748
|
+
* - Events removed from the store
|
|
749
|
+
*/
|
|
750
|
+
removed: import('./events/Event.js').Event[];
|
|
751
|
+
/**
|
|
752
|
+
* - Stored events left untouched (same instances)
|
|
753
|
+
*/
|
|
754
|
+
unchanged: import('./events/Event.js').Event[];
|
|
755
|
+
};
|
|
756
|
+
export type SetEventsOptions = {
|
|
757
|
+
/**
|
|
758
|
+
* - Apply only the differences instead of clearing and re-adding
|
|
759
|
+
*/
|
|
760
|
+
reconcile?: boolean;
|
|
761
|
+
/**
|
|
762
|
+
* - Reconcile only: remove stored events absent from the snapshot
|
|
763
|
+
*/
|
|
764
|
+
removeMissing?: boolean;
|
|
765
|
+
/**
|
|
766
|
+
* - Reconcile only: custom equivalence comparator
|
|
767
|
+
*/
|
|
768
|
+
isEquivalent?: EventEquivalenceFn;
|
|
769
|
+
};
|
|
770
|
+
export type EventsSetPayload = {
|
|
771
|
+
/**
|
|
772
|
+
* - All events after the operation
|
|
773
|
+
*/
|
|
774
|
+
events: import('./events/Event.js').Event[];
|
|
775
|
+
/**
|
|
776
|
+
* - Events added by the operation
|
|
777
|
+
*/
|
|
778
|
+
added: import('./events/Event.js').Event[];
|
|
779
|
+
/**
|
|
780
|
+
* - Events replaced by the operation
|
|
781
|
+
*/
|
|
782
|
+
updated: ReconciledUpdate[];
|
|
783
|
+
/**
|
|
784
|
+
* - Events removed by the operation
|
|
785
|
+
*/
|
|
786
|
+
removed: import('./events/Event.js').Event[];
|
|
787
|
+
/**
|
|
788
|
+
* - Events left untouched
|
|
789
|
+
*/
|
|
790
|
+
unchanged: import('./events/Event.js').Event[];
|
|
791
|
+
};
|
|
709
792
|
export type QueryFilters = {
|
|
710
793
|
/**
|
|
711
794
|
* - Start date for range query
|
|
@@ -1142,12 +1225,48 @@ export type ConflictSummary = {
|
|
|
1142
1225
|
*/
|
|
1143
1226
|
/**
|
|
1144
1227
|
* @typedef {Object} EventStoreChange
|
|
1145
|
-
* @property {('add'|'update'|'remove'|'clear')} type - Type of change
|
|
1228
|
+
* @property {('add'|'update'|'remove'|'clear'|'batch')} type - Type of change
|
|
1146
1229
|
* @property {import('./events/Event.js').Event} [event] - Affected event
|
|
1147
1230
|
* @property {import('./events/Event.js').Event} [oldEvent] - Previous event state (for updates)
|
|
1148
1231
|
* @property {import('./events/Event.js').Event[]} [oldEvents] - Previous events (for clear)
|
|
1232
|
+
* @property {EventStoreChange[]} [changes] - Individual changes (for batch)
|
|
1233
|
+
* @property {number} [count] - Number of individual changes (for batch)
|
|
1149
1234
|
* @property {number} version - Store version number
|
|
1150
1235
|
*/
|
|
1236
|
+
/**
|
|
1237
|
+
* @typedef {(a: import('./events/Event.js').Event, b: import('./events/Event.js').Event) => boolean} EventEquivalenceFn
|
|
1238
|
+
*/
|
|
1239
|
+
/**
|
|
1240
|
+
* @typedef {Object} ReconcileOptions
|
|
1241
|
+
* @property {boolean} [removeMissing=true] - Remove stored events that are absent from the snapshot
|
|
1242
|
+
* @property {EventEquivalenceFn} [isEquivalent] - Comparator deciding whether a stored event is unchanged (defaults to Event.isEquivalent)
|
|
1243
|
+
*/
|
|
1244
|
+
/**
|
|
1245
|
+
* @typedef {Object} ReconciledUpdate
|
|
1246
|
+
* @property {import('./events/Event.js').Event} event - Event now in the store
|
|
1247
|
+
* @property {import('./events/Event.js').Event} oldEvent - Event it replaced
|
|
1248
|
+
*/
|
|
1249
|
+
/**
|
|
1250
|
+
* @typedef {Object} ReconcileResult
|
|
1251
|
+
* @property {import('./events/Event.js').Event[]} added - Events that were not in the store before
|
|
1252
|
+
* @property {ReconciledUpdate[]} updated - Events whose data changed
|
|
1253
|
+
* @property {import('./events/Event.js').Event[]} removed - Events removed from the store
|
|
1254
|
+
* @property {import('./events/Event.js').Event[]} unchanged - Stored events left untouched (same instances)
|
|
1255
|
+
*/
|
|
1256
|
+
/**
|
|
1257
|
+
* @typedef {Object} SetEventsOptions
|
|
1258
|
+
* @property {boolean} [reconcile=false] - Apply only the differences instead of clearing and re-adding
|
|
1259
|
+
* @property {boolean} [removeMissing=true] - Reconcile only: remove stored events absent from the snapshot
|
|
1260
|
+
* @property {EventEquivalenceFn} [isEquivalent] - Reconcile only: custom equivalence comparator
|
|
1261
|
+
*/
|
|
1262
|
+
/**
|
|
1263
|
+
* @typedef {Object} EventsSetPayload
|
|
1264
|
+
* @property {import('./events/Event.js').Event[]} events - All events after the operation
|
|
1265
|
+
* @property {import('./events/Event.js').Event[]} added - Events added by the operation
|
|
1266
|
+
* @property {ReconciledUpdate[]} updated - Events replaced by the operation
|
|
1267
|
+
* @property {import('./events/Event.js').Event[]} removed - Events removed by the operation
|
|
1268
|
+
* @property {import('./events/Event.js').Event[]} unchanged - Events left untouched
|
|
1269
|
+
*/
|
|
1151
1270
|
/**
|
|
1152
1271
|
* @typedef {Object} QueryFilters
|
|
1153
1272
|
* @property {Date} [start] - Start date for range query
|