@openpeepshq/common 0.9.0 → 0.10.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.
@@ -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;
@@ -316,6 +316,15 @@ export declare const toHiddenPost: <T extends {
316
316
  export declare const isHiddenPost: (post: {
317
317
  hidden?: boolean;
318
318
  }) => boolean;
319
+ /**
320
+ * Only posts with `visibility === 'public'` are considered worth handing to
321
+ * the outside world. `withPublicPostReadScopes` additionally grants anonymous
322
+ * read to some `group` posts, but sharing a group post to an anonymous
323
+ * audience is consciously out of scope here.
324
+ */
325
+ export declare const isPubliclyShareable: (post: {
326
+ visibility: VisibilityType;
327
+ }) => boolean;
319
328
  export declare const participantIds: (post: Pick<PublicPost, "audience" | "profile"> & {
320
329
  creatorId?: string;
321
330
  }) => Set<string>;
@@ -517,6 +517,13 @@ export const toHiddenPost = (post) => ({
517
517
  },
518
518
  });
519
519
  export const isHiddenPost = (post) => !!post.hidden;
520
+ /**
521
+ * Only posts with `visibility === 'public'` are considered worth handing to
522
+ * the outside world. `withPublicPostReadScopes` additionally grants anonymous
523
+ * read to some `group` posts, but sharing a group post to an anonymous
524
+ * audience is consciously out of scope here.
525
+ */
526
+ export const isPubliclyShareable = (post) => post.visibility === 'public';
520
527
  export const participantIds = (post) => {
521
528
  const ids = new Set((post.audience ?? []).map((member) => member.id).filter(Boolean));
522
529
  const creatorId = post.creatorId ?? post.profile?.id;
@@ -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))
@@ -38318,6 +38318,7 @@ export declare const serverInfoSchema: z.ZodObject<{
38318
38318
  codeOfConduct: z.ZodOptional<z.ZodString>;
38319
38319
  welcomeEmail: z.ZodOptional<z.ZodString>;
38320
38320
  pinnedPost: z.ZodOptional<z.ZodString>;
38321
+ autoFollow: z.ZodOptional<z.ZodArray<z.ZodString>>;
38321
38322
  }, z.core.$strip>;
38322
38323
  settings: z.ZodObject<{
38323
38324
  openRegistrations: z.ZodBoolean;
@@ -38933,6 +38934,21 @@ export declare const jamTokenResponseSchema: z.ZodObject<{
38933
38934
  livekitUrl: z.ZodString;
38934
38935
  }, z.core.$strip>;
38935
38936
  export type JamTokenResponse = z.infer<typeof jamTokenResponseSchema>;
38937
+ /**
38938
+ * Waiting-room entry as stored in Redis and streamed to moderators: the
38939
+ * profile's `displayName` (or `handle` when absent) keyed by `profile.id`.
38940
+ * The admission path re-fetches the full profile by id, so the queue never
38941
+ * carries the full object.
38942
+ */
38943
+ export declare const jamWaitingRoomEntrySchema: z.ZodObject<{
38944
+ displayName: z.ZodOptional<z.ZodString>;
38945
+ }, z.core.$strip>;
38946
+ export type JamWaitingRoomEntry = z.infer<typeof jamWaitingRoomEntrySchema>;
38947
+ /** A waiting-room entry resolved for UI: the profile id (the record key) plus display name. */
38948
+ export type JamWaitingProfile = {
38949
+ id: string;
38950
+ displayName?: string;
38951
+ };
38936
38952
  export interface Credentials {
38937
38953
  token: string;
38938
38954
  }
@@ -72374,6 +72390,53 @@ export declare const postCreationDataSchema: z.ZodObject<{
72374
72390
  groupId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72375
72391
  reportId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72376
72392
  capabilitiesNeeded: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
72393
+ questionDraft: z.ZodOptional<z.ZodObject<{
72394
+ content: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72395
+ sensitive: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72396
+ spoilerText: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72397
+ attachments: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72398
+ type: z.ZodString;
72399
+ url: z.ZodURL;
72400
+ previewUrl: z.ZodNullable<z.ZodURL>;
72401
+ textUrl: z.ZodNull;
72402
+ filename: z.ZodString;
72403
+ meta: z.ZodObject<{
72404
+ usage: z.ZodOptional<z.ZodString>;
72405
+ focus: z.ZodOptional<z.ZodObject<{
72406
+ x: z.ZodNumber;
72407
+ y: z.ZodNumber;
72408
+ }, z.core.$strip>>;
72409
+ mimetype: z.ZodOptional<z.ZodString>;
72410
+ size: z.ZodOptional<z.ZodNumber>;
72411
+ }, z.core.$strip>;
72412
+ description: z.ZodOptional<z.ZodString>;
72413
+ blurhash: z.ZodOptional<z.ZodString>;
72414
+ status: z.ZodOptional<z.ZodEnum<{
72415
+ processing: "processing";
72416
+ ready: "ready";
72417
+ failed: "failed";
72418
+ }>>;
72419
+ error: z.ZodOptional<z.ZodString>;
72420
+ }, z.core.$strip>>>>;
72421
+ customEmojis: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72422
+ shortcode: z.ZodString;
72423
+ url: z.ZodURL;
72424
+ staticUrl: z.ZodURL;
72425
+ visibleInPicker: z.ZodBoolean;
72426
+ category: z.ZodString;
72427
+ }, z.core.$strip>>>>;
72428
+ language: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
72429
+ [x: string]: string;
72430
+ }>>>;
72431
+ type: z.ZodOptional<z.ZodLiteral<"question">>;
72432
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
72433
+ content: z.ZodString;
72434
+ type: z.ZodLiteral<"note">;
72435
+ }, z.core.$strip>>>;
72436
+ multiple: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72437
+ votersVisible: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72438
+ expiresAt: z.ZodOptional<z.ZodOptional<z.ZodISODateTime>>;
72439
+ }, z.core.$strip>>;
72377
72440
  }, z.core.$strip>;
