@openpeepshq/common 0.8.0 → 0.9.1

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.
@@ -7,6 +7,14 @@ export declare const uniquePostsById: <T extends {
7
7
  }>(posts: (T | undefined)[]) => T[];
8
8
  export declare const getJamUrl: (id: string, origin: string | undefined, occurrence?: string) => string;
9
9
  export declare const jamFromEvent: (event: PublicPost) => Jam | undefined;
10
+ /** A public post that is a real jam (the anonymous state-read short-circuit). */
11
+ export declare const isPublicJamPost: (event: {
12
+ visibility: string;
13
+ data?: {
14
+ type?: string;
15
+ jam?: unknown;
16
+ } | null;
17
+ }) => boolean;
10
18
  export declare const canModerateJam: (profile: Pick<PublicProfile, "id"> | undefined, post: PublicPost) => boolean;
11
19
  /** Host or jam moderator — same gate as the event Attendees tab. */
12
20
  export declare const canViewJamAttendees: (profile: Pick<PublicProfile, "id"> | undefined, post: PublicPost) => boolean;
@@ -34,6 +34,10 @@ export const jamFromEvent = (event) => {
34
34
  }
35
35
  return undefined;
36
36
  };
37
+ /** A public post that is a real jam (the anonymous state-read short-circuit). */
38
+ export const isPublicJamPost = (event) => event.visibility === 'public' &&
39
+ event.data?.type === 'event' &&
40
+ !!event.data?.jam;
37
41
  export const canModerateJam = (profile, post) => !!(profile && jamFromEvent(post)?.moderators?.includes(profile.id));
38
42
  /** Host or jam moderator — same gate as the event Attendees tab. */
