@dv4resi/dvss-backend-module-calendar-im 0.0.10 → 0.0.12

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/dist/index.d.ts CHANGED
@@ -1835,6 +1835,8 @@ interface IBookingEventInstance {
1835
1835
  startDateLabel: string;
1836
1836
  seriesId?: string;
1837
1837
  iCalUId?: string;
1838
+ uid?: string;
1839
+ instanceKind?: EVENT_INSTANCE_KIND;
1838
1840
  transactionId?: string;
1839
1841
  subject?: string;
1840
1842
  }
@@ -1845,6 +1847,64 @@ interface IBookingManagementContext {
1845
1847
  integration: ICapabilityIntegration;
1846
1848
  loggedInUserId: bigint;
1847
1849
  }
1850
+ interface ISyncEventsRequest extends IMailboxScope {
1851
+ resourceEmail: string;
1852
+ syncToken?: string;
1853
+ startDateLabel?: string;
1854
+ endDateLabel?: string;
1855
+ timeZone?: string;
1856
+ }
1857
+ interface ICalendarInboundRecurrence {
1858
+ pattern: {
1859
+ type: string;
1860
+ interval: number;
1861
+ daysOfWeek?: string[];
1862
+ firstDayOfWeek?: string;
1863
+ dayOfMonth?: number;
1864
+ month?: number;
1865
+ index?: string;
1866
+ };
1867
+ range: {
1868
+ type: string;
1869
+ startDate: string;
1870
+ endDate?: string;
1871
+ numberOfOccurrences?: number;
1872
+ recurrenceTimeZone?: string;
1873
+ };
1874
+ }
1875
+ interface ICalendarInboundSyncEvent {
1876
+ id?: string;
1877
+ subject?: string;
1878
+ body?: string;
1879
+ start?: {
1880
+ dateTime?: string;
1881
+ timeZone?: string;
1882
+ };
1883
+ end?: {
1884
+ dateTime?: string;
1885
+ timeZone?: string;
1886
+ };
1887
+ location?: string;
1888
+ resourceId?: string;
1889
+ type?: string;
1890
+ seriesMasterId?: string;
1891
+ transactionId?: string;
1892
+ isCancelled?: boolean;
1893
+ organizerEmail?: string;
1894
+ showAs?: string;
1895
+ attendees?: Array<{
1896
+ email: string;
1897
+ name?: string;
1898
+ type?: string;
1899
+ }>;
1900
+ recurrence?: ICalendarInboundRecurrence;
1901
+ responseStatus?: string;
1902
+ providerPayload?: Record<string, unknown>;
1903
+ }
1904
+ interface ISyncEventsResponse {
1905
+ events: ICalendarInboundSyncEvent[];
1906
+ nextSyncToken?: string;
1907
+ }
1848
1908
 
