Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@coozzy/cal-dav

Package Overview
Dependencies
Maintainers
3
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coozzy/cal-dav - npm Package Compare versions

Comparing version 2.3.3 to 2.3.4

14

dist/index.d.ts
import * as ICAL from 'ical.js';
import { CalDavService } from './lib/caldav-service';
import { CalDavParser } from './lib/caldav-parser';
import { Attendee, Reminder } from './lib/types';
import { Attendee, Alarm } from './lib/types';
export interface CalDavClient {

@@ -10,4 +10,4 @@ getEventByUrl(eventUrl: string): Promise<ICAL.Event | undefined>;

listAllEvents(): Promise<ICAL.Event[]>;
createEvent(eventUrl: string, id: string, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]): Promise<void>;
updateEvent(eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, exceptionEventId?: number, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]): Promise<void>;
createEvent(eventUrl: string, id: string, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]): Promise<void>;
updateEvent(eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, exceptionEventId?: number, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]): Promise<void>;
deleteOccurrenceEvent(eventUrl: string, event: ICAL.Event, exceptionEventId: number, prodid: string): Promise<void>;

@@ -28,5 +28,5 @@ listEventsInTimeRange(startDate: Date, endDate?: Date): Promise<ICAL.EventWithExceptions[]>;

multiGetEvents: (eventUrls: string[]) => Promise<ICAL.Event[]>;
createEvent: (eventUrl: string, id: string, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]) => Promise<void>;
updateEvent: (eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, exceptionEventId: number | undefined, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]) => Promise<void>;
updateEventProperties: (eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]) => string;
createEvent: (eventUrl: string, id: string, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]) => Promise<void>;
updateEvent: (eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, exceptionEventId: number | undefined, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]) => Promise<void>;
updateEventProperties: (eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]) => string;
deleteOccurrenceEvent: (eventUrl: string, event: ICAL.Event, exceptionEventId: number, prodid: string) => Promise<void>;

@@ -41,4 +41,4 @@ createEventWithString: (event: string, eventUid: string) => Promise<void>;

private eventIncludedInDates;
private mapReminderUnit;
private mapAlarmUnit;
private requiresTimeDesignatorForDuration;
}

