@openpeepshq/common 0.3.2 → 0.5.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/adminSections.d.ts +4 -0
- package/dist/lib/adminSections.js +5 -0
- package/dist/lib/attachmentHelpers.js +5 -1
- package/dist/lib/capabilitiesHelpers.d.ts +9 -0
- package/dist/lib/capabilitiesHelpers.js +9 -0
- package/dist/lib/csvHelpers.d.ts +2 -0
- package/dist/lib/csvHelpers.js +13 -0
- package/dist/lib/eventRecurrence.d.ts +11 -1
- package/dist/lib/eventRecurrence.js +23 -13
- package/dist/lib/eventWaitlist.d.ts +58 -0
- package/dist/lib/eventWaitlist.js +217 -0
- package/dist/lib/groupHelpers.d.ts +5 -0
- package/dist/lib/groupHelpers.js +16 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/markdownHelpers.d.ts +12 -3
- package/dist/lib/markdownHelpers.js +115 -6
- package/dist/lib/postHelpers.d.ts +27 -5
- package/dist/lib/postHelpers.js +73 -11
- package/dist/lib/profileHelpers.d.ts +12 -2
- package/dist/lib/profileHelpers.js +19 -2
- package/dist/lib/resources.d.ts +29 -1
- package/dist/lib/resources.js +74 -2
- package/dist/lib/utils.js +11 -11
- package/dist/types/admin-livekit.d.ts +23 -0
- package/dist/types/admin-livekit.js +18 -0
- package/dist/types/admin-media.d.ts +41 -0
- package/dist/types/admin-media.js +20 -0
- package/dist/types/api.d.ts +19945 -3526
- package/dist/types/api.js +16 -10
- package/dist/types/capabilities.d.ts +2 -2
- package/dist/types/capabilities.js +3 -0
- package/dist/types/config.d.ts +15 -0
- package/dist/types/config.js +14 -2
- package/dist/types/db.d.ts +65 -22
- package/dist/types/forbiddenHandles.d.ts +28 -0
- package/dist/types/forbiddenHandles.js +75 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/internal.d.ts +163 -44
- package/dist/types/models.d.ts +46 -14
- package/dist/types/models.js +38 -28
- package/dist/types/notifications.d.ts +2 -0
- package/dist/types/notifications.js +4 -2
- package/dist/types/roleDefaults.js +109 -95
- package/dist/types/stats.d.ts +348 -108
- package/package.json +7 -6
- package/src/lib/adminSections.ts +5 -0
- package/src/lib/attachmentHelpers.ts +18 -12
- package/src/lib/capabilitiesHelpers.ts +15 -0
- package/src/lib/csvHelpers.ts +19 -3
- package/src/lib/eventRecurrence.ts +33 -19
- package/src/lib/eventWaitlist.ts +325 -0
- package/src/lib/groupHelpers.ts +25 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/markdownHelpers.ts +121 -7
- package/src/lib/postHelpers.ts +102 -13
- package/src/lib/profileHelpers.ts +31 -2
- package/src/lib/resources.ts +105 -2
- package/src/lib/utils.ts +40 -31
- package/src/types/admin-livekit.ts +24 -0
- package/src/types/admin-media.ts +29 -0
- package/src/types/api.ts +20 -10
- package/src/types/auth.ts +2 -2
- package/src/types/capabilities.ts +3 -0
- package/src/types/config.ts +19 -10
- package/src/types/forbiddenHandles.ts +103 -0
- package/src/types/index.ts +2 -0
- package/src/types/models.ts +70 -33
- package/src/types/notifications.ts +7 -7
- package/src/types/roleDefaults.ts +115 -96
- package/src/types/stripe.ts +3 -1
package/dist/types/models.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z, util, ZodObject, ZodRawShape } from 'zod';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { HANDLE_RESERVED_MESSAGE, additionalForbiddenHandlesSchema, classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, handleRegex, handleRegexBase, isDefaultForbiddenHandle, isForbiddenHandle, normalizeForbiddenHandle } from './forbiddenHandles';
|
|
3
|
+
export { HANDLE_RESERVED_MESSAGE, additionalForbiddenHandlesSchema, classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, handleRegex, handleRegexBase, isDefaultForbiddenHandle, isForbiddenHandle, normalizeForbiddenHandle, };
|
|
4
4
|
/** `@handle` using the allowed handle charset. No `\\b` — hyphens are not word chars. */
|
|
5
5
|
export declare const mentionHandleRegexBase = "(^|[\\s(>])@([a-zA-Z0-9_-]{1,16})(?=\\s|$|[.,!?;:])";
|
|
6
|
-
export declare const forbiddenHandles: string[];
|
|
7
6
|
export declare const baseSchemaShape: {
|
|
8
7
|
createdAt: z.ZodISODateTime;
|
|
9
8
|
updatedAt: z.ZodISODateTime;
|
|
@@ -107,6 +106,14 @@ export declare const profileNotificationSettings: z.ZodObject<{
|
|
|
107
106
|
email: z.ZodBoolean;
|
|
108
107
|
}, z.core.$strip>;
|
|
109
108
|
export type ProfileNotificationSettings = z.infer<typeof profileNotificationSettings>;
|
|
109
|
+
/** Per-group activity level. Unset means `all`, matching account settings. */
|
|
110
|
+
export declare const groupNotificationLevelOptions: readonly ["all", "mostRelevant", "off"];
|
|
111
|
+
export declare const groupNotificationLevelSchema: z.ZodEnum<{
|
|
112
|
+
all: "all";
|
|
113
|
+
mostRelevant: "mostRelevant";
|
|
114
|
+
off: "off";
|
|
115
|
+
}>;
|
|
116
|
+
export type GroupNotificationLevel = z.infer<typeof groupNotificationLevelSchema>;
|
|
110
117
|
export declare const jamSettingsSchema: z.ZodObject<{
|
|
111
118
|
backgroundObfuscation: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
112
119
|
type: z.ZodLiteral<"blur">;
|
|
@@ -154,6 +161,11 @@ export declare const profileSettingsDataSchema: z.ZodObject<{
|
|
|
154
161
|
push: z.ZodBoolean;
|
|
155
162
|
email: z.ZodBoolean;
|
|
156
163
|
}, z.core.$strip>>>;
|
|
164
|
+
groupNotificationLevels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
165
|
+
all: "all";
|
|
166
|
+
mostRelevant: "mostRelevant";
|
|
167
|
+
off: "off";
|
|
168
|
+
}>>>;
|
|
157
169
|
jamSettings: z.ZodOptional<z.ZodObject<{
|
|
158
170
|
backgroundObfuscation: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
159
171
|
type: z.ZodLiteral<"blur">;
|
|
@@ -205,6 +217,11 @@ export declare const profileSettingsSchema: z.ZodObject<{
|
|
|
205
217
|
push: z.ZodBoolean;
|
|
206
218
|
email: z.ZodBoolean;
|
|
207
219
|
}, z.core.$strip>>>;
|
|
220
|
+
groupNotificationLevels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
221
|
+
all: "all";
|
|
222
|
+
mostRelevant: "mostRelevant";
|
|
223
|
+
off: "off";
|
|
224
|
+
}>>>;
|
|
208
225
|
jamSettings: z.ZodOptional<z.ZodObject<{
|
|
209
226
|
backgroundObfuscation: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
210
227
|
type: z.ZodLiteral<"blur">;
|
|
@@ -724,8 +741,8 @@ export declare const postTypeSchema: z.ZodEnum<{
|
|
|
724
741
|
}>;
|
|
725
742
|
export type PostType = z.infer<typeof postTypeSchema>;
|
|
726
743
|
export declare const resourceKindSchema: z.ZodEnum<{
|
|
727
|
-
link: "link";
|
|
728
744
|
file: "file";
|
|
745
|
+
link: "link";
|
|
729
746
|
video: "video";
|
|
730
747
|
gallery: "gallery";
|
|
731
748
|
audio: "audio";
|
|
@@ -951,6 +968,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
951
968
|
title: z.ZodOptional<z.ZodString>;
|
|
952
969
|
}, z.core.$strip>;
|
|
953
970
|
export type Article = z.infer<typeof articleSchema>;
|
|
971
|
+
/** Resource titles are library headings, so they stay much shorter than the description. */
|
|
972
|
+
export declare const RESOURCE_TITLE_MAX_LENGTH = 200;
|
|
954
973
|
export declare const resourcePostSchema: z.ZodObject<{
|
|
955
974
|
content: z.ZodOptional<z.ZodString>;
|
|
956
975
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -994,8 +1013,8 @@ export declare const resourcePostSchema: z.ZodObject<{
|
|
|
994
1013
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
995
1014
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
996
1015
|
resourceKind: z.ZodEnum<{
|
|
997
|
-
link: "link";
|
|
998
1016
|
file: "file";
|
|
1017
|
+
link: "link";
|
|
999
1018
|
video: "video";
|
|
1000
1019
|
gallery: "gallery";
|
|
1001
1020
|
audio: "audio";
|
|
@@ -1101,6 +1120,7 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1101
1120
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1102
1121
|
wholeDay: z.ZodBoolean;
|
|
1103
1122
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1123
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1104
1124
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1105
1125
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1106
1126
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -1295,6 +1315,7 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1295
1315
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1296
1316
|
wholeDay: z.ZodBoolean;
|
|
1297
1317
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1318
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1298
1319
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1299
1320
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1300
1321
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -1437,8 +1458,8 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1437
1458
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1438
1459
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1439
1460
|
resourceKind: z.ZodEnum<{
|
|
1440
|
-
link: "link";
|
|
1441
1461
|
file: "file";
|
|
1462
|
+
link: "link";
|
|
1442
1463
|
video: "video";
|
|
1443
1464
|
gallery: "gallery";
|
|
1444
1465
|
audio: "audio";
|
|
@@ -1595,6 +1616,7 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
1595
1616
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1596
1617
|
wholeDay: z.ZodBoolean;
|
|
1597
1618
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1619
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1598
1620
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1599
1621
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1600
1622
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -1737,8 +1759,8 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
1737
1759
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1738
1760
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1739
1761
|
resourceKind: z.ZodEnum<{
|
|
1740
|
-
link: "link";
|
|
1741
1762
|
file: "file";
|
|
1763
|
+
link: "link";
|
|
1742
1764
|
video: "video";
|
|
1743
1765
|
gallery: "gallery";
|
|
1744
1766
|
audio: "audio";
|
|
@@ -1897,6 +1919,7 @@ export declare const postSchema: z.ZodObject<{
|
|
|
1897
1919
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1898
1920
|
wholeDay: z.ZodBoolean;
|
|
1899
1921
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1922
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1900
1923
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1901
1924
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1902
1925
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -2039,8 +2062,8 @@ export declare const postSchema: z.ZodObject<{
|
|
|
2039
2062
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2040
2063
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2041
2064
|
resourceKind: z.ZodEnum<{
|
|
2042
|
-
link: "link";
|
|
2043
2065
|
file: "file";
|
|
2066
|
+
link: "link";
|
|
2044
2067
|
video: "video";
|
|
2045
2068
|
gallery: "gallery";
|
|
2046
2069
|
audio: "audio";
|
|
@@ -2063,6 +2086,7 @@ export declare const rsvpResponseSchema: z.ZodEnum<{
|
|
|
2063
2086
|
yes: "yes";
|
|
2064
2087
|
tentative: "tentative";
|
|
2065
2088
|
removed: "removed";
|
|
2089
|
+
waitlist: "waitlist";
|
|
2066
2090
|
}>;
|
|
2067
2091
|
export type RsvpResponse = z.infer<typeof rsvpResponseSchema>;
|
|
2068
2092
|
export declare const rsvpSchema: z.ZodObject<{
|
|
@@ -2071,18 +2095,22 @@ export declare const rsvpSchema: z.ZodObject<{
|
|
|
2071
2095
|
yes: "yes";
|
|
2072
2096
|
tentative: "tentative";
|
|
2073
2097
|
removed: "removed";
|
|
2098
|
+
waitlist: "waitlist";
|
|
2074
2099
|
}>;
|
|
2075
2100
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2101
|
+
waitlistJoinedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2102
|
+
offerExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2076
2103
|
}, z.core.$strip>;
|
|
2077
2104
|
export type RSVP = z.infer<typeof rsvpSchema>;
|
|
2078
2105
|
export declare const rsvpRequestSchema: z.ZodObject<{
|
|
2106
|
+
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2079
2107
|
response: z.ZodEnum<{
|
|
2080
2108
|
no: "no";
|
|
2081
2109
|
yes: "yes";
|
|
2082
2110
|
tentative: "tentative";
|
|
2083
2111
|
removed: "removed";
|
|
2112
|
+
waitlist: "waitlist";
|
|
2084
2113
|
}>;
|
|
2085
|
-
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2086
2114
|
recurrenceIds: z.ZodOptional<z.ZodArray<z.ZodISODateTime>>;
|
|
2087
2115
|
}, z.core.$strip>;
|
|
2088
2116
|
export type RsvpRequest = z.infer<typeof rsvpRequestSchema>;
|
|
@@ -2222,6 +2250,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2222
2250
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
2223
2251
|
wholeDay: z.ZodBoolean;
|
|
2224
2252
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
2253
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
2225
2254
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
2226
2255
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2227
2256
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -2364,8 +2393,8 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2364
2393
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2365
2394
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2366
2395
|
resourceKind: z.ZodEnum<{
|
|
2367
|
-
link: "link";
|
|
2368
2396
|
file: "file";
|
|
2397
|
+
link: "link";
|
|
2369
2398
|
video: "video";
|
|
2370
2399
|
gallery: "gallery";
|
|
2371
2400
|
audio: "audio";
|
|
@@ -2505,6 +2534,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2505
2534
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
2506
2535
|
wholeDay: z.ZodBoolean;
|
|
2507
2536
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
2537
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
2508
2538
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
2509
2539
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2510
2540
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -2647,8 +2677,8 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2647
2677
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2648
2678
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2649
2679
|
resourceKind: z.ZodEnum<{
|
|
2650
|
-
link: "link";
|
|
2651
2680
|
file: "file";
|
|
2681
|
+
link: "link";
|
|
2652
2682
|
video: "video";
|
|
2653
2683
|
gallery: "gallery";
|
|
2654
2684
|
audio: "audio";
|
|
@@ -2671,8 +2701,11 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2671
2701
|
yes: "yes";
|
|
2672
2702
|
tentative: "tentative";
|
|
2673
2703
|
removed: "removed";
|
|
2704
|
+
waitlist: "waitlist";
|
|
2674
2705
|
}>;
|
|
2675
2706
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2707
|
+
waitlistJoinedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2708
|
+
offerExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2676
2709
|
}, z.core.$strip>;
|
|
2677
2710
|
}, z.core.$strip>, z.ZodObject<{
|
|
2678
2711
|
type: z.ZodLiteral<"reaction">;
|
|
@@ -3059,8 +3092,8 @@ export declare const jamEventDataSchema: z.ZodObject<{
|
|
|
3059
3092
|
id: z.ZodString;
|
|
3060
3093
|
jamId: z.ZodString;
|
|
3061
3094
|
type: z.ZodEnum<{
|
|
3062
|
-
message: "message";
|
|
3063
3095
|
join: "join";
|
|
3096
|
+
message: "message";
|
|
3064
3097
|
start: "start";
|
|
3065
3098
|
reaction: "reaction";
|
|
3066
3099
|
leave: "leave";
|
|
@@ -3081,8 +3114,8 @@ export type JamEventData = z.infer<typeof jamEventDataSchema>;
|
|
|
3081
3114
|
export declare const jamEventSchema: z.ZodObject<{
|
|
3082
3115
|
jamId: z.ZodString;
|
|
3083
3116
|
type: z.ZodEnum<{
|
|
3084
|
-
message: "message";
|
|
3085
3117
|
join: "join";
|
|
3118
|
+
message: "message";
|
|
3086
3119
|
start: "start";
|
|
3087
3120
|
reaction: "reaction";
|
|
3088
3121
|
leave: "leave";
|
|
@@ -3256,4 +3289,3 @@ export declare const jamRecordingSchema: z.ZodObject<{
|
|
|
3256
3289
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
3257
3290
|
}, z.core.$strip>;
|
|
3258
3291
|
export type JamRecording = Model<JamRecordingData>;
|
|
3259
|
-
export {};
|
package/dist/types/models.js
CHANGED
|
@@ -4,32 +4,11 @@ import ISO6391 from 'iso-639-1';
|
|
|
4
4
|
import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
5
5
|
import { groupRelationships } from './capabilities.js';
|
|
6
6
|
import { capabilitiesSchema } from './config.js';
|
|
7
|
+
import { HANDLE_RESERVED_MESSAGE, additionalForbiddenHandlesSchema, classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, handleRegex, handleRegexBase, isDefaultForbiddenHandle, isForbiddenHandle, normalizeForbiddenHandle, } from './forbiddenHandles.js';
|
|
8
|
+
export { HANDLE_RESERVED_MESSAGE, additionalForbiddenHandlesSchema, classifyAdditionalForbiddenHandle, collectAdditionalForbiddenHandles, forbiddenHandles, handleRegex, handleRegexBase, isDefaultForbiddenHandle, isForbiddenHandle, normalizeForbiddenHandle, };
|
|
7
9
|
extendZodWithOpenApi(z);
|
|
8
|
-
export const handleRegexBase = '[a-zA-Z0-9_-]{1,16}';
|
|
9
|
-
export const handleRegex = new RegExp(`^${handleRegexBase}$`);
|
|
10
10
|
/** `@handle` using the allowed handle charset. No `\\b` — hyphens are not word chars. */
|
|
11
11
|
export const mentionHandleRegexBase = `(^|[\\s(>])@(${handleRegexBase})(?=\\s|$|[.,!?;:])`;
|
|
12
|
-
export const forbiddenHandles = [
|
|
13
|
-
'admin',
|
|
14
|
-
'allpeep',
|
|
15
|
-
'api',
|
|
16
|
-
'app',
|
|
17
|
-
'auth',
|
|
18
|
-
'config',
|
|
19
|
-
'core',
|
|
20
|
-
'db',
|
|
21
|
-
'email',
|
|
22
|
-
'federation',
|
|
23
|
-
'jam',
|
|
24
|
-
'media',
|
|
25
|
-
'network',
|
|
26
|
-
'plugins',
|
|
27
|
-
'undefined',
|
|
28
|
-
'jamStarted',
|
|
29
|
-
'jamSpeaker',
|
|
30
|
-
'jamModerator',
|
|
31
|
-
'new',
|
|
32
|
-
];
|
|
33
12
|
export const baseSchemaShape = {
|
|
34
13
|
createdAt: z.iso.datetime(),
|
|
35
14
|
updatedAt: z.iso.datetime(),
|
|
@@ -91,6 +70,13 @@ export const profileNotificationSettings = z.object({
|
|
|
91
70
|
push: z.boolean(),
|
|
92
71
|
email: z.boolean(),
|
|
93
72
|
});
|
|
73
|
+
/** Per-group activity level. Unset means `all`, matching account settings. */
|
|
74
|
+
export const groupNotificationLevelOptions = [
|
|
75
|
+
'all',
|
|
76
|
+
'mostRelevant',
|
|
77
|
+
'off',
|
|
78
|
+
];
|
|
79
|
+
export const groupNotificationLevelSchema = z.enum(groupNotificationLevelOptions);
|
|
94
80
|
export const jamSettingsSchema = z.object({
|
|
95
81
|
backgroundObfuscation: z
|
|
96
82
|
.discriminatedUnion('type', [
|
|
@@ -121,6 +107,10 @@ export const profileSettingsDataSchema = z.object({
|
|
|
121
107
|
theme: ThemeOptionsSchema.optional(),
|
|
122
108
|
defaults: profileSettingsDefaultsSchema.optional(),
|
|
123
109
|
notifications: z.record(z.string(), profileNotificationSettings).optional(),
|
|
110
|
+
/** Per-group level. A missing group id means all activity for that group. */
|
|
111
|
+
groupNotificationLevels: z
|
|
112
|
+
.record(z.string(), groupNotificationLevelSchema)
|
|
113
|
+
.optional(),
|
|
124
114
|
jamSettings: jamSettingsSchema.optional(),
|
|
125
115
|
stripeSettings: z
|
|
126
116
|
.object({
|
|
@@ -142,8 +132,8 @@ export const profileSettingsDataSchema = z.object({
|
|
|
142
132
|
export const profileSettingsSchema = modelSchema(profileSettingsDataSchema);
|
|
143
133
|
export const accountNameSchema = z
|
|
144
134
|
.string()
|
|
145
|
-
.refine((value) => !
|
|
146
|
-
message:
|
|
135
|
+
.refine((value) => !isForbiddenHandle(value), {
|
|
136
|
+
message: HANDLE_RESERVED_MESSAGE,
|
|
147
137
|
})
|
|
148
138
|
.refine((value) => handleRegex.test(value ?? ''), {
|
|
149
139
|
message: 'Handle must be 1–16 characters: letters, numbers, underscores, or hyphens (no spaces or punctuation)',
|
|
@@ -384,10 +374,12 @@ export const articleSchema = noteSchema
|
|
|
384
374
|
title: z.string().optional(),
|
|
385
375
|
})
|
|
386
376
|
.openapi('Article');
|
|
377
|
+
/** Resource titles are library headings, so they stay much shorter than the description. */
|
|
378
|
+
export const RESOURCE_TITLE_MAX_LENGTH = 200;
|
|
387
379
|
export const resourcePostSchema = noteSchema
|
|
388
380
|
.extend({
|
|
389
381
|
type: z.literal('resource'),
|
|
390
|
-
title: z.string(),
|
|
382
|
+
title: z.string().max(RESOURCE_TITLE_MAX_LENGTH),
|
|
391
383
|
tags: z.array(z.string().min(1)).optional(),
|
|
392
384
|
categoryPath: z.array(z.string().min(1)).optional(),
|
|
393
385
|
resourceKind: resourceKindSchema,
|
|
@@ -440,6 +432,8 @@ export const eventSchema = noteSchema
|
|
|
440
432
|
end: eventIsoDatetimeSchema.optional(),
|
|
441
433
|
wholeDay: z.boolean(),
|
|
442
434
|
maxAttendees: z.number().int().positive().optional(),
|
|
435
|
+
/** Minutes the next waitlisted member has to claim a freed seat. */
|
|
436
|
+
waitlistOfferMinutes: z.number().int().positive().max(10080).optional(),
|
|
443
437
|
attendeeListPublic: z.boolean().optional(),
|
|
444
438
|
moderators: z.string().uuid().array().optional(),
|
|
445
439
|
jam: jamSchema.optional(),
|
|
@@ -447,6 +441,10 @@ export const eventSchema = noteSchema
|
|
|
447
441
|
url: z.url().optional(),
|
|
448
442
|
recurrence: eventRecurrenceSchema.optional(),
|
|
449
443
|
exceptions: eventOccurrenceExceptionSchema.array().optional(),
|
|
444
|
+
})
|
|
445
|
+
.refine((data) => !data.end || new Date(data.end) > new Date(data.start), {
|
|
446
|
+
message: 'events.form.endBeforeStart',
|
|
447
|
+
path: ['end'],
|
|
450
448
|
})
|
|
451
449
|
.openapi('Event');
|
|
452
450
|
export const postDataUnionSchema = z.discriminatedUnion('type', [
|
|
@@ -469,12 +467,24 @@ export const answerSchema = z
|
|
|
469
467
|
selection: z.number().array(),
|
|
470
468
|
})
|
|
471
469
|
.openapi('Answer');
|
|
472
|
-
export const rsvpResponseSchema = z.enum([
|
|
470
|
+
export const rsvpResponseSchema = z.enum([
|
|
471
|
+
'yes',
|
|
472
|
+
'no',
|
|
473
|
+
'tentative',
|
|
474
|
+
'removed',
|
|
475
|
+
'waitlist',
|
|
476
|
+
]);
|
|
473
477
|
export const rsvpSchema = z.object({
|
|
474
478
|
response: rsvpResponseSchema,
|
|
475
479
|
recurrenceId: eventIsoDatetimeSchema.optional(),
|
|
480
|
+
/** Queue position. Copied onto later offer entries so a new write stays in line. */
|
|
481
|
+
waitlistJoinedAt: eventIsoDatetimeSchema.optional(),
|
|
482
|
+
/** When the current spot offer expires. Server-set; ignored on RSVP requests. */
|
|
483
|
+
offerExpiresAt: eventIsoDatetimeSchema.optional(),
|
|
476
484
|
});
|
|
477
|
-
export const rsvpRequestSchema = rsvpSchema
|
|
485
|
+
export const rsvpRequestSchema = rsvpSchema
|
|
486
|
+
.omit({ waitlistJoinedAt: true, offerExpiresAt: true })
|
|
487
|
+
.extend({
|
|
478
488
|
recurrenceIds: z.array(eventIsoDatetimeSchema).min(1).optional(),
|
|
479
489
|
});
|
|
480
490
|
export const entryReactionDataSchema = z.object({
|
|
@@ -164,6 +164,8 @@ export declare const notificationTypeSchema: z.ZodObject<{
|
|
|
164
164
|
"core-roles-read": "core-roles-read";
|
|
165
165
|
"core-roles-update": "core-roles-update";
|
|
166
166
|
"core-maintenance-restart": "core-maintenance-restart";
|
|
167
|
+
"core-media-read": "core-media-read";
|
|
168
|
+
"core-media-delete": "core-media-delete";
|
|
167
169
|
"core-inviteLinks-create": "core-inviteLinks-create";
|
|
168
170
|
"core-inviteLinks-read": "core-inviteLinks-read";
|
|
169
171
|
"core-inviteLinks-update": "core-inviteLinks-update";
|
|
@@ -34,11 +34,13 @@ export const sessionEventSchema = z.object({
|
|
|
34
34
|
export const notificationTypeSchema = z.object({
|
|
35
35
|
type: z.string(),
|
|
36
36
|
requiredCapabilities: z.enum(roleCapabilities).array().optional(),
|
|
37
|
-
defaultSettings: z
|
|
37
|
+
defaultSettings: z
|
|
38
|
+
.object({
|
|
38
39
|
create: z.boolean(),
|
|
39
40
|
push: z.boolean(),
|
|
40
41
|
email: z.boolean(),
|
|
41
|
-
})
|
|
42
|
+
})
|
|
43
|
+
.optional(),
|
|
42
44
|
});
|
|
43
45
|
export const notificationDefaults = {
|
|
44
46
|
create: true,
|
|
@@ -1,103 +1,117 @@
|
|
|
1
1
|
/** Stamps the version onto the roles so a stored role records its baseline. */
|
|
2
2
|
const versionedRoles = (version, roles) => roles.map((role) => ({ ...role, baseVersion: version }));
|
|
3
|
+
const builtinRoles = [
|
|
4
|
+
{
|
|
5
|
+
key: 'owner',
|
|
6
|
+
displayName: 'Owner',
|
|
7
|
+
capabilities: { add: ['*'], remove: [] },
|
|
8
|
+
default: true,
|
|
9
|
+
description: 'The owner of this community can do everything',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
key: 'admin',
|
|
13
|
+
displayName: 'Admin',
|
|
14
|
+
capabilities: {
|
|
15
|
+
add: [
|
|
16
|
+
'core-accounts-*',
|
|
17
|
+
'core-reports-*',
|
|
18
|
+
'core-groups-*',
|
|
19
|
+
'core-posts-*',
|
|
20
|
+
'core-profiles-*',
|
|
21
|
+
'core-customization-*',
|
|
22
|
+
'core-backups-*',
|
|
23
|
+
'core-i18n-*',
|
|
24
|
+
'core-logs-*',
|
|
25
|
+
'core-roles-read',
|
|
26
|
+
'core-maintenance-restart',
|
|
27
|
+
'core-inviteLinks-*',
|
|
28
|
+
'core-analytics-read',
|
|
29
|
+
'core-plugins-*',
|
|
30
|
+
],
|
|
31
|
+
remove: [],
|
|
32
|
+
},
|
|
33
|
+
default: true,
|
|
34
|
+
description: 'An admin of the community',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
key: 'moderator',
|
|
38
|
+
displayName: 'Moderator',
|
|
39
|
+
capabilities: {
|
|
40
|
+
add: [
|
|
41
|
+
'core-posts-delete',
|
|
42
|
+
'core-posts-pin-globally',
|
|
43
|
+
'core-posts-announce',
|
|
44
|
+
'core-profiles-suspend',
|
|
45
|
+
'core-accounts-read',
|
|
46
|
+
'core-profiles-read',
|
|
47
|
+
'core-groups-read',
|
|
48
|
+
'core-inviteLinks-read',
|
|
49
|
+
'core-reports-read',
|
|
50
|
+
'core-reports-update',
|
|
51
|
+
'core-analytics-read',
|
|
52
|
+
'core-local',
|
|
53
|
+
'core-posts-create-*',
|
|
54
|
+
'core-groups-create',
|
|
55
|
+
'core-reports-create',
|
|
56
|
+
],
|
|
57
|
+
remove: [],
|
|
58
|
+
},
|
|
59
|
+
default: true,
|
|
60
|
+
description: 'A moderator of the community',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: 'member',
|
|
64
|
+
displayName: 'Member',
|
|
65
|
+
capabilities: {
|
|
66
|
+
add: [
|
|
67
|
+
'core-local',
|
|
68
|
+
'core-posts-create-*',
|
|
69
|
+
'core-groups-create',
|
|
70
|
+
'core-reports-create',
|
|
71
|
+
],
|
|
72
|
+
remove: [],
|
|
73
|
+
},
|
|
74
|
+
default: true,
|
|
75
|
+
description: 'A member of the community',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: 'pendingmember',
|
|
79
|
+
displayName: 'Pending Member',
|
|
80
|
+
capabilities: {
|
|
81
|
+
add: ['core-local'],
|
|
82
|
+
remove: [],
|
|
83
|
+
},
|
|
84
|
+
default: true,
|
|
85
|
+
description: 'A member of the community that has not been approved yet',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
key: 'limitedmember',
|
|
89
|
+
displayName: 'Limited Member',
|
|
90
|
+
capabilities: {
|
|
91
|
+
add: [],
|
|
92
|
+
remove: [],
|
|
93
|
+
},
|
|
94
|
+
default: true,
|
|
95
|
+
description: 'A member of the community that can only partcipate in group they are added to',
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
const adminCanManageMedia = (roles) => roles.map((role) => role.key === 'admin'
|
|
99
|
+
? {
|
|
100
|
+
...role,
|
|
101
|
+
capabilities: {
|
|
102
|
+
add: [...(role.capabilities?.add ?? []), 'core-media-*'],
|
|
103
|
+
remove: [...(role.capabilities?.remove ?? [])],
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
: role);
|
|
3
107
|
export const roleDefaultsHistory = [
|
|
4
108
|
{
|
|
5
109
|
version: '2026-10-06',
|
|
6
|
-
roles: versionedRoles('2026-10-06',
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
default: true,
|
|
12
|
-
description: 'The owner of this community can do everything',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
key: 'admin',
|
|
16
|
-
displayName: 'Admin',
|
|
17
|
-
capabilities: {
|
|
18
|
-
add: [
|
|
19
|
-
'core-accounts-*',
|
|
20
|
-
'core-reports-*',
|
|
21
|
-
'core-groups-*',
|
|
22
|
-
'core-posts-*',
|
|
23
|
-
'core-profiles-*',
|
|
24
|
-
'core-customization-*',
|
|
25
|
-
'core-backups-*',
|
|
26
|
-
'core-i18n-*',
|
|
27
|
-
'core-logs-*',
|
|
28
|
-
'core-roles-read',
|
|
29
|
-
'core-maintenance-restart',
|
|
30
|
-
'core-inviteLinks-*',
|
|
31
|
-
'core-analytics-read',
|
|
32
|
-
'core-plugins-*',
|
|
33
|
-
],
|
|
34
|
-
remove: [],
|
|
35
|
-
},
|
|
36
|
-
default: true,
|
|
37
|
-
description: 'An admin of the community',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
key: 'moderator',
|
|
41
|
-
displayName: 'Moderator',
|
|
42
|
-
capabilities: {
|
|
43
|
-
add: [
|
|
44
|
-
'core-posts-delete',
|
|
45
|
-
'core-posts-pin-globally',
|
|
46
|
-
'core-posts-announce',
|
|
47
|
-
'core-profiles-suspend',
|
|
48
|
-
'core-accounts-read',
|
|
49
|
-
'core-profiles-read',
|
|
50
|
-
'core-groups-read',
|
|
51
|
-
'core-inviteLinks-read',
|
|
52
|
-
'core-reports-read',
|
|
53
|
-
'core-reports-update',
|
|
54
|
-
'core-analytics-read',
|
|
55
|
-
'core-local',
|
|
56
|
-
'core-posts-create-*',
|
|
57
|
-
'core-groups-create',
|
|
58
|
-
'core-reports-create',
|
|
59
|
-
],
|
|
60
|
-
remove: [],
|
|
61
|
-
},
|
|
62
|
-
default: true,
|
|
63
|
-
description: 'A moderator of the community',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
key: 'member',
|
|
67
|
-
displayName: 'Member',
|
|
68
|
-
capabilities: {
|
|
69
|
-
add: [
|
|
70
|
-
'core-local',
|
|
71
|
-
'core-posts-create-*',
|
|
72
|
-
'core-groups-create',
|
|
73
|
-
'core-reports-create',
|
|
74
|
-
],
|
|
75
|
-
remove: [],
|
|
76
|
-
},
|
|
77
|
-
default: true,
|
|
78
|
-
description: 'A member of the community',
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
key: 'pendingmember',
|
|
82
|
-
displayName: 'Pending Member',
|
|
83
|
-
capabilities: {
|
|
84
|
-
add: ['core-local'],
|
|
85
|
-
remove: [],
|
|
86
|
-
},
|
|
87
|
-
default: true,
|
|
88
|
-
description: 'A member of the community that has not been approved yet',
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
key: 'limitedmember',
|
|
92
|
-
displayName: 'Limited Member',
|
|
93
|
-
capabilities: {
|
|
94
|
-
add: [],
|
|
95
|
-
remove: [],
|
|
96
|
-
},
|
|
97
|
-
default: true,
|
|
98
|
-
description: 'A member of the community that can only partcipate in group they are added to',
|
|
99
|
-
},
|
|
100
|
-
]),
|
|
110
|
+
roles: versionedRoles('2026-10-06', builtinRoles),
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
version: '2026-10-13',
|
|
114
|
+
roles: versionedRoles('2026-10-13', adminCanManageMedia(builtinRoles)),
|
|
101
115
|
},
|
|
102
116
|
];
|
|
103
117
|
/** The current (last) version — the one in use. */
|