@openpeepshq/common 0.10.0 → 0.12.0

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.
@@ -1,6 +1,26 @@
1
1
  import type { PublicPost } from '../types';
2
- export declare const buildEventIcs: (post: PublicPost, options?: {
2
+ /**
3
+ * Feed cache TTL in seconds. Single source of truth for the HTTP `max-age`
4
+ * and the ICS `REFRESH-INTERVAL`/`X-PUBLISHED-TTL` so they cannot drift.
5
+ */
6
+ export declare const EVENTS_ICS_FEED_TTL_SECONDS = 3600;
7
+ /**
8
+ * Minimal structural shape of an event post that the feed builder reads.
9
+ * `PostWithMeta` satisfies it, so callers can pass rich post objects
10
+ * without a cast.
11
+ */
12
+ export type IcsEventPost = {
13
+ id: string;
14
+ type: string;
15
+ data?: {
16
+ type?: string;
17
+ } & Record<string, unknown>;
18
+ updatedAt: string;
19
+ };
20
+ export declare const buildEventIcs: (post: IcsEventPost, options?: {
3
21
  postUrl?: string;
22
+ lastModified?: string;
23
+ sequence?: number;
4
24
  }) => string | null;
5
25
  /** Attendance ICS: discrete booked dates, or the series definition when none. */
6
26
  export declare const buildRsvpIcs: (post: PublicPost, options?: {
@@ -19,3 +39,23 @@ export declare const rsvpConfirmationContent: (post: PublicPost, options: {
19
39
  allDay: boolean;
20
40
  occurrenceCount: number;
21
41
  } | null;
42
+ /**
43
+ * Build a multi-event ICS feed string. Composes the single-event exports so
44
+ * the feed stays byte-identical to what the per-event download produces, and
45
+ * carries one deduped VTIMEZONE block per zone so zone-aware events survive.
46
+ *
47
+ * `postUrl` is the community base (origin); each event's joinable-URL fallback
48
+ * is derived as `${postUrl}/posts/{id}`, mirroring the single-event export.
49
+ * Passing a bare origin (never the request URL) keeps the feed's `?token=`
50
+ * secret out of the ICS body.
51
+ *
52
+ * With no events the feed is still a valid calendar (PRODID, `X-WR-CALNAME`,
53
+ * `REFRESH-INTERVAL`, `X-PUBLISHED-TTL`, no VEVENTs) — the same shape the
54
+ * feed endpoint's 401 `emptyCalendar` fallback mirrors. An empty feed is 200,
55
+ * not 404: calendar clients expect a parseable document they can re-poll.
56
+ */
57
+ export declare const buildEventsFeedIcs: (posts: IcsEventPost[], options: {
58
+ postUrl?: string;
59
+ name: string;
60
+ ttl?: number;
61
+ }) => string;
@@ -4,6 +4,11 @@ import { tzlib_get_ical_block } from 'timezones-ical-library';
4
4
  import { effectiveEventTimes } from './eventRecurrence.js';
5
5
  import { getJamUrl } from './jamHelpers.js';
6
6
  import { isIanaTimeZone } from './timeZone.js';
7
+ /**
8
+ * Feed cache TTL in seconds. Single source of truth for the HTTP `max-age`
9
+ * and the ICS `REFRESH-INTERVAL`/`X-PUBLISHED-TTL` so they cannot drift.
10
+ */
11
+ export const EVENTS_ICS_FEED_TTL_SECONDS = 3600;
7
12
  const utcDateFromYmd = (yyyyMmDd) => {
8
13
  const [y, m, d] = yyyyMmDd.split('-').map(Number);
9
14
  return new Date(Date.UTC(y, m - 1, d));
@@ -43,6 +48,32 @@ const withVtimezone = (calendarText, timeZone) => {
43
48
  normalized +
44
49
  calendarText.slice(veventIndex));
45
50
  };
51
+ /**
52
+ * ical-generator writes an all-day `recurrenceId` as a UTC instant
53
+ * (`RECURRENCE-ID:20260713T000000Z`), but RFC 5545 §3.8.4.4 requires the
54
+ * RECURRENCE-ID value type to match the series DTSTART — DATE for all-day
55
+ * events. Rewrite each RECURRENCE-ID line to DATE form.
56
+ */
57
+ const withDateRecurrenceId = (calendarText) =>
58
+ // Split on any line ending so a trailing `\r` is never carried into the
59
+ // re-joined CRLF text (splitting on `\n` alone would leave `\r\r\n`).
60
+ calendarText
61
+ .split(/\r\n|\r|\n/)
62
+ .map((line) => {
63
+ if (!line.startsWith('RECURRENCE-ID'))
64
+ return line;
65
+ if (line.includes(';VALUE=DATE'))
66
+ return line;
67
+ const colonIdx = line.indexOf(':');
68
+ if (colonIdx === -1)
69
+ return line;
70
+ const ymd = line
71
+ .slice(colonIdx + 1)
72
+ .replace(/[^0-9]/g, '')
73
+ .slice(0, 8);
74
+ return `RECURRENCE-ID;VALUE=DATE:${ymd}`;
75
+ })
76
+ .join('\r\n');
46
77
  const originFromUrl = (url) => {
47
78
  if (!url) {
48
79
  return undefined;
@@ -110,6 +141,14 @@ export const buildEventIcs = (post, options) => {
110
141
  method: ICalCalendarMethod.PUBLISH,
111
142
  scale: 'GREGORIAN',
112
143
  });
144
+ // Optional per-post edit stamp (used by the feed so clients update an
145
+ // existing UID instead of re-adding); omitted for single-event exports.
146
+ const stamp = options?.lastModified
147
+ ? {
148
+ lastModified: new Date(options.lastModified),
149
+ sequence: options.sequence ?? 0,
150
+ }
151
+ : {};
113
152
  const link = event.url ?? options?.postUrl;
114
153
  const summary = event.name?.trim() || 'Event';
115
154
  const description = event.content?.trim();
@@ -130,6 +169,7 @@ export const buildEventIcs = (post, options) => {
130
169
  ...(description ? { description } : {}),
131
170
  ...(location ? { location } : {}),
132
171
  ...(link ? { url: link } : {}),
172
+ ...stamp,
133
173
  ...(repeating ? { repeating } : {}),
134
174
  });
135
175
  }
@@ -147,30 +187,58 @@ export const buildEventIcs = (post, options) => {
147
187
  ...(description ? { description } : {}),
148
188
  ...(location ? { location } : {}),
149
189
  ...(link ? { url: link } : {}),
190
+ ...stamp,
150
191
  ...(repeating ? { repeating } : {}),
151
192
  });
152
193
  }
153
194
  for (const exception of event.exceptions ?? []) {
154
195
  if (exception.cancelled || !exception.start)
155
196
  continue;
156
- const start = instantInZone(exception.start, timeZone);
157
- const end = exception.end
158
- ? instantInZone(exception.end, timeZone)
159
- : defaultEnd(start, timeZone);
160
- calendar.createEvent({
161
- id: `openpeeps-event-${post.id}-${exception.recurrenceId}@openpeepshq`,
162
- start,
163
- end,
164
- ...(timeZone ? { timezone: timeZone } : {}),
165
- summary,
166
- ...(description ? { description } : {}),
167
- ...(location ? { location } : {}),
168
- ...(link ? { url: link } : {}),
169
- recurrenceId: instantInZone(exception.recurrenceId, timeZone),
170
- });
197
+ if (event.wholeDay) {
198
+ // Rescheduled all-day occurrence: an all-day override whose day range
199
+ // is the exception's new start day through its end day (inclusive).
200
+ // RECURRENCE-ID identifies the *original* occurrence (RFC 5545 3.8.4.4),
201
+ // while DTSTART/DTEND stay on the new days. The DATE-form RECURRENCE-ID
202
+ // is normalized after serialization.
203
+ const excStartYmd = exception.start.slice(0, 10);
204
+ const excLastInclusiveYmd = exception.end?.slice(0, 10) ?? excStartYmd;
205
+ calendar.createEvent({
206
+ id: `openpeeps-event-${post.id}-${exception.recurrenceId}@openpeepshq`,
207
+ allDay: true,
208
+ start: utcDateFromYmd(excStartYmd),
209
+ end: exclusiveEndAfterInclusiveDay(excLastInclusiveYmd),
210
+ summary,
211
+ ...(description ? { description } : {}),
212
+ ...(location ? { location } : {}),
213
+ ...(link ? { url: link } : {}),
214
+ ...stamp,
215
+ recurrenceId: utcDateFromYmd(exception.recurrenceId.slice(0, 10)),
216
+ });
217
+ }
218
+ else {
219
+ const start = instantInZone(exception.start, timeZone);
220
+ const end = exception.end
221
+ ? instantInZone(exception.end, timeZone)
222
+ : defaultEnd(start, timeZone);
223
+ calendar.createEvent({
224
+ id: `openpeeps-event-${post.id}-${exception.recurrenceId}@openpeepshq`,
225
+ start,
226
+ end,
227
+ ...(timeZone ? { timezone: timeZone } : {}),
228
+ summary,
229
+ ...(description ? { description } : {}),
230
+ ...(location ? { location } : {}),
231
+ ...(link ? { url: link } : {}),
232
+ ...stamp,
233
+ recurrenceId: instantInZone(exception.recurrenceId, timeZone),
234
+ });
235
+ }
171
236
  }
172
237
  const calendarText = calendar.toString();
173
- return ((timeZone ? withVtimezone(calendarText, timeZone) : calendarText) + '\r\n');
238
+ const processed = event.wholeDay
239
+ ? withDateRecurrenceId(calendarText)
240
+ : calendarText;
241
+ return (timeZone ? withVtimezone(processed, timeZone) : processed) + '\r\n';
174
242
  };
175
243
  const addOccurrenceEvent = (calendar, post, event, recurrenceId, options) => {
176
244
  const link = event.url ?? options?.postUrl;
@@ -254,3 +322,93 @@ export const rsvpConfirmationContent = (post, options) => {
254
322
  occurrenceCount: occurrenceIds.length,
255
323
  };
256
324
  };
325
+ /** Collect the VEVENT blocks from a full ICS document. */
326
+ const extractVevents = (ics) => {
327
+ const blocks = [];
328
+ let depth = 0;
329
+ let current = [];
330
+ for (const line of ics.split(/\r?\n/)) {
331
+ if (line.startsWith('BEGIN:VEVENT')) {
332
+ depth += 1;
333
+ current = [line];
334
+ }
335
+ else if (line.startsWith('END:VEVENT')) {
336
+ depth -= 1;
337
+ current.push(line);
338
+ if (depth === 0)
339
+ blocks.push(current.join('\r\n'));
340
+ }
341
+ else if (depth > 0) {
342
+ current.push(line);
343
+ }
344
+ }
345
+ return blocks;
346
+ };
347
+ /**
348
+ * The zone list referenced by a set of VEVENTs, in first-seen order. Each
349
+ * per-post export splices in the VTIMEZONEs its events use; a feed of several
350
+ * zone-aware events must keep one block per zone (ical-generator emits
351
+ * `TZID=` references without any VTIMEZONE of its own).
352
+ */
353
+ const referencedZones = (vevents) => {
354
+ const zones = [];
355
+ for (const vevent of vevents) {
356
+ for (const line of vevent.split('\r\n')) {
357
+ const match = line.match(/;TZID=([^:;]+)/);
358
+ if (match && !zones.includes(match[1])) {
359
+ zones.push(match[1]);
360
+ }
361
+ }
362
+ }
363
+ return zones;
364
+ };
365
+ /**
366
+ * Build a multi-event ICS feed string. Composes the single-event exports so
367
+ * the feed stays byte-identical to what the per-event download produces, and
368
+ * carries one deduped VTIMEZONE block per zone so zone-aware events survive.
369
+ *
370
+ * `postUrl` is the community base (origin); each event's joinable-URL fallback
371
+ * is derived as `${postUrl}/posts/{id}`, mirroring the single-event export.
372
+ * Passing a bare origin (never the request URL) keeps the feed's `?token=`
373
+ * secret out of the ICS body.
374
+ *
375
+ * With no events the feed is still a valid calendar (PRODID, `X-WR-CALNAME`,
376
+ * `REFRESH-INTERVAL`, `X-PUBLISHED-TTL`, no VEVENTs) — the same shape the
377
+ * feed endpoint's 401 `emptyCalendar` fallback mirrors. An empty feed is 200,
378
+ * not 404: calendar clients expect a parseable document they can re-poll.
379
+ */
380
+ export const buildEventsFeedIcs = (posts, options) => {
381
+ const { name, ttl = EVENTS_ICS_FEED_TTL_SECONDS } = options;
382
+ const calendar = ical({
383
+ prodId: '//OpenPeeps//Feed//EN',
384
+ method: ICalCalendarMethod.PUBLISH,
385
+ scale: 'GREGORIAN',
386
+ name,
387
+ ttl,
388
+ });
389
+ const base = options.postUrl?.replace(/\/+$/, '');
390
+ const vevents = [];
391
+ for (const post of posts) {
392
+ if (post.type !== 'event' || post.data?.type !== 'event')
393
+ continue;
394
+ const single = buildEventIcs(post, {
395
+ postUrl: base ? `${base}/posts/${post.id}` : undefined,
396
+ lastModified: post.updatedAt,
397
+ // Minutes since epoch: stable across processes, grows only on edits.
398
+ sequence: Math.floor(new Date(post.updatedAt).getTime() / 60000),
399
+ });
400
+ if (single)
401
+ vevents.push(...extractVevents(single));
402
+ }
403
+ const zoneBlocks = referencedZones(vevents)
404
+ .map((zone) => {
405
+ const [block] = tzlib_get_ical_block(zone);
406
+ return block.replace(/\r?\n/g, '\r\n').trim();
407
+ })
408
+ .join('\r\n');
409
+ const body = (zoneBlocks ? zoneBlocks + '\r\n' : '') +
410
+ (vevents.length ? vevents.join('\r\n') + '\r\n' : '');
411
+ return calendar
412
+ .toString()
413
+ .replace(/END:VCALENDAR\r?\n?$/, body + 'END:VCALENDAR\r\n');
414
+ };
@@ -12,7 +12,7 @@ export type ThreadPreviewGroup = {
12
12
  posts: ThreadPreviewPost[];
13
13
  };
14
14
  export declare const buildThreadPreview: (rootId: string, replies: ThreadPreviewPost[]) => ThreadPreviewGroup[];
15
- export declare const getReactionCount: (post: PublicPost) => Record<"👍", number>;
15
+ export declare const getReactionCount: (post: PublicPost) => Record<"👍" | "👎" | "❤️" | "😂" | "😮" | "😢" | "🎉", number>;
16
16
  export declare const countVotes: (optionsCount: number, answers: Answer[]) => number[];
17
17
  /** Fill blank poll choices with their placeholder label (e.g. "Option 1"). */
18
18
  export declare const resolvePollOptionContents: (options: readonly string[], fallbackLabel: (index: number) => string) => string[];
@@ -298,10 +298,10 @@ export type PostActionAvailability = {
298
298
  canReact: boolean;
299
299
  };
300
300
  /**
301
- * Whether Reply / Repost / Like should look live. Non-members of a group
301
+ * Whether Reply / Repost / React should look live. Non-members of a group
302
302
  * post stay fully disabled (existing feed rule). Each action also follows
303
303
  * the capability the matching write endpoint actually checks: feed replies
304
- * and reposts need create-*, likes need core-posts-react.
304
+ * and reposts need create-*, reactions need core-posts-react.
305
305
  */
306
306
  export declare const getPostActionAvailability: (authData: AuthorizationData, post: PublicPost, config: CapabilitiesConfig) => PostActionAvailability;
307
307
  /** Sentinel handle for block-hidden reply tombstones (no name/handle leak). */
@@ -473,10 +473,10 @@ export const canCreatePostTypeIgnoringScopes = (authData, type, visibilities = v
473
473
  `core-posts-create-${type}-${visibility}`,
474
474
  ]).success);
