@openpeepshq/common 0.4.0 → 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 +9 -0
- package/dist/lib/eventRecurrence.js +17 -9
- package/dist/lib/eventWaitlist.d.ts +58 -0
- package/dist/lib/eventWaitlist.js +217 -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 +72 -9
- 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 +15 -9
- package/dist/types/capabilities.d.ts +2 -2
- package/dist/types/capabilities.js +3 -0
- package/dist/types/config.d.ts +3 -0
- package/dist/types/config.js +6 -0
- 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 +28 -14
- package/dist/types/models.js +27 -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 +19 -10
- package/src/lib/eventWaitlist.ts +325 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/markdownHelpers.ts +121 -7
- package/src/lib/postHelpers.ts +101 -11
- 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 +19 -9
- package/src/types/auth.ts +2 -2
- package/src/types/capabilities.ts +3 -0
- package/src/types/config.ts +6 -0
- package/src/types/forbiddenHandles.ts +103 -0
- package/src/types/index.ts +2 -0
- package/src/types/models.ts +53 -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;
|
|
@@ -742,8 +741,8 @@ export declare const postTypeSchema: z.ZodEnum<{
|
|
|
742
741
|
}>;
|
|
743
742
|
export type PostType = z.infer<typeof postTypeSchema>;
|
|
744
743
|
export declare const resourceKindSchema: z.ZodEnum<{
|
|
745
|
-
link: "link";
|
|
746
744
|
file: "file";
|
|
745
|
+
link: "link";
|
|
747
746
|
video: "video";
|
|
748
747
|
gallery: "gallery";
|
|
749
748
|
audio: "audio";
|
|
@@ -969,6 +968,8 @@ export declare const articleSchema: z.ZodObject<{
|
|
|
969
968
|
title: z.ZodOptional<z.ZodString>;
|
|
970
969
|
}, z.core.$strip>;
|
|
971
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;
|
|
972
973
|
export declare const resourcePostSchema: z.ZodObject<{
|
|
973
974
|
content: z.ZodOptional<z.ZodString>;
|
|
974
975
|
sensitive: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1012,8 +1013,8 @@ export declare const resourcePostSchema: z.ZodObject<{
|
|
|
1012
1013
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1013
1014
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1014
1015
|
resourceKind: z.ZodEnum<{
|
|
1015
|
-
link: "link";
|
|
1016
1016
|
file: "file";
|
|
1017
|
+
link: "link";
|
|
1017
1018
|
video: "video";
|
|
1018
1019
|
gallery: "gallery";
|
|
1019
1020
|
audio: "audio";
|
|
@@ -1119,6 +1120,7 @@ export declare const eventSchema: z.ZodObject<{
|
|
|
1119
1120
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1120
1121
|
wholeDay: z.ZodBoolean;
|
|
1121
1122
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1123
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1122
1124
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1123
1125
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1124
1126
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -1313,6 +1315,7 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1313
1315
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1314
1316
|
wholeDay: z.ZodBoolean;
|
|
1315
1317
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1318
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1316
1319
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1317
1320
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1318
1321
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -1455,8 +1458,8 @@ export declare const postDataUnionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1455
1458
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1456
1459
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1457
1460
|
resourceKind: z.ZodEnum<{
|
|
1458
|
-
link: "link";
|
|
1459
1461
|
file: "file";
|
|
1462
|
+
link: "link";
|
|
1460
1463
|
video: "video";
|
|
1461
1464
|
gallery: "gallery";
|
|
1462
1465
|
audio: "audio";
|
|
@@ -1613,6 +1616,7 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
1613
1616
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1614
1617
|
wholeDay: z.ZodBoolean;
|
|
1615
1618
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1619
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1616
1620
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1617
1621
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1618
1622
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -1755,8 +1759,8 @@ export declare const postDataSchema: z.ZodObject<{
|
|
|
1755
1759
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1756
1760
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1757
1761
|
resourceKind: z.ZodEnum<{
|
|
1758
|
-
link: "link";
|
|
1759
1762
|
file: "file";
|
|
1763
|
+
link: "link";
|
|
1760
1764
|
video: "video";
|
|
1761
1765
|
gallery: "gallery";
|
|
1762
1766
|
audio: "audio";
|
|
@@ -1915,6 +1919,7 @@ export declare const postSchema: z.ZodObject<{
|
|
|
1915
1919
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
1916
1920
|
wholeDay: z.ZodBoolean;
|
|
1917
1921
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
1922
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1918
1923
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
1919
1924
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1920
1925
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -2057,8 +2062,8 @@ export declare const postSchema: z.ZodObject<{
|
|
|
2057
2062
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2058
2063
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2059
2064
|
resourceKind: z.ZodEnum<{
|
|
2060
|
-
link: "link";
|
|
2061
2065
|
file: "file";
|
|
2066
|
+
link: "link";
|
|
2062
2067
|
video: "video";
|
|
2063
2068
|
gallery: "gallery";
|
|
2064
2069
|
audio: "audio";
|
|
@@ -2081,6 +2086,7 @@ export declare const rsvpResponseSchema: z.ZodEnum<{
|
|
|
2081
2086
|
yes: "yes";
|
|
2082
2087
|
tentative: "tentative";
|
|
2083
2088
|
removed: "removed";
|
|
2089
|
+
waitlist: "waitlist";
|
|
2084
2090
|
}>;
|
|
2085
2091
|
export type RsvpResponse = z.infer<typeof rsvpResponseSchema>;
|
|
2086
2092
|
export declare const rsvpSchema: z.ZodObject<{
|
|
@@ -2089,18 +2095,22 @@ export declare const rsvpSchema: z.ZodObject<{
|
|
|
2089
2095
|
yes: "yes";
|
|
2090
2096
|
tentative: "tentative";
|
|
2091
2097
|
removed: "removed";
|
|
2098
|
+
waitlist: "waitlist";
|
|
2092
2099
|
}>;
|
|
2093
2100
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2101
|
+
waitlistJoinedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2102
|
+
offerExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2094
2103
|
}, z.core.$strip>;
|
|
2095
2104
|
export type RSVP = z.infer<typeof rsvpSchema>;
|
|
2096
2105
|
export declare const rsvpRequestSchema: z.ZodObject<{
|
|
2106
|
+
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2097
2107
|
response: z.ZodEnum<{
|
|
2098
2108
|
no: "no";
|
|
2099
2109
|
yes: "yes";
|
|
2100
2110
|
tentative: "tentative";
|
|
2101
2111
|
removed: "removed";
|
|
2112
|
+
waitlist: "waitlist";
|
|
2102
2113
|
}>;
|
|
2103
|
-
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2104
2114
|
recurrenceIds: z.ZodOptional<z.ZodArray<z.ZodISODateTime>>;
|
|
2105
2115
|
}, z.core.$strip>;
|
|
2106
2116
|
export type RsvpRequest = z.infer<typeof rsvpRequestSchema>;
|
|
@@ -2240,6 +2250,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2240
2250
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
2241
2251
|
wholeDay: z.ZodBoolean;
|
|
2242
2252
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
2253
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
2243
2254
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
2244
2255
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2245
2256
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -2382,8 +2393,8 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2382
2393
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2383
2394
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2384
2395
|
resourceKind: z.ZodEnum<{
|
|
2385
|
-
link: "link";
|
|
2386
2396
|
file: "file";
|
|
2397
|
+
link: "link";
|
|
2387
2398
|
video: "video";
|
|
2388
2399
|
gallery: "gallery";
|
|
2389
2400
|
audio: "audio";
|
|
@@ -2523,6 +2534,7 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2523
2534
|
end: z.ZodOptional<z.ZodISODateTime>;
|
|
2524
2535
|
wholeDay: z.ZodBoolean;
|
|
2525
2536
|
maxAttendees: z.ZodOptional<z.ZodNumber>;
|
|
2537
|
+
waitlistOfferMinutes: z.ZodOptional<z.ZodNumber>;
|
|
2526
2538
|
attendeeListPublic: z.ZodOptional<z.ZodBoolean>;
|
|
2527
2539
|
moderators: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2528
2540
|
jam: z.ZodOptional<z.ZodObject<{
|
|
@@ -2665,8 +2677,8 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2665
2677
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2666
2678
|
categoryPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2667
2679
|
resourceKind: z.ZodEnum<{
|
|
2668
|
-
link: "link";
|
|
2669
2680
|
file: "file";
|
|
2681
|
+
link: "link";
|
|
2670
2682
|
video: "video";
|
|
2671
2683
|
gallery: "gallery";
|
|
2672
2684
|
audio: "audio";
|
|
@@ -2689,8 +2701,11 @@ export declare const entryDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2689
2701
|
yes: "yes";
|
|
2690
2702
|
tentative: "tentative";
|
|
2691
2703
|
removed: "removed";
|
|
2704
|
+
waitlist: "waitlist";
|
|
2692
2705
|
}>;
|
|
2693
2706
|
recurrenceId: z.ZodOptional<z.ZodISODateTime>;
|
|
2707
|
+
waitlistJoinedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2708
|
+
offerExpiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2694
2709
|
}, z.core.$strip>;
|
|
2695
2710
|
}, z.core.$strip>, z.ZodObject<{
|
|
2696
2711
|
type: z.ZodLiteral<"reaction">;
|
|
@@ -3077,8 +3092,8 @@ export declare const jamEventDataSchema: z.ZodObject<{
|
|
|
3077
3092
|
id: z.ZodString;
|
|
3078
3093
|
jamId: z.ZodString;
|
|
3079
3094
|
type: z.ZodEnum<{
|
|
3080
|
-
message: "message";
|
|
3081
3095
|
join: "join";
|
|
3096
|
+
message: "message";
|
|
3082
3097
|
start: "start";
|
|
3083
3098
|
reaction: "reaction";
|
|
3084
3099
|
leave: "leave";
|
|
@@ -3099,8 +3114,8 @@ export type JamEventData = z.infer<typeof jamEventDataSchema>;
|
|
|
3099
3114
|
export declare const jamEventSchema: z.ZodObject<{
|
|
3100
3115
|
jamId: z.ZodString;
|
|
3101
3116
|
type: z.ZodEnum<{
|
|
3102
|
-
message: "message";
|
|
3103
3117
|
join: "join";
|
|
3118
|
+
message: "message";
|
|
3104
3119
|
start: "start";
|
|
3105
3120
|
reaction: "reaction";
|
|
3106
3121
|
leave: "leave";
|
|
@@ -3274,4 +3289,3 @@ export declare const jamRecordingSchema: z.ZodObject<{
|
|
|
3274
3289
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
3275
3290
|
}, z.core.$strip>;
|
|
3276
3291
|
export type JamRecording = Model<JamRecordingData>;
|
|
3277
|
-
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(),
|
|
@@ -153,8 +132,8 @@ export const profileSettingsDataSchema = z.object({
|
|
|
153
132
|
export const profileSettingsSchema = modelSchema(profileSettingsDataSchema);
|
|
154
133
|
export const accountNameSchema = z
|
|
155
134
|
.string()
|
|
156
|
-
.refine((value) => !
|
|
157
|
-
message:
|
|
135
|
+
.refine((value) => !isForbiddenHandle(value), {
|
|
136
|
+
message: HANDLE_RESERVED_MESSAGE,
|
|
158
137
|
})
|
|
159
138
|
.refine((value) => handleRegex.test(value ?? ''), {
|
|
160
139
|
message: 'Handle must be 1–16 characters: letters, numbers, underscores, or hyphens (no spaces or punctuation)',
|
|
@@ -395,10 +374,12 @@ export const articleSchema = noteSchema
|
|
|
395
374
|
title: z.string().optional(),
|
|
396
375
|
})
|
|
397
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;
|
|
398
379
|
export const resourcePostSchema = noteSchema
|
|
399
380
|
.extend({
|
|
400
381
|
type: z.literal('resource'),
|
|
401
|
-
title: z.string(),
|
|
382
|
+
title: z.string().max(RESOURCE_TITLE_MAX_LENGTH),
|
|
402
383
|
tags: z.array(z.string().min(1)).optional(),
|
|
403
384
|
categoryPath: z.array(z.string().min(1)).optional(),
|
|
404
385
|
resourceKind: resourceKindSchema,
|
|
@@ -451,6 +432,8 @@ export const eventSchema = noteSchema
|
|
|
451
432
|
end: eventIsoDatetimeSchema.optional(),
|
|
452
433
|
wholeDay: z.boolean(),
|
|
453
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(),
|
|
454
437
|
attendeeListPublic: z.boolean().optional(),
|
|
455
438
|
moderators: z.string().uuid().array().optional(),
|
|
456
439
|
jam: jamSchema.optional(),
|
|
@@ -458,6 +441,10 @@ export const eventSchema = noteSchema
|
|
|
458
441
|
url: z.url().optional(),
|
|
459
442
|
recurrence: eventRecurrenceSchema.optional(),
|
|
460
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'],
|
|
461
448
|
})
|
|
462
449
|
.openapi('Event');
|
|
463
450
|
export const postDataUnionSchema = z.discriminatedUnion('type', [
|
|
@@ -480,12 +467,24 @@ export const answerSchema = z
|
|
|
480
467
|
selection: z.number().array(),
|
|
481
468
|
})
|
|
482
469
|
.openapi('Answer');
|
|
483
|
-
export const rsvpResponseSchema = z.enum([
|
|
470
|
+
export const rsvpResponseSchema = z.enum([
|
|
471
|
+
'yes',
|
|
472
|
+
'no',
|
|
473
|
+
'tentative',
|
|
474
|
+
'removed',
|
|
475
|
+
'waitlist',
|
|
476
|
+
]);
|
|
484
477
|
export const rsvpSchema = z.object({
|
|
485
478
|
response: rsvpResponseSchema,
|
|
486
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(),
|
|
487
484
|
});
|
|
488
|
-
export const rsvpRequestSchema = rsvpSchema
|
|
485
|
+
export const rsvpRequestSchema = rsvpSchema
|
|
486
|
+
.omit({ waitlistJoinedAt: true, offerExpiresAt: true })
|
|
487
|
+
.extend({
|
|
489
488
|
recurrenceIds: z.array(eventIsoDatetimeSchema).min(1).optional(),
|
|
490
489
|
});
|
|
491
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. */
|