ical-generator 9.0.0-develop.1 → 9.0.0-develop.3
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 +20 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -5
- package/src/attendee.ts +59 -3
- package/src/event.ts +1 -3
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
"bugs": {
|
|
4
4
|
"url": "http://github.com/sebbo2002/ical-generator/issues"
|
|
5
5
|
},
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"uuid-random": "^1.3.2"
|
|
8
|
-
},
|
|
9
6
|
"description": "ical-generator is a small piece of code which generates ical calendar files",
|
|
10
7
|
"devDependencies": {
|
|
11
8
|
"@eslint/js": "^9.25.0",
|
|
@@ -47,7 +44,7 @@
|
|
|
47
44
|
"typescript-eslint": "^8.29.0"
|
|
48
45
|
},
|
|
49
46
|
"engines": {
|
|
50
|
-
"node": "
|
|
47
|
+
"node": "20 || >=22.0.0"
|
|
51
48
|
},
|
|
52
49
|
"exports": {
|
|
53
50
|
"import": "./dist/index.js",
|
|
@@ -132,5 +129,5 @@
|
|
|
132
129
|
"test": "mocha"
|
|
133
130
|
},
|
|
134
131
|
"type": "module",
|
|
135
|
-
"version": "9.0.0-develop.
|
|
132
|
+
"version": "9.0.0-develop.3"
|
|
136
133
|
}
|
package/src/attendee.ts
CHANGED
|
@@ -17,6 +17,13 @@ export enum ICalAttendeeRole {
|
|
|
17
17
|
REQ = 'REQ-PARTICIPANT',
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// ref: https://datatracker.ietf.org/doc/html/rfc6638#section-7.1
|
|
21
|
+
export enum ICalAttendeeScheduleAgent {
|
|
22
|
+
CLIENT = 'CLIENT',
|
|
23
|
+
NONE = 'NONE',
|
|
24
|
+
SERVER = 'SERVER',
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
export enum ICalAttendeeStatus {
|
|
21
28
|
ACCEPTED = 'ACCEPTED',
|
|
22
29
|
DECLINED = 'DECLINED',
|
|
@@ -33,7 +40,6 @@ export enum ICalAttendeeType {
|
|
|
33
40
|
ROOM = 'ROOM',
|
|
34
41
|
UNKNOWN = 'UNKNOWN',
|
|
35
42
|
}
|
|
36
|
-
|
|
37
43
|
export interface ICalAttendeeData {
|
|
38
44
|
delegatedFrom?: ICalAttendee | ICalAttendeeData | null | string;
|
|
39
45
|
delegatedTo?: ICalAttendee | ICalAttendeeData | null | string;
|
|
@@ -44,6 +50,7 @@ export interface ICalAttendeeData {
|
|
|
44
50
|
name?: null | string;
|
|
45
51
|
role?: ICalAttendeeRole;
|
|
46
52
|
rsvp?: boolean | null;
|
|
53
|
+
scheduleAgent?: ICalAttendeeScheduleAgent | ICalXName | null;
|
|
47
54
|
sentBy?: null | string;
|
|
48
55
|
status?: ICalAttendeeStatus | null;
|
|
49
56
|
type?: ICalAttendeeType | null;
|
|
@@ -67,6 +74,8 @@ export interface ICalAttendeeJSONData {
|
|
|
67
74
|
x: { key: string; value: string }[];
|
|
68
75
|
}
|
|
69
76
|
|
|
77
|
+
export type ICalXName = `X-${string}`;
|
|
78
|
+
|
|
70
79
|
interface ICalInternalAttendeeData {
|
|
71
80
|
delegatedFrom: ICalAttendee | null;
|
|
72
81
|
delegatedTo: ICalAttendee | null;
|
|
@@ -75,6 +84,7 @@ interface ICalInternalAttendeeData {
|
|
|
75
84
|
name: null | string;
|
|
76
85
|
role: ICalAttendeeRole;
|
|
77
86
|
rsvp: boolean | null;
|
|
87
|
+
scheduleAgent: ICalAttendeeScheduleAgent | ICalXName | null;
|
|
78
88
|
sentBy: null | string;
|
|
79
89
|
status: ICalAttendeeStatus | null;
|
|
80
90
|
type: ICalAttendeeType | null;
|
|
@@ -119,6 +129,7 @@ export default class ICalAttendee {
|
|
|
119
129
|
name: null,
|
|
120
130
|
role: ICalAttendeeRole.REQ,
|
|
121
131
|
rsvp: null,
|
|
132
|
+
scheduleAgent: null,
|
|
122
133
|
sentBy: null,
|
|
123
134
|
status: null,
|
|
124
135
|
type: null,
|
|
@@ -145,6 +156,8 @@ export default class ICalAttendee {
|
|
|
145
156
|
this.delegatedFrom(data.delegatedFrom);
|
|
146
157
|
if (data.delegatesTo) this.delegatesTo(data.delegatesTo);
|
|
147
158
|
if (data.delegatesFrom) this.delegatesFrom(data.delegatesFrom);
|
|
159
|
+
if (data.scheduleAgent !== undefined)
|
|
160
|
+
this.scheduleAgent(data.scheduleAgent);
|
|
148
161
|
if (data.x !== undefined) this.x(data.x);
|
|
149
162
|
}
|
|
150
163
|
|
|
@@ -402,6 +415,46 @@ export default class ICalAttendee {
|
|
|
402
415
|
this.data.rsvp = Boolean(rsvp);
|
|
403
416
|
return this;
|
|
404
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Get attendee's schedule agent
|
|
420
|
+
* @since 9.0.0
|
|
421
|
+
*/
|
|
422
|
+
scheduleAgent(): ICalAttendeeScheduleAgent | ICalXName;
|
|
423
|
+
/**
|
|
424
|
+
* Set attendee's schedule agent
|
|
425
|
+
* See {@link ICalAttendeeScheduleAgent} for available values.
|
|
426
|
+
* You can also use custom X-* values.
|
|
427
|
+
*
|
|
428
|
+
* @since 9.0.0
|
|
429
|
+
*/
|
|
430
|
+
scheduleAgent(
|
|
431
|
+
scheduleAgent: ICalAttendeeScheduleAgent | ICalXName | null,
|
|
432
|
+
): this;
|
|
433
|
+
scheduleAgent(
|
|
434
|
+
scheduleAgent?: ICalAttendeeScheduleAgent | ICalXName | null,
|
|
435
|
+
): ICalAttendeeScheduleAgent | ICalXName | null | this {
|
|
436
|
+
if (scheduleAgent === undefined) {
|
|
437
|
+
return this.data.scheduleAgent;
|
|
438
|
+
}
|
|
439
|
+
if (!scheduleAgent) {
|
|
440
|
+
this.data.scheduleAgent = null;
|
|
441
|
+
return this;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (
|
|
445
|
+
typeof scheduleAgent == 'string' &&
|
|
446
|
+
scheduleAgent.toUpperCase().startsWith('X-')
|
|
447
|
+
) {
|
|
448
|
+
this.data.scheduleAgent = scheduleAgent as string as ICalXName;
|
|
449
|
+
return this;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
this.data.scheduleAgent = checkEnum(
|
|
453
|
+
ICalAttendeeScheduleAgent,
|
|
454
|
+
scheduleAgent,
|
|
455
|
+
) as ICalAttendeeScheduleAgent;
|
|
456
|
+
return this;
|
|
457
|
+
}
|
|
405
458
|
/**
|
|
406
459
|
* Get the acting user's email adress
|
|
407
460
|
* @since 3.3.0
|
|
@@ -462,7 +515,6 @@ export default class ICalAttendee {
|
|
|
462
515
|
x: this.x(),
|
|
463
516
|
});
|
|
464
517
|
}
|
|
465
|
-
|
|
466
518
|
/**
|
|
467
519
|
* Return generated attendee as a string.
|
|
468
520
|
*
|
|
@@ -520,6 +572,11 @@ export default class ICalAttendee {
|
|
|
520
572
|
g += ';EMAIL=' + escape(this.data.email, false);
|
|
521
573
|
}
|
|
522
574
|
|
|
575
|
+
// SCHEDULE-AGENT
|
|
576
|
+
if (this.data.scheduleAgent) {
|
|
577
|
+
g += ';SCHEDULE-AGENT=' + this.data.scheduleAgent;
|
|
578
|
+
}
|
|
579
|
+
|
|
523
580
|
// CUSTOM X ATTRIBUTES
|
|
524
581
|
if (this.data.x.length) {
|
|
525
582
|
g +=
|
|
@@ -564,7 +621,6 @@ export default class ICalAttendee {
|
|
|
564
621
|
this.data.type = checkEnum(ICalAttendeeType, type) as ICalAttendeeType;
|
|
565
622
|
return this;
|
|
566
623
|
}
|
|
567
|
-
|
|
568
624
|
/**
|
|
569
625
|
* Set X-* attributes. Woun't filter double attributes,
|
|
570
626
|
* which are also added by another method (e.g. status),
|
package/src/event.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import uuid from 'uuid-random';
|
|
4
|
-
|
|
5
3
|
import ICalAlarm, { type ICalAlarmData } from './alarm.ts';
|
|
6
4
|
import ICalAttendee, { type ICalAttendeeData } from './attendee.ts';
|
|
7
5
|
import ICalCalendar from './calendar.ts';
|
|
@@ -191,7 +189,7 @@ export default class ICalEvent {
|
|
|
191
189
|
description: null,
|
|
192
190
|
end: null,
|
|
193
191
|
floating: false,
|
|
194
|
-
id:
|
|
192
|
+
id: crypto.randomUUID(),
|
|
195
193
|
lastModified: null,
|
|
196
194
|
location: null,
|
|
197
195
|
organizer: null,
|