475
475
  /**
476
- * Whether Reply / Repost / Like should look live. Non-members of a group
476
+ * Whether Reply / Repost / React should look live. Non-members of a group
477
477
  * post stay fully disabled (existing feed rule). Each action also follows
478
478
  * the capability the matching write endpoint actually checks: feed replies
479
- * and reposts need create-*, likes need core-posts-react.
479
+ * and reposts need create-*, reactions need core-posts-react.
480
480
  */
481
481
  export const getPostActionAvailability = (authData, post, config) => {
482
482
  const isGroupPost = !!post.groupId || !!post.group;
@@ -1,6 +1,8 @@
1
- export declare const AP_LIKE_REACTION = "\uD83D\uDC4D";
2
- export declare const AP_DISLIKE_REACTION = "\uD83D\uDC4E";
3
- export declare const activityPubActivityForReaction: (reaction: string) => "Like" | "Dislike" | null;
1
+ import { type ReactionData } from '../types';
2
+ /** The legacy plain like a bodyless DELETE retracts for pre-picker clients. */
3
+ export declare const AP_LIKE_REACTION: "👍";
4
+ /** Whether a logged reaction value is one of the curated post reactions. */
5
+ export declare const isReactionType: (reaction: string) => reaction is ReactionData["reaction"];
4
6
  export type ReactionLogEntry = {
5
7
  type: string;
6
8
  createdAt: string;
@@ -1,12 +1,8 @@
1
- export const AP_LIKE_REACTION = '👍';
2
- export const AP_DISLIKE_REACTION = '👎';
3
- export const activityPubActivityForReaction = (reaction) => {
4
- if (reaction === AP_LIKE_REACTION)
5
- return 'Like';
6
- if (reaction === AP_DISLIKE_REACTION)
7
- return 'Dislike';
8
- return null;
9
- };
1
+ import { REACTION_TYPES } from '../types/index.js';
2
+ /** The legacy plain like a bodyless DELETE retracts for pre-picker clients. */
3
+ export const AP_LIKE_REACTION = REACTION_TYPES[0];
4
+ /** Whether a logged reaction value is one of the curated post reactions. */
5
+ export const isReactionType = (reaction) => REACTION_TYPES.includes(reaction);
10
6
  const reactionFromData = (data) => {
11
7
  if (!data || typeof data !== 'object' || !('reaction' in data)) {
12
8
  return undefined;
@@ -1652,6 +1652,12 @@ export type EntryWithPublicProfile = z.infer<typeof entryWithPublicProfileSchema
1652
1652
  declare const reactionWithPublicProfileSchema: z.ZodObject<{
1653
1653
  reaction: z.ZodEnum<{
1654
1654
  "\uD83D\uDC4D": "👍";
1655
+ "\uD83D\uDC4E": "👎";
1656
+ "\u2764\uFE0F": "❤️";
1657
+ "\uD83D\uDE02": "😂";
1658
+ "\uD83D\uDE2E": "😮";
1659
+ "\uD83D\uDE22": "😢";
1660
+ "\uD83C\uDF89": "🎉";
1655
1661
  }>;
1656
1662
  profile: z.ZodObject<{
1657
1663
  id: z.ZodString;
@@ -7087,6 +7093,12 @@ export declare const publicPostSchema: z.ZodObject<{
7087
7093
  reactions: z.ZodArray<z.ZodObject<{
7088
7094
  reaction: z.ZodEnum<{
7089
7095
  "\uD83D\uDC4D": "👍";
7096
+ "\uD83D\uDC4E": "👎";
7097
+ "\u2764\uFE0F": "❤️";
7098
+ "\uD83D\uDE02": "😂";
7099
+ "\uD83D\uDE2E": "😮";
7100
+ "\uD83D\uDE22": "😢";
7101
+ "\uD83C\uDF89": "🎉";
7090
7102
  }>;
7091
7103
  profile: z.ZodObject<{
7092
7104
  id: z.ZodString;
@@ -17731,6 +17743,12 @@ export declare const publicPostSchema: z.ZodObject<{
17731
17743
  reactions: z.ZodArray<z.ZodObject<{
17732
17744
  reaction: z.ZodEnum<{
17733
17745
  "\uD83D\uDC4D": "👍";
17746
+ "\uD83D\uDC4E": "👎";
17747
+ "\u2764\uFE0F": "❤️";
17748
+ "\uD83D\uDE02": "😂";
17749
+ "\uD83D\uDE2E": "😮";
17750
+ "\uD83D\uDE22": "😢";
17751
+ "\uD83C\uDF89": "🎉";
17734
17752
  }>;
17735
17753
  profile: z.ZodObject<{
17736
17754
  id: z.ZodString;
@@ -23562,6 +23580,12 @@ export declare const publicNotificationSchema: z.ZodObject<{
23562
23580
  reactions: z.ZodArray<z.ZodObject<{
23563
23581
  reaction: z.ZodEnum<{
23564
23582
  "\uD83D\uDC4D": "👍";
23583
+ "\uD83D\uDC4E": "👎";
23584
+ "\u2764\uFE0F": "❤️";
23585
+ "\uD83D\uDE02": "😂";
23586
+ "\uD83D\uDE2E": "😮";
23587
+ "\uD83D\uDE22": "😢";
23588
+ "\uD83C\uDF89": "🎉";
23565
23589
  }>;
23566
23590
  profile: z.ZodObject<{
23567
23591
  id: z.ZodString;
@@ -34206,6 +34230,12 @@ export declare const publicNotificationSchema: z.ZodObject<{
34206
34230
  reactions: z.ZodArray<z.ZodObject<{
34207
34231
  reaction: z.ZodEnum<{
34208
34232
  "\uD83D\uDC4D": "👍";
34233
+ "\uD83D\uDC4E": "👎";
34234
+ "\u2764\uFE0F": "❤️";
34235
+ "\uD83D\uDE02": "😂";
34236
+ "\uD83D\uDE2E": "😮";
34237
+ "\uD83D\uDE22": "😢";
34238
+ "\uD83C\uDF89": "🎉";
34209
34239
  }>;
34210
34240
  profile: z.ZodObject<{
34211
34241
  id: z.ZodString;
@@ -38934,6 +38964,11 @@ export declare const jamTokenResponseSchema: z.ZodObject<{
38934
38964
  livekitUrl: z.ZodString;
38935
38965
  }, z.core.$strip>;
38936
38966
  export type JamTokenResponse = z.infer<typeof jamTokenResponseSchema>;
38967
+ export declare const calendarFeedTokenResponseSchema: z.ZodObject<{
38968
+ success: z.ZodLiteral<true>;
38969
+ token: z.ZodString;
38970
+ }, z.core.$strip>;
38971
+ export type CalendarFeedTokenResponse = z.infer<typeof calendarFeedTokenResponseSchema>;
38937
38972
  /**
38938
38973
  * Waiting-room entry as stored in Redis and streamed to moderators: the
38939
38974
  * profile's `displayName` (or `handle` when absent) keyed by `profile.id`.
@@ -41075,6 +41110,12 @@ export declare const publicReportSchema: z.ZodObject<{
41075
41110
  reactions: z.ZodArray<z.ZodObject<{
41076
41111
  reaction: z.ZodEnum<{
41077
41112
  "\uD83D\uDC4D": "👍";
41113
+ "\uD83D\uDC4E": "👎";
41114
+ "\u2764\uFE0F": "❤️";
41115
+ "\uD83D\uDE02": "😂";
41116
+ "\uD83D\uDE2E": "😮";
41117
+ "\uD83D\uDE22": "😢";
41118
+ "\uD83C\uDF89": "🎉";
41078
41119
  }>;
41079
41120
  profile: z.ZodObject<{
41080
41121
  id: z.ZodString;
@@ -51719,6 +51760,12 @@ export declare const publicReportSchema: z.ZodObject<{
51719
51760
  reactions: z.ZodArray<z.ZodObject<{
51720
51761
  reaction: z.ZodEnum<{
51721
51762
  "\uD83D\uDC4D": "👍";
51763
+ "\uD83D\uDC4E": "👎";
51764
+ "\u2764\uFE0F": "❤️";
51765
+ "\uD83D\uDE02": "😂";
51766
+ "\uD83D\uDE2E": "😮";
51767
+ "\uD83D\uDE22": "😢";
51768
+ "\uD83C\uDF89": "🎉";
51722
51769
  }>;
51723
51770
  profile: z.ZodObject<{
51724
51771
  id: z.ZodString;
@@ -55610,6 +55657,33 @@ export declare const chronologicalInfiniteQueryParamsSchema: z.ZodObject<{
55610
55657
  ungrouped: z.ZodOptional<z.ZodLiteral<"true">>;
55611
55658
  }, z.core.$strip>;
55612
55659
  export type ChronologicalInfiniteQueryParams = z.infer<typeof chronologicalInfiniteQueryParamsSchema> | undefined;
55660
+ /**
55661
+ * Notifications feed query. `excludeTypes` is comma-joined because fetch
55662
+ * query params only allow string | number; the server splits it back.
55663
+ */
55664
+ export type NotificationFeedQueryParams = ChronologicalInfiniteQueryParams & NotificationFeedExcludeTypesQuery;
55665
+ /**
55666
+ * The `excludeTypes` query param of the notifications feed `GET` and the
55667
+ * mark-all-seen `PUT`, shared by both client endpoint declarations so the two
55668
+ * can't drift from each other or from `excludeTypesQuerySchema` (whose parse
55669
+ * consumes exactly this comma-joined string).
55670
+ */
55671
+ export type NotificationFeedExcludeTypesQuery = {
55672
+ excludeTypes?: string;
55673
+ };
55674
+ /**
55675
+ * Server-side schema for the notifications `excludeTypes` query param. The
55676
+ * client sends a comma-joined string (fetch query params only allow
55677
+ * string | number); this splits it back into a list of type keys. Shared by
55678
+ * the feed `GET` and the mark-all-seen `PUT` so the two can't drift.
55679
+ *
55680
+ * The parse must be idempotent: Riddl validates the query before the handler
55681
+ * and the handlers re-parse the already-parsed value, so the second pass sees
55682
+ * the array this transform produces. Accepting the array (union) in addition
55683
+ * to the string keeps both passes stable; a plain `z.string()` would reject
55684
+ * the array and 500 the endpoint.
55685
+ */
55686
+ export declare const excludeTypesQuerySchema: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
55613
55687
  export declare const offsetInfiniteQueryParamsSchema: z.ZodObject<{
55614
55688
  offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
55615
55689
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
@@ -57344,6 +57418,12 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
57344
57418
  reactions: z.ZodArray<z.ZodObject<{
57345
57419
  reaction: z.ZodEnum<{
57346
57420
  "\uD83D\uDC4D": "👍";
57421
+ "\uD83D\uDC4E": "👎";
57422
+ "\u2764\uFE0F": "❤️";
57423
+ "\uD83D\uDE02": "😂";
57424
+ "\uD83D\uDE2E": "😮";
57425
+ "\uD83D\uDE22": "😢";
57426
+ "\uD83C\uDF89": "🎉";
57347
57427
  }>;
57348
57428
  profile: z.ZodObject<{
57349
57429
  id: z.ZodString;
@@ -67988,6 +68068,12 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
67988
68068
  reactions: z.ZodArray<z.ZodObject<{
67989
68069
  reaction: z.ZodEnum<{
67990
68070
  "\uD83D\uDC4D": "👍";
68071
+ "\uD83D\uDC4E": "👎";
68072
+ "\u2764\uFE0F": "❤️";
68073
+ "\uD83D\uDE02": "😂";
68074
+ "\uD83D\uDE2E": "😮";
68075
+ "\uD83D\uDE22": "😢";
68076
+ "\uD83C\uDF89": "🎉";
67991
68077
  }>;
67992
68078
  profile: z.ZodObject<{
67993
68079
  id: z.ZodString;
package/dist/types/api.js CHANGED
@@ -379,6 +379,12 @@ export const tokenResponseSchema = z.object({
379
379
  export const jamTokenResponseSchema = tokenResponseSchema.extend({
380
380
  livekitUrl: z.string(),
381
381
  });
382
+ // The calendar-feed mint returns no `checkoutUrl`; a dedicated shape keeps
383
+ // the endpoint's contract exact.
384
+ export const calendarFeedTokenResponseSchema = z.object({
385
+ success: z.literal(true),
386
+ token: z.string(),
387
+ });
382
388
  /**
383
389
  * Waiting-room entry as stored in Redis and streamed to moderators: the
384
390
  * profile's `displayName` (or `handle` when absent) keyed by `profile.id`.
@@ -499,6 +505,22 @@ export const chronologicalInfiniteQueryParamsSchema = z.object({
499
505
  /** Query-string flag; fetch params only allow string | number. */
500
506
  ungrouped: z.literal('true').optional(),
501
507
  });
508
+ /**
509
+ * Server-side schema for the notifications `excludeTypes` query param. The
510
+ * client sends a comma-joined string (fetch query params only allow
511
+ * string | number); this splits it back into a list of type keys. Shared by
512
+ * the feed `GET` and the mark-all-seen `PUT` so the two can't drift.
513
+ *
514
+ * The parse must be idempotent: Riddl validates the query before the handler
515
+ * and the handlers re-parse the already-parsed value, so the second pass sees
516
+ * the array this transform produces. Accepting the array (union) in addition
517
+ * to the string keeps both passes stable; a plain `z.string()` would reject
518
+ * the array and 500 the endpoint.
519
+ */
520
+ export const excludeTypesQuerySchema = z
521
+ .union([z.string(), z.array(z.string())])
522
+ .transform((value) => (Array.isArray(value) ? value : value.split(',')).filter(Boolean))
523
+ .optional();
502
524
  export const offsetInfiniteQueryParamsSchema = z.object({
503
525
  offset: z.coerce.number().optional(),
504
526
  limit: z.coerce.number().optional(),
@@ -1537,6 +1537,12 @@ export declare const dbBasePostSchema: z.ZodObject<{
1537
1537
  reactions: z.ZodArray<z.ZodObject<{
1538
1538
  reaction: z.ZodEnum<{
1539
1539
  "\uD83D\uDC4D": "👍";
1540
+ "\uD83D\uDC4E": "👎";
1541
+ "\u2764\uFE0F": "❤️";
1542
+ "\uD83D\uDE02": "😂";
1543
+ "\uD83D\uDE2E": "😮";
1544
+ "\uD83D\uDE22": "😢";
1545
+ "\uD83C\uDF89": "🎉";
1540
1546
  }>;
1541
1547
  profile: z.ZodObject<{
1542
1548
  handle: z.ZodString;
@@ -3172,6 +3178,12 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
3172
3178
  reactions: z.ZodArray<z.ZodObject<{
3173
3179
  reaction: z.ZodEnum<{
3174
3180
  "\uD83D\uDC4D": "👍";
3181
+ "\uD83D\uDC4E": "👎";
3182
+ "\u2764\uFE0F": "❤️";
3183
+ "\uD83D\uDE02": "😂";
3184
+ "\uD83D\uDE2E": "😮";
3185
+ "\uD83D\uDE22": "😢";
3186
+ "\uD83C\uDF89": "🎉";
3175
3187
  }>;
3176
3188
  profile: z.ZodObject<{
3177
3189
  handle: z.ZodString;
@@ -4786,6 +4798,12 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
4786
4798
  reactions: z.ZodArray<z.ZodObject<{
4787
4799
  reaction: z.ZodEnum<{
4788
4800
  "\uD83D\uDC4D": "👍";
4801
+ "\uD83D\uDC4E": "👎";
4802
+ "\u2764\uFE0F": "❤️";
4803
+ "\uD83D\uDE02": "😂";
4804
+ "\uD83D\uDE2E": "😮";
4805
+ "\uD83D\uDE22": "😢";
4806
+ "\uD83C\uDF89": "🎉";
4789
4807
  }>;
4790
4808
  profile: z.ZodObject<{
4791
4809
  handle: z.ZodString;
@@ -6403,6 +6421,12 @@ export declare const dbPostSchema: z.ZodObject<{
6403
6421
  reactions: z.ZodArray<z.ZodObject<{
6404
6422
  reaction: z.ZodEnum<{
6405
6423
  "\uD83D\uDC4D": "👍";
6424
+ "\uD83D\uDC4E": "👎";
6425
+ "\u2764\uFE0F": "❤️";
6426
+ "\uD83D\uDE02": "😂";
6427
+ "\uD83D\uDE2E": "😮";
6428
+ "\uD83D\uDE22": "😢";
6429
+ "\uD83C\uDF89": "🎉";
6406
6430
  }>;
6407
6431
  profile: z.ZodObject<{
6408
6432
  handle: z.ZodString;
@@ -8017,6 +8041,12 @@ export declare const dbPostSchema: z.ZodObject<{
8017
8041
  reactions: z.ZodArray<z.ZodObject<{
8018
8042
  reaction: z.ZodEnum<{
8019
8043
  "\uD83D\uDC4D": "👍";
8044
+ "\uD83D\uDC4E": "👎";
8045
+ "\u2764\uFE0F": "❤️";
8046
+ "\uD83D\uDE02": "😂";
8047
+ "\uD83D\uDE2E": "😮";
8048
+ "\uD83D\uDE22": "😢";
8049
+ "\uD83C\uDF89": "🎉";
8020
8050
  }>;
8021
8051
  profile: z.ZodObject<{
8022
8052
  handle: z.ZodString;
@@ -9633,6 +9663,12 @@ export declare const dbPostSchema: z.ZodObject<{
9633
9663
  reactions: z.ZodArray<z.ZodObject<{
9634
9664
  reaction: z.ZodEnum<{
9635
9665
  "\uD83D\uDC4D": "👍";
9666
+ "\uD83D\uDC4E": "👎";
9667
+ "\u2764\uFE0F": "❤️";
9668
+ "\uD83D\uDE02": "😂";
9669
+ "\uD83D\uDE2E": "😮";
9670
+ "\uD83D\uDE22": "😢";
9671
+ "\uD83C\uDF89": "🎉";
9636
9672
  }>;
9637
9673
  profile: z.ZodObject<{
9638
9674
  handle: z.ZodString;
@@ -11247,6 +11283,12 @@ export declare const dbPostSchema: z.ZodObject<{
11247
11283
  reactions: z.ZodArray<z.ZodObject<{
11248
11284
  reaction: z.ZodEnum<{
11249
11285
  "\uD83D\uDC4D": "👍";
11286
+ "\uD83D\uDC4E": "👎";
11287
+ "\u2764\uFE0F": "❤️";
11288
+ "\uD83D\uDE02": "😂";
11289
+ "\uD83D\uDE2E": "😮";
11290
+ "\uD83D\uDE22": "😢";
11291
+ "\uD83C\uDF89": "🎉";
11250
11292
  }>;
11251
11293
  profile: z.ZodObject<{
11252
11294
  handle: z.ZodString;