@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
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";
|
|
@@ -583,6 +584,7 @@ export declare const jamSchema: z.ZodObject<{
|
|
|
583
584
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
584
585
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
585
586
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
587
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
586
588
|
videoEnabled: z.ZodBoolean;
|
|
587
589
|
type: z.ZodEnum<{
|
|
588
590
|
"video-call": "video-call";
|
|
@@ -1071,6 +1073,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
1071
1073
|
export type Article = z.infer<typeof articleSchema>;
|
|
1072
1074
|
/** Resource titles are library headings, so they stay much shorter than the description. */
|
|
1073
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;
|
|
1074
1078
|
export declare const resourcePostSchema: z.ZodObject<{
|
|
1075
1079
|
content: z.ZodOptional<z.ZodString>;
|
|
1076
1080
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1229,6 +1233,7 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1229
1233
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1230
1234
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1231
1235
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1236
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1232
1237
|
videoEnabled: z.ZodBoolean;
|
|
1233
1238
|
type: z.ZodEnum<{
|
|
1234
1239
|
"video-call": "video-call";
|
|
@@ -1425,6 +1430,7 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1425
1430
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1426
1431
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1427
1432
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1433
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1428
1434
|
videoEnabled: z.ZodBoolean;
|
|
1429
1435
|
type: z.ZodEnum<{
|
|
1430
1436
|
"video-call": "video-call";
|
|
@@ -1709,6 +1715,7 @@ export declare const postDataInputUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
1709
1715
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1710
1716
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1711
1717
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1718
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1712
1719
|
videoEnabled: z.ZodBoolean;
|
|
1713
1720
|
type: z.ZodEnum<{
|
|
1714
1721
|
"video-call": "video-call";
|
|
@@ -2011,6 +2018,7 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
2011
2018
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2012
2019
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2013
2020
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2021
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2014
2022
|
videoEnabled: z.ZodBoolean;
|
|
2015
2023
|
type: z.ZodEnum<{
|
|
2016
2024
|
"video-call": "video-call";
|
|
@@ -2315,6 +2323,7 @@ export declare const postSchema: z.ZodObject<{
|
|
|
2315
2323
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2316
2324
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2317
2325
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2326
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2318
2327
|
videoEnabled: z.ZodBoolean;
|
|
2319
2328
|
type: z.ZodEnum<{
|
|
2320
2329
|
"video-call": "video-call";
|
|
@@ -2647,6 +2656,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2647
2656
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2648
2657
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2649
2658
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2659
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2650
2660
|
videoEnabled: z.ZodBoolean;
|
|
2651
2661
|
type: z.ZodEnum<{
|
|
2652
2662
|
"video-call": "video-call";
|
|
@@ -2932,6 +2942,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2932
2942
|
speakers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2933
2943
|
presenters: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2934
2944
|
audience: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2945
|
+
banned: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2935
2946
|
videoEnabled: z.ZodBoolean;
|
|
2936
2947
|
type: z.ZodEnum<{
|
|
2937
2948
|
"video-call": "video-call";
|
|
@@ -3401,33 +3412,24 @@ export declare const pushSubscriptionSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
3401
3412
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
3402
3413
|
}, z.core.$strip>], "type">;
|
|
3403
3414
|
export type PushSubscription = z.infer<typeof pushSubscriptionSchema>;
|
|
3404
|
-
/**
|
|
3405
|
-
*
|
|
3406
|
-
* picker UI and the API schema.
|
|
3407
|
-
*/
|
|
3415
|
+
/** Curated default reactions: the set that applies when a community has not
|
|
3416
|
+
* configured its own via the community config (`content.allowedReactions`). */
|
|
3408
3417
|
export declare const REACTION_TYPES: readonly ["👍", "👎", "❤️", "😂", "😮", "😢", "🎉"];
|
|
3409
|
-
export declare const reactionTypeSchema: z.ZodEnum<{
|
|
3410
|
-
"\uD83D\uDC4D": "👍";
|
|
3411
|
-
"\uD83D\uDC4E": "👎";
|
|
3412
|
-
"\u2764\uFE0F": "❤️";
|
|
3413
|
-
"\uD83D\uDE02": "😂";
|
|
3414
|
-
"\uD83D\uDE2E": "😮";
|
|
3415
|
-
"\uD83D\uDE22": "😢";
|
|
3416
|
-
"\uD83C\uDF89": "🎉";
|
|
3417
|
-
}>;
|
|
3418
3418
|
export declare const reactionDataSchema: z.ZodObject<{
|
|
3419
|
-
reaction: z.
|
|
3420
|
-
"\uD83D\uDC4D": "👍";
|
|
3421
|
-
"\uD83D\uDC4E": "👎";
|
|
3422
|
-
"\u2764\uFE0F": "❤️";
|
|
3423
|
-
"\uD83D\uDE02": "😂";
|
|
3424
|
-
"\uD83D\uDE2E": "😮";
|
|
3425
|
-
"\uD83D\uDE22": "😢";
|
|
3426
|
-
"\uD83C\uDF89": "🎉";
|
|
3427
|
-
}>;
|
|
3419
|
+
reaction: z.ZodString;
|
|
3428
3420
|
}, z.core.$strip>;
|
|
3429
3421
|
export type ReactionData = z.infer<typeof reactionDataSchema>;
|
|
3430
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[];
|
|
3431
3433
|
export declare const mentionDataSchema: z.ZodObject<{
|
|
3432
3434
|
text: z.ZodOptional<z.ZodString>;
|
|
3433
3435
|
}, z.core.$strip>;
|
|
@@ -3506,6 +3508,7 @@ export declare const jamEventDataSchema: z.ZodObject<{
|
|
|
3506
3508
|
reaction: "reaction";
|
|
3507
3509
|
leave: "leave";
|
|
3508
3510
|
close: "close";
|
|
3511
|
+
kicked: "kicked";
|
|
3509
3512
|
recordStart: "recordStart";
|
|
3510
3513
|
recordStop: "recordStop";
|
|
3511
3514
|
streamStart: "streamStart";
|
|
@@ -3513,15 +3516,7 @@ export declare const jamEventDataSchema: z.ZodObject<{
|
|
|
3513
3516
|
}>;
|
|
3514
3517
|
profileId: z.ZodString;
|
|
3515
3518
|
content: z.ZodOptional<z.ZodString>;
|
|
3516
|
-
reaction: z.ZodOptional<z.
|
|
3517
|
-
"\uD83D\uDC4D": "👍";
|
|
3518
|
-
"\uD83D\uDC4E": "👎";
|
|
3519
|
-
"\u2764\uFE0F": "❤️";
|
|
3520
|
-
"\uD83D\uDE02": "😂";
|
|
3521
|
-
"\uD83D\uDE2E": "😮";
|
|
3522
|
-
"\uD83D\uDE22": "😢";
|
|
3523
|
-
"\uD83C\uDF89": "🎉";
|
|
3524
|
-
}>>;
|
|
3519
|
+
reaction: z.ZodOptional<z.ZodString>;
|
|
3525
3520
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
3526
3521
|
}, z.core.$strip>;
|
|
3527
3522
|
export type JamEventData = z.infer<typeof jamEventDataSchema>;
|
|
@@ -3534,6 +3529,7 @@ export declare const jamEventSchema: z.ZodObject<{
|
|
|
3534
3529
|
reaction: "reaction";
|
|
3535
3530
|
leave: "leave";
|
|
3536
3531
|
close: "close";
|
|
3532
|
+
kicked: "kicked";
|
|
3537
3533
|
recordStart: "recordStart";
|
|
3538
3534
|
recordStop: "recordStop";
|
|
3539
3535
|
streamStart: "streamStart";
|
|
@@ -3541,15 +3537,7 @@ export declare const jamEventSchema: z.ZodObject<{
|
|
|
3541
3537
|
}>;
|
|
3542
3538
|
profileId: z.ZodString;
|
|
3543
3539
|
content: z.ZodOptional<z.ZodString>;
|
|
3544
|
-
reaction: z.ZodOptional<z.
|
|
3545
|
-
"\uD83D\uDC4D": "👍";
|
|
3546
|
-
"\uD83D\uDC4E": "👎";
|
|
3547
|
-
"\u2764\uFE0F": "❤️";
|
|
3548
|
-
"\uD83D\uDE02": "😂";
|
|
3549
|
-
"\uD83D\uDE2E": "😮";
|
|
3550
|
-
"\uD83D\uDE22": "😢";
|
|
3551
|
-
"\uD83C\uDF89": "🎉";
|
|
3552
|
-
}>>;
|
|
3540
|
+
reaction: z.ZodOptional<z.ZodString>;
|
|
3553
3541
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
3554
3542
|
id: z.ZodUUID;
|
|
3555
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,6 +251,8 @@ 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(),
|
|
@@ -408,6 +410,8 @@ export const articleSchema = noteBaseSchema
|
|
|
408
410
|
.openapi('Article');
|
|
409
411
|
/** Resource titles are library headings, so they stay much shorter than the description. */
|
|
410
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;
|
|
411
415
|
export const resourcePostSchema = noteBaseSchema
|
|
412
416
|
.extend({
|
|
413
417
|
type: z.literal('resource'),
|
|
@@ -666,10 +670,8 @@ export const pushSubscriptionSchema = z.discriminatedUnion('type', [
|
|
|
666
670
|
modelSchema(pushSubscriptionFcmDataSchema),
|
|
667
671
|
modelSchema(pushSubscriptionWebhookDataSchema),
|
|
668
672
|
]);
|
|
669
|
-
/**
|
|
670
|
-
*
|
|
671
|
-
* picker UI and the API schema.
|
|
672
|
-
*/
|
|
673
|
+
/** Curated default reactions: the set that applies when a community has not
|
|
674
|
+
* configured its own via the community config (`content.allowedReactions`). */
|
|
673
675
|
export const REACTION_TYPES = [
|
|
674
676
|
'👍',
|
|
675
677
|
'👎',
|
|
@@ -679,10 +681,22 @@ export const REACTION_TYPES = [
|
|
|
679
681
|
'😢',
|
|
680
682
|
'🎉',
|
|
681
683
|
];
|
|
682
|
-
export const reactionTypeSchema = z.enum(REACTION_TYPES);
|
|
683
684
|
export const reactionDataSchema = z.object({
|
|
684
|
-
reaction:
|
|
685
|
+
reaction: reactionEmojiSchema,
|
|
685
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
|
+
};
|
|
686
700
|
export const mentionDataSchema = z.object({
|
|
687
701
|
text: z.string().optional(),
|
|
688
702
|
});
|
|
@@ -730,6 +744,7 @@ export const jamEventDataSchema = z.object({
|
|
|
730
744
|
'leave',
|
|
731
745
|
'start',
|
|
732
746
|
'close',
|
|
747
|
+
'kicked',
|
|
733
748
|
'recordStart',
|
|
734
749
|
'recordStop',
|
|
735
750
|
'streamStart',
|
|
@@ -737,7 +752,7 @@ export const jamEventDataSchema = z.object({
|
|
|
737
752
|
]),
|
|
738
753
|
profileId: z.string(),
|
|
739
754
|
content: z.string().optional(),
|
|
740
|
-
reaction:
|
|
755
|
+
reaction: reactionEmojiSchema.optional(),
|
|
741
756
|
recurrenceId: eventIsoDatetimeSchema.optional(),
|
|
742
757
|
});
|
|
743
758
|
export const jamEventSchema = modelSchema(jamEventDataSchema);
|