@openpeepshq/common 0.10.0 → 0.11.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 +3 -3
- package/dist/lib/postHelpers.js +2 -2
- package/dist/lib/reactions.d.ts +5 -3
- package/dist/lib/reactions.js +5 -9
- package/dist/types/api.d.ts +81 -0
- package/dist/types/api.js +16 -0
- package/dist/types/db.d.ts +42 -0
- package/dist/types/internal.d.ts +60 -0
- package/dist/types/models.d.ts +31 -0
- package/dist/types/models.js +16 -1
- package/dist/types/stats.d.ts +48 -0
- package/package.json +1 -1
- package/src/lib/postHelpers.ts +2 -2
- package/src/lib/reactions.ts +8 -8
- package/src/types/api.ts +35 -0
- package/src/types/models.ts +17 -1
|
@@ -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<"👍" | "👎" | "❤️" | "😂" | "😮" | "😢" | "🎉", 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[];
|
|
@@ -298,10 +298,10 @@ export type PostActionAvailability = {
|
|
|
298
298
|
canReact: boolean;
|
|
299
299
|
};
|
|
300
300
|
/**
|
|
301
|
-
* Whether Reply / Repost /
|
|
301
|
+
* Whether Reply / Repost / React should look live. Non-members of a group
|
|
302
302
|
* post stay fully disabled (existing feed rule). Each action also follows
|
|
303
303
|
* the capability the matching write endpoint actually checks: feed replies
|
|
304
|
-
* and reposts need create-*,
|
|
304
|
+
* and reposts need create-*, reactions need core-posts-react.
|
|
305
305
|
*/
|
|
306
306
|
export declare const getPostActionAvailability: (authData: AuthorizationData, post: PublicPost, config: CapabilitiesConfig) => PostActionAvailability;
|
|
307
307
|
/** Sentinel handle for block-hidden reply tombstones (no name/handle leak). */
|
package/dist/lib/postHelpers.js
CHANGED
|
@@ -473,10 +473,10 @@ export const canCreatePostTypeIgnoringScopes = (authData, type, visibilities = v
|
|
|
473
473
|
`core-posts-create-${type}-${visibility}`,
|
|
474
474
|
]).success);
|
|
475
475
|
/**
|
|
476
|
-
* Whether Reply / Repost /
|
|
476
|
+
* Whether Reply / Repost / React should look live. Non-members of a group
|
|
477
477
|
* post stay fully disabled (existing feed rule). Each action also follows
|
|
478
478
|
* the capability the matching write endpoint actually checks: feed replies
|
|
479
|
-
* and reposts need create-*,
|
|
479
|
+
* and reposts need create-*, reactions need core-posts-react.
|
|
480
480
|
*/
|
|
481
481
|
export const getPostActionAvailability = (authData, post, config) => {
|
|
482
482
|
const isGroupPost = !!post.groupId || !!post.group;
|
package/dist/lib/reactions.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
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"];
|
|
4
6
|
export type ReactionLogEntry = {
|
|
5
7
|
type: string;
|
|
6
8
|
createdAt: string;
|
package/dist/lib/reactions.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (reaction === AP_DISLIKE_REACTION)
|
|
7
|
-
return 'Dislike';
|
|
8
|
-
return null;
|
|
9
|
-
};
|
|
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);
|
|
10
6
|
const reactionFromData = (data) => {
|
|
11
7
|
if (!data || typeof data !== 'object' || !('reaction' in data)) {
|
|
12
8
|
return undefined;
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1652,6 +1652,12 @@ export type EntryWithPublicProfile = z.infer<typeof entryWithPublicProfileSchema
|
|
|
1652
1652
|
declare const reactionWithPublicProfileSchema: z.ZodObject<{
|
|
1653
1653
|
reaction: z.ZodEnum<{
|
|
1654
1654
|
"\uD83D\uDC4D": "👍";
|
|
1655
|
+
"\uD83D\uDC4E": "👎";
|
|
1656
|
+
"\u2764\uFE0F": "❤️";
|
|
1657
|
+
"\uD83D\uDE02": "😂";
|
|
1658
|
+
"\uD83D\uDE2E": "😮";
|
|
1659
|
+
"\uD83D\uDE22": "😢";
|
|
1660
|
+
"\uD83C\uDF89": "🎉";
|
|
1655
1661
|
}>;
|
|
1656
1662
|
profile: z.ZodObject<{
|
|
1657
1663
|
id: z.ZodString;
|
|
@@ -7087,6 +7093,12 @@ export declare const publicPostSchema: z.ZodObject<{
|
|
|
7087
7093
|
reactions: z.ZodArray<z.ZodObject<{
|
|
7088
7094
|
reaction: z.ZodEnum<{
|
|
7089
7095
|
"\uD83D\uDC4D": "👍";
|
|
7096
|
+
"\uD83D\uDC4E": "👎";
|
|
7097
|
+
"\u2764\uFE0F": "❤️";
|
|
7098
|
+
"\uD83D\uDE02": "😂";
|
|
7099
|
+
"\uD83D\uDE2E": "😮";
|
|
7100
|
+
"\uD83D\uDE22": "😢";
|
|
7101
|
+
"\uD83C\uDF89": "🎉";
|
|
7090
7102
|
}>;
|
|
7091
7103
|
profile: z.ZodObject<{
|
|
7092
7104
|
id: z.ZodString;
|
|
@@ -17731,6 +17743,12 @@ export declare const publicPostSchema: z.ZodObject<{
|
|
|
17731
17743
|
reactions: z.ZodArray<z.ZodObject<{
|
|
17732
17744
|
reaction: z.ZodEnum<{
|
|
17733
17745
|
"\uD83D\uDC4D": "👍";
|
|
17746
|
+
"\uD83D\uDC4E": "👎";
|
|
17747
|
+
"\u2764\uFE0F": "❤️";
|
|
17748
|
+
"\uD83D\uDE02": "😂";
|
|
17749
|
+
"\uD83D\uDE2E": "😮";
|
|
17750
|
+
"\uD83D\uDE22": "😢";
|
|
17751
|
+
"\uD83C\uDF89": "🎉";
|
|
17734
17752
|
}>;
|
|
17735
17753
|
profile: z.ZodObject<{
|
|
17736
17754
|
id: z.ZodString;
|
|
@@ -23562,6 +23580,12 @@ export declare const publicNotificationSchema: z.ZodObject<{
|
|
|
23562
23580
|
reactions: z.ZodArray<z.ZodObject<{
|
|
23563
23581
|
reaction: z.ZodEnum<{
|
|
23564
23582
|
"\uD83D\uDC4D": "👍";
|
|
23583
|
+
"\uD83D\uDC4E": "👎";
|
|
23584
|
+
"\u2764\uFE0F": "❤️";
|
|
23585
|
+
"\uD83D\uDE02": "😂";
|
|
23586
|
+
"\uD83D\uDE2E": "😮";
|
|
23587
|
+
"\uD83D\uDE22": "😢";
|
|
23588
|
+
"\uD83C\uDF89": "🎉";
|
|
23565
23589
|
}>;
|
|
23566
23590
|
profile: z.ZodObject<{
|
|
23567
23591
|
id: z.ZodString;
|
|
@@ -34206,6 +34230,12 @@ export declare const publicNotificationSchema: z.ZodObject<{
|
|
|
34206
34230
|
reactions: z.ZodArray<z.ZodObject<{
|
|
34207
34231
|
reaction: z.ZodEnum<{
|
|
34208
34232
|
"\uD83D\uDC4D": "👍";
|
|
34233
|
+
"\uD83D\uDC4E": "👎";
|
|
34234
|
+
"\u2764\uFE0F": "❤️";
|
|
34235
|
+
"\uD83D\uDE02": "😂";
|
|
34236
|
+
"\uD83D\uDE2E": "😮";
|
|
34237
|
+
"\uD83D\uDE22": "😢";
|
|
34238
|
+
"\uD83C\uDF89": "🎉";
|
|
34209
34239
|
}>;
|
|
34210
34240
|
profile: z.ZodObject<{
|
|
34211
34241
|
id: z.ZodString;
|
|
@@ -41075,6 +41105,12 @@ export declare const publicReportSchema: z.ZodObject<{
|
|
|
41075
41105
|
reactions: z.ZodArray<z.ZodObject<{
|
|
41076
41106
|
reaction: z.ZodEnum<{
|
|
41077
41107
|
"\uD83D\uDC4D": "👍";
|
|
41108
|
+
"\uD83D\uDC4E": "👎";
|
|
41109
|
+
"\u2764\uFE0F": "❤️";
|
|
41110
|
+
"\uD83D\uDE02": "😂";
|
|
41111
|
+
"\uD83D\uDE2E": "😮";
|
|
41112
|
+
"\uD83D\uDE22": "😢";
|
|
41113
|
+
"\uD83C\uDF89": "🎉";
|
|
41078
41114
|
}>;
|
|
41079
41115
|
profile: z.ZodObject<{
|
|
41080
41116
|
id: z.ZodString;
|
|
@@ -51719,6 +51755,12 @@ export declare const publicReportSchema: z.ZodObject<{
|
|
|
51719
51755
|
reactions: z.ZodArray<z.ZodObject<{
|
|
51720
51756
|
reaction: z.ZodEnum<{
|
|
51721
51757
|
"\uD83D\uDC4D": "👍";
|
|
51758
|
+
"\uD83D\uDC4E": "👎";
|
|
51759
|
+
"\u2764\uFE0F": "❤️";
|
|
51760
|
+
"\uD83D\uDE02": "😂";
|
|
51761
|
+
"\uD83D\uDE2E": "😮";
|
|
51762
|
+
"\uD83D\uDE22": "😢";
|
|
51763
|
+
"\uD83C\uDF89": "🎉";
|
|
51722
51764
|
}>;
|
|
51723
51765
|
profile: z.ZodObject<{
|
|
51724
51766
|
id: z.ZodString;
|
|
@@ -55610,6 +55652,33 @@ export declare const chronologicalInfiniteQueryParamsSchema: z.ZodObject<{
|
|
|
55610
55652
|
ungrouped: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
55611
55653
|
}, z.core.$strip>;
|
|
55612
55654
|
export type ChronologicalInfiniteQueryParams = z.infer<typeof chronologicalInfiniteQueryParamsSchema> | undefined;
|
|
55655
|
+
/**
|
|
55656
|
+
* Notifications feed query. `excludeTypes` is comma-joined because fetch
|
|
55657
|
+
* query params only allow string | number; the server splits it back.
|
|
55658
|
+
*/
|
|
55659
|
+
export type NotificationFeedQueryParams = ChronologicalInfiniteQueryParams & NotificationFeedExcludeTypesQuery;
|
|
55660
|
+
/**
|
|
55661
|
+
* The `excludeTypes` query param of the notifications feed `GET` and the
|
|
55662
|
+
* mark-all-seen `PUT`, shared by both client endpoint declarations so the two
|
|
55663
|
+
* can't drift from each other or from `excludeTypesQuerySchema` (whose parse
|
|
55664
|
+
* consumes exactly this comma-joined string).
|
|
55665
|
+
*/
|
|
55666
|
+
export type NotificationFeedExcludeTypesQuery = {
|
|
55667
|
+
excludeTypes?: string;
|
|
55668
|
+
};
|
|
55669
|
+
/**
|
|
55670
|
+
* Server-side schema for the notifications `excludeTypes` query param. The
|
|
55671
|
+
* client sends a comma-joined string (fetch query params only allow
|
|
55672
|
+
* string | number); this splits it back into a list of type keys. Shared by
|
|
55673
|
+
* the feed `GET` and the mark-all-seen `PUT` so the two can't drift.
|
|
55674
|
+
*
|
|
55675
|
+
* The parse must be idempotent: Riddl validates the query before the handler
|
|
55676
|
+
* and the handlers re-parse the already-parsed value, so the second pass sees
|
|
55677
|
+
* the array this transform produces. Accepting the array (union) in addition
|
|
55678
|
+
* to the string keeps both passes stable; a plain `z.string()` would reject
|
|
55679
|
+
* the array and 500 the endpoint.
|
|
55680
|
+
*/
|
|
55681
|
+
export declare const excludeTypesQuerySchema: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>>;
|
|
55613
55682
|
export declare const offsetInfiniteQueryParamsSchema: z.ZodObject<{
|
|
55614
55683
|
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
55615
55684
|
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -57344,6 +57413,12 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
|
|
|
57344
57413
|
reactions: z.ZodArray<z.ZodObject<{
|
|
57345
57414
|
reaction: z.ZodEnum<{
|
|
57346
57415
|
"\uD83D\uDC4D": "👍";
|
|
57416
|
+
"\uD83D\uDC4E": "👎";
|
|
57417
|
+
"\u2764\uFE0F": "❤️";
|
|
57418
|
+
"\uD83D\uDE02": "😂";
|
|
57419
|
+
"\uD83D\uDE2E": "😮";
|
|
57420
|
+
"\uD83D\uDE22": "😢";
|
|
57421
|
+
"\uD83C\uDF89": "🎉";
|
|
57347
57422
|
}>;
|
|
57348
57423
|
profile: z.ZodObject<{
|
|
57349
57424
|
id: z.ZodString;
|
|
@@ -67988,6 +68063,12 @@ export declare const directMessageSearchHitSchema: z.ZodObject<{
|
|
|
67988
68063
|
reactions: z.ZodArray<z.ZodObject<{
|
|
67989
68064
|
reaction: z.ZodEnum<{
|
|
67990
68065
|
"\uD83D\uDC4D": "👍";
|
|
68066
|
+
"\uD83D\uDC4E": "👎";
|
|
68067
|
+
"\u2764\uFE0F": "❤️";
|
|
68068
|
+
"\uD83D\uDE02": "😂";
|
|
68069
|
+
"\uD83D\uDE2E": "😮";
|
|
68070
|
+
"\uD83D\uDE22": "😢";
|
|
68071
|
+
"\uD83C\uDF89": "🎉";
|
|
67991
68072
|
}>;
|
|
67992
68073
|
profile: z.ZodObject<{
|
|
67993
68074
|
id: z.ZodString;
|
package/dist/types/api.js
CHANGED
|
@@ -499,6 +499,22 @@ export const chronologicalInfiniteQueryParamsSchema = z.object({
|
|
|
499
499
|
/** Query-string flag; fetch params only allow string | number. */
|
|
500
500
|
ungrouped: z.literal('true').optional(),
|
|
501
501
|
});
|
|
502
|
+
/**
|
|
503
|
+
* Server-side schema for the notifications `excludeTypes` query param. The
|
|
504
|
+
* client sends a comma-joined string (fetch query params only allow
|
|
505
|
+
* string | number); this splits it back into a list of type keys. Shared by
|
|
506
|
+
* the feed `GET` and the mark-all-seen `PUT` so the two can't drift.
|
|
507
|
+
*
|
|
508
|
+
* The parse must be idempotent: Riddl validates the query before the handler
|
|
509
|
+
* and the handlers re-parse the already-parsed value, so the second pass sees
|
|
510
|
+
* the array this transform produces. Accepting the array (union) in addition
|
|
511
|
+
* to the string keeps both passes stable; a plain `z.string()` would reject
|
|
512
|
+
* the array and 500 the endpoint.
|
|
513
|
+
*/
|
|
514
|
+
export const excludeTypesQuerySchema = z
|
|
515
|
+
.union([z.string(), z.array(z.string())])
|
|
516
|
+
.transform((value) => (Array.isArray(value) ? value : value.split(',')).filter(Boolean))
|
|
517
|
+
.optional();
|
|
502
518
|
export const offsetInfiniteQueryParamsSchema = z.object({
|
|
503
519
|
offset: z.coerce.number().optional(),
|
|
504
520
|
limit: z.coerce.number().optional(),
|
package/dist/types/db.d.ts
CHANGED
|
@@ -1537,6 +1537,12 @@ export declare const dbBasePostSchema: z.ZodObject<{
|
|
|
1537
1537
|
reactions: z.ZodArray<z.ZodObject<{
|
|
1538
1538
|
reaction: z.ZodEnum<{
|
|
1539
1539
|
"\uD83D\uDC4D": "👍";
|
|
1540
|
+
"\uD83D\uDC4E": "👎";
|
|
1541
|
+
"\u2764\uFE0F": "❤️";
|
|
1542
|
+
"\uD83D\uDE02": "😂";
|
|
1543
|
+
"\uD83D\uDE2E": "😮";
|
|
1544
|
+
"\uD83D\uDE22": "😢";
|
|
1545
|
+
"\uD83C\uDF89": "🎉";
|
|
1540
1546
|
}>;
|
|
1541
1547
|
profile: z.ZodObject<{
|
|
1542
1548
|
handle: z.ZodString;
|
|
@@ -3172,6 +3178,12 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
|
|
|
3172
3178
|
reactions: z.ZodArray<z.ZodObject<{
|
|
3173
3179
|
reaction: z.ZodEnum<{
|
|
3174
3180
|
"\uD83D\uDC4D": "👍";
|
|
3181
|
+
"\uD83D\uDC4E": "👎";
|
|
3182
|
+
"\u2764\uFE0F": "❤️";
|
|
3183
|
+
"\uD83D\uDE02": "😂";
|
|
3184
|
+
"\uD83D\uDE2E": "😮";
|
|
3185
|
+
"\uD83D\uDE22": "😢";
|
|
3186
|
+
"\uD83C\uDF89": "🎉";
|
|
3175
3187
|
}>;
|
|
3176
3188
|
profile: z.ZodObject<{
|
|
3177
3189
|
handle: z.ZodString;
|
|
@@ -4786,6 +4798,12 @@ export declare const dbPostWithReplySchema: z.ZodObject<{
|
|
|
4786
4798
|
reactions: z.ZodArray<z.ZodObject<{
|
|
4787
4799
|
reaction: z.ZodEnum<{
|
|
4788
4800
|
"\uD83D\uDC4D": "👍";
|
|
4801
|
+
"\uD83D\uDC4E": "👎";
|
|
4802
|
+
"\u2764\uFE0F": "❤️";
|
|
4803
|
+
"\uD83D\uDE02": "😂";
|
|
4804
|
+
"\uD83D\uDE2E": "😮";
|
|
4805
|
+
"\uD83D\uDE22": "😢";
|
|
4806
|
+
"\uD83C\uDF89": "🎉";
|
|
4789
4807
|
}>;
|
|
4790
4808
|
profile: z.ZodObject<{
|
|
4791
4809
|
handle: z.ZodString;
|
|
@@ -6403,6 +6421,12 @@ export declare const dbPostSchema: z.ZodObject<{
|
|
|
6403
6421
|
reactions: z.ZodArray<z.ZodObject<{
|
|
6404
6422
|
reaction: z.ZodEnum<{
|
|
6405
6423
|
"\uD83D\uDC4D": "👍";
|
|
6424
|
+
"\uD83D\uDC4E": "👎";
|
|
6425
|
+
"\u2764\uFE0F": "❤️";
|
|
6426
|
+
"\uD83D\uDE02": "😂";
|
|
6427
|
+
"\uD83D\uDE2E": "😮";
|
|
6428
|
+
"\uD83D\uDE22": "😢";
|
|
6429
|
+
"\uD83C\uDF89": "🎉";
|
|
6406
6430
|
}>;
|
|
6407
6431
|
profile: z.ZodObject<{
|
|
6408
6432
|
handle: z.ZodString;
|
|
@@ -8017,6 +8041,12 @@ export declare const dbPostSchema: z.ZodObject<{
|
|
|
8017
8041
|
reactions: z.ZodArray<z.ZodObject<{
|
|
8018
8042
|
reaction: z.ZodEnum<{
|
|
8019
8043
|
"\uD83D\uDC4D": "👍";
|
|
8044
|
+
"\uD83D\uDC4E": "👎";
|
|
8045
|
+
"\u2764\uFE0F": "❤️";
|
|
8046
|
+
"\uD83D\uDE02": "😂";
|
|
8047
|
+
"\uD83D\uDE2E": "😮";
|
|
8048
|
+
"\uD83D\uDE22": "😢";
|
|
8049
|
+
"\uD83C\uDF89": "🎉";
|
|
8020
8050
|
}>;
|
|
8021
8051
|
profile: z.ZodObject<{
|
|
8022
8052
|
handle: z.ZodString;
|
|
@@ -9633,6 +9663,12 @@ export declare const dbPostSchema: z.ZodObject<{
|
|
|
9633
9663
|
reactions: z.ZodArray<z.ZodObject<{
|
|
9634
9664
|
reaction: z.ZodEnum<{
|
|
9635
9665
|
"\uD83D\uDC4D": "👍";
|
|
9666
|
+
"\uD83D\uDC4E": "👎";
|
|
9667
|
+
"\u2764\uFE0F": "❤️";
|
|
9668
|
+
"\uD83D\uDE02": "😂";
|
|
9669
|
+
"\uD83D\uDE2E": "😮";
|
|
9670
|
+
"\uD83D\uDE22": "😢";
|
|
9671
|
+
"\uD83C\uDF89": "🎉";
|
|
9636
9672
|
}>;
|
|
9637
9673
|
profile: z.ZodObject<{
|
|
9638
9674
|
handle: z.ZodString;
|
|
@@ -11247,6 +11283,12 @@ export declare const dbPostSchema: z.ZodObject<{
|
|
|
11247
11283
|
reactions: z.ZodArray<z.ZodObject<{
|
|
11248
11284
|
reaction: z.ZodEnum<{
|
|
11249
11285
|
"\uD83D\uDC4D": "👍";
|
|
11286
|
+
"\uD83D\uDC4E": "👎";
|
|
11287
|
+
"\u2764\uFE0F": "❤️";
|
|
11288
|
+
"\uD83D\uDE02": "😂";
|
|
11289
|
+
"\uD83D\uDE2E": "😮";
|
|
11290
|
+
"\uD83D\uDE22": "😢";
|
|
11291
|
+
"\uD83C\uDF89": "🎉";
|
|
11250
11292
|
}>;
|
|
11251
11293
|
profile: z.ZodObject<{
|
|
11252
11294
|
handle: z.ZodString;
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -957,6 +957,12 @@ export type MentionWithProfile = z.infer<typeof mentionWithProfileSchema>;
|
|
|
957
957
|
declare const reactionWithProfileSchema: z.ZodObject<{
|
|
958
958
|
reaction: z.ZodEnum<{
|
|
959
959
|
"\uD83D\uDC4D": "👍";
|
|
960
|
+
"\uD83D\uDC4E": "👎";
|
|
961
|
+
"\u2764\uFE0F": "❤️";
|
|
962
|
+
"\uD83D\uDE02": "😂";
|
|
963
|
+
"\uD83D\uDE2E": "😮";
|
|
964
|
+
"\uD83D\uDE22": "😢";
|
|
965
|
+
"\uD83C\uDF89": "🎉";
|
|
960
966
|
}>;
|
|
961
967
|
profile: z.ZodObject<{
|
|
962
968
|
handle: z.ZodString;
|
|
@@ -9158,6 +9164,12 @@ declare const basePostSchema: z.ZodObject<{
|
|
|
9158
9164
|
reactions: z.ZodArray<z.ZodObject<{
|
|
9159
9165
|
reaction: z.ZodEnum<{
|
|
9160
9166
|
"\uD83D\uDC4D": "👍";
|
|
9167
|
+
"\uD83D\uDC4E": "👎";
|
|
9168
|
+
"\u2764\uFE0F": "❤️";
|
|
9169
|
+
"\uD83D\uDE02": "😂";
|
|
9170
|
+
"\uD83D\uDE2E": "😮";
|
|
9171
|
+
"\uD83D\uDE22": "😢";
|
|
9172
|
+
"\uD83C\uDF89": "🎉";
|
|
9161
9173
|
}>;
|
|
9162
9174
|
profile: z.ZodObject<{
|
|
9163
9175
|
handle: z.ZodString;
|
|
@@ -12876,6 +12888,12 @@ export declare const postWithMetaSchema: z.ZodObject<{
|
|
|
12876
12888
|
reactions: z.ZodArray<z.ZodObject<{
|
|
12877
12889
|
reaction: z.ZodEnum<{
|
|
12878
12890
|
"\uD83D\uDC4D": "👍";
|
|
12891
|
+
"\uD83D\uDC4E": "👎";
|
|
12892
|
+
"\u2764\uFE0F": "❤️";
|
|
12893
|
+
"\uD83D\uDE02": "😂";
|
|
12894
|
+
"\uD83D\uDE2E": "😮";
|
|
12895
|
+
"\uD83D\uDE22": "😢";
|
|
12896
|
+
"\uD83C\uDF89": "🎉";
|
|
12879
12897
|
}>;
|
|
12880
12898
|
profile: z.ZodObject<{
|
|
12881
12899
|
handle: z.ZodString;
|
|
@@ -19256,6 +19274,12 @@ export declare const postWithMetaSchema: z.ZodObject<{
|
|
|
19256
19274
|
reactions: z.ZodArray<z.ZodObject<{
|
|
19257
19275
|
reaction: z.ZodEnum<{
|
|
19258
19276
|
"\uD83D\uDC4D": "👍";
|
|
19277
|
+
"\uD83D\uDC4E": "👎";
|
|
19278
|
+
"\u2764\uFE0F": "❤️";
|
|
19279
|
+
"\uD83D\uDE02": "😂";
|
|
19280
|
+
"\uD83D\uDE2E": "😮";
|
|
19281
|
+
"\uD83D\uDE22": "😢";
|
|
19282
|
+
"\uD83C\uDF89": "🎉";
|
|
19259
19283
|
}>;
|
|
19260
19284
|
profile: z.ZodObject<{
|
|
19261
19285
|
handle: z.ZodString;
|
|
@@ -23523,6 +23547,12 @@ export declare const expandedNotificationSchema: z.ZodObject<{
|
|
|
23523
23547
|
reactions: z.ZodArray<z.ZodObject<{
|
|
23524
23548
|
reaction: z.ZodEnum<{
|
|
23525
23549
|
"\uD83D\uDC4D": "👍";
|
|
23550
|
+
"\uD83D\uDC4E": "👎";
|
|
23551
|
+
"\u2764\uFE0F": "❤️";
|
|
23552
|
+
"\uD83D\uDE02": "😂";
|
|
23553
|
+
"\uD83D\uDE2E": "😮";
|
|
23554
|
+
"\uD83D\uDE22": "😢";
|
|
23555
|
+
"\uD83C\uDF89": "🎉";
|
|
23526
23556
|
}>;
|
|
23527
23557
|
profile: z.ZodObject<{
|
|
23528
23558
|
handle: z.ZodString;
|
|
@@ -29903,6 +29933,12 @@ export declare const expandedNotificationSchema: z.ZodObject<{
|
|
|
29903
29933
|
reactions: z.ZodArray<z.ZodObject<{
|
|
29904
29934
|
reaction: z.ZodEnum<{
|
|
29905
29935
|
"\uD83D\uDC4D": "👍";
|
|
29936
|
+
"\uD83D\uDC4E": "👎";
|
|
29937
|
+
"\u2764\uFE0F": "❤️";
|
|
29938
|
+
"\uD83D\uDE02": "😂";
|
|
29939
|
+
"\uD83D\uDE2E": "😮";
|
|
29940
|
+
"\uD83D\uDE22": "😢";
|
|
29941
|
+
"\uD83C\uDF89": "🎉";
|
|
29906
29942
|
}>;
|
|
29907
29943
|
profile: z.ZodObject<{
|
|
29908
29944
|
handle: z.ZodString;
|
|
@@ -34942,6 +34978,12 @@ export declare const reportWithMetaSchema: z.ZodObject<{
|
|
|
34942
34978
|
reactions: z.ZodArray<z.ZodObject<{
|
|
34943
34979
|
reaction: z.ZodEnum<{
|
|
34944
34980
|
"\uD83D\uDC4D": "👍";
|
|
34981
|
+
"\uD83D\uDC4E": "👎";
|
|
34982
|
+
"\u2764\uFE0F": "❤️";
|
|
34983
|
+
"\uD83D\uDE02": "😂";
|
|
34984
|
+
"\uD83D\uDE2E": "😮";
|
|
34985
|
+
"\uD83D\uDE22": "😢";
|
|
34986
|
+
"\uD83C\uDF89": "🎉";
|
|
34945
34987
|
}>;
|
|
34946
34988
|
profile: z.ZodObject<{
|
|
34947
34989
|
handle: z.ZodString;
|
|
@@ -41322,6 +41364,12 @@ export declare const reportWithMetaSchema: z.ZodObject<{
|
|
|
41322
41364
|
reactions: z.ZodArray<z.ZodObject<{
|
|
41323
41365
|
reaction: z.ZodEnum<{
|
|
41324
41366
|
"\uD83D\uDC4D": "👍";
|
|
41367
|
+
"\uD83D\uDC4E": "👎";
|
|
41368
|
+
"\u2764\uFE0F": "❤️";
|
|
41369
|
+
"\uD83D\uDE02": "😂";
|
|
41370
|
+
"\uD83D\uDE2E": "😮";
|
|
41371
|
+
"\uD83D\uDE22": "😢";
|
|
41372
|
+
"\uD83C\uDF89": "🎉";
|
|
41325
41373
|
}>;
|
|
41326
41374
|
profile: z.ZodObject<{
|
|
41327
41375
|
handle: z.ZodString;
|
|
@@ -45338,6 +45386,12 @@ export declare const jamRecordingWithMetaSchema: z.ZodObject<{
|
|
|
45338
45386
|
reactions: z.ZodArray<z.ZodObject<{
|
|
45339
45387
|
reaction: z.ZodEnum<{
|
|
45340
45388
|
"\uD83D\uDC4D": "👍";
|
|
45389
|
+
"\uD83D\uDC4E": "👎";
|
|
45390
|
+
"\u2764\uFE0F": "❤️";
|
|
45391
|
+
"\uD83D\uDE02": "😂";
|
|
45392
|
+
"\uD83D\uDE2E": "😮";
|
|
45393
|
+
"\uD83D\uDE22": "😢";
|
|
45394
|
+
"\uD83C\uDF89": "🎉";
|
|
45341
45395
|
}>;
|
|
45342
45396
|
profile: z.ZodObject<{
|
|
45343
45397
|
handle: z.ZodString;
|
|
@@ -51718,6 +51772,12 @@ export declare const jamRecordingWithMetaSchema: z.ZodObject<{
|
|
|
51718
51772
|
reactions: z.ZodArray<z.ZodObject<{
|
|
51719
51773
|
reaction: z.ZodEnum<{
|
|
51720
51774
|
"\uD83D\uDC4D": "👍";
|
|
51775
|
+
"\uD83D\uDC4E": "👎";
|
|
51776
|
+
"\u2764\uFE0F": "❤️";
|
|
51777
|
+
"\uD83D\uDE02": "😂";
|
|
51778
|
+
"\uD83D\uDE2E": "😮";
|
|
51779
|
+
"\uD83D\uDE22": "😢";
|
|
51780
|
+
"\uD83C\uDF89": "🎉";
|
|
51721
51781
|
}>;
|
|
51722
51782
|
profile: z.ZodObject<{
|
|
51723
51783
|
handle: z.ZodString;
|
package/dist/types/models.d.ts
CHANGED
|
@@ -161,6 +161,7 @@ export declare const profileSettingsDataSchema: z.ZodObject<{
|
|
|
161
161
|
push: z.ZodBoolean;
|
|
162
162
|
email: z.ZodBoolean;
|
|
163
163
|
}, z.core.$strip>>>;
|
|
164
|
+
hiddenNotificationTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
164
165
|
groupNotificationLevels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
165
166
|
all: "all";
|
|
166
167
|
mostRelevant: "mostRelevant";
|
|
@@ -217,6 +218,7 @@ export declare const profileSettingsSchema: z.ZodObject<{
|
|
|
217
218
|
push: z.ZodBoolean;
|
|
218
219
|
email: z.ZodBoolean;
|
|
219
220
|
}, z.core.$strip>>>;
|
|
221
|
+
hiddenNotificationTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
220
222
|
groupNotificationLevels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
221
223
|
all: "all";
|
|
222
224
|
mostRelevant: "mostRelevant";
|
|
@@ -3390,12 +3392,29 @@ export declare const pushSubscriptionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
3390
3392
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
3391
3393
|
}, z.core.$strip>], "type">;
|
|
3392
3394
|
export type PushSubscription = z.infer<typeof pushSubscriptionSchema>;
|
|
3395
|
+
/**
|
|
3396
|
+
* Reactions users can attach to a post. Single source of truth for the
|
|
3397
|
+
* picker UI and the API schema.
|
|
3398
|
+
*/
|
|
3399
|
+
export declare const REACTION_TYPES: readonly ["👍", "👎", "❤️", "😂", "😮", "😢", "🎉"];
|
|
3393
3400
|
export declare const reactionTypeSchema: z.ZodEnum<{
|
|
3394
3401
|
"\uD83D\uDC4D": "👍";
|
|
3402
|
+
"\uD83D\uDC4E": "👎";
|
|
3403
|
+
"\u2764\uFE0F": "❤️";
|
|
3404
|
+
"\uD83D\uDE02": "😂";
|
|
3405
|
+
"\uD83D\uDE2E": "😮";
|
|
3406
|
+
"\uD83D\uDE22": "😢";
|
|
3407
|
+
"\uD83C\uDF89": "🎉";
|
|
3395
3408
|
}>;
|
|
3396
3409
|
export declare const reactionDataSchema: z.ZodObject<{
|
|
3397
3410
|
reaction: z.ZodEnum<{
|
|
3398
3411
|
"\uD83D\uDC4D": "👍";
|
|
3412
|
+
"\uD83D\uDC4E": "👎";
|
|
3413
|
+
"\u2764\uFE0F": "❤️";
|
|
3414
|
+
"\uD83D\uDE02": "😂";
|
|
3415
|
+
"\uD83D\uDE2E": "😮";
|
|
3416
|
+
"\uD83D\uDE22": "😢";
|
|
3417
|
+
"\uD83C\uDF89": "🎉";
|
|
3399
3418
|
}>;
|
|
3400
3419
|
}, z.core.$strip>;
|
|
3401
3420
|
export type ReactionData = z.infer<typeof reactionDataSchema>;
|
|
@@ -3487,6 +3506,12 @@ export declare const jamEventDataSchema: z.ZodObject<{
|
|
|
3487
3506
|
content: z.ZodOptional<z.ZodString>;
|
|
3488
3507
|
reaction: z.ZodOptional<z.ZodEnum<{
|
|
3489
3508
|
"\uD83D\uDC4D": "👍";
|
|
3509
|
+
"\uD83D\uDC4E": "👎";
|
|
3510
|
+
"\u2764\uFE0F": "❤️";
|
|
3511
|
+
"\uD83D\uDE02": "😂";
|
|
3512
|
+
"\uD83D\uDE2E": "😮";
|
|
3513
|
+
"\uD83D\uDE22": "😢";
|
|
3514
|
+
"\uD83C\uDF89": "🎉";
|
|
3490
3515
|
}>>;
|
|
3491
3516
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
3492
3517
|
}, z.core.$strip>;
|
|
@@ -3509,6 +3534,12 @@ export declare const jamEventSchema: z.ZodObject<{
|
|
|
3509
3534
|
content: z.ZodOptional<z.ZodString>;
|
|
3510
3535
|
reaction: z.ZodOptional<z.ZodEnum<{
|
|
3511
3536
|
"\uD83D\uDC4D": "👍";
|
|
3537
|
+
"\uD83D\uDC4E": "👎";
|
|
3538
|
+
"\u2764\uFE0F": "❤️";
|
|
3539
|
+
"\uD83D\uDE02": "😂";
|
|
3540
|
+
"\uD83D\uDE2E": "😮";
|
|
3541
|
+
"\uD83D\uDE22": "😢";
|
|
3542
|
+
"\uD83C\uDF89": "🎉";
|
|
3512
3543
|
}>>;
|
|
3513
3544
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
3514
3545
|
id: z.ZodUUID;
|
package/dist/types/models.js
CHANGED
|
@@ -109,6 +109,8 @@ export const profileSettingsDataSchema = z.object({
|
|
|
109
109
|
theme: ThemeOptionsSchema.optional(),
|
|
110
110
|
defaults: profileSettingsDefaultsSchema.optional(),
|
|
111
111
|
notifications: z.record(z.string(), profileNotificationSettings).optional(),
|
|
112
|
+
/** Notification types hidden from the feed (display only; creation is unaffected). */
|
|
113
|
+
hiddenNotificationTypes: z.string().array().optional(),
|
|
112
114
|
/** Per-group level. A missing group id means all activity for that group. */
|
|
113
115
|
groupNotificationLevels: z
|
|
114
116
|
.record(z.string(), groupNotificationLevelSchema)
|
|
@@ -662,7 +664,20 @@ export const pushSubscriptionSchema = z.discriminatedUnion('type', [
|
|
|
662
664
|
modelSchema(pushSubscriptionFcmDataSchema),
|
|
663
665
|
modelSchema(pushSubscriptionWebhookDataSchema),
|
|
664
666
|
]);
|
|
665
|
-
|
|
667
|
+
/**
|
|
668
|
+
* Reactions users can attach to a post. Single source of truth for the
|
|
669
|
+
* picker UI and the API schema.
|
|
670
|
+
*/
|
|
671
|
+
export const REACTION_TYPES = [
|
|
672
|
+
'👍',
|
|
673
|
+
'👎',
|
|
674
|
+
'❤️',
|
|
675
|
+
'😂',
|
|
676
|
+
'😮',
|
|
677
|
+
'😢',
|
|
678
|
+
'🎉',
|
|
679
|
+
];
|
|
680
|
+
export const reactionTypeSchema = z.enum(REACTION_TYPES);
|
|
666
681
|
export const reactionDataSchema = z.object({
|
|
667
682
|
reaction: reactionTypeSchema,
|
|
668
683
|
});
|
package/dist/types/stats.d.ts
CHANGED
|
@@ -1740,6 +1740,12 @@ export declare const publicPostWithActivityScoreSchema: z.ZodObject<{
|
|
|
1740
1740
|
reactions: z.ZodArray<z.ZodObject<{
|
|
1741
1741
|
reaction: z.ZodEnum<{
|
|
1742
1742
|
"\uD83D\uDC4D": "👍";
|
|
1743
|
+
"\uD83D\uDC4E": "👎";
|
|
1744
|
+
"\u2764\uFE0F": "❤️";
|
|
1745
|
+
"\uD83D\uDE02": "😂";
|
|
1746
|
+
"\uD83D\uDE2E": "😮";
|
|
1747
|
+
"\uD83D\uDE22": "😢";
|
|
1748
|
+
"\uD83C\uDF89": "🎉";
|
|
1743
1749
|
}>;
|
|
1744
1750
|
profile: z.ZodObject<{
|
|
1745
1751
|
id: z.ZodString;
|
|
@@ -12384,6 +12390,12 @@ export declare const publicPostWithActivityScoreSchema: z.ZodObject<{
|
|
|
12384
12390
|
reactions: z.ZodArray<z.ZodObject<{
|
|
12385
12391
|
reaction: z.ZodEnum<{
|
|
12386
12392
|
"\uD83D\uDC4D": "👍";
|
|
12393
|
+
"\uD83D\uDC4E": "👎";
|
|
12394
|
+
"\u2764\uFE0F": "❤️";
|
|
12395
|
+
"\uD83D\uDE02": "😂";
|
|
12396
|
+
"\uD83D\uDE2E": "😮";
|
|
12397
|
+
"\uD83D\uDE22": "😢";
|
|
12398
|
+
"\uD83C\uDF89": "🎉";
|
|
12387
12399
|
}>;
|
|
12388
12400
|
profile: z.ZodObject<{
|
|
12389
12401
|
id: z.ZodString;
|
|
@@ -18067,6 +18079,12 @@ declare const topPostsListSchema: z.ZodArray<z.ZodObject<{
|
|
|
18067
18079
|
reactions: z.ZodArray<z.ZodObject<{
|
|
18068
18080
|
reaction: z.ZodEnum<{
|
|
18069
18081
|
"\uD83D\uDC4D": "👍";
|
|
18082
|
+
"\uD83D\uDC4E": "👎";
|
|
18083
|
+
"\u2764\uFE0F": "❤️";
|
|
18084
|
+
"\uD83D\uDE02": "😂";
|
|
18085
|
+
"\uD83D\uDE2E": "😮";
|
|
18086
|
+
"\uD83D\uDE22": "😢";
|
|
18087
|
+
"\uD83C\uDF89": "🎉";
|
|
18070
18088
|
}>;
|
|
18071
18089
|
profile: z.ZodObject<{
|
|
18072
18090
|
id: z.ZodString;
|
|
@@ -28711,6 +28729,12 @@ declare const topPostsListSchema: z.ZodArray<z.ZodObject<{
|
|
|
28711
28729
|
reactions: z.ZodArray<z.ZodObject<{
|
|
28712
28730
|
reaction: z.ZodEnum<{
|
|
28713
28731
|
"\uD83D\uDC4D": "👍";
|
|
28732
|
+
"\uD83D\uDC4E": "👎";
|
|
28733
|
+
"\u2764\uFE0F": "❤️";
|
|
28734
|
+
"\uD83D\uDE02": "😂";
|
|
28735
|
+
"\uD83D\uDE2E": "😮";
|
|
28736
|
+
"\uD83D\uDE22": "😢";
|
|
28737
|
+
"\uD83C\uDF89": "🎉";
|
|
28714
28738
|
}>;
|
|
28715
28739
|
profile: z.ZodObject<{
|
|
28716
28740
|
id: z.ZodString;
|
|
@@ -34664,6 +34688,12 @@ export declare const profileActivitySummarySchema: z.ZodObject<{
|
|
|
34664
34688
|
reactions: z.ZodArray<z.ZodObject<{
|
|
34665
34689
|
reaction: z.ZodEnum<{
|
|
34666
34690
|
"\uD83D\uDC4D": "👍";
|
|
34691
|
+
"\uD83D\uDC4E": "👎";
|
|
34692
|
+
"\u2764\uFE0F": "❤️";
|
|
34693
|
+
"\uD83D\uDE02": "😂";
|
|
34694
|
+
"\uD83D\uDE2E": "😮";
|
|
34695
|
+
"\uD83D\uDE22": "😢";
|
|
34696
|
+
"\uD83C\uDF89": "🎉";
|
|
34667
34697
|
}>;
|
|
34668
34698
|
profile: z.ZodObject<{
|
|
34669
34699
|
id: z.ZodString;
|
|
@@ -45308,6 +45338,12 @@ export declare const profileActivitySummarySchema: z.ZodObject<{
|
|
|
45308
45338
|
reactions: z.ZodArray<z.ZodObject<{
|
|
45309
45339
|
reaction: z.ZodEnum<{
|
|
45310
45340
|
"\uD83D\uDC4D": "👍";
|
|
45341
|
+
"\uD83D\uDC4E": "👎";
|
|
45342
|
+
"\u2764\uFE0F": "❤️";
|
|
45343
|
+
"\uD83D\uDE02": "😂";
|
|
45344
|
+
"\uD83D\uDE2E": "😮";
|
|
45345
|
+
"\uD83D\uDE22": "😢";
|
|
45346
|
+
"\uD83C\uDF89": "🎉";
|
|
45311
45347
|
}>;
|
|
45312
45348
|
profile: z.ZodObject<{
|
|
45313
45349
|
id: z.ZodString;
|
|
@@ -51002,6 +51038,12 @@ export declare const adminProfileSummarySchema: z.ZodObject<{
|
|
|
51002
51038
|
reactions: z.ZodArray<z.ZodObject<{
|
|
51003
51039
|
reaction: z.ZodEnum<{
|
|
51004
51040
|
"\uD83D\uDC4D": "👍";
|
|
51041
|
+
"\uD83D\uDC4E": "👎";
|
|
51042
|
+
"\u2764\uFE0F": "❤️";
|
|
51043
|
+
"\uD83D\uDE02": "😂";
|
|
51044
|
+
"\uD83D\uDE2E": "😮";
|
|
51045
|
+
"\uD83D\uDE22": "😢";
|
|
51046
|
+
"\uD83C\uDF89": "🎉";
|
|
51005
51047
|
}>;
|
|
51006
51048
|
profile: z.ZodObject<{
|
|
51007
51049
|
id: z.ZodString;
|
|
@@ -61646,6 +61688,12 @@ export declare const adminProfileSummarySchema: z.ZodObject<{
|
|
|
61646
61688
|
reactions: z.ZodArray<z.ZodObject<{
|
|
61647
61689
|
reaction: z.ZodEnum<{
|
|
61648
61690
|
"\uD83D\uDC4D": "👍";
|
|
61691
|
+
"\uD83D\uDC4E": "👎";
|
|
61692
|
+
"\u2764\uFE0F": "❤️";
|
|
61693
|
+
"\uD83D\uDE02": "😂";
|
|
61694
|
+
"\uD83D\uDE2E": "😮";
|
|
61695
|
+
"\uD83D\uDE22": "😢";
|
|
61696
|
+
"\uD83C\uDF89": "🎉";
|
|
61649
61697
|
}>;
|
|
61650
61698
|
profile: z.ZodObject<{
|
|
61651
61699
|
id: z.ZodString;
|
package/package.json
CHANGED
package/src/lib/postHelpers.ts
CHANGED
|
@@ -771,10 +771,10 @@ export type PostActionAvailability = {
|
|
|
771
771
|
};
|
|
772
772
|
|
|
773
773
|
/**
|
|
774
|
-
* Whether Reply / Repost /
|
|
774
|
+
* Whether Reply / Repost / React should look live. Non-members of a group
|
|
775
775
|
* post stay fully disabled (existing feed rule). Each action also follows
|
|
776
776
|
* the capability the matching write endpoint actually checks: feed replies
|
|
777
|
-
* and reposts need create-*,
|
|
777
|
+
* and reposts need create-*, reactions need core-posts-react.
|
|
778
778
|
*/
|
|
779
779
|
export const getPostActionAvailability = (
|
|
780
780
|
authData: AuthorizationData,
|
package/src/lib/reactions.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export const AP_DISLIKE_REACTION = '👎';
|
|
1
|
+
import { REACTION_TYPES, type ReactionData } from '../types';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
/** The legacy plain like a bodyless DELETE retracts for pre-picker clients. */
|
|
4
|
+
export const AP_LIKE_REACTION = REACTION_TYPES[0];
|
|
5
|
+
|
|
6
|
+
/** Whether a logged reaction value is one of the curated post reactions. */
|
|
7
|
+
export const isReactionType = (
|
|
5
8
|
reaction: string,
|
|
6
|
-
):
|
|
7
|
-
|
|
8
|
-
if (reaction === AP_DISLIKE_REACTION) return 'Dislike';
|
|
9
|
-
return null;
|
|
10
|
-
};
|
|
9
|
+
): reaction is ReactionData['reaction'] =>
|
|
10
|
+
(REACTION_TYPES as readonly string[]).includes(reaction);
|
|
11
11
|
|
|
12
12
|
export type ReactionLogEntry = {
|
|
13
13
|
type: string;
|
package/src/types/api.ts
CHANGED
|
@@ -775,6 +775,41 @@ export const chronologicalInfiniteQueryParamsSchema = z.object({
|
|
|
775
775
|
export type ChronologicalInfiniteQueryParams =
|
|
776
776
|
| z.infer<typeof chronologicalInfiniteQueryParamsSchema>
|
|
777
777
|
| undefined;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Notifications feed query. `excludeTypes` is comma-joined because fetch
|
|
781
|
+
* query params only allow string | number; the server splits it back.
|
|
782
|
+
*/
|
|
783
|
+
export type NotificationFeedQueryParams = ChronologicalInfiniteQueryParams &
|
|
784
|
+
NotificationFeedExcludeTypesQuery;
|
|
785
|
+
|
|
786
|
+
/**
|
|
787
|
+
* The `excludeTypes` query param of the notifications feed `GET` and the
|
|
788
|
+
* mark-all-seen `PUT`, shared by both client endpoint declarations so the two
|
|
789
|
+
* can't drift from each other or from `excludeTypesQuerySchema` (whose parse
|
|
790
|
+
* consumes exactly this comma-joined string).
|
|
791
|
+
*/
|
|
792
|
+
export type NotificationFeedExcludeTypesQuery = { excludeTypes?: string };
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Server-side schema for the notifications `excludeTypes` query param. The
|
|
796
|
+
* client sends a comma-joined string (fetch query params only allow
|
|
797
|
+
* string | number); this splits it back into a list of type keys. Shared by
|
|
798
|
+
* the feed `GET` and the mark-all-seen `PUT` so the two can't drift.
|
|
799
|
+
*
|
|
800
|
+
* The parse must be idempotent: Riddl validates the query before the handler
|
|
801
|
+
* and the handlers re-parse the already-parsed value, so the second pass sees
|
|
802
|
+
* the array this transform produces. Accepting the array (union) in addition
|
|
803
|
+
* to the string keeps both passes stable; a plain `z.string()` would reject
|
|
804
|
+
* the array and 500 the endpoint.
|
|
805
|
+
*/
|
|
806
|
+
export const excludeTypesQuerySchema = z
|
|
807
|
+
.union([z.string(), z.array(z.string())])
|
|
808
|
+
.transform((value) =>
|
|
809
|
+
(Array.isArray(value) ? value : value.split(',')).filter(Boolean),
|
|
810
|
+
)
|
|
811
|
+
.optional();
|
|
812
|
+
|
|
778
813
|
export const offsetInfiniteQueryParamsSchema = z.object({
|
|
779
814
|
offset: z.coerce.number().optional(),
|
|
780
815
|
limit: z.coerce.number().optional(),
|
package/src/types/models.ts
CHANGED
|
@@ -184,6 +184,8 @@ export const profileSettingsDataSchema = z.object({
|
|
|
184
184
|
theme: ThemeOptionsSchema.optional(),
|
|
185
185
|
defaults: profileSettingsDefaultsSchema.optional(),
|
|
186
186
|
notifications: z.record(z.string(), profileNotificationSettings).optional(),
|
|
187
|
+
/** Notification types hidden from the feed (display only; creation is unaffected). */
|
|
188
|
+
hiddenNotificationTypes: z.string().array().optional(),
|
|
187
189
|
/** Per-group level. A missing group id means all activity for that group. */
|
|
188
190
|
groupNotificationLevels: z
|
|
189
191
|
.record(z.string(), groupNotificationLevelSchema)
|
|
@@ -914,7 +916,21 @@ export const pushSubscriptionSchema = z.discriminatedUnion('type', [
|
|
|
914
916
|
modelSchema(pushSubscriptionWebhookDataSchema),
|
|
915
917
|
]);
|
|
916
918
|
export type PushSubscription = z.infer<typeof pushSubscriptionSchema>;
|
|
917
|
-
|
|
919
|
+
/**
|
|
920
|
+
* Reactions users can attach to a post. Single source of truth for the
|
|
921
|
+
* picker UI and the API schema.
|
|
922
|
+
*/
|
|
923
|
+
export const REACTION_TYPES = [
|
|
924
|
+
'👍',
|
|
925
|
+
'👎',
|
|
926
|
+
'❤️',
|
|
927
|
+
'😂',
|
|
928
|
+
'😮',
|
|
929
|
+
'😢',
|
|
930
|
+
'🎉',
|
|
931
|
+
] as const;
|
|
932
|
+
|
|
933
|
+
export const reactionTypeSchema = z.enum(REACTION_TYPES);
|
|
918
934
|
|
|
919
935
|
export const reactionDataSchema = z.object({
|
|
920
936
|
reaction: reactionTypeSchema,
|