@openpeepshq/common 0.12.0 → 0.14.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 +19 -2
- package/dist/lib/postHelpers.js +24 -0
- 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 +250 -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 +51 -63
- package/dist/types/internal.d.ts +98 -90
- package/dist/types/models.d.ts +37 -40
- package/dist/types/models.js +25 -8
- package/dist/types/stats.d.ts +224 -72
- package/package.json +1 -1
- package/src/lib/postHelpers.ts +34 -0
- 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/models.ts +29 -9
package/dist/types/models.d.ts
CHANGED
|
@@ -568,6 +568,7 @@ export declare const jamDataSchema: z.ZodObject<{
|
|
|
568
568
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
569
569
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
570
570
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
571
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
571
572
|
videoEnabled: z.ZodBoolean;
|
|
572
573
|
type: z.ZodEnum<{
|
|
573
574
|
"video-call": "video-call";
|
|
@@ -576,12 +577,14 @@ export declare const jamDataSchema: z.ZodObject<{
|
|
|
576
577
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
577
578
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
578
579
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
580
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
579
581
|
}, z.core.$strip>;
|
|
580
582
|
export declare const jamSchema: z.ZodObject<{
|
|
581
583
|
moderators: z.ZodArray<z.ZodString>;
|
|
582
584
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
583
585
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
584
586
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
587
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
585
588
|
videoEnabled: z.ZodBoolean;
|
|
586
589
|
type: z.ZodEnum<{
|
|
587
590
|
"video-call": "video-call";
|
|
@@ -590,6 +593,7 @@ export declare const jamSchema: z.ZodObject<{
|
|
|
590
593
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
591
594
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
592
595
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
596
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
593
597
|
}, z.core.$strip>;
|
|
594
598
|
export type JamData = z.infer<typeof jamDataSchema>;
|
|
595
599
|
export type Jam = JamData;
|
|
@@ -1069,6 +1073,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
1069
1073
|
export type Article = z.infer<typeof articleSchema>;
|
|
1070
1074
|
/** Resource titles are library headings, so they stay much shorter than the description. */
|
|
1071
1075
|
export declare const RESOURCE_TITLE_MAX_LENGTH = 200;
|
|
1076
|
+
/** Category (folder) names render inline in cards, trees and breadcrumbs; keep them bounded so a very long name cannot blow out those layouts. */
|
|
1077
|
+
export declare const RESOURCE_CATEGORY_NAME_MAX_LENGTH = 120;
|
|
1072
1078
|
export declare const resourcePostSchema: z.ZodObject<{
|
|
1073
1079
|
content: z.ZodOptional<z.ZodString>;
|
|
1074
1080
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1227,6 +1233,7 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1227
1233
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1228
1234
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1229
1235
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1236
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1230
1237
|
videoEnabled: z.ZodBoolean;
|
|
1231
1238
|
type: z.ZodEnum<{
|
|
1232
1239
|
"video-call": "video-call";
|
|
@@ -1235,6 +1242,7 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1235
1242
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
1236
1243
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
1237
1244
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
1245
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
1238
1246
|
}, z.core.$strip>>;
|
|
1239
1247
|
physicalLocation: z.ZodOptional<z.ZodObject<{
|
|
1240
1248
|
text: z.ZodString;
|
|
@@ -1422,6 +1430,7 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1422
1430
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1423
1431
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1424
1432
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1433
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1425
1434
|
videoEnabled: z.ZodBoolean;
|
|
1426
1435
|
type: z.ZodEnum<{
|
|
1427
1436
|
"video-call": "video-call";
|
|
@@ -1430,6 +1439,7 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1430
1439
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
1431
1440
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
1432
1441
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
1442
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
1433
1443
|
}, z.core.$strip>>;
|
|
1434
1444
|
physicalLocation: z.ZodOptional<z.ZodObject<{
|
|
1435
1445
|
text: z.ZodString;
|
|
@@ -1705,6 +1715,7 @@ export declare const postDataInputUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
1705
1715
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1706
1716
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1707
1717
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1718
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1708
1719
|
videoEnabled: z.ZodBoolean;
|
|
1709
1720
|
type: z.ZodEnum<{
|
|
1710
1721
|
"video-call": "video-call";
|
|
@@ -1713,6 +1724,7 @@ export declare const postDataInputUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
1713
1724
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
1714
1725
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
1715
1726
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
1727
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
1716
1728
|
}, z.core.$strip>>;
|
|
1717
1729
|
physicalLocation: z.ZodOptional<z.ZodObject<{
|
|
1718
1730
|
text: z.ZodString;
|
|
@@ -2006,6 +2018,7 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
2006
2018
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2007
2019
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2008
2020
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2021
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2009
2022
|
videoEnabled: z.ZodBoolean;
|
|
2010
2023
|
type: z.ZodEnum<{
|
|
2011
2024
|
"video-call": "video-call";
|
|
@@ -2014,6 +2027,7 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
2014
2027
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
2015
2028
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
2016
2029
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
2030
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
2017
2031
|
}, z.core.$strip>>;
|
|
2018
2032
|
physicalLocation: z.ZodOptional<z.ZodObject<{
|
|
2019
2033
|
text: z.ZodString;
|
|
@@ -2309,6 +2323,7 @@ export declare const postSchema: z.ZodObject<{
|
|
|
2309
2323
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2310
2324
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2311
2325
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2326
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2312
2327
|
videoEnabled: z.ZodBoolean;
|
|
2313
2328
|
type: z.ZodEnum<{
|
|
2314
2329
|
"video-call": "video-call";
|
|
@@ -2317,6 +2332,7 @@ export declare const postSchema: z.ZodObject<{
|
|
|
2317
2332
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
2318
2333
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
2319
2334
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
2335
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
2320
2336
|
}, z.core.$strip>>;
|
|
2321
2337
|
physicalLocation: z.ZodOptional<z.ZodObject<{
|
|
2322
2338
|
text: z.ZodString;
|
|
@@ -2640,6 +2656,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2640
2656
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2641
2657
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2642
2658
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2659
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2643
2660
|
videoEnabled: z.ZodBoolean;
|
|
2644
2661
|
type: z.ZodEnum<{
|
|
2645
2662
|
"video-call": "video-call";
|
|
@@ -2648,6 +2665,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2648
2665
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
2649
2666
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
2650
2667
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
2668
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
2651
2669
|
}, z.core.$strip>>;
|
|
2652
2670
|
physicalLocation: z.ZodOptional<z.ZodObject<{
|
|
2653
2671
|
text: z.ZodString;
|
|
@@ -2924,6 +2942,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2924
2942
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2925
2943
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2926
2944
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2945
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2927
2946
|
videoEnabled: z.ZodBoolean;
|
|
2928
2947
|
type: z.ZodEnum<{
|
|
2929
2948
|
"video-call": "video-call";
|
|
@@ -2932,6 +2951,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2932
2951
|
maxPresenters: z.ZodOptional<z.ZodNumber>;
|
|
2933
2952
|
maxAudience: z.ZodOptional<z.ZodNumber>;
|
|
2934
2953
|
waitingRoom: z.ZodOptional<z.ZodBoolean>;
|
|
2954
|
+
notifyEveryone: z.ZodOptional<z.ZodBoolean>;
|
|
2935
2955
|
}, z.core.$strip>>;
|
|
2936
2956
|
physicalLocation: z.ZodOptional<z.ZodObject<{
|
|
2937
2957
|
text: z.ZodString;
|
|
@@ -3392,33 +3412,24 @@ export declare const pushSubscriptionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
3392
3412
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
3393
3413
|
}, z.core.$strip>], "type">;
|
|
3394
3414
|
export type PushSubscription = z.infer<typeof pushSubscriptionSchema>;
|
|
3395
|
-
/**
|
|
3396
|
-
*
|
|
3397
|
-
* picker UI and the API schema.
|
|
3398
|
-
*/
|
|
3415
|
+
/** Curated default reactions: the set that applies when a community has not
|
|
3416
|
+
* configured its own via the community config (`content.allowedReactions`). */
|
|
3399
3417
|
export declare const REACTION_TYPES: readonly ["👍", "👎", "❤️", "😂", "😮", "😢", "🎉"];
|
|
3400
|
-
export declare const reactionTypeSchema: z.ZodEnum<{
|
|
3401
|
-
"\uD83D\uDC4D": "👍";
|
|
3402
|
-
"\uD83D\uDC4E": "👎";
|
|
3403
|
-
"\u2764\uFE0F": "❤️";
|
|
3404
|
-
"\uD83D\uDE02": "😂";
|
|
3405
|
-
"\uD83D\uDE2E": "😮";
|
|
3406
|
-
"\uD83D\uDE22": "😢";
|
|
3407
|
-
"\uD83C\uDF89": "🎉";
|
|
3408
|
-
}>;
|
|
3409
3418
|
export declare const reactionDataSchema: z.ZodObject<{
|
|
3410
|
-
reaction: z.
|
|
3411
|
-
"\uD83D\uDC4D": "👍";
|
|
3412
|
-
"\uD83D\uDC4E": "👎";
|
|
3413
|
-
"\u2764\uFE0F": "❤️";
|
|
3414
|
-
"\uD83D\uDE02": "😂";
|
|
3415
|
-
"\uD83D\uDE2E": "😮";
|
|
3416
|
-
"\uD83D\uDE22": "😢";
|
|
3417
|
-
"\uD83C\uDF89": "🎉";
|
|
3418
|
-
}>;
|
|
3419
|
+
reaction: z.ZodString;
|
|
3419
3420
|
}, z.core.$strip>;
|
|
3420
3421
|
export type ReactionData = z.infer<typeof reactionDataSchema>;
|
|
3421
3422
|
export type Reaction = Model<ReactionData>;
|
|
3423
|
+
/**
|
|
3424
|
+
* The set of reactions a community allows on posts. A configured list (from
|
|
3425
|
+
* `communityConfig.content.allowedReactions`) wins; an absent/empty one falls
|
|
3426
|
+
* back to the curated defaults.
|
|
3427
|
+
*/
|
|
3428
|
+
export declare const resolveAllowedReactions: (config?: {
|
|
3429
|
+
content?: {
|
|
3430
|
+
allowedReactions?: readonly string[];
|
|
3431
|
+
};
|
|
3432
|
+
} | null) => readonly string[];
|
|
3422
3433
|
export declare const mentionDataSchema: z.ZodObject<{
|
|
3423
3434
|
text: z.ZodOptional<z.ZodString>;
|
|
3424
3435
|
}, z.core.$strip>;
|
|
@@ -3497,6 +3508,7 @@ export declare const jamEventDataSchema: z.ZodObject<{
|
|
|
3497
3508
|
reaction: "reaction";
|
|
3498
3509
|
leave: "leave";
|
|
3499
3510
|
close: "close";
|
|
3511
|
+
kicked: "kicked";
|
|
3500
3512
|
recordStart: "recordStart";
|
|
3501
3513
|
recordStop: "recordStop";
|
|
3502
3514
|
streamStart: "streamStart";
|
|
@@ -3504,15 +3516,7 @@ export declare const jamEventDataSchema: z.ZodObject<{
|
|
|
3504
3516
|
}>;
|
|
3505
3517
|
profileId: z.ZodString;
|
|
3506
3518
|
content: z.ZodOptional<z.ZodString>;
|
|
3507
|
-
reaction: z.ZodOptional<z.
|
|
3508
|
-
"\uD83D\uDC4D": "👍";
|
|
3509
|
-
"\uD83D\uDC4E": "👎";
|
|
3510
|
-
"\u2764\uFE0F": "❤️";
|
|
3511
|
-
"\uD83D\uDE02": "😂";
|
|
3512
|
-
"\uD83D\uDE2E": "😮";
|
|
3513
|
-
"\uD83D\uDE22": "😢";
|
|
3514
|
-
"\uD83C\uDF89": "🎉";
|
|
3515
|
-
}>>;
|
|
3519
|
+
reaction: z.ZodOptional<z.ZodString>;
|
|
3516
3520
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
3517
3521
|
}, z.core.$strip>;
|
|
3518
3522
|
export type JamEventData = z.infer<typeof jamEventDataSchema>;
|
|
@@ -3525,6 +3529,7 @@ export declare const jamEventSchema: z.ZodObject<{
|
|
|
3525
3529
|
reaction: "reaction";
|
|
3526
3530
|
leave: "leave";
|
|
3527
3531
|
close: "close";
|
|
3532
|
+
kicked: "kicked";
|
|
3528
3533
|
recordStart: "recordStart";
|
|
3529
3534
|
recordStop: "recordStop";
|
|
3530
3535
|
streamStart: "streamStart";
|
|
@@ -3532,15 +3537,7 @@ export declare const jamEventSchema: z.ZodObject<{
|
|
|
3532
3537
|
}>;
|
|
3533
3538
|
profileId: z.ZodString;
|
|
3534
3539
|
content: z.ZodOptional<z.ZodString>;
|
|
3535
|
-
reaction: z.ZodOptional<z.
|
|
3536
|
-
"\uD83D\uDC4D": "👍";
|
|
3537
|
-
"\uD83D\uDC4E": "👎";
|
|
3538
|
-
"\u2764\uFE0F": "❤️";
|
|
3539
|
-
"\uD83D\uDE02": "😂";
|
|
3540
|
-
"\uD83D\uDE2E": "😮";
|
|
3541
|
-
"\uD83D\uDE22": "😢";
|
|
3542
|
-
"\uD83C\uDF89": "🎉";
|
|
3543
|
-
}>>;
|
|
3540
|
+
reaction: z.ZodOptional<z.ZodString>;
|
|
3544
3541
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
3545
3542
|
id: z.ZodUUID;
|
|
3546
3543
|
createdAt: z.ZodISODateTime;
|
package/dist/types/models.js
CHANGED
|
@@ -5,7 +5,7 @@ import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
|
5
5
|
import { isEndBeforeStart } from '../lib/eventTime.js';
|
|
6
6
|
import { hasVisibleText, postContentWithinBudget } from '../lib/contentLength.js';
|
|
7
7
|
import { groupRelationships } from './capabilities.js';
|
|
8
|
-
import { capabilitiesSchema } from './config.js';
|
|
8
|
+
import { capabilitiesSchema, reactionEmojiSchema } from './config.js';
|
|
9
9
|
import { HANDLE_RESERVED_MESSAGE, additionalForbiddenHandlesSchema, classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, handleRegex, handleRegexBase, isDefaultForbiddenHandle, isForbiddenHandle, normalizeForbiddenHandle, } from './forbiddenHandles.js';
|
|
10
10
|
export { HANDLE_RESERVED_MESSAGE, additionalForbiddenHandlesSchema, classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, handleRegex, handleRegexBase, isDefaultForbiddenHandle, isForbiddenHandle, normalizeForbiddenHandle, };
|
|
11
11
|
extendZodWithOpenApi(z);
|
|
@@ -251,12 +251,16 @@ export const jamDataSchema = z
|
|
|
251
251
|
speakers: z.string().array().optional(),
|
|
252
252
|
presenters: z.string().array().optional(),
|
|
253
253
|
audience: z.string().array().optional(),
|
|
254
|
+
/** Profile ids banned from rejoining this jam; cleared via the lift-ban endpoint. */
|
|
255
|
+
banned: z.string().array().optional(),
|
|
254
256
|
videoEnabled: z.boolean(),
|
|
255
257
|
type: z.enum(['video-call']),
|
|
256
258
|
maxSpeakers: z.number().int().positive().optional(),
|
|
257
259
|
maxPresenters: z.number().int().positive().optional(),
|
|
258
260
|
maxAudience: z.number().int().positive().optional(),
|
|
259
261
|
waitingRoom: z.boolean().optional(),
|
|
262
|
+
/** Opt-in broadcast to the whole community when the jam starts. */
|
|
263
|
+
notifyEveryone: z.boolean().optional(),
|
|
260
264
|
})
|
|
261
265
|
.openapi('Jam');
|
|
262
266
|
export const jamSchema = jamDataSchema;
|
|
@@ -406,6 +410,8 @@ export const articleSchema = noteBaseSchema
|
|
|
406
410
|
.openapi('Article');
|
|
407
411
|
/** Resource titles are library headings, so they stay much shorter than the description. */
|
|
408
412
|
export const RESOURCE_TITLE_MAX_LENGTH = 200;
|
|
413
|
+
/** Category (folder) names render inline in cards, trees and breadcrumbs; keep them bounded so a very long name cannot blow out those layouts. */
|
|
414
|
+
export const RESOURCE_CATEGORY_NAME_MAX_LENGTH = 120;
|
|
409
415
|
export const resourcePostSchema = noteBaseSchema
|
|
410
416
|
.extend({
|
|
411
417
|
type: z.literal('resource'),
|
|
@@ -664,10 +670,8 @@ export const pushSubscriptionSchema = z.discriminatedUnion('type', [
|
|
|
664
670
|
modelSchema(pushSubscriptionFcmDataSchema),
|
|
665
671
|
modelSchema(pushSubscriptionWebhookDataSchema),
|
|
666
672
|
]);
|
|
667
|
-
/**
|
|
668
|
-
*
|
|
669
|
-
* picker UI and the API schema.
|
|
670
|
-
*/
|
|
673
|
+
/** Curated default reactions: the set that applies when a community has not
|
|
674
|
+
* configured its own via the community config (`content.allowedReactions`). */
|
|
671
675
|
export const REACTION_TYPES = [
|
|
672
676
|
'👍',
|
|
673
677
|
'👎',
|
|
@@ -677,10 +681,22 @@ export const REACTION_TYPES = [
|
|
|
677
681
|
'😢',
|
|
678
682
|
'🎉',
|
|
679
683
|
];
|
|
680
|
-
export const reactionTypeSchema = z.enum(REACTION_TYPES);
|
|
681
684
|
export const reactionDataSchema = z.object({
|
|
682
|
-
reaction:
|
|
685
|
+
reaction: reactionEmojiSchema,
|
|
683
686
|
});
|
|
687
|
+
/**
|
|
688
|
+
* The set of reactions a community allows on posts. A configured list (from
|
|
689
|
+
* `communityConfig.content.allowedReactions`) wins; an absent/empty one falls
|
|
690
|
+
* back to the curated defaults.
|
|
691
|
+
*/
|
|
692
|
+
export const resolveAllowedReactions = (config) => {
|
|
693
|
+
const configured = (config?.content?.allowedReactions ?? [])
|
|
694
|
+
.filter((emoji) => typeof emoji === 'string')
|
|
695
|
+
.map((emoji) => emoji.trim())
|
|
696
|
+
.filter((emoji) => emoji.length > 0);
|
|
697
|
+
const unique = [...new Set(configured)];
|
|
698
|
+
return unique.length > 0 ? unique : REACTION_TYPES;
|
|
699
|
+
};
|
|
684
700
|
export const mentionDataSchema = z.object({
|
|
685
701
|
text: z.string().optional(),
|
|
686
702
|
});
|
|
@@ -728,6 +744,7 @@ export const jamEventDataSchema = z.object({
|
|
|
728
744
|
'leave',
|
|
729
745
|
'start',
|
|
730
746
|
'close',
|
|
747
|
+
'kicked',
|
|
731
748
|
'recordStart',
|
|
732
749
|
'recordStop',
|
|
733
750
|
'streamStart',
|
|
@@ -735,7 +752,7 @@ export const jamEventDataSchema = z.object({
|
|
|
735
752
|
]),
|
|
736
753
|
profileId: z.string(),
|
|
737
754
|
content: z.string().optional(),
|
|
738
|
-
reaction:
|
|
755
|
+
reaction: reactionEmojiSchema.optional(),
|
|
739
756
|
recurrenceId: eventIsoDatetimeSchema.optional(),
|
|
740
757
|
});
|
|
741
758
|
export const jamEventSchema = modelSchema(jamEventDataSchema);
|