ical-generator 5.0.2-develop.2 → 6.0.0-develop.1
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 +14 -20
- package/dist/index.cjs +24 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -115
- package/dist/index.d.ts +52 -115
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/package.json +8 -14
- package/src/alarm.ts +68 -113
- package/src/attendee.ts +14 -11
- package/src/calendar.ts +0 -88
- package/src/category.ts +14 -12
- package/src/event.ts +13 -17
- package/src/index.ts +3 -1
- package/src/tools.ts +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ServerResponse } from 'node:http';
|
|
2
|
-
|
|
3
1
|
interface ICalAttendeeData {
|
|
4
2
|
name?: string | null;
|
|
5
|
-
email
|
|
3
|
+
email: string;
|
|
6
4
|
mailto?: string | null;
|
|
7
5
|
sentBy?: string | null;
|
|
8
6
|
status?: ICalAttendeeStatus | null;
|
|
@@ -20,7 +18,7 @@ interface ICalAttendeeData {
|
|
|
20
18
|
}
|
|
21
19
|
interface ICalAttendeeJSONData {
|
|
22
20
|
name: string | null;
|
|
23
|
-
email: string
|
|
21
|
+
email: string;
|
|
24
22
|
mailto: string | null;
|
|
25
23
|
sentBy: string | null;
|
|
26
24
|
status: ICalAttendeeStatus | null;
|
|
@@ -61,14 +59,14 @@ declare enum ICalAttendeeType {
|
|
|
61
59
|
* import ical from 'ical-generator';
|
|
62
60
|
* const calendar = ical();
|
|
63
61
|
* const event = calendar.createEvent();
|
|
64
|
-
* const attendee = event.createAttendee();
|
|
62
|
+
* const attendee = event.createAttendee({ email: 'mail@example.com' });
|
|
65
63
|
* ```
|
|
66
64
|
*
|
|
67
65
|
* You can also use the [[`ICalAttendee`]] object directly:
|
|
68
66
|
*
|
|
69
67
|
* ```javascript
|
|
70
68
|
* import ical, {ICalAttendee} from 'ical-generator';
|
|
71
|
-
* const attendee = new ICalAttendee();
|
|
69
|
+
* const attendee = new ICalAttendee({ email: 'mail@example.com' });
|
|
72
70
|
* event.attendees([attendee]);
|
|
73
71
|
* ```
|
|
74
72
|
*/
|
|
@@ -97,12 +95,12 @@ declare class ICalAttendee {
|
|
|
97
95
|
* Get the attendee's email address
|
|
98
96
|
* @since 0.2.0
|
|
99
97
|
*/
|
|
100
|
-
email(): string
|
|
98
|
+
email(): string;
|
|
101
99
|
/**
|
|
102
100
|
* Set the attendee's email address
|
|
103
101
|
* @since 0.2.0
|
|
104
102
|
*/
|
|
105
|
-
email(email: string
|
|
103
|
+
email(email: string): this;
|
|
106
104
|
/**
|
|
107
105
|
* Get the attendee's email address
|
|
108
106
|
* @since 1.3.0
|
|
@@ -418,14 +416,20 @@ interface ICalAttachment {
|
|
|
418
416
|
uri: string;
|
|
419
417
|
mime: string | null;
|
|
420
418
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
trigger
|
|
419
|
+
type ICalAlarmData = ICalAlarmBaseData | ICalAlarmTriggerData | ICalAlarmTriggerAfterData | ICalAlarmTriggerBeforeData;
|
|
420
|
+
type ICalAlarmTriggerData = ICalAlarmBaseData & {
|
|
421
|
+
trigger: number | ICalDateTimeValue;
|
|
422
|
+
};
|
|
423
|
+
type ICalAlarmTriggerAfterData = ICalAlarmBaseData & {
|
|
424
|
+
triggerAfter: number | ICalDateTimeValue;
|
|
425
|
+
};
|
|
426
|
+
type ICalAlarmTriggerBeforeData = ICalAlarmBaseData & {
|
|
427
|
+
triggerBefore: number | ICalDateTimeValue;
|
|
428
|
+
};
|
|
429
|
+
interface ICalAlarmBaseData {
|
|
430
|
+
type?: ICalAlarmType;
|
|
424
431
|
relatesTo?: ICalAlarmRelatesTo | null;
|
|
425
|
-
|
|
426
|
-
triggerAfter?: number | ICalDateTimeValue | null;
|
|
427
|
-
repeat?: number | null;
|
|
428
|
-
interval?: number | null;
|
|
432
|
+
repeat?: ICalAlarmRepeatData | null;
|
|
429
433
|
attach?: string | ICalAttachment | null;
|
|
430
434
|
description?: string | null;
|
|
431
435
|
x?: {
|
|
@@ -433,11 +437,15 @@ interface ICalAlarmData {
|
|
|
433
437
|
value: string;
|
|
434
438
|
}[] | [string, string][] | Record<string, string>;
|
|
435
439
|
}
|
|
440
|
+
interface ICalAlarmRepeatData {
|
|
441
|
+
times: number;
|
|
442
|
+
interval: number;
|
|
443
|
+
}
|
|
436
444
|
interface ICalAlarmJSONData {
|
|
437
|
-
type: ICalAlarmType
|
|
438
|
-
trigger: string | number
|
|
445
|
+
type: ICalAlarmType;
|
|
446
|
+
trigger: string | number;
|
|
439
447
|
relatesTo: ICalAlarmRelatesTo | null;
|
|
440
|
-
repeat:
|
|
448
|
+
repeat: ICalAlarmRepeatData | null;
|
|
441
449
|
interval: number | null;
|
|
442
450
|
attach: ICalAttachment | null;
|
|
443
451
|
description: string | null;
|
|
@@ -479,13 +487,13 @@ declare class ICalAlarm {
|
|
|
479
487
|
* Get the alarm type
|
|
480
488
|
* @since 0.2.1
|
|
481
489
|
*/
|
|
482
|
-
type(type: ICalAlarmType
|
|
490
|
+
type(type: ICalAlarmType): this;
|
|
483
491
|
/**
|
|
484
492
|
* Set the alarm type. See [[`ICalAlarmType`]]
|
|
485
493
|
* for available status options.
|
|
486
494
|
* @since 0.2.1
|
|
487
495
|
*/
|
|
488
|
-
type(): ICalAlarmType
|
|
496
|
+
type(): ICalAlarmType;
|
|
489
497
|
/**
|
|
490
498
|
* Get the trigger time for the alarm. Can either
|
|
491
499
|
* be a date and time value ([[`ICalDateTimeValue`]]) or
|
|
@@ -495,7 +503,7 @@ declare class ICalAlarm {
|
|
|
495
503
|
*
|
|
496
504
|
* @since 0.2.1
|
|
497
505
|
*/
|
|
498
|
-
trigger(): number | ICalDateTimeValue
|
|
506
|
+
trigger(): number | ICalDateTimeValue;
|
|
499
507
|
/**
|
|
500
508
|
* Use this method to set the alarm time.
|
|
501
509
|
*
|
|
@@ -514,7 +522,7 @@ declare class ICalAlarm {
|
|
|
514
522
|
*
|
|
515
523
|
* @since 0.2.1
|
|
516
524
|
*/
|
|
517
|
-
trigger(trigger: number | ICalDateTimeValue | Date
|
|
525
|
+
trigger(trigger: number | ICalDateTimeValue | Date): this;
|
|
518
526
|
/**
|
|
519
527
|
* Get to which time alarm trigger relates to.
|
|
520
528
|
* Can be either `START` or `END`. If the value is
|
|
@@ -555,7 +563,7 @@ declare class ICalAlarm {
|
|
|
555
563
|
*
|
|
556
564
|
* @since 0.2.1
|
|
557
565
|
*/
|
|
558
|
-
triggerAfter(): number | ICalDateTimeValue
|
|
566
|
+
triggerAfter(): number | ICalDateTimeValue;
|
|
559
567
|
/**
|
|
560
568
|
* Use this method to set the alarm time. Unlike `trigger`, this time
|
|
561
569
|
* the alarm takes place after the event has started.
|
|
@@ -574,7 +582,7 @@ declare class ICalAlarm {
|
|
|
574
582
|
*
|
|
575
583
|
* @since 0.2.1
|
|
576
584
|
*/
|
|
577
|
-
triggerAfter(trigger: number | ICalDateTimeValue
|
|
585
|
+
triggerAfter(trigger: number | ICalDateTimeValue): this;
|
|
578
586
|
/**
|
|
579
587
|
* Get the trigger time for the alarm. Can either
|
|
580
588
|
* be a date and time value ([[`ICalDateTimeValue`]]) or
|
|
@@ -585,7 +593,7 @@ declare class ICalAlarm {
|
|
|
585
593
|
* @since 0.2.1
|
|
586
594
|
* @alias trigger
|
|
587
595
|
*/
|
|
588
|
-
triggerBefore(trigger: number | ICalDateTimeValue
|
|
596
|
+
triggerBefore(trigger: number | ICalDateTimeValue): this;
|
|
589
597
|
/**
|
|
590
598
|
* Use this method to set the alarm time.
|
|
591
599
|
*
|
|
@@ -605,12 +613,12 @@ declare class ICalAlarm {
|
|
|
605
613
|
* @since 0.2.1
|
|
606
614
|
* @alias trigger
|
|
607
615
|
*/
|
|
608
|
-
triggerBefore(): number | ICalDateTimeValue
|
|
616
|
+
triggerBefore(): number | ICalDateTimeValue;
|
|
609
617
|
/**
|
|
610
618
|
* Get Alarm Repetitions
|
|
611
619
|
* @since 0.2.1
|
|
612
620
|
*/
|
|
613
|
-
repeat():
|
|
621
|
+
repeat(): ICalAlarmRepeatData | null;
|
|
614
622
|
/**
|
|
615
623
|
* Set Alarm Repetitions. Use this to repeat the alarm.
|
|
616
624
|
*
|
|
@@ -620,36 +628,16 @@ declare class ICalAlarm {
|
|
|
620
628
|
*
|
|
621
629
|
* // repeat the alarm 4 times every 5 minutes…
|
|
622
630
|
* cal.createAlarm({
|
|
623
|
-
* repeat:
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
*
|
|
628
|
-
* @since 0.2.1
|
|
629
|
-
*/
|
|
630
|
-
repeat(repeat: number | null): this;
|
|
631
|
-
/**
|
|
632
|
-
* Get Repeat Interval
|
|
633
|
-
* @since 0.2.1
|
|
634
|
-
*/
|
|
635
|
-
interval(interval: number | null): this;
|
|
636
|
-
/**
|
|
637
|
-
* Set Repeat Interval
|
|
638
|
-
*
|
|
639
|
-
* ```javascript
|
|
640
|
-
* const cal = ical();
|
|
641
|
-
* const event = cal.createEvent();
|
|
642
|
-
*
|
|
643
|
-
* // repeat the alarm 4 times every 5 minutes…
|
|
644
|
-
* cal.createAlarm({
|
|
645
|
-
* repeat: 4,
|
|
646
|
-
* interval: 300
|
|
631
|
+
* repeat: {
|
|
632
|
+
* times: 4,
|
|
633
|
+
* interval: 300
|
|
634
|
+
* }
|
|
647
635
|
* });
|
|
648
636
|
* ```
|
|
649
637
|
*
|
|
650
638
|
* @since 0.2.1
|
|
651
639
|
*/
|
|
652
|
-
|
|
640
|
+
repeat(repeat: ICalAlarmRepeatData | null): this;
|
|
653
641
|
/**
|
|
654
642
|
* Get Attachment
|
|
655
643
|
* @since 0.2.1
|
|
@@ -768,11 +756,12 @@ declare class ICalAlarm {
|
|
|
768
756
|
}
|
|
769
757
|
|
|
770
758
|
interface ICalCategoryData {
|
|
771
|
-
name
|
|
759
|
+
name: string;
|
|
772
760
|
}
|
|
773
761
|
interface ICalCategoryInternalData {
|
|
774
|
-
name: string
|
|
762
|
+
name: string;
|
|
775
763
|
}
|
|
764
|
+
type ICalCategoryJSONData = ICalCategoryInternalData;
|
|
776
765
|
/**
|
|
777
766
|
* Usually you get an `ICalCategory` object like this:
|
|
778
767
|
*
|
|
@@ -802,12 +791,12 @@ declare class ICalCategory {
|
|
|
802
791
|
* Get the category name
|
|
803
792
|
* @since 0.3.0
|
|
804
793
|
*/
|
|
805
|
-
name(): string
|
|
794
|
+
name(): string;
|
|
806
795
|
/**
|
|
807
796
|
* Set the category name
|
|
808
797
|
* @since 0.3.0
|
|
809
798
|
*/
|
|
810
|
-
name(name: string
|
|
799
|
+
name(name: string): this;
|
|
811
800
|
/**
|
|
812
801
|
* Return a shallow copy of the category's options for JSON stringification.
|
|
813
802
|
* Can be used for persistence.
|
|
@@ -848,7 +837,7 @@ declare enum ICalEventClass {
|
|
|
848
837
|
interface ICalEventData {
|
|
849
838
|
id?: string | number | null;
|
|
850
839
|
sequence?: number;
|
|
851
|
-
start
|
|
840
|
+
start: ICalDateTimeValue;
|
|
852
841
|
end?: ICalDateTimeValue | null;
|
|
853
842
|
recurrenceId?: ICalDateTimeValue | null;
|
|
854
843
|
timezone?: string | null;
|
|
@@ -880,7 +869,7 @@ interface ICalEventData {
|
|
|
880
869
|
interface ICalEventJSONData {
|
|
881
870
|
id: string;
|
|
882
871
|
sequence: number;
|
|
883
|
-
start: string
|
|
872
|
+
start: string;
|
|
884
873
|
end: string | null;
|
|
885
874
|
recurrenceId: string | null;
|
|
886
875
|
timezone: string | null;
|
|
@@ -986,7 +975,7 @@ declare class ICalEvent {
|
|
|
986
975
|
*
|
|
987
976
|
* @since 0.2.0
|
|
988
977
|
*/
|
|
989
|
-
start(): ICalDateTimeValue
|
|
978
|
+
start(): ICalDateTimeValue;
|
|
990
979
|
/**
|
|
991
980
|
* Set the appointment date of beginning, which is required for all events.
|
|
992
981
|
* You can use any supported date object, see
|
|
@@ -1260,7 +1249,7 @@ declare class ICalEvent {
|
|
|
1260
1249
|
*
|
|
1261
1250
|
* @since 0.2.0
|
|
1262
1251
|
*/
|
|
1263
|
-
createAttendee(data
|
|
1252
|
+
createAttendee(data: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
1264
1253
|
/**
|
|
1265
1254
|
* Get all attendees
|
|
1266
1255
|
* @since 0.2.0
|
|
@@ -1302,7 +1291,7 @@ declare class ICalEvent {
|
|
|
1302
1291
|
*
|
|
1303
1292
|
* @since 0.2.1
|
|
1304
1293
|
*/
|
|
1305
|
-
createAlarm(data
|
|
1294
|
+
createAlarm(data: ICalAlarm | ICalAlarmData): ICalAlarm;
|
|
1306
1295
|
/**
|
|
1307
1296
|
* Get all alarms
|
|
1308
1297
|
* @since 0.2.0
|
|
@@ -1342,7 +1331,7 @@ declare class ICalEvent {
|
|
|
1342
1331
|
*
|
|
1343
1332
|
* @since 0.3.0
|
|
1344
1333
|
*/
|
|
1345
|
-
createCategory(data
|
|
1334
|
+
createCategory(data: ICalCategory | ICalCategoryData): ICalCategory;
|
|
1346
1335
|
/**
|
|
1347
1336
|
* Get all categories
|
|
1348
1337
|
* @since 0.3.0
|
|
@@ -1945,58 +1934,6 @@ declare class ICalCalendar {
|
|
|
1945
1934
|
* @since 2.0.0-develop.1
|
|
1946
1935
|
*/
|
|
1947
1936
|
clear(): this;
|
|
1948
|
-
/**
|
|
1949
|
-
* Save ical file using [`fs/promises`](https://nodejs.org/api/fs.html#fs_fspromises_writefile_file_data_options).
|
|
1950
|
-
* Only works in node.js environments.
|
|
1951
|
-
*
|
|
1952
|
-
* ```javascript
|
|
1953
|
-
* await calendar.save('./calendar.ical');
|
|
1954
|
-
* ```
|
|
1955
|
-
*/
|
|
1956
|
-
save(path: string): Promise<void>;
|
|
1957
|
-
/**
|
|
1958
|
-
* Save ical file with [`fs.writeFile`](http://nodejs.org/api/fs.html#fs_fs_writefile_filename_data_options_callback).
|
|
1959
|
-
* Only works in node.js environments.
|
|
1960
|
-
*
|
|
1961
|
-
* ```javascript
|
|
1962
|
-
* calendar.save('./calendar.ical', err => {
|
|
1963
|
-
* console.log(err);
|
|
1964
|
-
* });
|
|
1965
|
-
* ```
|
|
1966
|
-
*/
|
|
1967
|
-
save(path: string, cb?: (err: NodeJS.ErrnoException | null) => void): this;
|
|
1968
|
-
/**
|
|
1969
|
-
* Save Calendar to disk synchronously using
|
|
1970
|
-
* [fs.writeFileSync](http://nodejs.org/api/fs.html#fs_fs_writefilesync_filename_data_options).
|
|
1971
|
-
* Only works in node.js environments.
|
|
1972
|
-
*
|
|
1973
|
-
* ```javascript
|
|
1974
|
-
* calendar.saveSync('./calendar.ical');
|
|
1975
|
-
* ```
|
|
1976
|
-
*/
|
|
1977
|
-
saveSync(path: string): this;
|
|
1978
|
-
/**
|
|
1979
|
-
* Send calendar to the user when using HTTP using the passed `ServerResponse` object.
|
|
1980
|
-
* Use second parameter `filename` to change the filename, which defaults to `'calendar.ics'`.
|
|
1981
|
-
*
|
|
1982
|
-
* @param response HTTP Response object which is used to send the calendar
|
|
1983
|
-
* @param [filename = 'calendar.ics'] Filename of the calendar file
|
|
1984
|
-
*/
|
|
1985
|
-
serve(response: ServerResponse, filename?: string): this;
|
|
1986
|
-
/**
|
|
1987
|
-
* Generates a blob to use for downloads or to generate a download URL.
|
|
1988
|
-
* Only supported in browsers supporting the Blob API.
|
|
1989
|
-
*
|
|
1990
|
-
* @since 1.9.0
|
|
1991
|
-
*/
|
|
1992
|
-
toBlob(): Blob;
|
|
1993
|
-
/**
|
|
1994
|
-
* Returns a URL to download the ical file. Uses the Blob object internally,
|
|
1995
|
-
* so it's only supported in browsers supporting the Blob API.
|
|
1996
|
-
*
|
|
1997
|
-
* @since 1.9.0
|
|
1998
|
-
*/
|
|
1999
|
-
toURL(): string;
|
|
2000
1937
|
/**
|
|
2001
1938
|
* Set X-* attributes. Woun't filter double attributes,
|
|
2002
1939
|
* which are also added by another method (e.g. busystatus),
|
|
@@ -2137,4 +2074,4 @@ declare function foldLines(input: string): string;
|
|
|
2137
2074
|
*/
|
|
2138
2075
|
declare function ical(data?: ICalCalendarData): ICalCalendar;
|
|
2139
2076
|
|
|
2140
|
-
export { ICalAlarm, ICalAlarmData, ICalAlarmJSONData, ICalAlarmType, ICalAlarmTypeValue, ICalAttachment, ICalAttendee, ICalAttendeeData, ICalAttendeeJSONData, ICalAttendeeRole, ICalAttendeeStatus, ICalAttendeeType, ICalCalendar, ICalCalendarData, ICalCalendarJSONData, ICalCalendarMethod, ICalCalendarProdIdData, ICalCategory, ICalCategoryData, ICalDateTimeValue, ICalDayJsStub, ICalDescription, ICalEvent, ICalEventBusyStatus, ICalEventClass, ICalEventData, ICalEventJSONData, ICalEventRepeatingFreq, ICalEventStatus, ICalEventTransparency, ICalGeo, ICalLocation, ICalLuxonDateTimeStub, ICalMomentDurationStub, ICalMomentStub, ICalMomentTimezoneStub, ICalOrganizer, ICalRRuleStub, ICalRepeatingOptions, ICalTimezone, ICalWeekday, ical as default, escape, foldLines, formatDate, formatDateTZ };
|
|
2077
|
+
export { ICalAlarm, ICalAlarmData, ICalAlarmJSONData, ICalAlarmRepeatData, ICalAlarmType, ICalAlarmTypeValue, ICalAttachment, ICalAttendee, ICalAttendeeData, ICalAttendeeJSONData, ICalAttendeeRole, ICalAttendeeStatus, ICalAttendeeType, ICalCalendar, ICalCalendarData, ICalCalendarJSONData, ICalCalendarMethod, ICalCalendarProdIdData, ICalCategory, ICalCategoryData, ICalCategoryJSONData, ICalDateTimeValue, ICalDayJsStub, ICalDescription, ICalEvent, ICalEventBusyStatus, ICalEventClass, ICalEventData, ICalEventJSONData, ICalEventRepeatingFreq, ICalEventStatus, ICalEventTransparency, ICalGeo, ICalLocation, ICalLuxonDateTimeStub, ICalMomentDurationStub, ICalMomentStub, ICalMomentTimezoneStub, ICalOrganizer, ICalRRuleStub, ICalRepeatingOptions, ICalTimezone, ICalWeekday, ical as default, escape, foldLines, formatDate, formatDateTZ };
|