@openpeepshq/common 0.1.45 → 0.2.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.js +1 -1
- package/dist/lib/capabilitiesHelpers.d.ts +9 -7
- package/dist/lib/capabilitiesHelpers.js +43 -38
- package/dist/lib/csvHelpers.js +1 -1
- package/dist/lib/eventIcs.d.ts +17 -0
- package/dist/lib/eventIcs.js +91 -15
- package/dist/lib/eventRecurrence.d.ts +19 -0
- package/dist/lib/eventRecurrence.js +82 -20
- package/dist/lib/eventTime.d.ts +7 -0
- package/dist/lib/eventTime.js +23 -9
- package/dist/lib/federationHosts.d.ts +3 -0
- package/dist/lib/federationHosts.js +17 -0
- package/dist/lib/feedCursor.d.ts +14 -0
- package/dist/lib/feedCursor.js +22 -0
- package/dist/lib/feedFormat.d.ts +12 -0
- package/dist/lib/feedFormat.js +14 -0
- package/dist/lib/groupHelpers.js +13 -34
- package/dist/lib/groupTemplateHelpers.js +6 -10
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/jamHelpers.d.ts +11 -2
- package/dist/lib/jamHelpers.js +43 -9
- package/dist/lib/legacyThemeRoot.d.ts +3 -0
- package/dist/lib/legacyThemeRoot.js +10 -0
- package/dist/lib/markdownHelpers.d.ts +8 -0
- package/dist/lib/markdownHelpers.js +34 -6
- package/dist/lib/postHelpers.d.ts +142 -3
- package/dist/lib/postHelpers.js +323 -47
- package/dist/lib/profileHelpers.d.ts +11 -0
- package/dist/lib/profileHelpers.js +34 -10
- package/dist/lib/pushHelpers.js +3 -4
- package/dist/lib/reactions.d.ts +17 -0
- package/dist/lib/reactions.js +37 -0
- package/dist/lib/scopeHelpers.d.ts +31 -2
- package/dist/lib/scopeHelpers.js +39 -8
- package/dist/lib/ssoLoginUrl.js +4 -6
- package/dist/lib/ssoProviders.d.ts +72 -0
- package/dist/lib/ssoProviders.js +366 -0
- package/dist/lib/timeZone.d.ts +9 -0
- package/dist/lib/timeZone.js +44 -0
- package/dist/lib/tokenHelpers.js +5 -5
- package/dist/lib/utils.js +6 -7
- package/dist/types/admin-db.js +1 -1
- package/dist/types/analytics.d.ts +20 -0
- package/dist/types/analytics.js +4 -0
- package/dist/types/api.d.ts +41800 -11853
- package/dist/types/api.js +53 -5
- package/dist/types/auth.d.ts +20 -6
- package/dist/types/capabilities.d.ts +15 -1
- package/dist/types/capabilities.js +51 -0
- package/dist/types/config.d.ts +99 -0
- package/dist/types/config.js +56 -4
- package/dist/types/db.d.ts +1155 -164
- package/dist/types/db.js +14 -0
- package/dist/types/export.d.ts +120 -0
- package/dist/types/export.js +7 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/internal.d.ts +2577 -524
- package/dist/types/internal.js +6 -0
- package/dist/types/models.d.ts +63 -7
- package/dist/types/models.js +40 -3
- package/dist/types/plugins.d.ts +22 -0
- package/dist/types/plugins.js +66 -0
- package/dist/types/roleDefaults.d.ts +31 -0
- package/dist/types/roleDefaults.js +110 -0
- package/dist/types/stats.d.ts +54606 -6065
- package/dist/types/stats.js +30 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types/utils.js +1 -3
- package/dist/zod.d.ts +1 -0
- package/dist/zod.js +1 -0
- package/package.json +36 -6
- package/src/index.ts +4 -0
- package/src/lib/adminSections.ts +84 -0
- package/src/lib/attachmentHelpers.ts +14 -0
- package/src/lib/capabilitiesHelpers.ts +532 -0
- package/src/lib/colors.ts +20 -0
- package/src/lib/csvHelpers.ts +31 -0
- package/src/lib/eventIcs.ts +265 -0
- package/src/lib/eventRecurrence.ts +495 -0
- package/src/lib/eventTime.ts +206 -0
- package/src/lib/federationHosts.ts +22 -0
- package/src/lib/feedCursor.ts +27 -0
- package/src/lib/feedFormat.ts +24 -0
- package/src/lib/groupHelpers.ts +421 -0
- package/src/lib/groupTemplateHelpers.ts +83 -0
- package/src/lib/index.ts +29 -0
- package/src/lib/jamHelpers.ts +164 -0
- package/src/lib/legacyThemeRoot.ts +14 -0
- package/src/lib/markdownHelpers.ts +122 -0
- package/src/lib/mediaDimensions.ts +21 -0
- package/src/lib/postHelpers.ts +783 -0
- package/src/lib/profileHelpers.ts +220 -0
- package/src/lib/pushHelpers.ts +34 -0
- package/src/lib/reactions.ts +52 -0
- package/src/lib/reportHelpers.ts +7 -0
- package/src/lib/scopeHelpers.ts +176 -0
- package/src/lib/ssoLoginUrl.ts +93 -0
- package/src/lib/ssoProviders.ts +472 -0
- package/src/lib/text.ts +26 -0
- package/src/lib/timeZone.ts +52 -0
- package/src/lib/tokenHelpers.ts +119 -0
- package/src/lib/utils.ts +322 -0
- package/src/types/admin-db.ts +74 -0
- package/src/types/admin-email.ts +55 -0
- package/src/types/admin-jobs.ts +17 -0
- package/src/types/admin-performance.ts +20 -0
- package/src/types/analytics.ts +318 -0
- package/src/types/api.ts +871 -0
- package/src/types/apple-app-site-association.ts +54 -0
- package/src/types/auth.ts +22 -0
- package/src/types/capabilities.ts +280 -0
- package/src/types/config.ts +546 -0
- package/src/types/db.ts +138 -0
- package/src/types/export.ts +10 -0
- package/src/types/index.ts +20 -0
- package/src/types/internal.ts +338 -0
- package/src/types/models.ts +939 -0
- package/src/types/notifications.ts +92 -0
- package/src/types/plugins.ts +150 -0
- package/src/types/roleDefaults.ts +132 -0
- package/src/types/stats.ts +195 -0
- package/src/types/stripe.ts +45 -0
- package/src/types/utils.ts +100 -0
- package/src/zod.ts +1 -0
package/dist/types/config.js
CHANGED
|
@@ -17,6 +17,14 @@ export const mediaStorageParamsSchema = z.object({
|
|
|
17
17
|
prefix: z.string(),
|
|
18
18
|
host: z.string().optional(),
|
|
19
19
|
});
|
|
20
|
+
/** MiB. 1024 is 1 GiB — the default shown in the admin media section. */
|
|
21
|
+
export const DEFAULT_MAX_MEDIA_UPLOAD_MB = 1024;
|
|
22
|
+
export const mediaUploadLimitBytes = (maxUploadMb) => {
|
|
23
|
+
const mb = Number.isInteger(maxUploadMb) && maxUploadMb >= 1
|
|
24
|
+
? maxUploadMb
|
|
25
|
+
: DEFAULT_MAX_MEDIA_UPLOAD_MB;
|
|
26
|
+
return mb * 1024 * 1024;
|
|
27
|
+
};
|
|
20
28
|
export const stripePaymentConfigSchema = (sanitize) => z.object({
|
|
21
29
|
paidMembership: z
|
|
22
30
|
.object({
|
|
@@ -59,7 +67,7 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
59
67
|
maxProfiles: fixed(z.number().int().nonnegative().optional(), sanitize),
|
|
60
68
|
}),
|
|
61
69
|
db: fixed(z.object({
|
|
62
|
-
// Optional
|
|
70
|
+
// Optional legacy fields so older stored configs still parse.
|
|
63
71
|
url: z.string().url().optional(),
|
|
64
72
|
databaseName: z.string().optional(),
|
|
65
73
|
databaseUrl: z.string(),
|
|
@@ -74,6 +82,12 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
74
82
|
}), sanitize),
|
|
75
83
|
}), sanitize),
|
|
76
84
|
media: z.object({
|
|
85
|
+
maxUploadMb: z
|
|
86
|
+
.number()
|
|
87
|
+
.int()
|
|
88
|
+
.min(1)
|
|
89
|
+
.default(DEFAULT_MAX_MEDIA_UPLOAD_MB)
|
|
90
|
+
.catch(DEFAULT_MAX_MEDIA_UPLOAD_MB),
|
|
77
91
|
storage: z.object({
|
|
78
92
|
driver: z.enum(['openpeeps']),
|
|
79
93
|
params: mediaStorageParamsSchema,
|
|
@@ -103,6 +117,8 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
103
117
|
}),
|
|
104
118
|
federation: z.object({
|
|
105
119
|
active: z.boolean(),
|
|
120
|
+
/** Host patterns (`mastodon.social`, `*.example.com`). Empty = fail closed. */
|
|
121
|
+
allowedHosts: z.array(z.string()).default([]),
|
|
106
122
|
}),
|
|
107
123
|
activityPub: z.object({
|
|
108
124
|
defaultDomain: z.string(),
|
|
@@ -112,7 +128,8 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
112
128
|
requestTimeout: z.number(),
|
|
113
129
|
}),
|
|
114
130
|
}),
|
|
115
|
-
sso: z
|
|
131
|
+
sso: z
|
|
132
|
+
.object({
|
|
116
133
|
onlySSO: z.boolean().optional(),
|
|
117
134
|
generic: z
|
|
118
135
|
.object({
|
|
@@ -152,9 +169,28 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
152
169
|
.object({
|
|
153
170
|
id: z.string(),
|
|
154
171
|
name: z.string(),
|
|
172
|
+
kind: z
|
|
173
|
+
.enum([
|
|
174
|
+
'oidc',
|
|
175
|
+
'github',
|
|
176
|
+
'gitlab',
|
|
177
|
+
'gitlab-selfhosted',
|
|
178
|
+
'google',
|
|
179
|
+
'entra',
|
|
180
|
+
'auth0',
|
|
181
|
+
'keycloak',
|
|
182
|
+
'authentik',
|
|
183
|
+
'okta',
|
|
184
|
+
'discord',
|
|
185
|
+
'pocketid',
|
|
186
|
+
])
|
|
187
|
+
.optional(),
|
|
188
|
+
instanceUrl: z.string().optional(),
|
|
189
|
+
tenant: z.string().optional(),
|
|
155
190
|
authorizationUrl: z.string(),
|
|
156
191
|
tokenUrl: z.string(),
|
|
157
192
|
userinfoUrl: z.string(),
|
|
193
|
+
emailsUrl: z.string().optional(),
|
|
158
194
|
jwksUri: z.string().optional(),
|
|
159
195
|
clientId: z.string(),
|
|
160
196
|
clientSecret: password(sanitize).optional(),
|
|
@@ -172,6 +208,7 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
172
208
|
.default({
|
|
173
209
|
id: 'example-oidc',
|
|
174
210
|
name: 'OIDC Provider',
|
|
211
|
+
kind: 'oidc',
|
|
175
212
|
authorizationUrl: 'https://example.com/authorize',
|
|
176
213
|
tokenUrl: 'https://example.com/token',
|
|
177
214
|
userinfoUrl: 'https://example.com/userinfo',
|
|
@@ -186,7 +223,8 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
186
223
|
approvalRequired: false,
|
|
187
224
|
})
|
|
188
225
|
.array(),
|
|
189
|
-
})
|
|
226
|
+
})
|
|
227
|
+
.describe('hidden'),
|
|
190
228
|
services: z.object({
|
|
191
229
|
sentry: z.object({
|
|
192
230
|
enabled: z.boolean(),
|
|
@@ -234,6 +272,15 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
|
|
|
234
272
|
base: z.string(),
|
|
235
273
|
icon: z.string().optional(),
|
|
236
274
|
mobileIcon: z.string().optional(),
|
|
275
|
+
// Kept so /server/info still satisfies common 0.1.44 (required
|
|
276
|
+
// theme.primaryHex) and RN 0.3.1 root-theme reads.
|
|
277
|
+
primaryHex: z.string().optional(),
|
|
278
|
+
logoFull: z.string().optional(),
|
|
279
|
+
logoSmall: z.string().optional(),
|
|
280
|
+
defaultProfileAvatar: z.string().optional(),
|
|
281
|
+
defaultGroupAvatar: z.string().optional(),
|
|
282
|
+
backgroundAuth: z.string().optional(),
|
|
283
|
+
background: z.string().optional(),
|
|
237
284
|
light: z.object({
|
|
238
285
|
primaryHex: z.string(),
|
|
239
286
|
secondaryHex: z.string().optional(),
|
|
@@ -283,6 +330,11 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
|
|
|
283
330
|
settings: z.object({
|
|
284
331
|
openRegistrations: z.boolean(),
|
|
285
332
|
defaultLanguage: z.string().optional(),
|
|
333
|
+
defaultTimeZone: z.string().optional(),
|
|
334
|
+
defaultFeedFormat: z.enum(['threaded', 'linear']).optional(),
|
|
335
|
+
/** Adds member profile pages to the sitemap. Off by default: a crawled
|
|
336
|
+
* profile is cached by search engines long after the member leaves. */
|
|
337
|
+
indexProfiles: z.boolean().optional(),
|
|
286
338
|
}),
|
|
287
339
|
roles: z.object({
|
|
288
340
|
onRegistration: z.object({
|
|
@@ -310,7 +362,7 @@ const addWildCardOptions = (capabilities) => {
|
|
|
310
362
|
[...firstLevelCategories].map((flc) => `${flc}-${wildCard}`),
|
|
311
363
|
[...secondLevelCategories].flatMap((slc) => [
|
|
312
364
|
...slc,
|
|
313
|
-
|
|
365
|
+
...[...slc].map((key) => `${key}-${wildCard}`),
|
|
314
366
|
]),
|
|
315
367
|
].flat();
|
|
316
368
|
};
|