72378
72441
  export type PostCreationData = z.infer<typeof postCreationDataSchema>;
72379
72442
  export declare const postCreationDataFormSchema: z.ZodObject<{
@@ -72902,6 +72965,53 @@ export declare const postCreationDataFormSchema: z.ZodObject<{
72902
72965
  groupId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72903
72966
  reportId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
72904
72967
  capabilitiesNeeded: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
72968
+ questionDraft: z.ZodOptional<z.ZodObject<{
72969
+ content: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72970
+ sensitive: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
72971
+ spoilerText: z.ZodOptional<z.ZodOptional<z.ZodString>>;
72972
+ attachments: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72973
+ type: z.ZodString;
72974
+ url: z.ZodURL;
72975
+ previewUrl: z.ZodNullable<z.ZodURL>;
72976
+ textUrl: z.ZodNull;
72977
+ filename: z.ZodString;
72978
+ meta: z.ZodObject<{
72979
+ usage: z.ZodOptional<z.ZodString>;
72980
+ focus: z.ZodOptional<z.ZodObject<{
72981
+ x: z.ZodNumber;
72982
+ y: z.ZodNumber;
72983
+ }, z.core.$strip>>;
72984
+ mimetype: z.ZodOptional<z.ZodString>;
72985
+ size: z.ZodOptional<z.ZodNumber>;
72986
+ }, z.core.$strip>;
72987
+ description: z.ZodOptional<z.ZodString>;
72988
+ blurhash: z.ZodOptional<z.ZodString>;
72989
+ status: z.ZodOptional<z.ZodEnum<{
72990
+ processing: "processing";
72991
+ ready: "ready";
72992
+ failed: "failed";
72993
+ }>>;
72994
+ error: z.ZodOptional<z.ZodString>;
72995
+ }, z.core.$strip>>>>;
72996
+ customEmojis: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
72997
+ shortcode: z.ZodString;
72998
+ url: z.ZodURL;
72999
+ staticUrl: z.ZodURL;
73000
+ visibleInPicker: z.ZodBoolean;
73001
+ category: z.ZodString;
73002
+ }, z.core.$strip>>>>;
73003
+ language: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
73004
+ [x: string]: string;
73005
+ }>>>;
73006
+ type: z.ZodOptional<z.ZodLiteral<"question">>;
73007
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
73008
+ content: z.ZodString;
73009
+ type: z.ZodLiteral<"note">;
73010
+ }, z.core.$strip>>>;
73011
+ multiple: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
73012
+ votersVisible: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
73013
+ expiresAt: z.ZodOptional<z.ZodOptional<z.ZodISODateTime>>;
73014
+ }, z.core.$strip>>;
72905
73015
  }, z.core.$strip>;