39
43
  export const canViewJamAttendees = (profile, post) => !!(profile &&
@@ -276,7 +276,7 @@ export type JamCapacityJoinBlock = {
276
276
  blocked: false;
277
277
  } | {
278
278
  blocked: true;
279
- reason: 'full' | 'rsvp-required' | 'removed';
279
+ reason: 'full' | 'rsvp-required' | 'removed' | 'guest-required';
280
280
  };
281
281
  export declare const getJamCapacityJoinBlock: (post: PublicPost, profile: Pick<PublicProfile, "id"> | undefined, recurrenceId?: string) => JamCapacityJoinBlock;
282
282
  export declare const canDeletePost: (authData: AuthorizationData, post: PublicPost, config: CapabilitiesConfig) => boolean;
@@ -1,4 +1,4 @@
1
- import type { GroupWithMeta, InviteLinkWithMeta, ProfileSettings, ProfileWithMeta, PublicProfile, StripeSubscriptionData } from '../types';
1
+ import type { GroupWithMeta, InviteLinkWithMeta, JamWaitingProfile, ProfileSettings, ProfileWithMeta, PublicProfile, StripeSubscriptionData } from '../types';
2
2
  export declare const PROFILE_DISPLAY_NAME_MAX_LENGTH = 30;
3
3
  /** Public sentinel shown for soft-deleted profiles (API + clients). */
4
4
  export declare const DELETED_AUTHOR_DISPLAY_NAME = "Deleted Profile";
@@ -35,6 +35,8 @@ export declare const toDeletedProfileWithMeta: (profile: ProfileWithMeta) => Pro
35
35
  /** Tombstone a `ProfileWithMeta` only when it is soft-deleted. */
36
36
  export declare const tombstoneProfileWithMetaIfDeleted: (profile: ProfileWithMeta | undefined) => ProfileWithMeta | undefined;
37
37
  export declare const profileName: (profile?: PublicProfile) => string | undefined;
38
+ /** Display name for a waiting-room queue entry (queue stores only a name). */
39
+ export declare const waitingRoomEntryName: (entry?: JamWaitingProfile) => string;
38
40
  export declare const matchesQuery: (profile: PublicProfile | GroupWithMeta | undefined, query: string, queryOptions?: {
39
41
  handle: boolean;
40
42
  displayName: boolean;
@@ -86,6 +86,8 @@ export const tombstoneProfileWithMetaIfDeleted = (profile) => profile && isDelet
86
86
  ? toDeletedProfileWithMeta(profile)
87
87
  : profile;
88
88
  export const profileName = (profile) => profile?.displayName || profile?.handle;
89
+ /** Display name for a waiting-room queue entry (queue stores only a name). */
90
+ export const waitingRoomEntryName = (entry) => entry?.displayName || `#${entry?.id.slice(0, 6)}`;
89
91
  export const matchesQuery = (profile, query, queryOptions = { handle: true, displayName: true }) => !!(profile &&
90
92
  (query.startsWith('@')
91
93
  ? profile.handle && containsIgnoreCase(profile.handle, query.substring(1))
@@ -38933,6 +38933,21 @@ export declare const jamTokenResponseSchema: z.ZodObject<{
38933
38933
  livekitUrl: z.ZodString;
38934
38934
  }, z.core.$strip>;
38935
38935
  export type JamTokenResponse = z.infer<typeof jamTokenResponseSchema>;
38936
+ /**
38937
+ * Waiting-room entry as stored in Redis and streamed to moderators: the
38938
+ * profile's `displayName` (or `handle` when absent) keyed by `profile.id`.
38939
+ * The admission path re-fetches the full profile by id, so the queue never
38940
+ * carries the full object.
38941
+ */
38942
+ export declare const jamWaitingRoomEntrySchema: z.ZodObject<{
38943
+ displayName: z.ZodOptional<z.ZodString>;
38944
+ }, z.core.$strip>;
38945
+ export type JamWaitingRoomEntry = z.infer<typeof jamWaitingRoomEntrySchema>;
38946
+ /** A waiting-room entry resolved for UI: the profile id (the record key) plus display name. */
38947
+ export type JamWaitingProfile = {
38948
+ id: string;
38949
+ displayName?: string;
38950
+ };
38936
38951
  export interface Credentials {
38937
38952
  token: string;
38938
38953
  }
@@ -39121,6 +39136,7 @@ export type ReportCreationData = z.infer<typeof reportCreationDataSchema>;
39121
39136
  export declare const jamStateSchema: z.ZodObject<{
39122
39137
  active: z.ZodBoolean;
39123
39138
  participants: z.ZodArray<z.ZodUUID>;
39139
+ observers: z.ZodOptional<z.ZodNumber>;
39124
39140
  }, z.core.$strip>;
39125
39141
  export type JamState = z.infer<typeof jamStateSchema>;
39126
39142
  export declare const publicReportSchema: z.ZodObject<{
@@ -55598,6 +55614,18 @@ export declare const offsetInfiniteQueryParamsSchema: z.ZodObject<{
55598
55614
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
55599
55615
  }, z.core.$strip>;
55600
55616
  export type OffsetInfiniteQueryParams = z.infer<typeof offsetInfiniteQueryParamsSchema> | undefined;
55617
+ /** Span cap of the date-range event feeds (events calendar). */
55618
+ export declare const EVENT_RANGE_MAX_SPAN_MS: number;
55619
+ /** Default page size of the date-range event feeds (events calendar). */
55620
+ export declare const EVENT_RANGE_DEFAULT_LIMIT = 500;
55621
+ /** Query params of the date-range event feeds (events calendar). */
55622
+ export declare const eventRangeQueryParamsSchema: z.ZodObject<{
55623
+ from: z.ZodString;
55624
+ to: z.ZodString;
55625
+ offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
55626
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
55627
+ }, z.core.$strip>;
55628
+ export type EventRangeQueryParams = z.infer<typeof eventRangeQueryParamsSchema>;
55601
55629
  export declare const searchResultItemSchema: (baseSchema: z.ZodType) => z.ZodObject<{
55602
55630
  score: z.ZodNumber;
55603
55631
  data: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
@@ -72361,6 +72389,53 @@ export declare const postCreationDataSchema: z.ZodObject<{
72361
72389
  groupId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72362
72390
  reportId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72363
72391
  capabilitiesNeeded: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
72392
+ questionDraft: z.ZodOptional<z.ZodObject<{
72393
+ content: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72394
+ sensitive: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72395
+ spoilerText: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72396
+ attachments: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72397
+ type: z.ZodString;
72398
+ url: z.ZodURL;
72399
+ previewUrl: z.ZodNullable<z.ZodURL>;
72400
+ textUrl: z.ZodNull;
72401
+ filename: z.ZodString;
72402
+ meta: z.ZodObject<{
72403
+ usage: z.ZodOptional<z.ZodString>;
72404
+ focus: z.ZodOptional<z.ZodObject<{
72405
+ x: z.ZodNumber;
72406
+ y: z.ZodNumber;
72407
+ }, z.core.$strip>>;
72408
+ mimetype: z.ZodOptional<z.ZodString>;
72409
+ size: z.ZodOptional<z.ZodNumber>;
72410
+ }, z.core.$strip>;
72411
+ description: z.ZodOptional<z.ZodString>;
72412
+ blurhash: z.ZodOptional<z.ZodString>;
72413
+ status: z.ZodOptional<z.ZodEnum<{
72414
+ processing: "processing";
72415
+ ready: "ready";
72416
+ failed: "failed";
72417
+ }>>;
72418
+ error: z.ZodOptional<z.ZodString>;
72419
+ }, z.core.$strip>>>>;
72420
+ customEmojis: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72421
+ shortcode: z.ZodString;
72422
+ url: z.ZodURL;
72423
+ staticUrl: z.ZodURL;
72424
+ visibleInPicker: z.ZodBoolean;
72425
+ category: z.ZodString;
72426
+ }, z.core.$strip>>>>;
72427
+ language: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
72428
+ [x: string]: string;
72429
+ }>>>;
72430
+ type: z.ZodOptional<z.ZodLiteral<"question">>;
72431
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
72432
+ content: z.ZodString;
72433
+ type: z.ZodLiteral<"note">;
72434
+ }, z.core.$strip>>>;
72435
+ multiple: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72436
+ votersVisible: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72437
+ expiresAt: z.ZodOptional<z.ZodOptional<z.ZodISODateTime>>;
72438
+ }, z.core.$strip>>;
72364
72439
  }, z.core.$strip>;
72365
72440
  export type PostCreationData = z.infer<typeof postCreationDataSchema>;
72366
72441
  export declare const postCreationDataFormSchema: z.ZodObject<{
@@ -72889,6 +72964,53 @@ export declare const postCreationDataFormSchema: z.ZodObject<{
72889
72964
  groupId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72890
72965
  reportId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72891
72966
  capabilitiesNeeded: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
72967
+ questionDraft: z.ZodOptional<z.ZodObject<{
72968
+ content: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72969
+ sensitive: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72970
+ spoilerText: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72971
+ attachments: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72972
+ type: z.ZodString;
72973
+ url: z.ZodURL;
72974
+ previewUrl: z.ZodNullable<z.ZodURL>;
72975
+ textUrl: z.ZodNull;
72976
+ filename: z.ZodString;
72977
+ meta: z.ZodObject<{
72978
+ usage: z.ZodOptional<z.ZodString>;
72979
+ focus: z.ZodOptional<z.ZodObject<{
72980
+ x: z.ZodNumber;
72981
+ y: z.ZodNumber;
72982
+ }, z.core.$strip>>;
72983
+ mimetype: z.ZodOptional<z.ZodString>;
72984
+ size: z.ZodOptional<z.ZodNumber>;
72985
+ }, z.core.$strip>;
72986
+ description: z.ZodOptional<z.ZodString>;
72987
+ blurhash: z.ZodOptional<z.ZodString>;
72988
+ status: z.ZodOptional<z.ZodEnum<{
72989
+ processing: "processing";
72990
+ ready: "ready";
72991
+ failed: "failed";
72992
+ }>>;
72993
+ error: z.ZodOptional<z.ZodString>;
72994
+ }, z.core.$strip>>>>;
72995
+ customEmojis: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72996
+ shortcode: z.ZodString;
72997
+ url: z.ZodURL;
72998
+ staticUrl: z.ZodURL;
72999
+ visibleInPicker: z.ZodBoolean;
73000
+ category: z.ZodString;
73001
+ }, z.core.$strip>>>>;
73002
+ language: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
73003
+ [x: string]: string;
73004
+ }>>>;
73005
+ type: z.ZodOptional<z.ZodLiteral<"question">>;
73006
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
73007
+ content: z.ZodString;
73008
+ type: z.ZodLiteral<"note">;
73009
+ }, z.core.$strip>>>;
73010
+ multiple: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
73011
+ votersVisible: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
73012
+ expiresAt: z.ZodOptional<z.ZodOptional<z.ZodISODateTime>>;
73013
+ }, z.core.$strip>>;
72892
73014
  }, z.core.$strip>;