@@ -99,3 +99,3 @@ "use strict";

};
this.createEvent = async (eventUrl, id, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, reminders) => {
this.createEvent = async (eventUrl, id, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, alarms) => {
try {

@@ -128,19 +128,19 @@ // wrap request data in VCALENDAR

}
if (reminders !== null && reminders !== void 0 && reminders.length) {
for (const reminder of reminders) {
const alarm = new ICAL.Component('valarm');
if (alarms !== null && alarms !== void 0 && alarms.length) {
for (const alarm of alarms) {
const calDavAlarm = new ICAL.Component('valarm');
const action = new ICAL.Property('action');
action.setValue('DISPLAY');
alarm.addProperty(action);
calDavAlarm.addProperty(action);
if (description) {
const description = new ICAL.Property('description');
description.setValue(description);
alarm.addProperty(description);
calDavAlarm.addProperty(description);
}
if (reminder.reminderIntervalValue && reminder.reminderIntervalUnit) {
if (alarm.alarmIntervalValue && alarm.alarmIntervalUnit) {
const trigger = new ICAL.Property('trigger');
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(reminder.reminderIntervalUnit) ? 'T' : ''}${reminder.reminderIntervalValue}${this.mapReminderUnit(reminder.reminderIntervalUnit)}`);
alarm.addProperty(trigger);
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(alarm.alarmIntervalUnit) ? 'T' : ''}${alarm.alarmIntervalValue}${this.mapAlarmUnit(alarm.alarmIntervalUnit)}`);
calDavAlarm.addProperty(trigger);
}
event.component.addSubcomponent(alarm);
event.component.addSubcomponent(calDavAlarm);
}

@@ -162,3 +162,3 @@ }

};
this.updateEvent = async (eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, exceptionEventId, frequencyInterval, endDateFrequency, countFrequency, reminders) => {
this.updateEvent = async (eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, exceptionEventId, frequencyInterval, endDateFrequency, countFrequency, alarms) => {
try {

@@ -178,3 +178,3 @@ let eventString;

const exceptionEvent = new ICAL.Event(exceptions[exception.toString()].component);
exceptionEventString += this.updateEventProperties(eventUrl, exceptionEvent, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, undefined, undefined, undefined, reminders);
exceptionEventString += this.updateEventProperties(eventUrl, exceptionEvent, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, undefined, undefined, undefined, alarms);
} else {

@@ -187,3 +187,3 @@ const exceptionEvent = new ICAL.Event(exceptions[exception.toString()].component);

} else {
eventString = this.updateEventProperties(eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, reminders);
eventString = this.updateEventProperties(eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, alarms);
}

@@ -196,3 +196,3 @@ eventString += exceptionEventString;

};
this.updateEventProperties = (eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, reminders) => {
this.updateEventProperties = (eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, alarms) => {
try {

@@ -241,19 +241,19 @@ event.summary = title;

event.component = newEventComponent;
if (reminders !== null && reminders !== void 0 && reminders.length) {
for (const reminder of reminders) {
const alarm = new ICAL.Component('valarm');
if (alarms !== null && alarms !== void 0 && alarms.length) {
for (const alarm of alarms) {
const calDavAlarm = new ICAL.Component('valarm');
const action = new ICAL.Property('action');
action.setValue('DISPLAY');
alarm.addProperty(action);
calDavAlarm.addProperty(action);
if (description) {
const description = new ICAL.Property('description');
description.setValue(description);
alarm.addProperty(description);
calDavAlarm.addProperty(description);
}
if (reminder.reminderIntervalValue && reminder.reminderIntervalUnit) {
if (alarm.alarmIntervalValue && alarm.alarmIntervalUnit) {
const trigger = new ICAL.Property('trigger');
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(reminder.reminderIntervalUnit) ? 'T' : ''}${reminder.reminderIntervalValue}${this.mapReminderUnit(reminder.reminderIntervalUnit)}`);
alarm.addProperty(trigger);
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(alarm.alarmIntervalUnit) ? 'T' : ''}${alarm.alarmIntervalValue}${this.mapAlarmUnit(alarm.alarmIntervalUnit)}`);
calDavAlarm.addProperty(trigger);
}
event.component.addSubcomponent(alarm);
event.component.addSubcomponent(calDavAlarm);
}

@@ -443,15 +443,15 @@ }

}
mapReminderUnit(unit) {
mapAlarmUnit(unit) {
switch (unit) {
case 'REMINDER_UNIT_MINUTE':
case 'ALARM_UNIT_MINUTE':
return 'M';
case 'REMINDER_UNIT_HOUR':
case 'ALARM_UNIT_HOUR':
return 'H';
case 'REMINDER_UNIT_DAY':
case 'ALARM_UNIT_DAY':
return 'D';
case 'REMINDER_UNIT_WEEK':
case 'ALARM_UNIT_WEEK':
return 'W';
case 'REMINDER_UNIT_MONTH':
case 'ALARM_UNIT_MONTH':
return 'M';
case 'REMINDER_UNIT_YEAR':
case 'ALARM_UNIT_YEAR':
return 'Y';

@@ -464,5 +464,5 @@ default:

switch (unit) {
case 'REMINDER_UNIT_WEEK':
case 'REMINDER_UNIT_MONTH':
case 'REMINDER_UNIT_YEAR':
case 'ALARM_UNIT_WEEK':
case 'ALARM_UNIT_MONTH':
case 'ALARM_UNIT_YEAR':
return true;

@@ -469,0 +469,0 @@ default:

@@ -7,6 +7,6 @@ export type AtendeeStatus = 'ATTENDEE_STATUS_NEEDS_ACTION' | 'ATTENDEE_STATUS_ACCEPTED' | 'ATTENDEE_STATUS_DECLINED' | 'ATTENDEE_STATUS_TENTATIVE';

}
export interface Reminder {
reminderIntervalValue?: number;
reminderIntervalUnit?: IntervalUnit;
export interface Alarm {
alarmIntervalValue?: number;
alarmIntervalUnit?: IntervalUnit;
}
export type IntervalUnit = 'REMINDER_UNIT_UNDEFINED' | 'REMINDER_UNIT_MINUTE' | 'REMINDER_UNIT_HOUR' | 'REMINDER_UNIT_DAY' | 'REMINDER_UNIT_WEEK' | 'REMINDER_UNIT_MONTH' | 'REMINDER_UNIT_YEAR';
export type IntervalUnit = 'ALARM_UNIT_UNDEFINED' | 'ALARM_UNIT_MINUTE' | 'ALARM_UNIT_HOUR' | 'ALARM_UNIT_DAY' | 'ALARM_UNIT_WEEK' | 'ALARM_UNIT_MONTH' | 'ALARM_UNIT_YEAR';
{
"name": "@coozzy/cal-dav",
"version": "2.3.3",
"version": "2.3.4",
"description": "Simple cal dav client.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

import * as ICAL from 'ical.js';
import {CalDavService, DefaultCalDavService} from './lib/caldav-service';
import {CalDavParser, DefaultCalDavParser} from './lib/caldav-parser';
import {Attendee, Reminder} from './lib/types';
import {Attendee, Alarm} from './lib/types';
import logger from '@coozzy/logger';

@@ -33,3 +33,3 @@ import {FrequencyValues, RecurData} from 'ical.js';

countFrequency?: number,
reminders?: Reminder[]): Promise<void>;
alarms?: Alarm[]): Promise<void>;

@@ -52,3 +52,3 @@ updateEvent(eventUrl: string,

countFrequency?: number,
reminders?: Reminder[]): Promise<void>;
alarms?: Alarm[]): Promise<void>;

@@ -168,3 +168,3 @@ deleteOccurrenceEvent(eventUrl: string,

createEvent = async(eventUrl: string, id: string, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]): Promise<void> => {
createEvent = async(eventUrl: string, id: string, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]): Promise<void> => {
try{

@@ -201,19 +201,19 @@ // wrap request data in VCALENDAR

if (reminders?.length) {
for (const reminder of reminders) {
const alarm = new ICAL.Component('valarm');
if (alarms?.length) {
for (const alarm of alarms) {
const calDavAlarm = new ICAL.Component('valarm');
const action = new ICAL.Property('action');
action.setValue('DISPLAY');
alarm.addProperty(action);
calDavAlarm.addProperty(action);
if (description) {
const description = new ICAL.Property('description');
description.setValue(description);
alarm.addProperty(description);
calDavAlarm.addProperty(description);
}
if (reminder.reminderIntervalValue && reminder.reminderIntervalUnit) {
if (alarm.alarmIntervalValue && alarm.alarmIntervalUnit) {
const trigger = new ICAL.Property('trigger');
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(reminder.reminderIntervalUnit) ? 'T' : ''}${reminder.reminderIntervalValue}${this.mapReminderUnit(reminder.reminderIntervalUnit)}`);
alarm.addProperty(trigger);
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(alarm.alarmIntervalUnit) ? 'T' : ''}${alarm.alarmIntervalValue}${this.mapAlarmUnit(alarm.alarmIntervalUnit)}`);
calDavAlarm.addProperty(trigger);
}
event.component.addSubcomponent(alarm);
event.component.addSubcomponent(calDavAlarm);
}

@@ -239,3 +239,3 @@ }

updateEvent = async(eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, exceptionEventId: number | undefined, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]): Promise<void> => {
updateEvent = async(eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, exceptionEventId: number | undefined, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]): Promise<void> => {
try{

@@ -255,3 +255,3 @@ let eventString: string;

const exceptionEvent: ICAL.Event = new ICAL.Event(exceptions[exception.toString()].component);
exceptionEventString += this.updateEventProperties(eventUrl, exceptionEvent, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, undefined, undefined, undefined, reminders);
exceptionEventString += this.updateEventProperties(eventUrl, exceptionEvent, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, undefined, undefined, undefined, alarms);
} else {

@@ -264,3 +264,3 @@ const exceptionEvent: ICAL.Event = new ICAL.Event(exceptions[exception.toString()].component);

} else {
eventString = this.updateEventProperties(eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, reminders);
eventString = this.updateEventProperties(eventUrl, event, title, description, location, startDate, endDate, attendees, categories, organizerEmail, prodid, privateEvent, frequencyInterval, endDateFrequency, countFrequency, alarms);
}

@@ -275,3 +275,3 @@ eventString += exceptionEventString;

updateEventProperties = (eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, reminders?: Reminder[]): string => {
updateEventProperties = (eventUrl: string, event: ICAL.Event, title: string, description: string, location: string, startDate: ICAL.TimeJsonData, endDate: ICAL.TimeJsonData, attendees: Attendee[], categories: string[], organizerEmail: string, prodid: string, privateEvent: boolean, frequencyInterval?: string, endDateFrequency?: ICAL.TimeJsonData, countFrequency?: number, alarms?: Alarm[]): string => {
try{

@@ -327,19 +327,19 @@ event.summary = title;

if (reminders?.length) {
for (const reminder of reminders) {
const alarm = new ICAL.Component('valarm');
if (alarms?.length) {
for (const alarm of alarms) {
const calDavAlarm = new ICAL.Component('valarm');
const action = new ICAL.Property('action');
action.setValue('DISPLAY');
alarm.addProperty(action);
calDavAlarm.addProperty(action);
if (description) {
const description = new ICAL.Property('description');
description.setValue(description);
alarm.addProperty(description);
calDavAlarm.addProperty(description);
}
if (reminder.reminderIntervalValue && reminder.reminderIntervalUnit) {
if (alarm.alarmIntervalValue && alarm.alarmIntervalUnit) {
const trigger = new ICAL.Property('trigger');
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(reminder.reminderIntervalUnit) ? 'T' : ''}${reminder.reminderIntervalValue}${this.mapReminderUnit(reminder.reminderIntervalUnit)}`);
alarm.addProperty(trigger);
trigger.setValue(`-P${this.requiresTimeDesignatorForDuration(alarm.alarmIntervalUnit) ? 'T' : ''}${alarm.alarmIntervalValue}${this.mapAlarmUnit(alarm.alarmIntervalUnit)}`);
calDavAlarm.addProperty(trigger);
}
event.component.addSubcomponent(alarm);
event.component.addSubcomponent(calDavAlarm);
}

@@ -566,15 +566,15 @@ }

private mapReminderUnit(unit: string): string {
private mapAlarmUnit(unit: string): string {
switch (unit) {
case 'REMINDER_UNIT_MINUTE':
case 'ALARM_UNIT_MINUTE':
return 'M';
case 'REMINDER_UNIT_HOUR':
case 'ALARM_UNIT_HOUR':
return 'H';
case 'REMINDER_UNIT_DAY':
case 'ALARM_UNIT_DAY':
return 'D';
case 'REMINDER_UNIT_WEEK':
case 'ALARM_UNIT_WEEK':
return 'W';
case 'REMINDER_UNIT_MONTH':
case 'ALARM_UNIT_MONTH':
return 'M';
case 'REMINDER_UNIT_YEAR':
case 'ALARM_UNIT_YEAR':
return 'Y';

@@ -588,5 +588,5 @@ default:

switch (unit) {
case 'REMINDER_UNIT_WEEK':
case 'REMINDER_UNIT_MONTH':
case 'REMINDER_UNIT_YEAR':
case 'ALARM_UNIT_WEEK':
case 'ALARM_UNIT_MONTH':
case 'ALARM_UNIT_YEAR':
return true;

@@ -593,0 +593,0 @@ default:

@@ -14,12 +14,12 @@

export interface Reminder {
reminderIntervalValue?: number;
reminderIntervalUnit?: IntervalUnit;
export interface Alarm {
alarmIntervalValue?: number;
alarmIntervalUnit?: IntervalUnit;
}
export type IntervalUnit = 'REMINDER_UNIT_UNDEFINED' |
'REMINDER_UNIT_MINUTE' |
'REMINDER_UNIT_HOUR' |
'REMINDER_UNIT_DAY' |
'REMINDER_UNIT_WEEK' |
'REMINDER_UNIT_MONTH' |
'REMINDER_UNIT_YEAR';
export type IntervalUnit = 'ALARM_UNIT_UNDEFINED' |
'ALARM_UNIT_MINUTE' |
'ALARM_UNIT_HOUR' |
'ALARM_UNIT_DAY' |
'ALARM_UNIT_WEEK' |
'ALARM_UNIT_MONTH' |
'ALARM_UNIT_YEAR';
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc