@openpeepshq/common 0.5.11 → 0.6.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.
@@ -322,6 +322,18 @@ export declare const participantIds: (post: Pick<PublicPost, "audience" | "profi
322
322
  export declare const isOneToOneDm: (post: Pick<PublicPost, "visibility" | "audience" | "profile"> & {
323
323
  creatorId?: string;
324
324
  }) => boolean;
325
+ /**
326
+ * A direct-message leave is the reply that leaveConversation posts: it
327
+ * replies to the thread's newest post and leaves the leaver out of the
328
+ * audience, so the thread stops reaching them. Replies created through
329
+ * the conversations endpoint always keep their author in the audience
330
+ * (the endpoint rejects posters who are no longer in the newest post's
331
+ * audience), so a reply whose audience lacks its author is only ever a
332
+ * leave — while a root post whose author is missing from the audience is
333
+ * just a message. Deliberately marker-free: leave posts must stay plain
334
+ * notes so they remain valid ActivityPub direct messages.
335
+ */
336
+ export declare const isConversationLeavePost: (post: Pick<PublicPost, "inReplyToId" | "audience" | "profile">) => boolean;
325
337
  export declare const isOneToOneWithBlocked: (post: Pick<PublicPost, "visibility" | "audience" | "profile"> & {
326
338
  creatorId?: string;
327
339
  }, viewer: {
@@ -521,6 +521,23 @@ export const participantIds = (post) => {
521
521
  };
522
522
  /** Direct message between exactly two participants. */
523
523
  export const isOneToOneDm = (post) => post.visibility === 'direct' && participantIds(post).size === 2;
524
+ /**
525
+ * A direct-message leave is the reply that leaveConversation posts: it
526
+ * replies to the thread's newest post and leaves the leaver out of the
527
+ * audience, so the thread stops reaching them. Replies created through
528
+ * the conversations endpoint always keep their author in the audience
529
+ * (the endpoint rejects posters who are no longer in the newest post's
530
+ * audience), so a reply whose audience lacks its author is only ever a
531
+ * leave — while a root post whose author is missing from the audience is
532
+ * just a message. Deliberately marker-free: leave posts must stay plain
533
+ * notes so they remain valid ActivityPub direct messages.
534
+ */
535
+ export const isConversationLeavePost = (post) => {
536
+ const authorId = post.profile?.id;
537
+ if (!post.inReplyToId || !authorId)
538
+ return false;
539
+ return !post.audience?.some((p) => p.id === authorId);
540
+ };
524
541
  export const isOneToOneWithBlocked = (post, viewer, blockedIds) => {
525
542
  if (!viewer || post.visibility !== 'direct')
526
543
  return false;
@@ -38309,6 +38309,7 @@ export declare const serverInfoSchema: z.ZodObject<{
38309
38309
  contactEmail: z.ZodOptional<z.ZodString>;
38310
38310
  privacyPolicy: z.ZodOptional<z.ZodString>;
38311
38311
  termsAndConditions: z.ZodOptional<z.ZodString>;
38312
+ bugReportUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodURL]>>;
38312
38313
  }, z.core.$strip>;
38313
38314
  content: z.ZodObject<{
38314
38315
  aboutPage: z.ZodOptional<z.ZodString>;
@@ -687,6 +687,7 @@ export declare const communityConfigSchemaFactory: (_sanitize?: boolean) => z.Zo
687
687
  contactEmail: z.ZodOptional<z.ZodString>;
688
688
  privacyPolicy: z.ZodOptional<z.ZodString>;
689
689
  termsAndConditions: z.ZodOptional<z.ZodString>;
690
+ bugReportUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodURL]>>;
690
691
  }, z.core.$strip>;
691
692
  content: z.ZodObject<{
692
693
  aboutPage: z.ZodOptional<z.ZodString>;
@@ -768,6 +769,7 @@ export declare const communityConfigSchema: z.ZodObject<{
768
769
  contactEmail: z.ZodOptional<z.ZodString>;
769
770
  privacyPolicy: z.ZodOptional<z.ZodString>;
770
771
  termsAndConditions: z.ZodOptional<z.ZodString>;
772
+ bugReportUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodURL]>>;
771
773
  }, z.core.$strip>;
772
774
  content: z.ZodObject<{
773
775
  aboutPage: z.ZodOptional<z.ZodString>;
@@ -849,6 +851,7 @@ export declare const communityConfigSanitizedSchema: z.ZodObject<{
849
851
  contactEmail: z.ZodOptional<z.ZodString>;
850
852
  privacyPolicy: z.ZodOptional<z.ZodString>;
851
853
  termsAndConditions: z.ZodOptional<z.ZodString>;
854
+ bugReportUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodURL]>>;
852
855
  }, z.core.$strip>;
853
856
  content: z.ZodObject<{
854
857
  aboutPage: z.ZodOptional<z.ZodString>;
@@ -326,6 +326,12 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
326
326
  contactEmail: z.string().email().optional(),
327
327
  privacyPolicy: z.string().optional(),
328
328
  termsAndConditions: z.string().optional(),
329
+ /** External bug report form; a "Report a bug" link is shown when set.
330
+ * `''` is the cleared value — pruneEmptyConfigStrings drops it on save.
331
+ * Only http(s) URLs are accepted; the render side re-checks as well. */
332
+ bugReportUrl: z
333
+ .union([z.literal(''), z.url({ protocol: /^https?$/ })])
334
+ .optional(),
329
335
  }),
330
336
  content: z.object({
331
337
  aboutPage: z.string().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/common",
3
- "version": "0.5.11",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -855,6 +855,25 @@ export const isOneToOneDm = (
855
855
  },
856
856
  ): boolean => post.visibility === 'direct' && participantIds(post).size === 2;
857
857
 
858
+ /**
859
+ * A direct-message leave is the reply that leaveConversation posts: it
860
+ * replies to the thread's newest post and leaves the leaver out of the
861
+ * audience, so the thread stops reaching them. Replies created through
862
+ * the conversations endpoint always keep their author in the audience
863
+ * (the endpoint rejects posters who are no longer in the newest post's
864
+ * audience), so a reply whose audience lacks its author is only ever a
865
+ * leave — while a root post whose author is missing from the audience is
866
+ * just a message. Deliberately marker-free: leave posts must stay plain
867
+ * notes so they remain valid ActivityPub direct messages.
868
+ */
869
+ export const isConversationLeavePost = (
870
+ post: Pick<PublicPost, 'inReplyToId' | 'audience' | 'profile'>,
871
+ ): boolean => {
872
+ const authorId = post.profile?.id;
873
+ if (!post.inReplyToId || !authorId) return false;
874
+ return !post.audience?.some((p) => p.id === authorId);
875
+ };
876
+
858
877
  export const isOneToOneWithBlocked = (
859
878
  post: Pick<PublicPost, 'visibility' | 'audience' | 'profile'> & {
860
879
  creatorId?: string;
@@ -395,6 +395,12 @@ export const communityConfigSchemaFactory = (_sanitize?: boolean) =>
395
395
  contactEmail: z.string().email().optional(),
396
396
  privacyPolicy: z.string().optional(),
397
397
  termsAndConditions: z.string().optional(),
398
+ /** External bug report form; a "Report a bug" link is shown when set.
399
+ * `''` is the cleared value — pruneEmptyConfigStrings drops it on save.
400
+ * Only http(s) URLs are accepted; the render side re-checks as well. */
401
+ bugReportUrl: z
402
+ .union([z.literal(''), z.url({ protocol: /^https?$/ })])
403
+ .optional(),
398
404
  }),
399
405
  content: z.object({
400
406
  aboutPage: z.string().optional(),