ical-generator 7.2.0-develop.2 → 7.2.0-develop.4
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.cjs +52 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -52
- package/dist/index.js.map +1 -1
- package/package.json +20 -17
- package/src/alarm.ts +10 -10
- package/src/attendee.ts +13 -13
- package/src/calendar.ts +11 -11
- package/src/event.ts +27 -27
- package/src/tools.ts +3 -12
package/package.json
CHANGED
|
@@ -8,37 +8,40 @@
|
|
|
8
8
|
},
|
|
9
9
|
"description": "ical-generator is a small piece of code which generates ical calendar files",
|
|
10
10
|
"devDependencies": {
|
|
11
|
+
"@eslint/js": "^9.8.0",
|
|
11
12
|
"@qiwi/semantic-release-gh-pages-plugin": "^5.2.12",
|
|
12
|
-
"@sebbo2002/semantic-release-jsr": "^1.0.
|
|
13
|
+
"@sebbo2002/semantic-release-jsr": "^1.0.1",
|
|
13
14
|
"@semantic-release/changelog": "^6.0.3",
|
|
14
15
|
"@semantic-release/exec": "^6.0.3",
|
|
15
16
|
"@semantic-release/git": "^10.0.1",
|
|
16
|
-
"@semantic-release/npm": "^12.0.
|
|
17
|
+
"@semantic-release/npm": "^12.0.1",
|
|
17
18
|
"@touch4it/ical-timezones": "^1.9.0",
|
|
19
|
+
"@types/eslint__js": "^8.42.3",
|
|
20
|
+
"@types/express": "^4.17.21",
|
|
18
21
|
"@types/luxon": "^3.4.2",
|
|
19
|
-
"@types/mocha": "^10.0.
|
|
20
|
-
"@
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"eslint": "^
|
|
25
|
-
"eslint-plugin-jsonc": "^2.14.0",
|
|
22
|
+
"@types/mocha": "^10.0.7",
|
|
23
|
+
"@types/node": "^22.0.0",
|
|
24
|
+
"c8": "^10.1.2",
|
|
25
|
+
"dayjs": "^1.11.12",
|
|
26
|
+
"eslint": "^9.8.0",
|
|
27
|
+
"eslint-plugin-jsonc": "^2.16.0",
|
|
26
28
|
"esm": "^3.2.25",
|
|
27
29
|
"license-checker": "^25.0.1",
|
|
28
30
|
"luxon": "^3.4.4",
|
|
29
|
-
"mocha": "^10.
|
|
31
|
+
"mocha": "^10.6.0",
|
|
30
32
|
"mochawesome": "^7.1.3",
|
|
31
33
|
"moment": "^2.30.1",
|
|
32
34
|
"moment-timezone": "^0.5.45",
|
|
33
|
-
"nyc": "^
|
|
35
|
+
"nyc": "^17.0.0",
|
|
34
36
|
"rrule": "^2.8.1",
|
|
35
|
-
"semantic-release": "^
|
|
37
|
+
"semantic-release": "^24.0.0",
|
|
36
38
|
"semantic-release-license": "^1.0.2",
|
|
37
39
|
"source-map-support": "^0.5.21",
|
|
38
40
|
"ts-node": "^10.9.2",
|
|
39
|
-
"tsup": "^8.
|
|
40
|
-
"typedoc": "^0.
|
|
41
|
-
"typescript": "^5.4
|
|
41
|
+
"tsup": "^8.2.3",
|
|
42
|
+
"typedoc": "^0.26.3",
|
|
43
|
+
"typescript": "^5.5.4",
|
|
44
|
+
"typescript-eslint": "^8.0.0-alpha.41"
|
|
42
45
|
},
|
|
43
46
|
"engines": {
|
|
44
47
|
"node": ">=18.0.0"
|
|
@@ -121,10 +124,10 @@
|
|
|
121
124
|
"develop": "TS_NODE_TRANSPILE_ONLY=true node --no-warnings --enable-source-maps --loader ts-node/esm src/bin/start.ts",
|
|
122
125
|
"example": "node ./dist/examples/push.js",
|
|
123
126
|
"license-check": "license-checker --production --summary",
|
|
124
|
-
"lint": "eslint .
|
|
127
|
+
"lint": "eslint .",
|
|
125
128
|
"start": "node ./dist/bin/start.js",
|
|
126
129
|
"test": "mocha"
|
|
127
130
|
},
|
|
128
131
|
"type": "module",
|
|
129
|
-
"version": "7.2.0-develop.
|
|
132
|
+
"version": "7.2.0-develop.4"
|
|
130
133
|
}
|
package/src/alarm.ts
CHANGED
|
@@ -135,16 +135,16 @@ export default class ICalAlarm {
|
|
|
135
135
|
throw new Error('`event` option required!');
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
data.type !== undefined
|
|
139
|
-
'trigger' in data && data.trigger !== undefined
|
|
140
|
-
'triggerBefore' in data && data.triggerBefore !== undefined
|
|
141
|
-
'triggerAfter' in data && data.triggerAfter !== undefined
|
|
142
|
-
data.repeat
|
|
143
|
-
data.attach !== undefined
|
|
144
|
-
data.description !== undefined
|
|
145
|
-
data.summary !== undefined
|
|
146
|
-
data.attendees !== undefined
|
|
147
|
-
data.x !== undefined
|
|
138
|
+
if (data.type !== undefined) this.type(data.type);
|
|
139
|
+
if ('trigger' in data && data.trigger !== undefined) this.trigger(data.trigger);
|
|
140
|
+
if ('triggerBefore' in data && data.triggerBefore !== undefined) this.triggerBefore(data.triggerBefore);
|
|
141
|
+
if ('triggerAfter' in data && data.triggerAfter !== undefined) this.triggerAfter(data.triggerAfter);
|
|
142
|
+
if (data.repeat) this.repeat(data.repeat);
|
|
143
|
+
if (data.attach !== undefined) this.attach(data.attach);
|
|
144
|
+
if (data.description !== undefined) this.description(data.description);
|
|
145
|
+
if (data.summary !== undefined) this.summary(data.summary);
|
|
146
|
+
if (data.attendees !== undefined) this.attendees(data.attendees);
|
|
147
|
+
if (data.x !== undefined) this.x(data.x);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
|
package/src/attendee.ts
CHANGED
|
@@ -126,19 +126,19 @@ export default class ICalAttendee {
|
|
|
126
126
|
throw new Error('No value for `email` in ICalAttendee given!');
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
data.name !== undefined
|
|
130
|
-
data.email !== undefined
|
|
131
|
-
data.mailto !== undefined
|
|
132
|
-
data.sentBy !== undefined
|
|
133
|
-
data.status !== undefined
|
|
134
|
-
data.role !== undefined
|
|
135
|
-
data.rsvp !== undefined
|
|
136
|
-
data.type !== undefined
|
|
137
|
-
data.delegatedTo !== undefined
|
|
138
|
-
data.delegatedFrom !== undefined
|
|
139
|
-
data.delegatesTo
|
|
140
|
-
data.delegatesFrom
|
|
141
|
-
data.x !== undefined
|
|
129
|
+
if (data.name !== undefined) this.name(data.name);
|
|
130
|
+
if (data.email !== undefined) this.email(data.email);
|
|
131
|
+
if (data.mailto !== undefined) this.mailto(data.mailto);
|
|
132
|
+
if (data.sentBy !== undefined) this.sentBy(data.sentBy);
|
|
133
|
+
if (data.status !== undefined) this.status(data.status);
|
|
134
|
+
if (data.role !== undefined) this.role(data.role);
|
|
135
|
+
if (data.rsvp !== undefined) this.rsvp(data.rsvp);
|
|
136
|
+
if (data.type !== undefined) this.type(data.type);
|
|
137
|
+
if (data.delegatedTo !== undefined) this.delegatedTo(data.delegatedTo);
|
|
138
|
+
if (data.delegatedFrom !== undefined) this.delegatedFrom(data.delegatedFrom);
|
|
139
|
+
if (data.delegatesTo) this.delegatesTo(data.delegatesTo);
|
|
140
|
+
if (data.delegatesFrom) this.delegatesFrom(data.delegatesFrom);
|
|
141
|
+
if (data.x !== undefined) this.x(data.x);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
|
package/src/calendar.ts
CHANGED
|
@@ -137,17 +137,17 @@ export default class ICalCalendar {
|
|
|
137
137
|
x: []
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
data.prodId !== undefined
|
|
141
|
-
data.method !== undefined
|
|
142
|
-
data.name !== undefined
|
|
143
|
-
data.description !== undefined
|
|
144
|
-
data.timezone !== undefined
|
|
145
|
-
data.source !== undefined
|
|
146
|
-
data.url !== undefined
|
|
147
|
-
data.scale !== undefined
|
|
148
|
-
data.ttl !== undefined
|
|
149
|
-
data.events !== undefined
|
|
150
|
-
data.x !== undefined
|
|
140
|
+
if (data.prodId !== undefined) this.prodId(data.prodId);
|
|
141
|
+
if (data.method !== undefined) this.method(data.method);
|
|
142
|
+
if (data.name !== undefined) this.name(data.name);
|
|
143
|
+
if (data.description !== undefined) this.description(data.description);
|
|
144
|
+
if (data.timezone !== undefined) this.timezone(data.timezone);
|
|
145
|
+
if (data.source !== undefined) this.source(data.source);
|
|
146
|
+
if (data.url !== undefined) this.url(data.url);
|
|
147
|
+
if (data.scale !== undefined) this.scale(data.scale);
|
|
148
|
+
if (data.ttl !== undefined) this.ttl(data.ttl);
|
|
149
|
+
if (data.events !== undefined) this.events(data.events);
|
|
150
|
+
if (data.x !== undefined) this.x(data.x);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
|
package/src/event.ts
CHANGED
|
@@ -212,33 +212,33 @@ export default class ICalEvent {
|
|
|
212
212
|
throw new Error('`calendar` option required!');
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
data.id
|
|
216
|
-
data.sequence !== undefined
|
|
217
|
-
data.start
|
|
218
|
-
data.end !== undefined
|
|
219
|
-
data.recurrenceId !== undefined
|
|
220
|
-
data.timezone !== undefined
|
|
221
|
-
data.stamp !== undefined
|
|
222
|
-
data.allDay !== undefined
|
|
223
|
-
data.floating !== undefined
|
|
224
|
-
data.repeating !== undefined
|
|
225
|
-
data.summary !== undefined
|
|
226
|
-
data.location !== undefined
|
|
227
|
-
data.description !== undefined
|
|
228
|
-
data.organizer !== undefined
|
|
229
|
-
data.attendees !== undefined
|
|
230
|
-
data.alarms !== undefined
|
|
231
|
-
data.categories !== undefined
|
|
232
|
-
data.status !== undefined
|
|
233
|
-
data.busystatus !== undefined
|
|
234
|
-
data.priority !== undefined
|
|
235
|
-
data.url !== undefined
|
|
236
|
-
data.attachments !== undefined
|
|
237
|
-
data.transparency !== undefined
|
|
238
|
-
data.created !== undefined
|
|
239
|
-
data.lastModified !== undefined
|
|
240
|
-
data.class !== undefined
|
|
241
|
-
data.x !== undefined
|
|
215
|
+
if (data.id) this.id(data.id);
|
|
216
|
+
if (data.sequence !== undefined) this.sequence(data.sequence);
|
|
217
|
+
if (data.start) this.start(data.start);
|
|
218
|
+
if (data.end !== undefined) this.end(data.end);
|
|
219
|
+
if (data.recurrenceId !== undefined) this.recurrenceId(data.recurrenceId);
|
|
220
|
+
if (data.timezone !== undefined) this.timezone(data.timezone);
|
|
221
|
+
if (data.stamp !== undefined) this.stamp(data.stamp);
|
|
222
|
+
if (data.allDay !== undefined) this.allDay(data.allDay);
|
|
223
|
+
if (data.floating !== undefined) this.floating(data.floating);
|
|
224
|
+
if (data.repeating !== undefined) this.repeating(data.repeating);
|
|
225
|
+
if (data.summary !== undefined) this.summary(data.summary);
|
|
226
|
+
if (data.location !== undefined) this.location(data.location);
|
|
227
|
+
if (data.description !== undefined) this.description(data.description);
|
|
228
|
+
if (data.organizer !== undefined) this.organizer(data.organizer);
|
|
229
|
+
if (data.attendees !== undefined) this.attendees(data.attendees);
|
|
230
|
+
if (data.alarms !== undefined) this.alarms(data.alarms);
|
|
231
|
+
if (data.categories !== undefined) this.categories(data.categories);
|
|
232
|
+
if (data.status !== undefined) this.status(data.status);
|
|
233
|
+
if (data.busystatus !== undefined) this.busystatus(data.busystatus);
|
|
234
|
+
if (data.priority !== undefined) this.priority(data.priority);
|
|
235
|
+
if (data.url !== undefined) this.url(data.url);
|
|
236
|
+
if (data.attachments !== undefined) this.attachments(data.attachments);
|
|
237
|
+
if (data.transparency !== undefined) this.transparency(data.transparency);
|
|
238
|
+
if (data.created !== undefined) this.created(data.created);
|
|
239
|
+
if (data.lastModified !== undefined) this.lastModified(data.lastModified);
|
|
240
|
+
if (data.class !== undefined) this.class(data.class);
|
|
241
|
+
if (data.x !== undefined) this.x(data.x);
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
/**
|
package/src/tools.ts
CHANGED
|
@@ -76,17 +76,13 @@ export function formatDate (timezone: string | null, d: ICalDateTimeValue, dateo
|
|
|
76
76
|
|
|
77
77
|
let m = d;
|
|
78
78
|
if(timezone) {
|
|
79
|
-
// @see https://day.js.org/docs/en/plugin/timezone
|
|
80
|
-
// @ts-ignore
|
|
81
79
|
m = typeof d.tz === 'function' ? d.tz(timezone) : d;
|
|
82
80
|
}
|
|
83
81
|
else if(floating) {
|
|
84
82
|
// m = d;
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
// @ts-ignore
|
|
88
85
|
else if (typeof d.utc === 'function') {
|
|
89
|
-
// @ts-ignore
|
|
90
86
|
m = d.utc();
|
|
91
87
|
}
|
|
92
88
|
else {
|
|
@@ -314,7 +310,6 @@ export function toDate(value: ICalDateTimeValue): Date {
|
|
|
314
310
|
return new Date(value);
|
|
315
311
|
}
|
|
316
312
|
|
|
317
|
-
// @ts-ignore
|
|
318
313
|
if(isLuxonDate(value)) {
|
|
319
314
|
return value.toJSDate();
|
|
320
315
|
}
|
|
@@ -324,7 +319,7 @@ export function toDate(value: ICalDateTimeValue): Date {
|
|
|
324
319
|
|
|
325
320
|
export function isMoment(value: ICalDateTimeValue): value is ICalMomentStub {
|
|
326
321
|
|
|
327
|
-
// @ts-
|
|
322
|
+
// @ts-expect-error _isAMomentObject is a private property
|
|
328
323
|
return value != null && value._isAMomentObject != null;
|
|
329
324
|
}
|
|
330
325
|
export function isMomentTZ(value: ICalDateTimeValue): value is ICalMomentTimezoneStub {
|
|
@@ -342,15 +337,11 @@ export function isLuxonDate(value: ICalDateTimeValue): value is ICalLuxonDateTim
|
|
|
342
337
|
}
|
|
343
338
|
|
|
344
339
|
export function isMomentDuration(value: unknown): value is ICalMomentDurationStub {
|
|
345
|
-
|
|
346
|
-
// @ts-ignore
|
|
347
|
-
return value !== null && typeof value === 'object' && typeof value.asSeconds === 'function';
|
|
340
|
+
return value !== null && typeof value === 'object' && 'asSeconds' in value && typeof value.asSeconds === 'function';
|
|
348
341
|
}
|
|
349
342
|
|
|
350
343
|
export function isRRule(value: unknown): value is ICalRRuleStub {
|
|
351
|
-
|
|
352
|
-
// @ts-ignore
|
|
353
|
-
return value !== null && typeof value === 'object' && typeof value.between === 'function' && typeof value.toString === 'function';
|
|
344
|
+
return value !== null && typeof value === 'object' && 'between' in value && typeof value.between === 'function' && typeof value.toString === 'function';
|
|
354
345
|
}
|
|
355
346
|
|
|
356
347
|
export function toJSON(value: ICalDateTimeValue | null | undefined): string | null | undefined {
|