@remit/calendar-service 0.0.7 → 0.0.8
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/package.json +1 -1
- package/src/feed.test.ts +4 -3
- package/src/feed.ts +0 -3
- package/src/index.ts +0 -1
- package/src/project.ts +8 -8
- package/src/suggest.ts +1 -6
package/package.json
CHANGED
package/src/feed.test.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
CALENDAR_FEED_TOKEN_BYTES,
|
|
10
10
|
calendarFeedIsUnchanged,
|
|
11
11
|
calendarFeedIsUnmodifiedSince,
|
|
12
|
-
calendarFeedPath,
|
|
13
12
|
hashCalendarFeedToken,
|
|
14
13
|
isCalendarFeedToken,
|
|
15
14
|
mintCalendarFeedToken,
|
|
@@ -99,7 +98,7 @@ describe("a feed address", () => {
|
|
|
99
98
|
const minted = mintCalendarFeedToken();
|
|
100
99
|
|
|
101
100
|
assert.equal(
|
|
102
|
-
readCalendarFeedToken(
|
|
101
|
+
readCalendarFeedToken(`/feeds/calendar/${minted.token}.ics`),
|
|
103
102
|
minted.token,
|
|
104
103
|
);
|
|
105
104
|
});
|
|
@@ -279,7 +278,9 @@ describe("a feed path in a log line", () => {
|
|
|
279
278
|
it("keeps the route and drops the token", () => {
|
|
280
279
|
const minted = mintCalendarFeedToken();
|
|
281
280
|
|
|
282
|
-
const redacted = redactCalendarFeedPath(
|
|
281
|
+
const redacted = redactCalendarFeedPath(
|
|
282
|
+
`/feeds/calendar/${minted.token}.ics`,
|
|
283
|
+
);
|
|
283
284
|
|
|
284
285
|
assert.equal(redacted.includes(minted.token), false);
|
|
285
286
|
assert.equal(redacted, "/feeds/calendar/<redacted>.ics");
|
package/src/feed.ts
CHANGED
|
@@ -50,9 +50,6 @@ export const mintCalendarFeedToken = (): CalendarFeedSecret => {
|
|
|
50
50
|
export const isCalendarFeedToken = (token: string): boolean =>
|
|
51
51
|
TOKEN_SHAPE.test(token);
|
|
52
52
|
|
|
53
|
-
export const calendarFeedPath = (token: string): string =>
|
|
54
|
-
`${CALENDAR_FEED_PATH_PREFIX}${token}${CALENDAR_FEED_PATH_SUFFIX}`;
|
|
55
|
-
|
|
56
53
|
/**
|
|
57
54
|
* The token a request path carries, or `null` when the path is not a feed
|
|
58
55
|
* address. One segment only: a slash inside it would name a different route.
|
package/src/index.ts
CHANGED
package/src/project.ts
CHANGED
|
@@ -36,18 +36,11 @@ const TRANSPARENCY_BY_ICAL: Record<string, CalendarObjectItem["transparency"]> =
|
|
|
36
36
|
TRANSPARENT: CalendarTransparency.Transparent,
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const readString = (component: ICAL.Component, name: string): string => {
|
|
39
|
+
export const readString = (component: ICAL.Component, name: string): string => {
|
|
40
40
|
const value = component.getFirstPropertyValue(name);
|
|
41
41
|
return typeof value === "string" ? value : "";
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* Whether the resource expands to more than its master instance — an RRULE, an
|
|
46
|
-
* RDATE, or an override VEVENT. The overrides count: a client that edits one
|
|
47
|
-
* instance of a series and then deletes the rule leaves a resource with nothing
|
|
48
|
-
* but a master and its exceptions, and every one of those is still an
|
|
49
|
-
* occurrence somebody has to see.
|
|
50
|
-
*/
|
|
51
44
|
/**
|
|
52
45
|
* The fields that describe one VEVENT rather than the series it belongs to.
|
|
53
46
|
*
|
|
@@ -73,6 +66,13 @@ export const projectEventDisplay = (
|
|
|
73
66
|
CalendarTransparency.Opaque,
|
|
74
67
|
});
|
|
75
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Whether the resource expands to more than its master instance — an RRULE, an
|
|
71
|
+
* RDATE, or an override VEVENT. The overrides count: a client that edits one
|
|
72
|
+
* instance of a series and then deletes the rule leaves a resource with nothing
|
|
73
|
+
* but a master and its exceptions, and every one of those is still an
|
|
74
|
+
* occurrence somebody has to see.
|
|
75
|
+
*/
|
|
76
76
|
export const hasRecurrence = (calendar: ParsedCalendar): boolean =>
|
|
77
77
|
calendar.master.hasProperty("rrule") ||
|
|
78
78
|
calendar.master.hasProperty("rdate") ||
|
package/src/suggest.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import type ICAL from "ical.js";
|
|
11
11
|
import type { CalendarResult } from "./errors.js";
|
|
12
12
|
import { parseCalendar } from "./parse.js";
|
|
13
|
-
import { projectCalendar } from "./project.js";
|
|
13
|
+
import { projectCalendar, readString } from "./project.js";
|
|
14
14
|
|
|
15
15
|
const METHOD_BY_ICAL: Record<string, CalendarSuggestionItem["method"]> = {
|
|
16
16
|
REQUEST: CalendarInviteMethod.Request,
|
|
@@ -20,11 +20,6 @@ const METHOD_BY_ICAL: Record<string, CalendarSuggestionItem["method"]> = {
|
|
|
20
20
|
PUBLISH: CalendarInviteMethod.Publish,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
const readString = (component: ICAL.Component, name: string): string => {
|
|
24
|
-
const value = component.getFirstPropertyValue(name);
|
|
25
|
-
return typeof value === "string" ? value : "";
|
|
26
|
-
};
|
|
27
|
-
|
|
28
23
|
/**
|
|
29
24
|
* A `CAL-ADDRESS` as a plain mail address. RFC 5545 3.3.3 writes one as a URI,
|
|
30
25
|
* which in practice is always `mailto:`; a card shows a person, not a URI.
|