72893
73015
  declare const answerWithPublicProfileSchema: z.ZodObject<{
72894
73016
  selection: z.ZodArray<z.ZodNumber>;
package/dist/types/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { notificationStatsSchema, pushNotificationSchema, } from './notifications.js';
3
- import { accessTokenSchema, accountInteractionsSchema, accountNameSchema, federatedHandleSchema, accountSchema, answerSchema, applicationDataSchema, groupDataSchema, groupRoleSchema, groupSchema, guestDataSchema, hashtagSchema, inviteLinkSchema, jamRecordingStatusSchema, latLngSchema, locationSchema, mediaAttachmentSchema, mentionDataSchema, postDataInputUnionSchema, postDataUnionSchema, postTypeSchema, profileDataSchema, profileStatsSchema, reactionDataSchema, roleDataSchema, reportDataSchema, reportSchema, resourceSchema, rsvpSchema, scopeSchema, visibilityTypeSchema, } from './models.js';
3
+ import { accessTokenSchema, accountInteractionsSchema, accountNameSchema, federatedHandleSchema, accountSchema, answerSchema, applicationDataSchema, groupDataSchema, groupRoleSchema, groupSchema, guestDataSchema, hashtagSchema, inviteLinkSchema, jamRecordingStatusSchema, latLngSchema, locationSchema, mediaAttachmentSchema, mentionDataSchema, postDataInputUnionSchema, postDataUnionSchema, postTypeSchema, profileDataSchema, profileStatsSchema, questionSchema, reactionDataSchema, roleDataSchema, reportDataSchema, reportSchema, resourceSchema, rsvpSchema, scopeSchema, visibilityTypeSchema, } from './models.js';
4
4
  import { groupWithMetaSchema } from './internal.js';
5
5
  import { communityConfigSchema } from './config.js';
6
6
  import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
@@ -379,6 +379,15 @@ export const tokenResponseSchema = z.object({
379
379
  export const jamTokenResponseSchema = tokenResponseSchema.extend({
380
380
  livekitUrl: z.string(),
381
381
  });
382
+ /**
383
+ * Waiting-room entry as stored in Redis and streamed to moderators: the
384
+ * profile's `displayName` (or `handle` when absent) keyed by `profile.id`.
385
+ * The admission path re-fetches the full profile by id, so the queue never
386
+ * carries the full object.
387
+ */
388
+ export const jamWaitingRoomEntrySchema = z.object({
389
+ displayName: z.string().optional(),
390
+ });
382
391
  const focusCoordinatesPattern = /^-?\d+,-?\d+$/;
383
392
  // NOTE: `file` / `thumbnail` accept a `File` (browser) or any
384
393
  // multipart body — modelled as `z.any()` for the API contract so the OpenAPI
@@ -474,6 +483,8 @@ export const reportCreationDataSchema = z.object({
474
483
  export const jamStateSchema = z.object({
475
484
  active: z.boolean(),
476
485
  participants: z.uuid().array(),
486
+ /** Count of hidden `EG_` sessions (observer links, recording/RTMP egress). */
487
+ observers: z.number().optional(),
477
488
  });
478
489
  export const publicReportSchema = reportSchema.extend({
479
490
  reporterProfile: publicProfileSchema,
@@ -492,6 +503,21 @@ export const offsetInfiniteQueryParamsSchema = z.object({
492
503
  offset: z.coerce.number().optional(),
493
504
  limit: z.coerce.number().optional(),
494
505
  });
506
+ /** Span cap of the date-range event feeds (events calendar). */
507
+ export const EVENT_RANGE_MAX_SPAN_MS = 62 * 24 * 60 * 60 * 1000;
508
+ /** Default page size of the date-range event feeds (events calendar). */
509
+ export const EVENT_RANGE_DEFAULT_LIMIT = 500;
510
+ /** Query params of the date-range event feeds (events calendar). */
511
+ export const eventRangeQueryParamsSchema = z
512
+ .object({
513
+ from: z.string().datetime({ offset: true }),
514
+ to: z.string().datetime({ offset: true }),
515
+ offset: z.coerce.number().optional(),
516
+ limit: z.coerce.number().optional(),
517
+ })
518
+ .refine((value) => new Date(value.from).getTime() < new Date(value.to).getTime() &&
519
+ new Date(value.to).getTime() - new Date(value.from).getTime() <=
520
+ EVENT_RANGE_MAX_SPAN_MS, { message: 'from < to with a span of at most 62 days' });
495
521
  export const searchResultItemSchema = (baseSchema) => z.object({
496
522
  score: z.number(),
497
523
  data: baseSchema,
@@ -522,6 +548,16 @@ export const postCreationDataSchema = z.object({
522
548
  groupId: z.uuid().nullable().optional(),
523
549
  reportId: z.uuid().nullable().optional(),
524
550
  capabilitiesNeeded: z.string().array().nullable().optional(),
551
+ /**
552
+ * Composer-side poll stash: the structural poll fields (`options`,
553
+ * `expiresAt`, `multiple`, `votersVisible`) that `toNote` captures when a
554
+ * poll draft is switched away so `toQuestion` can restore them on the
555
+ * reverse switch. Client-side only, never set by the server, and never
556
+ * persisted: the `POST /posts` handler parses the stored record with
557
+ * `postDataSchema`, which has no `questionDraft` key, so the parse
558
+ * strips it.
559
+ */
560
+ questionDraft: questionSchema.partial().optional(),
525
561
  });
526
562
  export const postCreationDataFormSchema = postCreationDataSchema
527
563
  .refine((data) => {
@@ -885,6 +885,8 @@ export declare const noteSchema: z.ZodObject<{
885
885
  export type Note = z.infer<typeof noteSchema>;
886
886
  /** Poll choices are stored short so they fit the vote UI on small screens. */
887
887
  export declare const POLL_OPTION_MAX_LENGTH = 30;
888
+ /** Default expiry for a new poll, applied by the web and native composers. */
889
+ export declare const POLL_DEFAULT_EXPIRY_MS: number;
888
890
  export declare const questionSchema: z.ZodObject<{
889
891
  content: z.ZodOptional<z.ZodString>;
890
892
  sensitive: z.ZodOptional<z.ZodBoolean>;
@@ -373,6 +373,8 @@ const contentBudgetRefine = {
373
373
  export const noteSchema = noteBaseSchema.openapi('Note');
374
374
  /** Poll choices are stored short so they fit the vote UI on small screens. */
375
375
  export const POLL_OPTION_MAX_LENGTH = 30;
376
+ /** Default expiry for a new poll, applied by the web and native composers. */
377
+ export const POLL_DEFAULT_EXPIRY_MS = 30 * 24 * 60 * 60 * 1000;
376
378
  export const questionSchema = noteBaseSchema
377
379
  .extend({
378
380
  type: z.literal('question'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/common",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -47,6 +47,15 @@ export const jamFromEvent = (event: PublicPost): Jam | undefined => {
47
47
  return undefined;
48
48
  };
49
49
 
50
+ /** A public post that is a real jam (the anonymous state-read short-circuit). */
51
+ export const isPublicJamPost = (event: {
52
+ visibility: string;
53
+ data?: { type?: string; jam?: unknown } | null;
54
+ }): boolean =>
55
+ event.visibility === 'public' &&
56
+ event.data?.type === 'event' &&
57
+ !!event.data?.jam;
58
+
50
59
  export const canModerateJam = (
51
60
  profile: Pick<PublicProfile, 'id'> | undefined,
52
61
  post: PublicPost,
@@ -631,7 +631,10 @@ export const canManageEventRsvps = (
631
631
 
632
632
  export type JamCapacityJoinBlock =
633
633
  | { blocked: false }
634
- | { blocked: true; reason: 'full' | 'rsvp-required' | 'removed' };
634
+ | {
635
+ blocked: true;
636
+ reason: 'full' | 'rsvp-required' | 'removed' | 'guest-required';
637
+ };
635
638
 
636
639
  export const getJamCapacityJoinBlock = (
637
640
  post: PublicPost,
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  GroupWithMeta,
3
3
  InviteLinkWithMeta,
4
+ JamWaitingProfile,
4
5
  ProfileSettings,
5
6
  ProfileWithMeta,
6
7
  PublicProfile,
@@ -131,6 +132,10 @@ export const tombstoneProfileWithMetaIfDeleted = (
131
132
  export const profileName = (profile?: PublicProfile) =>
132
133
  profile?.displayName || profile?.handle;
133
134
 
135
+ /** Display name for a waiting-room queue entry (queue stores only a name). */
136
+ export const waitingRoomEntryName = (entry?: JamWaitingProfile) =>
137
+ entry?.displayName || `#${entry?.id.slice(0, 6)}`;
138
+
134
139
  export const matchesQuery = (
135
140
  profile: PublicProfile | GroupWithMeta | undefined,
136
141
  query: string,
package/src/types/api.ts CHANGED
@@ -32,6 +32,7 @@ import {
32
32
  postTypeSchema,
33
33
  profileDataSchema,
34
34
  profileStatsSchema,
35
+ questionSchema,
35
36
  reactionDataSchema,
36
37
  roleDataSchema,
37
38
  Report,
@@ -579,6 +580,23 @@ export const jamTokenResponseSchema = tokenResponseSchema.extend({
579
580
  });
580
581
  export type JamTokenResponse = z.infer<typeof jamTokenResponseSchema>;
581
582
 
583
+ /**
584
+ * Waiting-room entry as stored in Redis and streamed to moderators: the
585
+ * profile's `displayName` (or `handle` when absent) keyed by `profile.id`.
586
+ * The admission path re-fetches the full profile by id, so the queue never
587
+ * carries the full object.
588
+ */
589
+ export const jamWaitingRoomEntrySchema = z.object({
590
+ displayName: z.string().optional(),
591
+ });
592
+ export type JamWaitingRoomEntry = z.infer<typeof jamWaitingRoomEntrySchema>;
593
+
594
+ /** A waiting-room entry resolved for UI: the profile id (the record key) plus display name. */
595
+ export type JamWaitingProfile = {
596
+ id: string;
597
+ displayName?: string;
598
+ };
599
+
582
600
  export interface Credentials {
583
601
  token: string;
584
602
  }
@@ -730,6 +748,8 @@ export type ReportCreationData = z.infer<typeof reportCreationDataSchema>;
730
748
  export const jamStateSchema = z.object({
731
749
  active: z.boolean(),
732
750
  participants: z.uuid().array(),
751
+ /** Count of hidden `EG_` sessions (observer links, recording/RTMP egress). */
752
+ observers: z.number().optional(),
733
753
  });
734
754
  export type JamState = z.infer<typeof jamStateSchema>;
735
755
 
@@ -763,6 +783,29 @@ export type OffsetInfiniteQueryParams =
763
783
  | z.infer<typeof offsetInfiniteQueryParamsSchema>
764
784
  | undefined;
765
785
 
786
+ /** Span cap of the date-range event feeds (events calendar). */
787
+ export const EVENT_RANGE_MAX_SPAN_MS = 62 * 24 * 60 * 60 * 1000;
788
+
789
+ /** Default page size of the date-range event feeds (events calendar). */
790
+ export const EVENT_RANGE_DEFAULT_LIMIT = 500;
791
+
792
+ /** Query params of the date-range event feeds (events calendar). */
793
+ export const eventRangeQueryParamsSchema = z
794
+ .object({
795
+ from: z.string().datetime({ offset: true }),
796
+ to: z.string().datetime({ offset: true }),
797
+ offset: z.coerce.number().optional(),
798
+ limit: z.coerce.number().optional(),
799
+ })
800
+ .refine(
801
+ (value) =>
802
+ new Date(value.from).getTime() < new Date(value.to).getTime() &&
803
+ new Date(value.to).getTime() - new Date(value.from).getTime() <=
804
+ EVENT_RANGE_MAX_SPAN_MS,
805
+ { message: 'from < to with a span of at most 62 days' },
806
+ );
807
+ export type EventRangeQueryParams = z.infer<typeof eventRangeQueryParamsSchema>;
808
+
766
809
  export const searchResultItemSchema = (baseSchema: z.ZodType) =>
767
810
  z.object({
768
811
  score: z.number(),
@@ -807,6 +850,16 @@ export const postCreationDataSchema = z.object({
807
850
  groupId: z.uuid().nullable().optional(),
808
851
  reportId: z.uuid().nullable().optional(),
809
852
  capabilitiesNeeded: z.string().array().nullable().optional(),
853
+ /**
854
+ * Composer-side poll stash: the structural poll fields (`options`,
855
+ * `expiresAt`, `multiple`, `votersVisible`) that `toNote` captures when a
856
+ * poll draft is switched away so `toQuestion` can restore them on the
857
+ * reverse switch. Client-side only, never set by the server, and never
858
+ * persisted: the `POST /posts` handler parses the stored record with
859
+ * `postDataSchema`, which has no `questionDraft` key, so the parse
860
+ * strips it.
861
+ */
862
+ questionDraft: questionSchema.partial().optional(),
810
863
  });
811
864
 
812
865
  export type PostCreationData = z.infer<typeof postCreationDataSchema>;
@@ -535,6 +535,9 @@ export type Note = z.infer<typeof noteSchema>;
535
535
  /** Poll choices are stored short so they fit the vote UI on small screens. */
536
536
  export const POLL_OPTION_MAX_LENGTH = 30;
537
537
 
538
+ /** Default expiry for a new poll, applied by the web and native composers. */
539
+ export const POLL_DEFAULT_EXPIRY_MS = 30 * 24 * 60 * 60 * 1000;
540
+
538
541
  export const questionSchema = noteBaseSchema
539
542
  .extend({
540
543
  type: z.literal('question'),