@hebcal/icalendar 7.0.5 → 7.0.6
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/foldLine.js +1 -3
- package/dist/icalendar.d.ts +2 -2
- package/dist/icalendar.js +32 -26
- package/dist/pkgVersion.d.ts +1 -1
- package/dist/pkgVersion.js +1 -1
- package/package.json +7 -7
package/dist/foldLine.js
CHANGED
|
@@ -49,9 +49,7 @@ export function foldLine(line) {
|
|
|
49
49
|
// lineBytes/74 of them, so we ask it about those offsets via
|
|
50
50
|
// `containing()` rather than iterating every cluster in the line --
|
|
51
51
|
// the same fold points for a fraction of the work.
|
|
52
|
-
|
|
53
|
-
foldSegmenter = new Intl.Segmenter('en', { granularity: 'grapheme' });
|
|
54
|
-
}
|
|
52
|
+
foldSegmenter ??= new Intl.Segmenter('en', { granularity: 'grapheme' });
|
|
55
53
|
const segments = foldSegmenter.segment(line);
|
|
56
54
|
const parts = [];
|
|
57
55
|
const n = line.length;
|
package/dist/icalendar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Event } from '@hebcal/core/dist/esm/event';
|
|
2
|
-
import { CalOptions } from '@hebcal/core/dist/esm/CalOptions';
|
|
1
|
+
import type { Event } from '@hebcal/core/dist/esm/event';
|
|
2
|
+
import type { CalOptions } from '@hebcal/core/dist/esm/CalOptions';
|
|
3
3
|
export type ICalEventOptions = {
|
|
4
4
|
dtstamp?: string;
|
|
5
5
|
sequence?: number;
|
package/dist/icalendar.js
CHANGED
|
@@ -26,6 +26,14 @@ const CATEGORY = {
|
|
|
26
26
|
user: 'Personal',
|
|
27
27
|
zmanim: null,
|
|
28
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Narrows `isDate()` from `@hebcal/hdate` (which returns a plain boolean)
|
|
31
|
+
* into a type guard.
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
function isDateObj(obj) {
|
|
35
|
+
return isDate(obj);
|
|
36
|
+
}
|
|
29
37
|
/**
|
|
30
38
|
* @private
|
|
31
39
|
*/
|
|
@@ -51,7 +59,7 @@ function appendTrackingToUrl(url, options) {
|
|
|
51
59
|
}
|
|
52
60
|
const utmMedium = options.utmMedium || 'icalendar';
|
|
53
61
|
const utmCampaign = options.utmCampaign;
|
|
54
|
-
return appendIsraelAndTracking(url, options.il, utmSource, utmMedium, utmCampaign);
|
|
62
|
+
return appendIsraelAndTracking(url, Boolean(options.il), utmSource, utmMedium, utmCampaign);
|
|
55
63
|
}
|
|
56
64
|
/** Formats a date-time string as `YYYYMMDDTHHMMSS` */
|
|
57
65
|
function rfc5545DateTime(dt, hour, minute) {
|
|
@@ -111,7 +119,6 @@ export class IcalEvent {
|
|
|
111
119
|
const opts = { ...options };
|
|
112
120
|
this.options = opts;
|
|
113
121
|
this.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
122
|
const ev0 = ev;
|
|
116
123
|
if (typeof ev0.sequence === 'number') {
|
|
117
124
|
this.sequence = ev0.sequence;
|
|
@@ -181,8 +188,7 @@ export class IcalEvent {
|
|
|
181
188
|
}
|
|
182
189
|
this.subj = subj;
|
|
183
190
|
this.category =
|
|
184
|
-
ev0.category ||
|
|
185
|
-
(CATEGORY[getEventCategories(ev)?.[0]] ?? null);
|
|
191
|
+
ev0.category || (CATEGORY[getEventCategories(ev)[0]] ?? null);
|
|
186
192
|
}
|
|
187
193
|
getAlarm() {
|
|
188
194
|
const ev = this.ev;
|
|
@@ -190,11 +196,12 @@ export class IcalEvent {
|
|
|
190
196
|
if (typeof evAlarm === 'string') {
|
|
191
197
|
return 'TRIGGER:' + evAlarm;
|
|
192
198
|
}
|
|
193
|
-
else if (
|
|
199
|
+
else if (evAlarm === false) {
|
|
194
200
|
return null;
|
|
195
201
|
}
|
|
196
|
-
else if (
|
|
197
|
-
|
|
202
|
+
else if (isDateObj(evAlarm)) {
|
|
203
|
+
// copy so we don't mutate the caller's Date
|
|
204
|
+
const alarmDt = new Date(evAlarm);
|
|
198
205
|
alarmDt.setSeconds(0);
|
|
199
206
|
return 'TRIGGER;VALUE=DATE-TIME:' + IcalEvent.makeDtstamp(alarmDt);
|
|
200
207
|
}
|
|
@@ -210,20 +217,21 @@ export class IcalEvent {
|
|
|
210
217
|
return null;
|
|
211
218
|
}
|
|
212
219
|
getUid() {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return uid;
|
|
220
|
+
const ev = this.ev;
|
|
221
|
+
if (ev.uid) {
|
|
222
|
+
return ev.uid;
|
|
217
223
|
}
|
|
218
|
-
const digest = murmur32HexSync(
|
|
219
|
-
uid = `hebcal-${this.isoDateOnly}-${digest}`;
|
|
224
|
+
const digest = murmur32HexSync(ev.getDesc());
|
|
225
|
+
let uid = `hebcal-${this.isoDateOnly}-${digest}`;
|
|
220
226
|
const loc = this.options.location;
|
|
221
227
|
if (this.timed && loc) {
|
|
222
|
-
|
|
223
|
-
|
|
228
|
+
const geoId = loc.getGeoId();
|
|
229
|
+
const name = loc.getName();
|
|
230
|
+
if (geoId) {
|
|
231
|
+
uid += `-${geoId}`;
|
|
224
232
|
}
|
|
225
|
-
else if (
|
|
226
|
-
uid += '-' + makeAnchor(
|
|
233
|
+
else if (name) {
|
|
234
|
+
uid += '-' + makeAnchor(name);
|
|
227
235
|
}
|
|
228
236
|
}
|
|
229
237
|
return uid;
|
|
@@ -231,21 +239,19 @@ export class IcalEvent {
|
|
|
231
239
|
getLongLines() {
|
|
232
240
|
if (this.lines)
|
|
233
241
|
return this.lines;
|
|
234
|
-
const categoryLine = this.category ? [`CATEGORIES:${this.category}`] : [];
|
|
235
242
|
const uid = this.getUid();
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
.
|
|
241
|
-
.concat([
|
|
243
|
+
const arr = (this.lines = [
|
|
244
|
+
'BEGIN:VEVENT',
|
|
245
|
+
`DTSTAMP:${this.dtstamp}`,
|
|
246
|
+
...(this.sequence ? [`SEQUENCE:${this.sequence}`] : []),
|
|
247
|
+
...(this.category ? [`CATEGORIES:${this.category}`] : []),
|
|
242
248
|
`SUMMARY:${this.subj}`,
|
|
243
249
|
`DTSTART${this.dtargs}:${this.startDate}`,
|
|
244
250
|
`DTEND${this.dtargs}:${this.endDate}`,
|
|
245
251
|
`UID:${uid}`,
|
|
246
252
|
`TRANSP:${this.transp}`,
|
|
247
253
|
`X-MICROSOFT-CDO-BUSYSTATUS:${this.busyStatus}`,
|
|
248
|
-
])
|
|
254
|
+
]);
|
|
249
255
|
if (!this.timed) {
|
|
250
256
|
arr.push('X-MICROSOFT-CDO-ALLDAYEVENT:TRUE');
|
|
251
257
|
}
|
|
@@ -277,7 +283,7 @@ export class IcalEvent {
|
|
|
277
283
|
}
|
|
278
284
|
const trigger = this.getAlarm();
|
|
279
285
|
if (trigger) {
|
|
280
|
-
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Event reminder',
|
|
286
|
+
arr.push('BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Event reminder', trigger, 'END:VALARM');
|
|
281
287
|
}
|
|
282
288
|
arr.push('END:VEVENT');
|
|
283
289
|
return arr;
|
package/dist/pkgVersion.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "7.0.
|
|
1
|
+
export declare const version = "7.0.6";
|
package/dist/pkgVersion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// DO NOT EDIT THIS AUTO-GENERATED FILE!
|
|
2
|
-
export const version = '7.0.
|
|
2
|
+
export const version = '7.0.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/icalendar",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.6",
|
|
4
4
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ical",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://hebcal.github.io/api/icalendar/",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hebcal/core": "^6.
|
|
34
|
-
"@hebcal/hdate": "^0.
|
|
33
|
+
"@hebcal/core": "^6.13.0",
|
|
34
|
+
"@hebcal/hdate": "^0.23.0",
|
|
35
35
|
"@hebcal/murmurhash3": "^1.0.0",
|
|
36
|
-
"@hebcal/rest-api": "^7.1
|
|
36
|
+
"@hebcal/rest-api": "^7.2.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build:version": "node ./version.js package.json src/pkgVersion.ts",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
},
|
|
50
50
|
"license": "BSD-2-Clause",
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@hebcal/learning": "^6.
|
|
53
|
-
"@types/node": "26.6.
|
|
52
|
+
"@hebcal/learning": "^6.12.0",
|
|
53
|
+
"@types/node": "26.6.4",
|
|
54
54
|
"oxlint": "^1.86.0",
|
|
55
55
|
"prettier": "^3.9.9",
|
|
56
56
|
"typescript": "^7.0.2",
|
|
57
|
-
"vitest": "^5.0.
|
|
57
|
+
"vitest": "^5.0.3"
|
|
58
58
|
}
|
|
59
59
|
}
|