1849
1909
  interface ICalendarWebhookSubscription {
1850
1910
  id?: string;
@@ -2188,6 +2248,7 @@ declare abstract class BaseCalendarBookingManagement {
2188
2248
  abstract cancelEvent(request: ICancelEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<void>;
2189
2249
  abstract deleteEvent(request: IDeleteEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<void>;
2190
2250
  abstract getEvents(request: IGetEventsRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IGetEventsResponse>;
2251
+ abstract syncEvents?(request: ISyncEventsRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<ISyncEventsResponse>;
2191
2252
  abstract getEvent?(request: IGetCalendarEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IBookingEventRef>;
2192
2253
  abstract acceptEvent?(request: IAcceptEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<void>;
2193
2254
  abstract getEventInstances(request: IGetEventInstancesRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IGetEventsResponse>;
@@ -2423,6 +2484,7 @@ interface IMicrosoftGraphEvent {
2423
2484
  seriesMasterId?: string;
2424
2485
  transactionId?: string;
2425
2486
  iCalUId?: string;
2487
+ uid?: string;
2426
2488
  recurrence?: IMicrosoftGraphRecurrence;
2427
2489
  attendees?: IMicrosoftGraphAttendee[];
2428
2490
  organizer?: {
@@ -2565,10 +2627,15 @@ declare class MicrosoftCalendarBookingService extends BaseCalendarBookingManagem
2565
2627
  private deleteGraphEvent;
2566
2628
  private resolveSkipDatesIfAny;
2567
2629
  private findOccurrenceInstanceId;
2630
+ private listAllEvents;
2568
2631
  private pickMailbox;
2569
2632
  private organizerUserMailbox;
2570
2633
  private assertMailbox;
2571
2634
  private assertEventId;
2635
+ syncEvents(request: ISyncEventsRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<ISyncEventsResponse>;
2636
+ private resolveDeltaUrl;
2637
+ private resolveSeedWindow;
2638
+ private toGraphRelativePath;
2572
2639
  }
2573
2640
 
2574
2641
  declare class MicrosoftCalendarWebhookService extends BaseCalendarWebhookManagement {
@@ -2639,6 +2706,7 @@ declare abstract class ICalendarBookingHandler {
2639
2706
  abstract getCalendarBookings(request: IGetEventsRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IGetEventsResponse>;
2640
2707
  abstract getCalendarBooking(request: IGetCalendarEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IBookingEventRef>;
2641
2708
  abstract acceptCalendarBooking(request: IAcceptEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<void>;
2709
+ abstract syncCalendarBookings(request: ISyncEventsRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<ISyncEventsResponse>;
2642
2710
  abstract getCalendarBookingInstances(request: IGetEventInstancesRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IGetEventsResponse>;
2643
2711
  abstract updateCalendarBookingInstances(request: IUpdateEventInstancesRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IUpdateEventInstancesResponse>;
2644
2712
  }
@@ -2677,6 +2745,7 @@ declare class MicrosoftCalendarBookingHandler extends ICalendarBookingHandler {
2677
2745
  getCalendarBookings(request: IGetEventsRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IGetEventsResponse>;
2678
2746
  getCalendarBooking(request: IGetCalendarEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IBookingEventRef>;
2679
2747
  acceptCalendarBooking(request: IAcceptEventRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<void>;
2748
+ syncCalendarBookings(request: ISyncEventsRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<ISyncEventsResponse>;
2680
2749
  getCalendarBookingInstances(request: IGetEventInstancesRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IGetEventsResponse>;
2681
2750
  updateCalendarBookingInstances(request: IUpdateEventInstancesRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IUpdateEventInstancesResponse>;
2682
2751
  }
@@ -2738,4 +2807,4 @@ declare class CalendarIntegrationConfigurationAdapterFactory extends AdapterFact
2738
2807
  constructor(microsoftCalendarIntegrationConfigurationHandler: MicrosoftCalendarIntegrationConfigurationHandler);
2739
2808
  }
2740
2809
 
2741
- export { type AccountConfig, type ActivityLogAuthor, AdapterFactoryService, BOOKABLE_ITEM_STATUS_ENUM, BOOKABLE_ITEM_TYPE_ENUM, BaseAccessManagement, BaseAccountingContactPersonManagement, BaseAccountingCreditNoteManagement, BaseAccountingCustomerPaymentManagement, BaseAccountingInvoiceManagement, BaseAccountingLOAManagement, BaseAccountingMiscellaneousManagement, BaseAccountingTaxManagement, BaseAuth, BaseCalendarBookingManagement, BaseCalendarResourceManagement, BaseCalendarWebhookManagement, BaseCreditBooking, BaseCustomerManagement, BaseDeviceManagement, BaseIntegrationConfiguration, BaseIntegrationResourceManagement, BaseMembershipCustomerManagement, BaseMembershipManagement, BasePackageManagement, BasePayment, BasePaymentMethodManagement, BasePaymentUserManagement, BaseWellnessManagement, CALENDAR_PROVIDER_ENUM, CREDIT_FILTER_BY_ENUM, CREDIT_NOTE_STATUS, CREDIT_STATUS_ENUM, CREDIT_TYPE_ENUM, CalendarAuthAdapterFactory, CalendarBookingAdapterFactory, CalendarIntegrationConfigurationAdapterFactory, AppModule$2 as CalendarIntegrationManager, CalendarResourceAdapterFactory, CalendarWebhookAdapterFactory, type CapabilityIntegrationCategory, type CustomerActivity, DOWNLOAD_CUSTOMER_ACCOUNTING_STATEMENT_FILTER_BY_ENUM, DOWNLOAD_CUSTOMER_ACCOUNTING_STATEMENT_STATUS_ENUM, type DigitalAsset, EVENT_INSTANCE_KIND, GET_CUSTOMER_CREDIT_NOTES_FILTER_BY, GET_CUSTOMER_CREDIT_NOTES_SORT_BY, GET_INVOICES_FILTER_BY_ENUM, GET_INVOICES_SORT_BY_ENUM, GET_PAYMENTS_FILTER_BY_ENUM, GET_PAYMENTS_FILTER_VALUE_ENUM, GET_PAYMENTS_SORTING_ENUM, GET_RECURRING_INVOICES_SORT_BY_ENUM, type GetCustomerActivitiesInput, type GetFolioActivitiesOptionsInput, HTTP_METHOD, type IAPIResponse, type IAcceptEventRequest, type IAccessProfile, type IAccessProfiles, type IAccountingAPIResponse, type IAccountingInvoice, type IAccountingListAPIPageContext, type IAccountingListAPIResponse, type IAccountingListAPISearchCriteria, type IAccounts, type IAddCapIntegResourceMapping, type IAddCapabilityIntegration, type IAddCapabilityIntegrationConfig, type IAddCapabilityIntegrationConfiguredFor, type IAddCapabilityIntegrationInput, type IAddCapabilityIntegrationMappingResponse, type IAddCustomerContactPersonRequest, type IAddCustomerRequest, type IAddItemToOrderItemConfig, type IAddItemToOrderRequest, type IAddItemToOrderResponse, type IAddPaymentToOrderRequest, type IAddResourceToIntegrationInput, type IAddResourceToIntegrationResponse, type IAddUpdateAccessGroupRequest, type IAdminCredentials, type IApiCallRequest, type IApplyCreditNoteForInvoicesRequest, type IAvailableDateWithSlots, type IAvailableTaxes, type IAvailableTimeSlot, type IBatchRefreshWebhookItem, type IBatchRefreshWebhookResult, type IBookableItem, type IBookableItemCategory, type IBookableItemMedia, type IBookableItemPrice, type IBookableItemPriceMeta, type IBookingEvent, type IBookingEventInstance, type IBookingEventRef, type IBookingItem, type IBookingItemResource, type IBookingManagementContext, ICalendarAuthHandler, ICalendarBookingHandler, ICalendarIntegrationConfigurationHandler, ICalendarResourceHandler, ICalendarWebhookHandler, type ICalendarWebhookSubscription, type ICancelEventRequest, type ICapabilityIntegration, type ICapabilityIntegrationConfig, type ICapabilityIntegrationResourceMapping, type ICapabilityIntegrationResourceMappingRow, type IConfiguration, type ICreateCreditNoteForInvoiceRequest, type ICreateCustomerPaymentRequest, type ICreateEventRequest, type ICreateOrderRequest, type ICreateOrderResponse, type ICreateRecurringInvoiceLineItem, type ICreateRecurringInvoiceRequest, type ICreateRecurringInvoiceResponse, type ICreateRefundRequest, type ICredit, type ICreditNoteAppliedInvoice, type ICreditNoteOperator, type ICurrency, type ICustomer, type ICustomerAddionalDetails, type ICustomerContactPerson, type ICustomerContactPersonResponse, type ICustomerCreditNote, type ICustomerCreditNoteDetail, type ICustomerLastCheckIn, type ICustomerPaymentDetails, type ICustomerPaymentRecord, type ICustomerRole, type ICustomerStatusResponse, type IDeleteAPIResponse, type IDeleteCustomerContactPersonRequest, type IDeleteDeviceInput, type IDeleteDeviceResponse, type IDeleteEventRequest, type IDeleteWebhookRequest, type IDownloadCustomerAccountingStatementRequest, type IEventSyncMetadata, type IExcludedDateResult, type IFetchOfferingAvailabilityRequest, type IGetAccessProfilesResponse, type IGetAppointmentsRequest, type IGetAvailableDatesAndTimeSlotsResponse, type IGetBookableItemsFromCreditRequest, type IGetCalendarEventRequest, type IGetCapabilityIntegrationInput, type IGetCapabilityIntegrationResult, type IGetCapabilityIntegrationsFilterInput, type IGetCapabilityIntegrationsOptionsInput, type IGetCapabilityIntegrationsRequest, type IGetCapabilityIntegrationsResponse, type IGetCapabilityIntegrationsSortingInput, type IGetCategoriesRequest, type IGetCoursesRequest, type IGetCreateCustomerPayment, type IGetCreateCustomerPaymentInfo, type IGetCustomerAccessGroupsInput, type IGetCustomerAccessGroupsResponse, type IGetCustomerActivities, type IGetCustomerCreditNotesRequest, type IGetCustomerCreditNotesResponse, type IGetCustomerCreditsRequest, type IGetCustomerCreditsRequestFilters, type IGetCustomerCreditsRequestOptions, type IGetCustomerPayment, type IGetCustomerPaymentRefundInfo, type IGetCustomerPaymentRequest, type IGetCustomerPayments, type IGetCustomerPaymentsFilter, type IGetCustomerPaymentsOptions, type IGetCustomerPaymentsRequest, type IGetCustomerPaymentsSorting, type IGetCustomerRequest, type IGetDeviceKeyInput, type IGetDeviceKeyResponse, type IGetDevicesInput, type IGetDevicesResponse, type IGetEventInstancesRequest, type IGetEventsRequest, type IGetEventsResponse, type IGetInvoicesOptions, type IGetInvoicesRequest, type IGetOrderResponse, type IGetPractitionersRequest, type IGetRecurringInvoiceInput, type IGetRecurringInvoiceRequest, type IGetRecurringInvoicesOptions, type IGetRecurringInvoicesRequest, type IGetRefundCustomerPayment, type IGetResourcesRequest, type IGetResourcesResponse, type IGetSessionsRequest, type IGraphBatchRequest, type IGraphBatchRequestItem, type IGraphBatchResponse, type IGraphBatchResponseItem, type IIcon, type IInstanceUpdate, type IIntegrationConfigFieldMetadata, type IIntegrationConfigFieldMetadataMap, type IIntegrationConfigJson, type IIntegrationConfigStructureMetadata, type IIntegrationRequestContext, type IIntegrationRequestLog, type IInvoice, type IInvoiceCapabilityIntegration, type IInvoiceCapabilityIntegrationConfig, type IInvoiceIntegrationRequest, type IInvoiceResponse, type IInvoicesResponse, type IKey, type IListUsersInput, type IListUsersResponse, type IMarkCustomerContactPersonPrimaryRequest, type IMicrosoftAccessDetails, type IMicrosoftAccessToken, type IMicrosoftApiCallRequest, type IMicrosoftConfig, type IMicrosoftGraphAttendee, type IMicrosoftGraphBatchRequest, type IMicrosoftGraphBatchRequestItem, type IMicrosoftGraphBatchResponse, type IMicrosoftGraphBatchResponseItem, type IMicrosoftGraphDateTimeTimeZone, type IMicrosoftGraphErrorBody, type IMicrosoftGraphEvent, type IMicrosoftGraphEventBatchResponse, type IMicrosoftGraphEventsResponse, type IMicrosoftGraphRecurrence, type IMicrosoftGraphRecurrencePattern, type IMicrosoftGraphRecurrenceRange, type IMicrosoftGraphRoom, type IMicrosoftGraphRoomsResponse, type IMicrosoftGraphSubscription, type IMicrosoftIntegrationConfig, type IMicrosoftPlatformConfig, type IMicrosoftTokenResponse, INVOICE_STATUS_ENUM, type INonSensitiveStoredField, type IOfferingBookingOccurrence, type IOfferingResource, type IOfferingResourceMedia, type IOrderGuest, type IRecurringInvoices, type IRecurringInvoicesResponse, type IRefreshWebhookRequest, type IRefreshWebhookResponse, type IRefundCustomerPayment, type IRegisterDeviceInput, type IRegisterDeviceResponse, type IRegisterWebhookRequest, type IRegisterWebhookResponse, type IRemoveCapabilityIntegrationMappingInput, type IRemoveResourceFromIntegrationRequest, type IRemoveResourceFromIntegrationResponse, type IResource, type IResourceManagementContext, type ISecureStorageWriteOptions, type ISensitiveStoredField, type IStoredConfigField, type ISystemResponse, type ITransactionNumberSeries, type ITransactionNumberSeriesItem, type IUpdateAPIResponse, type IUpdateCapabilityIntegration, type IUpdateCapabilityIntegrationRequest, type IUpdateCapabilityIntegrationResponse, type IUpdateCapabilityIntegrationUpdateData, type IUpdateCustomerContactPersonRequest, type IUpdateCustomerPaymentRequest, type IUpdateCustomerRequest, type IUpdateDeviceCertificateInput, type IUpdateDeviceCertificateResponse, type IUpdateEventInstancesRequest, type IUpdateEventInstancesResponse, type IUpdateEventRequest, type IUpdateOfferingIntegrationResourceConfigurationInput, type IUpdateOfferingIntegrationResourceConfigurationResponse, type IUpdateOrderRequest, type IUpdateOrderResponse, type IUpdateRecurringInvoiceRequest, type IUpdateRecurringInvoiceResponse, type IUpdateRecurringInvoiceStatusRequest, type IUserAccessGroup, type IValidatedCapabilityIntegration, type IValidatedCapabilityIntegrationConfig, type IWebhookManagementContext, type IWellnessManagementRequestOptions, IntegrationBookingDao, IntegrationCommonDao, IntegrationConfigSecureStorageService, IntegrationConfigurationDao, AppModule$1 as IntegrationLibsModule, AppModule as IntegrationMicrosoftModule, IntegrationOnpremDeploymentDao, IntegrationRequestLoggerService, IntegrationResourceManagementDao, IntegrationServiceCommunicationTopicDao, IntegrationSubcapabilityDao, IntegrationUserManagementDao, IntegrationVisitorCredentialMappingDao, type InvoiceAccessDetails, MICROSOFT_CALENDAR_DELTA_DEFAULT_WINDOW_YEARS, MICROSOFT_CLIENT_CREDENTIALS_GRANT_TYPE, MICROSOFT_DEFAULT_ACCESS_TOKEN_TYPE, MICROSOFT_DEFAULT_AUTH_URL, MICROSOFT_DEFAULT_GRAPH_BASE_URL, MICROSOFT_DEFAULT_GRAPH_SCOPE, MICROSOFT_DEFAULT_HEADERS, MICROSOFT_GRAPH_PATHS, MICROSOFT_SECURE_STORAGE, MICROSOFT_TOKEN_HEADERS, MicrosoftApiClientService, MicrosoftAuthService, MicrosoftCalendarAuthHandler, MicrosoftCalendarBookingHandler, MicrosoftCalendarBookingService, MicrosoftCalendarIntegrationConfigurationHandler, MicrosoftCalendarResourceHandler, MicrosoftCalendarResourceService, MicrosoftCalendarWebhookHandler, MicrosoftCalendarWebhookService, type MicrosoftIntegrationConfigInput, MicrosoftIntegrationConfigurationService, type Note, type NoteAttachment, type NoteChangelog, type NoteChangelogRecord, type NoteResource, type NoteUserIdentity, RECURRING_INVOICE_STATUS, RECURRING_INVOICE_STATUS_ENUM, RateLimiterService, type ResourceAssetMapping, TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY, TrafficGatewayService, type UserIdentity, buildMicrosoftIntegrationConfig, getMicrosoftKmsKeyId, looksLikeStoredSecureConfig };
2810
+ export { type AccountConfig, type ActivityLogAuthor, AdapterFactoryService, BOOKABLE_ITEM_STATUS_ENUM, BOOKABLE_ITEM_TYPE_ENUM, BaseAccessManagement, BaseAccountingContactPersonManagement, BaseAccountingCreditNoteManagement, BaseAccountingCustomerPaymentManagement, BaseAccountingInvoiceManagement, BaseAccountingLOAManagement, BaseAccountingMiscellaneousManagement, BaseAccountingTaxManagement, BaseAuth, BaseCalendarBookingManagement, BaseCalendarResourceManagement, BaseCalendarWebhookManagement, BaseCreditBooking, BaseCustomerManagement, BaseDeviceManagement, BaseIntegrationConfiguration, BaseIntegrationResourceManagement, BaseMembershipCustomerManagement, BaseMembershipManagement, BasePackageManagement, BasePayment, BasePaymentMethodManagement, BasePaymentUserManagement, BaseWellnessManagement, CALENDAR_PROVIDER_ENUM, CREDIT_FILTER_BY_ENUM, CREDIT_NOTE_STATUS, CREDIT_STATUS_ENUM, CREDIT_TYPE_ENUM, CalendarAuthAdapterFactory, CalendarBookingAdapterFactory, CalendarIntegrationConfigurationAdapterFactory, AppModule$2 as CalendarIntegrationManager, CalendarResourceAdapterFactory, CalendarWebhookAdapterFactory, type CapabilityIntegrationCategory, type CustomerActivity, DOWNLOAD_CUSTOMER_ACCOUNTING_STATEMENT_FILTER_BY_ENUM, DOWNLOAD_CUSTOMER_ACCOUNTING_STATEMENT_STATUS_ENUM, type DigitalAsset, EVENT_INSTANCE_KIND, GET_CUSTOMER_CREDIT_NOTES_FILTER_BY, GET_CUSTOMER_CREDIT_NOTES_SORT_BY, GET_INVOICES_FILTER_BY_ENUM, GET_INVOICES_SORT_BY_ENUM, GET_PAYMENTS_FILTER_BY_ENUM, GET_PAYMENTS_FILTER_VALUE_ENUM, GET_PAYMENTS_SORTING_ENUM, GET_RECURRING_INVOICES_SORT_BY_ENUM, type GetCustomerActivitiesInput, type GetFolioActivitiesOptionsInput, HTTP_METHOD, type IAPIResponse, type IAcceptEventRequest, type IAccessProfile, type IAccessProfiles, type IAccountingAPIResponse, type IAccountingInvoice, type IAccountingListAPIPageContext, type IAccountingListAPIResponse, type IAccountingListAPISearchCriteria, type IAccounts, type IAddCapIntegResourceMapping, type IAddCapabilityIntegration, type IAddCapabilityIntegrationConfig, type IAddCapabilityIntegrationConfiguredFor, type IAddCapabilityIntegrationInput, type IAddCapabilityIntegrationMappingResponse, type IAddCustomerContactPersonRequest, type IAddCustomerRequest, type IAddItemToOrderItemConfig, type IAddItemToOrderRequest, type IAddItemToOrderResponse, type IAddPaymentToOrderRequest, type IAddResourceToIntegrationInput, type IAddResourceToIntegrationResponse, type IAddUpdateAccessGroupRequest, type IAdminCredentials, type IApiCallRequest, type IApplyCreditNoteForInvoicesRequest, type IAvailableDateWithSlots, type IAvailableTaxes, type IAvailableTimeSlot, type IBatchRefreshWebhookItem, type IBatchRefreshWebhookResult, type IBookableItem, type IBookableItemCategory, type IBookableItemMedia, type IBookableItemPrice, type IBookableItemPriceMeta, type IBookingEvent, type IBookingEventInstance, type IBookingEventRef, type IBookingItem, type IBookingItemResource, type IBookingManagementContext, ICalendarAuthHandler, ICalendarBookingHandler, type ICalendarInboundRecurrence, type ICalendarInboundSyncEvent, ICalendarIntegrationConfigurationHandler, ICalendarResourceHandler, ICalendarWebhookHandler, type ICalendarWebhookSubscription, type ICancelEventRequest, type ICapabilityIntegration, type ICapabilityIntegrationConfig, type ICapabilityIntegrationResourceMapping, type ICapabilityIntegrationResourceMappingRow, type IConfiguration, type ICreateCreditNoteForInvoiceRequest, type ICreateCustomerPaymentRequest, type ICreateEventRequest, type ICreateOrderRequest, type ICreateOrderResponse, type ICreateRecurringInvoiceLineItem, type ICreateRecurringInvoiceRequest, type ICreateRecurringInvoiceResponse, type ICreateRefundRequest, type ICredit, type ICreditNoteAppliedInvoice, type ICreditNoteOperator, type ICurrency, type ICustomer, type ICustomerAddionalDetails, type ICustomerContactPerson, type ICustomerContactPersonResponse, type ICustomerCreditNote, type ICustomerCreditNoteDetail, type ICustomerLastCheckIn, type ICustomerPaymentDetails, type ICustomerPaymentRecord, type ICustomerRole, type ICustomerStatusResponse, type IDeleteAPIResponse, type IDeleteCustomerContactPersonRequest, type IDeleteDeviceInput, type IDeleteDeviceResponse, type IDeleteEventRequest, type IDeleteWebhookRequest, type IDownloadCustomerAccountingStatementRequest, type IEventSyncMetadata, type IExcludedDateResult, type IFetchOfferingAvailabilityRequest, type IGetAccessProfilesResponse, type IGetAppointmentsRequest, type IGetAvailableDatesAndTimeSlotsResponse, type IGetBookableItemsFromCreditRequest, type IGetCalendarEventRequest, type IGetCapabilityIntegrationInput, type IGetCapabilityIntegrationResult, type IGetCapabilityIntegrationsFilterInput, type IGetCapabilityIntegrationsOptionsInput, type IGetCapabilityIntegrationsRequest, type IGetCapabilityIntegrationsResponse, type IGetCapabilityIntegrationsSortingInput, type IGetCategoriesRequest, type IGetCoursesRequest, type IGetCreateCustomerPayment, type IGetCreateCustomerPaymentInfo, type IGetCustomerAccessGroupsInput, type IGetCustomerAccessGroupsResponse, type IGetCustomerActivities, type IGetCustomerCreditNotesRequest, type IGetCustomerCreditNotesResponse, type IGetCustomerCreditsRequest, type IGetCustomerCreditsRequestFilters, type IGetCustomerCreditsRequestOptions, type IGetCustomerPayment, type IGetCustomerPaymentRefundInfo, type IGetCustomerPaymentRequest, type IGetCustomerPayments, type IGetCustomerPaymentsFilter, type IGetCustomerPaymentsOptions, type IGetCustomerPaymentsRequest, type IGetCustomerPaymentsSorting, type IGetCustomerRequest, type IGetDeviceKeyInput, type IGetDeviceKeyResponse, type IGetDevicesInput, type IGetDevicesResponse, type IGetEventInstancesRequest, type IGetEventsRequest, type IGetEventsResponse, type IGetInvoicesOptions, type IGetInvoicesRequest, type IGetOrderResponse, type IGetPractitionersRequest, type IGetRecurringInvoiceInput, type IGetRecurringInvoiceRequest, type IGetRecurringInvoicesOptions, type IGetRecurringInvoicesRequest, type IGetRefundCustomerPayment, type IGetResourcesRequest, type IGetResourcesResponse, type IGetSessionsRequest, type IGraphBatchRequest, type IGraphBatchRequestItem, type IGraphBatchResponse, type IGraphBatchResponseItem, type IIcon, type IInstanceUpdate, type IIntegrationConfigFieldMetadata, type IIntegrationConfigFieldMetadataMap, type IIntegrationConfigJson, type IIntegrationConfigStructureMetadata, type IIntegrationRequestContext, type IIntegrationRequestLog, type IInvoice, type IInvoiceCapabilityIntegration, type IInvoiceCapabilityIntegrationConfig, type IInvoiceIntegrationRequest, type IInvoiceResponse, type IInvoicesResponse, type IKey, type IListUsersInput, type IListUsersResponse, type IMarkCustomerContactPersonPrimaryRequest, type IMicrosoftAccessDetails, type IMicrosoftAccessToken, type IMicrosoftApiCallRequest, type IMicrosoftConfig, type IMicrosoftGraphAttendee, type IMicrosoftGraphBatchRequest, type IMicrosoftGraphBatchRequestItem, type IMicrosoftGraphBatchResponse, type IMicrosoftGraphBatchResponseItem, type IMicrosoftGraphDateTimeTimeZone, type IMicrosoftGraphErrorBody, type IMicrosoftGraphEvent, type IMicrosoftGraphEventBatchResponse, type IMicrosoftGraphEventsResponse, type IMicrosoftGraphRecurrence, type IMicrosoftGraphRecurrencePattern, type IMicrosoftGraphRecurrenceRange, type IMicrosoftGraphRoom, type IMicrosoftGraphRoomsResponse, type IMicrosoftGraphSubscription, type IMicrosoftIntegrationConfig, type IMicrosoftPlatformConfig, type IMicrosoftTokenResponse, INVOICE_STATUS_ENUM, type INonSensitiveStoredField, type IOfferingBookingOccurrence, type IOfferingResource, type IOfferingResourceMedia, type IOrderGuest, type IRecurringInvoices, type IRecurringInvoicesResponse, type IRefreshWebhookRequest, type IRefreshWebhookResponse, type IRefundCustomerPayment, type IRegisterDeviceInput, type IRegisterDeviceResponse, type IRegisterWebhookRequest, type IRegisterWebhookResponse, type IRemoveCapabilityIntegrationMappingInput, type IRemoveResourceFromIntegrationRequest, type IRemoveResourceFromIntegrationResponse, type IResource, type IResourceManagementContext, type ISecureStorageWriteOptions, type ISensitiveStoredField, type IStoredConfigField, type ISyncEventsRequest, type ISyncEventsResponse, type ISystemResponse, type ITransactionNumberSeries, type ITransactionNumberSeriesItem, type IUpdateAPIResponse, type IUpdateCapabilityIntegration, type IUpdateCapabilityIntegrationRequest, type IUpdateCapabilityIntegrationResponse, type IUpdateCapabilityIntegrationUpdateData, type IUpdateCustomerContactPersonRequest, type IUpdateCustomerPaymentRequest, type IUpdateCustomerRequest, type IUpdateDeviceCertificateInput, type IUpdateDeviceCertificateResponse, type IUpdateEventInstancesRequest, type IUpdateEventInstancesResponse, type IUpdateEventRequest, type IUpdateOfferingIntegrationResourceConfigurationInput, type IUpdateOfferingIntegrationResourceConfigurationResponse, type IUpdateOrderRequest, type IUpdateOrderResponse, type IUpdateRecurringInvoiceRequest, type IUpdateRecurringInvoiceResponse, type IUpdateRecurringInvoiceStatusRequest, type IUserAccessGroup, type IValidatedCapabilityIntegration, type IValidatedCapabilityIntegrationConfig, type IWebhookManagementContext, type IWellnessManagementRequestOptions, IntegrationBookingDao, IntegrationCommonDao, IntegrationConfigSecureStorageService, IntegrationConfigurationDao, AppModule$1 as IntegrationLibsModule, AppModule as IntegrationMicrosoftModule, IntegrationOnpremDeploymentDao, IntegrationRequestLoggerService, IntegrationResourceManagementDao, IntegrationServiceCommunicationTopicDao, IntegrationSubcapabilityDao, IntegrationUserManagementDao, IntegrationVisitorCredentialMappingDao, type InvoiceAccessDetails, MICROSOFT_CALENDAR_DELTA_DEFAULT_WINDOW_YEARS, MICROSOFT_CLIENT_CREDENTIALS_GRANT_TYPE, MICROSOFT_DEFAULT_ACCESS_TOKEN_TYPE, MICROSOFT_DEFAULT_AUTH_URL, MICROSOFT_DEFAULT_GRAPH_BASE_URL, MICROSOFT_DEFAULT_GRAPH_SCOPE, MICROSOFT_DEFAULT_HEADERS, MICROSOFT_GRAPH_PATHS, MICROSOFT_SECURE_STORAGE, MICROSOFT_TOKEN_HEADERS, MicrosoftApiClientService, MicrosoftAuthService, MicrosoftCalendarAuthHandler, MicrosoftCalendarBookingHandler, MicrosoftCalendarBookingService, MicrosoftCalendarIntegrationConfigurationHandler, MicrosoftCalendarResourceHandler, MicrosoftCalendarResourceService, MicrosoftCalendarWebhookHandler, MicrosoftCalendarWebhookService, type MicrosoftIntegrationConfigInput, MicrosoftIntegrationConfigurationService, type Note, type NoteAttachment, type NoteChangelog, type NoteChangelogRecord, type NoteResource, type NoteUserIdentity, RECURRING_INVOICE_STATUS, RECURRING_INVOICE_STATUS_ENUM, RateLimiterService, type ResourceAssetMapping, TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY, TrafficGatewayService, type UserIdentity, buildMicrosoftIntegrationConfig, getMicrosoftKmsKeyId, looksLikeStoredSecureConfig };
package/dist/index.js CHANGED
@@ -4050,11 +4050,43 @@ function graphEventsToInstances(response) {
4050
4050
  startDateLabel: graph.start.dateTime.slice(0, 10),
4051
4051
  seriesId: graph.seriesMasterId,
4052
4052
  iCalUId: graph.iCalUId,
4053
+ uid: graph.uid,
4054
+ instanceKind: graph.type ? GRAPH_TYPE_TO_INSTANCE_KIND[graph.type] : void 0,
4053
4055
  transactionId: graph.transactionId,
4054
4056
  subject: graph.subject
4055
4057
  }));
4056
4058
  }
4057
4059
  __name(graphEventsToInstances, "graphEventsToInstances");
4060
+ function toGraphWindowDateTime(dateLabel, timeLabel, timeZone) {
4061
+ const local = `${dateLabel}T${timeLabel}`;
4062
+ const offset = timeZone ? timeZoneOffset(local, timeZone) : void 0;
4063
+ return offset ? `${local}${offset}` : local;
4064
+ }
4065
+ __name(toGraphWindowDateTime, "toGraphWindowDateTime");
4066
+ function timeZoneOffset(local, timeZone) {
4067
+ try {
4068
+ const zoneName = new Intl.DateTimeFormat("en-US", {
4069
+ timeZone,
4070
+ timeZoneName: "longOffset"
4071
+ }).formatToParts(/* @__PURE__ */ new Date(`${local}Z`)).find((part) => part.type === "timeZoneName")?.value;
4072
+ const match = zoneName ? /^GMT(?<offset>[+-]\d{2}:\d{2})?$/.exec(zoneName) : void 0;
4073
+ if (!match) {
4074
+ return void 0;
4075
+ }
4076
+ return match.groups?.offset ?? "+00:00";
4077
+ } catch {
4078
+ return void 0;
4079
+ }
4080
+ }
4081
+ __name(timeZoneOffset, "timeZoneOffset");
4082
+ function toGraphRelativeUrl(link) {
4083
+ if (!link) {
4084
+ return void 0;
4085
+ }
4086
+ const parsed = new URL(link);
4087
+ return `${parsed.pathname.replace(/^\/(?:v1\.0|beta)(?=\/)/, "")}${parsed.search}`;
4088
+ }
4089
+ __name(toGraphRelativeUrl, "toGraphRelativeUrl");
4058
4090
  function toGraphDateTime(dateLabel, timeLabel, isFullDay) {
4059
4091
  if (isFullDay || !timeLabel) {
4060
4092
  return `${dateLabel}T00:00:00`;
@@ -4070,6 +4102,57 @@ function omitUndefined(value) {
4070
4102
  return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
4071
4103
  }
4072
4104
  __name(omitUndefined, "omitUndefined");
4105
+ function fromGraphEvent(graph, options) {
4106
+ const providerPayload = {
4107
+ ...graph
4108
+ };
4109
+ return {
4110
+ id: graph.id,
4111
+ subject: graph.subject ?? "",
4112
+ body: graph.body?.content,
4113
+ start: graph.start ?? {
4114
+ dateTime: "",
4115
+ timeZone: ""
4116
+ },
4117
+ end: graph.end ?? {
4118
+ dateTime: "",
4119
+ timeZone: ""
4120
+ },
4121
+ location: graph.location?.displayName,
4122
+ resourceId: options?.resourceId,
4123
+ recurrence: graph.recurrence ? {
4124
+ pattern: {
4125
+ type: graph.recurrence.pattern?.type ?? "",
4126
+ interval: graph.recurrence.pattern?.interval ?? 1,
4127
+ daysOfWeek: graph.recurrence.pattern?.daysOfWeek,
4128
+ firstDayOfWeek: graph.recurrence.pattern?.firstDayOfWeek,
4129
+ dayOfMonth: graph.recurrence.pattern?.dayOfMonth,
4130
+ month: graph.recurrence.pattern?.month,
4131
+ index: graph.recurrence.pattern?.index
4132
+ },
4133
+ range: {
4134
+ type: graph.recurrence.range?.type ?? "",
4135
+ startDate: graph.recurrence.range?.startDate ?? "",
4136
+ endDate: graph.recurrence.range?.endDate,
4137
+ numberOfOccurrences: graph.recurrence.range?.numberOfOccurrences,
4138
+ recurrenceTimeZone: graph.recurrence.range?.recurrenceTimeZone
4139
+ }
4140
+ } : void 0,
4141
+ attendees: graph.attendees?.filter((attendee) => Boolean(attendee.emailAddress?.address)).map((attendee) => ({
4142
+ email: attendee.emailAddress?.address ?? "",
4143
+ name: attendee.emailAddress?.name,
4144
+ type: attendee.type
4145
+ })),
4146
+ organizerEmail: graph.organizer?.emailAddress?.address,
4147
+ showAs: graph.showAs,
4148
+ isCancelled: graph.isCancelled === true || graph["@removed"] != null,
4149
+ type: graph.type,
4150
+ seriesMasterId: graph.seriesMasterId,
4151
+ transactionId: graph.transactionId,
4152
+ providerPayload
4153
+ };
4154
+ }
4155
+ __name(fromGraphEvent, "fromGraphEvent");
4073
4156
 
4074
4157
  // ../../packages/dvss-integration-microsoft/src/capabilities/booking-management/booking-management.service.ts
4075
4158
  function _ts_decorate28(decorators, target, key, desc2) {
@@ -4084,6 +4167,10 @@ function _ts_metadata23(k, v) {
4084
4167
  }
4085
4168
  __name(_ts_metadata23, "_ts_metadata");
4086
4169
  var GRAPH_BATCH_MAX_SIZE = 20;
4170
+ var GRAPH_LIST_PAGE_SIZE = 100;
4171
+ var GRAPH_LIST_MAX_PAGES = 50;
4172
+ var WINDOW_START_TIME = "00:00:00";
4173
+ var WINDOW_END_TIME = "23:59:59";
4087
4174
  exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService extends BaseCalendarBookingManagement {
4088
4175
  static {
4089
4176
  __name(this, "MicrosoftCalendarBookingService");
@@ -4112,7 +4199,7 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
4112
4199
  targetMailbox: mailboxEmail
4113
4200
  })
4114
4201
  }, integration, loggedInUserId);
4115
- const excludedDateResults = await this.resolveSkipDatesIfAny(graphEvent.id, request.event.schedule?.skipDates, mailboxEmail, this.organizerUserMailbox(organizerEmail), integration, loggedInUserId);
4202
+ const excludedDateResults = await this.resolveSkipDatesIfAny(graphEvent.id, request.event.schedule?.skipDates, mailboxEmail, this.organizerUserMailbox(organizerEmail), request.event.timeZone, integration, loggedInUserId);
4116
4203
  const ref = graphEventToRef(graphEvent, {
4117
4204
  organizerUserEmail: this.organizerUserMailbox(organizerEmail),
4118
4205
  resourceId: roomEmail,
@@ -4146,7 +4233,7 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
4146
4233
  targetMailbox: mailboxEmail
4147
4234
  })
4148
4235
  }, integration, loggedInUserId);
4149
- const excludedDateResults = await this.resolveSkipDatesIfAny(graphEvent.id ?? request.eventId, request.event.schedule?.skipDates, mailboxEmail, this.organizerUserMailbox(request.organizerUserEmail), integration, loggedInUserId);
4236
+ const excludedDateResults = await this.resolveSkipDatesIfAny(graphEvent.id ?? request.eventId, request.event.schedule?.skipDates, mailboxEmail, this.organizerUserMailbox(request.organizerUserEmail), request.event.timeZone, integration, loggedInUserId);
4150
4237
  const ref = graphEventToRef(graphEvent, {
4151
4238
  organizerUserEmail: this.organizerUserMailbox(request.organizerUserEmail),
4152
4239
  resourceId: request.resourceEmail,
@@ -4268,18 +4355,15 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
4268
4355
  try {
4269
4356
  const mailboxEmail = this.pickMailbox(request.organizerUserEmail, request.resourceEmail);
4270
4357
  this.assertMailbox(mailboxEmail);
4271
- const hasWindow = Boolean(request.startDateLabel && request.endDateLabel);
4272
- const url = hasWindow ? MICROSOFT_GRAPH_PATHS.userCalendarView(mailboxEmail, `${request.startDateLabel}T00:00:00`, `${request.endDateLabel}T23:59:59`) : MICROSOFT_GRAPH_PATHS.userCalendarEvents(mailboxEmail);
4358
+ const url = request.startDateLabel && request.endDateLabel ? MICROSOFT_GRAPH_PATHS.userCalendarView(mailboxEmail, toGraphWindowDateTime(request.startDateLabel, WINDOW_START_TIME, request.timeZone), toGraphWindowDateTime(request.endDateLabel, WINDOW_END_TIME, request.timeZone)) : MICROSOFT_GRAPH_PATHS.userCalendarEvents(mailboxEmail);
4273
4359
  this.logger.info(loggedInUserId, this.getEvents.name, this.fileName, "List Microsoft Graph calendar events", {
4274
4360
  mailboxEmail,
4275
4361
  path: url,
4276
- hasTimeWindow: hasWindow
4362
+ hasTimeWindow: Boolean(request.startDateLabel && request.endDateLabel)
4363
+ });
4364
+ const events = graphEventsToInstances({
4365
+ value: await this.listAllEvents(url, request.timeZone, integration, loggedInUserId)
4277
4366
  });
4278
- const response = await this.microsoftApiClient.apiCall({
4279
- apiMethod: HTTP_METHOD.GET,
4280
- url
4281
- }, integration, loggedInUserId);
4282
- const events = graphEventsToInstances(response);
4283
4367
  this.logger.info(loggedInUserId, this.getEvents.name, this.fileName, "Listed Microsoft Graph calendar events", {
4284
4368
  mailboxEmail,
4285
4369
  count: events.length
@@ -4302,17 +4386,15 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
4302
4386
  const mailboxEmail = this.pickMailbox(request.organizerUserEmail, request.resourceEmail);
4303
4387
  this.assertMailbox(mailboxEmail);
4304
4388
  this.assertEventId(request.seriesEventId);
4305
- const url = MICROSOFT_GRAPH_PATHS.userCalendarEventInstances(mailboxEmail, request.seriesEventId, `${request.startDateLabel}T00:00:00`, `${request.endDateLabel}T23:59:59`);
4389
+ const url = MICROSOFT_GRAPH_PATHS.userCalendarEventInstances(mailboxEmail, request.seriesEventId, toGraphWindowDateTime(request.startDateLabel, WINDOW_START_TIME, request.timeZone), toGraphWindowDateTime(request.endDateLabel, WINDOW_END_TIME, request.timeZone));
4306
4390
  this.logger.info(loggedInUserId, this.getEventInstances.name, this.fileName, "List Microsoft Graph series instances", {
4307
4391
  mailboxEmail,
4308
4392
  seriesEventId: request.seriesEventId,
4309
4393
  path: url
4310
4394
  });
4311
- const response = await this.microsoftApiClient.apiCall({
4312
- apiMethod: HTTP_METHOD.GET,
4313
- url
4314
- }, integration, loggedInUserId);
4315
- const events = graphEventsToInstances(response);
4395
+ const events = graphEventsToInstances({
4396
+ value: await this.listAllEvents(url, request.timeZone, integration, loggedInUserId)
4397
+ });
4316
4398
  this.logger.info(loggedInUserId, this.getEventInstances.name, this.fileName, "Listed Microsoft Graph series instances", {
4317
4399
  mailboxEmail,
4318
4400
  seriesEventId: request.seriesEventId,
@@ -4417,14 +4499,14 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
4417
4499
  * created/updated and cancels it via the existing DELETE path. Best-effort per date — a
4418
4500
  * date that can't be resolved is reported `excluded: false`, not thrown.
4419
4501
  */
4420
- async resolveSkipDatesIfAny(seriesId, dates, mailboxEmail, organizerUserEmail, integration, loggedInUserId) {
4502
+ async resolveSkipDatesIfAny(seriesId, dates, mailboxEmail, organizerUserEmail, timeZone, integration, loggedInUserId) {
4421
4503
  if (!dates?.length) {
4422
4504
  return void 0;
4423
4505
  }
4424
4506
  const results = [];
4425
4507
  for (const date of dates) {
4426
4508
  try {
4427
- const instanceId = await this.findOccurrenceInstanceId(seriesId, date, mailboxEmail, integration, loggedInUserId);
4509
+ const instanceId = await this.findOccurrenceInstanceId(seriesId, date, mailboxEmail, timeZone, integration, loggedInUserId);
4428
4510
  if (!instanceId) {
4429
4511
  this.logger.warn(loggedInUserId, this.resolveSkipDatesIfAny.name, this.fileName, "Could not resolve skip-date occurrence", {
4430
4512
  seriesId,
@@ -4462,12 +4544,54 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
4462
4544
  }
4463
4545
  return results;
4464
4546
  }
4465
- async findOccurrenceInstanceId(seriesId, date, mailboxEmail, integration, loggedInUserId) {
4466
- const response = await this.microsoftApiClient.apiCall({
4467
- apiMethod: HTTP_METHOD.GET,
4468
- url: MICROSOFT_GRAPH_PATHS.userCalendarView(mailboxEmail, `${date}T00:00:00`, `${date}T23:59:59`)
4469
- }, integration, loggedInUserId);
4470
- return (response.value ?? []).find((occurrence) => occurrence.seriesMasterId === seriesId)?.id;
4547
+ /**
4548
+ * The series' own instance on `date`. Lists the series' instances rather than the mailbox's
4549
+ * whole calendarView, so a busy day can't push the occurrence off the returned page.
4550
+ */
4551
+ async findOccurrenceInstanceId(seriesId, date, mailboxEmail, timeZone, integration, loggedInUserId) {
4552
+ if (!seriesId) {
4553
+ return void 0;
4554
+ }
4555
+ const instances = await this.listAllEvents(MICROSOFT_GRAPH_PATHS.userCalendarEventInstances(mailboxEmail, seriesId, toGraphWindowDateTime(date, WINDOW_START_TIME, timeZone), toGraphWindowDateTime(date, WINDOW_END_TIME, timeZone)), timeZone, integration, loggedInUserId);
4556
+ return instances.find((occurrence) => occurrence.seriesMasterId === seriesId)?.id;
4557
+ }
4558
+ /**
4559
+ * GETs a Graph event listing and follows `@odata.nextLink` until the last page.
4560
+ *
4561
+ * Graph pages calendarView/instances listings (10 events by default), so reading only the first
4562
+ * page silently drops every event past it — on a busy organizer mailbox that is the very series
4563
+ * being looked up. `Prefer: outlook.timezone` makes Graph return `start`/`end` in the property's
4564
+ * zone, so the date labels cut from them are local dates rather than UTC ones.
4565
+ * @param url - The first page's path (calendarView / instances / events)
4566
+ * @param timeZone - IANA zone to return event times in; UTC when absent
4567
+ */
4568
+ async listAllEvents(url, timeZone, integration, loggedInUserId) {
4569
+ const headers = timeZone ? {
4570
+ Prefer: `outlook.timezone="${timeZone}"`
4571
+ } : void 0;
4572
+ const events = [];
4573
+ let nextUrl = `${url}${url.includes("?") ? "&" : "?"}$top=${GRAPH_LIST_PAGE_SIZE}`;
4574
+ let pageCount = 0;
4575
+ while (nextUrl && pageCount < GRAPH_LIST_MAX_PAGES) {
4576
+ const response = await this.microsoftApiClient.apiCall({
4577
+ apiMethod: HTTP_METHOD.GET,
4578
+ url: nextUrl,
4579
+ ...headers ? {
4580
+ headers
4581
+ } : {}
4582
+ }, integration, loggedInUserId);
4583
+ events.push(...response.value ?? []);
4584
+ nextUrl = toGraphRelativeUrl(response["@odata.nextLink"]);
4585
+ pageCount += 1;
4586
+ }
4587
+ if (nextUrl) {
4588
+ this.logger.warn(loggedInUserId, this.listAllEvents.name, this.fileName, "Stopped following Graph pages at the page limit; listing truncated", {
4589
+ url,
4590
+ pageCount,
4591
+ eventCount: events.length
4592
+ });
4593
+ }
4594
+ return events;
4471
4595
  }
4472
4596
  /** Mailbox the Graph call targets: the organizing user if known, else the room. */
4473
4597
  pickMailbox(organizerEmail, roomEmail) {
@@ -4487,6 +4611,108 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
4487
4611
  throw new dvssBackendModuleUtility.CustomException("BAD_REQUEST", "eventId is required");
4488
4612
  }
4489
4613
  }
4614
+ async syncEvents(request, integration, loggedInUserId) {
4615
+ try {
4616
+ this.assertMailbox(request.resourceEmail);
4617
+ const mailboxEmail = request.resourceEmail;
4618
+ let url = this.resolveDeltaUrl(request, mailboxEmail);
4619
+ this.logger.info(loggedInUserId, this.syncEvents.name, this.fileName, "Sync Microsoft Graph calendar events (delta)", {
4620
+ mailboxEmail,
4621
+ resourceId: request.resourceEmail,
4622
+ hasSyncToken: Boolean(request.syncToken),
4623
+ path: url
4624
+ });
4625
+ const events = [];
4626
+ let nextSyncToken;
4627
+ let page = 0;
4628
+ while (url) {
4629
+ page += 1;
4630
+ const response = await this.microsoftApiClient.apiCall({
4631
+ apiMethod: HTTP_METHOD.GET,
4632
+ url,
4633
+ headers: {
4634
+ ["Prefer"]: "odata.maxpagesize=50"
4635
+ }
4636
+ }, integration, loggedInUserId);
4637
+ for (const graphEvent of response.value ?? []) {
4638
+ events.push(fromGraphEvent(graphEvent, {
4639
+ resourceId: request.resourceEmail,
4640
+ organizerUserEmail: this.organizerUserMailbox(request.organizerUserEmail)
4641
+ }));
4642
+ }
4643
+ const nextLink = response["@odata.nextLink"];
4644
+ const deltaLink = response["@odata.deltaLink"];
4645
+ if (nextLink) {
4646
+ url = this.toGraphRelativePath(nextLink);
4647
+ continue;
4648
+ }
4649
+ nextSyncToken = deltaLink;
4650
+ url = "";
4651
+ }
4652
+ this.logger.info(loggedInUserId, this.syncEvents.name, this.fileName, "Synced Microsoft Graph calendar events (delta)", {
4653
+ mailboxEmail,
4654
+ resourceId: request.resourceEmail,
4655
+ count: events.length,
4656
+ pages: page,
4657
+ hasNextSyncToken: Boolean(nextSyncToken)
4658
+ });
4659
+ return {
4660
+ events,
4661
+ nextSyncToken
4662
+ };
4663
+ } catch (error) {
4664
+ this.logger.error(loggedInUserId, this.syncEvents.name, this.fileName, "Error syncing Microsoft Graph calendar events (delta)", error);
4665
+ throw error;
4666
+ }
4667
+ }
4668
+ resolveDeltaUrl(request, mailboxEmail) {
4669
+ if (request.syncToken?.trim()) {
4670
+ return this.toGraphRelativePath(request.syncToken.trim());
4671
+ }
4672
+ const window = this.resolveSeedWindow(request);
4673
+ return MICROSOFT_GRAPH_PATHS.userCalendarViewDelta(mailboxEmail, window.startDateTime, window.endDateTime);
4674
+ }
4675
+ resolveSeedWindow(request) {
4676
+ if (request.startDateLabel && request.endDateLabel) {
4677
+ return {
4678
+ startDateTime: `${request.startDateLabel}T00:00:00`,
4679
+ endDateTime: `${request.endDateLabel}T23:59:59`
4680
+ };
4681
+ }
4682
+ const start = /* @__PURE__ */ new Date();
4683
+ const end = new Date(start);
4684
+ end.setUTCFullYear(end.getUTCFullYear() + MICROSOFT_CALENDAR_DELTA_DEFAULT_WINDOW_YEARS);
4685
+ return {
4686
+ startDateTime: start.toISOString().replace("Z", ""),
4687
+ endDateTime: end.toISOString().replace("Z", "")
4688
+ };
4689
+ }
4690
+ /**
4691
+ * Traffic gateway always prefixes platform baseUrl — convert absolute Graph next/delta
4692
+ * links into path+query relative to `/v1.0`.
4693
+ */
4694
+ toGraphRelativePath(urlOrPath) {
4695
+ if (urlOrPath.startsWith("/")) {
4696
+ return urlOrPath;
4697
+ }
4698
+ const baseNoSlash = MICROSOFT_DEFAULT_GRAPH_BASE_URL.replace(/\/$/, "");
4699
+ if (urlOrPath.startsWith(baseNoSlash)) {
4700
+ const rest = urlOrPath.slice(baseNoSlash.length);
4701
+ return rest.startsWith("/") ? rest : `/${rest}`;
4702
+ }
4703
+ try {
4704
+ const parsed = new URL(urlOrPath);
4705
+ let path = `${parsed.pathname}${parsed.search}`;
4706
+ if (path.startsWith("/v1.0/")) {
4707
+ path = path.slice("/v1.0".length);
4708
+ } else if (path === "/v1.0") {
4709
+ path = "/";
4710
+ }
4711
+ return path.startsWith("/") ? path : `/${path}`;
4712
+ } catch {
4713
+ return urlOrPath.startsWith("/") ? urlOrPath : `/${urlOrPath}`;
4714
+ }
4715
+ }
4490
4716
  };
4491
4717
  exports.MicrosoftCalendarBookingService = _ts_decorate28([
4492
4718
  common.Injectable(),
@@ -5098,6 +5324,9 @@ exports.MicrosoftCalendarBookingHandler = class MicrosoftCalendarBookingHandler
5098
5324
  async acceptCalendarBooking(request, integration, loggedInUserId) {
5099
5325
  return this.microsoftCalendarBookingService.acceptEvent(request, integration, loggedInUserId);
5100
5326
  }
5327
+ async syncCalendarBookings(request, integration, loggedInUserId) {
5328
+ return this.microsoftCalendarBookingService.syncEvents(request, integration, loggedInUserId);
5329
+ }
5101
5330
  async getCalendarBookingInstances(request, integration, loggedInUserId) {
5102
5331
  return this.microsoftCalendarBookingService.getEventInstances(request, integration, loggedInUserId);
5103
5332
  }