@dv4resi/dvss-backend-module-calendar-im 0.0.13 → 0.0.14
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 +2 -0
- package/dist/index.js +35 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1750,6 +1750,7 @@ interface IBookingEvent {
|
|
|
1750
1750
|
timeZone?: string;
|
|
1751
1751
|
seriesEndDateLabel?: string;
|
|
1752
1752
|
syncMetadata?: IEventSyncMetadata;
|
|
1753
|
+
transactionId?: string;
|
|
1753
1754
|
}
|
|
1754
1755
|
interface IEventSyncMetadata {
|
|
1755
1756
|
createdBy?: 'DVSS' | 'PROVIDER';
|
|
@@ -2631,6 +2632,7 @@ declare class MicrosoftCalendarBookingService extends BaseCalendarBookingManagem
|
|
|
2631
2632
|
updateEventInstances(request: IUpdateEventInstancesRequest, integration: ICapabilityIntegration, loggedInUserId: bigint): Promise<IUpdateEventInstancesResponse>;
|
|
2632
2633
|
private chunkInstanceUpdates;
|
|
2633
2634
|
private deleteGraphEvent;
|
|
2635
|
+
private readHttpStatus;
|
|
2634
2636
|
private resolveSkipDatesIfAny;
|
|
2635
2637
|
private findOccurrenceInstanceId;
|
|
2636
2638
|
private listAllEvents;
|
package/dist/index.js
CHANGED
|
@@ -3919,6 +3919,9 @@ function toGraphEvent(event, options) {
|
|
|
3919
3919
|
if (attendees.length > 0) {
|
|
3920
3920
|
graph.attendees = attendees;
|
|
3921
3921
|
}
|
|
3922
|
+
if (event.transactionId !== void 0 && event.transactionId !== "") {
|
|
3923
|
+
graph.transactionId = event.transactionId;
|
|
3924
|
+
}
|
|
3922
3925
|
return graph;
|
|
3923
3926
|
}
|
|
3924
3927
|
__name(toGraphEvent, "toGraphEvent");
|
|
@@ -4493,10 +4496,38 @@ exports.MicrosoftCalendarBookingService = class MicrosoftCalendarBookingService
|
|
|
4493
4496
|
async deleteGraphEvent(mailboxEmail, eventId, integration, loggedInUserId) {
|
|
4494
4497
|
this.assertMailbox(mailboxEmail);
|
|
4495
4498
|
this.assertEventId(eventId);
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4499
|
+
try {
|
|
4500
|
+
await this.microsoftApiClient.apiCall({
|
|
4501
|
+
apiMethod: HTTP_METHOD.DELETE,
|
|
4502
|
+
url: MICROSOFT_GRAPH_PATHS.userCalendarEvent(mailboxEmail, eventId)
|
|
4503
|
+
}, integration, loggedInUserId);
|
|
4504
|
+
} catch (error) {
|
|
4505
|
+
const status = this.readHttpStatus(error);
|
|
4506
|
+
if (status === 404) {
|
|
4507
|
+
this.logger.info(loggedInUserId, this.deleteGraphEvent.name, this.fileName, "Graph event already deleted (404) \u2014 treating cancel as success", {
|
|
4508
|
+
mailboxEmail,
|
|
4509
|
+
eventId
|
|
4510
|
+
});
|
|
4511
|
+
return;
|
|
4512
|
+
}
|
|
4513
|
+
if (status === 412) {
|
|
4514
|
+
const preconditionError = new Error(`Microsoft Graph precondition failed (412) deleting event ${eventId}`);
|
|
4515
|
+
preconditionError.status = 412;
|
|
4516
|
+
preconditionError.response = {
|
|
4517
|
+
status: 412
|
|
4518
|
+
};
|
|
4519
|
+
preconditionError.isGraphPreconditionFailed = true;
|
|
4520
|
+
throw preconditionError;
|
|
4521
|
+
}
|
|
4522
|
+
throw error;
|
|
4523
|
+
}
|
|
4524
|
+
}
|
|
4525
|
+
readHttpStatus(error) {
|
|
4526
|
+
const errorObject = error;
|
|
4527
|
+
if (errorObject.isGraphPreconditionFailed) {
|
|
4528
|
+
return 412;
|
|
4529
|
+
}
|
|
4530
|
+
return errorObject.response?.status ?? errorObject.status;
|
|
4500
4531
|
}
|
|
4501
4532
|
/**
|
|
4502
4533
|
* Graph always creates/updates a recurring series whole. For each date in
|