ical-generator 8.1.2-develop.9 → 9.0.0-develop.2

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/src/types.ts CHANGED
@@ -1,35 +1,49 @@
1
+ export enum ICalEventRepeatingFreq {
2
+ DAILY = 'DAILY',
3
+ HOURLY = 'HOURLY',
4
+ MINUTELY = 'MINUTELY',
5
+ MONTHLY = 'MONTHLY',
6
+ SECONDLY = 'SECONDLY',
7
+ WEEKLY = 'WEEKLY',
8
+ YEARLY = 'YEARLY',
9
+ }
10
+
11
+ export enum ICalWeekday {
12
+ FR = 'FR',
13
+ MO = 'MO',
14
+ SA = 'SA',
15
+ SU = 'SU',
16
+ TH = 'TH',
17
+ TU = 'TU',
18
+ WE = 'WE',
19
+ }
20
+
1
21
  /**
2
22
  * ical-generator supports [native Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date),
3
23
  * [moment.js](https://momentjs.com/) (and [moment-timezone](https://momentjs.com/timezone/), [Day.js](https://day.js.org/en/) and
4
24
  * [Luxon](https://moment.github.io/luxon/)'s [DateTime](https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html)
5
25
  * objects. You can also pass a string which is then passed to javascript's Date internally.
6
26
  */
7
- export type ICalDateTimeValue = Date | ICalMomentStub | ICalMomentTimezoneStub | ICalLuxonDateTimeStub | ICalDayJsStub | string;
27
+ export type ICalDateTimeValue =
28
+ | Date
29
+ | ICalDayJsStub
30
+ | ICalLuxonDateTimeStub
31
+ | ICalMomentStub
32
+ | ICalMomentTimezoneStub
33
+ | string;
8
34
 
