@openpeepshq/common 0.13.0 → 0.15.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.
@@ -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<string, 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[];
@@ -1,8 +1,12 @@
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"];
1
+ export declare const AP_LIKE_REACTION = "\uD83D\uDC4D";
2
+ /**
3
+ * Whether a logged reaction value is usable: a non-empty emoji string.
4
+ * The community may configure a custom allowed set, so this no longer
5
+ * restricts to the curated defaults — it only guards against malformed/empty
6
+ * entries so response validation cannot fail on legacy logs. Reactions that
7
+ * were attached before being removed from the configured set still pass.
8
+ */
9
+ export declare const isReactionType: (reaction: string) => boolean;
6
10
  export type ReactionLogEntry = {
7
11
  type: string;
8
12
  createdAt: string;
@@ -1,8 +1,12 @@
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);
1
+ export const AP_LIKE_REACTION = '👍';
2
+ /**
3
+ * Whether a logged reaction value is usable: a non-empty emoji string.
4
+ * The community may configure a custom allowed set, so this no longer
5
+ * restricts to the curated defaults — it only guards against malformed/empty
6
+ * entries so response validation cannot fail on legacy logs. Reactions that
7
+ * were attached before being removed from the configured set still pass.
8
+ */
9
+ export const isReactionType = (reaction) => typeof reaction === 'string' && reaction.trim().length > 0;
6
10
  const reactionFromData = (data) => {
7
11
  if (!data || typeof data !== 'object' || !('reaction' in data)) {
8
12
  return undefined;
@@ -1,5 +1,5 @@
1
- import { RESOURCE_TITLE_MAX_LENGTH, type MediaAttachmentData, type ResourceKind, type VisibilityType } from '../types/models';
2
- export { RESOURCE_TITLE_MAX_LENGTH };
1
+ import { RESOURCE_CATEGORY_NAME_MAX_LENGTH, RESOURCE_TITLE_MAX_LENGTH, type MediaAttachmentData, type ResourceKind, type VisibilityType } from '../types/models';
2
+ export { RESOURCE_CATEGORY_NAME_MAX_LENGTH, RESOURCE_TITLE_MAX_LENGTH };
3
3
  export declare const isValidResourceUrl: (url: string | undefined) => boolean;
4
4
  export declare const RESOURCE_KINDS: readonly ["video", "file", "gallery", "audio", "link"];
5
5
  export declare const attachmentMediaKind: (att: Pick<MediaAttachmentData, "type" | "meta">) => "image" | "video" | "audio" | "file";
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { RESOURCE_TITLE_MAX_LENGTH, visibilityTypeValues, } from '../types/models.js';
3
- export { RESOURCE_TITLE_MAX_LENGTH };
2
+ import { RESOURCE_CATEGORY_NAME_MAX_LENGTH, RESOURCE_TITLE_MAX_LENGTH, visibilityTypeValues, } from '../types/models.js';
3
+ export { RESOURCE_CATEGORY_NAME_MAX_LENGTH, RESOURCE_TITLE_MAX_LENGTH };
4
4
  /** Matches `resourcePostSchema.url` (`z.url()`), after trimming. */
5
5
  const resourceUrlSchema = z.url();
6
6
  export const isValidResourceUrl = (url) => {