@openpeepshq/common 0.1.43 → 0.1.45
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/capabilitiesHelpers.d.ts +7 -7
- package/dist/lib/capabilitiesHelpers.js +4 -11
- package/dist/lib/eventIcs.js +56 -2
- package/dist/lib/eventRecurrence.d.ts +30 -0
- package/dist/lib/eventRecurrence.js +279 -0
- package/dist/lib/eventTime.d.ts +22 -0
- package/dist/lib/eventTime.js +127 -0
- package/dist/lib/groupHelpers.d.ts +63 -41
- package/dist/lib/groupHelpers.js +155 -45
- package/dist/lib/groupTemplateHelpers.d.ts +16 -0
- package/dist/lib/groupTemplateHelpers.js +51 -0
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/index.js +5 -0
- package/dist/lib/jamHelpers.d.ts +28 -2
- package/dist/lib/jamHelpers.js +56 -8
- package/dist/lib/markdownHelpers.d.ts +14 -0
- package/dist/lib/markdownHelpers.js +41 -0
- package/dist/lib/postHelpers.d.ts +24 -6
- package/dist/lib/postHelpers.js +79 -21
- package/dist/lib/profileHelpers.d.ts +11 -0
- package/dist/lib/profileHelpers.js +29 -0
- package/dist/lib/pushHelpers.d.ts +3 -1
- package/dist/lib/pushHelpers.js +13 -0
- package/dist/lib/reportHelpers.d.ts +2 -0
- package/dist/lib/reportHelpers.js +2 -0
- package/dist/lib/ssoLoginUrl.d.ts +24 -0
- package/dist/lib/ssoLoginUrl.js +75 -0
- package/dist/lib/text.d.ts +2 -0
- package/dist/lib/text.js +2 -0
- package/dist/lib/tokenHelpers.d.ts +5 -0
- package/dist/lib/tokenHelpers.js +19 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/types/analytics.d.ts +86 -0
- package/dist/types/analytics.js +21 -0
- package/dist/types/api.d.ts +2392 -355
- package/dist/types/api.js +44 -18
- package/dist/types/auth.d.ts +2 -7
- package/dist/types/capabilities.d.ts +11 -4
- package/dist/types/capabilities.js +44 -1
- package/dist/types/config.d.ts +50 -24
- package/dist/types/config.js +28 -15
- package/dist/types/db.d.ts +738 -66
- package/dist/types/db.js +3 -3
- package/dist/types/internal.d.ts +6189 -2604
- package/dist/types/internal.js +10 -1
- package/dist/types/models.d.ts +280 -9
- package/dist/types/models.js +59 -5
- package/dist/types/notifications.d.ts +39 -1
- package/dist/types/notifications.js +12 -0
- package/dist/types/plugins.d.ts +21 -1
- package/dist/types/plugins.js +9 -1
- package/dist/types/stats.d.ts +1284 -184
- package/package.json +1 -1
package/dist/types/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { pushNotificationSchema } from './notifications.js';
|
|
2
|
+
import { notificationStatsSchema, pushNotificationSchema, } from './notifications.js';
|
|
3
3
|
import { accessTokenSchema, accountInteractionsSchema, accountNameSchema, accountSchema, answerSchema, applicationDataSchema, groupDataSchema, groupRoleSchema, groupSchema, guestDataSchema, hashtagSchema, inviteLinkSchema, latLngSchema, locationSchema, mediaAttachmentSchema, mentionDataSchema, postDataUnionSchema, postTypeSchema, profileDataSchema, profileStatsSchema, reactionDataSchema, reportDataSchema, reportSchema, resourceSchema, rsvpSchema, scopeSchema, visibilityTypeSchema, } from './models.js';
|
|
4
4
|
import { groupWithMetaSchema } from './internal.js';
|
|
5
5
|
import { communityConfigSchema } from './config.js';
|
|
@@ -92,6 +92,10 @@ export const entryWithPublicProfileSchema = z.discriminatedUnion('type', [
|
|
|
92
92
|
const reactionWithPublicProfileSchema = reactionDataSchema.extend({
|
|
93
93
|
profile: publicProfileSchema,
|
|
94
94
|
});
|
|
95
|
+
const repostWithPublicProfileSchema = z.object({
|
|
96
|
+
profile: publicProfileSchema,
|
|
97
|
+
createdAt: z.string().datetime(),
|
|
98
|
+
});
|
|
95
99
|
export const publicReplyPostSchema = z.object({
|
|
96
100
|
id: z.string(),
|
|
97
101
|
type: postTypeSchema,
|
|
@@ -116,6 +120,8 @@ const basePublicPostSchema = publicReplyPostSchema.extend({
|
|
|
116
120
|
repostCount: z.number(),
|
|
117
121
|
replyCount: z.number(),
|
|
118
122
|
reactions: reactionWithPublicProfileSchema.array(),
|
|
123
|
+
/** Capped lean list of who reposted (most recent). Count stays in repostCount. */
|
|
124
|
+
reposts: repostWithPublicProfileSchema.array(),
|
|
119
125
|
application: publicApplicationSchema.optional(),
|
|
120
126
|
mentions: z.array(mentionWithPublicProfileSchema),
|
|
121
127
|
tags: z.array(hashtagSchema),
|
|
@@ -125,6 +131,9 @@ const basePublicPostSchema = publicReplyPostSchema.extend({
|
|
|
125
131
|
accountInteractions: accountInteractionsSchema.optional(),
|
|
126
132
|
rsvps: publicRsvpSchema.array(),
|
|
127
133
|
seen: z.boolean().optional(),
|
|
134
|
+
occurrenceRecurrenceId: z.string().datetime().optional(),
|
|
135
|
+
occurrenceStart: z.string().datetime().optional(),
|
|
136
|
+
occurrenceEnd: z.string().datetime().optional(),
|
|
128
137
|
});
|
|
129
138
|
const withReplyPostSchema = basePublicPostSchema.extend({
|
|
130
139
|
inReplyToId: z.string().optional().nullable(),
|
|
@@ -183,6 +192,8 @@ export const serverInfoSchema = z.object({
|
|
|
183
192
|
version: z.string(),
|
|
184
193
|
environment: z.string(),
|
|
185
194
|
publicContent: z.boolean(),
|
|
195
|
+
/** Latest post view (`post_seen.created_at`); null if none yet. */
|
|
196
|
+
lastAccessed: z.iso.datetime().nullable(),
|
|
186
197
|
maxProfiles: z.number().int().nonnegative().optional(),
|
|
187
198
|
communityConfig: communityConfigSchema,
|
|
188
199
|
jams: z.object({
|
|
@@ -207,16 +218,20 @@ export const serverInfoSchema = z.object({
|
|
|
207
218
|
}),
|
|
208
219
|
}),
|
|
209
220
|
}),
|
|
210
|
-
sso: z
|
|
221
|
+
sso: z
|
|
222
|
+
.object({
|
|
223
|
+
onlySSO: z.boolean().optional(),
|
|
224
|
+
generic: z.array(z.object({
|
|
225
|
+
id: z.string(),
|
|
226
|
+
name: z.string(),
|
|
227
|
+
loginLink: z.string(),
|
|
228
|
+
})),
|
|
211
229
|
oidc: z.array(z.object({
|
|
212
230
|
id: z.string(),
|
|
213
231
|
name: z.string(),
|
|
214
232
|
})),
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
export const notificationStatsSchema = z.object({
|
|
218
|
-
unread: z.number(),
|
|
219
|
-
unseen: z.number(),
|
|
233
|
+
})
|
|
234
|
+
.optional(),
|
|
220
235
|
});
|
|
221
236
|
export const unseenPostCountsSchema = z.object({
|
|
222
237
|
groups: z.record(z.string(), z.number()),
|
|
@@ -337,9 +352,10 @@ const focusCoordinatesPattern = /^-?\d+,-?\d+$/;
|
|
|
337
352
|
// they actually got a `File` / `Blob` instance.
|
|
338
353
|
export const mediaStorageRequestSchema = z.object({
|
|
339
354
|
description: z.string().optional(),
|
|
340
|
-
file: z
|
|
341
|
-
|
|
342
|
-
|
|
355
|
+
file: z.any().openapi({
|
|
356
|
+
type: 'string',
|
|
357
|
+
format: 'binary',
|
|
358
|
+
}),
|
|
343
359
|
thumbnail: z
|
|
344
360
|
.any()
|
|
345
361
|
.optional()
|
|
@@ -452,19 +468,19 @@ export const postCreationDataSchema = z.object({
|
|
|
452
468
|
});
|
|
453
469
|
export const postCreationDataFormSchema = postCreationDataSchema
|
|
454
470
|
.refine((data) => {
|
|
455
|
-
if (data.type !==
|
|
471
|
+
if (data.type !== 'event')
|
|
456
472
|
return true;
|
|
457
|
-
if (data.data.type !==
|
|
473
|
+
if (data.data.type !== 'event')
|
|
458
474
|
return true;
|
|
459
475
|
return !!data.data.name;
|
|
460
476
|
}, {
|
|
461
|
-
message:
|
|
462
|
-
path: [
|
|
477
|
+
message: 'Name is required',
|
|
478
|
+
path: ['data', 'name'],
|
|
463
479
|
})
|
|
464
480
|
.refine((data) => {
|
|
465
|
-
if (data.type !==
|
|
481
|
+
if (data.type !== 'event')
|
|
466
482
|
return true;
|
|
467
|
-
if (data.data.type !==
|
|
483
|
+
if (data.data.type !== 'event')
|
|
468
484
|
return true;
|
|
469
485
|
const { start, end } = data.data;
|
|
470
486
|
if (end && start && new Date(end) < new Date(start)) {
|
|
@@ -472,8 +488,8 @@ export const postCreationDataFormSchema = postCreationDataSchema
|
|
|
472
488
|
}
|
|
473
489
|
return true;
|
|
474
490
|
}, {
|
|
475
|
-
message:
|
|
476
|
-
path: [
|
|
491
|
+
message: 'End date cannot be before start date',
|
|
492
|
+
path: ['data', 'end'],
|
|
477
493
|
});
|
|
478
494
|
const answerWithPublicProfileSchema = answerSchema.extend({
|
|
479
495
|
profile: publicProfileSchema,
|
|
@@ -484,6 +500,16 @@ export const paymentCheckoutSchema = successFailureResponseSchema.extend({
|
|
|
484
500
|
export const jamObserverResponseSchema = z.object({
|
|
485
501
|
path: z.string().optional(),
|
|
486
502
|
});
|
|
503
|
+
export const jamRtmpStreamRequestSchema = z.object({
|
|
504
|
+
url: z.string().min(1),
|
|
505
|
+
streamKey: z.string().min(1),
|
|
506
|
+
});
|
|
507
|
+
export const jamRtmpStreamResponseSchema = z.object({
|
|
508
|
+
id: z.string(),
|
|
509
|
+
status: z.enum(['requested', 'active', 'completed', 'failed']),
|
|
510
|
+
destinationHost: z.string().optional(),
|
|
511
|
+
egressId: z.string().optional(),
|
|
512
|
+
});
|
|
487
513
|
export const accessTokenCreationDataSchema = z.object({
|
|
488
514
|
name: z.string(),
|
|
489
515
|
description: z.string().optional(),
|
package/dist/types/auth.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export declare const authorizationSchema: z.ZodObject<{
|
|
|
18
18
|
jams: "jams";
|
|
19
19
|
profiles: "profiles";
|
|
20
20
|
"*": "*";
|
|
21
|
-
jam: "jam";
|
|
22
21
|
notifications: "notifications";
|
|
23
22
|
posts: "posts";
|
|
24
23
|
groups: "groups";
|
|
@@ -75,7 +74,6 @@ export declare const authorizationDataSchema: z.ZodObject<{
|
|
|
75
74
|
jams: "jams";
|
|
76
75
|
profiles: "profiles";
|
|
77
76
|
"*": "*";
|
|
78
|
-
jam: "jam";
|
|
79
77
|
notifications: "notifications";
|
|
80
78
|
posts: "posts";
|
|
81
79
|
groups: "groups";
|
|
@@ -143,7 +141,6 @@ export declare const authorizationDataSchema: z.ZodObject<{
|
|
|
143
141
|
jams: "jams";
|
|
144
142
|
profiles: "profiles";
|
|
145
143
|
"*": "*";
|
|
146
|
-
jam: "jam";
|
|
147
144
|
notifications: "notifications";
|
|
148
145
|
posts: "posts";
|
|
149
146
|
groups: "groups";
|
|
@@ -202,7 +199,6 @@ export declare const authorizationDataSchema: z.ZodObject<{
|
|
|
202
199
|
jams: "jams";
|
|
203
200
|
profiles: "profiles";
|
|
204
201
|
"*": "*";
|
|
205
|
-
jam: "jam";
|
|
206
202
|
notifications: "notifications";
|
|
207
203
|
posts: "posts";
|
|
208
204
|
groups: "groups";
|
|
@@ -234,8 +230,9 @@ export declare const authorizationDataSchema: z.ZodObject<{
|
|
|
234
230
|
none: "none";
|
|
235
231
|
local: "local";
|
|
236
232
|
member: "member";
|
|
237
|
-
admin: "admin";
|
|
238
233
|
moderator: "moderator";
|
|
234
|
+
admin: "admin";
|
|
235
|
+
owner: "owner";
|
|
239
236
|
invited: "invited";
|
|
240
237
|
}>>>>;
|
|
241
238
|
group: z.ZodObject<{
|
|
@@ -319,7 +316,6 @@ export declare const authorizationDataSchema: z.ZodObject<{
|
|
|
319
316
|
jams: "jams";
|
|
320
317
|
profiles: "profiles";
|
|
321
318
|
"*": "*";
|
|
322
|
-
jam: "jam";
|
|
323
319
|
notifications: "notifications";
|
|
324
320
|
posts: "posts";
|
|
325
321
|
groups: "groups";
|
|
@@ -351,7 +347,6 @@ export declare const authorizationDataSchema: z.ZodObject<{
|
|
|
351
347
|
jams: "jams";
|
|
352
348
|
profiles: "profiles";
|
|
353
349
|
"*": "*";
|
|
354
|
-
jam: "jam";
|
|
355
350
|
notifications: "notifications";
|
|
356
351
|
posts: "posts";
|
|
357
352
|
groups: "groups";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type ObjectType = 'post' | 'group' | 'profile' | 'report' | 'community' | 'accessToken';
|
|
2
2
|
export declare const postRelationships: readonly ["none", "local", "audience", "mentioned", "attendee", "collaborator"];
|
|
3
|
-
export declare const defaultGroupRoles: readonly ["member", "admin", "
|
|
4
|
-
export declare const groupRelationships: readonly ["member", "admin", "
|
|
3
|
+
export declare const defaultGroupRoles: readonly ["member", "moderator", "admin", "owner"];
|
|
4
|
+
export declare const groupRelationships: readonly ["member", "moderator", "admin", "owner", "none", "local", "invited"];
|
|
5
5
|
export declare const profileRelationships: readonly ["none", "local", "self", "following", "followed-by", "blocked-by", "muted-by"];
|
|
6
6
|
export declare const reportRelationships: readonly ["none", "local", "reporter", "reported", "acted-on"];
|
|
7
7
|
export declare const accessTokenRelationships: readonly ["none", "local", "owner"];
|
|
@@ -11,7 +11,14 @@ export type ProfileRelationship = (typeof profileRelationships)[number];
|
|
|
11
11
|
export type ReportRelationship = (typeof reportRelationships)[number];
|
|
12
12
|
export type AccessTokenRelationship = (typeof accessTokenRelationships)[number];
|
|
13
13
|
export declare const postCapabilities: readonly ["core-posts-read", "core-posts-update", "core-posts-delete", "core-posts-vote", "core-posts-react", "core-posts-rsvp", "core-posts-reply", "core-posts-jam-moderate", "core-posts-jam-speak", "core-posts-jam-read"];
|
|
14
|
-
export declare const groupCapabilities: readonly ["core-groups-read", "core-groups-update", "core-groups-delete", "core-groups-join", "core-groups-leave", "core-groups-addMember", "core-groups-removeMember", "core-groups-changeMemberRole", "core-posts-create-note", "core-posts-create-event", "core-posts-create-poll", "core-posts-create-article"];
|
|
14
|
+
export declare const groupCapabilities: readonly ["core-groups-read", "core-groups-update", "core-groups-updateCapabilities", "core-groups-delete", "core-groups-join", "core-groups-leave", "core-groups-addMember", "core-groups-removeMember", "core-groups-changeMemberRole", "core-posts-create-note", "core-posts-create-event", "core-posts-create-poll", "core-posts-create-article"];
|
|
15
|
+
/** Caps an owner can toggle per relationship in the group editor. */
|
|
16
|
+
export declare const groupCapabilityEditorKeys: readonly ["core-groups-read", "core-groups-update", "core-groups-updateCapabilities", "core-groups-delete", "core-groups-join", "core-groups-leave", "core-groups-addMember", "core-groups-removeMember", "core-groups-changeMemberRole", "core-posts-create-note", "core-posts-create-event", "core-posts-create-poll", "core-posts-create-article", "core-posts-read", "core-posts-delete", "core-posts-react", "core-posts-reply", "core-posts-rsvp", "core-posts-vote", "core-posts-create-*", "core-posts-*", "core-groups-*"];
|
|
17
|
+
/** Owner is omitted — `*` / `core-groups-*` already grants every editor cap. */
|
|
18
|
+
export declare const groupCapabilityEditorRelationships: readonly ["none", "local", "member", "moderator", "admin"];
|
|
19
|
+
/** Explicit admin list — `core-groups-*` would also grant delete and cap edits. */
|
|
20
|
+
export declare const defaultGroupAdminCapabilityAdds: readonly ["core-posts-*", "core-groups-read", "core-groups-update", "core-groups-join", "core-groups-leave", "core-groups-addMember", "core-groups-removeMember", "core-groups-changeMemberRole"];
|
|
21
|
+
export declare const defaultGroupOwnerCapabilityAdds: readonly ["core-posts-*", "core-groups-*"];
|
|
15
22
|
export declare const profileCapabilities: readonly ["core-profiles-read", "core-profiles-update", "core-profiles-delete", "core-profiles-requestFollow", "core-profiles-follow", "core-profiles-unfollow", "core-profiles-block", "core-profiles-unblock", "core-profiles-mute", "core-profiles-unmute"];
|
|
16
23
|
export declare const reportCapabilities: readonly ["core-reports-create", "core-reports-read"];
|
|
17
24
|
export declare const accessTokenCapabilities: readonly ["core-serviceTokens-create", "core-serviceTokens-read", "core-serviceTokens-delete"];
|
|
@@ -20,5 +27,5 @@ export type GroupCapability = (typeof groupCapabilities)[number];
|
|
|
20
27
|
export type ProfileCapability = (typeof profileCapabilities)[number];
|
|
21
28
|
export type ReportCapability = (typeof reportCapabilities)[number];
|
|
22
29
|
export type AccessTokenCapability = (typeof accessTokenCapabilities)[number];
|
|
23
|
-
export declare const roleCapabilities: readonly ["core-local", "core-accounts-read", "core-accounts-create", "core-accounts-update", "core-accounts-delete", "core-reports-create", "core-reports-update", "core-groups-create", "core-groups-read", "core-groups-delete", "core-groups-addMember", "core-groups-removeMember", "core-groups-changeMemberRole", "core-posts-create-note-local", "core-posts-create-note-public", "core-posts-create-note-direct", "core-posts-create-note-private", "core-posts-create-event-local", "core-posts-create-event-public", "core-posts-create-event-direct", "core-posts-create-event-private", "core-posts-create-poll-local", "core-posts-create-poll-public", "core-posts-create-poll-direct", "core-posts-create-poll-private", "core-posts-create-article-local", "core-posts-create-article-public", "core-posts-create-article-direct", "core-posts-create-article-private", "core-posts-read-local", "core-posts-announce", "core-posts-delete", "core-profiles-read", "core-profiles-roles-update", "core-profiles-delete", "core-profiles-suspend", "core-profiles-update", "core-profiles-impersonate", "core-analytics-read", "core-config-update", "core-config-read", "core-customization-read", "core-customization-update", "core-capabilities-read", "core-capabilities-update", "core-backups-create", "core-backups-read", "core-backups-download", "core-backups-restore", "core-db-access", "core-i18n-update", "core-logs-read", "core-roles-read", "core-roles-update", "core-maintenance-restart", "core-inviteLinks-create", "core-inviteLinks-read", "core-inviteLinks-update", "core-inviteLinks-delete", "core-serviceTokens-create", "core-serviceTokens-read", "core-serviceTokens-update", "core-serviceTokens-delete"];
|
|
30
|
+
export declare const roleCapabilities: readonly ["core-local", "core-accounts-read", "core-accounts-create", "core-accounts-update", "core-accounts-delete", "core-reports-create", "core-reports-update", "core-groups-create", "core-groups-read", "core-groups-delete", "core-groups-addMember", "core-groups-removeMember", "core-groups-changeMemberRole", "core-posts-create-note-local", "core-posts-create-note-public", "core-posts-create-note-direct", "core-posts-create-note-private", "core-posts-create-event-local", "core-posts-create-event-public", "core-posts-create-event-direct", "core-posts-create-event-private", "core-posts-create-poll-local", "core-posts-create-poll-public", "core-posts-create-poll-direct", "core-posts-create-poll-private", "core-posts-create-article-local", "core-posts-create-article-public", "core-posts-create-article-direct", "core-posts-create-article-private", "core-posts-read-local", "core-posts-announce", "core-posts-delete", "core-profiles-read", "core-profiles-roles-update", "core-profiles-delete", "core-profiles-suspend", "core-profiles-update", "core-profiles-impersonate", "core-analytics-read", "core-config-update", "core-config-read", "core-customization-read", "core-customization-update", "core-capabilities-read", "core-capabilities-update", "core-backups-create", "core-backups-read", "core-backups-download", "core-backups-restore", "core-db-access", "core-i18n-update", "core-logs-read", "core-roles-read", "core-roles-update", "core-maintenance-restart", "core-inviteLinks-create", "core-inviteLinks-read", "core-inviteLinks-update", "core-inviteLinks-delete", "core-serviceTokens-create", "core-serviceTokens-read", "core-serviceTokens-update", "core-serviceTokens-delete", "core-plugins-manage"];
|
|
24
31
|
export type RoleCapability = (typeof roleCapabilities)[number];
|
|
@@ -6,7 +6,12 @@ export const postRelationships = [
|
|
|
6
6
|
'attendee',
|
|
7
7
|
'collaborator',
|
|
8
8
|
];
|
|
9
|
-
export const defaultGroupRoles = [
|
|
9
|
+
export const defaultGroupRoles = [
|
|
10
|
+
'member',
|
|
11
|
+
'moderator',
|
|
12
|
+
'admin',
|
|
13
|
+
'owner',
|
|
14
|
+
];
|
|
10
15
|
export const groupRelationships = [
|
|
11
16
|
...defaultGroupRoles,
|
|
12
17
|
'none',
|
|
@@ -45,6 +50,7 @@ export const postCapabilities = [
|
|
|
45
50
|
export const groupCapabilities = [
|
|
46
51
|
'core-groups-read',
|
|
47
52
|
'core-groups-update',
|
|
53
|
+
'core-groups-updateCapabilities',
|
|
48
54
|
'core-groups-delete',
|
|
49
55
|
'core-groups-join',
|
|
50
56
|
'core-groups-leave',
|
|
@@ -56,6 +62,42 @@ export const groupCapabilities = [
|
|
|
56
62
|
'core-posts-create-poll',
|
|
57
63
|
'core-posts-create-article',
|
|
58
64
|
];
|
|
65
|
+
/** Caps an owner can toggle per relationship in the group editor. */
|
|
66
|
+
export const groupCapabilityEditorKeys = [
|
|
67
|
+
...groupCapabilities,
|
|
68
|
+
'core-posts-read',
|
|
69
|
+
'core-posts-delete',
|
|
70
|
+
'core-posts-react',
|
|
71
|
+
'core-posts-reply',
|
|
72
|
+
'core-posts-rsvp',
|
|
73
|
+
'core-posts-vote',
|
|
74
|
+
'core-posts-create-*',
|
|
75
|
+
'core-posts-*',
|
|
76
|
+
'core-groups-*',
|
|
77
|
+
];
|
|
78
|
+
/** Owner is omitted — `*` / `core-groups-*` already grants every editor cap. */
|
|
79
|
+
export const groupCapabilityEditorRelationships = [
|
|
80
|
+
'none',
|
|
81
|
+
'local',
|
|
82
|
+
'member',
|
|
83
|
+
'moderator',
|
|
84
|
+
'admin',
|
|
85
|
+
];
|
|
86
|
+
/** Explicit admin list — `core-groups-*` would also grant delete and cap edits. */
|
|
87
|
+
export const defaultGroupAdminCapabilityAdds = [
|
|
88
|
+
'core-posts-*',
|
|
89
|
+
'core-groups-read',
|
|
90
|
+
'core-groups-update',
|
|
91
|
+
'core-groups-join',
|
|
92
|
+
'core-groups-leave',
|
|
93
|
+
'core-groups-addMember',
|
|
94
|
+
'core-groups-removeMember',
|
|
95
|
+
'core-groups-changeMemberRole',
|
|
96
|
+
];
|
|
97
|
+
export const defaultGroupOwnerCapabilityAdds = [
|
|
98
|
+
'core-posts-*',
|
|
99
|
+
'core-groups-*',
|
|
100
|
+
];
|
|
59
101
|
export const profileCapabilities = [
|
|
60
102
|
'core-profiles-read',
|
|
61
103
|
'core-profiles-update',
|
|
@@ -141,4 +183,5 @@ export const roleCapabilities = [
|
|
|
141
183
|
'core-serviceTokens-read',
|
|
142
184
|
'core-serviceTokens-update',
|
|
143
185
|
'core-serviceTokens-delete',
|
|
186
|
+
'core-plugins-manage',
|
|
144
187
|
];
|
package/dist/types/config.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
85
85
|
maxProfiles: z.ZodOptional<z.ZodNumber>;
|
|
86
86
|
}, z.core.$strip>;
|
|
87
87
|
db: z.ZodObject<{
|
|
88
|
-
url: z.ZodString
|
|
88
|
+
url: z.ZodOptional<z.ZodString>;
|
|
89
89
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
90
90
|
databaseUrl: z.ZodString;
|
|
91
91
|
}, z.core.$strip>;
|
|
@@ -128,6 +128,7 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
128
128
|
}, z.core.$strip>;
|
|
129
129
|
plugins: z.ZodObject<{
|
|
130
130
|
path: z.ZodString;
|
|
131
|
+
rootPackageJsonPath: z.ZodString;
|
|
131
132
|
}, z.core.$strip>;
|
|
132
133
|
secrets: z.ZodObject<{
|
|
133
134
|
jwt: z.ZodString | z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -156,7 +157,11 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
156
157
|
}, z.core.$strip>;
|
|
157
158
|
}, z.core.$strip>;
|
|
158
159
|
sso: z.ZodObject<{
|
|
160
|
+
onlySSO: z.ZodOptional<z.ZodBoolean>;
|
|
159
161
|
generic: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
162
|
+
id: z.ZodDefault<z.ZodString>;
|
|
163
|
+
name: z.ZodDefault<z.ZodString>;
|
|
164
|
+
loginLink: z.ZodOptional<z.ZodString>;
|
|
160
165
|
userProfileRequest: z.ZodObject<{
|
|
161
166
|
url: z.ZodString;
|
|
162
167
|
authHeader: z.ZodOptional<z.ZodString>;
|
|
@@ -240,7 +245,7 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
240
245
|
maxProfiles: z.ZodOptional<z.ZodNumber>;
|
|
241
246
|
}, z.core.$strip>;
|
|
242
247
|
db: z.ZodObject<{
|
|
243
|
-
url: z.ZodString
|
|
248
|
+
url: z.ZodOptional<z.ZodString>;
|
|
244
249
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
245
250
|
databaseUrl: z.ZodString;
|
|
246
251
|
}, z.core.$strip>;
|
|
@@ -283,6 +288,7 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
283
288
|
}, z.core.$strip>;
|
|
284
289
|
plugins: z.ZodObject<{
|
|
285
290
|
path: z.ZodString;
|
|
291
|
+
rootPackageJsonPath: z.ZodString;
|
|
286
292
|
}, z.core.$strip>;
|
|
287
293
|
secrets: z.ZodObject<{
|
|
288
294
|
jwt: z.ZodString | z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -311,7 +317,11 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
311
317
|
}, z.core.$strip>;
|
|
312
318
|
}, z.core.$strip>;
|
|
313
319
|
sso: z.ZodObject<{
|
|
320
|
+
onlySSO: z.ZodOptional<z.ZodBoolean>;
|
|
314
321
|
generic: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
322
|
+
id: z.ZodDefault<z.ZodString>;
|
|
323
|
+
name: z.ZodDefault<z.ZodString>;
|
|
324
|
+
loginLink: z.ZodOptional<z.ZodString>;
|
|
315
325
|
userProfileRequest: z.ZodObject<{
|
|
316
326
|
url: z.ZodString;
|
|
317
327
|
authHeader: z.ZodOptional<z.ZodString>;
|
|
@@ -395,7 +405,7 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
395
405
|
maxProfiles: z.ZodOptional<z.ZodNumber>;
|
|
396
406
|
}, z.core.$strip>;
|
|
397
407
|
db: z.ZodObject<{
|
|
398
|
-
url: z.ZodString
|
|
408
|
+
url: z.ZodOptional<z.ZodString>;
|
|
399
409
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
400
410
|
databaseUrl: z.ZodString;
|
|
401
411
|
}, z.core.$strip>;
|
|
@@ -438,6 +448,7 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
438
448
|
}, z.core.$strip>;
|
|
439
449
|
plugins: z.ZodObject<{
|
|
440
450
|
path: z.ZodString;
|
|
451
|
+
rootPackageJsonPath: z.ZodString;
|
|
441
452
|
}, z.core.$strip>;
|
|
442
453
|
secrets: z.ZodObject<{
|
|
443
454
|
jwt: z.ZodString | z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -466,7 +477,11 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
466
477
|
}, z.core.$strip>;
|
|
467
478
|
}, z.core.$strip>;
|
|
468
479
|
sso: z.ZodObject<{
|
|
480
|
+
onlySSO: z.ZodOptional<z.ZodBoolean>;
|
|
469
481
|
generic: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
482
|
+
id: z.ZodDefault<z.ZodString>;
|
|
483
|
+
name: z.ZodDefault<z.ZodString>;
|
|
484
|
+
loginLink: z.ZodOptional<z.ZodString>;
|
|
470
485
|
userProfileRequest: z.ZodObject<{
|
|
471
486
|
url: z.ZodString;
|
|
472
487
|
authHeader: z.ZodOptional<z.ZodString>;
|
|
@@ -541,20 +556,25 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
541
556
|
}, z.core.$strip>;
|
|
542
557
|
}, z.core.$strip>;
|
|
543
558
|
export type CoreConfig = z.infer<typeof coreConfigSchema>;
|
|
559
|
+
/** Community-configured member profile fields (`profiles.additionalFields`). */
|
|
560
|
+
export declare const communityProfileAdditionalFieldSchema: z.ZodObject<{
|
|
561
|
+
key: z.ZodString;
|
|
562
|
+
label: z.ZodString;
|
|
563
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
564
|
+
linkPattern: z.ZodOptional<z.ZodString>;
|
|
565
|
+
}, z.core.$strip>;
|
|
566
|
+
export type CommunityProfileAdditionalField = z.infer<typeof communityProfileAdditionalFieldSchema>;
|
|
544
567
|
export declare const communityConfigSchemaFactory: (_sanitize?: boolean) => z.ZodObject<{
|
|
545
568
|
theme: z.ZodObject<{
|
|
546
569
|
base: z.ZodString;
|
|
547
570
|
icon: z.ZodOptional<z.ZodString>;
|
|
548
571
|
mobileIcon: z.ZodOptional<z.ZodString>;
|
|
549
|
-
primaryHex: z.ZodString;
|
|
550
|
-
logoFull: z.ZodOptional<z.ZodString>;
|
|
551
|
-
logoSmall: z.ZodOptional<z.ZodString>;
|
|
552
|
-
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
553
|
-
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
554
|
-
backgroundAuth: z.ZodOptional<z.ZodString>;
|
|
555
|
-
background: z.ZodOptional<z.ZodString>;
|
|
556
572
|
light: z.ZodObject<{
|
|
557
573
|
primaryHex: z.ZodString;
|
|
574
|
+
secondaryHex: z.ZodOptional<z.ZodString>;
|
|
575
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
576
|
+
buttonRadius: z.ZodOptional<z.ZodString>;
|
|
577
|
+
radius: z.ZodOptional<z.ZodString>;
|
|
558
578
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
559
579
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
560
580
|
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -563,6 +583,10 @@ export declare const communityConfigSchemaFactory: (_sanitize?: boolean) => z.Zo
|
|
|
563
583
|
}, z.core.$strip>;
|
|
564
584
|
dark: z.ZodObject<{
|
|
565
585
|
primaryHex: z.ZodString;
|
|
586
|
+
secondaryHex: z.ZodOptional<z.ZodString>;
|
|
587
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
588
|
+
buttonRadius: z.ZodOptional<z.ZodString>;
|
|
589
|
+
radius: z.ZodOptional<z.ZodString>;
|
|
566
590
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
567
591
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
568
592
|
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -612,15 +636,12 @@ export declare const communityConfigSchema: z.ZodObject<{
|
|
|
612
636
|
base: z.ZodString;
|
|
613
637
|
icon: z.ZodOptional<z.ZodString>;
|
|
614
638
|
mobileIcon: z.ZodOptional<z.ZodString>;
|
|
615
|
-
primaryHex: z.ZodString;
|
|
616
|
-
logoFull: z.ZodOptional<z.ZodString>;
|
|
617
|
-
logoSmall: z.ZodOptional<z.ZodString>;
|
|
618
|
-
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
619
|
-
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
620
|
-
backgroundAuth: z.ZodOptional<z.ZodString>;
|
|
621
|
-
background: z.ZodOptional<z.ZodString>;
|
|
622
639
|
light: z.ZodObject<{
|
|
623
640
|
primaryHex: z.ZodString;
|
|
641
|
+
secondaryHex: z.ZodOptional<z.ZodString>;
|
|
642
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
643
|
+
buttonRadius: z.ZodOptional<z.ZodString>;
|
|
644
|
+
radius: z.ZodOptional<z.ZodString>;
|
|
624
645
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
625
646
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
626
647
|
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -629,6 +650,10 @@ export declare const communityConfigSchema: z.ZodObject<{
|
|
|
629
650
|
}, z.core.$strip>;
|
|
630
651
|
dark: z.ZodObject<{
|
|
631
652
|
primaryHex: z.ZodString;
|
|
653
|
+
secondaryHex: z.ZodOptional<z.ZodString>;
|
|
654
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
655
|
+
buttonRadius: z.ZodOptional<z.ZodString>;
|
|
656
|
+
radius: z.ZodOptional<z.ZodString>;
|
|
632
657
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
633
658
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
634
659
|
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -678,15 +703,12 @@ export declare const communityConfigSanitizedSchema: z.ZodObject<{
|
|
|
678
703
|
base: z.ZodString;
|
|
679
704
|
icon: z.ZodOptional<z.ZodString>;
|
|
680
705
|
mobileIcon: z.ZodOptional<z.ZodString>;
|
|
681
|
-
primaryHex: z.ZodString;
|
|
682
|
-
logoFull: z.ZodOptional<z.ZodString>;
|
|
683
|
-
logoSmall: z.ZodOptional<z.ZodString>;
|
|
684
|
-
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
685
|
-
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
686
|
-
backgroundAuth: z.ZodOptional<z.ZodString>;
|
|
687
|
-
background: z.ZodOptional<z.ZodString>;
|
|
688
706
|
light: z.ZodObject<{
|
|
689
707
|
primaryHex: z.ZodString;
|
|
708
|
+
secondaryHex: z.ZodOptional<z.ZodString>;
|
|
709
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
710
|
+
buttonRadius: z.ZodOptional<z.ZodString>;
|
|
711
|
+
radius: z.ZodOptional<z.ZodString>;
|
|
690
712
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
691
713
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
692
714
|
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -695,6 +717,10 @@ export declare const communityConfigSanitizedSchema: z.ZodObject<{
|
|
|
695
717
|
}, z.core.$strip>;
|
|
696
718
|
dark: z.ZodObject<{
|
|
697
719
|
primaryHex: z.ZodString;
|
|
720
|
+
secondaryHex: z.ZodOptional<z.ZodString>;
|
|
721
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
722
|
+
buttonRadius: z.ZodOptional<z.ZodString>;
|
|
723
|
+
radius: z.ZodOptional<z.ZodString>;
|
|
698
724
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
699
725
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
700
726
|
defaultGroupAvatar: z.ZodOptional<z.ZodString>;
|
package/dist/types/config.js
CHANGED
|
@@ -59,7 +59,8 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
59
59
|
maxProfiles: fixed(z.number().int().nonnegative().optional(), sanitize),
|
|
60
60
|
}),
|
|
61
61
|
db: fixed(z.object({
|
|
62
|
-
|
|
62
|
+
// Optional leftovers so Arango-era stored configs still parse.
|
|
63
|
+
url: z.string().url().optional(),
|
|
63
64
|
databaseName: z.string().optional(),
|
|
64
65
|
databaseUrl: z.string(),
|
|
65
66
|
}), sanitize),
|
|
@@ -83,6 +84,7 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
83
84
|
}),
|
|
84
85
|
plugins: z.object({
|
|
85
86
|
path: z.string(),
|
|
87
|
+
rootPackageJsonPath: z.string(),
|
|
86
88
|
}),
|
|
87
89
|
secrets: z.object({
|
|
88
90
|
jwt: password(sanitize),
|
|
@@ -111,8 +113,13 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
111
113
|
}),
|
|
112
114
|
}),
|
|
113
115
|
sso: z.object({
|
|
116
|
+
onlySSO: z.boolean().optional(),
|
|
114
117
|
generic: z
|
|
115
118
|
.object({
|
|
119
|
+
id: z.string().default('example-generic'),
|
|
120
|
+
name: z.string().default('Generic SSO'),
|
|
121
|
+
/** URL or path shown on the login page to start this provider's flow. */
|
|
122
|
+
loginLink: z.string().optional(),
|
|
116
123
|
userProfileRequest: z.object({
|
|
117
124
|
url: z.string(),
|
|
118
125
|
authHeader: z.string().optional(),
|
|
@@ -127,6 +134,9 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
127
134
|
createProfiles: z.boolean().optional(),
|
|
128
135
|
})
|
|
129
136
|
.default({
|
|
137
|
+
id: 'example-generic',
|
|
138
|
+
name: 'Generic SSO',
|
|
139
|
+
loginLink: '',
|
|
130
140
|
userProfileRequest: {
|
|
131
141
|
url: 'https://example.com/profile',
|
|
132
142
|
authHeader: 'Bearer ${token}',
|
|
@@ -211,20 +221,25 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
211
221
|
});
|
|
212
222
|
export const coreConfigSchema = coreConfigSchemaFactory(false);
|
|
213
223
|
export const coreConfigSanitizedSchema = coreConfigSchemaFactory(true);
|
|
224
|
+
/** Community-configured member profile fields (`profiles.additionalFields`). */
|
|
225
|
+
export const communityProfileAdditionalFieldSchema = z.object({
|
|
226
|
+
// Trim so whitespace-only keys fail the same as "".
|
|
227
|
+
key: z.string().trim().min(1),
|
|
228
|
+
label: z.string(),
|
|
229
|
+
icon: z.string().optional(),
|
|
230
|
+
linkPattern: z.string().optional(),
|
|
231
|
+
});
|
|
214
232
|
export const communityConfigSchemaFactory = (_sanitize) => z.object({
|
|
215
233
|
theme: z.object({
|
|
216
234
|
base: z.string(),
|
|
217
235
|
icon: z.string().optional(),
|
|
218
236
|
mobileIcon: z.string().optional(),
|
|
219
|
-
primaryHex: z.string(),
|
|
220
|
-
logoFull: z.string().optional(),
|
|
221
|
-
logoSmall: z.string().optional(),
|
|
222
|
-
defaultProfileAvatar: z.string().optional(),
|
|
223
|
-
defaultGroupAvatar: z.string().optional(),
|
|
224
|
-
backgroundAuth: z.string().optional(),
|
|
225
|
-
background: z.string().optional(),
|
|
226
237
|
light: z.object({
|
|
227
238
|
primaryHex: z.string(),
|
|
239
|
+
secondaryHex: z.string().optional(),
|
|
240
|
+
fontFamily: z.string().optional(),
|
|
241
|
+
buttonRadius: z.string().optional(),
|
|
242
|
+
radius: z.string().optional(),
|
|
228
243
|
logoSmall: z.string().optional(),
|
|
229
244
|
defaultProfileAvatar: z.string().optional(),
|
|
230
245
|
defaultGroupAvatar: z.string().optional(),
|
|
@@ -233,6 +248,10 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
|
|
|
233
248
|
}),
|
|
234
249
|
dark: z.object({
|
|
235
250
|
primaryHex: z.string(),
|
|
251
|
+
secondaryHex: z.string().optional(),
|
|
252
|
+
fontFamily: z.string().optional(),
|
|
253
|
+
buttonRadius: z.string().optional(),
|
|
254
|
+
radius: z.string().optional(),
|
|
236
255
|
logoSmall: z.string().optional(),
|
|
237
256
|
defaultProfileAvatar: z.string().optional(),
|
|
238
257
|
defaultGroupAvatar: z.string().optional(),
|
|
@@ -243,13 +262,7 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
|
|
|
243
262
|
profiles: z
|
|
244
263
|
.object({
|
|
245
264
|
additionalFields: z
|
|
246
|
-
.
|
|
247
|
-
key: z.string(),
|
|
248
|
-
label: z.string(),
|
|
249
|
-
icon: z.string().optional(),
|
|
250
|
-
linkPattern: z.string().optional(),
|
|
251
|
-
})
|
|
252
|
-
.array()
|
|
265
|
+
.array(communityProfileAdditionalFieldSchema)
|
|
253
266
|
.optional(),
|
|
254
267
|
})
|
|
255
268
|
.optional(),
|