72906
73016
  declare const answerWithPublicProfileSchema: z.ZodObject<{
72907
73017
  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
@@ -539,6 +548,16 @@ export const postCreationDataSchema = z.object({
539
548
  groupId: z.uuid().nullable().optional(),
540
549
  reportId: z.uuid().nullable().optional(),
541
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(),
542
561
  });
543
562
  export const postCreationDataFormSchema = postCreationDataSchema
544
563
  .refine((data) => {
@@ -695,6 +695,7 @@ export declare const communityConfigSchemaFactory: (_sanitize?: boolean) => z.Zo
695
695
  codeOfConduct: z.ZodOptional<z.ZodString>;
696
696
  welcomeEmail: z.ZodOptional<z.ZodString>;
697
697
  pinnedPost: z.ZodOptional<z.ZodString>;
698
+ autoFollow: z.ZodOptional<z.ZodArray<z.ZodString>>;
698
699
  }, z.core.$strip>;
699
700
  settings: z.ZodObject<{
700
701
  openRegistrations: z.ZodBoolean;
@@ -777,6 +778,7 @@ export declare const communityConfigSchema: z.ZodObject<{
777
778
  codeOfConduct: z.ZodOptional<z.ZodString>;
778
779
  welcomeEmail: z.ZodOptional<z.ZodString>;
779
780
  pinnedPost: z.ZodOptional<z.ZodString>;
781
+ autoFollow: z.ZodOptional<z.ZodArray<z.ZodString>>;
780
782
  }, z.core.$strip>;
781
783
  settings: z.ZodObject<{
782
784
  openRegistrations: z.ZodBoolean;
@@ -859,6 +861,7 @@ export declare const communityConfigSanitizedSchema: z.ZodObject<{
859
861
  codeOfConduct: z.ZodOptional<z.ZodString>;
860
862
  welcomeEmail: z.ZodOptional<z.ZodString>;
861
863
  pinnedPost: z.ZodOptional<z.ZodString>;
864
+ autoFollow: z.ZodOptional<z.ZodArray<z.ZodString>>;
862
865
  }, z.core.$strip>;
863
866
  settings: z.ZodObject<{
864
867
  openRegistrations: z.ZodBoolean;
@@ -339,6 +339,10 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
339
339
  codeOfConduct: z.string().optional(),
340
340
  welcomeEmail: z.string().optional(),
341
341
  pinnedPost: z.string().optional(),
342
+ /** Local handles new members are made to follow on registration.
343
+ * Admin-managed via Community → Auto-follow accounts; only resolvable
344
+ * local profiles may be designated (federated handles are rejected). */
345
+ autoFollow: z.string().array().optional(),
342
346
  }),
343
347
  settings: z.object({
344
348
  openRegistrations: z.boolean(),
@@ -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.9.0",
3
+ "version": "0.10.0",
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,
@@ -848,6 +851,16 @@ export const toHiddenPost = <
848
851
  export const isHiddenPost = (post: { hidden?: boolean }): boolean =>
849
852
  !!post.hidden;
850
853
 
854
+ /**
855
+ * Only posts with `visibility === 'public'` are considered worth handing to
856
+ * the outside world. `withPublicPostReadScopes` additionally grants anonymous
857
+ * read to some `group` posts, but sharing a group post to an anonymous
858
+ * audience is consciously out of scope here.
859
+ */
860
+ export const isPubliclyShareable = (post: {
861
+ visibility: VisibilityType;
862
+ }): boolean => post.visibility === 'public';
863
+
851
864
  export const participantIds = (
852
865
  post: Pick<PublicPost, 'audience' | 'profile'> & { creatorId?: string },
853
866
  ): Set<string> => {
@@ -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
  }
@@ -832,6 +850,16 @@ export const postCreationDataSchema = z.object({
832
850
  groupId: z.uuid().nullable().optional(),
833
851
  reportId: z.uuid().nullable().optional(),
834
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(),
835
863
  });
836
864
 
837
865
  export type PostCreationData = z.infer<typeof postCreationDataSchema>;
@@ -408,6 +408,10 @@ export const communityConfigSchemaFactory = (_sanitize?: boolean) =>
408
408
  codeOfConduct: z.string().optional(),
409
409
  welcomeEmail: z.string().optional(),
410
410
  pinnedPost: z.string().optional(),
411
+ /** Local handles new members are made to follow on registration.
412
+ * Admin-managed via Community → Auto-follow accounts; only resolvable
413
+ * local profiles may be designated (federated handles are rejected). */
414
+ autoFollow: z.string().array().optional(),
411
415
  }),
412
416
  settings: z.object({
413
417
  openRegistrations: z.boolean(),
@@ -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'),