@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.
- package/dist/lib/postHelpers.d.ts +1 -1
- package/dist/lib/reactions.d.ts +9 -5
- package/dist/lib/reactions.js +9 -5
- package/dist/lib/resources.d.ts +2 -2
- package/dist/lib/resources.js +2 -2
- package/dist/types/api.d.ts +132 -81
- package/dist/types/api.js +3 -0
- package/dist/types/config.d.ts +13 -0
- package/dist/types/config.js +17 -0
- package/dist/types/db.d.ts +29 -63
- package/dist/types/export.d.ts +54 -118
- package/dist/types/export.js +35 -5
- package/dist/types/internal.d.ts +54 -90
- package/dist/types/models.d.ts +28 -40
- package/dist/types/models.js +23 -8
- package/dist/types/stats.d.ts +116 -72
- package/package.json +1 -1
- package/src/lib/reactions.ts +10 -9
- package/src/lib/resources.ts +2 -1
- package/src/types/api.ts +9 -0
- package/src/types/config.ts +18 -0
- package/src/types/export.ts +56 -6
- package/src/types/models.ts +27 -9
|
@@ -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<
|
|
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[];
|
package/dist/lib/reactions.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
package/dist/lib/reactions.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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;
|
package/dist/lib/resources.d.ts
CHANGED
|
@@ -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";
|
package/dist/lib/resources.js
CHANGED
|
@@ -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) => {
|