9
- export interface ICalRepeatingOptions {
10
- freq: ICalEventRepeatingFreq;
11
- count?: number;
12
- interval?: number;
13
- until?: ICalDateTimeValue;
14
- byDay?: ICalWeekday[] | ICalWeekday;
15
- byMonth?: number[] | number;
16
- byMonthDay?: number[] | number;
17
- bySetPos?: number[] | number;
18
- exclude?: ICalDateTimeValue[] | ICalDateTimeValue;
19
- startOfWeek?: ICalWeekday;
20
- }
21
-
22
- export type ICalLocation = ICalLocationWithTitle | ICalLocationWithoutTitle;
23
-
24
- export interface ICalLocationWithTitle {
25
- title: string;
26
- address?: string;
27
- radius?: number;
28
- geo?: ICalGeo;
35
+ export interface ICalDayJsStub {
36
+ format(format?: string): string;
37
+ isValid(): boolean;
38
+ toDate(): Date;
39
+ toJSON(): string;
40
+ tz(zone?: string): ICalDayJsStub;
41
+ utc(): ICalDayJsStub;
29
42
  }
30
43
 
31
- export interface ICalLocationWithoutTitle {
32
- geo: ICalGeo;
44
+ export interface ICalDescription {
45
+ html?: string;
46
+ plain: string;
33
47
  }
34
48
 
35
49
  export interface ICalGeo {
@@ -37,82 +51,79 @@ export interface ICalGeo {
37
51
  lon: number;
38
52
  }
39
53
 
40
- export interface ICalOrganizer {
41
- name: string;
42
- email?: string;
43
- mailto?: string;
44
- sentBy?: string;
54
+ export type ICalLocation = ICalLocationWithoutTitle | ICalLocationWithTitle;
55
+
56
+ export interface ICalLocationWithoutTitle {
57
+ geo: ICalGeo;
45
58
  }
46
59
 
47
- export interface ICalDescription {
48
- plain: string;
49
- html?: string;
60
+ export interface ICalLocationWithTitle {
61
+ address?: string;
62
+ geo?: ICalGeo;
63
+ radius?: number;
64
+ title: string;
50
65
  }
51
66
 
52
- export interface ICalTimezone {
53
- name: string | null;
54
- generator?: (timezone: string) => string|null;
67
+ export interface ICalLuxonDateTimeStub {
68
+ get isValid(): boolean;
69
+ setZone(zone?: string): ICalLuxonDateTimeStub;
70
+ toFormat(fmt: string): string;
71
+ toJSDate(): Date;
72
+ toJSON(): null | string;
73
+ zone: { type: string };
74
+ }
75
+
76
+ export interface ICalMomentDurationStub {
77
+ asSeconds(): number;
55
78
  }
56
79
 
57
80
  export interface ICalMomentStub {
58
- format(format?: string): string;
59
81
  clone(): ICalMomentStub;
60
- utc(): ICalMomentStub;
61
- toDate(): Date;
82
+ format(format?: string): string;
62
83
  isValid(): boolean;
84
+ toDate(): Date;
63
85
  toJSON(): string;
86
+ utc(): ICalMomentStub;
64
87
  }
65
88
 
66
89
  export interface ICalMomentTimezoneStub extends ICalMomentStub {
67
90
  clone(): ICalMomentTimezoneStub;
68
- utc(): ICalMomentTimezoneStub;
69
91
  tz(): string | undefined;
70
92
  tz(timezone: string): ICalMomentTimezoneStub;
93
+ utc(): ICalMomentTimezoneStub;
71
94
  }
72
95
 
73
- export interface ICalMomentDurationStub {
74
- asSeconds(): number;
75
- }
76
-
77
- export interface ICalLuxonDateTimeStub {
78
- setZone(zone?: string): ICalLuxonDateTimeStub;
79
- zone: { type: string; };
80
- toFormat(fmt: string): string;
81
- toJSDate(): Date;
82
- get isValid(): boolean;
83
- toJSON(): string | null;
96
+ export interface ICalOrganizer {
97
+ email?: string;
98
+ mailto?: string;
99
+ name: string;
100
+ sentBy?: string;
84
101
  }
85
102
 
86
- export interface ICalDayJsStub {
87
- tz(zone?: string): ICalDayJsStub;
88
- utc(): ICalDayJsStub;
89
- format(format?: string): string;
90
- toDate(): Date;
91
- isValid(): boolean;
92
- toJSON(): string;
103
+ export interface ICalRepeatingOptions {
104
+ byDay?: ICalWeekday | ICalWeekday[];
105
+ byMonth?: number | number[];
106
+ byMonthDay?: number | number[];
107
+ bySetPos?: number | number[];
108
+ count?: number;
109
+ exclude?: ICalDateTimeValue | ICalDateTimeValue[];
110
+ freq: ICalEventRepeatingFreq;
111
+ interval?: number;
112
+ startOfWeek?: ICalWeekday;
113
+ until?: ICalDateTimeValue;
93
114
  }
94
115
 
95
116
  export interface ICalRRuleStub {
96
- between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
117
+ between(
118
+ after: Date,
119
+ before: Date,
120
+ inc?: boolean,
121
+ iterator?: (d: Date, len: number) => boolean,
122
+ ): Date[];
97
123
  toString(): string;
98
124
  }
99
125
 
100
- export enum ICalEventRepeatingFreq {
101
- SECONDLY = 'SECONDLY',
102
- MINUTELY = 'MINUTELY',
103
- HOURLY = 'HOURLY',
104
- DAILY = 'DAILY',
105
- WEEKLY = 'WEEKLY',
106
- MONTHLY = 'MONTHLY',
107
- YEARLY = 'YEARLY'
108
- }
109
-
110
- export enum ICalWeekday {
111
- SU = 'SU',
112
- MO = 'MO',
113
- TU = 'TU',
114
- WE = 'WE',
115
- TH = 'TH',
116
- FR = 'FR',
117
- SA = 'SA'
126
+ export interface ICalTimezone {
127
+ generator?: (timezone: string) => null | string;
128
+ name: null | string;
118
129
  }